1import{r as l,j}from"./app-kHafurZ5.js";import{c as k}from"./button-CydtzLAX.js";const B=({squareSize:r=4,gridGap:u=6,flickerChance:b=.3,color:v="rgb(0, 0, 0)",width:R,height:I,className:p,maxOpacity:h=.3,...V})=>{const A=l.useRef(null),C=l.useRef(null),[w,E]=l.useState(!1),[$,T]=l.useState({width:0,height:0}),y=l.useMemo(()=>(n=>{if(typeof window>"u")return"rgba(0, 0, 0,";const t=document.createElement("canvas");t.width=t.height=1;const s=t.getContext("2d");if(!s)return"rgba(255, 0, 0,";s.fillStyle=n,s.fillRect(0,0,1,1);const[o,c,a]=Array.from(s.getImageData(0,0,1,1).data);return`rgba(${o}, ${c}, ${a},`})(v),[v]),F=l.useCallback((e,n,t)=>{const s=window.devicePixelRatio||1;e.width=n*s,e.height=t*s,e.style.width=`${n}px`,e.style.height=`${t}px`;const o=Math.floor(n/(r+u)),c=Math.floor(t/(r+u)),a=new Float32Array(o*c);for(let i=0;i<a.length;i++)a[i]=Math.random()*h;return{cols:o,rows:c,squares:a,dpr:s}},[r,u,h]),x=l.useCallback((e,n)=>{for(let t=0;t<e.length;t++)Math.random()<b*n&&(e[t]=Math.random()*h)},[b,h]),M=l.useCallback((e,n,t,s,o,c,a)=>{e.clearRect(0,0,n,t),e.fillStyle="transparent",e.fillRect(0,0,n,t);for(let i=0;i<s;i++)for(let f=0;f<o;f++){const m=c[i*o+f];e.fillStyle=`${y}${m})`,e.fillRect(i*(r+u)*a,f*(r+u)*a,r*a,r*a)}},[y,r,u]);return l.useEffect(()=>{const e=A.current,n=C.current;if(!e||!n)return;const t=e.getContext("2d");if(!t)return;let s,o;const c=()=>{const d=R||n.clientWidth,g=I||n.clientHeight;T({width:d,height:g}),o=F(e,d,g)};c();let a=0;const i=d=>
1{if(!w)return;const g=(d-a)/1e3;a=d,x(o.squares,g),M(t,e.width,e.height,o.cols,o.rows,o.squares,o.dpr),s=requestAnimationFrame(i)},f=new ResizeObserver(()=>{c()});f.observe(n);const m=new IntersectionObserver(([d])=>{E(d.isIntersecting)},{threshold:0});return m.observe(e),w&&(s=requestAnimationFrame(i)),()=>{cancelAnimationFrame(s),f.disconnect(),m.disconnect()}},[F,x,M,R,I,w]),j.jsx("div",{ref:C,className:k(`h-full w-full ${p}`),...V,children:j.jsx("canvas",{ref:A,className:"pointer-events-none",style:{width:$.width,height:$.height}})})};function N(r){if(r.headerImage)return r.headerImage;if(r.headerVideo&&r.headerVideoThumbnail)return r.headerVideoThumbnail}export{B as F,N as g};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.