"use strict";(globalThis.webpackChunkultimate_cursor=globalThis.webpackChunkultimate_cursor||[]).push([[114],{4114(e,t,n){n.d(t,{default:()=>a});var i=n(1609);class o{position;velocity;lifeSpan;initialLifeSpan;canv;fallSpeed;constructor(e,t,n,i=100,o=1){this.position={x:e,y:t},this.velocity={x:(Math.random()<.5?-1:1)*(Math.random()/2),y:o+Math.random()},this.lifeSpan=Math.floor(30*Math.random()+i),this.initialLifeSpan=this.lifeSpan,this.canv=n,this.fallSpeed=o}update(e){this.position.x+=this.velocity.x,this.position.y+=this.velocity.y,this.lifeSpan--,this.velocity.x+=2*(Math.random()<.5?-1:1)/75,this.velocity.y-=Math.random()/300;const t=.01*(this.initialLifeSpan-this.lifeSpan),n=Math.max(this.lifeSpan/this.initialLifeSpan,0);e.save(),e.translate(this.position.x,this.position.y),e.rotate(t),e.scale(n,n),e.drawImage(this.canv,-this.canv.width/2,-this.canv.height/2),e.restore()}}const a=({wrapperElement:e,props:t})=>{const n=(0,i.useRef)(null),a=(0,i.useRef)([]),s=(0,i.useRef)([]),r=(0,i.useRef)(null),l=t?.snowflakeEmojis||["❄️"],c=t?.snowflakeSize||12,h=t?.snowflakeCount||5,u=t?.snowflakeLifespan||100,d=t?.snowflakeFallSpeed||1,f=(0,i.useRef)(null);return(0,i.useEffect)(()=>{if("undefined"==typeof window)return;f.current=window.matchMedia("(prefers-reduced-motion: reduce)");const t=document.createElement("canvas");t.style.zIndex="999999999";const i=t.getContext("2d");if(!i)return;const p=void 0!==e,m=p?e:document.body;t.style.position=p?"absolute":"fixed",t.style.top="0",t.style.left="0",t.style.pointerEvents="none",m.appendChild(t),n.current=t;const w=()=>{t.width=p?e.clientWidth:window.innerWidth,t.height=p?e.clientHeight:window.innerHeight},v=t=>{((e,t)=>{for(let n=0;n<h;n++){const n=s.current[Math.floor(Math.random()*s.current.length)],i=e+(20*Math.random()-10),r=t+(20*Math.random()-10);a.current.push(new o(i,r,n,u,d))}})(p?t.clientX-e.getBoundingClientRect().left:t.clientX,p?t.clientY-e.getBoundingClientRect().top:t.clientY)},x=()=>{i&&t&&(i.clearRect(0,0,t.width,t.height),a.current.forEach((e,t)=>{e.update(i),e.lifeSpan<0&&a.current.splice(t,1)})),r.current=requestAnimationFrame(x)},g=()=>{f.current?.matches||(w(),s.current=[],i.font=`${c}px serif`,i.textBaseline="middle",i.textAlign="center",l.forEach(e=>{const t=i.measureText(e),n=document.createElement("canvas");n.style.zIndex="999999999";const o=n.getContext("2d");o&&(n.width=t.width,n.height=2*t.actualBoundingBoxAscent,o.textAlign="center",o.font=`${c}px serif`,o.textBaseline="middle",o.fillText(e,n.width/2,t.actualBoundingBoxAscent),s.current.push(n))}),m.addEventListener("mousemove",v),window.addEventListener("resize",w),x())},y=()=>{n.current&&n.current.remove(),r.current&&cancelAnimationFrame(r.current),m.removeEventListener("mousemove",v),window.removeEventListener("resize",w)};return f.current.onchange=()=>{f.current?.matches?y():g()},g(),()=>y()},[e,l,c,h,u,d]),null}}}]);