cos-design 3.7.2 → 3.7.3
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 +39 -0
- package/README.md +37 -16
- package/dist/index.cjs +3 -3
- package/dist/index.css +1 -1
- package/dist/index.js +5425 -2680
- package/dist/src/components/index.d.ts +22 -0
- package/dist/src/components/photoCarousel/index.d.ts +9 -0
- package/dist/src/components/photoCarousel/types.d.ts +47 -0
- package/dist/src/components/photoClothesline/constants.d.ts +44 -0
- package/dist/src/components/photoClothesline/layout.d.ts +23 -0
- package/dist/src/components/photoClothesline/math.d.ts +6 -0
- package/dist/src/components/photoClothesline/model.d.ts +110 -0
- package/dist/src/components/photoClothesline/ropePath.d.ts +5 -0
- package/dist/src/components/photoClothesline/simulation.d.ts +46 -0
- package/dist/src/components/photoFilmstrip/index.d.ts +5 -0
- package/dist/src/components/photoFilmstrip/types.d.ts +43 -0
- package/dist/src/components/photoFridge/index.d.ts +5 -0
- package/dist/src/components/photoFridge/types.d.ts +41 -0
- package/dist/src/components/photoLantern/accessories.d.ts +4 -0
- package/dist/src/components/photoLantern/constants.d.ts +5 -0
- package/dist/src/components/photoLantern/dispose.d.ts +4 -0
- package/dist/src/components/photoLantern/geometry.d.ts +5 -0
- package/dist/src/components/photoLantern/index.d.ts +5 -0
- package/dist/src/components/photoLantern/materials.d.ts +9 -0
- package/dist/src/components/photoLantern/scene.d.ts +32 -0
- package/dist/src/components/photoLantern/textures.d.ts +9 -0
- package/dist/src/components/photoLantern/types.d.ts +59 -0
- package/dist/src/components/photoLightbox/index.d.ts +5 -0
- package/dist/src/components/photoLightbox/types.d.ts +39 -0
- package/dist/src/components/photoPolaroid/index.d.ts +5 -0
- package/dist/src/components/photoPolaroid/types.d.ts +39 -0
- package/dist/src/components/photoPostcard/index.d.ts +8 -0
- package/dist/src/components/photoPostcard/types.d.ts +45 -0
- package/dist/src/components/photoPrism/index.d.ts +9 -0
- package/dist/src/components/photoPrism/types.d.ts +39 -0
- package/dist/src/components/photoScroll/index.d.ts +9 -0
- package/dist/src/components/photoScroll/types.d.ts +43 -0
- package/dist/src/components/photoTunnel/index.d.ts +9 -0
- package/dist/src/components/photoTunnel/types.d.ts +43 -0
- package/dist/src/components/photoViewMaster/index.d.ts +9 -0
- package/dist/src/components/photoViewMaster/types.d.ts +47 -0
- package/dist/src/components/slotMachine/index.d.ts +2 -0
- package/package.json +3 -2
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={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,completedText:r=`Gone.`})=>{let i=(0,c.useRef)(null),a=(0,c.useRef)(null),[o,s]=(0,c.useState)(!1),[u,d]=(0,c.useState)(!1),f=(0,c.useRef)(!1),p=(0,c.useRef)(n);(0,c.useEffect)(()=>{p.current=n},[n]);let h=(0,c.useCallback)(()=>{o||u||s(!0)},[o,u]);return(0,c.useEffect)(()=>{if(!o||u)return;let n=i.current,r=a.current;if(!n||!r)return;let s=n.getBoundingClientRect(),c=window.devicePixelRatio||1,l=Math.ceil(s.width),m=Math.ceil(s.height);r.width=l*c,r.height=m*c,r.style.width=`${l}px`,r.style.height=`${m}px`;let h=r.getContext(`2d`);if(!h)return;h.scale(c,c);let g=document.createElement(`canvas`);g.width=l*c,g.height=m*c;let _=g.getContext(`2d`);if(!_)return;_.scale(c,c),_.font=`900 ${t}px system-ui, sans-serif`,_.textAlign=`center`,_.textBaseline=`middle`,_.fillStyle=`#f8fafc`,_.fillText(e,l/2,m/2);let v=_.getImageData(0,0,l*c,m*c).data,y=[];for(let e=0;e<m;e+=4)for(let t=0;t<l;t+=4)v[(Math.floor(e*c)*l*c+Math.floor(t*c))*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,l,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||(d(!0),f.current||(f.current=!0,p.current?.()))};return b=requestAnimationFrame(e=>C(e,e)),()=>{S=!0,cancelAnimationFrame(b)}},[o,u,e,t]),(0,l.jsxs)(`div`,{className:m.burnAway,children:[(0,l.jsxs)(`div`,{ref:i,className:m.stage,children:[!u&&(0,l.jsx)(`span`,{className:m.text,style:{fontSize:t,opacity:+!o},children:e}),(0,l.jsx)(`canvas`,{ref:a,className:m.canvas})]}),!o&&!u&&(0,l.jsx)(`button`,{type:`button`,className:m.trigger,onClick:h,children:`Ignite`}),u&&(0,l.jsx)(`p`,{className:m.hint,children:r})]})},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`},P=[`#ff6b6b`,`#ffd93d`,`#6bcb77`,`#4d96ff`,`#a66cff`,`#ff85c0`,`#38bdf8`],F=()=>P[Math.floor(Math.random()*P.length)],I=(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:F(),width:Math.random()*8+4,height:Math.random()*6+3,alpha:1,gravity:Math.random()*.15+.12}})},ee=(0,c.forwardRef)(({width:e=800,height:t=400,auto:n=!0,particleCount:r=120,hint:i=`点击画布再次喷射`},a)=>{let o=(0,c.useRef)(null),s=(0,c.useRef)([]),u=(0,c.useRef)(0),d=(0,c.useRef)({width:e,height:t,particleCount:r});d.current={width:e,height:t,particleCount:r};let f=(0,c.useCallback)(()=>{let{width:e,height:t,particleCount:n}=d.current;s.current.push(...I(e,t,n))},[]);return(0,c.useImperativeHandle)(a,()=>({burst:f}),[f]),(0,c.useEffect)(()=>{n&&f()},[n,f]),(0,c.useEffect)(()=>{let n=o.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 a=document.hidden,c=y(e=>{a=e}),l=()=>{u.current=requestAnimationFrame(l),!a&&(i.clearRect(0,0,e,t),s.current=s.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 l(),()=>{cancelAnimationFrame(u.current),c()}},[t,e]),(0,l.jsxs)(`div`,{className:N.confetti,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:o,className:N.canvas,style:{width:e,height:t},onClick:f}),(0,l.jsx)(`p`,{className:N.hint,children:i})]})});ee.displayName=`Confetti`;var L={curvedLoop:`cos-curvedLoop-dtMD7`,svg:`cos-svg-YDyYF`,measure:`cos-measure-1lmnX`,pathText:`cos-pathText-SKIrW`},te=({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:L.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:L.svg,viewBox:`0 0 1440 120`,children:[(0,l.jsx)(`text`,{ref:u,xmlSpace:`preserve`,className:L.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:L.pathText,children:(0,l.jsx)(`textPath`,{ref:d,href:`#${g}`,startOffset:`${m}px`,xmlSpace:`preserve`,children:S})})]})})},ne={cyberGrid:`cos-cyberGrid-VgJwl`,canvas:`cos-canvas--Mq-O`},re=({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:ne.cyberGrid,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:ne.canvas,style:{width:e,height:t}})})},R={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`},ie=e=>e instanceof Date?e.getTime():typeof e==`number`?e:new Date(e).getTime(),z=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}},B={days:`天`,hours:`时`,minutes:`分`,seconds:`秒`},ae=[{key:`days`},{key:`hours`},{key:`minutes`},{key:`seconds`}],oe=({targetDate:e,onEnd:t,showLabels:n=!0,color:r=`#f472b6`,labels:i,invalidText:a=`无效的目标时间`,endedText:o=`时间到!`})=>{let s=(0,c.useMemo)(()=>ie(e),[e]),u=!Number.isNaN(s),[,d]=(0,c.useState)(0),f=(0,c.useRef)(!1),p=(0,c.useRef)(t),m=u?z(s):{days:0,hours:0,minutes:0,seconds:0,total:0};return(0,c.useEffect)(()=>{p.current=t},[t]),(0,c.useEffect)(()=>{if(!u)return;if(f.current=!1,Date.now()>=s){f.current=!0,p.current?.();return}let e=window.setInterval(()=>{d(e=>e+1),Date.now()>=s&&!f.current&&(f.current=!0,p.current?.(),clearInterval(e))},1e3);return()=>clearInterval(e)},[u,s]),u?(0,l.jsxs)(`div`,{className:R.countdown,style:{"--countdown-color":r},children:[ae.map(({key:e})=>(0,l.jsxs)(`div`,{className:R.unit,children:[(0,l.jsx)(`div`,{className:R.value,children:String(m[e]).padStart(2,`0`)}),n&&(0,l.jsx)(`span`,{className:R.label,children:i?.[e]??B[e]})]},e)),m.total<=0&&(0,l.jsx)(`p`,{className:R.ended,children:o})]}):(0,l.jsx)(`div`,{className:R.countdown,children:(0,l.jsx)(`p`,{className:R.invalid,children:a})})},V={countUp:`cos-countUp-PKMgo`,glow:`cos-glow-oAz5z`,value:`cos-value-WDAyV`,valueWrap:`cos-valueWrap-AQoM4`,measure:`cos-measure-ZGRt4`,display:`cos-display-JHXA2`},se=e=>1-(1-e)**3,ce=(e,t)=>e.toLocaleString(`en-US`,{minimumFractionDigits:t,maximumFractionDigits:t}),le=({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=se(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}${ce(s,r)}${a}`,[r,s,i,a]),m=(0,c.useMemo)(()=>{let n=[t,e].map(e=>`${i}${ce(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:V.countUp,style:{"--count-up-color":o},children:[(0,l.jsx)(`div`,{className:V.glow}),(0,l.jsxs)(`div`,{className:V.valueWrap,children:[(0,l.jsx)(`span`,{className:`${V.value} ${V.measure}`,children:m}),(0,l.jsx)(`span`,{className:`${V.value} ${V.display}`,children:p})]})]})},ue={dnaHelix:`cos-dnaHelix-nEQLW`,canvas:`cos-canvas-uEV8B`},de=({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:ue.dnaHelix,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:ue.canvas,style:{width:e,height:t}})})},fe={electricArc:`cos-electricArc-BFlY3`,canvas:`cos-canvas-iowDx`},H=(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=H(e,t,o+f,s+p,i*.6,a-1),h=H(o+f,s+p,n,r,i*.6,a-1);return[...m.slice(0,-1),...h]},pe=({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=H(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:fe.electricArc,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:r,className:fe.canvas,style:{width:e,height:t}})})},U={cursorTrail:`cos-cursorTrail-fpz5p`,canvas:`cos-canvas-Iuyp3`,hint:`cos-hint-9GLHx`},me=({color:e=`#38bdf8`,length:t=20,width:n=800,height:r=400,hint:i=`移动鼠标查看粒子轨迹`})=>{let a=(0,c.useRef)(null),o=(0,c.useRef)([]),s=(0,c.useRef)({x:n/2,y:r/2}),u=(0,c.useRef)(0);return(0,c.useEffect)(()=>{let i=a.current;if(!i)return;let c=window.devicePixelRatio||1;i.width=n*c,i.height=r*c;let l=i.getContext(`2d`);if(!l)return;l.setTransform(c,0,0,c,0,0);let d=document.hidden,f=y(e=>{d=e}),p=()=>{if(u.current=requestAnimationFrame(p),d)return;let{x:i,y:a}=s.current;o.current.unshift({x:i,y:a,life:1}),o.current.length>t&&(o.current.length=t),l.fillStyle=`rgb(15 23 42 / 15%)`,l.fillRect(0,0,n,r);let c=o.current;for(let t=0;t<c.length;t++){let n=c[t],r=1-t/c.length,i=(1-t/c.length)*8+2;l.beginPath(),l.arc(n.x,n.y,i,0,Math.PI*2),l.fillStyle=e,l.globalAlpha=r*.8,l.fill()}l.globalAlpha=1};return p(),()=>{cancelAnimationFrame(u.current),f()}},[e,r,t,n]),(0,l.jsxs)(`div`,{className:U.cursorTrail,style:{width:n,height:r},children:[(0,l.jsx)(`canvas`,{ref:a,className:U.canvas,style:{width:n,height:r},onMouseMove:e=>{let t=e.currentTarget.getBoundingClientRect();s.current={x:e.clientX-t.left,y:e.clientY-t.top}}}),(0,l.jsx)(`p`,{className:U.hint,children:i})]})},W={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`},he={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}},ge=({onRoll:e,sides:t=6,rollText:n=`掷骰子`,rollingText:r=`掷骰中...`,resultPrefix:i=`点数:`})=>{let[a,o]=(0,c.useState)(!1),[s,u]=(0,c.useState)(1),[d,f]=(0,c.useState)({x:0,y:0,z:0}),p=(0,c.useRef)(e),m=(0,c.useRef)(0);(0,c.useEffect)(()=>{p.current=e},[e]),(0,c.useEffect)(()=>()=>clearTimeout(m.current),[]);let h=()=>{if(a)return;o(!0);let e=Math.floor(Math.random()*t)+1,n=he[e]??he[1],r=360*(3+Math.floor(Math.random()*3)),i=360*(3+Math.floor(Math.random()*3));f({x:n.x+r,y:n.y+i,z:Math.random()*360}),clearTimeout(m.current),m.current=window.setTimeout(()=>{u(e),o(!1),p.current?.(e)},1200)},g=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:W.dot,style:{left:`${e}%`,top:`${t}%`}},n));return(0,l.jsxs)(`div`,{className:W.diceRoll,children:[(0,l.jsx)(`div`,{className:W.scene,children:(0,l.jsx)(`div`,{className:`${W.cube} ${a?W.rolling:``}`,style:{transform:`rotateX(${d.x}deg) rotateY(${d.y}deg) rotateZ(${d.z}deg)`},children:[1,2,3,4,5,6].map(e=>(0,l.jsx)(`div`,{className:`${W.face} ${W[`face${e}`]}`,children:g(e)},e))})}),(0,l.jsx)(`button`,{type:`button`,className:W.rollBtn,onClick:h,disabled:a,children:a?r:n}),!a&&(0,l.jsxs)(`p`,{className:W.result,children:[i,` `,s]})]})},G={doublePendulum:`cos-doublePendulum-FUEeK`,canvas:`cos-canvas-OVkhW`},_e=({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:G.doublePendulum,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:a,className:G.canvas,style:{width:e,height:t}})})},ve={fireworks:`cos-fireworks-fsSqL`,canvas:`cos-canvas-spL8G`,hint:`cos-hint-5XDRH`},ye=[`#ff6b6b`,`#ffd93d`,`#6bcb77`,`#4d96ff`,`#a66cff`,`#ff85c0`],be=.12,xe=240,Se=()=>ye[Math.floor(Math.random()*ye.length)],Ce=(e,t,n)=>{let r=60+Math.floor(Math.random()*30);return Array.from({length:r},()=>{let r=Math.random()*Math.PI*2,i=Math.random()*4+2;return{x:e,y:t,vx:Math.cos(r)*i,vy:Math.sin(r)*i,alpha:1,color:Math.random()>.3?n:Se(),decay:Math.random()*.015+.01}})},K=(0,c.forwardRef)((e,t)=>{let{width:n=800,height:r=500,auto:i=!0,hint:a=`点击画布燃放烟花`}=e,o=(0,c.useRef)(null),s=(0,c.useRef)([]),u=(0,c.useRef)(0),d=(0,c.useCallback)(e=>{let t=e??Math.random()*n*.6+n*.2;s.current.push({x:t,y:r,vy:-(Math.random()*4+6),targetY:Math.random()*r*.35+r*.15,color:Se(),exploded:!1,particles:[],age:0})},[r,n]);return(0,c.useImperativeHandle)(t,()=>({launch:d}),[d]),(0,c.useEffect)(()=>{let e=o.current;if(!e)return;let t=window.devicePixelRatio||1;e.width=n*t,e.height=r*t;let a=e.getContext(`2d`);if(!a)return;a.setTransform(t,0,0,t,0,0);let c=0,l=document.hidden,f=y(e=>{l=e}),p=()=>{u.current=requestAnimationFrame(p),!l&&(a.fillStyle=`rgb(15 23 42 / 25%)`,a.fillRect(0,0,n,r),s.current=s.current.filter(e=>{if(!e.exploded){e.age+=1,e.y+=e.vy,e.vy+=be,a.beginPath(),a.arc(e.x,e.y,2.5,0,Math.PI*2),a.fillStyle=e.color,a.fill();let t=e.vy>=0,n=e.y<=e.targetY,r=e.y<0,i=e.age>=xe;return(t||n||r||i)&&(e.exploded=!0,e.particles=Ce(e.x,e.y,e.color)),!0}return e.particles=e.particles.filter(e=>(e.x+=e.vx,e.y+=e.vy,e.vy+=.06,e.alpha-=e.decay,e.alpha<=0?!1:(a.beginPath(),a.arc(e.x,e.y,2,0,Math.PI*2),a.fillStyle=e.color,a.globalAlpha=e.alpha,a.fill(),a.globalAlpha=1,!0))),e.particles.length>0}))};return p(),i&&(c=window.setInterval(()=>d(),1200)),()=>{cancelAnimationFrame(u.current),clearInterval(c),f()}},[i,r,d,n]),(0,l.jsxs)(`div`,{className:ve.fireworks,style:{width:n,height:r},children:[(0,l.jsx)(`canvas`,{ref:o,className:ve.canvas,style:{width:n,height:r},onClick:e=>{let t=e.currentTarget.getBoundingClientRect();d(e.clientX-t.left)}}),(0,l.jsx)(`p`,{className:ve.hint,children:a})]})});K.displayName=`Fireworks`;var q={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`},we=(e,t)=>Math.max(0,Math.floor(e)).toString().padStart(t,`0`).slice(-t),Te=({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:q.digit,style:{"--flip-color":t,"--flip-duration":`${n}ms`},children:(0,l.jsxs)(`div`,{className:`${q.digitCard} ${i?q.isFlipping:``}`,children:[(0,l.jsx)(`div`,{className:q.staticTop,children:(0,l.jsx)(`span`,{children:u})}),(0,l.jsx)(`div`,{className:q.staticBottom,children:(0,l.jsx)(`span`,{children:u})}),i&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`div`,{className:`${q.flap} ${q.flapTop}`,children:(0,l.jsx)(`span`,{children:o})}),(0,l.jsx)(`div`,{className:`${q.flap} ${q.flapBottom}`,children:(0,l.jsx)(`span`,{children:e})})]})]})})},Ee=({value:e,digits:t=4,color:n=`#38bdf8`,duration:r=600})=>{let i=we(e,t).split(``);return(0,l.jsx)(`div`,{className:q.flipCounter,children:i.map((e,t)=>(0,l.jsx)(Te,{digit:e,color:n,duration:r},t))})},De={fuzzyText:`cos-fuzzyText-AgND-`,canvas:`cos-canvas-CiG0H`},Oe=({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:De.fuzzyText,children:(0,l.jsx)(`canvas`,{ref:u,className:De.canvas})})},ke={gradientFlow:`cos-gradientFlow-XhN16`,text:`cos-text-ORuqk`,flow:`cos-flow-9FzMA`},Ae=[`#ff00de`,`#7c3aed`,`#00f0ff`,`#38bdf8`,`#ff00de`],je=({text:e=`GRADIENT`,colors:t=Ae,fontSize:n=64})=>{let r=t.length>=2?t.join(`, `):Ae.join(`, `);return(0,l.jsx)(`div`,{className:ke.gradientFlow,children:(0,l.jsx)(`h1`,{className:ke.text,style:{fontSize:n,backgroundImage:`linear-gradient(90deg, ${r})`},children:e})})},Me={gameOfLife:`cos-gameOfLife-1i2nu`,canvas:`cos-canvas-urOjh`,toolbar:`cos-toolbar-GmcD1`,meta:`cos-meta-KLxCp`,actions:`cos-actions-l3sAu`,button:`cos-button-g0tCm`},Ne=(e,t,n)=>Math.min(n,Math.max(t,e)),Pe=(e,t,n)=>Array.from({length:e},()=>Array.from({length:t},()=>+(Math.random()<n))),Fe=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},Ie=({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%)`,labels:s})=>{let u=(0,c.useRef)(null),d=Math.max(6,Math.floor(t/n)),f=Math.max(6,Math.floor(e/n)),p=Ne(i,.05,.7),[m,h]=(0,c.useState)(!0),[g,_]=(0,c.useState)(0),v=(0,c.useRef)(document.hidden),[b,x]=(0,c.useState)(()=>Pe(d,f,p)),[S,C]=(0,c.useState)({rows:d,cols:f,density:p});(S.rows!==d||S.cols!==f||S.density!==p)&&(C({rows:d,cols:f,density:p}),x(Pe(d,f,p)),_(0)),(0,c.useEffect)(()=>{let r=u.current;if(!r)return;let i=window.devicePixelRatio||1;r.width=e*i,r.height=t*i;let s=r.getContext(`2d`);if(!s)return;s.setTransform(i,0,0,i,0,0);let c=0,l=y(e=>{v.current=e}),p=()=>{s.fillStyle=`#020617`,s.fillRect(0,0,e,t);for(let e=0;e<d;e++)for(let t=0;t<f;t++){if(!b[e][t])continue;let r=t*n,i=e*n;s.fillStyle=a,s.fillRect(r+1,i+1,n-2,n-2);let o=s.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`),s.fillStyle=o,s.fillRect(r,i,n,n)}s.strokeStyle=o,s.lineWidth=1;for(let e=0;e<=f;e++)s.beginPath(),s.moveTo(e*n+.5,0),s.lineTo(e*n+.5,t),s.stroke();for(let t=0;t<=d;t++)s.beginPath(),s.moveTo(0,t*n+.5),s.lineTo(e,t*n+.5),s.stroke()},m=()=>{c=requestAnimationFrame(m),p()};return c=requestAnimationFrame(m),()=>{cancelAnimationFrame(c),l()}},[a,n,f,b,o,t,d,e]),(0,c.useEffect)(()=>{if(!m)return;let e=window.setInterval(()=>{v.current||(x(e=>Fe(e)),_(e=>e+1))},r);return()=>clearInterval(e)},[m,r]);let w=(0,c.useMemo)(()=>b.reduce((e,t)=>e+t.reduce((e,t)=>e+t,0),0),[b]),T=()=>{x(Pe(d,f,p)),_(0)},E=(e,t,r)=>{let i=Math.floor((e-r.left)/n),a=Math.floor((t-r.top)/n);a<0||a>=d||i<0||i>=f||(x(e=>e.map((e,t)=>t===a?e.map((e,t)=>t===i?+!e:e):e)),_(e=>e+1))};return(0,l.jsxs)(`div`,{className:Me.gameOfLife,style:{width:e},children:[(0,l.jsx)(`canvas`,{ref:u,className:Me.canvas,style:{width:e,height:t},onClick:e=>E(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect())}),(0,l.jsxs)(`div`,{className:Me.toolbar,children:[(0,l.jsxs)(`div`,{className:Me.meta,children:[(0,l.jsxs)(`span`,{children:[s?.generation??`Generation`,` `,g]}),(0,l.jsxs)(`span`,{children:[w,` `,s?.alive??`alive`]})]}),(0,l.jsxs)(`div`,{className:Me.actions,children:[(0,l.jsx)(`button`,{type:`button`,className:Me.button,onClick:()=>h(e=>!e),children:m?s?.pause??`Pause`:s?.play??`Play`}),(0,l.jsx)(`button`,{type:`button`,className:Me.button,onClick:T,children:s?.randomize??`Randomize`})]})]})]})},Le={glitchText:`cos-glitchText-dZ-sR`,text:`cos-text-JsPHN`,"glitch-1":`cos-glitch-1-s9pqH`,"glitch-2":`cos-glitch-2-GhFB-`},Re=({text:e=`GLITCH`,color:t=`#f8fafc`,glitchColor1:n=`#ff00de`,glitchColor2:r=`#00f0ff`,fontSize:i=64})=>(0,l.jsx)(`div`,{className:Le.glitchText,children:(0,l.jsx)(`h1`,{className:Le.text,"data-text":e,style:{fontSize:i,"--glitch-color":t,"--glitch-c1":n,"--glitch-c2":r},children:e})}),ze={gravityBalls:`cos-gravityBalls-LdwFo`,canvas:`cos-canvas-n7esd`},Be=[`#38bdf8`,`#a78bfa`,`#f472b6`,`#4ade80`,`#fbbf24`],Ve=({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:Be[Math.floor(Math.random()*Be.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:ze.gravityBalls,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:r,className:ze.canvas,style:{width:e,height:t}})})},He={wrap:`cos-wrap-r1gGL`,card:`cos-card-3W10s`,shine:`cos-shine-0xjID`,image:`cos-image-AV2XG`,placeholder:`cos-placeholder-wuuL3`,info:`cos-info-CNR0r`},Ue=({title:e=`全息卡片`,subtitle:t=`移动鼠标体验 3D 效果`,image:n})=>{let r=(0,c.useRef)(null);return(0,l.jsx)(`div`,{className:He.wrap,children:(0,l.jsxs)(`div`,{ref:r,className:He.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:He.shine}),n?(0,l.jsx)(`img`,{src:n,alt:e,className:He.image}):(0,l.jsx)(`div`,{className:He.placeholder,children:(0,l.jsx)(`span`,{children:`✦`})}),(0,l.jsxs)(`div`,{className:He.info,children:[(0,l.jsx)(`h3`,{children:e}),(0,l.jsx)(`p`,{children:t})]})]})})},We={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`},Ge=({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:We.liquidProgress,style:{width:n,height:n,"--liquid-color":r},children:[(0,l.jsxs)(`svg`,{viewBox:`0 0 100 100`,className:We.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:We.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:We.fillBg}),(0,l.jsx)(`path`,{ref:i,className:We.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:We.ring,strokeWidth:10,fill:`none`})]}),(0,l.jsxs)(`span`,{className:We.label,children:[Math.round(o),`%`]})]})},Ke={lorenzAttractor:`cos-lorenzAttractor--UAI7`,canvas:`cos-canvas-oeXce`},qe=({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:Ke.lorenzAttractor,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:a,className:Ke.canvas,style:{width:e,height:t}})})},Je={liquidGlass:`cos-liquidGlass-Z3bQg`,panel:`cos-panel-XYboD`,content:`cos-content-MHfkS`},Ye=({children:e=`液态玻璃面板`,blur:t=16,borderRadius:n=20})=>(0,l.jsx)(`div`,{className:Je.liquidGlass,children:(0,l.jsx)(`div`,{className:Je.panel,style:{"--glass-blur":`${t}px`,"--glass-radius":`${n}px`},children:(0,l.jsx)(`div`,{className:Je.content,children:e})})}),Xe={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:Xe.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:Xe.btn,style:{"--btn-color":n},children:e})})},Qe={matrixRain:`cos-matrixRain-qg9HC`,canvas:`cos-canvas--AvpG`,overlay:`cos-overlay-knj3b`,title:`cos-title-sDfhs`,flicker:`cos-flicker-smHxl`,subtitle:`cos-subtitle-CWheW`},$e=`ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*アイウエオカキクケコ`,et=({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=$e[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:Qe.matrixRain,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:s,className:Qe.canvas,style:{width:e,height:t}}),i&&(0,l.jsxs)(`div`,{className:Qe.overlay,children:[(0,l.jsx)(`h2`,{className:Qe.title,children:a}),(0,l.jsx)(`p`,{className:Qe.subtitle,children:o})]})]})},tt={metaballPool:`cos-metaballPool-JJaI9`,canvas:`cos-canvas-S7fDD`},nt=({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:tt.metaballPool,style:{width:e,height:t,"--pool-color":r},children:(0,l.jsx)(`canvas`,{ref:i,className:tt.canvas,style:{width:e,height:t}})})},rt={mazeGenerator:`cos-mazeGenerator-QEa0s`,canvas:`cos-canvas-emhxb`},it=({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:rt.mazeGenerator,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:rt.canvas,style:{width:e,height:t}})})},at={meteorRain:`cos-meteorRain-v8RNI`,canvas:`cos-canvas-hyFMr`},ot=({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:at.meteorRain,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:r,className:at.canvas,style:{width:e,height:t}})})},st={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`},ct=[{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`}],lt=[{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`}],ut=6,dt=`ui-sans-serif, system-ui, -apple-system, sans-serif`,ft=(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)})`},pt=(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},mt=({width:e=600,height:t=420,nodes:n=ct,edges:r=lt,linkColor:i=`rgb(148 163 184 / 35%)`,nodeRadius:a=20,hint:o=`拖拽节点 · 悬停查看关联`})=>{let s=(0,c.useRef)(null),u=(0,c.useRef)([]),d=(0,c.useRef)(null),f=(0,c.useRef)(null),[p,m]=(0,c.useState)(`default`),[h,g]=(0,c.useState)(o);(0,c.useEffect)(()=>{d.current||g(o)},[o]);let _=(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){u.current=[];return}let r=new Map(u.current.map(e=>[e.id,e]));u.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=s.current;if(!n)return;let o=Math.min(window.devicePixelRatio||1,2);n.width=e*o,n.height=t*o;let c=n.getContext(`2d`);if(!c)return;c.setTransform(o,0,0,o,0,0);let l=0,p=document.hidden,m=y(e=>{p=e}),h=()=>{let e=new Map;return u.current.forEach(t=>e.set(t.id,t)),e},g=(e,t)=>!t||e===t?!0:_.get(t)?.has(e)??!1,v=()=>{let n=u.current,i=h(),o=.92,s=.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)*s,r.vy+=(t/2-r.y)*s,r.vx*=o,r.vy*=o,f.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=c.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`),c.fillStyle=n,c.fillRect(0,0,e,t),c.fillStyle=`rgb(148 163 184 / 7%)`;for(let n=28;n<e;n+=28)for(let e=28;e<t;e+=28)c.beginPath(),c.arc(n,e,.7,0,Math.PI*2),c.fill();let r=c.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%)`),c.fillStyle=r,c.fillRect(0,0,e,t)},x=(e,t,n,r)=>{let o=t.x-e.x,s=t.y-e.y,l=Math.sqrt(o*o+s*s)||1,u=o/l,d=s/l,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=c.createLinearGradient(p,m,h,g);n?(y.addColorStop(0,pt(e.color,.85)),y.addColorStop(.5,pt(ft(e.color,t.color,.5),.55)),y.addColorStop(1,pt(t.color,.85)),c.lineWidth=2.4,c.shadowColor=pt(ft(e.color,t.color,.5),.45),c.shadowBlur=10):r?(y.addColorStop(0,pt(i,.12)),y.addColorStop(.5,pt(i,.08)),y.addColorStop(1,pt(i,.12)),c.lineWidth=1,c.shadowBlur=0):(y.addColorStop(0,pt(i,.15)),y.addColorStop(.5,i),y.addColorStop(1,pt(i,.15)),c.lineWidth=1.35,c.shadowBlur=0),c.strokeStyle=y,c.lineCap=`round`,c.beginPath(),c.moveTo(p,m),c.quadraticCurveTo(_+d*4,v-u*4,h,g),c.stroke(),c.shadowBlur=0},S=(e,n,r)=>{let i=g(e.id,n),o=n===e.id,s=r&&f.current?.node===e,l=a*(o||s?1.12:i||!n?1:.94),u=!n||i?1:.28;c.save(),c.globalAlpha=u,c.beginPath(),c.arc(e.x,e.y,l+(o||s?10:6),0,Math.PI*2),c.fillStyle=pt(e.color,o||s?.22:.12),c.fill(),c.shadowColor=pt(e.color,o||s?.75:.45),c.shadowBlur=o||s?22:14;let d=c.createRadialGradient(e.x-l*.28,e.y-l*.32,l*.1,e.x,e.y,l);d.addColorStop(0,ft(e.color,`#ffffff`,.55)),d.addColorStop(.55,e.color),d.addColorStop(1,ft(e.color,`#0f172a`,.35)),c.beginPath(),c.arc(e.x,e.y,l,0,Math.PI*2),c.fillStyle=d,c.fill(),c.shadowBlur=0,c.strokeStyle=o||s?`rgb(255 255 255 / 70%)`:`rgb(255 255 255 / 28%)`,c.lineWidth=o||s?1.6:1.1,c.stroke();let p=Math.max(10,Math.min(13,Math.round(a*.58)));c.font=`500 ${p}px ${dt}`,c.textAlign=`center`,c.textBaseline=`middle`;let m=e.label,h=c.measureText(m).width+16,_=p+8,v=e.x-h/2,y=Math.min(t-_-4,e.y+l+8);c.beginPath();let b=_/2;c.moveTo(v+b,y),c.arcTo(v+h,y,v+h,y+_,b),c.arcTo(v+h,y+_,v,y+_,b),c.arcTo(v,y+_,v,y,b),c.arcTo(v,y,v+h,y,b),c.closePath(),c.fillStyle=o||s?`rgb(15 23 42 / 78%)`:`rgb(15 23 42 / 55%)`,c.fill(),c.strokeStyle=`rgb(255 255 255 / 10%)`,c.lineWidth=1,c.stroke(),c.fillStyle=`#f8fafc`,c.fillText(m,e.x,y+_/2),c.restore()},C=()=>{b();let e=h(),t=f.current?.node.id??d.current,n=!!f.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=[...u.current].sort((e,n)=>(e.id===t?2:+!!g(e.id,t))-(n.id===t?2:+!!g(n.id,t)));for(let e of i)S(e,t,n)},w=()=>{l=requestAnimationFrame(w),!p&&(v(),C())};return l=requestAnimationFrame(w),()=>{cancelAnimationFrame(l),m()}},[_,r,t,i,a,e]);let v=(e,t,n)=>{let r=e-n.left,i=t-n.top,o=a+ut,s=null,c=o*o;for(let e of u.current){let t=(e.x-r)**2+(e.y-i)**2;t<=c&&(c=t,s=e)}return s},b=e=>{d.current=e?.id??null,g(e?e.label:o)},x=e=>{if(e.pointerType===`mouse`&&e.button!==0)return;let t=e.currentTarget.getBoundingClientRect(),n=v(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;f.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,b(n),m(`grabbing`)},S=n=>{let r=n.currentTarget.getBoundingClientRect(),i=n.clientX-r.left,o=n.clientY-r.top;if(f.current){n.pointerType===`touch`&&n.preventDefault();let{node:r,offsetX:s,offsetY:c}=f.current,l=Math.max(a,Math.min(e-a,i+s)),u=Math.max(a,Math.min(t-a,o+c));f.current.vx=l-f.current.lastX,f.current.vy=u-f.current.lastY,f.current.lastX=l,f.current.lastY=u,r.x=l,r.y=u,r.vx=0,r.vy=0,m(`grabbing`);return}let s=v(n.clientX,n.clientY,r);b(s),m(s?`grab`:`default`)},C=e=>{let t=f.current;t&&(t.node.vx=t.vx*.85,t.node.vy=t.vy*.85,f.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId));let n=e.currentTarget.getBoundingClientRect(),r=v(e.clientX,e.clientY,n);b(r),m(r?`grab`:`default`)},w=()=>{f.current||(b(null),m(`default`))},T=p===`grabbing`?st.cursorGrabbing:p===`grab`?st.cursorGrab:st.cursorDefault;return(0,l.jsxs)(`div`,{className:st.networkGraph,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:s,className:`${st.canvas} ${T}`,style:{width:e,height:t},onPointerDown:x,onPointerMove:S,onPointerUp:C,onPointerCancel:C,onPointerLeave:w}),(0,l.jsx)(`div`,{className:st.hint,children:h})]})},ht={neonText:`cos-neonText-JMP7i`,text:`cos-text-GTO-0`,flicker:`cos-flicker-nXceV`,"neon-flicker":`cos-neon-flicker-uDkmM`,reflection:`cos-reflection-aEYj6`},gt=({text:e=`NEON`,color:t=`#ff00de`,fontSize:n=72,flicker:r=!0})=>(0,l.jsxs)(`div`,{className:ht.neonText,children:[(0,l.jsx)(`h1`,{className:`${ht.text} ${r?ht.flicker:``}`,style:{fontSize:n,"--neon-color":t},children:e}),(0,l.jsx)(`p`,{className:ht.reflection,style:{fontSize:n*.35,color:t},children:e})]}),_t={newtonCradle:`cos-newtonCradle-mFl-b`,canvas:`cos-canvas-TWKl5`},vt=({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:_t.newtonCradle,style:{width:n,height:r,"--ball-color":t},children:(0,l.jsx)(`canvas`,{ref:i,className:_t.canvas,style:{width:n,height:r}})})},yt={orbitalChart:`cos-orbitalChart-XLORB`,canvas:`cos-canvas-hGVud`,legend:`cos-legend-Np9Mm`,swatch:`cos-swatch-xEKvA`},bt=[{label:`A`,value:30,color:`#38bdf8`},{label:`B`,value:25,color:`#a78bfa`},{label:`C`,value:20,color:`#f472b6`},{label:`D`,value:25,color:`#4ade80`}],xt=({data:e=bt,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:yt.orbitalChart,style:{width:t,height:t},children:[(0,l.jsx)(`canvas`,{ref:n,className:yt.canvas,style:{width:t,height:t}}),(0,l.jsx)(`ul`,{className:yt.legend,children:e.map(e=>(0,l.jsxs)(`li`,{children:[(0,l.jsx)(`span`,{className:yt.swatch,style:{background:e.color}}),e.label,` (`,e.value,`)`]},e.label))})]})},St={particleNetwork:`cos-particleNetwork-GSZq-`,canvas:`cos-canvas-E-BGP`,hint:`cos-hint-LEO5o`},Ct=({width:e=800,height:t=500,particleCount:n=60,linkDistance:r=120,repelRadius:i=150,color:a=`#38bdf8`,hint:o=`移动鼠标或手指与粒子互动`})=>{let s=(0,c.useRef)(null),u=(0,c.useRef)([]),d=(0,c.useRef)({x:-1e3,y:-1e3}),f=(0,c.useCallback)(()=>{u.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)(()=>{f()},[f]),(0,c.useEffect)(()=>{let n=s.current;if(!n)return;let o=window.devicePixelRatio||1;n.width=e*o,n.height=t*o;let c=n.getContext(`2d`);if(!c)return;c.setTransform(o,0,0,o,0,0);let l=0,f=document.hidden,p=y(e=>{f=e}),m=()=>{if(f){l=requestAnimationFrame(m);return}c.fillStyle=`#0f172a`,c.fillRect(0,0,e,t);let n=u.current,o=d.current,s=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<s&&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);c.beginPath(),c.moveTo(n[e].x,n[e].y),c.lineTo(n[t].x,n[t].y),c.strokeStyle=a,c.globalAlpha=1-i/r,c.lineWidth=.8,c.stroke(),c.globalAlpha=1}}n.forEach(e=>{c.beginPath(),c.arc(e.x,e.y,e.radius,0,Math.PI*2),c.fillStyle=a,c.fill()}),l=requestAnimationFrame(m)};return m(),()=>{cancelAnimationFrame(l),p()}},[a,t,f,r,i,e]);let p=(e,t,n)=>{d.current={x:e-n.left,y:t-n.top}},m=e=>{p(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect())},h=e=>{let t=e.touches[0];t&&p(t.clientX,t.clientY,e.currentTarget.getBoundingClientRect())},g=()=>{d.current={x:-1e3,y:-1e3}};return(0,l.jsxs)(`div`,{className:St.particleNetwork,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:s,className:St.canvas,style:{width:e,height:t},onMouseMove:m,onMouseLeave:g,onTouchMove:h,onTouchEnd:g}),(0,l.jsx)(`p`,{className:St.hint,children:o})]})},J={album:`cos-album-YDP44`,bookShadow:`cos-bookShadow-OTRJk`,stage:`cos-stage-0AOoU`,cover:`cos-cover-NgXqj`,coverEdgeTop:`cos-coverEdgeTop-6c9-Y`,coverEdgeSide:`cos-coverEdgeSide-P3osy`,pageStackLeft:`cos-pageStackLeft-tSbY2`,pageStackRight:`cos-pageStackRight-LHEJf`,book:`cos-book-KzrR1`,bookGutter:`cos-bookGutter-Wzw-P`,staticPage:`cos-staticPage-FxIfo`,turningPage:`cos-turningPage-dHWFc`,leftPage:`cos-leftPage-4Mlvj`,rightPage:`cos-rightPage-F4FGx`,gutterShade:`cos-gutterShade-KRm-E`,punchHoles:`cos-punchHoles-wFJEa`,punchLeft:`cos-punchLeft-GqHzv`,punchRight:`cos-punchRight-mjt9r`,punchHole:`cos-punchHole-f103b`,pageContent:`cos-pageContent-zI3p7`,photoMount:`cos-photoMount-xpDXf`,front:`cos-front-UroYj`,caption:`cos-caption-I0FZJ`,pageNumber:`cos-pageNumber-lEKVd`,back:`cos-back-8entC`,flyleaf:`cos-flyleaf-BiH6K`,flyleafCorner:`cos-flyleafCorner--pzLp`,flyleafCornerTl:`cos-flyleafCornerTl-AN5MS`,flyleafCornerTr:`cos-flyleafCornerTr-cbwv-`,flyleafCornerBl:`cos-flyleafCornerBl-iE60j`,flyleafCornerBr:`cos-flyleafCornerBr-QOzhA`,flyleafInner:`cos-flyleafInner-VJVEj`,flyleafMotif:`cos-flyleafMotif-TC3K5`,flyleafTitle:`cos-flyleafTitle-IIuP4`,flyleafSubtitle:`cos-flyleafSubtitle-jCr9V`,flyleafRule:`cos-flyleafRule-d7XA2`,face:`cos-face-lgVVG`,faceSheet:`cos-faceSheet--UI-p`,turnNextReady:`cos-turnNextReady-cvD3P`,turnPreviousReady:`cos-turnPreviousReady-kIHfq`,turnNext:`cos-turnNext-xt9ZK`,turnPrevious:`cos-turnPrevious-jjvaP`,wireBindingBack:`cos-wireBindingBack-kw-Ci`,wireBindingFront:`cos-wireBindingFront-bK9x5`,wireRingBack:`cos-wireRingBack-R26lf`,wireRingFront:`cos-wireRingFront-i2S1H`,hitArea:`cos-hitArea-NoHZa`,previousArea:`cos-previousArea-ZHppX`,nextArea:`cos-nextArea-eDUTE`,empty:`cos-empty-DOpsx`},wt=new Set,Tt=e=>{if(!e||typeof Image>`u`||wt.has(e))return;wt.add(e);let t=new Image;t.src=e,t.decode?.().catch(()=>{})},Et=e=>typeof e==`number`?`${e}px`:e,Dt=(e,t)=>Math.max(0,Math.min(Math.floor(e),Math.max(0,t))),Ot=()=>(0,l.jsx)(`svg`,{className:J.flyleafMotif,viewBox:`0 0 120 120`,"aria-hidden":`true`,children:(0,l.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeWidth:`1.1`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,l.jsx)(`circle`,{cx:`60`,cy:`60`,r:`46`}),(0,l.jsx)(`path`,{d:`M60 14 L106 60 L60 106 L14 60 Z`}),(0,l.jsx)(`circle`,{cx:`60`,cy:`60`,r:`28`}),(0,l.jsx)(`path`,{d:`M60 32 L88 60 L60 88 L32 60 Z`}),(0,l.jsx)(`path`,{d:`M60 20 V40 M60 80 V100 M20 60 H40 M80 60 H100`}),(0,l.jsx)(`path`,{d:`M34 34 L46 46 M86 34 L74 46 M34 86 L46 74 M86 86 L74 74`}),(0,l.jsx)(`path`,{d:`M60 50 L70 60 L60 70 L50 60 Z`}),(0,l.jsx)(`path`,{d:`M60 8 L63 14 L60 20 L57 14 Z`}),(0,l.jsx)(`path`,{d:`M60 100 L63 106 L60 112 L57 106 Z`}),(0,l.jsx)(`path`,{d:`M8 60 L14 63 L20 60 L14 57 Z`}),(0,l.jsx)(`path`,{d:`M100 60 L106 63 L112 60 L106 57 Z`})]})}),kt=32,At=4,jt=28,Mt=.916,Nt={previous:`Previous photo`,next:`Next photo`,empty:`No photos`,flyleafTitle:`Photo Album`,flyleafSubtitle:`Turn the page to begin`,flyleafEndTitle:`The End`,flyleafEndSubtitle:`Thank you for browsing`},Pt=e=>{if(!Number.isFinite(e)||e<=0)return 16;let t=e*Mt;return Math.max(At,Math.min(jt,Math.round(t/kt)))},Ft=(e,t)=>`${(e+.55)/t*100}%`,It=({photo:e,index:t,total:n,objectFit:r,showPageNumber:i,pageColor:a,flyleafTitle:o,flyleafSubtitle:s,flyleafEndTitle:c,flyleafEndSubtitle:u})=>{let d=t<0,f=d?o:c,p=d?s:u;return(0,l.jsx)(`div`,{className:J.pageContent,style:{backgroundColor:a},children:e?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`div`,{className:J.photoMount,children:(0,l.jsx)(`img`,{src:e.src,alt:e.alt??e.title??``,draggable:!1,style:{objectFit:r}})}),(e.title||e.description)&&(0,l.jsxs)(`div`,{className:J.caption,children:[e.title&&(0,l.jsx)(`strong`,{children:e.title}),e.description&&(0,l.jsx)(`span`,{children:e.description})]}),i&&(0,l.jsx)(`span`,{className:J.pageNumber,children:`${t+1} / ${n}`})]}):(0,l.jsxs)(`div`,{className:J.flyleaf,children:[(0,l.jsx)(`span`,{className:`${J.flyleafCorner} ${J.flyleafCornerTl}`,"aria-hidden":`true`}),(0,l.jsx)(`span`,{className:`${J.flyleafCorner} ${J.flyleafCornerTr}`,"aria-hidden":`true`}),(0,l.jsx)(`span`,{className:`${J.flyleafCorner} ${J.flyleafCornerBl}`,"aria-hidden":`true`}),(0,l.jsx)(`span`,{className:`${J.flyleafCorner} ${J.flyleafCornerBr}`,"aria-hidden":`true`}),(0,l.jsxs)(`div`,{className:J.flyleafInner,children:[(0,l.jsx)(`span`,{className:J.flyleafRule,"aria-hidden":`true`}),(0,l.jsx)(Ot,{}),(0,l.jsx)(`p`,{className:J.flyleafTitle,children:f}),(0,l.jsx)(`p`,{className:J.flyleafSubtitle,children:p}),(0,l.jsx)(`span`,{className:J.flyleafRule,"aria-hidden":`true`})]})]})})},Lt=({side:e,count:t})=>(0,l.jsx)(`div`,{className:`${J.punchHoles} ${e===`left`?J.punchLeft:J.punchRight}`,"aria-hidden":`true`,children:Array.from({length:t},(e,n)=>(0,l.jsx)(`span`,{className:J.punchHole,style:{top:Ft(n,t)}},n))}),Rt=({count:e,variant:t})=>{let n=t===`back`?J.wireRingBack:J.wireRingFront;return(0,l.jsx)(`div`,{className:t===`back`?J.wireBindingBack:J.wireBindingFront,"aria-hidden":`true`,children:Array.from({length:e},(t,r)=>(0,l.jsx)(`span`,{className:n,style:{top:Ft(r,e)}},r))})},zt=({photos:e,width:t=920,height:n=560,initialIndex:r=0,pageTurnDuration:i=760,objectFit:a=`cover`,showPageNumber:o=!0,pageColor:s=`#f2ead8`,coverColor:u=`#4a3025`,ariaLabel:d=`Photo album`,labels:f,onPageChange:p,className:m,style:h})=>{let[g,_]=(0,c.useState)(()=>Dt(r,e.length)),[v,y]=(0,c.useState)(null),[b,x]=(0,c.useState)(()=>typeof n==`number`?Pt(n):16),S=Dt(g,e.length),C=Math.max(180,i),w={previous:f?.previous??Nt.previous,next:f?.next??Nt.next,empty:f?.empty??Nt.empty,flyleafTitle:f?.flyleafTitle??Nt.flyleafTitle,flyleafSubtitle:f?.flyleafSubtitle??Nt.flyleafSubtitle,flyleafEndTitle:f?.flyleafEndTitle??Nt.flyleafEndTitle,flyleafEndSubtitle:f?.flyleafEndSubtitle??Nt.flyleafEndSubtitle},T=(0,c.useRef)(v),E=(0,c.useRef)(!1),D=(0,c.useRef)(0),O=(0,c.useRef)(null),k=(0,c.useRef)(null),A=(0,c.useRef)([]),j=(0,c.useCallback)(()=>{A.current.forEach(e=>window.cancelAnimationFrame(e)),A.current=[]},[]);(0,c.useEffect)(()=>{T.current=v},[v]),(0,c.useEffect)(()=>()=>j(),[j]),(0,c.useEffect)(()=>{let e=k.current;if(!e)return;let t=e=>{let t=Pt(e);x(e=>e===t?e:t)};if(t(e.getBoundingClientRect().height),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(e=>{let n=e[0];n&&t(n.contentRect.height)});return n.observe(e),()=>n.disconnect()},[n,t]);let M=(0,c.useCallback)(t=>{if(T.current||E.current||e.length<2)return;let n=S,r=t===`next`?n+2:n-2;t===`next`&&n+1>=e.length||t===`previous`&&n<=0||(E.current=!1,D.current+=1,j(),y({direction:t,fromIndex:n,targetIndex:r,phase:`cover`}))},[j,e.length,S]);(0,c.useEffect)(()=>{if(!v||v.phase!==`cover`)return;let e=D.current,t=!1,n=0,r=0;return n=window.requestAnimationFrame(()=>{r=window.requestAnimationFrame(()=>{t||e!==D.current||y(e=>e&&e.phase===`cover`?{...e,phase:`run`}:e)})}),()=>{t=!0,window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[v]);let N=(0,c.useCallback)(()=>{let t=T.current;if(!t||E.current||t.phase===`settle`)return;E.current=!0;let n=Dt(t.targetIndex,e.length),r=D.current,i=()=>{if(r!==D.current)return;E.current=!1;let t=e[n]??e[n-1],i=e[n]?n:n-1;t&&i>=0&&p?.(i,t)},a=O.current,o=t.direction===`next`?`translateZ(0) rotateY(-180deg)`:`translateZ(0) rotateY(0deg)`;a&&(a.style.animation=`none`,a.style.transition=`none`,a.style.willChange=`auto`,a.style.transform=o,a.style.opacity=`1`),_(n),y({...t,phase:`settle`,underlaySynced:!0}),j();let s=window.requestAnimationFrame(()=>{let e=window.requestAnimationFrame(()=>{if(r!==D.current)return;let e=O.current;e&&(e.style.visibility=`hidden`);let t=window.requestAnimationFrame(()=>{r===D.current&&(y(null),i())});A.current.push(t)});A.current.push(e)});A.current.push(s)},[j,p,e]);(0,c.useEffect)(()=>{if(!v||v.phase!==`run`)return;let e=D.current,t=window.setTimeout(()=>{e===D.current&&N()},C+120);return()=>window.clearTimeout(t)},[N,C,v]),(0,c.useEffect)(()=>{if(!v||v.phase!==`run`||v.underlaySynced)return;let e=D.current,t=window.setTimeout(()=>{e===D.current&&y(e=>e&&e.phase===`run`&&!e.underlaySynced?{...e,underlaySynced:!0}:e)},Math.round(C*.52));return()=>window.clearTimeout(t)},[C,v]),(0,c.useEffect)(()=>{for(let t=-2;t<=2;t+=1)Tt(e[S+t]?.src)},[e,S]);let P=(0,c.useMemo)(()=>{if(!v)return{left:S-1,right:S};let{fromIndex:e,targetIndex:t,direction:n,phase:r}=v;return r===`cover`?{left:e-1,right:e}:r===`settle`?{left:t-1,right:t}:n===`next`?{left:v.underlaySynced?t-1:e-1,right:t}:{left:t-1,right:v.underlaySynced?t:e}},[S,v]),F=(0,c.useMemo)(()=>v?v.direction===`next`?{front:v.fromIndex,back:v.fromIndex+1}:{front:v.targetIndex,back:v.targetIndex+1}:{front:S,back:S+1},[S,v]),I={...h,"--album-width":Et(t),"--album-height":Et(n),"--album-ratio":typeof t==`number`&&typeof n==`number`?t/n:1.6429,"--turn-duration":`${C}ms`,"--cover-color":u},ee=e=>{e.target===e.currentTarget&&(e.key===`ArrowRight`||e.key===`Enter`||e.key===` `?(e.preventDefault(),M(`next`)):e.key===`ArrowLeft`&&(e.preventDefault(),M(`previous`)))},L=e=>{if(e.target!==e.currentTarget)return;let t=e.animationName||``;t&&!/turnNext|turnPrevious/i.test(t)||N()};if(e.length===0)return(0,l.jsx)(`div`,{className:`${J.album} ${J.empty} ${m??``}`,style:I,role:`region`,"aria-label":d,children:w.empty});let te={total:e.length,objectFit:a,showPageNumber:o,pageColor:s,flyleafTitle:w.flyleafTitle,flyleafSubtitle:w.flyleafSubtitle,flyleafEndTitle:w.flyleafEndTitle,flyleafEndSubtitle:w.flyleafEndSubtitle},ne=v?v.phase===`settle`?J.turningPage:v.direction===`next`?`${J.turningPage} ${v.phase===`cover`?J.turnNextReady:J.turnNext}`:`${J.turningPage} ${v.phase===`cover`?J.turnPreviousReady:J.turnPrevious}`:null;return(0,l.jsxs)(`div`,{ref:k,className:`${J.album} ${m??``}`,style:I,role:`region`,"aria-label":d,"aria-roledescription":`photo album`,tabIndex:0,onKeyDown:ee,children:[(0,l.jsx)(`div`,{className:J.bookShadow,"aria-hidden":`true`}),(0,l.jsxs)(`div`,{className:J.stage,"aria-hidden":`true`,children:[(0,l.jsxs)(`div`,{className:J.cover,children:[(0,l.jsx)(`span`,{className:J.coverEdgeTop}),(0,l.jsx)(`span`,{className:J.coverEdgeSide})]}),(0,l.jsx)(`div`,{className:J.pageStackLeft}),(0,l.jsx)(`div`,{className:J.pageStackRight})]}),(0,l.jsx)(Rt,{count:b,variant:`back`}),(0,l.jsxs)(`div`,{className:J.book,children:[(0,l.jsxs)(`div`,{className:`${J.staticPage} ${J.leftPage}`,children:[(0,l.jsx)(Lt,{side:`left`,count:b}),(0,l.jsx)(`div`,{className:J.gutterShade,"aria-hidden":`true`}),(0,l.jsx)(It,{photo:e[P.left],index:P.left,...te})]}),(0,l.jsxs)(`div`,{className:`${J.staticPage} ${J.rightPage}`,children:[(0,l.jsx)(Lt,{side:`right`,count:b}),(0,l.jsx)(`div`,{className:J.gutterShade,"aria-hidden":`true`}),(0,l.jsx)(It,{photo:e[P.right],index:P.right,...te})]}),v&&ne&&(0,l.jsxs)(`div`,{ref:O,className:ne,onAnimationEnd:L,"aria-hidden":`true`,children:[(0,l.jsx)(`div`,{className:`${J.face} ${J.front}`,children:(0,l.jsxs)(`div`,{className:J.faceSheet,style:{backgroundColor:s},children:[(0,l.jsx)(Lt,{side:`right`,count:b}),(0,l.jsx)(It,{photo:e[F.front],index:F.front,...te})]})}),(0,l.jsx)(`div`,{className:`${J.face} ${J.back}`,children:(0,l.jsxs)(`div`,{className:J.faceSheet,style:{backgroundColor:s},children:[(0,l.jsx)(Lt,{side:`left`,count:b}),(0,l.jsx)(It,{photo:e[F.back],index:F.back,...te})]})})]})]}),(0,l.jsx)(`div`,{className:J.bookGutter,"aria-hidden":`true`}),(0,l.jsx)(Rt,{count:b,variant:`front`}),(0,l.jsx)(`button`,{type:`button`,className:`${J.hitArea} ${J.previousArea}`,onClick:()=>M(`previous`),disabled:S<=0||!!v,"aria-label":w.previous}),(0,l.jsx)(`button`,{type:`button`,className:`${J.hitArea} ${J.nextArea}`,onClick:()=>M(`next`),disabled:S+1>=e.length||!!v,"aria-label":w.next})]})},Y={clothesline:`cos-clothesline-sgTFe`,viewport:`cos-viewport-TH-gR`,pannable:`cos-pannable-sEcjn`,rail:`cos-rail-eTBFj`,strings:`cos-strings-HDBn-`,ropeShadow:`cos-ropeShadow-79mEA`,ropeShadowCore:`cos-ropeShadowCore-L3p8G`,ropeBody:`cos-ropeBody-pEvRS`,ropeTwist:`cos-ropeTwist-shhPx`,bandBody:`cos-bandBody-DScGJ`,bandGloss:`cos-bandGloss-I-wXr`,bandKnot:`cos-bandKnot-raqsN`,hanger:`cos-hanger-8FbKZ`,frame:`cos-frame-TORk3`,pin:`cos-pin-wNwv2`,pinSpring:`cos-pinSpring-1-6dJ`,photo:`cos-photo-90x94`,caption:`cos-caption-VM5T4`},Bt=1e3/120,Vt=Bt/1e3,Ht=64,Ut=13,Wt=6,Gt=8,Kt=4,qt=.42,Jt=3800,Yt=2600,Xt=2900,Zt=165,Qt=76,$t=60,en=34,tn=.05,nn=11,rn=108,an=34,on=110,sn=18,cn=.02,ln=.6,X=(e,t,n)=>Math.min(n,Math.max(t,e)),un=e=>{let t=Math.sin(e*127.1+31.7)*43758.5453;return t-Math.floor(t)},dn=e=>typeof e==`number`?`${e}px`:e,fn=(e,t)=>t*Math.tanh(e/t),pn=(e,t=e.length)=>{if(t<2)return``;let n=`M ${e[0].x.toFixed(2)} ${e[0].y.toFixed(2)}`;for(let r=0;r<t-1;r+=1){let i=e[r],a=e[r+1],o=r>0?e[r-1]:i,s=r+2<t?e[r+2]:a,c=i.x+(a.x-o.x)/6,l=i.y+(a.y-o.y)/6,u=a.x-(s.x-i.x)/6,d=a.y-(s.y-i.y)/6;n+=` C ${c.toFixed(2)} ${l.toFixed(2)} ${u.toFixed(2)} ${d.toFixed(2)} ${a.x.toFixed(2)} ${a.y.toFixed(2)}`}return n},mn=({photos:e,width:t=`100%`,height:n=480,photoWidth:r=150,photoHeight:i=200,photoGap:a=46,ropeTop:o=66,ropeSag:s=26,bandLength:u=34,bandWidth:d=5,maxPull:f=110,stiffness:p=1,damping:m=.16,tension:h=.35,tilt:g=5,ropeColor:_=`#8d7a5c`,bandColor:v,pinColor:y=`#d8a761`,frameColor:b=`#fffdf7`,background:x,objectFit:S=`cover`,showCaption:C=!0,initialIndex:w=0,onPhotoClick:T,ariaLabel:E=`Photo clothesline`,className:D,style:O})=>{let k=(0,c.useRef)(null),A=(0,c.useRef)(null),j=(0,c.useRef)([]),M=(0,c.useRef)([]),N=(0,c.useRef)([]),P=(0,c.useRef)([]),F=(0,c.useRef)([]),I=(0,c.useRef)([]),ee=(0,c.useRef)([]),L=(0,c.useRef)([]),te=(0,c.useRef)([]),ne=(0,c.useRef)(``),re=(0,c.useRef)(``),R=(0,c.useRef)(null),ie=(0,c.useRef)(null),z=(0,c.useRef)(0),B=(0,c.useRef)(0),ae=(0,c.useRef)(null),oe=(0,c.useRef)(null),V=(0,c.useRef)(null),se=(0,c.useRef)(null),ce=(0,c.useRef)(null),le=(0,c.useRef)(0),ue=(0,c.useRef)(0),de=(0,c.useRef)(!1),fe=(0,c.useRef)(w),[H,pe]=(0,c.useState)({width:0,height:0}),U=e.length,me=C&&e.some(e=>e.title||e.description),W=(0,c.useMemo)(()=>{let e=U>0?U*r+(U-1)*a:0,t=Math.round(r*.55),n=Math.max(e+t*2,H.width,r*2),c=(n-e)/2,l=r+a,d=[];for(let e=0;e<U;e+=1)d.push(c+e*l+r*(.4+un(e*5.13)*.2));let p=e=>{let t=n>0?X(e/n,0,1):0;return o+s*4*t*(1-t)},m=Math.min(20,a*.24+5),h=[],_=[],v=[],y=[],b=[],x=[];for(let e=0;e<U;e+=1){let t=c+e*l,n=d[e],i=p(n);h.push(t),v.push(n-t),y.push(i),_.push(i+u+Ut),b.push((un(e*3.71)*2-1)*g),x.push(t+r/2)}let S=[{x:0,baseY:p(0),pulls:[]}];for(let e=0;e<U;e+=1){let t=((e===0?0:d[e-1])+d[e])/2,n=e===0;S.push({x:t,baseY:p(t)+m*(n?.5:1),pulls:n?[{index:e,weight:.3}]:[{index:e-1,weight:.45},{index:e,weight:.45}]}),S.push({x:d[e],baseY:p(d[e]),pulls:[{index:e,weight:1}]})}if(U>0){let e=(d[U-1]+n)/2;S.push({x:e,baseY:p(e)+m*.5,pulls:[{index:U-1,weight:.3}]})}return S.push({x:n,baseY:p(n),pulls:[]}),{railWidth:n,stageHeight:Math.max(H.height,Math.ceil(o+s+u+Ut+i+f+40)),cardLefts:h,cardTops:_,pinOffsets:v,pinXs:d,anchorYs:y,baseRots:b,centers:x,anchors:S}},[u,U,f,a,i,r,s,o,g,H.height,H.width]),he=(0,c.useMemo)(()=>{let e=420*X(p,.1,3),t=X(m,.02,1);return{bandLength:Math.max(8,u),segLength:Math.max(8,u)/(Wt-1),gravityAccel:Xt,chainKeep:Math.exp(-(.6+t*6)*Vt),swingDamp:2*X(.28+t,.1,1)*Math.sqrt(Zt),spinDamp:2*X(.35+t,.1,1.2)*Math.sqrt($t),bandK:e*.9,bandRecover:nn,springK:e,springC:2*X(.45+t,.1,1.2)*Math.sqrt(e),neighborK:e*X(h,0,1),maxPull:Math.max(16,f)}},[u,m,f,p,h]),ge=Math.min(0,H.width-W.railWidth)<-.5,G=(0,c.useCallback)(()=>{let e=k.current?.clientWidth??H.width;return{min:Math.min(0,e-(R.current?.railWidth??0)),max:0}},[H.width]),_e=(0,c.useCallback)((e,t)=>{let n=R.current,r=ie.current;return{x:n?.pinXs[e]??0,y:(n?.anchorYs[e]??0)+(r?.segLength??0)*t}},[]),ve=(0,c.useCallback)(e=>Array.from({length:Wt},(t,n)=>{let r=_e(e,n);return{x:r.x,y:r.y,px:r.x,py:r.y,sx:r.x,sy:r.y,rx:r.x,ry:r.y}}),[_e]),ye=(0,c.useCallback)(e=>{let t=ee.current;for(;t.length<e;)t.push({x:0,y:0});return t},[]),be=(0,c.useCallback)((e,t)=>{let n=R.current,r=ie.current;if(!n||!r)return;let i=`translate3d(${z.current.toFixed(2)}px, 0, 0)`;A.current&&i!==re.current&&(A.current.style.transform=i,re.current=i);let a=t>0?1-Math.exp(-t*an):1,o=I.current;for(let t=0;t<o.length;t+=1){let i=o[t];if(!i)continue;let s=i.chain,c=s.length-1,l=ye(s.length);for(let t=0;t<=c;t+=1){let n=s[t],r=n.sx+(n.x-n.sx)*e,i=n.sy+(n.y-n.sy)*e;t===0||t===c?(n.rx=r,n.ry=i):(n.rx+=(r-n.rx)*a,n.ry+=(i-n.ry)*a),l[t].x=n.rx,l[t].y=n.ry}let u=F.current[t];if(u){let a=s[c],o=n.pinXs[t]??0,l=(n.anchorYs[t]??0)+r.bandLength,d=i.sRot+(i.rot-i.sRot)*e,f=i.sSpin+(i.spin-i.sSpin)*e,p=`translate3d(${(a.rx-o).toFixed(2)}px, ${(a.ry-l).toFixed(2)}px, 0) rotate(${d.toFixed(2)}deg) rotateY(${f.toFixed(2)}deg)`;p!==te.current[t]&&(u.style.transform=p,te.current[t]=p)}let d=pn(l,s.length);if(d!==L.current[t]){L.current[t]=d,M.current[t]?.setAttribute(`d`,d),N.current[t]?.setAttribute(`d`,d);let e=P.current[t];e&&(e.setAttribute(`cx`,s[0].rx.toFixed(2)),e.setAttribute(`cy`,s[0].ry.toFixed(2)))}}let s=n.anchors,c=ye(s.length);for(let t=0;t<s.length;t+=1){let n=s[t],r=n.baseY;for(let t of n.pulls){let n=o[t.index];n&&(r+=(n.sRopeY+(n.ropeY-n.sRopeY)*e)*t.weight)}c[t].x=n.x,c[t].y=r}let l=pn(c,s.length);if(l!==ne.current){ne.current=l;for(let e of j.current)e?.setAttribute(`d`,l)}},[ye]),xe=(0,c.useCallback)(e=>{let t=ie.current,n=R.current;if(!t||!n)return;let r=I.current,i=oe.current,a=i?.mode===`photo`?i.photoIndex:-1,o=V.current;if(V.current=null,i){let t=Math.exp(-e*6);i.vx*=t,i.vy*=t;let n=1-Math.exp(-e*on);i.smoothX+=(i.pointerX-i.smoothX)*n,i.smoothY+=(i.pointerY-i.smoothY)*n}for(let s=0;s<r.length;s+=1){let c=r[s],l=c.chain,u=l.length-1;for(let e=0;e<=u;e+=1)l[e].sx=l[e].x,l[e].sy=l[e].y;c.sRot=c.rot,c.sSpin=c.spin,c.sRopeY=c.ropeY;let d=n.pinXs[s]??0,f=(n.anchorYs[s]??0)+c.ropeY,p=t.maxPull,m=s===a&&i?i:null,h=0,g=0,_=0;if(m){g=m.smoothX-m.grabDx,_=m.smoothY-m.grabDy;let e=Math.hypot(g-d,_-f);h=Math.max(0,fn(e-t.bandLength,p))}c.slack=h>=c.slack?h:c.slack+(h-c.slack)*(1-Math.exp(-e*t.bandRecover)),c.slack<.02&&(c.slack=0);let v=t.bandLength+c.slack,y=v/(Wt-1);o&&o.index===s&&(l[u].px=l[u].x-o.vx*e,l[u].py=l[u].y-o.vy*e);let b=t.gravityAccel*e*e;for(let e=1;e<=u;e+=1){let n=l[e],r=(n.x-n.px)*t.chainKeep,i=(n.y-n.py)*t.chainKeep;n.px=n.x,n.py=n.y,n.x+=r,n.y+=i+b}let x=null;if(m){let e=g-d,t=_-f,n=Math.hypot(e,t);x=n>v&&n>.001?{x:d+e/n*v,y:f+t/n*v}:{x:g,y:_}}for(let e=0;e<Gt;e+=1){l[0].x=d,l[0].y=f,x&&(l[u].x=x.x,l[u].y=x.y);for(let e=0;e<u;e+=1){let t=l[e],n=l[e+1],r=n.x-t.x,i=n.y-t.y,a=Math.hypot(r,i)||1e-4;if(a<=y)continue;let o=(a-y)/a,s=e===0,c=e+1===u&&x!==null,d=s?0:c?1:.5,f=c?0:s?1:.5;t.x+=r*o*d,t.y+=i*o*d,n.x-=r*o*f,n.y-=i*o*f}}let S=l[u],C=-(Math.atan2(S.x-l[0].x,S.y-l[0].y)*180)/Math.PI,w=Qt*Math.tanh(C/Qt),T=(n.baseRots[s]??0)+w;c.vRot+=((T-c.rot)*Zt-c.vRot*t.swingDamp)*e,c.rot=X(c.rot+c.vRot*e,-108,rn);let E=(S.x-S.px)/e;c.swayVx+=(E-c.swayVx)*(1-Math.exp(-e*sn));let D=X(-c.swayVx*tn,-34,en);c.vSpin+=((D-c.spin)*$t-c.vSpin*t.spinDamp)*e,c.spin+=c.vSpin*e;let O=-t.springK*c.ropeY-t.springC*c.ropeVy;if(c.slack>0){let e=S.y-f,n=Math.hypot(S.x-d,e)||1;O+=t.bandK*c.slack*Math.max(e/n,0)}let k=r[s-1],A=r[s+1];k&&(O+=t.neighborK*(k.ropeY-c.ropeY)),A&&(O+=t.neighborK*(A.ropeY-c.ropeY)),c.ropeVy+=O*e,c.ropeY=X(c.ropeY+c.ropeVy*e,-t.maxPull,t.maxPull*1.2)}if(i?.mode===`pan`)return;let{min:s,max:c}=G(),l=ae.current;if(l!==null){let t=l-z.current;z.current+=t*(1-Math.exp(-e*12)),B.current=0,Math.abs(t)<.4&&(z.current=l,ae.current=null);return}if(i)return;let u=z.current;if(u>c||u<s){let t=u>c?c:s;B.current+=((t-u)*220-B.current*15)*e,z.current+=B.current*e,Math.abs(t-z.current)<.4&&Math.abs(B.current)<24&&(z.current=t,B.current=0);return}B.current!==0&&(z.current+=B.current*e,B.current*=Math.exp(-e*2.8),Math.abs(B.current)<12&&(B.current=0),z.current=X(z.current,s,c))},[G]),Se=(0,c.useCallback)(()=>{if(oe.current||ae.current!==null||V.current||Math.abs(B.current)>.5)return!1;let{min:e,max:t}=G();if(z.current>t+.4||z.current<e-.4)return!1;let n=R.current;return I.current.every((e,t)=>{let r=n?.baseRots[t]??0;return e.slack>0||Math.abs(e.rot-r)>1||Math.abs(e.vRot)>4||Math.abs(e.spin)>.6||Math.abs(e.vSpin)>4||Math.abs(e.ropeY)>.3||Math.abs(e.ropeVy)>3?!1:e.chain.every((e,n)=>{let r=_e(t,n);return Math.hypot(e.x-r.x,e.y-r.y)<ln&&Math.abs(e.x-e.px)<cn&&Math.abs(e.y-e.py)<cn})})},[G,_e]),Ce=(0,c.useCallback)(()=>{let e=R.current;I.current.forEach((t,n)=>{t.chain.forEach((e,t)=>{let r=_e(n,t);e.x=r.x,e.y=r.y,e.px=r.x,e.py=r.y,e.sx=r.x,e.sy=r.y,e.rx=r.x,e.ry=r.y}),t.rot=e?.baseRots[n]??0,t.vRot=0,t.spin=0,t.vSpin=0,t.swayVx=0,t.slack=0,t.ropeY=0,t.ropeVy=0,t.sRot=t.rot,t.sSpin=0,t.sRopeY=0}),B.current=0},[_e]);(0,c.useEffect)(()=>{let e=t=>{ce.current=null;let n=le.current||t;le.current=t;let r=Math.min(t-n,Ht);ue.current+=r;let i=0;for(;ue.current>=Bt&&i<12;)xe(Vt),ue.current-=Bt,i+=1;if(i>=12&&(ue.current=0),Se()){Ce(),be(1,0),le.current=0,ue.current=0;return}be(ue.current/Bt,r/1e3),ce.current=window.requestAnimationFrame(e)};return se.current=e,()=>{se.current=null}},[Se,be,Ce,xe]);let K=(0,c.useCallback)(()=>{if(ce.current!==null||typeof window>`u`)return;let e=se.current;e&&(le.current=0,ue.current=0,ce.current=window.requestAnimationFrame(e))},[]);(0,c.useEffect)(()=>{R.current=W,ie.current=he},[W,he]),(0,c.useEffect)(()=>{I.current=Array.from({length:U},(e,t)=>({chain:ve(t),rot:W.baseRots[t]??0,vRot:0,spin:0,vSpin:0,swayVx:0,slack:0,ropeY:0,ropeVy:0,sRot:W.baseRots[t]??0,sSpin:0,sRopeY:0})),F.current.length=U,ne.current=``,re.current=``},[U,W,he,ve]),(0,c.useEffect)(()=>{let e=k.current;if(!e)return;let t=(e,t)=>pe(n=>n.width===e&&n.height===t?n:{width:e,height:t});if(t(e.clientWidth,e.clientHeight),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(e=>{let n=e[0];n&&t(Math.round(n.contentRect.width),Math.round(n.contentRect.height))});return n.observe(e),()=>n.disconnect()},[]);let q=(0,c.useCallback)(e=>{let t=k.current?.clientWidth??H.width,n=R.current?.centers[X(e,0,Math.max(0,U-1))];if(n===void 0)return 0;let{min:r,max:i}=G();return X(t/2-n,r,i)},[U,G,H.width]);(0,c.useEffect)(()=>{if(H.width<=0)return;if(!de.current){de.current=!0,fe.current=w,z.current=q(w),be(1,0);return}if(fe.current!==w){fe.current=w,ae.current=q(w),K();return}let{min:e,max:t}=G();z.current=X(z.current,e,t),be(1,0)},[U,w,W,G,q,be,K,H.width]),(0,c.useEffect)(()=>()=>{ce.current!==null&&window.cancelAnimationFrame(ce.current),ce.current=null},[]);let we=(0,c.useCallback)(e=>{if(e.button!==0&&e.pointerType===`mouse`)return;let t=e.target?.closest?.(`[data-photo-index]`),n=t?Number(t.dataset.photoIndex):-1,r=Number.isFinite(n)?n:-1,i=k.current?.getBoundingClientRect(),a=i?.left??0,o=i?.top??0,s=e.clientX-a-z.current,c=e.clientY-o,l=r>=0?I.current[r]:void 0,u=l?.chain[l.chain.length-1];ae.current=null,B.current=0,oe.current={pointerId:e.pointerId,mode:u?`photo`:`pan`,photoIndex:r,grabDx:u?s-u.x:0,grabDy:u?c-u.y:0,pointerX:s,pointerY:c,smoothX:s,smoothY:c,rectLeft:a,rectTop:o,startX:e.clientX,startY:e.clientY,startOffset:z.current,lastX:e.clientX,lastY:e.clientY,lastTime:e.timeStamp,vx:0,vy:0,moved:0},e.currentTarget.setPointerCapture(e.pointerId),K()},[K]),Te=(0,c.useCallback)(e=>{let t=oe.current;if(!t||t.pointerId!==e.pointerId)return;let n=e.clientX-t.startX,r=e.clientY-t.startY;t.moved=Math.max(t.moved,Math.hypot(n,r));let i=Math.max(e.timeStamp-t.lastTime,1)/1e3;if(t.vx=.7*((e.clientX-t.lastX)/i)+.3*t.vx,t.vy=.7*((e.clientY-t.lastY)/i)+.3*t.vy,t.lastX=e.clientX,t.lastY=e.clientY,t.lastTime=e.timeStamp,t.mode===`pan`){let{min:e,max:r}=G(),i=t.startOffset+n;z.current=i-(i>r?i-r:i<e?i-e:0)*(1-qt),K();return}t.pointerX=e.clientX-t.rectLeft-z.current,t.pointerY=e.clientY-t.rectTop,K()},[G,K]),Ee=(0,c.useCallback)(t=>{let n=oe.current;if(!(!n||n.pointerId!==t.pointerId)){if(oe.current=null,t.currentTarget.hasPointerCapture(t.pointerId)&&t.currentTarget.releasePointerCapture(t.pointerId),n.mode===`pan`)B.current=X(n.vx,-3800,Jt);else if(n.moved<=Kt&&n.photoIndex>=0){let t=e[n.photoIndex];t&&T?.(n.photoIndex,t)}else n.photoIndex>=0&&(V.current={index:n.photoIndex,vx:X(n.vx,-2600,Yt),vy:X(n.vy,-2600,Yt)});K()}},[T,e,K]),De=(0,c.useCallback)(e=>{let t=oe.current;!t||t.pointerId!==e.pointerId||(oe.current=null,K())},[K]);(0,c.useEffect)(()=>{let e=k.current;if(!e)return;let t=e=>{let t=Math.abs(e.deltaX)>Math.abs(e.deltaY)?e.deltaX:e.shiftKey?e.deltaY:0;if(t===0)return;let{min:n,max:r}=G();n>=r||(e.preventDefault(),ae.current=null,B.current=0,z.current=X(z.current-t,n,r),K())};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[G,K]);let Oe=(0,c.useCallback)(t=>{let n=t.target?.closest?.(`[data-photo-index]`),i=n?Number(n.dataset.photoIndex):-1;if(t.key===`ArrowRight`||t.key===`ArrowLeft`){let{min:e,max:n}=G();if(e>=n)return;t.preventDefault();let i=r+a;ae.current=X((ae.current??z.current)+(t.key===`ArrowLeft`?i:-i),e,n),K();return}if(!(i<0)){if(t.key===`ArrowDown`||t.key===`ArrowUp`){t.preventDefault(),V.current={index:i,vx:0,vy:t.key===`ArrowDown`?1500:-1e3},K();return}if(t.key===`Enter`||t.key===` `){let n=e[i];if(!n||!T)return;t.preventDefault(),T(i,n)}}},[G,T,a,r,e,K]),ke=e=>({left:W.cardLefts[e],top:W.cardTops[e],width:r,height:i,transform:`translate3d(0, 0, 0) rotate(${W.baseRots[e]}deg)`,"--pin-x":`${W.pinOffsets[e]}px`,"--pin-grip":`-13px`}),Ae={...O,width:dn(t),height:dn(n),"--rope-color":_,"--band-color":v??_,"--band-width":`${Math.max(1,d)}px`,"--pin-color":y,"--frame-color":b,...x?{"--clothesline-bg":x}:null};return(0,l.jsx)(`div`,{className:`${Y.clothesline} ${D??``}`,style:Ae,role:`region`,"aria-label":E,children:(0,l.jsx)(`div`,{ref:k,className:`${Y.viewport} ${ge?Y.pannable:``}`,onPointerDown:we,onPointerMove:Te,onPointerUp:Ee,onPointerCancel:De,onKeyDown:Oe,children:(0,l.jsxs)(`div`,{ref:A,className:Y.rail,style:{width:W.railWidth},children:[(0,l.jsxs)(`svg`,{className:Y.strings,width:W.railWidth,height:W.stageHeight,viewBox:`0 0 ${W.railWidth} ${W.stageHeight}`,"aria-hidden":`true`,children:[(0,l.jsx)(`path`,{ref:e=>{j.current[0]=e},className:Y.ropeShadow}),(0,l.jsx)(`path`,{ref:e=>{j.current[1]=e},className:Y.ropeShadowCore}),(0,l.jsx)(`path`,{ref:e=>{j.current[2]=e},className:Y.ropeBody}),(0,l.jsx)(`path`,{ref:e=>{j.current[3]=e},className:Y.ropeTwist}),e.map((e,t)=>(0,l.jsxs)(`g`,{children:[(0,l.jsx)(`path`,{ref:e=>{M.current[t]=e,L.current[t]=``},className:Y.bandBody}),(0,l.jsx)(`path`,{ref:e=>{N.current[t]=e},className:Y.bandGloss}),(0,l.jsx)(`circle`,{ref:e=>{P.current[t]=e},className:Y.bandKnot,r:4.2})]},`band-${e.src}-${t}`))]}),e.map((e,t)=>(0,l.jsxs)(`div`,{ref:e=>{F.current[t]=e,te.current[t]=``},className:Y.hanger,"data-photo-index":t,style:ke(t),tabIndex:0,role:T?`button`:`group`,"aria-label":e.title??e.alt??void 0,children:[(0,l.jsx)(`span`,{className:Y.pin,"aria-hidden":`true`,children:(0,l.jsx)(`span`,{className:Y.pinSpring})}),(0,l.jsxs)(`figure`,{className:Y.frame,children:[(0,l.jsx)(`span`,{className:Y.photo,children:(0,l.jsx)(`img`,{src:e.src,alt:e.alt??e.title??``,draggable:!1,style:{objectFit:S}})}),me&&(0,l.jsxs)(`figcaption`,{className:Y.caption,children:[e.title&&(0,l.jsx)(`strong`,{children:e.title}),e.description&&(0,l.jsx)(`span`,{children:e.description})]})]})]},`${e.src}-${t}`))]})})})},hn={plasmaBall:`cos-plasmaBall-xGHSj`,canvas:`cos-canvas-V1CgL`},gn=({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:hn.plasmaBall,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:hn.canvas,style:{width:e,height:t}})})},_n={smokeFog:`cos-smokeFog-SYlts`,canvas:`cos-canvas-iOJV7`},vn=10,yn=128,bn=`#d2d4d8`,xn=[`#14151c`,`#1a1b24`,`#0e0f14`],Sn=(e,t)=>{let n=Math.sin(e*127.1+t*311.7)*43758.5453;return n-Math.floor(n)},Cn=(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=Sn(n,r),l=Sn(n+1,r),u=Sn(n,r+1),d=Sn(n+1,r+1);return c+(l-c)*o+(u-c)*s+(c-l-u+d)*o*s},wn=(e,t)=>{let n=0,r=.5,i=1;for(let a=0;a<4;a++)n+=r*Cn(e*i,t*i),i*=2.05,r*=.5;return n},Tn=(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]},En=(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)],Dn=(e,t=1)=>t>=1?`rgb(${e[0]} ${e[1]} ${e[2]})`:`rgb(${e[0]} ${e[1]} ${e[2]} / ${t})`,On=e=>{if(Array.isArray(e)&&e.length>=3)return[e[0],e[1],e[2]];let t=Tn(typeof e==`string`?e:xn[2],[14,15,20]),n=En(t,[255,255,255],.06);return[Dn(En(t,[255,255,255],.1)),Dn(n),Dn(t)]},kn=(e,t)=>{let n=document.createElement(`canvas`);n.width=yn,n.height=yn;let r=n.getContext(`2d`),i=r.createImageData(yn,yn),a=i.data,o=yn/2,s=yn/2,c=yn*.48;for(let n=0;n<yn;n++)for(let r=0;r<yn;r++){let i=(r-o)/c,l=(n-s)/c,u=Math.hypot(i,l);if(u>1.15)continue;let d=wn(r*.045+e*17.1,n*.045+e*9.3)*.7+wn(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*yn+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},An=e=>Array.from({length:vn},(t,n)=>kn(n+1,e)),jn=(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()*vn),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()}},Mn=(e,t)=>{let n=Math.hypot(e.vx,e.vy);if(n<=t)return;let r=t/n;e.vx*=r,e.vy*=r},Nn=e=>e<.06?e/.06:e>.55?Math.max(0,1-(e-.55)/.45):1,Pn=(e,t)=>.22+Math.min(1,Math.max(0,e/t))**1.15*.78,Fn=({width:e=800,height:t=500,density:n=.5,color:r=bn,backgroundColor:i=xn,speed:a=1,disperseStrength:o=1,disperseRadius:s=1,interactive:u=!0,ariaLabel:d})=>{let f=(0,c.useRef)(null),p=(0,c.useRef)([]),m=(0,c.useRef)([]),h=(0,c.useRef)(null),g=(0,c.useRef)(``),_=(0,c.useRef)(0),v=(0,c.useRef)({speed:a,disperseStrength:o,disperseRadius:s,interactive:u,color:r,backgroundColor:i});(0,c.useEffect)(()=>{v.current={speed:a,disperseStrength:o,disperseRadius:s,interactive:u,color:r,backgroundColor:i}},[a,o,s,u,r,i]),(0,c.useEffect)(()=>{h.current=An(Tn(r,[210,212,216])),g.current=r},[r]),(0,c.useEffect)(()=>{let r=Math.floor(56+n*100);p.current=Array.from({length:r},()=>jn(e,t,Math.random()**1.75))},[n,t,e]);let x=(0,c.useCallback)((n,r)=>{let i=v.current;if(!i.interactive)return;let a=f.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);m.current.length>3&&m.current.shift(),m.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=f.current;if(!e)return;let t=e=>{e.pointerType===`mouse`&&e.button!==0||x(e.clientX,e.clientY)};return e.addEventListener(`pointerdown`,t),()=>e.removeEventListener(`pointerdown`,t)},[x]),(0,c.useEffect)(()=>{let n=f.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=Tn(v.current.color,[210,212,216]);h.current||(h.current=An(a),g.current=v.current.color);let o=h.current,s=0,c=document.hidden,l=y(e=>{c=e}),u=typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,d=()=>{let[n,r,a]=On(v.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=Tn(a,[14,15,20]),c=En(s,[255,255,255],.22),l=i.createRadialGradient(e*.5,t*.75,0,e*.5,t,e*.55);l.addColorStop(0,Dn(c,.35)),l.addColorStop(1,Dn(s,0)),i.fillStyle=l,i.fillRect(0,0,e,t)},x=e=>{let n=Nn(e.age)*Pn(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(_.current=requestAnimationFrame(S),c)return;let n=b(v.current.speed,0,3),r=b(v.current.disperseStrength,0,3);s+=.01*Math.max(n,.001),d(),g.current!==v.current.color&&(h.current=An(Tn(v.current.color,[210,212,216])),g.current=v.current.color);let a=h.current??o,l=p.current,u=m.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,Mn(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)*Pn(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]=jn(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=Nn(o.age)*Pn(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){d();for(let e of p.current)x(e);return i.globalCompositeOperation=`source-over`,i.globalAlpha=1,()=>{l()}}return S(),()=>{cancelAnimationFrame(_.current),l()}},[t,e]),(0,l.jsx)(`div`,{className:_n.smokeFog,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:f,className:_n.canvas,style:{width:e,height:t,cursor:u?`pointer`:`default`},role:`img`,"aria-label":d??(u?`烟雾背景,点击可驱散`:`烟雾背景`)})})},In=.82,Ln=.08,Rn=1e3/60,zn=46*2.6,Bn=()=>({x:-1e3,y:-1e3,prevX:-1e3,prevY:-1e3,vx:0,vy:0,speed:0,active:!1,lastTs:0}),Vn=e=>e<.5?2*e*e:1-(-2*e+2)**2/2,Hn=e=>1-(1-e)**3,Un=(e,t,n)=>{let r=Math.min(1,Math.max(0,(n-e)/(t-e)));return r*r*(3-2*r)},Z=(e,t)=>e**t,Wn=e=>{let t=Math.sin(e*127.1+311.7)*43758.5453;return t-Math.floor(t)},Gn=(e,t,n=!0)=>{let r=.18+(e/18)**.5*.52,i=n?.8+Math.random()*.35:1;return r*t*i},Kn=(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()},qn=(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()},Jn=(e,t,n,r,i)=>{let a=Math.min(70,Math.floor(t*n/22e3));for(let o=0;o<a;o++){let a=Wn(o+1),s=Wn(o+57),c=Wn(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},Yn=(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),Kn(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%)`]]),Kn(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%)`]]),Kn(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=Wn(r+3),a=Wn(r+11);Kn(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),Kn(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%)`]]),Kn(e,t*.28,n*1.02,t*.4,[[0,`rgb(0 3 6 / 28%)`],[1,`rgb(0 3 6 / 0%)`]]),Kn(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)},Xn=(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;qn(e,s,-n*.02,c,n*(.7+i%2*.12),.12+i%3*.04,l)}qn(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(),Jn(e,t,n,r,i)},Zn=()=>{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},Qn=(e,t)=>e.find(e=>e.id===t),$n=e=>{let t=e.progress,n=Vn(Un(0,.72,t)),r=Hn(Un(.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}},er=(e,t)=>{let n=new Map;for(let t of e){let e=`${Math.floor(t.x/zn)},${Math.floor(t.y/zn)}`,r=n.get(e);r?r.push(t):n.set(e,[t])}for(let r of e){let e=Math.floor(r.x/zn),i=Math.floor(r.y/zn);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)}}},tr=e=>{er(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})},nr=(e,t,n)=>{er(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)})},rr=(e,t,n,r)=>{let i=[];for(let a=0;a<t.length;a++){let o=t[a],s=Qn(e,o.primaryId),c=Qn(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=$n(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,Gn(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)},ir=(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=Gn(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}},ar=(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}),or=(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=ar(e.x,e.y,t);e.vx+=(e.drift*.015+u.x*.05)*i,e.vy+=u.y*.025*i,e.vx*=Z(.968,i),e.vy*=Z(.994,i),e.x+=(e.vx+u.x*.22)*i,e.y+=e.vy*i},sr=(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)}},cr=(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*=Z(.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*=Z(.997,t),e.mode3Phase+=(.04+Math.abs(e.mode3Vel)*.8)*t,e.streamStretch*=Z(.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)},lr=(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},ur=(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)},dr=(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=ur(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},fr=(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},pr=(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;fr(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}},mr=(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=pr(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)}},hr=(e,t,n,r,i,a)=>{let o=dr(t,n),s=Math.min(1,Math.max(0,t.y/a)),c=i*In,l=a*Ln,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},gr=(e,t,n,r,i,a,o,s,c,l,u)=>{let d=mr(t,n,r,i,a,o),f=Math.min(1,Math.max(0,d.cy/l)),p=c*In,m=l*Ln,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},_r={bubbleField:`cos-bubbleField-i9211`,canvas:`cos-canvas-8vKsT`},vr=({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)(Bn()),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=ir(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=Bn(),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||=Zn();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=Bn()},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=_/Rn,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),Yn(a,e,t,w),g.current={key:O,canvas:i})}g.current&&i.drawImage(g.current.canvas,0,0,e,t),Xn(i,e,t,C,c,a),p.current+=S,p.current>.2&&s.current.length<E&&(p.current=0,s.current.push(ir(m.current++,e,t,T)));let A=d.current;A.active&&(A.speed*=Z(.94,y),A.vx*=Z(.94,y),A.vy*=Z(.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*=Z(.92,y),n.settle*=Z(.93,y),n.settle>0&&(n.aspect+=(.985-n.aspect)*.08*y),n.settle<.01&&(n.settle=0),j.has(n.id))cr(n,y);else{or(n,C,t,T,y),cr(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*Z(.9,y)+Math.min(.35,(e-.55)*.08)*y),n.streamAngle=n.streamAngle*Z(.85,y)+t*(1-Z(.85,y))}}if(D&&A.active&&A.speed>.2&&!j.has(n.id)){let e=sr(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,lr(n,e.strain,e.strainAngle,e.excite,e.fx,e.fy)}}if(n.y+n.radius<-12){let r=ir(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));tr(M),nr(M,u.current,j),rr(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??$n(n),a=Math.min(.9,.55+r.absorb*.2);gr(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)||hr(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:_r.bubbleField,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:o,className:_r.canvas,style:{width:e,height:t}})})},yr={solarSystem:`cos-solarSystem-27h8F`,canvas:`cos-canvas-C0nRa`},br=[{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}],xr=({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=br.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:yr.solarSystem,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:yr.canvas,style:{width:e,height:t}})})},Sr={snowfall:`cos-snowfall-Q-Dhg`,canvas:`cos-canvas-bJVF8`},Cr=({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:Sr.snowfall,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:Sr.canvas,style:{width:e,height:t}})})},wr={starfield:`cos-starfield-QTwia`,canvas:`cos-canvas-C2t3g`},Tr=({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:wr.starfield,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:wr.canvas,style:{width:e,height:t}})})},Q={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`},Er=({progress:e=0,onOpen:t,label:n=`开启宝箱`,openedLabel:r=`宝箱已开启!`})=>{let i=(0,c.useRef)(!1),a=(0,c.useRef)(t),o=b(e,0,100),s=o>=100;return(0,c.useEffect)(()=>{a.current=t},[t]),(0,c.useEffect)(()=>{s&&!i.current&&(i.current=!0,a.current?.()),s||(i.current=!1)},[s]),(0,l.jsxs)(`div`,{className:Q.progressChest,children:[(0,l.jsxs)(`div`,{className:Q.barWrap,children:[(0,l.jsx)(`div`,{className:Q.barTrack,children:(0,l.jsx)(`div`,{className:Q.barFill,style:{width:`${o}%`}})}),(0,l.jsxs)(`span`,{className:Q.pct,children:[o.toFixed(0),`%`]})]}),(0,l.jsxs)(`div`,{className:`${Q.chest} ${s?Q.open:``}`,children:[(0,l.jsxs)(`div`,{className:Q.lid,children:[(0,l.jsx)(`div`,{className:Q.lidTop}),(0,l.jsx)(`div`,{className:Q.lock})]}),(0,l.jsx)(`div`,{className:Q.body,children:s&&(0,l.jsxs)(`div`,{className:Q.treasure,children:[(0,l.jsx)(`span`,{children:`💎`}),(0,l.jsx)(`span`,{children:`✨`}),(0,l.jsx)(`span`,{children:`🪙`})]})})]}),(0,l.jsx)(`p`,{className:Q.label,children:s?r:n})]})},Dr={radarScan:`cos-radarScan-PZaG8`,canvas:`cos-canvas-fUw5N`},Or=({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:Dr.radarScan,style:{width:e,height:e},children:(0,l.jsx)(`canvas`,{ref:r,className:Dr.canvas,style:{width:e,height:e}})})},kr={redPacketRain:`cos-redPacketRain-eJ7FW`,canvas:`cos-canvas-direH`,hud:`cos-hud-InqMq`,end:`cos-end-u0J7o`,hint:`cos-hint-sO6ld`},Ar=({duration:e=1e4,onGrab:t,grabbedLabel:n=`已抢:`,endedText:r=`红包雨结束`,hint:i=`点击红包抢夺`})=>{let a=(0,c.useRef)(null),o=(0,c.useRef)([]),s=(0,c.useRef)(0),u=(0,c.useRef)(0),d=(0,c.useRef)(0),[f,p]=(0,c.useState)(0),[m,h]=(0,c.useState)(!0),g=(0,c.useRef)(!0),_=(0,c.useRef)(t);(0,c.useEffect)(()=>{_.current=t},[t]),(0,c.useEffect)(()=>{g.current=m},[m]);let v=(0,c.useCallback)(()=>{o.current.push({id:u.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=a.current;if(!t)return;let n=window.devicePixelRatio||1;t.width=400*n,t.height=500*n;let r=t.getContext(`2d`);if(!r)return;r.setTransform(n,0,0,n,0,0);let i=document.hidden,c=y(e=>{i=e}),l=window.setTimeout(()=>{g.current=!1,h(!1)},e),u=()=>{s.current=requestAnimationFrame(u),!i&&(d.current++,g.current&&d.current%20==0&&v(),r.fillStyle=`rgb(15 23 42 / 20%)`,r.fillRect(0,0,400,500),o.current=o.current.filter(e=>e.grabbed?!1:(e.y+=e.speed,e.x+=Math.sin(e.y*.02)*.5,r.save(),r.translate(e.x,e.y),r.rotate(e.rotation),r.fillStyle=`#dc2626`,r.beginPath(),r.roundRect(-22,-28,44,56,6),r.fill(),r.fillStyle=`#fbbf24`,r.beginPath(),r.arc(0,-10,8,0,Math.PI*2),r.fill(),r.fillStyle=`#fde68a`,r.font=`bold 12px system-ui`,r.textAlign=`center`,r.fillText(`¥${e.amount}`,0,12),r.restore(),e.y<560)))};return u(),()=>{cancelAnimationFrame(s.current),clearTimeout(l),c()}},[e,v]),(0,l.jsxs)(`div`,{className:kr.redPacketRain,children:[(0,l.jsx)(`canvas`,{ref:a,className:kr.canvas,style:{width:400,height:500},onClick:e=>{let t=e.currentTarget.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top,i=!1;o.current=o.current.map(e=>e.grabbed||i?e:Math.abs(n-e.x)<30&&Math.abs(r-e.y)<35?(i=!0,p(t=>t+e.amount),_.current?.(e.amount),{...e,grabbed:!0}):e)}}),(0,l.jsxs)(`div`,{className:kr.hud,children:[(0,l.jsxs)(`span`,{children:[n,` ¥`,f]}),!m&&(0,l.jsx)(`span`,{className:kr.end,children:r})]}),(0,l.jsx)(`p`,{className:kr.hint,children:i})]})},jr={returnCityContainer:`cos-returnCityContainer-6XTxj`,star:`cos-star-a59Dx`,glassWrap:`cos-glassWrap-golMO`,rotate:`cos-rotate-7X9Jj`,glassItem:`cos-glassItem-OwlFI`},Mr=({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=jr.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=jr.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:jr.returnCityContainer,children:(0,l.jsx)(`div`,{ref:i,className:jr.glassWrap})})},Nr={ropeChain:`cos-ropeChain-gYaSK`,canvas:`cos-canvas-5i95N`},Pr=({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:Nr.ropeChain,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:a,className:Nr.canvas,style:{width:e,height:t}})})},Fr={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`},Ir=[`React`,`Motion`,`Design`,`COS`],Lr=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)},Rr=({texts:e=Ir,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:Ir,[e]),[u,d]=(0,c.useState)(0),[f,p]=(0,c.useState)(`enter`),m=(0,c.useMemo)(()=>Lr(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:Fr.rotatingText,children:(0,l.jsx)(`div`,{className:Fr.badge,style:{fontSize:i,color:a,"--rt-bg":o,"--rt-duration":`${r}ms`},children:m.map((e,t)=>(0,l.jsx)(`span`,{className:`${Fr.char} ${f===`enter`?Fr.enter:Fr.exit}`,style:{animationDelay:`${f===`enter`?t*n:(m.length-1-t)*n}ms`},children:e===` `?`\xA0`:e},`${s[u]}-${e}-${t}-${f}`))})})},zr={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`},Br=(e,t,n,r)=>{let i=(r-90)*Math.PI/180;return{x:e+n*Math.cos(i),y:t+n*Math.sin(i)}},Vr=({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=Br(100,100,72,-120),t=Br(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=Br(100,100,72,-120),t=Br(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=Br(100,100,58,i);return(0,l.jsxs)(`div`,{className:zr.speedometer,style:{"--gauge-color":r},children:[(0,l.jsxs)(`svg`,{viewBox:`0 0 200 130`,className:zr.svg,children:[(0,l.jsx)(`path`,{d:a,className:zr.track,fill:`none`,strokeWidth:`12`,strokeLinecap:`round`}),(0,l.jsx)(`path`,{d:o,className:zr.valueArc,fill:`none`,strokeWidth:`12`,strokeLinecap:`round`}),[-120,-60,0,60,120].map(e=>{let t=Br(100,100,58,e),n=Br(100,100,66,e);return(0,l.jsx)(`line`,{x1:t.x,y1:t.y,x2:n.x,y2:n.y,className:zr.tick},e)}),(0,l.jsx)(`line`,{x1:`100`,y1:`100`,x2:s.x,y2:s.y,className:zr.needle}),(0,l.jsx)(`circle`,{cx:`100`,cy:`100`,r:`6`,className:zr.hub}),(0,l.jsx)(`text`,{x:`100`,y:`118`,className:zr.valueText,children:Math.round(e)})]}),(0,l.jsx)(`span`,{className:zr.label,children:n})]})},Hr={shinyText:`cos-shinyText-L0KoE`,text:`cos-text-J5KhP`,"shine-sweep":`cos-shine-sweep-jIufI`,paused:`cos-paused-dqgKu`},Ur=({text:e=`SHINY TEXT`,speed:t=2,color:n=`#94a3b8`,shineColor:r=`#ffffff`,fontSize:i=64,disabled:a=!1})=>(0,l.jsx)(`div`,{className:Hr.shinyText,children:(0,l.jsx)(`span`,{className:`${Hr.text} ${a?Hr.paused:``}`,style:{fontSize:i,"--shiny-color":n,"--shiny-shine":r,"--shiny-duration":`${Math.max(t,.4)}s`},children:e})}),Wr={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`},Gr=({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:Wr.timelinePulse,style:{"--pulse-color":n,"--step-count":e.length,"--progress-ratio":i},children:(0,l.jsxs)(`div`,{className:Wr.axis,children:[(0,l.jsx)(`div`,{className:Wr.track}),(0,l.jsx)(`div`,{className:Wr.progress}),(0,l.jsx)(`ul`,{className:Wr.steps,children:e.map((e,t)=>{let n=t<r?`done`:t===r?`current`:`pending`;return(0,l.jsxs)(`li`,{className:Wr.step,"data-state":n,children:[(0,l.jsx)(`span`,{className:Wr.dot}),(0,l.jsx)(`span`,{className:Wr.name,children:e})]},e+t)})})]})})},Kr={rippleWater:`cos-rippleWater-wsinI`,canvas:`cos-canvas-XOdSF`,hint:`cos-hint-0JH5D`},qr=`
|
|
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"),u=require("three");u=s(u,1);var d={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`},f=({children:e,scanColor:t=`#22c55e`,speed:n=2.5})=>(0,l.jsxs)(`div`,{className:d.barcodeScan,style:{"--scan-color":t,"--scan-speed":`${n}s`},children:[(0,l.jsx)(`div`,{className:d.content,children:e??(0,l.jsx)(`span`,{className:d.placeholder,children:`SCAN ME`})}),(0,l.jsxs)(`div`,{className:d.overlay,children:[(0,l.jsx)(`div`,{className:d.scanLine}),(0,l.jsx)(`div`,{className:d.glitchLayer})]}),(0,l.jsxs)(`div`,{className:d.corners,children:[(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{})]})]}),p={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`},m=({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),f=(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=f.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:p.blurText,ref:f,children:(0,l.jsx)(`p`,{className:p.text,style:{fontSize:a,"--blur-color":o,"--blur-duration":`${i}ms`},children:h.map((e,i)=>(0,l.jsxs)(`span`,{className:`${p.unit} ${p[n]} ${u?p.enter:p.idle}`,style:{animationDelay:`${i*r}ms`},children:[e===` `?`\xA0`:e,t===`words`&&i<h.length-1?`\xA0`:null]},`${e}-${i}`))})})},h={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`},g=({text:e=`BURN`,fontSize:t=64,onComplete:n,completedText:r=`Gone.`})=>{let i=(0,c.useRef)(null),a=(0,c.useRef)(null),[o,s]=(0,c.useState)(!1),[u,d]=(0,c.useState)(!1),f=(0,c.useRef)(!1),p=(0,c.useRef)(n);(0,c.useEffect)(()=>{p.current=n},[n]);let m=(0,c.useCallback)(()=>{o||u||s(!0)},[o,u]);return(0,c.useEffect)(()=>{if(!o||u)return;let n=i.current,r=a.current;if(!n||!r)return;let s=n.getBoundingClientRect(),c=window.devicePixelRatio||1,l=Math.ceil(s.width),m=Math.ceil(s.height);r.width=l*c,r.height=m*c,r.style.width=`${l}px`,r.style.height=`${m}px`;let h=r.getContext(`2d`);if(!h)return;h.scale(c,c);let g=document.createElement(`canvas`);g.width=l*c,g.height=m*c;let _=g.getContext(`2d`);if(!_)return;_.scale(c,c),_.font=`900 ${t}px system-ui, sans-serif`,_.textAlign=`center`,_.textBaseline=`middle`,_.fillStyle=`#f8fafc`,_.fillText(e,l/2,m/2);let v=_.getImageData(0,0,l*c,m*c).data,y=[];for(let e=0;e<m;e+=4)for(let t=0;t<l;t+=4)v[(Math.floor(e*c)*l*c+Math.floor(t*c))*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,l,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||(d(!0),f.current||(f.current=!0,p.current?.()))};return b=requestAnimationFrame(e=>C(e,e)),()=>{S=!0,cancelAnimationFrame(b)}},[o,u,e,t]),(0,l.jsxs)(`div`,{className:h.burnAway,children:[(0,l.jsxs)(`div`,{ref:i,className:h.stage,children:[!u&&(0,l.jsx)(`span`,{className:h.text,style:{fontSize:t,opacity:+!o},children:e}),(0,l.jsx)(`canvas`,{ref:a,className:h.canvas})]}),!o&&!u&&(0,l.jsx)(`button`,{type:`button`,className:h.trigger,onClick:m,children:`Ignite`}),u&&(0,l.jsx)(`p`,{className:h.hint,children:r})]})},_={aurora:`cos-aurora-dJJb8`,band:`cos-band-S5CoR`,"aurora-flow":`cos-aurora-flow-wU8TY`},v=[`#00ff87`,`#60efff`,`#7b2ff7`,`#f107a3`],y=({width:e=800,height:t=500,colors:n=v})=>{let r=n.length>=2?n:v;return(0,l.jsx)(`div`,{className:_.aurora,style:{width:e,height:t},children:r.map((e,t)=>(0,l.jsx)(`div`,{className:_.band,style:{"--aurora-color":e,"--aurora-delay":`${t*-3}s`,"--aurora-duration":`${12+t*2}s`}},e+t))})},b=e=>{let t=()=>e(document.hidden);return document.addEventListener(`visibilitychange`,t),()=>document.removeEventListener(`visibilitychange`,t)},x=(e,t,n)=>Math.min(n,Math.max(t,e)),S={audioVisualizer:`cos-audioVisualizer-r5dHp`,canvas:`cos-canvas-UNEea`},C=({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=b(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:S.audioVisualizer,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:S.canvas,style:{width:e,height:t}})})},w={canvasClock:`cos-canvasClock-QvdV3`,canvasTarget:`cos-canvasTarget-x-odC`},T=({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=b(e=>{s=e}),l=()=>{s||o(i),a=requestAnimationFrame(l)};return l(),()=>{cancelAnimationFrame(a),c()}},[o,r]),(0,l.jsx)(`div`,{className:w.canvasClock,style:{width:r,height:r},children:(0,l.jsx)(`canvas`,{ref:n,className:w.canvasTarget,style:{width:r,height:r}})})},E={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`},D=15,O=258,k=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)(()=>x(t,0,100)),p=x(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-O);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:E.chargeContainer,"data-auto":i?`true`:`false`,style:{"--charge-pct":p},children:[(0,l.jsxs)(`div`,{className:E.contrast,children:[Array.from({length:D},(e,t)=>(0,l.jsx)(`span`,{className:E.bubble,"data-index":t+1},t)),(0,l.jsx)(`div`,{className:E.circle}),(0,l.jsx)(`div`,{className:E.button})]}),(0,l.jsxs)(`div`,{className:E.text,children:[g,`%`]})]})},A={circularText:`cos-circularText--zmER`,scaleWrap:`cos-scaleWrap-LiyQK`,bonkers:`cos-bonkers-Wovjy`,ring:`cos-ring-2amY8`,spin:`cos-spin-9njNq`,char:`cos-char-oPqHL`},j=({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:A.circularText,children:(0,l.jsx)(`div`,{className:`${A.scaleWrap} ${o&&n===`goBonkers`?A.bonkers:``}`,onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),children:(0,l.jsx)(`div`,{className:A.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:A.char,style:{transform:`rotate(${n}deg) translateY(-${i}px)`},children:e===` `?`\xA0`:e},`${e}-${t}`)})})})})},M={clickSpark:`cos-clickSpark-db9Om`,canvas:`cos-canvas-p9fnQ`,content:`cos-content-7uE4T`,hint:`cos-hint-UqpWX`},N=({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=b(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:M.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:M.canvas}),e&&(0,l.jsx)(`div`,{className:M.content,children:e}),!e&&(0,l.jsx)(`p`,{className:M.hint,children:`点击任意位置产生火花`})]})},P={confetti:`cos-confetti-MeNtU`,canvas:`cos-canvas-0T3Vs`,hint:`cos-hint-sGHEi`},F=[`#ff6b6b`,`#ffd93d`,`#6bcb77`,`#4d96ff`,`#a66cff`,`#ff85c0`,`#38bdf8`],I=()=>F[Math.floor(Math.random()*F.length)],L=(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:I(),width:Math.random()*8+4,height:Math.random()*6+3,alpha:1,gravity:Math.random()*.15+.12}})},R=(0,c.forwardRef)(({width:e=800,height:t=400,auto:n=!0,particleCount:r=120,hint:i=`点击画布再次喷射`},a)=>{let o=(0,c.useRef)(null),s=(0,c.useRef)([]),u=(0,c.useRef)(0),d=(0,c.useRef)({width:e,height:t,particleCount:r});d.current={width:e,height:t,particleCount:r};let f=(0,c.useCallback)(()=>{let{width:e,height:t,particleCount:n}=d.current;s.current.push(...L(e,t,n))},[]);return(0,c.useImperativeHandle)(a,()=>({burst:f}),[f]),(0,c.useEffect)(()=>{n&&f()},[n,f]),(0,c.useEffect)(()=>{let n=o.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 a=document.hidden,c=b(e=>{a=e}),l=()=>{u.current=requestAnimationFrame(l),!a&&(i.clearRect(0,0,e,t),s.current=s.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 l(),()=>{cancelAnimationFrame(u.current),c()}},[t,e]),(0,l.jsxs)(`div`,{className:P.confetti,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:o,className:P.canvas,style:{width:e,height:t},onClick:f}),(0,l.jsx)(`p`,{className:P.hint,children:i})]})});R.displayName=`Confetti`;var z={curvedLoop:`cos-curvedLoop-dtMD7`,svg:`cos-svg-YDyYF`,measure:`cos-measure-1lmnX`,pathText:`cos-pathText-SKIrW`},B=({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:z.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:z.svg,viewBox:`0 0 1440 120`,children:[(0,l.jsx)(`text`,{ref:u,xmlSpace:`preserve`,className:z.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:z.pathText,children:(0,l.jsx)(`textPath`,{ref:d,href:`#${g}`,startOffset:`${m}px`,xmlSpace:`preserve`,children:S})})]})})},V={cyberGrid:`cos-cyberGrid-VgJwl`,canvas:`cos-canvas--Mq-O`},H=({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=b(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:V.cyberGrid,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:V.canvas,style:{width:e,height:t}})})},U={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`},W=e=>e instanceof Date?e.getTime():typeof e==`number`?e:new Date(e).getTime(),G=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}},K={days:`天`,hours:`时`,minutes:`分`,seconds:`秒`},q=[{key:`days`},{key:`hours`},{key:`minutes`},{key:`seconds`}],J=({targetDate:e,onEnd:t,showLabels:n=!0,color:r=`#f472b6`,labels:i,invalidText:a=`无效的目标时间`,endedText:o=`时间到!`})=>{let s=(0,c.useMemo)(()=>W(e),[e]),u=!Number.isNaN(s),[,d]=(0,c.useState)(0),f=(0,c.useRef)(!1),p=(0,c.useRef)(t),m=u?G(s):{days:0,hours:0,minutes:0,seconds:0,total:0};return(0,c.useEffect)(()=>{p.current=t},[t]),(0,c.useEffect)(()=>{if(!u)return;if(f.current=!1,Date.now()>=s){f.current=!0,p.current?.();return}let e=window.setInterval(()=>{d(e=>e+1),Date.now()>=s&&!f.current&&(f.current=!0,p.current?.(),clearInterval(e))},1e3);return()=>clearInterval(e)},[u,s]),u?(0,l.jsxs)(`div`,{className:U.countdown,style:{"--countdown-color":r},children:[q.map(({key:e})=>(0,l.jsxs)(`div`,{className:U.unit,children:[(0,l.jsx)(`div`,{className:U.value,children:String(m[e]).padStart(2,`0`)}),n&&(0,l.jsx)(`span`,{className:U.label,children:i?.[e]??K[e]})]},e)),m.total<=0&&(0,l.jsx)(`p`,{className:U.ended,children:o})]}):(0,l.jsx)(`div`,{className:U.countdown,children:(0,l.jsx)(`p`,{className:U.invalid,children:a})})},Y={countUp:`cos-countUp-PKMgo`,glow:`cos-glow-oAz5z`,value:`cos-value-WDAyV`,valueWrap:`cos-valueWrap-AQoM4`,measure:`cos-measure-ZGRt4`,display:`cos-display-JHXA2`},ee=e=>1-(1-e)**3,te=(e,t)=>e.toLocaleString(`en-US`,{minimumFractionDigits:t,maximumFractionDigits:t}),ne=({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=ee(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}${te(s,r)}${a}`,[r,s,i,a]),m=(0,c.useMemo)(()=>{let n=[t,e].map(e=>`${i}${te(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:Y.countUp,style:{"--count-up-color":o},children:[(0,l.jsx)(`div`,{className:Y.glow}),(0,l.jsxs)(`div`,{className:Y.valueWrap,children:[(0,l.jsx)(`span`,{className:`${Y.value} ${Y.measure}`,children:m}),(0,l.jsx)(`span`,{className:`${Y.value} ${Y.display}`,children:p})]})]})},X={dnaHelix:`cos-dnaHelix-nEQLW`,canvas:`cos-canvas-uEV8B`},re=({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=b(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:X.dnaHelix,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:X.canvas,style:{width:e,height:t}})})},ie={electricArc:`cos-electricArc-BFlY3`,canvas:`cos-canvas-iowDx`},ae=(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=ae(e,t,o+f,s+p,i*.6,a-1),h=ae(o+f,s+p,n,r,i*.6,a-1);return[...m.slice(0,-1),...h]},oe=({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=b(e=>{d=e}),p=()=>{if(u=requestAnimationFrame(p),d)return;o.fillStyle=`#0f172a`,o.fillRect(0,0,e,t);let r=ae(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:ie.electricArc,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:r,className:ie.canvas,style:{width:e,height:t}})})},se={cursorTrail:`cos-cursorTrail-fpz5p`,canvas:`cos-canvas-Iuyp3`,hint:`cos-hint-9GLHx`},ce=({color:e=`#38bdf8`,length:t=20,width:n=800,height:r=400,hint:i=`移动鼠标查看粒子轨迹`})=>{let a=(0,c.useRef)(null),o=(0,c.useRef)([]),s=(0,c.useRef)({x:n/2,y:r/2}),u=(0,c.useRef)(0);return(0,c.useEffect)(()=>{let i=a.current;if(!i)return;let c=window.devicePixelRatio||1;i.width=n*c,i.height=r*c;let l=i.getContext(`2d`);if(!l)return;l.setTransform(c,0,0,c,0,0);let d=document.hidden,f=b(e=>{d=e}),p=()=>{if(u.current=requestAnimationFrame(p),d)return;let{x:i,y:a}=s.current;o.current.unshift({x:i,y:a,life:1}),o.current.length>t&&(o.current.length=t),l.fillStyle=`rgb(15 23 42 / 15%)`,l.fillRect(0,0,n,r);let c=o.current;for(let t=0;t<c.length;t++){let n=c[t],r=1-t/c.length,i=(1-t/c.length)*8+2;l.beginPath(),l.arc(n.x,n.y,i,0,Math.PI*2),l.fillStyle=e,l.globalAlpha=r*.8,l.fill()}l.globalAlpha=1};return p(),()=>{cancelAnimationFrame(u.current),f()}},[e,r,t,n]),(0,l.jsxs)(`div`,{className:se.cursorTrail,style:{width:n,height:r},children:[(0,l.jsx)(`canvas`,{ref:a,className:se.canvas,style:{width:n,height:r},onMouseMove:e=>{let t=e.currentTarget.getBoundingClientRect();s.current={x:e.clientX-t.left,y:e.clientY-t.top}}}),(0,l.jsx)(`p`,{className:se.hint,children:i})]})},le={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,rollText:n=`掷骰子`,rollingText:r=`掷骰中...`,resultPrefix:i=`点数:`})=>{let[a,o]=(0,c.useState)(!1),[s,u]=(0,c.useState)(1),[d,f]=(0,c.useState)({x:0,y:0,z:0}),p=(0,c.useRef)(e),m=(0,c.useRef)(0);(0,c.useEffect)(()=>{p.current=e},[e]),(0,c.useEffect)(()=>()=>clearTimeout(m.current),[]);let h=()=>{if(a)return;o(!0);let e=Math.floor(Math.random()*t)+1,n=ue[e]??ue[1],r=360*(3+Math.floor(Math.random()*3)),i=360*(3+Math.floor(Math.random()*3));f({x:n.x+r,y:n.y+i,z:Math.random()*360}),clearTimeout(m.current),m.current=window.setTimeout(()=>{u(e),o(!1),p.current?.(e)},1200)},g=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:le.dot,style:{left:`${e}%`,top:`${t}%`}},n));return(0,l.jsxs)(`div`,{className:le.diceRoll,children:[(0,l.jsx)(`div`,{className:le.scene,children:(0,l.jsx)(`div`,{className:`${le.cube} ${a?le.rolling:``}`,style:{transform:`rotateX(${d.x}deg) rotateY(${d.y}deg) rotateZ(${d.z}deg)`},children:[1,2,3,4,5,6].map(e=>(0,l.jsx)(`div`,{className:`${le.face} ${le[`face${e}`]}`,children:g(e)},e))})}),(0,l.jsx)(`button`,{type:`button`,className:le.rollBtn,onClick:h,disabled:a,children:a?r:n}),!a&&(0,l.jsxs)(`p`,{className:le.result,children:[i,` `,s]})]})},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,_=0,v=document.hidden,y=b(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(_),y()}},[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)((e,t)=>{let{width:n=800,height:r=500,auto:i=!0,hint:a=`点击画布燃放烟花`}=e,o=(0,c.useRef)(null),s=(0,c.useRef)([]),u=(0,c.useRef)(0),d=(0,c.useCallback)(e=>{let t=e??Math.random()*n*.6+n*.2;s.current.push({x:t,y:r,vy:-(Math.random()*4+6),targetY:Math.random()*r*.35+r*.15,color:ve(),exploded:!1,particles:[],age:0})},[r,n]);return(0,c.useImperativeHandle)(t,()=>({launch:d}),[d]),(0,c.useEffect)(()=>{let e=o.current;if(!e)return;let t=window.devicePixelRatio||1;e.width=n*t,e.height=r*t;let a=e.getContext(`2d`);if(!a)return;a.setTransform(t,0,0,t,0,0);let c=0,l=document.hidden,f=b(e=>{l=e}),p=()=>{u.current=requestAnimationFrame(p),!l&&(a.fillStyle=`rgb(15 23 42 / 25%)`,a.fillRect(0,0,n,r),s.current=s.current.filter(e=>{if(!e.exploded){e.age+=1,e.y+=e.vy,e.vy+=ge,a.beginPath(),a.arc(e.x,e.y,2.5,0,Math.PI*2),a.fillStyle=e.color,a.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:(a.beginPath(),a.arc(e.x,e.y,2,0,Math.PI*2),a.fillStyle=e.color,a.globalAlpha=e.alpha,a.fill(),a.globalAlpha=1,!0))),e.particles.length>0}))};return p(),i&&(c=window.setInterval(()=>d(),1200)),()=>{cancelAnimationFrame(u.current),clearInterval(c),f()}},[i,r,d,n]),(0,l.jsxs)(`div`,{className:me.fireworks,style:{width:n,height:r},children:[(0,l.jsx)(`canvas`,{ref:o,className:me.canvas,style:{width:n,height:r},onClick:e=>{let t=e.currentTarget.getBoundingClientRect();d(e.clientX-t.left)}}),(0,l.jsx)(`p`,{className:me.hint,children:a})]})});be.displayName=`Fireworks`;var xe={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`},Se=(e,t)=>Math.max(0,Math.floor(e)).toString().padStart(t,`0`).slice(-t),Ce=({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:xe.digit,style:{"--flip-color":t,"--flip-duration":`${n}ms`},children:(0,l.jsxs)(`div`,{className:`${xe.digitCard} ${i?xe.isFlipping:``}`,children:[(0,l.jsx)(`div`,{className:xe.staticTop,children:(0,l.jsx)(`span`,{children:u})}),(0,l.jsx)(`div`,{className:xe.staticBottom,children:(0,l.jsx)(`span`,{children:u})}),i&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`div`,{className:`${xe.flap} ${xe.flapTop}`,children:(0,l.jsx)(`span`,{children:o})}),(0,l.jsx)(`div`,{className:`${xe.flap} ${xe.flapBottom}`,children:(0,l.jsx)(`span`,{children:e})})]})]})})},we=({value:e,digits:t=4,color:n=`#38bdf8`,duration:r=600})=>{let i=Se(e,t).split(``);return(0,l.jsx)(`div`,{className:xe.flipCounter,children:i.map((e,t)=>(0,l.jsx)(Ce,{digit:e,color:n,duration:r},t))})},Te={fuzzyText:`cos-fuzzyText-AgND-`,canvas:`cos-canvas-CiG0H`},Ee=({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:Te.fuzzyText,children:(0,l.jsx)(`canvas`,{ref:u,className:Te.canvas})})},De={gradientFlow:`cos-gradientFlow-XhN16`,text:`cos-text-ORuqk`,flow:`cos-flow-9FzMA`},Oe=[`#ff00de`,`#7c3aed`,`#00f0ff`,`#38bdf8`,`#ff00de`],ke=({text:e=`GRADIENT`,colors:t=Oe,fontSize:n=64})=>{let r=t.length>=2?t.join(`, `):Oe.join(`, `);return(0,l.jsx)(`div`,{className:De.gradientFlow,children:(0,l.jsx)(`h1`,{className:De.text,style:{fontSize:n,backgroundImage:`linear-gradient(90deg, ${r})`},children:e})})},Ae={gameOfLife:`cos-gameOfLife-1i2nu`,canvas:`cos-canvas-urOjh`,toolbar:`cos-toolbar-GmcD1`,meta:`cos-meta-KLxCp`,actions:`cos-actions-l3sAu`,button:`cos-button-g0tCm`},je=(e,t,n)=>Math.min(n,Math.max(t,e)),Me=(e,t,n)=>Array.from({length:e},()=>Array.from({length:t},()=>+(Math.random()<n))),Ne=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},Pe=({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%)`,labels:s})=>{let u=(0,c.useRef)(null),d=Math.max(6,Math.floor(t/n)),f=Math.max(6,Math.floor(e/n)),p=je(i,.05,.7),[m,h]=(0,c.useState)(!0),[g,_]=(0,c.useState)(0),v=(0,c.useRef)(document.hidden),[y,x]=(0,c.useState)(()=>Me(d,f,p)),[S,C]=(0,c.useState)({rows:d,cols:f,density:p});(S.rows!==d||S.cols!==f||S.density!==p)&&(C({rows:d,cols:f,density:p}),x(Me(d,f,p)),_(0)),(0,c.useEffect)(()=>{let r=u.current;if(!r)return;let i=window.devicePixelRatio||1;r.width=e*i,r.height=t*i;let s=r.getContext(`2d`);if(!s)return;s.setTransform(i,0,0,i,0,0);let c=0,l=b(e=>{v.current=e}),p=()=>{s.fillStyle=`#020617`,s.fillRect(0,0,e,t);for(let e=0;e<d;e++)for(let t=0;t<f;t++){if(!y[e][t])continue;let r=t*n,i=e*n;s.fillStyle=a,s.fillRect(r+1,i+1,n-2,n-2);let o=s.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`),s.fillStyle=o,s.fillRect(r,i,n,n)}s.strokeStyle=o,s.lineWidth=1;for(let e=0;e<=f;e++)s.beginPath(),s.moveTo(e*n+.5,0),s.lineTo(e*n+.5,t),s.stroke();for(let t=0;t<=d;t++)s.beginPath(),s.moveTo(0,t*n+.5),s.lineTo(e,t*n+.5),s.stroke()},m=()=>{c=requestAnimationFrame(m),p()};return c=requestAnimationFrame(m),()=>{cancelAnimationFrame(c),l()}},[a,n,f,y,o,t,d,e]),(0,c.useEffect)(()=>{if(!m)return;let e=window.setInterval(()=>{v.current||(x(e=>Ne(e)),_(e=>e+1))},r);return()=>clearInterval(e)},[m,r]);let w=(0,c.useMemo)(()=>y.reduce((e,t)=>e+t.reduce((e,t)=>e+t,0),0),[y]),T=()=>{x(Me(d,f,p)),_(0)},E=(e,t,r)=>{let i=Math.floor((e-r.left)/n),a=Math.floor((t-r.top)/n);a<0||a>=d||i<0||i>=f||(x(e=>e.map((e,t)=>t===a?e.map((e,t)=>t===i?+!e:e):e)),_(e=>e+1))};return(0,l.jsxs)(`div`,{className:Ae.gameOfLife,style:{width:e},children:[(0,l.jsx)(`canvas`,{ref:u,className:Ae.canvas,style:{width:e,height:t},onClick:e=>E(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect())}),(0,l.jsxs)(`div`,{className:Ae.toolbar,children:[(0,l.jsxs)(`div`,{className:Ae.meta,children:[(0,l.jsxs)(`span`,{children:[s?.generation??`Generation`,` `,g]}),(0,l.jsxs)(`span`,{children:[w,` `,s?.alive??`alive`]})]}),(0,l.jsxs)(`div`,{className:Ae.actions,children:[(0,l.jsx)(`button`,{type:`button`,className:Ae.button,onClick:()=>h(e=>!e),children:m?s?.pause??`Pause`:s?.play??`Play`}),(0,l.jsx)(`button`,{type:`button`,className:Ae.button,onClick:T,children:s?.randomize??`Randomize`})]})]})]})},Fe={glitchText:`cos-glitchText-dZ-sR`,text:`cos-text-JsPHN`,"glitch-1":`cos-glitch-1-s9pqH`,"glitch-2":`cos-glitch-2-GhFB-`},Ie=({text:e=`GLITCH`,color:t=`#f8fafc`,glitchColor1:n=`#ff00de`,glitchColor2:r=`#00f0ff`,fontSize:i=64})=>(0,l.jsx)(`div`,{className:Fe.glitchText,children:(0,l.jsx)(`h1`,{className:Fe.text,"data-text":e,style:{fontSize:i,"--glitch-color":t,"--glitch-c1":n,"--glitch-c2":r},children:e})}),Le={gravityBalls:`cos-gravityBalls-LdwFo`,canvas:`cos-canvas-n7esd`},Re=[`#38bdf8`,`#a78bfa`,`#f472b6`,`#4ade80`,`#fbbf24`],ze=({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:Re[Math.floor(Math.random()*Re.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=b(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:Le.gravityBalls,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:r,className:Le.canvas,style:{width:e,height:t}})})},Be={wrap:`cos-wrap-r1gGL`,card:`cos-card-3W10s`,shine:`cos-shine-0xjID`,image:`cos-image-AV2XG`,placeholder:`cos-placeholder-wuuL3`,info:`cos-info-CNR0r`},Ve=({title:e=`全息卡片`,subtitle:t=`移动鼠标体验 3D 效果`,image:n})=>{let r=(0,c.useRef)(null);return(0,l.jsx)(`div`,{className:Be.wrap,children:(0,l.jsxs)(`div`,{ref:r,className:Be.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:Be.shine}),n?(0,l.jsx)(`img`,{src:n,alt:e,className:Be.image}):(0,l.jsx)(`div`,{className:Be.placeholder,children:(0,l.jsx)(`span`,{children:`✦`})}),(0,l.jsxs)(`div`,{className:Be.info,children:[(0,l.jsx)(`h3`,{children:e}),(0,l.jsx)(`p`,{children:t})]})]})})},He={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`},Ue=({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=x(t>0?e/t*100:0,0,100),s=100-o;return(0,c.useEffect)(()=>{let e=0,t=0,n=document.hidden,r=b(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:He.liquidProgress,style:{width:n,height:n,"--liquid-color":r},children:[(0,l.jsxs)(`svg`,{viewBox:`0 0 100 100`,className:He.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:He.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:He.fillBg}),(0,l.jsx)(`path`,{ref:i,className:He.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:He.ring,strokeWidth:10,fill:`none`})]}),(0,l.jsxs)(`span`,{className:He.label,children:[Math.round(o),`%`]})]})},We={lorenzAttractor:`cos-lorenzAttractor--UAI7`,canvas:`cos-canvas-oeXce`},Ge=({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,_=b(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}},y=()=>{if(h=requestAnimationFrame(y),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),y(),()=>{cancelAnimationFrame(h),_()}},[r,t,i,n,e]),(0,l.jsx)(`div`,{className:We.lorenzAttractor,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:a,className:We.canvas,style:{width:e,height:t}})})},Ke={liquidGlass:`cos-liquidGlass-Z3bQg`,panel:`cos-panel-XYboD`,content:`cos-content-MHfkS`},qe=({children:e=`液态玻璃面板`,blur:t=16,borderRadius:n=20})=>(0,l.jsx)(`div`,{className:Ke.liquidGlass,children:(0,l.jsx)(`div`,{className:Ke.panel,style:{"--glass-blur":`${t}px`,"--glass-radius":`${n}px`},children:(0,l.jsx)(`div`,{className:Ke.content,children:e})})}),Je={magneticButton:`cos-magneticButton-GbRkE`,btn:`cos-btn--b2BJ`},Ye=({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:Je.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:Je.btn,style:{"--btn-color":n},children:e})})},Xe={matrixRain:`cos-matrixRain-qg9HC`,canvas:`cos-canvas--AvpG`,overlay:`cos-overlay-knj3b`,title:`cos-title-sDfhs`,flicker:`cos-flicker-smHxl`,subtitle:`cos-subtitle-CWheW`},Ze=`ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*アイウエオカキクケコ`,Qe=({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=b(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=Ze[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:Xe.matrixRain,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:s,className:Xe.canvas,style:{width:e,height:t}}),i&&(0,l.jsxs)(`div`,{className:Xe.overlay,children:[(0,l.jsx)(`h2`,{className:Xe.title,children:a}),(0,l.jsx)(`p`,{className:Xe.subtitle,children:o})]})]})},$e={metaballPool:`cos-metaballPool-JJaI9`,canvas:`cos-canvas-S7fDD`},et=({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,y=b(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+x((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(),n.removeEventListener(`mousemove`,h),n.removeEventListener(`mouseleave`,m),n.removeEventListener(`touchmove`,g),n.removeEventListener(`touchend`,m)}},[r,t,e]),(0,l.jsx)(`div`,{className:$e.metaballPool,style:{width:e,height:t,"--pool-color":r},children:(0,l.jsx)(`canvas`,{ref:i,className:$e.canvas,style:{width:e,height:t}})})},tt={mazeGenerator:`cos-mazeGenerator-QEa0s`,canvas:`cos-canvas-emhxb`},nt=({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=b(e=>{_=e}),y=()=>{if(_){m=requestAnimationFrame(y);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(y))};return y(),()=>{cancelAnimationFrame(m),v()}},[n,t,e]),(0,l.jsx)(`div`,{className:tt.mazeGenerator,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:tt.canvas,style:{width:e,height:t}})})},rt={meteorRain:`cos-meteorRain-v8RNI`,canvas:`cos-canvas-hyFMr`},it=({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=b(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:rt.meteorRain,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:r,className:rt.canvas,style:{width:e,height:t}})})},at={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`},ot=[{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`}],st=[{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`}],ct=6,lt=`ui-sans-serif, system-ui, -apple-system, sans-serif`,ut=(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)})`},dt=(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},ft=({width:e=600,height:t=420,nodes:n=ot,edges:r=st,linkColor:i=`rgb(148 163 184 / 35%)`,nodeRadius:a=20,hint:o=`拖拽节点 · 悬停查看关联`})=>{let s=(0,c.useRef)(null),u=(0,c.useRef)([]),d=(0,c.useRef)(null),f=(0,c.useRef)(null),[p,m]=(0,c.useState)(`default`),[h,g]=(0,c.useState)(o);(0,c.useEffect)(()=>{d.current||g(o)},[o]);let _=(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){u.current=[];return}let r=new Map(u.current.map(e=>[e.id,e]));u.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=s.current;if(!n)return;let o=Math.min(window.devicePixelRatio||1,2);n.width=e*o,n.height=t*o;let c=n.getContext(`2d`);if(!c)return;c.setTransform(o,0,0,o,0,0);let l=0,p=document.hidden,m=b(e=>{p=e}),h=()=>{let e=new Map;return u.current.forEach(t=>e.set(t.id,t)),e},g=(e,t)=>!t||e===t?!0:_.get(t)?.has(e)??!1,v=()=>{let n=u.current,i=h(),o=.92,s=.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)*s,r.vy+=(t/2-r.y)*s,r.vx*=o,r.vy*=o,f.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)))},y=()=>{let n=c.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`),c.fillStyle=n,c.fillRect(0,0,e,t),c.fillStyle=`rgb(148 163 184 / 7%)`;for(let n=28;n<e;n+=28)for(let e=28;e<t;e+=28)c.beginPath(),c.arc(n,e,.7,0,Math.PI*2),c.fill();let r=c.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%)`),c.fillStyle=r,c.fillRect(0,0,e,t)},x=(e,t,n,r)=>{let o=t.x-e.x,s=t.y-e.y,l=Math.sqrt(o*o+s*s)||1,u=o/l,d=s/l,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=c.createLinearGradient(p,m,h,g);n?(y.addColorStop(0,dt(e.color,.85)),y.addColorStop(.5,dt(ut(e.color,t.color,.5),.55)),y.addColorStop(1,dt(t.color,.85)),c.lineWidth=2.4,c.shadowColor=dt(ut(e.color,t.color,.5),.45),c.shadowBlur=10):r?(y.addColorStop(0,dt(i,.12)),y.addColorStop(.5,dt(i,.08)),y.addColorStop(1,dt(i,.12)),c.lineWidth=1,c.shadowBlur=0):(y.addColorStop(0,dt(i,.15)),y.addColorStop(.5,i),y.addColorStop(1,dt(i,.15)),c.lineWidth=1.35,c.shadowBlur=0),c.strokeStyle=y,c.lineCap=`round`,c.beginPath(),c.moveTo(p,m),c.quadraticCurveTo(_+d*4,v-u*4,h,g),c.stroke(),c.shadowBlur=0},S=(e,n,r)=>{let i=g(e.id,n),o=n===e.id,s=r&&f.current?.node===e,l=a*(o||s?1.12:i||!n?1:.94),u=!n||i?1:.28;c.save(),c.globalAlpha=u,c.beginPath(),c.arc(e.x,e.y,l+(o||s?10:6),0,Math.PI*2),c.fillStyle=dt(e.color,o||s?.22:.12),c.fill(),c.shadowColor=dt(e.color,o||s?.75:.45),c.shadowBlur=o||s?22:14;let d=c.createRadialGradient(e.x-l*.28,e.y-l*.32,l*.1,e.x,e.y,l);d.addColorStop(0,ut(e.color,`#ffffff`,.55)),d.addColorStop(.55,e.color),d.addColorStop(1,ut(e.color,`#0f172a`,.35)),c.beginPath(),c.arc(e.x,e.y,l,0,Math.PI*2),c.fillStyle=d,c.fill(),c.shadowBlur=0,c.strokeStyle=o||s?`rgb(255 255 255 / 70%)`:`rgb(255 255 255 / 28%)`,c.lineWidth=o||s?1.6:1.1,c.stroke();let p=Math.max(10,Math.min(13,Math.round(a*.58)));c.font=`500 ${p}px ${lt}`,c.textAlign=`center`,c.textBaseline=`middle`;let m=e.label,h=c.measureText(m).width+16,_=p+8,v=e.x-h/2,y=Math.min(t-_-4,e.y+l+8);c.beginPath();let b=_/2;c.moveTo(v+b,y),c.arcTo(v+h,y,v+h,y+_,b),c.arcTo(v+h,y+_,v,y+_,b),c.arcTo(v,y+_,v,y,b),c.arcTo(v,y,v+h,y,b),c.closePath(),c.fillStyle=o||s?`rgb(15 23 42 / 78%)`:`rgb(15 23 42 / 55%)`,c.fill(),c.strokeStyle=`rgb(255 255 255 / 10%)`,c.lineWidth=1,c.stroke(),c.fillStyle=`#f8fafc`,c.fillText(m,e.x,y+_/2),c.restore()},C=()=>{y();let e=h(),t=f.current?.node.id??d.current,n=!!f.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=[...u.current].sort((e,n)=>(e.id===t?2:+!!g(e.id,t))-(n.id===t?2:+!!g(n.id,t)));for(let e of i)S(e,t,n)},w=()=>{l=requestAnimationFrame(w),!p&&(v(),C())};return l=requestAnimationFrame(w),()=>{cancelAnimationFrame(l),m()}},[_,r,t,i,a,e]);let v=(e,t,n)=>{let r=e-n.left,i=t-n.top,o=a+ct,s=null,c=o*o;for(let e of u.current){let t=(e.x-r)**2+(e.y-i)**2;t<=c&&(c=t,s=e)}return s},y=e=>{d.current=e?.id??null,g(e?e.label:o)},x=e=>{if(e.pointerType===`mouse`&&e.button!==0)return;let t=e.currentTarget.getBoundingClientRect(),n=v(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;f.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,y(n),m(`grabbing`)},S=n=>{let r=n.currentTarget.getBoundingClientRect(),i=n.clientX-r.left,o=n.clientY-r.top;if(f.current){n.pointerType===`touch`&&n.preventDefault();let{node:r,offsetX:s,offsetY:c}=f.current,l=Math.max(a,Math.min(e-a,i+s)),u=Math.max(a,Math.min(t-a,o+c));f.current.vx=l-f.current.lastX,f.current.vy=u-f.current.lastY,f.current.lastX=l,f.current.lastY=u,r.x=l,r.y=u,r.vx=0,r.vy=0,m(`grabbing`);return}let s=v(n.clientX,n.clientY,r);y(s),m(s?`grab`:`default`)},C=e=>{let t=f.current;t&&(t.node.vx=t.vx*.85,t.node.vy=t.vy*.85,f.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId));let n=e.currentTarget.getBoundingClientRect(),r=v(e.clientX,e.clientY,n);y(r),m(r?`grab`:`default`)},w=()=>{f.current||(y(null),m(`default`))},T=p===`grabbing`?at.cursorGrabbing:p===`grab`?at.cursorGrab:at.cursorDefault;return(0,l.jsxs)(`div`,{className:at.networkGraph,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:s,className:`${at.canvas} ${T}`,style:{width:e,height:t},onPointerDown:x,onPointerMove:S,onPointerUp:C,onPointerCancel:C,onPointerLeave:w}),(0,l.jsx)(`div`,{className:at.hint,children:h})]})},pt={neonText:`cos-neonText-JMP7i`,text:`cos-text-GTO-0`,flicker:`cos-flicker-nXceV`,"neon-flicker":`cos-neon-flicker-uDkmM`,reflection:`cos-reflection-aEYj6`},mt=({text:e=`NEON`,color:t=`#ff00de`,fontSize:n=72,flicker:r=!0})=>(0,l.jsxs)(`div`,{className:pt.neonText,children:[(0,l.jsx)(`h1`,{className:`${pt.text} ${r?pt.flicker:``}`,style:{fontSize:n,"--neon-color":t},children:e}),(0,l.jsx)(`p`,{className:pt.reflection,style:{fontSize:n*.35,color:t},children:e})]}),ht={newtonCradle:`cos-newtonCradle-mFl-b`,canvas:`cos-canvas-TWKl5`},gt=({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)},y=0,x=document.hidden,S=b(e=>{x=e}),C=()=>{if(y=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(y),S()}},[t,a,r,n]),(0,l.jsx)(`div`,{className:ht.newtonCradle,style:{width:n,height:r,"--ball-color":t},children:(0,l.jsx)(`canvas`,{ref:i,className:ht.canvas,style:{width:n,height:r}})})},_t={orbitalChart:`cos-orbitalChart-XLORB`,canvas:`cos-canvas-hGVud`,legend:`cos-legend-Np9Mm`,swatch:`cos-swatch-xEKvA`},vt=[{label:`A`,value:30,color:`#38bdf8`},{label:`B`,value:25,color:`#a78bfa`},{label:`C`,value:20,color:`#f472b6`},{label:`D`,value:25,color:`#4ade80`}],yt=({data:e=vt,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=b(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=x(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:_t.orbitalChart,style:{width:t,height:t},children:[(0,l.jsx)(`canvas`,{ref:n,className:_t.canvas,style:{width:t,height:t}}),(0,l.jsx)(`ul`,{className:_t.legend,children:e.map(e=>(0,l.jsxs)(`li`,{children:[(0,l.jsx)(`span`,{className:_t.swatch,style:{background:e.color}}),e.label,` (`,e.value,`)`]},e.label))})]})},bt={particleNetwork:`cos-particleNetwork-GSZq-`,canvas:`cos-canvas-E-BGP`,hint:`cos-hint-LEO5o`},xt=({width:e=800,height:t=500,particleCount:n=60,linkDistance:r=120,repelRadius:i=150,color:a=`#38bdf8`,hint:o=`移动鼠标或手指与粒子互动`})=>{let s=(0,c.useRef)(null),u=(0,c.useRef)([]),d=(0,c.useRef)({x:-1e3,y:-1e3}),f=(0,c.useCallback)(()=>{u.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)(()=>{f()},[f]),(0,c.useEffect)(()=>{let n=s.current;if(!n)return;let o=window.devicePixelRatio||1;n.width=e*o,n.height=t*o;let c=n.getContext(`2d`);if(!c)return;c.setTransform(o,0,0,o,0,0);let l=0,f=document.hidden,p=b(e=>{f=e}),m=()=>{if(f){l=requestAnimationFrame(m);return}c.fillStyle=`#0f172a`,c.fillRect(0,0,e,t);let n=u.current,o=d.current,s=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<s&&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);c.beginPath(),c.moveTo(n[e].x,n[e].y),c.lineTo(n[t].x,n[t].y),c.strokeStyle=a,c.globalAlpha=1-i/r,c.lineWidth=.8,c.stroke(),c.globalAlpha=1}}n.forEach(e=>{c.beginPath(),c.arc(e.x,e.y,e.radius,0,Math.PI*2),c.fillStyle=a,c.fill()}),l=requestAnimationFrame(m)};return m(),()=>{cancelAnimationFrame(l),p()}},[a,t,f,r,i,e]);let p=(e,t,n)=>{d.current={x:e-n.left,y:t-n.top}},m=e=>{p(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect())},h=e=>{let t=e.touches[0];t&&p(t.clientX,t.clientY,e.currentTarget.getBoundingClientRect())},g=()=>{d.current={x:-1e3,y:-1e3}};return(0,l.jsxs)(`div`,{className:bt.particleNetwork,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:s,className:bt.canvas,style:{width:e,height:t},onMouseMove:m,onMouseLeave:g,onTouchMove:h,onTouchEnd:g}),(0,l.jsx)(`p`,{className:bt.hint,children:o})]})},Z={album:`cos-album-YDP44`,bookShadow:`cos-bookShadow-OTRJk`,stage:`cos-stage-0AOoU`,cover:`cos-cover-NgXqj`,coverEdgeTop:`cos-coverEdgeTop-6c9-Y`,coverEdgeSide:`cos-coverEdgeSide-P3osy`,pageStackLeft:`cos-pageStackLeft-tSbY2`,pageStackRight:`cos-pageStackRight-LHEJf`,book:`cos-book-KzrR1`,bookGutter:`cos-bookGutter-Wzw-P`,staticPage:`cos-staticPage-FxIfo`,turningPage:`cos-turningPage-dHWFc`,leftPage:`cos-leftPage-4Mlvj`,rightPage:`cos-rightPage-F4FGx`,gutterShade:`cos-gutterShade-KRm-E`,punchHoles:`cos-punchHoles-wFJEa`,punchLeft:`cos-punchLeft-GqHzv`,punchRight:`cos-punchRight-mjt9r`,punchHole:`cos-punchHole-f103b`,pageContent:`cos-pageContent-zI3p7`,photoMount:`cos-photoMount-xpDXf`,front:`cos-front-UroYj`,caption:`cos-caption-I0FZJ`,pageNumber:`cos-pageNumber-lEKVd`,back:`cos-back-8entC`,flyleaf:`cos-flyleaf-BiH6K`,flyleafCorner:`cos-flyleafCorner--pzLp`,flyleafCornerTl:`cos-flyleafCornerTl-AN5MS`,flyleafCornerTr:`cos-flyleafCornerTr-cbwv-`,flyleafCornerBl:`cos-flyleafCornerBl-iE60j`,flyleafCornerBr:`cos-flyleafCornerBr-QOzhA`,flyleafInner:`cos-flyleafInner-VJVEj`,flyleafMotif:`cos-flyleafMotif-TC3K5`,flyleafTitle:`cos-flyleafTitle-IIuP4`,flyleafSubtitle:`cos-flyleafSubtitle-jCr9V`,flyleafRule:`cos-flyleafRule-d7XA2`,face:`cos-face-lgVVG`,faceSheet:`cos-faceSheet--UI-p`,turnNextReady:`cos-turnNextReady-cvD3P`,turnPreviousReady:`cos-turnPreviousReady-kIHfq`,turnNext:`cos-turnNext-xt9ZK`,turnPrevious:`cos-turnPrevious-jjvaP`,wireBindingBack:`cos-wireBindingBack-kw-Ci`,wireBindingFront:`cos-wireBindingFront-bK9x5`,wireRingBack:`cos-wireRingBack-R26lf`,wireRingFront:`cos-wireRingFront-i2S1H`,hitArea:`cos-hitArea-NoHZa`,previousArea:`cos-previousArea-ZHppX`,nextArea:`cos-nextArea-eDUTE`,empty:`cos-empty-DOpsx`},St=new Set,Ct=e=>{if(!e||typeof Image>`u`||St.has(e))return;St.add(e);let t=new Image;t.src=e,t.decode?.().catch(()=>{})},wt=e=>typeof e==`number`?`${e}px`:e,Tt=(e,t)=>Math.max(0,Math.min(Math.floor(e),Math.max(0,t))),Et=()=>(0,l.jsx)(`svg`,{className:Z.flyleafMotif,viewBox:`0 0 120 120`,"aria-hidden":`true`,children:(0,l.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeWidth:`1.1`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,l.jsx)(`circle`,{cx:`60`,cy:`60`,r:`46`}),(0,l.jsx)(`path`,{d:`M60 14 L106 60 L60 106 L14 60 Z`}),(0,l.jsx)(`circle`,{cx:`60`,cy:`60`,r:`28`}),(0,l.jsx)(`path`,{d:`M60 32 L88 60 L60 88 L32 60 Z`}),(0,l.jsx)(`path`,{d:`M60 20 V40 M60 80 V100 M20 60 H40 M80 60 H100`}),(0,l.jsx)(`path`,{d:`M34 34 L46 46 M86 34 L74 46 M34 86 L46 74 M86 86 L74 74`}),(0,l.jsx)(`path`,{d:`M60 50 L70 60 L60 70 L50 60 Z`}),(0,l.jsx)(`path`,{d:`M60 8 L63 14 L60 20 L57 14 Z`}),(0,l.jsx)(`path`,{d:`M60 100 L63 106 L60 112 L57 106 Z`}),(0,l.jsx)(`path`,{d:`M8 60 L14 63 L20 60 L14 57 Z`}),(0,l.jsx)(`path`,{d:`M100 60 L106 63 L112 60 L106 57 Z`})]})}),Dt=32,Ot=4,kt=28,At=.916,jt={previous:`Previous photo`,next:`Next photo`,empty:`No photos`,flyleafTitle:`Photo Album`,flyleafSubtitle:`Turn the page to begin`,flyleafEndTitle:`The End`,flyleafEndSubtitle:`Thank you for browsing`},Mt=e=>{if(!Number.isFinite(e)||e<=0)return 16;let t=e*At;return Math.max(Ot,Math.min(kt,Math.round(t/Dt)))},Nt=(e,t)=>`${(e+.55)/t*100}%`,Pt=({photo:e,index:t,total:n,objectFit:r,showPageNumber:i,pageColor:a,flyleafTitle:o,flyleafSubtitle:s,flyleafEndTitle:c,flyleafEndSubtitle:u})=>{let d=t<0,f=d?o:c,p=d?s:u;return(0,l.jsx)(`div`,{className:Z.pageContent,style:{backgroundColor:a},children:e?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`div`,{className:Z.photoMount,children:(0,l.jsx)(`img`,{src:e.src,alt:e.alt??e.title??``,draggable:!1,style:{objectFit:r}})}),(e.title||e.description)&&(0,l.jsxs)(`div`,{className:Z.caption,children:[e.title&&(0,l.jsx)(`strong`,{children:e.title}),e.description&&(0,l.jsx)(`span`,{children:e.description})]}),i&&(0,l.jsx)(`span`,{className:Z.pageNumber,children:`${t+1} / ${n}`})]}):(0,l.jsxs)(`div`,{className:Z.flyleaf,children:[(0,l.jsx)(`span`,{className:`${Z.flyleafCorner} ${Z.flyleafCornerTl}`,"aria-hidden":`true`}),(0,l.jsx)(`span`,{className:`${Z.flyleafCorner} ${Z.flyleafCornerTr}`,"aria-hidden":`true`}),(0,l.jsx)(`span`,{className:`${Z.flyleafCorner} ${Z.flyleafCornerBl}`,"aria-hidden":`true`}),(0,l.jsx)(`span`,{className:`${Z.flyleafCorner} ${Z.flyleafCornerBr}`,"aria-hidden":`true`}),(0,l.jsxs)(`div`,{className:Z.flyleafInner,children:[(0,l.jsx)(`span`,{className:Z.flyleafRule,"aria-hidden":`true`}),(0,l.jsx)(Et,{}),(0,l.jsx)(`p`,{className:Z.flyleafTitle,children:f}),(0,l.jsx)(`p`,{className:Z.flyleafSubtitle,children:p}),(0,l.jsx)(`span`,{className:Z.flyleafRule,"aria-hidden":`true`})]})]})})},Ft=({side:e,count:t})=>(0,l.jsx)(`div`,{className:`${Z.punchHoles} ${e===`left`?Z.punchLeft:Z.punchRight}`,"aria-hidden":`true`,children:Array.from({length:t},(e,n)=>(0,l.jsx)(`span`,{className:Z.punchHole,style:{top:Nt(n,t)}},n))}),It=({count:e,variant:t})=>{let n=t===`back`?Z.wireRingBack:Z.wireRingFront;return(0,l.jsx)(`div`,{className:t===`back`?Z.wireBindingBack:Z.wireBindingFront,"aria-hidden":`true`,children:Array.from({length:e},(t,r)=>(0,l.jsx)(`span`,{className:n,style:{top:Nt(r,e)}},r))})},Lt=({photos:e,width:t=920,height:n=560,initialIndex:r=0,pageTurnDuration:i=760,objectFit:a=`cover`,showPageNumber:o=!0,pageColor:s=`#f2ead8`,coverColor:u=`#4a3025`,ariaLabel:d=`Photo album`,labels:f,onPageChange:p,className:m,style:h})=>{let[g,_]=(0,c.useState)(()=>Tt(r,e.length)),[v,y]=(0,c.useState)(null),[b,x]=(0,c.useState)(()=>typeof n==`number`?Mt(n):16),S=Tt(g,e.length),C=Math.max(180,i),w={previous:f?.previous??jt.previous,next:f?.next??jt.next,empty:f?.empty??jt.empty,flyleafTitle:f?.flyleafTitle??jt.flyleafTitle,flyleafSubtitle:f?.flyleafSubtitle??jt.flyleafSubtitle,flyleafEndTitle:f?.flyleafEndTitle??jt.flyleafEndTitle,flyleafEndSubtitle:f?.flyleafEndSubtitle??jt.flyleafEndSubtitle},T=(0,c.useRef)(v),E=(0,c.useRef)(!1),D=(0,c.useRef)(0),O=(0,c.useRef)(null),k=(0,c.useRef)(null),A=(0,c.useRef)([]),j=(0,c.useCallback)(()=>{A.current.forEach(e=>window.cancelAnimationFrame(e)),A.current=[]},[]);(0,c.useEffect)(()=>{T.current=v},[v]),(0,c.useEffect)(()=>()=>j(),[j]),(0,c.useEffect)(()=>{let e=k.current;if(!e)return;let t=e=>{let t=Mt(e);x(e=>e===t?e:t)};if(t(e.getBoundingClientRect().height),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(e=>{let n=e[0];n&&t(n.contentRect.height)});return n.observe(e),()=>n.disconnect()},[n,t]);let M=(0,c.useCallback)(t=>{if(T.current||E.current||e.length<2)return;let n=S,r=t===`next`?n+2:n-2;t===`next`&&n+1>=e.length||t===`previous`&&n<=0||(E.current=!1,D.current+=1,j(),y({direction:t,fromIndex:n,targetIndex:r,phase:`cover`}))},[j,e.length,S]);(0,c.useEffect)(()=>{if(!v||v.phase!==`cover`)return;let e=D.current,t=!1,n=0,r=0;return n=window.requestAnimationFrame(()=>{r=window.requestAnimationFrame(()=>{t||e!==D.current||y(e=>e&&e.phase===`cover`?{...e,phase:`run`}:e)})}),()=>{t=!0,window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[v]);let N=(0,c.useCallback)(()=>{let t=T.current;if(!t||E.current||t.phase===`settle`)return;E.current=!0;let n=Tt(t.targetIndex,e.length),r=D.current,i=()=>{if(r!==D.current)return;E.current=!1;let t=e[n]??e[n-1],i=e[n]?n:n-1;t&&i>=0&&p?.(i,t)},a=O.current,o=t.direction===`next`?`translateZ(0) rotateY(-180deg)`:`translateZ(0) rotateY(0deg)`;a&&(a.style.animation=`none`,a.style.transition=`none`,a.style.willChange=`auto`,a.style.transform=o,a.style.opacity=`1`),_(n),y({...t,phase:`settle`,underlaySynced:!0}),j();let s=window.requestAnimationFrame(()=>{let e=window.requestAnimationFrame(()=>{if(r!==D.current)return;let e=O.current;e&&(e.style.visibility=`hidden`);let t=window.requestAnimationFrame(()=>{r===D.current&&(y(null),i())});A.current.push(t)});A.current.push(e)});A.current.push(s)},[j,p,e]);(0,c.useEffect)(()=>{if(!v||v.phase!==`run`)return;let e=D.current,t=window.setTimeout(()=>{e===D.current&&N()},C+120);return()=>window.clearTimeout(t)},[N,C,v]),(0,c.useEffect)(()=>{if(!v||v.phase!==`run`||v.underlaySynced)return;let e=D.current,t=window.setTimeout(()=>{e===D.current&&y(e=>e&&e.phase===`run`&&!e.underlaySynced?{...e,underlaySynced:!0}:e)},Math.round(C*.52));return()=>window.clearTimeout(t)},[C,v]),(0,c.useEffect)(()=>{for(let t=-2;t<=2;t+=1)Ct(e[S+t]?.src)},[e,S]);let P=(0,c.useMemo)(()=>{if(!v)return{left:S-1,right:S};let{fromIndex:e,targetIndex:t,direction:n,phase:r}=v;return r===`cover`?{left:e-1,right:e}:r===`settle`?{left:t-1,right:t}:n===`next`?{left:v.underlaySynced?t-1:e-1,right:t}:{left:t-1,right:v.underlaySynced?t:e}},[S,v]),F=(0,c.useMemo)(()=>v?v.direction===`next`?{front:v.fromIndex,back:v.fromIndex+1}:{front:v.targetIndex,back:v.targetIndex+1}:{front:S,back:S+1},[S,v]),I={...h,"--album-width":wt(t),"--album-height":wt(n),"--album-ratio":typeof t==`number`&&typeof n==`number`?t/n:1.6429,"--turn-duration":`${C}ms`,"--cover-color":u},L=e=>{e.target===e.currentTarget&&(e.key===`ArrowRight`||e.key===`Enter`||e.key===` `?(e.preventDefault(),M(`next`)):e.key===`ArrowLeft`&&(e.preventDefault(),M(`previous`)))},R=e=>{if(e.target!==e.currentTarget)return;let t=e.animationName||``;t&&!/turnNext|turnPrevious/i.test(t)||N()};if(e.length===0)return(0,l.jsx)(`div`,{className:`${Z.album} ${Z.empty} ${m??``}`,style:I,role:`region`,"aria-label":d,children:w.empty});let z={total:e.length,objectFit:a,showPageNumber:o,pageColor:s,flyleafTitle:w.flyleafTitle,flyleafSubtitle:w.flyleafSubtitle,flyleafEndTitle:w.flyleafEndTitle,flyleafEndSubtitle:w.flyleafEndSubtitle},B=v?v.phase===`settle`?Z.turningPage:v.direction===`next`?`${Z.turningPage} ${v.phase===`cover`?Z.turnNextReady:Z.turnNext}`:`${Z.turningPage} ${v.phase===`cover`?Z.turnPreviousReady:Z.turnPrevious}`:null;return(0,l.jsxs)(`div`,{ref:k,className:`${Z.album} ${m??``}`,style:I,role:`region`,"aria-label":d,"aria-roledescription":`photo album`,tabIndex:0,onKeyDown:L,children:[(0,l.jsx)(`div`,{className:Z.bookShadow,"aria-hidden":`true`}),(0,l.jsxs)(`div`,{className:Z.stage,"aria-hidden":`true`,children:[(0,l.jsxs)(`div`,{className:Z.cover,children:[(0,l.jsx)(`span`,{className:Z.coverEdgeTop}),(0,l.jsx)(`span`,{className:Z.coverEdgeSide})]}),(0,l.jsx)(`div`,{className:Z.pageStackLeft}),(0,l.jsx)(`div`,{className:Z.pageStackRight})]}),(0,l.jsx)(It,{count:b,variant:`back`}),(0,l.jsxs)(`div`,{className:Z.book,children:[(0,l.jsxs)(`div`,{className:`${Z.staticPage} ${Z.leftPage}`,children:[(0,l.jsx)(Ft,{side:`left`,count:b}),(0,l.jsx)(`div`,{className:Z.gutterShade,"aria-hidden":`true`}),(0,l.jsx)(Pt,{photo:e[P.left],index:P.left,...z})]}),(0,l.jsxs)(`div`,{className:`${Z.staticPage} ${Z.rightPage}`,children:[(0,l.jsx)(Ft,{side:`right`,count:b}),(0,l.jsx)(`div`,{className:Z.gutterShade,"aria-hidden":`true`}),(0,l.jsx)(Pt,{photo:e[P.right],index:P.right,...z})]}),v&&B&&(0,l.jsxs)(`div`,{ref:O,className:B,onAnimationEnd:R,"aria-hidden":`true`,children:[(0,l.jsx)(`div`,{className:`${Z.face} ${Z.front}`,children:(0,l.jsxs)(`div`,{className:Z.faceSheet,style:{backgroundColor:s},children:[(0,l.jsx)(Ft,{side:`right`,count:b}),(0,l.jsx)(Pt,{photo:e[F.front],index:F.front,...z})]})}),(0,l.jsx)(`div`,{className:`${Z.face} ${Z.back}`,children:(0,l.jsxs)(`div`,{className:Z.faceSheet,style:{backgroundColor:s},children:[(0,l.jsx)(Ft,{side:`left`,count:b}),(0,l.jsx)(Pt,{photo:e[F.back],index:F.back,...z})]})})]})]}),(0,l.jsx)(`div`,{className:Z.bookGutter,"aria-hidden":`true`}),(0,l.jsx)(It,{count:b,variant:`front`}),(0,l.jsx)(`button`,{type:`button`,className:`${Z.hitArea} ${Z.previousArea}`,onClick:()=>M(`previous`),disabled:S<=0||!!v,"aria-label":w.previous}),(0,l.jsx)(`button`,{type:`button`,className:`${Z.hitArea} ${Z.nextArea}`,onClick:()=>M(`next`),disabled:S+1>=e.length||!!v,"aria-label":w.next})]})},Rt={carousel:`cos-carousel-47YCI`,groundShadow:`cos-groundShadow-HsXpl`,perspective:`cos-perspective-3y-IL`,scene:`cos-scene-fAgTN`,tray:`cos-tray-Op-wW`,trayRim:`cos-trayRim--l707`,ring:`cos-ring--iRg-`,card:`cos-card-pWo53`,frame:`cos-frame-hegBO`,imageWrap:`cos-imageWrap-QPOEy`,image:`cos-image-fvzWr`,cardFront:`cos-cardFront-vPlWj`,cardBack:`cos-cardBack-PgUQH`,caption:`cos-caption-SrLR0`,captionTitle:`cos-captionTitle-n8MP5`,captionDesc:`cos-captionDesc-30qul`,empty:`cos-empty-dkNyz`},zt=e=>typeof e==`number`?`${e}px`:e,Bt=(e,t)=>t<=0?0:(e%t+t)%t,Vt=(e,t,n)=>n<=0?0:Bt(Math.round(e/t),n),Ht=({photos:e,width:t=420,height:n=360,radius:r=180,cardWidth:i=120,cardHeight:a=160,autoRotate:o=!0,autoRotateSpeed:s=12,dragSensitivity:u=.35,friction:d=2.2,showCaption:f=!1,initialAngle:p=0,onPhotoClick:m,onFaceChange:h,ariaLabel:g=`Photo carousel`,className:_,style:v})=>{let y=e.length,b=y>0?360/y:360,x=(0,c.useRef)(null),S=(0,c.useRef)(p),C=(0,c.useRef)(0),w=(0,c.useRef)(!1),T=(0,c.useRef)(null),E=(0,c.useRef)(0),D=(0,c.useRef)(0),O=(0,c.useRef)(Vt(p,b,y)),k=(0,c.useRef)(!1),A=(0,c.useRef)(0),j=(0,c.useRef)(m),M=(0,c.useRef)(h),N=(0,c.useRef)(o),P=(0,c.useRef)(s),F=(0,c.useRef)(d),I=(0,c.useRef)(u),L=(0,c.useRef)(b),R=(0,c.useRef)(y),[z,B]=(0,c.useState)(()=>Vt(p,b,y));(0,c.useEffect)(()=>{j.current=m,M.current=h,N.current=o,P.current=s,F.current=d,I.current=u,L.current=b,R.current=y},[m,h,o,s,d,u,b,y]);let V=(0,c.useCallback)(e=>{S.current=e,x.current&&(x.current.style.transform=`rotateY(${-e}deg)`);let t=Vt(e,L.current,R.current);t!==O.current&&(O.current=t,B(t),M.current?.(t))},[]);(0,c.useEffect)(()=>{S.current=p,C.current=0,V(p)},[V,y,p,b]),(0,c.useEffect)(()=>{let e=0,t=null,n=r=>{if(e=requestAnimationFrame(n),t==null){t=r;return}let i=Math.min(.05,(r-t)/1e3);if(t=r,w.current)return;let a=S.current,o=C.current,s=!1;Math.abs(o)>.01?(a+=o*i,o*=Math.exp(-F.current*i),Math.abs(o)<.02&&(o=0),C.current=o,s=!0):N.current&&(a+=P.current*i,s=!0),s&&V(a)};return e=requestAnimationFrame(n),()=>cancelAnimationFrame(e)},[V]);let H=(0,c.useCallback)(e=>{R.current<=0||e.button!==0||(w.current=!0,k.current=!1,T.current=e.pointerId,A.current=e.clientX,E.current=e.clientX,D.current=performance.now(),C.current=0,e.currentTarget.setPointerCapture(e.pointerId))},[]),U=(0,c.useCallback)(e=>{if(!w.current||T.current!==e.pointerId)return;let t=performance.now(),n=e.clientX-E.current,r=Math.max(.008,(t-D.current)/1e3);E.current=e.clientX,D.current=t,Math.abs(e.clientX-A.current)>6&&(k.current=!0);let i=-n*I.current;C.current=i/r,V(S.current+i)},[V]),W=(0,c.useCallback)(e=>{if(T.current===e.pointerId){w.current=!1,T.current=null,C.current=Math.max(-720,Math.min(720,C.current));try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}}},[]),G=(0,c.useCallback)(t=>{let n=!k.current;if(W(t),n){let t=e[O.current];t&&j.current?.(O.current,t)}},[W,e]),K=(0,c.useCallback)(e=>{C.current=0,W(e)},[W]),q=e[z],J=f&&q&&(q.title||q.description),Y=(0,c.useMemo)(()=>e.map((e,t)=>`rotateY(${t*b}deg) translateZ(${r}px)`),[e,r,b]);return y===0?(0,l.jsx)(`div`,{className:[Rt.carousel,_].filter(Boolean).join(` `),style:{width:zt(t),height:zt(n),...v},role:`img`,"aria-label":g,children:(0,l.jsx)(`div`,{className:Rt.empty,children:`暂无照片`})}):(0,l.jsxs)(`div`,{className:[Rt.carousel,_].filter(Boolean).join(` `),style:{width:zt(t),height:zt(n),...v},role:`region`,"aria-label":g,"aria-roledescription":`carousel`,tabIndex:0,children:[(0,l.jsx)(`div`,{className:Rt.groundShadow,"aria-hidden":`true`}),(0,l.jsx)(`div`,{className:Rt.perspective,onPointerDown:H,onPointerMove:U,onPointerUp:G,onPointerCancel:K,children:(0,l.jsxs)(`div`,{className:Rt.scene,children:[(0,l.jsx)(`div`,{className:Rt.tray,"aria-hidden":`true`,children:(0,l.jsx)(`div`,{className:Rt.trayRim})}),(0,l.jsx)(`div`,{ref:x,className:Rt.ring,style:{width:i,height:a,transform:`rotateY(${-p}deg)`},children:e.map((e,t)=>{let n=t===z;return(0,l.jsx)(`div`,{className:[Rt.card,n?Rt.cardFront:Rt.cardBack].join(` `),style:{"--card-width":`${i}px`,"--card-height":`${a}px`,transform:Y[t]},"aria-hidden":!n,children:(0,l.jsx)(`div`,{className:Rt.frame,children:(0,l.jsx)(`div`,{className:Rt.imageWrap,children:(0,l.jsx)(`img`,{className:Rt.image,src:e.src,alt:e.alt??e.title??`Photo ${t+1}`,draggable:!1})})})},`${e.src}-${t}`)})})]})}),J?(0,l.jsxs)(`div`,{className:Rt.caption,children:[q?.title?(0,l.jsx)(`p`,{className:Rt.captionTitle,children:q.title}):null,q?.description?(0,l.jsx)(`p`,{className:Rt.captionDesc,children:q.description}):null]}):null]})},Ut=1e3/120,Wt=Ut/1e3,Gt=.42,Kt=3800,qt=2600,Jt=2900,Yt=.05,Xt=(e,t,n)=>Math.min(n,Math.max(t,e)),Zt=e=>{let t=Math.sin(e*127.1+31.7)*43758.5453;return t-Math.floor(t)},Qt=e=>typeof e==`number`?`${e}px`:e,$t=(e,t)=>t*Math.tanh(e/t),en=({count:e,viewportWidth:t,viewportHeight:n,photoWidth:r,photoHeight:i,photoGap:a,ropeTop:o,ropeSag:s,bandLength:c,maxPull:l,tilt:u})=>{let d=e>0?e*r+(e-1)*a:0,f=Math.round(r*.55),p=Math.max(d+f*2,t,r*2),m=(p-d)/2,h=r+a,g=[];for(let t=0;t<e;t+=1)g.push(m+t*h+r*(.4+Zt(t*5.13)*.2));let _=e=>{let t=p>0?Xt(e/p,0,1):0;return o+s*4*t*(1-t)},v=Math.min(20,a*.24+5),y=[],b=[],x=[],S=[],C=[],w=[];for(let t=0;t<e;t+=1){let e=m+t*h,n=g[t],i=_(n);y.push(e),x.push(n-e),S.push(i),b.push(i+c+13),C.push((Zt(t*3.71)*2-1)*u),w.push(e+r/2)}let T=[{x:0,baseY:_(0),pulls:[]}];for(let t=0;t<e;t+=1){let e=((t===0?0:g[t-1])+g[t])/2,n=t===0;T.push({x:e,baseY:_(e)+v*(n?.5:1),pulls:n?[{index:t,weight:.3}]:[{index:t-1,weight:.45},{index:t,weight:.45}]}),T.push({x:g[t],baseY:_(g[t]),pulls:[{index:t,weight:1}]})}if(e>0){let t=(g[e-1]+p)/2;T.push({x:t,baseY:_(t)+v*.5,pulls:[{index:e-1,weight:.3}]})}return T.push({x:p,baseY:_(p),pulls:[]}),{railWidth:p,stageHeight:Math.max(n,Math.ceil(o+s+c+13+i+l+40)),cardLefts:y,cardTops:b,pinOffsets:x,pinXs:g,anchorYs:S,baseRots:C,centers:w,anchors:T}},tn=({bandLength:e,damping:t,maxPull:n,stiffness:r,tension:i})=>{let a=420*Xt(r,.1,3),o=Xt(t,.02,1),s=Math.max(8,e);return{bandLength:s,segLength:s/5,gravityAccel:Jt,chainKeep:Math.exp(-(.6+o*6)*Wt),swingDamp:2*Xt(.28+o,.1,1)*Math.sqrt(165),spinDamp:2*Xt(.35+o,.1,1.2)*Math.sqrt(60),bandK:a*.9,bandRecover:11,springK:a,springC:2*Xt(.45+o,.1,1.2)*Math.sqrt(a),neighborK:a*Xt(i,0,1),maxPull:Math.max(16,n)}},nn=(e,t,n,r)=>({x:e?.pinXs[n]??0,y:(e?.anchorYs[n]??0)+(t?.segLength??0)*r}),rn=(e,t,n)=>Array.from({length:6},(r,i)=>{let a=nn(e,t,n,i);return{x:a.x,y:a.y,px:a.x,py:a.y,sx:a.x,sy:a.y,rx:a.x,ry:a.y}}),an=(e,t,n)=>{let r=e.baseRots[n]??0;return{chain:rn(e,t,n),rot:r,vRot:0,spin:0,vSpin:0,swayVx:0,slack:0,ropeY:0,ropeVy:0,sRot:r,sSpin:0,sRopeY:0}},on=(e,t,n,r)=>{e.chain.forEach((e,i)=>{let a=nn(t,n,r,i);e.x=a.x,e.y=a.y,e.px=a.x,e.py=a.y,e.sx=a.x,e.sy=a.y,e.rx=a.x,e.ry=a.y}),e.rot=t?.baseRots[r]??0,e.vRot=0,e.spin=0,e.vSpin=0,e.swayVx=0,e.slack=0,e.ropeY=0,e.ropeVy=0,e.sRot=e.rot,e.sSpin=0,e.sRopeY=0},sn=(e,t=e.length)=>{if(t<2)return``;let n=`M ${e[0].x.toFixed(2)} ${e[0].y.toFixed(2)}`;for(let r=0;r<t-1;r+=1){let i=e[r],a=e[r+1],o=r>0?e[r-1]:i,s=r+2<t?e[r+2]:a,c=i.x+(a.x-o.x)/6,l=i.y+(a.y-o.y)/6,u=a.x-(s.x-i.x)/6,d=a.y-(s.y-i.y)/6;n+=` C ${c.toFixed(2)} ${l.toFixed(2)} ${u.toFixed(2)} ${d.toFixed(2)} ${a.x.toFixed(2)} ${a.y.toFixed(2)}`}return n},cn=(e,t)=>{for(;e.length<t;)e.push({x:0,y:0});return e},ln=(e,t)=>({min:Math.min(0,e-t),max:0}),un=(e,t,n,r,i)=>{let{layout:a,physics:o,nodes:s}=e;if(!a||!o)return;let c=`translate3d(${e.offset.toFixed(2)}px, 0, 0)`;t.rail&&c!==n.rail&&(t.rail.style.transform=c,n.rail=c);let l=i>0?1-Math.exp(-i*34):1;for(let i=0;i<s.length;i+=1){let c=s[i];if(!c)continue;let u=c.chain,d=u.length-1,f=cn(e.buffer,u.length);for(let e=0;e<=d;e+=1){let t=u[e],n=t.sx+(t.x-t.sx)*r,i=t.sy+(t.y-t.sy)*r;e===0||e===d?(t.rx=n,t.ry=i):(t.rx+=(n-t.rx)*l,t.ry+=(i-t.ry)*l),f[e].x=t.rx,f[e].y=t.ry}let p=t.cards[i];if(p){let e=u[d],t=a.pinXs[i]??0,s=(a.anchorYs[i]??0)+o.bandLength,l=c.sRot+(c.rot-c.sRot)*r,f=c.sSpin+(c.spin-c.sSpin)*r,m=`translate3d(${(e.rx-t).toFixed(2)}px, ${(e.ry-s).toFixed(2)}px, 0) rotate(${l.toFixed(2)}deg) rotateY(${f.toFixed(2)}deg)`;m!==n.cards[i]&&(p.style.transform=m,n.cards[i]=m)}let m=sn(f,u.length);if(m!==n.bands[i]){n.bands[i]=m,t.bandPaths[i]?.setAttribute(`d`,m),t.bandGloss[i]?.setAttribute(`d`,m);let e=t.knots[i];e&&(e.setAttribute(`cx`,u[0].rx.toFixed(2)),e.setAttribute(`cy`,u[0].ry.toFixed(2)))}}let u=a.anchors,d=cn(e.buffer,u.length);for(let e=0;e<u.length;e+=1){let t=u[e],n=t.baseY;for(let e of t.pulls){let t=s[e.index];t&&(n+=(t.sRopeY+(t.ropeY-t.sRopeY)*r)*e.weight)}d[e].x=t.x,d[e].y=n}let f=sn(d,u.length);if(f!==n.rope){n.rope=f;for(let e of t.ropePaths)e?.setAttribute(`d`,f)}},dn=(e,t,n)=>{let{physics:r,layout:i,nodes:a}=e;if(!r||!i)return;let o=e.drag,s=o?.mode===`photo`?o.photoIndex:-1,c=e.impulse;if(e.impulse=null,o){let e=Math.exp(-n*6);o.vx*=e,o.vy*=e;let t=1-Math.exp(-n*110);o.smoothX+=(o.pointerX-o.smoothX)*t,o.smoothY+=(o.pointerY-o.smoothY)*t}for(let e=0;e<a.length;e+=1){let t=a[e],l=t.chain,u=l.length-1;for(let e=0;e<=u;e+=1)l[e].sx=l[e].x,l[e].sy=l[e].y;t.sRot=t.rot,t.sSpin=t.spin,t.sRopeY=t.ropeY;let d=i.pinXs[e]??0,f=(i.anchorYs[e]??0)+t.ropeY,p=r.maxPull,m=e===s&&o?o:null,h=0,g=0,_=0;if(m){g=m.smoothX-m.grabDx,_=m.smoothY-m.grabDy;let e=Math.hypot(g-d,_-f);h=Math.max(0,$t(e-r.bandLength,p))}t.slack=h>=t.slack?h:t.slack+(h-t.slack)*(1-Math.exp(-n*r.bandRecover)),t.slack<.02&&(t.slack=0);let v=r.bandLength+t.slack,y=v/5;c&&c.index===e&&(l[u].px=l[u].x-c.vx*n,l[u].py=l[u].y-c.vy*n);let b=r.gravityAccel*n*n;for(let e=1;e<=u;e+=1){let t=l[e],n=(t.x-t.px)*r.chainKeep,i=(t.y-t.py)*r.chainKeep;t.px=t.x,t.py=t.y,t.x+=n,t.y+=i+b}let x=null;if(m){let e=g-d,t=_-f,n=Math.hypot(e,t);x=n>v&&n>.001?{x:d+e/n*v,y:f+t/n*v}:{x:g,y:_}}for(let e=0;e<8;e+=1){l[0].x=d,l[0].y=f,x&&(l[u].x=x.x,l[u].y=x.y);for(let e=0;e<u;e+=1){let t=l[e],n=l[e+1],r=n.x-t.x,i=n.y-t.y,a=Math.hypot(r,i)||1e-4;if(a<=y)continue;let o=(a-y)/a,s=e===0,c=e+1===u&&x!==null,d=s?0:c?1:.5,f=c?0:s?1:.5;t.x+=r*o*d,t.y+=i*o*d,n.x-=r*o*f,n.y-=i*o*f}}let S=l[u],C=-(Math.atan2(S.x-l[0].x,S.y-l[0].y)*180)/Math.PI,w=76*Math.tanh(C/76),T=(i.baseRots[e]??0)+w;t.vRot+=((T-t.rot)*165-t.vRot*r.swingDamp)*n,t.rot=Xt(t.rot+t.vRot*n,-108,108);let E=(S.x-S.px)/n;t.swayVx+=(E-t.swayVx)*(1-Math.exp(-n*18));let D=Xt(-t.swayVx*Yt,-34,34);t.vSpin+=((D-t.spin)*60-t.vSpin*r.spinDamp)*n,t.spin+=t.vSpin*n;let O=-r.springK*t.ropeY-r.springC*t.ropeVy;if(t.slack>0){let e=S.y-f,n=Math.hypot(S.x-d,e)||1;O+=r.bandK*t.slack*Math.max(e/n,0)}let k=a[e-1],A=a[e+1];k&&(O+=r.neighborK*(k.ropeY-t.ropeY)),A&&(O+=r.neighborK*(A.ropeY-t.ropeY)),t.ropeVy+=O*n,t.ropeY=Xt(t.ropeY+t.ropeVy*n,-r.maxPull,r.maxPull*1.2)}if(o?.mode===`pan`)return;let{min:l,max:u}=ln(t,i.railWidth),d=e.snapTarget;if(d!==null){let t=d-e.offset;e.offset+=t*(1-Math.exp(-n*12)),e.offsetVelocity=0,Math.abs(t)<.4&&(e.offset=d,e.snapTarget=null);return}if(o)return;let f=e.offset;if(f>u||f<l){let t=f>u?u:l;e.offsetVelocity+=((t-f)*220-e.offsetVelocity*15)*n,e.offset+=e.offsetVelocity*n,Math.abs(t-e.offset)<.4&&Math.abs(e.offsetVelocity)<24&&(e.offset=t,e.offsetVelocity=0);return}e.offsetVelocity!==0&&(e.offset+=e.offsetVelocity*n,e.offsetVelocity*=Math.exp(-n*2.8),Math.abs(e.offsetVelocity)<12&&(e.offsetVelocity=0),e.offset=Xt(e.offset,l,u))},fn=(e,t)=>{if(e.drag||e.snapTarget!==null||e.impulse||Math.abs(e.offsetVelocity)>.5)return!1;let n=e.layout;if(!n)return!1;let{min:r,max:i}=ln(t,n.railWidth);return e.offset>i+.4||e.offset<r-.4?!1:e.nodes.every((t,r)=>{let i=n.baseRots[r]??0;return t.slack>0||Math.abs(t.rot-i)>1||Math.abs(t.vRot)>4||Math.abs(t.spin)>.6||Math.abs(t.vSpin)>4||Math.abs(t.ropeY)>.3||Math.abs(t.ropeVy)>3?!1:t.chain.every((t,i)=>{let a=nn(n,e.physics,r,i);return Math.hypot(t.x-a.x,t.y-a.y)<.6&&Math.abs(t.x-t.px)<.02&&Math.abs(t.y-t.py)<.02})})},pn=e=>{e.nodes.forEach((t,n)=>{on(t,e.layout,e.physics,n)}),e.offsetVelocity=0},mn={clothesline:`cos-clothesline-sgTFe`,viewport:`cos-viewport-TH-gR`,pannable:`cos-pannable-sEcjn`,rail:`cos-rail-eTBFj`,strings:`cos-strings-HDBn-`,ropeShadow:`cos-ropeShadow-79mEA`,ropeShadowCore:`cos-ropeShadowCore-L3p8G`,ropeBody:`cos-ropeBody-pEvRS`,ropeTwist:`cos-ropeTwist-shhPx`,bandBody:`cos-bandBody-DScGJ`,bandGloss:`cos-bandGloss-I-wXr`,bandKnot:`cos-bandKnot-raqsN`,hanger:`cos-hanger-8FbKZ`,frame:`cos-frame-TORk3`,pin:`cos-pin-wNwv2`,pinSpring:`cos-pinSpring-1-6dJ`,photo:`cos-photo-90x94`,caption:`cos-caption-VM5T4`},hn=({photos:e,width:t=`100%`,height:n=480,photoWidth:r=150,photoHeight:i=200,photoGap:a=46,ropeTop:o=66,ropeSag:s=26,bandLength:u=34,bandWidth:d=5,maxPull:f=110,stiffness:p=1,damping:m=.16,tension:h=.35,tilt:g=5,ropeColor:_=`#8d7a5c`,bandColor:v,pinColor:y=`#d8a761`,frameColor:b=`#fffdf7`,background:x,objectFit:S=`cover`,showCaption:C=!0,initialIndex:w=0,onPhotoClick:T,ariaLabel:E=`Photo clothesline`,className:D,style:O})=>{let k=(0,c.useRef)(null),A=(0,c.useRef)(null),j=(0,c.useRef)([]),M=(0,c.useRef)([]),N=(0,c.useRef)([]),P=(0,c.useRef)([]),F=(0,c.useRef)([]),I=(0,c.useRef)({bands:[],cards:[],rope:``,rail:``}),L=(0,c.useRef)({nodes:[],layout:null,physics:null,offset:0,offsetVelocity:0,snapTarget:null,drag:null,impulse:null,buffer:[]}),R=(0,c.useRef)(null),z=(0,c.useRef)(null),B=(0,c.useRef)(0),V=(0,c.useRef)(0),H=(0,c.useRef)(!1),U=(0,c.useRef)(w),W=(0,c.useRef)(T),G=(0,c.useRef)(e),[K,q]=(0,c.useState)({width:0,height:0}),J=e.length,Y=C&&e.some(e=>e.title||e.description);(0,c.useEffect)(()=>{W.current=T,G.current=e},[T,e]);let ee=(0,c.useMemo)(()=>en({count:J,viewportWidth:K.width,viewportHeight:K.height,photoWidth:r,photoHeight:i,photoGap:a,ropeTop:o,ropeSag:s,bandLength:u,maxPull:f,tilt:g}),[u,J,f,a,i,r,s,o,g,K.height,K.width]),te=(0,c.useMemo)(()=>tn({bandLength:u,damping:m,maxPull:f,stiffness:p,tension:h}),[u,m,f,p,h]),ne=Math.min(0,K.width-ee.railWidth)<-.5,X=(0,c.useCallback)(()=>k.current?.clientWidth??K.width,[K.width]),re=(0,c.useCallback)(()=>({rail:A.current,ropePaths:j.current,bandPaths:M.current,bandGloss:N.current,knots:P.current,cards:F.current}),[]),ie=(0,c.useCallback)((e,t)=>{un(L.current,re(),I.current,e,t)},[re]),ae=(0,c.useCallback)(()=>{if(z.current!==null||typeof window>`u`)return;let e=R.current;e&&(B.current=0,V.current=0,z.current=window.requestAnimationFrame(e))},[]);(0,c.useEffect)(()=>{let e=t=>{z.current=null;let n=B.current||t;B.current=t;let r=Math.min(t-n,64);V.current+=r;let i=L.current,a=X(),o=0;for(;V.current>=8.333333333333334&&o<12;)dn(i,a,Wt),V.current-=Ut,o+=1;if(o>=12&&(V.current=0),fn(i,a)){pn(i),ie(1,0),B.current=0,V.current=0;return}ie(V.current/Ut,r/1e3),z.current=window.requestAnimationFrame(e)};return R.current=e,()=>{R.current=null}},[ie,X]),(0,c.useEffect)(()=>{let e=L.current;e.layout=ee,e.physics=te},[ee,te]),(0,c.useEffect)(()=>{let e=L.current;e.nodes=Array.from({length:J},(e,t)=>an(ee,te,t)),F.current.length=J,I.current.rope=``,I.current.rail=``},[J,ee,te]),(0,c.useEffect)(()=>{let e=k.current;if(!e)return;let t=(e,t)=>q(n=>n.width===e&&n.height===t?n:{width:e,height:t});if(t(e.clientWidth,e.clientHeight),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(e=>{let n=e[0];n&&t(Math.round(n.contentRect.width),Math.round(n.contentRect.height))});return n.observe(e),()=>n.disconnect()},[]);let oe=(0,c.useCallback)(e=>{let t=X(),n=L.current.layout?.centers[Xt(e,0,Math.max(0,J-1))];if(n===void 0)return 0;let{min:r,max:i}=ln(t,L.current.layout?.railWidth??0);return Xt(t/2-n,r,i)},[J,X]);(0,c.useEffect)(()=>{if(K.width<=0)return;let e=L.current;if(!H.current){H.current=!0,U.current=w,e.offset=oe(w),ie(1,0);return}if(U.current!==w){U.current=w,e.snapTarget=oe(w),ae();return}let{min:t,max:n}=ln(X(),e.layout?.railWidth??0);e.offset=Xt(e.offset,t,n),ie(1,0)},[J,w,ee,oe,ie,ae,X,K.width]),(0,c.useEffect)(()=>()=>{z.current!==null&&window.cancelAnimationFrame(z.current),z.current=null},[]);let se=(0,c.useCallback)(e=>{if(e.button!==0&&e.pointerType===`mouse`)return;let t=e.target?.closest?.(`[data-photo-index]`),n=t?Number(t.dataset.photoIndex):-1,r=Number.isFinite(n)?n:-1,i=k.current?.getBoundingClientRect(),a=i?.left??0,o=i?.top??0,s=L.current,c=e.clientX-a-s.offset,l=e.clientY-o,u=r>=0?s.nodes[r]:void 0,d=u?.chain[u.chain.length-1];s.snapTarget=null,s.offsetVelocity=0,s.drag={pointerId:e.pointerId,mode:d?`photo`:`pan`,photoIndex:r,grabDx:d?c-d.x:0,grabDy:d?l-d.y:0,pointerX:c,pointerY:l,smoothX:c,smoothY:l,rectLeft:a,rectTop:o,startX:e.clientX,startY:e.clientY,startOffset:s.offset,lastX:e.clientX,lastY:e.clientY,lastTime:e.timeStamp,vx:0,vy:0,moved:0},e.currentTarget.setPointerCapture(e.pointerId),ae()},[ae]),ce=(0,c.useCallback)(e=>{let t=L.current,n=t.drag;if(!n||n.pointerId!==e.pointerId)return;let r=e.clientX-n.startX,i=e.clientY-n.startY;n.moved=Math.max(n.moved,Math.hypot(r,i));let a=Math.max(e.timeStamp-n.lastTime,1)/1e3;if(n.vx=.7*((e.clientX-n.lastX)/a)+.3*n.vx,n.vy=.7*((e.clientY-n.lastY)/a)+.3*n.vy,n.lastX=e.clientX,n.lastY=e.clientY,n.lastTime=e.timeStamp,n.mode===`pan`){let{min:e,max:i}=ln(X(),t.layout?.railWidth??0),a=n.startOffset+r;t.offset=a-(a>i?a-i:a<e?a-e:0)*(1-Gt),ae();return}n.pointerX=e.clientX-n.rectLeft-t.offset,n.pointerY=e.clientY-n.rectTop,ae()},[ae,X]),le=(0,c.useCallback)(e=>{let t=L.current,n=t.drag;if(!(!n||n.pointerId!==e.pointerId)){if(t.drag=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),n.mode===`pan`)t.offsetVelocity=Xt(n.vx,-Kt,Kt);else if(n.moved<=4&&n.photoIndex>=0){let e=G.current[n.photoIndex];e&&W.current?.(n.photoIndex,e)}else n.photoIndex>=0&&(t.impulse={index:n.photoIndex,vx:Xt(n.vx,-qt,qt),vy:Xt(n.vy,-qt,qt)});ae()}},[ae]),ue=(0,c.useCallback)(e=>{let t=L.current,n=t.drag;!n||n.pointerId!==e.pointerId||(t.drag=null,ae())},[ae]);(0,c.useEffect)(()=>{let e=k.current;if(!e)return;let t=e=>{let t=Math.abs(e.deltaX)>Math.abs(e.deltaY)?e.deltaX:e.shiftKey?e.deltaY:0;if(t===0)return;let n=L.current,{min:r,max:i}=ln(X(),n.layout?.railWidth??0);r>=i||(e.preventDefault(),n.snapTarget=null,n.offsetVelocity=0,n.offset=Xt(n.offset-t,r,i),ae())};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[ae,X]);let de=(0,c.useCallback)(e=>{let t=e.target?.closest?.(`[data-photo-index]`),n=t?Number(t.dataset.photoIndex):-1,i=L.current;if(e.key===`ArrowRight`||e.key===`ArrowLeft`){let{min:t,max:n}=ln(X(),i.layout?.railWidth??0);if(t>=n)return;e.preventDefault();let o=r+a;i.snapTarget=Xt((i.snapTarget??i.offset)+(e.key===`ArrowLeft`?o:-o),t,n),ae();return}if(!(n<0)){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault(),i.impulse={index:n,vx:0,vy:e.key===`ArrowDown`?1500:-1e3},ae();return}if(e.key===`Enter`||e.key===` `){let t=G.current[n];if(!t||!W.current)return;e.preventDefault(),W.current(n,t)}}},[a,r,ae,X]),fe=e=>({left:ee.cardLefts[e],top:ee.cardTops[e],width:r,height:i,transform:`translate3d(0, 0, 0) rotate(${ee.baseRots[e]}deg)`,"--pin-x":`${ee.pinOffsets[e]}px`,"--pin-grip":`-13px`}),pe={...O,width:Qt(t),height:Qt(n),"--rope-color":_,"--band-color":v??_,"--band-width":`${Math.max(1,d)}px`,"--pin-color":y,"--frame-color":b,...x?{"--clothesline-bg":x}:null};return(0,l.jsx)(`div`,{className:`${mn.clothesline} ${D??``}`,style:pe,role:`region`,"aria-label":E,children:(0,l.jsx)(`div`,{ref:k,className:`${mn.viewport} ${ne?mn.pannable:``}`,onPointerDown:se,onPointerMove:ce,onPointerUp:le,onPointerCancel:ue,onKeyDown:de,children:(0,l.jsxs)(`div`,{ref:A,className:mn.rail,style:{width:ee.railWidth},children:[(0,l.jsxs)(`svg`,{className:mn.strings,width:ee.railWidth,height:ee.stageHeight,viewBox:`0 0 ${ee.railWidth} ${ee.stageHeight}`,"aria-hidden":`true`,children:[(0,l.jsx)(`path`,{ref:e=>{j.current[0]=e},className:mn.ropeShadow}),(0,l.jsx)(`path`,{ref:e=>{j.current[1]=e},className:mn.ropeShadowCore}),(0,l.jsx)(`path`,{ref:e=>{j.current[2]=e},className:mn.ropeBody}),(0,l.jsx)(`path`,{ref:e=>{j.current[3]=e},className:mn.ropeTwist}),e.map((e,t)=>(0,l.jsxs)(`g`,{children:[(0,l.jsx)(`path`,{ref:e=>{M.current[t]=e,I.current.bands[t]=``},className:mn.bandBody}),(0,l.jsx)(`path`,{ref:e=>{N.current[t]=e},className:mn.bandGloss}),(0,l.jsx)(`circle`,{ref:e=>{P.current[t]=e},className:mn.bandKnot,r:4.2})]},`band-${e.src}-${t}`))]}),e.map((e,t)=>(0,l.jsx)(gn,{photo:e,index:t,style:fe(t),objectFit:S,hasCaption:Y,clickable:!!T,onCardRef:e=>{F.current[t]=e,I.current.cards[t]=``}},`${e.src}-${t}`))]})})})},gn=c.default.memo(({photo:e,index:t,style:n,objectFit:r,hasCaption:i,clickable:a,onCardRef:o})=>(0,l.jsxs)(`div`,{ref:o,className:mn.hanger,"data-photo-index":t,style:n,tabIndex:0,role:a?`button`:`group`,"aria-label":e.title??e.alt??void 0,children:[(0,l.jsx)(`span`,{className:mn.pin,"aria-hidden":`true`,children:(0,l.jsx)(`span`,{className:mn.pinSpring})}),(0,l.jsxs)(`figure`,{className:mn.frame,children:[(0,l.jsx)(`span`,{className:mn.photo,children:(0,l.jsx)(`img`,{src:e.src,alt:e.alt??e.title??``,draggable:!1,style:{objectFit:r}})}),i&&(0,l.jsxs)(`figcaption`,{className:mn.caption,children:[e.title&&(0,l.jsx)(`strong`,{children:e.title}),e.description&&(0,l.jsx)(`span`,{children:e.description})]})]})]}));gn.displayName=`PhotoHanger`;var _n={filmstrip:`cos-filmstrip-xRvDi`,sprocketBand:`cos-sprocketBand-Md1u6`,sprocketBandBottom:`cos-sprocketBandBottom-KyDcg`,viewport:`cos-viewport-qraxB`,strip:`cos-strip-qvNaQ`,frameCell:`cos-frameCell-ZyVRT`,frameNumber:`cos-frameNumber-1pHpP`,frameWindow:`cos-frameWindow-GiJp4`,caption:`cos-caption-RBarX`,empty:`cos-empty-ql-mT`},vn=6,yn=8,bn=2600,xn=14,Sn=e=>typeof e==`number`?`${e}px`:e,Cn=(e,t,n)=>Math.min(n,Math.max(t,e)),wn=e=>String(e+1).padStart(2,`0`),Tn=({photos:e,width:t=`100%`,height:n=280,frameWidth:r=160,frameHeight:i=120,frameGap:a=14,showCaption:o=!0,friction:s=2.8,dragSensitivity:u=1,initialIndex:d=0,onPhotoClick:f,onIndexChange:p,ariaLabel:m=`Photo filmstrip`,className:h,style:g})=>{let _=(0,c.useRef)(null),v=(0,c.useRef)(null),y=(0,c.useRef)(null),b=(0,c.useRef)({offset:0,velocity:0,drag:null,snapTarget:null}),x=(0,c.useRef)(null),S=(0,c.useRef)(0),C=(0,c.useRef)(0),w=(0,c.useRef)(!1),T=(0,c.useRef)(d),E=(0,c.useRef)(f),D=(0,c.useRef)(p),O=(0,c.useRef)(e),k=(0,c.useRef)(s),A=(0,c.useRef)(u),[j,M]=(0,c.useState)(0),[N,P]=(0,c.useState)(d),F=e.length,I=r+a,L=o&&e.some(e=>e.title||e.description);(0,c.useEffect)(()=>{E.current=f,D.current=p,O.current=e,k.current=s,A.current=u},[u,s,p,f,e]);let R=(0,c.useMemo)(()=>j>0?j/2-r/2:0,[r,j]),z=(0,c.useMemo)(()=>F<=0?0:R*2+F*r+Math.max(0,F-1)*a,[F,a,r,R]),B=(0,c.useCallback)(e=>{if(j<=0||F<=0)return 0;let t=R+Cn(Math.floor(e),0,F-1)*I+r/2;return j/2-t},[F,I,r,R,j]),V=(0,c.useCallback)(e=>{if(F<=0||j<=0)return 0;let t=(j/2-e-R-r/2)/I;return Cn(Math.round(t),0,F-1)},[F,I,r,R,j]),H=(0,c.useCallback)(()=>F<=0?{min:0,max:0}:{min:B(F-1),max:B(0)},[F,B]),U=(0,c.useCallback)(e=>{let t=y.current;t&&(t.style.transform=`translate3d(${e}px, 0, 0)`)},[]),W=(0,c.useCallback)(e=>{if(e===C.current)return;C.current=e,P(e);let t=O.current[e];t&&D.current?.(e,t)},[]),G=(0,c.useCallback)(()=>{x.current!==null&&(window.cancelAnimationFrame(x.current),x.current=null),S.current=0},[]),K=(0,c.useCallback)(()=>{if(x.current!==null||typeof window>`u`)return;let e=t=>{x.current=null;let n=S.current||t;S.current=t;let r=Math.min(.05,(t-n)/1e3),i=b.current,{min:a,max:o}=H(),s=!1;if(i.drag)U(i.offset),s=!0;else if(i.snapTarget!==null){let e=i.snapTarget-i.offset;Math.abs(e)<=.35?(i.offset=i.snapTarget,i.snapTarget=null,i.velocity=0,W(V(i.offset)),U(i.offset)):(i.offset+=e*Math.min(1,xn*r),i.velocity=0,U(i.offset),s=!0)}else{let e=i.velocity;if(Math.abs(e)>yn)e*=Math.exp(-k.current*r),Math.abs(e)<=yn&&(e=0),i.velocity=e,i.offset+=e*r,(i.offset<a||i.offset>o)&&(i.offset=Cn(i.offset,a,o),i.velocity=0),U(i.offset),s=!0;else{i.velocity=0;let e=B(V(i.offset));Math.abs(i.offset-e)>.35?(i.snapTarget=e,s=!0):(i.offset=e,W(V(i.offset)),U(i.offset))}}s?x.current=window.requestAnimationFrame(e):S.current=0};x.current=window.requestAnimationFrame(e)},[U,V,W,H,B]);(0,c.useEffect)(()=>{let e=v.current;if(!e)return;let t=e=>{M(t=>t===e?t:e)};if(t(e.clientWidth),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(e=>{let n=e[0];n&&t(Math.round(n.contentRect.width))});return n.observe(e),()=>n.disconnect()},[]),(0,c.useEffect)(()=>{if(j<=0||F<=0)return;let e=b.current;if(!w.current){w.current=!0,T.current=d,e.offset=B(d),e.velocity=0,e.snapTarget=null,e.drag=null,C.current=Cn(d,0,F-1),P(C.current),U(e.offset);return}if(T.current!==d){T.current=d,e.velocity=0,e.drag=null,e.snapTarget=B(d),K();return}let{min:t,max:n}=H();e.offset=Cn(e.offset,t,n),U(e.offset)},[U,F,d,H,B,K,j]),(0,c.useEffect)(()=>()=>{G()},[G]);let q=(0,c.useCallback)(e=>{let t=b.current,n=t.drag;if(!n||n.pointerId!==e.pointerId)return;t.drag=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId);let r=Math.max(.008,(e.timeStamp-n.lastTime)/1e3);if(t.velocity=Cn((e.clientX-n.lastX)/r*A.current,-2600,bn),t.snapTarget=null,n.moved<=vn){t.velocity=0;let e=V(t.offset),n=O.current[e];n&&E.current?.(e,n),t.snapTarget=B(e)}K()},[V,B,K]),J=(0,c.useCallback)(e=>{if(e.button!==0&&e.pointerType===`mouse`||F<=0)return;let t=b.current;t.drag={pointerId:e.pointerId,startX:e.clientX,startOffset:t.offset,lastX:e.clientX,lastTime:e.timeStamp,vx:0,moved:0},t.velocity=0,t.snapTarget=null,e.currentTarget.setPointerCapture(e.pointerId),K()},[F,K]),Y=(0,c.useCallback)(e=>{let t=b.current,n=t.drag;if(!n||n.pointerId!==e.pointerId)return;let r=e.clientX-n.startX;n.moved=Math.max(n.moved,Math.abs(r));let i=Math.max(e.timeStamp-n.lastTime,1)/1e3;n.vx=.7*((e.clientX-n.lastX)/i)+.3*n.vx,n.lastX=e.clientX,n.lastTime=e.timeStamp;let{min:a,max:o}=H();t.offset=Cn(n.startOffset+r*A.current,a,o),U(t.offset),K()},[U,H,K]),ee=(0,c.useCallback)(e=>{q(e)},[q]),te=(0,c.useCallback)(e=>{q(e)},[q]),ne=(0,c.useCallback)(e=>{if(F<=0||e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault();let t=b.current,n=e.key===`ArrowLeft`?I:-I,{min:r,max:i}=H(),a=t.snapTarget??t.offset;t.velocity=0,t.drag=null,t.snapTarget=Cn(a+n,r,i),K()},[F,I,H,K]),X=e[N],re=o&&X?.title?`,当前:${X.title}${X.description?`,${X.description}`:``}`:``;return(0,l.jsxs)(`div`,{ref:_,className:[_n.filmstrip,h].filter(Boolean).join(` `),style:{width:Sn(t),height:Sn(n),...g},role:`region`,"aria-label":m+re,tabIndex:F>0?0:-1,onKeyDown:ne,children:[(0,l.jsx)(`div`,{className:_n.sprocketBand,"aria-hidden":`true`}),(0,l.jsx)(`div`,{ref:v,className:_n.viewport,onPointerDown:J,onPointerMove:Y,onPointerUp:ee,onPointerCancel:te,children:F>0?(0,l.jsx)(`div`,{ref:y,className:_n.strip,style:{minWidth:z,paddingLeft:R,paddingRight:R,boxSizing:`border-box`},children:e.map((e,t)=>(0,l.jsxs)(`div`,{className:_n.frameCell,style:{width:r,marginRight:t<F-1?a:0},"data-photo-index":t,children:[(0,l.jsx)(`span`,{className:_n.frameNumber,children:wn(t)}),(0,l.jsx)(`div`,{className:_n.frameWindow,style:{width:r,height:i},children:(0,l.jsx)(`img`,{src:e.src,alt:e.alt??e.title??``,draggable:!1})}),L&&(e.title||e.description)&&(0,l.jsxs)(`div`,{className:_n.caption,children:[e.title&&(0,l.jsx)(`strong`,{children:e.title}),e.description&&(0,l.jsx)(`span`,{children:e.description})]})]},`${e.src}-${t}`))}):(0,l.jsx)(`div`,{className:_n.empty,children:`No photos`})}),(0,l.jsx)(`div`,{className:[_n.sprocketBand,_n.sprocketBandBottom].join(` `),"aria-hidden":`true`})]})},En={fridge:`cos-fridge-3RQp4`,handle:`cos-handle-Qr-U3`,stage:`cos-stage-Aw2rq`,card:`cos-card-SefXh`,cardDragging:`cos-cardDragging-UA1W-`,magnetRow:`cos-magnetRow-Q9nXm`,magnet:`cos-magnet-PiJ8m`,magnetRed:`cos-magnetRed-eIhOH`,magnetBlue:`cos-magnetBlue-BHgCS`,magnetGreen:`cos-magnetGreen-L7iFW`,magnetYellow:`cos-magnetYellow-gKTmk`,photoFrame:`cos-photoFrame-g1FoK`,image:`cos-image-wyaBh`,caption:`cos-caption-M-HQN`,title:`cos-title-ziJT2`,description:`cos-description-xaZI-`,empty:`cos-empty-gHMtw`},Dn=6,On=1200,kn=.08,An=1.05,jn=10,Mn=32,Nn=.24,Pn=[`magnetRed`,`magnetBlue`,`magnetGreen`,`magnetYellow`],Fn=e=>typeof e==`number`?`${e}px`:e,In=(e,t,n)=>Math.min(n,Math.max(t,e)),Ln=e=>{let t=Math.sin(e*127.1+31.7)*43758.5453;return t-Math.floor(t)},Rn=(e,t,n,r,i,a)=>{if(e<=0||t<=0||n<=0)return[];let o=Math.max(jn,t-r-jn-Mn),s=Math.max(jn,n-i-jn),c=Math.max(0,o-jn)*.55*a,l=Math.max(0,s-jn)*.5*a,u=jn+(o-jn)*.5-r*.5,d=jn+(s-jn)*.5-i*.5;return Array.from({length:e},(t,n)=>{let r=e<=1?.5:n/(e-1),i=(r-.5)*c*1.4,f=Math.sin(r*Math.PI*1.2)*l*.35,p=(Ln(n*7.13+2.1)*2-1)*c*.45,m=(Ln(n*11.37+5.9)*2-1)*l*.42,h=(Ln(n*3.71+1.4)*2-1)*12*a;return{x:In(u+i+p,jn,o),y:In(d+f+m,jn,s),rot:h}})},zn=(e,t,n,r,i)=>{let a=Math.max(jn,r-t-jn-Mn),o=Math.max(jn,i-n-jn);e.x=In(e.x,jn,a),e.y=In(e.y,jn,o)},Bn=({photos:e,width:t=`100%`,height:n=480,cardWidth:r=120,cardHeight:i=140,scatter:a=1,friction:o=2,showCaption:s=!0,initialIndex:u=0,onPhotoClick:d,ariaLabel:f=`冰箱磁贴照片墙`,className:p,style:m})=>{let h=(0,c.useRef)(null),g=(0,c.useRef)([]),_=(0,c.useRef)([]),v=(0,c.useRef)([]),y=(0,c.useRef)(0),b=(0,c.useRef)(null),x=(0,c.useRef)(null),S=(0,c.useRef)(null),C=(0,c.useRef)(0),w=(0,c.useRef)(-1),T=(0,c.useRef)(d),E=(0,c.useRef)(e),D=(0,c.useRef)(o),O=(0,c.useRef)({w:r,h:i}),k=(0,c.useRef)({width:0,height:0}),[A,j]=(0,c.useState)({width:0,height:0}),[M,N]=(0,c.useState)(null),P=e.length,F=In(a,0,2.5),I=Math.round(i*(s?1-Nn:1)),L=s&&e.some(e=>e.title||e.description);(0,c.useEffect)(()=>{T.current=d,E.current=e,D.current=o,O.current={w:r,h:i}},[d,e,o,r,i]),(0,c.useEffect)(()=>{k.current=A},[A]);let R=(0,c.useMemo)(()=>Rn(P,A.width,A.height,r,i,F),[i,r,P,F,A.height,A.width]),z=(0,c.useCallback)(e=>{let t=g.current[e],n=_.current[e],r=v.current[e]??e;if(!t||!n)return;let i=x.current===e?An:1;t.style.zIndex=String(r),t.style.transform=`translate3d(${n.x}px, ${n.y}px, 0) rotate(${n.rot}deg) scale(${i})`},[]),B=(0,c.useCallback)(()=>{for(let e=0;e<_.current.length;e+=1)z(e)},[z]),V=(0,c.useCallback)(()=>{let{w:e,h:t}=O.current,n=k.current;_.current=R.map(e=>({x:e.x,y:e.y,rot:e.rot,vx:0,vy:0,vRot:0})),v.current=Array.from({length:P},(e,t)=>t),y.current=Math.max(P-1,0);let r=In(Math.floor(u),0,Math.max(0,P-1));P>0&&(y.current+=1,v.current[r]=y.current),_.current.forEach(r=>zn(r,e,t,n.width,n.height)),w.current=P,B()},[P,u,B,R]),H=(0,c.useCallback)(()=>{let{w:e,h:t}=O.current,n=k.current;n.width<=0||n.height<=0||_.current.forEach((r,i)=>{zn(r,e,t,n.width,n.height),z(i)})},[z]);(0,c.useEffect)(()=>{A.width<=0||A.height<=0||(w.current!==P||_.current.length!==P?V():H())},[V,H,P,A.height,A.width]),(0,c.useEffect)(()=>{let e=h.current;if(!e)return;let t=new ResizeObserver(([e])=>{let{width:t,height:n}=e.contentRect;j({width:t,height:n})});return t.observe(e),j({width:e.clientWidth,height:e.clientHeight}),()=>t.disconnect()},[]);let U=(0,c.useCallback)(()=>{S.current!==null&&(cancelAnimationFrame(S.current),S.current=null)},[]),W=(0,c.useRef)(()=>void 0);(0,c.useEffect)(()=>{W.current=e=>{let t=C.current?Math.min((e-C.current)/1e3,.032):.016;C.current=e;let{w:n,h:r}=O.current,i=k.current,a=Math.exp(-D.current*t*60),o=!1,s=_.current;for(let e=0;e<s.length;e+=1){if(x.current===e)continue;let c=s[e];c.x+=c.vx*t,c.y+=c.vy*t,c.rot+=c.vRot*t,c.vx*=a,c.vy*=a,c.vRot*=a,zn(c,n,r,i.width,i.height),Math.abs(c.vx)>kn||Math.abs(c.vy)>kn||Math.abs(c.vRot)>kn*.3?o=!0:(c.vx=0,c.vy=0,c.vRot=0),z(e)}o?S.current=requestAnimationFrame(e=>W.current(e)):S.current=null}},[z]);let G=(0,c.useCallback)(()=>{S.current===null&&(C.current=0,S.current=requestAnimationFrame(e=>W.current(e)))},[]);(0,c.useEffect)(()=>()=>U(),[U]);let K=(0,c.useCallback)(e=>{y.current+=1,v.current[e]=y.current,z(e)},[z]),q=e=>t=>{if(t.button!==0)return;let n=_.current[e];if(!n)return;let r=h.current?.getBoundingClientRect();if(!r)return;t.currentTarget.setPointerCapture(t.pointerId),t.preventDefault(),K(e),x.current=e,N(e);let i=t.clientX-r.left,a=t.clientY-r.top;b.current={pointerId:t.pointerId,index:e,grabDx:i-n.x,grabDy:a-n.y,startX:t.clientX,startY:t.clientY,lastX:t.clientX,lastY:t.clientY,lastTime:t.timeStamp,moved:0,vx:0,vy:0},n.vx=0,n.vy=0,n.vRot=0,z(e)},J=e=>{let t=b.current;if(!t||t.pointerId!==e.pointerId)return;let n=h.current?.getBoundingClientRect();if(!n)return;let r=e.clientX-t.startX,i=e.clientY-t.startY;t.moved=Math.max(t.moved,Math.hypot(r,i));let a=Math.max(e.timeStamp-t.lastTime,1)/1e3;t.vx=In(.65*((e.clientX-t.lastX)/a)+.35*t.vx,-1200,On),t.vy=In(.65*((e.clientY-t.lastY)/a)+.35*t.vy,-1200,On),t.lastX=e.clientX,t.lastY=e.clientY,t.lastTime=e.timeStamp;let o=_.current[t.index];if(!o)return;let{w:s,h:c}=O.current;o.x=e.clientX-n.left-t.grabDx,o.y=e.clientY-n.top-t.grabDy,o.rot+=t.vx*.0035,zn(o,s,c,k.current.width,k.current.height),z(t.index)},Y=e=>{let t=b.current;if(!t||t.pointerId!==e.pointerId)return;b.current=null,x.current=null,N(null),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId);let n=_.current[t.index];if(n){if(t.moved<=Dn){let e=E.current[t.index];e&&T.current?.(t.index,e),z(t.index);return}n.vx=t.vx*.5,n.vy=t.vy*.5,n.vRot=t.vx*.008,G(),z(t.index)}},ee=e=>{Y(e)},te=e=>{Y(e)};return(0,l.jsxs)(`div`,{className:[En.fridge,p].filter(Boolean).join(` `),style:{width:Fn(t),height:Fn(n),...m},role:`region`,"aria-label":f,children:[(0,l.jsx)(`div`,{className:En.handle,"aria-hidden":`true`}),(0,l.jsx)(`div`,{ref:h,className:En.stage,children:P===0?(0,l.jsx)(`div`,{className:En.empty,children:`暂无照片`}):e.map((e,t)=>{let n=L&&(e.title||e.description),a=En[Pn[t%Pn.length]];return(0,l.jsxs)(`div`,{ref:e=>{g.current[t]=e},className:[En.card,M===t?En.cardDragging:``].filter(Boolean).join(` `),style:{width:r,height:i},onPointerDown:q(t),onPointerMove:J,onPointerUp:ee,onPointerCancel:te,children:[(0,l.jsxs)(`div`,{className:En.magnetRow,"aria-hidden":`true`,children:[(0,l.jsx)(`span`,{className:`${En.magnet} ${a}`}),(0,l.jsx)(`span`,{className:`${En.magnet} ${En[Pn[(t+1)%Pn.length]]}`})]}),(0,l.jsx)(`div`,{className:En.photoFrame,style:{height:I},children:(0,l.jsx)(`img`,{className:En.image,src:e.src,alt:e.alt??e.title??``,draggable:!1})}),n?(0,l.jsxs)(`div`,{className:En.caption,children:[e.title?(0,l.jsx)(`p`,{className:En.title,children:e.title}):null,e.description?(0,l.jsx)(`p`,{className:En.description,children:e.description}):null]}):null]},`${e.src}-${t}`)})})]})},Vn=Math.PI*2/6,Hn=1.12,Un=2.05,Wn=.84,Gn=(e,t,n,r)=>{let{accentMat:i,trimMat:a,beadMat:o,silkMat:s}=t,c=Un,l=new u.Group;l.position.y=c/2+.16,e.add(l),l.add(new u.Mesh(new u.CylinderGeometry(.1,.14,.05,20),i));let d=new u.Mesh(new u.CylinderGeometry(.016,.02,.32,12),a);d.position.y=.2,l.add(d);let f=new u.Mesh(new u.SphereGeometry(.055,20,20),a);f.position.y=.38,l.add(f);let p=.012,m=new u.Mesh(new u.TorusGeometry(.06,p,12,36),a);m.position.y=.48,l.add(m);let h=new u.Mesh(new u.CylinderGeometry(.007,.007,.24,8),a);h.position.y=.672-p*.55,l.add(h);let g=new u.CylinderGeometry(.038,.048,.028,16),_=new u.SphereGeometry(.026,16,16);for(let t=0;t<6;t++){let r=t*Vn+Vn/2,o=n*.98*Math.sin(r),s=n*.98*Math.cos(r),l=new u.Group;l.position.set(o,c/2+.145,s);let d=new u.Mesh(g,i);d.castShadow=!0,l.add(d);let f=new u.Mesh(_,a);f.position.y=.03,f.castShadow=!0,l.add(f),e.add(l)}let v=new u.SphereGeometry(.032,14,14),y=new u.CylinderGeometry(.006,.006,.1,8),b=new u.SphereGeometry(.038,14,14),x=new u.CylinderGeometry(.01,.004,c*.4,6),S=c*.4;for(let t=0;t<6;t++){let r=t*Vn+Vn/2,i=new u.Group;i.position.set(Math.sin(r)*(n+.04),c/2-.02,Math.cos(r)*(n+.04)),i.add(new u.Mesh(v,o));let a=new u.Mesh(y,o);a.position.y=-.065,i.add(a);let l=new u.Mesh(b,s);l.position.y=-.13,i.add(l);for(let e=0;e<5;e++){let t=new u.Mesh(x,s);t.position.set((e-2)*.012,-.13-S/2,0),i.add(t)}e.add(i)}for(let t=0;t<18;t++){let n=t/18*Math.PI*2,i=new u.Mesh(new u.CylinderGeometry(.008,.003,.14+t%3*.02,6),s);i.position.set(r*.88*Math.sin(n),-c/2-.2,r*.88*Math.cos(n)),e.add(i)}},Kn=e=>{let t=e;t.map?.dispose(),t.emissiveMap?.dispose(),t.alphaMap?.dispose()},qn=e=>{(Array.isArray(e)?e:[e]).forEach(e=>{Kn(e),e.dispose()})},Jn=(e,t=new Set)=>{e.traverse(e=>{let n=e;n.isMesh&&(n.geometry?.dispose(),(Array.isArray(n.material)?n.material:[n.material]).forEach(e=>{!e||t.has(e)||(t.add(e),qn(e))}))})},Yn=e=>{let t=new u.Shape;for(let n=0;n<6;n++){let r=-Math.PI/6+n*Vn,i=Math.cos(r)*e,a=Math.sin(r)*e;n===0?t.moveTo(i,a):t.lineTo(i,a)}return t.closePath(),t},Xn=(e,t,n)=>{let r=new u.Shape,i=e/2,a=t/2,o=Math.min(n,i,a);return r.moveTo(-i+o,-a),r.lineTo(i-o,-a),r.quadraticCurveTo(i,-a,i,-a+o),r.lineTo(i,a-o),r.quadraticCurveTo(i,a,i-o,a),r.lineTo(-i+o,a),r.quadraticCurveTo(-i,a,-i,a-o),r.lineTo(-i,-a+o),r.quadraticCurveTo(-i,-a,-i+o,-a),r},Zn=(e,t,n,r,i,a)=>{let o=Xn(e,t,n);return o.holes.push(Xn(r,i,a)),o},Qn=e=>new u.Color(e),$n=()=>{let e=document.createElement(`canvas`);e.width=256,e.height=256;let t=e.getContext(`2d`),n=t.createRadialGradient(256/2,256/2,8,256/2,256/2,256/2);n.addColorStop(0,`rgba(90, 48, 22, 0.32)`),n.addColorStop(.35,`rgba(90, 48, 22, 0.13)`),n.addColorStop(.7,`rgba(90, 48, 22, 0.04)`),n.addColorStop(1,`rgba(90, 48, 22, 0)`),t.fillStyle=n,t.fillRect(0,0,256,256);let r=new u.CanvasTexture(e);return r.colorSpace=u.SRGBColorSpace,r},er=(e,t,n=512)=>{let r=document.createElement(`canvas`);r.width=n,r.height=n;let i=r.getContext(`2d`);i.fillStyle=e,i.fillRect(0,0,n,n);for(let e=0;e<56;e++){let r=(e+.5)/56*n;i.beginPath(),i.moveTo(r+Math.sin(e*.9)*10,0);for(let t=0;t<=n;t+=6)i.lineTo(r+Math.sin(t*.035+e*.7)*9+Math.sin(t*.01)*3,t);i.strokeStyle=t,i.globalAlpha=.06+e%7*.018,i.lineWidth=.8+e%4*.55,i.stroke()}for(let e=0;e<8;e++){let r=e/8*n+18;i.beginPath(),i.moveTo(r,0);for(let t=0;t<=n;t+=8)i.lineTo(r+Math.sin(t*.028+e)*14,t);i.strokeStyle=t,i.globalAlpha=.16,i.lineWidth=2.2,i.stroke()}i.globalAlpha=.045;for(let r=0;r<1800;r++)i.fillStyle=r%2==0?t:e,i.fillRect(Math.random()*n,Math.random()*n,1.2,1.2);i.globalAlpha=1;let a=new u.CanvasTexture(r);return a.colorSpace=u.SRGBColorSpace,a.wrapS=u.RepeatWrapping,a.wrapT=u.RepeatWrapping,a.needsUpdate=!0,a},tr=(e,t,n,r,i)=>{let a=er(e,t);return a.repeat.set(n,r),a.anisotropy=i,a},nr=(e,t,n,r)=>{e.colorSpace=u.SRGBColorSpace,e.anisotropy=r,e.wrapS=u.ClampToEdgeWrapping,e.wrapT=u.ClampToEdgeWrapping,e.center.set(.5,.5),e.generateMipmaps=!0,e.minFilter=u.LinearMipmapLinearFilter,e.magFilter=u.LinearFilter;let i=e.image,a=(i?.width||1)/(i?.height||1);t===`contain`?a>n?e.repeat.set(1,n/a):e.repeat.set(a/n,1):t===`fill`?e.repeat.set(1,1):a>n?e.repeat.set(n/a,1):e.repeat.set(1,a/n)},rr=`"PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif`,ir=e=>{if(`naturalWidth`in e){let t=e;return{w:t.naturalWidth||t.width,h:t.naturalHeight||t.height}}let t=e;return{w:t.width,h:t.height}},ar=(e,t,n)=>{let{w:r,h:i}=ir(e),a=Math.max(512,r||1024),o=Math.max(512,i||1024),s=document.createElement(`canvas`);s.width=a,s.height=o;let c=s.getContext(`2d`);if(c.drawImage(e,0,0,a,o),t||n){let e=o*.3,r=c.createLinearGradient(0,o-e,0,o);r.addColorStop(0,`rgba(8, 14, 22, 0)`),r.addColorStop(.45,`rgba(8, 14, 22, 0.42)`),r.addColorStop(1,`rgba(8, 14, 22, 0.78)`),c.fillStyle=r,c.fillRect(0,o-e,a,e),c.textAlign=`center`,c.textBaseline=`bottom`;let i=a*.88,s=Math.max(22,Math.round(o*.048)),l=Math.max(16,Math.round(o*.032));t&&(c.fillStyle=`#ffffff`,c.font=`600 ${s}px ${rr}`,c.shadowColor=`rgba(0,0,0,0.45)`,c.shadowBlur=8,c.shadowOffsetY=2,c.fillText(t,a/2,n?o-o*.085:o-o*.05,i)),n&&(c.fillStyle=`rgba(255,255,255,0.88)`,c.font=`400 ${l}px ${rr}`,c.shadowColor=`rgba(0,0,0,0.35)`,c.shadowBlur=6,c.fillText(n,a/2,o-o*.038,i)),c.shadowBlur=0,c.shadowOffsetY=0}let l=new u.CanvasTexture(s);return l.colorSpace=u.SRGBColorSpace,l.needsUpdate=!0,l},or=(e,t,n,r,i)=>new u.MeshPhysicalMaterial({color:e,map:t,metalness:0,roughness:n,clearcoat:r,clearcoatRoughness:i}),sr=(e,t,n)=>{let r=tr(`#c4a07a`,`#5a3a22`,1.4,2.2,n),i=tr(`#d4b896`,`#6a4a30`,1.2,1.8,n),a=tr(`#e0c6a0`,`#7a5638`,1,2.4,n),o=a.clone();return o.repeat.set(1.6,1.6),o.anisotropy=n,{frameMat:or(e,r,.62,.22,.55),accentMat:or(new u.Color(e).offsetHSL(.02,-.04,.1),i,.58,.28,.5),trimMat:or(new u.Color(e).offsetHSL(.03,-.08,.18),a,.48,.35,.4),beadMat:or(13211226,o,.42,.4,.35),silkMat:new u.MeshPhysicalMaterial({color:t,metalness:0,roughness:.62,sheen:1,sheenRoughness:.45,sheenColor:new u.Color(t).offsetHSL(0,-.1,.25)})}},cr=e=>{e.add(new u.HemisphereLight(16774891,12888202,.72));let t=new u.DirectionalLight(16774632,.85);t.position.set(4.2,6.5,5),t.castShadow=!0,t.shadow.mapSize.set(1024,1024),t.shadow.camera.near=1,t.shadow.camera.far=20,t.shadow.camera.left=-5,t.shadow.camera.right=5,t.shadow.camera.top=5,t.shadow.camera.bottom=-5,t.shadow.radius=3,t.shadow.bias=-8e-4,e.add(t);let n=new u.DirectionalLight(15783344,.34);n.position.set(-4,2.5,-2.5),e.add(n);let r=new u.DirectionalLight(16771280,.24);r.position.set(0,3,-5),e.add(r)},lr=(e,t,n,r)=>{let i=new u.ExtrudeGeometry(Yn(e),{depth:t,bevelEnabled:!0,bevelThickness:.025,bevelSize:.02,bevelSegments:3});i.rotateX(-Math.PI/2);let a=new u.Mesh(i,r);return a.position.y=n,a.castShadow=!0,a.receiveShadow=!0,a},ur=(e,t)=>{let n=new u.Scene;if(t.background)try{n.background=Qn(t.background)}catch{n.background=null}else n.background=null;let r=new u.PerspectiveCamera(34,t.width/t.height,.1,100);r.position.set(0,1.35,6.6),r.lookAt(0,.08,0);let i=new u.WebGLRenderer({canvas:e,antialias:!0,alpha:!0,powerPreference:`high-performance`});i.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),i.setSize(t.width,t.height,!1),i.setClearColor(0,0),i.outputColorSpace=u.SRGBColorSpace,i.toneMapping=u.ACESFilmicToneMapping,i.toneMappingExposure=1.12,i.shadowMap.enabled=!0,i.shadowMap.type=u.PCFSoftShadowMap;let a=Hn,o=Un,s=a*Wn,c=o*Wn,l=s/c,d=a/(2*Math.tan(Math.PI/6)),f=a/(2*Math.sin(Math.PI/6)),p=f*1.12,m=Qn(t.frameColor),h=Qn(t.paperColor),g=Qn(t.lightColor),_=Qn(t.tasselColor),v=new u.Group;v.rotation.x=u.MathUtils.degToRad(14),n.add(v);let y=new u.Group;v.add(y),cr(n);let b=i.capabilities.getMaxAnisotropy(),x=sr(m,_,b),{frameMat:S,accentMat:C}=x,w=[],T=new u.TextureLoader,E=new u.PlaneGeometry(s,c),D=new u.ExtrudeGeometry(Zn(a*.96,o*.96,.04,s+.02,c+.02,.025),{depth:.07,bevelEnabled:!0,bevelThickness:.012,bevelSize:.01,bevelSegments:2}),O=new u.ShapeGeometry(Zn(s+.05,c+.05,.028,s,c,.02));for(let e=0;e<6;e++){let t=e*Vn,n=new u.Group;n.position.set(Math.sin(t)*d,0,Math.cos(t)*d),n.rotation.y=t;let r=new u.Mesh(D,S);r.position.z=-.01,r.castShadow=!0,r.receiveShadow=!0,n.add(r);let i=new u.Mesh(O,C);i.position.z=.02,n.add(i);let a=new u.MeshBasicMaterial({color:h,map:null,toneMapped:!1,side:u.FrontSide,transparent:!0,opacity:1}),o=new u.Mesh(E,a);o.position.z=.032,o.userData.fadeTo=1,n.add(o),w.push(o),y.add(n)}let k=new u.CylinderGeometry(.038,.042,o-.12,20),A=new u.CylinderGeometry(.052,.048,.06,20);for(let e=0;e<6;e++){let t=e*Vn+Vn/2,n=Math.sin(t)*f,r=Math.cos(t)*f,i=new u.Mesh(k,S);i.position.set(n,0,r),i.castShadow=!0,y.add(i);let a=new u.Mesh(A,C);a.position.set(n,o/2-.05,r),a.castShadow=!0,y.add(a);let s=new u.Mesh(A,C);s.position.set(n,-o/2+.05,r),s.castShadow=!0,y.add(s)}y.add(lr(p,.1,o/2+.02,S)),y.add(lr(p*.78,.06,o/2+.12,S)),y.add(lr(p,.1,-o/2-.1,S)),y.add(lr(p*.62,.12,-o/2-.24,S));let j=new u.PointLight(g,3.2,7.5,1.35);j.position.set(0,-.08,0),j.castShadow=!1,y.add(j),j.add(new u.Mesh(new u.SphereGeometry(.07,24,24),new u.MeshBasicMaterial({color:16775408})));let M=new u.Mesh(new u.SphereGeometry(.14,24,24),new u.MeshBasicMaterial({color:g,transparent:!0,opacity:.35}));j.add(M);let N=new u.Mesh(new u.SphereGeometry(.32,24,24),new u.MeshBasicMaterial({color:g,transparent:!0,opacity:.12}));j.add(N),t.showAccessories&&Gn(y,x,f,d);let P=$n(),F=new u.Mesh(new u.PlaneGeometry(3.6,3.6),new u.MeshBasicMaterial({map:P,transparent:!0,depthWrite:!1,opacity:1}));F.rotation.x=-Math.PI/2,F.position.y=-o/2-.42,v.add(F);let I=t.initialAngleDeg;y.rotation.y=-u.MathUtils.degToRad(I);let L=new Map,R=new Map,z=new Map,B=0,V=!1,H=0,U=()=>{V||(V=!0,H&&=(window.clearTimeout(H),0),i.render(n,r),t.onReady?.())},W=()=>{B+=1},G=()=>{B=Math.max(0,B-1),B===0&&U()},K=(e,t,n)=>{let r=L.get(e);if(r){t(r);return}let i=z.get(e);if(i){i.resolve.push(t),i.reject.push(n);return}z.set(e,{resolve:[t],reject:[n]}),W(),T.load(e,t=>{L.set(e,t);let n=z.get(e);z.delete(e),n?.resolve.forEach(e=>e(t)),G()},void 0,()=>{let t=z.get(e);z.delete(e),t?.reject.forEach(e=>e()),G()})},q=(e,t)=>{e.map=null,e.color.copy(h),e.transparent=!0,e.opacity=1,e.needsUpdate=!0,t.userData.fadeTo=1},J=(e,t,n,r)=>{w.forEach((i,a)=>{let o=i.material,s=e[a];if(!s?.src){q(o,i);return}let c=(e,a)=>{let c=r?s.title:void 0,u=r?s.description:void 0,d=`${s.src}::${c||``}::${u||``}::${+!!r}`,f=R.get(d);f||(r&&(c||u)&&e.image?(f=ar(e.image,c,u),R.set(d,f)):f=e),nr(f,n,l,b),o.map=f,o.color.set(t?5592405:16777215),o.transparent=!0,o.opacity=+!a,i.userData.fadeTo=1,o.needsUpdate=!0};if(L.has(s.src)){c(L.get(s.src),!1);return}o.map=null,o.color.copy(h),o.opacity=1,o.needsUpdate=!0,K(s.src,e=>c(e,V),()=>q(o,i))})};J(t.photos,t.silhouette,t.objectFit,t.showCaption),B===0?U():H=window.setTimeout(U,1600);let Y=()=>{for(let e=0;e<w.length;e++){let t=w[e],n=t.material,r=t.userData.fadeTo;if(n.opacity===r)continue;let i=n.opacity+(r-n.opacity)*.22;n.opacity=Math.abs(i-r)<.02?r:i,n.opacity>=1&&r>=1&&n.map&&(n.transparent=!1)}};return{renderer:i,setAngleDeg:e=>{I=e,y.rotation.y=-u.MathUtils.degToRad(e)},getAngleDeg:()=>I,setLightSway:(e,t)=>{let n=Math.max(0,Math.min(1,t)),r=(Math.sin(e*1.55)*.16+Math.sin(e*2.6)*.08)*n,i=(Math.cos(e*1.2)*.1+Math.sin(e*2.9)*.07)*n-.06,a=(Math.sin(e*.85)*.09+Math.cos(e*2.1)*.05)*n,o=.88+Math.sin(e*5.1)*.07*n+Math.sin(e*9.2)*.04*n;j.position.set(r,i,a),j.intensity=1.6*o,M.material.opacity=.18*o,N.material.opacity=.06*o},setSize:(e,t)=>{r.aspect=e/Math.max(t,1),r.updateProjectionMatrix(),i.setSize(e,t,!1)},updatePhotos:J,render:()=>{Y(),i.render(n,r)},dispose:()=>{H&&window.clearTimeout(H),w.forEach(e=>{let t=e.material;t.map=null}),Jn(n),L.forEach(e=>e.dispose()),L.clear(),R.forEach(e=>e.dispose()),R.clear(),z.clear(),i.dispose()}}},dr=e=>{let t=(e%360+360)%360;return Math.round(t/60)%6},fr={root:`cos-root-6stAx`,canvas:`cos-canvas-xXFVP`,canvasReady:`cos-canvasReady-3z5WA`},pr=6,mr=720,hr=2.5,gr=90,_r=.045,vr=360,yr=480,br=e=>typeof e==`number`?`${e}px`:e,xr=(e,t,n)=>Math.max(t,Math.min(n,e)),Sr=(e,t,n)=>{if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e==`string`){let t=e.trim();if(t.endsWith(`%`)){let e=Number.parseFloat(t);if(Number.isFinite(e))return n*e/100}let r=Number.parseFloat(t);if(Number.isFinite(r))return r}return t},Cr=e=>typeof e==`string`&&e.startsWith(`#`)?e:void 0,wr=({photos:e,width:t=vr,height:n=yr,autoRotate:r=!0,autoRotateSpeed:i=14,dragSensitivity:a=.42,friction:o=1.4,frameColor:s=`#5c4033`,paperColor:u=`#faf4e8`,lightColor:d=`#f0b35a`,background:f,lightSway:p=1,showAccessories:m=!0,tasselColor:h=`#c94b3a`,objectFit:g=`cover`,silhouette:_=!1,showCaption:v=!1,initialAngle:y=0,onFaceChange:x,onPhotoClick:S,ariaLabel:C=`走马灯图片预览`,className:w,style:T})=>{let E=(0,c.useRef)(null),D=(0,c.useRef)(null),O=(0,c.useRef)(null),k=(0,c.useRef)(y),A=(0,c.useRef)(0),j=(0,c.useRef)(!1),M=(0,c.useRef)(null),N=(0,c.useRef)(0),P=(0,c.useRef)(0),F=(0,c.useRef)(!1),I=(0,c.useRef)(0),L=(0,c.useRef)(!1),R=(0,c.useRef)(dr(y)),z=(0,c.useRef)(x),B=(0,c.useRef)(S),V=(0,c.useRef)([]),H=(0,c.useRef)(r),U=(0,c.useRef)(i),W=(0,c.useRef)(o),G=(0,c.useRef)(p),K=(0,c.useRef)(a),[q,J]=(0,c.useState)(()=>dr(y)),[Y,ee]=(0,c.useState)({w:vr,h:yr}),[te,ne]=(0,c.useState)(!1),X=(0,c.useMemo)(()=>Array.from({length:6},(t,n)=>e[n]),[e]);(0,c.useEffect)(()=>{V.current=X,z.current=x,B.current=S,H.current=r,U.current=i,W.current=o,G.current=p,K.current=a},[X,x,S,r,i,o,p,a]),(0,c.useEffect)(()=>{let e=E.current;if(!e)return;let r=()=>{let r=e.parentElement,i=r?.clientWidth||window.innerWidth,a=r?.clientHeight||window.innerHeight;ee({w:Sr(t,vr,i),h:Sr(n,yr,a)})};r();let i=new ResizeObserver(r);return i.observe(e),e.parentElement&&i.observe(e.parentElement),()=>i.disconnect()},[t,n]),(0,c.useEffect)(()=>{let e=D.current;if(!e||Y.w<=0||Y.h<=0)return;let t=ur(e,{width:Y.w,height:Y.h,photos:V.current,frameColor:s,paperColor:u,lightColor:d,tasselColor:h,showAccessories:m,showCaption:v,silhouette:_,objectFit:g||`cover`,background:Cr(f),initialAngleDeg:k.current,onReady:()=>ne(!0)});return O.current=t,()=>{t.dispose(),O.current=null}},[Y.w,Y.h,s,u,d,h,m,f]),(0,c.useEffect)(()=>{O.current?.updatePhotos(X,_,g||`cover`,v)},[X,_,g,v]),(0,c.useEffect)(()=>{let e=b(e=>{L.current=e}),t=0,n=performance.now(),r=e=>{t=requestAnimationFrame(r);let i=O.current;if(!i||L.current){n=e;return}let a=Math.min(.05,(e-n)/1e3);if(n=e,!j.current){let e=A.current;Math.abs(e)>hr?(e*=Math.exp(-W.current*a),Math.abs(e)<=hr&&(e=0),A.current=e,k.current+=e*a,i.setAngleDeg(k.current)):H.current&&(k.current+=U.current*a,i.setAngleDeg(k.current))}let o=dr(k.current);o!==R.current&&(R.current=o,J(o),z.current?.(o,V.current[o])),i.setLightSway(e/1e3,G.current),i.render()};return t=requestAnimationFrame(r),()=>{cancelAnimationFrame(t),e()}},[]);let re=(e,t)=>{if(j.current){if(j.current=!1,M.current=null,!t||e-P.current>gr){A.current=0;return}A.current=xr(A.current,-720,mr)}},ie=e=>{e.button===0&&(j.current=!0,F.current=!1,M.current=e.pointerId,I.current=e.clientX,N.current=e.clientX,P.current=e.timeStamp,A.current=0,e.currentTarget.setPointerCapture(e.pointerId))},ae=e=>{if(!j.current||M.current!==e.pointerId)return;let t=e.clientX-N.current,n=Math.max(.008,(e.timeStamp-P.current)/1e3);Math.abs(e.clientX-I.current)>pr&&(F.current=!0);let r=K.current;k.current-=t*r,O.current?.setAngleDeg(k.current);let i=-t/n*r,a=1-Math.exp(-n/_r);A.current+=(i-A.current)*a,N.current=e.clientX,P.current=e.timeStamp},oe=e=>{if(M.current!==e.pointerId)return;let t=!F.current;re(e.timeStamp,!0);try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}if(t){let e=V.current[R.current];e&&B.current?.(R.current,e)}},se=e=>{M.current===e.pointerId&&re(e.timeStamp,!1)},ce=X[q],le=v&&ce?.title?`,当前:${ce.title}${ce.description?`,${ce.description}`:``}`:``;return(0,l.jsx)(`div`,{ref:E,className:[fr.root,w].filter(Boolean).join(` `),style:{width:br(t),height:br(n),...f===void 0?null:{background:f},...T},role:`img`,"aria-label":C+le,onPointerDown:ie,onPointerMove:ae,onPointerUp:oe,onPointerCancel:se,children:(0,l.jsx)(`canvas`,{ref:D,className:[fr.canvas,te?fr.canvasReady:``].filter(Boolean).join(` `)})})},Tr={lightbox:`cos-lightbox-bqk2N`,stage:`cos-stage-D827Z`,table:`cos-table-mnUIm`,slot:`cos-slot-vt-ci`,slide:`cos-slide-RMjUk`,slideBehind:`cos-slideBehind-WGhIm`,slideActive:`cos-slideActive-ESL-9`,slideExiting:`cos-slideExiting-CPoNN`,slideImageWrap:`cos-slideImageWrap-NuRq7`,slideImage:`cos-slideImage--AcPS`,caption:`cos-caption-QLSVi`,captionTitle:`cos-captionTitle-a3aRv`,captionDesc:`cos-captionDesc-GQ6bR`,empty:`cos-empty-jO5QV`},Er=6,Dr=260,Or=320,kr=e=>typeof e==`number`?`${e}px`:e,Ar=(e,t)=>t<=0?0:Math.max(0,Math.min(t-1,Math.floor(e))),jr=({photos:e,width:t=360,height:n=480,slideWidth:r=200,slideHeight:i=280,pullThreshold:a=100,showCaption:o=!0,initialIndex:s=0,onPhotoClick:u,onIndexChange:d,ariaLabel:f=`Photo lightbox`,className:p,style:m})=>{let h=(0,c.useRef)(null),g=(0,c.useRef)(null),_=(0,c.useRef)(Ar(s,e.length)),v=(0,c.useRef)(u),y=(0,c.useRef)(d),b=(0,c.useRef)(e),x=(0,c.useRef)(null),[S,C]=(0,c.useState)(()=>Ar(s,e.length)),[w,T]=(0,c.useState)(0),[E,D]=(0,c.useState)(`idle`),O=e.length,k=e[S],A=S<O-1?e[S+1]:void 0,j=S>0,M=S<O-1;(0,c.useEffect)(()=>{v.current=u,y.current=d,b.current=e},[u,d,e]),(0,c.useEffect)(()=>{_.current=S},[S]),(0,c.useEffect)(()=>()=>{x.current!=null&&window.clearTimeout(x.current)},[]);let N=(0,c.useCallback)(e=>{let t=b.current,n=Ar(e,t.length);C(n),_.current=n;let r=t[n];r&&y.current?.(n,r)},[]),P=(0,c.useCallback)(e=>{N(e),T(0),D(`idle`)},[N]),F=(0,c.useCallback)(e=>{let t=e*(r+72);D(`exiting`),T(t),x.current!=null&&window.clearTimeout(x.current),x.current=window.setTimeout(()=>{P(Ar(_.current+e,b.current.length))},Dr)},[P,r]),I=(0,c.useCallback)(()=>{D(`snapping`),T(0),window.setTimeout(()=>D(`idle`),Or)},[]),L=(0,c.useCallback)(e=>{Ar(_.current+e,b.current.length)!==_.current&&F(e>0?1:-1)},[F]),R=(0,c.useCallback)(e=>{E===`exiting`||O===0||(g.current={pointerId:e.pointerId,startX:e.clientX,moved:!1},D(`dragging`),e.currentTarget.setPointerCapture(e.pointerId))},[O,E]),z=(0,c.useCallback)(e=>{let t=g.current;if(!t||t.pointerId!==e.pointerId||E===`exiting`)return;let n=e.clientX-t.startX;Math.abs(n)>Er&&(t.moved=!0),T(n>0&&!M||n<0&&!j?n*.28:n)},[M,j,E]),B=(0,c.useCallback)(e=>{let t=g.current;if(!t||t.pointerId!==e.pointerId||(g.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),E===`exiting`))return;let n=e.clientX-t.startX;if(!t.moved){D(`idle`),T(0);let e=b.current[_.current];e&&v.current?.(_.current,e);return}if(Math.abs(n)>=a){let e=n>0?1:-1;if(e>0&&M||e<0&&j){F(e);return}}I()},[F,M,j,E,a,I]),V=(0,c.useCallback)(e=>{let t=g.current;!t||t.pointerId!==e.pointerId||(g.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),E!==`exiting`&&I())},[E,I]);(0,c.useEffect)(()=>{let e=h.current;if(!e)return;let t=e=>{e.key===`ArrowRight`?(e.preventDefault(),L(1)):e.key===`ArrowLeft`&&(e.preventDefault(),L(-1))};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[L]);let H=Math.max(24,(typeof t==`number`?t:r+48)*.08),U=Math.max(28,(typeof n==`number`?n:i+56)*.1),W=r+H*2,G=i+U*2,K=`translate(-50%, -50%) translateX(${w}px)`,q=E===`snapping`||E===`exiting`?`transform ${E===`exiting`?Dr:Or}ms cubic-bezier(0.22, 1, 0.36, 1), opacity ${Dr}ms ease`:`none`,J=e=>!o||!e.title&&!e.description?null:(0,l.jsxs)(`div`,{className:Tr.caption,children:[e.title?(0,l.jsx)(`div`,{className:Tr.captionTitle,children:e.title}):null,e.description?(0,l.jsx)(`div`,{className:Tr.captionDesc,children:e.description}):null]}),Y=(e,t,n,a,s)=>{let c=i-(o&&(e.title||e.description)?44:0);return(0,l.jsxs)(`div`,{className:[Tr.slide,n===`active`?Tr.slideActive:Tr.slideBehind,s].filter(Boolean).join(` `),style:{width:r,height:i,transform:a,transition:q,opacity:n===`active`&&E===`exiting`?.35:void 0},onPointerDown:n===`active`?R:void 0,onPointerMove:n===`active`?z:void 0,onPointerUp:n===`active`?B:void 0,onPointerCancel:n===`active`?V:void 0,role:n===`active`?`button`:void 0,"aria-label":n===`active`?e.alt||e.title||`Slide ${t+1} of ${O}`:void 0,children:[(0,l.jsx)(`div`,{className:Tr.slideImageWrap,style:{height:c},children:(0,l.jsx)(`img`,{className:Tr.slideImage,src:e.src,alt:e.alt||e.title||``,draggable:!1})}),J(e)]})};return(0,l.jsx)(`div`,{ref:h,className:[Tr.lightbox,p].filter(Boolean).join(` `),style:{width:kr(t),height:kr(n),...m},role:`region`,"aria-label":f,tabIndex:0,children:(0,l.jsx)(`div`,{className:Tr.stage,children:O===0?(0,l.jsx)(`div`,{className:Tr.empty,children:`No photos`}):(0,l.jsx)(`div`,{className:Tr.table,style:{width:W,height:G},children:(0,l.jsxs)(`div`,{className:Tr.slot,style:{width:r,height:i},children:[A?Y(A,S+1,`behind`,`translate(-50%, calc(-50% + 14px)) scale(0.94)`):null,k?Y(k,S,`active`,K,E===`exiting`?Tr.slideExiting:void 0):null]})})})})},Mr={polaroid:`cos-polaroid-ouSvd`,stage:`cos-stage-VPNlO`,card:`cos-card-J8utI`,cardDragging:`cos-cardDragging-0Gy8K`,imageWrap:`cos-imageWrap-vGQwm`,image:`cos-image-gNSgv`,caption:`cos-caption-Bewfy`,title:`cos-title-eUY1D`,description:`cos-description-dFhlF`,empty:`cos-empty-Zk3rN`},Nr=6,Pr=1400,Fr=.12,Ir=.86,Lr=.88,Rr=1.04,zr=.22,Br=e=>typeof e==`number`?`${e}px`:e,Vr=(e,t,n)=>Math.min(n,Math.max(t,e)),Hr=e=>{let t=Math.sin(e*127.1+31.7)*43758.5453;return t-Math.floor(t)},Ur=(e,t,n,r,i,a)=>{if(e<=0||t<=0||n<=0)return[];let o=Math.max(0,t-r)*.38*a,s=Math.max(0,n-i)*.28*a,c=t*.5-r*.5,l=n*.5-i*.5;return Array.from({length:e},(t,n)=>{let r=e<=1?.5:n/(e-1),i=Math.sin(r*Math.PI)*s*.28,u=(r-.5)*o*1.65,d=(Hr(n*7.13+2.1)*2-1)*o*.42,f=(Hr(n*11.37+5.9)*2-1)*s*.38,p=(Hr(n*3.71+1.4)*2-1)*14*a;return{restX:c+u+d,restY:l-i+f,restRot:p}})},Wr=({photos:e,width:t=`100%`,height:n=420,cardWidth:r=150,cardHeight:i=180,scatter:a=1,showCaption:o=!0,initialIndex:s=0,onPhotoClick:u,ariaLabel:d=`拍立得照片堆叠`,className:f,style:p})=>{let m=(0,c.useRef)(null),h=(0,c.useRef)([]),g=(0,c.useRef)([]),_=(0,c.useRef)([]),v=(0,c.useRef)([]),y=(0,c.useRef)(0),b=(0,c.useRef)(null),x=(0,c.useRef)(null),S=(0,c.useRef)(null),C=(0,c.useRef)(0),w=(0,c.useRef)(u),T=(0,c.useRef)(e),[E,D]=(0,c.useState)({width:0,height:0}),[O,k]=(0,c.useState)(null),A=e.length,j=Vr(a,0,2.5),M=Math.round(i*(1-zr)),N=o&&e.some(e=>e.title||e.description);(0,c.useEffect)(()=>{w.current=u,T.current=e},[u,e]);let P=(0,c.useMemo)(()=>Ur(A,E.width,E.height,r,i,j),[i,r,A,j,E.height,E.width]),F=(0,c.useCallback)(e=>{let t=h.current[e],n=_.current[e],r=v.current[e]??e;if(!t||!n)return;let i=x.current===e?Rr:1;t.style.zIndex=String(r),t.style.transform=`translate3d(${n.x}px, ${n.y}px, 0) rotate(${n.rot}deg) scale(${i})`},[]),I=(0,c.useCallback)(()=>{for(let e=0;e<_.current.length;e+=1)F(e)},[F]),L=(0,c.useCallback)(()=>{g.current=P,_.current=P.map(e=>({x:e.restX,y:e.restY,rot:e.restRot,vx:0,vy:0,vRot:0})),v.current=Array.from({length:A},(e,t)=>t),y.current=Math.max(A-1,0);let e=Vr(Math.floor(s),0,Math.max(0,A-1));A>0&&(y.current+=1,v.current[e]=y.current),I()},[A,s,I,P]);(0,c.useEffect)(()=>{L()},[L]),(0,c.useEffect)(()=>{let e=m.current;if(!e)return;let t=new ResizeObserver(([e])=>{let{width:t,height:n}=e.contentRect;D({width:t,height:n})});return t.observe(e),D({width:e.clientWidth,height:e.clientHeight}),()=>t.disconnect()},[]);let R=(0,c.useCallback)(()=>{S.current!==null&&(cancelAnimationFrame(S.current),S.current=null)},[]),z=(0,c.useRef)(()=>void 0);(0,c.useEffect)(()=>{z.current=e=>{let t=C.current?Math.min((e-C.current)/1e3,.032):.016;C.current=e;let n=!1,r=_.current;for(let e=0;e<r.length;e+=1){if(x.current===e)continue;let i=r[e];i.x+=i.vx*t,i.y+=i.vy*t,i.rot+=i.vRot*t;let a=Ir**(t*60),o=Lr**(t*60);i.vx*=a,i.vy*=a,i.vRot*=o,Math.abs(i.vx)>Fr||Math.abs(i.vy)>Fr||Math.abs(i.vRot)>Fr*.35?n=!0:(i.vx=0,i.vy=0,i.vRot=0),F(e)}n?S.current=requestAnimationFrame(e=>z.current(e)):S.current=null}},[F]);let B=(0,c.useCallback)(()=>{S.current===null&&(C.current=0,S.current=requestAnimationFrame(e=>z.current(e)))},[]);(0,c.useEffect)(()=>()=>R(),[R]);let V=(0,c.useCallback)(e=>{y.current+=1,v.current[e]=y.current,F(e)},[F]),H=e=>t=>{if(t.button!==0)return;let n=_.current[e];if(!n)return;let r=m.current?.getBoundingClientRect();if(!r)return;t.currentTarget.setPointerCapture(t.pointerId),t.preventDefault(),V(e),x.current=e,k(e);let i=t.clientX-r.left,a=t.clientY-r.top;b.current={pointerId:t.pointerId,index:e,grabDx:i-n.x,grabDy:a-n.y,startX:t.clientX,startY:t.clientY,lastX:t.clientX,lastY:t.clientY,lastTime:t.timeStamp,moved:0,vx:0,vy:0},n.vx=0,n.vy=0,n.vRot=0,F(e)},U=e=>{let t=b.current;if(!t||t.pointerId!==e.pointerId)return;let n=m.current?.getBoundingClientRect();if(!n)return;let r=e.clientX-t.startX,i=e.clientY-t.startY;t.moved=Math.max(t.moved,Math.hypot(r,i));let a=Math.max(e.timeStamp-t.lastTime,1)/1e3;t.vx=Vr(.65*((e.clientX-t.lastX)/a)+.35*t.vx,-1400,Pr),t.vy=Vr(.65*((e.clientY-t.lastY)/a)+.35*t.vy,-1400,Pr),t.lastX=e.clientX,t.lastY=e.clientY,t.lastTime=e.timeStamp;let o=_.current[t.index];o&&(o.x=e.clientX-n.left-t.grabDx,o.y=e.clientY-n.top-t.grabDy,o.rot+=t.vx*.0045,F(t.index))},W=e=>{let t=b.current;if(!t||t.pointerId!==e.pointerId)return;b.current=null,x.current=null,k(null),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId);let n=_.current[t.index];if(n){if(t.moved<=Nr){let e=T.current[t.index];e&&w.current?.(t.index,e),F(t.index);return}n.vx=t.vx*.55,n.vy=t.vy*.55,n.vRot=t.vx*.012,B(),F(t.index)}},G=e=>{W(e)},K=e=>{W(e)};return(0,l.jsx)(`div`,{className:[Mr.polaroid,f].filter(Boolean).join(` `),style:{width:Br(t),height:Br(n),...p},role:`region`,"aria-label":d,children:(0,l.jsx)(`div`,{ref:m,className:Mr.stage,children:A===0?(0,l.jsx)(`div`,{className:Mr.empty,children:`暂无照片`}):e.map((e,t)=>{let n=N&&(e.title||e.description);return(0,l.jsxs)(`div`,{ref:e=>{h.current[t]=e},className:[Mr.card,O===t?Mr.cardDragging:``].filter(Boolean).join(` `),style:{width:r,height:i},onPointerDown:H(t),onPointerMove:U,onPointerUp:G,onPointerCancel:K,children:[(0,l.jsx)(`div`,{className:Mr.imageWrap,style:{height:M},children:(0,l.jsx)(`img`,{className:Mr.image,src:e.src,alt:e.alt??e.title??``,draggable:!1})}),n?(0,l.jsxs)(`div`,{className:Mr.caption,children:[e.title?(0,l.jsx)(`p`,{className:Mr.title,children:e.title}):null,e.description?(0,l.jsx)(`p`,{className:Mr.description,children:e.description}):null]}):null]},`${e.src}-${t}`)})})})},Q={postcard:`cos-postcard-g2207`,stage:`cos-stage-jZQ8g`,stack:`cos-stack-fblvy`,stackCard:`cos-stackCard-vGX-D`,cardSlot:`cos-cardSlot-r9iP9`,cardActive:`cos-cardActive-oxk4p`,cardExiting:`cos-cardExiting-PLlYP`,flipInner:`cos-flipInner--e4Ib`,flipped:`cos-flipped-IIL2I`,face:`cos-face-5lB6h`,front:`cos-front-C--cv`,back:`cos-back-3zraM`,photoFrame:`cos-photoFrame-HWolG`,photoFrameWithCaption:`cos-photoFrameWithCaption-4crS0`,photoWrap:`cos-photoWrap-WK92L`,photo:`cos-photo-bdRgi`,cornerStamp:`cos-cornerStamp-Xq-fF`,frontCaption:`cos-frontCaption-w8czv`,frontCaptionTitle:`cos-frontCaptionTitle-rVeaq`,frontCaptionDesc:`cos-frontCaptionDesc-i7PGX`,linedPaper:`cos-linedPaper-iYgmF`,greeting:`cos-greeting-MkrH1`,bodyText:`cos-bodyText-2YX8O`,bodyPlaceholder:`cos-bodyPlaceholder-qovIN`,backFooter:`cos-backFooter-3Dn0w`,stampSquare:`cos-stampSquare-fGd3a`,postmark:`cos-postmark-1FaXp`,postmarkText:`cos-postmarkText-1Ewtv`,divider:`cos-divider-Wgj-N`,empty:`cos-empty-Ys5A1`,hint:`cos-hint-JGozg`},Gr=6,Kr=280,qr=320,Jr=e=>typeof e==`number`?`${e}px`:e,Yr=(e,t)=>t<=0?0:(e%t+t)%t,Xr=(e,t)=>t<=0?0:Math.max(0,Math.min(t-1,Math.floor(e))),Zr=e=>{let t=Math.sin(e*127.1+31.7)*43758.5453;return t-Math.floor(t)},Qr=({photo:e,showCaption:t})=>{let n=t&&(e.title||e.description),r=e.title?e.title:`Greetings from the road`;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:`${Q.face} ${Q.front}`,children:[(0,l.jsx)(`div`,{className:`${Q.photoFrame} ${n?Q.photoFrameWithCaption:``}`,children:(0,l.jsx)(`div`,{className:Q.photoWrap,children:(0,l.jsx)(`img`,{className:Q.photo,src:e.src,alt:e.alt??e.title??``,draggable:!1})})}),(0,l.jsx)(`div`,{className:Q.cornerStamp,"aria-hidden":`true`}),n?(0,l.jsxs)(`div`,{className:Q.frontCaption,children:[e.title?(0,l.jsx)(`p`,{className:Q.frontCaptionTitle,children:e.title}):null,e.description?(0,l.jsx)(`p`,{className:Q.frontCaptionDesc,children:e.description}):null]}):null]}),(0,l.jsxs)(`div`,{className:`${Q.face} ${Q.back}`,children:[(0,l.jsx)(`div`,{className:Q.divider,"aria-hidden":`true`}),(0,l.jsxs)(`div`,{className:Q.linedPaper,children:[(0,l.jsx)(`p`,{className:Q.greeting,children:r}),e.description?(0,l.jsx)(`p`,{className:Q.bodyText,children:e.description}):(0,l.jsx)(`p`,{className:Q.bodyPlaceholder,children:`Wish you were here…`})]}),(0,l.jsxs)(`div`,{className:Q.backFooter,children:[(0,l.jsx)(`div`,{className:Q.postmark,"aria-hidden":`true`,children:(0,l.jsxs)(`span`,{className:Q.postmarkText,children:[`TRAVEL`,(0,l.jsx)(`br`,{}),`POST`]})}),(0,l.jsx)(`div`,{className:Q.stampSquare,"aria-hidden":`true`})]})]})]})},$r=({photos:e,width:t=360,height:n=420,cardWidth:r=260,cardHeight:i=170,pullThreshold:a=80,showCaption:o=!0,initialIndex:s=0,initialFlipped:u=!1,onPhotoClick:d,onIndexChange:f,onFlipChange:p,ariaLabel:m=`明信片`,className:h,style:g})=>{let _=(0,c.useRef)(null),v=(0,c.useRef)(null),y=(0,c.useRef)(Xr(s,e.length)),b=(0,c.useRef)(d),x=(0,c.useRef)(f),S=(0,c.useRef)(p),C=(0,c.useRef)(e),w=(0,c.useRef)(null),[T,E]=(0,c.useState)(()=>Xr(s,e.length)),[D,O]=(0,c.useState)(u),[k,A]=(0,c.useState)(0),[j,M]=(0,c.useState)(`idle`),N=e.length,P=e[T];(0,c.useEffect)(()=>{b.current=d,x.current=f,S.current=p,C.current=e},[d,f,p,e]),(0,c.useEffect)(()=>{y.current=T},[T]),(0,c.useEffect)(()=>()=>{w.current!=null&&window.clearTimeout(w.current)},[]);let F=(0,c.useMemo)(()=>N<=1?[]:[1,2].slice(0,Math.min(2,N-1)).map(e=>{let t=T*13.7+e*5.3;return{depth:e,rot:(Zr(t)*2-1)*5.5,dx:e*5+Zr(t+1.1)*4,dy:e*3+Zr(t+2.4)*3}}),[N,T]),I=(0,c.useCallback)(e=>{let t=C.current,n=Xr(e,t.length);E(n),y.current=n,O(!1),S.current?.(!1);let r=t[n];r&&x.current?.(n,r)},[]),L=(0,c.useCallback)(e=>{I(e),A(0),M(`idle`)},[I]),R=(0,c.useCallback)(e=>{let t=e*(r*.55+48);M(`exiting`),A(t),w.current!=null&&window.clearTimeout(w.current),w.current=window.setTimeout(()=>{let t=C.current;L(Yr(y.current+e,t.length))},Kr)},[r,L]),z=(0,c.useCallback)(()=>{M(`snapping`),A(0),window.setTimeout(()=>M(`idle`),qr)},[]),B=(0,c.useCallback)(e=>{C.current.length<=1||R(e>0?1:-1)},[R]),V=(0,c.useCallback)(()=>{O(e=>{let t=!e;return S.current?.(t),t})},[]),H=(0,c.useCallback)(e=>{j===`exiting`||N===0||(v.current={pointerId:e.pointerId,startX:e.clientX,moved:!1},M(`dragging`),e.currentTarget.setPointerCapture(e.pointerId))},[N,j]),U=(0,c.useCallback)(e=>{let t=v.current;if(!t||t.pointerId!==e.pointerId||j===`exiting`)return;let n=e.clientX-t.startX;Math.abs(n)>Gr&&(t.moved=!0),A(N<=1?n*.22:n)},[N,j]),W=(0,c.useCallback)(e=>{let t=v.current;if(!t||t.pointerId!==e.pointerId||(v.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),j===`exiting`))return;let n=e.clientX-t.startX;if(!t.moved){M(`idle`),A(0),V();let e=C.current[y.current];e&&b.current?.(y.current,e);return}if(Math.abs(n)>=a&&N>1){R(n>0?1:-1);return}z()},[R,N,j,a,z,V]),G=(0,c.useCallback)(e=>{let t=v.current;!t||t.pointerId!==e.pointerId||(v.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),j!==`exiting`&&z())},[j,z]);(0,c.useEffect)(()=>{let e=_.current;if(!e)return;let t=e=>{e.key===`ArrowRight`?(e.preventDefault(),B(1)):e.key===`ArrowLeft`?(e.preventDefault(),B(-1)):(e.key===` `||e.key===`Enter`)&&(e.preventDefault(),V())};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[B,V]);let K=`translateX(${k}px)`,q=j===`snapping`||j===`exiting`?`transform ${j===`exiting`?Kr:qr}ms cubic-bezier(0.22, 1, 0.36, 1), opacity ${Kr}ms ease`:`none`,J=[Q.postcard,h].filter(Boolean).join(` `),Y=[Q.cardActive,D?Q.flipped:``,j===`exiting`?Q.cardExiting:``].filter(Boolean).join(` `);return(0,l.jsx)(`div`,{ref:_,className:J,style:{width:Jr(t),height:Jr(n),...g},role:`region`,"aria-label":m,tabIndex:0,children:(0,l.jsx)(`div`,{className:Q.stage,children:N===0?(0,l.jsx)(`div`,{className:Q.empty,children:`暂无明信片`}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:Q.stack,style:{width:r,height:i},children:[F.map(({depth:e,rot:t,dx:n,dy:a})=>(0,l.jsx)(`div`,{className:Q.stackCard,style:{width:r,height:i,transform:`translate(calc(-50% + ${n}px), calc(-50% + ${a}px)) rotate(${t}deg)`,opacity:e===1?.92:.78},"aria-hidden":`true`},e)),(0,l.jsx)(`div`,{className:Q.cardSlot,style:{width:r,height:i},children:(0,l.jsx)(`div`,{className:Y,style:{width:r,height:i,transform:K,transition:q,opacity:j===`exiting`?.55:1},onPointerDown:H,onPointerMove:U,onPointerUp:W,onPointerCancel:G,role:`button`,"aria-label":P?`${D?`背面`:`正面`}:${P.alt??P.title??`明信片 ${T+1}`}`:void 0,"aria-pressed":D,children:P?(0,l.jsx)(`div`,{className:Q.flipInner,children:(0,l.jsx)(Qr,{photo:P,showCaption:o})}):null})})]}),N>1?(0,l.jsx)(`div`,{className:Q.hint,children:`拖拽切换 · 点击查看背面`}):null]})})})},ei={root:`cos-root-2T188`,stage:`cos-stage-C0Wkx`,floatWrap:`cos-floatWrap-XWQUl`,cube:`cos-cube-TPTSs`,face:`cos-face-Am85d`,front:`cos-front-QMqKk`,back:`cos-back-AXzOG`,right:`cos-right-m-nHP`,left:`cos-left-2UKCq`,top:`cos-top-9GHQa`,bottom:`cos-bottom-HI67S`,photo:`cos-photo-CbyrW`,placeholder:`cos-placeholder-i9IG0`,caption:`cos-caption-LkGpj`,glow:`cos-glow-1fpVK`},ti=6,ni=6,ri=640,ii=2.2,ai=90,oi=.045,si=7.5,ci=5,li=4.8,ui=(e,t,n)=>Math.max(t,Math.min(n,e)),di=380,fi=380,pi=200,mi=e=>typeof e==`number`?`${e}px`:e,hi=[`front`,`back`,`right`,`left`,`top`,`bottom`],gi=e=>{let t=(e%360+360)%360;return t>180&&(t-=360),t},_i=(e,t)=>{let n=gi(e),r=(t%360+360)%360;return n>45?4:n<-45?5:r>=315||r<45?0:r>=45&&r<135?2:r>=135&&r<225?1:3},vi=({photos:e,width:t=di,height:n=fi,size:r=pi,autoRotate:i=!0,dragSensitivity:a=.4,friction:o=1.35,showCaption:s=!0,onPhotoClick:u,ariaLabel:d=`照片棱镜`,className:f,style:p})=>{let m=(0,c.useRef)(null),h=(0,c.useRef)(null),g=(0,c.useRef)(null),_=(0,c.useRef)(-12),v=(0,c.useRef)(-28),y=(0,c.useRef)(0),x=(0,c.useRef)(0),S=(0,c.useRef)(!1),C=(0,c.useRef)(null),w=(0,c.useRef)(0),T=(0,c.useRef)(0),E=(0,c.useRef)(0),D=(0,c.useRef)(!1),O=(0,c.useRef)(0),k=(0,c.useRef)(0),A=(0,c.useRef)(!1),j=(0,c.useRef)(_i(-12,-28)),M=(0,c.useRef)(u),N=(0,c.useRef)([]),P=(0,c.useRef)(i),F=(0,c.useRef)(o),I=(0,c.useRef)(a),[L,R]=(0,c.useState)(()=>_i(-12,-28)),z=(0,c.useMemo)(()=>Array.from({length:ti},(t,n)=>e[n]),[e]);(0,c.useEffect)(()=>{N.current=z,M.current=u,P.current=i,F.current=o,I.current=a},[z,u,i,o,a]),(0,c.useEffect)(()=>{let e=b(e=>{A.current=e}),t=0,n=performance.now(),r=0,i=e=>{let t=h.current,n=g.current;if(!t||!n)return;t.style.transform=`rotateX(${_.current}deg) rotateY(${v.current}deg)`,n.style.transform=`translateY(${e}px)`;let r=_i(_.current,v.current);r!==j.current&&(j.current=r,R(r))},a=e=>{if(t=requestAnimationFrame(a),A.current){n=e;return}let o=Math.min(.05,(e-n)/1e3);if(n=e,r+=o,!S.current){let e=y.current,t=x.current;if(Math.abs(e)>ii||Math.abs(t)>ii){let n=Math.exp(-F.current*o);e*=n,t*=n,Math.abs(e)<=ii&&(e=0),Math.abs(t)<=ii&&(t=0),y.current=e,x.current=t,_.current+=t*o,v.current+=e*o}else P.current&&(v.current+=si*o)}i(S.current||Math.abs(y.current)>ii||Math.abs(x.current)>ii?0:Math.sin(r/li*Math.PI*2)*ci)};return t=requestAnimationFrame(a),i(0),()=>{cancelAnimationFrame(t),e()}},[]);let B=(e,t)=>{if(S.current){if(S.current=!1,C.current=null,!t||e-E.current>ai){y.current=0,x.current=0;return}y.current=ui(y.current,-640,ri),x.current=ui(x.current,-640,ri)}},V=e=>{e.button===0&&(S.current=!0,D.current=!1,C.current=e.pointerId,O.current=e.clientX,k.current=e.clientY,w.current=e.clientX,T.current=e.clientY,E.current=e.timeStamp,y.current=0,x.current=0,e.currentTarget.setPointerCapture(e.pointerId))},H=e=>{if(!S.current||C.current!==e.pointerId)return;let t=e.clientX-w.current,n=e.clientY-T.current,r=Math.max(.008,(e.timeStamp-E.current)/1e3);Math.hypot(e.clientX-O.current,e.clientY-k.current)>ni&&(D.current=!0);let i=I.current;v.current-=t*i,_.current-=n*i;let a=-t/r*i,o=-n/r*i,s=1-Math.exp(-r/oi);y.current+=(a-y.current)*s,x.current+=(o-x.current)*s,w.current=e.clientX,T.current=e.clientY,E.current=e.timeStamp;let c=h.current;c&&(c.style.transform=`rotateX(${_.current}deg) rotateY(${v.current}deg)`);let l=_i(_.current,v.current);l!==j.current&&(j.current=l,R(l))},U=e=>{if(C.current!==e.pointerId)return;let t=!D.current;B(e.timeStamp,!0);try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}if(t){let t=e.target?.closest?.(`[data-face-index]`),n=t?Number(t.dataset.faceIndex):j.current,r=Number.isFinite(n)?n:j.current,i=N.current[r];i&&M.current?.(r,i)}},W=e=>{C.current===e.pointerId&&B(e.timeStamp,!1)},G=z[L],K=s&&G?.title?`,当前:${G.title}${G.description?`,${G.description}`:``}`:``;return(0,l.jsxs)(`div`,{ref:m,className:[ei.root,f].filter(Boolean).join(` `),style:{width:mi(t),height:mi(n),"--prism-size":`${r}px`,...p},role:`img`,"aria-label":d+K,onPointerDown:V,onPointerMove:H,onPointerUp:U,onPointerCancel:W,children:[(0,l.jsx)(`div`,{className:ei.glow,"aria-hidden":`true`}),(0,l.jsx)(`div`,{className:ei.stage,children:(0,l.jsx)(`div`,{ref:g,className:ei.floatWrap,children:(0,l.jsx)(`div`,{ref:h,className:ei.cube,children:hi.map((e,t)=>{let n=z[t],r=s&&n&&(n.title||n.description);return(0,l.jsxs)(`div`,{className:[ei.face,ei[e]].join(` `),"data-face-index":t,children:[n?(0,l.jsx)(`img`,{className:ei.photo,src:n.src,alt:n.alt??n.title??`Photo ${t+1}`,draggable:!1}):(0,l.jsx)(`div`,{className:ei.placeholder,"aria-hidden":`true`}),r?(0,l.jsxs)(`div`,{className:ei.caption,children:[n?.title?(0,l.jsx)(`strong`,{children:n.title}):null,n?.description?(0,l.jsx)(`span`,{children:n.description}):null]}):null]},e)})})})})]})},yi={scroll:`cos-scroll-8mfVT`,roller:`cos-roller-m5TKG`,rollerLeft:`cos-rollerLeft-5C7e9`,rollerRight:`cos-rollerRight-qKsHt`,center:`cos-center-TvM9I`,paperViewport:`cos-paperViewport-gDTEb`,paper:`cos-paper-gG1pz`,paperSurface:`cos-paperSurface-c0iGA`,frameCell:`cos-frameCell-GIuyW`,frame:`cos-frame-Rpb6t`,caption:`cos-caption-n6kN6`,empty:`cos-empty--2nS5`},bi=6,xi=.045,Si=90,Ci=8,wi=2600,Ti=14,Ei=e=>typeof e==`number`?`${e}px`:e,Di=(e,t,n)=>Math.min(n,Math.max(t,e)),Oi=({photos:e,width:t=520,height:n=280,frameWidth:r=160,frameHeight:i=200,frameGap:a=20,dragSensitivity:o=1,friction:s=1.5,showCaption:u=!0,initialIndex:d=0,onPhotoClick:f,onIndexChange:p,ariaLabel:m=`卷轴照片`,className:h,style:g})=>{let _=(0,c.useRef)(null),v=(0,c.useRef)(null),y=(0,c.useRef)({offset:0,velocity:0,drag:null,snapTarget:null}),x=(0,c.useRef)(null),S=(0,c.useRef)(0),C=(0,c.useRef)(!1),w=(0,c.useRef)(0),T=(0,c.useRef)(!1),E=(0,c.useRef)(d),D=(0,c.useRef)(f),O=(0,c.useRef)(p),k=(0,c.useRef)(e),A=(0,c.useRef)(s),j=(0,c.useRef)(o),[M,N]=(0,c.useState)(0),[P,F]=(0,c.useState)(d),I=e.length,L=r+a;(0,c.useEffect)(()=>{D.current=f,O.current=p,k.current=e,A.current=s,j.current=o},[o,s,p,f,e]);let R=(0,c.useMemo)(()=>M>0?M/2-r/2:0,[r,M]),z=(0,c.useMemo)(()=>I<=0?0:R*2+I*r+Math.max(0,I-1)*a,[I,a,r,R]),B=(0,c.useCallback)(e=>{if(M<=0||I<=0)return 0;let t=R+Di(Math.floor(e),0,I-1)*L+r/2;return M/2-t},[I,L,r,R,M]),V=(0,c.useCallback)(e=>{if(I<=0||M<=0)return 0;let t=(M/2-e-R-r/2)/L;return Di(Math.round(t),0,I-1)},[I,L,r,R,M]),H=(0,c.useCallback)(()=>I<=0?{min:0,max:0}:{min:B(I-1),max:B(0)},[I,B]),U=(0,c.useCallback)(e=>{let t=v.current;t&&(t.style.transform=`translate3d(${e}px, 0, 0)`)},[]),W=(0,c.useCallback)(e=>{if(e===w.current)return;w.current=e,F(e);let t=k.current[e];t&&O.current?.(e,t)},[]),G=(0,c.useCallback)(()=>{x.current!==null&&(window.cancelAnimationFrame(x.current),x.current=null),S.current=0},[]),K=(0,c.useCallback)(()=>{if(x.current!==null||typeof window>`u`)return;let e=t=>{if(x.current=null,C.current)return;let n=S.current||t;S.current=t;let r=Math.min(.05,(t-n)/1e3),i=y.current,{min:a,max:o}=H(),s=!1;if(i.drag)U(i.offset),s=!0;else if(i.snapTarget!==null){let e=i.snapTarget-i.offset;Math.abs(e)<=.35?(i.offset=i.snapTarget,i.snapTarget=null,i.velocity=0,W(V(i.offset)),U(i.offset)):(i.offset+=e*Math.min(1,Ti*r),i.velocity=0,U(i.offset),s=!0)}else{let e=i.velocity;if(Math.abs(e)>Ci)e*=Math.exp(-A.current*r),Math.abs(e)<=Ci&&(e=0),i.velocity=e,i.offset+=e*r,(i.offset<a||i.offset>o)&&(i.offset=Di(i.offset,a,o),i.velocity=0),U(i.offset),s=!0;else{i.velocity=0;let e=B(V(i.offset));Math.abs(i.offset-e)>.35?(i.snapTarget=e,s=!0):(i.offset=e,W(V(i.offset)),U(i.offset))}}s?x.current=window.requestAnimationFrame(e):S.current=0};x.current=window.requestAnimationFrame(e)},[U,V,W,H,B]);(0,c.useEffect)(()=>b(e=>{C.current=e,e||K()}),[K]),(0,c.useEffect)(()=>{let e=_.current;if(!e)return;let t=e=>{N(t=>t===e?t:e)};if(t(e.clientWidth),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(e=>{let n=e[0];n&&t(Math.round(n.contentRect.width))});return n.observe(e),()=>n.disconnect()},[]),(0,c.useEffect)(()=>{if(M<=0||I<=0)return;let e=y.current;if(!T.current){T.current=!0,E.current=d,e.offset=B(d),e.velocity=0,e.snapTarget=null,e.drag=null,w.current=Di(d,0,I-1),F(w.current),U(e.offset);return}if(E.current!==d){E.current=d,e.velocity=0,e.drag=null,e.snapTarget=B(d),K();return}let{min:t,max:n}=H();e.offset=Di(e.offset,t,n),U(e.offset)},[U,I,d,H,B,K,M]),(0,c.useEffect)(()=>()=>{G()},[G]);let q=(0,c.useCallback)(e=>{let t=y.current,n=t.drag;if(!(!n||n.pointerId!==e.pointerId)){if(t.drag=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),e.timeStamp-n.lastMoveTime>Si?t.velocity=0:t.velocity=Di(n.vx*j.current,-2600,wi),t.snapTarget=null,n.moved<=bi){t.velocity=0;let e=V(t.offset),n=k.current[e];n&&D.current?.(e,n),t.snapTarget=B(e)}K()}},[V,B,K]),J=(0,c.useCallback)(e=>{if(e.button!==0&&e.pointerType===`mouse`||I<=0)return;let t=e.timeStamp,n=y.current;n.drag={pointerId:e.pointerId,startX:e.clientX,startOffset:n.offset,lastX:e.clientX,lastTime:t,lastMoveTime:t,vx:0,moved:0},n.velocity=0,n.snapTarget=null,e.currentTarget.setPointerCapture(e.pointerId),K()},[I,K]),Y=(0,c.useCallback)(e=>{let t=y.current,n=t.drag;if(!n||n.pointerId!==e.pointerId)return;let r=e.clientX-n.startX;n.moved=Math.max(n.moved,Math.abs(r)),n.lastMoveTime=e.timeStamp;let i=Math.max(e.timeStamp-n.lastTime,1)/1e3,a=(e.clientX-n.lastX)/i,o=1-Math.exp(-i/xi);n.vx=o*a+(1-o)*n.vx,n.lastX=e.clientX,n.lastTime=e.timeStamp;let{min:s,max:c}=H();t.offset=Di(n.startOffset+r*j.current,s,c),U(t.offset),W(V(t.offset)),K()},[U,V,W,H,K]),ee=(0,c.useCallback)(e=>{q(e)},[q]),te=(0,c.useCallback)(e=>{q(e)},[q]),ne=(0,c.useCallback)(e=>{if(I<=0||e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault();let t=y.current,n=e.key===`ArrowLeft`?L:-L,{min:r,max:i}=H(),a=t.snapTarget??t.offset;t.velocity=0,t.drag=null,t.snapTarget=Di(a+n,r,i),K()},[I,L,H,K]),X=e[P],re=u&&X?.title?`,当前:${X.title}${X.description?`,${X.description}`:``}`:``;return I===0?(0,l.jsxs)(`div`,{className:[yi.scroll,h].filter(Boolean).join(` `),style:{width:Ei(t),height:Ei(n),...g},role:`img`,"aria-label":m,children:[(0,l.jsx)(`div`,{className:[yi.roller,yi.rollerLeft].join(` `),"aria-hidden":`true`}),(0,l.jsx)(`div`,{className:yi.center,children:(0,l.jsx)(`div`,{className:yi.empty,children:`暂无照片`})}),(0,l.jsx)(`div`,{className:[yi.roller,yi.rollerRight].join(` `),"aria-hidden":`true`})]}):(0,l.jsxs)(`div`,{className:[yi.scroll,h].filter(Boolean).join(` `),style:{width:Ei(t),height:Ei(n),...g},role:`region`,"aria-label":m+re,tabIndex:0,onKeyDown:ne,children:[(0,l.jsx)(`div`,{className:[yi.roller,yi.rollerLeft].join(` `),"aria-hidden":`true`}),(0,l.jsx)(`div`,{className:yi.center,children:(0,l.jsx)(`div`,{ref:_,className:yi.paperViewport,onPointerDown:J,onPointerMove:Y,onPointerUp:ee,onPointerCancel:te,children:(0,l.jsx)(`div`,{ref:v,className:yi.paper,style:{minWidth:z,boxSizing:`border-box`},children:(0,l.jsx)(`div`,{className:yi.paperSurface,style:{paddingLeft:R,paddingRight:R,minWidth:z},children:e.map((e,t)=>{let n=u&&(e.title||e.description);return(0,l.jsx)(`div`,{className:yi.frameCell,style:{width:r,marginRight:t<I-1?a:0},"data-active":t===P?`true`:`false`,"data-photo-index":t,children:(0,l.jsxs)(`div`,{className:yi.frame,style:{width:r,height:i},children:[(0,l.jsx)(`img`,{src:e.src,alt:e.alt??e.title??`Photo ${t+1}`,draggable:!1}),n?(0,l.jsxs)(`div`,{className:yi.caption,children:[e.title?(0,l.jsx)(`strong`,{children:e.title}):null,e.description?(0,l.jsx)(`span`,{children:e.description}):null]}):null]})},`${e.src}-${t}`)})})})})}),(0,l.jsx)(`div`,{className:[yi.roller,yi.rollerRight].join(` `),"aria-hidden":`true`})]})},ki={tunnel:`cos-tunnel-esly-`,vignette:`cos-vignette-P8ZI-`,depthFog:`cos-depthFog-E0b-c`,stage:`cos-stage--T1Yo`,track:`cos-track-u0COO`,frame:`cos-frame-N6-20`,frameInner:`cos-frameInner-CYOXO`,imageWrap:`cos-imageWrap-Xkdph`,image:`cos-image-Rj-YX`,frameCurrent:`cos-frameCurrent-xEe4Y`,caption:`cos-caption-FTJST`,captionTitle:`cos-captionTitle-BBveQ`,captionDesc:`cos-captionDesc-WhlOz`,empty:`cos-empty-mRm15`},Ai=6,ji=.35,Mi=8,Ni=10,Pi=90,Fi=.045,Ii=e=>typeof e==`number`?`${e}px`:e,Li=(e,t,n)=>Math.min(n,Math.max(t,e)),Ri=(e,t)=>t<=0?0:Li(Math.round(e),0,t-1),zi=({photos:e,width:t=380,height:n=480,depthStep:r=180,dragSensitivity:i=.008,friction:a=1.5,autoAdvance:o=!1,autoAdvanceSpeed:s=.15,showCaption:u=!0,initialIndex:d=0,onPhotoClick:f,onIndexChange:p,ariaLabel:m=`纵深照片隧道`,className:h,style:g})=>{let _=e.length,v=(0,c.useRef)(null),y=(0,c.useRef)([]),x=(0,c.useRef)(d),S=(0,c.useRef)(0),C=(0,c.useRef)(null),w=(0,c.useRef)(!1),T=(0,c.useRef)(null),E=(0,c.useRef)(0),D=(0,c.useRef)(0),O=(0,c.useRef)(0),k=(0,c.useRef)(0),A=(0,c.useRef)(0),j=(0,c.useRef)(0),M=(0,c.useRef)(!1),N=(0,c.useRef)(!1),P=(0,c.useRef)(Ri(d,_)),F=(0,c.useRef)(f),I=(0,c.useRef)(p),L=(0,c.useRef)(e),R=(0,c.useRef)(r),z=(0,c.useRef)(i),B=(0,c.useRef)(a),V=(0,c.useRef)(o),H=(0,c.useRef)(s),U=(0,c.useRef)(_),[W,G]=(0,c.useState)(()=>Ri(d,_));(0,c.useEffect)(()=>{F.current=f,I.current=p,L.current=e,R.current=r,z.current=i,B.current=a,V.current=o,H.current=s,U.current=_},[o,s,_,r,i,a,p,f,e]);let K=(0,c.useCallback)(e=>{if(e===P.current)return;P.current=e,G(e);let t=L.current[e];t&&I.current?.(e,t)},[]),q=(0,c.useCallback)(e=>{x.current=e;let t=R.current,n=U.current;for(let r=0;r<n;r+=1){let n=y.current[r];if(!n)continue;let i=r-e,a=Math.abs(i),o=i*t,s=Math.max(.52,1-a*.14),c=Math.max(.12,1-a*.32),l=a>.45?Math.min(4,(a-.45)*2.4):0,u=a<.55;n.style.transform=`translate3d(-50%, -50%, ${o}px) scale(${s})`,n.style.opacity=String(c),n.style.filter=l>.05?`blur(${l}px)`:`none`,n.classList.toggle(ki.frameCurrent,u),n.setAttribute(`aria-hidden`,u?`false`:`true`)}},[]);(0,c.useEffect)(()=>{let e=Ri(d,_);x.current=e,S.current=0,C.current=null,P.current=e,q(e);let t=requestAnimationFrame(()=>{G(e)});return()=>cancelAnimationFrame(t)},[q,_,d]),(0,c.useEffect)(()=>{let e=b(e=>{N.current=e}),t=0,n=performance.now(),r=e=>{if(t=requestAnimationFrame(r),N.current){n=e;return}let i=Math.min(.05,(e-n)/1e3);if(n=e,w.current)return;let a=Math.max(0,U.current-1),o=x.current,s=S.current,c=!1;if(C.current!==null){let e=C.current-o;Math.abs(e)<=.004?(o=C.current,C.current=null,s=0,K(Ri(o,U.current)),c=!0):(o+=e*Math.min(1,Ni*i),s=0,c=!0)}else if(Math.abs(s)>ji)s*=Math.exp(-B.current*i),Math.abs(s)<=ji&&(s=0),o=Li(o+s*i,0,a),c=!0,(s===0||o<=0||o>=a)&&(C.current=Ri(o,U.current));else if(V.current&&U.current>1){o+=H.current*i,o>=a?o=a:c=!0;let e=Ri(o,U.current);e!==P.current&&K(e)}else{let e=Ri(o,U.current);Math.abs(o-e)>.004?(C.current=e,c=!0):o!==e&&(o=e,K(e),c=!0)}S.current=s,c&&q(o)};return t=requestAnimationFrame(r),q(x.current),()=>{cancelAnimationFrame(t),e()}},[q,K]);let J=(0,c.useCallback)((e,t)=>{w.current&&(w.current=!1,T.current=null,!t||e-j.current>Pi?S.current=0:S.current=Li(S.current,-8,Mi),C.current=null)},[]),Y=(0,c.useCallback)(e=>{U.current<=0||e.button!==0||(w.current=!0,M.current=!1,T.current=e.pointerId,E.current=e.clientX,D.current=e.clientY,O.current=x.current,k.current=e.clientX,A.current=e.clientY,j.current=e.timeStamp,S.current=0,C.current=null,e.currentTarget.setPointerCapture(e.pointerId))},[]),ee=(0,c.useCallback)(e=>{if(!w.current||T.current!==e.pointerId)return;let t=e.clientX-E.current,n=e.clientY-D.current;Math.hypot(t,n)>Ai&&(M.current=!0);let r=e.clientX-k.current,i=e.clientY-A.current,a=Math.max(.008,(e.timeStamp-j.current)/1e3),o=z.current,s=(Math.abs(i)>=Math.abs(r)?-i*o:-r*o)/a,c=1-Math.exp(-a/Fi);S.current+=(s-S.current)*c;let l=Math.abs(n)>=Math.abs(t)?-n*o:-t*o,u=Math.max(0,U.current-1),d=Li(O.current+l,0,u);k.current=e.clientX,A.current=e.clientY,j.current=e.timeStamp,q(d),K(Ri(d,U.current))},[q,K]),te=(0,c.useCallback)(e=>{if(T.current!==e.pointerId)return;let t=!M.current;J(e.timeStamp,!0);try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}if(t){let e=P.current,t=L.current[e];t&&F.current?.(e,t)}},[J]),ne=(0,c.useCallback)(e=>{if(T.current===e.pointerId){J(e.timeStamp,!1);try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}}},[J]),X=e[W],re=u&&X&&(X.title||X.description),ie=re&&X?.title?`,当前:${X.title}${X.description?`,${X.description}`:``}`:``;return _===0?(0,l.jsx)(`div`,{className:[ki.tunnel,h].filter(Boolean).join(` `),style:{width:Ii(t),height:Ii(n),...g},role:`img`,"aria-label":m,children:(0,l.jsx)(`div`,{className:ki.empty,children:`暂无照片`})}):(0,l.jsxs)(`div`,{className:[ki.tunnel,h].filter(Boolean).join(` `),style:{width:Ii(t),height:Ii(n),...g},role:`region`,"aria-label":m+ie,"aria-roledescription":`carousel`,tabIndex:0,children:[(0,l.jsx)(`div`,{className:ki.depthFog,"aria-hidden":`true`}),(0,l.jsx)(`div`,{className:ki.vignette,"aria-hidden":`true`}),(0,l.jsx)(`div`,{ref:v,className:ki.stage,onPointerDown:Y,onPointerMove:ee,onPointerUp:te,onPointerCancel:ne,children:(0,l.jsx)(`div`,{className:ki.track,children:e.map((e,t)=>(0,l.jsx)(`div`,{ref:e=>{y.current[t]=e},className:ki.frame,"data-photo-index":t,"aria-hidden":t!==W,children:(0,l.jsx)(`div`,{className:ki.frameInner,children:(0,l.jsx)(`div`,{className:ki.imageWrap,children:(0,l.jsx)(`img`,{className:ki.image,src:e.src,alt:e.alt??e.title??`Photo ${t+1}`,draggable:!1})})})},`${e.src}-${t}`))})}),re?(0,l.jsxs)(`div`,{className:ki.caption,children:[X?.title?(0,l.jsx)(`p`,{className:ki.captionTitle,children:X.title}):null,X?.description?(0,l.jsx)(`p`,{className:ki.captionDesc,children:X.description}):null]}):null]})},$={root:`cos-root-qGq-T`,body:`cos-body-8jOJ0`,bodyRidge:`cos-bodyRidge-88Vkq`,topBulb:`cos-topBulb-M3wyM`,sideGrip:`cos-sideGrip-jL6g7`,left:`cos-left-mXvTL`,right:`cos-right-Q4Ozn`,discStage:`cos-discStage-HZPMB`,disc:`cos-disc-SkhwL`,slot:`cos-slot-AubzH`,slotFrame:`cos-slotFrame-AbvoX`,slotImage:`cos-slotImage-RfkHp`,peepStack:`cos-peepStack-KseMg`,peepRing:`cos-peepRing-8SSr0`,peepWindow:`cos-peepWindow-9dosU`,peepImage:`cos-peepImage-YxDtE`,peepGlare:`cos-peepGlare-vmPru`,peepVignette:`cos-peepVignette-MSiRk`,caption:`cos-caption-e--JN`,captionTitle:`cos-captionTitle-lSCbX`,captionDesc:`cos-captionDesc-qUIGe`,empty:`cos-empty-s8TJ0`},Bi=380,Vi=420,Hi=300,Ui=160,Wi=6,Gi=640,Ki=2.2,qi=90,Ji=.045,Yi=.35,Xi=14,Zi=e=>typeof e==`number`?`${e}px`:e,Qi=(e,t,n)=>Math.max(t,Math.min(n,e)),$i=(e,t)=>t<=0?0:(e%t+t)%t,ea=(e,t,n)=>n<=0?0:$i(Math.round(-e/t),n),ta=(e,t,n)=>{let r=-t*n;return r+Math.round((e-r)/360)*360},na=({photos:e,width:t=Bi,height:n=Vi,discSize:r=Hi,peepSize:i=Ui,dragSensitivity:a=.45,friction:o=1.4,autoRotate:s=!0,autoRotateSpeed:u=8,showCaption:d=!0,initialIndex:f=0,onPhotoClick:p,onIndexChange:m,ariaLabel:h=`观景器`,className:g,style:_})=>{let v=e.length,y=v>0?360/v:360,x=(r-i)/4+i/2,S=(0,c.useRef)(null),C=(0,c.useRef)(null),w=(0,c.useRef)(-f*y),T=(0,c.useRef)(0),E=(0,c.useRef)(!1),D=(0,c.useRef)(null),O=(0,c.useRef)(0),k=(0,c.useRef)(0),A=(0,c.useRef)(!1),j=(0,c.useRef)(0),M=(0,c.useRef)(!1),N=(0,c.useRef)(ea(-f*y,y,v)),P=(0,c.useRef)(p),F=(0,c.useRef)(m),I=(0,c.useRef)(e),L=(0,c.useRef)(s),R=(0,c.useRef)(u),z=(0,c.useRef)(o),B=(0,c.useRef)(a),V=(0,c.useRef)(y),H=(0,c.useRef)(v),[U,W]=(0,c.useState)(()=>$i(f,v)),G=(0,c.useMemo)(()=>e.map((e,t)=>`rotate(${t*y}deg) translateY(-${x}px)`),[e,x,y]);(0,c.useEffect)(()=>{P.current=p,F.current=m,I.current=e,L.current=s,R.current=u,z.current=o,B.current=a,V.current=y,H.current=v},[p,m,e,s,u,o,a,y,v]);let K=e=>{w.current=e,C.current&&(C.current.style.transform=`rotate(${e}deg)`);let t=ea(e,V.current,H.current);if(t!==N.current){N.current=t,W(t);let e=I.current[t];e&&F.current?.(t,e)}};(0,c.useEffect)(()=>{let e=$i(f,v),t=-e*y;T.current=0,N.current=e,w.current=t,C.current&&(C.current.style.transform=`rotate(${t}deg)`);let n=requestAnimationFrame(()=>{W(e)});return()=>cancelAnimationFrame(n)},[v,f,y]),(0,c.useEffect)(()=>{let e=b(e=>{M.current=e}),t=0,n=performance.now(),r=e=>{if(t=requestAnimationFrame(r),M.current){n=e;return}let i=Math.min(.05,(e-n)/1e3);if(n=e,E.current||H.current<=0)return;let a=w.current,o=T.current,s=V.current;if(Math.abs(o)>Ki)a+=o*i,o*=Math.exp(-z.current*i),Math.abs(o)<=Ki&&(o=0);else{o=0;let e=ea(a,s,H.current),t=ta(a,e,s),n=t-a;Math.abs(n)>Yi?a+=n*Math.min(1,Xi*i):(a=t,L.current&&(a-=R.current*i))}T.current=o,K(a)};return t=requestAnimationFrame(r),K(w.current),()=>{cancelAnimationFrame(t),e()}},[]);let q=(e,t)=>{if(E.current){if(E.current=!1,D.current=null,!t||e-k.current>qi){T.current=0;return}T.current=Qi(T.current,-640,Gi)}},J=e=>{e.button!==0||v<=0||(E.current=!0,A.current=!1,D.current=e.pointerId,j.current=e.clientX,O.current=e.clientX,k.current=e.timeStamp,T.current=0,e.currentTarget.setPointerCapture(e.pointerId))},Y=e=>{if(!E.current||D.current!==e.pointerId)return;let t=e.clientX-O.current,n=Math.max(.008,(e.timeStamp-k.current)/1e3);Math.abs(e.clientX-j.current)>Wi&&(A.current=!0);let r=B.current;K(w.current-t*r);let i=-t/n*r,a=1-Math.exp(-n/Ji);T.current+=(i-T.current)*a,O.current=e.clientX,k.current=e.timeStamp},ee=e=>{if(D.current!==e.pointerId)return;let t=!A.current;q(e.timeStamp,!0);try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}if(t){let e=I.current[N.current];e&&P.current?.(N.current,e)}},te=e=>{D.current===e.pointerId&&q(e.timeStamp,!1)},ne=e[U],X=d&&ne&&(ne.title||ne.description),re=X&&ne?.title?`,当前:${ne.title}${ne.description?`,${ne.description}`:``}`:``;return v===0?(0,l.jsx)(`div`,{ref:S,className:[$.root,g].filter(Boolean).join(` `),style:{width:Zi(t),height:Zi(n),"--pvm-disc-size":`${r}px`,"--pvm-peep-size":`${i}px`,..._},role:`img`,"aria-label":h,children:(0,l.jsx)(`div`,{className:$.empty,children:`暂无照片`})}):(0,l.jsxs)(`div`,{ref:S,className:[$.root,g].filter(Boolean).join(` `),style:{width:Zi(t),height:Zi(n),"--pvm-disc-size":`${r}px`,"--pvm-peep-size":`${i}px`,..._},role:`img`,"aria-label":h+re,onPointerDown:J,onPointerMove:Y,onPointerUp:ee,onPointerCancel:te,children:[(0,l.jsxs)(`div`,{className:$.body,children:[(0,l.jsx)(`div`,{className:$.topBulb,"aria-hidden":`true`}),(0,l.jsx)(`div`,{className:[$.sideGrip,$.left].join(` `),"aria-hidden":`true`}),(0,l.jsx)(`div`,{className:[$.sideGrip,$.right].join(` `),"aria-hidden":`true`}),(0,l.jsx)(`div`,{className:$.bodyRidge,"aria-hidden":`true`}),(0,l.jsx)(`div`,{className:$.discStage,children:(0,l.jsx)(`div`,{ref:C,className:$.disc,style:{transform:`rotate(${-f*y}deg)`},"aria-hidden":`true`,children:e.map((e,t)=>(0,l.jsx)(`div`,{className:$.slot,style:{transform:G[t]},children:(0,l.jsx)(`div`,{className:$.slotFrame,children:(0,l.jsx)(`img`,{className:$.slotImage,src:e.src,alt:``,draggable:!1})})},`${e.src}-${t}`))})}),(0,l.jsxs)(`div`,{className:$.peepStack,children:[(0,l.jsx)(`div`,{className:$.peepRing,"aria-hidden":`true`}),(0,l.jsxs)(`div`,{className:$.peepWindow,children:[ne?(0,l.jsx)(`img`,{className:$.peepImage,src:ne.src,alt:ne.alt??ne.title??`Photo ${U+1}`,draggable:!1}):null,(0,l.jsx)(`div`,{className:$.peepVignette,"aria-hidden":`true`}),(0,l.jsx)(`div`,{className:$.peepGlare,"aria-hidden":`true`})]})]})]}),X?(0,l.jsxs)(`div`,{className:$.caption,children:[ne?.title?(0,l.jsx)(`p`,{className:$.captionTitle,children:ne.title}):null,ne?.description?(0,l.jsx)(`p`,{className:$.captionDesc,children:ne.description}):null]}):null]})},ra={plasmaBall:`cos-plasmaBall-xGHSj`,canvas:`cos-canvas-V1CgL`},ia=({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=b(e=>{_=e}),y=(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=y(e,t,o+f,s+p,i*.55,a-1),h=y(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=y(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:ra.plasmaBall,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:ra.canvas,style:{width:e,height:t}})})},aa={smokeFog:`cos-smokeFog-SYlts`,canvas:`cos-canvas-iOJV7`},oa=10,sa=128,ca=`#d2d4d8`,la=[`#14151c`,`#1a1b24`,`#0e0f14`],ua=(e,t)=>{let n=Math.sin(e*127.1+t*311.7)*43758.5453;return n-Math.floor(n)},da=(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=ua(n,r),l=ua(n+1,r),u=ua(n,r+1),d=ua(n+1,r+1);return c+(l-c)*o+(u-c)*s+(c-l-u+d)*o*s},fa=(e,t)=>{let n=0,r=.5,i=1;for(let a=0;a<4;a++)n+=r*da(e*i,t*i),i*=2.05,r*=.5;return n},pa=(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]},ma=(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)],ha=(e,t=1)=>t>=1?`rgb(${e[0]} ${e[1]} ${e[2]})`:`rgb(${e[0]} ${e[1]} ${e[2]} / ${t})`,ga=e=>{if(Array.isArray(e)&&e.length>=3)return[e[0],e[1],e[2]];let t=pa(typeof e==`string`?e:la[2],[14,15,20]),n=ma(t,[255,255,255],.06);return[ha(ma(t,[255,255,255],.1)),ha(n),ha(t)]},_a=(e,t)=>{let n=document.createElement(`canvas`);n.width=sa,n.height=sa;let r=n.getContext(`2d`),i=r.createImageData(sa,sa),a=i.data,o=sa/2,s=sa/2,c=sa*.48;for(let n=0;n<sa;n++)for(let r=0;r<sa;r++){let i=(r-o)/c,l=(n-s)/c,u=Math.hypot(i,l);if(u>1.15)continue;let d=fa(r*.045+e*17.1,n*.045+e*9.3)*.7+fa(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*sa+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},va=e=>Array.from({length:oa},(t,n)=>_a(n+1,e)),ya=(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()*oa),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()}},ba=(e,t)=>{let n=Math.hypot(e.vx,e.vy);if(n<=t)return;let r=t/n;e.vx*=r,e.vy*=r},xa=e=>e<.06?e/.06:e>.55?Math.max(0,1-(e-.55)/.45):1,Sa=(e,t)=>.22+Math.min(1,Math.max(0,e/t))**1.15*.78,Ca=({width:e=800,height:t=500,density:n=.5,color:r=ca,backgroundColor:i=la,speed:a=1,disperseStrength:o=1,disperseRadius:s=1,interactive:u=!0,ariaLabel:d})=>{let f=(0,c.useRef)(null),p=(0,c.useRef)([]),m=(0,c.useRef)([]),h=(0,c.useRef)(null),g=(0,c.useRef)(``),_=(0,c.useRef)(0),v=(0,c.useRef)({speed:a,disperseStrength:o,disperseRadius:s,interactive:u,color:r,backgroundColor:i});(0,c.useEffect)(()=>{v.current={speed:a,disperseStrength:o,disperseRadius:s,interactive:u,color:r,backgroundColor:i}},[a,o,s,u,r,i]),(0,c.useEffect)(()=>{h.current=va(pa(r,[210,212,216])),g.current=r},[r]),(0,c.useEffect)(()=>{let r=Math.floor(56+n*100);p.current=Array.from({length:r},()=>ya(e,t,Math.random()**1.75))},[n,t,e]);let y=(0,c.useCallback)((n,r)=>{let i=v.current;if(!i.interactive)return;let a=f.current;if(!a)return;let o=a.getBoundingClientRect(),s=(n-o.left)/o.width*e,c=(r-o.top)/o.height*t,l=x(i.disperseRadius,0,3),u=x(i.disperseStrength,0,3);m.current.length>3&&m.current.shift(),m.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=f.current;if(!e)return;let t=e=>{e.pointerType===`mouse`&&e.button!==0||y(e.clientX,e.clientY)};return e.addEventListener(`pointerdown`,t),()=>e.removeEventListener(`pointerdown`,t)},[y]),(0,c.useEffect)(()=>{let n=f.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=pa(v.current.color,[210,212,216]);h.current||(h.current=va(a),g.current=v.current.color);let o=h.current,s=0,c=document.hidden,l=b(e=>{c=e}),u=typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,d=()=>{let[n,r,a]=ga(v.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=pa(a,[14,15,20]),c=ma(s,[255,255,255],.22),l=i.createRadialGradient(e*.5,t*.75,0,e*.5,t,e*.55);l.addColorStop(0,ha(c,.35)),l.addColorStop(1,ha(s,0)),i.fillStyle=l,i.fillRect(0,0,e,t)},y=e=>{let n=xa(e.age)*Sa(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(_.current=requestAnimationFrame(S),c)return;let n=x(v.current.speed,0,3),r=x(v.current.disperseStrength,0,3);s+=.01*Math.max(n,.001),d(),g.current!==v.current.color&&(h.current=va(pa(v.current.color,[210,212,216])),g.current=v.current.color);let a=h.current??o,l=p.current,u=m.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,ba(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)*Sa(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]=ya(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=xa(o.age)*Sa(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){d();for(let e of p.current)y(e);return i.globalCompositeOperation=`source-over`,i.globalAlpha=1,()=>{l()}}return S(),()=>{cancelAnimationFrame(_.current),l()}},[t,e]),(0,l.jsx)(`div`,{className:aa.smokeFog,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:f,className:aa.canvas,style:{width:e,height:t,cursor:u?`pointer`:`default`},role:`img`,"aria-label":d??(u?`烟雾背景,点击可驱散`:`烟雾背景`)})})},wa=.82,Ta=.08,Ea=1e3/60,Da=46*2.6,Oa=()=>({x:-1e3,y:-1e3,prevX:-1e3,prevY:-1e3,vx:0,vy:0,speed:0,active:!1,lastTs:0}),ka=e=>e<.5?2*e*e:1-(-2*e+2)**2/2,Aa=e=>1-(1-e)**3,ja=(e,t,n)=>{let r=Math.min(1,Math.max(0,(n-e)/(t-e)));return r*r*(3-2*r)},Ma=(e,t)=>e**t,Na=e=>{let t=Math.sin(e*127.1+311.7)*43758.5453;return t-Math.floor(t)},Pa=(e,t,n=!0)=>{let r=.18+(e/18)**.5*.52,i=n?.8+Math.random()*.35:1;return r*t*i},Fa=(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()},Ia=(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()},La=(e,t,n,r,i)=>{let a=Math.min(70,Math.floor(t*n/22e3));for(let o=0;o<a;o++){let a=Na(o+1),s=Na(o+57),c=Na(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},Ra=(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),Fa(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%)`]]),Fa(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%)`]]),Fa(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=Na(r+3),a=Na(r+11);Fa(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),Fa(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%)`]]),Fa(e,t*.28,n*1.02,t*.4,[[0,`rgb(0 3 6 / 28%)`],[1,`rgb(0 3 6 / 0%)`]]),Fa(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)},za=(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;Ia(e,s,-n*.02,c,n*(.7+i%2*.12),.12+i%3*.04,l)}Ia(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(),La(e,t,n,r,i)},Ba=()=>{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},Va=(e,t)=>e.find(e=>e.id===t),Ha=e=>{let t=e.progress,n=ka(ja(0,.72,t)),r=Aa(ja(.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}},Ua=(e,t)=>{let n=new Map;for(let t of e){let e=`${Math.floor(t.x/Da)},${Math.floor(t.y/Da)}`,r=n.get(e);r?r.push(t):n.set(e,[t])}for(let r of e){let e=Math.floor(r.x/Da),i=Math.floor(r.y/Da);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)}}},Wa=e=>{Ua(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})},Ga=(e,t,n)=>{Ua(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)})},Ka=(e,t,n,r)=>{let i=[];for(let a=0;a<t.length;a++){let o=t[a],s=Va(e,o.primaryId),c=Va(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=Ha(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,Pa(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)},qa=(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=Pa(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}},Ja=(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}),Ya=(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=Ja(e.x,e.y,t);e.vx+=(e.drift*.015+u.x*.05)*i,e.vy+=u.y*.025*i,e.vx*=Ma(.968,i),e.vy*=Ma(.994,i),e.x+=(e.vx+u.x*.22)*i,e.y+=e.vy*i},Xa=(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)}},Za=(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*=Ma(.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*=Ma(.997,t),e.mode3Phase+=(.04+Math.abs(e.mode3Vel)*.8)*t,e.streamStretch*=Ma(.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)},Qa=(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},$a=(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)},eo=(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=$a(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},to=(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},no=(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;to(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}},ro=(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=no(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)}},io=(e,t,n,r,i,a)=>{let o=eo(t,n),s=Math.min(1,Math.max(0,t.y/a)),c=i*wa,l=a*Ta,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},ao=(e,t,n,r,i,a,o,s,c,l,u)=>{let d=ro(t,n,r,i,a,o),f=Math.min(1,Math.max(0,d.cy/l)),p=c*wa,m=l*Ta,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},oo={bubbleField:`cos-bubbleField-i9211`,canvas:`cos-canvas-8vKsT`},so=({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)(Oa()),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=qa(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=Oa(),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||=Ba();let c=_.current,l=0,y=0,x=document.hidden,S=b(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=Oa()},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(y=requestAnimationFrame(k),x)return;l||=o;let _=Math.min(40,Math.max(8,o-l||16.666666666666668));l=o;let b=_/Ea,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),Ra(a,e,t,w),g.current={key:O,canvas:i})}g.current&&i.drawImage(g.current.canvas,0,0,e,t),za(i,e,t,C,c,a),p.current+=S,p.current>.2&&s.current.length<E&&(p.current=0,s.current.push(qa(m.current++,e,t,T)));let A=d.current;A.active&&(A.speed*=Ma(.94,b),A.vx*=Ma(.94,b),A.vy*=Ma(.94,b));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*b,n.tilt+=Math.sin(C*.2+n.deformPhase)*.0012*b,n.pulseBoost*=Ma(.92,b),n.settle*=Ma(.93,b),n.settle>0&&(n.aspect+=(.985-n.aspect)*.08*b),n.settle<.01&&(n.settle=0),j.has(n.id))Za(n,b);else{Ya(n,C,t,T,b),Za(n,b);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*Ma(.9,b)+Math.min(.35,(e-.55)*.08)*b),n.streamAngle=n.streamAngle*Ma(.85,b)+t*(1-Ma(.85,b))}}if(D&&A.active&&A.speed>.2&&!j.has(n.id)){let e=Xa(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*b*r,n.vy+=e.fy*t*.82*b*r,Qa(n,e.strain,e.strainAngle,e.excite,e.fx,e.fy)}}if(n.y+n.radius<-12){let r=qa(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));Wa(M),Ga(M,u.current,j),Ka(s.current,u.current,T,b),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??Ha(n),a=Math.min(.9,.55+r.absorb*.2);ao(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)||io(i,n,C,w,e,t)};return k(),()=>{cancelAnimationFrame(y),n.removeEventListener(`pointermove`,E),n.removeEventListener(`pointerenter`,D),n.removeEventListener(`pointerdown`,O),n.removeEventListener(`pointerleave`,T),S()}},[t,e]),(0,l.jsx)(`div`,{className:oo.bubbleField,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:o,className:oo.canvas,style:{width:e,height:t}})})},co={solarSystem:`cos-solarSystem-27h8F`,canvas:`cos-canvas-C0nRa`},lo=[{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}],uo=({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=lo.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=b(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:co.solarSystem,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:co.canvas,style:{width:e,height:t}})})},fo={snowfall:`cos-snowfall-Q-Dhg`,canvas:`cos-canvas-bJVF8`},po=({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=b(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:fo.snowfall,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:fo.canvas,style:{width:e,height:t}})})},mo={starfield:`cos-starfield-QTwia`,canvas:`cos-canvas-C2t3g`},ho=({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=b(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:mo.starfield,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:mo.canvas,style:{width:e,height:t}})})},go={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`},_o=({progress:e=0,onOpen:t,label:n=`开启宝箱`,openedLabel:r=`宝箱已开启!`})=>{let i=(0,c.useRef)(!1),a=(0,c.useRef)(t),o=x(e,0,100),s=o>=100;return(0,c.useEffect)(()=>{a.current=t},[t]),(0,c.useEffect)(()=>{s&&!i.current&&(i.current=!0,a.current?.()),s||(i.current=!1)},[s]),(0,l.jsxs)(`div`,{className:go.progressChest,children:[(0,l.jsxs)(`div`,{className:go.barWrap,children:[(0,l.jsx)(`div`,{className:go.barTrack,children:(0,l.jsx)(`div`,{className:go.barFill,style:{width:`${o}%`}})}),(0,l.jsxs)(`span`,{className:go.pct,children:[o.toFixed(0),`%`]})]}),(0,l.jsxs)(`div`,{className:`${go.chest} ${s?go.open:``}`,children:[(0,l.jsxs)(`div`,{className:go.lid,children:[(0,l.jsx)(`div`,{className:go.lidTop}),(0,l.jsx)(`div`,{className:go.lock})]}),(0,l.jsx)(`div`,{className:go.body,children:s&&(0,l.jsxs)(`div`,{className:go.treasure,children:[(0,l.jsx)(`span`,{children:`💎`}),(0,l.jsx)(`span`,{children:`✨`}),(0,l.jsx)(`span`,{children:`🪙`})]})})]}),(0,l.jsx)(`p`,{className:go.label,children:s?r:n})]})},vo={radarScan:`cos-radarScan-PZaG8`,canvas:`cos-canvas-fUw5N`},yo=({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=b(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:vo.radarScan,style:{width:e,height:e},children:(0,l.jsx)(`canvas`,{ref:r,className:vo.canvas,style:{width:e,height:e}})})},bo={redPacketRain:`cos-redPacketRain-eJ7FW`,canvas:`cos-canvas-direH`,hud:`cos-hud-InqMq`,end:`cos-end-u0J7o`,hint:`cos-hint-sO6ld`},xo=({duration:e=1e4,onGrab:t,grabbedLabel:n=`已抢:`,endedText:r=`红包雨结束`,hint:i=`点击红包抢夺`})=>{let a=(0,c.useRef)(null),o=(0,c.useRef)([]),s=(0,c.useRef)(0),u=(0,c.useRef)(0),d=(0,c.useRef)(0),[f,p]=(0,c.useState)(0),[m,h]=(0,c.useState)(!0),g=(0,c.useRef)(!0),_=(0,c.useRef)(t);(0,c.useEffect)(()=>{_.current=t},[t]),(0,c.useEffect)(()=>{g.current=m},[m]);let v=(0,c.useCallback)(()=>{o.current.push({id:u.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=a.current;if(!t)return;let n=window.devicePixelRatio||1;t.width=400*n,t.height=500*n;let r=t.getContext(`2d`);if(!r)return;r.setTransform(n,0,0,n,0,0);let i=document.hidden,c=b(e=>{i=e}),l=window.setTimeout(()=>{g.current=!1,h(!1)},e),u=()=>{s.current=requestAnimationFrame(u),!i&&(d.current++,g.current&&d.current%20==0&&v(),r.fillStyle=`rgb(15 23 42 / 20%)`,r.fillRect(0,0,400,500),o.current=o.current.filter(e=>e.grabbed?!1:(e.y+=e.speed,e.x+=Math.sin(e.y*.02)*.5,r.save(),r.translate(e.x,e.y),r.rotate(e.rotation),r.fillStyle=`#dc2626`,r.beginPath(),r.roundRect(-22,-28,44,56,6),r.fill(),r.fillStyle=`#fbbf24`,r.beginPath(),r.arc(0,-10,8,0,Math.PI*2),r.fill(),r.fillStyle=`#fde68a`,r.font=`bold 12px system-ui`,r.textAlign=`center`,r.fillText(`¥${e.amount}`,0,12),r.restore(),e.y<560)))};return u(),()=>{cancelAnimationFrame(s.current),clearTimeout(l),c()}},[e,v]),(0,l.jsxs)(`div`,{className:bo.redPacketRain,children:[(0,l.jsx)(`canvas`,{ref:a,className:bo.canvas,style:{width:400,height:500},onClick:e=>{let t=e.currentTarget.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top,i=!1;o.current=o.current.map(e=>e.grabbed||i?e:Math.abs(n-e.x)<30&&Math.abs(r-e.y)<35?(i=!0,p(t=>t+e.amount),_.current?.(e.amount),{...e,grabbed:!0}):e)}}),(0,l.jsxs)(`div`,{className:bo.hud,children:[(0,l.jsxs)(`span`,{children:[n,` ¥`,f]}),!m&&(0,l.jsx)(`span`,{className:bo.end,children:r})]}),(0,l.jsx)(`p`,{className:bo.hint,children:i})]})},So={returnCityContainer:`cos-returnCityContainer-6XTxj`,star:`cos-star-a59Dx`,glassWrap:`cos-glassWrap-golMO`,rotate:`cos-rotate-7X9Jj`,glassItem:`cos-glassItem-OwlFI`},Co=({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=So.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=So.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:So.returnCityContainer,children:(0,l.jsx)(`div`,{ref:i,className:So.glassWrap})})},wo={ropeChain:`cos-ropeChain-gYaSK`,canvas:`cos-canvas-5i95N`},To=({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),y=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`,y,{passive:!0}),c.addEventListener(`touchmove`,x,{passive:!0}),window.addEventListener(`touchend`,g);let S=0,C=document.hidden,w=b(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`,y),c.removeEventListener(`touchmove`,x),window.removeEventListener(`touchend`,g)}},[r,i,t,n,e]),(0,l.jsx)(`div`,{className:wo.ropeChain,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:a,className:wo.canvas,style:{width:e,height:t}})})},Eo={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`},Do=[`React`,`Motion`,`Design`,`COS`],Oo=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)},ko=({texts:e=Do,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:Do,[e]),[u,d]=(0,c.useState)(0),[f,p]=(0,c.useState)(`enter`),m=(0,c.useMemo)(()=>Oo(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:Eo.rotatingText,children:(0,l.jsx)(`div`,{className:Eo.badge,style:{fontSize:i,color:a,"--rt-bg":o,"--rt-duration":`${r}ms`},children:m.map((e,t)=>(0,l.jsx)(`span`,{className:`${Eo.char} ${f===`enter`?Eo.enter:Eo.exit}`,style:{animationDelay:`${f===`enter`?t*n:(m.length-1-t)*n}ms`},children:e===` `?`\xA0`:e},`${s[u]}-${e}-${t}-${f}`))})})},Ao={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`},jo=(e,t,n,r)=>{let i=(r-90)*Math.PI/180;return{x:e+n*Math.cos(i),y:t+n*Math.sin(i)}},Mo=({value:e=0,max:t=100,label:n=`SPEED`,color:r=`#f97316`})=>{let i=-120+x(t>0?e/t:0,0,1)*240,a=(0,c.useMemo)(()=>{let e=jo(100,100,72,-120),t=jo(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=jo(100,100,72,-120),t=jo(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=jo(100,100,58,i);return(0,l.jsxs)(`div`,{className:Ao.speedometer,style:{"--gauge-color":r},children:[(0,l.jsxs)(`svg`,{viewBox:`0 0 200 130`,className:Ao.svg,children:[(0,l.jsx)(`path`,{d:a,className:Ao.track,fill:`none`,strokeWidth:`12`,strokeLinecap:`round`}),(0,l.jsx)(`path`,{d:o,className:Ao.valueArc,fill:`none`,strokeWidth:`12`,strokeLinecap:`round`}),[-120,-60,0,60,120].map(e=>{let t=jo(100,100,58,e),n=jo(100,100,66,e);return(0,l.jsx)(`line`,{x1:t.x,y1:t.y,x2:n.x,y2:n.y,className:Ao.tick},e)}),(0,l.jsx)(`line`,{x1:`100`,y1:`100`,x2:s.x,y2:s.y,className:Ao.needle}),(0,l.jsx)(`circle`,{cx:`100`,cy:`100`,r:`6`,className:Ao.hub}),(0,l.jsx)(`text`,{x:`100`,y:`118`,className:Ao.valueText,children:Math.round(e)})]}),(0,l.jsx)(`span`,{className:Ao.label,children:n})]})},No={shinyText:`cos-shinyText-L0KoE`,text:`cos-text-J5KhP`,"shine-sweep":`cos-shine-sweep-jIufI`,paused:`cos-paused-dqgKu`},Po=({text:e=`SHINY TEXT`,speed:t=2,color:n=`#94a3b8`,shineColor:r=`#ffffff`,fontSize:i=64,disabled:a=!1})=>(0,l.jsx)(`div`,{className:No.shinyText,children:(0,l.jsx)(`span`,{className:`${No.text} ${a?No.paused:``}`,style:{fontSize:i,"--shiny-color":n,"--shiny-shine":r,"--shiny-duration":`${Math.max(t,.4)}s`},children:e})}),Fo={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`},Io=({steps:e=[`Start`,`Process`,`Review`,`Done`],current:t=0,color:n=`#22d3ee`})=>{let r=x(t,0,Math.max(0,e.length-1)),i=e.length>1?r/(e.length-1):0;return(0,l.jsx)(`div`,{className:Fo.timelinePulse,style:{"--pulse-color":n,"--step-count":e.length,"--progress-ratio":i},children:(0,l.jsxs)(`div`,{className:Fo.axis,children:[(0,l.jsx)(`div`,{className:Fo.track}),(0,l.jsx)(`div`,{className:Fo.progress}),(0,l.jsx)(`ul`,{className:Fo.steps,children:e.map((e,t)=>{let n=t<r?`done`:t===r?`current`:`pending`;return(0,l.jsxs)(`li`,{className:Fo.step,"data-state":n,children:[(0,l.jsx)(`span`,{className:Fo.dot}),(0,l.jsx)(`span`,{className:Fo.name,children:e})]},e+t)})})]})})},Lo={rippleWater:`cos-rippleWater-wsinI`,canvas:`cos-canvas-XOdSF`,hint:`cos-hint-0JH5D`},Ro=`
|
|
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
|
+
`,zo=`
|
|
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
|
-
`,Yr=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]},Xr=(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},Zr=(e,t,n)=>{let r=Xr(e,e.VERTEX_SHADER,t),i=Xr(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},$=192,Qr=e=>({from:Yr(e.fromColor),to:Yr(e.toColor),tint:Yr(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}),$r=({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)(Qr({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=Qr({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=Zr(i,qr,Jr);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=$*$,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,$,$,0,i.RGBA,i.UNSIGNED_BYTE,A)},M=(e,t,n,r)=>{let i=e*($-1),a=t*($-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>=$-1||s<=0||s>=$-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*$+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<$-1;e++){let t=e*$;for(let e=1;e<$-1;e++){let i=t+e,a=D[i-1]+D[i+1]+D[i-$]+D[i+$];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,$,$),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 P(0),()=>{i.deleteTexture(k),i.deleteBuffer(o),i.deleteProgram(a)};let F=document.hidden,I=y(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=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(),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:Kr.rippleWater,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:v,className:Kr.canvas,style:{width:e,height:t,cursor:h?`pointer`:`default`},role:`img`,"aria-label":_||`涟漪水面`}),g?(0,l.jsx)(`span`,{className:Kr.hint,"aria-hidden":!0,children:_}):null]})},ei={scrambleText:`cos-scrambleText-hN4Wm`,text:`cos-text-frsHs`,cursor:`cos-cursor-3zQOy`,blink:`cos-blink-OcKXu`},ti=`ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%&*`,ni=({text:e=`DECRYPTED`,duration:t=2e3,charset:n=ti})=>{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:ti,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:ei.scrambleText,children:(0,l.jsxs)(`p`,{className:ei.text,children:[r,(0,l.jsx)(`span`,{className:ei.cursor})]})})},ri={scratchCard:`cos-scratchCard-McIEK`,prize:`cos-prize-X0z5V`,canvas:`cos-canvas-JqIlr`,hidden:`cos-hidden-Lsfbt`},ii=({coverColor:e=`#94a3b8`,prize:t=`🎉 恭喜中奖!`,coverText:n=`刮开涂层`,onReveal:r,width:i=300,height:a=180})=>{let o=(0,c.useRef)(null),s=(0,c.useRef)(!1),u=(0,c.useRef)(!1),d=(0,c.useRef)(r),[f,p]=(0,c.useState)(!1);(0,c.useEffect)(()=>{d.current=r},[r]);let m=(0,c.useCallback)(t=>{t.globalCompositeOperation=`source-over`,t.fillStyle=e,t.fillRect(0,0,i,a),t.fillStyle=`rgb(255 255 255 / 30%)`,t.font=`bold 16px system-ui, sans-serif`,t.textAlign=`center`,t.fillText(n,i/2,a/2)},[e,n,a,i]),h=(0,c.useCallback)(e=>{if(u.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&&(u.current=!0,p(!0),d.current?.())},[]);(0,c.useEffect)(()=>{let e=o.current;if(!e)return;let t=window.devicePixelRatio||1;e.width=i*t,e.height=a*t;let n=e.getContext(`2d`);n&&(n.setTransform(t,0,0,t,0,0),m(n))},[m,a,i]);let g=(e,t)=>{let n=o.current;if(!n||u.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(),h(n))},_=e=>{let t=o.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}},v=e=>{s.current=!0;let t=_(e);t&&g(t.x,t.y)},y=e=>{if(!s.current)return;let t=_(e);t&&g(t.x,t.y)},b=()=>{s.current=!1};return(0,l.jsxs)(`div`,{className:ri.scratchCard,style:{width:i,height:a},children:[(0,l.jsx)(`div`,{className:ri.prize,children:t}),(0,l.jsx)(`canvas`,{ref:o,className:`${ri.canvas} ${f?ri.hidden:``}`,style:{width:i,height:a},onMouseDown:v,onMouseMove:y,onMouseUp:b,onMouseLeave:b,onTouchStart:v,onTouchMove:y,onTouchEnd:b})]})},ai={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`},oi=[`🍒`,`🍋`,`🍊`,`🍇`,`⭐`,`7️⃣`],si=e=>1-(1-e)**3,ci=({symbols:e=oi,onSpinEnd:t,startText:n=`开始`,spinningText:r=`旋转中...`,jackpotText:i=`🎰 大奖!`,resultPrefix:a=`结果:`})=>{let[o,s]=(0,c.useState)(!1),[u,d]=(0,c.useState)([0,0,0]),[f,p]=(0,c.useState)([]),m=(0,c.useRef)(0),h=(0,c.useRef)(t),g=(0,c.useRef)(null);(0,c.useEffect)(()=>{h.current=t},[t]);let _=(0,c.useCallback)(()=>{let t=[];for(let n=0;n<20;n++)t.push(...e);return t},[e])();return(0,c.useEffect)(()=>()=>{g.current&&(g.current.cancelled=!0),cancelAnimationFrame(m.current)},[]),(0,l.jsxs)(`div`,{className:ai.slotMachine,children:[(0,l.jsx)(`div`,{className:ai.machine,children:[0,1,2].map(e=>(0,l.jsxs)(`div`,{className:ai.reel,style:{height:240},children:[(0,l.jsx)(`div`,{className:ai.strip,style:{transform:`translateY(${u[e]}px)`},children:_.map((e,t)=>(0,l.jsx)(`div`,{className:ai.item,style:{height:80},children:e},t))}),(0,l.jsx)(`div`,{className:ai.mask})]},e))}),(0,l.jsx)(`button`,{type:`button`,className:ai.spinBtn,onClick:()=>{if(o)return;s(!0),p([]);let t=[0,1,2].map(()=>Math.floor(Math.random()*e.length)),n=t.map(t=>-(t-1+e.length*10)*80),r=[...u],i=2e3,a=[0,300,600],c=performance.now(),l={cancelled:!1};g.current=l;let f=o=>{if(!l.cancelled){if(d(r.map((e,t)=>{let r=o-c-a[t];if(r<0)return e;let s=si(Math.min(r/i,1));return e+(n[t]-e)*s})),!a.every(e=>o-c-e>=i))m.current=requestAnimationFrame(f);else if(!l.cancelled){let n=t.map(t=>e[t]);p(n),s(!1),h.current?.(n)}}};m.current=requestAnimationFrame(f)},disabled:o,children:o?r:n}),f.length>0&&!o&&(0,l.jsx)(`p`,{className:ai.result,children:f[0]===f[1]&&f[1]===f[2]?i:`${a} ${f.join(` `)}`})]})},li={sandFall:`cos-sandFall-kgJeI`,canvas:`cos-canvas-9z6X1`,toolbar:`cos-toolbar-u8dLM`,hint:`cos-hint-DS8tY`,button:`cos-button-YhINe`},ui=[`#fbbf24`,`#f59e0b`,`#d97706`,`#b45309`,`#92400e`],di=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]},fi=({width:e=480,height:t=400,cellSize:n=4,colors:r=ui,spawnRate:i=3,hint:a=`按住鼠标绘制沙粒`,clearText:o=`Clear`})=>{let s=(0,c.useRef)(null),u=Math.max(1,Math.floor(e/n)),d=Math.max(1,Math.floor(t/n)),f=(0,c.useRef)(Array(u*d).fill(null)),p=(0,c.useRef)({x:-1,y:-1,down:!1}),m=(0,c.useMemo)(()=>(r.length>0?r:ui).map(di),[r]),h=()=>{f.current=Array(u*d).fill(null)};(0,c.useEffect)(()=>{f.current=Array(u*d).fill(null)},[u,d]),(0,c.useEffect)(()=>{let r=s.current;if(!r)return;let a=window.devicePixelRatio||1;r.width=e*a,r.height=t*a;let o=r.getContext(`2d`);if(!o)return;o.setTransform(a,0,0,a,0,0);let c=0,l=document.hidden,h=y(e=>{l=e}),g=(e,t)=>t*u+e,_=()=>{let e=f.current;for(let t=d-2;t>=0;t--)for(let n=0;n<u;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,o=n+a,s=n-a;o>=0&&o<u&&e[g(o,t+1)]===null?(e[g(o,t+1)]=e[r],e[r]=null):s>=0&&s<u&&e[g(s,t+1)]===null&&(e[g(s,t+1)]=e[r],e[r]=null)}},v=()=>{let{x:e,y:t,down:r}=p.current;if(!r||e<0||t<0)return;let a=Math.floor(e/n),o=Math.floor(t/n),s=f.current;for(let e=0;e<i;e++){let e=a+Math.floor((Math.random()-.5)*6),t=o+Math.floor((Math.random()-.5)*3);if(e<0||e>=u||t<0||t>=d)continue;let n=g(e,t);s[n]===null&&(s[n]=Math.floor(Math.random()*m.length))}},b=()=>{o.fillStyle=`#0f172a`,o.fillRect(0,0,e,t);let r=f.current;for(let e=0;e<d;e++)for(let t=0;t<u;t++){let i=r[g(t,e)];if(i===null)continue;let[a,s,c]=m[i];o.fillStyle=`rgb(${a} ${s} ${c})`,o.fillRect(t*n,e*n,n,n)}},x=()=>{c=requestAnimationFrame(x),!l&&(v(),_(),b())};return c=requestAnimationFrame(x),()=>{cancelAnimationFrame(c),h()}},[n,u,t,m,d,i,e]);let g=(e,t,n,r)=>{p.current={x:e-n.left,y:t-n.top,down:r}};return(0,l.jsxs)(`div`,{className:li.sandFall,style:{width:e},children:[(0,l.jsx)(`canvas`,{ref:s,className:li.canvas,style:{width:e,height:t},onMouseDown:e=>g(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect(),!0),onMouseMove:e=>{p.current.down&&g(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect(),!0)},onMouseUp:()=>{p.current.down=!1},onMouseLeave:()=>{p.current.down=!1},onTouchStart:e=>{let t=e.touches[0];t&&g(t.clientX,t.clientY,e.currentTarget.getBoundingClientRect(),!0)},onTouchMove:e=>{let t=e.touches[0];t&&g(t.clientX,t.clientY,e.currentTarget.getBoundingClientRect(),!0)},onTouchEnd:()=>{p.current.down=!1}}),(0,l.jsxs)(`div`,{className:li.toolbar,children:[(0,l.jsx)(`span`,{className:li.hint,children:a}),(0,l.jsx)(`button`,{type:`button`,className:li.button,onClick:h,children:o})]})]})},pi={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`},mi=[`fromTop`,`fromBottom`,`fromLeft`,`fromRight`],hi=({text:e=`REVEAL`,delay:t=80,color:n=`#f8fafc`})=>(0,l.jsx)(`div`,{className:pi.splitReveal,children:(0,l.jsx)(`h1`,{className:pi.text,style:{"--reveal-color":n},children:e.split(``).map((e,n)=>(0,l.jsx)(`span`,{className:`${pi.char} ${pi[mi[n%mi.length]]}`,style:{animationDelay:`${n*t}ms`},children:e===` `?`\xA0`:e},`${e}-${n}`))})}),gi={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`},_i=({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:gi.splitText,children:(0,l.jsx)(`div`,{className:gi.text,style:{fontSize:o,"--split-color":s,"--split-duration":`${r}ms`},children:f.map((e,r)=>(0,l.jsx)(`span`,{className:`${gi.char} ${gi[t]} ${u?gi.enter:gi.exit}`,style:{animationDelay:`${r*n}ms`},children:e===` `?`\xA0`:e},`${e}-${r}`))})})},vi={springMass:`cos-springMass-cYEt6`,canvas:`cos-canvas-mwL9l`,hint:`cos-hint-TKLm3`},yi=(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}},bi=({width:e=560,height:t=400,cols:n=6,rows:r=5,stiffness:i=.22,damping:a=.9,color:o=`#a78bfa`,hint:s=`拖拽网格质点,观察弹簧回弹`})=>{let u=(0,c.useRef)(null),d=(0,c.useRef)(yi(e,t,n,r)),f=(0,c.useRef)(null),p=(0,c.useRef)({x:0,y:0});(0,c.useEffect)(()=>{d.current=yi(e,t,n,r),f.current=null},[n,t,r,e]),(0,c.useEffect)(()=>{let n=u.current;if(!n)return;let r=window.devicePixelRatio||1;n.width=e*r,n.height=t*r;let s=n.getContext(`2d`);if(!s)return;s.setTransform(r,0,0,r,0,0);let c=0,l=document.hidden,m=y(e=>{l=e}),h=Math.max(.04,Math.min(i,.8)),g=()=>{let{nodes:n,springs:r}=d.current,i=f.current;if(i){let e=n[i.index];e.x=p.current.x+i.ox,e.y=p.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}=d.current;s.fillStyle=`#0f172a`,s.fillRect(0,0,e,t);for(let i of r){let r=n[i.a],a=n[i.b],c=Math.hypot(a.x-r.x,a.y-r.y)||1,l=Math.min(1,Math.abs(c-i.rest)/i.rest);s.beginPath(),s.moveTo(r.x,r.y),s.lineTo(a.x,a.y),s.strokeStyle=o,s.globalAlpha=.22+l*.55,s.lineWidth=i.rest>Math.max(e,t)*.2?1:1.6,s.stroke(),s.globalAlpha=1}n.forEach((e,t)=>{s.beginPath(),s.arc(e.x,e.y,e.pinned?6:8,0,Math.PI*2),s.fillStyle=e.pinned?`#64748b`:o,s.fill(),s.strokeStyle=`rgb(255 255 255 / 28%)`,s.lineWidth=1,s.stroke(),f.current?.index===t&&(s.beginPath(),s.arc(e.x,e.y,13,0,Math.PI*2),s.strokeStyle=o,s.globalAlpha=.45,s.lineWidth=2,s.stroke(),s.globalAlpha=1)})},v=()=>{c=requestAnimationFrame(v),!l&&(g(),_())};return c=requestAnimationFrame(v),()=>{cancelAnimationFrame(c),m()}},[o,a,t,i,e]);let m=(e,t)=>{let{nodes:n}=d.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},h=(e,t,n)=>{let r=e-n.left,i=t-n.top;p.current={x:r,y:i};let a=m(r,i);if(a<0)return;let o=d.current.nodes[a];f.current={index:a,ox:o.x-r,oy:o.y-i}},g=(e,t,n)=>{p.current={x:e-n.left,y:t-n.top}},_=()=>{f.current=null};return(0,l.jsxs)(`div`,{className:vi.springMass,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:u,className:vi.canvas,style:{width:e,height:t},onMouseDown:e=>h(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect()),onMouseMove:e=>g(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect()),onMouseUp:_,onMouseLeave:_,onTouchStart:e=>{let t=e.touches[0];t&&h(t.clientX,t.clientY,e.currentTarget.getBoundingClientRect())},onTouchMove:e=>{let t=e.touches[0];t&&g(t.clientX,t.clientY,e.currentTarget.getBoundingClientRect())},onTouchEnd:_}),(0,l.jsx)(`div`,{className:vi.hint,children:s})]})},xi={spotlight:`cos-spotlight-OddY1`,content:`cos-content-5I1Wy`,overlay:`cos-overlay-F6CJ5`},Si=({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:xi.spotlight,style:{"--spot-radius":`${t}px`,"--dim-color":n},onMouseMove:i,children:[(0,l.jsx)(`div`,{className:xi.content,children:e}),(0,l.jsx)(`div`,{className:xi.overlay})]})},Ci={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`},wi=[`#FF6B6B`,`#4ECDC4`,`#FFE66D`,`#A78BFA`,`#60A5FA`,`#F472B6`,`#34D399`,`#FB923C`],Ti=[{label:`一等奖`},{label:`二等奖`},{label:`三等奖`},{label:`谢谢参与`},{label:`优惠券`},{label:`再来一次`}],Ei=e=>1-(1-e)**3,Di=({prizes:e=Ti,size:t=360,spinDuration:n=4e3,spinRounds:r=5,buttonText:i=`开始抽奖`,spinningText:a=`抽奖中...`,resultPrefix:o=`恭喜获得:`,onSpinEnd:s})=>{let u=(0,c.useRef)(null),d=(0,c.useRef)(0),f=(0,c.useRef)(0),p=(0,c.useRef)(1),[m,h]=(0,c.useState)(!1),[g,_]=(0,c.useState)(null),v=(0,c.useRef)(s),y=(0,c.useRef)(null);(0,c.useEffect)(()=>{v.current=s},[s]);let b=t+48,x=(e,t)=>t.color??wi[e%wi.length],S=(0,c.useCallback)(n=>{let r=u.current;if(!r)return;let i=r.getContext(`2d`);if(!i)return;let a=b/2,o=t/2,s=Math.PI*2/e.length;i.clearRect(0,0,b,b),i.save(),i.translate(a,a),i.rotate(n),e.forEach((e,n)=>{let r=n*s-Math.PI/2,a=r+s,c=x(n,e);i.beginPath(),i.moveTo(0,0),i.arc(0,0,o,r,a),i.closePath(),i.fillStyle=c,i.fill(),i.strokeStyle=`rgb(255 255 255 / 35%)`,i.lineWidth=2,i.stroke(),i.save(),i.rotate(r+s/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,o-18,6),i.restore()}),i.beginPath(),i.arc(0,0,o,0,Math.PI*2),i.strokeStyle=`#fbbf24`,i.lineWidth=6,i.stroke(),i.beginPath(),i.arc(0,0,o-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)*(o+14),r=Math.sin(t)*(o+14);i.beginPath(),i.arc(n,r,3,0,Math.PI*2),i.fillStyle=e%2==0?`#fde68a`:`#f59e0b`,i.fill()}i.restore()},[b,e,t]);(0,c.useEffect)(()=>{let e=u.current;if(!e)return;let t=window.devicePixelRatio||1;p.current=t,e.width=b*t,e.height=b*t;let n=e.getContext(`2d`);n&&n.setTransform(t,0,0,t,0,0),S(d.current)},[b,S]),(0,c.useEffect)(()=>()=>{y.current&&(y.current.cancelled=!0),f.current&&cancelAnimationFrame(f.current)},[]);let C=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:Ci.turntable,style:{width:b,height:b+80},children:[(0,l.jsxs)(`div`,{className:Ci.wheelWrap,style:{width:b,height:b},children:[(0,l.jsx)(`div`,{className:Ci.pointer}),(0,l.jsx)(`canvas`,{ref:u,className:Ci.canvas,style:{width:b,height:b}}),(0,l.jsx)(`button`,{type:`button`,className:Ci.spinBtn,onClick:()=>{if(m||e.length===0)return;h(!0),_(null);let t=Math.PI*2/e.length,i=Math.floor(Math.random()*e.length)*t+t/2,a=d.current,o=a+r*Math.PI*2+(Math.PI*2-i)-a%(Math.PI*2),s=a,c=performance.now(),l={cancelled:!1};y.current=l;let u=t=>{if(l.cancelled)return;let r=t-c,i=Math.min(r/n,1),a=Ei(i),p=s+(o-s)*a;if(d.current=p,S(p),i<1)f.current=requestAnimationFrame(u);else if(!l.cancelled){let t=C(p),n=e[t];d.current=p,h(!1),_(n),v.current?.(n,t)}};f.current=requestAnimationFrame(u)},disabled:m,children:m?a:i})]}),g&&!m&&(0,l.jsxs)(`p`,{className:Ci.result,children:[o,(0,l.jsx)(`strong`,{children:g.label})]})]})},Oi={textMorph:`cos-textMorph-W-C1e`,stage:`cos-stage-AaMn6`,layer:`cos-layer-N-4oM`},ki=[`COS DESIGN`,`TEXT MORPH`,`SMOOTH TRANSITION`],Ai=(e,t,n)=>Math.min(n,Math.max(t,e)),ji=({texts:e=ki,interval:t=2200,duration:n=680,fontSize:r=64,color:i=`#f8fafc`})=>{let a=(0,c.useMemo)(()=>e.length>0?e:ki,[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=Ai((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:Oi.textMorph,style:{"--morph-color":i},children:(0,l.jsxs)(`div`,{className:Oi.stage,style:{fontSize:r},children:[(0,l.jsx)(`span`,{className:`${Oi.layer} ${Oi.current}`,style:{opacity:g,filter:`blur(${v}px)`,transform:`scale(${b}) translateY(${u*-8}px)`},children:m}),(0,l.jsx)(`span`,{className:`${Oi.layer} ${Oi.next}`,style:{opacity:_,filter:`blur(${y}px)`,transform:`scale(${x}) translateY(${(1-u)*8}px)`},children:h})]})})},Mi={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-`},Ni=({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:Mi.trueFocus,children:(0,l.jsxs)(`div`,{className:Mi.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:Mi.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:Mi.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:`${Mi.corner} ${Mi.tl}`}),(0,l.jsx)(`span`,{className:`${Mi.corner} ${Mi.tr}`}),(0,l.jsx)(`span`,{className:`${Mi.corner} ${Mi.bl}`}),(0,l.jsx)(`span`,{className:`${Mi.corner} ${Mi.br}`})]})]})})},Pi={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`},Fi=[`Hello, cos-design!`,`欢迎来到组件库 ✨`,`Build something fun 🚀`],Ii=({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:Pi.typewriter,children:(0,l.jsxs)(`div`,{className:Pi.terminal,children:[(0,l.jsxs)(`div`,{className:Pi.dots,children:[(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{})]}),(0,l.jsxs)(`p`,{className:Pi.text,children:[(0,l.jsx)(`span`,{className:Pi.prompt,children:`>`}),i,(0,l.jsx)(`span`,{className:Pi.cursor,children:`|`})]})]})})},Li=({texts:e=Fi,speed:t=100,deleteSpeed:n=50,pause:r=2e3})=>{let i=e.length>0?e:Fi;return(0,l.jsx)(Ii,{texts:i,speed:t,deleteSpeed:n,pause:r},i.join(`\0`))},Ri={waveButton:`cos-waveButton-Aa7G-`,btn:`cos-btn-WJrEN`,label:`cos-label-9BHOU`,wave:`cos-wave-GycLU`,ripple:`cos-ripple-5ZFpr`},zi=({text:e=`点我试试`,color:t=`#38bdf8`,className:n,style:r,...i})=>(0,l.jsx)(`div`,{className:Ri.waveButton,children:(0,l.jsxs)(`button`,{type:`button`,className:`${Ri.btn} ${n??``}`,style:{"--wave-color":t,...r},...i,children:[(0,l.jsx)(`span`,{className:Ri.wave}),(0,l.jsx)(`span`,{className:Ri.wave}),(0,l.jsx)(`span`,{className:Ri.label,children:e})]})}),Bi=e=>Math.min(1,Math.max(0,e)),Vi=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]},Hi=([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)}`},Ui=(e,t,n)=>e+(t-e)*n,Wi=(e,t,n)=>[Ui(e[0],t[0],n),Ui(e[1],t[1],n),Ui(e[2],t[2],n)],Gi=(e,t,n)=>Hi(Wi(Vi(e),Vi(t),Bi(n))),Ki=e=>{let t=Bi(e);return t*t*(3-2*t)},qi=(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()}},Ji=(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()},Yi=(e,t=new Date)=>Ji(e??`14:00`,t)??Ji(`14:00`,t),Xi=(e,t)=>{let{sunrise:n,sunset:r}=t;if(!(r>n)){let t=qi(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=Bi((e-n)/i);else if(e>=r){let t=Math.max(1,a-r);c=Bi((e-r)/t)}else{let t=Math.max(1,n-o);c=Bi((e-o)/t)}let l=s?Math.sin(Math.PI*c):0,u=Math.abs(e-n),d=Math.abs(e-r),f=Bi(1-Math.min(u,d)/45e5);return{isDay:s,arcProgress:c,elevation:l,twilight:f}},Zi=(e,t,n)=>{let r=Bi(n),i=Math.sin(Math.PI*r);return{x:e*(.1+.8*r),y:t*(.58-.4*i)}},Qi=`#e8895c`,$i=`#f3c98a`,ea=`#2a1f4a`,ta=`#c4784a`,na=(e,t,n)=>{if(n.isDay){let t=Ki(n.elevation),r=(1-t)*.72;return[Gi(Gi(e[0],Qi,r),`#1a2438`,(1-t)*.12),Gi(Gi(e[1],$i,r*.85),`#3a4558`,(1-t)*.08)]}let r=n.twilight;return[Gi(t[0],Gi(ea,Qi,.35),r*.55),Gi(t[1],Gi(ta,$i,.4),r*.7)]},ra=(e,t,n)=>{let r=e.createLinearGradient(0,0,0,t);return r.addColorStop(0,n[0]),r.addColorStop(1,n[1]),r},ia=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}},aa=2,oa=[``,`薄雾`,`中雾`,`浓雾`],sa=e=>Math.min(3,Math.max(1,Math.round(e))),ca=e=>{let t=sa(e);return`${t} · ${oa[t]}`},la=e=>e===`fog`,ua=(e,t)=>{let n=sa(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`}},da=e=>{let t=sa(e);return t===1?.45:t===3?.95:.65},fa=e=>e===45?2:e===48?3:null,pa=e=>e==null||!Number.isFinite(e)?null:e>=5e3?1:e>=1e3?2:3,ma=2,ha=[``,`细雹`,`密雹`,`巨雹`],ga=e=>Math.min(3,Math.max(1,Math.round(e))),_a=e=>{let t=ga(e);return`${t} · ${ha[t]}`},va=e=>e===`hail`,ya=e=>{let t=ga(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}},ba=e=>e===96?2:e===99?3:null,xa=1,Sa=10,Ca=5,wa=5,Ta=e=>Math.min(10,Math.max(1,Math.round(e))),Ea=(e,t,n)=>e+(t-e)*n,Da=e=>{let t=Ta(e);return t<=2?1:t<=4?2:t<=6?3:t<=8?4:5},Oa=[`毛毛雨`,`小雨`,`中雨`,`暴雨`,`特大暴雨`],ka=[`毛毛雪`,`小雪`,`中雪`,`暴雪`,`特大暴雪`],Aa=(e,t)=>{let n=Da(e);return(t===`rain`?Oa:ka)[n-1]},ja=(e,t)=>`${Ta(e)} · ${Aa(e,t)}`,Ma=[``,...Oa],Na=[``,...ka],Pa=e=>e===`lightRain`||e===`moderateRain`||e===`heavyRain`?`rain`:e===`lightSnow`||e===`moderateSnow`||e===`heavySnow`?`snow`:e,Fa=e=>e===`rain`||e===`lightRain`||e===`moderateRain`||e===`heavyRain`,Ia=e=>e===`snow`||e===`lightSnow`||e===`moderateSnow`||e===`heavySnow`,La=e=>Fa(e)||e===`thunderstorm`||e===`sleet`,Ra=e=>Ia(e)||e===`sleet`,za=(e,t=5)=>e===`lightRain`?3:e===`moderateRain`?5:e===`heavyRain`?8:Ta(t),Ba=(e,t=5)=>e===`lightSnow`?3:e===`moderateSnow`?5:e===`heavySnow`?8:Ta(t),Va=(e,t)=>t===`rain`?e<=2?`lightRain`:e===3?`moderateRain`:`heavyRain`:e<=2?`lightSnow`:e===3?`moderateSnow`:`heavySnow`,Ha=(e,t=5,n=5)=>e===`rain`?Va(Da(t),`rain`):e===`lightRain`||e===`moderateRain`||e===`heavyRain`?Va(Da(za(e)),`rain`):e===`snow`?Va(Da(n),`snow`):e===`lightSnow`||e===`moderateSnow`||e===`heavySnow`?Va(Da(Ba(e)),`snow`):e,Ua=(e,t)=>{let n=(Ta(t)-1)/9;return{count:Math.round(Ea(35,340,n)),speed:Ea(5.5,16,n),wind:Ea(-.4,-3.2,n),alpha:Ea(.28,.62,n),splash:Ta(t)>=5}},Wa=e=>{let t=(Ta(e)-1)/9;return Math.round(Ea(30,360,t))},Ga=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,Ka=e=>[77].includes(e)?2:[71,85].includes(e)?3:[73].includes(e)?5:[75].includes(e)?8:[86].includes(e)?10:null,qa=2,Ja=[``,`轻霾`,`中霾`,`重霾`],Ya=e=>Math.min(3,Math.max(1,Math.round(e))),Xa=e=>{let t=Ya(e);return`${t} · ${Ja[t]}`},Za=e=>e===`smog`,Qa=(e,t)=>{let n=Ya(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`}},$a=e=>{let t=Ya(e);return t===1?.55:t===3?1.05:.85},eo=e=>e==null||!Number.isFinite(e)?null:e>=5e3?1:e>=1e3?2:3,to={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`},no=e=>Pa(to[e]??`overcast`),ro={weather:null,rainLevel:null,snowLevel:null,fogLevel:null,hailLevel:null,smogLevel:null,status:`idle`,error:null,current:null},io={weather:null,rainLevel:null,snowLevel:null,fogLevel:null,hailLevel:null,smogLevel:null,status:`locating`,error:null,current:null},ao={weather:null,rainLevel:null,snowLevel:null,fogLevel:null,hailLevel:null,smogLevel:null,status:`fetching`,error:null,current:null},oo=e=>e!=null&&Number.isFinite(e.latitude)&&Number.isFinite(e.longitude),so=e=>{if(typeof e!=`string`||!e)return null;let t=Date.parse(e);return Number.isFinite(t)?t:null},co=e=>{if(typeof e!=`string`||!e)return null;let t=e.match(/T(\d{2}):(\d{2})/);return t?`${t[1]}:${t[2]}`:null},lo=(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},uo=(e=!0,t)=>{let n=oo(t),r=n?t.latitude:null,i=n?t.longitude:null,a=e?n?ao:io:ro,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=so(o?.daily?.sunrise?.[0]),d=so(o?.daily?.sunset?.[0]),f=typeof o?.timezone==`string`?o.timezone:null,p=co(o?.current?.time)??lo(f),m=no(s),h=Ga(s),g=Ka(s),_=o?.current?.visibility,v=_!=null&&Number.isFinite(Number(_))?Number(_):null,y=m===`fog`?pa(v)??fa(s)??2:null,b=m===`hail`?ba(s)??2:null,x=m===`smog`?eo(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},fo=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=so(a?.daily?.sunrise?.[0]),s=so(a?.daily?.sunset?.[0]);return o==null||s==null?null:{sunrise:o,sunset:s}},po=e=>{let t=oo(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 fo(n,r,t.signal).then(t=>{e||o(t)}).catch(()=>{e||o(null)}),()=>{e=!0,t.abort()}},[n,r]),t?a:null},mo=3,ho=e=>Math.min(12,Math.max(0,Math.round(e))),go=e=>Math.max(0,ho(e)-2),_o=.55,vo=[0,3,8,16,24,33,44,55,68,81,95,110,125],yo=[1,5,11,19,28,38,49,61,74,88,102,117,1/0],bo=(e,t,n=0,r=0)=>{let i=t.gustiness,a=t.wander,o=n*.0017+r*.0024,s=e*_o,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)}},xo=e=>{let t=ho(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}},So=e=>vo[ho(e)]??16,Co=e=>{let t=Math.max(0,e);for(let e=0;e<yo.length;e++)if(t<=yo[e])return e;return 12},wo=e=>{let t=Co(e),n=go(t),r=So(n),i=Math.max(.04,Math.min(r/16,4.2)),{alphaMul:a}=xo(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}},To=e=>e.live&&e.liveWindKmh!=null&&Number.isFinite(e.liveWindKmh)?Math.max(0,e.liveWindKmh):So(e.windLevel);function Eo(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 Do(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 Oo(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 ko(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=ko(e,t,o,s,i*.55,a-1),l=ko(o,s,n,r,i*.55,a-1);return[...c.slice(0,-1),...l]}function Ao(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=bo(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 jo(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=ko(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 Mo=3.2,No=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},Po=(e=16)=>Array.from({length:e},()=>No(Mo)),Fo=e=>e[Math.floor(Math.random()*e.length)],Io=(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=Fo(r),e.drawSize=e.r*2.8+4,e.rotation=Math.random()*Math.PI*2,e.rotationSpeed=(Math.random()-.5)*.06},Lo=(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 Io(a,e,t,n,Math.random()<.72,r,i),a};function Ro(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 zo(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 Bo(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=bo(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{Io(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 Vo(e){e.ctx.fillStyle=e.skyGradient,e.ctx.fillRect(0,0,e.width,e.height)}function Ho(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 Uo(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?ia(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 Wo(e){if(e.activeNight){Ho(e),Uo(e);return}Uo(e)}var Go={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}},Ko={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}},qo=([e,t,n])=>[Math.round(e*.3+18),Math.round(t*.3+24),Math.round(n*.3+42)];function Jo(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 Yo(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}=Jo(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 Xo(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 Zo(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 Qo(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 $o=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},es=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},ts=()=>({dots:[1.2,1.6,2,2.3].map(e=>$o(e)),crystals:[2.6,3.2,3.8,4.4,5].map(e=>es(e*2.4))}),ns=e=>e[Math.floor(Math.random()*e.length)],rs=(e,t,n,r)=>{let i=1+Math.random()**1.6*4.2,a=i>=2.4,o=ns(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}},is=(e,t)=>t?e===`smog`?`96, 88, 66`:`138, 150, 168`:e===`smog`?`168, 155, 126`:`226, 232, 238`;function as(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=Go[i],h=(()=>{let e=m;return La(i)&&e.rain&&(e={...e,rain:Ua(e.rain,l)}),Ra(i)&&(e={...e,snowCount:Wa(u),fogBanks:u>=7?Math.max(e.fogBanks,3):e.fogBanks,haze:u>=7?Math.max(e.haze,.12):e.haze}),la(i)&&(e=ua(e,f)),Za(i)&&(e=Qa(e,p)),e})(),g=Ko[i],_=a??null,v=_?Xi(s?Date.now():o,_):null,y=v?!v.isDay:!1,b=v?na(h.sky,g.sky,v):y?g.sky:h.sky,x=y?qo(h.cloudColor):h.cloudColor,S=Math.min(n,r)*.09,C=n*.72,w=r*.26;if(v){let e=Zi(n,r,v.arcProgress);C=e.x,w=e.y}let T=ra(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=Zo(h,S),O=Qo(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},()=>Yo(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)*(la(i)?da(f):Za(i)?$a(p):1)})),F=h.fogBanks>0?Xo(is(i,y)):null,I=h.snowCount>0?ts():null,ee=I==null?[]:Array.from({length:h.snowCount},()=>rs(n,r,I)),L=va(i)?ya(d):null,te=L==null?null:Po(),ne=te!=null&&L!=null?Array.from({length:L.count},()=>Lo(n,r,te,{min:L.sizeMin,max:L.sizeMax},L.speedMul)):[],re=(()=>{let{count:e}=xo(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}))})(),R=[],ie=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:R,nextStrike:ie}}}function os(e,t){if(!e.dayCycleTimes)return;let n=Xi(e.liveClock?t??Date.now():e.sceneTimeMs,e.dayCycleTimes),r=Ko[e.activeWeather],i=na(e.cfg.sky,r.sky,n),a=Zi(e.width,e.height,n.arcProgress);e.dayCycle=n,e.activeNight=!n.isDay,e.sky=i,e.skyGradient=ra(e.ctx,e.height,i),e.sunX=a.x,e.sunY=a.y,e.celestial=n.isDay?e.sunSprite:e.moonSprite}function ss(e,t){t&&(e.state.t+=1),e.windField=bo(e.state.t,e.windMotion),e.dayCycleTimes&&os(e,e.liveClock?Date.now():e.sceneTimeMs),Vo(e),Wo(e),Eo(e),Do(e),Oo(e),Ro(e),zo(e),Bo(e),Ao(e),jo(e)}function cs(e){let{ctx:t,width:n,height:r,activeWeather:i,activeNight:a,windMotion:o}=e,s=as(e),c={ctx:t,width:n,height:r,activeWeather:i,activeNight:s.dayCycle?!s.dayCycle.isDay:a,windMotion:o,windField:bo(0,o),...s};if(c.dayCycleTimes&&os(c,c.liveClock?Date.now():c.sceneTimeMs),typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return ss(c,!1),()=>void 0;let l=0,u=document.hidden,d=y(e=>{u=e}),f=()=>{l=requestAnimationFrame(f),!u&&ss(c,!0)};return f(),()=>{cancelAnimationFrame(l),d()}}var ls={weatherBackground:`cos-weatherBackground-Mnm22`,canvas:`cos-canvas-nvqMt`,loadingOverlay:`cos-loadingOverlay-O58B7`,loadingSpinner:`cos-loadingSpinner-NQ9yG`,"weather-loading-spin":`cos-weather-loading-spin-IPFWZ`},us=({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,ariaLabel:_,loadingText:v=`天气加载中…`})=>{let y=(0,c.useRef)(null),b=uo(i,a!=null&&o!=null?{latitude:a,longitude:o}:void 0),x=Pa(i&&b.weather?b.weather:n),S=i&&b.rainLevel!=null?b.rainLevel:u,C=i&&b.snowLevel!=null?b.snowLevel:d,w=i&&b.fogLevel!=null?b.fogLevel:p,T=i&&b.hailLevel!=null?b.hailLevel:f,E=i&&b.smogLevel!=null?b.smogLevel:m,D=Ha(x,S,C),O=Yi(r),k=b.current?.sunrise??null,A=b.current?.sunset??null,j=b.current?.windSpeed??null,M=(0,c.useMemo)(()=>i&&k!=null&&A!=null?{sunrise:k,sunset:A}:qi(O),[i,k,A,O]),N=To({live:i,windLevel:s,liveWindKmh:j}),P=(0,c.useMemo)(()=>wo(N),[N]),F=i&&b.current?!b.current.isDay:!Xi(O,M).isDay,I=g||i&&(b.status===`locating`||b.status===`fetching`),ee=(0,c.useRef)(h);return(0,c.useEffect)(()=>{ee.current=h}),(0,c.useEffect)(()=>{b.weather&&ee.current?.(Pa(b.weather))},[b.weather]),(0,c.useEffect)(()=>{let n=y.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),cs({ctx:a,width:e,height:t,activeWeather:D,activeNight:F,dayCycleTimes:M,sceneTimeMs:O,liveClock:i,windMotion:P,rainLevel:S,snowLevel:C,fogLevel:w,hailLevel:T,smogLevel:E})},[F,D,M,S,C,w,T,E,t,i,O,e,P]),(0,l.jsxs)(`div`,{className:ls.weatherBackground,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:y,className:ls.canvas,style:{width:e,height:t},role:`img`,"aria-label":_??`天气背景:${x}${F?`(夜间)`:``},${P.level}级风`}),I&&(0,l.jsxs)(`div`,{className:ls.loadingOverlay,role:`status`,"aria-live":`polite`,children:[(0,l.jsx)(`div`,{className:ls.loadingSpinner,"aria-hidden":!0}),(0,l.jsx)(`span`,{children:v})]})]})},ds={waveText:`cos-waveText-Zy2Tp`,text:`cos-text-el-KR`,char:`cos-char-Y9-mV`,wave:`cos-wave-jVRCz`},fs=({text:e=`WAVE`,amplitude:t=12,color:n=`#38bdf8`,fontSize:r=56})=>(0,l.jsx)(`div`,{className:ds.waveText,children:(0,l.jsx)(`h1`,{className:ds.text,style:{fontSize:r,"--wave-color":n,"--wave-amp":`${t}px`},children:e.split(``).map((e,t)=>(0,l.jsx)(`span`,{className:ds.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=vr,exports.BurnAway=h,exports.CanvasClock=w,exports.Charge=O,exports.CircularText=A,exports.ClickSpark=M,exports.Confetti=ee,exports.CountUp=le,exports.Countdown=oe,exports.CursorTrail=me,exports.CurvedLoop=te,exports.CyberGrid=re,exports.DEFAULT_FOG_LEVEL=aa,exports.DEFAULT_HAIL_LEVEL=ma,exports.DEFAULT_RAIN_LEVEL=Ca,exports.DEFAULT_SMOG_LEVEL=qa,exports.DEFAULT_SNOW_LEVEL=wa,exports.DEFAULT_WIND_LEVEL=mo,exports.DiceRoll=ge,exports.DnaHelix=de,exports.DoublePendulum=_e,exports.ElectricArc=pe,exports.FOG_LEVEL_LABELS=oa,exports.Fireworks=K,exports.FlipCounter=Ee,exports.FuzzyText=Oe,exports.GameOfLife=Ie,exports.GlitchText=Re,exports.GradientFlow=je,exports.GravityBalls=Ve,exports.HAIL_LEVEL_LABELS=ha,exports.HolographicCard=Ue,exports.LiquidGlass=Ye,exports.LiquidProgress=Ge,exports.LorenzAttractor=qe,exports.MAX_PRECIP_LEVEL=Sa,exports.MIN_PRECIP_LEVEL=xa,exports.MagneticButton=Ze,exports.MatrixRain=et,exports.MazeGenerator=it,exports.MetaballPool=nt,exports.MeteorRain=ot,exports.NeonText=gt,exports.NetworkGraph=mt,exports.NewtonCradle=vt,exports.OrbitalChart=xt,exports.ParticleNetwork=Ct,exports.PhotoAlbum=zt,exports.PhotoClothesline=mn,exports.PlasmaBall=gn,exports.ProgressChest=Er,exports.RAIN_LEVEL_LABELS=Ma,exports.RadarScan=Or,exports.RedPacketRain=Ar,exports.ReturnCity=Mr,exports.RippleWater=$r,exports.RopeChain=Pr,exports.RotatingText=Rr,exports.SMOG_LEVEL_LABELS=Ja,exports.SNOW_LEVEL_LABELS=Na,exports.SandFall=fi,exports.ScrambleText=ni,exports.ScratchCard=ii,exports.ShinyText=Ur,exports.SlotMachine=ci,exports.SmokeFog=Fn,exports.Snowfall=Cr,exports.SolarSystem=xr,exports.Speedometer=Vr,exports.SplitReveal=hi,exports.SplitText=_i,exports.Spotlight=Si,exports.SpringMass=bi,exports.Starfield=Tr,exports.TextMorph=ji,exports.TimelinePulse=Gr,exports.TrueFocus=Ni,exports.Turntable=Di,exports.Typewriter=Li,exports.WaveButton=zi,exports.WaveText=fs,exports.WeatherBackground=us,exports.buildWindMotion=wo,exports.clampFogLevel=sa,exports.clampHailLevel=ga,exports.clampPrecipLevel=Ta,exports.clampSmogLevel=Ya,exports.fogBankAlphaScale=da,exports.fogLevelFromVisibility=pa,exports.fogLevelFromWmo=fa,exports.formatFogLevel=ca,exports.formatHailLevel=_a,exports.formatLocalHm=lo,exports.formatPrecipLevel=ja,exports.formatSmogLevel=Xa,exports.hailLevelFromWmo=ba,exports.hailSpec=ya,exports.intensifyFogConfig=ua,exports.intensifyRainConfig=Ua,exports.intensifySmogConfig=Qa,exports.intensifySnowCount=Wa,exports.isRainWeather=Fa,exports.isSnowWeather=Ia,exports.kmhToWindLevel=Co,exports.mapWmoCodeToWeatherType=no,exports.normalizeWeatherType=Pa,exports.precipBand=Da,exports.precipLabel=Aa,exports.rainLevelFromWeather=za,exports.rainLevelFromWmo=Ga,exports.resolveSceneWeather=Ha,exports.sampleWindField=bo,exports.smogBankAlphaScale=$a,exports.smogLevelFromVisibility=eo,exports.snowLevelFromWeather=Ba,exports.snowLevelFromWmo=Ka,exports.supportsFogLevel=la,exports.supportsHailLevel=va,exports.supportsRainLevel=La,exports.supportsSmogLevel=Za,exports.supportsSnowLevel=Ra,exports.useLiveWeather=uo,exports.useSunTimes=po,exports.visualWindLevel=go,exports.windLevelToKmh=So,exports.windStreakSpec=xo;
|
|
93
|
+
`,Bo=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]},Vo=(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},Ho=(e,t,n)=>{let r=Vo(e,e.VERTEX_SHADER,t),i=Vo(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},Uo=192,Wo=e=>({from:Bo(e.fromColor),to:Bo(e.toColor),tint:Bo(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}),Go=({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),y=(0,c.useRef)(0),S=(0,c.useRef)(null),C=(0,c.useRef)(Wo({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=Wo({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=Ho(i,Ro,zo);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=Uo*Uo,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,Uo,Uo,0,i.RGBA,i.UNSIGNED_BYTE,A)},M=(e,t,n,r)=>{let i=e*(Uo-1),a=t*(Uo-1),o=x(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>=Uo-1||s<=0||s>=Uo-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*Uo+r]+=n*(l+u*1.1)}},N=(e,t)=>{let n=x(e,.9,.999),r=x(t,.3,.7);for(let e=0;e<2;e++){for(let e=1;e<Uo-1;e++){let t=e*Uo;for(let e=1;e<Uo-1;e++){let i=t+e,a=D[i-1]+D[i+1]+D[i-Uo]+D[i+Uo];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,Uo,Uo),i.uniform1f(h,x(t.waveAmplitude,0,2)),i.uniform1f(g,x(t.waveSpeed,0,3)),i.uniform1f(_,x(t.shimmer,0,2)),i.uniform1f(w,x(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=b(e=>{F=e}),L=performance.now(),R=e=>{if(y.current=requestAnimationFrame(R),F)return;let t=C.current;if(S.current){let e=S.current,n=x(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-L)/1e3)};return y.current=requestAnimationFrame(R),()=>{cancelAnimationFrame(y.current),I(),i.deleteTexture(k),i.deleteBuffer(o),i.deleteProgram(a)}},[t,e]),(0,l.jsxs)(`div`,{className:Lo.rippleWater,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:v,className:Lo.canvas,style:{width:e,height:t,cursor:h?`pointer`:`default`},role:`img`,"aria-label":_||`涟漪水面`}),g?(0,l.jsx)(`span`,{className:Lo.hint,"aria-hidden":!0,children:_}):null]})},Ko={scrambleText:`cos-scrambleText-hN4Wm`,text:`cos-text-frsHs`,cursor:`cos-cursor-3zQOy`,blink:`cos-blink-OcKXu`},qo=`ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%&*`,Jo=({text:e=`DECRYPTED`,duration:t=2e3,charset:n=qo})=>{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:qo,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:Ko.scrambleText,children:(0,l.jsxs)(`p`,{className:Ko.text,children:[r,(0,l.jsx)(`span`,{className:Ko.cursor})]})})},Yo={scratchCard:`cos-scratchCard-McIEK`,prize:`cos-prize-X0z5V`,canvas:`cos-canvas-JqIlr`,hidden:`cos-hidden-Lsfbt`},Xo=({coverColor:e=`#94a3b8`,prize:t=`🎉 恭喜中奖!`,coverText:n=`刮开涂层`,onReveal:r,width:i=300,height:a=180})=>{let o=(0,c.useRef)(null),s=(0,c.useRef)(!1),u=(0,c.useRef)(!1),d=(0,c.useRef)(r),[f,p]=(0,c.useState)(!1);(0,c.useEffect)(()=>{d.current=r},[r]);let m=(0,c.useCallback)(t=>{t.globalCompositeOperation=`source-over`,t.fillStyle=e,t.fillRect(0,0,i,a),t.fillStyle=`rgb(255 255 255 / 30%)`,t.font=`bold 16px system-ui, sans-serif`,t.textAlign=`center`,t.fillText(n,i/2,a/2)},[e,n,a,i]),h=(0,c.useCallback)(e=>{if(u.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&&(u.current=!0,p(!0),d.current?.())},[]);(0,c.useEffect)(()=>{let e=o.current;if(!e)return;let t=window.devicePixelRatio||1;e.width=i*t,e.height=a*t;let n=e.getContext(`2d`);n&&(n.setTransform(t,0,0,t,0,0),m(n))},[m,a,i]);let g=(e,t)=>{let n=o.current;if(!n||u.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(),h(n))},_=e=>{let t=o.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}},v=e=>{s.current=!0;let t=_(e);t&&g(t.x,t.y)},y=e=>{if(!s.current)return;let t=_(e);t&&g(t.x,t.y)},b=()=>{s.current=!1};return(0,l.jsxs)(`div`,{className:Yo.scratchCard,style:{width:i,height:a},children:[(0,l.jsx)(`div`,{className:Yo.prize,children:t}),(0,l.jsx)(`canvas`,{ref:o,className:`${Yo.canvas} ${f?Yo.hidden:``}`,style:{width:i,height:a},onMouseDown:v,onMouseMove:y,onMouseUp:b,onMouseLeave:b,onTouchStart:v,onTouchMove:y,onTouchEnd:b})]})},Zo={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`},Qo=[`🍒`,`🍋`,`🍊`,`🍇`,`⭐`,`7️⃣`],$o=30,es=8,ts=[0,350,700],ns=e=>1-(1-e)**3,rs=({symbols:e=Qo,spinDuration:t=3e3,onSpinEnd:n,startText:r=`开始`,spinningText:i=`旋转中...`,jackpotText:a=`🎰 大奖!`,resultPrefix:o=`结果:`})=>{let[s,u]=(0,c.useState)(!1),[d,f]=(0,c.useState)([0,0,0]),[p,m]=(0,c.useState)([]),h=(0,c.useRef)(0),g=(0,c.useRef)(n),_=(0,c.useRef)(null);(0,c.useEffect)(()=>{g.current=n},[n]);let v=e.length*80,y=Math.floor($o/2)*v,b=(0,c.useCallback)(()=>{let t=[];for(let n=0;n<$o;n++)t.push(...e);return t},[e])(),x=(t,n)=>-(t-1+n*e.length)*80;return(0,c.useEffect)(()=>()=>{_.current&&(_.current.cancelled=!0),cancelAnimationFrame(h.current)},[]),(0,l.jsxs)(`div`,{className:Zo.slotMachine,children:[(0,l.jsx)(`div`,{className:Zo.machine,children:[0,1,2].map(e=>(0,l.jsxs)(`div`,{className:Zo.reel,style:{height:240},children:[(0,l.jsx)(`div`,{className:Zo.strip,style:{transform:`translateY(${d[e]}px)`},children:b.map((e,t)=>(0,l.jsx)(`div`,{className:Zo.item,style:{height:80},children:e},t))}),(0,l.jsx)(`div`,{className:Zo.mask})]},e))}),(0,l.jsx)(`button`,{type:`button`,className:Zo.spinBtn,onClick:()=>{if(s||e.length===0)return;u(!0),m([]);let n=[0,1,2].map(()=>Math.floor(Math.random()*e.length)),r=[...d],i=n.map((e,t)=>{let n=r[t],i=es*v,a=Math.ceil((-n+i)/v)+1,o=x(e,a);for(;n-o<i;)a+=1,o=x(e,a);return o}),a=Math.max(t,16),o=performance.now(),c={cancelled:!1};_.current=c;let l=t=>{if(!c.cancelled){if(f(r.map((e,n)=>{let r=t-o-ts[n];if(r<0)return e;let s=ns(Math.min(r/a,1));return e+(i[n]-e)*s})),!ts.every(e=>t-o-e>=a))h.current=requestAnimationFrame(l);else if(!c.cancelled){let t=n.map(t=>e[t]);f(n.map(e=>x(e,Math.round(y/v)))),m(t),u(!1),g.current?.(t)}}};h.current=requestAnimationFrame(l)},disabled:s,children:s?i:r}),p.length>0&&!s&&(0,l.jsx)(`p`,{className:Zo.result,children:p[0]===p[1]&&p[1]===p[2]?a:`${o} ${p.join(` `)}`})]})},is={sandFall:`cos-sandFall-kgJeI`,canvas:`cos-canvas-9z6X1`,toolbar:`cos-toolbar-u8dLM`,hint:`cos-hint-DS8tY`,button:`cos-button-YhINe`},as=[`#fbbf24`,`#f59e0b`,`#d97706`,`#b45309`,`#92400e`],os=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]},ss=({width:e=480,height:t=400,cellSize:n=4,colors:r=as,spawnRate:i=3,hint:a=`按住鼠标绘制沙粒`,clearText:o=`Clear`})=>{let s=(0,c.useRef)(null),u=Math.max(1,Math.floor(e/n)),d=Math.max(1,Math.floor(t/n)),f=(0,c.useRef)(Array(u*d).fill(null)),p=(0,c.useRef)({x:-1,y:-1,down:!1}),m=(0,c.useMemo)(()=>(r.length>0?r:as).map(os),[r]),h=()=>{f.current=Array(u*d).fill(null)};(0,c.useEffect)(()=>{f.current=Array(u*d).fill(null)},[u,d]),(0,c.useEffect)(()=>{let r=s.current;if(!r)return;let a=window.devicePixelRatio||1;r.width=e*a,r.height=t*a;let o=r.getContext(`2d`);if(!o)return;o.setTransform(a,0,0,a,0,0);let c=0,l=document.hidden,h=b(e=>{l=e}),g=(e,t)=>t*u+e,_=()=>{let e=f.current;for(let t=d-2;t>=0;t--)for(let n=0;n<u;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,o=n+a,s=n-a;o>=0&&o<u&&e[g(o,t+1)]===null?(e[g(o,t+1)]=e[r],e[r]=null):s>=0&&s<u&&e[g(s,t+1)]===null&&(e[g(s,t+1)]=e[r],e[r]=null)}},v=()=>{let{x:e,y:t,down:r}=p.current;if(!r||e<0||t<0)return;let a=Math.floor(e/n),o=Math.floor(t/n),s=f.current;for(let e=0;e<i;e++){let e=a+Math.floor((Math.random()-.5)*6),t=o+Math.floor((Math.random()-.5)*3);if(e<0||e>=u||t<0||t>=d)continue;let n=g(e,t);s[n]===null&&(s[n]=Math.floor(Math.random()*m.length))}},y=()=>{o.fillStyle=`#0f172a`,o.fillRect(0,0,e,t);let r=f.current;for(let e=0;e<d;e++)for(let t=0;t<u;t++){let i=r[g(t,e)];if(i===null)continue;let[a,s,c]=m[i];o.fillStyle=`rgb(${a} ${s} ${c})`,o.fillRect(t*n,e*n,n,n)}},x=()=>{c=requestAnimationFrame(x),!l&&(v(),_(),y())};return c=requestAnimationFrame(x),()=>{cancelAnimationFrame(c),h()}},[n,u,t,m,d,i,e]);let g=(e,t,n,r)=>{p.current={x:e-n.left,y:t-n.top,down:r}};return(0,l.jsxs)(`div`,{className:is.sandFall,style:{width:e},children:[(0,l.jsx)(`canvas`,{ref:s,className:is.canvas,style:{width:e,height:t},onMouseDown:e=>g(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect(),!0),onMouseMove:e=>{p.current.down&&g(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect(),!0)},onMouseUp:()=>{p.current.down=!1},onMouseLeave:()=>{p.current.down=!1},onTouchStart:e=>{let t=e.touches[0];t&&g(t.clientX,t.clientY,e.currentTarget.getBoundingClientRect(),!0)},onTouchMove:e=>{let t=e.touches[0];t&&g(t.clientX,t.clientY,e.currentTarget.getBoundingClientRect(),!0)},onTouchEnd:()=>{p.current.down=!1}}),(0,l.jsxs)(`div`,{className:is.toolbar,children:[(0,l.jsx)(`span`,{className:is.hint,children:a}),(0,l.jsx)(`button`,{type:`button`,className:is.button,onClick:h,children:o})]})]})},cs={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`},ls=[`fromTop`,`fromBottom`,`fromLeft`,`fromRight`],us=({text:e=`REVEAL`,delay:t=80,color:n=`#f8fafc`})=>(0,l.jsx)(`div`,{className:cs.splitReveal,children:(0,l.jsx)(`h1`,{className:cs.text,style:{"--reveal-color":n},children:e.split(``).map((e,n)=>(0,l.jsx)(`span`,{className:`${cs.char} ${cs[ls[n%ls.length]]}`,style:{animationDelay:`${n*t}ms`},children:e===` `?`\xA0`:e},`${e}-${n}`))})}),ds={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`},fs=({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:ds.splitText,children:(0,l.jsx)(`div`,{className:ds.text,style:{fontSize:o,"--split-color":s,"--split-duration":`${r}ms`},children:f.map((e,r)=>(0,l.jsx)(`span`,{className:`${ds.char} ${ds[t]} ${u?ds.enter:ds.exit}`,style:{animationDelay:`${r*n}ms`},children:e===` `?`\xA0`:e},`${e}-${r}`))})})},ps={springMass:`cos-springMass-cYEt6`,canvas:`cos-canvas-mwL9l`,hint:`cos-hint-TKLm3`},ms=(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}},hs=({width:e=560,height:t=400,cols:n=6,rows:r=5,stiffness:i=.22,damping:a=.9,color:o=`#a78bfa`,hint:s=`拖拽网格质点,观察弹簧回弹`})=>{let u=(0,c.useRef)(null),d=(0,c.useRef)(ms(e,t,n,r)),f=(0,c.useRef)(null),p=(0,c.useRef)({x:0,y:0});(0,c.useEffect)(()=>{d.current=ms(e,t,n,r),f.current=null},[n,t,r,e]),(0,c.useEffect)(()=>{let n=u.current;if(!n)return;let r=window.devicePixelRatio||1;n.width=e*r,n.height=t*r;let s=n.getContext(`2d`);if(!s)return;s.setTransform(r,0,0,r,0,0);let c=0,l=document.hidden,m=b(e=>{l=e}),h=Math.max(.04,Math.min(i,.8)),g=()=>{let{nodes:n,springs:r}=d.current,i=f.current;if(i){let e=n[i.index];e.x=p.current.x+i.ox,e.y=p.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}=d.current;s.fillStyle=`#0f172a`,s.fillRect(0,0,e,t);for(let i of r){let r=n[i.a],a=n[i.b],c=Math.hypot(a.x-r.x,a.y-r.y)||1,l=Math.min(1,Math.abs(c-i.rest)/i.rest);s.beginPath(),s.moveTo(r.x,r.y),s.lineTo(a.x,a.y),s.strokeStyle=o,s.globalAlpha=.22+l*.55,s.lineWidth=i.rest>Math.max(e,t)*.2?1:1.6,s.stroke(),s.globalAlpha=1}n.forEach((e,t)=>{s.beginPath(),s.arc(e.x,e.y,e.pinned?6:8,0,Math.PI*2),s.fillStyle=e.pinned?`#64748b`:o,s.fill(),s.strokeStyle=`rgb(255 255 255 / 28%)`,s.lineWidth=1,s.stroke(),f.current?.index===t&&(s.beginPath(),s.arc(e.x,e.y,13,0,Math.PI*2),s.strokeStyle=o,s.globalAlpha=.45,s.lineWidth=2,s.stroke(),s.globalAlpha=1)})},v=()=>{c=requestAnimationFrame(v),!l&&(g(),_())};return c=requestAnimationFrame(v),()=>{cancelAnimationFrame(c),m()}},[o,a,t,i,e]);let m=(e,t)=>{let{nodes:n}=d.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},h=(e,t,n)=>{let r=e-n.left,i=t-n.top;p.current={x:r,y:i};let a=m(r,i);if(a<0)return;let o=d.current.nodes[a];f.current={index:a,ox:o.x-r,oy:o.y-i}},g=(e,t,n)=>{p.current={x:e-n.left,y:t-n.top}},_=()=>{f.current=null};return(0,l.jsxs)(`div`,{className:ps.springMass,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:u,className:ps.canvas,style:{width:e,height:t},onMouseDown:e=>h(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect()),onMouseMove:e=>g(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect()),onMouseUp:_,onMouseLeave:_,onTouchStart:e=>{let t=e.touches[0];t&&h(t.clientX,t.clientY,e.currentTarget.getBoundingClientRect())},onTouchMove:e=>{let t=e.touches[0];t&&g(t.clientX,t.clientY,e.currentTarget.getBoundingClientRect())},onTouchEnd:_}),(0,l.jsx)(`div`,{className:ps.hint,children:s})]})},gs={spotlight:`cos-spotlight-OddY1`,content:`cos-content-5I1Wy`,overlay:`cos-overlay-F6CJ5`},_s=({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:gs.spotlight,style:{"--spot-radius":`${t}px`,"--dim-color":n},onMouseMove:i,children:[(0,l.jsx)(`div`,{className:gs.content,children:e}),(0,l.jsx)(`div`,{className:gs.overlay})]})},vs={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`},ys=[`#FF6B6B`,`#4ECDC4`,`#FFE66D`,`#A78BFA`,`#60A5FA`,`#F472B6`,`#34D399`,`#FB923C`],bs=[{label:`一等奖`},{label:`二等奖`},{label:`三等奖`},{label:`谢谢参与`},{label:`优惠券`},{label:`再来一次`}],xs=e=>1-(1-e)**3,Ss=({prizes:e=bs,size:t=360,spinDuration:n=4e3,spinRounds:r=5,buttonText:i=`开始抽奖`,spinningText:a=`抽奖中...`,resultPrefix:o=`恭喜获得:`,onSpinEnd:s})=>{let u=(0,c.useRef)(null),d=(0,c.useRef)(0),f=(0,c.useRef)(0),p=(0,c.useRef)(1),[m,h]=(0,c.useState)(!1),[g,_]=(0,c.useState)(null),v=(0,c.useRef)(s),y=(0,c.useRef)(null);(0,c.useEffect)(()=>{v.current=s},[s]);let b=t+48,x=(e,t)=>t.color??ys[e%ys.length],S=(0,c.useCallback)(n=>{let r=u.current;if(!r)return;let i=r.getContext(`2d`);if(!i)return;let a=b/2,o=t/2,s=Math.PI*2/e.length;i.clearRect(0,0,b,b),i.save(),i.translate(a,a),i.rotate(n),e.forEach((e,n)=>{let r=n*s-Math.PI/2,a=r+s,c=x(n,e);i.beginPath(),i.moveTo(0,0),i.arc(0,0,o,r,a),i.closePath(),i.fillStyle=c,i.fill(),i.strokeStyle=`rgb(255 255 255 / 35%)`,i.lineWidth=2,i.stroke(),i.save(),i.rotate(r+s/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,o-18,6),i.restore()}),i.beginPath(),i.arc(0,0,o,0,Math.PI*2),i.strokeStyle=`#fbbf24`,i.lineWidth=6,i.stroke(),i.beginPath(),i.arc(0,0,o-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)*(o+14),r=Math.sin(t)*(o+14);i.beginPath(),i.arc(n,r,3,0,Math.PI*2),i.fillStyle=e%2==0?`#fde68a`:`#f59e0b`,i.fill()}i.restore()},[b,e,t]);return(0,c.useEffect)(()=>{let e=u.current;if(!e)return;let t=window.devicePixelRatio||1;p.current=t,e.width=b*t,e.height=b*t;let n=e.getContext(`2d`);n&&n.setTransform(t,0,0,t,0,0),S(d.current)},[b,S]),(0,c.useEffect)(()=>()=>{y.current&&(y.current.cancelled=!0),f.current&&cancelAnimationFrame(f.current)},[]),(0,l.jsxs)(`div`,{className:vs.turntable,style:{width:b,height:b+80},children:[(0,l.jsxs)(`div`,{className:vs.wheelWrap,style:{width:b,height:b},children:[(0,l.jsx)(`div`,{className:vs.pointer}),(0,l.jsx)(`canvas`,{ref:u,className:vs.canvas,style:{width:b,height:b}}),(0,l.jsx)(`button`,{type:`button`,className:vs.spinBtn,onClick:()=>{if(m||e.length===0)return;h(!0),_(null);let t=Math.PI*2/e.length,i=Math.floor(Math.random()*e.length),a=i*t+t/2,o=d.current,s=o+r*Math.PI*2+(Math.PI*2-a)-o%(Math.PI*2),c=o,l=performance.now(),u={cancelled:!1};y.current=u;let p=t=>{if(u.cancelled)return;let r=t-l,a=Math.min(r/n,1),o=xs(a),m=c+(s-c)*o;if(d.current=m,S(m),a<1)f.current=requestAnimationFrame(p);else if(!u.cancelled){let t=e[i];d.current=m,h(!1),_(t),v.current?.(t,i)}};f.current=requestAnimationFrame(p)},disabled:m,children:m?a:i})]}),g&&!m&&(0,l.jsxs)(`p`,{className:vs.result,children:[o,(0,l.jsx)(`strong`,{children:g.label})]})]})},Cs={textMorph:`cos-textMorph-W-C1e`,stage:`cos-stage-AaMn6`,layer:`cos-layer-N-4oM`},ws=[`COS DESIGN`,`TEXT MORPH`,`SMOOTH TRANSITION`],Ts=(e,t,n)=>Math.min(n,Math.max(t,e)),Es=({texts:e=ws,interval:t=2200,duration:n=680,fontSize:r=64,color:i=`#f8fafc`})=>{let a=(0,c.useMemo)(()=>e.length>0?e:ws,[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=Ts((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:Cs.textMorph,style:{"--morph-color":i},children:(0,l.jsxs)(`div`,{className:Cs.stage,style:{fontSize:r},children:[(0,l.jsx)(`span`,{className:`${Cs.layer} ${Cs.current}`,style:{opacity:g,filter:`blur(${v}px)`,transform:`scale(${b}) translateY(${u*-8}px)`},children:m}),(0,l.jsx)(`span`,{className:`${Cs.layer} ${Cs.next}`,style:{opacity:_,filter:`blur(${y}px)`,transform:`scale(${x}) translateY(${(1-u)*8}px)`},children:h})]})})},Ds={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-`},Os=({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:Ds.trueFocus,children:(0,l.jsxs)(`div`,{className:Ds.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:Ds.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:Ds.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:`${Ds.corner} ${Ds.tl}`}),(0,l.jsx)(`span`,{className:`${Ds.corner} ${Ds.tr}`}),(0,l.jsx)(`span`,{className:`${Ds.corner} ${Ds.bl}`}),(0,l.jsx)(`span`,{className:`${Ds.corner} ${Ds.br}`})]})]})})},ks={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`},As=[`Hello, cos-design!`,`欢迎来到组件库 ✨`,`Build something fun 🚀`],js=({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:ks.typewriter,children:(0,l.jsxs)(`div`,{className:ks.terminal,children:[(0,l.jsxs)(`div`,{className:ks.dots,children:[(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{})]}),(0,l.jsxs)(`p`,{className:ks.text,children:[(0,l.jsx)(`span`,{className:ks.prompt,children:`>`}),i,(0,l.jsx)(`span`,{className:ks.cursor,children:`|`})]})]})})},Ms=({texts:e=As,speed:t=100,deleteSpeed:n=50,pause:r=2e3})=>{let i=e.length>0?e:As;return(0,l.jsx)(js,{texts:i,speed:t,deleteSpeed:n,pause:r},i.join(`\0`))},Ns={waveButton:`cos-waveButton-Aa7G-`,btn:`cos-btn-WJrEN`,label:`cos-label-9BHOU`,wave:`cos-wave-GycLU`,ripple:`cos-ripple-5ZFpr`},Ps=({text:e=`点我试试`,color:t=`#38bdf8`,className:n,style:r,...i})=>(0,l.jsx)(`div`,{className:Ns.waveButton,children:(0,l.jsxs)(`button`,{type:`button`,className:`${Ns.btn} ${n??``}`,style:{"--wave-color":t,...r},...i,children:[(0,l.jsx)(`span`,{className:Ns.wave}),(0,l.jsx)(`span`,{className:Ns.wave}),(0,l.jsx)(`span`,{className:Ns.label,children:e})]})}),Fs=e=>Math.min(1,Math.max(0,e)),Is=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]},Ls=([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)}`},Rs=(e,t,n)=>e+(t-e)*n,zs=(e,t,n)=>[Rs(e[0],t[0],n),Rs(e[1],t[1],n),Rs(e[2],t[2],n)],Bs=(e,t,n)=>Ls(zs(Is(e),Is(t),Fs(n))),Vs=e=>{let t=Fs(e);return t*t*(3-2*t)},Hs=(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()}},Us=(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()},Ws=(e,t=new Date)=>Us(e??`14:00`,t)??Us(`14:00`,t),Gs=(e,t)=>{let{sunrise:n,sunset:r}=t;if(!(r>n)){let t=Hs(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=Fs((e-n)/i);else if(e>=r){let t=Math.max(1,a-r);c=Fs((e-r)/t)}else{let t=Math.max(1,n-o);c=Fs((e-o)/t)}let l=s?Math.sin(Math.PI*c):0,u=Math.abs(e-n),d=Math.abs(e-r),f=Fs(1-Math.min(u,d)/45e5);return{isDay:s,arcProgress:c,elevation:l,twilight:f}},Ks=(e,t,n)=>{let r=Fs(n),i=Math.sin(Math.PI*r);return{x:e*(.1+.8*r),y:t*(.58-.4*i)}},qs=`#e8895c`,Js=`#f3c98a`,Ys=`#2a1f4a`,Xs=`#c4784a`,Zs=(e,t,n)=>{if(n.isDay){let t=Vs(n.elevation),r=(1-t)*.72;return[Bs(Bs(e[0],qs,r),`#1a2438`,(1-t)*.12),Bs(Bs(e[1],Js,r*.85),`#3a4558`,(1-t)*.08)]}let r=n.twilight;return[Bs(t[0],Bs(Ys,qs,.35),r*.55),Bs(t[1],Bs(Xs,Js,.4),r*.7)]},Qs=(e,t,n)=>{let r=e.createLinearGradient(0,0,0,t);return r.addColorStop(0,n[0]),r.addColorStop(1,n[1]),r},$s=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}},ec=2,tc=[``,`薄雾`,`中雾`,`浓雾`],nc=e=>Math.min(3,Math.max(1,Math.round(e))),rc=e=>{let t=nc(e);return`${t} · ${tc[t]}`},ic=e=>e===`fog`,ac=(e,t)=>{let n=nc(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`}},oc=e=>{let t=nc(e);return t===1?.45:t===3?.95:.65},sc=e=>e===45?2:e===48?3:null,cc=e=>e==null||!Number.isFinite(e)?null:e>=5e3?1:e>=1e3?2:3,lc=2,uc=[``,`细雹`,`密雹`,`巨雹`],dc=e=>Math.min(3,Math.max(1,Math.round(e))),fc=e=>{let t=dc(e);return`${t} · ${uc[t]}`},pc=e=>e===`hail`,mc=e=>{let t=dc(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}},hc=e=>e===96?2:e===99?3:null,gc=1,_c=10,vc=5,yc=5,bc=e=>Math.min(10,Math.max(1,Math.round(e))),xc=(e,t,n)=>e+(t-e)*n,Sc=e=>{let t=bc(e);return t<=2?1:t<=4?2:t<=6?3:t<=8?4:5},Cc=[`毛毛雨`,`小雨`,`中雨`,`暴雨`,`特大暴雨`],wc=[`毛毛雪`,`小雪`,`中雪`,`暴雪`,`特大暴雪`],Tc=(e,t)=>{let n=Sc(e);return(t===`rain`?Cc:wc)[n-1]},Ec=(e,t)=>`${bc(e)} · ${Tc(e,t)}`,Dc=[``,...Cc],Oc=[``,...wc],kc=e=>e===`lightRain`||e===`moderateRain`||e===`heavyRain`?`rain`:e===`lightSnow`||e===`moderateSnow`||e===`heavySnow`?`snow`:e,Ac=e=>e===`rain`||e===`lightRain`||e===`moderateRain`||e===`heavyRain`,jc=e=>e===`snow`||e===`lightSnow`||e===`moderateSnow`||e===`heavySnow`,Mc=e=>Ac(e)||e===`thunderstorm`||e===`sleet`,Nc=e=>jc(e)||e===`sleet`,Pc=(e,t=5)=>e===`lightRain`?3:e===`moderateRain`?5:e===`heavyRain`?8:bc(t),Fc=(e,t=5)=>e===`lightSnow`?3:e===`moderateSnow`?5:e===`heavySnow`?8:bc(t),Ic=(e,t)=>t===`rain`?e<=2?`lightRain`:e===3?`moderateRain`:`heavyRain`:e<=2?`lightSnow`:e===3?`moderateSnow`:`heavySnow`,Lc=(e,t=5,n=5)=>e===`rain`?Ic(Sc(t),`rain`):e===`lightRain`||e===`moderateRain`||e===`heavyRain`?Ic(Sc(Pc(e)),`rain`):e===`snow`?Ic(Sc(n),`snow`):e===`lightSnow`||e===`moderateSnow`||e===`heavySnow`?Ic(Sc(Fc(e)),`snow`):e,Rc=(e,t)=>{let n=(bc(t)-1)/9;return{count:Math.round(xc(35,340,n)),speed:xc(5.5,16,n),wind:xc(-.4,-3.2,n),alpha:xc(.28,.62,n),splash:bc(t)>=5}},zc=e=>{let t=(bc(e)-1)/9;return Math.round(xc(30,360,t))},Bc=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,Vc=e=>[77].includes(e)?2:[71,85].includes(e)?3:[73].includes(e)?5:[75].includes(e)?8:[86].includes(e)?10:null,Hc=2,Uc=[``,`轻霾`,`中霾`,`重霾`],Wc=e=>Math.min(3,Math.max(1,Math.round(e))),Gc=e=>{let t=Wc(e);return`${t} · ${Uc[t]}`},Kc=e=>e===`smog`,qc=(e,t)=>{let n=Wc(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`}},Jc=e=>{let t=Wc(e);return t===1?.55:t===3?1.05:.85},Yc=e=>e==null||!Number.isFinite(e)?null:e>=5e3?1:e>=1e3?2:3,Xc={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`},Zc=e=>kc(Xc[e]??`overcast`),Qc={weather:null,rainLevel:null,snowLevel:null,fogLevel:null,hailLevel:null,smogLevel:null,status:`idle`,error:null,current:null},$c={weather:null,rainLevel:null,snowLevel:null,fogLevel:null,hailLevel:null,smogLevel:null,status:`locating`,error:null,current:null},el={weather:null,rainLevel:null,snowLevel:null,fogLevel:null,hailLevel:null,smogLevel:null,status:`fetching`,error:null,current:null},tl=e=>e!=null&&Number.isFinite(e.latitude)&&Number.isFinite(e.longitude),nl=e=>{if(typeof e!=`string`||!e)return null;let t=Date.parse(e);return Number.isFinite(t)?t:null},rl=e=>{if(typeof e!=`string`||!e)return null;let t=e.match(/T(\d{2}):(\d{2})/);return t?`${t[1]}:${t[2]}`:null},il=(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},al=(e=!0,t)=>{let n=tl(t),r=n?t.latitude:null,i=n?t.longitude:null,a=e?n?el:$c:Qc,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=nl(o?.daily?.sunrise?.[0]),d=nl(o?.daily?.sunset?.[0]),f=typeof o?.timezone==`string`?o.timezone:null,p=rl(o?.current?.time)??il(f),m=Zc(s),h=Bc(s),g=Vc(s),_=o?.current?.visibility,v=_!=null&&Number.isFinite(Number(_))?Number(_):null,y=m===`fog`?cc(v)??sc(s)??2:null,b=m===`hail`?hc(s)??2:null,x=m===`smog`?Yc(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},ol=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=nl(a?.daily?.sunrise?.[0]),s=nl(a?.daily?.sunset?.[0]);return o==null||s==null?null:{sunrise:o,sunset:s}},sl=e=>{let t=tl(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 ol(n,r,t.signal).then(t=>{e||o(t)}).catch(()=>{e||o(null)}),()=>{e=!0,t.abort()}},[n,r]),t?a:null},cl=3,ll=e=>Math.min(12,Math.max(0,Math.round(e))),ul=e=>Math.max(0,ll(e)-2),dl=.55,fl=[0,3,8,16,24,33,44,55,68,81,95,110,125],pl=[1,5,11,19,28,38,49,61,74,88,102,117,1/0],ml=(e,t,n=0,r=0)=>{let i=t.gustiness,a=t.wander,o=n*.0017+r*.0024,s=e*dl,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)}},hl=e=>{let t=ll(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}},gl=e=>fl[ll(e)]??16,_l=e=>{let t=Math.max(0,e);for(let e=0;e<pl.length;e++)if(t<=pl[e])return e;return 12},vl=e=>{let t=_l(e),n=ul(t),r=gl(n),i=Math.max(.04,Math.min(r/16,4.2)),{alphaMul:a}=hl(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}},yl=e=>e.live&&e.liveWindKmh!=null&&Number.isFinite(e.liveWindKmh)?Math.max(0,e.liveWindKmh):gl(e.windLevel);function bl(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 xl(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 Sl(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 Cl(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=Cl(e,t,o,s,i*.55,a-1),l=Cl(o,s,n,r,i*.55,a-1);return[...c.slice(0,-1),...l]}function wl(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=ml(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 Tl(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=Cl(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 El=3.2,Dl=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},Ol=(e=16)=>Array.from({length:e},()=>Dl(El)),kl=e=>e[Math.floor(Math.random()*e.length)],Al=(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=kl(r),e.drawSize=e.r*2.8+4,e.rotation=Math.random()*Math.PI*2,e.rotationSpeed=(Math.random()-.5)*.06},jl=(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 Al(a,e,t,n,Math.random()<.72,r,i),a};function Ml(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 Nl(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 Pl(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=ml(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{Al(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 Fl(e){e.ctx.fillStyle=e.skyGradient,e.ctx.fillRect(0,0,e.width,e.height)}function Il(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 Ll(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?$s(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 Rl(e){if(e.activeNight){Il(e),Ll(e);return}Ll(e)}var zl={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}},Bl={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}},Vl=([e,t,n])=>[Math.round(e*.3+18),Math.round(t*.3+24),Math.round(n*.3+42)];function Hl(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 Ul(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}=Hl(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 Wl(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 Gl(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 Kl(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 ql=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},Jl=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},Yl=()=>({dots:[1.2,1.6,2,2.3].map(e=>ql(e)),crystals:[2.6,3.2,3.8,4.4,5].map(e=>Jl(e*2.4))}),Xl=e=>e[Math.floor(Math.random()*e.length)],Zl=(e,t,n,r)=>{let i=1+Math.random()**1.6*4.2,a=i>=2.4,o=Xl(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}},Ql=(e,t)=>t?e===`smog`?`96, 88, 66`:`138, 150, 168`:e===`smog`?`168, 155, 126`:`226, 232, 238`;function $l(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=zl[i],h=(()=>{let e=m;return Mc(i)&&e.rain&&(e={...e,rain:Rc(e.rain,l)}),Nc(i)&&(e={...e,snowCount:zc(u),fogBanks:u>=7?Math.max(e.fogBanks,3):e.fogBanks,haze:u>=7?Math.max(e.haze,.12):e.haze}),ic(i)&&(e=ac(e,f)),Kc(i)&&(e=qc(e,p)),e})(),g=Bl[i],_=a??null,v=_?Gs(s?Date.now():o,_):null,y=v?!v.isDay:!1,b=v?Zs(h.sky,g.sky,v):y?g.sky:h.sky,x=y?Vl(h.cloudColor):h.cloudColor,S=Math.min(n,r)*.09,C=n*.72,w=r*.26;if(v){let e=Ks(n,r,v.arcProgress);C=e.x,w=e.y}let T=Qs(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=Gl(h,S),O=Kl(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},()=>Ul(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)*(ic(i)?oc(f):Kc(i)?Jc(p):1)})),F=h.fogBanks>0?Wl(Ql(i,y)):null,I=h.snowCount>0?Yl():null,L=I==null?[]:Array.from({length:h.snowCount},()=>Zl(n,r,I)),R=pc(i)?mc(d):null,z=R==null?null:Ol(),B=z!=null&&R!=null?Array.from({length:R.count},()=>jl(n,r,z,{min:R.sizeMin,max:R.sizeMax},R.speedMul)):[],V=(()=>{let{count:e}=hl(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}))})(),H=[],U=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:R,state:{stars:A,moonCraters:E,clouds:j,drops:M,splashes:N,fogBanks:P,flakes:L,hailstones:B,hailPool:z??[],windStreaks:V,t:0,flashAlpha:0,boltLife:0,boltPoints:H,nextStrike:U}}}function eu(e,t){if(!e.dayCycleTimes)return;let n=Gs(e.liveClock?t??Date.now():e.sceneTimeMs,e.dayCycleTimes),r=Bl[e.activeWeather],i=Zs(e.cfg.sky,r.sky,n),a=Ks(e.width,e.height,n.arcProgress);e.dayCycle=n,e.activeNight=!n.isDay,e.sky=i,e.skyGradient=Qs(e.ctx,e.height,i),e.sunX=a.x,e.sunY=a.y,e.celestial=n.isDay?e.sunSprite:e.moonSprite}function tu(e,t){t&&(e.state.t+=1),e.windField=ml(e.state.t,e.windMotion),e.dayCycleTimes&&eu(e,e.liveClock?Date.now():e.sceneTimeMs),Fl(e),Rl(e),bl(e),xl(e),Sl(e),Ml(e),Nl(e),Pl(e),wl(e),Tl(e)}function nu(e){let{ctx:t,width:n,height:r,activeWeather:i,activeNight:a,windMotion:o}=e,s=$l(e),c={ctx:t,width:n,height:r,activeWeather:i,activeNight:s.dayCycle?!s.dayCycle.isDay:a,windMotion:o,windField:ml(0,o),...s};if(c.dayCycleTimes&&eu(c,c.liveClock?Date.now():c.sceneTimeMs),typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return tu(c,!1),()=>void 0;let l=0,u=document.hidden,d=b(e=>{u=e}),f=()=>{l=requestAnimationFrame(f),!u&&tu(c,!0)};return f(),()=>{cancelAnimationFrame(l),d()}}var ru={weatherBackground:`cos-weatherBackground-Mnm22`,canvas:`cos-canvas-nvqMt`,loadingOverlay:`cos-loadingOverlay-O58B7`,loadingSpinner:`cos-loadingSpinner-NQ9yG`,"weather-loading-spin":`cos-weather-loading-spin-IPFWZ`},iu=({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,ariaLabel:_,loadingText:v=`天气加载中…`})=>{let y=(0,c.useRef)(null),b=al(i,a!=null&&o!=null?{latitude:a,longitude:o}:void 0),x=kc(i&&b.weather?b.weather:n),S=i&&b.rainLevel!=null?b.rainLevel:u,C=i&&b.snowLevel!=null?b.snowLevel:d,w=i&&b.fogLevel!=null?b.fogLevel:p,T=i&&b.hailLevel!=null?b.hailLevel:f,E=i&&b.smogLevel!=null?b.smogLevel:m,D=Lc(x,S,C),O=Ws(r),k=b.current?.sunrise??null,A=b.current?.sunset??null,j=b.current?.windSpeed??null,M=(0,c.useMemo)(()=>i&&k!=null&&A!=null?{sunrise:k,sunset:A}:Hs(O),[i,k,A,O]),N=yl({live:i,windLevel:s,liveWindKmh:j}),P=(0,c.useMemo)(()=>vl(N),[N]),F=i&&b.current?!b.current.isDay:!Gs(O,M).isDay,I=g||i&&(b.status===`locating`||b.status===`fetching`),L=(0,c.useRef)(h);return(0,c.useEffect)(()=>{L.current=h}),(0,c.useEffect)(()=>{b.weather&&L.current?.(kc(b.weather))},[b.weather]),(0,c.useEffect)(()=>{let n=y.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),nu({ctx:a,width:e,height:t,activeWeather:D,activeNight:F,dayCycleTimes:M,sceneTimeMs:O,liveClock:i,windMotion:P,rainLevel:S,snowLevel:C,fogLevel:w,hailLevel:T,smogLevel:E})},[F,D,M,S,C,w,T,E,t,i,O,e,P]),(0,l.jsxs)(`div`,{className:ru.weatherBackground,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:y,className:ru.canvas,style:{width:e,height:t},role:`img`,"aria-label":_??`天气背景:${x}${F?`(夜间)`:``},${P.level}级风`}),I&&(0,l.jsxs)(`div`,{className:ru.loadingOverlay,role:`status`,"aria-live":`polite`,children:[(0,l.jsx)(`div`,{className:ru.loadingSpinner,"aria-hidden":!0}),(0,l.jsx)(`span`,{children:v})]})]})},au={waveText:`cos-waveText-Zy2Tp`,text:`cos-text-el-KR`,char:`cos-char-Y9-mV`,wave:`cos-wave-jVRCz`},ou=({text:e=`WAVE`,amplitude:t=12,color:n=`#38bdf8`,fontSize:r=56})=>(0,l.jsx)(`div`,{className:au.waveText,children:(0,l.jsx)(`h1`,{className:au.text,style:{fontSize:r,"--wave-color":n,"--wave-amp":`${t}px`},children:e.split(``).map((e,t)=>(0,l.jsx)(`span`,{className:au.char,style:{animationDelay:`${t*.1}s`},children:e===` `?`\xA0`:e},`${e}-${t}`))})});exports.AudioVisualizer=C,exports.Aurora=y,exports.BarcodeScan=f,exports.BlurText=m,exports.BubbleField=so,exports.BurnAway=g,exports.CanvasClock=T,exports.Charge=k,exports.CircularText=j,exports.ClickSpark=N,exports.Confetti=R,exports.CountUp=ne,exports.Countdown=J,exports.CursorTrail=ce,exports.CurvedLoop=B,exports.CyberGrid=H,exports.DEFAULT_FOG_LEVEL=ec,exports.DEFAULT_HAIL_LEVEL=lc,exports.DEFAULT_RAIN_LEVEL=vc,exports.DEFAULT_SMOG_LEVEL=Hc,exports.DEFAULT_SNOW_LEVEL=yc,exports.DEFAULT_WIND_LEVEL=cl,exports.DiceRoll=de,exports.DnaHelix=re,exports.DoublePendulum=pe,exports.ElectricArc=oe,exports.FOG_LEVEL_LABELS=tc,exports.Fireworks=be,exports.FlipCounter=we,exports.FuzzyText=Ee,exports.GameOfLife=Pe,exports.GlitchText=Ie,exports.GradientFlow=ke,exports.GravityBalls=ze,exports.HAIL_LEVEL_LABELS=uc,exports.HolographicCard=Ve,exports.LiquidGlass=qe,exports.LiquidProgress=Ue,exports.LorenzAttractor=Ge,exports.MAX_PRECIP_LEVEL=_c,exports.MIN_PRECIP_LEVEL=gc,exports.MagneticButton=Ye,exports.MatrixRain=Qe,exports.MazeGenerator=nt,exports.MetaballPool=et,exports.MeteorRain=it,exports.NeonText=mt,exports.NetworkGraph=ft,exports.NewtonCradle=gt,exports.OrbitalChart=yt,exports.ParticleNetwork=xt,exports.PhotoAlbum=Lt,exports.PhotoCarousel=Ht,exports.PhotoClothesline=hn,exports.PhotoFilmstrip=Tn,exports.PhotoFridge=Bn,exports.PhotoLantern=wr,exports.PhotoLightbox=jr,exports.PhotoPolaroid=Wr,exports.PhotoPostcard=$r,exports.PhotoPrism=vi,exports.PhotoScroll=Oi,exports.PhotoTunnel=zi,exports.PhotoViewMaster=na,exports.PlasmaBall=ia,exports.ProgressChest=_o,exports.RAIN_LEVEL_LABELS=Dc,exports.RadarScan=yo,exports.RedPacketRain=xo,exports.ReturnCity=Co,exports.RippleWater=Go,exports.RopeChain=To,exports.RotatingText=ko,exports.SMOG_LEVEL_LABELS=Uc,exports.SNOW_LEVEL_LABELS=Oc,exports.SandFall=ss,exports.ScrambleText=Jo,exports.ScratchCard=Xo,exports.ShinyText=Po,exports.SlotMachine=rs,exports.SmokeFog=Ca,exports.Snowfall=po,exports.SolarSystem=uo,exports.Speedometer=Mo,exports.SplitReveal=us,exports.SplitText=fs,exports.Spotlight=_s,exports.SpringMass=hs,exports.Starfield=ho,exports.TextMorph=Es,exports.TimelinePulse=Io,exports.TrueFocus=Os,exports.Turntable=Ss,exports.Typewriter=Ms,exports.WaveButton=Ps,exports.WaveText=ou,exports.WeatherBackground=iu,exports.buildWindMotion=vl,exports.clampFogLevel=nc,exports.clampHailLevel=dc,exports.clampPrecipLevel=bc,exports.clampSmogLevel=Wc,exports.fogBankAlphaScale=oc,exports.fogLevelFromVisibility=cc,exports.fogLevelFromWmo=sc,exports.formatFogLevel=rc,exports.formatHailLevel=fc,exports.formatLocalHm=il,exports.formatPrecipLevel=Ec,exports.formatSmogLevel=Gc,exports.hailLevelFromWmo=hc,exports.hailSpec=mc,exports.intensifyFogConfig=ac,exports.intensifyRainConfig=Rc,exports.intensifySmogConfig=qc,exports.intensifySnowCount=zc,exports.isRainWeather=Ac,exports.isSnowWeather=jc,exports.kmhToWindLevel=_l,exports.mapWmoCodeToWeatherType=Zc,exports.normalizeWeatherType=kc,exports.precipBand=Sc,exports.precipLabel=Tc,exports.rainLevelFromWeather=Pc,exports.rainLevelFromWmo=Bc,exports.resolveSceneWeather=Lc,exports.sampleWindField=ml,exports.smogBankAlphaScale=Jc,exports.smogLevelFromVisibility=Yc,exports.snowLevelFromWeather=Fc,exports.snowLevelFromWmo=Vc,exports.supportsFogLevel=ic,exports.supportsHailLevel=pc,exports.supportsRainLevel=Mc,exports.supportsSmogLevel=Kc,exports.supportsSnowLevel=Nc,exports.useLiveWeather=al,exports.useSunTimes=sl,exports.visualWindLevel=ul,exports.windLevelToKmh=gl,exports.windStreakSpec=hl;
|