own-the-canvas 2.0.0 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/CHANGELOG.md +33 -1
  2. package/README.md +34 -17
  3. package/lib/components/AuroraBorealis/AuroraBorealis.d.ts +5 -3
  4. package/lib/components/AuroraBorealis/useAuroraBorealis.d.ts +14 -3
  5. package/lib/components/ButterflySwarm/useButterflySwarm.d.ts +7 -0
  6. package/lib/components/Candle/Candle.d.ts +35 -0
  7. package/lib/components/Candle/index.d.ts +2 -0
  8. package/lib/components/Candle/useCandle.d.ts +18 -0
  9. package/lib/components/Cat/Cat.d.ts +42 -0
  10. package/lib/components/Cat/index.d.ts +2 -0
  11. package/lib/components/Cat/useCat.d.ts +22 -0
  12. package/lib/components/Eye/Eye.d.ts +46 -0
  13. package/lib/components/Eye/index.d.ts +3 -0
  14. package/lib/components/Eye/useEye.d.ts +29 -0
  15. package/lib/components/Fireworks/Fireworks.d.ts +2 -0
  16. package/lib/components/Fireworks/useFireworks.d.ts +1 -0
  17. package/lib/components/FluidSimulation/useFluidSimulation.d.ts +9 -3
  18. package/lib/components/GameOfLife/GameOfLife.d.ts +2 -2
  19. package/lib/components/GameOfLife/useGameOfLife.d.ts +10 -1
  20. package/lib/components/Hummingbird/Hummingbird.d.ts +43 -0
  21. package/lib/components/Hummingbird/index.d.ts +2 -0
  22. package/lib/components/Hummingbird/useHummingbird.d.ts +35 -0
  23. package/lib/components/Jellyfish/Jellyfish.d.ts +37 -0
  24. package/lib/components/Jellyfish/index.d.ts +2 -0
  25. package/lib/components/Jellyfish/useJellyfish.d.ts +20 -0
  26. package/lib/components/KoiPond/KoiPond.d.ts +2 -2
  27. package/lib/components/KoiPond/useKoiPond.d.ts +10 -3
  28. package/lib/components/Komorebi/Komorebi.d.ts +34 -0
  29. package/lib/components/Komorebi/index.d.ts +2 -0
  30. package/lib/components/Komorebi/useKomorebi.d.ts +22 -0
  31. package/lib/components/Lightning/Lightning.d.ts +1 -1
  32. package/lib/components/Lightning/useLightning.d.ts +7 -0
  33. package/lib/components/Octopus/Octopus.d.ts +44 -0
  34. package/lib/components/Octopus/index.d.ts +2 -0
  35. package/lib/components/Octopus/useOctopus.d.ts +35 -0
  36. package/lib/components/Owl/Owl.d.ts +48 -0
  37. package/lib/components/Owl/index.d.ts +2 -0
  38. package/lib/components/Owl/useOwl.d.ts +29 -0
  39. package/lib/components/Rain/Rain.d.ts +2 -0
  40. package/lib/components/Rain/useRain.d.ts +1 -0
  41. package/lib/components/ReactionDiffusion/ReactionDiffusion.d.ts +1 -1
  42. package/lib/components/ReactionDiffusion/useReactionDiffusion.d.ts +9 -3
  43. package/lib/components/Snail/Snail.d.ts +38 -0
  44. package/lib/components/Snail/index.d.ts +2 -0
  45. package/lib/components/Snail/useSnail.d.ts +21 -0
  46. package/lib/components/SpiderWeb/SpiderWeb.d.ts +4 -0
  47. package/lib/components/SpiderWeb/useSpiderWeb.d.ts +3 -0
  48. package/lib/components/Starfield/useStarfield.d.ts +10 -3
  49. package/lib/components/Sunflowers/Sunflowers.d.ts +36 -0
  50. package/lib/components/Sunflowers/index.d.ts +2 -0
  51. package/lib/components/Sunflowers/useSunflowers.d.ts +23 -0
  52. package/lib/components/TidePool/TidePool.d.ts +32 -0
  53. package/lib/components/TidePool/index.d.ts +2 -0
  54. package/lib/components/TidePool/useTidePool.d.ts +21 -0
  55. package/lib/components/WaveInterference/WaveInterference.d.ts +2 -0
  56. package/lib/components/WaveInterference/useWaveInterference.d.ts +20 -3
  57. package/lib/index.cjs.js +1 -1
  58. package/lib/index.d.ts +22 -6
  59. package/lib/index.es.js +11154 -9467
  60. package/lib/runtime/caustics.d.ts +16 -0
  61. package/package.json +2 -2
  62. package/lib/components/DeepSeaBioluminescence/DeepSeaBioluminescence.d.ts +0 -29
  63. package/lib/components/DeepSeaBioluminescence/index.d.ts +0 -2
  64. package/lib/components/DeepSeaBioluminescence/useDeepSeaBioluminescence.d.ts +0 -18
  65. package/lib/components/FrostGlass/FrostGlass.d.ts +0 -33
  66. package/lib/components/FrostGlass/index.d.ts +0 -2
  67. package/lib/components/FrostGlass/useFrostGlass.d.ts +0 -38
  68. package/lib/components/LSystem/LSystem.d.ts +0 -33
  69. package/lib/components/LSystem/index.d.ts +0 -2
  70. package/lib/components/LSystem/useLSystem.d.ts +0 -23
package/lib/index.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ct=require("react/jsx-runtime"),G=require("react"),Un=require("react-dom"),_n="アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲンァィゥェォッャュョ",Ue="ABCDEFGHIJKLMNOPQRSTUVWXYZ",Vn="01";function Kn(e){return e==="katakana"?_n:e==="latin"?Ue:e==="binary"?Vn:e||Ue}function Jn(e,d){const o=G.useRef(d);o.current=d;const g=G.useRef([]),y=G.useRef(0);G.useEffect(()=>{const t=e.current;if(!t)return;const c=t.parentElement;if(!c)return;const C=t.getContext("2d");let a=0,r=0;function i(h,x){const E=window.devicePixelRatio||1;a=h,r=x,t.width=Math.round(a*E),t.height=Math.round(r*E),t.style.width=`${a}px`,t.style.height=`${r}px`,C.scale(E,E);const{fontSize:L}=o.current,F=Math.floor(a/L);g.current=Array.from({length:F},()=>Math.floor(Math.random()*-(r/L)))}const n=new ResizeObserver(h=>{const{width:x,height:E}=h[0].contentRect;x>0&&E>0&&i(x,E)});n.observe(c);const s=c.getBoundingClientRect();s.width>0&&s.height>0&&i(s.width,s.height);let l=0,m=0;function I(){const{color:h,backgroundColor:x,fontSize:E,charset:L,resetThreshold:F}=o.current,B=L;C.fillStyle=x,C.fillRect(0,0,a,r),C.fillStyle=h,C.font=`${E}px monospace`;const j=g.current;for(let H=0;H<j.length;H++){const O=B[Math.floor(Math.random()*B.length)];C.fillText(O,H*E,j[H]*E),j[H]++,j[H]*E>r&&Math.random()>F&&(j[H]=0)}}function M(h){const x=l?h-l:0;l=h,m+=x;const{speed:E}=o.current;m>=E&&(m=m%E,I()),y.current=requestAnimationFrame(M)}return y.current=requestAnimationFrame(M),()=>{n.disconnect(),cancelAnimationFrame(y.current)}},[e])}const Qn={default:{color:"#00ff41"},monochrome:{},cyberpunk:{color:"#bf5fff",backgroundColor:"rgba(5,0,20,0.12)"},binary:{charset:"binary",color:"#00cfff",fontSize:12,speed:50},minimal:{color:"#4ade80",backgroundColor:"rgba(0,0,0,0.08)",speed:40},blood:{color:"#dc2626",backgroundColor:"rgba(10,0,0,0.1)",charset:"latin"}},So=G.forwardRef((e,d)=>{const{preset:o,color:g,backgroundColor:y,fontSize:t,speed:c,charset:C,resetThreshold:a,width:r,height:i,className:n,style:s}=e,l=Qn[o??"default"]||{},m=G.useRef(null);G.useImperativeHandle(d,()=>m.current);const I=Kn(C??l.charset??"latin");Jn(m,{color:g??l.color??"#ffffff",backgroundColor:y??l.backgroundColor??"rgba(17,17,17,0.1)",fontSize:t??l.fontSize??14,speed:c??l.speed??33,charset:I,resetThreshold:a??l.resetThreshold??.95});const M={width:r??"100%",height:i??"100%",display:"block",overflow:"hidden",...s};return ct.jsx("div",{style:M,className:n,children:ct.jsx("canvas",{ref:m,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});So.displayName="MatrixRain";const te=new Map;function ne(e){if(te.has(e))return te.get(e);let d=e.trim();d.startsWith("#")&&(d=d.slice(1));let o,g,y;if(d.length===3)o=parseInt(d[0]+d[0],16),g=parseInt(d[1]+d[1],16),y=parseInt(d[2]+d[2],16);else if(d.length===6)o=parseInt(d.slice(0,2),16),g=parseInt(d.slice(2,4),16),y=parseInt(d.slice(4,6),16);else return te.set(e,null),null;if(isNaN(o)||isNaN(g)||isNaN(y))return te.set(e,null),null;const t=[o,g,y];return te.set(e,t),t}function ut(e,d=1){const o=ne(e);return o?`rgba(${o[0]},${o[1]},${o[2]},${d})`:`rgba(255,255,255,${d})`}function mt(e){const d=ne(e);return d?`${d[0]},${d[1]},${d[2]}`:"255,255,255"}function Zn(e,d,o){return[e[0]+(d[0]-e[0])*o,e[1]+(d[1]-e[1])*o,e[2]+(d[2]-e[2])*o]}function bt(e,d){const o=Math.max(0,Math.min(1,d));if(e.length===0)return[255,255,255];if(e.length===1)return ne(e[0])??[255,255,255];const g=o*(e.length-1),y=Math.min(Math.floor(g),e.length-2),t=g-y,c=ne(e[y])??[255,255,255],C=ne(e[y+1])??[255,255,255];return Zn(c,C,t)}const tr=16;function Rt(){const e=G.useRef({cx:0,cy:0,over:!1,down:!1,taps:[]});return G.useEffect(()=>{const d=e.current,o=C=>{d.cx=C.clientX,d.cy=C.clientY,d.over=!0},g=C=>{o(C),d.down=!0,d.taps.length<tr&&d.taps.push({cx:C.clientX,cy:C.clientY})},y=()=>{d.down=!1},t=C=>{C.relatedTarget||(d.over=!1,d.down=!1)},c=()=>{d.over=!1,d.down=!1};return window.addEventListener("pointermove",o,{passive:!0}),window.addEventListener("pointerdown",g,{passive:!0}),window.addEventListener("pointerup",y,{passive:!0}),window.addEventListener("pointerout",t,{passive:!0}),window.addEventListener("blur",c),()=>{window.removeEventListener("pointermove",o),window.removeEventListener("pointerdown",g),window.removeEventListener("pointerup",y),window.removeEventListener("pointerout",t),window.removeEventListener("blur",c)}},[]),e}function It(e,d){const o=d.getBoundingClientRect(),g=e.clientX-o.left,y=e.clientY-o.top;return g>=0&&y>=0&&g<=o.width&&y<=o.height?{x:g,y}:null}function kt(e,d){if(!d)return e.taps.length=0,{x:-9999,y:-9999,inside:!1,down:!1,taps:[]};const o=d.getBoundingClientRect(),g=(C,a)=>C>=0&&a>=0&&C<=o.width&&a<=o.height,y=e.cx-o.left,t=e.cy-o.top,c=[];for(const C of e.taps){const a=C.cx-o.left,r=C.cy-o.top;g(a,r)&&c.push({x:a,y:r})}return e.taps.length=0,{x:y,y:t,inside:e.over&&g(y,t),down:e.down,taps:c}}function Xt(){let e=0,d=0,o=!1;return(g,y)=>{if(!g.inside)return o=!1,{vx:0,vy:0};const t=o?(g.x-e)/Math.max(y,.01):0,c=o?(g.y-d)/Math.max(y,.01):0;return e=g.x,d=g.y,o=!0,{vx:t,vy:c}}}function Pt(e,d=64){if(typeof document>"u")return null;const o=document.createElement("canvas");o.width=o.height=d;const g=o.getContext("2d");if(!g||typeof g.createRadialGradient!="function")return null;const y=d/2,t=g.createRadialGradient(y,y,0,y,y,y);return t.addColorStop(0,ut(e,1)),t.addColorStop(.18,ut(e,.75)),t.addColorStop(.45,ut(e,.18)),t.addColorStop(1,ut(e,0)),g.fillStyle=t,g.fillRect(0,0,d,d),o}function er(){var e;return typeof window<"u"&&typeof window.matchMedia=="function"&&!!((e=window.matchMedia("(prefers-reduced-motion: reduce)"))!=null&&e.matches)}function le(e,d,o){const g=e.split(",").map(Number),y=d.split(",").map(Number);return g.length<3||y.length<3?e:g.slice(0,3).map((t,c)=>Math.round(t+(y[c]-t)*o)).join(",")}function or(e,d){const o=G.useRef([]),g=G.useRef(null),y=G.useRef(null),t=G.useRef(d);t.current=d;const c=G.useRef(0),C=G.useRef(""),a=G.useRef(""),r=G.useRef(""),i=G.useRef(""),n=G.useRef(null),s=G.useRef({sprite:null,color:""}).current;G.useEffect(()=>{var l;(l=n.current)==null||l.call(n)},[d.particleCount,d.particleSize]),G.useEffect(()=>{const l=e.current;if(!l)return;const m=l,I=m.parentElement;if(!I)return;const M=m.getContext("2d");let h=0,x=0,E=t.current.velocityMultiplier;function L(R,v){const{particleCount:A,particleSize:p,speed:f,velocityMultiplier:b,twinkle:z}=t.current;E=b,o.current=Array.from({length:A},()=>({x:Math.random()*R,y:Math.random()*v,vx:(Math.random()-.5)*f*b,vy:(Math.random()-.5)*f*b,size:Math.random()*p+p*.4,opacity:Math.random()*.5+.5,tint:Math.random()<.7?Math.random()*.25:.5+Math.random()*.5,twinklePhase:z?Math.random()*Math.PI*2:void 0}))}function F(R,v){const A=window.devicePixelRatio||1;m.width=Math.round(R*A),m.height=Math.round(v*A),m.style.width=`${R}px`,m.style.height=`${v}px`,M.scale(A,A),h=R,x=v,L(R,v)}n.current=()=>{h>0&&x>0&&L(h,x)};const B=new ResizeObserver(R=>{const{width:v,height:A}=R[0].contentRect;v>0&&A>0&&F(v,A)});B.observe(I);const j=I.getBoundingClientRect();j.width>0&&j.height>0&&F(j.width,j.height);function H(R){const v=m.getBoundingClientRect();return{x:R.clientX-v.left,y:R.clientY-v.top}}function O(R){if(!t.current.dragParticles)return;const{x:v,y:A}=H(R),p=o.current,{dragRadius:f}=t.current;let b=-1,z=f;for(let w=0;w<p.length;w++){const D=p[w].x-v,W=p[w].y-A,k=Math.sqrt(D*D+W*W);k<z&&(z=k,b=w)}b!==-1&&(y.current={particleIndex:b,offsetX:p[b].x-v,offsetY:p[b].y-A})}function T(R){const v=It(R,m);if(!v)return u();const{x:A,y:p}=v;if(y.current){const f=o.current[y.current.particleIndex];f.x=A+y.current.offsetX,f.y=p+y.current.offsetY,f.vx=0,f.vy=0}t.current.interactive&&(g.current={x:A,y:p})}function $(){y.current=null}function u(){g.current=null,y.current=null}m.addEventListener("mousedown",O),window.addEventListener("mousemove",T),m.addEventListener("mouseup",$),document.addEventListener("mouseleave",u);function S(){const{particleColor:R,lineColor:v,lineDistance:A,connectParticles:p,backgroundColor:f,speed:b,repelRadius:z,repelStrength:w,friction:D,maxVelocityMultiplier:W,lineWidth:k,lineOpacity:q,wrapEdges:P,twinkle:N,twinkleSpeed:U,twinkleAmplitude:Y,glowParticles:X,glowBlur:_,lineStyle:V,interactive:Q}=t.current;R!==r.current&&(C.current=mt(R),r.current=R),v!==i.current&&(a.current=mt(v),i.current=v);const ot=o.current,tt=g.current,at=C.current,K=a.current;if(M.clearRect(0,0,h,x),f&&f!=="transparent"){const st=mt(f),rt=M.createRadialGradient(h/2,x/2,0,h/2,x/2,Math.hypot(h,x)/2);rt.addColorStop(0,`rgb(${le(st,K,.1)})`),rt.addColorStop(1,`rgb(${st})`),M.fillStyle=rt,M.fillRect(0,0,h,x)}const J=t.current.velocityMultiplier;if(J!==E){const st=E?J/E:1;if(Number.isFinite(st))for(const rt of ot)rt.vx*=st,rt.vy*=st;E=J}for(let st=0;st<ot.length;st++){const rt=ot[st];if(y.current&&y.current.particleIndex===st)continue;if(tt){const et=rt.x-tt.x,it=rt.y-tt.y,ft=Math.sqrt(et*et+it*it);if(ft<z&&ft>0){const dt=(z-ft)/z*2;rt.vx+=et/ft*dt*w,rt.vy+=it/ft*dt*w}}rt.vx*=D,rt.vy*=D;const lt=b*W,Z=Math.sqrt(rt.vx*rt.vx+rt.vy*rt.vy);Z>lt&&(rt.vx=rt.vx/Z*lt,rt.vy=rt.vy/Z*lt),rt.x+=rt.vx,rt.y+=rt.vy,P?(rt.x<0?rt.x+=h:rt.x>h&&(rt.x-=h),rt.y<0?rt.y+=x:rt.y>x&&(rt.y-=x)):(rt.x<0&&(rt.x=0,rt.vx*=-1),rt.x>h&&(rt.x=h,rt.vx*=-1),rt.y<0&&(rt.y=0,rt.vy*=-1),rt.y>x&&(rt.y=x,rt.vy*=-1)),N&&(rt.twinklePhase===void 0&&(rt.twinklePhase=Math.random()*Math.PI*2),rt.twinklePhase+=U)}if(p){V==="dashed"?M.setLineDash([4,6]):M.setLineDash([]);for(let st=0;st<ot.length;st++)for(let rt=st+1;rt<ot.length;rt++){const lt=ot[st].x-ot[rt].x,Z=ot[st].y-ot[rt].y,et=Math.sqrt(lt*lt+Z*Z);if(et<A){const it=1-et/A;M.beginPath(),M.moveTo(ot[st].x,ot[st].y),M.lineTo(ot[rt].x,ot[rt].y),M.strokeStyle=`rgba(${le(K,at,it*.6)},${it*it*q*1.2})`,M.lineWidth=k*(.6+it*.9),M.stroke()}}if(tt&&Q)for(const st of ot){const rt=Math.hypot(st.x-tt.x,st.y-tt.y);if(rt<A*1.3){const lt=1-rt/(A*1.3);M.beginPath(),M.moveTo(tt.x,tt.y),M.lineTo(st.x,st.y),M.strokeStyle=`rgba(${at},${lt*q})`,M.lineWidth=k*(.6+lt),M.stroke()}}M.setLineDash([])}(!s.sprite||s.color!==R)&&(s.sprite=Pt(R.startsWith("#")?R:"#ffffff",64),s.color=R);const nt=Math.max(.01,t.current.particleSize*1.4);for(let st=0;st<ot.length;st++){const rt=ot[st],lt=N&&rt.twinklePhase!==void 0?1-Y+Y*Math.sin(rt.twinklePhase):rt.opacity,Z=Math.min(1,rt.size/nt),et=le(at,K,rt.tint??0);if(s.sprite){const it=rt.size*(X?5+_/6:5)*(.6+Z*.6);M.globalCompositeOperation="lighter",M.globalAlpha=lt*(X?.75:.4)*(.5+Z*.5),M.drawImage(s.sprite,rt.x-it,rt.y-it,it*2,it*2),M.globalAlpha=1,M.globalCompositeOperation="source-over"}M.beginPath(),M.arc(rt.x,rt.y,rt.size*(.7+Z*.3),0,Math.PI*2),M.fillStyle=`rgba(${le(et,"255,255,255",.35*Z)},${lt})`,M.fill()}c.current=requestAnimationFrame(S)}return c.current=requestAnimationFrame(S),()=>{B.disconnect(),cancelAnimationFrame(c.current),m.removeEventListener("mousedown",O),window.removeEventListener("mousemove",T),m.removeEventListener("mouseup",$),document.removeEventListener("mouseleave",u)}},[e])}const nr={default:{particleColor:"#9be7ff",lineColor:"#4aa8c7",backgroundColor:"#040a18",twinkle:!0},monochrome:{},galaxy:{particleColor:"#8B5CF6",lineColor:"#8B5CF6",backgroundColor:"#030014",particleCount:80,lineDistance:130},snow:{particleColor:"#dbeafe",lineColor:"#dbeafe",connectParticles:!1,particleCount:160,speed:.3,backgroundColor:"transparent"},minimal:{connectParticles:!1,particleColor:"#4ade80",backgroundColor:"transparent",particleCount:60},ocean:{particleColor:"#67e8f9",lineColor:"#0891B2",backgroundColor:"#020f1a",particleCount:100,lineDistance:110,speed:.5},cosmos:{particleColor:"#e0e7ff",lineColor:"#6366f1",backgroundColor:"#030014",particleCount:80,lineDistance:120,speed:.3,wrapEdges:!0,twinkle:!0,glowParticles:!0,velocityMultiplier:.3},aurora:{particleColor:"#67e8f9",lineColor:"#0891B2",backgroundColor:"#020f1a",particleCount:80,lineDistance:110,speed:.3,wrapEdges:!0,twinkle:!0,glowParticles:!0,lineStyle:"dashed",velocityMultiplier:.3},gold:{particleColor:"#fbbf24",lineColor:"#d97706",backgroundColor:"#0c0800",particleCount:80,speed:.3,wrapEdges:!0,twinkle:!0,glowParticles:!0,lineOpacity:.4,velocityMultiplier:.3}},Po=G.forwardRef((e,d)=>{const{preset:o,particleCount:g,particleColor:y,lineColor:t,lineDistance:c,particleSize:C,speed:a,connectParticles:r,interactive:i,backgroundColor:n,repelRadius:s,repelStrength:l,friction:m,maxVelocityMultiplier:I,lineWidth:M,lineOpacity:h,wrapEdges:x,twinkle:E,twinkleSpeed:L,twinkleAmplitude:F,glowParticles:B,glowBlur:j,lineStyle:H,dragParticles:O,dragRadius:T,velocityMultiplier:$,width:u,height:S,className:R,style:v}=e,A=nr[o??"default"]||{},p=G.useRef(null);G.useImperativeHandle(d,()=>p.current),or(p,{particleCount:g??A.particleCount??120,particleColor:y??A.particleColor??"#ffffff",lineColor:t??A.lineColor??"#6b7280",lineDistance:c??A.lineDistance??120,particleSize:C??2.5,speed:a??A.speed??.8,connectParticles:r??A.connectParticles??!0,interactive:i??!0,backgroundColor:n??A.backgroundColor??"transparent",repelRadius:s??80,repelStrength:l??.3,friction:m??.99,maxVelocityMultiplier:I??3,lineWidth:M??.8,lineOpacity:h??A.lineOpacity??.6,wrapEdges:x??A.wrapEdges??!1,twinkle:E??A.twinkle??!1,twinkleSpeed:L??.03,twinkleAmplitude:F??.4,glowParticles:B??A.glowParticles??!1,glowBlur:j??15,lineStyle:H??A.lineStyle??"solid",dragParticles:O??!1,dragRadius:T??20,velocityMultiplier:$??A.velocityMultiplier??2});const f=O??!1;return ct.jsx("div",{className:R,style:{width:u??"100%",height:S??"100%",display:"block",overflow:"hidden",cursor:f?"grab":"default",...v},children:ct.jsx("canvas",{ref:p,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});Po.displayName="ParticleField";function rr(e,d){const o=G.useRef([]),g=G.useRef([]),y=G.useRef([]),t=G.useRef(d);t.current=d;const c=G.useRef(0),C=G.useRef(0),a=G.useRef(null);G.useEffect(()=>{var r;(r=a.current)==null||r.call(a)},[d.starCount]),G.useEffect(()=>{const r=e.current;if(!r)return;const i=r,n=i.parentElement;if(!n)return;const s=i.getContext("2d");let l=0,m=0;function I(F,B){const{starCount:j,starSizeMin:H,starSizeMax:O,starOpacityMin:T,starOpacityMax:$,twinkleSpeed:u}=t.current;o.current=Array.from({length:j},()=>{const S=Math.random()*F,R=Math.random()*B,v=Math.random(),A=Math.random(),p=Math.random()*Math.PI*2,f=Math.random();return{x:S,y:R,rs:v,ro:A,rt:f,twinklePhase:p,size:v*(O-H)+H,opacity:A*($-T)+T,twinkleSpeed:f*u+u*.3}})}function M(F,B){const{starCount:j}=t.current,H=Math.max(F,B);g.current=Array.from({length:j},()=>({x:(Math.random()-.5)*F*2,y:(Math.random()-.5)*B*2,z:Math.random()*H,pz:0}))}function h(F,B){const j=window.devicePixelRatio||1;i.width=Math.round(F*j),i.height=Math.round(B*j),i.style.width=`${F}px`,i.style.height=`${B}px`,s.scale(j,j),l=F,m=B,I(F,B),M(F,B)}a.current=()=>{l>0&&m>0&&(I(l,m),M(l,m))};const x=new ResizeObserver(F=>{const{width:B,height:j}=F[0].contentRect;B>0&&j>0&&h(B,j)});x.observe(n);const E=n.getBoundingClientRect();E.width>0&&E.height>0&&h(E.width,E.height);function L(F){const{starColor:B,shootingStarColor:j,backgroundColor:H,speed:O,twinkle:T,shootingStars:$,shootingStarInterval:u,perspective:S,shootingStarLength:R,shootingStarLifetime:v}=t.current;if(s.fillStyle=H,s.fillRect(0,0,l,m),S==="3D"){const A=l/2,p=m/2,f=Math.max(l,m),b=g.current;for(let z=0;z<b.length;z++){const w=b[z];w.pz=w.z,w.z-=O*4,w.z<=0&&(w.x=(Math.random()-.5)*l*2,w.y=(Math.random()-.5)*m*2,w.z=f,w.pz=w.z);const D=w.x/w.z*l+A,W=w.y/w.z*m+p,k=w.x/w.pz*l+A,q=w.y/w.pz*m+p,P=Math.max((1-w.z/f)*3,.1),N=1-w.z/f;s.beginPath(),s.moveTo(k,q),s.lineTo(D,W),s.strokeStyle=ut(B,N),s.lineWidth=P,s.stroke()}}else{const A=o.current,p=t.current;for(let f=0;f<A.length;f++){const b=A[f];b.size=b.rs*(p.starSizeMax-p.starSizeMin)+p.starSizeMin,b.opacity=b.ro*(p.starOpacityMax-p.starOpacityMin)+p.starOpacityMin,b.twinkleSpeed=b.rt*p.twinkleSpeed+p.twinkleSpeed*.3,b.y+=O*(b.size/2),b.y>m&&(b.y=0,b.x=Math.random()*l);let z=b.opacity;T&&(b.twinklePhase+=b.twinkleSpeed,z=b.opacity*(.5+.5*Math.sin(b.twinklePhase))),s.beginPath(),s.arc(b.x,b.y,b.size,0,Math.PI*2),s.fillStyle=ut(B,z),s.fill()}if($){if(F-C.current>u){C.current=F;const f=Math.random()*8+4,b=Math.random()*4+2;y.current.push({x:Math.random()*l*.7,y:Math.random()*m*.3,vx:f,vy:b,length:Math.random()*(R*.5)+R*.5,opacity:1,life:0,maxLife:v})}y.current=y.current.filter(f=>{if(f.x+=f.vx,f.y+=f.vy,f.life++,f.opacity=1-f.life/f.maxLife,f.opacity<=0)return!1;const b=f.length/Math.sqrt(f.vx*f.vx+f.vy*f.vy),z=s.createLinearGradient(f.x,f.y,f.x-f.vx*b,f.y-f.vy*b);return z.addColorStop(0,ut(j,f.opacity)),z.addColorStop(1,ut(j,0)),s.beginPath(),s.moveTo(f.x,f.y),s.lineTo(f.x-f.vx*b,f.y-f.vy*b),s.strokeStyle=z,s.lineWidth=2,s.stroke(),!0})}}c.current=requestAnimationFrame(L)}return c.current=requestAnimationFrame(L),()=>{x.disconnect(),cancelAnimationFrame(c.current)}},[e])}const ar={default:{starColor:"#c4b5fd",backgroundColor:"#0d0118"},monochrome:{},warp:{perspective:"3D",speed:2,starCount:300,shootingStars:!1,backgroundColor:"#000000"},peaceful:{perspective:"2D",speed:.2,twinkle:!0,shootingStars:!0,shootingStarInterval:2e3,backgroundColor:"#000818"},minimal:{starColor:"#94a3b8",backgroundColor:"#0f172a",twinkle:!1,shootingStars:!1,speed:.3},nebula:{starColor:"#c4b5fd",backgroundColor:"#0d0118",twinkle:!0,shootingStars:!0,starCount:250,speed:.4}},Eo=G.forwardRef((e,d)=>{const{preset:o,starCount:g,starColor:y,shootingStarColor:t,backgroundColor:c,speed:C,twinkle:a,shootingStars:r,shootingStarInterval:i,perspective:n,starSizeMin:s,starSizeMax:l,starOpacityMin:m,starOpacityMax:I,twinkleSpeed:M,shootingStarLength:h,shootingStarLifetime:x,width:E,height:L,className:F,style:B}=e,j=ar[o??"default"]||{},H=G.useRef(null);return G.useImperativeHandle(d,()=>H.current),rr(H,{starCount:g??j.starCount??200,starColor:y??j.starColor??"#ffffff",shootingStarColor:t??j.shootingStarColor??"#ffffff",backgroundColor:c??j.backgroundColor??"#111111",speed:C??j.speed??.5,twinkle:a??j.twinkle??!0,shootingStars:r??j.shootingStars??!0,shootingStarInterval:i??j.shootingStarInterval??3e3,perspective:n??j.perspective??"2D",starSizeMin:s??.3,starSizeMax:l??2.8,starOpacityMin:m??.3,starOpacityMax:I??1,twinkleSpeed:M??.03,shootingStarLength:h??80,shootingStarLifetime:x??60}),ct.jsx("div",{className:F,style:{width:E??"100%",height:L??"100%",display:"block",overflow:"hidden",...B},children:ct.jsx("canvas",{ref:H,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});Eo.displayName="Starfield";function _e(e,d){const o=Math.sin(e*127.1+d*311.7)*43758.5453;return o-Math.floor(o)}function ie(e,d,o){const g=Math.sin(e*127.1+d*311.7+o*74.7)*43758.5453;return g-Math.floor(g)}const Ge=e=>e*e*(3-2*e);function Ot(e,d=0){const o=Math.floor(e),g=Ge(e-o),y=_e(o,d);return y+(_e(o+1,d)-y)*g}function sr(e,d,o=0){const g=Math.floor(e),y=Math.floor(d),t=Ge(e-g),c=Ge(d-y),C=ie(g,y,o),a=ie(g+1,y,o),r=ie(g,y+1,o),i=ie(g+1,y+1,o),n=C+(a-C)*t,s=r+(i-r)*t;return n+(s-n)*c}function Ao(e,d=5,o=0,g=.5){let y=0,t=1,c=0,C=1;for(let a=0;a<d;a++)y+=Ot(e*C,o+a*17)*t,c+=t,t*=g,C*=2;return y/c}function Ft(e,d,o=4,g=0,y=.5){let t=0,c=1,C=0,a=1;for(let r=0;r<o;r++)t+=sr(e*a,d*a,g+r*17)*c,C+=c,c*=y,a*=2;return t/C}const Ve={inferno:["#1a0200","#7a0d02","#c92a06","#f26b0f","#ffb02e","#ffe28a","#fffbe8"],toxic:["#001a05","#06520f","#13a017","#58d61a","#c4f53a","#f2ffb0","#ffffff"],ice:["#000b1f","#032a66","#0b5fb8","#1fa8e6","#79e2ff","#d4f8ff","#ffffff"],plasma:["#12001f","#4a0570","#9c13a8","#e0388f","#ff7f8f","#ffd0c4","#ffffff"],smoke:["#0d0d0d","#2b2b2b","#555555","#808080","#b0b0b0","#dcdcdc","#ffffff"]};function lr(e){const d=new Uint32Array(256);for(let o=1;o<256;o++){const g=o/255,[y,t,c]=bt(e,g),C=Math.min(255,Math.round(Math.pow(g,.55)*255*1.35));d[o]=C<<24|Math.round(c)<<16|Math.round(t)<<8|Math.round(y)}return d}function ir(e,d){const o=G.useRef(d);o.current=d,G.useEffect(()=>{const g=e.current;if(!g)return;const y=g,t=y.parentElement;if(!t)return;const c=y.getContext("2d"),C=document.createElement("canvas"),a=C.getContext("2d"),r=document.createElement("canvas"),i=r.getContext("2d");let n=0,s=0,l=0,m=0,I=5,M=null,h=null,x=new Uint32Array(256),E="",L="255,200,120";const F=[];let B=NaN;function j(R,v){const A=Math.min(2,window.devicePixelRatio||1);y.width=Math.round(R*A),y.height=Math.round(v*A),y.style.width=`${R}px`,y.style.height=`${v}px`,c.setTransform(A,0,0,A,0,0),n=R,s=v,B=o.current.resolution;const p=Math.max(.2,Math.min(1,B));I=Math.max(3,Math.round(5/p),Math.ceil(Math.sqrt(R*v/16e3))),l=Math.max(2,Math.ceil(n/I)+1),m=Math.max(2,Math.ceil(s/I)+1),C.width=l,C.height=m,r.width=Math.max(1,Math.ceil(l/4)),r.height=Math.max(1,Math.ceil(m/4)),M=a.createImageData(l,m),h=new Uint32Array(M.data.buffer)}const H=new ResizeObserver(R=>{const{width:v,height:A}=R[0].contentRect;v>0&&A>0&&j(v,A)});H.observe(t);const O=t.getBoundingClientRect();O.width>0&&O.height>0&&j(O.width,O.height);let T=0,$=0,u=0;function S(R){T=requestAnimationFrame(S);const v=$?Math.min(.05,(R-$)/1e3):1/60;if($=R,u+=v,!M||!h||n===0)return;const A=o.current;A.resolution!==B&&j(n,s);const p=A.customColors&&A.customColors.length>=2?A.customColors:Ve[A.palette]??Ve.inferno,f=p.join(",");if(f!==E){E=f,x=lr(p);const[N,U,Y]=bt(p,.66);L=`${Math.round(N)},${Math.round(U)},${Math.round(Y)}`}const b=Math.max(-1,Math.min(1,A.windStrength*A.windDirection)),z=Math.max(0,Math.min(1,A.spread)),w=Math.min(.9,A.cooling*(A.coolingScale/3)),D=Math.max(.08,A.intensity)*(1-w*.85)*1.3,W=.8+Math.max(0,A.noiseStrength)/110,k=.0105*(1.35-z*.6),q=u*1.7;for(let N=0;N<m;N++){const U=N*I,Y=1-U/s,X=(Ot(u*.45+Y*1.8,3)-.5)*Y*34,_=b*Y*Y*s*.32,V=U*.0125+q,Q=N*l;for(let ot=0;ot<l;ot++){const tt=ot*I-_-X,at=.38+.62*Ao(tt*.0042+u*.12,3,5),K=D*at,J=Y/K;if(J>1.6){h[Q+ot]=0;continue}const nt=Ft(tt*k,V,3,1);let st=1-J+(nt-.5)*W*(.3+J)-Math.max(0,J-.85)*.9;Y<.035&&(st=Math.max(st,.88-Y*4)),st=st<0?0:st>1?1:st,h[Q+ot]=x[Math.pow(st,1.75)*255|0]}}a.putImageData(M,0,0),c.clearRect(0,0,n,s),c.imageSmoothingEnabled=!0,c.imageSmoothingQuality="high",c.drawImage(C,0,0,l*I,m*I),i.clearRect(0,0,r.width,r.height),i.imageSmoothingEnabled=!0,i.drawImage(C,0,0,r.width,r.height),c.globalCompositeOperation="lighter",c.globalAlpha=.36,c.drawImage(r,-I*2,-I*3,l*I+I*4,m*I+I*3),c.globalAlpha=1;const P=A.intensity*28*v;for(let N=0;(N<P||Math.random()<P-N)&&!(F.length>90);N++){const U=1.2+Math.random()*1.8;F.push({x:Math.random()*n,y:s*(1-Math.random()*D*.5),vx:b*30+(Math.random()-.5)*20,vy:-(45+Math.random()*85),life:U,max:U,size:1+Math.random()*1.6,seed:Math.random()*100})}for(let N=F.length-1;N>=0;N--){const U=F[N];if(U.life-=v,U.life<=0||U.y<-10){F.splice(N,1);continue}U.x+=(U.vx+(Ot(u*1.4+U.seed)-.5)*60)*v,U.y+=U.vy*v;const Y=Math.min(1,U.life/U.max*1.4)*(.65+.35*Math.sin(u*18+U.seed));c.fillStyle=`rgba(${L},${Y})`,c.beginPath(),c.arc(U.x,U.y,U.size,0,Math.PI*2),c.fill()}c.globalCompositeOperation="source-over"}return T=requestAnimationFrame(S),()=>{H.disconnect(),cancelAnimationFrame(T)}},[e])}const cr={default:{palette:"inferno"},monochrome:{palette:"smoke"},inferno:{palette:"inferno",intensity:.95,windStrength:.2,windDirection:1},toxic:{palette:"toxic",intensity:.9,cooling:.2,spread:.8,windStrength:.1},ice:{palette:"ice",intensity:.85,windStrength:.15,windDirection:-1,cooling:.35},plasma:{palette:"plasma",intensity:.92,spread:.75,windStrength:.05}},Io=G.forwardRef((e,d)=>{const{preset:o,palette:g,customColors:y,intensity:t,windStrength:c,windDirection:C,spread:a,cooling:r,noiseStrength:i,coolingScale:n,resolution:s,width:l,height:m,className:I,style:M}=e,h=cr[o??"default"]||{},x=G.useRef(null);return G.useImperativeHandle(d,()=>x.current),ir(x,{palette:g??h.palette??"smoke",customColors:y,intensity:t??h.intensity??.95,windStrength:c??h.windStrength??.3,windDirection:C??h.windDirection??1,spread:a??h.spread??0,cooling:r??h.cooling??.3,noiseStrength:i??60,coolingScale:n??3,resolution:s??1}),ct.jsx("div",{className:I,style:{width:l??"100%",height:m??"100%",display:"block",overflow:"hidden",...M},children:ct.jsx("canvas",{ref:x,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});Io.displayName="FireEffect";function fr(e,d){const o=G.useRef(d);o.current=d;const g=G.useRef([]),y=G.useRef(0),t=G.useRef(!1),c=G.useRef(!1),C=G.useRef(0),a=G.useRef(0);G.useEffect(()=>{const r=e.current;if(!r)return;const i=r,n=i.parentElement;if(!n)return;const s=i.getContext("2d");let l=0,m=0;function I(F,B){const j=window.devicePixelRatio||1;i.width=Math.round(F*j),i.height=Math.round(B*j),i.style.width=`${F}px`,i.style.height=`${B}px`,s.scale(j,j),l=F,m=B}const M=new ResizeObserver(F=>{const{width:B,height:j}=F[0].contentRect;B>0&&j>0&&I(B,j)});M.observe(n);const h=n.getBoundingClientRect();h.width>0&&h.height>0&&I(h.width,h.height);function x(F){const{spread:B,colors:j,shapes:H,duration:O,spawnX:T,spawnY:$,spawnSpread:u,speedMin:S,speedMax:R,sizeMin:v,sizeMax:A,angularVelocity:p}=o.current,f=l*T,b=m*$,z=Math.max(1,O/16.67);for(let w=0;w<F;w++){const D=(Math.random()*2-1)*B*Math.PI,W=Math.random()*(R-S)+S;g.current.push({x:f+(Math.random()-.5)*u,y:b,vx:Math.sin(D)*W,vy:-Math.cos(D)*W,angle:Math.random()*Math.PI*2,angularV:(Math.random()-.5)*p,color:j[Math.floor(Math.random()*j.length)],shape:H[Math.floor(Math.random()*H.length)],w:Math.random()*(A-v)+v,h:Math.random()*(A-v)*.75+v*.5,opacity:1,life:0,maxLife:z})}}function E(F){switch(s.save(),s.translate(F.x,F.y),s.rotate(F.angle),s.globalAlpha=F.opacity,s.fillStyle=F.color,F.shape){case"square":s.fillRect(-F.w/2,-F.h/2,F.w,F.h);break;case"circle":s.beginPath(),s.arc(0,0,F.w/2,0,Math.PI*2),s.fill();break;case"triangle":s.beginPath(),s.moveTo(0,-F.h/2),s.lineTo(F.w/2,F.h/2),s.lineTo(-F.w/2,F.h/2),s.closePath(),s.fill();break;case"strip":s.fillRect(-F.w,-F.h/4,F.w*2,F.h/2);break}s.restore()}function L(F){const B=C.current?Math.min(F-C.current,50):16.67;C.current=F;const{trigger:j,particleCount:H,gravity:O,continuous:T,wind:$,emissionRate:u,onComplete:S}=o.current;if(j&&!t.current&&(x(H),c.current=!1),t.current=j,T&&j){a.current+=u*B/1e3;const v=Math.floor(a.current);v>0&&(x(v),a.current-=v)}s.clearRect(0,0,l,m);const R=B/16.67;g.current=g.current.filter(v=>(v.vy+=O*.3*R,v.vx+=$*.05*R,v.x+=v.vx*R,v.y+=v.vy*R,v.angle+=v.angularV*R,v.life+=R,v.opacity=Math.max(0,1-v.life/v.maxLife),v.opacity<=0||v.y>m+50?!1:(E(v),!0))),s.globalAlpha=1,!c.current&&j&&!T&&g.current.length===0&&t.current&&(c.current=!0,S==null||S()),y.current=requestAnimationFrame(L)}return y.current=requestAnimationFrame(L),()=>{M.disconnect(),cancelAnimationFrame(y.current)}},[e])}const dr={monochrome:["#ffffff","#e5e7eb","#d1d5db","#9ca3af","#6b7280","#4b5563"],colorful:["#ff6b6b","#ffd93d","#6bcb77","#4d96ff","#ff6fc8","#ff9a3c","#c77dff"]},ur={default:{palette:"colorful"},monochrome:{palette:"monochrome"},celebration:{palette:"colorful",shapes:["square","circle","triangle","strip"],speedMax:20},pastel:{colors:["#fbb6ce","#fed7aa","#fef08a","#bbf7d0","#bae6fd","#ddd6fe","#fbcfe8"],shapes:["circle","square"],gravity:.3,wind:.2},gold:{colors:["#ffd700","#ffa500","#ffec47","#fff3b0","#e6ac00"],shapes:["square","circle","strip"],speedMax:18,gravity:.4}},hr=["square","circle","triangle","strip"],$o=G.forwardRef((e,d)=>{const{preset:o,palette:g,trigger:y=!1,particleCount:t,spread:c,gravity:C,colors:a,shapes:r,duration:i,continuous:n,wind:s,spawnX:l,spawnY:m,spawnSpread:I,speedMin:M,speedMax:h,sizeMin:x,sizeMax:E,angularVelocity:L,emissionRate:F,onComplete:B,width:j,height:H,className:O,style:T}=e,$=ur[o??"default"]||{},u=g??$.palette??"colorful",S=a??$.colors??dr[u],R=G.useRef(null);return G.useImperativeHandle(d,()=>R.current),fr(R,{trigger:y,particleCount:t??150,spread:c??.8,gravity:C??$.gravity??.5,colors:S,shapes:r??$.shapes??hr,duration:i??4e3,continuous:n??!1,wind:s??$.wind??.5,spawnX:l??.5,spawnY:m??.4,spawnSpread:I??60,speedMin:M??4,speedMax:h??$.speedMax??16,sizeMin:x??6,sizeMax:E??14,angularVelocity:L??.3,emissionRate:F??10,onComplete:B}),ct.jsx("div",{className:O,style:{width:j??"100%",height:H??"100%",display:"block",overflow:"hidden",pointerEvents:"none",...T},children:ct.jsx("canvas",{ref:R,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});$o.displayName="Confetti";function vt({canvasRef:e,overlay:d=!1,zIndex:o=10,width:g,height:y,className:t,style:c}){const[C,a]=G.useState(!1);return G.useEffect(()=>a(!0),[]),d?C?Un.createPortal(ct.jsx("canvas",{ref:e,"aria-hidden":"true",role:"presentation",className:t,style:{position:"fixed",inset:0,display:"block",pointerEvents:"none",zIndex:o,...c}}),document.body):null:ct.jsx("div",{className:t,style:{width:g??"100%",height:y??"100%",display:"block",overflow:"hidden",...c},children:ct.jsx("canvas",{ref:e,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})}const gr=22,mr=17,pr=2e3,yr=5e3,Ke=.25,Mr=.25;function br(){return{quality:1,avg:16.67,slowMs:0,fastMs:0}}function Cr(e,d){e.avg+=(d-e.avg)/60,e.avg>gr?(e.slowMs+=d,e.fastMs=0,e.slowMs>=pr&&(e.quality=Math.max(Mr,e.quality-Ke),e.slowMs=0)):e.avg<mr?(e.fastMs+=d,e.slowMs=0,e.fastMs>=yr&&(e.quality=Math.min(1,e.quality+Ke),e.fastMs=0)):(e.slowMs=0,e.fastMs=0)}function Xe(e,d,o,g,y){let t=null;for(const c of g){if(e.vy>0&&o<=c.y&&e.y>=c.y&&e.x>=c.x&&e.x<=c.x+c.w){(!t||c.y<t.y)&&(t=c);continue}if(e.y>c.y&&e.y<c.y+c.h){const C=d<c.x&&e.x>=c.x,a=d>c.x+c.w&&e.x<=c.x+c.w;(C||a)&&(e.x=C?c.x:c.x+c.w,e.vx=-e.vx)}}return t&&(e.y=t.y,e.vy=y>0?-e.vy*y:0),t}function re(e,d,o){return{solidId:d.id,offsetX:e.x-d.x,dy:o}}function ae(e,d,o){const g=o.get(d.solidId);return!g||d.offsetX<0||d.offsetX>g.w?!1:(e.x=g.x+d.offsetX,e.y=g.y+d.dy,!0)}const je="[data-otc-solid]",Vt=new Map;let Me=new WeakMap,Je=0,vr=1,se=!0,Kt=null,At=null;function Qt(){se=!0}function To(e){e.target!==document&&e.target!==window&&(se=!0)}function Qe(e){return e instanceof Element&&(e.matches(je)||e.querySelector(je)!==null)}function xr(e){for(const d of e){if(d.type==="attributes")return Qt();for(const o of Array.from(d.addedNodes))if(Qe(o))return Qt();for(const o of Array.from(d.removedNodes))if(Qe(o))return Qt()}}function zo(e){const d=e.el.getBoundingClientRect();e.px=d.left+window.scrollX,e.py=d.top+window.scrollY,e.w=d.width,e.h=d.height}function wr(){const e=new Set(Array.from(document.querySelectorAll(je)));for(const d of Array.from(Vt.keys()))e.has(d)||(Vt.delete(d),At==null||At.unobserve(d));for(const d of e){let o=Vt.get(d);o||(o={id:vr++,el:d,live:!1,px:0,py:0,w:0,h:0},Vt.set(d,o),At==null||At.observe(d)),o.live=d.getAttribute("data-otc-solid")==="live",zo(o)}Me=new WeakMap,se=!1}function Rr(){se=!0,Kt=new MutationObserver(xr),Kt.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["data-otc-solid"]}),typeof ResizeObserver<"u"&&(At=new ResizeObserver(Qt),At.observe(document.body)),window.addEventListener("resize",Qt),document.addEventListener("scroll",To,{capture:!0,passive:!0})}function kr(){Kt==null||Kt.disconnect(),At==null||At.disconnect(),Kt=null,At=null,window.removeEventListener("resize",Qt),document.removeEventListener("scroll",To,{capture:!0}),Vt.clear(),Me=new WeakMap}function Sr(){Je++===0&&Rr();let e=!1;return()=>{e||(e=!0,--Je===0&&kr())}}function Pr(e,d){se&&wr();let o,g;if(d)o=window.scrollX,g=window.scrollY;else{let t=Me.get(e);if(!t){const c=e.getBoundingClientRect();t={px:c.left+window.scrollX,py:c.top+window.scrollY},Me.set(e,t)}o=t.px,g=t.py}const y=[];for(const t of Vt.values())t.live&&zo(t),!(t.w===0||t.h===0)&&y.push({id:t.id,x:t.px-o,y:t.py-g,w:t.w,h:t.h});return y}const Er=[],Ar=64;function xt(e={}){const{noLoop:d=!1,overlay:o=!1,collide:g=!1,reducedMotion:y="static",maxDpr:t=2}=e,[c,C]=G.useState(null),a=G.useRef(e.onFrame),r=G.useRef(e.onResize);return a.current=e.onFrame,r.current=e.onResize,G.useEffect(()=>{var v;if(!c)return;const i=c.getContext("2d");if(!i)return;let n=0,s=0,l=0,m=0,I=!1,M=!1,h=document.hidden;const x=br(),E=y==="static"&&typeof window.matchMedia=="function"?window.matchMedia("(prefers-reduced-motion: reduce)"):null;let L=(E==null?void 0:E.matches)??!1;const F=g?Sr():null,B=A=>{var p;n===0||s===0||(o&&i.clearRect(0,0,n,s),(p=a.current)==null||p.call(a,i,n,s,A,{quality:x.quality,overlay:o,solids:g?Pr(c,o):Er}))},j=A=>{const p=m?Math.min(A-m,Ar):16;m=A,Cr(x,p),B(p),l=requestAnimationFrame(j)},H=()=>{const A=!d&&!M&&!h&&!L&&n>0;A&&!I?(I=!0,m=0,l=requestAnimationFrame(j)):!A&&I&&(I=!1,cancelAnimationFrame(l))},O=(A,p)=>{var b;if(A<=0||p<=0)return;const f=Math.min(window.devicePixelRatio||1,t);c.width=Math.round(A*f),c.height=Math.round(p*f),c.style.width=`${A}px`,c.style.height=`${p}px`,i.setTransform(f,0,0,f,0,0),n=A,s=p,(b=r.current)==null||b.call(r,n,s),L&&B(16),H()};let T=null;const $=()=>O(window.innerWidth,window.innerHeight);if(o)window.addEventListener("resize",$),$();else{const A=c.parentElement;if(A){T=new ResizeObserver(f=>{var z;const b=(z=f[0])==null?void 0:z.contentRect;b&&O(b.width,b.height)}),T.observe(A);const p=A.getBoundingClientRect();O(p.width,p.height)}}let u=null;typeof IntersectionObserver<"u"&&(u=new IntersectionObserver(A=>{const p=A[A.length-1];p&&(M=!p.isIntersecting,H())}),u.observe(c));const S=()=>{h=document.hidden,H()};document.addEventListener("visibilitychange",S);const R=()=>{L=(E==null?void 0:E.matches)??!1,L&&B(16),H()};return(v=E==null?void 0:E.addEventListener)==null||v.call(E,"change",R),H(),()=>{var A;I=!1,cancelAnimationFrame(l),T==null||T.disconnect(),u==null||u.disconnect(),window.removeEventListener("resize",$),document.removeEventListener("visibilitychange",S),(A=E==null?void 0:E.removeEventListener)==null||A.call(E,"change",R),F==null||F()}},[c,d,o,g,y,t]),{canvasRef:C,canvas:c}}function Ir(e,d,o,g,y,t){const c=Math.min(g,2),C=Ft(e+o*.6,d+o*.6*t,c,1,y),a=Ft(e+5.2-o*.4,d+1.3+o*.3,c,2,y),r=Ft(e+3.5*C+1.7+o*.25,d+3.5*a+9.2,c,3,y),i=Ft(e+3.5*C+8.3,d+3.5*a+2.8-o*.2*t,c,4,y),n=Ft(e+3*r,d+3*i,g,5,y),s=Math.min(1,Math.hypot(r-.5,i-.5)*2.2);return[n,s]}function $r(e){const d=G.useRef(e);d.current=e;const o=G.useRef({t:0,buf:null,staticKey:""}).current;function g(t,c,C){var s,l;const a=Math.max(16,Math.round(t*C)),r=Math.max(16,Math.round(c*C));if(o.buf&&o.buf.bw===a&&o.buf.bh===r)return o.buf;if(typeof document>"u")return null;const i=document.createElement("canvas");i.width=a,i.height=r;const n=(l=(s=i.getContext("2d"))==null?void 0:s.createImageData)==null?void 0:l.call(s,a,r);return n?(o.buf={c:i,img:n,bw:a,bh:r},o.staticKey="",o.buf):null}function y(t,c,C,a,r){var x;const i=d.current,n=i.colors.length>=2?i.colors:["#000000","#ffffff"],s=4e4*(r.quality<.75?.5:1),l=Math.min(Math.min(1,Math.max(.05,i.resolution)),Math.sqrt(s/Math.max(1,c*C))),m=g(c,C,l);if(!m)return;i.animated&&(o.t+=a*.001*i.speed);const I=`${i.animated}|${n.join()}|${i.scale}|${i.octaves}|${i.persistence}|${i.timeOffsetY}|${m.bw}x${m.bh}`;if(i.animated||I!==o.staticKey){o.staticKey=I;const E=o.t,L=1.6*Math.max(.1,i.scale)/Math.min(m.bw,m.bh),F=Math.max(1,Math.min(6,Math.round(i.octaves))),B=Math.min(.9,Math.max(.1,i.persistence)),j=Array.from({length:256},(O,T)=>bt(n,T/255)),H=m.img.data;for(let O=0;O<m.bh;O++)for(let T=0;T<m.bw;T++){const[$,u]=Ir(T*L,O*L,E,F,B,i.timeOffsetY),S=j[Math.max(0,Math.min(255,(($-.5)*1.9+.5)*255))|0],R=u*18,v=(Math.random()-.5)*3,A=(O*m.bw+T)*4;H[A]=S[0]+R+v,H[A+1]=S[1]+R+v,H[A+2]=S[2]+R+v,H[A+3]=255}(x=m.c.getContext("2d"))==null||x.putImageData(m.img,0,0)}const h=t.globalCompositeOperation;t.globalCompositeOperation=i.blendMode||"source-over",t.imageSmoothingEnabled=!0,t.imageSmoothingQuality="high",t.drawImage(m.c,0,0,c,C),t.globalCompositeOperation=h}return xt({onFrame:y})}const Tr={default:{colors:["#0d1117","#0d4f3c","#00ff87","#00cfff","#7C3AED"]},monochrome:{},aurora:{colors:["#0d1117","#0d4f3c","#00ff87","#00cfff","#7C3AED"],speed:.2,scale:.8,octaves:3},sunset:{colors:["#0a0010","#7C3AED","#dc2626","#f97316","#fbbf24"],speed:.15,scale:1.2,octaves:2},ocean:{colors:["#020f1a","#0891B2","#06b6d4","#67e8f9","#e0f2fe"],speed:.25,scale:.9,octaves:4},forest:{colors:["#0a1a0a","#166534","#15803d","#4ade80","#d1fae5"],speed:.2,scale:1.1,octaves:3},neon:{colors:["#050010","#7C3AED","#0891B2","#00ff87","#7C3AED"],speed:.4,scale:.7,octaves:3}},Fo=G.forwardRef((e,d)=>{const{preset:o,colors:g,speed:y,scale:t,octaves:c,animated:C,blendMode:a,timeOffsetY:r,persistence:i,resolution:n,width:s,height:l,className:m,style:I}=e,M=Tr[o??"default"]||{},{canvasRef:h,canvas:x}=$r({colors:g??M.colors??["#0a0a0a","#2d2d2d","#6b7280","#d1d5db","#f5f5f5"],speed:y??M.speed??.25,scale:t??M.scale??1,octaves:c??M.octaves??3,animated:C??!0,blendMode:a??"source-over",timeOffsetY:r??.5,persistence:i??.5,resolution:n??.25});return G.useImperativeHandle(d,()=>x,[x]),ct.jsx(vt,{canvasRef:h,width:s,height:l,className:m,style:I})});Fo.displayName="NoiseGradient";const Dt=new Uint8Array(512),Jt=new Uint8Array(256);for(let e=0;e<256;e++)Jt[e]=e;for(let e=255;e>0;e--){const d=Math.floor(Math.random()*(e+1));[Jt[e],Jt[d]]=[Jt[d],Jt[e]]}for(let e=0;e<512;e++)Dt[e]=Jt[e&255];function Ze(e){return e*e*e*(e*(e*6-15)+10)}function Ee(e,d,o){return e+o*(d-e)}function ce(e,d,o){const g=e&3,y=g<2?d:o,t=g<2?o:d;return(g&1?-y:y)+(g&2?-t:t)}function to(e,d){const o=Math.floor(e)&255,g=Math.floor(d)&255,y=e-Math.floor(e),t=d-Math.floor(d),c=Ze(y),C=Ze(t),a=Dt[Dt[o]+g],r=Dt[Dt[o]+g+1],i=Dt[Dt[o+1]+g],n=Dt[Dt[o+1]+g+1];return Ee(Ee(ce(a,y,t),ce(i,y-1,t),c),Ee(ce(r,y,t-1),ce(n,y-1,t-1),c),C)}function zr(e,d){const o=G.useRef(d);o.current=d;const g=G.useRef([]),y=G.useRef(0),t=G.useRef(0),c=G.useRef(null),C=G.useRef(null);G.useEffect(()=>{var a;(a=c.current)==null||a.call(c)},[d.particleCount]),G.useEffect(()=>{const a=e.current;if(!a)return;const r=a.parentElement;if(!r)return;const i=a.getContext("2d");let n=0,s=0;function l(){const{colors:F}=o.current;return{x:Math.random()*n,y:Math.random()*s,vx:0,vy:0,age:0,maxAge:Math.random()*120+60,color:F[Math.floor(Math.random()*F.length)]}}function m(){const{particleCount:F}=o.current;g.current=Array.from({length:F},l)}function I(F,B){const j=e.current,H=window.devicePixelRatio||1;j.width=Math.round(F*H),j.height=Math.round(B*H),j.style.width=`${F}px`,j.style.height=`${B}px`,i.scale(H,H),n=F,s=B,m()}c.current=()=>{n>0&&s>0&&m()};function M(F){const B=It(F,a);if(!B)return h();o.current.interactive&&(C.current=B)}function h(){C.current=null}window.addEventListener("mousemove",M),document.addEventListener("mouseleave",h);const x=new ResizeObserver(F=>{const{width:B,height:j}=F[0].contentRect;B>0&&j>0&&I(B,j)});x.observe(r);const E=r.getBoundingClientRect();E.width>0&&E.height>0&&I(E.width,E.height);function L(){if(!o.current.animated){y.current=requestAnimationFrame(L);return}const{speed:F,noiseScale:B,fadeStrength:j,lineWidth:H,backgroundColor:O,timeSpeed:T,curl:$,attractRadius:u,attractStrength:S}=o.current;t.current+=T*.001;const R=t.current;O&&O!=="transparent"?(i.fillStyle=O,i.globalAlpha=j,i.fillRect(0,0,n,s),i.globalAlpha=1):(i.fillStyle=`rgba(0,0,0,${j})`,i.fillRect(0,0,n,s));const v=g.current,A=C.current;for(let p=0;p<v.length;p++){const f=v[p],b=f.x*B,z=f.y*B,w=to(b+R,z+R*.7)*Math.PI*4;let D=Math.cos(w),W=Math.sin(w);if($){const N=to(b+100+R,z+R*.7);D+=-Math.sin(N*Math.PI*2)*.5,W+=Math.cos(N*Math.PI*2)*.5}const k=f.x,q=f.y;if(f.vx=f.vx*.9+D*F*.1,f.vy=f.vy*.9+W*F*.1,A){const N=A.x-f.x,U=A.y-f.y,Y=Math.sqrt(N*N+U*U);if(Y<u&&Y>0){const X=(u-Y)/u*S*.1;f.vx+=N/Y*X,f.vy+=U/Y*X}}f.x+=f.vx,f.y+=f.vy,f.age++;const P=Math.max(0,1-f.age/f.maxAge)*.7;i.beginPath(),i.moveTo(k,q),i.lineTo(f.x,f.y),i.strokeStyle=f.color,i.globalAlpha=P,i.lineWidth=H,i.stroke(),i.globalAlpha=1,(f.age>f.maxAge||f.x<0||f.x>n||f.y<0||f.y>s)&&(g.current[p]=l())}y.current=requestAnimationFrame(L)}return y.current=requestAnimationFrame(L),()=>{x.disconnect(),cancelAnimationFrame(y.current),window.removeEventListener("mousemove",M),document.removeEventListener("mouseleave",h)}},[e])}const Fr={default:{colors:["#0c4a6e","#0891B2","#06b6d4","#67e8f9","#e0f2fe"],backgroundColor:"#020f1a"},neon:{colors:["#7C3AED","#e0b0ff","#0891B2","#67e8f9"],backgroundColor:"#000000",speed:1.5,curl:!0},ocean:{colors:["#0c4a6e","#0891B2","#06b6d4","#67e8f9","#e0f2fe"],backgroundColor:"#020f1a",noiseScale:.003,speed:.8},lava:{colors:["#7f1d1d","#dc2626","#f97316","#fbbf24"],backgroundColor:"#0c0000",noiseScale:.004,speed:.6,curl:!1},forest:{colors:["#14532d","#15803d","#4ade80","#d9f99d"],backgroundColor:"#0a1a0a",speed:.7,curl:!0},monochrome:{colors:["#e2e8f0","#94a3b8","#475569"],backgroundColor:"#0f172a",speed:.8}},Lo=G.forwardRef((e,d)=>{const{preset:o,particleCount:g,colors:y,speed:t,noiseScale:c,trailLength:C,fadeStrength:a,lineWidth:r,backgroundColor:i,animated:n,timeSpeed:s,curl:l,interactive:m,attractRadius:I,attractStrength:M,width:h,height:x,className:E,style:L}=e,F=Fr[o??"default"]||{},B=G.useRef(null);return G.useImperativeHandle(d,()=>B.current),zr(B,{particleCount:g??F.particleCount??800,colors:y??F.colors??["#ffffff","#6b7280","#9ca3af"],speed:t??F.speed??1,noiseScale:c??F.noiseScale??.004,trailLength:C??.04,fadeStrength:a??C??.04,lineWidth:r??1,backgroundColor:i??F.backgroundColor??"#111111",animated:n??!0,timeSpeed:s??1,curl:l??F.curl??!1,interactive:m??!1,attractRadius:I??100,attractStrength:M??3}),ct.jsx("div",{className:E,style:{width:h??"100%",height:x??"100%",display:"block",overflow:"hidden",...L},children:ct.jsx("canvas",{ref:B,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});Lo.displayName="FlowField";const eo=1600,oo=["peony","chrysanthemum","willow","ring","palm","crossette","peony","chrysanthemum"],Ht=(e,d,o)=>{const g=e.split(",").map(Number),y=d.split(",").map(Number);return g.map((t,c)=>Math.round(t+(y[c]-t)*o)).join(",")},ee=e=>e.startsWith("#")?mt(e):"255,255,255";function Lr(e,d){const o=G.useRef(d);o.current=d;const g=G.useRef([]),y=G.useRef({w:0,h:0}),t=(c,C)=>{const{colors:a,shellSpeed:r}=o.current,{w:i,h:n}=y.current;if(!i||!n)return;const s=c??i*(.15+Math.random()*.7),l=C??n*(.12+Math.random()*.33),m=Math.max(20,o.current.gravity*3600*.3),I=Math.max(40,n-l),M=-Math.sqrt(2*m*I)*(.98+Math.random()*.04);g.current.push({x:s,y:n,vx:(Math.random()-.5)*30,vy:Math.min(M,-r*40),targetY:l,rgb:ee(a[Math.floor(Math.random()*a.length)]??"#ffffff"),kind:oo[Math.floor(Math.random()*oo.length)],trail:[]})};return G.useEffect(()=>{const c=e.current;if(!c)return;const C=c.parentElement;if(!C)return;const a=c.getContext("2d");let r=0,i=0,n=1,s=0,l=[],m=[],I=[],M=[],h=.6;const x=new Map;function E(v){let A=x.get(v);if(A)return A;A=document.createElement("canvas"),A.width=A.height=32;const p=A.getContext("2d");if(!p||typeof p.createRadialGradient!="function")return null;const f=p.createRadialGradient(16,16,0,16,16,16);return f.addColorStop(0,`rgba(${v},0.9)`),f.addColorStop(.25,`rgba(${v},0.35)`),f.addColorStop(1,`rgba(${v},0)`),p.fillStyle=f,p.fillRect(0,0,32,32),x.set(v,A),A}const L=()=>({x:Math.random()*r,y:Math.random()*i*.8,r:.3+Math.random()*1.1,opacity:.35+Math.random()*.6,isGlowing:Math.random()<.25,tw:Math.random()*6});function F(){const{starCount:v}=o.current;m=Array.from({length:v},L),M=[];let A=-10;for(;A<r+10;){const p=18+Math.random()*46,f=i*(.05+Math.random()*.13)*(Math.random()<.12?1.7:1),b=[];for(let z=6;z<f-6;z+=7)for(let w=4;w<p-4;w+=6)Math.random()<.18&&b.push([w,z]);M.push({x:A,w:p,h:f,windows:b}),A+=p+Math.random()*4}}function B(v,A){n=Math.min(2,window.devicePixelRatio||1),c.width=Math.round(v*n),c.height=Math.round(A*n),c.style.width=`${v}px`,c.style.height=`${A}px`,r=v,i=A,y.current={w:r,h:i},F()}const j=new ResizeObserver(v=>{const{width:A,height:p}=v[0].contentRect;A>0&&p>0&&B(A,p)});j.observe(C);const H=C.getBoundingClientRect();H.width>0&&H.height>0&&B(H.width,H.height);function O(v){const A=c.getBoundingClientRect();t(v.clientX-A.left,Math.min(i*.75,v.clientY-A.top))}C.addEventListener("click",O);function T(v){l.length<eo&&l.push({...v,trail:[]})}function $(v){const A=o.current,p=Math.max(12,A.particleCount),f=A.spread*68,b=A.particleSize,z=Math.max(.6,1.4/Math.max(.2,A.fadeSpeed/.015)),w=ee(A.colors[Math.floor(Math.random()*A.colors.length)]??"#ffffff"),D="255,196,92";I.push({x:v.x,y:v.y,rgb:v.rgb,life:1});const W=(k,q,P,N={})=>{for(let U=0;U<k;U++){const Y=U/k*Math.PI*2+Math.random()*.08,X=q*(.92+Math.random()*.12);T({x:v.x,y:v.y,vx:Math.cos(Y)*X,vy:Math.sin(Y)*X,life:z*(.85+Math.random()*.3),max:z,rgb:P,size:b,drag:1.2,glitter:!1,split:!1,...N})}};switch(v.kind){case"willow":for(let k=0;k<p;k++){const q=Math.random()*Math.PI*2,P=f*Math.sqrt(Math.random())*.85;T({x:v.x,y:v.y,vx:Math.cos(q)*P,vy:Math.sin(q)*P,life:z*2.2,max:z*2.2,rgb:D,size:b*.9,drag:2.2,glitter:!0,split:!1})}break;case"ring":W(Math.round(p*.7),f,v.rgb),W(Math.round(p*.3),f*.45,w);break;case"palm":for(let k=0;k<7;k++){const q=-Math.PI/2+(k-3)*.42;for(let P=0;P<6;P++){const N=f*(.6+P*.08);T({x:v.x,y:v.y,vx:Math.cos(q)*N+(Math.random()-.5)*8,vy:Math.sin(q)*N,life:z*1.4,max:z*1.4,rgb:P%2?D:v.rgb,size:b*1.2,drag:1.4,glitter:P%2===1,split:!1})}}break;case"crossette":W(Math.max(10,Math.round(p*.18)),f*.75,v.rgb,{split:!0,life:z*.55,max:z*.55});break;case"chrysanthemum":for(let k=0;k<p;k++){const q=Math.random()*Math.PI*2,P=f*(.55+Math.random()*.5);T({x:v.x,y:v.y,vx:Math.cos(q)*P,vy:Math.sin(q)*P,life:z,max:z,rgb:Math.random()<.25?w:v.rgb,size:b,drag:1.3,glitter:Math.random()<.3,split:!1})}break;default:for(let k=0;k<p;k++){const q=Math.random()*2-1,P=Math.random()*Math.PI*2,N=Math.sqrt(1-q*q),U=f*(.9+Math.random()*.15);T({x:v.x,y:v.y,vx:Math.cos(P)*N*U,vy:q*U,life:z,max:z,rgb:Math.random()<.15?w:v.rgb,size:b,drag:1.3,glitter:!1,split:!1})}}}let u=0,S=0;function R(v){u=requestAnimationFrame(R);const A=S?Math.min(.05,(v-S)/1e3):1/60;if(S=v,s+=A,r===0)return;const p=o.current,f=p.gravity*3600*.3,b=Math.max(2,Math.min(24,Math.round(p.trailLength*1.6)));if(p.autoLaunch&&(h-=A,h<=0)){const q=Math.random()<.18?3:1;for(let P=0;P<q;P++)t();h=p.autoInterval/1e3*(.6+Math.random()*.7)}a.setTransform(n,0,0,n,0,0);const z=!p.backgroundColor||p.backgroundColor==="transparent";if(a.clearRect(0,0,r,i),!z){const q=ee(p.backgroundColor),P=a.createLinearGradient(0,0,0,i);P.addColorStop(0,`rgb(${q})`),P.addColorStop(1,`rgb(${Ht(q,"70,60,110",.35)})`),a.fillStyle=P,a.fillRect(0,0,r,i)}for(m.length>p.starCount&&(m.length=Math.max(0,p.starCount));m.length<p.starCount;)m.push(L());const w=ee(p.starColor);for(const q of m){const P=q.opacity*(.7+.3*Math.sin(s*2+q.tw));p.glowingStars&&q.isGlowing&&(a.fillStyle=`rgba(${w},${P*.15})`,a.beginPath(),a.arc(q.x,q.y,q.r*(2+p.starGlowBlur/3),0,Math.PI*2),a.fill()),a.fillStyle=`rgba(${w},${P})`,a.beginPath(),a.arc(q.x,q.y,q.r,0,Math.PI*2),a.fill()}a.globalCompositeOperation="lighter";for(let q=I.length-1;q>=0;q--){const P=I[q];if(P.life-=A*1.6,P.life<=0){I.splice(q,1);continue}const N=Math.max(r,i)*.6,U=a.createRadialGradient(P.x,P.y,0,P.x,P.y,N);U.addColorStop(0,`rgba(${P.rgb},${.22*P.life*P.life})`),U.addColorStop(1,`rgba(${P.rgb},0)`),a.fillStyle=U,a.fillRect(0,0,r,i)}for(let q=g.current.length-1;q>=0;q--){const P=g.current[q];if(P.vy+=f*A,P.x+=P.vx*A,P.y+=P.vy*A,P.trail.push(P.x,P.y),P.trail.length>16&&P.trail.splice(0,2),Math.random()<.6&&T({x:P.x,y:P.y,vx:(Math.random()-.5)*30,vy:20+Math.random()*30,life:.35,max:.35,rgb:"255,210,150",size:.8,drag:3,glitter:!1,split:!1}),P.y<=P.targetY||P.vy>=0){g.current.splice(q,1),$(P);continue}a.strokeStyle=`rgba(${Ht(P.rgb,"255,255,255",.6)},0.8)`,a.lineWidth=1.6,a.beginPath();for(let N=0;N<P.trail.length;N+=2)N?a.lineTo(P.trail[N],P.trail[N+1]):a.moveTo(P.trail[N],P.trail[N+1]);a.stroke(),a.fillStyle="rgba(255,240,210,1)",a.beginPath(),a.arc(P.x,P.y,2,0,Math.PI*2),a.fill()}const D=Math.pow(p.friction,A*60),W=[];a.lineCap="round";let k=0;for(let q=0;q<l.length;q++){const P=l[q];if(P.life-=A,P.life<=0){if(P.split)for(let X=0;X<4;X++){const _=X/4*Math.PI*2+Math.random()*.3;W.push({x:P.x,y:P.y,vx:Math.cos(_)*90,vy:Math.sin(_)*90,life:.8,max:.8,rgb:Ht(P.rgb,"255,255,255",.3),size:P.size*.9,drag:1.4,glitter:!0,split:!1,trail:[]})}continue}const N=Math.pow(D,P.drag);P.vx*=N,P.vy=P.vy*N+f*A*(P.drag>2?.55:1),P.x+=P.vx*A,P.y+=P.vy*A,P.trail.push(P.x,P.y),P.trail.length>b*2&&P.trail.splice(0,2),l[k++]=P;const U=P.life/P.max;let Y=Math.min(1,U*1.6);if(P.glitter&&U<.45&&(Y*=Math.random()<.5?1:.1),P.trail.length>=4){a.strokeStyle=`rgba(${P.rgb},${Y*.45})`,a.lineWidth=Math.max(.6,P.size*.9),a.beginPath(),a.moveTo(P.trail[0],P.trail[1]);for(let X=2;X<P.trail.length;X+=2)a.lineTo(P.trail[X],P.trail[X+1]);a.stroke()}if(p.glowEffect){const X=E(P.rgb);if(X){const _=P.size*(3+p.glowBlur/2.5);a.globalAlpha=Y*.7,a.drawImage(X,P.x-_,P.y-_,_*2,_*2),a.globalAlpha=1}}a.fillStyle=`rgba(${Ht(P.rgb,"255,255,255",.45)},${Y})`,a.beginPath(),a.arc(P.x,P.y,Math.max(.5,P.size*(.6+U*.5)),0,Math.PI*2),a.fill()}l.length=k;for(const q of W)l.length<eo&&l.push(q);if(a.globalCompositeOperation="source-over",!z){const q=ee(p.backgroundColor),P=I.reduce((U,Y)=>Math.max(U,Y.life),0),N=I.length?I[I.length-1].rgb:"255,255,255";a.fillStyle=`rgb(${Ht(Ht(q,"0,0,0",.55),N,P*.12)})`;for(const U of M)a.fillRect(U.x,i-U.h,U.w,U.h);a.fillStyle="rgba(255,206,120,0.75)";for(const U of M)for(const[Y,X]of U.windows)a.fillRect(U.x+Y,i-U.h+X,2.2,3)}}return u=requestAnimationFrame(R),()=>{j.disconnect(),cancelAnimationFrame(u),C.removeEventListener("click",O)}},[e]),{launch:t}}const Br={default:{colors:["#f43f5e","#f59e0b","#4ade80","#06b6d4","#ffd166","#ffffff"],particleCount:80,gravity:.08,glowEffect:!0,glowBlur:8,backgroundColor:"#04060f"},monochrome:{colors:["#ffffff","#e2e8f0","#6b7280","#9ca3af"],particleCount:80,gravity:.08,glowEffect:!0,glowBlur:8,backgroundColor:"#111111"},celebration:{colors:["#f43f5e","#f59e0b","#4ade80","#06b6d4","#7C3AED","#ffffff"],particleCount:120,gravity:.06,spread:6,glowEffect:!0,glowBlur:12,backgroundColor:"#050010"},subtle:{colors:["#94a3b8","#cbd5e1","#e2e8f0"],particleCount:50,gravity:.1,spread:3.5,glowEffect:!1,backgroundColor:"#0f172a"},neon:{colors:["#00ffff","#ff00ff","#00ff41","#ff6600"],particleCount:100,gravity:.05,spread:7,glowEffect:!0,glowBlur:20,backgroundColor:"#000000"},golden:{colors:["#fbbf24","#f59e0b","#d97706","#ffffff","#fef3c7"],particleCount:90,gravity:.07,spread:5,glowEffect:!0,glowBlur:15,backgroundColor:"#0c0500"}},Bo=G.forwardRef((e,d)=>{const{preset:o,colors:g,particleCount:y,gravity:t,friction:c,fadeSpeed:C,particleSize:a,trailLength:r,spread:i,autoLaunch:n,autoInterval:s,glowEffect:l,glowBlur:m,backgroundColor:I,shellSpeed:M,starCount:h,starColor:x,glowingStars:E,starGlowBlur:L,width:F,height:B,className:j,style:H}=e,O=Br[o??"default"]||{},T=G.useRef(null);return G.useImperativeHandle(d,()=>T.current),Lr(T,{colors:g??O.colors??["#ffffff","#e2e8f0","#6b7280","#9ca3af"],particleCount:y??O.particleCount??80,gravity:t??O.gravity??.08,friction:c??O.friction??.97,fadeSpeed:C??O.fadeSpeed??.015,particleSize:a??O.particleSize??2,trailLength:r??O.trailLength??6,spread:i??O.spread??5,autoLaunch:n??!0,autoInterval:s??1800,glowEffect:l??O.glowEffect??!0,glowBlur:m??O.glowBlur??8,backgroundColor:I??O.backgroundColor??"#111111",shellSpeed:M??O.shellSpeed??12,starCount:h??80,starColor:x??"#ffffff",glowingStars:E??!1,starGlowBlur:L??8}),ct.jsx("div",{className:j,style:{width:F??"100%",height:B??"100%",display:"block",overflow:"hidden",...H},children:ct.jsx("canvas",{ref:T,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});Bo.displayName="Fireworks";function Dr(e,d){const o=G.useRef(d);o.current=d;const g=G.useRef(0),y=G.useRef(0);G.useEffect(()=>{const t=e.current;if(!t)return;const c=t.parentElement;if(!c)return;const C=t.getContext("2d");let a=0,r=0;function i(I,M){const h=e.current,x=window.devicePixelRatio||1;h.width=Math.round(I*x),h.height=Math.round(M*x),h.style.width=`${I}px`,h.style.height=`${M}px`,C.scale(x,x),a=I,r=M}const n=new ResizeObserver(I=>{const{width:M,height:h}=I[0].contentRect;M>0&&h>0&&i(M,h)});n.observe(c);const s=c.getBoundingClientRect();s.width>0&&s.height>0&&i(s.width,s.height);function l(I,M,h,x,E,L,F,B,j,H,O,T,$){const u=6+x*2,S=x/8*Math.PI*2,R=E*(1+x*.15);for(let v=0;v<F;v++){const A=v/F*Math.PI*2;for(let p=0;p<(B?2:1);p++){C.save(),C.translate(I,M),C.rotate(A+(p===1?Math.PI/F:0)),p===1&&C.scale(1,-1),C.beginPath();for(let f=0;f<=u*3;f++){const b=f/(u*3)*Math.PI*2,z=$*Math.sin(b*3+R+S),w=h*(.5+.5*Math.abs(Math.sin(b*(u/2)+R*.5))),D=(w+z*h*.15)*Math.cos(b),W=(w+z*h*.1)*Math.sin(b);f===0?C.moveTo(D,W):C.lineTo(D,W)}C.closePath(),H&&(C.shadowColor=L,C.shadowBlur=O),C.strokeStyle=L,C.lineWidth=j*(1-x*.08),C.globalAlpha=T*(1-x*.1),C.stroke(),C.shadowBlur=0,C.globalAlpha=1,C.restore()}}}function m(){const{symmetry:I,colors:M,lineWidth:h,speed:x,layers:E,radius:L,backgroundColor:F,animated:B,glowEffect:j,glowBlur:H,strokeOpacity:O,mirror:T,noiseAmount:$}=o.current;B&&(y.current+=x*.005);const u=y.current;C.clearRect(0,0,a,r),F&&F!=="transparent"&&(C.fillStyle=F,C.fillRect(0,0,a,r));const S=a/2,R=r/2,v=Math.min(a,r)*.45*L;for(let A=0;A<E;A++){const p=v*(1-A*(.85/E)),f=M[A%M.length];l(S,R,p,A,u+A*.3,f,I,T,h,j,H,O,$)}g.current=requestAnimationFrame(m)}return g.current=requestAnimationFrame(m),()=>{n.disconnect(),cancelAnimationFrame(g.current)}},[e])}const Or={default:{symmetry:8,colors:["#f43f5e","#fb7185","#fda4af","#fbbf24"],lineWidth:1.5,speed:1,layers:5,glowEffect:!0,glowBlur:10,strokeOpacity:.8,mirror:!0,noiseAmount:.3,backgroundColor:"#0c0005"},monochrome:{symmetry:8,colors:["#ffffff","#6b7280"],lineWidth:1.5,speed:1,layers:5,glowEffect:!0,glowBlur:10,strokeOpacity:.8,mirror:!0,noiseAmount:.3,backgroundColor:"#111111"},neon:{symmetry:12,colors:["#00ffff","#ff00ff","#7C3AED","#00ff41"],lineWidth:1,speed:1.5,layers:6,glowEffect:!0,glowBlur:20,strokeOpacity:.9,mirror:!0,noiseAmount:.5,backgroundColor:"#000000"},lotus:{symmetry:6,colors:["#f43f5e","#fb7185","#fda4af","#fbbf24"],lineWidth:2,speed:.5,layers:4,glowEffect:!0,glowBlur:8,strokeOpacity:.7,mirror:!0,noiseAmount:.2,backgroundColor:"#0c0005"},cosmic:{symmetry:16,colors:["#6366f1","#8b5cf6","#a78bfa","#c4b5fd","#ddd6fe"],lineWidth:.8,speed:.8,layers:7,glowEffect:!0,glowBlur:15,strokeOpacity:.6,mirror:!1,noiseAmount:.6,backgroundColor:"#030014"},minimal:{symmetry:6,colors:["#e2e8f0","#94a3b8"],lineWidth:1,speed:.3,layers:3,glowEffect:!1,strokeOpacity:.5,mirror:!0,noiseAmount:.1,backgroundColor:"#0f172a"}},Do=G.forwardRef((e,d)=>{const{preset:o,symmetry:g,colors:y,lineWidth:t,speed:c,layers:C,radius:a,backgroundColor:r,animated:i,glowEffect:n,glowBlur:s,strokeOpacity:l,mirror:m,noiseAmount:I,width:M,height:h,className:x,style:E}=e,L=Or[o??"default"]||{},F=G.useRef(null);return G.useImperativeHandle(d,()=>F.current),Dr(F,{symmetry:g??L.symmetry??8,colors:y??L.colors??["#ffffff","#6b7280"],lineWidth:t??L.lineWidth??1.5,speed:c??L.speed??1,layers:C??L.layers??5,radius:a??1,backgroundColor:r??L.backgroundColor??"#111111",animated:i??!0,glowEffect:n??L.glowEffect??!0,glowBlur:s??L.glowBlur??10,strokeOpacity:l??L.strokeOpacity??.8,mirror:m??L.mirror??!0,noiseAmount:I??L.noiseAmount??.3}),ct.jsx("div",{className:x,style:{width:M??"100%",height:h??"100%",display:"block",overflow:"hidden",...E},children:ct.jsx("canvas",{ref:F,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});Do.displayName="Mandala";function ht(e,d,o){return Math.min(e,o-1)+Math.min(d,o-1)*o}function Ae(e,d,o,g,y,t){const c=t*y*e*e,C=1+4*c;for(let a=0;a<4;a++){for(let r=1;r<e-1;r++)for(let i=1;i<e-1;i++)o[ht(i,r,e)]=(g[ht(i,r,e)]+c*(o[ht(i-1,r,e)]+o[ht(i+1,r,e)]+o[ht(i,r-1,e)]+o[ht(i,r+1,e)]))/C;jt(e,d,o)}}function Ie(e,d,o,g,y,t,c){const C=c*e;for(let a=1;a<e-1;a++)for(let r=1;r<e-1;r++){let i=r-C*y[ht(r,a,e)],n=a-C*t[ht(r,a,e)];i=Math.max(.5,Math.min(e-1.5,i)),n=Math.max(.5,Math.min(e-1.5,n));const s=Math.floor(i),l=s+1,m=Math.floor(n),I=m+1,M=i-s,h=1-M,x=n-m,E=1-x;o[ht(r,a,e)]=h*(E*g[ht(s,m,e)]+x*g[ht(s,I,e)])+M*(E*g[ht(l,m,e)]+x*g[ht(l,I,e)])}jt(e,d,o)}function no(e,d,o,g,y){const t=1/e;for(let c=1;c<e-1;c++)for(let C=1;C<e-1;C++)y[ht(C,c,e)]=-.5*t*(d[ht(C+1,c,e)]-d[ht(C-1,c,e)]+o[ht(C,c+1,e)]-o[ht(C,c-1,e)]),g[ht(C,c,e)]=0;jt(e,0,y),jt(e,0,g);for(let c=0;c<4;c++){for(let C=1;C<e-1;C++)for(let a=1;a<e-1;a++)g[ht(a,C,e)]=(y[ht(a,C,e)]+g[ht(a-1,C,e)]+g[ht(a+1,C,e)]+g[ht(a,C-1,e)]+g[ht(a,C+1,e)])/4;jt(e,0,g)}for(let c=1;c<e-1;c++)for(let C=1;C<e-1;C++)d[ht(C,c,e)]-=.5*(g[ht(C+1,c,e)]-g[ht(C-1,c,e)])/t,o[ht(C,c,e)]-=.5*(g[ht(C,c+1,e)]-g[ht(C,c-1,e)])/t;jt(e,1,d),jt(e,2,o)}function jt(e,d,o){for(let g=1;g<e-1;g++)o[ht(0,g,e)]=d===1?-o[ht(1,g,e)]:o[ht(1,g,e)],o[ht(e-1,g,e)]=d===1?-o[ht(e-2,g,e)]:o[ht(e-2,g,e)],o[ht(g,0,e)]=d===2?-o[ht(g,1,e)]:o[ht(g,1,e)],o[ht(g,e-1,e)]=d===2?-o[ht(g,e-2,e)]:o[ht(g,e-2,e)];o[ht(0,0,e)]=.5*(o[ht(1,0,e)]+o[ht(0,1,e)]),o[ht(e-1,0,e)]=.5*(o[ht(e-2,0,e)]+o[ht(e-1,1,e)]),o[ht(0,e-1,e)]=.5*(o[ht(1,e-1,e)]+o[ht(0,e-2,e)]),o[ht(e-1,e-1,e)]=.5*(o[ht(e-2,e-1,e)]+o[ht(e-1,e-2,e)])}function Wr(e,d){const o=G.useRef(d);o.current=d;const g=G.useRef(0),y=G.useRef(null),t=G.useRef(0);G.useEffect(()=>{const c=e.current;if(!c)return;const C=c.parentElement;if(!C)return;const a=c.getContext("2d");let r=0,i=0;const n=Math.max(32,Math.min(128,d.resolution)),s=n*n;let l=new Float32Array(s),m=new Float32Array(s),I=new Float32Array(s),M=new Float32Array(s),h=new Float32Array(s),x=new Float32Array(s),E=new Float32Array(s),L=new Float32Array(s),F=new Float32Array(s),B=new Float32Array(s),j=new Float32Array(s),H=new Float32Array(s),O=null;const T=document.createElement("canvas");T.width=n,T.height=n;const $=T.getContext("2d");function u(D,W){const k=e.current,q=window.devicePixelRatio||1;k.width=Math.round(D*q),k.height=Math.round(W*q),k.style.width=`${D}px`,k.style.height=`${W}px`,a.scale(q,q),a.imageSmoothingEnabled=!0,a.imageSmoothingQuality="high",r=D,i=W,O=$.createImageData(n,n)}const S=new ResizeObserver(D=>{const{width:W,height:k}=D[0].contentRect;W>0&&k>0&&u(W,k)});S.observe(C);const R=C.getBoundingClientRect();R.width>0&&R.height>0&&u(R.width,R.height);function v(D,W,k,q,P,N,U,Y,X){const _=Math.max(1,Math.floor(X));for(let V=-_;V<=_;V++)for(let Q=-_;Q<=_;Q++){const ot=D+Q,tt=W+V;if(ot<1||ot>=n-1||tt<1||tt>=n-1)continue;const at=Math.sqrt(Q*Q+V*V);if(at>_)continue;const K=1-at/_,J=ht(ot,tt,n);h[J]+=P*K,x[J]+=N*K,E[J]+=U*K,l[J]+=k*Y*K,m[J]+=q*Y*K}}function A(D){const W=It(D,e.current);if(!W)return p();const k=W.x,q=W.y,P=y.current;y.current={x:k,y:q,px:P?P.x:k,py:P?P.y:q}}function p(){y.current=null}window.addEventListener("mousemove",A),document.addEventListener("mouseleave",p);let f=0,b=-1;function z(){const{inkColors:D}=o.current,W=D[t.current%D.length];t.current++;const k=mt(W).split(",").map(Number),q=Math.floor(n*.2+Math.random()*n*.6),P=Math.floor(n*.2+Math.random()*n*.6),N=Math.random()*Math.PI*2;v(q,P,Math.cos(N)*2,Math.sin(N)*2,k[0]/255,k[1]/255,k[2]/255,3,3)}function w(){const{viscosity:D,diffusion:W,dissipation:k,inkColors:q,backgroundColor:P,mouseForce:N,inkRadius:U,autoInk:Y,autoInkInterval:X,glowEffect:_,glowBlur:V}=o.current,Q=.016;f+=16;const ot=()=>Math.max(50,X)*(.6+Math.random()*.8);Y?b<0?b=f+ot():f>=b&&(z(),b=f+ot()):b=-1;const tt=y.current;if(tt){const K=Math.floor(tt.x/r*n),J=Math.floor(tt.y/i*n),nt=(tt.x-tt.px)*.5,st=(tt.y-tt.py)*.5,rt=q[t.current%q.length],lt=mt(rt).split(",").map(Number);v(K,J,nt,st,lt[0]/255,lt[1]/255,lt[2]/255,N,U),Math.abs(nt)+Math.abs(st)>.5&&t.current++,tt.px=tt.x,tt.py=tt.y}I.set(l),M.set(m),Ae(n,1,l,I,D,Q),Ae(n,2,m,M,D,Q),no(n,l,m,j,H),I.set(l),M.set(m),Ie(n,1,l,I,I,M,Q),Ie(n,2,m,M,I,M,Q),no(n,l,m,j,H);for(const[K,J]of[[h,L],[x,F],[E,B]]){J.set(K),Ae(n,0,K,J,W,Q),J.set(K),Ie(n,0,K,J,l,m,Q);for(let nt=0;nt<s;nt++)K[nt]=Math.max(0,K[nt]*k),J[nt]=0}for(let K=0;K<s;K++)I[K]=0,M[K]=0;if(!O){g.current=requestAnimationFrame(w);return}const at=O.data;for(let K=0;K<n;K++)for(let J=0;J<n;J++){const nt=ht(J,K,n),st=(K*n+J)*4;at[st]=Math.min(255,h[nt]*255),at[st+1]=Math.min(255,x[nt]*255),at[st+2]=Math.min(255,E[nt]*255),at[st+3]=Math.min(255,(h[nt]+x[nt]+E[nt])*200)}a.clearRect(0,0,r,i),P&&P!=="transparent"&&(a.fillStyle=P,a.fillRect(0,0,r,i)),$.putImageData(O,0,0),a.drawImage(T,0,0,r,i),_&&V>0&&typeof a.filter=="string"&&(a.save(),a.filter=`blur(${V}px)`,a.globalCompositeOperation="lighter",a.globalAlpha=.6,a.drawImage(T,0,0,r,i),a.restore()),g.current=requestAnimationFrame(w)}return g.current=requestAnimationFrame(w),()=>{S.disconnect(),cancelAnimationFrame(g.current),window.removeEventListener("mousemove",A),document.removeEventListener("mouseleave",p)}},[e,d.resolution])}const qr={default:{resolution:80,viscosity:1e-4,diffusion:1e-4,dissipation:.995,inkColors:["#0c4a6e","#0891B2","#06b6d4","#67e8f9"],glowEffect:!0,glowBlur:0,backgroundColor:"#020f1a",autoInk:!0,autoInkInterval:1500,mouseForce:5,inkRadius:4},monochrome:{resolution:80,viscosity:1e-4,diffusion:1e-4,dissipation:.995,inkColors:["#ffffff","#6b7280","#9ca3af"],glowEffect:!0,glowBlur:0,backgroundColor:"#111111",autoInk:!0,autoInkInterval:1500,mouseForce:5,inkRadius:4},ink:{resolution:80,viscosity:5e-5,diffusion:5e-5,dissipation:.998,inkColors:["#1e1b4b","#312e81","#4338ca","#6366f1"],backgroundColor:"#f8fafc",autoInk:!0,autoInkInterval:2e3,mouseForce:4,inkRadius:3},neon:{resolution:64,viscosity:1e-5,diffusion:1e-5,dissipation:.993,inkColors:["#00ffff","#ff00ff","#00ff41","#ff6600"],glowEffect:!0,backgroundColor:"#000000",autoInk:!0,mouseForce:8,inkRadius:5},lava:{resolution:64,viscosity:.001,diffusion:5e-4,dissipation:.99,inkColors:["#7f1d1d","#dc2626","#f97316","#fbbf24"],backgroundColor:"#0c0000",autoInk:!0,mouseForce:6,inkRadius:4},ocean:{resolution:80,viscosity:2e-4,diffusion:1e-4,dissipation:.997,inkColors:["#0c4a6e","#0891B2","#06b6d4","#67e8f9"],backgroundColor:"#020f1a",autoInk:!0,mouseForce:4,inkRadius:5},smoke:{resolution:72,viscosity:5e-5,diffusion:2e-4,dissipation:.994,inkColors:["#475569","#94a3b8","#cbd5e1","#e2e8f0"],backgroundColor:"#0f172a",autoInk:!0,autoInkInterval:800,mouseForce:3,inkRadius:6}},Oo=G.forwardRef((e,d)=>{const{preset:o,resolution:g,viscosity:y,diffusion:t,dissipation:c,inkColors:C,glowEffect:a,glowBlur:r,backgroundColor:i,autoInk:n,autoInkInterval:s,mouseForce:l,inkRadius:m,width:I,height:M,className:h,style:x}=e,E=qr[o??"default"]||{},L=G.useRef(null);return G.useImperativeHandle(d,()=>L.current),Wr(L,{resolution:g??E.resolution??128,viscosity:y??E.viscosity??1e-4,diffusion:t??E.diffusion??1e-4,dissipation:c??E.dissipation??.995,inkColors:C??E.inkColors??["#ffffff","#6b7280","#9ca3af"],glowEffect:a??E.glowEffect??!0,glowBlur:r??E.glowBlur??0,backgroundColor:i??E.backgroundColor??"#111111",autoInk:n??E.autoInk??!0,autoInkInterval:s??E.autoInkInterval??1500,mouseForce:l??E.mouseForce??5,inkRadius:m??E.inkRadius??4}),ct.jsx("div",{className:h,style:{width:I??"100%",height:M??"100%",display:"block",overflow:"hidden",...x},children:ct.jsx("canvas",{ref:L,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});Oo.displayName="FluidSimulation";const $t=(e,d,o)=>{const g=e.split(",").map(Number),y=d.split(",").map(Number);return g.map((t,c)=>Math.round(t+(y[c]-t)*o)).join(",")};function Gr(e,d){const o=G.useRef(d);o.current=d,G.useEffect(()=>{const g=e.current;if(!g)return;const y=g.parentElement;if(!y)return;const t=g.getContext("2d");let c=0,C=0,a=1,r=0,i=[],n=[],s=[],l=[],m=[],I=[],M=0,h=6;const x=()=>C*.72;function E($,u){$.z=Math.random(),$.x=Math.random()*(c+200)-100,$.y=u?-Math.random()*C*.3:Math.random()*C,$.len=.4+$.z*.8,$.v=.55+$.z*.65+Math.random()*.1}function L(){const $=o.current;i=Array.from({length:Math.max(0,$.dropCount)},()=>{const R={x:0,y:0,z:0,len:0,v:0};return E(R,!1),R}),l=Array.from({length:$.starCount},()=>({x:Math.random()*c,y:Math.random()*C*.45,r:.3+Math.random(),o:.2+Math.random()*.5,g:Math.random()<.25})),m=[];const u=Math.max(2,Math.round(c/260));for(let R=0;R<u;R++)m.push({x:(R+.5)/u*c+(Math.random()-.5)*60,h:C*(.2+Math.random()*.08),rgb:Math.random()<.7?"255,196,120":"150,210,255"});I=[];let S=-10;for(;S<c+10;){const R=26+Math.random()*60;I.push({x:S,w:R,h:C*(.08+Math.random()*.17)}),S+=R+Math.random()*6}}function F($,u){a=Math.min(2,window.devicePixelRatio||1),g.width=Math.round($*a),g.height=Math.round(u*a),g.style.width=`${$}px`,g.style.height=`${u}px`,c=$,C=u,L()}const B=new ResizeObserver($=>{const{width:u,height:S}=$[0].contentRect;u>0&&S>0&&F(u,S)});B.observe(y);const j=y.getBoundingClientRect();j.width>0&&j.height>0&&F(j.width,j.height);let H=0,O=0;function T($){H=requestAnimationFrame(T);const u=O?Math.min(.05,($-O)/1e3):1/60;if(O=$,r+=u,c===0)return;const S=o.current;(i.length!==Math.max(0,S.dropCount)||l.length!==S.starCount)&&L();const R=mt(S.backgroundColor==="transparent"?"#000000":S.backgroundColor),v=mt(S.dropColor),A=mt(S.splashColor),p=x(),f=S.wind*(1+.45*Math.sin(r*S.windSpeed*.9)+.2*Math.sin(r*S.windSpeed*2.3));(S.dropCount>350||S.speed>20)&&(h-=u,h<=0&&(M=1,h=5+Math.random()*9)),M=Math.max(0,M-u*2.6);const z=M>0?M*(.6+.4*Math.sin(r*60)):0;if(t.setTransform(a,0,0,a,0,0),t.clearRect(0,0,c,C),S.backgroundColor!=="transparent"){const D=t.createLinearGradient(0,0,0,p);D.addColorStop(0,`rgb(${$t(R,"210,225,255",z*.35)})`),D.addColorStop(1,`rgb(${$t($t(R,"120,110,140",.28),"210,225,255",z*.4)})`),t.fillStyle=D,t.fillRect(0,0,c,p);const W=mt(S.starColor);for(const P of l){const N=S.glowingStars&&P.g;N&&S.starGlowBlur>0&&(t.fillStyle=`rgba(${W},${P.o*.18})`,t.beginPath(),t.arc(P.x,P.y,P.r+S.starGlowBlur*.4,0,Math.PI*2),t.fill()),t.fillStyle=`rgba(${W},${P.o*(N?1:.6)})`,t.beginPath(),t.arc(P.x,P.y,P.r,0,Math.PI*2),t.fill()}t.fillStyle=`rgba(${$t(R,"40,46,70",.5)},0.95)`;for(const P of I)t.fillRect(P.x,p-P.h,P.w,P.h);const k=t.createLinearGradient(0,p-C*.22,0,p);k.addColorStop(0,`rgba(${$t(R,"150,160,190",.5)},0)`),k.addColorStop(1,`rgba(${$t(R,"150,160,190",.5)},0.45)`),t.fillStyle=k,t.fillRect(0,p-C*.22,c,C*.22);const q=t.createLinearGradient(0,p,0,C);q.addColorStop(0,`rgb(${$t(R,"90,96,120",.32)})`),q.addColorStop(1,`rgb(${$t(R,"0,0,0",.25)})`),t.fillStyle=q,t.fillRect(0,p,c,C-p),t.globalCompositeOperation="lighter";for(const P of m){t.fillStyle=`rgba(${$t(R,"20,20,26",.6)},1)`,t.fillRect(P.x-1.5,p-P.h,3,P.h);const N=p-P.h,U=t.createRadialGradient(P.x,N,0,P.x,N,C*.22);U.addColorStop(0,`rgba(${P.rgb},0.5)`),U.addColorStop(.25,`rgba(${P.rgb},0.14)`),U.addColorStop(1,`rgba(${P.rgb},0)`),t.fillStyle=U,t.fillRect(P.x-C*.22,N-C*.22,C*.44,C*.44),t.fillStyle=`rgba(${P.rgb},1)`,t.beginPath(),t.arc(P.x,N,3,0,Math.PI*2),t.fill();const Y=t.createLinearGradient(0,p,0,C);Y.addColorStop(0,`rgba(${P.rgb},0.38)`),Y.addColorStop(1,`rgba(${P.rgb},0.04)`),t.fillStyle=Y;for(let X=p;X<C;X+=3){const _=(X-p)/(C-p),V=Math.sin(X*.35+r*3+P.x)*(2+_*6),Q=3+_*16;t.fillRect(P.x-Q/2+V,X,Q,2)}}t.globalCompositeOperation="source-over"}const w=S.speed*60;t.lineCap="round";for(const D of i){const W=w*D.v;D.y+=W*u,D.x+=f*60*D.v*u;const k=p+D.z*(C-p)*.95;if(D.y>k){if(S.showSplashes&&(n.length<160&&Math.random()<.6&&n.push({x:D.x,y:k,life:1,size:.5+D.z}),D.z>.6&&s.length<200))for(let U=0;U<2;U++)s.push({x:D.x,y:k,vx:(Math.random()-.5)*60+f*20,vy:-(40+Math.random()*60),life:.35});E(D,!0);continue}D.x>c+100&&(D.x-=c+200),D.x<-100&&(D.x+=c+200);const q=S.dropLength*D.len,P=Math.atan2(W,f*60*D.v),N=S.dropOpacity*(.15+D.z*.7);t.strokeStyle=`rgba(${$t(v,"255,255,255",D.z*.25+z*.5)},${N})`,t.lineWidth=S.dropWidth*(.4+D.z*.8),t.beginPath(),t.moveTo(D.x,D.y),t.lineTo(D.x-Math.cos(P)*q,D.y-Math.sin(P)*q),t.stroke()}for(let D=n.length-1;D>=0;D--){const W=n[D];if(W.life-=u*1.8,W.life<=0){n.splice(D,1);continue}const k=(1-W.life)*14*W.size+1;t.strokeStyle=`rgba(${A},${W.life*.45})`,t.lineWidth=.8,t.beginPath(),t.ellipse(W.x,W.y,k,k*.28,0,0,Math.PI*2),t.stroke()}t.fillStyle=`rgba(${A},0.7)`;for(let D=s.length-1;D>=0;D--){const W=s[D];if(W.life-=u,W.life<=0){s.splice(D,1);continue}W.vy+=400*u,W.x+=W.vx*u,W.y+=W.vy*u,t.globalAlpha=W.life/.35,t.fillRect(W.x,W.y,1.2,1.2)}t.globalAlpha=1,z>0&&(t.fillStyle=`rgba(220,230,255,${z*.12})`,t.fillRect(0,0,c,C))}return H=requestAnimationFrame(T),()=>{B.disconnect(),cancelAnimationFrame(H)}},[e])}const jr={default:{dropColor:"#a9c2e8",splashColor:"#dbe7ff",backgroundColor:"#0b1424"},monochrome:{dropColor:"#000000",splashColor:"#000000",backgroundColor:"#ffffff"},storm:{dropCount:500,speed:25,wind:1.5,windSpeed:1,dropOpacity:.8,dropLength:30,dropColor:"#94a3b8",splashColor:"#cbd5e1",backgroundColor:"#0a0a14"},drizzle:{dropCount:80,speed:8,wind:.1,dropOpacity:.3,dropLength:12,dropColor:"#7C3AED",splashColor:"#0891B2",backgroundColor:"#050010"},neon:{dropColor:"#00ffff",splashColor:"#ff00ff",backgroundColor:"#000000",dropOpacity:.7,dropWidth:1.5},golden:{dropColor:"#f59e0b",splashColor:"#fbbf24",backgroundColor:"#0a0500",dropOpacity:.65,dropLength:18}},Wo=G.forwardRef((e,d)=>{const{preset:o,dropCount:g,speed:y,wind:t,windSpeed:c,dropLength:C,dropWidth:a,dropOpacity:r,dropColor:i,splashColor:n,showSplashes:s,backgroundColor:l,starCount:m,starColor:I,glowingStars:M,starGlowBlur:h,width:x,height:E,className:L,style:F}=e,B=jr[o??"default"]||{},j=G.useRef(null);return G.useImperativeHandle(d,()=>j.current),Gr(j,{dropCount:g??B.dropCount??200,speed:y??B.speed??15,wind:t??B.wind??.3,windSpeed:c??B.windSpeed??.5,dropLength:C??B.dropLength??28,dropWidth:a??B.dropWidth??1.5,dropOpacity:r??B.dropOpacity??.85,dropColor:i??B.dropColor??"#000000",splashColor:n??B.splashColor??"#000000",showSplashes:s??B.showSplashes??!0,backgroundColor:l??B.backgroundColor??"#ffffff",starCount:m??60,starColor:I??"#ffffff",glowingStars:M??!1,starGlowBlur:h??8}),ct.jsx("div",{className:L,style:{width:x??"100%",height:E??"100%",display:"block",overflow:"hidden",...F},children:ct.jsx("canvas",{ref:j,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});Wo.displayName="Rain";function be(e,d,o,g,y,t,c){if(y<=0){c.push({x:o,y:g});return}const C=Math.hypot(o-e,g-d),a=(e+o)/2+(Math.random()-.5)*t*C*.5,r=(d+g)/2+(Math.random()-.5)*t*C*.1;be(e,d,a,r,y-1,t,c),be(a,r,o,g,y-1,t,c)}function Xr(e,d){const o=G.useRef(d);o.current=d;const g=G.useRef([]),y=G.useRef(0),t=G.useRef(0);G.useEffect(()=>{const c=e.current;if(!c)return;const C=c.parentElement;if(!C)return;const a=c.getContext("2d");let r=0,i=0;function n(B,j){const H=window.devicePixelRatio||1;c.width=Math.round(B*H),c.height=Math.round(j*H),c.style.width=`${B}px`,c.style.height=`${j}px`,a.scale(H,H),r=B,i=j}const s=new ResizeObserver(B=>{const{width:j,height:H}=B[0].contentRect;j>0&&H>0&&n(j,H)});s.observe(C);const l=C.getBoundingClientRect();l.width>0&&l.height>0&&n(l.width,l.height);function m(B){const{glowBlur:j,color:H,coreColor:O}=o.current,T=B.points;if(T.length<2||B.alpha<=0)return;const $=B.alpha*B.energy;a.lineCap="round",a.lineJoin="round",a.shadowBlur=0,a.globalAlpha=$*.3,a.strokeStyle=H,a.lineWidth=6*B.energy,a.filter=`blur(${Math.round(j*.6)}px)`,a.beginPath(),a.moveTo(T[0].x,T[0].y);for(let u=1;u<T.length;u++)a.lineTo(T[u].x,T[u].y);a.stroke(),a.filter="none",a.globalAlpha=$*.6,a.strokeStyle=H,a.lineWidth=2.5*B.energy,a.shadowColor=H,a.shadowBlur=j*B.energy,a.beginPath(),a.moveTo(T[0].x,T[0].y);for(let u=1;u<T.length;u++)a.lineTo(T[u].x,T[u].y);a.stroke(),a.globalAlpha=$*.9,a.strokeStyle=O,a.lineWidth=.8*B.energy,a.shadowBlur=0,a.beginPath(),a.moveTo(T[0].x,T[0].y);for(let u=1;u<T.length;u++)a.lineTo(T[u].x,T[u].y);a.stroke(),a.globalAlpha=1,a.shadowBlur=0}function I(B,j){const{roughness:H,branchChance:O,branchDecay:T,flickerCount:$}=o.current,u=Math.max(1,Math.min(12,Math.round(o.current.segments))),S=48,{startX:R,startY:v,endY:A}=o.current,p=B!==void 0?B:R*r,f=v*i,b=p+(Math.random()-.5)*r*.2,z=j!==void 0?j:A*i,w=[];function D(W,k,q,P,N){const U=[{x:W,y:k}];be(W,k,q,P,u,H,U),w.push({points:U,energy:N,alpha:1});const Y=O*Math.min(1,256/U.length);let X=0;for(let _=2;_<U.length-1&&X<S;_++){if(Math.random()>=Y)continue;X++;const V=(Math.random()-.5)*Math.PI*.65,Q=(z-U[_].y)*(.25+Math.random()*.4),ot=U[_].x+Math.sin(V)*Q,tt=U[_].y+Math.cos(V)*Math.abs(Q),at=[{x:U[_].x,y:U[_].y}];be(U[_].x,U[_].y,ot,tt,Math.max(2,u-2),H*.8,at),w.push({points:at,energy:N*T,alpha:1})}}for(let W=0;W<$;W++)D(p+(Math.random()-.5)*4,f,b+(Math.random()-.5)*8,z,1);g.current=w,t.current=.35}let M=0,h=0,x=0;const E=()=>Math.max(50,o.current.autoInterval)*(.5+Math.random());I(),x=E();function L(B){if(!o.current.interactive)return;const j=c.getBoundingClientRect();I(B.clientX-j.left,B.clientY-j.top)}c.addEventListener("click",L);function F(B){const{backgroundColor:j}=o.current;h+=M?Math.min(B-M,64):16,M=B,h>=x&&(I(),h=0,x=E()),!j||j==="transparent"?a.clearRect(0,0,r,i):(a.fillStyle=j,a.fillRect(0,0,r,i));const H=g.current;let O=!1;for(const T of H)T.alpha*=.82,T.alpha>.01&&(O=!0,m(T));O||(g.current=[]),t.current>.005&&(a.globalAlpha=t.current,a.fillStyle="#ffffff",a.fillRect(0,0,r,i),a.globalAlpha=1,t.current*=.55),y.current=requestAnimationFrame(F)}return y.current=requestAnimationFrame(F),()=>{s.disconnect(),cancelAnimationFrame(y.current),c.removeEventListener("click",L)}},[e])}const Hr={default:{color:"#c0c0ff",coreColor:"#ffffff",glowBlur:20,backgroundColor:"#050010"},monochrome:{color:"#6b7280",coreColor:"#ffffff",glowBlur:20,backgroundColor:"#111111"},neon:{color:"#00ffff",coreColor:"#ffffff",glowBlur:40,branchChance:.5,backgroundColor:"#000000",flickerCount:4},storm:{color:"#c0c0ff",coreColor:"#ffffff",branchChance:.4,roughness:.7,autoInterval:1e3,backgroundColor:"#050010",glowBlur:15},plasma:{color:"#ff00ff",coreColor:"#ffaaff",glowBlur:30,segments:10,backgroundColor:"#0a0010",branchChance:.35},subtle:{glowBlur:8,branchChance:.1,color:"#94a3b8",coreColor:"#e2e8f0",autoInterval:4e3,backgroundColor:"#0f172a",flickerCount:2}},qo=G.forwardRef((e,d)=>{const{preset:o,segments:g,roughness:y,branchChance:t,branchDecay:c,flickerCount:C,glowBlur:a,color:r,coreColor:i,backgroundColor:n,autoInterval:s,interactive:l,startX:m,startY:I,endY:M,width:h,height:x,className:E,style:L}=e,F=Hr[o??"default"]||{},B=G.useRef(null);return G.useImperativeHandle(d,()=>B.current),Xr(B,{segments:g??F.segments??8,roughness:y??F.roughness??.5,branchChance:t??F.branchChance??.1,branchDecay:c??F.branchDecay??.6,flickerCount:C??F.flickerCount??3,glowBlur:a??F.glowBlur??20,color:r??F.color??"#6b7280",coreColor:i??F.coreColor??"#ffffff",backgroundColor:n??F.backgroundColor??"#111111",autoInterval:s??F.autoInterval??2e3,interactive:l??F.interactive??!0,startX:m??F.startX??.5,startY:I??F.startY??0,endY:M??F.endY??1}),ct.jsx("div",{className:E,style:{width:h??"100%",height:x??"100%",display:"block",overflow:"hidden",cursor:"crosshair",...L},children:ct.jsx("canvas",{ref:B,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});qo.displayName="Lightning";function Yr(e,d,o){const g=G.useRef(d);g.current=d;const y=G.useRef(0),t=G.useRef(new Uint16Array(0)),c=G.useRef(new Uint16Array(0)),C=G.useRef(0),a=G.useRef(0),r=G.useRef(!1),i=G.useRef(0);G.useEffect(()=>{const n=e.current;if(!n)return;const s=n.parentElement;if(!s)return;const l=n.getContext("2d");let m=0,I=0,M="";function h(H=!0){const{cellSize:O,initialDensity:T}=g.current,$=Math.floor(m/O),u=Math.floor(I/O);if(C.current=$,a.current=u,t.current=new Uint16Array($*u),c.current=new Uint16Array($*u),H)for(let S=0;S<t.current.length;S++)t.current[S]=Math.random()<T?1:0}function x(H,O){const T=e.current,$=window.devicePixelRatio||1;T.width=Math.round(H*$),T.height=Math.round(O*$),T.style.width=`${H}px`,T.style.height=`${O}px`,l.scale($,$),m=H,I=O,h(!0),M=`${g.current.cellSize}|${g.current.initialDensity}`}const E=new ResizeObserver(H=>{const{width:O,height:T}=H[0].contentRect;O>0&&T>0&&x(O,T)});E.observe(s);const L=s.getBoundingClientRect();L.width>0&&L.height>0&&x(L.width,L.height),o&&(o.current={randomize:()=>h(!0),clear:()=>{t.current.fill(0)},pause:()=>{r.current=!0},resume:()=>{r.current=!1},canvas:n});function F(){const H=C.current,O=a.current,T=t.current,$=c.current,{wrapEdges:u}=g.current;for(let S=0;S<O;S++)for(let R=0;R<H;R++){let v=0;for(let f=-1;f<=1;f++)for(let b=-1;b<=1;b++){if(f===0&&b===0)continue;let z=S+f,w=R+b;if(u)z=(z+O)%O,w=(w+H)%H;else if(z<0||z>=O||w<0||w>=H)continue;T[z*H+w]>0&&v++}const A=S*H+R,p=T[A]>0;p&&(v===2||v===3)?$[A]=Math.min(T[A]+1,255):!p&&v===3?$[A]=1:$[A]=0}t.current=$.slice()}function B(H){const{cellSize:O,speed:T,aliveColor:$,oldColor:u,deadColor:S,showAge:R,backgroundColor:v,initialDensity:A}=g.current,p=`${O}|${A}`;if(p!==M&&(M=p,h(!0)),!r.current){const D=1e3/T;H-i.current>=D&&(F(),i.current=H)}l.fillStyle=v,l.fillRect(0,0,m,I);const f=C.current,b=a.current,z=t.current,w=60;if(S!==v&&f>0&&b>0){l.fillStyle=S,l.fillRect(0,0,f*O,b*O),l.fillStyle=v;for(let D=0;D<=f;D++)l.fillRect(D*O-.5,0,1,b*O);for(let D=0;D<=b;D++)l.fillRect(0,D*O-.5,f*O,1)}for(let D=0;D<b;D++)for(let W=0;W<f;W++){const k=z[D*f+W];if(k===0)continue;const q=R?Math.min(k/w,1):0,[P,N,U]=bt([$,u],q);l.fillStyle=`rgb(${P},${N},${U})`,l.fillRect(W*O+.5,D*O+.5,O-1,O-1)}y.current=requestAnimationFrame(B)}y.current=requestAnimationFrame(B);function j(H){if(!g.current.interactive)return;const T=e.current.getBoundingClientRect(),$=H.clientX-T.left,u=H.clientY-T.top,{cellSize:S}=g.current,R=Math.floor($/S),v=Math.floor(u/S),A=C.current,p=a.current;if(R<0||R>=A||v<0||v>=p)return;const f=v*A+R;t.current[f]=t.current[f]>0?0:1}return n.addEventListener("click",j),()=>{E.disconnect(),cancelAnimationFrame(y.current),n.removeEventListener("click",j)}},[e,o])}const Nr={default:{aliveColor:"#00ff41",oldColor:"#004d14",deadColor:"#000000",backgroundColor:"#000000"},monochrome:{aliveColor:"#ffffff",oldColor:"#6b7280",deadColor:"#111111",backgroundColor:"#111111"},neon:{aliveColor:"#00ff41",oldColor:"#00ffff",deadColor:"#000000",backgroundColor:"#000000",cellSize:6},matrix:{aliveColor:"#00ff41",oldColor:"#004d14",deadColor:"#000000",backgroundColor:"#000000",cellSize:10},minimal:{aliveColor:"#ffffff",oldColor:"#94a3b8",deadColor:"#0f172a",backgroundColor:"#0f172a",showAge:!1},fire:{aliveColor:"#ff6b00",oldColor:"#ffff00",deadColor:"#050010",backgroundColor:"#050010",cellSize:5,speed:8}},Go=G.forwardRef((e,d)=>{const{preset:o,cellSize:g,speed:y,initialDensity:t,aliveColor:c,oldColor:C,deadColor:a,showAge:r,wrapEdges:i,interactive:n,backgroundColor:s,width:l,height:m,className:I,style:M}=e,h=Nr[o??"default"]||{},x=G.useRef(null),E=G.useRef(null);return G.useImperativeHandle(d,()=>({randomize:()=>{var L;return(L=E.current)==null?void 0:L.randomize()},clear:()=>{var L;return(L=E.current)==null?void 0:L.clear()},pause:()=>{var L;return(L=E.current)==null?void 0:L.pause()},resume:()=>{var L;return(L=E.current)==null?void 0:L.resume()},get canvas(){return x.current}}),[]),Yr(x,{cellSize:g??h.cellSize??8,speed:y??h.speed??10,initialDensity:t??h.initialDensity??.3,aliveColor:c??h.aliveColor??"#ffffff",oldColor:C??h.oldColor??"#6b7280",deadColor:a??h.deadColor??"#111111",showAge:r??h.showAge??!0,wrapEdges:i??h.wrapEdges??!0,interactive:n??h.interactive??!0,backgroundColor:s??h.backgroundColor??"#111111"},E),ct.jsx("div",{className:I,style:{width:l??"100%",height:m??"100%",display:"block",overflow:"hidden",cursor:"crosshair",...M},children:ct.jsx("canvas",{ref:x,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});Go.displayName="GameOfLife";function Ur(e,d,o){const g=Math.hypot(e.vx,e.vy)||1,y=Math.hypot(d,o)||1;return(e.vx*d+e.vy*o)/(g*y)>-.7}function _r(e,d,o){let g=0,y=0,t=0,c=0,C=0,a=0,r=0,i=0,n=0;const s=o.separationRadius**2,l=o.alignmentRadius**2,m=o.cohesionRadius**2;for(const h of d){if(h===e)continue;const x=h.x-e.x,E=h.y-e.y,L=x*x+E*E;L>m&&L>l&&L>s||Ur(e,x,E)&&(L<s&&L>0&&(g-=x/L,y-=E/L),L<l&&(t+=h.vx,c+=h.vy,r++),L<m&&(C+=h.x,a+=h.y,i++,n=Math.max(n,h.fear)))}let I=g*o.separationForce*25,M=y*o.separationForce*25;return r&&(I+=(t/r-e.vx)*o.alignmentForce,M+=(c/r-e.vy)*o.alignmentForce),i&&(I+=(C/i-e.x)*o.cohesionForce*.02,M+=(a/i-e.y)*o.cohesionForce*.02),[I,M,n*.93]}function Vr(e){const d=G.useRef(e);d.current=e;const o=G.useRef({boids:[],t:0,w:0,h:0}).current,g=Rt(),y=G.useRef(null);function t(){const a=Math.random()*Math.PI*2,r=d.current.maxSpeed*(.6+Math.random()*.4);return{x:Math.random()*o.w,y:Math.random()*o.h,vx:Math.cos(a)*r,vy:Math.sin(a)*r,z:.6+Math.random()*.4,flap:Math.random()*Math.PI*2,bank:0,fear:0,wander:Math.random()*100,trail:[]}}function c(a,r,i,n,s){const l=d.current,m=n/16.67;o.t+=n*.001;const I=o.t;s.overlay||(a.fillStyle=l.backgroundColor,a.fillRect(0,0,r,i));const M=l.count>0?Math.max(1,Math.ceil(l.count*s.quality)):0,h=o.boids;for(;h.length<M;)h.push(t());h.length>M&&(h.length=M);const x=Math.max(20,l.separationRadius,l.alignmentRadius,l.cohesionRadius),E=Math.ceil(r/x)+1,L=new Map;for(const T of h){const $=Math.floor(T.y/x)*E+Math.floor(T.x/x),u=L.get($);u?u.push(T):L.set($,[T])}const F=kt(g.current,y.current),B=l.interactive&&F.inside,j=[[r*(.5+.35*Math.sin(I*.11)),i*(.5+.3*Math.sin(I*.17+1))],[r*(.5+.35*Math.sin(I*.13+2.5)),i*(.5+.3*Math.cos(I*.09))]],H=[];for(const T of h){H.length=0;const $=Math.floor(T.x/x),u=Math.floor(T.y/x);for(let W=u-1;W<=u+1;W++)for(let k=$-1;k<=$+1;k++){const q=L.get(W*E+k);if(q)for(const P of q)H.push(P)}let[S,R,v]=_r(T,H,l);T.fear=Math.max(T.fear*Math.pow(.97,m),v),T.wander+=.05*m,S+=Math.cos(T.wander*1.3)*.02,R+=Math.sin(T.wander)*.02;const A=j[T.z>.8?0:1];if(S+=(A[0]-T.x)*4e-5*l.maxSpeed,R+=(A[1]-T.y)*4e-5*l.maxSpeed,B){const W=T.x-F.x,k=T.y-F.y,q=Math.hypot(W,k);if(q<l.mouseRadius){const P=(1-q/l.mouseRadius)*l.mouseForce;S+=W/(q||1)*P*4,R+=k/(q||1)*P*4,T.fear=1}}l.wrapEdges||(T.x<60&&(S+=(60-T.x)*.002),T.x>r-60&&(S-=(T.x-(r-60))*.002),T.y<60&&(R+=(60-T.y)*.002),T.y>i-60&&(R-=(T.y-(i-60))*.002));const p=Math.atan2(T.vy,T.vx);T.vx+=S*m,T.vy+=R*m;const f=l.maxSpeed*(1+T.fear*.8),b=l.maxSpeed*.45,z=Math.hypot(T.vx,T.vy)||1,w=Math.max(b,Math.min(f,z));T.vx=T.vx/z*w,T.vy=T.vy/z*w;const D=Math.atan2(Math.sin(Math.atan2(T.vy,T.vx)-p),Math.cos(Math.atan2(T.vy,T.vx)-p));if(T.bank+=(Math.max(-1,Math.min(1,D*10))-T.bank)*.15*m,T.flap+=(.25+T.fear*.35+Math.max(0,w-l.maxSpeed*.7)*.1)*m,T.x+=T.vx*m,T.y+=T.vy*m,l.wrapEdges){let W=!1;T.x<-10&&(T.x+=r+20,W=!0),T.x>r+10&&(T.x-=r+20,W=!0),T.y<-10&&(T.y+=i+20,W=!0),T.y>i+10&&(T.y-=i+20,W=!0),W&&(T.trail.length=0)}for(T.trail.push(T.x,T.y);T.trail.length>Math.max(0,l.trailLength)*2;)T.trail.splice(0,2)}if(l.trailLength>1&&l.trailOpacity>0){const T=[new Path2D,new Path2D,new Path2D];for(const $ of h){const u=$.trail.length/2;for(let S=1;S<u;S++){const R=Math.min(2,Math.floor(S/u*3));T[R].moveTo($.trail[(S-1)*2],$.trail[(S-1)*2+1]),T[R].lineTo($.trail[S*2],$.trail[S*2+1])}}a.lineCap="round";for(let $=0;$<3;$++)a.strokeStyle=ut(l.color,l.trailOpacity*(.2+$*.35)),a.lineWidth=.6+$*.5,a.stroke(T[$])}const O=[new Path2D,new Path2D];for(const T of h){const $=Math.atan2(T.vy,T.vx),u=l.boidSize*T.z,S=Math.cos($),R=Math.sin($),v=(U,Y)=>[T.x+U*S-Y*R,T.y+U*R+Y*S],A=Math.sin(T.flap),p=u*(1.1+.5*A),f=u*(.35-.25*A),b=p*(1+T.bank*.35),z=p*(1-T.bank*.35),w=O[T.z>.8?1:0],D=v(u*1.1,0),W=v(-u*.9,0),k=v(-f,-b),q=v(-f,z),P=v(u*.15,-u*.2),N=v(u*.15,u*.2);w.moveTo(D[0],D[1]),w.lineTo(P[0],P[1]),w.lineTo(k[0],k[1]),w.lineTo(v(-u*.25,-u*.12)[0],v(-u*.25,-u*.12)[1]),w.lineTo(W[0],W[1]),w.lineTo(v(-u*.25,u*.12)[0],v(-u*.25,u*.12)[1]),w.lineTo(q[0],q[1]),w.lineTo(N[0],N[1]),w.closePath()}a.fillStyle=l.color,a.globalAlpha=.6,a.fill(O[0]),a.globalAlpha=1,a.fill(O[1])}const C=xt({onResize:(a,r)=>{o.w=a,o.h=r,o.boids=Array.from({length:d.current.count},t)},onFrame:c});return y.current=C.canvas,C}const Kr={default:{color:"#0891B2",backgroundColor:"#030d1a"},monochrome:{color:"#ffffff",backgroundColor:"#111111"},birds:{color:"#94a3b8",backgroundColor:"#0f172a",trailLength:12,boidSize:7,count:60,maxSpeed:2.5},fish:{color:"#0891B2",backgroundColor:"#030d1a",alignmentRadius:40,cohesionForce:.05,trailLength:6,boidSize:5},swarm:{color:"#f59e0b",backgroundColor:"#050010",count:200,boidSize:4,trailLength:4,maxSpeed:4,separationRadius:15,alignmentRadius:35,cohesionRadius:40},neon:{color:"#00ffff",backgroundColor:"#000000",trailOpacity:.6,trailLength:15,boidSize:6}},jo=G.forwardRef((e,d)=>{const{preset:o,count:g,maxSpeed:y,separationRadius:t,alignmentRadius:c,cohesionRadius:C,separationForce:a,alignmentForce:r,cohesionForce:i,color:n,trailLength:s,trailOpacity:l,boidSize:m,backgroundColor:I,interactive:M,mouseRadius:h,mouseForce:x,wrapEdges:E,width:L,height:F,className:B,style:j}=e,H=Kr[o??"default"]||{},{canvasRef:O,canvas:T}=Vr({count:g??H.count??80,maxSpeed:y??H.maxSpeed??3,separationRadius:t??H.separationRadius??25,alignmentRadius:c??H.alignmentRadius??50,cohesionRadius:C??H.cohesionRadius??60,separationForce:a??H.separationForce??.05,alignmentForce:r??H.alignmentForce??.05,cohesionForce:i??H.cohesionForce??.03,color:n??H.color??"#ffffff",trailLength:s??H.trailLength??8,trailOpacity:l??H.trailOpacity??.4,boidSize:m??H.boidSize??6,backgroundColor:I??H.backgroundColor??"#111111",interactive:M??H.interactive??!0,mouseRadius:h??H.mouseRadius??80,mouseForce:x??H.mouseForce??.2,wrapEdges:E??H.wrapEdges??!0});return G.useImperativeHandle(d,()=>T,[T]),ct.jsx(vt,{canvasRef:O,width:L,height:F,className:B,style:j})});jo.displayName="Boids";function ro(e){const d=e.replace("#",""),o=d.length===3?d.split("").map(y=>y+y).join(""):d,g=parseInt(o,16)||0;return[g>>16&255,g>>8&255,g&255]}function Jr(e,d){const o=G.useRef(d);o.current=d;const g=G.useRef(0),y=G.useRef(null);G.useEffect(()=>{const t=e.current;if(!t)return;const c=t.parentElement;if(!c)return;const C=t.getContext("2d");let a=0,r=0;function i(T,$){const u=T*$,S=new Float32Array(u).fill(1),R=new Float32Array(u).fill(0),v=Math.max(5,Math.floor(T*$/1e3));for(let b=0;b<v;b++){const z=Math.floor(Math.random()*T),w=Math.floor(Math.random()*$),D=Math.floor(2+Math.random()*5);for(let W=-D;W<=D;W++)for(let k=-D;k<=D;k++)if(k*k+W*W<=D*D){const q=(z+k+T)%T,N=(w+W+$)%$*T+q;S[N]=.5+(Math.random()-.5)*.1,R[N]=.25+Math.random()*.1}}const A=new OffscreenCanvas(T,$),p=A.getContext("2d"),f=p.createImageData(T,$);for(let b=0;b<u;b++)f.data[b*4+3]=255;y.current={u:S,v:R,uNext:new Float32Array(u),vNext:new Float32Array(u),gw:T,gh:$,imageData:f,offscreen:A,offCtx:p}}function n(T,$){const u=window.devicePixelRatio||1;a=T,r=$,t.width=Math.round(a*u),t.height=Math.round(r*u),t.style.width=`${a}px`,t.style.height=`${r}px`,C.setTransform(u,0,0,u,0,0);const{resolution:S}=o.current,R=Math.max(4,Math.round(a*S)),v=Math.max(4,Math.round(r*S));i(R,v)}const s=new ResizeObserver(T=>{const{width:$,height:u}=T[0].contentRect;$>0&&u>0&&n($,u)});s.observe(c);const l=c.getBoundingClientRect();l.width>0&&l.height>0&&n(l.width,l.height);let m=!1,I=!1,M=-1,h=-1;function x(T,$){const u=y.current;if(!u)return;const S=t.getBoundingClientRect(),R=T-S.left,v=$-S.top;M=Math.floor(R/a*u.gw),h=Math.floor(v/r*u.gh)}function E(T){o.current.interactive&&x(T.clientX,T.clientY)}function L(T){o.current.interactive&&(m=!0,I=!0,x(T.clientX,T.clientY))}function F(){m=!1,I||(M=-1,h=-1)}function B(){m=!1,M=-1,h=-1}c.addEventListener("mousemove",E),c.addEventListener("mousedown",L),c.addEventListener("mouseup",F),c.addEventListener("mouseleave",B);function j(){const T=y.current;if(!T)return;const{u:$,v:u,uNext:S,vNext:R,gw:v,gh:A}=T,{feedRate:p,killRate:f,diffusionU:b,diffusionV:z}=o.current;if((m||I)&&M>=0&&h>=0){I=!1;const w=3;for(let D=-w;D<=w;D++)for(let W=-w;W<=w;W++)if(W*W+D*D<=w*w){const k=(M+W+v)%v,P=(h+D+A)%A*v+k;$[P]=.5,u[P]=.25}}for(let w=0;w<A;w++){const D=(w-1+A)%A*v,W=(w+1)%A*v,k=w*v;for(let q=0;q<v;q++){const P=k+q,N=(q-1+v)%v,U=(q+1)%v,Y=$[k+N]+$[k+U]+$[D+q]+$[W+q]-4*$[P],X=u[k+N]+u[k+U]+u[D+q]+u[W+q]-4*u[P],_=$[P]*u[P]*u[P];S[P]=Math.max(0,Math.min(1,$[P]+b*Y-_+p*(1-$[P]))),R[P]=Math.max(0,Math.min(1,u[P]+z*X+_-(p+f)*u[P]))}}T.u.set(S),T.v.set(R)}function H(){const T=y.current;if(!T)return;const{u:$,v:u,gw:S,gh:R,imageData:v,offscreen:A,offCtx:p}=T,{colorA:f,colorB:b,backgroundColor:z}=o.current,[w,D,W]=ro(f),[k,q,P]=ro(b),N=v.data,U=-.6,Y=-.8;for(let X=0;X<R;X++){const _=X>0?-S:0,V=X<R-1?S:0;for(let Q=0;Q<S;Q++){const ot=X*S+Q,tt=Math.max(0,Math.min(1,u[ot]*3.5)),at=(u[Q<S-1?ot+1:ot]-u[Q>0?ot-1:ot])*3.5,K=(u[ot+V]-u[ot+_])*3.5,J=Math.max(.35,Math.min(1.35,.95-(at*U+K*Y)*2.2)),nt=Math.pow(Math.max(0,-(at*U+K*Y)*2.4-.25),3)*tt*.75,st=(1-$[ot]*.12)*J,rt=ot*4;N[rt]=Math.min(255,(w+(k-w)*tt)*st+nt*255),N[rt+1]=Math.min(255,(D+(q-D)*tt)*st+nt*255),N[rt+2]=Math.min(255,(W+(P-W)*tt)*st+nt*255)}}p.putImageData(v,0,0),z&&z!=="transparent"&&(C.fillStyle=z,C.fillRect(0,0,a,r)),C.imageSmoothingEnabled=!0,C.imageSmoothingQuality="high",C.drawImage(A,0,0,a,r)}function O(){const{speed:T}=o.current,$=Math.max(1,Math.round(T));for(let u=0;u<$;u++)j();H(),g.current=requestAnimationFrame(O)}return g.current=requestAnimationFrame(O),()=>{s.disconnect(),cancelAnimationFrame(g.current),c.removeEventListener("mousemove",E),c.removeEventListener("mousedown",L),c.removeEventListener("mouseup",F),c.removeEventListener("mouseleave",B)}},[e,d.resolution])}const Qr={default:{colorA:"#04121f",colorB:"#5eead4",backgroundColor:"#04121f"},monochrome:{},coral:{feedRate:.055,killRate:.062},spots:{feedRate:.035,killRate:.065},maze:{feedRate:.029,killRate:.057},waves:{feedRate:.014,killRate:.053,speed:6},neon:{feedRate:.055,killRate:.062,colorA:"#0a0a0a",colorB:"#00ffff",backgroundColor:"#0a0a0a"}},Xo=G.forwardRef((e,d)=>{const{preset:o,feedRate:g,killRate:y,diffusionU:t,diffusionV:c,resolution:C,speed:a,colorA:r,colorB:i,backgroundColor:n,interactive:s,width:l,height:m,className:I,style:M}=e,h=Qr[o??"default"]||{},x=G.useRef(null);return G.useImperativeHandle(d,()=>x.current),Jr(x,{feedRate:g??h.feedRate??.055,killRate:y??h.killRate??.062,diffusionU:t??h.diffusionU??.2,diffusionV:c??h.diffusionV??.1,resolution:C??h.resolution??.5,speed:a??h.speed??8,colorA:r??h.colorA??"#111111",colorB:i??h.colorB??"#ffffff",backgroundColor:n??h.backgroundColor??"#111111",interactive:s??!0}),ct.jsx("div",{className:I,style:{width:l??"100%",height:m??"100%",display:"block",overflow:"hidden",cursor:"crosshair",...M},children:ct.jsx("canvas",{ref:x,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});Xo.displayName="ReactionDiffusion";function Zr(e){const d=e.replace("#",""),o=d.length===3?d.split("").map(y=>y+y).join(""):d,g=parseInt(o,16)||0;return[g>>16&255,g>>8&255,g&255]}function ta(e,d){const o=G.useRef(d);o.current=d;const g=G.useRef(0),y=G.useRef(0),t=G.useRef([]),c=G.useRef([]);G.useEffect(()=>{const C=e.current;if(!C)return;const a=C.parentElement;if(!a)return;const r=C.getContext("2d");let i=0,n=0;function s(F,B){const{starCount:j}=o.current;t.current=Array.from({length:j},()=>({x:Math.random()*F,y:Math.random()*B*.7,r:.3+Math.random()*1.2,opacity:.4+Math.random()*.6}))}function l(F){const{layers:B}=o.current;c.current=Array.from({length:B},(j,H)=>({colorIndex:H%Math.max(1,o.current.colors.length),freqOffset:.5+Math.random()*1.5,ampScale:.4+Math.random()*.6,speedScale:.3+Math.random()*.7,yCenter:.15+H/Math.max(1,B-1)*.45,thickness:.06+Math.random()*.1,phase:Math.random()*Math.PI*2}))}function m(F,B){const j=window.devicePixelRatio||1;i=F,n=B,C.width=Math.round(i*j),C.height=Math.round(n*j),C.style.width=`${i}px`,C.style.height=`${n}px`,r.scale(j,j),s(i,n),l()}const I=new ResizeObserver(F=>{const{width:B,height:j}=F[0].contentRect;B>0&&j>0&&m(B,j)});I.observe(a);const M=a.getBoundingClientRect();M.width>0&&M.height>0&&m(M.width,M.height);let h=d.layers,x=d.starCount,E=0;function L(F){const B=E?Math.min(F-E,50):16;E=F;const{colors:j,speed:H,intensity:O,layers:T,waveAmplitude:$,waveFrequency:u,backgroundColor:S,animated:R,starCount:v}=o.current;T!==h&&(h=T,l()),v!==x&&(x=v,s(i,n)),R&&(y.current+=B*.001*H);const A=y.current;r.fillStyle=S,r.fillRect(0,0,i,n);const p=t.current;for(const w of p)r.beginPath(),r.arc(w.x,w.y,w.r,0,Math.PI*2),r.fillStyle=`rgba(255,255,255,${w.opacity*.8})`,r.fill();const f=r.globalCompositeOperation;r.globalCompositeOperation="screen";const b=Math.max(4,Math.ceil(i/4)),z=i/b;for(const w of c.current){const D=j[w.colorIndex%j.length]||"#ffffff",[W,k,q]=Zr(D),P=w.yCenter*n,N=$*n*w.ampScale,U=u*w.freqOffset,Y=w.thickness*n;r.beginPath();for(let V=0;V<=b;V++){const Q=V*z,ot=Q/i*Math.PI*2*U+A*w.speedScale+w.phase,tt=P-N*Math.sin(ot)-Y*.5;V===0?r.moveTo(Q,tt):r.lineTo(Q,tt)}for(let V=b;V>=0;V--){const Q=V*z,ot=Q/i*Math.PI*2*U+A*w.speedScale+w.phase,tt=P-N*Math.sin(ot)+Y*.5;r.lineTo(Q,tt)}r.closePath();const X=r.createLinearGradient(0,P-N-Y,0,P+N+Y);X.addColorStop(0,`rgba(${W},${k},${q},0)`),X.addColorStop(.3,`rgba(${W},${k},${q},${O*.6})`),X.addColorStop(.5,`rgba(${W},${k},${q},${O})`),X.addColorStop(.7,`rgba(${W},${k},${q},${O*.6})`),X.addColorStop(1,`rgba(${W},${k},${q},0)`),r.fillStyle=X,r.fill();const _=Math.floor(i/60);for(let V=0;V<_;V++){const Q=(V/_+A*.02*w.speedScale)%1*i,ot=P-N-Y*.5,tt=Y*2+N*2,at=r.createLinearGradient(0,ot,0,ot+tt);at.addColorStop(0,`rgba(${W},${k},${q},0)`),at.addColorStop(.5,`rgba(${W},${k},${q},${O*.3})`),at.addColorStop(1,`rgba(${W},${k},${q},0)`),r.fillStyle=at,r.fillRect(Q-1,ot,2,tt)}}r.globalCompositeOperation=f,g.current=requestAnimationFrame(L)}return g.current=requestAnimationFrame(L),()=>{I.disconnect(),cancelAnimationFrame(g.current)}},[e])}const ea={default:{colors:["#00ff88","#00ccff","#88ff00"],backgroundColor:"#050a0f"},monochrome:{},arctic:{colors:["#00ff88","#00ccff","#88ff00"],backgroundColor:"#050a0f"},solar:{colors:["#ff4400","#ff8800","#cc00ff"],backgroundColor:"#0a0005"},tropical:{colors:["#00ffcc","#0088ff","#00ff44"],backgroundColor:"#030a0a"},neon:{colors:["#ff00ff","#00ffff","#ff0088"],backgroundColor:"#000000",intensity:1},midnight:{colors:["#4400cc","#0033ff","#2200aa"],backgroundColor:"#000005"}},Ho=G.forwardRef((e,d)=>{const{preset:o,colors:g,speed:y,intensity:t,layers:c,backgroundColor:C,waveAmplitude:a,waveFrequency:r,starCount:i,animated:n,width:s,height:l,className:m,style:I}=e,M=ea[o??"default"]||{},h=G.useRef(null);return G.useImperativeHandle(d,()=>h.current),ta(h,{colors:g??M.colors??["#ffffff","#6b7280","#9ca3af"],speed:y??M.speed??1,intensity:t??M.intensity??.8,layers:c??5,backgroundColor:C??M.backgroundColor??"#111111",waveAmplitude:a??.15,waveFrequency:r??2,starCount:i??80,animated:n??!0}),ct.jsx("div",{className:m,style:{width:s??"100%",height:l??"100%",display:"block",overflow:"hidden",...I},children:ct.jsx("canvas",{ref:h,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});Ho.displayName="AuroraBorealis";function oa(e,d){for(e=Math.abs(Math.round(e)),d=Math.abs(Math.round(d));d>0;)[e,d]=[d,e%d];return e||1}function na(e,d){const o=oa(e,d);return 2*Math.PI*(d/o)}function ra(e,d){const o=G.useRef(d);o.current=d;const g=G.useRef(0);G.useEffect(()=>{const y=e.current;if(!y)return;const t=y.parentElement;if(!t)return;const c=y.getContext("2d");let C=0,a=0,r=[],i=-1,n=-1,s=-1,l=-1,m=!0;function I($,u){const S=C/2,R=a/2,v=S+($.R-$.r)*Math.cos(u)+$.d*Math.cos(($.R-$.r)/$.r*u),A=R+($.R-$.r)*Math.sin(u)-$.d*Math.sin(($.R-$.r)/$.r*u);return[v,A]}function M($,u,S){const{outerRadius:R,innerRadius:v,penDistance:A}=o.current,f=Math.min(C,a)/2*R,z=u>1?($/(u-1)-.5)*.12:0;let w,D;S?(w=f*Math.max(.05,v+z+(Math.random()-.5)*.08),D=w*Math.max(.05,A*(.85+Math.random()*.3))):(w=f*Math.max(.05,v+z),D=w*Math.max(.05,A)),w=Math.max(1,w),D=Math.max(.1,D);const W=na(f,w),k={t:0,prevX:0,prevY:0,R:f,r:w,d:D,fullPeriod:W},[q,P]=I(k,0);return k.prevX=q,k.prevY=P,k}function h($){const{outerRadius:u,innerRadius:S,penDistance:R,layerCount:v}=o.current;r=[];for(let A=0;A<v;A++)r.push(M(A,v,$));i=u,n=S,s=R,l=v}function x(){const{backgroundColor:$}=o.current;c.globalCompositeOperation="source-over",c.globalAlpha=1,c.fillStyle=$,c.fillRect(0,0,C,a)}function E($,u){const S=window.devicePixelRatio||1;C=$,a=u,y.width=Math.round(C*S),y.height=Math.round(a*S),y.style.width=`${C}px`,y.style.height=`${a}px`,c.setTransform(S,0,0,S,0,0),x(),m=!0,h(!1)}const L=new ResizeObserver($=>{const{width:u,height:S}=$[0].contentRect;u>0&&S>0&&E(u,S)});L.observe(t);const F=t.getBoundingClientRect();F.width>0&&F.height>0&&E(F.width,F.height);let B=0;function j($,u,S,R,v,A,p,f){c.strokeStyle=v,c.lineWidth=A,c.lineCap="round",p?(c.shadowColor=v,c.shadowBlur=f):c.shadowBlur=0,c.beginPath(),c.moveTo($,u),c.lineTo(S,R),c.stroke()}function H($,u,S,R,v){const A=Math.cos(v),p=Math.sin(v),f=S-$,b=R-u;return[$+f*A-b*p,u+f*p+b*A]}function O($,u){const{colors:S}=o.current,R=S.length>0?S:["#ffffff"];return R[u%R.length]}function T($){const u=B?Math.min($-B,50):16;B=$;const{outerRadius:S,innerRadius:R,penDistance:v,layerCount:A,speed:p,backgroundColor:f,lineWidth:b,trailFade:z,animated:w,autoReset:D,symmetry:W,glowEffect:k,glowBlur:q}=o.current;if(!m&&(S!==i||R!==n||v!==s||A!==l)&&(h(!1),x()),m=!1,!w){g.current=requestAnimationFrame(T);return}z>0&&(c.globalCompositeOperation="source-over",c.globalAlpha=Math.min(1,z*(u/16)),c.fillStyle=f,c.fillRect(0,0,C,a),c.globalAlpha=1),c.globalCompositeOperation="source-over";const P=p*Math.PI/180*(u/16),N=Math.max(1,Math.ceil(P/.02)),U=P/N,Y=C/2,X=a/2,_=2*Math.PI/W;let V=!1;for(let Q=0;Q<r.length;Q++){const ot=r[Q],tt=O(ot,Q);for(let at=0;at<N;at++){ot.t+=U;const[K,J]=I(ot,ot.t);for(let nt=0;nt<W;nt++){const st=nt*_,[rt,lt]=H(Y,X,ot.prevX,ot.prevY,st),[Z,et]=H(Y,X,K,J,st);j(rt,lt,Z,et,tt,b,k,q)}ot.prevX=K,ot.prevY=J}ot.t>=ot.fullPeriod&&D&&(V=!0)}k||(c.shadowBlur=0),c.globalCompositeOperation="source-over",V&&(h(!0),x()),g.current=requestAnimationFrame(T)}return g.current=requestAnimationFrame(T),()=>{L.disconnect(),cancelAnimationFrame(g.current)}},[e])}const aa={default:{colors:["#ff2244","#22aaff","#44ff88"],backgroundColor:"#050005"},monochrome:{},neon:{colors:["#00ffff","#ff00ff"],backgroundColor:"#000000",lineWidth:1.5,glowEffect:!0,glowBlur:15,trailFade:.005},prismatic:{colors:["#ff2244","#22aaff","#44ff88"],layerCount:3,symmetry:2,lineWidth:1,trailFade:.004,backgroundColor:"#050005"},mandala:{colors:["#ff00ff","#00ffff"],symmetry:6,layerCount:2,glowEffect:!0,glowBlur:12,trailFade:.002,backgroundColor:"#000000"},cosmic:{colors:["#ff4488","#44ffff","#ffff44","#44ff88"],layerCount:4,glowEffect:!0,glowBlur:10,trailFade:.002,backgroundColor:"#020008",lineWidth:1},minimal:{colors:["#ffffff"],speed:.5,lineWidth:.5,trailFade:.001}},Yo=G.forwardRef((e,d)=>{const{preset:o,outerRadius:g,innerRadius:y,penDistance:t,speed:c,colors:C,backgroundColor:a,lineWidth:r,trailFade:i,animated:n,autoReset:s,layerCount:l,symmetry:m,glowEffect:I,glowBlur:M,width:h,height:x,className:E,style:L}=e,F=aa[o??"default"]||{},B=G.useRef(null);return G.useImperativeHandle(d,()=>B.current),ra(B,{outerRadius:g??.85,innerRadius:y??F.innerRadius??.4,penDistance:t??F.penDistance??.9,speed:c??F.speed??2,colors:C??F.colors??["#ffffff"],backgroundColor:a??F.backgroundColor??"#111111",lineWidth:r??F.lineWidth??1,trailFade:i??F.trailFade??.003,animated:n??!0,autoReset:s??!0,layerCount:l??F.layerCount??2,symmetry:m??F.symmetry??1,glowEffect:I??F.glowEffect??!1,glowBlur:M??F.glowBlur??10}),ct.jsx("div",{className:E,style:{width:h??"100%",height:x??"100%",display:"block",overflow:"hidden",...L},children:ct.jsx("canvas",{ref:B,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});Yo.displayName="Spirograph";const Ct=0,Tt=1,Lt=2,Yt=3,fe=4;function oe(e){const d=e.replace("#",""),o=d.length===3?d.split("").map(y=>y+y).join(""):d,g=parseInt(o,16)||0;return[g>>16&255,g>>8&255,g&255]}function sa(e,d){const o=G.useRef(d);o.current=d;const g=G.useRef(0),y=G.useRef(null),t=G.useRef(null),c=G.useRef(null),C=G.useRef(0),a=G.useRef(0);G.useEffect(()=>{const r=e.current;if(!r)return;const i=r.parentElement;if(!i)return;const n=r.getContext("2d");let s=0,l=0,m=null,I=null,M=null;function h(z,w){C.current=z,a.current=w,y.current=new Uint8Array(z*w),t.current=new Float32Array(z*w),c.current=new Uint8Array(z*w),m=new OffscreenCanvas(z,w),I=m.getContext("2d"),M=I.createImageData(z,w)}function x(z,w){const D=window.devicePixelRatio||1;s=z,l=w,r.width=Math.round(s*D),r.height=Math.round(l*D),r.style.width=`${s}px`,r.style.height=`${l}px`,n.setTransform(D,0,0,D,0,0);const{cellSize:W}=o.current,k=Math.max(4,Math.floor(s/W)),q=Math.max(4,Math.floor(l/W));h(k,q)}const E=new ResizeObserver(z=>{const{width:w,height:D}=z[0].contentRect;w>0&&D>0&&x(w,D)});E.observe(i);const L=i.getBoundingClientRect();L.width>0&&L.height>0&&x(L.width,L.height);let F=!1;function B(z,w){const D=r.getBoundingClientRect(),W=z-D.left,k=w-D.top,q=C.current,P=a.current;return[Math.floor(W/s*q),Math.floor(k/l*P)]}function j(z,w){const D=y.current,W=t.current;if(!D||!W)return;const k=C.current,q=a.current,{brushSize:P,material:N}=o.current;for(let U=-P;U<=P;U++)for(let Y=-P;Y<=P;Y++){if(Y*Y+U*U>P*P)continue;const X=z+Y,_=w+U;if(X<0||X>=k||_<0||_>=q)continue;const V=_*k+X;N==="erase"?(D[V]=Ct,W[V]=0):N==="sand"?(D[V]=Tt,c.current[V]=(u&3)<<6|(Math.random()*63|0)):N==="water"?D[V]=Lt:N==="fire"?(D[V]=Yt,W[V]=1):N==="wall"&&(D[V]=fe)}}function H(z){o.current.interactive&&(F=!0,j(...B(z.clientX,z.clientY)))}function O(z){!o.current.interactive||!F||j(...B(z.clientX,z.clientY))}function T(){F=!1}function $(){F=!1}r.addEventListener("mousedown",H),r.addEventListener("mousemove",O),r.addEventListener("mouseup",T),r.addEventListener("mouseleave",$);let u=0;function S(){const z=y.current,w=t.current,D=c.current;if(!z||!w||!D)return;const W=(P,N)=>{const U=D[N];D[N]=D[P],D[P]=U},k=C.current,q=a.current;for(let P=q-1;P>=0;P--){const N=Math.random()<.5;for(let U=0;U<k;U++){const Y=N?U:k-1-U,X=P*k+Y,_=z[X];if(_===Ct||_===fe)continue;const V=P+1<q,Q=P-1>=0,ot=Y-1>=0,tt=Y+1<k;if(_===Tt)if(V&&z[(P+1)*k+Y]===Ct)z[(P+1)*k+Y]=Tt,z[X]=Ct,W(X,(P+1)*k+Y);else if(V&&z[(P+1)*k+Y]===Lt)z[(P+1)*k+Y]=Tt,z[X]=Lt,W(X,(P+1)*k+Y);else{const at=Math.random()<.5,K=at?-1:1,J=at?1:-1,nt=at?ot:tt,st=at?tt:ot;V&&nt&&z[(P+1)*k+(Y+K)]===Ct?(z[(P+1)*k+(Y+K)]=Tt,z[X]=Ct,W(X,(P+1)*k+(Y+K))):V&&st&&z[(P+1)*k+(Y+J)]===Ct&&(z[(P+1)*k+(Y+J)]=Tt,z[X]=Ct,W(X,(P+1)*k+(Y+J)))}else if(_===Lt)if(V&&z[(P+1)*k+Y]===Ct)z[(P+1)*k+Y]=Lt,z[X]=Ct;else{const at=Math.random()<.5,K=at?-1:1,J=at?1:-1,nt=at?ot:tt,st=at?tt:ot;nt&&z[P*k+(Y+K)]===Ct?(z[P*k+(Y+K)]=Lt,z[X]=Ct):st&&z[P*k+(Y+J)]===Ct&&(z[P*k+(Y+J)]=Lt,z[X]=Ct)}else if(_===Yt){if(w[X]-=.005+Math.random()*.01,w[X]<=0){z[X]=Ct,w[X]=0;continue}Q&&z[(P-1)*k+Y]===Ct&&Math.random()<.4&&(z[(P-1)*k+Y]=Yt,w[(P-1)*k+Y]=w[X]*(.7+Math.random()*.3)),Q&&z[(P-1)*k+Y]===Tt&&Math.random()<.02&&(z[(P-1)*k+Y]=Yt,w[(P-1)*k+Y]=1);const at=Math.random()<.5?-1:1;Q&&(at===-1?ot:tt)&&z[(P-1)*k+(Y+at)]===Ct&&Math.random()<.15&&(z[(P-1)*k+(Y+at)]=Yt,w[(P-1)*k+(Y+at)]=w[X]*.6),V&&z[(P+1)*k+Y]===Lt&&(z[X]=Ct,z[(P+1)*k+Y]=Ct,w[X]=0)}}}}let R=0,v=!1;function A(){const z=y.current,w=c.current;if(!z||!w)return;const D=C.current,W=a.current;R++,R%240===0&&(u=u+1&3);for(let k=0;k<3;k++){const q=Math.round(D*(.2+k*.3+Math.sin(R*.004+k*2.1)*.12)),P=u+k&3;for(let N=0;N<3;N++){const U=q+(Math.random()*4|0)-1;if(U<0||U>=D)continue;const Y=U;z[Y]===Ct&&(z[Y]=Tt,w[Y]=P<<6|(Math.random()*63|0))}}if(R%20===0){let k=W;for(let q=0;q<D;q+=3){let P=W-1;for(;P>=0&&z[P*D+q]!==Ct;)P--;k=Math.min(k,P+1)}k<W*.38?v=!0:k>W*.62&&(v=!1)}if(v){const k=(W-1)*D;for(let q=0;q<D;q++)z[k+q]===Tt&&Math.random()<.35&&(z[k+q]=Ct)}}function p(){const z=y.current,w=t.current,D=c.current;if(!z||!w||!D||!M||!m||!I)return;const W=C.current,k=a.current,{sandColor:q,waterColor:P,fireColor:N,wallColor:U,backgroundColor:Y}=o.current,X=oe(Y),_=oe(q),V=(ft,dt,gt)=>ft.map((pt,yt)=>pt+(dt[yt]-pt)*gt),Q=[_,V(_,[246,232,196],.45),V(_,[150,96,30],.4),V(_,[176,74,38],.45)],[ot,tt,at]=oe(P),[K,J,nt]=oe(N),[st,rt,lt]=oe(U),Z=M.data,et=R*.06;for(let ft=0;ft<W;ft++){let dt=0;for(let gt=0;gt<k;gt++){const pt=gt*W+ft,yt=pt*4,wt=z[pt],St=gt>0?z[pt-W]:Ct;if(wt===Ct){Z[yt+3]=0,dt=0;continue}if(Z[yt+3]=255,wt===Tt){const Mt=Q[D[pt]>>6],Et=.88+(D[pt]&63)/63*.22,Ce=St===Ct?1.16:Math.max(.72,1-dt*.006),Zt=Et*Ce;Z[yt]=Math.min(255,Mt[0]*Zt),Z[yt+1]=Math.min(255,Mt[1]*Zt),Z[yt+2]=Math.min(255,Mt[2]*Zt),dt++}else if(wt===Lt){const Mt=St===Ct?.35:0,Et=.08*Math.sin(et+ft*.35+gt*.2);Z[yt]=Math.min(255,ot*(.85+Et)+255*Mt*.5),Z[yt+1]=Math.min(255,tt*(.85+Et)+255*Mt*.5),Z[yt+2]=Math.min(255,at*(.9+Et)+255*Mt*.5),Z[yt+3]=225}else if(wt===Yt){const Mt=Math.max(0,Math.min(1,w[pt]));Z[yt]=Math.min(255,K*(.6+Mt*.6)+80*Mt),Z[yt+1]=Math.min(255,J*Mt+120*Mt*Mt),Z[yt+2]=Math.min(255,nt*Mt*.4+60*Mt*Mt*Mt)}else if(wt===fe){const Mt=St===fe?1:1.2;Z[yt]=Math.min(255,st*Mt),Z[yt+1]=Math.min(255,rt*Mt),Z[yt+2]=Math.min(255,lt*Mt)}}}I.putImageData(M,0,0);const it=n.createLinearGradient(0,0,0,l);it.addColorStop(0,`rgb(${V(X,[255,236,200],.08).map(Math.round).join(",")})`),it.addColorStop(1,`rgb(${X.join(",")})`),n.fillStyle=it,n.fillRect(0,0,s,l),n.imageSmoothingEnabled=!1,n.drawImage(m,0,0,s,l)}let f=0;function b(){for(o.current.autoPour&&A(),f=Math.min(8,f+Math.max(0,o.current.gravity));f>=1;)S(),f-=1;p(),g.current=requestAnimationFrame(b)}return g.current=requestAnimationFrame(b),()=>{E.disconnect(),cancelAnimationFrame(g.current),r.removeEventListener("mousedown",H),r.removeEventListener("mousemove",O),r.removeEventListener("mouseup",T),r.removeEventListener("mouseleave",$)}},[e,d.cellSize])}const la={default:{sandColor:"#c8a85a",waterColor:"#0088cc",fireColor:"#ff4400",backgroundColor:"#1a1200",wallColor:"#6b4c1a"},monochrome:{},desert:{sandColor:"#c8a85a",backgroundColor:"#1a1200",wallColor:"#6b4c1a"},ocean:{waterColor:"#0088cc",backgroundColor:"#001a2e",wallColor:"#0a3a5a",material:"water"},inferno:{fireColor:"#ff4400",backgroundColor:"#0a0000",wallColor:"#2a0000",material:"fire"},neon:{sandColor:"#00ffff",waterColor:"#ff00ff",fireColor:"#ffff00",wallColor:"#00ff88",backgroundColor:"#050505"}},No=G.forwardRef((e,d)=>{const{preset:o,cellSize:g,brushSize:y,material:t,sandColor:c,waterColor:C,fireColor:a,wallColor:r,backgroundColor:i,interactive:n,gravity:s,autoPour:l,width:m,height:I,className:M,style:h}=e,x=la[o??"default"]||{},E=G.useRef(null);return G.useImperativeHandle(d,()=>E.current),sa(E,{cellSize:g??4,brushSize:y??3,material:t??x.material??"sand",sandColor:c??x.sandColor??"#ffffff",waterColor:C??x.waterColor??"#6b7280",fireColor:a??x.fireColor??"#ffffff",wallColor:r??x.wallColor??"#4b5563",backgroundColor:i??x.backgroundColor??"#111111",interactive:n??!0,gravity:s??1,autoPour:l??!0}),ct.jsx("div",{className:M,style:{width:m??"100%",height:I??"100%",display:"block",overflow:"hidden",cursor:"crosshair",...h},children:ct.jsx("canvas",{ref:E,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});No.displayName="SandSimulation";function $e(e){const d=e.replace("#",""),o=d.length===3?d.split("").map(y=>y+y).join(""):d,g=parseInt(o,16)||0;return[g>>16&255,g>>8&255,g&255]}function ia(e,d){const o=G.useRef(d);o.current=d;const g=G.useRef(0),y=G.useRef(0),t=G.useRef([]);G.useEffect(()=>{const c=e.current;if(!c)return;const C=c.parentElement;if(!C)return;const a=c.getContext("2d");let r=0,i=0,n=null,s=null,l=null,m=0,I=0;function M(){t.current=[{x:r*.35,y:i*.5},{x:r*.65,y:i*.5}]}function h(H,O){const T=window.devicePixelRatio||1;r=H,i=O,c.width=Math.round(r*T),c.height=Math.round(i*T),c.style.width=`${r}px`,c.style.height=`${i}px`,a.scale(T,T);const{resolution:$}=o.current;m=Math.max(4,Math.round(r*$)),I=Math.max(4,Math.round(i*$)),n=new OffscreenCanvas(m,I),s=n.getContext("2d"),l=s.createImageData(m,I),M()}const x=new ResizeObserver(H=>{const{width:O,height:T}=H[0].contentRect;O>0&&T>0&&h(O,T)});x.observe(C);const E=C.getBoundingClientRect();E.width>0&&E.height>0&&h(E.width,E.height);const L=16;function F(H){const O=c.getBoundingClientRect(),T=H.clientX-O.left,$=H.clientY-O.top,u=t.current,{maxSources:S}=o.current;for(let R=0;R<u.length;R++){const v=u[R].x-T,A=u[R].y-$;if(v*v+A*A<L*L){u.splice(R,1);return}}u.length<S&&u.push({x:T,y:$})}c.addEventListener("click",F);let B=0;function j(H){const O=B?Math.min(H-B,50):16;B=H;const{wavelength:T,speed:$,colorHigh:u,colorLow:S,showSources:R,animated:v,decay:A,backgroundColor:p}=o.current,f=t.current;v&&(y.current+=O*.001*$);const b=y.current,[z,w,D]=$e(S),[W,k,q]=$e(u),[P,N,U]=$e(p),Y=l.data,X=2*Math.PI/T,_=X*($*60),V=Math.max(1,f.length),Q=r/m,ot=i/I;for(let tt=0;tt<I;tt++)for(let at=0;at<m;at++){const K=(at+.5)*Q,J=(tt+.5)*ot;let nt=0,st=0;for(const ft of f){const dt=K-ft.x,gt=J-ft.y,pt=Math.sqrt(dt*dt+gt*gt),yt=Math.exp(-A*pt);nt+=yt*Math.cos(X*pt-_*b),st+=yt}const rt=Math.min(1,st/V/.15),lt=rt*rt*(3-2*rt),Z=(nt/V+1)*.5,et=Math.max(0,Math.min(1,Z)),it=(tt*m+at)*4;Y[it]=Math.round(P+(z+(W-z)*et-P)*lt),Y[it+1]=Math.round(N+(w+(k-w)*et-N)*lt),Y[it+2]=Math.round(U+(D+(q-D)*et-U)*lt),Y[it+3]=255}if(s.putImageData(l,0,0),a.imageSmoothingEnabled=!0,a.imageSmoothingQuality="low",a.drawImage(n,0,0,r,i),R)for(const tt of f)a.beginPath(),a.arc(tt.x,tt.y,8,0,Math.PI*2),a.strokeStyle=u,a.lineWidth=2,a.stroke(),a.beginPath(),a.moveTo(tt.x-5,tt.y),a.lineTo(tt.x+5,tt.y),a.moveTo(tt.x,tt.y-5),a.lineTo(tt.x,tt.y+5),a.stroke();g.current=requestAnimationFrame(j)}return g.current=requestAnimationFrame(j),()=>{x.disconnect(),cancelAnimationFrame(g.current),c.removeEventListener("click",F)}},[e,d.resolution])}const ca={default:{colorHigh:"#88ccff",colorLow:"#001133"},monochrome:{},ripple:{colorHigh:"#88ccff",colorLow:"#001133",wavelength:100},plasma:{colorHigh:"#ff4400",colorLow:"#000033",wavelength:60,decay:.001},neon:{colorHigh:"#00ffff",colorLow:"#000000",wavelength:70},cosmic:{colorHigh:"#cc88ff",colorLow:"#050005",decay:.002}},Uo=G.forwardRef((e,d)=>{const{preset:o,maxSources:g,wavelength:y,speed:t,colorHigh:c,colorLow:C,backgroundColor:a,showSources:r,resolution:i,animated:n,decay:s,width:l,height:m,className:I,style:M}=e,h=ca[o??"default"]||{},x=G.useRef(null);return G.useImperativeHandle(d,()=>x.current),ia(x,{maxSources:g??6,wavelength:y??h.wavelength??80,speed:t??1,colorHigh:c??h.colorHigh??"#ffffff",colorLow:C??h.colorLow??"#111111",backgroundColor:a??h.backgroundColor??"#111111",showSources:r??!1,resolution:i??.4,animated:n??!0,decay:s??h.decay??.003}),ct.jsx("div",{className:I,style:{width:l??"100%",height:m??"100%",display:"block",overflow:"hidden",cursor:"crosshair",...M},children:ct.jsx("canvas",{ref:x,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});Uo.displayName="WaveInterference";const fa=[[-1,-1],[0,-1],[1,-1],[-1,0],[1,0],[-1,1],[0,1],[1,1]],ao=[[-1,-1],[0,-1],[1,-1],[-1,0],[1,0],[-1,1],[0,1],[1,1]];function da(e,d){const o=G.useRef(d);o.current=d;const g=G.useRef(0);G.useEffect(()=>{const y=e.current;if(!y)return;const t=y.parentElement;if(!t)return;const c=y.getContext("2d");let C=0,a=0,r=0,i=0,n=null,s=[],l=0;function m(R,v){return v*r+R}function I(R,v){return R<0||R>=r||v<0||v>=i?!1:n[m(R,v)]===1}function M(R,v){for(const[A,p]of fa)if(I(R+A,v+p))return!0;return!1}function h(R,v){R<0||R>=r||v<0||v>=i||(n[m(R,v)]=1)}function x(R,v){const{particleSize:A}=o.current;return[Math.floor(R/A),Math.floor(v/A)]}function E(R,v){const{particleSize:A}=o.current;return[R*A+A*.5,v*A+A*.5]}function L(){const{seedMode:R}=o.current;if(R==="bottom")return{x:Math.floor(Math.random()*r),y:0};const v=Math.random()*Math.PI*2,A=Math.min(l,Math.floor(Math.min(r,i)*.48)),p=r/2,f=i/2;return{x:Math.max(0,Math.min(r-1,Math.round(p+Math.cos(v)*A))),y:Math.max(0,Math.min(i-1,Math.round(f+Math.sin(v)*A)))}}function F(R,v,A){const[p,f]=E(R,v),{particleColor:b,walkerColor:z,particleSize:w,glowEffect:D,glowBlur:W}=o.current;D&&A?(c.shadowColor=b,c.shadowBlur=W):c.shadowBlur=0;const k=w*.5;c.fillStyle=A?b:z,c.beginPath(),c.arc(p,f,k,0,Math.PI*2),c.fill(),c.shadowBlur=0}function B(R,v){const[A,p]=E(R,v),{particleSize:f,backgroundColor:b}=o.current,z=f*.5+1;c.fillStyle=b,c.beginPath(),c.arc(A,p,z,0,Math.PI*2),c.fill()}function j(){const{seedMode:R}=o.current;if(n)if(R==="bottom")for(let v=0;v<r;v++)h(v,i-1),F(v,i-1,!0);else if(R==="ring"){const v=Math.floor(r/2),A=Math.floor(i/2),p=Math.max(2,Math.floor(Math.min(r,i)*.04));for(let f=0;f<Math.PI*2;f+=.15){const b=Math.round(v+Math.cos(f)*p),z=Math.round(A+Math.sin(f)*p);b>=0&&b<r&&z>=0&&z<i&&(h(b,z),F(b,z,!0))}}else{const v=Math.floor(r/2),A=Math.floor(i/2);h(v,A),F(v,A,!0)}}function H(R,v){const{particleSize:A,walkerCount:p}=o.current;r=Math.max(4,Math.floor(R/A)),i=Math.max(4,Math.floor(v/A)),n=new Uint8Array(r*i),l=Math.floor(Math.min(r,i)*.05),c.fillStyle=o.current.backgroundColor,c.fillRect(0,0,C,a),j(),s=[];for(let f=0;f<p;f++)s.push(L())}function O(R,v){const A=window.devicePixelRatio||1;C=R,a=v,y.width=Math.round(C*A),y.height=Math.round(a*A),y.style.width=`${C}px`,y.style.height=`${a}px`,c.setTransform(A,0,0,A,0,0),H(C,a)}const T=new ResizeObserver(R=>{const{width:v,height:A}=R[0].contentRect;v>0&&A>0&&O(v,A)});T.observe(t);const $=t.getBoundingClientRect();$.width>0&&$.height>0&&O($.width,$.height);function u(R){if(!o.current.interactive||!n)return;const v=y.getBoundingClientRect(),A=R.clientX-v.left,p=R.clientY-v.top,[f,b]=x(A,p);f>=0&&f<r&&b>=0&&b<i&&(h(f,b),F(f,b,!0))}y.addEventListener("click",u);function S(){if(!n){g.current=requestAnimationFrame(S);return}const{stepsPerFrame:R,walkerCount:v,showWalkers:A,seedMode:p}=o.current;for(let f=0;f<R;f++)for(let b=0;b<s.length;b++){const z=s[b],w=z.x,D=z.y;A&&B(w,D);const W=ao[Math.floor(Math.random()*ao.length)];let k=z.x+W[0],q=z.y+W[1];if(k=Math.max(0,Math.min(r-1,k)),q=p==="bottom"?Math.max(0,Math.min(i-2,q)):Math.max(0,Math.min(i-1,q)),z.x=k,z.y=q,M(k,q)&&!I(k,q)){if(h(k,q),F(k,q,!0),p!=="bottom"){const P=r/2,N=i/2,U=Math.sqrt((k-P)**2+(q-N)**2);l=Math.min(Math.floor(Math.min(r,i)*.48),Math.max(l,Math.ceil(U)+3))}s.length<=v&&(s[b]=L())}else A&&F(k,q,!1)}g.current=requestAnimationFrame(S)}return g.current=requestAnimationFrame(S),()=>{T.disconnect(),cancelAnimationFrame(g.current),y.removeEventListener("click",u)}},[e,d.particleSize,d.seedMode])}const ua={default:{particleColor:"#ff7043",walkerColor:"#ff7043",backgroundColor:"#0a0500"},monochrome:{},coral:{particleColor:"#ff7043",walkerColor:"#ff7043",backgroundColor:"#0a0500",glowEffect:!0,glowBlur:6},snowflake:{particleColor:"#a8d8ff",walkerColor:"#a8d8ff",backgroundColor:"#020510",seedMode:"center",glowEffect:!0,glowBlur:8},lightning:{particleColor:"#fffde7",walkerColor:"#fff59d",backgroundColor:"#050510",seedMode:"bottom",glowEffect:!0,glowBlur:10},neon:{particleColor:"#00ffcc",walkerColor:"#ff00ff",backgroundColor:"#000000",glowEffect:!0,glowBlur:12},frost:{particleColor:"#e0f7fa",walkerColor:"#80deea",backgroundColor:"#011820",seedMode:"ring",glowEffect:!0,glowBlur:6}},_o=G.forwardRef((e,d)=>{const{preset:o,particleColor:g,walkerColor:y,backgroundColor:t,particleSize:c,walkerCount:C,stepsPerFrame:a,seedMode:r,showWalkers:i,glowEffect:n,glowBlur:s,interactive:l,width:m,height:I,className:M,style:h}=e,x=ua[o??"default"]||{},E=G.useRef(null);return G.useImperativeHandle(d,()=>E.current),da(E,{particleColor:g??x.particleColor??"#ffffff",walkerColor:y??x.walkerColor??"#6b7280",backgroundColor:t??x.backgroundColor??"#111111",particleSize:c??x.particleSize??3,walkerCount:C??60,stepsPerFrame:a??20,seedMode:r??x.seedMode??"center",showWalkers:i??!1,glowEffect:n??x.glowEffect??!0,glowBlur:s??x.glowBlur??8,interactive:l??!0}),ct.jsx("div",{className:M,style:{width:m??"100%",height:I??"100%",display:"block",overflow:"hidden",cursor:"crosshair",...h},children:ct.jsx("canvas",{ref:E,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});_o.displayName="DiffusionAggregation";const Te=25e4;function ha(e,d,o){let g=e;for(let y=0;y<o;y++){let t="";for(const c of g){const C=d[c];if(C?t+=C:t+=c,t.length>=Te){t=t.slice(0,Te);break}}if(g=t,g.length>=Te)break}return g}function ga(e,d,o,g){let y=0,t=0,c=-Math.PI/2;const C=[],a=[],r=[],i=[];let n=-1;for(const O of e)switch(O){case"F":case"G":{const T=y+Math.cos(c),$=t+Math.sin(c);a.push(y,t,T,$),r.push(C.length),i.push(0),n=r.length-1,y=T,t=$;break}case"f":y+=Math.cos(c),t+=Math.sin(c);break;case"+":c+=d;break;case"-":c-=d;break;case"[":C.push({x:y,y:t,a:c});break;case"]":{n>=0&&(i[n]=1),n=-1;const T=C.pop();T&&(y=T.x,t=T.y,c=T.a);break}}n>=0&&(i[n]=1);const s={segs:new Float32Array(0),depth:new Uint8Array(0),tip:new Uint8Array(0),maxDepth:0,upright:!1,baseY:g};if(a.length===0)return s;let l=1/0,m=-1/0,I=1/0,M=-1/0;for(let O=0;O<a.length;O+=4)l=Math.min(l,a[O],a[O+2]),m=Math.max(m,a[O],a[O+2]),I=Math.min(I,a[O+1],a[O+3]),M=Math.max(M,a[O+1],a[O+3]);const h=m-l||1,x=M-I||1,E=I<0&&M>=-.1&&C.length===0&&r.some(O=>O>0),L=Math.min(o*.88/h,g*(E?.82:.88)/x),F=o/2-(l+m)/2*L,B=E?g*.9-M*L:g/2-(I+M)/2*L,j=new Float32Array(a.length);for(let O=0;O<a.length;O+=4)j[O]=a[O]*L+F,j[O+1]=a[O+1]*L+B,j[O+2]=a[O+2]*L+F,j[O+3]=a[O+3]*L+B;let H=0;for(const O of r)H=Math.max(H,O);return{segs:j,depth:Uint8Array.from(r),tip:Uint8Array.from(i),maxDepth:H,upright:E,baseY:M*L+B}}const Wt=(e,d,o)=>e.map((g,y)=>Math.round(g+(d[y]-g)*o)).join(",");function so(e){let d=e.replace("#","");d.length===3&&(d=d.split("").map(g=>g+g).join(""));const o=parseInt(d.slice(0,6),16)||0;return[o>>16&255,o>>8&255,o&255]}function ma(e,d){const o=G.useRef(d);o.current=d,G.useEffect(()=>{const g=e.current;if(!g)return;const y=g.parentElement;if(!y)return;const t=g.getContext("2d");let c=0,C=0,a=1,r=0,i=null,n="",s=0,l=-1,m=1,I=0;const M=Array.from({length:18},()=>({x:Math.random(),y:Math.random(),s:.6+Math.random(),p:Math.random()*6})),h=()=>{const{axiom:O,rules:T,iterations:$,angle:u}=o.current;return`${O}|${JSON.stringify(T)}|${$}|${u}|${c}|${C}`};function x(){const{axiom:O,rules:T,iterations:$,angle:u}=o.current;i=ga(ha(O,T,$),u*Math.PI/180,c,C),n=h(),s=0,l=-1,m=1,I=0}function E(O,T){a=Math.min(2,window.devicePixelRatio||1),c=O,C=T,g.width=Math.round(c*a),g.height=Math.round(C*a),g.style.width=`${c}px`,g.style.height=`${C}px`,x()}const L=new ResizeObserver(O=>{const{width:T,height:$}=O[0].contentRect;T>0&&$>0&&E(T,$)});L.observe(y);const F=y.getBoundingClientRect();F.width>0&&F.height>0&&E(F.width,F.height);let B=0,j=0;function H(O){B=requestAnimationFrame(H);const T=j?Math.min(O-j,50):16;if(j=O,r+=T/1e3,c===0)return;const $=o.current;h()!==n&&x();const u=i,S=u.segs.length/4;l<0?(s=Math.min(S,s+Math.max(1,$.speed*3*(T/16))),s>=S&&$.autoReset&&(l=3500)):$.autoReset?(l-=T,l<1200&&(m=Math.max($.trailFade,l/1200)),l<=0&&(s=0,l=-1,m=1,I++)):(l=-1,m=1);const R=so($.color),v=Wt(R,[74,50,32],.78).split(",").map(Number),A=so($.backgroundColor);t.setTransform(a,0,0,a,0,0);const p=t.createLinearGradient(0,0,0,C);if(p.addColorStop(0,`rgb(${Wt(A,R,.1)})`),p.addColorStop(1,`rgb(${$.backgroundColor==="transparent"?"0,0,0":A.join(",")})`),t.fillStyle=p,t.fillRect(0,0,c,C),u.upright){const w=t.createRadialGradient(c/2,u.baseY+C*.06,0,c/2,u.baseY+C*.06,c*.45);w.addColorStop(0,`rgba(${Wt(R,[20,30,15],.6)},0.9)`),w.addColorStop(1,`rgba(${Wt(R,[20,30,15],.6)},0)`),t.fillStyle=w,t.beginPath(),t.ellipse(c/2,u.baseY+C*.06,c*.45,C*.09,0,0,Math.PI*2),t.fill()}const f=(w,D,W)=>{if(!u.upright)return w;const k=Math.max(0,(u.baseY-D)/C);return w+Math.sin(r*1.1+D*.012)*k*k*14*(.4+W/(u.maxDepth+1))};t.lineCap="round",t.lineJoin="round";const b=Math.floor(s);$.trailFade>0&&I>0&&b<S&&z(b,S,Math.min(1,$.trailFade)),z(0,b,m),t.globalAlpha=1;function z(w,D,W){if(t.globalAlpha=W,u.upright){for(let q=0;q<=u.maxDepth;q++){const P=u.maxDepth?q/u.maxDepth:1;t.beginPath();for(let N=w;N<D;N++){if(u.depth[N]!==q)continue;const U=N*4;t.moveTo(f(u.segs[U],u.segs[U+1],q),u.segs[U+1]),t.lineTo(f(u.segs[U+2],u.segs[U+3],q),u.segs[U+3])}t.strokeStyle=`rgb(${Wt(v,R,Math.pow(P,1.4))})`,t.lineWidth=$.lineWidth*Math.max(.7,(u.maxDepth-q+1)*1.05),t.stroke()}const k=[242,181,166];for(let q=w;q<D;q++){if(!u.tip[q])continue;const P=q*4,N=u.depth[q],U=f(u.segs[P+2],u.segs[P+3],N),Y=u.segs[P+3],X=Math.atan2(u.segs[P+3]-u.segs[P+1],u.segs[P+2]-u.segs[P]),_=q*2654435761%11===0,V=2.2+$.lineWidth*1.2+q*7%5*.35;if(t.save(),t.translate(U,Y),t.rotate(X+Math.sin(r*2+q)*.15),t.fillStyle=_?`rgb(${k.join(",")})`:`rgb(${Wt(R,[255,255,200],q*13%7/20)})`,t.beginPath(),_)for(let Q=0;Q<5;Q++)t.ellipse(Math.cos(Q*Math.PI*2/5)*V*.55,Math.sin(Q*Math.PI*2/5)*V*.55,V*.5,V*.32,Q*Math.PI*2/5,0,Math.PI*2);else t.ellipse(V*.6,0,V,V*.42,0,0,Math.PI*2);t.fill(),t.restore(),$.glowEffect&&(t.globalCompositeOperation="lighter",t.fillStyle=`rgba(${R.join(",")},${.12*W})`,t.beginPath(),t.arc(U,Y,V+$.glowBlur*.6,0,Math.PI*2),t.fill(),t.globalCompositeOperation="source-over")}}else{const q=Math.max(1,Math.ceil(S/24));for(let P=Math.floor(w/q);P*q<D;P++){t.beginPath();for(let U=Math.max(w,P*q);U<Math.min(D,(P+1)*q);U++){const Y=U*4;t.moveTo(u.segs[Y],u.segs[Y+1]),t.lineTo(u.segs[Y+2],u.segs[Y+3])}const N=P/24;t.strokeStyle=`rgb(${Wt(R,[255,214,120],Math.sin(N*Math.PI)*.6)})`,t.lineWidth=$.lineWidth*1.3,$.glowEffect&&(t.shadowColor=$.color,t.shadowBlur=$.glowBlur),t.stroke(),t.shadowBlur=0}}}if(u.upright)for(const w of M){const D=(w.x*c+r*18*w.s)%(c+20)-10,W=(w.y*C+r*10*w.s+Math.sin(r+w.p)*8)%(C+20)-10;t.save(),t.translate(D,W),t.rotate(r*w.s+w.p),t.fillStyle=`rgba(242,181,166,${.55*m})`,t.beginPath(),t.ellipse(0,0,3*w.s,1.6*w.s,0,0,Math.PI*2),t.fill(),t.restore()}}return B=requestAnimationFrame(H),()=>{L.disconnect(),cancelAnimationFrame(B)}},[e])}const lo={default:{axiom:"X",rules:{X:"F+[[X]-X]-F[-FX]+X",F:"FF"},iterations:4,angle:25},fern:{axiom:"X",rules:{X:"F+[[X]-X]-F[-FX]+X",F:"FF"},iterations:5,angle:22},dragon:{axiom:"FX",rules:{X:"X+YF+",Y:"-FX-Y"},iterations:12,angle:90},sierpinski:{axiom:"F-G-G",rules:{F:"F-G+F+G-F",G:"GG"},iterations:5,angle:120},bush:{axiom:"Y",rules:{X:"X[-FFF][+FFF]FX",Y:"YFX[+Y][-Y]"},iterations:5,angle:25},snowflake:{axiom:"F++F++F",rules:{F:"F-F++F-F"},iterations:4,angle:60}},Vo=G.forwardRef((e,d)=>{const{preset:o,axiom:g,rules:y,iterations:t,angle:c,lineWidth:C,color:a,backgroundColor:r,speed:i,autoReset:n,trailFade:s,glowEffect:l,glowBlur:m,width:I,height:M,className:h,style:x}=e,E=lo[o??"default"]??lo.default,L=G.useRef(null);return G.useImperativeHandle(d,()=>L.current),ma(L,{axiom:g??E.axiom,rules:y??E.rules,iterations:t??E.iterations,angle:c??E.angle,lineWidth:C??1,color:a??"#86efac",backgroundColor:r??"#06120a",speed:i??5,autoReset:n??!0,trailFade:s??0,glowEffect:l??!1,glowBlur:m??8}),ct.jsx("div",{className:h,style:{width:I??"100%",height:M??"100%",display:"block",overflow:"hidden",...x},children:ct.jsx("canvas",{ref:L,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});Vo.displayName="LSystem";function io(e){let d=e.replace("#","");d.length===3&&(d=d.split("").map(g=>g+g).join(""));const o=parseInt(d.slice(0,6),16)||0;return[o>>16&255,o>>8&255,o&255]}function co([e,d,o]){e/=255,d/=255,o/=255;const g=Math.max(e,d,o),y=Math.min(e,d,o),t=(g+y)/2;if(g===y)return[0,0,t];const c=g-y,C=t>.5?c/(2-g-y):c/(g+y);return[(g===e?(d-o)/c+(d<o?6:0):g===d?(o-e)/c+2:(e-d)/c+4)*60,C,t]}function qt(e,d,o){return`hsl(${(e%360+360)%360}, ${Math.round(Math.max(0,Math.min(1,d))*100)}%, ${Math.round(Math.max(0,Math.min(1,o))*100)}%)`}function pa(e,d){const[o,g,y]=co(io(e)),[t,c,C]=co(io(d)),a=Math.max(.55,g),r=Math.max(.55,c),i=Math.min(.68,Math.max(.45,y)),n=Math.min(.62,Math.max(.4,C));return[qt(o,a,i),qt(t,r,n),qt(o+38,a,i),qt(o-32,a,i-.04),qt(t+42,r,n+.04),qt(t-30,r,n),qt(o+180,a*.8,.6)]}function ya(e,d,o){return Array.from({length:e},()=>{const g=o()<.55?0:o()<.6?1:2,y=3+Math.floor(o()*3),t=[];for(let c=0;c<y;c++){const C=c/y*Math.PI*2+(o()-.5)*.9,a=.6+o()*.5;t.push([Math.cos(C)*a,Math.sin(C)*a])}return{kind:g,r0:.02+Math.pow(o(),.75)*1,a0:o(),drift:(o()-.5)*.12,wobble:.04+o()*.1,phase:o()*Math.PI*2,rot:o()*Math.PI*2,spin:(o()-.5)*.9,size:(g===1?.025+o()*.035:.05+o()*.11)*d,color:Math.floor(o()*7),verts:t}})}function Ma(e,d){const o=G.useRef(d);o.current=d,G.useEffect(()=>{const g=e.current;if(!g)return;const y=g,t=y.parentElement;if(!t)return;const c=y.getContext("2d"),C=document.createElement("canvas"),a=C.getContext("2d");let r=0,i=0,n=1,s=[],l="",m=[],I="",M=7;const h=()=>((M=M*16807%2147483647)-1)/2147483646;function x(T,$){n=Math.min(2,window.devicePixelRatio||1),y.width=Math.round(T*n),y.height=Math.round($*n),y.style.width=`${T}px`,y.style.height=`${$}px`,r=T,i=$}const E=new ResizeObserver(T=>{const{width:$,height:u}=T[0].contentRect;$>0&&u>0&&x($,u)});E.observe(t);const L=t.getBoundingClientRect();L.width>0&&L.height>0&&x(L.width,L.height);let F=0,B=0,j=0,H=0;function O(T){F=requestAnimationFrame(O);const $=B?Math.min(.05,(T-B)/1e3):1/60;if(B=T,r===0)return;const u=o.current;u.animated&&(j+=$*u.speed*.6,H+=u.rotation*Math.PI/180*$*60*.5);const S=Math.max(2,Math.round(u.segments)),R=Math.PI/S,v=Math.hypot(r,i)/2*(1.04+.06*Math.sin(j*u.zoomSpeed*3)),A=`${u.colorA}|${u.colorB}`;A!==I&&(I=A,m=pa(u.colorA,u.colorB));const p=Math.round(26+Math.max(.5,u.noiseScale)*10),f=`${p}|${u.noiseScale}`;f!==l&&(l=f,M=7,s=ya(p,1.6/Math.sqrt(Math.max(.5,u.noiseScale)/2.5+.6),h));const b=n*Math.min(1,.5+u.resolution),z=Math.ceil(v*b),w=Math.ceil(v*Math.sin(Math.min(Math.PI/2,R*1.02))*b)+2;(C.width!==z||C.height!==w)&&(C.width=z,C.height=w),a.setTransform(b,0,0,b,0,0),a.globalCompositeOperation="source-over";const D=a.createRadialGradient(0,0,0,0,0,v);D.addColorStop(0,u.backgroundColor),D.addColorStop(1,u.backgroundColor),a.fillStyle=D,a.fillRect(0,0,v,w/b),a.globalCompositeOperation="source-over";const W=R*1.9;for(const U of s){let Y=((U.a0+U.drift*j)%1+1)%1;Y=-R*.45+Y*W;const X=(U.r0+Math.sin(j*.7+U.phase)*U.wobble)*v*.92,_=Math.cos(Y)*X,V=Math.sin(Y)*X,Q=U.size*v,ot=m[U.color%m.length];if(a.save(),a.translate(_,V),a.rotate(U.rot+j*U.spin),U.kind===1){const tt=a.createRadialGradient(-Q*.35,-Q*.35,Q*.05,0,0,Q);tt.addColorStop(0,"rgba(255,255,255,0.95)"),tt.addColorStop(.35,ot),tt.addColorStop(1,"rgba(0,0,0,0.2)"),a.fillStyle=tt,a.beginPath(),a.arc(0,0,Q,0,Math.PI*2),a.fill()}else{const tt=U.kind===2?Q*2.4:Q,at=U.kind===2?Q*.32:Q;a.beginPath(),U.verts.forEach(([K,J],nt)=>nt?a.lineTo(K*tt,J*at):a.moveTo(K*tt,J*at)),a.closePath(),a.globalAlpha=.78,a.fillStyle=ot,a.fill(),a.globalAlpha=.55,a.strokeStyle="rgba(255,255,255,0.6)",a.lineWidth=1.1,a.stroke(),a.globalAlpha=1}a.restore()}c.setTransform(n,0,0,n,0,0),c.fillStyle=u.backgroundColor,c.fillRect(0,0,r,i);const k=r/2,q=i/2;for(let U=0;U<2*S;U++)c.save(),c.translate(k,q),c.rotate(H),U%2===0?c.rotate(U*R):(c.rotate((U+1)*R),c.scale(1,-1)),c.beginPath(),c.moveTo(0,0),c.arc(0,0,v,-.012,R+.012),c.closePath(),c.clip(),c.drawImage(C,0,0,z/b,w/b),c.restore();const P=c.createRadialGradient(k,q,0,k,q,Math.min(r,i)*.12);P.addColorStop(0,"rgba(255,255,255,0.28)"),P.addColorStop(1,"rgba(255,255,255,0)"),c.globalCompositeOperation="lighter",c.fillStyle=P,c.fillRect(0,0,r,i),c.globalCompositeOperation="source-over";const N=c.createRadialGradient(k,q,Math.min(r,i)*.35,k,q,Math.hypot(r,i)/2);N.addColorStop(0,"rgba(0,0,0,0)"),N.addColorStop(1,"rgba(0,0,0,0.55)"),c.fillStyle=N,c.fillRect(0,0,r,i)}return F=requestAnimationFrame(O),()=>{E.disconnect(),cancelAnimationFrame(F)}},[e])}const ba={default:{colorA:"#ffb84d",colorB:"#1f9e8f",backgroundColor:"#0a0710"},monochrome:{},neon:{colorA:"#00ffff",colorB:"#ff00ff",backgroundColor:"#000000",segments:8,speed:1.5},crystal:{colorA:"#88ccff",colorB:"#002244",backgroundColor:"#000510",segments:12,noiseScale:4},void:{colorA:"#cc00ff",colorB:"#000000",backgroundColor:"#000000",segments:6,rotation:.4},fire:{colorA:"#ff8800",colorB:"#ff0000",backgroundColor:"#0a0000",segments:6,speed:2},ice:{colorA:"#ffffff",colorB:"#002255",backgroundColor:"#000510",segments:10,noiseScale:2,zoomSpeed:.5}},Ko=G.forwardRef((e,d)=>{const{preset:o,segments:g,speed:y,colorA:t,colorB:c,backgroundColor:C,noiseScale:a,zoomSpeed:r,rotation:i,resolution:n,animated:s,width:l,height:m,className:I,style:M}=e,h=ba[o??"default"]||{},x=G.useRef(null);return G.useImperativeHandle(d,()=>x.current),Ma(x,{segments:g??h.segments??8,speed:y??h.speed??1,colorA:t??h.colorA??"#e0e0ff",colorB:c??h.colorB??"#1a0a2e",backgroundColor:C??h.backgroundColor??"#111111",noiseScale:a??h.noiseScale??2.5,zoomSpeed:r??h.zoomSpeed??.3,rotation:i??h.rotation??.2,resolution:n??.5,animated:s??!0}),ct.jsx("div",{className:I,style:{width:l??"100%",height:m??"100%",display:"block",overflow:"hidden",...M},children:ct.jsx("canvas",{ref:x,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});Ko.displayName="Kaleidoscope";function Ca(e,d,o){return e.map((g,y)=>{if(d==="cycle"){const c=g.hue/60%6,C=c-Math.floor(c),a=0,r=Math.round(255*(1-C)*.75),i=Math.round(255*C*.75),n=192,s=Math.floor(c);return(()=>{switch(s){case 0:return[n,i,a];case 1:return[r,n,a];case 2:return[a,n,i];case 3:return[a,r,n];case 4:return[i,a,n];default:return[n,a,r]}})()}if(d==="gradient"){const t=y/Math.max(1,e.length-1);return bt([o,"#6b7280"],t)}return bt([o],0)})}function va(e,d){const o=G.useRef(d);o.current=d;const g=G.useRef(0);G.useEffect(()=>{const y=e.current;if(!y)return;const t=y.parentElement;if(!t)return;const c=y.getContext("2d");let C=0,a=0;const r={seeds:[],gridW:0,gridH:0,cellIds:new Int16Array(0),imageData:null,offscreen:null,offCtx:null,dragIdx:-1,isDragging:!1,mouseGX:0,mouseGY:0};function i($,u,S){const R=[];for(let v=0;v<S;v++)R.push({gx:Math.random()*$,gy:Math.random()*u,vx:(Math.random()-.5)*.3,vy:(Math.random()-.5)*.3,hue:v/S*360});return R}function n($,u){const{resolution:S,cellCount:R}=o.current,v=Math.max(1,Math.round($*S)),A=Math.max(1,Math.round(u*S));r.gridW=v,r.gridH=A,r.cellIds=new Int16Array(v*A);const p=new OffscreenCanvas(v,A),f=p.getContext("2d");if(r.offscreen=p,r.offCtx=f,r.imageData=f.createImageData(v,A),r.seeds.length===0)r.seeds=i(v,A,R);else{const b=r.gridW||v,z=r.gridH||A;for(const w of r.seeds)w.gx=w.gx/b*v,w.gy=w.gy/z*A}}function s($,u){const S=window.devicePixelRatio||1;C=$,a=u,y.width=Math.round(C*S),y.height=Math.round(a*S),y.style.width=`${C}px`,y.style.height=`${a}px`,c.setTransform(S,0,0,S,0,0),n(C,a)}let l=!1,m=0,I=0;function M($,u){const{resolution:S}=o.current;return[$*S,u*S]}function h($,u){let S=-1,R=1/0;for(let v=0;v<r.seeds.length;v++){const A=r.seeds[v],p=$-A.gx,f=u-A.gy,b=p*p+f*f;b<R&&(R=b,S=v)}return S}function x($){if(!o.current.interactive)return;const u=y.getBoundingClientRect(),S=$.clientX-u.left,R=$.clientY-u.top,[v,A]=M(S,R);m=v,I=A,l=!0;const p=h(v,A);if(p>=0){const f=r.seeds[p],b=v-f.gx,z=A-f.gy,w=(r.gridW*.15)**2;b*b+z*z<w&&(r.dragIdx=p,r.isDragging=!0)}r.mouseGX=v,r.mouseGY=A}function E($){if(!o.current.interactive)return;const u=y.getBoundingClientRect(),S=$.clientX-u.left,R=$.clientY-u.top,[v,A]=M(S,R);r.mouseGX=v,r.mouseGY=A,l&&r.isDragging&&r.dragIdx>=0&&(r.seeds[r.dragIdx].gx=Math.max(0,Math.min(r.gridW-1,v)),r.seeds[r.dragIdx].gy=Math.max(0,Math.min(r.gridH-1,A)))}function L($){if(!o.current.interactive)return;const u=y.getBoundingClientRect(),S=$.clientX-u.left,R=$.clientY-u.top,[v,A]=M(S,R),p=Math.abs(v-m)+Math.abs(A-I);if(!r.isDragging&&p<2){const{cellCount:f}=o.current;if(r.seeds.length<f*2){const b=r.seeds.length/(f||1)*360;r.seeds.push({gx:Math.max(0,Math.min(r.gridW-1,v)),gy:Math.max(0,Math.min(r.gridH-1,A)),vx:0,vy:0,hue:b})}}l=!1,r.isDragging=!1,r.dragIdx=-1}y.addEventListener("mousedown",x),y.addEventListener("mousemove",E),y.addEventListener("mouseup",L);const F=new ResizeObserver($=>{const{width:u,height:S}=$[0].contentRect;u>0&&S>0&&s(u,S)});F.observe(t);const B=t.getBoundingClientRect();B.width>0&&B.height>0&&s(B.width,B.height);let j=0,H=-1,O=-1;function T($){const u=j?Math.min($-j,50):16;j=$;const{cellCount:S,speed:R,colorMode:v,cellColor:A,backgroundColor:p,showEdges:f,edgeColor:b,resolution:z,relaxation:w,animated:D}=o.current;if(z!==H)r.seeds=[],n(C,a),H=z,O=S;else if(S!==O){if(S>r.seeds.length){const{gridW:J,gridH:nt}=r;for(;r.seeds.length<S;){const st=r.seeds.length;r.seeds.push({gx:Math.random()*J,gy:Math.random()*nt,vx:(Math.random()-.5)*.3,vy:(Math.random()-.5)*.3,hue:st/S*360})}}else r.seeds.length=S;O=S}const{seeds:W,gridW:k,gridH:q,imageData:P,offscreen:N,offCtx:U,cellIds:Y}=r;if(!P||!N||!U||W.length===0){g.current=requestAnimationFrame(T);return}if(D){const J=u/16;for(const nt of W)r.isDragging&&W.indexOf(nt)===r.dragIdx||(nt.vx+=(Math.random()-.5)*.05*R,nt.vy+=(Math.random()-.5)*.05*R,nt.vx=Math.max(-.5*R,Math.min(.5*R,nt.vx)),nt.vy=Math.max(-.5*R,Math.min(.5*R,nt.vy)),nt.gx+=nt.vx*J,nt.gy+=nt.vy*J,nt.gx<0&&(nt.gx=0,nt.vx=Math.abs(nt.vx)),nt.gx>=k&&(nt.gx=k-1,nt.vx=-Math.abs(nt.vx)),nt.gy<0&&(nt.gy=0,nt.vy=Math.abs(nt.vy)),nt.gy>=q&&(nt.gy=q-1,nt.vy=-Math.abs(nt.vy)))}const X=Ca(W,v,A),[_,V,Q]=bt([p],0),[ot,tt,at]=bt([b],0),K=P.data;for(let J=0;J<q;J++)for(let nt=0;nt<k;nt++){let st=1/0,rt=0;for(let ft=0;ft<W.length;ft++){const dt=nt-W[ft].gx,gt=J-W[ft].gy,pt=dt*dt+gt*gt;pt<st&&(st=pt,rt=ft)}Y[J*k+nt]=rt;const[lt,Z,et]=X[rt],it=(J*k+nt)*4;K[it]=lt,K[it+1]=Z,K[it+2]=et,K[it+3]=255}if(D&&w>0){const J=new Float32Array(W.length),nt=new Float32Array(W.length),st=new Uint32Array(W.length);for(let rt=0;rt<q;rt++)for(let lt=0;lt<k;lt++){const Z=Y[rt*k+lt];J[Z]+=lt,nt[Z]+=rt,st[Z]++}for(let rt=0;rt<W.length;rt++)r.isDragging&&rt===r.dragIdx||st[rt]>0&&(W[rt].gx+=(J[rt]/st[rt]-W[rt].gx)*w,W[rt].gy+=(nt[rt]/st[rt]-W[rt].gy)*w)}if(f)for(let J=0;J<q;J++)for(let nt=0;nt<k;nt++){const st=Y[J*k+nt];if(nt>0&&Y[J*k+nt-1]!==st||J>0&&Y[(J-1)*k+nt]!==st){const lt=(J*k+nt)*4;K[lt]=ot,K[lt+1]=tt,K[lt+2]=at,K[lt+3]=255}}if(U.putImageData(P,0,0),c.drawImage(N,0,0,C,a),o.current.interactive){c.save();for(let J=0;J<W.length;J++){const nt=W[J].gx/k*C,st=W[J].gy/q*a;c.beginPath(),c.arc(nt,st,3,0,Math.PI*2),c.fillStyle="rgba(255,255,255,0.5)",c.fill()}c.restore()}g.current=requestAnimationFrame(T)}return g.current=requestAnimationFrame(T),()=>{F.disconnect(),cancelAnimationFrame(g.current),y.removeEventListener("mousedown",x),y.removeEventListener("mousemove",E),y.removeEventListener("mouseup",L)}},[e])}const xa={default:{colorMode:"cycle"},monochrome:{edgeColor:"#333333"},"stained-glass":{colorMode:"cycle",edgeColor:"#111111",cellCount:25},neon:{colorMode:"cycle",backgroundColor:"#000000",edgeColor:"#000000",showEdges:!1},frost:{colorMode:"gradient",cellColor:"#88ccff",backgroundColor:"#001833",edgeColor:"#ffffff"},ember:{colorMode:"cycle",backgroundColor:"#0a0200",edgeColor:"#0a0200",showEdges:!1},void:{cellColor:"#ffffff",backgroundColor:"#000000",showEdges:!1}},Jo=G.forwardRef((e,d)=>{const{preset:o,cellCount:g,speed:y,colorMode:t,cellColor:c,backgroundColor:C,showEdges:a,edgeColor:r,resolution:i,relaxation:n,interactive:s,animated:l,width:m,height:I,className:M,style:h}=e,x=xa[o??"default"]||{},E=G.useRef(null);return G.useImperativeHandle(d,()=>E.current),va(E,{cellCount:g??x.cellCount??20,speed:y??1,colorMode:t??x.colorMode??"solid",cellColor:c??x.cellColor??"#ffffff",backgroundColor:C??x.backgroundColor??"#111111",showEdges:a??x.showEdges??!0,edgeColor:r??x.edgeColor??C??x.backgroundColor??"#111111",resolution:i??1,relaxation:n??.05,interactive:s??!0,animated:l??!0}),ct.jsx("div",{className:M,style:{width:m??"100%",height:I??"100%",display:"block",overflow:"hidden",...h},children:ct.jsx("canvas",{ref:E,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});Jo.displayName="VoronoiCells";const de=Math.PI*2;function wa(e,d){const o=G.useRef(d);o.current=d;const g=G.useRef(0);G.useEffect(()=>{const y=e.current;if(!y)return;const t=y.parentElement;if(!t)return;const c=y.getContext("2d");let C=0,a=0;const r={agents:new Float32Array(0),trail:new Float32Array(0),nextTrail:new Float32Array(0),gridW:0,gridH:0,imageData:null,offscreen:null,offCtx:null,mouseGX:0,mouseGY:0,mouseActive:!1};function i(L,F,B,j,H){const O=Math.round(j),T=Math.round(H);return O<0||O>=F||T<0||T>=B?0:L[T*F+O]}function n(L,F){const{resolution:B,agentCount:j}=o.current,H=Math.max(1,Math.round(L*B)),O=Math.max(1,Math.round(F*B));r.gridW=H,r.gridH=O,r.trail=new Float32Array(H*O),r.nextTrail=new Float32Array(H*O);const T=j;r.agents=new Float32Array(T*3);const $=H/2,u=O/2,S=Math.min(H,O)*.25;for(let A=0;A<T;A++){const p=Math.random()*de,f=Math.random()*S;r.agents[A*3]=$+Math.cos(p)*f,r.agents[A*3+1]=u+Math.sin(p)*f,r.agents[A*3+2]=Math.random()*de}const R=new OffscreenCanvas(H,O),v=R.getContext("2d");r.offscreen=R,r.offCtx=v,r.imageData=v.createImageData(H,O)}function s(L,F){const B=window.devicePixelRatio||1;C=L,a=F,y.width=Math.round(C*B),y.height=Math.round(a*B),y.style.width=`${C}px`,y.style.height=`${a}px`,c.setTransform(B,0,0,B,0,0),n(C,a)}function l(L){if(!o.current.interactive)return;const F=It(L,y);if(!F)return m();const B=F.x,j=F.y,{resolution:H}=o.current;r.mouseGX=B*H,r.mouseGY=j*H,r.mouseActive=!0}function m(){r.mouseActive=!1}window.addEventListener("mousemove",l),document.addEventListener("mouseleave",m);const I=new ResizeObserver(L=>{const{width:F,height:B}=L[0].contentRect;F>0&&B>0&&s(F,B)});I.observe(t);const M=t.getBoundingClientRect();M.width>0&&M.height>0&&s(M.width,M.height);let h=-1,x=-1;function E(L){const{agentCount:F,sensorAngle:B,sensorDistance:j,stepSize:H,rotateSpeed:O,trailDecay:T,diffuseStrength:$,trailColor:u,backgroundColor:S,resolution:R,interactive:v,mouseRadius:A,mouseStrength:p,animated:f}=o.current;if(R!==h)n(C,a),h=R,x=F;else if(F!==x){const at=F,K=r.agents,J=new Float32Array(at*3),nt=r.gridW,st=r.gridH;if(at>K.length/3){J.set(K);for(let rt=K.length/3;rt<at;rt++){const lt=Math.random()*de,Z=Math.random()*Math.min(nt,st)*.25;J[rt*3]=nt/2+Math.cos(lt)*Z,J[rt*3+1]=st/2+Math.sin(lt)*Z,J[rt*3+2]=Math.random()*de}}else J.set(K.subarray(0,at*3));r.agents=J,x=F}if(!f){g.current=requestAnimationFrame(E);return}const{agents:b,trail:z,nextTrail:w,gridW:D,gridH:W,imageData:k,offscreen:q,offCtx:P}=r;if(!k||!q||!P){g.current=requestAnimationFrame(E);return}const N=B*Math.PI/180,U=O*Math.PI/180,Y=F;for(let at=0;at<Y;at++){const K=b[at*3],J=b[at*3+1],nt=Math.round(K),st=Math.round(J);nt>=0&&nt<D&&st>=0&&st<W&&(z[st*D+nt]+=1)}if(v&&r.mouseActive){const at=A*R,K=at*at,J=r.mouseGX,nt=r.mouseGY,st=Math.max(0,Math.floor(J-at)),rt=Math.min(D-1,Math.ceil(J+at)),lt=Math.max(0,Math.floor(nt-at)),Z=Math.min(W-1,Math.ceil(nt+at));for(let et=lt;et<=Z;et++)for(let it=st;it<=rt;it++){const ft=it-J,dt=et-nt;ft*ft+dt*dt<=K&&(z[et*D+it]+=p)}}const X=$,_=1-X;for(let at=0;at<W;at++)for(let K=0;K<D;K++){let J=0,nt=0;for(let st=-1;st<=1;st++)for(let rt=-1;rt<=1;rt++){const lt=K+rt,Z=at+st;lt>=0&&lt<D&&Z>=0&&Z<W&&(J+=z[Z*D+lt],nt++)}w[at*D+K]=(z[at*D+K]*_+J/nt*X)*T}const V=r.trail;r.trail=r.nextTrail,r.nextTrail=V;const Q=r.trail;for(let at=0;at<Y;at++){const K=b[at*3],J=b[at*3+1],nt=b[at*3+2],st=i(Q,D,W,K+Math.cos(nt-N)*j,J+Math.sin(nt-N)*j),rt=i(Q,D,W,K+Math.cos(nt)*j,J+Math.sin(nt)*j),lt=i(Q,D,W,K+Math.cos(nt+N)*j,J+Math.sin(nt+N)*j);let Z=nt;rt>st&&rt>lt||(st>lt?Z-=U:lt>st?Z+=U:Z+=(Math.random()-.5)*U),Z+=(Math.random()-.5)*.1;let et=K+Math.cos(Z)*H,it=J+Math.sin(Z)*H;et<0&&(et+=D),et>=D&&(et-=D),it<0&&(it+=W),it>=W&&(it-=W),b[at*3]=et,b[at*3+1]=it,b[at*3+2]=Z}const ot=k.data,tt=5;for(let at=0;at<W;at++)for(let K=0;K<D;K++){const J=Math.min(Q[at*D+K]/tt,1),[nt,st,rt]=bt([S,u],J),lt=(at*D+K)*4;ot[lt]=nt,ot[lt+1]=st,ot[lt+2]=rt,ot[lt+3]=255}P.putImageData(k,0,0),c.drawImage(q,0,0,C,a),g.current=requestAnimationFrame(E)}return g.current=requestAnimationFrame(E),()=>{I.disconnect(),cancelAnimationFrame(g.current),window.removeEventListener("mousemove",l),document.removeEventListener("mouseleave",m)}},[e])}const Ra={default:{trailColor:"#ffcc44",backgroundColor:"#0a0800"},monochrome:{},neon:{trailColor:"#00ffff",backgroundColor:"#000000"},coral:{trailColor:"#ff8844",backgroundColor:"#0a0200"},vein:{trailColor:"#ff2244",backgroundColor:"#080000",agentCount:3e3},frost:{trailColor:"#88ddff",backgroundColor:"#000a10"},gold:{trailColor:"#ffcc44",backgroundColor:"#0a0800"}},Qo=G.forwardRef((e,d)=>{const{preset:o,agentCount:g,sensorAngle:y,sensorDistance:t,stepSize:c,rotateSpeed:C,trailDecay:a,diffuseStrength:r,trailColor:i,backgroundColor:n,resolution:s,interactive:l,mouseRadius:m,mouseStrength:I,animated:M,width:h,height:x,className:E,style:L}=e,F=Ra[o??"default"]||{},B=G.useRef(null);return G.useImperativeHandle(d,()=>B.current),wa(B,{agentCount:g??F.agentCount??1800,sensorAngle:y??45,sensorDistance:t??9,stepSize:c??1.5,rotateSpeed:C??45,trailDecay:a??F.trailDecay??.92,diffuseStrength:r??.2,trailColor:i??F.trailColor??"#ffffff",backgroundColor:n??F.backgroundColor??"#111111",resolution:s??.35,interactive:l??!0,mouseRadius:m??20,mouseStrength:I??3,animated:M??!0}),ct.jsx("div",{className:E,style:{width:h??"100%",height:x??"100%",display:"block",overflow:"hidden",...L},children:ct.jsx("canvas",{ref:B,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});Qo.displayName="SlimeMold";function fo(){let e=0,d=0;for(;e===0;)e=Math.random();for(;d===0;)d=Math.random();return Math.sqrt(-2*Math.log(e))*Math.cos(2*Math.PI*d)}function Zo(e,d,o,g){let y=e,t=d;for(let c=0;c<g;c++){const C=[],a=[],r=y.length/2;for(let i=0;i<r;i++){const n=y[i*2],s=y[i*2+1],l=(i+1)%r,m=y[l*2],I=y[l*2+1],M=Math.hypot(m-n,I-s),h=(t[i]+t[l])/2;C.push(n,s),a.push(t[i]),C.push((n+m)/2+fo()*M*o*h,(s+I)/2+fo()*M*o*h),a.push(h*(.8+Math.random()*.4))}y=C,t=a}return{pts:y,vari:t}}function ka(e){const o=[],g=[];for(let y=0;y<10;y++){const t=y/10*Math.PI*2;o.push(Math.cos(t),Math.sin(t)),g.push(.4+Math.random()*.8)}return Zo(o,g,.25+e*.35,3)}function Sa(e){const d=G.useRef(e);d.current=e;const o=G.useRef({paper:null,pctx:null,grain:null,scale:1,blooms:[],nextAuto:.3,t:0,key:""}).current,g=Rt(),y=G.useRef(null);function t(i,n){var x;const s=d.current;if(o.key=`${i}|${n}|${s.resolution}|${s.backgroundColor}`,o.blooms=[],typeof document>"u")return;const l=Math.min(1,Math.max(.2,s.resolution)),m=document.createElement("canvas");m.width=Math.max(1,Math.round(i*l)),m.height=Math.max(1,Math.round(n*l)),o.paper=m,o.scale=l,o.pctx=m.getContext("2d"),o.pctx&&(o.pctx.fillStyle=s.backgroundColor,o.pctx.fillRect(0,0,m.width,m.height));const I=document.createElement("canvas");I.width=128,I.height=128;const M=I.getContext("2d"),h=(x=M==null?void 0:M.createImageData)==null?void 0:x.call(M,128,128);if(M&&h){for(let E=0;E<128*128;E++){const L=128+(Math.random()-.5)*90;h.data[E*4]=h.data[E*4+1]=h.data[E*4+2]=L,h.data[E*4+3]=255}M.putImageData(h,0,0),o.grain=I}}function c(i,n){const s=d.current;if(o.blooms.length>=Math.max(1,s.maxBlooms))return;const l=s.colors.length?s.colors:["#ffffff"],{pts:m,vari:I}=ka(s.noiseAmount);o.blooms.push({x:i*o.scale,y:n*o.scale,color:l[Math.random()*l.length|0],base:m,vari:I,drawn:0,total:Math.max(12,Math.round(s.layerCount*7)),radius:s.bloomRadius*o.scale*(.6+Math.random()*.6)})}function C(i,n){const s=o.pctx;if(!s)return;const l=i.drawn/i.total,m=i.radius*(.35+.65*(1-Math.pow(1-l,2))),{pts:I}=Zo(i.base,i.vari,.18+n.noiseAmount*.2,2);s.beginPath();for(let M=0;M<I.length;M+=2){const h=i.x+I[M]*m,x=i.y+I[M+1]*m;M===0?s.moveTo(h,x):s.lineTo(h,x)}s.closePath(),s.fillStyle=ut(i.color,Math.min(1,n.opacity*.28)),s.fill(),n.wetEdge>0&&(s.strokeStyle=ut(i.color,Math.min(1,n.wetEdge*.05)),s.lineWidth=Math.max(.8,1.6*o.scale),s.stroke()),i.drawn++}function a(i,n,s,l,m){const I=d.current,M=l/16.67;o.t+=l*.001,o.key!==`${n}|${s}|${I.resolution}|${I.backgroundColor}`&&t(n,s);const h=kt(g.current,y.current);if(I.interactive)for(const E of h.taps)c(E.x,E.y);I.animated&&I.autoBloom&&o.t>o.nextAuto&&(o.nextAuto=o.t+Math.max(.15,I.autoBloomInterval/1e3),c(n*(.1+Math.random()*.8),s*(.1+Math.random()*.8)));const x=I.animated?Math.max(1,Math.round(I.bloomSpeed*2.5*M*(m.quality<.75?.6:1))):1/0;for(const E of o.blooms)for(let L=0;L<x&&E.drawn<E.total;L++)C(E,I);if(o.blooms=o.blooms.filter(E=>E.drawn<E.total),I.animated&&I.fadeSpeed>0&&o.pctx&&o.paper&&(o.pctx.fillStyle=ut(I.backgroundColor,Math.min(1,I.fadeSpeed*3*M)),o.pctx.fillRect(0,0,o.paper.width,o.paper.height)),o.paper?(i.imageSmoothingEnabled=!0,i.imageSmoothingQuality="high",i.drawImage(o.paper,0,0,n,s)):m.overlay||(i.fillStyle=I.backgroundColor,i.fillRect(0,0,n,s)),o.grain){const E=i.globalCompositeOperation;i.globalCompositeOperation="overlay",i.globalAlpha=.06;for(let L=0;L<s;L+=128)for(let F=0;F<n;F+=128)i.drawImage(o.grain,F,L);i.globalAlpha=1,i.globalCompositeOperation=E}}const r=xt({onResize:(i,n)=>t(i,n),onFrame:a});return y.current=r.canvas,r}const Pa={default:{colors:["#f97316","#ec4899","#8b5cf6","#fbbf24"],backgroundColor:"#0a0005"},sunset:{colors:["#f97316","#ec4899","#8b5cf6","#fbbf24"],backgroundColor:"#0a0005",bloomRadius:100,opacity:.18,wetEdge:.5},ocean:{colors:["#0ea5e9","#06b6d4","#6366f1","#38bdf8"],backgroundColor:"#020b18",bloomRadius:90,opacity:.15,wetEdge:.35},spring:{colors:["#86efac","#d9f99d","#fde68a","#fbcfe8","#c4b5fd"],backgroundColor:"#0a0f05",bloomRadius:80,opacity:.2,layerCount:8},monochrome:{colors:["#ffffff","#d1d5db","#9ca3af"],backgroundColor:"#111111",bloomRadius:100,opacity:.12,wetEdge:.6},neon:{colors:["#f0abfc","#67e8f9","#a5f3fc","#c084fc"],backgroundColor:"#050010",bloomRadius:110,opacity:.2,wetEdge:.7,noiseAmount:.6}},tn=G.forwardRef((e,d)=>{const{preset:o,colors:g,backgroundColor:y,bloomRadius:t,bloomSpeed:c,opacity:C,wetEdge:a,layerCount:r,noiseAmount:i,fadeSpeed:n,interactive:s,autoBloom:l,autoBloomInterval:m,resolution:I,animated:M,maxBlooms:h,width:x,height:E,className:L,style:F}=e,B=Pa[o??"default"]||{},{canvasRef:j,canvas:H}=Sa({colors:g??B.colors??["#ffffff","#6b7280","#9ca3af"],backgroundColor:y??B.backgroundColor??"#111111",bloomRadius:t??B.bloomRadius??80,bloomSpeed:c??.5,opacity:C??B.opacity??.15,wetEdge:a??B.wetEdge??.4,layerCount:r??B.layerCount??6,noiseAmount:i??B.noiseAmount??.5,fadeSpeed:n??.001,interactive:s??!0,autoBloom:l??!0,autoBloomInterval:m??1500,resolution:I??.5,animated:M??!0,maxBlooms:h??12});return G.useImperativeHandle(d,()=>H,[H]),ct.jsx(vt,{canvasRef:j,width:x,height:E,className:L,style:{cursor:s??!0?"crosshair":"default",...F}})});tn.displayName="WatercolorBloom";function Ea(e){const[d,o,g]=e.split(",").map(a=>Number(a)/255),y=Math.max(d,o,g),t=Math.min(d,o,g),c=y-t;return c===0?0:(y===d?(o-g)/c+(o<g?6:0):y===o?(g-d)/c+2:(d-o)/c+4)*60}function Aa(e,d){const o=G.useRef(d);o.current=d,G.useEffect(()=>{const g=e.current;if(!g)return;const y=g.parentElement;if(!y)return;const t=g.getContext("2d"),c=document.createElement("canvas"),C=c.getContext("2d"),a=document.createElement("canvas"),r=a.getContext("2d");let i=0,n=0,s=1,l=0,m=1,I=1,M=!1,h=[0,0,0,0],x=[0,0],E=null;function L(){l=0,m=1,h=[Math.random()*6.28,Math.random()*6.28,Math.random()*6.28,Math.random()*6.28],x=[(Math.random()-.5)*.02,(Math.random()-.5)*.02],E=null,C.setTransform(1,0,0,1,0,0),C.clearRect(0,0,c.width,c.height)}function F(u,S){s=Math.min(2,window.devicePixelRatio||1),g.width=Math.round(u*s),g.height=Math.round(S*s),g.style.width=`${u}px`,g.style.height=`${S}px`,c.width=g.width,c.height=g.height,a.width=Math.max(1,Math.round(u/3)),a.height=Math.max(1,Math.round(S/3)),i=u,n=S,L()}const B=new ResizeObserver(u=>{const{width:S,height:R}=u[0].contentRect;S>0&&R>0&&F(S,R)});B.observe(y);const j=y.getBoundingClientRect();j.width>0&&j.height>0&&F(j.width,j.height);function H(u){const S=i/2*u.amplitude*.92,R=n/2*u.amplitude*.9,v=u.freq1,A=u.freq2,p=A+u.freq3+x[0],f=v+u.freq3*1.3+x[1];return{x:i/2+S*m*(.62*Math.sin(v*l+h[0])+.38*Math.sin(p*l+h[1])),y:n/2+R*m*(.62*Math.sin(A*l+h[2])+.38*Math.sin(f*l+h[3]))}}let O=0,T=0;function $(u){O=requestAnimationFrame($);const S=T?Math.min(.05,(u-T)/1e3):1/60;if(T=u,i===0)return;const R=o.current,v=mt(R.color),A=mt(R.color2),p=mt(R.backgroundColor),f=Ea(v);if(C.setTransform(s,0,0,s,0,0),R.trailFade>0&&(C.globalCompositeOperation="destination-out",C.fillStyle=`rgba(0,0,0,${Math.min(.2,R.trailFade*.18)})`,C.fillRect(0,0,i,n),C.globalCompositeOperation="source-over"),R.animated&&!M){const z=Math.round(70*R.speed*S*60/60)+1;C.lineCap="round",C.lineJoin="round",C.lineWidth=Math.max(.5,R.lineWidth)*1.1;for(let w=0;w<z;w++){l+=.011,m*=Math.pow(R.damping,.6);const D=H(R);if(E){let W;if(R.colorMode==="cycle")W=`hsla(${f+Math.sin(l*.05)*70+l*.6},85%,64%,0.7)`;else if(R.colorMode==="gradient"){const k=1-m;W=`rgba(${v.split(",").map((P,N)=>Math.round(+P+(+A.split(",")[N]-+P)*k)).join(",")},0.72)`}else W=`rgba(${v},0.7)`;C.strokeStyle=W,C.beginPath(),C.moveTo(E.x,E.y),C.lineTo(D.x,D.y),C.stroke()}E=D}m<.04&&R.autoReset&&(M=!0)}M&&(I-=S/1.4,I<=0&&(L(),I=1,M=!1)),t.setTransform(s,0,0,s,0,0);const b=t.createRadialGradient(i/2,n/2,0,i/2,n/2,Math.hypot(i,n)/2);if(b.addColorStop(0,`rgb(${p.split(",").map((z,w)=>Math.round(+z+(+v.split(",")[w]-+z)*.06)).join(",")})`),b.addColorStop(1,`rgb(${p})`),t.fillStyle=b,t.fillRect(0,0,i,n),t.globalAlpha=I,t.drawImage(c,0,0,i,n),R.glowEffect&&(r.setTransform(1,0,0,1,0,0),r.clearRect(0,0,a.width,a.height),r.drawImage(c,0,0,a.width,a.height),t.globalCompositeOperation="lighter",t.globalAlpha=I*Math.min(.85,.25+R.glowBlur/30),t.imageSmoothingEnabled=!0,t.drawImage(a,0,0,i,n),t.globalCompositeOperation="source-over"),t.globalAlpha=1,E&&!M){t.globalCompositeOperation="lighter";const z=t.createRadialGradient(E.x,E.y,0,E.x,E.y,14);z.addColorStop(0,"rgba(255,255,255,0.95)"),z.addColorStop(.3,`rgba(${v},0.6)`),z.addColorStop(1,`rgba(${v},0)`),t.fillStyle=z,t.beginPath(),t.arc(E.x,E.y,14,0,Math.PI*2),t.fill(),t.globalCompositeOperation="source-over"}}return O=requestAnimationFrame($),()=>{B.disconnect(),cancelAnimationFrame(O)}},[e])}const Ia={default:{color:"#ffb347",color2:"#2ec4b6",backgroundColor:"#06101a",colorMode:"gradient",glowEffect:!0,glowBlur:10},monochrome:{},neon:{color:"#00ffcc",color2:"#ff00aa",backgroundColor:"#000000",colorMode:"cycle",glowEffect:!0,glowBlur:12,trailFade:.015},crystal:{color:"#88ccff",color2:"#ffffff",backgroundColor:"#000510",colorMode:"gradient",glowEffect:!0,glowBlur:8,freq1:3,freq2:5},sand:{color:"#d4a76a",color2:"#7c5c2e",backgroundColor:"#1a1005",colorMode:"gradient",trailFade:.005,damping:.9998},minimal:{color:"#6b7280",backgroundColor:"#111111",lineWidth:.8,trailFade:.03,colorMode:"solid",glowEffect:!1},cosmic:{color:"#c084fc",color2:"#38bdf8",backgroundColor:"#020010",colorMode:"cycle",glowEffect:!0,glowBlur:15,freq1:5,freq2:7,freq3:.02}},en=G.forwardRef((e,d)=>{const{preset:o,color:g,color2:y,backgroundColor:t,lineWidth:c,trailFade:C,speed:a,damping:r,freq1:i,freq2:n,freq3:s,amplitude:l,colorMode:m,glowEffect:I,glowBlur:M,animated:h,autoReset:x,width:E,height:L,className:F,style:B}=e,j=Ia[o??"default"]||{},H=G.useRef(null);return G.useImperativeHandle(d,()=>H.current),Aa(H,{color:g??j.color??"#ffffff",color2:y??j.color2??"#6b7280",backgroundColor:t??j.backgroundColor??"#111111",lineWidth:c??j.lineWidth??1,trailFade:C??j.trailFade??.01,speed:a??1,damping:r??j.damping??.9995,freq1:i??j.freq1??2,freq2:n??j.freq2??3,freq3:s??j.freq3??.01,amplitude:l??.9,colorMode:m??j.colorMode??"solid",glowEffect:I??j.glowEffect??!1,glowBlur:M??j.glowBlur??10,animated:h??!0,autoReset:x??!0}),ct.jsx("div",{className:F,style:{width:E??"100%",height:L??"100%",display:"block",overflow:"hidden",...B},children:ct.jsx("canvas",{ref:H,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});en.displayName="PendulaWave";const Nt=(e,d,o)=>{const g=e.split(",").map(Number),y=d.split(",").map(Number);return g.map((t,c)=>Math.round(t+(y[c]-t)*o)).join(",")};function $a(e,d){const o=G.useRef(d);o.current=d,G.useEffect(()=>{const g=e.current;if(!g)return;const y=g.parentElement;if(!y)return;const t=g.getContext("2d"),c=document.createElement("canvas"),C=c.getContext("2d");let a=0,r=0,i=1,n=0,s=[];const l=Array.from({length:60},()=>({x:Math.random(),y:Math.random(),r:.4+Math.random()*1.2,s:4+Math.random()*10,p:Math.random()*6}));function m(u,S,R,v,A=0){const p=o.current,f=Math.max(2,Math.min(12,Math.round(p.symmetry))),b={x0:0,y0:0,ang:0,len:0,maxLen:R,w:Math.max(2,R*.045+p.cellSize*.5),depth:0,nextSpawn:R*(.14+Math.random()*.06),dist:0};return{x:u,y:S,R,rot:-Math.PI/2+(f%2?0:Math.PI/f)*0,branches:[b],born:n+A,doneAt:-1,fade:1,auto:v}}function I(){const u=Math.min(a,r);s=[m(a/2,r/2,u*.44,!0)],a/r>1.6&&(s.push(m(a*.16,r*.34,u*.2,!0,1.5)),s.push(m(a*.84,r*.68,u*.24,!0,3)))}function M(u,S){i=Math.min(2,window.devicePixelRatio||1),g.width=Math.round(u*i),g.height=Math.round(S*i),g.style.width=`${u}px`,g.style.height=`${S}px`,a=u,r=S,c.width=Math.max(1,Math.round(u/4)),c.height=Math.max(1,Math.round(S/4)),I()}const h=new ResizeObserver(u=>{const{width:S,height:R}=u[0].contentRect;S>0&&R>0&&M(S,R)});h.observe(y);const x=y.getBoundingClientRect();x.width>0&&x.height>0&&M(x.width,x.height);function E(u,S){if(!o.current.interactive)return;const R=g.getBoundingClientRect(),v=u-R.left,A=S-R.top;s.length>8&&s.shift(),s.push(m(v,A,Math.min(a,r)*(.16+Math.random()*.1),!1))}function L(u){E(u.clientX,u.clientY)}function F(u){if(!o.current.interactive)return;u.preventDefault();const S=u.touches[0];S&&E(S.clientX,S.clientY)}y.addEventListener("mousedown",L),y.addEventListener("touchstart",F,{passive:!1});function B(u,S){const R=o.current,v=Math.max(2,Math.min(12,Math.round(R.symmetry))),A=v===6||v===12||v===3?Math.PI/3:Math.min(1.2,Math.max(.55,2*Math.PI/v)),p=R.animated?Math.max(.2,R.growthSpeed)*28:1e6,f=Math.max(0,Math.min(1,R.noiseAmount));let b=!1;const z=[];for(const w of u.branches)if(!(w.len>=w.maxLen))for(b=!0,w.len=Math.min(w.maxLen,w.len+p*S*(1-w.depth*.22));w.depth<2&&w.len>=w.nextSpawn&&w.nextSpawn<w.maxLen*.92;){const D=w.nextSpawn,W=w.maxLen-D;if(w.depth===0||Math.random()<R.branchProbability+.25){const q=W*(w.depth===0?.5+Math.random()*.12:.55+Math.random()*.2)*(1+(Math.random()-.5)*f),P=w.x0+Math.cos(w.ang)*D,N=w.y0+Math.sin(w.ang)*D;for(const U of[1,-1])z.push({x0:P,y0:N,ang:w.ang+U*A,len:0,maxLen:Math.max(4,q),w:Math.max(1.2,w.w*.6),depth:w.depth+1,nextSpawn:q*(.25+Math.random()*.1),dist:w.dist+D})}w.nextSpawn+=w.maxLen*(w.depth===0?.11+Math.random()*.05:.22+Math.random()*.08)}u.branches.push(...z),!b&&u.doneAt<0&&(u.doneAt=n)}function j(u,S,R,v,A){const p=u.len<u.maxLen;if(A==="cycle"){const f=(u.dist+u.len)/S.R*200+n*25;return[`hsla(${f},85%,70%,1)`,`hsla(${f+40},90%,82%,1)`]}if(A==="age"){const f=Math.min(1,u.dist/S.R*1.2),b=Nt(R,v,f);return[`rgb(${b})`,`rgb(${Nt(b,"255,255,255",.45)})`]}return[`rgb(${R})`,p?`rgb(${v})`:`rgb(${Nt(R,"255,255,255",.5)})`]}function H(u,S,R,v,A,p){const f=Math.PI*2/p;u.save(),u.translate(S.x,S.y),u.globalAlpha=S.fade;for(let z=0;z<p;z++){u.save(),u.rotate(S.rot+z*f);for(const w of S.branches){if(w.len<=.5)continue;const D=Math.cos(w.ang),W=Math.sin(w.ang),k=w.x0+D*w.len,q=w.y0+W*w.len,P=w.w*.5,N=w.x0+D*w.len*.18,U=w.y0+W*w.len*.18,[Y,X]=j(w,S,R,v,A),_=u.createLinearGradient(w.x0,w.y0,k,q);_.addColorStop(0,Y),_.addColorStop(1,X),u.fillStyle=_,u.globalAlpha=S.fade*(.85-w.depth*.12),u.beginPath(),u.moveTo(w.x0,w.y0),u.lineTo(N-W*P,U+D*P),u.lineTo(k,q),u.lineTo(N+W*P,U-D*P),u.closePath(),u.fill(),u.globalAlpha=S.fade*.75,u.strokeStyle="rgba(255,255,255,0.85)",u.lineWidth=Math.max(.5,P*.35),u.beginPath(),u.moveTo(w.x0,w.y0),u.lineTo(k,q),u.stroke()}u.restore()}const b=S.R*.1*Math.min(1,(n-S.born)*2+.2);u.globalAlpha=S.fade*.8,u.beginPath();for(let z=0;z<=p;z++){const w=S.rot+z*f;z?u.lineTo(Math.cos(w)*b,Math.sin(w)*b):u.moveTo(Math.cos(w)*b,Math.sin(w)*b)}u.fillStyle=`rgba(${Nt(R,"255,255,255",.3)},0.55)`,u.fill(),u.strokeStyle="rgba(255,255,255,0.8)",u.lineWidth=1,u.stroke(),u.restore(),u.globalAlpha=1}let O=0,T=0;function $(u){O=requestAnimationFrame($);const S=T?Math.min(.05,(u-T)/1e3):1/60;if(T=u,n+=S,a===0)return;const R=o.current,v=Math.max(2,Math.min(12,Math.round(R.symmetry))),A=mt(R.crystalColor),p=mt(R.activeColor),f=mt(R.backgroundColor);for(const w of s)n>=w.born&&B(w,S);for(const w of s)w.doneAt>0&&R.autoReset&&n-w.doneAt>4&&(w.fade-=S/1.5);const b=s.filter(w=>w.fade<=0);if(b.length){s=s.filter(w=>w.fade>0);for(const w of b)w.auto&&s.push(m(w.x,w.y,w.R,!0,.6))}t.setTransform(i,0,0,i,0,0);const z=t.createRadialGradient(a/2,r/2,0,a/2,r/2,Math.hypot(a,r)/2);z.addColorStop(0,`rgb(${Nt(f,p,.14)})`),z.addColorStop(1,`rgb(${f})`),t.fillStyle=z,t.fillRect(0,0,a,r);for(const w of l){const D=(w.y*r+n*w.s)%(r+10)-5,W=w.x*a+Math.sin(n*.5+w.p)*8;t.fillStyle=`rgba(${Nt(A,"255,255,255",.5)},${.25+.25*Math.sin(n*2+w.p)})`,t.beginPath(),t.arc(W,D,w.r,0,Math.PI*2),t.fill()}for(const w of s)n>=w.born&&H(t,w,A,p,R.colorMode,v);if(R.glowEffect){C.setTransform(.25,0,0,.25,0,0),C.clearRect(0,0,a,r);for(const w of s)n>=w.born&&H(C,w,p,p,R.colorMode,v);t.globalCompositeOperation="lighter",t.globalAlpha=Math.min(.9,.3+R.glowBlur/30),t.imageSmoothingEnabled=!0,t.drawImage(c,0,0,a,r),t.globalAlpha=1,t.globalCompositeOperation="source-over"}t.globalCompositeOperation="lighter";for(const w of s){if(n<w.born)continue;const W=w.branches[0].len;for(let k=0;k<v;k++){const q=w.rot+k*(Math.PI*2/v),P=w.x+Math.cos(q)*W,N=w.y+Math.sin(q)*W,U=(.5+.5*Math.sin(n*5+k*1.3))*w.fade,Y=3+w.R*.02;t.strokeStyle=`rgba(255,255,255,${.7*U})`,t.lineWidth=1,t.beginPath(),t.moveTo(P-Y,N),t.lineTo(P+Y,N),t.moveTo(P,N-Y),t.lineTo(P,N+Y),t.stroke()}}t.globalCompositeOperation="source-over"}return O=requestAnimationFrame($),()=>{h.disconnect(),cancelAnimationFrame(O),y.removeEventListener("mousedown",L),y.removeEventListener("touchstart",F)}},[e])}const Ta={default:{crystalColor:"#e0f2fe",activeColor:"#7dd3fc",backgroundColor:"#0c1a2e"},monochrome:{},snowflake:{crystalColor:"#e0f2fe",activeColor:"#7dd3fc",backgroundColor:"#0c1a2e",symmetry:6,branchProbability:.4,noiseAmount:.15,glowEffect:!0,glowBlur:10},gem:{crystalColor:"#c084fc",activeColor:"#e879f9",backgroundColor:"#09000f",symmetry:8,branchProbability:.2,noiseAmount:.1,colorMode:"age",glowEffect:!0,glowBlur:15},neon:{crystalColor:"#00ffcc",activeColor:"#ff00aa",backgroundColor:"#000000",symmetry:4,branchProbability:.35,noiseAmount:.3,colorMode:"cycle",glowEffect:!0,glowBlur:18},frost:{crystalColor:"#bae6fd",activeColor:"#ffffff",backgroundColor:"#0a1628",symmetry:6,branchProbability:.5,noiseAmount:.25,cellSize:2,glowEffect:!0,glowBlur:8},gold:{crystalColor:"#fbbf24",activeColor:"#f59e0b",backgroundColor:"#0a0500",symmetry:12,branchProbability:.15,noiseAmount:.05,colorMode:"age",glowEffect:!0,glowBlur:12}},on=G.forwardRef((e,d)=>{const{preset:o,crystalColor:g,activeColor:y,backgroundColor:t,growthSpeed:c,symmetry:C,branchProbability:a,noiseAmount:r,cellSize:i,glowEffect:n,glowBlur:s,interactive:l,autoReset:m,colorMode:I,animated:M,width:h,height:x,className:E,style:L}=e,F=Ta[o??"default"]||{},B=G.useRef(null);return G.useImperativeHandle(d,()=>B.current),$a(B,{crystalColor:g??F.crystalColor??"#ffffff",activeColor:y??F.activeColor??"#6b7280",backgroundColor:t??F.backgroundColor??"#111111",growthSpeed:c??3,symmetry:C??F.symmetry??6,branchProbability:a??F.branchProbability??.3,noiseAmount:r??F.noiseAmount??.2,cellSize:i??F.cellSize??3,glowEffect:n??F.glowEffect??!0,glowBlur:s??F.glowBlur??12,interactive:l??!0,autoReset:m??!0,colorMode:I??F.colorMode??"solid",animated:M??!0}),ct.jsx("div",{className:E,style:{width:h??"100%",height:x??"100%",display:"block",overflow:"hidden",cursor:l??!0?"crosshair":"default",...L},children:ct.jsx("canvas",{ref:B,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});on.displayName="CrystalGrowth";const Gt=(e,d,o)=>{const g=e.split(",").map(Number),y=d.split(",").map(Number);return g.map((t,c)=>Math.round(t+(y[c]-t)*o)).join(",")},za=(e,d)=>{const o=Math.sin(e*127.1+d*311.7)*43758.5453;return o-Math.floor(o)};function Fa(e,d){const o=G.useRef(d);o.current=d,G.useEffect(()=>{const g=e.current;if(!g)return;const y=g.parentElement;if(!y)return;const t=g.getContext("2d");let c=0,C=0,a=1,r=0,i=[],n=[],s=[],l=[],m=0;const I=Array.from({length:70},()=>({x:Math.random(),y:Math.random(),z:Math.random(),p:Math.random()*6})),M={x:-9999,y:-9999,inside:!1};function h(){const f=[],b=4+Math.floor(Math.random()*3);for(let z=0;z<b;z++){let w=z/b*Math.PI*2+(Math.random()-.5)*.8,D=0,W=0;const k=[[0,0]],q=3;for(let P=0;P<q;P++){const N=4+Math.random()*6;w+=(Math.random()-.5)*.9,D+=Math.cos(w)*N,W+=Math.sin(w)*N,k.push([D,W])}f.push(k)}return{bx:Math.random(),by:Math.random(),x:0,y:0,seed:Math.random()*100,flash:0,ring:0,hover:0,refractory:0,dendrites:f}}function x(){const f=o.current;i=Array.from({length:Math.max(2,f.nodeCount)},h);for(const b of i)b.bx=.05+b.bx*.9,b.by=.08+b.by*.84,b.x=b.bx*c,b.y=b.by*C;n=[]}function E(f,b){a=Math.min(2,window.devicePixelRatio||1),g.width=Math.round(f*a),g.height=Math.round(b*a),g.style.width=`${f}px`,g.style.height=`${b}px`,t.setTransform(a,0,0,a,0,0),c=f,C=b,x()}const L=new ResizeObserver(f=>{const{width:b,height:z}=f[0].contentRect;b>0&&z>0&&E(b,z)});L.observe(y);const F=y.getBoundingClientRect();F.width>0&&F.height>0&&E(F.width,F.height);function B(f,b){const z=i[f];if(!z||z.refractory>0)return;z.flash=Math.max(z.flash,b),z.ring=1,z.refractory=.35;const w=o.current.pulseDecay,D=b*w;if(!(D<.12))for(const W of l[f]??[])Math.random()<.75&&n.length<160&&n.push({a:f,b:W,prog:0,energy:D,trail:[]})}function j(f,b,z){let w=-1,D=z;return i.forEach((W,k)=>{const q=Math.hypot(W.x-f,W.y-b);q<D&&(D=q,w=k)}),w}function H(f){const b=It(f,g);if(!b)return O();M.x=b.x,M.y=b.y,M.inside=!0}function O(){M.inside=!1,M.x=M.y=-9999}function T(f,b){if(!o.current.interactive)return;const z=g.getBoundingClientRect(),w=j(f-z.left,b-z.top,120);w>=0&&(i[w].refractory=0,B(w,1))}function $(f){T(f.clientX,f.clientY)}function u(f){o.current.interactive&&(f.preventDefault(),f.touches[0]&&T(f.touches[0].clientX,f.touches[0].clientY))}window.addEventListener("mousemove",H),document.addEventListener("mouseleave",O),y.addEventListener("mousedown",$),y.addEventListener("touchstart",u,{passive:!1});function S(f,b){const z=i[f],w=i[b],D=Math.min(f,b),W=Math.max(f,b),k=(za(D,W)-.5)*.45*(f<b?1:-1);return{x:(z.x+w.x)/2-(w.y-z.y)*k,y:(z.y+w.y)/2+(w.x-z.x)*k}}const R=(f,b,z,w)=>({x:(1-w)*(1-w)*f.x+2*(1-w)*w*b.x+w*w*z.x,y:(1-w)*(1-w)*f.y+2*(1-w)*w*b.y+w*w*z.y});let v=0,A=0;function p(f){v=requestAnimationFrame(p);const b=A?Math.min(.05,(f-A)/1e3):1/60;if(A=f,c===0)return;const z=o.current;i.length!==Math.max(2,z.nodeCount)&&x();const w=z.animated?b*z.speed:0;r+=w;const D=mt(z.nodeColor),W=mt(z.edgeColor),k=mt(z.signalColor),q=mt(z.backgroundColor);for(const Y of i){const X=z.wander?z.wanderSpeed:0;Y.x=Y.bx*c+(Ot(r*.15*X+Y.seed)-.5)*60*X*2,Y.y=Y.by*C+(Ot(r*.15*X+Y.seed+50)-.5)*60*X*2,Y.flash*=Math.exp(-w*2.4),Y.ring=Math.max(0,Y.ring-w*1.6),Y.refractory=Math.max(0,Y.refractory-w);const _=M.inside&&z.interactive?Math.max(0,1-Math.hypot(Y.x-M.x,Y.y-M.y)/70):0;Y.hover+=(_-Y.hover)*Math.min(1,b*10)}s=[],l=i.map(()=>[]);const P=z.connectionRadius;for(let Y=0;Y<i.length;Y++){const X=[];for(let _=0;_<i.length;_++){if(Y===_)continue;const V=Math.hypot(i[Y].x-i[_].x,i[Y].y-i[_].y);V<P&&X.push([V,_])}X.sort((_,V)=>_[0]-V[0]);for(const[,_]of X.slice(0,4))l[Y].includes(_)||l[Y].push(_),l[_].includes(Y)||l[_].push(Y),Y<_?s.push([Y,_]):s.some(([V,Q])=>V===_&&Q===Y)||s.push([_,Y])}m+=w*1e3,z.animated&&m>z.pulseInterval&&(m=0,B(Math.floor(Math.random()*i.length),1)),t.setTransform(a,0,0,a,0,0);const N=t.createRadialGradient(c/2,C/2,0,c/2,C/2,Math.hypot(c,C)/2);N.addColorStop(0,`rgb(${Gt(q,W,.12)})`),N.addColorStop(1,`rgb(${q})`),t.fillStyle=N,t.fillRect(0,0,c,C);for(const Y of I)t.fillStyle=`rgba(${D},${.08+.12*Y.z*(.5+.5*Math.sin(r+Y.p))})`,t.beginPath(),t.arc(((Y.x*c+r*4*Y.z)%c+c)%c,Y.y*C,.5+Y.z,0,Math.PI*2),t.fill();t.lineCap="round";for(const[Y,X]of s){const _=i[Y],V=i[X],Q=S(Y,X),ot=Math.max(_.hover,V.hover,_.flash*.6,V.flash*.6);t.strokeStyle=`rgba(${Gt(W,D,ot)},${.34+ot*.5})`,t.lineWidth=z.lineWidth*(.8+ot*.9),t.beginPath(),t.moveTo(_.x,_.y),t.quadraticCurveTo(Q.x,Q.y,V.x,V.y),t.stroke()}t.globalCompositeOperation="lighter";for(let Y=n.length-1;Y>=0;Y--){const X=n[Y],_=i[X.a],V=i[X.b];if(!_||!V){n.splice(Y,1);continue}const Q=S(X.a,X.b),ot=Math.hypot(V.x-_.x,V.y-_.y)+1;if(X.prog+=w*260/ot,X.prog>=1){n.splice(Y,1),B(X.b,X.energy);continue}const tt=R(_,Q,V,X.prog);X.trail.push(tt),X.trail.length>9&&X.trail.shift(),t.strokeStyle=`rgba(${k},${.5*X.energy})`,t.lineWidth=2.2,t.beginPath(),X.trail.forEach((K,J)=>J?t.lineTo(K.x,K.y):t.moveTo(K.x,K.y)),t.stroke();const at=t.createRadialGradient(tt.x,tt.y,0,tt.x,tt.y,9);at.addColorStop(0,`rgba(255,255,255,${X.energy})`),at.addColorStop(.3,`rgba(${k},${.8*X.energy})`),at.addColorStop(1,`rgba(${k},0)`),t.fillStyle=at,t.beginPath(),t.arc(tt.x,tt.y,9,0,Math.PI*2),t.fill()}t.globalCompositeOperation="source-over";const U=z.nodeRadius;for(const Y of i){const X=Math.max(Y.flash,Y.hover);t.strokeStyle=`rgba(${Gt(D,k,Y.flash*.6)},${.35+X*.45})`,t.lineWidth=.9;for(const V of Y.dendrites)t.beginPath(),V.forEach(([Q,ot],tt)=>tt?t.lineTo(Y.x+Q,Y.y+ot):t.moveTo(Y.x+Q,Y.y+ot)),t.stroke();if(z.glowEffect){t.globalCompositeOperation="lighter";const V=U*(3+X*3)*(.6+z.glowBlur/25),Q=t.createRadialGradient(Y.x,Y.y,0,Y.x,Y.y,V);Q.addColorStop(0,`rgba(${Gt(D,k,Y.flash)},${.3+X*.5})`),Q.addColorStop(1,`rgba(${D},0)`),t.fillStyle=Q,t.beginPath(),t.arc(Y.x,Y.y,V,0,Math.PI*2),t.fill(),t.globalCompositeOperation="source-over"}const _=t.createRadialGradient(Y.x-U*.3,Y.y-U*.3,0,Y.x,Y.y,U*1.4);_.addColorStop(0,`rgb(${Gt(D,"255,255,255",.55+Y.flash*.4)})`),_.addColorStop(1,`rgb(${Gt(D,k,Y.flash)})`),t.fillStyle=_,t.beginPath(),t.arc(Y.x,Y.y,U*(1.2+Y.flash*.3),0,Math.PI*2),t.fill(),t.fillStyle=`rgba(${Gt(q,D,.25)},0.85)`,t.beginPath(),t.arc(Y.x+U*.15,Y.y+U*.1,U*.42,0,Math.PI*2),t.fill(),Y.ring>0&&(t.strokeStyle=`rgba(${k},${Y.ring*.7})`,t.lineWidth=1.5,t.beginPath(),t.arc(Y.x,Y.y,U*1.4+(1-Y.ring)*22,0,Math.PI*2),t.stroke())}}return v=requestAnimationFrame(p),()=>{L.disconnect(),cancelAnimationFrame(v),window.removeEventListener("mousemove",H),document.removeEventListener("mouseleave",O),y.removeEventListener("mousedown",$),y.removeEventListener("touchstart",u)}},[e])}const La={default:{nodeColor:"#5ce1e6",edgeColor:"#2a8c9e",signalColor:"#ffc857",backgroundColor:"#050b14"},monochrome:{},neon:{nodeColor:"#00ffcc",edgeColor:"#00ffcc",signalColor:"#ffffff",backgroundColor:"#000000",glowEffect:!0,glowBlur:20,pulseInterval:1500,pulseDecay:.9},brain:{nodeColor:"#f472b6",edgeColor:"#ec4899",signalColor:"#fbbf24",backgroundColor:"#0f0005",connectionRadius:130,glowEffect:!0,glowBlur:18,pulseDecay:.88,wanderSpeed:.4},minimal:{nodeColor:"#6b7280",edgeColor:"#374151",signalColor:"#9ca3af",backgroundColor:"#111111",glowEffect:!1,pulseInterval:3e3,nodeRadius:3},plasma:{nodeColor:"#c084fc",edgeColor:"#7c3aed",signalColor:"#f0abfc",backgroundColor:"#050010",connectionRadius:170,glowEffect:!0,glowBlur:25,pulseDecay:.92,wanderSpeed:.2},circuit:{nodeColor:"#22c55e",edgeColor:"#166534",signalColor:"#86efac",backgroundColor:"#020a02",connectionRadius:100,nodeRadius:3,glowEffect:!0,glowBlur:12,pulseInterval:1e3,pulseDecay:.8,wanderSpeed:.1}},nn=G.forwardRef((e,d)=>{const{preset:o,nodeCount:g,nodeColor:y,edgeColor:t,signalColor:c,backgroundColor:C,connectionRadius:a,nodeRadius:r,lineWidth:i,speed:n,pulseInterval:s,pulseDecay:l,glowEffect:m,glowBlur:I,interactive:M,animated:h,wander:x,wanderSpeed:E,width:L,height:F,className:B,style:j}=e,H=La[o??"default"]||{},O=G.useRef(null);return G.useImperativeHandle(d,()=>O.current),Fa(O,{nodeCount:g??40,nodeColor:y??H.nodeColor??"#ffffff",edgeColor:t??H.edgeColor??"#6b7280",signalColor:c??H.signalColor??"#ffffff",backgroundColor:C??H.backgroundColor??"#111111",connectionRadius:a??H.connectionRadius??150,nodeRadius:r??H.nodeRadius??4,lineWidth:i??1,speed:n??1,pulseInterval:s??H.pulseInterval??2e3,pulseDecay:l??H.pulseDecay??.85,glowEffect:m??H.glowEffect??!0,glowBlur:I??H.glowBlur??15,interactive:M??!0,animated:h??!0,wander:x??!0,wanderSpeed:E??H.wanderSpeed??.3}),ct.jsx("div",{className:B,style:{width:L??"100%",height:F??"100%",display:"block",overflow:"hidden",cursor:M??!0?"pointer":"default",...j},children:ct.jsx("canvas",{ref:O,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});nn.displayName="NeuralWeb";function Ba(e,d){const o=G.useRef(d);o.current=d,G.useEffect(()=>{const g=e.current;if(!g)return;const y=g.parentElement;if(!y)return;const t=g.getContext("2d");let c=0,C=0,a=0,r=new Float32Array(0),i=0,n=[],s=-1,l=0,m=0;const I=document.createElement("canvas"),M=I.getContext("2d");let h=null,x=0,E=0,L=-1;function F(f,b){const{blobCount:z,minRadius:w,maxRadius:D,speed:W}=o.current;n=Array.from({length:z},()=>{const k=w+Math.random()*(D-w);return{x:k+Math.random()*(f-k*2),y:k+Math.random()*(b-k*2),vx:(Math.random()-.5)*W*2,vy:(Math.random()-.5)*W*2,radius:k,rt:(k-w)/Math.max(1e-6,D-w),phase:Math.random()*Math.PI*2}})}function B(f,b){const{resolution:z}=o.current;z===L&&x>0||(L=z,x=Math.max(1,Math.round(f*z)),E=Math.max(1,Math.round(b*z)),I.width=x,I.height=E,h=M.createImageData(x,E))}function j(f,b){const z=window.devicePixelRatio||1;c=f,C=b,g.width=Math.round(f*z),g.height=Math.round(b*z),g.style.width=`${f}px`,g.style.height=`${b}px`,t.scale(z,z),L=-1,B(f,b),F(f,b)}const H=new ResizeObserver(f=>{const{width:b,height:z}=f[0].contentRect;b>0&&z>0&&j(b,z)});H.observe(y);const O=y.getBoundingClientRect();O.width>0&&O.height>0&&j(O.width,O.height);function T(f,b){for(let z=0;z<n.length;z++){const w=n[z].x-f,D=n[z].y-b;if(w*w+D*D<n[z].radius*n[z].radius)return z}return-1}function $(f){if(!o.current.interactive)return;const b=g.getBoundingClientRect(),z=f.clientX-b.left,w=f.clientY-b.top,D=T(z,w);if(D>=0)s=D,l=z-n[D].x,m=w-n[D].y;else{const{minRadius:W,maxRadius:k}=o.current,q=W+Math.random()*(k-W);n.push({x:z,y:w,vx:0,vy:0,radius:q,rt:(q-W)/Math.max(1e-6,k-W),phase:Math.random()*Math.PI*2})}}function u(f){if(!o.current.interactive||s<0)return;const b=g.getBoundingClientRect();n[s].x=f.clientX-b.left-l,n[s].y=f.clientY-b.top-m,n[s].vx=0,n[s].vy=0}function S(){s=-1}function R(f){if(!o.current.interactive)return;f.preventDefault();const b=g.getBoundingClientRect(),z=f.touches[0].clientX-b.left,w=f.touches[0].clientY-b.top,D=T(z,w);D>=0&&(s=D,l=z-n[D].x,m=w-n[D].y)}function v(f){if(!o.current.interactive||s<0)return;f.preventDefault();const b=g.getBoundingClientRect();n[s].x=f.touches[0].clientX-b.left-l,n[s].y=f.touches[0].clientY-b.top-m,n[s].vx=0,n[s].vy=0}function A(){s=-1}y.addEventListener("mousedown",$),y.addEventListener("mousemove",u),window.addEventListener("mouseup",S),y.addEventListener("touchstart",R,{passive:!1}),y.addEventListener("touchmove",v,{passive:!1}),y.addEventListener("touchend",A);function p(){const{blobCount:f,color:b,backgroundColor:z,threshold:w,speed:D,glowEffect:W,glowBlur:k,animated:q,resolution:P}=o.current;if(P!==L&&(L=-1,B(c,C)),f!==n.length&&s<0&&c>0){for(;n.length<f;){const{minRadius:lt,maxRadius:Z}=o.current,et=lt+Math.random()*(Z-lt);n.push({x:et+Math.random()*Math.max(1,c-et*2),y:et+Math.random()*Math.max(1,C-et*2),vx:(Math.random()-.5)*D*2,vy:(Math.random()-.5)*D*2,radius:et,rt:(et-lt)/Math.max(1e-6,Z-lt),phase:Math.random()*Math.PI*2})}for(;n.length>f;)n.pop()}{const{minRadius:lt,maxRadius:Z}=o.current;for(const et of n)et.radius=lt+et.rt*(Z-lt)}if(t.fillStyle=z,t.fillRect(0,0,c,C),!q||!h||x===0){i=requestAnimationFrame(p);return}const N=c/x,U=C/E;a+=1/60;for(let lt=0;lt<n.length;lt++){if(lt===s)continue;const Z=n[lt],et=Math.sin(a*.35*D+Z.phase)*D*1.1;Z.vy+=(et-Z.vy)*.02,Z.vx+=(Math.sin(a*.21+Z.phase*1.7)*.6*D-Z.vx)*.02,Z.x+=Z.vx,Z.y+=Z.vy,Z.x<Z.radius*.6?(Z.x=Z.radius*.6,Z.vx=Math.abs(Z.vx)):Z.x>c-Z.radius*.6&&(Z.x=c-Z.radius*.6,Z.vx=-Math.abs(Z.vx)),Z.y<Z.radius*.4?(Z.y=Z.radius*.4,Z.vy=Math.abs(Z.vy)):Z.y>C-Z.radius*.4&&(Z.y=C-Z.radius*.4,Z.vy=-Math.abs(Z.vy))}const[Y,X,_]=bt([z],0),[V,Q,ot]=bt([b],0),tt=[Math.min(255,V+(255-V)*.6),Math.min(255,Q+(255-Q)*.55),Math.min(255,ot+(255-ot)*.35)],at=[V*.6,Q*.3,ot*.45],K=h.data,J=w*.82,nt=w*.18,st=n.reduce((lt,Z)=>lt+Z.radius,0)/Math.max(1,n.length),rt=r.length===x*E?r:r=new Float32Array(x*E);for(let lt=0;lt<E;lt++){const Z=lt*U;for(let et=0;et<x;et++){const it=et*N;let ft=0;for(const dt of n){const gt=it-dt.x,pt=Z-dt.y;ft+=dt.radius*dt.radius/Math.max(1,gt*gt+pt*pt)}rt[lt*x+et]=ft}}for(let lt=0;lt<E;lt++)for(let Z=0;Z<x;Z++){const et=lt*x+Z,it=rt[et],ft=et*4,dt=Math.min(1,Math.max(0,(it-J)/nt)),gt=W?Math.max(0,Math.min(1,it/w))**3*.35*(k/20):0;let pt=Y+(V-Y)*gt,yt=X+(Q-X)*gt,wt=_+(ot-_)*gt;if(dt>0){const St=Math.max(0,1-w/it),Mt=rt[Z<x-1?et+1:et],Et=rt[Z>0?et-1:et],Ce=rt[lt<E-1?et+x:et],Zt=rt[lt>0?et-x:et],ve=w*(Mt-Et)/(2*N*it*it)*st,xe=w*(Ce-Zt)/(2*U*it*it)*st,we=Math.sqrt(ve*ve+xe*xe+1),Ye=-ve/we,Ne=-xe/we,Re=1/we,jn=Math.max(0,Ye*-.5+Ne*-.6+Re*.62),Xn=2*(Ye*-.5+Ne*-.6+Re*.62)*Re-.62,ke=Math.pow(Math.max(0,Xn),18)*.8*Math.min(1,St*5),Se=Math.pow(St,.55),Pe=.35+jn*.85,Hn=(at[0]+(tt[0]-at[0])*Se)*Pe+ke*255,Yn=(at[1]+(tt[1]-at[1])*Se)*Pe+ke*255,Nn=(at[2]+(tt[2]-at[2])*Se)*Pe+ke*255;pt=pt+(Math.min(255,Hn)-pt)*dt,yt=yt+(Math.min(255,Yn)-yt)*dt,wt=wt+(Math.min(255,Nn)-wt)*dt}K[ft]=pt|0,K[ft+1]=yt|0,K[ft+2]=wt|0,K[ft+3]=255}M.putImageData(h,0,0),t.imageSmoothingEnabled=!0,t.imageSmoothingQuality="high",t.drawImage(I,0,0,c,C),i=requestAnimationFrame(p)}return i=requestAnimationFrame(p),()=>{H.disconnect(),cancelAnimationFrame(i),y.removeEventListener("mousedown",$),y.removeEventListener("mousemove",u),window.removeEventListener("mouseup",S),y.removeEventListener("touchstart",R),y.removeEventListener("touchmove",v),y.removeEventListener("touchend",A)}},[e])}const Da={default:{color:"#ff7a45",backgroundColor:"#14060a"},monochrome:{},plasma:{color:"#c084fc",backgroundColor:"#050010",glowEffect:!0,glowBlur:30,speed:1.5},lava:{color:"#f97316",backgroundColor:"#1a0000",glowEffect:!0,glowBlur:20,speed:.5,minRadius:50,maxRadius:100},ocean:{color:"#38bdf8",backgroundColor:"#020c17",glowEffect:!0,glowBlur:15,speed:.8,threshold:.8},neon:{color:"#00ffcc",backgroundColor:"#000000",glowEffect:!0,glowBlur:25,speed:2,threshold:1.1},ghost:{color:"#e2e8f0",backgroundColor:"#111111",glowEffect:!1,speed:.3,threshold:.9,minRadius:60,maxRadius:110}},rn=G.forwardRef((e,d)=>{const{preset:o,blobCount:g,color:y,backgroundColor:t,threshold:c,speed:C,minRadius:a,maxRadius:r,glowEffect:i,glowBlur:n,resolution:s,animated:l,interactive:m,width:I,height:M,className:h,style:x}=e,E=Da[o??"default"]||{},L=G.useRef(null);return G.useImperativeHandle(d,()=>L.current),Ba(L,{blobCount:g??5,color:y??E.color??"#ffffff",backgroundColor:t??E.backgroundColor??"#111111",threshold:c??E.threshold??1,speed:C??E.speed??1,minRadius:a??E.minRadius??40,maxRadius:r??E.maxRadius??80,glowEffect:i??E.glowEffect??!0,glowBlur:n??E.glowBlur??20,resolution:s??.4,animated:l??!0,interactive:m??!0}),ct.jsx("div",{className:h,style:{width:I??"100%",height:M??"100%",display:"block",overflow:"hidden",cursor:m??!0?"grab":"default",...x},children:ct.jsx("canvas",{ref:L,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});rn.displayName="Metaballs";const Ut=220,Bt=(e,d,o)=>{const g=e.split(",").map(Number),y=d.split(",").map(Number);return g.map((t,c)=>Math.round(t+(y[c]-t)*o)).join(",")};function Oa(e,d){const o=G.useRef(d);o.current=d,G.useEffect(()=>{const g=e.current;if(!g)return;const y=g.parentElement;if(!y)return;const t=g.getContext("2d");let c=0,C=0,a=1,r=0,i=0,n=[],s=[],l=new Float32Array(0),m=new Float32Array(0),I=0,M=0,h=0,x=0,E=0;const L=document.createElement("canvas"),F=L.getContext("2d"),B=document.createElement("canvas"),j=B.getContext("2d");let H="",O=null,T=-1;const $=18,u=14;function S(N,U){const{resolution:Y}=o.current;Y===T&&I>0||(T=Y,I=Math.max(1,Math.round(N*Y)),M=Math.max(1,Math.round(U*Y)),l=new Float32Array(I*M),m=new Float32Array(I*M),L.width=I,L.height=M,O=F.createImageData(I,M))}function R(){const N=Math.min(c,C);for(let U=0;U<30;U++){const Y=30+Math.random()*(c-60),X=30+Math.random()*(C-60);if(Math.hypot(Y-h,X-x)>N*.32&&s.every(_=>Math.hypot(_.x-Y,_.y-X)>80))return{x:Y,y:X,amount:Ut,max:Ut,seed:Math.random()*100}}return{x:c*.15,y:C*.2,amount:Ut,max:Ut,seed:Math.random()*100}}function v(N,U){const{antCount:Y,maxFood:X}=o.current;h=N/2,x=U/2,n=Array.from({length:Y},()=>({x:h,y:x,angle:Math.random()*Math.PI*2,hasFood:!1,step:Math.random()*10})),s=[];for(let _=0;_<Math.min(3,X);_++)s.push(R())}function A(N,U){a=Math.min(2,window.devicePixelRatio||1),c=N,C=U,g.width=Math.round(N*a),g.height=Math.round(U*a),g.style.width=`${N}px`,g.style.height=`${U}px`,t.setTransform(a,0,0,a,0,0),T=-1,H="",S(N,U),v(N,U)}const p=new ResizeObserver(N=>{const{width:U,height:Y}=N[0].contentRect;U>0&&Y>0&&A(U,Y)});p.observe(y);const f=y.getBoundingClientRect();f.width>0&&f.height>0&&A(f.width,f.height);function b(N,U){if(!o.current.interactive)return;const Y=g.getBoundingClientRect();s.length<o.current.maxFood&&s.push({x:N-Y.left,y:U-Y.top,amount:Ut,max:Ut,seed:Math.random()*100})}function z(N){b(N.clientX,N.clientY)}function w(N){o.current.interactive&&(N.preventDefault(),N.touches[0]&&b(N.touches[0].clientX,N.touches[0].clientY))}y.addEventListener("mousedown",z),y.addEventListener("touchstart",w,{passive:!1});function D(N){const U=`${c}|${C}|${N}`;if(U===H)return;H=U,B.width=Math.max(1,Math.round(c*a)),B.height=Math.max(1,Math.round(C*a)),j.setTransform(a,0,0,a,0,0),j.fillStyle=`rgb(${N})`,j.fillRect(0,0,c,C);const Y=Math.round(c*C/90);for(let _=0;_<Y;_++){const V=Math.random()<.5;j.fillStyle=`rgba(${V?Bt(N,"255,236,200",.25):Bt(N,"0,0,0",.35)},${.25+Math.random()*.4})`,j.fillRect(Math.random()*c,Math.random()*C,1+Math.random()*1.5,1+Math.random()*1.5)}for(let _=0;_<Math.round(c*C/9e3);_++){const V=Math.random()*c,Q=Math.random()*C,ot=10+Math.random()*18,tt=Math.random()*Math.PI;j.save(),j.translate(V,Q),j.rotate(tt),j.fillStyle=`rgba(${Bt(N,Math.random()<.5?"120,90,40":"70,90,40",.35)},0.5)`,j.beginPath(),j.ellipse(0,0,ot,ot*.38,0,0,Math.PI*2),j.fill(),j.strokeStyle=`rgba(${Bt(N,"0,0,0",.3)},0.45)`,j.lineWidth=.8,j.beginPath(),j.moveTo(-ot,0),j.lineTo(ot,0),j.stroke(),j.restore()}const X=j.createRadialGradient(c/2,C/2,Math.min(c,C)*.3,c/2,C/2,Math.hypot(c,C)/2);X.addColorStop(0,"rgba(0,0,0,0)"),X.addColorStop(1,"rgba(0,0,0,0.4)"),j.fillStyle=X,j.fillRect(0,0,c,C)}function W(N,U,Y){const X=Math.max(0,Math.min(I-1,U|0)),_=Math.max(0,Math.min(M-1,Y|0));return N[_*I+X]}function k(N,U,Y){t.save(),t.translate(N.x,N.y),t.rotate(N.angle),t.strokeStyle=`rgba(${Bt(U,"0,0,0",.25)},0.95)`,t.lineWidth=.7,t.beginPath();for(let X=0;X<3;X++){const _=Math.sin(N.step*1.4+(X%2?Math.PI:0))*1.2,V=.6-X*1.3;t.moveTo(V,0),t.lineTo(V+1.2+_,-3.2),t.moveTo(V,0),t.lineTo(V+1.2-_,3.2)}t.stroke(),t.fillStyle=`rgb(${U})`,t.beginPath(),t.ellipse(-3.2,0,2.3,1.6,0,0,Math.PI*2),t.fill(),t.beginPath(),t.ellipse(-.2,0,1.3,.85,0,0,Math.PI*2),t.fill(),t.beginPath(),t.ellipse(2,0,1.25,1.05,0,0,Math.PI*2),t.fill(),t.fillStyle="rgba(255,255,255,0.28)",t.beginPath(),t.ellipse(-3.6,-.6,1,.5,0,0,Math.PI*2),t.fill(),N.hasFood&&(t.fillStyle=`rgb(${Y})`,t.beginPath(),t.ellipse(3.9,0,1.4,1.2,0,0,Math.PI*2),t.fill()),t.restore()}let q=0;function P(N){r=requestAnimationFrame(P);const U=q?Math.min(.05,(N-q)/1e3):1/60;q=N,i+=U;const Y=o.current;if(c===0||(Y.resolution!==T&&(T=-1,S(c,C)),!O))return;for(n.length>Y.antCount&&(n.length=Math.max(0,Y.antCount));n.length<Y.antCount;)n.push({x:h,y:x,angle:Math.random()*Math.PI*2,hasFood:!1,step:Math.random()*10});s.length>Y.maxFood&&(s.length=Math.max(0,Y.maxFood));const X=mt(Y.backgroundColor),_=mt(Y.pheromoneColor),V=mt(Y.antColor),Q=mt(Y.foodColor),ot=mt(Y.nestColor);D(X);const tt=c/I,at=C/M;if(Y.animated){for(let et=0;et<l.length;et++)l[et]*=1-Y.evaporationRate,m[et]*=1-Y.evaporationRate,l[et]<.001&&(l[et]=0),m[et]<.001&&(m[et]=0);if(Y.diffusionRate>0){const et=Y.diffusionRate*.25;for(let it=1;it<M-1;it++)for(let ft=1;ft<I-1;ft++){const dt=it*I+ft,gt=l,pt=m;gt[dt]+=((gt[dt-1]+gt[dt+1]+gt[dt-I]+gt[dt+I])*.25-gt[dt])*et,pt[dt]+=((pt[dt-1]+pt[dt+1]+pt[dt-I]+pt[dt+I])*.25-pt[dt])*et}}for(const et of n){const it=et.hasFood?m:l,ft=Mt=>W(it,(et.x+Math.cos(Mt)*Y.sensorDistance)/tt,(et.y+Math.sin(Mt)*Y.sensorDistance)/at),dt=ft(et.angle-Y.sensorAngle),gt=ft(et.angle),pt=ft(et.angle+Y.sensorAngle);if(gt>=dt&&gt>=pt||(dt>pt?et.angle-=Y.turnSpeed*Math.random():pt>dt?et.angle+=Y.turnSpeed*Math.random():et.angle+=(Math.random()-.5)*Y.turnSpeed),et.hasFood){const Mt=Math.atan2(x-et.y,h-et.x);et.angle+=Math.atan2(Math.sin(Mt-et.angle),Math.cos(Mt-et.angle))*.04}et.angle+=(Math.random()-.5)*.2,et.x+=Math.cos(et.angle)*Y.antSpeed,et.y+=Math.sin(et.angle)*Y.antSpeed,et.step+=Y.antSpeed*.6,et.x<0?(et.x=0,et.angle=Math.PI-et.angle):et.x>=c&&(et.x=c-1,et.angle=Math.PI-et.angle),et.y<0?(et.y=0,et.angle=-et.angle):et.y>=C&&(et.y=C-1,et.angle=-et.angle);const yt=Math.max(0,Math.min(I-1,et.x/tt|0)),St=Math.max(0,Math.min(M-1,et.y/at|0))*I+yt;if(et.hasFood?l[St]=Math.min(255,l[St]+Y.pheromoneStrength):m[St]=Math.min(255,m[St]+Y.pheromoneStrength),et.hasFood&&(et.x-h)**2+(et.y-x)**2<$*$&&(et.hasFood=!1,et.angle+=Math.PI),!et.hasFood)for(let Mt=s.length-1;Mt>=0;Mt--){const Et=s[Mt];if((et.x-Et.x)**2+(et.y-Et.y)**2<u*u&&Et.amount>0){et.hasFood=!0,et.angle+=Math.PI,Et.amount--,Et.amount<=0&&s.splice(Mt,1);break}}}s.length<Math.min(3,Y.maxFood)&&(E===0?E=i+3:i>E&&(s.push(R()),E=0))}const K=O.data,J=Math.max(1,Y.pheromoneStrength*8),[nt,st,rt]=_.split(",").map(Number);for(let et=0;et<I*M;et++){const it=Math.min(1,l[et]/J),ft=Math.min(1,m[et]/J)*.35,dt=et*4;K[dt]=Math.min(255,nt*it+230*ft),K[dt+1]=Math.min(255,st*it+215*ft),K[dt+2]=Math.min(255,rt*it+180*ft),K[dt+3]=Math.min(255,(it*1.15+ft)*255)}F.putImageData(O,0,0),t.setTransform(a,0,0,a,0,0),t.drawImage(B,0,0,c,C),t.imageSmoothingEnabled=!0,t.drawImage(L,0,0,c,C),t.globalCompositeOperation="lighter",t.globalAlpha=.45,t.drawImage(L,-2,-2,c+4,C+4),t.globalAlpha=1,t.globalCompositeOperation="source-over";const lt=t.createRadialGradient(h-6,x-8,2,h,x,$*2.1);lt.addColorStop(0,`rgb(${Bt(ot,"255,230,190",.25)})`),lt.addColorStop(.6,`rgb(${ot})`),lt.addColorStop(1,`rgba(${ot},0)`),t.fillStyle=lt,t.beginPath(),t.arc(h,x,$*2.1,0,Math.PI*2),t.fill();for(let et=0;et<26;et++){const it=et*2.39996,ft=$*(.6+et*37%13/13*1.2);t.fillStyle=`rgba(${Bt(ot,et%2?"0,0,0":"255,230,190",.3)},0.8)`,t.fillRect(h+Math.cos(it)*ft,x+Math.sin(it)*ft,1.6,1.6)}const Z=t.createRadialGradient(h,x,0,h,x,$*.5);Z.addColorStop(0,"rgba(10,6,2,1)"),Z.addColorStop(1,"rgba(10,6,2,0)"),t.fillStyle=Z,t.beginPath(),t.arc(h,x,$*.5,0,Math.PI*2),t.fill();for(const et of s){const it=Math.ceil(et.amount/et.max*14),ft=t.createRadialGradient(et.x,et.y,0,et.x,et.y,u*2);ft.addColorStop(0,`rgba(${Q},0.25)`),ft.addColorStop(1,`rgba(${Q},0)`),t.fillStyle=ft,t.beginPath(),t.arc(et.x,et.y,u*2,0,Math.PI*2),t.fill();for(let dt=0;dt<it;dt++){const gt=dt*2.39996+et.seed,pt=Math.sqrt(dt/14)*u*.85,yt=et.x+Math.cos(gt)*pt,wt=et.y+Math.sin(gt)*pt,St=t.createRadialGradient(yt-1,wt-1,.3,yt,wt,3.2);St.addColorStop(0,`rgb(${Bt(Q,"255,255,255",.55)})`),St.addColorStop(1,`rgb(${Bt(Q,"0,0,0",.25)})`),t.fillStyle=St,t.beginPath(),t.arc(yt,wt,3.2,0,Math.PI*2),t.fill()}}for(const et of n)k(et,V,Q)}return r=requestAnimationFrame(P),()=>{p.disconnect(),cancelAnimationFrame(r),y.removeEventListener("mousedown",z),y.removeEventListener("touchstart",w)}},[e])}const Wa={default:{antColor:"#d9693a",pheromoneColor:"#6fdc8c",foodColor:"#f5c242",nestColor:"#9a6a3a",backgroundColor:"#1a140d"},monochrome:{},neon:{antColor:"#ffffff",pheromoneColor:"#00ffcc",foodColor:"#f0abfc",nestColor:"#fbbf24",backgroundColor:"#000000",pheromoneStrength:8},desert:{antColor:"#451a03",pheromoneColor:"#d97706",foodColor:"#84cc16",nestColor:"#b45309",backgroundColor:"#fef3c7",antSpeed:2,evaporationRate:.005},jungle:{antColor:"#1a0a00",pheromoneColor:"#4ade80",foodColor:"#fbbf24",nestColor:"#7c3aed",backgroundColor:"#052e16",antCount:200,antSpeed:1},minimal:{antColor:"#9ca3af",pheromoneColor:"#374151",foodColor:"#6b7280",nestColor:"#6b7280",backgroundColor:"#111111",antCount:80,pheromoneStrength:3},swarm:{antColor:"#ffffff",pheromoneColor:"#6b7280",foodColor:"#4ade80",nestColor:"#f59e0b",backgroundColor:"#111111",antCount:400,antSpeed:2,pheromoneStrength:10,evaporationRate:.002}},an=G.forwardRef((e,d)=>{const{preset:o,antCount:g,evaporationRate:y,diffusionRate:t,pheromoneStrength:c,antSpeed:C,sensorAngle:a,sensorDistance:r,turnSpeed:i,antColor:n,pheromoneColor:s,foodColor:l,nestColor:m,backgroundColor:I,resolution:M,animated:h,interactive:x,maxFood:E,width:L,height:F,className:B,style:j}=e,H=Wa[o??"default"]||{},O=G.useRef(null);return G.useImperativeHandle(d,()=>O.current),Oa(O,{antCount:g??H.antCount??150,evaporationRate:y??H.evaporationRate??.003,diffusionRate:t??.1,pheromoneStrength:c??H.pheromoneStrength??5,antSpeed:C??H.antSpeed??1.5,sensorAngle:a??.4,sensorDistance:r??6,turnSpeed:i??.3,antColor:n??H.antColor??"#ffffff",pheromoneColor:s??H.pheromoneColor??"#6b7280",foodColor:l??H.foodColor??"#4ade80",nestColor:m??H.nestColor??"#f59e0b",backgroundColor:I??H.backgroundColor??"#111111",resolution:M??.5,animated:h??!0,interactive:x??!0,maxFood:E??5}),ct.jsx("div",{className:B,style:{width:L??"100%",height:F??"100%",display:"block",overflow:"hidden",cursor:x??!0?"crosshair":"default",...j},children:ct.jsx("canvas",{ref:O,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});an.displayName="AntColony";function qa(e,d){const o=G.useRef(d);o.current=d,G.useEffect(()=>{const g=e.current;if(!g)return;const y=g.parentElement;if(!y)return;const t=g.getContext("2d");let c=0,C=0,a=0,r="",i=!0,n=[],s=1,l=0;const m=document.createElement("canvas"),I=m.getContext("2d");let M=[],h=-1,x=0,E=0;function L(w,D){M=[{x:w*.35,y:D*.5,charge:1},{x:w*.65,y:D*.5,charge:-1}]}function F(w,D){c=w,C=D,g.width=Math.round(w*s),g.height=Math.round(D*s),g.style.width=`${w}px`,g.style.height=`${D}px`,s=Math.min(2,window.devicePixelRatio||1),g.width=Math.round(w*s),g.height=Math.round(D*s),t.setTransform(s,0,0,s,0,0),L(w,D),i=!0}const B=new ResizeObserver(w=>{const{width:D,height:W}=w[0].contentRect;D>0&&W>0&&F(D,W)});B.observe(y);const j=y.getBoundingClientRect();j.width>0&&j.height>0&&F(j.width,j.height);function H(w,D){let W=0,k=0;for(const q of M){const P=w-q.x,N=D-q.y,U=P*P+N*N;if(U<1)continue;const Y=Math.sqrt(U),X=q.charge/U;W+=P/Y*X,k+=N/Y*X}return[W,k]}function O(){const{fieldLineCount:w,stepSize:D,maxSteps:W,poleRadius:k}=o.current,q=k*k;n=[],M.forEach((P,N)=>{const U=P.charge;for(let Y=0;Y<w;Y++){const X=Y/w*Math.PI*2+N%2*(Math.PI/w);let _=P.x+Math.cos(X)*(k+2),V=P.y+Math.sin(X)*(k+2);const Q=[_,V];for(let ot=0;ot<W;ot++){const[tt,at]=H(_,V),K=Math.sqrt(tt*tt+at*at);if(K<1e-10)break;const J=_+tt/K*D*U,nt=V+at/K*D*U;if(J<-20||J>c+20||nt<-20||nt>C+20)break;let st=!1;for(const rt of M)if((J-rt.x)**2+(nt-rt.y)**2<q){st=!0;break}if(Q.push(J,nt),_=J,V=nt,st)break}Q.length>4&&n.push({pts:Q,from:U})}})}function T(){const{lineColor:w,backgroundColor:D}=o.current;m.width=Math.max(1,Math.round(c*s)),m.height=Math.max(1,Math.round(C*s)),I.setTransform(s,0,0,s,0,0);const W=ut(D,1);I.fillStyle=W,I.fillRect(0,0,c,C);const k=Math.round(c*C/140);I.lineCap="round";for(let P=0;P<k;P++){const N=Math.random()*c,U=Math.random()*C,[Y,X]=H(N,U),_=Math.sqrt(Y*Y+X*X);if(_<1e-12)continue;const V=Math.min(1,Math.sqrt(_)*40),Q=2.5+V*3.5,ot=Y/_,tt=X/_;I.strokeStyle=ut(w,.05+V*.22),I.lineWidth=.8,I.beginPath(),I.moveTo(N-ot*Q,U-tt*Q),I.lineTo(N+ot*Q,U+tt*Q),I.stroke()}const q=I.createRadialGradient(c/2,C/2,Math.min(c,C)*.3,c/2,C/2,Math.hypot(c,C)/2);q.addColorStop(0,"rgba(0,0,0,0)"),q.addColorStop(1,"rgba(0,0,0,0.45)"),I.fillStyle=q,I.fillRect(0,0,c,C)}function $(w){const{lineWidth:D,lineOpacity:W,poleRadius:k,glowEffect:q,glowBlur:P,positiveColor:N,negativeColor:U,animated:Y,lineColor:X}=o.current,_=o.current,V=`${_.fieldLineCount}|${_.stepSize}|${_.maxSteps}|${k}|${X}|${_.backgroundColor}`;V!==r&&(r=V,i=!0),i&&(O(),T(),i=!1),Y&&(l+=w),t.setTransform(s,0,0,s,0,0),t.drawImage(m,0,0,c,C),t.lineWidth=D*1.2,t.lineJoin="round";for(const Q of n){const ot=Q.pts.length,tt=t.createLinearGradient(Q.pts[0],Q.pts[1],Q.pts[ot-2],Q.pts[ot-1]),at=Q.from===1?N:U,K=Q.from===1?U:N;tt.addColorStop(0,ut(at,W)),tt.addColorStop(.5,ut(X,W*.85)),tt.addColorStop(1,ut(K,W)),t.strokeStyle=tt,t.beginPath(),t.moveTo(Q.pts[0],Q.pts[1]);for(let J=2;J<ot;J+=2)t.lineTo(Q.pts[J],Q.pts[J+1]);t.stroke()}t.globalCompositeOperation="lighter",n.forEach((Q,ot)=>{const tt=Q.pts.length/2;for(let at=0;at<3;at++){let K=(l*.18+at/3+ot*.137)%1;Q.from!==1&&(K=1-K);const J=Math.min(tt-1,Math.floor(K*(tt-1))),nt=Q.pts[J*2],st=Q.pts[J*2+1],rt=6,lt=t.createRadialGradient(nt,st,0,nt,st,rt);lt.addColorStop(0,"rgba(255,255,255,0.85)"),lt.addColorStop(.35,ut(X,.5)),lt.addColorStop(1,ut(X,0)),t.fillStyle=lt,t.beginPath(),t.arc(nt,st,rt,0,Math.PI*2),t.fill()}}),t.globalCompositeOperation="source-over";for(const Q of M){const ot=Q.charge===1?N:U;if(q){t.globalCompositeOperation="lighter";const at=k*(2.2+P/12)*(1+.08*Math.sin(l*2.5+Q.x)),K=t.createRadialGradient(Q.x,Q.y,k*.6,Q.x,Q.y,at);K.addColorStop(0,ut(ot,.55)),K.addColorStop(1,ut(ot,0)),t.fillStyle=K,t.beginPath(),t.arc(Q.x,Q.y,at,0,Math.PI*2),t.fill(),t.globalCompositeOperation="source-over"}const tt=t.createRadialGradient(Q.x-k*.35,Q.y-k*.4,k*.1,Q.x,Q.y,k);tt.addColorStop(0,"rgba(255,255,255,0.95)"),tt.addColorStop(.3,ot),tt.addColorStop(1,ut(ot,1)),t.fillStyle=tt,t.beginPath(),t.arc(Q.x,Q.y,k,0,Math.PI*2),t.fill(),t.strokeStyle="rgba(0,0,0,0.35)",t.lineWidth=1.5,t.stroke(),t.fillStyle="#ffffff",t.font=`bold ${Math.round(k*.95)}px system-ui, sans-serif`,t.textAlign="center",t.textBaseline="middle",t.shadowColor="rgba(0,0,0,0.5)",t.shadowBlur=3,t.fillText(Q.charge===1?"N":"S",Q.x,Q.y+.5),t.shadowBlur=0}}function u(w){if(!o.current.interactive)return;const D=g.getBoundingClientRect(),W=w.clientX-D.left,k=w.clientY-D.top,{poleRadius:q,maxPoles:P}=o.current,N=q*2;let U=-1;for(let Y=0;Y<M.length;Y++){const X=M[Y].x-W,_=M[Y].y-k;if(X*X+_*_<N*N){U=Y;break}}if(U>=0)h=U,x=W-M[U].x,E=k-M[U].y;else if(M.length<P){const Y=M.length%2===0?1:-1;M.push({x:W,y:k,charge:Y}),i=!0}}function S(w){if(!o.current.interactive||h<0)return;const D=g.getBoundingClientRect();M[h].x=w.clientX-D.left-x,M[h].y=w.clientY-D.top-E,i=!0}function R(){h=-1}function v(w){if(!o.current.interactive||(w.preventDefault(),M.length<=2))return;const D=g.getBoundingClientRect(),W=w.clientX-D.left,k=w.clientY-D.top,{poleRadius:q}=o.current,P=q*2;for(let N=0;N<M.length;N++){const U=M[N].x-W,Y=M[N].y-k;if(U*U+Y*Y<P*P){M.splice(N,1),i=!0;break}}}function A(w){if(!o.current.interactive)return;w.preventDefault();const D=g.getBoundingClientRect(),W=w.touches[0].clientX-D.left,k=w.touches[0].clientY-D.top,{poleRadius:q}=o.current,P=q*2;for(let N=0;N<M.length;N++){const U=M[N].x-W,Y=M[N].y-k;if(U*U+Y*Y<P*P){h=N,x=W-M[N].x,E=k-M[N].y;return}}}function p(w){if(!o.current.interactive||h<0)return;w.preventDefault();const D=g.getBoundingClientRect();M[h].x=w.touches[0].clientX-D.left-x,M[h].y=w.touches[0].clientY-D.top-E,i=!0}function f(){h=-1}y.addEventListener("mousedown",u),y.addEventListener("mousemove",S),window.addEventListener("mouseup",R),y.addEventListener("contextmenu",v),y.addEventListener("touchstart",A,{passive:!1}),y.addEventListener("touchmove",p,{passive:!1}),y.addEventListener("touchend",f);let b=0;function z(w){const D=b?Math.min(.05,(w-b)/1e3):.016666666666666666;b=w,c>0&&$(D),a=requestAnimationFrame(z)}return a=requestAnimationFrame(z),()=>{B.disconnect(),cancelAnimationFrame(a),y.removeEventListener("mousedown",u),y.removeEventListener("mousemove",S),window.removeEventListener("mouseup",R),y.removeEventListener("contextmenu",v),y.removeEventListener("touchstart",A),y.removeEventListener("touchmove",p),y.removeEventListener("touchend",f)}},[e])}const Ga={default:{positiveColor:"#ef5350",negativeColor:"#42a5f5",lineColor:"#e0f2fe",backgroundColor:"#06101c"},monochrome:{},neon:{positiveColor:"#f43f5e",negativeColor:"#3b82f6",lineColor:"#00ffcc",backgroundColor:"#000000",glowEffect:!0,glowBlur:25,lineOpacity:.8},warm:{positiveColor:"#f97316",negativeColor:"#fbbf24",lineColor:"#fed7aa",backgroundColor:"#0c0500",glowEffect:!0,glowBlur:18},mono:{positiveColor:"#ffffff",negativeColor:"#6b7280",lineColor:"#9ca3af",backgroundColor:"#111111",glowEffect:!1,lineOpacity:.5},electric:{positiveColor:"#38bdf8",negativeColor:"#a78bfa",lineColor:"#e0f2fe",backgroundColor:"#020c14",glowEffect:!0,glowBlur:30,fieldLineCount:24},minimal:{positiveColor:"#ef4444",negativeColor:"#3b82f6",lineColor:"#4b5563",backgroundColor:"#111111",glowEffect:!1,lineOpacity:.4,fieldLineCount:10}},sn=G.forwardRef((e,d)=>{const{preset:o,fieldLineCount:g,stepSize:y,maxSteps:t,positiveColor:c,negativeColor:C,lineColor:a,backgroundColor:r,lineWidth:i,lineOpacity:n,poleRadius:s,glowEffect:l,glowBlur:m,animated:I,interactive:M,maxPoles:h,width:x,height:E,className:L,style:F}=e,B=Ga[o??"default"]||{},j=G.useRef(null);return G.useImperativeHandle(d,()=>j.current),qa(j,{fieldLineCount:g??B.fieldLineCount??16,stepSize:y??4,maxSteps:t??400,positiveColor:c??B.positiveColor??"#ef4444",negativeColor:C??B.negativeColor??"#3b82f6",lineColor:a??B.lineColor??"#6b7280",backgroundColor:r??B.backgroundColor??"#111111",lineWidth:i??1,lineOpacity:n??B.lineOpacity??.6,poleRadius:s??12,glowEffect:l??B.glowEffect??!0,glowBlur:m??B.glowBlur??20,animated:I??!0,interactive:M??!0,maxPoles:h??6}),ct.jsx("div",{className:L,style:{width:x??"100%",height:E??"100%",display:"block",overflow:"hidden",cursor:M??!0?"pointer":"default",...F},children:ct.jsx("canvas",{ref:j,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});sn.displayName="MagneticField";function ja(e,d){const o=G.useRef(d);o.current=d;const g=G.useRef([]),y=G.useRef([]),t=G.useRef([]),c=G.useRef(0),C=G.useRef({x:-999,y:-999}),a=G.useRef(0);G.useEffect(()=>{const r=e.current;if(!r)return;const i=r.parentElement;if(!i)return;const n=r.getContext("2d");let s=0,l=0;function m(){const{segmentCount:R}=o.current,v=s/2,A=l/2;g.current=Array.from({length:R},(p,f)=>({x:v-f*12,y:A})),C.current={x:v,y:A}}function I(R,v){const{starCount:A}=o.current;t.current=Array.from({length:A},()=>({x:Math.random()*R,y:Math.random()*v,r:.3+Math.random()*1.2,opacity:.4+Math.random()*.6,isGlowing:Math.random()<.28}))}function M(R,v){const A=window.devicePixelRatio||1;r.width=Math.round(R*A),r.height=Math.round(v*A),r.style.width=`${R}px`,r.style.height=`${v}px`,n.scale(A,A),s=R,l=v,m(),I(R,v)}const h=new ResizeObserver(R=>{const{width:v,height:A}=R[0].contentRect;v>0&&A>0&&M(v,A)});h.observe(i);const x=i.getBoundingClientRect();x.width>0&&x.height>0&&M(x.width,x.height);let E=!1;function L(R){if(!o.current.interactive)return;const v=It(R,r);E=!!v,v&&(C.current=v)}function F(){E=!1}window.addEventListener("mousemove",L),document.addEventListener("mouseleave",F);function B(R,v,A,p){const{segmentSize:f}=o.current,b=Math.sqrt(A*A+p*p)||1,z=A/b,w=p/b,D=3+Math.floor(Math.random()*2);for(let W=0;W<D;W++){const q=40+Math.random()*20;y.current.push({x:R+z*f*.9,y:v+w*f*.9,vx:z*(2.5+Math.random()*3)+(Math.random()-.5)*1.8,vy:w*(2.5+Math.random()*3)+(Math.random()-.5)*1.8-.3,life:q,maxLife:q,size:3+Math.random()*5})}y.current.length>200&&y.current.splice(0,30)}function j(R,v){const[A,p,f]=R.split(",").map(Number),b=v<0?0:255,z=Math.abs(v);return`${Math.round(A+(b-A)*z)},${Math.round(p+(b-p)*z)},${Math.round(f+(b-f)*z)}`}function H(R,v,A,p,f,b,z){const w=[],D=Math.cos(A),W=Math.sin(A);n.save(),n.translate(R,v),n.rotate(A);const k=[{a:Math.PI/2-.12+f,len:p*.92},{a:Math.PI/2+.46+f,len:p},{a:Math.PI/2+.98+f,len:p*.62}];for(const q of[-1,1]){const P=k.map(X=>({x:Math.cos(X.a)*X.len,y:q*Math.sin(X.a)*X.len})),N=X=>({x:(P[X].x+P[X+1].x)*.5*.7,y:(P[X].y+P[X+1].y)*.5*.7}),U=P[1],Y=n.createLinearGradient(0,0,U.x,U.y);Y.addColorStop(0,`rgba(${j(b,-.25)},0.88)`),Y.addColorStop(.55,`rgba(${b},0.5)`),Y.addColorStop(1,`rgba(${b},0.2)`),n.beginPath(),n.moveTo(0,0),n.lineTo(P[0].x,P[0].y);for(let X=0;X<P.length-1;X++){const _=N(X);n.quadraticCurveTo(_.x,_.y,P[X+1].x,P[X+1].y)}n.closePath(),n.fillStyle=Y,n.fill(),n.save(),n.shadowColor=`rgba(${b},0.8)`,n.shadowBlur=10,n.beginPath(),n.moveTo(P[0].x,P[0].y);for(let X=0;X<P.length-1;X++){const _=N(X);n.quadraticCurveTo(_.x,_.y,P[X+1].x,P[X+1].y)}n.strokeStyle=`rgba(${j(b,.35)},0.85)`,n.lineWidth=1.4,n.stroke(),n.restore(),n.strokeStyle=`rgba(${j(b,.3)},0.28)`,n.lineWidth=.8;for(let X=0;X<P.length-1;X++){const _=N(X);n.beginPath(),n.moveTo(0,0),n.quadraticCurveTo(_.x*.4,_.y*.55,_.x,_.y),n.stroke()}for(const X of P)n.beginPath(),n.moveTo(0,0),n.lineTo(X.x,X.y),n.strokeStyle=`rgba(${j(b,.15)},0.95)`,n.lineWidth=2.2,n.lineCap="round",n.stroke(),w.push({x:R+D*X.x-W*X.y,y:v+W*X.x+D*X.y})}n.restore(),n.fillStyle=`rgba(${z},0.95)`;for(const q of w)n.beginPath(),n.arc(q.x,q.y,2.2,0,Math.PI*2),n.fill()}let O=d.starCount;function T(){const{starCount:R,starColor:v,glowingStars:A,starGlowBlur:p}=o.current;R!==O&&(O=R,I(s,l));const f=t.current;if(f.length!==0){n.fillStyle=v;for(const b of f)A&&b.isGlowing||(n.globalAlpha=b.opacity,n.beginPath(),n.arc(b.x,b.y,b.r,0,Math.PI*2),n.fill());if(A){n.shadowColor=v,n.shadowBlur=p;for(const b of f)b.isGlowing&&(n.globalAlpha=b.opacity*.12,n.beginPath(),n.arc(b.x,b.y,b.r*5,0,Math.PI*2),n.fill(),n.globalAlpha=b.opacity*.35,n.beginPath(),n.arc(b.x,b.y,b.r*2.5,0,Math.PI*2),n.fill(),n.globalAlpha=b.opacity,n.beginPath(),n.arc(b.x,b.y,b.r*1.5,0,Math.PI*2),n.fill());n.shadowBlur=0,n.shadowColor="rgba(0,0,0,0)"}n.globalAlpha=1}}function $(R){const{segmentCount:v,segmentSize:A,bodyColor:p,eyeColor:f,fireColor:b,backgroundColor:z,followSpeed:w,wingSpan:D,showFire:W,interactive:k}=o.current;a.current+=R*.001;const q=a.current;n.fillStyle=z,n.fillRect(0,0,s,l),T();const P=g.current;(!k||!E)&&(C.current={x:s*.5+Math.sin(q*.5)*s*.35,y:l*.5+Math.cos(q*.7)*l*.3});const N=C.current;for(;P.length<v;){const K=P[P.length-1]||{x:s/2,y:l/2};P.push({x:K.x,y:K.y})}P.length>v&&(P.length=v);const U=P[0],Y=Math.min(w,1);U.x+=(N.x-U.x)*Y,U.y+=(N.y-U.y)*Y;for(let K=1;K<P.length;K++){const J=P[K-1],nt=P[K],st=J.x-nt.x,rt=J.y-nt.y,lt=Math.sqrt(st*st+rt*rt)||.001,Z=A*1.2;lt>Z&&(nt.x=J.x-st/lt*Z,nt.y=J.y-rt/lt*Z);const et=-rt/lt,it=st/lt,ft=Math.sin(q*4-K*.4)*(A*.25)*(K/P.length);nt.x+=et*ft,nt.y+=it*ft}const X=P.length>=2?Math.atan2(P[0].y-P[1].y,P[0].x-P[1].x):0,_=mt(p),V=mt(b);if(W&&P.length>=2){const K=P[0],J=P[1],nt=K.x-J.x,st=K.y-J.y;Math.random()<.8&&B(K.x,K.y,nt,st)}const Q=mt(f),ot=P[0],tt=P.length;{const K=n.createRadialGradient(ot.x,ot.y,0,ot.x,ot.y,A*9);K.addColorStop(0,`rgba(${_},0.16)`),K.addColorStop(1,`rgba(${_},0)`),n.fillStyle=K,n.fillRect(0,0,s,l)}if(W){n.globalCompositeOperation="lighter";for(let K=y.current.length-1;K>=0;K--){const J=y.current[K];if(J.x+=J.vx,J.y+=J.vy,J.life-=1,J.life<=0){y.current.splice(K,1);continue}const nt=J.life/J.maxLife,st=Math.max(1,J.size*(.5+nt)*1.5),rt=n.createRadialGradient(J.x,J.y,0,J.x,J.y,st);rt.addColorStop(0,`rgba(255,246,222,${nt*.9})`),rt.addColorStop(.35,`rgba(${V},${nt*.7})`),rt.addColorStop(1,`rgba(${V},0)`),n.fillStyle=rt,n.beginPath(),n.arc(J.x,J.y,st,0,Math.PI*2),n.fill()}n.globalCompositeOperation="source-over"}const at=Math.sin(q*6)*.28;if(tt>=4){const K=P[2],J=P[3];H(K.x,K.y,Math.atan2(K.y-J.y,K.x-J.x),D,at,_,V)}if(tt>=3){const K=[],J=[];for(let Z=0;Z<tt;Z++){const et=P[Math.max(0,Z-1)],it=P[Math.min(tt-1,Z+1)],ft=et.x-it.x,dt=et.y-it.y,gt=Math.sqrt(ft*ft+dt*dt)||1;K.push({x:ft/gt,y:dt/gt});const pt=Z/(tt-1);J.push(A*(Z===0?.62:.86*Math.pow(1-pt,.8)+.12))}const nt=(Z,et,it)=>({x:P[Z].x-K[Z].y*J[Z]*et*it,y:P[Z].y+K[Z].x*J[Z]*et*it}),st=P[tt-1],rt={x:st.x-K[tt-1].x*A*1.3,y:st.y-K[tt-1].y*A*1.3},lt=Z=>{const et=[];for(let it=0;it<tt;it++)et.push(nt(it,Z,1));et.push(rt);for(let it=tt-1;it>=0;it--)et.push(nt(it,Z,-1));n.beginPath(),n.moveTo(et[0].x,et[0].y);for(let it=1;it<et.length-1;it++){const ft=(et[it].x+et[it+1].x)/2,dt=(et[it].y+et[it+1].y)/2;n.quadraticCurveTo(et[it].x,et[it].y,ft,dt)}n.closePath()};{const Z=K[tt-1].x,et=K[tt-1].y,it=A*.62;n.beginPath(),n.moveTo(st.x,st.y),n.quadraticCurveTo(st.x-Z*A*.5-et*it,st.y-et*A*.5+Z*it,st.x-Z*A*2,st.y-et*A*2),n.quadraticCurveTo(st.x-Z*A*.5+et*it,st.y-et*A*.5-Z*it,st.x,st.y),n.fillStyle=`rgba(${j(V,-.1)},0.88)`,n.fill()}for(const Z of[Math.round(tt*.3),Math.round(tt*.58)]){const et=Math.sin(q*4+Z)*A*.22;for(const it of[-1,1]){const ft=K[Z],dt=-ft.y*it,gt=ft.x*it,pt={x:P[Z].x+dt*J[Z]*.7,y:P[Z].y+gt*J[Z]*.7},yt={x:pt.x+dt*A*.85+ft.x*A*.25,y:pt.y+gt*A*.85+ft.y*A*.25},wt={x:yt.x+dt*A*.45-ft.x*(A*.7-et),y:yt.y+gt*A*.45-ft.y*(A*.7-et)};n.lineCap="round",n.lineJoin="round",n.beginPath(),n.moveTo(pt.x,pt.y),n.lineTo(yt.x,yt.y),n.lineTo(wt.x,wt.y),n.strokeStyle=`rgba(${j(_,-.55)},1)`,n.lineWidth=A*.34,n.stroke(),n.strokeStyle=`rgba(${j(_,-.15)},1)`,n.lineWidth=A*.16,n.stroke();for(const St of[-.5,0,.5]){const Mt=Math.atan2(wt.y-yt.y,wt.x-yt.x)+St;n.beginPath(),n.moveTo(wt.x,wt.y),n.lineTo(wt.x+Math.cos(Mt)*A*.34,wt.y+Math.sin(Mt)*A*.34),n.strokeStyle=`rgba(${j(V,.35)},0.95)`,n.lineWidth=1.6,n.stroke()}}}n.save(),lt(1),n.fillStyle=`rgba(${j(_,-.68)},1)`,n.fill(),n.shadowColor=`rgba(${_},0.95)`,n.shadowBlur=16,n.strokeStyle=`rgba(${j(_,.12)},0.95)`,n.lineWidth=2,n.stroke(),n.restore(),lt(.62),n.fillStyle=`rgba(${j(_,-.42)},1)`,n.fill(),lt(.24),n.fillStyle=`rgba(${j(_,-.05)},0.8)`,n.fill(),n.lineWidth=1,n.lineCap="round";for(let Z=1;Z<tt-1;Z++){const et=J[Z],it=nt(Z,.8,1),ft=nt(Z,.8,-1),dt=P[Z].x-K[Z].x*et*.95,gt=P[Z].y-K[Z].y*et*.95;n.beginPath(),n.moveTo(it.x,it.y),n.quadraticCurveTo(dt,gt,ft.x,ft.y),n.strokeStyle=`rgba(${j(_,.45)},${.42-Z/tt*.2})`,n.stroke()}for(let Z=1;Z<tt-1;Z++){const et=J[Z],it=et*(.95-Z/tt*.3),ft=P[Z].x,dt=P[Z].y,gt=et*.28;n.beginPath(),n.moveTo(ft-K[Z].y*gt,dt+K[Z].x*gt),n.lineTo(ft-K[Z].x*it,dt-K[Z].y*it),n.lineTo(ft+K[Z].y*gt,dt-K[Z].x*gt),n.closePath(),n.fillStyle=`rgba(${j(V,.05)},${.95-Z/tt*.35})`,n.fill()}}{const K=A;n.save(),n.translate(ot.x,ot.y),n.rotate(X),n.lineCap="round";for(const lt of[-1,1]){const Z=Math.sin(q*3+lt)*K*.45;n.beginPath(),n.moveTo(K*1.15,lt*K*.2),n.bezierCurveTo(K*.4,lt*K*1.1,-K*.8,lt*(K*1.4)+Z,-K*2.1,lt*(K*1.9)+Z*1.5),n.strokeStyle=`rgba(${j(V,.1)},0.75)`,n.lineWidth=1.5,n.stroke()}for(const lt of[-1,1])n.beginPath(),n.moveTo(K*.05,lt*K*.42),n.quadraticCurveTo(-K*.9,lt*K*.55,-K*1.75,lt*K*1.25),n.quadraticCurveTo(-K*.85,lt*K*.98,-K*.3,lt*K*.78),n.closePath(),n.fillStyle=`rgba(${j(V,.2)},1)`,n.fill(),n.strokeStyle=`rgba(${j(V,-.35)},0.9)`,n.lineWidth=1,n.stroke();const J=[[1.62,0],[1.2,.3],[.65,.4],[.3,.66],[-.3,.82],[-.82,.5],[-.98,0],[-.82,-.5],[-.3,-.82],[.3,-.66],[.65,-.4],[1.2,-.3]],nt=()=>{n.beginPath();const lt=[(J[0][0]+J[1][0])/2,(J[0][1]+J[1][1])/2];n.moveTo(K*lt[0],K*lt[1]);for(let Z=1;Z<=J.length;Z++){const et=J[Z%J.length],it=J[(Z+1)%J.length];n.quadraticCurveTo(K*et[0],K*et[1],K*(et[0]+it[0])/2,K*(et[1]+it[1])/2)}n.closePath()};n.save(),nt();const st=n.createLinearGradient(-K,0,K*1.6,0);st.addColorStop(0,`rgba(${j(_,-.6)},1)`),st.addColorStop(1,`rgba(${j(_,-.15)},1)`),n.fillStyle=st,n.fill(),n.shadowColor=`rgba(${_},0.95)`,n.shadowBlur=16,n.strokeStyle=`rgba(${j(_,.15)},0.95)`,n.lineWidth=2,n.stroke(),n.restore(),n.strokeStyle=`rgba(${j(_,.4)},0.5)`,n.lineWidth=1.2,n.beginPath(),n.moveTo(K*1.45,0),n.lineTo(-K*.7,0),n.stroke();for(const lt of[-1,1])n.beginPath(),n.moveTo(K*.75,lt*K*.2),n.quadraticCurveTo(K*.45,lt*K*.62,-K*.05,lt*K*.62),n.stroke();for(const lt of[-1,1])n.beginPath(),n.ellipse(K*1.28,lt*K*.13,K*.07,K*.04,0,0,Math.PI*2),n.fillStyle="rgba(0,0,0,0.75)",n.fill();for(const lt of[-1,1]){const Z=K*.5,et=lt*K*.42;n.beginPath(),n.ellipse(Z,et,K*.25,K*.15,lt*-.35,0,Math.PI*2),n.fillStyle=`rgba(${Q},1)`,n.fill(),n.beginPath(),n.ellipse(Z+K*.02,et,K*.05,K*.13,0,0,Math.PI*2),n.fillStyle="rgba(10,6,0,0.95)",n.fill()}n.restore();const rt=(lt,Z)=>({x:ot.x+Math.cos(X)*lt-Math.sin(X)*Z,y:ot.y+Math.sin(X)*lt+Math.cos(X)*Z});n.save(),n.globalCompositeOperation="lighter";for(const lt of[-1,1]){const Z=rt(K*.5,lt*K*.42),et=n.createRadialGradient(Z.x,Z.y,0,Z.x,Z.y,K*.6);et.addColorStop(0,`rgba(${Q},0.55)`),et.addColorStop(1,`rgba(${Q},0)`),n.fillStyle=et,n.beginPath(),n.arc(Z.x,Z.y,K*.6,0,Math.PI*2),n.fill()}if(W){const lt=rt(K*1.55,0),Z=n.createRadialGradient(lt.x,lt.y,0,lt.x,lt.y,K*.95);Z.addColorStop(0,"rgba(255,240,210,0.85)"),Z.addColorStop(.4,`rgba(${V},0.5)`),Z.addColorStop(1,`rgba(${V},0)`),n.fillStyle=Z,n.beginPath(),n.arc(lt.x,lt.y,K*.95,0,Math.PI*2),n.fill()}n.restore(),n.fillStyle="rgba(255,255,255,0.9)";for(const lt of[-1,1]){const Z=rt(K*.6,lt*K*.37);n.beginPath(),n.arc(Z.x,Z.y,K*.035,0,Math.PI*2),n.fill()}}}let u=0;function S(R){const v=u?R-u:16;u=R,$(v),c.current=requestAnimationFrame(S)}return c.current=requestAnimationFrame(S),()=>{h.disconnect(),cancelAnimationFrame(c.current),window.removeEventListener("mousemove",L),document.removeEventListener("mouseleave",F)}},[e])}const Xa={default:{bodyColor:"#35e0a1",eyeColor:"#ffd24a",fireColor:"#ff9d3c",backgroundColor:"#07130f"},monochrome:{},emerald:{bodyColor:"#00ff88",eyeColor:"#00ff00",fireColor:"#00ffaa",backgroundColor:"#0a1a0f"},inferno:{bodyColor:"#ff6600",eyeColor:"#ff0000",fireColor:"#ffaa00",backgroundColor:"#1a0500"},void:{bodyColor:"#9900ff",eyeColor:"#cc00ff",fireColor:"#6600cc",backgroundColor:"#050010"},ice:{bodyColor:"#88ddff",eyeColor:"#ffffff",fireColor:"#aaeeff",backgroundColor:"#050a14"}},ln=G.forwardRef((e,d)=>{const{preset:o,segmentCount:g,segmentSize:y,bodyColor:t,eyeColor:c,fireColor:C,backgroundColor:a,followSpeed:r,wingSpan:i,showFire:n,interactive:s,starCount:l,starColor:m,glowingStars:I,starGlowBlur:M,width:h,height:x,className:E,style:L}=e,F=Xa[o??"default"]||{},B=G.useRef(null);return G.useImperativeHandle(d,()=>B.current),ja(B,{segmentCount:g??20,segmentSize:y??F.segmentSize??18,bodyColor:t??F.bodyColor??"#ffffff",eyeColor:c??F.eyeColor??"#111111",fireColor:C??F.fireColor??"#ffffff",backgroundColor:a??F.backgroundColor??"transparent",followSpeed:r??.15,wingSpan:i??F.wingSpan??80,showFire:n??!1,interactive:s??!0,starCount:l??60,starColor:m??"#ffffff",glowingStars:I??!1,starGlowBlur:M??8}),ct.jsx("div",{className:E,style:{width:h??"100%",height:x??"100%",display:"block",overflow:"hidden",cursor:"none",...L},children:ct.jsx("canvas",{ref:B,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});ln.displayName="DragonCursor";function Ha(e,d,o){const g=Math.sin(d.t*1.5+e.phase)*d.wind*.5;e.vx+=g*.01*o,e.vy+=d.gravity*.016*o,e.x+=(e.vx+d.wind*.02)*o,e.y+=e.vy*o,e.angle+=(e.angularVel+Math.sin(d.t*2+e.phase)*.002)*o,e.scaleY=.6+Math.abs(Math.sin(e.angle*1.5))*.4}function Ya(e){const d=G.useRef(e);d.current=e;const o=G.useRef([]),g=G.useRef({w:0,h:0}),y=G.useRef(0),t=G.useRef({strength:0,dir:1});function c(r){const{petalSize:i}=d.current,{w:n,h:s}=g.current,l={x:Math.random()*n,y:r?-i-Math.random()*80:Math.random()*s,vx:(Math.random()-.5)*.6,vy:.2+Math.random()*.5,angle:Math.random()*Math.PI*2,angularVel:(Math.random()-.5)*.06,sizeMul:.7+Math.random()*.6,size:0,alpha:.6+Math.random()*.4,settled:!1,settleY:0,phase:Math.random()*Math.PI*2,scaleY:1,rest:null};return l.size=i*l.sizeMul,l}function C(r,i,n){r.save(),r.translate(i.x,i.y),r.rotate(i.angle),r.scale(1,i.scaleY),r.globalAlpha=i.alpha;const s=i.size;r.beginPath(),r.moveTo(0,-s),r.quadraticCurveTo(s*.8,-s*.3,0,s*.6),r.quadraticCurveTo(-s*.8,-s*.3,0,-s),r.fillStyle=n,r.fill(),r.globalAlpha=1,r.restore()}function a(r,i,n,s,l){var D;const{petalCount:m,petalColor:I,backgroundColor:M,gravity:h,windStrength:x,windGusts:E,showAccumulation:L,maxAccumulation:F,restitution:B}=d.current,j=s/16.67;y.current+=s*.001;const H=y.current;l.overlay||(r.fillStyle=M,r.fillRect(0,0,i,n));const O=t.current;E&&(Math.random()<.003*j&&(O.strength=2+Math.random()*3,O.dir=Math.random()<.5?1:-1),O.strength*=Math.pow(.985,j));const T=x+O.strength*O.dir,$={t:H,wind:T,gravity:h},u=m>0?Math.max(1,Math.ceil(m*l.quality)):0,S=o.current;for(;S.length<u;)S.push(c(!0));S.length>u&&(S.length=u);for(const W of S)W.sizeMul!==void 0&&(W.size=d.current.petalSize*W.sizeMul);const R=`rgb(${mt(I)})`,v=S.filter(W=>W.settled),A=v.reduce((W,k)=>W+(k.rest?0:1),0),p=L?Math.min(F,A*.6):0,f=n-p,b=l.solids,z=new Map(b.map(W=>[W.id,W])),w=()=>{if(v.length>u*.6){const W=S.find(k=>k.settled);W&&Object.assign(W,c(!0))}};for(const W of v){if(W.rest&&(W.rest.offsetX+=T*.006*j,!ae(W,W.rest,z))){W.settled=!1,W.rest=null,W.vy=.3;continue}C(r,W,R)}for(const W of S){if(W.settled)continue;const k=W.x,q=W.y;if(Ha(W,$,j),b.length>0){const P=Xe(W,k,q,b,B);if(P&&B===0){let N=0;for(const Y of S)((D=Y.rest)==null?void 0:D.solidId)===P.id&&N++;const U=L?Math.min(F,N*.6):0;W.settled=!0,W.rest=re(W,P,-U-W.size*.3),W.y=P.y+W.rest.dy,W.settleY=W.y,W.angle=(Math.random()-.5)*.6,W.alpha*=.8,w(),C(r,W,R);continue}}W.x<-W.size&&(W.x=i+W.size),W.x>i+W.size&&(W.x=-W.size),W.y>=f-W.size*.5&&(L?(W.settled=!0,W.x=Math.max(W.size,Math.min(i-W.size,W.x)),W.y=f-W.size*.3,W.settleY=W.y,W.angle=(Math.random()-.5)*.6,W.alpha*=.8,w()):Object.assign(W,c(!0))),C(r,W,R)}}return xt({overlay:e.overlay,collide:e.collide,onResize:(r,i)=>{g.current={w:r,h:i},o.current=Array.from({length:d.current.petalCount},()=>c(!1))},onFrame:a})}const Na={default:{petalColor:"#ffb7c5",backgroundColor:"#1a0a10"},monochrome:{},sakura:{petalColor:"#ffb7c5",backgroundColor:"#1a0a10",windStrength:1},autumn:{petalColor:"#e06030",backgroundColor:"#0d0805",windStrength:1.4,gravity:.09},snow:{petalColor:"#ddeeff",backgroundColor:"#050a14",windStrength:.5,gravity:.03,petalSize:5},neon:{petalColor:"#ff00aa",backgroundColor:"#050005",windStrength:.9}},cn=G.forwardRef((e,d)=>{const{preset:o,petalCount:g,petalColor:y,petalSize:t,backgroundColor:c,gravity:C,windStrength:a,windGusts:r,showAccumulation:i,maxAccumulation:n,overlay:s,collide:l,restitution:m,zIndex:I,width:M,height:h,className:x,style:E}=e,L=Na[o??"default"]||{},{canvasRef:F,canvas:B}=Ya({petalCount:g??80,petalColor:y??L.petalColor??"#ffffff",petalSize:t??L.petalSize??8,backgroundColor:c??L.backgroundColor??"#111111",gravity:C??L.gravity??.06,windStrength:a??L.windStrength??.8,windGusts:r??!0,showAccumulation:i??!0,maxAccumulation:n??40,overlay:s??!1,collide:l??!1,restitution:m??0});return G.useImperativeHandle(d,()=>B,[B]),ct.jsx(vt,{canvasRef:F,overlay:s,zIndex:I,width:M,height:h,className:x,style:E})});cn.displayName="SakuraBlossom";function Ua(e,d,o){return(Math.sin(e*1.3+o)*Math.cos(d*1.1-o*.7)+Math.sin(e*2.7-o*1.3)*Math.cos(d*2.1+o*.9)*.5+1.5)/3}function _a(e,d){const o=G.useRef(d);o.current=d;const g=G.useRef([]),y=G.useRef([]),t=G.useRef([]),c=G.useRef(0),C=G.useRef(0),a=G.useRef(null),r=G.useRef(null);G.useEffect(()=>{const i=e.current;if(!i)return;const n=i.parentElement;if(!n)return;const s=i.getContext("2d");let l=0,m=0;function I(){const $=Math.random()*Math.PI*2,u=.5+Math.random()*.8,S=u*o.current.speed,R=40+Math.random()*30,v=Math.random()*l,A=Math.random()*m,p=Math.random()<.4;return{x:v,y:A,vx:Math.cos($)*S,vy:Math.sin($)*S,angle:$,speedMul:u,length:R,segments:Array.from({length:8},(f,b)=>({x:v-Math.cos($)*b*(R/8),y:A-Math.sin($)*b*(R/8)})),tailPhase:Math.random()*Math.PI*2,isAccent:p,wanderAngle:$}}function M(){t.current=Array.from({length:5},()=>({x:l*.1+Math.random()*l*.8,y:m*.1+Math.random()*m*.8,radius:18+Math.random()*22,rotation:Math.random()*Math.PI*2,gapAngle:.3+Math.random()*.4}))}function h(){const{fishCount:$}=o.current;g.current=Array.from({length:$},I),M()}function x($,u){const S=window.devicePixelRatio||1;i.width=Math.round($*S),i.height=Math.round(u*S),i.style.width=`${$}px`,i.style.height=`${u}px`,s.scale(S,S),l=$,m=u,h()}const E=new ResizeObserver($=>{const{width:u,height:S}=$[0].contentRect;u>0&&S>0&&x(u,S)});E.observe(n);const L=n.getBoundingClientRect();L.width>0&&L.height>0&&x(L.width,L.height);function F($){if(!o.current.interactive)return;const u=It($,i);if(!u)return B();const S=u.x,R=u.y,v=a.current;if(v){const A=S-v.x,p=R-v.y;A*A+p*p>400&&y.current.push({x:S,y:R,radius:0,maxRadius:60,alpha:.6})}a.current={x:S,y:R},r.current={x:S,y:R}}function B(){a.current=null}window.addEventListener("mousemove",F),document.addEventListener("mouseleave",B);function j($,u){const S=$.segments;if(S.length<2)return;const{fishColor:R,scaleColor:v}=o.current,A=mt($.isAccent?v:R),p=mt($.isAccent?R:v);s.save();const f=S.map((X,_)=>{const V=_/(S.length-1);return $.length*.18*Math.sin(Math.PI*(1-V))});s.beginPath();for(let X=0;X<S.length;X++){const _=S[X],V=S[Math.min(X+1,S.length-1)],Q=V.x-_.x,ot=V.y-_.y,tt=Math.sqrt(Q*Q+ot*ot)||.001,at=-ot/tt*f[X],K=Q/tt*f[X];X===0?s.moveTo(_.x+at,_.y+K):s.lineTo(_.x+at,_.y+K)}for(let X=S.length-1;X>=0;X--){const _=S[X],V=S[Math.min(X+1,S.length-1)],Q=V.x-_.x,ot=V.y-_.y,tt=Math.sqrt(Q*Q+ot*ot)||.001,at=-ot/tt*f[X],K=Q/tt*f[X];s.lineTo(_.x-at,_.y-K)}s.closePath(),s.fillStyle=`rgba(${A},0.85)`,s.fill();for(let X=1;X<S.length-2;X+=2){const _=S[X],V=f[X]*.7;V>1&&(s.beginPath(),s.arc(_.x,_.y,V,0,Math.PI*2),s.fillStyle=`rgba(${p},0.5)`,s.fill())}const b=S[S.length-1],z=S[S.length-2],w=Math.atan2(b.y-z.y,b.x-z.x),D=Math.sin($.tailPhase+u*5)*.6,W=$.length*.35;s.beginPath(),s.moveTo(b.x,b.y),s.lineTo(b.x+Math.cos(w+Math.PI/2+D)*W,b.y+Math.sin(w+Math.PI/2+D)*W),s.lineTo(b.x+Math.cos(w-Math.PI/2-D)*W,b.y+Math.sin(w-Math.PI/2-D)*W),s.closePath(),s.fillStyle=`rgba(${A},0.6)`,s.fill();const k=S[0],q=S[1],P=Math.atan2(k.y-q.y,k.x-q.x),N=f[0]*.4,U=k.x+Math.cos(P+Math.PI/3)*N,Y=k.y+Math.sin(P+Math.PI/3)*N;s.beginPath(),s.arc(U,Y,Math.max(1.5,N*.5),0,Math.PI*2),s.fillStyle="#111111",s.fill(),s.restore()}function H($){const{fishCount:u,fishColor:S,scaleColor:R,waterColor:v,rippleColor:A,lilyColor:p,speed:f,showLilies:b,caustics:z}=o.current;C.current+=$*.001;const w=C.current;if(s.fillStyle=v,s.fillRect(0,0,l,m),z){const q=Math.ceil(l/40),P=Math.ceil(m/40);mt(v);for(let N=0;N<P;N++)for(let U=0;U<q;U++){const Y=Ua(U*.4,N*.4,w*.8);if(Y>.6){const X=(Y-.6)*.25;s.fillStyle=`rgba(255,255,255,${X})`,s.fillRect(U*40,N*40,40,40)}}}for(;g.current.length<u;)g.current.push(I());g.current.length>u&&(g.current.length=u);const D=a.current;for(const k of g.current){k.wanderAngle+=(Math.random()-.5)*.05;const q=k.speedMul*f,P=Math.cos(k.wanderAngle)*q,N=Math.sin(k.wanderAngle)*q;k.vx+=(P-k.vx)*.02,k.vy+=(N-k.vy)*.02;for(const Q of g.current){if(Q===k)continue;const ot=k.x-Q.x,tt=k.y-Q.y,at=Math.sqrt(ot*ot+tt*tt)||.001;at<k.length*1.5&&(k.vx+=ot/at*.05,k.vy+=tt/at*.05)}if(D){const Q=k.x-D.x,ot=k.y-D.y,tt=Math.sqrt(Q*Q+ot*ot)||.001;tt<80&&(k.vx+=Q/tt*.3,k.vy+=ot/tt*.3,k.wanderAngle=Math.atan2(k.vy,k.vx))}const U=60;k.x<U&&(k.vx+=.1),k.x>l-U&&(k.vx-=.1),k.y<U&&(k.vy+=.1),k.y>m-U&&(k.vy-=.1);const Y=Math.sqrt(k.vx*k.vx+k.vy*k.vy)||.001,X=q*1.8;Y>X&&(k.vx=k.vx/Y*X,k.vy=k.vy/Y*X),k.angle=Math.atan2(k.vy,k.vx),k.x+=k.vx,k.y+=k.vy,k.tailPhase+=.05;const _=k.segments;_[0].x+=(k.x-_[0].x)*.4,_[0].y+=(k.y-_[0].y)*.4;const V=k.length/_.length;for(let Q=1;Q<_.length;Q++){const ot=_[Q-1],tt=_[Q],at=ot.x-tt.x,K=ot.y-tt.y,J=Math.sqrt(at*at+K*K)||.001;J>V&&(tt.x=ot.x-at/J*V,tt.y=ot.y-K/J*V)}j(k,w)}if(b){const k=mt(p);for(const q of t.current)s.save(),s.translate(q.x,q.y),s.rotate(q.rotation+w*.05),s.beginPath(),s.arc(0,0,q.radius,q.gapAngle,Math.PI*2-q.gapAngle),s.lineTo(0,0),s.closePath(),s.fillStyle=`rgba(${k},0.55)`,s.fill(),s.strokeStyle=`rgba(${k},0.3)`,s.lineWidth=1,s.stroke(),s.beginPath(),s.arc(0,0,q.radius*.15,0,Math.PI*2),s.fillStyle=`rgba(${k},0.8)`,s.fill(),s.restore()}const W=mt(A);for(let k=y.current.length-1;k>=0;k--){const q=y.current[k];if(q.radius+=1.2,q.alpha-=.012,q.alpha<=0){y.current.splice(k,1);continue}s.beginPath(),s.arc(q.x,q.y,q.radius,0,Math.PI*2),s.strokeStyle=`rgba(${W},${q.alpha})`,s.lineWidth=1,s.stroke(),q.radius>10&&(s.beginPath(),s.arc(q.x,q.y,q.radius*.6,0,Math.PI*2),s.strokeStyle=`rgba(${W},${q.alpha*.5})`,s.stroke())}}let O=0;function T($){const u=O?$-O:16;O=$,H(u),c.current=requestAnimationFrame(T)}return c.current=requestAnimationFrame(T),()=>{E.disconnect(),cancelAnimationFrame(c.current),window.removeEventListener("mousemove",F),document.removeEventListener("mouseleave",B)}},[e])}const Va={default:{fishColor:"#ff6030",scaleColor:"#ffffff",waterColor:"#0a1520",rippleColor:"#60a8d0",lilyColor:"#50aa50"},monochrome:{},koi:{fishColor:"#ff6030",scaleColor:"#ffffff",waterColor:"#0a1520",rippleColor:"#60a8d0",lilyColor:"#50aa50",speed:1},night:{fishColor:"#c0c0ff",scaleColor:"#8080ff",waterColor:"#040812",rippleColor:"#4050a0",lilyColor:"#304030"},lotus:{fishColor:"#ffb0c0",scaleColor:"#ffffff",waterColor:"#0a1218",rippleColor:"#90c0d0",lilyColor:"#ff80a0",speed:.7},neon:{fishColor:"#00ffcc",scaleColor:"#ff00aa",waterColor:"#050010",rippleColor:"#00aaff",lilyColor:"#00ff44",speed:1.2}},fn=G.forwardRef((e,d)=>{const{preset:o,fishCount:g,fishColor:y,scaleColor:t,waterColor:c,rippleColor:C,lilyColor:a,speed:r,interactive:i,showLilies:n,caustics:s,width:l,height:m,className:I,style:M}=e,h=Va[o??"default"]||{},x=G.useRef(null);return G.useImperativeHandle(d,()=>x.current),_a(x,{fishCount:g??6,fishColor:y??h.fishColor??"#ffffff",scaleColor:t??h.scaleColor??"#6b7280",waterColor:c??h.waterColor??"#111111",rippleColor:C??h.rippleColor??"#6b7280",lilyColor:a??h.lilyColor??"#ffffff",speed:r??h.speed??1,interactive:i??!0,showLilies:n??!0,caustics:s??!0}),ct.jsx("div",{className:I,style:{width:l??"100%",height:m??"100%",display:"block",overflow:"hidden",cursor:"crosshair",...M},children:ct.jsx("canvas",{ref:x,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});fn.displayName="KoiPond";const ze=.24;function Ka(e){return Math.max(.25,1+.7*Math.cos(e))}function Ja(e,d,o){return e<o?null:e+d*d/Math.max(e,1)}function Qa(e){const d=G.useRef(e);d.current=e;const o=G.useRef({t:0,cx:0,cy:0,orbiters:[],jets:[],stars:[],starKey:"",disk:{color:"",img:null},jet:{color:"",img:null},star:{color:"",img:null}}).current,g=Rt(),y=G.useRef(null);function t(a,r,i=!1){const n=Math.max(20,a.diskWidth),s=i?.85+Math.random()*.15:Math.pow(Math.random(),1.4);return{r:r+s*n,theta:Math.random()*Math.PI*2,heat:Math.random(),len:.08+Math.random()*.18}}function c(a,r,i,n,s){const l=d.current,m=n/16.67*l.speed;o.t+=n*.001*l.speed;const I=kt(g.current,y.current),M=l.interactive&&I.inside?I.x:r/2,h=l.interactive&&I.inside?I.y:i/2;o.cx===0&&o.cy===0&&(o.cx=M,o.cy=h),o.cx+=(M-o.cx)*(1-Math.pow(.94,m)),o.cy+=(h-o.cy)*(1-Math.pow(.94,m));const x=o.cx,E=o.cy,L=Math.max(6,l.eventHorizonRadius)*1.6,F=L*1.45,B=L*1.6;s.overlay||(a.fillStyle=l.backgroundColor,a.fillRect(0,0,r,i));const j=`${r}|${i}|${l.starCount}`;o.starKey!==j&&(o.starKey=j,o.stars=Array.from({length:l.starCount},()=>({x:Math.random()*r,y:Math.random()*i,r:.4+Math.random()*1.1,glow:Math.random()<.15,tw:Math.random()*6}))),o.star.color!==l.starColor&&(o.star={color:l.starColor,img:Pt(l.starColor,32)});const H=(p,f)=>{if(!l.lensing)return[p,f];const b=p-x,z=f-E,w=Math.hypot(b,z),D=Ja(w,B,L);return D===null?null:[x+b/(w||1)*D,E+z/(w||1)*D]};a.fillStyle=l.starColor;for(const p of o.stars){const f=H(p.x,p.y);if(!f)continue;const b=.35+.35*Math.sin(o.t*1.3+p.tw);if(l.glowingStars&&p.glow&&o.star.img){const z=l.starGlowBlur;a.globalAlpha=b,a.drawImage(o.star.img,f[0]-z,f[1]-z,z*2,z*2)}a.globalAlpha=b,a.fillRect(f[0]-p.r/2,f[1]-p.r/2,p.r,p.r)}if(l.lensing){a.strokeStyle=ut(l.starColor,.05),a.lineWidth=1;const p=48;a.beginPath();for(let f=0;f<=r;f+=p){let b=!1;for(let z=0;z<=i;z+=8){const w=H(f,z);if(!w){b=!1;continue}b?a.lineTo(w[0],w[1]):(a.moveTo(w[0],w[1]),b=!0)}}for(let f=0;f<=i;f+=p){let b=!1;for(let z=0;z<=r;z+=8){const w=H(z,f);if(!w){b=!1;continue}b?a.lineTo(w[0],w[1]):(a.moveTo(w[0],w[1]),b=!0)}}a.globalAlpha=1,a.stroke()}a.globalAlpha=1;const O=Math.ceil(l.particleCount*2.2*s.quality);for(;o.orbiters.length<O;)o.orbiters.push(t(l,F));o.orbiters.length>O&&(o.orbiters.length=O);const T=l.gravity/200*.05;for(const p of o.orbiters)p.theta+=T*Math.pow(F/p.r,1.5)*m,p.r-=.02*(l.gravity/200)*m,p.r<F&&Object.assign(p,t(l,F,!0));const $=bt(["#ffffff",l.diskColor],.35),u=bt([l.diskColor],0),S=(p,f,b)=>{const z=[u[0]+($[0]-u[0])*p,u[1]+($[1]-u[1])*p,u[2]+($[2]-u[2])*p];return`rgba(${Math.min(255,z[0]*f)|0},${Math.min(255,z[1]*f)|0},${Math.min(255,z[2]*f)|0},${Math.min(1,b)})`},R=Math.max(20,l.diskWidth),v=p=>{const f=[new Path2D,new Path2D,new Path2D,new Path2D];for(const b of o.orbiters){const z=Math.sin(b.theta)<0;if(p==="back"&&!z||p==="front"&&z)continue;const w=1-(b.r-F)/R,D=Ka(b.theta),W=Math.min(3,Math.floor((w*.6+(D-.25)*.4)*4)),k=f[Math.max(0,W)],q=3;for(let P=0;P<=q;P++){const N=b.theta-b.len*(P/q);let U,Y;if(p==="halo"){const X=L*1.08+(b.r-F)*.32;U=x+Math.cos(N)*X,Y=E+Math.sin(N)*X}else U=x+Math.cos(N)*b.r,Y=E+Math.sin(N)*b.r*ze;P===0?k.moveTo(U,Y):k.lineTo(U,Y)}}a.lineCap="round";for(let b=0;b<4;b++){const z=(b+.5)/4;a.strokeStyle=S(z,.6+z*.9,p==="halo"?.22+z*.3:.35+z*.55),a.lineWidth=p==="halo"?1:1.1+z*.9,a.stroke(f[b])}},A=a.globalCompositeOperation;if(a.globalCompositeOperation="lighter",o.disk.color!==l.diskColor&&(o.disk={color:l.diskColor,img:Pt(l.diskColor,128)}),o.disk.img){const p=(F+R)*2.4;a.globalAlpha=.28,a.drawImage(o.disk.img,x-p/2,E-p*ze*.9,p,p*ze*1.8),a.globalAlpha=1}if(v("back"),v("halo"),a.globalCompositeOperation=A,a.fillStyle="#000000",a.beginPath(),a.arc(x,E,L,0,Math.PI*2),a.fill(),a.globalCompositeOperation="lighter",a.strokeStyle=S(1,1.4,.85),a.lineWidth=Math.max(1,L*.04),a.shadowColor=l.diskColor,a.shadowBlur=L*.3,a.beginPath(),a.arc(x,E,L*1.02,0,Math.PI*2),a.stroke(),a.shadowBlur=0,v("front"),l.showJets){if(o.jet.color!==l.jetColor&&(o.jet={color:l.jetColor,img:Pt(l.jetColor,32)}),Math.random()<.9*m*s.quality)for(const f of[-1,1])o.jets.push({d:L*.6,side:f,life:1,wob:Math.random()*6});let p=0;for(const f of o.jets){if(f.d+=(3+f.d*.012)*m,f.life-=.008*m,f.life<=0||f.d>Math.max(r,i)||(o.jets[p++]=f,!o.jet.img))continue;const b=x+Math.sin(f.d*.03+f.wob)*(2+f.d*.05),z=E+f.side*f.d,w=3+f.d*.05;a.globalAlpha=f.life*.5,a.drawImage(o.jet.img,b-w,z-w,w*2,w*2)}o.jets.length=p,a.globalAlpha=1}a.globalCompositeOperation=A}const C=xt({onResize:()=>{o.cx=0,o.cy=0,o.starKey=""},onFrame:c});return y.current=C.canvas,C}const Za={default:{diskColor:"#ff6600",backgroundColor:"#0d0200",jetColor:"#ff3300"},monochrome:{},cosmic:{diskColor:"#aaccff",backgroundColor:"#020510",jetColor:"#88aaff",diskWidth:140},inferno:{diskColor:"#ff6600",backgroundColor:"#0d0200",jetColor:"#ff3300",diskWidth:100},neon:{diskColor:"#00ffcc",backgroundColor:"#000510",jetColor:"#ff00aa",diskWidth:120},void:{diskColor:"#6b7280",backgroundColor:"#050505",jetColor:"#4b5563",particleCount:200,diskWidth:80}},dn=G.forwardRef((e,d)=>{const{preset:o,diskColor:g,backgroundColor:y,particleCount:t,gravity:c,eventHorizonRadius:C,diskWidth:a,jetColor:r,showJets:i,lensing:n,speed:s,interactive:l,starCount:m,starColor:I,glowingStars:M,starGlowBlur:h,width:x,height:E,className:L,style:F}=e,B=Za[o??"default"]||{},{canvasRef:j,canvas:H}=Qa({diskColor:g??B.diskColor??"#ffffff",backgroundColor:y??B.backgroundColor??"#111111",particleCount:t??B.particleCount??300,gravity:c??B.gravity??200,eventHorizonRadius:C??B.eventHorizonRadius??30,diskWidth:a??B.diskWidth??120,jetColor:r??B.jetColor??"#6b7280",showJets:i??!0,lensing:n??!0,speed:s??1,interactive:l??!0,starCount:m??100,starColor:I??"#ffffff",glowingStars:M??!1,starGlowBlur:h??8});return G.useImperativeHandle(d,()=>H,[H]),ct.jsx(vt,{canvasRef:j,width:x,height:E,className:L,style:F})});dn.displayName="BlackHole";function ts(e,d){const o=G.useRef(d);o.current=d;const g=G.useRef([]),y=G.useRef(0),t=G.useRef(0),c=G.useRef({starCount:-1,armCount:-1,armTightness:-1}),C=G.useRef({tiltX:d.tiltX,tiltY:0,targetTX:d.tiltX,targetTY:0}),a=G.useRef(null);G.useEffect(()=>{const r=e.current;if(!r)return;const i=r.parentElement;if(!i)return;const n=r.getContext("2d");let s=0,l=0,m=0;function I(O){return Math.sin(O*127.1)*.5+Math.sin(O*311.7)*.3+Math.sin(O*74.3)*.2}function M(){const{starCount:O,armCount:T,armTightness:$}=o.current;g.current=[];const u=Math.floor(O*.15),S=Math.floor(O*.2),R=O-u-S;for(let v=0;v<R;v++){const A=v%T,p=.05+Math.random()*.95,b=A/T*Math.PI*2+p*$*Math.PI*4,z=(I(p*A+v)*.15+(Math.random()-.5)*.1)*(1-p*.5);g.current.push({r:p,baseAngle:b+z,armIndex:A,isHalo:!1,size:Math.max(.3,(1-p*.7)*2.5+Math.random()*.8),brightness:.4+(1-p)*.6+Math.random()*.2,twinkle:Math.random()*Math.PI*2})}for(let v=0;v<S;v++){const A=Math.random()*Math.random()*.18;g.current.push({r:A,baseAngle:Math.random()*Math.PI*2,armIndex:0,isHalo:!1,size:.5+Math.random()*1.5,brightness:.7+Math.random()*.3,twinkle:Math.random()*Math.PI*2})}for(let v=0;v<u;v++)g.current.push({r:.6+Math.random()*.5,baseAngle:Math.random()*Math.PI*2,armIndex:-1,isHalo:!0,size:.3+Math.random()*.6,brightness:.1+Math.random()*.25,twinkle:Math.random()*Math.PI*2})}function h(O,T){const $=window.devicePixelRatio||1;r.width=Math.round(O*$),r.height=Math.round(T*$),r.style.width=`${O}px`,r.style.height=`${T}px`,n.scale($,$),s=O,l=T,M()}const x=new ResizeObserver(O=>{const{width:T,height:$}=O[0].contentRect;T>0&&$>0&&h(T,$)});x.observe(i);const E=i.getBoundingClientRect();E.width>0&&E.height>0&&h(E.width,E.height);function L(O){if(!o.current.interactive)return;const T=It(O,r);if(!T)return F();a.current=T}function F(){a.current=null}window.addEventListener("mousemove",L),document.addEventListener("mouseleave",F);function B(O){const{starCount:T,armCount:$,armTightness:u,coreColor:S,diskColor:R,backgroundColor:v,rotationSpeed:A,coreGlow:p,glowBlur:f}=o.current,b=c.current;(b.starCount!==T||b.armCount!==$||b.armTightness!==u)&&(M(),c.current={starCount:T,armCount:$,armTightness:u}),t.current+=O*.001,m+=A*O*.001*300;const z=C.current,w=a.current;w&&o.current.interactive?(z.targetTX=.1+w.y/l*.7,z.targetTY=(w.x/s-.5)*1.2):(z.targetTX=o.current.tiltX,z.targetTY=0),z.tiltX+=(z.targetTX-z.tiltX)*.04,z.tiltY+=(z.targetTY-z.tiltY)*.04,n.fillStyle=v,n.fillRect(0,0,s,l);const D=s/2,W=l/2,k=Math.min(s,l)*.45,q=Math.cos(z.tiltX),P=Math.sin(z.tiltY),N=Math.cos(z.tiltY),U=mt(S),Y=mt(R),X=g.current,_=[];for(const V of X){V.twinkle+=.02;const Q=V.baseAngle+m*(1-V.r*.3),ot=V.r*k,tt=Math.cos(Q)*ot,at=Math.sin(Q)*ot,K=V.isHalo?(Math.random()-.5)*ot*.3:0,J=tt*N-at*P,nt=tt*P+at*N,st=D+J,rt=W+K*1+nt*q,lt=nt;_.push({sx:st,sy:rt,sz:lt,star:V})}if(_.sort((V,Q)=>V.sz-Q.sz),p){const V=k*.12,Q=n.createRadialGradient(D,W,0,D,W,V*3);Q.addColorStop(0,`rgba(${U},0.35)`),Q.addColorStop(.3,`rgba(${U},0.12)`),Q.addColorStop(1,`rgba(${U},0)`),n.beginPath(),n.arc(D,W,V*3,0,Math.PI*2),n.fillStyle=Q,n.fill(),n.shadowBlur=f,n.shadowColor=`rgb(${U})`,n.beginPath(),n.arc(D,W,V*.4,0,Math.PI*2),n.fillStyle=`rgb(${U})`,n.fill(),n.shadowBlur=0}for(const{sx:V,sy:Q,sz:ot,star:tt}of _){const at=.8+.2*Math.sin(tt.twinkle),K=tt.brightness*at,J=ot<0?.5+.5*(1+ot/k):1,nt=K*J,st=tt.isHalo||tt.r>.4?Y:U,rt=tt.size*(.7+.3*J);n.beginPath(),n.arc(V,Q,Math.max(.2,rt),0,Math.PI*2),n.fillStyle=`rgba(${st},${Math.min(1,nt)})`,n.fill()}}let j=0;function H(O){const T=j?O-j:16;j=O,B(T),y.current=requestAnimationFrame(H)}return y.current=requestAnimationFrame(H),()=>{x.disconnect(),cancelAnimationFrame(y.current),window.removeEventListener("mousemove",L),document.removeEventListener("mouseleave",F)}},[e])}const es={default:{coreColor:"#ffd8a8",diskColor:"#a8c4ff",backgroundColor:"#020408"},monochrome:{},andromeda:{coreColor:"#ffd8a8",diskColor:"#a8c4ff",backgroundColor:"#020408",armTightness:.6},neon:{coreColor:"#ff00ff",diskColor:"#00ffff",backgroundColor:"#000008",rotationSpeed:6e-4},void:{coreColor:"#8866ff",diskColor:"#4433aa",backgroundColor:"#020005",armCount:3,armTightness:.4},golden:{coreColor:"#ffe066",diskColor:"#ffaa33",backgroundColor:"#060400",rotationSpeed:2e-4}},un=G.forwardRef((e,d)=>{const{preset:o,starCount:g,armCount:y,armTightness:t,coreColor:c,diskColor:C,backgroundColor:a,rotationSpeed:r,tiltX:i,interactive:n,coreGlow:s,glowBlur:l,width:m,height:I,className:M,style:h}=e,x=es[o??"default"]||{},E=G.useRef(null);return G.useImperativeHandle(d,()=>E.current),ts(E,{starCount:g??3e3,armCount:y??x.armCount??2,armTightness:t??x.armTightness??.5,coreColor:c??x.coreColor??"#ffffff",diskColor:C??x.diskColor??"#6b7280",backgroundColor:a??x.backgroundColor??"#111111",rotationSpeed:r??x.rotationSpeed??3e-4,tiltX:i??.3,interactive:n??!0,coreGlow:s??!0,glowBlur:l??30}),ct.jsx("div",{className:M,style:{width:m??"100%",height:I??"100%",display:"block",overflow:"hidden",...h},children:ct.jsx("canvas",{ref:E,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});un.displayName="GalaxySpiral";function Fe(e,d,o){return o+(d-o)*Math.pow(Math.max(0,Math.min(1,e)),1.9)}function Le(e,d){return d*.012*(.55+1.6*(1-e))}function os(e){const d=G.useRef(e);d.current=e;const o=G.useRef({streaks:[],dust:[],debris:[],puffs:[],baseX:0,topX:0,t:0,flash:0,bolt:null,nextBolt:2,sprite:{color:"",img:null},dustSprite:{color:"",img:null}}).current,g=Rt(),y=G.useRef(null);function t(a){o.baseX=o.topX=a/2,o.puffs=Array.from({length:70},(r,i)=>({theta:Math.random()*Math.PI*2,ring:Math.pow(i/70,.7),size:.6+Math.random()*.8,shade:.35+Math.random()*.4})),o.streaks=[]}function c(a,r,i,n,s){const l=d.current,m=n/16.67*l.speed;o.t+=n*.001*l.speed;const I=o.t,M=i*.94,h=M-i*Math.min(.92,Math.max(.3,l.funnelHeight)),x=M-h,E=Math.min(r*.2,x*.32),L=Math.max(5,E*.07);if(!s.overlay){a.fillStyle=l.backgroundColor,a.fillRect(0,0,r,i);const p=a.createLinearGradient(0,0,0,i);p.addColorStop(0,ut(l.funnelColor,.07)),p.addColorStop(.6,ut(l.funnelColor,0)),a.fillStyle=p,a.fillRect(0,0,r,i)}const F=kt(g.current,y.current),B=l.interactive&&F.inside?F.x:r/2+Math.sin(I*.23)*r*.18;o.baseX+=(B-o.baseX)*(1-Math.pow(.975,m)),o.topX+=(o.baseX-o.topX)*(1-Math.pow(.992,m));const j=p=>{const f=o.baseX+(o.topX-o.baseX)*p,b=Math.sin(I*.9+p*4.2)*E*.18*Math.sin(p*Math.PI);return f+b},H=p=>M-p*x,T="#"+bt([l.backgroundColor,l.funnelColor],.38).map(p=>Math.round(p).toString(16).padStart(2,"0")).join("");if(uo(o.sprite,T)&&(o.sprite={color:T,img:Pt(T,64)}),uo(o.dustSprite,l.debrisColor)&&(o.dustSprite={color:l.debrisColor,img:Pt(l.debrisColor,64)}),l.showLightning&&I>o.nextBolt){o.nextBolt=I+1.5+Math.random()*4,o.flash=1;const p=o.topX+(Math.random()-.5)*E*2.4,f=[[p,h-x*.12]];let b=p,z=h-x*.12;const w=7+(Math.random()*5|0);for(let D=0;D<w;D++)b+=(Math.random()-.5)*E*.5,z+=x*.035+Math.random()*x*.03,f.push([b,z]);o.bolt={pts:f,life:1}}o.flash*=Math.pow(.86,m);const $=Math.min(r*.75,E*4.2);if(o.sprite.img){for(const p of o.puffs){p.theta+=Le(1,l.rotationSpeed)*.35*m*(1.2-p.ring*.6);const f=$*.5*p.ring,b=x*.07*p.ring,z=o.topX+Math.cos(p.theta)*f,w=h-x*.04+Math.sin(p.theta)*b,D=E*(.55+p.size*.55)*(1-p.ring*.3);a.globalAlpha=Math.min(1,(.1+p.shade*.14)*(1+o.flash*2.5)),a.drawImage(o.sprite.img,z-D,w-D*.55,D*2,D*1.1)}a.globalAlpha=1}a.beginPath();const u=40;for(let p=0;p<=u;p++){const f=p/u,b=j(f)-Fe(f,E,L);p===0?a.moveTo(b,H(f)):a.lineTo(b,H(f))}for(let p=u;p>=0;p--){const f=p/u;a.lineTo(j(f)+Fe(f,E,L),H(f))}a.closePath();const S=a.createLinearGradient(0,h,0,M);S.addColorStop(0,ut(l.funnelColor,.32)),S.addColorStop(.6,ut(l.funnelColor,.16)),S.addColorStop(1,ut(l.funnelColor,.08)),a.fillStyle=S,a.fill();const R=Math.ceil(l.particleCount*s.quality);for(;o.streaks.length<R;)o.streaks.push({u:Math.pow(Math.random(),.8),theta:Math.random()*Math.PI*2,len:.25+Math.random()*.5,jitter:Math.random(),bright:.4+Math.random()*.6});o.streaks.length>R&&(o.streaks.length=R);const v=new Path2D,A=new Path2D;for(const p of o.streaks){p.theta+=Le(p.u,l.rotationSpeed)*m*(.8+p.jitter*.4),p.u+=9e-4*l.vortexStrength*m*(.5+p.jitter),p.u>1&&(p.u-=1);const f=Fe(p.u,E,L)*(.75+p.jitter*.3),b=j(p.u),z=H(p.u),w=.22,D=p.theta-p.len,W=p.theta,k=Math.sin(p.theta)>0?v:A,q=4;for(let P=0;P<=q;P++){const N=D+(W-D)*(P/q),U=b+Math.cos(N)*f,Y=z+Math.sin(N)*f*w;P===0?k.moveTo(U,Y):k.lineTo(U,Y)}}if(a.lineCap="round",a.strokeStyle=ut(l.funnelColor,.22+o.flash*.3),a.lineWidth=1,a.stroke(A),a.strokeStyle=ut(l.funnelColor,.6+o.flash*.4),a.lineWidth=1.3,a.stroke(v),l.showGroundDust){const p=3*s.quality*m;for(let b=0;b<Math.floor(p)+(Math.random()<p%1?1:0);b++)o.dust.push({x:o.baseX,y:M,theta:Math.random()*Math.PI*2,r:L*(1+Math.random()*2),vy:-(.3+Math.random()*.6),life:1,size:8+Math.random()*18});if(Math.random()<.12*l.vortexStrength*m){const b=Math.random()*Math.PI*2,z=(2+Math.random()*3)*l.vortexStrength;o.debris.push({x:o.baseX+Math.cos(b)*L*2,y:M-4,vx:Math.cos(b)*z,vy:-(2+Math.random()*4)*l.vortexStrength,rot:0,spin:(Math.random()-.5)*.4,size:1.5+Math.random()*3,life:1})}let f=0;for(const b of o.dust)if(b.theta+=Le(0,l.rotationSpeed)*.8*m,b.r+=.35*m,b.y+=b.vy*m,b.life-=.006*m,!(b.life<=0)&&(o.dust[f++]=b,o.dustSprite.img)){const z=o.baseX+Math.cos(b.theta)*b.r,w=b.y+Math.sin(b.theta)*b.r*.2;a.globalAlpha=b.life*.35,a.drawImage(o.dustSprite.img,z-b.size,w-b.size*.6,b.size*2,b.size*1.2)}o.dust.length=f,a.globalAlpha=1,a.fillStyle=l.debrisColor,f=0;for(const b of o.debris)b.vy+=.12*m,b.vx*=Math.pow(.99,m),b.x+=b.vx*m,b.y+=b.vy*m,b.rot+=b.spin*m,b.y>M&&(b.y=M,b.vy*=-.3,b.vx*=.6,b.life-=.25),b.life-=.004*m,!(b.life<=0)&&(o.debris[f++]=b,a.save(),a.translate(b.x,b.y),a.rotate(b.rot),a.globalAlpha=Math.min(1,b.life*1.5),a.fillRect(-b.size,-b.size*.4,b.size*2,b.size*.8),a.restore());o.debris.length=f,a.globalAlpha=1}o.bolt&&o.bolt.life>0&&(a.strokeStyle=ut(l.lightningColor,o.bolt.life),a.lineWidth=1.6,a.shadowColor=l.lightningColor,a.shadowBlur=12*o.bolt.life,a.beginPath(),o.bolt.pts.forEach(([p,f],b)=>b?a.lineTo(p,f):a.moveTo(p,f)),a.stroke(),a.shadowBlur=0,o.bolt.life-=.08*m),o.flash>.02&&(a.fillStyle=ut(l.lightningColor,o.flash*.12),a.fillRect(0,0,r,i))}const C=xt({onResize:a=>t(a),onFrame:c});return y.current=C.canvas,C}function uo(e,d){return e.color!==d}const ns={default:{funnelColor:"#c8d8e8",debrisColor:"#8898a8",lightningColor:"#ffffff",backgroundColor:"#0a1018"},monochrome:{},storm:{funnelColor:"#c8d8e8",debrisColor:"#8898a8",lightningColor:"#ffffff",backgroundColor:"#0a1018",funnelHeight:.85},fire:{funnelColor:"#ff6600",debrisColor:"#cc3300",lightningColor:"#ffaa00",backgroundColor:"#0d0200",rotationSpeed:4},neon:{funnelColor:"#00ffcc",debrisColor:"#ff00aa",lightningColor:"#ffffff",backgroundColor:"#000810",rotationSpeed:5},void:{funnelColor:"#8866ff",debrisColor:"#4433aa",lightningColor:"#cc88ff",backgroundColor:"#020008",rotationSpeed:2}},hn=G.forwardRef((e,d)=>{const{preset:o,particleCount:g,funnelColor:y,debrisColor:t,lightningColor:c,backgroundColor:C,rotationSpeed:a,funnelHeight:r,vortexStrength:i,showLightning:n,showGroundDust:s,interactive:l,speed:m,width:I,height:M,className:h,style:x}=e,E=ns[o??"default"]||{},{canvasRef:L,canvas:F}=os({particleCount:g??600,funnelColor:y??E.funnelColor??"#ffffff",debrisColor:t??E.debrisColor??"#6b7280",lightningColor:c??E.lightningColor??"#ffffff",backgroundColor:C??E.backgroundColor??"#111111",rotationSpeed:a??E.rotationSpeed??3,funnelHeight:r??E.funnelHeight??.8,vortexStrength:i??1,showLightning:n??!0,showGroundDust:s??!0,interactive:l??!0,speed:m??1});return G.useImperativeHandle(d,()=>F,[F]),ct.jsx(vt,{canvasRef:L,width:I,height:M,className:h,style:x})});hn.displayName="TornadoVortex";function rs(e,d){const o=G.useRef(d);o.current=d;const g=G.useRef([]),y=G.useRef(0),t=G.useRef(0),c=G.useRef(null);G.useEffect(()=>{const C=e.current;if(!C)return;const a=C.parentElement;if(!a)return;const r=C.getContext("2d");let i=0,n=0;const s=Array.from({length:14},()=>({x:Math.random(),y:Math.random(),r:20+Math.random()*60,a:.03+Math.random()*.05,hue:Math.random()*360}));function l(T,$){const{minRadius:u,maxRadius:S}=o.current,R=u+Math.random()*(S-u);return{x:R+Math.random()*(i-R*2),y:R+Math.random()*(n-R*2),vx:(Math.random()-.5)*1.5,vy:-(.2+Math.random()*.6),r:R,hue:Math.random()*360,shimmerOffset:Math.random()*Math.PI*2,popping:!1,popProgress:0,popParticles:[]}}function m(){const{bubbleCount:T}=o.current;g.current=Array.from({length:T},()=>l())}function I(T,$){const u=Math.min(2,window.devicePixelRatio||1);C.width=Math.round(T*u),C.height=Math.round($*u),C.style.width=`${T}px`,C.style.height=`${$}px`,r.setTransform(Math.min(2,u),0,0,Math.min(2,u),0,0),i=T,n=$,m()}const M=new ResizeObserver(T=>{const{width:$,height:u}=T[0].contentRect;$>0&&u>0&&I($,u)});M.observe(a);const h=a.getBoundingClientRect();h.width>0&&h.height>0&&I(h.width,h.height);function x(T){if(!o.current.interactive)return;const $=It(T,C);if(!$)return E();c.current=$}function E(){c.current=null}function L(T){if(!o.current.popEffect)return;const $=C.getBoundingClientRect(),u=T.clientX-$.left,S=T.clientY-$.top;for(const R of g.current){if(R.popping)continue;const v=u-R.x,A=S-R.y;if(v*v+A*A<R.r*R.r){F(R);break}}}window.addEventListener("mousemove",x),document.addEventListener("mouseleave",E),C.addEventListener("click",L);function F(T){T.popping=!0,T.popProgress=0;const $=8+Math.floor(T.r/8);for(let u=0;u<$;u++){const S=u/$*Math.PI*2,R=1+Math.random()*3;T.popParticles.push({x:T.x+Math.cos(S)*T.r,y:T.y+Math.sin(S)*T.r,vx:Math.cos(S)*R,vy:Math.sin(S)*R,alpha:.8})}}function B(T,$,u,S){const{x:R,y:v,r:A}=T,p=mt(u),f=T.hue;if(S){r.globalCompositeOperation="lighter";const W=r.createRadialGradient(R,v,A*.8,R,v,A*1.45);W.addColorStop(0,`hsla(${f},90%,70%,0.1)`),W.addColorStop(1,`hsla(${f},90%,70%,0)`),r.fillStyle=W,r.beginPath(),r.arc(R,v,A*1.45,0,Math.PI*2),r.fill(),r.globalCompositeOperation="source-over"}const b=r.createRadialGradient(R-A*.3,v-A*.35,A*.1,R,v,A);b.addColorStop(0,"rgba(255,255,255,0.025)"),b.addColorStop(.72,`rgba(${p},0.035)`),b.addColorStop(1,`rgba(${p},0.14)`),r.fillStyle=b,r.beginPath(),r.arc(R,v,A,0,Math.PI*2),r.fill();const z=$*.6+T.shimmerOffset;let w=`hsla(${f},85%,68%,0.5)`;if(typeof r.createConicGradient=="function"){const W=r.createConicGradient(z,R,v);if(W){const k=[[0,0,.6],[.18,60,.15],[.38,150,.55],[.58,220,.12],[.8,300,.5],[1,360,.6]];for(const[q,P,N]of k)W.addColorStop(q,`hsla(${f+P},90%,66%,${N})`);w=W}}const D=Math.max(1.5,A*.09);r.strokeStyle=w,r.lineWidth=D,r.beginPath(),r.arc(R,v,A-D/2,0,Math.PI*2),r.stroke(),r.globalAlpha=.28,r.lineWidth=A*.2,r.beginPath(),r.arc(R,v,A*.84,0,Math.PI*2),r.stroke(),r.globalAlpha=1,r.strokeStyle="rgba(255,255,255,0.32)",r.lineWidth=1,r.beginPath(),r.arc(R,v,A,0,Math.PI*2),r.stroke(),r.lineCap="round",r.strokeStyle=`rgba(${p},0.75)`,r.lineWidth=Math.max(1.2,A*.07),r.beginPath(),r.arc(R,v,A*.72,Math.PI*1.06,Math.PI*1.38),r.stroke(),r.fillStyle=`rgba(${p},0.9)`,r.beginPath(),r.arc(R-A*.3,v-A*.6,Math.max(1,A*.055),0,Math.PI*2),r.fill(),r.strokeStyle=`rgba(${p},0.22)`,r.lineWidth=Math.max(1,A*.05),r.beginPath(),r.arc(R,v,A*.78,Math.PI*.12,Math.PI*.36),r.stroke()}function j(T){const{bubbleCount:$,backgroundColor:u,shimmerColor:S,gravity:R,friction:v,interactive:A,mergeOnCollide:p,glowEffect:f,popEffect:b}=o.current;t.current+=T*.001;const z=t.current,w=mt(u),D=r.createLinearGradient(0,0,i,n);D.addColorStop(0,`rgb(${w.split(",").map(q=>Math.min(255,+q+14)).join(",")})`),D.addColorStop(1,`rgb(${w})`),r.fillStyle=D,r.fillRect(0,0,i,n),r.globalCompositeOperation="lighter";for(const q of s){const P=q.x*i+Math.sin(z*.1+q.hue)*12,N=q.y*n,U=r.createRadialGradient(P,N,0,P,N,q.r);U.addColorStop(0,`hsla(${q.hue},70%,65%,${q.a})`),U.addColorStop(.7,`hsla(${q.hue},70%,65%,${q.a*.6})`),U.addColorStop(1,`hsla(${q.hue},70%,65%,0)`),r.fillStyle=U,r.beginPath(),r.arc(P,N,q.r,0,Math.PI*2),r.fill()}r.globalCompositeOperation="source-over";const W=g.current,k=c.current;for(;W.filter(q=>!q.popping).length<$;){const q=l();q.y=n+q.r+Math.random()*30,W.push(q)}for(let q=0;q<W.length;q++){const P=W[q];if(P.popping){P.popProgress+=.08;for(const N of P.popParticles)N.x+=N.vx,N.y+=N.vy,N.alpha-=.05;P.popParticles=P.popParticles.filter(N=>N.alpha>0);continue}if(P.vy+=R-.03,P.vx+=Math.sin(z*.5+P.shimmerOffset)*.012,P.vx*=v,P.vy*=v,P.vy=Math.max(-1.1,Math.min(1.1,P.vy)),P.x+=P.vx,P.y+=P.vy,P.hue=(P.hue+.3)%360,A&&k){const N=P.x-k.x,U=P.y-k.y,Y=Math.sqrt(N*N+U*U)||.001;if(Y<P.r+60){const X=(P.r+60-Y)*.015;P.vx+=N/Y*X,P.vy+=U/Y*X}}P.x+P.r<-4?P.x=i+P.r:P.x-P.r>i+4&&(P.x=-P.r),P.y+P.r<-4?(P.y=n+P.r+2,P.x=Math.random()*i):P.y-P.r>n+4&&(P.y=-P.r-2,P.x=Math.random()*i);for(let N=q+1;N<W.length;N++){const U=W[N];if(U.popping)continue;const Y=U.x-P.x,X=U.y-P.y,_=Math.sqrt(Y*Y+X*X)||.001,V=P.r+U.r;if(_<V)if(p&&_<V*.6){const Q=Math.min(o.current.maxRadius,Math.sqrt(P.r*P.r+U.r*U.r));P.r=Q,P.x=(P.x+U.x)/2,P.y=(P.y+U.y)/2,P.vx=(P.vx+U.vx)*.5,P.vy=(P.vy+U.vy)*.5,U.popping=!0,U.popProgress=1}else{const Q=Y/_,ot=X/_,tt=V-_;P.x-=Q*tt*.5,P.y-=ot*tt*.5,U.x+=Q*tt*.5,U.y+=ot*tt*.5;const at=P.vx-U.vx,K=P.vy-U.vy,J=at*Q+K*ot;J>0&&(P.vx-=J*Q*.7,P.vy-=J*ot*.7,U.vx+=J*Q*.7,U.vy+=J*ot*.7)}}}for(const q of W)if(!(q.popping&&q.popProgress>=1))if(!q.popping)B(q,z,S,f);else{const P=q.r*(1+q.popProgress*1.5);r.beginPath(),r.arc(q.x,q.y,P,0,Math.PI*2),r.strokeStyle=`hsla(${q.hue},80%,70%,${.6*(1-q.popProgress)})`,r.lineWidth=2,r.stroke();for(const N of q.popParticles)r.beginPath(),r.arc(N.x,N.y,2,0,Math.PI*2),r.fillStyle=`hsla(${q.hue},80%,75%,${N.alpha})`,r.fill()}g.current=W.filter(q=>!q.popping||q.popProgress<1.5)}let H=0;function O(T){const $=H?T-H:16;H=T,j($),y.current=requestAnimationFrame(O)}return y.current=requestAnimationFrame(O),()=>{M.disconnect(),cancelAnimationFrame(y.current),window.removeEventListener("mousemove",x),document.removeEventListener("mouseleave",E),C.removeEventListener("click",L)}},[e])}const as={default:{backgroundColor:"#050a12",shimmerColor:"#ffffff"},monochrome:{},soap:{backgroundColor:"#050a12",shimmerColor:"#ffffff",gravity:.01,minRadius:25,maxRadius:90},neon:{backgroundColor:"#000008",shimmerColor:"#00ffff",gravity:.015,bubbleCount:12},deep:{backgroundColor:"#010510",shimmerColor:"#88aaff",gravity:.008,minRadius:15,maxRadius:60,bubbleCount:20},minimal:{backgroundColor:"#111111",shimmerColor:"#ffffff",gravity:.025,bubbleCount:8,minRadius:30,maxRadius:100}},gn=G.forwardRef((e,d)=>{const{preset:o,bubbleCount:g,minRadius:y,maxRadius:t,backgroundColor:c,shimmerColor:C,popEffect:a,gravity:r,friction:i,interactive:n,mergeOnCollide:s,glowEffect:l,width:m,height:I,className:M,style:h}=e,x=as[o??"default"]||{},E=G.useRef(null);return G.useImperativeHandle(d,()=>E.current),rs(E,{bubbleCount:g??x.bubbleCount??15,minRadius:y??x.minRadius??20,maxRadius:t??x.maxRadius??50,backgroundColor:c??x.backgroundColor??"#111111",shimmerColor:C??x.shimmerColor??"#ffffff",popEffect:a??!0,gravity:r??x.gravity??.02,friction:i??.995,interactive:n??!0,mergeOnCollide:s??!0,glowEffect:l??!0}),ct.jsx("div",{className:M,style:{width:m??"100%",height:I??"100%",display:"block",overflow:"hidden",cursor:"pointer",...h},children:ct.jsx("canvas",{ref:E,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});gn.displayName="BubbleUniverse";function ss(e){return .4+.6*Math.sqrt(Math.max(0,1-e*e))}function Be(e,d,o,g,y,t){const c=g.angle+(y-.5)*g.span,C=o*(1+Math.sin(y*Math.PI)*g.height*t);return[e+Math.cos(c)*C,d+Math.sin(c)*C]}function ls(e){const d=G.useRef(e);d.current=e;const o=G.useRef({t:0,loops:[],flares:[],plasma:[],nextAuto:1.5,tex:null,spots:[],stars:[],corona:{color:"",img:null},flareSprite:{color:"",img:null}}).current,g=Rt(),y=G.useRef(null);function t(r,i){o.loops=Array.from({length:4},()=>({angle:Math.random()*Math.PI*2,span:.18+Math.random()*.22,height:.18+Math.random()*.22,phase:Math.random()*10,flow:Array.from({length:26},()=>Math.random())})),o.spots=Array.from({length:3},()=>({lat:(Math.random()-.5)*.8,lon:Math.random()*Math.PI*2,r:.05+Math.random()*.05})),o.stars=Array.from({length:Math.round(r*i/4e3)},()=>({x:Math.random()*r,y:Math.random()*i,a:.1+Math.random()*.4}))}function c(r){var s,l;if(o.tex&&o.tex.n===r)return o.tex;if(typeof document>"u")return null;const i=document.createElement("canvas");i.width=i.height=r;const n=(l=(s=i.getContext("2d"))==null?void 0:s.createImageData)==null?void 0:l.call(s,r,r);return n?(o.tex={c:i,img:n,n:r},o.tex):null}function C(r,i,n,s,l){var u;const m=d.current,I=s/16.67*m.speed;o.t+=s*.001*m.speed;const M=o.t,h=i/2,x=n/2,E=Math.max(10,Math.min(i,n)/2*m.sunRadius);if(!l.overlay){r.fillStyle=m.backgroundColor,r.fillRect(0,0,i,n),r.fillStyle="#ffffff";for(const S of o.stars)r.globalAlpha=S.a,r.fillRect(S.x,S.y,1,1);r.globalAlpha=1}o.corona.color!==m.coronaColor&&(o.corona={color:m.coronaColor,img:Pt(m.coronaColor,128)}),o.flareSprite.color!==m.flareColor&&(o.flareSprite={color:m.flareColor,img:Pt(m.flareColor,32)});const L=r.globalCompositeOperation;if(r.globalCompositeOperation="lighter",m.glowEffect&&o.corona.img){const S=E*2.2+m.glowBlur*2;r.globalAlpha=.55,r.drawImage(o.corona.img,h-S,x-S,S*2,S*2)}for(let S=0;S<28;S++){const R=S/28*Math.PI*2+M*.02+Math.sin(S*7.3)*.1,v=E*(.5+.9*Ft(S*.7,M*.15,3,2)),A=.06+.05*Math.sin(S*3.1),p=r.createLinearGradient(h+Math.cos(R)*E*.95,x+Math.sin(R)*E*.95,h+Math.cos(R)*(E+v),x+Math.sin(R)*(E+v));p.addColorStop(0,ut(m.coronaColor,.22)),p.addColorStop(1,ut(m.coronaColor,0)),r.globalAlpha=1,r.fillStyle=p,r.beginPath(),r.moveTo(h+Math.cos(R-A)*E*.95,x+Math.sin(R-A)*E*.95),r.lineTo(h+Math.cos(R)*(E+v),x+Math.sin(R)*(E+v)),r.lineTo(h+Math.cos(R+A)*E*.95,x+Math.sin(R+A)*E*.95),r.closePath(),r.fill()}r.globalCompositeOperation=L,r.globalAlpha=1;const F=Math.round(Math.min(140,Math.max(64,E*.9))*(l.quality<.75?.6:1)),B=c(F);if(B){const S=bt([m.sunColor],0),R=bt([m.sunColor,m.coronaColor],.55),v=2+m.convectionCells*.22,A=B.img.data,p=M*.03;for(let f=0;f<F;f++){const b=(f+.5)/F*2-1;for(let z=0;z<F;z++){const w=(z+.5)/F*2-1,D=w*w+b*b,W=(f*F+z)*4;if(D>1){A[W+3]=0;continue}const k=Math.sqrt(D),q=Math.sqrt(1-D),P=Math.atan2(w,q)+p,N=Math.asin(b),U=Ft(P*v,N*v+M*.05,3,9),Y=Ft(P*v*3.1-M*.2,N*v*3.1,2,4);let X=ss(k)*(.72+.4*U+.18*(Y-.5));for(const V of o.spots){const Q=Math.atan2(Math.sin(P-V.lon),Math.cos(P-V.lon)),ot=Math.hypot(Q*Math.cos(N),N-V.lat)/V.r;ot<1.6&&(X*=ot<1?.25+.2*ot:.55+.45*((ot-1)/.6))}const _=1-q;A[W]=Math.min(255,(S[0]+(R[0]-S[0])*_)*X*1.1),A[W+1]=Math.min(255,(S[1]+(R[1]-S[1])*_)*X*1.1),A[W+2]=Math.min(255,(S[2]+(R[2]-S[2])*_)*X*1.1),A[W+3]=255}}(u=B.c.getContext("2d"))==null||u.putImageData(B.img,0,0),r.imageSmoothingEnabled=!0,r.drawImage(B.c,h-E,x-E,E*2,E*2)}const j=kt(g.current,y.current),H=S=>{if(o.flares.length>=Math.max(1,m.flareCount))return;o.flares.push({angle:S,age:0,life:2.8+Math.random()*1.5});const R=h+Math.cos(S)*E,v=x+Math.sin(S)*E;for(let A=0;A<70;A++){const p=S+(Math.random()-.5)*.9,f=1.5+Math.random()*4.5;o.plasma.push({x:R,y:v,vx:Math.cos(p)*f,vy:Math.sin(p)*f,life:1,size:.8+Math.random()*2})}};if(m.interactive)for(const S of j.taps)H(Math.atan2(S.y-x,S.x-h));m.autoFlare&&M>o.nextAuto&&(o.nextAuto=M+Math.max(.3,m.autoFlareInterval/1e3)*(.7+Math.random()*.6),H(Math.random()*Math.PI*2)),r.globalCompositeOperation="lighter";const O=o.flareSprite.img;for(const S of o.loops){S.angle+=4e-4*I;const R=.75+.25*Math.sin(M*.4+S.phase);r.strokeStyle=ut(m.flareColor,.18),r.lineWidth=E*.03,r.beginPath();for(let v=0;v<=24;v++){const[A,p]=Be(h,x,E,S,v/24,R);v?r.lineTo(A,p):r.moveTo(A,p)}if(r.stroke(),O)for(let v=0;v<S.flow.length;v++){S.flow[v]=(S.flow[v]+.004*I*(v%2?1:-1)+1)%1;const[A,p]=Be(h,x,E,S,S.flow[v],R),f=E*.07;r.globalAlpha=.5,r.drawImage(O,A-f,p-f,f*2,f*2)}}let T=0;for(const S of o.flares){if(S.age+=s*.001*m.speed,S.age>S.life)continue;o.flares[T++]=S;const R=S.age/S.life,v={angle:S.angle,span:.32,height:.25+R*1.4};r.globalAlpha=Math.max(0,1-R)*.9,r.strokeStyle=m.flareColor,r.lineWidth=E*.035*(1-R*.6),r.beginPath();for(let A=0;A<=30;A++){const[p,f]=Be(h,x,E,v,A/30,1);A?r.lineTo(p,f):r.moveTo(p,f)}if(r.stroke(),O&&R<.35){const A=E*(.5-R);r.globalAlpha=1-R/.35,r.drawImage(O,h+Math.cos(S.angle)*E-A,x+Math.sin(S.angle)*E-A,A*2,A*2)}}o.flares.length=T;let $=0;for(const S of o.plasma){const R=S.x-h,v=S.y-x,A=R*R+v*v,p=E*E*.12/Math.max(A,E*E);if(S.vx-=R/Math.sqrt(A)*p*I,S.vy-=v/Math.sqrt(A)*p*I,S.x+=S.vx*I,S.y+=S.vy*I,S.life-=.006*I,!(S.life<=0||A<E*E*.9)&&(o.plasma[$++]=S,O)){const f=S.size*3;r.globalAlpha=S.life,r.drawImage(O,S.x-f,S.y-f,f*2,f*2)}}o.plasma.length=$,r.globalAlpha=1,r.globalCompositeOperation=L}const a=xt({onResize:t,onFrame:C});return y.current=a.canvas,a}const is={default:{sunColor:"#ff6600",coronaColor:"#ff3300",flareColor:"#ffaa00",backgroundColor:"#0a0200"},monochrome:{},inferno:{sunColor:"#ff6600",coronaColor:"#ff3300",flareColor:"#ffaa00",backgroundColor:"#0a0200",glowBlur:60},plasma:{sunColor:"#cc44ff",coronaColor:"#8800cc",flareColor:"#ff88ff",backgroundColor:"#050008",glowBlur:50},neon:{sunColor:"#00ffcc",coronaColor:"#00aaff",flareColor:"#ffffff",backgroundColor:"#000810",glowBlur:45},"white-dwarf":{sunColor:"#eef4ff",coronaColor:"#aac4ff",flareColor:"#ffffff",backgroundColor:"#000008",sunRadius:.15,glowBlur:80}},mn=G.forwardRef((e,d)=>{const{preset:o,sunColor:g,coronaColor:y,flareColor:t,backgroundColor:c,sunRadius:C,convectionCells:a,flareCount:r,autoFlare:i,autoFlareInterval:n,interactive:s,glowEffect:l,glowBlur:m,speed:I,width:M,height:h,className:x,style:E}=e,L=is[o??"default"]||{},{canvasRef:F,canvas:B}=ls({sunColor:g??L.sunColor??"#ffffff",coronaColor:y??L.coronaColor??"#6b7280",flareColor:t??L.flareColor??"#ffffff",backgroundColor:c??L.backgroundColor??"#111111",sunRadius:C??L.sunRadius??.35,convectionCells:a??20,flareCount:r??3,autoFlare:i??!0,autoFlareInterval:n??3e3,interactive:s??!0,glowEffect:l??!0,glowBlur:m??L.glowBlur??40,speed:I??1});return G.useImperativeHandle(d,()=>B,[B]),ct.jsx(vt,{canvasRef:F,width:M,height:h,className:x,style:{cursor:"crosshair",...E}})});mn.displayName="SolarFlare";const zt=(e,d,o)=>{const g=e.split(",").map(Number),y=d.split(",").map(Number);return g.map((t,c)=>Math.round(t+(y[c]-t)*o)).join(",")};function cs(e,d,o,g){const y=g.x-o.x,t=g.y-o.y,c=d.x*t-d.y*y;if(Math.abs(c)<1e-9)return 1/0;const C=((o.x-e.x)*t-(o.y-e.y)*y)/c,a=((o.x-e.x)*d.y-(o.y-e.y)*d.x)/c;return C>0&&a>=0&&a<=1?C:1/0}function fs(e,d){const o=G.useRef(d);o.current=d,G.useEffect(()=>{const g=e.current;if(!g)return;const y=g.parentElement,t=g.getContext("2d");let c=0,C=0,a=1,r={x:0,y:0},i=[],n=[],s=[],l=[],m=[],I=[],M=0,h=0,x="";const E={x:-9999,y:-9999,px:-9999,py:-9999},L={x:0,y:0,tx:0,ty:0,heading:Math.PI/2,walk:0,lastActive:-99};function F(){const b=o.current;M=Math.max(5,Math.round(b.spokeCount)),h=Math.max(3,Math.round(b.ringCount)),x=`${M}|${h}|${c}|${C}`;let z=11;const w=()=>((z=z*16807%2147483647)-1)/2147483646;a=Math.min(c,C)/420,r={x:c*.5,y:C*.48};const D=Math.min(c*.44,C*.8),W=C*.44,k=7;i=Array.from({length:k},(N,U)=>{const Y=U/k*Math.PI*2+(w()-.5)*.35,X=.95+w()*.12;return{x:r.x+Math.cos(Y)*D*X,y:r.y+Math.sin(Y)*W*X}}),n=i.map(N=>{const U={x:N.x-r.x,y:N.y-r.y};let Y=1/0;return U.x>0&&(Y=Math.min(Y,(c-N.x)/U.x)),U.x<0&&(Y=Math.min(Y,-N.x/U.x)),U.y>0&&(Y=Math.min(Y,(C-N.y)/U.y)),U.y<0&&(Y=Math.min(Y,-N.y/U.y)),[N,{x:N.x+U.x*Y,y:N.y+U.y*Y}]}),s=[];const q=[],P=[];for(let N=0;N<M;N++){const U=N/M*Math.PI*2+(w()-.5)*.12,Y={x:Math.cos(U),y:Math.sin(U)};let X=1/0;for(let _=0;_<k;_++)X=Math.min(X,cs(r,Y,i[_],i[(_+1)%k]));isFinite(X)||(X=Math.min(D,W)),P.push(Y),q.push(X),s.push({x:r.x+Y.x*X,y:r.y+Y.y*X})}l=[];for(let N=0;N<h;N++)for(let U=0;U<M;U++){const Y=(N+U/M)/h,X=q[U]*(.17+.77*Y);l.push({bx:r.x+P[U].x*X,by:r.y+P[U].y*X,ox:0,oy:0,vx:0,vy:0,f:.17+.77*Y})}m=[];for(let N=0;N<l.length-1;N++)if(w()<.45){const U=1+Math.floor(w()*3);for(let Y=0;Y<U;Y++)m.push({seg:N,u:.15+w()*.7,r:(.9+w()*1.6)*Math.max(.7,a)})}I=Array.from({length:12},()=>({x:w()*c,y:w()*C,r:(18+w()*50)*Math.max(.6,a),a:.03+w()*.05})),L.x=L.tx=r.x,L.y=L.ty=r.y}function B(b,z){const w=Math.min(2,window.devicePixelRatio||1);g.width=Math.round(b*w),g.height=Math.round(z*w),g.style.width=`${b}px`,g.style.height=`${z}px`,t.setTransform(w,0,0,w,0,0),c=b,C=z,F()}const j=new ResizeObserver(b=>{const{width:z,height:w}=b[0].contentRect;z>0&&w>0&&B(z,w)});j.observe(y);const H=y.getBoundingClientRect();H.width>0&&H.height>0&&B(H.width,H.height);function O(b){const z=It(b,g);if(!z)return T();E.px=E.x<-9e3?z.x:E.x,E.py=E.y<-9e3?z.y:E.y,E.x=z.x,E.y=z.y}function T(){E.x=E.y=E.px=E.py=-9999}window.addEventListener("mousemove",O),document.addEventListener("mouseleave",T);const $=b=>({x:b.bx+b.ox,y:b.by+b.oy}),u=(b,z,w)=>{const D=(b.x+z.x)/2,W=(b.y+z.y)/2;return{x:D+(w.x-D)*.07,y:W+(w.y-W)*.07}},S=(b,z,w,D)=>({x:(1-D)*(1-D)*b.x+2*(1-D)*D*z.x+D*D*w.x,y:(1-D)*(1-D)*b.y+2*(1-D)*D*z.y+D*D*w.y});function R(b,z,w,D,W){const k=2*Math.max(.65,a),q=Math.cos(b.heading),P=Math.sin(b.heading),N=-P,U=q,Y=(tt,at)=>({x:b.x+q*tt*k+N*at*k,y:b.y+P*tt*k+U*at*k});t.lineCap="round",t.lineJoin="round";const X=[[.5,16,-.55],[1.05,13,-.35],[2.05,11,.4],[2.6,14,.5]],_=Y(1.8,0);for(const tt of[-1,1])X.forEach(([at,K,J],nt)=>{const st=W?Math.sin(b.walk+nt*1.6+(tt>0?Math.PI:0))*.18:0,rt=b.heading+tt*(at+st),lt={x:_.x+Math.cos(rt)*K*.55*k,y:_.y+Math.sin(rt)*K*.55*k},Z=rt+tt*J,et={x:lt.x+Math.cos(Z)*K*.7*k,y:lt.y+Math.sin(Z)*K*.7*k};t.beginPath(),t.moveTo(_.x,_.y),t.lineTo(lt.x,lt.y),t.lineTo(et.x,et.y),t.strokeStyle=`rgba(${zt(z,w,.2)},1)`,t.lineWidth=1.1*k,t.stroke(),t.strokeStyle=`rgba(${zt(z,w,.6)},0.55)`,t.lineWidth=.4*k,t.stroke()});const V=Y(-8.5,0);t.save(),t.translate(V.x,V.y),t.rotate(b.heading);const Q=t.createRadialGradient(-2*k,-3*k,.5*k,0,0,9*k);Q.addColorStop(0,`rgba(${zt(z,w,.55)},1)`),Q.addColorStop(1,`rgba(${z},1)`),t.fillStyle=Q,t.beginPath(),t.ellipse(0,0,8.5*k,6.5*k,0,0,Math.PI*2),t.fill(),t.strokeStyle=`rgba(${w},0.7)`,t.lineWidth=.6*k,t.stroke(),t.strokeStyle=`rgba(${w},0.65)`,t.lineWidth=.9*k;for(let tt=0;tt<3;tt++){const at=-4.5*k+tt*3*k;t.beginPath(),t.moveTo(at-1.6*k,-2.6*k),t.lineTo(at+.8*k,0),t.lineTo(at-1.6*k,2.6*k),t.stroke()}t.fillStyle="rgba(255,255,255,0.22)",t.beginPath(),t.ellipse(-1.5*k,-2.8*k,3.5*k,1.4*k,-.2,0,Math.PI*2),t.fill(),t.restore();const ot=Y(1.8,0);t.save(),t.translate(ot.x,ot.y),t.rotate(b.heading),t.fillStyle=`rgba(${zt(z,"0,0,0",.15)},1)`,t.beginPath(),t.ellipse(0,0,4.2*k,3.4*k,0,0,Math.PI*2),t.fill(),t.strokeStyle=`rgba(${w},0.6)`,t.lineWidth=.5*k,t.stroke(),t.fillStyle=`rgba(${w},0.95)`;for(const tt of[-1,1])t.beginPath(),t.ellipse(3*k,tt*1.1*k,.7*k,.7*k,0,0,Math.PI*2),t.fill();t.restore()}let v=0,A=0,p=0;function f(b){v=requestAnimationFrame(f);const z=A?Math.min(.05,(b-A)/1e3):1/60;if(A=b,p+=z,c===0)return;const w=o.current;`${Math.max(5,Math.round(w.spokeCount))}|${Math.max(3,Math.round(w.ringCount))}|${c}|${C}`!==x&&F();const D=mt(w.webColor),W=mt(w.glowColor),k=mt(w.backgroundColor),q=mt(w.spiderColor),P=t.createRadialGradient(c*.5,C*.45,0,c*.5,C*.5,Math.hypot(c,C)*.6);P.addColorStop(0,`rgb(${zt(k,W,.12)})`),P.addColorStop(1,`rgb(${k})`),t.fillStyle=P,t.fillRect(0,0,c,C);const N={x:c*.86,y:C*.17};t.globalCompositeOperation="lighter";const U=t.createRadialGradient(N.x,N.y,0,N.x,N.y,C*.55);U.addColorStop(0,`rgba(${W},0.22)`),U.addColorStop(1,`rgba(${W},0)`),t.fillStyle=U,t.fillRect(0,0,c,C);for(const J of I){const nt=t.createRadialGradient(J.x,J.y,0,J.x,J.y,J.r);nt.addColorStop(0,`rgba(${W},${J.a})`),nt.addColorStop(.75,`rgba(${W},${J.a*.6})`),nt.addColorStop(1,`rgba(${W},0)`),t.fillStyle=nt,t.beginPath(),t.arc(J.x+Math.sin(p*.1+J.r)*6,J.y,J.r,0,Math.PI*2),t.fill()}t.fillStyle=`rgba(${zt(W,"255,255,255",.7)},0.55)`,t.beginPath(),t.arc(N.x,N.y,14*Math.max(.7,a),0,Math.PI*2),t.fill(),t.globalCompositeOperation="source-over";const Y=w.swaySpeed,X=(Math.sin(p*.55*Y)*.7+Math.sin(p*1.6*Y+1)*.3)*6*a,_=Math.sin(p*.8*Y+2)*2.5*a,V=w.interactive&&E.x>-9e3,Q=w.disturbRadius,ot=V?Math.min(40,Math.hypot(E.x-E.px,E.y-E.py)):0;for(const J of l){const nt=Math.sin(Math.PI*Math.min(1,J.f));let st=X*nt,rt=_*nt;if(V){const lt=J.bx+J.ox-E.x,Z=J.by+J.oy-E.y,et=Math.hypot(lt,Z);if(et<Q&&et>.01){const it=(1-et/Q)**2;st+=lt/et*it*16,rt+=Z/et*it*16,J.vx+=lt/et*it*ot*6,J.vy+=Z/et*it*ot*6}}J.vx+=(-(J.ox-st)*70-J.vx*5)*z,J.vy+=(-(J.oy-rt)*70-J.vy*5)*z,J.ox+=J.vx*z,J.oy+=J.vy*z}E.px=E.x,E.py=E.y;const tt={x:r.x+X*.15,y:r.y+_*.15},at=Math.atan2(N.y-r.y,N.x-r.x);t.lineCap="round",t.strokeStyle=`rgba(${D},0.5)`,t.lineWidth=.9,t.beginPath();for(const[J,nt]of n)t.moveTo(J.x,J.y),t.lineTo(nt.x,nt.y);i.forEach((J,nt)=>{const st=i[(nt+1)%i.length];t.moveTo(J.x,J.y),t.lineTo(st.x,st.y)}),t.stroke(),t.strokeStyle=`rgba(${D},0.62)`,t.lineWidth=.85;for(let J=0;J<M;J++){t.beginPath(),t.moveTo(tt.x,tt.y);for(let nt=0;nt<h;nt++){const st=$(l[nt*M+J]);t.lineTo(st.x,st.y)}t.lineTo(s[J].x,s[J].y),t.stroke()}t.strokeStyle=`rgba(${D},0.55)`,t.lineWidth=.7;for(const J of[.035,.065,.095]){t.beginPath();for(let nt=0;nt<=M;nt++){const st=s[nt%M],rt=tt.x+(st.x-r.x)*J,lt=tt.y+(st.y-r.y)*J;nt?t.lineTo(rt,lt):t.moveTo(rt,lt)}t.stroke()}const K=zt(D,W,.6);for(let J=0;J<l.length-1;J++){const nt=$(l[J]),st=$(l[J+1]),rt=u(nt,st,tt),lt=Math.atan2(st.y-nt.y,st.x-nt.x),Z=Math.abs(Math.cos(lt-at+p*.25));t.strokeStyle=`rgba(${Z>.75?zt(K,"255,255,255",.35):D},${.32+Z*.45})`,t.lineWidth=.7+Z*.35,t.beginPath(),t.moveTo(nt.x,nt.y),t.quadraticCurveTo(rt.x,rt.y,st.x,st.y),t.stroke()}if(w.dewDrops){const J=zt(W,"255,255,255",.75);for(const nt of m){const st=$(l[nt.seg]),rt=$(l[nt.seg+1]),lt=S(st,u(st,rt,tt),rt,nt.u),Z=.6+.4*Math.sin(p*2+nt.seg*1.7+nt.u*9);t.globalCompositeOperation="lighter",t.fillStyle=`rgba(${W},${.12*Z})`,t.beginPath(),t.arc(lt.x,lt.y,nt.r*3.2,0,Math.PI*2),t.fill(),t.globalCompositeOperation="source-over",t.fillStyle=`rgba(${zt(k,W,.35)},0.85)`,t.beginPath(),t.arc(lt.x,lt.y,nt.r,0,Math.PI*2),t.fill(),t.strokeStyle=`rgba(${W},0.75)`,t.lineWidth=.6,t.stroke(),t.fillStyle=`rgba(${J},${.6+.4*Z})`,t.beginPath(),t.arc(lt.x-nt.r*.35,lt.y-nt.r*.35,Math.max(.4,nt.r*.38),0,Math.PI*2),t.fill()}}if(w.showSpider){V&&Math.hypot((E.x-r.x)/(c*.44),(E.y-r.y)/(C*.44))<1?(L.tx=r.x+(E.x-r.x)*.85,L.ty=r.y+(E.y-r.y)*.85,L.lastActive=p):p-L.lastActive>2.5&&(L.tx=tt.x,L.ty=tt.y);const nt=L.tx-L.x,st=L.ty-L.y,rt=Math.hypot(nt,st),lt=rt>2;if(lt){const Z=Math.min(rt,75*Math.max(.7,a)*z);L.x+=nt/rt*Z,L.y+=st/rt*Z,L.walk+=Z*.35;let it=Math.atan2(st,nt)-L.heading;it=Math.atan2(Math.sin(it),Math.cos(it)),L.heading+=it*Math.min(1,z*6)}else{let Z=Math.PI/2-L.heading;Z=Math.atan2(Math.sin(Z),Math.cos(Z)),L.heading+=Z*Math.min(1,z*2)}R(L,q,W,p,lt)}}return v=requestAnimationFrame(f),()=>{j.disconnect(),cancelAnimationFrame(v),window.removeEventListener("mousemove",O),document.removeEventListener("mouseleave",T)}},[e])}const ds={default:{webColor:"#c0c8e0",backgroundColor:"#04081a",spiderColor:"#404060",glowColor:"#8899cc"},monochrome:{webColor:"#d8d8d8",backgroundColor:"#0a0a0a",spiderColor:"#c0c0c0",glowColor:"#e0e0e0"},night:{webColor:"#c0c8e0",backgroundColor:"#04081a",spiderColor:"#404060",glowColor:"#8899cc"},forest:{webColor:"#90b890",backgroundColor:"#050f05",spiderColor:"#2a4a2a",glowColor:"#66aa66"},neon:{webColor:"#00ffcc",backgroundColor:"#000000",spiderColor:"#003322",glowColor:"#00ffff"},frost:{webColor:"#e0f0ff",backgroundColor:"#040810",spiderColor:"#203040",glowColor:"#aaddff"}},pn=G.forwardRef((e,d)=>{const{preset:o,spokeCount:g,ringCount:y,webColor:t,backgroundColor:c,spiderColor:C,dewDrops:a,glowColor:r,swaySpeed:i,disturbRadius:n,interactive:s,showSpider:l,width:m,height:I,className:M,style:h}=e,x=ds[o??"default"]||{},E=G.useRef(null);return G.useImperativeHandle(d,()=>E.current),fs(E,{spokeCount:g??12,ringCount:y??10,webColor:t??x.webColor??"#d8d8d8",backgroundColor:c??x.backgroundColor??"#0a0a0a",spiderColor:C??x.spiderColor??"#c0c0c0",dewDrops:a??!0,glowColor:r??x.glowColor??"#e0e0e0",swaySpeed:i??1,disturbRadius:n??80,interactive:s??!0,showSpider:l??!0}),ct.jsx("div",{className:M,style:{width:m??"100%",height:I??"100%",display:"block",overflow:"hidden",cursor:"crosshair",...h},children:ct.jsx("canvas",{ref:E,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});pn.displayName="SpiderWeb";function ho(e,d,o,g,y,t){e.save(),e.scale(g*o,1),e.beginPath(),e.moveTo(0,0),e.bezierCurveTo(d*.9,-d*.6,d*1.3,d*.2,0,d*.45),e.fillStyle=y,e.fill(),e.beginPath(),e.moveTo(0,d*.2),e.bezierCurveTo(d*.6,d*.5,d*.7,d*1.1,0,d*.85),e.fill(),e.fillStyle=t,e.beginPath(),e.arc(d*.5,-d*.1,d*.1,0,Math.PI*2),e.fill(),e.beginPath(),e.arc(d*.8,d*.3,d*.08,0,Math.PI*2),e.fill(),e.restore()}function us(e,d){const o=G.useRef(d);o.current=d,G.useEffect(()=>{const g=e.current;if(!g)return;const y=g.parentElement,t=g.getContext("2d");let c=0,C=0;const a=[],r={x:-9999,y:-9999,prevX:-9999,prevY:-9999};function i(){return{x:Math.random()*c,y:Math.random()*C,vx:(Math.random()-.5)*o.current.speed,vy:(Math.random()-.5)*o.current.speed,angle:Math.random()*Math.PI*2,flapPhase:Math.random()*Math.PI*2,hueShift:(Math.random()-.5)*40,size:10+Math.random()*10,wanderAngle:Math.random()*Math.PI*2,fleeing:!1}}function n(){a.length=0;for(let E=0;E<o.current.butterflyCount;E++)a.push(i())}function s(E,L){const F=window.devicePixelRatio||1;g.width=Math.round(E*F),g.height=Math.round(L*F),g.style.width=`${E}px`,g.style.height=`${L}px`,t.scale(F,F),c=E,C=L,n()}const l=new ResizeObserver(E=>{const{width:L,height:F}=E[0].contentRect;L>0&&F>0&&s(L,F)});l.observe(y);const m=y.getBoundingClientRect();m.width>0&&m.height>0&&s(m.width,m.height);function I(E){const L=It(E,g);if(!L)return M();r.prevX=r.x,r.prevY=r.y,r.x=L.x,r.y=L.y}function M(){r.x=-9999,r.y=-9999}window.addEventListener("mousemove",I),document.addEventListener("mouseleave",M);let h=0;function x(){const E=o.current;E.showTrails?t.fillStyle=ut(E.backgroundColor,.18):t.fillStyle=E.backgroundColor,t.fillRect(0,0,c,C);const F=(r.x>-100?Math.hypot(r.x-r.prevX,r.y-r.prevY):0)>12;for(;a.length<E.butterflyCount;)a.push(i());a.length=E.butterflyCount;for(const B of a){B.wanderAngle+=(Math.random()-.5)*.3;const j=Math.cos(B.wanderAngle)*.15*E.speed,H=Math.sin(B.wanderAngle)*.15*E.speed;if(E.interactive&&r.x>-100){const R=r.x-B.x,v=r.y-B.y,A=Math.hypot(R,v);if(A<E.attractRadius&&A>0)if(F)B.vx+=-R/A*1.5,B.vy+=-v/A*1.5,B.fleeing=!0;else{const p=(1-A/E.attractRadius)*.08*E.speed;B.vx+=R/A*p,B.vy+=v/A*p,B.fleeing=!1}else B.fleeing=!1}B.vx=(B.vx+j)*.94,B.vy=(B.vy+H)*.94;const O=Math.hypot(B.vx,B.vy),T=E.speed*(B.fleeing?3:1.2);O>T&&(B.vx=B.vx/O*T,B.vy=B.vy/O*T),B.x+=B.vx,B.y+=B.vy,B.x<-B.size*2&&(B.x=c+B.size),B.x>c+B.size*2&&(B.x=-B.size),B.y<-B.size*2&&(B.y=C+B.size),B.y>C+B.size*2&&(B.y=-B.size),O>.05&&(B.angle=Math.atan2(B.vy,B.vx)+Math.PI/2),B.flapPhase+=E.flapSpeed*.15*(B.fleeing?2:1),t.save(),t.translate(B.x,B.y),t.rotate(B.angle);const $=Math.cos(B.flapPhase),u=ut(E.wingColor,.85),S=ut(E.patternColor,.7);ho(t,B.size,$,1,u,S),ho(t,B.size,$,-1,u,S),t.fillStyle=ut(E.patternColor,.9),t.beginPath(),t.ellipse(0,B.size*.4,1.5,B.size*.5,0,0,Math.PI*2),t.fill(),t.strokeStyle=ut(E.patternColor,.6),t.lineWidth=.8,t.beginPath(),t.moveTo(0,0),t.lineTo(-3,-B.size*.4),t.stroke(),t.beginPath(),t.moveTo(0,0),t.lineTo(3,-B.size*.4),t.stroke(),t.restore()}h=requestAnimationFrame(x)}return h=requestAnimationFrame(x),()=>{cancelAnimationFrame(h),l.disconnect(),window.removeEventListener("mousemove",I),document.removeEventListener("mouseleave",M)}},[e])}const hs={default:{wingColor:"#e06010",patternColor:"#111111",backgroundColor:"#0a0800"},monochrome:{wingColor:"#c8c8c8",patternColor:"#444444",backgroundColor:"#0a0a0a"},monarch:{wingColor:"#e06010",patternColor:"#111111",backgroundColor:"#0a0800"},morpho:{wingColor:"#1060ff",patternColor:"#0030aa",backgroundColor:"#000508"},meadow:{wingColor:"#f0c030",patternColor:"#804000",backgroundColor:"#0a1405"},night:{wingColor:"#c0d0e0",patternColor:"#304050",backgroundColor:"#020408"}},yn=G.forwardRef((e,d)=>{const{preset:o,butterflyCount:g,wingColor:y,patternColor:t,backgroundColor:c,flapSpeed:C,speed:a,attractRadius:r,interactive:i,showTrails:n,width:s,height:l,className:m,style:I}=e,M=hs[o??"default"]||{},h=G.useRef(null);return G.useImperativeHandle(d,()=>h.current),us(h,{butterflyCount:g??12,wingColor:y??M.wingColor??"#c8c8c8",patternColor:t??M.patternColor??"#444444",backgroundColor:c??M.backgroundColor??"#111111",flapSpeed:C??1,speed:a??1,attractRadius:r??120,interactive:i??!0,showTrails:n??!1}),ct.jsx("div",{className:m,style:{width:s??"100%",height:l??"100%",display:"block",overflow:"hidden",cursor:"crosshair",...I},children:ct.jsx("canvas",{ref:h,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});yn.displayName="ButterflySwarm";const ue=(e,d,o)=>{const g=e.split(",").map(Number),y=d.split(",").map(Number);return g.map((t,c)=>Math.round(t+(y[c]-t)*o)).join(",")};function go(e,d,o){const g=.45+Math.random()*.55;return{x:e*(.08+Math.random()*.84),y:o??d+60+Math.random()*d*.4,z:g,R:(22+Math.random()*18)*(.6+g*.55),vx:0,vy:-10,phase:Math.random()*Math.PI*2,rate:2*Math.PI/(1.9+Math.random()*1.2),seed:Math.random()*100,flash:0,tentacles:8+Math.floor(Math.random()*5)}}function gs(e,d){const o=.25+Math.random()*.75;return{x:Math.random()*e,y:Math.random()*d,z:o,r:.4+o*1.3,lit:Math.random()<.28,tw:Math.random()*10,flash:0}}function ms(e,d){const o=G.useRef(d);o.current=d,G.useEffect(()=>{const g=e.current;if(!g)return;const y=g.parentElement,t=g.getContext("2d");let c=0,C=0,a=[],r=[];const i=[],n={x:-1,y:-1,px:-1,py:-1,inside:!1};function s(){const H=o.current;a=Array.from({length:H.jellyfishCount},()=>go(c,C,Math.random()*C)),r=Array.from({length:H.planktonCount},()=>gs(c,C))}function l(H,O){const T=Math.min(2,window.devicePixelRatio||1);g.width=Math.round(H*T),g.height=Math.round(O*T),g.style.width=`${H}px`,g.style.height=`${O}px`,t.setTransform(T,0,0,T,0,0),c=H,C=O,s()}const m=new ResizeObserver(H=>{const{width:O,height:T}=H[0].contentRect;O>0&&T>0&&l(O,T)});m.observe(y);const I=y.getBoundingClientRect();I.width>0&&I.height>0&&l(I.width,I.height);function M(H){const O=It(H,g);if(!O)return h();if(n.px=n.inside?n.x:O.x,n.py=n.inside?n.y:O.y,n.x=O.x,n.y=O.y,n.inside=!0,!o.current.interactive)return;const T=Math.hypot(n.x-n.px,n.y-n.py),$=Math.min(6,Math.floor(T/4)+1);for(let u=0;u<$&&i.length<260;u++){const S=.8+Math.random()*1.1,R=Math.random();i.push({x:n.px+(n.x-n.px)*R+(Math.random()-.5)*18,y:n.py+(n.y-n.py)*R+(Math.random()-.5)*18,vx:(Math.random()-.5)*24,vy:(Math.random()-.5)*24-6,life:S,max:S,size:.8+Math.random()*1.8})}}function h(){n.inside=!1,n.x=-1,n.y=-1}window.addEventListener("mousemove",M),document.addEventListener("mouseleave",h);function x(H,O,T){const $=.55+.45*Math.sin(T*1.7+H.tw);if(H.lit){const u=(.25+.5*$)*H.z+H.flash;t.fillStyle=`rgba(${O},${Math.min(1,u*.22)})`,t.beginPath(),t.arc(H.x,H.y,H.r*4,0,Math.PI*2),t.fill(),t.fillStyle=`rgba(${ue(O,"255,255,255",.5)},${Math.min(1,u)})`}else t.fillStyle=`rgba(205,225,240,${.18*H.z*$})`;t.beginPath(),t.arc(H.x,H.y,H.r,0,Math.PI*2),t.fill()}function E(H,O,T,$){const u=Math.pow(Math.max(0,Math.sin(H.phase)),1.4),S=.35+.65*H.z,R=H.R,v=R*(1-.17*u),A=R*.9*(1+.12*u),p=Math.atan2(H.vx,-H.vy)*.8,f=ue(T,"255,255,255",.55),b=Math.cos(p),z=Math.sin(p),w=(P,N)=>({x:H.x+P*b-N*z,y:H.y+P*z+N*b});t.globalCompositeOperation="lighter";const D=w(0,-A*.3),W=t.createRadialGradient(D.x,D.y,0,D.x,D.y,R*2.8);W.addColorStop(0,`rgba(${T},${(.17+H.flash*.35)*S})`),W.addColorStop(1,`rgba(${T},0)`),t.fillStyle=W,t.beginPath(),t.arc(D.x,D.y,R*2.8,0,Math.PI*2),t.fill(),t.globalCompositeOperation="source-over",t.save(),t.translate(H.x,H.y),t.rotate(p);const k=P=>A*.14*(1-P*P);t.lineCap="round";for(let P=0;P<H.tentacles;P++){const N=-.9+1.8*P/(H.tentacles-1),U=v*N,Y=k(N),X=R*(3+P*7%3*.55)*(1-.14*u),_=16;t.beginPath(),t.moveTo(U,Y);for(let V=1;V<=_;V++){const Q=V/_,ot=U*(1+Q*.25)+Math.sin($*1.5+Q*5+P*1.3+H.seed)*R*.28*Math.pow(Q,1.2)-H.vx*.05*Q*R*.1,tt=Y+Q*X;t.lineTo(ot,tt)}t.strokeStyle=`rgba(${f},${.32*S})`,t.lineWidth=.8,t.stroke()}for(let P=0;P<4;P++){const N=(P-1.5)*v*.1,U=R*(1.7+P%2*.35),Y=14,X=[],_=[];for(let V=0;V<=Y;V++){const Q=V/Y,ot=N+Math.sin($*2+Q*4+P*1.7+H.seed)*R*.14*Q,tt=A*.08+Q*U,at=(R*.1*(1-Q)+1)*(1+.45*Math.sin(Q*14+$*3+P));X.push([ot-at,tt]),_.push([ot+at,tt])}t.beginPath(),X.forEach(([V,Q],ot)=>ot?t.lineTo(V,Q):t.moveTo(V,Q));for(let V=_.length-1;V>=0;V--)t.lineTo(_[V][0],_[V][1]);t.closePath(),t.fillStyle=`rgba(${O},${.24*S})`,t.fill(),t.strokeStyle=`rgba(${T},${.3*S})`,t.lineWidth=.8,t.stroke()}t.beginPath(),t.moveTo(-v,0),t.bezierCurveTo(-v*1.02,-A*1.3,v*1.02,-A*1.3,v,0),t.quadraticCurveTo(0,A*.28,-v,0),t.closePath();const q=t.createRadialGradient(0,-A*.5,R*.05,0,-A*.2,v*1.25);q.addColorStop(0,`rgba(${f},${.55*S})`),q.addColorStop(.45,`rgba(${O},${.3*S})`),q.addColorStop(1,`rgba(${O},${.12*S})`),t.fillStyle=q,t.fill(),t.strokeStyle=`rgba(${f},${.6*S})`,t.lineWidth=1.2,t.stroke(),t.globalCompositeOperation="lighter",t.strokeStyle=`rgba(${T},${.22*S})`,t.lineWidth=.8;for(let P=0;P<8;P++){const N=-.85+1.7*P/7;t.beginPath(),t.moveTo(0,-A*.82),t.quadraticCurveTo(v*N*.7,-A*.7,v*N,k(N)-1),t.stroke()}t.strokeStyle=`rgba(${T},${(.55+H.flash*.4)*S})`,t.lineWidth=1.6;for(let P=0;P<4;P++){const N=Math.PI/4+P*Math.PI/2;t.beginPath(),t.ellipse(Math.cos(N)*v*.26,-A*.42+Math.sin(N)*A*.16,v*.13,A*.09,N,0,Math.PI*2),t.stroke()}t.beginPath(),t.ellipse(-v*.3,-A*.72,v*.3,A*.1,-.35,0,Math.PI*2),t.fillStyle=`rgba(255,255,255,${.1*S})`,t.fill(),t.restore();for(let P=0;P<12;P++){const N=-.95+1.9*P/11,U=w(v*N,A*.14*(1-N*N)),Y=(.5+.5*Math.sin($*4-P*.65+H.seed))*(.55+H.flash)*S;t.fillStyle=`rgba(${T},${Math.min(1,Y*.35)})`,t.beginPath(),t.arc(U.x,U.y,3.4*H.z+1,0,Math.PI*2),t.fill(),t.fillStyle=`rgba(${f},${Math.min(1,Y)})`,t.beginPath(),t.arc(U.x,U.y,1.1*H.z+.4,0,Math.PI*2),t.fill()}t.globalCompositeOperation="source-over"}let L=0,F=0,B=0;function j(H){L=requestAnimationFrame(j);const O=F?Math.min(.05,(H-F)/1e3):1/60;if(F=H,c===0)return;const T=o.current,$=O*T.speed;B+=$,(a.length!==T.jellyfishCount||r.length!==T.planktonCount)&&s();const u=mt(T.jellyfishColor),S=mt(T.glowColor),R=mt(T.waterColor),v=t.createLinearGradient(0,0,0,C);v.addColorStop(0,`rgb(${ue(R,S,.1)})`),v.addColorStop(1,`rgb(${R})`),t.fillStyle=v,t.fillRect(0,0,c,C),t.globalCompositeOperation="lighter";for(let f=0;f<4;f++){const b=c*(.15+f*.24)+Math.sin(B*.15+f*2)*c*.05,z=t.createLinearGradient(0,0,0,C*.9);z.addColorStop(0,`rgba(${S},0.055)`),z.addColorStop(1,`rgba(${S},0)`),t.fillStyle=z,t.beginPath(),t.moveTo(b-14,0),t.lineTo(b+14,0),t.lineTo(b+120+c*.05,C*.9),t.lineTo(b-40+c*.05,C*.9),t.closePath(),t.fill()}t.globalCompositeOperation="source-over";const A=T.interactive&&n.inside;for(const f of r){if(f.y+=(4+f.z*6)*$,f.x+=Math.sin(B*.4+f.tw)*3*$,f.y>C+4&&(f.y=-4,f.x=Math.random()*c),A){const b=Math.hypot(f.x-n.x,f.y-n.y);b<90&&(f.flash=Math.max(f.flash,(1-b/90)*.9))}f.flash*=Math.exp(-$*1.6)}t.globalCompositeOperation="lighter";for(const f of r)f.z<.6&&x(f,S,B);t.globalCompositeOperation="source-over";for(const f of a){f.phase+=f.rate*$;const b=Math.pow(Math.max(0,Math.sin(f.phase)),1.4),z=Math.sin(B*.2+f.seed)*.35,w=70*b*(.6+f.z*.6);if(f.vx+=Math.sin(z)*w*$,f.vy-=Math.cos(z)*w*$,A){const W=f.x-n.x,k=f.y-n.y,q=Math.hypot(W,k)||1;q<150&&(f.flash=Math.max(f.flash,1-q/150),f.vx+=W/q*40*$,f.vy+=k/q*40*$)}f.flash*=Math.exp(-$*1.4);const D=Math.exp(-$*1.3);f.vx*=D,f.vy=f.vy*D+3*$,f.x+=f.vx*$,f.y+=f.vy*$,f.x<-f.R*2&&(f.x=c+f.R*2),f.x>c+f.R*2&&(f.x=-f.R*2),f.y<-f.R*5&&Object.assign(f,go(c,C))}[...a].sort((f,b)=>f.z-b.z).forEach(f=>E(f,u,S,B)),t.globalCompositeOperation="lighter";for(const f of r)f.z>=.6&&x(f,S,B);const p=ue(S,"255,255,255",.5);for(let f=i.length-1;f>=0;f--){const b=i[f];if(b.life-=O,b.life<=0){i.splice(f,1);continue}b.x+=b.vx*O,b.y+=b.vy*O,b.vx*=.97,b.vy*=.97;const z=b.life/b.max;t.fillStyle=`rgba(${S},${.25*z})`,t.beginPath(),t.arc(b.x,b.y,b.size*4,0,Math.PI*2),t.fill(),t.fillStyle=`rgba(${p},${z})`,t.beginPath(),t.arc(b.x,b.y,b.size,0,Math.PI*2),t.fill()}t.globalCompositeOperation="source-over"}return L=requestAnimationFrame(j),()=>{m.disconnect(),cancelAnimationFrame(L),window.removeEventListener("mousemove",M),document.removeEventListener("mouseleave",h)}},[e])}const ps={default:{jellyfishColor:"#7fd8ff",glowColor:"#3fe0d0",waterColor:"#020a16"},monochrome:{},abyssal:{jellyfishColor:"#8855cc",glowColor:"#aa55ff",waterColor:"#020008"},coral:{jellyfishColor:"#ff8855",glowColor:"#ffaa44",waterColor:"#040a0c"},aurora:{jellyfishColor:"#44ffaa",glowColor:"#00ff88",waterColor:"#020c08"},crimson:{jellyfishColor:"#ff3344",glowColor:"#ff2244",waterColor:"#080002"}},Mn=G.forwardRef((e,d)=>{const{preset:o,jellyfishCount:g,planktonCount:y,jellyfishColor:t,glowColor:c,waterColor:C,interactive:a,speed:r,width:i,height:n,className:s,style:l}=e,m=ps[o??"default"]||{},I=G.useRef(null);return G.useImperativeHandle(d,()=>I.current),ms(I,{jellyfishCount:g??5,planktonCount:y??200,jellyfishColor:t??m.jellyfishColor??"#99bbcc",glowColor:c??m.glowColor??"#aaccdd",waterColor:C??m.waterColor??"#060c10",interactive:a??!0,speed:r??1}),ct.jsx("div",{className:s,style:{width:i??"100%",height:n??"100%",display:"block",overflow:"hidden",cursor:"crosshair",...l},children:ct.jsx("canvas",{ref:I,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});Mn.displayName="DeepSeaBioluminescence";const bn=(e,d)=>(e+4096)*16384+(d+4096);function Cn(e,d){const o=e.nodes[d],g=bn(Math.floor(o.x/e.cell),Math.floor(o.y/e.cell)),y=e.grid.get(g);y?y.push(d):e.grid.set(g,[d])}function mo(e,d,o,g){const y=Math.floor(d/e.cell),t=Math.floor(o/e.cell),c=Math.ceil(g/e.cell);let C=-1,a=g*g;for(let r=y-c;r<=y+c;r++)for(let i=t-c;i<=t+c;i++){const n=e.grid.get(bn(r,i));if(n)for(const s of n){const l=e.nodes[s],m=(l.x-d)**2+(l.y-o)**2;m<a&&(a=m,C=s)}}return C}function vn(e,d,o,g){const y={nodes:[],ax:d,ay:o,alive:new Uint8Array(d.length).fill(1),live:d.length,grid:new Map,cell:g,leaves:[],tendrils:[],done:d.length===0,sw:0,sh:0,stuck:0,blocked:new Map};for(const t of e)y.nodes.push({x:t.x,y:t.y,parent:-1,dx:t.dx,dy:t.dy,weight:0}),Cn(y,y.nodes.length-1);return y}function ys(e,d,o,g,y,t,c){e.nodes.push({x:o,y:g,parent:d,dx:y,dy:t,weight:0});const C=e.nodes.length-1;Cn(e,C);for(let r=d;r>=0;r=e.nodes[r].parent)e.nodes[r].weight++;const a=c.t??0;if(Math.random()<(c.leafChance??0)){const r=Math.random()<.5?-1:1;e.leaves.push({x:o,y:g,angle:Math.atan2(t,y)+r*(.6+Math.random()*.7),size:(c.leafSize??8)*(.7+Math.random()*.6),born:a,shade:Math.random()*3|0})}if(Math.random()<(c.tendrilChance??0)){const r=Math.random()<.5?-1:1;e.tendrils.push({x:o,y:g,angle:Math.atan2(t,y)+r*.9,dir:r,size:5+Math.random()*5,born:a})}return C}function po(e,d){if(e.done)return 0;const o=new Map;for(let t=0;t<e.ax.length;t++){if(!e.alive[t])continue;const c=mo(e,e.ax[t],e.ay[t],d.influence);if(c<0)continue;const C=e.nodes[c],a=e.ax[t]-C.x,r=e.ay[t]-C.y,i=Math.hypot(a,r)||1,n=o.get(c);n?(n.gx+=a/i,n.gy+=r/i,n.attrs.push(t)):o.set(c,{gx:a/i,gy:r/i,attrs:[t]})}const g=[],y=(t,c,C)=>{const a=e.nodes[t];let r=c*.75+a.dx*.25,i=C*.75+a.dy*.25;if(d.sun&&d.sunX!==void 0&&d.sunY!==void 0){const m=d.sunX-a.x,I=d.sunY-a.y,M=Math.hypot(m,I)||1;r+=m/M*d.sun,i+=I/M*d.sun}let n=Math.hypot(r,i);n<.001&&(r=Math.random()-.5,i=Math.random()-.5,n=Math.hypot(r,i)),r/=n,i/=n;const s=a.x+r*d.segLen,l=a.y+i*d.segLen;return mo(e,s,l,d.segLen*.45)>=0?!1:(g.push(ys(e,t,s,l,r,i,d)),!0)};for(const[t,{gx:c,gy:C,attrs:a}]of o){if(e.nodes.length>=d.maxNodes)break;const r=Math.hypot(c,C)||1;if(y(t,c/r,C/r)){e.blocked.delete(t);continue}const i=(e.blocked.get(t)??0)+1;if(e.blocked.set(t,i),i>=3){for(const n of a)e.alive[n]&&(e.alive[n]=0,e.live--);e.blocked.delete(t)}}if(o.size===0&&e.live>0){let t=-1,c=-1,C=1/0;const a=Math.max(1,Math.floor(e.nodes.length*e.live/6e4));for(let r=0;r<e.ax.length;r++)if(e.alive[r])for(let i=0;i<e.nodes.length;i+=a){const n=(e.nodes[i].x-e.ax[r])**2+(e.nodes[i].y-e.ay[r])**2;n<C&&(C=n,t=i,c=r)}if(t>=0){const r=e.nodes[t],i=Math.sqrt(C)||1;!y(t,(e.ax[c]-r.x)/i,(e.ay[c]-r.y)/i)&&++e.stuck>4&&(e.alive[c]=0,e.live--,e.stuck=0)}}if(g.length){const t=d.kill*d.kill;for(let c=0;c<e.ax.length;c++)if(e.alive[c])for(const C of g){const a=e.nodes[C];if((a.x-e.ax[c])**2+(a.y-e.ay[c])**2<t){e.alive[c]=0,e.live--;break}}}return(e.live<=0||e.nodes.length>=d.maxNodes)&&(e.done=!0),g.length}function Ms(e,d,o,g){const y=[],t=[],c=Math.round(e*d/650*g),C=Math.min(e,d)*.3;for(let r=0;y.length<c&&r<c*12;r++){const i=Math.random()*e,n=Math.random()*d,s=Math.min(i,e-i,d-n,n*1.6),l=.08+.92*Math.max(0,1-s/C);Math.random()<l&&(y.push(i),t.push(n))}const a=Array.from({length:Math.max(1,o)},(r,i)=>{const n=Math.max(1,o);return{x:n===1?e*.1:i/(n-1)*e*.9+e*.05+(Math.random()-.5)*30,y:d+2,dx:0,dy:-1}});return vn(a,y,t,70)}function bs(e,d,o){const g=e.h*2+e.w,y=Math.round(g/3.2*o),t=[],c=[];for(let r=0;r<y;r++){const i=Math.random()*g,n=-3+Math.random()*(d+3);i<e.h?(t.push(-n),c.push(e.h-i)):i<e.h+e.w?(t.push(i-e.h),c.push(-n)):(t.push(e.w+n),c.push(i-e.h-e.w))}const C=[{x:-d*.4,y:e.h+2,dx:0,dy:-1},{x:e.w+d*.4,y:e.h+2,dx:0,dy:-1}],a=vn(C,t,c,Math.max(24,d*2.2));return a.sw=e.w,a.sh=e.h,a}const Cs=e=>1+2.70158*Math.pow(e-1,3)+1.70158*Math.pow(e-1,2);function vs(e){const d=G.useRef(e);d.current=e;const o=G.useRef(new Map),g=G.useRef(0),y=G.useRef(0),t=G.useRef(-1),c=G.useRef(""),C=Rt(),a=G.useRef(null);function r(l,m,I){const M=l===-1;return{influence:M?70:Math.max(24,m.hug*2.2),kill:M?11:7,segLen:M?4.5:3.2,maxNodes:M?3500:1600,leafChance:m.leafDensity*(M?.5:.85),tendrilChance:.025,leafSize:m.leafSize*(M?1:.9),t:I}}function i(l,m,I,M,h){const x=Array.from({length:6},()=>new Path2D);for(let j=0;j<m.nodes.length;j++){const H=m.nodes[j];if(H.parent<0)continue;const O=m.nodes[H.parent],T=.7+Math.sqrt(H.weight)*.3,$=Math.min(5,Math.floor(T));x[$].moveTo(O.x,O.y),x[$].lineTo(H.x,H.y)}l.globalAlpha=h,l.strokeStyle=I.color,l.lineCap="round",l.lineJoin="round";for(let j=0;j<6;j++)l.lineWidth=.8+j*.85,l.stroke(x[j]);l.lineWidth=.7;const E=new Path2D;for(const j of m.tendrils){const H=Math.min(1,(M-j.born)/1.4);if(H<=0)continue;const O=Math.ceil(18*H);let T=j.x,$=j.y,u=j.angle;E.moveTo(T,$);for(let S=0;S<O;S++){const R=j.size*.22*(1-S/22);u+=j.dir*(.18+S*.035),T+=Math.cos(u)*R,$+=Math.sin(u)*R,E.lineTo(T,$)}}l.stroke(E);const L=[new Path2D,new Path2D,new Path2D],F=new Path2D;for(const j of m.leaves){const H=Math.min(1,(M-j.born)/.9);if(H<=0)continue;const O=j.size*Math.max(0,Cs(H)),T=Math.cos(j.angle),$=Math.sin(j.angle),u=j.x+T*1.5,S=j.y+$*1.5,R=(f,b)=>[u+f*T-b*$,S+f*$+b*T],v=L[j.shade],A=R(0,0);v.moveTo(A[0],A[1]),v.bezierCurveTo(...R(O*.15,-O*.62),...R(O*.95,-O*.55),...R(O,0)),v.bezierCurveTo(...R(O*.95,O*.55),...R(O*.15,O*.62),A[0],A[1]),v.closePath();const p=R(O*.85,0);F.moveTo(A[0],A[1]),F.lineTo(p[0],p[1])}l.fillStyle=I.leafColor;const B=[.62,.8,1];for(let j=0;j<3;j++)l.globalAlpha=B[j]*h,l.fill(L[j]);l.globalAlpha=.45*h,l.lineWidth=.6,l.strokeStyle=I.color,l.stroke(F),l.globalAlpha=1}function n(l,m,I,M,h){const x=d.current;g.current+=M*.001;const E=g.current,L=o.current;h.overlay||(l.fillStyle=x.backgroundColor,l.fillRect(0,0,m,I));const F=`${x.collide}|${x.vines}|${x.density}|${x.hug}`;c.current!==F&&(c.current=F,L.clear(),t.current=-1);const B=h.solids,j=new Map(B.map(R=>[R.id,R])),H=er(),O=(R,v)=>{const A=v();if(H){const p=r(R,x,E-10);for(let f=0;f<6e3&&!A.done;f++)po(A,p)}L.set(R,A)};if(x.collide){for(const R of B){if(R.w<40||R.h<12)continue;const v=L.get(R.id);(!v||Math.abs(v.sw-R.w)>R.w*.2||Math.abs(v.sh-R.h)>R.h*.3)&&O(R.id,()=>bs(R,x.hug,x.density))}for(const R of L.keys())j.has(R)||L.delete(R)}else L.has(-1)||O(-1,()=>Ms(m,I,x.vines,x.density));const T=kt(C.current,a.current);y.current+=M*.001*15*x.growthSpeed;const $=Math.min(6,Math.floor(y.current));y.current-=$;let u=L.size>0;for(const[R,v]of L){const A=R===-1?null:j.get(R),p=A?A.x:0,f=A?A.y:0,b=r(R,x,E);x.followCursor&&T.inside&&(b.sunX=T.x-p,b.sunY=T.y-f,b.sun=.35);for(let z=0;z<$;z++)po(v,b);v.done||(u=!1)}let S=1;if(x.loop&&u){t.current<0&&(t.current=E);const R=E-t.current;R>7&&(S=Math.max(0,1-(R-7)/1.8)),S<=0&&(L.clear(),t.current=-1)}else t.current=-1;for(const[R,v]of L){const A=R===-1?null:j.get(R);l.save(),A&&l.translate(A.x,A.y),i(l,v,x,E,S),l.restore()}}const s=xt({overlay:e.overlay,collide:e.collide,onResize:()=>{o.current.delete(-1)},onFrame:n});return a.current=s.canvas,s}const xs={default:{color:"#3f5a2a",leafColor:"#5f9e3a",backgroundColor:"#0c120b"},monochrome:{},"english-ivy":{color:"#3f5a2a",leafColor:"#5f9e3a",backgroundColor:"#0c120b"},autumn:{color:"#5a3a22",leafColor:"#d9622b",backgroundColor:"#140b07"},jungle:{color:"#245c3a",leafColor:"#34d399",backgroundColor:"#04110b",leafDensity:.55,leafSize:11},gilded:{color:"#8a6a2a",leafColor:"#f5c96a",backgroundColor:"#0e0b06",leafDensity:.3}},xn=G.forwardRef((e,d)=>{const{preset:o,color:g,leafColor:y,backgroundColor:t,vines:c,growthSpeed:C,density:a,leafSize:r,leafDensity:i,followCursor:n,hug:s,loop:l,overlay:m,collide:I,zIndex:M,width:h,height:x,className:E,style:L}=e,F=xs[o??"default"]||{},{canvasRef:B,canvas:j}=vs({color:g??F.color??"#6b7280",leafColor:y??F.leafColor??"#ffffff",backgroundColor:t??F.backgroundColor??"#111111",vines:Math.max(1,Math.round(c??4)),growthSpeed:C??1,density:Math.min(2,Math.max(.3,a??1)),leafSize:r??F.leafSize??9,leafDensity:i??F.leafDensity??.35,followCursor:n??!0,hug:s??20,loop:l??!1,overlay:m??!1,collide:I??!1});return G.useImperativeHandle(d,()=>j,[j]),ct.jsx(vt,{canvasRef:B,overlay:m,zIndex:M,width:h,height:x,className:E,style:L})});xn.displayName="IvyGrowth";const He=3,wn=Math.exp(He)-1,ws=e=>Math.log(1+wn*e)/He,Rs=e=>(Math.exp(He*e)-1)/wn;function ks(e,d,o,g,y){const t=[];for(let a=0;a<e.length;a++)e[a].phase+=d/o*(e[a].rate??1),e[a].phase>=1&&t.push(a);const c=new Set,C=y*y;for(;t.length;){const a=t.pop();if(c.has(a))continue;c.add(a);const r=e[a];if(r.phase=0,r.flash=1,!(g<=0))for(let i=0;i<e.length;i++){if(i===a||c.has(i))continue;const n=e[i],s=n.x-r.x,l=n.y-r.y;if(s*s+l*l>C)continue;const m=ws(Math.min(n.phase,1))+g;m>=1?(n.phase=1,t.push(i)):n.phase=Rs(m)}}return c.size}const Ss=e=>Math.atan2(Math.sin(e),Math.cos(e));function Ps(e){const d=G.useRef(e);d.current=e;const o=G.useRef([]),g=G.useRef({w:0,h:0}),y=G.useRef(0),t=G.useRef({color:"",img:null}),c=Rt(),C=G.useRef(null);function a(){const{w:n,h:s}=g.current;return{x:Math.random()*n,y:s*.15+Math.random()*s*.85,heading:Math.random()*Math.PI*2,speed:.25+Math.random()*.45,phase:Math.random(),rate:.95+Math.random()*.1,flash:0,depth:.55+Math.random()*.45,seed:Math.random()*1e3,target:null,rest:null,restLeft:0}}function r(n,s,l,m,I){const M=d.current,h=m/16.67;y.current+=m*.001;const x=y.current;I.overlay||(n.fillStyle=M.backgroundColor,n.fillRect(0,0,s,l)),t.current.color!==M.color&&(t.current={color:M.color,img:Pt(M.color,64)});const E=t.current.img,L=M.count>0?Math.max(1,Math.ceil(M.count*I.quality)):0,F=o.current;for(;F.length<L;)F.push(a());F.length>L&&(F.length=L);const B=kt(c.current,C.current),j=M.interactive&&B.inside;if(M.interactive)for(const $ of B.taps)for(const u of F)Math.hypot(u.x-$.x,u.y-$.y)<160&&(u.phase=1);const H=I.solids,O=new Map(H.map($=>[$.id,$]));for(const $ of F){if($.rest){$.restLeft-=m,($.restLeft<=0||!ae($,$.rest,O))&&($.rest=null,$.heading=-Math.PI/2+(Math.random()-.5));continue}let u=Math.sin(x*.9+$.seed)*.025+Math.sin(x*2.3+$.seed*1.7)*.015;u+=(Math.random()-.5)*.04;let S=0,R=0,v=0;if($.target){const f=O.get($.target.solidId);if(!f)$.target=null;else{const b=f.x+$.target.offsetX,z=f.y-2;if(Math.hypot(b-$.x,z-$.y)<4){$.x=b,$.y=z,$.rest=re($,f,-2),$.restLeft=3e3+Math.random()*6e3,$.target=null;continue}S=b-$.x,R=z-$.y,v=.08}}else if(H.length&&Math.random()<6e-4*h){const f=H[Math.random()*H.length|0];f.w>8&&f.y>0&&f.y<l&&($.target={solidId:f.id,offsetX:4+Math.random()*(f.w-8)})}if(j&&!$.target){const f=B.x-$.x,b=B.y-$.y,z=Math.hypot(f,b);if(z<240){const w=z<45?-1:1;S=f*w,R=b*w,v=.05*(1-z/240)+.01}}const A=30;if($.x<A&&(S+=1,v=Math.max(v,.04)),$.x>s-A&&(S-=1,v=Math.max(v,.04)),$.y<A&&(R+=1,v=Math.max(v,.04)),$.y>l-A&&(R-=1,v=Math.max(v,.04)),v>0){const f=Math.atan2(R,S);u+=Ss(f-$.heading)*v}$.heading+=u*h;const p=$.speed*M.speed*($.target?1.8:1);$.x+=Math.cos($.heading)*p*h,$.y+=(Math.sin($.heading)*p+Math.sin(x*1.4+$.seed)*.08)*h,($.x<-40||$.x>s+40||$.y<-40||$.y>l+40)&&($.x=Math.min(s,Math.max(0,$.x)),$.y=Math.min(l,Math.max(0,$.y)))}ks(F,m*.001,Math.max(.2,M.period),M.sync,M.syncRadius);const T=n.globalCompositeOperation;n.globalCompositeOperation="lighter";for(const $ of F){$.flash*=Math.exp(-m/380);const u=.16+.84*$.flash,S=M.glow*$.depth*(.6+.6*u);E&&(n.globalAlpha=Math.min(1,u*$.depth),n.drawImage(E,$.x-S,$.y-S,S*2,S*2)),n.globalAlpha=Math.min(1,.25+u),n.fillStyle=M.color,n.beginPath(),n.arc($.x,$.y,M.size*$.depth*(.6+.4*u),0,Math.PI*2),n.fill()}n.globalAlpha=1,n.globalCompositeOperation=T}const i=xt({overlay:e.overlay,collide:e.collide,onResize:(n,s)=>{g.current={w:n,h:s},o.current=Array.from({length:d.current.count},a)},onFrame:r});return C.current=i.canvas,i}const Es={default:{color:"#d9f99d",backgroundColor:"#06100a"},monochrome:{},summer:{color:"#d9f99d",backgroundColor:"#06100a",glow:22},riverbank:{color:"#facc15",backgroundColor:"#050806",sync:.14,period:1.2},"blue-ghost":{color:"#7dd3fc",backgroundColor:"#03070d",sync:.04,period:2.2,glow:26},ember:{color:"#fb923c",backgroundColor:"#0c0503",sync:.1}},Rn=G.forwardRef((e,d)=>{const{preset:o,count:g,color:y,backgroundColor:t,size:c,glow:C,period:a,sync:r,syncRadius:i,speed:n,interactive:s,overlay:l,collide:m,zIndex:I,width:M,height:h,className:x,style:E}=e,L=Es[o??"default"]||{},{canvasRef:F,canvas:B}=Ps({count:g??60,color:y??L.color??"#ffffff",backgroundColor:t??L.backgroundColor??"#111111",size:c??2.2,glow:C??L.glow??18,period:a??L.period??1.6,sync:r??L.sync??.08,syncRadius:i??160,speed:n??1,interactive:s??!0,overlay:l??!1,collide:m??!1});return G.useImperativeHandle(d,()=>B,[B]),ct.jsx(vt,{canvasRef:F,overlay:l,zIndex:I,width:M,height:h,className:x,style:E})});Rn.displayName="Fireflies";const As=.32,Is=.025,yo=700,$s=Math.PI*(3-Math.sqrt(5));function Ts(e,d,o){const g=d.wind*(.55+.45*Math.sin(d.t*.31+e.y*.008))+Math.sin(d.t*1.7+e.x*.02+e.phase)*.25,y=Math.sin(d.t*1.1+e.x*.015+e.phase*2)*.28,t=1-Math.pow(1-Is,o);e.vx+=(g-e.vx)*t,e.vy+=(As+y-e.vy)*t,e.x+=e.vx*o,e.y+=e.vy*o}function Mo(e,d){const o=1-2*(e+.5)/d,g=Math.sqrt(1-o*o),y=e*$s;return[Math.cos(y)*g,o,Math.sin(y)*g]}function zs(e){const d=G.useRef(e);d.current=e;const o=G.useRef([]),g=G.useRef([]),y=G.useRef(0),t=G.useRef(2),c=G.useRef(""),C=Rt(),a=G.useRef(Xt()).current,r=G.useRef(null);function i(M,h){const x=d.current;c.current=`${x.headCount}|${x.seedsPerHead}`;const E=Math.max(0,x.headCount);o.current=Array.from({length:E},(L,F)=>({x:M*((F+.5)/E)+(Math.random()-.5)*(M/E)*.4,stemH:h*(.32+Math.random()*.3),r:Math.min(46,Math.max(22,Math.min(M,h)*.06))*(.85+Math.random()*.3),sway:0,swayVel:0,attached:Array(x.seedsPerHead).fill(!0),grow:1,emptySince:-1})),g.current=[]}function n(M,h){return{x:M.x+Math.sin(M.sway)*M.stemH,y:h-Math.cos(M.sway)*M.stemH}}function s(M,h,x,E,L){if(!M.attached[h]||g.current.length>=yo)return;M.attached[h]=!1;const F=n(M,x),[B,j]=Mo(h,M.attached.length);g.current.push({x:F.x+B*M.r,y:F.y+j*M.r,vx:E+B*.8,vy:L+j*.8-.4,phase:Math.random()*Math.PI*2,life:0,alpha:1,rest:null,landed:!1})}function l(M,h){const x=Math.max(-.7,Math.min(.7,h.vx*.25)),E=Math.sin(x),L=-Math.cos(x),F=h.x+E*9,B=h.y+L*9;M.globalAlpha=h.alpha,M.beginPath(),M.moveTo(h.x,h.y),M.lineTo(F,B);for(let j=0;j<9;j++){const H=x-Math.PI/2+(j/8-.5)*2.3;M.moveTo(F,B),M.lineTo(F+Math.cos(H)*6,B+Math.sin(H)*6)}M.stroke(),M.beginPath(),M.ellipse(h.x,h.y,.9,1.8,x,0,Math.PI*2),M.fill()}function m(M,h,x,E,L){const F=d.current,B=E/16.67;y.current+=E*.001;const j=y.current;c.current!==`${F.headCount}|${F.seedsPerHead}`&&i(h,x),L.overlay||(M.fillStyle=F.backgroundColor,M.fillRect(0,0,h,x));const H=kt(C.current,r.current),O=a(H,B),T=Math.hypot(O.vx,O.vy),$=o.current;if(F.autoBlow&&j>t.current&&$.length){t.current=j+2.5+Math.random()*4;const f=$[Math.random()*$.length|0],b=3+(Math.random()*6|0);for(let z=0;z<b;z++){const w=Math.random()*f.attached.length|0;s(f,w,x,F.wind*1.5,-.6)}}M.lineCap="round";for(const f of $){let b=F.wind*.06+Math.sin(j*.9+f.x*.01)*.03;const z=n(f,x);if(F.interactive&&H.inside&&T>1.5){const q=Math.hypot(H.x-z.x,H.y-z.y),P=f.r*1.9;if(q<P){b+=O.vx/40*(1-q/P);const N=Math.min(1,T*.02*F.blowStrength)*(1-q/P);for(let U=0;U<f.attached.length;U++)f.attached[U]&&Math.random()<N*.35*B&&s(f,U,x,O.vx*.22,O.vy*.22)}}f.swayVel+=(-.035*(f.sway-b)-.08*f.swayVel)*B,f.sway+=f.swayVel*B;const w=f.attached.reduce((q,P)=>q+(P?1:0),0);F.regrow&&w===0&&(f.emptySince<0?f.emptySince=j:j-f.emptySince>3.5&&(f.attached.fill(!0),f.grow=0,f.emptySince=-1)),f.grow=Math.min(1,f.grow+E/1600);const D=n(f,x);M.strokeStyle=F.stemColor,M.lineWidth=2,M.globalAlpha=1,M.beginPath(),M.moveTo(f.x,x+2),M.quadraticCurveTo(f.x+Math.sin(f.sway)*f.stemH*.35,x-f.stemH*.55,D.x,D.y),M.stroke();const W=f.attached.length,k=f.r*(.35+.65*f.grow);M.strokeStyle=F.color,M.lineWidth=.6;for(const q of[!0,!1]){M.globalAlpha=(q?.28:.8)*f.grow,M.beginPath();for(let P=0;P<W;P++){if(!f.attached[P])continue;const[N,U,Y]=Mo(P,W);if(Y<0!==q)continue;const X=D.x+N*k,_=D.y+U*k;M.moveTo(D.x+N*k*.18,D.y+U*k*.18),M.lineTo(X,_);for(let V=0;V<5;V++){const Q=Math.atan2(U,N)+(V-2)*.45;M.moveTo(X,_),M.lineTo(X+Math.cos(Q)*3.2,_+Math.sin(Q)*3.2)}}M.stroke()}M.globalAlpha=1,M.fillStyle=F.stemColor,M.beginPath(),M.arc(D.x,D.y,Math.max(2,f.r*.12),0,Math.PI*2),M.fill()}const u=L.solids,S=new Map(u.map(f=>[f.id,f])),R={t:j,wind:F.wind},v=g.current,A=Math.ceil(yo*L.quality);v.length>A&&v.splice(0,v.length-A),M.strokeStyle=F.color,M.fillStyle=F.stemColor,M.lineWidth=.6;let p=0;for(const f of v){if(f.landed)f.life-=E,f.rest&&!ae(f,f.rest,S)&&(f.rest=null,f.landed=!1,f.vy=.2),f.life<1200&&(f.alpha=Math.max(0,f.life/1200));else{const b=f.x,z=f.y;if(Ts(f,R,B),u.length){const w=Xe(f,b,z,u,0);w&&(f.rest=re(f,w,-1),f.landed=!0,f.life=3e3+Math.random()*5e3)}!f.landed&&f.y>x-2&&(f.y=x-2,f.landed=!0,f.life=2e3+Math.random()*3e3)}f.alpha<=0||f.x<-60||f.x>h+60||f.y<-120||(v[p++]=f,l(M,f))}v.length=p,M.globalAlpha=1}const I=xt({overlay:e.overlay,collide:e.collide,onResize:i,onFrame:m});return r.current=I.canvas,I}const Fs={default:{color:"#dbeafe",stemColor:"#3b4a63",backgroundColor:"#05080f"},monochrome:{},meadow:{color:"#f8fafc",stemColor:"#5f8f3e",backgroundColor:"#0b1a14"},sunset:{color:"#ffe8cc",stemColor:"#8a5a2b",backgroundColor:"#1a0c08",wind:1.2},moonlit:{color:"#dbeafe",stemColor:"#3b4a63",backgroundColor:"#05080f",wind:.6},ink:{color:"#1f2937",stemColor:"#4b5563",backgroundColor:"#f5f1e8"}},kn=G.forwardRef((e,d)=>{const{preset:o,headCount:g,seedsPerHead:y,color:t,stemColor:c,backgroundColor:C,wind:a,blowStrength:r,autoBlow:i,regrow:n,interactive:s,overlay:l,collide:m,zIndex:I,width:M,height:h,className:x,style:E}=e,L=Fs[o??"default"]||{},{canvasRef:F,canvas:B}=zs({headCount:Math.max(0,Math.round(g??3)),seedsPerHead:Math.max(8,Math.round(y??110)),color:t??L.color??"#ffffff",stemColor:c??L.stemColor??"#6b7280",backgroundColor:C??L.backgroundColor??"#111111",wind:a??L.wind??.9,blowStrength:r??1,autoBlow:i??!0,regrow:n??!0,interactive:s??!0,overlay:l??!1,collide:m??!1});return G.useImperativeHandle(d,()=>B,[B]),ct.jsx(vt,{canvasRef:F,overlay:l,zIndex:I,width:M,height:h,className:x,style:E})});kn.displayName="Dandelion";const he=4,Ls=.11;function Bs(e,d,o){e.vel+=(-e.stiffness*(e.angle-d)-Ls*e.vel)*o,e.angle+=e.vel*o}function Ds(e){const d=G.useRef(e);d.current=e;const o=G.useRef([]),g=G.useRef(""),y=G.useRef(0),t=Rt(),c=G.useRef(Xt()).current,C=G.useRef(null);function a(n,s){const l=d.current;g.current=`${l.density}|${l.rows}|${l.height}|${l.flowers}`;const m=[],I=s*l.height;for(let M=0;M<l.rows;M++){const h=(M+1)/l.rows,x=Math.round(n/100*l.density*(.6+.4*h)),E=[];for(let L=0;L<x;L++)E.push({x:Math.random()*n,row:M,h:I*(.45+Math.random()*.55)*(.55+.45*h),w:(2.2+Math.random()*2.6)*(.6+.4*h),angle:0,vel:0,lean:(Math.random()-.5)*.35,stiffness:.05+Math.random()*.05,shade:Math.floor(Math.random()*he),flower:Math.random()<l.flowers*h});E.sort((L,F)=>L.x-F.x),m.push(E)}o.current=m}function r(n,s,l,m,I){const M=d.current,h=m/16.67;y.current+=m*.001;const x=y.current;I.overlay||(n.fillStyle=M.backgroundColor,n.fillRect(0,0,s,l)),g.current!==`${M.density}|${M.rows}|${M.height}|${M.flowers}`&&a(s,l);const E=kt(t.current,C.current),L=c(E,h),F=M.interactive&&E.inside,B=80,j=I.quality>=1?1:I.quality>=.5?2:3,H=l+2,O=o.current;for(let T=0;T<O.length;T++){const $=(T+1)/O.length,u=O[T],S=Array.from({length:he},()=>new Path2D),R=new Path2D;for(let p=0;p<u.length;p+=j){const f=u[p],b=.18*Math.sin(x*.8+f.x*.006)+.08*Math.sin(x*2.1+f.x*.03),z=Math.sin(f.x*.0025-x*1.1),w=Math.pow(Math.max(0,z),6)*.55*M.gusts;let D=f.lean+M.wind*(.12+b+w)*(.7+.3*$);if(F){const Y=f.x-E.x,X=H-f.h;if(Math.abs(Y)<B&&E.y>X-20){const _=1-Math.abs(Y)/B;D+=Math.sign(Y||1)*_*_*1.1+L.vx*.03*_}}Bs(f,D,h);const W=f.angle,k=f.x+Math.sin(W)*f.h,q=H-Math.cos(W)*f.h*(1-.08*Math.abs(W)),P=f.x+Math.sin(W*.45)*f.h*.5,N=H-Math.cos(W*.45)*f.h*.55,U=S[f.shade];if(U.moveTo(f.x-f.w/2,H),U.quadraticCurveTo(P-f.w*.3,N,k,q),U.quadraticCurveTo(P+f.w*.3,N,f.x+f.w/2,H),U.closePath(),f.flower){const Y=1.6+f.w*.45;R.moveTo(k+Y,q),R.arc(k,q,Y,0,Math.PI*2)}}const v=H-l*M.height,A=.45+.55*$;for(let p=0;p<he;p++){const f=p/(he-1)*.35,b=bt([M.backgroundColor,M.baseColor],A),z=bt([M.backgroundColor,M.tipColor],A*(.65+f)),w=n.createLinearGradient(0,H,0,v);w.addColorStop(0,`rgb(${b[0]|0},${b[1]|0},${b[2]|0})`),w.addColorStop(1,`rgb(${z[0]|0},${z[1]|0},${z[2]|0})`),n.fillStyle=w,n.fill(S[p])}if(M.flowers>0){const p=bt([M.backgroundColor,M.flowerColor],A);n.fillStyle=`rgb(${p[0]|0},${p[1]|0},${p[2]|0})`,n.fill(R)}}}const i=xt({overlay:e.overlay,onResize:a,onFrame:r});return C.current=i.canvas,i}const Os={default:{baseColor:"#14301a",tipColor:"#8fd16a",backgroundColor:"#0a1420",flowerColor:"#fef3c7"},monochrome:{},meadow:{baseColor:"#14301a",tipColor:"#8fd16a",backgroundColor:"#0a1420",flowerColor:"#fef3c7",flowers:.04},dusk:{baseColor:"#1b1433",tipColor:"#a78bfa",backgroundColor:"#0d0a1a",flowerColor:"#fda4af",flowers:.03},wheat:{baseColor:"#4a3512",tipColor:"#f0cf7a",backgroundColor:"#140e06",bladeHeight:.5},frost:{baseColor:"#1e2a38",tipColor:"#e2ecf7",backgroundColor:"#070b10"}},Sn=G.forwardRef((e,d)=>{const{preset:o,density:g,bladeHeight:y,baseColor:t,tipColor:c,backgroundColor:C,flowerColor:a,flowers:r,wind:i,gusts:n,rows:s,interactive:l,overlay:m,zIndex:I,width:M,height:h,className:x,style:E}=e,L=Os[o??"default"]||{},{canvasRef:F,canvas:B}=Ds({density:g??45,height:y??L.bladeHeight??.38,baseColor:t??L.baseColor??"#374151",tipColor:c??L.tipColor??"#ffffff",backgroundColor:C??L.backgroundColor??"#111111",flowerColor:a??L.flowerColor??"#ffffff",flowers:r??L.flowers??0,wind:i??1,gusts:n??1,rows:Math.max(1,Math.round(s??3)),interactive:l??!0,overlay:m??!1});return G.useImperativeHandle(d,()=>B,[B]),ct.jsx(vt,{canvasRef:F,overlay:m,zIndex:I,width:M,height:h,className:x,style:E})});Sn.displayName="GrassField";const Ws=e=>Math.atan2(Math.sin(e),Math.cos(e));function qs(e,d,o,g,y=1,t=.12){const C=Math.atan2(o-e.y,d-e.x)-e.side*e.alpha,a=Ws(C-e.heading),r=t*g;e.heading+=Math.max(-r,Math.min(r,a)),e.x+=Math.cos(e.heading)*e.speed*y*g,e.y+=Math.sin(e.heading)*e.speed*y*g}function Gs(e){const d=G.useRef(e);d.current=e;const o=G.useRef([]),g=G.useRef({w:0,h:0}),y=G.useRef({x:0,y:0}),t=G.useRef(0),c=G.useRef({color:"",img:null}),C=Rt(),a=G.useRef(null);function r(){const{w:l,h:m}=g.current,I=d.current,M=Math.random()*Math.PI*2,h=Math.min(l,m)*(.12+Math.random()*.45);return{x:l*I.lightX+Math.cos(M)*h,y:m*I.lightY+Math.sin(M)*h,heading:Math.random()*Math.PI*2,speed:1.6+Math.random()*1.4,alpha:0,side:Math.random()<.5?1:-1,flap:Math.random()*Math.PI*2,size:.75+Math.random()*.5,escape:0,seed:Math.random()*1e3}}function i(l,m,I,M,h){const x=.35+.65*Math.abs(Math.sin(m.flap));l.save(),l.translate(m.x,m.y),l.rotate(m.heading+Math.PI/2),l.globalAlpha=M,l.fillStyle=I;for(const E of[-1,1])l.beginPath(),l.moveTo(0,-h*.2),l.quadraticCurveTo(E*h*1.6*x,-h*1.1,E*h*1.5*x,h*.1),l.quadraticCurveTo(E*h*.9*x,h*.25,0,h*.15),l.fill(),l.beginPath(),l.moveTo(0,h*.1),l.quadraticCurveTo(E*h*1.05*x,h*.3,E*h*.75*x,h*.95),l.quadraticCurveTo(E*h*.3*x,h*.9,0,h*.55),l.fill();l.beginPath(),l.ellipse(0,h*.2,h*.16,h*.6,0,0,Math.PI*2),l.fill(),l.restore()}function n(l,m,I,M,h){const x=d.current,E=M/16.67;t.current+=M*.001;const L=t.current;h.overlay||(l.fillStyle=x.backgroundColor,l.fillRect(0,0,m,I));const F=kt(C.current,a.current),B=y.current,j=x.followCursor&&F.inside?F.x:m*x.lightX,H=x.followCursor&&F.inside?F.y:I*x.lightY,O=1-Math.pow(.82,E);B.x+=(j-B.x)*O,B.y+=(H-B.y)*O;const T=.92+.05*Math.sin(L*11)+.03*Math.sin(L*23.7);c.current.color!==x.lightColor&&(c.current={color:x.lightColor,img:Pt(x.lightColor,128)});const $=c.current.img;if(x.showLight&&$){const p=l.globalCompositeOperation;l.globalCompositeOperation="lighter";const f=x.glowRadius*T;l.globalAlpha=.55,l.drawImage($,B.x-f*2,B.y-f*2,f*4,f*4),l.globalAlpha=.9,l.drawImage($,B.x-f*.35,B.y-f*.35,f*.7,f*.7),l.globalAlpha=1,l.globalCompositeOperation=p}for(const p of F.taps)for(const f of o.current)Math.hypot(f.x-p.x,f.y-p.y)<220&&(f.escape=500+Math.random()*900,f.heading=Math.atan2(f.y-p.y,f.x-p.x)+(Math.random()-.5));const u=x.count>0?Math.max(1,Math.ceil(x.count*h.quality)):0,S=o.current;for(;S.length<u;)S.push(r());S.length>u&&(S.length=u);const R=x.angle*Math.PI/180,v=Math.hypot(m,I);for(const p of S){p.alpha=R+Math.sin(L*.7+p.seed)*.18,p.flap+=(.55+p.speed*.12)*E;const f=p.speed*x.speed;p.escape>0?(p.escape-=M,p.heading+=(Math.random()-.5)*.3*E,p.x+=Math.cos(p.heading)*f*1.5*E,p.y+=Math.sin(p.heading)*f*1.5*E):(qs(p,B.x,B.y,E,x.speed),p.heading+=(Math.random()-.5)*.35*E,Math.hypot(p.x-B.x,p.y-B.y)<10&&(p.escape=250+Math.random()*700,p.heading+=Math.PI+(Math.random()-.5)*1.2)),Math.hypot(p.x-B.x,p.y-B.y)>v&&Object.assign(p,r())}const A=bt([x.backgroundColor],0);for(const p of S){const f=Math.hypot(p.x-B.x,p.y-B.y),b=Math.max(0,1-f/(x.glowRadius*3)),z=bt([x.color,x.lightColor],b*.6),w=.35+.65*b,D=`rgb(${A[0]+(z[0]-A[0])*w|0},${A[1]+(z[1]-A[1])*w|0},${A[2]+(z[2]-A[2])*w|0})`;i(l,p,D,.55+.45*b,x.size*p.size)}l.globalAlpha=1}const s=xt({overlay:e.overlay,onResize:(l,m)=>{g.current={w:l,h:m};const I=d.current;y.current={x:l*I.lightX,y:m*I.lightY},o.current=Array.from({length:I.count},r)},onFrame:n});return a.current=s.canvas,s}const js={default:{color:"#c8b28f",lightColor:"#ffd27a",backgroundColor:"#0b0805"},monochrome:{},"porch-lamp":{color:"#c8b28f",lightColor:"#ffd27a",backgroundColor:"#0b0805"},moonlight:{color:"#cbd5e1",lightColor:"#dbeafe",backgroundColor:"#04070f",angle:86},candle:{color:"#d6a77a",lightColor:"#ff9a3c",backgroundColor:"#0a0503",angle:76},neon:{color:"#a78bfa",lightColor:"#f0abfc",backgroundColor:"#07020c"}},Pn=G.forwardRef((e,d)=>{const{preset:o,count:g,color:y,lightColor:t,backgroundColor:c,angle:C,speed:a,size:r,glowRadius:i,lightX:n,lightY:s,showLight:l,followCursor:m,overlay:I,zIndex:M,width:h,height:x,className:E,style:L}=e,F=js[o??"default"]||{},{canvasRef:B,canvas:j}=Gs({count:g??26,color:y??F.color??"#9ca3af",lightColor:t??F.lightColor??"#ffffff",backgroundColor:c??F.backgroundColor??"#111111",angle:C??F.angle??80,speed:a??1,size:r??8,glowRadius:i??120,lightX:n??.5,lightY:s??.42,showLight:l??!0,followCursor:m??!0,overlay:I??!1});return G.useImperativeHandle(d,()=>j,[j]),ct.jsx(vt,{canvasRef:B,overlay:I,zIndex:M,width:h,height:x,className:E,style:L})});Pn.displayName="Moths";function Xs(e,d,o,g,y,t){const c=g*Math.PI/180,C=Math.sin(c),a=Math.cos(c),r=Math.cos(c),i=-Math.sin(c),n=e*t,s=e*y-n/2,l=Math.max(1,o),m=n/l,I=m*.14,M=d/Math.max(.2,a)*1.15;return Array.from({length:l},(h,x)=>({ax:s+x*m+I/2,ay:0,dx:C,dy:a,nx:r,ny:i,width:(m-I)*Math.cos(c),length:M,spread:.35}))}function Hs(e,d,o){let g=0;for(const y of o){const t=e-y.ax,c=d-y.ay,C=t*y.dx+c*y.dy;if(C<0||C>y.length)continue;const a=t*y.nx+c*y.ny,r=y.width*(1+y.spread*(C/y.length));if(a<0||a>r)continue;const i=a/r,n=Math.min(1,Math.min(i,1-i)/.18);g+=n*(1-.65*(C/y.length))}return Math.min(1,g)}function Ys(e){const d=G.useRef(e);d.current=e;const o=G.useRef([]),g=G.useRef([]),y=G.useRef(""),t=G.useRef(0),c=G.useRef({color:"",img:null}),C=Rt(),a=G.useRef(Xt()).current,r=G.useRef(null);function i(l,m){return{x:Math.random()*l,y:Math.random()*m,vx:0,vy:0,size:.5+Math.random()*Math.random()*1.6,tw:Math.random()*Math.PI*2,twSpeed:.6+Math.random()*2.2}}function n(l,m,I,M,h){const x=d.current,E=M/16.67;t.current+=M*.001;const L=t.current,F=`${m}|${I}|${x.beams}|${x.angle}|${x.windowX}|${x.windowWidth}`;y.current!==F&&(y.current=F,g.current=Xs(m,I,x.beams,x.angle,x.windowX,x.windowWidth));const B=g.current;h.overlay||(l.fillStyle=x.backgroundColor,l.fillRect(0,0,m,I));const j=(.78+.22*Math.sin(L*.13)*Math.sin(L*.071+1.3))*x.intensity,H=l.globalCompositeOperation;l.globalCompositeOperation="lighter";for(const p of B)for(const[f,b]of[[1,.05],[.78,.06],[.52,.07]]){const z=(1-f)/2,w=p.width,D=p.width*(1+p.spread),W=w*z,k=D*z,q=p.ax+p.dx*p.length,P=p.ay+p.dy*p.length,N=l.createLinearGradient(p.ax,p.ay,q,P);N.addColorStop(0,ut(x.color,b*j)),N.addColorStop(.6,ut(x.color,b*j*.45)),N.addColorStop(1,ut(x.color,0)),l.fillStyle=N,l.beginPath(),l.moveTo(p.ax+p.nx*W,p.ay+p.ny*W),l.lineTo(p.ax+p.nx*(W+w*f),p.ay+p.ny*(W+w*f)),l.lineTo(q+p.nx*(k+D*f),P+p.ny*(k+D*f)),l.lineTo(q+p.nx*k,P+p.ny*k),l.closePath(),l.fill()}const O=Math.max(0,Math.ceil(x.dustCount*h.quality)),T=o.current;for(;T.length<O;)T.push(i(m,I));T.length>O&&(T.length=O);const $=kt(C.current,r.current),u=a($,E),S=x.interactive&&$.inside,R=140;c.current.color!==x.color&&(c.current={color:x.color,img:Pt(x.color,32)});const v=c.current.img,A=1-Math.pow(.97,E);for(const p of T){const f=p.x*.004+L*.09,b=p.y*.005-L*.06,z=-Math.sin(f)*Math.sin(b)*.6,w=-Math.cos(f)*Math.cos(b)*.5-.04;if(p.vx+=(z*x.speed*.35-p.vx)*A+(Math.random()-.5)*.02*E,p.vy+=(w*x.speed*.35-p.vy)*A+(Math.random()-.5)*.02*E,S){const q=p.x-$.x,P=p.y-$.y,N=Math.hypot(q,P);if(N<R){const U=(1-N/R)*(1-N/R);p.vx+=(u.vx*.05-P/(N||1)*Math.hypot(u.vx,u.vy)*.03)*U*E,p.vy+=(u.vy*.05+q/(N||1)*Math.hypot(u.vx,u.vy)*.03)*U*E}}p.x+=p.vx*E,p.y+=p.vy*E,p.x<-5&&(p.x+=m+10),p.x>m+5&&(p.x-=m+10),p.y<-5&&(p.y+=I+10),p.y>I+5&&(p.y-=I+10);const D=Hs(p.x,p.y,B);p.tw+=p.twSpeed*M*.001;const W=D*j*(.55+.45*Math.sin(p.tw))+.03;if(W<.04)continue;const k=x.dustSize*p.size*(1.6+D);v?(l.globalAlpha=Math.min(1,W),l.drawImage(v,p.x-k*2,p.y-k*2,k*4,k*4)):(l.globalAlpha=Math.min(1,W),l.fillStyle=x.color,l.fillRect(p.x-k/2,p.y-k/2,k,k))}l.globalAlpha=1,l.globalCompositeOperation=H}const s=xt({overlay:e.overlay,onResize:(l,m)=>{o.current=Array.from({length:d.current.dustCount},()=>i(l,m))},onFrame:n});return r.current=s.canvas,s}const Ns={default:{color:"#ffcf87",backgroundColor:"#140d07"},monochrome:{},"golden-hour":{color:"#ffcf87",backgroundColor:"#140d07",angle:32,intensity:1.1},chapel:{color:"#fff1d6",backgroundColor:"#0b0a0c",angle:12,beams:3,intensity:1.2},morning:{color:"#e0f2fe",backgroundColor:"#0a1016",angle:22},dusk:{color:"#fda4af",backgroundColor:"#120a12",angle:38,intensity:.9}},En=G.forwardRef((e,d)=>{const{preset:o,color:g,backgroundColor:y,beams:t,angle:c,intensity:C,dustCount:a,dustSize:r,speed:i,windowX:n,windowWidth:s,interactive:l,overlay:m,zIndex:I,width:M,height:h,className:x,style:E}=e,L=Ns[o??"default"]||{},{canvasRef:F,canvas:B}=Ys({color:g??L.color??"#ffffff",backgroundColor:y??L.backgroundColor??"#111111",beams:Math.max(1,Math.round(t??L.beams??4)),angle:Math.max(-60,Math.min(60,c??L.angle??24)),intensity:C??L.intensity??1,dustCount:Math.max(0,a??320),dustSize:r??1,speed:i??1,windowX:n??.35,windowWidth:s??.42,interactive:l??!0,overlay:m??!1});return G.useImperativeHandle(d,()=>B,[B]),ct.jsx(vt,{canvasRef:F,overlay:m,zIndex:I,width:M,height:h,className:x,style:E})});En.displayName="SunbeamDust";function Us(e,d,o){const g=1-Math.pow(.985,o),y=1-Math.pow(.98,o),t=-d.rise*(.35+.65*e.z);e.vy+=(t-e.vy)*g;const c=d.wind*(.4+.6*e.z)+Math.sin(d.t*.45+e.phase)*.28*e.z;e.vx+=(c-e.vx)*y,e.x+=e.vx*o,e.y+=e.vy*o;const C=e.vx*.12+Math.sin(d.t*1.3+e.seed)*.03;e.swayVel+=(-.03*(e.sway-C)-.06*e.swayVel)*o,e.sway+=e.swayVel*o,e.z=Math.max(.18,e.z-12e-5*o)}function _s(e){const d=G.useRef(e);d.current=e;const o=G.useRef([]),g=G.useRef(0),y=G.useRef(0),t=G.useRef({color:"",img:null}),c=Rt(),C=G.useRef(null);function a(s,l,m){return{x:s,y:l,z:m,vx:0,vy:-.1,sway:(Math.random()-.5)*.2,swayVel:0,phase:Math.random()*Math.PI*2,seed:Math.random()*1e3,born:0}}function r(s,l,m,I,M,h){const x=m.size*l.z,E=.82+.1*Math.sin(I*13+l.seed)+.08*Math.sin(I*7.3+l.seed*2.1),L=h*(.35+.65*l.z);if(M){const T=s.globalCompositeOperation;s.globalCompositeOperation="lighter";const $=x*3.2*E;s.globalAlpha=.42*L,s.drawImage(M,l.x-$,l.y-$*.85,$*2,$*2),s.globalCompositeOperation=T}s.save(),s.translate(l.x,l.y),s.rotate(l.sway),s.globalAlpha=L;const F=-x*.7,B=x*.62,j=x*.5,H=x*.4,O=s.createLinearGradient(0,B,0,F);if(O.addColorStop(0,ut(m.glowColor,1)),O.addColorStop(.45,ut(m.color,.95)),O.addColorStop(1,ut(m.color,.7)),s.fillStyle=O,s.beginPath(),s.moveTo(-j,F),s.quadraticCurveTo(0,F-x*.12,j,F),s.quadraticCurveTo(j*1.12,(F+B)/2,H,B),s.quadraticCurveTo(0,B+x*.08,-H,B),s.quadraticCurveTo(-j*1.12,(F+B)/2,-j,F),s.fill(),x>9){s.strokeStyle=ut(m.color,.35),s.lineWidth=Math.max(.5,x*.03),s.beginPath();for(const T of[-.5,0,.5])s.moveTo(j*T,F),s.lineTo(H*T,B);s.stroke(),s.fillStyle=ut(m.glowColor,.9*E),s.beginPath(),s.ellipse(0,B,H*.85,x*.07,0,0,Math.PI*2),s.fill()}s.restore()}function i(s,l,m,I,M){const h=d.current,x=I/16.67;g.current+=I*.001;const E=g.current;M.overlay||(s.fillStyle=h.backgroundColor,s.fillRect(0,0,l,m)),t.current.color!==h.glowColor&&(t.current={color:h.glowColor,img:Pt(h.glowColor,96)});const L=t.current.img,F=o.current,B=Math.max(0,Math.ceil(h.count*M.quality));if(h.autoRelease&&B>0){for(y.current+=I*.001*B/14;y.current>=1;)if(y.current-=1,F.length<B){const T=.3+Math.pow(Math.random(),1.8)*.7;F.push(a(Math.random()*l,m+h.size*2,T))}}const j=kt(c.current,C.current);if(h.interactive)for(const T of j.taps){const $=M.solids.find(S=>T.x>=S.x&&T.x<=S.x+S.w&&T.y>=S.y&&T.y<=S.y+S.h),u=$?a($.x+$.w/2,$.y-h.size*.4,1):a(T.x,T.y,1);u.vy=-.6,F.push(u)}const H={t:E,wind:h.wind,rise:h.riseSpeed};let O=0;for(const T of F){Us(T,H,x),T.born=Math.min(1,T.born+I/900);const $=h.size*3;T.y<-$||T.x<-$*3||T.x>l+$*3||(F[O++]=T)}F.length=O,F.sort((T,$)=>T.z-$.z);for(const T of F){const $=Math.min(1,(T.y+h.size*3)/(m*.25));r(s,T,h,E,L,T.born*Math.max(0,$))}s.globalAlpha=1}const n=xt({overlay:e.overlay,collide:e.collide,onResize:(s,l)=>{const m=d.current;o.current=m.autoRelease?Array.from({length:Math.ceil(m.count*.6)},()=>{const I=a(Math.random()*s,l*(.2+Math.random()*.8),.3+Math.pow(Math.random(),1.8)*.7);return I.born=1,I.vy=-m.riseSpeed*(.35+.65*I.z),I}):[]},onFrame:i});return C.current=n.canvas,n}const Vs={default:{color:"#ff8a3d",glowColor:"#ffd27a",backgroundColor:"#0b0612"},monochrome:{},festival:{color:"#ff8a3d",glowColor:"#ffd27a",backgroundColor:"#0b0612"},lotus:{color:"#ff9eb5",glowColor:"#ffe1a8",backgroundColor:"#0a0710"},moon:{color:"#f3e8d0",glowColor:"#fff3c4",backgroundColor:"#070b16"},jade:{color:"#7ee0b0",glowColor:"#e6ffb3",backgroundColor:"#04110c"}},An=G.forwardRef((e,d)=>{const{preset:o,count:g,color:y,glowColor:t,backgroundColor:c,size:C,riseSpeed:a,wind:r,autoRelease:i,interactive:n,overlay:s,collide:l,zIndex:m,width:I,height:M,className:h,style:x}=e,E=Vs[o??"default"]||{},{canvasRef:L,canvas:F}=_s({count:Math.max(0,g??22),color:y??E.color??"#d1d5db",glowColor:t??E.glowColor??"#ffffff",backgroundColor:c??E.backgroundColor??"#111111",size:C??34,riseSpeed:a??1,wind:r??.3,autoRelease:i??!0,interactive:n??!0,overlay:s??!1,collide:l??!1});return G.useImperativeHandle(d,()=>F,[F]),ct.jsx(vt,{canvasRef:L,overlay:s,zIndex:m,width:I,height:M,className:h,style:x})});An.displayName="PaperLanterns";function Ks(e,d,o,g){const y={x:new Float32Array(o),y:new Float32Array(o),vx:new Float32Array(o),vy:new Float32Array(o),seg:g};for(let t=0;t<o;t++)y.x[t]=e,y.y[t]=d-t*g;return y}function Js(e,d,o,g=4,y=.94){const t=e.x.length,c=new Float32Array(t),C=new Float32Array(t),a=Math.pow(y,o);for(let r=1;r<t;r++){const[i,n]=d(r);e.vx[r]=(e.vx[r]+i*o)*a,e.vy[r]=(e.vy[r]+n*o)*a,c[r]=e.x[r],C[r]=e.y[r],e.x[r]+=e.vx[r]*o,e.y[r]+=e.vy[r]*o}for(let r=0;r<g;r++)for(let i=1;i<t;i++){const n=e.x[i]-e.x[i-1],s=e.y[i]-e.y[i-1],l=Math.hypot(n,s)||1e-6,m=(l-e.seg)/l;i===1?(e.x[i]-=n*m,e.y[i]-=s*m):(e.x[i]-=n*m*.5,e.y[i]-=s*m*.5,e.x[i-1]+=n*m*.5,e.y[i-1]+=s*m*.5)}for(let r=1;r<t;r++)e.vx[r]=(e.x[r]-c[r])/o,e.vy[r]=(e.y[r]-C[r])/o}const Qs=e=>`rgb(${e[0]|0},${e[1]|0},${e[2]|0})`;function Zs(e){const d=G.useRef(e);d.current=e;const o=G.useRef([]),g=G.useRef([]),y=G.useRef([]),t=G.useRef(0),c=G.useRef(""),C=Rt(),a=G.useRef(Xt()).current,r=G.useRef(null);function i(l,m){const I=d.current;c.current=`${I.kelpCount}|${I.fishCount}`,o.current=Array.from({length:I.kelpCount},(M,h)=>{const x=.45+Math.random()*.55,E=m*(.55+Math.random()*.4)*(.7+.3*x),L=16,F=(h+.5)/I.kelpCount*l+(Math.random()-.5)*(l/I.kelpCount)*.8;return{chain:Ks(F,m+6,L,E/(L-1)),z:x,phase:Math.random()*10,frond:12+Math.random()*8}}).sort((M,h)=>M.z-h.z),g.current=Array.from({length:I.fishCount},(M,h)=>({x:Math.random()*l,y:m*(.2+Math.random()*.5),vx:(Math.random()-.5)*2,vy:(Math.random()-.5)*.5,size:5+Math.random()*4,school:h%2,tail:Math.random()*6})),y.current=[]}function n(l,m,I,M,h){const x=d.current,E=M/16.67;t.current+=M*.001;const L=t.current;if(c.current!==`${x.kelpCount}|${x.fishCount}`&&i(m,I),!h.overlay){l.fillStyle=x.backgroundColor,l.fillRect(0,0,m,I);const S=l.createLinearGradient(0,0,0,I);S.addColorStop(0,"rgba(255,255,255,0.07)"),S.addColorStop(.45,"rgba(255,255,255,0)"),S.addColorStop(1,"rgba(0,0,0,0.38)"),l.fillStyle=S,l.fillRect(0,0,m,I)}if(x.lightRays){const S=l.globalCompositeOperation;l.globalCompositeOperation="lighter";for(let R=0;R<5;R++){const v=m*(.1+R*.2)+Math.sin(L*.17+R*1.9)*m*.05,A=m*.12,p=14+R*9,f=l.createLinearGradient(0,0,0,I*.85),b=.035+.02*Math.sin(L*.4+R*2.3);f.addColorStop(0,`rgba(255,255,255,${b})`),f.addColorStop(1,"rgba(255,255,255,0)"),l.fillStyle=f,l.beginPath(),l.moveTo(v-p,0),l.lineTo(v+p,0),l.lineTo(v+A+p*3.2,I*.85),l.lineTo(v+A-p*3.2,I*.85),l.closePath(),l.fill()}l.globalCompositeOperation=S}const F=kt(C.current,r.current),B=a(F,E),j=x.interactive&&F.inside,H=120,O=(S,R,v)=>{if(!j)return[0,0];const A=Math.hypot(S-F.x,R-F.y);if(A>H)return[0,0];const p=(1-A/H)*v;return[B.vx*p,B.vy*p]},T=bt([x.backgroundColor],0);for(const S of o.current){const R=S.chain,v=R.x.length;Js(R,w=>{const D=w/(v-1),W=Math.sin(L*.55+S.phase+w*.22)+.35,[k,q]=O(R.x[w],R.y[w],.06);return[x.current*.016*W*D+k,-.045+q]},E);const A=bt([x.kelpColor],0),p=.35+.65*S.z,f=Qs([T[0]+(A[0]-T[0])*p,T[1]+(A[1]-T[1])*p,T[2]+(A[2]-T[2])*p]),b=new Path2D;for(let w=2;w<v;w++){const D=Math.atan2(R.y[w]-R.y[w-1],R.x[w]-R.x[w-1]),W=w%2?1:-1,k=D+W*(.75+.25*Math.sin(L*1.6+w+S.phase)),q=S.frond*S.z*(1-w/v*.35),P=q*.28,N=R.x[w]+Math.cos(k)*q,U=R.y[w]+Math.sin(k)*q,Y=R.x[w]+Math.cos(k)*q*.5,X=R.y[w]+Math.sin(k)*q*.5,_=-Math.sin(k)*P,V=Math.cos(k)*P;b.moveTo(R.x[w],R.y[w]),b.quadraticCurveTo(Y+_,X+V,N,U),b.quadraticCurveTo(Y-_,X-V,R.x[w],R.y[w])}l.fillStyle=f,l.globalAlpha=.9,l.fill(b),l.globalAlpha=1,l.strokeStyle=f,l.lineCap="round",l.lineJoin="round";const z=[0,Math.floor(v/3),Math.floor(2*v/3),v-1];for(let w=0;w<3;w++){l.lineWidth=(3.4-w*1)*S.z,l.beginPath(),l.moveTo(R.x[z[w]],R.y[z[w]]);for(let D=z[w]+1;D<=z[w+1];D++)l.lineTo(R.x[D],R.y[D]);l.stroke()}l.fillStyle=f,l.beginPath(),l.arc(R.x[v-1],R.y[v-1],2.6*S.z,0,Math.PI*2),l.fill()}const $=g.current,u=[[0,0,0],[0,0,0]];for(const S of $)u[S.school][0]+=S.x,u[S.school][1]+=S.y,u[S.school][2]++;for(let S=0;S<2;S++){const R=m*(.5+.38*Math.sin(L*.07+S*2.5)),v=I*(.42+.18*Math.sin(L*.11+S*1.3)),A=u[S][2]||1;for(const p of $){if(p.school!==S)continue;let f=(u[S][0]/A-p.x)*4e-4+(R-p.x)*12e-5,b=(u[S][1]/A-p.y)*4e-4+(v-p.y)*12e-5;for(const W of $){if(W===p)continue;const k=p.x-W.x,q=p.y-W.y,P=k*k+q*q;P<196&&P>0?(f+=k/P*.4,b+=q/P*.4):W.school===S&&P<3600&&(f+=(W.vx-p.vx)*.004,b+=(W.vy-p.vy)*.004)}let z=2.2;if(j){const W=p.x-F.x,k=p.y-F.y,q=Math.hypot(W,k);if(q<130){const P=(1-q/130)*(.25+Math.hypot(B.vx,B.vy)*.03);f+=W/(q||1)*P,b+=k/(q||1)*P,z=5}}p.y<I*.08&&(b+=.05),p.y>I*.85&&(b-=.05),p.vx+=f*E,p.vy+=b*E;const w=Math.hypot(p.vx,p.vy),D=Math.max(.7,Math.min(z,w));p.vx=p.vx/(w||1)*D,p.vy=p.vy/(w||1)*D*.8,p.x+=p.vx*E,p.y+=p.vy*E,p.x<-30&&(p.x=m+30),p.x>m+30&&(p.x=-30),p.tail+=(.25+w*.12)*E}}l.fillStyle=x.fishColor;for(const S of $){l.save(),l.translate(S.x,S.y),l.rotate(Math.atan2(S.vy,S.vx)),l.globalAlpha=.9;const R=S.size;l.beginPath(),l.ellipse(0,0,R,R*.38,0,0,Math.PI*2),l.fill();const v=Math.sin(S.tail)*.4;l.beginPath(),l.moveTo(-R*.8,0),l.lineTo(-R*1.55,-R*.45+v*R*.5),l.lineTo(-R*1.55,R*.45+v*R*.5),l.closePath(),l.fill(),l.restore()}if(l.globalAlpha=1,x.bubbles){const S=y.current;if(Math.random()<.025*E*h.quality&&o.current.length){const v=o.current[Math.random()*o.current.length|0];S.push({x:v.chain.x[2],y:v.chain.y[2],r:1.2+Math.random()*2.6,seed:Math.random()*10})}l.strokeStyle=ut(x.fishColor,.45),l.lineWidth=.8;let R=0;for(const v of S){const[A,p]=O(v.x,v.y,.08);v.x+=(Math.sin(L*3+v.seed)*.35+A)*E,v.y+=(-.55-v.r*.12+p)*E,v.r+=.002*E,!(v.y<-8)&&(S[R++]=v,l.beginPath(),l.arc(v.x,v.y,v.r,0,Math.PI*2),l.stroke())}S.length=R}}const s=xt({overlay:e.overlay,onResize:i,onFrame:n});return r.current=s.canvas,s}const tl={default:{kelpColor:"#8a7a2c",fishColor:"#e2e8f0",backgroundColor:"#052637"},monochrome:{},pacific:{kelpColor:"#8a7a2c",fishColor:"#e2e8f0",backgroundColor:"#052637"},tropical:{kelpColor:"#2fa36b",fishColor:"#ffb36b",backgroundColor:"#04354a"},midnight:{kelpColor:"#2b5a6b",fishColor:"#9be7ff",backgroundColor:"#020a14",current:.7},golden:{kelpColor:"#b8902e",fishColor:"#fff1c1",backgroundColor:"#141006"}},In=G.forwardRef((e,d)=>{const{preset:o,kelpCount:g,fishCount:y,kelpColor:t,fishColor:c,backgroundColor:C,current:a,bubbles:r,lightRays:i,interactive:n,overlay:s,zIndex:l,width:m,height:I,className:M,style:h}=e,x=tl[o??"default"]||{},{canvasRef:E,canvas:L}=Zs({kelpCount:Math.max(0,Math.round(g??9)),fishCount:Math.max(0,Math.round(y??16)),kelpColor:t??x.kelpColor??"#6b7280",fishColor:c??x.fishColor??"#ffffff",backgroundColor:C??x.backgroundColor??"#111111",current:a??x.current??1,bubbles:r??!0,lightRays:i??!0,interactive:n??!0,overlay:s??!1});return G.useImperativeHandle(d,()=>L,[L]),ct.jsx(vt,{canvasRef:E,overlay:s,zIndex:l,width:m,height:I,className:M,style:h})});In.displayName="KelpForest";const bo=3;function el(e,d,o,g=2){const y=e.h,t=y.length,c=d*e.cell;let C=0,a=0;for(let r=0;r<g;r++){for(let i=0;i<t-1;i++){const n=y[i]-y[i+1];if(n>c){const s=(n-c)/2;y[i]-=s,y[i+1]+=s}else if(n<-c){const s=(-n-c)/2;y[i]+=s,y[i+1]-=s}}o&&t>0&&(y[0]>c&&(C+=y[0]-c,y[0]=c),y[t-1]>c&&(a+=y[t-1]-c,y[t-1]=c))}return[C,a]}function Co(e){return{h:new Float32Array(Math.max(1,Math.ceil(e/bo))),cell:bo,width:e}}function ol(e){const d=G.useRef(e);d.current=e;const o=G.useRef([]),g=G.useRef(new Map),y=G.useRef({w:0,h:0}),t=G.useRef(0),c=Rt(),C=G.useRef(Xt()).current,a=G.useRef(null);function r(m){const{w:I,h:M}=y.current,h=d.current,x=.45+Math.random()*.55;return{x:Math.random()*(I+100)-50,y:m?-10-Math.random()*40:Math.random()*M,vx:0,vy:h.fallSpeed*x,size:h.flakeSize*x*(.6+Math.random()*.6),depth:x,phase:Math.random()*Math.PI*2,load:0}}function i(m,I,M,h){const x=Math.max(0,Math.min(m.h.length-1,Math.floor(I/m.cell)));m.h[x]=Math.min(h,m.h[x]+M)}function n(m,I,M,h,x,E){const L=I.h,F=L.length;let B=!1;for(let O=0;O<F;O++)if(L[O]>.4){B=!0;break}if(!B)return;m.beginPath(),m.moveTo(M,h);let j=M,H=h-L[0];m.lineTo(j,H);for(let O=1;O<F;O++){const T=M+O*I.cell+I.cell/2,$=h-L[O];m.quadraticCurveTo(j,H,(j+T)/2,(H+$)/2),j=T,H=$}m.lineTo(M+I.width,h-L[F-1]),m.lineTo(M+I.width,h),m.closePath(),m.fillStyle=x,m.fill(),m.strokeStyle=E,m.lineWidth=1,m.stroke()}function s(m,I,M,h,x){const E=d.current,L=h/16.67;t.current+=h*.001;const F=t.current,B=g.current;x.overlay||(m.fillStyle=E.backgroundColor,m.fillRect(0,0,I,M));const j=B.get(-1);(!j||Math.abs(j.width-I)>1)&&B.set(-1,Co(I));const H=x.solids,O=new Map(H.map(k=>[k.id,k]));for(const k of H){if(k.w<12)continue;const q=B.get(k.id);(!q||Math.abs(q.width-k.w)>2)&&B.set(k.id,Co(k.w))}for(const k of B.keys())k!==-1&&!O.has(k)&&B.delete(k);const T=o.current;for(const[k,q]of B){const[P,N]=el(q,E.slope,k!==-1),U=O.get(k);if(U)for(const[Y,X]of[[P,-1],[N,1]])Y<.05||T.push({x:X<0?U.x-2:U.x+U.w+2,y:U.y-2,vx:X*(.3+Math.random()*.4),vy:.5,size:Math.min(6,1.5+Y*1.5),depth:1,phase:0,load:Y})}const $=kt(c.current,a.current),u=C($,L),S=Math.hypot(u.vx,u.vy);if(E.interactive&&$.inside&&S>1.2)for(const[k,q]of B){const P=k===-1?null:O.get(k),N=P?P.x:0,U=P?P.y:M,Y=Math.floor(($.x-N)/q.cell);for(let X=Y-5;X<=Y+5;X++){if(X<0||X>=q.h.length||q.h[X]<.5)continue;const _=U-q.h[X];if($.y<_-12||$.y>U+4)continue;const V=Math.min(q.h[X],(.25+S*.06)*L);q.h[X]-=V,Math.random()<V*.6&&T.length<2e3&&T.push({x:N+X*q.cell,y:_,vx:u.vx*.35+(Math.random()-.5),vy:u.vy*.35-1-Math.random(),size:1+Math.random()*1.6,depth:1,phase:Math.random()*6,load:V})}}const R=Math.ceil(E.count*x.quality);let v=0;for(const k of T)k.load===0&&v++;for(let k=v;k<R;k++)T.push(r(!0));const A=1-Math.pow(.96,L),p=B.get(-1),f=[new Path2D,new Path2D,new Path2D];let b=0,z=0;for(const k of T){const q=k.y,P=k.load>0,N=Math.sin(F*1.3+k.phase)*.35*k.depth,U=(E.wind*k.depth+N)*(P?.3:1),Y=E.fallSpeed*(P?2.2:.55+k.depth*.6);k.vx+=(U-k.vx)*(P?A*.4:A),k.vy+=(Y-k.vy)*(P?A*.5:A),k.x+=k.vx*L,k.y+=k.vy*L;let X=!1;if(k.vy>0){for(const V of H){if(k.x<V.x||k.x>V.x+V.w)continue;const Q=B.get(V.id);if(!Q)continue;const ot=Math.min(Q.h.length-1,Math.floor((k.x-V.x)/Q.cell)),tt=V.y-Q.h[ot];if(q<=tt&&k.y>=tt){i(Q,k.x-V.x,P?k.load:k.size*.5,E.maxDepth),X=!0;break}}if(!X){const V=Math.max(0,Math.min(p.h.length-1,Math.floor(k.x/p.cell)));k.y>=M-p.h[V]&&(k.x>=0&&k.x<=I&&i(p,k.x,P?k.load:k.size*.35,E.floorDepth),X=!0)}}if(X||k.y>M+20||k.x<-80||k.x>I+80){if(P||z>=R)continue;Object.assign(k,r(!0))}T[b++]=k,P||z++;const _=k.depth<.65?0:k.depth<.85?1:2;f[_].moveTo(k.x+k.size,k.y),f[_].arc(k.x,k.y,k.size,0,Math.PI*2)}T.length=b,m.fillStyle=E.color;const w=[.45,.7,.95];for(let k=0;k<3;k++)m.globalAlpha=w[k],m.fill(f[k]);m.globalAlpha=1;const D=bt([E.color,E.backgroundColor],.28),W=`rgb(${D[0]|0},${D[1]|0},${D[2]|0})`;for(const[k,q]of B){const P=k===-1?null:O.get(k);if(k!==-1&&!P)continue;const N=P?P.x:0,U=P?P.y:M,Y=k===-1?E.floorDepth:E.maxDepth,X=m.createLinearGradient(0,U-Y,0,U);X.addColorStop(0,E.color),X.addColorStop(1,W),n(m,q,N,U,X,E.color)}}const l=xt({overlay:e.overlay,collide:e.collide,onResize:(m,I)=>{y.current={w:m,h:I},g.current.delete(-1),o.current=Array.from({length:d.current.count},()=>r(!1))},onFrame:s});return a.current=l.canvas,l}const nl={default:{color:"#f8fafc",backgroundColor:"#0b1220"},monochrome:{},"winter-night":{color:"#f8fafc",backgroundColor:"#0b1220"},blizzard:{color:"#e2e8f0",backgroundColor:"#1e293b",wind:1.8},nordic:{color:"#ffffff",backgroundColor:"#10141c",maxDepth:34},dusk:{color:"#fde2e4",backgroundColor:"#1a1020",wind:-.3}},$n=G.forwardRef((e,d)=>{const{preset:o,count:g,color:y,backgroundColor:t,flakeSize:c,wind:C,fallSpeed:a,maxDepth:r,floorDepth:i,slope:n,interactive:s,overlay:l,collide:m,zIndex:I,width:M,height:h,className:x,style:E}=e,L=nl[o??"default"]||{},{canvasRef:F,canvas:B}=ol({count:Math.max(0,Math.round(g??220)),color:y??L.color??"#ffffff",backgroundColor:t??L.backgroundColor??"#111111",flakeSize:c??2.2,wind:C??L.wind??.4,fallSpeed:a??1,maxDepth:r??L.maxDepth??26,floorDepth:i??60,slope:n??.7,interactive:s??!0,overlay:l??!1,collide:m??!1});return G.useImperativeHandle(d,()=>B,[B]),ct.jsx(vt,{canvasRef:F,overlay:l,zIndex:I,width:M,height:h,className:x,style:E})});$n.displayName="SnowDrift";const De=2.4,rl=Math.PI/3;function al(e,d,o=3){const g=Math.max(1,Math.ceil(e/o)),y=Math.max(1,Math.ceil(d/o));return{cols:g,rows:y,cell:o,cells:new Uint8Array(g*y)}}function sl(e,d,o,g){if(e.left<=0)return null;e.angle+=(Math.random()-.5)*.09;const y=e.angle+(Math.random()-.5)*.18,t=e.x+Math.cos(y)*De,c=e.y+Math.sin(y)*De,C=Math.floor(t/d.cell),a=Math.floor(c/d.cell);if(C<0||a<0||C>=d.cols||a>=d.rows)return e.left=0,null;const r=a*d.cols+C,i=Math.floor(e.x/d.cell)===C&&Math.floor(e.y/d.cell)===a;if(d.cells[r]&&!i)return e.left=0,null;d.cells[r]=1;const n=[e.x,e.y,t,c];if(e.x=t,e.y=c,e.left-=De,e.gen<4&&Math.random()<o){const s=Math.random()<.5?-1:1;g({x:t,y:c,angle:e.angle+s*(rl+(Math.random()-.5)*.25),left:e.left*(.2+Math.random()*.3),width:e.width*.72,gen:e.gen+1})}return n}function ll(e){const d=G.useRef(e);d.current=e;const o=G.useRef(null),g=Rt(),y=G.useRef(null);function t(i,n){var E,L,F;const s=y.current&&i>0?y.current.width/i:1,l=typeof document<"u"?document.createElement("canvas"):null;let m=null;l&&(l.width=Math.round(i*s),l.height=Math.round(n*s),m=l.getContext("2d"),(E=m==null?void 0:m.setTransform)==null||E.call(m,s,0,0,s,0,0));const I=Math.max(1,Math.ceil(i/10)),M=Math.max(1,Math.ceil(n/10)),h=l?document.createElement("canvas"):null;h&&(h.width=I,h.height=M);const x=((F=(L=h==null?void 0:h.getContext("2d"))==null?void 0:L.createImageData)==null?void 0:F.call(L,I,M))??null;o.current={grid:al(i,n),tips:[],frost:l,fctx:m,fog:new Float32Array(I*M).fill(1),fogW:I,fogH:M,fogImg:x,fogCanvas:h,frosted:0,acc:0,seededSolids:new Set}}function c(i,n){const s=Math.random()*4|0,l=Math.random(),m=s===0?l*i:s===1?i-1:s===2?l*i:1,I=s===0?1:s===1?l*n:s===2?n-1:l*n,M=s===0?Math.PI/2:s===1?Math.PI:s===2?-Math.PI/2:0;return{x:m,y:I,angle:M+(Math.random()-.5)*1.1,left:40+Math.random()*Math.min(i,n)*.3,width:1.1+Math.random()*.5,gen:0}}function C(i,n){return Array.from({length:n},()=>{const s=2*(i.w+i.h);let l=Math.random()*s,m,I,M;return l<i.w?(m=i.x+l,I=i.y-1,M=-Math.PI/2):(l-=i.w)<i.h?(m=i.x+i.w+1,I=i.y+l,M=0):(l-=i.h)<i.w?(m=i.x+i.w-l,I=i.y+i.h+1,M=Math.PI/2):(l-=i.w,m=i.x-1,I=i.y+i.h-l,M=Math.PI),{x:m,y:I,angle:M+(Math.random()-.5)*1.2,left:40+Math.random()*90,width:1.2+Math.random()*.6,gen:0}})}function a(i,n,s,l,m){var O;const I=d.current,M=l/16.67;o.current||t(n,s);const h=o.current,x=h.grid,E=x.cols*x.rows;m.overlay||(i.fillStyle=I.backgroundColor,i.fillRect(0,0,n,s));const L=Math.ceil(90*m.quality);for(const T of m.solids)h.seededSolids.has(T.id)||T.w<10||(h.seededSolids.add(T.id),h.tips.push(...C(T,Math.ceil((T.w+T.h)/40))));const F=h.frosted/E;if(F<I.coverage&&h.tips.length<L&&Math.random()<.25*M&&h.tips.push(c(n,s)),F<I.coverage&&h.tips.length<L)for(let T=0;T<6;T++){const $=Math.random()*E|0;if(!x.cells[$])continue;const u=$%x.cols,S=$/x.cols|0,R=Math.random()*Math.PI*2,v=Math.floor(u+Math.cos(R)*2),A=Math.floor(S+Math.sin(R)*2);if(!(v<0||A<0||v>=x.cols||A>=x.rows||x.cells[A*x.cols+v])){h.tips.push({x:(u+.5)*x.cell,y:(S+.5)*x.cell,angle:R,left:15+Math.random()*45,width:.9,gen:1});break}}h.acc+=l*.001*30*I.growthSpeed;const B=Math.min(4,Math.floor(h.acc));h.acc-=B;const j=h.fctx;j&&(j.lineCap="round",j.strokeStyle=I.color);for(let T=0;T<B;T++){const $=[];for(const u of h.tips){const S=sl(u,x,I.branching,R=>$.push(R));if(S&&(h.frosted++,j)){if(j.globalAlpha=(.35+.5*Math.min(1,u.width))*(1-u.gen*.12),j.lineWidth=u.width,j.beginPath(),j.moveTo(S[0],S[1]),j.lineTo(S[2],S[3]),Math.random()<.6){const R=Math.atan2(S[3]-S[1],S[2]-S[0]),v=(2+Math.random()*5)*(1-u.gen*.15);for(const A of[-1,1]){if(Math.random()<.3)continue;const p=R+A*Math.PI/3;j.moveTo(S[2],S[3]),j.lineTo(S[2]+Math.cos(p)*v,S[3]+Math.sin(p)*v)}}j.stroke()}}h.tips=h.tips.filter(u=>u.left>0).concat($),h.tips.length>L*3&&(h.tips.length=L*3)}const H=kt(g.current,y.current);if(I.interactive&&H.inside){const T=I.breathRadius,$=Math.floor((H.x-T)/x.cell),u=Math.floor((H.x+T)/x.cell),S=Math.floor((H.y-T)/x.cell),R=Math.floor((H.y+T)/x.cell);for(let f=Math.max(0,S);f<=Math.min(x.rows-1,R);f++)for(let b=Math.max(0,$);b<=Math.min(x.cols-1,u);b++){const z=(b+.5)*x.cell-H.x,w=(f+.5)*x.cell-H.y;if(z*z+w*w>T*T)continue;const D=f*x.cols+b;x.cells[D]&&(x.cells[D]=0,h.frosted--)}if(h.tips=h.tips.filter(f=>Math.hypot(f.x-H.x,f.y-H.y)>T),j){j.save(),j.globalCompositeOperation="destination-out",j.globalAlpha=1;const f=j.createRadialGradient(H.x,H.y,T*.55,H.x,H.y,T);f.addColorStop(0,"rgba(0,0,0,1)"),f.addColorStop(1,"rgba(0,0,0,0)"),j.fillStyle=f,j.beginPath(),j.arc(H.x,H.y,T,0,Math.PI*2),j.fill(),j.restore()}const v=T*1.25/10,A=H.x/10,p=H.y/10;for(let f=Math.max(0,Math.floor(p-v));f<=Math.min(h.fogH-1,Math.ceil(p+v));f++)for(let b=Math.max(0,Math.floor(A-v));b<=Math.min(h.fogW-1,Math.ceil(A+v));b++){const z=Math.hypot(b-A,f-p)/v;z<1&&(h.fog[f*h.fogW+b]=Math.min(h.fog[f*h.fogW+b],z*z))}}if(I.fog>0&&h.fogImg&&h.fogCanvas){const T=1-Math.pow(.996,M),[$,u,S]=bt([I.fogColor],0),R=h.fogImg.data;for(let v=0;v<h.fog.length;v++){h.fog[v]+=(1-h.fog[v])*T;const A=v*4;R[A]=$,R[A+1]=u,R[A+2]=S,R[A+3]=h.fog[v]*I.fog*255}(O=h.fogCanvas.getContext("2d"))==null||O.putImageData(h.fogImg,0,0),i.imageSmoothingEnabled=!0,i.drawImage(h.fogCanvas,0,0,n,s)}else I.fog>0&&(i.fillStyle=ut(I.fogColor,I.fog),i.fillRect(0,0,n,s));h.frost&&i.drawImage(h.frost,0,0,n,s)}const r=xt({overlay:e.overlay,collide:e.collide,onResize:()=>{o.current=null},onFrame:a});return y.current=r.canvas,r}const il={default:{color:"#e0f2fe",fogColor:"#cbd5e1",backgroundColor:"#0b1220"},monochrome:{},"winter-window":{color:"#e0f2fe",fogColor:"#cbd5e1",backgroundColor:"#0b1220"},"ice-blue":{color:"#a5f3fc",fogColor:"#bae6fd",backgroundColor:"#031018",fog:.1},silver:{color:"#f1f5f9",fogColor:"#e2e8f0",backgroundColor:"#18181b"},rose:{color:"#ffe4e6",fogColor:"#fecdd3",backgroundColor:"#1a0b10"}},Tn=G.forwardRef((e,d)=>{const{preset:o,color:g,fogColor:y,backgroundColor:t,coverage:c,growthSpeed:C,branching:a,breathRadius:r,fog:i,interactive:n,overlay:s,collide:l,zIndex:m,width:I,height:M,className:h,style:x}=e,E=il[o??"default"]||{},{canvasRef:L,canvas:F}=ll({color:g??E.color??"#ffffff",fogColor:y??E.fogColor??"#ffffff",backgroundColor:t??E.backgroundColor??"#111111",coverage:c??.32,growthSpeed:C??1,branching:a??.05,breathRadius:r??46,fog:i??E.fog??.12,interactive:n??!0,overlay:s??!1,collide:l??!1});return G.useImperativeHandle(d,()=>F,[F]),ct.jsx(vt,{canvasRef:L,overlay:s,zIndex:m,width:I,height:M,className:h,style:x})});Tn.displayName="FrostGlass";function cl(e){const d=2+Math.sin(e)*15,o=Math.cos(e)*15,g=t=>[.5,2+Math.sin(e)*5,t*Math.cos(e)*5],y=[[[-7,1,0],[7,1,0],[0,-5,.8]],[[-7,1,0],[7,1,0],[0,-5,-.8]],[[4,-1,.3],[7,1,0],[16,11,0]],[[15,10,0],[16.5,11.5,.3],[20.5,8,0]],[[-4,-1,.3],[-7,1,0],[-17,10,0]]];for(const t of[1,-1]){const c=[-1.5,d,t*o],C=g(t);y.push([[5,2,0],C,c]),y.push([C,[-5,2,0],c])}return y}const Oe=(()=>{const e=[-.35,.8,-.5],d=Math.hypot(...e);return[e[0]/d,e[1]/d,e[2]/d]})();function fl(e,d,o){const g=d[0]-e[0],y=d[1]-e[1],t=d[2]-e[2],c=o[0]-e[0],C=o[1]-e[1],a=o[2]-e[2];let r=y*a-t*C,i=t*c-g*a,n=g*C-y*c;const s=Math.hypot(r,i,n)||1;return r/=s,i/=s,n/=s,.42+.58*Math.abs(r*Oe[0]+i*Oe[1]+n*Oe[2])}const vo=700,dl=.6;function ul(e){const d=G.useRef(e);d.current=e;const o=G.useRef([]),g=G.useRef({w:0,h:0}),y=G.useRef(0),t=Rt(),c=G.useRef(null);function C(n){const{w:s,h:l}=g.current;n.tx=s*(.1+Math.random()*.8),n.ty=l*(.12+Math.random()*.6),n.tz=-150+Math.random()*400}function a(n){const{w:s,h:l}=g.current,m={x:Math.random()*s,y:l*(.15+Math.random()*.6),z:-100+Math.random()*300,vx:(Math.random()<.5?-1:1)*1.5,vy:0,vz:0,flap:Math.random()*Math.PI*2,flapSpeed:.09+Math.random()*.05,bank:0,color:n,tx:0,ty:0,tz:0,perch:null,rest:null,restLeft:0};return C(m),m}function r(n,s,l,m,I){const M=d.current,h=m/16.67;y.current+=m*.001;const x=y.current;I.overlay||(n.fillStyle=M.backgroundColor,n.fillRect(0,0,s,l));const E=M.count>0?Math.max(1,Math.ceil(M.count*I.quality)):0,L=o.current;for(;L.length<E;)L.push(a(L.length));L.length>E&&(L.length=E);const F=kt(t.current,c.current),B=I.solids,j=new Map(B.map(u=>[u.id,u])),H=s/2,O=l/2;for(const u of L){if(u.rest){u.restLeft-=m,(u.restLeft<=0||!ae(u,u.rest,j))&&(u.rest=null,u.vy=-2,u.vx=(Math.random()<.5?-1:1)*1.2,C(u)),u.flap=1.25;continue}let S=u.tx,R=u.ty,v=u.tz;if(u.perch){const k=j.get(u.perch.solidId);if(!k)u.perch=null;else if(S=k.x+u.perch.offsetX,R=k.y-6,v=0,Math.hypot(S-u.x,R-u.y,u.z)<6){u.x=S,u.y=R,u.z=0,u.vx=u.vy=u.vz=0,u.rest=re(u,k,-6),u.restLeft=3e3+Math.random()*4e3,u.perch=null;continue}}else if(M.interactive&&F.inside){const k=x*.6+u.color*1.7;S=F.x+Math.cos(k)*110,R=F.y+Math.sin(k)*50,v=Math.sin(k*.7)*120}else Math.hypot(u.tx-u.x,u.ty-u.y)<60&&C(u);if(!u.perch&&B.length&&Math.random()<.0012*h){const k=B[Math.random()*B.length|0];k.w>30&&k.y>20&&k.y<l&&(u.perch={solidId:k.id,offsetX:12+Math.random()*(k.w-24)})}let A=(S-u.x)*9e-4,p=(R-u.y)*9e-4,f=(v-u.z)*6e-4;for(const k of L){if(k===u||k.rest)continue;const q=u.x-k.x,P=u.y-k.y,N=u.z-k.z,U=q*q+P*P+N*N;U<2500&&U>0&&(A+=q/U*.6,p+=P/U*.6,f+=N/U*.6)}const b=Math.atan2(u.vz,u.vx);u.vx+=A*h,u.vy+=p*h,u.vz+=f*h;const z=Math.hypot(u.vx,u.vy,u.vz)||1,w=(u.perch?1.4:1.9)*M.speed,D=z+(w-z)*.05;u.vx=u.vx/z*D,u.vy=u.vy/z*D,u.vz=u.vz/z*D,u.x+=u.vx*h,u.y+=u.vy*h,u.z+=u.vz*h,u.z=Math.max(-300,Math.min(500,u.z));const W=Math.atan2(Math.sin(Math.atan2(u.vz,u.vx)-b),Math.cos(Math.atan2(u.vz,u.vx)-b));u.bank+=(Math.max(-.7,Math.min(.7,W*12))-u.bank)*.08*h,u.flap+=u.flapSpeed*M.speed*(u.vy>.6?.35:1+Math.max(0,-u.vy)*.3)*h*2}const T=[],$=M.size*1.15;for(const u of L){let S=u.vx,R=u.vy,v=u.vz;u.rest&&(S=1,R=0,v=.3);const A=Math.hypot(S,R,v)||1;S/=A,R/=A,v/=A;let p=v,f=0,b=-S;const z=Math.hypot(p,b)||1;p/=z,b/=z;let w=f*v-b*R,D=b*S-p*v,W=p*R-f*S;const k=u.bank+dl,q=Math.cos(k),P=Math.sin(k),N=p*q+w*P,U=f*q+D*P,Y=b*q+W*P;w=w*q-p*P,D=D*q-f*P,W=W*q-b*P,p=N,f=U,b=Y;const X=u.rest?1.25:Math.sin(u.flap)*.75,_=bt([M.colors[u.color%M.colors.length]??"#ffffff"],0);for(const V of cl(X)){const Q=[];let ot=0;const tt=[];for(const[J,nt,st]of V){const rt=u.x+(S*J+w*nt+p*st)*$,lt=u.y+(R*J+D*nt+f*st)*$,Z=u.z+(v*J+W*nt+b*st)*$;tt.push([rt,-lt,Z]);const et=vo/(vo+Z);Q.push(H+(rt-H)*et,O+(lt-O)*et),ot+=Z}const at=fl(tt[0],tt[1],tt[2]),K=Math.max(.55,Math.min(1,1-u.z/1400));T.push({pts:Q,z:ot/3,fill:`rgb(${_[0]*at*K|0},${_[1]*at*K|0},${_[2]*at*K|0})`})}}T.sort((u,S)=>S.z-u.z),n.lineJoin="round",n.lineWidth=.5;for(const u of T)n.beginPath(),n.moveTo(u.pts[0],u.pts[1]),n.lineTo(u.pts[2],u.pts[3]),n.lineTo(u.pts[4],u.pts[5]),n.closePath(),n.fillStyle=u.fill,n.strokeStyle=u.fill,n.fill(),n.stroke()}const i=xt({overlay:e.overlay,collide:e.collide,onResize:(n,s)=>{g.current={w:n,h:s},o.current=Array.from({length:d.current.count},(l,m)=>a(m))},onFrame:r});return c.current=i.canvas,i}const hl={default:{colors:["#ef4444","#f59e0b","#10b981","#3b82f6","#8b5cf6","#ec4899"],backgroundColor:"#0f0f14"},monochrome:{},senbazuru:{colors:["#ef4444","#f59e0b","#10b981","#3b82f6","#8b5cf6","#ec4899"],backgroundColor:"#0f0f14"},washi:{colors:["#f5e6c8","#e8c39e","#c97b63","#7a9e7e"],backgroundColor:"#1b1814"},"white-paper":{colors:["#ffffff","#f1f5f9"],backgroundColor:"#0b1220"},gold:{colors:["#f5c96a","#e0a94a","#fff1c1"],backgroundColor:"#0e0b06"}},zn=G.forwardRef((e,d)=>{const{preset:o,count:g,colors:y,backgroundColor:t,size:c,speed:C,interactive:a,overlay:r,collide:i,zIndex:n,width:s,height:l,className:m,style:I}=e,M=hl[o??"default"]||{},{canvasRef:h,canvas:x}=ul({count:Math.max(0,Math.round(g??14)),colors:y??M.colors??["#ffffff","#d1d5db","#9ca3af"],backgroundColor:t??M.backgroundColor??"#111111",size:c??1.6,speed:C??1,interactive:a??!0,overlay:r??!1,collide:i??!1});return G.useImperativeHandle(d,()=>x,[x]),ct.jsx(vt,{canvasRef:h,overlay:r,zIndex:n,width:s,height:l,className:m,style:I})});zn.displayName="OrigamiCranes";const ge=8;function gl(e){let d=e>>>0;return()=>(d=d*1664525+1013904223>>>0,d/4294967296)}function ml(e,d){const o=gl(e),g=[],y=[],t=(c,C,a,r,i)=>{const n=g.length;if(g.push({parent:c,rel:C,len:a,width:r,depth:i,phase:o()*Math.PI*2}),i>=ge-4){const l=i>=ge-1?5:i>=ge-3?3:2;for(let m=0;m<l;m++)y.push({branch:n,along:.3+o()*.7,side:o()<.5?-1:1,size:.75+o()*.5,thr:o(),jitter:o()*6|0,attached:!0})}if(i>=ge)return;const s=i<2?2:o()<.35?3:2;for(let l=0;l<s;l++){const m=.22+o()*.24,I=s===2?l===0?-m:m:(l-1)*m*1.1;t(n,I+(o()-.5)*.15,a*(.68+o()*.14),r*.68,i+1)}};return t(-1,0,d,Math.max(4,d*.09),0),{branches:g,leaves:y}}function pl(e){const d=(e%4+4)%4;return d<1?.35+.65*d:d<2?1:d<3?1-(d-2):0}const yl={spring:.35,summer:1.5,autumn:2.45,winter:3.5};function Ml(e){const d=G.useRef(e);d.current=e;const o=G.useRef(null),g=G.useRef([]),y=G.useRef(0),t=G.useRef(.2),c=G.useRef(0),C=G.useRef(""),a=Rt(),r=G.useRef(Xt()).current,i=G.useRef(null);function n(m,I,M){const h=(I%4+4)%4,x=[m.blossomColor,m.leafColor,m.leafColor,m.autumnColor,m.autumnColor],E=Math.min(1,h/3),L=bt(x,Math.min(.999,E+(M-2.5)*.025)),F=.82+M*.04;return`rgb(${L[0]*F|0},${L[1]*F|0},${L[2]*F|0})`}function s(m,I,M,h,x){const E=d.current,L=h/16.67;y.current+=h*.001;const F=y.current,B=`${I}|${M}|${E.treeSize}`;(C.current!==B||!o.current)&&(C.current=B,o.current=ml(7,Math.min(M*.24,I*.3)*E.treeSize));const j=o.current;E.season==="cycle"?t.current=(t.current+h*.001*4/Math.max(4,E.cycleSeconds))%4:t.current+=(yl[E.season]-t.current)*(1-Math.pow(.97,L));const H=t.current,O=pl(H),T=H>3?Math.min(1,(H-3)*3)*Math.min(1,(4-H)*4):0;x.overlay||(m.fillStyle=E.backgroundColor,m.fillRect(0,0,I,M));const $=kt(a.current,i.current),u=r($,L);E.interactive&&$.inside&&(c.current+=u.vx*.004*L),c.current*=Math.pow(.97,L),c.current=Math.max(-1.5,Math.min(1.5,c.current));const S=E.wind*(.6+.4*Math.sin(F*.4))+c.current,R=j.branches.length,v=new Float32Array(R),A=new Float32Array(R),p=new Float32Array(R),f=new Float32Array(R),b=new Float32Array(R),z=I*E.treeX;for(let X=0;X<R;X++){const _=j.branches[X],V=.012*Math.pow(_.depth+1,1.35),Q=(S*.6+Math.sin(F*(1.1+_.depth*.25)+_.phase)*(.25+Math.abs(S)*.35))*V,ot=_.parent<0?-Math.PI/2:b[_.parent];b[X]=ot+_.rel+Q,v[X]=_.parent<0?z:p[_.parent],A[X]=_.parent<0?M+2:f[_.parent],p[X]=v[X]+Math.cos(b[X])*_.len,f[X]=A[X]+Math.sin(b[X])*_.len}const w=new Map;for(let X=0;X<R;X++){const _=Math.max(.6,Math.round(j.branches[X].width*2)/2);let V=w.get(_);V||w.set(_,V=new Path2D),V.moveTo(v[X],A[X]),V.lineTo(p[X],f[X])}m.strokeStyle=E.trunkColor,m.lineCap="round";for(const[X,_]of w)m.lineWidth=X,m.stroke(_);if(T>.02){m.strokeStyle=`rgba(255,255,255,${.85*T})`,m.lineWidth=1.6,m.beginPath();for(let X=0;X<R;X++){if(j.branches[X].width<1.2)continue;const _=Math.sin(b[X])*-j.branches[X].width*.45,V=-Math.abs(Math.cos(b[X]))*j.branches[X].width*.45;m.moveTo(v[X]+_,A[X]+V),m.lineTo(p[X]+_,f[X]+V)}m.stroke()}const D=Array.from({length:6},(X,_)=>n(E,H,_)),W=D.map(()=>new Path2D),k=Math.max(2.5,Math.min(I,M)*.008)*E.treeSize,q=g.current,P=H>=2&&H<3;for(const X of j.leaves){const _=O>X.thr,V=X.branch,Q=v[V]+(p[V]-v[V])*X.along,ot=A[V]+(f[V]-A[V])*X.along,tt=b[V]+X.side*.9+Math.sin(F*2.2+X.thr*20)*.15;if(X.attached&&!_?(X.attached=!1,(P||H<1)&&q.length<400*x.quality&&q.push({x:Q,y:ot,vx:S*.5,vy:.2,angle:tt,spin:(Math.random()-.5)*.1,size:X.size*k,color:D[X.jitter],life:0,rest:null,landed:!1,phase:Math.random()*6})):!X.attached&&_&&(X.attached=!0),!X.attached)continue;const at=X.size*k*(H<1?.55+.45*H:1),K=Q+Math.cos(tt)*at*.8,J=ot+Math.sin(tt)*at*.8;W[X.jitter].moveTo(K+Math.cos(tt)*at,J+Math.sin(tt)*at),W[X.jitter].ellipse(K,J,at,at*.55,tt,0,Math.PI*2)}for(let X=0;X<6;X++)m.fillStyle=D[X],m.fill(W[X]);const N=x.solids,U=new Map(N.map(X=>[X.id,X]));let Y=0;for(const X of q){if(X.landed)X.life+=h,X.rest&&!ae(X,X.rest,U)&&(X.rest=null,X.landed=!1,X.vy=.3);else{const V=X.x,Q=X.y,ot=1-Math.pow(.97,L);if(X.vx+=(S*.9+Math.sin(F*1.6+X.phase)*.8-X.vx)*ot,X.vy+=(.7+Math.sin(F*2.3+X.phase)*.35-X.vy)*ot,X.x+=X.vx*L,X.y+=X.vy*L,X.angle+=X.spin*L+X.vx*.01*L,N.length){const tt=Xe(X,V,Q,N,0);tt&&(X.rest=re(X,tt,-1),X.landed=!0)}!X.landed&&X.y>M-2&&(X.y=M-2,X.landed=!0)}const _=X.landed?Math.max(0,1-X.life/6e3):1;_<=0||X.x<-40||X.x>I+40||(q[Y++]=X,m.globalAlpha=_,m.fillStyle=X.color,m.beginPath(),m.ellipse(X.x,X.y,X.size,X.size*.5*Math.abs(Math.cos(X.angle*2))+.6,X.angle,0,Math.PI*2),m.fill())}q.length=Y,m.globalAlpha=1}const l=xt({overlay:e.overlay,collide:e.collide,onResize:()=>{C.current=""},onFrame:s});return i.current=l.canvas,l}const bl={default:{trunkColor:"#4a362a",leafColor:"#5b8c3e",blossomColor:"#ffb7c5",autumnColor:"#d9622b",backgroundColor:"#0e0c0a"},monochrome:{},japanese:{trunkColor:"#4a362a",leafColor:"#5b8c3e",blossomColor:"#ffb7c5",autumnColor:"#d9622b",backgroundColor:"#0e0c0a"},maple:{trunkColor:"#4a3020",leafColor:"#3f7d3a",blossomColor:"#fde68a",autumnColor:"#c2410c",backgroundColor:"#120a06"},moonlight:{trunkColor:"#64748b",leafColor:"#94a3b8",blossomColor:"#e2e8f0",autumnColor:"#cbd5e1",backgroundColor:"#050810"},ink:{trunkColor:"#1f2937",leafColor:"#374151",blossomColor:"#9ca3af",autumnColor:"#4b5563",backgroundColor:"#f5f1e8"}},Fn=G.forwardRef((e,d)=>{const{preset:o,season:g,cycleSeconds:y,trunkColor:t,leafColor:c,blossomColor:C,autumnColor:a,backgroundColor:r,treeX:i,treeSize:n,wind:s,interactive:l,overlay:m,collide:I,zIndex:M,width:h,height:x,className:E,style:L}=e,F=bl[o??"default"]||{},{canvasRef:B,canvas:j}=Ml({season:g??"cycle",cycleSeconds:y??48,trunkColor:t??F.trunkColor??"#6b7280",leafColor:c??F.leafColor??"#d1d5db",blossomColor:C??F.blossomColor??"#ffffff",autumnColor:a??F.autumnColor??"#9ca3af",backgroundColor:r??F.backgroundColor??"#111111",treeX:i??.5,treeSize:n??1,wind:s??.6,interactive:l??!0,overlay:m??!1,collide:I??!1});return G.useImperativeHandle(d,()=>j,[j]),ct.jsx(vt,{canvasRef:B,overlay:m,zIndex:M,width:h,height:x,className:E,style:L})});Fn.displayName="SeasonsTree";function me(e,d){const o=Ao(e*d.freq,5,d.seed),g=Math.pow(Math.min(1,Math.max(0,(o-.2)/.6)),1.6);return d.base-d.amp*g}function Cl(e,d){const o=Math.max(1,d);return Array.from({length:o},(g,y)=>{const t=o===1?1:y/(o-1);return{base:e*(.5+.42*t),amp:e*(.3-.1*t),freq:.0032+.0035*t,seed:11+y*7,depth:t}})}const _t=e=>`rgb(${e[0]|0},${e[1]|0},${e[2]|0})`;function vl(e){const d=G.useRef(e);d.current=e;const o=G.useRef(0),g=G.useRef({x:0,px:0}),y=G.useRef({color:"",img:null}),t=Rt(),c=G.useRef(null);function C(r,i,n,s,l){const m=d.current,I=s/16.67;o.current+=s*.001;const M=o.current;l.overlay||(r.fillStyle=m.paperColor,r.fillRect(0,0,i,n));const h=kt(t.current,c.current),x=g.current;x.x+=m.drift*.35*I;const E=m.parallax&&h.inside?(h.x/i-.5)*2:0;x.px+=(E-x.px)*(1-Math.pow(.95,I));const L=Cl(n,m.layers),F=bt([m.paperColor],0),B=bt([m.inkColor],0),j=$=>{const u=(.18+.82*Math.pow($,1.25))*.92;return[F[0]+(B[0]-F[0])*u,F[1]+(B[1]-F[1])*u,F[2]+(B[2]-F[2])*u]},H=Math.min(i,n)*.075;r.fillStyle=ut(m.sunColor,.85),r.beginPath(),r.arc(i*.72-x.px*6,n*.24,H,0,Math.PI*2),r.fill(),y.current.color!==m.paperColor&&(y.current={color:m.paperColor,img:Pt(m.paperColor,64)});const O=y.current.img,T=Math.max(3,Math.round(i/260));for(let $=0;$<L.length;$++){const u=L[$],S=x.x*(.15+.85*u.depth)+x.px*40*u.depth,R=j(u.depth),v=u.base-u.amp,A=r.createLinearGradient(0,v,0,u.base+n*.06);A.addColorStop(0,_t(R)),A.addColorStop(.5,_t(R.map((p,f)=>p+(F[f]-p)*.25))),A.addColorStop(1,_t(F)),r.fillStyle=A,r.beginPath(),r.moveTo(0,n);for(let p=0;p<=i+T;p+=T)r.lineTo(p,me(p+S,u));r.lineTo(i,n),r.closePath(),r.fill(),r.strokeStyle=_t(R),r.lineWidth=.8+u.depth*1.2,r.globalAlpha=.55,r.beginPath();for(let p=0;p<=i+T;p+=T){const f=me(p+S,u);p===0?r.moveTo(p,f):r.lineTo(p,f)}if(r.stroke(),u.depth>.3){r.lineWidth=.7,r.globalAlpha=.35*u.depth,r.beginPath();const p=9,f=Math.floor(S/p)*p;for(let b=f;b<S+i;b+=p){const z=Ot(b*.37,u.seed);if(z<.45)continue;const w=b-S,D=me(b,u),W=6+z*18*u.depth;r.moveTo(w,D+2),r.quadraticCurveTo(w-2,D+W*.5,w-4+z*3,D+W)}r.stroke()}if(r.globalAlpha=1,m.pines&&u.depth>.6){r.fillStyle=_t(R);const p=26,f=Math.floor(S/p)*p;for(let b=f;b<S+i+p;b+=p){const z=Ot(b*.11,u.seed+3);if(z<.62)continue;const w=b-S,D=me(b,u),W=(10+z*22)*(.6+u.depth*.6);r.beginPath();for(let k=0;k<4;k++){const q=D-W*(k/4),P=W*.28*(1-k/5);r.moveTo(w-P,q),r.lineTo(w,q-W*.32),r.lineTo(w+P,q)}r.fill(),r.fillRect(w-.6,D-W*.2,1.2,W*.25)}}if(O&&m.mist>0){for(let p=0;p<6;p++){const f=i*(.35+.25*Ot(p*3.1,u.seed)),b=.12+.2*u.depth,z=(p/6*(i+f)+M*12*b+S*.3)%(i+f)-f/2,w=u.base-u.amp*.15+Math.sin(M*.2+p)*6;r.globalAlpha=Math.min(1,.55*m.mist),r.drawImage(O,z-f/2,w-n*.05,f,n*.12)}r.globalAlpha=1}if($===1&&m.birds>0){r.strokeStyle=_t(j(.85)),r.lineWidth=1.1,r.beginPath();for(let p=0;p<m.birds;p++){const f=(p*137.5+M*(14+p*1.5))%(i+80)-40,b=n*(.18+.12*Ot(p*5.3+M*.05,99)),z=4+p%3,w=Math.sin(M*6+p)*z*.5;r.moveTo(f-z,b-w),r.quadraticCurveTo(f-z*.4,b-z*.3,f,b),r.quadraticCurveTo(f+z*.4,b-z*.3,f+z,b-w)}r.stroke()}}}const a=xt({overlay:e.overlay,onFrame:C});return c.current=a.canvas,a}const xl={default:{paperColor:"#efe8d8",inkColor:"#141414",sunColor:"#b91c1c"},monochrome:{},sumi:{paperColor:"#efe8d8",inkColor:"#141414",sunColor:"#b91c1c"},night:{paperColor:"#0d1117",inkColor:"#e5e7eb",sunColor:"#f8fafc"},jade:{paperColor:"#e6efe9",inkColor:"#0f3d2e",sunColor:"#c2410c"},dusk:{paperColor:"#f3e3d3",inkColor:"#3b1d2e",sunColor:"#e11d48"}},Ln=G.forwardRef((e,d)=>{const{preset:o,paperColor:g,inkColor:y,sunColor:t,layers:c,mist:C,drift:a,birds:r,pines:i,parallax:n,overlay:s,zIndex:l,width:m,height:I,className:M,style:h}=e,x=xl[o??"default"]||{},{canvasRef:E,canvas:L}=vl({paperColor:g??x.paperColor??"#f2efe6",inkColor:y??x.inkColor??"#111111",sunColor:t??x.sunColor??"#6b7280",layers:Math.max(1,Math.min(9,Math.round(c??5))),mist:C??1,drift:a??1,birds:Math.max(0,Math.round(r??5)),pines:i??!0,parallax:n??!0,overlay:s??!1});return G.useImperativeHandle(d,()=>L,[L]),ct.jsx(vt,{canvasRef:E,overlay:s,zIndex:l,width:m,height:I,className:M,style:h})});Ln.displayName="InkMountains";const pe=4.5;function wl(e,d){const o=Math.cbrt(e.r**3+d.r**3);return{...e.y>d.y?e:d,r:o,vy:Math.max(e.vy,d.vy),pinned:0}}function Rl(e,d,o){if(e.r<pe)return 0;if(e.pinned>0)return e.pinned-=o,0;const g=(e.r-pe+.6)*.9;e.vy+=(g-e.vy)*(1-Math.pow(.9,d)),Math.random()<.012*d*(pe*2/e.r)&&(e.pinned=80+Math.random()*400);const y=e.vy*d;return e.y+=y,e.x+=Math.sin(e.y*.05+e.seed)*.25*d,y}function kl(e){const d=G.useRef(e);d.current=e;const o=G.useRef(null),g=Rt(),y=G.useRef(null);function t(i,n,s){var M;if(typeof document>"u")return null;const l=d.current,m=document.createElement("canvas");m.width=Math.round(i*s),m.height=Math.round(n*s);const I=m.getContext("2d");if(!I)return m;if((M=I.setTransform)==null||M.call(I,s,0,0,s,0,0),I.fillStyle=l.backgroundColor,I.fillRect(0,0,i,n),typeof I.createRadialGradient=="function")for(let h=0;h<l.lights;h++){const x=Math.random()*i,E=n*(.25+Math.random()*.75),L=14+Math.random()*46,F=l.lightColors[h%Math.max(1,l.lightColors.length)]??"#ffffff",B=.2+Math.random()*.4,j=I.createRadialGradient(x,E,0,x,E,L);j.addColorStop(0,ut(F,B)),j.addColorStop(.6,ut(F,B*.7)),j.addColorStop(1,ut(F,0)),I.fillStyle=j,I.beginPath(),I.arc(x,E,L,0,Math.PI*2),I.fill()}return m}function c(i,n){var h,x;const s=d.current,l=y.current&&i>0?y.current.width/i:1,m=Math.max(1,Math.ceil(i/8)),I=Math.max(1,Math.ceil(n/8)),M=typeof document<"u"?document.createElement("canvas"):null;M&&(M.width=m,M.height=I),o.current={bg:t(i,n,l),dpr:l,drops:[],droplets:Array.from({length:Math.round(i*n/900)},()=>({x:Math.random()*i,y:Math.random()*n,r:.6+Math.random()*1.6})),fog:new Float32Array(m*I).fill(1),fogW:m,fogH:I,fogImg:((x=(h=M==null?void 0:M.getContext("2d"))==null?void 0:h.createImageData)==null?void 0:x.call(h,m,I))??null,fogCanvas:M,key:`${s.backgroundColor}|${s.lights}|${s.lightColors.join(",")}`}}function C(i,n,s,l,m=0){const I=n/8,M=s/8,h=l/8;for(let x=Math.max(0,Math.floor(M-h));x<=Math.min(i.fogH-1,Math.ceil(M+h));x++)for(let E=Math.max(0,Math.floor(I-h));E<=Math.min(i.fogW-1,Math.ceil(I+h));E++){const L=Math.hypot(E-I,x-M)/Math.max(h,.5);if(L<1){const F=x*i.fogW+E;i.fog[F]=Math.min(i.fog[F],m+(1-m)*L*L)}}}function a(i,n,s,l,m){var H;const I=d.current,M=l/16.67;o.current||c(n,s);let h=o.current;h.key!==`${I.backgroundColor}|${I.lights}|${I.lightColors.join(",")}`&&(c(n,s),h=o.current),h.bg&&!m.overlay&&i.drawImage(h.bg,0,0,n,s);const x=I.rain*.9*M*m.quality;for(let O=0;O<Math.floor(x)+(Math.random()<x%1?1:0);O++)Math.random()<.22?h.drops.push({x:Math.random()*n,y:Math.random()*s*.9,r:(1.8+Math.random()*3.6)*I.dropSize,vy:0,pinned:0,traveled:0,seed:Math.random()*10}):h.droplets.length<n*s/500&&h.droplets.push({x:Math.random()*n,y:Math.random()*s,r:.6+Math.random()*1.6});const E=Math.ceil(90*m.quality);h.drops.length>E&&h.drops.splice(0,h.drops.length-E);for(const O of h.drops){const T=Rl(O,M,l);if(T>0){O.traveled+=T,C(h,O.x,O.y,O.r*1.3,.05),O.traveled>7&&(O.traveled=0,Math.random()<.7&&h.droplets.push({x:O.x+(Math.random()-.5)*O.r,y:O.y-O.r*1.5,r:.8+Math.random()*O.r*.25}),O.r=Math.max(pe*.92,O.r-.03));for(let $=h.droplets.length-1;$>=0;$--){const u=h.droplets[$];Math.abs(u.x-O.x)<O.r&&u.y>O.y-O.r&&u.y<O.y+O.r*1.2&&(O.r=Math.cbrt(O.r**3+u.r**3),h.droplets[$]=h.droplets[h.droplets.length-1],h.droplets.pop())}}}h.drops.sort((O,T)=>O.x-T.x);for(let O=0;O<h.drops.length;O++){const T=h.drops[O];if(!(T.r<=0))for(let $=O+1;$<h.drops.length&&h.drops[$].x-T.x<14;$++){const u=h.drops[$];if(!(u.r<=0)&&Math.hypot(T.x-u.x,T.y-u.y)<(T.r+u.r)*.8){const S=wl(T,u);Object.assign(T,S),u.r=0}}}h.drops=h.drops.filter(O=>O.r>0&&O.y<s+20);const L=kt(g.current,y.current);if(I.interactive&&L.inside&&(C(h,L.x,L.y,26*1.6),h.droplets=h.droplets.filter(T=>Math.hypot(T.x-L.x,T.y-L.y)>26),h.drops=h.drops.filter(T=>Math.hypot(T.x-L.x,T.y-L.y)>26+T.r)),I.fog>0&&h.fogImg&&h.fogCanvas){const O=1-Math.pow(.9975,M),[T,$,u]=bt([I.fogColor],0),S=h.fogImg.data;for(let R=0;R<h.fog.length;R++){h.fog[R]+=(1-h.fog[R])*O;const v=R*4;S[v]=T,S[v+1]=$,S[v+2]=u,S[v+3]=h.fog[R]*I.fog*255}(H=h.fogCanvas.getContext("2d"))==null||H.putImageData(h.fogImg,0,0),i.imageSmoothingEnabled=!0,i.drawImage(h.fogCanvas,0,0,n,s)}const F=new Path2D,B=new Path2D;for(const O of h.droplets)F.moveTo(O.x+O.r,O.y),F.arc(O.x,O.y,O.r,0,Math.PI*2),B.moveTo(O.x-O.r*.3+.5,O.y-O.r*.35),B.arc(O.x-O.r*.3,O.y-O.r*.35,.5,0,Math.PI*2);i.fillStyle="rgba(0,0,0,0.22)",i.fill(F),i.fillStyle="rgba(255,255,255,0.45)",i.fill(B);const j=h.dpr;for(const O of h.drops){const T=O.r,$=O.r*(O.vy>.3?1.18:1);if(h.bg){i.save(),i.beginPath(),i.ellipse(O.x,O.y,T,$,0,0,Math.PI*2),i.clip();const u=O.r*5,S=Math.max(0,(O.x-u)*j),R=Math.max(0,(O.y-u)*j);i.translate(O.x,O.y),i.scale(1,-1),i.drawImage(h.bg,S,R,u*2*j,u*2*j,-T,-$,T*2,$*2),i.restore()}i.strokeStyle="rgba(0,0,0,0.35)",i.lineWidth=.8,i.beginPath(),i.ellipse(O.x,O.y,T,$,0,0,Math.PI*2),i.stroke(),i.fillStyle="rgba(255,255,255,0.55)",i.beginPath(),i.ellipse(O.x-T*.35,O.y-$*.45,T*.22,$*.14,-.5,0,Math.PI*2),i.fill()}}const r=xt({overlay:e.overlay,onResize:()=>{o.current=null},onFrame:a});return y.current=r.canvas,r}const Sl={default:{lightColors:["#fbbf24","#f97316","#ef4444","#38bdf8","#a78bfa","#fde68a"],backgroundColor:"#07090f",fogColor:"#94a3b8"},monochrome:{},"city-night":{lightColors:["#fbbf24","#f97316","#ef4444","#38bdf8","#a78bfa","#fde68a"],backgroundColor:"#07090f",fogColor:"#94a3b8"},neon:{lightColors:["#f0abfc","#22d3ee","#f472b6","#a78bfa","#34d399"],backgroundColor:"#05030a",fogColor:"#a78bfa"},cafe:{lightColors:["#fcd34d","#fb923c","#fde68a"],backgroundColor:"#120b06",fogColor:"#d6b98c",fog:.3},storm:{lightColors:["#e2e8f0","#94a3b8","#64748b"],backgroundColor:"#0b0f14",fogColor:"#cbd5e1",fog:.35}},Bn=G.forwardRef((e,d)=>{const{preset:o,lightColors:g,backgroundColor:y,fogColor:t,rain:c,dropSize:C,fog:a,lights:r,interactive:i,overlay:n,zIndex:s,width:l,height:m,className:I,style:M}=e,h=Sl[o??"default"]||{},{canvasRef:x,canvas:E}=kl({lightColors:g??h.lightColors??["#ffffff","#9ca3af","#6b7280"],backgroundColor:y??h.backgroundColor??"#111111",fogColor:t??h.fogColor??"#9ca3af",rain:c??1,dropSize:C??1,fog:a??h.fog??.25,lights:Math.max(0,Math.round(r??34)),interactive:i??!0,overlay:n??!1});return G.useImperativeHandle(d,()=>E,[E]),ct.jsx(vt,{canvasRef:x,overlay:n,zIndex:s,width:l,height:m,className:I,style:M})});Bn.displayName="WindowRain";function Pl(e,d,o){const C=.011*e+o*.4,a=.017*d-o*.55,r=.023*e-o*.3+1.3,i=.009*d+o*.35,n=-.017*Math.sin(C)*Math.sin(a)+.6*.009*Math.sin(r)*Math.cos(i),s=-(.011*Math.cos(C)*Math.cos(a)+.6*.023*Math.cos(r)*Math.sin(i));return[n*85,s*85]}const xo=(e,d,o)=>{const g=Math.max(0,Math.min(1,(o-e)/(d-e)));return g*g*(3-2*g)},wo=7e3,El=45;function Al(e){const d=G.useRef(e);d.current=e;const o=G.useRef([]),g=G.useRef(0),y=G.useRef(-1),t=G.useRef({color:"",img:null}),c=Rt(),C=G.useRef(Xt()).current,a=G.useRef(null);function r(s,l,m,I){const M=l===1?m*.5:m*(.3+.4*s/(l-1)),h=Math.min(I*.32,220);return{x:M,y:I-h,base:I}}function i(s,l,m,I,M){const h=d.current,x=I/16.67;g.current+=I*.001;const E=g.current;if(y.current!==h.sticks){y.current=h.sticks,o.current=[];for(let u=0;u<h.sticks;u++)for(const S of[-1.5,0,1.6])o.current.push({stick:u,offset:S,puffs:[],acc:0})}M.overlay||(s.fillStyle=h.backgroundColor,s.fillRect(0,0,l,m));const L=kt(c.current,a.current),F=C(L,x),B=h.interactive&&L.inside,j=110,H=1-Math.pow(.92,x);for(const u of o.current){const S=r(u.stick,h.sticks,l,m);for(u.acc+=I*.001*El*(.5+.5*M.quality);u.acc>=1;)u.acc-=1,u.puffs.push({x:S.x+u.offset,y:S.y-2,vx:0,vy:-.6,age:0});let R=0;for(const v of u.puffs){v.age+=I;const A=S.y-v.y,p=h.turbulence*(.06+1.3*xo(15,Math.max(80,S.y*.5),A)),[f,b]=Pl(v.x+u.stick*300+u.offset*90,v.y,E),z=f*p,w=-h.rise*(.5+.25*xo(0,120,A))+b*p*.6;if(v.vx+=(z-v.vx)*H,v.vy+=(w-v.vy)*H,B){const D=v.x-L.x,W=v.y-L.y,k=Math.hypot(D,W);if(k<j){const q=(1-k/j)**2;v.vx+=(F.vx*.12-W/(k||1)*Math.abs(F.vx+F.vy)*.04)*q*x,v.vy+=(F.vy*.12+D/(k||1)*Math.abs(F.vx+F.vy)*.04)*q*x}}v.x+=v.vx*x,v.y+=v.vy*x,!(v.age>wo||v.y<-30)&&(u.puffs[R++]=v)}u.puffs.length=R}const O=6,T=s.lineJoin;s.lineJoin="round",s.lineCap="round";for(const u of o.current){const S=Array.from({length:O},()=>new Path2D),R=u.puffs;for(let v=1;v<R.length;v++){const A=R[v-1],p=R[v];if(Math.abs(A.x-p.x)+Math.abs(A.y-p.y)>60)continue;const f=Math.min(O-1,Math.floor(p.age/wo*O));S[f].moveTo(A.x,A.y),S[f].lineTo(p.x,p.y)}for(let v=0;v<O;v++){const A=(v+.5)/O;s.strokeStyle=ut(h.color,(.42*(1-A)**1.6+.02)*(u.offset===0?1:.6)),s.lineWidth=(.7+A*9)*h.thickness*(u.offset===0?1:.7),s.stroke(S[v])}}s.lineJoin=T,t.current.color!==h.emberColor&&(t.current={color:h.emberColor,img:Pt(h.emberColor,48)});const $=t.current.img;for(let u=0;u<h.sticks;u++){const S=r(u,h.sticks,l,m);s.strokeStyle=h.stickColor,s.lineWidth=2,s.beginPath(),s.moveTo(S.x,S.base),s.lineTo(S.x,S.y),s.stroke();const R=.75+.15*Math.sin(E*9+u)+.1*Math.sin(E*23+u*2);if($){const v=s.globalCompositeOperation;s.globalCompositeOperation="lighter",s.globalAlpha=R,s.drawImage($,S.x-12,S.y-12,24,24),s.globalAlpha=1,s.globalCompositeOperation=v}s.fillStyle=h.emberColor,s.fillRect(S.x-1.2,S.y-1,2.4,3)}}const n=xt({overlay:e.overlay,onFrame:i});return a.current=n.canvas,n}const Il={default:{color:"#e7e5e4",emberColor:"#ff6a2b",stickColor:"#5b4636",backgroundColor:"#0c0a09"},monochrome:{},temple:{color:"#e7e5e4",emberColor:"#ff6a2b",stickColor:"#5b4636",backgroundColor:"#0c0a09"},sandalwood:{color:"#f5e6d3",emberColor:"#ffb15c",stickColor:"#7a5230",backgroundColor:"#140d08"},moonlight:{color:"#cbd5e1",emberColor:"#fde68a",stickColor:"#475569",backgroundColor:"#05070d"},noir:{color:"#ffffff",emberColor:"#ffffff",stickColor:"#3f3f46",backgroundColor:"#000000"}},Dn=G.forwardRef((e,d)=>{const{preset:o,sticks:g,color:y,emberColor:t,stickColor:c,backgroundColor:C,turbulence:a,rise:r,thickness:i,interactive:n,overlay:s,zIndex:l,width:m,height:I,className:M,style:h}=e,x=Il[o??"default"]||{},{canvasRef:E,canvas:L}=Al({sticks:Math.max(1,Math.min(5,Math.round(g??1))),color:y??x.color??"#ffffff",emberColor:t??x.emberColor??"#ffffff",stickColor:c??x.stickColor??"#6b7280",backgroundColor:C??x.backgroundColor??"#111111",turbulence:a??1,rise:r??1,thickness:i??1,interactive:n??!0,overlay:s??!1});return G.useImperativeHandle(d,()=>L,[L]),ct.jsx(vt,{canvasRef:E,overlay:s,zIndex:l,width:m,height:I,className:M,style:h})});Dn.displayName="IncenseSmoke";const ye=72,On=e=>Math.pow(e/(ye-1),1.9),We=e=>1/(On(e)*.97+.03);function $l(e,d,o){return Math.sin(e*.9+d*1.3-o*1.1)+.5*Math.sin(e*2.1-d*.7-o*1.7+1.3)+.25*Math.sin(e*4.3+d*2.9-o*2.6+.4)}function Tl(e,d,o){const g=(e-d)/.07;return Math.exp(-g*g)*Math.max(0,1-o*o)}function zl(e){const d=G.useRef(e);d.current=e;const o=G.useRef(0),g=G.useRef([]),y=G.useRef(0),t=G.useRef([]),c=G.useRef({color:"",img:null}),C=Rt(),a=G.useRef(null);function r(n,s,l,m,I){const M=d.current;o.current+=m*.001*M.speed;const h=o.current,x=l*M.horizon,E=s/2,L=s*M.moonX,F=bt([M.skyColor],0),B=bt([M.seaColor],0),j=bt([M.moonColor],0),H=b=>`rgb(${b[0]|0},${b[1]|0},${b[2]|0})`,O=(b,z,w)=>b.map((D,W)=>D+(z[W]-D)*w);if(!I.overlay){const b=n.createLinearGradient(0,0,0,x);b.addColorStop(0,H(F)),b.addColorStop(1,H(O(F,j,.12))),n.fillStyle=b,n.fillRect(0,0,s,x+1)}t.current.length!==M.stars&&(t.current=Array.from({length:M.stars},()=>({x:Math.random(),y:Math.random()*.95,r:.3+Math.random()*.9,ph:Math.random()*6}))),n.fillStyle=M.moonColor;for(const b of t.current)n.globalAlpha=.25+.35*(.5+.5*Math.sin(h*1.5+b.ph)),n.fillRect(b.x*s,b.y*x,b.r,b.r);n.globalAlpha=1,c.current.color!==M.moonColor&&(c.current={color:M.moonColor,img:Pt(M.moonColor,96)});const T=Math.min(s,l)*.05,$=x*.42;c.current.img&&(n.globalAlpha=.35,n.drawImage(c.current.img,L-T*6,$-T*6,T*12,T*12),n.globalAlpha=1),n.fillStyle=M.moonColor,n.beginPath(),n.arc(L,$,T,0,Math.PI*2),n.fill();const u=n.createLinearGradient(0,x,0,l);u.addColorStop(0,H(O(B,j,.18))),u.addColorStop(.35,H(B)),u.addColorStop(1,H(O(B,[0,0,0],.45))),n.fillStyle=u,n.fillRect(0,x,s,l-x);const S=kt(C.current,a.current);if(M.interactive&&S.inside&&S.y>x+4&&h-y.current>.12){y.current=h;const z=Math.pow((S.y-x)/(l-x),1/1.9)*(ye-1),w=We(z);g.current.push({x:(S.x-E)*w/s,z:w,born:h}),g.current.length>10&&g.current.shift()}for(const b of S.taps){if(b.y<=x)continue;const z=We(Math.pow((b.y-x)/(l-x),1/1.9)*(ye-1));g.current.push({x:(b.x-E)*z/s,z,born:h-.01})}g.current=g.current.filter(b=>h-b.born<4);const R=Math.max(3,Math.round(s/280)),v=H(O(B,j,.35)),A=[],p=[];for(let b=1;b<ye;b++){const z=On(b),w=x+(l-x)*z,D=We(b),W=M.waveHeight*(.6+9*Math.pow(z,1.4)),k=N=>{const U=(N-E)*D/s;let Y=$l(U*4,D*.35,h);for(const X of g.current){const _=h-X.born,V=Math.hypot((U-X.x)*6,(D-X.z)*1.2),Q=_*3.2,ot=Math.exp(-((V-Q)**2)*2.2)*Math.max(0,1-_/4);Y+=Math.sin((V-Q)*9)*ot*1.8}return Y};n.beginPath();let q=k(0);n.moveTo(0,w-q*W);const P=(.06+.32*z)*s;for(let N=R;N<=s+R;N+=R){const U=k(N);n.lineTo(N,w-U*W);const Y=(U-q)/R*W,X=(N-L)/P;if(Math.abs(X)<1){const _=Math.sin(N*1.37+b*2.1+h*5.3)*Math.sin(N*.71-h*3.1+b),V=Tl(Y,.08*(1-z),X)*(.35+.65*z)*(_>.3?1:.15);V>.08&&(p.push(N-R*(.5+z),w-U*W-.6,R*(1+2*z),1+z*1.6),A.push(V))}q=U}n.strokeStyle=v,n.globalAlpha=.08+.2*z,n.lineWidth=.6+z,n.stroke()}n.globalAlpha=1;const f=n.globalCompositeOperation;n.globalCompositeOperation="lighter",n.fillStyle=M.moonColor;for(const[b,z,w]of[[.08,.35,.35],[.35,.7,.65],[.7,2,1]]){n.globalAlpha=w,n.beginPath();for(let D=0;D<A.length;D++)A[D]<b||A[D]>=z||n.rect(p[D*4],p[D*4+1],p[D*4+2],p[D*4+3]);n.fill()}n.globalAlpha=1,n.globalCompositeOperation=f,n.fillStyle=ut(M.moonColor,.08),n.fillRect(0,x-1,s,2)}const i=xt({overlay:e.overlay,onFrame:r});return a.current=i.canvas,i}const Fl={default:{seaColor:"#0b2236",skyColor:"#030712",moonColor:"#f8fafc"},monochrome:{},midnight:{seaColor:"#0b2236",skyColor:"#030712",moonColor:"#f8fafc"},harvest:{seaColor:"#1c1410",skyColor:"#0a0604",moonColor:"#fbbf24"},arctic:{seaColor:"#0f2a33",skyColor:"#04121a",moonColor:"#e0f2fe"},rose:{seaColor:"#2a1324",skyColor:"#0d0510",moonColor:"#fecdd3"}},Wn=G.forwardRef((e,d)=>{const{preset:o,seaColor:g,skyColor:y,moonColor:t,horizon:c,moonX:C,waveHeight:a,speed:r,stars:i,interactive:n,overlay:s,zIndex:l,width:m,height:I,className:M,style:h}=e,x=Fl[o??"default"]||{},{canvasRef:E,canvas:L}=zl({seaColor:g??x.seaColor??"#1f2937",skyColor:y??x.skyColor??"#111111",moonColor:t??x.moonColor??"#ffffff",horizon:c??.42,moonX:C??.62,waveHeight:a??1,speed:r??1,stars:Math.max(0,Math.round(i??120)),interactive:n??!0,overlay:s??!1});return G.useImperativeHandle(d,()=>L,[L]),ct.jsx(vt,{canvasRef:E,overlay:s,zIndex:l,width:m,height:I,className:M,style:h})});Wn.displayName="MoonlitSea";function Ro(e,d,o){const g=Ft(e,d,5,5);return Math.max(0,Math.min(1,(g-(1-o)*.75)*4.2))}function Ll(e){const d=G.useRef(e);d.current=e;const o=G.useRef(0),g=G.useRef(null),y=G.useRef({color:"",img:null}),t=Rt(),c=G.useRef(null);function C(i,n,s){var E,L;const l=d.current,m=Math.round(Math.max(120,Math.min(320,i/3.5))*(s<.75?.65:1)),I=Math.max(8,Math.round(m*(n*(1-l.horizon))/i)),M=g.current;if(M&&M.bw===m&&M.bh===I)return M;if(typeof document>"u")return null;const h=document.createElement("canvas");h.width=m,h.height=I;const x=(L=(E=h.getContext("2d"))==null?void 0:E.createImageData)==null?void 0:L.call(E,m,I);return x?(g.current={c:h,img:x,bw:m,bh:I,clear:new Float32Array(m*I)},g.current):null}function a(i,n,s,l,m){var A;const I=d.current,M=l/16.67;o.current+=l*.001*I.speed;const h=o.current,x=s*I.horizon,E=bt([I.skyColor],0),L=bt([I.sunColor],0),F=bt([I.cloudColor],0),B=bt([I.shadowColor],0),j=p=>`rgb(${p[0]|0},${p[1]|0},${p[2]|0})`,H=(p,f,b)=>p.map((z,w)=>z+(f[w]-z)*b),O=n*.5;if(!m.overlay){const p=i.createLinearGradient(0,0,0,x);p.addColorStop(0,j(E)),p.addColorStop(.7,j(H(E,L,.35))),p.addColorStop(1,j(H(E,L,.85))),i.fillStyle=p,i.fillRect(0,0,n,x+1)}y.current.color!==I.sunColor&&(y.current={color:I.sunColor,img:Pt(I.sunColor,128)});const T=Math.min(n,s)*.06;y.current.img&&(i.globalAlpha=.6,i.drawImage(y.current.img,O-T*7,x-T*4,T*14,T*8),i.globalAlpha=1),i.fillStyle=I.sunColor,i.beginPath(),i.arc(O,x,T,Math.PI,0),i.fill();const $=C(n,s,m.quality);if(!$)return;const u=kt(t.current,c.current);if(I.interactive&&u.inside&&u.y>x){const p=u.x/n*$.bw,f=(u.y-x)/(s-x)*$.bh,b=$.bw*.09;for(let z=Math.max(0,Math.floor(f-b));z<Math.min($.bh,f+b);z++)for(let w=Math.max(0,Math.floor(p-b));w<Math.min($.bw,p+b);w++){const D=Math.hypot(w-p,z-f)/b;D<1&&($.clear[z*$.bw+w]=Math.max($.clear[z*$.bw+w],1-D*D))}}const S=Math.pow(.985,M),R=$.img.data,v=H(B,[0,0,0],.35);for(let p=0;p<$.bh;p++){const f=(p+.5)/$.bh,b=1/(f*.96+.04),z=Math.min(1,Math.max(0,(b-2)/20));for(let w=0;w<$.bw;w++){const D=(w+.5)/$.bw-.5,W=D*b*1.6,k=b*.55+h*.12,q=p*$.bw+w;$.clear[q]*=S;const P=Math.max(0,Ro(W,k,I.coverage)-$.clear[q]*.9),N=Ro(W,k+.06,I.coverage),U=Math.max(0,Math.min(1,.55+(P-N)*2.5+(1-f)*.25)),Y=Math.pow(U,2.2)*(.5+.5*(1-Math.abs(D)*1.4));let X=H(B,F,U);X=H(X,L,Y*.55);const _=P*P*(3-2*P);X=H(v,X,_),X=H(X,H(E,L,.8),z);const V=q*4;R[V]=X[0],R[V+1]=X[1],R[V+2]=X[2],R[V+3]=255}}(A=$.c.getContext("2d"))==null||A.putImageData($.img,0,0),i.imageSmoothingEnabled=!0,i.imageSmoothingQuality="high",i.drawImage($.c,0,x,n,s-x)}const r=xt({overlay:e.overlay,onResize:()=>{g.current=null},onFrame:a});return c.current=r.canvas,r}const Bl={default:{skyColor:"#1e1b4b",sunColor:"#fb923c",cloudColor:"#fde2cf",shadowColor:"#8a6f8e"},monochrome:{},sunset:{skyColor:"#1e1b4b",sunColor:"#fb923c",cloudColor:"#fde2cf",shadowColor:"#8a6f8e"},dawn:{skyColor:"#0c4a6e",sunColor:"#fde68a",cloudColor:"#fef3c7",shadowColor:"#7c8fa6"},golden:{skyColor:"#422006",sunColor:"#fbbf24",cloudColor:"#fff1c1",shadowColor:"#8a5a2b"},stormy:{skyColor:"#0f172a",sunColor:"#cbd5e1",cloudColor:"#94a3b8",shadowColor:"#1e293b",coverage:.8}},qn=G.forwardRef((e,d)=>{const{preset:o,skyColor:g,sunColor:y,cloudColor:t,shadowColor:c,horizon:C,coverage:a,speed:r,interactive:i,overlay:n,zIndex:s,width:l,height:m,className:I,style:M}=e,h=Bl[o??"default"]||{},{canvasRef:x,canvas:E}=Ll({skyColor:g??h.skyColor??"#111111",sunColor:y??h.sunColor??"#ffffff",cloudColor:t??h.cloudColor??"#d1d5db",shadowColor:c??h.shadowColor??"#4b5563",horizon:C??.36,coverage:a??h.coverage??.55,speed:r??1,interactive:i??!0,overlay:n??!1});return G.useImperativeHandle(d,()=>E,[E]),ct.jsx(vt,{canvasRef:x,overlay:n,zIndex:s,width:l,height:m,className:I,style:M})});qn.displayName="CloudSea";function ko(e,d,o){return 1/Math.pow(1+(e*e+d*d)/(o*o),1.5)}const qe=.12;function Dl(e,d){return e<=qe?0:d*Math.min(1,(e-qe)/(1-qe))**.8}function Ol(e){const d=G.useRef(e);d.current=e;const o=G.useRef([]),g=G.useRef(""),y=G.useRef(0),t=G.useRef({x:0,y:0,pulse:0}),c=G.useRef({color:"",img:null}),C=Rt(),a=G.useRef(null);function r(s){const l=d.current,m=[];for(let I=0;I<3;I++){const M=Math.max(3,Math.round(l.spikes*(.7+I*.15)));for(let h=0;h<M;h++){const x=(h+(I%2?.5:0)+.5)/(M+.5)-.5;m.push({x:x*s*(.75+I*.08),row:I,h:0,v:0,lean:0,width:s/M*(.42+I*.06),seed:Math.random()*10})}}o.current=m}function i(s,l,m,I,M){const h=d.current,x=I/16.67;y.current+=I*.001;const E=y.current,L=l/2,F=m*.74,B=Math.min(l*.82,Math.max(160,l*h.poolWidth)),j=`${B}|${h.spikes}`;g.current!==j&&(g.current=j,r(B)),M.overlay||(s.fillStyle=h.backgroundColor,s.fillRect(0,0,l,m),c.current.color!==h.highlightColor&&(c.current={color:h.highlightColor,img:Pt(h.highlightColor,128)}),c.current.img&&(s.globalAlpha=.09,s.drawImage(c.current.img,L-B,F-B*.5,B*2,B),s.globalAlpha=1));const H=kt(C.current,a.current),O=t.current,T=h.interactive&&H.inside,$=T?H.x:L+Math.sin(E*.5)*B*.18,u=T?H.y:F-m*(.22+.07*Math.sin(E*.8)),S=1-Math.pow(.8,x);O.x+=($-O.x)*S,O.y+=(u-O.y)*S,H.taps.length&&(O.pulse=1),O.pulse*=Math.pow(.96,x);const R=h.strength*(T?1:.75)*(1+O.pulse*.9),v=m*.32,A=m*.34*h.spikeHeight,p=ko(O.x-L,O.y-F,v)*R,f=m*.055+Math.min(m*.06,p*m*.07),b=Math.max(-B*.12,Math.min(B*.12,(O.x-L)*.08*Math.min(1,p*2)));for(const k of o.current){const q=L+b+k.x,P=ko(O.x-q,O.y-F,v)*R,N=Dl(P,A)*(.55+k.row*.22)*(1+.05*Math.sin(E*7+k.seed));k.v+=((N-k.h)*.12-k.v*.22)*x,k.h=Math.max(0,k.h+k.v*x);const U=Math.atan2(O.x-q,Math.max(20,F-O.y))*.55*Math.min(1,P*2);k.lean+=(U-k.lean)*S}const z=k=>{const q=(k-L-b)/(B/2);return Math.abs(q)>=1?0:f*Math.pow(1-q*q,.6)},w=k=>{const q=new Path2D,P=L+b-B/2-6,N=L+b+B/2+6,U=1.5;q.moveTo(P,F);const Y=o.current.filter(X=>X.row===k&&X.h>.5);for(let X=P;X<=N;X+=U){let _=z(X)*(.85+k*.08);for(const V of Y){const Q=L+b+V.x,ot=X-Q,tt=V.h,at=ot-V.lean*tt*.9*Math.max(0,1-Math.abs(ot)/V.width),K=1-Math.abs(at)/V.width;K>0&&(_=Math.max(_,z(Q)+tt*Math.pow(K,2.4)))}q.lineTo(X,F-_)}return q.lineTo(N,F),q.closePath(),q},D=h.fluidColor,W=[];for(let k=0;k<3;k++){const q=w(k);W.push(q),s.fillStyle=D,s.fill(q),s.strokeStyle=ut(h.highlightColor,.18+k*.12),s.lineWidth=.8+k*.3,s.stroke(q)}s.strokeStyle=ut(h.highlightColor,.55),s.lineWidth=1.1,s.beginPath();for(const k of o.current){if(k.row!==2||k.h<6)continue;const q=L+b+k.x,P=F-z(q);s.moveTo(q-k.width*.35,P-k.h*.08),s.quadraticCurveTo(q-k.width*.18+k.lean*k.h*.3,P-k.h*.5,q+k.lean*k.h*.85-1,F-z(q)-k.h*.92)}if(s.stroke(),s.fillStyle=ut(h.highlightColor,.1),s.beginPath(),s.ellipse(L+b-B*.15,F-f*.55,B*.22,Math.max(2,f*.22),0,0,Math.PI*2),s.fill(),h.reflection){s.save(),s.translate(0,F*2),s.scale(1,-1),s.globalAlpha=.22,s.fillStyle=D;for(const k of W)s.fill(k);if(s.restore(),!M.overlay){const k=s.createLinearGradient(0,F,0,Math.min(m,F+A));k.addColorStop(0,ut(h.backgroundColor,0)),k.addColorStop(1,ut(h.backgroundColor,1)),s.fillStyle=k,s.fillRect(0,F,l,m-F)}s.globalAlpha=1}}const n=xt({overlay:e.overlay,onFrame:i});return a.current=n.canvas,n}const Wl={default:{backgroundColor:"#ececec",fluidColor:"#050505",highlightColor:"#ffffff"},monochrome:{},studio:{backgroundColor:"#ececec",fluidColor:"#050505",highlightColor:"#ffffff"},noir:{backgroundColor:"#0a0a0a",fluidColor:"#000000",highlightColor:"#9ca3af"},gold:{backgroundColor:"#120d05",fluidColor:"#1a1206",highlightColor:"#f5c96a"},"oil-slick":{backgroundColor:"#0b0b12",fluidColor:"#05050a",highlightColor:"#a78bfa"}},Gn=G.forwardRef((e,d)=>{const{preset:o,fluidColor:g,highlightColor:y,backgroundColor:t,spikes:c,spikeHeight:C,poolWidth:a,strength:r,reflection:i,interactive:n,overlay:s,zIndex:l,width:m,height:I,className:M,style:h}=e,x=Wl[o??"default"]||{},{canvasRef:E,canvas:L}=Ol({fluidColor:g??x.fluidColor??"#050505",highlightColor:y??x.highlightColor??"#ffffff",backgroundColor:t??x.backgroundColor??"#e5e5e5",spikes:Math.max(3,Math.min(24,Math.round(c??9))),spikeHeight:C??1,poolWidth:a??.5,strength:r??1,reflection:i??!0,interactive:n??!0,overlay:s??!1});return G.useImperativeHandle(d,()=>L,[L]),ct.jsx(vt,{canvasRef:E,overlay:s,zIndex:l,width:m,height:I,className:M,style:h})});Gn.displayName="Ferrofluid";exports.AntColony=an;exports.AuroraBorealis=Ho;exports.BlackHole=dn;exports.Boids=jo;exports.BubbleUniverse=gn;exports.ButterflySwarm=yn;exports.CloudSea=qn;exports.Confetti=$o;exports.CrystalGrowth=on;exports.Dandelion=kn;exports.DeepSeaBioluminescence=Mn;exports.DiffusionAggregation=_o;exports.DragonCursor=ln;exports.Ferrofluid=Gn;exports.FireEffect=Io;exports.Fireflies=Rn;exports.Fireworks=Bo;exports.FlowField=Lo;exports.FluidSimulation=Oo;exports.FrostGlass=Tn;exports.GalaxySpiral=un;exports.GameOfLife=Go;exports.GrassField=Sn;exports.IncenseSmoke=Dn;exports.InkMountains=Ln;exports.IvyGrowth=xn;exports.Kaleidoscope=Ko;exports.KelpForest=In;exports.KoiPond=fn;exports.LSystem=Vo;exports.Lightning=qo;exports.MagneticField=sn;exports.Mandala=Do;exports.MatrixRain=So;exports.Metaballs=rn;exports.MoonlitSea=Wn;exports.Moths=Pn;exports.NeuralWeb=nn;exports.NoiseGradient=Fo;exports.OrigamiCranes=zn;exports.PaperLanterns=An;exports.ParticleField=Po;exports.PendulaWave=en;exports.Rain=Wo;exports.ReactionDiffusion=Xo;exports.SakuraBlossom=cn;exports.SandSimulation=No;exports.SeasonsTree=Fn;exports.SlimeMold=Qo;exports.SnowDrift=$n;exports.SolarFlare=mn;exports.SpiderWeb=pn;exports.Spirograph=Yo;exports.Starfield=Eo;exports.SunbeamDust=En;exports.TornadoVortex=hn;exports.VoronoiCells=Jo;exports.WatercolorBloom=tn;exports.WaveInterference=Uo;exports.WindowRain=Bn;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Mo=require("react/jsx-runtime"),Y=require("react"),fa=require("react-dom"),da="アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲンァィゥェォッャュョ",jt="ABCDEFGHIJKLMNOPQRSTUVWXYZ",ha="01";function ua(t){return t==="katakana"?da:t==="latin"?jt:t==="binary"?ha:t||jt}function ga(t,u){const s=Y.useRef(u);s.current=u;const v=Y.useRef([]),k=Y.useRef(0);Y.useEffect(()=>{const e=t.current;if(!e)return;const y=e.parentElement;if(!y)return;const P=e.getContext("2d");let o=0,n=0;function a(b,m){const w=window.devicePixelRatio||1;o=b,n=m,e.width=Math.round(o*w),e.height=Math.round(n*w),e.style.width=`${o}px`,e.style.height=`${n}px`,P.scale(w,w);const{fontSize:B}=s.current,F=Math.floor(o/B);v.current=Array.from({length:F},()=>Math.floor(Math.random()*-(n/B)))}const i=new ResizeObserver(b=>{const{width:m,height:w}=b[0].contentRect;m>0&&w>0&&a(m,w)});i.observe(y);const r=y.getBoundingClientRect();r.width>0&&r.height>0&&a(r.width,r.height);let g=0,l=0;function h(){const{color:b,backgroundColor:m,fontSize:w,charset:B,resetThreshold:F}=s.current,X=B;P.fillStyle=m,P.fillRect(0,0,o,n),P.fillStyle=b,P.font=`${w}px monospace`;const O=v.current;for(let _=0;_<O.length;_++){const H=X[Math.floor(Math.random()*X.length)];P.fillText(H,_*w,O[_]*w),O[_]++,O[_]*w>n&&Math.random()>F&&(O[_]=0)}}function f(b){const m=g?b-g:0;g=b,l+=m;const{speed:w}=s.current;l>=w&&(l=l%w,h()),k.current=requestAnimationFrame(f)}return k.current=requestAnimationFrame(f),()=>{i.disconnect(),cancelAnimationFrame(k.current)}},[t])}const pa={default:{color:"#00ff41"},monochrome:{},cyberpunk:{color:"#bf5fff",backgroundColor:"rgba(5,0,20,0.12)"},binary:{charset:"binary",color:"#00cfff",fontSize:12,speed:50},minimal:{color:"#4ade80",backgroundColor:"rgba(0,0,0,0.08)",speed:40},blood:{color:"#dc2626",backgroundColor:"rgba(10,0,0,0.1)",charset:"latin"}},Wn=Y.forwardRef((t,u)=>{const{preset:s,color:v,backgroundColor:k,fontSize:e,speed:y,charset:P,resetThreshold:o,width:n,height:a,className:i,style:r}=t,g=pa[s??"default"]||{},l=Y.useRef(null);Y.useImperativeHandle(u,()=>l.current);const h=ua(P??g.charset??"latin");ga(l,{color:v??g.color??"#ffffff",backgroundColor:k??g.backgroundColor??"rgba(17,17,17,0.1)",fontSize:e??g.fontSize??14,speed:y??g.speed??33,charset:h,resetThreshold:o??g.resetThreshold??.95});const f={width:n??"100%",height:a??"100%",display:"block",overflow:"hidden",...r};return Mo.jsx("div",{style:f,className:i,children:Mo.jsx("canvas",{ref:l,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});Wn.displayName="MatrixRain";const je=new Map;function Ve(t){if(je.has(t))return je.get(t);let u=t.trim();u.startsWith("#")&&(u=u.slice(1));let s,v,k;if(u.length===3)s=parseInt(u[0]+u[0],16),v=parseInt(u[1]+u[1],16),k=parseInt(u[2]+u[2],16);else if(u.length===6)s=parseInt(u.slice(0,2),16),v=parseInt(u.slice(2,4),16),k=parseInt(u.slice(4,6),16);else return je.set(t,null),null;if(isNaN(s)||isNaN(v)||isNaN(k))return je.set(t,null),null;const e=[s,v,k];return je.set(t,e),e}function ko(t,u=1){const s=Ve(t);return s?`rgba(${s[0]},${s[1]},${s[2]},${u})`:`rgba(255,255,255,${u})`}function xo(t){const u=Ve(t);return u?`${u[0]},${u[1]},${u[2]}`:"255,255,255"}function ma(t,u,s){return[t[0]+(u[0]-t[0])*s,t[1]+(u[1]-t[1])*s,t[2]+(u[2]-t[2])*s]}function Fo(t,u){const s=Math.max(0,Math.min(1,u));if(t.length===0)return[255,255,255];if(t.length===1)return Ve(t[0])??[255,255,255];const v=s*(t.length-1),k=Math.min(Math.floor(v),t.length-2),e=v-k,y=Ve(t[k])??[255,255,255],P=Ve(t[k+1])??[255,255,255];return ma(y,P,e)}function uo(t,u,s){const v=t.split(",").map(Number),k=u.split(",").map(Number);return v.map((e,y)=>Math.round(e+(k[y]-e)*s)).join(",")}function Po(t,u="255,255,255"){return t.startsWith("#")?xo(t):u}const ya=16;function Eo(){const t=Y.useRef({cx:0,cy:0,over:!1,down:!1,taps:[]});return Y.useEffect(()=>{const u=t.current,s=P=>{u.cx=P.clientX,u.cy=P.clientY,u.over=!0},v=P=>{s(P),u.down=!0,u.taps.length<ya&&u.taps.push({cx:P.clientX,cy:P.clientY})},k=()=>{u.down=!1},e=P=>{P.relatedTarget||(u.over=!1,u.down=!1)},y=()=>{u.over=!1,u.down=!1};return window.addEventListener("pointermove",s,{passive:!0}),window.addEventListener("pointerdown",v,{passive:!0}),window.addEventListener("pointerup",k,{passive:!0}),window.addEventListener("pointerout",e,{passive:!0}),window.addEventListener("blur",y),()=>{window.removeEventListener("pointermove",s),window.removeEventListener("pointerdown",v),window.removeEventListener("pointerup",k),window.removeEventListener("pointerout",e),window.removeEventListener("blur",y)}},[]),t}function ye(t,u){const s=u.getBoundingClientRect(),v=t.clientX-s.left,k=t.clientY-s.top;return v>=0&&k>=0&&v<=s.width&&k<=s.height?{x:v,y:k}:null}function zo(t,u){if(!u)return t.taps.length=0,{x:-9999,y:-9999,inside:!1,down:!1,taps:[]};const s=u.getBoundingClientRect(),v=(P,o)=>P>=0&&o>=0&&P<=s.width&&o<=s.height,k=t.cx-s.left,e=t.cy-s.top,y=[];for(const P of t.taps){const o=P.cx-s.left,n=P.cy-s.top;v(o,n)&&y.push({x:o,y:n})}return t.taps.length=0,{x:k,y:e,inside:t.over&&v(k,e),down:t.down,taps:y}}function Vo(){let t=0,u=0,s=!1;return(v,k)=>{if(!v.inside)return s=!1,{vx:0,vy:0};const e=s?(v.x-t)/Math.max(k,.01):0,y=s?(v.y-u)/Math.max(k,.01):0;return t=v.x,u=v.y,s=!0,{vx:e,vy:y}}}function Yo(t,u=64){if(typeof document>"u")return null;const s=document.createElement("canvas");s.width=s.height=u;const v=s.getContext("2d");if(!v||typeof v.createRadialGradient!="function")return null;const k=u/2,e=v.createRadialGradient(k,k,0,k,k,k);return e.addColorStop(0,ko(t,1)),e.addColorStop(.18,ko(t,.75)),e.addColorStop(.45,ko(t,.18)),e.addColorStop(1,ko(t,0)),v.fillStyle=e,v.fillRect(0,0,u,u),s}function Ma(){var t;return typeof window<"u"&&typeof window.matchMedia=="function"&&!!((t=window.matchMedia("(prefers-reduced-motion: reduce)"))!=null&&t.matches)}function ot(t,u,s){const v=t.split(",").map(Number),k=u.split(",").map(Number);return v.length<3||k.length<3?t:v.slice(0,3).map((e,y)=>Math.round(e+(k[y]-e)*s)).join(",")}function ba(t,u){const s=Y.useRef([]),v=Y.useRef(null),k=Y.useRef(null),e=Y.useRef(u);e.current=u;const y=Y.useRef(0),P=Y.useRef(""),o=Y.useRef(""),n=Y.useRef(""),a=Y.useRef(""),i=Y.useRef(null),r=Y.useRef({sprite:null,color:""}).current;Y.useEffect(()=>{var g;(g=i.current)==null||g.call(i)},[u.particleCount,u.particleSize]),Y.useEffect(()=>{const g=t.current;if(!g)return;const l=g,h=l.parentElement;if(!h)return;const f=l.getContext("2d");let b=0,m=0,w=e.current.velocityMultiplier;function B(E,x){const{particleCount:I,particleSize:M,speed:p,velocityMultiplier:R,twinkle:c}=e.current;w=R,s.current=Array.from({length:I},()=>({x:Math.random()*E,y:Math.random()*x,vx:(Math.random()-.5)*p*R,vy:(Math.random()-.5)*p*R,size:Math.random()*M+M*.4,opacity:Math.random()*.5+.5,tint:Math.random()<.7?Math.random()*.25:.5+Math.random()*.5,twinklePhase:c?Math.random()*Math.PI*2:void 0}))}function F(E,x){const I=window.devicePixelRatio||1;l.width=Math.round(E*I),l.height=Math.round(x*I),l.style.width=`${E}px`,l.style.height=`${x}px`,f.scale(I,I),b=E,m=x,B(E,x)}i.current=()=>{b>0&&m>0&&B(b,m)};const X=new ResizeObserver(E=>{const{width:x,height:I}=E[0].contentRect;x>0&&I>0&&F(x,I)});X.observe(h);const O=h.getBoundingClientRect();O.width>0&&O.height>0&&F(O.width,O.height);function _(E){const x=l.getBoundingClientRect();return{x:E.clientX-x.left,y:E.clientY-x.top}}function H(E){if(!e.current.dragParticles)return;const{x,y:I}=_(E),M=s.current,{dragRadius:p}=e.current;let R=-1,c=p;for(let d=0;d<M.length;d++){const $=M[d].x-x,C=M[d].y-I,S=Math.sqrt($*$+C*C);S<c&&(c=S,R=d)}R!==-1&&(k.current={particleIndex:R,offsetX:M[R].x-x,offsetY:M[R].y-I})}function D(E){const x=ye(E,l);if(!x)return A();const{x:I,y:M}=x;if(k.current){const p=s.current[k.current.particleIndex];p.x=I+k.current.offsetX,p.y=M+k.current.offsetY,p.vx=0,p.vy=0}e.current.interactive&&(v.current={x:I,y:M})}function W(){k.current=null}function A(){v.current=null,k.current=null}l.addEventListener("mousedown",H),window.addEventListener("mousemove",D),l.addEventListener("mouseup",W),document.addEventListener("mouseleave",A);function T(){const{particleColor:E,lineColor:x,lineDistance:I,connectParticles:M,backgroundColor:p,speed:R,repelRadius:c,repelStrength:d,friction:$,maxVelocityMultiplier:C,lineWidth:S,lineOpacity:N,wrapEdges:z,twinkle:L,twinkleSpeed:G,twinkleAmplitude:q,glowParticles:j,glowBlur:V,lineStyle:K,interactive:to}=e.current;E!==n.current&&(P.current=xo(E),n.current=E),x!==a.current&&(o.current=xo(x),a.current=x);const lo=s.current,ao=v.current,ro=P.current,Q=o.current;if(f.clearRect(0,0,b,m),p&&p!=="transparent"){const oo=xo(p),Z=f.createRadialGradient(b/2,m/2,0,b/2,m/2,Math.hypot(b,m)/2);Z.addColorStop(0,`rgb(${ot(oo,Q,.1)})`),Z.addColorStop(1,`rgb(${oo})`),f.fillStyle=Z,f.fillRect(0,0,b,m)}const so=e.current.velocityMultiplier;if(so!==w){const oo=w?so/w:1;if(Number.isFinite(oo))for(const Z of lo)Z.vx*=oo,Z.vy*=oo;w=so}for(let oo=0;oo<lo.length;oo++){const Z=lo[oo];if(k.current&&k.current.particleIndex===oo)continue;if(ao){const eo=Z.x-ao.x,co=Z.y-ao.y,fo=Math.sqrt(eo*eo+co*co);if(fo<c&&fo>0){const mo=(c-fo)/c*2;Z.vx+=eo/fo*mo*d,Z.vy+=co/fo*mo*d}}Z.vx*=$,Z.vy*=$;const no=R*C,U=Math.sqrt(Z.vx*Z.vx+Z.vy*Z.vy);U>no&&(Z.vx=Z.vx/U*no,Z.vy=Z.vy/U*no),Z.x+=Z.vx,Z.y+=Z.vy,z?(Z.x<0?Z.x+=b:Z.x>b&&(Z.x-=b),Z.y<0?Z.y+=m:Z.y>m&&(Z.y-=m)):(Z.x<0&&(Z.x=0,Z.vx*=-1),Z.x>b&&(Z.x=b,Z.vx*=-1),Z.y<0&&(Z.y=0,Z.vy*=-1),Z.y>m&&(Z.y=m,Z.vy*=-1)),L&&(Z.twinklePhase===void 0&&(Z.twinklePhase=Math.random()*Math.PI*2),Z.twinklePhase+=G)}if(M){K==="dashed"?f.setLineDash([4,6]):f.setLineDash([]);for(let oo=0;oo<lo.length;oo++)for(let Z=oo+1;Z<lo.length;Z++){const no=lo[oo].x-lo[Z].x,U=lo[oo].y-lo[Z].y,eo=Math.sqrt(no*no+U*U);if(eo<I){const co=1-eo/I;f.beginPath(),f.moveTo(lo[oo].x,lo[oo].y),f.lineTo(lo[Z].x,lo[Z].y),f.strokeStyle=`rgba(${ot(Q,ro,co*.6)},${co*co*N*1.2})`,f.lineWidth=S*(.6+co*.9),f.stroke()}}if(ao&&to)for(const oo of lo){const Z=Math.hypot(oo.x-ao.x,oo.y-ao.y);if(Z<I*1.3){const no=1-Z/(I*1.3);f.beginPath(),f.moveTo(ao.x,ao.y),f.lineTo(oo.x,oo.y),f.strokeStyle=`rgba(${ro},${no*N})`,f.lineWidth=S*(.6+no),f.stroke()}}f.setLineDash([])}(!r.sprite||r.color!==E)&&(r.sprite=Yo(E.startsWith("#")?E:"#ffffff",64),r.color=E);const J=Math.max(.01,e.current.particleSize*1.4);for(let oo=0;oo<lo.length;oo++){const Z=lo[oo],no=L&&Z.twinklePhase!==void 0?1-q+q*Math.sin(Z.twinklePhase):Z.opacity,U=Math.min(1,Z.size/J),eo=ot(ro,Q,Z.tint??0);if(r.sprite){const co=Z.size*(j?5+V/6:5)*(.6+U*.6);f.globalCompositeOperation="lighter",f.globalAlpha=no*(j?.75:.4)*(.5+U*.5),f.drawImage(r.sprite,Z.x-co,Z.y-co,co*2,co*2),f.globalAlpha=1,f.globalCompositeOperation="source-over"}f.beginPath(),f.arc(Z.x,Z.y,Z.size*(.7+U*.3),0,Math.PI*2),f.fillStyle=`rgba(${ot(eo,"255,255,255",.35*U)},${no})`,f.fill()}y.current=requestAnimationFrame(T)}return y.current=requestAnimationFrame(T),()=>{X.disconnect(),cancelAnimationFrame(y.current),l.removeEventListener("mousedown",H),window.removeEventListener("mousemove",D),l.removeEventListener("mouseup",W),document.removeEventListener("mouseleave",A)}},[t])}const Ca={default:{particleColor:"#9be7ff",lineColor:"#4aa8c7",backgroundColor:"#040a18",twinkle:!0},monochrome:{},galaxy:{particleColor:"#8B5CF6",lineColor:"#8B5CF6",backgroundColor:"#030014",particleCount:80,lineDistance:130},snow:{particleColor:"#dbeafe",lineColor:"#dbeafe",connectParticles:!1,particleCount:160,speed:.3,backgroundColor:"transparent"},minimal:{connectParticles:!1,particleColor:"#4ade80",backgroundColor:"transparent",particleCount:60},ocean:{particleColor:"#67e8f9",lineColor:"#0891B2",backgroundColor:"#020f1a",particleCount:100,lineDistance:110,speed:.5},cosmos:{particleColor:"#e0e7ff",lineColor:"#6366f1",backgroundColor:"#030014",particleCount:80,lineDistance:120,speed:.3,wrapEdges:!0,twinkle:!0,glowParticles:!0,velocityMultiplier:.3},aurora:{particleColor:"#67e8f9",lineColor:"#0891B2",backgroundColor:"#020f1a",particleCount:80,lineDistance:110,speed:.3,wrapEdges:!0,twinkle:!0,glowParticles:!0,lineStyle:"dashed",velocityMultiplier:.3},gold:{particleColor:"#fbbf24",lineColor:"#d97706",backgroundColor:"#0c0800",particleCount:80,speed:.3,wrapEdges:!0,twinkle:!0,glowParticles:!0,lineOpacity:.4,velocityMultiplier:.3}},qn=Y.forwardRef((t,u)=>{const{preset:s,particleCount:v,particleColor:k,lineColor:e,lineDistance:y,particleSize:P,speed:o,connectParticles:n,interactive:a,backgroundColor:i,repelRadius:r,repelStrength:g,friction:l,maxVelocityMultiplier:h,lineWidth:f,lineOpacity:b,wrapEdges:m,twinkle:w,twinkleSpeed:B,twinkleAmplitude:F,glowParticles:X,glowBlur:O,lineStyle:_,dragParticles:H,dragRadius:D,velocityMultiplier:W,width:A,height:T,className:E,style:x}=t,I=Ca[s??"default"]||{},M=Y.useRef(null);Y.useImperativeHandle(u,()=>M.current),ba(M,{particleCount:v??I.particleCount??120,particleColor:k??I.particleColor??"#ffffff",lineColor:e??I.lineColor??"#6b7280",lineDistance:y??I.lineDistance??120,particleSize:P??2.5,speed:o??I.speed??.8,connectParticles:n??I.connectParticles??!0,interactive:a??!0,backgroundColor:i??I.backgroundColor??"transparent",repelRadius:r??80,repelStrength:g??.3,friction:l??.99,maxVelocityMultiplier:h??3,lineWidth:f??.8,lineOpacity:b??I.lineOpacity??.6,wrapEdges:m??I.wrapEdges??!1,twinkle:w??I.twinkle??!1,twinkleSpeed:B??.03,twinkleAmplitude:F??.4,glowParticles:X??I.glowParticles??!1,glowBlur:O??15,lineStyle:_??I.lineStyle??"solid",dragParticles:H??!1,dragRadius:D??20,velocityMultiplier:W??I.velocityMultiplier??2});const p=H??!1;return Mo.jsx("div",{className:E,style:{width:A??"100%",height:T??"100%",display:"block",overflow:"hidden",cursor:p?"grab":"default",...x},children:Mo.jsx("canvas",{ref:M,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});qn.displayName="ParticleField";function Io({canvasRef:t,overlay:u=!1,zIndex:s=10,width:v,height:k,className:e,style:y}){const[P,o]=Y.useState(!1);return Y.useEffect(()=>o(!0),[]),u?P?fa.createPortal(Mo.jsx("canvas",{ref:t,"aria-hidden":"true",role:"presentation",className:e,style:{position:"fixed",inset:0,display:"block",pointerEvents:"none",zIndex:s,...y}}),document.body):null:Mo.jsx("div",{className:e,style:{width:v??"100%",height:k??"100%",display:"block",overflow:"hidden",...y},children:Mo.jsx("canvas",{ref:t,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})}const va=22,wa=17,ka=2e3,Sa=5e3,Xt=.25,Ra=.25;function Pa(){return{quality:1,avg:16.67,slowMs:0,fastMs:0}}function xa(t,u){t.avg+=(u-t.avg)/60,t.avg>va?(t.slowMs+=u,t.fastMs=0,t.slowMs>=ka&&(t.quality=Math.max(Ra,t.quality-Xt),t.slowMs=0)):t.avg<wa?(t.fastMs+=u,t.slowMs=0,t.fastMs>=Sa&&(t.quality=Math.min(1,t.quality+Xt),t.fastMs=0)):(t.slowMs=0,t.fastMs=0)}function Wt(t,u,s,v,k){let e=null;for(const y of v){if(t.vy>0&&s<=y.y&&t.y>=y.y&&t.x>=y.x&&t.x<=y.x+y.w){(!e||y.y<e.y)&&(e=y);continue}if(t.y>y.y&&t.y<y.y+y.h){const P=u<y.x&&t.x>=y.x,o=u>y.x+y.w&&t.x<=y.x+y.w;(P||o)&&(t.x=P?y.x:y.x+y.w,t.vx=-t.vx)}}return e&&(t.y=e.y,t.vy=k>0?-t.vy*k:0),e}function Je(t,u,s){return{solidId:u.id,offsetX:t.x-u.x,dy:s}}function Qe(t,u,s){const v=s.get(u.solidId);return!v||u.offsetX<0||u.offsetX>v.w?!1:(t.x=v.x+u.offsetX,t.y=v.y+u.dy,!0)}const Ft="[data-otc-solid]",qe=new Map;let mt=new WeakMap,Ht=0,$a=1,Ze=!0,Ge=null,ae=null;function Ne(){Ze=!0}function Gn(t){t.target!==document&&t.target!==window&&(Ze=!0)}function Yt(t){return t instanceof Element&&(t.matches(Ft)||t.querySelector(Ft)!==null)}function Ia(t){for(const u of t){if(u.type==="attributes")return Ne();for(const s of Array.from(u.addedNodes))if(Yt(s))return Ne();for(const s of Array.from(u.removedNodes))if(Yt(s))return Ne()}}function Dn(t){const u=t.el.getBoundingClientRect();t.px=u.left+window.scrollX,t.py=u.top+window.scrollY,t.w=u.width,t.h=u.height}function Ta(){const t=new Set(Array.from(document.querySelectorAll(Ft)));for(const u of Array.from(qe.keys()))t.has(u)||(qe.delete(u),ae==null||ae.unobserve(u));for(const u of t){let s=qe.get(u);s||(s={id:$a++,el:u,live:!1,px:0,py:0,w:0,h:0},qe.set(u,s),ae==null||ae.observe(u)),s.live=u.getAttribute("data-otc-solid")==="live",Dn(s)}mt=new WeakMap,Ze=!1}function Aa(){Ze=!0,Ge=new MutationObserver(Ia),Ge.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["data-otc-solid"]}),typeof ResizeObserver<"u"&&(ae=new ResizeObserver(Ne),ae.observe(document.body)),window.addEventListener("resize",Ne),document.addEventListener("scroll",Gn,{capture:!0,passive:!0})}function Ea(){Ge==null||Ge.disconnect(),ae==null||ae.disconnect(),Ge=null,ae=null,window.removeEventListener("resize",Ne),document.removeEventListener("scroll",Gn,{capture:!0}),qe.clear(),mt=new WeakMap}function za(){Ht++===0&&Aa();let t=!1;return()=>{t||(t=!0,--Ht===0&&Ea())}}function La(t,u){Ze&&Ta();let s,v;if(u)s=window.scrollX,v=window.scrollY;else{let e=mt.get(t);if(!e){const y=t.getBoundingClientRect();e={px:y.left+window.scrollX,py:y.top+window.scrollY},mt.set(t,e)}s=e.px,v=e.py}const k=[];for(const e of qe.values())e.live&&Dn(e),!(e.w===0||e.h===0)&&k.push({id:e.id,x:e.px-s,y:e.py-v,w:e.w,h:e.h});return k}const Fa=[],Ba=64;function To(t={}){const{noLoop:u=!1,overlay:s=!1,collide:v=!1,reducedMotion:k="static",maxDpr:e=2}=t,[y,P]=Y.useState(null),o=Y.useRef(t.onFrame),n=Y.useRef(t.onResize);return o.current=t.onFrame,n.current=t.onResize,Y.useEffect(()=>{var x;if(!y)return;const a=y.getContext("2d");if(!a)return;let i=0,r=0,g=0,l=0,h=!1,f=!1,b=document.hidden;const m=Pa(),w=k==="static"&&typeof window.matchMedia=="function"?window.matchMedia("(prefers-reduced-motion: reduce)"):null;let B=(w==null?void 0:w.matches)??!1;const F=v?za():null,X=I=>{var M;i===0||r===0||(s&&a.clearRect(0,0,i,r),(M=o.current)==null||M.call(o,a,i,r,I,{quality:m.quality,overlay:s,solids:v?La(y,s):Fa}))},O=I=>{const M=l?Math.min(I-l,Ba):16;l=I,xa(m,M),X(M),g=requestAnimationFrame(O)},_=()=>{const I=!u&&!f&&!b&&!B&&i>0;I&&!h?(h=!0,l=0,g=requestAnimationFrame(O)):!I&&h&&(h=!1,cancelAnimationFrame(g))},H=(I,M)=>{var R;if(I<=0||M<=0)return;const p=Math.min(window.devicePixelRatio||1,e);y.width=Math.round(I*p),y.height=Math.round(M*p),y.style.width=`${I}px`,y.style.height=`${M}px`,a.setTransform(p,0,0,p,0,0),i=I,r=M,(R=n.current)==null||R.call(n,i,r),B&&X(16),_()};let D=null;const W=()=>H(window.innerWidth,window.innerHeight);if(s)window.addEventListener("resize",W),W();else{const I=y.parentElement;if(I){D=new ResizeObserver(p=>{var c;const R=(c=p[0])==null?void 0:c.contentRect;R&&H(R.width,R.height)}),D.observe(I);const M=I.getBoundingClientRect();H(M.width,M.height)}}let A=null;typeof IntersectionObserver<"u"&&(A=new IntersectionObserver(I=>{const M=I[I.length-1];M&&(f=!M.isIntersecting,_())}),A.observe(y));const T=()=>{b=document.hidden,_()};document.addEventListener("visibilitychange",T);const E=()=>{B=(w==null?void 0:w.matches)??!1,B&&X(16),_()};return(x=w==null?void 0:w.addEventListener)==null||x.call(w,"change",E),_(),()=>{var I;h=!1,cancelAnimationFrame(g),D==null||D.disconnect(),A==null||A.disconnect(),window.removeEventListener("resize",W),document.removeEventListener("visibilitychange",T),(I=w==null?void 0:w.removeEventListener)==null||I.call(w,"change",E),F==null||F()}},[y,u,s,v,k,e]),{canvasRef:P,canvas:y}}function _t(t,u){const s=Math.sin(t*127.1+u*311.7)*43758.5453;return s-Math.floor(s)}function et(t,u,s){const v=Math.sin(t*127.1+u*311.7+s*74.7)*43758.5453;return v-Math.floor(v)}const Bt=t=>t*t*(3-2*t);function Go(t,u=0){const s=Math.floor(t),v=Bt(t-s),k=_t(s,u);return k+(_t(s+1,u)-k)*v}function Ke(t,u,s=0){const v=Math.floor(t),k=Math.floor(u),e=Bt(t-v),y=Bt(u-k),P=et(v,k,s),o=et(v+1,k,s),n=et(v,k+1,s),a=et(v+1,k+1,s),i=P+(o-P)*e,r=n+(a-n)*e;return i+(r-i)*y}function yt(t,u=5,s=0,v=.5){let k=0,e=1,y=0,P=1;for(let o=0;o<u;o++)k+=Go(t*P,s+o*17)*e,y+=e,e*=v,P*=2;return k/y}function Zo(t,u,s=4,v=0,k=.5){let e=0,y=1,P=0,o=1;for(let n=0;n<s;n++)e+=Ke(t*o,u*o,v+n*17)*y,P+=y,y*=k,o*=2;return e/P}const Vt=(t,u,s)=>Math.max(u,Math.min(s,t)),Ut=["255,190,150","255,225,190","255,250,240","220,232,255","180,205,255"];function Oa(t){return t<.12?0:t<.32?1:t<.7?2:t<.92?3:4}function Mt(t,u,s,v){const k=v?Math.random():Math.pow(Math.random(),1.6)*.9+.1,e=Math.max(0,s.starSizeMax-s.starSizeMin);return{x:v?(Math.random()-.5)*t*2:Math.random()*t,y:v?(Math.random()-.5)*u*2:Math.random()*u,z:k,size:s.starSizeMin+e*Math.pow(Math.random(),3)*(v?1:.4+.6*k),alpha:s.starOpacityMin+(s.starOpacityMax-s.starOpacityMin)*Math.random(),tint:Oa(Math.random()),tw:Math.random()*Math.PI*2,px:0,py:0}}function Wa(t){const u=Y.useRef(t);u.current=t;const s=Eo(),v=Y.useRef(null),k=Y.useRef({t:0,w:0,h:0,key:"",stars:[],shooters:[],nextShoot:1.5,lookX:0,lookY:0,vpx:.5,vpy:.5}),e=Y.useRef({key:"",c:null}),y=Y.useRef({key:"",c:null});function P(a,i,r,g){if(typeof document>"u")return null;const l=Math.max(1,Math.round(a/3)),h=Math.max(1,Math.round(i/3)),f=document.createElement("canvas");f.width=l,f.height=h;const b=f.getContext("2d");if(!b||typeof b.createImageData!="function")return f;const m=b.createImageData(l,h),w=m.data,[B,F,X]=g.split(",").map(Number),O="255,214,170".split(",").map(Number),_=uo(r,"120,150,255",.5).split(",").map(Number),H=uo(r,"255,70,150",.6).split(",").map(Number),D=uo(r,"60,190,255",.6).split(",").map(Number),W=-.42,A=Math.cos(W),T=Math.sin(W);for(let p=0;p<h;p++)for(let R=0;R<l;R++){const c=R/l,d=p/h,$=(c-.5)*A-(d-.5)*T*(h/l),C=(c-.5)*T+(d-.5)*A*(h/l)+(Zo($*3,.5,3,4)-.5)*.08,S=Math.exp(-((C/.17)**2)),N=Zo(c*6,d*6*h/l,5,1);let z=S*Math.pow(N,1.6)*1.5;const L=Math.exp(-((C/.022)**2))*Math.pow(Zo(c*9+3,d*9,4,2),1.2)*1.1;z=Math.max(0,z-L*S);const G=Math.exp(-(($/.25)**2)),q=Math.pow(Math.max(0,Zo(c*3+10,d*3,4,5)-.5)*2,2.2)*Math.exp(-(((c-.22)/.25)**2+((d-.7)/.35)**2)),j=Math.pow(Math.max(0,Zo(c*3-10,d*3,4,6)-.5)*2,2.2)*Math.exp(-(((c-.8)/.22)**2+((d-.25)/.3)**2)),V=(p*l+R)*4,K=z*(.35+.65*G);let to=B,lo=F,ao=X;to+=(O[0]*G+_[0]*(1-G))*K*.55+H[0]*q*.75+D[0]*j*.6,lo+=(O[1]*G+_[1]*(1-G))*K*.55+H[1]*q*.75+D[1]*j*.6,ao+=(O[2]*G+_[2]*(1-G))*K*.55+H[2]*q*.75+D[2]*j*.6,w[V]=Math.min(255,to),w[V+1]=Math.min(255,lo),w[V+2]=Math.min(255,ao),w[V+3]=255}b.putImageData(m,0,0);const E=document.createElement("canvas");E.width=Math.max(1,Math.round(a)),E.height=Math.max(1,Math.round(i));const x=E.getContext("2d");if(!x)return f;x.imageSmoothingEnabled=!0,x.drawImage(f,0,0,E.width,E.height);let I=11;const M=()=>((I=I*16807%2147483647)-1)/2147483646;for(let p=0;p<a*i*.012;p++){const R=M()*a,c=M()*i,d=(R/a-.5)*A-(c/i-.5)*T*(i/a),$=(R/a-.5)*T+(c/i-.5)*A*(i/a);M()>.08+.92*Math.exp(-(($/.14)**2))||(x.fillStyle=`rgba(255,248,240,${.12+M()*.5*(.5+.5*Math.exp(-((d/.4)**2)))})`,x.fillRect(R,c,M()<.85?1:1.5,1))}return E}function o(a,i,r,g,l){const h=u.current,f=k.current,b=g/1e3;f.t+=b;const m=f.t,w=h.perspective==="3D",B=Po(h.starColor),F=Po(h.backgroundColor,"0,0,0"),X=Po(h.shootingStarColor),O=Vt(Math.round(h.starCount*(.6+.4*l.quality)),0,5e3),_=`${i}x${r}|${h.perspective}|${h.starSizeMin}|${h.starSizeMax}|${h.starOpacityMin}|${h.starOpacityMax}`;for(f.key!==_&&(f.key=_,f.stars=[],f.w=i,f.h=r);f.stars.length<O;)f.stars.push(Mt(i,r,h,w));f.stars.length=O,y.current.key!==h.starColor&&(y.current={key:h.starColor,c:Yo("#ffffff",64)});const H=zo(s.current,v.current),D=H.inside?H.x/i-.5:0,W=H.inside?H.y/r-.5:0;f.lookX+=(D-f.lookX)*Math.min(1,b*2),f.lookY+=(W-f.lookY)*Math.min(1,b*2),f.vpx+=((H.inside?H.x/i:.5)-f.vpx)*Math.min(1,b*1.5),f.vpy+=((H.inside?H.y/r:.5)-f.vpy)*Math.min(1,b*1.5),a.globalCompositeOperation="source-over",a.globalAlpha=1,a.fillStyle=`rgb(${F})`,a.fillRect(0,0,i,r);const A=`${i}x${r}|${B}|${F}`;if(e.current.key!==A&&(e.current={key:A,c:P(i,r,B,F)}),e.current.c){a.imageSmoothingEnabled=!0,a.globalAlpha=w?.35:1;const I=i*.03;a.drawImage(e.current.c,-I-f.lookX*I,-I-f.lookY*I,i+I*2,r+I*2),a.globalAlpha=1}const T=y.current.c,E=h.twinkle?h.twinkleSpeed*60:0,x=h.speed;if(w){const I=i*f.vpx,M=r*f.vpy,p=Math.min(i,r)*.5;a.globalCompositeOperation="lighter",a.lineCap="round";for(const R of f.stars){const c=R.z;if(R.z-=x*b*.35,R.z<=.02){Object.assign(R,Mt(i,r,h,!0),{z:1});continue}const d=I+R.x/R.z*p/Math.max(i,r)*2,$=M+R.y/R.z*p/Math.max(i,r)*2,C=I+R.x/c*p/Math.max(i,r)*2,S=M+R.y/c*p/Math.max(i,r)*2;if(d<-50||d>i+50||$<-50||$>r+50){Object.assign(R,Mt(i,r,h,!0),{z:1});continue}const N=1-R.z,z=R.alpha*Math.min(1,N*1.6),L=uo(uo(Ut[R.tint],B,.4),"190,215,255",N*.4),G=1+x*2.5,q=d-(d-C)*G,j=$-($-S)*G;a.strokeStyle=`rgba(${L},${z})`,a.lineWidth=Math.max(.5,R.size*N*1.6),a.beginPath(),a.moveTo(q,j),a.lineTo(d,$),a.stroke()}if(T){a.globalAlpha=.25+.1*Math.min(2,x);const R=Math.min(i,r)*.5;a.drawImage(T,I-R,M-R,R*2,R*2),a.globalAlpha=1}}else{a.globalCompositeOperation="lighter";for(const I of f.stars){I.x-=x*b*12*I.z,I.x<-4&&(I.x+=i+8,I.y=Math.random()*r);const M=I.x-f.lookX*i*.05*I.z,p=I.y-f.lookY*r*.05*I.z,R=E?.7+.3*Math.sin(m*E*(.5+I.tw*.3)+I.tw*7)*(I.size<1.4?1:.3):1,c=I.alpha*R*(.45+.55*I.z),d=uo(Ut[I.tint],B,.35);a.fillStyle=`rgba(${d},${c})`;const $=I.size;if($<1.2)a.fillRect(M-$/2,p-$/2,Math.max(.6,$),Math.max(.6,$));else if(a.beginPath(),a.arc(M,p,$*.6,0,Math.PI*2),a.fill(),T&&(a.globalAlpha=c*.6,a.drawImage(T,M-$*4,p-$*4,$*8,$*8),a.globalAlpha=1),$>h.starSizeMin+(h.starSizeMax-h.starSizeMin)*.6){a.strokeStyle=`rgba(${d},${c*.5})`,a.lineWidth=.6;const C=$*6;a.beginPath(),a.moveTo(M-C,p),a.lineTo(M+C,p),a.moveTo(M,p-C),a.lineTo(M,p+C),a.stroke()}}}if(h.shootingStars&&(f.nextShoot-=b,f.nextShoot<=0)){const I=.35+Math.random()*.5,M=Math.random()<.5?1:-1,p=Math.max(40,h.shootingStarLength)*9;f.shooters.push({x:Math.random()*i,y:Math.random()*r*.5,vx:Math.cos(I)*p*M,vy:Math.sin(I)*p,age:0,life:Math.max(10,h.shootingStarLifetime)/60}),f.nextShoot=h.shootingStarInterval/1e3*(.5+Math.random())}for(const I of f.shooters){I.age+=b,I.x+=I.vx*b,I.y+=I.vy*b;const M=I.age/I.life,p=Math.sin(Math.PI*Vt(M,0,1)),R=Math.hypot(I.vx,I.vy)||1,c=h.shootingStarLength*(.4+.6*Math.min(1,M*3)),d=I.x-I.vx/R*c,$=I.y-I.vy/R*c,C=a.createLinearGradient(I.x,I.y,d,$);C.addColorStop(0,`rgba(${X},${p})`),C.addColorStop(.3,`rgba(${X},${p*.4})`),C.addColorStop(1,`rgba(${X},0)`),a.strokeStyle=C,a.lineWidth=1.6,a.lineCap="round",a.beginPath(),a.moveTo(I.x,I.y),a.lineTo(d,$),a.stroke(),T&&(a.globalAlpha=p*.8,a.drawImage(T,I.x-6,I.y-6,12,12),a.globalAlpha=1)}f.shooters=f.shooters.filter(I=>I.age<I.life),a.globalCompositeOperation="source-over"}const n=To({onFrame:o});return v.current=n.canvas,n}const qa={default:{starColor:"#c4b5fd",backgroundColor:"#0d0118"},monochrome:{},warp:{perspective:"3D",speed:2,starCount:300,shootingStars:!1,backgroundColor:"#000000"},peaceful:{perspective:"2D",speed:.2,twinkle:!0,shootingStars:!0,shootingStarInterval:2e3,backgroundColor:"#000818"},minimal:{starColor:"#94a3b8",backgroundColor:"#0f172a",twinkle:!1,shootingStars:!1,speed:.3},nebula:{starColor:"#c4b5fd",backgroundColor:"#0d0118",twinkle:!0,shootingStars:!0,starCount:250,speed:.4}},Nn=Y.forwardRef((t,u)=>{const{preset:s,starCount:v,starColor:k,shootingStarColor:e,backgroundColor:y,speed:P,twinkle:o,shootingStars:n,shootingStarInterval:a,perspective:i,starSizeMin:r,starSizeMax:g,starOpacityMin:l,starOpacityMax:h,twinkleSpeed:f,shootingStarLength:b,shootingStarLifetime:m,width:w,height:B,className:F,style:X}=t,O=qa[s??"default"]||{},{canvasRef:_,canvas:H}=Wa({starCount:v??O.starCount??200,starColor:k??O.starColor??"#ffffff",shootingStarColor:e??O.shootingStarColor??"#ffffff",backgroundColor:y??O.backgroundColor??"#111111",speed:P??O.speed??.5,twinkle:o??O.twinkle??!0,shootingStars:n??O.shootingStars??!0,shootingStarInterval:a??O.shootingStarInterval??3e3,perspective:i??O.perspective??"2D",starSizeMin:r??.3,starSizeMax:g??2.8,starOpacityMin:l??.3,starOpacityMax:h??1,twinkleSpeed:f??.03,shootingStarLength:b??80,shootingStarLifetime:m??60});return Y.useImperativeHandle(u,()=>H,[H]),Mo.jsx(Io,{canvasRef:_,width:w,height:B,className:F,style:X})});Nn.displayName="Starfield";const Kt={inferno:["#1a0200","#7a0d02","#c92a06","#f26b0f","#ffb02e","#ffe28a","#fffbe8"],toxic:["#001a05","#06520f","#13a017","#58d61a","#c4f53a","#f2ffb0","#ffffff"],ice:["#000b1f","#032a66","#0b5fb8","#1fa8e6","#79e2ff","#d4f8ff","#ffffff"],plasma:["#12001f","#4a0570","#9c13a8","#e0388f","#ff7f8f","#ffd0c4","#ffffff"],smoke:["#0d0d0d","#2b2b2b","#555555","#808080","#b0b0b0","#dcdcdc","#ffffff"]};function Ga(t){const u=new Uint32Array(256);for(let s=1;s<256;s++){const v=s/255,[k,e,y]=Fo(t,v),P=Math.min(255,Math.round(Math.pow(v,.55)*255*1.35));u[s]=P<<24|Math.round(y)<<16|Math.round(e)<<8|Math.round(k)}return u}function Da(t,u){const s=Y.useRef(u);s.current=u,Y.useEffect(()=>{const v=t.current;if(!v)return;const k=v,e=k.parentElement;if(!e)return;const y=k.getContext("2d"),P=document.createElement("canvas"),o=P.getContext("2d"),n=document.createElement("canvas"),a=n.getContext("2d");let i=0,r=0,g=0,l=0,h=5,f=null,b=null,m=new Uint32Array(256),w="",B="255,200,120";const F=[];let X=NaN;function O(E,x){const I=Math.min(2,window.devicePixelRatio||1);k.width=Math.round(E*I),k.height=Math.round(x*I),k.style.width=`${E}px`,k.style.height=`${x}px`,y.setTransform(I,0,0,I,0,0),i=E,r=x,X=s.current.resolution;const M=Math.max(.2,Math.min(1,X));h=Math.max(3,Math.round(5/M),Math.ceil(Math.sqrt(E*x/16e3))),g=Math.max(2,Math.ceil(i/h)+1),l=Math.max(2,Math.ceil(r/h)+1),P.width=g,P.height=l,n.width=Math.max(1,Math.ceil(g/4)),n.height=Math.max(1,Math.ceil(l/4)),f=o.createImageData(g,l),b=new Uint32Array(f.data.buffer)}const _=new ResizeObserver(E=>{const{width:x,height:I}=E[0].contentRect;x>0&&I>0&&O(x,I)});_.observe(e);const H=e.getBoundingClientRect();H.width>0&&H.height>0&&O(H.width,H.height);let D=0,W=0,A=0;function T(E){D=requestAnimationFrame(T);const x=W?Math.min(.05,(E-W)/1e3):1/60;if(W=E,A+=x,!f||!b||i===0)return;const I=s.current;I.resolution!==X&&O(i,r);const M=I.customColors&&I.customColors.length>=2?I.customColors:Kt[I.palette]??Kt.inferno,p=M.join(",");if(p!==w){w=p,m=Ga(M);const[L,G,q]=Fo(M,.66);B=`${Math.round(L)},${Math.round(G)},${Math.round(q)}`}const R=Math.max(-1,Math.min(1,I.windStrength*I.windDirection)),c=Math.max(0,Math.min(1,I.spread)),d=Math.min(.9,I.cooling*(I.coolingScale/3)),$=Math.max(.08,I.intensity)*(1-d*.85)*1.3,C=.8+Math.max(0,I.noiseStrength)/110,S=.0105*(1.35-c*.6),N=A*1.7;for(let L=0;L<l;L++){const G=L*h,q=1-G/r,j=(Go(A*.45+q*1.8,3)-.5)*q*34,V=R*q*q*r*.32,K=G*.0125+N,to=L*g;for(let lo=0;lo<g;lo++){const ao=lo*h-V-j,ro=.38+.62*yt(ao*.0042+A*.12,3,5),Q=$*ro,so=q/Q;if(so>1.6){b[to+lo]=0;continue}const J=Zo(ao*S,K,3,1);let oo=1-so+(J-.5)*C*(.3+so)-Math.max(0,so-.85)*.9;q<.035&&(oo=Math.max(oo,.88-q*4)),oo=oo<0?0:oo>1?1:oo,b[to+lo]=m[Math.pow(oo,1.75)*255|0]}}o.putImageData(f,0,0),y.clearRect(0,0,i,r),y.imageSmoothingEnabled=!0,y.imageSmoothingQuality="high",y.drawImage(P,0,0,g*h,l*h),a.clearRect(0,0,n.width,n.height),a.imageSmoothingEnabled=!0,a.drawImage(P,0,0,n.width,n.height),y.globalCompositeOperation="lighter",y.globalAlpha=.36,y.drawImage(n,-h*2,-h*3,g*h+h*4,l*h+h*3),y.globalAlpha=1;const z=I.intensity*28*x;for(let L=0;(L<z||Math.random()<z-L)&&!(F.length>90);L++){const G=1.2+Math.random()*1.8;F.push({x:Math.random()*i,y:r*(1-Math.random()*$*.5),vx:R*30+(Math.random()-.5)*20,vy:-(45+Math.random()*85),life:G,max:G,size:1+Math.random()*1.6,seed:Math.random()*100})}for(let L=F.length-1;L>=0;L--){const G=F[L];if(G.life-=x,G.life<=0||G.y<-10){F.splice(L,1);continue}G.x+=(G.vx+(Go(A*1.4+G.seed)-.5)*60)*x,G.y+=G.vy*x;const q=Math.min(1,G.life/G.max*1.4)*(.65+.35*Math.sin(A*18+G.seed));y.fillStyle=`rgba(${B},${q})`,y.beginPath(),y.arc(G.x,G.y,G.size,0,Math.PI*2),y.fill()}y.globalCompositeOperation="source-over"}return D=requestAnimationFrame(T),()=>{_.disconnect(),cancelAnimationFrame(D)}},[t])}const Na={default:{palette:"inferno"},monochrome:{palette:"smoke"},inferno:{palette:"inferno",intensity:.95,windStrength:.2,windDirection:1},toxic:{palette:"toxic",intensity:.9,cooling:.2,spread:.8,windStrength:.1},ice:{palette:"ice",intensity:.85,windStrength:.15,windDirection:-1,cooling:.35},plasma:{palette:"plasma",intensity:.92,spread:.75,windStrength:.05}},jn=Y.forwardRef((t,u)=>{const{preset:s,palette:v,customColors:k,intensity:e,windStrength:y,windDirection:P,spread:o,cooling:n,noiseStrength:a,coolingScale:i,resolution:r,width:g,height:l,className:h,style:f}=t,b=Na[s??"default"]||{},m=Y.useRef(null);return Y.useImperativeHandle(u,()=>m.current),Da(m,{palette:v??b.palette??"smoke",customColors:k,intensity:e??b.intensity??.95,windStrength:y??b.windStrength??.3,windDirection:P??b.windDirection??1,spread:o??b.spread??0,cooling:n??b.cooling??.3,noiseStrength:a??60,coolingScale:i??3,resolution:r??1}),Mo.jsx("div",{className:h,style:{width:g??"100%",height:l??"100%",display:"block",overflow:"hidden",...f},children:Mo.jsx("canvas",{ref:m,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});jn.displayName="FireEffect";function ja(t,u){const s=Y.useRef(u);s.current=u;const v=Y.useRef([]),k=Y.useRef(0),e=Y.useRef(!1),y=Y.useRef(!1),P=Y.useRef(0),o=Y.useRef(0);Y.useEffect(()=>{const n=t.current;if(!n)return;const a=n,i=a.parentElement;if(!i)return;const r=a.getContext("2d");let g=0,l=0;function h(F,X){const O=window.devicePixelRatio||1;a.width=Math.round(F*O),a.height=Math.round(X*O),a.style.width=`${F}px`,a.style.height=`${X}px`,r.scale(O,O),g=F,l=X}const f=new ResizeObserver(F=>{const{width:X,height:O}=F[0].contentRect;X>0&&O>0&&h(X,O)});f.observe(i);const b=i.getBoundingClientRect();b.width>0&&b.height>0&&h(b.width,b.height);function m(F){const{spread:X,colors:O,shapes:_,duration:H,spawnX:D,spawnY:W,spawnSpread:A,speedMin:T,speedMax:E,sizeMin:x,sizeMax:I,angularVelocity:M}=s.current,p=g*D,R=l*W,c=Math.max(1,H/16.67);for(let d=0;d<F;d++){const $=(Math.random()*2-1)*X*Math.PI,C=Math.random()*(E-T)+T;v.current.push({x:p+(Math.random()-.5)*A,y:R,vx:Math.sin($)*C,vy:-Math.cos($)*C,angle:Math.random()*Math.PI*2,angularV:(Math.random()-.5)*M,color:O[Math.floor(Math.random()*O.length)],shape:_[Math.floor(Math.random()*_.length)],w:Math.random()*(I-x)+x,h:Math.random()*(I-x)*.75+x*.5,opacity:1,life:0,maxLife:c})}}function w(F){switch(r.save(),r.translate(F.x,F.y),r.rotate(F.angle),r.globalAlpha=F.opacity,r.fillStyle=F.color,F.shape){case"square":r.fillRect(-F.w/2,-F.h/2,F.w,F.h);break;case"circle":r.beginPath(),r.arc(0,0,F.w/2,0,Math.PI*2),r.fill();break;case"triangle":r.beginPath(),r.moveTo(0,-F.h/2),r.lineTo(F.w/2,F.h/2),r.lineTo(-F.w/2,F.h/2),r.closePath(),r.fill();break;case"strip":r.fillRect(-F.w,-F.h/4,F.w*2,F.h/2);break}r.restore()}function B(F){const X=P.current?Math.min(F-P.current,50):16.67;P.current=F;const{trigger:O,particleCount:_,gravity:H,continuous:D,wind:W,emissionRate:A,onComplete:T}=s.current;if(O&&!e.current&&(m(_),y.current=!1),e.current=O,D&&O){o.current+=A*X/1e3;const x=Math.floor(o.current);x>0&&(m(x),o.current-=x)}r.clearRect(0,0,g,l);const E=X/16.67;v.current=v.current.filter(x=>(x.vy+=H*.3*E,x.vx+=W*.05*E,x.x+=x.vx*E,x.y+=x.vy*E,x.angle+=x.angularV*E,x.life+=E,x.opacity=Math.max(0,1-x.life/x.maxLife),x.opacity<=0||x.y>l+50?!1:(w(x),!0))),r.globalAlpha=1,!y.current&&O&&!D&&v.current.length===0&&e.current&&(y.current=!0,T==null||T()),k.current=requestAnimationFrame(B)}return k.current=requestAnimationFrame(B),()=>{f.disconnect(),cancelAnimationFrame(k.current)}},[t])}const Xa={monochrome:["#ffffff","#e5e7eb","#d1d5db","#9ca3af","#6b7280","#4b5563"],colorful:["#ff6b6b","#ffd93d","#6bcb77","#4d96ff","#ff6fc8","#ff9a3c","#c77dff"]},Ha={default:{palette:"colorful"},monochrome:{palette:"monochrome"},celebration:{palette:"colorful",shapes:["square","circle","triangle","strip"],speedMax:20},pastel:{colors:["#fbb6ce","#fed7aa","#fef08a","#bbf7d0","#bae6fd","#ddd6fe","#fbcfe8"],shapes:["circle","square"],gravity:.3,wind:.2},gold:{colors:["#ffd700","#ffa500","#ffec47","#fff3b0","#e6ac00"],shapes:["square","circle","strip"],speedMax:18,gravity:.4}},Ya=["square","circle","triangle","strip"],Xn=Y.forwardRef((t,u)=>{const{preset:s,palette:v,trigger:k=!1,particleCount:e,spread:y,gravity:P,colors:o,shapes:n,duration:a,continuous:i,wind:r,spawnX:g,spawnY:l,spawnSpread:h,speedMin:f,speedMax:b,sizeMin:m,sizeMax:w,angularVelocity:B,emissionRate:F,onComplete:X,width:O,height:_,className:H,style:D}=t,W=Ha[s??"default"]||{},A=v??W.palette??"colorful",T=o??W.colors??Xa[A],E=Y.useRef(null);return Y.useImperativeHandle(u,()=>E.current),ja(E,{trigger:k,particleCount:e??150,spread:y??.8,gravity:P??W.gravity??.5,colors:T,shapes:n??W.shapes??Ya,duration:a??4e3,continuous:i??!1,wind:r??W.wind??.5,spawnX:g??.5,spawnY:l??.4,spawnSpread:h??60,speedMin:f??4,speedMax:b??W.speedMax??16,sizeMin:m??6,sizeMax:w??14,angularVelocity:B??.3,emissionRate:F??10,onComplete:X}),Mo.jsx("div",{className:H,style:{width:O??"100%",height:_??"100%",display:"block",overflow:"hidden",pointerEvents:"none",...D},children:Mo.jsx("canvas",{ref:E,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});Xn.displayName="Confetti";function _a(t,u,s,v,k,e){const y=Math.min(v,2),P=Zo(t+s*.6,u+s*.6*e,y,1,k),o=Zo(t+5.2-s*.4,u+1.3+s*.3,y,2,k),n=Zo(t+3.5*P+1.7+s*.25,u+3.5*o+9.2,y,3,k),a=Zo(t+3.5*P+8.3,u+3.5*o+2.8-s*.2*e,y,4,k),i=Zo(t+3*n,u+3*a,v,5,k),r=Math.min(1,Math.hypot(n-.5,a-.5)*2.2);return[i,r]}function Va(t){const u=Y.useRef(t);u.current=t;const s=Y.useRef({t:0,buf:null,staticKey:""}).current;function v(e,y,P){var r,g;const o=Math.max(16,Math.round(e*P)),n=Math.max(16,Math.round(y*P));if(s.buf&&s.buf.bw===o&&s.buf.bh===n)return s.buf;if(typeof document>"u")return null;const a=document.createElement("canvas");a.width=o,a.height=n;const i=(g=(r=a.getContext("2d"))==null?void 0:r.createImageData)==null?void 0:g.call(r,o,n);return i?(s.buf={c:a,img:i,bw:o,bh:n},s.staticKey="",s.buf):null}function k(e,y,P,o,n){var m;const a=u.current,i=a.colors.length>=2?a.colors:["#000000","#ffffff"],r=4e4*(n.quality<.75?.5:1),g=Math.min(Math.min(1,Math.max(.05,a.resolution)),Math.sqrt(r/Math.max(1,y*P))),l=v(y,P,g);if(!l)return;a.animated&&(s.t+=o*.001*a.speed);const h=`${a.animated}|${i.join()}|${a.scale}|${a.octaves}|${a.persistence}|${a.timeOffsetY}|${l.bw}x${l.bh}`;if(a.animated||h!==s.staticKey){s.staticKey=h;const w=s.t,B=1.6*Math.max(.1,a.scale)/Math.min(l.bw,l.bh),F=Math.max(1,Math.min(6,Math.round(a.octaves))),X=Math.min(.9,Math.max(.1,a.persistence)),O=Array.from({length:256},(H,D)=>Fo(i,D/255)),_=l.img.data;for(let H=0;H<l.bh;H++)for(let D=0;D<l.bw;D++){const[W,A]=_a(D*B,H*B,w,F,X,a.timeOffsetY),T=O[Math.max(0,Math.min(255,((W-.5)*1.9+.5)*255))|0],E=A*18,x=(Math.random()-.5)*3,I=(H*l.bw+D)*4;_[I]=T[0]+E+x,_[I+1]=T[1]+E+x,_[I+2]=T[2]+E+x,_[I+3]=255}(m=l.c.getContext("2d"))==null||m.putImageData(l.img,0,0)}const b=e.globalCompositeOperation;e.globalCompositeOperation=a.blendMode||"source-over",e.imageSmoothingEnabled=!0,e.imageSmoothingQuality="high",e.drawImage(l.c,0,0,y,P),e.globalCompositeOperation=b}return To({onFrame:k})}const Ua={default:{colors:["#0d1117","#0d4f3c","#00ff87","#00cfff","#7C3AED"]},monochrome:{},aurora:{colors:["#0d1117","#0d4f3c","#00ff87","#00cfff","#7C3AED"],speed:.2,scale:.8,octaves:3},sunset:{colors:["#0a0010","#7C3AED","#dc2626","#f97316","#fbbf24"],speed:.15,scale:1.2,octaves:2},ocean:{colors:["#020f1a","#0891B2","#06b6d4","#67e8f9","#e0f2fe"],speed:.25,scale:.9,octaves:4},forest:{colors:["#0a1a0a","#166534","#15803d","#4ade80","#d1fae5"],speed:.2,scale:1.1,octaves:3},neon:{colors:["#050010","#7C3AED","#0891B2","#00ff87","#7C3AED"],speed:.4,scale:.7,octaves:3}},Hn=Y.forwardRef((t,u)=>{const{preset:s,colors:v,speed:k,scale:e,octaves:y,animated:P,blendMode:o,timeOffsetY:n,persistence:a,resolution:i,width:r,height:g,className:l,style:h}=t,f=Ua[s??"default"]||{},{canvasRef:b,canvas:m}=Va({colors:v??f.colors??["#0a0a0a","#2d2d2d","#6b7280","#d1d5db","#f5f5f5"],speed:k??f.speed??.25,scale:e??f.scale??1,octaves:y??f.octaves??3,animated:P??!0,blendMode:o??"source-over",timeOffsetY:n??.5,persistence:a??.5,resolution:i??.25});return Y.useImperativeHandle(u,()=>m,[m]),Mo.jsx(Io,{canvasRef:b,width:r,height:g,className:l,style:h})});Hn.displayName="NoiseGradient";const ge=new Uint8Array(512),De=new Uint8Array(256);for(let t=0;t<256;t++)De[t]=t;for(let t=255;t>0;t--){const u=Math.floor(Math.random()*(t+1));[De[t],De[u]]=[De[u],De[t]]}for(let t=0;t<512;t++)ge[t]=De[t&255];function Jt(t){return t*t*t*(t*(t*6-15)+10)}function bt(t,u,s){return t+s*(u-t)}function tt(t,u,s){const v=t&3,k=v<2?u:s,e=v<2?s:u;return(v&1?-k:k)+(v&2?-e:e)}function Qt(t,u){const s=Math.floor(t)&255,v=Math.floor(u)&255,k=t-Math.floor(t),e=u-Math.floor(u),y=Jt(k),P=Jt(e),o=ge[ge[s]+v],n=ge[ge[s]+v+1],a=ge[ge[s+1]+v],i=ge[ge[s+1]+v+1];return bt(bt(tt(o,k,e),tt(a,k-1,e),y),bt(tt(n,k,e-1),tt(i,k-1,e-1),y),P)}function Ka(t,u){const s=Y.useRef(u);s.current=u;const v=Y.useRef([]),k=Y.useRef(0),e=Y.useRef(0),y=Y.useRef(null),P=Y.useRef(null);Y.useEffect(()=>{var o;(o=y.current)==null||o.call(y)},[u.particleCount]),Y.useEffect(()=>{const o=t.current;if(!o)return;const n=o.parentElement;if(!n)return;const a=o.getContext("2d");let i=0,r=0;function g(){const{colors:F}=s.current;return{x:Math.random()*i,y:Math.random()*r,vx:0,vy:0,age:0,maxAge:Math.random()*120+60,color:F[Math.floor(Math.random()*F.length)]}}function l(){const{particleCount:F}=s.current;v.current=Array.from({length:F},g)}function h(F,X){const O=t.current,_=window.devicePixelRatio||1;O.width=Math.round(F*_),O.height=Math.round(X*_),O.style.width=`${F}px`,O.style.height=`${X}px`,a.scale(_,_),i=F,r=X,l()}y.current=()=>{i>0&&r>0&&l()};function f(F){const X=ye(F,o);if(!X)return b();s.current.interactive&&(P.current=X)}function b(){P.current=null}window.addEventListener("mousemove",f),document.addEventListener("mouseleave",b);const m=new ResizeObserver(F=>{const{width:X,height:O}=F[0].contentRect;X>0&&O>0&&h(X,O)});m.observe(n);const w=n.getBoundingClientRect();w.width>0&&w.height>0&&h(w.width,w.height);function B(){if(!s.current.animated){k.current=requestAnimationFrame(B);return}const{speed:F,noiseScale:X,fadeStrength:O,lineWidth:_,backgroundColor:H,timeSpeed:D,curl:W,attractRadius:A,attractStrength:T}=s.current;e.current+=D*.001;const E=e.current;H&&H!=="transparent"?(a.fillStyle=H,a.globalAlpha=O,a.fillRect(0,0,i,r),a.globalAlpha=1):(a.fillStyle=`rgba(0,0,0,${O})`,a.fillRect(0,0,i,r));const x=v.current,I=P.current;for(let M=0;M<x.length;M++){const p=x[M],R=p.x*X,c=p.y*X,d=Qt(R+E,c+E*.7)*Math.PI*4;let $=Math.cos(d),C=Math.sin(d);if(W){const L=Qt(R+100+E,c+E*.7);$+=-Math.sin(L*Math.PI*2)*.5,C+=Math.cos(L*Math.PI*2)*.5}const S=p.x,N=p.y;if(p.vx=p.vx*.9+$*F*.1,p.vy=p.vy*.9+C*F*.1,I){const L=I.x-p.x,G=I.y-p.y,q=Math.sqrt(L*L+G*G);if(q<A&&q>0){const j=(A-q)/A*T*.1;p.vx+=L/q*j,p.vy+=G/q*j}}p.x+=p.vx,p.y+=p.vy,p.age++;const z=Math.max(0,1-p.age/p.maxAge)*.7;a.beginPath(),a.moveTo(S,N),a.lineTo(p.x,p.y),a.strokeStyle=p.color,a.globalAlpha=z,a.lineWidth=_,a.stroke(),a.globalAlpha=1,(p.age>p.maxAge||p.x<0||p.x>i||p.y<0||p.y>r)&&(v.current[M]=g())}k.current=requestAnimationFrame(B)}return k.current=requestAnimationFrame(B),()=>{m.disconnect(),cancelAnimationFrame(k.current),window.removeEventListener("mousemove",f),document.removeEventListener("mouseleave",b)}},[t])}const Ja={default:{colors:["#0c4a6e","#0891B2","#06b6d4","#67e8f9","#e0f2fe"],backgroundColor:"#020f1a"},neon:{colors:["#7C3AED","#e0b0ff","#0891B2","#67e8f9"],backgroundColor:"#000000",speed:1.5,curl:!0},ocean:{colors:["#0c4a6e","#0891B2","#06b6d4","#67e8f9","#e0f2fe"],backgroundColor:"#020f1a",noiseScale:.003,speed:.8},lava:{colors:["#7f1d1d","#dc2626","#f97316","#fbbf24"],backgroundColor:"#0c0000",noiseScale:.004,speed:.6,curl:!1},forest:{colors:["#14532d","#15803d","#4ade80","#d9f99d"],backgroundColor:"#0a1a0a",speed:.7,curl:!0},monochrome:{colors:["#e2e8f0","#94a3b8","#475569"],backgroundColor:"#0f172a",speed:.8}},Yn=Y.forwardRef((t,u)=>{const{preset:s,particleCount:v,colors:k,speed:e,noiseScale:y,trailLength:P,fadeStrength:o,lineWidth:n,backgroundColor:a,animated:i,timeSpeed:r,curl:g,interactive:l,attractRadius:h,attractStrength:f,width:b,height:m,className:w,style:B}=t,F=Ja[s??"default"]||{},X=Y.useRef(null);return Y.useImperativeHandle(u,()=>X.current),Ka(X,{particleCount:v??F.particleCount??800,colors:k??F.colors??["#ffffff","#6b7280","#9ca3af"],speed:e??F.speed??1,noiseScale:y??F.noiseScale??.004,trailLength:P??.04,fadeStrength:o??P??.04,lineWidth:n??1,backgroundColor:a??F.backgroundColor??"#111111",animated:i??!0,timeSpeed:r??1,curl:g??F.curl??!1,interactive:l??!1,attractRadius:h??100,attractStrength:f??3}),Mo.jsx("div",{className:w,style:{width:b??"100%",height:m??"100%",display:"block",overflow:"hidden",...B},children:Mo.jsx("canvas",{ref:X,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});Yn.displayName="FlowField";const Zt=1600,on=["peony","chrysanthemum","willow","ring","palm","crossette","peony","chrysanthemum"],xe=(t,u,s)=>{const v=t.split(",").map(Number),k=u.split(",").map(Number);return v.map((e,y)=>Math.round(e+(k[y]-e)*s)).join(",")},$e=t=>t.startsWith("#")?xo(t):"255,255,255";function Qa(t,u){const s=Y.useRef(u);s.current=u;const v=Y.useRef([]),k=Y.useRef({w:0,h:0}),e=(y,P)=>{const{colors:o,shellSpeed:n}=s.current,{w:a,h:i}=k.current;if(!a||!i)return;const r=y??a*(.15+Math.random()*.7),g=P??i*(.12+Math.random()*.33),l=Math.max(20,s.current.gravity*3600*.3),h=Math.max(40,i-g),f=-Math.sqrt(2*l*h)*(.98+Math.random()*.04);v.current.push({x:r,y:i,vx:(Math.random()-.5)*30,vy:Math.min(f,-n*40),targetY:g,rgb:$e(o[Math.floor(Math.random()*o.length)]??"#ffffff"),kind:on[Math.floor(Math.random()*on.length)],trail:[]})};return Y.useEffect(()=>{const y=t.current;if(!y)return;const P=y.parentElement;if(!P)return;const o=y.getContext("2d");let n=0,a=0,i=1,r=0,g=[],l=[],h=[],f=[],b=.6;const m=new Map;function w(x){let I=m.get(x);if(I)return I;I=document.createElement("canvas"),I.width=I.height=32;const M=I.getContext("2d");if(!M||typeof M.createRadialGradient!="function")return null;const p=M.createRadialGradient(16,16,0,16,16,16);return p.addColorStop(0,`rgba(${x},0.9)`),p.addColorStop(.25,`rgba(${x},0.35)`),p.addColorStop(1,`rgba(${x},0)`),M.fillStyle=p,M.fillRect(0,0,32,32),m.set(x,I),I}const B=()=>({x:Math.random()*n,y:Math.random()*a*.8,r:.3+Math.random()*1.1,opacity:.35+Math.random()*.6,isGlowing:Math.random()<.25,tw:Math.random()*6});function F(){const{starCount:x}=s.current;l=Array.from({length:x},B),f=[];let I=-10;for(;I<n+10;){const M=18+Math.random()*46,p=a*(.05+Math.random()*.13)*(Math.random()<.12?1.7:1),R=[];for(let c=6;c<p-6;c+=7)for(let d=4;d<M-4;d+=6)Math.random()<.18&&R.push([d,c]);f.push({x:I,w:M,h:p,windows:R}),I+=M+Math.random()*4}}function X(x,I){i=Math.min(2,window.devicePixelRatio||1),y.width=Math.round(x*i),y.height=Math.round(I*i),y.style.width=`${x}px`,y.style.height=`${I}px`,n=x,a=I,k.current={w:n,h:a},F()}const O=new ResizeObserver(x=>{const{width:I,height:M}=x[0].contentRect;I>0&&M>0&&X(I,M)});O.observe(P);const _=P.getBoundingClientRect();_.width>0&&_.height>0&&X(_.width,_.height);function H(x){const I=y.getBoundingClientRect();e(x.clientX-I.left,Math.min(a*.75,x.clientY-I.top))}P.addEventListener("click",H);function D(x){g.length<Zt&&g.push({...x,trail:[]})}function W(x){const I=s.current,M=Math.max(12,I.particleCount),p=I.spread*68,R=I.particleSize,c=Math.max(.6,1.4/Math.max(.2,I.fadeSpeed/.015)),d=$e(I.colors[Math.floor(Math.random()*I.colors.length)]??"#ffffff"),$="255,196,92";h.push({x:x.x,y:x.y,rgb:x.rgb,life:1});const C=(S,N,z,L={})=>{for(let G=0;G<S;G++){const q=G/S*Math.PI*2+Math.random()*.08,j=N*(.92+Math.random()*.12);D({x:x.x,y:x.y,vx:Math.cos(q)*j,vy:Math.sin(q)*j,life:c*(.85+Math.random()*.3),max:c,rgb:z,size:R,drag:1.2,glitter:!1,split:!1,...L})}};switch(x.kind){case"willow":for(let S=0;S<M;S++){const N=Math.random()*Math.PI*2,z=p*Math.sqrt(Math.random())*.85;D({x:x.x,y:x.y,vx:Math.cos(N)*z,vy:Math.sin(N)*z,life:c*2.2,max:c*2.2,rgb:$,size:R*.9,drag:2.2,glitter:!0,split:!1})}break;case"ring":C(Math.round(M*.7),p,x.rgb),C(Math.round(M*.3),p*.45,d);break;case"palm":for(let S=0;S<7;S++){const N=-Math.PI/2+(S-3)*.42;for(let z=0;z<6;z++){const L=p*(.6+z*.08);D({x:x.x,y:x.y,vx:Math.cos(N)*L+(Math.random()-.5)*8,vy:Math.sin(N)*L,life:c*1.4,max:c*1.4,rgb:z%2?$:x.rgb,size:R*1.2,drag:1.4,glitter:z%2===1,split:!1})}}break;case"crossette":C(Math.max(10,Math.round(M*.18)),p*.75,x.rgb,{split:!0,life:c*.55,max:c*.55});break;case"chrysanthemum":for(let S=0;S<M;S++){const N=Math.random()*Math.PI*2,z=p*(.55+Math.random()*.5);D({x:x.x,y:x.y,vx:Math.cos(N)*z,vy:Math.sin(N)*z,life:c,max:c,rgb:Math.random()<.25?d:x.rgb,size:R,drag:1.3,glitter:Math.random()<.3,split:!1})}break;default:for(let S=0;S<M;S++){const N=Math.random()*2-1,z=Math.random()*Math.PI*2,L=Math.sqrt(1-N*N),G=p*(.9+Math.random()*.15);D({x:x.x,y:x.y,vx:Math.cos(z)*L*G,vy:N*G,life:c,max:c,rgb:Math.random()<.15?d:x.rgb,size:R,drag:1.3,glitter:!1,split:!1})}}}let A=0,T=0;function E(x){A=requestAnimationFrame(E);const I=T?Math.min(.05,(x-T)/1e3):1/60;if(T=x,r+=I,n===0)return;const M=s.current,p=M.gravity*3600*.3,R=Math.max(2,Math.min(24,Math.round(M.trailLength*1.6)));if(M.autoLaunch&&(b-=I,b<=0)){const z=Math.random()<.18?3:1;for(let L=0;L<z;L++)e();b=M.autoInterval/1e3*(.6+Math.random()*.7)}o.setTransform(i,0,0,i,0,0);const c=!M.backgroundColor||M.backgroundColor==="transparent",d=!M.showBackground||c;if(o.clearRect(0,0,n,a),d&&!c&&(o.fillStyle=`rgb(${$e(M.backgroundColor)})`,o.fillRect(0,0,n,a)),!d){const z=$e(M.backgroundColor),L=o.createLinearGradient(0,0,0,a);L.addColorStop(0,`rgb(${z})`),L.addColorStop(1,`rgb(${xe(z,"70,60,110",.35)})`),o.fillStyle=L,o.fillRect(0,0,n,a)}for(l.length>M.starCount&&(l.length=Math.max(0,M.starCount));l.length<M.starCount;)l.push(B());const $=$e(M.starColor);for(const z of M.showBackground?l:[]){const L=z.opacity*(.7+.3*Math.sin(r*2+z.tw));M.glowingStars&&z.isGlowing&&(o.fillStyle=`rgba(${$},${L*.15})`,o.beginPath(),o.arc(z.x,z.y,z.r*(2+M.starGlowBlur/3),0,Math.PI*2),o.fill()),o.fillStyle=`rgba(${$},${L})`,o.beginPath(),o.arc(z.x,z.y,z.r,0,Math.PI*2),o.fill()}o.globalCompositeOperation="lighter";for(let z=h.length-1;z>=0;z--){const L=h[z];if(L.life-=I*1.6,L.life<=0){h.splice(z,1);continue}if(d)continue;const G=Math.max(n,a)*.6,q=o.createRadialGradient(L.x,L.y,0,L.x,L.y,G);q.addColorStop(0,`rgba(${L.rgb},${.22*L.life*L.life})`),q.addColorStop(1,`rgba(${L.rgb},0)`),o.fillStyle=q,o.fillRect(0,0,n,a)}for(let z=v.current.length-1;z>=0;z--){const L=v.current[z];if(L.vy+=p*I,L.x+=L.vx*I,L.y+=L.vy*I,L.trail.push(L.x,L.y),L.trail.length>16&&L.trail.splice(0,2),Math.random()<.6&&D({x:L.x,y:L.y,vx:(Math.random()-.5)*30,vy:20+Math.random()*30,life:.35,max:.35,rgb:"255,210,150",size:.8,drag:3,glitter:!1,split:!1}),L.y<=L.targetY||L.vy>=0){v.current.splice(z,1),W(L);continue}o.strokeStyle=`rgba(${xe(L.rgb,"255,255,255",.6)},0.8)`,o.lineWidth=1.6,o.beginPath();for(let G=0;G<L.trail.length;G+=2)G?o.lineTo(L.trail[G],L.trail[G+1]):o.moveTo(L.trail[G],L.trail[G+1]);o.stroke(),o.fillStyle="rgba(255,240,210,1)",o.beginPath(),o.arc(L.x,L.y,2,0,Math.PI*2),o.fill()}const C=Math.pow(M.friction,I*60),S=[];o.lineCap="round";let N=0;for(let z=0;z<g.length;z++){const L=g[z];if(L.life-=I,L.life<=0){if(L.split)for(let V=0;V<4;V++){const K=V/4*Math.PI*2+Math.random()*.3;S.push({x:L.x,y:L.y,vx:Math.cos(K)*90,vy:Math.sin(K)*90,life:.8,max:.8,rgb:xe(L.rgb,"255,255,255",.3),size:L.size*.9,drag:1.4,glitter:!0,split:!1,trail:[]})}continue}const G=Math.pow(C,L.drag);L.vx*=G,L.vy=L.vy*G+p*I*(L.drag>2?.55:1),L.x+=L.vx*I,L.y+=L.vy*I,L.trail.push(L.x,L.y),L.trail.length>R*2&&L.trail.splice(0,2),g[N++]=L;const q=L.life/L.max;let j=Math.min(1,q*1.6);if(L.glitter&&q<.45&&(j*=Math.random()<.5?1:.1),L.trail.length>=4){o.strokeStyle=`rgba(${L.rgb},${j*.45})`,o.lineWidth=Math.max(.6,L.size*.9),o.beginPath(),o.moveTo(L.trail[0],L.trail[1]);for(let V=2;V<L.trail.length;V+=2)o.lineTo(L.trail[V],L.trail[V+1]);o.stroke()}if(M.glowEffect){const V=w(L.rgb);if(V){const K=L.size*(3+M.glowBlur/2.5);o.globalAlpha=j*.7,o.drawImage(V,L.x-K,L.y-K,K*2,K*2),o.globalAlpha=1}}o.fillStyle=`rgba(${xe(L.rgb,"255,255,255",.45)},${j})`,o.beginPath(),o.arc(L.x,L.y,Math.max(.5,L.size*(.6+q*.5)),0,Math.PI*2),o.fill()}g.length=N;for(const z of S)g.length<Zt&&g.push(z);if(o.globalCompositeOperation="source-over",!d){const z=$e(M.backgroundColor),L=h.reduce((q,j)=>Math.max(q,j.life),0),G=h.length?h[h.length-1].rgb:"255,255,255";o.fillStyle=`rgb(${xe(xe(z,"0,0,0",.55),G,L*.12)})`;for(const q of f)o.fillRect(q.x,a-q.h,q.w,q.h);o.fillStyle="rgba(255,206,120,0.75)";for(const q of f)for(const[j,V]of q.windows)o.fillRect(q.x+j,a-q.h+V,2.2,3)}}return A=requestAnimationFrame(E),()=>{O.disconnect(),cancelAnimationFrame(A),P.removeEventListener("click",H)}},[t]),{launch:e}}const Za={default:{colors:["#f43f5e","#f59e0b","#4ade80","#06b6d4","#ffd166","#ffffff"],particleCount:80,gravity:.08,glowEffect:!0,glowBlur:8,backgroundColor:"#04060f"},monochrome:{colors:["#ffffff","#e2e8f0","#6b7280","#9ca3af"],particleCount:80,gravity:.08,glowEffect:!0,glowBlur:8,backgroundColor:"#111111"},celebration:{colors:["#f43f5e","#f59e0b","#4ade80","#06b6d4","#7C3AED","#ffffff"],particleCount:120,gravity:.06,spread:6,glowEffect:!0,glowBlur:12,backgroundColor:"#050010"},subtle:{colors:["#94a3b8","#cbd5e1","#e2e8f0"],particleCount:50,gravity:.1,spread:3.5,glowEffect:!1,backgroundColor:"#0f172a"},neon:{colors:["#00ffff","#ff00ff","#00ff41","#ff6600"],particleCount:100,gravity:.05,spread:7,glowEffect:!0,glowBlur:20,backgroundColor:"#000000"},golden:{colors:["#fbbf24","#f59e0b","#d97706","#ffffff","#fef3c7"],particleCount:90,gravity:.07,spread:5,glowEffect:!0,glowBlur:15,backgroundColor:"#0c0500"}},_n=Y.forwardRef((t,u)=>{const{preset:s,colors:v,particleCount:k,gravity:e,friction:y,fadeSpeed:P,particleSize:o,trailLength:n,spread:a,autoLaunch:i,autoInterval:r,glowEffect:g,glowBlur:l,backgroundColor:h,showBackground:f,shellSpeed:b,starCount:m,starColor:w,glowingStars:B,starGlowBlur:F,width:X,height:O,className:_,style:H}=t,D=Za[s??"default"]||{},W=Y.useRef(null);return Y.useImperativeHandle(u,()=>W.current),Qa(W,{colors:v??D.colors??["#ffffff","#e2e8f0","#6b7280","#9ca3af"],particleCount:k??D.particleCount??80,gravity:e??D.gravity??.08,friction:y??D.friction??.97,fadeSpeed:P??D.fadeSpeed??.015,particleSize:o??D.particleSize??2,trailLength:n??D.trailLength??6,spread:a??D.spread??5,autoLaunch:i??!0,autoInterval:r??1800,glowEffect:g??D.glowEffect??!0,glowBlur:l??D.glowBlur??8,backgroundColor:h??D.backgroundColor??"#111111",showBackground:f??!0,shellSpeed:b??D.shellSpeed??12,starCount:m??80,starColor:w??"#ffffff",glowingStars:B??!1,starGlowBlur:F??8}),Mo.jsx("div",{className:_,style:{width:X??"100%",height:O??"100%",display:"block",overflow:"hidden",...H},children:Mo.jsx("canvas",{ref:W,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});_n.displayName="Fireworks";function ol(t,u){const s=Y.useRef(u);s.current=u;const v=Y.useRef(0),k=Y.useRef(0);Y.useEffect(()=>{const e=t.current;if(!e)return;const y=e.parentElement;if(!y)return;const P=e.getContext("2d");let o=0,n=0;function a(h,f){const b=t.current,m=window.devicePixelRatio||1;b.width=Math.round(h*m),b.height=Math.round(f*m),b.style.width=`${h}px`,b.style.height=`${f}px`,P.scale(m,m),o=h,n=f}const i=new ResizeObserver(h=>{const{width:f,height:b}=h[0].contentRect;f>0&&b>0&&a(f,b)});i.observe(y);const r=y.getBoundingClientRect();r.width>0&&r.height>0&&a(r.width,r.height);function g(h,f,b,m,w,B,F,X,O,_,H,D,W){const A=6+m*2,T=m/8*Math.PI*2,E=w*(1+m*.15);for(let x=0;x<F;x++){const I=x/F*Math.PI*2;for(let M=0;M<(X?2:1);M++){P.save(),P.translate(h,f),P.rotate(I+(M===1?Math.PI/F:0)),M===1&&P.scale(1,-1),P.beginPath();for(let p=0;p<=A*3;p++){const R=p/(A*3)*Math.PI*2,c=W*Math.sin(R*3+E+T),d=b*(.5+.5*Math.abs(Math.sin(R*(A/2)+E*.5))),$=(d+c*b*.15)*Math.cos(R),C=(d+c*b*.1)*Math.sin(R);p===0?P.moveTo($,C):P.lineTo($,C)}P.closePath(),_&&(P.shadowColor=B,P.shadowBlur=H),P.strokeStyle=B,P.lineWidth=O*(1-m*.08),P.globalAlpha=D*(1-m*.1),P.stroke(),P.shadowBlur=0,P.globalAlpha=1,P.restore()}}}function l(){const{symmetry:h,colors:f,lineWidth:b,speed:m,layers:w,radius:B,backgroundColor:F,animated:X,glowEffect:O,glowBlur:_,strokeOpacity:H,mirror:D,noiseAmount:W}=s.current;X&&(k.current+=m*.005);const A=k.current;P.clearRect(0,0,o,n),F&&F!=="transparent"&&(P.fillStyle=F,P.fillRect(0,0,o,n));const T=o/2,E=n/2,x=Math.min(o,n)*.45*B;for(let I=0;I<w;I++){const M=x*(1-I*(.85/w)),p=f[I%f.length];g(T,E,M,I,A+I*.3,p,h,D,b,O,_,H,W)}v.current=requestAnimationFrame(l)}return v.current=requestAnimationFrame(l),()=>{i.disconnect(),cancelAnimationFrame(v.current)}},[t])}const el={default:{symmetry:8,colors:["#f43f5e","#fb7185","#fda4af","#fbbf24"],lineWidth:1.5,speed:1,layers:5,glowEffect:!0,glowBlur:10,strokeOpacity:.8,mirror:!0,noiseAmount:.3,backgroundColor:"#0c0005"},monochrome:{symmetry:8,colors:["#ffffff","#6b7280"],lineWidth:1.5,speed:1,layers:5,glowEffect:!0,glowBlur:10,strokeOpacity:.8,mirror:!0,noiseAmount:.3,backgroundColor:"#111111"},neon:{symmetry:12,colors:["#00ffff","#ff00ff","#7C3AED","#00ff41"],lineWidth:1,speed:1.5,layers:6,glowEffect:!0,glowBlur:20,strokeOpacity:.9,mirror:!0,noiseAmount:.5,backgroundColor:"#000000"},lotus:{symmetry:6,colors:["#f43f5e","#fb7185","#fda4af","#fbbf24"],lineWidth:2,speed:.5,layers:4,glowEffect:!0,glowBlur:8,strokeOpacity:.7,mirror:!0,noiseAmount:.2,backgroundColor:"#0c0005"},cosmic:{symmetry:16,colors:["#6366f1","#8b5cf6","#a78bfa","#c4b5fd","#ddd6fe"],lineWidth:.8,speed:.8,layers:7,glowEffect:!0,glowBlur:15,strokeOpacity:.6,mirror:!1,noiseAmount:.6,backgroundColor:"#030014"},minimal:{symmetry:6,colors:["#e2e8f0","#94a3b8"],lineWidth:1,speed:.3,layers:3,glowEffect:!1,strokeOpacity:.5,mirror:!0,noiseAmount:.1,backgroundColor:"#0f172a"}},Vn=Y.forwardRef((t,u)=>{const{preset:s,symmetry:v,colors:k,lineWidth:e,speed:y,layers:P,radius:o,backgroundColor:n,animated:a,glowEffect:i,glowBlur:r,strokeOpacity:g,mirror:l,noiseAmount:h,width:f,height:b,className:m,style:w}=t,B=el[s??"default"]||{},F=Y.useRef(null);return Y.useImperativeHandle(u,()=>F.current),ol(F,{symmetry:v??B.symmetry??8,colors:k??B.colors??["#ffffff","#6b7280"],lineWidth:e??B.lineWidth??1.5,speed:y??B.speed??1,layers:P??B.layers??5,radius:o??1,backgroundColor:n??B.backgroundColor??"#111111",animated:a??!0,glowEffect:i??B.glowEffect??!0,glowBlur:r??B.glowBlur??10,strokeOpacity:g??B.strokeOpacity??.8,mirror:l??B.mirror??!0,noiseAmount:h??B.noiseAmount??.3}),Mo.jsx("div",{className:m,style:{width:f??"100%",height:b??"100%",display:"block",overflow:"hidden",...w},children:Mo.jsx("canvas",{ref:F,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});Vn.displayName="Mandala";const Ue=(t,u,s)=>Math.max(u,Math.min(s,t));function Re(t,u,s,v){for(let k=1;k<t-1;k++)v[k]=s===2?-v[k+t]:v[k+t],v[k+(u-1)*t]=s===2?-v[k+(u-2)*t]:v[k+(u-2)*t];for(let k=1;k<u-1;k++)v[k*t]=s===1?-v[1+k*t]:v[1+k*t],v[t-1+k*t]=s===1?-v[t-2+k*t]:v[t-2+k*t];v[0]=.5*(v[1]+v[t]),v[t-1]=.5*(v[t-2]+v[2*t-1]),v[(u-1)*t]=.5*(v[1+(u-1)*t]+v[(u-2)*t]),v[t*u-1]=.5*(v[t*u-2]+v[t*(u-1)-1])}function Ct(t,u,s,v,k,e,y){const P=y*e*t*u;if(P<=0){v.set(k);return}const o=1+4*P;for(let n=0;n<4;n++){for(let a=1;a<u-1;a++)for(let i=1;i<t-1;i++){const r=i+a*t;v[r]=(k[r]+P*(v[r-1]+v[r+1]+v[r-t]+v[r+t]))/o}Re(t,u,s,v)}}function vt(t,u,s,v,k,e,y,P){for(let o=1;o<u-1;o++)for(let n=1;n<t-1;n++){const a=n+o*t,i=Ue(n-P*e[a],.5,t-1.5),r=Ue(o-P*y[a],.5,u-1.5),g=Math.floor(i),l=Math.floor(r),h=i-g,f=r-l,b=1-h,m=1-f,w=g+l*t;v[a]=b*(m*k[w]+f*k[w+t])+h*(m*k[w+1]+f*k[w+1+t])}Re(t,u,s,v)}function en(t){const{W:u,H:s,u:v,v:k,p:e,div:y}=t;for(let P=1;P<s-1;P++)for(let o=1;o<u-1;o++){const n=o+P*u;y[n]=-.5*(v[n+1]-v[n-1]+k[n+u]-k[n-u]),e[n]=0}Re(u,s,0,y),Re(u,s,0,e);for(let P=0;P<12;P++){for(let o=1;o<s-1;o++)for(let n=1;n<u-1;n++){const a=n+o*u;e[a]=(y[a]+e[a-1]+e[a+1]+e[a-u]+e[a+u])/4}Re(u,s,0,e)}for(let P=1;P<s-1;P++)for(let o=1;o<u-1;o++){const n=o+P*u;v[n]-=.5*(e[n+1]-e[n-1]),k[n]-=.5*(e[n+u]-e[n-u])}Re(u,s,1,v),Re(u,s,2,k)}function tl(t,u,s){const{W:v,H:k,u:e,v:y,curl:P}=t;for(let o=1;o<k-1;o++)for(let n=1;n<v-1;n++){const a=n+o*v;P[a]=.5*(y[a+1]-y[a-1]-(e[a+v]-e[a-v]))}for(let o=2;o<k-2;o++)for(let n=2;n<v-2;n++){const a=n+o*v;let i=.5*(Math.abs(P[a+1])-Math.abs(P[a-1])),r=.5*(Math.abs(P[a+v])-Math.abs(P[a-v]));const g=Math.hypot(i,r)+1e-5;i/=g,r/=g,e[a]+=u*r*P[a]*s,y[a]-=u*i*P[a]*s}}function nl(t,u){const s=t*u,v=()=>new Float32Array(s);let k=null,e=null,y=null;return typeof document<"u"&&(k=document.createElement("canvas"),k.width=t,k.height=u,e=k.getContext("2d"),y=e?e.createImageData(t,u):null),{W:t,H:u,u:v(),v:v(),u0:v(),v0:v(),r:v(),g:v(),b:v(),tmp:v(),p:v(),div:v(),curl:v(),c:k,ctx:e,img:y}}function rl(t){const u=Y.useRef(t);u.current=t;const s=Eo(),v=Y.useRef(null),k=Y.useRef({t:0,key:"",grid:null,nextBurst:.4,ci:0,lx:-1,ly:-1});function e(o,n,a,i,r,g,l,h){const f=Math.max(1,h),b=f*f,m=Math.max(1,Math.floor(n-f*2)),w=Math.min(o.W-2,Math.ceil(n+f*2)),B=Math.max(1,Math.floor(a-f*2)),F=Math.min(o.H-2,Math.ceil(a+f*2));for(let X=B;X<=F;X++)for(let O=m;O<=w;O++){const _=(O-n)**2+(X-a)**2,H=Math.exp(-_/b);if(H<.01)continue;const D=O+X*o.W;o.r[D]+=g[0]*l*H,o.g[D]+=g[1]*l*H,o.b[D]+=g[2]*l*H,o.u[D]+=i*H,o.v[D]+=r*H}}function y(o,n,a,i){const r=u.current,g=k.current,l=Math.min(.033,i/1e3);g.t+=l;const h=g.t,f=Ue(Math.round(r.resolution),32,128),b=Math.max(.2,Math.min(5,n/Math.max(1,a))),m=Math.max(8,Math.round(f*Math.sqrt(b))),w=Math.max(8,Math.round(f/Math.sqrt(b))),B=`${m}x${w}`;(g.key!==B||!g.grid)&&(g.key=B,g.grid=nl(m,w));const F=g.grid,X=n/m,O=(r.inkColors.length?r.inkColors:["#ffffff"]).map(d=>Po(d).split(",").map($=>Number($)/255)),_=d=>{const $=(d%O.length+O.length)%O.length,C=Math.floor($),S=$-C,N=O[C],z=O[(C+1)%O.length];return[N[0]+(z[0]-N[0])*S,N[1]+(z[1]-N[1])*S,N[2]+(z[2]-N[2])*S]};if(r.autoInk){for(let d=0;d<3;d++){const $=h*.23+d*Math.PI*2/3,C=m*(.5+.3*Math.cos($)),S=w*(.5+.28*Math.sin($*1.6+d)),N=Math.atan2(w/2-S,m/2-C)+.7*Math.sin(h*.4+d*2);e(F,C,S,Math.cos(N)*55,Math.sin(N)*55,_(h*.12+d*1.3),6*l*4,Math.max(1,r.inkRadius*.3))}if(g.nextBurst-=l,g.nextBurst<=0){g.nextBurst=Math.max(.05,r.autoInkInterval/1e3)*(.6+Math.random()*.8);const d=m*(.15+Math.random()*.7),$=w*(.15+Math.random()*.7),C=Math.random()*Math.PI*2;e(F,d,$,Math.cos(C)*40,Math.sin(C)*40,_(g.ci++),3,r.inkRadius)}}const H=zo(s.current,v.current);if(H.inside){const d=H.x/X,$=H.y/X;if(g.lx>=0){const C=d-g.lx,S=$-g.ly,N=Math.hypot(C,S);if(N>.05){const z=Math.min(8,Math.ceil(N));for(let L=1;L<=z;L++)e(F,g.lx+C*L/z,g.ly+S*L/z,C/l*r.mouseForce*.08,S/l*r.mouseForce*.08,_(g.ci*.15+h*.2),1.2/z,r.inkRadius*.7);g.ci+=N*.02}}g.lx=d,g.ly=$}else g.lx=g.ly=-1;for(const d of H.taps){const $=d.x/X,C=d.y/X;for(let S=0;S<10;S++){const N=S/10*Math.PI*2;e(F,$+Math.cos(N)*2,C+Math.sin(N)*2,Math.cos(N)*60*r.mouseForce*.2,Math.sin(N)*60*r.mouseForce*.2,_(g.ci+S*.1),.35,r.inkRadius*.6)}g.ci++}const{u:D,v:W,u0:A,v0:T,tmp:E}=F;A.set(D),T.set(W),Ct(m,w,1,D,A,r.viscosity,l),Ct(m,w,2,W,T,r.viscosity,l),tl(F,14,l),en(F),A.set(D),T.set(W),vt(m,w,1,D,A,A,T,l),vt(m,w,2,W,T,A,T,l),en(F);const x=Math.pow(Ue(r.dissipation,0,1),l*60);for(const d of[F.r,F.g,F.b]){E.set(d),Ct(m,w,0,d,E,r.diffusion,l),E.set(d),vt(m,w,0,d,E,D,W,l);for(let $=0;$<d.length;$++)d[$]*=x}const I=Math.pow(.999,l*60);for(let d=0;d<D.length;d++)D[d]*=I,W[d]*=I;if(o.globalCompositeOperation="source-over",o.globalAlpha=1,o.clearRect(0,0,n,a),r.backgroundColor&&r.backgroundColor!=="transparent"&&(o.fillStyle=r.backgroundColor,o.fillRect(0,0,n,a)),!F.img||!F.ctx||!F.c)return;const M=F.img.data,{r:p,g:R,b:c}=F;for(let d=0;d<w;d++)for(let $=0;$<m;$++){const C=$+d*m,S=p[C]+R[C]+c[C],N=$<m-1?p[C+1]+R[C+1]+c[C+1]:S,z=$>0?p[C-1]+R[C-1]+c[C-1]:S,L=d<w-1?p[C+m]+R[C+m]+c[C+m]:S,G=d>0?p[C-m]+R[C-m]+c[C-m]:S,q=Ue(1+(z-N+(G-L))*.9,.6,1.5),j=C*4;M[j]=255*(1-Math.exp(-p[C]*2.6))*q,M[j+1]=255*(1-Math.exp(-R[C]*2.6))*q,M[j+2]=255*(1-Math.exp(-c[C]*2.6))*q,M[j+3]=255*(1-Math.exp(-S*2.2))}F.ctx.putImageData(F.img,0,0),o.imageSmoothingEnabled=!0,o.imageSmoothingQuality="high",o.drawImage(F.c,0,0,n,a),r.glowEffect&&r.glowBlur>0&&typeof o.filter=="string"&&(o.save(),o.filter=`blur(${r.glowBlur}px)`,o.globalCompositeOperation="lighter",o.globalAlpha=.6,o.drawImage(F.c,0,0,n,a),o.restore())}const P=To({onFrame:y});return v.current=P.canvas,P}const al={default:{resolution:80,viscosity:1e-4,diffusion:1e-4,dissipation:.995,inkColors:["#0c4a6e","#0891B2","#06b6d4","#67e8f9"],glowEffect:!0,glowBlur:0,backgroundColor:"#020f1a",autoInk:!0,autoInkInterval:1500,mouseForce:5,inkRadius:4},monochrome:{resolution:80,viscosity:1e-4,diffusion:1e-4,dissipation:.995,inkColors:["#ffffff","#6b7280","#9ca3af"],glowEffect:!0,glowBlur:0,backgroundColor:"#111111",autoInk:!0,autoInkInterval:1500,mouseForce:5,inkRadius:4},ink:{resolution:80,viscosity:5e-5,diffusion:5e-5,dissipation:.998,inkColors:["#1e1b4b","#312e81","#4338ca","#6366f1"],backgroundColor:"#f8fafc",autoInk:!0,autoInkInterval:2e3,mouseForce:4,inkRadius:3},neon:{resolution:64,viscosity:1e-5,diffusion:1e-5,dissipation:.993,inkColors:["#00ffff","#ff00ff","#00ff41","#ff6600"],glowEffect:!0,backgroundColor:"#000000",autoInk:!0,mouseForce:8,inkRadius:5},lava:{resolution:64,viscosity:.001,diffusion:5e-4,dissipation:.99,inkColors:["#7f1d1d","#dc2626","#f97316","#fbbf24"],backgroundColor:"#0c0000",autoInk:!0,mouseForce:6,inkRadius:4},ocean:{resolution:80,viscosity:2e-4,diffusion:1e-4,dissipation:.997,inkColors:["#0c4a6e","#0891B2","#06b6d4","#67e8f9"],backgroundColor:"#020f1a",autoInk:!0,mouseForce:4,inkRadius:5},smoke:{resolution:72,viscosity:5e-5,diffusion:2e-4,dissipation:.994,inkColors:["#475569","#94a3b8","#cbd5e1","#e2e8f0"],backgroundColor:"#0f172a",autoInk:!0,autoInkInterval:800,mouseForce:3,inkRadius:6}},Un=Y.forwardRef((t,u)=>{const{preset:s,resolution:v,viscosity:k,diffusion:e,dissipation:y,inkColors:P,glowEffect:o,glowBlur:n,backgroundColor:a,autoInk:i,autoInkInterval:r,mouseForce:g,inkRadius:l,width:h,height:f,className:b,style:m}=t,w=al[s??"default"]||{},{canvasRef:B,canvas:F}=rl({resolution:v??w.resolution??128,viscosity:k??w.viscosity??1e-4,diffusion:e??w.diffusion??1e-4,dissipation:y??w.dissipation??.995,inkColors:P??w.inkColors??["#ffffff","#6b7280","#9ca3af"],glowEffect:o??w.glowEffect??!0,glowBlur:n??w.glowBlur??0,backgroundColor:a??w.backgroundColor??"#111111",autoInk:i??w.autoInk??!0,autoInkInterval:r??w.autoInkInterval??1500,mouseForce:g??w.mouseForce??5,inkRadius:l??w.inkRadius??4});return Y.useImperativeHandle(u,()=>F,[F]),Mo.jsx(Io,{canvasRef:B,width:h,height:f,className:b,style:m})});Un.displayName="FluidSimulation";const ie=(t,u,s)=>{const v=t.split(",").map(Number),k=u.split(",").map(Number);return v.map((e,y)=>Math.round(e+(k[y]-e)*s)).join(",")};function ll(t,u){const s=Y.useRef(u);s.current=u,Y.useEffect(()=>{const v=t.current;if(!v)return;const k=v.parentElement;if(!k)return;const e=v.getContext("2d");let y=0,P=0,o=1,n=0,a=[],i=[],r=[],g=[],l=[],h=[],f=0,b=6;const m=()=>P*.72;function w(W,A){W.z=Math.random(),W.x=Math.random()*(y+200)-100,W.y=A?-Math.random()*P*.3:Math.random()*P,W.len=.4+W.z*.8,W.v=.55+W.z*.65+Math.random()*.1}function B(){const W=s.current;a=Array.from({length:Math.max(0,W.dropCount)},()=>{const E={x:0,y:0,z:0,len:0,v:0};return w(E,!1),E}),g=Array.from({length:W.starCount},()=>({x:Math.random()*y,y:Math.random()*P*.45,r:.3+Math.random(),o:.2+Math.random()*.5,g:Math.random()<.25})),l=[];const A=Math.max(2,Math.round(y/260));for(let E=0;E<A;E++)l.push({x:(E+.5)/A*y+(Math.random()-.5)*60,h:P*(.2+Math.random()*.08),rgb:Math.random()<.7?"255,196,120":"150,210,255"});h=[];let T=-10;for(;T<y+10;){const E=26+Math.random()*60;h.push({x:T,w:E,h:P*(.08+Math.random()*.17)}),T+=E+Math.random()*6}}function F(W,A){o=Math.min(2,window.devicePixelRatio||1),v.width=Math.round(W*o),v.height=Math.round(A*o),v.style.width=`${W}px`,v.style.height=`${A}px`,y=W,P=A,B()}const X=new ResizeObserver(W=>{const{width:A,height:T}=W[0].contentRect;A>0&&T>0&&F(A,T)});X.observe(k);const O=k.getBoundingClientRect();O.width>0&&O.height>0&&F(O.width,O.height);let _=0,H=0;function D(W){_=requestAnimationFrame(D);const A=H?Math.min(.05,(W-H)/1e3):1/60;if(H=W,n+=A,y===0)return;const T=s.current;(a.length!==Math.max(0,T.dropCount)||g.length!==T.starCount)&&B();const E=xo(T.backgroundColor==="transparent"?"#000000":T.backgroundColor),x=xo(T.dropColor),I=xo(T.splashColor),M=m(),p=T.wind*(1+.45*Math.sin(n*T.windSpeed*.9)+.2*Math.sin(n*T.windSpeed*2.3));(T.dropCount>350||T.speed>20)&&(b-=A,b<=0&&(f=1,b=5+Math.random()*9)),f=Math.max(0,f-A*2.6);const c=f>0?f*(.6+.4*Math.sin(n*60)):0;e.setTransform(o,0,0,o,0,0),e.clearRect(0,0,y,P);const d=T.showBackground&&T.backgroundColor!=="transparent";if(!d&&T.backgroundColor!=="transparent"&&(e.fillStyle=`rgb(${E})`,e.fillRect(0,0,y,P)),d){const C=e.createLinearGradient(0,0,0,M);C.addColorStop(0,`rgb(${ie(E,"210,225,255",c*.35)})`),C.addColorStop(1,`rgb(${ie(ie(E,"120,110,140",.28),"210,225,255",c*.4)})`),e.fillStyle=C,e.fillRect(0,0,y,M);const S=xo(T.starColor);for(const L of g){const G=T.glowingStars&&L.g;G&&T.starGlowBlur>0&&(e.fillStyle=`rgba(${S},${L.o*.18})`,e.beginPath(),e.arc(L.x,L.y,L.r+T.starGlowBlur*.4,0,Math.PI*2),e.fill()),e.fillStyle=`rgba(${S},${L.o*(G?1:.6)})`,e.beginPath(),e.arc(L.x,L.y,L.r,0,Math.PI*2),e.fill()}e.fillStyle=`rgba(${ie(E,"40,46,70",.5)},0.95)`;for(const L of h)e.fillRect(L.x,M-L.h,L.w,L.h);const N=e.createLinearGradient(0,M-P*.22,0,M);N.addColorStop(0,`rgba(${ie(E,"150,160,190",.5)},0)`),N.addColorStop(1,`rgba(${ie(E,"150,160,190",.5)},0.45)`),e.fillStyle=N,e.fillRect(0,M-P*.22,y,P*.22);const z=e.createLinearGradient(0,M,0,P);z.addColorStop(0,`rgb(${ie(E,"90,96,120",.32)})`),z.addColorStop(1,`rgb(${ie(E,"0,0,0",.25)})`),e.fillStyle=z,e.fillRect(0,M,y,P-M),e.globalCompositeOperation="lighter";for(const L of l){e.fillStyle=`rgba(${ie(E,"20,20,26",.6)},1)`,e.fillRect(L.x-1.5,M-L.h,3,L.h);const G=M-L.h,q=e.createRadialGradient(L.x,G,0,L.x,G,P*.22);q.addColorStop(0,`rgba(${L.rgb},0.5)`),q.addColorStop(.25,`rgba(${L.rgb},0.14)`),q.addColorStop(1,`rgba(${L.rgb},0)`),e.fillStyle=q,e.fillRect(L.x-P*.22,G-P*.22,P*.44,P*.44),e.fillStyle=`rgba(${L.rgb},1)`,e.beginPath(),e.arc(L.x,G,3,0,Math.PI*2),e.fill();const j=e.createLinearGradient(0,M,0,P);j.addColorStop(0,`rgba(${L.rgb},0.38)`),j.addColorStop(1,`rgba(${L.rgb},0.04)`),e.fillStyle=j;for(let V=M;V<P;V+=3){const K=(V-M)/(P-M),to=Math.sin(V*.35+n*3+L.x)*(2+K*6),lo=3+K*16;e.fillRect(L.x-lo/2+to,V,lo,2)}}e.globalCompositeOperation="source-over"}const $=T.speed*60;e.lineCap="round";for(const C of a){const S=$*C.v;C.y+=S*A,C.x+=p*60*C.v*A;const N=M+C.z*(P-M)*.95;if(C.y>N){if(T.showSplashes&&(i.length<160&&Math.random()<.6&&i.push({x:C.x,y:N,life:1,size:.5+C.z}),C.z>.6&&r.length<200))for(let q=0;q<2;q++)r.push({x:C.x,y:N,vx:(Math.random()-.5)*60+p*20,vy:-(40+Math.random()*60),life:.35});w(C,!0);continue}C.x>y+100&&(C.x-=y+200),C.x<-100&&(C.x+=y+200);const z=T.dropLength*C.len,L=Math.atan2(S,p*60*C.v),G=T.dropOpacity*(.15+C.z*.7);e.strokeStyle=`rgba(${ie(x,"255,255,255",C.z*.25+c*.5)},${G})`,e.lineWidth=T.dropWidth*(.4+C.z*.8),e.beginPath(),e.moveTo(C.x,C.y),e.lineTo(C.x-Math.cos(L)*z,C.y-Math.sin(L)*z),e.stroke()}for(let C=i.length-1;C>=0;C--){const S=i[C];if(S.life-=A*1.8,S.life<=0){i.splice(C,1);continue}const N=(1-S.life)*14*S.size+1;e.strokeStyle=`rgba(${I},${S.life*.45})`,e.lineWidth=.8,e.beginPath(),e.ellipse(S.x,S.y,N,N*.28,0,0,Math.PI*2),e.stroke()}e.fillStyle=`rgba(${I},0.7)`;for(let C=r.length-1;C>=0;C--){const S=r[C];if(S.life-=A,S.life<=0){r.splice(C,1);continue}S.vy+=400*A,S.x+=S.vx*A,S.y+=S.vy*A,e.globalAlpha=S.life/.35,e.fillRect(S.x,S.y,1.2,1.2)}e.globalAlpha=1,d&&c>0&&(e.fillStyle=`rgba(220,230,255,${c*.12})`,e.fillRect(0,0,y,P))}return _=requestAnimationFrame(D),()=>{X.disconnect(),cancelAnimationFrame(_)}},[t])}const sl={default:{dropColor:"#a9c2e8",splashColor:"#dbe7ff",backgroundColor:"#0b1424"},monochrome:{dropColor:"#000000",splashColor:"#000000",backgroundColor:"#ffffff"},storm:{dropCount:500,speed:25,wind:1.5,windSpeed:1,dropOpacity:.8,dropLength:30,dropColor:"#94a3b8",splashColor:"#cbd5e1",backgroundColor:"#0a0a14"},drizzle:{dropCount:80,speed:8,wind:.1,dropOpacity:.3,dropLength:12,dropColor:"#7C3AED",splashColor:"#0891B2",backgroundColor:"#050010"},neon:{dropColor:"#00ffff",splashColor:"#ff00ff",backgroundColor:"#000000",dropOpacity:.7,dropWidth:1.5},golden:{dropColor:"#f59e0b",splashColor:"#fbbf24",backgroundColor:"#0a0500",dropOpacity:.65,dropLength:18}},Kn=Y.forwardRef((t,u)=>{const{preset:s,dropCount:v,speed:k,wind:e,windSpeed:y,dropLength:P,dropWidth:o,dropOpacity:n,dropColor:a,splashColor:i,showSplashes:r,backgroundColor:g,showBackground:l,starCount:h,starColor:f,glowingStars:b,starGlowBlur:m,width:w,height:B,className:F,style:X}=t,O=sl[s??"default"]||{},_=Y.useRef(null);return Y.useImperativeHandle(u,()=>_.current),ll(_,{dropCount:v??O.dropCount??200,speed:k??O.speed??15,wind:e??O.wind??.3,windSpeed:y??O.windSpeed??.5,dropLength:P??O.dropLength??28,dropWidth:o??O.dropWidth??1.5,dropOpacity:n??O.dropOpacity??.85,dropColor:a??O.dropColor??"#000000",splashColor:i??O.splashColor??"#000000",showSplashes:r??O.showSplashes??!0,backgroundColor:g??O.backgroundColor??"#ffffff",showBackground:l??!0,starCount:h??60,starColor:f??"#ffffff",glowingStars:b??!1,starGlowBlur:m??8}),Mo.jsx("div",{className:F,style:{width:w??"100%",height:B??"100%",display:"block",overflow:"hidden",...X},children:Mo.jsx("canvas",{ref:_,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});Kn.displayName="Rain";const tn=.11,il=4,nn=48;function Ot(t,u,s,v,k,e,y){if(k<=0){y.push({x:s,y:v});return}const P=Math.hypot(s-t,v-u),o=(t+s)/2+(Math.random()-.5)*e*P*.5,n=(u+v)/2+(Math.random()-.5)*e*P*.1;Ot(t,u,o,n,k-1,e,y),Ot(o,n,s,v,k-1,e,y)}const te=(t,u,s)=>{const v=t.split(",").map(Number),k=u.split(",").map(Number);return v.map((e,y)=>Math.round(e+(k[y]-e)*s)).join(",")},wt=t=>t.startsWith("#")?xo(t):"255,255,255";function cl(t,u){const s=Y.useRef(u);s.current=u,Y.useEffect(()=>{const v=t.current;if(!v)return;const k=v.parentElement;if(!k)return;const e=v.getContext("2d");let y=0,P=0,o=1,n=0,a=[],i=[],r=0,g=0,l=3,h=null,f=null,b="";const m=()=>P*.9,w=()=>P*.3;function B(c,d){b=`${y}|${P}|${c}|${d}`;const $=Math.max(1,Math.ceil(y/2)),C=Math.max(1,Math.ceil(P*.55/2));let S=7;const N=()=>((S=S*16807%2147483647)-1)/2147483646,z=Array.from({length:Math.max(40,Math.round(y/6))},()=>{const j=Math.pow(N(),.7)*.26;return{x:N()*y,y:j*P,r:Math.min(y,P)*(.04+N()*.07)*(.7+j*2),sx:1.6+N()*1.4}}),L=te(te(c,"70,72,92",.4),"0,0,0",.1),G=te(d,"255,255,255",.45),q=(j,V,K,to)=>{const lo=document.createElement("canvas");lo.width=$,lo.height=C;const ao=lo.getContext("2d");if(!ao||typeof ao.createRadialGradient!="function")return null;if(ao.scale(.5,.5),to>0){const ro=ao.createLinearGradient(0,0,0,P*.42);ro.addColorStop(0,`rgba(${j},${to})`),ro.addColorStop(.55,`rgba(${j},${to*.5})`),ro.addColorStop(1,`rgba(${j},0)`),ao.fillStyle=ro,ao.fillRect(0,0,y,P*.55)}for(const ro of z)for(const Q of[-y,0,y]){const so=ro.x+Q;if(so+ro.r*ro.sx<0||so-ro.r*ro.sx>y)continue;ao.save(),ao.translate(so,ro.y),ao.scale(ro.sx,1);const J=ao.createRadialGradient(0,ro.r*K,0,0,0,ro.r);J.addColorStop(0,`rgba(${j},${V})`),J.addColorStop(.5,`rgba(${j},${V*.5})`),J.addColorStop(1,`rgba(${j},0)`),ao.fillStyle=J,ao.fillRect(-ro.r,-ro.r,ro.r*2,ro.r*2),ao.restore()}return lo};h=q(L,.3,0,.7),f=q(G,.2,.5,0)}function F(){let c=3;const d=()=>((c=c*16807%2147483647)-1)/2147483646,$=d()*6,C=d()*6,S=d()*6;i=[];for(let N=0;N<=y+8;N+=8){const z=N/Math.max(1,y);i.push(m()-P*(.035*Math.sin(z*3.1+$)+.02*Math.sin(z*7.3+C)+.008*Math.sin(z*19+S)+.03))}}function X(c,d){o=Math.min(2,window.devicePixelRatio||1),v.width=Math.round(c*o),v.height=Math.round(d*o),v.style.width=`${c}px`,v.style.height=`${d}px`,y=c,P=d,F(),b=""}const O=new ResizeObserver(c=>{const{width:d,height:$}=c[0].contentRect;d>0&&$>0&&X(d,$)});O.observe(k);const _=k.getBoundingClientRect();_.width>0&&_.height>0&&X(_.width,_.height);function H(c,d,$,C,S,N){const z=[{x:c,y:d}];return Ot(c,d,$,C,S,N,z),z}function D(c,d){if(!y)return;const $=s.current,C=Math.max(1,Math.min(12,Math.round($.segments))),S=c??$.startX*y,N=$.startY*P,z=S+(Math.random()-.5)*y*.2,L=d??$.endY*P,G=H(S,N,z,L,C,$.roughness),q=[],j=$.branchChance*Math.min(1,256/G.length);for(let V=2;V<G.length-1&&q.length<nn;V++){if(Math.random()>=j)continue;const K=(Math.random()-.5)*Math.PI*.65,to=(L-G[V].y)*(.25+Math.random()*.4),lo=H(G[V].x,G[V].y,G[V].x+Math.sin(K)*to,G[V].y+Math.cos(K)*Math.abs(to),Math.max(2,C-2),$.roughness*.8);if(q.push({points:lo,energy:$.branchDecay*(.6+Math.random()*.4),at:V/G.length}),Math.random()<$.branchChance&&lo.length>4&&q.length<nn){const ao=Math.floor(lo.length*(.3+Math.random()*.4)),ro=K+(Math.random()-.5)*1.2,Q=Math.abs(to)*.45;q.push({points:H(lo[ao].x,lo[ao].y,lo[ao].x+Math.sin(ro)*Q,lo[ao].y+Math.cos(ro)*Q,Math.max(2,C-3),$.roughness*.7),energy:$.branchDecay*$.branchDecay*.8,at:(V+ao*.5)/G.length})}}a.push({main:G,branches:q,age:0,alpha:0,branchAlpha:0,strokes:0,nextStroke:tn,sx:S,ex:z,ey:L}),a.length>il&&a.shift()}let W=0;const A=()=>Math.max(.05,s.current.autoInterval/1e3)*(.5+Math.random());let T=A();D();function E(c){if(!s.current.interactive)return;const d=v.getBoundingClientRect();D(c.clientX-d.left,c.clientY-d.top)}v.addEventListener("click",E);function x(c,d){const $=Math.min(c.length,Math.max(0,Math.ceil(d)));if($<2)return!1;e.beginPath(),e.moveTo(c[0].x,c[0].y);for(let C=1;C<$;C++)e.lineTo(c[C].x,c[C].y);return!0}function I(c,d,$,C,S,N,z){if($<=.004||!x(c,d))return;const L=Math.max(0,z);L>0&&(e.strokeStyle=`rgba(${S},${$*.07})`,e.lineWidth=L*1.1*C,e.stroke(),e.strokeStyle=`rgba(${S},${$*.16})`,e.lineWidth=L*.4*C,e.stroke()),e.strokeStyle=`rgba(${S},${$*.65})`,e.lineWidth=2.6*C,e.stroke(),e.strokeStyle=`rgba(${N},${Math.min(1,$*1.1)})`,e.lineWidth=Math.max(.6,1.2*C),e.stroke()}let M=0,p=0;function R(c){M=requestAnimationFrame(R);const d=p?Math.min(.064,(c-p)/1e3):1/60;if(p=c,n+=d,y===0)return;const $=s.current;W+=d,W>=T&&(D(),W=0,T=A());for(const L of a){L.age+=d,L.alpha*=Math.exp(-d*11),L.branchAlpha*=Math.exp(-d*16);const G=Math.max(1,Math.round($.flickerCount));if(L.age>=L.nextStroke&&L.strokes<G){const q=L.strokes===0;if(L.strokes++,L.alpha=q?1:.65+Math.random()*.35,q)L.branchAlpha=1;else for(const j of L.main)j.x+=(Math.random()-.5)*1.5;L.nextStroke=L.age+.045+Math.random()*.09,L.alpha>r&&(g=L.sx),r=Math.max(r,L.alpha)}}a=a.filter(L=>L.strokes===0||L.alpha>.01||L.strokes<Math.max(1,Math.round($.flickerCount)));const C=!$.backgroundColor||$.backgroundColor==="transparent",S=wt($.color),N=wt($.coreColor);C||(l-=d,l<=0&&(l=Math.max(.6,$.autoInterval/1e3)*(.8+Math.random()*1.6),r<.2&&(r=.25+Math.random()*.2,g=y*(.1+Math.random()*.8)))),r*=Math.exp(-d*7),e.setTransform(o,0,0,o,0,0),e.globalCompositeOperation="source-over",e.clearRect(0,0,y,P),e.lineCap="round",e.lineJoin="round";let z="0,0,0";if(!C){z=wt($.backgroundColor);const L=e.createLinearGradient(0,0,0,P);L.addColorStop(0,`rgb(${te(te(z,"0,0,0",.25),S,r*.18)})`),L.addColorStop(.65,`rgb(${te(te(z,S,.06),S,r*.28)})`),L.addColorStop(1,`rgb(${te(te(z,S,.12),S,r*.35)})`),e.fillStyle=L,e.fillRect(0,0,y,P),b!==`${y}|${P}|${z}|${S}`&&B(z,S);const G=(n*6%y+y)%y;if(h&&(e.drawImage(h,G-y,0,y,P*.55),e.drawImage(h,G,0,y,P*.55)),e.globalCompositeOperation="lighter",r>.01){const q=Math.max(y,P)*.55,j=e.createRadialGradient(g,w()*.6,0,g,w()*.6,q);j.addColorStop(0,`rgba(${S},${r*.35})`),j.addColorStop(.4,`rgba(${S},${r*.1})`),j.addColorStop(1,`rgba(${S},0)`),e.fillStyle=j,e.fillRect(0,0,y,P),f&&(e.globalAlpha=Math.min(1,r*1.2),e.drawImage(f,G-y,0,y,P*.55),e.drawImage(f,G,0,y,P*.55),e.globalAlpha=1)}}e.globalCompositeOperation="lighter";for(const L of a){const G=Math.min(1,L.age/tn);if(L.strokes===0){const V=L.main.length*G;I(L.main,V,.28,.45,S,N,$.glowBlur*.3);for(const K of L.branches){const to=(G-K.at)/Math.max(.05,1-K.at);to>0&&I(K.points,K.points.length*Math.min(1,to*1.6),.2,K.energy*.45,S,N,$.glowBlur*.3)}continue}for(const V of L.branches)I(V.points,V.points.length,L.branchAlpha*Math.min(1,V.energy+.2),V.energy,S,N,$.glowBlur);I(L.main,L.main.length,L.alpha,1,S,N,$.glowBlur),I(L.main,L.main.length,Math.min(.12,L.alpha*.4+.04),.6,S,N,0);const q=Math.min(L.ey,m()),j=(40+$.glowBlur*3)*L.alpha;if(!C&&j>1){const V=e.createRadialGradient(L.ex,q,0,L.ex,q,j*2);V.addColorStop(0,`rgba(${te(N,S,.3)},${.5*L.alpha})`),V.addColorStop(1,`rgba(${S},0)`),e.fillStyle=V,e.fillRect(L.ex-j*2,q-j*2,j*4,j*4)}}e.globalCompositeOperation="source-over",!C&&i.length?(e.beginPath(),e.moveTo(0,P),i.forEach((L,G)=>e.lineTo(G*8,L)),e.lineTo(y,P),e.closePath(),e.fillStyle=`rgb(${te(te(z,"0,0,0",.7),S,r*.06)})`,e.fill(),r>.02&&(e.beginPath(),i.forEach((L,G)=>G?e.lineTo(G*8,L):e.moveTo(0,L)),e.strokeStyle=`rgba(${te(S,"255,255,255",.4)},${r*.45})`,e.lineWidth=1,e.stroke())):C&&r>.01&&(e.fillStyle=`rgba(255,255,255,${r*.3})`,e.fillRect(0,0,y,P))}return M=requestAnimationFrame(R),()=>{O.disconnect(),cancelAnimationFrame(M),v.removeEventListener("click",E)}},[t])}const fl={default:{color:"#c0c0ff",coreColor:"#ffffff",glowBlur:20,backgroundColor:"#050010"},monochrome:{color:"#6b7280",coreColor:"#ffffff",glowBlur:20,backgroundColor:"#111111"},neon:{color:"#00ffff",coreColor:"#ffffff",glowBlur:40,branchChance:.5,backgroundColor:"#000000",flickerCount:4},storm:{color:"#c0c0ff",coreColor:"#ffffff",branchChance:.4,roughness:.7,autoInterval:1e3,backgroundColor:"#050010",glowBlur:15},plasma:{color:"#ff00ff",coreColor:"#ffaaff",glowBlur:30,segments:10,backgroundColor:"#0a0010",branchChance:.35},subtle:{glowBlur:8,branchChance:.1,color:"#94a3b8",coreColor:"#e2e8f0",autoInterval:4e3,backgroundColor:"#0f172a",flickerCount:2}},Jn=Y.forwardRef((t,u)=>{const{preset:s,segments:v,roughness:k,branchChance:e,branchDecay:y,flickerCount:P,glowBlur:o,color:n,coreColor:a,backgroundColor:i,autoInterval:r,interactive:g,startX:l,startY:h,endY:f,width:b,height:m,className:w,style:B}=t,F=fl[s??"default"]||{},X=Y.useRef(null);return Y.useImperativeHandle(u,()=>X.current),cl(X,{segments:v??F.segments??8,roughness:k??F.roughness??.5,branchChance:e??F.branchChance??.1,branchDecay:y??F.branchDecay??.6,flickerCount:P??F.flickerCount??3,glowBlur:o??F.glowBlur??20,color:n??F.color??"#6b7280",coreColor:a??F.coreColor??"#ffffff",backgroundColor:i??F.backgroundColor??"#111111",autoInterval:r??F.autoInterval??2e3,interactive:g??F.interactive??!0,startX:l??F.startX??.5,startY:h??F.startY??0,endY:f??F.endY??1}),Mo.jsx("div",{className:w,style:{width:b??"100%",height:m??"100%",display:"block",overflow:"hidden",cursor:"crosshair",...B},children:Mo.jsx("canvas",{ref:X,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});Jn.displayName="Lightning";const nt=(t,u,s)=>Math.max(u,Math.min(s,t));function dl(t,u,s,v,k){let e=0;for(let y=0;y<v;y++)for(let P=0;P<s;P++){let o=0;for(let r=-1;r<=1;r++){let g=y+r;if(k)g=(g+v)%v;else if(g<0||g>=v)continue;for(let l=-1;l<=1;l++){if(!r&&!l)continue;let h=P+l;if(k)h=(h+s)%s;else if(h<0||h>=s)continue;t[g*s+h]&&o++}}const n=y*s+P,a=t[n],i=a?o===2||o===3?Math.min(255,a+1):0:o===3?1:0;u[n]=i,i&&e++}return e}const hl=[[1,0],[2,1],[0,2],[1,2],[2,2]];function ul(t,u){const s=Y.useRef(t);s.current=t;const v=Eo(),k=Y.useRef(null),e=Y.useRef({cols:0,rows:0,key:"",grid:new Uint8Array(0),next:new Uint8Array(0),prev:new Uint8Array(0),heat:new Float32Array(0),acc:0,paused:!1,history:[],lastPaint:-1}),y=Y.useRef(null);function P(i,r,g){const l=e.current;if(l.cols=i,l.rows=r,l.grid=new Uint8Array(i*r),l.next=new Uint8Array(i*r),l.prev=new Uint8Array(i*r),l.heat=new Float32Array(i*r),l.history=[],g)for(let h=0;h<l.grid.length;h++)l.grid[h]=Math.random()<s.current.initialDensity?1:0}function o(){const i=e.current;for(let r=0;r<3;r++){const g=Math.floor(Math.random()*Math.max(1,i.cols-3)),l=Math.floor(Math.random()*Math.max(1,i.rows-3)),h=Math.random()<.5,f=Math.random()<.5;for(const[b,m]of hl){const w=g+(h?2-b:b),B=l+(f?2-m:m);w<i.cols&&B<i.rows&&(i.grid[B*i.cols+w]=1)}}}u.current={randomize:()=>P(e.current.cols,e.current.rows,!0),clear:()=>P(e.current.cols,e.current.rows,!1),pause:()=>{e.current.paused=!0},resume:()=>{e.current.paused=!1},get canvas(){return k.current}};function n(i,r,g,l){const h=s.current,f=e.current,b=l/1e3,m=nt(h.cellSize,2,64),w=Math.max(1,Math.floor(r/m)),B=Math.max(1,Math.floor(g/m)),F=`${w}x${B}|${h.initialDensity}`;f.key!==F&&(f.key=F,P(w,B,!0));const X=zo(v.current,k.current);if(h.interactive){const I=(M,p)=>{const R=Math.floor(M/m),c=Math.floor(p/m);return R>=0&&c>=0&&R<w&&c<B?c*w+R:-1};for(const M of X.taps){const p=I(M.x,M.y);p>=0&&(f.grid[p]=f.grid[p]?0:1,f.lastPaint=p)}if(X.down&&X.inside){const M=I(X.x,X.y);M>=0&&M!==f.lastPaint&&(f.grid[M]=1,f.lastPaint=M)}else f.lastPaint=-1}if(!f.paused&&h.speed>0){f.acc+=b*h.speed;let I=0;for(;f.acc>=1&&I<4;){f.acc-=1,I++,f.prev.set(f.grid);const M=dl(f.grid,f.next,w,B,h.wrapEdges);for(let p=0;p<f.grid.length;p++)f.prev[p]&&!f.next[p]&&(f.heat[p]=1);if([f.grid,f.next]=[f.next,f.grid],f.history.push(M),f.history.length>24&&f.history.shift(),f.history.length===24){const p=Math.min(...f.history),R=Math.max(...f.history);(R-p<=Math.max(3,R*.02)||M<w*B*.01)&&(o(),f.history=[])}}f.acc>1&&(f.acc=0)}const O=f.paused?1:nt(f.acc*1.6,0,1);for(let I=0;I<f.heat.length;I++)f.heat[I]>0&&(f.heat[I]=Math.max(0,f.heat[I]-b*1.1));const _=Po(h.aliveColor),H=Po(h.oldColor),D=Po(h.deadColor,"0,0,0"),W=Po(h.backgroundColor,"0,0,0"),A=I=>h.showAge?uo(_,H,nt((I-1)/24,0,1)):_;i.globalCompositeOperation="source-over",i.globalAlpha=1,i.fillStyle=`rgb(${W})`,i.fillRect(0,0,r,g);const T=(r-w*m)/2,E=(g-B*m)/2;if(m>=5){i.fillStyle=`rgba(${uo(D,"255,255,255",.08)},0.6)`;for(let I=0;I<B;I++)for(let M=0;M<w;M++)f.grid[I*w+M]||i.fillRect(T+M*m+m/2-.5,E+I*m+m/2-.5,1,1)}if(typeof document<"u"){let I=y.current;if(!I||I.c.width!==w||I.c.height!==B){const M=document.createElement("canvas");M.width=w,M.height=B;const p=M.getContext("2d");I=p?{c:M,g:p,img:p.createImageData(w,B)}:null,y.current=I}if(I){const M=I.img.data,p=_.split(",").map(Number),R=H.split(",").map(Number);for(let c=0;c<f.grid.length;c++){const d=f.grid[c],$=c*4;if(d){const C=h.showAge?nt((d-1)/24,0,1):0;M[$]=p[0]+(R[0]-p[0])*C,M[$+1]=p[1]+(R[1]-p[1])*C,M[$+2]=p[2]+(R[2]-p[2])*C,M[$+3]=(d===1?O:1)*200}else f.heat[c]>0?(M[$]=R[0],M[$+1]=R[1],M[$+2]=R[2],M[$+3]=f.heat[c]*110):M[$+3]=0}I.g.putImageData(I.img,0,0),i.imageSmoothingEnabled=!0,i.globalCompositeOperation="lighter",i.globalAlpha=.55,i.drawImage(I.c,T-m*1.5,E-m*1.5,w*m+m*3,B*m+m*3),i.globalAlpha=.9,i.drawImage(I.c,T,E,w*m,B*m),i.globalAlpha=1,i.globalCompositeOperation="source-over"}}const x=m*.38;for(let I=0;I<B;I++)for(let M=0;M<w;M++){const p=I*w+M,R=f.grid[p],c=T+M*m+m/2,d=E+I*m+m/2;if(R){const $=R===1?.35+.65*O:1;i.fillStyle=`rgb(${A(R)})`,m<5?i.fillRect(c-m/2,d-m/2,m,m):(i.beginPath(),i.arc(c,d,x*$,0,Math.PI*2),i.fill()),R===1&&m>=5&&(i.fillStyle=`rgba(255,255,255,${.55*(1-O*.6)})`,i.beginPath(),i.arc(c,d,x*.45*$,0,Math.PI*2),i.fill())}else f.heat[p]>.02&&m>=5&&(i.fillStyle=`rgba(${H},${f.heat[p]*.7})`,i.beginPath(),i.arc(c,d,x*f.heat[p]*.8,0,Math.PI*2),i.fill())}}const a=To({onFrame:n});return k.current=a.canvas,a}const gl={default:{aliveColor:"#00ff41",oldColor:"#004d14",deadColor:"#000000",backgroundColor:"#000000"},monochrome:{aliveColor:"#ffffff",oldColor:"#6b7280",deadColor:"#111111",backgroundColor:"#111111"},neon:{aliveColor:"#00ff41",oldColor:"#00ffff",deadColor:"#000000",backgroundColor:"#000000",cellSize:6},matrix:{aliveColor:"#00ff41",oldColor:"#004d14",deadColor:"#000000",backgroundColor:"#000000",cellSize:10},minimal:{aliveColor:"#ffffff",oldColor:"#94a3b8",deadColor:"#0f172a",backgroundColor:"#0f172a",showAge:!1},fire:{aliveColor:"#ff6b00",oldColor:"#ffff00",deadColor:"#050010",backgroundColor:"#050010",cellSize:5,speed:8}},Qn=Y.forwardRef((t,u)=>{const{preset:s,cellSize:v,speed:k,initialDensity:e,aliveColor:y,oldColor:P,deadColor:o,showAge:n,wrapEdges:a,interactive:i,backgroundColor:r,width:g,height:l,className:h,style:f}=t,b=gl[s??"default"]||{},m=Y.useRef(null);Y.useImperativeHandle(u,()=>({randomize:()=>{var B;return(B=m.current)==null?void 0:B.randomize()},clear:()=>{var B;return(B=m.current)==null?void 0:B.clear()},pause:()=>{var B;return(B=m.current)==null?void 0:B.pause()},resume:()=>{var B;return(B=m.current)==null?void 0:B.resume()},get canvas(){var B;return((B=m.current)==null?void 0:B.canvas)??null}}),[]);const{canvasRef:w}=ul({cellSize:v??b.cellSize??8,speed:k??b.speed??10,initialDensity:e??b.initialDensity??.3,aliveColor:y??b.aliveColor??"#ffffff",oldColor:P??b.oldColor??"#6b7280",deadColor:o??b.deadColor??"#111111",showAge:n??b.showAge??!0,wrapEdges:a??b.wrapEdges??!0,interactive:i??b.interactive??!0,backgroundColor:r??b.backgroundColor??"#111111"},m);return Mo.jsx(Io,{canvasRef:w,width:g,height:l,className:h,style:{cursor:"crosshair",...f}})});Qn.displayName="GameOfLife";function pl(t,u,s){const v=Math.hypot(t.vx,t.vy)||1,k=Math.hypot(u,s)||1;return(t.vx*u+t.vy*s)/(v*k)>-.7}function ml(t,u,s){let v=0,k=0,e=0,y=0,P=0,o=0,n=0,a=0,i=0;const r=s.separationRadius**2,g=s.alignmentRadius**2,l=s.cohesionRadius**2;for(const b of u){if(b===t)continue;const m=b.x-t.x,w=b.y-t.y,B=m*m+w*w;B>l&&B>g&&B>r||pl(t,m,w)&&(B<r&&B>0&&(v-=m/B,k-=w/B),B<g&&(e+=b.vx,y+=b.vy,n++),B<l&&(P+=b.x,o+=b.y,a++,i=Math.max(i,b.fear)))}let h=v*s.separationForce*25,f=k*s.separationForce*25;return n&&(h+=(e/n-t.vx)*s.alignmentForce,f+=(y/n-t.vy)*s.alignmentForce),a&&(h+=(P/a-t.x)*s.cohesionForce*.02,f+=(o/a-t.y)*s.cohesionForce*.02),[h,f,i*.93]}function yl(t){const u=Y.useRef(t);u.current=t;const s=Y.useRef({boids:[],t:0,w:0,h:0}).current,v=Eo(),k=Y.useRef(null);function e(){const o=Math.random()*Math.PI*2,n=u.current.maxSpeed*(.6+Math.random()*.4);return{x:Math.random()*s.w,y:Math.random()*s.h,vx:Math.cos(o)*n,vy:Math.sin(o)*n,z:.6+Math.random()*.4,flap:Math.random()*Math.PI*2,bank:0,fear:0,wander:Math.random()*100,trail:[]}}function y(o,n,a,i,r){const g=u.current,l=i/16.67;s.t+=i*.001;const h=s.t;r.overlay||(o.fillStyle=g.backgroundColor,o.fillRect(0,0,n,a));const f=g.count>0?Math.max(1,Math.ceil(g.count*r.quality)):0,b=s.boids;for(;b.length<f;)b.push(e());b.length>f&&(b.length=f);const m=Math.max(20,g.separationRadius,g.alignmentRadius,g.cohesionRadius),w=Math.ceil(n/m)+1,B=new Map;for(const D of b){const W=Math.floor(D.y/m)*w+Math.floor(D.x/m),A=B.get(W);A?A.push(D):B.set(W,[D])}const F=zo(v.current,k.current),X=g.interactive&&F.inside,O=[[n*(.5+.35*Math.sin(h*.11)),a*(.5+.3*Math.sin(h*.17+1))],[n*(.5+.35*Math.sin(h*.13+2.5)),a*(.5+.3*Math.cos(h*.09))]],_=[];for(const D of b){_.length=0;const W=Math.floor(D.x/m),A=Math.floor(D.y/m);for(let C=A-1;C<=A+1;C++)for(let S=W-1;S<=W+1;S++){const N=B.get(C*w+S);if(N)for(const z of N)_.push(z)}let[T,E,x]=ml(D,_,g);D.fear=Math.max(D.fear*Math.pow(.97,l),x),D.wander+=.05*l,T+=Math.cos(D.wander*1.3)*.02,E+=Math.sin(D.wander)*.02;const I=O[D.z>.8?0:1];if(T+=(I[0]-D.x)*4e-5*g.maxSpeed,E+=(I[1]-D.y)*4e-5*g.maxSpeed,X){const C=D.x-F.x,S=D.y-F.y,N=Math.hypot(C,S);if(N<g.mouseRadius){const z=(1-N/g.mouseRadius)*g.mouseForce;T+=C/(N||1)*z*4,E+=S/(N||1)*z*4,D.fear=1}}g.wrapEdges||(D.x<60&&(T+=(60-D.x)*.002),D.x>n-60&&(T-=(D.x-(n-60))*.002),D.y<60&&(E+=(60-D.y)*.002),D.y>a-60&&(E-=(D.y-(a-60))*.002));const M=Math.atan2(D.vy,D.vx);D.vx+=T*l,D.vy+=E*l;const p=g.maxSpeed*(1+D.fear*.8),R=g.maxSpeed*.45,c=Math.hypot(D.vx,D.vy)||1,d=Math.max(R,Math.min(p,c));D.vx=D.vx/c*d,D.vy=D.vy/c*d;const $=Math.atan2(Math.sin(Math.atan2(D.vy,D.vx)-M),Math.cos(Math.atan2(D.vy,D.vx)-M));if(D.bank+=(Math.max(-1,Math.min(1,$*10))-D.bank)*.15*l,D.flap+=(.25+D.fear*.35+Math.max(0,d-g.maxSpeed*.7)*.1)*l,D.x+=D.vx*l,D.y+=D.vy*l,g.wrapEdges){let C=!1;D.x<-10&&(D.x+=n+20,C=!0),D.x>n+10&&(D.x-=n+20,C=!0),D.y<-10&&(D.y+=a+20,C=!0),D.y>a+10&&(D.y-=a+20,C=!0),C&&(D.trail.length=0)}for(D.trail.push(D.x,D.y);D.trail.length>Math.max(0,g.trailLength)*2;)D.trail.splice(0,2)}if(g.trailLength>1&&g.trailOpacity>0){const D=[new Path2D,new Path2D,new Path2D];for(const W of b){const A=W.trail.length/2;for(let T=1;T<A;T++){const E=Math.min(2,Math.floor(T/A*3));D[E].moveTo(W.trail[(T-1)*2],W.trail[(T-1)*2+1]),D[E].lineTo(W.trail[T*2],W.trail[T*2+1])}}o.lineCap="round";for(let W=0;W<3;W++)o.strokeStyle=ko(g.color,g.trailOpacity*(.2+W*.35)),o.lineWidth=.6+W*.5,o.stroke(D[W])}const H=[new Path2D,new Path2D];for(const D of b){const W=Math.atan2(D.vy,D.vx),A=g.boidSize*D.z,T=Math.cos(W),E=Math.sin(W),x=(G,q)=>[D.x+G*T-q*E,D.y+G*E+q*T],I=Math.sin(D.flap),M=A*(1.1+.5*I),p=A*(.35-.25*I),R=M*(1+D.bank*.35),c=M*(1-D.bank*.35),d=H[D.z>.8?1:0],$=x(A*1.1,0),C=x(-A*.9,0),S=x(-p,-R),N=x(-p,c),z=x(A*.15,-A*.2),L=x(A*.15,A*.2);d.moveTo($[0],$[1]),d.lineTo(z[0],z[1]),d.lineTo(S[0],S[1]),d.lineTo(x(-A*.25,-A*.12)[0],x(-A*.25,-A*.12)[1]),d.lineTo(C[0],C[1]),d.lineTo(x(-A*.25,A*.12)[0],x(-A*.25,A*.12)[1]),d.lineTo(N[0],N[1]),d.lineTo(L[0],L[1]),d.closePath()}o.fillStyle=g.color,o.globalAlpha=.6,o.fill(H[0]),o.globalAlpha=1,o.fill(H[1])}const P=To({onResize:(o,n)=>{s.w=o,s.h=n,s.boids=Array.from({length:u.current.count},e)},onFrame:y});return k.current=P.canvas,P}const Ml={default:{color:"#0891B2",backgroundColor:"#030d1a"},monochrome:{color:"#ffffff",backgroundColor:"#111111"},birds:{color:"#94a3b8",backgroundColor:"#0f172a",trailLength:12,boidSize:7,count:60,maxSpeed:2.5},fish:{color:"#0891B2",backgroundColor:"#030d1a",alignmentRadius:40,cohesionForce:.05,trailLength:6,boidSize:5},swarm:{color:"#f59e0b",backgroundColor:"#050010",count:200,boidSize:4,trailLength:4,maxSpeed:4,separationRadius:15,alignmentRadius:35,cohesionRadius:40},neon:{color:"#00ffff",backgroundColor:"#000000",trailOpacity:.6,trailLength:15,boidSize:6}},Zn=Y.forwardRef((t,u)=>{const{preset:s,count:v,maxSpeed:k,separationRadius:e,alignmentRadius:y,cohesionRadius:P,separationForce:o,alignmentForce:n,cohesionForce:a,color:i,trailLength:r,trailOpacity:g,boidSize:l,backgroundColor:h,interactive:f,mouseRadius:b,mouseForce:m,wrapEdges:w,width:B,height:F,className:X,style:O}=t,_=Ml[s??"default"]||{},{canvasRef:H,canvas:D}=yl({count:v??_.count??80,maxSpeed:k??_.maxSpeed??3,separationRadius:e??_.separationRadius??25,alignmentRadius:y??_.alignmentRadius??50,cohesionRadius:P??_.cohesionRadius??60,separationForce:o??_.separationForce??.05,alignmentForce:n??_.alignmentForce??.05,cohesionForce:a??_.cohesionForce??.03,color:i??_.color??"#ffffff",trailLength:r??_.trailLength??8,trailOpacity:g??_.trailOpacity??.4,boidSize:l??_.boidSize??6,backgroundColor:h??_.backgroundColor??"#111111",interactive:f??_.interactive??!0,mouseRadius:b??_.mouseRadius??80,mouseForce:m??_.mouseForce??.2,wrapEdges:w??_.wrapEdges??!0});return Y.useImperativeHandle(u,()=>D,[D]),Mo.jsx(Io,{canvasRef:H,width:B,height:F,className:X,style:O})});Zn.displayName="Boids";const Ie=(t,u,s)=>Math.max(u,Math.min(s,t));function rt(t,u,s,v,k,e,y){for(let P=-y;P<=y;P++)for(let o=-y;o<=y;o++){if(o*o+P*P>y*y)continue;const n=(e+P+v)%v*s+(k+o+s)%s;t[n]=.5,u[n]=.25}}function bl(t){const u=Y.useRef(t);u.current=t;const s=Eo(),v=Y.useRef(null),k=Y.useRef({t:0,key:"",field:null,check:0,lastGX:-1,lastGY:-1});function e(o,n){const a=o*n,i=new Float32Array(a).fill(1),r=new Float32Array(a),g=Math.max(5,Math.floor(a/1e3));for(let b=0;b<g;b++)rt(i,r,o,n,Math.floor(Math.random()*o),Math.floor(Math.random()*n),Math.floor(2+Math.random()*5));let l=null,h=null,f=null;if(typeof document<"u"&&(l=document.createElement("canvas"),l.width=o,l.height=n,h=l.getContext("2d"),f=h?h.createImageData(o,n):null,f))for(let b=0;b<a;b++)f.data[b*4+3]=255;return{u:i,v:r,uNext:new Float32Array(a),vNext:new Float32Array(a),df:new Float32Array(a),dk:new Float32Array(a),gw:o,gh:n,c:l,g:h,img:f}}function y(o,n,a,i){const r=u.current,g=k.current;g.t+=i/1e3;const l=Ie(r.resolution,.1,1),h=Math.max(4,Math.round(n*l)),f=Math.max(4,Math.round(a*l)),b=`${h}x${f}`;(g.key!==b||!g.field)&&(g.key=b,g.field=e(h,f));const m=g.field,{u:w,v:B,uNext:F,vNext:X,df:O,dk:_}=m;if(Math.floor(g.t*4)!==Math.floor((g.t-i/1e3)*4)){const S=g.t*.05;for(let N=0;N<f;N++)for(let z=0;z<h;z++){const L=Math.sin(z/h*4.2+S)*Math.cos(N/f*3.1-S*.7),G=Math.sin((z+N)/(h+f)*5.3-S*1.3);O[N*h+z]=L*.0022,_[N*h+z]=G*.0011}}const H=zo(s.current,v.current);if(r.interactive){if(H.inside){const S=Math.floor(H.x/n*h),N=Math.floor(H.y/a*f);if(S!==g.lastGX||N!==g.lastGY){if(g.lastGX>=0){const z=Math.ceil(Math.hypot(S-g.lastGX,N-g.lastGY));for(let L=1;L<=z;L++)rt(w,B,h,f,Math.round(g.lastGX+(S-g.lastGX)*L/z),Math.round(g.lastGY+(N-g.lastGY)*L/z),H.down?3:1)}g.lastGX=S,g.lastGY=N}}else g.lastGX=g.lastGY=-1;for(const S of H.taps)rt(w,B,h,f,Math.floor(S.x/n*h),Math.floor(S.y/a*f),5)}const D=Ie(Math.round(r.speed),1,40),W=r.feedRate,A=r.killRate,T=r.diffusionU,E=r.diffusionV;for(let S=0;S<D;S++){for(let N=0;N<f;N++){const z=(N-1+f)%f*h,L=(N+1)%f*h,G=N*h;for(let q=0;q<h;q++){const j=G+q,V=(q-1+h)%h,K=(q+1)%h,to=w[G+V]+w[G+K]+w[z+q]+w[L+q]-4*w[j],lo=B[G+V]+B[G+K]+B[z+q]+B[L+q]-4*B[j],ao=W+O[j],ro=A+_[j],Q=w[j]*B[j]*B[j];F[j]=Ie(w[j]+T*to-Q+ao*(1-w[j]),0,1),X[j]=Ie(B[j]+E*lo+Q-(ao+ro)*B[j],0,1)}}w.set(F),B.set(X)}if(g.check+=i,g.check>2e3){g.check=0;let S=0;for(let N=0;N<B.length;N+=7)S+=B[N];if(S/(B.length/7)<.002)for(let N=0;N<6;N++)rt(w,B,h,f,Math.floor(Math.random()*h),Math.floor(Math.random()*f),4)}if(!m.img||!m.g||!m.c)return;const[x,I,M]=Po(r.colorA,"0,0,0").split(",").map(Number),[p,R,c]=Po(r.colorB).split(",").map(Number),d=m.img.data,$=-.6,C=-.8;for(let S=0;S<f;S++){const N=S>0?-h:0,z=S<f-1?h:0;for(let L=0;L<h;L++){const G=S*h+L,q=Ie(B[G]*3.5,0,1),j=(B[L<h-1?G+1:G]-B[L>0?G-1:G])*3.5,V=(B[G+z]-B[G+N])*3.5,K=j*$+V*C,to=Ie(.95-K*2.2,.35,1.35),lo=Math.pow(Math.max(0,-K*2.4-.25),3)*q*.75,ao=q*(1-q)*.5,ro=(1-w[G]*.12)*to,Q=G*4;d[Q]=Math.min(255,(x+(p-x)*q)*ro+lo*255+p*ao),d[Q+1]=Math.min(255,(I+(R-I)*q)*ro+lo*255+R*ao),d[Q+2]=Math.min(255,(M+(c-M)*q)*ro+lo*255+c*ao)}}m.g.putImageData(m.img,0,0),o.globalCompositeOperation="source-over",r.backgroundColor&&r.backgroundColor!=="transparent"&&(o.fillStyle=r.backgroundColor,o.fillRect(0,0,n,a)),o.imageSmoothingEnabled=!0,o.imageSmoothingQuality="high",o.drawImage(m.c,0,0,n,a)}const P=To({onFrame:y});return v.current=P.canvas,P}const Cl={default:{colorA:"#04121f",colorB:"#5eead4",backgroundColor:"#04121f"},monochrome:{},coral:{feedRate:.055,killRate:.062},spots:{feedRate:.035,killRate:.065},maze:{feedRate:.029,killRate:.057},waves:{feedRate:.014,killRate:.053,speed:6},neon:{feedRate:.055,killRate:.062,colorA:"#0a0a0a",colorB:"#00ffff",backgroundColor:"#0a0a0a"}},or=Y.forwardRef((t,u)=>{const{preset:s,feedRate:v,killRate:k,diffusionU:e,diffusionV:y,resolution:P,speed:o,colorA:n,colorB:a,backgroundColor:i,interactive:r,width:g,height:l,className:h,style:f}=t,b=Cl[s??"default"]||{},{canvasRef:m,canvas:w}=bl({feedRate:v??b.feedRate??.055,killRate:k??b.killRate??.062,diffusionU:e??b.diffusionU??.2,diffusionV:y??b.diffusionV??.1,resolution:P??b.resolution??.5,speed:o??b.speed??8,colorA:n??b.colorA??"#111111",colorB:a??b.colorB??"#ffffff",backgroundColor:i??b.backgroundColor??"#111111",interactive:r??!0});return Y.useImperativeHandle(u,()=>w,[w]),Mo.jsx(Io,{canvasRef:m,width:g,height:l,className:h,style:f})});or.displayName="ReactionDiffusion";const Te=(t,u,s)=>Math.max(u,Math.min(s,t));function vl(t,u){return t<0?Math.exp(t*22):Math.exp(-t/Math.max(.01,u))*(1-Math.exp(-t*45))}function wl(t){const u=Y.useRef(t);u.current=t;const s=Eo(),v=Y.useRef(null),k=Y.useRef(Vo()),e=Y.useRef({t:0,w:0,h:0,stars:[],nStars:-1,surge:0,stir:0,sx:-1,shoot:null}),y=Y.useRef(null);function P(n,a,i,r,g){const l=u.current,h=e.current,f=r/1e3,b=r/16.67;l.animated&&(h.t+=f*l.speed);const m=h.t,w=i*.74;if(h.w!==a||h.h!==i||h.nStars!==l.starCount){h.w=a,h.h=i,h.nStars=l.starCount;const x=Te(Math.round(l.starCount),0,2e3);h.stars=Array.from({length:x},()=>({x:Math.random()*a,y:Math.pow(Math.random(),1.3)*w,r:.3+Math.pow(Math.random(),3)*1.4,tw:Math.random()*10}))}const B=Po(l.backgroundColor,"0,0,0"),F=(l.colors.length?l.colors:["#ffffff"]).map(x=>Po(x)),X=zo(s.current,v.current),{vx:O,vy:_}=k.current(X,b);l.interactive&&X.inside&&X.y<w&&(h.stir=Math.min(1.5,h.stir+Math.hypot(O,_)*.006*b),h.sx=X.x/a),l.interactive&&X.taps.length&&(h.surge=1),h.stir*=Math.exp(-f*.8),h.surge*=Math.exp(-f*.6),n.globalCompositeOperation="source-over",n.globalAlpha=1;const H=n.createLinearGradient(0,0,0,w);H.addColorStop(0,`rgb(${uo(B,"0,0,0",.4)})`),H.addColorStop(1,`rgb(${uo(B,uo(F[0],"40,60,80",.6),.12)})`),n.fillStyle=H,n.fillRect(0,0,a,w+1);for(const x of h.stars){const I=.55+.45*Math.sin(h.t*.8*(l.animated?1:0)+x.tw*3+x.tw);n.fillStyle=`rgba(235,240,255,${I*(.4+.6*(1-x.y/w))})`,n.fillRect(x.x,x.y,x.r*1.4,x.r*1.4)}if(l.animated&&(!h.shoot&&Math.random()<f*.05&&(h.shoot={x:Math.random()*a,y:Math.random()*w*.4,vx:(Math.random()<.5?-1:1)*a*.6,vy:w*.25,age:0}),h.shoot)){const x=h.shoot;x.age+=f,x.x+=x.vx*f,x.y+=x.vy*f;const I=Math.max(0,1-x.age/.8);n.strokeStyle=`rgba(255,255,255,${I*.8})`,n.lineWidth=1.2,n.beginPath(),n.moveTo(x.x,x.y),n.lineTo(x.x-x.vx*.08,x.y-x.vy*.08),n.stroke(),x.age>.8&&(h.shoot=null)}const D=Math.round(110+110*g.quality),W=Math.max(32,Math.round(D*w/Math.max(1,a)*2.2));let A=y.current;if(typeof document<"u"&&(!A||A.c.width!==D||A.c.height!==W)){const x=document.createElement("canvas");x.width=D,x.height=W;const I=x.getContext("2d");A=I?{c:x,g:I,img:I.createImageData(D,W),acc:new Float32Array(D*W*3)}:null,y.current=A}if(A){const x=A.acc;x.fill(0);const I=Te(Math.round(l.layers),1,12),M=Te(l.waveAmplitude,0,1),p=Math.max(.1,l.waveFrequency),R=Te(l.intensity,0,2)*(1+h.surge*1.4);for(let d=0;d<I;d++){const $=F[d%F.length].split(",").map(Number),C=uo(F[(d+1)%F.length],"255,70,170",.35).split(",").map(Number),S=d*13.7,N=.36+d/Math.max(1,I-1||1)*.36+d%2*.04,z=.55+.45*(d/Math.max(1,I-1||1)),L=.22+d%3*.08;let G=0;for(let q=0;q<D;q++){const j=q/D,V=(yt(j*p*1.3+m*.05+S,3,S)-.5)*M*3.2+Math.sin(j*p*Math.PI*2+m*.25+S)*M*.5,K=(N+V)*W,to=q?Math.abs(K-G)/W*D*.04:0;G=K;const lo=.15+.85*Math.pow(Go(j*70+m*.9+S,S+3),3)*(.5+.5*Go(j*9-m*.4,S+5)),ao=Te(Go(j*2.2+m*.03+S,S+7)*2-.6,0,1);let ro=lo*ao*z*R*1.3*(1+Math.min(1.5,to));if(h.stir>.01&&h.sx>=0&&(ro*=1+h.stir*Math.exp(-(((j-h.sx)/.12)**2))*1.5),ro<.01)continue;const Q=L*(.7+.6*Go(j*25+S,S+9)),so=Math.max(0,Math.floor(K-Q*W*4)),J=Math.min(W-1,Math.ceil(K+6));for(let oo=so;oo<=J;oo++){const Z=(K-oo)/W,no=vl(Z,Q)*ro;if(no<.003)continue;const U=Te(Z/(Q*1.6),0,1),eo=(oo*D+q)*3;x[eo]+=($[0]+(C[0]-$[0])*U)*no,x[eo+1]+=($[1]+(C[1]-$[1])*U)*no,x[eo+2]+=($[2]+(C[2]-$[2])*U)*no}}}const c=A.img.data;for(let d=0,$=0;d<x.length;d+=3,$+=4){const C=x[d],S=x[d+1],N=x[d+2],z=Math.max(C,S,N);if(z<1){c[$+3]=0;continue}c[$]=C/z*255,c[$+1]=S/z*255,c[$+2]=N/z*255,c[$+3]=Math.min(255,z)}A.g.putImageData(A.img,0,0),n.globalCompositeOperation="lighter",n.imageSmoothingEnabled=!0,n.drawImage(A.c,0,0,a,w),n.globalAlpha=.35,n.drawImage(A.c,-a*.02,-w*.03,a*1.04,w*1.06),n.globalAlpha=1,n.globalCompositeOperation="source-over"}const T=uo(F[0],"255,255,255",.2);for(let x=0;x<2;x++){const I=i*(x?.1:.2),M=w;n.fillStyle=`rgb(${x?uo(B,"0,0,0",.6):uo(uo(B,F[0],.07),"40,50,70",.12)})`,n.beginPath(),n.moveTo(0,M+1);for(let p=0;p<=64;p++){const R=p/64*a;n.lineTo(R,M-yt(R/a*(x?5:2.5)+x*9,4,21+x)*I)}n.lineTo(a,M+1),n.closePath(),n.fill(),x||(n.strokeStyle=`rgba(${T},0.18)`,n.lineWidth=1,n.stroke())}n.fillStyle=`rgb(${uo(B,"0,0,0",.85)})`;for(let x=0;x<70;x++){const I=x*.618%1*a,M=i*(.03+x*.37%1*.05),p=M*.32;n.beginPath(),n.moveTo(I,w-M),n.lineTo(I-p,w+1),n.lineTo(I+p,w+1),n.closePath(),n.fill()}const E=n.createLinearGradient(0,w,0,i);E.addColorStop(0,`rgb(${uo(B,"0,0,0",.3)})`),E.addColorStop(1,`rgb(${uo(B,"0,0,0",.6)})`),n.fillStyle=E,n.fillRect(0,w,a,i-w),A&&(n.save(),n.beginPath(),n.rect(0,w,a,i-w),n.clip(),n.globalCompositeOperation="lighter",n.globalAlpha=.3,n.translate(0,w*2),n.scale(1,-1),n.drawImage(A.c,Math.sin(m*.7)*3,0,a,w),n.restore(),n.globalAlpha=1,n.globalCompositeOperation="source-over"),n.strokeStyle="rgba(255,255,255,0.05)",n.lineWidth=1;for(let x=0;x<10;x++){const I=w+(i-w)*(.1+x*.09),M=(x*.37+m*.01)%1*a;n.beginPath(),n.moveTo(M,I),n.lineTo(M+a*.15,I),n.stroke()}}const o=To({onFrame:P});return v.current=o.canvas,o}const kl={default:{colors:["#00ff88","#00ccff","#88ff00"],backgroundColor:"#050a0f"},monochrome:{},arctic:{colors:["#00ff88","#00ccff","#88ff00"],backgroundColor:"#050a0f"},solar:{colors:["#ff4400","#ff8800","#cc00ff"],backgroundColor:"#0a0005"},tropical:{colors:["#00ffcc","#0088ff","#00ff44"],backgroundColor:"#030a0a"},neon:{colors:["#ff00ff","#00ffff","#ff0088"],backgroundColor:"#000000",intensity:1},midnight:{colors:["#4400cc","#0033ff","#2200aa"],backgroundColor:"#000005"}},er=Y.forwardRef((t,u)=>{const{preset:s,colors:v,speed:k,intensity:e,layers:y,backgroundColor:P,waveAmplitude:o,waveFrequency:n,starCount:a,animated:i,interactive:r,width:g,height:l,className:h,style:f}=t,b=kl[s??"default"]||{},{canvasRef:m,canvas:w}=wl({colors:v??b.colors??["#ffffff","#6b7280","#9ca3af"],speed:k??b.speed??1,intensity:e??b.intensity??.8,layers:y??5,backgroundColor:P??b.backgroundColor??"#111111",waveAmplitude:o??.15,waveFrequency:n??2,starCount:a??80,animated:i??!0,interactive:r??!0});return Y.useImperativeHandle(u,()=>w,[w]),Mo.jsx(Io,{canvasRef:m,width:g,height:l,className:h,style:f})});er.displayName="AuroraBorealis";function Sl(t,u){for(t=Math.abs(Math.round(t)),u=Math.abs(Math.round(u));u>0;)[t,u]=[u,t%u];return t||1}function Rl(t,u){const s=Sl(t,u);return 2*Math.PI*(u/s)}function Pl(t,u){const s=Y.useRef(u);s.current=u;const v=Y.useRef(0);Y.useEffect(()=>{const k=t.current;if(!k)return;const e=k.parentElement;if(!e)return;const y=k.getContext("2d");let P=0,o=0,n=[],a=-1,i=-1,r=-1,g=-1,l=!0;function h(W,A){const T=P/2,E=o/2,x=T+(W.R-W.r)*Math.cos(A)+W.d*Math.cos((W.R-W.r)/W.r*A),I=E+(W.R-W.r)*Math.sin(A)-W.d*Math.sin((W.R-W.r)/W.r*A);return[x,I]}function f(W,A,T){const{outerRadius:E,innerRadius:x,penDistance:I}=s.current,p=Math.min(P,o)/2*E,c=A>1?(W/(A-1)-.5)*.12:0;let d,$;T?(d=p*Math.max(.05,x+c+(Math.random()-.5)*.08),$=d*Math.max(.05,I*(.85+Math.random()*.3))):(d=p*Math.max(.05,x+c),$=d*Math.max(.05,I)),d=Math.max(1,d),$=Math.max(.1,$);const C=Rl(p,d),S={t:0,prevX:0,prevY:0,R:p,r:d,d:$,fullPeriod:C},[N,z]=h(S,0);return S.prevX=N,S.prevY=z,S}function b(W){const{outerRadius:A,innerRadius:T,penDistance:E,layerCount:x}=s.current;n=[];for(let I=0;I<x;I++)n.push(f(I,x,W));a=A,i=T,r=E,g=x}function m(){const{backgroundColor:W}=s.current;y.globalCompositeOperation="source-over",y.globalAlpha=1,y.fillStyle=W,y.fillRect(0,0,P,o)}function w(W,A){const T=window.devicePixelRatio||1;P=W,o=A,k.width=Math.round(P*T),k.height=Math.round(o*T),k.style.width=`${P}px`,k.style.height=`${o}px`,y.setTransform(T,0,0,T,0,0),m(),l=!0,b(!1)}const B=new ResizeObserver(W=>{const{width:A,height:T}=W[0].contentRect;A>0&&T>0&&w(A,T)});B.observe(e);const F=e.getBoundingClientRect();F.width>0&&F.height>0&&w(F.width,F.height);let X=0;function O(W,A,T,E,x,I,M,p){y.strokeStyle=x,y.lineWidth=I,y.lineCap="round",M?(y.shadowColor=x,y.shadowBlur=p):y.shadowBlur=0,y.beginPath(),y.moveTo(W,A),y.lineTo(T,E),y.stroke()}function _(W,A,T,E,x){const I=Math.cos(x),M=Math.sin(x),p=T-W,R=E-A;return[W+p*I-R*M,A+p*M+R*I]}function H(W,A){const{colors:T}=s.current,E=T.length>0?T:["#ffffff"];return E[A%E.length]}function D(W){const A=X?Math.min(W-X,50):16;X=W;const{outerRadius:T,innerRadius:E,penDistance:x,layerCount:I,speed:M,backgroundColor:p,lineWidth:R,trailFade:c,animated:d,autoReset:$,symmetry:C,glowEffect:S,glowBlur:N}=s.current;if(!l&&(T!==a||E!==i||x!==r||I!==g)&&(b(!1),m()),l=!1,!d){v.current=requestAnimationFrame(D);return}c>0&&(y.globalCompositeOperation="source-over",y.globalAlpha=Math.min(1,c*(A/16)),y.fillStyle=p,y.fillRect(0,0,P,o),y.globalAlpha=1),y.globalCompositeOperation="source-over";const z=M*Math.PI/180*(A/16),L=Math.max(1,Math.ceil(z/.02)),G=z/L,q=P/2,j=o/2,V=2*Math.PI/C;let K=!1;for(let to=0;to<n.length;to++){const lo=n[to],ao=H(lo,to);for(let ro=0;ro<L;ro++){lo.t+=G;const[Q,so]=h(lo,lo.t);for(let J=0;J<C;J++){const oo=J*V,[Z,no]=_(q,j,lo.prevX,lo.prevY,oo),[U,eo]=_(q,j,Q,so,oo);O(Z,no,U,eo,ao,R,S,N)}lo.prevX=Q,lo.prevY=so}lo.t>=lo.fullPeriod&&$&&(K=!0)}S||(y.shadowBlur=0),y.globalCompositeOperation="source-over",K&&(b(!0),m()),v.current=requestAnimationFrame(D)}return v.current=requestAnimationFrame(D),()=>{B.disconnect(),cancelAnimationFrame(v.current)}},[t])}const xl={default:{colors:["#ff2244","#22aaff","#44ff88"],backgroundColor:"#050005"},monochrome:{},neon:{colors:["#00ffff","#ff00ff"],backgroundColor:"#000000",lineWidth:1.5,glowEffect:!0,glowBlur:15,trailFade:.005},prismatic:{colors:["#ff2244","#22aaff","#44ff88"],layerCount:3,symmetry:2,lineWidth:1,trailFade:.004,backgroundColor:"#050005"},mandala:{colors:["#ff00ff","#00ffff"],symmetry:6,layerCount:2,glowEffect:!0,glowBlur:12,trailFade:.002,backgroundColor:"#000000"},cosmic:{colors:["#ff4488","#44ffff","#ffff44","#44ff88"],layerCount:4,glowEffect:!0,glowBlur:10,trailFade:.002,backgroundColor:"#020008",lineWidth:1},minimal:{colors:["#ffffff"],speed:.5,lineWidth:.5,trailFade:.001}},tr=Y.forwardRef((t,u)=>{const{preset:s,outerRadius:v,innerRadius:k,penDistance:e,speed:y,colors:P,backgroundColor:o,lineWidth:n,trailFade:a,animated:i,autoReset:r,layerCount:g,symmetry:l,glowEffect:h,glowBlur:f,width:b,height:m,className:w,style:B}=t,F=xl[s??"default"]||{},X=Y.useRef(null);return Y.useImperativeHandle(u,()=>X.current),Pl(X,{outerRadius:v??.85,innerRadius:k??F.innerRadius??.4,penDistance:e??F.penDistance??.9,speed:y??F.speed??2,colors:P??F.colors??["#ffffff"],backgroundColor:o??F.backgroundColor??"#111111",lineWidth:n??F.lineWidth??1,trailFade:a??F.trailFade??.003,animated:i??!0,autoReset:r??!0,layerCount:g??F.layerCount??2,symmetry:l??F.symmetry??1,glowEffect:h??F.glowEffect??!1,glowBlur:f??F.glowBlur??10}),Mo.jsx("div",{className:w,style:{width:b??"100%",height:m??"100%",display:"block",overflow:"hidden",...B},children:Mo.jsx("canvas",{ref:X,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});tr.displayName="Spirograph";const Wo=0,ce=1,he=2,Ae=3,at=4;function Xe(t){const u=t.replace("#",""),s=u.length===3?u.split("").map(k=>k+k).join(""):u,v=parseInt(s,16)||0;return[v>>16&255,v>>8&255,v&255]}function $l(t,u){const s=Y.useRef(u);s.current=u;const v=Y.useRef(0),k=Y.useRef(null),e=Y.useRef(null),y=Y.useRef(null),P=Y.useRef(0),o=Y.useRef(0);Y.useEffect(()=>{const n=t.current;if(!n)return;const a=n.parentElement;if(!a)return;const i=n.getContext("2d");let r=0,g=0,l=null,h=null,f=null;function b(c,d){P.current=c,o.current=d,k.current=new Uint8Array(c*d),e.current=new Float32Array(c*d),y.current=new Uint8Array(c*d),l=new OffscreenCanvas(c,d),h=l.getContext("2d"),f=h.createImageData(c,d)}function m(c,d){const $=window.devicePixelRatio||1;r=c,g=d,n.width=Math.round(r*$),n.height=Math.round(g*$),n.style.width=`${r}px`,n.style.height=`${g}px`,i.setTransform($,0,0,$,0,0);const{cellSize:C}=s.current,S=Math.max(4,Math.floor(r/C)),N=Math.max(4,Math.floor(g/C));b(S,N)}const w=new ResizeObserver(c=>{const{width:d,height:$}=c[0].contentRect;d>0&&$>0&&m(d,$)});w.observe(a);const B=a.getBoundingClientRect();B.width>0&&B.height>0&&m(B.width,B.height);let F=!1;function X(c,d){const $=n.getBoundingClientRect(),C=c-$.left,S=d-$.top,N=P.current,z=o.current;return[Math.floor(C/r*N),Math.floor(S/g*z)]}function O(c,d){const $=k.current,C=e.current;if(!$||!C)return;const S=P.current,N=o.current,{brushSize:z,material:L}=s.current;for(let G=-z;G<=z;G++)for(let q=-z;q<=z;q++){if(q*q+G*G>z*z)continue;const j=c+q,V=d+G;if(j<0||j>=S||V<0||V>=N)continue;const K=V*S+j;L==="erase"?($[K]=Wo,C[K]=0):L==="sand"?($[K]=ce,y.current[K]=(A&3)<<6|(Math.random()*63|0)):L==="water"?$[K]=he:L==="fire"?($[K]=Ae,C[K]=1):L==="wall"&&($[K]=at)}}function _(c){s.current.interactive&&(F=!0,O(...X(c.clientX,c.clientY)))}function H(c){!s.current.interactive||!F||O(...X(c.clientX,c.clientY))}function D(){F=!1}function W(){F=!1}n.addEventListener("mousedown",_),n.addEventListener("mousemove",H),n.addEventListener("mouseup",D),n.addEventListener("mouseleave",W);let A=0;function T(){const c=k.current,d=e.current,$=y.current;if(!c||!d||!$)return;const C=(z,L)=>{const G=$[L];$[L]=$[z],$[z]=G},S=P.current,N=o.current;for(let z=N-1;z>=0;z--){const L=Math.random()<.5;for(let G=0;G<S;G++){const q=L?G:S-1-G,j=z*S+q,V=c[j];if(V===Wo||V===at)continue;const K=z+1<N,to=z-1>=0,lo=q-1>=0,ao=q+1<S;if(V===ce)if(K&&c[(z+1)*S+q]===Wo)c[(z+1)*S+q]=ce,c[j]=Wo,C(j,(z+1)*S+q);else if(K&&c[(z+1)*S+q]===he)c[(z+1)*S+q]=ce,c[j]=he,C(j,(z+1)*S+q);else{const ro=Math.random()<.5,Q=ro?-1:1,so=ro?1:-1,J=ro?lo:ao,oo=ro?ao:lo;K&&J&&c[(z+1)*S+(q+Q)]===Wo?(c[(z+1)*S+(q+Q)]=ce,c[j]=Wo,C(j,(z+1)*S+(q+Q))):K&&oo&&c[(z+1)*S+(q+so)]===Wo&&(c[(z+1)*S+(q+so)]=ce,c[j]=Wo,C(j,(z+1)*S+(q+so)))}else if(V===he)if(K&&c[(z+1)*S+q]===Wo)c[(z+1)*S+q]=he,c[j]=Wo;else{const ro=Math.random()<.5,Q=ro?-1:1,so=ro?1:-1,J=ro?lo:ao,oo=ro?ao:lo;J&&c[z*S+(q+Q)]===Wo?(c[z*S+(q+Q)]=he,c[j]=Wo):oo&&c[z*S+(q+so)]===Wo&&(c[z*S+(q+so)]=he,c[j]=Wo)}else if(V===Ae){if(d[j]-=.005+Math.random()*.01,d[j]<=0){c[j]=Wo,d[j]=0;continue}to&&c[(z-1)*S+q]===Wo&&Math.random()<.4&&(c[(z-1)*S+q]=Ae,d[(z-1)*S+q]=d[j]*(.7+Math.random()*.3)),to&&c[(z-1)*S+q]===ce&&Math.random()<.02&&(c[(z-1)*S+q]=Ae,d[(z-1)*S+q]=1);const ro=Math.random()<.5?-1:1;to&&(ro===-1?lo:ao)&&c[(z-1)*S+(q+ro)]===Wo&&Math.random()<.15&&(c[(z-1)*S+(q+ro)]=Ae,d[(z-1)*S+(q+ro)]=d[j]*.6),K&&c[(z+1)*S+q]===he&&(c[j]=Wo,c[(z+1)*S+q]=Wo,d[j]=0)}}}}let E=0,x=!1;function I(){const c=k.current,d=y.current;if(!c||!d)return;const $=P.current,C=o.current;E++,E%240===0&&(A=A+1&3);for(let S=0;S<3;S++){const N=Math.round($*(.2+S*.3+Math.sin(E*.004+S*2.1)*.12)),z=A+S&3;for(let L=0;L<3;L++){const G=N+(Math.random()*4|0)-1;if(G<0||G>=$)continue;const q=G;c[q]===Wo&&(c[q]=ce,d[q]=z<<6|(Math.random()*63|0))}}if(E%20===0){let S=C;for(let N=0;N<$;N+=3){let z=C-1;for(;z>=0&&c[z*$+N]!==Wo;)z--;S=Math.min(S,z+1)}S<C*.38?x=!0:S>C*.62&&(x=!1)}if(x){const S=(C-1)*$;for(let N=0;N<$;N++)c[S+N]===ce&&Math.random()<.35&&(c[S+N]=Wo)}}function M(){const c=k.current,d=e.current,$=y.current;if(!c||!d||!$||!f||!l||!h)return;const C=P.current,S=o.current,{sandColor:N,waterColor:z,fireColor:L,wallColor:G,backgroundColor:q}=s.current,j=Xe(q),V=Xe(N),K=(fo,mo,go)=>fo.map((po,yo)=>po+(mo[yo]-po)*go),to=[V,K(V,[246,232,196],.45),K(V,[150,96,30],.4),K(V,[176,74,38],.45)],[lo,ao,ro]=Xe(z),[Q,so,J]=Xe(L),[oo,Z,no]=Xe(G),U=f.data,eo=E*.06;for(let fo=0;fo<C;fo++){let mo=0;for(let go=0;go<S;go++){const po=go*C+fo,yo=po*4,vo=c[po],$o=go>0?c[po-C]:Wo;if(vo===Wo){U[yo+3]=0,mo=0;continue}if(U[yo+3]=255,vo===ce){const io=to[$[po]>>6],ho=.88+($[po]&63)/63*.22,Co=$o===Wo?1.16:Math.max(.72,1-mo*.006),bo=ho*Co;U[yo]=Math.min(255,io[0]*bo),U[yo+1]=Math.min(255,io[1]*bo),U[yo+2]=Math.min(255,io[2]*bo),mo++}else if(vo===he){const io=$o===Wo?.35:0,ho=.08*Math.sin(eo+fo*.35+go*.2);U[yo]=Math.min(255,lo*(.85+ho)+255*io*.5),U[yo+1]=Math.min(255,ao*(.85+ho)+255*io*.5),U[yo+2]=Math.min(255,ro*(.9+ho)+255*io*.5),U[yo+3]=225}else if(vo===Ae){const io=Math.max(0,Math.min(1,d[po]));U[yo]=Math.min(255,Q*(.6+io*.6)+80*io),U[yo+1]=Math.min(255,so*io+120*io*io),U[yo+2]=Math.min(255,J*io*.4+60*io*io*io)}else if(vo===at){const io=$o===at?1:1.2;U[yo]=Math.min(255,oo*io),U[yo+1]=Math.min(255,Z*io),U[yo+2]=Math.min(255,no*io)}}}h.putImageData(f,0,0);const co=i.createLinearGradient(0,0,0,g);co.addColorStop(0,`rgb(${K(j,[255,236,200],.08).map(Math.round).join(",")})`),co.addColorStop(1,`rgb(${j.join(",")})`),i.fillStyle=co,i.fillRect(0,0,r,g),i.imageSmoothingEnabled=!1,i.drawImage(l,0,0,r,g)}let p=0;function R(){for(s.current.autoPour&&I(),p=Math.min(8,p+Math.max(0,s.current.gravity));p>=1;)T(),p-=1;M(),v.current=requestAnimationFrame(R)}return v.current=requestAnimationFrame(R),()=>{w.disconnect(),cancelAnimationFrame(v.current),n.removeEventListener("mousedown",_),n.removeEventListener("mousemove",H),n.removeEventListener("mouseup",D),n.removeEventListener("mouseleave",W)}},[t,u.cellSize])}const Il={default:{sandColor:"#c8a85a",waterColor:"#0088cc",fireColor:"#ff4400",backgroundColor:"#1a1200",wallColor:"#6b4c1a"},monochrome:{},desert:{sandColor:"#c8a85a",backgroundColor:"#1a1200",wallColor:"#6b4c1a"},ocean:{waterColor:"#0088cc",backgroundColor:"#001a2e",wallColor:"#0a3a5a",material:"water"},inferno:{fireColor:"#ff4400",backgroundColor:"#0a0000",wallColor:"#2a0000",material:"fire"},neon:{sandColor:"#00ffff",waterColor:"#ff00ff",fireColor:"#ffff00",wallColor:"#00ff88",backgroundColor:"#050505"}},nr=Y.forwardRef((t,u)=>{const{preset:s,cellSize:v,brushSize:k,material:e,sandColor:y,waterColor:P,fireColor:o,wallColor:n,backgroundColor:a,interactive:i,gravity:r,autoPour:g,width:l,height:h,className:f,style:b}=t,m=Il[s??"default"]||{},w=Y.useRef(null);return Y.useImperativeHandle(u,()=>w.current),$l(w,{cellSize:v??4,brushSize:k??3,material:e??m.material??"sand",sandColor:y??m.sandColor??"#ffffff",waterColor:P??m.waterColor??"#6b7280",fireColor:o??m.fireColor??"#ffffff",wallColor:n??m.wallColor??"#4b5563",backgroundColor:a??m.backgroundColor??"#111111",interactive:i??!0,gravity:r??1,autoPour:g??!0}),Mo.jsx("div",{className:f,style:{width:l??"100%",height:h??"100%",display:"block",overflow:"hidden",cursor:"crosshair",...b},children:Mo.jsx("canvas",{ref:w,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});nr.displayName="SandSimulation";const Ce=(t,u,s)=>Math.max(u,Math.min(s,t)),Tl=18;function Al(t){const u=Y.useRef(t);u.current=t;const s=Eo(),v=Y.useRef(null),k=Y.useRef(Vo()),e=Y.useRef({t:0,w:0,h:0,key:"",sources:[],finger:{x:0,y:0,amp:0},grab:-1,downX:0,downY:0,moved:!1,wasDown:!1}),y=Y.useRef(null),P=Y.useRef({key:"",c:null});function o(a,i,r,g){const l=u.current,h=e.current,f=g/1e3;l.animated&&(h.t+=f*l.speed),(h.w!==i||h.h!==r)&&(h.w=i,h.h=r,h.sources=[{x:i*.35,y:r*.5,amp:1},{x:i*.65,y:r*.5,amp:1}]);const b=zo(s.current,v.current),{vx:m,vy:w}=k.current(b,g/16.67),B=(T,E)=>h.sources.findIndex(x=>Math.hypot(x.x-T,x.y-E)<Tl);if(l.interactive){b.down&&!h.wasDown&&b.inside&&(h.grab=B(b.x,b.y),h.downX=b.x,h.downY=b.y,h.moved=!1),b.down&&h.grab>=0&&h.sources[h.grab]&&(Math.hypot(b.x-h.downX,b.y-h.downY)>4&&(h.moved=!0),h.moved&&(h.sources[h.grab].x=Ce(b.x,0,i),h.sources[h.grab].y=Ce(b.y,0,r)));for(const x of b.taps){if(h.grab>=0&&h.moved)continue;const I=B(x.x,x.y);I>=0?h.sources.splice(I,1):h.sources.length<l.maxSources&&h.sources.push({x:x.x,y:x.y,amp:1})}b.down||(h.grab=-1),h.wasDown=b.down;const T=Math.hypot(m,w),E=b.inside&&h.grab<0?Ce(T/12,0,.8):0;h.finger.amp+=(E-h.finger.amp)*Math.min(1,f*(E>h.finger.amp?6:1.5)),b.inside&&(h.finger.x=b.x,h.finger.y=b.y)}else h.finger.amp=0;for(;h.sources.length>Math.max(0,Math.round(l.maxSources));)h.sources.pop();const F=h.finger.amp>.02?[...h.sources,h.finger]:h.sources,X=Ce(l.resolution,.1,1),O=Math.max(4,Math.round(i*X)),_=Math.max(4,Math.round(r*X));let H=y.current;if(typeof document<"u"&&(!H||H.c.width!==O||H.c.height!==_)){const T=document.createElement("canvas");T.width=O,T.height=_;const E=T.getContext("2d");H=E?{c:T,g:E,img:E.createImageData(O,_)}:null,y.current=H}const D=Po(l.colorLow,"0,0,0").split(",").map(Number),W=Po(l.colorHigh).split(",").map(Number),A=Po(l.backgroundColor,"0,0,0").split(",").map(Number);if(H){const T=H.img.data,E=2*Math.PI/Math.max(4,l.wavelength),x=E*60*h.t,I=i/O,M=r/_,p=.85/E,R=-.45,c=-.55,d=.7,$=Math.hypot(R,c,d+1),C=R/$,S=c/$,N=(d+1)/$;for(let z=0;z<_;z++)for(let L=0;L<O;L++){const G=(L+.5)*I,q=(z+.5)*M;let j=0,V=0,K=0,to=0;for(let fo=0;fo<F.length;fo++){const mo=F[fo],go=G-mo.x,po=q-mo.y,yo=Math.sqrt(go*go+po*po)+1e-6,vo=Math.exp(-l.decay*yo)*mo.amp,$o=E*yo-x;j+=vo*Math.cos($o);const io=-vo*Math.sin($o)*E/yo;V+=io*go,K+=io*po,to+=vo}const lo=1/Math.max(1,F.length);j*=lo,V*=lo,K*=lo,to*=lo;let ao=-V*p,ro=-K*p,Q=1;const so=Math.hypot(ao,ro,Q);ao/=so,ro/=so,Q/=so;const J=Ce(ao*R+ro*c+Q*d,0,1),oo=Math.pow(Math.max(0,ao*C+ro*S+Q*N),100),Z=Ce(to/.15,0,1),no=Z*Z*(3-2*Z),U=Ce(.5+j*.6,0,1),eo=.3+.9*J,co=(z*O+L)*4;for(let fo=0;fo<3;fo++){const mo=(D[fo]+(W[fo]-D[fo])*U)*eo+oo*255*.85;T[co+fo]=A[fo]+(mo-A[fo])*no}T[co+3]=255}H.g.putImageData(H.img,0,0),a.imageSmoothingEnabled=!0,a.imageSmoothingQuality="high",a.drawImage(H.c,0,0,i,r)}else a.fillStyle=l.backgroundColor,a.fillRect(0,0,i,r);if(l.showSources){P.current.key!==l.colorHigh&&(P.current={key:l.colorHigh,c:Yo(l.colorHigh.startsWith("#")?l.colorHigh:"#ffffff",64)});const T=Math.sin(h.t*60*(2*Math.PI)/Math.max(4,l.wavelength));for(const E of h.sources)P.current.c&&(a.globalCompositeOperation="lighter",a.globalAlpha=.6+.3*T,a.drawImage(P.current.c,E.x-22,E.y-22,44,44),a.globalAlpha=1,a.globalCompositeOperation="source-over"),a.fillStyle="rgba(255,255,255,0.9)",a.beginPath(),a.arc(E.x,E.y,3+T,0,Math.PI*2),a.fill(),a.strokeStyle=`rgba(${W.join(",")},0.6)`,a.lineWidth=1.2,a.beginPath(),a.arc(E.x,E.y,9,0,Math.PI*2),a.stroke()}}const n=To({onFrame:o});return v.current=n.canvas,n}const El={default:{colorHigh:"#88ccff",colorLow:"#001133"},monochrome:{},ripple:{colorHigh:"#88ccff",colorLow:"#001133",wavelength:100},plasma:{colorHigh:"#ff4400",colorLow:"#000033",wavelength:60,decay:.001},neon:{colorHigh:"#00ffff",colorLow:"#000000",wavelength:70},cosmic:{colorHigh:"#cc88ff",colorLow:"#050005",decay:.002}},rr=Y.forwardRef((t,u)=>{const{preset:s,maxSources:v,wavelength:k,speed:e,colorHigh:y,colorLow:P,backgroundColor:o,showSources:n,resolution:a,animated:i,decay:r,interactive:g,width:l,height:h,className:f,style:b}=t,m=El[s??"default"]||{},{canvasRef:w,canvas:B}=Al({maxSources:v??6,wavelength:k??m.wavelength??80,speed:e??1,colorHigh:y??m.colorHigh??"#ffffff",colorLow:P??m.colorLow??"#111111",backgroundColor:o??m.backgroundColor??"#111111",showSources:n??!1,resolution:a??.4,animated:i??!0,decay:r??m.decay??.003,interactive:g??!0});return Y.useImperativeHandle(u,()=>B,[B]),Mo.jsx(Io,{canvasRef:w,width:l,height:h,className:f,style:{cursor:"crosshair",...b}})});rr.displayName="WaveInterference";const zl=[[-1,-1],[0,-1],[1,-1],[-1,0],[1,0],[-1,1],[0,1],[1,1]],rn=[[-1,-1],[0,-1],[1,-1],[-1,0],[1,0],[-1,1],[0,1],[1,1]];function Ll(t,u){const s=Y.useRef(u);s.current=u;const v=Y.useRef(0);Y.useEffect(()=>{const k=t.current;if(!k)return;const e=k.parentElement;if(!e)return;const y=k.getContext("2d");let P=0,o=0,n=0,a=0,i=null,r=[],g=0;function l(E,x){return x*n+E}function h(E,x){return E<0||E>=n||x<0||x>=a?!1:i[l(E,x)]===1}function f(E,x){for(const[I,M]of zl)if(h(E+I,x+M))return!0;return!1}function b(E,x){E<0||E>=n||x<0||x>=a||(i[l(E,x)]=1)}function m(E,x){const{particleSize:I}=s.current;return[Math.floor(E/I),Math.floor(x/I)]}function w(E,x){const{particleSize:I}=s.current;return[E*I+I*.5,x*I+I*.5]}function B(){const{seedMode:E}=s.current;if(E==="bottom")return{x:Math.floor(Math.random()*n),y:0};const x=Math.random()*Math.PI*2,I=Math.min(g,Math.floor(Math.min(n,a)*.48)),M=n/2,p=a/2;return{x:Math.max(0,Math.min(n-1,Math.round(M+Math.cos(x)*I))),y:Math.max(0,Math.min(a-1,Math.round(p+Math.sin(x)*I)))}}function F(E,x,I){const[M,p]=w(E,x),{particleColor:R,walkerColor:c,particleSize:d,glowEffect:$,glowBlur:C}=s.current;$&&I?(y.shadowColor=R,y.shadowBlur=C):y.shadowBlur=0;const S=d*.5;y.fillStyle=I?R:c,y.beginPath(),y.arc(M,p,S,0,Math.PI*2),y.fill(),y.shadowBlur=0}function X(E,x){const[I,M]=w(E,x),{particleSize:p,backgroundColor:R}=s.current,c=p*.5+1;y.fillStyle=R,y.beginPath(),y.arc(I,M,c,0,Math.PI*2),y.fill()}function O(){const{seedMode:E}=s.current;if(i)if(E==="bottom")for(let x=0;x<n;x++)b(x,a-1),F(x,a-1,!0);else if(E==="ring"){const x=Math.floor(n/2),I=Math.floor(a/2),M=Math.max(2,Math.floor(Math.min(n,a)*.04));for(let p=0;p<Math.PI*2;p+=.15){const R=Math.round(x+Math.cos(p)*M),c=Math.round(I+Math.sin(p)*M);R>=0&&R<n&&c>=0&&c<a&&(b(R,c),F(R,c,!0))}}else{const x=Math.floor(n/2),I=Math.floor(a/2);b(x,I),F(x,I,!0)}}function _(E,x){const{particleSize:I,walkerCount:M}=s.current;n=Math.max(4,Math.floor(E/I)),a=Math.max(4,Math.floor(x/I)),i=new Uint8Array(n*a),g=Math.floor(Math.min(n,a)*.05),y.fillStyle=s.current.backgroundColor,y.fillRect(0,0,P,o),O(),r=[];for(let p=0;p<M;p++)r.push(B())}function H(E,x){const I=window.devicePixelRatio||1;P=E,o=x,k.width=Math.round(P*I),k.height=Math.round(o*I),k.style.width=`${P}px`,k.style.height=`${o}px`,y.setTransform(I,0,0,I,0,0),_(P,o)}const D=new ResizeObserver(E=>{const{width:x,height:I}=E[0].contentRect;x>0&&I>0&&H(x,I)});D.observe(e);const W=e.getBoundingClientRect();W.width>0&&W.height>0&&H(W.width,W.height);function A(E){if(!s.current.interactive||!i)return;const x=k.getBoundingClientRect(),I=E.clientX-x.left,M=E.clientY-x.top,[p,R]=m(I,M);p>=0&&p<n&&R>=0&&R<a&&(b(p,R),F(p,R,!0))}k.addEventListener("click",A);function T(){if(!i){v.current=requestAnimationFrame(T);return}const{stepsPerFrame:E,walkerCount:x,showWalkers:I,seedMode:M}=s.current;for(let p=0;p<E;p++)for(let R=0;R<r.length;R++){const c=r[R],d=c.x,$=c.y;I&&X(d,$);const C=rn[Math.floor(Math.random()*rn.length)];let S=c.x+C[0],N=c.y+C[1];if(S=Math.max(0,Math.min(n-1,S)),N=M==="bottom"?Math.max(0,Math.min(a-2,N)):Math.max(0,Math.min(a-1,N)),c.x=S,c.y=N,f(S,N)&&!h(S,N)){if(b(S,N),F(S,N,!0),M!=="bottom"){const z=n/2,L=a/2,G=Math.sqrt((S-z)**2+(N-L)**2);g=Math.min(Math.floor(Math.min(n,a)*.48),Math.max(g,Math.ceil(G)+3))}r.length<=x&&(r[R]=B())}else I&&F(S,N,!1)}v.current=requestAnimationFrame(T)}return v.current=requestAnimationFrame(T),()=>{D.disconnect(),cancelAnimationFrame(v.current),k.removeEventListener("click",A)}},[t,u.particleSize,u.seedMode])}const Fl={default:{particleColor:"#ff7043",walkerColor:"#ff7043",backgroundColor:"#0a0500"},monochrome:{},coral:{particleColor:"#ff7043",walkerColor:"#ff7043",backgroundColor:"#0a0500",glowEffect:!0,glowBlur:6},snowflake:{particleColor:"#a8d8ff",walkerColor:"#a8d8ff",backgroundColor:"#020510",seedMode:"center",glowEffect:!0,glowBlur:8},lightning:{particleColor:"#fffde7",walkerColor:"#fff59d",backgroundColor:"#050510",seedMode:"bottom",glowEffect:!0,glowBlur:10},neon:{particleColor:"#00ffcc",walkerColor:"#ff00ff",backgroundColor:"#000000",glowEffect:!0,glowBlur:12},frost:{particleColor:"#e0f7fa",walkerColor:"#80deea",backgroundColor:"#011820",seedMode:"ring",glowEffect:!0,glowBlur:6}},ar=Y.forwardRef((t,u)=>{const{preset:s,particleColor:v,walkerColor:k,backgroundColor:e,particleSize:y,walkerCount:P,stepsPerFrame:o,seedMode:n,showWalkers:a,glowEffect:i,glowBlur:r,interactive:g,width:l,height:h,className:f,style:b}=t,m=Fl[s??"default"]||{},w=Y.useRef(null);return Y.useImperativeHandle(u,()=>w.current),Ll(w,{particleColor:v??m.particleColor??"#ffffff",walkerColor:k??m.walkerColor??"#6b7280",backgroundColor:e??m.backgroundColor??"#111111",particleSize:y??m.particleSize??3,walkerCount:P??60,stepsPerFrame:o??20,seedMode:n??m.seedMode??"center",showWalkers:a??!1,glowEffect:i??m.glowEffect??!0,glowBlur:r??m.glowBlur??8,interactive:g??!0}),Mo.jsx("div",{className:f,style:{width:l??"100%",height:h??"100%",display:"block",overflow:"hidden",cursor:"crosshair",...b},children:Mo.jsx("canvas",{ref:w,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});ar.displayName="DiffusionAggregation";function an(t){let u=t.replace("#","");u.length===3&&(u=u.split("").map(v=>v+v).join(""));const s=parseInt(u.slice(0,6),16)||0;return[s>>16&255,s>>8&255,s&255]}function ln([t,u,s]){t/=255,u/=255,s/=255;const v=Math.max(t,u,s),k=Math.min(t,u,s),e=(v+k)/2;if(v===k)return[0,0,e];const y=v-k,P=e>.5?y/(2-v-k):y/(v+k);return[(v===t?(u-s)/y+(u<s?6:0):v===u?(s-t)/y+2:(t-u)/y+4)*60,P,e]}function ve(t,u,s){return`hsl(${(t%360+360)%360}, ${Math.round(Math.max(0,Math.min(1,u))*100)}%, ${Math.round(Math.max(0,Math.min(1,s))*100)}%)`}function Bl(t,u){const[s,v,k]=ln(an(t)),[e,y,P]=ln(an(u)),o=Math.max(.55,v),n=Math.max(.55,y),a=Math.min(.68,Math.max(.45,k)),i=Math.min(.62,Math.max(.4,P));return[ve(s,o,a),ve(e,n,i),ve(s+38,o,a),ve(s-32,o,a-.04),ve(e+42,n,i+.04),ve(e-30,n,i),ve(s+180,o*.8,.6)]}function Ol(t,u,s){return Array.from({length:t},()=>{const v=s()<.55?0:s()<.6?1:2,k=3+Math.floor(s()*3),e=[];for(let y=0;y<k;y++){const P=y/k*Math.PI*2+(s()-.5)*.9,o=.6+s()*.5;e.push([Math.cos(P)*o,Math.sin(P)*o])}return{kind:v,r0:.02+Math.pow(s(),.75)*1,a0:s(),drift:(s()-.5)*.12,wobble:.04+s()*.1,phase:s()*Math.PI*2,rot:s()*Math.PI*2,spin:(s()-.5)*.9,size:(v===1?.025+s()*.035:.05+s()*.11)*u,color:Math.floor(s()*7),verts:e}})}function Wl(t,u){const s=Y.useRef(u);s.current=u,Y.useEffect(()=>{const v=t.current;if(!v)return;const k=v,e=k.parentElement;if(!e)return;const y=k.getContext("2d"),P=document.createElement("canvas"),o=P.getContext("2d");let n=0,a=0,i=1,r=[],g="",l=[],h="",f=7;const b=()=>((f=f*16807%2147483647)-1)/2147483646;function m(D,W){i=Math.min(2,window.devicePixelRatio||1),k.width=Math.round(D*i),k.height=Math.round(W*i),k.style.width=`${D}px`,k.style.height=`${W}px`,n=D,a=W}const w=new ResizeObserver(D=>{const{width:W,height:A}=D[0].contentRect;W>0&&A>0&&m(W,A)});w.observe(e);const B=e.getBoundingClientRect();B.width>0&&B.height>0&&m(B.width,B.height);let F=0,X=0,O=0,_=0;function H(D){F=requestAnimationFrame(H);const W=X?Math.min(.05,(D-X)/1e3):1/60;if(X=D,n===0)return;const A=s.current;A.animated&&(O+=W*A.speed*.6,_+=A.rotation*Math.PI/180*W*60*.5);const T=Math.max(2,Math.round(A.segments)),E=Math.PI/T,x=Math.hypot(n,a)/2*(1.04+.06*Math.sin(O*A.zoomSpeed*3)),I=`${A.colorA}|${A.colorB}`;I!==h&&(h=I,l=Bl(A.colorA,A.colorB));const M=Math.round(26+Math.max(.5,A.noiseScale)*10),p=`${M}|${A.noiseScale}`;p!==g&&(g=p,f=7,r=Ol(M,1.6/Math.sqrt(Math.max(.5,A.noiseScale)/2.5+.6),b));const R=i*Math.min(1,.5+A.resolution),c=Math.ceil(x*R),d=Math.ceil(x*Math.sin(Math.min(Math.PI/2,E*1.02))*R)+2;(P.width!==c||P.height!==d)&&(P.width=c,P.height=d),o.setTransform(R,0,0,R,0,0),o.globalCompositeOperation="source-over";const $=o.createRadialGradient(0,0,0,0,0,x);$.addColorStop(0,A.backgroundColor),$.addColorStop(1,A.backgroundColor),o.fillStyle=$,o.fillRect(0,0,x,d/R),o.globalCompositeOperation="source-over";const C=E*1.9;for(const G of r){let q=((G.a0+G.drift*O)%1+1)%1;q=-E*.45+q*C;const j=(G.r0+Math.sin(O*.7+G.phase)*G.wobble)*x*.92,V=Math.cos(q)*j,K=Math.sin(q)*j,to=G.size*x,lo=l[G.color%l.length];if(o.save(),o.translate(V,K),o.rotate(G.rot+O*G.spin),G.kind===1){const ao=o.createRadialGradient(-to*.35,-to*.35,to*.05,0,0,to);ao.addColorStop(0,"rgba(255,255,255,0.95)"),ao.addColorStop(.35,lo),ao.addColorStop(1,"rgba(0,0,0,0.2)"),o.fillStyle=ao,o.beginPath(),o.arc(0,0,to,0,Math.PI*2),o.fill()}else{const ao=G.kind===2?to*2.4:to,ro=G.kind===2?to*.32:to;o.beginPath(),G.verts.forEach(([Q,so],J)=>J?o.lineTo(Q*ao,so*ro):o.moveTo(Q*ao,so*ro)),o.closePath(),o.globalAlpha=.78,o.fillStyle=lo,o.fill(),o.globalAlpha=.55,o.strokeStyle="rgba(255,255,255,0.6)",o.lineWidth=1.1,o.stroke(),o.globalAlpha=1}o.restore()}y.setTransform(i,0,0,i,0,0),y.fillStyle=A.backgroundColor,y.fillRect(0,0,n,a);const S=n/2,N=a/2;for(let G=0;G<2*T;G++)y.save(),y.translate(S,N),y.rotate(_),G%2===0?y.rotate(G*E):(y.rotate((G+1)*E),y.scale(1,-1)),y.beginPath(),y.moveTo(0,0),y.arc(0,0,x,-.012,E+.012),y.closePath(),y.clip(),y.drawImage(P,0,0,c/R,d/R),y.restore();const z=y.createRadialGradient(S,N,0,S,N,Math.min(n,a)*.12);z.addColorStop(0,"rgba(255,255,255,0.28)"),z.addColorStop(1,"rgba(255,255,255,0)"),y.globalCompositeOperation="lighter",y.fillStyle=z,y.fillRect(0,0,n,a),y.globalCompositeOperation="source-over";const L=y.createRadialGradient(S,N,Math.min(n,a)*.35,S,N,Math.hypot(n,a)/2);L.addColorStop(0,"rgba(0,0,0,0)"),L.addColorStop(1,"rgba(0,0,0,0.55)"),y.fillStyle=L,y.fillRect(0,0,n,a)}return F=requestAnimationFrame(H),()=>{w.disconnect(),cancelAnimationFrame(F)}},[t])}const ql={default:{colorA:"#ffb84d",colorB:"#1f9e8f",backgroundColor:"#0a0710"},monochrome:{},neon:{colorA:"#00ffff",colorB:"#ff00ff",backgroundColor:"#000000",segments:8,speed:1.5},crystal:{colorA:"#88ccff",colorB:"#002244",backgroundColor:"#000510",segments:12,noiseScale:4},void:{colorA:"#cc00ff",colorB:"#000000",backgroundColor:"#000000",segments:6,rotation:.4},fire:{colorA:"#ff8800",colorB:"#ff0000",backgroundColor:"#0a0000",segments:6,speed:2},ice:{colorA:"#ffffff",colorB:"#002255",backgroundColor:"#000510",segments:10,noiseScale:2,zoomSpeed:.5}},lr=Y.forwardRef((t,u)=>{const{preset:s,segments:v,speed:k,colorA:e,colorB:y,backgroundColor:P,noiseScale:o,zoomSpeed:n,rotation:a,resolution:i,animated:r,width:g,height:l,className:h,style:f}=t,b=ql[s??"default"]||{},m=Y.useRef(null);return Y.useImperativeHandle(u,()=>m.current),Wl(m,{segments:v??b.segments??8,speed:k??b.speed??1,colorA:e??b.colorA??"#e0e0ff",colorB:y??b.colorB??"#1a0a2e",backgroundColor:P??b.backgroundColor??"#111111",noiseScale:o??b.noiseScale??2.5,zoomSpeed:n??b.zoomSpeed??.3,rotation:a??b.rotation??.2,resolution:i??.5,animated:r??!0}),Mo.jsx("div",{className:h,style:{width:g??"100%",height:l??"100%",display:"block",overflow:"hidden",...f},children:Mo.jsx("canvas",{ref:m,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});lr.displayName="Kaleidoscope";function Gl(t,u,s){return t.map((v,k)=>{if(u==="cycle"){const y=v.hue/60%6,P=y-Math.floor(y),o=0,n=Math.round(255*(1-P)*.75),a=Math.round(255*P*.75),i=192,r=Math.floor(y);return(()=>{switch(r){case 0:return[i,a,o];case 1:return[n,i,o];case 2:return[o,i,a];case 3:return[o,n,i];case 4:return[a,o,i];default:return[i,o,n]}})()}if(u==="gradient"){const e=k/Math.max(1,t.length-1);return Fo([s,"#6b7280"],e)}return Fo([s],0)})}function Dl(t,u){const s=Y.useRef(u);s.current=u;const v=Y.useRef(0);Y.useEffect(()=>{const k=t.current;if(!k)return;const e=k.parentElement;if(!e)return;const y=k.getContext("2d");let P=0,o=0;const n={seeds:[],gridW:0,gridH:0,cellIds:new Int16Array(0),imageData:null,offscreen:null,offCtx:null,dragIdx:-1,isDragging:!1,mouseGX:0,mouseGY:0};function a(W,A,T){const E=[];for(let x=0;x<T;x++)E.push({gx:Math.random()*W,gy:Math.random()*A,vx:(Math.random()-.5)*.3,vy:(Math.random()-.5)*.3,hue:x/T*360});return E}function i(W,A){const{resolution:T,cellCount:E}=s.current,x=Math.max(1,Math.round(W*T)),I=Math.max(1,Math.round(A*T));n.gridW=x,n.gridH=I,n.cellIds=new Int16Array(x*I);const M=new OffscreenCanvas(x,I),p=M.getContext("2d");if(n.offscreen=M,n.offCtx=p,n.imageData=p.createImageData(x,I),n.seeds.length===0)n.seeds=a(x,I,E);else{const R=n.gridW||x,c=n.gridH||I;for(const d of n.seeds)d.gx=d.gx/R*x,d.gy=d.gy/c*I}}function r(W,A){const T=window.devicePixelRatio||1;P=W,o=A,k.width=Math.round(P*T),k.height=Math.round(o*T),k.style.width=`${P}px`,k.style.height=`${o}px`,y.setTransform(T,0,0,T,0,0),i(P,o)}let g=!1,l=0,h=0;function f(W,A){const{resolution:T}=s.current;return[W*T,A*T]}function b(W,A){let T=-1,E=1/0;for(let x=0;x<n.seeds.length;x++){const I=n.seeds[x],M=W-I.gx,p=A-I.gy,R=M*M+p*p;R<E&&(E=R,T=x)}return T}function m(W){if(!s.current.interactive)return;const A=k.getBoundingClientRect(),T=W.clientX-A.left,E=W.clientY-A.top,[x,I]=f(T,E);l=x,h=I,g=!0;const M=b(x,I);if(M>=0){const p=n.seeds[M],R=x-p.gx,c=I-p.gy,d=(n.gridW*.15)**2;R*R+c*c<d&&(n.dragIdx=M,n.isDragging=!0)}n.mouseGX=x,n.mouseGY=I}function w(W){if(!s.current.interactive)return;const A=k.getBoundingClientRect(),T=W.clientX-A.left,E=W.clientY-A.top,[x,I]=f(T,E);n.mouseGX=x,n.mouseGY=I,g&&n.isDragging&&n.dragIdx>=0&&(n.seeds[n.dragIdx].gx=Math.max(0,Math.min(n.gridW-1,x)),n.seeds[n.dragIdx].gy=Math.max(0,Math.min(n.gridH-1,I)))}function B(W){if(!s.current.interactive)return;const A=k.getBoundingClientRect(),T=W.clientX-A.left,E=W.clientY-A.top,[x,I]=f(T,E),M=Math.abs(x-l)+Math.abs(I-h);if(!n.isDragging&&M<2){const{cellCount:p}=s.current;if(n.seeds.length<p*2){const R=n.seeds.length/(p||1)*360;n.seeds.push({gx:Math.max(0,Math.min(n.gridW-1,x)),gy:Math.max(0,Math.min(n.gridH-1,I)),vx:0,vy:0,hue:R})}}g=!1,n.isDragging=!1,n.dragIdx=-1}k.addEventListener("mousedown",m),k.addEventListener("mousemove",w),k.addEventListener("mouseup",B);const F=new ResizeObserver(W=>{const{width:A,height:T}=W[0].contentRect;A>0&&T>0&&r(A,T)});F.observe(e);const X=e.getBoundingClientRect();X.width>0&&X.height>0&&r(X.width,X.height);let O=0,_=-1,H=-1;function D(W){const A=O?Math.min(W-O,50):16;O=W;const{cellCount:T,speed:E,colorMode:x,cellColor:I,backgroundColor:M,showEdges:p,edgeColor:R,resolution:c,relaxation:d,animated:$}=s.current;if(c!==_)n.seeds=[],i(P,o),_=c,H=T;else if(T!==H){if(T>n.seeds.length){const{gridW:so,gridH:J}=n;for(;n.seeds.length<T;){const oo=n.seeds.length;n.seeds.push({gx:Math.random()*so,gy:Math.random()*J,vx:(Math.random()-.5)*.3,vy:(Math.random()-.5)*.3,hue:oo/T*360})}}else n.seeds.length=T;H=T}const{seeds:C,gridW:S,gridH:N,imageData:z,offscreen:L,offCtx:G,cellIds:q}=n;if(!z||!L||!G||C.length===0){v.current=requestAnimationFrame(D);return}if($){const so=A/16;for(const J of C)n.isDragging&&C.indexOf(J)===n.dragIdx||(J.vx+=(Math.random()-.5)*.05*E,J.vy+=(Math.random()-.5)*.05*E,J.vx=Math.max(-.5*E,Math.min(.5*E,J.vx)),J.vy=Math.max(-.5*E,Math.min(.5*E,J.vy)),J.gx+=J.vx*so,J.gy+=J.vy*so,J.gx<0&&(J.gx=0,J.vx=Math.abs(J.vx)),J.gx>=S&&(J.gx=S-1,J.vx=-Math.abs(J.vx)),J.gy<0&&(J.gy=0,J.vy=Math.abs(J.vy)),J.gy>=N&&(J.gy=N-1,J.vy=-Math.abs(J.vy)))}const j=Gl(C,x,I),[V,K,to]=Fo([M],0),[lo,ao,ro]=Fo([R],0),Q=z.data;for(let so=0;so<N;so++)for(let J=0;J<S;J++){let oo=1/0,Z=0;for(let fo=0;fo<C.length;fo++){const mo=J-C[fo].gx,go=so-C[fo].gy,po=mo*mo+go*go;po<oo&&(oo=po,Z=fo)}q[so*S+J]=Z;const[no,U,eo]=j[Z],co=(so*S+J)*4;Q[co]=no,Q[co+1]=U,Q[co+2]=eo,Q[co+3]=255}if($&&d>0){const so=new Float32Array(C.length),J=new Float32Array(C.length),oo=new Uint32Array(C.length);for(let Z=0;Z<N;Z++)for(let no=0;no<S;no++){const U=q[Z*S+no];so[U]+=no,J[U]+=Z,oo[U]++}for(let Z=0;Z<C.length;Z++)n.isDragging&&Z===n.dragIdx||oo[Z]>0&&(C[Z].gx+=(so[Z]/oo[Z]-C[Z].gx)*d,C[Z].gy+=(J[Z]/oo[Z]-C[Z].gy)*d)}if(p)for(let so=0;so<N;so++)for(let J=0;J<S;J++){const oo=q[so*S+J];if(J>0&&q[so*S+J-1]!==oo||so>0&&q[(so-1)*S+J]!==oo){const no=(so*S+J)*4;Q[no]=lo,Q[no+1]=ao,Q[no+2]=ro,Q[no+3]=255}}if(G.putImageData(z,0,0),y.drawImage(L,0,0,P,o),s.current.interactive){y.save();for(let so=0;so<C.length;so++){const J=C[so].gx/S*P,oo=C[so].gy/N*o;y.beginPath(),y.arc(J,oo,3,0,Math.PI*2),y.fillStyle="rgba(255,255,255,0.5)",y.fill()}y.restore()}v.current=requestAnimationFrame(D)}return v.current=requestAnimationFrame(D),()=>{F.disconnect(),cancelAnimationFrame(v.current),k.removeEventListener("mousedown",m),k.removeEventListener("mousemove",w),k.removeEventListener("mouseup",B)}},[t])}const Nl={default:{colorMode:"cycle"},monochrome:{edgeColor:"#333333"},"stained-glass":{colorMode:"cycle",edgeColor:"#111111",cellCount:25},neon:{colorMode:"cycle",backgroundColor:"#000000",edgeColor:"#000000",showEdges:!1},frost:{colorMode:"gradient",cellColor:"#88ccff",backgroundColor:"#001833",edgeColor:"#ffffff"},ember:{colorMode:"cycle",backgroundColor:"#0a0200",edgeColor:"#0a0200",showEdges:!1},void:{cellColor:"#ffffff",backgroundColor:"#000000",showEdges:!1}},sr=Y.forwardRef((t,u)=>{const{preset:s,cellCount:v,speed:k,colorMode:e,cellColor:y,backgroundColor:P,showEdges:o,edgeColor:n,resolution:a,relaxation:i,interactive:r,animated:g,width:l,height:h,className:f,style:b}=t,m=Nl[s??"default"]||{},w=Y.useRef(null);return Y.useImperativeHandle(u,()=>w.current),Dl(w,{cellCount:v??m.cellCount??20,speed:k??1,colorMode:e??m.colorMode??"solid",cellColor:y??m.cellColor??"#ffffff",backgroundColor:P??m.backgroundColor??"#111111",showEdges:o??m.showEdges??!0,edgeColor:n??m.edgeColor??P??m.backgroundColor??"#111111",resolution:a??1,relaxation:i??.05,interactive:r??!0,animated:g??!0}),Mo.jsx("div",{className:f,style:{width:l??"100%",height:h??"100%",display:"block",overflow:"hidden",...b},children:Mo.jsx("canvas",{ref:w,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});sr.displayName="VoronoiCells";const lt=Math.PI*2;function jl(t,u){const s=Y.useRef(u);s.current=u;const v=Y.useRef(0);Y.useEffect(()=>{const k=t.current;if(!k)return;const e=k.parentElement;if(!e)return;const y=k.getContext("2d");let P=0,o=0;const n={agents:new Float32Array(0),trail:new Float32Array(0),nextTrail:new Float32Array(0),gridW:0,gridH:0,imageData:null,offscreen:null,offCtx:null,mouseGX:0,mouseGY:0,mouseActive:!1};function a(B,F,X,O,_){const H=Math.round(O),D=Math.round(_);return H<0||H>=F||D<0||D>=X?0:B[D*F+H]}function i(B,F){const{resolution:X,agentCount:O}=s.current,_=Math.max(1,Math.round(B*X)),H=Math.max(1,Math.round(F*X));n.gridW=_,n.gridH=H,n.trail=new Float32Array(_*H),n.nextTrail=new Float32Array(_*H);const D=O;n.agents=new Float32Array(D*3);const W=_/2,A=H/2,T=Math.min(_,H)*.25;for(let I=0;I<D;I++){const M=Math.random()*lt,p=Math.random()*T;n.agents[I*3]=W+Math.cos(M)*p,n.agents[I*3+1]=A+Math.sin(M)*p,n.agents[I*3+2]=Math.random()*lt}const E=new OffscreenCanvas(_,H),x=E.getContext("2d");n.offscreen=E,n.offCtx=x,n.imageData=x.createImageData(_,H)}function r(B,F){const X=window.devicePixelRatio||1;P=B,o=F,k.width=Math.round(P*X),k.height=Math.round(o*X),k.style.width=`${P}px`,k.style.height=`${o}px`,y.setTransform(X,0,0,X,0,0),i(P,o)}function g(B){if(!s.current.interactive)return;const F=ye(B,k);if(!F)return l();const X=F.x,O=F.y,{resolution:_}=s.current;n.mouseGX=X*_,n.mouseGY=O*_,n.mouseActive=!0}function l(){n.mouseActive=!1}window.addEventListener("mousemove",g),document.addEventListener("mouseleave",l);const h=new ResizeObserver(B=>{const{width:F,height:X}=B[0].contentRect;F>0&&X>0&&r(F,X)});h.observe(e);const f=e.getBoundingClientRect();f.width>0&&f.height>0&&r(f.width,f.height);let b=-1,m=-1;function w(B){const{agentCount:F,sensorAngle:X,sensorDistance:O,stepSize:_,rotateSpeed:H,trailDecay:D,diffuseStrength:W,trailColor:A,backgroundColor:T,resolution:E,interactive:x,mouseRadius:I,mouseStrength:M,animated:p}=s.current;if(E!==b)i(P,o),b=E,m=F;else if(F!==m){const ro=F,Q=n.agents,so=new Float32Array(ro*3),J=n.gridW,oo=n.gridH;if(ro>Q.length/3){so.set(Q);for(let Z=Q.length/3;Z<ro;Z++){const no=Math.random()*lt,U=Math.random()*Math.min(J,oo)*.25;so[Z*3]=J/2+Math.cos(no)*U,so[Z*3+1]=oo/2+Math.sin(no)*U,so[Z*3+2]=Math.random()*lt}}else so.set(Q.subarray(0,ro*3));n.agents=so,m=F}if(!p){v.current=requestAnimationFrame(w);return}const{agents:R,trail:c,nextTrail:d,gridW:$,gridH:C,imageData:S,offscreen:N,offCtx:z}=n;if(!S||!N||!z){v.current=requestAnimationFrame(w);return}const L=X*Math.PI/180,G=H*Math.PI/180,q=F;for(let ro=0;ro<q;ro++){const Q=R[ro*3],so=R[ro*3+1],J=Math.round(Q),oo=Math.round(so);J>=0&&J<$&&oo>=0&&oo<C&&(c[oo*$+J]+=1)}if(x&&n.mouseActive){const ro=I*E,Q=ro*ro,so=n.mouseGX,J=n.mouseGY,oo=Math.max(0,Math.floor(so-ro)),Z=Math.min($-1,Math.ceil(so+ro)),no=Math.max(0,Math.floor(J-ro)),U=Math.min(C-1,Math.ceil(J+ro));for(let eo=no;eo<=U;eo++)for(let co=oo;co<=Z;co++){const fo=co-so,mo=eo-J;fo*fo+mo*mo<=Q&&(c[eo*$+co]+=M)}}const j=W,V=1-j;for(let ro=0;ro<C;ro++)for(let Q=0;Q<$;Q++){let so=0,J=0;for(let oo=-1;oo<=1;oo++)for(let Z=-1;Z<=1;Z++){const no=Q+Z,U=ro+oo;no>=0&&no<$&&U>=0&&U<C&&(so+=c[U*$+no],J++)}d[ro*$+Q]=(c[ro*$+Q]*V+so/J*j)*D}const K=n.trail;n.trail=n.nextTrail,n.nextTrail=K;const to=n.trail;for(let ro=0;ro<q;ro++){const Q=R[ro*3],so=R[ro*3+1],J=R[ro*3+2],oo=a(to,$,C,Q+Math.cos(J-L)*O,so+Math.sin(J-L)*O),Z=a(to,$,C,Q+Math.cos(J)*O,so+Math.sin(J)*O),no=a(to,$,C,Q+Math.cos(J+L)*O,so+Math.sin(J+L)*O);let U=J;Z>oo&&Z>no||(oo>no?U-=G:no>oo?U+=G:U+=(Math.random()-.5)*G),U+=(Math.random()-.5)*.1;let eo=Q+Math.cos(U)*_,co=so+Math.sin(U)*_;eo<0&&(eo+=$),eo>=$&&(eo-=$),co<0&&(co+=C),co>=C&&(co-=C),R[ro*3]=eo,R[ro*3+1]=co,R[ro*3+2]=U}const lo=S.data,ao=5;for(let ro=0;ro<C;ro++)for(let Q=0;Q<$;Q++){const so=Math.min(to[ro*$+Q]/ao,1),[J,oo,Z]=Fo([T,A],so),no=(ro*$+Q)*4;lo[no]=J,lo[no+1]=oo,lo[no+2]=Z,lo[no+3]=255}z.putImageData(S,0,0),y.drawImage(N,0,0,P,o),v.current=requestAnimationFrame(w)}return v.current=requestAnimationFrame(w),()=>{h.disconnect(),cancelAnimationFrame(v.current),window.removeEventListener("mousemove",g),document.removeEventListener("mouseleave",l)}},[t])}const Xl={default:{trailColor:"#ffcc44",backgroundColor:"#0a0800"},monochrome:{},neon:{trailColor:"#00ffff",backgroundColor:"#000000"},coral:{trailColor:"#ff8844",backgroundColor:"#0a0200"},vein:{trailColor:"#ff2244",backgroundColor:"#080000",agentCount:3e3},frost:{trailColor:"#88ddff",backgroundColor:"#000a10"},gold:{trailColor:"#ffcc44",backgroundColor:"#0a0800"}},ir=Y.forwardRef((t,u)=>{const{preset:s,agentCount:v,sensorAngle:k,sensorDistance:e,stepSize:y,rotateSpeed:P,trailDecay:o,diffuseStrength:n,trailColor:a,backgroundColor:i,resolution:r,interactive:g,mouseRadius:l,mouseStrength:h,animated:f,width:b,height:m,className:w,style:B}=t,F=Xl[s??"default"]||{},X=Y.useRef(null);return Y.useImperativeHandle(u,()=>X.current),jl(X,{agentCount:v??F.agentCount??1800,sensorAngle:k??45,sensorDistance:e??9,stepSize:y??1.5,rotateSpeed:P??45,trailDecay:o??F.trailDecay??.92,diffuseStrength:n??.2,trailColor:a??F.trailColor??"#ffffff",backgroundColor:i??F.backgroundColor??"#111111",resolution:r??.35,interactive:g??!0,mouseRadius:l??20,mouseStrength:h??3,animated:f??!0}),Mo.jsx("div",{className:w,style:{width:b??"100%",height:m??"100%",display:"block",overflow:"hidden",...B},children:Mo.jsx("canvas",{ref:X,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});ir.displayName="SlimeMold";function sn(){let t=0,u=0;for(;t===0;)t=Math.random();for(;u===0;)u=Math.random();return Math.sqrt(-2*Math.log(t))*Math.cos(2*Math.PI*u)}function cr(t,u,s,v){let k=t,e=u;for(let y=0;y<v;y++){const P=[],o=[],n=k.length/2;for(let a=0;a<n;a++){const i=k[a*2],r=k[a*2+1],g=(a+1)%n,l=k[g*2],h=k[g*2+1],f=Math.hypot(l-i,h-r),b=(e[a]+e[g])/2;P.push(i,r),o.push(e[a]),P.push((i+l)/2+sn()*f*s*b,(r+h)/2+sn()*f*s*b),o.push(b*(.8+Math.random()*.4))}k=P,e=o}return{pts:k,vari:e}}function Hl(t){const s=[],v=[];for(let k=0;k<10;k++){const e=k/10*Math.PI*2;s.push(Math.cos(e),Math.sin(e)),v.push(.4+Math.random()*.8)}return cr(s,v,.25+t*.35,3)}function Yl(t){const u=Y.useRef(t);u.current=t;const s=Y.useRef({paper:null,pctx:null,grain:null,scale:1,blooms:[],nextAuto:.3,t:0,key:""}).current,v=Eo(),k=Y.useRef(null);function e(a,i){var m;const r=u.current;if(s.key=`${a}|${i}|${r.resolution}|${r.backgroundColor}`,s.blooms=[],typeof document>"u")return;const g=Math.min(1,Math.max(.2,r.resolution)),l=document.createElement("canvas");l.width=Math.max(1,Math.round(a*g)),l.height=Math.max(1,Math.round(i*g)),s.paper=l,s.scale=g,s.pctx=l.getContext("2d"),s.pctx&&(s.pctx.fillStyle=r.backgroundColor,s.pctx.fillRect(0,0,l.width,l.height));const h=document.createElement("canvas");h.width=128,h.height=128;const f=h.getContext("2d"),b=(m=f==null?void 0:f.createImageData)==null?void 0:m.call(f,128,128);if(f&&b){for(let w=0;w<128*128;w++){const B=128+(Math.random()-.5)*90;b.data[w*4]=b.data[w*4+1]=b.data[w*4+2]=B,b.data[w*4+3]=255}f.putImageData(b,0,0),s.grain=h}}function y(a,i){const r=u.current;if(s.blooms.length>=Math.max(1,r.maxBlooms))return;const g=r.colors.length?r.colors:["#ffffff"],{pts:l,vari:h}=Hl(r.noiseAmount);s.blooms.push({x:a*s.scale,y:i*s.scale,color:g[Math.random()*g.length|0],base:l,vari:h,drawn:0,total:Math.max(12,Math.round(r.layerCount*7)),radius:r.bloomRadius*s.scale*(.6+Math.random()*.6)})}function P(a,i){const r=s.pctx;if(!r)return;const g=a.drawn/a.total,l=a.radius*(.35+.65*(1-Math.pow(1-g,2))),{pts:h}=cr(a.base,a.vari,.18+i.noiseAmount*.2,2);r.beginPath();for(let f=0;f<h.length;f+=2){const b=a.x+h[f]*l,m=a.y+h[f+1]*l;f===0?r.moveTo(b,m):r.lineTo(b,m)}r.closePath(),r.fillStyle=ko(a.color,Math.min(1,i.opacity*.28)),r.fill(),i.wetEdge>0&&(r.strokeStyle=ko(a.color,Math.min(1,i.wetEdge*.05)),r.lineWidth=Math.max(.8,1.6*s.scale),r.stroke()),a.drawn++}function o(a,i,r,g,l){const h=u.current,f=g/16.67;s.t+=g*.001,s.key!==`${i}|${r}|${h.resolution}|${h.backgroundColor}`&&e(i,r);const b=zo(v.current,k.current);if(h.interactive)for(const w of b.taps)y(w.x,w.y);h.animated&&h.autoBloom&&s.t>s.nextAuto&&(s.nextAuto=s.t+Math.max(.15,h.autoBloomInterval/1e3),y(i*(.1+Math.random()*.8),r*(.1+Math.random()*.8)));const m=h.animated?Math.max(1,Math.round(h.bloomSpeed*2.5*f*(l.quality<.75?.6:1))):1/0;for(const w of s.blooms)for(let B=0;B<m&&w.drawn<w.total;B++)P(w,h);if(s.blooms=s.blooms.filter(w=>w.drawn<w.total),h.animated&&h.fadeSpeed>0&&s.pctx&&s.paper&&(s.pctx.fillStyle=ko(h.backgroundColor,Math.min(1,h.fadeSpeed*3*f)),s.pctx.fillRect(0,0,s.paper.width,s.paper.height)),s.paper?(a.imageSmoothingEnabled=!0,a.imageSmoothingQuality="high",a.drawImage(s.paper,0,0,i,r)):l.overlay||(a.fillStyle=h.backgroundColor,a.fillRect(0,0,i,r)),s.grain){const w=a.globalCompositeOperation;a.globalCompositeOperation="overlay",a.globalAlpha=.06;for(let B=0;B<r;B+=128)for(let F=0;F<i;F+=128)a.drawImage(s.grain,F,B);a.globalAlpha=1,a.globalCompositeOperation=w}}const n=To({onResize:(a,i)=>e(a,i),onFrame:o});return k.current=n.canvas,n}const _l={default:{colors:["#f97316","#ec4899","#8b5cf6","#fbbf24"],backgroundColor:"#0a0005"},sunset:{colors:["#f97316","#ec4899","#8b5cf6","#fbbf24"],backgroundColor:"#0a0005",bloomRadius:100,opacity:.18,wetEdge:.5},ocean:{colors:["#0ea5e9","#06b6d4","#6366f1","#38bdf8"],backgroundColor:"#020b18",bloomRadius:90,opacity:.15,wetEdge:.35},spring:{colors:["#86efac","#d9f99d","#fde68a","#fbcfe8","#c4b5fd"],backgroundColor:"#0a0f05",bloomRadius:80,opacity:.2,layerCount:8},monochrome:{colors:["#ffffff","#d1d5db","#9ca3af"],backgroundColor:"#111111",bloomRadius:100,opacity:.12,wetEdge:.6},neon:{colors:["#f0abfc","#67e8f9","#a5f3fc","#c084fc"],backgroundColor:"#050010",bloomRadius:110,opacity:.2,wetEdge:.7,noiseAmount:.6}},fr=Y.forwardRef((t,u)=>{const{preset:s,colors:v,backgroundColor:k,bloomRadius:e,bloomSpeed:y,opacity:P,wetEdge:o,layerCount:n,noiseAmount:a,fadeSpeed:i,interactive:r,autoBloom:g,autoBloomInterval:l,resolution:h,animated:f,maxBlooms:b,width:m,height:w,className:B,style:F}=t,X=_l[s??"default"]||{},{canvasRef:O,canvas:_}=Yl({colors:v??X.colors??["#ffffff","#6b7280","#9ca3af"],backgroundColor:k??X.backgroundColor??"#111111",bloomRadius:e??X.bloomRadius??80,bloomSpeed:y??.5,opacity:P??X.opacity??.15,wetEdge:o??X.wetEdge??.4,layerCount:n??X.layerCount??6,noiseAmount:a??X.noiseAmount??.5,fadeSpeed:i??.001,interactive:r??!0,autoBloom:g??!0,autoBloomInterval:l??1500,resolution:h??.5,animated:f??!0,maxBlooms:b??12});return Y.useImperativeHandle(u,()=>_,[_]),Mo.jsx(Io,{canvasRef:O,width:m,height:w,className:B,style:{cursor:r??!0?"crosshair":"default",...F}})});fr.displayName="WatercolorBloom";function Vl(t){const[u,s,v]=t.split(",").map(o=>Number(o)/255),k=Math.max(u,s,v),e=Math.min(u,s,v),y=k-e;return y===0?0:(k===u?(s-v)/y+(s<v?6:0):k===s?(v-u)/y+2:(u-s)/y+4)*60}function Ul(t,u){const s=Y.useRef(u);s.current=u,Y.useEffect(()=>{const v=t.current;if(!v)return;const k=v.parentElement;if(!k)return;const e=v.getContext("2d"),y=document.createElement("canvas"),P=y.getContext("2d"),o=document.createElement("canvas"),n=o.getContext("2d");let a=0,i=0,r=1,g=0,l=1,h=1,f=!1,b=[0,0,0,0],m=[0,0],w=null;function B(){g=0,l=1,b=[Math.random()*6.28,Math.random()*6.28,Math.random()*6.28,Math.random()*6.28],m=[(Math.random()-.5)*.02,(Math.random()-.5)*.02],w=null,P.setTransform(1,0,0,1,0,0),P.clearRect(0,0,y.width,y.height)}function F(A,T){r=Math.min(2,window.devicePixelRatio||1),v.width=Math.round(A*r),v.height=Math.round(T*r),v.style.width=`${A}px`,v.style.height=`${T}px`,y.width=v.width,y.height=v.height,o.width=Math.max(1,Math.round(A/3)),o.height=Math.max(1,Math.round(T/3)),a=A,i=T,B()}const X=new ResizeObserver(A=>{const{width:T,height:E}=A[0].contentRect;T>0&&E>0&&F(T,E)});X.observe(k);const O=k.getBoundingClientRect();O.width>0&&O.height>0&&F(O.width,O.height);function _(A){const T=a/2*A.amplitude*.92,E=i/2*A.amplitude*.9,x=A.freq1,I=A.freq2,M=I+A.freq3+m[0],p=x+A.freq3*1.3+m[1];return{x:a/2+T*l*(.62*Math.sin(x*g+b[0])+.38*Math.sin(M*g+b[1])),y:i/2+E*l*(.62*Math.sin(I*g+b[2])+.38*Math.sin(p*g+b[3]))}}let H=0,D=0;function W(A){H=requestAnimationFrame(W);const T=D?Math.min(.05,(A-D)/1e3):1/60;if(D=A,a===0)return;const E=s.current,x=xo(E.color),I=xo(E.color2),M=xo(E.backgroundColor),p=Vl(x);if(P.setTransform(r,0,0,r,0,0),E.trailFade>0&&(P.globalCompositeOperation="destination-out",P.fillStyle=`rgba(0,0,0,${Math.min(.2,E.trailFade*.18)})`,P.fillRect(0,0,a,i),P.globalCompositeOperation="source-over"),E.animated&&!f){const c=Math.round(70*E.speed*T*60/60)+1;P.lineCap="round",P.lineJoin="round",P.lineWidth=Math.max(.5,E.lineWidth)*1.1;for(let d=0;d<c;d++){g+=.011,l*=Math.pow(E.damping,.6);const $=_(E);if(w){let C;if(E.colorMode==="cycle")C=`hsla(${p+Math.sin(g*.05)*70+g*.6},85%,64%,0.7)`;else if(E.colorMode==="gradient"){const S=1-l;C=`rgba(${x.split(",").map((z,L)=>Math.round(+z+(+I.split(",")[L]-+z)*S)).join(",")},0.72)`}else C=`rgba(${x},0.7)`;P.strokeStyle=C,P.beginPath(),P.moveTo(w.x,w.y),P.lineTo($.x,$.y),P.stroke()}w=$}l<.04&&E.autoReset&&(f=!0)}f&&(h-=T/1.4,h<=0&&(B(),h=1,f=!1)),e.setTransform(r,0,0,r,0,0);const R=e.createRadialGradient(a/2,i/2,0,a/2,i/2,Math.hypot(a,i)/2);if(R.addColorStop(0,`rgb(${M.split(",").map((c,d)=>Math.round(+c+(+x.split(",")[d]-+c)*.06)).join(",")})`),R.addColorStop(1,`rgb(${M})`),e.fillStyle=R,e.fillRect(0,0,a,i),e.globalAlpha=h,e.drawImage(y,0,0,a,i),E.glowEffect&&(n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,o.width,o.height),n.drawImage(y,0,0,o.width,o.height),e.globalCompositeOperation="lighter",e.globalAlpha=h*Math.min(.85,.25+E.glowBlur/30),e.imageSmoothingEnabled=!0,e.drawImage(o,0,0,a,i),e.globalCompositeOperation="source-over"),e.globalAlpha=1,w&&!f){e.globalCompositeOperation="lighter";const c=e.createRadialGradient(w.x,w.y,0,w.x,w.y,14);c.addColorStop(0,"rgba(255,255,255,0.95)"),c.addColorStop(.3,`rgba(${x},0.6)`),c.addColorStop(1,`rgba(${x},0)`),e.fillStyle=c,e.beginPath(),e.arc(w.x,w.y,14,0,Math.PI*2),e.fill(),e.globalCompositeOperation="source-over"}}return H=requestAnimationFrame(W),()=>{X.disconnect(),cancelAnimationFrame(H)}},[t])}const Kl={default:{color:"#ffb347",color2:"#2ec4b6",backgroundColor:"#06101a",colorMode:"gradient",glowEffect:!0,glowBlur:10},monochrome:{},neon:{color:"#00ffcc",color2:"#ff00aa",backgroundColor:"#000000",colorMode:"cycle",glowEffect:!0,glowBlur:12,trailFade:.015},crystal:{color:"#88ccff",color2:"#ffffff",backgroundColor:"#000510",colorMode:"gradient",glowEffect:!0,glowBlur:8,freq1:3,freq2:5},sand:{color:"#d4a76a",color2:"#7c5c2e",backgroundColor:"#1a1005",colorMode:"gradient",trailFade:.005,damping:.9998},minimal:{color:"#6b7280",backgroundColor:"#111111",lineWidth:.8,trailFade:.03,colorMode:"solid",glowEffect:!1},cosmic:{color:"#c084fc",color2:"#38bdf8",backgroundColor:"#020010",colorMode:"cycle",glowEffect:!0,glowBlur:15,freq1:5,freq2:7,freq3:.02}},dr=Y.forwardRef((t,u)=>{const{preset:s,color:v,color2:k,backgroundColor:e,lineWidth:y,trailFade:P,speed:o,damping:n,freq1:a,freq2:i,freq3:r,amplitude:g,colorMode:l,glowEffect:h,glowBlur:f,animated:b,autoReset:m,width:w,height:B,className:F,style:X}=t,O=Kl[s??"default"]||{},_=Y.useRef(null);return Y.useImperativeHandle(u,()=>_.current),Ul(_,{color:v??O.color??"#ffffff",color2:k??O.color2??"#6b7280",backgroundColor:e??O.backgroundColor??"#111111",lineWidth:y??O.lineWidth??1,trailFade:P??O.trailFade??.01,speed:o??1,damping:n??O.damping??.9995,freq1:a??O.freq1??2,freq2:i??O.freq2??3,freq3:r??O.freq3??.01,amplitude:g??.9,colorMode:l??O.colorMode??"solid",glowEffect:h??O.glowEffect??!1,glowBlur:f??O.glowBlur??10,animated:b??!0,autoReset:m??!0}),Mo.jsx("div",{className:F,style:{width:w??"100%",height:B??"100%",display:"block",overflow:"hidden",...X},children:Mo.jsx("canvas",{ref:_,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});dr.displayName="PendulaWave";const Ee=(t,u,s)=>{const v=t.split(",").map(Number),k=u.split(",").map(Number);return v.map((e,y)=>Math.round(e+(k[y]-e)*s)).join(",")};function Jl(t,u){const s=Y.useRef(u);s.current=u,Y.useEffect(()=>{const v=t.current;if(!v)return;const k=v.parentElement;if(!k)return;const e=v.getContext("2d"),y=document.createElement("canvas"),P=y.getContext("2d");let o=0,n=0,a=1,i=0,r=[];const g=Array.from({length:60},()=>({x:Math.random(),y:Math.random(),r:.4+Math.random()*1.2,s:4+Math.random()*10,p:Math.random()*6}));function l(A,T,E,x,I=0){const M=s.current,p=Math.max(2,Math.min(12,Math.round(M.symmetry))),R={x0:0,y0:0,ang:0,len:0,maxLen:E,w:Math.max(2,E*.045+M.cellSize*.5),depth:0,nextSpawn:E*(.14+Math.random()*.06),dist:0};return{x:A,y:T,R:E,rot:-Math.PI/2+(p%2?0:Math.PI/p)*0,branches:[R],born:i+I,doneAt:-1,fade:1,auto:x}}function h(){const A=Math.min(o,n);r=[l(o/2,n/2,A*.44,!0)],o/n>1.6&&(r.push(l(o*.16,n*.34,A*.2,!0,1.5)),r.push(l(o*.84,n*.68,A*.24,!0,3)))}function f(A,T){a=Math.min(2,window.devicePixelRatio||1),v.width=Math.round(A*a),v.height=Math.round(T*a),v.style.width=`${A}px`,v.style.height=`${T}px`,o=A,n=T,y.width=Math.max(1,Math.round(A/4)),y.height=Math.max(1,Math.round(T/4)),h()}const b=new ResizeObserver(A=>{const{width:T,height:E}=A[0].contentRect;T>0&&E>0&&f(T,E)});b.observe(k);const m=k.getBoundingClientRect();m.width>0&&m.height>0&&f(m.width,m.height);function w(A,T){if(!s.current.interactive)return;const E=v.getBoundingClientRect(),x=A-E.left,I=T-E.top;r.length>8&&r.shift(),r.push(l(x,I,Math.min(o,n)*(.16+Math.random()*.1),!1))}function B(A){w(A.clientX,A.clientY)}function F(A){if(!s.current.interactive)return;A.preventDefault();const T=A.touches[0];T&&w(T.clientX,T.clientY)}k.addEventListener("mousedown",B),k.addEventListener("touchstart",F,{passive:!1});function X(A,T){const E=s.current,x=Math.max(2,Math.min(12,Math.round(E.symmetry))),I=x===6||x===12||x===3?Math.PI/3:Math.min(1.2,Math.max(.55,2*Math.PI/x)),M=E.animated?Math.max(.2,E.growthSpeed)*28:1e6,p=Math.max(0,Math.min(1,E.noiseAmount));let R=!1;const c=[];for(const d of A.branches)if(!(d.len>=d.maxLen))for(R=!0,d.len=Math.min(d.maxLen,d.len+M*T*(1-d.depth*.22));d.depth<2&&d.len>=d.nextSpawn&&d.nextSpawn<d.maxLen*.92;){const $=d.nextSpawn,C=d.maxLen-$;if(d.depth===0||Math.random()<E.branchProbability+.25){const N=C*(d.depth===0?.5+Math.random()*.12:.55+Math.random()*.2)*(1+(Math.random()-.5)*p),z=d.x0+Math.cos(d.ang)*$,L=d.y0+Math.sin(d.ang)*$;for(const G of[1,-1])c.push({x0:z,y0:L,ang:d.ang+G*I,len:0,maxLen:Math.max(4,N),w:Math.max(1.2,d.w*.6),depth:d.depth+1,nextSpawn:N*(.25+Math.random()*.1),dist:d.dist+$})}d.nextSpawn+=d.maxLen*(d.depth===0?.11+Math.random()*.05:.22+Math.random()*.08)}A.branches.push(...c),!R&&A.doneAt<0&&(A.doneAt=i)}function O(A,T,E,x,I){const M=A.len<A.maxLen;if(I==="cycle"){const p=(A.dist+A.len)/T.R*200+i*25;return[`hsla(${p},85%,70%,1)`,`hsla(${p+40},90%,82%,1)`]}if(I==="age"){const p=Math.min(1,A.dist/T.R*1.2),R=Ee(E,x,p);return[`rgb(${R})`,`rgb(${Ee(R,"255,255,255",.45)})`]}return[`rgb(${E})`,M?`rgb(${x})`:`rgb(${Ee(E,"255,255,255",.5)})`]}function _(A,T,E,x,I,M){const p=Math.PI*2/M;A.save(),A.translate(T.x,T.y),A.globalAlpha=T.fade;for(let c=0;c<M;c++){A.save(),A.rotate(T.rot+c*p);for(const d of T.branches){if(d.len<=.5)continue;const $=Math.cos(d.ang),C=Math.sin(d.ang),S=d.x0+$*d.len,N=d.y0+C*d.len,z=d.w*.5,L=d.x0+$*d.len*.18,G=d.y0+C*d.len*.18,[q,j]=O(d,T,E,x,I),V=A.createLinearGradient(d.x0,d.y0,S,N);V.addColorStop(0,q),V.addColorStop(1,j),A.fillStyle=V,A.globalAlpha=T.fade*(.85-d.depth*.12),A.beginPath(),A.moveTo(d.x0,d.y0),A.lineTo(L-C*z,G+$*z),A.lineTo(S,N),A.lineTo(L+C*z,G-$*z),A.closePath(),A.fill(),A.globalAlpha=T.fade*.75,A.strokeStyle="rgba(255,255,255,0.85)",A.lineWidth=Math.max(.5,z*.35),A.beginPath(),A.moveTo(d.x0,d.y0),A.lineTo(S,N),A.stroke()}A.restore()}const R=T.R*.1*Math.min(1,(i-T.born)*2+.2);A.globalAlpha=T.fade*.8,A.beginPath();for(let c=0;c<=M;c++){const d=T.rot+c*p;c?A.lineTo(Math.cos(d)*R,Math.sin(d)*R):A.moveTo(Math.cos(d)*R,Math.sin(d)*R)}A.fillStyle=`rgba(${Ee(E,"255,255,255",.3)},0.55)`,A.fill(),A.strokeStyle="rgba(255,255,255,0.8)",A.lineWidth=1,A.stroke(),A.restore(),A.globalAlpha=1}let H=0,D=0;function W(A){H=requestAnimationFrame(W);const T=D?Math.min(.05,(A-D)/1e3):1/60;if(D=A,i+=T,o===0)return;const E=s.current,x=Math.max(2,Math.min(12,Math.round(E.symmetry))),I=xo(E.crystalColor),M=xo(E.activeColor),p=xo(E.backgroundColor);for(const d of r)i>=d.born&&X(d,T);for(const d of r)d.doneAt>0&&E.autoReset&&i-d.doneAt>4&&(d.fade-=T/1.5);const R=r.filter(d=>d.fade<=0);if(R.length){r=r.filter(d=>d.fade>0);for(const d of R)d.auto&&r.push(l(d.x,d.y,d.R,!0,.6))}e.setTransform(a,0,0,a,0,0);const c=e.createRadialGradient(o/2,n/2,0,o/2,n/2,Math.hypot(o,n)/2);c.addColorStop(0,`rgb(${Ee(p,M,.14)})`),c.addColorStop(1,`rgb(${p})`),e.fillStyle=c,e.fillRect(0,0,o,n);for(const d of g){const $=(d.y*n+i*d.s)%(n+10)-5,C=d.x*o+Math.sin(i*.5+d.p)*8;e.fillStyle=`rgba(${Ee(I,"255,255,255",.5)},${.25+.25*Math.sin(i*2+d.p)})`,e.beginPath(),e.arc(C,$,d.r,0,Math.PI*2),e.fill()}for(const d of r)i>=d.born&&_(e,d,I,M,E.colorMode,x);if(E.glowEffect){P.setTransform(.25,0,0,.25,0,0),P.clearRect(0,0,o,n);for(const d of r)i>=d.born&&_(P,d,M,M,E.colorMode,x);e.globalCompositeOperation="lighter",e.globalAlpha=Math.min(.9,.3+E.glowBlur/30),e.imageSmoothingEnabled=!0,e.drawImage(y,0,0,o,n),e.globalAlpha=1,e.globalCompositeOperation="source-over"}e.globalCompositeOperation="lighter";for(const d of r){if(i<d.born)continue;const C=d.branches[0].len;for(let S=0;S<x;S++){const N=d.rot+S*(Math.PI*2/x),z=d.x+Math.cos(N)*C,L=d.y+Math.sin(N)*C,G=(.5+.5*Math.sin(i*5+S*1.3))*d.fade,q=3+d.R*.02;e.strokeStyle=`rgba(255,255,255,${.7*G})`,e.lineWidth=1,e.beginPath(),e.moveTo(z-q,L),e.lineTo(z+q,L),e.moveTo(z,L-q),e.lineTo(z,L+q),e.stroke()}}e.globalCompositeOperation="source-over"}return H=requestAnimationFrame(W),()=>{b.disconnect(),cancelAnimationFrame(H),k.removeEventListener("mousedown",B),k.removeEventListener("touchstart",F)}},[t])}const Ql={default:{crystalColor:"#e0f2fe",activeColor:"#7dd3fc",backgroundColor:"#0c1a2e"},monochrome:{},snowflake:{crystalColor:"#e0f2fe",activeColor:"#7dd3fc",backgroundColor:"#0c1a2e",symmetry:6,branchProbability:.4,noiseAmount:.15,glowEffect:!0,glowBlur:10},gem:{crystalColor:"#c084fc",activeColor:"#e879f9",backgroundColor:"#09000f",symmetry:8,branchProbability:.2,noiseAmount:.1,colorMode:"age",glowEffect:!0,glowBlur:15},neon:{crystalColor:"#00ffcc",activeColor:"#ff00aa",backgroundColor:"#000000",symmetry:4,branchProbability:.35,noiseAmount:.3,colorMode:"cycle",glowEffect:!0,glowBlur:18},frost:{crystalColor:"#bae6fd",activeColor:"#ffffff",backgroundColor:"#0a1628",symmetry:6,branchProbability:.5,noiseAmount:.25,cellSize:2,glowEffect:!0,glowBlur:8},gold:{crystalColor:"#fbbf24",activeColor:"#f59e0b",backgroundColor:"#0a0500",symmetry:12,branchProbability:.15,noiseAmount:.05,colorMode:"age",glowEffect:!0,glowBlur:12}},hr=Y.forwardRef((t,u)=>{const{preset:s,crystalColor:v,activeColor:k,backgroundColor:e,growthSpeed:y,symmetry:P,branchProbability:o,noiseAmount:n,cellSize:a,glowEffect:i,glowBlur:r,interactive:g,autoReset:l,colorMode:h,animated:f,width:b,height:m,className:w,style:B}=t,F=Ql[s??"default"]||{},X=Y.useRef(null);return Y.useImperativeHandle(u,()=>X.current),Jl(X,{crystalColor:v??F.crystalColor??"#ffffff",activeColor:k??F.activeColor??"#6b7280",backgroundColor:e??F.backgroundColor??"#111111",growthSpeed:y??3,symmetry:P??F.symmetry??6,branchProbability:o??F.branchProbability??.3,noiseAmount:n??F.noiseAmount??.2,cellSize:a??F.cellSize??3,glowEffect:i??F.glowEffect??!0,glowBlur:r??F.glowBlur??12,interactive:g??!0,autoReset:l??!0,colorMode:h??F.colorMode??"solid",animated:f??!0}),Mo.jsx("div",{className:w,style:{width:b??"100%",height:m??"100%",display:"block",overflow:"hidden",cursor:g??!0?"crosshair":"default",...B},children:Mo.jsx("canvas",{ref:X,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});hr.displayName="CrystalGrowth";const we=(t,u,s)=>{const v=t.split(",").map(Number),k=u.split(",").map(Number);return v.map((e,y)=>Math.round(e+(k[y]-e)*s)).join(",")},Zl=(t,u)=>{const s=Math.sin(t*127.1+u*311.7)*43758.5453;return s-Math.floor(s)};function os(t,u){const s=Y.useRef(u);s.current=u,Y.useEffect(()=>{const v=t.current;if(!v)return;const k=v.parentElement;if(!k)return;const e=v.getContext("2d");let y=0,P=0,o=1,n=0,a=[],i=[],r=[],g=[],l=0;const h=Array.from({length:70},()=>({x:Math.random(),y:Math.random(),z:Math.random(),p:Math.random()*6})),f={x:-9999,y:-9999,inside:!1};function b(){const p=[],R=4+Math.floor(Math.random()*3);for(let c=0;c<R;c++){let d=c/R*Math.PI*2+(Math.random()-.5)*.8,$=0,C=0;const S=[[0,0]],N=3;for(let z=0;z<N;z++){const L=4+Math.random()*6;d+=(Math.random()-.5)*.9,$+=Math.cos(d)*L,C+=Math.sin(d)*L,S.push([$,C])}p.push(S)}return{bx:Math.random(),by:Math.random(),x:0,y:0,seed:Math.random()*100,flash:0,ring:0,hover:0,refractory:0,dendrites:p}}function m(){const p=s.current;a=Array.from({length:Math.max(2,p.nodeCount)},b);for(const R of a)R.bx=.05+R.bx*.9,R.by=.08+R.by*.84,R.x=R.bx*y,R.y=R.by*P;i=[]}function w(p,R){o=Math.min(2,window.devicePixelRatio||1),v.width=Math.round(p*o),v.height=Math.round(R*o),v.style.width=`${p}px`,v.style.height=`${R}px`,e.setTransform(o,0,0,o,0,0),y=p,P=R,m()}const B=new ResizeObserver(p=>{const{width:R,height:c}=p[0].contentRect;R>0&&c>0&&w(R,c)});B.observe(k);const F=k.getBoundingClientRect();F.width>0&&F.height>0&&w(F.width,F.height);function X(p,R){const c=a[p];if(!c||c.refractory>0)return;c.flash=Math.max(c.flash,R),c.ring=1,c.refractory=.35;const d=s.current.pulseDecay,$=R*d;if(!($<.12))for(const C of g[p]??[])Math.random()<.75&&i.length<160&&i.push({a:p,b:C,prog:0,energy:$,trail:[]})}function O(p,R,c){let d=-1,$=c;return a.forEach((C,S)=>{const N=Math.hypot(C.x-p,C.y-R);N<$&&($=N,d=S)}),d}function _(p){const R=ye(p,v);if(!R)return H();f.x=R.x,f.y=R.y,f.inside=!0}function H(){f.inside=!1,f.x=f.y=-9999}function D(p,R){if(!s.current.interactive)return;const c=v.getBoundingClientRect(),d=O(p-c.left,R-c.top,120);d>=0&&(a[d].refractory=0,X(d,1))}function W(p){D(p.clientX,p.clientY)}function A(p){s.current.interactive&&(p.preventDefault(),p.touches[0]&&D(p.touches[0].clientX,p.touches[0].clientY))}window.addEventListener("mousemove",_),document.addEventListener("mouseleave",H),k.addEventListener("mousedown",W),k.addEventListener("touchstart",A,{passive:!1});function T(p,R){const c=a[p],d=a[R],$=Math.min(p,R),C=Math.max(p,R),S=(Zl($,C)-.5)*.45*(p<R?1:-1);return{x:(c.x+d.x)/2-(d.y-c.y)*S,y:(c.y+d.y)/2+(d.x-c.x)*S}}const E=(p,R,c,d)=>({x:(1-d)*(1-d)*p.x+2*(1-d)*d*R.x+d*d*c.x,y:(1-d)*(1-d)*p.y+2*(1-d)*d*R.y+d*d*c.y});let x=0,I=0;function M(p){x=requestAnimationFrame(M);const R=I?Math.min(.05,(p-I)/1e3):1/60;if(I=p,y===0)return;const c=s.current;a.length!==Math.max(2,c.nodeCount)&&m();const d=c.animated?R*c.speed:0;n+=d;const $=xo(c.nodeColor),C=xo(c.edgeColor),S=xo(c.signalColor),N=xo(c.backgroundColor);for(const q of a){const j=c.wander?c.wanderSpeed:0;q.x=q.bx*y+(Go(n*.15*j+q.seed)-.5)*60*j*2,q.y=q.by*P+(Go(n*.15*j+q.seed+50)-.5)*60*j*2,q.flash*=Math.exp(-d*2.4),q.ring=Math.max(0,q.ring-d*1.6),q.refractory=Math.max(0,q.refractory-d);const V=f.inside&&c.interactive?Math.max(0,1-Math.hypot(q.x-f.x,q.y-f.y)/70):0;q.hover+=(V-q.hover)*Math.min(1,R*10)}r=[],g=a.map(()=>[]);const z=c.connectionRadius;for(let q=0;q<a.length;q++){const j=[];for(let V=0;V<a.length;V++){if(q===V)continue;const K=Math.hypot(a[q].x-a[V].x,a[q].y-a[V].y);K<z&&j.push([K,V])}j.sort((V,K)=>V[0]-K[0]);for(const[,V]of j.slice(0,4))g[q].includes(V)||g[q].push(V),g[V].includes(q)||g[V].push(q),q<V?r.push([q,V]):r.some(([K,to])=>K===V&&to===q)||r.push([V,q])}l+=d*1e3,c.animated&&l>c.pulseInterval&&(l=0,X(Math.floor(Math.random()*a.length),1)),e.setTransform(o,0,0,o,0,0);const L=e.createRadialGradient(y/2,P/2,0,y/2,P/2,Math.hypot(y,P)/2);L.addColorStop(0,`rgb(${we(N,C,.12)})`),L.addColorStop(1,`rgb(${N})`),e.fillStyle=L,e.fillRect(0,0,y,P);for(const q of h)e.fillStyle=`rgba(${$},${.08+.12*q.z*(.5+.5*Math.sin(n+q.p))})`,e.beginPath(),e.arc(((q.x*y+n*4*q.z)%y+y)%y,q.y*P,.5+q.z,0,Math.PI*2),e.fill();e.lineCap="round";for(const[q,j]of r){const V=a[q],K=a[j],to=T(q,j),lo=Math.max(V.hover,K.hover,V.flash*.6,K.flash*.6);e.strokeStyle=`rgba(${we(C,$,lo)},${.34+lo*.5})`,e.lineWidth=c.lineWidth*(.8+lo*.9),e.beginPath(),e.moveTo(V.x,V.y),e.quadraticCurveTo(to.x,to.y,K.x,K.y),e.stroke()}e.globalCompositeOperation="lighter";for(let q=i.length-1;q>=0;q--){const j=i[q],V=a[j.a],K=a[j.b];if(!V||!K){i.splice(q,1);continue}const to=T(j.a,j.b),lo=Math.hypot(K.x-V.x,K.y-V.y)+1;if(j.prog+=d*260/lo,j.prog>=1){i.splice(q,1),X(j.b,j.energy);continue}const ao=E(V,to,K,j.prog);j.trail.push(ao),j.trail.length>9&&j.trail.shift(),e.strokeStyle=`rgba(${S},${.5*j.energy})`,e.lineWidth=2.2,e.beginPath(),j.trail.forEach((Q,so)=>so?e.lineTo(Q.x,Q.y):e.moveTo(Q.x,Q.y)),e.stroke();const ro=e.createRadialGradient(ao.x,ao.y,0,ao.x,ao.y,9);ro.addColorStop(0,`rgba(255,255,255,${j.energy})`),ro.addColorStop(.3,`rgba(${S},${.8*j.energy})`),ro.addColorStop(1,`rgba(${S},0)`),e.fillStyle=ro,e.beginPath(),e.arc(ao.x,ao.y,9,0,Math.PI*2),e.fill()}e.globalCompositeOperation="source-over";const G=c.nodeRadius;for(const q of a){const j=Math.max(q.flash,q.hover);e.strokeStyle=`rgba(${we($,S,q.flash*.6)},${.35+j*.45})`,e.lineWidth=.9;for(const K of q.dendrites)e.beginPath(),K.forEach(([to,lo],ao)=>ao?e.lineTo(q.x+to,q.y+lo):e.moveTo(q.x+to,q.y+lo)),e.stroke();if(c.glowEffect){e.globalCompositeOperation="lighter";const K=G*(3+j*3)*(.6+c.glowBlur/25),to=e.createRadialGradient(q.x,q.y,0,q.x,q.y,K);to.addColorStop(0,`rgba(${we($,S,q.flash)},${.3+j*.5})`),to.addColorStop(1,`rgba(${$},0)`),e.fillStyle=to,e.beginPath(),e.arc(q.x,q.y,K,0,Math.PI*2),e.fill(),e.globalCompositeOperation="source-over"}const V=e.createRadialGradient(q.x-G*.3,q.y-G*.3,0,q.x,q.y,G*1.4);V.addColorStop(0,`rgb(${we($,"255,255,255",.55+q.flash*.4)})`),V.addColorStop(1,`rgb(${we($,S,q.flash)})`),e.fillStyle=V,e.beginPath(),e.arc(q.x,q.y,G*(1.2+q.flash*.3),0,Math.PI*2),e.fill(),e.fillStyle=`rgba(${we(N,$,.25)},0.85)`,e.beginPath(),e.arc(q.x+G*.15,q.y+G*.1,G*.42,0,Math.PI*2),e.fill(),q.ring>0&&(e.strokeStyle=`rgba(${S},${q.ring*.7})`,e.lineWidth=1.5,e.beginPath(),e.arc(q.x,q.y,G*1.4+(1-q.ring)*22,0,Math.PI*2),e.stroke())}}return x=requestAnimationFrame(M),()=>{B.disconnect(),cancelAnimationFrame(x),window.removeEventListener("mousemove",_),document.removeEventListener("mouseleave",H),k.removeEventListener("mousedown",W),k.removeEventListener("touchstart",A)}},[t])}const es={default:{nodeColor:"#5ce1e6",edgeColor:"#2a8c9e",signalColor:"#ffc857",backgroundColor:"#050b14"},monochrome:{},neon:{nodeColor:"#00ffcc",edgeColor:"#00ffcc",signalColor:"#ffffff",backgroundColor:"#000000",glowEffect:!0,glowBlur:20,pulseInterval:1500,pulseDecay:.9},brain:{nodeColor:"#f472b6",edgeColor:"#ec4899",signalColor:"#fbbf24",backgroundColor:"#0f0005",connectionRadius:130,glowEffect:!0,glowBlur:18,pulseDecay:.88,wanderSpeed:.4},minimal:{nodeColor:"#6b7280",edgeColor:"#374151",signalColor:"#9ca3af",backgroundColor:"#111111",glowEffect:!1,pulseInterval:3e3,nodeRadius:3},plasma:{nodeColor:"#c084fc",edgeColor:"#7c3aed",signalColor:"#f0abfc",backgroundColor:"#050010",connectionRadius:170,glowEffect:!0,glowBlur:25,pulseDecay:.92,wanderSpeed:.2},circuit:{nodeColor:"#22c55e",edgeColor:"#166534",signalColor:"#86efac",backgroundColor:"#020a02",connectionRadius:100,nodeRadius:3,glowEffect:!0,glowBlur:12,pulseInterval:1e3,pulseDecay:.8,wanderSpeed:.1}},ur=Y.forwardRef((t,u)=>{const{preset:s,nodeCount:v,nodeColor:k,edgeColor:e,signalColor:y,backgroundColor:P,connectionRadius:o,nodeRadius:n,lineWidth:a,speed:i,pulseInterval:r,pulseDecay:g,glowEffect:l,glowBlur:h,interactive:f,animated:b,wander:m,wanderSpeed:w,width:B,height:F,className:X,style:O}=t,_=es[s??"default"]||{},H=Y.useRef(null);return Y.useImperativeHandle(u,()=>H.current),os(H,{nodeCount:v??40,nodeColor:k??_.nodeColor??"#ffffff",edgeColor:e??_.edgeColor??"#6b7280",signalColor:y??_.signalColor??"#ffffff",backgroundColor:P??_.backgroundColor??"#111111",connectionRadius:o??_.connectionRadius??150,nodeRadius:n??_.nodeRadius??4,lineWidth:a??1,speed:i??1,pulseInterval:r??_.pulseInterval??2e3,pulseDecay:g??_.pulseDecay??.85,glowEffect:l??_.glowEffect??!0,glowBlur:h??_.glowBlur??15,interactive:f??!0,animated:b??!0,wander:m??!0,wanderSpeed:w??_.wanderSpeed??.3}),Mo.jsx("div",{className:X,style:{width:B??"100%",height:F??"100%",display:"block",overflow:"hidden",cursor:f??!0?"pointer":"default",...O},children:Mo.jsx("canvas",{ref:H,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});ur.displayName="NeuralWeb";function ts(t,u){const s=Y.useRef(u);s.current=u,Y.useEffect(()=>{const v=t.current;if(!v)return;const k=v.parentElement;if(!k)return;const e=v.getContext("2d");let y=0,P=0,o=0,n=new Float32Array(0),a=0,i=[],r=-1,g=0,l=0;const h=document.createElement("canvas"),f=h.getContext("2d");let b=null,m=0,w=0,B=-1;function F(p,R){const{blobCount:c,minRadius:d,maxRadius:$,speed:C}=s.current;i=Array.from({length:c},()=>{const S=d+Math.random()*($-d);return{x:S+Math.random()*(p-S*2),y:S+Math.random()*(R-S*2),vx:(Math.random()-.5)*C*2,vy:(Math.random()-.5)*C*2,radius:S,rt:(S-d)/Math.max(1e-6,$-d),phase:Math.random()*Math.PI*2}})}function X(p,R){const{resolution:c}=s.current;c===B&&m>0||(B=c,m=Math.max(1,Math.round(p*c)),w=Math.max(1,Math.round(R*c)),h.width=m,h.height=w,b=f.createImageData(m,w))}function O(p,R){const c=window.devicePixelRatio||1;y=p,P=R,v.width=Math.round(p*c),v.height=Math.round(R*c),v.style.width=`${p}px`,v.style.height=`${R}px`,e.scale(c,c),B=-1,X(p,R),F(p,R)}const _=new ResizeObserver(p=>{const{width:R,height:c}=p[0].contentRect;R>0&&c>0&&O(R,c)});_.observe(k);const H=k.getBoundingClientRect();H.width>0&&H.height>0&&O(H.width,H.height);function D(p,R){for(let c=0;c<i.length;c++){const d=i[c].x-p,$=i[c].y-R;if(d*d+$*$<i[c].radius*i[c].radius)return c}return-1}function W(p){if(!s.current.interactive)return;const R=v.getBoundingClientRect(),c=p.clientX-R.left,d=p.clientY-R.top,$=D(c,d);if($>=0)r=$,g=c-i[$].x,l=d-i[$].y;else{const{minRadius:C,maxRadius:S}=s.current,N=C+Math.random()*(S-C);i.push({x:c,y:d,vx:0,vy:0,radius:N,rt:(N-C)/Math.max(1e-6,S-C),phase:Math.random()*Math.PI*2})}}function A(p){if(!s.current.interactive||r<0)return;const R=v.getBoundingClientRect();i[r].x=p.clientX-R.left-g,i[r].y=p.clientY-R.top-l,i[r].vx=0,i[r].vy=0}function T(){r=-1}function E(p){if(!s.current.interactive)return;p.preventDefault();const R=v.getBoundingClientRect(),c=p.touches[0].clientX-R.left,d=p.touches[0].clientY-R.top,$=D(c,d);$>=0&&(r=$,g=c-i[$].x,l=d-i[$].y)}function x(p){if(!s.current.interactive||r<0)return;p.preventDefault();const R=v.getBoundingClientRect();i[r].x=p.touches[0].clientX-R.left-g,i[r].y=p.touches[0].clientY-R.top-l,i[r].vx=0,i[r].vy=0}function I(){r=-1}k.addEventListener("mousedown",W),k.addEventListener("mousemove",A),window.addEventListener("mouseup",T),k.addEventListener("touchstart",E,{passive:!1}),k.addEventListener("touchmove",x,{passive:!1}),k.addEventListener("touchend",I);function M(){const{blobCount:p,color:R,backgroundColor:c,threshold:d,speed:$,glowEffect:C,glowBlur:S,animated:N,resolution:z}=s.current;if(z!==B&&(B=-1,X(y,P)),p!==i.length&&r<0&&y>0){for(;i.length<p;){const{minRadius:no,maxRadius:U}=s.current,eo=no+Math.random()*(U-no);i.push({x:eo+Math.random()*Math.max(1,y-eo*2),y:eo+Math.random()*Math.max(1,P-eo*2),vx:(Math.random()-.5)*$*2,vy:(Math.random()-.5)*$*2,radius:eo,rt:(eo-no)/Math.max(1e-6,U-no),phase:Math.random()*Math.PI*2})}for(;i.length>p;)i.pop()}{const{minRadius:no,maxRadius:U}=s.current;for(const eo of i)eo.radius=no+eo.rt*(U-no)}if(e.fillStyle=c,e.fillRect(0,0,y,P),!N||!b||m===0){a=requestAnimationFrame(M);return}const L=y/m,G=P/w;o+=1/60;for(let no=0;no<i.length;no++){if(no===r)continue;const U=i[no],eo=Math.sin(o*.35*$+U.phase)*$*1.1;U.vy+=(eo-U.vy)*.02,U.vx+=(Math.sin(o*.21+U.phase*1.7)*.6*$-U.vx)*.02,U.x+=U.vx,U.y+=U.vy,U.x<U.radius*.6?(U.x=U.radius*.6,U.vx=Math.abs(U.vx)):U.x>y-U.radius*.6&&(U.x=y-U.radius*.6,U.vx=-Math.abs(U.vx)),U.y<U.radius*.4?(U.y=U.radius*.4,U.vy=Math.abs(U.vy)):U.y>P-U.radius*.4&&(U.y=P-U.radius*.4,U.vy=-Math.abs(U.vy))}const[q,j,V]=Fo([c],0),[K,to,lo]=Fo([R],0),ao=[Math.min(255,K+(255-K)*.6),Math.min(255,to+(255-to)*.55),Math.min(255,lo+(255-lo)*.35)],ro=[K*.6,to*.3,lo*.45],Q=b.data,so=d*.82,J=d*.18,oo=i.reduce((no,U)=>no+U.radius,0)/Math.max(1,i.length),Z=n.length===m*w?n:n=new Float32Array(m*w);for(let no=0;no<w;no++){const U=no*G;for(let eo=0;eo<m;eo++){const co=eo*L;let fo=0;for(const mo of i){const go=co-mo.x,po=U-mo.y;fo+=mo.radius*mo.radius/Math.max(1,go*go+po*po)}Z[no*m+eo]=fo}}for(let no=0;no<w;no++)for(let U=0;U<m;U++){const eo=no*m+U,co=Z[eo],fo=eo*4,mo=Math.min(1,Math.max(0,(co-so)/J)),go=C?Math.max(0,Math.min(1,co/d))**3*.35*(S/20):0;let po=q+(K-q)*go,yo=j+(to-j)*go,vo=V+(lo-V)*go;if(mo>0){const $o=Math.max(0,1-d/co),io=Z[U<m-1?eo+1:eo],ho=Z[U>0?eo-1:eo],Co=Z[no<w-1?eo+m:eo],bo=Z[no>0?eo-m:eo],Ao=d*(io-ho)/(2*L*co*co)*oo,Xo=d*(Co-bo)/(2*G*co*co)*oo,wo=Math.sqrt(Ao*Ao+Xo*Xo+1),Do=-Ao/wo,_o=-Xo/wo,oe=1/wo,So=Math.max(0,Do*-.5+_o*-.6+oe*.62),Uo=2*(Do*-.5+_o*-.6+oe*.62)*oe-.62,Ko=Math.pow(Math.max(0,Uo),18)*.8*Math.min(1,$o*5),jo=Math.pow($o,.55),re=.35+So*.85,se=(ro[0]+(ao[0]-ro[0])*jo)*re+Ko*255,le=(ro[1]+(ao[1]-ro[1])*jo)*re+Ko*255,de=(ro[2]+(ao[2]-ro[2])*jo)*re+Ko*255;po=po+(Math.min(255,se)-po)*mo,yo=yo+(Math.min(255,le)-yo)*mo,vo=vo+(Math.min(255,de)-vo)*mo}Q[fo]=po|0,Q[fo+1]=yo|0,Q[fo+2]=vo|0,Q[fo+3]=255}f.putImageData(b,0,0),e.imageSmoothingEnabled=!0,e.imageSmoothingQuality="high",e.drawImage(h,0,0,y,P),a=requestAnimationFrame(M)}return a=requestAnimationFrame(M),()=>{_.disconnect(),cancelAnimationFrame(a),k.removeEventListener("mousedown",W),k.removeEventListener("mousemove",A),window.removeEventListener("mouseup",T),k.removeEventListener("touchstart",E),k.removeEventListener("touchmove",x),k.removeEventListener("touchend",I)}},[t])}const ns={default:{color:"#ff7a45",backgroundColor:"#14060a"},monochrome:{},plasma:{color:"#c084fc",backgroundColor:"#050010",glowEffect:!0,glowBlur:30,speed:1.5},lava:{color:"#f97316",backgroundColor:"#1a0000",glowEffect:!0,glowBlur:20,speed:.5,minRadius:50,maxRadius:100},ocean:{color:"#38bdf8",backgroundColor:"#020c17",glowEffect:!0,glowBlur:15,speed:.8,threshold:.8},neon:{color:"#00ffcc",backgroundColor:"#000000",glowEffect:!0,glowBlur:25,speed:2,threshold:1.1},ghost:{color:"#e2e8f0",backgroundColor:"#111111",glowEffect:!1,speed:.3,threshold:.9,minRadius:60,maxRadius:110}},gr=Y.forwardRef((t,u)=>{const{preset:s,blobCount:v,color:k,backgroundColor:e,threshold:y,speed:P,minRadius:o,maxRadius:n,glowEffect:a,glowBlur:i,resolution:r,animated:g,interactive:l,width:h,height:f,className:b,style:m}=t,w=ns[s??"default"]||{},B=Y.useRef(null);return Y.useImperativeHandle(u,()=>B.current),ts(B,{blobCount:v??5,color:k??w.color??"#ffffff",backgroundColor:e??w.backgroundColor??"#111111",threshold:y??w.threshold??1,speed:P??w.speed??1,minRadius:o??w.minRadius??40,maxRadius:n??w.maxRadius??80,glowEffect:a??w.glowEffect??!0,glowBlur:i??w.glowBlur??20,resolution:r??.4,animated:g??!0,interactive:l??!0}),Mo.jsx("div",{className:b,style:{width:h??"100%",height:f??"100%",display:"block",overflow:"hidden",cursor:l??!0?"grab":"default",...m},children:Mo.jsx("canvas",{ref:B,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});gr.displayName="Metaballs";const ze=220,ue=(t,u,s)=>{const v=t.split(",").map(Number),k=u.split(",").map(Number);return v.map((e,y)=>Math.round(e+(k[y]-e)*s)).join(",")};function rs(t,u){const s=Y.useRef(u);s.current=u,Y.useEffect(()=>{const v=t.current;if(!v)return;const k=v.parentElement;if(!k)return;const e=v.getContext("2d");let y=0,P=0,o=1,n=0,a=0,i=[],r=[],g=new Float32Array(0),l=new Float32Array(0),h=0,f=0,b=0,m=0,w=0;const B=document.createElement("canvas"),F=B.getContext("2d"),X=document.createElement("canvas"),O=X.getContext("2d");let _="",H=null,D=-1;const W=18,A=14;function T(L,G){const{resolution:q}=s.current;q===D&&h>0||(D=q,h=Math.max(1,Math.round(L*q)),f=Math.max(1,Math.round(G*q)),g=new Float32Array(h*f),l=new Float32Array(h*f),B.width=h,B.height=f,H=F.createImageData(h,f))}function E(){const L=Math.min(y,P);for(let G=0;G<30;G++){const q=30+Math.random()*(y-60),j=30+Math.random()*(P-60);if(Math.hypot(q-b,j-m)>L*.32&&r.every(V=>Math.hypot(V.x-q,V.y-j)>80))return{x:q,y:j,amount:ze,max:ze,seed:Math.random()*100}}return{x:y*.15,y:P*.2,amount:ze,max:ze,seed:Math.random()*100}}function x(L,G){const{antCount:q,maxFood:j}=s.current;b=L/2,m=G/2,i=Array.from({length:q},()=>({x:b,y:m,angle:Math.random()*Math.PI*2,hasFood:!1,step:Math.random()*10})),r=[];for(let V=0;V<Math.min(3,j);V++)r.push(E())}function I(L,G){o=Math.min(2,window.devicePixelRatio||1),y=L,P=G,v.width=Math.round(L*o),v.height=Math.round(G*o),v.style.width=`${L}px`,v.style.height=`${G}px`,e.setTransform(o,0,0,o,0,0),D=-1,_="",T(L,G),x(L,G)}const M=new ResizeObserver(L=>{const{width:G,height:q}=L[0].contentRect;G>0&&q>0&&I(G,q)});M.observe(k);const p=k.getBoundingClientRect();p.width>0&&p.height>0&&I(p.width,p.height);function R(L,G){if(!s.current.interactive)return;const q=v.getBoundingClientRect();r.length<s.current.maxFood&&r.push({x:L-q.left,y:G-q.top,amount:ze,max:ze,seed:Math.random()*100})}function c(L){R(L.clientX,L.clientY)}function d(L){s.current.interactive&&(L.preventDefault(),L.touches[0]&&R(L.touches[0].clientX,L.touches[0].clientY))}k.addEventListener("mousedown",c),k.addEventListener("touchstart",d,{passive:!1});function $(L){const G=`${y}|${P}|${L}`;if(G===_)return;_=G,X.width=Math.max(1,Math.round(y*o)),X.height=Math.max(1,Math.round(P*o)),O.setTransform(o,0,0,o,0,0),O.fillStyle=`rgb(${L})`,O.fillRect(0,0,y,P);const q=Math.round(y*P/90);for(let V=0;V<q;V++){const K=Math.random()<.5;O.fillStyle=`rgba(${K?ue(L,"255,236,200",.25):ue(L,"0,0,0",.35)},${.25+Math.random()*.4})`,O.fillRect(Math.random()*y,Math.random()*P,1+Math.random()*1.5,1+Math.random()*1.5)}for(let V=0;V<Math.round(y*P/9e3);V++){const K=Math.random()*y,to=Math.random()*P,lo=10+Math.random()*18,ao=Math.random()*Math.PI;O.save(),O.translate(K,to),O.rotate(ao),O.fillStyle=`rgba(${ue(L,Math.random()<.5?"120,90,40":"70,90,40",.35)},0.5)`,O.beginPath(),O.ellipse(0,0,lo,lo*.38,0,0,Math.PI*2),O.fill(),O.strokeStyle=`rgba(${ue(L,"0,0,0",.3)},0.45)`,O.lineWidth=.8,O.beginPath(),O.moveTo(-lo,0),O.lineTo(lo,0),O.stroke(),O.restore()}const j=O.createRadialGradient(y/2,P/2,Math.min(y,P)*.3,y/2,P/2,Math.hypot(y,P)/2);j.addColorStop(0,"rgba(0,0,0,0)"),j.addColorStop(1,"rgba(0,0,0,0.4)"),O.fillStyle=j,O.fillRect(0,0,y,P)}function C(L,G,q){const j=Math.max(0,Math.min(h-1,G|0)),V=Math.max(0,Math.min(f-1,q|0));return L[V*h+j]}function S(L,G,q){e.save(),e.translate(L.x,L.y),e.rotate(L.angle),e.strokeStyle=`rgba(${ue(G,"0,0,0",.25)},0.95)`,e.lineWidth=.7,e.beginPath();for(let j=0;j<3;j++){const V=Math.sin(L.step*1.4+(j%2?Math.PI:0))*1.2,K=.6-j*1.3;e.moveTo(K,0),e.lineTo(K+1.2+V,-3.2),e.moveTo(K,0),e.lineTo(K+1.2-V,3.2)}e.stroke(),e.fillStyle=`rgb(${G})`,e.beginPath(),e.ellipse(-3.2,0,2.3,1.6,0,0,Math.PI*2),e.fill(),e.beginPath(),e.ellipse(-.2,0,1.3,.85,0,0,Math.PI*2),e.fill(),e.beginPath(),e.ellipse(2,0,1.25,1.05,0,0,Math.PI*2),e.fill(),e.fillStyle="rgba(255,255,255,0.28)",e.beginPath(),e.ellipse(-3.6,-.6,1,.5,0,0,Math.PI*2),e.fill(),L.hasFood&&(e.fillStyle=`rgb(${q})`,e.beginPath(),e.ellipse(3.9,0,1.4,1.2,0,0,Math.PI*2),e.fill()),e.restore()}let N=0;function z(L){n=requestAnimationFrame(z);const G=N?Math.min(.05,(L-N)/1e3):1/60;N=L,a+=G;const q=s.current;if(y===0||(q.resolution!==D&&(D=-1,T(y,P)),!H))return;for(i.length>q.antCount&&(i.length=Math.max(0,q.antCount));i.length<q.antCount;)i.push({x:b,y:m,angle:Math.random()*Math.PI*2,hasFood:!1,step:Math.random()*10});r.length>q.maxFood&&(r.length=Math.max(0,q.maxFood));const j=xo(q.backgroundColor),V=xo(q.pheromoneColor),K=xo(q.antColor),to=xo(q.foodColor),lo=xo(q.nestColor);$(j);const ao=y/h,ro=P/f;if(q.animated){for(let eo=0;eo<g.length;eo++)g[eo]*=1-q.evaporationRate,l[eo]*=1-q.evaporationRate,g[eo]<.001&&(g[eo]=0),l[eo]<.001&&(l[eo]=0);if(q.diffusionRate>0){const eo=q.diffusionRate*.25;for(let co=1;co<f-1;co++)for(let fo=1;fo<h-1;fo++){const mo=co*h+fo,go=g,po=l;go[mo]+=((go[mo-1]+go[mo+1]+go[mo-h]+go[mo+h])*.25-go[mo])*eo,po[mo]+=((po[mo-1]+po[mo+1]+po[mo-h]+po[mo+h])*.25-po[mo])*eo}}for(const eo of i){const co=eo.hasFood?l:g,fo=io=>C(co,(eo.x+Math.cos(io)*q.sensorDistance)/ao,(eo.y+Math.sin(io)*q.sensorDistance)/ro),mo=fo(eo.angle-q.sensorAngle),go=fo(eo.angle),po=fo(eo.angle+q.sensorAngle);if(go>=mo&&go>=po||(mo>po?eo.angle-=q.turnSpeed*Math.random():po>mo?eo.angle+=q.turnSpeed*Math.random():eo.angle+=(Math.random()-.5)*q.turnSpeed),eo.hasFood){const io=Math.atan2(m-eo.y,b-eo.x);eo.angle+=Math.atan2(Math.sin(io-eo.angle),Math.cos(io-eo.angle))*.04}eo.angle+=(Math.random()-.5)*.2,eo.x+=Math.cos(eo.angle)*q.antSpeed,eo.y+=Math.sin(eo.angle)*q.antSpeed,eo.step+=q.antSpeed*.6,eo.x<0?(eo.x=0,eo.angle=Math.PI-eo.angle):eo.x>=y&&(eo.x=y-1,eo.angle=Math.PI-eo.angle),eo.y<0?(eo.y=0,eo.angle=-eo.angle):eo.y>=P&&(eo.y=P-1,eo.angle=-eo.angle);const yo=Math.max(0,Math.min(h-1,eo.x/ao|0)),$o=Math.max(0,Math.min(f-1,eo.y/ro|0))*h+yo;if(eo.hasFood?g[$o]=Math.min(255,g[$o]+q.pheromoneStrength):l[$o]=Math.min(255,l[$o]+q.pheromoneStrength),eo.hasFood&&(eo.x-b)**2+(eo.y-m)**2<W*W&&(eo.hasFood=!1,eo.angle+=Math.PI),!eo.hasFood)for(let io=r.length-1;io>=0;io--){const ho=r[io];if((eo.x-ho.x)**2+(eo.y-ho.y)**2<A*A&&ho.amount>0){eo.hasFood=!0,eo.angle+=Math.PI,ho.amount--,ho.amount<=0&&r.splice(io,1);break}}}r.length<Math.min(3,q.maxFood)&&(w===0?w=a+3:a>w&&(r.push(E()),w=0))}const Q=H.data,so=Math.max(1,q.pheromoneStrength*8),[J,oo,Z]=V.split(",").map(Number);for(let eo=0;eo<h*f;eo++){const co=Math.min(1,g[eo]/so),fo=Math.min(1,l[eo]/so)*.35,mo=eo*4;Q[mo]=Math.min(255,J*co+230*fo),Q[mo+1]=Math.min(255,oo*co+215*fo),Q[mo+2]=Math.min(255,Z*co+180*fo),Q[mo+3]=Math.min(255,(co*1.15+fo)*255)}F.putImageData(H,0,0),e.setTransform(o,0,0,o,0,0),e.drawImage(X,0,0,y,P),e.imageSmoothingEnabled=!0,e.drawImage(B,0,0,y,P),e.globalCompositeOperation="lighter",e.globalAlpha=.45,e.drawImage(B,-2,-2,y+4,P+4),e.globalAlpha=1,e.globalCompositeOperation="source-over";const no=e.createRadialGradient(b-6,m-8,2,b,m,W*2.1);no.addColorStop(0,`rgb(${ue(lo,"255,230,190",.25)})`),no.addColorStop(.6,`rgb(${lo})`),no.addColorStop(1,`rgba(${lo},0)`),e.fillStyle=no,e.beginPath(),e.arc(b,m,W*2.1,0,Math.PI*2),e.fill();for(let eo=0;eo<26;eo++){const co=eo*2.39996,fo=W*(.6+eo*37%13/13*1.2);e.fillStyle=`rgba(${ue(lo,eo%2?"0,0,0":"255,230,190",.3)},0.8)`,e.fillRect(b+Math.cos(co)*fo,m+Math.sin(co)*fo,1.6,1.6)}const U=e.createRadialGradient(b,m,0,b,m,W*.5);U.addColorStop(0,"rgba(10,6,2,1)"),U.addColorStop(1,"rgba(10,6,2,0)"),e.fillStyle=U,e.beginPath(),e.arc(b,m,W*.5,0,Math.PI*2),e.fill();for(const eo of r){const co=Math.ceil(eo.amount/eo.max*14),fo=e.createRadialGradient(eo.x,eo.y,0,eo.x,eo.y,A*2);fo.addColorStop(0,`rgba(${to},0.25)`),fo.addColorStop(1,`rgba(${to},0)`),e.fillStyle=fo,e.beginPath(),e.arc(eo.x,eo.y,A*2,0,Math.PI*2),e.fill();for(let mo=0;mo<co;mo++){const go=mo*2.39996+eo.seed,po=Math.sqrt(mo/14)*A*.85,yo=eo.x+Math.cos(go)*po,vo=eo.y+Math.sin(go)*po,$o=e.createRadialGradient(yo-1,vo-1,.3,yo,vo,3.2);$o.addColorStop(0,`rgb(${ue(to,"255,255,255",.55)})`),$o.addColorStop(1,`rgb(${ue(to,"0,0,0",.25)})`),e.fillStyle=$o,e.beginPath(),e.arc(yo,vo,3.2,0,Math.PI*2),e.fill()}}for(const eo of i)S(eo,K,to)}return n=requestAnimationFrame(z),()=>{M.disconnect(),cancelAnimationFrame(n),k.removeEventListener("mousedown",c),k.removeEventListener("touchstart",d)}},[t])}const as={default:{antColor:"#d9693a",pheromoneColor:"#6fdc8c",foodColor:"#f5c242",nestColor:"#9a6a3a",backgroundColor:"#1a140d"},monochrome:{},neon:{antColor:"#ffffff",pheromoneColor:"#00ffcc",foodColor:"#f0abfc",nestColor:"#fbbf24",backgroundColor:"#000000",pheromoneStrength:8},desert:{antColor:"#451a03",pheromoneColor:"#d97706",foodColor:"#84cc16",nestColor:"#b45309",backgroundColor:"#fef3c7",antSpeed:2,evaporationRate:.005},jungle:{antColor:"#1a0a00",pheromoneColor:"#4ade80",foodColor:"#fbbf24",nestColor:"#7c3aed",backgroundColor:"#052e16",antCount:200,antSpeed:1},minimal:{antColor:"#9ca3af",pheromoneColor:"#374151",foodColor:"#6b7280",nestColor:"#6b7280",backgroundColor:"#111111",antCount:80,pheromoneStrength:3},swarm:{antColor:"#ffffff",pheromoneColor:"#6b7280",foodColor:"#4ade80",nestColor:"#f59e0b",backgroundColor:"#111111",antCount:400,antSpeed:2,pheromoneStrength:10,evaporationRate:.002}},pr=Y.forwardRef((t,u)=>{const{preset:s,antCount:v,evaporationRate:k,diffusionRate:e,pheromoneStrength:y,antSpeed:P,sensorAngle:o,sensorDistance:n,turnSpeed:a,antColor:i,pheromoneColor:r,foodColor:g,nestColor:l,backgroundColor:h,resolution:f,animated:b,interactive:m,maxFood:w,width:B,height:F,className:X,style:O}=t,_=as[s??"default"]||{},H=Y.useRef(null);return Y.useImperativeHandle(u,()=>H.current),rs(H,{antCount:v??_.antCount??150,evaporationRate:k??_.evaporationRate??.003,diffusionRate:e??.1,pheromoneStrength:y??_.pheromoneStrength??5,antSpeed:P??_.antSpeed??1.5,sensorAngle:o??.4,sensorDistance:n??6,turnSpeed:a??.3,antColor:i??_.antColor??"#ffffff",pheromoneColor:r??_.pheromoneColor??"#6b7280",foodColor:g??_.foodColor??"#4ade80",nestColor:l??_.nestColor??"#f59e0b",backgroundColor:h??_.backgroundColor??"#111111",resolution:f??.5,animated:b??!0,interactive:m??!0,maxFood:w??5}),Mo.jsx("div",{className:X,style:{width:B??"100%",height:F??"100%",display:"block",overflow:"hidden",cursor:m??!0?"crosshair":"default",...O},children:Mo.jsx("canvas",{ref:H,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});pr.displayName="AntColony";function ls(t,u){const s=Y.useRef(u);s.current=u,Y.useEffect(()=>{const v=t.current;if(!v)return;const k=v.parentElement;if(!k)return;const e=v.getContext("2d");let y=0,P=0,o=0,n="",a=!0,i=[],r=1,g=0;const l=document.createElement("canvas"),h=l.getContext("2d");let f=[],b=-1,m=0,w=0;function B(d,$){f=[{x:d*.35,y:$*.5,charge:1},{x:d*.65,y:$*.5,charge:-1}]}function F(d,$){y=d,P=$,v.width=Math.round(d*r),v.height=Math.round($*r),v.style.width=`${d}px`,v.style.height=`${$}px`,r=Math.min(2,window.devicePixelRatio||1),v.width=Math.round(d*r),v.height=Math.round($*r),e.setTransform(r,0,0,r,0,0),B(d,$),a=!0}const X=new ResizeObserver(d=>{const{width:$,height:C}=d[0].contentRect;$>0&&C>0&&F($,C)});X.observe(k);const O=k.getBoundingClientRect();O.width>0&&O.height>0&&F(O.width,O.height);function _(d,$){let C=0,S=0;for(const N of f){const z=d-N.x,L=$-N.y,G=z*z+L*L;if(G<1)continue;const q=Math.sqrt(G),j=N.charge/G;C+=z/q*j,S+=L/q*j}return[C,S]}function H(){const{fieldLineCount:d,stepSize:$,maxSteps:C,poleRadius:S}=s.current,N=S*S;i=[],f.forEach((z,L)=>{const G=z.charge;for(let q=0;q<d;q++){const j=q/d*Math.PI*2+L%2*(Math.PI/d);let V=z.x+Math.cos(j)*(S+2),K=z.y+Math.sin(j)*(S+2);const to=[V,K];for(let lo=0;lo<C;lo++){const[ao,ro]=_(V,K),Q=Math.sqrt(ao*ao+ro*ro);if(Q<1e-10)break;const so=V+ao/Q*$*G,J=K+ro/Q*$*G;if(so<-20||so>y+20||J<-20||J>P+20)break;let oo=!1;for(const Z of f)if((so-Z.x)**2+(J-Z.y)**2<N){oo=!0;break}if(to.push(so,J),V=so,K=J,oo)break}to.length>4&&i.push({pts:to,from:G})}})}function D(){const{lineColor:d,backgroundColor:$}=s.current;l.width=Math.max(1,Math.round(y*r)),l.height=Math.max(1,Math.round(P*r)),h.setTransform(r,0,0,r,0,0);const C=ko($,1);h.fillStyle=C,h.fillRect(0,0,y,P);const S=Math.round(y*P/140);h.lineCap="round";for(let z=0;z<S;z++){const L=Math.random()*y,G=Math.random()*P,[q,j]=_(L,G),V=Math.sqrt(q*q+j*j);if(V<1e-12)continue;const K=Math.min(1,Math.sqrt(V)*40),to=2.5+K*3.5,lo=q/V,ao=j/V;h.strokeStyle=ko(d,.05+K*.22),h.lineWidth=.8,h.beginPath(),h.moveTo(L-lo*to,G-ao*to),h.lineTo(L+lo*to,G+ao*to),h.stroke()}const N=h.createRadialGradient(y/2,P/2,Math.min(y,P)*.3,y/2,P/2,Math.hypot(y,P)/2);N.addColorStop(0,"rgba(0,0,0,0)"),N.addColorStop(1,"rgba(0,0,0,0.45)"),h.fillStyle=N,h.fillRect(0,0,y,P)}function W(d){const{lineWidth:$,lineOpacity:C,poleRadius:S,glowEffect:N,glowBlur:z,positiveColor:L,negativeColor:G,animated:q,lineColor:j}=s.current,V=s.current,K=`${V.fieldLineCount}|${V.stepSize}|${V.maxSteps}|${S}|${j}|${V.backgroundColor}`;K!==n&&(n=K,a=!0),a&&(H(),D(),a=!1),q&&(g+=d),e.setTransform(r,0,0,r,0,0),e.drawImage(l,0,0,y,P),e.lineWidth=$*1.2,e.lineJoin="round";for(const to of i){const lo=to.pts.length,ao=e.createLinearGradient(to.pts[0],to.pts[1],to.pts[lo-2],to.pts[lo-1]),ro=to.from===1?L:G,Q=to.from===1?G:L;ao.addColorStop(0,ko(ro,C)),ao.addColorStop(.5,ko(j,C*.85)),ao.addColorStop(1,ko(Q,C)),e.strokeStyle=ao,e.beginPath(),e.moveTo(to.pts[0],to.pts[1]);for(let so=2;so<lo;so+=2)e.lineTo(to.pts[so],to.pts[so+1]);e.stroke()}e.globalCompositeOperation="lighter",i.forEach((to,lo)=>{const ao=to.pts.length/2;for(let ro=0;ro<3;ro++){let Q=(g*.18+ro/3+lo*.137)%1;to.from!==1&&(Q=1-Q);const so=Math.min(ao-1,Math.floor(Q*(ao-1))),J=to.pts[so*2],oo=to.pts[so*2+1],Z=6,no=e.createRadialGradient(J,oo,0,J,oo,Z);no.addColorStop(0,"rgba(255,255,255,0.85)"),no.addColorStop(.35,ko(j,.5)),no.addColorStop(1,ko(j,0)),e.fillStyle=no,e.beginPath(),e.arc(J,oo,Z,0,Math.PI*2),e.fill()}}),e.globalCompositeOperation="source-over";for(const to of f){const lo=to.charge===1?L:G;if(N){e.globalCompositeOperation="lighter";const ro=S*(2.2+z/12)*(1+.08*Math.sin(g*2.5+to.x)),Q=e.createRadialGradient(to.x,to.y,S*.6,to.x,to.y,ro);Q.addColorStop(0,ko(lo,.55)),Q.addColorStop(1,ko(lo,0)),e.fillStyle=Q,e.beginPath(),e.arc(to.x,to.y,ro,0,Math.PI*2),e.fill(),e.globalCompositeOperation="source-over"}const ao=e.createRadialGradient(to.x-S*.35,to.y-S*.4,S*.1,to.x,to.y,S);ao.addColorStop(0,"rgba(255,255,255,0.95)"),ao.addColorStop(.3,lo),ao.addColorStop(1,ko(lo,1)),e.fillStyle=ao,e.beginPath(),e.arc(to.x,to.y,S,0,Math.PI*2),e.fill(),e.strokeStyle="rgba(0,0,0,0.35)",e.lineWidth=1.5,e.stroke(),e.fillStyle="#ffffff",e.font=`bold ${Math.round(S*.95)}px system-ui, sans-serif`,e.textAlign="center",e.textBaseline="middle",e.shadowColor="rgba(0,0,0,0.5)",e.shadowBlur=3,e.fillText(to.charge===1?"N":"S",to.x,to.y+.5),e.shadowBlur=0}}function A(d){if(!s.current.interactive)return;const $=v.getBoundingClientRect(),C=d.clientX-$.left,S=d.clientY-$.top,{poleRadius:N,maxPoles:z}=s.current,L=N*2;let G=-1;for(let q=0;q<f.length;q++){const j=f[q].x-C,V=f[q].y-S;if(j*j+V*V<L*L){G=q;break}}if(G>=0)b=G,m=C-f[G].x,w=S-f[G].y;else if(f.length<z){const q=f.length%2===0?1:-1;f.push({x:C,y:S,charge:q}),a=!0}}function T(d){if(!s.current.interactive||b<0)return;const $=v.getBoundingClientRect();f[b].x=d.clientX-$.left-m,f[b].y=d.clientY-$.top-w,a=!0}function E(){b=-1}function x(d){if(!s.current.interactive||(d.preventDefault(),f.length<=2))return;const $=v.getBoundingClientRect(),C=d.clientX-$.left,S=d.clientY-$.top,{poleRadius:N}=s.current,z=N*2;for(let L=0;L<f.length;L++){const G=f[L].x-C,q=f[L].y-S;if(G*G+q*q<z*z){f.splice(L,1),a=!0;break}}}function I(d){if(!s.current.interactive)return;d.preventDefault();const $=v.getBoundingClientRect(),C=d.touches[0].clientX-$.left,S=d.touches[0].clientY-$.top,{poleRadius:N}=s.current,z=N*2;for(let L=0;L<f.length;L++){const G=f[L].x-C,q=f[L].y-S;if(G*G+q*q<z*z){b=L,m=C-f[L].x,w=S-f[L].y;return}}}function M(d){if(!s.current.interactive||b<0)return;d.preventDefault();const $=v.getBoundingClientRect();f[b].x=d.touches[0].clientX-$.left-m,f[b].y=d.touches[0].clientY-$.top-w,a=!0}function p(){b=-1}k.addEventListener("mousedown",A),k.addEventListener("mousemove",T),window.addEventListener("mouseup",E),k.addEventListener("contextmenu",x),k.addEventListener("touchstart",I,{passive:!1}),k.addEventListener("touchmove",M,{passive:!1}),k.addEventListener("touchend",p);let R=0;function c(d){const $=R?Math.min(.05,(d-R)/1e3):.016666666666666666;R=d,y>0&&W($),o=requestAnimationFrame(c)}return o=requestAnimationFrame(c),()=>{X.disconnect(),cancelAnimationFrame(o),k.removeEventListener("mousedown",A),k.removeEventListener("mousemove",T),window.removeEventListener("mouseup",E),k.removeEventListener("contextmenu",x),k.removeEventListener("touchstart",I),k.removeEventListener("touchmove",M),k.removeEventListener("touchend",p)}},[t])}const ss={default:{positiveColor:"#ef5350",negativeColor:"#42a5f5",lineColor:"#e0f2fe",backgroundColor:"#06101c"},monochrome:{},neon:{positiveColor:"#f43f5e",negativeColor:"#3b82f6",lineColor:"#00ffcc",backgroundColor:"#000000",glowEffect:!0,glowBlur:25,lineOpacity:.8},warm:{positiveColor:"#f97316",negativeColor:"#fbbf24",lineColor:"#fed7aa",backgroundColor:"#0c0500",glowEffect:!0,glowBlur:18},mono:{positiveColor:"#ffffff",negativeColor:"#6b7280",lineColor:"#9ca3af",backgroundColor:"#111111",glowEffect:!1,lineOpacity:.5},electric:{positiveColor:"#38bdf8",negativeColor:"#a78bfa",lineColor:"#e0f2fe",backgroundColor:"#020c14",glowEffect:!0,glowBlur:30,fieldLineCount:24},minimal:{positiveColor:"#ef4444",negativeColor:"#3b82f6",lineColor:"#4b5563",backgroundColor:"#111111",glowEffect:!1,lineOpacity:.4,fieldLineCount:10}},mr=Y.forwardRef((t,u)=>{const{preset:s,fieldLineCount:v,stepSize:k,maxSteps:e,positiveColor:y,negativeColor:P,lineColor:o,backgroundColor:n,lineWidth:a,lineOpacity:i,poleRadius:r,glowEffect:g,glowBlur:l,animated:h,interactive:f,maxPoles:b,width:m,height:w,className:B,style:F}=t,X=ss[s??"default"]||{},O=Y.useRef(null);return Y.useImperativeHandle(u,()=>O.current),ls(O,{fieldLineCount:v??X.fieldLineCount??16,stepSize:k??4,maxSteps:e??400,positiveColor:y??X.positiveColor??"#ef4444",negativeColor:P??X.negativeColor??"#3b82f6",lineColor:o??X.lineColor??"#6b7280",backgroundColor:n??X.backgroundColor??"#111111",lineWidth:a??1,lineOpacity:i??X.lineOpacity??.6,poleRadius:r??12,glowEffect:g??X.glowEffect??!0,glowBlur:l??X.glowBlur??20,animated:h??!0,interactive:f??!0,maxPoles:b??6}),Mo.jsx("div",{className:B,style:{width:m??"100%",height:w??"100%",display:"block",overflow:"hidden",cursor:f??!0?"pointer":"default",...F},children:Mo.jsx("canvas",{ref:O,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});mr.displayName="MagneticField";function is(t,u){const s=Y.useRef(u);s.current=u;const v=Y.useRef([]),k=Y.useRef([]),e=Y.useRef([]),y=Y.useRef(0),P=Y.useRef({x:-999,y:-999}),o=Y.useRef(0);Y.useEffect(()=>{const n=t.current;if(!n)return;const a=n.parentElement;if(!a)return;const i=n.getContext("2d");let r=0,g=0;function l(){const{segmentCount:E}=s.current,x=r/2,I=g/2;v.current=Array.from({length:E},(M,p)=>({x:x-p*12,y:I})),P.current={x,y:I}}function h(E,x){const{starCount:I}=s.current;e.current=Array.from({length:I},()=>({x:Math.random()*E,y:Math.random()*x,r:.3+Math.random()*1.2,opacity:.4+Math.random()*.6,isGlowing:Math.random()<.28}))}function f(E,x){const I=window.devicePixelRatio||1;n.width=Math.round(E*I),n.height=Math.round(x*I),n.style.width=`${E}px`,n.style.height=`${x}px`,i.scale(I,I),r=E,g=x,l(),h(E,x)}const b=new ResizeObserver(E=>{const{width:x,height:I}=E[0].contentRect;x>0&&I>0&&f(x,I)});b.observe(a);const m=a.getBoundingClientRect();m.width>0&&m.height>0&&f(m.width,m.height);let w=!1;function B(E){if(!s.current.interactive)return;const x=ye(E,n);w=!!x,x&&(P.current=x)}function F(){w=!1}window.addEventListener("mousemove",B),document.addEventListener("mouseleave",F);function X(E,x,I,M){const{segmentSize:p}=s.current,R=Math.sqrt(I*I+M*M)||1,c=I/R,d=M/R,$=3+Math.floor(Math.random()*2);for(let C=0;C<$;C++){const N=40+Math.random()*20;k.current.push({x:E+c*p*.9,y:x+d*p*.9,vx:c*(2.5+Math.random()*3)+(Math.random()-.5)*1.8,vy:d*(2.5+Math.random()*3)+(Math.random()-.5)*1.8-.3,life:N,maxLife:N,size:3+Math.random()*5})}k.current.length>200&&k.current.splice(0,30)}function O(E,x){const[I,M,p]=E.split(",").map(Number),R=x<0?0:255,c=Math.abs(x);return`${Math.round(I+(R-I)*c)},${Math.round(M+(R-M)*c)},${Math.round(p+(R-p)*c)}`}function _(E,x,I,M,p,R,c){const d=[],$=Math.cos(I),C=Math.sin(I);i.save(),i.translate(E,x),i.rotate(I);const S=[{a:Math.PI/2-.12+p,len:M*.92},{a:Math.PI/2+.46+p,len:M},{a:Math.PI/2+.98+p,len:M*.62}];for(const N of[-1,1]){const z=S.map(j=>({x:Math.cos(j.a)*j.len,y:N*Math.sin(j.a)*j.len})),L=j=>({x:(z[j].x+z[j+1].x)*.5*.7,y:(z[j].y+z[j+1].y)*.5*.7}),G=z[1],q=i.createLinearGradient(0,0,G.x,G.y);q.addColorStop(0,`rgba(${O(R,-.25)},0.88)`),q.addColorStop(.55,`rgba(${R},0.5)`),q.addColorStop(1,`rgba(${R},0.2)`),i.beginPath(),i.moveTo(0,0),i.lineTo(z[0].x,z[0].y);for(let j=0;j<z.length-1;j++){const V=L(j);i.quadraticCurveTo(V.x,V.y,z[j+1].x,z[j+1].y)}i.closePath(),i.fillStyle=q,i.fill(),i.save(),i.shadowColor=`rgba(${R},0.8)`,i.shadowBlur=10,i.beginPath(),i.moveTo(z[0].x,z[0].y);for(let j=0;j<z.length-1;j++){const V=L(j);i.quadraticCurveTo(V.x,V.y,z[j+1].x,z[j+1].y)}i.strokeStyle=`rgba(${O(R,.35)},0.85)`,i.lineWidth=1.4,i.stroke(),i.restore(),i.strokeStyle=`rgba(${O(R,.3)},0.28)`,i.lineWidth=.8;for(let j=0;j<z.length-1;j++){const V=L(j);i.beginPath(),i.moveTo(0,0),i.quadraticCurveTo(V.x*.4,V.y*.55,V.x,V.y),i.stroke()}for(const j of z)i.beginPath(),i.moveTo(0,0),i.lineTo(j.x,j.y),i.strokeStyle=`rgba(${O(R,.15)},0.95)`,i.lineWidth=2.2,i.lineCap="round",i.stroke(),d.push({x:E+$*j.x-C*j.y,y:x+C*j.x+$*j.y})}i.restore(),i.fillStyle=`rgba(${c},0.95)`;for(const N of d)i.beginPath(),i.arc(N.x,N.y,2.2,0,Math.PI*2),i.fill()}let H=u.starCount;function D(){const{starCount:E,starColor:x,glowingStars:I,starGlowBlur:M}=s.current;E!==H&&(H=E,h(r,g));const p=e.current;if(p.length!==0){i.fillStyle=x;for(const R of p)I&&R.isGlowing||(i.globalAlpha=R.opacity,i.beginPath(),i.arc(R.x,R.y,R.r,0,Math.PI*2),i.fill());if(I){i.shadowColor=x,i.shadowBlur=M;for(const R of p)R.isGlowing&&(i.globalAlpha=R.opacity*.12,i.beginPath(),i.arc(R.x,R.y,R.r*5,0,Math.PI*2),i.fill(),i.globalAlpha=R.opacity*.35,i.beginPath(),i.arc(R.x,R.y,R.r*2.5,0,Math.PI*2),i.fill(),i.globalAlpha=R.opacity,i.beginPath(),i.arc(R.x,R.y,R.r*1.5,0,Math.PI*2),i.fill());i.shadowBlur=0,i.shadowColor="rgba(0,0,0,0)"}i.globalAlpha=1}}function W(E){const{segmentCount:x,segmentSize:I,bodyColor:M,eyeColor:p,fireColor:R,backgroundColor:c,followSpeed:d,wingSpan:$,showFire:C,interactive:S}=s.current;o.current+=E*.001;const N=o.current;i.fillStyle=c,i.fillRect(0,0,r,g),D();const z=v.current;(!S||!w)&&(P.current={x:r*.5+Math.sin(N*.5)*r*.35,y:g*.5+Math.cos(N*.7)*g*.3});const L=P.current;for(;z.length<x;){const Q=z[z.length-1]||{x:r/2,y:g/2};z.push({x:Q.x,y:Q.y})}z.length>x&&(z.length=x);const G=z[0],q=Math.min(d,1);G.x+=(L.x-G.x)*q,G.y+=(L.y-G.y)*q;for(let Q=1;Q<z.length;Q++){const so=z[Q-1],J=z[Q],oo=so.x-J.x,Z=so.y-J.y,no=Math.sqrt(oo*oo+Z*Z)||.001,U=I*1.2;no>U&&(J.x=so.x-oo/no*U,J.y=so.y-Z/no*U);const eo=-Z/no,co=oo/no,fo=Math.sin(N*4-Q*.4)*(I*.25)*(Q/z.length);J.x+=eo*fo,J.y+=co*fo}const j=z.length>=2?Math.atan2(z[0].y-z[1].y,z[0].x-z[1].x):0,V=xo(M),K=xo(R);if(C&&z.length>=2){const Q=z[0],so=z[1],J=Q.x-so.x,oo=Q.y-so.y;Math.random()<.8&&X(Q.x,Q.y,J,oo)}const to=xo(p),lo=z[0],ao=z.length;{const Q=i.createRadialGradient(lo.x,lo.y,0,lo.x,lo.y,I*9);Q.addColorStop(0,`rgba(${V},0.16)`),Q.addColorStop(1,`rgba(${V},0)`),i.fillStyle=Q,i.fillRect(0,0,r,g)}if(C){i.globalCompositeOperation="lighter";for(let Q=k.current.length-1;Q>=0;Q--){const so=k.current[Q];if(so.x+=so.vx,so.y+=so.vy,so.life-=1,so.life<=0){k.current.splice(Q,1);continue}const J=so.life/so.maxLife,oo=Math.max(1,so.size*(.5+J)*1.5),Z=i.createRadialGradient(so.x,so.y,0,so.x,so.y,oo);Z.addColorStop(0,`rgba(255,246,222,${J*.9})`),Z.addColorStop(.35,`rgba(${K},${J*.7})`),Z.addColorStop(1,`rgba(${K},0)`),i.fillStyle=Z,i.beginPath(),i.arc(so.x,so.y,oo,0,Math.PI*2),i.fill()}i.globalCompositeOperation="source-over"}const ro=Math.sin(N*6)*.28;if(ao>=4){const Q=z[2],so=z[3];_(Q.x,Q.y,Math.atan2(Q.y-so.y,Q.x-so.x),$,ro,V,K)}if(ao>=3){const Q=[],so=[];for(let U=0;U<ao;U++){const eo=z[Math.max(0,U-1)],co=z[Math.min(ao-1,U+1)],fo=eo.x-co.x,mo=eo.y-co.y,go=Math.sqrt(fo*fo+mo*mo)||1;Q.push({x:fo/go,y:mo/go});const po=U/(ao-1);so.push(I*(U===0?.62:.86*Math.pow(1-po,.8)+.12))}const J=(U,eo,co)=>({x:z[U].x-Q[U].y*so[U]*eo*co,y:z[U].y+Q[U].x*so[U]*eo*co}),oo=z[ao-1],Z={x:oo.x-Q[ao-1].x*I*1.3,y:oo.y-Q[ao-1].y*I*1.3},no=U=>{const eo=[];for(let co=0;co<ao;co++)eo.push(J(co,U,1));eo.push(Z);for(let co=ao-1;co>=0;co--)eo.push(J(co,U,-1));i.beginPath(),i.moveTo(eo[0].x,eo[0].y);for(let co=1;co<eo.length-1;co++){const fo=(eo[co].x+eo[co+1].x)/2,mo=(eo[co].y+eo[co+1].y)/2;i.quadraticCurveTo(eo[co].x,eo[co].y,fo,mo)}i.closePath()};{const U=Q[ao-1].x,eo=Q[ao-1].y,co=I*.62;i.beginPath(),i.moveTo(oo.x,oo.y),i.quadraticCurveTo(oo.x-U*I*.5-eo*co,oo.y-eo*I*.5+U*co,oo.x-U*I*2,oo.y-eo*I*2),i.quadraticCurveTo(oo.x-U*I*.5+eo*co,oo.y-eo*I*.5-U*co,oo.x,oo.y),i.fillStyle=`rgba(${O(K,-.1)},0.88)`,i.fill()}for(const U of[Math.round(ao*.3),Math.round(ao*.58)]){const eo=Math.sin(N*4+U)*I*.22;for(const co of[-1,1]){const fo=Q[U],mo=-fo.y*co,go=fo.x*co,po={x:z[U].x+mo*so[U]*.7,y:z[U].y+go*so[U]*.7},yo={x:po.x+mo*I*.85+fo.x*I*.25,y:po.y+go*I*.85+fo.y*I*.25},vo={x:yo.x+mo*I*.45-fo.x*(I*.7-eo),y:yo.y+go*I*.45-fo.y*(I*.7-eo)};i.lineCap="round",i.lineJoin="round",i.beginPath(),i.moveTo(po.x,po.y),i.lineTo(yo.x,yo.y),i.lineTo(vo.x,vo.y),i.strokeStyle=`rgba(${O(V,-.55)},1)`,i.lineWidth=I*.34,i.stroke(),i.strokeStyle=`rgba(${O(V,-.15)},1)`,i.lineWidth=I*.16,i.stroke();for(const $o of[-.5,0,.5]){const io=Math.atan2(vo.y-yo.y,vo.x-yo.x)+$o;i.beginPath(),i.moveTo(vo.x,vo.y),i.lineTo(vo.x+Math.cos(io)*I*.34,vo.y+Math.sin(io)*I*.34),i.strokeStyle=`rgba(${O(K,.35)},0.95)`,i.lineWidth=1.6,i.stroke()}}}i.save(),no(1),i.fillStyle=`rgba(${O(V,-.68)},1)`,i.fill(),i.shadowColor=`rgba(${V},0.95)`,i.shadowBlur=16,i.strokeStyle=`rgba(${O(V,.12)},0.95)`,i.lineWidth=2,i.stroke(),i.restore(),no(.62),i.fillStyle=`rgba(${O(V,-.42)},1)`,i.fill(),no(.24),i.fillStyle=`rgba(${O(V,-.05)},0.8)`,i.fill(),i.lineWidth=1,i.lineCap="round";for(let U=1;U<ao-1;U++){const eo=so[U],co=J(U,.8,1),fo=J(U,.8,-1),mo=z[U].x-Q[U].x*eo*.95,go=z[U].y-Q[U].y*eo*.95;i.beginPath(),i.moveTo(co.x,co.y),i.quadraticCurveTo(mo,go,fo.x,fo.y),i.strokeStyle=`rgba(${O(V,.45)},${.42-U/ao*.2})`,i.stroke()}for(let U=1;U<ao-1;U++){const eo=so[U],co=eo*(.95-U/ao*.3),fo=z[U].x,mo=z[U].y,go=eo*.28;i.beginPath(),i.moveTo(fo-Q[U].y*go,mo+Q[U].x*go),i.lineTo(fo-Q[U].x*co,mo-Q[U].y*co),i.lineTo(fo+Q[U].y*go,mo-Q[U].x*go),i.closePath(),i.fillStyle=`rgba(${O(K,.05)},${.95-U/ao*.35})`,i.fill()}}{const Q=I;i.save(),i.translate(lo.x,lo.y),i.rotate(j),i.lineCap="round";for(const no of[-1,1]){const U=Math.sin(N*3+no)*Q*.45;i.beginPath(),i.moveTo(Q*1.15,no*Q*.2),i.bezierCurveTo(Q*.4,no*Q*1.1,-Q*.8,no*(Q*1.4)+U,-Q*2.1,no*(Q*1.9)+U*1.5),i.strokeStyle=`rgba(${O(K,.1)},0.75)`,i.lineWidth=1.5,i.stroke()}for(const no of[-1,1])i.beginPath(),i.moveTo(Q*.05,no*Q*.42),i.quadraticCurveTo(-Q*.9,no*Q*.55,-Q*1.75,no*Q*1.25),i.quadraticCurveTo(-Q*.85,no*Q*.98,-Q*.3,no*Q*.78),i.closePath(),i.fillStyle=`rgba(${O(K,.2)},1)`,i.fill(),i.strokeStyle=`rgba(${O(K,-.35)},0.9)`,i.lineWidth=1,i.stroke();const so=[[1.62,0],[1.2,.3],[.65,.4],[.3,.66],[-.3,.82],[-.82,.5],[-.98,0],[-.82,-.5],[-.3,-.82],[.3,-.66],[.65,-.4],[1.2,-.3]],J=()=>{i.beginPath();const no=[(so[0][0]+so[1][0])/2,(so[0][1]+so[1][1])/2];i.moveTo(Q*no[0],Q*no[1]);for(let U=1;U<=so.length;U++){const eo=so[U%so.length],co=so[(U+1)%so.length];i.quadraticCurveTo(Q*eo[0],Q*eo[1],Q*(eo[0]+co[0])/2,Q*(eo[1]+co[1])/2)}i.closePath()};i.save(),J();const oo=i.createLinearGradient(-Q,0,Q*1.6,0);oo.addColorStop(0,`rgba(${O(V,-.6)},1)`),oo.addColorStop(1,`rgba(${O(V,-.15)},1)`),i.fillStyle=oo,i.fill(),i.shadowColor=`rgba(${V},0.95)`,i.shadowBlur=16,i.strokeStyle=`rgba(${O(V,.15)},0.95)`,i.lineWidth=2,i.stroke(),i.restore(),i.strokeStyle=`rgba(${O(V,.4)},0.5)`,i.lineWidth=1.2,i.beginPath(),i.moveTo(Q*1.45,0),i.lineTo(-Q*.7,0),i.stroke();for(const no of[-1,1])i.beginPath(),i.moveTo(Q*.75,no*Q*.2),i.quadraticCurveTo(Q*.45,no*Q*.62,-Q*.05,no*Q*.62),i.stroke();for(const no of[-1,1])i.beginPath(),i.ellipse(Q*1.28,no*Q*.13,Q*.07,Q*.04,0,0,Math.PI*2),i.fillStyle="rgba(0,0,0,0.75)",i.fill();for(const no of[-1,1]){const U=Q*.5,eo=no*Q*.42;i.beginPath(),i.ellipse(U,eo,Q*.25,Q*.15,no*-.35,0,Math.PI*2),i.fillStyle=`rgba(${to},1)`,i.fill(),i.beginPath(),i.ellipse(U+Q*.02,eo,Q*.05,Q*.13,0,0,Math.PI*2),i.fillStyle="rgba(10,6,0,0.95)",i.fill()}i.restore();const Z=(no,U)=>({x:lo.x+Math.cos(j)*no-Math.sin(j)*U,y:lo.y+Math.sin(j)*no+Math.cos(j)*U});i.save(),i.globalCompositeOperation="lighter";for(const no of[-1,1]){const U=Z(Q*.5,no*Q*.42),eo=i.createRadialGradient(U.x,U.y,0,U.x,U.y,Q*.6);eo.addColorStop(0,`rgba(${to},0.55)`),eo.addColorStop(1,`rgba(${to},0)`),i.fillStyle=eo,i.beginPath(),i.arc(U.x,U.y,Q*.6,0,Math.PI*2),i.fill()}if(C){const no=Z(Q*1.55,0),U=i.createRadialGradient(no.x,no.y,0,no.x,no.y,Q*.95);U.addColorStop(0,"rgba(255,240,210,0.85)"),U.addColorStop(.4,`rgba(${K},0.5)`),U.addColorStop(1,`rgba(${K},0)`),i.fillStyle=U,i.beginPath(),i.arc(no.x,no.y,Q*.95,0,Math.PI*2),i.fill()}i.restore(),i.fillStyle="rgba(255,255,255,0.9)";for(const no of[-1,1]){const U=Z(Q*.6,no*Q*.37);i.beginPath(),i.arc(U.x,U.y,Q*.035,0,Math.PI*2),i.fill()}}}let A=0;function T(E){const x=A?E-A:16;A=E,W(x),y.current=requestAnimationFrame(T)}return y.current=requestAnimationFrame(T),()=>{b.disconnect(),cancelAnimationFrame(y.current),window.removeEventListener("mousemove",B),document.removeEventListener("mouseleave",F)}},[t])}const cs={default:{bodyColor:"#35e0a1",eyeColor:"#ffd24a",fireColor:"#ff9d3c",backgroundColor:"#07130f"},monochrome:{},emerald:{bodyColor:"#00ff88",eyeColor:"#00ff00",fireColor:"#00ffaa",backgroundColor:"#0a1a0f"},inferno:{bodyColor:"#ff6600",eyeColor:"#ff0000",fireColor:"#ffaa00",backgroundColor:"#1a0500"},void:{bodyColor:"#9900ff",eyeColor:"#cc00ff",fireColor:"#6600cc",backgroundColor:"#050010"},ice:{bodyColor:"#88ddff",eyeColor:"#ffffff",fireColor:"#aaeeff",backgroundColor:"#050a14"}},yr=Y.forwardRef((t,u)=>{const{preset:s,segmentCount:v,segmentSize:k,bodyColor:e,eyeColor:y,fireColor:P,backgroundColor:o,followSpeed:n,wingSpan:a,showFire:i,interactive:r,starCount:g,starColor:l,glowingStars:h,starGlowBlur:f,width:b,height:m,className:w,style:B}=t,F=cs[s??"default"]||{},X=Y.useRef(null);return Y.useImperativeHandle(u,()=>X.current),is(X,{segmentCount:v??20,segmentSize:k??F.segmentSize??18,bodyColor:e??F.bodyColor??"#ffffff",eyeColor:y??F.eyeColor??"#111111",fireColor:P??F.fireColor??"#ffffff",backgroundColor:o??F.backgroundColor??"transparent",followSpeed:n??.15,wingSpan:a??F.wingSpan??80,showFire:i??!1,interactive:r??!0,starCount:g??60,starColor:l??"#ffffff",glowingStars:h??!1,starGlowBlur:f??8}),Mo.jsx("div",{className:w,style:{width:b??"100%",height:m??"100%",display:"block",overflow:"hidden",cursor:"none",...B},children:Mo.jsx("canvas",{ref:X,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});yr.displayName="DragonCursor";function fs(t,u,s){const v=Math.sin(u.t*1.5+t.phase)*u.wind*.5;t.vx+=v*.01*s,t.vy+=u.gravity*.016*s,t.x+=(t.vx+u.wind*.02)*s,t.y+=t.vy*s,t.angle+=(t.angularVel+Math.sin(u.t*2+t.phase)*.002)*s,t.scaleY=.6+Math.abs(Math.sin(t.angle*1.5))*.4}function ds(t){const u=Y.useRef(t);u.current=t;const s=Y.useRef([]),v=Y.useRef({w:0,h:0}),k=Y.useRef(0),e=Y.useRef({strength:0,dir:1});function y(n){const{petalSize:a}=u.current,{w:i,h:r}=v.current,g={x:Math.random()*i,y:n?-a-Math.random()*80:Math.random()*r,vx:(Math.random()-.5)*.6,vy:.2+Math.random()*.5,angle:Math.random()*Math.PI*2,angularVel:(Math.random()-.5)*.06,sizeMul:.7+Math.random()*.6,size:0,alpha:.6+Math.random()*.4,settled:!1,settleY:0,phase:Math.random()*Math.PI*2,scaleY:1,rest:null};return g.size=a*g.sizeMul,g}function P(n,a,i){n.save(),n.translate(a.x,a.y),n.rotate(a.angle),n.scale(1,a.scaleY),n.globalAlpha=a.alpha;const r=a.size;n.beginPath(),n.moveTo(0,-r),n.quadraticCurveTo(r*.8,-r*.3,0,r*.6),n.quadraticCurveTo(-r*.8,-r*.3,0,-r),n.fillStyle=i,n.fill(),n.globalAlpha=1,n.restore()}function o(n,a,i,r,g){var $;const{petalCount:l,petalColor:h,backgroundColor:f,gravity:b,windStrength:m,windGusts:w,showAccumulation:B,maxAccumulation:F,restitution:X}=u.current,O=r/16.67;k.current+=r*.001;const _=k.current;g.overlay||(n.fillStyle=f,n.fillRect(0,0,a,i));const H=e.current;w&&(Math.random()<.003*O&&(H.strength=2+Math.random()*3,H.dir=Math.random()<.5?1:-1),H.strength*=Math.pow(.985,O));const D=m+H.strength*H.dir,W={t:_,wind:D,gravity:b},A=l>0?Math.max(1,Math.ceil(l*g.quality)):0,T=s.current;for(;T.length<A;)T.push(y(!0));T.length>A&&(T.length=A);for(const C of T)C.sizeMul!==void 0&&(C.size=u.current.petalSize*C.sizeMul);const E=`rgb(${xo(h)})`,x=T.filter(C=>C.settled),I=x.reduce((C,S)=>C+(S.rest?0:1),0),M=B?Math.min(F,I*.6):0,p=i-M,R=g.solids,c=new Map(R.map(C=>[C.id,C])),d=()=>{if(x.length>A*.6){const C=T.find(S=>S.settled);C&&Object.assign(C,y(!0))}};for(const C of x){if(C.rest&&(C.rest.offsetX+=D*.006*O,!Qe(C,C.rest,c))){C.settled=!1,C.rest=null,C.vy=.3;continue}P(n,C,E)}for(const C of T){if(C.settled)continue;const S=C.x,N=C.y;if(fs(C,W,O),R.length>0){const z=Wt(C,S,N,R,X);if(z&&X===0){let L=0;for(const q of T)(($=q.rest)==null?void 0:$.solidId)===z.id&&L++;const G=B?Math.min(F,L*.6):0;C.settled=!0,C.rest=Je(C,z,-G-C.size*.3),C.y=z.y+C.rest.dy,C.settleY=C.y,C.angle=(Math.random()-.5)*.6,C.alpha*=.8,d(),P(n,C,E);continue}}C.x<-C.size&&(C.x=a+C.size),C.x>a+C.size&&(C.x=-C.size),C.y>=p-C.size*.5&&(B?(C.settled=!0,C.x=Math.max(C.size,Math.min(a-C.size,C.x)),C.y=p-C.size*.3,C.settleY=C.y,C.angle=(Math.random()-.5)*.6,C.alpha*=.8,d()):Object.assign(C,y(!0))),P(n,C,E)}}return To({overlay:t.overlay,collide:t.collide,onResize:(n,a)=>{v.current={w:n,h:a},s.current=Array.from({length:u.current.petalCount},()=>y(!1))},onFrame:o})}const hs={default:{petalColor:"#ffb7c5",backgroundColor:"#1a0a10"},monochrome:{},sakura:{petalColor:"#ffb7c5",backgroundColor:"#1a0a10",windStrength:1},autumn:{petalColor:"#e06030",backgroundColor:"#0d0805",windStrength:1.4,gravity:.09},snow:{petalColor:"#ddeeff",backgroundColor:"#050a14",windStrength:.5,gravity:.03,petalSize:5},neon:{petalColor:"#ff00aa",backgroundColor:"#050005",windStrength:.9}},Mr=Y.forwardRef((t,u)=>{const{preset:s,petalCount:v,petalColor:k,petalSize:e,backgroundColor:y,gravity:P,windStrength:o,windGusts:n,showAccumulation:a,maxAccumulation:i,overlay:r,collide:g,restitution:l,zIndex:h,width:f,height:b,className:m,style:w}=t,B=hs[s??"default"]||{},{canvasRef:F,canvas:X}=ds({petalCount:v??80,petalColor:k??B.petalColor??"#ffffff",petalSize:e??B.petalSize??8,backgroundColor:y??B.backgroundColor??"#111111",gravity:P??B.gravity??.06,windStrength:o??B.windStrength??.8,windGusts:n??!0,showAccumulation:a??!0,maxAccumulation:i??40,overlay:r??!1,collide:g??!1,restitution:l??0});return Y.useImperativeHandle(u,()=>X,[X]),Mo.jsx(Io,{canvasRef:F,overlay:r,zIndex:h,width:f,height:b,className:m,style:w})});Mr.displayName="SakuraBlossom";const cn=(t,u,s)=>Math.max(u,Math.min(s,t));function br(t,u,s,v,k,e,y,P,o=11,n){if(y<=0||typeof document>"u")return;const a=Math.round(96+96*P),i=Math.max(8,Math.round(a*v/Math.max(1,s)));let r=u.current;if(!r||r.c.width!==a||r.c.height!==i){const X=document.createElement("canvas");X.width=a,X.height=i;const O=X.getContext("2d");r=O?{c:X,g:O,img:O.createImageData(a,i)}:null,u.current=r}if(!r)return;const[g,l,h]=e.split(",").map(Number),f=r.img.data,b=o/a,m=n?n.x/s*a:-1,w=n?n.y/v*i:-1,B=cn(y,0,2)*.5;for(let X=0;X<i;X++)for(let O=0;O<a;O++){let _=O*b,H=X*b;if(m>=0){const T=Math.hypot(O-m,X-w);if(T<20){const E=Math.sin(T*.5-k*8)*.15*(1-T/20);_+=E,H+=E}}const D=Ke(_+k*.35,H-k*.2,1)+Ke(_*1.6-k*.3,H*1.6+k*.25,2),W=cn(1-Math.abs(D-1)*5,0,1),A=(X*a+O)*4;f[A]=g,f[A+1]=l,f[A+2]=h,f[A+3]=Math.round(255*W*W*W*B)}r.g.putImageData(r.img,0,0);const F=t.globalCompositeOperation;t.globalCompositeOperation="lighter",t.imageSmoothingEnabled=!0,t.drawImage(r.c,0,0,s,v),t.globalCompositeOperation=F}const Jo=12,st=(t,u,s)=>Math.max(u,Math.min(s,t)),fn=t=>Math.atan2(Math.sin(t),Math.cos(t));function dn(t){return t<0||t>1?0:.16*Math.pow(Math.sin(Math.PI*Math.pow(t,.55)),.8)*(1-.6*t)+.014}function us(t,u,s){const v=Math.min(t,u)*(.16+Math.random()*.08),k=Math.random()*t,e=Math.random()*u,y=Math.random()*Math.PI*2,P=new Float32Array(Jo*2);for(let a=0;a<Jo;a++)P[a*2]=k-Math.cos(y)*v*a/Jo,P[a*2+1]=e-Math.sin(y)*v*a/Jo;const o=[],n=2+Math.floor(Math.random()*3);for(let a=0;a<n;a++)o.push({u:.1+Math.random()*.75,v:(Math.random()-.5)*1.2,r:.5+Math.random()*.7});return{x:k,y:e,a:y,v:0,len:v,z:.55+Math.random()*.45,seed:Math.random()*100,tail:Math.random()*6,turn:0,sp:P,spots:o,accent:s%3===2}}function gs(t){const u=Y.useRef(t);u.current=t;const s=Eo(),v=Y.useRef(null),k=Y.useRef(Vo()),e=Y.useRef(null),y=Y.useRef({t:0,w:0,h:0,koi:[],ripples:[],pads:[],food:[],wake:0});function P(a,i){const r=y.current;r.w=a,r.h=i,r.koi=[];const g=Math.min(a,i);r.pads=[];const l=Math.max(3,Math.round(a*i/(g*g)*3));for(let h=0;h<l;h++)r.pads.push({x:Math.random()*a,y:Math.random()*i,r:g*(.06+Math.random()*.06),rot:Math.random()*Math.PI*2,notch:.22+Math.random()*.12,flower:h%3===0,seed:Math.random()*100,vx:0,vy:0})}function o(a,i,r,g,l){const h=u.current,f=y.current,b=g/1e3,m=g/16.67;f.t+=b;const w=f.t;(f.w!==i||f.h!==r)&&P(i,r);const B=Math.min(i,r),F=Po(h.fishColor),X=Po(h.scaleColor),O=Po(h.waterColor,"0,0,0"),_=Po(h.rippleColor),H=Po(h.lilyColor),D=st(Math.round(h.fishCount),0,40);for(;f.koi.length<D;)f.koi.push(us(i,r,f.koi.length));f.koi.length=D;const W=zo(s.current,v.current),{vx:A,vy:T}=k.current(W,m),E=Math.hypot(A,T);if(h.interactive&&W.inside&&E>2&&(f.wake-=b,f.wake<=0&&(f.ripples.push({x:W.x,y:W.y,age:0,life:1.6,size:B*.12}),f.wake=.14)),h.interactive)for(const c of W.taps)f.food.push({x:c.x,y:c.y,age:0}),f.ripples.push({x:c.x,y:c.y,age:0,life:2.4,size:B*.3}),f.food.length>12&&f.food.shift();Math.random()<b*.25&&f.ripples.push({x:Math.random()*i,y:Math.random()*r,age:0,life:2,size:B*.08});for(const c of f.ripples)c.age+=b;f.ripples=f.ripples.filter(c=>c.age<c.life);for(const c of f.food)c.age+=b;f.food=f.food.filter(c=>c.age<25);for(const c of f.koi){const d=B*.11*h.speed*(.7+.3*c.z);let $=c.a+(Go(w*.15+c.seed,4)-.5)*2.4,C=d,S=null,N=B*.9;for(const V of f.food){const K=Math.hypot(V.x-c.x,V.y-c.y);K<N&&(N=K,S=V)}S?($=Math.atan2(S.y-c.y,S.x-c.x),C=d*2.6,N<c.len*.12&&(f.food.splice(f.food.indexOf(S),1),f.ripples.push({x:S.x,y:S.y,age:0,life:1.2,size:B*.07}))):h.interactive&&W.inside&&E>25&&Math.hypot(W.x-c.x,W.y-c.y)<B*.25&&($=Math.atan2(c.y-W.y,c.x-W.x),C=d*3);const z=c.len*.6;(c.x<z||c.x>i-z||c.y<z||c.y>r-z)&&($=Math.atan2(r/2-c.y,i/2-c.x));for(const V of f.koi){if(V===c)continue;const K=c.x-V.x,to=c.y-V.y,lo=Math.hypot(K,to);lo<c.len*.5&&lo>0&&($+=fn(Math.atan2(to,K)-c.a)*.15)}const L=fn($-c.a),G=1.6*(.5+c.v/Math.max(1,d));c.turn+=(st(L*2,-G,G)-c.turn)*Math.min(1,b*3),c.a+=c.turn*b,c.v+=(C-c.v)*Math.min(1,b*1.5),c.x+=Math.cos(c.a)*c.v*b,c.y+=Math.sin(c.a)*c.v*b,c.x=st(c.x,0,i),c.y=st(c.y,0,r),c.tail+=b*(2.2+5*c.v/Math.max(1,B*.11));const q=c.sp,j=c.len/(Jo-1);q[0]=c.x,q[1]=c.y;for(let V=1;V<Jo;V++){const K=q[(V-1)*2],to=q[(V-1)*2+1];let lo=q[V*2]-K,ao=q[V*2+1]-to;const ro=Math.hypot(lo,ao)||1;lo/=ro,ao/=ro;const Q=V/Jo,so=Math.sin(c.tail-Q*5)*.06*Q*Q,J=-ao,oo=lo;q[V*2]=K+(lo+J*so)*j,q[V*2+1]=to+(ao+oo*so)*j}}a.globalCompositeOperation="source-over",a.globalAlpha=1;const x=a.createRadialGradient(i*.45,r*.4,B*.1,i/2,r/2,Math.hypot(i,r)*.65);x.addColorStop(0,`rgb(${uo(O,"120,140,110",.22)})`),x.addColorStop(.6,`rgb(${O})`),x.addColorStop(1,`rgb(${uo(O,"0,0,0",.55)})`),a.fillStyle=x,a.fillRect(0,0,i,r),a.fillStyle=`rgba(${uo(O,"160,170,140",.25)},0.35)`;for(let c=0;c<16;c++){const d=(c*.618+.13)%1*i,$=(c*.382+.29)%1*r,C=B*(.03+c%4*.015);a.beginPath(),a.ellipse(d,$,C,C*.7,c,0,Math.PI*2),a.fill()}h.caustics&&br(a,e,i,r,w*.8,uo(_,"255,255,230",.5),.35,l.quality,12);const I=f.koi.slice().sort((c,d)=>c.z-d.z),M=(c,d,$)=>{const C=c.sp,S=[],N=[];for(let z=0;z<Jo;z++){const L=Math.min(Jo-1,z+1),G=Math.max(0,z-1);let q=C[G*2]-C[L*2],j=C[G*2+1]-C[L*2+1];const V=Math.hypot(q,j)||1;q/=V,j/=V;const K=dn(z/(Jo-1))*c.len;S.push([C[z*2]-j*K+d,C[z*2+1]+q*K+$]),N.push([C[z*2]+j*K+d,C[z*2+1]-q*K+$])}a.beginPath(),a.moveTo(C[0]+Math.cos(c.a)*c.len*.03+d,C[1]+Math.sin(c.a)*c.len*.03+$);for(const[z,L]of S)a.lineTo(z,L);for(let z=N.length-1;z>=0;z--)a.lineTo(N[z][0],N[z][1]);a.closePath()},p=(c,d,$)=>{const C=c.sp,S=(Jo-1)*2,N=Math.atan2(C[S+1]-C[S-1],C[S]-C[S-2]),z=Math.sin(c.tail-5)*.5,L=c.len*.36,G=C[S]+d,q=C[S+1]+$;a.beginPath(),a.moveTo(G,q);for(const j of[1,-1]){const V=N+j*.75+z;a.quadraticCurveTo(G+Math.cos(N+j*.7+z*.6)*L*.55,q+Math.sin(N+j*.7+z*.6)*L*.55,G+Math.cos(V)*L,q+Math.sin(V)*L),a.quadraticCurveTo(G+Math.cos(N+z)*L*.7,q+Math.sin(N+z)*L*.7,G,q)}a.closePath()};for(const c of I){const d=c.len*(.18+.25*(1-c.z));a.fillStyle=`rgba(0,0,0,${.22+.1*c.z})`,M(c,d*.6,d),a.fill(),p(c,d*.6,d),a.fill()}for(const c of I){const d=c.accent?X:F,$=c.accent?F:X,C=.35*(1-c.z),S=uo(d,O,C),N=uo($,O,C),z=c.sp,L=Math.sin(c.tail*.6)*.35;for(const V of[1,-1]){const to=z[6],lo=z[3*2+1],ao=c.a+Math.PI+V*(1+L*V);a.fillStyle=`rgba(${uo(S,"255,255,255",.3)},0.55)`,a.beginPath(),a.moveTo(to,lo),a.quadraticCurveTo(to+Math.cos(ao-V*.4)*c.len*.2,lo+Math.sin(ao-V*.4)*c.len*.2,to+Math.cos(ao)*c.len*.2,lo+Math.sin(ao)*c.len*.2),a.quadraticCurveTo(to+Math.cos(ao+V*.3)*c.len*.1,lo+Math.sin(ao+V*.3)*c.len*.1,to,lo),a.fill()}a.fillStyle=`rgba(${uo(S,"255,255,255",.15)},0.75)`,p(c,0,0),a.fill(),a.strokeStyle=`rgba(${uo(S,"255,255,255",.4)},0.35)`,a.lineWidth=Math.max(.5,c.len*.006),a.stroke();const G=a.createLinearGradient(z[0],z[1],z[(Jo-1)*2],z[(Jo-1)*2+1]);G.addColorStop(0,`rgb(${uo(S,"255,255,255",.12)})`),G.addColorStop(1,`rgb(${uo(S,"0,0,0",.12)})`),a.fillStyle=G,M(c,0,0),a.fill(),a.save(),M(c,0,0),a.clip(),a.fillStyle=`rgb(${N})`;for(const V of c.spots){const K=Math.min(Jo-1,Math.round(V.u*(Jo-1))),to=Math.min(Jo-1,K+1),lo=Math.max(0,K-1);let ao=z[lo*2]-z[to*2],ro=z[lo*2+1]-z[to*2+1];const Q=Math.hypot(ao,ro)||1;ao/=Q,ro/=Q;const so=dn(V.u)*c.len,J=z[K*2]-ro*so*V.v,oo=z[K*2+1]+ao*so*V.v;a.beginPath(),a.ellipse(J,oo,so*V.r*1.4,so*V.r,Math.atan2(ro,ao),0,Math.PI*2),a.fill()}a.strokeStyle=`rgba(255,255,255,${.18*c.z})`,a.lineWidth=c.len*.03,a.lineCap="round",a.beginPath(),a.moveTo(z[2],z[3]);for(let V=2;V<Jo-2;V++)a.lineTo(z[V*2],z[V*2+1]);a.stroke(),a.restore();const q=z[0]+Math.cos(c.a)*c.len*-.05,j=z[1]+Math.sin(c.a)*c.len*-.05;a.fillStyle="rgba(10,10,10,0.8)";for(const V of[1,-1]){const K=-Math.sin(c.a)*V,to=Math.cos(c.a)*V;a.beginPath(),a.arc(q+K*c.len*.055,j+to*c.len*.055,Math.max(.8,c.len*.012),0,Math.PI*2),a.fill()}}a.fillStyle="rgb(190,140,80)";for(const c of f.food){const d=Math.sin(c.age*3)*.5;a.beginPath(),a.arc(c.x,c.y+d,Math.max(1.5,B*.006),0,Math.PI*2),a.fill()}a.lineWidth=1.4;for(const c of f.ripples){const d=c.age/c.life,$=c.size*(.1+d),C=(1-d)*(1-d);a.strokeStyle=`rgba(${uo(_,"255,255,255",.4)},${.5*C})`,a.beginPath(),a.arc(c.x,c.y,$,0,Math.PI*2),a.stroke(),a.strokeStyle=`rgba(${uo(O,"0,0,0",.4)},${.35*C})`,a.beginPath(),a.arc(c.x,c.y,$*.88,0,Math.PI*2),a.stroke(),c.size>B*.2&&(a.strokeStyle=`rgba(${_},${.3*C})`,a.beginPath(),a.arc(c.x,c.y,$*.6,0,Math.PI*2),a.stroke())}if(h.showLilies)for(const c of f.pads){for(const C of f.ripples){const S=c.x-C.x,N=c.y-C.y,z=Math.hypot(S,N)||1,L=C.size*(.1+C.age/C.life);if(Math.abs(z-L)<c.r){const G=(1-C.age/C.life)*6*b;c.vx+=S/z*G*B*.02,c.vy+=N/z*G*B*.02}}c.vx*=Math.exp(-b*.8),c.vy*=Math.exp(-b*.8),c.x+=c.vx*b+Math.sin(w*.1+c.seed)*b*2,c.y+=c.vy*b+Math.cos(w*.08+c.seed)*b*2,c.x<-c.r?c.x=i+c.r:c.x>i+c.r&&(c.x=-c.r),c.y<-c.r?c.y=r+c.r:c.y>r+c.r&&(c.y=-c.r),c.rot+=Math.sin(w*.2+c.seed)*b*.05;const d=(C,S)=>{a.beginPath(),a.moveTo(c.x+C,c.y+S),a.arc(c.x+C,c.y+S,c.r,c.rot+c.notch/2,c.rot+Math.PI*2-c.notch/2),a.closePath()};a.fillStyle="rgba(0,0,0,0.28)",d(c.r*.12,c.r*.18),a.fill();const $=a.createRadialGradient(c.x-c.r*.3,c.y-c.r*.3,c.r*.1,c.x,c.y,c.r);$.addColorStop(0,`rgb(${uo(H,"255,255,200",.18)})`),$.addColorStop(.85,`rgb(${H})`),$.addColorStop(1,`rgb(${uo(H,"0,0,0",.35)})`),a.fillStyle=$,d(0,0),a.fill(),a.strokeStyle=`rgba(${uo(H,"0,0,0",.3)},0.5)`,a.lineWidth=Math.max(.6,c.r*.025);for(let C=1;C<10;C++){const S=c.rot+c.notch/2+C/10*(Math.PI*2-c.notch);a.beginPath(),a.moveTo(c.x,c.y),a.lineTo(c.x+Math.cos(S)*c.r*.92,c.y+Math.sin(S)*c.r*.92),a.stroke()}if(a.strokeStyle=`rgba(${uo(H,"255,255,220",.4)},0.45)`,a.beginPath(),a.arc(c.x,c.y,c.r*.97,c.rot+Math.PI+.4,c.rot+Math.PI*1.6),a.stroke(),c.flower){const C=c.x+Math.cos(c.rot+Math.PI)*c.r*.25,S=c.y+Math.sin(c.rot+Math.PI)*c.r*.25,N=uo(H,"255,190,215",.75);for(let z=0;z<2;z++){const G=c.r*(z?.32:.48);for(let q=0;q<8;q++){const j=(q+z*.5)/8*Math.PI*2+c.seed;a.fillStyle=`rgb(${z?uo(N,"255,255,255",.45):N})`,a.beginPath(),a.moveTo(C,S),a.quadraticCurveTo(C+Math.cos(j-.35)*G*.7,S+Math.sin(j-.35)*G*.7,C+Math.cos(j)*G,S+Math.sin(j)*G),a.quadraticCurveTo(C+Math.cos(j+.35)*G*.7,S+Math.sin(j+.35)*G*.7,C,S),a.fill()}}a.fillStyle="rgb(250,210,90)",a.beginPath(),a.arc(C,S,c.r*.09,0,Math.PI*2),a.fill()}}const R=a.createLinearGradient(0,0,i,r);R.addColorStop(0,"rgba(255,255,255,0.06)"),R.addColorStop(.4,"rgba(255,255,255,0)"),R.addColorStop(1,"rgba(255,255,255,0.03)"),a.fillStyle=R,a.fillRect(0,0,i,r)}const n=To({onFrame:o});return v.current=n.canvas,n}const ps={default:{fishColor:"#ff6030",scaleColor:"#ffffff",waterColor:"#0a1520",rippleColor:"#60a8d0",lilyColor:"#50aa50"},monochrome:{},koi:{fishColor:"#ff6030",scaleColor:"#ffffff",waterColor:"#0a1520",rippleColor:"#60a8d0",lilyColor:"#50aa50",speed:1},night:{fishColor:"#c0c0ff",scaleColor:"#8080ff",waterColor:"#040812",rippleColor:"#4050a0",lilyColor:"#304030"},lotus:{fishColor:"#ffb0c0",scaleColor:"#ffffff",waterColor:"#0a1218",rippleColor:"#90c0d0",lilyColor:"#ff80a0",speed:.7},neon:{fishColor:"#00ffcc",scaleColor:"#ff00aa",waterColor:"#050010",rippleColor:"#00aaff",lilyColor:"#00ff44",speed:1.2}},Cr=Y.forwardRef((t,u)=>{const{preset:s,fishCount:v,fishColor:k,scaleColor:e,waterColor:y,rippleColor:P,lilyColor:o,speed:n,interactive:a,showLilies:i,caustics:r,width:g,height:l,className:h,style:f}=t,b=ps[s??"default"]||{},{canvasRef:m,canvas:w}=gs({fishCount:v??6,fishColor:k??b.fishColor??"#ffffff",scaleColor:e??b.scaleColor??"#6b7280",waterColor:y??b.waterColor??"#111111",rippleColor:P??b.rippleColor??"#6b7280",lilyColor:o??b.lilyColor??"#ffffff",speed:n??b.speed??1,interactive:a??!0,showLilies:i??!0,caustics:r??!0});return Y.useImperativeHandle(u,()=>w,[w]),Mo.jsx(Io,{canvasRef:m,width:g,height:l,className:h,style:{cursor:"crosshair",...f}})});Cr.displayName="KoiPond";const kt=.24;function ms(t){return Math.max(.25,1+.7*Math.cos(t))}function ys(t,u,s){return t<s?null:t+u*u/Math.max(t,1)}function Ms(t){const u=Y.useRef(t);u.current=t;const s=Y.useRef({t:0,cx:0,cy:0,orbiters:[],jets:[],stars:[],starKey:"",disk:{color:"",img:null},jet:{color:"",img:null},star:{color:"",img:null}}).current,v=Eo(),k=Y.useRef(null);function e(o,n,a=!1){const i=Math.max(20,o.diskWidth),r=a?.85+Math.random()*.15:Math.pow(Math.random(),1.4);return{r:n+r*i,theta:Math.random()*Math.PI*2,heat:Math.random(),len:.08+Math.random()*.18}}function y(o,n,a,i,r){const g=u.current,l=i/16.67*g.speed;s.t+=i*.001*g.speed;const h=zo(v.current,k.current),f=g.interactive&&h.inside?h.x:n/2,b=g.interactive&&h.inside?h.y:a/2;s.cx===0&&s.cy===0&&(s.cx=f,s.cy=b),s.cx+=(f-s.cx)*(1-Math.pow(.94,l)),s.cy+=(b-s.cy)*(1-Math.pow(.94,l));const m=s.cx,w=s.cy,B=Math.max(6,g.eventHorizonRadius)*1.6,F=B*1.45,X=B*1.6;r.overlay||(o.fillStyle=g.backgroundColor,o.fillRect(0,0,n,a));const O=`${n}|${a}|${g.starCount}`;s.starKey!==O&&(s.starKey=O,s.stars=Array.from({length:g.starCount},()=>({x:Math.random()*n,y:Math.random()*a,r:.4+Math.random()*1.1,glow:Math.random()<.15,tw:Math.random()*6}))),s.star.color!==g.starColor&&(s.star={color:g.starColor,img:Yo(g.starColor,32)});const _=(M,p)=>{if(!g.lensing)return[M,p];const R=M-m,c=p-w,d=Math.hypot(R,c),$=ys(d,X,B);return $===null?null:[m+R/(d||1)*$,w+c/(d||1)*$]};o.fillStyle=g.starColor;for(const M of s.stars){const p=_(M.x,M.y);if(!p)continue;const R=.35+.35*Math.sin(s.t*1.3+M.tw);if(g.glowingStars&&M.glow&&s.star.img){const c=g.starGlowBlur;o.globalAlpha=R,o.drawImage(s.star.img,p[0]-c,p[1]-c,c*2,c*2)}o.globalAlpha=R,o.fillRect(p[0]-M.r/2,p[1]-M.r/2,M.r,M.r)}if(g.lensing){o.strokeStyle=ko(g.starColor,.05),o.lineWidth=1;const M=48;o.beginPath();for(let p=0;p<=n;p+=M){let R=!1;for(let c=0;c<=a;c+=8){const d=_(p,c);if(!d){R=!1;continue}R?o.lineTo(d[0],d[1]):(o.moveTo(d[0],d[1]),R=!0)}}for(let p=0;p<=a;p+=M){let R=!1;for(let c=0;c<=n;c+=8){const d=_(c,p);if(!d){R=!1;continue}R?o.lineTo(d[0],d[1]):(o.moveTo(d[0],d[1]),R=!0)}}o.globalAlpha=1,o.stroke()}o.globalAlpha=1;const H=Math.ceil(g.particleCount*2.2*r.quality);for(;s.orbiters.length<H;)s.orbiters.push(e(g,F));s.orbiters.length>H&&(s.orbiters.length=H);const D=g.gravity/200*.05;for(const M of s.orbiters)M.theta+=D*Math.pow(F/M.r,1.5)*l,M.r-=.02*(g.gravity/200)*l,M.r<F&&Object.assign(M,e(g,F,!0));const W=Fo(["#ffffff",g.diskColor],.35),A=Fo([g.diskColor],0),T=(M,p,R)=>{const c=[A[0]+(W[0]-A[0])*M,A[1]+(W[1]-A[1])*M,A[2]+(W[2]-A[2])*M];return`rgba(${Math.min(255,c[0]*p)|0},${Math.min(255,c[1]*p)|0},${Math.min(255,c[2]*p)|0},${Math.min(1,R)})`},E=Math.max(20,g.diskWidth),x=M=>{const p=[new Path2D,new Path2D,new Path2D,new Path2D];for(const R of s.orbiters){const c=Math.sin(R.theta)<0;if(M==="back"&&!c||M==="front"&&c)continue;const d=1-(R.r-F)/E,$=ms(R.theta),C=Math.min(3,Math.floor((d*.6+($-.25)*.4)*4)),S=p[Math.max(0,C)],N=3;for(let z=0;z<=N;z++){const L=R.theta-R.len*(z/N);let G,q;if(M==="halo"){const j=B*1.08+(R.r-F)*.32;G=m+Math.cos(L)*j,q=w+Math.sin(L)*j}else G=m+Math.cos(L)*R.r,q=w+Math.sin(L)*R.r*kt;z===0?S.moveTo(G,q):S.lineTo(G,q)}}o.lineCap="round";for(let R=0;R<4;R++){const c=(R+.5)/4;o.strokeStyle=T(c,.6+c*.9,M==="halo"?.22+c*.3:.35+c*.55),o.lineWidth=M==="halo"?1:1.1+c*.9,o.stroke(p[R])}},I=o.globalCompositeOperation;if(o.globalCompositeOperation="lighter",s.disk.color!==g.diskColor&&(s.disk={color:g.diskColor,img:Yo(g.diskColor,128)}),s.disk.img){const M=(F+E)*2.4;o.globalAlpha=.28,o.drawImage(s.disk.img,m-M/2,w-M*kt*.9,M,M*kt*1.8),o.globalAlpha=1}if(x("back"),x("halo"),o.globalCompositeOperation=I,o.fillStyle="#000000",o.beginPath(),o.arc(m,w,B,0,Math.PI*2),o.fill(),o.globalCompositeOperation="lighter",o.strokeStyle=T(1,1.4,.85),o.lineWidth=Math.max(1,B*.04),o.shadowColor=g.diskColor,o.shadowBlur=B*.3,o.beginPath(),o.arc(m,w,B*1.02,0,Math.PI*2),o.stroke(),o.shadowBlur=0,x("front"),g.showJets){if(s.jet.color!==g.jetColor&&(s.jet={color:g.jetColor,img:Yo(g.jetColor,32)}),Math.random()<.9*l*r.quality)for(const p of[-1,1])s.jets.push({d:B*.6,side:p,life:1,wob:Math.random()*6});let M=0;for(const p of s.jets){if(p.d+=(3+p.d*.012)*l,p.life-=.008*l,p.life<=0||p.d>Math.max(n,a)||(s.jets[M++]=p,!s.jet.img))continue;const R=m+Math.sin(p.d*.03+p.wob)*(2+p.d*.05),c=w+p.side*p.d,d=3+p.d*.05;o.globalAlpha=p.life*.5,o.drawImage(s.jet.img,R-d,c-d,d*2,d*2)}s.jets.length=M,o.globalAlpha=1}o.globalCompositeOperation=I}const P=To({onResize:()=>{s.cx=0,s.cy=0,s.starKey=""},onFrame:y});return k.current=P.canvas,P}const bs={default:{diskColor:"#ff6600",backgroundColor:"#0d0200",jetColor:"#ff3300"},monochrome:{},cosmic:{diskColor:"#aaccff",backgroundColor:"#020510",jetColor:"#88aaff",diskWidth:140},inferno:{diskColor:"#ff6600",backgroundColor:"#0d0200",jetColor:"#ff3300",diskWidth:100},neon:{diskColor:"#00ffcc",backgroundColor:"#000510",jetColor:"#ff00aa",diskWidth:120},void:{diskColor:"#6b7280",backgroundColor:"#050505",jetColor:"#4b5563",particleCount:200,diskWidth:80}},vr=Y.forwardRef((t,u)=>{const{preset:s,diskColor:v,backgroundColor:k,particleCount:e,gravity:y,eventHorizonRadius:P,diskWidth:o,jetColor:n,showJets:a,lensing:i,speed:r,interactive:g,starCount:l,starColor:h,glowingStars:f,starGlowBlur:b,width:m,height:w,className:B,style:F}=t,X=bs[s??"default"]||{},{canvasRef:O,canvas:_}=Ms({diskColor:v??X.diskColor??"#ffffff",backgroundColor:k??X.backgroundColor??"#111111",particleCount:e??X.particleCount??300,gravity:y??X.gravity??200,eventHorizonRadius:P??X.eventHorizonRadius??30,diskWidth:o??X.diskWidth??120,jetColor:n??X.jetColor??"#6b7280",showJets:a??!0,lensing:i??!0,speed:r??1,interactive:g??!0,starCount:l??100,starColor:h??"#ffffff",glowingStars:f??!1,starGlowBlur:b??8});return Y.useImperativeHandle(u,()=>_,[_]),Mo.jsx(Io,{canvasRef:O,width:m,height:w,className:B,style:F})});vr.displayName="BlackHole";function Cs(t,u){const s=Y.useRef(u);s.current=u;const v=Y.useRef([]),k=Y.useRef(0),e=Y.useRef(0),y=Y.useRef({starCount:-1,armCount:-1,armTightness:-1}),P=Y.useRef({tiltX:u.tiltX,tiltY:0,targetTX:u.tiltX,targetTY:0}),o=Y.useRef(null);Y.useEffect(()=>{const n=t.current;if(!n)return;const a=n.parentElement;if(!a)return;const i=n.getContext("2d");let r=0,g=0,l=0;function h(H){return Math.sin(H*127.1)*.5+Math.sin(H*311.7)*.3+Math.sin(H*74.3)*.2}function f(){const{starCount:H,armCount:D,armTightness:W}=s.current;v.current=[];const A=Math.floor(H*.15),T=Math.floor(H*.2),E=H-A-T;for(let x=0;x<E;x++){const I=x%D,M=.05+Math.random()*.95,R=I/D*Math.PI*2+M*W*Math.PI*4,c=(h(M*I+x)*.15+(Math.random()-.5)*.1)*(1-M*.5);v.current.push({r:M,baseAngle:R+c,armIndex:I,isHalo:!1,size:Math.max(.3,(1-M*.7)*2.5+Math.random()*.8),brightness:.4+(1-M)*.6+Math.random()*.2,twinkle:Math.random()*Math.PI*2})}for(let x=0;x<T;x++){const I=Math.random()*Math.random()*.18;v.current.push({r:I,baseAngle:Math.random()*Math.PI*2,armIndex:0,isHalo:!1,size:.5+Math.random()*1.5,brightness:.7+Math.random()*.3,twinkle:Math.random()*Math.PI*2})}for(let x=0;x<A;x++)v.current.push({r:.6+Math.random()*.5,baseAngle:Math.random()*Math.PI*2,armIndex:-1,isHalo:!0,size:.3+Math.random()*.6,brightness:.1+Math.random()*.25,twinkle:Math.random()*Math.PI*2})}function b(H,D){const W=window.devicePixelRatio||1;n.width=Math.round(H*W),n.height=Math.round(D*W),n.style.width=`${H}px`,n.style.height=`${D}px`,i.scale(W,W),r=H,g=D,f()}const m=new ResizeObserver(H=>{const{width:D,height:W}=H[0].contentRect;D>0&&W>0&&b(D,W)});m.observe(a);const w=a.getBoundingClientRect();w.width>0&&w.height>0&&b(w.width,w.height);function B(H){if(!s.current.interactive)return;const D=ye(H,n);if(!D)return F();o.current=D}function F(){o.current=null}window.addEventListener("mousemove",B),document.addEventListener("mouseleave",F);function X(H){const{starCount:D,armCount:W,armTightness:A,coreColor:T,diskColor:E,backgroundColor:x,rotationSpeed:I,coreGlow:M,glowBlur:p}=s.current,R=y.current;(R.starCount!==D||R.armCount!==W||R.armTightness!==A)&&(f(),y.current={starCount:D,armCount:W,armTightness:A}),e.current+=H*.001,l+=I*H*.001*300;const c=P.current,d=o.current;d&&s.current.interactive?(c.targetTX=.1+d.y/g*.7,c.targetTY=(d.x/r-.5)*1.2):(c.targetTX=s.current.tiltX,c.targetTY=0),c.tiltX+=(c.targetTX-c.tiltX)*.04,c.tiltY+=(c.targetTY-c.tiltY)*.04,i.fillStyle=x,i.fillRect(0,0,r,g);const $=r/2,C=g/2,S=Math.min(r,g)*.45,N=Math.cos(c.tiltX),z=Math.sin(c.tiltY),L=Math.cos(c.tiltY),G=xo(T),q=xo(E),j=v.current,V=[];for(const K of j){K.twinkle+=.02;const to=K.baseAngle+l*(1-K.r*.3),lo=K.r*S,ao=Math.cos(to)*lo,ro=Math.sin(to)*lo,Q=K.isHalo?(Math.random()-.5)*lo*.3:0,so=ao*L-ro*z,J=ao*z+ro*L,oo=$+so,Z=C+Q*1+J*N,no=J;V.push({sx:oo,sy:Z,sz:no,star:K})}if(V.sort((K,to)=>K.sz-to.sz),M){const K=S*.12,to=i.createRadialGradient($,C,0,$,C,K*3);to.addColorStop(0,`rgba(${G},0.35)`),to.addColorStop(.3,`rgba(${G},0.12)`),to.addColorStop(1,`rgba(${G},0)`),i.beginPath(),i.arc($,C,K*3,0,Math.PI*2),i.fillStyle=to,i.fill(),i.shadowBlur=p,i.shadowColor=`rgb(${G})`,i.beginPath(),i.arc($,C,K*.4,0,Math.PI*2),i.fillStyle=`rgb(${G})`,i.fill(),i.shadowBlur=0}for(const{sx:K,sy:to,sz:lo,star:ao}of V){const ro=.8+.2*Math.sin(ao.twinkle),Q=ao.brightness*ro,so=lo<0?.5+.5*(1+lo/S):1,J=Q*so,oo=ao.isHalo||ao.r>.4?q:G,Z=ao.size*(.7+.3*so);i.beginPath(),i.arc(K,to,Math.max(.2,Z),0,Math.PI*2),i.fillStyle=`rgba(${oo},${Math.min(1,J)})`,i.fill()}}let O=0;function _(H){const D=O?H-O:16;O=H,X(D),k.current=requestAnimationFrame(_)}return k.current=requestAnimationFrame(_),()=>{m.disconnect(),cancelAnimationFrame(k.current),window.removeEventListener("mousemove",B),document.removeEventListener("mouseleave",F)}},[t])}const vs={default:{coreColor:"#ffd8a8",diskColor:"#a8c4ff",backgroundColor:"#020408"},monochrome:{},andromeda:{coreColor:"#ffd8a8",diskColor:"#a8c4ff",backgroundColor:"#020408",armTightness:.6},neon:{coreColor:"#ff00ff",diskColor:"#00ffff",backgroundColor:"#000008",rotationSpeed:6e-4},void:{coreColor:"#8866ff",diskColor:"#4433aa",backgroundColor:"#020005",armCount:3,armTightness:.4},golden:{coreColor:"#ffe066",diskColor:"#ffaa33",backgroundColor:"#060400",rotationSpeed:2e-4}},wr=Y.forwardRef((t,u)=>{const{preset:s,starCount:v,armCount:k,armTightness:e,coreColor:y,diskColor:P,backgroundColor:o,rotationSpeed:n,tiltX:a,interactive:i,coreGlow:r,glowBlur:g,width:l,height:h,className:f,style:b}=t,m=vs[s??"default"]||{},w=Y.useRef(null);return Y.useImperativeHandle(u,()=>w.current),Cs(w,{starCount:v??3e3,armCount:k??m.armCount??2,armTightness:e??m.armTightness??.5,coreColor:y??m.coreColor??"#ffffff",diskColor:P??m.diskColor??"#6b7280",backgroundColor:o??m.backgroundColor??"#111111",rotationSpeed:n??m.rotationSpeed??3e-4,tiltX:a??.3,interactive:i??!0,coreGlow:r??!0,glowBlur:g??30}),Mo.jsx("div",{className:f,style:{width:l??"100%",height:h??"100%",display:"block",overflow:"hidden",...b},children:Mo.jsx("canvas",{ref:w,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});wr.displayName="GalaxySpiral";function St(t,u,s){return s+(u-s)*Math.pow(Math.max(0,Math.min(1,t)),1.9)}function Rt(t,u){return u*.012*(.55+1.6*(1-t))}function ws(t){const u=Y.useRef(t);u.current=t;const s=Y.useRef({streaks:[],dust:[],debris:[],puffs:[],baseX:0,topX:0,t:0,flash:0,bolt:null,nextBolt:2,sprite:{color:"",img:null},dustSprite:{color:"",img:null}}).current,v=Eo(),k=Y.useRef(null);function e(o){s.baseX=s.topX=o/2,s.puffs=Array.from({length:70},(n,a)=>({theta:Math.random()*Math.PI*2,ring:Math.pow(a/70,.7),size:.6+Math.random()*.8,shade:.35+Math.random()*.4})),s.streaks=[]}function y(o,n,a,i,r){const g=u.current,l=i/16.67*g.speed;s.t+=i*.001*g.speed;const h=s.t,f=a*.94,b=f-a*Math.min(.92,Math.max(.3,g.funnelHeight)),m=f-b,w=Math.min(n*.2,m*.32),B=Math.max(5,w*.07);if(!r.overlay){o.fillStyle=g.backgroundColor,o.fillRect(0,0,n,a);const M=o.createLinearGradient(0,0,0,a);M.addColorStop(0,ko(g.funnelColor,.07)),M.addColorStop(.6,ko(g.funnelColor,0)),o.fillStyle=M,o.fillRect(0,0,n,a)}const F=zo(v.current,k.current),X=g.interactive&&F.inside?F.x:n/2+Math.sin(h*.23)*n*.18;s.baseX+=(X-s.baseX)*(1-Math.pow(.975,l)),s.topX+=(s.baseX-s.topX)*(1-Math.pow(.992,l));const O=M=>{const p=s.baseX+(s.topX-s.baseX)*M,R=Math.sin(h*.9+M*4.2)*w*.18*Math.sin(M*Math.PI);return p+R},_=M=>f-M*m,D="#"+Fo([g.backgroundColor,g.funnelColor],.38).map(M=>Math.round(M).toString(16).padStart(2,"0")).join("");if(hn(s.sprite,D)&&(s.sprite={color:D,img:Yo(D,64)}),hn(s.dustSprite,g.debrisColor)&&(s.dustSprite={color:g.debrisColor,img:Yo(g.debrisColor,64)}),g.showLightning&&h>s.nextBolt){s.nextBolt=h+1.5+Math.random()*4,s.flash=1;const M=s.topX+(Math.random()-.5)*w*2.4,p=[[M,b-m*.12]];let R=M,c=b-m*.12;const d=7+(Math.random()*5|0);for(let $=0;$<d;$++)R+=(Math.random()-.5)*w*.5,c+=m*.035+Math.random()*m*.03,p.push([R,c]);s.bolt={pts:p,life:1}}s.flash*=Math.pow(.86,l);const W=Math.min(n*.75,w*4.2);if(s.sprite.img){for(const M of s.puffs){M.theta+=Rt(1,g.rotationSpeed)*.35*l*(1.2-M.ring*.6);const p=W*.5*M.ring,R=m*.07*M.ring,c=s.topX+Math.cos(M.theta)*p,d=b-m*.04+Math.sin(M.theta)*R,$=w*(.55+M.size*.55)*(1-M.ring*.3);o.globalAlpha=Math.min(1,(.1+M.shade*.14)*(1+s.flash*2.5)),o.drawImage(s.sprite.img,c-$,d-$*.55,$*2,$*1.1)}o.globalAlpha=1}o.beginPath();const A=40;for(let M=0;M<=A;M++){const p=M/A,R=O(p)-St(p,w,B);M===0?o.moveTo(R,_(p)):o.lineTo(R,_(p))}for(let M=A;M>=0;M--){const p=M/A;o.lineTo(O(p)+St(p,w,B),_(p))}o.closePath();const T=o.createLinearGradient(0,b,0,f);T.addColorStop(0,ko(g.funnelColor,.32)),T.addColorStop(.6,ko(g.funnelColor,.16)),T.addColorStop(1,ko(g.funnelColor,.08)),o.fillStyle=T,o.fill();const E=Math.ceil(g.particleCount*r.quality);for(;s.streaks.length<E;)s.streaks.push({u:Math.pow(Math.random(),.8),theta:Math.random()*Math.PI*2,len:.25+Math.random()*.5,jitter:Math.random(),bright:.4+Math.random()*.6});s.streaks.length>E&&(s.streaks.length=E);const x=new Path2D,I=new Path2D;for(const M of s.streaks){M.theta+=Rt(M.u,g.rotationSpeed)*l*(.8+M.jitter*.4),M.u+=9e-4*g.vortexStrength*l*(.5+M.jitter),M.u>1&&(M.u-=1);const p=St(M.u,w,B)*(.75+M.jitter*.3),R=O(M.u),c=_(M.u),d=.22,$=M.theta-M.len,C=M.theta,S=Math.sin(M.theta)>0?x:I,N=4;for(let z=0;z<=N;z++){const L=$+(C-$)*(z/N),G=R+Math.cos(L)*p,q=c+Math.sin(L)*p*d;z===0?S.moveTo(G,q):S.lineTo(G,q)}}if(o.lineCap="round",o.strokeStyle=ko(g.funnelColor,.22+s.flash*.3),o.lineWidth=1,o.stroke(I),o.strokeStyle=ko(g.funnelColor,.6+s.flash*.4),o.lineWidth=1.3,o.stroke(x),g.showGroundDust){const M=3*r.quality*l;for(let R=0;R<Math.floor(M)+(Math.random()<M%1?1:0);R++)s.dust.push({x:s.baseX,y:f,theta:Math.random()*Math.PI*2,r:B*(1+Math.random()*2),vy:-(.3+Math.random()*.6),life:1,size:8+Math.random()*18});if(Math.random()<.12*g.vortexStrength*l){const R=Math.random()*Math.PI*2,c=(2+Math.random()*3)*g.vortexStrength;s.debris.push({x:s.baseX+Math.cos(R)*B*2,y:f-4,vx:Math.cos(R)*c,vy:-(2+Math.random()*4)*g.vortexStrength,rot:0,spin:(Math.random()-.5)*.4,size:1.5+Math.random()*3,life:1})}let p=0;for(const R of s.dust)if(R.theta+=Rt(0,g.rotationSpeed)*.8*l,R.r+=.35*l,R.y+=R.vy*l,R.life-=.006*l,!(R.life<=0)&&(s.dust[p++]=R,s.dustSprite.img)){const c=s.baseX+Math.cos(R.theta)*R.r,d=R.y+Math.sin(R.theta)*R.r*.2;o.globalAlpha=R.life*.35,o.drawImage(s.dustSprite.img,c-R.size,d-R.size*.6,R.size*2,R.size*1.2)}s.dust.length=p,o.globalAlpha=1,o.fillStyle=g.debrisColor,p=0;for(const R of s.debris)R.vy+=.12*l,R.vx*=Math.pow(.99,l),R.x+=R.vx*l,R.y+=R.vy*l,R.rot+=R.spin*l,R.y>f&&(R.y=f,R.vy*=-.3,R.vx*=.6,R.life-=.25),R.life-=.004*l,!(R.life<=0)&&(s.debris[p++]=R,o.save(),o.translate(R.x,R.y),o.rotate(R.rot),o.globalAlpha=Math.min(1,R.life*1.5),o.fillRect(-R.size,-R.size*.4,R.size*2,R.size*.8),o.restore());s.debris.length=p,o.globalAlpha=1}s.bolt&&s.bolt.life>0&&(o.strokeStyle=ko(g.lightningColor,s.bolt.life),o.lineWidth=1.6,o.shadowColor=g.lightningColor,o.shadowBlur=12*s.bolt.life,o.beginPath(),s.bolt.pts.forEach(([M,p],R)=>R?o.lineTo(M,p):o.moveTo(M,p)),o.stroke(),o.shadowBlur=0,s.bolt.life-=.08*l),s.flash>.02&&(o.fillStyle=ko(g.lightningColor,s.flash*.12),o.fillRect(0,0,n,a))}const P=To({onResize:o=>e(o),onFrame:y});return k.current=P.canvas,P}function hn(t,u){return t.color!==u}const ks={default:{funnelColor:"#c8d8e8",debrisColor:"#8898a8",lightningColor:"#ffffff",backgroundColor:"#0a1018"},monochrome:{},storm:{funnelColor:"#c8d8e8",debrisColor:"#8898a8",lightningColor:"#ffffff",backgroundColor:"#0a1018",funnelHeight:.85},fire:{funnelColor:"#ff6600",debrisColor:"#cc3300",lightningColor:"#ffaa00",backgroundColor:"#0d0200",rotationSpeed:4},neon:{funnelColor:"#00ffcc",debrisColor:"#ff00aa",lightningColor:"#ffffff",backgroundColor:"#000810",rotationSpeed:5},void:{funnelColor:"#8866ff",debrisColor:"#4433aa",lightningColor:"#cc88ff",backgroundColor:"#020008",rotationSpeed:2}},kr=Y.forwardRef((t,u)=>{const{preset:s,particleCount:v,funnelColor:k,debrisColor:e,lightningColor:y,backgroundColor:P,rotationSpeed:o,funnelHeight:n,vortexStrength:a,showLightning:i,showGroundDust:r,interactive:g,speed:l,width:h,height:f,className:b,style:m}=t,w=ks[s??"default"]||{},{canvasRef:B,canvas:F}=ws({particleCount:v??600,funnelColor:k??w.funnelColor??"#ffffff",debrisColor:e??w.debrisColor??"#6b7280",lightningColor:y??w.lightningColor??"#ffffff",backgroundColor:P??w.backgroundColor??"#111111",rotationSpeed:o??w.rotationSpeed??3,funnelHeight:n??w.funnelHeight??.8,vortexStrength:a??1,showLightning:i??!0,showGroundDust:r??!0,interactive:g??!0,speed:l??1});return Y.useImperativeHandle(u,()=>F,[F]),Mo.jsx(Io,{canvasRef:B,width:h,height:f,className:b,style:m})});kr.displayName="TornadoVortex";function Ss(t,u){const s=Y.useRef(u);s.current=u;const v=Y.useRef([]),k=Y.useRef(0),e=Y.useRef(0),y=Y.useRef(null);Y.useEffect(()=>{const P=t.current;if(!P)return;const o=P.parentElement;if(!o)return;const n=P.getContext("2d");let a=0,i=0;const r=Array.from({length:14},()=>({x:Math.random(),y:Math.random(),r:20+Math.random()*60,a:.03+Math.random()*.05,hue:Math.random()*360}));function g(D,W){const{minRadius:A,maxRadius:T}=s.current,E=A+Math.random()*(T-A);return{x:E+Math.random()*(a-E*2),y:E+Math.random()*(i-E*2),vx:(Math.random()-.5)*1.5,vy:-(.2+Math.random()*.6),r:E,hue:Math.random()*360,shimmerOffset:Math.random()*Math.PI*2,popping:!1,popProgress:0,popParticles:[]}}function l(){const{bubbleCount:D}=s.current;v.current=Array.from({length:D},()=>g())}function h(D,W){const A=Math.min(2,window.devicePixelRatio||1);P.width=Math.round(D*A),P.height=Math.round(W*A),P.style.width=`${D}px`,P.style.height=`${W}px`,n.setTransform(Math.min(2,A),0,0,Math.min(2,A),0,0),a=D,i=W,l()}const f=new ResizeObserver(D=>{const{width:W,height:A}=D[0].contentRect;W>0&&A>0&&h(W,A)});f.observe(o);const b=o.getBoundingClientRect();b.width>0&&b.height>0&&h(b.width,b.height);function m(D){if(!s.current.interactive)return;const W=ye(D,P);if(!W)return w();y.current=W}function w(){y.current=null}function B(D){if(!s.current.popEffect)return;const W=P.getBoundingClientRect(),A=D.clientX-W.left,T=D.clientY-W.top;for(const E of v.current){if(E.popping)continue;const x=A-E.x,I=T-E.y;if(x*x+I*I<E.r*E.r){F(E);break}}}window.addEventListener("mousemove",m),document.addEventListener("mouseleave",w),P.addEventListener("click",B);function F(D){D.popping=!0,D.popProgress=0;const W=8+Math.floor(D.r/8);for(let A=0;A<W;A++){const T=A/W*Math.PI*2,E=1+Math.random()*3;D.popParticles.push({x:D.x+Math.cos(T)*D.r,y:D.y+Math.sin(T)*D.r,vx:Math.cos(T)*E,vy:Math.sin(T)*E,alpha:.8})}}function X(D,W,A,T){const{x:E,y:x,r:I}=D,M=xo(A),p=D.hue;if(T){n.globalCompositeOperation="lighter";const C=n.createRadialGradient(E,x,I*.8,E,x,I*1.45);C.addColorStop(0,`hsla(${p},90%,70%,0.1)`),C.addColorStop(1,`hsla(${p},90%,70%,0)`),n.fillStyle=C,n.beginPath(),n.arc(E,x,I*1.45,0,Math.PI*2),n.fill(),n.globalCompositeOperation="source-over"}const R=n.createRadialGradient(E-I*.3,x-I*.35,I*.1,E,x,I);R.addColorStop(0,"rgba(255,255,255,0.025)"),R.addColorStop(.72,`rgba(${M},0.035)`),R.addColorStop(1,`rgba(${M},0.14)`),n.fillStyle=R,n.beginPath(),n.arc(E,x,I,0,Math.PI*2),n.fill();const c=W*.6+D.shimmerOffset;let d=`hsla(${p},85%,68%,0.5)`;if(typeof n.createConicGradient=="function"){const C=n.createConicGradient(c,E,x);if(C){const S=[[0,0,.6],[.18,60,.15],[.38,150,.55],[.58,220,.12],[.8,300,.5],[1,360,.6]];for(const[N,z,L]of S)C.addColorStop(N,`hsla(${p+z},90%,66%,${L})`);d=C}}const $=Math.max(1.5,I*.09);n.strokeStyle=d,n.lineWidth=$,n.beginPath(),n.arc(E,x,I-$/2,0,Math.PI*2),n.stroke(),n.globalAlpha=.28,n.lineWidth=I*.2,n.beginPath(),n.arc(E,x,I*.84,0,Math.PI*2),n.stroke(),n.globalAlpha=1,n.strokeStyle="rgba(255,255,255,0.32)",n.lineWidth=1,n.beginPath(),n.arc(E,x,I,0,Math.PI*2),n.stroke(),n.lineCap="round",n.strokeStyle=`rgba(${M},0.75)`,n.lineWidth=Math.max(1.2,I*.07),n.beginPath(),n.arc(E,x,I*.72,Math.PI*1.06,Math.PI*1.38),n.stroke(),n.fillStyle=`rgba(${M},0.9)`,n.beginPath(),n.arc(E-I*.3,x-I*.6,Math.max(1,I*.055),0,Math.PI*2),n.fill(),n.strokeStyle=`rgba(${M},0.22)`,n.lineWidth=Math.max(1,I*.05),n.beginPath(),n.arc(E,x,I*.78,Math.PI*.12,Math.PI*.36),n.stroke()}function O(D){const{bubbleCount:W,backgroundColor:A,shimmerColor:T,gravity:E,friction:x,interactive:I,mergeOnCollide:M,glowEffect:p,popEffect:R}=s.current;e.current+=D*.001;const c=e.current,d=xo(A),$=n.createLinearGradient(0,0,a,i);$.addColorStop(0,`rgb(${d.split(",").map(N=>Math.min(255,+N+14)).join(",")})`),$.addColorStop(1,`rgb(${d})`),n.fillStyle=$,n.fillRect(0,0,a,i),n.globalCompositeOperation="lighter";for(const N of r){const z=N.x*a+Math.sin(c*.1+N.hue)*12,L=N.y*i,G=n.createRadialGradient(z,L,0,z,L,N.r);G.addColorStop(0,`hsla(${N.hue},70%,65%,${N.a})`),G.addColorStop(.7,`hsla(${N.hue},70%,65%,${N.a*.6})`),G.addColorStop(1,`hsla(${N.hue},70%,65%,0)`),n.fillStyle=G,n.beginPath(),n.arc(z,L,N.r,0,Math.PI*2),n.fill()}n.globalCompositeOperation="source-over";const C=v.current,S=y.current;for(;C.filter(N=>!N.popping).length<W;){const N=g();N.y=i+N.r+Math.random()*30,C.push(N)}for(let N=0;N<C.length;N++){const z=C[N];if(z.popping){z.popProgress+=.08;for(const L of z.popParticles)L.x+=L.vx,L.y+=L.vy,L.alpha-=.05;z.popParticles=z.popParticles.filter(L=>L.alpha>0);continue}if(z.vy+=E-.03,z.vx+=Math.sin(c*.5+z.shimmerOffset)*.012,z.vx*=x,z.vy*=x,z.vy=Math.max(-1.1,Math.min(1.1,z.vy)),z.x+=z.vx,z.y+=z.vy,z.hue=(z.hue+.3)%360,I&&S){const L=z.x-S.x,G=z.y-S.y,q=Math.sqrt(L*L+G*G)||.001;if(q<z.r+60){const j=(z.r+60-q)*.015;z.vx+=L/q*j,z.vy+=G/q*j}}z.x+z.r<-4?z.x=a+z.r:z.x-z.r>a+4&&(z.x=-z.r),z.y+z.r<-4?(z.y=i+z.r+2,z.x=Math.random()*a):z.y-z.r>i+4&&(z.y=-z.r-2,z.x=Math.random()*a);for(let L=N+1;L<C.length;L++){const G=C[L];if(G.popping)continue;const q=G.x-z.x,j=G.y-z.y,V=Math.sqrt(q*q+j*j)||.001,K=z.r+G.r;if(V<K)if(M&&V<K*.6){const to=Math.min(s.current.maxRadius,Math.sqrt(z.r*z.r+G.r*G.r));z.r=to,z.x=(z.x+G.x)/2,z.y=(z.y+G.y)/2,z.vx=(z.vx+G.vx)*.5,z.vy=(z.vy+G.vy)*.5,G.popping=!0,G.popProgress=1}else{const to=q/V,lo=j/V,ao=K-V;z.x-=to*ao*.5,z.y-=lo*ao*.5,G.x+=to*ao*.5,G.y+=lo*ao*.5;const ro=z.vx-G.vx,Q=z.vy-G.vy,so=ro*to+Q*lo;so>0&&(z.vx-=so*to*.7,z.vy-=so*lo*.7,G.vx+=so*to*.7,G.vy+=so*lo*.7)}}}for(const N of C)if(!(N.popping&&N.popProgress>=1))if(!N.popping)X(N,c,T,p);else{const z=N.r*(1+N.popProgress*1.5);n.beginPath(),n.arc(N.x,N.y,z,0,Math.PI*2),n.strokeStyle=`hsla(${N.hue},80%,70%,${.6*(1-N.popProgress)})`,n.lineWidth=2,n.stroke();for(const L of N.popParticles)n.beginPath(),n.arc(L.x,L.y,2,0,Math.PI*2),n.fillStyle=`hsla(${N.hue},80%,75%,${L.alpha})`,n.fill()}v.current=C.filter(N=>!N.popping||N.popProgress<1.5)}let _=0;function H(D){const W=_?D-_:16;_=D,O(W),k.current=requestAnimationFrame(H)}return k.current=requestAnimationFrame(H),()=>{f.disconnect(),cancelAnimationFrame(k.current),window.removeEventListener("mousemove",m),document.removeEventListener("mouseleave",w),P.removeEventListener("click",B)}},[t])}const Rs={default:{backgroundColor:"#050a12",shimmerColor:"#ffffff"},monochrome:{},soap:{backgroundColor:"#050a12",shimmerColor:"#ffffff",gravity:.01,minRadius:25,maxRadius:90},neon:{backgroundColor:"#000008",shimmerColor:"#00ffff",gravity:.015,bubbleCount:12},deep:{backgroundColor:"#010510",shimmerColor:"#88aaff",gravity:.008,minRadius:15,maxRadius:60,bubbleCount:20},minimal:{backgroundColor:"#111111",shimmerColor:"#ffffff",gravity:.025,bubbleCount:8,minRadius:30,maxRadius:100}},Sr=Y.forwardRef((t,u)=>{const{preset:s,bubbleCount:v,minRadius:k,maxRadius:e,backgroundColor:y,shimmerColor:P,popEffect:o,gravity:n,friction:a,interactive:i,mergeOnCollide:r,glowEffect:g,width:l,height:h,className:f,style:b}=t,m=Rs[s??"default"]||{},w=Y.useRef(null);return Y.useImperativeHandle(u,()=>w.current),Ss(w,{bubbleCount:v??m.bubbleCount??15,minRadius:k??m.minRadius??20,maxRadius:e??m.maxRadius??50,backgroundColor:y??m.backgroundColor??"#111111",shimmerColor:P??m.shimmerColor??"#ffffff",popEffect:o??!0,gravity:n??m.gravity??.02,friction:a??.995,interactive:i??!0,mergeOnCollide:r??!0,glowEffect:g??!0}),Mo.jsx("div",{className:f,style:{width:l??"100%",height:h??"100%",display:"block",overflow:"hidden",cursor:"pointer",...b},children:Mo.jsx("canvas",{ref:w,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});Sr.displayName="BubbleUniverse";function Ps(t){return .4+.6*Math.sqrt(Math.max(0,1-t*t))}function Pt(t,u,s,v,k,e){const y=v.angle+(k-.5)*v.span,P=s*(1+Math.sin(k*Math.PI)*v.height*e);return[t+Math.cos(y)*P,u+Math.sin(y)*P]}function xs(t){const u=Y.useRef(t);u.current=t;const s=Y.useRef({t:0,loops:[],flares:[],plasma:[],nextAuto:1.5,tex:null,spots:[],stars:[],corona:{color:"",img:null},flareSprite:{color:"",img:null}}).current,v=Eo(),k=Y.useRef(null);function e(n,a){s.loops=Array.from({length:4},()=>({angle:Math.random()*Math.PI*2,span:.18+Math.random()*.22,height:.18+Math.random()*.22,phase:Math.random()*10,flow:Array.from({length:26},()=>Math.random())})),s.spots=Array.from({length:3},()=>({lat:(Math.random()-.5)*.8,lon:Math.random()*Math.PI*2,r:.05+Math.random()*.05})),s.stars=Array.from({length:Math.round(n*a/4e3)},()=>({x:Math.random()*n,y:Math.random()*a,a:.1+Math.random()*.4}))}function y(n){var r,g;if(s.tex&&s.tex.n===n)return s.tex;if(typeof document>"u")return null;const a=document.createElement("canvas");a.width=a.height=n;const i=(g=(r=a.getContext("2d"))==null?void 0:r.createImageData)==null?void 0:g.call(r,n,n);return i?(s.tex={c:a,img:i,n},s.tex):null}function P(n,a,i,r,g){var A;const l=u.current,h=r/16.67*l.speed;s.t+=r*.001*l.speed;const f=s.t,b=a/2,m=i/2,w=Math.max(10,Math.min(a,i)/2*l.sunRadius);if(!g.overlay){n.fillStyle=l.backgroundColor,n.fillRect(0,0,a,i),n.fillStyle="#ffffff";for(const T of s.stars)n.globalAlpha=T.a,n.fillRect(T.x,T.y,1,1);n.globalAlpha=1}s.corona.color!==l.coronaColor&&(s.corona={color:l.coronaColor,img:Yo(l.coronaColor,128)}),s.flareSprite.color!==l.flareColor&&(s.flareSprite={color:l.flareColor,img:Yo(l.flareColor,32)});const B=n.globalCompositeOperation;if(n.globalCompositeOperation="lighter",l.glowEffect&&s.corona.img){const T=w*2.2+l.glowBlur*2;n.globalAlpha=.55,n.drawImage(s.corona.img,b-T,m-T,T*2,T*2)}for(let T=0;T<28;T++){const E=T/28*Math.PI*2+f*.02+Math.sin(T*7.3)*.1,x=w*(.5+.9*Zo(T*.7,f*.15,3,2)),I=.06+.05*Math.sin(T*3.1),M=n.createLinearGradient(b+Math.cos(E)*w*.95,m+Math.sin(E)*w*.95,b+Math.cos(E)*(w+x),m+Math.sin(E)*(w+x));M.addColorStop(0,ko(l.coronaColor,.22)),M.addColorStop(1,ko(l.coronaColor,0)),n.globalAlpha=1,n.fillStyle=M,n.beginPath(),n.moveTo(b+Math.cos(E-I)*w*.95,m+Math.sin(E-I)*w*.95),n.lineTo(b+Math.cos(E)*(w+x),m+Math.sin(E)*(w+x)),n.lineTo(b+Math.cos(E+I)*w*.95,m+Math.sin(E+I)*w*.95),n.closePath(),n.fill()}n.globalCompositeOperation=B,n.globalAlpha=1;const F=Math.round(Math.min(140,Math.max(64,w*.9))*(g.quality<.75?.6:1)),X=y(F);if(X){const T=Fo([l.sunColor],0),E=Fo([l.sunColor,l.coronaColor],.55),x=2+l.convectionCells*.22,I=X.img.data,M=f*.03;for(let p=0;p<F;p++){const R=(p+.5)/F*2-1;for(let c=0;c<F;c++){const d=(c+.5)/F*2-1,$=d*d+R*R,C=(p*F+c)*4;if($>1){I[C+3]=0;continue}const S=Math.sqrt($),N=Math.sqrt(1-$),z=Math.atan2(d,N)+M,L=Math.asin(R),G=Zo(z*x,L*x+f*.05,3,9),q=Zo(z*x*3.1-f*.2,L*x*3.1,2,4);let j=Ps(S)*(.72+.4*G+.18*(q-.5));for(const K of s.spots){const to=Math.atan2(Math.sin(z-K.lon),Math.cos(z-K.lon)),lo=Math.hypot(to*Math.cos(L),L-K.lat)/K.r;lo<1.6&&(j*=lo<1?.25+.2*lo:.55+.45*((lo-1)/.6))}const V=1-N;I[C]=Math.min(255,(T[0]+(E[0]-T[0])*V)*j*1.1),I[C+1]=Math.min(255,(T[1]+(E[1]-T[1])*V)*j*1.1),I[C+2]=Math.min(255,(T[2]+(E[2]-T[2])*V)*j*1.1),I[C+3]=255}}(A=X.c.getContext("2d"))==null||A.putImageData(X.img,0,0),n.imageSmoothingEnabled=!0,n.drawImage(X.c,b-w,m-w,w*2,w*2)}const O=zo(v.current,k.current),_=T=>{if(s.flares.length>=Math.max(1,l.flareCount))return;s.flares.push({angle:T,age:0,life:2.8+Math.random()*1.5});const E=b+Math.cos(T)*w,x=m+Math.sin(T)*w;for(let I=0;I<70;I++){const M=T+(Math.random()-.5)*.9,p=1.5+Math.random()*4.5;s.plasma.push({x:E,y:x,vx:Math.cos(M)*p,vy:Math.sin(M)*p,life:1,size:.8+Math.random()*2})}};if(l.interactive)for(const T of O.taps)_(Math.atan2(T.y-m,T.x-b));l.autoFlare&&f>s.nextAuto&&(s.nextAuto=f+Math.max(.3,l.autoFlareInterval/1e3)*(.7+Math.random()*.6),_(Math.random()*Math.PI*2)),n.globalCompositeOperation="lighter";const H=s.flareSprite.img;for(const T of s.loops){T.angle+=4e-4*h;const E=.75+.25*Math.sin(f*.4+T.phase);n.strokeStyle=ko(l.flareColor,.18),n.lineWidth=w*.03,n.beginPath();for(let x=0;x<=24;x++){const[I,M]=Pt(b,m,w,T,x/24,E);x?n.lineTo(I,M):n.moveTo(I,M)}if(n.stroke(),H)for(let x=0;x<T.flow.length;x++){T.flow[x]=(T.flow[x]+.004*h*(x%2?1:-1)+1)%1;const[I,M]=Pt(b,m,w,T,T.flow[x],E),p=w*.07;n.globalAlpha=.5,n.drawImage(H,I-p,M-p,p*2,p*2)}}let D=0;for(const T of s.flares){if(T.age+=r*.001*l.speed,T.age>T.life)continue;s.flares[D++]=T;const E=T.age/T.life,x={angle:T.angle,span:.32,height:.25+E*1.4};n.globalAlpha=Math.max(0,1-E)*.9,n.strokeStyle=l.flareColor,n.lineWidth=w*.035*(1-E*.6),n.beginPath();for(let I=0;I<=30;I++){const[M,p]=Pt(b,m,w,x,I/30,1);I?n.lineTo(M,p):n.moveTo(M,p)}if(n.stroke(),H&&E<.35){const I=w*(.5-E);n.globalAlpha=1-E/.35,n.drawImage(H,b+Math.cos(T.angle)*w-I,m+Math.sin(T.angle)*w-I,I*2,I*2)}}s.flares.length=D;let W=0;for(const T of s.plasma){const E=T.x-b,x=T.y-m,I=E*E+x*x,M=w*w*.12/Math.max(I,w*w);if(T.vx-=E/Math.sqrt(I)*M*h,T.vy-=x/Math.sqrt(I)*M*h,T.x+=T.vx*h,T.y+=T.vy*h,T.life-=.006*h,!(T.life<=0||I<w*w*.9)&&(s.plasma[W++]=T,H)){const p=T.size*3;n.globalAlpha=T.life,n.drawImage(H,T.x-p,T.y-p,p*2,p*2)}}s.plasma.length=W,n.globalAlpha=1,n.globalCompositeOperation=B}const o=To({onResize:e,onFrame:P});return k.current=o.canvas,o}const $s={default:{sunColor:"#ff6600",coronaColor:"#ff3300",flareColor:"#ffaa00",backgroundColor:"#0a0200"},monochrome:{},inferno:{sunColor:"#ff6600",coronaColor:"#ff3300",flareColor:"#ffaa00",backgroundColor:"#0a0200",glowBlur:60},plasma:{sunColor:"#cc44ff",coronaColor:"#8800cc",flareColor:"#ff88ff",backgroundColor:"#050008",glowBlur:50},neon:{sunColor:"#00ffcc",coronaColor:"#00aaff",flareColor:"#ffffff",backgroundColor:"#000810",glowBlur:45},"white-dwarf":{sunColor:"#eef4ff",coronaColor:"#aac4ff",flareColor:"#ffffff",backgroundColor:"#000008",sunRadius:.15,glowBlur:80}},Rr=Y.forwardRef((t,u)=>{const{preset:s,sunColor:v,coronaColor:k,flareColor:e,backgroundColor:y,sunRadius:P,convectionCells:o,flareCount:n,autoFlare:a,autoFlareInterval:i,interactive:r,glowEffect:g,glowBlur:l,speed:h,width:f,height:b,className:m,style:w}=t,B=$s[s??"default"]||{},{canvasRef:F,canvas:X}=xs({sunColor:v??B.sunColor??"#ffffff",coronaColor:k??B.coronaColor??"#6b7280",flareColor:e??B.flareColor??"#ffffff",backgroundColor:y??B.backgroundColor??"#111111",sunRadius:P??B.sunRadius??.35,convectionCells:o??20,flareCount:n??3,autoFlare:a??!0,autoFlareInterval:i??3e3,interactive:r??!0,glowEffect:g??!0,glowBlur:l??B.glowBlur??40,speed:h??1});return Y.useImperativeHandle(u,()=>X,[X]),Mo.jsx(Io,{canvasRef:F,width:f,height:b,className:m,style:{cursor:"crosshair",...w}})});Rr.displayName="SolarFlare";const fe=(t,u,s)=>{const v=t.split(",").map(Number),k=u.split(",").map(Number);return v.map((e,y)=>Math.round(e+(k[y]-e)*s)).join(",")};function Is(t,u,s,v){const k=v.x-s.x,e=v.y-s.y,y=u.x*e-u.y*k;if(Math.abs(y)<1e-9)return 1/0;const P=((s.x-t.x)*e-(s.y-t.y)*k)/y,o=((s.x-t.x)*u.y-(s.y-t.y)*u.x)/y;return P>0&&o>=0&&o<=1?P:1/0}function Ts(t,u){const s=Y.useRef(u);s.current=u,Y.useEffect(()=>{const v=t.current;if(!v)return;const k=v.parentElement,e=v.getContext("2d");let y=0,P=0,o=1,n={x:0,y:0},a=[],i=[],r=[],g=[],l=[],h=[],f=0,b=0,m="";const w={x:-9999,y:-9999,px:-9999,py:-9999},B={x:0,y:0,tx:0,ty:0,heading:Math.PI/2,walk:0,lastActive:-99};function F(){const R=s.current;f=Math.max(5,Math.round(R.spokeCount)),b=Math.max(3,Math.round(R.ringCount)),m=`${f}|${b}|${y}|${P}`;let c=11;const d=()=>((c=c*16807%2147483647)-1)/2147483646;o=Math.min(y,P)/420,n={x:y*.5,y:P*.48};const $=Math.min(y*.44,P*.8),C=P*.44,S=7;a=Array.from({length:S},(L,G)=>{const q=G/S*Math.PI*2+(d()-.5)*.35,j=.95+d()*.12;return{x:n.x+Math.cos(q)*$*j,y:n.y+Math.sin(q)*C*j}}),i=a.map(L=>{const G={x:L.x-n.x,y:L.y-n.y};let q=1/0;return G.x>0&&(q=Math.min(q,(y-L.x)/G.x)),G.x<0&&(q=Math.min(q,-L.x/G.x)),G.y>0&&(q=Math.min(q,(P-L.y)/G.y)),G.y<0&&(q=Math.min(q,-L.y/G.y)),[L,{x:L.x+G.x*q,y:L.y+G.y*q}]}),r=[];const N=[],z=[];for(let L=0;L<f;L++){const G=L/f*Math.PI*2+(d()-.5)*.12,q={x:Math.cos(G),y:Math.sin(G)};let j=1/0;for(let V=0;V<S;V++)j=Math.min(j,Is(n,q,a[V],a[(V+1)%S]));isFinite(j)||(j=Math.min($,C)),z.push(q),N.push(j),r.push({x:n.x+q.x*j,y:n.y+q.y*j})}g=[];for(let L=0;L<b;L++)for(let G=0;G<f;G++){const q=(L+G/f)/b,j=N[G]*(.17+.77*q);g.push({bx:n.x+z[G].x*j,by:n.y+z[G].y*j,ox:0,oy:0,vx:0,vy:0,f:.17+.77*q})}l=[];for(let L=0;L<g.length-1;L++)if(d()<.45){const G=1+Math.floor(d()*3);for(let q=0;q<G;q++)l.push({seg:L,u:.15+d()*.7,r:(.9+d()*1.6)*Math.max(.7,o)})}h=Array.from({length:12},()=>({x:d()*y,y:d()*P,r:(18+d()*50)*Math.max(.6,o),a:.03+d()*.05})),B.x=B.tx=n.x,B.y=B.ty=n.y}function X(R,c){const d=Math.min(2,window.devicePixelRatio||1);v.width=Math.round(R*d),v.height=Math.round(c*d),v.style.width=`${R}px`,v.style.height=`${c}px`,e.setTransform(d,0,0,d,0,0),y=R,P=c,F()}const O=new ResizeObserver(R=>{const{width:c,height:d}=R[0].contentRect;c>0&&d>0&&X(c,d)});O.observe(k);const _=k.getBoundingClientRect();_.width>0&&_.height>0&&X(_.width,_.height);function H(R){const c=ye(R,v);if(!c)return D();w.px=w.x<-9e3?c.x:w.x,w.py=w.y<-9e3?c.y:w.y,w.x=c.x,w.y=c.y}function D(){w.x=w.y=w.px=w.py=-9999}window.addEventListener("mousemove",H),document.addEventListener("mouseleave",D);const W=R=>({x:R.bx+R.ox,y:R.by+R.oy}),A=(R,c,d)=>{const $=(R.x+c.x)/2,C=(R.y+c.y)/2;return{x:$+(d.x-$)*.07,y:C+(d.y-C)*.07}},T=(R,c,d,$)=>({x:(1-$)*(1-$)*R.x+2*(1-$)*$*c.x+$*$*d.x,y:(1-$)*(1-$)*R.y+2*(1-$)*$*c.y+$*$*d.y});function E(R,c,d,$,C){const S=2*Math.max(.65,o),N=Math.cos(R.heading),z=Math.sin(R.heading),L=-z,G=N,q=(ao,ro)=>({x:R.x+N*ao*S+L*ro*S,y:R.y+z*ao*S+G*ro*S});e.lineCap="round",e.lineJoin="round";const j=[[.5,16,-.55],[1.05,13,-.35],[2.05,11,.4],[2.6,14,.5]],V=q(1.8,0);for(const ao of[-1,1])j.forEach(([ro,Q,so],J)=>{const oo=C?Math.sin(R.walk+J*1.6+(ao>0?Math.PI:0))*.18:0,Z=R.heading+ao*(ro+oo),no={x:V.x+Math.cos(Z)*Q*.55*S,y:V.y+Math.sin(Z)*Q*.55*S},U=Z+ao*so,eo={x:no.x+Math.cos(U)*Q*.7*S,y:no.y+Math.sin(U)*Q*.7*S};e.beginPath(),e.moveTo(V.x,V.y),e.lineTo(no.x,no.y),e.lineTo(eo.x,eo.y),e.strokeStyle=`rgba(${fe(c,d,.2)},1)`,e.lineWidth=1.1*S,e.stroke(),e.strokeStyle=`rgba(${fe(c,d,.6)},0.55)`,e.lineWidth=.4*S,e.stroke()});const K=q(-8.5,0);e.save(),e.translate(K.x,K.y),e.rotate(R.heading);const to=e.createRadialGradient(-2*S,-3*S,.5*S,0,0,9*S);to.addColorStop(0,`rgba(${fe(c,d,.55)},1)`),to.addColorStop(1,`rgba(${c},1)`),e.fillStyle=to,e.beginPath(),e.ellipse(0,0,8.5*S,6.5*S,0,0,Math.PI*2),e.fill(),e.strokeStyle=`rgba(${d},0.7)`,e.lineWidth=.6*S,e.stroke(),e.strokeStyle=`rgba(${d},0.65)`,e.lineWidth=.9*S;for(let ao=0;ao<3;ao++){const ro=-4.5*S+ao*3*S;e.beginPath(),e.moveTo(ro-1.6*S,-2.6*S),e.lineTo(ro+.8*S,0),e.lineTo(ro-1.6*S,2.6*S),e.stroke()}e.fillStyle="rgba(255,255,255,0.22)",e.beginPath(),e.ellipse(-1.5*S,-2.8*S,3.5*S,1.4*S,-.2,0,Math.PI*2),e.fill(),e.restore();const lo=q(1.8,0);e.save(),e.translate(lo.x,lo.y),e.rotate(R.heading),e.fillStyle=`rgba(${fe(c,"0,0,0",.15)},1)`,e.beginPath(),e.ellipse(0,0,4.2*S,3.4*S,0,0,Math.PI*2),e.fill(),e.strokeStyle=`rgba(${d},0.6)`,e.lineWidth=.5*S,e.stroke(),e.fillStyle=`rgba(${d},0.95)`;for(const ao of[-1,1])e.beginPath(),e.ellipse(3*S,ao*1.1*S,.7*S,.7*S,0,0,Math.PI*2),e.fill();e.restore()}let x=0,I=0,M=0;function p(R){x=requestAnimationFrame(p);const c=I?Math.min(.05,(R-I)/1e3):1/60;if(I=R,M+=c,y===0)return;const d=s.current;`${Math.max(5,Math.round(d.spokeCount))}|${Math.max(3,Math.round(d.ringCount))}|${y}|${P}`!==m&&F();const $=xo(d.webColor),C=xo(d.glowColor),S=xo(d.backgroundColor),N=xo(d.spiderColor),z=e.createRadialGradient(y*.5,P*.45,0,y*.5,P*.5,Math.hypot(y,P)*.6);z.addColorStop(0,`rgb(${fe(S,C,.12)})`),z.addColorStop(1,`rgb(${S})`),e.fillStyle=z,e.fillRect(0,0,y,P);const L={x:y*.86,y:P*.17},G=d.moonColor?xo(d.moonColor):fe(C,"255,255,255",.7),q=d.moonColor?G:C;if(e.globalCompositeOperation="lighter",d.showMoon){const J=e.createRadialGradient(L.x,L.y,0,L.x,L.y,P*.55);J.addColorStop(0,`rgba(${q},0.22)`),J.addColorStop(1,`rgba(${q},0)`),e.fillStyle=J,e.fillRect(0,0,y,P)}for(const J of h){const oo=e.createRadialGradient(J.x,J.y,0,J.x,J.y,J.r);oo.addColorStop(0,`rgba(${C},${J.a})`),oo.addColorStop(.75,`rgba(${C},${J.a*.6})`),oo.addColorStop(1,`rgba(${C},0)`),e.fillStyle=oo,e.beginPath(),e.arc(J.x+Math.sin(M*.1+J.r)*6,J.y,J.r,0,Math.PI*2),e.fill()}if(d.showMoon){const J=14*Math.max(.7,o),oo=e.createRadialGradient(L.x,L.y,J*.8,L.x,L.y,J*2.6);oo.addColorStop(0,`rgba(${G},0.18)`),oo.addColorStop(1,`rgba(${G},0)`),e.fillStyle=oo,e.fillRect(L.x-J*2.6,L.y-J*2.6,J*5.2,J*5.2),e.fillStyle=`rgba(${G},0.55)`,e.beginPath(),e.arc(L.x,L.y,J,0,Math.PI*2),e.fill()}e.globalCompositeOperation="source-over";const j=d.swaySpeed,V=(Math.sin(M*.55*j)*.7+Math.sin(M*1.6*j+1)*.3)*6*o,K=Math.sin(M*.8*j+2)*2.5*o,to=d.interactive&&w.x>-9e3,lo=d.disturbRadius,ao=to?Math.min(40,Math.hypot(w.x-w.px,w.y-w.py)):0;for(const J of g){const oo=Math.sin(Math.PI*Math.min(1,J.f));let Z=V*oo,no=K*oo;if(to){const U=J.bx+J.ox-w.x,eo=J.by+J.oy-w.y,co=Math.hypot(U,eo);if(co<lo&&co>.01){const fo=(1-co/lo)**2;Z+=U/co*fo*16,no+=eo/co*fo*16,J.vx+=U/co*fo*ao*6,J.vy+=eo/co*fo*ao*6}}J.vx+=(-(J.ox-Z)*70-J.vx*5)*c,J.vy+=(-(J.oy-no)*70-J.vy*5)*c,J.ox+=J.vx*c,J.oy+=J.vy*c}w.px=w.x,w.py=w.y;const ro={x:n.x+V*.15,y:n.y+K*.15},Q=Math.atan2(L.y-n.y,L.x-n.x);e.lineCap="round",e.strokeStyle=`rgba(${$},0.5)`,e.lineWidth=.9,e.beginPath();for(const[J,oo]of i)e.moveTo(J.x,J.y),e.lineTo(oo.x,oo.y);a.forEach((J,oo)=>{const Z=a[(oo+1)%a.length];e.moveTo(J.x,J.y),e.lineTo(Z.x,Z.y)}),e.stroke(),e.strokeStyle=`rgba(${$},0.62)`,e.lineWidth=.85;for(let J=0;J<f;J++){e.beginPath(),e.moveTo(ro.x,ro.y);for(let oo=0;oo<b;oo++){const Z=W(g[oo*f+J]);e.lineTo(Z.x,Z.y)}e.lineTo(r[J].x,r[J].y),e.stroke()}e.strokeStyle=`rgba(${$},0.55)`,e.lineWidth=.7;for(const J of[.035,.065,.095]){e.beginPath();for(let oo=0;oo<=f;oo++){const Z=r[oo%f],no=ro.x+(Z.x-n.x)*J,U=ro.y+(Z.y-n.y)*J;oo?e.lineTo(no,U):e.moveTo(no,U)}e.stroke()}const so=fe($,C,.6);for(let J=0;J<g.length-1;J++){const oo=W(g[J]),Z=W(g[J+1]),no=A(oo,Z,ro),U=Math.atan2(Z.y-oo.y,Z.x-oo.x),eo=Math.abs(Math.cos(U-Q+M*.25));e.strokeStyle=`rgba(${eo>.75?fe(so,"255,255,255",.35):$},${.32+eo*.45})`,e.lineWidth=.7+eo*.35,e.beginPath(),e.moveTo(oo.x,oo.y),e.quadraticCurveTo(no.x,no.y,Z.x,Z.y),e.stroke()}if(d.dewDrops){const J=fe(C,"255,255,255",.75);for(const oo of l){const Z=W(g[oo.seg]),no=W(g[oo.seg+1]),U=T(Z,A(Z,no,ro),no,oo.u),eo=.6+.4*Math.sin(M*2+oo.seg*1.7+oo.u*9);e.globalCompositeOperation="lighter",e.fillStyle=`rgba(${C},${.12*eo})`,e.beginPath(),e.arc(U.x,U.y,oo.r*3.2,0,Math.PI*2),e.fill(),e.globalCompositeOperation="source-over",e.fillStyle=`rgba(${fe(S,C,.35)},0.85)`,e.beginPath(),e.arc(U.x,U.y,oo.r,0,Math.PI*2),e.fill(),e.strokeStyle=`rgba(${C},0.75)`,e.lineWidth=.6,e.stroke(),e.fillStyle=`rgba(${J},${.6+.4*eo})`,e.beginPath(),e.arc(U.x-oo.r*.35,U.y-oo.r*.35,Math.max(.4,oo.r*.38),0,Math.PI*2),e.fill()}}if(d.showSpider){to&&Math.hypot((w.x-n.x)/(y*.44),(w.y-n.y)/(P*.44))<1?(B.tx=n.x+(w.x-n.x)*.85,B.ty=n.y+(w.y-n.y)*.85,B.lastActive=M):M-B.lastActive>2.5&&(B.tx=ro.x,B.ty=ro.y);const oo=B.tx-B.x,Z=B.ty-B.y,no=Math.hypot(oo,Z),U=no>2;if(U){const eo=Math.min(no,75*Math.max(.7,o)*c);B.x+=oo/no*eo,B.y+=Z/no*eo,B.walk+=eo*.35;let fo=Math.atan2(Z,oo)-B.heading;fo=Math.atan2(Math.sin(fo),Math.cos(fo)),B.heading+=fo*Math.min(1,c*6)}else{let eo=Math.PI/2-B.heading;eo=Math.atan2(Math.sin(eo),Math.cos(eo)),B.heading+=eo*Math.min(1,c*2)}E(B,N,C,M,U)}}return x=requestAnimationFrame(p),()=>{O.disconnect(),cancelAnimationFrame(x),window.removeEventListener("mousemove",H),document.removeEventListener("mouseleave",D)}},[t])}const As={default:{webColor:"#c0c8e0",backgroundColor:"#04081a",spiderColor:"#404060",glowColor:"#8899cc"},monochrome:{webColor:"#d8d8d8",backgroundColor:"#0a0a0a",spiderColor:"#c0c0c0",glowColor:"#e0e0e0"},night:{webColor:"#c0c8e0",backgroundColor:"#04081a",spiderColor:"#404060",glowColor:"#8899cc"},forest:{webColor:"#90b890",backgroundColor:"#050f05",spiderColor:"#2a4a2a",glowColor:"#66aa66"},neon:{webColor:"#00ffcc",backgroundColor:"#000000",spiderColor:"#003322",glowColor:"#00ffff"},frost:{webColor:"#e0f0ff",backgroundColor:"#040810",spiderColor:"#203040",glowColor:"#aaddff"}},Pr=Y.forwardRef((t,u)=>{const{preset:s,spokeCount:v,ringCount:k,webColor:e,backgroundColor:y,spiderColor:P,dewDrops:o,glowColor:n,swaySpeed:a,disturbRadius:i,interactive:r,showSpider:g,showMoon:l,moonColor:h,width:f,height:b,className:m,style:w}=t,B=As[s??"default"]||{},F=Y.useRef(null);return Y.useImperativeHandle(u,()=>F.current),Ts(F,{spokeCount:v??12,ringCount:k??10,webColor:e??B.webColor??"#d8d8d8",backgroundColor:y??B.backgroundColor??"#0a0a0a",spiderColor:P??B.spiderColor??"#c0c0c0",dewDrops:o??!0,glowColor:n??B.glowColor??"#e0e0e0",swaySpeed:a??1,disturbRadius:i??80,interactive:r??!0,showSpider:g??!0,showMoon:l??!0,moonColor:h??""}),Mo.jsx("div",{className:m,style:{width:f??"100%",height:b??"100%",display:"block",overflow:"hidden",cursor:"crosshair",...w},children:Mo.jsx("canvas",{ref:F,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});Pr.displayName="SpiderWeb";const Es=26,me=(t,u,s)=>{const v=t.split(",").map(Number),k=u.split(",").map(Number);return v.map((e,y)=>Math.round(e+(k[y]-e)*s)).join(",")},xt=t=>t.startsWith("#")?xo(t):"255,255,255";function zs(t){t.beginPath(),t.moveTo(.04,-.12),t.bezierCurveTo(.28,-.5,.7,-.88,1.08,-.88),t.bezierCurveTo(1,-.6,.92,-.25,.76,.02),t.bezierCurveTo(.5,.07,.25,.05,.05,.02),t.closePath()}function Ls(t){t.beginPath(),t.moveTo(.05,-.01),t.bezierCurveTo(.45,-.06,.86,.12,.8,.42),t.bezierCurveTo(.76,.7,.45,.94,.22,.88),t.bezierCurveTo(.1,.72,.04,.45,.03,.2),t.closePath()}const Fs=[[1,-.82],[.95,-.55],[.86,-.22],[.62,.03],[.6,-.66]],Bs=[[.76,.3],[.7,.58],[.48,.84],[.26,.84]],Os=[[1,-.8],[.97,-.66],[.93,-.5],[.88,-.34],[.81,-.17],[.88,-.76],[.92,-.69]],Ws=[[.78,.33],[.76,.5],[.66,.7],[.48,.83],[.31,.83]];function un(t,u,s,v,k,e,y){u(t);const P=t.createRadialGradient(.05,0,0,.05,0,1.05);P.addColorStop(0,`rgb(${me(k,e,.55)})`),P.addColorStop(.3,`rgb(${k})`),P.addColorStop(.8,`rgb(${me(k,"255,255,255",.14)})`),P.addColorStop(1,`rgb(${k})`),t.fillStyle=P,t.fill(),t.save(),t.clip(),t.strokeStyle=`rgba(${e},0.6)`,t.lineWidth=.026,t.beginPath();for(const[o,n]of s)t.moveTo(.05,0),t.quadraticCurveTo(o*.5,n*.4,o,n);t.stroke(),u(t),t.strokeStyle=`rgb(${e})`,t.lineWidth=.2,t.stroke(),t.fillStyle=`rgba(${me(k,"255,255,255",.85)},0.9)`;for(const[o,n]of v)t.beginPath(),t.arc(o,n,.032,0,Math.PI*2),t.fill();y<.4&&(t.fillStyle=`rgba(0,0,0,${(.4-y)*1.1})`,t.fillRect(-.1,-1,1.3,2)),t.restore()}function qs(t,u){const s=Y.useRef(u);s.current=u,Y.useEffect(()=>{const v=t.current;if(!v)return;const k=v.parentElement,e=v.getContext("2d");let y=0,P=0,o=1,n=0,a=[],i=[];const r={x:-9999,y:-9999,prevX:-9999,prevY:-9999};function g(){const _=.55+Math.random()*.45;return{x:Math.random()*y,y:Math.random()*P,vx:(Math.random()-.5)*s.current.speed,vy:(Math.random()-.5)*s.current.speed,angle:Math.random()*Math.PI*2,flapPhase:Math.random()*Math.PI*2,tint:Math.random()*2-1,z:_,size:(16+Math.random()*8)*_,wanderAngle:Math.random()*Math.PI*2,fleeing:!1,glide:0,trail:[]}}function l(_){if(_=Math.max(0,Math.round(_)),a.length!==_){for(;a.length<_;)a.push(g());a.length=_,a.sort((H,D)=>H.z-D.z)}}function h(_,H){o=Math.min(2,window.devicePixelRatio||1),v.width=Math.round(_*o),v.height=Math.round(H*o),v.style.width=`${_}px`,v.style.height=`${H}px`,y=_,P=H,a=[],l(s.current.butterflyCount),i=Array.from({length:14},()=>({x:Math.random()*y,y:Math.random()*P,r:(20+Math.random()*60)*Math.max(.6,Math.min(y,P)/420),a:.03+Math.random()*.06,s:Math.random()*6}))}const f=new ResizeObserver(_=>{const{width:H,height:D}=_[0].contentRect;H>0&&D>0&&h(H,D)});f.observe(k);const b=k.getBoundingClientRect();b.width>0&&b.height>0&&h(b.width,b.height);function m(_){const H=ye(_,v);if(!H)return w();r.prevX=r.x,r.prevY=r.y,r.x=H.x,r.y=H.y}function w(){r.x=-9999,r.y=-9999}window.addEventListener("mousemove",m),document.addEventListener("mouseleave",w);function B(_,H,D){const W=_.size;e.fillStyle=`rgb(${H})`,e.beginPath(),e.ellipse(0,.38*W,.06*W,.36*W,0,0,Math.PI*2),e.fill(),e.beginPath(),e.ellipse(0,-.02*W,.085*W,.14*W,0,0,Math.PI*2),e.fill(),e.beginPath(),e.arc(0,-.19*W,.065*W,0,Math.PI*2),e.fill(),e.strokeStyle=`rgba(${D},0.35)`,e.lineWidth=Math.max(.5,.025*W),e.beginPath(),e.ellipse(0,-.02*W,.085*W,.14*W,0,0,Math.PI*2),e.stroke(),e.strokeStyle=`rgb(${H})`,e.lineWidth=Math.max(.5,.022*W),e.fillStyle=`rgb(${H})`;for(const A of[-1,1]){const T=A*.21*W,E=-.62*W;e.beginPath(),e.moveTo(A*.03*W,-.24*W),e.quadraticCurveTo(A*.06*W,-.5*W,T,E),e.stroke(),e.beginPath(),e.arc(T,E,Math.max(.6,.03*W),0,Math.PI*2),e.fill()}}let F=0,X=0;function O(_){F=requestAnimationFrame(O);const H=X?Math.min(.05,(_-X)/1e3):1/60;if(X=_,n+=H,y===0)return;const D=H*60,W=s.current;l(W.butterflyCount);const A=xt(W.wingColor),T=xt(W.patternColor),E=!W.backgroundColor||W.backgroundColor==="transparent";if(e.setTransform(o,0,0,o,0,0),e.clearRect(0,0,y,P),!E){const p=xt(W.backgroundColor),R=e.createRadialGradient(y*.5,P*.35,0,y*.5,P*.5,Math.hypot(y,P)*.65);R.addColorStop(0,`rgb(${me(p,A,.1)})`),R.addColorStop(1,`rgb(${p})`),e.fillStyle=R,e.fillRect(0,0,y,P),e.globalCompositeOperation="lighter";const c=me(A,"255,240,200",.6);for(const d of i){const $=d.x+Math.sin(n*.15+d.s)*14,C=d.y+Math.cos(n*.11+d.s)*8,S=d.a*(.7+.3*Math.sin(n*.6+d.s)),N=e.createRadialGradient($,C,0,$,C,d.r);N.addColorStop(0,`rgba(${c},${S})`),N.addColorStop(.7,`rgba(${c},${S*.6})`),N.addColorStop(1,`rgba(${c},0)`),e.fillStyle=N,e.beginPath(),e.arc($,C,d.r,0,Math.PI*2),e.fill()}e.globalCompositeOperation="source-over"}const I=(r.x>-100?Math.hypot(r.x-r.prevX,r.y-r.prevY):0)>12,M=me(A,"255,255,255",.5);for(const p of a){const R=W.speed*(.6+p.z*.4);p.wanderAngle+=(Math.random()-.5)*.3*D;let c=Math.cos(p.wanderAngle)*.15*R,d=Math.sin(p.wanderAngle)*.15*R;if(p.fleeing=!1,W.interactive&&r.x>-100){const J=r.x-p.x,oo=r.y-p.y,Z=Math.hypot(J,oo);if(Z<W.attractRadius&&Z>0)if(I)c-=J/Z*1.5,d-=oo/Z*1.5,p.fleeing=!0,p.glide=0;else{const no=(1-Z/W.attractRadius)*.08*R;c+=J/Z*no,d+=oo/Z*no}}const $=Math.pow(.94,D);p.vx=(p.vx+c*D)*$,p.vy=(p.vy+d*D)*$;const C=Math.hypot(p.vx,p.vy),S=R*(p.fleeing?3:1.2);C>S&&(p.vx=p.vx/C*S,p.vy=p.vy/C*S),p.x+=p.vx*D,p.y+=p.vy*D;const N=p.size*2;let z=!1;if(p.x<-N&&(p.x=y+p.size,z=!0),p.x>y+N&&(p.x=-p.size,z=!0),p.y<-N&&(p.y=P+p.size,z=!0),p.y>P+N&&(p.y=-p.size,z=!0),z&&(p.trail.length=0),C>.05){let J=Math.atan2(p.vy,p.vx)+Math.PI/2-p.angle;J=Math.atan2(Math.sin(J),Math.cos(J)),p.angle+=J*Math.min(1,.18*D)}p.glide>0?p.glide-=H:!p.fleeing&&Math.random()<.004*D&&(p.glide=.3+Math.random()*.6);const L=p.glide>0;L||(p.flapPhase+=W.flapSpeed*Math.PI*2*2.4*H*(p.fleeing?1.8:1));const G=L?.82+.06*Math.sin(n*20+p.tint*9):Math.pow(.5+.5*Math.sin(p.flapPhase),.8),q=.12+.86*G,j=L?q:.12+.86*Math.pow(.5+.5*Math.sin(p.flapPhase-.35),.8),V=L?0:Math.sin(p.flapPhase)*.12*p.size,K=p.x+Math.cos(p.angle)*V,to=p.y+Math.sin(p.angle)*V;if(W.showTrails){p.trail.push(K,to),p.trail.length>Es*2&&p.trail.splice(0,2),e.lineCap="round",e.lineWidth=Math.max(.6,p.z*1.4);for(let J=2;J<p.trail.length;J+=2)e.strokeStyle=`rgba(${M},${J/p.trail.length*.22*p.z})`,e.beginPath(),e.moveTo(p.trail[J-2],p.trail[J-1]),e.lineTo(p.trail[J],p.trail[J+1]),e.stroke()}else p.trail.length&&(p.trail.length=0);const lo=p.tint*.12,ao=me(A,lo>0?"255,255,255":"0,0,0",Math.abs(lo)),ro=T,Q=me(T,"0,0,0",.35);e.save(),e.translate(K,to),e.rotate(p.angle),e.globalAlpha=.6+.4*p.z;const so=1+.05*(G-.5);for(const J of[-1,1])e.save(),e.scale(J*j*p.size*so,p.size*so),un(e,Ls,Bs,Ws,ao,ro,j),e.restore(),e.save(),e.scale(J*q*p.size*so,p.size*so),un(e,zs,Fs,Os,ao,ro,q),e.restore();B(p,Q,me(A,"255,255,255",.5)),e.restore()}e.globalAlpha=1}return F=requestAnimationFrame(O),()=>{cancelAnimationFrame(F),f.disconnect(),window.removeEventListener("mousemove",m),document.removeEventListener("mouseleave",w)}},[t])}const Gs={default:{wingColor:"#e06010",patternColor:"#111111",backgroundColor:"#0a0800"},monochrome:{wingColor:"#c8c8c8",patternColor:"#444444",backgroundColor:"#0a0a0a"},monarch:{wingColor:"#e06010",patternColor:"#111111",backgroundColor:"#0a0800"},morpho:{wingColor:"#1060ff",patternColor:"#0030aa",backgroundColor:"#000508"},meadow:{wingColor:"#f0c030",patternColor:"#804000",backgroundColor:"#0a1405"},night:{wingColor:"#c0d0e0",patternColor:"#304050",backgroundColor:"#020408"}},xr=Y.forwardRef((t,u)=>{const{preset:s,butterflyCount:v,wingColor:k,patternColor:e,backgroundColor:y,flapSpeed:P,speed:o,attractRadius:n,interactive:a,showTrails:i,width:r,height:g,className:l,style:h}=t,f=Gs[s??"default"]||{},b=Y.useRef(null);return Y.useImperativeHandle(u,()=>b.current),qs(b,{butterflyCount:v??12,wingColor:k??f.wingColor??"#c8c8c8",patternColor:e??f.patternColor??"#444444",backgroundColor:y??f.backgroundColor??"#111111",flapSpeed:P??1,speed:o??1,attractRadius:n??120,interactive:a??!0,showTrails:i??!1}),Mo.jsx("div",{className:l,style:{width:r??"100%",height:g??"100%",display:"block",overflow:"hidden",cursor:"crosshair",...h},children:Mo.jsx("canvas",{ref:b,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});xr.displayName="ButterflySwarm";const $r=(t,u)=>(t+4096)*16384+(u+4096);function Ir(t,u){const s=t.nodes[u],v=$r(Math.floor(s.x/t.cell),Math.floor(s.y/t.cell)),k=t.grid.get(v);k?k.push(u):t.grid.set(v,[u])}function gn(t,u,s,v){const k=Math.floor(u/t.cell),e=Math.floor(s/t.cell),y=Math.ceil(v/t.cell);let P=-1,o=v*v;for(let n=k-y;n<=k+y;n++)for(let a=e-y;a<=e+y;a++){const i=t.grid.get($r(n,a));if(i)for(const r of i){const g=t.nodes[r],l=(g.x-u)**2+(g.y-s)**2;l<o&&(o=l,P=r)}}return P}function Tr(t,u,s,v){const k={nodes:[],ax:u,ay:s,alive:new Uint8Array(u.length).fill(1),live:u.length,grid:new Map,cell:v,leaves:[],tendrils:[],done:u.length===0,sw:0,sh:0,stuck:0,blocked:new Map};for(const e of t)k.nodes.push({x:e.x,y:e.y,parent:-1,dx:e.dx,dy:e.dy,weight:0}),Ir(k,k.nodes.length-1);return k}function Ds(t,u,s,v,k,e,y){t.nodes.push({x:s,y:v,parent:u,dx:k,dy:e,weight:0});const P=t.nodes.length-1;Ir(t,P);for(let n=u;n>=0;n=t.nodes[n].parent)t.nodes[n].weight++;const o=y.t??0;if(Math.random()<(y.leafChance??0)){const n=Math.random()<.5?-1:1;t.leaves.push({x:s,y:v,angle:Math.atan2(e,k)+n*(.6+Math.random()*.7),size:(y.leafSize??8)*(.7+Math.random()*.6),born:o,shade:Math.random()*3|0})}if(Math.random()<(y.tendrilChance??0)){const n=Math.random()<.5?-1:1;t.tendrils.push({x:s,y:v,angle:Math.atan2(e,k)+n*.9,dir:n,size:5+Math.random()*5,born:o})}return P}function pn(t,u){if(t.done)return 0;const s=new Map;for(let e=0;e<t.ax.length;e++){if(!t.alive[e])continue;const y=gn(t,t.ax[e],t.ay[e],u.influence);if(y<0)continue;const P=t.nodes[y],o=t.ax[e]-P.x,n=t.ay[e]-P.y,a=Math.hypot(o,n)||1,i=s.get(y);i?(i.gx+=o/a,i.gy+=n/a,i.attrs.push(e)):s.set(y,{gx:o/a,gy:n/a,attrs:[e]})}const v=[],k=(e,y,P)=>{const o=t.nodes[e];let n=y*.75+o.dx*.25,a=P*.75+o.dy*.25;if(u.sun&&u.sunX!==void 0&&u.sunY!==void 0){const l=u.sunX-o.x,h=u.sunY-o.y,f=Math.hypot(l,h)||1;n+=l/f*u.sun,a+=h/f*u.sun}let i=Math.hypot(n,a);i<.001&&(n=Math.random()-.5,a=Math.random()-.5,i=Math.hypot(n,a)),n/=i,a/=i;const r=o.x+n*u.segLen,g=o.y+a*u.segLen;return gn(t,r,g,u.segLen*.45)>=0?!1:(v.push(Ds(t,e,r,g,n,a,u)),!0)};for(const[e,{gx:y,gy:P,attrs:o}]of s){if(t.nodes.length>=u.maxNodes)break;const n=Math.hypot(y,P)||1;if(k(e,y/n,P/n)){t.blocked.delete(e);continue}const a=(t.blocked.get(e)??0)+1;if(t.blocked.set(e,a),a>=3){for(const i of o)t.alive[i]&&(t.alive[i]=0,t.live--);t.blocked.delete(e)}}if(s.size===0&&t.live>0){let e=-1,y=-1,P=1/0;const o=Math.max(1,Math.floor(t.nodes.length*t.live/6e4));for(let n=0;n<t.ax.length;n++)if(t.alive[n])for(let a=0;a<t.nodes.length;a+=o){const i=(t.nodes[a].x-t.ax[n])**2+(t.nodes[a].y-t.ay[n])**2;i<P&&(P=i,e=a,y=n)}if(e>=0){const n=t.nodes[e],a=Math.sqrt(P)||1;!k(e,(t.ax[y]-n.x)/a,(t.ay[y]-n.y)/a)&&++t.stuck>4&&(t.alive[y]=0,t.live--,t.stuck=0)}}if(v.length){const e=u.kill*u.kill;for(let y=0;y<t.ax.length;y++)if(t.alive[y])for(const P of v){const o=t.nodes[P];if((o.x-t.ax[y])**2+(o.y-t.ay[y])**2<e){t.alive[y]=0,t.live--;break}}}return(t.live<=0||t.nodes.length>=u.maxNodes)&&(t.done=!0),v.length}function Ns(t,u,s,v){const k=[],e=[],y=Math.round(t*u/650*v),P=Math.min(t,u)*.3;for(let n=0;k.length<y&&n<y*12;n++){const a=Math.random()*t,i=Math.random()*u,r=Math.min(a,t-a,u-i,i*1.6),g=.08+.92*Math.max(0,1-r/P);Math.random()<g&&(k.push(a),e.push(i))}const o=Array.from({length:Math.max(1,s)},(n,a)=>{const i=Math.max(1,s);return{x:i===1?t*.1:a/(i-1)*t*.9+t*.05+(Math.random()-.5)*30,y:u+2,dx:0,dy:-1}});return Tr(o,k,e,70)}function js(t,u,s){const v=t.h*2+t.w,k=Math.round(v/3.2*s),e=[],y=[];for(let n=0;n<k;n++){const a=Math.random()*v,i=-3+Math.random()*(u+3);a<t.h?(e.push(-i),y.push(t.h-a)):a<t.h+t.w?(e.push(a-t.h),y.push(-i)):(e.push(t.w+i),y.push(a-t.h-t.w))}const P=[{x:-u*.4,y:t.h+2,dx:0,dy:-1},{x:t.w+u*.4,y:t.h+2,dx:0,dy:-1}],o=Tr(P,e,y,Math.max(24,u*2.2));return o.sw=t.w,o.sh=t.h,o}const Xs=t=>1+2.70158*Math.pow(t-1,3)+1.70158*Math.pow(t-1,2);function Hs(t){const u=Y.useRef(t);u.current=t;const s=Y.useRef(new Map),v=Y.useRef(0),k=Y.useRef(0),e=Y.useRef(-1),y=Y.useRef(""),P=Eo(),o=Y.useRef(null);function n(g,l,h){const f=g===-1;return{influence:f?70:Math.max(24,l.hug*2.2),kill:f?11:7,segLen:f?4.5:3.2,maxNodes:f?3500:1600,leafChance:l.leafDensity*(f?.5:.85),tendrilChance:.025,leafSize:l.leafSize*(f?1:.9),t:h}}function a(g,l,h,f,b){const m=Array.from({length:6},()=>new Path2D);for(let O=0;O<l.nodes.length;O++){const _=l.nodes[O];if(_.parent<0)continue;const H=l.nodes[_.parent],D=.7+Math.sqrt(_.weight)*.3,W=Math.min(5,Math.floor(D));m[W].moveTo(H.x,H.y),m[W].lineTo(_.x,_.y)}g.globalAlpha=b,g.strokeStyle=h.color,g.lineCap="round",g.lineJoin="round";for(let O=0;O<6;O++)g.lineWidth=.8+O*.85,g.stroke(m[O]);g.lineWidth=.7;const w=new Path2D;for(const O of l.tendrils){const _=Math.min(1,(f-O.born)/1.4);if(_<=0)continue;const H=Math.ceil(18*_);let D=O.x,W=O.y,A=O.angle;w.moveTo(D,W);for(let T=0;T<H;T++){const E=O.size*.22*(1-T/22);A+=O.dir*(.18+T*.035),D+=Math.cos(A)*E,W+=Math.sin(A)*E,w.lineTo(D,W)}}g.stroke(w);const B=[new Path2D,new Path2D,new Path2D],F=new Path2D;for(const O of l.leaves){const _=Math.min(1,(f-O.born)/.9);if(_<=0)continue;const H=O.size*Math.max(0,Xs(_)),D=Math.cos(O.angle),W=Math.sin(O.angle),A=O.x+D*1.5,T=O.y+W*1.5,E=(p,R)=>[A+p*D-R*W,T+p*W+R*D],x=B[O.shade],I=E(0,0);x.moveTo(I[0],I[1]),x.bezierCurveTo(...E(H*.15,-H*.62),...E(H*.95,-H*.55),...E(H,0)),x.bezierCurveTo(...E(H*.95,H*.55),...E(H*.15,H*.62),I[0],I[1]),x.closePath();const M=E(H*.85,0);F.moveTo(I[0],I[1]),F.lineTo(M[0],M[1])}g.fillStyle=h.leafColor;const X=[.62,.8,1];for(let O=0;O<3;O++)g.globalAlpha=X[O]*b,g.fill(B[O]);g.globalAlpha=.45*b,g.lineWidth=.6,g.strokeStyle=h.color,g.stroke(F),g.globalAlpha=1}function i(g,l,h,f,b){const m=u.current;v.current+=f*.001;const w=v.current,B=s.current;b.overlay||(g.fillStyle=m.backgroundColor,g.fillRect(0,0,l,h));const F=`${m.collide}|${m.vines}|${m.density}|${m.hug}`;y.current!==F&&(y.current=F,B.clear(),e.current=-1);const X=b.solids,O=new Map(X.map(E=>[E.id,E])),_=Ma(),H=(E,x)=>{const I=x();if(_){const M=n(E,m,w-10);for(let p=0;p<6e3&&!I.done;p++)pn(I,M)}B.set(E,I)};if(m.collide){for(const E of X){if(E.w<40||E.h<12)continue;const x=B.get(E.id);(!x||Math.abs(x.sw-E.w)>E.w*.2||Math.abs(x.sh-E.h)>E.h*.3)&&H(E.id,()=>js(E,m.hug,m.density))}for(const E of B.keys())O.has(E)||B.delete(E)}else B.has(-1)||H(-1,()=>Ns(l,h,m.vines,m.density));const D=zo(P.current,o.current);k.current+=f*.001*15*m.growthSpeed;const W=Math.min(6,Math.floor(k.current));k.current-=W;let A=B.size>0;for(const[E,x]of B){const I=E===-1?null:O.get(E),M=I?I.x:0,p=I?I.y:0,R=n(E,m,w);m.followCursor&&D.inside&&(R.sunX=D.x-M,R.sunY=D.y-p,R.sun=.35);for(let c=0;c<W;c++)pn(x,R);x.done||(A=!1)}let T=1;if(m.loop&&A){e.current<0&&(e.current=w);const E=w-e.current;E>7&&(T=Math.max(0,1-(E-7)/1.8)),T<=0&&(B.clear(),e.current=-1)}else e.current=-1;for(const[E,x]of B){const I=E===-1?null:O.get(E);g.save(),I&&g.translate(I.x,I.y),a(g,x,m,w,T),g.restore()}}const r=To({overlay:t.overlay,collide:t.collide,onResize:()=>{s.current.delete(-1)},onFrame:i});return o.current=r.canvas,r}const Ys={default:{color:"#3f5a2a",leafColor:"#5f9e3a",backgroundColor:"#0c120b"},monochrome:{},"english-ivy":{color:"#3f5a2a",leafColor:"#5f9e3a",backgroundColor:"#0c120b"},autumn:{color:"#5a3a22",leafColor:"#d9622b",backgroundColor:"#140b07"},jungle:{color:"#245c3a",leafColor:"#34d399",backgroundColor:"#04110b",leafDensity:.55,leafSize:11},gilded:{color:"#8a6a2a",leafColor:"#f5c96a",backgroundColor:"#0e0b06",leafDensity:.3}},Ar=Y.forwardRef((t,u)=>{const{preset:s,color:v,leafColor:k,backgroundColor:e,vines:y,growthSpeed:P,density:o,leafSize:n,leafDensity:a,followCursor:i,hug:r,loop:g,overlay:l,collide:h,zIndex:f,width:b,height:m,className:w,style:B}=t,F=Ys[s??"default"]||{},{canvasRef:X,canvas:O}=Hs({color:v??F.color??"#6b7280",leafColor:k??F.leafColor??"#ffffff",backgroundColor:e??F.backgroundColor??"#111111",vines:Math.max(1,Math.round(y??4)),growthSpeed:P??1,density:Math.min(2,Math.max(.3,o??1)),leafSize:n??F.leafSize??9,leafDensity:a??F.leafDensity??.35,followCursor:i??!0,hug:r??20,loop:g??!1,overlay:l??!1,collide:h??!1});return Y.useImperativeHandle(u,()=>O,[O]),Mo.jsx(Io,{canvasRef:X,overlay:l,zIndex:f,width:b,height:m,className:w,style:B})});Ar.displayName="IvyGrowth";const qt=3,Er=Math.exp(qt)-1,_s=t=>Math.log(1+Er*t)/qt,Vs=t=>(Math.exp(qt*t)-1)/Er;function Us(t,u,s,v,k){const e=[];for(let o=0;o<t.length;o++)t[o].phase+=u/s*(t[o].rate??1),t[o].phase>=1&&e.push(o);const y=new Set,P=k*k;for(;e.length;){const o=e.pop();if(y.has(o))continue;y.add(o);const n=t[o];if(n.phase=0,n.flash=1,!(v<=0))for(let a=0;a<t.length;a++){if(a===o||y.has(a))continue;const i=t[a],r=i.x-n.x,g=i.y-n.y;if(r*r+g*g>P)continue;const l=_s(Math.min(i.phase,1))+v;l>=1?(i.phase=1,e.push(a)):i.phase=Vs(l)}}return y.size}const Ks=t=>Math.atan2(Math.sin(t),Math.cos(t));function Js(t){const u=Y.useRef(t);u.current=t;const s=Y.useRef([]),v=Y.useRef({w:0,h:0}),k=Y.useRef(0),e=Y.useRef({color:"",img:null}),y=Eo(),P=Y.useRef(null);function o(){const{w:i,h:r}=v.current;return{x:Math.random()*i,y:r*.15+Math.random()*r*.85,heading:Math.random()*Math.PI*2,speed:.25+Math.random()*.45,phase:Math.random(),rate:.95+Math.random()*.1,flash:0,depth:.55+Math.random()*.45,seed:Math.random()*1e3,target:null,rest:null,restLeft:0}}function n(i,r,g,l,h){const f=u.current,b=l/16.67;k.current+=l*.001;const m=k.current;h.overlay||(i.fillStyle=f.backgroundColor,i.fillRect(0,0,r,g)),e.current.color!==f.color&&(e.current={color:f.color,img:Yo(f.color,64)});const w=e.current.img,B=f.count>0?Math.max(1,Math.ceil(f.count*h.quality)):0,F=s.current;for(;F.length<B;)F.push(o());F.length>B&&(F.length=B);const X=zo(y.current,P.current),O=f.interactive&&X.inside;if(f.interactive)for(const W of X.taps)for(const A of F)Math.hypot(A.x-W.x,A.y-W.y)<160&&(A.phase=1);const _=h.solids,H=new Map(_.map(W=>[W.id,W]));for(const W of F){if(W.rest){W.restLeft-=l,(W.restLeft<=0||!Qe(W,W.rest,H))&&(W.rest=null,W.heading=-Math.PI/2+(Math.random()-.5));continue}let A=Math.sin(m*.9+W.seed)*.025+Math.sin(m*2.3+W.seed*1.7)*.015;A+=(Math.random()-.5)*.04;let T=0,E=0,x=0;if(W.target){const p=H.get(W.target.solidId);if(!p)W.target=null;else{const R=p.x+W.target.offsetX,c=p.y-2;if(Math.hypot(R-W.x,c-W.y)<4){W.x=R,W.y=c,W.rest=Je(W,p,-2),W.restLeft=3e3+Math.random()*6e3,W.target=null;continue}T=R-W.x,E=c-W.y,x=.08}}else if(_.length&&Math.random()<6e-4*b){const p=_[Math.random()*_.length|0];p.w>8&&p.y>0&&p.y<g&&(W.target={solidId:p.id,offsetX:4+Math.random()*(p.w-8)})}if(O&&!W.target){const p=X.x-W.x,R=X.y-W.y,c=Math.hypot(p,R);if(c<240){const d=c<45?-1:1;T=p*d,E=R*d,x=.05*(1-c/240)+.01}}const I=30;if(W.x<I&&(T+=1,x=Math.max(x,.04)),W.x>r-I&&(T-=1,x=Math.max(x,.04)),W.y<I&&(E+=1,x=Math.max(x,.04)),W.y>g-I&&(E-=1,x=Math.max(x,.04)),x>0){const p=Math.atan2(E,T);A+=Ks(p-W.heading)*x}W.heading+=A*b;const M=W.speed*f.speed*(W.target?1.8:1);W.x+=Math.cos(W.heading)*M*b,W.y+=(Math.sin(W.heading)*M+Math.sin(m*1.4+W.seed)*.08)*b,(W.x<-40||W.x>r+40||W.y<-40||W.y>g+40)&&(W.x=Math.min(r,Math.max(0,W.x)),W.y=Math.min(g,Math.max(0,W.y)))}Us(F,l*.001,Math.max(.2,f.period),f.sync,f.syncRadius);const D=i.globalCompositeOperation;i.globalCompositeOperation="lighter";for(const W of F){W.flash*=Math.exp(-l/380);const A=.16+.84*W.flash,T=f.glow*W.depth*(.6+.6*A);w&&(i.globalAlpha=Math.min(1,A*W.depth),i.drawImage(w,W.x-T,W.y-T,T*2,T*2)),i.globalAlpha=Math.min(1,.25+A),i.fillStyle=f.color,i.beginPath(),i.arc(W.x,W.y,f.size*W.depth*(.6+.4*A),0,Math.PI*2),i.fill()}i.globalAlpha=1,i.globalCompositeOperation=D}const a=To({overlay:t.overlay,collide:t.collide,onResize:(i,r)=>{v.current={w:i,h:r},s.current=Array.from({length:u.current.count},o)},onFrame:n});return P.current=a.canvas,a}const Qs={default:{color:"#d9f99d",backgroundColor:"#06100a"},monochrome:{},summer:{color:"#d9f99d",backgroundColor:"#06100a",glow:22},riverbank:{color:"#facc15",backgroundColor:"#050806",sync:.14,period:1.2},"blue-ghost":{color:"#7dd3fc",backgroundColor:"#03070d",sync:.04,period:2.2,glow:26},ember:{color:"#fb923c",backgroundColor:"#0c0503",sync:.1}},zr=Y.forwardRef((t,u)=>{const{preset:s,count:v,color:k,backgroundColor:e,size:y,glow:P,period:o,sync:n,syncRadius:a,speed:i,interactive:r,overlay:g,collide:l,zIndex:h,width:f,height:b,className:m,style:w}=t,B=Qs[s??"default"]||{},{canvasRef:F,canvas:X}=Js({count:v??60,color:k??B.color??"#ffffff",backgroundColor:e??B.backgroundColor??"#111111",size:y??2.2,glow:P??B.glow??18,period:o??B.period??1.6,sync:n??B.sync??.08,syncRadius:a??160,speed:i??1,interactive:r??!0,overlay:g??!1,collide:l??!1});return Y.useImperativeHandle(u,()=>X,[X]),Mo.jsx(Io,{canvasRef:F,overlay:g,zIndex:h,width:f,height:b,className:m,style:w})});zr.displayName="Fireflies";const Zs=.32,o0=.025,mn=700,e0=Math.PI*(3-Math.sqrt(5));function t0(t,u,s){const v=u.wind*(.55+.45*Math.sin(u.t*.31+t.y*.008))+Math.sin(u.t*1.7+t.x*.02+t.phase)*.25,k=Math.sin(u.t*1.1+t.x*.015+t.phase*2)*.28,e=1-Math.pow(1-o0,s);t.vx+=(v-t.vx)*e,t.vy+=(Zs+k-t.vy)*e,t.x+=t.vx*s,t.y+=t.vy*s}function yn(t,u){const s=1-2*(t+.5)/u,v=Math.sqrt(1-s*s),k=t*e0;return[Math.cos(k)*v,s,Math.sin(k)*v]}function n0(t){const u=Y.useRef(t);u.current=t;const s=Y.useRef([]),v=Y.useRef([]),k=Y.useRef(0),e=Y.useRef(2),y=Y.useRef(""),P=Eo(),o=Y.useRef(Vo()).current,n=Y.useRef(null);function a(f,b){const m=u.current;y.current=`${m.headCount}|${m.seedsPerHead}`;const w=Math.max(0,m.headCount);s.current=Array.from({length:w},(B,F)=>({x:f*((F+.5)/w)+(Math.random()-.5)*(f/w)*.4,stemH:b*(.32+Math.random()*.3),r:Math.min(46,Math.max(22,Math.min(f,b)*.06))*(.85+Math.random()*.3),sway:0,swayVel:0,attached:Array(m.seedsPerHead).fill(!0),grow:1,emptySince:-1})),v.current=[]}function i(f,b){return{x:f.x+Math.sin(f.sway)*f.stemH,y:b-Math.cos(f.sway)*f.stemH}}function r(f,b,m,w,B){if(!f.attached[b]||v.current.length>=mn)return;f.attached[b]=!1;const F=i(f,m),[X,O]=yn(b,f.attached.length);v.current.push({x:F.x+X*f.r,y:F.y+O*f.r,vx:w+X*.8,vy:B+O*.8-.4,phase:Math.random()*Math.PI*2,life:0,alpha:1,rest:null,landed:!1})}function g(f,b){const m=Math.max(-.7,Math.min(.7,b.vx*.25)),w=Math.sin(m),B=-Math.cos(m),F=b.x+w*9,X=b.y+B*9;f.globalAlpha=b.alpha,f.beginPath(),f.moveTo(b.x,b.y),f.lineTo(F,X);for(let O=0;O<9;O++){const _=m-Math.PI/2+(O/8-.5)*2.3;f.moveTo(F,X),f.lineTo(F+Math.cos(_)*6,X+Math.sin(_)*6)}f.stroke(),f.beginPath(),f.ellipse(b.x,b.y,.9,1.8,m,0,Math.PI*2),f.fill()}function l(f,b,m,w,B){const F=u.current,X=w/16.67;k.current+=w*.001;const O=k.current;y.current!==`${F.headCount}|${F.seedsPerHead}`&&a(b,m),B.overlay||(f.fillStyle=F.backgroundColor,f.fillRect(0,0,b,m));const _=zo(P.current,n.current),H=o(_,X),D=Math.hypot(H.vx,H.vy),W=s.current;if(F.autoBlow&&O>e.current&&W.length){e.current=O+2.5+Math.random()*4;const p=W[Math.random()*W.length|0],R=3+(Math.random()*6|0);for(let c=0;c<R;c++){const d=Math.random()*p.attached.length|0;r(p,d,m,F.wind*1.5,-.6)}}f.lineCap="round";for(const p of W){let R=F.wind*.06+Math.sin(O*.9+p.x*.01)*.03;const c=i(p,m);if(F.interactive&&_.inside&&D>1.5){const N=Math.hypot(_.x-c.x,_.y-c.y),z=p.r*1.9;if(N<z){R+=H.vx/40*(1-N/z);const L=Math.min(1,D*.02*F.blowStrength)*(1-N/z);for(let G=0;G<p.attached.length;G++)p.attached[G]&&Math.random()<L*.35*X&&r(p,G,m,H.vx*.22,H.vy*.22)}}p.swayVel+=(-.035*(p.sway-R)-.08*p.swayVel)*X,p.sway+=p.swayVel*X;const d=p.attached.reduce((N,z)=>N+(z?1:0),0);F.regrow&&d===0&&(p.emptySince<0?p.emptySince=O:O-p.emptySince>3.5&&(p.attached.fill(!0),p.grow=0,p.emptySince=-1)),p.grow=Math.min(1,p.grow+w/1600);const $=i(p,m);f.strokeStyle=F.stemColor,f.lineWidth=2,f.globalAlpha=1,f.beginPath(),f.moveTo(p.x,m+2),f.quadraticCurveTo(p.x+Math.sin(p.sway)*p.stemH*.35,m-p.stemH*.55,$.x,$.y),f.stroke();const C=p.attached.length,S=p.r*(.35+.65*p.grow);f.strokeStyle=F.color,f.lineWidth=.6;for(const N of[!0,!1]){f.globalAlpha=(N?.28:.8)*p.grow,f.beginPath();for(let z=0;z<C;z++){if(!p.attached[z])continue;const[L,G,q]=yn(z,C);if(q<0!==N)continue;const j=$.x+L*S,V=$.y+G*S;f.moveTo($.x+L*S*.18,$.y+G*S*.18),f.lineTo(j,V);for(let K=0;K<5;K++){const to=Math.atan2(G,L)+(K-2)*.45;f.moveTo(j,V),f.lineTo(j+Math.cos(to)*3.2,V+Math.sin(to)*3.2)}}f.stroke()}f.globalAlpha=1,f.fillStyle=F.stemColor,f.beginPath(),f.arc($.x,$.y,Math.max(2,p.r*.12),0,Math.PI*2),f.fill()}const A=B.solids,T=new Map(A.map(p=>[p.id,p])),E={t:O,wind:F.wind},x=v.current,I=Math.ceil(mn*B.quality);x.length>I&&x.splice(0,x.length-I),f.strokeStyle=F.color,f.fillStyle=F.stemColor,f.lineWidth=.6;let M=0;for(const p of x){if(p.landed)p.life-=w,p.rest&&!Qe(p,p.rest,T)&&(p.rest=null,p.landed=!1,p.vy=.2),p.life<1200&&(p.alpha=Math.max(0,p.life/1200));else{const R=p.x,c=p.y;if(t0(p,E,X),A.length){const d=Wt(p,R,c,A,0);d&&(p.rest=Je(p,d,-1),p.landed=!0,p.life=3e3+Math.random()*5e3)}!p.landed&&p.y>m-2&&(p.y=m-2,p.landed=!0,p.life=2e3+Math.random()*3e3)}p.alpha<=0||p.x<-60||p.x>b+60||p.y<-120||(x[M++]=p,g(f,p))}x.length=M,f.globalAlpha=1}const h=To({overlay:t.overlay,collide:t.collide,onResize:a,onFrame:l});return n.current=h.canvas,h}const r0={default:{color:"#dbeafe",stemColor:"#3b4a63",backgroundColor:"#05080f"},monochrome:{},meadow:{color:"#f8fafc",stemColor:"#5f8f3e",backgroundColor:"#0b1a14"},sunset:{color:"#ffe8cc",stemColor:"#8a5a2b",backgroundColor:"#1a0c08",wind:1.2},moonlit:{color:"#dbeafe",stemColor:"#3b4a63",backgroundColor:"#05080f",wind:.6},ink:{color:"#1f2937",stemColor:"#4b5563",backgroundColor:"#f5f1e8"}},Lr=Y.forwardRef((t,u)=>{const{preset:s,headCount:v,seedsPerHead:k,color:e,stemColor:y,backgroundColor:P,wind:o,blowStrength:n,autoBlow:a,regrow:i,interactive:r,overlay:g,collide:l,zIndex:h,width:f,height:b,className:m,style:w}=t,B=r0[s??"default"]||{},{canvasRef:F,canvas:X}=n0({headCount:Math.max(0,Math.round(v??3)),seedsPerHead:Math.max(8,Math.round(k??110)),color:e??B.color??"#ffffff",stemColor:y??B.stemColor??"#6b7280",backgroundColor:P??B.backgroundColor??"#111111",wind:o??B.wind??.9,blowStrength:n??1,autoBlow:a??!0,regrow:i??!0,interactive:r??!0,overlay:g??!1,collide:l??!1});return Y.useImperativeHandle(u,()=>X,[X]),Mo.jsx(Io,{canvasRef:F,overlay:g,zIndex:h,width:f,height:b,className:m,style:w})});Lr.displayName="Dandelion";const it=4,a0=.11;function l0(t,u,s){t.vel+=(-t.stiffness*(t.angle-u)-a0*t.vel)*s,t.angle+=t.vel*s}function s0(t){const u=Y.useRef(t);u.current=t;const s=Y.useRef([]),v=Y.useRef(""),k=Y.useRef(0),e=Eo(),y=Y.useRef(Vo()).current,P=Y.useRef(null);function o(i,r){const g=u.current;v.current=`${g.density}|${g.rows}|${g.height}|${g.flowers}`;const l=[],h=r*g.height;for(let f=0;f<g.rows;f++){const b=(f+1)/g.rows,m=Math.round(i/100*g.density*(.6+.4*b)),w=[];for(let B=0;B<m;B++)w.push({x:Math.random()*i,row:f,h:h*(.45+Math.random()*.55)*(.55+.45*b),w:(2.2+Math.random()*2.6)*(.6+.4*b),angle:0,vel:0,lean:(Math.random()-.5)*.35,stiffness:.05+Math.random()*.05,shade:Math.floor(Math.random()*it),flower:Math.random()<g.flowers*b});w.sort((B,F)=>B.x-F.x),l.push(w)}s.current=l}function n(i,r,g,l,h){const f=u.current,b=l/16.67;k.current+=l*.001;const m=k.current;h.overlay||(i.fillStyle=f.backgroundColor,i.fillRect(0,0,r,g)),v.current!==`${f.density}|${f.rows}|${f.height}|${f.flowers}`&&o(r,g);const w=zo(e.current,P.current),B=y(w,b),F=f.interactive&&w.inside,X=80,O=h.quality>=1?1:h.quality>=.5?2:3,_=g+2,H=s.current;for(let D=0;D<H.length;D++){const W=(D+1)/H.length,A=H[D],T=Array.from({length:it},()=>new Path2D),E=new Path2D;for(let M=0;M<A.length;M+=O){const p=A[M],R=.18*Math.sin(m*.8+p.x*.006)+.08*Math.sin(m*2.1+p.x*.03),c=Math.sin(p.x*.0025-m*1.1),d=Math.pow(Math.max(0,c),6)*.55*f.gusts;let $=p.lean+f.wind*(.12+R+d)*(.7+.3*W);if(F){const q=p.x-w.x,j=_-p.h;if(Math.abs(q)<X&&w.y>j-20){const V=1-Math.abs(q)/X;$+=Math.sign(q||1)*V*V*1.1+B.vx*.03*V}}l0(p,$,b);const C=p.angle,S=p.x+Math.sin(C)*p.h,N=_-Math.cos(C)*p.h*(1-.08*Math.abs(C)),z=p.x+Math.sin(C*.45)*p.h*.5,L=_-Math.cos(C*.45)*p.h*.55,G=T[p.shade];if(G.moveTo(p.x-p.w/2,_),G.quadraticCurveTo(z-p.w*.3,L,S,N),G.quadraticCurveTo(z+p.w*.3,L,p.x+p.w/2,_),G.closePath(),p.flower){const q=1.6+p.w*.45;E.moveTo(S+q,N),E.arc(S,N,q,0,Math.PI*2)}}const x=_-g*f.height,I=.45+.55*W;for(let M=0;M<it;M++){const p=M/(it-1)*.35,R=Fo([f.backgroundColor,f.baseColor],I),c=Fo([f.backgroundColor,f.tipColor],I*(.65+p)),d=i.createLinearGradient(0,_,0,x);d.addColorStop(0,`rgb(${R[0]|0},${R[1]|0},${R[2]|0})`),d.addColorStop(1,`rgb(${c[0]|0},${c[1]|0},${c[2]|0})`),i.fillStyle=d,i.fill(T[M])}if(f.flowers>0){const M=Fo([f.backgroundColor,f.flowerColor],I);i.fillStyle=`rgb(${M[0]|0},${M[1]|0},${M[2]|0})`,i.fill(E)}}}const a=To({overlay:t.overlay,onResize:o,onFrame:n});return P.current=a.canvas,a}const i0={default:{baseColor:"#14301a",tipColor:"#8fd16a",backgroundColor:"#0a1420",flowerColor:"#fef3c7"},monochrome:{},meadow:{baseColor:"#14301a",tipColor:"#8fd16a",backgroundColor:"#0a1420",flowerColor:"#fef3c7",flowers:.04},dusk:{baseColor:"#1b1433",tipColor:"#a78bfa",backgroundColor:"#0d0a1a",flowerColor:"#fda4af",flowers:.03},wheat:{baseColor:"#4a3512",tipColor:"#f0cf7a",backgroundColor:"#140e06",bladeHeight:.5},frost:{baseColor:"#1e2a38",tipColor:"#e2ecf7",backgroundColor:"#070b10"}},Fr=Y.forwardRef((t,u)=>{const{preset:s,density:v,bladeHeight:k,baseColor:e,tipColor:y,backgroundColor:P,flowerColor:o,flowers:n,wind:a,gusts:i,rows:r,interactive:g,overlay:l,zIndex:h,width:f,height:b,className:m,style:w}=t,B=i0[s??"default"]||{},{canvasRef:F,canvas:X}=s0({density:v??45,height:k??B.bladeHeight??.38,baseColor:e??B.baseColor??"#374151",tipColor:y??B.tipColor??"#ffffff",backgroundColor:P??B.backgroundColor??"#111111",flowerColor:o??B.flowerColor??"#ffffff",flowers:n??B.flowers??0,wind:a??1,gusts:i??1,rows:Math.max(1,Math.round(r??3)),interactive:g??!0,overlay:l??!1});return Y.useImperativeHandle(u,()=>X,[X]),Mo.jsx(Io,{canvasRef:F,overlay:l,zIndex:h,width:f,height:b,className:m,style:w})});Fr.displayName="GrassField";const c0=t=>Math.atan2(Math.sin(t),Math.cos(t));function f0(t,u,s,v,k=1,e=.12){const P=Math.atan2(s-t.y,u-t.x)-t.side*t.alpha,o=c0(P-t.heading),n=e*v;t.heading+=Math.max(-n,Math.min(n,o)),t.x+=Math.cos(t.heading)*t.speed*k*v,t.y+=Math.sin(t.heading)*t.speed*k*v}function d0(t){const u=Y.useRef(t);u.current=t;const s=Y.useRef([]),v=Y.useRef({w:0,h:0}),k=Y.useRef({x:0,y:0}),e=Y.useRef(0),y=Y.useRef({color:"",img:null}),P=Eo(),o=Y.useRef(null);function n(){const{w:g,h:l}=v.current,h=u.current,f=Math.random()*Math.PI*2,b=Math.min(g,l)*(.12+Math.random()*.45);return{x:g*h.lightX+Math.cos(f)*b,y:l*h.lightY+Math.sin(f)*b,heading:Math.random()*Math.PI*2,speed:1.6+Math.random()*1.4,alpha:0,side:Math.random()<.5?1:-1,flap:Math.random()*Math.PI*2,size:.75+Math.random()*.5,escape:0,seed:Math.random()*1e3}}function a(g,l,h,f,b){const m=.35+.65*Math.abs(Math.sin(l.flap));g.save(),g.translate(l.x,l.y),g.rotate(l.heading+Math.PI/2),g.globalAlpha=f,g.fillStyle=h;for(const w of[-1,1])g.beginPath(),g.moveTo(0,-b*.2),g.quadraticCurveTo(w*b*1.6*m,-b*1.1,w*b*1.5*m,b*.1),g.quadraticCurveTo(w*b*.9*m,b*.25,0,b*.15),g.fill(),g.beginPath(),g.moveTo(0,b*.1),g.quadraticCurveTo(w*b*1.05*m,b*.3,w*b*.75*m,b*.95),g.quadraticCurveTo(w*b*.3*m,b*.9,0,b*.55),g.fill();g.beginPath(),g.ellipse(0,b*.2,b*.16,b*.6,0,0,Math.PI*2),g.fill(),g.restore()}function i(g,l,h,f,b){const m=u.current,w=f/16.67;e.current+=f*.001;const B=e.current;b.overlay||(g.fillStyle=m.backgroundColor,g.fillRect(0,0,l,h));const F=zo(P.current,o.current),X=k.current,O=m.followCursor&&F.inside?F.x:l*m.lightX,_=m.followCursor&&F.inside?F.y:h*m.lightY,H=1-Math.pow(.82,w);X.x+=(O-X.x)*H,X.y+=(_-X.y)*H;const D=.92+.05*Math.sin(B*11)+.03*Math.sin(B*23.7);y.current.color!==m.lightColor&&(y.current={color:m.lightColor,img:Yo(m.lightColor,128)});const W=y.current.img;if(m.showLight&&W){const M=g.globalCompositeOperation;g.globalCompositeOperation="lighter";const p=m.glowRadius*D;g.globalAlpha=.55,g.drawImage(W,X.x-p*2,X.y-p*2,p*4,p*4),g.globalAlpha=.9,g.drawImage(W,X.x-p*.35,X.y-p*.35,p*.7,p*.7),g.globalAlpha=1,g.globalCompositeOperation=M}for(const M of F.taps)for(const p of s.current)Math.hypot(p.x-M.x,p.y-M.y)<220&&(p.escape=500+Math.random()*900,p.heading=Math.atan2(p.y-M.y,p.x-M.x)+(Math.random()-.5));const A=m.count>0?Math.max(1,Math.ceil(m.count*b.quality)):0,T=s.current;for(;T.length<A;)T.push(n());T.length>A&&(T.length=A);const E=m.angle*Math.PI/180,x=Math.hypot(l,h);for(const M of T){M.alpha=E+Math.sin(B*.7+M.seed)*.18,M.flap+=(.55+M.speed*.12)*w;const p=M.speed*m.speed;M.escape>0?(M.escape-=f,M.heading+=(Math.random()-.5)*.3*w,M.x+=Math.cos(M.heading)*p*1.5*w,M.y+=Math.sin(M.heading)*p*1.5*w):(f0(M,X.x,X.y,w,m.speed),M.heading+=(Math.random()-.5)*.35*w,Math.hypot(M.x-X.x,M.y-X.y)<10&&(M.escape=250+Math.random()*700,M.heading+=Math.PI+(Math.random()-.5)*1.2)),Math.hypot(M.x-X.x,M.y-X.y)>x&&Object.assign(M,n())}const I=Fo([m.backgroundColor],0);for(const M of T){const p=Math.hypot(M.x-X.x,M.y-X.y),R=Math.max(0,1-p/(m.glowRadius*3)),c=Fo([m.color,m.lightColor],R*.6),d=.35+.65*R,$=`rgb(${I[0]+(c[0]-I[0])*d|0},${I[1]+(c[1]-I[1])*d|0},${I[2]+(c[2]-I[2])*d|0})`;a(g,M,$,.55+.45*R,m.size*M.size)}g.globalAlpha=1}const r=To({overlay:t.overlay,onResize:(g,l)=>{v.current={w:g,h:l};const h=u.current;k.current={x:g*h.lightX,y:l*h.lightY},s.current=Array.from({length:h.count},n)},onFrame:i});return o.current=r.canvas,r}const h0={default:{color:"#c8b28f",lightColor:"#ffd27a",backgroundColor:"#0b0805"},monochrome:{},"porch-lamp":{color:"#c8b28f",lightColor:"#ffd27a",backgroundColor:"#0b0805"},moonlight:{color:"#cbd5e1",lightColor:"#dbeafe",backgroundColor:"#04070f",angle:86},candle:{color:"#d6a77a",lightColor:"#ff9a3c",backgroundColor:"#0a0503",angle:76},neon:{color:"#a78bfa",lightColor:"#f0abfc",backgroundColor:"#07020c"}},Br=Y.forwardRef((t,u)=>{const{preset:s,count:v,color:k,lightColor:e,backgroundColor:y,angle:P,speed:o,size:n,glowRadius:a,lightX:i,lightY:r,showLight:g,followCursor:l,overlay:h,zIndex:f,width:b,height:m,className:w,style:B}=t,F=h0[s??"default"]||{},{canvasRef:X,canvas:O}=d0({count:v??26,color:k??F.color??"#9ca3af",lightColor:e??F.lightColor??"#ffffff",backgroundColor:y??F.backgroundColor??"#111111",angle:P??F.angle??80,speed:o??1,size:n??8,glowRadius:a??120,lightX:i??.5,lightY:r??.42,showLight:g??!0,followCursor:l??!0,overlay:h??!1});return Y.useImperativeHandle(u,()=>O,[O]),Mo.jsx(Io,{canvasRef:X,overlay:h,zIndex:f,width:b,height:m,className:w,style:B})});Br.displayName="Moths";function u0(t,u,s,v,k,e){const y=v*Math.PI/180,P=Math.sin(y),o=Math.cos(y),n=Math.cos(y),a=-Math.sin(y),i=t*e,r=t*k-i/2,g=Math.max(1,s),l=i/g,h=l*.14,f=u/Math.max(.2,o)*1.15;return Array.from({length:g},(b,m)=>({ax:r+m*l+h/2,ay:0,dx:P,dy:o,nx:n,ny:a,width:(l-h)*Math.cos(y),length:f,spread:.35}))}function g0(t,u,s){let v=0;for(const k of s){const e=t-k.ax,y=u-k.ay,P=e*k.dx+y*k.dy;if(P<0||P>k.length)continue;const o=e*k.nx+y*k.ny,n=k.width*(1+k.spread*(P/k.length));if(o<0||o>n)continue;const a=o/n,i=Math.min(1,Math.min(a,1-a)/.18);v+=i*(1-.65*(P/k.length))}return Math.min(1,v)}function p0(t){const u=Y.useRef(t);u.current=t;const s=Y.useRef([]),v=Y.useRef([]),k=Y.useRef(""),e=Y.useRef(0),y=Y.useRef({color:"",img:null}),P=Eo(),o=Y.useRef(Vo()).current,n=Y.useRef(null);function a(g,l){return{x:Math.random()*g,y:Math.random()*l,vx:0,vy:0,size:.5+Math.random()*Math.random()*1.6,tw:Math.random()*Math.PI*2,twSpeed:.6+Math.random()*2.2}}function i(g,l,h,f,b){const m=u.current,w=f/16.67;e.current+=f*.001;const B=e.current,F=`${l}|${h}|${m.beams}|${m.angle}|${m.windowX}|${m.windowWidth}`;k.current!==F&&(k.current=F,v.current=u0(l,h,m.beams,m.angle,m.windowX,m.windowWidth));const X=v.current;b.overlay||(g.fillStyle=m.backgroundColor,g.fillRect(0,0,l,h));const O=(.78+.22*Math.sin(B*.13)*Math.sin(B*.071+1.3))*m.intensity,_=g.globalCompositeOperation;g.globalCompositeOperation="lighter";for(const M of X)for(const[p,R]of[[1,.05],[.78,.06],[.52,.07]]){const c=(1-p)/2,d=M.width,$=M.width*(1+M.spread),C=d*c,S=$*c,N=M.ax+M.dx*M.length,z=M.ay+M.dy*M.length,L=g.createLinearGradient(M.ax,M.ay,N,z);L.addColorStop(0,ko(m.color,R*O)),L.addColorStop(.6,ko(m.color,R*O*.45)),L.addColorStop(1,ko(m.color,0)),g.fillStyle=L,g.beginPath(),g.moveTo(M.ax+M.nx*C,M.ay+M.ny*C),g.lineTo(M.ax+M.nx*(C+d*p),M.ay+M.ny*(C+d*p)),g.lineTo(N+M.nx*(S+$*p),z+M.ny*(S+$*p)),g.lineTo(N+M.nx*S,z+M.ny*S),g.closePath(),g.fill()}const H=Math.max(0,Math.ceil(m.dustCount*b.quality)),D=s.current;for(;D.length<H;)D.push(a(l,h));D.length>H&&(D.length=H);const W=zo(P.current,n.current),A=o(W,w),T=m.interactive&&W.inside,E=140;y.current.color!==m.color&&(y.current={color:m.color,img:Yo(m.color,32)});const x=y.current.img,I=1-Math.pow(.97,w);for(const M of D){const p=M.x*.004+B*.09,R=M.y*.005-B*.06,c=-Math.sin(p)*Math.sin(R)*.6,d=-Math.cos(p)*Math.cos(R)*.5-.04;if(M.vx+=(c*m.speed*.35-M.vx)*I+(Math.random()-.5)*.02*w,M.vy+=(d*m.speed*.35-M.vy)*I+(Math.random()-.5)*.02*w,T){const N=M.x-W.x,z=M.y-W.y,L=Math.hypot(N,z);if(L<E){const G=(1-L/E)*(1-L/E);M.vx+=(A.vx*.05-z/(L||1)*Math.hypot(A.vx,A.vy)*.03)*G*w,M.vy+=(A.vy*.05+N/(L||1)*Math.hypot(A.vx,A.vy)*.03)*G*w}}M.x+=M.vx*w,M.y+=M.vy*w,M.x<-5&&(M.x+=l+10),M.x>l+5&&(M.x-=l+10),M.y<-5&&(M.y+=h+10),M.y>h+5&&(M.y-=h+10);const $=g0(M.x,M.y,X);M.tw+=M.twSpeed*f*.001;const C=$*O*(.55+.45*Math.sin(M.tw))+.03;if(C<.04)continue;const S=m.dustSize*M.size*(1.6+$);x?(g.globalAlpha=Math.min(1,C),g.drawImage(x,M.x-S*2,M.y-S*2,S*4,S*4)):(g.globalAlpha=Math.min(1,C),g.fillStyle=m.color,g.fillRect(M.x-S/2,M.y-S/2,S,S))}g.globalAlpha=1,g.globalCompositeOperation=_}const r=To({overlay:t.overlay,onResize:(g,l)=>{s.current=Array.from({length:u.current.dustCount},()=>a(g,l))},onFrame:i});return n.current=r.canvas,r}const m0={default:{color:"#ffcf87",backgroundColor:"#140d07"},monochrome:{},"golden-hour":{color:"#ffcf87",backgroundColor:"#140d07",angle:32,intensity:1.1},chapel:{color:"#fff1d6",backgroundColor:"#0b0a0c",angle:12,beams:3,intensity:1.2},morning:{color:"#e0f2fe",backgroundColor:"#0a1016",angle:22},dusk:{color:"#fda4af",backgroundColor:"#120a12",angle:38,intensity:.9}},Or=Y.forwardRef((t,u)=>{const{preset:s,color:v,backgroundColor:k,beams:e,angle:y,intensity:P,dustCount:o,dustSize:n,speed:a,windowX:i,windowWidth:r,interactive:g,overlay:l,zIndex:h,width:f,height:b,className:m,style:w}=t,B=m0[s??"default"]||{},{canvasRef:F,canvas:X}=p0({color:v??B.color??"#ffffff",backgroundColor:k??B.backgroundColor??"#111111",beams:Math.max(1,Math.round(e??B.beams??4)),angle:Math.max(-60,Math.min(60,y??B.angle??24)),intensity:P??B.intensity??1,dustCount:Math.max(0,o??320),dustSize:n??1,speed:a??1,windowX:i??.35,windowWidth:r??.42,interactive:g??!0,overlay:l??!1});return Y.useImperativeHandle(u,()=>X,[X]),Mo.jsx(Io,{canvasRef:F,overlay:l,zIndex:h,width:f,height:b,className:m,style:w})});Or.displayName="SunbeamDust";function y0(t,u,s){const v=1-Math.pow(.985,s),k=1-Math.pow(.98,s),e=-u.rise*(.35+.65*t.z);t.vy+=(e-t.vy)*v;const y=u.wind*(.4+.6*t.z)+Math.sin(u.t*.45+t.phase)*.28*t.z;t.vx+=(y-t.vx)*k,t.x+=t.vx*s,t.y+=t.vy*s;const P=t.vx*.12+Math.sin(u.t*1.3+t.seed)*.03;t.swayVel+=(-.03*(t.sway-P)-.06*t.swayVel)*s,t.sway+=t.swayVel*s,t.z=Math.max(.18,t.z-12e-5*s)}function M0(t){const u=Y.useRef(t);u.current=t;const s=Y.useRef([]),v=Y.useRef(0),k=Y.useRef(0),e=Y.useRef({color:"",img:null}),y=Eo(),P=Y.useRef(null);function o(r,g,l){return{x:r,y:g,z:l,vx:0,vy:-.1,sway:(Math.random()-.5)*.2,swayVel:0,phase:Math.random()*Math.PI*2,seed:Math.random()*1e3,born:0}}function n(r,g,l,h,f,b){const m=l.size*g.z,w=.82+.1*Math.sin(h*13+g.seed)+.08*Math.sin(h*7.3+g.seed*2.1),B=b*(.35+.65*g.z);if(f){const D=r.globalCompositeOperation;r.globalCompositeOperation="lighter";const W=m*3.2*w;r.globalAlpha=.42*B,r.drawImage(f,g.x-W,g.y-W*.85,W*2,W*2),r.globalCompositeOperation=D}r.save(),r.translate(g.x,g.y),r.rotate(g.sway),r.globalAlpha=B;const F=-m*.7,X=m*.62,O=m*.5,_=m*.4,H=r.createLinearGradient(0,X,0,F);if(H.addColorStop(0,ko(l.glowColor,1)),H.addColorStop(.45,ko(l.color,.95)),H.addColorStop(1,ko(l.color,.7)),r.fillStyle=H,r.beginPath(),r.moveTo(-O,F),r.quadraticCurveTo(0,F-m*.12,O,F),r.quadraticCurveTo(O*1.12,(F+X)/2,_,X),r.quadraticCurveTo(0,X+m*.08,-_,X),r.quadraticCurveTo(-O*1.12,(F+X)/2,-O,F),r.fill(),m>9){r.strokeStyle=ko(l.color,.35),r.lineWidth=Math.max(.5,m*.03),r.beginPath();for(const D of[-.5,0,.5])r.moveTo(O*D,F),r.lineTo(_*D,X);r.stroke(),r.fillStyle=ko(l.glowColor,.9*w),r.beginPath(),r.ellipse(0,X,_*.85,m*.07,0,0,Math.PI*2),r.fill()}r.restore()}function a(r,g,l,h,f){const b=u.current,m=h/16.67;v.current+=h*.001;const w=v.current;f.overlay||(r.fillStyle=b.backgroundColor,r.fillRect(0,0,g,l)),e.current.color!==b.glowColor&&(e.current={color:b.glowColor,img:Yo(b.glowColor,96)});const B=e.current.img,F=s.current,X=Math.max(0,Math.ceil(b.count*f.quality));if(b.autoRelease&&X>0){for(k.current+=h*.001*X/14;k.current>=1;)if(k.current-=1,F.length<X){const D=.3+Math.pow(Math.random(),1.8)*.7;F.push(o(Math.random()*g,l+b.size*2,D))}}const O=zo(y.current,P.current);if(b.interactive)for(const D of O.taps){const W=f.solids.find(T=>D.x>=T.x&&D.x<=T.x+T.w&&D.y>=T.y&&D.y<=T.y+T.h),A=W?o(W.x+W.w/2,W.y-b.size*.4,1):o(D.x,D.y,1);A.vy=-.6,F.push(A)}const _={t:w,wind:b.wind,rise:b.riseSpeed};let H=0;for(const D of F){y0(D,_,m),D.born=Math.min(1,D.born+h/900);const W=b.size*3;D.y<-W||D.x<-W*3||D.x>g+W*3||(F[H++]=D)}F.length=H,F.sort((D,W)=>D.z-W.z);for(const D of F){const W=Math.min(1,(D.y+b.size*3)/(l*.25));n(r,D,b,w,B,D.born*Math.max(0,W))}r.globalAlpha=1}const i=To({overlay:t.overlay,collide:t.collide,onResize:(r,g)=>{const l=u.current;s.current=l.autoRelease?Array.from({length:Math.ceil(l.count*.6)},()=>{const h=o(Math.random()*r,g*(.2+Math.random()*.8),.3+Math.pow(Math.random(),1.8)*.7);return h.born=1,h.vy=-l.riseSpeed*(.35+.65*h.z),h}):[]},onFrame:a});return P.current=i.canvas,i}const b0={default:{color:"#ff8a3d",glowColor:"#ffd27a",backgroundColor:"#0b0612"},monochrome:{},festival:{color:"#ff8a3d",glowColor:"#ffd27a",backgroundColor:"#0b0612"},lotus:{color:"#ff9eb5",glowColor:"#ffe1a8",backgroundColor:"#0a0710"},moon:{color:"#f3e8d0",glowColor:"#fff3c4",backgroundColor:"#070b16"},jade:{color:"#7ee0b0",glowColor:"#e6ffb3",backgroundColor:"#04110c"}},Wr=Y.forwardRef((t,u)=>{const{preset:s,count:v,color:k,glowColor:e,backgroundColor:y,size:P,riseSpeed:o,wind:n,autoRelease:a,interactive:i,overlay:r,collide:g,zIndex:l,width:h,height:f,className:b,style:m}=t,w=b0[s??"default"]||{},{canvasRef:B,canvas:F}=M0({count:Math.max(0,v??22),color:k??w.color??"#d1d5db",glowColor:e??w.glowColor??"#ffffff",backgroundColor:y??w.backgroundColor??"#111111",size:P??34,riseSpeed:o??1,wind:n??.3,autoRelease:a??!0,interactive:i??!0,overlay:r??!1,collide:g??!1});return Y.useImperativeHandle(u,()=>F,[F]),Mo.jsx(Io,{canvasRef:B,overlay:r,zIndex:l,width:h,height:f,className:b,style:m})});Wr.displayName="PaperLanterns";function C0(t,u,s,v){const k={x:new Float32Array(s),y:new Float32Array(s),vx:new Float32Array(s),vy:new Float32Array(s),seg:v};for(let e=0;e<s;e++)k.x[e]=t,k.y[e]=u-e*v;return k}function v0(t,u,s,v=4,k=.94){const e=t.x.length,y=new Float32Array(e),P=new Float32Array(e),o=Math.pow(k,s);for(let n=1;n<e;n++){const[a,i]=u(n);t.vx[n]=(t.vx[n]+a*s)*o,t.vy[n]=(t.vy[n]+i*s)*o,y[n]=t.x[n],P[n]=t.y[n],t.x[n]+=t.vx[n]*s,t.y[n]+=t.vy[n]*s}for(let n=0;n<v;n++)for(let a=1;a<e;a++){const i=t.x[a]-t.x[a-1],r=t.y[a]-t.y[a-1],g=Math.hypot(i,r)||1e-6,l=(g-t.seg)/g;a===1?(t.x[a]-=i*l,t.y[a]-=r*l):(t.x[a]-=i*l*.5,t.y[a]-=r*l*.5,t.x[a-1]+=i*l*.5,t.y[a-1]+=r*l*.5)}for(let n=1;n<e;n++)t.vx[n]=(t.x[n]-y[n])/s,t.vy[n]=(t.y[n]-P[n])/s}const w0=t=>`rgb(${t[0]|0},${t[1]|0},${t[2]|0})`;function k0(t){const u=Y.useRef(t);u.current=t;const s=Y.useRef([]),v=Y.useRef([]),k=Y.useRef([]),e=Y.useRef(0),y=Y.useRef(""),P=Eo(),o=Y.useRef(Vo()).current,n=Y.useRef(null);function a(g,l){const h=u.current;y.current=`${h.kelpCount}|${h.fishCount}`,s.current=Array.from({length:h.kelpCount},(f,b)=>{const m=.45+Math.random()*.55,w=l*(.55+Math.random()*.4)*(.7+.3*m),B=16,F=(b+.5)/h.kelpCount*g+(Math.random()-.5)*(g/h.kelpCount)*.8;return{chain:C0(F,l+6,B,w/(B-1)),z:m,phase:Math.random()*10,frond:12+Math.random()*8}}).sort((f,b)=>f.z-b.z),v.current=Array.from({length:h.fishCount},(f,b)=>({x:Math.random()*g,y:l*(.2+Math.random()*.5),vx:(Math.random()-.5)*2,vy:(Math.random()-.5)*.5,size:5+Math.random()*4,school:b%2,tail:Math.random()*6})),k.current=[]}function i(g,l,h,f,b){const m=u.current,w=f/16.67;e.current+=f*.001;const B=e.current;if(y.current!==`${m.kelpCount}|${m.fishCount}`&&a(l,h),!b.overlay){g.fillStyle=m.backgroundColor,g.fillRect(0,0,l,h);const T=g.createLinearGradient(0,0,0,h);T.addColorStop(0,"rgba(255,255,255,0.07)"),T.addColorStop(.45,"rgba(255,255,255,0)"),T.addColorStop(1,"rgba(0,0,0,0.38)"),g.fillStyle=T,g.fillRect(0,0,l,h)}if(m.lightRays){const T=g.globalCompositeOperation;g.globalCompositeOperation="lighter";for(let E=0;E<5;E++){const x=l*(.1+E*.2)+Math.sin(B*.17+E*1.9)*l*.05,I=l*.12,M=14+E*9,p=g.createLinearGradient(0,0,0,h*.85),R=.035+.02*Math.sin(B*.4+E*2.3);p.addColorStop(0,`rgba(255,255,255,${R})`),p.addColorStop(1,"rgba(255,255,255,0)"),g.fillStyle=p,g.beginPath(),g.moveTo(x-M,0),g.lineTo(x+M,0),g.lineTo(x+I+M*3.2,h*.85),g.lineTo(x+I-M*3.2,h*.85),g.closePath(),g.fill()}g.globalCompositeOperation=T}const F=zo(P.current,n.current),X=o(F,w),O=m.interactive&&F.inside,_=120,H=(T,E,x)=>{if(!O)return[0,0];const I=Math.hypot(T-F.x,E-F.y);if(I>_)return[0,0];const M=(1-I/_)*x;return[X.vx*M,X.vy*M]},D=Fo([m.backgroundColor],0);for(const T of s.current){const E=T.chain,x=E.x.length;v0(E,d=>{const $=d/(x-1),C=Math.sin(B*.55+T.phase+d*.22)+.35,[S,N]=H(E.x[d],E.y[d],.06);return[m.current*.016*C*$+S,-.045+N]},w);const I=Fo([m.kelpColor],0),M=.35+.65*T.z,p=w0([D[0]+(I[0]-D[0])*M,D[1]+(I[1]-D[1])*M,D[2]+(I[2]-D[2])*M]),R=new Path2D;for(let d=2;d<x;d++){const $=Math.atan2(E.y[d]-E.y[d-1],E.x[d]-E.x[d-1]),C=d%2?1:-1,S=$+C*(.75+.25*Math.sin(B*1.6+d+T.phase)),N=T.frond*T.z*(1-d/x*.35),z=N*.28,L=E.x[d]+Math.cos(S)*N,G=E.y[d]+Math.sin(S)*N,q=E.x[d]+Math.cos(S)*N*.5,j=E.y[d]+Math.sin(S)*N*.5,V=-Math.sin(S)*z,K=Math.cos(S)*z;R.moveTo(E.x[d],E.y[d]),R.quadraticCurveTo(q+V,j+K,L,G),R.quadraticCurveTo(q-V,j-K,E.x[d],E.y[d])}g.fillStyle=p,g.globalAlpha=.9,g.fill(R),g.globalAlpha=1,g.strokeStyle=p,g.lineCap="round",g.lineJoin="round";const c=[0,Math.floor(x/3),Math.floor(2*x/3),x-1];for(let d=0;d<3;d++){g.lineWidth=(3.4-d*1)*T.z,g.beginPath(),g.moveTo(E.x[c[d]],E.y[c[d]]);for(let $=c[d]+1;$<=c[d+1];$++)g.lineTo(E.x[$],E.y[$]);g.stroke()}g.fillStyle=p,g.beginPath(),g.arc(E.x[x-1],E.y[x-1],2.6*T.z,0,Math.PI*2),g.fill()}const W=v.current,A=[[0,0,0],[0,0,0]];for(const T of W)A[T.school][0]+=T.x,A[T.school][1]+=T.y,A[T.school][2]++;for(let T=0;T<2;T++){const E=l*(.5+.38*Math.sin(B*.07+T*2.5)),x=h*(.42+.18*Math.sin(B*.11+T*1.3)),I=A[T][2]||1;for(const M of W){if(M.school!==T)continue;let p=(A[T][0]/I-M.x)*4e-4+(E-M.x)*12e-5,R=(A[T][1]/I-M.y)*4e-4+(x-M.y)*12e-5;for(const C of W){if(C===M)continue;const S=M.x-C.x,N=M.y-C.y,z=S*S+N*N;z<196&&z>0?(p+=S/z*.4,R+=N/z*.4):C.school===T&&z<3600&&(p+=(C.vx-M.vx)*.004,R+=(C.vy-M.vy)*.004)}let c=2.2;if(O){const C=M.x-F.x,S=M.y-F.y,N=Math.hypot(C,S);if(N<130){const z=(1-N/130)*(.25+Math.hypot(X.vx,X.vy)*.03);p+=C/(N||1)*z,R+=S/(N||1)*z,c=5}}M.y<h*.08&&(R+=.05),M.y>h*.85&&(R-=.05),M.vx+=p*w,M.vy+=R*w;const d=Math.hypot(M.vx,M.vy),$=Math.max(.7,Math.min(c,d));M.vx=M.vx/(d||1)*$,M.vy=M.vy/(d||1)*$*.8,M.x+=M.vx*w,M.y+=M.vy*w,M.x<-30&&(M.x=l+30),M.x>l+30&&(M.x=-30),M.tail+=(.25+d*.12)*w}}g.fillStyle=m.fishColor;for(const T of W){g.save(),g.translate(T.x,T.y),g.rotate(Math.atan2(T.vy,T.vx)),g.globalAlpha=.9;const E=T.size;g.beginPath(),g.ellipse(0,0,E,E*.38,0,0,Math.PI*2),g.fill();const x=Math.sin(T.tail)*.4;g.beginPath(),g.moveTo(-E*.8,0),g.lineTo(-E*1.55,-E*.45+x*E*.5),g.lineTo(-E*1.55,E*.45+x*E*.5),g.closePath(),g.fill(),g.restore()}if(g.globalAlpha=1,m.bubbles){const T=k.current;if(Math.random()<.025*w*b.quality&&s.current.length){const x=s.current[Math.random()*s.current.length|0];T.push({x:x.chain.x[2],y:x.chain.y[2],r:1.2+Math.random()*2.6,seed:Math.random()*10})}g.strokeStyle=ko(m.fishColor,.45),g.lineWidth=.8;let E=0;for(const x of T){const[I,M]=H(x.x,x.y,.08);x.x+=(Math.sin(B*3+x.seed)*.35+I)*w,x.y+=(-.55-x.r*.12+M)*w,x.r+=.002*w,!(x.y<-8)&&(T[E++]=x,g.beginPath(),g.arc(x.x,x.y,x.r,0,Math.PI*2),g.stroke())}T.length=E}}const r=To({overlay:t.overlay,onResize:a,onFrame:i});return n.current=r.canvas,r}const S0={default:{kelpColor:"#8a7a2c",fishColor:"#e2e8f0",backgroundColor:"#052637"},monochrome:{},pacific:{kelpColor:"#8a7a2c",fishColor:"#e2e8f0",backgroundColor:"#052637"},tropical:{kelpColor:"#2fa36b",fishColor:"#ffb36b",backgroundColor:"#04354a"},midnight:{kelpColor:"#2b5a6b",fishColor:"#9be7ff",backgroundColor:"#020a14",current:.7},golden:{kelpColor:"#b8902e",fishColor:"#fff1c1",backgroundColor:"#141006"}},qr=Y.forwardRef((t,u)=>{const{preset:s,kelpCount:v,fishCount:k,kelpColor:e,fishColor:y,backgroundColor:P,current:o,bubbles:n,lightRays:a,interactive:i,overlay:r,zIndex:g,width:l,height:h,className:f,style:b}=t,m=S0[s??"default"]||{},{canvasRef:w,canvas:B}=k0({kelpCount:Math.max(0,Math.round(v??9)),fishCount:Math.max(0,Math.round(k??16)),kelpColor:e??m.kelpColor??"#6b7280",fishColor:y??m.fishColor??"#ffffff",backgroundColor:P??m.backgroundColor??"#111111",current:o??m.current??1,bubbles:n??!0,lightRays:a??!0,interactive:i??!0,overlay:r??!1});return Y.useImperativeHandle(u,()=>B,[B]),Mo.jsx(Io,{canvasRef:w,overlay:r,zIndex:g,width:l,height:h,className:f,style:b})});qr.displayName="KelpForest";const Mn=3;function R0(t,u,s,v=2){const k=t.h,e=k.length,y=u*t.cell;let P=0,o=0;for(let n=0;n<v;n++){for(let a=0;a<e-1;a++){const i=k[a]-k[a+1];if(i>y){const r=(i-y)/2;k[a]-=r,k[a+1]+=r}else if(i<-y){const r=(-i-y)/2;k[a]+=r,k[a+1]-=r}}s&&e>0&&(k[0]>y&&(P+=k[0]-y,k[0]=y),k[e-1]>y&&(o+=k[e-1]-y,k[e-1]=y))}return[P,o]}function bn(t){return{h:new Float32Array(Math.max(1,Math.ceil(t/Mn))),cell:Mn,width:t}}function P0(t){const u=Y.useRef(t);u.current=t;const s=Y.useRef([]),v=Y.useRef(new Map),k=Y.useRef({w:0,h:0}),e=Y.useRef(0),y=Eo(),P=Y.useRef(Vo()).current,o=Y.useRef(null);function n(l){const{w:h,h:f}=k.current,b=u.current,m=.45+Math.random()*.55;return{x:Math.random()*(h+100)-50,y:l?-10-Math.random()*40:Math.random()*f,vx:0,vy:b.fallSpeed*m,size:b.flakeSize*m*(.6+Math.random()*.6),depth:m,phase:Math.random()*Math.PI*2,load:0}}function a(l,h,f,b){const m=Math.max(0,Math.min(l.h.length-1,Math.floor(h/l.cell)));l.h[m]=Math.min(b,l.h[m]+f)}function i(l,h,f,b,m,w){const B=h.h,F=B.length;let X=!1;for(let H=0;H<F;H++)if(B[H]>.4){X=!0;break}if(!X)return;l.beginPath(),l.moveTo(f,b);let O=f,_=b-B[0];l.lineTo(O,_);for(let H=1;H<F;H++){const D=f+H*h.cell+h.cell/2,W=b-B[H];l.quadraticCurveTo(O,_,(O+D)/2,(_+W)/2),O=D,_=W}l.lineTo(f+h.width,b-B[F-1]),l.lineTo(f+h.width,b),l.closePath(),l.fillStyle=m,l.fill(),l.strokeStyle=w,l.lineWidth=1,l.stroke()}function r(l,h,f,b,m){const w=u.current,B=b/16.67;e.current+=b*.001;const F=e.current,X=v.current;m.overlay||(l.fillStyle=w.backgroundColor,l.fillRect(0,0,h,f));const O=X.get(-1);(!O||Math.abs(O.width-h)>1)&&X.set(-1,bn(h));const _=m.solids,H=new Map(_.map(S=>[S.id,S]));for(const S of _){if(S.w<12)continue;const N=X.get(S.id);(!N||Math.abs(N.width-S.w)>2)&&X.set(S.id,bn(S.w))}for(const S of X.keys())S!==-1&&!H.has(S)&&X.delete(S);const D=s.current;for(const[S,N]of X){const[z,L]=R0(N,w.slope,S!==-1),G=H.get(S);if(G)for(const[q,j]of[[z,-1],[L,1]])q<.05||D.push({x:j<0?G.x-2:G.x+G.w+2,y:G.y-2,vx:j*(.3+Math.random()*.4),vy:.5,size:Math.min(6,1.5+q*1.5),depth:1,phase:0,load:q})}const W=zo(y.current,o.current),A=P(W,B),T=Math.hypot(A.vx,A.vy);if(w.interactive&&W.inside&&T>1.2)for(const[S,N]of X){const z=S===-1?null:H.get(S),L=z?z.x:0,G=z?z.y:f,q=Math.floor((W.x-L)/N.cell);for(let j=q-5;j<=q+5;j++){if(j<0||j>=N.h.length||N.h[j]<.5)continue;const V=G-N.h[j];if(W.y<V-12||W.y>G+4)continue;const K=Math.min(N.h[j],(.25+T*.06)*B);N.h[j]-=K,Math.random()<K*.6&&D.length<2e3&&D.push({x:L+j*N.cell,y:V,vx:A.vx*.35+(Math.random()-.5),vy:A.vy*.35-1-Math.random(),size:1+Math.random()*1.6,depth:1,phase:Math.random()*6,load:K})}}const E=Math.ceil(w.count*m.quality);let x=0;for(const S of D)S.load===0&&x++;for(let S=x;S<E;S++)D.push(n(!0));const I=1-Math.pow(.96,B),M=X.get(-1),p=[new Path2D,new Path2D,new Path2D];let R=0,c=0;for(const S of D){const N=S.y,z=S.load>0,L=Math.sin(F*1.3+S.phase)*.35*S.depth,G=(w.wind*S.depth+L)*(z?.3:1),q=w.fallSpeed*(z?2.2:.55+S.depth*.6);S.vx+=(G-S.vx)*(z?I*.4:I),S.vy+=(q-S.vy)*(z?I*.5:I),S.x+=S.vx*B,S.y+=S.vy*B;let j=!1;if(S.vy>0){for(const K of _){if(S.x<K.x||S.x>K.x+K.w)continue;const to=X.get(K.id);if(!to)continue;const lo=Math.min(to.h.length-1,Math.floor((S.x-K.x)/to.cell)),ao=K.y-to.h[lo];if(N<=ao&&S.y>=ao){a(to,S.x-K.x,z?S.load:S.size*.5,w.maxDepth),j=!0;break}}if(!j){const K=Math.max(0,Math.min(M.h.length-1,Math.floor(S.x/M.cell)));S.y>=f-M.h[K]&&(S.x>=0&&S.x<=h&&a(M,S.x,z?S.load:S.size*.35,w.floorDepth),j=!0)}}if(j||S.y>f+20||S.x<-80||S.x>h+80){if(z||c>=E)continue;Object.assign(S,n(!0))}D[R++]=S,z||c++;const V=S.depth<.65?0:S.depth<.85?1:2;p[V].moveTo(S.x+S.size,S.y),p[V].arc(S.x,S.y,S.size,0,Math.PI*2)}D.length=R,l.fillStyle=w.color;const d=[.45,.7,.95];for(let S=0;S<3;S++)l.globalAlpha=d[S],l.fill(p[S]);l.globalAlpha=1;const $=Fo([w.color,w.backgroundColor],.28),C=`rgb(${$[0]|0},${$[1]|0},${$[2]|0})`;for(const[S,N]of X){const z=S===-1?null:H.get(S);if(S!==-1&&!z)continue;const L=z?z.x:0,G=z?z.y:f,q=S===-1?w.floorDepth:w.maxDepth,j=l.createLinearGradient(0,G-q,0,G);j.addColorStop(0,w.color),j.addColorStop(1,C),i(l,N,L,G,j,w.color)}}const g=To({overlay:t.overlay,collide:t.collide,onResize:(l,h)=>{k.current={w:l,h},v.current.delete(-1),s.current=Array.from({length:u.current.count},()=>n(!1))},onFrame:r});return o.current=g.canvas,g}const x0={default:{color:"#f8fafc",backgroundColor:"#0b1220"},monochrome:{},"winter-night":{color:"#f8fafc",backgroundColor:"#0b1220"},blizzard:{color:"#e2e8f0",backgroundColor:"#1e293b",wind:1.8},nordic:{color:"#ffffff",backgroundColor:"#10141c",maxDepth:34},dusk:{color:"#fde2e4",backgroundColor:"#1a1020",wind:-.3}},Gr=Y.forwardRef((t,u)=>{const{preset:s,count:v,color:k,backgroundColor:e,flakeSize:y,wind:P,fallSpeed:o,maxDepth:n,floorDepth:a,slope:i,interactive:r,overlay:g,collide:l,zIndex:h,width:f,height:b,className:m,style:w}=t,B=x0[s??"default"]||{},{canvasRef:F,canvas:X}=P0({count:Math.max(0,Math.round(v??220)),color:k??B.color??"#ffffff",backgroundColor:e??B.backgroundColor??"#111111",flakeSize:y??2.2,wind:P??B.wind??.4,fallSpeed:o??1,maxDepth:n??B.maxDepth??26,floorDepth:a??60,slope:i??.7,interactive:r??!0,overlay:g??!1,collide:l??!1});return Y.useImperativeHandle(u,()=>X,[X]),Mo.jsx(Io,{canvasRef:F,overlay:g,zIndex:h,width:f,height:b,className:m,style:w})});Gr.displayName="SnowDrift";function $0(t){const u=2+Math.sin(t)*15,s=Math.cos(t)*15,v=e=>[.5,2+Math.sin(t)*5,e*Math.cos(t)*5],k=[[[-7,1,0],[7,1,0],[0,-5,.8]],[[-7,1,0],[7,1,0],[0,-5,-.8]],[[4,-1,.3],[7,1,0],[16,11,0]],[[15,10,0],[16.5,11.5,.3],[20.5,8,0]],[[-4,-1,.3],[-7,1,0],[-17,10,0]]];for(const e of[1,-1]){const y=[-1.5,u,e*s],P=v(e);k.push([[5,2,0],P,y]),k.push([P,[-5,2,0],y])}return k}const $t=(()=>{const t=[-.35,.8,-.5],u=Math.hypot(...t);return[t[0]/u,t[1]/u,t[2]/u]})();function I0(t,u,s){const v=u[0]-t[0],k=u[1]-t[1],e=u[2]-t[2],y=s[0]-t[0],P=s[1]-t[1],o=s[2]-t[2];let n=k*o-e*P,a=e*y-v*o,i=v*P-k*y;const r=Math.hypot(n,a,i)||1;return n/=r,a/=r,i/=r,.42+.58*Math.abs(n*$t[0]+a*$t[1]+i*$t[2])}const Cn=700,T0=.6;function A0(t){const u=Y.useRef(t);u.current=t;const s=Y.useRef([]),v=Y.useRef({w:0,h:0}),k=Y.useRef(0),e=Eo(),y=Y.useRef(null);function P(i){const{w:r,h:g}=v.current;i.tx=r*(.1+Math.random()*.8),i.ty=g*(.12+Math.random()*.6),i.tz=-150+Math.random()*400}function o(i){const{w:r,h:g}=v.current,l={x:Math.random()*r,y:g*(.15+Math.random()*.6),z:-100+Math.random()*300,vx:(Math.random()<.5?-1:1)*1.5,vy:0,vz:0,flap:Math.random()*Math.PI*2,flapSpeed:.09+Math.random()*.05,bank:0,color:i,tx:0,ty:0,tz:0,perch:null,rest:null,restLeft:0};return P(l),l}function n(i,r,g,l,h){const f=u.current,b=l/16.67;k.current+=l*.001;const m=k.current;h.overlay||(i.fillStyle=f.backgroundColor,i.fillRect(0,0,r,g));const w=f.count>0?Math.max(1,Math.ceil(f.count*h.quality)):0,B=s.current;for(;B.length<w;)B.push(o(B.length));B.length>w&&(B.length=w);const F=zo(e.current,y.current),X=h.solids,O=new Map(X.map(A=>[A.id,A])),_=r/2,H=g/2;for(const A of B){if(A.rest){A.restLeft-=l,(A.restLeft<=0||!Qe(A,A.rest,O))&&(A.rest=null,A.vy=-2,A.vx=(Math.random()<.5?-1:1)*1.2,P(A)),A.flap=1.25;continue}let T=A.tx,E=A.ty,x=A.tz;if(A.perch){const S=O.get(A.perch.solidId);if(!S)A.perch=null;else if(T=S.x+A.perch.offsetX,E=S.y-6,x=0,Math.hypot(T-A.x,E-A.y,A.z)<6){A.x=T,A.y=E,A.z=0,A.vx=A.vy=A.vz=0,A.rest=Je(A,S,-6),A.restLeft=3e3+Math.random()*4e3,A.perch=null;continue}}else if(f.interactive&&F.inside){const S=m*.6+A.color*1.7;T=F.x+Math.cos(S)*110,E=F.y+Math.sin(S)*50,x=Math.sin(S*.7)*120}else Math.hypot(A.tx-A.x,A.ty-A.y)<60&&P(A);if(!A.perch&&X.length&&Math.random()<.0012*b){const S=X[Math.random()*X.length|0];S.w>30&&S.y>20&&S.y<g&&(A.perch={solidId:S.id,offsetX:12+Math.random()*(S.w-24)})}let I=(T-A.x)*9e-4,M=(E-A.y)*9e-4,p=(x-A.z)*6e-4;for(const S of B){if(S===A||S.rest)continue;const N=A.x-S.x,z=A.y-S.y,L=A.z-S.z,G=N*N+z*z+L*L;G<2500&&G>0&&(I+=N/G*.6,M+=z/G*.6,p+=L/G*.6)}const R=Math.atan2(A.vz,A.vx);A.vx+=I*b,A.vy+=M*b,A.vz+=p*b;const c=Math.hypot(A.vx,A.vy,A.vz)||1,d=(A.perch?1.4:1.9)*f.speed,$=c+(d-c)*.05;A.vx=A.vx/c*$,A.vy=A.vy/c*$,A.vz=A.vz/c*$,A.x+=A.vx*b,A.y+=A.vy*b,A.z+=A.vz*b,A.z=Math.max(-300,Math.min(500,A.z));const C=Math.atan2(Math.sin(Math.atan2(A.vz,A.vx)-R),Math.cos(Math.atan2(A.vz,A.vx)-R));A.bank+=(Math.max(-.7,Math.min(.7,C*12))-A.bank)*.08*b,A.flap+=A.flapSpeed*f.speed*(A.vy>.6?.35:1+Math.max(0,-A.vy)*.3)*b*2}const D=[],W=f.size*1.15;for(const A of B){let T=A.vx,E=A.vy,x=A.vz;A.rest&&(T=1,E=0,x=.3);const I=Math.hypot(T,E,x)||1;T/=I,E/=I,x/=I;let M=x,p=0,R=-T;const c=Math.hypot(M,R)||1;M/=c,R/=c;let d=p*x-R*E,$=R*T-M*x,C=M*E-p*T;const S=A.bank+T0,N=Math.cos(S),z=Math.sin(S),L=M*N+d*z,G=p*N+$*z,q=R*N+C*z;d=d*N-M*z,$=$*N-p*z,C=C*N-R*z,M=L,p=G,R=q;const j=A.rest?1.25:Math.sin(A.flap)*.75,V=Fo([f.colors[A.color%f.colors.length]??"#ffffff"],0);for(const K of $0(j)){const to=[];let lo=0;const ao=[];for(const[so,J,oo]of K){const Z=A.x+(T*so+d*J+M*oo)*W,no=A.y+(E*so+$*J+p*oo)*W,U=A.z+(x*so+C*J+R*oo)*W;ao.push([Z,-no,U]);const eo=Cn/(Cn+U);to.push(_+(Z-_)*eo,H+(no-H)*eo),lo+=U}const ro=I0(ao[0],ao[1],ao[2]),Q=Math.max(.55,Math.min(1,1-A.z/1400));D.push({pts:to,z:lo/3,fill:`rgb(${V[0]*ro*Q|0},${V[1]*ro*Q|0},${V[2]*ro*Q|0})`})}}D.sort((A,T)=>T.z-A.z),i.lineJoin="round",i.lineWidth=.5;for(const A of D)i.beginPath(),i.moveTo(A.pts[0],A.pts[1]),i.lineTo(A.pts[2],A.pts[3]),i.lineTo(A.pts[4],A.pts[5]),i.closePath(),i.fillStyle=A.fill,i.strokeStyle=A.fill,i.fill(),i.stroke()}const a=To({overlay:t.overlay,collide:t.collide,onResize:(i,r)=>{v.current={w:i,h:r},s.current=Array.from({length:u.current.count},(g,l)=>o(l))},onFrame:n});return y.current=a.canvas,a}const E0={default:{colors:["#ef4444","#f59e0b","#10b981","#3b82f6","#8b5cf6","#ec4899"],backgroundColor:"#0f0f14"},monochrome:{},senbazuru:{colors:["#ef4444","#f59e0b","#10b981","#3b82f6","#8b5cf6","#ec4899"],backgroundColor:"#0f0f14"},washi:{colors:["#f5e6c8","#e8c39e","#c97b63","#7a9e7e"],backgroundColor:"#1b1814"},"white-paper":{colors:["#ffffff","#f1f5f9"],backgroundColor:"#0b1220"},gold:{colors:["#f5c96a","#e0a94a","#fff1c1"],backgroundColor:"#0e0b06"}},Dr=Y.forwardRef((t,u)=>{const{preset:s,count:v,colors:k,backgroundColor:e,size:y,speed:P,interactive:o,overlay:n,collide:a,zIndex:i,width:r,height:g,className:l,style:h}=t,f=E0[s??"default"]||{},{canvasRef:b,canvas:m}=A0({count:Math.max(0,Math.round(v??14)),colors:k??f.colors??["#ffffff","#d1d5db","#9ca3af"],backgroundColor:e??f.backgroundColor??"#111111",size:y??1.6,speed:P??1,interactive:o??!0,overlay:n??!1,collide:a??!1});return Y.useImperativeHandle(u,()=>m,[m]),Mo.jsx(Io,{canvasRef:b,overlay:n,zIndex:i,width:r,height:g,className:l,style:h})});Dr.displayName="OrigamiCranes";const ct=8;function z0(t){let u=t>>>0;return()=>(u=u*1664525+1013904223>>>0,u/4294967296)}function L0(t,u){const s=z0(t),v=[],k=[],e=(y,P,o,n,a)=>{const i=v.length;if(v.push({parent:y,rel:P,len:o,width:n,depth:a,phase:s()*Math.PI*2}),a>=ct-4){const g=a>=ct-1?5:a>=ct-3?3:2;for(let l=0;l<g;l++)k.push({branch:i,along:.3+s()*.7,side:s()<.5?-1:1,size:.75+s()*.5,thr:s(),jitter:s()*6|0,attached:!0})}if(a>=ct)return;const r=a<2?2:s()<.35?3:2;for(let g=0;g<r;g++){const l=.22+s()*.24,h=r===2?g===0?-l:l:(g-1)*l*1.1;e(i,h+(s()-.5)*.15,o*(.68+s()*.14),n*.68,a+1)}};return e(-1,0,u,Math.max(4,u*.09),0),{branches:v,leaves:k}}function F0(t){const u=(t%4+4)%4;return u<1?.35+.65*u:u<2?1:u<3?1-(u-2):0}const B0={spring:.35,summer:1.5,autumn:2.45,winter:3.5};function O0(t){const u=Y.useRef(t);u.current=t;const s=Y.useRef(null),v=Y.useRef([]),k=Y.useRef(0),e=Y.useRef(.2),y=Y.useRef(0),P=Y.useRef(""),o=Eo(),n=Y.useRef(Vo()).current,a=Y.useRef(null);function i(l,h,f){const b=(h%4+4)%4,m=[l.blossomColor,l.leafColor,l.leafColor,l.autumnColor,l.autumnColor],w=Math.min(1,b/3),B=Fo(m,Math.min(.999,w+(f-2.5)*.025)),F=.82+f*.04;return`rgb(${B[0]*F|0},${B[1]*F|0},${B[2]*F|0})`}function r(l,h,f,b,m){const w=u.current,B=b/16.67;k.current+=b*.001;const F=k.current,X=`${h}|${f}|${w.treeSize}`;(P.current!==X||!s.current)&&(P.current=X,s.current=L0(7,Math.min(f*.24,h*.3)*w.treeSize));const O=s.current;w.season==="cycle"?e.current=(e.current+b*.001*4/Math.max(4,w.cycleSeconds))%4:e.current+=(B0[w.season]-e.current)*(1-Math.pow(.97,B));const _=e.current,H=F0(_),D=_>3?Math.min(1,(_-3)*3)*Math.min(1,(4-_)*4):0;m.overlay||(l.fillStyle=w.backgroundColor,l.fillRect(0,0,h,f));const W=zo(o.current,a.current),A=n(W,B);w.interactive&&W.inside&&(y.current+=A.vx*.004*B),y.current*=Math.pow(.97,B),y.current=Math.max(-1.5,Math.min(1.5,y.current));const T=w.wind*(.6+.4*Math.sin(F*.4))+y.current,E=O.branches.length,x=new Float32Array(E),I=new Float32Array(E),M=new Float32Array(E),p=new Float32Array(E),R=new Float32Array(E),c=h*w.treeX;for(let j=0;j<E;j++){const V=O.branches[j],K=.012*Math.pow(V.depth+1,1.35),to=(T*.6+Math.sin(F*(1.1+V.depth*.25)+V.phase)*(.25+Math.abs(T)*.35))*K,lo=V.parent<0?-Math.PI/2:R[V.parent];R[j]=lo+V.rel+to,x[j]=V.parent<0?c:M[V.parent],I[j]=V.parent<0?f+2:p[V.parent],M[j]=x[j]+Math.cos(R[j])*V.len,p[j]=I[j]+Math.sin(R[j])*V.len}const d=new Map;for(let j=0;j<E;j++){const V=Math.max(.6,Math.round(O.branches[j].width*2)/2);let K=d.get(V);K||d.set(V,K=new Path2D),K.moveTo(x[j],I[j]),K.lineTo(M[j],p[j])}l.strokeStyle=w.trunkColor,l.lineCap="round";for(const[j,V]of d)l.lineWidth=j,l.stroke(V);if(D>.02){l.strokeStyle=`rgba(255,255,255,${.85*D})`,l.lineWidth=1.6,l.beginPath();for(let j=0;j<E;j++){if(O.branches[j].width<1.2)continue;const V=Math.sin(R[j])*-O.branches[j].width*.45,K=-Math.abs(Math.cos(R[j]))*O.branches[j].width*.45;l.moveTo(x[j]+V,I[j]+K),l.lineTo(M[j]+V,p[j]+K)}l.stroke()}const $=Array.from({length:6},(j,V)=>i(w,_,V)),C=$.map(()=>new Path2D),S=Math.max(2.5,Math.min(h,f)*.008)*w.treeSize,N=v.current,z=_>=2&&_<3;for(const j of O.leaves){const V=H>j.thr,K=j.branch,to=x[K]+(M[K]-x[K])*j.along,lo=I[K]+(p[K]-I[K])*j.along,ao=R[K]+j.side*.9+Math.sin(F*2.2+j.thr*20)*.15;if(j.attached&&!V?(j.attached=!1,(z||_<1)&&N.length<400*m.quality&&N.push({x:to,y:lo,vx:T*.5,vy:.2,angle:ao,spin:(Math.random()-.5)*.1,size:j.size*S,color:$[j.jitter],life:0,rest:null,landed:!1,phase:Math.random()*6})):!j.attached&&V&&(j.attached=!0),!j.attached)continue;const ro=j.size*S*(_<1?.55+.45*_:1),Q=to+Math.cos(ao)*ro*.8,so=lo+Math.sin(ao)*ro*.8;C[j.jitter].moveTo(Q+Math.cos(ao)*ro,so+Math.sin(ao)*ro),C[j.jitter].ellipse(Q,so,ro,ro*.55,ao,0,Math.PI*2)}for(let j=0;j<6;j++)l.fillStyle=$[j],l.fill(C[j]);const L=m.solids,G=new Map(L.map(j=>[j.id,j]));let q=0;for(const j of N){if(j.landed)j.life+=b,j.rest&&!Qe(j,j.rest,G)&&(j.rest=null,j.landed=!1,j.vy=.3);else{const K=j.x,to=j.y,lo=1-Math.pow(.97,B);if(j.vx+=(T*.9+Math.sin(F*1.6+j.phase)*.8-j.vx)*lo,j.vy+=(.7+Math.sin(F*2.3+j.phase)*.35-j.vy)*lo,j.x+=j.vx*B,j.y+=j.vy*B,j.angle+=j.spin*B+j.vx*.01*B,L.length){const ao=Wt(j,K,to,L,0);ao&&(j.rest=Je(j,ao,-1),j.landed=!0)}!j.landed&&j.y>f-2&&(j.y=f-2,j.landed=!0)}const V=j.landed?Math.max(0,1-j.life/6e3):1;V<=0||j.x<-40||j.x>h+40||(N[q++]=j,l.globalAlpha=V,l.fillStyle=j.color,l.beginPath(),l.ellipse(j.x,j.y,j.size,j.size*.5*Math.abs(Math.cos(j.angle*2))+.6,j.angle,0,Math.PI*2),l.fill())}N.length=q,l.globalAlpha=1}const g=To({overlay:t.overlay,collide:t.collide,onResize:()=>{P.current=""},onFrame:r});return a.current=g.canvas,g}const W0={default:{trunkColor:"#4a362a",leafColor:"#5b8c3e",blossomColor:"#ffb7c5",autumnColor:"#d9622b",backgroundColor:"#0e0c0a"},monochrome:{},japanese:{trunkColor:"#4a362a",leafColor:"#5b8c3e",blossomColor:"#ffb7c5",autumnColor:"#d9622b",backgroundColor:"#0e0c0a"},maple:{trunkColor:"#4a3020",leafColor:"#3f7d3a",blossomColor:"#fde68a",autumnColor:"#c2410c",backgroundColor:"#120a06"},moonlight:{trunkColor:"#64748b",leafColor:"#94a3b8",blossomColor:"#e2e8f0",autumnColor:"#cbd5e1",backgroundColor:"#050810"},ink:{trunkColor:"#1f2937",leafColor:"#374151",blossomColor:"#9ca3af",autumnColor:"#4b5563",backgroundColor:"#f5f1e8"}},Nr=Y.forwardRef((t,u)=>{const{preset:s,season:v,cycleSeconds:k,trunkColor:e,leafColor:y,blossomColor:P,autumnColor:o,backgroundColor:n,treeX:a,treeSize:i,wind:r,interactive:g,overlay:l,collide:h,zIndex:f,width:b,height:m,className:w,style:B}=t,F=W0[s??"default"]||{},{canvasRef:X,canvas:O}=O0({season:v??"cycle",cycleSeconds:k??48,trunkColor:e??F.trunkColor??"#6b7280",leafColor:y??F.leafColor??"#d1d5db",blossomColor:P??F.blossomColor??"#ffffff",autumnColor:o??F.autumnColor??"#9ca3af",backgroundColor:n??F.backgroundColor??"#111111",treeX:a??.5,treeSize:i??1,wind:r??.6,interactive:g??!0,overlay:l??!1,collide:h??!1});return Y.useImperativeHandle(u,()=>O,[O]),Mo.jsx(Io,{canvasRef:X,overlay:l,zIndex:f,width:b,height:m,className:w,style:B})});Nr.displayName="SeasonsTree";function ft(t,u){const s=yt(t*u.freq,5,u.seed),v=Math.pow(Math.min(1,Math.max(0,(s-.2)/.6)),1.6);return u.base-u.amp*v}function q0(t,u){const s=Math.max(1,u);return Array.from({length:s},(v,k)=>{const e=s===1?1:k/(s-1);return{base:t*(.5+.42*e),amp:t*(.3-.1*e),freq:.0032+.0035*e,seed:11+k*7,depth:e}})}const Le=t=>`rgb(${t[0]|0},${t[1]|0},${t[2]|0})`;function G0(t){const u=Y.useRef(t);u.current=t;const s=Y.useRef(0),v=Y.useRef({x:0,px:0}),k=Y.useRef({color:"",img:null}),e=Eo(),y=Y.useRef(null);function P(n,a,i,r,g){const l=u.current,h=r/16.67;s.current+=r*.001;const f=s.current;g.overlay||(n.fillStyle=l.paperColor,n.fillRect(0,0,a,i));const b=zo(e.current,y.current),m=v.current;m.x+=l.drift*.35*h;const w=l.parallax&&b.inside?(b.x/a-.5)*2:0;m.px+=(w-m.px)*(1-Math.pow(.95,h));const B=q0(i,l.layers),F=Fo([l.paperColor],0),X=Fo([l.inkColor],0),O=W=>{const A=(.18+.82*Math.pow(W,1.25))*.92;return[F[0]+(X[0]-F[0])*A,F[1]+(X[1]-F[1])*A,F[2]+(X[2]-F[2])*A]},_=Math.min(a,i)*.075;n.fillStyle=ko(l.sunColor,.85),n.beginPath(),n.arc(a*.72-m.px*6,i*.24,_,0,Math.PI*2),n.fill(),k.current.color!==l.paperColor&&(k.current={color:l.paperColor,img:Yo(l.paperColor,64)});const H=k.current.img,D=Math.max(3,Math.round(a/260));for(let W=0;W<B.length;W++){const A=B[W],T=m.x*(.15+.85*A.depth)+m.px*40*A.depth,E=O(A.depth),x=A.base-A.amp,I=n.createLinearGradient(0,x,0,A.base+i*.06);I.addColorStop(0,Le(E)),I.addColorStop(.5,Le(E.map((M,p)=>M+(F[p]-M)*.25))),I.addColorStop(1,Le(F)),n.fillStyle=I,n.beginPath(),n.moveTo(0,i);for(let M=0;M<=a+D;M+=D)n.lineTo(M,ft(M+T,A));n.lineTo(a,i),n.closePath(),n.fill(),n.strokeStyle=Le(E),n.lineWidth=.8+A.depth*1.2,n.globalAlpha=.55,n.beginPath();for(let M=0;M<=a+D;M+=D){const p=ft(M+T,A);M===0?n.moveTo(M,p):n.lineTo(M,p)}if(n.stroke(),A.depth>.3){n.lineWidth=.7,n.globalAlpha=.35*A.depth,n.beginPath();const M=9,p=Math.floor(T/M)*M;for(let R=p;R<T+a;R+=M){const c=Go(R*.37,A.seed);if(c<.45)continue;const d=R-T,$=ft(R,A),C=6+c*18*A.depth;n.moveTo(d,$+2),n.quadraticCurveTo(d-2,$+C*.5,d-4+c*3,$+C)}n.stroke()}if(n.globalAlpha=1,l.pines&&A.depth>.6){n.fillStyle=Le(E);const M=26,p=Math.floor(T/M)*M;for(let R=p;R<T+a+M;R+=M){const c=Go(R*.11,A.seed+3);if(c<.62)continue;const d=R-T,$=ft(R,A),C=(10+c*22)*(.6+A.depth*.6);n.beginPath();for(let S=0;S<4;S++){const N=$-C*(S/4),z=C*.28*(1-S/5);n.moveTo(d-z,N),n.lineTo(d,N-C*.32),n.lineTo(d+z,N)}n.fill(),n.fillRect(d-.6,$-C*.2,1.2,C*.25)}}if(H&&l.mist>0){for(let M=0;M<6;M++){const p=a*(.35+.25*Go(M*3.1,A.seed)),R=.12+.2*A.depth,c=(M/6*(a+p)+f*12*R+T*.3)%(a+p)-p/2,d=A.base-A.amp*.15+Math.sin(f*.2+M)*6;n.globalAlpha=Math.min(1,.55*l.mist),n.drawImage(H,c-p/2,d-i*.05,p,i*.12)}n.globalAlpha=1}if(W===1&&l.birds>0){n.strokeStyle=Le(O(.85)),n.lineWidth=1.1,n.beginPath();for(let M=0;M<l.birds;M++){const p=(M*137.5+f*(14+M*1.5))%(a+80)-40,R=i*(.18+.12*Go(M*5.3+f*.05,99)),c=4+M%3,d=Math.sin(f*6+M)*c*.5;n.moveTo(p-c,R-d),n.quadraticCurveTo(p-c*.4,R-c*.3,p,R),n.quadraticCurveTo(p+c*.4,R-c*.3,p+c,R-d)}n.stroke()}}}const o=To({overlay:t.overlay,onFrame:P});return y.current=o.canvas,o}const D0={default:{paperColor:"#efe8d8",inkColor:"#141414",sunColor:"#b91c1c"},monochrome:{},sumi:{paperColor:"#efe8d8",inkColor:"#141414",sunColor:"#b91c1c"},night:{paperColor:"#0d1117",inkColor:"#e5e7eb",sunColor:"#f8fafc"},jade:{paperColor:"#e6efe9",inkColor:"#0f3d2e",sunColor:"#c2410c"},dusk:{paperColor:"#f3e3d3",inkColor:"#3b1d2e",sunColor:"#e11d48"}},jr=Y.forwardRef((t,u)=>{const{preset:s,paperColor:v,inkColor:k,sunColor:e,layers:y,mist:P,drift:o,birds:n,pines:a,parallax:i,overlay:r,zIndex:g,width:l,height:h,className:f,style:b}=t,m=D0[s??"default"]||{},{canvasRef:w,canvas:B}=G0({paperColor:v??m.paperColor??"#f2efe6",inkColor:k??m.inkColor??"#111111",sunColor:e??m.sunColor??"#6b7280",layers:Math.max(1,Math.min(9,Math.round(y??5))),mist:P??1,drift:o??1,birds:Math.max(0,Math.round(n??5)),pines:a??!0,parallax:i??!0,overlay:r??!1});return Y.useImperativeHandle(u,()=>B,[B]),Mo.jsx(Io,{canvasRef:w,overlay:r,zIndex:g,width:l,height:h,className:f,style:b})});jr.displayName="InkMountains";const gt=4.5;function N0(t,u){const s=Math.cbrt(t.r**3+u.r**3);return{...t.y>u.y?t:u,r:s,vy:Math.max(t.vy,u.vy),pinned:0}}function j0(t,u,s){if(t.r<gt)return 0;if(t.pinned>0)return t.pinned-=s,0;const v=(t.r-gt+.6)*.9;t.vy+=(v-t.vy)*(1-Math.pow(.9,u)),Math.random()<.012*u*(gt*2/t.r)&&(t.pinned=80+Math.random()*400);const k=t.vy*u;return t.y+=k,t.x+=Math.sin(t.y*.05+t.seed)*.25*u,k}function X0(t){const u=Y.useRef(t);u.current=t;const s=Y.useRef(null),v=Eo(),k=Y.useRef(null);function e(a,i,r){var f;if(typeof document>"u")return null;const g=u.current,l=document.createElement("canvas");l.width=Math.round(a*r),l.height=Math.round(i*r);const h=l.getContext("2d");if(!h)return l;if((f=h.setTransform)==null||f.call(h,r,0,0,r,0,0),h.fillStyle=g.backgroundColor,h.fillRect(0,0,a,i),typeof h.createRadialGradient=="function")for(let b=0;b<g.lights;b++){const m=Math.random()*a,w=i*(.25+Math.random()*.75),B=14+Math.random()*46,F=g.lightColors[b%Math.max(1,g.lightColors.length)]??"#ffffff",X=.2+Math.random()*.4,O=h.createRadialGradient(m,w,0,m,w,B);O.addColorStop(0,ko(F,X)),O.addColorStop(.6,ko(F,X*.7)),O.addColorStop(1,ko(F,0)),h.fillStyle=O,h.beginPath(),h.arc(m,w,B,0,Math.PI*2),h.fill()}return l}function y(a,i){var b,m;const r=u.current,g=k.current&&a>0?k.current.width/a:1,l=Math.max(1,Math.ceil(a/8)),h=Math.max(1,Math.ceil(i/8)),f=typeof document<"u"?document.createElement("canvas"):null;f&&(f.width=l,f.height=h),s.current={bg:e(a,i,g),dpr:g,drops:[],droplets:Array.from({length:Math.round(a*i/900)},()=>({x:Math.random()*a,y:Math.random()*i,r:.6+Math.random()*1.6})),fog:new Float32Array(l*h).fill(1),fogW:l,fogH:h,fogImg:((m=(b=f==null?void 0:f.getContext("2d"))==null?void 0:b.createImageData)==null?void 0:m.call(b,l,h))??null,fogCanvas:f,key:`${r.backgroundColor}|${r.lights}|${r.lightColors.join(",")}`}}function P(a,i,r,g,l=0){const h=i/8,f=r/8,b=g/8;for(let m=Math.max(0,Math.floor(f-b));m<=Math.min(a.fogH-1,Math.ceil(f+b));m++)for(let w=Math.max(0,Math.floor(h-b));w<=Math.min(a.fogW-1,Math.ceil(h+b));w++){const B=Math.hypot(w-h,m-f)/Math.max(b,.5);if(B<1){const F=m*a.fogW+w;a.fog[F]=Math.min(a.fog[F],l+(1-l)*B*B)}}}function o(a,i,r,g,l){var _;const h=u.current,f=g/16.67;s.current||y(i,r);let b=s.current;b.key!==`${h.backgroundColor}|${h.lights}|${h.lightColors.join(",")}`&&(y(i,r),b=s.current),b.bg&&!l.overlay&&a.drawImage(b.bg,0,0,i,r);const m=h.rain*.9*f*l.quality;for(let H=0;H<Math.floor(m)+(Math.random()<m%1?1:0);H++)Math.random()<.22?b.drops.push({x:Math.random()*i,y:Math.random()*r*.9,r:(1.8+Math.random()*3.6)*h.dropSize,vy:0,pinned:0,traveled:0,seed:Math.random()*10}):b.droplets.length<i*r/500&&b.droplets.push({x:Math.random()*i,y:Math.random()*r,r:.6+Math.random()*1.6});const w=Math.ceil(90*l.quality);b.drops.length>w&&b.drops.splice(0,b.drops.length-w);for(const H of b.drops){const D=j0(H,f,g);if(D>0){H.traveled+=D,P(b,H.x,H.y,H.r*1.3,.05),H.traveled>7&&(H.traveled=0,Math.random()<.7&&b.droplets.push({x:H.x+(Math.random()-.5)*H.r,y:H.y-H.r*1.5,r:.8+Math.random()*H.r*.25}),H.r=Math.max(gt*.92,H.r-.03));for(let W=b.droplets.length-1;W>=0;W--){const A=b.droplets[W];Math.abs(A.x-H.x)<H.r&&A.y>H.y-H.r&&A.y<H.y+H.r*1.2&&(H.r=Math.cbrt(H.r**3+A.r**3),b.droplets[W]=b.droplets[b.droplets.length-1],b.droplets.pop())}}}b.drops.sort((H,D)=>H.x-D.x);for(let H=0;H<b.drops.length;H++){const D=b.drops[H];if(!(D.r<=0))for(let W=H+1;W<b.drops.length&&b.drops[W].x-D.x<14;W++){const A=b.drops[W];if(!(A.r<=0)&&Math.hypot(D.x-A.x,D.y-A.y)<(D.r+A.r)*.8){const T=N0(D,A);Object.assign(D,T),A.r=0}}}b.drops=b.drops.filter(H=>H.r>0&&H.y<r+20);const B=zo(v.current,k.current);if(h.interactive&&B.inside&&(P(b,B.x,B.y,26*1.6),b.droplets=b.droplets.filter(D=>Math.hypot(D.x-B.x,D.y-B.y)>26),b.drops=b.drops.filter(D=>Math.hypot(D.x-B.x,D.y-B.y)>26+D.r)),h.fog>0&&b.fogImg&&b.fogCanvas){const H=1-Math.pow(.9975,f),[D,W,A]=Fo([h.fogColor],0),T=b.fogImg.data;for(let E=0;E<b.fog.length;E++){b.fog[E]+=(1-b.fog[E])*H;const x=E*4;T[x]=D,T[x+1]=W,T[x+2]=A,T[x+3]=b.fog[E]*h.fog*255}(_=b.fogCanvas.getContext("2d"))==null||_.putImageData(b.fogImg,0,0),a.imageSmoothingEnabled=!0,a.drawImage(b.fogCanvas,0,0,i,r)}const F=new Path2D,X=new Path2D;for(const H of b.droplets)F.moveTo(H.x+H.r,H.y),F.arc(H.x,H.y,H.r,0,Math.PI*2),X.moveTo(H.x-H.r*.3+.5,H.y-H.r*.35),X.arc(H.x-H.r*.3,H.y-H.r*.35,.5,0,Math.PI*2);a.fillStyle="rgba(0,0,0,0.22)",a.fill(F),a.fillStyle="rgba(255,255,255,0.45)",a.fill(X);const O=b.dpr;for(const H of b.drops){const D=H.r,W=H.r*(H.vy>.3?1.18:1);if(b.bg){a.save(),a.beginPath(),a.ellipse(H.x,H.y,D,W,0,0,Math.PI*2),a.clip();const A=H.r*5,T=Math.max(0,(H.x-A)*O),E=Math.max(0,(H.y-A)*O);a.translate(H.x,H.y),a.scale(1,-1),a.drawImage(b.bg,T,E,A*2*O,A*2*O,-D,-W,D*2,W*2),a.restore()}a.strokeStyle="rgba(0,0,0,0.35)",a.lineWidth=.8,a.beginPath(),a.ellipse(H.x,H.y,D,W,0,0,Math.PI*2),a.stroke(),a.fillStyle="rgba(255,255,255,0.55)",a.beginPath(),a.ellipse(H.x-D*.35,H.y-W*.45,D*.22,W*.14,-.5,0,Math.PI*2),a.fill()}}const n=To({overlay:t.overlay,onResize:()=>{s.current=null},onFrame:o});return k.current=n.canvas,n}const H0={default:{lightColors:["#fbbf24","#f97316","#ef4444","#38bdf8","#a78bfa","#fde68a"],backgroundColor:"#07090f",fogColor:"#94a3b8"},monochrome:{},"city-night":{lightColors:["#fbbf24","#f97316","#ef4444","#38bdf8","#a78bfa","#fde68a"],backgroundColor:"#07090f",fogColor:"#94a3b8"},neon:{lightColors:["#f0abfc","#22d3ee","#f472b6","#a78bfa","#34d399"],backgroundColor:"#05030a",fogColor:"#a78bfa"},cafe:{lightColors:["#fcd34d","#fb923c","#fde68a"],backgroundColor:"#120b06",fogColor:"#d6b98c",fog:.3},storm:{lightColors:["#e2e8f0","#94a3b8","#64748b"],backgroundColor:"#0b0f14",fogColor:"#cbd5e1",fog:.35}},Xr=Y.forwardRef((t,u)=>{const{preset:s,lightColors:v,backgroundColor:k,fogColor:e,rain:y,dropSize:P,fog:o,lights:n,interactive:a,overlay:i,zIndex:r,width:g,height:l,className:h,style:f}=t,b=H0[s??"default"]||{},{canvasRef:m,canvas:w}=X0({lightColors:v??b.lightColors??["#ffffff","#9ca3af","#6b7280"],backgroundColor:k??b.backgroundColor??"#111111",fogColor:e??b.fogColor??"#9ca3af",rain:y??1,dropSize:P??1,fog:o??b.fog??.25,lights:Math.max(0,Math.round(n??34)),interactive:a??!0,overlay:i??!1});return Y.useImperativeHandle(u,()=>w,[w]),Mo.jsx(Io,{canvasRef:m,overlay:i,zIndex:r,width:g,height:l,className:h,style:f})});Xr.displayName="WindowRain";function Y0(t,u,s){const P=.011*t+s*.4,o=.017*u-s*.55,n=.023*t-s*.3+1.3,a=.009*u+s*.35,i=-.017*Math.sin(P)*Math.sin(o)+.6*.009*Math.sin(n)*Math.cos(a),r=-(.011*Math.cos(P)*Math.cos(o)+.6*.023*Math.cos(n)*Math.sin(a));return[i*85,r*85]}const vn=(t,u,s)=>{const v=Math.max(0,Math.min(1,(s-t)/(u-t)));return v*v*(3-2*v)},wn=7e3,_0=45;function V0(t){const u=Y.useRef(t);u.current=t;const s=Y.useRef([]),v=Y.useRef(0),k=Y.useRef(-1),e=Y.useRef({color:"",img:null}),y=Eo(),P=Y.useRef(Vo()).current,o=Y.useRef(null);function n(r,g,l,h){const f=g===1?l*.5:l*(.3+.4*r/(g-1)),b=Math.min(h*.32,220);return{x:f,y:h-b,base:h}}function a(r,g,l,h,f){const b=u.current,m=h/16.67;v.current+=h*.001;const w=v.current;if(k.current!==b.sticks){k.current=b.sticks,s.current=[];for(let A=0;A<b.sticks;A++)for(const T of[-1.5,0,1.6])s.current.push({stick:A,offset:T,puffs:[],acc:0})}f.overlay||(r.fillStyle=b.backgroundColor,r.fillRect(0,0,g,l));const B=zo(y.current,o.current),F=P(B,m),X=b.interactive&&B.inside,O=110,_=1-Math.pow(.92,m);for(const A of s.current){const T=n(A.stick,b.sticks,g,l);for(A.acc+=h*.001*_0*(.5+.5*f.quality);A.acc>=1;)A.acc-=1,A.puffs.push({x:T.x+A.offset,y:T.y-2,vx:0,vy:-.6,age:0});let E=0;for(const x of A.puffs){x.age+=h;const I=T.y-x.y,M=b.turbulence*(.06+1.3*vn(15,Math.max(80,T.y*.5),I)),[p,R]=Y0(x.x+A.stick*300+A.offset*90,x.y,w),c=p*M,d=-b.rise*(.5+.25*vn(0,120,I))+R*M*.6;if(x.vx+=(c-x.vx)*_,x.vy+=(d-x.vy)*_,X){const $=x.x-B.x,C=x.y-B.y,S=Math.hypot($,C);if(S<O){const N=(1-S/O)**2;x.vx+=(F.vx*.12-C/(S||1)*Math.abs(F.vx+F.vy)*.04)*N*m,x.vy+=(F.vy*.12+$/(S||1)*Math.abs(F.vx+F.vy)*.04)*N*m}}x.x+=x.vx*m,x.y+=x.vy*m,!(x.age>wn||x.y<-30)&&(A.puffs[E++]=x)}A.puffs.length=E}const H=6,D=r.lineJoin;r.lineJoin="round",r.lineCap="round";for(const A of s.current){const T=Array.from({length:H},()=>new Path2D),E=A.puffs;for(let x=1;x<E.length;x++){const I=E[x-1],M=E[x];if(Math.abs(I.x-M.x)+Math.abs(I.y-M.y)>60)continue;const p=Math.min(H-1,Math.floor(M.age/wn*H));T[p].moveTo(I.x,I.y),T[p].lineTo(M.x,M.y)}for(let x=0;x<H;x++){const I=(x+.5)/H;r.strokeStyle=ko(b.color,(.42*(1-I)**1.6+.02)*(A.offset===0?1:.6)),r.lineWidth=(.7+I*9)*b.thickness*(A.offset===0?1:.7),r.stroke(T[x])}}r.lineJoin=D,e.current.color!==b.emberColor&&(e.current={color:b.emberColor,img:Yo(b.emberColor,48)});const W=e.current.img;for(let A=0;A<b.sticks;A++){const T=n(A,b.sticks,g,l);r.strokeStyle=b.stickColor,r.lineWidth=2,r.beginPath(),r.moveTo(T.x,T.base),r.lineTo(T.x,T.y),r.stroke();const E=.75+.15*Math.sin(w*9+A)+.1*Math.sin(w*23+A*2);if(W){const x=r.globalCompositeOperation;r.globalCompositeOperation="lighter",r.globalAlpha=E,r.drawImage(W,T.x-12,T.y-12,24,24),r.globalAlpha=1,r.globalCompositeOperation=x}r.fillStyle=b.emberColor,r.fillRect(T.x-1.2,T.y-1,2.4,3)}}const i=To({overlay:t.overlay,onFrame:a});return o.current=i.canvas,i}const U0={default:{color:"#e7e5e4",emberColor:"#ff6a2b",stickColor:"#5b4636",backgroundColor:"#0c0a09"},monochrome:{},temple:{color:"#e7e5e4",emberColor:"#ff6a2b",stickColor:"#5b4636",backgroundColor:"#0c0a09"},sandalwood:{color:"#f5e6d3",emberColor:"#ffb15c",stickColor:"#7a5230",backgroundColor:"#140d08"},moonlight:{color:"#cbd5e1",emberColor:"#fde68a",stickColor:"#475569",backgroundColor:"#05070d"},noir:{color:"#ffffff",emberColor:"#ffffff",stickColor:"#3f3f46",backgroundColor:"#000000"}},Hr=Y.forwardRef((t,u)=>{const{preset:s,sticks:v,color:k,emberColor:e,stickColor:y,backgroundColor:P,turbulence:o,rise:n,thickness:a,interactive:i,overlay:r,zIndex:g,width:l,height:h,className:f,style:b}=t,m=U0[s??"default"]||{},{canvasRef:w,canvas:B}=V0({sticks:Math.max(1,Math.min(5,Math.round(v??1))),color:k??m.color??"#ffffff",emberColor:e??m.emberColor??"#ffffff",stickColor:y??m.stickColor??"#6b7280",backgroundColor:P??m.backgroundColor??"#111111",turbulence:o??1,rise:n??1,thickness:a??1,interactive:i??!0,overlay:r??!1});return Y.useImperativeHandle(u,()=>B,[B]),Mo.jsx(Io,{canvasRef:w,overlay:r,zIndex:g,width:l,height:h,className:f,style:b})});Hr.displayName="IncenseSmoke";const pt=72,Yr=t=>Math.pow(t/(pt-1),1.9),It=t=>1/(Yr(t)*.97+.03);function K0(t,u,s){return Math.sin(t*.9+u*1.3-s*1.1)+.5*Math.sin(t*2.1-u*.7-s*1.7+1.3)+.25*Math.sin(t*4.3+u*2.9-s*2.6+.4)}function J0(t,u,s){const v=(t-u)/.07;return Math.exp(-v*v)*Math.max(0,1-s*s)}function Q0(t){const u=Y.useRef(t);u.current=t;const s=Y.useRef(0),v=Y.useRef([]),k=Y.useRef(0),e=Y.useRef([]),y=Y.useRef({color:"",img:null}),P=Eo(),o=Y.useRef(null);function n(i,r,g,l,h){const f=u.current;s.current+=l*.001*f.speed;const b=s.current,m=g*f.horizon,w=r/2,B=r*f.moonX,F=Fo([f.skyColor],0),X=Fo([f.seaColor],0),O=Fo([f.moonColor],0),_=R=>`rgb(${R[0]|0},${R[1]|0},${R[2]|0})`,H=(R,c,d)=>R.map(($,C)=>$+(c[C]-$)*d);if(!h.overlay){const R=i.createLinearGradient(0,0,0,m);R.addColorStop(0,_(F)),R.addColorStop(1,_(H(F,O,.12))),i.fillStyle=R,i.fillRect(0,0,r,m+1)}e.current.length!==f.stars&&(e.current=Array.from({length:f.stars},()=>({x:Math.random(),y:Math.random()*.95,r:.3+Math.random()*.9,ph:Math.random()*6}))),i.fillStyle=f.moonColor;for(const R of e.current)i.globalAlpha=.25+.35*(.5+.5*Math.sin(b*1.5+R.ph)),i.fillRect(R.x*r,R.y*m,R.r,R.r);i.globalAlpha=1,y.current.color!==f.moonColor&&(y.current={color:f.moonColor,img:Yo(f.moonColor,96)});const D=Math.min(r,g)*.05,W=m*.42;y.current.img&&(i.globalAlpha=.35,i.drawImage(y.current.img,B-D*6,W-D*6,D*12,D*12),i.globalAlpha=1),i.fillStyle=f.moonColor,i.beginPath(),i.arc(B,W,D,0,Math.PI*2),i.fill();const A=i.createLinearGradient(0,m,0,g);A.addColorStop(0,_(H(X,O,.18))),A.addColorStop(.35,_(X)),A.addColorStop(1,_(H(X,[0,0,0],.45))),i.fillStyle=A,i.fillRect(0,m,r,g-m);const T=zo(P.current,o.current);if(f.interactive&&T.inside&&T.y>m+4&&b-k.current>.12){k.current=b;const c=Math.pow((T.y-m)/(g-m),1/1.9)*(pt-1),d=It(c);v.current.push({x:(T.x-w)*d/r,z:d,born:b}),v.current.length>10&&v.current.shift()}for(const R of T.taps){if(R.y<=m)continue;const c=It(Math.pow((R.y-m)/(g-m),1/1.9)*(pt-1));v.current.push({x:(R.x-w)*c/r,z:c,born:b-.01})}v.current=v.current.filter(R=>b-R.born<4);const E=Math.max(3,Math.round(r/280)),x=_(H(X,O,.35)),I=[],M=[];for(let R=1;R<pt;R++){const c=Yr(R),d=m+(g-m)*c,$=It(R),C=f.waveHeight*(.6+9*Math.pow(c,1.4)),S=L=>{const G=(L-w)*$/r;let q=K0(G*4,$*.35,b);for(const j of v.current){const V=b-j.born,K=Math.hypot((G-j.x)*6,($-j.z)*1.2),to=V*3.2,lo=Math.exp(-((K-to)**2)*2.2)*Math.max(0,1-V/4);q+=Math.sin((K-to)*9)*lo*1.8}return q};i.beginPath();let N=S(0);i.moveTo(0,d-N*C);const z=(.06+.32*c)*r;for(let L=E;L<=r+E;L+=E){const G=S(L);i.lineTo(L,d-G*C);const q=(G-N)/E*C,j=(L-B)/z;if(Math.abs(j)<1){const V=Math.sin(L*1.37+R*2.1+b*5.3)*Math.sin(L*.71-b*3.1+R),K=J0(q,.08*(1-c),j)*(.35+.65*c)*(V>.3?1:.15);K>.08&&(M.push(L-E*(.5+c),d-G*C-.6,E*(1+2*c),1+c*1.6),I.push(K))}N=G}i.strokeStyle=x,i.globalAlpha=.08+.2*c,i.lineWidth=.6+c,i.stroke()}i.globalAlpha=1;const p=i.globalCompositeOperation;i.globalCompositeOperation="lighter",i.fillStyle=f.moonColor;for(const[R,c,d]of[[.08,.35,.35],[.35,.7,.65],[.7,2,1]]){i.globalAlpha=d,i.beginPath();for(let $=0;$<I.length;$++)I[$]<R||I[$]>=c||i.rect(M[$*4],M[$*4+1],M[$*4+2],M[$*4+3]);i.fill()}i.globalAlpha=1,i.globalCompositeOperation=p,i.fillStyle=ko(f.moonColor,.08),i.fillRect(0,m-1,r,2)}const a=To({overlay:t.overlay,onFrame:n});return o.current=a.canvas,a}const Z0={default:{seaColor:"#0b2236",skyColor:"#030712",moonColor:"#f8fafc"},monochrome:{},midnight:{seaColor:"#0b2236",skyColor:"#030712",moonColor:"#f8fafc"},harvest:{seaColor:"#1c1410",skyColor:"#0a0604",moonColor:"#fbbf24"},arctic:{seaColor:"#0f2a33",skyColor:"#04121a",moonColor:"#e0f2fe"},rose:{seaColor:"#2a1324",skyColor:"#0d0510",moonColor:"#fecdd3"}},_r=Y.forwardRef((t,u)=>{const{preset:s,seaColor:v,skyColor:k,moonColor:e,horizon:y,moonX:P,waveHeight:o,speed:n,stars:a,interactive:i,overlay:r,zIndex:g,width:l,height:h,className:f,style:b}=t,m=Z0[s??"default"]||{},{canvasRef:w,canvas:B}=Q0({seaColor:v??m.seaColor??"#1f2937",skyColor:k??m.skyColor??"#111111",moonColor:e??m.moonColor??"#ffffff",horizon:y??.42,moonX:P??.62,waveHeight:o??1,speed:n??1,stars:Math.max(0,Math.round(a??120)),interactive:i??!0,overlay:r??!1});return Y.useImperativeHandle(u,()=>B,[B]),Mo.jsx(Io,{canvasRef:w,overlay:r,zIndex:g,width:l,height:h,className:f,style:b})});_r.displayName="MoonlitSea";function kn(t,u,s){const v=Zo(t,u,5,5);return Math.max(0,Math.min(1,(v-(1-s)*.75)*4.2))}function oi(t){const u=Y.useRef(t);u.current=t;const s=Y.useRef(0),v=Y.useRef(null),k=Y.useRef({color:"",img:null}),e=Eo(),y=Y.useRef(null);function P(a,i,r){var w,B;const g=u.current,l=Math.round(Math.max(120,Math.min(320,a/3.5))*(r<.75?.65:1)),h=Math.max(8,Math.round(l*(i*(1-g.horizon))/a)),f=v.current;if(f&&f.bw===l&&f.bh===h)return f;if(typeof document>"u")return null;const b=document.createElement("canvas");b.width=l,b.height=h;const m=(B=(w=b.getContext("2d"))==null?void 0:w.createImageData)==null?void 0:B.call(w,l,h);return m?(v.current={c:b,img:m,bw:l,bh:h,clear:new Float32Array(l*h)},v.current):null}function o(a,i,r,g,l){var I;const h=u.current,f=g/16.67;s.current+=g*.001*h.speed;const b=s.current,m=r*h.horizon,w=Fo([h.skyColor],0),B=Fo([h.sunColor],0),F=Fo([h.cloudColor],0),X=Fo([h.shadowColor],0),O=M=>`rgb(${M[0]|0},${M[1]|0},${M[2]|0})`,_=(M,p,R)=>M.map((c,d)=>c+(p[d]-c)*R),H=i*.5;if(!l.overlay){const M=a.createLinearGradient(0,0,0,m);M.addColorStop(0,O(w)),M.addColorStop(.7,O(_(w,B,.35))),M.addColorStop(1,O(_(w,B,.85))),a.fillStyle=M,a.fillRect(0,0,i,m+1)}k.current.color!==h.sunColor&&(k.current={color:h.sunColor,img:Yo(h.sunColor,128)});const D=Math.min(i,r)*.06;k.current.img&&(a.globalAlpha=.6,a.drawImage(k.current.img,H-D*7,m-D*4,D*14,D*8),a.globalAlpha=1),a.fillStyle=h.sunColor,a.beginPath(),a.arc(H,m,D,Math.PI,0),a.fill();const W=P(i,r,l.quality);if(!W)return;const A=zo(e.current,y.current);if(h.interactive&&A.inside&&A.y>m){const M=A.x/i*W.bw,p=(A.y-m)/(r-m)*W.bh,R=W.bw*.09;for(let c=Math.max(0,Math.floor(p-R));c<Math.min(W.bh,p+R);c++)for(let d=Math.max(0,Math.floor(M-R));d<Math.min(W.bw,M+R);d++){const $=Math.hypot(d-M,c-p)/R;$<1&&(W.clear[c*W.bw+d]=Math.max(W.clear[c*W.bw+d],1-$*$))}}const T=Math.pow(.985,f),E=W.img.data,x=_(X,[0,0,0],.35);for(let M=0;M<W.bh;M++){const p=(M+.5)/W.bh,R=1/(p*.96+.04),c=Math.min(1,Math.max(0,(R-2)/20));for(let d=0;d<W.bw;d++){const $=(d+.5)/W.bw-.5,C=$*R*1.6,S=R*.55+b*.12,N=M*W.bw+d;W.clear[N]*=T;const z=Math.max(0,kn(C,S,h.coverage)-W.clear[N]*.9),L=kn(C,S+.06,h.coverage),G=Math.max(0,Math.min(1,.55+(z-L)*2.5+(1-p)*.25)),q=Math.pow(G,2.2)*(.5+.5*(1-Math.abs($)*1.4));let j=_(X,F,G);j=_(j,B,q*.55);const V=z*z*(3-2*z);j=_(x,j,V),j=_(j,_(w,B,.8),c);const K=N*4;E[K]=j[0],E[K+1]=j[1],E[K+2]=j[2],E[K+3]=255}}(I=W.c.getContext("2d"))==null||I.putImageData(W.img,0,0),a.imageSmoothingEnabled=!0,a.imageSmoothingQuality="high",a.drawImage(W.c,0,m,i,r-m)}const n=To({overlay:t.overlay,onResize:()=>{v.current=null},onFrame:o});return y.current=n.canvas,n}const ei={default:{skyColor:"#1e1b4b",sunColor:"#fb923c",cloudColor:"#fde2cf",shadowColor:"#8a6f8e"},monochrome:{},sunset:{skyColor:"#1e1b4b",sunColor:"#fb923c",cloudColor:"#fde2cf",shadowColor:"#8a6f8e"},dawn:{skyColor:"#0c4a6e",sunColor:"#fde68a",cloudColor:"#fef3c7",shadowColor:"#7c8fa6"},golden:{skyColor:"#422006",sunColor:"#fbbf24",cloudColor:"#fff1c1",shadowColor:"#8a5a2b"},stormy:{skyColor:"#0f172a",sunColor:"#cbd5e1",cloudColor:"#94a3b8",shadowColor:"#1e293b",coverage:.8}},Vr=Y.forwardRef((t,u)=>{const{preset:s,skyColor:v,sunColor:k,cloudColor:e,shadowColor:y,horizon:P,coverage:o,speed:n,interactive:a,overlay:i,zIndex:r,width:g,height:l,className:h,style:f}=t,b=ei[s??"default"]||{},{canvasRef:m,canvas:w}=oi({skyColor:v??b.skyColor??"#111111",sunColor:k??b.sunColor??"#ffffff",cloudColor:e??b.cloudColor??"#d1d5db",shadowColor:y??b.shadowColor??"#4b5563",horizon:P??.36,coverage:o??b.coverage??.55,speed:n??1,interactive:a??!0,overlay:i??!1});return Y.useImperativeHandle(u,()=>w,[w]),Mo.jsx(Io,{canvasRef:m,overlay:i,zIndex:r,width:g,height:l,className:h,style:f})});Vr.displayName="CloudSea";function Sn(t,u,s){return 1/Math.pow(1+(t*t+u*u)/(s*s),1.5)}const Tt=.12;function ti(t,u){return t<=Tt?0:u*Math.min(1,(t-Tt)/(1-Tt))**.8}function ni(t){const u=Y.useRef(t);u.current=t;const s=Y.useRef([]),v=Y.useRef(""),k=Y.useRef(0),e=Y.useRef({x:0,y:0,pulse:0}),y=Y.useRef({color:"",img:null}),P=Eo(),o=Y.useRef(null);function n(r){const g=u.current,l=[];for(let h=0;h<3;h++){const f=Math.max(3,Math.round(g.spikes*(.7+h*.15)));for(let b=0;b<f;b++){const m=(b+(h%2?.5:0)+.5)/(f+.5)-.5;l.push({x:m*r*(.75+h*.08),row:h,h:0,v:0,lean:0,width:r/f*(.42+h*.06),seed:Math.random()*10})}}s.current=l}function a(r,g,l,h,f){const b=u.current,m=h/16.67;k.current+=h*.001;const w=k.current,B=g/2,F=l*.74,X=Math.min(g*.82,Math.max(160,g*b.poolWidth)),O=`${X}|${b.spikes}`;v.current!==O&&(v.current=O,n(X)),f.overlay||(r.fillStyle=b.backgroundColor,r.fillRect(0,0,g,l),y.current.color!==b.highlightColor&&(y.current={color:b.highlightColor,img:Yo(b.highlightColor,128)}),y.current.img&&(r.globalAlpha=.09,r.drawImage(y.current.img,B-X,F-X*.5,X*2,X),r.globalAlpha=1));const _=zo(P.current,o.current),H=e.current,D=b.interactive&&_.inside,W=D?_.x:B+Math.sin(w*.5)*X*.18,A=D?_.y:F-l*(.22+.07*Math.sin(w*.8)),T=1-Math.pow(.8,m);H.x+=(W-H.x)*T,H.y+=(A-H.y)*T,_.taps.length&&(H.pulse=1),H.pulse*=Math.pow(.96,m);const E=b.strength*(D?1:.75)*(1+H.pulse*.9),x=l*.32,I=l*.34*b.spikeHeight,M=Sn(H.x-B,H.y-F,x)*E,p=l*.055+Math.min(l*.06,M*l*.07),R=Math.max(-X*.12,Math.min(X*.12,(H.x-B)*.08*Math.min(1,M*2)));for(const S of s.current){const N=B+R+S.x,z=Sn(H.x-N,H.y-F,x)*E,L=ti(z,I)*(.55+S.row*.22)*(1+.05*Math.sin(w*7+S.seed));S.v+=((L-S.h)*.12-S.v*.22)*m,S.h=Math.max(0,S.h+S.v*m);const G=Math.atan2(H.x-N,Math.max(20,F-H.y))*.55*Math.min(1,z*2);S.lean+=(G-S.lean)*T}const c=S=>{const N=(S-B-R)/(X/2);return Math.abs(N)>=1?0:p*Math.pow(1-N*N,.6)},d=S=>{const N=new Path2D,z=B+R-X/2-6,L=B+R+X/2+6,G=1.5;N.moveTo(z,F);const q=s.current.filter(j=>j.row===S&&j.h>.5);for(let j=z;j<=L;j+=G){let V=c(j)*(.85+S*.08);for(const K of q){const to=B+R+K.x,lo=j-to,ao=K.h,ro=lo-K.lean*ao*.9*Math.max(0,1-Math.abs(lo)/K.width),Q=1-Math.abs(ro)/K.width;Q>0&&(V=Math.max(V,c(to)+ao*Math.pow(Q,2.4)))}N.lineTo(j,F-V)}return N.lineTo(L,F),N.closePath(),N},$=b.fluidColor,C=[];for(let S=0;S<3;S++){const N=d(S);C.push(N),r.fillStyle=$,r.fill(N),r.strokeStyle=ko(b.highlightColor,.18+S*.12),r.lineWidth=.8+S*.3,r.stroke(N)}r.strokeStyle=ko(b.highlightColor,.55),r.lineWidth=1.1,r.beginPath();for(const S of s.current){if(S.row!==2||S.h<6)continue;const N=B+R+S.x,z=F-c(N);r.moveTo(N-S.width*.35,z-S.h*.08),r.quadraticCurveTo(N-S.width*.18+S.lean*S.h*.3,z-S.h*.5,N+S.lean*S.h*.85-1,F-c(N)-S.h*.92)}if(r.stroke(),r.fillStyle=ko(b.highlightColor,.1),r.beginPath(),r.ellipse(B+R-X*.15,F-p*.55,X*.22,Math.max(2,p*.22),0,0,Math.PI*2),r.fill(),b.reflection){r.save(),r.translate(0,F*2),r.scale(1,-1),r.globalAlpha=.22,r.fillStyle=$;for(const S of C)r.fill(S);if(r.restore(),!f.overlay){const S=r.createLinearGradient(0,F,0,Math.min(l,F+I));S.addColorStop(0,ko(b.backgroundColor,0)),S.addColorStop(1,ko(b.backgroundColor,1)),r.fillStyle=S,r.fillRect(0,F,g,l-F)}r.globalAlpha=1}}const i=To({overlay:t.overlay,onFrame:a});return o.current=i.canvas,i}const ri={default:{backgroundColor:"#ececec",fluidColor:"#050505",highlightColor:"#ffffff"},monochrome:{},studio:{backgroundColor:"#ececec",fluidColor:"#050505",highlightColor:"#ffffff"},noir:{backgroundColor:"#0a0a0a",fluidColor:"#000000",highlightColor:"#9ca3af"},gold:{backgroundColor:"#120d05",fluidColor:"#1a1206",highlightColor:"#f5c96a"},"oil-slick":{backgroundColor:"#0b0b12",fluidColor:"#05050a",highlightColor:"#a78bfa"}},Ur=Y.forwardRef((t,u)=>{const{preset:s,fluidColor:v,highlightColor:k,backgroundColor:e,spikes:y,spikeHeight:P,poolWidth:o,strength:n,reflection:a,interactive:i,overlay:r,zIndex:g,width:l,height:h,className:f,style:b}=t,m=ri[s??"default"]||{},{canvasRef:w,canvas:B}=ni({fluidColor:v??m.fluidColor??"#050505",highlightColor:k??m.highlightColor??"#ffffff",backgroundColor:e??m.backgroundColor??"#e5e5e5",spikes:Math.max(3,Math.min(24,Math.round(y??9))),spikeHeight:P??1,poolWidth:o??.5,strength:n??1,reflection:a??!0,interactive:i??!0,overlay:r??!1});return Y.useImperativeHandle(u,()=>B,[B]),Mo.jsx(Io,{canvasRef:w,overlay:r,zIndex:g,width:l,height:h,className:f,style:b})});Ur.displayName="Ferrofluid";const qo=(t,u,s)=>{const v=t.split(",").map(Number),k=u.split(",").map(Number);return v.map((e,y)=>Math.round(e+(k[y]-e)*s)).join(",")},He=t=>t.startsWith("#")?xo(t):"255,255,255",Fe=(t,u,s)=>Math.max(u,Math.min(s,t)),Rn=t=>t*t*(3-2*t);function Pn([t,u,s,v],k){const e=1-k;return{x:e*e*e*t.x+3*e*e*k*u.x+3*e*k*k*s.x+k*k*k*v.x,y:e*e*e*t.y+3*e*e*k*u.y+3*e*k*k*s.y+k*k*k*v.y}}function xn([t,u,s,v],k){const e=1-k;return{x:3*e*e*(u.x-t.x)+6*e*k*(s.x-u.x)+3*k*k*(v.x-s.x),y:3*e*e*(u.y-t.y)+6*e*k*(s.y-u.y)+3*k*k*(v.y-s.y)}}function ai(t){return t<0?0:t<.07?Rn(t/.07):t<.1?1:t<.27?1-Rn((t-.1)/.17):0}function li(t,u){const s=Y.useRef(u);s.current=u,Y.useEffect(()=>{const v=t.current;if(!v)return;const k=v.parentElement;if(!k)return;const e=v.getContext("2d");let y=0,P=0,o=1,n=0,a=9;const i=()=>((a=a*16807%2147483647)-1)/2147483646,r=Array.from({length:38},(p,R)=>({t:.08+R/37*.88+(i()-.5)*.02,len:.85+i()*.3,curl:.7+i()*.6,tilt:(i()-.5)*.18})),g=Array.from({length:24},(p,R)=>({t:.22+R/23*.72+(i()-.5)*.02,len:.7+i()*.5,tilt:(i()-.5)*.2})),l=Array.from({length:12},()=>{const p=i()<.5,R=(i()-.5)*.7,c=[];let d=p?-1:1,$=R;const C=5+Math.floor(i()*4);for(let S=0;S<C;S++)c.push({x:d,y:$}),d+=(p?1:-1)*(.05+i()*.06),$+=(i()-.5)*.18;return{pts:c,a:.06+i()*.09,w:.5+i()*.6}}),h={x:0,y:0,active:!1},f={x:0,y:0,fx:0,fy:0,since:0,nextIdle:.8,nextMicro:.6};let b=s.current.pupilSize,m=0,w=-1,B=2,F=!1,X=null,O="";function _(p,R,c){O=`${p}|${o}|${R}|${c}`;const d=Math.max(2,Math.ceil(p*2*o)),$=document.createElement("canvas");$.width=$.height=d;const C=$.getContext("2d");if(!C||typeof C.createRadialGradient!="function"){X=null;return}let S=5;const N=()=>((S=S*16807%2147483647)-1)/2147483646;C.scale(d/(2*p),d/(2*p)),C.translate(p,p);const z=C.createRadialGradient(0,0,0,0,0,p);z.addColorStop(0,`rgb(${qo(c,"0,0,0",.35)})`),z.addColorStop(.3,`rgb(${c})`),z.addColorStop(.48,`rgb(${qo(c,R,.55)})`),z.addColorStop(.62,`rgb(${R})`),z.addColorStop(.86,`rgb(${qo(R,"0,0,0",.28)})`),z.addColorStop(.96,`rgb(${qo(R,"0,0,0",.72)})`),z.addColorStop(1,`rgba(${qo(R,"0,0,0",.8)},0)`),C.fillStyle=z,C.beginPath(),C.arc(0,0,p,0,Math.PI*2),C.fill(),C.save(),C.beginPath(),C.arc(0,0,p*.97,0,Math.PI*2),C.clip(),C.lineCap="round";for(let L=0;L<360;L++){const G=N()*Math.PI*2,q=p*(.16+N()*.16),j=p*(.72+N()*.26),V=(N()-.5)*.12,K=N()<.55,to=K?qo(N()<.5?c:R,"255,255,255",.15+N()*.2):qo(R,"0,0,0",.5);C.strokeStyle=`rgba(${to},${K?.08+N()*.14:.16+N()*.2})`,C.lineWidth=p*(.004+N()*.01);const lo=G+V,ao=(q+j)/2;C.beginPath(),C.moveTo(Math.cos(G)*q,Math.sin(G)*q),C.quadraticCurveTo(Math.cos(lo)*ao,Math.sin(lo)*ao,Math.cos(G)*j,Math.sin(G)*j),C.stroke()}C.beginPath();for(let L=0;L<=56;L++){const G=L/56*Math.PI*2,q=p*(.42+(L%2?.035:-.02)+(N()-.5)*.03);L?C.lineTo(Math.cos(G)*q,Math.sin(G)*q):C.moveTo(Math.cos(G)*q,Math.sin(G)*q)}C.closePath(),C.fillStyle=`rgba(${qo(c,"255,255,255",.15)},0.18)`,C.fill(),C.strokeStyle=`rgba(${qo(c,"255,255,255",.3)},0.55)`,C.lineWidth=p*.022,C.stroke();for(let L=0;L<26;L++){const G=N()*Math.PI*2,q=p*(.47+N()*.34);C.save(),C.translate(Math.cos(G)*q,Math.sin(G)*q),C.rotate(G),C.fillStyle=`rgba(${qo(R,"0,0,0",.65)},${.25+N()*.2})`,C.beginPath(),C.ellipse(0,0,p*(.025+N()*.035),p*(.012+N()*.016),0,0,Math.PI*2),C.fill(),C.restore()}C.strokeStyle=`rgba(${qo(R,"0,0,0",.6)},0.16)`,C.lineWidth=p*.008;for(const L of[.7,.79,.87]){const G=N()*Math.PI*2;C.beginPath(),C.arc(0,0,p*L,G,G+Math.PI*(.8+N()*.9)),C.stroke()}for(let L=0;L<4;L++){const G=N()*Math.PI*2,q=p*(.5+N()*.3);C.fillStyle=`rgba(${qo(c,"110,55,20",.5)},0.45)`,C.beginPath(),C.arc(Math.cos(G)*q,Math.sin(G)*q,p*(.015+N()*.02),0,Math.PI*2),C.fill()}C.restore(),C.strokeStyle=`rgba(${qo(R,"0,0,0",.82)},0.55)`,C.lineWidth=p*.07,C.beginPath(),C.arc(0,0,p*.955,0,Math.PI*2),C.stroke(),X=$}function H(p,R){o=Math.min(2,window.devicePixelRatio||1),v.width=Math.round(p*o),v.height=Math.round(R*o),v.style.width=`${p}px`,v.style.height=`${R}px`,y=p,P=R,O=""}const D=new ResizeObserver(p=>{const{width:R,height:c}=p[0].contentRect;R>0&&c>0&&H(R,c)});D.observe(k);const W=k.getBoundingClientRect();W.width>0&&W.height>0&&H(W.width,W.height);function A(p){const R=v.getBoundingClientRect();h.x=p.clientX-R.left,h.y=p.clientY-R.top,h.active=!0}function T(){h.active=!1}function E(){w=n,m=1}window.addEventListener("mousemove",A),document.addEventListener("mouseleave",T),v.addEventListener("click",E);let x=0,I=0;function M(p){x=requestAnimationFrame(M);const R=I?Math.min(.05,(p-I)/1e3):1/60;if(I=p,n+=R,y===0)return;const c=s.current,d=He(c.irisColor),$=He(c.irisInnerColor),C=He(c.scleraColor),S=He(c.skinColor),N=He(c.lashColor),z=y/2,L=P*.52,G=Math.max(10,Math.min(y*.4,P*.62)*Fe(c.eyeSize,.2,1.5)),q=G*.46,j=G*.43,V=G*.48,K=q*.38,to=c.followCursor&&h.active;if(f.since+=R,to){const Ro=V*Math.tanh((h.x-z)/(G*1.2)),No=K*Math.tanh((h.y-L)/(G*.9));Math.hypot(Ro-f.fx,No-f.fy)>j*.1&&f.since>.12&&(f.fx=Ro,f.fy=No,f.since=0)}else if(f.nextIdle-=R,f.nextIdle<=0){const Ro=Math.random()<.35;f.fx=Ro?0:(Math.random()*2-1)*V*.75,f.fy=Ro?0:(Math.random()*2-1)*K*.6,f.nextIdle=1.2+Math.random()*2.3,f.since=0}f.nextMicro-=R,f.nextMicro<=0&&(f.fx+=(Math.random()-.5)*j*.05,f.fy+=(Math.random()-.5)*j*.05,f.nextMicro=.4+Math.random()*.9),f.fx=Fe(f.fx,-V,V),f.fy=Fe(f.fy,-K,K);const lo=1-Math.exp(-R*30);f.x+=(f.fx-f.x)*lo,f.y+=(f.fy-f.y)*lo,c.blinkInterval>0&&(B-=R,B<=0&&(w=n,!F&&Math.random()<.15?(B=.32,F=!0):(B=c.blinkInterval/1e3*(.4+Math.random()*1.2),F=!1)));const ao=w>=0?ai(n-w):0;m*=Math.exp(-R*1.6);const ro=z+f.x,Q=L+f.y,so=to?Fe(1-Math.hypot(h.x-ro,h.y-Q)/(G*1.6),0,1):0,J=1+.03*Math.sin(n*1.3)+.015*Math.sin(n*3.7),oo=Fe(c.pupilSize,.08,.85)*(1-.38*so)*(1+.4*m)*J;b+=(oo-b)*Math.min(1,R*3.5);const Z=j*Fe(b,.06,.88),no=1-f.y/K*.16,U=no+(-.5-no)*ao,eo=1-.22*ao+f.y/K*.06,co={x:z-G,y:L+q*.08},fo={x:z+G,y:L-q*.05},mo=[co,{x:z-G*.45,y:L-q*U*1.25},{x:z+G*.35,y:L-q*U*1.3},fo],go=[co,{x:z-G*.35,y:L+q*eo*.95},{x:z+G*.45,y:L+q*eo*.8},fo],po=[{x:co.x+G*.06,y:co.y-q*.25},{x:z-G*.4,y:L-q*(1.7-ao*.3)},{x:z+G*.4,y:L-q*(1.75-ao*.3)},{x:fo.x+G*.02,y:fo.y-q*.3}],yo=(Ro,No=!0)=>{No&&e.moveTo(Ro[0].x,Ro[0].y),e.bezierCurveTo(Ro[1].x,Ro[1].y,Ro[2].x,Ro[2].y,Ro[3].x,Ro[3].y)};e.setTransform(o,0,0,o,0,0),e.globalAlpha=1,e.globalCompositeOperation="source-over",e.clearRect(0,0,y,P),c.backgroundColor&&c.backgroundColor!=="transparent"&&(e.fillStyle=c.backgroundColor,e.fillRect(0,0,y,P));const vo=e.createRadialGradient(z-G*.25,L-q*.9,0,z,L,G*2.2);vo.addColorStop(0,`rgba(${qo(S,"255,255,255",.1)},1)`),vo.addColorStop(.4,`rgba(${S},0.95)`),vo.addColorStop(.75,`rgba(${qo(S,"0,0,0",.45)},0.55)`),vo.addColorStop(1,`rgba(${qo(S,"0,0,0",.6)},0)`),e.fillStyle=vo,e.fillRect(0,0,y,P);const $o=e.createRadialGradient(z,L,G*.5,z,L,G*1.35);$o.addColorStop(0,"rgba(0,0,0,0.28)"),$o.addColorStop(1,"rgba(0,0,0,0)"),e.fillStyle=$o,e.fillRect(0,0,y,P);const io=z-G*.1,ho=L-q*(1.25-ao*.6),Co=G*.45,bo=e.createRadialGradient(io,ho,0,io,ho,Co);bo.addColorStop(0,"rgba(255,255,255,0.09)"),bo.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=bo,e.fillRect(io-Co,ho-Co,Co*2,Co*2),e.lineCap="round";for(const[Ro,No]of[[.22,.05],[.1,.08],[.035,.16]])e.strokeStyle=`rgba(${qo(S,"40,10,10",.7)},${No})`,e.lineWidth=q*Ro,e.beginPath(),yo(po),e.stroke();e.strokeStyle=`rgba(${qo(S,"40,10,30",.6)},0.035)`,e.lineWidth=q*.5,e.beginPath(),e.moveTo(co.x+G*.1,co.y+q*.35),e.bezierCurveTo(z-G*.3,L+q*1.25,z+G*.4,L+q*1.1,fo.x-G*.1,fo.y+q*.35),e.stroke(),e.save(),e.beginPath(),yo(mo),e.lineTo(fo.x,L+q*3),e.lineTo(co.x,L+q*3),e.closePath(),e.clip(),e.beginPath(),yo(go),e.lineTo(fo.x,L-q*3),e.lineTo(co.x,L-q*3),e.closePath(),e.clip();const Ao=e.createRadialGradient(z+f.x*.3,L+f.y*.3-q*.2,0,z,L,G*1.05);Ao.addColorStop(0,`rgb(${C})`),Ao.addColorStop(.55,`rgb(${qo(C,"215,170,165",.18)})`),Ao.addColorStop(.85,`rgb(${qo(qo(C,"200,140,135",.3),"0,0,0",.25)})`),Ao.addColorStop(1,`rgb(${qo(C,"60,30,30",.6)})`),e.fillStyle=Ao,e.fillRect(z-G,L-q*1.5,G*2,q*3);const Xo=e.createRadialGradient(co.x+G*.05,co.y,0,co.x+G*.05,co.y,G*.12);Xo.addColorStop(0,"rgba(205,110,110,0.85)"),Xo.addColorStop(1,"rgba(205,110,110,0)"),e.fillStyle=Xo,e.fillRect(co.x-G*.1,co.y-G*.15,G*.3,G*.3),e.lineJoin="round";for(const Ro of l)e.strokeStyle=`rgba(175,45,45,${Ro.a})`,e.lineWidth=Ro.w*Math.max(.6,G/220),e.beginPath(),Ro.pts.forEach((No,be)=>{const Me=z+No.x*G*.97+f.x*.6,Qo=L+No.y*q+f.y*.5;be?e.lineTo(Me,Qo):e.moveTo(Me,Qo)}),e.stroke();const wo=1-Math.min(.2,Math.abs(f.x)/G*.35),Do=1-Math.min(.12,Math.abs(f.y)/G*.35);e.save(),e.translate(ro,Q),e.scale(wo,Do);const _o=e.createRadialGradient(0,0,j*.9,0,0,j*1.18);if(_o.addColorStop(0,"rgba(0,0,0,0.25)"),_o.addColorStop(1,"rgba(0,0,0,0)"),e.fillStyle=_o,e.beginPath(),e.arc(0,0,j*1.2,0,Math.PI*2),e.fill(),O!==`${j}|${o}|${d}|${$}`&&_(j,d,$),X)e.drawImage(X,-j,-j,j*2,j*2);else{const Ro=e.createRadialGradient(0,0,0,0,0,j);Ro.addColorStop(0,`rgb(${$})`),Ro.addColorStop(1,`rgb(${d})`),e.fillStyle=Ro,e.beginPath(),e.arc(0,0,j,0,Math.PI*2),e.fill()}const oe=c.pupilShape==="slit",So=oe?Z*.32:Z,Uo=oe?j*.9:Z;e.strokeStyle=`rgba(${qo($,"60,30,10",.6)},0.55)`,e.lineWidth=Math.max(.6,Z*.14),e.beginPath(),e.ellipse(0,0,So*1.05,Uo*(oe?1:1.05),0,0,Math.PI*2),e.stroke(),e.save(),e.scale(1,Uo/So);const Ko=e.createRadialGradient(0,0,0,0,0,So);Ko.addColorStop(0,"rgb(2,2,3)"),Ko.addColorStop(.82,"rgb(6,5,6)"),Ko.addColorStop(1,"rgba(6,5,6,0)"),e.fillStyle=Ko,e.beginPath(),e.arc(0,0,So,0,Math.PI*2),e.fill(),e.restore();const jo=e.createRadialGradient(-j*.3,-j*.35,0,0,0,j);jo.addColorStop(0,"rgba(255,255,255,0.1)"),jo.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=jo,e.beginPath(),e.arc(0,0,j,0,Math.PI*2),e.fill(),e.restore();const re=z+f.x*.75-j*.34,se=L+f.y*.75-j*.36;e.save(),e.translate(re,se),e.rotate(-.18);const le=e.createRadialGradient(0,0,0,0,0,j*.26);le.addColorStop(0,"rgba(255,255,255,0.85)"),le.addColorStop(.5,"rgba(255,255,255,0.45)"),le.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=le,e.scale(1.25,.9),e.beginPath(),e.arc(0,0,j*.26,0,Math.PI*2),e.fill(),e.restore(),e.fillStyle="rgba(255,255,255,0.4)",e.beginPath(),e.arc(z+f.x*.75+j*.3,L+f.y*.75+j*.32,Math.max(.8,j*.04),0,Math.PI*2),e.fill(),e.save();const de=1e4;if(e.translate(-de,0),e.shadowColor="rgba(0,0,0,0.55)",e.shadowBlur=q*.35*o,e.shadowOffsetX=de*o,e.shadowOffsetY=q*.1*o,e.strokeStyle="#000",e.lineWidth=q*.22,e.beginPath(),yo(mo),e.stroke(),e.restore(),e.strokeStyle="rgba(0,0,0,0.12)",e.lineWidth=q*.14,e.beginPath(),yo(go),e.stroke(),e.strokeStyle="rgba(255,255,255,0.35)",e.lineWidth=Math.max(.6,q*.02),e.save(),e.translate(0,-q*.05),e.beginPath(),yo(go),e.stroke(),e.restore(),e.restore(),e.strokeStyle=`rgba(${qo(S,"205,120,115",.5)},${.9*(1-ao*.85)})`,e.lineWidth=q*.035,e.beginPath(),yo(go),e.stroke(),e.strokeStyle=`rgba(${qo(N,S,.25)},0.95)`,e.lineWidth=q*.055,e.beginPath(),yo(mo),e.stroke(),c.showLashes){e.strokeStyle=`rgba(${N},0.85)`;for(const Ro of r){const No=Pn(mo,Ro.t),be=xn(mo,Ro.t);let Qo=Math.atan2(-be.x,be.y)+(Ro.t-.35)*.9+Ro.tilt;Qo+=(Math.PI/2-.5-Qo)*Math.pow(ao,1.5)*.9;const Pe=q*(.22+.28*Math.pow(Math.sin(Math.PI*Ro.t),.7))*(.75+.5*Ro.t)*Ro.len,ia=No.x+Math.cos(Qo)*Pe,ca=No.y+Math.sin(Qo)*Pe,Nt=Qo-.6*Ro.curl*(1-ao*.6);e.lineWidth=Math.max(.5,q*.014),e.beginPath(),e.moveTo(No.x,No.y),e.quadraticCurveTo(No.x+Math.cos(Qo+.25)*Pe*.6,No.y+Math.sin(Qo+.25)*Pe*.6,ia+Math.cos(Nt)*Pe*.15,ca+Math.sin(Nt)*Pe*.15),e.stroke()}e.strokeStyle=`rgba(${N},0.45)`;for(const Ro of g){const No=Pn(go,Ro.t),be=xn(go,Ro.t),Me=Math.atan2(be.x,-be.y)-(Ro.t-.4)*.7+Ro.tilt,Qo=q*.14*Ro.len*(.6+.6*Ro.t);e.lineWidth=Math.max(.4,q*.013),e.beginPath(),e.moveTo(No.x,No.y+q*.02),e.quadraticCurveTo(No.x+Math.cos(Me)*Qo*.6,No.y+Math.sin(Me)*Qo*.6,No.x+Math.cos(Me+.2)*Qo,No.y+Math.sin(Me+.2)*Qo),e.stroke()}}}return x=requestAnimationFrame(M),()=>{D.disconnect(),cancelAnimationFrame(x),window.removeEventListener("mousemove",A),document.removeEventListener("mouseleave",T),v.removeEventListener("click",E)}},[t])}const si={default:{irisColor:"#4a7c59",irisInnerColor:"#c8963e",scleraColor:"#f1ebe4",skinColor:"#c99a7e",lashColor:"#1a1210",backgroundColor:"#0c0807"},monochrome:{},ocean:{irisColor:"#3a78b5",irisInnerColor:"#a7c8d8",scleraColor:"#f3eee9",skinColor:"#e0b598",lashColor:"#2a1c14",backgroundColor:"#05090f"},amber:{irisColor:"#a8661c",irisInnerColor:"#f2c14e",scleraColor:"#efe6dc",skinColor:"#8a5a3f",lashColor:"#120a06",backgroundColor:"#0a0604"},violet:{irisColor:"#6f52ad",irisInnerColor:"#e2bdf2",scleraColor:"#f3edf0",skinColor:"#d8a891",lashColor:"#1c1018",backgroundColor:"#0b0710"},serpent:{irisColor:"#8fae2a",irisInnerColor:"#f0e06a",scleraColor:"#d6cf9a",skinColor:"#3e5a36",lashColor:"#0f1a0f",backgroundColor:"#040703",pupilShape:"slit",pupilSize:.5,showLashes:!1}},Kr=Y.forwardRef((t,u)=>{const{preset:s,irisColor:v,irisInnerColor:k,scleraColor:e,skinColor:y,lashColor:P,backgroundColor:o,pupilShape:n,pupilSize:a,eyeSize:i,followCursor:r,blinkInterval:g,showLashes:l,width:h,height:f,className:b,style:m}=t,w=si[s??"default"]||{},B=Y.useRef(null);return Y.useImperativeHandle(u,()=>B.current),li(B,{irisColor:v??w.irisColor??"#6b7280",irisInnerColor:k??w.irisInnerColor??"#d1d5db",scleraColor:e??w.scleraColor??"#f3f4f6",skinColor:y??w.skinColor??"#9ca3af",lashColor:P??w.lashColor??"#111111",backgroundColor:o??w.backgroundColor??"#111111",pupilShape:n??w.pupilShape??"round",pupilSize:a??w.pupilSize??.38,eyeSize:i??1,followCursor:r??!0,blinkInterval:g??4e3,showLashes:l??w.showLashes??!0}),Mo.jsx("div",{className:b,style:{width:h??"100%",height:f??"100%",display:"block",overflow:"hidden",...m},children:Mo.jsx("canvas",{ref:B,"aria-hidden":"true",role:"presentation",style:{display:"block"}})})});Kr.displayName="Eye";const Lo=(t,u,s)=>{const v=t.split(",").map(Number),k=u.split(",").map(Number);return v.map((e,y)=>Math.round(e+(k[y]-e)*s)).join(",")},ke=t=>t.startsWith("#")?xo(t):"255,255,255",dt=(t,u,s)=>Math.max(u,Math.min(s,t)),$n=t=>t*t*(3-2*t);function ii(t){return t<0?0:t<.12?$n(t/.12):t<.2?1:t<.45?1-$n((t-.2)/.25):0}function Gt(t,u,s,v){let k=null,e=1/0;for(const y of t){if(y.y<v*.5||y.y>s||y.x+y.w<0||y.x>u)continue;const P=Math.abs(y.x+y.w/2-u/2);P<e&&(e=P,k=y)}return k}function ci(t){const u=Y.useRef(t);u.current=t;const s=Eo(),v=Y.useRef(null),k=Y.useRef(Vo()),e=Y.useRef({t:0,x:-1,y:-1,yaw:0,pitch:0,roll:0,fy:0,fp:0,since:0,nextIdle:1,still:0,tiltSign:1,bob:0,puff:0,alarm:0,drowsy:0,idle:0,pupil:.5,blinkAt:-1,blinkGap:2});function y(o,n,a,i,r){const g=u.current,l=e.current,h=i/1e3,f=i/16.67;l.t+=h;const b=l.t,m=ke(g.featherColor),w=ke(g.bellyColor),B=ke(g.faceColor),F=ke(g.eyeColor),X=ke(g.beakColor),O=ke(g.branchColor),_=ke(g.backgroundColor==="transparent"?"#000000":g.backgroundColor);let H=(r.overlay?130:Math.min(n,a)*.6)*dt(g.size,.2,2);const D=g.collide?Gt(r.solids,n,a,H):null;let W,A;D?(H=Math.min(H,D.y/1.2),W=dt(D.x+D.w/2,H*.4,n-H*.4),A=D.y):(W=n/2,A=a*.84,H=Math.min(H,A/1.25)),(l.x<0||Math.hypot(W-l.x,A-l.y)>H*3)&&(l.x=W,l.y=A),l.x+=(W-l.x)*Math.min(1,h*8),l.y+=(A-l.y)*Math.min(1,h*8);const T=l.x,E=l.y,x=zo(s.current,v.current),{vx:I,vy:M}=k.current(x,f),p=Math.hypot(I,M),R=T,c=E-H*.88,d=g.followCursor&&x.inside;if(x.inside&&p>.5?l.idle=0:l.idle+=h,l.drowsy+=((l.idle>6?1:0)-l.drowsy)*Math.min(1,h*(l.idle>6?.4:4)),l.since+=h,d){const go=Math.tanh((x.x-R)/(H*1.3)),po=Math.tanh((x.y-c)/(H*1.6));Math.hypot(go-l.fy,po-l.fp)>.08&&l.since>.15&&(l.fy=go,l.fp=po,l.since=0),l.still=p<.6?l.still+h:0,p>18&&Math.hypot(x.x-R,x.y-c)<H*2.5&&(l.alarm=Math.max(l.alarm,.7),l.bob=Math.max(l.bob,.7))}else l.still=0,l.nextIdle-=h,l.nextIdle<=0&&(l.fy=Math.random()<.3?0:(Math.random()*2-1)*.9,l.fp=(Math.random()*2-1)*.3,l.nextIdle=1.5+Math.random()*2.5);const $=1-Math.exp(-h*14);l.yaw+=(l.fy-l.yaw)*$,l.pitch+=(l.fp-l.pitch)*$,l.still>.9&&l.still-h<=.9&&(l.tiltSign=-l.tiltSign);const C=l.still>.9?.3*l.tiltSign:0;l.roll+=(C-l.roll)*Math.min(1,h*5),x.taps.length&&(l.puff=1,l.alarm=1,l.bob=1,l.idle=0),l.puff*=Math.exp(-h*1.4),l.alarm*=Math.exp(-h*1.2),l.bob*=Math.exp(-h*2.2),g.blinkInterval>0&&(l.blinkGap-=h,l.blinkGap<=0&&(l.blinkAt=b,l.blinkGap=g.blinkInterval/1e3*(.5+Math.random())));const S=l.blinkAt>=0?ii(b-l.blinkAt):0,N=Math.max(S,l.drowsy*.55*(1-l.alarm)),L=.52*(1-.4*(d?dt(1-Math.hypot(x.x-R,x.y-c)/(H*2.2),0,1):0))*(1+.45*l.alarm)*(1+.15*l.drowsy);if(l.pupil+=(L-l.pupil)*Math.min(1,h*4),o.globalCompositeOperation="source-over",o.globalAlpha=1,!r.overlay&&g.backgroundColor!=="transparent"){const go=o.createLinearGradient(0,0,0,a);go.addColorStop(0,`rgb(${Lo(_,"0,0,0",.2)})`),go.addColorStop(1,`rgb(${Lo(_,"60,70,100",.18)})`),o.fillStyle=go,o.fillRect(0,0,n,a);for(let ho=0;ho<7;ho++){const Co=(ho*.153+.07)%1*n;if(Math.abs(Co-n*.82)<Math.min(n,a)*.12)continue;const bo=n*(.012+ho%3*.008);o.fillStyle=`rgba(${Lo(_,"0,0,0",.35)},${.35+ho%2*.25})`,o.fillRect(Co,0,bo,a)}const po=n*.82,yo=a*.2,vo=Math.min(n,a)*.07,$o=o.createRadialGradient(po,yo,0,po,yo,vo*7);$o.addColorStop(0,"rgba(220,228,255,0.22)"),$o.addColorStop(1,"rgba(220,228,255,0)"),o.fillStyle=$o,o.fillRect(0,0,n,a),o.fillStyle="rgba(236,240,255,0.85)",o.beginPath(),o.arc(po,yo,vo,0,Math.PI*2),o.fill();const io=o.createLinearGradient(0,a*.5,0,a);io.addColorStop(0,`rgba(${Lo(_,"150,160,190",.4)},0)`),io.addColorStop(1,`rgba(${Lo(_,"150,160,190",.4)},0.35)`),o.fillStyle=io,o.fillRect(0,a*.5,n,a*.5)}if(!D){const go=H*.09;o.lineCap="round",o.strokeStyle=`rgb(${Lo(O,"0,0,0",.35)})`,o.lineWidth=go*1.15,o.beginPath(),o.moveTo(-10,E+go*.9),o.quadraticCurveTo(T,E+go*.2,n+10,E+go*.1),o.stroke(),o.strokeStyle=`rgb(${O})`,o.lineWidth=go,o.beginPath(),o.moveTo(-10,E+go*.75),o.quadraticCurveTo(T,E+go*.05,n+10,E),o.stroke(),o.strokeStyle=`rgba(${Lo(O,"255,255,255",.25)},0.35)`,o.lineWidth=Math.max(.6,go*.08);for(let po=0;po<9;po++){const yo=po/9*n+7;o.beginPath(),o.moveTo(yo,E+go*.2),o.lineTo(yo+go*1.6,E+go*.05),o.stroke()}o.strokeStyle=`rgb(${O})`,o.lineWidth=go*.35,o.beginPath(),o.moveTo(T+H*.75,E+go*.1),o.quadraticCurveTo(T+H*.9,E-H*.2,T+H*1.1,E-H*.32),o.stroke(),o.fillStyle=`rgb(${Lo(O,"60,90,50",.6)})`;for(const[po,yo,vo]of[[1.08,-.33,-.6],[.95,-.22,.5],[1.15,-.25,.9]])o.save(),o.translate(T+H*po,E+H*yo),o.rotate(vo),o.beginPath(),o.ellipse(0,0,H*.07,H*.028,0,0,Math.PI*2),o.fill(),o.restore()}const q=Math.sin(b*38)*.012*l.puff,j=1+Math.sin(b*1.6)*.012,V=1+.12*l.puff+.05*l.drowsy;o.save(),o.translate(T,E),o.scale(H,H),o.lineCap="round",o.lineJoin="round";const K=Lo(m,"0,0,0",.32);o.fillStyle=`rgb(${Lo(m,"0,0,0",.25)})`,o.beginPath(),o.moveTo(-.09,-.1),o.lineTo(.09,-.1),o.quadraticCurveTo(.07,.08,.035,.16),o.lineTo(0,.13),o.lineTo(-.035,.16),o.quadraticCurveTo(-.07,.08,-.09,-.1),o.closePath(),o.fill(),o.strokeStyle=`rgba(${Lo(m,"255,255,255",.2)},0.3)`,o.lineWidth=.008;for(const go of[0,.05,.1])o.beginPath(),o.moveTo(-.06+go*.2,go),o.lineTo(.06-go*.2,go),o.stroke();o.save(),o.translate(q,-.36),o.scale(V,j);const to=o.createRadialGradient(-.1,-.15,.02,0,0,.42);to.addColorStop(0,`rgb(${Lo(m,"255,255,255",.12)})`),to.addColorStop(1,`rgb(${Lo(m,"0,0,0",.3)})`),o.fillStyle=to,o.beginPath(),o.ellipse(0,0,.3,.38,0,0,Math.PI*2),o.fill(),o.save(),o.beginPath(),o.ellipse(0,.06,.2,.28,0,0,Math.PI*2);const lo=o.createRadialGradient(0,-.05,0,0,.06,.3);lo.addColorStop(0,`rgb(${Lo(w,"255,255,255",.1)})`),lo.addColorStop(1,`rgb(${Lo(w,m,.45)})`),o.fillStyle=lo,o.fill(),o.clip(),o.strokeStyle=`rgba(${K},0.55)`,o.lineWidth=.014;for(let go=0,po=-.18;po<.34;po+=.052,go++)for(let yo=-.2+go%2*.035;yo<.21;yo+=.07)o.beginPath(),o.moveTo(yo-.022,po-.012),o.lineTo(yo,po+.008),o.lineTo(yo+.022,po-.012),o.stroke();o.restore();for(const go of[-1,1]){o.save(),o.scale(go,1),o.translate(.03*l.puff,0),o.rotate(-.08*l.puff);const po=o.createLinearGradient(.16,-.3,.32,.3);po.addColorStop(0,`rgb(${Lo(m,"0,0,0",.1)})`),po.addColorStop(1,`rgb(${Lo(m,"0,0,0",.4)})`),o.fillStyle=po,o.beginPath(),o.moveTo(.17,-.27),o.bezierCurveTo(.36,-.15,.36,.12,.21,.36),o.bezierCurveTo(.17,.2,.15,-.02,.17,-.27),o.fill(),o.save(),o.clip(),o.strokeStyle=`rgba(${Lo(m,"255,255,255",.3)},0.35)`,o.lineWidth=.01;for(let yo=-.2;yo<.34;yo+=.07)o.beginPath(),o.arc(.25,yo,.06,.2,Math.PI-.2),o.stroke();o.fillStyle=`rgba(${Lo(w,"255,255,255",.4)},0.6)`;for(const[yo,vo]of[[.27,-.12],[.3,.02],[.26,.16],[.24,-.02]])o.beginPath(),o.arc(yo,vo,.012,0,Math.PI*2),o.fill();o.restore(),o.restore()}o.restore();const ao=Lo(X,"150,140,120",.5);for(const go of[-.08,.08]){o.fillStyle=`rgb(${Lo(w,m,.25)})`,o.beginPath(),o.ellipse(go,-.045,.06,.05,0,0,Math.PI*2),o.fill(),o.strokeStyle=`rgb(${ao})`,o.lineWidth=.022;for(const po of[-.03,0,.03])o.beginPath(),o.moveTo(go+po*.5,-.02),o.quadraticCurveTo(go+po,.01,go+po*1.3,.04),o.stroke();o.strokeStyle="rgb(25,22,20)",o.lineWidth=.012;for(const po of[-.03,0,.03])o.beginPath(),o.moveTo(go+po*1.3,.04),o.lineTo(go+po*1.2,.06),o.stroke()}const ro=l.yaw,Q=l.pitch,so=Math.sin(b*16)*.025*l.bob;o.save(),o.translate(q,-.66+so),o.rotate(l.roll),o.translate(0,.66);const J=ro*.11,oo=Q*.05,Z=o.createRadialGradient(-.08,-.98,.02,0,-.88,.32);if(Z.addColorStop(0,`rgb(${Lo(m,"255,255,255",.1)})`),Z.addColorStop(1,`rgb(${Lo(m,"0,0,0",.28)})`),o.fillStyle=Z,o.beginPath(),o.ellipse(0,-.88,.29*V*(1-Math.abs(ro)*.04),.245*V,0,0,Math.PI*2),o.fill(),g.earTufts)for(const go of[-1,1]){const po=go*.17+J*.45,yo=-1.03,vo=.04*l.alarm;o.fillStyle=`rgb(${Lo(m,"0,0,0",.2)})`,o.beginPath(),o.moveTo(po-go*.07,yo+.04),o.quadraticCurveTo(po+go*.02,yo-.06,po+go*.09,yo-.15-vo),o.quadraticCurveTo(po+go*.06,yo-.03,po+go*.08,yo+.05),o.closePath(),o.fill(),o.strokeStyle=`rgba(${K},0.6)`,o.lineWidth=.008,o.beginPath(),o.moveTo(po,yo+.02),o.lineTo(po+go*.075,yo-.12-vo),o.stroke()}const no=.112,U=-.875+oo;o.fillStyle=`rgb(${Lo(B,m,.7)})`;for(const go of[-1,1])o.beginPath(),o.arc(go*no+J,U+.005,.148,0,Math.PI*2),o.fill();for(const go of[-1,1]){const po=o.createRadialGradient(go*no+J,U,.05,go*no+J,U,.135);po.addColorStop(0,`rgb(${Lo(B,"0,0,0",.25)})`),po.addColorStop(1,`rgb(${B})`),o.fillStyle=po,o.beginPath(),o.arc(go*no+J,U,.133,0,Math.PI*2),o.fill()}o.strokeStyle=`rgba(${Lo(B,"0,0,0",.35)},0.35)`,o.lineWidth=.006;for(const go of[-1,1]){const po=go*no+J;for(let yo=0;yo<22;yo++){const vo=yo/22*Math.PI*2;o.beginPath(),o.moveTo(po+Math.cos(vo)*.085,U+Math.sin(vo)*.085),o.lineTo(po+Math.cos(vo)*.128,U+Math.sin(vo)*.128),o.stroke()}}o.strokeStyle=`rgba(${Lo(w,"255,255,255",.3)},0.75)`,o.lineWidth=.028,o.beginPath(),o.moveTo(J-.2,U-.12-l.alarm*.025),o.quadraticCurveTo(J-.06,U-.08,J,U+.03),o.quadraticCurveTo(J+.06,U-.08,J+.2,U-.12-l.alarm*.025),o.stroke();const eo=.068*(1+l.alarm*.08);for(const go of[-1,1]){const po=go*no+J*1.05,yo=U;o.fillStyle="rgba(0,0,0,0.65)",o.beginPath(),o.arc(po,yo,eo*1.14,0,Math.PI*2),o.fill(),o.save(),o.beginPath(),o.arc(po,yo,eo,0,Math.PI*2),o.clip();const vo=o.createRadialGradient(po,yo,eo*.2,po,yo,eo);vo.addColorStop(0,`rgb(${Lo(F,"255,255,255",.25)})`),vo.addColorStop(.75,`rgb(${F})`),vo.addColorStop(1,`rgb(${Lo(F,"0,0,0",.45)})`),o.fillStyle=vo,o.fillRect(po-eo,yo-eo,eo*2,eo*2),o.strokeStyle=`rgba(${Lo(F,"0,0,0",.4)},0.4)`,o.lineWidth=.004;for(let $o=0;$o<16;$o++){const io=$o/16*Math.PI*2;o.beginPath(),o.moveTo(po+Math.cos(io)*eo*.4,yo+Math.sin(io)*eo*.4),o.lineTo(po+Math.cos(io)*eo*.95,yo+Math.sin(io)*eo*.95),o.stroke()}if(o.fillStyle="rgb(6,5,6)",o.beginPath(),o.arc(po,yo,eo*dt(l.pupil,.15,.85),0,Math.PI*2),o.fill(),o.fillStyle="rgba(255,255,255,0.85)",o.beginPath(),o.arc(po-eo*.32,yo-eo*.36,eo*.18,0,Math.PI*2),o.fill(),o.fillStyle="rgba(255,255,255,0.4)",o.beginPath(),o.arc(po+eo*.3,yo+eo*.32,eo*.07,0,Math.PI*2),o.fill(),N>.01){const $o=yo-eo+eo*2*N;o.fillStyle=`rgb(${Lo(B,m,.55)})`,o.fillRect(po-eo,yo-eo,eo*2,eo*2*N),o.strokeStyle="rgba(20,14,10,0.7)",o.lineWidth=.008,o.beginPath(),o.moveTo(po-eo,$o),o.quadraticCurveTo(po,$o+eo*.12,po+eo,$o),o.stroke()}o.restore()}const co=J*1.1,fo=U+.06,mo=o.createLinearGradient(co-.03,fo,co+.03,fo);mo.addColorStop(0,`rgb(${Lo(X,"255,255,255",.25)})`),mo.addColorStop(1,`rgb(${Lo(X,"0,0,0",.3)})`),o.fillStyle=mo,o.beginPath(),o.moveTo(co-.032,fo-.035),o.quadraticCurveTo(co-.02,fo+.04,co+.004,fo+.075),o.quadraticCurveTo(co+.02,fo+.03,co+.032,fo-.035),o.closePath(),o.fill(),o.fillStyle=`rgb(${Lo(B,"255,255,255",.15)})`,o.beginPath(),o.ellipse(co,fo-.04,.045,.025,0,0,Math.PI*2),o.fill(),o.restore(),o.restore()}const P=To({overlay:t.overlay,collide:t.collide,onFrame:y});return v.current=P.canvas,P}const fi={default:{featherColor:"#6b4a33",bellyColor:"#d9bf9a",faceColor:"#c48a52",eyeColor:"#f2a516",beakColor:"#3a3330",branchColor:"#3b2a1e",backgroundColor:"#070a12",earTufts:!0},monochrome:{},tawny:{featherColor:"#7f5539",bellyColor:"#cfae86",faceColor:"#b08660",eyeColor:"#3a2416",beakColor:"#d8c7a8",branchColor:"#3b2a1e",backgroundColor:"#080a0c",earTufts:!1},snowy:{featherColor:"#e6e8ec",bellyColor:"#f7f8fa",faceColor:"#f3f4f6",eyeColor:"#f5c518",beakColor:"#2b2b2b",branchColor:"#4a4540",backgroundColor:"#0a1220",earTufts:!1},barn:{featherColor:"#c99a5b",bellyColor:"#f3e9da",faceColor:"#f7f1e8",eyeColor:"#1a120c",beakColor:"#e8d2b5",branchColor:"#3d2b1c",backgroundColor:"#0b0a10",earTufts:!1},spirit:{featherColor:"#3a3f6b",bellyColor:"#8a9ad8",faceColor:"#6c7bc4",eyeColor:"#7af0ff",beakColor:"#c9d2ff",branchColor:"#1b1d33",backgroundColor:"#03040c",earTufts:!0}},Jr=Y.forwardRef((t,u)=>{const{preset:s,featherColor:v,bellyColor:k,faceColor:e,eyeColor:y,beakColor:P,branchColor:o,backgroundColor:n,earTufts:a,size:i,followCursor:r,blinkInterval:g,overlay:l,collide:h,zIndex:f,width:b,height:m,className:w,style:B}=t,F=fi[s??"default"]||{},{canvasRef:X,canvas:O}=ci({featherColor:v??F.featherColor??"#6b7280",bellyColor:k??F.bellyColor??"#d1d5db",faceColor:e??F.faceColor??"#9ca3af",eyeColor:y??F.eyeColor??"#e5e7eb",beakColor:P??F.beakColor??"#374151",branchColor:o??F.branchColor??"#4b5563",backgroundColor:n??F.backgroundColor??"#111111",earTufts:a??F.earTufts??!0,size:i??1,followCursor:r??!0,blinkInterval:g??5e3,overlay:l??!1,collide:h??!1});return Y.useImperativeHandle(u,()=>O,[O]),Mo.jsx(Io,{canvasRef:X,overlay:l,zIndex:f,width:b,height:m,className:w,style:B})});Jr.displayName="Owl";const Ho=24,Oo=(t,u,s)=>{const v=t.split(",").map(Number),k=u.split(",").map(Number);return v.map((e,y)=>Math.round(e+(k[y]-e)*s)).join(",")},Be=t=>t.startsWith("#")?xo(t):"255,255,255",pe=(t,u,s)=>Math.max(u,Math.min(s,t));function di(t,u,s,v,k=2){const e=t.length-1;for(let y=0;y<k;y++){t[e].x=s.x,t[e].y=s.y;for(let P=e-1;P>=0;P--){const o=t[P].x-t[P+1].x,n=t[P].y-t[P+1].y,a=Math.hypot(o,n)||1;t[P].x=t[P+1].x+o/a*v,t[P].y=t[P+1].y+n/a*v}t[0].x=u.x,t[0].y=u.y;for(let P=1;P<=e;P++){const o=t[P].x-t[P-1].x,n=t[P].y-t[P-1].y,a=Math.hypot(o,n)||1;t[P].x=t[P-1].x+o/a*v,t[P].y=t[P-1].y+n/a*v}}}function hi(t,u){const s=pe(u.x,t.x,t.x+t.w),v=pe(u.y,t.y,t.y+t.h);if(s>t.x&&s<t.x+t.w&&v>t.y&&v<t.y+t.h){const k=s-t.x,e=t.x+t.w-s,y=v-t.y,P=t.y+t.h-v,o=Math.min(k,e,y,P);return o===k?{x:t.x,y:v}:o===e?{x:t.x+t.w,y:v}:o===y?{x:s,y:t.y}:{x:s,y:t.y+t.h}}return{x:s,y:v}}const At=(t,u)=>t*.16*Math.pow(1-u/Ho,1.1)+t*.006;function Oe(t,u,s){s?t.moveTo(u[0].x,u[0].y):t.lineTo(u[0].x,u[0].y);for(let v=1;v<u.length-1;v++)t.quadraticCurveTo(u[v].x,u[v].y,(u[v].x+u[v+1].x)/2,(u[v].y+u[v+1].y)/2);t.lineTo(u[u.length-1].x,u[u.length-1].y)}function ui(t){const u=Y.useRef(t);u.current=t;const s=Eo(),v=Y.useRef(null),k=Y.useRef({t:0,x:-1,y:-1,vx:0,vy:0,ang:-Math.PI/2,pulse:0,jetIn:.5,pale:0,excite:0,inkFor:0,inkDir:0,blinkAt:-9,nextBlink:3,arms:[],ink:[],spots:[],bumps:[],snow:[],w:0,h:0});function e(o,n){const a=k.current;a.w=o,a.h=n;let i=21;const r=()=>((i=i*16807%2147483647)-1)/2147483646;if(!a.arms.length){const g=()=>Array.from({length:Ho+1},()=>({x:0,y:0}));a.arms=Array.from({length:8},(l,h)=>{const f=(h<4?-1:1)*(1.2+r()*1.6);return{spread:(h/7-.5)*2,phase:r()*6,curl:f,curlTo:f,lift:0,liftTo:0,nextMood:1+r()*4,pts:g(),pose:g(),tmp:g(),anchor:null,reach:0}}),a.spots=Array.from({length:22},()=>({a:r()*Math.PI*2,r:Math.sqrt(r())*.85,size:.02+r()*.035,ph:r()*6})),a.bumps=Array.from({length:46},()=>({a:r()*Math.PI*2,r:Math.sqrt(r())*.9,size:.01+r()*.022}))}a.snow=Array.from({length:45},()=>({x:r()*o,y:r()*n,r:.4+r()*1.3,v:4+r()*10})),a.x<0&&(a.x=o/2,a.y=n*.42);for(const g of a.arms)for(const l of g.pts)l.x=a.x,l.y=a.y}function y(o,n,a,i,r){const g=u.current,l=k.current,h=i/1e3;l.t+=h;const f=l.t;(l.w!==n||l.h!==a)&&e(n,a);const b=Be(g.skinColor),m=Be(g.spotColor),w=Be(g.suckerColor),B=Be(g.eyeColor),F=Be(g.inkColor),X=Be(g.backgroundColor==="transparent"?"#000000":g.backgroundColor),O=Math.max(12,(r.overlay?70:Math.min(n,a)*.17)*pe(g.size,.2,2.5)),_=O*2.5*pe(g.tentacleLength,.3,2),H=_/Ho,D=zo(s.current,v.current),W=D.inside&&g.followCursor,A=Math.hypot(D.x-l.x,D.y-l.y);if(l.excite+=((W&&A<_*1.3?1:0)-l.excite)*Math.min(1,h*2),g.interactive&&D.taps.length){const io=D.taps[D.taps.length-1],ho=l.x-io.x,Co=l.y-io.y,bo=Math.hypot(ho,Co)||1;l.vx+=ho/bo*650,l.vy+=Co/bo*650,l.pulse=1,l.pale=1,l.jetIn=1.2,l.inkFor=.4,l.inkDir=Math.atan2(-Co,-ho);for(const Ao of l.arms)Ao.anchor=null}l.pale*=Math.exp(-h*1.3);let T,E;if(W){const io=A||1;T=D.x+(l.x-D.x)/io*_*.75,E=D.y+(l.y-D.y)/io*_*.75}else T=n*(.5+.18*Math.sin(f*.13)),E=a*(.42+.1*Math.sin(f*.21+1));T=pe(T,O,n-O),E=pe(E,O*1.2,a-O*.5),l.jetIn-=h;const x=Math.hypot(T-l.x,E-l.y);if(x>O*1.1&&l.jetIn<=0){const io=Math.min(x*2.4,520);l.vx+=(T-l.x)/x*io,l.vy+=(E-l.y)/x*io,l.pulse=1,l.jetIn=.8+Math.random()*.4}l.vx+=(T-l.x)*.4*h,l.vy+=(E-l.y)*.4*h;for(const io of l.arms)if(io.anchor){const ho=io.anchor.x-l.x,Co=io.anchor.y-l.y,bo=Math.hypot(ho,Co);bo>_*.6&&(l.vx+=ho/bo*(bo-_*.6)*2*h,l.vy+=Co/bo*(bo-_*.6)*2*h)}const I=Math.exp(-h*1.8);l.vx*=I,l.vy*=I,l.x+=l.vx*h,l.y+=l.vy*h+Math.sin(f*.9)*4*h;const M={x:O*.7,y:O*1.3},p={x:n-O*.7,y:a-O*.4};(l.x<M.x||l.x>p.x)&&(l.x=pe(l.x,M.x,p.x),l.vx*=-.3),(l.y<M.y||l.y>p.y)&&(l.y=pe(l.y,M.y,p.y),l.vy*=-.3),l.pulse*=Math.exp(-h*2.5);const R=Math.hypot(l.vx,l.vy);let d=(R>70?Math.atan2(l.vy,l.vx):-Math.PI/2+Math.sin(f*.5)*.12)-l.ang;d=Math.atan2(Math.sin(d),Math.cos(d)),l.ang+=d*Math.min(1,h*3);const $=Math.cos(l.ang),C=Math.sin(l.ang),S=-C,N=$,z=pe((R-60)/300,0,1),L=Math.sin(f*1.3),G=[];W&&A<_*1.1&&(l.arms.forEach((io,ho)=>G.push({i:ho,d:Math.hypot(io.pts[Ho].x-D.x,io.pts[Ho].y-D.y)})),G.sort((io,ho)=>io.d-ho.d));const q=new Set(G.slice(0,2).map(io=>io.i)),j=1-Math.exp(-h*12);if(l.arms.forEach((io,ho)=>{io.nextMood-=h,io.nextMood<=0&&(io.curlTo=Math.sign(io.spread||1)*(.4+Math.random()*3)*(Math.random()<.2?-1:1),io.liftTo=Math.random()<.18?-Math.sign(io.spread||1)*(.6+Math.random()*.8):0,io.nextMood=2+Math.random()*4),io.curl+=(io.curlTo-io.curl)*Math.min(1,h*.7),io.lift+=(io.liftTo-io.lift)*Math.min(1,h*.9);const Co={x:l.x-$*O*.15+S*io.spread*O*.3,y:l.y-C*O*.15+N*io.spread*O*.3};let bo=Math.atan2(-C,-$)+io.spread*(1.4-z*1.2)+io.lift*(1-z);const Ao=io.pose;Ao[0].x=Co.x,Ao[0].y=Co.y;for(let wo=0;wo<Ho;wo++){const Do=wo/Ho;bo+=(Math.sin(f*1.5+io.phase-wo*.32)*.12*(1-z*.7)+io.curl*Math.pow(Do,2.6)*.2*(1-z))*(.3+Do),Ao[wo+1].x=Ao[wo].x+Math.cos(bo)*H,Ao[wo+1].y=Ao[wo].y+Math.sin(bo)*H}if(g.collide){if(io.anchor)(!r.solids.find(Do=>Do.id===io.anchor.id)||Math.hypot(io.anchor.x-Co.x,io.anchor.y-Co.y)>_*1.02||Math.random()<.06*h)&&(io.anchor=null);else if(!q.has(ho)&&Math.random()<1.5*h){let wo=null,Do=_*.9;for(const _o of r.solids){const oe=hi(_o,Ao[Ho]),So=Math.hypot(oe.x-Co.x,oe.y-Co.y);So<Do&&(Do=So,wo={...oe,id:_o.id})}io.anchor=wo}}else io.anchor=null;let Xo=null;if(q.has(ho)){const wo=O*.18;Xo={x:D.x+Math.cos(f*3+ho)*wo,y:D.y+Math.sin(f*3+ho)*wo}}else io.anchor&&(Xo=io.anchor);if(io.reach+=((Xo?1:0)-io.reach)*Math.min(1,h*4),Xo){for(let wo=0;wo<=Ho;wo++)io.tmp[wo].x=Ao[wo].x,io.tmp[wo].y=Ao[wo].y;di(io.tmp,Co,Xo,H,3);for(let wo=0;wo<=Ho;wo++)Ao[wo].x+=(io.tmp[wo].x-Ao[wo].x)*io.reach,Ao[wo].y+=(io.tmp[wo].y-Ao[wo].y)*io.reach}io.pts[0].x=Co.x,io.pts[0].y=Co.y;for(let wo=1;wo<=Ho;wo++)io.pts[wo].x+=(Ao[wo].x-io.pts[wo].x)*j,io.pts[wo].y+=(Ao[wo].y-io.pts[wo].y)*j}),o.globalCompositeOperation="source-over",o.globalAlpha=1,!r.overlay&&g.backgroundColor!=="transparent"){const io=o.createLinearGradient(0,0,0,a);io.addColorStop(0,`rgb(${Oo(X,"60,150,180",.16)})`),io.addColorStop(1,`rgb(${Oo(X,"0,0,0",.35)})`),o.fillStyle=io,o.fillRect(0,0,n,a),o.globalCompositeOperation="lighter";for(let ho=0;ho<5;ho++){const Co=n*(.1+ho*.2)+Math.sin(f*.25+ho*1.7)*n*.04,bo=n*(.05+ho%2*.04),Ao=o.createLinearGradient(0,0,0,a*.85);Ao.addColorStop(0,`rgba(160,220,240,${.06+.02*Math.sin(f*.8+ho)})`),Ao.addColorStop(1,"rgba(160,220,240,0)"),o.fillStyle=Ao,o.beginPath(),o.moveTo(Co-bo*.3,0),o.lineTo(Co+bo*.3,0),o.lineTo(Co+bo*1.6,a*.85),o.lineTo(Co-bo*.4,a*.85),o.closePath(),o.fill()}o.globalCompositeOperation="source-over",o.fillStyle="rgba(210,230,240,0.35)";for(const ho of l.snow)ho.y+=ho.v*h,ho.x+=Math.sin(f*.5+ho.r*9)*3*h,ho.y>a+2&&(ho.y=-2,ho.x=Math.random()*n),o.beginPath(),o.arc(ho.x,ho.y,ho.r,0,Math.PI*2),o.fill()}const K=Oo(Oo(b,Oo(b,"60,10,10",.35),l.excite*.5),"245,240,235",l.pale*.7),to=Oo(K,"0,0,0",.38),lo=Oo(K,w,.45);o.lineCap="round",o.lineJoin="round";const ao=l.arms.map((io,ho)=>ho).sort((io,ho)=>l.arms[io].spread-l.arms[ho].spread),ro=Math.round(Ho*.26);o.fillStyle=`rgb(${Oo(K,to,.45)})`;for(let io=0;io<ao.length-1;io++){const ho=l.arms[ao[io]].pts,Co=l.arms[ao[io+1]].pts,bo={x:(ho[ro>>1].x+Co[ro>>1].x)/2,y:(ho[ro>>1].y+Co[ro>>1].y)/2};o.beginPath(),Oe(o,ho.slice(0,ro+1),!0),o.quadraticCurveTo(bo.x,bo.y,Co[ro].x,Co[ro].y),Oe(o,Co.slice(0,ro+1).reverse(),!1),o.closePath(),o.fill()}const Q=l.arms.map((io,ho)=>ho).sort((io,ho)=>io%2-ho%2||io-ho).reverse();for(const io of Q){const ho=l.arms[io].pts,Co=io%2===1,bo=[],Ao=[],Xo=[],wo=[];for(let So=0;So<=Ho;So++){const Uo=ho[Math.max(0,So-1)],Ko=ho[Math.min(Ho,So+1)],jo=Ko.x-Uo.x,re=Ko.y-Uo.y,se=Math.hypot(jo,re)||1,le=-re/se,de=jo/se,Ro=At(O,So);wo.push({x:le,y:de}),bo.push({x:ho[So].x+le*Ro,y:ho[So].y+de*Ro}),Ao.push({x:ho[So].x-le*Ro,y:ho[So].y-de*Ro}),Xo.push({x:ho[So].x-le*Ro*.1,y:ho[So].y-de*Ro*.1})}const Do=Co?Oo(K,"0,0,0",.3):K,_o=o.createLinearGradient(ho[0].x,ho[0].y,ho[Ho].x,ho[Ho].y);_o.addColorStop(0,`rgb(${Oo(Do,to,.4)})`),_o.addColorStop(.45,`rgb(${Do})`),_o.addColorStop(1,`rgb(${Oo(Do,"255,225,215",.18)})`),o.fillStyle=_o,o.beginPath(),Oe(o,bo,!0),Oe(o,Ao.slice().reverse(),!1),o.closePath(),o.fill(),o.fillStyle=`rgba(${Co?Oo(lo,"0,0,0",.3):lo},0.75)`,o.beginPath(),Oe(o,Xo.slice(0,Ho-1),!0),Oe(o,Ao.slice(0,Ho-1).reverse(),!1),o.closePath(),o.fill();for(let So=1;So<Ho-2;So++){const Uo=At(O,So),Ko={x:ho[So].x+wo[So].x*Uo*.55,y:ho[So].y+wo[So].y*Uo*.55},jo={x:ho[So+1].x+wo[So+1].x*Uo*.55,y:ho[So+1].y+wo[So+1].y*Uo*.55};o.strokeStyle=`rgba(${Oo(Do,"255,255,255",.45)},${.22*(1-So/Ho)})`,o.lineWidth=Math.max(.5,Uo*.28),o.beginPath(),o.moveTo(Ko.x,Ko.y),o.lineTo(jo.x,jo.y),o.stroke()}const oe=Co?Oo(w,"0,0,0",.3):w;for(let So=2;So<Ho-1;So++){const Uo=At(O,So),Ko=So%2?.6:.3,jo=Uo*(So%2?.34:.28);if(jo<.6)continue;const re=ho[So].x-wo[So].x*Uo*Ko,se=ho[So].y-wo[So].y*Uo*Ko;o.fillStyle=`rgb(${oe})`,o.beginPath(),o.arc(re,se,jo,0,Math.PI*2),o.fill(),o.fillStyle=`rgba(${Oo(oe,to,.55)},0.85)`,o.beginPath(),o.arc(re-wo[So].x*jo*.12,se-wo[So].y*jo*.12,jo*.5,0,Math.PI*2),o.fill(),o.fillStyle="rgba(255,255,255,0.35)",o.beginPath(),o.arc(re+wo[So].x*jo*.4,se+wo[So].y*jo*.4,jo*.22,0,Math.PI*2),o.fill()}}const so=l.pulse,J=l.ang+Math.PI/2,oo=-Math.sin(J),Z=-Math.cos(J);o.save(),o.translate(l.x,l.y),o.rotate(J);const no=(1-.16*so)*(1+.035*L),U=1+.1*so,eo=()=>{o.beginPath(),o.moveTo(-O*.3,-O*.16),o.bezierCurveTo(-O*.6*no,-O*.36,-O*.56*no,-O*1.24*U,0,-O*1.22*U),o.bezierCurveTo(O*.56*no,-O*1.24*U,O*.6*no,-O*.36,O*.3,-O*.16),o.closePath()},co=o.createRadialGradient(oo*O*.2,-O*.05+Z*O*.15,O*.04,0,0,O*.5);co.addColorStop(0,`rgb(${Oo(K,"255,255,255",.15)})`),co.addColorStop(1,`rgb(${to})`),o.fillStyle=co,o.beginPath(),o.ellipse(0,-O*.02,O*.42,O*.3,0,0,Math.PI*2),o.fill();const fo=O*.1*(1+.6*so+.12*L);o.save(),o.translate(O*.34,O*.06),o.rotate(.5),o.fillStyle=`rgb(${Oo(K,to,.45)})`,o.beginPath(),o.ellipse(fo*.5,0,fo*.75,O*.05,0,0,Math.PI*2),o.fill(),o.fillStyle=`rgb(${Oo(to,"0,0,0",.5)})`,o.beginPath(),o.ellipse(fo*1.15,0,O*.015,O*.035,0,0,Math.PI*2),o.fill(),o.restore(),eo();const mo=o.createRadialGradient(oo*O*.32,-O*.66+Z*O*.32,O*.05,0,-O*.6,O*.85);mo.addColorStop(0,`rgb(${Oo(K,"255,255,255",.25)})`),mo.addColorStop(.55,`rgb(${K})`),mo.addColorStop(1,`rgb(${to})`),o.fillStyle=mo,o.fill(),o.save(),o.clip();for(const io of l.bumps){const ho=Math.cos(io.a)*io.r*O*.48*no,Co=-O*.66*U+Math.sin(io.a)*io.r*O*.52*U,bo=O*io.size;o.fillStyle=`rgba(${to},0.35)`,o.beginPath(),o.arc(ho-oo*bo*.4,Co-Z*bo*.4,bo,0,Math.PI*2),o.fill(),o.fillStyle=`rgba(${Oo(K,"255,255,255",.35)},0.5)`,o.beginPath(),o.arc(ho+oo*bo*.3,Co+Z*bo*.3,bo*.7,0,Math.PI*2),o.fill()}const go=.3+.7*Math.max(l.excite,l.pale*.5);for(const io of l.spots){const ho=Math.cos(io.a)*io.r*O*.46*no,Co=-O*.66*U+Math.sin(io.a)*io.r*O*.5*U,bo=go*(.55+.45*Math.sin(f*2.2+io.ph));o.strokeStyle=`rgba(${m},${bo})`,o.lineWidth=Math.max(.5,O*io.size*.4),o.fillStyle=`rgba(${Oo(m,K,.55)},${bo*.4})`,o.beginPath(),o.arc(ho,Co,O*io.size,0,Math.PI*2),o.fill(),o.stroke()}if(l.excite>.05)for(let io=0;io<2;io++){const ho=(f*.9+io*.5)%1,Co=-O*1.25*U+ho*O*1.15,bo=o.createLinearGradient(0,Co-O*.16,0,Co+O*.16);bo.addColorStop(0,`rgba(${to},0)`),bo.addColorStop(.5,`rgba(${Oo(to,"20,0,0",.4)},${.38*l.excite})`),bo.addColorStop(1,`rgba(${to},0)`),o.fillStyle=bo,o.fillRect(-O,Co-O*.16,O*2,O*.32)}o.restore(),o.strokeStyle=`rgba(${to},0.55)`,o.lineWidth=O*.022,o.beginPath(),o.ellipse(0,-O*.14,O*.34,O*.09,0,Math.PI*1.1,Math.PI*1.9),o.stroke(),l.nextBlink-=h,l.nextBlink<=0&&(l.blinkAt=f,l.nextBlink=4+Math.random()*5);const po=f-l.blinkAt,yo=po<.12?po/.12:po<.32?1-(po-.12)/.2:0;for(const io of[-1,1]){const ho=io*O*.33,Co=-O*.1,bo=O*.13,Ao=o.createRadialGradient(ho+oo*bo*.5,Co+Z*bo*.5,bo*.3,ho,Co,bo*1.5);Ao.addColorStop(0,`rgb(${Oo(K,"255,255,255",.15)})`),Ao.addColorStop(1,`rgb(${Oo(K,to,.4)})`),o.fillStyle=Ao,o.beginPath(),o.arc(ho,Co,bo*1.45,0,Math.PI*2),o.fill(),o.fillStyle=`rgb(${Oo(K,to,.2)})`,o.beginPath(),o.moveTo(ho-io*bo*.5,Co-bo*1.25),o.lineTo(ho+io*bo*.15,Co-bo*2),o.lineTo(ho+io*bo*.55,Co-bo*1.2),o.closePath(),o.fill(),o.save(),o.beginPath(),o.arc(ho,Co,bo,0,Math.PI*2),o.clip();const Xo=o.createRadialGradient(ho,Co,0,ho,Co,bo);Xo.addColorStop(0,`rgb(${Oo(B,"255,255,255",.4)})`),Xo.addColorStop(.75,`rgb(${B})`),Xo.addColorStop(1,`rgb(${Oo(B,"0,0,0",.4)})`),o.fillStyle=Xo,o.fillRect(ho-bo,Co-bo,bo*2,bo*2),o.strokeStyle=`rgba(${Oo(B,"0,0,0",.4)},0.35)`,o.lineWidth=Math.max(.4,bo*.04);for(let Do=0;Do<14;Do++){const _o=Do/14*Math.PI*2;o.beginPath(),o.moveTo(ho+Math.cos(_o)*bo*.45,Co+Math.sin(_o)*bo*.45),o.lineTo(ho+Math.cos(_o)*bo*.92,Co+Math.sin(_o)*bo*.92),o.stroke()}o.save(),o.translate(ho,Co),o.rotate(-J);const wo=bo*(.3+.4*Math.max(l.excite*.6,l.pale));o.fillStyle="rgb(8,6,8)",o.beginPath(),o.ellipse(0,0,bo*.42,wo*.42,0,0,Math.PI*2),o.fill();for(const Do of[-1,1])o.beginPath(),o.arc(Do*bo*.36,0,wo*.6,0,Math.PI*2),o.fill();o.restore(),o.fillStyle="rgba(255,255,255,0.75)",o.beginPath(),o.arc(ho+oo*bo*.4-io*bo*.15,Co+Z*bo*.4,bo*.16,0,Math.PI*2),o.fill(),yo>0&&(o.fillStyle=`rgb(${Oo(K,to,.3)})`,o.fillRect(ho-bo,Co-bo,bo*2,bo*2*yo)),o.restore(),o.strokeStyle=`rgba(${to},0.7)`,o.lineWidth=Math.max(.6,bo*.1),o.beginPath(),o.arc(ho,Co,bo*1.12,Math.PI*1.15,Math.PI*1.85),o.stroke()}o.restore();const vo=l.x+Math.cos(J)*O*.45-Math.sin(J)*O*.14,$o=l.y+Math.sin(J)*O*.45+Math.cos(J)*O*.14;if(l.inkFor>0){l.inkFor-=h;for(let io=0;io<3&&l.ink.length<140;io++){const ho=140+Math.random()*160,Co=l.inkDir+(Math.random()-.5)*.7;l.ink.push({x:vo,y:$o,vx:Math.cos(Co)*ho,vy:Math.sin(Co)*ho,r:O*(.06+Math.random()*.08),life:1,dark:.6+Math.random()*.4})}}for(let io=l.ink.length-1;io>=0;io--){const ho=l.ink[io];if(ho.life-=h/5,ho.life<=0){l.ink.splice(io,1);continue}const Co=Math.exp(-h*2.6);ho.vx*=Co,ho.vy*=Co,ho.x+=ho.vx*h+Math.sin(f*.7+io)*4*h,ho.y+=ho.vy*h-4*h,ho.r+=O*(.05+.25*(1-ho.life))*h*2;const bo=o.createRadialGradient(ho.x,ho.y,0,ho.x,ho.y,ho.r);bo.addColorStop(0,`rgba(${F},${.6*ho.life*ho.dark})`),bo.addColorStop(.55,`rgba(${F},${.32*ho.life*ho.dark})`),bo.addColorStop(1,`rgba(${F},0)`),o.fillStyle=bo,o.beginPath(),o.arc(ho.x,ho.y,ho.r,0,Math.PI*2),o.fill()}}const P=To({overlay:t.overlay,collide:t.collide,onResize:e,onFrame:y});return v.current=P.canvas,P}const gi={default:{skinColor:"#c4553a",spotColor:"#7a2a1c",suckerColor:"#f2c4a8",eyeColor:"#e8c25a",inkColor:"#140b12",backgroundColor:"#04131c"},monochrome:{},"blue-ringed":{skinColor:"#d9b44a",spotColor:"#2fb8ff",suckerColor:"#f3e2b0",eyeColor:"#f0d070",inkColor:"#0d0a12",backgroundColor:"#03121a"},ghost:{skinColor:"#d8dde6",spotColor:"#9fb4d8",suckerColor:"#ffffff",eyeColor:"#b8e6ff",inkColor:"#1a1f2e",backgroundColor:"#020812"},abyss:{skinColor:"#5b2f7a",spotColor:"#e05cff",suckerColor:"#d7b6f0",eyeColor:"#ffcf5a",inkColor:"#05030a",backgroundColor:"#02030a"},sand:{skinColor:"#b89a72",spotColor:"#5e4630",suckerColor:"#efe0c8",eyeColor:"#e2c27a",inkColor:"#120d08",backgroundColor:"#0b0f12"}},Qr=Y.forwardRef((t,u)=>{const{preset:s,skinColor:v,spotColor:k,suckerColor:e,eyeColor:y,inkColor:P,backgroundColor:o,size:n,tentacleLength:a,followCursor:i,interactive:r,overlay:g,collide:l,zIndex:h,width:f,height:b,className:m,style:w}=t,B=gi[s??"default"]||{},{canvasRef:F,canvas:X}=ui({skinColor:v??B.skinColor??"#9ca3af",spotColor:k??B.spotColor??"#4b5563",suckerColor:e??B.suckerColor??"#e5e7eb",eyeColor:y??B.eyeColor??"#d1d5db",inkColor:P??B.inkColor??"#0a0a0a",backgroundColor:o??B.backgroundColor??"#111111",size:n??1,tentacleLength:a??1,followCursor:i??!0,interactive:r??!0,overlay:g??!1,collide:l??!1});return Y.useImperativeHandle(u,()=>X,[X]),Mo.jsx(Io,{canvasRef:F,overlay:g,zIndex:h,width:f,height:b,className:m,style:w})});Qr.displayName="Octopus";const Bo=(t,u,s)=>{const v=t.split(",").map(Number),k=u.split(",").map(Number);return v.map((e,y)=>Math.round(e+(k[y]-e)*s)).join(",")},Ye=t=>t.startsWith("#")?xo(t):"255,255,255",ne=(t,u,s)=>Math.max(u,Math.min(s,t));function In(t){const u=[];for(const s of t)u.push({x:s.x-2,y:s.y+s.h/2,face:1,key:`s${s.id}L`}),u.push({x:s.x+s.w+2,y:s.y+s.h/2,face:-1,key:`s${s.id}R`});return u}const Et=-.28,Tn=1;function An(t,u){t.beginPath(),t.moveTo(0,-.03),t.bezierCurveTo(.2*u,-.075,.5*u,-.08,.66*u,-.03),t.quadraticCurveTo(.7*u,.01,.62*u,.04);for(let s=0;s<4;s++){const v=.62*u-(s+1)*.12*u;t.quadraticCurveTo(v+.06*u,.07,v,.05+s*.004)}t.lineTo(0,.035),t.closePath()}function pi(t){const u=Y.useRef(t);u.current=t;const s=Eo(),v=Y.useRef(null),k=Y.useRef(Vo()),e=Y.useRef({t:0,birds:[],flowers:[],pollen:[],bokeh:[],w:0,h:0});function y(r,g){const l=e.current;l.w=r,l.h=g;let h=13;const f=()=>((h=h*16807%2147483647)-1)/2147483646,b=ne(Math.round(r/190),2,6);l.flowers=Array.from({length:b},(m,w)=>{const B=(w+.5)/b*r+(f()-.5)*(r/b)*.4,F=w%2?-1:1,X=[{t:1,dir:F,droop:.25,bud:!1}];return f()<.7&&X.push({t:.72,dir:-F,droop:.5,bud:f()<.5}),f()<.5&&X.push({t:.86,dir:F,droop:.9,bud:!0}),{bx:B,nx:B-F*r*.02,ny:g*(.3+f()*.32),dir:F,phase:f()*6,bob:0,blooms:X}}),l.bokeh=Array.from({length:18},()=>({x:f()*r,y:f()*g,r:(14+f()*50)*Math.max(.6,Math.min(r,g)/420),a:.03+f()*.06,warm:f()<.45}));for(const m of l.birds)m.x=ne(m.x,0,r),m.y=ne(m.y,0,g)}function P(r,g){return{x:r*(.2+Math.random()*.6),y:g*(.25+Math.random()*.4),vx:0,vy:0,facing:1,tilt:-.9,seed:Math.random()*10,mode:"hover",timer:.4+Math.random(),aim:null,tx:0,ty:0,settled:!1,backout:0,tailSpread:.5,rival:-1}}function o(r,g,l,h,f,b,m,w,B){const F=e.current,X=b*.85,O=Bo("58,112,64",w,.25);F.flowers.forEach((_,H)=>{_.bob*=Math.exp(-f*3);const D=Math.sin(h*.7+_.phase)*.05+_.bob*Math.sin(h*9)*.05,W=_.nx+D*l*.15,A=_.ny,T={x:_.bx+_.dir*g*.03,y:(l+A)/2},E=x=>({x:(1-x)*(1-x)*_.bx+2*(1-x)*x*T.x+x*x*W,y:(1-x)*(1-x)*(l+4)+2*(1-x)*x*T.y+x*x*A});r.lineCap="round";for(const[x,I]of[[b*.07,1],[b*.03,.5]])r.strokeStyle=I===1?`rgb(${O})`:`rgba(${Bo(O,"255,255,210",.35)},0.5)`,r.lineWidth=Math.max(1,x),r.beginPath(),r.moveTo(_.bx,l+4),r.quadraticCurveTo(T.x,T.y,W,A),r.stroke();for(const[x,I]of[[.3,1],[.5,-1],[.68,1]]){const M=E(x),p=(I*.9-.5+D)*(_.dir>0?1:-1)-Math.PI/2+I*1.2,R=b*.55;r.save(),r.translate(M.x,M.y),r.rotate(p);const c=r.createLinearGradient(0,-R*.15,0,R*.15);c.addColorStop(0,`rgb(${Bo(O,"200,230,150",.2)})`),c.addColorStop(1,`rgb(${Bo(O,"0,0,0",.3)})`),r.fillStyle=c,r.beginPath(),r.moveTo(0,0),r.quadraticCurveTo(R*.45,-R*.24,R,0),r.quadraticCurveTo(R*.45,R*.22,0,0),r.fill(),r.strokeStyle=`rgba(${Bo(O,"255,255,210",.4)},0.45)`,r.lineWidth=Math.max(.5,b*.012),r.beginPath(),r.moveTo(0,0),r.lineTo(R*.9,0),r.stroke(),r.restore()}_.blooms.forEach((x,I)=>{const M=x.t>=1?{x:W,y:A}:E(x.t),p=(x.dir>0?0:Math.PI)+x.dir*x.droop*.6+D,R=Math.cos(p),c=Math.sin(p),d=-c,$=R,C=x.bud?X*.45:X,S=M.x+R*C,N=M.y+c*C,z=x.dir*C*.08;if(x.bud){const q=r.createLinearGradient(M.x-d*C*.2,M.y-$*C*.2,M.x+d*C*.2,M.y+$*C*.2);q.addColorStop(0,`rgb(${Bo(m,"0,0,0",.3)})`),q.addColorStop(.5,`rgb(${Bo(m,"255,210,120",.2)})`),q.addColorStop(1,`rgb(${Bo(m,"0,0,0",.2)})`),r.fillStyle=q,r.save(),r.translate(M.x+R*C*.55,M.y+c*C*.55),r.rotate(p),r.beginPath(),r.moveTo(-C*.55,0),r.bezierCurveTo(-C*.2,-C*.2,C*.35,-C*.18,C*.5,0),r.bezierCurveTo(C*.35,C*.18,-C*.2,C*.2,-C*.55,0),r.fill(),r.restore(),r.fillStyle=`rgb(${Bo(O,"0,0,0",.1)})`,r.beginPath(),r.ellipse(M.x+R*C*.08,M.y+c*C*.08,C*.14,C*.09,p,0,Math.PI*2),r.fill();return}const L=r.createLinearGradient(M.x-d*C*.15,M.y-$*C*.15,M.x+d*C*.15,M.y+$*C*.15);L.addColorStop(0,`rgb(${Bo(m,"0,0,0",.3)})`),L.addColorStop(.5,`rgb(${Bo(m,"255,210,120",x.bud?.1:.25)})`),L.addColorStop(1,`rgb(${Bo(m,"0,0,0",.15)})`),r.fillStyle=L;const G=x.bud?.07:.15;if(r.beginPath(),r.moveTo(M.x+d*C*.04,M.y+$*C*.04),r.quadraticCurveTo(M.x+R*C*.6+d*(C*.05+z),M.y+c*C*.6+$*(C*.05+z),S+d*C*G,N+$*C*G),r.lineTo(S-d*C*G,N-$*C*G),r.quadraticCurveTo(M.x+R*C*.6-d*(C*.05-z),M.y+c*C*.6-$*(C*.05-z),M.x-d*C*.04,M.y-$*C*.04),r.closePath(),r.fill(),r.fillStyle=`rgb(${Bo(O,"0,0,0",.1)})`,r.beginPath(),r.ellipse(M.x+R*C*.06,M.y+c*C*.06,C*.09,C*.05,p,0,Math.PI*2),r.fill(),!x.bud){r.strokeStyle=`rgba(${Bo(m,"60,0,10",.5)},0.35)`,r.lineWidth=Math.max(.4,b*.008);for(const q of[-.05,0,.05])r.beginPath(),r.moveTo(M.x+R*C*.15+d*C*q*.5,M.y+c*C*.15+$*C*q*.5),r.lineTo(S-R*C*.05+d*C*q*1.6,N-c*C*.05+$*C*q*1.6),r.stroke();for(let q=0;q<5;q++){const j=(q/4-.5)*2.4,V=S+d*Math.sin(j)*C*.2+R*Math.cos(j)*C*.04,K=N+$*Math.sin(j)*C*.2+c*Math.cos(j)*C*.04,to=r.createRadialGradient(S,N,0,V,K,C*.14);to.addColorStop(0,`rgb(${Bo(m,"255,220,140",.3)})`),to.addColorStop(1,`rgb(${Bo(m,"255,255,255",.05+q%2*.06)})`),r.fillStyle=to,r.save(),r.translate(V,K),r.rotate(p+j*.65),r.beginPath(),r.ellipse(0,0,C*.085,C*.125,0,0,Math.PI*2),r.fill(),r.restore()}r.fillStyle=`rgba(${Bo(m,"40,0,10",.65)},0.85)`,r.beginPath(),r.ellipse(S,N,C*.05,C*.1,p,0,Math.PI*2),r.fill();for(const q of[-.03,.03]){const j=S+R*C*.24+d*C*q,V=N+c*C*.24+$*C*q;r.strokeStyle="rgba(255,236,190,0.85)",r.lineWidth=Math.max(.5,b*.012),r.beginPath(),r.moveTo(S,N),r.lineTo(j,V),r.stroke(),r.fillStyle="rgb(255,214,90)",r.beginPath(),r.arc(j,V,Math.max(.8,b*.018),0,Math.PI*2),r.fill()}B.push({x:S+R*C*.02,y:N+c*C*.02,face:x.dir>0?-1:1,key:`f${H}.${I}`})}})})}function n(r,g,l,h,f){const b=u.current,m=e.current,w=h/1e3,B=h/16.67;m.t+=w;const F=m.t;(m.w!==g||m.h!==l)&&y(g,l);const X=Ye(b.bodyColor),O=Ye(b.throatColor),_=Ye(b.bellyColor),H=Ye(b.flowerColor),D=Ye(b.backgroundColor==="transparent"?"#000000":b.backgroundColor),W=Math.max(16,(f.overlay?50:Math.min(g,l)*.2)*ne(b.size,.3,2.5));if(r.globalCompositeOperation="source-over",r.globalAlpha=1,!f.overlay&&b.backgroundColor!=="transparent"){const d=r.createLinearGradient(0,0,0,l);d.addColorStop(0,`rgb(${Bo(D,"255,190,120",.1)})`),d.addColorStop(.6,`rgb(${D})`),d.addColorStop(1,`rgb(${Bo(D,"0,0,0",.3)})`),r.fillStyle=d,r.fillRect(0,0,g,l),r.globalCompositeOperation="lighter";for(const $ of m.bokeh){const C=r.createRadialGradient($.x,$.y,0,$.x,$.y,$.r),S=$.warm?"255,200,130":"170,230,150";C.addColorStop(0,`rgba(${S},${$.a})`),C.addColorStop(.7,`rgba(${S},${$.a*.6})`),C.addColorStop(1,`rgba(${S},0)`),r.fillStyle=C,r.beginPath(),r.arc($.x+Math.sin(F*.2+$.r)*6,$.y,$.r,0,Math.PI*2),r.fill()}r.globalCompositeOperation="source-over"}const A=[];b.showFlowers&&o(r,g,l,F,w,W,H,D,A),b.collide&&A.push(...In(f.solids));const T=ne(Math.round(b.birdCount),0,8);for(;m.birds.length<T;)m.birds.push(P(g,l));m.birds.length=T;const E=zo(s.current,v.current),{vx:x,vy:I}=k.current(E,B),M=Math.hypot(x,I),p=b.collide&&E.inside?f.solids.find(d=>E.x>=d.x&&E.x<=d.x+d.w&&E.y>=d.y&&E.y<=d.y+d.h):void 0,R=W*Tn,c=ne(b.speed,.1,4);m.birds.forEach((d,$)=>{var so;const C=d.aim,S=d.settled,N=b.interactive&&E.inside&&!p&&M<4&&Math.hypot(E.x-d.x,E.y-d.y)<W*7;if(b.interactive&&E.inside&&M>14&&Math.hypot(E.x-d.x,E.y-d.y)<W*4&&d.mode!=="flee"){d.mode="flee",d.timer=.6,d.aim=null;const J=Math.atan2(d.y-E.y,d.x-E.x)+(Math.random()-.5);d.tx=ne(d.x+Math.cos(J)*W*6,W,g-W),d.ty=ne(d.y+Math.sin(J)*W*6,W,l-W)}if(m.birds.length>1&&d.mode!=="flee"&&d.mode!=="chase"&&!N&&Math.random()<.06*w){const J=m.birds.findIndex((oo,Z)=>Z!==$&&oo.mode!=="flee"&&Math.hypot(oo.x-d.x,oo.y-d.y)<W*8);if(J>=0){const oo=m.birds[J];d.mode="chase",d.timer=1.3,d.rival=J,d.aim=null,oo.mode="flee",oo.timer=1.1,oo.aim=null;const Z=Math.atan2(oo.y-d.y,oo.x-d.x)+(Math.random()-.5)*.8;oo.tx=ne(oo.x+Math.cos(Z)*W*7,W,g-W),oo.ty=ne(oo.y+Math.sin(Z)*W*5,W,l-W)}}if(d.timer-=w,d.mode==="flee")d.timer<=0&&(d.mode="hover",d.timer=.5);else if(d.mode==="chase"){const J=m.birds[d.rival];!J||d.timer<=0?(d.mode="hover",d.timer=.4):(d.tx=J.x-Math.sign(J.x-d.x||1)*W*.8,d.ty=J.y)}else if(N){const J=d.x<E.x?-1:1;d.tx=E.x+J*W*2.2,d.ty=E.y-W*.3,d.aim=null,d.mode="dart"}else if(d.timer<=0||d.aim&&!A.some(J=>J.key===d.aim.key)||p&&!((so=d.aim)!=null&&so.key.startsWith(`s${p.id}`))){const J=new Set(m.birds.filter(no=>no!==d&&no.aim).map(no=>no.aim.key)),oo=p?In([p]):A.filter(no=>{var U;return!J.has(no.key)&&no.key!==((U=d.aim)==null?void 0:U.key)}),Z=oo.length?oo[Math.floor(Math.random()*oo.length)]:null;Z?(d.aim=Z,d.mode="dart",d.timer=1.4+Math.random()*1.6):(d.aim=null,d.tx=g*(.2+Math.random()*.6),d.ty=l*(.2+Math.random()*.5),d.mode="dart",d.timer=1.5+Math.random())}C&&S&&d.aim!==C&&(d.backout=.32),d.backout>0?(d.backout-=w,d.tx=d.x-Math.sign(d.facing||1)*W*.9,d.ty=d.y-W*.05):d.aim&&(d.tx=d.aim.x-d.aim.face*Math.cos(Et)*R,d.ty=d.aim.y-Math.sin(Et)*R);const z=140*c,L=2*Math.sqrt(z)*.95;d.vx+=((d.tx-d.x)*z-d.vx*L)*w,d.vy+=((d.ty-d.y)*z-d.vy*L)*w;const G=1100*c*Math.max(.6,W/50)*(d.mode==="chase"||d.mode==="flee"?1.2:1),q=Math.hypot(d.vx,d.vy);if(q>G&&(d.vx*=G/q,d.vy*=G/q),d.x+=d.vx*w,d.y+=d.vy*w,d.settled=!!d.aim&&d.backout<=0&&q<40&&Math.hypot(d.tx-d.x,d.ty-d.y)<6,d.settled&&!S&&d.aim){const J=/^f(\d+)\./.exec(d.aim.key);J&&(m.flowers[Number(J[1])].bob=1);for(let oo=0;oo<8&&m.pollen.length<80;oo++){const Z=Math.random()*Math.PI*2,no=10+Math.random()*30;m.pollen.push({x:d.aim.x,y:d.aim.y,vx:Math.cos(Z)*no,vy:Math.sin(Z)*no-10,life:1})}}const j=d.backout>0?Math.sign(d.facing||1):d.aim&&d.settled?d.aim.face:Math.abs(d.vx)>60?Math.sign(d.vx):N?Math.sign(E.x-d.x)||1:d.facing>0?1:-1;d.facing+=(j-d.facing)*Math.min(1,w*12);const V=ne(q/G,0,1),K=d.aim&&d.settled?Et:d.backout>0?-.6:-.95+V*.75+ne(d.vy/G,-.5,.5)*.4;d.tilt+=(K-d.tilt)*Math.min(1,w*10),d.tailSpread+=((V>.35?.15:.75)-d.tailSpread)*Math.min(1,w*8);const to=d.settled?Math.sin(F*6+d.seed)*W*.05:0,lo=(Math.sin(F*3.1+d.seed)*1.2+Math.sin(F*11+d.seed)*.4)*W*.03,ao=(Math.sin(F*4.3+d.seed*2)*1.2+Math.sin(F*13+d.seed)*.4)*W*.03,ro=d.x+lo+Math.cos(d.tilt)*Math.sign(d.facing||1)*to,Q=d.y+ao+Math.sin(d.tilt)*to;a(r,ro,Q,W,d,F,V,X,O,_)});for(let d=m.pollen.length-1;d>=0;d--){const $=m.pollen[d];if($.life-=w*.8,$.life<=0){m.pollen.splice(d,1);continue}$.vx*=Math.exp(-w*2),$.vy=$.vy*Math.exp(-w*2)+12*w,$.x+=$.vx*w,$.y+=$.vy*w,r.fillStyle=`rgba(255,220,110,${$.life*.9})`,r.beginPath(),r.arc($.x,$.y,Math.max(.6,W*.012),0,Math.PI*2),r.fill()}}function a(r,g,l,h,f,b,m,w,B,F){const X=f.facing;r.save(),r.translate(g,l),r.scale(Math.sign(X||1)*Math.max(.25,Math.abs(X)),1),r.rotate(f.tilt),r.scale(h,h),r.lineCap="round",r.lineJoin="round";const O=Bo(w,"0,0,0",.55),_=Bo(O,"190,200,210",.6),H=.5+.5*Math.sin(b*1.3+f.seed+f.tilt*2+f.x*.004),D={x:.03,y:-.1},W=-Math.PI*.56-m*.25,A=1.15-m*.35,T=(R,c)=>{r.fillStyle=`rgba(${_},${R})`;for(let d=0;d<9;d++){const $=Math.cos(Math.PI*(d+.5)/9);r.save(),r.translate(D.x,D.y),r.rotate(W+A*$),An(r,c*(.85+.15*Math.abs($))),r.fill(),r.restore()}};T(.045,.92);const E=Math.sin(b*5+f.seed)*.12*(1-m);for(let R=-2;R<=2;R++){const c=Math.PI+E+R*f.tailSpread*.28;r.save(),r.translate(-.26,0),r.rotate(c),r.fillStyle=`rgb(${Bo(O,w,Math.abs(R)===2?.1:.4)})`,r.beginPath(),r.ellipse(.17,0,.18,.045,0,0,Math.PI*2),r.fill(),Math.abs(R)>=1&&(r.fillStyle="rgba(255,255,255,0.8)",r.beginPath(),r.ellipse(.32,0,.035,.03,0,0,Math.PI*2),r.fill()),r.restore()}r.beginPath(),r.moveTo(.43,-.075),r.bezierCurveTo(.42,-.17,.26,-.2,.19,-.13),r.bezierCurveTo(.08,-.15,-.14,-.12,-.3,-.035),r.lineTo(-.3,.035),r.bezierCurveTo(-.12,.15,.14,.16,.3,.075),r.bezierCurveTo(.37,.04,.42,0,.44,-.02),r.closePath();const x=r.createLinearGradient(0,-.18,0,.15);x.addColorStop(0,`rgb(${Bo(w,"255,255,210",.3*H)})`),x.addColorStop(.42,`rgb(${w})`),x.addColorStop(.62,`rgb(${Bo(w,F,.55)})`),x.addColorStop(.8,`rgb(${F})`),x.addColorStop(1,`rgb(${Bo(F,"0,0,0",.2)})`),r.fillStyle=x,r.fill(),r.save(),r.clip(),r.strokeStyle=`rgba(${Bo(w,"255,255,220",.5)},${.15+.3*H})`,r.lineWidth=.008;for(let R=0;R<4;R++)for(let c=0;c<7;c++){const d=-.22+c*.075+R%2*.035,$=-.12+R*.035;r.beginPath(),r.arc(d,$,.03,.3,Math.PI-.3),r.stroke()}const I=.15+.85*Math.pow(Math.max(0,Math.sin(b*1.7+f.x*.012+f.tilt*3+f.seed)),2)*(f.settled?1.1:1);r.beginPath(),r.moveTo(.44,-.03),r.quadraticCurveTo(.38,.07,.2,.1),r.quadraticCurveTo(.2,0,.3,-.04),r.closePath();const M=r.createRadialGradient(.33,.03,0,.33,.03,.15);M.addColorStop(0,`rgb(${Bo(Bo(B,"0,0,0",.75),Bo(B,"255,255,255",.3),ne(I,0,1))})`),M.addColorStop(1,`rgb(${Bo(B,"0,0,0",.8-I*.4)})`),r.fillStyle=M,r.fill(),r.strokeStyle=`rgba(${Bo(B,"255,255,255",.6)},${.35*I})`,r.lineWidth=.006;for(let R=0;R<3;R++)for(let c=0;c<4;c++)r.beginPath(),r.arc(.25+c*.045+R%2*.02,-.01+R*.03,.018,.3,Math.PI-.3),r.stroke();r.strokeStyle=`rgba(${Bo(F,"255,255,255",.5)},0.85)`,r.lineWidth=.022,r.beginPath(),r.moveTo(.36,.075),r.quadraticCurveTo(.26,.12,.17,.11),r.stroke(),r.restore(),r.fillStyle="rgb(8,8,10)",r.beginPath(),r.arc(.355,-.085,.032,0,Math.PI*2),r.fill(),r.fillStyle="rgba(255,255,255,0.9)",r.beginPath(),r.arc(.364,-.094,.01,0,Math.PI*2),r.fill(),r.beginPath(),r.ellipse(.29,-.085,.018,.01,0,0,Math.PI*2),r.fill(),r.fillStyle="rgb(22,20,20)",r.beginPath(),r.moveTo(.42,-.07),r.quadraticCurveTo(.7,-.05,Tn,.012),r.quadraticCurveTo(.7,-.015,.43,-.025),r.closePath(),r.fill(),r.strokeStyle="rgba(255,255,255,0.18)",r.lineWidth=.006,r.beginPath(),r.moveTo(.45,-.062),r.quadraticCurveTo(.7,-.045,.95,0),r.stroke(),r.strokeStyle="rgba(20,18,16,0.85)",r.lineWidth=.018,r.beginPath(),r.moveTo(.04,.13),r.lineTo(-.02,.16),r.stroke(),T(.06,1);const p=Math.sin(b*9+f.seed);r.save(),r.translate(D.x,D.y),r.rotate(W+A*p),An(r,.95),r.fillStyle=`rgba(${_},0.32)`,r.fill(),r.strokeStyle=`rgba(${Bo(_,"255,255,255",.3)},0.3)`,r.lineWidth=.006,r.stroke(),r.restore(),r.restore(),r.globalAlpha=1}const i=To({overlay:t.overlay,collide:t.collide,onResize:y,onFrame:n});return v.current=i.canvas,i}const mi={default:{bodyColor:"#2f9e6a",throatColor:"#ff2d6f",bellyColor:"#e9e4d4",flowerColor:"#e8433a",backgroundColor:"#0c1712"},monochrome:{},ruby:{bodyColor:"#3e8f4f",throatColor:"#ff1f3d",bellyColor:"#f0ece2",flowerColor:"#ff7a2f",backgroundColor:"#0e140c"},violet:{bodyColor:"#2a8f8a",throatColor:"#a55bff",bellyColor:"#e8eef0",flowerColor:"#ff5fa8",backgroundColor:"#0a0e18"},sunset:{bodyColor:"#c0622b",throatColor:"#ffb21f",bellyColor:"#f6e2c8",flowerColor:"#d6336c",backgroundColor:"#1a0d10"},frost:{bodyColor:"#5aa6c8",throatColor:"#dff6ff",bellyColor:"#f4f8fb",flowerColor:"#9db8ff",backgroundColor:"#07101a"}},Zr=Y.forwardRef((t,u)=>{const{preset:s,bodyColor:v,throatColor:k,bellyColor:e,flowerColor:y,backgroundColor:P,birdCount:o,size:n,speed:a,interactive:i,showFlowers:r,overlay:g,collide:l,zIndex:h,width:f,height:b,className:m,style:w}=t,B=mi[s??"default"]||{},{canvasRef:F,canvas:X}=pi({bodyColor:v??B.bodyColor??"#6b7280",throatColor:k??B.throatColor??"#e5e7eb",bellyColor:e??B.bellyColor??"#d1d5db",flowerColor:y??B.flowerColor??"#9ca3af",backgroundColor:P??B.backgroundColor??"#111111",birdCount:o??1,size:n??1,speed:a??1,interactive:i??!0,showFlowers:r??!0,overlay:g??!1,collide:l??!1});return Y.useImperativeHandle(u,()=>X,[X]),Mo.jsx(Io,{canvasRef:F,overlay:g,zIndex:h,width:f,height:b,className:m,style:w})});Zr.displayName="Hummingbird";const ee=(t,u,s)=>{const v=t.split(",").map(Number),k=u.split(",").map(Number);return v.map((e,y)=>Math.round(e+(k[y]-e)*s)).join(",")},ht=t=>t.startsWith("#")?xo(t):"255,255,255",Se=(t,u,s)=>Math.max(u,Math.min(s,t));function En(t,u,s,v,k,e){const y=u+e,P=s-v;t.beginPath(),t.moveTo(y,P),t.bezierCurveTo(y+k*.25,P+v*.35,u+k+e*.3,s-v*.42,u+k*.9+e*.12,s-v*.12),t.bezierCurveTo(u+k*.75,s+k*.4,u-k*.75,s+k*.4,u-k*.9+e*.12,s-v*.12),t.bezierCurveTo(u-k+e*.3,s-v*.42,y-k*.25,P+v*.35,y,P),t.closePath()}function yi(t){const u=Y.useRef(t);u.current=t;const s=Eo(),v=Y.useRef(null),k=Y.useRef(Vo()),e=Y.useRef({t:0,lit:!0,ignite:1,outFor:0,ember:0,lean:0,leanVel:0,gust:0,nextGust:3,smoke:[],smoking:0,drips:[]});function y(){let n=4;const a=()=>((n=n*16807%2147483647)-1)/2147483646;e.current.drips=Array.from({length:5},()=>({x:(a()-.5)*.8,len:.15+a()*.55,w:.05+a()*.05}))}function P(n,a,i,r,g){const l=u.current,h=e.current,f=r/1e3,b=r/16.67;h.t+=f;const m=h.t,w=ht(l.flameColor),B=ht(l.coreColor),F=ht(l.waxColor),X=Math.min(a,i),O=X*.17*Se(l.size,.3,2),_=O*(1+2.2*Se(l.candleHeight,.1,1.2)),H=i*.84,D=a/2,W=Math.max(O*2.4,H-_),A=D,T=W+O*.02,E=T-O*.12,x=zo(s.current,v.current),{vx:I,vy:M}=k.current(x,b);let p=0;if(x.inside){const oo=Se(1-Math.hypot(x.x-A,x.y-(E-O*.5))/(X*.6),0,1);p=Se(I*oo*.035,-1.2,1.2),h.gust=Math.max(h.gust,Se(Math.hypot(I,M)*oo/40,0,.7))}h.leanVel+=((p-h.lean)*60-h.leanVel*7)*f,h.lean+=h.leanVel*f,h.nextGust-=f,h.nextGust<=0&&(h.gust=Math.max(h.gust,(.15+Math.random()*.25)*l.flicker),h.nextGust=2+Math.random()*5),h.gust*=Math.exp(-f*3),l.interactive&&x.taps.length&&(h.lit&&h.ignite>.5?(h.lit=!1,h.outFor=0,h.smoking=3,h.ember=1):h.lit||(h.lit=!0)),h.lit||(h.outFor+=f,h.outFor>2.6&&(h.lit=!0)),h.ignite=h.lit?Math.min(1,h.ignite+f*2):Math.max(0,h.ignite-f*9),h.ember=Math.max(0,h.ember-f*.5),h.smoking=Math.max(0,h.smoking-f);const R=Se(l.flicker,0,3),c=.035*Math.sin(m*7.3)+.025*Math.sin(m*13.1+1)+.018*Math.sin(m*23.7+2),d=h.ignite,$=d<1&&h.lit?Math.sin(d*Math.PI)*.25:0,C=O*.95*(1+c*R-h.gust*.35+$)*d,S=C*.26,N=C*(h.lean*.6+(.04*Math.sin(m*9.1)+.025*Math.sin(m*17.3))*R*(1+h.gust*3)),z=d*(.85+c*2*R-h.gust*.3)*Se(l.glowIntensity,0,3);n.globalCompositeOperation="source-over",n.globalAlpha=1,!g.overlay&&l.backgroundColor!=="transparent"&&(n.fillStyle=l.backgroundColor,n.fillRect(0,0,a,i));const L=ht(l.backgroundColor==="transparent"?"#000000":l.backgroundColor),G=A+N*.4,q=E-C*.45;if(z>.01){n.globalCompositeOperation="lighter";const oo=n.createRadialGradient(G,q,0,G,q,X*1.25);oo.addColorStop(0,`rgba(${w},${.3*z})`),oo.addColorStop(.35,`rgba(${w},${.1*z})`),oo.addColorStop(1,`rgba(${w},0)`),n.fillStyle=oo,n.fillRect(0,0,a,i),n.globalCompositeOperation="source-over"}if(!g.overlay){const oo=n.createLinearGradient(0,H,0,i);oo.addColorStop(0,`rgb(${ee(ee(L,"40,28,20",.6),w,.12*Math.min(1,z))})`),oo.addColorStop(1,`rgb(${ee(L,"0,0,0",.4)})`),n.fillStyle=oo,n.fillRect(0,H,a,i-H)}if(z>.01){n.globalCompositeOperation="lighter";const oo=n.createRadialGradient(D,H+O*.15,0,D,H+O*.15,O*3);oo.addColorStop(0,`rgba(${w},${.22*z})`),oo.addColorStop(1,`rgba(${w},0)`),n.fillStyle=oo,n.save(),n.translate(D,H+O*.15),n.scale(1,.28),n.translate(-D,-(H+O*.15)),n.fillRect(D-O*3,H+O*.15-O*3,O*6,O*6),n.restore(),n.globalCompositeOperation="source-over"}const j=n.createRadialGradient(D,H,0,D,H,O*.9);j.addColorStop(0,"rgba(0,0,0,0.55)"),j.addColorStop(1,"rgba(0,0,0,0)"),n.save(),n.translate(D,H),n.scale(1,.22),n.translate(-D,-H),n.fillStyle=j,n.fillRect(D-O,H-O,O*2,O*2),n.restore();const V=D-O/2,K=D+O/2,to=O*.13,lo=n.createLinearGradient(V,0,K,0);if(lo.addColorStop(0,`rgb(${ee(F,"0,0,0",.5)})`),lo.addColorStop(.28,`rgb(${ee(F,w,.08*Math.min(1,z))})`),lo.addColorStop(.62,`rgb(${ee(F,"0,0,0",.18)})`),lo.addColorStop(1,`rgb(${ee(F,"0,0,0",.62)})`),n.fillStyle=lo,n.beginPath(),n.moveTo(V,W),n.lineTo(V,H),n.ellipse(D,H,O/2,to*.8,0,Math.PI,0,!0),n.lineTo(K,W),n.closePath(),n.fill(),n.save(),n.clip(),z>.01){const oo=n.createLinearGradient(0,W,0,W+O*1.6);oo.addColorStop(0,`rgba(${ee(F,w,.6)},${.55*Math.min(1,z)})`),oo.addColorStop(1,`rgba(${ee(F,w,.6)},0)`),n.fillStyle=oo,n.fillRect(V,W,O,O*1.6)}for(const oo of h.drips){const Z=D+oo.x*O*.5,no=oo.len*_*.6,U=oo.w*O,eo=Math.abs(oo.x);n.fillStyle=`rgba(${ee(F,"255,255,255",.08-eo*.1)},${.9-eo*.4})`,n.beginPath(),n.moveTo(Z-U,W),n.lineTo(Z-U*.8,W+no),n.arc(Z,W+no,U*.9,Math.PI,0,!0),n.lineTo(Z+U,W),n.fill(),n.strokeStyle=`rgba(255,255,255,${.14*(1-eo)})`,n.lineWidth=Math.max(.5,U*.35),n.beginPath(),n.moveTo(Z-U*.35,W+O*.05),n.lineTo(Z-U*.35,W+no),n.stroke()}n.restore(),n.fillStyle=`rgb(${ee(F,"255,255,255",.06)})`,n.beginPath(),n.ellipse(D,W,O/2,to,0,0,Math.PI*2),n.fill();const ao=n.createRadialGradient(D,W,0,D,W,O*.44);ao.addColorStop(0,`rgba(${ee(F,w,.55)},${.35+.6*Math.min(1,z)})`),ao.addColorStop(1,`rgba(${ee(F,"0,0,0",.2)},0.9)`),n.fillStyle=ao,n.beginPath(),n.ellipse(D,W+to*.12,O*.42,to*.72,0,0,Math.PI*2),n.fill(),n.strokeStyle=`rgba(255,255,255,${.18+.2*Math.min(1,z)})`,n.lineWidth=Math.max(.6,O*.012),n.beginPath(),n.ellipse(D,W,O/2,to,0,Math.PI*1.05,Math.PI*1.95),n.stroke();const ro=A+N*.05+O*.015,Q=E;n.strokeStyle="rgb(30,22,18)",n.lineWidth=Math.max(1,O*.022),n.lineCap="round",n.beginPath(),n.moveTo(A,T),n.quadraticCurveTo(A,(T+Q)/2,ro,Q),n.stroke();const so=Math.max(h.ember,d);if(so>.01){n.globalCompositeOperation="lighter";const oo=n.createRadialGradient(ro,Q,0,ro,Q,O*.06);oo.addColorStop(0,`rgba(255,140,60,${.9*so})`),oo.addColorStop(1,"rgba(255,80,20,0)"),n.fillStyle=oo,n.fillRect(ro-O*.06,Q-O*.06,O*.12,O*.12),n.globalCompositeOperation="source-over"}if(C>.5){n.globalCompositeOperation="lighter";const oo=n.createRadialGradient(G,q,0,G,q,C*1.4);oo.addColorStop(0,`rgba(${w},${.35*d})`),oo.addColorStop(1,`rgba(${w},0)`),n.fillStyle=oo,n.fillRect(G-C*1.4,q-C*1.4,C*2.8,C*2.8),En(n,A,E,C,S,N);const Z=n.createLinearGradient(0,E-C,0,E+S*.4);Z.addColorStop(0,`rgba(${w},0)`),Z.addColorStop(.25,`rgba(${w},0.55)`),Z.addColorStop(.7,`rgba(${ee(w,B,.4)},0.85)`),Z.addColorStop(1,`rgba(${w},0.35)`),n.fillStyle=Z,n.fill(),En(n,A,E-C*.04,C*.62,S*.52,N*.55);const no=n.createLinearGradient(0,E-C*.66,0,E);no.addColorStop(0,`rgba(${B},0.25)`),no.addColorStop(.45,`rgba(${B},0.95)`),no.addColorStop(1,`rgba(${B},0.55)`),n.fillStyle=no,n.fill();const U=n.createRadialGradient(A,E-S*.05,0,A,E-S*.05,S*.8);U.addColorStop(0,`rgba(90,130,255,${.45*d})`),U.addColorStop(1,"rgba(90,130,255,0)"),n.fillStyle=U,n.save(),n.translate(A,E),n.scale(1,.7),n.translate(-A,-E),n.fillRect(A-S,E-S,S*2,S*2),n.restore(),n.globalCompositeOperation="source-over"}h.smoking>0&&h.smoke.push({x:ro,y:Q,age:0,seed:m});const J=h.smoke;for(const oo of J)oo.age+=f,oo.y-=(X*.07+oo.age*X*.03)*f,oo.x+=(Math.sin(oo.age*2.3+oo.seed*.7)*X*.03+h.lean*X*.05)*f;for(;J.length&&J[0].age>4;)J.shift();if(J.length>1){n.lineCap="round";for(let oo=1;oo<J.length;oo++){const Z=J[oo-1],no=J[oo],U=Math.min(1,h.smoking+.2)*(1-no.age/4);n.strokeStyle=`rgba(190,184,178,${.3*U*Math.min(1,no.age*4)})`,n.lineWidth=1+no.age*O*.06,n.beginPath(),n.moveTo(Z.x,Z.y),n.lineTo(no.x,no.y),n.stroke()}}}const o=To({onResize:y,onFrame:P});return v.current=o.canvas,o}const Mi={default:{flameColor:"#ff9a3c",coreColor:"#fff3d1",waxColor:"#efe2cc",backgroundColor:"#0b0705"},monochrome:{},ivory:{flameColor:"#ffb457",coreColor:"#fffaf0",waxColor:"#f7f1e3",backgroundColor:"#100c09"},rose:{flameColor:"#ff8a5c",coreColor:"#fff0e6",waxColor:"#e8a7a9",backgroundColor:"#0e0608"},obsidian:{flameColor:"#ffa340",coreColor:"#fff1cc",waxColor:"#2b2726",backgroundColor:"#060505",glowIntensity:1.2},spirit:{flameColor:"#4fd1ff",coreColor:"#e8fbff",waxColor:"#cfd8e6",backgroundColor:"#03060c",glowIntensity:1.1}},oa=Y.forwardRef((t,u)=>{const{preset:s,flameColor:v,coreColor:k,waxColor:e,backgroundColor:y,size:P,candleHeight:o,flicker:n,glowIntensity:a,interactive:i,width:r,height:g,className:l,style:h}=t,f=Mi[s??"default"]||{},{canvasRef:b,canvas:m}=yi({flameColor:v??f.flameColor??"#e5e7eb",coreColor:k??f.coreColor??"#ffffff",waxColor:e??f.waxColor??"#9ca3af",backgroundColor:y??f.backgroundColor??"#111111",size:P??1,candleHeight:o??.6,flicker:n??1,glowIntensity:a??f.glowIntensity??1,interactive:i??!0});return Y.useImperativeHandle(u,()=>m,[m]),Mo.jsx(Io,{canvasRef:b,width:r,height:g,className:l,style:h})});oa.displayName="Candle";const We=(t,u,s)=>Math.max(u,Math.min(s,t));function zn(t,u){const s=((t-.05)/.55)**2+((u+.27)/.3)**2<1,v=(t+.4)**2+(u+.36)**2<.24**2;return s||v}function bi(t){const u=Y.useRef(t);u.current=t;const s=Eo(),v=Y.useRef(null),k=Y.useRef(Vo()),e=Y.useRef({t:0,x:-1,y:-1,peek:0,wake:0,startle:0,purr:0,knead:0,earL:0,earR:0,earCool:0,nextFlick:3,look:0,lookY:0,tail:0,dream:0,nextDream:6,zees:[],zeeGap:1.5});function y(o,n,a,i,r){const g=u.current,l=e.current,h=i/1e3,f=i/16.67;l.t+=h;const b=l.t,m=Po(g.furColor),w=Po(g.stripeColor),B=Po(g.bellyColor),F=Po(g.eyeColor),X=Po(g.cushionColor),O=Po(g.backgroundColor,"0,0,0");let _=(r.overlay?150:Math.min(n*.7,a))*.55*We(g.size,.2,2);const H=g.collide?Gt(r.solids,n,a,_*.6):null;let D,W;H?(_=Math.min(_,H.y/.7,H.w/1),D=We(H.x+H.w/2,_*.7,n-_*.7),W=H.y):(D=n/2,W=a*.8,_=Math.min(_,n/1.8,W/.75)),(l.x<0||Math.hypot(D-l.x,W-l.y)>_*3)&&(l.x=D,l.y=W),l.x+=(D-l.x)*Math.min(1,h*6),l.y+=(W-l.y)*Math.min(1,h*6);const A=l.x,T=l.y,E=zo(s.current,v.current),{vx:x,vy:I}=k.current(E,f),M=Math.hypot(x,I),p=(E.x-A)/_,R=(E.y-T)/_,c=-.4,d=-.36,$=E.inside?Math.hypot(p-c,R-d):99,C=g.followCursor&&E.inside&&$<2.2;let S=C?$<1.2?1:.55:0,N=l.startle>.05?1:C&&M>16&&$<1.3?.6:0;const z=g.interactive&&E.inside&&M<7&&zn(p,R)&&l.startle<.2;l.purr+=((z?1:0)-l.purr)*Math.min(1,h*(z?1.2:.6)),l.purr>.4&&(S=Math.min(S,.15),N=Math.min(N,.2));for(const Z of E.taps){if(!g.interactive)break;const no=(Z.x-A)/_,U=(Z.y-T)/_;zn(no,U)?(l.startle=1,l.purr=0,l.earL=l.earR=1):Math.hypot(no-c,U-d)<2.5&&(no<c?l.earL=1:l.earR=1)}l.startle*=Math.exp(-h*.5),l.peek+=(S-l.peek)*Math.min(1,h*(S>l.peek?3:1.5)),l.wake+=(N-l.wake)*Math.min(1,h*(N>l.wake?6:.8)),l.earCool-=h,l.nextFlick-=h,g.followCursor&&E.inside&&M>4&&$<2.4&&l.earCool<=0&&(p<c?l.earL=1:l.earR=1,l.earCool=1.1),l.nextFlick<=0&&(Math.random()<.5?l.earL=1:l.earR=1,l.nextFlick=3+Math.random()*5),l.earL*=Math.exp(-h*5),l.earR*=Math.exp(-h*5),l.nextDream-=h,l.nextDream<=0&&(l.dream=1,l.nextDream=8+Math.random()*8),l.dream*=Math.exp(-h*.7),C?(l.look+=(We(p-c,-1,1)-l.look)*Math.min(1,h*5),l.lookY+=(We(R-d,-1,1)-l.lookY)*Math.min(1,h*5)):(l.look*=Math.exp(-h*2),l.lookY*=Math.exp(-h*2)),l.knead+=h*(l.purr>.5?3.2:0);const L=l.peek<.1&&l.wake<.1&&l.purr<.2;l.zeeGap-=h,L&&l.zeeGap<=0&&(l.zees.push({x:-.5,y:-.48,age:0}),l.zeeGap=2.2);for(const Z of l.zees)Z.age+=h,Z.x-=h*.05,Z.y-=h*.09;if(l.zees=l.zees.filter(Z=>Z.age<3.2),o.globalCompositeOperation="source-over",o.globalAlpha=1,!r.overlay&&g.backgroundColor!=="transparent"){const Z=o.createLinearGradient(0,0,0,a);Z.addColorStop(0,`rgb(${uo(O,"0,0,0",.25)})`),Z.addColorStop(.78,`rgb(${O})`),Z.addColorStop(.78,`rgb(${uo(O,"0,0,0",.35)})`),Z.addColorStop(1,`rgb(${uo(O,"0,0,0",.5)})`),o.fillStyle=Z,o.fillRect(0,0,n,a);const no=Math.min(n,a)*.34,U=n*.78-no/2,eo=a*.12,co=no*1.2,fo=o.createLinearGradient(0,eo,0,eo+co);fo.addColorStop(0,"rgb(24,36,64)"),fo.addColorStop(1,"rgb(46,62,96)"),o.fillStyle=fo,o.fillRect(U,eo,no,co),o.fillStyle="rgba(230,236,255,0.85)",o.beginPath(),o.arc(U+no*.7,eo+co*.25,no*.09,0,Math.PI*2),o.fill(),o.strokeStyle="rgba(200,215,255,0.25)",o.lineWidth=1;for(let go=0;go<14;go++){const po=U+(go*.618+.1)%1*no,yo=eo+(b*.15+go*.37)%1*co;o.beginPath(),o.moveTo(po,yo),o.lineTo(po,Math.min(eo+co,yo+6)),o.stroke()}o.strokeStyle=`rgb(${uo(O,"0,0,0",.5)})`,o.lineWidth=Math.max(2,no*.04),o.strokeRect(U,eo,no,co),o.beginPath(),o.moveTo(U+no/2,eo),o.lineTo(U+no/2,eo+co),o.moveTo(U,eo+co/2),o.lineTo(U+no,eo+co/2),o.stroke(),o.fillStyle="rgba(150,170,230,0.06)",o.beginPath(),o.moveTo(U,eo+co),o.lineTo(U+no,eo+co),o.lineTo(U+no*.6,a),o.lineTo(U-no*.9,a),o.closePath(),o.fill();const mo=o.createRadialGradient(0,a*.35,0,0,a*.35,Math.max(n,a)*.7);mo.addColorStop(0,"rgba(255,190,120,0.18)"),mo.addColorStop(1,"rgba(255,190,120,0)"),o.fillStyle=mo,o.fillRect(0,0,n,a)}o.save(),o.translate(A,T),o.scale(_,_),o.lineCap="round",o.lineJoin="round";const q=Math.sin(b*(l.purr>.3?2.2:1.4)),j=Math.sin(b*70)*.003*l.purr;if(H)o.fillStyle="rgba(0,0,0,0.3)",o.beginPath(),o.ellipse(0,.005,.62,.03,0,0,Math.PI*2),o.fill();else{o.fillStyle="rgba(0,0,0,0.35)",o.beginPath(),o.ellipse(0,.1,.82,.08,0,0,Math.PI*2),o.fill();const Z=o.createLinearGradient(0,-.06,0,.12);Z.addColorStop(0,`rgb(${uo(X,"255,255,255",.18)})`),Z.addColorStop(1,`rgb(${uo(X,"0,0,0",.45)})`),o.fillStyle=Z,o.beginPath(),o.ellipse(0,.03,.78,.1,0,0,Math.PI*2),o.fill(),o.strokeStyle=`rgba(${uo(X,"0,0,0",.4)},0.6)`,o.lineWidth=.008,o.beginPath(),o.ellipse(0,.03,.74,.085,0,Math.PI*.05,Math.PI*.95),o.stroke(),o.fillStyle=`rgb(${uo(X,"0,0,0",.3)})`,o.beginPath(),o.arc(.62,.05,.015,0,Math.PI*2),o.fill()}o.translate(j,0),o.save(),o.scale(1,1+q*.025);const V=()=>{o.beginPath(),o.ellipse(.05,-.25,.53,.25,0,0,Math.PI*2),o.moveTo(.58,-.33),o.arc(.3,-.31,.28,0,Math.PI*2)},K=o.createRadialGradient(-.15,-.5,.05,.1,-.2,.75);K.addColorStop(0,`rgb(${uo(m,"255,230,200",.18)})`),K.addColorStop(.6,`rgb(${m})`),K.addColorStop(1,`rgb(${uo(m,"0,0,0",.45)})`),o.fillStyle=K,V(),o.fill(),o.save(),V(),o.clip(),o.strokeStyle=`rgba(${w},0.6)`;for(let Z=0;Z<9;Z++){const no=-.34+Z*.105;o.lineWidth=.032-Z%2*.01,o.beginPath(),o.moveTo(no-.02,-.56),o.quadraticCurveTo(no+.06,-.4,no-.01,-.22+Math.abs(no)*.15),o.stroke()}o.lineWidth=.03,o.beginPath(),o.arc(.32,-.3,.14,-2.6,.8),o.stroke(),o.beginPath(),o.arc(.32,-.3,.06,-2.2,1.2),o.stroke(),o.fillStyle=`rgba(${B},0.85)`,o.beginPath(),o.ellipse(-.3,-.06,.2,.1,0,0,Math.PI*2),o.fill(),o.restore(),o.restore();for(let Z=0;Z<2;Z++){const no=l.purr>.5?Math.max(0,Math.sin(l.knead*Math.PI+Z*Math.PI))*.025:0,U=-.5+Z*.13,eo=-.045-no;o.fillStyle=`rgb(${uo(B,m,.15)})`,o.beginPath(),o.ellipse(U,eo,.085,.045,-.1,0,Math.PI*2),o.fill(),o.strokeStyle=`rgba(${uo(m,"0,0,0",.4)},0.5)`,o.lineWidth=.006;for(const co of[-.025,.005,.035])o.beginPath(),o.moveTo(U-.07,eo+co*.6),o.lineTo(U-.085,eo+co*.6),o.stroke()}const to=l.wake*.13+l.peek*.02;o.save(),o.translate(-.4,-.3-to),o.rotate(-.22*(1-l.wake)+l.look*.18*l.wake+l.lookY*.08*l.peek);const lo=o.createRadialGradient(-.06,-.12,.02,0,-.04,.26);lo.addColorStop(0,`rgb(${uo(m,"255,230,200",.2)})`),lo.addColorStop(1,`rgb(${uo(m,"0,0,0",.3)})`);const ao=l.startle*.5;for(const[Z,no]of[[-1,l.earL],[1,l.earR]]){o.save();const U=Z*.1;o.translate(U,-.13),o.rotate(Z*(.15+ao)+Math.sin(no*18)*no*.5*Z),o.fillStyle=`rgb(${uo(m,"0,0,0",.12)})`,o.beginPath(),o.moveTo(-.075,.03),o.lineTo(Z*.02,-.15),o.lineTo(.075,.03),o.closePath(),o.fill(),o.fillStyle=`rgba(${uo(B,"220,120,130",.4)},0.8)`,o.beginPath(),o.moveTo(-.045,.02),o.lineTo(Z*.015,-.11),o.lineTo(.045,.02),o.closePath(),o.fill(),o.restore()}o.fillStyle=lo,o.beginPath(),o.ellipse(0,-.02,.2,.17,0,0,Math.PI*2),o.fill(),o.strokeStyle=`rgba(${w},0.55)`,o.lineWidth=.014,o.beginPath(),o.moveTo(-.05,-.15),o.lineTo(-.03,-.09),o.lineTo(0,-.13),o.lineTo(.03,-.09),o.lineTo(.05,-.15),o.stroke(),o.fillStyle=`rgba(${B},0.95)`,o.beginPath(),o.ellipse(-.035,.06,.055,.04,0,0,Math.PI*2),o.ellipse(.035,.06,.055,.04,0,0,Math.PI*2),o.fill();const ro=[Math.max(l.peek*.6,l.wake),Math.max(l.peek>.8?(l.peek-.8)*2:0,l.wake)],Q=.006+.016*(1-Math.min(1,l.startle+l.wake*.5))+(l.peek>0?.004:0);for(let Z=0;Z<2;Z++){const no=Z===0?-.075:.075,U=-.005,eo=We(ro[Z],0,1);if(eo<.08){o.strokeStyle=`rgba(${uo(m,"0,0,0",.7)},0.9)`,o.lineWidth=.011,o.beginPath(),o.moveTo(no-.04,U-.005),o.quadraticCurveTo(no,U+.022,no+.04,U-.005),o.stroke();continue}const co=.032*eo;o.save(),o.beginPath(),o.moveTo(no-.042,U),o.quadraticCurveTo(no,U-co*1.6,no+.042,U),o.quadraticCurveTo(no,U+co*1.2,no-.042,U),o.closePath(),o.fillStyle=`rgb(${F})`,o.fill(),o.clip();const fo=o.createRadialGradient(no,U,.004,no,U,.04);fo.addColorStop(0,`rgba(${uo(F,"255,255,200",.4)},1)`),fo.addColorStop(1,`rgba(${uo(F,"0,0,0",.4)},1)`),o.fillStyle=fo,o.fillRect(no-.05,U-.05,.1,.1);const mo=no+We(l.look,-1,1)*.014;o.fillStyle="rgb(8,6,6)",o.beginPath(),o.ellipse(mo,U,Q,.04,0,0,Math.PI*2),o.fill(),o.fillStyle="rgba(255,255,255,0.8)",o.beginPath(),o.arc(mo-.012,U-.012,.006,0,Math.PI*2),o.fill(),o.restore(),o.strokeStyle="rgba(20,12,10,0.8)",o.lineWidth=.008,o.beginPath(),o.moveTo(no-.042,U),o.quadraticCurveTo(no,U-co*1.6,no+.042,U),o.stroke()}o.fillStyle="rgb(214,128,134)",o.beginPath(),o.moveTo(-.018,.03),o.lineTo(.018,.03),o.lineTo(0,.05),o.closePath(),o.fill(),o.strokeStyle=`rgba(${uo(m,"0,0,0",.6)},0.7)`,o.lineWidth=.007,o.beginPath(),o.moveTo(0,.05),o.lineTo(0,.065),o.quadraticCurveTo(-.02,.08,-.035,.068),o.moveTo(0,.065),o.quadraticCurveTo(.02,.08,.035,.068),o.stroke();const so=Math.sin(b*22)*.04*l.dream;o.strokeStyle="rgba(255,250,240,0.55)",o.lineWidth=.004;for(const Z of[-1,1])for(let no=0;no<3;no++){const U=(no-1)*.16+so;o.beginPath(),o.moveTo(Z*.06,.06),o.quadraticCurveTo(Z*.17,.05+U*.3,Z*.26,.04+U*.6+no*.012),o.stroke()}o.restore();const J=Math.sin(b*.9)*.03+Math.sin(b*13)*.025*l.dream+Math.sin(b*7)*.03*(l.peek*.5+l.wake),oo=()=>{o.beginPath(),o.moveTo(.55,-.12),o.bezierCurveTo(.6,.02,.2,.03,-.05,0),o.quadraticCurveTo(-.25,-.02,-.33+J*.4,-.08+J)};if(o.strokeStyle=`rgb(${uo(m,"0,0,0",.15)})`,o.lineWidth=.1,oo(),o.stroke(),o.strokeStyle=`rgba(${w},0.65)`,o.setLineDash([.035,.06]),o.lineWidth=.098,oo(),o.stroke(),o.setLineDash([]),o.fillStyle=`rgb(${uo(w,"0,0,0",.2)})`,o.beginPath(),o.arc(-.33+J*.4,-.08+J,.05,0,Math.PI*2),o.fill(),l.purr>.05){o.strokeStyle=`rgba(255,236,210,${.35*l.purr})`,o.lineWidth=.008;for(let Z=0;Z<3;Z++){const no=(b*1.2+Z/3)%1;o.globalAlpha=1-no,o.beginPath(),o.arc(-.35,-.2,.3+no*.25,-2.4,-1.6),o.stroke()}o.globalAlpha=1}o.strokeStyle="rgba(235,235,255,0.7)",o.lineWidth=.012;for(const Z of l.zees){const no=Math.min(1,Z.age*2)*(1-Z.age/3.2),U=.035+Z.age*.012;o.globalAlpha=no,o.beginPath(),o.moveTo(Z.x-U,Z.y-U),o.lineTo(Z.x+U,Z.y-U),o.lineTo(Z.x-U,Z.y+U),o.lineTo(Z.x+U,Z.y+U),o.stroke()}o.globalAlpha=1,o.restore()}const P=To({overlay:t.overlay,collide:t.collide,onFrame:y});return v.current=P.canvas,P}const Ci={default:{furColor:"#d9822b",stripeColor:"#8f4a16",bellyColor:"#f4dcc0",eyeColor:"#9cc23a",cushionColor:"#7a2f3d",backgroundColor:"#140f16"},monochrome:{},tuxedo:{furColor:"#24232a",stripeColor:"#1a191f",bellyColor:"#f1efea",eyeColor:"#e3b23c",cushionColor:"#2f5d62",backgroundColor:"#0e1013"},siamese:{furColor:"#eadcc6",stripeColor:"#6b4a37",bellyColor:"#f7efe2",eyeColor:"#4aa3e0",cushionColor:"#5a3f6b",backgroundColor:"#100d14"},grey:{furColor:"#8a8f99",stripeColor:"#555a64",bellyColor:"#cfd2d8",eyeColor:"#d9a73a",cushionColor:"#8a5a3c",backgroundColor:"#0f1115"},midnight:{furColor:"#18171c",stripeColor:"#0d0c10",bellyColor:"#2c2a33",eyeColor:"#f1c232",cushionColor:"#2d4a63",backgroundColor:"#06070c"}},ea=Y.forwardRef((t,u)=>{const{preset:s,furColor:v,stripeColor:k,bellyColor:e,eyeColor:y,cushionColor:P,backgroundColor:o,size:n,followCursor:a,interactive:i,overlay:r,collide:g,zIndex:l,width:h,height:f,className:b,style:m}=t,w=Ci[s??"default"]||{},{canvasRef:B,canvas:F}=bi({furColor:v??w.furColor??"#9ca3af",stripeColor:k??w.stripeColor??"#6b7280",bellyColor:e??w.bellyColor??"#e5e7eb",eyeColor:y??w.eyeColor??"#e5e7eb",cushionColor:P??w.cushionColor??"#4b5563",backgroundColor:o??w.backgroundColor??"#111111",size:n??1,followCursor:a??!0,interactive:i??!0,overlay:r??!1,collide:g??!1});return Y.useImperativeHandle(u,()=>F,[F]),Mo.jsx(Io,{canvasRef:B,overlay:r,zIndex:l,width:h,height:f,className:b,style:m})});ea.displayName="Cat";const Ln=12,vi=4,wi=16,ki=9,_e=(t,u,s)=>Math.max(u,Math.min(s,t));function zt(t){const u=t-Math.floor(t);return u<.22?Math.sin(u/.22*Math.PI*.5):Math.pow(1-(u-.22)/.78,2.2)}function Fn(t,u,s,v,k){const e=new Float32Array(t*2),y=new Float32Array(t*2);for(let P=0;P<t;P++)e[P*2]=y[P*2]=v,e[P*2+1]=y[P*2+1]=k+P;return{p:e,q:y,n:t,anchor:u,arm:s}}function Bn(t,u,s){const v=.45+Math.random()*.55,k=Math.min(t,u)*(.1+Math.random()*.05)*v,e=Math.random()*t,y=s?u+k*2:k+Math.random()*(u-k),P=[];for(let o=0;o<Ln;o++)P.push(Fn(wi,(o+.5)/Ln*2-1,!1,e,y));for(let o=0;o<vi;o++)P.push(Fn(ki,(o-1.5)*.14,!0,e,y));return{x:e,y,vx:0,vy:0,a:(Math.random()-.5)*.6,r:k,z:v,phase:Math.random(),rate:.8+Math.random()*.4,flash:0,seed:Math.random()*100,chains:P}}function Si(t){const u=Y.useRef(t);u.current=t;const s=Eo(),v=Y.useRef(null),k=Y.useRef(Vo()),e=Y.useRef({t:0,jellies:[],snow:[],w:0,h:0}),y=Y.useRef({key:"",img:null});function P(a,i){const r=e.current;r.w=a,r.h=i,r.jellies=[],r.snow=Array.from({length:70},()=>({x:Math.random()*a,y:Math.random()*i,r:.4+Math.random()*1.2}))}function o(a,i,r,g,l){const h=u.current,f=e.current,b=g/1e3,m=g/16.67;f.t+=b;const w=f.t;(f.w!==i||f.h!==r)&&P(i,r);const B=Po(h.bellColor),F=Po(h.glowColor),X=Po(h.backgroundColor,"0,0,0");y.current.key!==h.glowColor&&(y.current={key:h.glowColor,img:Yo(h.glowColor.startsWith("#")?h.glowColor:"#ffffff",96)});const O=_e(Math.round(h.count*(.5+.5*l.quality)),0,30);for(;f.jellies.length<O;)f.jellies.push(Bn(i,r,!1));f.jellies.length>O&&(f.jellies.length=O);const _=zo(s.current,v.current),{vx:H,vy:D}=k.current(_,m);if(a.globalCompositeOperation="source-over",a.globalAlpha=1,!l.overlay&&h.backgroundColor!=="transparent"){const T=a.createLinearGradient(0,0,0,r);T.addColorStop(0,`rgb(${uo(X,"120,170,210",.18)})`),T.addColorStop(.5,`rgb(${X})`),T.addColorStop(1,`rgb(${uo(X,"0,0,0",.55)})`),a.fillStyle=T,a.fillRect(0,0,i,r),a.globalCompositeOperation="lighter";for(let E=0;E<5;E++){const x=i*(.15+E*.19)+Math.sin(w*.2+E*2)*i*.04,I=i*(.05+E%2*.04),M=a.createLinearGradient(0,0,0,r*.8);M.addColorStop(0,`rgba(${uo(F,"200,230,255",.6)},${.06+.03*Math.sin(w*.5+E)})`),M.addColorStop(1,`rgba(${uo(F,"200,230,255",.6)},0)`),a.fillStyle=M,a.beginPath(),a.moveTo(x-I*.4,0),a.lineTo(x+I*.4,0),a.lineTo(x+I*2.2,r*.8),a.lineTo(x-I*.6,r*.8),a.closePath(),a.fill()}a.globalCompositeOperation="source-over"}a.fillStyle=`rgba(${uo(F,"255,255,255",.7)},0.35)`;for(const T of f.snow)T.y+=b*6*T.r,T.x+=Math.sin(w*.3+T.y*.01)*b*3,_.inside&&Math.hypot(T.x-_.x,T.y-_.y)<80&&(T.x+=H*.05*m,T.y+=D*.05*m),T.y>r+2&&(T.y=-2,T.x=Math.random()*i),a.beginPath(),a.arc(T.x,T.y,T.r,0,Math.PI*2),a.fill();for(const T of _.taps){if(!h.interactive)break;for(const E of f.jellies)Math.hypot(E.x-T.x,E.y-T.y)<E.r*5&&(E.flash=1,E.rate=2)}for(const T of f.jellies){const E=h.pulseRate*T.rate*.55,x=zt(T.phase);T.phase+=b*E;const I=zt(T.phase);if(T.rate+=(1-T.rate)*Math.min(1,b*.5),T.flash*=Math.exp(-b*1.6),I>x){const $=(I-x)*T.r*2.6;T.vx+=Math.sin(T.a)*$,T.vy-=Math.cos(T.a)*$}let M=-T.a*.25+Math.sin(w*.3+T.seed)*.15;if(h.interactive&&_.inside){const $=T.x-_.x,C=T.y-_.y,S=Math.hypot($,C);if(S<T.r*5){let z=Math.atan2($,-C)-T.a;z=Math.atan2(Math.sin(z),Math.cos(z)),M+=z*1.5*(1-S/(T.r*5)),T.rate=Math.max(T.rate,1.6);const L=(1-S/(T.r*5))*.04;T.vx+=H*L*m,T.vy+=D*L*m}}if(h.collide)for(const $ of l.solids){const C=T.r*1.1;if(T.x>$.x-C&&T.x<$.x+$.w+C&&T.y>$.y-C&&T.y<$.y+$.h+C){const S=_e(T.x,$.x,$.x+$.w),N=_e(T.y,$.y,$.y+$.h);let z=T.x-S,L=T.y-N,G=Math.hypot(z,L);G<.001&&(z=0,L=1,G=1),T.vx+=z/G*T.r*b*6,T.vy+=L/G*T.r*b*6,M+=(Math.atan2(z,-L)-T.a)*.8}}T.a+=_e(M,-2,2)*b,T.a=_e(T.a,-1.3,1.3);const p=Math.exp(-b*1.4);T.vx*=p,T.vy=T.vy*p+T.r*.05*b,T.x+=T.vx*b,T.y+=T.vy*b,T.y<-T.r*6&&Object.assign(T,Bn(i,r,!0)),T.x<-T.r*3?T.x+=i+T.r*6:T.x>i+T.r*3&&(T.x-=i+T.r*6);const R=Math.cos(T.a),c=Math.sin(T.a),d=T.r*(1-.22*I);for(const $ of T.chains){const C=$.anchor*d*($.arm?1:.95),S=$.arm?-T.r*.05:0,N=T.x+C*R-S*c,z=T.y+C*c+S*R,L=T.r*($.arm?.16:.22)*h.tentacleLength,G=$.p,q=$.q;G[0]=q[0]=N,G[1]=q[1]=z;const j=Math.pow(.9,m);for(let V=1;V<$.n;V++){const K=V*2,to=K+1,lo=G[K]+(G[K]-q[K])*j,ao=G[to]+(G[to]-q[to])*j;if(q[K]=G[K],q[to]=G[to],G[K]=lo+Math.sin(w*1.3+V*.5+T.seed+$.anchor*3)*.04*m,G[to]=ao+.05*m,_.inside&&h.interactive){const ro=Math.hypot(G[K]-_.x,G[to]-_.y);if(ro<60){const Q=(1-ro/60)*.25;G[K]+=H*Q*m,G[to]+=D*Q*m}}}for(let V=0;V<2;V++)for(let K=1;K<$.n;K++){const to=(K-1)*2,lo=K*2,ao=G[lo]-G[to],ro=G[lo+1]-G[to+1],Q=Math.hypot(ao,ro)||1,so=(Q-L)/Q;K===1?(G[lo]-=ao*so,G[lo+1]-=ro*so):(G[to]+=ao*so*.5,G[to+1]+=ro*so*.5,G[lo]-=ao*so*.5,G[lo+1]-=ro*so*.5)}}}const A=f.jellies.slice().sort((T,E)=>T.z-E.z);for(const T of A){const E=zt(T.phase),x=.45+.55*T.z;a.lineCap="round",a.lineJoin="round";for(const c of T.chains){const d=c.p;a.beginPath(),a.moveTo(d[0],d[1]);for(let $=1;$<c.n-1;$++){const C=(d[$*2]+d[$*2+2])/2,S=(d[$*2+1]+d[$*2+3])/2;a.quadraticCurveTo(d[$*2],d[$*2+1],C,S)}a.lineTo(d[(c.n-1)*2],d[(c.n-1)*2+1]),c.arm?(a.strokeStyle=`rgba(${uo(B,F,.3)},${.28*x})`,a.lineWidth=T.r*.12,a.stroke(),a.strokeStyle=`rgba(${uo(B,"255,255,255",.4)},${.22*x})`,a.lineWidth=T.r*.03,a.stroke()):(a.strokeStyle=`rgba(${uo(F,B,.4)},${(.35+.4*T.flash)*x})`,a.lineWidth=Math.max(.5,T.r*.018),a.stroke())}a.save(),a.translate(T.x,T.y),a.rotate(T.a);const I=T.r*(1-.22*E),M=T.r*(.78+.22*E);if(y.current.img){a.globalCompositeOperation="lighter",a.globalAlpha=(.12+.6*T.flash)*x;const c=T.r*(3+T.flash*2);a.drawImage(y.current.img,-c/2,-M*.5-c/2,c,c),a.globalAlpha=1,a.globalCompositeOperation="source-over"}const p=()=>{a.beginPath(),a.moveTo(-I,0),a.bezierCurveTo(-I*1.02,-M*.9,-I*.5,-M*1.08,0,-M),a.bezierCurveTo(I*.5,-M*1.08,I*1.02,-M*.9,I,0);const c=8;for(let d=c-1;d>=0;d--){const $=-I+2*I*d/c;a.quadraticCurveTo($+I/c,M*.07*(1-E*.5),$,0)}a.closePath()},R=a.createRadialGradient(0,-M*.55,I*.1,0,-M*.3,I*1.1);R.addColorStop(0,`rgba(${uo(B,"255,255,255",.35)},${.42*x})`),R.addColorStop(.7,`rgba(${B},${.2*x})`),R.addColorStop(1,`rgba(${uo(B,F,.5)},${.34*x})`),a.fillStyle=R,p(),a.fill(),a.save(),p(),a.clip(),a.strokeStyle=`rgba(${uo(B,"255,255,255",.5)},${.18*x})`,a.lineWidth=Math.max(.4,T.r*.012);for(let c=0;c<9;c++){const d=c/8*2-1;a.beginPath(),a.moveTo(0,-M*.75),a.quadraticCurveTo(d*I*.6,-M*.6,d*I*.98,0),a.stroke()}a.strokeStyle=`rgba(${uo(F,B,.25)},${(.45+.4*T.flash)*x})`,a.lineWidth=T.r*.07;for(let c=0;c<4;c++){const d=(c-1.5)*I*.3,$=-M*(.42+(c===1||c===2?.06:0));a.beginPath(),a.ellipse(d,$,I*.11,M*.08,0,.3,Math.PI*2-.3),a.stroke()}a.restore(),a.globalCompositeOperation="lighter",a.strokeStyle=`rgba(${F},${(.4+.5*T.flash)*x})`,a.lineWidth=Math.max(.8,T.r*.03),a.beginPath(),a.moveTo(-I,0),a.bezierCurveTo(-I*1.02,-M*.9,-I*.5,-M*1.08,0,-M),a.bezierCurveTo(I*.5,-M*1.08,I*1.02,-M*.9,I,0),a.stroke(),a.fillStyle=`rgba(${uo(F,"255,255,255",.5)},${(.5+.5*T.flash)*x})`;for(let c=0;c<=8;c++)a.beginPath(),a.arc(-I+2*I*c/8,0,Math.max(.6,T.r*.02),0,Math.PI*2),a.fill();a.globalCompositeOperation="source-over",a.restore()}}const n=To({overlay:t.overlay,collide:t.collide,onFrame:o,onResize:P});return v.current=n.canvas,n}const Ri={default:{bellColor:"#c9a7e8",glowColor:"#8fd8ff",backgroundColor:"#04122a"},monochrome:{},"sea-nettle":{bellColor:"#f0a050",glowColor:"#ffcf7a",backgroundColor:"#031722",tentacleLength:1.6},crystal:{bellColor:"#b9f3ff",glowColor:"#5ef0e0",backgroundColor:"#010c18",tentacleLength:.8},"lions-mane":{bellColor:"#e2564a",glowColor:"#ff9a6a",backgroundColor:"#0a0714",tentacleLength:2,count:3},ghost:{bellColor:"#e8ecf4",glowColor:"#c6d4ff",backgroundColor:"#06070d",count:6}},ta=Y.forwardRef((t,u)=>{const{preset:s,count:v,bellColor:k,glowColor:e,backgroundColor:y,tentacleLength:P,pulseRate:o,interactive:n,overlay:a,collide:i,zIndex:r,width:g,height:l,className:h,style:f}=t,b=Ri[s??"default"]||{},{canvasRef:m,canvas:w}=Si({count:v??b.count??4,bellColor:k??b.bellColor??"#d1d5db",glowColor:e??b.glowColor??"#ffffff",backgroundColor:y??b.backgroundColor??"#111111",tentacleLength:P??b.tentacleLength??1,pulseRate:o??1,interactive:n??!0,overlay:a??!1,collide:i??!1});return Y.useImperativeHandle(u,()=>w,[w]),Mo.jsx(Io,{canvasRef:m,overlay:a,zIndex:r,width:g,height:l,className:h,style:f})});ta.displayName="Jellyfish";const Lt=(t,u,s)=>Math.max(u,Math.min(s,t)),On=40;function Pi(t,u,s,v){return t>=v&&u>0?-1:t<=s&&u<0?1:u}function xi(t){const u=Y.useRef(t);u.current=t;const s=Eo(),v=Y.useRef(null),k=Y.useRef(Vo()),e=Y.useRef({t:0,u:.35,dir:1,face:1,hide:0,calm:9,eyeL:1,eyeR:1,lean:0,wave:0,trail:[],lastX:-1,lastY:-1,surf:-1});function y(o,n,a,i,r){const g=u.current,l=e.current,h=i/1e3,f=i/16.67;l.t+=h;const b=l.t,m=Po(g.shellColor),w=Po(g.bodyColor),B=Po(g.trailColor),F=Po(g.backgroundColor,"0,0,0");let X=(r.overlay?120:Math.min(n,a)*.42)*Lt(g.size,.2,2);const O=g.collide?Gt(r.solids,n,a,X*.6):null;let _,H,D;O?(X=Math.min(X,O.w/1.6),_=O.x+X*.6,H=O.x+O.w-X*.6,D=O.y):(_=X*.8,H=n-X*.8,D=a*.8),H<_&&(H=_=(_+H)/2);const W=O?O.id:-1;W!==l.surf&&(l.surf=W,l.trail=[],l.lastX=-1);const A=zo(s.current,v.current),{vx:T,vy:E}=k.current(A,f),x=Math.hypot(T,E);let I=_+(H-_)*l.u;const M=I+l.face*X*.75,p=D-X*.35,R=A.inside?Math.hypot(A.x-M,A.y-p):1e9,c=A.inside?Math.hypot(A.x-I,A.y-(D-X*.33)):1e9;let d=!1;if(g.interactive){A.inside&&x>12&&Math.min(R,c)<X*1.4&&(d=!0);for(const ro of A.taps)Math.hypot(ro.x-I,ro.y-(D-X*.3))<X*.9&&(d=!0)}d?l.calm=0:l.calm=g.interactive?l.calm+h:Math.max(l.calm+h,1.6);const $=l.calm<1.6?1:0;l.hide+=($-l.hide)*Math.min(1,h*($>l.hide?9:.9));for(const ro of["eyeL","eyeR"]){const Q=M+l.face*X*(ro==="eyeL"?.08:.16),so=p-X*.18,J=g.interactive&&A.inside&&Math.hypot(A.x-Q,A.y-so)<X*.18;l[ro]+=((J?.15:1)-l[ro])*Math.min(1,h*(J?12:1.2))}const C=A.inside&&l.hide<.3&&R<X*3?Lt(Math.atan2(A.y-p,(A.x-M)*l.face)+1.1,-.8,.8):0;l.lean+=(C-l.lean)*Math.min(1,h*2);const S=1-l.hide;if(S>.9&&H>_){const ro=X*.09*g.speed*(.8+.2*Math.sin(l.wave*2));l.u=Lt(l.u+l.dir*ro*h/(H-_),0,1),l.dir=Pi(l.u,l.dir,0,1),l.wave+=h*g.speed*3}l.face+=(l.dir-l.face)*Math.min(1,h*1.5),I=_+(H-_)*l.u;const N=I-l.face*X*.4;g.trail&&S>.9&&(l.lastX<0||Math.hypot(N-l.lastX,D-l.lastY)>X*.05)&&(l.trail.push({x:N,y:D,age:0}),l.lastX=N,l.lastY=D,l.trail.length>600&&l.trail.shift());for(const ro of l.trail)ro.age+=h;for(;l.trail.length&&l.trail[0].age>On;)l.trail.shift();if(g.trail||(l.trail.length=0),o.globalCompositeOperation="source-over",o.globalAlpha=1,!r.overlay&&g.backgroundColor!=="transparent"){const ro=o.createLinearGradient(0,0,0,a);ro.addColorStop(0,`rgb(${uo(F,"0,0,0",.3)})`),ro.addColorStop(.8,`rgb(${F})`),ro.addColorStop(1,`rgb(${uo(F,"0,0,0",.4)})`),o.fillStyle=ro,o.fillRect(0,0,n,a);for(let Q=0;Q<9;Q++){const so=(Q*.37+.11)%1*n,J=a*(.12+Q*.53%1*.5),oo=Math.min(n,a)*(.03+Q%3*.025);o.fillStyle=`rgba(${uo(F,"200,255,190",.25)},${.05+Q%2*.04})`,o.beginPath(),o.arc(so,J,oo,0,Math.PI*2),o.fill()}for(let Q=0;Q<4;Q++){const so=n*(.1+Q*.28),J=a*(.3+Q%2*.2);o.save(),o.translate(so,J),o.rotate(-.6+Q*.45+Math.sin(b*.4+Q)*.03),o.fillStyle=`rgba(${uo(F,"90,150,80",.35)},0.35)`,o.beginPath(),o.ellipse(0,0,Math.min(n,a)*.2,Math.min(n,a)*.07,0,0,Math.PI*2),o.fill(),o.restore()}}if(!O){const ro=o.createLinearGradient(0,D,0,a);ro.addColorStop(0,`rgb(${uo(F,"120,140,90",.3)})`),ro.addColorStop(1,`rgb(${uo(F,"0,0,0",.5)})`),o.fillStyle=ro,o.fillRect(0,D,n,a-D),o.fillStyle=`rgba(${uo(F,"150,190,90",.4)},0.7)`;for(let Q=0;Q<60;Q++){const so=Q*.618%1*n,J=1.5+Q%4;o.beginPath(),o.arc(so,D+Q%3,J,Math.PI,0),o.fill()}o.strokeStyle=`rgba(${uo(F,"150,200,100",.45)},0.8)`,o.lineWidth=1.2;for(let Q=0;Q<40;Q++){const so=(Q*.381+.05)%1*n,J=X*(.25+Q%5*.12),oo=Math.sin(b*.8+Q)*J*.1;o.beginPath(),o.moveTo(so,D+2),o.quadraticCurveTo(so+oo*.5,D-J*.5,so+oo+(Q%2?4:-4),D-J),o.stroke()}}if(l.trail.length>1){o.lineCap="round",o.lineJoin="round";for(let ro=1;ro<l.trail.length;ro++){const Q=l.trail[ro-1],so=l.trail[ro];if(Math.abs(Q.x-so.x)>X)continue;const J=1-so.age/On,oo=Math.max(0,1-so.age/8);o.strokeStyle=`rgba(${B},${.12+.3*oo*J})`,o.lineWidth=X*.11,o.beginPath(),o.moveTo(Q.x,Q.y-X*.01),o.lineTo(so.x,so.y-X*.01),o.stroke();const Z=.5+.5*Math.sin(so.x*.15-b*2);o.strokeStyle=`rgba(${uo(B,"255,255,255",.6)},${(.15+.5*oo*Z)*J})`,o.lineWidth=Math.max(.6,X*.012),o.beginPath(),o.moveTo(Q.x,Q.y-X*.04),o.lineTo(so.x,so.y-X*.04),o.stroke()}}o.save(),o.translate(I,D),o.scale(X*(Math.abs(l.face)<.15?.15*Math.sign(l.face||1):l.face),X),o.lineCap="round",o.lineJoin="round",o.fillStyle="rgba(0,0,0,0.35)",o.beginPath(),o.ellipse(.05,.01,.55*(.5+.5*S),.035,0,0,Math.PI*2),o.fill();const L=.2+.6*S,G=-.2-.25*S,q=()=>{o.beginPath(),o.moveTo(G,0),o.quadraticCurveTo(G+.06,-.07,G+.18,-.08),o.lineTo(L-.25,-.1),o.bezierCurveTo(L-.12,-.1-.15*S,L+.02,-.18*S-.05,L+.04,-.06),o.quadraticCurveTo(L+.05,0,L-.02,0),o.closePath()},j=o.createLinearGradient(0,-.25,0,0);j.addColorStop(0,`rgb(${uo(w,"255,255,255",.15)})`),j.addColorStop(1,`rgb(${uo(w,"0,0,0",.35)})`),o.fillStyle=j,q(),o.fill(),o.save(),q(),o.clip(),o.strokeStyle=`rgba(${uo(w,"0,0,0",.4)},0.35)`,o.lineWidth=.008;for(let ro=G;ro<L;ro+=.045)o.beginPath(),o.moveTo(ro,-.25),o.lineTo(ro+.03,0),o.stroke();o.fillStyle=`rgba(${uo(w,"0,0,0",.5)},0.35)`;for(let ro=0;ro<8;ro++){const Q=G+(ro/8+l.wave*.12)%1*(L-G);o.beginPath(),o.ellipse(Q,-.015,.025,.02,0,0,Math.PI*2),o.fill()}if(o.fillStyle=`rgba(255,255,255,${.12+.08*Math.sin(b*1.5)})`,o.beginPath(),o.ellipse((L+G)/2+.1,-.09,(L-G)*.35,.012,0,0,Math.PI*2),o.fill(),o.restore(),S>.05){const ro=L-.06,Q=-.12*S-.05;o.strokeStyle=`rgb(${uo(w,"0,0,0",.15)})`,o.lineWidth=.022;for(const J of[0,.03]){const oo=.35+J*4+Math.sin(b*2+J*30)*.08;o.beginPath(),o.moveTo(ro+J,Q+.04),o.lineTo(ro+J+Math.cos(oo)*.1*S,Q+.04+Math.sin(oo)*.1*S),o.stroke()}const so=[[-.03,l.eyeL],[.03,l.eyeR]];for(const[J,oo]of so){const Z=.34*S*oo,no=-1.15+J*4+l.lean*.6+Math.sin(b*1.1+J*50)*.08,U=ro+J,eo=Q,co=U+Math.cos(no)*Z,fo=eo+Math.sin(no)*Z;o.strokeStyle=`rgb(${uo(w,"0,0,0",.1)})`,o.lineWidth=.028-.01*(Z/.34),o.beginPath(),o.moveTo(U,eo),o.quadraticCurveTo(U+Math.cos(no-.3)*Z*.5,eo+Math.sin(no-.3)*Z*.5,co,fo),o.stroke(),o.fillStyle=`rgb(${uo(w,"0,0,0",.25)})`,o.beginPath(),o.arc(co,fo,.022,0,Math.PI*2),o.fill(),o.fillStyle="rgb(12,10,10)",o.beginPath(),o.arc(co+.006,fo,.012,0,Math.PI*2),o.fill(),o.fillStyle="rgba(255,255,255,0.7)",o.beginPath(),o.arc(co,fo-.008,.005,0,Math.PI*2),o.fill()}}const V=.3,K=-.05,to=-.31+l.hide*.04,lo=o.createRadialGradient(K-V*.35,to-V*.4,V*.05,K,to,V*1.05);lo.addColorStop(0,`rgb(${uo(m,"255,250,230",.35)})`),lo.addColorStop(.65,`rgb(${m})`),lo.addColorStop(1,`rgb(${uo(m,"0,0,0",.5)})`),o.fillStyle=lo,o.beginPath(),o.ellipse(K,to,V,V*.95,0,0,Math.PI*2),o.fill(),o.save(),o.beginPath(),o.ellipse(K,to,V,V*.95,0,0,Math.PI*2),o.clip(),o.strokeStyle=`rgba(${uo(m,"0,0,0",.45)},0.35)`,o.lineWidth=.006;for(let ro=0;ro<28;ro++){const Q=ro/28*Math.PI*2;o.beginPath(),o.moveTo(K+Math.cos(Q)*V*.35,to+Math.sin(Q)*V*.35),o.lineTo(K+Math.cos(Q+.2)*V,to+Math.sin(Q+.2)*V),o.stroke()}o.restore();const ao=(ro,Q)=>{o.beginPath();const so=Math.log(ro/.02)/(Q*Math.PI*2);for(let J=0;J<=80;J++){const oo=J/80*Q*Math.PI*2,Z=ro*Math.exp(-so*oo),no=K+.02+Math.cos(oo+.6)*Z,U=to-.01+Math.sin(oo+.6)*Z*.95;J===0?o.moveTo(no,U):o.lineTo(no,U)}};o.strokeStyle=`rgba(${uo(m,"40,20,10",.6)},0.8)`,o.lineWidth=.03,ao(V*.96,2.6),o.stroke(),o.strokeStyle=`rgba(${uo(m,"255,240,210",.5)},0.5)`,o.lineWidth=.012,ao(V*.86,2.6),o.stroke(),o.fillStyle="rgba(255,255,255,0.35)",o.beginPath(),o.ellipse(K-V*.35,to-V*.5,V*.18,V*.07,-.5,0,Math.PI*2),o.fill(),o.strokeStyle=`rgb(${uo(m,"255,245,225",.55)})`,o.lineWidth=.025,o.beginPath(),o.ellipse(K+V*.55,to+V*.6,V*.32,V*.18,-.4,Math.PI*.9,Math.PI*2.05),o.stroke(),o.restore()}const P=To({overlay:t.overlay,collide:t.collide,onFrame:y});return v.current=P.canvas,P}const $i={default:{shellColor:"#b5773f",bodyColor:"#a8988a",trailColor:"#cfe6ff",backgroundColor:"#0f1a12"},monochrome:{},amber:{shellColor:"#e0a03a",bodyColor:"#c9b49a",trailColor:"#fff1c9",backgroundColor:"#1a1208"},forest:{shellColor:"#6f5a33",bodyColor:"#7d7466",trailColor:"#d6f5c8",backgroundColor:"#07140b"},candy:{shellColor:"#e47aa8",bodyColor:"#e8cfc4",trailColor:"#ffd6f0",backgroundColor:"#170b18"},nocturne:{shellColor:"#4f6aa8",bodyColor:"#8a93a6",trailColor:"#9fe8ff",backgroundColor:"#050811"}},na=Y.forwardRef((t,u)=>{const{preset:s,shellColor:v,bodyColor:k,trailColor:e,backgroundColor:y,size:P,speed:o,trail:n,interactive:a,overlay:i,collide:r,zIndex:g,width:l,height:h,className:f,style:b}=t,m=$i[s??"default"]||{},{canvasRef:w,canvas:B}=xi({shellColor:v??m.shellColor??"#9ca3af",bodyColor:k??m.bodyColor??"#6b7280",trailColor:e??m.trailColor??"#e5e7eb",backgroundColor:y??m.backgroundColor??"#111111",size:P??1,speed:o??1,trail:n??!0,interactive:a??!0,overlay:i??!1,collide:r??!1});return Y.useImperativeHandle(u,()=>B,[B]),Mo.jsx(Io,{canvasRef:w,overlay:i,zIndex:g,width:l,height:h,className:f,style:b})});na.displayName="Snail";const ra=(t,u,s)=>Math.max(u,Math.min(s,t)),Ii=Math.PI*(3-Math.sqrt(5));function Ti(t,u,s,v,k,e){return{yaw:Math.tanh((s-t)/Math.max(1,k*.35))*.95,pitch:ra(Math.tanh((v-u)/Math.max(1,e*.45))*.8+.12,-.7,.9)}}function Ai(t){const u=Y.useRef(t);u.current=t;const s=Eo(),v=Y.useRef(null),k=Y.useRef(Vo()),e=Y.useRef({t:0,flowers:[],petals:[],sunX:-1,sunY:-1,gust:0});function y(n){const a=[];for(let i=0;i<n;i++){const r=i%2===1&&n>3;a.push({u:(i+.5)/n+(Math.random()-.5)*.4/n,z:r?.72+Math.random()*.1:.92+Math.random()*.08,tall:.55+Math.random()*.15,seed:Math.random()*100,yaw:0,pitch:.2,vyaw:0,vpitch:0,shake:0,bend:0,bendV:0})}return a.sort((i,r)=>i.z-r.z)}function P(n,a,i,r,g){const l=u.current,h=e.current,f=r/1e3,b=r/16.67;h.t+=f;const m=h.t,w=Po(l.petalColor),B=Po(l.centerColor),F=Po(l.stemColor),X=Po(l.backgroundColor,"0,0,0"),O=ra(Math.round(l.count),0,24);h.flowers.length!==O&&(h.flowers=y(O));const _=zo(s.current,v.current),{vx:H}=k.current(_,b),D=l.followCursor&&_.inside,W=m/40%1,A=a*(.1+.8*W),T=i*(.42-Math.sin(W*Math.PI)*.3),E=D?_.x:A,x=D?_.y:T;h.sunX<0&&(h.sunX=E,h.sunY=x),h.sunX+=(E-h.sunX)*Math.min(1,f*(D?10:2)),h.sunY+=(x-h.sunY)*Math.min(1,f*(D?10:2));const I=h.sunX,M=h.sunY;n.globalCompositeOperation="source-over",n.globalAlpha=1;const p=!g.overlay&&l.backgroundColor!=="transparent",R=i*.62;if(p){const $=n.createLinearGradient(0,0,0,R);$.addColorStop(0,`rgb(${uo(X,"40,50,110",.45)})`),$.addColorStop(.7,`rgb(${X})`),$.addColorStop(1,`rgb(${uo(X,"255,220,150",.45)})`),n.fillStyle=$,n.fillRect(0,0,a,R+1);const C=Math.min(a,i),S=n.createRadialGradient(I,M,0,I,M,C*.7);S.addColorStop(0,"rgba(255,236,180,0.55)"),S.addColorStop(.15,"rgba(255,200,120,0.25)"),S.addColorStop(1,"rgba(255,180,100,0)"),n.fillStyle=S,n.fillRect(0,0,a,i),n.fillStyle="rgba(255,248,225,0.95)",n.beginPath(),n.arc(I,M,C*.045,0,Math.PI*2),n.fill();for(let N=0;N<3;N++){const z=R+N*i*.06;n.fillStyle=`rgb(${uo(uo(F,X,.55-N*.15),"0,0,0",.2+N*.1)})`,n.beginPath(),n.moveTo(0,i);for(let L=0;L<=24;L++){const G=L/24*a;n.lineTo(G,z-Go(G/a*3+N*7,3)*i*.05)}n.lineTo(a,i),n.closePath(),n.fill(),n.fillStyle=`rgba(${uo(w,X,.3+N*.1)},${.5+N*.15})`;for(let L=N*7%11;L<a;L+=9+N*4){const G=z-Go(L/a*3+N*7,3)*i*.05+2;n.beginPath(),n.arc(L,G,1.2+N*.8,0,Math.PI*2),n.fill()}}}h.gust*=Math.exp(-f*.8);const c=$=>l.wind*((Go(m*.35+$*2,11)-.5)*.9+Math.sin(m*1.3+$*6)*.08)+h.gust;for(const $ of _.taps)l.interactive&&(h.gust+=($.x<a/2?1:-1)*.2);const d=Math.min(a,i);for(const $ of h.flowers){const C=d*.12*$.z,S=$.u*a,N=i+4,z=i*$.tall*$.z;let L=c($.u)*.5;l.interactive&&_.inside&&Math.abs(_.x-S)<C*2&&_.y>N-z-C&&(L+=H*.01),$.bendV+=((L-$.bend)*30-$.bendV*5)*f,$.bend+=$.bendV*f;const G=S+$.bend*z*.35,q=N-z+Math.abs($.bend)*z*.05,j=Ti(G,q,I,M,a,i);$.vyaw+=((j.yaw-$.yaw)*9-$.vyaw*4)*f,$.vpitch+=((j.pitch-$.pitch)*9-$.vpitch*4)*f,$.yaw+=$.vyaw*f,$.pitch+=$.vpitch*f;for(const fo of _.taps){if(!l.interactive)break;if(Math.hypot(fo.x-G,fo.y-q)<C*1.2){$.shake=1;for(let mo=0;mo<4;mo++){const go=Math.random()*Math.PI*2;h.petals.push({x:G+Math.cos(go)*C*.8,y:q+Math.sin(go)*C*.8,vx:(Math.random()-.5)*40,vy:-20-Math.random()*30,a:go,va:(Math.random()-.5)*6,age:0,s:C*.4})}}}$.shake*=Math.exp(-f*3);const V=$.yaw+Math.sin(m*25+$.seed)*.12*$.shake,K=$.pitch;n.lineCap="round";const to=n.createLinearGradient(S-C*.1,0,S+C*.1,0);to.addColorStop(0,`rgb(${uo(F,"0,0,0",.35)})`),to.addColorStop(1,`rgb(${uo(F,"255,240,180",.15)})`),n.strokeStyle=to,n.lineWidth=C*.13,n.beginPath(),n.moveTo(S,N),n.quadraticCurveTo(S+$.bend*z*.05,N-z*.5,G,q+C*.2),n.stroke();for(const[fo,mo]of[[.35,-1],[.6,1]]){const go=S+$.bend*z*.35*fo*fo,po=N-z*fo,yo=mo*(.9+Math.sin(m*1.4+$.seed+fo*5)*.08*l.wind)-$.bend*.6;n.save(),n.translate(go,po),n.rotate(-Math.PI/2+yo);const vo=C*1.1;n.fillStyle=`rgb(${uo(F,"0,0,0",.12)})`,n.beginPath(),n.moveTo(0,0),n.bezierCurveTo(vo*.3,-vo*.45,vo*.95,-vo*.3,vo,0),n.bezierCurveTo(vo*.95,vo*.3,vo*.3,vo*.45,0,0),n.fill(),n.strokeStyle=`rgba(${uo(F,"255,255,200",.3)},0.5)`,n.lineWidth=C*.02,n.beginPath(),n.moveTo(0,0),n.lineTo(vo*.95,0),n.stroke(),n.restore()}const lo=Math.sin(V)*Math.cos(K),ao=Math.sin(K),ro=Math.cos(V)*Math.cos(K),Q=Math.atan2(ao,lo),so=Math.max(.12,Math.abs(ro)),J=C*.22,oo=G+lo*J,Z=q+ao*J;n.save(),n.translate(G-lo*J*.4,q-ao*J*.4),n.rotate(Q),n.scale(so,1),n.rotate(-Q),n.fillStyle=`rgb(${uo(F,"0,0,0",.25)})`;for(let fo=0;fo<14;fo++){const mo=fo/14*Math.PI*2+.1;n.save(),n.rotate(mo),n.beginPath(),n.moveTo(C*.4,-C*.08),n.quadraticCurveTo(C*.75,0,C*.4,C*.08),n.fill(),n.restore()}n.beginPath(),n.arc(0,0,C*.48,0,Math.PI*2),n.fill(),n.restore(),n.save(),n.translate(oo,Z),n.rotate(Q),n.scale(so,1),n.rotate(-Q);const no=.75+.25*ro;for(let fo=0;fo<2;fo++)for(let go=0;go<21;go++){const po=(go+fo*.5)/21*Math.PI*2,yo=Math.sin(m*2+go*1.7+$.seed)*.04*l.wind,vo=C*(fo?.92:1)*(.92+.08*Math.sin(go*2.3+$.seed));n.save(),n.rotate(po+yo);const $o=n.createLinearGradient(C*.4,0,vo,0);$o.addColorStop(0,`rgb(${uo(w,"120,60,0",fo?.2:.4)})`),$o.addColorStop(1,`rgb(${uo(w,"255,250,210",(fo?.25:.05)*no)})`),n.fillStyle=$o,n.beginPath(),n.moveTo(C*.38,-C*.07),n.quadraticCurveTo(vo*.8,-C*.13,vo,0),n.quadraticCurveTo(vo*.8,C*.13,C*.38,C*.07),n.closePath(),n.fill(),n.strokeStyle=`rgba(${uo(w,"120,60,0",.5)},0.25)`,n.lineWidth=C*.008,n.beginPath(),n.moveTo(C*.45,0),n.lineTo(vo*.9,0),n.stroke(),n.restore()}const U=C*.44;n.fillStyle=`rgb(${uo(B,"0,0,0",.3)})`,n.beginPath(),n.arc(0,0,U,0,Math.PI*2),n.fill();const eo=Math.round(150+100*g.quality),co=U/Math.sqrt(eo);for(let fo=1;fo<eo;fo++){const mo=co*Math.sqrt(fo),go=fo*Ii,po=mo/U;n.fillStyle=`rgb(${po<.3?uo(B,"120,140,40",.5*(1-po/.3)):uo(B,"255,190,90",(po-.3)*.25)})`,n.beginPath(),n.arc(Math.cos(go)*mo,Math.sin(go)*mo,co*.48,0,Math.PI*2),n.fill()}n.restore(),n.strokeStyle=`rgba(255,236,170,${.25*no})`,n.lineWidth=C*.03,n.beginPath(),n.arc(oo,Z,C*.45,Math.atan2(M-Z,I-oo)-.8,Math.atan2(M-Z,I-oo)+.8),n.stroke()}for(const $ of h.petals)$.age+=f,$.vy+=30*f,$.vx+=(c($.x/a)*40-$.vx)*f,$.vx*=.99,$.vy*=.97,$.x+=$.vx*f+Math.sin($.age*4+$.a)*.4*b,$.y+=$.vy*f,$.a+=$.va*f,n.save(),n.globalAlpha=Math.max(0,1-$.age/5),n.translate($.x,$.y),n.rotate($.a),n.scale(1,Math.abs(Math.sin($.age*3+$.a))*.8+.2),n.fillStyle=`rgb(${w})`,n.beginPath(),n.ellipse(0,0,$.s,$.s*.28,0,0,Math.PI*2),n.fill(),n.restore();h.petals=h.petals.filter($=>$.age<5&&$.y<i+20),n.globalAlpha=1}const o=To({overlay:t.overlay,onFrame:P});return v.current=o.canvas,o}const Ei={default:{petalColor:"#f6b51e",centerColor:"#4a2a12",stemColor:"#4f7a2a",backgroundColor:"#f0a868"},monochrome:{},dawn:{petalColor:"#ffd34d",centerColor:"#5a3a1a",stemColor:"#5d8a3a",backgroundColor:"#f6c2b0"},dusk:{petalColor:"#f08a1c",centerColor:"#2e1a0e",stemColor:"#3a5a26",backgroundColor:"#a8577a"},velvet:{petalColor:"#a8323a",centerColor:"#2a140e",stemColor:"#46632a",backgroundColor:"#e8a070"},moonlight:{petalColor:"#d8d080",centerColor:"#2a2420",stemColor:"#2e4a3a",backgroundColor:"#1c2a4a"}},aa=Y.forwardRef((t,u)=>{const{preset:s,count:v,petalColor:k,centerColor:e,stemColor:y,backgroundColor:P,wind:o,followCursor:n,interactive:a,overlay:i,zIndex:r,width:g,height:l,className:h,style:f}=t,b=Ei[s??"default"]||{},{canvasRef:m,canvas:w}=Ai({count:v??5,petalColor:k??b.petalColor??"#d1d5db",centerColor:e??b.centerColor??"#374151",stemColor:y??b.stemColor??"#6b7280",backgroundColor:P??b.backgroundColor??"#111111",wind:o??1,followCursor:n??!0,interactive:a??!0,overlay:i??!1});return Y.useImperativeHandle(u,()=>w,[w]),Mo.jsx(Io,{canvasRef:m,overlay:i,zIndex:r,width:g,height:l,className:h,style:f})});aa.displayName="Sunflowers";const Dt=(t,u,s)=>Math.max(u,Math.min(s,t)),zi=(t,u,s)=>{const v=Dt((s-t)/(u-t),0,1);return v*v*(3-2*v)};function Li(t){return 1/Math.max(.25,Math.sin(Dt(t,.05,1)*Math.PI/2))}function Fi(t){if(typeof document>"u")return null;const u=document.createElement("canvas");u.width=u.height=64;const s=u.getContext("2d");if(!s||typeof s.createRadialGradient!="function")return null;const v=s.createRadialGradient(32,32,0,32,32,32),k=uo(t,"255,255,255",.55);return v.addColorStop(0,`rgba(${k},1)`),v.addColorStop(.55,`rgba(${t},0.92)`),v.addColorStop(.8,`rgba(${t},0.4)`),v.addColorStop(1,`rgba(${t},0)`),s.fillStyle=v,s.fillRect(0,0,64,64),u}function Bi(t){const u=Y.useRef(t);u.current=t;const s=Eo(),v=Y.useRef(null),k=Y.useRef(Vo()),e=Y.useRef({t:0,pools:[],spots:[],leaves:[],gusts:[],stir:0,sx:-1,sy:-1,w:0,h:0,n:-1}),y=Y.useRef({key:"",img:null});function P(a,i,r){const g=e.current;g.w=a,g.h=i,g.n=r;const l=a*i/1e4,h=Dt(Math.round(l*7*r),16,1200);g.spots=[],g.pools=[];const f=Math.max(3,Math.round(h/24));for(let b=0;b<f;b++){const m=Math.random()*a,w=Math.random()*i,B=Math.min(a,i)*(.14+Math.random()*.2);g.pools.push({x:m,y:w,r:B,seed:Math.random()*1e3});for(let F=0;F<h/f;F++){const X=Math.random()*Math.PI*2,O=Math.sqrt(Math.random())*B;g.spots.push({x:m+Math.cos(X)*O,y:w+Math.sin(X)*O,r:Math.min(a,i)*(.018+Math.random()*.035),seed:Math.random()*1e3})}}g.leaves=Array.from({length:9},()=>({x:Math.random()*a,y:Math.random()*i,s:Math.min(a,i)*(.12+Math.random()*.14),a:Math.random()*Math.PI*2,seed:Math.random()*100}))}function o(a,i,r,g,l){const h=u.current,f=e.current,b=g/1e3,m=g/16.67;f.t+=b;const w=f.t;(f.w!==i||f.h!==r||f.n!==h.density)&&P(i,r,h.density);const B=Po(h.lightColor),F=Po(h.shadowColor);y.current.key!==B&&(y.current={key:B,img:Fi(B)});const X=Po(h.backgroundColor,"0,0,0"),O=!l.overlay&&h.backgroundColor!=="transparent",_=zo(s.current,v.current),{vx:H,vy:D}=k.current(_,m);if(h.interactive&&_.inside&&(f.stir=Math.min(3,f.stir+Math.hypot(H,D)*.01*m),f.sx=_.x,f.sy=_.y),f.stir*=Math.exp(-b*.9),h.interactive)for(const M of _.taps)f.gusts.push({x:M.x,y:M.y,r:0});const W=Math.min(i,r);for(const M of f.gusts)M.r+=b*W*.9;if(f.gusts=f.gusts.filter(M=>M.r<Math.hypot(i,r)),a.globalCompositeOperation="source-over",a.globalAlpha=1,O){const M=a.createLinearGradient(0,0,i,r);M.addColorStop(0,`rgb(${uo(X,F,.25)})`),M.addColorStop(1,`rgb(${uo(uo(X,F,.4),"0,0,0",.15)})`),a.fillStyle=M,a.fillRect(0,0,i,r);const p=a.createRadialGradient(i*.6,r*.35,0,i*.6,r*.35,Math.max(i,r)*.8);p.addColorStop(0,`rgba(${B},0.16)`),p.addColorStop(1,`rgba(${B},0)`),a.fillStyle=p,a.fillRect(0,0,i,r)}const A=Li(h.sunHeight),T=W*.025*h.wind,E=(M,p)=>{let R=0,c=0;for(const d of f.gusts){const $=M-d.x,C=p-d.y,S=Math.hypot($,C)||1,N=Math.exp(-(((S-d.r)/(W*.08))**2)),z=1-d.r/Math.hypot(i,r);R+=$/S*N*z*W*.03,c+=C/S*N*z*W*.03}return[R,c]};a.globalCompositeOperation=O?"lighter":"source-over";const x=y.current.img;if(x)for(const M of f.pools){const p=.6+.4*Go(w*.15+M.seed,6);a.globalAlpha=(O?.16:.07)*p;const R=M.r*1.5;a.drawImage(x,M.x-R,M.y-R*A,R*2,R*2*A)}const I=Math.round(f.spots.length*(.5+.5*l.quality));for(let M=0;M<I;M++){const p=f.spots[M];let R=(Go(w*.25*(.6+h.wind*.4)+p.y*.004,1)-.5)*T*2,c=(Go(w*.22*(.6+h.wind*.4)+p.x*.004,2)-.5)*T*1.4,d=0;if(f.sx>=0&&f.stir>.01){const q=Math.hypot(p.x-f.sx,p.y-f.sy);d=f.stir*Math.max(0,1-q/(W*.4)),R+=Math.sin(w*9+p.seed)*d*W*.012,c+=Math.cos(w*7+p.seed)*d*W*.012}const[$,C]=E(p.x,p.y);R+=$,c+=C;const S=zi(.22,.52,Go(w*(.35+.25*h.wind+d*1.5)+p.seed,5));if(S<.02)continue;const N=p.x+R,z=p.y+c,L=p.r*(.85+.3*S),G=O?.7*S:.25*S;a.globalAlpha=G,x?(a.save(),a.translate(N,z),a.rotate(.35),a.drawImage(x,-L,-L*A,L*2,L*2*A),a.restore()):(a.fillStyle=`rgb(${B})`,a.beginPath(),a.ellipse(N,z,L,L*A,.35,0,Math.PI*2),a.fill())}a.globalCompositeOperation="source-over";for(const M of f.leaves){const p=M.x+(Go(w*.18+M.seed,7)-.5)*T*5,R=M.y+(Go(w*.15+M.seed,8)-.5)*T*3,c=M.a+(Go(w*.2+M.seed,9)-.5)*.6*h.wind;for(let d=0;d<2;d++){const $=d?1.12:1;a.globalAlpha=O?d?.08:.14:d?.05:.08,a.fillStyle=`rgb(${uo(F,"0,0,0",.4)})`,a.save(),a.translate(p,R),a.rotate(c),a.scale($,$);const C=M.s;a.beginPath(),a.moveTo(-C,0),a.bezierCurveTo(-C*.4,-C*.42,C*.5,-C*.36,C,0),a.bezierCurveTo(C*.5,C*.36,-C*.4,C*.42,-C,0),a.fill(),a.restore()}}a.globalAlpha=1}const n=To({overlay:t.overlay,onFrame:o});return v.current=n.canvas,n}const Oi={default:{lightColor:"#ffd9a0",shadowColor:"#3a4a3a",backgroundColor:"#c9b49a"},monochrome:{},morning:{lightColor:"#fff2d6",shadowColor:"#5a6a78",backgroundColor:"#d8d4cc",sunHeight:.5},forest:{lightColor:"#e6f5a8",shadowColor:"#1e3a22",backgroundColor:"#4a5e40",sunHeight:.85},"golden-hour":{lightColor:"#ffb060",shadowColor:"#4a2a2a",backgroundColor:"#b88a6a",sunHeight:.3},moonlight:{lightColor:"#c8d8ff",shadowColor:"#0a1020",backgroundColor:"#28324a",sunHeight:.6}},la=Y.forwardRef((t,u)=>{const{preset:s,lightColor:v,shadowColor:k,backgroundColor:e,density:y,wind:P,sunHeight:o,interactive:n,overlay:a,zIndex:i,width:r,height:g,className:l,style:h}=t,f=Oi[s??"default"]||{},{canvasRef:b,canvas:m}=Bi({lightColor:v??f.lightColor??"#ffffff",shadowColor:k??f.shadowColor??"#374151",backgroundColor:e??f.backgroundColor??"#111111",density:y??1,wind:P??1,sunHeight:o??f.sunHeight??.7,interactive:n??!0,overlay:a??!1});return Y.useImperativeHandle(u,()=>m,[m]),Mo.jsx(Io,{canvasRef:b,overlay:a,zIndex:i,width:r,height:g,className:l,style:h})});la.displayName="Komorebi";const ut=(t,u,s)=>Math.max(u,Math.min(s,t));function Wi(t,u,s){return s?t<u*2.2:t<u*1.4}function qi(t){const u=Y.useRef(t);u.current=t;const s=Eo(),v=Y.useRef(null),k=Y.useRef(Vo()),e=Y.useRef({t:0,w:0,h:0,rockKey:"",anemones:[],stars:[],fish:[],rings:[],wake:0}),y=Y.useRef(null),P=Y.useRef(null);function o(r,g){const l=e.current;l.w=r,l.h=g,l.rockKey="";const h=Math.min(r,g);l.stars=Array.from({length:2},(f,b)=>({x:r*(.25+b*.5)+(Math.random()-.5)*r*.1,y:g*(.3+b*.4),r:h*(.09+Math.random()*.03),a:Math.random()*Math.PI,seed:Math.random()*100})),l.anemones=[],l.fish=[]}function n(r,g,l){if(typeof document>"u")return;const h=y.current??document.createElement("canvas");y.current=h,h.width=Math.max(1,Math.round(r)),h.height=Math.max(1,Math.round(g));const f=h.getContext("2d");if(!f)return;let b=7;const m=()=>((b=b*16807%2147483647)-1)/2147483646;f.fillStyle=`rgb(${uo(l,"210,190,150",.35)})`,f.fillRect(0,0,r,g);const w=Math.min(r,g);for(let B=0;B<14;B++){const F=m()*r,X=m()*g,O=w*(.06+m()*.12),_=.1+m()*.2,H=f.createRadialGradient(F-O*.3,X-O*.3,O*.1,F,X,O);H.addColorStop(0,`rgb(${uo(l,"255,255,255",_*.5)})`),H.addColorStop(1,`rgb(${uo(l,"0,0,0",_)})`),f.fillStyle=H,f.beginPath(),f.ellipse(F,X,O,O*(.6+m()*.4),m()*Math.PI,0,Math.PI*2),f.fill(),f.fillStyle=`rgba(${uo(l,"60,120,60",.6)},0.35)`,f.beginPath(),f.ellipse(F+O*.2,X+O*.1,O*.5,O*.3,m()*Math.PI,0,Math.PI*2),f.fill()}for(let B=0;B<260;B++){const F=m()*r,X=m()*g,O=w*(.004+m()*.014);f.fillStyle=`rgb(${uo(uo(l,"230,220,200",m()*.6),"0,0,0",m()*.3)})`,f.beginPath(),f.ellipse(F,X,O,O*(.6+m()*.4),m()*Math.PI,0,Math.PI*2),f.fill()}for(let B=0;B<6;B++){const F=m()*r,X=m()*g,O=w*.012;f.strokeStyle="rgba(255,245,230,0.6)",f.lineWidth=1,f.beginPath(),f.arc(F,X,O,Math.PI,0);for(let _=-2;_<=2;_++)f.moveTo(F,X),f.lineTo(F+_*O*.45,X-O);f.stroke()}}function a(r,g,l,h,f){const b=u.current,m=e.current,w=h/1e3,B=h/16.67;m.t+=w;const F=m.t;(m.w!==g||m.h!==l)&&o(g,l);const X=Math.min(g,l),O=Po(b.waterColor),_=Po(b.rockColor),H=Po(b.anemoneColor),D=Po(b.starfishColor);m.rockKey!==_&&(m.rockKey=_,n(g,l,_));const W=ut(Math.round(b.anemoneCount),0,20),A=ut(Math.round(b.fishCount),0,40);for(;m.anemones.length<W;){const c=m.anemones.length;m.anemones.push({x:g*((c*.618+.15)%1),y:l*((c*.382+.2)%1)*.8+l*.1,r:X*(.06+Math.random()*.035),open:1,seed:Math.random()*100,shut:!1})}for(m.anemones.length=W;m.fish.length<A;)m.fish.push({x:Math.random()*g,y:Math.random()*l,a:Math.random()*Math.PI*2,v:0,s:X*(.04+Math.random()*.02),seed:Math.random()*100,tail:0});m.fish.length=A;const T=zo(s.current,v.current),{vx:E,vy:x}=k.current(T,B),I=Math.hypot(E,x),M=b.interactive&&T.inside;if(M&&I>3&&(m.wake-=w,m.wake<=0&&(m.rings.push({x:T.x,y:T.y,age:0,big:!1}),m.wake=.12)),b.interactive)for(const c of T.taps){m.rings.push({x:c.x,y:c.y,age:0,big:!0});for(const d of m.anemones)Math.hypot(d.x-c.x,d.y-c.y)<d.r*4&&(d.shut=!0);for(const d of m.fish)Math.hypot(d.x-c.x,d.y-c.y)<X*.4&&(d.a=Math.atan2(d.y-c.y,d.x-c.x),d.v=X*1.4)}for(const c of m.rings)c.age+=w;m.rings=m.rings.filter(c=>c.age<(c.big?2.4:1.2)),r.globalCompositeOperation="source-over",r.globalAlpha=1;const p=X*.004;y.current?r.drawImage(y.current,Math.sin(F*.7)*p,Math.cos(F*.6)*p,g,l):(r.fillStyle=`rgb(${_})`,r.fillRect(0,0,g,l));for(const c of m.stars){r.save(),r.translate(c.x,c.y),r.rotate(c.a+Math.sin(F*.05+c.seed)*.1),r.fillStyle="rgba(0,0,0,0.25)";const d=(C,S)=>{r.beginPath();for(let N=0;N<5;N++){const z=N/5*Math.PI*2,L=Math.sin(F*.4+c.seed+N*1.3)*.25,G=z+L,q=c.r,j=c.r*.32,V=z-Math.PI/5,K=z+Math.PI/5;N===0&&r.moveTo(C+Math.cos(V)*j,S+Math.sin(V)*j),r.quadraticCurveTo(C+Math.cos(z-.15)*q*.6,S+Math.sin(z-.15)*q*.6,C+Math.cos(G)*q,S+Math.sin(G)*q),r.quadraticCurveTo(C+Math.cos(z+.15)*q*.6,S+Math.sin(z+.15)*q*.6,C+Math.cos(K)*j,S+Math.sin(K)*j)}r.closePath()};d(c.r*.08,c.r*.1),r.fill();const $=r.createRadialGradient(0,0,0,0,0,c.r);$.addColorStop(0,`rgb(${uo(D,"255,240,220",.25)})`),$.addColorStop(1,`rgb(${uo(D,"0,0,0",.25)})`),r.fillStyle=$,d(0,0),r.fill(),r.fillStyle=`rgba(${uo(D,"255,255,255",.5)},0.7)`;for(let C=0;C<5;C++){const S=C/5*Math.PI*2+Math.sin(F*.4+c.seed+C*1.3)*.12;for(let N=1;N<6;N++){const z=c.r*N*.15;r.beginPath(),r.arc(Math.cos(S)*z,Math.sin(S)*z,c.r*.025,0,Math.PI*2),r.fill()}}r.restore()}for(const c of m.anemones){const d=M?Math.hypot(T.x-c.x,T.y-c.y):1e9;c.shut=Wi(d,c.r,c.shut)||c.shut&&c.open>.6,c.open+=((c.shut?0:1)-c.open)*Math.min(1,w*(c.shut?7:.6));const $=28;r.fillStyle="rgba(0,0,0,0.3)",r.beginPath(),r.arc(c.x+c.r*.15,c.y+c.r*.2,c.r*(.45+.6*c.open),0,Math.PI*2),r.fill(),r.lineCap="round";for(let S=0;S<2;S++)for(let N=0;N<$;N++){const z=(N+S*.5)/$*Math.PI*2,L=(Ke(c.x*.01+F*.4,c.y*.01+N*.1,3)-.5)*.9,G=c.r*(S?.75:1)*(.25+.75*c.open),q=z+L*c.open,j=c.x+Math.cos(z)*c.r*.25,V=c.y+Math.sin(z)*c.r*.25,K=c.x+Math.cos(q)*(c.r*.25+G),to=c.y+Math.sin(q)*(c.r*.25+G);r.strokeStyle=`rgb(${uo(H,S?"255,255,255":"0,0,0",S?.15:.2)})`,r.lineWidth=c.r*.11,r.beginPath(),r.moveTo(j,V),r.quadraticCurveTo(j+Math.cos(z)*G*.6,V+Math.sin(z)*G*.6,K,to),r.stroke(),r.fillStyle=`rgb(${uo(H,"255,250,240",.55)})`,r.beginPath(),r.arc(K,to,c.r*.06,0,Math.PI*2),r.fill()}const C=r.createRadialGradient(c.x,c.y,0,c.x,c.y,c.r*.35);C.addColorStop(0,`rgb(${uo(H,"0,0,0",.5)})`),C.addColorStop(.5,`rgb(${uo(H,"255,220,180",.3)})`),C.addColorStop(1,`rgb(${uo(H,"0,0,0",.2)})`),r.fillStyle=C,r.beginPath(),r.arc(c.x,c.y,c.r*(.3+.08*(1-c.open)),0,Math.PI*2),r.fill()}for(const c of m.fish){let d=(Ke(c.seed,F*.3,9)-.5)*3,$=X*.12;if(M){const S=c.x-T.x,N=c.y-T.y;if(Math.hypot(S,N)<X*.25){const L=Math.atan2(N,S);d+=Math.atan2(Math.sin(L-c.a),Math.cos(L-c.a))*6,$=X*(.6+I*.02)}}const C=X*.08;if(c.x<C||c.x>g-C||c.y<C||c.y>l-C){const S=Math.atan2(l/2-c.y,g/2-c.x);d+=Math.atan2(Math.sin(S-c.a),Math.cos(S-c.a))*3}c.a+=d*w,c.v+=($-c.v)*Math.min(1,w*2.5),c.x+=Math.cos(c.a)*c.v*w,c.y+=Math.sin(c.a)*c.v*w,c.x=ut(c.x,0,g),c.y=ut(c.y,0,l),c.tail+=w*(6+c.v/X*30)}for(const c of[0,1])for(const d of m.fish){r.save(),r.translate(d.x+(c?0:d.s*.9),d.y+(c?0:d.s*1.2)),r.rotate(d.a);const $=Math.sin(d.tail)*.35,C=d.s;if(r.fillStyle=c?`rgb(${uo(_,"200,200,180",.4)})`:"rgba(0,0,0,0.28)",r.beginPath(),r.moveTo(C,0),r.quadraticCurveTo(C*.4,-C*.32,-C*.6,Math.sin($)*C*.15),r.quadraticCurveTo(C*.4,C*.32,C,0),r.fill(),r.save(),r.translate(-C*.6,Math.sin($)*C*.15),r.rotate($),r.beginPath(),r.moveTo(0,0),r.lineTo(-C*.4,-C*.25),r.lineTo(-C*.4,C*.25),r.closePath(),r.fill(),r.restore(),c){r.fillStyle=`rgba(${uo(_,"0,0,0",.5)},0.6)`,r.beginPath(),r.ellipse(C*.1,0,C*.45,C*.05,0,0,Math.PI*2),r.fill(),r.fillStyle="rgb(20,20,20)";for(const S of[-1,1])r.beginPath(),r.arc(C*.7,S*C*.13,C*.06,0,Math.PI*2),r.fill()}r.restore()}const R=r.createRadialGradient(g/2,l/2,X*.1,g/2,l/2,Math.hypot(g,l)*.6);R.addColorStop(0,`rgba(${O},0.16)`),R.addColorStop(1,`rgba(${uo(O,"0,0,0",.5)},0.6)`),r.fillStyle=R,r.fillRect(0,0,g,l),br(r,P,g,l,F,uo(O,"255,255,240",.75),b.causticIntensity,f.quality,11,M?T:null),r.lineWidth=1.5;for(const c of m.rings){const d=c.big?2.4:1.2,$=c.age*X*(c.big?.35:.15),C=(1-c.age/d)*(c.big?.6:.3);r.strokeStyle=`rgba(255,255,255,${C})`,r.beginPath(),r.arc(c.x,c.y,$,0,Math.PI*2),r.stroke(),c.big&&(r.strokeStyle=`rgba(${uo(O,"0,0,0",.4)},${C*.6})`,r.beginPath(),r.arc(c.x,c.y,$*.8,0,Math.PI*2),r.stroke())}r.fillStyle="rgba(255,255,255,0.5)";for(let c=0;c<12;c++){const d=(c*.618+F*.01)%1*g,$=(c*.382+Math.sin(F*.3+c)*.01)%1*l,C=Math.max(0,Math.sin(F*2.3+c*2.1));r.globalAlpha=C*C*.6,r.beginPath(),r.ellipse(d,$,X*.012,X*.003,.4,0,Math.PI*2),r.fill()}r.globalAlpha=1}const i=To({onFrame:a});return v.current=i.canvas,i}const Gi={default:{waterColor:"#2a8a8f",rockColor:"#6e6457",anemoneColor:"#5fbf7a",starfishColor:"#e0702e"},monochrome:{},tropical:{waterColor:"#22b5c4",rockColor:"#c8b48a",anemoneColor:"#b05fd0",starfishColor:"#3a6ad8"},"kelp-coast":{waterColor:"#1f5a48",rockColor:"#4a4a40",anemoneColor:"#e07aa0",starfishColor:"#8a3aa0"},sunset:{waterColor:"#c0704a",rockColor:"#5a4a40",anemoneColor:"#f0c050",starfishColor:"#d8402e"},night:{waterColor:"#0e2a4a",rockColor:"#2a2c34",anemoneColor:"#4ae0d0",starfishColor:"#c06a3a"}},sa=Y.forwardRef((t,u)=>{const{preset:s,waterColor:v,rockColor:k,anemoneColor:e,starfishColor:y,fishCount:P,anemoneCount:o,causticIntensity:n,interactive:a,width:i,height:r,className:g,style:l}=t,h=Gi[s??"default"]||{},{canvasRef:f,canvas:b}=qi({waterColor:v??h.waterColor??"#6b7280",rockColor:k??h.rockColor??"#4b5563",anemoneColor:e??h.anemoneColor??"#d1d5db",starfishColor:y??h.starfishColor??"#9ca3af",fishCount:P??7,anemoneCount:o??5,causticIntensity:n??1,interactive:a??!0});return Y.useImperativeHandle(u,()=>b,[b]),Mo.jsx(Io,{canvasRef:f,width:i,height:r,className:g,style:l})});sa.displayName="TidePool";exports.AntColony=pr;exports.AuroraBorealis=er;exports.BlackHole=vr;exports.Boids=Zn;exports.BubbleUniverse=Sr;exports.ButterflySwarm=xr;exports.Candle=oa;exports.Cat=ea;exports.CloudSea=Vr;exports.Confetti=Xn;exports.CrystalGrowth=hr;exports.Dandelion=Lr;exports.DiffusionAggregation=ar;exports.DragonCursor=yr;exports.Eye=Kr;exports.Ferrofluid=Ur;exports.FireEffect=jn;exports.Fireflies=zr;exports.Fireworks=_n;exports.FlowField=Yn;exports.FluidSimulation=Un;exports.GalaxySpiral=wr;exports.GameOfLife=Qn;exports.GrassField=Fr;exports.Hummingbird=Zr;exports.IncenseSmoke=Hr;exports.InkMountains=jr;exports.IvyGrowth=Ar;exports.Jellyfish=ta;exports.Kaleidoscope=lr;exports.KelpForest=qr;exports.KoiPond=Cr;exports.Komorebi=la;exports.Lightning=Jn;exports.MagneticField=mr;exports.Mandala=Vn;exports.MatrixRain=Wn;exports.Metaballs=gr;exports.MoonlitSea=_r;exports.Moths=Br;exports.NeuralWeb=ur;exports.NoiseGradient=Hn;exports.Octopus=Qr;exports.OrigamiCranes=Dr;exports.Owl=Jr;exports.PaperLanterns=Wr;exports.ParticleField=qn;exports.PendulaWave=dr;exports.Rain=Kn;exports.ReactionDiffusion=or;exports.SakuraBlossom=Mr;exports.SandSimulation=nr;exports.SeasonsTree=Nr;exports.SlimeMold=ir;exports.Snail=na;exports.SnowDrift=Gr;exports.SolarFlare=Rr;exports.SpiderWeb=Pr;exports.Spirograph=tr;exports.Starfield=Nn;exports.SunbeamDust=Or;exports.Sunflowers=aa;exports.TidePool=sa;exports.TornadoVortex=kr;exports.VoronoiCells=sr;exports.WatercolorBloom=fr;exports.WaveInterference=rr;exports.WindowRain=Xr;