cos-design 3.5.5 → 3.7.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 +37 -0
- package/README.md +87 -52
- package/dist/index.cjs +3 -3
- package/dist/index.css +1 -1
- package/dist/index.js +2378 -702
- package/dist/src/components/blurText/index.d.ts +21 -0
- package/dist/src/components/bubbleField/background.d.ts +3 -0
- package/dist/src/components/bubbleField/constants.d.ts +10 -0
- package/dist/src/components/bubbleField/index.d.ts +5 -0
- package/dist/src/components/bubbleField/merge.d.ts +5 -0
- package/dist/src/components/bubbleField/physics.d.ts +12 -0
- package/dist/src/components/bubbleField/render.d.ts +3 -0
- package/dist/src/components/bubbleField/types.d.ts +81 -0
- package/dist/src/components/bubbleField/utils.d.ts +6 -0
- package/dist/src/components/circularText/index.d.ts +17 -0
- package/dist/src/components/countUp/index.d.ts +19 -0
- package/dist/src/components/curvedLoop/index.d.ts +19 -0
- package/dist/src/components/fuzzyText/index.d.ts +21 -0
- package/dist/src/components/gameOfLife/index.d.ts +17 -0
- package/dist/src/components/index.d.ts +30 -0
- package/dist/src/components/networkGraph/index.d.ts +24 -0
- package/dist/src/components/rotatingText/index.d.ts +19 -0
- package/dist/src/components/sandFall/index.d.ts +13 -0
- package/dist/src/components/shinyText/index.d.ts +17 -0
- package/dist/src/components/splitText/index.d.ts +21 -0
- package/dist/src/components/springMass/index.d.ts +17 -0
- package/dist/src/components/textMorph/index.d.ts +15 -0
- package/dist/src/components/trueFocus/index.d.ts +25 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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`},w=15,T=258,E=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-T);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:w},(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,`%`]})]})},D={clickSpark:`cos-clickSpark-db9Om`,canvas:`cos-canvas-p9fnQ`,content:`cos-content-7uE4T`,hint:`cos-hint-UqpWX`},O=({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:D.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:D.canvas}),e&&(0,l.jsx)(`div`,{className:D.content,children:e}),!e&&(0,l.jsx)(`p`,{className:D.hint,children:`点击任意位置产生火花`})]})},k={confetti:`cos-confetti-MeNtU`,canvas:`cos-canvas-0T3Vs`,hint:`cos-hint-sGHEi`},A=[`#ff6b6b`,`#ffd93d`,`#6bcb77`,`#4d96ff`,`#a66cff`,`#ff85c0`,`#38bdf8`],j=()=>A[Math.floor(Math.random()*A.length)],M=(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:j(),width:Math.random()*8+4,height:Math.random()*6+3,alpha:1,gravity:Math.random()*.15+.12}})},N=(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(...M(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:k.confetti,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:a,className:k.canvas,style:{width:e,height:t},onClick:d}),(0,l.jsx)(`p`,{className:k.hint,children:`点击画布再次喷射`})]})});N.displayName=`Confetti`;var P={cyberGrid:`cos-cyberGrid-VgJwl`,canvas:`cos-canvas--Mq-O`},F=({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:P.cyberGrid,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:P.canvas,style:{width:e,height:t}})})},I={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`},ee=e=>e instanceof Date?e.getTime():typeof e==`number`?e:new Date(e).getTime(),L=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}},te=[{key:`days`,label:`天`},{key:`hours`,label:`时`},{key:`minutes`,label:`分`},{key:`seconds`,label:`秒`}],ne=({targetDate:e,onEnd:t,showLabels:n=!0,color:r=`#f472b6`})=>{let i=(0,c.useMemo)(()=>ee(e),[e]),a=!Number.isNaN(i),[,o]=(0,c.useState)(0),s=(0,c.useRef)(!1),u=(0,c.useRef)(t),d=a?L(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:I.countdown,style:{"--countdown-color":r},children:[te.map(({key:e,label:t})=>(0,l.jsxs)(`div`,{className:I.unit,children:[(0,l.jsx)(`div`,{className:I.value,children:String(d[e]).padStart(2,`0`)}),n&&(0,l.jsx)(`span`,{className:I.label,children:t})]},e)),d.total<=0&&(0,l.jsx)(`p`,{className:I.ended,children:`时间到!`})]}):(0,l.jsx)(`div`,{className:I.countdown,children:(0,l.jsx)(`p`,{className:I.invalid,children:`无效的目标时间`})})},re={dnaHelix:`cos-dnaHelix-nEQLW`,canvas:`cos-canvas-uEV8B`},ie=({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:re.dnaHelix,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:re.canvas,style:{width:e,height:t}})})},ae={electricArc:`cos-electricArc-BFlY3`,canvas:`cos-canvas-iowDx`},oe=(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=oe(e,t,o+f,s+p,i*.6,a-1),h=oe(o+f,s+p,n,r,i*.6,a-1);return[...m.slice(0,-1),...h]},se=({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=oe(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:ae.electricArc,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:r,className:ae.canvas,style:{width:e,height:t}})})},ce={cursorTrail:`cos-cursorTrail-fpz5p`,canvas:`cos-canvas-Iuyp3`,hint:`cos-hint-9GLHx`},le=({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:ce.cursorTrail,style:{width:n,height:r},children:[(0,l.jsx)(`canvas`,{ref:i,className:ce.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:ce.hint,children:`移动鼠标查看粒子轨迹`})]})},R={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`},ue={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}},de=({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=ue[e]??ue[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:R.dot,style:{left:`${e}%`,top:`${t}%`}},n));return(0,l.jsxs)(`div`,{className:R.diceRoll,children:[(0,l.jsx)(`div`,{className:R.scene,children:(0,l.jsx)(`div`,{className:`${R.cube} ${n?R.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:`${R.face} ${R[`face${e}`]}`,children:p(e)},e))})}),(0,l.jsx)(`button`,{type:`button`,className:R.rollBtn,onClick:f,disabled:n,children:n?`掷骰中...`:`掷骰子`}),!n&&(0,l.jsxs)(`p`,{className:R.result,children:[`点数: `,i]})]})},fe={doublePendulum:`cos-doublePendulum-FUEeK`,canvas:`cos-canvas-OVkhW`},pe=({width:e=400,height:t=400,trailLength:n=120,color:r=`#38bdf8`,color2:i=`#a78bfa`})=>{let a=(0,c.useRef)(null),o=(0,c.useRef)({theta1:Math.PI/2+.1,theta2:Math.PI/2-.2,omega1:0,omega2:0}),s=(0,c.useRef)([]);return(0,c.useEffect)(()=>{let c=a.current;if(!c)return;let l=window.devicePixelRatio||1;c.width=e*l,c.height=t*l;let u=c.getContext(`2d`);if(!u)return;u.setTransform(l,0,0,l,0,0);let d=e/2,f=t*.28,p=t*.28,m=t*.26,h=9.8,g=.016,v=0,y=document.hidden,b=_(e=>{y=e}),x=()=>{if(v=requestAnimationFrame(x),y)return;let a=o.current,{theta1:c,theta2:l,omega1:_,omega2:b}=a,S=Math.sin(c),C=Math.sin(c-l),w=Math.cos(c-l),T=Math.cos(c),E=p*(3-1*Math.cos(2*c-2*l)),D=(-9.8*3*S-1*h*Math.sin(c-2*l)-2*C*1*(b*b*m+_*_*p*w))/E,O=2*C*(_*_*p*2+h*2*T+b*b*m*1*w)/(m*(3-1*Math.cos(2*c-2*l)));a.omega1+=D*g,a.omega2+=O*g,a.theta1+=a.omega1*g,a.theta2+=a.omega2*g;let k=d+p*Math.sin(a.theta1),A=f+p*Math.cos(a.theta1),j=k+m*Math.sin(a.theta2),M=A+m*Math.cos(a.theta2),N=s.current;N.push({x:j,y:M}),N.length>n&&N.shift(),u.fillStyle=`rgba(15, 23, 42, 0.22)`,u.fillRect(0,0,e,t),N.length>1&&(u.beginPath(),N.forEach((e,t)=>t===0?u.moveTo(e.x,e.y):u.lineTo(e.x,e.y)),u.strokeStyle=i,u.lineWidth=1.5,u.globalAlpha=.7,u.stroke(),u.globalAlpha=1),u.beginPath(),u.moveTo(d,f),u.lineTo(k,A),u.lineTo(j,M),u.strokeStyle=`#64748b`,u.lineWidth=2,u.stroke(),u.beginPath(),u.arc(d,f,5,0,Math.PI*2),u.fillStyle=`#94a3b8`,u.fill(),u.beginPath(),u.arc(k,A,10,0,Math.PI*2),u.fillStyle=r,u.shadowColor=r,u.shadowBlur=10,u.fill(),u.shadowBlur=0,u.beginPath(),u.arc(j,M,10,0,Math.PI*2),u.fillStyle=i,u.shadowColor=i,u.shadowBlur=10,u.fill(),u.shadowBlur=0};return u.fillStyle=`#0f172a`,u.fillRect(0,0,e,t),x(),()=>{cancelAnimationFrame(v),b()}},[r,i,t,n,e]),(0,l.jsx)(`div`,{className:fe.doublePendulum,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:a,className:fe.canvas,style:{width:e,height:t}})})},me={fireworks:`cos-fireworks-fsSqL`,canvas:`cos-canvas-spL8G`,hint:`cos-hint-5XDRH`},he=[`#ff6b6b`,`#ffd93d`,`#6bcb77`,`#4d96ff`,`#a66cff`,`#ff85c0`],ge=.12,_e=240,ve=()=>he[Math.floor(Math.random()*he.length)],ye=(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:ve(),decay:Math.random()*.015+.01}})},be=(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:ve(),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+=ge,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>=_e;return(t||n||r||i)&&(e.exploded=!0,e.particles=ye(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:me.fireworks,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:i,className:me.canvas,style:{width:e,height:t},onClick:e=>{let t=e.currentTarget.getBoundingClientRect();s(e.clientX-t.left)}}),(0,l.jsx)(`p`,{className:me.hint,children:`点击画布燃放烟花`})]})});be.displayName=`Fireworks`;var z={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`},xe=(e,t)=>Math.max(0,Math.floor(e)).toString().padStart(t,`0`).slice(-t),Se=({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:z.digit,style:{"--flip-color":t,"--flip-duration":`${n}ms`},children:(0,l.jsxs)(`div`,{className:`${z.digitCard} ${i?z.isFlipping:``}`,children:[(0,l.jsx)(`div`,{className:z.staticTop,children:(0,l.jsx)(`span`,{children:u})}),(0,l.jsx)(`div`,{className:z.staticBottom,children:(0,l.jsx)(`span`,{children:u})}),i&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`div`,{className:`${z.flap} ${z.flapTop}`,children:(0,l.jsx)(`span`,{children:o})}),(0,l.jsx)(`div`,{className:`${z.flap} ${z.flapBottom}`,children:(0,l.jsx)(`span`,{children:e})})]})]})})},Ce=({value:e,digits:t=4,color:n=`#38bdf8`,duration:r=600})=>{let i=xe(e,t).split(``);return(0,l.jsx)(`div`,{className:z.flipCounter,children:i.map((e,t)=>(0,l.jsx)(Se,{digit:e,color:n,duration:r},t))})},we={gradientFlow:`cos-gradientFlow-XhN16`,text:`cos-text-ORuqk`,flow:`cos-flow-9FzMA`},Te=[`#ff00de`,`#7c3aed`,`#00f0ff`,`#38bdf8`,`#ff00de`],Ee=({text:e=`GRADIENT`,colors:t=Te,fontSize:n=64})=>{let r=t.length>=2?t.join(`, `):Te.join(`, `);return(0,l.jsx)(`div`,{className:we.gradientFlow,children:(0,l.jsx)(`h1`,{className:we.text,style:{fontSize:n,backgroundImage:`linear-gradient(90deg, ${r})`},children:e})})},De={glitchText:`cos-glitchText-dZ-sR`,text:`cos-text-JsPHN`,"glitch-1":`cos-glitch-1-s9pqH`,"glitch-2":`cos-glitch-2-GhFB-`},Oe=({text:e=`GLITCH`,color:t=`#f8fafc`,glitchColor1:n=`#ff00de`,glitchColor2:r=`#00f0ff`,fontSize:i=64})=>(0,l.jsx)(`div`,{className:De.glitchText,children:(0,l.jsx)(`h1`,{className:De.text,"data-text":e,style:{fontSize:i,"--glitch-color":t,"--glitch-c1":n,"--glitch-c2":r},children:e})}),ke={gravityBalls:`cos-gravityBalls-LdwFo`,canvas:`cos-canvas-n7esd`},Ae=[`#38bdf8`,`#a78bfa`,`#f472b6`,`#4ade80`,`#fbbf24`],je=({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:Ae[Math.floor(Math.random()*Ae.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:ke.gravityBalls,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:r,className:ke.canvas,style:{width:e,height:t}})})},B={wrap:`cos-wrap-r1gGL`,card:`cos-card-3W10s`,shine:`cos-shine-0xjID`,image:`cos-image-AV2XG`,placeholder:`cos-placeholder-wuuL3`,info:`cos-info-CNR0r`},Me=({title:e=`全息卡片`,subtitle:t=`移动鼠标体验 3D 效果`,image:n})=>{let r=(0,c.useRef)(null);return(0,l.jsx)(`div`,{className:B.wrap,children:(0,l.jsxs)(`div`,{ref:r,className:B.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:B.shine}),n?(0,l.jsx)(`img`,{src:n,alt:e,className:B.image}):(0,l.jsx)(`div`,{className:B.placeholder,children:(0,l.jsx)(`span`,{children:`✦`})}),(0,l.jsxs)(`div`,{className:B.info,children:[(0,l.jsx)(`h3`,{children:e}),(0,l.jsx)(`p`,{children:t})]})]})})},V={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`},Ne=({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:V.liquidProgress,style:{width:n,height:n,"--liquid-color":r},children:[(0,l.jsxs)(`svg`,{viewBox:`0 0 100 100`,className:V.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:V.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:V.fillBg}),(0,l.jsx)(`path`,{ref:i,className:V.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:V.ring,strokeWidth:10,fill:`none`})]}),(0,l.jsxs)(`span`,{className:V.label,children:[Math.round(o),`%`]})]})},Pe={lorenzAttractor:`cos-lorenzAttractor--UAI7`,canvas:`cos-canvas-oeXce`},Fe=({width:e=400,height:t=360,speed:n=1,color:r=`#f472b6`,pointCount:i=2e3})=>{let a=(0,c.useRef)(null),o=(0,c.useRef)(0);return(0,c.useEffect)(()=>{let s=a.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=.005,d=[],f=.1,p=0,m=0;for(let e=0;e<i;e++){let e=10*(p-f),t=f*(28-m)-p,n=f*p-2.6666666666666665*m;f+=e*u,p+=t*u,m+=n*u,d.push({x:f,y:p,z:m})}let h=0,g=document.hidden,v=_(e=>{g=e}),y=(n,r,i,a)=>{let o=Math.cos(a),s=Math.sin(a),c=n*o-i*s,l=n*s+i*o,u=r;return{x:e/2+c*6,y:t/2-u*6,depth:l}},b=()=>{if(h=requestAnimationFrame(b),g)return;o.current+=.004*n;let i=o.current;l.fillStyle=`rgba(15, 23, 42, 0.15)`,l.fillRect(0,0,e,t);let a=d.map(e=>y(e.x,e.y,e.z,i));l.beginPath(),a.forEach((e,t)=>t===0?l.moveTo(e.x,e.y):l.lineTo(e.x,e.y)),l.strokeStyle=r,l.globalAlpha=.75,l.lineWidth=.9,l.stroke(),l.globalAlpha=1,a.forEach((e,t)=>{if(t%50!=0)return;let n=.2+(e.depth+30)/60*.6;l.beginPath(),l.arc(e.x,e.y,1.5,0,Math.PI*2),l.fillStyle=`#fff`,l.globalAlpha=Math.max(.1,Math.min(n,.9)),l.fill()}),l.globalAlpha=1};return l.fillStyle=`#0f172a`,l.fillRect(0,0,e,t),b(),()=>{cancelAnimationFrame(h),v()}},[r,t,i,n,e]),(0,l.jsx)(`div`,{className:Pe.lorenzAttractor,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:a,className:Pe.canvas,style:{width:e,height:t}})})},Ie={liquidGlass:`cos-liquidGlass-Z3bQg`,panel:`cos-panel-XYboD`,content:`cos-content-MHfkS`},Le=({children:e=`液态玻璃面板`,blur:t=16,borderRadius:n=20})=>(0,l.jsx)(`div`,{className:Ie.liquidGlass,children:(0,l.jsx)(`div`,{className:Ie.panel,style:{"--glass-blur":`${t}px`,"--glass-radius":`${n}px`},children:(0,l.jsx)(`div`,{className:Ie.content,children:e})})}),Re={magneticButton:`cos-magneticButton-GbRkE`,btn:`cos-btn--b2BJ`},ze=({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:Re.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:Re.btn,style:{"--btn-color":n},children:e})})},Be={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:Be.matrixRain,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:s,className:Be.canvas,style:{width:e,height:t}}),i&&(0,l.jsxs)(`div`,{className:Be.overlay,children:[(0,l.jsx)(`h2`,{className:Be.title,children:a}),(0,l.jsx)(`p`,{className:Be.subtitle,children:o})]})]})},Ue={metaballPool:`cos-metaballPool-JJaI9`,canvas:`cos-canvas-S7fDD`},We=({width:e=400,height:t=300,ballCount:n=5,color:r=`#38bdf8`})=>{let i=(0,c.useRef)(null),a=(0,c.useRef)([]),o=(0,c.useRef)({x:-999,y:-999,active:!1});return(0,c.useEffect)(()=>{let r=Math.max(2,Math.min(n,10));a.current=Array.from({length:r},()=>({x:Math.random()*(e-80)+40,y:Math.random()*(t-80)+40,vx:(Math.random()-.5)*2,vy:(Math.random()-.5)*2,r:28+Math.random()*18}))},[n,t,e]),(0,c.useEffect)(()=>{let n=i.current;if(!n)return;let r=window.devicePixelRatio||1,s=.5,c=Math.floor(e*s),l=Math.floor(t*s);n.width=e*r,n.height=t*r;let u=n.getContext(`2d`);if(!u)return;u.setTransform(r,0,0,r,0,0);let d=document.createElement(`canvas`);d.width=c,d.height=l;let f=d.getContext(`2d`);if(!f)return;let p=(e,t)=>{let r=n.getBoundingClientRect();o.current={x:e-r.left,y:t-r.top,active:!0}},m=()=>{o.current.active=!1},h=e=>p(e.clientX,e.clientY),g=e=>{e.touches[0]&&p(e.touches[0].clientX,e.touches[0].clientY)};n.addEventListener(`mousemove`,h),n.addEventListener(`mouseleave`,m),n.addEventListener(`touchmove`,g,{passive:!0}),n.addEventListener(`touchend`,m);let y=0,b=document.hidden,x=_(e=>{b=e}),S=()=>{if(y=requestAnimationFrame(S),b)return;let n=a.current,r=o.current;for(let i of n){if(r.active){let e=i.x-r.x,t=i.y-r.y,n=Math.hypot(e,t)||1;if(n<120){let r=(120-n)*.04;i.vx+=e/n*r,i.vy+=t/n*r}}i.vx*=.98,i.vy*=.98,i.x+=i.vx,i.y+=i.vy,i.x-i.r<0?(i.x=i.r,i.vx*=-.8):i.x+i.r>e&&(i.x=e-i.r,i.vx*=-.8),i.y-i.r<0?(i.y=i.r,i.vy*=-.8):i.y+i.r>t&&(i.y=t-i.r,i.vy*=-.8)}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)*.55;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 i=f.createImageData(c,l),p=i.data;for(let e=0;e<l;e++)for(let t=0;t<c;t++){let r=t/s,i=e/s,a=0;for(let e of n){let t=r-e.x,n=i-e.y,o=t*t+n*n;a+=e.r*e.r/(o+1)}let o=(e*c+t)*4;a>1?(p[o]=56+v((a-1)*.8,0,1)*40,p[o+1]=189,p[o+2]=248,p[o+3]=255):p[o+3]=0}f.putImageData(i,0,0),u.fillStyle=`#0f172a`,u.fillRect(0,0,e,t),u.save(),u.filter=`blur(8px)`,u.drawImage(d,0,0,e,t),u.restore(),u.globalCompositeOperation=`lighter`,u.drawImage(d,0,0,e,t),u.globalCompositeOperation=`source-over`;for(let e of n){let t=u.createRadialGradient(e.x-e.r*.3,e.y-e.r*.3,0,e.x,e.y,e.r*.6);t.addColorStop(0,`rgba(255,255,255,0.5)`),t.addColorStop(1,`rgba(56,189,248,0)`),u.beginPath(),u.arc(e.x,e.y,e.r*.5,0,Math.PI*2),u.fillStyle=t,u.fill()}};return S(),()=>{cancelAnimationFrame(y),x(),n.removeEventListener(`mousemove`,h),n.removeEventListener(`mouseleave`,m),n.removeEventListener(`touchmove`,g),n.removeEventListener(`touchend`,m)}},[r,t,e]),(0,l.jsx)(`div`,{className:Ue.metaballPool,style:{width:e,height:t,"--pool-color":r},children:(0,l.jsx)(`canvas`,{ref:i,className:Ue.canvas,style:{width:e,height:t}})})},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}})})},Ye={neonText:`cos-neonText-JMP7i`,text:`cos-text-GTO-0`,flicker:`cos-flicker-nXceV`,"neon-flicker":`cos-neon-flicker-uDkmM`,reflection:`cos-reflection-aEYj6`},Xe=({text:e=`NEON`,color:t=`#ff00de`,fontSize:n=72,flicker:r=!0})=>(0,l.jsxs)(`div`,{className:Ye.neonText,children:[(0,l.jsx)(`h1`,{className:`${Ye.text} ${r?Ye.flicker:``}`,style:{fontSize:n,"--neon-color":t},children:e}),(0,l.jsx)(`p`,{className:Ye.reflection,style:{fontSize:n*.35,color:t},children:e})]}),Ze={newtonCradle:`cos-newtonCradle-mFl-b`,canvas:`cos-canvas-TWKl5`},Qe=({ballCount:e=5,color:t=`#38bdf8`,width:n=280,height:r=200})=>{let i=(0,c.useRef)(null),a=Math.max(2,Math.min(e,7));return(0,c.useEffect)(()=>{let e=i.current;if(!e)return;let o=window.devicePixelRatio||1;e.width=n*o,e.height=r*o;let s=e.getContext(`2d`);if(!s)return;s.setTransform(o,0,0,o,0,0);let c=r-28-28,l=(a-1)*28,u=(n-l)/2,d=1/60,f=Array.from({length:a},()=>({theta:0,omega:0}));f[0].theta=-.52;let p=`left`,m=e=>u+e*28,h=e=>{let t=f[e];return{x:m(e)+c*Math.sin(t.theta),y:16+c*Math.cos(t.theta)}},g=e=>{p===`left`&&(p=`right`,f[0].omega=0,f[0].theta=0,f[a-1].omega=Math.abs(e))},v=e=>{p===`right`&&(p=`left`,f[a-1].omega=0,f[a-1].theta=0,f[0].omega=-Math.abs(e))},y=()=>{let e=h(0),t=h(1);if(e.x+14>=t.x-14-.5&&f[0].omega>.02){g(f[0].omega);return}let n=h(a-1),r=h(a-2);n.x-14<=r.x+14+.5&&f[a-1].omega<-.02&&v(f[a-1].omega)},b=0,x=document.hidden,S=_(e=>{x=e}),C=()=>{if(b=requestAnimationFrame(C),!x){for(let e=0;e<a;e++){let t=f[e];if(Math.abs(t.omega)<1e-5&&Math.abs(t.theta)<1e-5)continue;let n=-(980/c)*Math.sin(t.theta);t.omega+=n*d,t.omega*=.9998,t.theta+=t.omega*d}y();for(let e=1;e<a-1;e++)f[e].theta=0,f[e].omega=0;s.fillStyle=`#0f172a`,s.fillRect(0,0,n,r),s.strokeStyle=`#475569`,s.lineWidth=3,s.beginPath(),s.moveTo(u-14,16),s.lineTo(u+l+14,16),s.stroke();for(let e=0;e<a;e++){let n=m(e),{x:r,y:i}=h(e);s.beginPath(),s.moveTo(n,16),s.lineTo(r,i),s.strokeStyle=`#64748b`,s.lineWidth=2,s.stroke(),s.beginPath(),s.arc(r,i,14,0,Math.PI*2);let a=s.createRadialGradient(r-14*.3,i-14*.3,0,r,i,14);a.addColorStop(0,`#fff`),a.addColorStop(.35,t),a.addColorStop(1,t),s.fillStyle=a,s.shadowColor=t,s.shadowBlur=6,s.fill(),s.shadowBlur=0}}};return C(),()=>{cancelAnimationFrame(b),S()}},[t,a,r,n]),(0,l.jsx)(`div`,{className:Ze.newtonCradle,style:{width:n,height:r,"--ball-color":t},children:(0,l.jsx)(`canvas`,{ref:i,className:Ze.canvas,style:{width:n,height:r}})})},$e={orbitalChart:`cos-orbitalChart-XLORB`,canvas:`cos-canvas-hGVud`,legend:`cos-legend-Np9Mm`,swatch:`cos-swatch-xEKvA`},et=[{label:`A`,value:30,color:`#38bdf8`},{label:`B`,value:25,color:`#a78bfa`},{label:`C`,value:20,color:`#f472b6`},{label:`D`,value:25,color:`#4ade80`}],tt=({data:e=et,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:$e.orbitalChart,style:{width:t,height:t},children:[(0,l.jsx)(`canvas`,{ref:n,className:$e.canvas,style:{width:t,height:t}}),(0,l.jsx)(`ul`,{className:$e.legend,children:e.map(e=>(0,l.jsxs)(`li`,{children:[(0,l.jsx)(`span`,{className:$e.swatch,style:{background:e.color}}),e.label,` (`,e.value,`)`]},e.label))})]})},nt={particleNetwork:`cos-particleNetwork-GSZq-`,canvas:`cos-canvas-E-BGP`,hint:`cos-hint-LEO5o`},rt=({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:nt.particleNetwork,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:o,className:nt.canvas,style:{width:e,height:t},onMouseMove:p,onMouseLeave:h,onTouchMove:m,onTouchEnd:h}),(0,l.jsx)(`p`,{className:nt.hint,children:`移动鼠标或手指与粒子互动`})]})},it={plasmaBall:`cos-plasmaBall-xGHSj`,canvas:`cos-canvas-V1CgL`},at=({width:e=320,height:t=320,color:n=`#a78bfa`,arcCount:r=8})=>{let i=(0,c.useRef)(null),a=(0,c.useRef)({x:e/2,y:t/2,active:!1}),o=(0,c.useRef)([]);return(0,c.useEffect)(()=>{o.current=Array.from({length:r},(e,t)=>({angle:t/r*Math.PI*2,length:.6+Math.random()*.35,speed:.02+Math.random()*.03}))},[r]),(0,c.useEffect)(()=>{let r=i.current;if(!r)return;let s=window.devicePixelRatio||1;r.width=e*s,r.height=t*s;let c=r.getContext(`2d`);if(!c)return;c.setTransform(s,0,0,s,0,0);let l=e/2,u=t/2,d=Math.min(e,t)*.38,f=(e,t)=>{let n=r.getBoundingClientRect();a.current={x:e-n.left,y:t-n.top,active:!0}},p=()=>{a.current.active=!1},m=e=>f(e.clientX,e.clientY),h=e=>{e.touches[0]&&f(e.touches[0].clientX,e.touches[0].clientY)};r.addEventListener(`mousemove`,m),r.addEventListener(`mouseleave`,p),r.addEventListener(`touchmove`,h,{passive:!0}),r.addEventListener(`touchend`,p);let g=0,v=document.hidden,y=_(e=>{v=e}),b=(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=b(e,t,o+f,s+p,i*.55,a-1),h=b(o+f,s+p,n,r,i*.55,a-1);return[...m.slice(0,-1),...h]},x=()=>{if(g=requestAnimationFrame(x),v)return;let r=a.current,i=o.current;c.fillStyle=`#0f172a`,c.fillRect(0,0,e,t);let s=c.createRadialGradient(l,u,d*.1,l,u,d*1.1);s.addColorStop(0,`rgba(30, 41, 59, 0.9)`),s.addColorStop(.7,`rgba(15, 23, 42, 0.6)`),s.addColorStop(1,`rgba(15, 23, 42, 0)`),c.beginPath(),c.arc(l,u,d*1.05,0,Math.PI*2),c.fillStyle=s,c.fill(),c.beginPath(),c.arc(l,u,d,0,Math.PI*2),c.strokeStyle=`rgba(148, 163, 184, 0.35)`,c.lineWidth=2,c.stroke(),i.forEach(e=>{e.angle+=e.speed*(Math.random()>.5?1:-1);let t=r.active?Math.atan2(r.y-u,r.x-l)+(e.angle-Math.PI)*.15:e.angle,i=d*e.length,a=b(l,u,l+Math.cos(t)*i,u+Math.sin(t)*i,18,4);c.beginPath(),a.forEach(([e,t],n)=>n===0?c.moveTo(e,t):c.lineTo(e,t)),c.strokeStyle=n,c.lineWidth=1.5,c.shadowColor=n,c.shadowBlur=14,c.globalAlpha=.85,c.stroke(),c.shadowBlur=0,c.globalAlpha=1}),c.beginPath(),c.arc(l,u,10,0,Math.PI*2);let f=c.createRadialGradient(l,u,0,l,u,10);f.addColorStop(0,`#fff`),f.addColorStop(.5,n),f.addColorStop(1,n),c.fillStyle=f,c.shadowColor=n,c.shadowBlur=20,c.fill(),c.shadowBlur=0};return x(),()=>{cancelAnimationFrame(g),y(),r.removeEventListener(`mousemove`,m),r.removeEventListener(`mouseleave`,p),r.removeEventListener(`touchmove`,h),r.removeEventListener(`touchend`,p)}},[r,n,t,e]),(0,l.jsx)(`div`,{className:it.plasmaBall,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:it.canvas,style:{width:e,height:t}})})},ot={smokeFog:`cos-smokeFog-SYlts`,canvas:`cos-canvas-iOJV7`},st=10,H=128,ct=`#d2d4d8`,lt=[`#14151c`,`#1a1b24`,`#0e0f14`],ut=(e,t)=>{let n=Math.sin(e*127.1+t*311.7)*43758.5453;return n-Math.floor(n)},dt=(e,t)=>{let n=Math.floor(e),r=Math.floor(t),i=e-n,a=t-r,o=i*i*(3-2*i),s=a*a*(3-2*a),c=ut(n,r),l=ut(n+1,r),u=ut(n,r+1),d=ut(n+1,r+1);return c+(l-c)*o+(u-c)*s+(c-l-u+d)*o*s},ft=(e,t)=>{let n=0,r=.5,i=1;for(let a=0;a<4;a++)n+=r*dt(e*i,t*i),i*=2.05,r*=.5;return n},pt=(e,t)=>{let n=e.replace(`#`,``).trim(),r=n.length===3?n.split(``).map(e=>e+e).join(``):n;if(r.length!==6)return t;let i=Number.parseInt(r,16);return Number.isNaN(i)?t:[i>>16&255,i>>8&255,i&255]},mt=(e,t,n)=>[Math.round(e[0]+(t[0]-e[0])*n),Math.round(e[1]+(t[1]-e[1])*n),Math.round(e[2]+(t[2]-e[2])*n)],ht=(e,t=1)=>t>=1?`rgb(${e[0]} ${e[1]} ${e[2]})`:`rgb(${e[0]} ${e[1]} ${e[2]} / ${t})`,gt=e=>{if(Array.isArray(e)&&e.length>=3)return[e[0],e[1],e[2]];let t=pt(typeof e==`string`?e:lt[2],[14,15,20]),n=mt(t,[255,255,255],.06);return[ht(mt(t,[255,255,255],.1)),ht(n),ht(t)]},_t=(e,t)=>{let n=document.createElement(`canvas`);n.width=H,n.height=H;let r=n.getContext(`2d`),i=r.createImageData(H,H),a=i.data,o=H/2,s=H/2,c=H*.48;for(let n=0;n<H;n++)for(let r=0;r<H;r++){let i=(r-o)/c,l=(n-s)/c,u=Math.hypot(i,l);if(u>1.15)continue;let d=ft(r*.045+e*17.1,n*.045+e*9.3)*.7+ft(r*.09-e*3.2,n*.09+e*5.7)*.3,f=u+(d-.45)*.55,p=1-Math.max(0,f);if(p=Math.max(0,p)**1.35,p*=.55+d*.7,p<.01)continue;let m=(n*H+r)*4,h=.88+d*.18;a[m]=Math.min(255,t[0]*h),a[m+1]=Math.min(255,t[1]*h+1),a[m+2]=Math.min(255,t[2]*h+3),a[m+3]=Math.min(255,p*210)}return r.putImageData(i,0,0),n},vt=e=>Array.from({length:st},(t,n)=>_t(n+1,e)),yt=(e,t,n=0)=>{let r=70+Math.random()*110,i=Math.min(.92,n*.88),a=t*(1-n*.92)+r*(.15-n*.1),o=(.32+Math.random()*.28)*(1-n*.55);return{x:Math.random()*e,y:a,vx:(Math.random()-.5)*.18,vy:-(.08+Math.random()*.16),size:r*(.7+i*.55),birthSize:r,maxSize:r*(1.8+Math.random()*1.4),rotation:Math.random()*Math.PI*2,spin:(Math.random()-.5)*.004,age:i,ageSpeed:4e-4+Math.random()*65e-5,opacity:o,sprite:Math.floor(Math.random()*st),stretch:.85+Math.random()*.55+n*.25,receptivity:.5+Math.random()*.85,mass:.5+Math.random()*.9,phase:Math.random()*Math.PI*2,warmth:Math.random()}},bt=(e,t)=>{let n=Math.hypot(e.vx,e.vy);if(n<=t)return;let r=t/n;e.vx*=r,e.vy*=r},xt=e=>e<.06?e/.06:e>.55?Math.max(0,1-(e-.55)/.45):1,St=(e,t)=>.22+Math.min(1,Math.max(0,e/t))**1.15*.78,Ct=({width:e=800,height:t=500,density:n=.5,color:r=ct,backgroundColor:i=lt,speed:a=1,disperseStrength:o=1,disperseRadius:s=1,interactive:u=!0})=>{let d=(0,c.useRef)(null),f=(0,c.useRef)([]),p=(0,c.useRef)([]),m=(0,c.useRef)(null),h=(0,c.useRef)(``),g=(0,c.useRef)(0),y=(0,c.useRef)({speed:a,disperseStrength:o,disperseRadius:s,interactive:u,color:r,backgroundColor:i});(0,c.useEffect)(()=>{y.current={speed:a,disperseStrength:o,disperseRadius:s,interactive:u,color:r,backgroundColor:i}},[a,o,s,u,r,i]),(0,c.useEffect)(()=>{m.current=vt(pt(r,[210,212,216])),h.current=r},[r]),(0,c.useEffect)(()=>{let r=Math.floor(56+n*100);f.current=Array.from({length:r},()=>yt(e,t,Math.random()**1.75))},[n,t,e]);let b=(0,c.useCallback)((n,r)=>{let i=y.current;if(!i.interactive)return;let a=d.current;if(!a)return;let o=a.getBoundingClientRect(),s=(n-o.left)/o.width*e,c=(r-o.top)/o.height*t,l=v(i.disperseRadius,0,3),u=v(i.disperseStrength,0,3);p.current.length>3&&p.current.shift(),p.current.push({x:s,y:c,life:1,swirl:Math.random()<.5?-1:1,radius:Math.min(e,t)*.08*l,maxRadius:Math.min(e,t)*(.42+Math.random()*.12)*l,strength:(.7+Math.random()*.25)*u})},[t,e]);return(0,c.useEffect)(()=>{let e=d.current;if(!e)return;let t=e=>{e.pointerType===`mouse`&&e.button!==0||b(e.clientX,e.clientY)};return e.addEventListener(`pointerdown`,t),()=>e.removeEventListener(`pointerdown`,t)},[b]),(0,c.useEffect)(()=>{let n=d.current;if(!n)return;let r=Math.min(window.devicePixelRatio||1,2);n.width=Math.floor(e*r),n.height=Math.floor(t*r);let i=n.getContext(`2d`);if(!i)return;i.setTransform(r,0,0,r,0,0);let a=pt(y.current.color,[210,212,216]);m.current||(m.current=vt(a),h.current=y.current.color);let o=m.current,s=0,c=document.hidden,l=_(e=>{c=e}),u=typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,b=()=>{let[n,r,a]=gt(y.current.backgroundColor),o=i.createLinearGradient(0,0,0,t);o.addColorStop(0,n),o.addColorStop(.45,r),o.addColorStop(1,a),i.fillStyle=o,i.fillRect(0,0,e,t);let s=pt(a,[14,15,20]),c=mt(s,[255,255,255],.22),l=i.createRadialGradient(e*.5,t*.75,0,e*.5,t,e*.55);l.addColorStop(0,ht(c,.35)),l.addColorStop(1,ht(s,0)),i.fillStyle=l,i.fillRect(0,0,e,t)},x=e=>{let n=xt(e.age)*St(e.y,t);if(n<=.01)return;let r=o[e.sprite],a=e.birthSize+(e.maxSize-e.birthSize)*Math.min(1,e.age*1.15),s=e.size+(a-e.size)*.35,c=s,l=s*e.stretch;i.save(),i.translate(e.x,e.y),i.rotate(e.rotation),i.globalAlpha=e.opacity*n*(.85+e.warmth*.2),i.globalCompositeOperation=`screen`,i.drawImage(r,-c/2,-l/2,c,l),i.restore()},S=()=>{if(g.current=requestAnimationFrame(S),c)return;let n=v(y.current.speed,0,3),r=v(y.current.disperseStrength,0,3);s+=.01*Math.max(n,.001),b(),h.current!==y.current.color&&(m.current=vt(pt(y.current.color,[210,212,216])),h.current=y.current.color);let a=m.current??o,l=f.current,u=p.current;for(let e=u.length-1;e>=0;e--){let t=u[e],n=1-t.life,i=Math.sin(Math.PI*Math.min(1,n*1.05))*t.strength;t.radius+=(t.maxRadius-t.radius)*.055;for(let e of l){let n=e.x-t.x,a=e.y-t.y,o=Math.hypot(n,a)||.001;if(o>t.radius)continue;let c=o/t.radius,l=Math.exp(-c*c*2.2)*(1-c*.35),u=Math.exp(-(((c-.72)/.32)**2)),d=l*.55+u*.45,f=.72+.28*Math.sin(e.phase*2.7+s*1.2+o*.03),p=d*e.receptivity*f*i;if(p<.02)continue;let m=n/o,h=a/o,g=-h*t.swirl,_=m*t.swirl,v=1/(.65+e.mass*.7),y=Math.sin(e.phase*4.2+s*1.6)*.35;e.vx+=(m*.55+g*.22+y*.12)*p*v,e.vy+=(h*.48+_*.22-.06)*p*v,e.opacity*=1-p*.028,e.maxSize*=1+p*.02,e.stretch+=p*.012,e.spin+=y*p*.004,bt(e,2.4*Math.max(r,.35))}t.life*=.972,t.life<.04&&u.splice(e,1)}i.save();for(let r=0;r<l.length;r++){let o=l[r],c=Math.sin(s*.55+o.phase)*.16,u=Math.cos(s*.4+o.phase*1.3)*.05;o.vx+=c*.018*n,o.vy+=u*.01*n-.0035*n;let d=Math.hypot(o.vx,o.vy),f=d>.8?.975:.99;o.vx*=f,o.vy*=f,o.x+=o.vx*n,o.y+=o.vy*n,o.rotation+=(o.spin+o.vx*.002)*n,o.age+=o.ageSpeed*n;let p=o.birthSize+(o.maxSize-o.birthSize)*Math.min(1,o.age*1.15);o.size+=(p-o.size)*.04;let m=(.3+o.warmth*.1)*St(o.y,t),h=.006+.008*Math.max(0,1-d/2.2);if(o.opacity+=(m-o.opacity)*h,o.stretch+=(1.05+(1-o.y/t)*.55-o.stretch)*.01,o.age>=1||o.y<-o.size||o.opacity<.02){l[r]=yt(e,t,0);continue}o.x<-o.size&&(o.x=e+o.size*.5),o.x>e+o.size&&(o.x=-o.size*.5);let g=xt(o.age)*St(o.y,t);if(g<=.01)continue;let _=a[o.sprite],v=o.birthSize+(o.maxSize-o.birthSize)*Math.min(1,o.age*1.15),y=o.size+(v-o.size)*.35,b=y,x=y*o.stretch;i.save(),i.translate(o.x,o.y),i.rotate(o.rotation),i.globalAlpha=o.opacity*g*(.85+o.warmth*.2),i.globalCompositeOperation=`screen`,i.drawImage(_,-b/2,-x/2,b,x),i.restore()}i.restore(),i.globalCompositeOperation=`source-over`,i.globalAlpha=1};if(u){b();for(let e of f.current)x(e);return i.globalCompositeOperation=`source-over`,i.globalAlpha=1,()=>{l()}}return S(),()=>{cancelAnimationFrame(g.current),l()}},[t,e]),(0,l.jsx)(`div`,{className:ot.smokeFog,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:d,className:ot.canvas,style:{width:e,height:t,cursor:u?`pointer`:`default`},role:`img`,"aria-label":u?`烟雾背景,点击可驱散`:`烟雾背景`})})},wt={solarSystem:`cos-solarSystem-27h8F`,canvas:`cos-canvas-C0nRa`},Tt=[{name:`Mercury`,radius:0,orbit:42,speed:4.8,color:`#94a3b8`,size:3},{name:`Venus`,radius:0,orbit:58,speed:3.5,color:`#fbbf24`,size:5},{name:`Earth`,radius:0,orbit:78,speed:3,color:`#38bdf8`,size:5},{name:`Mars`,radius:0,orbit:98,speed:2.4,color:`#f87171`,size:4},{name:`Jupiter`,radius:0,orbit:130,speed:1.6,color:`#fb923c`,size:12},{name:`Saturn`,radius:0,orbit:160,speed:1.2,color:`#fcd34d`,size:10},{name:`Moon`,radius:0,orbit:14,speed:8,color:`#cbd5e1`,size:2,parent:2}],Et=({width:e=400,height:t=400,speed:n=1,showOrbits:r=!0})=>{let i=(0,c.useRef)(null),a=(0,c.useRef)([]),o=(0,c.useRef)([]);return(0,c.useEffect)(()=>{a.current=Tt.map(e=>({...e,angle:Math.random()*Math.PI*2})),o.current=Array.from({length:80},()=>({x:Math.random(),y:Math.random(),alpha:Math.random()*.6}))},[]),(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=e/2,d=t/2,f=Math.min(e,t)/380,p=0,m=document.hidden,h=_(e=>{m=e}),g=()=>{if(p=requestAnimationFrame(g),m)return;let i=a.current,s=[];l.fillStyle=`#0f172a`,l.fillRect(0,0,e,t),o.current.forEach(n=>{l.fillStyle=`rgba(255,255,255,${n.alpha})`,l.fillRect(n.x*e,n.y*t,1,1)}),l.beginPath(),l.arc(u,d,18*f,0,Math.PI*2);let c=l.createRadialGradient(u,d,0,u,d,18*f);c.addColorStop(0,`#fef08a`),c.addColorStop(.5,`#fbbf24`),c.addColorStop(1,`#f97316`),l.fillStyle=c,l.shadowColor=`#fbbf24`,l.shadowBlur=24,l.fill(),l.shadowBlur=0,i.forEach((e,t)=>{e.angle+=e.speed*.008*n/Math.sqrt(e.orbit);let i=u,a=d;e.parent!==void 0&&s[e.parent]&&(i=s[e.parent].x,a=s[e.parent].y);let o=e.orbit*f,c=i+Math.cos(e.angle)*o,p=a+Math.sin(e.angle)*o;if(s[t]={x:c,y:p},r&&e.parent===void 0&&(l.beginPath(),l.arc(i,a,o,0,Math.PI*2),l.strokeStyle=`rgba(148, 163, 184, 0.15)`,l.lineWidth=1,l.stroke()),e.name===`Saturn`&&(l.beginPath(),l.ellipse(c,p,e.size*f*1.8,e.size*f*.5,e.angle*.3,0,Math.PI*2),l.strokeStyle=`rgba(252, 211, 77, 0.5)`,l.lineWidth=1.5,l.stroke()),l.beginPath(),l.arc(c,p,e.size*f,0,Math.PI*2),l.fillStyle=e.color,e.name===`Earth`){let t=l.createRadialGradient(c-2,p-2,0,c,p,e.size*f);t.addColorStop(0,`#4ade80`),t.addColorStop(.6,e.color),t.addColorStop(1,`#1d4ed8`),l.fillStyle=t}l.fill()})};return g(),()=>{cancelAnimationFrame(p),h()}},[t,r,n,e]),(0,l.jsx)(`div`,{className:wt.solarSystem,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:wt.canvas,style:{width:e,height:t}})})},Dt={snowfall:`cos-snowfall-Q-Dhg`,canvas:`cos-canvas-bJVF8`},Ot=({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:Dt.snowfall,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:Dt.canvas,style:{width:e,height:t}})})},kt={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:kt.starfield,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:kt.canvas,style:{width:e,height:t}})})},U={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`},jt=({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:U.progressChest,children:[(0,l.jsxs)(`div`,{className:U.barWrap,children:[(0,l.jsx)(`div`,{className:U.barTrack,children:(0,l.jsx)(`div`,{className:U.barFill,style:{width:`${a}%`}})}),(0,l.jsxs)(`span`,{className:U.pct,children:[a.toFixed(0),`%`]})]}),(0,l.jsxs)(`div`,{className:`${U.chest} ${o?U.open:``}`,children:[(0,l.jsxs)(`div`,{className:U.lid,children:[(0,l.jsx)(`div`,{className:U.lidTop}),(0,l.jsx)(`div`,{className:U.lock})]}),(0,l.jsx)(`div`,{className:U.body,children:o&&(0,l.jsxs)(`div`,{className:U.treasure,children:[(0,l.jsx)(`span`,{children:`💎`}),(0,l.jsx)(`span`,{children:`✨`}),(0,l.jsx)(`span`,{children:`🪙`})]})})]}),(0,l.jsx)(`p`,{className:U.label,children:o?`宝箱已开启!`:n})]})},Mt={radarScan:`cos-radarScan-PZaG8`,canvas:`cos-canvas-fUw5N`},Nt=({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:Mt.radarScan,style:{width:e,height:e},children:(0,l.jsx)(`canvas`,{ref:r,className:Mt.canvas,style:{width:e,height:e}})})},Pt={redPacketRain:`cos-redPacketRain-eJ7FW`,canvas:`cos-canvas-direH`,hud:`cos-hud-InqMq`,end:`cos-end-u0J7o`,hint:`cos-hint-sO6ld`},Ft=({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:Pt.redPacketRain,children:[(0,l.jsx)(`canvas`,{ref:n,className:Pt.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:Pt.hud,children:[(0,l.jsxs)(`span`,{children:[`已抢: ¥`,s]}),!d&&(0,l.jsx)(`span`,{className:Pt.end,children:`红包雨结束`})]}),(0,l.jsx)(`p`,{className:Pt.hint,children:`点击红包抢夺`})]})},It={returnCityContainer:`cos-returnCityContainer-6XTxj`,star:`cos-star-a59Dx`,glassWrap:`cos-glassWrap-golMO`,rotate:`cos-rotate-7X9Jj`,glassItem:`cos-glassItem-OwlFI`},Lt=({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=It.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=It.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:It.returnCityContainer,children:(0,l.jsx)(`div`,{ref:i,className:It.glassWrap})})},Rt={ropeChain:`cos-ropeChain-gYaSK`,canvas:`cos-canvas-5i95N`},zt=({width:e=400,height:t=400,segments:n=16,color:r=`#38bdf8`,gravity:i=.4})=>{let a=(0,c.useRef)(null),o=(0,c.useRef)([]),s=(0,c.useRef)({active:!1,index:-1});return(0,c.useEffect)(()=>{let r=Math.max(4,Math.min(n,30)),i=t*.7/r,a=e/2,s=t*.08;o.current=Array.from({length:r+1},(e,t)=>({x:a,y:s+t*i,prevX:a,prevY:s+t*i,pinned:t===0}))},[t,n,e]),(0,c.useEffect)(()=>{let c=a.current;if(!c)return;let l=window.devicePixelRatio||1;c.width=e*l,c.height=t*l;let u=c.getContext(`2d`);if(!u)return;u.setTransform(l,0,0,l,0,0);let d=Math.max(4,Math.min(n,30)),f=t*.7/d,p=(e,t)=>{let n=o.current,r=-1,i=30;return n.forEach((n,a)=>{let o=Math.hypot(n.x-e,n.y-t);o<i&&(i=o,r=a)}),r},m=(e,t)=>{let n=c.getBoundingClientRect(),r=e-n.left,i=t-n.top,a=p(r,i);if(a>=0){s.current={active:!0,index:a};let e=o.current[a];e.x=r,e.y=i,e.prevX=r,e.prevY=i}},h=(e,t)=>{if(!s.current.active)return;let n=c.getBoundingClientRect(),r=o.current[s.current.index];r.x=e-n.left,r.y=t-n.top},g=()=>{s.current={active:!1,index:-1}},v=e=>m(e.clientX,e.clientY),y=e=>h(e.clientX,e.clientY),b=e=>{e.touches[0]&&m(e.touches[0].clientX,e.touches[0].clientY)},x=e=>{e.touches[0]&&h(e.touches[0].clientX,e.touches[0].clientY)};c.addEventListener(`mousedown`,v),c.addEventListener(`mousemove`,y),window.addEventListener(`mouseup`,g),c.addEventListener(`touchstart`,b,{passive:!0}),c.addEventListener(`touchmove`,x,{passive:!0}),window.addEventListener(`touchend`,g);let S=0,C=document.hidden,w=_(e=>{C=e}),T=()=>{if(S=requestAnimationFrame(T),C)return;let n=o.current,a=s.current;for(let e of n){if(e.pinned||a.active&&n.indexOf(e)===a.index)continue;let t=(e.x-e.prevX)*.99,r=(e.y-e.prevY)*.99;e.prevX=e.x,e.prevY=e.y,e.x+=t,e.y+=r,e.y+=i}for(let e=0;e<6;e++)for(let e=0;e<n.length-1;e++){let t=n[e],r=n[e+1],i=r.x-t.x,o=r.y-t.y,s=Math.hypot(i,o)||.001,c=(s-f)/s,l=i*c*.5,u=o*c*.5;!t.pinned&&!(a.active&&e===a.index)&&(t.x+=l,t.y+=u),!r.pinned&&!(a.active&&e+1===a.index)&&(r.x-=l,r.y-=u)}u.fillStyle=`#0f172a`,u.fillRect(0,0,e,t),u.beginPath(),n.forEach((e,t)=>t===0?u.moveTo(e.x,e.y):u.lineTo(e.x,e.y)),u.strokeStyle=r,u.lineWidth=3,u.lineCap=`round`,u.lineJoin=`round`,u.shadowColor=r,u.shadowBlur=8,u.stroke(),u.shadowBlur=0,n.forEach((e,t)=>{(t===0||t===n.length-1||t%4==0)&&(u.beginPath(),u.arc(e.x,e.y,t===0?6:4,0,Math.PI*2),u.fillStyle=t===0?`#94a3b8`:r,u.fill())})};return T(),()=>{cancelAnimationFrame(S),w(),c.removeEventListener(`mousedown`,v),c.removeEventListener(`mousemove`,y),window.removeEventListener(`mouseup`,g),c.removeEventListener(`touchstart`,b),c.removeEventListener(`touchmove`,x),window.removeEventListener(`touchend`,g)}},[r,i,t,n,e]),(0,l.jsx)(`div`,{className:Rt.ropeChain,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:a,className:Rt.canvas,style:{width:e,height:t}})})},W={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`},G=(e,t,n,r)=>{let i=(r-90)*Math.PI/180;return{x:e+n*Math.cos(i),y:t+n*Math.sin(i)}},Bt=({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=G(100,100,72,-120),t=G(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=G(100,100,72,-120),t=G(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=G(100,100,58,i);return(0,l.jsxs)(`div`,{className:W.speedometer,style:{"--gauge-color":r},children:[(0,l.jsxs)(`svg`,{viewBox:`0 0 200 130`,className:W.svg,children:[(0,l.jsx)(`path`,{d:a,className:W.track,fill:`none`,strokeWidth:`12`,strokeLinecap:`round`}),(0,l.jsx)(`path`,{d:o,className:W.valueArc,fill:`none`,strokeWidth:`12`,strokeLinecap:`round`}),[-120,-60,0,60,120].map(e=>{let t=G(100,100,58,e),n=G(100,100,66,e);return(0,l.jsx)(`line`,{x1:t.x,y1:t.y,x2:n.x,y2:n.y,className:W.tick},e)}),(0,l.jsx)(`line`,{x1:`100`,y1:`100`,x2:s.x,y2:s.y,className:W.needle}),(0,l.jsx)(`circle`,{cx:`100`,cy:`100`,r:`6`,className:W.hub}),(0,l.jsx)(`text`,{x:`100`,y:`118`,className:W.valueText,children:Math.round(e)})]}),(0,l.jsx)(`span`,{className:W.label,children:n})]})},K={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`},Vt=({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:K.timelinePulse,style:{"--pulse-color":n,"--step-count":e.length,"--progress-ratio":i},children:(0,l.jsxs)(`div`,{className:K.axis,children:[(0,l.jsx)(`div`,{className:K.track}),(0,l.jsx)(`div`,{className:K.progress}),(0,l.jsx)(`ul`,{className:K.steps,children:e.map((e,t)=>{let n=t<r?`done`:t===r?`current`:`pending`;return(0,l.jsxs)(`li`,{className:K.step,"data-state":n,children:[(0,l.jsx)(`span`,{className:K.dot}),(0,l.jsx)(`span`,{className:K.name,children:e})]},e+t)})})]})})},Ht={rippleWater:`cos-rippleWater-wsinI`,canvas:`cos-canvas-XOdSF`,hint:`cos-hint-0JH5D`},Ut=`
|
|
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={blurText:`cos-blurText-I8PNq`,text:`cos-text-t-IfM`,unit:`cos-unit-8HSAb`,idle:`cos-idle-OqUeJ`,top:`cos-top-j8xKn`,enter:`cos-enter-ZtGBp`,blurFromTop:`cos-blurFromTop-7baxF`,bottom:`cos-bottom-s-Evv`,blurFromBottom:`cos-blurFromBottom-UMwhj`},p=({text:e=`BLUR TEXT`,animateBy:t=`words`,direction:n=`top`,stagger:r=120,duration:i=500,fontSize:a=56,color:o=`#f8fafc`,onAnimationComplete:s})=>{let[u,d]=(0,c.useState)(!1),p=(0,c.useRef)(null),m=(0,c.useRef)(!1),h=(0,c.useMemo)(()=>t===`words`?e.split(` `):e.split(``),[t,e]);return(0,c.useEffect)(()=>{let e=p.current;if(!e)return;let t=new IntersectionObserver(([e])=>{e.isIntersecting&&(d(!0),t.disconnect())},{threshold:.15});return t.observe(e),()=>t.disconnect()},[]),(0,c.useEffect)(()=>{if(!u||m.current||!s)return;let e=h.length*r+i,t=window.setTimeout(()=>{m.current=!0,s()},e);return()=>window.clearTimeout(t)},[i,h.length,u,s,r]),(0,l.jsx)(`div`,{className:f.blurText,ref:p,children:(0,l.jsx)(`p`,{className:f.text,style:{fontSize:a,"--blur-color":o,"--blur-duration":`${i}ms`},children:h.map((e,i)=>(0,l.jsxs)(`span`,{className:`${f.unit} ${f[n]} ${u?f.enter:f.idle}`,style:{animationDelay:`${i*r}ms`},children:[e===` `?`\xA0`:e,t===`words`&&i<h.length-1?`\xA0`:null]},`${e}-${i}`))})})},m={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`},h=({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),f=(0,c.useRef)(n);(0,c.useEffect)(()=>{f.current=n},[n]);let p=(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,p=Math.ceil(c.width),m=Math.ceil(c.height);o.width=p*l,o.height=m*l,o.style.width=`${p}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=p*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,p/2,m/2);let v=_.getImageData(0,0,p*l,m*l).data,y=[];for(let e=0;e<m;e+=4)for(let t=0;t<p;t+=4)v[(Math.floor(e*l)*p*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,p,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,f.current?.()))};return b=requestAnimationFrame(e=>C(e,e)),()=>{S=!0,cancelAnimationFrame(b)}},[a,s,e,t]),(0,l.jsxs)(`div`,{className:m.burnAway,children:[(0,l.jsxs)(`div`,{ref:r,className:m.stage,children:[!s&&(0,l.jsx)(`span`,{className:m.text,style:{fontSize:t,opacity:+!a},children:e}),(0,l.jsx)(`canvas`,{ref:i,className:m.canvas})]}),!a&&!s&&(0,l.jsx)(`button`,{type:`button`,className:m.trigger,onClick:p,children:`Ignite`}),s&&(0,l.jsx)(`p`,{className:m.hint,children:`Gone.`})]})},g={aurora:`cos-aurora-dJJb8`,band:`cos-band-S5CoR`,"aurora-flow":`cos-aurora-flow-wU8TY`},_=[`#00ff87`,`#60efff`,`#7b2ff7`,`#f107a3`],v=({width:e=800,height:t=500,colors:n=_})=>{let r=n.length>=2?n:_;return(0,l.jsx)(`div`,{className:g.aurora,style:{width:e,height:t},children:r.map((e,t)=>(0,l.jsx)(`div`,{className:g.band,style:{"--aurora-color":e,"--aurora-delay":`${t*-3}s`,"--aurora-duration":`${12+t*2}s`}},e+t))})},y=e=>{let t=()=>e(document.hidden);return document.addEventListener(`visibilitychange`,t),()=>document.removeEventListener(`visibilitychange`,t)},b=(e,t,n)=>Math.min(n,Math.max(t,e)),x={audioVisualizer:`cos-audioVisualizer-r5dHp`,canvas:`cos-canvas-UNEea`},S=({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=y(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 _=()=>{if(c=requestAnimationFrame(_),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 _(),()=>{h=!0,cancelAnimationFrame(c),g(),p?.getTracks().forEach(e=>e.stop()),u?.close()}},[n,t,r,e]),(0,l.jsx)(`div`,{className:x.audioVisualizer,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:x.canvas,style:{width:e,height:t}})})},C={canvasClock:`cos-canvasClock-QvdV3`,canvasTarget:`cos-canvasTarget-x-odC`},w=({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=y(e=>{s=e}),l=()=>{s||o(i),a=requestAnimationFrame(l)};return l(),()=>{cancelAnimationFrame(a),c()}},[o,r]),(0,l.jsx)(`div`,{className:C.canvasClock,style:{width:r,height:r},children:(0,l.jsx)(`canvas`,{ref:n,className:C.canvasTarget,style:{width:r,height:r}})})},T={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`},E=15,D=258,O=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)(()=>b(t,0,100)),p=b(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-D);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:T.chargeContainer,"data-auto":i?`true`:`false`,style:{"--charge-pct":p},children:[(0,l.jsxs)(`div`,{className:T.contrast,children:[Array.from({length:E},(e,t)=>(0,l.jsx)(`span`,{className:T.bubble,"data-index":t+1},t)),(0,l.jsx)(`div`,{className:T.circle}),(0,l.jsx)(`div`,{className:T.button})]}),(0,l.jsxs)(`div`,{className:T.text,children:[g,`%`]})]})},k={circularText:`cos-circularText--zmER`,scaleWrap:`cos-scaleWrap-LiyQK`,bonkers:`cos-bonkers-Wovjy`,ring:`cos-ring-2amY8`,spin:`cos-spin-9njNq`,char:`cos-char-oPqHL`},A=({text:e=`COS DESIGN • REACT BITS • `,spinDuration:t=20,onHover:n=`speedUp`,fontSize:r=22,radius:i=90,color:a=`#f8fafc`})=>{let[o,s]=(0,c.useState)(!1),u=(0,c.useMemo)(()=>Array.from(e),[e]),d=(0,c.useMemo)(()=>{if(!o)return t;switch(n){case`slowDown`:return t*2;case`speedUp`:return t/4;case`pause`:return 0;case`goBonkers`:return Math.max(t/20,.2);default:return t}},[o,n,t]),f=i*2+r*2;return(0,l.jsx)(`div`,{className:k.circularText,children:(0,l.jsx)(`div`,{className:`${k.scaleWrap} ${o&&n===`goBonkers`?k.bonkers:``}`,onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),children:(0,l.jsx)(`div`,{className:k.ring,style:{width:f,height:f,color:a,fontSize:r,animationDuration:d>0?`${d}s`:void 0,animationPlayState:d===0?`paused`:`running`},children:u.map((e,t)=>{let n=360/u.length*t;return(0,l.jsx)(`span`,{className:k.char,style:{transform:`rotate(${n}deg) translateY(-${i}px)`},children:e===` `?`\xA0`:e},`${e}-${t}`)})})})})},j={clickSpark:`cos-clickSpark-db9Om`,canvas:`cos-canvas-p9fnQ`,content:`cos-content-7uE4T`,hint:`cos-hint-UqpWX`},M=({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=y(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:j.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:j.canvas}),e&&(0,l.jsx)(`div`,{className:j.content,children:e}),!e&&(0,l.jsx)(`p`,{className:j.hint,children:`点击任意位置产生火花`})]})},N={confetti:`cos-confetti-MeNtU`,canvas:`cos-canvas-0T3Vs`,hint:`cos-hint-sGHEi`},ee=[`#ff6b6b`,`#ffd93d`,`#6bcb77`,`#4d96ff`,`#a66cff`,`#ff85c0`,`#38bdf8`],te=()=>ee[Math.floor(Math.random()*ee.length)],ne=(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:te(),width:Math.random()*8+4,height:Math.random()*6+3,alpha:1,gravity:Math.random()*.15+.12}})},re=(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(...ne(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=y(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:N.confetti,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:a,className:N.canvas,style:{width:e,height:t},onClick:d}),(0,l.jsx)(`p`,{className:N.hint,children:`点击画布再次喷射`})]})});re.displayName=`Confetti`;var P={curvedLoop:`cos-curvedLoop-dtMD7`,svg:`cos-svg-YDyYF`,measure:`cos-measure-1lmnX`,pathText:`cos-pathText-SKIrW`},ie=({text:e=`COS DESIGN ✦ CURVED LOOP ✦ `,speed:t=2,curveAmount:n=80,direction:r=`left`,interactive:i=!0,color:a=`#f8fafc`,fontSize:o=56})=>{let s=(0,c.useMemo)(()=>(/\s|\u00A0$/.test(e)?e.replace(/\s+$/,``):e)+`\xA0`,[e]),u=(0,c.useRef)(null),d=(0,c.useRef)(null),[f,p]=(0,c.useState)(0),[m,h]=(0,c.useState)(0),g=`curve-${(0,c.useId)().replace(/:/g,``)}`,_=`M-100,40 Q500,${40+n} 1540,40`,v=(0,c.useRef)(!1),y=(0,c.useRef)(0),b=(0,c.useRef)(r),x=(0,c.useRef)(0),S=f?Array(Math.ceil(1800/f)+2).fill(s).join(``):s,C=f>0;(0,c.useEffect)(()=>{b.current=r},[r]),(0,c.useEffect)(()=>{u.current&&p(u.current.getComputedTextLength())},[s,o]),(0,c.useEffect)(()=>{if(!f||!d.current)return;let e=-f;d.current.setAttribute(`startOffset`,`${e}px`),h(e)},[f]),(0,c.useEffect)(()=>{if(!f||!C)return;let e=0,n=()=>{if(!v.current&&d.current){let e=b.current===`right`?t:-t,n=Number.parseFloat(d.current.getAttribute(`startOffset`)||`0`)+e;n<=-f&&(n+=f),n>0&&(n-=f),d.current.setAttribute(`startOffset`,`${n}px`),h(n)}e=requestAnimationFrame(n)};return e=requestAnimationFrame(n),()=>cancelAnimationFrame(e)},[C,f,t]);let w=e=>{i&&(v.current=!0,y.current=e.clientX,x.current=0,e.target.setPointerCapture(e.pointerId))},T=e=>{if(!i||!v.current||!d.current)return;let t=e.clientX-y.current;y.current=e.clientX,x.current=t;let n=Number.parseFloat(d.current.getAttribute(`startOffset`)||`0`)+t;n<=-f&&(n+=f),n>0&&(n-=f),d.current.setAttribute(`startOffset`,`${n}px`),h(n)},E=()=>{i&&(v.current=!1,b.current=x.current>0?`right`:`left`)};return(0,l.jsx)(`div`,{className:P.curvedLoop,style:{visibility:C?`visible`:`hidden`,cursor:i?`grab`:`default`,"--curve-color":a,"--curve-font-size":`${o}px`},onPointerDown:w,onPointerMove:T,onPointerUp:E,onPointerLeave:E,children:(0,l.jsxs)(`svg`,{className:P.svg,viewBox:`0 0 1440 120`,children:[(0,l.jsx)(`text`,{ref:u,xmlSpace:`preserve`,className:P.measure,children:s}),(0,l.jsx)(`defs`,{children:(0,l.jsx)(`path`,{id:g,d:_,fill:`none`,stroke:`transparent`})}),C&&(0,l.jsx)(`text`,{xmlSpace:`preserve`,className:P.pathText,children:(0,l.jsx)(`textPath`,{ref:d,href:`#${g}`,startOffset:`${m}px`,xmlSpace:`preserve`,children:S})})]})})},ae={cyberGrid:`cos-cyberGrid-VgJwl`,canvas:`cos-canvas--Mq-O`},oe=({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=y(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:ae.cyberGrid,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:ae.canvas,style:{width:e,height:t}})})},F={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`},se=e=>e instanceof Date?e.getTime():typeof e==`number`?e:new Date(e).getTime(),ce=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}},le=[{key:`days`,label:`天`},{key:`hours`,label:`时`},{key:`minutes`,label:`分`},{key:`seconds`,label:`秒`}],ue=({targetDate:e,onEnd:t,showLabels:n=!0,color:r=`#f472b6`})=>{let i=(0,c.useMemo)(()=>se(e),[e]),a=!Number.isNaN(i),[,o]=(0,c.useState)(0),s=(0,c.useRef)(!1),u=(0,c.useRef)(t),d=a?ce(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:F.countdown,style:{"--countdown-color":r},children:[le.map(({key:e,label:t})=>(0,l.jsxs)(`div`,{className:F.unit,children:[(0,l.jsx)(`div`,{className:F.value,children:String(d[e]).padStart(2,`0`)}),n&&(0,l.jsx)(`span`,{className:F.label,children:t})]},e)),d.total<=0&&(0,l.jsx)(`p`,{className:F.ended,children:`时间到!`})]}):(0,l.jsx)(`div`,{className:F.countdown,children:(0,l.jsx)(`p`,{className:F.invalid,children:`无效的目标时间`})})},I={countUp:`cos-countUp-PKMgo`,glow:`cos-glow-oAz5z`,value:`cos-value-WDAyV`,valueWrap:`cos-valueWrap-AQoM4`,measure:`cos-measure-ZGRt4`,display:`cos-display-JHXA2`},de=e=>1-(1-e)**3,fe=(e,t)=>e.toLocaleString(`en-US`,{minimumFractionDigits:t,maximumFractionDigits:t}),pe=({value:e,start:t=0,duration:n=1400,decimals:r=0,prefix:i=``,suffix:a=``,color:o=`#34d399`})=>{let[s,u]=(0,c.useState)(t),d=(0,c.useRef)(0),f=(0,c.useRef)(t);(0,c.useEffect)(()=>{let t=f.current,r=e,i=performance.now();cancelAnimationFrame(d.current);let a=e=>{let o=Math.min(1,(e-i)/Math.max(n,16)),s=de(o);u(t+(r-t)*s),o<1?d.current=requestAnimationFrame(a):f.current=r};return d.current=requestAnimationFrame(a),()=>cancelAnimationFrame(d.current)},[n,e]);let p=(0,c.useMemo)(()=>`${i}${fe(s,r)}${a}`,[r,s,i,a]),m=(0,c.useMemo)(()=>{let n=[t,e].map(e=>`${i}${fe(e,r)}${a}`);return n.reduce((e,t)=>t.length>e.length?t:e,n[0])},[r,i,t,a,e]);return(0,l.jsxs)(`div`,{className:I.countUp,style:{"--count-up-color":o},children:[(0,l.jsx)(`div`,{className:I.glow}),(0,l.jsxs)(`div`,{className:I.valueWrap,children:[(0,l.jsx)(`span`,{className:`${I.value} ${I.measure}`,children:m}),(0,l.jsx)(`span`,{className:`${I.value} ${I.display}`,children:p})]})]})},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=y(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`},_e=(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=_e(e,t,o+f,s+p,i*.6,a-1),h=_e(o+f,s+p,n,r,i*.6,a-1);return[...m.slice(0,-1),...h]},ve=({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=y(e=>{d=e}),p=()=>{if(u=requestAnimationFrame(p),d)return;o.fillStyle=`#0f172a`,o.fillRect(0,0,e,t);let r=_e(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}})})},ye={cursorTrail:`cos-cursorTrail-fpz5p`,canvas:`cos-canvas-Iuyp3`,hint:`cos-hint-9GLHx`},be=({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=y(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:ye.cursorTrail,style:{width:n,height:r},children:[(0,l.jsx)(`canvas`,{ref:i,className:ye.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:ye.hint,children:`移动鼠标查看粒子轨迹`})]})},L={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`},xe={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}},Se=({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=xe[e]??xe[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:L.dot,style:{left:`${e}%`,top:`${t}%`}},n));return(0,l.jsxs)(`div`,{className:L.diceRoll,children:[(0,l.jsx)(`div`,{className:L.scene,children:(0,l.jsx)(`div`,{className:`${L.cube} ${n?L.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:`${L.face} ${L[`face${e}`]}`,children:p(e)},e))})}),(0,l.jsx)(`button`,{type:`button`,className:L.rollBtn,onClick:f,disabled:n,children:n?`掷骰中...`:`掷骰子`}),!n&&(0,l.jsxs)(`p`,{className:L.result,children:[`点数: `,i]})]})},Ce={doublePendulum:`cos-doublePendulum-FUEeK`,canvas:`cos-canvas-OVkhW`},we=({width:e=400,height:t=400,trailLength:n=120,color:r=`#38bdf8`,color2:i=`#a78bfa`})=>{let a=(0,c.useRef)(null),o=(0,c.useRef)({theta1:Math.PI/2+.1,theta2:Math.PI/2-.2,omega1:0,omega2:0}),s=(0,c.useRef)([]);return(0,c.useEffect)(()=>{let c=a.current;if(!c)return;let l=window.devicePixelRatio||1;c.width=e*l,c.height=t*l;let u=c.getContext(`2d`);if(!u)return;u.setTransform(l,0,0,l,0,0);let d=e/2,f=t*.28,p=t*.28,m=t*.26,h=9.8,g=.016,_=0,v=document.hidden,b=y(e=>{v=e}),x=()=>{if(_=requestAnimationFrame(x),v)return;let a=o.current,{theta1:c,theta2:l,omega1:y,omega2:b}=a,S=Math.sin(c),C=Math.sin(c-l),w=Math.cos(c-l),T=Math.cos(c),E=p*(3-1*Math.cos(2*c-2*l)),D=(-9.8*3*S-1*h*Math.sin(c-2*l)-2*C*1*(b*b*m+y*y*p*w))/E,O=2*C*(y*y*p*2+h*2*T+b*b*m*1*w)/(m*(3-1*Math.cos(2*c-2*l)));a.omega1+=D*g,a.omega2+=O*g,a.theta1+=a.omega1*g,a.theta2+=a.omega2*g;let k=d+p*Math.sin(a.theta1),A=f+p*Math.cos(a.theta1),j=k+m*Math.sin(a.theta2),M=A+m*Math.cos(a.theta2),N=s.current;N.push({x:j,y:M}),N.length>n&&N.shift(),u.fillStyle=`rgba(15, 23, 42, 0.22)`,u.fillRect(0,0,e,t),N.length>1&&(u.beginPath(),N.forEach((e,t)=>t===0?u.moveTo(e.x,e.y):u.lineTo(e.x,e.y)),u.strokeStyle=i,u.lineWidth=1.5,u.globalAlpha=.7,u.stroke(),u.globalAlpha=1),u.beginPath(),u.moveTo(d,f),u.lineTo(k,A),u.lineTo(j,M),u.strokeStyle=`#64748b`,u.lineWidth=2,u.stroke(),u.beginPath(),u.arc(d,f,5,0,Math.PI*2),u.fillStyle=`#94a3b8`,u.fill(),u.beginPath(),u.arc(k,A,10,0,Math.PI*2),u.fillStyle=r,u.shadowColor=r,u.shadowBlur=10,u.fill(),u.shadowBlur=0,u.beginPath(),u.arc(j,M,10,0,Math.PI*2),u.fillStyle=i,u.shadowColor=i,u.shadowBlur=10,u.fill(),u.shadowBlur=0};return u.fillStyle=`#0f172a`,u.fillRect(0,0,e,t),x(),()=>{cancelAnimationFrame(_),b()}},[r,i,t,n,e]),(0,l.jsx)(`div`,{className:Ce.doublePendulum,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:a,className:Ce.canvas,style:{width:e,height:t}})})},Te={fireworks:`cos-fireworks-fsSqL`,canvas:`cos-canvas-spL8G`,hint:`cos-hint-5XDRH`},Ee=[`#ff6b6b`,`#ffd93d`,`#6bcb77`,`#4d96ff`,`#a66cff`,`#ff85c0`],De=.12,Oe=240,ke=()=>Ee[Math.floor(Math.random()*Ee.length)],Ae=(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:ke(),decay:Math.random()*.015+.01}})},je=(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:ke(),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=y(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+=De,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>=Oe;return(t||n||r||i)&&(e.exploded=!0,e.particles=Ae(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:Te.fireworks,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:i,className:Te.canvas,style:{width:e,height:t},onClick:e=>{let t=e.currentTarget.getBoundingClientRect();s(e.clientX-t.left)}}),(0,l.jsx)(`p`,{className:Te.hint,children:`点击画布燃放烟花`})]})});je.displayName=`Fireworks`;var R={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`},Me=(e,t)=>Math.max(0,Math.floor(e)).toString().padStart(t,`0`).slice(-t),Ne=({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:R.digit,style:{"--flip-color":t,"--flip-duration":`${n}ms`},children:(0,l.jsxs)(`div`,{className:`${R.digitCard} ${i?R.isFlipping:``}`,children:[(0,l.jsx)(`div`,{className:R.staticTop,children:(0,l.jsx)(`span`,{children:u})}),(0,l.jsx)(`div`,{className:R.staticBottom,children:(0,l.jsx)(`span`,{children:u})}),i&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`div`,{className:`${R.flap} ${R.flapTop}`,children:(0,l.jsx)(`span`,{children:o})}),(0,l.jsx)(`div`,{className:`${R.flap} ${R.flapBottom}`,children:(0,l.jsx)(`span`,{children:e})})]})]})})},Pe=({value:e,digits:t=4,color:n=`#38bdf8`,duration:r=600})=>{let i=Me(e,t).split(``);return(0,l.jsx)(`div`,{className:R.flipCounter,children:i.map((e,t)=>(0,l.jsx)(Ne,{digit:e,color:n,duration:r},t))})},Fe={fuzzyText:`cos-fuzzyText-AgND-`,canvas:`cos-canvas-CiG0H`},Ie=({text:e=`FUZZY`,fontSize:t=72,fontWeight:n=900,color:r=`#f8fafc`,baseIntensity:i=.18,hoverIntensity:a=.5,enableHover:o=!0,fuzzRange:s=30})=>{let u=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let c=0,l=!1,d=u.current;return d?((async()=>{let u=d.getContext(`2d`);if(!u)return;let f=window.getComputedStyle(d).fontFamily||`sans-serif`,p=`${n} ${`${t}px`} ${f}`;try{await document.fonts.load(p)}catch{await document.fonts.ready}if(l)return;let m=document.createElement(`canvas`),h=m.getContext(`2d`);if(!h)return;h.font=p,h.textBaseline=`alphabetic`;let g=h.measureText(e),_=g.actualBoundingBoxLeft??0,v=g.actualBoundingBoxRight??g.width,y=g.actualBoundingBoxAscent??t,b=g.actualBoundingBoxDescent??t*.2,x=Math.ceil(_+v),S=Math.ceil(y+b),C=x+10;m.width=C,m.height=S,h.font=p,h.textBaseline=`alphabetic`,h.fillStyle=r,h.fillText(e,10/2-_,y);let w=s+20;d.width=C+w*2,d.height=S,u.setTransform(1,0,0,1,0,0),u.translate(w,0);let T=w+10/2,E=T+x,D=S,O=!1,k=()=>{if(l)return;let e=O?a:i;u.clearRect(-s-20,-10,C+2*(s+20),S+20);for(let t=0;t<S;t++){let n=Math.floor(e*(Math.random()-.5)*s);u.drawImage(m,0,t,C,1,n,t,C,1)}c=window.requestAnimationFrame(k)};c=window.requestAnimationFrame(k);let A=(e,t)=>e>=T&&e<=E&&t>=0&&t<=D,j=e=>{if(!o)return;let t=d.getBoundingClientRect();O=A(e.clientX-t.left,e.clientY-t.top)},M=()=>{O=!1};o&&(d.addEventListener(`mousemove`,j),d.addEventListener(`mouseleave`,M)),d.cleanupFuzzyText=()=>{window.cancelAnimationFrame(c),o&&(d.removeEventListener(`mousemove`,j),d.removeEventListener(`mouseleave`,M))}})(),()=>{l=!0,window.cancelAnimationFrame(c),d.cleanupFuzzyText?.()}):void 0},[i,r,o,t,n,s,a,e]),(0,l.jsx)(`div`,{className:Fe.fuzzyText,children:(0,l.jsx)(`canvas`,{ref:u,className:Fe.canvas})})},Le={gradientFlow:`cos-gradientFlow-XhN16`,text:`cos-text-ORuqk`,flow:`cos-flow-9FzMA`},Re=[`#ff00de`,`#7c3aed`,`#00f0ff`,`#38bdf8`,`#ff00de`],ze=({text:e=`GRADIENT`,colors:t=Re,fontSize:n=64})=>{let r=t.length>=2?t.join(`, `):Re.join(`, `);return(0,l.jsx)(`div`,{className:Le.gradientFlow,children:(0,l.jsx)(`h1`,{className:Le.text,style:{fontSize:n,backgroundImage:`linear-gradient(90deg, ${r})`},children:e})})},z={gameOfLife:`cos-gameOfLife-1i2nu`,canvas:`cos-canvas-urOjh`,toolbar:`cos-toolbar-GmcD1`,meta:`cos-meta-KLxCp`,actions:`cos-actions-l3sAu`,button:`cos-button-g0tCm`},Be=(e,t,n)=>Math.min(n,Math.max(t,e)),Ve=(e,t,n)=>Array.from({length:e},()=>Array.from({length:t},()=>+(Math.random()<n))),He=e=>{let t=e.length,n=e[0]?.length||0,r=Array.from({length:t},()=>Array(n).fill(0));for(let i=0;i<t;i++)for(let a=0;a<n;a++){let o=0;for(let r=-1;r<=1;r++)for(let s=-1;s<=1;s++){if(s===0&&r===0)continue;let c=i+r,l=a+s;c<0||c>=t||l<0||l>=n||(o+=e[c][l])}e[i][a]?r[i][a]=+(o===2||o===3):o===3&&(r[i][a]=1)}return r},Ue=({width:e=560,height:t=420,cellSize:n=14,speed:r=120,density:i=.28,aliveColor:a=`#a3e635`,gridColor:o=`rgb(148 163 184 / 14%)`})=>{let s=(0,c.useRef)(null),u=Math.max(6,Math.floor(t/n)),d=Math.max(6,Math.floor(e/n)),f=Be(i,.05,.7),[p,m]=(0,c.useState)(!0),[h,g]=(0,c.useState)(0),_=(0,c.useRef)(document.hidden),[v,b]=(0,c.useState)(()=>Ve(u,d,f)),[x,S]=(0,c.useState)({rows:u,cols:d,density:f});(x.rows!==u||x.cols!==d||x.density!==f)&&(S({rows:u,cols:d,density:f}),b(Ve(u,d,f)),g(0)),(0,c.useEffect)(()=>{let r=s.current;if(!r)return;let i=window.devicePixelRatio||1;r.width=e*i,r.height=t*i;let c=r.getContext(`2d`);if(!c)return;c.setTransform(i,0,0,i,0,0);let l=0,f=y(e=>{_.current=e}),p=()=>{c.fillStyle=`#020617`,c.fillRect(0,0,e,t);for(let e=0;e<u;e++)for(let t=0;t<d;t++){if(!v[e][t])continue;let r=t*n,i=e*n;c.fillStyle=a,c.fillRect(r+1,i+1,n-2,n-2);let o=c.createRadialGradient(r+n/2,i+n/2,0,r+n/2,i+n/2,n*.8);o.addColorStop(0,`rgb(255 255 255 / 28%)`),o.addColorStop(1,`transparent`),c.fillStyle=o,c.fillRect(r,i,n,n)}c.strokeStyle=o,c.lineWidth=1;for(let e=0;e<=d;e++)c.beginPath(),c.moveTo(e*n+.5,0),c.lineTo(e*n+.5,t),c.stroke();for(let t=0;t<=u;t++)c.beginPath(),c.moveTo(0,t*n+.5),c.lineTo(e,t*n+.5),c.stroke()},m=()=>{l=requestAnimationFrame(m),p()};return l=requestAnimationFrame(m),()=>{cancelAnimationFrame(l),f()}},[a,n,d,v,o,t,u,e]),(0,c.useEffect)(()=>{if(!p)return;let e=window.setInterval(()=>{_.current||(b(e=>He(e)),g(e=>e+1))},r);return()=>clearInterval(e)},[p,r]);let C=(0,c.useMemo)(()=>v.reduce((e,t)=>e+t.reduce((e,t)=>e+t,0),0),[v]),w=()=>{b(Ve(u,d,f)),g(0)},T=(e,t,r)=>{let i=Math.floor((e-r.left)/n),a=Math.floor((t-r.top)/n);a<0||a>=u||i<0||i>=d||(b(e=>e.map((e,t)=>t===a?e.map((e,t)=>t===i?+!e:e):e)),g(e=>e+1))};return(0,l.jsxs)(`div`,{className:z.gameOfLife,style:{width:e},children:[(0,l.jsx)(`canvas`,{ref:s,className:z.canvas,style:{width:e,height:t},onClick:e=>T(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect())}),(0,l.jsxs)(`div`,{className:z.toolbar,children:[(0,l.jsxs)(`div`,{className:z.meta,children:[(0,l.jsxs)(`span`,{children:[`Generation `,h]}),(0,l.jsxs)(`span`,{children:[C,` alive`]})]}),(0,l.jsxs)(`div`,{className:z.actions,children:[(0,l.jsx)(`button`,{type:`button`,className:z.button,onClick:()=>m(e=>!e),children:p?`Pause`:`Play`}),(0,l.jsx)(`button`,{type:`button`,className:z.button,onClick:w,children:`Randomize`})]})]})]})},We={glitchText:`cos-glitchText-dZ-sR`,text:`cos-text-JsPHN`,"glitch-1":`cos-glitch-1-s9pqH`,"glitch-2":`cos-glitch-2-GhFB-`},Ge=({text:e=`GLITCH`,color:t=`#f8fafc`,glitchColor1:n=`#ff00de`,glitchColor2:r=`#00f0ff`,fontSize:i=64})=>(0,l.jsx)(`div`,{className:We.glitchText,children:(0,l.jsx)(`h1`,{className:We.text,"data-text":e,style:{fontSize:i,"--glitch-color":t,"--glitch-c1":n,"--glitch-c2":r},children:e})}),Ke={gravityBalls:`cos-gravityBalls-LdwFo`,canvas:`cos-canvas-n7esd`},qe=[`#38bdf8`,`#a78bfa`,`#f472b6`,`#4ade80`,`#fbbf24`],Je=({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:qe[Math.floor(Math.random()*qe.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=y(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:Ke.gravityBalls,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:r,className:Ke.canvas,style:{width:e,height:t}})})},Ye={wrap:`cos-wrap-r1gGL`,card:`cos-card-3W10s`,shine:`cos-shine-0xjID`,image:`cos-image-AV2XG`,placeholder:`cos-placeholder-wuuL3`,info:`cos-info-CNR0r`},Xe=({title:e=`全息卡片`,subtitle:t=`移动鼠标体验 3D 效果`,image:n})=>{let r=(0,c.useRef)(null);return(0,l.jsx)(`div`,{className:Ye.wrap,children:(0,l.jsxs)(`div`,{ref:r,className:Ye.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:Ye.shine}),n?(0,l.jsx)(`img`,{src:n,alt:e,className:Ye.image}):(0,l.jsx)(`div`,{className:Ye.placeholder,children:(0,l.jsx)(`span`,{children:`✦`})}),(0,l.jsxs)(`div`,{className:Ye.info,children:[(0,l.jsx)(`h3`,{children:e}),(0,l.jsx)(`p`,{children:t})]})]})})},Ze={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`},Qe=({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=b(t>0?e/t*100:0,0,100),s=100-o;return(0,c.useEffect)(()=>{let e=0,t=0,n=document.hidden,r=y(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:Ze.liquidProgress,style:{width:n,height:n,"--liquid-color":r},children:[(0,l.jsxs)(`svg`,{viewBox:`0 0 100 100`,className:Ze.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:Ze.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:Ze.fillBg}),(0,l.jsx)(`path`,{ref:i,className:Ze.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:Ze.ring,strokeWidth:10,fill:`none`})]}),(0,l.jsxs)(`span`,{className:Ze.label,children:[Math.round(o),`%`]})]})},$e={lorenzAttractor:`cos-lorenzAttractor--UAI7`,canvas:`cos-canvas-oeXce`},et=({width:e=400,height:t=360,speed:n=1,color:r=`#f472b6`,pointCount:i=2e3})=>{let a=(0,c.useRef)(null),o=(0,c.useRef)(0);return(0,c.useEffect)(()=>{let s=a.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=.005,d=[],f=.1,p=0,m=0;for(let e=0;e<i;e++){let e=10*(p-f),t=f*(28-m)-p,n=f*p-2.6666666666666665*m;f+=e*u,p+=t*u,m+=n*u,d.push({x:f,y:p,z:m})}let h=0,g=document.hidden,_=y(e=>{g=e}),v=(n,r,i,a)=>{let o=Math.cos(a),s=Math.sin(a),c=n*o-i*s,l=n*s+i*o,u=r;return{x:e/2+c*6,y:t/2-u*6,depth:l}},b=()=>{if(h=requestAnimationFrame(b),g)return;o.current+=.004*n;let i=o.current;l.fillStyle=`rgba(15, 23, 42, 0.15)`,l.fillRect(0,0,e,t);let a=d.map(e=>v(e.x,e.y,e.z,i));l.beginPath(),a.forEach((e,t)=>t===0?l.moveTo(e.x,e.y):l.lineTo(e.x,e.y)),l.strokeStyle=r,l.globalAlpha=.75,l.lineWidth=.9,l.stroke(),l.globalAlpha=1,a.forEach((e,t)=>{if(t%50!=0)return;let n=.2+(e.depth+30)/60*.6;l.beginPath(),l.arc(e.x,e.y,1.5,0,Math.PI*2),l.fillStyle=`#fff`,l.globalAlpha=Math.max(.1,Math.min(n,.9)),l.fill()}),l.globalAlpha=1};return l.fillStyle=`#0f172a`,l.fillRect(0,0,e,t),b(),()=>{cancelAnimationFrame(h),_()}},[r,t,i,n,e]),(0,l.jsx)(`div`,{className:$e.lorenzAttractor,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:a,className:$e.canvas,style:{width:e,height:t}})})},tt={liquidGlass:`cos-liquidGlass-Z3bQg`,panel:`cos-panel-XYboD`,content:`cos-content-MHfkS`},nt=({children:e=`液态玻璃面板`,blur:t=16,borderRadius:n=20})=>(0,l.jsx)(`div`,{className:tt.liquidGlass,children:(0,l.jsx)(`div`,{className:tt.panel,style:{"--glass-blur":`${t}px`,"--glass-radius":`${n}px`},children:(0,l.jsx)(`div`,{className:tt.content,children:e})})}),rt={magneticButton:`cos-magneticButton-GbRkE`,btn:`cos-btn--b2BJ`},it=({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:rt.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:rt.btn,style:{"--btn-color":n},children:e})})},at={matrixRain:`cos-matrixRain-qg9HC`,canvas:`cos-canvas--AvpG`,overlay:`cos-overlay-knj3b`,title:`cos-title-sDfhs`,flicker:`cos-flicker-smHxl`,subtitle:`cos-subtitle-CWheW`},ot=`ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*アイウエオカキクケコ`,st=({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=y(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=ot[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:at.matrixRain,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:s,className:at.canvas,style:{width:e,height:t}}),i&&(0,l.jsxs)(`div`,{className:at.overlay,children:[(0,l.jsx)(`h2`,{className:at.title,children:a}),(0,l.jsx)(`p`,{className:at.subtitle,children:o})]})]})},ct={metaballPool:`cos-metaballPool-JJaI9`,canvas:`cos-canvas-S7fDD`},lt=({width:e=400,height:t=300,ballCount:n=5,color:r=`#38bdf8`})=>{let i=(0,c.useRef)(null),a=(0,c.useRef)([]),o=(0,c.useRef)({x:-999,y:-999,active:!1});return(0,c.useEffect)(()=>{let r=Math.max(2,Math.min(n,10));a.current=Array.from({length:r},()=>({x:Math.random()*(e-80)+40,y:Math.random()*(t-80)+40,vx:(Math.random()-.5)*2,vy:(Math.random()-.5)*2,r:28+Math.random()*18}))},[n,t,e]),(0,c.useEffect)(()=>{let n=i.current;if(!n)return;let r=window.devicePixelRatio||1,s=.5,c=Math.floor(e*s),l=Math.floor(t*s);n.width=e*r,n.height=t*r;let u=n.getContext(`2d`);if(!u)return;u.setTransform(r,0,0,r,0,0);let d=document.createElement(`canvas`);d.width=c,d.height=l;let f=d.getContext(`2d`);if(!f)return;let p=(e,t)=>{let r=n.getBoundingClientRect();o.current={x:e-r.left,y:t-r.top,active:!0}},m=()=>{o.current.active=!1},h=e=>p(e.clientX,e.clientY),g=e=>{e.touches[0]&&p(e.touches[0].clientX,e.touches[0].clientY)};n.addEventListener(`mousemove`,h),n.addEventListener(`mouseleave`,m),n.addEventListener(`touchmove`,g,{passive:!0}),n.addEventListener(`touchend`,m);let _=0,v=document.hidden,x=y(e=>{v=e}),S=()=>{if(_=requestAnimationFrame(S),v)return;let n=a.current,r=o.current;for(let i of n){if(r.active){let e=i.x-r.x,t=i.y-r.y,n=Math.hypot(e,t)||1;if(n<120){let r=(120-n)*.04;i.vx+=e/n*r,i.vy+=t/n*r}}i.vx*=.98,i.vy*=.98,i.x+=i.vx,i.y+=i.vy,i.x-i.r<0?(i.x=i.r,i.vx*=-.8):i.x+i.r>e&&(i.x=e-i.r,i.vx*=-.8),i.y-i.r<0?(i.y=i.r,i.vy*=-.8):i.y+i.r>t&&(i.y=t-i.r,i.vy*=-.8)}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)*.55;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 i=f.createImageData(c,l),p=i.data;for(let e=0;e<l;e++)for(let t=0;t<c;t++){let r=t/s,i=e/s,a=0;for(let e of n){let t=r-e.x,n=i-e.y,o=t*t+n*n;a+=e.r*e.r/(o+1)}let o=(e*c+t)*4;a>1?(p[o]=56+b((a-1)*.8,0,1)*40,p[o+1]=189,p[o+2]=248,p[o+3]=255):p[o+3]=0}f.putImageData(i,0,0),u.fillStyle=`#0f172a`,u.fillRect(0,0,e,t),u.save(),u.filter=`blur(8px)`,u.drawImage(d,0,0,e,t),u.restore(),u.globalCompositeOperation=`lighter`,u.drawImage(d,0,0,e,t),u.globalCompositeOperation=`source-over`;for(let e of n){let t=u.createRadialGradient(e.x-e.r*.3,e.y-e.r*.3,0,e.x,e.y,e.r*.6);t.addColorStop(0,`rgba(255,255,255,0.5)`),t.addColorStop(1,`rgba(56,189,248,0)`),u.beginPath(),u.arc(e.x,e.y,e.r*.5,0,Math.PI*2),u.fillStyle=t,u.fill()}};return S(),()=>{cancelAnimationFrame(_),x(),n.removeEventListener(`mousemove`,h),n.removeEventListener(`mouseleave`,m),n.removeEventListener(`touchmove`,g),n.removeEventListener(`touchend`,m)}},[r,t,e]),(0,l.jsx)(`div`,{className:ct.metaballPool,style:{width:e,height:t,"--pool-color":r},children:(0,l.jsx)(`canvas`,{ref:i,className:ct.canvas,style:{width:e,height:t}})})},ut={mazeGenerator:`cos-mazeGenerator-QEa0s`,canvas:`cos-canvas-emhxb`},dt=({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,_=document.hidden,v=y(e=>{_=e}),b=()=>{if(_){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),v()}},[n,t,e]),(0,l.jsx)(`div`,{className:ut.mazeGenerator,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:ut.canvas,style:{width:e,height:t}})})},ft={meteorRain:`cos-meteorRain-v8RNI`,canvas:`cos-canvas-hyFMr`},pt=({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=y(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:ft.meteorRain,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:r,className:ft.canvas,style:{width:e,height:t}})})},mt={networkGraph:`cos-networkGraph-4jjqg`,canvas:`cos-canvas-F17fx`,cursorDefault:`cos-cursorDefault-pUq31`,cursorGrab:`cos-cursorGrab-clAFY`,cursorGrabbing:`cos-cursorGrabbing-Bzm-F`,hint:`cos-hint-19aNc`},ht=[{id:`react`,label:`React`,color:`#61dafb`},{id:`vue`,label:`Vue`,color:`#42b883`},{id:`angular`,label:`Angular`,color:`#dd0031`},{id:`svelte`,label:`Svelte`,color:`#ff3e00`},{id:`ts`,label:`TypeScript`,color:`#3178c6`},{id:`vite`,label:`Vite`,color:`#bd34fe`},{id:`next`,label:`Next.js`,color:`#f8fafc`}],gt=[{source:`react`,target:`ts`},{source:`react`,target:`next`},{source:`react`,target:`vite`},{source:`vue`,target:`ts`},{source:`vue`,target:`vite`},{source:`angular`,target:`ts`},{source:`svelte`,target:`vite`},{source:`ts`,target:`vite`}],_t=6,vt=`ui-sans-serif, system-ui, -apple-system, sans-serif`,yt=(e,t,n)=>{let r=e=>{let t=e.replace(`#`,``),n=t.length===3?t.split(``).map(e=>e+e).join(``):t;return n.length===6?[parseInt(n.slice(0,2),16),parseInt(n.slice(2,4),16),parseInt(n.slice(4,6),16)]:[148,163,184]},[i,a,o]=r(e),[s,c,l]=r(t);return`rgb(${Math.round(i+(s-i)*n)} ${Math.round(a+(c-a)*n)} ${Math.round(o+(l-o)*n)})`},B=(e,t)=>{if(e.startsWith(`#`)){let n=e.replace(`#`,``),r=n.length===3?n.split(``).map(e=>e+e).join(``):n;if(r.length===6)return`rgb(${parseInt(r.slice(0,2),16)} ${parseInt(r.slice(2,4),16)} ${parseInt(r.slice(4,6),16)} / ${t})`}let n=e.match(/rgba?\(([^)]+)\)/i);if(n){let e=n[1].split(/[,\s/]+/).filter(Boolean).map(Number);if(e.length>=3)return`rgb(${e[0]} ${e[1]} ${e[2]} / ${t})`}return e},bt=({width:e=600,height:t=420,nodes:n=ht,edges:r=gt,linkColor:i=`rgb(148 163 184 / 35%)`,nodeRadius:a=20})=>{let o=(0,c.useRef)(null),s=(0,c.useRef)([]),u=(0,c.useRef)(null),d=(0,c.useRef)(null),[f,p]=(0,c.useState)(`default`),[m,h]=(0,c.useState)(`拖拽节点 · 悬停查看关联`),g=(0,c.useMemo)(()=>{let e=new Map;for(let t of n)e.set(t.id,new Set);for(let t of r)e.get(t.source)?.add(t.target),e.get(t.target)?.add(t.source);return e},[r,n]);(0,c.useEffect)(()=>{if(!n.length){s.current=[];return}let r=new Map(s.current.map(e=>[e.id,e]));s.current=n.map((i,a)=>{let o=r.get(i.id);return o?{...o,label:i.label||i.id,color:i.color||`#38bdf8`}:{id:i.id,label:i.label||i.id,color:i.color||`#38bdf8`,x:e/2+Math.cos(a/n.length*Math.PI*2)*140,y:t/2+Math.sin(a/n.length*Math.PI*2)*120,vx:0,vy:0}})},[t,n,e]),(0,c.useEffect)(()=>{let n=o.current;if(!n)return;let c=Math.min(window.devicePixelRatio||1,2);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 f=0,p=document.hidden,m=y(e=>{p=e}),h=()=>{let e=new Map;return s.current.forEach(t=>e.set(t.id,t)),e},_=(e,t)=>!t||e===t?!0:g.get(t)?.has(e)??!1,v=()=>{let n=s.current,i=h(),o=.92,c=.003;for(let e=0;e<n.length;e++){let t=n[e];for(let r=e+1;r<n.length;r++){let e=n[r],i=t.x-e.x,a=t.y-e.y,o=i*i+a*a||1,s=2400/o,c=Math.sqrt(o);i/=c,a/=c,t.vx+=i*s,t.vy+=a*s,e.vx-=i*s,e.vy-=a*s}}for(let e of r){let t=i.get(e.source),n=i.get(e.target);if(!t||!n)continue;let r=n.x-t.x,a=n.y-t.y,o=Math.sqrt(r*r+a*a)||1,s=.012*(o-120),c=r/o*s,l=a/o*s;t.vx+=c,t.vy+=l,n.vx-=c,n.vy-=l}for(let r of n)r.vx+=(e/2-r.x)*c,r.vy+=(t/2-r.y)*c,r.vx*=o,r.vy*=o,d.current?.node!==r&&(r.x+=r.vx,r.y+=r.vy,r.x=Math.max(a,Math.min(e-a,r.x)),r.y=Math.max(a,Math.min(t-a,r.y)))},b=()=>{let n=l.createRadialGradient(e*.5,t*.42,20,e*.5,t*.5,Math.max(e,t)*.72);n.addColorStop(0,`#1a2744`),n.addColorStop(.55,`#0f172a`),n.addColorStop(1,`#020617`),l.fillStyle=n,l.fillRect(0,0,e,t),l.fillStyle=`rgb(148 163 184 / 7%)`;for(let n=28;n<e;n+=28)for(let e=28;e<t;e+=28)l.beginPath(),l.arc(n,e,.7,0,Math.PI*2),l.fill();let r=l.createRadialGradient(e/2,t/2,Math.min(e,t)*.25,e/2,t/2,Math.max(e,t)*.7);r.addColorStop(0,`rgb(0 0 0 / 0%)`),r.addColorStop(1,`rgb(2 6 23 / 55%)`),l.fillStyle=r,l.fillRect(0,0,e,t)},x=(e,t,n,r)=>{let o=t.x-e.x,s=t.y-e.y,c=Math.sqrt(o*o+s*s)||1,u=o/c,d=s/c,f=a*.55,p=e.x+u*f,m=e.y+d*f,h=t.x-u*f,g=t.y-d*f,_=(p+h)/2,v=(m+g)/2,y=l.createLinearGradient(p,m,h,g);n?(y.addColorStop(0,B(e.color,.85)),y.addColorStop(.5,B(yt(e.color,t.color,.5),.55)),y.addColorStop(1,B(t.color,.85)),l.lineWidth=2.4,l.shadowColor=B(yt(e.color,t.color,.5),.45),l.shadowBlur=10):r?(y.addColorStop(0,B(i,.12)),y.addColorStop(.5,B(i,.08)),y.addColorStop(1,B(i,.12)),l.lineWidth=1,l.shadowBlur=0):(y.addColorStop(0,B(i,.15)),y.addColorStop(.5,i),y.addColorStop(1,B(i,.15)),l.lineWidth=1.35,l.shadowBlur=0),l.strokeStyle=y,l.lineCap=`round`,l.beginPath(),l.moveTo(p,m),l.quadraticCurveTo(_+d*4,v-u*4,h,g),l.stroke(),l.shadowBlur=0},S=(e,n,r)=>{let i=_(e.id,n),o=n===e.id,s=r&&d.current?.node===e,c=a*(o||s?1.12:i||!n?1:.94),u=!n||i?1:.28;l.save(),l.globalAlpha=u,l.beginPath(),l.arc(e.x,e.y,c+(o||s?10:6),0,Math.PI*2),l.fillStyle=B(e.color,o||s?.22:.12),l.fill(),l.shadowColor=B(e.color,o||s?.75:.45),l.shadowBlur=o||s?22:14;let f=l.createRadialGradient(e.x-c*.28,e.y-c*.32,c*.1,e.x,e.y,c);f.addColorStop(0,yt(e.color,`#ffffff`,.55)),f.addColorStop(.55,e.color),f.addColorStop(1,yt(e.color,`#0f172a`,.35)),l.beginPath(),l.arc(e.x,e.y,c,0,Math.PI*2),l.fillStyle=f,l.fill(),l.shadowBlur=0,l.strokeStyle=o||s?`rgb(255 255 255 / 70%)`:`rgb(255 255 255 / 28%)`,l.lineWidth=o||s?1.6:1.1,l.stroke();let p=Math.max(10,Math.min(13,Math.round(a*.58)));l.font=`500 ${p}px ${vt}`,l.textAlign=`center`,l.textBaseline=`middle`;let m=e.label,h=l.measureText(m).width+16,g=p+8,v=e.x-h/2,y=Math.min(t-g-4,e.y+c+8);l.beginPath();let b=g/2;l.moveTo(v+b,y),l.arcTo(v+h,y,v+h,y+g,b),l.arcTo(v+h,y+g,v,y+g,b),l.arcTo(v,y+g,v,y,b),l.arcTo(v,y,v+h,y,b),l.closePath(),l.fillStyle=o||s?`rgb(15 23 42 / 78%)`:`rgb(15 23 42 / 55%)`,l.fill(),l.strokeStyle=`rgb(255 255 255 / 10%)`,l.lineWidth=1,l.stroke(),l.fillStyle=`#f8fafc`,l.fillText(m,e.x,y+g/2),l.restore()},C=()=>{b();let e=h(),t=d.current?.node.id??u.current,n=!!d.current;for(let n of r){let r=e.get(n.source),i=e.get(n.target);if(!r||!i)continue;let a=!!(t&&(n.source===t||n.target===t));x(r,i,a,!!(t&&!a))}let i=[...s.current].sort((e,n)=>(e.id===t?2:+!!_(e.id,t))-(n.id===t?2:+!!_(n.id,t)));for(let e of i)S(e,t,n)},w=()=>{f=requestAnimationFrame(w),!p&&(v(),C())};return f=requestAnimationFrame(w),()=>{cancelAnimationFrame(f),m()}},[g,r,t,i,a,e]);let _=(e,t,n)=>{let r=e-n.left,i=t-n.top,o=a+_t,c=null,l=o*o;for(let e of s.current){let t=(e.x-r)**2+(e.y-i)**2;t<=l&&(l=t,c=e)}return c},v=e=>{u.current=e?.id??null,h(e?e.label:`拖拽节点 · 悬停查看关联`)},b=e=>{if(e.pointerType===`mouse`&&e.button!==0)return;let t=e.currentTarget.getBoundingClientRect(),n=_(e.clientX,e.clientY,t);if(!n)return;e.currentTarget.setPointerCapture(e.pointerId),e.pointerType===`touch`&&e.preventDefault();let r=e.clientX-t.left,i=e.clientY-t.top;d.current={node:n,offsetX:n.x-r,offsetY:n.y-i,lastX:r,lastY:i,vx:0,vy:0},n.vx=0,n.vy=0,v(n),p(`grabbing`)},x=n=>{let r=n.currentTarget.getBoundingClientRect(),i=n.clientX-r.left,o=n.clientY-r.top;if(d.current){n.pointerType===`touch`&&n.preventDefault();let{node:r,offsetX:s,offsetY:c}=d.current,l=Math.max(a,Math.min(e-a,i+s)),u=Math.max(a,Math.min(t-a,o+c));d.current.vx=l-d.current.lastX,d.current.vy=u-d.current.lastY,d.current.lastX=l,d.current.lastY=u,r.x=l,r.y=u,r.vx=0,r.vy=0,p(`grabbing`);return}let s=_(n.clientX,n.clientY,r);v(s),p(s?`grab`:`default`)},S=e=>{let t=d.current;t&&(t.node.vx=t.vx*.85,t.node.vy=t.vy*.85,d.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId));let n=e.currentTarget.getBoundingClientRect(),r=_(e.clientX,e.clientY,n);v(r),p(r?`grab`:`default`)},C=()=>{d.current||(v(null),p(`default`))},w=f===`grabbing`?mt.cursorGrabbing:f===`grab`?mt.cursorGrab:mt.cursorDefault;return(0,l.jsxs)(`div`,{className:mt.networkGraph,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:o,className:`${mt.canvas} ${w}`,style:{width:e,height:t},onPointerDown:b,onPointerMove:x,onPointerUp:S,onPointerCancel:S,onPointerLeave:C}),(0,l.jsx)(`div`,{className:mt.hint,children:m})]})},xt={neonText:`cos-neonText-JMP7i`,text:`cos-text-GTO-0`,flicker:`cos-flicker-nXceV`,"neon-flicker":`cos-neon-flicker-uDkmM`,reflection:`cos-reflection-aEYj6`},St=({text:e=`NEON`,color:t=`#ff00de`,fontSize:n=72,flicker:r=!0})=>(0,l.jsxs)(`div`,{className:xt.neonText,children:[(0,l.jsx)(`h1`,{className:`${xt.text} ${r?xt.flicker:``}`,style:{fontSize:n,"--neon-color":t},children:e}),(0,l.jsx)(`p`,{className:xt.reflection,style:{fontSize:n*.35,color:t},children:e})]}),Ct={newtonCradle:`cos-newtonCradle-mFl-b`,canvas:`cos-canvas-TWKl5`},wt=({ballCount:e=5,color:t=`#38bdf8`,width:n=280,height:r=200})=>{let i=(0,c.useRef)(null),a=Math.max(2,Math.min(e,7));return(0,c.useEffect)(()=>{let e=i.current;if(!e)return;let o=window.devicePixelRatio||1;e.width=n*o,e.height=r*o;let s=e.getContext(`2d`);if(!s)return;s.setTransform(o,0,0,o,0,0);let c=r-28-28,l=(a-1)*28,u=(n-l)/2,d=1/60,f=Array.from({length:a},()=>({theta:0,omega:0}));f[0].theta=-.52;let p=`left`,m=e=>u+e*28,h=e=>{let t=f[e];return{x:m(e)+c*Math.sin(t.theta),y:16+c*Math.cos(t.theta)}},g=e=>{p===`left`&&(p=`right`,f[0].omega=0,f[0].theta=0,f[a-1].omega=Math.abs(e))},_=e=>{p===`right`&&(p=`left`,f[a-1].omega=0,f[a-1].theta=0,f[0].omega=-Math.abs(e))},v=()=>{let e=h(0),t=h(1);if(e.x+14>=t.x-14-.5&&f[0].omega>.02){g(f[0].omega);return}let n=h(a-1),r=h(a-2);n.x-14<=r.x+14+.5&&f[a-1].omega<-.02&&_(f[a-1].omega)},b=0,x=document.hidden,S=y(e=>{x=e}),C=()=>{if(b=requestAnimationFrame(C),!x){for(let e=0;e<a;e++){let t=f[e];if(Math.abs(t.omega)<1e-5&&Math.abs(t.theta)<1e-5)continue;let n=-(980/c)*Math.sin(t.theta);t.omega+=n*d,t.omega*=.9998,t.theta+=t.omega*d}v();for(let e=1;e<a-1;e++)f[e].theta=0,f[e].omega=0;s.fillStyle=`#0f172a`,s.fillRect(0,0,n,r),s.strokeStyle=`#475569`,s.lineWidth=3,s.beginPath(),s.moveTo(u-14,16),s.lineTo(u+l+14,16),s.stroke();for(let e=0;e<a;e++){let n=m(e),{x:r,y:i}=h(e);s.beginPath(),s.moveTo(n,16),s.lineTo(r,i),s.strokeStyle=`#64748b`,s.lineWidth=2,s.stroke(),s.beginPath(),s.arc(r,i,14,0,Math.PI*2);let a=s.createRadialGradient(r-14*.3,i-14*.3,0,r,i,14);a.addColorStop(0,`#fff`),a.addColorStop(.35,t),a.addColorStop(1,t),s.fillStyle=a,s.shadowColor=t,s.shadowBlur=6,s.fill(),s.shadowBlur=0}}};return C(),()=>{cancelAnimationFrame(b),S()}},[t,a,r,n]),(0,l.jsx)(`div`,{className:Ct.newtonCradle,style:{width:n,height:r,"--ball-color":t},children:(0,l.jsx)(`canvas`,{ref:i,className:Ct.canvas,style:{width:n,height:r}})})},Tt={orbitalChart:`cos-orbitalChart-XLORB`,canvas:`cos-canvas-hGVud`,legend:`cos-legend-Np9Mm`,swatch:`cos-swatch-xEKvA`},Et=[{label:`A`,value:30,color:`#38bdf8`},{label:`B`,value:25,color:`#a78bfa`},{label:`C`,value:20,color:`#f472b6`},{label:`D`,value:25,color:`#4ade80`}],Dt=({data:e=Et,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=y(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=b(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:Tt.orbitalChart,style:{width:t,height:t},children:[(0,l.jsx)(`canvas`,{ref:n,className:Tt.canvas,style:{width:t,height:t}}),(0,l.jsx)(`ul`,{className:Tt.legend,children:e.map(e=>(0,l.jsxs)(`li`,{children:[(0,l.jsx)(`span`,{className:Tt.swatch,style:{background:e.color}}),e.label,` (`,e.value,`)`]},e.label))})]})},Ot={particleNetwork:`cos-particleNetwork-GSZq-`,canvas:`cos-canvas-E-BGP`,hint:`cos-hint-LEO5o`},kt=({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=y(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:Ot.particleNetwork,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:o,className:Ot.canvas,style:{width:e,height:t},onMouseMove:p,onMouseLeave:h,onTouchMove:m,onTouchEnd:h}),(0,l.jsx)(`p`,{className:Ot.hint,children:`移动鼠标或手指与粒子互动`})]})},At={plasmaBall:`cos-plasmaBall-xGHSj`,canvas:`cos-canvas-V1CgL`},jt=({width:e=320,height:t=320,color:n=`#a78bfa`,arcCount:r=8})=>{let i=(0,c.useRef)(null),a=(0,c.useRef)({x:e/2,y:t/2,active:!1}),o=(0,c.useRef)([]);return(0,c.useEffect)(()=>{o.current=Array.from({length:r},(e,t)=>({angle:t/r*Math.PI*2,length:.6+Math.random()*.35,speed:.02+Math.random()*.03}))},[r]),(0,c.useEffect)(()=>{let r=i.current;if(!r)return;let s=window.devicePixelRatio||1;r.width=e*s,r.height=t*s;let c=r.getContext(`2d`);if(!c)return;c.setTransform(s,0,0,s,0,0);let l=e/2,u=t/2,d=Math.min(e,t)*.38,f=(e,t)=>{let n=r.getBoundingClientRect();a.current={x:e-n.left,y:t-n.top,active:!0}},p=()=>{a.current.active=!1},m=e=>f(e.clientX,e.clientY),h=e=>{e.touches[0]&&f(e.touches[0].clientX,e.touches[0].clientY)};r.addEventListener(`mousemove`,m),r.addEventListener(`mouseleave`,p),r.addEventListener(`touchmove`,h,{passive:!0}),r.addEventListener(`touchend`,p);let g=0,_=document.hidden,v=y(e=>{_=e}),b=(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=b(e,t,o+f,s+p,i*.55,a-1),h=b(o+f,s+p,n,r,i*.55,a-1);return[...m.slice(0,-1),...h]},x=()=>{if(g=requestAnimationFrame(x),_)return;let r=a.current,i=o.current;c.fillStyle=`#0f172a`,c.fillRect(0,0,e,t);let s=c.createRadialGradient(l,u,d*.1,l,u,d*1.1);s.addColorStop(0,`rgba(30, 41, 59, 0.9)`),s.addColorStop(.7,`rgba(15, 23, 42, 0.6)`),s.addColorStop(1,`rgba(15, 23, 42, 0)`),c.beginPath(),c.arc(l,u,d*1.05,0,Math.PI*2),c.fillStyle=s,c.fill(),c.beginPath(),c.arc(l,u,d,0,Math.PI*2),c.strokeStyle=`rgba(148, 163, 184, 0.35)`,c.lineWidth=2,c.stroke(),i.forEach(e=>{e.angle+=e.speed*(Math.random()>.5?1:-1);let t=r.active?Math.atan2(r.y-u,r.x-l)+(e.angle-Math.PI)*.15:e.angle,i=d*e.length,a=b(l,u,l+Math.cos(t)*i,u+Math.sin(t)*i,18,4);c.beginPath(),a.forEach(([e,t],n)=>n===0?c.moveTo(e,t):c.lineTo(e,t)),c.strokeStyle=n,c.lineWidth=1.5,c.shadowColor=n,c.shadowBlur=14,c.globalAlpha=.85,c.stroke(),c.shadowBlur=0,c.globalAlpha=1}),c.beginPath(),c.arc(l,u,10,0,Math.PI*2);let f=c.createRadialGradient(l,u,0,l,u,10);f.addColorStop(0,`#fff`),f.addColorStop(.5,n),f.addColorStop(1,n),c.fillStyle=f,c.shadowColor=n,c.shadowBlur=20,c.fill(),c.shadowBlur=0};return x(),()=>{cancelAnimationFrame(g),v(),r.removeEventListener(`mousemove`,m),r.removeEventListener(`mouseleave`,p),r.removeEventListener(`touchmove`,h),r.removeEventListener(`touchend`,p)}},[r,n,t,e]),(0,l.jsx)(`div`,{className:At.plasmaBall,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:At.canvas,style:{width:e,height:t}})})},Mt={smokeFog:`cos-smokeFog-SYlts`,canvas:`cos-canvas-iOJV7`},Nt=10,V=128,Pt=`#d2d4d8`,Ft=[`#14151c`,`#1a1b24`,`#0e0f14`],It=(e,t)=>{let n=Math.sin(e*127.1+t*311.7)*43758.5453;return n-Math.floor(n)},Lt=(e,t)=>{let n=Math.floor(e),r=Math.floor(t),i=e-n,a=t-r,o=i*i*(3-2*i),s=a*a*(3-2*a),c=It(n,r),l=It(n+1,r),u=It(n,r+1),d=It(n+1,r+1);return c+(l-c)*o+(u-c)*s+(c-l-u+d)*o*s},Rt=(e,t)=>{let n=0,r=.5,i=1;for(let a=0;a<4;a++)n+=r*Lt(e*i,t*i),i*=2.05,r*=.5;return n},zt=(e,t)=>{let n=e.replace(`#`,``).trim(),r=n.length===3?n.split(``).map(e=>e+e).join(``):n;if(r.length!==6)return t;let i=Number.parseInt(r,16);return Number.isNaN(i)?t:[i>>16&255,i>>8&255,i&255]},Bt=(e,t,n)=>[Math.round(e[0]+(t[0]-e[0])*n),Math.round(e[1]+(t[1]-e[1])*n),Math.round(e[2]+(t[2]-e[2])*n)],Vt=(e,t=1)=>t>=1?`rgb(${e[0]} ${e[1]} ${e[2]})`:`rgb(${e[0]} ${e[1]} ${e[2]} / ${t})`,Ht=e=>{if(Array.isArray(e)&&e.length>=3)return[e[0],e[1],e[2]];let t=zt(typeof e==`string`?e:Ft[2],[14,15,20]),n=Bt(t,[255,255,255],.06);return[Vt(Bt(t,[255,255,255],.1)),Vt(n),Vt(t)]},Ut=(e,t)=>{let n=document.createElement(`canvas`);n.width=V,n.height=V;let r=n.getContext(`2d`),i=r.createImageData(V,V),a=i.data,o=V/2,s=V/2,c=V*.48;for(let n=0;n<V;n++)for(let r=0;r<V;r++){let i=(r-o)/c,l=(n-s)/c,u=Math.hypot(i,l);if(u>1.15)continue;let d=Rt(r*.045+e*17.1,n*.045+e*9.3)*.7+Rt(r*.09-e*3.2,n*.09+e*5.7)*.3,f=u+(d-.45)*.55,p=1-Math.max(0,f);if(p=Math.max(0,p)**1.35,p*=.55+d*.7,p<.01)continue;let m=(n*V+r)*4,h=.88+d*.18;a[m]=Math.min(255,t[0]*h),a[m+1]=Math.min(255,t[1]*h+1),a[m+2]=Math.min(255,t[2]*h+3),a[m+3]=Math.min(255,p*210)}return r.putImageData(i,0,0),n},Wt=e=>Array.from({length:Nt},(t,n)=>Ut(n+1,e)),Gt=(e,t,n=0)=>{let r=70+Math.random()*110,i=Math.min(.92,n*.88),a=t*(1-n*.92)+r*(.15-n*.1),o=(.32+Math.random()*.28)*(1-n*.55);return{x:Math.random()*e,y:a,vx:(Math.random()-.5)*.18,vy:-(.08+Math.random()*.16),size:r*(.7+i*.55),birthSize:r,maxSize:r*(1.8+Math.random()*1.4),rotation:Math.random()*Math.PI*2,spin:(Math.random()-.5)*.004,age:i,ageSpeed:4e-4+Math.random()*65e-5,opacity:o,sprite:Math.floor(Math.random()*Nt),stretch:.85+Math.random()*.55+n*.25,receptivity:.5+Math.random()*.85,mass:.5+Math.random()*.9,phase:Math.random()*Math.PI*2,warmth:Math.random()}},Kt=(e,t)=>{let n=Math.hypot(e.vx,e.vy);if(n<=t)return;let r=t/n;e.vx*=r,e.vy*=r},qt=e=>e<.06?e/.06:e>.55?Math.max(0,1-(e-.55)/.45):1,Jt=(e,t)=>.22+Math.min(1,Math.max(0,e/t))**1.15*.78,Yt=({width:e=800,height:t=500,density:n=.5,color:r=Pt,backgroundColor:i=Ft,speed:a=1,disperseStrength:o=1,disperseRadius:s=1,interactive:u=!0})=>{let d=(0,c.useRef)(null),f=(0,c.useRef)([]),p=(0,c.useRef)([]),m=(0,c.useRef)(null),h=(0,c.useRef)(``),g=(0,c.useRef)(0),_=(0,c.useRef)({speed:a,disperseStrength:o,disperseRadius:s,interactive:u,color:r,backgroundColor:i});(0,c.useEffect)(()=>{_.current={speed:a,disperseStrength:o,disperseRadius:s,interactive:u,color:r,backgroundColor:i}},[a,o,s,u,r,i]),(0,c.useEffect)(()=>{m.current=Wt(zt(r,[210,212,216])),h.current=r},[r]),(0,c.useEffect)(()=>{let r=Math.floor(56+n*100);f.current=Array.from({length:r},()=>Gt(e,t,Math.random()**1.75))},[n,t,e]);let v=(0,c.useCallback)((n,r)=>{let i=_.current;if(!i.interactive)return;let a=d.current;if(!a)return;let o=a.getBoundingClientRect(),s=(n-o.left)/o.width*e,c=(r-o.top)/o.height*t,l=b(i.disperseRadius,0,3),u=b(i.disperseStrength,0,3);p.current.length>3&&p.current.shift(),p.current.push({x:s,y:c,life:1,swirl:Math.random()<.5?-1:1,radius:Math.min(e,t)*.08*l,maxRadius:Math.min(e,t)*(.42+Math.random()*.12)*l,strength:(.7+Math.random()*.25)*u})},[t,e]);return(0,c.useEffect)(()=>{let e=d.current;if(!e)return;let t=e=>{e.pointerType===`mouse`&&e.button!==0||v(e.clientX,e.clientY)};return e.addEventListener(`pointerdown`,t),()=>e.removeEventListener(`pointerdown`,t)},[v]),(0,c.useEffect)(()=>{let n=d.current;if(!n)return;let r=Math.min(window.devicePixelRatio||1,2);n.width=Math.floor(e*r),n.height=Math.floor(t*r);let i=n.getContext(`2d`);if(!i)return;i.setTransform(r,0,0,r,0,0);let a=zt(_.current.color,[210,212,216]);m.current||(m.current=Wt(a),h.current=_.current.color);let o=m.current,s=0,c=document.hidden,l=y(e=>{c=e}),u=typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,v=()=>{let[n,r,a]=Ht(_.current.backgroundColor),o=i.createLinearGradient(0,0,0,t);o.addColorStop(0,n),o.addColorStop(.45,r),o.addColorStop(1,a),i.fillStyle=o,i.fillRect(0,0,e,t);let s=zt(a,[14,15,20]),c=Bt(s,[255,255,255],.22),l=i.createRadialGradient(e*.5,t*.75,0,e*.5,t,e*.55);l.addColorStop(0,Vt(c,.35)),l.addColorStop(1,Vt(s,0)),i.fillStyle=l,i.fillRect(0,0,e,t)},x=e=>{let n=qt(e.age)*Jt(e.y,t);if(n<=.01)return;let r=o[e.sprite],a=e.birthSize+(e.maxSize-e.birthSize)*Math.min(1,e.age*1.15),s=e.size+(a-e.size)*.35,c=s,l=s*e.stretch;i.save(),i.translate(e.x,e.y),i.rotate(e.rotation),i.globalAlpha=e.opacity*n*(.85+e.warmth*.2),i.globalCompositeOperation=`screen`,i.drawImage(r,-c/2,-l/2,c,l),i.restore()},S=()=>{if(g.current=requestAnimationFrame(S),c)return;let n=b(_.current.speed,0,3),r=b(_.current.disperseStrength,0,3);s+=.01*Math.max(n,.001),v(),h.current!==_.current.color&&(m.current=Wt(zt(_.current.color,[210,212,216])),h.current=_.current.color);let a=m.current??o,l=f.current,u=p.current;for(let e=u.length-1;e>=0;e--){let t=u[e],n=1-t.life,i=Math.sin(Math.PI*Math.min(1,n*1.05))*t.strength;t.radius+=(t.maxRadius-t.radius)*.055;for(let e of l){let n=e.x-t.x,a=e.y-t.y,o=Math.hypot(n,a)||.001;if(o>t.radius)continue;let c=o/t.radius,l=Math.exp(-c*c*2.2)*(1-c*.35),u=Math.exp(-(((c-.72)/.32)**2)),d=l*.55+u*.45,f=.72+.28*Math.sin(e.phase*2.7+s*1.2+o*.03),p=d*e.receptivity*f*i;if(p<.02)continue;let m=n/o,h=a/o,g=-h*t.swirl,_=m*t.swirl,v=1/(.65+e.mass*.7),y=Math.sin(e.phase*4.2+s*1.6)*.35;e.vx+=(m*.55+g*.22+y*.12)*p*v,e.vy+=(h*.48+_*.22-.06)*p*v,e.opacity*=1-p*.028,e.maxSize*=1+p*.02,e.stretch+=p*.012,e.spin+=y*p*.004,Kt(e,2.4*Math.max(r,.35))}t.life*=.972,t.life<.04&&u.splice(e,1)}i.save();for(let r=0;r<l.length;r++){let o=l[r],c=Math.sin(s*.55+o.phase)*.16,u=Math.cos(s*.4+o.phase*1.3)*.05;o.vx+=c*.018*n,o.vy+=u*.01*n-.0035*n;let d=Math.hypot(o.vx,o.vy),f=d>.8?.975:.99;o.vx*=f,o.vy*=f,o.x+=o.vx*n,o.y+=o.vy*n,o.rotation+=(o.spin+o.vx*.002)*n,o.age+=o.ageSpeed*n;let p=o.birthSize+(o.maxSize-o.birthSize)*Math.min(1,o.age*1.15);o.size+=(p-o.size)*.04;let m=(.3+o.warmth*.1)*Jt(o.y,t),h=.006+.008*Math.max(0,1-d/2.2);if(o.opacity+=(m-o.opacity)*h,o.stretch+=(1.05+(1-o.y/t)*.55-o.stretch)*.01,o.age>=1||o.y<-o.size||o.opacity<.02){l[r]=Gt(e,t,0);continue}o.x<-o.size&&(o.x=e+o.size*.5),o.x>e+o.size&&(o.x=-o.size*.5);let g=qt(o.age)*Jt(o.y,t);if(g<=.01)continue;let _=a[o.sprite],v=o.birthSize+(o.maxSize-o.birthSize)*Math.min(1,o.age*1.15),y=o.size+(v-o.size)*.35,b=y,x=y*o.stretch;i.save(),i.translate(o.x,o.y),i.rotate(o.rotation),i.globalAlpha=o.opacity*g*(.85+o.warmth*.2),i.globalCompositeOperation=`screen`,i.drawImage(_,-b/2,-x/2,b,x),i.restore()}i.restore(),i.globalCompositeOperation=`source-over`,i.globalAlpha=1};if(u){v();for(let e of f.current)x(e);return i.globalCompositeOperation=`source-over`,i.globalAlpha=1,()=>{l()}}return S(),()=>{cancelAnimationFrame(g.current),l()}},[t,e]),(0,l.jsx)(`div`,{className:Mt.smokeFog,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:d,className:Mt.canvas,style:{width:e,height:t,cursor:u?`pointer`:`default`},role:`img`,"aria-label":u?`烟雾背景,点击可驱散`:`烟雾背景`})})},Xt=.82,Zt=.08,Qt=1e3/60,$t=46*2.6,en=()=>({x:-1e3,y:-1e3,prevX:-1e3,prevY:-1e3,vx:0,vy:0,speed:0,active:!1,lastTs:0}),tn=e=>e<.5?2*e*e:1-(-2*e+2)**2/2,nn=e=>1-(1-e)**3,rn=(e,t,n)=>{let r=Math.min(1,Math.max(0,(n-e)/(t-e)));return r*r*(3-2*r)},H=(e,t)=>e**t,an=e=>{let t=Math.sin(e*127.1+311.7)*43758.5453;return t-Math.floor(t)},on=(e,t,n=!0)=>{let r=.18+(e/18)**.5*.52,i=n?.8+Math.random()*.35:1;return r*t*i},U=(e,t,n,r,i)=>{let a=e.createRadialGradient(t,n,0,t,n,r);for(let[e,t]of i)a.addColorStop(e,t);e.fillStyle=a,e.beginPath(),e.arc(t,n,r,0,Math.PI*2),e.fill()},sn=(e,t,n,r,i,a,o)=>{e.save(),e.translate(t,n),e.rotate(r),e.scale(a,1);let s=e.createRadialGradient(0,0,0,0,i*.15,i);s.addColorStop(0,`rgb(170 220 240 / ${o*100}%)`),s.addColorStop(.2,`rgb(90 170 200 / ${o*45}%)`),s.addColorStop(.55,`rgb(40 110 150 / ${o*12}%)`),s.addColorStop(1,`rgb(10 40 60 / 0%)`),e.fillStyle=s,e.beginPath(),e.arc(0,i*.15,i,0,Math.PI*2),e.fill(),e.restore()},cn=(e,t,n,r,i)=>{let a=Math.min(70,Math.floor(t*n/22e3));for(let o=0;o<a;o++){let a=an(o+1),s=an(o+57),c=an(o+131),l=.3+c*1.1,u=5+s*16,d=Math.sin(r*(.1+a*.28)+o*.7)*(5+s*14),f=(a*t+r*(1.5+c*5)+d)%(t+24)-12,p=(s*n+r*u*.22)%(n+24)-12,m=Math.min(1,Math.max(0,p/n)),h=(.02+c*.07)*(.35+m*.55),g=l*4.4;e.globalAlpha=h,e.drawImage(i,f-g*.5,p-g*.5,g,g)}e.globalAlpha=1},ln=(e,t,n,r)=>{let i=e.createLinearGradient(0,0,0,n);i.addColorStop(0,`#0c4558`),i.addColorStop(.08,`#0a3c50`),i.addColorStop(.18,`#083445`),i.addColorStop(.32,`#062a38`),i.addColorStop(.48,`#041f2b`),i.addColorStop(.64,`#03161f`),i.addColorStop(.8,`#020e15`),i.addColorStop(.92,`#01080c`),i.addColorStop(1,`#000406`),e.fillStyle=i,e.fillRect(0,0,t,n),U(e,t*.55,-n*.05,n*1.05,[[0,`rgb(150 215 235 / 26%)`],[.18,`rgb(80 170 200 / 14%)`],[.4,`${r}12`],[.65,`rgb(30 90 120 / 4%)`],[1,`rgb(5 20 30 / 0%)`]]),U(e,t*.18,n*.12,t*.7,[[0,`rgb(70 150 175 / 8%)`],[.45,`rgb(30 90 120 / 3%)`],[1,`rgb(10 30 45 / 0%)`]]),U(e,t*.88,n*.22,t*.55,[[0,`rgb(50 120 150 / 6%)`],[.5,`rgb(20 70 100 / 2%)`],[1,`rgb(5 20 30 / 0%)`]]);for(let r=0;r<4;r++){let i=an(r+3),a=an(r+11);U(e,t*(.2+i*.6),n*(.28+a*.4),n*(.28+a*.18),[[0,`rgb(25 70 95 / ${4+i*3}%)`],[.5,`rgb(15 45 65 / ${2+a*2}%)`],[1,`rgb(5 20 30 / 0%)`]])}let a=e.createLinearGradient(0,0,0,n);a.addColorStop(0,`rgb(0 10 16 / 0%)`),a.addColorStop(.35,`rgb(0 8 14 / 6%)`),a.addColorStop(.65,`rgb(0 5 10 / 22%)`),a.addColorStop(.85,`rgb(0 3 7 / 42%)`),a.addColorStop(1,`rgb(0 1 3 / 62%)`),e.fillStyle=a,e.fillRect(0,0,t,n),U(e,t*.5,n*1.05,n*.55,[[0,`rgb(0 2 5 / 70%)`],[.45,`rgb(0 4 8 / 35%)`],[1,`rgb(0 6 10 / 0%)`]]),U(e,t*.28,n*1.02,t*.4,[[0,`rgb(0 3 6 / 28%)`],[1,`rgb(0 3 6 / 0%)`]]),U(e,t*.75,n*1.04,t*.35,[[0,`rgb(0 2 5 / 24%)`],[1,`rgb(0 2 5 / 0%)`]]);let o=e.createRadialGradient(t*.5,n*.4,Math.min(t,n)*.35,t*.5,n*.48,Math.max(t,n)*.78);o.addColorStop(0,`rgb(0 0 0 / 0%)`),o.addColorStop(.55,`rgb(0 6 10 / 6%)`),o.addColorStop(.8,`rgb(0 3 6 / 18%)`),o.addColorStop(1,`rgb(0 1 3 / 36%)`),e.fillStyle=o,e.fillRect(0,0,t,n)},un=(e,t,n,r,i,a)=>{let o=t*(.55+Math.sin(r*.07)*.03);e.save(),e.globalCompositeOperation=`screen`;for(let i=0;i<5;i++){let o=r*.11+i*1.35,s=t*(.22+i*.14)+Math.sin(o)*t*(a?.015:.04),c=.12+Math.sin(o*.6+i)*(a?.02:.05),l=.045+i%3*.012+Math.sin(r*.2+i)*.008;sn(e,s,-n*.02,c,n*(.7+i%2*.12),.12+i%3*.04,l)}sn(e,o+t*.02,-n*.04,.08+Math.sin(r*.09)*(a?.012:.03),n*.78,.2,.07+Math.sin(r*.15)*.012),e.restore(),cn(e,t,n,r,i)},dn=()=>{let e=document.createElement(`canvas`);e.width=48,e.height=48;let t=e.getContext(`2d`);if(!t)return e;let n=t.createRadialGradient(48/2,48/2,0,48/2,48/2,48/2);return n.addColorStop(0,`rgb(220 240 250 / 90%)`),n.addColorStop(.3,`rgb(180 220 240 / 42%)`),n.addColorStop(1,`rgb(180 220 240 / 0%)`),t.fillStyle=n,t.beginPath(),t.arc(48/2,48/2,48/2,0,Math.PI*2),t.fill(),e},fn=(e,t)=>e.find(e=>e.id===t),pn=e=>{let t=e.progress,n=tn(rn(0,.72,t)),r=nn(rn(.28,1,t)),i=e.startSecondaryX-e.startPrimaryX,a=e.startSecondaryY-e.startPrimaryY,o=Math.hypot(i,a)||1,s=i/o,c=a/o,l=e.startPrimaryRadius,u=e.startSecondaryRadius,d=l+u,f=d*(1-n),p=e.startPrimaryX+s*(d-f)*(u/(l+u)),m=e.startPrimaryY+c*(d-f)*(u/(l+u)),h=p+s*f,g=m+c*f;return{ax:p,ay:m,ar:l+(e.targetRadius-l)*r,bx:h,by:g,br:Math.max(.8,u*(1-r*.97)),approach:n,absorb:r}},mn=(e,t)=>{let n=new Map;for(let t of e){let e=`${Math.floor(t.x/$t)},${Math.floor(t.y/$t)}`,r=n.get(e);r?r.push(t):n.set(e,[t])}for(let r of e){let e=Math.floor(r.x/$t),i=Math.floor(r.y/$t);for(let a=-1;a<=1;a++)for(let o=-1;o<=1;o++){let s=n.get(`${e+a},${i+o}`);if(s)for(let e of s)e.id<=r.id||t(r,e)}}},hn=e=>{mn(e,(e,t)=>{let n=t.x-e.x,r=t.y-e.y,i=Math.hypot(n,r)||1,a=i-(e.radius+t.radius),o=Math.min(8,(e.radius+t.radius)*.14);if(a>o||a<0)return;let s=(1-a/o)*.01,c=n/i,l=r/i;e.vx+=c*s,e.vy+=l*s*.55,t.vx-=c*s,t.vy-=l*s*.55})},gn=(e,t,n)=>{mn(e,(e,r)=>{if(n.has(e.id)||n.has(r.id)||Math.hypot(e.x-r.x,e.y-r.y)>e.radius+r.radius-Math.min(e.radius,r.radius)*.12)return;let i=e.radius>=r.radius?e:r,a=e.radius>=r.radius?r:e,o=Math.min(46,Math.cbrt(i.radius**3+a.radius**3));t.push({primaryId:i.id,secondaryId:a.id,progress:0,targetRadius:o,startPrimaryRadius:i.radius,startSecondaryRadius:a.radius,startPrimaryX:i.x,startPrimaryY:i.y,startSecondaryX:a.x,startSecondaryY:a.y}),n.add(i.id),n.add(a.id)})},_n=(e,t,n,r)=>{let i=[];for(let a=0;a<t.length;a++){let o=t[a],s=fn(e,o.primaryId),c=fn(e,o.secondaryId);if(!s||!c){i.push(a);continue}o.progress=Math.min(1,o.progress+.018*r);let l=(s.vy+c.vy)*.5-.12,u=(s.vx+c.vx)*.5;o.startPrimaryX+=u*r,o.startPrimaryY+=l*r,o.startSecondaryX+=u*r,o.startSecondaryY+=l*r;let d=pn(o);if(o.pose=d,s.x=d.ax,s.y=d.ay,s.radius=d.ar,c.x=d.bx,c.y=d.by,c.radius=d.br,s.vx=u,s.vy=l,c.vx=u,c.vy=l,o.progress>=1){s.x=(d.ax*d.ar+d.bx*d.br)/Math.max(1,d.ar+d.br),s.y=(d.ay*d.ar+d.by*d.br)/Math.max(1,d.ar+d.br),s.radius=o.targetRadius,s.terminalRise=Math.min(2.2,on(s.radius,n,!1)*1.04),s.settle=.7,s.aspect=.94;let t=e.findIndex(e=>e.id===c.id);t>=0&&e.splice(t,1),i.push(a)}}for(let e=i.length-1;e>=0;e--)t.splice(i[e],1)},vn=(e,t,n,r,i=!1)=>{let a=i?2.5+Math.random()*9:4+Math.random()*(Math.random()<.25?18:10),o=a+8,s=on(a,r),c=a<10?.985+Math.random()*.02:.96+Math.random()*.03;return{id:e,x:o+Math.random()*Math.max(1,t-o*2),y:n+a+Math.random()*(i?120:36),radius:a,terminalRise:s,drift:(Math.random()-.5)*.22,vx:(Math.random()-.5)*.15,vy:-s*(.04+Math.random()*.14),phase:Math.random()*Math.PI*2,alpha:.42+Math.random()*.38,aspect:c,deformAmp:.008+Math.random()*.012+Math.min(.015,a*6e-4),deformPhase:Math.random()*Math.PI*2,deformSpeed:.7+Math.random()*.5,tilt:Math.random()*Math.PI*2,pulseBoost:0,streamStretch:0,streamAngle:0,mode2:0,mode2Vel:0,mode2Angle:Math.random()*Math.PI,mode3:0,mode3Vel:0,mode3Phase:Math.random()*Math.PI*2,settle:0}},yn=(e,t,n)=>({x:Math.sin(t*.009+n*.48)*.12+Math.cos(e*.006-n*.32)*.09,y:Math.cos(e*.008+n*.38)*.05}),bn=(e,t,n,r,i)=>{let a=1+(1-Math.min(1,Math.max(0,e.y/n)))*.12,o=(e.terminalRise*r*a- -e.vy)*(.022+e.radius*.0011);e.vy-=o*i;let s=.03+e.radius*.0025,c=Math.sin(t*(1.1+e.deformSpeed)+e.phase)*s+Math.sin(t*2.1+e.deformPhase)*s*.35;e.vy-=c*.02*i;let l=Math.sin(t*.85+e.deformPhase)*(.05+e.radius*.003)+Math.cos(t*.5+e.phase)*.03;e.vx+=l*.015*i;let u=yn(e.x,e.y,t);e.vx+=(e.drift*.015+u.x*.05)*i,e.vy+=u.y*.025*i,e.vx*=H(.968,i),e.vy*=H(.994,i),e.x+=(e.vx+u.x*.22)*i,e.y+=e.vy*i},xn=(e,t,n,r,i,a,o)=>{let s=e-n,c=t-r,l=Math.hypot(s,c)||1,u=70+Math.min(140,o*3.8),d=l/u;if(d>1.35)return{fx:0,fy:0,strain:0,strainAngle:0,excite:0};let f=Math.exp(-d*d*2.1),p=s/l,m=c/l,h=Math.max(.001,Math.hypot(i,a)),g=i/h,_=a/h,v=-_,y=g,b=s*v+c*y,x=s*g+c*_,S=f*Math.min(1.15,o/22),C=x<0?1.35:.72,w=f*Math.min(1,o/18)*Math.tanh(b/(u*.35)),T=f*Math.min(.85,o/30)*(1-Math.abs(x)/(u+1)),E=g*S*1.55*C+v*w*1.25+p*T*.55,D=_*S*1.55*C+y*w*1.25+m*T*.55;return{fx:E,fy:D,strain:f*Math.min(1,o/16)*(.55+Math.abs(w)*.45),strainAngle:Math.atan2(D+_*.4,E+g*.4),excite:f*Math.min(1.2,o/14)}},Sn=(e,t)=>{let n=.22+3.4/Math.sqrt(Math.max(6,e.radius)),r=n*1.55,i=.045+e.radius*9e-4,a=.055+e.radius*.001;e.mode2Vel+=(-n*n*e.mode2-i*e.mode2Vel)*t,e.mode2+=e.mode2Vel*t,e.mode2=Math.max(-1.1,Math.min(1.1,e.mode2)),e.mode2*=H(.998,t),e.mode3Vel+=(-r*r*e.mode3-a*e.mode3Vel)*t,e.mode3+=e.mode3Vel*t,e.mode3=Math.max(-.9,Math.min(.9,e.mode3)),e.mode3*=H(.997,t),e.mode3Phase+=(.04+Math.abs(e.mode3Vel)*.8)*t,e.streamStretch*=H(.88,t),Math.abs(e.streamStretch)<.004&&(e.streamStretch=0),Math.abs(e.mode2)<.002&&Math.abs(e.mode2Vel)<.002&&(e.mode2=0,e.mode2Vel=0),Math.abs(e.mode3)<.002&&Math.abs(e.mode3Vel)<.002&&(e.mode3=0,e.mode3Vel=0)},Cn=(e,t,n,r,i,a)=>{if(t<.02&&r<.02)return;let o=Math.min(.55,t*.65);e.streamStretch=e.streamStretch*(1-o)+t*o,e.streamAngle=e.streamAngle*(1-o)+n*o;let s=r*(.06+Math.min(.05,e.radius*.0014));e.mode2Vel+=s*(.75+Math.random()*.85),e.mode2Angle=e.mode2Angle*.7+n*.3,e.mode3Vel+=s*.45*(Math.random()-.3),e.pulseBoost=Math.min(1.35,e.pulseBoost+r*.08),e.tilt+=(i*.002-a*.0015)*r},wn=(e,t,n)=>{let r=Math.sin(n*e.deformSpeed+e.deformPhase)*e.deformAmp+(Math.sin(t*2+e.phase+n*.4)*e.deformAmp*.55+Math.sin(t*3+e.deformPhase)*e.deformAmp*.25)+e.pulseBoost*.035+e.settle*.06;if(Math.abs(e.streamStretch)>.01){let n=Math.cos(t-e.streamAngle),i=e.streamStretch*(.14+Math.min(.08,e.radius*.0025));r+=n*n*i,r-=(1-n*n)*i*.55}return Math.abs(e.mode2)>.002&&(r+=e.mode2*Math.cos(2*(t-e.mode2Angle))*.28),Math.abs(e.mode3)>.002&&(r+=e.mode3*Math.cos(3*(t-e.mode3Phase))*.16),e.radius*(1+r)},Tn=(e,t)=>{let n=e.x,r=e.y,i=e.aspect-e.settle*.04,a=e.tilt,o=Math.abs(e.streamStretch)*.7+Math.abs(e.mode2)*.9+Math.abs(e.mode3)*.35;if(o>.03){let t=Math.min(1,o),n=e.streamStretch>.02?e.streamAngle:e.mode2Angle;a=a*(1-t*.55)+n*t*.55,i-=Math.min(.12,e.streamStretch*.1+Math.abs(e.mode2)*.08)}let s=Math.cos(a),c=Math.sin(a),l=new Path2D;for(let a=0;a<=48;a++){let o=Math.PI*2*a/48,u=wn(e,o,t),d=Math.cos(o)*u,f=Math.sin(o)*u*i,p=n+d*s-f*c,m=r+d*c+f*s;a===0?l.moveTo(p,m):l.lineTo(p,m)}return l.closePath(),l},En=(e,t,n,r,i,a,o,s)=>{let c=(e-n)*(e-n)+(t-r)*(t-r)+.35,l=(e-a)*(e-a)+(t-o)*(t-o)+.35;return i*i/c+s*s/l},Dn=(e,t,n,r,i,a,o,s,c)=>{let l=Math.cos(e),u=Math.sin(e),d=Math.hypot(t-s,n-c)+Math.hypot(i-s,a-c)+r+o+8,f=0,p=d;for(let e=0;e<14;e++){let e=(f+p)*.5;En(s+l*e,c+u*e,t,n,r,i,a,o)>=1?f=e:p=e}let m=(f+p)*.5;return{x:s+l*m,y:c+u*m}},On=(e,t,n,r,i,a)=>{let o=n+a||1,s=(e*n+r*a)/o,c=(t*n+i*a)/o,l=new Path2D;for(let o=0;o<=56;o++){let u=Dn(Math.PI*2*o/56,e,t,n,r,i,a,s,c);o===0?l.moveTo(u.x,u.y):l.lineTo(u.x,u.y)}return l.closePath(),{path:l,cx:s,cy:c,radius:Math.max(n,a)}},kn=(e,t,n,r,i,a)=>{let o=Tn(t,n),s=Math.min(1,Math.max(0,t.y/a)),c=i*Xt,l=a*Zt,u=Math.atan2(l-t.y,c-t.x),d=t.x+Math.cos(u)*t.radius*.38,f=t.y+Math.sin(u)*t.radius*.38,p=t.x-Math.cos(u)*t.radius*.42,m=t.y-Math.sin(u)*t.radius*.42,h=t.alpha*(.55+(1-s)*.55),g=e.createRadialGradient(d,f,t.radius*.04,t.x,t.y,t.radius*1.45);g.addColorStop(0,`rgb(255 255 255 / 72%)`),g.addColorStop(.12,`rgb(186 230 253 / 42%)`),g.addColorStop(.35,`${r}30`),g.addColorStop(.62,`rgb(14 116 144 / 22%)`),g.addColorStop(.85,`rgb(2 12 27 / 48%)`),g.addColorStop(1,`rgb(1 4 12 / 78%)`),e.fillStyle=g,e.globalAlpha=h,e.fill(o),e.save(),e.clip(o);let _=e.createRadialGradient(p,m,0,p,m,t.radius*.95);_.addColorStop(0,`rgb(1 8 20 / 58%)`),_.addColorStop(.55,`rgb(2 12 27 / 28%)`),_.addColorStop(1,`rgb(2 12 27 / 0%)`),e.fillStyle=_,e.fillRect(t.x-t.radius*1.2,t.y-t.radius*1.2,t.radius*2.4,t.radius*2.4),e.beginPath(),e.ellipse(d,f,t.radius*.2,t.radius*.11,u-.25,0,Math.PI*2),e.fillStyle=`rgb(255 255 255 / 78%)`,e.fill(),e.beginPath(),e.ellipse(t.x+Math.cos(u+.9)*t.radius*.15,t.y+Math.sin(u+.9)*t.radius*.15,t.radius*.07,t.radius*.04,u,0,Math.PI*2),e.fillStyle=`rgb(255 255 255 / 22%)`,e.fill(),e.restore();let v=e.createRadialGradient(t.x,t.y,t.radius*.68,t.x,t.y,t.radius*1.06);v.addColorStop(0,`rgb(255 255 255 / 0%)`),v.addColorStop(.5,`rgb(186 230 253 / 24%)`),v.addColorStop(1,`rgb(224 242 254 / 55%)`),e.strokeStyle=v,e.lineWidth=.8+t.radius*.028,e.stroke(o),e.globalAlpha=1},An=(e,t,n,r,i,a,o,s,c,l,u)=>{let d=On(t,n,r,i,a,o),f=Math.min(1,Math.max(0,d.cy/l)),p=c*Xt,m=l*Zt,h=Math.atan2(m-d.cy,p-d.cx),g=d.cx+Math.cos(h)*d.radius*.32,_=d.cy+Math.sin(h)*d.radius*.32,v=Math.hypot(t-i,n-a)+r+o,y=e.createRadialGradient(g,_,d.radius*.05,d.cx,d.cy,v*.75);y.addColorStop(0,`rgb(255 255 255 / 70%)`),y.addColorStop(.14,`rgb(186 230 253 / 40%)`),y.addColorStop(.4,`${s}32`),y.addColorStop(.75,`rgb(2 12 27 / 45%)`),y.addColorStop(1,`rgb(1 4 12 / 75%)`),e.fillStyle=y,e.globalAlpha=u*(.55+(1-f)*.5),e.fill(d.path),e.save(),e.clip(d.path),e.beginPath(),e.ellipse(g,_,d.radius*.22,d.radius*.12,h-.2,0,Math.PI*2),e.fillStyle=`rgb(255 255 255 / 72%)`,e.fill(),e.restore(),e.strokeStyle=`rgb(224 242 254 / 42%)`,e.lineWidth=1+d.radius*.02,e.stroke(d.path),e.globalAlpha=1},jn={bubbleField:`cos-bubbleField-i9211`,canvas:`cos-canvas-8vKsT`},Mn=({width:e=800,height:t=500,bubbleCount:n=36,speed:r=1,color:i=`#7dd3fc`,interactive:a=!0})=>{let o=(0,c.useRef)(null),s=(0,c.useRef)([]),u=(0,c.useRef)([]),d=(0,c.useRef)(en()),f=(0,c.useRef)(0),p=(0,c.useRef)(0),m=(0,c.useRef)(1),h=(0,c.useRef)(0),g=(0,c.useRef)(null),_=(0,c.useRef)(null),v=(0,c.useRef)({width:e,height:t,speed:r,color:i,interactive:a,bubbleCount:n});return(0,c.useEffect)(()=>{v.current={width:e,height:t,speed:r,color:i,interactive:a,bubbleCount:n}},[e,t,r,i,a,n]),(0,c.useEffect)(()=>{s.current=Array.from({length:n},()=>{let n=vn(m.current++,e,t,r,!0);return n.y=t*(.15+Math.random()*.85),n.vy=-n.terminalRise*(.35+Math.random()*.35),n}),u.current=[],d.current=en(),f.current=0,p.current=0,h.current=0},[n,t,r,e]),(0,c.useEffect)(()=>{let n=o.current;if(!n)return;let r=Math.min(window.devicePixelRatio||1,2);n.width=Math.floor(e*r),n.height=Math.floor(t*r);let i=n.getContext(`2d`);if(!i)return;i.setTransform(r,0,0,r,0,0);let a=typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;_.current||=dn();let c=_.current,l=0,b=0,x=document.hidden,S=y(e=>{x=e}),C=(r,i)=>{let a=n.getBoundingClientRect(),o=e/Math.max(a.width,1),s=t/Math.max(a.height,1);return{x:(r-a.left)*o,y:(i-a.top)*s}},w=(e,t)=>{if(!v.current.interactive)return;let{x:n,y:r}=C(e,t),i=d.current,a=performance.now(),o=i.lastTs>0?Math.max(1,a-i.lastTs):16;if(i.active){let e=n-i.x,t=r-i.y,a=16/o,s=e*a,c=t*a,l=Math.hypot(s,c);i.vx=i.vx*.55+s*.45,i.vy=i.vy*.55+c*.45,i.speed=i.speed*.55+l*.45}else i.vx=0,i.vy=0,i.speed=0;i.prevX=i.x,i.prevY=i.y,i.x=n,i.y=r,i.active=!0,i.lastTs=a},T=()=>{d.current=en()},E=e=>{w(e.clientX,e.clientY)},D=e=>{w(e.clientX,e.clientY)},O=e=>{w(e.clientX,e.clientY)};n.addEventListener(`pointermove`,E),n.addEventListener(`pointerenter`,D),n.addEventListener(`pointerdown`,O),n.addEventListener(`pointerleave`,T);let k=(o=0)=>{if(b=requestAnimationFrame(k),x)return;l||=o;let _=Math.min(40,Math.max(8,o-l||16.666666666666668));l=o;let y=_/Qt,S=_/1e3;f.current+=S*(a?.6:1);let C=f.current,{color:w,speed:T,bubbleCount:E,interactive:D}=v.current,O=`${e}x${t}@${r}:${w}`;if(g.current?.key!==O){let i=document.createElement(`canvas`);i.width=n.width,i.height=n.height;let a=i.getContext(`2d`);a&&(a.setTransform(r,0,0,r,0,0),ln(a,e,t,w),g.current={key:O,canvas:i})}g.current&&i.drawImage(g.current.canvas,0,0,e,t),un(i,e,t,C,c,a),p.current+=S,p.current>.2&&s.current.length<E&&(p.current=0,s.current.push(vn(m.current++,e,t,T)));let A=d.current;A.active&&(A.speed*=H(.94,y),A.vx*=H(.94,y),A.vy*=H(.94,y));let j=new Set;for(let e of u.current)j.add(e.primaryId),j.add(e.secondaryId);for(let n of s.current){if(n.phase+=.008*y,n.tilt+=Math.sin(C*.2+n.deformPhase)*.0012*y,n.pulseBoost*=H(.92,y),n.settle*=H(.93,y),n.settle>0&&(n.aspect+=(.985-n.aspect)*.08*y),n.settle<.01&&(n.settle=0),j.has(n.id))Sn(n,y);else{bn(n,C,t,T,y),Sn(n,y);let e=Math.hypot(n.vx,n.vy+n.terminalRise*.35);if(e>.55){let t=Math.atan2(n.vy,n.vx);n.streamStretch=Math.min(.85,n.streamStretch*H(.9,y)+Math.min(.35,(e-.55)*.08)*y),n.streamAngle=n.streamAngle*H(.85,y)+t*(1-H(.85,y))}}if(D&&A.active&&A.speed>.2&&!j.has(n.id)){let e=xn(n.x,n.y,A.x,A.y,A.vx,A.vy,A.speed);if(e.excite>.01||Math.hypot(e.fx,e.fy)>.01){let t=1/(.75+n.radius*.035),r=a?.55:1;n.vx+=e.fx*t*y*r,n.vy+=e.fy*t*.82*y*r,Cn(n,e.strain,e.strainAngle,e.excite,e.fx,e.fy)}}if(n.y+n.radius<-12){let r=vn(m.current++,e,t,T);Object.assign(n,r,{y:t+r.radius+ h.current++*.01})}n.x<-n.radius*1.5&&(n.x=e+n.radius),n.x>e+n.radius*1.5&&(n.x=-n.radius)}let M=s.current.filter(e=>!j.has(e.id));hn(M),gn(M,u.current,j),_n(s.current,u.current,T,y),j.clear();for(let e of u.current)j.add(e.primaryId),j.add(e.secondaryId);for(let n of u.current){let r=n.pose??pn(n),a=Math.min(.9,.55+r.absorb*.2);An(i,r.ax,r.ay,r.ar,r.bx,r.by,r.br,w,e,t,a)}let N=[...s.current].sort((e,t)=>t.y-e.y);for(let n of N)j.has(n.id)||kn(i,n,C,w,e,t)};return k(),()=>{cancelAnimationFrame(b),n.removeEventListener(`pointermove`,E),n.removeEventListener(`pointerenter`,D),n.removeEventListener(`pointerdown`,O),n.removeEventListener(`pointerleave`,T),S()}},[t,e]),(0,l.jsx)(`div`,{className:jn.bubbleField,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:o,className:jn.canvas,style:{width:e,height:t}})})},Nn={solarSystem:`cos-solarSystem-27h8F`,canvas:`cos-canvas-C0nRa`},Pn=[{name:`Mercury`,radius:0,orbit:42,speed:4.8,color:`#94a3b8`,size:3},{name:`Venus`,radius:0,orbit:58,speed:3.5,color:`#fbbf24`,size:5},{name:`Earth`,radius:0,orbit:78,speed:3,color:`#38bdf8`,size:5},{name:`Mars`,radius:0,orbit:98,speed:2.4,color:`#f87171`,size:4},{name:`Jupiter`,radius:0,orbit:130,speed:1.6,color:`#fb923c`,size:12},{name:`Saturn`,radius:0,orbit:160,speed:1.2,color:`#fcd34d`,size:10},{name:`Moon`,radius:0,orbit:14,speed:8,color:`#cbd5e1`,size:2,parent:2}],Fn=({width:e=400,height:t=400,speed:n=1,showOrbits:r=!0})=>{let i=(0,c.useRef)(null),a=(0,c.useRef)([]),o=(0,c.useRef)([]);return(0,c.useEffect)(()=>{a.current=Pn.map(e=>({...e,angle:Math.random()*Math.PI*2})),o.current=Array.from({length:80},()=>({x:Math.random(),y:Math.random(),alpha:Math.random()*.6}))},[]),(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=e/2,d=t/2,f=Math.min(e,t)/380,p=0,m=document.hidden,h=y(e=>{m=e}),g=()=>{if(p=requestAnimationFrame(g),m)return;let i=a.current,s=[];l.fillStyle=`#0f172a`,l.fillRect(0,0,e,t),o.current.forEach(n=>{l.fillStyle=`rgba(255,255,255,${n.alpha})`,l.fillRect(n.x*e,n.y*t,1,1)}),l.beginPath(),l.arc(u,d,18*f,0,Math.PI*2);let c=l.createRadialGradient(u,d,0,u,d,18*f);c.addColorStop(0,`#fef08a`),c.addColorStop(.5,`#fbbf24`),c.addColorStop(1,`#f97316`),l.fillStyle=c,l.shadowColor=`#fbbf24`,l.shadowBlur=24,l.fill(),l.shadowBlur=0,i.forEach((e,t)=>{e.angle+=e.speed*.008*n/Math.sqrt(e.orbit);let i=u,a=d;e.parent!==void 0&&s[e.parent]&&(i=s[e.parent].x,a=s[e.parent].y);let o=e.orbit*f,c=i+Math.cos(e.angle)*o,p=a+Math.sin(e.angle)*o;if(s[t]={x:c,y:p},r&&e.parent===void 0&&(l.beginPath(),l.arc(i,a,o,0,Math.PI*2),l.strokeStyle=`rgba(148, 163, 184, 0.15)`,l.lineWidth=1,l.stroke()),e.name===`Saturn`&&(l.beginPath(),l.ellipse(c,p,e.size*f*1.8,e.size*f*.5,e.angle*.3,0,Math.PI*2),l.strokeStyle=`rgba(252, 211, 77, 0.5)`,l.lineWidth=1.5,l.stroke()),l.beginPath(),l.arc(c,p,e.size*f,0,Math.PI*2),l.fillStyle=e.color,e.name===`Earth`){let t=l.createRadialGradient(c-2,p-2,0,c,p,e.size*f);t.addColorStop(0,`#4ade80`),t.addColorStop(.6,e.color),t.addColorStop(1,`#1d4ed8`),l.fillStyle=t}l.fill()})};return g(),()=>{cancelAnimationFrame(p),h()}},[t,r,n,e]),(0,l.jsx)(`div`,{className:Nn.solarSystem,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:Nn.canvas,style:{width:e,height:t}})})},In={snowfall:`cos-snowfall-Q-Dhg`,canvas:`cos-canvas-bJVF8`},Ln=({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=y(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:In.snowfall,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:In.canvas,style:{width:e,height:t}})})},Rn={starfield:`cos-starfield-QTwia`,canvas:`cos-canvas-C2t3g`},zn=({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=y(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:Rn.starfield,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:Rn.canvas,style:{width:e,height:t}})})},W={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`},Bn=({progress:e=0,onOpen:t,label:n=`开启宝箱`})=>{let r=(0,c.useRef)(!1),i=(0,c.useRef)(t),a=b(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:W.progressChest,children:[(0,l.jsxs)(`div`,{className:W.barWrap,children:[(0,l.jsx)(`div`,{className:W.barTrack,children:(0,l.jsx)(`div`,{className:W.barFill,style:{width:`${a}%`}})}),(0,l.jsxs)(`span`,{className:W.pct,children:[a.toFixed(0),`%`]})]}),(0,l.jsxs)(`div`,{className:`${W.chest} ${o?W.open:``}`,children:[(0,l.jsxs)(`div`,{className:W.lid,children:[(0,l.jsx)(`div`,{className:W.lidTop}),(0,l.jsx)(`div`,{className:W.lock})]}),(0,l.jsx)(`div`,{className:W.body,children:o&&(0,l.jsxs)(`div`,{className:W.treasure,children:[(0,l.jsx)(`span`,{children:`💎`}),(0,l.jsx)(`span`,{children:`✨`}),(0,l.jsx)(`span`,{children:`🪙`})]})})]}),(0,l.jsx)(`p`,{className:W.label,children:o?`宝箱已开启!`:n})]})},Vn={radarScan:`cos-radarScan-PZaG8`,canvas:`cos-canvas-fUw5N`},Hn=({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=y(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:Vn.radarScan,style:{width:e,height:e},children:(0,l.jsx)(`canvas`,{ref:r,className:Vn.canvas,style:{width:e,height:e}})})},Un={redPacketRain:`cos-redPacketRain-eJ7FW`,canvas:`cos-canvas-direH`,hud:`cos-hud-InqMq`,end:`cos-end-u0J7o`,hint:`cos-hint-sO6ld`},Wn=({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=y(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:Un.redPacketRain,children:[(0,l.jsx)(`canvas`,{ref:n,className:Un.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:Un.hud,children:[(0,l.jsxs)(`span`,{children:[`已抢: ¥`,s]}),!d&&(0,l.jsx)(`span`,{className:Un.end,children:`红包雨结束`})]}),(0,l.jsx)(`p`,{className:Un.hint,children:`点击红包抢夺`})]})},Gn={returnCityContainer:`cos-returnCityContainer-6XTxj`,star:`cos-star-a59Dx`,glassWrap:`cos-glassWrap-golMO`,rotate:`cos-rotate-7X9Jj`,glassItem:`cos-glassItem-OwlFI`},Kn=({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=Gn.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=Gn.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:Gn.returnCityContainer,children:(0,l.jsx)(`div`,{ref:i,className:Gn.glassWrap})})},qn={ropeChain:`cos-ropeChain-gYaSK`,canvas:`cos-canvas-5i95N`},Jn=({width:e=400,height:t=400,segments:n=16,color:r=`#38bdf8`,gravity:i=.4})=>{let a=(0,c.useRef)(null),o=(0,c.useRef)([]),s=(0,c.useRef)({active:!1,index:-1});return(0,c.useEffect)(()=>{let r=Math.max(4,Math.min(n,30)),i=t*.7/r,a=e/2,s=t*.08;o.current=Array.from({length:r+1},(e,t)=>({x:a,y:s+t*i,prevX:a,prevY:s+t*i,pinned:t===0}))},[t,n,e]),(0,c.useEffect)(()=>{let c=a.current;if(!c)return;let l=window.devicePixelRatio||1;c.width=e*l,c.height=t*l;let u=c.getContext(`2d`);if(!u)return;u.setTransform(l,0,0,l,0,0);let d=Math.max(4,Math.min(n,30)),f=t*.7/d,p=(e,t)=>{let n=o.current,r=-1,i=30;return n.forEach((n,a)=>{let o=Math.hypot(n.x-e,n.y-t);o<i&&(i=o,r=a)}),r},m=(e,t)=>{let n=c.getBoundingClientRect(),r=e-n.left,i=t-n.top,a=p(r,i);if(a>=0){s.current={active:!0,index:a};let e=o.current[a];e.x=r,e.y=i,e.prevX=r,e.prevY=i}},h=(e,t)=>{if(!s.current.active)return;let n=c.getBoundingClientRect(),r=o.current[s.current.index];r.x=e-n.left,r.y=t-n.top},g=()=>{s.current={active:!1,index:-1}},_=e=>m(e.clientX,e.clientY),v=e=>h(e.clientX,e.clientY),b=e=>{e.touches[0]&&m(e.touches[0].clientX,e.touches[0].clientY)},x=e=>{e.touches[0]&&h(e.touches[0].clientX,e.touches[0].clientY)};c.addEventListener(`mousedown`,_),c.addEventListener(`mousemove`,v),window.addEventListener(`mouseup`,g),c.addEventListener(`touchstart`,b,{passive:!0}),c.addEventListener(`touchmove`,x,{passive:!0}),window.addEventListener(`touchend`,g);let S=0,C=document.hidden,w=y(e=>{C=e}),T=()=>{if(S=requestAnimationFrame(T),C)return;let n=o.current,a=s.current;for(let e of n){if(e.pinned||a.active&&n.indexOf(e)===a.index)continue;let t=(e.x-e.prevX)*.99,r=(e.y-e.prevY)*.99;e.prevX=e.x,e.prevY=e.y,e.x+=t,e.y+=r,e.y+=i}for(let e=0;e<6;e++)for(let e=0;e<n.length-1;e++){let t=n[e],r=n[e+1],i=r.x-t.x,o=r.y-t.y,s=Math.hypot(i,o)||.001,c=(s-f)/s,l=i*c*.5,u=o*c*.5;!t.pinned&&!(a.active&&e===a.index)&&(t.x+=l,t.y+=u),!r.pinned&&!(a.active&&e+1===a.index)&&(r.x-=l,r.y-=u)}u.fillStyle=`#0f172a`,u.fillRect(0,0,e,t),u.beginPath(),n.forEach((e,t)=>t===0?u.moveTo(e.x,e.y):u.lineTo(e.x,e.y)),u.strokeStyle=r,u.lineWidth=3,u.lineCap=`round`,u.lineJoin=`round`,u.shadowColor=r,u.shadowBlur=8,u.stroke(),u.shadowBlur=0,n.forEach((e,t)=>{(t===0||t===n.length-1||t%4==0)&&(u.beginPath(),u.arc(e.x,e.y,t===0?6:4,0,Math.PI*2),u.fillStyle=t===0?`#94a3b8`:r,u.fill())})};return T(),()=>{cancelAnimationFrame(S),w(),c.removeEventListener(`mousedown`,_),c.removeEventListener(`mousemove`,v),window.removeEventListener(`mouseup`,g),c.removeEventListener(`touchstart`,b),c.removeEventListener(`touchmove`,x),window.removeEventListener(`touchend`,g)}},[r,i,t,n,e]),(0,l.jsx)(`div`,{className:qn.ropeChain,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:a,className:qn.canvas,style:{width:e,height:t}})})},Yn={rotatingText:`cos-rotatingText-uIUt4`,badge:`cos-badge-kZAc-`,char:`cos-char-B5HUV`,enter:`cos-enter-JqV3n`,slideIn:`cos-slideIn-4B5cg`,exit:`cos-exit-5rJ34`,slideOut:`cos-slideOut-YeYDC`},Xn=[`React`,`Motion`,`Design`,`COS`],Zn=e=>{let t=Intl;if(t.Segmenter){let n=new t.Segmenter(`en`,{granularity:`grapheme`});return Array.from(n.segment(e),e=>e.segment)}return Array.from(e)},Qn=({texts:e=Xn,interval:t=2200,stagger:n=40,duration:r=420,fontSize:i=56,color:a=`#0f172a`,highlightColor:o=`#38bdf8`})=>{let s=(0,c.useMemo)(()=>e.length>0?e:Xn,[e]),[u,d]=(0,c.useState)(0),[f,p]=(0,c.useState)(`enter`),m=(0,c.useMemo)(()=>Zn(s[u]),[u,s]);return(0,c.useEffect)(()=>{let e,i;return e=setTimeout(()=>{p(`exit`),i=setTimeout(()=>{d(e=>(e+1)%s.length),p(`enter`)},m.length*n+r)},t),()=>{e&&clearTimeout(e),i&&clearTimeout(i)}},[m.length,r,u,t,s.length,n]),(0,l.jsx)(`div`,{className:Yn.rotatingText,children:(0,l.jsx)(`div`,{className:Yn.badge,style:{fontSize:i,color:a,"--rt-bg":o,"--rt-duration":`${r}ms`},children:m.map((e,t)=>(0,l.jsx)(`span`,{className:`${Yn.char} ${f===`enter`?Yn.enter:Yn.exit}`,style:{animationDelay:`${f===`enter`?t*n:(m.length-1-t)*n}ms`},children:e===` `?`\xA0`:e},`${s[u]}-${e}-${t}-${f}`))})})},G={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`},K=(e,t,n,r)=>{let i=(r-90)*Math.PI/180;return{x:e+n*Math.cos(i),y:t+n*Math.sin(i)}},$n=({value:e=0,max:t=100,label:n=`SPEED`,color:r=`#f97316`})=>{let i=-120+b(t>0?e/t:0,0,1)*240,a=(0,c.useMemo)(()=>{let e=K(100,100,72,-120),t=K(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=K(100,100,72,-120),t=K(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=K(100,100,58,i);return(0,l.jsxs)(`div`,{className:G.speedometer,style:{"--gauge-color":r},children:[(0,l.jsxs)(`svg`,{viewBox:`0 0 200 130`,className:G.svg,children:[(0,l.jsx)(`path`,{d:a,className:G.track,fill:`none`,strokeWidth:`12`,strokeLinecap:`round`}),(0,l.jsx)(`path`,{d:o,className:G.valueArc,fill:`none`,strokeWidth:`12`,strokeLinecap:`round`}),[-120,-60,0,60,120].map(e=>{let t=K(100,100,58,e),n=K(100,100,66,e);return(0,l.jsx)(`line`,{x1:t.x,y1:t.y,x2:n.x,y2:n.y,className:G.tick},e)}),(0,l.jsx)(`line`,{x1:`100`,y1:`100`,x2:s.x,y2:s.y,className:G.needle}),(0,l.jsx)(`circle`,{cx:`100`,cy:`100`,r:`6`,className:G.hub}),(0,l.jsx)(`text`,{x:`100`,y:`118`,className:G.valueText,children:Math.round(e)})]}),(0,l.jsx)(`span`,{className:G.label,children:n})]})},er={shinyText:`cos-shinyText-L0KoE`,text:`cos-text-J5KhP`,"shine-sweep":`cos-shine-sweep-jIufI`,paused:`cos-paused-dqgKu`},tr=({text:e=`SHINY TEXT`,speed:t=2,color:n=`#94a3b8`,shineColor:r=`#ffffff`,fontSize:i=64,disabled:a=!1})=>(0,l.jsx)(`div`,{className:er.shinyText,children:(0,l.jsx)(`span`,{className:`${er.text} ${a?er.paused:``}`,style:{fontSize:i,"--shiny-color":n,"--shiny-shine":r,"--shiny-duration":`${Math.max(t,.4)}s`},children:e})}),q={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`},nr=({steps:e=[`Start`,`Process`,`Review`,`Done`],current:t=0,color:n=`#22d3ee`})=>{let r=b(t,0,Math.max(0,e.length-1)),i=e.length>1?r/(e.length-1):0;return(0,l.jsx)(`div`,{className:q.timelinePulse,style:{"--pulse-color":n,"--step-count":e.length,"--progress-ratio":i},children:(0,l.jsxs)(`div`,{className:q.axis,children:[(0,l.jsx)(`div`,{className:q.track}),(0,l.jsx)(`div`,{className:q.progress}),(0,l.jsx)(`ul`,{className:q.steps,children:e.map((e,t)=>{let n=t<r?`done`:t===r?`current`:`pending`;return(0,l.jsxs)(`li`,{className:q.step,"data-state":n,children:[(0,l.jsx)(`span`,{className:q.dot}),(0,l.jsx)(`span`,{className:q.name,children:e})]},e+t)})})]})})},rr={rippleWater:`cos-rippleWater-wsinI`,canvas:`cos-canvas-XOdSF`,hint:`cos-hint-0JH5D`},ir=`
|
|
2
2
|
attribute vec2 a_pos;
|
|
3
3
|
varying vec2 v_uv;
|
|
4
4
|
void main() {
|
|
5
5
|
v_uv = a_pos * 0.5 + 0.5;
|
|
6
6
|
gl_Position = vec4(a_pos, 0.0, 1.0);
|
|
7
7
|
}
|
|
8
|
-
`,
|
|
8
|
+
`,ar=`
|
|
9
9
|
precision highp float;
|
|
10
10
|
|
|
11
11
|
uniform float u_time;
|
|
@@ -90,4 +90,4 @@ void main() {
|
|
|
90
90
|
|
|
91
91
|
gl_FragColor = vec4(water, 1.0);
|
|
92
92
|
}
|
|
93
|
-
`,Gt=e=>{let t=e.replace(`#`,``),n=t.length===3?t.split(``).map(e=>e+e).join(``):t,r=Number.parseInt(n,16);return Number.isNaN(r)?[.22,.74,.97]:[(r>>16&255)/255,(r>>8&255)/255,(r&255)/255]},Kt=(e,t,n)=>{let r=e.createShader(t);return r?(e.shaderSource(r,n),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS)?r:(e.deleteShader(r),null)):null},qt=(e,t,n)=>{let r=Kt(e,e.VERTEX_SHADER,t),i=Kt(e,e.FRAGMENT_SHADER,n);if(!r||!i)return null;let a=e.createProgram();return a?(e.attachShader(a,r),e.attachShader(a,i),e.linkProgram(a),e.deleteShader(r),e.deleteShader(i),e.getProgramParameter(a,e.LINK_STATUS)?a:(e.deleteProgram(a),null)):null},q=192,Jt=e=>({from:Gt(e.fromColor),to:Gt(e.toColor),tint:Gt(e.color),waveAmplitude:e.waveAmplitude,waveSpeed:e.waveSpeed,shimmer:e.shimmer,reflection:e.reflection,rippleStrength:e.rippleStrength,rippleRadius:e.rippleRadius,damping:e.damping,spread:e.spread,interactive:e.interactive}),Yt=({width:e=800,height:t=500,fromColor:n=`#52ade3`,toColor:r=`#013565`,color:i=`#a8d8f5`,waveAmplitude:a=1,waveSpeed:o=1,shimmer:s=1,reflection:u=.38,rippleStrength:d=1,rippleRadius:f=6,damping:p=.985,spread:m=.5,interactive:h=!0,showHint:g=!0,hint:y=`点击水面产生涟漪`})=>{let b=(0,c.useRef)(null),x=(0,c.useRef)(0),S=(0,c.useRef)(null),C=(0,c.useRef)(Jt({fromColor:n,toColor:r,color:i,waveAmplitude:a,waveSpeed:o,shimmer:s,reflection:u,rippleStrength:d,rippleRadius:f,damping:p,spread:m,interactive:h}));(0,c.useEffect)(()=>{C.current=Jt({fromColor:n,toColor:r,color:i,waveAmplitude:a,waveSpeed:o,shimmer:s,reflection:u,rippleStrength:d,rippleRadius:f,damping:p,spread:m,interactive:h})},[n,r,i,a,o,s,u,d,f,p,m,h]);let w=(0,c.useCallback)((e,t)=>{if(!C.current.interactive)return;let n=b.current;if(!n)return;let r=n.getBoundingClientRect();S.current={x:(e-r.left)/r.width,y:1-(t-r.top)/r.height,strength:C.current.rippleStrength}},[]);return(0,c.useEffect)(()=>{let e=b.current;if(!e)return;let t=e=>{e.pointerType===`mouse`&&e.button!==0||w(e.clientX,e.clientY)};return e.addEventListener(`pointerdown`,t),()=>e.removeEventListener(`pointerdown`,t)},[w]),(0,c.useEffect)(()=>{let n=b.current;if(!n)return;let r=Math.min(window.devicePixelRatio||1,2);n.width=Math.floor(e*r),n.height=Math.floor(t*r);let i=n.getContext(`webgl`,{alpha:!1,antialias:!1,depth:!1,stencil:!1,premultipliedAlpha:!1});if(!i)return;let a=qt(i,Ut,Wt);if(!a)return;let o=i.createBuffer();i.bindBuffer(i.ARRAY_BUFFER,o),i.bufferData(i.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,1]),i.STATIC_DRAW);let s=i.getAttribLocation(a,`a_pos`),c=i.getUniformLocation(a,`u_time`),l=i.getUniformLocation(a,`u_res`),u=i.getUniformLocation(a,`u_tint`),d=i.getUniformLocation(a,`u_from`),f=i.getUniformLocation(a,`u_to`),p=i.getUniformLocation(a,`u_height`),m=i.getUniformLocation(a,`u_sim`),h=i.getUniformLocation(a,`u_waveAmp`),g=i.getUniformLocation(a,`u_waveSpeed`),y=i.getUniformLocation(a,`u_shimmer`),w=i.getUniformLocation(a,`u_reflection`),T=q*q,E=new Float32Array(T),D=new Float32Array(T),O=new Float32Array(T),k=i.createTexture();i.bindTexture(i.TEXTURE_2D,k),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE);let A=new Uint8Array(T*4),j=()=>{for(let e=0;e<T;e++){let t=Math.max(0,Math.min(255,Math.floor((D[e]*.5+.5)*255))),n=e*4;A[n]=t,A[n+1]=t,A[n+2]=t,A[n+3]=255}i.bindTexture(i.TEXTURE_2D,k),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,q,q,0,i.RGBA,i.UNSIGNED_BYTE,A)},M=(e,t,n,r)=>{let i=e*(q-1),a=t*(q-1),o=v(r,2,12);for(let e=-o-1;e<=o+1;e++)for(let t=-o-1;t<=o+1;t++){let r=Math.round(i+t),s=Math.round(a+e);if(r<=0||r>=q-1||s<=0||s>=q-1)continue;let c=Math.sqrt(t*t+e*e),l=Math.exp(-c*c*.55)*-.35,u=Math.exp(-((c-o*.55)**2)*.9);D[s*q+r]+=n*(l+u*1.1)}},N=(e,t)=>{let n=v(e,.9,.999),r=v(t,.3,.7);for(let e=0;e<2;e++){for(let e=1;e<q-1;e++){let t=e*q;for(let e=1;e<q-1;e++){let i=t+e,a=D[i-1]+D[i+1]+D[i-q]+D[i+q];O[i]=(a*r-E[i])*n,O[i]>1.5?O[i]=1.5:O[i]<-1.5&&(O[i]=-1.5)}}let e=E;E=D,D=O,O=e,O.fill(0)}},P=e=>{let t=C.current;i.viewport(0,0,n.width,n.height),i.useProgram(a),i.bindBuffer(i.ARRAY_BUFFER,o),i.enableVertexAttribArray(s),i.vertexAttribPointer(s,2,i.FLOAT,!1,0,0),i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,k),i.uniform1i(p,0),i.uniform1f(c,e),i.uniform2f(l,n.width,n.height),i.uniform3f(u,t.tint[0],t.tint[1],t.tint[2]),i.uniform3f(d,t.from[0],t.from[1],t.from[2]),i.uniform3f(f,t.to[0],t.to[1],t.to[2]),i.uniform2f(m,q,q),i.uniform1f(h,v(t.waveAmplitude,0,2)),i.uniform1f(g,v(t.waveSpeed,0,3)),i.uniform1f(y,v(t.shimmer,0,2)),i.uniform1f(w,v(t.reflection,0,1)),i.drawArrays(i.TRIANGLE_STRIP,0,4)};if(j(),typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return P(0),()=>{i.deleteTexture(k),i.deleteBuffer(o),i.deleteProgram(a)};let F=document.hidden,I=_(e=>{F=e}),ee=performance.now(),L=e=>{if(x.current=requestAnimationFrame(L),F)return;let t=C.current;if(S.current){let e=S.current,n=v(e.strength,0,3),r=t.rippleRadius;M(e.x,e.y,n,r),M(e.x+.004,e.y-.003,n*.35,r),S.current=null}N(t.damping,t.spread),j(),P((e-ee)/1e3)};return x.current=requestAnimationFrame(L),()=>{cancelAnimationFrame(x.current),I(),i.deleteTexture(k),i.deleteBuffer(o),i.deleteProgram(a)}},[t,e]),(0,l.jsxs)(`div`,{className:Ht.rippleWater,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:b,className:Ht.canvas,style:{width:e,height:t,cursor:h?`pointer`:`default`},role:`img`,"aria-label":y||`涟漪水面`}),g?(0,l.jsx)(`span`,{className:Ht.hint,"aria-hidden":!0,children:y}):null]})},Xt={scrambleText:`cos-scrambleText-hN4Wm`,text:`cos-text-frsHs`,cursor:`cos-cursor-3zQOy`,blink:`cos-blink-OcKXu`},Zt=`ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%&*`,Qt=({text:e=`DECRYPTED`,duration:t=2e3,charset:n=Zt})=>{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:Zt,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:Xt.scrambleText,children:(0,l.jsxs)(`p`,{className:Xt.text,children:[r,(0,l.jsx)(`span`,{className:Xt.cursor})]})})},$t={scratchCard:`cos-scratchCard-McIEK`,prize:`cos-prize-X0z5V`,canvas:`cos-canvas-JqIlr`,hidden:`cos-hidden-Lsfbt`},en=({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:$t.scratchCard,style:{width:r,height:i},children:[(0,l.jsx)(`div`,{className:$t.prize,children:t}),(0,l.jsx)(`canvas`,{ref:a,className:`${$t.canvas} ${d?$t.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`},tn=[`🍒`,`🍋`,`🍊`,`🍇`,`⭐`,`7️⃣`],nn=e=>1-(1-e)**3,rn=({symbols:e=tn,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=nn(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(` `)}`})]})},an={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`},on=[`fromTop`,`fromBottom`,`fromLeft`,`fromRight`],sn=({text:e=`REVEAL`,delay:t=80,color:n=`#f8fafc`})=>(0,l.jsx)(`div`,{className:an.splitReveal,children:(0,l.jsx)(`h1`,{className:an.text,style:{"--reveal-color":n},children:e.split(``).map((e,n)=>(0,l.jsx)(`span`,{className:`${an.char} ${an[on[n%on.length]]}`,style:{animationDelay:`${n*t}ms`},children:e===` `?`\xA0`:e},`${e}-${n}`))})}),cn={spotlight:`cos-spotlight-OddY1`,content:`cos-content-5I1Wy`,overlay:`cos-overlay-F6CJ5`},ln=({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:cn.spotlight,style:{"--spot-radius":`${t}px`,"--dim-color":n},onMouseMove:i,children:[(0,l.jsx)(`div`,{className:cn.content,children:e}),(0,l.jsx)(`div`,{className:cn.overlay})]})},Y={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`},un=[`#FF6B6B`,`#4ECDC4`,`#FFE66D`,`#A78BFA`,`#60A5FA`,`#F472B6`,`#34D399`,`#FB923C`],dn=[{label:`一等奖`},{label:`二等奖`},{label:`三等奖`},{label:`谢谢参与`},{label:`优惠券`},{label:`再来一次`}],fn=e=>1-(1-e)**3,pn=({prizes:e=dn,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??un[e%un.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:Y.turntable,style:{width:v,height:v+80},children:[(0,l.jsxs)(`div`,{className:Y.wheelWrap,style:{width:v,height:v},children:[(0,l.jsx)(`div`,{className:Y.pointer}),(0,l.jsx)(`canvas`,{ref:o,className:Y.canvas,style:{width:v,height:v}}),(0,l.jsx)(`button`,{type:`button`,className:Y.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=fn(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:Y.result,children:[`恭喜获得:`,(0,l.jsx)(`strong`,{children:m.label})]})]})},X={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`},mn=[`Hello, cos-design!`,`欢迎来到组件库 ✨`,`Build something fun 🚀`],hn=({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:X.typewriter,children:(0,l.jsxs)(`div`,{className:X.terminal,children:[(0,l.jsxs)(`div`,{className:X.dots,children:[(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{})]}),(0,l.jsxs)(`p`,{className:X.text,children:[(0,l.jsx)(`span`,{className:X.prompt,children:`>`}),i,(0,l.jsx)(`span`,{className:X.cursor,children:`|`})]})]})})},gn=({texts:e=mn,speed:t=100,deleteSpeed:n=50,pause:r=2e3})=>{let i=e.length>0?e:mn;return(0,l.jsx)(hn,{texts:i,speed:t,deleteSpeed:n,pause:r},i.join(`\0`))},_n={waveButton:`cos-waveButton-Aa7G-`,btn:`cos-btn-WJrEN`,label:`cos-label-9BHOU`,wave:`cos-wave-GycLU`,ripple:`cos-ripple-5ZFpr`},vn=({text:e=`点我试试`,color:t=`#38bdf8`,className:n,style:r,...i})=>(0,l.jsx)(`div`,{className:_n.waveButton,children:(0,l.jsxs)(`button`,{type:`button`,className:`${_n.btn} ${n??``}`,style:{"--wave-color":t,...r},...i,children:[(0,l.jsx)(`span`,{className:_n.wave}),(0,l.jsx)(`span`,{className:_n.wave}),(0,l.jsx)(`span`,{className:_n.label,children:e})]})}),Z=e=>Math.min(1,Math.max(0,e)),yn=e=>{let t=e.replace(`#`,``).trim(),n=t.length===3?t.split(``).map(e=>e+e).join(``):t;if(n.length!==6)return[80,140,200];let r=Number.parseInt(n,16);return Number.isNaN(r)?[80,140,200]:[r>>16&255,r>>8&255,r&255]},bn=([e,t,n])=>{let r=e=>Math.min(255,Math.max(0,Math.round(e))).toString(16).padStart(2,`0`);return`#${r(e)}${r(t)}${r(n)}`},xn=(e,t,n)=>e+(t-e)*n,Sn=(e,t,n)=>[xn(e[0],t[0],n),xn(e[1],t[1],n),xn(e[2],t[2],n)],Q=(e,t,n)=>bn(Sn(yn(e),yn(t),Z(n))),Cn=e=>{let t=Z(e);return t*t*(3-2*t)},wn=(e=Date.now())=>{let t=new Date(e),n=new Date(t);n.setHours(6,0,0,0);let r=new Date(t);return r.setHours(18,0,0,0),{sunrise:n.getTime(),sunset:r.getTime()}},Tn=(e,t=new Date)=>{let n=e.trim().match(/^(\d{1,2}):(\d{2})$/);if(!n)return null;let r=Number(n[1]),i=Number(n[2]);if(r<0||r>23||i<0||i>59)return null;let a=new Date(t);return a.setHours(r,i,0,0),a.getTime()},En=(e,t=new Date)=>Tn(e??`14:00`,t)??Tn(`14:00`,t),Dn=(e,t)=>{let{sunrise:n,sunset:r}=t;if(!(r>n)){let t=wn(e);n=t.sunrise,r=t.sunset}let i=Math.max(1,r-n),a=n+1440*60*1e3,o=r-1440*60*1e3,s=e>=n&&e<r,c;if(s)c=Z((e-n)/i);else if(e>=r){let t=Math.max(1,a-r);c=Z((e-r)/t)}else{let t=Math.max(1,n-o);c=Z((e-o)/t)}let l=s?Math.sin(Math.PI*c):0,u=Math.abs(e-n),d=Math.abs(e-r),f=Z(1-Math.min(u,d)/45e5);return{isDay:s,arcProgress:c,elevation:l,twilight:f}},On=(e,t,n)=>{let r=Z(n),i=Math.sin(Math.PI*r);return{x:e*(.1+.8*r),y:t*(.58-.4*i)}},kn=`#e8895c`,An=`#f3c98a`,jn=`#2a1f4a`,Mn=`#c4784a`,Nn=(e,t,n)=>{if(n.isDay){let t=Cn(n.elevation),r=(1-t)*.72;return[Q(Q(e[0],kn,r),`#1a2438`,(1-t)*.12),Q(Q(e[1],An,r*.85),`#3a4558`,(1-t)*.08)]}let r=n.twilight;return[Q(t[0],Q(jn,kn,.35),r*.55),Q(t[1],Q(Mn,An,.4),r*.7)]},Pn=(e,t,n)=>{let r=e.createLinearGradient(0,0,0,t);return r.addColorStop(0,n[0]),r.addColorStop(1,n[1]),r},Fn=e=>{if(!e.isDay)return{scale:.92+e.twilight*.06,alpha:.75+e.twilight*.2};let t=e.elevation;return{scale:.82+t*.22,alpha:.65+t*.35}},In=2,Ln=[``,`薄雾`,`中雾`,`浓雾`],Rn=e=>Math.min(3,Math.max(1,Math.round(e))),zn=e=>{let t=Rn(e);return`${t} · ${Ln[t]}`},Bn=e=>e===`fog`,Vn=(e,t)=>{let n=Rn(t);return n===1?{...e,fogBanks:3,haze:.06,cloudAlpha:Math.min(e.cloudAlpha,.28),sun:`soft`}:n===3?{...e,fogBanks:12,haze:.3,cloudAlpha:.42,sun:`dim`}:{...e,fogBanks:5,haze:.11,cloudAlpha:.32,sun:`dim`}},Hn=e=>{let t=Rn(e);return t===1?.45:t===3?.95:.65},Un=e=>e===45?2:e===48?3:null,Wn=e=>e==null||!Number.isFinite(e)?null:e>=5e3?1:e>=1e3?2:3,Gn=2,Kn=[``,`细雹`,`密雹`,`巨雹`],qn=e=>Math.min(3,Math.max(1,Math.round(e))),Jn=e=>{let t=qn(e);return`${t} · ${Kn[t]}`},Yn=e=>e===`hail`,Xn=e=>{let t=qn(e);return t===1?{count:75,sizeMin:.85,sizeMax:2.1,speedMul:.88}:t===3?{count:210,sizeMin:2.4,sizeMax:5.6,speedMul:1.22}:{count:145,sizeMin:1.4,sizeMax:3.8,speedMul:1}},Zn=e=>e===96?2:e===99?3:null,Qn=1,$n=10,er=5,tr=5,$=e=>Math.min(10,Math.max(1,Math.round(e))),nr=(e,t,n)=>e+(t-e)*n,rr=e=>{let t=$(e);return t<=2?1:t<=4?2:t<=6?3:t<=8?4:5},ir=[`毛毛雨`,`小雨`,`中雨`,`暴雨`,`特大暴雨`],ar=[`毛毛雪`,`小雪`,`中雪`,`暴雪`,`特大暴雪`],or=(e,t)=>{let n=rr(e);return(t===`rain`?ir:ar)[n-1]},sr=(e,t)=>`${$(e)} · ${or(e,t)}`,cr=[``,...ir],lr=[``,...ar],ur=e=>e===`lightRain`||e===`moderateRain`||e===`heavyRain`?`rain`:e===`lightSnow`||e===`moderateSnow`||e===`heavySnow`?`snow`:e,dr=e=>e===`rain`||e===`lightRain`||e===`moderateRain`||e===`heavyRain`,fr=e=>e===`snow`||e===`lightSnow`||e===`moderateSnow`||e===`heavySnow`,pr=e=>dr(e)||e===`thunderstorm`||e===`sleet`,mr=e=>fr(e)||e===`sleet`,hr=(e,t=5)=>e===`lightRain`?3:e===`moderateRain`?5:e===`heavyRain`?8:$(t),gr=(e,t=5)=>e===`lightSnow`?3:e===`moderateSnow`?5:e===`heavySnow`?8:$(t),_r=(e,t)=>t===`rain`?e<=2?`lightRain`:e===3?`moderateRain`:`heavyRain`:e<=2?`lightSnow`:e===3?`moderateSnow`:`heavySnow`,vr=(e,t=5,n=5)=>e===`rain`?_r(rr(t),`rain`):e===`lightRain`||e===`moderateRain`||e===`heavyRain`?_r(rr(hr(e)),`rain`):e===`snow`?_r(rr(n),`snow`):e===`lightSnow`||e===`moderateSnow`||e===`heavySnow`?_r(rr(gr(e)),`snow`):e,yr=(e,t)=>{let n=($(t)-1)/9;return{count:Math.round(nr(35,340,n)),speed:nr(5.5,16,n),wind:nr(-.4,-3.2,n),alpha:nr(.28,.62,n),splash:$(t)>=5}},br=e=>{let t=($(e)-1)/9;return Math.round(nr(30,360,t))},xr=e=>[51,56].includes(e)?2:[61,66,80].includes(e)?3:[53,55,57,63,81].includes(e)?5:[65,67].includes(e)?8:[82].includes(e)?10:[95].includes(e)?7:null,Sr=e=>[77].includes(e)?2:[71,85].includes(e)?3:[73].includes(e)?5:[75].includes(e)?8:[86].includes(e)?10:null,Cr=2,wr=[``,`轻霾`,`中霾`,`重霾`],Tr=e=>Math.min(3,Math.max(1,Math.round(e))),Er=e=>{let t=Tr(e);return`${t} · ${wr[t]}`},Dr=e=>e===`smog`,Or=(e,t)=>{let n=Tr(t);return n===1?{...e,fogBanks:5,haze:.16,cloudAlpha:Math.min(e.cloudAlpha,.28),sun:`soft`}:n===3?{...e,fogBanks:16,haze:.48,cloudAlpha:.42,sun:`dim`}:{...e,fogBanks:12,haze:.34,cloudAlpha:.35,sun:`dim`}},kr=e=>{let t=Tr(e);return t===1?.55:t===3?1.05:.85},Ar=e=>e==null||!Number.isFinite(e)?null:e>=5e3?1:e>=1e3?2:3,jr={0:`sunny`,1:`sunny`,2:`partlyCloudy`,3:`overcast`,45:`fog`,48:`fog`,51:`rain`,53:`rain`,55:`rain`,56:`rain`,57:`rain`,61:`rain`,63:`rain`,65:`rain`,66:`rain`,67:`rain`,80:`rain`,81:`rain`,82:`rain`,71:`snow`,73:`snow`,75:`snow`,77:`snow`,85:`snow`,86:`snow`,95:`thunderstorm`,96:`hail`,99:`hail`},Mr=e=>ur(jr[e]??`overcast`),Nr={weather:null,rainLevel:null,snowLevel:null,fogLevel:null,hailLevel:null,smogLevel:null,status:`idle`,error:null,current:null},Pr={weather:null,rainLevel:null,snowLevel:null,fogLevel:null,hailLevel:null,smogLevel:null,status:`locating`,error:null,current:null},Fr={weather:null,rainLevel:null,snowLevel:null,fogLevel:null,hailLevel:null,smogLevel:null,status:`fetching`,error:null,current:null},Ir=e=>e!=null&&Number.isFinite(e.latitude)&&Number.isFinite(e.longitude),Lr=e=>{if(typeof e!=`string`||!e)return null;let t=Date.parse(e);return Number.isFinite(t)?t:null},Rr=e=>{if(typeof e!=`string`||!e)return null;let t=e.match(/T(\d{2}):(\d{2})/);return t?`${t[1]}:${t[2]}`:null},zr=(e,t)=>{if(e)try{let t=new Intl.DateTimeFormat(`en-GB`,{timeZone:e,hour:`2-digit`,minute:`2-digit`,hour12:!1}).formatToParts(new Date),n=t.find(e=>e.type===`hour`)?.value,r=t.find(e=>e.type===`minute`)?.value;if(n!=null&&r!=null)return`${n.padStart(2,`0`)}:${r.padStart(2,`0`)}`}catch{}return t??null},Br=(e=!0,t)=>{let n=Ir(t),r=n?t.latitude:null,i=n?t.longitude:null,a=e?n?Fr:Pr:Nr,o=`${e}:${r},${i}`,[s,l]=(0,c.useState)(a),[u,d]=(0,c.useState)(o);return u!==o&&(d(o),l(t=>e&&t.weather?{...a,weather:t.weather,current:t.current}:a)),(0,c.useEffect)(()=>{if(!e)return;let t=!1,n=new AbortController,a=async(e,r)=>{try{let i=new URLSearchParams({latitude:String(e),longitude:String(r),current:`weather_code,wind_speed_10m,is_day,visibility`,daily:`sunrise,sunset`,timezone:`auto`,forecast_days:`1`}),a=await fetch(`https://api.open-meteo.com/v1/forecast?${i}`,{signal:n.signal});if(!a.ok)throw Error(`Open-Meteo 请求失败(HTTP ${a.status})`);let o=await a.json(),s=Number(o?.current?.weather_code);if(Number.isNaN(s))throw Error(`Open-Meteo 返回数据缺少 weather_code`);let c=Number(o?.current?.wind_speed_10m??0),u=Lr(o?.daily?.sunrise?.[0]),d=Lr(o?.daily?.sunset?.[0]),f=typeof o?.timezone==`string`?o.timezone:null,p=Rr(o?.current?.time)??zr(f),m=Mr(s),h=xr(s),g=Sr(s),_=o?.current?.visibility,v=_!=null&&Number.isFinite(Number(_))?Number(_):null,y=m===`fog`?Wn(v)??Un(s)??2:null,b=m===`hail`?Zn(s)??2:null,x=m===`smog`?Ar(v)??2:null;if(t)return;l({weather:m,rainLevel:h,snowLevel:g,fogLevel:y,hailLevel:b,smogLevel:x,status:`success`,error:null,current:{weatherCode:s,windSpeed:c,isDay:o?.current?.is_day===1,latitude:e,longitude:r,timezone:f,localTime:p,visibility:v,rainLevel:h,snowLevel:g,fogLevel:y,hailLevel:b,smogLevel:x,sunrise:u,sunset:d}})}catch(e){if(t||e instanceof DOMException&&e.name===`AbortError`)return;l({weather:null,rainLevel:null,snowLevel:null,fogLevel:null,hailLevel:null,smogLevel:null,status:`error`,error:e instanceof Error?e.message:`天气获取失败`,current:null})}};return r!=null&&i!=null?(a(r,i),()=>{t=!0,n.abort()}):typeof navigator>`u`||!navigator.geolocation?(Promise.resolve().then(()=>{t||l({weather:null,rainLevel:null,snowLevel:null,fogLevel:null,hailLevel:null,smogLevel:null,status:`error`,error:`当前环境不支持定位`,current:null})}),()=>{t=!0}):(navigator.geolocation.getCurrentPosition(({coords:e})=>{t||(l(e=>({...e,status:`fetching`})),a(e.latitude,e.longitude))},e=>{t||l({weather:null,rainLevel:null,snowLevel:null,fogLevel:null,hailLevel:null,smogLevel:null,status:`error`,error:e.message||`定位失败`,current:null})},{timeout:1e4,maximumAge:600*1e3}),()=>{t=!0,n.abort()})},[e,r,i]),s},Vr=async(e,t,n)=>{let r=new URLSearchParams({latitude:String(e),longitude:String(t),daily:`sunrise,sunset`,timezone:`auto`,forecast_days:`1`}),i=await fetch(`https://api.open-meteo.com/v1/forecast?${r}`,{signal:n});if(!i.ok)return null;let a=await i.json(),o=Lr(a?.daily?.sunrise?.[0]),s=Lr(a?.daily?.sunset?.[0]);return o==null||s==null?null:{sunrise:o,sunset:s}},Hr=e=>{let t=Ir(e),n=t?e.latitude:null,r=t?e.longitude:null,i=`${n},${r}`,[a,o]=(0,c.useState)(null),[s,l]=(0,c.useState)(i);return s!==i&&(l(i),o(null)),(0,c.useEffect)(()=>{if(n==null||r==null)return;let e=!1,t=new AbortController;return Vr(n,r,t.signal).then(t=>{e||o(t)}).catch(()=>{e||o(null)}),()=>{e=!0,t.abort()}},[n,r]),t?a:null},Ur=3,Wr=e=>Math.min(12,Math.max(0,Math.round(e))),Gr=e=>Math.max(0,Wr(e)-2),Kr=.55,qr=[0,3,8,16,24,33,44,55,68,81,95,110,125],Jr=[1,5,11,19,28,38,49,61,74,88,102,117,1/0],Yr=(e,t,n=0,r=0)=>{let i=t.gustiness,a=t.wander,o=n*.0017+r*.0024,s=e*Kr,c=Math.sin(s*.007+o),l=Math.sin(s*.021+1.37+o*1.4),u=Math.sin(s*.055+2.8+o*.6),d=1+(.5*c+.35*l+.15*u)*(.25+i*.75),f=Math.sin(s*.012+o*.8);f>.72&&(d+=(f-.72)*(.8+i*2.4)),Math.sin(s*.0095+.6+o)<-.55&&(d*=.45+i*.2),d=Math.max(.12,Math.min(2.25,d));let p=a*(.55*Math.sin(s*.0088+o)+.3*Math.sin(s*.026+1.9+o*1.1)+.15*Math.sin(s*.063+.4));return{intensity:d,angle:p,ux:Math.cos(p),uy:Math.sin(p)}},Xr=e=>{let t=Wr(e);if(t<=0)return{count:0,alphaMul:0};let n=Math.min(1,(t/9)**1.15);return{count:Math.floor(3+n*n*50),alphaMul:.1+n*.9}},Zr=e=>qr[Wr(e)]??16,Qr=e=>{let t=Math.max(0,e);for(let e=0;e<Jr.length;e++)if(t<=Jr[e])return e;return 12},$r=e=>{let t=Qr(e),n=Gr(t),r=Zr(n),i=Math.max(.04,Math.min(r/16,4.2)),{alphaMul:a}=Xr(n),o=i**.82,s=Math.min(1,(n/8)**1.1),c=(.04+s*.32)*Math.PI;return{speedKmh:e,level:t,visualLevel:n,scale:i,cloud:.28+i*.72,rain:o,snowDrift:-(.04+o*.28),hail:.4+o*.85,fog:.32+o*.58,streak:.55+o*.95,streakVisibility:a,gustiness:s,wander:c}},ei=e=>e.live&&e.liveWindKmh!=null&&Number.isFinite(e.liveWindKmh)?Math.max(0,e.liveWindKmh):Zr(e.windLevel);function ti(e){let t=e.windMotion.cloud,{intensity:n,angle:r,uy:i}=e.windField,a=-Math.cos(r);for(let r of e.state.clouds){let o=Math.abs(r.speed)*t*n;r.x+=o*a,r.y+=o*i*.12,r.y<-80&&(r.y=-80),r.y>e.height*.55&&(r.y=e.height*.55),r.x-140*r.scale>e.width&&(r.x=-160*r.scale),r.x+180*r.scale<0&&(r.x=e.width+40*r.scale),e.ctx.drawImage(r.sprite,r.x+r.ox,r.y+r.oy)}}function ni(e){let t=e.fogSprite;if(!t||e.state.fogBanks.length===0)return;let{canvas:n,baseR:r}=t,i=e.windMotion.fog,{intensity:a,angle:o,uy:s}=e.windField,c=-Math.cos(o);for(let t of e.state.fogBanks){let o=Math.abs(t.speed)*i*a;t.x+=o*c,t.y+=o*s*.1,t.y<e.height*.02&&(t.y=e.height*.02),t.y>e.height*.95&&(t.y=e.height*.95),c<0&&t.x+t.rw<0&&(t.x=e.width+t.rw),c>0&&t.x-t.rw>e.width&&(t.x=-t.rw),e.ctx.save(),e.ctx.translate(t.x,t.y),e.ctx.scale(t.rw/r,t.rh/r),e.ctx.globalAlpha=t.alpha,e.ctx.drawImage(n,-r,-r),e.ctx.restore()}}function ri(e){if(e.cfg.haze<=0)return;let t=e.activeWeather===`smog`?`177, 164, 135`:`220, 226, 232`;e.activeNight&&(t=e.activeWeather===`smog`?`82, 74, 54`:`116, 128, 145`),e.ctx.fillStyle=`rgba(${t}, ${e.cfg.haze})`,e.ctx.fillRect(0,0,e.width,e.height)}function ii(e,t,n,r,i,a){if(a<=0)return[[e,t],[n,r]];let o=(e+n)/2+(Math.random()-.5)*i,s=(t+r)/2,c=ii(e,t,o,s,i*.55,a-1),l=ii(o,s,n,r,i*.55,a-1);return[...c.slice(0,-1),...l]}function ai(e){if(e.state.windStreaks.length===0)return;let t=e.windMotion.streak,n=e.windMotion.streakVisibility;if(n<=.02)return;let r=e.state.t;for(let i of e.state.windStreaks){let a=Yr(r+i.phase*18,e.windMotion,i.x,i.y),o=a.intensity*(.55+.45*e.windField.intensity),s=a.angle*.65+e.windField.angle*.35,c=-1*Math.cos(s),l=Math.sin(s),u=i.speed*t*o;i.x+=u*c,i.y+=u*l*.45,i.wave+=.03+o*.025,(i.x<-i.length-40||i.x>e.width+i.length+40)&&(i.x=c<0?e.width+i.length+Math.random()*e.width*.25:-i.length-Math.random()*e.width*.25,i.y=Math.random()*e.height),i.y<-20&&(i.y=e.height+10),i.y>e.height+20&&(i.y=-10);let d=5+o*5,f=Math.sin(i.wave)*d,p=i.length*(.85+o*.2),m=i.x+c*p,h=i.y+l*p*.45,g=i.alpha*n*Math.min(1.35,.55+o*.55);if(e.ctx.beginPath(),e.ctx.moveTo(i.x,i.y),e.ctx.bezierCurveTo(i.x+c*p*.3,i.y+l*p*.3*.45+f,i.x+c*p*.7,i.y+l*p*.7*.45-f,m,h),e.ctx.strokeStyle=`rgba(235, 244, 250, ${g})`,e.ctx.lineWidth=i.width*(.85+o*.2),e.ctx.lineCap=`round`,e.ctx.stroke(),i.length>70&&n>.45&&o>.7){let t=i.x+c*p*.58,n=i.y+l*p*.58*.45-f*.4;e.ctx.save(),e.ctx.translate(t,n),e.ctx.rotate(s+i.wave*2),e.ctx.beginPath(),e.ctx.ellipse(0,0,4,1.6,0,0,Math.PI*2),e.ctx.fillStyle=`rgba(91, 76, 52, ${g*1.4})`,e.ctx.fill(),e.ctx.restore()}}}function oi(e){if(e.cfg.lightning){if(e.state.t>=e.state.nextStrike){e.state.nextStrike=e.state.t+150+Math.random()*300,e.state.flashAlpha=.5,e.state.boltLife=9;let t=e.width*(.15+Math.random()*.7);e.state.boltPoints=ii(t,e.height*.12,t+(Math.random()-.5)*e.width*.2,e.height*.92,60,6)}if(e.state.boltLife>0){--e.state.boltLife;let t=e.state.boltLife/9;e.ctx.beginPath(),e.state.boltPoints.forEach(([t,n],r)=>r===0?e.ctx.moveTo(t,n):e.ctx.lineTo(t,n)),e.ctx.strokeStyle=`rgba(240, 246, 255, ${t})`,e.ctx.lineWidth=2.4,e.ctx.shadowColor=`#bcd7ff`,e.ctx.shadowBlur=16,e.ctx.stroke(),e.ctx.shadowBlur=0}e.state.flashAlpha>.01&&(e.ctx.fillStyle=`rgba(226, 236, 255, ${e.state.flashAlpha})`,e.ctx.fillRect(0,0,e.width,e.height),e.state.flashAlpha*=.82)}}var si=3.2,ci=e=>{let t=Math.ceil(e*2.8+4),n=document.createElement(`canvas`);n.width=t,n.height=t;let r=n.getContext(`2d`),i=t/2,a=t/2,o=9+Math.floor(Math.random()*5),s=Array.from({length:o},(t,n)=>{let r=n/o*Math.PI*2+(Math.random()-.5)*.22,s=e*(.72+Math.random()*.44);return{x:i+Math.cos(r)*s,y:a+Math.sin(r)*s}}),c=(e,t)=>({x:(e.x+t.x)/2,y:(e.y+t.y)/2});r.beginPath();let l=c(s[s.length-1],s[0]);r.moveTo(l.x,l.y);for(let e=0;e<s.length;e++){let t=c(s[e],s[(e+1)%s.length]);r.quadraticCurveTo(s[e].x,s[e].y,t.x,t.y)}r.closePath();let u=i-e*.3,d=a-e*.34,f=r.createRadialGradient(u,d,e*.06,i,a,e*1.2);f.addColorStop(0,`rgba(255, 255, 255, 0.98)`),f.addColorStop(.42,`rgba(228, 241, 252, 0.96)`),f.addColorStop(.82,`rgba(176, 203, 224, 0.93)`),f.addColorStop(1,`rgba(130, 162, 188, 0.9)`),r.fillStyle=f,r.fill(),r.strokeStyle=`rgba(155, 190, 215, 0.62)`,r.lineWidth=Math.max(.45,e*.11),r.stroke();let p=1+Math.floor(Math.random()*2);for(let t=0;t<p;t++){let t=Math.random()*Math.PI*2,n=i+Math.cos(t)*e*(.28+Math.random()*.35),o=a+Math.sin(t)*e*(.28+Math.random()*.35);r.beginPath(),r.ellipse(n,o,e*(.14+Math.random()*.1),e*(.1+Math.random()*.08),t,0,Math.PI*2),r.fillStyle=`rgba(105, 135, 165, 0.28)`,r.fill()}if(Math.random()<.75){let t=Math.random()*Math.PI*2,n=i+Math.cos(t)*e*(.38+Math.random()*.28),o=a+Math.sin(t)*e*(.38+Math.random()*.28);r.beginPath(),r.arc(n,o,e*(.1+Math.random()*.08),0,Math.PI*2),r.fillStyle=`rgba(255, 255, 255, 0.55)`,r.fill()}return r.beginPath(),r.ellipse(i-e*.34,a-e*.36,e*.24,e*.17,-.35,0,Math.PI*2),r.fillStyle=`rgba(255, 255, 255, 0.78)`,r.fill(),n},li=(e=16)=>Array.from({length:e},()=>ci(si)),ui=e=>e[Math.floor(Math.random()*e.length)],di=(e,t,n,r,i=!0,a,o=1)=>{let s=a?.min??1.4,c=a?.max??4.8;e.r=s+Math.random()**1.35*(c-s),e.x=Math.random()*(t+260)-130+(Math.random()-.5)*40,e.y=i?-e.r-Math.random()*n*.55:Math.random()*n,e.vx=(-1.2-Math.random()*4.8+(Math.random()-.5)*1.2)*o,e.vy=(5.5+Math.random()*11)*o,e.bounces=0,e.opacity=.45+Math.random()*.55,e.delay=Math.floor(Math.random()*(i?110:45)),e.gravity=(.11+Math.random()*.14)*(.9+o*.1),e.phase=Math.random()*Math.PI*2,e.gust=(Math.random()-.5)*1.4,e.maxBounces=+(Math.random()<.62),e.sprite=ui(r),e.drawSize=e.r*2.8+4,e.rotation=Math.random()*Math.PI*2,e.rotationSpeed=(Math.random()-.5)*.06},fi=(e,t,n,r,i=1)=>{let a={x:0,y:0,r:2,vx:0,vy:0,bounces:0,opacity:1,delay:0,gravity:.16,phase:0,gust:0,maxBounces:1,sprite:n[0],drawSize:9.6,rotation:0,rotationSpeed:0};return di(a,e,t,n,Math.random()<.72,r,i),a};function pi(e){if(!e.cfg.rain)return;let{alpha:t,splash:n}=e.cfg.rain,r=e.cfg.rain.wind*e.windMotion.rain,{intensity:i,angle:a,uy:o}=e.windField,s=r*i*Math.cos(a),c=Math.abs(r)*i*o*.35;e.ctx.strokeStyle=`rgba(214, 228, 240, ${t})`,e.ctx.lineWidth=1.2,e.ctx.beginPath();for(let t of e.state.drops){let r=t.speed+c,i=Math.hypot(s,r)||1,a=s/i,o=r/i;e.ctx.moveTo(t.x,t.y),e.ctx.lineTo(t.x+a*t.len,t.y+o*t.len),t.x+=s,t.y+=r,t.y>e.height&&(n&&Math.random()<.3&&e.state.splashes.length<60&&e.state.splashes.push({x:t.x,r:1,alpha:.5}),t.y=-t.len,t.x=Math.random()*(e.width+160)-80)}e.ctx.stroke();for(let t=e.state.splashes.length-1;t>=0;t--){let n=e.state.splashes[t];if(n.r+=.8,n.alpha-=.035,n.alpha<=0){e.state.splashes.splice(t,1);continue}e.ctx.beginPath(),e.ctx.ellipse(n.x,e.height-3,n.r,n.r*.35,0,Math.PI,Math.PI*2),e.ctx.strokeStyle=`rgba(214, 228, 240, ${n.alpha})`,e.ctx.lineWidth=1,e.ctx.stroke()}}function mi(e){let t=e.windMotion.snowDrift,{intensity:n,angle:r,uy:i}=e.windField,a=t*n*Math.cos(r),o=Math.abs(t)*n*i*.4;for(let t of e.state.flakes){t.y+=t.speed+o,t.x+=Math.sin(e.state.t*.02+t.phase)*(.3+t.size*.08)+t.drift+a,t.rotation+=t.rotationSpeed,t.y-t.drawSize>e.height&&(t.y=-t.drawSize,t.x=Math.random()*e.width,t.phase=Math.random()*Math.PI*2,t.drift=(Math.random()-.5)*.4,t.opacity=.55+Math.random()*.45),t.x>e.width+20&&(t.x=-20),t.x<-20&&(t.x=e.width+20);let n=t.drawSize/2;e.ctx.save(),e.ctx.globalAlpha=t.opacity,e.ctx.translate(t.x,t.y),e.ctx.rotate(t.rotation),e.ctx.drawImage(t.sprite,-n,-n,t.drawSize,t.drawSize),e.ctx.restore()}}function hi(e){if(e.state.hailstones.length===0)return;let t=e.state.hailPool,n=e.windMotion.hail,r=e.state.t,i=e.windField;for(let a of e.state.hailstones){if(a.delay>0){--a.delay;continue}let o=Yr(r+a.phase*12,e.windMotion,a.x,a.y),s=o.intensity*(.4+.6*i.intensity),c=o.angle*.5+i.angle*.5,l=e.windMotion.snowDrift*.45*s*Math.cos(c),u=Math.abs(e.windMotion.snowDrift)*s*Math.sin(c)*.2,d=a.x,f=a.y;if(a.vy+=a.gravity+u*.02,a.vx+=a.gust*.004*n*s+l+(Math.random()-.5)*.08*n*s,a.x+=a.vx+Math.sin(r*.028+a.phase)*.35,a.y+=a.vy,e.ctx.beginPath(),e.ctx.moveTo(d,f),e.ctx.lineTo(a.x,a.y),e.ctx.strokeStyle=`rgba(225, 239, 250, ${a.opacity*.18})`,e.ctx.lineWidth=a.r*.35,e.ctx.stroke(),a.y+a.r>=e.height)if(a.bounces<a.maxBounces)a.y=e.height-a.r,a.vy*=-(.22+Math.random()*.28),a.vx=a.vx*(.55+Math.random()*.25)+(Math.random()-.5)*1.6,a.bounces+=1;else{di(a,e.width,e.height,t,!0,e.hailSpec?{min:e.hailSpec.sizeMin,max:e.hailSpec.sizeMax}:void 0,e.hailSpec?.speedMul??1);continue}let p=a.drawSize/2;a.rotation+=a.rotationSpeed,e.ctx.save(),e.ctx.globalAlpha=a.opacity,e.ctx.translate(a.x,a.y),e.ctx.rotate(a.rotation),e.ctx.drawImage(a.sprite,-p,-p,a.drawSize,a.drawSize),e.ctx.restore()}}function gi(e){e.ctx.fillStyle=e.skyGradient,e.ctx.fillRect(0,0,e.width,e.height)}function _i(e){if(e.state.stars.length===0)return;let t=1;if(e.dayCycle){if(e.dayCycle.isDay)return;t=.35+(1-e.dayCycle.twilight)*.65}else if(!e.activeNight)return;for(let n of e.state.stars){let r=.35+(Math.sin(e.state.t*n.speed+n.phase)+1)*.325;e.ctx.beginPath(),e.ctx.arc(n.x,n.y,n.r,0,Math.PI*2),e.ctx.fillStyle=`rgba(226, 235, 255, ${r*t})`,e.ctx.fill()}}function vi(e){let t=e.celestial;if(!t)return;let{ctx:n,sunX:r,sunY:i,state:a}=e,o=1+Math.sin(a.t*t.breathSpeed)*t.breathAmp,s=e.dayCycle?Fn(e.dayCycle):{scale:1,alpha:1},c=t.half*o*s.scale,l=c*2;n.save(),n.globalAlpha=s.alpha,n.drawImage(t.canvas,r-c,i-c,l,l),n.restore()}function yi(e){if(e.activeNight){_i(e),vi(e);return}vi(e)}var bi={sunny:{sky:[`#4a9fe0`,`#c8e8fb`],sun:`full`,cloudCount:1,cloudColor:[255,255,255],cloudAlpha:.5,cloudSpread:.12,rain:null,fogBanks:0,haze:0,snowCount:0,lightning:!1},partlyCloudy:{sky:[`#5b9bd0`,`#cfe6f3`],sun:`soft`,cloudCount:5,cloudColor:[255,255,255],cloudAlpha:.85,cloudSpread:.22,rain:null,fogBanks:0,haze:0,snowCount:0,lightning:!1},overcast:{sky:[`#8a97a8`,`#c3cbd6`],sun:`none`,cloudCount:9,cloudColor:[100,116,139],cloudAlpha:.55,cloudSpread:.3,rain:null,fogBanks:0,haze:.06,snowCount:0,lightning:!1},rain:{sky:[`#55637a`,`#7e8ba0`],sun:`none`,cloudCount:8,cloudColor:[51,65,85],cloudAlpha:.65,cloudSpread:.26,rain:{count:150,speed:10,wind:-1.5,alpha:.5,splash:!0},fogBanks:0,haze:.06,snowCount:0,lightning:!1},lightRain:{sky:[`#6b7a8f`,`#9aa7b8`],sun:`none`,cloudCount:7,cloudColor:[71,85,105],cloudAlpha:.6,cloudSpread:.24,rain:{count:70,speed:7,wind:-.8,alpha:.4,splash:!1},fogBanks:0,haze:.04,snowCount:0,lightning:!1},moderateRain:{sky:[`#55637a`,`#7e8ba0`],sun:`none`,cloudCount:8,cloudColor:[51,65,85],cloudAlpha:.65,cloudSpread:.26,rain:{count:150,speed:10,wind:-1.5,alpha:.5,splash:!0},fogBanks:0,haze:.06,snowCount:0,lightning:!1},heavyRain:{sky:[`#3d4a5f`,`#5d6a80`],sun:`none`,cloudCount:9,cloudColor:[30,41,59],cloudAlpha:.7,cloudSpread:.3,rain:{count:280,speed:14,wind:-2.8,alpha:.55,splash:!0},fogBanks:0,haze:.1,snowCount:0,lightning:!1},thunderstorm:{sky:[`#252f42`,`#43506a`],sun:`none`,cloudCount:10,cloudColor:[15,23,42],cloudAlpha:.75,cloudSpread:.32,rain:{count:240,speed:13,wind:-2.2,alpha:.55,splash:!0},fogBanks:0,haze:.08,snowCount:0,lightning:!0},fog:{sky:[`#aab4bf`,`#d5dbe1`],sun:`dim`,cloudCount:3,cloudColor:[203,213,225],cloudAlpha:.4,cloudSpread:.2,rain:null,fogBanks:10,haze:.28,snowCount:0,lightning:!1},lightSnow:{sky:[`#aab8c8`,`#e2e8ef`],sun:`none`,cloudCount:5,cloudColor:[166,180,196],cloudAlpha:.45,cloudSpread:.22,rain:null,fogBanks:0,haze:.05,snowCount:70,lightning:!1},moderateSnow:{sky:[`#9fb0c4`,`#dde5ee`],sun:`none`,cloudCount:6,cloudColor:[148,163,184],cloudAlpha:.5,cloudSpread:.24,rain:null,fogBanks:0,haze:.08,snowCount:160,lightning:!1},heavySnow:{sky:[`#8495aa`,`#c7d1dc`],sun:`none`,cloudCount:9,cloudColor:[100,116,139],cloudAlpha:.62,cloudSpread:.3,rain:null,fogBanks:3,haze:.14,snowCount:300,lightning:!1},sleet:{sky:[`#78899e`,`#b8c5d2`],sun:`none`,cloudCount:8,cloudColor:[71,85,105],cloudAlpha:.6,cloudSpread:.28,rain:{count:100,speed:9,wind:-1.4,alpha:.42,splash:!0},fogBanks:0,haze:.09,snowCount:100,lightning:!1},hail:{sky:[`#46566c`,`#77889d`],sun:`none`,cloudCount:9,cloudColor:[30,41,59],cloudAlpha:.68,cloudSpread:.3,rain:{count:80,speed:11,wind:-2.5,alpha:.38,splash:!0},fogBanks:0,haze:.1,snowCount:0,lightning:!1},smog:{sky:[`#8f8b7e`,`#c5bca8`],sun:`dim`,cloudCount:3,cloudColor:[142,136,119],cloudAlpha:.35,cloudSpread:.2,rain:null,fogBanks:12,haze:.34,snowCount:0,lightning:!1},gale:{sky:[`#587087`,`#a6b5c2`],sun:`soft`,cloudCount:8,cloudColor:[203,213,225],cloudAlpha:.72,cloudSpread:.3,rain:null,fogBanks:0,haze:.04,snowCount:0,lightning:!1},snow:{sky:[`#9fb0c4`,`#dde5ee`],sun:`none`,cloudCount:6,cloudColor:[148,163,184],cloudAlpha:.5,cloudSpread:.24,rain:null,fogBanks:0,haze:.08,snowCount:160,lightning:!1}},xi={sunny:{sky:[`#0b1a33`,`#27476e`],stars:110},partlyCloudy:{sky:[`#0f1f38`,`#2c4666`],stars:60},overcast:{sky:[`#181f2a`,`#333e4e`],stars:0},rain:{sky:[`#11161f`,`#242c3a`],stars:0},lightRain:{sky:[`#151b26`,`#2b3442`],stars:0},moderateRain:{sky:[`#11161f`,`#242c3a`],stars:0},heavyRain:{sky:[`#0c1017`,`#1c232e`],stars:0},thunderstorm:{sky:[`#0a0e18`,`#192132`],stars:0},fog:{sky:[`#1c222b`,`#3a434e`],stars:0},snow:{sky:[`#131a26`,`#333f4f`],stars:8},lightSnow:{sky:[`#161e2b`,`#3a4656`],stars:20},moderateSnow:{sky:[`#131a26`,`#333f4f`],stars:8},heavySnow:{sky:[`#101623`,`#2a3545`],stars:0},sleet:{sky:[`#121924`,`#2c3745`],stars:0},hail:{sky:[`#0e141d`,`#26303e`],stars:0},smog:{sky:[`#1a1812`,`#38321f`],stars:0},gale:{sky:[`#101a26`,`#2e3d4d`],stars:30}},Si=([e,t,n])=>[Math.round(e*.3+18),Math.round(t*.3+24),Math.round(n*.3+42)];function Ci(e,t,n,r){let[i,a,o]=n,s=1/0,c=1/0,l=-1/0,u=-1/0;for(let n of t){let t=n.dx*e,r=n.dy*e,i=n.r*e;s=Math.min(s,t-i),c=Math.min(c,r-i),l=Math.max(l,t+i),u=Math.max(u,r+i)}let d=Math.floor(s-2),f=Math.floor(c-2),p=Math.ceil(l+2)-d,m=Math.ceil(u+2)-f,h=document.createElement(`canvas`);h.width=p,h.height=m;let g=h.getContext(`2d`);for(let n of t){let t=n.dx*e-d,s=n.dy*e-f,c=n.r*e,l=g.createRadialGradient(t,s,0,t,s,c);l.addColorStop(0,`rgba(${i}, ${a}, ${o}, ${r})`),l.addColorStop(1,`rgba(${i}, ${a}, ${o}, 0)`),g.beginPath(),g.arc(t,s,c,0,Math.PI*2),g.fillStyle=l,g.fill()}return{sprite:h,ox:d,oy:f}}function wi(e,t,n,r,i){let a=.7+Math.random()*.9,o=4+Math.floor(Math.random()*3),s=Array.from({length:o},(e,t)=>({dx:(t-o/2)*26+(Math.random()-.5)*14,dy:(Math.random()-.5)*14,r:22+Math.random()*20})),{sprite:c,ox:l,oy:u}=Ci(a,s,r,i);return{x:Math.random()*(e+240)-120,y:t*.06+Math.random()*t*n,scale:a,speed:.12+Math.random()*.22,puffs:s,sprite:c,ox:l,oy:u}}function Ti(e,t=120){let n=t*2,r=document.createElement(`canvas`);r.width=n,r.height=n;let i=r.getContext(`2d`),a=i.createRadialGradient(t,t,0,t,t,t);return a.addColorStop(0,`rgba(${e}, 1)`),a.addColorStop(1,`rgba(${e}, 0)`),i.fillStyle=a,i.beginPath(),i.arc(t,t,t,0,Math.PI*2),i.fill(),{canvas:r,baseR:t}}function Ei(e,t){let n=e.sun;if(n===`none`)return null;let r=n===`full`?1:n===`soft`?.62:.32,i=t*(n===`full`?.72:n===`soft`?.62:.5),a=t*(n===`full`?7.2:n===`soft`?5.2:3.6),o=a;n===`full`&&(o=Math.max(o,1.55*t*5.5)),o=Math.ceil(o+2);let s=o*2,c=document.createElement(`canvas`);c.width=s,c.height=s;let l=c.getContext(`2d`),u=o,d=o;l.save(),l.globalCompositeOperation=`lighter`;let f=l.createRadialGradient(u,d,0,u,d,a);f.addColorStop(0,`rgba(255, 230, 170, ${.14*r})`),f.addColorStop(.22,`rgba(255, 210, 140, ${.07*r})`),f.addColorStop(.5,`rgba(255, 195, 120, ${.03*r})`),f.addColorStop(1,`rgba(255, 200, 130, 0)`),l.fillStyle=f,l.fillRect(0,0,s,s);let p=t*(n===`full`?3.4:2.6),m=l.createRadialGradient(u,d,i*.15,u,d,p);if(m.addColorStop(0,`rgba(255, 240, 200, ${.32*r})`),m.addColorStop(.4,`rgba(255, 220, 150, ${.16*r})`),m.addColorStop(.75,`rgba(255, 200, 120, ${.05*r})`),m.addColorStop(1,`rgba(255, 190, 110, 0)`),l.fillStyle=m,l.beginPath(),l.arc(u,d,p,0,Math.PI*2),l.fill(),n===`full`){l.translate(u,d),l.scale(1.55,.55);let e=l.createRadialGradient(0,0,0,0,0,t*5.5);e.addColorStop(0,`rgba(255, 225, 170, 0.08)`),e.addColorStop(.5,`rgba(255, 205, 140, 0.03)`),e.addColorStop(1,`rgba(255, 195, 130, 0)`),l.fillStyle=e,l.beginPath(),l.arc(0,0,t*5.5,0,Math.PI*2),l.fill()}l.restore();let h=i*2.05,g=l.createRadialGradient(u,d,0,u,d,h);g.addColorStop(0,`rgba(255, 245, 210, ${.7*r})`),g.addColorStop(.4,`rgba(255, 230, 170, ${.35*r})`),g.addColorStop(.75,`rgba(255, 210, 140, ${.1*r})`),g.addColorStop(1,`rgba(255, 200, 130, 0)`),l.fillStyle=g,l.beginPath(),l.arc(u,d,h,0,Math.PI*2),l.fill();let _=l.createRadialGradient(u,d,0,u,d,i);return n===`dim`?(_.addColorStop(0,`rgba(255, 240, 210, ${.5*r})`),_.addColorStop(.55,`rgba(255, 220, 170, ${.3*r})`),_.addColorStop(1,`rgba(255, 200, 140, 0)`)):(_.addColorStop(0,`rgba(255, 250, 230, ${.98*r})`),_.addColorStop(.4,`rgba(255, 240, 195, ${.92*r})`),_.addColorStop(.75,`rgba(255, 220, 150, ${.55*r})`),_.addColorStop(1,`rgba(255, 205, 130, 0)`)),l.fillStyle=_,l.beginPath(),l.arc(u,d,i,0,Math.PI*2),l.fill(),{canvas:c,half:o,breathSpeed:.018,breathAmp:.018}}function Di(e,t,n){if(e.sun===`none`)return null;let r=t*.82,i=e.sun===`dim`,a=i?.45:1,o=r*(i?4.2:6.2),s=Math.ceil(Math.max(o,r*2.6,r*1.35)+2),c=s*2,l=document.createElement(`canvas`);l.width=c,l.height=c;let u=l.getContext(`2d`),d=s,f=s;u.save(),u.globalCompositeOperation=`lighter`;let p=u.createRadialGradient(d,f,0,d,f,o);p.addColorStop(0,`rgba(200, 215, 240, ${.16*a})`),p.addColorStop(.25,`rgba(170, 190, 225, ${.07*a})`),p.addColorStop(.55,`rgba(140, 165, 210, ${.025*a})`),p.addColorStop(1,`rgba(130, 155, 200, 0)`),u.fillStyle=p,u.fillRect(0,0,c,c);let m=r*2.6,h=u.createRadialGradient(d,f,r*.2,d,f,m);h.addColorStop(0,`rgba(230, 236, 248, ${.28*a})`),h.addColorStop(.45,`rgba(190, 205, 230, ${.12*a})`),h.addColorStop(1,`rgba(160, 180, 220, 0)`),u.fillStyle=h,u.beginPath(),u.arc(d,f,m,0,Math.PI*2),u.fill(),u.restore();let g=u.createRadialGradient(d-r*.28,f-r*.3,0,d,f,r);g.addColorStop(0,`rgba(236, 240, 246, ${.96*a})`),g.addColorStop(.45,`rgba(214, 220, 230, ${.94*a})`),g.addColorStop(.82,`rgba(186, 196, 212, ${.9*a})`),g.addColorStop(1,`rgba(160, 172, 192, ${.75*a})`),u.beginPath(),u.arc(d,f,r,0,Math.PI*2),u.fillStyle=g,u.fill(),u.save(),u.beginPath(),u.arc(d,f,r*.98,0,Math.PI*2),u.clip();for(let e of[{dx:-.18,dy:.12,rx:.38,ry:.28,a:.14},{dx:.22,dy:-.08,rx:.26,ry:.2,a:.11},{dx:.05,dy:.32,rx:.2,ry:.14,a:.09}]){let t=d+e.dx*r,n=f+e.dy*r,i=u.createRadialGradient(t,n,0,t,n,e.rx*r);i.addColorStop(0,`rgba(140, 152, 170, ${e.a*a})`),i.addColorStop(.65,`rgba(150, 162, 178, ${e.a*.45*a})`),i.addColorStop(1,`rgba(160, 170, 185, 0)`),u.fillStyle=i,u.beginPath(),u.ellipse(t,n,e.rx*r,e.ry*r,.35,0,Math.PI*2),u.fill()}for(let e of n){let t=d+e.dx*r,n=f+e.dy*r,i=e.r*r,o=u.createRadialGradient(t-i*.25,n-i*.3,0,t,n,i);o.addColorStop(0,`rgba(155, 168, 186, ${.22*a})`),o.addColorStop(.55,`rgba(145, 158, 176, ${.28*a})`),o.addColorStop(.85,`rgba(200, 210, 224, ${.12*a})`),o.addColorStop(1,`rgba(210, 218, 230, 0)`),u.fillStyle=o,u.beginPath(),u.arc(t,n,i,0,Math.PI*2),u.fill()}let _=u.createRadialGradient(d-r*.35,f-r*.38,0,d-r*.1,f-r*.1,r*.7);_.addColorStop(0,`rgba(255, 255, 255, ${.28*a})`),_.addColorStop(.45,`rgba(245, 248, 252, ${.08*a})`),_.addColorStop(1,`rgba(240, 244, 250, 0)`),u.fillStyle=_,u.beginPath(),u.arc(d,f,r,0,Math.PI*2),u.fill(),u.restore();let v=u.createRadialGradient(d,f,r*.72,d,f,r*1.35);return v.addColorStop(0,`rgba(210, 220, 235, 0)`),v.addColorStop(.55,`rgba(200, 212, 232, ${.1*a})`),v.addColorStop(1,`rgba(180, 195, 220, 0)`),u.fillStyle=v,u.beginPath(),u.arc(d,f,r*1.35,0,Math.PI*2),u.fill(),{canvas:l,half:s,breathSpeed:.012,breathAmp:.012}}var Oi=e=>{let t=Math.ceil(e*2+4),n=document.createElement(`canvas`);n.width=t,n.height=t;let r=n.getContext(`2d`),i=r.createRadialGradient(t/2,t/2,0,t/2,t/2,e+1);return i.addColorStop(0,`rgba(255, 255, 255, 1)`),i.addColorStop(.6,`rgba(255, 255, 255, 0.85)`),i.addColorStop(1,`rgba(255, 255, 255, 0)`),r.fillStyle=i,r.fillRect(0,0,t,t),n},ki=e=>{let t=Math.ceil(e*2+6),n=document.createElement(`canvas`);n.width=t,n.height=t;let r=n.getContext(`2d`);r.translate(t/2,t/2),r.strokeStyle=`rgba(255, 255, 255, 0.95)`,r.lineCap=`round`,r.lineWidth=Math.max(e*.11,.7),r.shadowColor=`rgba(255, 255, 255, 0.5)`,r.shadowBlur=e*.25;let i=1+Math.floor(Math.random()*3),a=Array.from({length:i},()=>({pos:.3+Math.random()*.5,len:e*(.22+Math.random()*.34),angle:Math.PI/3*(.8+Math.random()*.45)})),o=Math.random()<.55,s=e*(.14+Math.random()*.12),c=Math.random()<.45,l=e*(.14+Math.random()*.14);for(let t=0;t<6;t++){r.save(),r.rotate(t*Math.PI/3),r.beginPath(),r.moveTo(0,0),r.lineTo(0,-e);for(let t of a){let n=-e*t.pos;r.moveTo(0,n),r.lineTo(Math.sin(t.angle)*t.len,n-Math.cos(t.angle)*t.len),r.moveTo(0,n),r.lineTo(-Math.sin(t.angle)*t.len,n-Math.cos(t.angle)*t.len)}o&&(r.moveTo(0,-e),r.lineTo(s*.7,-e-s*.5),r.moveTo(0,-e),r.lineTo(-s*.7,-e-s*.5)),r.stroke(),r.restore()}if(c){r.beginPath();for(let e=0;e<6;e++){let t=e*Math.PI/3-Math.PI/2,n=Math.cos(t)*l,i=Math.sin(t)*l;e===0?r.moveTo(n,i):r.lineTo(n,i)}r.closePath(),r.stroke()}return n},Ai=()=>({dots:[1.2,1.6,2,2.3].map(e=>Oi(e)),crystals:[2.6,3.2,3.8,4.4,5].map(e=>ki(e*2.4))}),ji=e=>e[Math.floor(Math.random()*e.length)],Mi=(e,t,n,r)=>{let i=1+Math.random()**1.6*4.2,a=i>=2.4,o=ji(a?n.crystals:n.dots),s=a?i*4.8+6:i*2+4;return{x:Math.random()*e,y:r??Math.random()*t,size:i,speed:.4+i*.28+Math.random()*.4,phase:Math.random()*Math.PI*2,drift:(Math.random()-.5)*.4,rotation:Math.random()*Math.PI*2,rotationSpeed:(Math.random()-.5)*.025,opacity:.55+Math.random()*.45,sprite:o,drawSize:s}},Ni=(e,t)=>t?e===`smog`?`96, 88, 66`:`138, 150, 168`:e===`smog`?`168, 155, 126`:`226, 232, 238`;function Pi(e){let{ctx:t,width:n,height:r,activeWeather:i,dayCycleTimes:a=null,sceneTimeMs:o,liveClock:s=!1,windMotion:c,rainLevel:l=5,snowLevel:u=5,hailLevel:d=2,fogLevel:f=2,smogLevel:p=2}=e,m=bi[i],h=(()=>{let e=m;return pr(i)&&e.rain&&(e={...e,rain:yr(e.rain,l)}),mr(i)&&(e={...e,snowCount:br(u),fogBanks:u>=7?Math.max(e.fogBanks,3):e.fogBanks,haze:u>=7?Math.max(e.haze,.12):e.haze}),Bn(i)&&(e=Vn(e,f)),Dr(i)&&(e=Or(e,p)),e})(),g=xi[i],_=a??null,v=_?Dn(s?Date.now():o,_):null,y=v?!v.isDay:!1,b=v?Nn(h.sky,g.sky,v):y?g.sky:h.sky,x=y?Si(h.cloudColor):h.cloudColor,S=Math.min(n,r)*.09,C=n*.72,w=r*.26;if(v){let e=On(n,r,v.arcProgress);C=e.x,w=e.y}let T=Pn(t,r,b),E=[{dx:-.32,dy:.08,r:.17},{dx:.24,dy:-.22,r:.12},{dx:.04,dy:.34,r:.1},{dx:.36,dy:.24,r:.07}],D=Ei(h,S),O=Di(h,S,E),k=y?O:D,A=y||_!=null?Array.from({length:g.stars},()=>({x:Math.random()*n,y:Math.random()*r*.72,r:.4+Math.random()*1.1,phase:Math.random()*Math.PI*2,speed:.015+Math.random()*.035})):[],j=Array.from({length:h.cloudCount},()=>wi(n,r,h.cloudSpread,x,h.cloudAlpha)),M=h.rain?Array.from({length:h.rain.count},()=>({x:Math.random()*(n+160)-80,y:Math.random()*r,len:8+Math.random()*10,speed:h.rain.speed*(.75+Math.random()*.5)})):[],N=[],P=Array.from({length:h.fogBanks},(e,t)=>({x:Math.random()*n,y:t/Math.max(h.fogBanks-1,1)*r*.9+r*.05,rw:n*(.25+Math.random()*.3),rh:r*(.08+Math.random()*.08),speed:(.1+Math.random()*.25)*(t%2==0?1:-1),alpha:(.1+Math.random()*.1)*(Bn(i)?Hn(f):Dr(i)?kr(p):1)})),F=h.fogBanks>0?Ti(Ni(i,y)):null,I=h.snowCount>0?Ai():null,ee=I==null?[]:Array.from({length:h.snowCount},()=>Mi(n,r,I)),L=Yn(i)?Xn(d):null,te=L==null?null:li(),ne=te!=null&&L!=null?Array.from({length:L.count},()=>fi(n,r,te,{min:L.sizeMin,max:L.sizeMax},L.speedMul)):[],re=(()=>{let{count:e}=Xr(c.visualLevel);return e<=0?[]:Array.from({length:e},()=>({x:Math.random()*n,y:Math.random()*r,length:35+Math.random()*120,speed:6+Math.random()*10,wave:Math.random()*Math.PI*2,alpha:.1+Math.random()*.28,width:.5+Math.random()*1.1,phase:Math.random()*Math.PI*2}))})(),ie=[],ae=120+Math.random()*240;return{sky:b,cloudRgb:x,cfg:h,sunX:C,sunY:w,sunR:S,skyGradient:T,celestial:k,sunSprite:D,moonSprite:O,fogSprite:F,dayCycleTimes:_,dayCycle:v,sceneTimeMs:o,liveClock:s,hailSpec:L,state:{stars:A,moonCraters:E,clouds:j,drops:M,splashes:N,fogBanks:P,flakes:ee,hailstones:ne,hailPool:te??[],windStreaks:re,t:0,flashAlpha:0,boltLife:0,boltPoints:ie,nextStrike:ae}}}function Fi(e,t){if(!e.dayCycleTimes)return;let n=Dn(e.liveClock?t??Date.now():e.sceneTimeMs,e.dayCycleTimes),r=xi[e.activeWeather],i=Nn(e.cfg.sky,r.sky,n),a=On(e.width,e.height,n.arcProgress);e.dayCycle=n,e.activeNight=!n.isDay,e.sky=i,e.skyGradient=Pn(e.ctx,e.height,i),e.sunX=a.x,e.sunY=a.y,e.celestial=n.isDay?e.sunSprite:e.moonSprite}function Ii(e,t){t&&(e.state.t+=1),e.windField=Yr(e.state.t,e.windMotion),e.dayCycleTimes&&Fi(e,e.liveClock?Date.now():e.sceneTimeMs),gi(e),yi(e),ti(e),ni(e),ri(e),pi(e),mi(e),hi(e),ai(e),oi(e)}function Li(e){let{ctx:t,width:n,height:r,activeWeather:i,activeNight:a,windMotion:o}=e,s=Pi(e),c={ctx:t,width:n,height:r,activeWeather:i,activeNight:s.dayCycle?!s.dayCycle.isDay:a,windMotion:o,windField:Yr(0,o),...s};if(c.dayCycleTimes&&Fi(c,c.liveClock?Date.now():c.sceneTimeMs),typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return Ii(c,!1),()=>void 0;let l=0,u=document.hidden,d=_(e=>{u=e}),f=()=>{l=requestAnimationFrame(f),!u&&Ii(c,!0)};return f(),()=>{cancelAnimationFrame(l),d()}}var Ri={weatherBackground:`cos-weatherBackground-Mnm22`,canvas:`cos-canvas-nvqMt`,loadingOverlay:`cos-loadingOverlay-O58B7`,loadingSpinner:`cos-loadingSpinner-NQ9yG`,"weather-loading-spin":`cos-weather-loading-spin-IPFWZ`},zi=({width:e=800,height:t=450,weather:n=`partlyCloudy`,time:r=`14:00`,live:i=!1,latitude:a,longitude:o,windLevel:s=3,rainLevel:u=5,snowLevel:d=5,hailLevel:f=2,fogLevel:p=2,smogLevel:m=2,onLiveWeather:h,loading:g=!1})=>{let _=(0,c.useRef)(null),v=Br(i,a!=null&&o!=null?{latitude:a,longitude:o}:void 0),y=ur(i&&v.weather?v.weather:n),b=i&&v.rainLevel!=null?v.rainLevel:u,x=i&&v.snowLevel!=null?v.snowLevel:d,S=i&&v.fogLevel!=null?v.fogLevel:p,C=i&&v.hailLevel!=null?v.hailLevel:f,w=i&&v.smogLevel!=null?v.smogLevel:m,T=vr(y,b,x),E=En(r),D=v.current?.sunrise??null,O=v.current?.sunset??null,k=v.current?.windSpeed??null,A=(0,c.useMemo)(()=>i&&D!=null&&O!=null?{sunrise:D,sunset:O}:wn(E),[i,D,O,E]),j=ei({live:i,windLevel:s,liveWindKmh:k}),M=(0,c.useMemo)(()=>$r(j),[j]),N=i&&v.current?!v.current.isDay:!Dn(E,A).isDay,P=g||i&&(v.status===`locating`||v.status===`fetching`),F=(0,c.useRef)(h);return(0,c.useEffect)(()=>{F.current=h}),(0,c.useEffect)(()=>{v.weather&&F.current?.(ur(v.weather))},[v.weather]),(0,c.useEffect)(()=>{let n=_.current;if(!n)return;let r=window.devicePixelRatio||1;n.width=e*r,n.height=t*r;let a=n.getContext(`2d`);if(a)return a.setTransform(r,0,0,r,0,0),Li({ctx:a,width:e,height:t,activeWeather:T,activeNight:N,dayCycleTimes:A,sceneTimeMs:E,liveClock:i,windMotion:M,rainLevel:b,snowLevel:x,fogLevel:S,hailLevel:C,smogLevel:w})},[N,T,A,b,x,S,C,w,t,i,E,e,M]),(0,l.jsxs)(`div`,{className:Ri.weatherBackground,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:_,className:Ri.canvas,style:{width:e,height:t},role:`img`,"aria-label":`天气背景:${y}${N?`(夜间)`:``},${M.level}级风`}),P&&(0,l.jsxs)(`div`,{className:Ri.loadingOverlay,role:`status`,"aria-live":`polite`,children:[(0,l.jsx)(`div`,{className:Ri.loadingSpinner,"aria-hidden":!0}),(0,l.jsx)(`span`,{children:`天气加载中…`})]})]})},Bi={waveText:`cos-waveText-Zy2Tp`,text:`cos-text-el-KR`,char:`cos-char-Y9-mV`,wave:`cos-wave-jVRCz`},Vi=({text:e=`WAVE`,amplitude:t=12,color:n=`#38bdf8`,fontSize:r=56})=>(0,l.jsx)(`div`,{className:Bi.waveText,children:(0,l.jsx)(`h1`,{className:Bi.text,style:{fontSize:r,"--wave-color":n,"--wave-amp":`${t}px`},children:e.split(``).map((e,t)=>(0,l.jsx)(`span`,{className:Bi.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=E,exports.ClickSpark=O,exports.Confetti=N,exports.Countdown=ne,exports.CursorTrail=le,exports.CyberGrid=F,exports.DEFAULT_FOG_LEVEL=In,exports.DEFAULT_HAIL_LEVEL=Gn,exports.DEFAULT_RAIN_LEVEL=er,exports.DEFAULT_SMOG_LEVEL=Cr,exports.DEFAULT_SNOW_LEVEL=tr,exports.DEFAULT_WIND_LEVEL=Ur,exports.DiceRoll=de,exports.DnaHelix=ie,exports.DoublePendulum=pe,exports.ElectricArc=se,exports.FOG_LEVEL_LABELS=Ln,exports.Fireworks=be,exports.FlipCounter=Ce,exports.GlitchText=Oe,exports.GradientFlow=Ee,exports.GravityBalls=je,exports.HAIL_LEVEL_LABELS=Kn,exports.HolographicCard=Me,exports.LiquidGlass=Le,exports.LiquidProgress=Ne,exports.LorenzAttractor=Fe,exports.MAX_PRECIP_LEVEL=$n,exports.MIN_PRECIP_LEVEL=Qn,exports.MagneticButton=ze,exports.MatrixRain=He,exports.MazeGenerator=Ke,exports.MetaballPool=We,exports.MeteorRain=Je,exports.NeonText=Xe,exports.NewtonCradle=Qe,exports.OrbitalChart=tt,exports.ParticleNetwork=rt,exports.PlasmaBall=at,exports.ProgressChest=jt,exports.RAIN_LEVEL_LABELS=cr,exports.RadarScan=Nt,exports.RedPacketRain=Ft,exports.ReturnCity=Lt,exports.RippleWater=Yt,exports.RopeChain=zt,exports.SMOG_LEVEL_LABELS=wr,exports.SNOW_LEVEL_LABELS=lr,exports.ScrambleText=Qt,exports.ScratchCard=en,exports.SlotMachine=rn,exports.SmokeFog=Ct,exports.Snowfall=Ot,exports.SolarSystem=Et,exports.Speedometer=Bt,exports.SplitReveal=sn,exports.Spotlight=ln,exports.Starfield=At,exports.TimelinePulse=Vt,exports.Turntable=pn,exports.Typewriter=gn,exports.WaveButton=vn,exports.WaveText=Vi,exports.WeatherBackground=zi,exports.buildWindMotion=$r,exports.clampFogLevel=Rn,exports.clampHailLevel=qn,exports.clampPrecipLevel=$,exports.clampSmogLevel=Tr,exports.fogBankAlphaScale=Hn,exports.fogLevelFromVisibility=Wn,exports.fogLevelFromWmo=Un,exports.formatFogLevel=zn,exports.formatHailLevel=Jn,exports.formatLocalHm=zr,exports.formatPrecipLevel=sr,exports.formatSmogLevel=Er,exports.hailLevelFromWmo=Zn,exports.hailSpec=Xn,exports.intensifyFogConfig=Vn,exports.intensifyRainConfig=yr,exports.intensifySmogConfig=Or,exports.intensifySnowCount=br,exports.isRainWeather=dr,exports.isSnowWeather=fr,exports.kmhToWindLevel=Qr,exports.mapWmoCodeToWeatherType=Mr,exports.normalizeWeatherType=ur,exports.precipBand=rr,exports.precipLabel=or,exports.rainLevelFromWeather=hr,exports.rainLevelFromWmo=xr,exports.resolveSceneWeather=vr,exports.sampleWindField=Yr,exports.smogBankAlphaScale=kr,exports.smogLevelFromVisibility=Ar,exports.snowLevelFromWeather=gr,exports.snowLevelFromWmo=Sr,exports.supportsFogLevel=Bn,exports.supportsHailLevel=Yn,exports.supportsRainLevel=pr,exports.supportsSmogLevel=Dr,exports.supportsSnowLevel=mr,exports.useLiveWeather=Br,exports.useSunTimes=Hr,exports.visualWindLevel=Gr,exports.windLevelToKmh=Zr,exports.windStreakSpec=Xr;
|
|
93
|
+
`,or=e=>{let t=e.replace(`#`,``),n=t.length===3?t.split(``).map(e=>e+e).join(``):t,r=Number.parseInt(n,16);return Number.isNaN(r)?[.22,.74,.97]:[(r>>16&255)/255,(r>>8&255)/255,(r&255)/255]},sr=(e,t,n)=>{let r=e.createShader(t);return r?(e.shaderSource(r,n),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS)?r:(e.deleteShader(r),null)):null},cr=(e,t,n)=>{let r=sr(e,e.VERTEX_SHADER,t),i=sr(e,e.FRAGMENT_SHADER,n);if(!r||!i)return null;let a=e.createProgram();return a?(e.attachShader(a,r),e.attachShader(a,i),e.linkProgram(a),e.deleteShader(r),e.deleteShader(i),e.getProgramParameter(a,e.LINK_STATUS)?a:(e.deleteProgram(a),null)):null},J=192,lr=e=>({from:or(e.fromColor),to:or(e.toColor),tint:or(e.color),waveAmplitude:e.waveAmplitude,waveSpeed:e.waveSpeed,shimmer:e.shimmer,reflection:e.reflection,rippleStrength:e.rippleStrength,rippleRadius:e.rippleRadius,damping:e.damping,spread:e.spread,interactive:e.interactive}),ur=({width:e=800,height:t=500,fromColor:n=`#52ade3`,toColor:r=`#013565`,color:i=`#a8d8f5`,waveAmplitude:a=1,waveSpeed:o=1,shimmer:s=1,reflection:u=.38,rippleStrength:d=1,rippleRadius:f=6,damping:p=.985,spread:m=.5,interactive:h=!0,showHint:g=!0,hint:_=`点击水面产生涟漪`})=>{let v=(0,c.useRef)(null),x=(0,c.useRef)(0),S=(0,c.useRef)(null),C=(0,c.useRef)(lr({fromColor:n,toColor:r,color:i,waveAmplitude:a,waveSpeed:o,shimmer:s,reflection:u,rippleStrength:d,rippleRadius:f,damping:p,spread:m,interactive:h}));(0,c.useEffect)(()=>{C.current=lr({fromColor:n,toColor:r,color:i,waveAmplitude:a,waveSpeed:o,shimmer:s,reflection:u,rippleStrength:d,rippleRadius:f,damping:p,spread:m,interactive:h})},[n,r,i,a,o,s,u,d,f,p,m,h]);let w=(0,c.useCallback)((e,t)=>{if(!C.current.interactive)return;let n=v.current;if(!n)return;let r=n.getBoundingClientRect();S.current={x:(e-r.left)/r.width,y:1-(t-r.top)/r.height,strength:C.current.rippleStrength}},[]);return(0,c.useEffect)(()=>{let e=v.current;if(!e)return;let t=e=>{e.pointerType===`mouse`&&e.button!==0||w(e.clientX,e.clientY)};return e.addEventListener(`pointerdown`,t),()=>e.removeEventListener(`pointerdown`,t)},[w]),(0,c.useEffect)(()=>{let n=v.current;if(!n)return;let r=Math.min(window.devicePixelRatio||1,2);n.width=Math.floor(e*r),n.height=Math.floor(t*r);let i=n.getContext(`webgl`,{alpha:!1,antialias:!1,depth:!1,stencil:!1,premultipliedAlpha:!1});if(!i)return;let a=cr(i,ir,ar);if(!a)return;let o=i.createBuffer();i.bindBuffer(i.ARRAY_BUFFER,o),i.bufferData(i.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,1]),i.STATIC_DRAW);let s=i.getAttribLocation(a,`a_pos`),c=i.getUniformLocation(a,`u_time`),l=i.getUniformLocation(a,`u_res`),u=i.getUniformLocation(a,`u_tint`),d=i.getUniformLocation(a,`u_from`),f=i.getUniformLocation(a,`u_to`),p=i.getUniformLocation(a,`u_height`),m=i.getUniformLocation(a,`u_sim`),h=i.getUniformLocation(a,`u_waveAmp`),g=i.getUniformLocation(a,`u_waveSpeed`),_=i.getUniformLocation(a,`u_shimmer`),w=i.getUniformLocation(a,`u_reflection`),T=J*J,E=new Float32Array(T),D=new Float32Array(T),O=new Float32Array(T),k=i.createTexture();i.bindTexture(i.TEXTURE_2D,k),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE);let A=new Uint8Array(T*4),j=()=>{for(let e=0;e<T;e++){let t=Math.max(0,Math.min(255,Math.floor((D[e]*.5+.5)*255))),n=e*4;A[n]=t,A[n+1]=t,A[n+2]=t,A[n+3]=255}i.bindTexture(i.TEXTURE_2D,k),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,J,J,0,i.RGBA,i.UNSIGNED_BYTE,A)},M=(e,t,n,r)=>{let i=e*(J-1),a=t*(J-1),o=b(r,2,12);for(let e=-o-1;e<=o+1;e++)for(let t=-o-1;t<=o+1;t++){let r=Math.round(i+t),s=Math.round(a+e);if(r<=0||r>=J-1||s<=0||s>=J-1)continue;let c=Math.sqrt(t*t+e*e),l=Math.exp(-c*c*.55)*-.35,u=Math.exp(-((c-o*.55)**2)*.9);D[s*J+r]+=n*(l+u*1.1)}},N=(e,t)=>{let n=b(e,.9,.999),r=b(t,.3,.7);for(let e=0;e<2;e++){for(let e=1;e<J-1;e++){let t=e*J;for(let e=1;e<J-1;e++){let i=t+e,a=D[i-1]+D[i+1]+D[i-J]+D[i+J];O[i]=(a*r-E[i])*n,O[i]>1.5?O[i]=1.5:O[i]<-1.5&&(O[i]=-1.5)}}let e=E;E=D,D=O,O=e,O.fill(0)}},ee=e=>{let t=C.current;i.viewport(0,0,n.width,n.height),i.useProgram(a),i.bindBuffer(i.ARRAY_BUFFER,o),i.enableVertexAttribArray(s),i.vertexAttribPointer(s,2,i.FLOAT,!1,0,0),i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,k),i.uniform1i(p,0),i.uniform1f(c,e),i.uniform2f(l,n.width,n.height),i.uniform3f(u,t.tint[0],t.tint[1],t.tint[2]),i.uniform3f(d,t.from[0],t.from[1],t.from[2]),i.uniform3f(f,t.to[0],t.to[1],t.to[2]),i.uniform2f(m,J,J),i.uniform1f(h,b(t.waveAmplitude,0,2)),i.uniform1f(g,b(t.waveSpeed,0,3)),i.uniform1f(_,b(t.shimmer,0,2)),i.uniform1f(w,b(t.reflection,0,1)),i.drawArrays(i.TRIANGLE_STRIP,0,4)};if(j(),typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return ee(0),()=>{i.deleteTexture(k),i.deleteBuffer(o),i.deleteProgram(a)};let te=document.hidden,ne=y(e=>{te=e}),re=performance.now(),P=e=>{if(x.current=requestAnimationFrame(P),te)return;let t=C.current;if(S.current){let e=S.current,n=b(e.strength,0,3),r=t.rippleRadius;M(e.x,e.y,n,r),M(e.x+.004,e.y-.003,n*.35,r),S.current=null}N(t.damping,t.spread),j(),ee((e-re)/1e3)};return x.current=requestAnimationFrame(P),()=>{cancelAnimationFrame(x.current),ne(),i.deleteTexture(k),i.deleteBuffer(o),i.deleteProgram(a)}},[t,e]),(0,l.jsxs)(`div`,{className:rr.rippleWater,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:v,className:rr.canvas,style:{width:e,height:t,cursor:h?`pointer`:`default`},role:`img`,"aria-label":_||`涟漪水面`}),g?(0,l.jsx)(`span`,{className:rr.hint,"aria-hidden":!0,children:_}):null]})},dr={scrambleText:`cos-scrambleText-hN4Wm`,text:`cos-text-frsHs`,cursor:`cos-cursor-3zQOy`,blink:`cos-blink-OcKXu`},fr=`ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%&*`,pr=({text:e=`DECRYPTED`,duration:t=2e3,charset:n=fr})=>{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:fr,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:dr.scrambleText,children:(0,l.jsxs)(`p`,{className:dr.text,children:[r,(0,l.jsx)(`span`,{className:dr.cursor})]})})},mr={scratchCard:`cos-scratchCard-McIEK`,prize:`cos-prize-X0z5V`,canvas:`cos-canvas-JqIlr`,hidden:`cos-hidden-Lsfbt`},hr=({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:mr.scratchCard,style:{width:r,height:i},children:[(0,l.jsx)(`div`,{className:mr.prize,children:t}),(0,l.jsx)(`canvas`,{ref:a,className:`${mr.canvas} ${d?mr.hidden:``}`,style:{width:r,height:i},onMouseDown:_,onMouseMove:v,onMouseUp:y,onMouseLeave:y,onTouchStart:_,onTouchMove:v,onTouchEnd:y})]})},Y={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`},gr=[`🍒`,`🍋`,`🍊`,`🍇`,`⭐`,`7️⃣`],_r=e=>1-(1-e)**3,vr=({symbols:e=gr,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:Y.slotMachine,children:[(0,l.jsx)(`div`,{className:Y.machine,children:[0,1,2].map(e=>(0,l.jsxs)(`div`,{className:Y.reel,style:{height:240},children:[(0,l.jsx)(`div`,{className:Y.strip,style:{transform:`translateY(${i[e]}px)`},children:p.map((e,t)=>(0,l.jsx)(`div`,{className:Y.item,style:{height:80},children:e},t))}),(0,l.jsx)(`div`,{className:Y.mask})]},e))}),(0,l.jsx)(`button`,{type:`button`,className:Y.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=_r(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:Y.result,children:o[0]===o[1]&&o[1]===o[2]?`🎰 大奖!`:`结果: ${o.join(` `)}`})]})},yr={sandFall:`cos-sandFall-kgJeI`,canvas:`cos-canvas-9z6X1`,toolbar:`cos-toolbar-u8dLM`,hint:`cos-hint-DS8tY`,button:`cos-button-YhINe`},br=[`#fbbf24`,`#f59e0b`,`#d97706`,`#b45309`,`#92400e`],xr=e=>{let t=e.trim().replace(`#`,``);if(!/^[0-9a-fA-F]{6}$/.test(t))return[251,191,36];let n=parseInt(t,16);return[n>>16&255,n>>8&255,n&255]},Sr=({width:e=480,height:t=400,cellSize:n=4,colors:r=br,spawnRate:i=3})=>{let a=(0,c.useRef)(null),o=Math.max(1,Math.floor(e/n)),s=Math.max(1,Math.floor(t/n)),u=(0,c.useRef)(Array(o*s).fill(null)),d=(0,c.useRef)({x:-1,y:-1,down:!1}),f=(0,c.useMemo)(()=>(r.length>0?r:br).map(xr),[r]),p=()=>{u.current=Array(o*s).fill(null)};(0,c.useEffect)(()=>{u.current=Array(o*s).fill(null)},[o,s]),(0,c.useEffect)(()=>{let r=a.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 p=0,m=document.hidden,h=y(e=>{m=e}),g=(e,t)=>t*o+e,_=()=>{let e=u.current;for(let t=s-2;t>=0;t--)for(let n=0;n<o;n++){let r=g(n,t);if(e[r]===null)continue;let i=g(n,t+1);if(e[i]===null){e[i]=e[r],e[r]=null;continue}let a=Math.random()<.5?-1:1,s=n+a,c=n-a;s>=0&&s<o&&e[g(s,t+1)]===null?(e[g(s,t+1)]=e[r],e[r]=null):c>=0&&c<o&&e[g(c,t+1)]===null&&(e[g(c,t+1)]=e[r],e[r]=null)}},v=()=>{let{x:e,y:t,down:r}=d.current;if(!r||e<0||t<0)return;let a=Math.floor(e/n),c=Math.floor(t/n),l=u.current;for(let e=0;e<i;e++){let e=a+Math.floor((Math.random()-.5)*6),t=c+Math.floor((Math.random()-.5)*3);if(e<0||e>=o||t<0||t>=s)continue;let n=g(e,t);l[n]===null&&(l[n]=Math.floor(Math.random()*f.length))}},b=()=>{l.fillStyle=`#0f172a`,l.fillRect(0,0,e,t);let r=u.current;for(let e=0;e<s;e++)for(let t=0;t<o;t++){let i=r[g(t,e)];if(i===null)continue;let[a,o,s]=f[i];l.fillStyle=`rgb(${a} ${o} ${s})`,l.fillRect(t*n,e*n,n,n)}},x=()=>{p=requestAnimationFrame(x),!m&&(v(),_(),b())};return p=requestAnimationFrame(x),()=>{cancelAnimationFrame(p),h()}},[n,o,t,f,s,i,e]);let m=(e,t,n,r)=>{d.current={x:e-n.left,y:t-n.top,down:r}};return(0,l.jsxs)(`div`,{className:yr.sandFall,style:{width:e},children:[(0,l.jsx)(`canvas`,{ref:a,className:yr.canvas,style:{width:e,height:t},onMouseDown:e=>m(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect(),!0),onMouseMove:e=>{d.current.down&&m(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect(),!0)},onMouseUp:()=>{d.current.down=!1},onMouseLeave:()=>{d.current.down=!1},onTouchStart:e=>{let t=e.touches[0];t&&m(t.clientX,t.clientY,e.currentTarget.getBoundingClientRect(),!0)},onTouchMove:e=>{let t=e.touches[0];t&&m(t.clientX,t.clientY,e.currentTarget.getBoundingClientRect(),!0)},onTouchEnd:()=>{d.current.down=!1}}),(0,l.jsxs)(`div`,{className:yr.toolbar,children:[(0,l.jsx)(`span`,{className:yr.hint,children:`按住鼠标绘制沙粒`}),(0,l.jsx)(`button`,{type:`button`,className:yr.button,onClick:p,children:`Clear`})]})]})},Cr={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`},wr=[`fromTop`,`fromBottom`,`fromLeft`,`fromRight`],Tr=({text:e=`REVEAL`,delay:t=80,color:n=`#f8fafc`})=>(0,l.jsx)(`div`,{className:Cr.splitReveal,children:(0,l.jsx)(`h1`,{className:Cr.text,style:{"--reveal-color":n},children:e.split(``).map((e,n)=>(0,l.jsx)(`span`,{className:`${Cr.char} ${Cr[wr[n%wr.length]]}`,style:{animationDelay:`${n*t}ms`},children:e===` `?`\xA0`:e},`${e}-${n}`))})}),Er={splitText:`cos-splitText-hz-Wy`,text:`cos-text-E89BY`,char:`cos-char-Rmkag`,fadeUp:`cos-fadeUp-5VVYL`,enter:`cos-enter-Nt9F9`,fadeUpIn:`cos-fadeUpIn-eRcGj`,exit:`cos-exit-oGQWA`,fadeUpOut:`cos-fadeUpOut-YFnv-`,scale:`cos-scale-yrOq-`,scaleIn:`cos-scaleIn-0YN5q`,scaleOut:`cos-scaleOut-4Q-NP`,rotate:`cos-rotate-TXlZi`,rotateIn:`cos-rotateIn-ixK-d`,rotateOut:`cos-rotateOut-OA6Ys`,blur:`cos-blur-8VyzQ`,blurIn:`cos-blurIn-X-IdF`,blurOut:`cos-blurOut-ZBSbO`},Dr=({text:e=`SPLIT TEXT`,animation:t=`fadeUp`,stagger:n=50,duration:r=500,loop:i=!0,loopPause:a=2400,fontSize:o=56,color:s=`#f8fafc`})=>{let[u,d]=(0,c.useState)(!0),f=(0,c.useMemo)(()=>e.split(``),[e]),p=f.length*n+r;return(0,c.useEffect)(()=>{if(!i)return;let e,t,n=!1,o=()=>{n||(d(!0),t=setTimeout(()=>{n||(d(!1),e=setTimeout(o,Math.max(r,600)))},p+a))};return o(),()=>{n=!0,e&&clearTimeout(e),t&&clearTimeout(t)}},[r,i,a,p]),(0,l.jsx)(`div`,{className:Er.splitText,children:(0,l.jsx)(`div`,{className:Er.text,style:{fontSize:o,"--split-color":s,"--split-duration":`${r}ms`},children:f.map((e,r)=>(0,l.jsx)(`span`,{className:`${Er.char} ${Er[t]} ${u?Er.enter:Er.exit}`,style:{animationDelay:`${r*n}ms`},children:e===` `?`\xA0`:e},`${e}-${r}`))})})},Or={springMass:`cos-springMass-cYEt6`,canvas:`cos-canvas-mwL9l`,hint:`cos-hint-TKLm3`},kr=(e,t,n,r)=>{let i=Math.max(3,Math.min(n,10)),a=Math.max(3,Math.min(r,8)),o=e*.16,s=t*.18,c=(e-o*2)/(i-1),l=(t-s*2)/(a-1),u=[];for(let e=0;e<a;e++)for(let t=0;t<i;t++){let n=e===0&&(t===0||t===i-1)||e===a-1&&(t===0||t===i-1);u.push({x:o+t*c,y:s+e*l,vx:0,vy:0,pinned:n})}let d=[],f=(e,t)=>t*i+e;for(let e=0;e<a;e++)for(let t=0;t<i;t++)if(t<i-1&&d.push({a:f(t,e),b:f(t+1,e),rest:c}),e<a-1&&d.push({a:f(t,e),b:f(t,e+1),rest:l}),t<i-1&&e<a-1){let n=Math.hypot(c,l);d.push({a:f(t,e),b:f(t+1,e+1),rest:n}),d.push({a:f(t+1,e),b:f(t,e+1),rest:n})}return{nodes:u,springs:d,cols:i,rows:a}},Ar=({width:e=560,height:t=400,cols:n=6,rows:r=5,stiffness:i=.22,damping:a=.9,color:o=`#a78bfa`})=>{let s=(0,c.useRef)(null),u=(0,c.useRef)(kr(e,t,n,r)),d=(0,c.useRef)(null),f=(0,c.useRef)({x:0,y:0});(0,c.useEffect)(()=>{u.current=kr(e,t,n,r),d.current=null},[n,t,r,e]),(0,c.useEffect)(()=>{let n=s.current;if(!n)return;let r=window.devicePixelRatio||1;n.width=e*r,n.height=t*r;let c=n.getContext(`2d`);if(!c)return;c.setTransform(r,0,0,r,0,0);let l=0,p=document.hidden,m=y(e=>{p=e}),h=Math.max(.04,Math.min(i,.8)),g=()=>{let{nodes:n,springs:r}=u.current,i=d.current;if(i){let e=n[i.index];e.x=f.current.x+i.ox,e.y=f.current.y+i.oy,e.vx=0,e.vy=0}for(let e of r){let t=n[e.a],r=n[e.b],a=r.x-t.x,o=r.y-t.y,s=Math.hypot(a,o)||.001,c=(s-e.rest)*h,l=a/s*c,u=o/s*c,d=i?.index===e.a,f=i?.index===e.b;!t.pinned&&!d&&(t.vx+=l,t.vy+=u),!r.pinned&&!f&&(r.vx-=l,r.vy-=u)}for(let r=0;r<n.length;r++){let o=n[r];if(o.pinned||i?.index===r){o.vx=0,o.vy=0;continue}o.vx*=a,o.vy*=a,o.x+=o.vx,o.y+=o.vy,o.x<10?(o.x=10,o.vx*=-.4):o.x>e-10&&(o.x=e-10,o.vx*=-.4),o.y<10?(o.y=10,o.vy*=-.4):o.y>t-10&&(o.y=t-10,o.vy*=-.4)}},_=()=>{let{nodes:n,springs:r}=u.current;c.fillStyle=`#0f172a`,c.fillRect(0,0,e,t);for(let i of r){let r=n[i.a],a=n[i.b],s=Math.hypot(a.x-r.x,a.y-r.y)||1,l=Math.min(1,Math.abs(s-i.rest)/i.rest);c.beginPath(),c.moveTo(r.x,r.y),c.lineTo(a.x,a.y),c.strokeStyle=o,c.globalAlpha=.22+l*.55,c.lineWidth=i.rest>Math.max(e,t)*.2?1:1.6,c.stroke(),c.globalAlpha=1}n.forEach((e,t)=>{c.beginPath(),c.arc(e.x,e.y,e.pinned?6:8,0,Math.PI*2),c.fillStyle=e.pinned?`#64748b`:o,c.fill(),c.strokeStyle=`rgb(255 255 255 / 28%)`,c.lineWidth=1,c.stroke(),d.current?.index===t&&(c.beginPath(),c.arc(e.x,e.y,13,0,Math.PI*2),c.strokeStyle=o,c.globalAlpha=.45,c.lineWidth=2,c.stroke(),c.globalAlpha=1)})},v=()=>{l=requestAnimationFrame(v),!p&&(g(),_())};return l=requestAnimationFrame(v),()=>{cancelAnimationFrame(l),m()}},[o,a,t,i,e]);let p=(e,t)=>{let{nodes:n}=u.current,r=-1,i=20;return n.forEach((n,a)=>{if(n.pinned)return;let o=Math.hypot(n.x-e,n.y-t);o<i&&(i=o,r=a)}),r},m=(e,t,n)=>{let r=e-n.left,i=t-n.top;f.current={x:r,y:i};let a=p(r,i);if(a<0)return;let o=u.current.nodes[a];d.current={index:a,ox:o.x-r,oy:o.y-i}},h=(e,t,n)=>{f.current={x:e-n.left,y:t-n.top}},g=()=>{d.current=null};return(0,l.jsxs)(`div`,{className:Or.springMass,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:s,className:Or.canvas,style:{width:e,height:t},onMouseDown:e=>m(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect()),onMouseMove:e=>h(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect()),onMouseUp:g,onMouseLeave:g,onTouchStart:e=>{let t=e.touches[0];t&&m(t.clientX,t.clientY,e.currentTarget.getBoundingClientRect())},onTouchMove:e=>{let t=e.touches[0];t&&h(t.clientX,t.clientY,e.currentTarget.getBoundingClientRect())},onTouchEnd:g}),(0,l.jsx)(`div`,{className:Or.hint,children:`拖拽网格质点,观察弹簧回弹`})]})},jr={spotlight:`cos-spotlight-OddY1`,content:`cos-content-5I1Wy`,overlay:`cos-overlay-F6CJ5`},Mr=({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:jr.spotlight,style:{"--spot-radius":`${t}px`,"--dim-color":n},onMouseMove:i,children:[(0,l.jsx)(`div`,{className:jr.content,children:e}),(0,l.jsx)(`div`,{className:jr.overlay})]})},Nr={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`},Pr=[`#FF6B6B`,`#4ECDC4`,`#FFE66D`,`#A78BFA`,`#60A5FA`,`#F472B6`,`#34D399`,`#FB923C`],Fr=[{label:`一等奖`},{label:`二等奖`},{label:`三等奖`},{label:`谢谢参与`},{label:`优惠券`},{label:`再来一次`}],Ir=e=>1-(1-e)**3,Lr=({prizes:e=Fr,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??Pr[e%Pr.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:Nr.turntable,style:{width:v,height:v+80},children:[(0,l.jsxs)(`div`,{className:Nr.wheelWrap,style:{width:v,height:v},children:[(0,l.jsx)(`div`,{className:Nr.pointer}),(0,l.jsx)(`canvas`,{ref:o,className:Nr.canvas,style:{width:v,height:v}}),(0,l.jsx)(`button`,{type:`button`,className:Nr.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=Ir(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:Nr.result,children:[`恭喜获得:`,(0,l.jsx)(`strong`,{children:m.label})]})]})},Rr={textMorph:`cos-textMorph-W-C1e`,stage:`cos-stage-AaMn6`,layer:`cos-layer-N-4oM`},zr=[`COS DESIGN`,`TEXT MORPH`,`SMOOTH TRANSITION`],Br=(e,t,n)=>Math.min(n,Math.max(t,e)),Vr=({texts:e=zr,interval:t=2200,duration:n=680,fontSize:r=64,color:i=`#f8fafc`})=>{let a=(0,c.useMemo)(()=>e.length>0?e:zr,[e]),[o,s]=(0,c.useState)(0),[u,d]=(0,c.useState)(0),f=(0,c.useRef)(0),p=(0,c.useRef)(0);(0,c.useEffect)(()=>(p.current=window.setTimeout(()=>{let e=performance.now(),t=r=>{let i=Br((r-e)/Math.max(n,16),0,1);if(d(i),i<1){f.current=requestAnimationFrame(t);return}s(e=>(e+1)%a.length),d(0)};f.current=requestAnimationFrame(t)},t),()=>{window.clearTimeout(p.current),cancelAnimationFrame(f.current)}),[n,o,t,a]);let m=a[o],h=a[(o+1)%a.length],g=1-u,_=u,v=u*14,y=(1-u)*14,b=1-u*.08,x=.92+u*.08;return(0,l.jsx)(`div`,{className:Rr.textMorph,style:{"--morph-color":i},children:(0,l.jsxs)(`div`,{className:Rr.stage,style:{fontSize:r},children:[(0,l.jsx)(`span`,{className:`${Rr.layer} ${Rr.current}`,style:{opacity:g,filter:`blur(${v}px)`,transform:`scale(${b}) translateY(${u*-8}px)`},children:m}),(0,l.jsx)(`span`,{className:`${Rr.layer} ${Rr.next}`,style:{opacity:_,filter:`blur(${y}px)`,transform:`scale(${x}) translateY(${(1-u)*8}px)`},children:h})]})})},X={trueFocus:`cos-trueFocus-GX7IP`,stage:`cos-stage-epay6`,word:`cos-word-5pfV3`,focusFrame:`cos-focusFrame-o7brV`,corner:`cos-corner-PThvn`,tl:`cos-tl-maoq6`,tr:`cos-tr-KTph3`,bl:`cos-bl-JAm8m`,br:`cos-br-s9hq-`},Hr=({sentence:e=`True Focus`,separator:t=` `,manualMode:n=!1,blurAmount:r=5,borderColor:i=`#22c55e`,glowColor:a=`rgb(34 197 94 / 60%)`,animationDuration:o=.5,pauseBetweenAnimations:s=1,fontSize:u=48,color:d=`#f8fafc`})=>{let f=e.split(t).filter(Boolean),[p,m]=(0,c.useState)(0),[h,g]=(0,c.useState)(0),_=(0,c.useRef)(null),v=(0,c.useRef)([]),[y,b]=(0,c.useState)({x:0,y:0,width:0,height:0});(0,c.useEffect)(()=>{if(n||f.length===0)return;let e=window.setInterval(()=>{m(e=>(e+1)%f.length)},(o+s)*1e3);return()=>window.clearInterval(e)},[o,n,s,f.length]),(0,c.useEffect)(()=>{let e=_.current,t=v.current[p];if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();b({x:r.left-n.left,y:r.top-n.top,width:r.width,height:r.height})},[p,u,e,f.length]);let x=e=>{n&&(g(e),m(e))},S=()=>{n&&m(h)};return(0,l.jsx)(`div`,{className:X.trueFocus,children:(0,l.jsxs)(`div`,{className:X.stage,ref:_,style:{fontSize:u,"--focus-color":d,"--border-color":i,"--glow-color":a,"--focus-duration":`${o}s`},children:[f.map((e,t)=>{let i=t===p;return(0,l.jsx)(`span`,{ref:e=>{v.current[t]=e},className:X.word,style:{filter:i?`blur(0px)`:`blur(${r}px)`,cursor:n?`pointer`:`default`},onMouseEnter:()=>x(t),onMouseLeave:S,children:e},`${e}-${t}`)}),(0,l.jsxs)(`div`,{className:X.focusFrame,style:{transform:`translate(${y.x}px, ${y.y}px)`,width:y.width,height:y.height,opacity:+(p>=0)},children:[(0,l.jsx)(`span`,{className:`${X.corner} ${X.tl}`}),(0,l.jsx)(`span`,{className:`${X.corner} ${X.tr}`}),(0,l.jsx)(`span`,{className:`${X.corner} ${X.bl}`}),(0,l.jsx)(`span`,{className:`${X.corner} ${X.br}`})]})]})})},Ur={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`},Wr=[`Hello, cos-design!`,`欢迎来到组件库 ✨`,`Build something fun 🚀`],Gr=({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:Ur.typewriter,children:(0,l.jsxs)(`div`,{className:Ur.terminal,children:[(0,l.jsxs)(`div`,{className:Ur.dots,children:[(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{})]}),(0,l.jsxs)(`p`,{className:Ur.text,children:[(0,l.jsx)(`span`,{className:Ur.prompt,children:`>`}),i,(0,l.jsx)(`span`,{className:Ur.cursor,children:`|`})]})]})})},Kr=({texts:e=Wr,speed:t=100,deleteSpeed:n=50,pause:r=2e3})=>{let i=e.length>0?e:Wr;return(0,l.jsx)(Gr,{texts:i,speed:t,deleteSpeed:n,pause:r},i.join(`\0`))},qr={waveButton:`cos-waveButton-Aa7G-`,btn:`cos-btn-WJrEN`,label:`cos-label-9BHOU`,wave:`cos-wave-GycLU`,ripple:`cos-ripple-5ZFpr`},Jr=({text:e=`点我试试`,color:t=`#38bdf8`,className:n,style:r,...i})=>(0,l.jsx)(`div`,{className:qr.waveButton,children:(0,l.jsxs)(`button`,{type:`button`,className:`${qr.btn} ${n??``}`,style:{"--wave-color":t,...r},...i,children:[(0,l.jsx)(`span`,{className:qr.wave}),(0,l.jsx)(`span`,{className:qr.wave}),(0,l.jsx)(`span`,{className:qr.label,children:e})]})}),Z=e=>Math.min(1,Math.max(0,e)),Yr=e=>{let t=e.replace(`#`,``).trim(),n=t.length===3?t.split(``).map(e=>e+e).join(``):t;if(n.length!==6)return[80,140,200];let r=Number.parseInt(n,16);return Number.isNaN(r)?[80,140,200]:[r>>16&255,r>>8&255,r&255]},Xr=([e,t,n])=>{let r=e=>Math.min(255,Math.max(0,Math.round(e))).toString(16).padStart(2,`0`);return`#${r(e)}${r(t)}${r(n)}`},Zr=(e,t,n)=>e+(t-e)*n,Qr=(e,t,n)=>[Zr(e[0],t[0],n),Zr(e[1],t[1],n),Zr(e[2],t[2],n)],Q=(e,t,n)=>Xr(Qr(Yr(e),Yr(t),Z(n))),$r=e=>{let t=Z(e);return t*t*(3-2*t)},ei=(e=Date.now())=>{let t=new Date(e),n=new Date(t);n.setHours(6,0,0,0);let r=new Date(t);return r.setHours(18,0,0,0),{sunrise:n.getTime(),sunset:r.getTime()}},ti=(e,t=new Date)=>{let n=e.trim().match(/^(\d{1,2}):(\d{2})$/);if(!n)return null;let r=Number(n[1]),i=Number(n[2]);if(r<0||r>23||i<0||i>59)return null;let a=new Date(t);return a.setHours(r,i,0,0),a.getTime()},ni=(e,t=new Date)=>ti(e??`14:00`,t)??ti(`14:00`,t),ri=(e,t)=>{let{sunrise:n,sunset:r}=t;if(!(r>n)){let t=ei(e);n=t.sunrise,r=t.sunset}let i=Math.max(1,r-n),a=n+1440*60*1e3,o=r-1440*60*1e3,s=e>=n&&e<r,c;if(s)c=Z((e-n)/i);else if(e>=r){let t=Math.max(1,a-r);c=Z((e-r)/t)}else{let t=Math.max(1,n-o);c=Z((e-o)/t)}let l=s?Math.sin(Math.PI*c):0,u=Math.abs(e-n),d=Math.abs(e-r),f=Z(1-Math.min(u,d)/45e5);return{isDay:s,arcProgress:c,elevation:l,twilight:f}},ii=(e,t,n)=>{let r=Z(n),i=Math.sin(Math.PI*r);return{x:e*(.1+.8*r),y:t*(.58-.4*i)}},ai=`#e8895c`,oi=`#f3c98a`,si=`#2a1f4a`,ci=`#c4784a`,li=(e,t,n)=>{if(n.isDay){let t=$r(n.elevation),r=(1-t)*.72;return[Q(Q(e[0],ai,r),`#1a2438`,(1-t)*.12),Q(Q(e[1],oi,r*.85),`#3a4558`,(1-t)*.08)]}let r=n.twilight;return[Q(t[0],Q(si,ai,.35),r*.55),Q(t[1],Q(ci,oi,.4),r*.7)]},ui=(e,t,n)=>{let r=e.createLinearGradient(0,0,0,t);return r.addColorStop(0,n[0]),r.addColorStop(1,n[1]),r},di=e=>{if(!e.isDay)return{scale:.92+e.twilight*.06,alpha:.75+e.twilight*.2};let t=e.elevation;return{scale:.82+t*.22,alpha:.65+t*.35}},fi=2,pi=[``,`薄雾`,`中雾`,`浓雾`],mi=e=>Math.min(3,Math.max(1,Math.round(e))),hi=e=>{let t=mi(e);return`${t} · ${pi[t]}`},gi=e=>e===`fog`,_i=(e,t)=>{let n=mi(t);return n===1?{...e,fogBanks:3,haze:.06,cloudAlpha:Math.min(e.cloudAlpha,.28),sun:`soft`}:n===3?{...e,fogBanks:12,haze:.3,cloudAlpha:.42,sun:`dim`}:{...e,fogBanks:5,haze:.11,cloudAlpha:.32,sun:`dim`}},vi=e=>{let t=mi(e);return t===1?.45:t===3?.95:.65},yi=e=>e===45?2:e===48?3:null,bi=e=>e==null||!Number.isFinite(e)?null:e>=5e3?1:e>=1e3?2:3,xi=2,Si=[``,`细雹`,`密雹`,`巨雹`],Ci=e=>Math.min(3,Math.max(1,Math.round(e))),wi=e=>{let t=Ci(e);return`${t} · ${Si[t]}`},Ti=e=>e===`hail`,Ei=e=>{let t=Ci(e);return t===1?{count:75,sizeMin:.85,sizeMax:2.1,speedMul:.88}:t===3?{count:210,sizeMin:2.4,sizeMax:5.6,speedMul:1.22}:{count:145,sizeMin:1.4,sizeMax:3.8,speedMul:1}},Di=e=>e===96?2:e===99?3:null,Oi=1,ki=10,Ai=5,ji=5,$=e=>Math.min(10,Math.max(1,Math.round(e))),Mi=(e,t,n)=>e+(t-e)*n,Ni=e=>{let t=$(e);return t<=2?1:t<=4?2:t<=6?3:t<=8?4:5},Pi=[`毛毛雨`,`小雨`,`中雨`,`暴雨`,`特大暴雨`],Fi=[`毛毛雪`,`小雪`,`中雪`,`暴雪`,`特大暴雪`],Ii=(e,t)=>{let n=Ni(e);return(t===`rain`?Pi:Fi)[n-1]},Li=(e,t)=>`${$(e)} · ${Ii(e,t)}`,Ri=[``,...Pi],zi=[``,...Fi],Bi=e=>e===`lightRain`||e===`moderateRain`||e===`heavyRain`?`rain`:e===`lightSnow`||e===`moderateSnow`||e===`heavySnow`?`snow`:e,Vi=e=>e===`rain`||e===`lightRain`||e===`moderateRain`||e===`heavyRain`,Hi=e=>e===`snow`||e===`lightSnow`||e===`moderateSnow`||e===`heavySnow`,Ui=e=>Vi(e)||e===`thunderstorm`||e===`sleet`,Wi=e=>Hi(e)||e===`sleet`,Gi=(e,t=5)=>e===`lightRain`?3:e===`moderateRain`?5:e===`heavyRain`?8:$(t),Ki=(e,t=5)=>e===`lightSnow`?3:e===`moderateSnow`?5:e===`heavySnow`?8:$(t),qi=(e,t)=>t===`rain`?e<=2?`lightRain`:e===3?`moderateRain`:`heavyRain`:e<=2?`lightSnow`:e===3?`moderateSnow`:`heavySnow`,Ji=(e,t=5,n=5)=>e===`rain`?qi(Ni(t),`rain`):e===`lightRain`||e===`moderateRain`||e===`heavyRain`?qi(Ni(Gi(e)),`rain`):e===`snow`?qi(Ni(n),`snow`):e===`lightSnow`||e===`moderateSnow`||e===`heavySnow`?qi(Ni(Ki(e)),`snow`):e,Yi=(e,t)=>{let n=($(t)-1)/9;return{count:Math.round(Mi(35,340,n)),speed:Mi(5.5,16,n),wind:Mi(-.4,-3.2,n),alpha:Mi(.28,.62,n),splash:$(t)>=5}},Xi=e=>{let t=($(e)-1)/9;return Math.round(Mi(30,360,t))},Zi=e=>[51,56].includes(e)?2:[61,66,80].includes(e)?3:[53,55,57,63,81].includes(e)?5:[65,67].includes(e)?8:[82].includes(e)?10:[95].includes(e)?7:null,Qi=e=>[77].includes(e)?2:[71,85].includes(e)?3:[73].includes(e)?5:[75].includes(e)?8:[86].includes(e)?10:null,$i=2,ea=[``,`轻霾`,`中霾`,`重霾`],ta=e=>Math.min(3,Math.max(1,Math.round(e))),na=e=>{let t=ta(e);return`${t} · ${ea[t]}`},ra=e=>e===`smog`,ia=(e,t)=>{let n=ta(t);return n===1?{...e,fogBanks:5,haze:.16,cloudAlpha:Math.min(e.cloudAlpha,.28),sun:`soft`}:n===3?{...e,fogBanks:16,haze:.48,cloudAlpha:.42,sun:`dim`}:{...e,fogBanks:12,haze:.34,cloudAlpha:.35,sun:`dim`}},aa=e=>{let t=ta(e);return t===1?.55:t===3?1.05:.85},oa=e=>e==null||!Number.isFinite(e)?null:e>=5e3?1:e>=1e3?2:3,sa={0:`sunny`,1:`sunny`,2:`partlyCloudy`,3:`overcast`,45:`fog`,48:`fog`,51:`rain`,53:`rain`,55:`rain`,56:`rain`,57:`rain`,61:`rain`,63:`rain`,65:`rain`,66:`rain`,67:`rain`,80:`rain`,81:`rain`,82:`rain`,71:`snow`,73:`snow`,75:`snow`,77:`snow`,85:`snow`,86:`snow`,95:`thunderstorm`,96:`hail`,99:`hail`},ca=e=>Bi(sa[e]??`overcast`),la={weather:null,rainLevel:null,snowLevel:null,fogLevel:null,hailLevel:null,smogLevel:null,status:`idle`,error:null,current:null},ua={weather:null,rainLevel:null,snowLevel:null,fogLevel:null,hailLevel:null,smogLevel:null,status:`locating`,error:null,current:null},da={weather:null,rainLevel:null,snowLevel:null,fogLevel:null,hailLevel:null,smogLevel:null,status:`fetching`,error:null,current:null},fa=e=>e!=null&&Number.isFinite(e.latitude)&&Number.isFinite(e.longitude),pa=e=>{if(typeof e!=`string`||!e)return null;let t=Date.parse(e);return Number.isFinite(t)?t:null},ma=e=>{if(typeof e!=`string`||!e)return null;let t=e.match(/T(\d{2}):(\d{2})/);return t?`${t[1]}:${t[2]}`:null},ha=(e,t)=>{if(e)try{let t=new Intl.DateTimeFormat(`en-GB`,{timeZone:e,hour:`2-digit`,minute:`2-digit`,hour12:!1}).formatToParts(new Date),n=t.find(e=>e.type===`hour`)?.value,r=t.find(e=>e.type===`minute`)?.value;if(n!=null&&r!=null)return`${n.padStart(2,`0`)}:${r.padStart(2,`0`)}`}catch{}return t??null},ga=(e=!0,t)=>{let n=fa(t),r=n?t.latitude:null,i=n?t.longitude:null,a=e?n?da:ua:la,o=`${e}:${r},${i}`,[s,l]=(0,c.useState)(a),[u,d]=(0,c.useState)(o);return u!==o&&(d(o),l(t=>e&&t.weather?{...a,weather:t.weather,current:t.current}:a)),(0,c.useEffect)(()=>{if(!e)return;let t=!1,n=new AbortController,a=async(e,r)=>{try{let i=new URLSearchParams({latitude:String(e),longitude:String(r),current:`weather_code,wind_speed_10m,is_day,visibility`,daily:`sunrise,sunset`,timezone:`auto`,forecast_days:`1`}),a=await fetch(`https://api.open-meteo.com/v1/forecast?${i}`,{signal:n.signal});if(!a.ok)throw Error(`Open-Meteo 请求失败(HTTP ${a.status})`);let o=await a.json(),s=Number(o?.current?.weather_code);if(Number.isNaN(s))throw Error(`Open-Meteo 返回数据缺少 weather_code`);let c=Number(o?.current?.wind_speed_10m??0),u=pa(o?.daily?.sunrise?.[0]),d=pa(o?.daily?.sunset?.[0]),f=typeof o?.timezone==`string`?o.timezone:null,p=ma(o?.current?.time)??ha(f),m=ca(s),h=Zi(s),g=Qi(s),_=o?.current?.visibility,v=_!=null&&Number.isFinite(Number(_))?Number(_):null,y=m===`fog`?bi(v)??yi(s)??2:null,b=m===`hail`?Di(s)??2:null,x=m===`smog`?oa(v)??2:null;if(t)return;l({weather:m,rainLevel:h,snowLevel:g,fogLevel:y,hailLevel:b,smogLevel:x,status:`success`,error:null,current:{weatherCode:s,windSpeed:c,isDay:o?.current?.is_day===1,latitude:e,longitude:r,timezone:f,localTime:p,visibility:v,rainLevel:h,snowLevel:g,fogLevel:y,hailLevel:b,smogLevel:x,sunrise:u,sunset:d}})}catch(e){if(t||e instanceof DOMException&&e.name===`AbortError`)return;l({weather:null,rainLevel:null,snowLevel:null,fogLevel:null,hailLevel:null,smogLevel:null,status:`error`,error:e instanceof Error?e.message:`天气获取失败`,current:null})}};return r!=null&&i!=null?(a(r,i),()=>{t=!0,n.abort()}):typeof navigator>`u`||!navigator.geolocation?(Promise.resolve().then(()=>{t||l({weather:null,rainLevel:null,snowLevel:null,fogLevel:null,hailLevel:null,smogLevel:null,status:`error`,error:`当前环境不支持定位`,current:null})}),()=>{t=!0}):(navigator.geolocation.getCurrentPosition(({coords:e})=>{t||(l(e=>({...e,status:`fetching`})),a(e.latitude,e.longitude))},e=>{t||l({weather:null,rainLevel:null,snowLevel:null,fogLevel:null,hailLevel:null,smogLevel:null,status:`error`,error:e.message||`定位失败`,current:null})},{timeout:1e4,maximumAge:600*1e3}),()=>{t=!0,n.abort()})},[e,r,i]),s},_a=async(e,t,n)=>{let r=new URLSearchParams({latitude:String(e),longitude:String(t),daily:`sunrise,sunset`,timezone:`auto`,forecast_days:`1`}),i=await fetch(`https://api.open-meteo.com/v1/forecast?${r}`,{signal:n});if(!i.ok)return null;let a=await i.json(),o=pa(a?.daily?.sunrise?.[0]),s=pa(a?.daily?.sunset?.[0]);return o==null||s==null?null:{sunrise:o,sunset:s}},va=e=>{let t=fa(e),n=t?e.latitude:null,r=t?e.longitude:null,i=`${n},${r}`,[a,o]=(0,c.useState)(null),[s,l]=(0,c.useState)(i);return s!==i&&(l(i),o(null)),(0,c.useEffect)(()=>{if(n==null||r==null)return;let e=!1,t=new AbortController;return _a(n,r,t.signal).then(t=>{e||o(t)}).catch(()=>{e||o(null)}),()=>{e=!0,t.abort()}},[n,r]),t?a:null},ya=3,ba=e=>Math.min(12,Math.max(0,Math.round(e))),xa=e=>Math.max(0,ba(e)-2),Sa=.55,Ca=[0,3,8,16,24,33,44,55,68,81,95,110,125],wa=[1,5,11,19,28,38,49,61,74,88,102,117,1/0],Ta=(e,t,n=0,r=0)=>{let i=t.gustiness,a=t.wander,o=n*.0017+r*.0024,s=e*Sa,c=Math.sin(s*.007+o),l=Math.sin(s*.021+1.37+o*1.4),u=Math.sin(s*.055+2.8+o*.6),d=1+(.5*c+.35*l+.15*u)*(.25+i*.75),f=Math.sin(s*.012+o*.8);f>.72&&(d+=(f-.72)*(.8+i*2.4)),Math.sin(s*.0095+.6+o)<-.55&&(d*=.45+i*.2),d=Math.max(.12,Math.min(2.25,d));let p=a*(.55*Math.sin(s*.0088+o)+.3*Math.sin(s*.026+1.9+o*1.1)+.15*Math.sin(s*.063+.4));return{intensity:d,angle:p,ux:Math.cos(p),uy:Math.sin(p)}},Ea=e=>{let t=ba(e);if(t<=0)return{count:0,alphaMul:0};let n=Math.min(1,(t/9)**1.15);return{count:Math.floor(3+n*n*50),alphaMul:.1+n*.9}},Da=e=>Ca[ba(e)]??16,Oa=e=>{let t=Math.max(0,e);for(let e=0;e<wa.length;e++)if(t<=wa[e])return e;return 12},ka=e=>{let t=Oa(e),n=xa(t),r=Da(n),i=Math.max(.04,Math.min(r/16,4.2)),{alphaMul:a}=Ea(n),o=i**.82,s=Math.min(1,(n/8)**1.1),c=(.04+s*.32)*Math.PI;return{speedKmh:e,level:t,visualLevel:n,scale:i,cloud:.28+i*.72,rain:o,snowDrift:-(.04+o*.28),hail:.4+o*.85,fog:.32+o*.58,streak:.55+o*.95,streakVisibility:a,gustiness:s,wander:c}},Aa=e=>e.live&&e.liveWindKmh!=null&&Number.isFinite(e.liveWindKmh)?Math.max(0,e.liveWindKmh):Da(e.windLevel);function ja(e){let t=e.windMotion.cloud,{intensity:n,angle:r,uy:i}=e.windField,a=-Math.cos(r);for(let r of e.state.clouds){let o=Math.abs(r.speed)*t*n;r.x+=o*a,r.y+=o*i*.12,r.y<-80&&(r.y=-80),r.y>e.height*.55&&(r.y=e.height*.55),r.x-140*r.scale>e.width&&(r.x=-160*r.scale),r.x+180*r.scale<0&&(r.x=e.width+40*r.scale),e.ctx.drawImage(r.sprite,r.x+r.ox,r.y+r.oy)}}function Ma(e){let t=e.fogSprite;if(!t||e.state.fogBanks.length===0)return;let{canvas:n,baseR:r}=t,i=e.windMotion.fog,{intensity:a,angle:o,uy:s}=e.windField,c=-Math.cos(o);for(let t of e.state.fogBanks){let o=Math.abs(t.speed)*i*a;t.x+=o*c,t.y+=o*s*.1,t.y<e.height*.02&&(t.y=e.height*.02),t.y>e.height*.95&&(t.y=e.height*.95),c<0&&t.x+t.rw<0&&(t.x=e.width+t.rw),c>0&&t.x-t.rw>e.width&&(t.x=-t.rw),e.ctx.save(),e.ctx.translate(t.x,t.y),e.ctx.scale(t.rw/r,t.rh/r),e.ctx.globalAlpha=t.alpha,e.ctx.drawImage(n,-r,-r),e.ctx.restore()}}function Na(e){if(e.cfg.haze<=0)return;let t=e.activeWeather===`smog`?`177, 164, 135`:`220, 226, 232`;e.activeNight&&(t=e.activeWeather===`smog`?`82, 74, 54`:`116, 128, 145`),e.ctx.fillStyle=`rgba(${t}, ${e.cfg.haze})`,e.ctx.fillRect(0,0,e.width,e.height)}function Pa(e,t,n,r,i,a){if(a<=0)return[[e,t],[n,r]];let o=(e+n)/2+(Math.random()-.5)*i,s=(t+r)/2,c=Pa(e,t,o,s,i*.55,a-1),l=Pa(o,s,n,r,i*.55,a-1);return[...c.slice(0,-1),...l]}function Fa(e){if(e.state.windStreaks.length===0)return;let t=e.windMotion.streak,n=e.windMotion.streakVisibility;if(n<=.02)return;let r=e.state.t;for(let i of e.state.windStreaks){let a=Ta(r+i.phase*18,e.windMotion,i.x,i.y),o=a.intensity*(.55+.45*e.windField.intensity),s=a.angle*.65+e.windField.angle*.35,c=-1*Math.cos(s),l=Math.sin(s),u=i.speed*t*o;i.x+=u*c,i.y+=u*l*.45,i.wave+=.03+o*.025,(i.x<-i.length-40||i.x>e.width+i.length+40)&&(i.x=c<0?e.width+i.length+Math.random()*e.width*.25:-i.length-Math.random()*e.width*.25,i.y=Math.random()*e.height),i.y<-20&&(i.y=e.height+10),i.y>e.height+20&&(i.y=-10);let d=5+o*5,f=Math.sin(i.wave)*d,p=i.length*(.85+o*.2),m=i.x+c*p,h=i.y+l*p*.45,g=i.alpha*n*Math.min(1.35,.55+o*.55);if(e.ctx.beginPath(),e.ctx.moveTo(i.x,i.y),e.ctx.bezierCurveTo(i.x+c*p*.3,i.y+l*p*.3*.45+f,i.x+c*p*.7,i.y+l*p*.7*.45-f,m,h),e.ctx.strokeStyle=`rgba(235, 244, 250, ${g})`,e.ctx.lineWidth=i.width*(.85+o*.2),e.ctx.lineCap=`round`,e.ctx.stroke(),i.length>70&&n>.45&&o>.7){let t=i.x+c*p*.58,n=i.y+l*p*.58*.45-f*.4;e.ctx.save(),e.ctx.translate(t,n),e.ctx.rotate(s+i.wave*2),e.ctx.beginPath(),e.ctx.ellipse(0,0,4,1.6,0,0,Math.PI*2),e.ctx.fillStyle=`rgba(91, 76, 52, ${g*1.4})`,e.ctx.fill(),e.ctx.restore()}}}function Ia(e){if(e.cfg.lightning){if(e.state.t>=e.state.nextStrike){e.state.nextStrike=e.state.t+150+Math.random()*300,e.state.flashAlpha=.5,e.state.boltLife=9;let t=e.width*(.15+Math.random()*.7);e.state.boltPoints=Pa(t,e.height*.12,t+(Math.random()-.5)*e.width*.2,e.height*.92,60,6)}if(e.state.boltLife>0){--e.state.boltLife;let t=e.state.boltLife/9;e.ctx.beginPath(),e.state.boltPoints.forEach(([t,n],r)=>r===0?e.ctx.moveTo(t,n):e.ctx.lineTo(t,n)),e.ctx.strokeStyle=`rgba(240, 246, 255, ${t})`,e.ctx.lineWidth=2.4,e.ctx.shadowColor=`#bcd7ff`,e.ctx.shadowBlur=16,e.ctx.stroke(),e.ctx.shadowBlur=0}e.state.flashAlpha>.01&&(e.ctx.fillStyle=`rgba(226, 236, 255, ${e.state.flashAlpha})`,e.ctx.fillRect(0,0,e.width,e.height),e.state.flashAlpha*=.82)}}var La=3.2,Ra=e=>{let t=Math.ceil(e*2.8+4),n=document.createElement(`canvas`);n.width=t,n.height=t;let r=n.getContext(`2d`),i=t/2,a=t/2,o=9+Math.floor(Math.random()*5),s=Array.from({length:o},(t,n)=>{let r=n/o*Math.PI*2+(Math.random()-.5)*.22,s=e*(.72+Math.random()*.44);return{x:i+Math.cos(r)*s,y:a+Math.sin(r)*s}}),c=(e,t)=>({x:(e.x+t.x)/2,y:(e.y+t.y)/2});r.beginPath();let l=c(s[s.length-1],s[0]);r.moveTo(l.x,l.y);for(let e=0;e<s.length;e++){let t=c(s[e],s[(e+1)%s.length]);r.quadraticCurveTo(s[e].x,s[e].y,t.x,t.y)}r.closePath();let u=i-e*.3,d=a-e*.34,f=r.createRadialGradient(u,d,e*.06,i,a,e*1.2);f.addColorStop(0,`rgba(255, 255, 255, 0.98)`),f.addColorStop(.42,`rgba(228, 241, 252, 0.96)`),f.addColorStop(.82,`rgba(176, 203, 224, 0.93)`),f.addColorStop(1,`rgba(130, 162, 188, 0.9)`),r.fillStyle=f,r.fill(),r.strokeStyle=`rgba(155, 190, 215, 0.62)`,r.lineWidth=Math.max(.45,e*.11),r.stroke();let p=1+Math.floor(Math.random()*2);for(let t=0;t<p;t++){let t=Math.random()*Math.PI*2,n=i+Math.cos(t)*e*(.28+Math.random()*.35),o=a+Math.sin(t)*e*(.28+Math.random()*.35);r.beginPath(),r.ellipse(n,o,e*(.14+Math.random()*.1),e*(.1+Math.random()*.08),t,0,Math.PI*2),r.fillStyle=`rgba(105, 135, 165, 0.28)`,r.fill()}if(Math.random()<.75){let t=Math.random()*Math.PI*2,n=i+Math.cos(t)*e*(.38+Math.random()*.28),o=a+Math.sin(t)*e*(.38+Math.random()*.28);r.beginPath(),r.arc(n,o,e*(.1+Math.random()*.08),0,Math.PI*2),r.fillStyle=`rgba(255, 255, 255, 0.55)`,r.fill()}return r.beginPath(),r.ellipse(i-e*.34,a-e*.36,e*.24,e*.17,-.35,0,Math.PI*2),r.fillStyle=`rgba(255, 255, 255, 0.78)`,r.fill(),n},za=(e=16)=>Array.from({length:e},()=>Ra(La)),Ba=e=>e[Math.floor(Math.random()*e.length)],Va=(e,t,n,r,i=!0,a,o=1)=>{let s=a?.min??1.4,c=a?.max??4.8;e.r=s+Math.random()**1.35*(c-s),e.x=Math.random()*(t+260)-130+(Math.random()-.5)*40,e.y=i?-e.r-Math.random()*n*.55:Math.random()*n,e.vx=(-1.2-Math.random()*4.8+(Math.random()-.5)*1.2)*o,e.vy=(5.5+Math.random()*11)*o,e.bounces=0,e.opacity=.45+Math.random()*.55,e.delay=Math.floor(Math.random()*(i?110:45)),e.gravity=(.11+Math.random()*.14)*(.9+o*.1),e.phase=Math.random()*Math.PI*2,e.gust=(Math.random()-.5)*1.4,e.maxBounces=+(Math.random()<.62),e.sprite=Ba(r),e.drawSize=e.r*2.8+4,e.rotation=Math.random()*Math.PI*2,e.rotationSpeed=(Math.random()-.5)*.06},Ha=(e,t,n,r,i=1)=>{let a={x:0,y:0,r:2,vx:0,vy:0,bounces:0,opacity:1,delay:0,gravity:.16,phase:0,gust:0,maxBounces:1,sprite:n[0],drawSize:9.6,rotation:0,rotationSpeed:0};return Va(a,e,t,n,Math.random()<.72,r,i),a};function Ua(e){if(!e.cfg.rain)return;let{alpha:t,splash:n}=e.cfg.rain,r=e.cfg.rain.wind*e.windMotion.rain,{intensity:i,angle:a,uy:o}=e.windField,s=r*i*Math.cos(a),c=Math.abs(r)*i*o*.35;e.ctx.strokeStyle=`rgba(214, 228, 240, ${t})`,e.ctx.lineWidth=1.2,e.ctx.beginPath();for(let t of e.state.drops){let r=t.speed+c,i=Math.hypot(s,r)||1,a=s/i,o=r/i;e.ctx.moveTo(t.x,t.y),e.ctx.lineTo(t.x+a*t.len,t.y+o*t.len),t.x+=s,t.y+=r,t.y>e.height&&(n&&Math.random()<.3&&e.state.splashes.length<60&&e.state.splashes.push({x:t.x,r:1,alpha:.5}),t.y=-t.len,t.x=Math.random()*(e.width+160)-80)}e.ctx.stroke();for(let t=e.state.splashes.length-1;t>=0;t--){let n=e.state.splashes[t];if(n.r+=.8,n.alpha-=.035,n.alpha<=0){e.state.splashes.splice(t,1);continue}e.ctx.beginPath(),e.ctx.ellipse(n.x,e.height-3,n.r,n.r*.35,0,Math.PI,Math.PI*2),e.ctx.strokeStyle=`rgba(214, 228, 240, ${n.alpha})`,e.ctx.lineWidth=1,e.ctx.stroke()}}function Wa(e){let t=e.windMotion.snowDrift,{intensity:n,angle:r,uy:i}=e.windField,a=t*n*Math.cos(r),o=Math.abs(t)*n*i*.4;for(let t of e.state.flakes){t.y+=t.speed+o,t.x+=Math.sin(e.state.t*.02+t.phase)*(.3+t.size*.08)+t.drift+a,t.rotation+=t.rotationSpeed,t.y-t.drawSize>e.height&&(t.y=-t.drawSize,t.x=Math.random()*e.width,t.phase=Math.random()*Math.PI*2,t.drift=(Math.random()-.5)*.4,t.opacity=.55+Math.random()*.45),t.x>e.width+20&&(t.x=-20),t.x<-20&&(t.x=e.width+20);let n=t.drawSize/2;e.ctx.save(),e.ctx.globalAlpha=t.opacity,e.ctx.translate(t.x,t.y),e.ctx.rotate(t.rotation),e.ctx.drawImage(t.sprite,-n,-n,t.drawSize,t.drawSize),e.ctx.restore()}}function Ga(e){if(e.state.hailstones.length===0)return;let t=e.state.hailPool,n=e.windMotion.hail,r=e.state.t,i=e.windField;for(let a of e.state.hailstones){if(a.delay>0){--a.delay;continue}let o=Ta(r+a.phase*12,e.windMotion,a.x,a.y),s=o.intensity*(.4+.6*i.intensity),c=o.angle*.5+i.angle*.5,l=e.windMotion.snowDrift*.45*s*Math.cos(c),u=Math.abs(e.windMotion.snowDrift)*s*Math.sin(c)*.2,d=a.x,f=a.y;if(a.vy+=a.gravity+u*.02,a.vx+=a.gust*.004*n*s+l+(Math.random()-.5)*.08*n*s,a.x+=a.vx+Math.sin(r*.028+a.phase)*.35,a.y+=a.vy,e.ctx.beginPath(),e.ctx.moveTo(d,f),e.ctx.lineTo(a.x,a.y),e.ctx.strokeStyle=`rgba(225, 239, 250, ${a.opacity*.18})`,e.ctx.lineWidth=a.r*.35,e.ctx.stroke(),a.y+a.r>=e.height)if(a.bounces<a.maxBounces)a.y=e.height-a.r,a.vy*=-(.22+Math.random()*.28),a.vx=a.vx*(.55+Math.random()*.25)+(Math.random()-.5)*1.6,a.bounces+=1;else{Va(a,e.width,e.height,t,!0,e.hailSpec?{min:e.hailSpec.sizeMin,max:e.hailSpec.sizeMax}:void 0,e.hailSpec?.speedMul??1);continue}let p=a.drawSize/2;a.rotation+=a.rotationSpeed,e.ctx.save(),e.ctx.globalAlpha=a.opacity,e.ctx.translate(a.x,a.y),e.ctx.rotate(a.rotation),e.ctx.drawImage(a.sprite,-p,-p,a.drawSize,a.drawSize),e.ctx.restore()}}function Ka(e){e.ctx.fillStyle=e.skyGradient,e.ctx.fillRect(0,0,e.width,e.height)}function qa(e){if(e.state.stars.length===0)return;let t=1;if(e.dayCycle){if(e.dayCycle.isDay)return;t=.35+(1-e.dayCycle.twilight)*.65}else if(!e.activeNight)return;for(let n of e.state.stars){let r=.35+(Math.sin(e.state.t*n.speed+n.phase)+1)*.325;e.ctx.beginPath(),e.ctx.arc(n.x,n.y,n.r,0,Math.PI*2),e.ctx.fillStyle=`rgba(226, 235, 255, ${r*t})`,e.ctx.fill()}}function Ja(e){let t=e.celestial;if(!t)return;let{ctx:n,sunX:r,sunY:i,state:a}=e,o=1+Math.sin(a.t*t.breathSpeed)*t.breathAmp,s=e.dayCycle?di(e.dayCycle):{scale:1,alpha:1},c=t.half*o*s.scale,l=c*2;n.save(),n.globalAlpha=s.alpha,n.drawImage(t.canvas,r-c,i-c,l,l),n.restore()}function Ya(e){if(e.activeNight){qa(e),Ja(e);return}Ja(e)}var Xa={sunny:{sky:[`#4a9fe0`,`#c8e8fb`],sun:`full`,cloudCount:1,cloudColor:[255,255,255],cloudAlpha:.5,cloudSpread:.12,rain:null,fogBanks:0,haze:0,snowCount:0,lightning:!1},partlyCloudy:{sky:[`#5b9bd0`,`#cfe6f3`],sun:`soft`,cloudCount:5,cloudColor:[255,255,255],cloudAlpha:.85,cloudSpread:.22,rain:null,fogBanks:0,haze:0,snowCount:0,lightning:!1},overcast:{sky:[`#8a97a8`,`#c3cbd6`],sun:`none`,cloudCount:9,cloudColor:[100,116,139],cloudAlpha:.55,cloudSpread:.3,rain:null,fogBanks:0,haze:.06,snowCount:0,lightning:!1},rain:{sky:[`#55637a`,`#7e8ba0`],sun:`none`,cloudCount:8,cloudColor:[51,65,85],cloudAlpha:.65,cloudSpread:.26,rain:{count:150,speed:10,wind:-1.5,alpha:.5,splash:!0},fogBanks:0,haze:.06,snowCount:0,lightning:!1},lightRain:{sky:[`#6b7a8f`,`#9aa7b8`],sun:`none`,cloudCount:7,cloudColor:[71,85,105],cloudAlpha:.6,cloudSpread:.24,rain:{count:70,speed:7,wind:-.8,alpha:.4,splash:!1},fogBanks:0,haze:.04,snowCount:0,lightning:!1},moderateRain:{sky:[`#55637a`,`#7e8ba0`],sun:`none`,cloudCount:8,cloudColor:[51,65,85],cloudAlpha:.65,cloudSpread:.26,rain:{count:150,speed:10,wind:-1.5,alpha:.5,splash:!0},fogBanks:0,haze:.06,snowCount:0,lightning:!1},heavyRain:{sky:[`#3d4a5f`,`#5d6a80`],sun:`none`,cloudCount:9,cloudColor:[30,41,59],cloudAlpha:.7,cloudSpread:.3,rain:{count:280,speed:14,wind:-2.8,alpha:.55,splash:!0},fogBanks:0,haze:.1,snowCount:0,lightning:!1},thunderstorm:{sky:[`#252f42`,`#43506a`],sun:`none`,cloudCount:10,cloudColor:[15,23,42],cloudAlpha:.75,cloudSpread:.32,rain:{count:240,speed:13,wind:-2.2,alpha:.55,splash:!0},fogBanks:0,haze:.08,snowCount:0,lightning:!0},fog:{sky:[`#aab4bf`,`#d5dbe1`],sun:`dim`,cloudCount:3,cloudColor:[203,213,225],cloudAlpha:.4,cloudSpread:.2,rain:null,fogBanks:10,haze:.28,snowCount:0,lightning:!1},lightSnow:{sky:[`#aab8c8`,`#e2e8ef`],sun:`none`,cloudCount:5,cloudColor:[166,180,196],cloudAlpha:.45,cloudSpread:.22,rain:null,fogBanks:0,haze:.05,snowCount:70,lightning:!1},moderateSnow:{sky:[`#9fb0c4`,`#dde5ee`],sun:`none`,cloudCount:6,cloudColor:[148,163,184],cloudAlpha:.5,cloudSpread:.24,rain:null,fogBanks:0,haze:.08,snowCount:160,lightning:!1},heavySnow:{sky:[`#8495aa`,`#c7d1dc`],sun:`none`,cloudCount:9,cloudColor:[100,116,139],cloudAlpha:.62,cloudSpread:.3,rain:null,fogBanks:3,haze:.14,snowCount:300,lightning:!1},sleet:{sky:[`#78899e`,`#b8c5d2`],sun:`none`,cloudCount:8,cloudColor:[71,85,105],cloudAlpha:.6,cloudSpread:.28,rain:{count:100,speed:9,wind:-1.4,alpha:.42,splash:!0},fogBanks:0,haze:.09,snowCount:100,lightning:!1},hail:{sky:[`#46566c`,`#77889d`],sun:`none`,cloudCount:9,cloudColor:[30,41,59],cloudAlpha:.68,cloudSpread:.3,rain:{count:80,speed:11,wind:-2.5,alpha:.38,splash:!0},fogBanks:0,haze:.1,snowCount:0,lightning:!1},smog:{sky:[`#8f8b7e`,`#c5bca8`],sun:`dim`,cloudCount:3,cloudColor:[142,136,119],cloudAlpha:.35,cloudSpread:.2,rain:null,fogBanks:12,haze:.34,snowCount:0,lightning:!1},gale:{sky:[`#587087`,`#a6b5c2`],sun:`soft`,cloudCount:8,cloudColor:[203,213,225],cloudAlpha:.72,cloudSpread:.3,rain:null,fogBanks:0,haze:.04,snowCount:0,lightning:!1},snow:{sky:[`#9fb0c4`,`#dde5ee`],sun:`none`,cloudCount:6,cloudColor:[148,163,184],cloudAlpha:.5,cloudSpread:.24,rain:null,fogBanks:0,haze:.08,snowCount:160,lightning:!1}},Za={sunny:{sky:[`#0b1a33`,`#27476e`],stars:110},partlyCloudy:{sky:[`#0f1f38`,`#2c4666`],stars:60},overcast:{sky:[`#181f2a`,`#333e4e`],stars:0},rain:{sky:[`#11161f`,`#242c3a`],stars:0},lightRain:{sky:[`#151b26`,`#2b3442`],stars:0},moderateRain:{sky:[`#11161f`,`#242c3a`],stars:0},heavyRain:{sky:[`#0c1017`,`#1c232e`],stars:0},thunderstorm:{sky:[`#0a0e18`,`#192132`],stars:0},fog:{sky:[`#1c222b`,`#3a434e`],stars:0},snow:{sky:[`#131a26`,`#333f4f`],stars:8},lightSnow:{sky:[`#161e2b`,`#3a4656`],stars:20},moderateSnow:{sky:[`#131a26`,`#333f4f`],stars:8},heavySnow:{sky:[`#101623`,`#2a3545`],stars:0},sleet:{sky:[`#121924`,`#2c3745`],stars:0},hail:{sky:[`#0e141d`,`#26303e`],stars:0},smog:{sky:[`#1a1812`,`#38321f`],stars:0},gale:{sky:[`#101a26`,`#2e3d4d`],stars:30}},Qa=([e,t,n])=>[Math.round(e*.3+18),Math.round(t*.3+24),Math.round(n*.3+42)];function $a(e,t,n,r){let[i,a,o]=n,s=1/0,c=1/0,l=-1/0,u=-1/0;for(let n of t){let t=n.dx*e,r=n.dy*e,i=n.r*e;s=Math.min(s,t-i),c=Math.min(c,r-i),l=Math.max(l,t+i),u=Math.max(u,r+i)}let d=Math.floor(s-2),f=Math.floor(c-2),p=Math.ceil(l+2)-d,m=Math.ceil(u+2)-f,h=document.createElement(`canvas`);h.width=p,h.height=m;let g=h.getContext(`2d`);for(let n of t){let t=n.dx*e-d,s=n.dy*e-f,c=n.r*e,l=g.createRadialGradient(t,s,0,t,s,c);l.addColorStop(0,`rgba(${i}, ${a}, ${o}, ${r})`),l.addColorStop(1,`rgba(${i}, ${a}, ${o}, 0)`),g.beginPath(),g.arc(t,s,c,0,Math.PI*2),g.fillStyle=l,g.fill()}return{sprite:h,ox:d,oy:f}}function eo(e,t,n,r,i){let a=.7+Math.random()*.9,o=4+Math.floor(Math.random()*3),s=Array.from({length:o},(e,t)=>({dx:(t-o/2)*26+(Math.random()-.5)*14,dy:(Math.random()-.5)*14,r:22+Math.random()*20})),{sprite:c,ox:l,oy:u}=$a(a,s,r,i);return{x:Math.random()*(e+240)-120,y:t*.06+Math.random()*t*n,scale:a,speed:.12+Math.random()*.22,puffs:s,sprite:c,ox:l,oy:u}}function to(e,t=120){let n=t*2,r=document.createElement(`canvas`);r.width=n,r.height=n;let i=r.getContext(`2d`),a=i.createRadialGradient(t,t,0,t,t,t);return a.addColorStop(0,`rgba(${e}, 1)`),a.addColorStop(1,`rgba(${e}, 0)`),i.fillStyle=a,i.beginPath(),i.arc(t,t,t,0,Math.PI*2),i.fill(),{canvas:r,baseR:t}}function no(e,t){let n=e.sun;if(n===`none`)return null;let r=n===`full`?1:n===`soft`?.62:.32,i=t*(n===`full`?.72:n===`soft`?.62:.5),a=t*(n===`full`?7.2:n===`soft`?5.2:3.6),o=a;n===`full`&&(o=Math.max(o,1.55*t*5.5)),o=Math.ceil(o+2);let s=o*2,c=document.createElement(`canvas`);c.width=s,c.height=s;let l=c.getContext(`2d`),u=o,d=o;l.save(),l.globalCompositeOperation=`lighter`;let f=l.createRadialGradient(u,d,0,u,d,a);f.addColorStop(0,`rgba(255, 230, 170, ${.14*r})`),f.addColorStop(.22,`rgba(255, 210, 140, ${.07*r})`),f.addColorStop(.5,`rgba(255, 195, 120, ${.03*r})`),f.addColorStop(1,`rgba(255, 200, 130, 0)`),l.fillStyle=f,l.fillRect(0,0,s,s);let p=t*(n===`full`?3.4:2.6),m=l.createRadialGradient(u,d,i*.15,u,d,p);if(m.addColorStop(0,`rgba(255, 240, 200, ${.32*r})`),m.addColorStop(.4,`rgba(255, 220, 150, ${.16*r})`),m.addColorStop(.75,`rgba(255, 200, 120, ${.05*r})`),m.addColorStop(1,`rgba(255, 190, 110, 0)`),l.fillStyle=m,l.beginPath(),l.arc(u,d,p,0,Math.PI*2),l.fill(),n===`full`){l.translate(u,d),l.scale(1.55,.55);let e=l.createRadialGradient(0,0,0,0,0,t*5.5);e.addColorStop(0,`rgba(255, 225, 170, 0.08)`),e.addColorStop(.5,`rgba(255, 205, 140, 0.03)`),e.addColorStop(1,`rgba(255, 195, 130, 0)`),l.fillStyle=e,l.beginPath(),l.arc(0,0,t*5.5,0,Math.PI*2),l.fill()}l.restore();let h=i*2.05,g=l.createRadialGradient(u,d,0,u,d,h);g.addColorStop(0,`rgba(255, 245, 210, ${.7*r})`),g.addColorStop(.4,`rgba(255, 230, 170, ${.35*r})`),g.addColorStop(.75,`rgba(255, 210, 140, ${.1*r})`),g.addColorStop(1,`rgba(255, 200, 130, 0)`),l.fillStyle=g,l.beginPath(),l.arc(u,d,h,0,Math.PI*2),l.fill();let _=l.createRadialGradient(u,d,0,u,d,i);return n===`dim`?(_.addColorStop(0,`rgba(255, 240, 210, ${.5*r})`),_.addColorStop(.55,`rgba(255, 220, 170, ${.3*r})`),_.addColorStop(1,`rgba(255, 200, 140, 0)`)):(_.addColorStop(0,`rgba(255, 250, 230, ${.98*r})`),_.addColorStop(.4,`rgba(255, 240, 195, ${.92*r})`),_.addColorStop(.75,`rgba(255, 220, 150, ${.55*r})`),_.addColorStop(1,`rgba(255, 205, 130, 0)`)),l.fillStyle=_,l.beginPath(),l.arc(u,d,i,0,Math.PI*2),l.fill(),{canvas:c,half:o,breathSpeed:.018,breathAmp:.018}}function ro(e,t,n){if(e.sun===`none`)return null;let r=t*.82,i=e.sun===`dim`,a=i?.45:1,o=r*(i?4.2:6.2),s=Math.ceil(Math.max(o,r*2.6,r*1.35)+2),c=s*2,l=document.createElement(`canvas`);l.width=c,l.height=c;let u=l.getContext(`2d`),d=s,f=s;u.save(),u.globalCompositeOperation=`lighter`;let p=u.createRadialGradient(d,f,0,d,f,o);p.addColorStop(0,`rgba(200, 215, 240, ${.16*a})`),p.addColorStop(.25,`rgba(170, 190, 225, ${.07*a})`),p.addColorStop(.55,`rgba(140, 165, 210, ${.025*a})`),p.addColorStop(1,`rgba(130, 155, 200, 0)`),u.fillStyle=p,u.fillRect(0,0,c,c);let m=r*2.6,h=u.createRadialGradient(d,f,r*.2,d,f,m);h.addColorStop(0,`rgba(230, 236, 248, ${.28*a})`),h.addColorStop(.45,`rgba(190, 205, 230, ${.12*a})`),h.addColorStop(1,`rgba(160, 180, 220, 0)`),u.fillStyle=h,u.beginPath(),u.arc(d,f,m,0,Math.PI*2),u.fill(),u.restore();let g=u.createRadialGradient(d-r*.28,f-r*.3,0,d,f,r);g.addColorStop(0,`rgba(236, 240, 246, ${.96*a})`),g.addColorStop(.45,`rgba(214, 220, 230, ${.94*a})`),g.addColorStop(.82,`rgba(186, 196, 212, ${.9*a})`),g.addColorStop(1,`rgba(160, 172, 192, ${.75*a})`),u.beginPath(),u.arc(d,f,r,0,Math.PI*2),u.fillStyle=g,u.fill(),u.save(),u.beginPath(),u.arc(d,f,r*.98,0,Math.PI*2),u.clip();for(let e of[{dx:-.18,dy:.12,rx:.38,ry:.28,a:.14},{dx:.22,dy:-.08,rx:.26,ry:.2,a:.11},{dx:.05,dy:.32,rx:.2,ry:.14,a:.09}]){let t=d+e.dx*r,n=f+e.dy*r,i=u.createRadialGradient(t,n,0,t,n,e.rx*r);i.addColorStop(0,`rgba(140, 152, 170, ${e.a*a})`),i.addColorStop(.65,`rgba(150, 162, 178, ${e.a*.45*a})`),i.addColorStop(1,`rgba(160, 170, 185, 0)`),u.fillStyle=i,u.beginPath(),u.ellipse(t,n,e.rx*r,e.ry*r,.35,0,Math.PI*2),u.fill()}for(let e of n){let t=d+e.dx*r,n=f+e.dy*r,i=e.r*r,o=u.createRadialGradient(t-i*.25,n-i*.3,0,t,n,i);o.addColorStop(0,`rgba(155, 168, 186, ${.22*a})`),o.addColorStop(.55,`rgba(145, 158, 176, ${.28*a})`),o.addColorStop(.85,`rgba(200, 210, 224, ${.12*a})`),o.addColorStop(1,`rgba(210, 218, 230, 0)`),u.fillStyle=o,u.beginPath(),u.arc(t,n,i,0,Math.PI*2),u.fill()}let _=u.createRadialGradient(d-r*.35,f-r*.38,0,d-r*.1,f-r*.1,r*.7);_.addColorStop(0,`rgba(255, 255, 255, ${.28*a})`),_.addColorStop(.45,`rgba(245, 248, 252, ${.08*a})`),_.addColorStop(1,`rgba(240, 244, 250, 0)`),u.fillStyle=_,u.beginPath(),u.arc(d,f,r,0,Math.PI*2),u.fill(),u.restore();let v=u.createRadialGradient(d,f,r*.72,d,f,r*1.35);return v.addColorStop(0,`rgba(210, 220, 235, 0)`),v.addColorStop(.55,`rgba(200, 212, 232, ${.1*a})`),v.addColorStop(1,`rgba(180, 195, 220, 0)`),u.fillStyle=v,u.beginPath(),u.arc(d,f,r*1.35,0,Math.PI*2),u.fill(),{canvas:l,half:s,breathSpeed:.012,breathAmp:.012}}var io=e=>{let t=Math.ceil(e*2+4),n=document.createElement(`canvas`);n.width=t,n.height=t;let r=n.getContext(`2d`),i=r.createRadialGradient(t/2,t/2,0,t/2,t/2,e+1);return i.addColorStop(0,`rgba(255, 255, 255, 1)`),i.addColorStop(.6,`rgba(255, 255, 255, 0.85)`),i.addColorStop(1,`rgba(255, 255, 255, 0)`),r.fillStyle=i,r.fillRect(0,0,t,t),n},ao=e=>{let t=Math.ceil(e*2+6),n=document.createElement(`canvas`);n.width=t,n.height=t;let r=n.getContext(`2d`);r.translate(t/2,t/2),r.strokeStyle=`rgba(255, 255, 255, 0.95)`,r.lineCap=`round`,r.lineWidth=Math.max(e*.11,.7),r.shadowColor=`rgba(255, 255, 255, 0.5)`,r.shadowBlur=e*.25;let i=1+Math.floor(Math.random()*3),a=Array.from({length:i},()=>({pos:.3+Math.random()*.5,len:e*(.22+Math.random()*.34),angle:Math.PI/3*(.8+Math.random()*.45)})),o=Math.random()<.55,s=e*(.14+Math.random()*.12),c=Math.random()<.45,l=e*(.14+Math.random()*.14);for(let t=0;t<6;t++){r.save(),r.rotate(t*Math.PI/3),r.beginPath(),r.moveTo(0,0),r.lineTo(0,-e);for(let t of a){let n=-e*t.pos;r.moveTo(0,n),r.lineTo(Math.sin(t.angle)*t.len,n-Math.cos(t.angle)*t.len),r.moveTo(0,n),r.lineTo(-Math.sin(t.angle)*t.len,n-Math.cos(t.angle)*t.len)}o&&(r.moveTo(0,-e),r.lineTo(s*.7,-e-s*.5),r.moveTo(0,-e),r.lineTo(-s*.7,-e-s*.5)),r.stroke(),r.restore()}if(c){r.beginPath();for(let e=0;e<6;e++){let t=e*Math.PI/3-Math.PI/2,n=Math.cos(t)*l,i=Math.sin(t)*l;e===0?r.moveTo(n,i):r.lineTo(n,i)}r.closePath(),r.stroke()}return n},oo=()=>({dots:[1.2,1.6,2,2.3].map(e=>io(e)),crystals:[2.6,3.2,3.8,4.4,5].map(e=>ao(e*2.4))}),so=e=>e[Math.floor(Math.random()*e.length)],co=(e,t,n,r)=>{let i=1+Math.random()**1.6*4.2,a=i>=2.4,o=so(a?n.crystals:n.dots),s=a?i*4.8+6:i*2+4;return{x:Math.random()*e,y:r??Math.random()*t,size:i,speed:.4+i*.28+Math.random()*.4,phase:Math.random()*Math.PI*2,drift:(Math.random()-.5)*.4,rotation:Math.random()*Math.PI*2,rotationSpeed:(Math.random()-.5)*.025,opacity:.55+Math.random()*.45,sprite:o,drawSize:s}},lo=(e,t)=>t?e===`smog`?`96, 88, 66`:`138, 150, 168`:e===`smog`?`168, 155, 126`:`226, 232, 238`;function uo(e){let{ctx:t,width:n,height:r,activeWeather:i,dayCycleTimes:a=null,sceneTimeMs:o,liveClock:s=!1,windMotion:c,rainLevel:l=5,snowLevel:u=5,hailLevel:d=2,fogLevel:f=2,smogLevel:p=2}=e,m=Xa[i],h=(()=>{let e=m;return Ui(i)&&e.rain&&(e={...e,rain:Yi(e.rain,l)}),Wi(i)&&(e={...e,snowCount:Xi(u),fogBanks:u>=7?Math.max(e.fogBanks,3):e.fogBanks,haze:u>=7?Math.max(e.haze,.12):e.haze}),gi(i)&&(e=_i(e,f)),ra(i)&&(e=ia(e,p)),e})(),g=Za[i],_=a??null,v=_?ri(s?Date.now():o,_):null,y=v?!v.isDay:!1,b=v?li(h.sky,g.sky,v):y?g.sky:h.sky,x=y?Qa(h.cloudColor):h.cloudColor,S=Math.min(n,r)*.09,C=n*.72,w=r*.26;if(v){let e=ii(n,r,v.arcProgress);C=e.x,w=e.y}let T=ui(t,r,b),E=[{dx:-.32,dy:.08,r:.17},{dx:.24,dy:-.22,r:.12},{dx:.04,dy:.34,r:.1},{dx:.36,dy:.24,r:.07}],D=no(h,S),O=ro(h,S,E),k=y?O:D,A=y||_!=null?Array.from({length:g.stars},()=>({x:Math.random()*n,y:Math.random()*r*.72,r:.4+Math.random()*1.1,phase:Math.random()*Math.PI*2,speed:.015+Math.random()*.035})):[],j=Array.from({length:h.cloudCount},()=>eo(n,r,h.cloudSpread,x,h.cloudAlpha)),M=h.rain?Array.from({length:h.rain.count},()=>({x:Math.random()*(n+160)-80,y:Math.random()*r,len:8+Math.random()*10,speed:h.rain.speed*(.75+Math.random()*.5)})):[],N=[],ee=Array.from({length:h.fogBanks},(e,t)=>({x:Math.random()*n,y:t/Math.max(h.fogBanks-1,1)*r*.9+r*.05,rw:n*(.25+Math.random()*.3),rh:r*(.08+Math.random()*.08),speed:(.1+Math.random()*.25)*(t%2==0?1:-1),alpha:(.1+Math.random()*.1)*(gi(i)?vi(f):ra(i)?aa(p):1)})),te=h.fogBanks>0?to(lo(i,y)):null,ne=h.snowCount>0?oo():null,re=ne==null?[]:Array.from({length:h.snowCount},()=>co(n,r,ne)),P=Ti(i)?Ei(d):null,ie=P==null?null:za(),ae=ie!=null&&P!=null?Array.from({length:P.count},()=>Ha(n,r,ie,{min:P.sizeMin,max:P.sizeMax},P.speedMul)):[],oe=(()=>{let{count:e}=Ea(c.visualLevel);return e<=0?[]:Array.from({length:e},()=>({x:Math.random()*n,y:Math.random()*r,length:35+Math.random()*120,speed:6+Math.random()*10,wave:Math.random()*Math.PI*2,alpha:.1+Math.random()*.28,width:.5+Math.random()*1.1,phase:Math.random()*Math.PI*2}))})(),F=[],se=120+Math.random()*240;return{sky:b,cloudRgb:x,cfg:h,sunX:C,sunY:w,sunR:S,skyGradient:T,celestial:k,sunSprite:D,moonSprite:O,fogSprite:te,dayCycleTimes:_,dayCycle:v,sceneTimeMs:o,liveClock:s,hailSpec:P,state:{stars:A,moonCraters:E,clouds:j,drops:M,splashes:N,fogBanks:ee,flakes:re,hailstones:ae,hailPool:ie??[],windStreaks:oe,t:0,flashAlpha:0,boltLife:0,boltPoints:F,nextStrike:se}}}function fo(e,t){if(!e.dayCycleTimes)return;let n=ri(e.liveClock?t??Date.now():e.sceneTimeMs,e.dayCycleTimes),r=Za[e.activeWeather],i=li(e.cfg.sky,r.sky,n),a=ii(e.width,e.height,n.arcProgress);e.dayCycle=n,e.activeNight=!n.isDay,e.sky=i,e.skyGradient=ui(e.ctx,e.height,i),e.sunX=a.x,e.sunY=a.y,e.celestial=n.isDay?e.sunSprite:e.moonSprite}function po(e,t){t&&(e.state.t+=1),e.windField=Ta(e.state.t,e.windMotion),e.dayCycleTimes&&fo(e,e.liveClock?Date.now():e.sceneTimeMs),Ka(e),Ya(e),ja(e),Ma(e),Na(e),Ua(e),Wa(e),Ga(e),Fa(e),Ia(e)}function mo(e){let{ctx:t,width:n,height:r,activeWeather:i,activeNight:a,windMotion:o}=e,s=uo(e),c={ctx:t,width:n,height:r,activeWeather:i,activeNight:s.dayCycle?!s.dayCycle.isDay:a,windMotion:o,windField:Ta(0,o),...s};if(c.dayCycleTimes&&fo(c,c.liveClock?Date.now():c.sceneTimeMs),typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return po(c,!1),()=>void 0;let l=0,u=document.hidden,d=y(e=>{u=e}),f=()=>{l=requestAnimationFrame(f),!u&&po(c,!0)};return f(),()=>{cancelAnimationFrame(l),d()}}var ho={weatherBackground:`cos-weatherBackground-Mnm22`,canvas:`cos-canvas-nvqMt`,loadingOverlay:`cos-loadingOverlay-O58B7`,loadingSpinner:`cos-loadingSpinner-NQ9yG`,"weather-loading-spin":`cos-weather-loading-spin-IPFWZ`},go=({width:e=800,height:t=450,weather:n=`partlyCloudy`,time:r=`14:00`,live:i=!1,latitude:a,longitude:o,windLevel:s=3,rainLevel:u=5,snowLevel:d=5,hailLevel:f=2,fogLevel:p=2,smogLevel:m=2,onLiveWeather:h,loading:g=!1})=>{let _=(0,c.useRef)(null),v=ga(i,a!=null&&o!=null?{latitude:a,longitude:o}:void 0),y=Bi(i&&v.weather?v.weather:n),b=i&&v.rainLevel!=null?v.rainLevel:u,x=i&&v.snowLevel!=null?v.snowLevel:d,S=i&&v.fogLevel!=null?v.fogLevel:p,C=i&&v.hailLevel!=null?v.hailLevel:f,w=i&&v.smogLevel!=null?v.smogLevel:m,T=Ji(y,b,x),E=ni(r),D=v.current?.sunrise??null,O=v.current?.sunset??null,k=v.current?.windSpeed??null,A=(0,c.useMemo)(()=>i&&D!=null&&O!=null?{sunrise:D,sunset:O}:ei(E),[i,D,O,E]),j=Aa({live:i,windLevel:s,liveWindKmh:k}),M=(0,c.useMemo)(()=>ka(j),[j]),N=i&&v.current?!v.current.isDay:!ri(E,A).isDay,ee=g||i&&(v.status===`locating`||v.status===`fetching`),te=(0,c.useRef)(h);return(0,c.useEffect)(()=>{te.current=h}),(0,c.useEffect)(()=>{v.weather&&te.current?.(Bi(v.weather))},[v.weather]),(0,c.useEffect)(()=>{let n=_.current;if(!n)return;let r=window.devicePixelRatio||1;n.width=e*r,n.height=t*r;let a=n.getContext(`2d`);if(a)return a.setTransform(r,0,0,r,0,0),mo({ctx:a,width:e,height:t,activeWeather:T,activeNight:N,dayCycleTimes:A,sceneTimeMs:E,liveClock:i,windMotion:M,rainLevel:b,snowLevel:x,fogLevel:S,hailLevel:C,smogLevel:w})},[N,T,A,b,x,S,C,w,t,i,E,e,M]),(0,l.jsxs)(`div`,{className:ho.weatherBackground,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:_,className:ho.canvas,style:{width:e,height:t},role:`img`,"aria-label":`天气背景:${y}${N?`(夜间)`:``},${M.level}级风`}),ee&&(0,l.jsxs)(`div`,{className:ho.loadingOverlay,role:`status`,"aria-live":`polite`,children:[(0,l.jsx)(`div`,{className:ho.loadingSpinner,"aria-hidden":!0}),(0,l.jsx)(`span`,{children:`天气加载中…`})]})]})},_o={waveText:`cos-waveText-Zy2Tp`,text:`cos-text-el-KR`,char:`cos-char-Y9-mV`,wave:`cos-wave-jVRCz`},vo=({text:e=`WAVE`,amplitude:t=12,color:n=`#38bdf8`,fontSize:r=56})=>(0,l.jsx)(`div`,{className:_o.waveText,children:(0,l.jsx)(`h1`,{className:_o.text,style:{fontSize:r,"--wave-color":n,"--wave-amp":`${t}px`},children:e.split(``).map((e,t)=>(0,l.jsx)(`span`,{className:_o.char,style:{animationDelay:`${t*.1}s`},children:e===` `?`\xA0`:e},`${e}-${t}`))})});exports.AudioVisualizer=S,exports.Aurora=v,exports.BarcodeScan=d,exports.BlurText=p,exports.BubbleField=Mn,exports.BurnAway=h,exports.CanvasClock=w,exports.Charge=O,exports.CircularText=A,exports.ClickSpark=M,exports.Confetti=re,exports.CountUp=pe,exports.Countdown=ue,exports.CursorTrail=be,exports.CurvedLoop=ie,exports.CyberGrid=oe,exports.DEFAULT_FOG_LEVEL=fi,exports.DEFAULT_HAIL_LEVEL=xi,exports.DEFAULT_RAIN_LEVEL=Ai,exports.DEFAULT_SMOG_LEVEL=$i,exports.DEFAULT_SNOW_LEVEL=ji,exports.DEFAULT_WIND_LEVEL=ya,exports.DiceRoll=Se,exports.DnaHelix=he,exports.DoublePendulum=we,exports.ElectricArc=ve,exports.FOG_LEVEL_LABELS=pi,exports.Fireworks=je,exports.FlipCounter=Pe,exports.FuzzyText=Ie,exports.GameOfLife=Ue,exports.GlitchText=Ge,exports.GradientFlow=ze,exports.GravityBalls=Je,exports.HAIL_LEVEL_LABELS=Si,exports.HolographicCard=Xe,exports.LiquidGlass=nt,exports.LiquidProgress=Qe,exports.LorenzAttractor=et,exports.MAX_PRECIP_LEVEL=ki,exports.MIN_PRECIP_LEVEL=Oi,exports.MagneticButton=it,exports.MatrixRain=st,exports.MazeGenerator=dt,exports.MetaballPool=lt,exports.MeteorRain=pt,exports.NeonText=St,exports.NetworkGraph=bt,exports.NewtonCradle=wt,exports.OrbitalChart=Dt,exports.ParticleNetwork=kt,exports.PlasmaBall=jt,exports.ProgressChest=Bn,exports.RAIN_LEVEL_LABELS=Ri,exports.RadarScan=Hn,exports.RedPacketRain=Wn,exports.ReturnCity=Kn,exports.RippleWater=ur,exports.RopeChain=Jn,exports.RotatingText=Qn,exports.SMOG_LEVEL_LABELS=ea,exports.SNOW_LEVEL_LABELS=zi,exports.SandFall=Sr,exports.ScrambleText=pr,exports.ScratchCard=hr,exports.ShinyText=tr,exports.SlotMachine=vr,exports.SmokeFog=Yt,exports.Snowfall=Ln,exports.SolarSystem=Fn,exports.Speedometer=$n,exports.SplitReveal=Tr,exports.SplitText=Dr,exports.Spotlight=Mr,exports.SpringMass=Ar,exports.Starfield=zn,exports.TextMorph=Vr,exports.TimelinePulse=nr,exports.TrueFocus=Hr,exports.Turntable=Lr,exports.Typewriter=Kr,exports.WaveButton=Jr,exports.WaveText=vo,exports.WeatherBackground=go,exports.buildWindMotion=ka,exports.clampFogLevel=mi,exports.clampHailLevel=Ci,exports.clampPrecipLevel=$,exports.clampSmogLevel=ta,exports.fogBankAlphaScale=vi,exports.fogLevelFromVisibility=bi,exports.fogLevelFromWmo=yi,exports.formatFogLevel=hi,exports.formatHailLevel=wi,exports.formatLocalHm=ha,exports.formatPrecipLevel=Li,exports.formatSmogLevel=na,exports.hailLevelFromWmo=Di,exports.hailSpec=Ei,exports.intensifyFogConfig=_i,exports.intensifyRainConfig=Yi,exports.intensifySmogConfig=ia,exports.intensifySnowCount=Xi,exports.isRainWeather=Vi,exports.isSnowWeather=Hi,exports.kmhToWindLevel=Oa,exports.mapWmoCodeToWeatherType=ca,exports.normalizeWeatherType=Bi,exports.precipBand=Ni,exports.precipLabel=Ii,exports.rainLevelFromWeather=Gi,exports.rainLevelFromWmo=Zi,exports.resolveSceneWeather=Ji,exports.sampleWindField=Ta,exports.smogBankAlphaScale=aa,exports.smogLevelFromVisibility=oa,exports.snowLevelFromWeather=Ki,exports.snowLevelFromWmo=Qi,exports.supportsFogLevel=gi,exports.supportsHailLevel=Ti,exports.supportsRainLevel=Ui,exports.supportsSmogLevel=ra,exports.supportsSnowLevel=Wi,exports.useLiveWeather=ga,exports.useSunTimes=va,exports.visualWindLevel=xa,exports.windLevelToKmh=Da,exports.windStreakSpec=Ea;
|