react-confetti-burst 1.0.5 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var xe=Object.defineProperty;var Mt=Object.getOwnPropertyDescriptor;var Ot=Object.getOwnPropertyNames;var Bt=Object.prototype.hasOwnProperty;var kt=(e,t)=>{for(var n in t)xe(e,n,{get:t[n],enumerable:!0})},_t=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ot(t))!Bt.call(e,i)&&i!==n&&xe(e,i,{get:()=>t[i],enumerable:!(r=Mt(t,i))||r.enumerable});return e};var zt=e=>_t(xe({},"__esModule",{value:!0}),e);var un={};kt(un,{ConfettiBurst:()=>At,ConfettiButton:()=>Ke,ConfettiEngine:()=>de,DEFAULT_COLORS:()=>me,DEFAULT_CONFIG:()=>_,DEFAULT_DIRECTION:()=>ae,DEFAULT_PARTICLE:()=>se,DEFAULT_PHYSICS:()=>oe,DIRECTION_ANGLES:()=>ge,EASING_FUNCTIONS:()=>rt,clamp:()=>z,confetti:()=>v,createConfettiExplosion:()=>De,default:()=>v,degToRad:()=>S,fireFromElement:()=>Ct,forceCleanup:()=>wt,getActiveAnimationCount:()=>vt,getDirectionAngle:()=>ce,getElementCenter:()=>ct,isBrowser:()=>$,lerp:()=>st,mergeConfig:()=>be,parseColor:()=>J,radToDeg:()=>lt,randomFromArray:()=>Z,randomInRange:()=>m,randomInt:()=>at,rgbaToString:()=>K,useConfetti:()=>j});module.exports=zt(un);var me=["#FF6B6B","#4ECDC4","#FFE66D","#95E1D3","#F38181","#AA96DA","#FCBAD3","#A8D8EA","#FF9A8B","#88D8B0"],oe={gravity:1,drag:.035,friction:.99,rotationSpeed:1,wind:0,windVariation:.02,tumble:!0,decay:.99,bounce:0,floor:null,wobble:!0,wobbleSpeed:1.5,flutter:!0,flutterSpeed:2.5,flutterIntensity:.4,airResistance:.03,swayAmplitude:15,swayFrequency:2},ae={direction:"up",spread:55,velocity:[25,50],velocityDecay:.92},se={colors:me,shapes:["square","rectangle","circle"],size:[6,14],opacity:[.85,1],lifespan:4e3,fadeOut:!0,scaleDown:!1,spin:!0,spinSpeed:[-15,15],tilt:[-30,30],depth3D:.6,aspectRatio:[.5,1.5],shimmer:!0},V={enabled:!1,length:10,fade:.5,width:.5},Re={enabled:!1,blur:10,color:null,intensity:.5},tt={recycle:!1,numberOfPieces:200,spawnRate:50,run:!0,tweenDuration:5e3},nt={secondaryExplosions:!0,burstCount:80,burstDelay:500,spread:360,launchHeight:.6,rocketColors:["#ffd700","#ff6b35","#ff0000"],burstColors:["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff"],trailLength:10,riseDuration:1e3,showRocket:!0},Ee={width:null,height:null,autoResize:!0,resizeDebounce:100,frameRate:null,pixelRatio:null,useWorker:!1,useOffscreen:!1};var _={particleCount:50,particle:se,physics:oe,direction:ae,mode:"burst",easing:"easeOut",zIndex:9999,autoCleanup:!0,scalar:1,drift:0,flat:!1},ge={up:90,down:270,left:180,right:0},E={DEG_TO_RAD:Math.PI/180,RAD_TO_DEG:180/Math.PI,TWO_PI:Math.PI*2,HALF_PI:Math.PI/2},rt={linear:e=>e,easeIn:e=>e*e*e,easeOut:e=>1-Math.pow(1-e,3),easeInOut:e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2,bounce:e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,elastic:e=>{let t=2*Math.PI/3;return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e*10-.75)*t)+1},back:e=>1+2.70158*Math.pow(e-1,3)+1.70158*Math.pow(e-1,2),circ:e=>Math.sqrt(1-Math.pow(e-1,2)),expo:e=>e===1?1:1-Math.pow(2,-10*e)};var le={r:0,g:0,b:0,a:0},X={MAX_PARTICLES:500,FRAME_BUDGET:16.67,MIN_OPACITY:.01,MIN_SIZE:.5,MAX_DPR:2},it=100,Fe=5,ot=.5,k={rainbow:me,pride:["#E40303","#FF8C00","#FFED00","#008026","#24408E","#732982"],christmas:["#C41E3A","#165B33","#FFD700","#FFFFFF","#BB2528"],halloween:["#FF6600","#000000","#8B008B","#00FF00","#FFD700"],pastel:["#FFB3BA","#FFDFBA","#FFFFBA","#BAFFC9","#BAE1FF"],neon:["#FF00FF","#00FFFF","#FF0080","#80FF00","#FF8000"],gold:["#FFD700","#DAA520","#B8860B","#FFC125","#FFDF00"],silver:["#C0C0C0","#A8A8A8","#D3D3D3","#DCDCDC","#E8E8E8"],hearts:["#FF69B4","#FF1493","#FF007F","#DC143C","#FFB6C1"],ocean:["#006994","#00CED1","#20B2AA","#48D1CC","#87CEEB"]},ie={celebration:["🎉","🎊","🥳","✨","🎈"],hearts:["❤️","💕","💖","💗","💓","💘"],stars:["⭐","🌟","✨","💫","⚡"],money:["💰","💵","💸","🤑","💎"],christmas:["🎄","🎅","🎁","❄️","⭐"],halloween:["🎃","👻","🦇","🕷️","💀"],birthday:["🎂","🎁","🎈","🎉","🥳"],food:["🍕","🍔","🍟","🌭","🍿"]},hn={default:{name:"default",description:"Default balanced confetti burst with realistic paper physics",options:{particleCount:60,particle:{shapes:["square","rectangle","circle"],size:[6,14],depth3D:.6,tilt:[-30,30]},physics:{gravity:.25,drag:.035,wobble:!0,wobbleSpeed:1.5}}},celebration:{name:"celebration",description:"Big celebration with lots of colorful confetti and realistic movement",options:{particleCount:120,particle:{colors:[...k.rainbow],shapes:["square","rectangle","circle","star"],size:[8,16],lifespan:5e3,depth3D:.7,tilt:[-35,35]},direction:{direction:"radial",spread:360,velocity:[30,55]},physics:{gravity:.22,drag:.04,wobble:!0,wobbleSpeed:2,windVariation:.03}}},firework:{name:"firework",description:"Firework-style explosion with secondary bursts",options:{mode:"firework",particleCount:80,particle:{colors:[...k.neon],shapes:["circle","star"],size:[4,8],trail:{enabled:!0,length:8,fade:.6},glow:{enabled:!0,blur:8,intensity:.7}},firework:{secondaryExplosions:!0,burstCount:80}}},snow:{name:"snow",description:"Gentle falling snowflakes",options:{mode:"snow",particleCount:150,particle:{colors:["#FFFFFF","#F0F8FF","#E0FFFF"],shapes:["circle"],size:[3,8],lifespan:8e3,opacity:[.6,1]},physics:{gravity:.05,wind:.3,windVariation:.2,wobble:!0,wobbleSpeed:2},continuous:{recycle:!0,numberOfPieces:150}}},rain:{name:"rain",description:"Rainfall effect",options:{mode:"rain",particleCount:200,particle:{colors:["#6CA0DC","#4A90D9","#2E7BB9"],shapes:["line"],size:[2,4],lifespan:2e3},physics:{gravity:.8,wind:.1},direction:{direction:"down",spread:10,velocity:[30,50]},continuous:{recycle:!0}}},sparkle:{name:"sparkle",description:"Sparkling stars with glow effect",options:{particleCount:40,particle:{colors:[...k.gold],shapes:["star"],size:[6,12],glow:{enabled:!0,blur:15,intensity:.8}},physics:{gravity:.1}}},confetti:{name:"confetti",description:"Classic confetti falling with realistic paper flutter",options:{mode:"continuous",particleCount:200,particle:{shapes:["square","rectangle"],size:[6,14],depth3D:.8,tilt:[-40,40],lifespan:6e3},physics:{gravity:.18,drag:.045,wind:.08,windVariation:.04,wobble:!0,wobbleSpeed:2},continuous:{recycle:!0,numberOfPieces:200},spawnArea:{x:0,y:0,width:typeof window<"u"?window.innerWidth:1920,height:0}}},emoji:{name:"emoji",description:"Emoji celebration",options:{particleCount:30,particle:{images:ie.celebration.map(e=>({src:e,isEmoji:!0,scale:1.5})),size:[20,30],lifespan:4e3},direction:{direction:"up",spread:60,velocity:[20,35]}}},hearts:{name:"hearts",description:"Floating hearts",options:{particleCount:50,particle:{colors:[...k.hearts],shapes:["heart"],size:[12,20],lifespan:5e3},physics:{gravity:-.1,wobble:!0},direction:{direction:"up",spread:90,velocity:[10,20]}}},stars:{name:"stars",description:"Shooting stars",options:{particleCount:60,particle:{colors:[...k.gold,"#FFFFFF"],shapes:["star"],size:[8,16],trail:{enabled:!0,length:12,fade:.4}},direction:{direction:"radial",spread:360,velocity:[30,60]}}},money:{name:"money",description:"Money rain",options:{particleCount:40,particle:{colors:["#85BB65","#228B22","#32CD32"],images:ie.money.map(e=>({src:e,isEmoji:!0})),size:[20,30],lifespan:4e3},physics:{gravity:.15,wobble:!0}}},pride:{name:"pride",description:"Pride rainbow celebration",options:{particleCount:100,particle:{colors:[...k.pride],shapes:["square","rectangle","heart"],size:[10,16]},direction:{direction:"radial",spread:360,velocity:[25,45]}}},christmas:{name:"christmas",description:"Christmas celebration",options:{particleCount:80,particle:{colors:[...k.christmas],shapes:["star","circle"],size:[8,14],images:ie.christmas.map(e=>({src:e,isEmoji:!0}))}}},halloween:{name:"halloween",description:"Spooky Halloween",options:{particleCount:60,particle:{colors:[...k.halloween],shapes:["circle","star"],images:ie.halloween.map(e=>({src:e,isEmoji:!0})),size:[15,25]},physics:{gravity:.2,wobble:!0}}},newYear:{name:"newYear",description:"New Year celebration with fireworks",options:{mode:"firework",particleCount:100,particle:{colors:[...k.gold,...k.silver],shapes:["star","circle"],size:[6,12],trail:{enabled:!0,length:10},glow:{enabled:!0,blur:12}},firework:{secondaryExplosions:!0,burstCount:100}}},birthday:{name:"birthday",description:"Birthday party celebration",options:{particleCount:80,particle:{colors:[...k.pastel,...k.rainbow],shapes:["star","circle","heart"],images:ie.birthday.map(e=>({src:e,isEmoji:!0})),size:[12,20],lifespan:5e3},direction:{direction:"up",spread:80,velocity:[25,45]}}}};function C(){if(typeof crypto<"u"&&crypto.getRandomValues){let e=new Uint32Array(1);return crypto.getRandomValues(e),e[0]/4294967296}return Math.random()}function m(e,t){return e+C()*(t-e)}function at(e,t){return Math.floor(m(e,t+1))}function Z(e){if(e.length===0)throw new Error("Cannot pick from empty array");return e[Math.floor(C()*e.length)]}function z(e,t,n){return Math.min(Math.max(e,t),n)}function st(e,t,n){return e+(t-e)*z(n,0,1)}function S(e){return e*E.DEG_TO_RAD}function lt(e){return e*E.RAD_TO_DEG}function J(e){if(typeof e=="object"&&"r"in e)return{r:z(Math.round(e.r),0,255),g:z(Math.round(e.g),0,255),b:z(Math.round(e.b),0,255),a:z(e.a,0,1)};if(typeof e=="object"&&"type"in e)return J(e.colors[0]);let t=e.trim().toLowerCase();return t.startsWith("#")?Lt(t):t.startsWith("rgb")?Ht(t):Nt(t)}function Lt(e){let t=e.slice(1),n,r,i,o=1;switch(t.length){case 3:n=parseInt(t[0]+t[0],16),r=parseInt(t[1]+t[1],16),i=parseInt(t[2]+t[2],16);break;case 4:n=parseInt(t[0]+t[0],16),r=parseInt(t[1]+t[1],16),i=parseInt(t[2]+t[2],16),o=parseInt(t[3]+t[3],16)/255;break;case 6:n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16);break;case 8:n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16),o=parseInt(t.slice(6,8),16)/255;break;default:return le}return isNaN(n)||isNaN(r)||isNaN(i)||isNaN(o)?le:{r:n,g:r,b:i,a:o}}function Ht(e){let t=e.match(/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/);return t?{r:z(parseInt(t[1],10),0,255),g:z(parseInt(t[2],10),0,255),b:z(parseInt(t[3],10),0,255),a:t[4]!==void 0?z(parseFloat(t[4]),0,1):1}:le}function Nt(e){let t={red:{r:255,g:0,b:0,a:1},green:{r:0,g:128,b:0,a:1},blue:{r:0,g:0,b:255,a:1},white:{r:255,g:255,b:255,a:1},black:{r:0,g:0,b:0,a:1},yellow:{r:255,g:255,b:0,a:1},cyan:{r:0,g:255,b:255,a:1},magenta:{r:255,g:0,b:255,a:1},orange:{r:255,g:165,b:0,a:1},purple:{r:128,g:0,b:128,a:1},pink:{r:255,g:192,b:203,a:1}};if(t[e])return t[e];if(typeof document<"u")try{let n=document.createElement("canvas");n.width=1,n.height=1;let r=n.getContext("2d");if(r){r.fillStyle=e,r.fillRect(0,0,1,1);let i=r.getImageData(0,0,1,1).data;return{r:i[0],g:i[1],b:i[2],a:i[3]/255}}}catch{}return le}function K(e){return`rgba(${e.r}, ${e.g}, ${e.b}, ${e.a})`}function ce(e,t){if(e==="custom"&&t!==void 0)return S(t);if(e==="radial")return C()*E.TWO_PI;let n=ge[e];return S(n??90)}function ct(e){let t=e.getBoundingClientRect();return{x:t.left+t.width/2,y:t.top+t.height/2}}function be(e){if(!e)return _;let t={...se,...e.particle},n={...oe,...e.physics},r={...ae,...e.direction};return{particleCount:e.particleCount??_.particleCount,particle:t,physics:n,direction:r,mode:e.mode??_.mode,spawnArea:e.spawnArea?{type:"rect",x:0,y:0,...e.spawnArea}:void 0,continuous:e.continuous,firework:e.firework,canvas:e.canvas,easing:e.easing??_.easing,zIndex:e.zIndex??_.zIndex,autoCleanup:e.autoCleanup??_.autoCleanup,scalar:e.scalar??_.scalar,drift:e.drift??_.drift,flat:e.flat??_.flat,onStart:e.onStart,onComplete:e.onComplete,onFrame:e.onFrame,onParticleCreate:e.onParticleCreate,onParticleDeath:e.onParticleDeath}}function $(){return typeof window<"u"&&typeof document<"u"}function ut(e=2){return $()?Math.min(window.devicePixelRatio||1,e):1}function dt(){let e,t;return{promise:new Promise((r,i)=>{e=r,t=i}),resolve:e,reject:t}}var Ut=0;function Q(e,t,n,r,i,o,a,s,c,l,u){let p=m(a[0],a[1]),f=m(s[0],s[1]),h=Z(i),F=typeof h=="string"?J(h):"type"in h?J(h.colors[0]):h,w=1+(C()-.5)*.3,A=Math.cos(n)*r*w,g=-Math.sin(n)*r*w,y;u?.images&&u.images.length>0&&(y=Z(u.images));let d=u?.tiltRange??[-30,30],x=u?.spinSpeedRange??[-15,15],D=u?.aspectRatioRange??[.5,1.5],R=m(D[0],D[1]);return{id:Ut++,x:e,y:t,vx:A,vy:g,size:p,originalSize:p,rotation:C()*E.TWO_PI,rotationSpeed:(C()-.5)*.3*l,color:F,shape:y?"custom":Z(o),opacity:f,originalOpacity:f,life:c,maxLife:c,active:!0,image:y,imageElement:null,trail:[],wobblePhase:C()*E.TWO_PI,wobbleSpeed:m(.8,2.5),tilt:S(m(d[0],d[1])),tiltSpeed:m(x[0],x[1])*.015,depth:u?.depth3D??.6,hasExploded:!1,data:{},flutterPhase:C()*E.TWO_PI,flutterSpeed:m(1.5,3.5),swayPhase:C()*E.TWO_PI,aspectRatio:R,angularVelocity:(C()-.5)*.4,scaleX:1,scaleY:1,shimmerPhase:C()*E.TWO_PI,currentDrag:m(.02,.05)}}function ft(e,t,n,r,i,o,a){if(!e.active)return;let s=t*.05988;if(o?.enabled??V.enabled){let P=e.trail;P.unshift({x:e.x,y:e.y,opacity:e.opacity,size:e.size});let B=o?.length??V.length;P.length>B&&P.pop()}let c=e.vx,l=e.vy,u=e.tilt,p=c*c+l*l,f=u-u*u*u*.166667,h=1+f*.15;if(l+=n.gravity*h*s,(n.flutter??!0)&&p>1){let P=n.flutterSpeed??2.5,B=n.flutterIntensity??.4;e.flutterPhase+=P*.05*s;let N=e.flutterPhase,he=(N-N*N*N*.166667)*B*s,Dt=1-u*u*.5;if(c+=he*Dt,(f<0?-f:f)>.7){let St=he<0?-he:he;l-=St*.3}}let w=n.swayAmplitude??15,A=n.swayFrequency??2;e.swayPhase+=A*.03*s;let g=e.swayPhase,y=(g-g*g*g*.166667)*w*.01*s;c+=y;let d=n.windVariation,x=n.wind+d*(Math.random()-.5);c+=x*s;let D=n.airResistance??.03,R=1-u*u*.5,H=R<0?-R:R,Y=n.drag+H*D,L=p>0?Math.sqrt(p):0,G=Math.max(.9,1-Y*L*.01)*n.friction*n.decay;if(c*=G,l*=G,e.x+=c*s,e.y+=l*s,e.vx=c,e.vy=l,n.tumble&&(e.angularVelocity=(e.angularVelocity+c*.001*s)*.98,e.rotation+=(e.rotationSpeed+e.angularVelocity)*s),e.tiltSpeed=(e.tiltSpeed+(Math.random()-.5)*.002*s)*.995,e.tilt=(e.tilt+e.tiltSpeed*s)%E.TWO_PI,n.wobble){let P=e.wobblePhase+n.wobbleSpeed*.1*s;e.wobblePhase=P;let B=1-P*P*.5,N=P-P*P*P*.166667;e.scaleX=.3+.7*(B<0?-B:B),e.scaleY=.3+.7*(N<0?-N:N)}if(e.shimmerPhase+=.1*s,n.floor!==null&&n.bounce>0&&a){let P=n.floor??a,B=e.size*.5;e.y+B>=P&&(e.y=P-B,e.vy=-e.vy*n.bounce,e.vx*=.85,e.rotationSpeed+=(Math.random()-.5)*.1)}e.life-=t;let et=1-e.life/e.maxLife;if(r){let P=et,B=P*P*(3-2*P);e.opacity=e.originalOpacity*(1-B*.9)}i&&(e.size=e.originalSize*(1-et*.5)),(e.life<=0||e.opacity<X.MIN_OPACITY||e.size<X.MIN_SIZE)&&(e.active=!1)}function pt(e,t,n){if(!t.active)return;let{x:r,y:i,size:o,rotation:a,color:s,shape:c,opacity:l,tilt:u,aspectRatio:p,scaleX:f,scaleY:h,shimmerPhase:F}=t;if(l<.02)return;let w=n?.trailConfig,A=n?.glowConfig;(w?.enabled??V.enabled)&&t.trail.length>0&&Wt(e,t,w??V),e.save();let g=A?.enabled??Re.enabled;g&&(e.shadowBlur=A?.blur??Re.blur,e.shadowColor=A?.color??K(s)),e.translate(r,i),e.rotate(a+u),t.depth>0&&e.scale(f,h);let d=1+(F-Math.floor(F))*.3-.15,x=.7+.3*(f*h<0?-(f*h):f*h),D=l*s.a*x*(g?A?.intensity??1:1);if(D<.02){e.restore();return}e.globalAlpha=D>1?1:D;let R=s.r*d,H=s.g*d,Y=s.b*d;if(e.fillStyle=`rgb(${R>255?255:R},${H>255?255:H},${Y>255?255:Y})`,t.image&&t.image.isEmoji)Jt(e,t.image.src,o*(t.image.scale??1));else if(t.imageElement)Kt(e,t.imageElement,o*(t.image?.scale??1));else if(c==="custom"&&n?.customDraw){let L={ctx:e,particle:t,progress:1-t.life/t.maxLife,elapsed:n.elapsed??0};n.customDraw(L)}else{let L=p??1;switch(c){case"square":case"rectangle":let re=o*(c==="rectangle"?Math.max(1.5,L*1.5):Math.sqrt(L)),G=o/(c==="rectangle"?Math.max(1.5,L):Math.sqrt(L));e.fillRect(-re*.5,-G*.5,re,G);break;case"circle":e.beginPath(),e.arc(0,0,o*.5,0,E.TWO_PI),e.fill();break;case"triangle":qt(e,o);break;case"star":Gt(e,o);break;case"line":Vt(e,o);break;case"heart":$t(e,o);break;case"diamond":jt(e,o);break;case"hexagon":Yt(e,o);break;case"spiral":Xt(e,o,s);break;case"ribbon":Zt(e,o);break;default:e.fillRect(-o*.5,-o*.5,o,o)}}e.restore()}function Wt(e,t,n){let r=n.fade??V.fade,i=n.width??V.width;e.save(),e.lineCap="round",e.lineJoin="round";for(let o=0;o<t.trail.length-1;o++){let a=t.trail[o],s=t.trail[o+1],c=a.opacity*Math.pow(r,o),l=a.size*i*Math.pow(r,o);c>.01&&l>.1&&(e.beginPath(),e.strokeStyle=K({...t.color,a:c}),e.lineWidth=l,e.moveTo(a.x,a.y),e.lineTo(s.x,s.y),e.stroke())}e.restore()}function qt(e,t){let n=t/2;e.beginPath(),e.moveTo(0,-n),e.lineTo(n,n),e.lineTo(-n,n),e.closePath(),e.fill()}function Gt(e,t){let n=t/2,r=n*ot,i=Math.PI/Fe;e.beginPath();for(let o=0;o<Fe*2;o++){let a=o%2===0?n:r,s=o*i-E.HALF_PI,c=Math.cos(s)*a,l=Math.sin(s)*a;o===0?e.moveTo(c,l):e.lineTo(c,l)}e.closePath(),e.fill()}function Vt(e,t){let n=t*2,r=t/4;e.fillRect(-n/2,-r/2,n,r)}function $t(e,t){let n=t/30;e.save(),e.scale(n,n),e.beginPath(),e.moveTo(0,-8),e.bezierCurveTo(-10,-18,-25,-8,-15,5),e.lineTo(0,18),e.lineTo(15,5),e.bezierCurveTo(25,-8,10,-18,0,-8),e.closePath(),e.fill(),e.restore()}function jt(e,t){let n=t/2;e.beginPath(),e.moveTo(0,-n),e.lineTo(n*.6,0),e.lineTo(0,n),e.lineTo(-n*.6,0),e.closePath(),e.fill()}function Yt(e,t){let n=t/2;e.beginPath();for(let r=0;r<6;r++){let i=Math.PI/3*r-Math.PI/6,o=Math.cos(i)*n,a=Math.sin(i)*n;r===0?e.moveTo(o,a):e.lineTo(o,a)}e.closePath(),e.fill()}function Xt(e,t,n){e.strokeStyle=K(n),e.lineWidth=t/8,e.lineCap="round",e.beginPath();for(let r=0;r<22;r++){let i=.35*r,o=(.2+1.5*i)*(t/20),a=o*Math.cos(i),s=o*Math.sin(i);r===0?e.moveTo(a,s):e.lineTo(a,s)}e.stroke()}function Zt(e,t){let n=t,r=t/3,i=t/4;e.beginPath(),e.moveTo(-n/2,0),e.quadraticCurveTo(-n/4,-i,0,0),e.quadraticCurveTo(n/4,i,n/2,0),e.lineTo(n/2,r),e.quadraticCurveTo(n/4,r+i,0,r),e.quadraticCurveTo(-n/4,r-i,-n/2,r),e.closePath(),e.fill()}function Jt(e,t,n){e.font=`${n}px serif`,e.textAlign="center",e.textBaseline="middle",e.fillText(t,0,0)}function Kt(e,t,n){let r=n/2;e.drawImage(t,-r,-r,n,n)}function ht(e){return e.filter(t=>t.active).length}var b=null,U=null,ee=0,ue=null,mt=[],Qt=500;function gt(e){mt.length<Qt&&(e.active=!1,e.trail.length=0,mt.push(e))}var Ae=360,en=new Float32Array(Ae),tn=new Float32Array(Ae);for(let e=0;e<Ae;e++){let t=e*Math.PI/180;en[e]=Math.sin(t),tn[e]=Math.cos(t)}function nn(e,t){if(!$())throw new Error("ConfettiEngine requires a browser environment");let n={...Ee,...t},r=n.pixelRatio??ut(X.MAX_DPR);if(!b){if(b=document.createElement("canvas"),b.style.cssText=`
1
+ "use strict";var Se=Object.defineProperty;var Wt=Object.getOwnPropertyDescriptor;var Vt=Object.getOwnPropertyNames;var Yt=Object.prototype.hasOwnProperty;var Gt=(e,t)=>{for(var n in t)Se(e,n,{get:t[n],enumerable:!0})},qt=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Vt(t))!Yt.call(e,i)&&i!==n&&Se(e,i,{get:()=>t[i],enumerable:!(r=Wt(t,i))||r.enumerable});return e};var $t=e=>qt(Se({},"__esModule",{value:!0}),e);var Dn={};Gt(Dn,{COLOR_PALETTES:()=>ot,Confetti:()=>Ne,ConfettiBurst:()=>Rt,ConfettiButton:()=>Le,ConfettiCannon:()=>Ot,ConfettiEngine:()=>ce,ConfettiOnMount:()=>St,ConfettiTrigger:()=>Be,DEFAULT_ACCESSIBILITY:()=>st,DEFAULT_CANVAS:()=>ae,DEFAULT_COLORS:()=>$,DEFAULT_CONFIG:()=>L,DEFAULT_CONTINUOUS:()=>he,DEFAULT_DIRECTION:()=>re,DEFAULT_FIREWORK:()=>ge,DEFAULT_GLOW:()=>oe,DEFAULT_PARTICLE:()=>ie,DEFAULT_PHYSICS:()=>ne,DEFAULT_TRAIL:()=>k,DIRECTION_ANGLES:()=>j,EASING_FUNCTIONS:()=>ut,EMOJI_SETS:()=>G,PRESETS:()=>Re,clamp:()=>T,confetti:()=>O,createConfettiExplosion:()=>ue,default:()=>O,degToRad:()=>E,fireFromElement:()=>Pe,forceCleanup:()=>Tt,getActiveAnimationCount:()=>It,getDirectionAngle:()=>le,getElementCenter:()=>pt,getMaxPoolSize:()=>Pt,getPreset:()=>En,getPresetNames:()=>An,isBrowser:()=>Y,lerp:()=>Ce,mergeConfig:()=>ye,parseColor:()=>Z,presetToCanvasOptions:()=>Rn,radToDeg:()=>be,randomFromArray:()=>X,randomInRange:()=>b,randomInt:()=>ft,rgbaToString:()=>K,setMaxPoolSize:()=>wt,shapeFromImage:()=>zt,shapeFromPath:()=>Ht,shapeFromText:()=>at,shapesFromEmoji:()=>Ut,useConfetti:()=>B,useConfettiCenter:()=>At,useConfettiOnCondition:()=>xt,useConfettiSequence:()=>Et,useConfettiTrigger:()=>Ft});module.exports=$t(Dn);var $=["#FF6B6B","#4ECDC4","#FFE66D","#95E1D3","#F38181","#AA96DA","#FCBAD3","#A8D8EA","#FF9A8B","#88D8B0"],ne={gravity:1,drag:.035,friction:.99,rotationSpeed:1,wind:0,windVariation:.02,tumble:!0,decay:.99,bounce:0,floor:null,wobble:!0,wobbleSpeed:1.5,flutter:!0,flutterSpeed:2.5,flutterIntensity:.4,airResistance:.03,swayAmplitude:15,swayFrequency:2},re={direction:"up",spread:55,velocity:[25,50],velocityDecay:.92},ie={colors:$,shapes:["square","rectangle","circle"],size:[6,14],opacity:[.85,1],lifespan:4e3,fadeOut:!0,scaleDown:!1,spin:!0,spinSpeed:[-15,15],tilt:[-30,30],depth3D:.6,aspectRatio:[.5,1.5],shimmer:!0},k={enabled:!1,length:10,fade:.5,width:.5},oe={enabled:!1,blur:10,color:null,intensity:.5},he={recycle:!1,numberOfPieces:200,spawnRate:50,run:!0,tweenDuration:5e3},ge={secondaryExplosions:!0,burstCount:80,burstDelay:500,spread:360,launchHeight:.6,rocketColors:["#ffd700","#ff6b35","#ff0000"],burstColors:["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff"],trailLength:10,riseDuration:1e3,showRocket:!0},ae={width:null,height:null,autoResize:!0,resizeDebounce:100,frameRate:null,pixelRatio:null,useWorker:!1,useOffscreen:!1},st={disableForReducedMotion:!1,ariaLabel:"Confetti animation",ariaHidden:!0},L={particleCount:50,particle:ie,physics:ne,direction:re,mode:"burst",easing:"easeOut",zIndex:9999,autoCleanup:!0,scalar:1,drift:0,flat:!1},j={up:90,down:270,left:180,right:0},P={DEG_TO_RAD:Math.PI/180,RAD_TO_DEG:180/Math.PI,TWO_PI:Math.PI*2,HALF_PI:Math.PI/2},R={SIN_TAYLOR_COEFF:.166667,COS_TAYLOR_COEFF:.5,FLUTTER_PHASE_SCALE:.05,SWAY_PHASE_SCALE:.03,SWAY_FORCE_SCALE:.01,GRAVITY_TILT_MODIFIER:.15,FLUTTER_AIR_CATCH_THRESHOLD:.7,FLUTTER_AIR_CATCH_MULTIPLIER:.3,ORIENTATION_OPACITY_BASE:.7,ORIENTATION_OPACITY_SCALE:.3,SHIMMER_RANGE:.3,SHIMMER_OFFSET:.15,MIN_OPACITY_THRESHOLD:.02,MIN_SIZE_THRESHOLD:.1,VELOCITY_VARIATION_RANGE:.3,ANGULAR_DAMPING:.98,TILT_DAMPING:.995};var se={r:0,g:0,b:0,a:0},Oe={MAX_PARTICLES:500,FRAME_BUDGET:16.67,MIN_OPACITY:.01,MIN_SIZE:.5,MAX_DPR:2},lt=100,De=5,ct=.5;var ut={linear:e=>e,easeIn:e=>e*e*e,easeOut:e=>1-Math.pow(1-e,3),easeInOut:e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2,bounce:e=>e<.36363636363636365?7.5625*e*e:e<.7272727272727273?7.5625*(e-=.5454545454545454)*e+.75:e<.9090909090909091?7.5625*(e-=.8181818181818182)*e+.9375:7.5625*(e-=.9545454545454546)*e+.984375,elastic:e=>{let t=2*Math.PI/3;return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e*10-.75)*t)+1},back:e=>1+2.70158*Math.pow(e-1,3)+1.70158*Math.pow(e-1,2),circ:e=>Math.sqrt(1-Math.pow(e-1,2)),expo:e=>e===1?1:1-Math.pow(2,-10*e)};function C(){if(typeof crypto<"u"&&crypto.getRandomValues){let e=new Uint32Array(1);return crypto.getRandomValues(e),e[0]/4294967296}return Math.random()}function b(e,t){return e+C()*(t-e)}function ft(e,t){return Math.floor(b(e,t+1))}function X(e){if(e.length===0)throw new Error("Cannot pick from empty array");return e[Math.floor(C()*e.length)]}function T(e,t,n){return Math.min(Math.max(e,t),n)}function Ce(e,t,n){return e+(t-e)*T(n,0,1)}function E(e){return e*P.DEG_TO_RAD}function be(e){return e*P.RAD_TO_DEG}function Z(e){if(typeof e=="object"&&"r"in e)return{r:T(Math.round(e.r),0,255),g:T(Math.round(e.g),0,255),b:T(Math.round(e.b),0,255),a:T(e.a,0,1)};if(typeof e=="object"&&"type"in e)return Z(e.colors[0]);let t=e.trim().toLowerCase();return t.startsWith("#")?jt(t):t.startsWith("rgb")?Xt(t):Zt(t)}function jt(e){let t=e.slice(1),n,r,i,o=1;switch(t.length){case 3:n=parseInt(t[0]+t[0],16),r=parseInt(t[1]+t[1],16),i=parseInt(t[2]+t[2],16);break;case 4:n=parseInt(t[0]+t[0],16),r=parseInt(t[1]+t[1],16),i=parseInt(t[2]+t[2],16),o=parseInt(t[3]+t[3],16)/255;break;case 6:n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16);break;case 8:n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16),o=parseInt(t.slice(6,8),16)/255;break;default:return se}return isNaN(n)||isNaN(r)||isNaN(i)||isNaN(o)?se:{r:n,g:r,b:i,a:o}}function Xt(e){let t=e.match(/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/);return t?{r:T(parseInt(t[1],10),0,255),g:T(parseInt(t[2],10),0,255),b:T(parseInt(t[3],10),0,255),a:t[4]!==void 0?T(parseFloat(t[4]),0,1):1}:se}var dt=new Map;function Zt(e){let t={red:{r:255,g:0,b:0,a:1},green:{r:0,g:128,b:0,a:1},blue:{r:0,g:0,b:255,a:1},white:{r:255,g:255,b:255,a:1},black:{r:0,g:0,b:0,a:1},yellow:{r:255,g:255,b:0,a:1},cyan:{r:0,g:255,b:255,a:1},magenta:{r:255,g:0,b:255,a:1},orange:{r:255,g:165,b:0,a:1},purple:{r:128,g:0,b:128,a:1},pink:{r:255,g:192,b:203,a:1}};if(t[e])return t[e];let n=dt.get(e);if(n)return n;if(typeof document<"u")try{let r=document.createElement("canvas");r.width=1,r.height=1;let i=r.getContext("2d");if(i){i.fillStyle=e,i.fillRect(0,0,1,1);let o=i.getImageData(0,0,1,1).data,a={r:o[0],g:o[1],b:o[2],a:o[3]/255};return dt.set(e,a),a}}catch{}return se}function K(e){return`rgba(${e.r}, ${e.g}, ${e.b}, ${e.a})`}function le(e,t){if(e==="custom"&&t!==void 0)return E(t);if(e==="radial")return C()*P.TWO_PI;let n=j[e];return E(n??90)}function pt(e){let t=e.getBoundingClientRect();return{x:t.left+t.width/2,y:t.top+t.height/2}}function ye(e){if(!e)return L;let t={...ie,...e.particle},n={...ne,...e.physics},r={...re,...e.direction};return{particleCount:e.particleCount??L.particleCount,particle:t,physics:n,direction:r,mode:e.mode??L.mode,spawnArea:e.spawnArea?{type:"rect",x:0,y:0,...e.spawnArea}:void 0,continuous:e.continuous,firework:e.firework,canvas:e.canvas,easing:e.easing??L.easing,zIndex:e.zIndex??L.zIndex,autoCleanup:e.autoCleanup??L.autoCleanup,scalar:e.scalar??L.scalar,drift:e.drift??L.drift,flat:e.flat??L.flat,onStart:e.onStart,onComplete:e.onComplete,onFrame:e.onFrame,onParticleCreate:e.onParticleCreate,onParticleDeath:e.onParticleDeath}}function Y(){return typeof window<"u"&&typeof document<"u"}function mt(e=2){return Y()?Math.min(window.devicePixelRatio||1,e):1}function ht(){let e,t;return{promise:new Promise((r,i)=>{e=r,t=i}),resolve:e,reject:t}}var Kt=0,gt=!1;function J(e,t,n,r,i,o,a,s,l,c,u){if(i.length===0)throw new Error("Colors array cannot be empty");if(o.length===0)throw new Error("Shapes array cannot be empty");if(a[0]>a[1])throw new Error("Invalid size range");if(s[0]>s[1])throw new Error("Invalid opacity range");let m=b(a[0],a[1]),p=b(s[0],s[1]),h=X(i),I=typeof h=="string"?Z(h):"type"in h?Z(h.colors[0]):h,A=1+(C()-.5)*R.VELOCITY_VARIATION_RANGE,S=Math.cos(n)*r*A,F=-Math.sin(n)*r*A,x;u?.images&&u.images.length>0&&(x=X(u.images));let f=u?.tiltRange??[-30,30],D=u?.spinSpeedRange??[-15,15],d=u?.aspectRatioRange??[.5,1.5],M=b(d[0],d[1]);return{id:Kt++,x:e,y:t,vx:S,vy:F,size:m,originalSize:m,rotation:C()*P.TWO_PI,rotationSpeed:(C()-.5)*.3*c,color:I,shape:x?"custom":X(o),opacity:p,originalOpacity:p,life:l,maxLife:l,active:!0,image:x,imageElement:null,trail:[],wobblePhase:C()*P.TWO_PI,wobbleSpeed:b(.8,2.5),tilt:E(b(f[0],f[1])),tiltSpeed:b(D[0],D[1])*.015,depth:u?.depth3D??.6,hasExploded:!1,data:{},flutterPhase:C()*P.TWO_PI,flutterSpeed:b(1.5,3.5),swayPhase:C()*P.TWO_PI,aspectRatio:M,angularVelocity:(C()-.5)*.4,scaleX:1,scaleY:1,shimmerPhase:C()*P.TWO_PI,currentDrag:b(.02,.05)}}function Ct(e,t,n,r,i,o,a){if(!e.active)return;let s=t*.059988;(o?.enabled??k.enabled)&&Jt(e,o??k),Qt(e,s,n),an(e,s,n),sn(e,t,n,r,i),n.floor!==null&&n.bounce>0&&a&&ln(e,n,a),(e.life<=0||e.opacity<R.MIN_OPACITY_THRESHOLD||e.size<R.MIN_SIZE_THRESHOLD)&&(e.active=!1)}function Jt(e,t){let n=e.trail;n.unshift({x:e.x,y:e.y,opacity:e.opacity,size:e.size});let r=t.length??k.length;n.length>r&&n.pop()}function Qt(e,t,n){let r=e.vx,i=e.vy,o=e.tilt,a=r*r+i*i;en(e,i,o,n,t),i=e.vy,tn(e,r,i,o,a,n,t),r=e.vx,i=e.vy,nn(e,r,n,t),r=e.vx,rn(e,n,t),r=e.vx,on(e,r,i,o,a,n),r=e.vx,i=e.vy,e.x+=r*t,e.y+=i*t}function en(e,t,n,r,i){let a=1+Math.sin(n)*R.GRAVITY_TILT_MODIFIER;e.vy=t+r.gravity*a*i}function tn(e,t,n,r,i,o,a){if(!(o.flutter??!0)||i<=1)return;let l=o.flutterSpeed??2.5,c=o.flutterIntensity??.4;e.flutterPhase=(e.flutterPhase+l*R.FLUTTER_PHASE_SCALE*a)%P.TWO_PI;let u=e.flutterPhase,p=Math.sin(u)*c*a,h=Math.cos(r);e.vx=t+p*h;let I=Math.sin(r);if((I<0?-I:I)>R.FLUTTER_AIR_CATCH_THRESHOLD){let S=p<0?-p:p;e.vy=n-S*R.FLUTTER_AIR_CATCH_MULTIPLIER}}function nn(e,t,n,r){let i=n.swayAmplitude??15,o=n.swayFrequency??2;e.swayPhase=(e.swayPhase+o*R.SWAY_PHASE_SCALE*r)%P.TWO_PI;let a=e.swayPhase,s=Math.sin(a)*i*R.SWAY_FORCE_SCALE*r;e.vx=t+s}function rn(e,t,n){let r=t.windVariation,i=t.wind+r*(C()-.5);e.vx+=i*n}function on(e,t,n,r,i,o){let a=o.airResistance??.03,s=Math.cos(r),l=s<0?-s:s,c=o.drag+l*a,u=i>0?Math.sqrt(i):0,p=Math.max(.9,1-c*u*.01)*o.friction*o.decay;e.vx=t*p,e.vy=n*p}function an(e,t,n){if(n.tumble&&(e.angularVelocity=(e.angularVelocity+e.vx*.001*t)*R.ANGULAR_DAMPING,e.rotation+=(e.rotationSpeed+e.angularVelocity)*t),e.tiltSpeed=(e.tiltSpeed+(C()-.5)*.002*t)*R.TILT_DAMPING,e.tilt=(e.tilt+e.tiltSpeed*t)%P.TWO_PI,n.wobble){e.wobblePhase=(e.wobblePhase+n.wobbleSpeed*.1*t)%P.TWO_PI;let r=e.wobblePhase,i=Math.cos(r),o=Math.sin(r);e.scaleX=.3+.7*(i<0?-i:i),e.scaleY=.3+.7*(o<0?-o:o)}e.shimmerPhase=(e.shimmerPhase+.1*t)%P.TWO_PI}function sn(e,t,n,r,i){t>0&&(e.life-=t);let o=1-e.life/e.maxLife;if(r){let a=o,s=a*a*(3-2*a);e.opacity=e.originalOpacity*(1-s*.9)}i&&(e.size=e.originalSize*(1-o*.5))}function ln(e,t,n){let r=t.floor??n,i=e.size*.5;e.y+i>=r&&(e.y=r-i,e.vy=-e.vy*t.bounce,e.vx*=.85,e.rotationSpeed+=(C()-.5)*.1)}function bt(e,t,n){if(!t.active)return;let{x:r,y:i,size:o,rotation:a,color:s,shape:l,opacity:c,tilt:u,aspectRatio:m,scaleX:p,scaleY:h,shimmerPhase:I}=t;if(c<R.MIN_OPACITY_THRESHOLD)return;let A=n?.trailConfig,S=n?.glowConfig;(A?.enabled??k.enabled)&&t.trail.length>0&&cn(e,t,A??k),e.save();let F=S?.enabled??oe.enabled;F&&(e.shadowBlur=S?.blur??oe.blur,e.shadowColor=S?.color??K(s)),e.translate(r,i),e.rotate(a+u),t.depth>0&&e.scale(p,h);let f=1+(I-Math.floor(I))*R.SHIMMER_RANGE-R.SHIMMER_OFFSET,D=R.ORIENTATION_OPACITY_BASE+R.ORIENTATION_OPACITY_SCALE*(p*h<0?-(p*h):p*h),d=c*s.a*D*(F?S?.intensity??1:1);if(d<R.MIN_OPACITY_THRESHOLD){e.restore();return}e.globalAlpha=d>1?1:d;let M=s.r*f,W=s.g*f,q=s.b*f;if(e.fillStyle=`rgb(${M>255?255:M},${W>255?255:W},${q>255?255:q})`,t.image&&t.image.isEmoji)bn(e,t.image.src,o*(t.image.scale??1));else if(t.imageElement)yn(e,t.imageElement,o*(t.image?.scale??1));else if(l==="custom"&&n?.customDraw){let N={ctx:e,particle:t,progress:1-t.life/t.maxLife,elapsed:n.elapsed??0};try{n.customDraw(N)}catch{gt||(gt=!0)}}else{let N=m??1;switch(l){case"square":case"rectangle":let V=o*(l==="rectangle"?Math.max(1.5,N*1.5):Math.sqrt(N)),me=o/(l==="rectangle"?Math.max(1.5,N):Math.sqrt(N));e.fillRect(-V*.5,-me*.5,V,me);break;case"circle":e.beginPath(),e.arc(0,0,o*.5,0,P.TWO_PI),e.fill();break;case"triangle":un(e,o);break;case"star":dn(e,o);break;case"line":fn(e,o);break;case"heart":pn(e,o);break;case"diamond":mn(e,o);break;case"hexagon":hn(e,o);break;case"spiral":gn(e,o,s);break;case"ribbon":Cn(e,o);break;default:e.fillRect(-o*.5,-o*.5,o,o)}}e.restore()}function cn(e,t,n){let r=n.fade??k.fade,i=n.width??k.width;e.save(),e.lineCap="round",e.lineJoin="round";for(let o=0;o<t.trail.length-1;o++){let a=t.trail[o],s=t.trail[o+1],l=a.opacity*Math.pow(r,o),c=a.size*i*Math.pow(r,o);l>.01&&c>.1&&(e.beginPath(),e.strokeStyle=K({r:t.color.r,g:t.color.g,b:t.color.b,a:l}),e.lineWidth=c,e.moveTo(a.x,a.y),e.lineTo(s.x,s.y),e.stroke())}e.restore()}function un(e,t){let n=t/2;e.beginPath(),e.moveTo(0,-n),e.lineTo(n,n),e.lineTo(-n,n),e.closePath(),e.fill()}function dn(e,t){let n=t/2,r=n*ct,i=Math.PI/De;e.beginPath();for(let o=0;o<De*2;o++){let a=o%2===0?n:r,s=o*i-P.HALF_PI,l=Math.cos(s)*a,c=Math.sin(s)*a;o===0?e.moveTo(l,c):e.lineTo(l,c)}e.closePath(),e.fill()}function fn(e,t){let n=t*2,r=t/4;e.fillRect(-n/2,-r/2,n,r)}function pn(e,t){let n=t/30;e.save(),e.scale(n,n),e.beginPath(),e.moveTo(0,-8),e.bezierCurveTo(-10,-18,-25,-8,-15,5),e.lineTo(0,18),e.lineTo(15,5),e.bezierCurveTo(25,-8,10,-18,0,-8),e.closePath(),e.fill(),e.restore()}function mn(e,t){let n=t/2;e.beginPath(),e.moveTo(0,-n),e.lineTo(n*.6,0),e.lineTo(0,n),e.lineTo(-n*.6,0),e.closePath(),e.fill()}function hn(e,t){let n=t/2;e.beginPath();for(let r=0;r<6;r++){let i=Math.PI/3*r-Math.PI/6,o=Math.cos(i)*n,a=Math.sin(i)*n;r===0?e.moveTo(o,a):e.lineTo(o,a)}e.closePath(),e.fill()}function gn(e,t,n){e.strokeStyle=K(n),e.lineWidth=t/8,e.lineCap="round",e.beginPath();for(let r=0;r<22;r++){let i=.35*r,o=(.2+1.5*i)*(t/20),a=o*Math.cos(i),s=o*Math.sin(i);r===0?e.moveTo(a,s):e.lineTo(a,s)}e.stroke()}function Cn(e,t){let n=t,r=t/3,i=t/4;e.beginPath(),e.moveTo(-n/2,0),e.quadraticCurveTo(-n/4,-i,0,0),e.quadraticCurveTo(n/4,i,n/2,0),e.lineTo(n/2,r),e.quadraticCurveTo(n/4,r+i,0,r),e.quadraticCurveTo(-n/4,r-i,-n/2,r),e.closePath(),e.fill()}function bn(e,t,n){e.font=`${n}px serif`,e.textAlign="center",e.textBaseline="middle",e.fillText(t,0,0)}function yn(e,t,n){let r=n/2;e.drawImage(t,-r,-r,n,n)}function yt(e){let t=0;for(let n=0;n<e.length;n++)e[n].active&&t++;return t}var y=null,H=null,Q=0;var z=null,ve=[],we=500;function wt(e){for(we=Math.max(1,Math.floor(e));ve.length>we;)ve.pop()}function Pt(){return we}function Me(e){ve.length<we&&(e.active=!1,e.trail.length=0,ve.push(e))}var _e=360,vn=new Float32Array(_e),wn=new Float32Array(_e);for(let e=0;e<_e;e++){let t=e*Math.PI/180;vn[e]=Math.sin(t),wn[e]=Math.cos(t)}function Pn(e,t){if(!Y())throw new Error("ConfettiEngine requires a browser environment");let n={...ae,...t},r=n.pixelRatio??mt(Oe.MAX_DPR);if(!y){if(y=document.createElement("canvas"),y.style.cssText=`
2
2
  position: fixed;
3
3
  top: 0;
4
4
  left: 0;
@@ -6,7 +6,7 @@
6
6
  height: 100%;
7
7
  pointer-events: none;
8
8
  z-index: ${e};
9
- `,U=b.getContext("2d",{alpha:!0,desynchronized:!0}),!U)throw new Error("Failed to get canvas 2D context");document.body.appendChild(b),n.autoResize&&(ue=()=>{if(b&&U){let a=n.width??window.innerWidth,s=n.height??window.innerHeight;b.width=a*r,b.height=s*r,b.style.width=`${a}px`,b.style.height=`${s}px`,U.scale(r,r)}},window.addEventListener("resize",ue))}b.style.zIndex=String(e);let i=n.width??window.innerWidth,o=n.height??window.innerHeight;return(b.width!==i*r||b.height!==o*r)&&(b.width=i*r,b.height=o*r,b.style.width=`${i}px`,b.style.height=`${o}px`,U.scale(r,r)),{canvas:b,ctx:U,width:i,height:o,dpr:r}}function rn(){b&&ee===0&&setTimeout(()=>{ee===0&&b&&(ue&&(window.removeEventListener("resize",ue),ue=null),b.remove(),b=null,U=null)},it)}function bt(e,t,n){let{type:r,x:i,y:o,w:a,h:s}=e;switch(r){case"point":return{x:i,y:o};case"rect":return{x:m(i,i+(a??0)),y:m(o,o+(s??0))};case"line":let c=C();return{x:i+c*(a??0),y:o+c*(s??0)};case"circle":let l=C()*E.TWO_PI,u=Math.sqrt(C())*(a??50);return{x:i+Math.cos(l)*u,y:o+Math.sin(l)*u};default:return{x:i,y:o}}}var de=class{constructor(t,n){this.particles=[];this.canvasContext=null;this.animationFrameId=null;this.lastFrameTime=0;this.lastSpawnTime=0;this.isRunning=!1;this.isPaused=!1;this.deferred=dt();this.frameInterval=0;this.lastRenderTime=0;this.animate=()=>{if(!this.isRunning||!this.canvasContext)return;if((this.mode==="continuous"||this.mode==="snow"||this.mode==="rain")&&!this.continuousConfig.run){this.animationFrameId=requestAnimationFrame(this.animate),this.lastFrameTime=performance.now();return}if(this.isPaused){this.animationFrameId=requestAnimationFrame(this.animate),this.lastFrameTime=performance.now();return}let t=performance.now(),n=t-this.lastFrameTime;if(this.lastFrameTime=t,this.frameInterval>0){if(t-this.lastRenderTime<this.frameInterval){this.animationFrameId=requestAnimationFrame(this.animate);return}this.lastRenderTime=t}let{ctx:r,width:i,height:o,dpr:a}=this.canvasContext,{physics:s,particle:c}=this.config;r.setTransform(1,0,0,1,0,0),r.clearRect(0,0,i*a,o*a),r.scale(a,a);let l=this.particles,u=l.length,p=0,f=!0,h=100,F=-h,w=i+h,A=-h,g=o+h;for(let y=0;y<u;y++){let d=l[y];if(d.active){if(ft(d,n,s,c.fadeOut,c.scaleDown),d.data?.isRocket&&d.y<=d.data.targetY){d.active=!1,this.explodeFirework(d.x,d.y,d.data);continue}if(d.data?.willExplode&&!d.data.hasExploded&&d.vx*d.vx+d.vy*d.vy<1&&(d.data.hasExploded=!0,this.explodeFirework(d.x,d.y,{burstCount:15,spread:360,burstColors:d.data.burstColors})),d.x<F||d.x>w||d.y<A||d.y>g){(d.y>g||d.x<F-200||d.x>w+200)&&(d.active=!1);continue}pt(r,d,{customDraw:this.drawShape}),p++,f=!1}}if(this.mode==="continuous"||this.mode==="snow"||this.mode==="rain"){let y=t-this.lastSpawnTime,d=1e3/(this.continuousConfig.spawnRate??10);if(y>=d){if(this.continuousConfig.recycle){let D=this.continuousConfig.numberOfPieces-p;if(D>0){for(let R=u-1;R>=0&&D>0;R--)l[R].active||(gt(l[R]),l.splice(R,1));this.spawnParticles(Math.min(D,5))}}else p<this.continuousConfig.numberOfPieces&&this.spawnParticles(Math.min(3,this.continuousConfig.numberOfPieces-p));this.lastSpawnTime=t}}if(this.mode==="firework"){let y=0;for(let x=0;x<u;x++)l[x].active&&l[x].data?.isRocket&&y++;let d=t-this.lastSpawnTime;y===0&&d>=(this.fireworkConfig.burstDelay??500)&&(this.launchFirework(),this.lastSpawnTime=t)}if((this.mode==="burst"||this.mode==="cannon"||this.mode==="explosion")&&f){this.complete();return}this.animationFrameId=requestAnimationFrame(this.animate)};this.origin=t,this.config=be(n),this.mode=n?.mode??"burst",this.spawnArea=n?.spawnArea,this.continuousConfig={...tt,...n?.continuous},this.fireworkConfig={...nt,...n?.firework},this.canvasConfig={...Ee,...n?.canvas},this.drawShape=n?.particle?.drawShape,this.canvasConfig.frameRate&&(this.frameInterval=1e3/this.canvasConfig.frameRate)}start(){if(this.isRunning)return this.createHandle();if(!$())return this.deferred.resolve(),this.createHandle();if(this.isRunning=!0,ee++,this.canvasContext=nn(this.config.zIndex,this.canvasConfig),this.mode==="continuous"||this.mode==="snow"||this.mode==="rain"){let t=Math.min(this.continuousConfig.numberOfPieces,Math.floor(this.continuousConfig.numberOfPieces*.5));this.spawnParticles(t)}else this.mode==="firework"?this.launchFirework():this.createParticles();return this.config.onStart?.(),this.lastFrameTime=performance.now(),this.lastSpawnTime=performance.now(),this.lastRenderTime=performance.now(),this.animate(),this.createHandle()}createParticles(){let{particleCount:t,particle:n,direction:r,physics:i}=this.config,{x:o,y:a}=this.origin,s=Math.min(t,X.MAX_PARTICLES);for(let c=0;c<s;c++){let l;if(r.direction==="radial")l=C()*E.TWO_PI;else{let f=ce(r.direction,r.angle),h=S(r.spread);l=f+(C()-.5)*h}let u=m(r.velocity[0],r.velocity[1]),p=Q(o,a,l,u,n.colors,n.shapes,n.size,n.opacity,n.lifespan,i.rotationSpeed,{images:n.images,tiltRange:n.tilt,spinSpeedRange:n.spinSpeed,depth3D:n.depth3D});this.particles.push(p)}}spawnParticles(t){if(!this.canvasContext)return;let{particle:n,physics:r}=this.config,{width:i,height:o}=this.canvasContext;for(let a=0;a<t;a++){let s;this.spawnArea?s=bt(this.spawnArea,i,o):this.mode==="snow"||this.mode==="rain"?s={x:m(0,i),y:-20}:s={x:m(0,i),y:m(-20,0)};let c,l;this.mode==="snow"?(c=S(m(-20,20)-90),l=m(.5,2)):this.mode==="rain"?(c=S(-90),l=m(8,15)):(c=C()*E.TWO_PI,l=m(2,6));let u=Q(s.x,s.y,c,l,n.colors,n.shapes,n.size,n.opacity,n.lifespan,r.rotationSpeed,{images:n.images,tiltRange:n.tilt,spinSpeedRange:n.spinSpeed,depth3D:n.depth3D});this.particles.push(u)}}launchFirework(){if(!this.canvasContext)return;let{width:t,height:n}=this.canvasContext,{launchHeight:r,burstCount:i,spread:o,secondaryExplosions:a,rocketColors:s,burstColors:c,trailLength:l}=this.fireworkConfig,u=this.spawnArea?bt(this.spawnArea,t,n).x:m(t*.2,t*.8),p=n*(1-r),f=u+m(-50,50),h=Q(u,n,S(-90+m(-10,10)),m(15,25),s,["circle"],[3,5],[1,1],2e3,0);h.data={isRocket:!0,targetY:p,targetX:f,burstCount:i,spread:o,burstColors:c,secondaryExplosions:a,trailLength:l},this.particles.push(h)}explodeFirework(t,n,r){let{burstCount:i=80,spread:o=360,burstColors:a,secondaryExplosions:s}=r,c=a??this.config.particle.colors,l=S(o);for(let u=0;u<i;u++){let p=u/i*l-l/2+S(-90),f=m(4,12),h=Q(t,n,p,f,c,this.config.particle.shapes,[2,6],[.8,1],1500,this.config.physics.rotationSpeed);s&&C()<.1&&(h.data={willExplode:!0,burstColors:c}),this.particles.push(h)}}stop(){this.isRunning&&(this.animationFrameId!==null&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null),this.cleanup(),this.deferred.resolve())}pause(){this.isPaused=!0}resume(){this.isPaused=!1}complete(){this.config.onComplete?.(),this.cleanup(),this.deferred.resolve()}cleanup(){this.isRunning=!1,this.isPaused=!1;let t=this.particles;for(let n=t.length-1;n>=0;n--)gt(t[n]);this.particles=[],this.canvasContext=null,ee--,this.config.autoCleanup&&rn()}addParticles(t){if(!(!this.isRunning||!this.canvasContext))if(this.mode==="continuous"||this.mode==="snow"||this.mode==="rain")this.spawnParticles(t);else{let{particle:n,direction:r,physics:i}=this.config,{x:o,y:a}=this.origin;for(let s=0;s<t;s++){let c;if(r.direction==="radial")c=C()*E.TWO_PI;else{let p=ce(r.direction,r.angle),f=S(r.spread);c=p+(C()-.5)*f}let l=m(r.velocity[0],r.velocity[1]),u=Q(o,a,c,l,n.colors,n.shapes,n.size,n.opacity,n.lifespan,i.rotationSpeed);this.particles.push(u)}}}clear(){this.particles=[]}getParticleCount(){return ht(this.particles)}getState(){return this.isRunning?this.isPaused?"paused":"running":"stopped"}createHandle(){return{stop:()=>this.stop(),pause:()=>this.pause(),resume:()=>this.resume(),promise:this.deferred.promise,addParticles:t=>this.addParticles(t),clear:()=>this.clear(),getParticleCount:()=>this.getParticleCount(),getState:()=>this.getState()}}};function De(e,t){return new de(e,t).start()}function Ct(e,t){if(!e||!$())return null;let n=e.getBoundingClientRect(),r={x:n.left+n.width/2,y:n.top+n.height/2};return De(r,t)}function vt(){return ee}function wt(){b&&(b.remove(),b=null,U=null),ee=0}var O=require("react");var xn=Math.PI*2,on=Math.PI/180,yt=1e3/60;function I(){if(typeof crypto<"u"&&crypto.getRandomValues){let e=new Uint32Array(1);return crypto.getRandomValues(e),e[0]/4294967296}return Math.random()}function Ce(e){return e*on}function W(e,t,n){return Math.min(Math.max(e,t),n)}function Se(e,t){let n=Math.max(0,e-t),r=n/yt;return Object.freeze({value:n,factor:r})}function Pt(e){if(typeof e!="string"||e.length>50)return null;let t=e.trim().toLowerCase();if(t.startsWith("#")){let r=t.slice(1);if(!/^[0-9a-f]+$/.test(r))return null;let i,o,a,s=255;if(r.length===3)i=parseInt(r[0]+r[0],16),o=parseInt(r[1]+r[1],16),a=parseInt(r[2]+r[2],16);else if(r.length===6)i=parseInt(r.slice(0,2),16),o=parseInt(r.slice(2,4),16),a=parseInt(r.slice(4,6),16);else if(r.length===8)i=parseInt(r.slice(0,2),16),o=parseInt(r.slice(2,4),16),a=parseInt(r.slice(4,6),16),s=parseInt(r.slice(6,8),16);else return null;return{r:i,g:o,b:a,a:s/255}}let n=t.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)$/);return n?{r:W(parseInt(n[1],10),0,255),g:W(parseInt(n[2],10),0,255),b:W(parseInt(n[3],10),0,255),a:n[4]!==void 0?W(parseFloat(n[4]),0,1):1}:null}function Me(e,t){let n=Pt(e);if(!n)return e;let{r,g:i,b:o,a}=n,s=W(r+t,0,255),c=W(i+t,0,255),l=W(o+t,0,255);return a<1?`rgba(${Math.round(s)}, ${Math.round(c)}, ${Math.round(l)}, ${a})`:`rgb(${Math.round(s)}, ${Math.round(c)}, ${Math.round(l)})`}function te(){if(typeof window>"u")return!1;try{return window.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1}catch{return!1}}var an=0;function fe(){return++an}function ve(e){if(e.length===0)return;let t=Math.floor(I()*e.length);return e[t]}function we(e){return typeof requestAnimationFrame<"u"?requestAnimationFrame(e):setTimeout(e,yt)}function Oe(e){typeof cancelAnimationFrame<"u"?cancelAnimationFrame(e):clearTimeout(e)}function Be(){return typeof window>"u"?1:Math.min(window.devicePixelRatio||1,2)}var It=Object.freeze(["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"]),sn=Object.freeze(["square","circle"]),ye=Math.PI*2,Pe=class e{constructor(t,n,r,i,o,a,s,c,l,u,p,f,h,F,w,A,g){this.id=t,this.position=n,this.velocity=r,this.angle2D=i,this.gravity=o,this.drift=a,this.decay=s,this.wobble=c,this.tilt=l,this.roll=u,this.rotate=p,this.color=f,this.shape=h,this.size=F,this.scalar=w,this.flat=A,this.tick=0,this.totalTicks=g,this.destroyed=!1,this.opacity=1}static create(t,n,r={}){let{angle:i=90,spread:o=45,startVelocity:a=45,decay:s=.94,gravity:c=1,drift:l=0,flat:u=!1,ticks:p=200,origin:f={x:.5,y:.5},colors:h=It,shapes:F=sn,scalar:w=1,size:A=4}=r,g={x:f.x*t,y:f.y*n},y=Ce(i),d=Ce(o),x=-y+(.5*d-I()*d),D=a*.5+I()*a,R={angle:I()*ye,angleSpeed:I()*.1+.05,moveSpeed:-15+I()*30,distance:25+I()*15},H={value:I()*ye,sinDirection:I()>=.5?1:-1,cosDirection:I()>=.5?1:-1,speed:(I()*.4+.3)*(I()>.5?1:-1),enable:!u},Y={angle:I()*ye,speed:(15+I()*10)/60,horizontal:I()>.3,vertical:I()>.7,enable:!u},L={angle:I()*ye,speed:(I()*2-1)*.1,enable:!u},re=ve(h)??It[0],G=ve(F)??"square";return new e(fe(),g,D,x,c*3,l,s,R,H,Y,L,re,G,A,w,u,p)}get progress(){return this.tick/this.totalTicks}get computedSize(){return this.size*this.scalar}destroy(){this.destroyed=!0}clone(t){let n=Object.create(e.prototype);return Object.assign(n,this,t),n}},Ie=class{constructor(t=1e3){this.pool=[];this.maxSize=t}acquire(t,n,r){let i=this.pool.pop();return i?this.resetParticle(i,t,n,r):Pe.create(t,n,r)}release(t){this.pool.length<this.maxSize&&(t.destroyed=!0,this.pool.push(t))}clear(){this.pool.length=0}get size(){return this.pool.length}resetParticle(t,n,r,i){let o=Pe.create(n,r,i);return Object.assign(t,o,{id:t.id}),t.destroyed=!1,t}};var M=Math.PI*2,ke=class{constructor(){this.id="base"}init(t){}isEnabled(t){return!t.destroyed}update(t,n){if(t.destroyed)return;let r=Math.cos(t.angle2D)*t.velocity,i=Math.sin(t.angle2D)*t.velocity;t.position.x+=r*n.factor+t.drift*n.factor,t.position.y+=i*n.factor+t.gravity*n.factor,t.velocity*=t.decay,t.tick++;let o=t.tick/t.totalTicks;t.opacity=1-Math.pow(o,2),t.tick>=t.totalTicks&&(t.destroyed=!0)}},_e=class{constructor(){this.id="wobble"}init(t){t.wobble||(t.wobble={angle:Math.random()*M,angleSpeed:Math.random()*.1+.05,moveSpeed:-15+Math.random()*30,distance:25+Math.random()*15})}isEnabled(t){return!t.destroyed&&!t.flat&&!!t.wobble}update(t,n){if(!this.isEnabled(t))return;let r=t.wobble;r.angle+=r.angleSpeed*n.factor,r.angle>M&&(r.angle-=M);let i=Math.cos(r.angle)*r.distance*.1;t.position.x+=i*n.factor}},ze=class{constructor(){this.id="tilt"}init(t){t.tilt||(t.tilt={value:Math.random()*M,sinDirection:Math.random()>=.5?1:-1,cosDirection:Math.random()>=.5?1:-1,speed:(Math.random()*.4+.3)*(Math.random()>.5?1:-1),enable:!t.flat})}isEnabled(t){return!t.destroyed&&t.tilt?.enable===!0}update(t,n){if(!this.isEnabled(t))return;let r=t.tilt;r.value+=r.speed*.01*n.factor,r.value>M?r.value-=M:r.value<0&&(r.value+=M)}getTransformValues(t){if(!t.tilt?.enable)return{};let n=t.tilt;return{b:Math.cos(n.value)*n.cosDirection*.5,c:Math.sin(n.value)*n.sinDirection*.5}}},Le=class{constructor(){this.id="roll"}init(t){t.roll||(t.roll={angle:Math.random()*M,speed:(15+Math.random()*10)/60,horizontal:Math.random()>.3,vertical:Math.random()>.7,enable:!t.flat})}isEnabled(t){return!t.destroyed&&t.roll?.enable===!0}update(t,n){if(!this.isEnabled(t))return;let r=t.roll;r.angle+=r.speed*n.factor,r.angle>M&&(r.angle-=M)}getTransformValues(t){if(!t.roll?.enable)return{};let n=t.roll;return{a:n.horizontal?Math.abs(Math.cos(n.angle)):void 0,d:n.vertical?Math.abs(Math.sin(n.angle)):void 0}}getDarkenAmount(t){if(!t.roll?.enable)return 0;let n=t.roll;return!n.horizontal&&!n.vertical?0:(n.horizontal?Math.cos(n.angle):Math.sin(n.angle))<0?25:0}},He=class{constructor(){this.id="rotate"}init(t){t.rotate||(t.rotate={angle:Math.random()*M,speed:(Math.random()*2-1)*.1,enable:!t.flat})}isEnabled(t){return!t.destroyed&&t.rotate?.enable===!0}update(t,n){if(!this.isEnabled(t))return;let r=t.rotate;r.angle+=r.speed*n.factor,r.angle>M?r.angle-=M:r.angle<0&&(r.angle+=M)}},Ne=class{constructor(){this.id="opacity"}init(t){t.opacity=1}isEnabled(t){return!t.destroyed}update(t,n){if(!this.isEnabled(t))return;let r=t.tick/t.totalTicks;t.opacity=1-Math.pow(r,2)}};function Tt(){return[new ke,new _e,new ze,new Le,new He,new Ne]}var xt=Math.PI*2,Ue=class{constructor(){this.type="circle"}draw(t,n,r){let i=n.flat?1:.6+Math.sin(n.wobble.angle)*.4;t.ellipse(0,0,r*i,r*(1-i*.3),n.tilt?.value??0,0,xt)}},We=class{constructor(){this.type="square"}draw(t,n,r){let i=n.flat?0:Math.sin(n.wobble.angle)*r*.3;t.moveTo(-r+i,-r),t.lineTo(r+i,-r*.5),t.lineTo(r-i,r),t.lineTo(-r-i,r*.5)}},qe=class{constructor(){this.type="rectangle"}draw(t,n,r){let i=r*1.5,o=r*.6,a=n.flat?0:Math.sin(n.wobble.angle)*o*.2;t.moveTo(-i+a,-o),t.lineTo(i+a,-o*.5),t.lineTo(i-a,o),t.lineTo(-i-a,o*.5)}},Ge=class{constructor(){this.type="star"}draw(t,n,r){let i=r,o=r*.5,a=5,s=Math.PI/a,c=-Math.PI/2;t.moveTo(0,-i);for(let l=0;l<a;l++)t.lineTo(Math.cos(c)*i,Math.sin(c)*i),c+=s,t.lineTo(Math.cos(c)*o,Math.sin(c)*o),c+=s}},Ve=class{constructor(){this.type="triangle"}draw(t,n,r){let i=r*Math.sqrt(3)/2;t.moveTo(0,-i),t.lineTo(-r,i),t.lineTo(r,i)}},$e=class{constructor(){this.type="diamond"}draw(t,n,r){t.moveTo(0,-r),t.lineTo(r*.6,0),t.lineTo(0,r),t.lineTo(-r*.6,0)}},je=class{constructor(){this.type="heart"}draw(t,n,r){let o=-r*.3,a=r*.3;t.moveTo(0,o+a),t.bezierCurveTo(0-r,o,0-r,o-a*2,0,o-a),t.bezierCurveTo(0+r,o-a*2,0+r,o,0,o+a)}},Ye=class{constructor(){this.type="hexagon"}draw(t,n,r){let o=xt/6;for(let a=0;a<6;a++){let s=o*a-Math.PI/2,c=Math.cos(s)*r,l=Math.sin(s)*r;a===0?t.moveTo(c,l):t.lineTo(c,l)}}},Xe=class{constructor(){this.drawers=new Map;this.register(new Ue),this.register(new We),this.register(new qe),this.register(new Ge),this.register(new Ve),this.register(new $e),this.register(new je),this.register(new Ye)}register(t){this.drawers.set(t.type,t)}get(t){return this.drawers.get(t)}has(t){return this.drawers.has(t)}getTypes(){return Array.from(this.drawers.keys())}unregister(t){return this.drawers.delete(t)}clear(){this.drawers.clear()}},ne=new Xe;var q=class{constructor(t={}){this.destroyed=!1;this.t=[];this.n=null;this.m=0;this.i=null;this.p=!1;this.o=null;this.P=t=>{if(this.destroyed)return;let n=Se(t,this.m);this.m=t,this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);let r=!1,i=[];for(let o=0;o<this.t.length;o++){let a=this.t[o];if(a.destroyed){i.push(o);continue}for(let s of this.e)s.isEnabled(a)&&s.update(a,n);if(a.destroyed){i.push(o);continue}r=!0,this.E(a)}for(let o=i.length-1;o>=0;o--){let a=i[o],s=this.t[a];this.l.release(s),this.t.splice(a,1)}r?this.n=we(this.P):(this.n=null,this.i?.(),this.i=null)};this.I=()=>{this.v()};this.id=`confetti-${fe()}`,this.f={canvas:t.canvas,resize:t.resize??!0,zIndex:t.zIndex??100,disableForReducedMotion:t.disableForReducedMotion??!1},t.canvas?this.canvas=t.canvas:(this.canvas=this.T(),this.p=!0);let n=this.canvas.getContext("2d",{alpha:!0,desynchronized:!0});if(!n)throw new Error("Failed to get 2D canvas context");this.ctx=n,this.e=Tt(),this.l=new Ie(500),this.f.resize&&this.R(),this.v()}get particles(){return this.t}async fire(t={}){if(this.f.disableForReducedMotion&&te())return Promise.resolve();if(this.destroyed)throw new Error("Cannot fire on destroyed container");let n=t.particleCount??100,r=this.canvas.width,i=this.canvas.height;for(let o=0;o<n;o++){let a=this.l.acquire(r,i,t);for(let s of this.e)s.init(a);this.t.push(a)}return this.n?new Promise(o=>{let a=this.i;this.i=()=>{a?.(),o()}}):new Promise(o=>{this.i=o,this.m=performance.now(),this.n=we(this.P)})}stop(){this.n&&(Oe(this.n),this.n=null);for(let t of this.t)this.l.release(t);this.t.length=0,this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.i?.(),this.i=null}reset(){this.stop(),this.l.clear()}destroy(){this.destroyed||(this.stop(),this.o&&(this.o.disconnect(),this.o=null),this.p&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.destroyed=!0)}E(t){let n=this.ctx,r=t.size*t.scalar,i={a:1,b:0,c:0,d:1};for(let l of this.e)if(l.getTransformValues){let u=l.getTransformValues(t);u.a!==void 0&&(i.a=u.a),u.b!==void 0&&(i.b=u.b),u.c!==void 0&&(i.c=u.c),u.d!==void 0&&(i.d=u.d)}let a=this.e.find(l=>l.id==="roll")?.getDarkenAmount(t)??0,s=a>0?Me(t.color,-a):t.color;n.save(),n.translate(t.position.x,t.position.y),n.rotate(t.rotate?.angle??0),n.transform(i.a??1,i.b??0,i.c??0,i.d??1,0,0),n.fillStyle=s,n.globalAlpha=t.opacity,n.beginPath();let c=ne.get(t.shape);c?c.draw(n,t,r):ne.get("square")?.draw(n,t,r),n.closePath(),n.fill(),n.restore()}T(){let t=document.createElement("canvas");return t.id=this.id,t.style.cssText=`
9
+ `,H=y.getContext("2d",{alpha:!0,desynchronized:!0}),!H)throw new Error("Failed to get canvas 2D context");document.body.appendChild(y),n.autoResize&&(z=()=>{if(y&&H){let a=n.width??window.innerWidth,s=n.height??window.innerHeight;y.width=a*r,y.height=s*r,y.style.width=`${a}px`,y.style.height=`${s}px`,H.setTransform(r,0,0,r,0,0)}},window.addEventListener("resize",z))}y.style.zIndex=String(e);let i=n.width??window.innerWidth,o=n.height??window.innerHeight;return(y.width!==i*r||y.height!==o*r)&&(y.width=i*r,y.height=o*r,y.style.width=`${i}px`,y.style.height=`${o}px`,H.setTransform(r,0,0,r,0,0)),{canvas:y,ctx:H,width:i,height:o,dpr:r}}function In(){y&&Q===0&&setTimeout(()=>{Q===0&&y&&(z&&(window.removeEventListener("resize",z),z=null),y.remove(),y=null,H=null)},lt)}function vt(e,t,n){let{type:r,x:i,y:o,w:a,h:s}=e;switch(r){case"point":return{x:i,y:o};case"rect":return{x:b(i,i+(a??0)),y:b(o,o+(s??0))};case"line":let l=C();return{x:i+l*(a??0),y:o+l*(s??0)};case"circle":let c=C()*P.TWO_PI,u=Math.sqrt(C())*(a??50);return{x:i+Math.cos(c)*u,y:o+Math.sin(c)*u};default:return{x:i,y:o}}}var ce=class{constructor(t,n){this.particles=[];this.canvasContext=null;this.animationFrameId=null;this.lastFrameTime=0;this.lastSpawnTime=0;this.isRunning=!1;this.isPaused=!1;this.deferred=ht();this.frameInterval=0;this.lastRenderTime=0;this.animate=()=>{if(!this.isRunning||!this.canvasContext)return;if((this.mode==="continuous"||this.mode==="snow"||this.mode==="rain")&&!this.continuousConfig.run){this.animationFrameId=requestAnimationFrame(this.animate),this.lastFrameTime=performance.now();return}if(this.isPaused){this.animationFrameId=requestAnimationFrame(this.animate),this.lastFrameTime=performance.now();return}let t=performance.now(),n=t-this.lastFrameTime;if(this.lastFrameTime=t,this.frameInterval>0){if(t-this.lastRenderTime<this.frameInterval){this.animationFrameId=requestAnimationFrame(this.animate);return}this.lastRenderTime=t}let{ctx:r,width:i,height:o,dpr:a}=this.canvasContext,{physics:s,particle:l}=this.config;r.setTransform(1,0,0,1,0,0),r.clearRect(0,0,i*a,o*a),r.scale(a,a);let c=this.particles,u=c.length,m=0,p=!0,h=100,I=-h,A=i+h,S=-h,F=o+h;for(let x=0;x<u;x++){let f=c[x];if(f.active){if(Ct(f,n,s,l.fadeOut,l.scaleDown),f.data?.isRocket&&f.y<=f.data.targetY){f.active=!1,this.explodeFirework(f.x,f.y,f.data);continue}if(f.data?.willExplode&&!f.data.hasExploded&&f.vx*f.vx+f.vy*f.vy<1&&(f.data.hasExploded=!0,this.explodeFirework(f.x,f.y,{burstCount:15,spread:360,burstColors:f.data.burstColors})),f.x<I||f.x>A||f.y<S||f.y>F){(f.y>F||f.x<I-200||f.x>A+200)&&(f.active=!1);continue}bt(r,f,{customDraw:this.drawShape}),m++,p=!1}}if(this.mode==="continuous"||this.mode==="snow"||this.mode==="rain"){let x=t-this.lastSpawnTime,f=1e3/(this.continuousConfig.spawnRate??10);if(x>=f){if(this.continuousConfig.recycle){let d=this.continuousConfig.numberOfPieces-m;if(d>0){for(let M=u-1;M>=0&&d>0;M--)c[M].active||(Me(c[M]),c.splice(M,1));this.spawnParticles(Math.min(d,5))}}else m<this.continuousConfig.numberOfPieces&&this.spawnParticles(Math.min(3,this.continuousConfig.numberOfPieces-m));this.lastSpawnTime=t}}if(this.mode==="firework"){let x=0;for(let D=0;D<u;D++)c[D].active&&c[D].data?.isRocket&&x++;let f=t-this.lastSpawnTime;x===0&&f>=(this.fireworkConfig.burstDelay??500)&&(this.launchFirework(),this.lastSpawnTime=t)}if((this.mode==="burst"||this.mode==="cannon"||this.mode==="explosion")&&p){this.complete();return}this.animationFrameId=requestAnimationFrame(this.animate)};this.origin=t,this.config=ye(n),this.mode=n?.mode??"burst",this.spawnArea=n?.spawnArea,this.continuousConfig={...he,...n?.continuous},this.fireworkConfig={...ge,...n?.firework},this.canvasConfig={...ae,...n?.canvas},this.drawShape=n?.particle?.drawShape,this.canvasConfig.frameRate&&(this.frameInterval=1e3/this.canvasConfig.frameRate)}start(){if(this.isRunning)return this.createHandle();if(!Y())return this.deferred.resolve(),this.createHandle();if(typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches)return this.deferred.resolve(),this.createHandle();if(this.isRunning=!0,Q++,this.canvasContext=Pn(this.config.zIndex,this.canvasConfig),this.mode==="continuous"||this.mode==="snow"||this.mode==="rain"){let t=Math.min(this.continuousConfig.numberOfPieces,Math.floor(this.continuousConfig.numberOfPieces*.5));this.spawnParticles(t)}else this.mode==="firework"?this.launchFirework():this.createParticles();return this.config.onStart?.(),this.lastFrameTime=performance.now(),this.lastSpawnTime=performance.now(),this.lastRenderTime=performance.now(),this.animate(),this.createHandle()}createParticles(){let{particleCount:t,particle:n,direction:r,physics:i}=this.config,{x:o,y:a}=this.origin,s=Math.min(t,Oe.MAX_PARTICLES);for(let l=0;l<s;l++){let c;if(r.direction==="radial")c=C()*P.TWO_PI;else{let p=le(r.direction,r.angle),h=E(r.spread);c=p+(C()-.5)*h}let u=b(r.velocity[0],r.velocity[1]),m=J(o,a,c,u,n.colors,n.shapes,n.size,n.opacity,n.lifespan,i.rotationSpeed,{images:n.images,tiltRange:n.tilt,spinSpeedRange:n.spinSpeed,depth3D:n.depth3D});this.particles.push(m)}}spawnParticles(t){if(!this.canvasContext)return;let{particle:n,physics:r}=this.config,{width:i,height:o}=this.canvasContext;for(let a=0;a<t;a++){let s;this.spawnArea?s=vt(this.spawnArea,i,o):this.mode==="snow"||this.mode==="rain"?s={x:b(0,i),y:-20}:s={x:b(0,i),y:b(-20,0)};let l,c;this.mode==="snow"?(l=E(b(-20,20)-90),c=b(.5,2)):this.mode==="rain"?(l=E(-90),c=b(8,15)):(l=C()*P.TWO_PI,c=b(2,6));let u=J(s.x,s.y,l,c,n.colors,n.shapes,n.size,n.opacity,n.lifespan,r.rotationSpeed,{images:n.images,tiltRange:n.tilt,spinSpeedRange:n.spinSpeed,depth3D:n.depth3D});this.particles.push(u)}}launchFirework(){if(!this.canvasContext)return;let{width:t,height:n}=this.canvasContext,{launchHeight:r,burstCount:i,spread:o,secondaryExplosions:a,rocketColors:s,burstColors:l,trailLength:c}=this.fireworkConfig,u=this.spawnArea?vt(this.spawnArea,t,n).x:b(t*.2,t*.8),m=n*(1-r),p=u+b(-50,50),h=J(u,n,E(-90+b(-10,10)),b(15,25),s,["circle"],[3,5],[1,1],2e3,0);h.data={isRocket:!0,targetY:m,targetX:p,burstCount:i,spread:o,burstColors:l,secondaryExplosions:a,trailLength:c},this.particles.push(h)}explodeFirework(t,n,r){let{burstCount:i=80,spread:o=360,burstColors:a,secondaryExplosions:s}=r,l=a??this.config.particle.colors,c=E(o);for(let u=0;u<i;u++){let m=u/i*c-c/2+E(-90),p=b(4,12),h=J(t,n,m,p,l,this.config.particle.shapes,[2,6],[.8,1],1500,this.config.physics.rotationSpeed);s&&C()<.1&&(h.data={willExplode:!0,burstColors:l}),this.particles.push(h)}}stop(){this.isRunning&&(this.animationFrameId!==null&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null),this.cleanup(),this.deferred.resolve())}pause(){this.isPaused=!0}resume(){this.isPaused=!1}complete(){this.config.onComplete?.(),this.cleanup(),this.deferred.resolve()}cleanup(){this.isRunning=!1,this.isPaused=!1;let t=this.particles;for(let n=t.length-1;n>=0;n--)Me(t[n]);this.particles=[],this.canvasContext=null,Q--,this.config.autoCleanup&&In()}addParticles(t){if(!(!this.isRunning||!this.canvasContext))if(this.mode==="continuous"||this.mode==="snow"||this.mode==="rain")this.spawnParticles(t);else{let{particle:n,direction:r,physics:i}=this.config,{x:o,y:a}=this.origin;for(let s=0;s<t;s++){let l;if(r.direction==="radial")l=C()*P.TWO_PI;else{let m=le(r.direction,r.angle),p=E(r.spread);l=m+(C()-.5)*p}let c=b(r.velocity[0],r.velocity[1]),u=J(o,a,l,c,n.colors,n.shapes,n.size,n.opacity,n.lifespan,i.rotationSpeed);this.particles.push(u)}}}clear(){let t=this.particles;for(let n=t.length-1;n>=0;n--)Me(t[n]);this.particles=[]}getParticleCount(){return yt(this.particles)}getState(){return this.isRunning?this.isPaused?"paused":"running":"stopped"}createHandle(){return{stop:()=>this.stop(),pause:()=>this.pause(),resume:()=>this.resume(),promise:this.deferred.promise,addParticles:t=>this.addParticles(t),clear:()=>this.clear(),getParticleCount:()=>this.getParticleCount(),getState:()=>this.getState()}}};function ue(e,t){return new ce(e,t).start()}function Pe(e,t){if(!e||!Y())return null;let n=e.getBoundingClientRect(),r={x:n.left+n.width/2,y:n.top+n.height/2};return ue(r,t)}function It(){return Q}function Tt(){z&&(window.removeEventListener("resize",z),z=null),y&&(y.remove(),y=null,H=null),Q=0}var w=require("react");function B(){let[e,t]=(0,w.useState)(!1),n=(0,w.useRef)(new Set);(0,w.useEffect)(()=>()=>{n.current.forEach(c=>c.stop()),n.current.clear()},[]);let r=(0,w.useCallback)((c,u)=>{let m=ue(c,u);return n.current.add(m),t(!0),m.promise.then(()=>{n.current.delete(m),n.current.size===0&&t(!1)}),m},[]),i=(0,w.useCallback)((c,u)=>{let m=Pe(c,u);return m?(n.current.add(m),t(!0),m.promise.then(()=>{n.current.delete(m),n.current.size===0&&t(!1)}),m):null},[]),o=(0,w.useCallback)(()=>{n.current.forEach(c=>c.stop()),n.current.clear(),t(!1)},[]),a=(0,w.useCallback)(()=>{n.current.forEach(c=>c.pause())},[]),s=(0,w.useCallback)(()=>{n.current.forEach(c=>c.resume())},[]),l=(0,w.useCallback)(()=>Array.from(n.current),[]);return{fire:r,fireFromElement:i,isActive:e,stopAll:o,pauseAll:a,resumeAll:s,getActiveHandles:l}}function Ft(e){let t=(0,w.useRef)(null),{fireFromElement:n,isActive:r}=B(),i=(0,w.useCallback)(()=>n(t.current,e),[n,e]);return{ref:t,fire:i,isActive:r}}function xt(e,t,n){let r=(0,w.useRef)(!1),{fire:i}=B();(0,w.useEffect)(()=>{e&&!r.current&&(r.current=!0,i(t,n))},[e,i,t,n]),(0,w.useEffect)(()=>{e||(r.current=!1)},[e])}function Et(e){let{fire:t,isActive:n,stopAll:r}=B(),i=(0,w.useRef)([]),o=(0,w.useCallback)(()=>{i.current.forEach(s=>clearTimeout(s)),i.current=[],r()},[r]),a=(0,w.useCallback)(()=>{o(),e.forEach(({origin:s,options:l,delay:c})=>{let u=window.setTimeout(()=>{t(s,l)},c);i.current.push(u)})},[e,t,o]);return(0,w.useEffect)(()=>()=>{i.current.forEach(s=>clearTimeout(s))},[]),{start:a,isActive:n,cancel:o}}function At(e){let{fire:t,isActive:n}=B();return{fire:(0,w.useCallback)(()=>{let i={x:typeof window<"u"?window.innerWidth/2:0,y:typeof window<"u"?window.innerHeight/2:0};return t(i,{...e,direction:{direction:"radial"}})},[t,e]),isActive:n}}var v=require("react");var ke=require("react/jsx-runtime");function Rt({active:e,origin:t,triggerRef:n,options:r,onComplete:i}){let{fire:o,fireFromElement:a}=B(),s=(0,v.useRef)(!1);return(0,v.useEffect)(()=>{if(e&&!s.current){s.current=!0;let l=null;n?.current?l=a(n.current,r):t&&(l=o(t,r)),l&&l.promise.then(()=>{i?.()})}},[e,t,n,r,o,a,i]),(0,v.useEffect)(()=>{e||(s.current=!1)},[e]),null}var Be=(0,v.forwardRef)(({options:e,style:t},n)=>{let r=(0,v.useRef)(null),{fireFromElement:i}=B();return(0,v.useImperativeHandle)(n,()=>({fire:()=>i(r.current,e)})),(0,ke.jsx)("div",{ref:r,style:{position:"absolute",width:1,height:1,pointerEvents:"none",...t},"aria-hidden":"true"})});Be.displayName="ConfettiTrigger";var Le=(0,v.forwardRef)(({children:e,confettiOptions:t,fireOnClick:n=!0,originOffset:r,direction:i,onClick:o,...a},s)=>{let l=(0,v.useRef)(null),{fire:c}=B(),u=(0,v.useCallback)(p=>{l.current=p,typeof s=="function"?s(p):s&&(s.current=p)},[s]),m=(0,v.useCallback)(p=>{if(n&&l.current){let h=l.current.getBoundingClientRect(),I={x:h.left+h.width/2+(r?.x??0),y:h.top+h.height/2+(r?.y??0)},A=i?{...t,direction:{...t?.direction,direction:i}}:t;c(I,A)}o?.(p)},[n,c,t,r,i,o]);return(0,ke.jsx)("button",{ref:u,onClick:m,...a,children:e})});Le.displayName="ConfettiButton";function St({origin:e,options:t,onComplete:n,delay:r=0}){let{fire:i}=B(),o=(0,v.useRef)(!1);return(0,v.useEffect)(()=>{if(o.current)return;o.current=!0;let a=e??{x:typeof window<"u"?window.innerWidth/2:0,y:typeof window<"u"?window.innerHeight/2:0},s=setTimeout(()=>{i(a,t).promise.then(()=>n?.())},r);return()=>clearTimeout(s)},[i,e,t,n,r]),null}function Ot({left:e=0,top:t=0,angle:n=90,options:r,fire:i=!1,onComplete:o}){let{fire:a}=B(),s=(0,v.useRef)(!1);return(0,v.useEffect)(()=>{if(!i||s.current||typeof window>"u")return;s.current=!0;let l=typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100*window.innerWidth:typeof e=="number"?e:parseFloat(e)||0,c=typeof t=="string"&&t.endsWith("%")?parseFloat(t)/100*window.innerHeight:typeof t=="number"?t:parseFloat(t)||0;a({x:l,y:c},{...r,direction:{...r?.direction,direction:"custom",angle:n}}).promise.then(()=>o?.())},[i,e,t,n,r,a,o]),(0,v.useEffect)(()=>{i||(s.current=!1)},[i]),null}function Ne({width:e,height:t,numberOfPieces:n=200,confettiSource:r,initialVelocityX:i,initialVelocityY:o,recycle:a=!0,run:s=!0,gravity:l=.3,wind:c=0,opacity:u=1,drawShape:m,tweenDuration:p=100,colors:h,onConfettiComplete:I,frameRate:A}){let{fire:S}=B(),F=(0,v.useRef)(null),x=(0,v.useRef)(!1),f=(0,v.useRef)({width:e,height:t,numberOfPieces:n,confettiSource:r,initialVelocityX:i,initialVelocityY:o,recycle:a,gravity:l,wind:c,opacity:u,drawShape:m,tweenDuration:p,colors:h,onConfettiComplete:I,frameRate:A});f.current={width:e,height:t,numberOfPieces:n,confettiSource:r,initialVelocityX:i,initialVelocityY:o,recycle:a,gravity:l,wind:c,opacity:u,drawShape:m,tweenDuration:p,colors:h,onConfettiComplete:I,frameRate:A};let D=(0,v.useRef)(S);return D.current=S,(0,v.useEffect)(()=>{if(!s){F.current&&(F.current.stop(),F.current=null),x.current=!1;return}if(x.current)return;x.current=!0;let d=f.current,M=d.confettiSource?{type:"rect",x:d.confettiSource.x,y:d.confettiSource.y,w:d.confettiSource.w??window.innerWidth,h:d.confettiSource.h??10}:{type:"rect",x:0,y:0,w:d.width??window.innerWidth,h:10},W=typeof d.initialVelocityX=="number"?[d.initialVelocityX*.5,d.initialVelocityX*1.5]:d.initialVelocityX?[d.initialVelocityX.min,d.initialVelocityX.max]:[4,10],q=typeof d.initialVelocityY=="number"?[d.initialVelocityY*.5,d.initialVelocityY*1.5]:d.initialVelocityY?[d.initialVelocityY.min,d.initialVelocityY.max]:[10,30],N=(d.width??window.innerWidth)/2,V=0;return F.current=D.current({x:N,y:V},{particleCount:d.numberOfPieces,particle:{colors:d.colors??["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff"],opacity:[d.opacity*.8,d.opacity],shapes:["square","circle","rectangle"],drawShape:d.drawShape},physics:{gravity:d.gravity*10,wind:d.wind*5,windVariation:W[1]-W[0]},direction:{velocity:q},mode:"continuous",spawnArea:M,continuous:{recycle:d.recycle,numberOfPieces:d.numberOfPieces,spawnRate:30,run:s,tweenDuration:d.tweenDuration},canvas:{width:d.width,height:d.height,frameRate:d.frameRate,autoResize:!d.width&&!d.height},onComplete:d.onConfettiComplete}),()=>{F.current&&(F.current.stop(),F.current=null)}},[s]),null}Ne.displayName="Confetti";var Dt=1e3/60;function g(){return C()}function He(e,t){let n=Math.max(0,e-t),r=n/Dt;return Object.freeze({value:n,factor:r})}function Mt(e){if(typeof e!="string"||e.length>50)return null;let t=e.trim().toLowerCase();if(t.startsWith("#")){let r=t.slice(1);if(!/^[0-9a-f]+$/.test(r))return null;let i,o,a,s=255;if(r.length===3)i=parseInt(r[0]+r[0],16),o=parseInt(r[1]+r[1],16),a=parseInt(r[2]+r[2],16);else if(r.length===6)i=parseInt(r.slice(0,2),16),o=parseInt(r.slice(2,4),16),a=parseInt(r.slice(4,6),16);else if(r.length===8)i=parseInt(r.slice(0,2),16),o=parseInt(r.slice(2,4),16),a=parseInt(r.slice(4,6),16),s=parseInt(r.slice(6,8),16);else return null;return{r:i,g:o,b:a,a:s/255}}let n=t.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)$/);return n?{r:T(parseInt(n[1],10),0,255),g:T(parseInt(n[2],10),0,255),b:T(parseInt(n[3],10),0,255),a:n[4]!==void 0?T(parseFloat(n[4]),0,1):1}:null}function ze(e,t){let n=Mt(e);if(!n)return e;let{r,g:i,b:o,a}=n,s=T(r+t,0,255),l=T(i+t,0,255),c=T(o+t,0,255);return a<1?`rgba(${Math.round(s)}, ${Math.round(l)}, ${Math.round(c)}, ${a})`:`rgb(${Math.round(s)}, ${Math.round(l)}, ${Math.round(c)})`}function ee(){if(typeof window>"u")return!1;try{return window.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1}catch{return!1}}var Fn=0;function de(){return++Fn}function Ie(e){if(e.length===0)return;let t=Math.floor(g()*e.length);return e[t]}function Te(e){return typeof requestAnimationFrame<"u"?requestAnimationFrame(e):setTimeout(e,Dt)}function Ue(e){typeof cancelAnimationFrame<"u"?cancelAnimationFrame(e):clearTimeout(e)}function fe(){return typeof window>"u"?1:Math.min(window.devicePixelRatio||1,2)}var _t=Object.freeze(["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"]),xn=Object.freeze(["square","circle"]),Fe=Math.PI*2,xe=class e{constructor(t,n,r,i,o,a,s,l,c,u,m,p,h,I,A,S,F){this.id=t,this.position=n,this.velocity=r,this.angle2D=i,this.gravity=o,this.drift=a,this.decay=s,this.wobble=l,this.tilt=c,this.roll=u,this.rotate=m,this.color=p,this.shape=h,this.size=I,this.scalar=A,this.flat=S,this.tick=0,this.totalTicks=F,this.destroyed=!1,this.opacity=1}static create(t,n,r={}){let{angle:i=90,spread:o=45,startVelocity:a=45,decay:s=.94,gravity:l=1,drift:c=0,flat:u=!1,ticks:m=200,origin:p={x:.5,y:.5},colors:h=_t,shapes:I=xn,scalar:A=1,size:S=4}=r,F={x:p.x*t,y:p.y*n},x=E(i),f=E(o),D=-x+(.5*f-g()*f),d=a*.5+g()*a,M={angle:g()*Fe,angleSpeed:g()*.1+.05,moveSpeed:-15+g()*30,distance:25+g()*15},W={value:g()*Fe,sinDirection:g()>=.5?1:-1,cosDirection:g()>=.5?1:-1,speed:(g()*.4+.3)*(g()>.5?1:-1),enable:!u},q={angle:g()*Fe,speed:(15+g()*10)/60,horizontal:g()>.3,vertical:g()>.7,enable:!u},N={angle:g()*Fe,speed:(g()*2-1)*.1,enable:!u},V=Ie(h)??_t[0],me=Ie(I)??"square";return new e(de(),F,d,D,l*3,c,s,M,W,q,N,V,me,S,A,u,m)}get progress(){return this.tick/this.totalTicks}get computedSize(){return this.size*this.scalar}destroy(){this.destroyed=!0}clone(t){let n=Object.create(e.prototype);return Object.assign(n,this,t),n}},Ee=class{constructor(t=1e3){this.pool=[];this.maxSize=t}acquire(t,n,r){let i=this.pool.pop();return i?this.resetParticle(i,t,n,r):xe.create(t,n,r)}release(t){this.pool.length<this.maxSize&&(t.destroyed=!0,this.pool.push(t))}clear(){this.pool.length=0}get size(){return this.pool.length}resetParticle(t,n,r,i){let o=xe.create(n,r,i);return Object.assign(t,o,{id:t.id}),t.destroyed=!1,t}};var _=Math.PI*2,We=class{constructor(){this.id="base"}init(t){}isEnabled(t){return!t.destroyed}update(t,n){if(t.destroyed)return;let r=Math.cos(t.angle2D)*t.velocity,i=Math.sin(t.angle2D)*t.velocity;t.position.x+=r*n.factor+t.drift*n.factor,t.position.y+=i*n.factor+t.gravity*n.factor,t.velocity*=t.decay,t.tick++,t.tick>=t.totalTicks&&(t.destroyed=!0)}},Ve=class{constructor(){this.id="wobble"}init(t){t.wobble||(t.wobble={angle:g()*_,angleSpeed:g()*.1+.05,moveSpeed:-15+g()*30,distance:25+g()*15})}isEnabled(t){return!t.destroyed&&!t.flat&&!!t.wobble}update(t,n){if(!this.isEnabled(t))return;let r=t.wobble;r.angle+=r.angleSpeed*n.factor,r.angle>_&&(r.angle-=_);let i=Math.cos(r.angle)*r.distance*.1;t.position.x+=i*n.factor}},Ye=class{constructor(){this.id="tilt"}init(t){t.tilt||(t.tilt={value:g()*_,sinDirection:g()>=.5?1:-1,cosDirection:g()>=.5?1:-1,speed:(g()*.4+.3)*(g()>.5?1:-1),enable:!t.flat})}isEnabled(t){return!t.destroyed&&t.tilt?.enable===!0}update(t,n){if(!this.isEnabled(t))return;let r=t.tilt;r.value+=r.speed*.01*n.factor,r.value>_?r.value-=_:r.value<0&&(r.value+=_)}getTransformValues(t){if(!t.tilt?.enable)return{};let n=t.tilt;return{b:Math.cos(n.value)*n.cosDirection*.5,c:Math.sin(n.value)*n.sinDirection*.5}}},Ge=class{constructor(){this.id="roll"}init(t){t.roll||(t.roll={angle:g()*_,speed:(15+g()*10)/60,horizontal:g()>.3,vertical:g()>.7,enable:!t.flat})}isEnabled(t){return!t.destroyed&&t.roll?.enable===!0}update(t,n){if(!this.isEnabled(t))return;let r=t.roll;r.angle+=r.speed*n.factor,r.angle>_&&(r.angle-=_)}getTransformValues(t){if(!t.roll?.enable)return{};let n=t.roll;return{a:n.horizontal?Math.abs(Math.cos(n.angle)):void 0,d:n.vertical?Math.abs(Math.sin(n.angle)):void 0}}getDarkenAmount(t){if(!t.roll?.enable)return 0;let n=t.roll;return!n.horizontal&&!n.vertical?0:(n.horizontal?Math.cos(n.angle):Math.sin(n.angle))<0?25:0}},qe=class{constructor(){this.id="rotate"}init(t){t.rotate||(t.rotate={angle:g()*_,speed:(g()*2-1)*.1,enable:!t.flat})}isEnabled(t){return!t.destroyed&&t.rotate?.enable===!0}update(t,n){if(!this.isEnabled(t))return;let r=t.rotate;r.angle+=r.speed*n.factor,r.angle>_?r.angle-=_:r.angle<0&&(r.angle+=_)}},$e=class{constructor(){this.id="opacity"}init(t){t.opacity=1}isEnabled(t){return!t.destroyed}update(t,n){if(!this.isEnabled(t))return;let r=t.tick/t.totalTicks;t.opacity=1-Math.pow(r,2)}};function Bt(){return[new We,new Ve,new Ye,new Ge,new qe,new $e]}var Lt=Math.PI*2,je=class{constructor(){this.type="circle"}draw(t,n,r){let i=n.flat?1:.6+Math.sin(n.wobble.angle)*.4;t.ellipse(0,0,r*i,r*(1-i*.3),n.tilt?.value??0,0,Lt)}},Xe=class{constructor(){this.type="square"}draw(t,n,r){let i=n.flat?0:Math.sin(n.wobble.angle)*r*.3;t.moveTo(-r+i,-r),t.lineTo(r+i,-r*.5),t.lineTo(r-i,r),t.lineTo(-r-i,r*.5)}},Ze=class{constructor(){this.type="rectangle"}draw(t,n,r){let i=r*1.5,o=r*.6,a=n.flat?0:Math.sin(n.wobble.angle)*o*.2;t.moveTo(-i+a,-o),t.lineTo(i+a,-o*.5),t.lineTo(i-a,o),t.lineTo(-i-a,o*.5)}},Ke=class{constructor(){this.type="star"}draw(t,n,r){let i=r,o=r*.5,a=5,s=Math.PI/a,l=-Math.PI/2;t.moveTo(0,-i);for(let c=0;c<a;c++)t.lineTo(Math.cos(l)*i,Math.sin(l)*i),l+=s,t.lineTo(Math.cos(l)*o,Math.sin(l)*o),l+=s}},Je=class{constructor(){this.type="triangle"}draw(t,n,r){let i=r*Math.sqrt(3)/2;t.moveTo(0,-i),t.lineTo(-r,i),t.lineTo(r,i)}},Qe=class{constructor(){this.type="diamond"}draw(t,n,r){t.moveTo(0,-r),t.lineTo(r*.6,0),t.lineTo(0,r),t.lineTo(-r*.6,0)}},et=class{constructor(){this.type="heart"}draw(t,n,r){let o=-r*.3,a=r*.3;t.moveTo(0,o+a),t.bezierCurveTo(0-r,o,0-r,o-a*2,0,o-a),t.bezierCurveTo(0+r,o-a*2,0+r,o,0,o+a)}},tt=class{constructor(){this.type="hexagon"}draw(t,n,r){let o=Lt/6;for(let a=0;a<6;a++){let s=o*a-Math.PI/2,l=Math.cos(s)*r,c=Math.sin(s)*r;a===0?t.moveTo(l,c):t.lineTo(l,c)}}},nt=class{constructor(){this.drawers=new Map;this.register(new je),this.register(new Xe),this.register(new Ze),this.register(new Ke),this.register(new Je),this.register(new Qe),this.register(new et),this.register(new tt)}register(t){this.drawers.set(t.type,t)}get(t){return this.drawers.get(t)}has(t){return this.drawers.has(t)}getTypes(){return Array.from(this.drawers.keys())}unregister(t){return this.drawers.delete(t)}clear(){this.drawers.clear()}},te=new nt;var U=class{constructor(t={}){this.destroyed=!1;this.t=[];this.n=null;this.m=0;this.i=null;this.p=!1;this.o=null;this.C=!1;this.T=t=>{if(this.destroyed)return;let n=He(t,this.m);this.m=t;let r=fe();this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.ctx.scale(r,r);let i=!1,o=[];for(let a=0;a<this.t.length;a++){let s=this.t[a];if(s.destroyed){o.push(a);continue}for(let l of this.e)l.isEnabled(s)&&l.update(s,n);if(s.destroyed){o.push(a);continue}i=!0,this.A(s)}for(let a=o.length-1;a>=0;a--){let s=o[a],l=this.t[s];this.l.release(l),this.t.splice(s,1)}i?this.n=Te(this.T):(this.n=null,this.i?.(),this.i=null)};this.v=()=>{this.I()};this.id=`confetti-${de()}`,this.f={canvas:t.canvas,resize:t.resize??!0,zIndex:t.zIndex??100,disableForReducedMotion:t.disableForReducedMotion??!1},t.canvas?this.canvas=t.canvas:(this.canvas=this.F(),this.p=!0);let n=this.canvas.getContext("2d",{alpha:!0,desynchronized:!0});if(!n)throw new Error("Failed to get 2D canvas context");this.ctx=n,this.e=Bt(),this.l=new Ee(500),this.f.resize&&this.E(),this.I()}get particles(){return this.t}async fire(t={}){if(this.f.disableForReducedMotion&&ee())return Promise.resolve();if(this.destroyed)throw new Error("Cannot fire on destroyed container");let n=t.particleCount??100,r=fe(),i=this.canvas.width/r,o=this.canvas.height/r;for(let a=0;a<n;a++){let s=this.l.acquire(i,o,t);for(let l of this.e)l.init(s);this.t.push(s)}return this.n?new Promise(a=>{let s=this.i;this.i=()=>{s?.(),a()}}):new Promise(a=>{this.i=a,this.m=performance.now(),this.n=Te(this.T)})}stop(){this.n&&(Ue(this.n),this.n=null);for(let t of this.t)this.l.release(t);this.t.length=0,this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.i?.(),this.i=null}reset(){this.stop(),this.l.clear()}destroy(){this.destroyed||(this.stop(),this.o&&(this.o.disconnect(),this.o=null),this.C&&(window.removeEventListener("resize",this.v),this.C=!1),this.p&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.destroyed=!0)}A(t){let n=this.ctx,r=t.size*t.scalar,i={a:1,b:0,c:0,d:1};for(let c of this.e)if(c.getTransformValues){let u=c.getTransformValues(t);u.a!==void 0&&(i.a=u.a),u.b!==void 0&&(i.b=u.b),u.c!==void 0&&(i.c=u.c),u.d!==void 0&&(i.d=u.d)}let a=this.e.find(c=>c.id==="roll")?.getDarkenAmount(t)??0,s=a>0?ze(t.color,-a):t.color;n.save(),n.translate(t.position.x,t.position.y),n.rotate(t.rotate?.angle??0),n.transform(i.a??1,i.b??0,i.c??0,i.d??1,0,0),n.fillStyle=s,n.globalAlpha=t.opacity,n.beginPath();let l=te.get(t.shape);l?l.draw(n,t,r):te.get("square")?.draw(n,t,r),n.closePath(),n.fill(),n.restore()}F(){let t=document.createElement("canvas");return t.id=this.id,t.style.cssText=`
10
10
  position: fixed;
11
11
  top: 0;
12
12
  left: 0;
@@ -14,4 +14,4 @@
14
14
  height: 100%;
15
15
  pointer-events: none;
16
16
  z-index: ${this.f.zIndex};
17
- `,document.body.appendChild(t),t}R(){if(typeof ResizeObserver>"u"){window.addEventListener("resize",this.I);return}this.o=new ResizeObserver(this.I),this.p?this.o.observe(document.body):this.canvas.parentElement&&this.o.observe(this.canvas.parentElement)}v(){let t=Be();if(this.p){let n=document.documentElement.clientWidth,r=document.documentElement.clientHeight;this.canvas.width=n*t,this.canvas.height=r*t,this.canvas.style.width=`${n}px`,this.canvas.style.height=`${r}px`}else{let n=this.canvas.getBoundingClientRect();this.canvas.width=n.width*t,this.canvas.height=n.height*t}this.ctx.scale(t,t)}};var Te=class{constructor(){this.e=[];this.C=[];this.u=[];this.s=null}addUpdater(t){this.e.some(n=>n.id===t.id)||this.e.push(t)}addMover(t){this.C.some(n=>n.id===t.id)||this.C.push(t)}addShapeDrawer(t){ne.register(t)}getUpdaters(){return Object.freeze([...this.e])}getMovers(){return Object.freeze([...this.C])}getShapeDrawer(t){return ne.get(t)}createContainer(t){let n=new q(t);return this.u.push(n),n}getDefaultContainer(){return(!this.s||this.s.destroyed)&&(this.s=new q,this.u.push(this.s)),this.s}destroyAll(){for(let t of this.u)t.destroy();this.u.length=0,this.s=null}get containerCount(){return this.u.length}},Ze=null;function Je(){return Ze||(Ze=new Te),Ze}var pe=new Map;function Rt(e,t){let n=pe.get(e);if(!n||n.destroyed){let r=e==="default"?{resize:!0,...t}:{canvas:e,resize:t?.resize??!1,...t};n=new q(r),pe.set(e,n)}return n}function Et(e){return{particleCount:e.particleCount??100,size:e.size??4,angle:e.angle??90,spread:e.spread??45,startVelocity:e.startVelocity??45,decay:e.decay??.94,gravity:e.gravity??1,drift:e.drift??0,flat:e.flat??!1,ticks:e.ticks??200,origin:e.origin??{x:.5,y:.5},colors:e.colors??void 0,shapes:e.shapes??void 0,scalar:e.scalar??1}}function v(e={}){if(e.disableForReducedMotion&&te())return Promise.resolve();try{return Rt("default").fire(Et(e))}catch{return null}}v.create=function(e,t={}){let n=Rt(e,t),r=(i={})=>{if((i.disableForReducedMotion??t.disableForReducedMotion)&&te())return Promise.resolve();try{return n.fire(Et(i))}catch{return null}};return r.reset=()=>{n.stop()},r};v.reset=function(){let e=pe.get("default");e&&!e.destroyed&&e.stop()};v.fireworks=async function(e={}){let t={particleCount:30,spread:55,...e};await Promise.all([v({...t,angle:60,origin:{x:0,y:.65}}),v({...t,angle:120,origin:{x:1,y:.65}})])};v.schoolPride=function(e={}){let t=Date.now()+3e3,n=e.colors??["#bb0000","#ffffff"];function r(){v({particleCount:2,angle:60,spread:55,origin:{x:0,y:.6},colors:n,...e}),v({particleCount:2,angle:120,spread:55,origin:{x:1,y:.6},colors:n,...e}),Date.now()<t&&requestAnimationFrame(r)}r()};v.snow=function(e={}){let{duration:t=5e3,...n}=e,r=Date.now()+t;function i(){v({particleCount:1,startVelocity:0,ticks:300,gravity:.3,origin:{x:Math.random(),y:0},colors:["#ffffff","#f0f8ff","#e6f3ff"],shapes:["circle"],scalar:.8+Math.random()*.4,drift:Math.random()-.5,...n}),Date.now()<r&&requestAnimationFrame(i)}i()};v.burst=function(e,t={}){return v({particleCount:80,spread:360,startVelocity:30,decay:.92,scalar:1.2,origin:e,...t})};v.destroyAll=function(){for(let e of pe.values())e.destroy();pe.clear(),Je().destroyAll()};v.getShapes=function(){return["square","circle","star","triangle","rectangle","diamond","heart","hexagon"]};function Ft(){let e=!1,t=!1,n=Promise.resolve();return{stop:()=>{e=!0,v.reset()},pause:()=>{t=!0},resume:()=>{t=!1},promise:n,addParticles:()=>{},clear:()=>{v.reset()},getParticleCount:()=>0,getState:()=>e?"stopped":t?"paused":"running"}}function j(){let[e,t]=(0,O.useState)(!1),n=(0,O.useRef)(new Set);(0,O.useEffect)(()=>()=>{n.current.forEach(l=>l.stop()),n.current.clear()},[]);let r=(0,O.useCallback)((l,u)=>{let p={x:l.x/window.innerWidth,y:l.y/window.innerHeight},f=Ft();return n.current.add(f),t(!0),v({particleCount:u?.particleCount??100,spread:u?.direction?.spread??70,origin:p,colors:u?.particle?.colors}),setTimeout(()=>{n.current.delete(f),n.current.size===0&&t(!1)},3e3),f},[]),i=(0,O.useCallback)((l,u)=>{if(!l)return null;let p=l.getBoundingClientRect(),f=document.documentElement.clientWidth,h=document.documentElement.clientHeight,F={x:(p.left+p.width/2)/f,y:(p.top+p.height/2)/h},w=Ft();return n.current.add(w),t(!0),v({particleCount:u?.particleCount??100,spread:u?.direction?.spread??70,origin:F,colors:u?.particle?.colors}),setTimeout(()=>{n.current.delete(w),n.current.size===0&&t(!1)},3e3),w},[]),o=(0,O.useCallback)(()=>{n.current.forEach(l=>l.stop()),n.current.clear(),t(!1)},[]),a=(0,O.useCallback)(()=>{n.current.forEach(l=>l.pause())},[]),s=(0,O.useCallback)(()=>{n.current.forEach(l=>l.resume())},[]),c=(0,O.useCallback)(()=>Array.from(n.current),[]);return{fire:r,fireFromElement:i,isActive:e,stopAll:o,pauseAll:a,resumeAll:s,getActiveHandles:c}}var T=require("react");var Qe=require("react/jsx-runtime");function At({active:e,origin:t,triggerRef:n,options:r,onComplete:i}){let{fire:o,fireFromElement:a}=j(),s=(0,T.useRef)(!1);return(0,T.useEffect)(()=>{if(e&&!s.current){s.current=!0;let c=null;n?.current?c=a(n.current,r):t&&(c=o(t,r)),c&&c.promise.then(()=>{i?.()})}},[e,t,n,r,o,a,i]),(0,T.useEffect)(()=>{e||(s.current=!1)},[e]),null}var ln=(0,T.forwardRef)(({options:e,style:t},n)=>{let r=(0,T.useRef)(null),{fireFromElement:i}=j();return(0,T.useImperativeHandle)(n,()=>({fire:()=>i(r.current,e)})),(0,Qe.jsx)("div",{ref:r,style:{position:"absolute",width:1,height:1,pointerEvents:"none",...t},"aria-hidden":"true"})});ln.displayName="ConfettiTrigger";var Ke=(0,T.forwardRef)(({children:e,confettiOptions:t,fireOnClick:n=!0,onClick:r,...i},o)=>{let a=(0,T.useRef)(null),{fireFromElement:s}=j(),c=(0,T.useCallback)(u=>{a.current=u,typeof o=="function"?o(u):o&&(o.current=u)},[o]),l=(0,T.useCallback)(u=>{n&&a.current&&s(a.current,t),r?.(u)},[n,s,t,r]);return(0,Qe.jsx)("button",{ref:c,onClick:l,...i,children:e})});Ke.displayName="ConfettiButton";function cn({width:e,height:t,numberOfPieces:n=200,confettiSource:r,initialVelocityX:i,initialVelocityY:o,recycle:a=!0,run:s=!0,gravity:c=.3,wind:l=0,opacity:u=1,drawShape:p,tweenDuration:f=100,colors:h,onConfettiComplete:F,frameRate:w}){let{fire:A}=j(),g=(0,T.useRef)(null),y=(0,T.useRef)(!1);return(0,T.useEffect)(()=>{if(!s){g.current&&(g.current.stop(),g.current=null),y.current=!1;return}if(y.current)return;y.current=!0;let d=r?{type:"rect",x:r.x,y:r.y,w:r.w??window.innerWidth,h:r.h??10}:{type:"rect",x:0,y:0,w:e??window.innerWidth,h:10},x=typeof i=="number"?[i*.5,i*1.5]:i?[i.min,i.max]:[4,10],D=typeof o=="number"?[o*.5,o*1.5]:o?[o.min,o.max]:[10,30],R=(e??window.innerWidth)/2,H=0;return g.current=A({x:R,y:H},{particleCount:n,particle:{colors:h??["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff"],opacity:[u*.8,u],shapes:["square","circle","rectangle"],drawShape:p},physics:{gravity:c*10,wind:l*5,windVariation:x[1]-x[0]},direction:{velocity:D},mode:"continuous",spawnArea:d,continuous:{recycle:a,numberOfPieces:n,spawnRate:30,run:s,tweenDuration:f},canvas:{width:e,height:t,frameRate:w,autoResize:!e&&!t},onComplete:F}),()=>{g.current&&(g.current.stop(),g.current=null)}},[s,e,t,n,r,i,o,a,c,l,u,p,f,h,F,w,A]),(0,T.useEffect)(()=>{g.current},[a]),null}cn.displayName="Confetti";
17
+ `,document.body.appendChild(t),t}E(){if(typeof ResizeObserver>"u"){this.C=!0,window.addEventListener("resize",this.v);return}this.o=new ResizeObserver(this.v),this.p?this.o.observe(document.body):this.canvas.parentElement&&this.o.observe(this.canvas.parentElement)}I(){let t=fe();if(this.p){let n=document.documentElement.clientWidth,r=document.documentElement.clientHeight;this.canvas.width=n*t,this.canvas.height=r*t,this.canvas.style.width=`${n}px`,this.canvas.style.height=`${r}px`}else{let n=this.canvas.getBoundingClientRect();this.canvas.width=n.width*t,this.canvas.height=n.height*t}this.ctx.setTransform(t,0,0,t,0,0)}};var Ae=class{constructor(){this.e=[];this.P=[];this.u=[];this.s=null}addUpdater(t){this.e.some(n=>n.id===t.id)||this.e.push(t)}addMover(t){this.P.some(n=>n.id===t.id)||this.P.push(t)}addShapeDrawer(t){te.register(t)}getUpdaters(){return Object.freeze([...this.e])}getMovers(){return Object.freeze([...this.P])}getShapeDrawer(t){return te.get(t)}createContainer(t){let n=new U(t);return this.u.push(n),n}getDefaultContainer(){return(!this.s||this.s.destroyed)&&(this.s=new U,this.u.push(this.s)),this.s}destroyAll(){for(let t of this.u)t.destroy();this.u.length=0,this.s=null}get containerCount(){return this.u.length}},rt=null;function it(){return rt||(rt=new Ae),rt}var pe=new Map;function Nt(e,t){let n=pe.get(e);if(!n||n.destroyed){let r=e==="default"?{resize:!0,...t}:{canvas:e,resize:t?.resize??!1,...t};n=new U(r),pe.set(e,n)}return n}function kt(e){return{particleCount:e.particleCount??100,size:e.size??4,angle:e.angle??90,spread:e.spread??45,startVelocity:e.startVelocity??45,decay:e.decay??.94,gravity:e.gravity??1,drift:e.drift??0,flat:e.flat??!1,ticks:e.ticks??200,origin:e.origin??{x:.5,y:.5},colors:e.colors??void 0,shapes:e.shapes??void 0,scalar:e.scalar??1}}function O(e={}){if(e.disableForReducedMotion&&ee())return Promise.resolve();try{return Nt("default").fire(kt(e))}catch{return null}}O.create=function(e,t={}){let n=Nt(e,t),r=(i={})=>{if((i.disableForReducedMotion??t.disableForReducedMotion)&&ee())return Promise.resolve();try{return n.fire(kt(i))}catch{return null}};return r.reset=()=>{n.stop()},r};O.reset=function(){let e=pe.get("default");e&&!e.destroyed&&e.stop()};O.fireworks=async function(e={}){let t={particleCount:30,spread:55,...e},n=O({...t,angle:60,origin:{x:0,y:.65}}),r=O({...t,angle:120,origin:{x:1,y:.65}}),i=[];n&&i.push(n),r&&i.push(r),i.length>0&&await Promise.all(i)};O.schoolPride=function(e={}){let t=Date.now()+3e3,n=e.colors??["#bb0000","#ffffff"],r=null,i=!1;function o(){i||(O({particleCount:2,angle:60,spread:55,origin:{x:0,y:.6},colors:n,...e}),O({particleCount:2,angle:120,spread:55,origin:{x:1,y:.6},colors:n,...e}),Date.now()<t&&!i&&(r=requestAnimationFrame(o)))}return o(),{cancel(){i=!0,r!==null&&(cancelAnimationFrame(r),r=null)}}};O.snow=function(e={}){let{duration:t=5e3,...n}=e,r=Date.now()+t,i=null,o=!1;function a(){o||(O({particleCount:1,startVelocity:0,ticks:300,gravity:.3,origin:{x:C(),y:0},colors:["#ffffff","#f0f8ff","#e6f3ff"],shapes:["circle"],scalar:.8+C()*.4,drift:C()-.5,...n}),Date.now()<r&&!o&&(i=requestAnimationFrame(a)))}return a(),{cancel(){o=!0,i!==null&&(cancelAnimationFrame(i),i=null)}}};O.burst=function(e,t={}){return O({particleCount:80,spread:360,startVelocity:30,decay:.92,scalar:1.2,origin:e,...t})};O.destroyAll=function(){for(let e of pe.values())e.destroyed||e.destroy();pe.clear(),it().destroyAll()};O.getShapes=function(){return["square","circle","star","triangle","rectangle","diamond","heart","hexagon"]};var ot={rainbow:$,pride:["#E40303","#FF8C00","#FFED00","#008026","#24408E","#732982"],christmas:["#C41E3A","#165B33","#FFD700","#FFFFFF","#BB2528"],halloween:["#FF6600","#000000","#8B008B","#00FF00","#FFD700"],pastel:["#FFB3BA","#FFDFBA","#FFFFBA","#BAFFC9","#BAE1FF"],neon:["#FF00FF","#00FFFF","#FF0080","#80FF00","#FF8000"],gold:["#FFD700","#DAA520","#B8860B","#FFC125","#FFDF00"],silver:["#C0C0C0","#A8A8A8","#D3D3D3","#DCDCDC","#E8E8E8"],hearts:["#FF69B4","#FF1493","#FF007F","#DC143C","#FFB6C1"],ocean:["#006994","#00CED1","#20B2AA","#48D1CC","#87CEEB"]},G={celebration:["🎉","🎊","🥳","✨","🎈"],hearts:["❤️","💕","💖","💗","💓","💘"],stars:["⭐","🌟","✨","💫","⚡"],money:["💰","💵","💸","🤑","💎"],christmas:["🎄","🎅","🎁","❄️","⭐"],halloween:["🎃","👻","🦇","🕷️","💀"],birthday:["🎂","🎁","🎈","🎉","🥳"],food:["🍕","🍔","🍟","🌭","🍿"]},Re={default:{name:"default",description:"Default balanced confetti burst with realistic paper physics",options:{particleCount:60,particle:{shapes:["square","rectangle","circle"],size:[6,14],depth3D:.6,tilt:[-30,30]},physics:{gravity:.25,drag:.035,wobble:!0,wobbleSpeed:1.5}}},celebration:{name:"celebration",description:"Big celebration with lots of colorful confetti and realistic movement",options:{particleCount:120,particle:{colors:[...$],shapes:["square","rectangle","circle","star"],size:[8,16],lifespan:5e3,depth3D:.7,tilt:[-35,35]},direction:{direction:"radial",spread:360,velocity:[30,55]},physics:{gravity:.22,drag:.04,wobble:!0,wobbleSpeed:2,windVariation:.03}}},firework:{name:"firework",description:"Firework-style explosion with secondary bursts",options:{mode:"firework",particleCount:80,particle:{colors:[...ot.neon],shapes:["circle","star"],size:[4,8],trail:{enabled:!0,length:8,fade:.6},glow:{enabled:!0,blur:8,intensity:.7}},firework:{secondaryExplosions:!0,burstCount:80}}},snow:{name:"snow",description:"Gentle falling snowflakes",options:{mode:"snow",particleCount:150,particle:{colors:["#FFFFFF","#F0F8FF","#E0FFFF"],shapes:["circle"],size:[3,8],lifespan:8e3,opacity:[.6,1]},physics:{gravity:.05,wind:.3,windVariation:.2,wobble:!0,wobbleSpeed:2},continuous:{recycle:!0,numberOfPieces:150}}},rain:{name:"rain",description:"Rainfall effect",options:{mode:"rain",particleCount:200,particle:{colors:["#6CA0DC","#4A90D9","#2E7BB9"],shapes:["line"],size:[2,4],lifespan:2e3},physics:{gravity:.8,wind:.1},direction:{direction:"down",spread:10,velocity:[30,50]},continuous:{recycle:!0}}},sparkle:{name:"sparkle",description:"Sparkling stars with glow effect",options:{particleCount:40,particle:{colors:["#FFD700","#DAA520","#B8860B","#FFC125","#FFDF00"],shapes:["star"],size:[6,12],glow:{enabled:!0,blur:15,intensity:.8}},physics:{gravity:.1},direction:{direction:"radial",spread:360,velocity:[30,60]}}},confetti:{name:"confetti",description:"Classic confetti falling with realistic paper flutter",options:{mode:"continuous",particleCount:200,particle:{shapes:["square","rectangle"],size:[6,14],depth3D:.8,tilt:[-40,40],lifespan:6e3},physics:{gravity:.18,drag:.045,wind:.08,windVariation:.04,wobble:!0,wobbleSpeed:2},continuous:{recycle:!0,numberOfPieces:200},spawnArea:{x:0,y:0,width:1920,height:0}}},emoji:{name:"emoji",description:"Emoji celebration",options:{particleCount:30,particle:{images:G.celebration.map(e=>({src:e,isEmoji:!0,scale:1.5})),size:[20,30],lifespan:4e3},direction:{direction:"up",spread:60,velocity:[20,35]}}},hearts:{name:"hearts",description:"Floating hearts",options:{particleCount:50,particle:{colors:["#FF69B4","#FF1493","#FF007F","#DC143C","#FFB6C1"],shapes:["heart"],size:[12,20],lifespan:5e3},physics:{gravity:-.1,wobble:!0},direction:{direction:"up",spread:90,velocity:[10,20]}}},stars:{name:"stars",description:"Shooting stars",options:{particleCount:60,particle:{colors:["#FFD700","#FFFFFF"],shapes:["star"],size:[8,16],trail:{enabled:!0,length:12,fade:.4}},direction:{direction:"radial",spread:360,velocity:[30,60]}}},money:{name:"money",description:"Money rain",options:{particleCount:40,particle:{colors:["#85BB65","#228B22","#32CD32"],images:G.money.map(e=>({src:e,isEmoji:!0})),size:[20,30],lifespan:4e3},physics:{gravity:.15,wobble:!0}}},pride:{name:"pride",description:"Pride rainbow celebration",options:{particleCount:100,particle:{colors:[...ot.pride],shapes:["square","rectangle","heart"],size:[10,16]},direction:{direction:"radial",spread:360,velocity:[25,45]}}},christmas:{name:"christmas",description:"Christmas celebration",options:{particleCount:80,particle:{colors:["#C41E3A","#165B33","#FFD700","#FFFFFF","#BB2528"],shapes:["star","circle"],size:[8,14],images:G.christmas.map(e=>({src:e,isEmoji:!0}))}}},halloween:{name:"halloween",description:"Spooky Halloween",options:{particleCount:60,particle:{colors:["#FF6600","#000000","#8B008B","#00FF00","#FFD700"],shapes:["circle","star"],images:G.halloween.map(e=>({src:e,isEmoji:!0})),size:[15,25]},physics:{gravity:.2,wobble:!0}}},newYear:{name:"newYear",description:"New Year celebration with fireworks",options:{mode:"firework",particleCount:100,particle:{colors:["#FFD700","#DAA520","#B8860B","#FFC125","#FFDF00","#C0C0C0","#A8A8A8"],shapes:["star","circle"],size:[6,12],trail:{enabled:!0,length:10},glow:{enabled:!0,blur:12}},firework:{secondaryExplosions:!0,burstCount:100}}},birthday:{name:"birthday",description:"Birthday party celebration",options:{particleCount:80,particle:{colors:["#FFB3BA","#FFDFBA","#FFFFBA","#BAFFC9","#BAE1FF","#E40303","#FF8C00","#FFED00","#008026","#24408E","#732982"],shapes:["star","circle","heart"],images:G.birthday.map(e=>({src:e,isEmoji:!0})),size:[12,20],lifespan:5e3},direction:{direction:"up",spread:80,velocity:[25,45]}}}};function En(e){let t=Re[e];if(!t)throw new Error(`Preset "${e}" not found. Available presets: ${Object.keys(Re).join(", ")}`);return t}function An(){return Object.keys(Re)}function Rn(e){let t={};if(e.particleCount!==void 0&&(t.particleCount=e.particleCount),e.particle?.colors&&(t.colors=e.particle.colors),e.particle?.shapes&&(t.shapes=e.particle.shapes),e.particle?.size){let n=e.particle.size;Array.isArray(n)&&(t.size=(n[0]+n[1])/2)}if(e.physics?.gravity!==void 0&&(t.gravity=e.physics.gravity),e.physics?.wind!==void 0&&(t.drift=e.physics.wind),e.direction?.spread!==void 0&&(t.spread=e.direction.spread),e.direction?.direction){let n=e.direction.direction;n==="custom"&&e.direction.angle!==void 0?t.angle=e.direction.angle:n!=="radial"&&n!=="custom"&&(t.angle=j[n]),n==="radial"&&t.spread===void 0&&(t.spread=360)}if(e.direction?.velocity){let n=e.direction.velocity;Array.isArray(n)&&(t.startVelocity=(n[0]+n[1])/2)}return e.scalar!==void 0&&(t.scalar=e.scalar),e.flat!==void 0&&(t.flat=e.flat),e.drift!==void 0&&(t.drift=e.drift),e.ticks!==void 0&&(t.ticks=e.ticks),e.zIndex!==void 0&&(t.zIndex=e.zIndex),t}function Ht(e){let{path:t,matrix:n,fillColor:r,strokeColor:i,strokeWidth:o}=e,a=Sn(t);return{type:"path",path:t,matrix:n?[...n]:void 0,fillColor:r,strokeColor:i,strokeWidth:o,bounds:a}}function at(e){let{text:t,scalar:n=1,color:r,fontFamily:i="serif",fontWeight:o="normal",fontStyle:a="normal"}=e;return{type:"text",text:t,scalar:n,color:r,fontFamily:i,fontWeight:String(o),fontStyle:a}}async function zt(e){let{src:t,width:n,height:r,scalar:i=1}=e;if(typeof t!="string")return{type:"image",src:t.src,image:t,scalar:i,width:n,height:r};let o=await On(t);return{type:"image",src:t,image:o,scalar:i,width:n,height:r}}function Ut(e,t={}){return e.map(n=>at({...t,text:n}))}function Sn(e){let t=e.match(/-?\d*\.?\d+/g);if(!t||t.length<2)return{minX:-1,minY:-1,maxX:1,maxY:1};let n=1/0,r=1/0,i=-1/0,o=-1/0;for(let a=0;a<t.length-1;a+=2){let s=parseFloat(t[a]),l=parseFloat(t[a+1]);!isNaN(s)&&!isNaN(l)&&(n=Math.min(n,s),r=Math.min(r,l),i=Math.max(i,s),o=Math.max(o,l))}return isFinite(n)?{minX:n,minY:r,maxX:i,maxY:o}:{minX:-1,minY:-1,maxX:1,maxY:1}}function On(e){return new Promise((t,n)=>{let r=new Image;r.crossOrigin="anonymous",r.onload=()=>t(r),r.onerror=()=>n(new Error(`Failed to load image: ${e}`)),r.src=e})}
@@ -0,0 +1,9 @@
1
+ "use strict";var ReactConfettiBurst=(()=>{var L=Object.defineProperty;var ye=Object.getOwnPropertyDescriptor;var Pe=Object.getOwnPropertyNames;var we=Object.prototype.hasOwnProperty;var _e=(n,e)=>{for(var r in e)L(n,r,{get:e[r],enumerable:!0})},Re=(n,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Pe(e))!we.call(n,i)&&i!==r&&L(n,i,{get:()=>e[i],enumerable:!(t=ye(e,i))||t.enumerable});return n};var Te=n=>Re(L({},"__esModule",{value:!0}),n);var Se={};_e(Se,{confetti:()=>u,default:()=>Me});var ie={DEG_TO_RAD:Math.PI/180,RAD_TO_DEG:180/Math.PI,TWO_PI:Math.PI*2,HALF_PI:Math.PI/2};function g(){if(typeof crypto<"u"&&crypto.getRandomValues){let n=new Uint32Array(1);return crypto.getRandomValues(n),n[0]/4294967296}return Math.random()}function h(n,e,r){return Math.min(Math.max(n,e),r)}function C(n){return n*ie.DEG_TO_RAD}var ae=1e3/60;function s(){return g()}function N(n,e){let r=Math.max(0,n-e),t=r/ae;return Object.freeze({value:r,factor:t})}function oe(n){if(typeof n!="string"||n.length>50)return null;let e=n.trim().toLowerCase();if(e.startsWith("#")){let t=e.slice(1);if(!/^[0-9a-f]+$/.test(t))return null;let i,o,a,l=255;if(t.length===3)i=parseInt(t[0]+t[0],16),o=parseInt(t[1]+t[1],16),a=parseInt(t[2]+t[2],16);else if(t.length===6)i=parseInt(t.slice(0,2),16),o=parseInt(t.slice(2,4),16),a=parseInt(t.slice(4,6),16);else if(t.length===8)i=parseInt(t.slice(0,2),16),o=parseInt(t.slice(2,4),16),a=parseInt(t.slice(4,6),16),l=parseInt(t.slice(6,8),16);else return null;return{r:i,g:o,b:a,a:l/255}}let r=e.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)$/);return r?{r:h(parseInt(r[1],10),0,255),g:h(parseInt(r[2],10),0,255),b:h(parseInt(r[3],10),0,255),a:r[4]!==void 0?h(parseFloat(r[4]),0,1):1}:null}function U(n,e){let r=oe(n);if(!r)return n;let{r:t,g:i,b:o,a}=r,l=h(t+e,0,255),c=h(i+e,0,255),d=h(o+e,0,255);return a<1?`rgba(${Math.round(l)}, ${Math.round(c)}, ${Math.round(d)}, ${a})`:`rgb(${Math.round(l)}, ${Math.round(c)}, ${Math.round(d)})`}function b(){if(typeof window>"u")return!1;try{return window.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1}catch{return!1}}var Oe=0;function v(){return++Oe}function _(n){if(n.length===0)return;let e=Math.floor(s()*n.length);return n[e]}function R(n){return typeof requestAnimationFrame<"u"?requestAnimationFrame(n):setTimeout(n,ae)}function k(n){typeof cancelAnimationFrame<"u"?cancelAnimationFrame(n):clearTimeout(n)}function y(){return typeof window>"u"?1:Math.min(window.devicePixelRatio||1,2)}var se=Object.freeze(["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"]),Ee=Object.freeze(["square","circle"]),T=Math.PI*2,x=class n{constructor(e,r,t,i,o,a,l,c,d,f,O,w,E,M,S,F,z){this.id=e,this.position=r,this.velocity=t,this.angle2D=i,this.gravity=o,this.drift=a,this.decay=l,this.wobble=c,this.tilt=d,this.roll=f,this.rotate=O,this.color=w,this.shape=E,this.size=M,this.scalar=S,this.flat=F,this.tick=0,this.totalTicks=z,this.destroyed=!1,this.opacity=1}static create(e,r,t={}){let{angle:i=90,spread:o=45,startVelocity:a=45,decay:l=.94,gravity:c=1,drift:d=0,flat:f=!1,ticks:O=200,origin:w={x:.5,y:.5},colors:E=se,shapes:M=Ee,scalar:S=1,size:F=4}=t,z={x:w.x*e,y:w.y*r},fe=C(i),ne=C(o),pe=-fe+(.5*ne-s()*ne),he=a*.5+s()*a,me={angle:s()*T,angleSpeed:s()*.1+.05,moveSpeed:-15+s()*30,distance:25+s()*15},ge={value:s()*T,sinDirection:s()>=.5?1:-1,cosDirection:s()>=.5?1:-1,speed:(s()*.4+.3)*(s()>.5?1:-1),enable:!f},be={angle:s()*T,speed:(15+s()*10)/60,horizontal:s()>.3,vertical:s()>.7,enable:!f},Ie={angle:s()*T,speed:(s()*2-1)*.1,enable:!f},Ce=_(E)??se[0],ve=_(M)??"square";return new n(v(),z,he,pe,c*3,d,l,me,ge,be,Ie,Ce,ve,F,S,f,O)}get progress(){return this.tick/this.totalTicks}get computedSize(){return this.size*this.scalar}destroy(){this.destroyed=!0}clone(e){let r=Object.create(n.prototype);return Object.assign(r,this,e),r}},A=class{constructor(e=1e3){this.pool=[];this.maxSize=e}acquire(e,r,t){let i=this.pool.pop();return i?this.resetParticle(i,e,r,t):x.create(e,r,t)}release(e){this.pool.length<this.maxSize&&(e.destroyed=!0,this.pool.push(e))}clear(){this.pool.length=0}get size(){return this.pool.length}resetParticle(e,r,t,i){let o=x.create(r,t,i);return Object.assign(e,o,{id:e.id}),e.destroyed=!1,e}};var p=Math.PI*2,B=class{constructor(){this.id="base"}init(e){}isEnabled(e){return!e.destroyed}update(e,r){if(e.destroyed)return;let t=Math.cos(e.angle2D)*e.velocity,i=Math.sin(e.angle2D)*e.velocity;e.position.x+=t*r.factor+e.drift*r.factor,e.position.y+=i*r.factor+e.gravity*r.factor,e.velocity*=e.decay,e.tick++,e.tick>=e.totalTicks&&(e.destroyed=!0)}},H=class{constructor(){this.id="wobble"}init(e){e.wobble||(e.wobble={angle:s()*p,angleSpeed:s()*.1+.05,moveSpeed:-15+s()*30,distance:25+s()*15})}isEnabled(e){return!e.destroyed&&!e.flat&&!!e.wobble}update(e,r){if(!this.isEnabled(e))return;let t=e.wobble;t.angle+=t.angleSpeed*r.factor,t.angle>p&&(t.angle-=p);let i=Math.cos(t.angle)*t.distance*.1;e.position.x+=i*r.factor}},G=class{constructor(){this.id="tilt"}init(e){e.tilt||(e.tilt={value:s()*p,sinDirection:s()>=.5?1:-1,cosDirection:s()>=.5?1:-1,speed:(s()*.4+.3)*(s()>.5?1:-1),enable:!e.flat})}isEnabled(e){return!e.destroyed&&e.tilt?.enable===!0}update(e,r){if(!this.isEnabled(e))return;let t=e.tilt;t.value+=t.speed*.01*r.factor,t.value>p?t.value-=p:t.value<0&&(t.value+=p)}getTransformValues(e){if(!e.tilt?.enable)return{};let r=e.tilt;return{b:Math.cos(r.value)*r.cosDirection*.5,c:Math.sin(r.value)*r.sinDirection*.5}}},V=class{constructor(){this.id="roll"}init(e){e.roll||(e.roll={angle:s()*p,speed:(15+s()*10)/60,horizontal:s()>.3,vertical:s()>.7,enable:!e.flat})}isEnabled(e){return!e.destroyed&&e.roll?.enable===!0}update(e,r){if(!this.isEnabled(e))return;let t=e.roll;t.angle+=t.speed*r.factor,t.angle>p&&(t.angle-=p)}getTransformValues(e){if(!e.roll?.enable)return{};let r=e.roll;return{a:r.horizontal?Math.abs(Math.cos(r.angle)):void 0,d:r.vertical?Math.abs(Math.sin(r.angle)):void 0}}getDarkenAmount(e){if(!e.roll?.enable)return 0;let r=e.roll;return!r.horizontal&&!r.vertical?0:(r.horizontal?Math.cos(r.angle):Math.sin(r.angle))<0?25:0}},q=class{constructor(){this.id="rotate"}init(e){e.rotate||(e.rotate={angle:s()*p,speed:(s()*2-1)*.1,enable:!e.flat})}isEnabled(e){return!e.destroyed&&e.rotate?.enable===!0}update(e,r){if(!this.isEnabled(e))return;let t=e.rotate;t.angle+=t.speed*r.factor,t.angle>p?t.angle-=p:t.angle<0&&(t.angle+=p)}},$=class{constructor(){this.id="opacity"}init(e){e.opacity=1}isEnabled(e){return!e.destroyed}update(e,r){if(!this.isEnabled(e))return;let t=e.tick/e.totalTicks;e.opacity=1-Math.pow(t,2)}};function le(){return[new B,new H,new G,new V,new q,new $]}var ce=Math.PI*2,W=class{constructor(){this.type="circle"}draw(e,r,t){let i=r.flat?1:.6+Math.sin(r.wobble.angle)*.4;e.ellipse(0,0,t*i,t*(1-i*.3),r.tilt?.value??0,0,ce)}},Y=class{constructor(){this.type="square"}draw(e,r,t){let i=r.flat?0:Math.sin(r.wobble.angle)*t*.3;e.moveTo(-t+i,-t),e.lineTo(t+i,-t*.5),e.lineTo(t-i,t),e.lineTo(-t-i,t*.5)}},j=class{constructor(){this.type="rectangle"}draw(e,r,t){let i=t*1.5,o=t*.6,a=r.flat?0:Math.sin(r.wobble.angle)*o*.2;e.moveTo(-i+a,-o),e.lineTo(i+a,-o*.5),e.lineTo(i-a,o),e.lineTo(-i-a,o*.5)}},X=class{constructor(){this.type="star"}draw(e,r,t){let i=t,o=t*.5,a=5,l=Math.PI/a,c=-Math.PI/2;e.moveTo(0,-i);for(let d=0;d<a;d++)e.lineTo(Math.cos(c)*i,Math.sin(c)*i),c+=l,e.lineTo(Math.cos(c)*o,Math.sin(c)*o),c+=l}},Z=class{constructor(){this.type="triangle"}draw(e,r,t){let i=t*Math.sqrt(3)/2;e.moveTo(0,-i),e.lineTo(-t,i),e.lineTo(t,i)}},K=class{constructor(){this.type="diamond"}draw(e,r,t){e.moveTo(0,-t),e.lineTo(t*.6,0),e.lineTo(0,t),e.lineTo(-t*.6,0)}},J=class{constructor(){this.type="heart"}draw(e,r,t){let o=-t*.3,a=t*.3;e.moveTo(0,o+a),e.bezierCurveTo(0-t,o,0-t,o-a*2,0,o-a),e.bezierCurveTo(0+t,o-a*2,0+t,o,0,o+a)}},Q=class{constructor(){this.type="hexagon"}draw(e,r,t){let o=ce/6;for(let a=0;a<6;a++){let l=o*a-Math.PI/2,c=Math.cos(l)*t,d=Math.sin(l)*t;a===0?e.moveTo(c,d):e.lineTo(c,d)}}},ee=class{constructor(){this.drawers=new Map;this.register(new W),this.register(new Y),this.register(new j),this.register(new X),this.register(new Z),this.register(new K),this.register(new J),this.register(new Q)}register(e){this.drawers.set(e.type,e)}get(e){return this.drawers.get(e)}has(e){return this.drawers.has(e)}getTypes(){return Array.from(this.drawers.keys())}unregister(e){return this.drawers.delete(e)}clear(){this.drawers.clear()}},I=new ee;var m=class{constructor(e={}){this.destroyed=!1;this._particles=[];this._animationId=null;this._lastTimestamp=0;this._resolvePromise=null;this._isOwnCanvas=!1;this._resizeObserver=null;this._usesWindowResize=!1;this._animate=e=>{if(this.destroyed)return;let r=N(e,this._lastTimestamp);this._lastTimestamp=e;let t=y();this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.ctx.scale(t,t);let i=!1,o=[];for(let a=0;a<this._particles.length;a++){let l=this._particles[a];if(l.destroyed){o.push(a);continue}for(let c of this._updaters)c.isEnabled(l)&&c.update(l,r);if(l.destroyed){o.push(a);continue}i=!0,this._drawParticle(l)}for(let a=o.length-1;a>=0;a--){let l=o[a],c=this._particles[l];this._pool.release(c),this._particles.splice(l,1)}i?this._animationId=R(this._animate):(this._animationId=null,this._resolvePromise?.(),this._resolvePromise=null)};this._handleResize=()=>{this._updateCanvasSize()};this.id=`confetti-${v()}`,this._options={canvas:e.canvas,resize:e.resize??!0,zIndex:e.zIndex??100,disableForReducedMotion:e.disableForReducedMotion??!1},e.canvas?this.canvas=e.canvas:(this.canvas=this._createCanvas(),this._isOwnCanvas=!0);let r=this.canvas.getContext("2d",{alpha:!0,desynchronized:!0});if(!r)throw new Error("Failed to get 2D canvas context");this.ctx=r,this._updaters=le(),this._pool=new A(500),this._options.resize&&this._setupResizeHandling(),this._updateCanvasSize()}get particles(){return this._particles}async fire(e={}){if(this._options.disableForReducedMotion&&b())return Promise.resolve();if(this.destroyed)throw new Error("Cannot fire on destroyed container");let r=e.particleCount??100,t=y(),i=this.canvas.width/t,o=this.canvas.height/t;for(let a=0;a<r;a++){let l=this._pool.acquire(i,o,e);for(let c of this._updaters)c.init(l);this._particles.push(l)}return this._animationId?new Promise(a=>{let l=this._resolvePromise;this._resolvePromise=()=>{l?.(),a()}}):new Promise(a=>{this._resolvePromise=a,this._lastTimestamp=performance.now(),this._animationId=R(this._animate)})}stop(){this._animationId&&(k(this._animationId),this._animationId=null);for(let e of this._particles)this._pool.release(e);this._particles.length=0,this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this._resolvePromise?.(),this._resolvePromise=null}reset(){this.stop(),this._pool.clear()}destroy(){this.destroyed||(this.stop(),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null),this._usesWindowResize&&(window.removeEventListener("resize",this._handleResize),this._usesWindowResize=!1),this._isOwnCanvas&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.destroyed=!0)}_drawParticle(e){let r=this.ctx,t=e.size*e.scalar,i={a:1,b:0,c:0,d:1};for(let d of this._updaters)if(d.getTransformValues){let f=d.getTransformValues(e);f.a!==void 0&&(i.a=f.a),f.b!==void 0&&(i.b=f.b),f.c!==void 0&&(i.c=f.c),f.d!==void 0&&(i.d=f.d)}let a=this._updaters.find(d=>d.id==="roll")?.getDarkenAmount(e)??0,l=a>0?U(e.color,-a):e.color;r.save(),r.translate(e.position.x,e.position.y),r.rotate(e.rotate?.angle??0),r.transform(i.a??1,i.b??0,i.c??0,i.d??1,0,0),r.fillStyle=l,r.globalAlpha=e.opacity,r.beginPath();let c=I.get(e.shape);c?c.draw(r,e,t):I.get("square")?.draw(r,e,t),r.closePath(),r.fill(),r.restore()}_createCanvas(){let e=document.createElement("canvas");return e.id=this.id,e.style.cssText=`
2
+ position: fixed;
3
+ top: 0;
4
+ left: 0;
5
+ width: 100%;
6
+ height: 100%;
7
+ pointer-events: none;
8
+ z-index: ${this._options.zIndex};
9
+ `,document.body.appendChild(e),e}_setupResizeHandling(){if(typeof ResizeObserver>"u"){this._usesWindowResize=!0,window.addEventListener("resize",this._handleResize);return}this._resizeObserver=new ResizeObserver(this._handleResize),this._isOwnCanvas?this._resizeObserver.observe(document.body):this.canvas.parentElement&&this._resizeObserver.observe(this.canvas.parentElement)}_updateCanvasSize(){let e=y();if(this._isOwnCanvas){let r=document.documentElement.clientWidth,t=document.documentElement.clientHeight;this.canvas.width=r*e,this.canvas.height=t*e,this.canvas.style.width=`${r}px`,this.canvas.style.height=`${t}px`}else{let r=this.canvas.getBoundingClientRect();this.canvas.width=r.width*e,this.canvas.height=r.height*e}this.ctx.setTransform(e,0,0,e,0,0)}};var D=class{constructor(){this._updaters=[];this._movers=[];this._containers=[];this._defaultContainer=null}addUpdater(e){this._updaters.some(r=>r.id===e.id)||this._updaters.push(e)}addMover(e){this._movers.some(r=>r.id===e.id)||this._movers.push(e)}addShapeDrawer(e){I.register(e)}getUpdaters(){return Object.freeze([...this._updaters])}getMovers(){return Object.freeze([...this._movers])}getShapeDrawer(e){return I.get(e)}createContainer(e){let r=new m(e);return this._containers.push(r),r}getDefaultContainer(){return(!this._defaultContainer||this._defaultContainer.destroyed)&&(this._defaultContainer=new m,this._containers.push(this._defaultContainer)),this._defaultContainer}destroyAll(){for(let e of this._containers)e.destroy();this._containers.length=0,this._defaultContainer=null}get containerCount(){return this._containers.length}},te=null;function re(){return te||(te=new D),te}var P=new Map;function de(n,e){let r=P.get(n);if(!r||r.destroyed){let t=n==="default"?{resize:!0,...e}:{canvas:n,resize:e?.resize??!1,...e};r=new m(t),P.set(n,r)}return r}function ue(n){return{particleCount:n.particleCount??100,size:n.size??4,angle:n.angle??90,spread:n.spread??45,startVelocity:n.startVelocity??45,decay:n.decay??.94,gravity:n.gravity??1,drift:n.drift??0,flat:n.flat??!1,ticks:n.ticks??200,origin:n.origin??{x:.5,y:.5},colors:n.colors??void 0,shapes:n.shapes??void 0,scalar:n.scalar??1}}function u(n={}){if(n.disableForReducedMotion&&b())return Promise.resolve();try{return de("default").fire(ue(n))}catch{return null}}u.create=function(n,e={}){let r=de(n,e),t=(i={})=>{if((i.disableForReducedMotion??e.disableForReducedMotion)&&b())return Promise.resolve();try{return r.fire(ue(i))}catch{return null}};return t.reset=()=>{r.stop()},t};u.reset=function(){let n=P.get("default");n&&!n.destroyed&&n.stop()};u.fireworks=async function(n={}){let e={particleCount:30,spread:55,...n},r=u({...e,angle:60,origin:{x:0,y:.65}}),t=u({...e,angle:120,origin:{x:1,y:.65}}),i=[];r&&i.push(r),t&&i.push(t),i.length>0&&await Promise.all(i)};u.schoolPride=function(n={}){let e=Date.now()+3e3,r=n.colors??["#bb0000","#ffffff"],t=null,i=!1;function o(){i||(u({particleCount:2,angle:60,spread:55,origin:{x:0,y:.6},colors:r,...n}),u({particleCount:2,angle:120,spread:55,origin:{x:1,y:.6},colors:r,...n}),Date.now()<e&&!i&&(t=requestAnimationFrame(o)))}return o(),{cancel(){i=!0,t!==null&&(cancelAnimationFrame(t),t=null)}}};u.snow=function(n={}){let{duration:e=5e3,...r}=n,t=Date.now()+e,i=null,o=!1;function a(){o||(u({particleCount:1,startVelocity:0,ticks:300,gravity:.3,origin:{x:g(),y:0},colors:["#ffffff","#f0f8ff","#e6f3ff"],shapes:["circle"],scalar:.8+g()*.4,drift:g()-.5,...r}),Date.now()<t&&!o&&(i=requestAnimationFrame(a)))}return a(),{cancel(){o=!0,i!==null&&(cancelAnimationFrame(i),i=null)}}};u.burst=function(n,e={}){return u({particleCount:80,spread:360,startVelocity:30,decay:.92,scalar:1.2,origin:n,...e})};u.destroyAll=function(){for(let n of P.values())n.destroyed||n.destroy();P.clear(),re().destroyAll()};u.getShapes=function(){return["square","circle","star","triangle","rectangle","diamond","heart","hexagon"]};var Me=u;return Te(Se);})();
package/dist/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var Ie=["#FF6B6B","#4ECDC4","#FFE66D","#95E1D3","#F38181","#AA96DA","#FCBAD3","#A8D8EA","#FF9A8B","#88D8B0"],ue={gravity:1,drag:.035,friction:.99,rotationSpeed:1,wind:0,windVariation:.02,tumble:!0,decay:.99,bounce:0,floor:null,wobble:!0,wobbleSpeed:1.5,flutter:!0,flutterSpeed:2.5,flutterIntensity:.4,airResistance:.03,swayAmplitude:15,swayFrequency:2},de={direction:"up",spread:55,velocity:[25,50],velocityDecay:.92},fe={colors:Ie,shapes:["square","rectangle","circle"],size:[6,14],opacity:[.85,1],lifespan:4e3,fadeOut:!0,scaleDown:!1,spin:!0,spinSpeed:[-15,15],tilt:[-30,30],depth3D:.6,aspectRatio:[.5,1.5],shimmer:!0},q={enabled:!1,length:10,fade:.5,width:.5},Te={enabled:!1,blur:10,color:null,intensity:.5},Ke={recycle:!1,numberOfPieces:200,spawnRate:50,run:!0,tweenDuration:5e3},Qe={secondaryExplosions:!0,burstCount:80,burstDelay:500,spread:360,launchHeight:.6,rocketColors:["#ffd700","#ff6b35","#ff0000"],burstColors:["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff"],trailLength:10,riseDuration:1e3,showRocket:!0},xe={width:null,height:null,autoResize:!0,resizeDebounce:100,frameRate:null,pixelRatio:null,useWorker:!1,useOffscreen:!1};var B={particleCount:50,particle:fe,physics:ue,direction:de,mode:"burst",easing:"easeOut",zIndex:9999,autoCleanup:!0,scalar:1,drift:0,flat:!1},Re={up:90,down:270,left:180,right:0},R={DEG_TO_RAD:Math.PI/180,RAD_TO_DEG:180/Math.PI,TWO_PI:Math.PI*2,HALF_PI:Math.PI/2},xt={linear:e=>e,easeIn:e=>e*e*e,easeOut:e=>1-Math.pow(1-e,3),easeInOut:e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2,bounce:e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,elastic:e=>{let t=2*Math.PI/3;return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e*10-.75)*t)+1},back:e=>1+2.70158*Math.pow(e-1,3)+1.70158*Math.pow(e-1,2),circ:e=>Math.sqrt(1-Math.pow(e-1,2)),expo:e=>e===1?1:1-Math.pow(2,-10*e)};var te={r:0,g:0,b:0,a:0},V={MAX_PARTICLES:500,FRAME_BUDGET:16.67,MIN_OPACITY:.01,MIN_SIZE:.5,MAX_DPR:2},et=100,Ee=5,tt=.5,O={rainbow:Ie,pride:["#E40303","#FF8C00","#FFED00","#008026","#24408E","#732982"],christmas:["#C41E3A","#165B33","#FFD700","#FFFFFF","#BB2528"],halloween:["#FF6600","#000000","#8B008B","#00FF00","#FFD700"],pastel:["#FFB3BA","#FFDFBA","#FFFFBA","#BAFFC9","#BAE1FF"],neon:["#FF00FF","#00FFFF","#FF0080","#80FF00","#FF8000"],gold:["#FFD700","#DAA520","#B8860B","#FFC125","#FFDF00"],silver:["#C0C0C0","#A8A8A8","#D3D3D3","#DCDCDC","#E8E8E8"],hearts:["#FF69B4","#FF1493","#FF007F","#DC143C","#FFB6C1"],ocean:["#006994","#00CED1","#20B2AA","#48D1CC","#87CEEB"]},ee={celebration:["🎉","🎊","🥳","✨","🎈"],hearts:["❤️","💕","💖","💗","💓","💘"],stars:["⭐","🌟","✨","💫","⚡"],money:["💰","💵","💸","🤑","💎"],christmas:["🎄","🎅","🎁","❄️","⭐"],halloween:["🎃","👻","🦇","🕷️","💀"],birthday:["🎂","🎁","🎈","🎉","🥳"],food:["🍕","🍔","🍟","🌭","🍿"]},fn={default:{name:"default",description:"Default balanced confetti burst with realistic paper physics",options:{particleCount:60,particle:{shapes:["square","rectangle","circle"],size:[6,14],depth3D:.6,tilt:[-30,30]},physics:{gravity:.25,drag:.035,wobble:!0,wobbleSpeed:1.5}}},celebration:{name:"celebration",description:"Big celebration with lots of colorful confetti and realistic movement",options:{particleCount:120,particle:{colors:[...O.rainbow],shapes:["square","rectangle","circle","star"],size:[8,16],lifespan:5e3,depth3D:.7,tilt:[-35,35]},direction:{direction:"radial",spread:360,velocity:[30,55]},physics:{gravity:.22,drag:.04,wobble:!0,wobbleSpeed:2,windVariation:.03}}},firework:{name:"firework",description:"Firework-style explosion with secondary bursts",options:{mode:"firework",particleCount:80,particle:{colors:[...O.neon],shapes:["circle","star"],size:[4,8],trail:{enabled:!0,length:8,fade:.6},glow:{enabled:!0,blur:8,intensity:.7}},firework:{secondaryExplosions:!0,burstCount:80}}},snow:{name:"snow",description:"Gentle falling snowflakes",options:{mode:"snow",particleCount:150,particle:{colors:["#FFFFFF","#F0F8FF","#E0FFFF"],shapes:["circle"],size:[3,8],lifespan:8e3,opacity:[.6,1]},physics:{gravity:.05,wind:.3,windVariation:.2,wobble:!0,wobbleSpeed:2},continuous:{recycle:!0,numberOfPieces:150}}},rain:{name:"rain",description:"Rainfall effect",options:{mode:"rain",particleCount:200,particle:{colors:["#6CA0DC","#4A90D9","#2E7BB9"],shapes:["line"],size:[2,4],lifespan:2e3},physics:{gravity:.8,wind:.1},direction:{direction:"down",spread:10,velocity:[30,50]},continuous:{recycle:!0}}},sparkle:{name:"sparkle",description:"Sparkling stars with glow effect",options:{particleCount:40,particle:{colors:[...O.gold],shapes:["star"],size:[6,12],glow:{enabled:!0,blur:15,intensity:.8}},physics:{gravity:.1}}},confetti:{name:"confetti",description:"Classic confetti falling with realistic paper flutter",options:{mode:"continuous",particleCount:200,particle:{shapes:["square","rectangle"],size:[6,14],depth3D:.8,tilt:[-40,40],lifespan:6e3},physics:{gravity:.18,drag:.045,wind:.08,windVariation:.04,wobble:!0,wobbleSpeed:2},continuous:{recycle:!0,numberOfPieces:200},spawnArea:{x:0,y:0,width:typeof window<"u"?window.innerWidth:1920,height:0}}},emoji:{name:"emoji",description:"Emoji celebration",options:{particleCount:30,particle:{images:ee.celebration.map(e=>({src:e,isEmoji:!0,scale:1.5})),size:[20,30],lifespan:4e3},direction:{direction:"up",spread:60,velocity:[20,35]}}},hearts:{name:"hearts",description:"Floating hearts",options:{particleCount:50,particle:{colors:[...O.hearts],shapes:["heart"],size:[12,20],lifespan:5e3},physics:{gravity:-.1,wobble:!0},direction:{direction:"up",spread:90,velocity:[10,20]}}},stars:{name:"stars",description:"Shooting stars",options:{particleCount:60,particle:{colors:[...O.gold,"#FFFFFF"],shapes:["star"],size:[8,16],trail:{enabled:!0,length:12,fade:.4}},direction:{direction:"radial",spread:360,velocity:[30,60]}}},money:{name:"money",description:"Money rain",options:{particleCount:40,particle:{colors:["#85BB65","#228B22","#32CD32"],images:ee.money.map(e=>({src:e,isEmoji:!0})),size:[20,30],lifespan:4e3},physics:{gravity:.15,wobble:!0}}},pride:{name:"pride",description:"Pride rainbow celebration",options:{particleCount:100,particle:{colors:[...O.pride],shapes:["square","rectangle","heart"],size:[10,16]},direction:{direction:"radial",spread:360,velocity:[25,45]}}},christmas:{name:"christmas",description:"Christmas celebration",options:{particleCount:80,particle:{colors:[...O.christmas],shapes:["star","circle"],size:[8,14],images:ee.christmas.map(e=>({src:e,isEmoji:!0}))}}},halloween:{name:"halloween",description:"Spooky Halloween",options:{particleCount:60,particle:{colors:[...O.halloween],shapes:["circle","star"],images:ee.halloween.map(e=>({src:e,isEmoji:!0})),size:[15,25]},physics:{gravity:.2,wobble:!0}}},newYear:{name:"newYear",description:"New Year celebration with fireworks",options:{mode:"firework",particleCount:100,particle:{colors:[...O.gold,...O.silver],shapes:["star","circle"],size:[6,12],trail:{enabled:!0,length:10},glow:{enabled:!0,blur:12}},firework:{secondaryExplosions:!0,burstCount:100}}},birthday:{name:"birthday",description:"Birthday party celebration",options:{particleCount:80,particle:{colors:[...O.pastel,...O.rainbow],shapes:["star","circle","heart"],images:ee.birthday.map(e=>({src:e,isEmoji:!0})),size:[12,20],lifespan:5e3},direction:{direction:"up",spread:80,velocity:[25,45]}}}};function C(){if(typeof crypto<"u"&&crypto.getRandomValues){let e=new Uint32Array(1);return crypto.getRandomValues(e),e[0]/4294967296}return Math.random()}function m(e,t){return e+C()*(t-e)}function Rt(e,t){return Math.floor(m(e,t+1))}function ne(e){if(e.length===0)throw new Error("Cannot pick from empty array");return e[Math.floor(C()*e.length)]}function _(e,t,n){return Math.min(Math.max(e,t),n)}function Et(e,t,n){return e+(t-e)*_(n,0,1)}function S(e){return e*R.DEG_TO_RAD}function Ft(e){return e*R.RAD_TO_DEG}function re(e){if(typeof e=="object"&&"r"in e)return{r:_(Math.round(e.r),0,255),g:_(Math.round(e.g),0,255),b:_(Math.round(e.b),0,255),a:_(e.a,0,1)};if(typeof e=="object"&&"type"in e)return re(e.colors[0]);let t=e.trim().toLowerCase();return t.startsWith("#")?At(t):t.startsWith("rgb")?Dt(t):St(t)}function At(e){let t=e.slice(1),n,r,i,o=1;switch(t.length){case 3:n=parseInt(t[0]+t[0],16),r=parseInt(t[1]+t[1],16),i=parseInt(t[2]+t[2],16);break;case 4:n=parseInt(t[0]+t[0],16),r=parseInt(t[1]+t[1],16),i=parseInt(t[2]+t[2],16),o=parseInt(t[3]+t[3],16)/255;break;case 6:n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16);break;case 8:n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16),o=parseInt(t.slice(6,8),16)/255;break;default:return te}return isNaN(n)||isNaN(r)||isNaN(i)||isNaN(o)?te:{r:n,g:r,b:i,a:o}}function Dt(e){let t=e.match(/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/);return t?{r:_(parseInt(t[1],10),0,255),g:_(parseInt(t[2],10),0,255),b:_(parseInt(t[3],10),0,255),a:t[4]!==void 0?_(parseFloat(t[4]),0,1):1}:te}function St(e){let t={red:{r:255,g:0,b:0,a:1},green:{r:0,g:128,b:0,a:1},blue:{r:0,g:0,b:255,a:1},white:{r:255,g:255,b:255,a:1},black:{r:0,g:0,b:0,a:1},yellow:{r:255,g:255,b:0,a:1},cyan:{r:0,g:255,b:255,a:1},magenta:{r:255,g:0,b:255,a:1},orange:{r:255,g:165,b:0,a:1},purple:{r:128,g:0,b:128,a:1},pink:{r:255,g:192,b:203,a:1}};if(t[e])return t[e];if(typeof document<"u")try{let n=document.createElement("canvas");n.width=1,n.height=1;let r=n.getContext("2d");if(r){r.fillStyle=e,r.fillRect(0,0,1,1);let i=r.getImageData(0,0,1,1).data;return{r:i[0],g:i[1],b:i[2],a:i[3]/255}}}catch{}return te}function ie(e){return`rgba(${e.r}, ${e.g}, ${e.b}, ${e.a})`}function pe(e,t){if(e==="custom"&&t!==void 0)return S(t);if(e==="radial")return C()*R.TWO_PI;let n=Re[e];return S(n??90)}function Mt(e){let t=e.getBoundingClientRect();return{x:t.left+t.width/2,y:t.top+t.height/2}}function Fe(e){if(!e)return B;let t={...fe,...e.particle},n={...ue,...e.physics},r={...de,...e.direction};return{particleCount:e.particleCount??B.particleCount,particle:t,physics:n,direction:r,mode:e.mode??B.mode,spawnArea:e.spawnArea?{type:"rect",x:0,y:0,...e.spawnArea}:void 0,continuous:e.continuous,firework:e.firework,canvas:e.canvas,easing:e.easing??B.easing,zIndex:e.zIndex??B.zIndex,autoCleanup:e.autoCleanup??B.autoCleanup,scalar:e.scalar??B.scalar,drift:e.drift??B.drift,flat:e.flat??B.flat,onStart:e.onStart,onComplete:e.onComplete,onFrame:e.onFrame,onParticleCreate:e.onParticleCreate,onParticleDeath:e.onParticleDeath}}function $(){return typeof window<"u"&&typeof document<"u"}function nt(e=2){return $()?Math.min(window.devicePixelRatio||1,e):1}function rt(){let e,t;return{promise:new Promise((r,i)=>{e=r,t=i}),resolve:e,reject:t}}var Ot=0;function j(e,t,n,r,i,o,a,s,c,l,u){let p=m(a[0],a[1]),f=m(s[0],s[1]),h=ne(i),E=typeof h=="string"?re(h):"type"in h?re(h.colors[0]):h,v=1+(C()-.5)*.3,F=Math.cos(n)*r*v,g=-Math.sin(n)*r*v,w;u?.images&&u.images.length>0&&(w=ne(u.images));let d=u?.tiltRange??[-30,30],T=u?.spinSpeedRange??[-15,15],A=u?.aspectRatioRange??[.5,1.5],x=m(A[0],A[1]);return{id:Ot++,x:e,y:t,vx:F,vy:g,size:p,originalSize:p,rotation:C()*R.TWO_PI,rotationSpeed:(C()-.5)*.3*l,color:E,shape:w?"custom":ne(o),opacity:f,originalOpacity:f,life:c,maxLife:c,active:!0,image:w,imageElement:null,trail:[],wobblePhase:C()*R.TWO_PI,wobbleSpeed:m(.8,2.5),tilt:S(m(d[0],d[1])),tiltSpeed:m(T[0],T[1])*.015,depth:u?.depth3D??.6,hasExploded:!1,data:{},flutterPhase:C()*R.TWO_PI,flutterSpeed:m(1.5,3.5),swayPhase:C()*R.TWO_PI,aspectRatio:x,angularVelocity:(C()-.5)*.4,scaleX:1,scaleY:1,shimmerPhase:C()*R.TWO_PI,currentDrag:m(.02,.05)}}function it(e,t,n,r,i,o,a){if(!e.active)return;let s=t*.05988;if(o?.enabled??q.enabled){let P=e.trail;P.unshift({x:e.x,y:e.y,opacity:e.opacity,size:e.size});let M=o?.length??q.length;P.length>M&&P.pop()}let c=e.vx,l=e.vy,u=e.tilt,p=c*c+l*l,f=u-u*u*u*.166667,h=1+f*.15;if(l+=n.gravity*h*s,(n.flutter??!0)&&p>1){let P=n.flutterSpeed??2.5,M=n.flutterIntensity??.4;e.flutterPhase+=P*.05*s;let L=e.flutterPhase,ce=(L-L*L*L*.166667)*M*s,It=1-u*u*.5;if(c+=ce*It,(f<0?-f:f)>.7){let Tt=ce<0?-ce:ce;l-=Tt*.3}}let v=n.swayAmplitude??15,F=n.swayFrequency??2;e.swayPhase+=F*.03*s;let g=e.swayPhase,w=(g-g*g*g*.166667)*v*.01*s;c+=w;let d=n.windVariation,T=n.wind+d*(Math.random()-.5);c+=T*s;let A=n.airResistance??.03,x=1-u*u*.5,z=x<0?-x:x,G=n.drag+z*A,k=p>0?Math.sqrt(p):0,W=Math.max(.9,1-G*k*.01)*n.friction*n.decay;if(c*=W,l*=W,e.x+=c*s,e.y+=l*s,e.vx=c,e.vy=l,n.tumble&&(e.angularVelocity=(e.angularVelocity+c*.001*s)*.98,e.rotation+=(e.rotationSpeed+e.angularVelocity)*s),e.tiltSpeed=(e.tiltSpeed+(Math.random()-.5)*.002*s)*.995,e.tilt=(e.tilt+e.tiltSpeed*s)%R.TWO_PI,n.wobble){let P=e.wobblePhase+n.wobbleSpeed*.1*s;e.wobblePhase=P;let M=1-P*P*.5,L=P-P*P*P*.166667;e.scaleX=.3+.7*(M<0?-M:M),e.scaleY=.3+.7*(L<0?-L:L)}if(e.shimmerPhase+=.1*s,n.floor!==null&&n.bounce>0&&a){let P=n.floor??a,M=e.size*.5;e.y+M>=P&&(e.y=P-M,e.vy=-e.vy*n.bounce,e.vx*=.85,e.rotationSpeed+=(Math.random()-.5)*.1)}e.life-=t;let Je=1-e.life/e.maxLife;if(r){let P=Je,M=P*P*(3-2*P);e.opacity=e.originalOpacity*(1-M*.9)}i&&(e.size=e.originalSize*(1-Je*.5)),(e.life<=0||e.opacity<V.MIN_OPACITY||e.size<V.MIN_SIZE)&&(e.active=!1)}function ot(e,t,n){if(!t.active)return;let{x:r,y:i,size:o,rotation:a,color:s,shape:c,opacity:l,tilt:u,aspectRatio:p,scaleX:f,scaleY:h,shimmerPhase:E}=t;if(l<.02)return;let v=n?.trailConfig,F=n?.glowConfig;(v?.enabled??q.enabled)&&t.trail.length>0&&Bt(e,t,v??q),e.save();let g=F?.enabled??Te.enabled;g&&(e.shadowBlur=F?.blur??Te.blur,e.shadowColor=F?.color??ie(s)),e.translate(r,i),e.rotate(a+u),t.depth>0&&e.scale(f,h);let d=1+(E-Math.floor(E))*.3-.15,T=.7+.3*(f*h<0?-(f*h):f*h),A=l*s.a*T*(g?F?.intensity??1:1);if(A<.02){e.restore();return}e.globalAlpha=A>1?1:A;let x=s.r*d,z=s.g*d,G=s.b*d;if(e.fillStyle=`rgb(${x>255?255:x},${z>255?255:z},${G>255?255:G})`,t.image&&t.image.isEmoji)qt(e,t.image.src,o*(t.image.scale??1));else if(t.imageElement)Gt(e,t.imageElement,o*(t.image?.scale??1));else if(c==="custom"&&n?.customDraw){let k={ctx:e,particle:t,progress:1-t.life/t.maxLife,elapsed:n.elapsed??0};n.customDraw(k)}else{let k=p??1;switch(c){case"square":case"rectangle":let Q=o*(c==="rectangle"?Math.max(1.5,k*1.5):Math.sqrt(k)),W=o/(c==="rectangle"?Math.max(1.5,k):Math.sqrt(k));e.fillRect(-Q*.5,-W*.5,Q,W);break;case"circle":e.beginPath(),e.arc(0,0,o*.5,0,R.TWO_PI),e.fill();break;case"triangle":kt(e,o);break;case"star":_t(e,o);break;case"line":zt(e,o);break;case"heart":Lt(e,o);break;case"diamond":Ht(e,o);break;case"hexagon":Nt(e,o);break;case"spiral":Ut(e,o,s);break;case"ribbon":Wt(e,o);break;default:e.fillRect(-o*.5,-o*.5,o,o)}}e.restore()}function Bt(e,t,n){let r=n.fade??q.fade,i=n.width??q.width;e.save(),e.lineCap="round",e.lineJoin="round";for(let o=0;o<t.trail.length-1;o++){let a=t.trail[o],s=t.trail[o+1],c=a.opacity*Math.pow(r,o),l=a.size*i*Math.pow(r,o);c>.01&&l>.1&&(e.beginPath(),e.strokeStyle=ie({...t.color,a:c}),e.lineWidth=l,e.moveTo(a.x,a.y),e.lineTo(s.x,s.y),e.stroke())}e.restore()}function kt(e,t){let n=t/2;e.beginPath(),e.moveTo(0,-n),e.lineTo(n,n),e.lineTo(-n,n),e.closePath(),e.fill()}function _t(e,t){let n=t/2,r=n*tt,i=Math.PI/Ee;e.beginPath();for(let o=0;o<Ee*2;o++){let a=o%2===0?n:r,s=o*i-R.HALF_PI,c=Math.cos(s)*a,l=Math.sin(s)*a;o===0?e.moveTo(c,l):e.lineTo(c,l)}e.closePath(),e.fill()}function zt(e,t){let n=t*2,r=t/4;e.fillRect(-n/2,-r/2,n,r)}function Lt(e,t){let n=t/30;e.save(),e.scale(n,n),e.beginPath(),e.moveTo(0,-8),e.bezierCurveTo(-10,-18,-25,-8,-15,5),e.lineTo(0,18),e.lineTo(15,5),e.bezierCurveTo(25,-8,10,-18,0,-8),e.closePath(),e.fill(),e.restore()}function Ht(e,t){let n=t/2;e.beginPath(),e.moveTo(0,-n),e.lineTo(n*.6,0),e.lineTo(0,n),e.lineTo(-n*.6,0),e.closePath(),e.fill()}function Nt(e,t){let n=t/2;e.beginPath();for(let r=0;r<6;r++){let i=Math.PI/3*r-Math.PI/6,o=Math.cos(i)*n,a=Math.sin(i)*n;r===0?e.moveTo(o,a):e.lineTo(o,a)}e.closePath(),e.fill()}function Ut(e,t,n){e.strokeStyle=ie(n),e.lineWidth=t/8,e.lineCap="round",e.beginPath();for(let r=0;r<22;r++){let i=.35*r,o=(.2+1.5*i)*(t/20),a=o*Math.cos(i),s=o*Math.sin(i);r===0?e.moveTo(a,s):e.lineTo(a,s)}e.stroke()}function Wt(e,t){let n=t,r=t/3,i=t/4;e.beginPath(),e.moveTo(-n/2,0),e.quadraticCurveTo(-n/4,-i,0,0),e.quadraticCurveTo(n/4,i,n/2,0),e.lineTo(n/2,r),e.quadraticCurveTo(n/4,r+i,0,r),e.quadraticCurveTo(-n/4,r-i,-n/2,r),e.closePath(),e.fill()}function qt(e,t,n){e.font=`${n}px serif`,e.textAlign="center",e.textBaseline="middle",e.fillText(t,0,0)}function Gt(e,t,n){let r=n/2;e.drawImage(t,-r,-r,n,n)}function at(e){return e.filter(t=>t.active).length}var b=null,H=null,Y=0,oe=null,st=[],Vt=500;function lt(e){st.length<Vt&&(e.active=!1,e.trail.length=0,st.push(e))}var Ae=360,$t=new Float32Array(Ae),jt=new Float32Array(Ae);for(let e=0;e<Ae;e++){let t=e*Math.PI/180;$t[e]=Math.sin(t),jt[e]=Math.cos(t)}function Yt(e,t){if(!$())throw new Error("ConfettiEngine requires a browser environment");let n={...xe,...t},r=n.pixelRatio??nt(V.MAX_DPR);if(!b){if(b=document.createElement("canvas"),b.style.cssText=`
1
+ var J=["#FF6B6B","#4ECDC4","#FFE66D","#95E1D3","#F38181","#AA96DA","#FCBAD3","#A8D8EA","#FF9A8B","#88D8B0"],le={gravity:1,drag:.035,friction:.99,rotationSpeed:1,wind:0,windVariation:.02,tumble:!0,decay:.99,bounce:0,floor:null,wobble:!0,wobbleSpeed:1.5,flutter:!0,flutterSpeed:2.5,flutterIntensity:.4,airResistance:.03,swayAmplitude:15,swayFrequency:2},ce={direction:"up",spread:55,velocity:[25,50],velocityDecay:.92},ue={colors:J,shapes:["square","rectangle","circle"],size:[6,14],opacity:[.85,1],lifespan:4e3,fadeOut:!0,scaleDown:!1,spin:!0,spinSpeed:[-15,15],tilt:[-30,30],depth3D:.6,aspectRatio:[.5,1.5],shimmer:!0},N={enabled:!1,length:10,fade:.5,width:.5},de={enabled:!1,blur:10,color:null,intensity:.5},xe={recycle:!1,numberOfPieces:200,spawnRate:50,run:!0,tweenDuration:5e3},Ee={secondaryExplosions:!0,burstCount:80,burstDelay:500,spread:360,launchHeight:.6,rocketColors:["#ffd700","#ff6b35","#ff0000"],burstColors:["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff"],trailLength:10,riseDuration:1e3,showRocket:!0},fe={width:null,height:null,autoResize:!0,resizeDebounce:100,frameRate:null,pixelRatio:null,useWorker:!1,useOffscreen:!1},At={disableForReducedMotion:!1,ariaLabel:"Confetti animation",ariaHidden:!0},_={particleCount:50,particle:ue,physics:le,direction:ce,mode:"burst",easing:"easeOut",zIndex:9999,autoCleanup:!0,scalar:1,drift:0,flat:!1},Q={up:90,down:270,left:180,right:0},v={DEG_TO_RAD:Math.PI/180,RAD_TO_DEG:180/Math.PI,TWO_PI:Math.PI*2,HALF_PI:Math.PI/2},x={SIN_TAYLOR_COEFF:.166667,COS_TAYLOR_COEFF:.5,FLUTTER_PHASE_SCALE:.05,SWAY_PHASE_SCALE:.03,SWAY_FORCE_SCALE:.01,GRAVITY_TILT_MODIFIER:.15,FLUTTER_AIR_CATCH_THRESHOLD:.7,FLUTTER_AIR_CATCH_MULTIPLIER:.3,ORIENTATION_OPACITY_BASE:.7,ORIENTATION_OPACITY_SCALE:.3,SHIMMER_RANGE:.3,SHIMMER_OFFSET:.15,MIN_OPACITY_THRESHOLD:.02,MIN_SIZE_THRESHOLD:.1,VELOCITY_VARIATION_RANGE:.3,ANGULAR_DAMPING:.98,TILT_DAMPING:.995};var ee={r:0,g:0,b:0,a:0},Ae={MAX_PARTICLES:500,FRAME_BUDGET:16.67,MIN_OPACITY:.01,MIN_SIZE:.5,MAX_DPR:2},rt=100,Re=5,it=.5;var Rt={linear:e=>e,easeIn:e=>e*e*e,easeOut:e=>1-Math.pow(1-e,3),easeInOut:e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2,bounce:e=>e<.36363636363636365?7.5625*e*e:e<.7272727272727273?7.5625*(e-=.5454545454545454)*e+.75:e<.9090909090909091?7.5625*(e-=.8181818181818182)*e+.9375:7.5625*(e-=.9545454545454546)*e+.984375,elastic:e=>{let t=2*Math.PI/3;return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e*10-.75)*t)+1},back:e=>1+2.70158*Math.pow(e-1,3)+1.70158*Math.pow(e-1,2),circ:e=>Math.sqrt(1-Math.pow(e-1,2)),expo:e=>e===1?1:1-Math.pow(2,-10*e)};function C(){if(typeof crypto<"u"&&crypto.getRandomValues){let e=new Uint32Array(1);return crypto.getRandomValues(e),e[0]/4294967296}return Math.random()}function b(e,t){return e+C()*(t-e)}function St(e,t){return Math.floor(b(e,t+1))}function te(e){if(e.length===0)throw new Error("Cannot pick from empty array");return e[Math.floor(C()*e.length)]}function T(e,t,n){return Math.min(Math.max(e,t),n)}function Se(e,t,n){return e+(t-e)*T(n,0,1)}function E(e){return e*v.DEG_TO_RAD}function Oe(e){return e*v.RAD_TO_DEG}function ne(e){if(typeof e=="object"&&"r"in e)return{r:T(Math.round(e.r),0,255),g:T(Math.round(e.g),0,255),b:T(Math.round(e.b),0,255),a:T(e.a,0,1)};if(typeof e=="object"&&"type"in e)return ne(e.colors[0]);let t=e.trim().toLowerCase();return t.startsWith("#")?Ot(t):t.startsWith("rgb")?Dt(t):Mt(t)}function Ot(e){let t=e.slice(1),n,r,i,o=1;switch(t.length){case 3:n=parseInt(t[0]+t[0],16),r=parseInt(t[1]+t[1],16),i=parseInt(t[2]+t[2],16);break;case 4:n=parseInt(t[0]+t[0],16),r=parseInt(t[1]+t[1],16),i=parseInt(t[2]+t[2],16),o=parseInt(t[3]+t[3],16)/255;break;case 6:n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16);break;case 8:n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16),o=parseInt(t.slice(6,8),16)/255;break;default:return ee}return isNaN(n)||isNaN(r)||isNaN(i)||isNaN(o)?ee:{r:n,g:r,b:i,a:o}}function Dt(e){let t=e.match(/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/);return t?{r:T(parseInt(t[1],10),0,255),g:T(parseInt(t[2],10),0,255),b:T(parseInt(t[3],10),0,255),a:t[4]!==void 0?T(parseFloat(t[4]),0,1):1}:ee}var ot=new Map;function Mt(e){let t={red:{r:255,g:0,b:0,a:1},green:{r:0,g:128,b:0,a:1},blue:{r:0,g:0,b:255,a:1},white:{r:255,g:255,b:255,a:1},black:{r:0,g:0,b:0,a:1},yellow:{r:255,g:255,b:0,a:1},cyan:{r:0,g:255,b:255,a:1},magenta:{r:255,g:0,b:255,a:1},orange:{r:255,g:165,b:0,a:1},purple:{r:128,g:0,b:128,a:1},pink:{r:255,g:192,b:203,a:1}};if(t[e])return t[e];let n=ot.get(e);if(n)return n;if(typeof document<"u")try{let r=document.createElement("canvas");r.width=1,r.height=1;let i=r.getContext("2d");if(i){i.fillStyle=e,i.fillRect(0,0,1,1);let o=i.getImageData(0,0,1,1).data,a={r:o[0],g:o[1],b:o[2],a:o[3]/255};return ot.set(e,a),a}}catch{}return ee}function re(e){return`rgba(${e.r}, ${e.g}, ${e.b}, ${e.a})`}function pe(e,t){if(e==="custom"&&t!==void 0)return E(t);if(e==="radial")return C()*v.TWO_PI;let n=Q[e];return E(n??90)}function _t(e){let t=e.getBoundingClientRect();return{x:t.left+t.width/2,y:t.top+t.height/2}}function De(e){if(!e)return _;let t={...ue,...e.particle},n={...le,...e.physics},r={...ce,...e.direction};return{particleCount:e.particleCount??_.particleCount,particle:t,physics:n,direction:r,mode:e.mode??_.mode,spawnArea:e.spawnArea?{type:"rect",x:0,y:0,...e.spawnArea}:void 0,continuous:e.continuous,firework:e.firework,canvas:e.canvas,easing:e.easing??_.easing,zIndex:e.zIndex??_.zIndex,autoCleanup:e.autoCleanup??_.autoCleanup,scalar:e.scalar??_.scalar,drift:e.drift??_.drift,flat:e.flat??_.flat,onStart:e.onStart,onComplete:e.onComplete,onFrame:e.onFrame,onParticleCreate:e.onParticleCreate,onParticleDeath:e.onParticleDeath}}function G(){return typeof window<"u"&&typeof document<"u"}function at(e=2){return G()?Math.min(window.devicePixelRatio||1,e):1}function st(){let e,t;return{promise:new Promise((r,i)=>{e=r,t=i}),resolve:e,reject:t}}var Bt=0,lt=!1;function q(e,t,n,r,i,o,a,s,l,c,u){if(i.length===0)throw new Error("Colors array cannot be empty");if(o.length===0)throw new Error("Shapes array cannot be empty");if(a[0]>a[1])throw new Error("Invalid size range");if(s[0]>s[1])throw new Error("Invalid opacity range");let m=b(a[0],a[1]),p=b(s[0],s[1]),h=te(i),w=typeof h=="string"?ne(h):"type"in h?ne(h.colors[0]):h,F=1+(C()-.5)*x.VELOCITY_VARIATION_RANGE,A=Math.cos(n)*r*F,P=-Math.sin(n)*r*F,I;u?.images&&u.images.length>0&&(I=te(u.images));let f=u?.tiltRange??[-30,30],R=u?.spinSpeedRange??[-15,15],d=u?.aspectRatioRange??[.5,1.5],O=b(d[0],d[1]);return{id:Bt++,x:e,y:t,vx:A,vy:P,size:m,originalSize:m,rotation:C()*v.TWO_PI,rotationSpeed:(C()-.5)*.3*c,color:w,shape:I?"custom":te(o),opacity:p,originalOpacity:p,life:l,maxLife:l,active:!0,image:I,imageElement:null,trail:[],wobblePhase:C()*v.TWO_PI,wobbleSpeed:b(.8,2.5),tilt:E(b(f[0],f[1])),tiltSpeed:b(R[0],R[1])*.015,depth:u?.depth3D??.6,hasExploded:!1,data:{},flutterPhase:C()*v.TWO_PI,flutterSpeed:b(1.5,3.5),swayPhase:C()*v.TWO_PI,aspectRatio:O,angularVelocity:(C()-.5)*.4,scaleX:1,scaleY:1,shimmerPhase:C()*v.TWO_PI,currentDrag:b(.02,.05)}}function ct(e,t,n,r,i,o,a){if(!e.active)return;let s=t*.059988;(o?.enabled??N.enabled)&&Lt(e,o??N),Nt(e,s,n),Vt(e,s,n),Yt(e,t,n,r,i),n.floor!==null&&n.bounce>0&&a&&Gt(e,n,a),(e.life<=0||e.opacity<x.MIN_OPACITY_THRESHOLD||e.size<x.MIN_SIZE_THRESHOLD)&&(e.active=!1)}function Lt(e,t){let n=e.trail;n.unshift({x:e.x,y:e.y,opacity:e.opacity,size:e.size});let r=t.length??N.length;n.length>r&&n.pop()}function Nt(e,t,n){let r=e.vx,i=e.vy,o=e.tilt,a=r*r+i*i;kt(e,i,o,n,t),i=e.vy,Ht(e,r,i,o,a,n,t),r=e.vx,i=e.vy,zt(e,r,n,t),r=e.vx,Ut(e,n,t),r=e.vx,Wt(e,r,i,o,a,n),r=e.vx,i=e.vy,e.x+=r*t,e.y+=i*t}function kt(e,t,n,r,i){let a=1+Math.sin(n)*x.GRAVITY_TILT_MODIFIER;e.vy=t+r.gravity*a*i}function Ht(e,t,n,r,i,o,a){if(!(o.flutter??!0)||i<=1)return;let l=o.flutterSpeed??2.5,c=o.flutterIntensity??.4;e.flutterPhase=(e.flutterPhase+l*x.FLUTTER_PHASE_SCALE*a)%v.TWO_PI;let u=e.flutterPhase,p=Math.sin(u)*c*a,h=Math.cos(r);e.vx=t+p*h;let w=Math.sin(r);if((w<0?-w:w)>x.FLUTTER_AIR_CATCH_THRESHOLD){let A=p<0?-p:p;e.vy=n-A*x.FLUTTER_AIR_CATCH_MULTIPLIER}}function zt(e,t,n,r){let i=n.swayAmplitude??15,o=n.swayFrequency??2;e.swayPhase=(e.swayPhase+o*x.SWAY_PHASE_SCALE*r)%v.TWO_PI;let a=e.swayPhase,s=Math.sin(a)*i*x.SWAY_FORCE_SCALE*r;e.vx=t+s}function Ut(e,t,n){let r=t.windVariation,i=t.wind+r*(C()-.5);e.vx+=i*n}function Wt(e,t,n,r,i,o){let a=o.airResistance??.03,s=Math.cos(r),l=s<0?-s:s,c=o.drag+l*a,u=i>0?Math.sqrt(i):0,p=Math.max(.9,1-c*u*.01)*o.friction*o.decay;e.vx=t*p,e.vy=n*p}function Vt(e,t,n){if(n.tumble&&(e.angularVelocity=(e.angularVelocity+e.vx*.001*t)*x.ANGULAR_DAMPING,e.rotation+=(e.rotationSpeed+e.angularVelocity)*t),e.tiltSpeed=(e.tiltSpeed+(C()-.5)*.002*t)*x.TILT_DAMPING,e.tilt=(e.tilt+e.tiltSpeed*t)%v.TWO_PI,n.wobble){e.wobblePhase=(e.wobblePhase+n.wobbleSpeed*.1*t)%v.TWO_PI;let r=e.wobblePhase,i=Math.cos(r),o=Math.sin(r);e.scaleX=.3+.7*(i<0?-i:i),e.scaleY=.3+.7*(o<0?-o:o)}e.shimmerPhase=(e.shimmerPhase+.1*t)%v.TWO_PI}function Yt(e,t,n,r,i){t>0&&(e.life-=t);let o=1-e.life/e.maxLife;if(r){let a=o,s=a*a*(3-2*a);e.opacity=e.originalOpacity*(1-s*.9)}i&&(e.size=e.originalSize*(1-o*.5))}function Gt(e,t,n){let r=t.floor??n,i=e.size*.5;e.y+i>=r&&(e.y=r-i,e.vy=-e.vy*t.bounce,e.vx*=.85,e.rotationSpeed+=(C()-.5)*.1)}function ut(e,t,n){if(!t.active)return;let{x:r,y:i,size:o,rotation:a,color:s,shape:l,opacity:c,tilt:u,aspectRatio:m,scaleX:p,scaleY:h,shimmerPhase:w}=t;if(c<x.MIN_OPACITY_THRESHOLD)return;let F=n?.trailConfig,A=n?.glowConfig;(F?.enabled??N.enabled)&&t.trail.length>0&&qt(e,t,F??N),e.save();let P=A?.enabled??de.enabled;P&&(e.shadowBlur=A?.blur??de.blur,e.shadowColor=A?.color??re(s)),e.translate(r,i),e.rotate(a+u),t.depth>0&&e.scale(p,h);let f=1+(w-Math.floor(w))*x.SHIMMER_RANGE-x.SHIMMER_OFFSET,R=x.ORIENTATION_OPACITY_BASE+x.ORIENTATION_OPACITY_SCALE*(p*h<0?-(p*h):p*h),d=c*s.a*R*(P?A?.intensity??1:1);if(d<x.MIN_OPACITY_THRESHOLD){e.restore();return}e.globalAlpha=d>1?1:d;let O=s.r*f,W=s.g*f,Y=s.b*f;if(e.fillStyle=`rgb(${O>255?255:O},${W>255?255:W},${Y>255?255:Y})`,t.image&&t.image.isEmoji)tn(e,t.image.src,o*(t.image.scale??1));else if(t.imageElement)nn(e,t.imageElement,o*(t.image?.scale??1));else if(l==="custom"&&n?.customDraw){let B={ctx:e,particle:t,progress:1-t.life/t.maxLife,elapsed:n.elapsed??0};try{n.customDraw(B)}catch{lt||(lt=!0)}}else{let B=m??1;switch(l){case"square":case"rectangle":let V=o*(l==="rectangle"?Math.max(1.5,B*1.5):Math.sqrt(B)),se=o/(l==="rectangle"?Math.max(1.5,B):Math.sqrt(B));e.fillRect(-V*.5,-se*.5,V,se);break;case"circle":e.beginPath(),e.arc(0,0,o*.5,0,v.TWO_PI),e.fill();break;case"triangle":$t(e,o);break;case"star":jt(e,o);break;case"line":Xt(e,o);break;case"heart":Zt(e,o);break;case"diamond":Kt(e,o);break;case"hexagon":Jt(e,o);break;case"spiral":Qt(e,o,s);break;case"ribbon":en(e,o);break;default:e.fillRect(-o*.5,-o*.5,o,o)}}e.restore()}function qt(e,t,n){let r=n.fade??N.fade,i=n.width??N.width;e.save(),e.lineCap="round",e.lineJoin="round";for(let o=0;o<t.trail.length-1;o++){let a=t.trail[o],s=t.trail[o+1],l=a.opacity*Math.pow(r,o),c=a.size*i*Math.pow(r,o);l>.01&&c>.1&&(e.beginPath(),e.strokeStyle=re({r:t.color.r,g:t.color.g,b:t.color.b,a:l}),e.lineWidth=c,e.moveTo(a.x,a.y),e.lineTo(s.x,s.y),e.stroke())}e.restore()}function $t(e,t){let n=t/2;e.beginPath(),e.moveTo(0,-n),e.lineTo(n,n),e.lineTo(-n,n),e.closePath(),e.fill()}function jt(e,t){let n=t/2,r=n*it,i=Math.PI/Re;e.beginPath();for(let o=0;o<Re*2;o++){let a=o%2===0?n:r,s=o*i-v.HALF_PI,l=Math.cos(s)*a,c=Math.sin(s)*a;o===0?e.moveTo(l,c):e.lineTo(l,c)}e.closePath(),e.fill()}function Xt(e,t){let n=t*2,r=t/4;e.fillRect(-n/2,-r/2,n,r)}function Zt(e,t){let n=t/30;e.save(),e.scale(n,n),e.beginPath(),e.moveTo(0,-8),e.bezierCurveTo(-10,-18,-25,-8,-15,5),e.lineTo(0,18),e.lineTo(15,5),e.bezierCurveTo(25,-8,10,-18,0,-8),e.closePath(),e.fill(),e.restore()}function Kt(e,t){let n=t/2;e.beginPath(),e.moveTo(0,-n),e.lineTo(n*.6,0),e.lineTo(0,n),e.lineTo(-n*.6,0),e.closePath(),e.fill()}function Jt(e,t){let n=t/2;e.beginPath();for(let r=0;r<6;r++){let i=Math.PI/3*r-Math.PI/6,o=Math.cos(i)*n,a=Math.sin(i)*n;r===0?e.moveTo(o,a):e.lineTo(o,a)}e.closePath(),e.fill()}function Qt(e,t,n){e.strokeStyle=re(n),e.lineWidth=t/8,e.lineCap="round",e.beginPath();for(let r=0;r<22;r++){let i=.35*r,o=(.2+1.5*i)*(t/20),a=o*Math.cos(i),s=o*Math.sin(i);r===0?e.moveTo(a,s):e.lineTo(a,s)}e.stroke()}function en(e,t){let n=t,r=t/3,i=t/4;e.beginPath(),e.moveTo(-n/2,0),e.quadraticCurveTo(-n/4,-i,0,0),e.quadraticCurveTo(n/4,i,n/2,0),e.lineTo(n/2,r),e.quadraticCurveTo(n/4,r+i,0,r),e.quadraticCurveTo(-n/4,r-i,-n/2,r),e.closePath(),e.fill()}function tn(e,t,n){e.font=`${n}px serif`,e.textAlign="center",e.textBaseline="middle",e.fillText(t,0,0)}function nn(e,t,n){let r=n/2;e.drawImage(t,-r,-r,n,n)}function dt(e){let t=0;for(let n=0;n<e.length;n++)e[n].active&&t++;return t}var y=null,H=null,$=0;var z=null,me=[],he=500;function rn(e){for(he=Math.max(1,Math.floor(e));me.length>he;)me.pop()}function on(){return he}function Me(e){me.length<he&&(e.active=!1,e.trail.length=0,me.push(e))}var _e=360,an=new Float32Array(_e),sn=new Float32Array(_e);for(let e=0;e<_e;e++){let t=e*Math.PI/180;an[e]=Math.sin(t),sn[e]=Math.cos(t)}function ln(e,t){if(!G())throw new Error("ConfettiEngine requires a browser environment");let n={...fe,...t},r=n.pixelRatio??at(Ae.MAX_DPR);if(!y){if(y=document.createElement("canvas"),y.style.cssText=`
2
2
  position: fixed;
3
3
  top: 0;
4
4
  left: 0;
@@ -6,7 +6,7 @@ var Ie=["#FF6B6B","#4ECDC4","#FFE66D","#95E1D3","#F38181","#AA96DA","#FCBAD3","#
6
6
  height: 100%;
7
7
  pointer-events: none;
8
8
  z-index: ${e};
9
- `,H=b.getContext("2d",{alpha:!0,desynchronized:!0}),!H)throw new Error("Failed to get canvas 2D context");document.body.appendChild(b),n.autoResize&&(oe=()=>{if(b&&H){let a=n.width??window.innerWidth,s=n.height??window.innerHeight;b.width=a*r,b.height=s*r,b.style.width=`${a}px`,b.style.height=`${s}px`,H.scale(r,r)}},window.addEventListener("resize",oe))}b.style.zIndex=String(e);let i=n.width??window.innerWidth,o=n.height??window.innerHeight;return(b.width!==i*r||b.height!==o*r)&&(b.width=i*r,b.height=o*r,b.style.width=`${i}px`,b.style.height=`${o}px`,H.scale(r,r)),{canvas:b,ctx:H,width:i,height:o,dpr:r}}function Xt(){b&&Y===0&&setTimeout(()=>{Y===0&&b&&(oe&&(window.removeEventListener("resize",oe),oe=null),b.remove(),b=null,H=null)},et)}function ct(e,t,n){let{type:r,x:i,y:o,w:a,h:s}=e;switch(r){case"point":return{x:i,y:o};case"rect":return{x:m(i,i+(a??0)),y:m(o,o+(s??0))};case"line":let c=C();return{x:i+c*(a??0),y:o+c*(s??0)};case"circle":let l=C()*R.TWO_PI,u=Math.sqrt(C())*(a??50);return{x:i+Math.cos(l)*u,y:o+Math.sin(l)*u};default:return{x:i,y:o}}}var he=class{constructor(t,n){this.particles=[];this.canvasContext=null;this.animationFrameId=null;this.lastFrameTime=0;this.lastSpawnTime=0;this.isRunning=!1;this.isPaused=!1;this.deferred=rt();this.frameInterval=0;this.lastRenderTime=0;this.animate=()=>{if(!this.isRunning||!this.canvasContext)return;if((this.mode==="continuous"||this.mode==="snow"||this.mode==="rain")&&!this.continuousConfig.run){this.animationFrameId=requestAnimationFrame(this.animate),this.lastFrameTime=performance.now();return}if(this.isPaused){this.animationFrameId=requestAnimationFrame(this.animate),this.lastFrameTime=performance.now();return}let t=performance.now(),n=t-this.lastFrameTime;if(this.lastFrameTime=t,this.frameInterval>0){if(t-this.lastRenderTime<this.frameInterval){this.animationFrameId=requestAnimationFrame(this.animate);return}this.lastRenderTime=t}let{ctx:r,width:i,height:o,dpr:a}=this.canvasContext,{physics:s,particle:c}=this.config;r.setTransform(1,0,0,1,0,0),r.clearRect(0,0,i*a,o*a),r.scale(a,a);let l=this.particles,u=l.length,p=0,f=!0,h=100,E=-h,v=i+h,F=-h,g=o+h;for(let w=0;w<u;w++){let d=l[w];if(d.active){if(it(d,n,s,c.fadeOut,c.scaleDown),d.data?.isRocket&&d.y<=d.data.targetY){d.active=!1,this.explodeFirework(d.x,d.y,d.data);continue}if(d.data?.willExplode&&!d.data.hasExploded&&d.vx*d.vx+d.vy*d.vy<1&&(d.data.hasExploded=!0,this.explodeFirework(d.x,d.y,{burstCount:15,spread:360,burstColors:d.data.burstColors})),d.x<E||d.x>v||d.y<F||d.y>g){(d.y>g||d.x<E-200||d.x>v+200)&&(d.active=!1);continue}ot(r,d,{customDraw:this.drawShape}),p++,f=!1}}if(this.mode==="continuous"||this.mode==="snow"||this.mode==="rain"){let w=t-this.lastSpawnTime,d=1e3/(this.continuousConfig.spawnRate??10);if(w>=d){if(this.continuousConfig.recycle){let A=this.continuousConfig.numberOfPieces-p;if(A>0){for(let x=u-1;x>=0&&A>0;x--)l[x].active||(lt(l[x]),l.splice(x,1));this.spawnParticles(Math.min(A,5))}}else p<this.continuousConfig.numberOfPieces&&this.spawnParticles(Math.min(3,this.continuousConfig.numberOfPieces-p));this.lastSpawnTime=t}}if(this.mode==="firework"){let w=0;for(let T=0;T<u;T++)l[T].active&&l[T].data?.isRocket&&w++;let d=t-this.lastSpawnTime;w===0&&d>=(this.fireworkConfig.burstDelay??500)&&(this.launchFirework(),this.lastSpawnTime=t)}if((this.mode==="burst"||this.mode==="cannon"||this.mode==="explosion")&&f){this.complete();return}this.animationFrameId=requestAnimationFrame(this.animate)};this.origin=t,this.config=Fe(n),this.mode=n?.mode??"burst",this.spawnArea=n?.spawnArea,this.continuousConfig={...Ke,...n?.continuous},this.fireworkConfig={...Qe,...n?.firework},this.canvasConfig={...xe,...n?.canvas},this.drawShape=n?.particle?.drawShape,this.canvasConfig.frameRate&&(this.frameInterval=1e3/this.canvasConfig.frameRate)}start(){if(this.isRunning)return this.createHandle();if(!$())return this.deferred.resolve(),this.createHandle();if(this.isRunning=!0,Y++,this.canvasContext=Yt(this.config.zIndex,this.canvasConfig),this.mode==="continuous"||this.mode==="snow"||this.mode==="rain"){let t=Math.min(this.continuousConfig.numberOfPieces,Math.floor(this.continuousConfig.numberOfPieces*.5));this.spawnParticles(t)}else this.mode==="firework"?this.launchFirework():this.createParticles();return this.config.onStart?.(),this.lastFrameTime=performance.now(),this.lastSpawnTime=performance.now(),this.lastRenderTime=performance.now(),this.animate(),this.createHandle()}createParticles(){let{particleCount:t,particle:n,direction:r,physics:i}=this.config,{x:o,y:a}=this.origin,s=Math.min(t,V.MAX_PARTICLES);for(let c=0;c<s;c++){let l;if(r.direction==="radial")l=C()*R.TWO_PI;else{let f=pe(r.direction,r.angle),h=S(r.spread);l=f+(C()-.5)*h}let u=m(r.velocity[0],r.velocity[1]),p=j(o,a,l,u,n.colors,n.shapes,n.size,n.opacity,n.lifespan,i.rotationSpeed,{images:n.images,tiltRange:n.tilt,spinSpeedRange:n.spinSpeed,depth3D:n.depth3D});this.particles.push(p)}}spawnParticles(t){if(!this.canvasContext)return;let{particle:n,physics:r}=this.config,{width:i,height:o}=this.canvasContext;for(let a=0;a<t;a++){let s;this.spawnArea?s=ct(this.spawnArea,i,o):this.mode==="snow"||this.mode==="rain"?s={x:m(0,i),y:-20}:s={x:m(0,i),y:m(-20,0)};let c,l;this.mode==="snow"?(c=S(m(-20,20)-90),l=m(.5,2)):this.mode==="rain"?(c=S(-90),l=m(8,15)):(c=C()*R.TWO_PI,l=m(2,6));let u=j(s.x,s.y,c,l,n.colors,n.shapes,n.size,n.opacity,n.lifespan,r.rotationSpeed,{images:n.images,tiltRange:n.tilt,spinSpeedRange:n.spinSpeed,depth3D:n.depth3D});this.particles.push(u)}}launchFirework(){if(!this.canvasContext)return;let{width:t,height:n}=this.canvasContext,{launchHeight:r,burstCount:i,spread:o,secondaryExplosions:a,rocketColors:s,burstColors:c,trailLength:l}=this.fireworkConfig,u=this.spawnArea?ct(this.spawnArea,t,n).x:m(t*.2,t*.8),p=n*(1-r),f=u+m(-50,50),h=j(u,n,S(-90+m(-10,10)),m(15,25),s,["circle"],[3,5],[1,1],2e3,0);h.data={isRocket:!0,targetY:p,targetX:f,burstCount:i,spread:o,burstColors:c,secondaryExplosions:a,trailLength:l},this.particles.push(h)}explodeFirework(t,n,r){let{burstCount:i=80,spread:o=360,burstColors:a,secondaryExplosions:s}=r,c=a??this.config.particle.colors,l=S(o);for(let u=0;u<i;u++){let p=u/i*l-l/2+S(-90),f=m(4,12),h=j(t,n,p,f,c,this.config.particle.shapes,[2,6],[.8,1],1500,this.config.physics.rotationSpeed);s&&C()<.1&&(h.data={willExplode:!0,burstColors:c}),this.particles.push(h)}}stop(){this.isRunning&&(this.animationFrameId!==null&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null),this.cleanup(),this.deferred.resolve())}pause(){this.isPaused=!0}resume(){this.isPaused=!1}complete(){this.config.onComplete?.(),this.cleanup(),this.deferred.resolve()}cleanup(){this.isRunning=!1,this.isPaused=!1;let t=this.particles;for(let n=t.length-1;n>=0;n--)lt(t[n]);this.particles=[],this.canvasContext=null,Y--,this.config.autoCleanup&&Xt()}addParticles(t){if(!(!this.isRunning||!this.canvasContext))if(this.mode==="continuous"||this.mode==="snow"||this.mode==="rain")this.spawnParticles(t);else{let{particle:n,direction:r,physics:i}=this.config,{x:o,y:a}=this.origin;for(let s=0;s<t;s++){let c;if(r.direction==="radial")c=C()*R.TWO_PI;else{let p=pe(r.direction,r.angle),f=S(r.spread);c=p+(C()-.5)*f}let l=m(r.velocity[0],r.velocity[1]),u=j(o,a,c,l,n.colors,n.shapes,n.size,n.opacity,n.lifespan,i.rotationSpeed);this.particles.push(u)}}}clear(){this.particles=[]}getParticleCount(){return at(this.particles)}getState(){return this.isRunning?this.isPaused?"paused":"running":"stopped"}createHandle(){return{stop:()=>this.stop(),pause:()=>this.pause(),resume:()=>this.resume(),promise:this.deferred.promise,addParticles:t=>this.addParticles(t),clear:()=>this.clear(),getParticleCount:()=>this.getParticleCount(),getState:()=>this.getState()}}};function ut(e,t){return new he(e,t).start()}function Zt(e,t){if(!e||!$())return null;let n=e.getBoundingClientRect(),r={x:n.left+n.width/2,y:n.top+n.height/2};return ut(r,t)}function Jt(){return Y}function Kt(){b&&(b.remove(),b=null,H=null),Y=0}import{useCallback as J,useRef as nn,useState as rn,useEffect as on}from"react";var In=Math.PI*2,Qt=Math.PI/180,dt=1e3/60;function I(){if(typeof crypto<"u"&&crypto.getRandomValues){let e=new Uint32Array(1);return crypto.getRandomValues(e),e[0]/4294967296}return Math.random()}function me(e){return e*Qt}function N(e,t,n){return Math.min(Math.max(e,t),n)}function De(e,t){let n=Math.max(0,e-t),r=n/dt;return Object.freeze({value:n,factor:r})}function ft(e){if(typeof e!="string"||e.length>50)return null;let t=e.trim().toLowerCase();if(t.startsWith("#")){let r=t.slice(1);if(!/^[0-9a-f]+$/.test(r))return null;let i,o,a,s=255;if(r.length===3)i=parseInt(r[0]+r[0],16),o=parseInt(r[1]+r[1],16),a=parseInt(r[2]+r[2],16);else if(r.length===6)i=parseInt(r.slice(0,2),16),o=parseInt(r.slice(2,4),16),a=parseInt(r.slice(4,6),16);else if(r.length===8)i=parseInt(r.slice(0,2),16),o=parseInt(r.slice(2,4),16),a=parseInt(r.slice(4,6),16),s=parseInt(r.slice(6,8),16);else return null;return{r:i,g:o,b:a,a:s/255}}let n=t.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)$/);return n?{r:N(parseInt(n[1],10),0,255),g:N(parseInt(n[2],10),0,255),b:N(parseInt(n[3],10),0,255),a:n[4]!==void 0?N(parseFloat(n[4]),0,1):1}:null}function Se(e,t){let n=ft(e);if(!n)return e;let{r,g:i,b:o,a}=n,s=N(r+t,0,255),c=N(i+t,0,255),l=N(o+t,0,255);return a<1?`rgba(${Math.round(s)}, ${Math.round(c)}, ${Math.round(l)}, ${a})`:`rgb(${Math.round(s)}, ${Math.round(c)}, ${Math.round(l)})`}function X(){if(typeof window>"u")return!1;try{return window.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1}catch{return!1}}var en=0;function ae(){return++en}function ge(e){if(e.length===0)return;let t=Math.floor(I()*e.length);return e[t]}function be(e){return typeof requestAnimationFrame<"u"?requestAnimationFrame(e):setTimeout(e,dt)}function Me(e){typeof cancelAnimationFrame<"u"?cancelAnimationFrame(e):clearTimeout(e)}function Oe(){return typeof window>"u"?1:Math.min(window.devicePixelRatio||1,2)}var pt=Object.freeze(["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"]),tn=Object.freeze(["square","circle"]),Ce=Math.PI*2,ve=class e{constructor(t,n,r,i,o,a,s,c,l,u,p,f,h,E,v,F,g){this.id=t,this.position=n,this.velocity=r,this.angle2D=i,this.gravity=o,this.drift=a,this.decay=s,this.wobble=c,this.tilt=l,this.roll=u,this.rotate=p,this.color=f,this.shape=h,this.size=E,this.scalar=v,this.flat=F,this.tick=0,this.totalTicks=g,this.destroyed=!1,this.opacity=1}static create(t,n,r={}){let{angle:i=90,spread:o=45,startVelocity:a=45,decay:s=.94,gravity:c=1,drift:l=0,flat:u=!1,ticks:p=200,origin:f={x:.5,y:.5},colors:h=pt,shapes:E=tn,scalar:v=1,size:F=4}=r,g={x:f.x*t,y:f.y*n},w=me(i),d=me(o),T=-w+(.5*d-I()*d),A=a*.5+I()*a,x={angle:I()*Ce,angleSpeed:I()*.1+.05,moveSpeed:-15+I()*30,distance:25+I()*15},z={value:I()*Ce,sinDirection:I()>=.5?1:-1,cosDirection:I()>=.5?1:-1,speed:(I()*.4+.3)*(I()>.5?1:-1),enable:!u},G={angle:I()*Ce,speed:(15+I()*10)/60,horizontal:I()>.3,vertical:I()>.7,enable:!u},k={angle:I()*Ce,speed:(I()*2-1)*.1,enable:!u},Q=ge(h)??pt[0],W=ge(E)??"square";return new e(ae(),g,A,T,c*3,l,s,x,z,G,k,Q,W,F,v,u,p)}get progress(){return this.tick/this.totalTicks}get computedSize(){return this.size*this.scalar}destroy(){this.destroyed=!0}clone(t){let n=Object.create(e.prototype);return Object.assign(n,this,t),n}},we=class{constructor(t=1e3){this.pool=[];this.maxSize=t}acquire(t,n,r){let i=this.pool.pop();return i?this.resetParticle(i,t,n,r):ve.create(t,n,r)}release(t){this.pool.length<this.maxSize&&(t.destroyed=!0,this.pool.push(t))}clear(){this.pool.length=0}get size(){return this.pool.length}resetParticle(t,n,r,i){let o=ve.create(n,r,i);return Object.assign(t,o,{id:t.id}),t.destroyed=!1,t}};var D=Math.PI*2,Be=class{constructor(){this.id="base"}init(t){}isEnabled(t){return!t.destroyed}update(t,n){if(t.destroyed)return;let r=Math.cos(t.angle2D)*t.velocity,i=Math.sin(t.angle2D)*t.velocity;t.position.x+=r*n.factor+t.drift*n.factor,t.position.y+=i*n.factor+t.gravity*n.factor,t.velocity*=t.decay,t.tick++;let o=t.tick/t.totalTicks;t.opacity=1-Math.pow(o,2),t.tick>=t.totalTicks&&(t.destroyed=!0)}},ke=class{constructor(){this.id="wobble"}init(t){t.wobble||(t.wobble={angle:Math.random()*D,angleSpeed:Math.random()*.1+.05,moveSpeed:-15+Math.random()*30,distance:25+Math.random()*15})}isEnabled(t){return!t.destroyed&&!t.flat&&!!t.wobble}update(t,n){if(!this.isEnabled(t))return;let r=t.wobble;r.angle+=r.angleSpeed*n.factor,r.angle>D&&(r.angle-=D);let i=Math.cos(r.angle)*r.distance*.1;t.position.x+=i*n.factor}},_e=class{constructor(){this.id="tilt"}init(t){t.tilt||(t.tilt={value:Math.random()*D,sinDirection:Math.random()>=.5?1:-1,cosDirection:Math.random()>=.5?1:-1,speed:(Math.random()*.4+.3)*(Math.random()>.5?1:-1),enable:!t.flat})}isEnabled(t){return!t.destroyed&&t.tilt?.enable===!0}update(t,n){if(!this.isEnabled(t))return;let r=t.tilt;r.value+=r.speed*.01*n.factor,r.value>D?r.value-=D:r.value<0&&(r.value+=D)}getTransformValues(t){if(!t.tilt?.enable)return{};let n=t.tilt;return{b:Math.cos(n.value)*n.cosDirection*.5,c:Math.sin(n.value)*n.sinDirection*.5}}},ze=class{constructor(){this.id="roll"}init(t){t.roll||(t.roll={angle:Math.random()*D,speed:(15+Math.random()*10)/60,horizontal:Math.random()>.3,vertical:Math.random()>.7,enable:!t.flat})}isEnabled(t){return!t.destroyed&&t.roll?.enable===!0}update(t,n){if(!this.isEnabled(t))return;let r=t.roll;r.angle+=r.speed*n.factor,r.angle>D&&(r.angle-=D)}getTransformValues(t){if(!t.roll?.enable)return{};let n=t.roll;return{a:n.horizontal?Math.abs(Math.cos(n.angle)):void 0,d:n.vertical?Math.abs(Math.sin(n.angle)):void 0}}getDarkenAmount(t){if(!t.roll?.enable)return 0;let n=t.roll;return!n.horizontal&&!n.vertical?0:(n.horizontal?Math.cos(n.angle):Math.sin(n.angle))<0?25:0}},Le=class{constructor(){this.id="rotate"}init(t){t.rotate||(t.rotate={angle:Math.random()*D,speed:(Math.random()*2-1)*.1,enable:!t.flat})}isEnabled(t){return!t.destroyed&&t.rotate?.enable===!0}update(t,n){if(!this.isEnabled(t))return;let r=t.rotate;r.angle+=r.speed*n.factor,r.angle>D?r.angle-=D:r.angle<0&&(r.angle+=D)}},He=class{constructor(){this.id="opacity"}init(t){t.opacity=1}isEnabled(t){return!t.destroyed}update(t,n){if(!this.isEnabled(t))return;let r=t.tick/t.totalTicks;t.opacity=1-Math.pow(r,2)}};function ht(){return[new Be,new ke,new _e,new ze,new Le,new He]}var mt=Math.PI*2,Ne=class{constructor(){this.type="circle"}draw(t,n,r){let i=n.flat?1:.6+Math.sin(n.wobble.angle)*.4;t.ellipse(0,0,r*i,r*(1-i*.3),n.tilt?.value??0,0,mt)}},Ue=class{constructor(){this.type="square"}draw(t,n,r){let i=n.flat?0:Math.sin(n.wobble.angle)*r*.3;t.moveTo(-r+i,-r),t.lineTo(r+i,-r*.5),t.lineTo(r-i,r),t.lineTo(-r-i,r*.5)}},We=class{constructor(){this.type="rectangle"}draw(t,n,r){let i=r*1.5,o=r*.6,a=n.flat?0:Math.sin(n.wobble.angle)*o*.2;t.moveTo(-i+a,-o),t.lineTo(i+a,-o*.5),t.lineTo(i-a,o),t.lineTo(-i-a,o*.5)}},qe=class{constructor(){this.type="star"}draw(t,n,r){let i=r,o=r*.5,a=5,s=Math.PI/a,c=-Math.PI/2;t.moveTo(0,-i);for(let l=0;l<a;l++)t.lineTo(Math.cos(c)*i,Math.sin(c)*i),c+=s,t.lineTo(Math.cos(c)*o,Math.sin(c)*o),c+=s}},Ge=class{constructor(){this.type="triangle"}draw(t,n,r){let i=r*Math.sqrt(3)/2;t.moveTo(0,-i),t.lineTo(-r,i),t.lineTo(r,i)}},Ve=class{constructor(){this.type="diamond"}draw(t,n,r){t.moveTo(0,-r),t.lineTo(r*.6,0),t.lineTo(0,r),t.lineTo(-r*.6,0)}},$e=class{constructor(){this.type="heart"}draw(t,n,r){let o=-r*.3,a=r*.3;t.moveTo(0,o+a),t.bezierCurveTo(0-r,o,0-r,o-a*2,0,o-a),t.bezierCurveTo(0+r,o-a*2,0+r,o,0,o+a)}},je=class{constructor(){this.type="hexagon"}draw(t,n,r){let o=mt/6;for(let a=0;a<6;a++){let s=o*a-Math.PI/2,c=Math.cos(s)*r,l=Math.sin(s)*r;a===0?t.moveTo(c,l):t.lineTo(c,l)}}},Ye=class{constructor(){this.drawers=new Map;this.register(new Ne),this.register(new Ue),this.register(new We),this.register(new qe),this.register(new Ge),this.register(new Ve),this.register(new $e),this.register(new je)}register(t){this.drawers.set(t.type,t)}get(t){return this.drawers.get(t)}has(t){return this.drawers.has(t)}getTypes(){return Array.from(this.drawers.keys())}unregister(t){return this.drawers.delete(t)}clear(){this.drawers.clear()}},Z=new Ye;var U=class{constructor(t={}){this.destroyed=!1;this.t=[];this.n=null;this.m=0;this.i=null;this.p=!1;this.o=null;this.P=t=>{if(this.destroyed)return;let n=De(t,this.m);this.m=t,this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);let r=!1,i=[];for(let o=0;o<this.t.length;o++){let a=this.t[o];if(a.destroyed){i.push(o);continue}for(let s of this.e)s.isEnabled(a)&&s.update(a,n);if(a.destroyed){i.push(o);continue}r=!0,this.E(a)}for(let o=i.length-1;o>=0;o--){let a=i[o],s=this.t[a];this.l.release(s),this.t.splice(a,1)}r?this.n=be(this.P):(this.n=null,this.i?.(),this.i=null)};this.I=()=>{this.v()};this.id=`confetti-${ae()}`,this.f={canvas:t.canvas,resize:t.resize??!0,zIndex:t.zIndex??100,disableForReducedMotion:t.disableForReducedMotion??!1},t.canvas?this.canvas=t.canvas:(this.canvas=this.T(),this.p=!0);let n=this.canvas.getContext("2d",{alpha:!0,desynchronized:!0});if(!n)throw new Error("Failed to get 2D canvas context");this.ctx=n,this.e=ht(),this.l=new we(500),this.f.resize&&this.R(),this.v()}get particles(){return this.t}async fire(t={}){if(this.f.disableForReducedMotion&&X())return Promise.resolve();if(this.destroyed)throw new Error("Cannot fire on destroyed container");let n=t.particleCount??100,r=this.canvas.width,i=this.canvas.height;for(let o=0;o<n;o++){let a=this.l.acquire(r,i,t);for(let s of this.e)s.init(a);this.t.push(a)}return this.n?new Promise(o=>{let a=this.i;this.i=()=>{a?.(),o()}}):new Promise(o=>{this.i=o,this.m=performance.now(),this.n=be(this.P)})}stop(){this.n&&(Me(this.n),this.n=null);for(let t of this.t)this.l.release(t);this.t.length=0,this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.i?.(),this.i=null}reset(){this.stop(),this.l.clear()}destroy(){this.destroyed||(this.stop(),this.o&&(this.o.disconnect(),this.o=null),this.p&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.destroyed=!0)}E(t){let n=this.ctx,r=t.size*t.scalar,i={a:1,b:0,c:0,d:1};for(let l of this.e)if(l.getTransformValues){let u=l.getTransformValues(t);u.a!==void 0&&(i.a=u.a),u.b!==void 0&&(i.b=u.b),u.c!==void 0&&(i.c=u.c),u.d!==void 0&&(i.d=u.d)}let a=this.e.find(l=>l.id==="roll")?.getDarkenAmount(t)??0,s=a>0?Se(t.color,-a):t.color;n.save(),n.translate(t.position.x,t.position.y),n.rotate(t.rotate?.angle??0),n.transform(i.a??1,i.b??0,i.c??0,i.d??1,0,0),n.fillStyle=s,n.globalAlpha=t.opacity,n.beginPath();let c=Z.get(t.shape);c?c.draw(n,t,r):Z.get("square")?.draw(n,t,r),n.closePath(),n.fill(),n.restore()}T(){let t=document.createElement("canvas");return t.id=this.id,t.style.cssText=`
9
+ `,H=y.getContext("2d",{alpha:!0,desynchronized:!0}),!H)throw new Error("Failed to get canvas 2D context");document.body.appendChild(y),n.autoResize&&(z=()=>{if(y&&H){let a=n.width??window.innerWidth,s=n.height??window.innerHeight;y.width=a*r,y.height=s*r,y.style.width=`${a}px`,y.style.height=`${s}px`,H.setTransform(r,0,0,r,0,0)}},window.addEventListener("resize",z))}y.style.zIndex=String(e);let i=n.width??window.innerWidth,o=n.height??window.innerHeight;return(y.width!==i*r||y.height!==o*r)&&(y.width=i*r,y.height=o*r,y.style.width=`${i}px`,y.style.height=`${o}px`,H.setTransform(r,0,0,r,0,0)),{canvas:y,ctx:H,width:i,height:o,dpr:r}}function cn(){y&&$===0&&setTimeout(()=>{$===0&&y&&(z&&(window.removeEventListener("resize",z),z=null),y.remove(),y=null,H=null)},rt)}function ft(e,t,n){let{type:r,x:i,y:o,w:a,h:s}=e;switch(r){case"point":return{x:i,y:o};case"rect":return{x:b(i,i+(a??0)),y:b(o,o+(s??0))};case"line":let l=C();return{x:i+l*(a??0),y:o+l*(s??0)};case"circle":let c=C()*v.TWO_PI,u=Math.sqrt(C())*(a??50);return{x:i+Math.cos(c)*u,y:o+Math.sin(c)*u};default:return{x:i,y:o}}}var ge=class{constructor(t,n){this.particles=[];this.canvasContext=null;this.animationFrameId=null;this.lastFrameTime=0;this.lastSpawnTime=0;this.isRunning=!1;this.isPaused=!1;this.deferred=st();this.frameInterval=0;this.lastRenderTime=0;this.animate=()=>{if(!this.isRunning||!this.canvasContext)return;if((this.mode==="continuous"||this.mode==="snow"||this.mode==="rain")&&!this.continuousConfig.run){this.animationFrameId=requestAnimationFrame(this.animate),this.lastFrameTime=performance.now();return}if(this.isPaused){this.animationFrameId=requestAnimationFrame(this.animate),this.lastFrameTime=performance.now();return}let t=performance.now(),n=t-this.lastFrameTime;if(this.lastFrameTime=t,this.frameInterval>0){if(t-this.lastRenderTime<this.frameInterval){this.animationFrameId=requestAnimationFrame(this.animate);return}this.lastRenderTime=t}let{ctx:r,width:i,height:o,dpr:a}=this.canvasContext,{physics:s,particle:l}=this.config;r.setTransform(1,0,0,1,0,0),r.clearRect(0,0,i*a,o*a),r.scale(a,a);let c=this.particles,u=c.length,m=0,p=!0,h=100,w=-h,F=i+h,A=-h,P=o+h;for(let I=0;I<u;I++){let f=c[I];if(f.active){if(ct(f,n,s,l.fadeOut,l.scaleDown),f.data?.isRocket&&f.y<=f.data.targetY){f.active=!1,this.explodeFirework(f.x,f.y,f.data);continue}if(f.data?.willExplode&&!f.data.hasExploded&&f.vx*f.vx+f.vy*f.vy<1&&(f.data.hasExploded=!0,this.explodeFirework(f.x,f.y,{burstCount:15,spread:360,burstColors:f.data.burstColors})),f.x<w||f.x>F||f.y<A||f.y>P){(f.y>P||f.x<w-200||f.x>F+200)&&(f.active=!1);continue}ut(r,f,{customDraw:this.drawShape}),m++,p=!1}}if(this.mode==="continuous"||this.mode==="snow"||this.mode==="rain"){let I=t-this.lastSpawnTime,f=1e3/(this.continuousConfig.spawnRate??10);if(I>=f){if(this.continuousConfig.recycle){let d=this.continuousConfig.numberOfPieces-m;if(d>0){for(let O=u-1;O>=0&&d>0;O--)c[O].active||(Me(c[O]),c.splice(O,1));this.spawnParticles(Math.min(d,5))}}else m<this.continuousConfig.numberOfPieces&&this.spawnParticles(Math.min(3,this.continuousConfig.numberOfPieces-m));this.lastSpawnTime=t}}if(this.mode==="firework"){let I=0;for(let R=0;R<u;R++)c[R].active&&c[R].data?.isRocket&&I++;let f=t-this.lastSpawnTime;I===0&&f>=(this.fireworkConfig.burstDelay??500)&&(this.launchFirework(),this.lastSpawnTime=t)}if((this.mode==="burst"||this.mode==="cannon"||this.mode==="explosion")&&p){this.complete();return}this.animationFrameId=requestAnimationFrame(this.animate)};this.origin=t,this.config=De(n),this.mode=n?.mode??"burst",this.spawnArea=n?.spawnArea,this.continuousConfig={...xe,...n?.continuous},this.fireworkConfig={...Ee,...n?.firework},this.canvasConfig={...fe,...n?.canvas},this.drawShape=n?.particle?.drawShape,this.canvasConfig.frameRate&&(this.frameInterval=1e3/this.canvasConfig.frameRate)}start(){if(this.isRunning)return this.createHandle();if(!G())return this.deferred.resolve(),this.createHandle();if(typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches)return this.deferred.resolve(),this.createHandle();if(this.isRunning=!0,$++,this.canvasContext=ln(this.config.zIndex,this.canvasConfig),this.mode==="continuous"||this.mode==="snow"||this.mode==="rain"){let t=Math.min(this.continuousConfig.numberOfPieces,Math.floor(this.continuousConfig.numberOfPieces*.5));this.spawnParticles(t)}else this.mode==="firework"?this.launchFirework():this.createParticles();return this.config.onStart?.(),this.lastFrameTime=performance.now(),this.lastSpawnTime=performance.now(),this.lastRenderTime=performance.now(),this.animate(),this.createHandle()}createParticles(){let{particleCount:t,particle:n,direction:r,physics:i}=this.config,{x:o,y:a}=this.origin,s=Math.min(t,Ae.MAX_PARTICLES);for(let l=0;l<s;l++){let c;if(r.direction==="radial")c=C()*v.TWO_PI;else{let p=pe(r.direction,r.angle),h=E(r.spread);c=p+(C()-.5)*h}let u=b(r.velocity[0],r.velocity[1]),m=q(o,a,c,u,n.colors,n.shapes,n.size,n.opacity,n.lifespan,i.rotationSpeed,{images:n.images,tiltRange:n.tilt,spinSpeedRange:n.spinSpeed,depth3D:n.depth3D});this.particles.push(m)}}spawnParticles(t){if(!this.canvasContext)return;let{particle:n,physics:r}=this.config,{width:i,height:o}=this.canvasContext;for(let a=0;a<t;a++){let s;this.spawnArea?s=ft(this.spawnArea,i,o):this.mode==="snow"||this.mode==="rain"?s={x:b(0,i),y:-20}:s={x:b(0,i),y:b(-20,0)};let l,c;this.mode==="snow"?(l=E(b(-20,20)-90),c=b(.5,2)):this.mode==="rain"?(l=E(-90),c=b(8,15)):(l=C()*v.TWO_PI,c=b(2,6));let u=q(s.x,s.y,l,c,n.colors,n.shapes,n.size,n.opacity,n.lifespan,r.rotationSpeed,{images:n.images,tiltRange:n.tilt,spinSpeedRange:n.spinSpeed,depth3D:n.depth3D});this.particles.push(u)}}launchFirework(){if(!this.canvasContext)return;let{width:t,height:n}=this.canvasContext,{launchHeight:r,burstCount:i,spread:o,secondaryExplosions:a,rocketColors:s,burstColors:l,trailLength:c}=this.fireworkConfig,u=this.spawnArea?ft(this.spawnArea,t,n).x:b(t*.2,t*.8),m=n*(1-r),p=u+b(-50,50),h=q(u,n,E(-90+b(-10,10)),b(15,25),s,["circle"],[3,5],[1,1],2e3,0);h.data={isRocket:!0,targetY:m,targetX:p,burstCount:i,spread:o,burstColors:l,secondaryExplosions:a,trailLength:c},this.particles.push(h)}explodeFirework(t,n,r){let{burstCount:i=80,spread:o=360,burstColors:a,secondaryExplosions:s}=r,l=a??this.config.particle.colors,c=E(o);for(let u=0;u<i;u++){let m=u/i*c-c/2+E(-90),p=b(4,12),h=q(t,n,m,p,l,this.config.particle.shapes,[2,6],[.8,1],1500,this.config.physics.rotationSpeed);s&&C()<.1&&(h.data={willExplode:!0,burstColors:l}),this.particles.push(h)}}stop(){this.isRunning&&(this.animationFrameId!==null&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null),this.cleanup(),this.deferred.resolve())}pause(){this.isPaused=!0}resume(){this.isPaused=!1}complete(){this.config.onComplete?.(),this.cleanup(),this.deferred.resolve()}cleanup(){this.isRunning=!1,this.isPaused=!1;let t=this.particles;for(let n=t.length-1;n>=0;n--)Me(t[n]);this.particles=[],this.canvasContext=null,$--,this.config.autoCleanup&&cn()}addParticles(t){if(!(!this.isRunning||!this.canvasContext))if(this.mode==="continuous"||this.mode==="snow"||this.mode==="rain")this.spawnParticles(t);else{let{particle:n,direction:r,physics:i}=this.config,{x:o,y:a}=this.origin;for(let s=0;s<t;s++){let l;if(r.direction==="radial")l=C()*v.TWO_PI;else{let m=pe(r.direction,r.angle),p=E(r.spread);l=m+(C()-.5)*p}let c=b(r.velocity[0],r.velocity[1]),u=q(o,a,l,c,n.colors,n.shapes,n.size,n.opacity,n.lifespan,i.rotationSpeed);this.particles.push(u)}}}clear(){let t=this.particles;for(let n=t.length-1;n>=0;n--)Me(t[n]);this.particles=[]}getParticleCount(){return dt(this.particles)}getState(){return this.isRunning?this.isPaused?"paused":"running":"stopped"}createHandle(){return{stop:()=>this.stop(),pause:()=>this.pause(),resume:()=>this.resume(),promise:this.deferred.promise,addParticles:t=>this.addParticles(t),clear:()=>this.clear(),getParticleCount:()=>this.getParticleCount(),getState:()=>this.getState()}}};function Ce(e,t){return new ge(e,t).start()}function Be(e,t){if(!e||!G())return null;let n=e.getBoundingClientRect(),r={x:n.left+n.width/2,y:n.top+n.height/2};return Ce(r,t)}function un(){return $}function dn(){z&&(window.removeEventListener("resize",z),z=null),y&&(y.remove(),y=null,H=null),$=0}import{useCallback as L,useRef as ye,useState as fn,useEffect as be}from"react";function M(){let[e,t]=fn(!1),n=ye(new Set);be(()=>()=>{n.current.forEach(c=>c.stop()),n.current.clear()},[]);let r=L((c,u)=>{let m=Ce(c,u);return n.current.add(m),t(!0),m.promise.then(()=>{n.current.delete(m),n.current.size===0&&t(!1)}),m},[]),i=L((c,u)=>{let m=Be(c,u);return m?(n.current.add(m),t(!0),m.promise.then(()=>{n.current.delete(m),n.current.size===0&&t(!1)}),m):null},[]),o=L(()=>{n.current.forEach(c=>c.stop()),n.current.clear(),t(!1)},[]),a=L(()=>{n.current.forEach(c=>c.pause())},[]),s=L(()=>{n.current.forEach(c=>c.resume())},[]),l=L(()=>Array.from(n.current),[]);return{fire:r,fireFromElement:i,isActive:e,stopAll:o,pauseAll:a,resumeAll:s,getActiveHandles:l}}function pn(e){let t=ye(null),{fireFromElement:n,isActive:r}=M(),i=L(()=>n(t.current,e),[n,e]);return{ref:t,fire:i,isActive:r}}function mn(e,t,n){let r=ye(!1),{fire:i}=M();be(()=>{e&&!r.current&&(r.current=!0,i(t,n))},[e,i,t,n]),be(()=>{e||(r.current=!1)},[e])}function hn(e){let{fire:t,isActive:n,stopAll:r}=M(),i=ye([]),o=L(()=>{i.current.forEach(s=>clearTimeout(s)),i.current=[],r()},[r]),a=L(()=>{o(),e.forEach(({origin:s,options:l,delay:c})=>{let u=window.setTimeout(()=>{t(s,l)},c);i.current.push(u)})},[e,t,o]);return be(()=>()=>{i.current.forEach(s=>clearTimeout(s))},[]),{start:a,isActive:n,cancel:o}}function gn(e){let{fire:t,isActive:n}=M();return{fire:L(()=>{let i={x:typeof window<"u"?window.innerWidth/2:0,y:typeof window<"u"?window.innerHeight/2:0};return t(i,{...e,direction:{direction:"radial"}})},[t,e]),isActive:n}}import{useEffect as j,useRef as k,useCallback as pt,forwardRef as mt,useImperativeHandle as Cn}from"react";import{jsx as bt}from"react/jsx-runtime";function bn({active:e,origin:t,triggerRef:n,options:r,onComplete:i}){let{fire:o,fireFromElement:a}=M(),s=k(!1);return j(()=>{if(e&&!s.current){s.current=!0;let l=null;n?.current?l=a(n.current,r):t&&(l=o(t,r)),l&&l.promise.then(()=>{i?.()})}},[e,t,n,r,o,a,i]),j(()=>{e||(s.current=!1)},[e]),null}var ht=mt(({options:e,style:t},n)=>{let r=k(null),{fireFromElement:i}=M();return Cn(n,()=>({fire:()=>i(r.current,e)})),bt("div",{ref:r,style:{position:"absolute",width:1,height:1,pointerEvents:"none",...t},"aria-hidden":"true"})});ht.displayName="ConfettiTrigger";var gt=mt(({children:e,confettiOptions:t,fireOnClick:n=!0,originOffset:r,direction:i,onClick:o,...a},s)=>{let l=k(null),{fire:c}=M(),u=pt(p=>{l.current=p,typeof s=="function"?s(p):s&&(s.current=p)},[s]),m=pt(p=>{if(n&&l.current){let h=l.current.getBoundingClientRect(),w={x:h.left+h.width/2+(r?.x??0),y:h.top+h.height/2+(r?.y??0)},F=i?{...t,direction:{...t?.direction,direction:i}}:t;c(w,F)}o?.(p)},[n,c,t,r,i,o]);return bt("button",{ref:u,onClick:m,...a,children:e})});gt.displayName="ConfettiButton";function yn({origin:e,options:t,onComplete:n,delay:r=0}){let{fire:i}=M(),o=k(!1);return j(()=>{if(o.current)return;o.current=!0;let a=e??{x:typeof window<"u"?window.innerWidth/2:0,y:typeof window<"u"?window.innerHeight/2:0},s=setTimeout(()=>{i(a,t).promise.then(()=>n?.())},r);return()=>clearTimeout(s)},[i,e,t,n,r]),null}function vn({left:e=0,top:t=0,angle:n=90,options:r,fire:i=!1,onComplete:o}){let{fire:a}=M(),s=k(!1);return j(()=>{if(!i||s.current||typeof window>"u")return;s.current=!0;let l=typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100*window.innerWidth:typeof e=="number"?e:parseFloat(e)||0,c=typeof t=="string"&&t.endsWith("%")?parseFloat(t)/100*window.innerHeight:typeof t=="number"?t:parseFloat(t)||0;a({x:l,y:c},{...r,direction:{...r?.direction,direction:"custom",angle:n}}).promise.then(()=>o?.())},[i,e,t,n,r,a,o]),j(()=>{i||(s.current=!1)},[i]),null}function Ct({width:e,height:t,numberOfPieces:n=200,confettiSource:r,initialVelocityX:i,initialVelocityY:o,recycle:a=!0,run:s=!0,gravity:l=.3,wind:c=0,opacity:u=1,drawShape:m,tweenDuration:p=100,colors:h,onConfettiComplete:w,frameRate:F}){let{fire:A}=M(),P=k(null),I=k(!1),f=k({width:e,height:t,numberOfPieces:n,confettiSource:r,initialVelocityX:i,initialVelocityY:o,recycle:a,gravity:l,wind:c,opacity:u,drawShape:m,tweenDuration:p,colors:h,onConfettiComplete:w,frameRate:F});f.current={width:e,height:t,numberOfPieces:n,confettiSource:r,initialVelocityX:i,initialVelocityY:o,recycle:a,gravity:l,wind:c,opacity:u,drawShape:m,tweenDuration:p,colors:h,onConfettiComplete:w,frameRate:F};let R=k(A);return R.current=A,j(()=>{if(!s){P.current&&(P.current.stop(),P.current=null),I.current=!1;return}if(I.current)return;I.current=!0;let d=f.current,O=d.confettiSource?{type:"rect",x:d.confettiSource.x,y:d.confettiSource.y,w:d.confettiSource.w??window.innerWidth,h:d.confettiSource.h??10}:{type:"rect",x:0,y:0,w:d.width??window.innerWidth,h:10},W=typeof d.initialVelocityX=="number"?[d.initialVelocityX*.5,d.initialVelocityX*1.5]:d.initialVelocityX?[d.initialVelocityX.min,d.initialVelocityX.max]:[4,10],Y=typeof d.initialVelocityY=="number"?[d.initialVelocityY*.5,d.initialVelocityY*1.5]:d.initialVelocityY?[d.initialVelocityY.min,d.initialVelocityY.max]:[10,30],B=(d.width??window.innerWidth)/2,V=0;return P.current=R.current({x:B,y:V},{particleCount:d.numberOfPieces,particle:{colors:d.colors??["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff"],opacity:[d.opacity*.8,d.opacity],shapes:["square","circle","rectangle"],drawShape:d.drawShape},physics:{gravity:d.gravity*10,wind:d.wind*5,windVariation:W[1]-W[0]},direction:{velocity:Y},mode:"continuous",spawnArea:O,continuous:{recycle:d.recycle,numberOfPieces:d.numberOfPieces,spawnRate:30,run:s,tweenDuration:d.tweenDuration},canvas:{width:d.width,height:d.height,frameRate:d.frameRate,autoResize:!d.width&&!d.height},onComplete:d.onConfettiComplete}),()=>{P.current&&(P.current.stop(),P.current=null)}},[s]),null}Ct.displayName="Confetti";var yt=1e3/60;function g(){return C()}function Le(e,t){let n=Math.max(0,e-t),r=n/yt;return Object.freeze({value:n,factor:r})}function vt(e){if(typeof e!="string"||e.length>50)return null;let t=e.trim().toLowerCase();if(t.startsWith("#")){let r=t.slice(1);if(!/^[0-9a-f]+$/.test(r))return null;let i,o,a,s=255;if(r.length===3)i=parseInt(r[0]+r[0],16),o=parseInt(r[1]+r[1],16),a=parseInt(r[2]+r[2],16);else if(r.length===6)i=parseInt(r.slice(0,2),16),o=parseInt(r.slice(2,4),16),a=parseInt(r.slice(4,6),16);else if(r.length===8)i=parseInt(r.slice(0,2),16),o=parseInt(r.slice(2,4),16),a=parseInt(r.slice(4,6),16),s=parseInt(r.slice(6,8),16);else return null;return{r:i,g:o,b:a,a:s/255}}let n=t.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)$/);return n?{r:T(parseInt(n[1],10),0,255),g:T(parseInt(n[2],10),0,255),b:T(parseInt(n[3],10),0,255),a:n[4]!==void 0?T(parseFloat(n[4]),0,1):1}:null}function Ne(e,t){let n=vt(e);if(!n)return e;let{r,g:i,b:o,a}=n,s=T(r+t,0,255),l=T(i+t,0,255),c=T(o+t,0,255);return a<1?`rgba(${Math.round(s)}, ${Math.round(l)}, ${Math.round(c)}, ${a})`:`rgb(${Math.round(s)}, ${Math.round(l)}, ${Math.round(c)})`}function X(){if(typeof window>"u")return!1;try{return window.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1}catch{return!1}}var Pn=0;function ie(){return++Pn}function ve(e){if(e.length===0)return;let t=Math.floor(g()*e.length);return e[t]}function we(e){return typeof requestAnimationFrame<"u"?requestAnimationFrame(e):setTimeout(e,yt)}function ke(e){typeof cancelAnimationFrame<"u"?cancelAnimationFrame(e):clearTimeout(e)}function oe(){return typeof window>"u"?1:Math.min(window.devicePixelRatio||1,2)}var wt=Object.freeze(["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"]),In=Object.freeze(["square","circle"]),Pe=Math.PI*2,Ie=class e{constructor(t,n,r,i,o,a,s,l,c,u,m,p,h,w,F,A,P){this.id=t,this.position=n,this.velocity=r,this.angle2D=i,this.gravity=o,this.drift=a,this.decay=s,this.wobble=l,this.tilt=c,this.roll=u,this.rotate=m,this.color=p,this.shape=h,this.size=w,this.scalar=F,this.flat=A,this.tick=0,this.totalTicks=P,this.destroyed=!1,this.opacity=1}static create(t,n,r={}){let{angle:i=90,spread:o=45,startVelocity:a=45,decay:s=.94,gravity:l=1,drift:c=0,flat:u=!1,ticks:m=200,origin:p={x:.5,y:.5},colors:h=wt,shapes:w=In,scalar:F=1,size:A=4}=r,P={x:p.x*t,y:p.y*n},I=E(i),f=E(o),R=-I+(.5*f-g()*f),d=a*.5+g()*a,O={angle:g()*Pe,angleSpeed:g()*.1+.05,moveSpeed:-15+g()*30,distance:25+g()*15},W={value:g()*Pe,sinDirection:g()>=.5?1:-1,cosDirection:g()>=.5?1:-1,speed:(g()*.4+.3)*(g()>.5?1:-1),enable:!u},Y={angle:g()*Pe,speed:(15+g()*10)/60,horizontal:g()>.3,vertical:g()>.7,enable:!u},B={angle:g()*Pe,speed:(g()*2-1)*.1,enable:!u},V=ve(h)??wt[0],se=ve(w)??"square";return new e(ie(),P,d,R,l*3,c,s,O,W,Y,B,V,se,A,F,u,m)}get progress(){return this.tick/this.totalTicks}get computedSize(){return this.size*this.scalar}destroy(){this.destroyed=!0}clone(t){let n=Object.create(e.prototype);return Object.assign(n,this,t),n}},Te=class{constructor(t=1e3){this.pool=[];this.maxSize=t}acquire(t,n,r){let i=this.pool.pop();return i?this.resetParticle(i,t,n,r):Ie.create(t,n,r)}release(t){this.pool.length<this.maxSize&&(t.destroyed=!0,this.pool.push(t))}clear(){this.pool.length=0}get size(){return this.pool.length}resetParticle(t,n,r,i){let o=Ie.create(n,r,i);return Object.assign(t,o,{id:t.id}),t.destroyed=!1,t}};var D=Math.PI*2,He=class{constructor(){this.id="base"}init(t){}isEnabled(t){return!t.destroyed}update(t,n){if(t.destroyed)return;let r=Math.cos(t.angle2D)*t.velocity,i=Math.sin(t.angle2D)*t.velocity;t.position.x+=r*n.factor+t.drift*n.factor,t.position.y+=i*n.factor+t.gravity*n.factor,t.velocity*=t.decay,t.tick++,t.tick>=t.totalTicks&&(t.destroyed=!0)}},ze=class{constructor(){this.id="wobble"}init(t){t.wobble||(t.wobble={angle:g()*D,angleSpeed:g()*.1+.05,moveSpeed:-15+g()*30,distance:25+g()*15})}isEnabled(t){return!t.destroyed&&!t.flat&&!!t.wobble}update(t,n){if(!this.isEnabled(t))return;let r=t.wobble;r.angle+=r.angleSpeed*n.factor,r.angle>D&&(r.angle-=D);let i=Math.cos(r.angle)*r.distance*.1;t.position.x+=i*n.factor}},Ue=class{constructor(){this.id="tilt"}init(t){t.tilt||(t.tilt={value:g()*D,sinDirection:g()>=.5?1:-1,cosDirection:g()>=.5?1:-1,speed:(g()*.4+.3)*(g()>.5?1:-1),enable:!t.flat})}isEnabled(t){return!t.destroyed&&t.tilt?.enable===!0}update(t,n){if(!this.isEnabled(t))return;let r=t.tilt;r.value+=r.speed*.01*n.factor,r.value>D?r.value-=D:r.value<0&&(r.value+=D)}getTransformValues(t){if(!t.tilt?.enable)return{};let n=t.tilt;return{b:Math.cos(n.value)*n.cosDirection*.5,c:Math.sin(n.value)*n.sinDirection*.5}}},We=class{constructor(){this.id="roll"}init(t){t.roll||(t.roll={angle:g()*D,speed:(15+g()*10)/60,horizontal:g()>.3,vertical:g()>.7,enable:!t.flat})}isEnabled(t){return!t.destroyed&&t.roll?.enable===!0}update(t,n){if(!this.isEnabled(t))return;let r=t.roll;r.angle+=r.speed*n.factor,r.angle>D&&(r.angle-=D)}getTransformValues(t){if(!t.roll?.enable)return{};let n=t.roll;return{a:n.horizontal?Math.abs(Math.cos(n.angle)):void 0,d:n.vertical?Math.abs(Math.sin(n.angle)):void 0}}getDarkenAmount(t){if(!t.roll?.enable)return 0;let n=t.roll;return!n.horizontal&&!n.vertical?0:(n.horizontal?Math.cos(n.angle):Math.sin(n.angle))<0?25:0}},Ve=class{constructor(){this.id="rotate"}init(t){t.rotate||(t.rotate={angle:g()*D,speed:(g()*2-1)*.1,enable:!t.flat})}isEnabled(t){return!t.destroyed&&t.rotate?.enable===!0}update(t,n){if(!this.isEnabled(t))return;let r=t.rotate;r.angle+=r.speed*n.factor,r.angle>D?r.angle-=D:r.angle<0&&(r.angle+=D)}},Ye=class{constructor(){this.id="opacity"}init(t){t.opacity=1}isEnabled(t){return!t.destroyed}update(t,n){if(!this.isEnabled(t))return;let r=t.tick/t.totalTicks;t.opacity=1-Math.pow(r,2)}};function Pt(){return[new He,new ze,new Ue,new We,new Ve,new Ye]}var It=Math.PI*2,Ge=class{constructor(){this.type="circle"}draw(t,n,r){let i=n.flat?1:.6+Math.sin(n.wobble.angle)*.4;t.ellipse(0,0,r*i,r*(1-i*.3),n.tilt?.value??0,0,It)}},qe=class{constructor(){this.type="square"}draw(t,n,r){let i=n.flat?0:Math.sin(n.wobble.angle)*r*.3;t.moveTo(-r+i,-r),t.lineTo(r+i,-r*.5),t.lineTo(r-i,r),t.lineTo(-r-i,r*.5)}},$e=class{constructor(){this.type="rectangle"}draw(t,n,r){let i=r*1.5,o=r*.6,a=n.flat?0:Math.sin(n.wobble.angle)*o*.2;t.moveTo(-i+a,-o),t.lineTo(i+a,-o*.5),t.lineTo(i-a,o),t.lineTo(-i-a,o*.5)}},je=class{constructor(){this.type="star"}draw(t,n,r){let i=r,o=r*.5,a=5,s=Math.PI/a,l=-Math.PI/2;t.moveTo(0,-i);for(let c=0;c<a;c++)t.lineTo(Math.cos(l)*i,Math.sin(l)*i),l+=s,t.lineTo(Math.cos(l)*o,Math.sin(l)*o),l+=s}},Xe=class{constructor(){this.type="triangle"}draw(t,n,r){let i=r*Math.sqrt(3)/2;t.moveTo(0,-i),t.lineTo(-r,i),t.lineTo(r,i)}},Ze=class{constructor(){this.type="diamond"}draw(t,n,r){t.moveTo(0,-r),t.lineTo(r*.6,0),t.lineTo(0,r),t.lineTo(-r*.6,0)}},Ke=class{constructor(){this.type="heart"}draw(t,n,r){let o=-r*.3,a=r*.3;t.moveTo(0,o+a),t.bezierCurveTo(0-r,o,0-r,o-a*2,0,o-a),t.bezierCurveTo(0+r,o-a*2,0+r,o,0,o+a)}},Je=class{constructor(){this.type="hexagon"}draw(t,n,r){let o=It/6;for(let a=0;a<6;a++){let s=o*a-Math.PI/2,l=Math.cos(s)*r,c=Math.sin(s)*r;a===0?t.moveTo(l,c):t.lineTo(l,c)}}},Qe=class{constructor(){this.drawers=new Map;this.register(new Ge),this.register(new qe),this.register(new $e),this.register(new je),this.register(new Xe),this.register(new Ze),this.register(new Ke),this.register(new Je)}register(t){this.drawers.set(t.type,t)}get(t){return this.drawers.get(t)}has(t){return this.drawers.has(t)}getTypes(){return Array.from(this.drawers.keys())}unregister(t){return this.drawers.delete(t)}clear(){this.drawers.clear()}},Z=new Qe;var U=class{constructor(t={}){this.destroyed=!1;this.t=[];this.n=null;this.m=0;this.i=null;this.p=!1;this.o=null;this.C=!1;this.T=t=>{if(this.destroyed)return;let n=Le(t,this.m);this.m=t;let r=oe();this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.ctx.scale(r,r);let i=!1,o=[];for(let a=0;a<this.t.length;a++){let s=this.t[a];if(s.destroyed){o.push(a);continue}for(let l of this.e)l.isEnabled(s)&&l.update(s,n);if(s.destroyed){o.push(a);continue}i=!0,this.A(s)}for(let a=o.length-1;a>=0;a--){let s=o[a],l=this.t[s];this.l.release(l),this.t.splice(s,1)}i?this.n=we(this.T):(this.n=null,this.i?.(),this.i=null)};this.v=()=>{this.I()};this.id=`confetti-${ie()}`,this.f={canvas:t.canvas,resize:t.resize??!0,zIndex:t.zIndex??100,disableForReducedMotion:t.disableForReducedMotion??!1},t.canvas?this.canvas=t.canvas:(this.canvas=this.F(),this.p=!0);let n=this.canvas.getContext("2d",{alpha:!0,desynchronized:!0});if(!n)throw new Error("Failed to get 2D canvas context");this.ctx=n,this.e=Pt(),this.l=new Te(500),this.f.resize&&this.E(),this.I()}get particles(){return this.t}async fire(t={}){if(this.f.disableForReducedMotion&&X())return Promise.resolve();if(this.destroyed)throw new Error("Cannot fire on destroyed container");let n=t.particleCount??100,r=oe(),i=this.canvas.width/r,o=this.canvas.height/r;for(let a=0;a<n;a++){let s=this.l.acquire(i,o,t);for(let l of this.e)l.init(s);this.t.push(s)}return this.n?new Promise(a=>{let s=this.i;this.i=()=>{s?.(),a()}}):new Promise(a=>{this.i=a,this.m=performance.now(),this.n=we(this.T)})}stop(){this.n&&(ke(this.n),this.n=null);for(let t of this.t)this.l.release(t);this.t.length=0,this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.i?.(),this.i=null}reset(){this.stop(),this.l.clear()}destroy(){this.destroyed||(this.stop(),this.o&&(this.o.disconnect(),this.o=null),this.C&&(window.removeEventListener("resize",this.v),this.C=!1),this.p&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.destroyed=!0)}A(t){let n=this.ctx,r=t.size*t.scalar,i={a:1,b:0,c:0,d:1};for(let c of this.e)if(c.getTransformValues){let u=c.getTransformValues(t);u.a!==void 0&&(i.a=u.a),u.b!==void 0&&(i.b=u.b),u.c!==void 0&&(i.c=u.c),u.d!==void 0&&(i.d=u.d)}let a=this.e.find(c=>c.id==="roll")?.getDarkenAmount(t)??0,s=a>0?Ne(t.color,-a):t.color;n.save(),n.translate(t.position.x,t.position.y),n.rotate(t.rotate?.angle??0),n.transform(i.a??1,i.b??0,i.c??0,i.d??1,0,0),n.fillStyle=s,n.globalAlpha=t.opacity,n.beginPath();let l=Z.get(t.shape);l?l.draw(n,t,r):Z.get("square")?.draw(n,t,r),n.closePath(),n.fill(),n.restore()}F(){let t=document.createElement("canvas");return t.id=this.id,t.style.cssText=`
10
10
  position: fixed;
11
11
  top: 0;
12
12
  left: 0;
@@ -14,4 +14,4 @@ var Ie=["#FF6B6B","#4ECDC4","#FFE66D","#95E1D3","#F38181","#AA96DA","#FCBAD3","#
14
14
  height: 100%;
15
15
  pointer-events: none;
16
16
  z-index: ${this.f.zIndex};
17
- `,document.body.appendChild(t),t}R(){if(typeof ResizeObserver>"u"){window.addEventListener("resize",this.I);return}this.o=new ResizeObserver(this.I),this.p?this.o.observe(document.body):this.canvas.parentElement&&this.o.observe(this.canvas.parentElement)}v(){let t=Oe();if(this.p){let n=document.documentElement.clientWidth,r=document.documentElement.clientHeight;this.canvas.width=n*t,this.canvas.height=r*t,this.canvas.style.width=`${n}px`,this.canvas.style.height=`${r}px`}else{let n=this.canvas.getBoundingClientRect();this.canvas.width=n.width*t,this.canvas.height=n.height*t}this.ctx.scale(t,t)}};var ye=class{constructor(){this.e=[];this.C=[];this.u=[];this.s=null}addUpdater(t){this.e.some(n=>n.id===t.id)||this.e.push(t)}addMover(t){this.C.some(n=>n.id===t.id)||this.C.push(t)}addShapeDrawer(t){Z.register(t)}getUpdaters(){return Object.freeze([...this.e])}getMovers(){return Object.freeze([...this.C])}getShapeDrawer(t){return Z.get(t)}createContainer(t){let n=new U(t);return this.u.push(n),n}getDefaultContainer(){return(!this.s||this.s.destroyed)&&(this.s=new U,this.u.push(this.s)),this.s}destroyAll(){for(let t of this.u)t.destroy();this.u.length=0,this.s=null}get containerCount(){return this.u.length}},Xe=null;function Ze(){return Xe||(Xe=new ye),Xe}var se=new Map;function gt(e,t){let n=se.get(e);if(!n||n.destroyed){let r=e==="default"?{resize:!0,...t}:{canvas:e,resize:t?.resize??!1,...t};n=new U(r),se.set(e,n)}return n}function bt(e){return{particleCount:e.particleCount??100,size:e.size??4,angle:e.angle??90,spread:e.spread??45,startVelocity:e.startVelocity??45,decay:e.decay??.94,gravity:e.gravity??1,drift:e.drift??0,flat:e.flat??!1,ticks:e.ticks??200,origin:e.origin??{x:.5,y:.5},colors:e.colors??void 0,shapes:e.shapes??void 0,scalar:e.scalar??1}}function y(e={}){if(e.disableForReducedMotion&&X())return Promise.resolve();try{return gt("default").fire(bt(e))}catch{return null}}y.create=function(e,t={}){let n=gt(e,t),r=(i={})=>{if((i.disableForReducedMotion??t.disableForReducedMotion)&&X())return Promise.resolve();try{return n.fire(bt(i))}catch{return null}};return r.reset=()=>{n.stop()},r};y.reset=function(){let e=se.get("default");e&&!e.destroyed&&e.stop()};y.fireworks=async function(e={}){let t={particleCount:30,spread:55,...e};await Promise.all([y({...t,angle:60,origin:{x:0,y:.65}}),y({...t,angle:120,origin:{x:1,y:.65}})])};y.schoolPride=function(e={}){let t=Date.now()+3e3,n=e.colors??["#bb0000","#ffffff"];function r(){y({particleCount:2,angle:60,spread:55,origin:{x:0,y:.6},colors:n,...e}),y({particleCount:2,angle:120,spread:55,origin:{x:1,y:.6},colors:n,...e}),Date.now()<t&&requestAnimationFrame(r)}r()};y.snow=function(e={}){let{duration:t=5e3,...n}=e,r=Date.now()+t;function i(){y({particleCount:1,startVelocity:0,ticks:300,gravity:.3,origin:{x:Math.random(),y:0},colors:["#ffffff","#f0f8ff","#e6f3ff"],shapes:["circle"],scalar:.8+Math.random()*.4,drift:Math.random()-.5,...n}),Date.now()<r&&requestAnimationFrame(i)}i()};y.burst=function(e,t={}){return y({particleCount:80,spread:360,startVelocity:30,decay:.92,scalar:1.2,origin:e,...t})};y.destroyAll=function(){for(let e of se.values())e.destroy();se.clear(),Ze().destroyAll()};y.getShapes=function(){return["square","circle","star","triangle","rectangle","diamond","heart","hexagon"]};function Ct(){let e=!1,t=!1,n=Promise.resolve();return{stop:()=>{e=!0,y.reset()},pause:()=>{t=!0},resume:()=>{t=!1},promise:n,addParticles:()=>{},clear:()=>{y.reset()},getParticleCount:()=>0,getState:()=>e?"stopped":t?"paused":"running"}}function K(){let[e,t]=rn(!1),n=nn(new Set);on(()=>()=>{n.current.forEach(l=>l.stop()),n.current.clear()},[]);let r=J((l,u)=>{let p={x:l.x/window.innerWidth,y:l.y/window.innerHeight},f=Ct();return n.current.add(f),t(!0),y({particleCount:u?.particleCount??100,spread:u?.direction?.spread??70,origin:p,colors:u?.particle?.colors}),setTimeout(()=>{n.current.delete(f),n.current.size===0&&t(!1)},3e3),f},[]),i=J((l,u)=>{if(!l)return null;let p=l.getBoundingClientRect(),f=document.documentElement.clientWidth,h=document.documentElement.clientHeight,E={x:(p.left+p.width/2)/f,y:(p.top+p.height/2)/h},v=Ct();return n.current.add(v),t(!0),y({particleCount:u?.particleCount??100,spread:u?.direction?.spread??70,origin:E,colors:u?.particle?.colors}),setTimeout(()=>{n.current.delete(v),n.current.size===0&&t(!1)},3e3),v},[]),o=J(()=>{n.current.forEach(l=>l.stop()),n.current.clear(),t(!1)},[]),a=J(()=>{n.current.forEach(l=>l.pause())},[]),s=J(()=>{n.current.forEach(l=>l.resume())},[]),c=J(()=>Array.from(n.current),[]);return{fire:r,fireFromElement:i,isActive:e,stopAll:o,pauseAll:a,resumeAll:s,getActiveHandles:c}}import{useEffect as Pe,useRef as le,useCallback as vt,forwardRef as wt,useImperativeHandle as an}from"react";import{jsx as Pt}from"react/jsx-runtime";function sn({active:e,origin:t,triggerRef:n,options:r,onComplete:i}){let{fire:o,fireFromElement:a}=K(),s=le(!1);return Pe(()=>{if(e&&!s.current){s.current=!0;let c=null;n?.current?c=a(n.current,r):t&&(c=o(t,r)),c&&c.promise.then(()=>{i?.()})}},[e,t,n,r,o,a,i]),Pe(()=>{e||(s.current=!1)},[e]),null}var ln=wt(({options:e,style:t},n)=>{let r=le(null),{fireFromElement:i}=K();return an(n,()=>({fire:()=>i(r.current,e)})),Pt("div",{ref:r,style:{position:"absolute",width:1,height:1,pointerEvents:"none",...t},"aria-hidden":"true"})});ln.displayName="ConfettiTrigger";var yt=wt(({children:e,confettiOptions:t,fireOnClick:n=!0,onClick:r,...i},o)=>{let a=le(null),{fireFromElement:s}=K(),c=vt(u=>{a.current=u,typeof o=="function"?o(u):o&&(o.current=u)},[o]),l=vt(u=>{n&&a.current&&s(a.current,t),r?.(u)},[n,s,t,r]);return Pt("button",{ref:c,onClick:l,...i,children:e})});yt.displayName="ConfettiButton";function cn({width:e,height:t,numberOfPieces:n=200,confettiSource:r,initialVelocityX:i,initialVelocityY:o,recycle:a=!0,run:s=!0,gravity:c=.3,wind:l=0,opacity:u=1,drawShape:p,tweenDuration:f=100,colors:h,onConfettiComplete:E,frameRate:v}){let{fire:F}=K(),g=le(null),w=le(!1);return Pe(()=>{if(!s){g.current&&(g.current.stop(),g.current=null),w.current=!1;return}if(w.current)return;w.current=!0;let d=r?{type:"rect",x:r.x,y:r.y,w:r.w??window.innerWidth,h:r.h??10}:{type:"rect",x:0,y:0,w:e??window.innerWidth,h:10},T=typeof i=="number"?[i*.5,i*1.5]:i?[i.min,i.max]:[4,10],A=typeof o=="number"?[o*.5,o*1.5]:o?[o.min,o.max]:[10,30],x=(e??window.innerWidth)/2,z=0;return g.current=F({x,y:z},{particleCount:n,particle:{colors:h??["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff"],opacity:[u*.8,u],shapes:["square","circle","rectangle"],drawShape:p},physics:{gravity:c*10,wind:l*5,windVariation:T[1]-T[0]},direction:{velocity:A},mode:"continuous",spawnArea:d,continuous:{recycle:a,numberOfPieces:n,spawnRate:30,run:s,tweenDuration:f},canvas:{width:e,height:t,frameRate:v,autoResize:!e&&!t},onComplete:E}),()=>{g.current&&(g.current.stop(),g.current=null)}},[s,e,t,n,r,i,o,a,c,l,u,p,f,h,E,v,F]),Pe(()=>{g.current},[a]),null}cn.displayName="Confetti";export{sn as ConfettiBurst,yt as ConfettiButton,he as ConfettiEngine,Ie as DEFAULT_COLORS,B as DEFAULT_CONFIG,de as DEFAULT_DIRECTION,fe as DEFAULT_PARTICLE,ue as DEFAULT_PHYSICS,Re as DIRECTION_ANGLES,xt as EASING_FUNCTIONS,_ as clamp,y as confetti,ut as createConfettiExplosion,y as default,S as degToRad,Zt as fireFromElement,Kt as forceCleanup,Jt as getActiveAnimationCount,pe as getDirectionAngle,Mt as getElementCenter,$ as isBrowser,Et as lerp,Fe as mergeConfig,re as parseColor,Ft as radToDeg,ne as randomFromArray,m as randomInRange,Rt as randomInt,ie as rgbaToString,K as useConfetti};
17
+ `,document.body.appendChild(t),t}E(){if(typeof ResizeObserver>"u"){this.C=!0,window.addEventListener("resize",this.v);return}this.o=new ResizeObserver(this.v),this.p?this.o.observe(document.body):this.canvas.parentElement&&this.o.observe(this.canvas.parentElement)}I(){let t=oe();if(this.p){let n=document.documentElement.clientWidth,r=document.documentElement.clientHeight;this.canvas.width=n*t,this.canvas.height=r*t,this.canvas.style.width=`${n}px`,this.canvas.style.height=`${r}px`}else{let n=this.canvas.getBoundingClientRect();this.canvas.width=n.width*t,this.canvas.height=n.height*t}this.ctx.setTransform(t,0,0,t,0,0)}};var Fe=class{constructor(){this.e=[];this.P=[];this.u=[];this.s=null}addUpdater(t){this.e.some(n=>n.id===t.id)||this.e.push(t)}addMover(t){this.P.some(n=>n.id===t.id)||this.P.push(t)}addShapeDrawer(t){Z.register(t)}getUpdaters(){return Object.freeze([...this.e])}getMovers(){return Object.freeze([...this.P])}getShapeDrawer(t){return Z.get(t)}createContainer(t){let n=new U(t);return this.u.push(n),n}getDefaultContainer(){return(!this.s||this.s.destroyed)&&(this.s=new U,this.u.push(this.s)),this.s}destroyAll(){for(let t of this.u)t.destroy();this.u.length=0,this.s=null}get containerCount(){return this.u.length}},et=null;function tt(){return et||(et=new Fe),et}var ae=new Map;function Tt(e,t){let n=ae.get(e);if(!n||n.destroyed){let r=e==="default"?{resize:!0,...t}:{canvas:e,resize:t?.resize??!1,...t};n=new U(r),ae.set(e,n)}return n}function Ft(e){return{particleCount:e.particleCount??100,size:e.size??4,angle:e.angle??90,spread:e.spread??45,startVelocity:e.startVelocity??45,decay:e.decay??.94,gravity:e.gravity??1,drift:e.drift??0,flat:e.flat??!1,ticks:e.ticks??200,origin:e.origin??{x:.5,y:.5},colors:e.colors??void 0,shapes:e.shapes??void 0,scalar:e.scalar??1}}function S(e={}){if(e.disableForReducedMotion&&X())return Promise.resolve();try{return Tt("default").fire(Ft(e))}catch{return null}}S.create=function(e,t={}){let n=Tt(e,t),r=(i={})=>{if((i.disableForReducedMotion??t.disableForReducedMotion)&&X())return Promise.resolve();try{return n.fire(Ft(i))}catch{return null}};return r.reset=()=>{n.stop()},r};S.reset=function(){let e=ae.get("default");e&&!e.destroyed&&e.stop()};S.fireworks=async function(e={}){let t={particleCount:30,spread:55,...e},n=S({...t,angle:60,origin:{x:0,y:.65}}),r=S({...t,angle:120,origin:{x:1,y:.65}}),i=[];n&&i.push(n),r&&i.push(r),i.length>0&&await Promise.all(i)};S.schoolPride=function(e={}){let t=Date.now()+3e3,n=e.colors??["#bb0000","#ffffff"],r=null,i=!1;function o(){i||(S({particleCount:2,angle:60,spread:55,origin:{x:0,y:.6},colors:n,...e}),S({particleCount:2,angle:120,spread:55,origin:{x:1,y:.6},colors:n,...e}),Date.now()<t&&!i&&(r=requestAnimationFrame(o)))}return o(),{cancel(){i=!0,r!==null&&(cancelAnimationFrame(r),r=null)}}};S.snow=function(e={}){let{duration:t=5e3,...n}=e,r=Date.now()+t,i=null,o=!1;function a(){o||(S({particleCount:1,startVelocity:0,ticks:300,gravity:.3,origin:{x:C(),y:0},colors:["#ffffff","#f0f8ff","#e6f3ff"],shapes:["circle"],scalar:.8+C()*.4,drift:C()-.5,...n}),Date.now()<r&&!o&&(i=requestAnimationFrame(a)))}return a(),{cancel(){o=!0,i!==null&&(cancelAnimationFrame(i),i=null)}}};S.burst=function(e,t={}){return S({particleCount:80,spread:360,startVelocity:30,decay:.92,scalar:1.2,origin:e,...t})};S.destroyAll=function(){for(let e of ae.values())e.destroyed||e.destroy();ae.clear(),tt().destroyAll()};S.getShapes=function(){return["square","circle","star","triangle","rectangle","diamond","heart","hexagon"]};var xt={rainbow:J,pride:["#E40303","#FF8C00","#FFED00","#008026","#24408E","#732982"],christmas:["#C41E3A","#165B33","#FFD700","#FFFFFF","#BB2528"],halloween:["#FF6600","#000000","#8B008B","#00FF00","#FFD700"],pastel:["#FFB3BA","#FFDFBA","#FFFFBA","#BAFFC9","#BAE1FF"],neon:["#FF00FF","#00FFFF","#FF0080","#80FF00","#FF8000"],gold:["#FFD700","#DAA520","#B8860B","#FFC125","#FFDF00"],silver:["#C0C0C0","#A8A8A8","#D3D3D3","#DCDCDC","#E8E8E8"],hearts:["#FF69B4","#FF1493","#FF007F","#DC143C","#FFB6C1"],ocean:["#006994","#00CED1","#20B2AA","#48D1CC","#87CEEB"]},K={celebration:["🎉","🎊","🥳","✨","🎈"],hearts:["❤️","💕","💖","💗","💓","💘"],stars:["⭐","🌟","✨","💫","⚡"],money:["💰","💵","💸","🤑","💎"],christmas:["🎄","🎅","🎁","❄️","⭐"],halloween:["🎃","👻","🦇","🕷️","💀"],birthday:["🎂","🎁","🎈","🎉","🥳"],food:["🍕","🍔","🍟","🌭","🍿"]},nt={default:{name:"default",description:"Default balanced confetti burst with realistic paper physics",options:{particleCount:60,particle:{shapes:["square","rectangle","circle"],size:[6,14],depth3D:.6,tilt:[-30,30]},physics:{gravity:.25,drag:.035,wobble:!0,wobbleSpeed:1.5}}},celebration:{name:"celebration",description:"Big celebration with lots of colorful confetti and realistic movement",options:{particleCount:120,particle:{colors:[...J],shapes:["square","rectangle","circle","star"],size:[8,16],lifespan:5e3,depth3D:.7,tilt:[-35,35]},direction:{direction:"radial",spread:360,velocity:[30,55]},physics:{gravity:.22,drag:.04,wobble:!0,wobbleSpeed:2,windVariation:.03}}},firework:{name:"firework",description:"Firework-style explosion with secondary bursts",options:{mode:"firework",particleCount:80,particle:{colors:[...xt.neon],shapes:["circle","star"],size:[4,8],trail:{enabled:!0,length:8,fade:.6},glow:{enabled:!0,blur:8,intensity:.7}},firework:{secondaryExplosions:!0,burstCount:80}}},snow:{name:"snow",description:"Gentle falling snowflakes",options:{mode:"snow",particleCount:150,particle:{colors:["#FFFFFF","#F0F8FF","#E0FFFF"],shapes:["circle"],size:[3,8],lifespan:8e3,opacity:[.6,1]},physics:{gravity:.05,wind:.3,windVariation:.2,wobble:!0,wobbleSpeed:2},continuous:{recycle:!0,numberOfPieces:150}}},rain:{name:"rain",description:"Rainfall effect",options:{mode:"rain",particleCount:200,particle:{colors:["#6CA0DC","#4A90D9","#2E7BB9"],shapes:["line"],size:[2,4],lifespan:2e3},physics:{gravity:.8,wind:.1},direction:{direction:"down",spread:10,velocity:[30,50]},continuous:{recycle:!0}}},sparkle:{name:"sparkle",description:"Sparkling stars with glow effect",options:{particleCount:40,particle:{colors:["#FFD700","#DAA520","#B8860B","#FFC125","#FFDF00"],shapes:["star"],size:[6,12],glow:{enabled:!0,blur:15,intensity:.8}},physics:{gravity:.1},direction:{direction:"radial",spread:360,velocity:[30,60]}}},confetti:{name:"confetti",description:"Classic confetti falling with realistic paper flutter",options:{mode:"continuous",particleCount:200,particle:{shapes:["square","rectangle"],size:[6,14],depth3D:.8,tilt:[-40,40],lifespan:6e3},physics:{gravity:.18,drag:.045,wind:.08,windVariation:.04,wobble:!0,wobbleSpeed:2},continuous:{recycle:!0,numberOfPieces:200},spawnArea:{x:0,y:0,width:1920,height:0}}},emoji:{name:"emoji",description:"Emoji celebration",options:{particleCount:30,particle:{images:K.celebration.map(e=>({src:e,isEmoji:!0,scale:1.5})),size:[20,30],lifespan:4e3},direction:{direction:"up",spread:60,velocity:[20,35]}}},hearts:{name:"hearts",description:"Floating hearts",options:{particleCount:50,particle:{colors:["#FF69B4","#FF1493","#FF007F","#DC143C","#FFB6C1"],shapes:["heart"],size:[12,20],lifespan:5e3},physics:{gravity:-.1,wobble:!0},direction:{direction:"up",spread:90,velocity:[10,20]}}},stars:{name:"stars",description:"Shooting stars",options:{particleCount:60,particle:{colors:["#FFD700","#FFFFFF"],shapes:["star"],size:[8,16],trail:{enabled:!0,length:12,fade:.4}},direction:{direction:"radial",spread:360,velocity:[30,60]}}},money:{name:"money",description:"Money rain",options:{particleCount:40,particle:{colors:["#85BB65","#228B22","#32CD32"],images:K.money.map(e=>({src:e,isEmoji:!0})),size:[20,30],lifespan:4e3},physics:{gravity:.15,wobble:!0}}},pride:{name:"pride",description:"Pride rainbow celebration",options:{particleCount:100,particle:{colors:[...xt.pride],shapes:["square","rectangle","heart"],size:[10,16]},direction:{direction:"radial",spread:360,velocity:[25,45]}}},christmas:{name:"christmas",description:"Christmas celebration",options:{particleCount:80,particle:{colors:["#C41E3A","#165B33","#FFD700","#FFFFFF","#BB2528"],shapes:["star","circle"],size:[8,14],images:K.christmas.map(e=>({src:e,isEmoji:!0}))}}},halloween:{name:"halloween",description:"Spooky Halloween",options:{particleCount:60,particle:{colors:["#FF6600","#000000","#8B008B","#00FF00","#FFD700"],shapes:["circle","star"],images:K.halloween.map(e=>({src:e,isEmoji:!0})),size:[15,25]},physics:{gravity:.2,wobble:!0}}},newYear:{name:"newYear",description:"New Year celebration with fireworks",options:{mode:"firework",particleCount:100,particle:{colors:["#FFD700","#DAA520","#B8860B","#FFC125","#FFDF00","#C0C0C0","#A8A8A8"],shapes:["star","circle"],size:[6,12],trail:{enabled:!0,length:10},glow:{enabled:!0,blur:12}},firework:{secondaryExplosions:!0,burstCount:100}}},birthday:{name:"birthday",description:"Birthday party celebration",options:{particleCount:80,particle:{colors:["#FFB3BA","#FFDFBA","#FFFFBA","#BAFFC9","#BAE1FF","#E40303","#FF8C00","#FFED00","#008026","#24408E","#732982"],shapes:["star","circle","heart"],images:K.birthday.map(e=>({src:e,isEmoji:!0})),size:[12,20],lifespan:5e3},direction:{direction:"up",spread:80,velocity:[25,45]}}}};function Fr(e){let t=nt[e];if(!t)throw new Error(`Preset "${e}" not found. Available presets: ${Object.keys(nt).join(", ")}`);return t}function xr(){return Object.keys(nt)}function Er(e){let t={};if(e.particleCount!==void 0&&(t.particleCount=e.particleCount),e.particle?.colors&&(t.colors=e.particle.colors),e.particle?.shapes&&(t.shapes=e.particle.shapes),e.particle?.size){let n=e.particle.size;Array.isArray(n)&&(t.size=(n[0]+n[1])/2)}if(e.physics?.gravity!==void 0&&(t.gravity=e.physics.gravity),e.physics?.wind!==void 0&&(t.drift=e.physics.wind),e.direction?.spread!==void 0&&(t.spread=e.direction.spread),e.direction?.direction){let n=e.direction.direction;n==="custom"&&e.direction.angle!==void 0?t.angle=e.direction.angle:n!=="radial"&&n!=="custom"&&(t.angle=Q[n]),n==="radial"&&t.spread===void 0&&(t.spread=360)}if(e.direction?.velocity){let n=e.direction.velocity;Array.isArray(n)&&(t.startVelocity=(n[0]+n[1])/2)}return e.scalar!==void 0&&(t.scalar=e.scalar),e.flat!==void 0&&(t.flat=e.flat),e.drift!==void 0&&(t.drift=e.drift),e.ticks!==void 0&&(t.ticks=e.ticks),e.zIndex!==void 0&&(t.zIndex=e.zIndex),t}function Tn(e){let{path:t,matrix:n,fillColor:r,strokeColor:i,strokeWidth:o}=e,a=En(t);return{type:"path",path:t,matrix:n?[...n]:void 0,fillColor:r,strokeColor:i,strokeWidth:o,bounds:a}}function Et(e){let{text:t,scalar:n=1,color:r,fontFamily:i="serif",fontWeight:o="normal",fontStyle:a="normal"}=e;return{type:"text",text:t,scalar:n,color:r,fontFamily:i,fontWeight:String(o),fontStyle:a}}async function Fn(e){let{src:t,width:n,height:r,scalar:i=1}=e;if(typeof t!="string")return{type:"image",src:t.src,image:t,scalar:i,width:n,height:r};let o=await An(t);return{type:"image",src:t,image:o,scalar:i,width:n,height:r}}function xn(e,t={}){return e.map(n=>Et({...t,text:n}))}function En(e){let t=e.match(/-?\d*\.?\d+/g);if(!t||t.length<2)return{minX:-1,minY:-1,maxX:1,maxY:1};let n=1/0,r=1/0,i=-1/0,o=-1/0;for(let a=0;a<t.length-1;a+=2){let s=parseFloat(t[a]),l=parseFloat(t[a+1]);!isNaN(s)&&!isNaN(l)&&(n=Math.min(n,s),r=Math.min(r,l),i=Math.max(i,s),o=Math.max(o,l))}return isFinite(n)?{minX:n,minY:r,maxX:i,maxY:o}:{minX:-1,minY:-1,maxX:1,maxY:1}}function An(e){return new Promise((t,n)=>{let r=new Image;r.crossOrigin="anonymous",r.onload=()=>t(r),r.onerror=()=>n(new Error(`Failed to load image: ${e}`)),r.src=e})}export{xt as COLOR_PALETTES,Ct as Confetti,bn as ConfettiBurst,gt as ConfettiButton,vn as ConfettiCannon,ge as ConfettiEngine,yn as ConfettiOnMount,ht as ConfettiTrigger,At as DEFAULT_ACCESSIBILITY,fe as DEFAULT_CANVAS,J as DEFAULT_COLORS,_ as DEFAULT_CONFIG,xe as DEFAULT_CONTINUOUS,ce as DEFAULT_DIRECTION,Ee as DEFAULT_FIREWORK,de as DEFAULT_GLOW,ue as DEFAULT_PARTICLE,le as DEFAULT_PHYSICS,N as DEFAULT_TRAIL,Q as DIRECTION_ANGLES,Rt as EASING_FUNCTIONS,K as EMOJI_SETS,nt as PRESETS,T as clamp,S as confetti,Ce as createConfettiExplosion,S as default,E as degToRad,Be as fireFromElement,dn as forceCleanup,un as getActiveAnimationCount,pe as getDirectionAngle,_t as getElementCenter,on as getMaxPoolSize,Fr as getPreset,xr as getPresetNames,G as isBrowser,Se as lerp,De as mergeConfig,ne as parseColor,Er as presetToCanvasOptions,Oe as radToDeg,te as randomFromArray,b as randomInRange,St as randomInt,re as rgbaToString,rn as setMaxPoolSize,Fn as shapeFromImage,Tn as shapeFromPath,Et as shapeFromText,xn as shapesFromEmoji,M as useConfetti,gn as useConfettiCenter,mn as useConfettiOnCondition,hn as useConfettiSequence,pn as useConfettiTrigger};