react-confetti-burst 1.0.6 → 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 Fe=Object.defineProperty;var _t=Object.getOwnPropertyDescriptor;var Bt=Object.getOwnPropertyNames;var Lt=Object.prototype.hasOwnProperty;var Nt=(e,t)=>{for(var n in t)Fe(e,n,{get:t[n],enumerable:!0})},kt=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Bt(t))!Lt.call(e,o)&&o!==n&&Fe(e,o,{get:()=>t[o],enumerable:!(r=_t(t,o))||r.enumerable});return e};var Ht=e=>kt(Fe({},"__esModule",{value:!0}),e);var Fn={};Nt(Fn,{COLOR_PALETTES:()=>et,ConfettiBurst:()=>It,ConfettiButton:()=>Oe,ConfettiEngine:()=>ae,DEFAULT_COLORS:()=>q,DEFAULT_CONFIG:()=>_,DEFAULT_DIRECTION:()=>te,DEFAULT_PARTICLE:()=>ne,DEFAULT_PHYSICS:()=>ee,DIRECTION_ANGLES:()=>fe,EASING_FUNCTIONS:()=>at,EMOJI_SETS:()=>G,PRESETS:()=>Te,clamp:()=>B,confetti:()=>x,createConfettiExplosion:()=>se,default:()=>x,degToRad:()=>O,fireFromElement:()=>ge,forceCleanup:()=>Pt,getActiveAnimationCount:()=>wt,getDirectionAngle:()=>oe,getElementCenter:()=>ut,getMaxPoolSize:()=>vt,getPreset:()=>wn,getPresetNames:()=>Pn,isBrowser:()=>U,lerp:()=>lt,mergeConfig:()=>me,parseColor:()=>$,radToDeg:()=>ct,randomFromArray:()=>V,randomInRange:()=>h,randomInt:()=>st,rgbaToString:()=>j,setMaxPoolSize:()=>yt,shapeFromImage:()=>Dt,shapeFromPath:()=>Ot,shapeFromText:()=>tt,shapesFromEmoji:()=>Mt,useConfetti:()=>W});module.exports=Ht(Fn);var q=["#FF6B6B","#4ECDC4","#FFE66D","#95E1D3","#F38181","#AA96DA","#FCBAD3","#A8D8EA","#FF9A8B","#88D8B0"],ee={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},te={direction:"up",spread:55,velocity:[25,50],velocityDecay:.92},ne={colors:q,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},xe={enabled:!1,blur:10,color:null,intensity:.5},nt={recycle:!1,numberOfPieces:200,spawnRate:50,run:!0,tweenDuration:5e3},rt={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:ne,physics:ee,direction:te,mode:"burst",easing:"easeOut",zIndex:9999,autoCleanup:!0,scalar:1,drift:0,flat:!1},fe={up:90,down:270,left:180,right:0},T={DEG_TO_RAD:Math.PI/180,RAD_TO_DEG:180/Math.PI,TWO_PI:Math.PI*2,HALF_PI:Math.PI/2},g={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 re={r:0,g:0,b:0,a:0},Re={MAX_PARTICLES:500,FRAME_BUDGET:16.67,MIN_OPACITY:.01,MIN_SIZE:.5,MAX_DPR:2},ot=100,Ae=5,it=.5;var at={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 h(e,t){return e+C()*(t-e)}function st(e,t){return Math.floor(h(e,t+1))}function V(e){if(e.length===0)throw new Error("Cannot pick from empty array");return e[Math.floor(C()*e.length)]}function B(e,t,n){return Math.min(Math.max(e,t),n)}function lt(e,t,n){return e+(t-e)*B(n,0,1)}function O(e){return e*T.DEG_TO_RAD}function ct(e){return e*T.RAD_TO_DEG}function $(e){if(typeof e=="object"&&"r"in e)return{r:B(Math.round(e.r),0,255),g:B(Math.round(e.g),0,255),b:B(Math.round(e.b),0,255),a:B(e.a,0,1)};if(typeof e=="object"&&"type"in e)return $(e.colors[0]);let t=e.trim().toLowerCase();return t.startsWith("#")?zt(t):t.startsWith("rgb")?Ut(t):Wt(t)}function zt(e){let t=e.slice(1),n,r,o,i=1;switch(t.length){case 3:n=parseInt(t[0]+t[0],16),r=parseInt(t[1]+t[1],16),o=parseInt(t[2]+t[2],16);break;case 4:n=parseInt(t[0]+t[0],16),r=parseInt(t[1]+t[1],16),o=parseInt(t[2]+t[2],16),i=parseInt(t[3]+t[3],16)/255;break;case 6:n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),o=parseInt(t.slice(4,6),16);break;case 8:n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),o=parseInt(t.slice(4,6),16),i=parseInt(t.slice(6,8),16)/255;break;default:return re}return isNaN(n)||isNaN(r)||isNaN(o)||isNaN(i)?re:{r:n,g:r,b:o,a:i}}function Ut(e){let t=e.match(/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/);return t?{r:B(parseInt(t[1],10),0,255),g:B(parseInt(t[2],10),0,255),b:B(parseInt(t[3],10),0,255),a:t[4]!==void 0?B(parseFloat(t[4]),0,1):1}:re}function Wt(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 o=r.getImageData(0,0,1,1).data;return{r:o[0],g:o[1],b:o[2],a:o[3]/255}}}catch{}return re}function j(e){return`rgba(${e.r}, ${e.g}, ${e.b}, ${e.a})`}function oe(e,t){if(e==="custom"&&t!==void 0)return O(t);if(e==="radial")return C()*T.TWO_PI;let n=fe[e];return O(n??90)}function ut(e){let t=e.getBoundingClientRect();return{x:t.left+t.width/2,y:t.top+t.height/2}}function me(e){if(!e)return _;let t={...ne,...e.particle},n={...ee,...e.physics},r={...te,...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 U(){return typeof window<"u"&&typeof document<"u"}function dt(e=2){return U()?Math.min(window.devicePixelRatio||1,e):1}function ft(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}var Gt=0,mt=!1;function X(e,t,n,r,o,i,a,s,c,l,u){if(o.length===0)throw new Error("Colors array cannot be empty");if(i.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 f=h(a[0],a[1]),m=h(s[0],s[1]),p=V(o),I=typeof p=="string"?$(p):"type"in p?$(p.colors[0]):p,E=1+(C()-.5)*g.VELOCITY_VARIATION_RANGE,F=Math.cos(n)*r*E,y=-Math.sin(n)*r*E,w;u?.images&&u.images.length>0&&(w=V(u.images));let d=u?.tiltRange??[-30,30],R=u?.spinSpeedRange??[-15,15],A=u?.aspectRatioRange??[.5,1.5],S=h(A[0],A[1]);return{id:Gt++,x:e,y:t,vx:F,vy:y,size:f,originalSize:f,rotation:C()*T.TWO_PI,rotationSpeed:(C()-.5)*.3*l,color:I,shape:w?"custom":V(i),opacity:m,originalOpacity:m,life:c,maxLife:c,active:!0,image:w,imageElement:null,trail:[],wobblePhase:C()*T.TWO_PI,wobbleSpeed:h(.8,2.5),tilt:O(h(d[0],d[1])),tiltSpeed:h(R[0],R[1])*.015,depth:u?.depth3D??.6,hasExploded:!1,data:{},flutterPhase:C()*T.TWO_PI,flutterSpeed:h(1.5,3.5),swayPhase:C()*T.TWO_PI,aspectRatio:S,angularVelocity:(C()-.5)*.4,scaleX:1,scaleY:1,shimmerPhase:C()*T.TWO_PI,currentDrag:h(.02,.05)}}function pt(e,t,n,r,o,i,a){if(!e.active)return;let s=t*.05988;(i?.enabled??N.enabled)&&Yt(e,i??N),qt(e,s,n),Jt(e,s,n),Kt(e,t,n,r,o),n.floor!==null&&n.bounce>0&&a&&Qt(e,n,a),(e.life<=0||e.opacity<g.MIN_OPACITY_THRESHOLD||e.size<g.MIN_SIZE_THRESHOLD)&&(e.active=!1)}function Yt(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 qt(e,t,n){let r=e.vx,o=e.vy,i=e.tilt,a=r*r+o*o;Vt(e,o,i,n,t),o=e.vy,$t(e,r,o,i,a,n,t),r=e.vx,o=e.vy,jt(e,r,n,t),r=e.vx,Xt(e,n,t),r=e.vx,Zt(e,r,o,i,a,n),r=e.vx,o=e.vy,e.x+=r*t,e.y+=o*t}function Vt(e,t,n,r,o){let a=1+(n-n*n*n*g.SIN_TAYLOR_COEFF)*g.GRAVITY_TILT_MODIFIER;e.vy=t+r.gravity*a*o}function $t(e,t,n,r,o,i,a){if(!(i.flutter??!0)||o<=1)return;let c=i.flutterSpeed??2.5,l=i.flutterIntensity??.4;e.flutterPhase+=c*g.FLUTTER_PHASE_SCALE*a;let u=e.flutterPhase,m=(u-u*u*u*g.SIN_TAYLOR_COEFF)*l*a,p=1-r*r*g.COS_TAYLOR_COEFF;e.vx=t+m*p;let I=r-r*r*r*g.SIN_TAYLOR_COEFF;if((I<0?-I:I)>g.FLUTTER_AIR_CATCH_THRESHOLD){let F=m<0?-m:m;e.vy=n-F*g.FLUTTER_AIR_CATCH_MULTIPLIER}}function jt(e,t,n,r){let o=n.swayAmplitude??15,i=n.swayFrequency??2;e.swayPhase+=i*g.SWAY_PHASE_SCALE*r;let a=e.swayPhase,s=(a-a*a*a*g.SIN_TAYLOR_COEFF)*o*g.SWAY_FORCE_SCALE*r;e.vx=t+s}function Xt(e,t,n){let r=t.windVariation,o=t.wind+r*(Math.random()-.5);e.vx+=o*n}function Zt(e,t,n,r,o,i){let a=i.airResistance??.03,s=1-r*r*g.COS_TAYLOR_COEFF,c=s<0?-s:s,l=i.drag+c*a,u=o>0?Math.sqrt(o):0,m=Math.max(.9,1-l*u*.01)*i.friction*i.decay;e.vx=t*m,e.vy=n*m}function Jt(e,t,n){if(n.tumble&&(e.angularVelocity=(e.angularVelocity+e.vx*.001*t)*g.ANGULAR_DAMPING,e.rotation+=(e.rotationSpeed+e.angularVelocity)*t),e.tiltSpeed=(e.tiltSpeed+(Math.random()-.5)*.002*t)*g.TILT_DAMPING,e.tilt=(e.tilt+e.tiltSpeed*t)%T.TWO_PI,n.wobble){let r=e.wobblePhase+n.wobbleSpeed*.1*t;e.wobblePhase=r;let o=1-r*r*g.COS_TAYLOR_COEFF,i=r-r*r*r*g.SIN_TAYLOR_COEFF;e.scaleX=.3+.7*(o<0?-o:o),e.scaleY=.3+.7*(i<0?-i:i)}e.shimmerPhase+=.1*t}function Kt(e,t,n,r,o){t>0&&(e.life-=t);let i=1-e.life/e.maxLife;if(r){let a=i,s=a*a*(3-2*a);e.opacity=e.originalOpacity*(1-s*.9)}o&&(e.size=e.originalSize*(1-i*.5))}function Qt(e,t,n){let r=t.floor??n,o=e.size*.5;e.y+o>=r&&(e.y=r-o,e.vy=-e.vy*t.bounce,e.vx*=.85,e.rotationSpeed+=(Math.random()-.5)*.1)}function ht(e,t,n){if(!t.active)return;let{x:r,y:o,size:i,rotation:a,color:s,shape:c,opacity:l,tilt:u,aspectRatio:f,scaleX:m,scaleY:p,shimmerPhase:I}=t;if(l<g.MIN_OPACITY_THRESHOLD)return;let E=n?.trailConfig,F=n?.glowConfig;(E?.enabled??N.enabled)&&t.trail.length>0&&en(e,t,E??N),e.save();let y=F?.enabled??xe.enabled;y&&(e.shadowBlur=F?.blur??xe.blur,e.shadowColor=F?.color??j(s)),e.translate(r,o),e.rotate(a+u),t.depth>0&&e.scale(m,p);let d=1+(I-Math.floor(I))*g.SHIMMER_RANGE-g.SHIMMER_OFFSET,R=g.ORIENTATION_OPACITY_BASE+g.ORIENTATION_OPACITY_SCALE*(m*p<0?-(m*p):m*p),A=l*s.a*R*(y?F?.intensity??1:1);if(A<g.MIN_OPACITY_THRESHOLD){e.restore();return}e.globalAlpha=A>1?1:A;let S=s.r*d,Y=s.g*d,ue=s.b*d;if(e.fillStyle=`rgb(${S>255?255:S},${Y>255?255:Y},${ue>255?255:ue})`,t.image&&t.image.isEmoji)un(e,t.image.src,i*(t.image.scale??1));else if(t.imageElement)dn(e,t.imageElement,i*(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};try{n.customDraw(L)}catch{mt||(mt=!0)}}else{let L=f??1;switch(c){case"square":case"rectangle":let Q=i*(c==="rectangle"?Math.max(1.5,L*1.5):Math.sqrt(L)),de=i/(c==="rectangle"?Math.max(1.5,L):Math.sqrt(L));e.fillRect(-Q*.5,-de*.5,Q,de);break;case"circle":e.beginPath(),e.arc(0,0,i*.5,0,T.TWO_PI),e.fill();break;case"triangle":tn(e,i);break;case"star":nn(e,i);break;case"line":rn(e,i);break;case"heart":on(e,i);break;case"diamond":an(e,i);break;case"hexagon":sn(e,i);break;case"spiral":ln(e,i,s);break;case"ribbon":cn(e,i);break;default:e.fillRect(-i*.5,-i*.5,i,i)}}e.restore()}function en(e,t,n){let r=n.fade??N.fade,o=n.width??N.width;e.save(),e.lineCap="round",e.lineJoin="round";for(let i=0;i<t.trail.length-1;i++){let a=t.trail[i],s=t.trail[i+1],c=a.opacity*Math.pow(r,i),l=a.size*o*Math.pow(r,i);c>.01&&l>.1&&(e.beginPath(),e.strokeStyle=j({...t.color,a:c}),e.lineWidth=l,e.moveTo(a.x,a.y),e.lineTo(s.x,s.y),e.stroke())}e.restore()}function tn(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 nn(e,t){let n=t/2,r=n*it,o=Math.PI/Ae;e.beginPath();for(let i=0;i<Ae*2;i++){let a=i%2===0?n:r,s=i*o-T.HALF_PI,c=Math.cos(s)*a,l=Math.sin(s)*a;i===0?e.moveTo(c,l):e.lineTo(c,l)}e.closePath(),e.fill()}function rn(e,t){let n=t*2,r=t/4;e.fillRect(-n/2,-r/2,n,r)}function on(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 an(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 sn(e,t){let n=t/2;e.beginPath();for(let r=0;r<6;r++){let o=Math.PI/3*r-Math.PI/6,i=Math.cos(o)*n,a=Math.sin(o)*n;r===0?e.moveTo(i,a):e.lineTo(i,a)}e.closePath(),e.fill()}function ln(e,t,n){e.strokeStyle=j(n),e.lineWidth=t/8,e.lineCap="round",e.beginPath();for(let r=0;r<22;r++){let o=.35*r,i=(.2+1.5*o)*(t/20),a=i*Math.cos(o),s=i*Math.sin(o);r===0?e.moveTo(a,s):e.lineTo(a,s)}e.stroke()}function cn(e,t){let n=t,r=t/3,o=t/4;e.beginPath(),e.moveTo(-n/2,0),e.quadraticCurveTo(-n/4,-o,0,0),e.quadraticCurveTo(n/4,o,n/2,0),e.lineTo(n/2,r),e.quadraticCurveTo(n/4,r+o,0,r),e.quadraticCurveTo(-n/4,r-o,-n/2,r),e.closePath(),e.fill()}function un(e,t,n){e.font=`${n}px serif`,e.textAlign="center",e.textBaseline="middle",e.fillText(t,0,0)}function dn(e,t,n){let r=n/2;e.drawImage(t,-r,-r,n,n)}function gt(e){return e.filter(t=>t.active).length}var b=null,k=null,Z=0;var ie=null,pe=[],he=500;function yt(e){for(he=Math.max(1,Math.floor(e));pe.length>he;)pe.pop()}function vt(){return he}function bt(e){pe.length<he&&(e.active=!1,e.trail.length=0,pe.push(e))}var Se=360,fn=new Float32Array(Se),mn=new Float32Array(Se);for(let e=0;e<Se;e++){let t=e*Math.PI/180;fn[e]=Math.sin(t),mn[e]=Math.cos(t)}function pn(e,t){if(!U())throw new Error("ConfettiEngine requires a browser environment");let n={...Ee,...t},r=n.pixelRatio??dt(Re.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
- `,k=b.getContext("2d",{alpha:!0,desynchronized:!0}),!k)throw new Error("Failed to get canvas 2D context");document.body.appendChild(b),n.autoResize&&(ie=()=>{if(b&&k){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`,k.scale(r,r)}},window.addEventListener("resize",ie))}b.style.zIndex=String(e);let o=n.width??window.innerWidth,i=n.height??window.innerHeight;return(b.width!==o*r||b.height!==i*r)&&(b.width=o*r,b.height=i*r,b.style.width=`${o}px`,b.style.height=`${i}px`,k.scale(r,r)),{canvas:b,ctx:k,width:o,height:i,dpr:r}}function hn(){b&&Z===0&&setTimeout(()=>{Z===0&&b&&(ie&&(window.removeEventListener("resize",ie),ie=null),b.remove(),b=null,k=null)},ot)}function Ct(e,t,n){let{type:r,x:o,y:i,w:a,h:s}=e;switch(r){case"point":return{x:o,y:i};case"rect":return{x:h(o,o+(a??0)),y:h(i,i+(s??0))};case"line":let c=C();return{x:o+c*(a??0),y:i+c*(s??0)};case"circle":let l=C()*T.TWO_PI,u=Math.sqrt(C())*(a??50);return{x:o+Math.cos(l)*u,y:i+Math.sin(l)*u};default:return{x:o,y:i}}}var ae=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=ft();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:o,height:i,dpr:a}=this.canvasContext,{physics:s,particle:c}=this.config;r.setTransform(1,0,0,1,0,0),r.clearRect(0,0,o*a,i*a),r.scale(a,a);let l=this.particles,u=l.length,f=0,m=!0,p=100,I=-p,E=o+p,F=-p,y=i+p;for(let w=0;w<u;w++){let d=l[w];if(d.active){if(pt(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<I||d.x>E||d.y<F||d.y>y){(d.y>y||d.x<I-200||d.x>E+200)&&(d.active=!1);continue}ht(r,d,{customDraw:this.drawShape}),f++,m=!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-f;if(A>0){for(let S=u-1;S>=0&&A>0;S--)l[S].active||(bt(l[S]),l.splice(S,1));this.spawnParticles(Math.min(A,5))}}else f<this.continuousConfig.numberOfPieces&&this.spawnParticles(Math.min(3,this.continuousConfig.numberOfPieces-f));this.lastSpawnTime=t}}if(this.mode==="firework"){let w=0;for(let R=0;R<u;R++)l[R].active&&l[R].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")&&m){this.complete();return}this.animationFrameId=requestAnimationFrame(this.animate)};this.origin=t,this.config=me(n),this.mode=n?.mode??"burst",this.spawnArea=n?.spawnArea,this.continuousConfig={...nt,...n?.continuous},this.fireworkConfig={...rt,...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(!U())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,Z++,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:o}=this.config,{x:i,y:a}=this.origin,s=Math.min(t,Re.MAX_PARTICLES);for(let c=0;c<s;c++){let l;if(r.direction==="radial")l=C()*T.TWO_PI;else{let m=oe(r.direction,r.angle),p=O(r.spread);l=m+(C()-.5)*p}let u=h(r.velocity[0],r.velocity[1]),f=X(i,a,l,u,n.colors,n.shapes,n.size,n.opacity,n.lifespan,o.rotationSpeed,{images:n.images,tiltRange:n.tilt,spinSpeedRange:n.spinSpeed,depth3D:n.depth3D});this.particles.push(f)}}spawnParticles(t){if(!this.canvasContext)return;let{particle:n,physics:r}=this.config,{width:o,height:i}=this.canvasContext;for(let a=0;a<t;a++){let s;this.spawnArea?s=Ct(this.spawnArea,o,i):this.mode==="snow"||this.mode==="rain"?s={x:h(0,o),y:-20}:s={x:h(0,o),y:h(-20,0)};let c,l;this.mode==="snow"?(c=O(h(-20,20)-90),l=h(.5,2)):this.mode==="rain"?(c=O(-90),l=h(8,15)):(c=C()*T.TWO_PI,l=h(2,6));let u=X(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:o,spread:i,secondaryExplosions:a,rocketColors:s,burstColors:c,trailLength:l}=this.fireworkConfig,u=this.spawnArea?Ct(this.spawnArea,t,n).x:h(t*.2,t*.8),f=n*(1-r),m=u+h(-50,50),p=X(u,n,O(-90+h(-10,10)),h(15,25),s,["circle"],[3,5],[1,1],2e3,0);p.data={isRocket:!0,targetY:f,targetX:m,burstCount:o,spread:i,burstColors:c,secondaryExplosions:a,trailLength:l},this.particles.push(p)}explodeFirework(t,n,r){let{burstCount:o=80,spread:i=360,burstColors:a,secondaryExplosions:s}=r,c=a??this.config.particle.colors,l=O(i);for(let u=0;u<o;u++){let f=u/o*l-l/2+O(-90),m=h(4,12),p=X(t,n,f,m,c,this.config.particle.shapes,[2,6],[.8,1],1500,this.config.physics.rotationSpeed);s&&C()<.1&&(p.data={willExplode:!0,burstColors:c}),this.particles.push(p)}}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--)bt(t[n]);this.particles=[],this.canvasContext=null,Z--,this.config.autoCleanup&&hn()}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:o}=this.config,{x:i,y:a}=this.origin;for(let s=0;s<t;s++){let c;if(r.direction==="radial")c=C()*T.TWO_PI;else{let f=oe(r.direction,r.angle),m=O(r.spread);c=f+(C()-.5)*m}let l=h(r.velocity[0],r.velocity[1]),u=X(i,a,c,l,n.colors,n.shapes,n.size,n.opacity,n.lifespan,o.rotationSpeed);this.particles.push(u)}}}clear(){this.particles=[]}getParticleCount(){return gt(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 se(e,t){return new ae(e,t).start()}function ge(e,t){if(!e||!U())return null;let n=e.getBoundingClientRect(),r={x:n.left+n.width/2,y:n.top+n.height/2};return se(r,t)}function wt(){return Z}function Pt(){b&&(b.remove(),b=null,k=null),Z=0}var M=require("react");function W(){let[e,t]=(0,M.useState)(!1),n=(0,M.useRef)(new Set);(0,M.useEffect)(()=>()=>{n.current.forEach(l=>l.stop()),n.current.clear()},[]);let r=(0,M.useCallback)((l,u)=>{let f=se(l,u);return n.current.add(f),t(!0),f.promise.then(()=>{n.current.delete(f),n.current.size===0&&t(!1)}),f},[]),o=(0,M.useCallback)((l,u)=>{let f=ge(l,u);return f?(n.current.add(f),t(!0),f.promise.then(()=>{n.current.delete(f),n.current.size===0&&t(!1)}),f):null},[]),i=(0,M.useCallback)(()=>{n.current.forEach(l=>l.stop()),n.current.clear(),t(!1)},[]),a=(0,M.useCallback)(()=>{n.current.forEach(l=>l.pause())},[]),s=(0,M.useCallback)(()=>{n.current.forEach(l=>l.resume())},[]),c=(0,M.useCallback)(()=>Array.from(n.current),[]);return{fire:r,fireFromElement:o,isActive:e,stopAll:i,pauseAll:a,resumeAll:s,getActiveHandles:c}}var P=require("react");var De=require("react/jsx-runtime");function It({active:e,origin:t,triggerRef:n,options:r,onComplete:o}){let{fire:i,fireFromElement:a}=W(),s=(0,P.useRef)(!1);return(0,P.useEffect)(()=>{if(e&&!s.current){s.current=!0;let c=null;n?.current?c=a(n.current,r):t&&(c=i(t,r)),c&&c.promise.then(()=>{o?.()})}},[e,t,n,r,i,a,o]),(0,P.useEffect)(()=>{e||(s.current=!1)},[e]),null}var gn=(0,P.forwardRef)(({options:e,style:t},n)=>{let r=(0,P.useRef)(null),{fireFromElement:o}=W();return(0,P.useImperativeHandle)(n,()=>({fire:()=>o(r.current,e)})),(0,De.jsx)("div",{ref:r,style:{position:"absolute",width:1,height:1,pointerEvents:"none",...t},"aria-hidden":"true"})});gn.displayName="ConfettiTrigger";var Oe=(0,P.forwardRef)(({children:e,confettiOptions:t,fireOnClick:n=!0,onClick:r,...o},i)=>{let a=(0,P.useRef)(null),{fireFromElement:s}=W(),c=(0,P.useCallback)(u=>{a.current=u,typeof i=="function"?i(u):i&&(i.current=u)},[i]),l=(0,P.useCallback)(u=>{n&&a.current&&s(a.current,t),r?.(u)},[n,s,t,r]);return(0,De.jsx)("button",{ref:c,onClick:l,...o,children:e})});Oe.displayName="ConfettiButton";function bn({width:e,height:t,numberOfPieces:n=200,confettiSource:r,initialVelocityX:o,initialVelocityY:i,recycle:a=!0,run:s=!0,gravity:c=.3,wind:l=0,opacity:u=1,drawShape:f,tweenDuration:m=100,colors:p,onConfettiComplete:I,frameRate:E}){let{fire:F}=W(),y=(0,P.useRef)(null),w=(0,P.useRef)(!1);return(0,P.useEffect)(()=>{if(!s){y.current&&(y.current.stop(),y.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},R=typeof o=="number"?[o*.5,o*1.5]:o?[o.min,o.max]:[4,10],A=typeof i=="number"?[i*.5,i*1.5]:i?[i.min,i.max]:[10,30],S=(e??window.innerWidth)/2,Y=0;return y.current=F({x:S,y:Y},{particleCount:n,particle:{colors:p??["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff"],opacity:[u*.8,u],shapes:["square","circle","rectangle"],drawShape:f},physics:{gravity:c*10,wind:l*5,windVariation:R[1]-R[0]},direction:{velocity:A},mode:"continuous",spawnArea:d,continuous:{recycle:a,numberOfPieces:n,spawnRate:30,run:s,tweenDuration:m},canvas:{width:e,height:t,frameRate:E,autoResize:!e&&!t},onComplete:I}),()=>{y.current&&(y.current.stop(),y.current=null)}},[s,e,t,n,r,o,i,a,c,l,u,f,m,p,I,E,F]),(0,P.useEffect)(()=>{y.current},[a]),null}bn.displayName="Confetti";var Gn=Math.PI*2,Cn=Math.PI/180,Tt=1e3/60;function v(){if(typeof crypto<"u"&&crypto.getRandomValues){let e=new Uint32Array(1);return crypto.getRandomValues(e),e[0]/4294967296}return Math.random()}function be(e){return e*Cn}function H(e,t,n){return Math.min(Math.max(e,t),n)}function Me(e,t){let n=Math.max(0,e-t),r=n/Tt;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 o,i,a,s=255;if(r.length===3)o=parseInt(r[0]+r[0],16),i=parseInt(r[1]+r[1],16),a=parseInt(r[2]+r[2],16);else if(r.length===6)o=parseInt(r.slice(0,2),16),i=parseInt(r.slice(2,4),16),a=parseInt(r.slice(4,6),16);else if(r.length===8)o=parseInt(r.slice(0,2),16),i=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:o,g:i,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:H(parseInt(n[1],10),0,255),g:H(parseInt(n[2],10),0,255),b:H(parseInt(n[3],10),0,255),a:n[4]!==void 0?H(parseFloat(n[4]),0,1):1}:null}function _e(e,t){let n=Ft(e);if(!n)return e;let{r,g:o,b:i,a}=n,s=H(r+t,0,255),c=H(o+t,0,255),l=H(i+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 J(){if(typeof window>"u")return!1;try{return window.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1}catch{return!1}}var yn=0;function le(){return++yn}function Ce(e){if(e.length===0)return;let t=Math.floor(v()*e.length);return e[t]}function ye(e){return typeof requestAnimationFrame<"u"?requestAnimationFrame(e):setTimeout(e,Tt)}function Be(e){typeof cancelAnimationFrame<"u"?cancelAnimationFrame(e):clearTimeout(e)}function Le(){return typeof window>"u"?1:Math.min(window.devicePixelRatio||1,2)}var xt=Object.freeze(["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"]),vn=Object.freeze(["square","circle"]),ve=Math.PI*2,we=class e{constructor(t,n,r,o,i,a,s,c,l,u,f,m,p,I,E,F,y){this.id=t,this.position=n,this.velocity=r,this.angle2D=o,this.gravity=i,this.drift=a,this.decay=s,this.wobble=c,this.tilt=l,this.roll=u,this.rotate=f,this.color=m,this.shape=p,this.size=I,this.scalar=E,this.flat=F,this.tick=0,this.totalTicks=y,this.destroyed=!1,this.opacity=1}static create(t,n,r={}){let{angle:o=90,spread:i=45,startVelocity:a=45,decay:s=.94,gravity:c=1,drift:l=0,flat:u=!1,ticks:f=200,origin:m={x:.5,y:.5},colors:p=xt,shapes:I=vn,scalar:E=1,size:F=4}=r,y={x:m.x*t,y:m.y*n},w=be(o),d=be(i),R=-w+(.5*d-v()*d),A=a*.5+v()*a,S={angle:v()*ve,angleSpeed:v()*.1+.05,moveSpeed:-15+v()*30,distance:25+v()*15},Y={value:v()*ve,sinDirection:v()>=.5?1:-1,cosDirection:v()>=.5?1:-1,speed:(v()*.4+.3)*(v()>.5?1:-1),enable:!u},ue={angle:v()*ve,speed:(15+v()*10)/60,horizontal:v()>.3,vertical:v()>.7,enable:!u},L={angle:v()*ve,speed:(v()*2-1)*.1,enable:!u},Q=Ce(p)??xt[0],de=Ce(I)??"square";return new e(le(),y,A,R,c*3,l,s,S,Y,ue,L,Q,de,F,E,u,f)}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}},Pe=class{constructor(t=1e3){this.pool=[];this.maxSize=t}acquire(t,n,r){let o=this.pool.pop();return o?this.resetParticle(o,t,n,r):we.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,o){let i=we.create(n,r,o);return Object.assign(t,i,{id:t.id}),t.destroyed=!1,t}};var D=Math.PI*2,Ne=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,o=Math.sin(t.angle2D)*t.velocity;t.position.x+=r*n.factor+t.drift*n.factor,t.position.y+=o*n.factor+t.gravity*n.factor,t.velocity*=t.decay,t.tick++;let i=t.tick/t.totalTicks;t.opacity=1-Math.pow(i,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 o=Math.cos(r.angle)*r.distance*.1;t.position.x+=o*n.factor}},He=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}},Ue=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)}},We=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 Et(){return[new Ne,new ke,new He,new ze,new Ue,new We]}var Rt=Math.PI*2,Ge=class{constructor(){this.type="circle"}draw(t,n,r){let o=n.flat?1:.6+Math.sin(n.wobble.angle)*.4;t.ellipse(0,0,r*o,r*(1-o*.3),n.tilt?.value??0,0,Rt)}},Ye=class{constructor(){this.type="square"}draw(t,n,r){let o=n.flat?0:Math.sin(n.wobble.angle)*r*.3;t.moveTo(-r+o,-r),t.lineTo(r+o,-r*.5),t.lineTo(r-o,r),t.lineTo(-r-o,r*.5)}},qe=class{constructor(){this.type="rectangle"}draw(t,n,r){let o=r*1.5,i=r*.6,a=n.flat?0:Math.sin(n.wobble.angle)*i*.2;t.moveTo(-o+a,-i),t.lineTo(o+a,-i*.5),t.lineTo(o-a,i),t.lineTo(-o-a,i*.5)}},Ve=class{constructor(){this.type="star"}draw(t,n,r){let o=r,i=r*.5,a=5,s=Math.PI/a,c=-Math.PI/2;t.moveTo(0,-o);for(let l=0;l<a;l++)t.lineTo(Math.cos(c)*o,Math.sin(c)*o),c+=s,t.lineTo(Math.cos(c)*i,Math.sin(c)*i),c+=s}},$e=class{constructor(){this.type="triangle"}draw(t,n,r){let o=r*Math.sqrt(3)/2;t.moveTo(0,-o),t.lineTo(-r,o),t.lineTo(r,o)}},je=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)}},Xe=class{constructor(){this.type="heart"}draw(t,n,r){let i=-r*.3,a=r*.3;t.moveTo(0,i+a),t.bezierCurveTo(0-r,i,0-r,i-a*2,0,i-a),t.bezierCurveTo(0+r,i-a*2,0+r,i,0,i+a)}},Ze=class{constructor(){this.type="hexagon"}draw(t,n,r){let i=Rt/6;for(let a=0;a<6;a++){let s=i*a-Math.PI/2,c=Math.cos(s)*r,l=Math.sin(s)*r;a===0?t.moveTo(c,l):t.lineTo(c,l)}}},Je=class{constructor(){this.drawers=new Map;this.register(new Ge),this.register(new Ye),this.register(new qe),this.register(new Ve),this.register(new $e),this.register(new je),this.register(new Xe),this.register(new Ze)}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()}},K=new Je;var z=class{constructor(t={}){this.destroyed=!1;this.t=[];this.n=null;this.p=0;this.o=null;this.m=!1;this.i=null;this.P=t=>{if(this.destroyed)return;let n=Me(t,this.p);this.p=t,this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);let r=!1,o=[];for(let i=0;i<this.t.length;i++){let a=this.t[i];if(a.destroyed){o.push(i);continue}for(let s of this.e)s.isEnabled(a)&&s.update(a,n);if(a.destroyed){o.push(i);continue}r=!0,this.E(a)}for(let i=o.length-1;i>=0;i--){let a=o[i],s=this.t[a];this.l.release(s),this.t.splice(a,1)}r?this.n=ye(this.P):(this.n=null,this.o?.(),this.o=null)};this.I=()=>{this.v()};this.id=`confetti-${le()}`,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.m=!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=Et(),this.l=new Pe(500),this.f.resize&&this.F(),this.v()}get particles(){return this.t}async fire(t={}){if(this.f.disableForReducedMotion&&J())return Promise.resolve();if(this.destroyed)throw new Error("Cannot fire on destroyed container");let n=t.particleCount??100,r=this.canvas.width,o=this.canvas.height;for(let i=0;i<n;i++){let a=this.l.acquire(r,o,t);for(let s of this.e)s.init(a);this.t.push(a)}return this.n?new Promise(i=>{let a=this.o;this.o=()=>{a?.(),i()}}):new Promise(i=>{this.o=i,this.p=performance.now(),this.n=ye(this.P)})}stop(){this.n&&(Be(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.o?.(),this.o=null}reset(){this.stop(),this.l.clear()}destroy(){this.destroyed||(this.stop(),this.i&&(this.i.disconnect(),this.i=null),this.m&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.destroyed=!0)}E(t){let n=this.ctx,r=t.size*t.scalar,o={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&&(o.a=u.a),u.b!==void 0&&(o.b=u.b),u.c!==void 0&&(o.c=u.c),u.d!==void 0&&(o.d=u.d)}let a=this.e.find(l=>l.id==="roll")?.getDarkenAmount(t)??0,s=a>0?_e(t.color,-a):t.color;n.save(),n.translate(t.position.x,t.position.y),n.rotate(t.rotate?.angle??0),n.transform(o.a??1,o.b??0,o.c??0,o.d??1,0,0),n.fillStyle=s,n.globalAlpha=t.opacity,n.beginPath();let c=K.get(t.shape);c?c.draw(n,t,r):K.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}F(){if(typeof ResizeObserver>"u"){window.addEventListener("resize",this.I);return}this.i=new ResizeObserver(this.I),this.m?this.i.observe(document.body):this.canvas.parentElement&&this.i.observe(this.canvas.parentElement)}v(){let t=Le();if(this.m){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 Ie=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){K.register(t)}getUpdaters(){return Object.freeze([...this.e])}getMovers(){return Object.freeze([...this.C])}getShapeDrawer(t){return K.get(t)}createContainer(t){let n=new z(t);return this.u.push(n),n}getDefaultContainer(){return(!this.s||this.s.destroyed)&&(this.s=new z,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}},Ke=null;function Qe(){return Ke||(Ke=new Ie),Ke}var ce=new Map;function At(e,t){let n=ce.get(e);if(!n||n.destroyed){let r=e==="default"?{resize:!0,...t}:{canvas:e,resize:t?.resize??!1,...t};n=new z(r),ce.set(e,n)}return n}function St(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 x(e={}){if(e.disableForReducedMotion&&J())return Promise.resolve();try{return At("default").fire(St(e))}catch{return null}}x.create=function(e,t={}){let n=At(e,t),r=(o={})=>{if((o.disableForReducedMotion??t.disableForReducedMotion)&&J())return Promise.resolve();try{return n.fire(St(o))}catch{return null}};return r.reset=()=>{n.stop()},r};x.reset=function(){let e=ce.get("default");e&&!e.destroyed&&e.stop()};x.fireworks=async function(e={}){let t={particleCount:30,spread:55,...e};await Promise.all([x({...t,angle:60,origin:{x:0,y:.65}}),x({...t,angle:120,origin:{x:1,y:.65}})])};x.schoolPride=function(e={}){let t=Date.now()+3e3,n=e.colors??["#bb0000","#ffffff"];function r(){x({particleCount:2,angle:60,spread:55,origin:{x:0,y:.6},colors:n,...e}),x({particleCount:2,angle:120,spread:55,origin:{x:1,y:.6},colors:n,...e}),Date.now()<t&&requestAnimationFrame(r)}r()};x.snow=function(e={}){let{duration:t=5e3,...n}=e,r=Date.now()+t;function o(){x({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(o)}o()};x.burst=function(e,t={}){return x({particleCount:80,spread:360,startVelocity:30,decay:.92,scalar:1.2,origin:e,...t})};x.destroyAll=function(){for(let e of ce.values())e.destroy();ce.clear(),Qe().destroyAll()};x.getShapes=function(){return["square","circle","star","triangle","rectangle","diamond","heart","hexagon"]};var et={rainbow:q,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:["🍕","🍔","🍟","🌭","🍿"]},Te={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:[...q],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:[...et.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:[...et.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 wn(e){let t=Te[e];if(!t)throw new Error(`Preset "${e}" not found. Available presets: ${Object.keys(Te).join(", ")}`);return t}function Pn(){return Object.keys(Te)}function Ot(e){let{path:t,matrix:n,fillColor:r,strokeColor:o,strokeWidth:i}=e,a=In(t);return{type:"path",path:t,matrix:n?[...n]:void 0,fillColor:r,strokeColor:o,strokeWidth:i,bounds:a}}function tt(e){let{text:t,scalar:n=1,color:r,fontFamily:o="serif",fontWeight:i="normal",fontStyle:a="normal"}=e;return{type:"text",text:t,scalar:n,color:r,fontFamily:o,fontWeight:String(i),fontStyle:a}}async function Dt(e){let{src:t,scalar:n=1}=e;return typeof t!="string"?{type:"text",text:"",scalar:n,fontFamily:`url(${t.src})`}:(await Tn(t),{type:"text",text:"",scalar:n,fontFamily:`url(${t})`,color:void 0})}function Mt(e,t={}){return e.map(n=>tt({...t,text:n}))}function In(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,o=-1/0,i=-1/0;for(let a=0;a<t.length-1;a+=2){let s=parseFloat(t[a]),c=parseFloat(t[a+1]);!isNaN(s)&&!isNaN(c)&&(n=Math.min(n,s),r=Math.min(r,c),o=Math.max(o,s),i=Math.max(i,c))}return isFinite(n)?{minX:n,minY:r,maxX:o,maxY:i}:{minX:-1,minY:-1,maxX:1,maxY:1}}function Tn(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})}
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})}
@@ -1,4 +1,4 @@
1
- "use strict";var ReactConfettiBurst=(()=>{var k=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var ye=Object.getOwnPropertyNames;var Pe=Object.prototype.hasOwnProperty;var we=(n,e)=>{for(var t in e)k(n,t,{get:e[t],enumerable:!0})},Ce=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ye(e))!Pe.call(n,i)&&i!==t&&k(n,i,{get:()=>e[i],enumerable:!(r=Ie(e,i))||r.enumerable});return n};var _e=n=>Ce(k({},"__esModule",{value:!0}),n);var De={};we(De,{confetti:()=>u,default:()=>Te});var ze=Math.PI*2,xe=Math.PI/180,ne=1e3/60;function l(){if(typeof crypto<"u"&&crypto.getRandomValues){let n=new Uint32Array(1);return crypto.getRandomValues(n),n[0]/4294967296}return Math.random()}function P(n){return n*xe}function p(n,e,t){return Math.min(Math.max(n,e),t)}function A(n,e){let t=Math.max(0,n-e),r=t/ne;return Object.freeze({value:t,factor:r})}function ie(n){if(typeof n!="string"||n.length>50)return null;let e=n.trim().toLowerCase();if(e.startsWith("#")){let r=e.slice(1);if(!/^[0-9a-f]+$/.test(r))return null;let i,a,o,s=255;if(r.length===3)i=parseInt(r[0]+r[0],16),a=parseInt(r[1]+r[1],16),o=parseInt(r[2]+r[2],16);else if(r.length===6)i=parseInt(r.slice(0,2),16),a=parseInt(r.slice(2,4),16),o=parseInt(r.slice(4,6),16);else if(r.length===8)i=parseInt(r.slice(0,2),16),a=parseInt(r.slice(2,4),16),o=parseInt(r.slice(4,6),16),s=parseInt(r.slice(6,8),16);else return null;return{r:i,g:a,b:o,a:s/255}}let t=e.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)$/);return t?{r:p(parseInt(t[1],10),0,255),g:p(parseInt(t[2],10),0,255),b:p(parseInt(t[3],10),0,255),a:t[4]!==void 0?p(parseFloat(t[4]),0,1):1}:null}function U(n,e){let t=ie(n);if(!t)return n;let{r,g:i,b:a,a:o}=t,s=p(r+e,0,255),c=p(i+e,0,255),d=p(a+e,0,255);return o<1?`rgba(${Math.round(s)}, ${Math.round(c)}, ${Math.round(d)}, ${o})`:`rgb(${Math.round(s)}, ${Math.round(c)}, ${Math.round(d)})`}function g(){if(typeof window>"u")return!1;try{return window.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1}catch{return!1}}var Me=0;function b(){return++Me}function w(n){if(n.length===0)return;let e=Math.floor(l()*n.length);return n[e]}function C(n){return typeof requestAnimationFrame<"u"?requestAnimationFrame(n):setTimeout(n,ne)}function F(n){typeof cancelAnimationFrame<"u"?cancelAnimationFrame(n):clearTimeout(n)}function V(){return typeof window>"u"?1:Math.min(window.devicePixelRatio||1,2)}var ae=Object.freeze(["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"]),Re=Object.freeze(["square","circle"]),_=Math.PI*2,x=class n{constructor(e,t,r,i,a,o,s,c,d,f,T,y,D,O,z,E,S){this.id=e,this.position=t,this.velocity=r,this.angle2D=i,this.gravity=a,this.drift=o,this.decay=s,this.wobble=c,this.tilt=d,this.roll=f,this.rotate=T,this.color=y,this.shape=D,this.size=O,this.scalar=z,this.flat=E,this.tick=0,this.totalTicks=S,this.destroyed=!1,this.opacity=1}static create(e,t,r={}){let{angle:i=90,spread:a=45,startVelocity:o=45,decay:s=.94,gravity:c=1,drift:d=0,flat:f=!1,ticks:T=200,origin:y={x:.5,y:.5},colors:D=ae,shapes:O=Re,scalar:z=1,size:E=4}=r,S={x:y.x*e,y:y.y*t},de=P(i),re=P(a),ue=-de+(.5*re-l()*re),fe=o*.5+l()*o,he={angle:l()*_,angleSpeed:l()*.1+.05,moveSpeed:-15+l()*30,distance:25+l()*15},pe={value:l()*_,sinDirection:l()>=.5?1:-1,cosDirection:l()>=.5?1:-1,speed:(l()*.4+.3)*(l()>.5?1:-1),enable:!f},me={angle:l()*_,speed:(15+l()*10)/60,horizontal:l()>.3,vertical:l()>.7,enable:!f},ge={angle:l()*_,speed:(l()*2-1)*.1,enable:!f},ve=w(D)??ae[0],be=w(O)??"square";return new n(b(),S,fe,ue,c*3,d,s,he,pe,me,ge,ve,be,E,z,f,T)}get progress(){return this.tick/this.totalTicks}get computedSize(){return this.size*this.scalar}destroy(){this.destroyed=!0}clone(e){let t=Object.create(n.prototype);return Object.assign(t,this,e),t}},M=class{constructor(e=1e3){this.pool=[];this.maxSize=e}acquire(e,t,r){let i=this.pool.pop();return i?this.resetParticle(i,e,t,r):x.create(e,t,r)}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,t,r,i){let a=x.create(t,r,i);return Object.assign(e,a,{id:e.id}),e.destroyed=!1,e}};var h=Math.PI*2,q=class{constructor(){this.id="base"}init(e){}isEnabled(e){return!e.destroyed}update(e,t){if(e.destroyed)return;let r=Math.cos(e.angle2D)*e.velocity,i=Math.sin(e.angle2D)*e.velocity;e.position.x+=r*t.factor+e.drift*t.factor,e.position.y+=i*t.factor+e.gravity*t.factor,e.velocity*=e.decay,e.tick++;let a=e.tick/e.totalTicks;e.opacity=1-Math.pow(a,2),e.tick>=e.totalTicks&&(e.destroyed=!0)}},$=class{constructor(){this.id="wobble"}init(e){e.wobble||(e.wobble={angle:Math.random()*h,angleSpeed:Math.random()*.1+.05,moveSpeed:-15+Math.random()*30,distance:25+Math.random()*15})}isEnabled(e){return!e.destroyed&&!e.flat&&!!e.wobble}update(e,t){if(!this.isEnabled(e))return;let r=e.wobble;r.angle+=r.angleSpeed*t.factor,r.angle>h&&(r.angle-=h);let i=Math.cos(r.angle)*r.distance*.1;e.position.x+=i*t.factor}},L=class{constructor(){this.id="tilt"}init(e){e.tilt||(e.tilt={value:Math.random()*h,sinDirection:Math.random()>=.5?1:-1,cosDirection:Math.random()>=.5?1:-1,speed:(Math.random()*.4+.3)*(Math.random()>.5?1:-1),enable:!e.flat})}isEnabled(e){return!e.destroyed&&e.tilt?.enable===!0}update(e,t){if(!this.isEnabled(e))return;let r=e.tilt;r.value+=r.speed*.01*t.factor,r.value>h?r.value-=h:r.value<0&&(r.value+=h)}getTransformValues(e){if(!e.tilt?.enable)return{};let t=e.tilt;return{b:Math.cos(t.value)*t.cosDirection*.5,c:Math.sin(t.value)*t.sinDirection*.5}}},j=class{constructor(){this.id="roll"}init(e){e.roll||(e.roll={angle:Math.random()*h,speed:(15+Math.random()*10)/60,horizontal:Math.random()>.3,vertical:Math.random()>.7,enable:!e.flat})}isEnabled(e){return!e.destroyed&&e.roll?.enable===!0}update(e,t){if(!this.isEnabled(e))return;let r=e.roll;r.angle+=r.speed*t.factor,r.angle>h&&(r.angle-=h)}getTransformValues(e){if(!e.roll?.enable)return{};let t=e.roll;return{a:t.horizontal?Math.abs(Math.cos(t.angle)):void 0,d:t.vertical?Math.abs(Math.sin(t.angle)):void 0}}getDarkenAmount(e){if(!e.roll?.enable)return 0;let t=e.roll;return!t.horizontal&&!t.vertical?0:(t.horizontal?Math.cos(t.angle):Math.sin(t.angle))<0?25:0}},B=class{constructor(){this.id="rotate"}init(e){e.rotate||(e.rotate={angle:Math.random()*h,speed:(Math.random()*2-1)*.1,enable:!e.flat})}isEnabled(e){return!e.destroyed&&e.rotate?.enable===!0}update(e,t){if(!this.isEnabled(e))return;let r=e.rotate;r.angle+=r.speed*t.factor,r.angle>h?r.angle-=h:r.angle<0&&(r.angle+=h)}},H=class{constructor(){this.id="opacity"}init(e){e.opacity=1}isEnabled(e){return!e.destroyed}update(e,t){if(!this.isEnabled(e))return;let r=e.tick/e.totalTicks;e.opacity=1-Math.pow(r,2)}};function oe(){return[new q,new $,new L,new j,new B,new H]}var se=Math.PI*2,W=class{constructor(){this.type="circle"}draw(e,t,r){let i=t.flat?1:.6+Math.sin(t.wobble.angle)*.4;e.ellipse(0,0,r*i,r*(1-i*.3),t.tilt?.value??0,0,se)}},N=class{constructor(){this.type="square"}draw(e,t,r){let i=t.flat?0:Math.sin(t.wobble.angle)*r*.3;e.moveTo(-r+i,-r),e.lineTo(r+i,-r*.5),e.lineTo(r-i,r),e.lineTo(-r-i,r*.5)}},G=class{constructor(){this.type="rectangle"}draw(e,t,r){let i=r*1.5,a=r*.6,o=t.flat?0:Math.sin(t.wobble.angle)*a*.2;e.moveTo(-i+o,-a),e.lineTo(i+o,-a*.5),e.lineTo(i-o,a),e.lineTo(-i-o,a*.5)}},X=class{constructor(){this.type="star"}draw(e,t,r){let i=r,a=r*.5,o=5,s=Math.PI/o,c=-Math.PI/2;e.moveTo(0,-i);for(let d=0;d<o;d++)e.lineTo(Math.cos(c)*i,Math.sin(c)*i),c+=s,e.lineTo(Math.cos(c)*a,Math.sin(c)*a),c+=s}},Y=class{constructor(){this.type="triangle"}draw(e,t,r){let i=r*Math.sqrt(3)/2;e.moveTo(0,-i),e.lineTo(-r,i),e.lineTo(r,i)}},J=class{constructor(){this.type="diamond"}draw(e,t,r){e.moveTo(0,-r),e.lineTo(r*.6,0),e.lineTo(0,r),e.lineTo(-r*.6,0)}},K=class{constructor(){this.type="heart"}draw(e,t,r){let a=-r*.3,o=r*.3;e.moveTo(0,a+o),e.bezierCurveTo(0-r,a,0-r,a-o*2,0,a-o),e.bezierCurveTo(0+r,a-o*2,0+r,a,0,a+o)}},Q=class{constructor(){this.type="hexagon"}draw(e,t,r){let a=se/6;for(let o=0;o<6;o++){let s=a*o-Math.PI/2,c=Math.cos(s)*r,d=Math.sin(s)*r;o===0?e.moveTo(c,d):e.lineTo(c,d)}}},Z=class{constructor(){this.drawers=new Map;this.register(new W),this.register(new N),this.register(new G),this.register(new X),this.register(new Y),this.register(new J),this.register(new K),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()}},v=new Z;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._animate=e=>{if(this.destroyed)return;let t=A(e,this._lastTimestamp);this._lastTimestamp=e,this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);let r=!1,i=[];for(let a=0;a<this._particles.length;a++){let o=this._particles[a];if(o.destroyed){i.push(a);continue}for(let s of this._updaters)s.isEnabled(o)&&s.update(o,t);if(o.destroyed){i.push(a);continue}r=!0,this._drawParticle(o)}for(let a=i.length-1;a>=0;a--){let o=i[a],s=this._particles[o];this._pool.release(s),this._particles.splice(o,1)}r?this._animationId=C(this._animate):(this._animationId=null,this._resolvePromise?.(),this._resolvePromise=null)};this._handleResize=()=>{this._updateCanvasSize()};this.id=`confetti-${b()}`,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 t=this.canvas.getContext("2d",{alpha:!0,desynchronized:!0});if(!t)throw new Error("Failed to get 2D canvas context");this.ctx=t,this._updaters=oe(),this._pool=new M(500),this._options.resize&&this._setupResizeHandling(),this._updateCanvasSize()}get particles(){return this._particles}async fire(e={}){if(this._options.disableForReducedMotion&&g())return Promise.resolve();if(this.destroyed)throw new Error("Cannot fire on destroyed container");let t=e.particleCount??100,r=this.canvas.width,i=this.canvas.height;for(let a=0;a<t;a++){let o=this._pool.acquire(r,i,e);for(let s of this._updaters)s.init(o);this._particles.push(o)}return this._animationId?new Promise(a=>{let o=this._resolvePromise;this._resolvePromise=()=>{o?.(),a()}}):new Promise(a=>{this._resolvePromise=a,this._lastTimestamp=performance.now(),this._animationId=C(this._animate)})}stop(){this._animationId&&(F(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._isOwnCanvas&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.destroyed=!0)}_drawParticle(e){let t=this.ctx,r=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 o=this._updaters.find(d=>d.id==="roll")?.getDarkenAmount(e)??0,s=o>0?U(e.color,-o):e.color;t.save(),t.translate(e.position.x,e.position.y),t.rotate(e.rotate?.angle??0),t.transform(i.a??1,i.b??0,i.c??0,i.d??1,0,0),t.fillStyle=s,t.globalAlpha=e.opacity,t.beginPath();let c=v.get(e.shape);c?c.draw(t,e,r):v.get("square")?.draw(t,e,r),t.closePath(),t.fill(),t.restore()}_createCanvas(){let e=document.createElement("canvas");return e.id=this.id,e.style.cssText=`
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
2
  position: fixed;
3
3
  top: 0;
4
4
  left: 0;
@@ -6,4 +6,4 @@
6
6
  height: 100%;
7
7
  pointer-events: none;
8
8
  z-index: ${this._options.zIndex};
9
- `,document.body.appendChild(e),e}_setupResizeHandling(){if(typeof ResizeObserver>"u"){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=V();if(this._isOwnCanvas){let t=document.documentElement.clientWidth,r=document.documentElement.clientHeight;this.canvas.width=t*e,this.canvas.height=r*e,this.canvas.style.width=`${t}px`,this.canvas.style.height=`${r}px`}else{let t=this.canvas.getBoundingClientRect();this.canvas.width=t.width*e,this.canvas.height=t.height*e}this.ctx.scale(e,e)}};var R=class{constructor(){this._updaters=[];this._movers=[];this._containers=[];this._defaultContainer=null}addUpdater(e){this._updaters.some(t=>t.id===e.id)||this._updaters.push(e)}addMover(e){this._movers.some(t=>t.id===e.id)||this._movers.push(e)}addShapeDrawer(e){v.register(e)}getUpdaters(){return Object.freeze([...this._updaters])}getMovers(){return Object.freeze([...this._movers])}getShapeDrawer(e){return v.get(e)}createContainer(e){let t=new m(e);return this._containers.push(t),t}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}},ee=null;function te(){return ee||(ee=new R),ee}var I=new Map;function le(n,e){let t=I.get(n);if(!t||t.destroyed){let r=n==="default"?{resize:!0,...e}:{canvas:n,resize:e?.resize??!1,...e};t=new m(r),I.set(n,t)}return t}function ce(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&&g())return Promise.resolve();try{return le("default").fire(ce(n))}catch{return null}}u.create=function(n,e={}){let t=le(n,e),r=(i={})=>{if((i.disableForReducedMotion??e.disableForReducedMotion)&&g())return Promise.resolve();try{return t.fire(ce(i))}catch{return null}};return r.reset=()=>{t.stop()},r};u.reset=function(){let n=I.get("default");n&&!n.destroyed&&n.stop()};u.fireworks=async function(n={}){let e={particleCount:30,spread:55,...n};await Promise.all([u({...e,angle:60,origin:{x:0,y:.65}}),u({...e,angle:120,origin:{x:1,y:.65}})])};u.schoolPride=function(n={}){let e=Date.now()+3e3,t=n.colors??["#bb0000","#ffffff"];function r(){u({particleCount:2,angle:60,spread:55,origin:{x:0,y:.6},colors:t,...n}),u({particleCount:2,angle:120,spread:55,origin:{x:1,y:.6},colors:t,...n}),Date.now()<e&&requestAnimationFrame(r)}r()};u.snow=function(n={}){let{duration:e=5e3,...t}=n,r=Date.now()+e;function i(){u({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,...t}),Date.now()<r&&requestAnimationFrame(i)}i()};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 I.values())n.destroy();I.clear(),te().destroyAll()};u.getShapes=function(){return["square","circle","star","triangle","rectangle","diamond","heart","hexagon"]};var Te=u;return _e(De);})();
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 X=["#FF6B6B","#4ECDC4","#FFE66D","#95E1D3","#F38181","#AA96DA","#FCBAD3","#A8D8EA","#FF9A8B","#88D8B0"],ae={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},se={direction:"up",spread:55,velocity:[25,50],velocityDecay:.92},le={colors:X,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},B={enabled:!1,length:10,fade:.5,width:.5},Pe={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},Ie={width:null,height:null,autoResize:!0,resizeDebounce:100,frameRate:null,pixelRatio:null,useWorker:!1,useOffscreen:!1};var D={particleCount:50,particle:le,physics:ae,direction:se,mode:"burst",easing:"easeOut",zIndex:9999,autoCleanup:!0,scalar:1,drift:0,flat:!1},Te={up:90,down:270,left:180,right:0},I={DEG_TO_RAD:Math.PI/180,RAD_TO_DEG:180/Math.PI,TWO_PI:Math.PI*2,HALF_PI:Math.PI/2},g={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 Z={r:0,g:0,b:0,a:0},Fe={MAX_PARTICLES:500,FRAME_BUDGET:16.67,MIN_OPACITY:.01,MIN_SIZE:.5,MAX_DPR:2},et=100,xe=5,tt=.5;var It={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 h(e,t){return e+C()*(t-e)}function Tt(e,t){return Math.floor(h(e,t+1))}function J(e){if(e.length===0)throw new Error("Cannot pick from empty array");return e[Math.floor(C()*e.length)]}function M(e,t,n){return Math.min(Math.max(e,t),n)}function Ft(e,t,n){return e+(t-e)*M(n,0,1)}function O(e){return e*I.DEG_TO_RAD}function xt(e){return e*I.RAD_TO_DEG}function K(e){if(typeof e=="object"&&"r"in e)return{r:M(Math.round(e.r),0,255),g:M(Math.round(e.g),0,255),b:M(Math.round(e.b),0,255),a:M(e.a,0,1)};if(typeof e=="object"&&"type"in e)return K(e.colors[0]);let t=e.trim().toLowerCase();return t.startsWith("#")?Et(t):t.startsWith("rgb")?Rt(t):At(t)}function Et(e){let t=e.slice(1),n,r,o,i=1;switch(t.length){case 3:n=parseInt(t[0]+t[0],16),r=parseInt(t[1]+t[1],16),o=parseInt(t[2]+t[2],16);break;case 4:n=parseInt(t[0]+t[0],16),r=parseInt(t[1]+t[1],16),o=parseInt(t[2]+t[2],16),i=parseInt(t[3]+t[3],16)/255;break;case 6:n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),o=parseInt(t.slice(4,6),16);break;case 8:n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),o=parseInt(t.slice(4,6),16),i=parseInt(t.slice(6,8),16)/255;break;default:return Z}return isNaN(n)||isNaN(r)||isNaN(o)||isNaN(i)?Z:{r:n,g:r,b:o,a:i}}function Rt(e){let t=e.match(/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/);return t?{r:M(parseInt(t[1],10),0,255),g:M(parseInt(t[2],10),0,255),b:M(parseInt(t[3],10),0,255),a:t[4]!==void 0?M(parseFloat(t[4]),0,1):1}:Z}function At(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 o=r.getImageData(0,0,1,1).data;return{r:o[0],g:o[1],b:o[2],a:o[3]/255}}}catch{}return Z}function Q(e){return`rgba(${e.r}, ${e.g}, ${e.b}, ${e.a})`}function ce(e,t){if(e==="custom"&&t!==void 0)return O(t);if(e==="radial")return C()*I.TWO_PI;let n=Te[e];return O(n??90)}function St(e){let t=e.getBoundingClientRect();return{x:t.left+t.width/2,y:t.top+t.height/2}}function Ee(e){if(!e)return D;let t={...le,...e.particle},n={...ae,...e.physics},r={...se,...e.direction};return{particleCount:e.particleCount??D.particleCount,particle:t,physics:n,direction:r,mode:e.mode??D.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??D.easing,zIndex:e.zIndex??D.zIndex,autoCleanup:e.autoCleanup??D.autoCleanup,scalar:e.scalar??D.scalar,drift:e.drift??D.drift,flat:e.flat??D.flat,onStart:e.onStart,onComplete:e.onComplete,onFrame:e.onFrame,onParticleCreate:e.onParticleCreate,onParticleDeath:e.onParticleDeath}}function z(){return typeof window<"u"&&typeof document<"u"}function nt(e=2){return z()?Math.min(window.devicePixelRatio||1,e):1}function rt(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}var Ot=0,ot=!1;function U(e,t,n,r,o,i,a,s,c,l,u){if(o.length===0)throw new Error("Colors array cannot be empty");if(i.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 f=h(a[0],a[1]),m=h(s[0],s[1]),p=J(o),P=typeof p=="string"?K(p):"type"in p?K(p.colors[0]):p,F=1+(C()-.5)*g.VELOCITY_VARIATION_RANGE,T=Math.cos(n)*r*F,y=-Math.sin(n)*r*F,w;u?.images&&u.images.length>0&&(w=J(u.images));let d=u?.tiltRange??[-30,30],x=u?.spinSpeedRange??[-15,15],R=u?.aspectRatioRange??[.5,1.5],A=h(R[0],R[1]);return{id:Ot++,x:e,y:t,vx:T,vy:y,size:f,originalSize:f,rotation:C()*I.TWO_PI,rotationSpeed:(C()-.5)*.3*l,color:P,shape:w?"custom":J(i),opacity:m,originalOpacity:m,life:c,maxLife:c,active:!0,image:w,imageElement:null,trail:[],wobblePhase:C()*I.TWO_PI,wobbleSpeed:h(.8,2.5),tilt:O(h(d[0],d[1])),tiltSpeed:h(x[0],x[1])*.015,depth:u?.depth3D??.6,hasExploded:!1,data:{},flutterPhase:C()*I.TWO_PI,flutterSpeed:h(1.5,3.5),swayPhase:C()*I.TWO_PI,aspectRatio:A,angularVelocity:(C()-.5)*.4,scaleX:1,scaleY:1,shimmerPhase:C()*I.TWO_PI,currentDrag:h(.02,.05)}}function it(e,t,n,r,o,i,a){if(!e.active)return;let s=t*.05988;(i?.enabled??B.enabled)&&Dt(e,i??B),Mt(e,s,n),Ht(e,s,n),zt(e,t,n,r,o),n.floor!==null&&n.bounce>0&&a&&Ut(e,n,a),(e.life<=0||e.opacity<g.MIN_OPACITY_THRESHOLD||e.size<g.MIN_SIZE_THRESHOLD)&&(e.active=!1)}function Dt(e,t){let n=e.trail;n.unshift({x:e.x,y:e.y,opacity:e.opacity,size:e.size});let r=t.length??B.length;n.length>r&&n.pop()}function Mt(e,t,n){let r=e.vx,o=e.vy,i=e.tilt,a=r*r+o*o;_t(e,o,i,n,t),o=e.vy,Bt(e,r,o,i,a,n,t),r=e.vx,o=e.vy,Lt(e,r,n,t),r=e.vx,Nt(e,n,t),r=e.vx,kt(e,r,o,i,a,n),r=e.vx,o=e.vy,e.x+=r*t,e.y+=o*t}function _t(e,t,n,r,o){let a=1+(n-n*n*n*g.SIN_TAYLOR_COEFF)*g.GRAVITY_TILT_MODIFIER;e.vy=t+r.gravity*a*o}function Bt(e,t,n,r,o,i,a){if(!(i.flutter??!0)||o<=1)return;let c=i.flutterSpeed??2.5,l=i.flutterIntensity??.4;e.flutterPhase+=c*g.FLUTTER_PHASE_SCALE*a;let u=e.flutterPhase,m=(u-u*u*u*g.SIN_TAYLOR_COEFF)*l*a,p=1-r*r*g.COS_TAYLOR_COEFF;e.vx=t+m*p;let P=r-r*r*r*g.SIN_TAYLOR_COEFF;if((P<0?-P:P)>g.FLUTTER_AIR_CATCH_THRESHOLD){let T=m<0?-m:m;e.vy=n-T*g.FLUTTER_AIR_CATCH_MULTIPLIER}}function Lt(e,t,n,r){let o=n.swayAmplitude??15,i=n.swayFrequency??2;e.swayPhase+=i*g.SWAY_PHASE_SCALE*r;let a=e.swayPhase,s=(a-a*a*a*g.SIN_TAYLOR_COEFF)*o*g.SWAY_FORCE_SCALE*r;e.vx=t+s}function Nt(e,t,n){let r=t.windVariation,o=t.wind+r*(Math.random()-.5);e.vx+=o*n}function kt(e,t,n,r,o,i){let a=i.airResistance??.03,s=1-r*r*g.COS_TAYLOR_COEFF,c=s<0?-s:s,l=i.drag+c*a,u=o>0?Math.sqrt(o):0,m=Math.max(.9,1-l*u*.01)*i.friction*i.decay;e.vx=t*m,e.vy=n*m}function Ht(e,t,n){if(n.tumble&&(e.angularVelocity=(e.angularVelocity+e.vx*.001*t)*g.ANGULAR_DAMPING,e.rotation+=(e.rotationSpeed+e.angularVelocity)*t),e.tiltSpeed=(e.tiltSpeed+(Math.random()-.5)*.002*t)*g.TILT_DAMPING,e.tilt=(e.tilt+e.tiltSpeed*t)%I.TWO_PI,n.wobble){let r=e.wobblePhase+n.wobbleSpeed*.1*t;e.wobblePhase=r;let o=1-r*r*g.COS_TAYLOR_COEFF,i=r-r*r*r*g.SIN_TAYLOR_COEFF;e.scaleX=.3+.7*(o<0?-o:o),e.scaleY=.3+.7*(i<0?-i:i)}e.shimmerPhase+=.1*t}function zt(e,t,n,r,o){t>0&&(e.life-=t);let i=1-e.life/e.maxLife;if(r){let a=i,s=a*a*(3-2*a);e.opacity=e.originalOpacity*(1-s*.9)}o&&(e.size=e.originalSize*(1-i*.5))}function Ut(e,t,n){let r=t.floor??n,o=e.size*.5;e.y+o>=r&&(e.y=r-o,e.vy=-e.vy*t.bounce,e.vx*=.85,e.rotationSpeed+=(Math.random()-.5)*.1)}function at(e,t,n){if(!t.active)return;let{x:r,y:o,size:i,rotation:a,color:s,shape:c,opacity:l,tilt:u,aspectRatio:f,scaleX:m,scaleY:p,shimmerPhase:P}=t;if(l<g.MIN_OPACITY_THRESHOLD)return;let F=n?.trailConfig,T=n?.glowConfig;(F?.enabled??B.enabled)&&t.trail.length>0&&Wt(e,t,F??B),e.save();let y=T?.enabled??Pe.enabled;y&&(e.shadowBlur=T?.blur??Pe.blur,e.shadowColor=T?.color??Q(s)),e.translate(r,o),e.rotate(a+u),t.depth>0&&e.scale(m,p);let d=1+(P-Math.floor(P))*g.SHIMMER_RANGE-g.SHIMMER_OFFSET,x=g.ORIENTATION_OPACITY_BASE+g.ORIENTATION_OPACITY_SCALE*(m*p<0?-(m*p):m*p),R=l*s.a*x*(y?T?.intensity??1:1);if(R<g.MIN_OPACITY_THRESHOLD){e.restore();return}e.globalAlpha=R>1?1:R;let A=s.r*d,H=s.g*d,oe=s.b*d;if(e.fillStyle=`rgb(${A>255?255:A},${H>255?255:H},${oe>255?255:oe})`,t.image&&t.image.isEmoji)Jt(e,t.image.src,i*(t.image.scale??1));else if(t.imageElement)Kt(e,t.imageElement,i*(t.image?.scale??1));else if(c==="custom"&&n?.customDraw){let _={ctx:e,particle:t,progress:1-t.life/t.maxLife,elapsed:n.elapsed??0};try{n.customDraw(_)}catch{ot||(ot=!0)}}else{let _=f??1;switch(c){case"square":case"rectangle":let j=i*(c==="rectangle"?Math.max(1.5,_*1.5):Math.sqrt(_)),ie=i/(c==="rectangle"?Math.max(1.5,_):Math.sqrt(_));e.fillRect(-j*.5,-ie*.5,j,ie);break;case"circle":e.beginPath(),e.arc(0,0,i*.5,0,I.TWO_PI),e.fill();break;case"triangle":Gt(e,i);break;case"star":Yt(e,i);break;case"line":qt(e,i);break;case"heart":Vt(e,i);break;case"diamond":$t(e,i);break;case"hexagon":jt(e,i);break;case"spiral":Xt(e,i,s);break;case"ribbon":Zt(e,i);break;default:e.fillRect(-i*.5,-i*.5,i,i)}}e.restore()}function Wt(e,t,n){let r=n.fade??B.fade,o=n.width??B.width;e.save(),e.lineCap="round",e.lineJoin="round";for(let i=0;i<t.trail.length-1;i++){let a=t.trail[i],s=t.trail[i+1],c=a.opacity*Math.pow(r,i),l=a.size*o*Math.pow(r,i);c>.01&&l>.1&&(e.beginPath(),e.strokeStyle=Q({...t.color,a:c}),e.lineWidth=l,e.moveTo(a.x,a.y),e.lineTo(s.x,s.y),e.stroke())}e.restore()}function Gt(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 Yt(e,t){let n=t/2,r=n*tt,o=Math.PI/xe;e.beginPath();for(let i=0;i<xe*2;i++){let a=i%2===0?n:r,s=i*o-I.HALF_PI,c=Math.cos(s)*a,l=Math.sin(s)*a;i===0?e.moveTo(c,l):e.lineTo(c,l)}e.closePath(),e.fill()}function qt(e,t){let n=t*2,r=t/4;e.fillRect(-n/2,-r/2,n,r)}function Vt(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 $t(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 o=Math.PI/3*r-Math.PI/6,i=Math.cos(o)*n,a=Math.sin(o)*n;r===0?e.moveTo(i,a):e.lineTo(i,a)}e.closePath(),e.fill()}function Xt(e,t,n){e.strokeStyle=Q(n),e.lineWidth=t/8,e.lineCap="round",e.beginPath();for(let r=0;r<22;r++){let o=.35*r,i=(.2+1.5*o)*(t/20),a=i*Math.cos(o),s=i*Math.sin(o);r===0?e.moveTo(a,s):e.lineTo(a,s)}e.stroke()}function Zt(e,t){let n=t,r=t/3,o=t/4;e.beginPath(),e.moveTo(-n/2,0),e.quadraticCurveTo(-n/4,-o,0,0),e.quadraticCurveTo(n/4,o,n/2,0),e.lineTo(n/2,r),e.quadraticCurveTo(n/4,r+o,0,r),e.quadraticCurveTo(-n/4,r-o,-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 st(e){return e.filter(t=>t.active).length}var b=null,L=null,W=0;var ee=null,ue=[],de=500;function Qt(e){for(de=Math.max(1,Math.floor(e));ue.length>de;)ue.pop()}function en(){return de}function lt(e){ue.length<de&&(e.active=!1,e.trail.length=0,ue.push(e))}var Re=360,tn=new Float32Array(Re),nn=new Float32Array(Re);for(let e=0;e<Re;e++){let t=e*Math.PI/180;tn[e]=Math.sin(t),nn[e]=Math.cos(t)}function rn(e,t){if(!z())throw new Error("ConfettiEngine requires a browser environment");let n={...Ie,...t},r=n.pixelRatio??nt(Fe.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 X=["#FF6B6B","#4ECDC4","#FFE66D","#95E1D3","#F38181","#AA96DA","#FCBAD3","#A
6
6
  height: 100%;
7
7
  pointer-events: none;
8
8
  z-index: ${e};
9
- `,L=b.getContext("2d",{alpha:!0,desynchronized:!0}),!L)throw new Error("Failed to get canvas 2D context");document.body.appendChild(b),n.autoResize&&(ee=()=>{if(b&&L){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`,L.scale(r,r)}},window.addEventListener("resize",ee))}b.style.zIndex=String(e);let o=n.width??window.innerWidth,i=n.height??window.innerHeight;return(b.width!==o*r||b.height!==i*r)&&(b.width=o*r,b.height=i*r,b.style.width=`${o}px`,b.style.height=`${i}px`,L.scale(r,r)),{canvas:b,ctx:L,width:o,height:i,dpr:r}}function on(){b&&W===0&&setTimeout(()=>{W===0&&b&&(ee&&(window.removeEventListener("resize",ee),ee=null),b.remove(),b=null,L=null)},et)}function ct(e,t,n){let{type:r,x:o,y:i,w:a,h:s}=e;switch(r){case"point":return{x:o,y:i};case"rect":return{x:h(o,o+(a??0)),y:h(i,i+(s??0))};case"line":let c=C();return{x:o+c*(a??0),y:i+c*(s??0)};case"circle":let l=C()*I.TWO_PI,u=Math.sqrt(C())*(a??50);return{x:o+Math.cos(l)*u,y:i+Math.sin(l)*u};default:return{x:o,y:i}}}var fe=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:o,height:i,dpr:a}=this.canvasContext,{physics:s,particle:c}=this.config;r.setTransform(1,0,0,1,0,0),r.clearRect(0,0,o*a,i*a),r.scale(a,a);let l=this.particles,u=l.length,f=0,m=!0,p=100,P=-p,F=o+p,T=-p,y=i+p;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<P||d.x>F||d.y<T||d.y>y){(d.y>y||d.x<P-200||d.x>F+200)&&(d.active=!1);continue}at(r,d,{customDraw:this.drawShape}),f++,m=!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 R=this.continuousConfig.numberOfPieces-f;if(R>0){for(let A=u-1;A>=0&&R>0;A--)l[A].active||(lt(l[A]),l.splice(A,1));this.spawnParticles(Math.min(R,5))}}else f<this.continuousConfig.numberOfPieces&&this.spawnParticles(Math.min(3,this.continuousConfig.numberOfPieces-f));this.lastSpawnTime=t}}if(this.mode==="firework"){let w=0;for(let x=0;x<u;x++)l[x].active&&l[x].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")&&m){this.complete();return}this.animationFrameId=requestAnimationFrame(this.animate)};this.origin=t,this.config=Ee(n),this.mode=n?.mode??"burst",this.spawnArea=n?.spawnArea,this.continuousConfig={...Ke,...n?.continuous},this.fireworkConfig={...Qe,...n?.firework},this.canvasConfig={...Ie,...n?.canvas},this.drawShape=n?.particle?.drawShape,this.canvasConfig.frameRate&&(this.frameInterval=1e3/this.canvasConfig.frameRate)}start(){if(this.isRunning)return this.createHandle();if(!z())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,W++,this.canvasContext=rn(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:o}=this.config,{x:i,y:a}=this.origin,s=Math.min(t,Fe.MAX_PARTICLES);for(let c=0;c<s;c++){let l;if(r.direction==="radial")l=C()*I.TWO_PI;else{let m=ce(r.direction,r.angle),p=O(r.spread);l=m+(C()-.5)*p}let u=h(r.velocity[0],r.velocity[1]),f=U(i,a,l,u,n.colors,n.shapes,n.size,n.opacity,n.lifespan,o.rotationSpeed,{images:n.images,tiltRange:n.tilt,spinSpeedRange:n.spinSpeed,depth3D:n.depth3D});this.particles.push(f)}}spawnParticles(t){if(!this.canvasContext)return;let{particle:n,physics:r}=this.config,{width:o,height:i}=this.canvasContext;for(let a=0;a<t;a++){let s;this.spawnArea?s=ct(this.spawnArea,o,i):this.mode==="snow"||this.mode==="rain"?s={x:h(0,o),y:-20}:s={x:h(0,o),y:h(-20,0)};let c,l;this.mode==="snow"?(c=O(h(-20,20)-90),l=h(.5,2)):this.mode==="rain"?(c=O(-90),l=h(8,15)):(c=C()*I.TWO_PI,l=h(2,6));let u=U(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:o,spread:i,secondaryExplosions:a,rocketColors:s,burstColors:c,trailLength:l}=this.fireworkConfig,u=this.spawnArea?ct(this.spawnArea,t,n).x:h(t*.2,t*.8),f=n*(1-r),m=u+h(-50,50),p=U(u,n,O(-90+h(-10,10)),h(15,25),s,["circle"],[3,5],[1,1],2e3,0);p.data={isRocket:!0,targetY:f,targetX:m,burstCount:o,spread:i,burstColors:c,secondaryExplosions:a,trailLength:l},this.particles.push(p)}explodeFirework(t,n,r){let{burstCount:o=80,spread:i=360,burstColors:a,secondaryExplosions:s}=r,c=a??this.config.particle.colors,l=O(i);for(let u=0;u<o;u++){let f=u/o*l-l/2+O(-90),m=h(4,12),p=U(t,n,f,m,c,this.config.particle.shapes,[2,6],[.8,1],1500,this.config.physics.rotationSpeed);s&&C()<.1&&(p.data={willExplode:!0,burstColors:c}),this.particles.push(p)}}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,W--,this.config.autoCleanup&&on()}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:o}=this.config,{x:i,y:a}=this.origin;for(let s=0;s<t;s++){let c;if(r.direction==="radial")c=C()*I.TWO_PI;else{let f=ce(r.direction,r.angle),m=O(r.spread);c=f+(C()-.5)*m}let l=h(r.velocity[0],r.velocity[1]),u=U(i,a,c,l,n.colors,n.shapes,n.size,n.opacity,n.lifespan,o.rotationSpeed);this.particles.push(u)}}}clear(){this.particles=[]}getParticleCount(){return st(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 me(e,t){return new fe(e,t).start()}function Ae(e,t){if(!e||!z())return null;let n=e.getBoundingClientRect(),r={x:n.left+n.width/2,y:n.top+n.height/2};return me(r,t)}function an(){return W}function sn(){b&&(b.remove(),b=null,L=null),W=0}import{useCallback as G,useRef as ln,useState as cn,useEffect as un}from"react";function Y(){let[e,t]=cn(!1),n=ln(new Set);un(()=>()=>{n.current.forEach(l=>l.stop()),n.current.clear()},[]);let r=G((l,u)=>{let f=me(l,u);return n.current.add(f),t(!0),f.promise.then(()=>{n.current.delete(f),n.current.size===0&&t(!1)}),f},[]),o=G((l,u)=>{let f=Ae(l,u);return f?(n.current.add(f),t(!0),f.promise.then(()=>{n.current.delete(f),n.current.size===0&&t(!1)}),f):null},[]),i=G(()=>{n.current.forEach(l=>l.stop()),n.current.clear(),t(!1)},[]),a=G(()=>{n.current.forEach(l=>l.pause())},[]),s=G(()=>{n.current.forEach(l=>l.resume())},[]),c=G(()=>Array.from(n.current),[]);return{fire:r,fireFromElement:o,isActive:e,stopAll:i,pauseAll:a,resumeAll:s,getActiveHandles:c}}import{useEffect as pe,useRef as te,useCallback as ut,forwardRef as dt,useImperativeHandle as dn}from"react";import{jsx as mt}from"react/jsx-runtime";function fn({active:e,origin:t,triggerRef:n,options:r,onComplete:o}){let{fire:i,fireFromElement:a}=Y(),s=te(!1);return pe(()=>{if(e&&!s.current){s.current=!0;let c=null;n?.current?c=a(n.current,r):t&&(c=i(t,r)),c&&c.promise.then(()=>{o?.()})}},[e,t,n,r,i,a,o]),pe(()=>{e||(s.current=!1)},[e]),null}var mn=dt(({options:e,style:t},n)=>{let r=te(null),{fireFromElement:o}=Y();return dn(n,()=>({fire:()=>o(r.current,e)})),mt("div",{ref:r,style:{position:"absolute",width:1,height:1,pointerEvents:"none",...t},"aria-hidden":"true"})});mn.displayName="ConfettiTrigger";var ft=dt(({children:e,confettiOptions:t,fireOnClick:n=!0,onClick:r,...o},i)=>{let a=te(null),{fireFromElement:s}=Y(),c=ut(u=>{a.current=u,typeof i=="function"?i(u):i&&(i.current=u)},[i]),l=ut(u=>{n&&a.current&&s(a.current,t),r?.(u)},[n,s,t,r]);return mt("button",{ref:c,onClick:l,...o,children:e})});ft.displayName="ConfettiButton";function pn({width:e,height:t,numberOfPieces:n=200,confettiSource:r,initialVelocityX:o,initialVelocityY:i,recycle:a=!0,run:s=!0,gravity:c=.3,wind:l=0,opacity:u=1,drawShape:f,tweenDuration:m=100,colors:p,onConfettiComplete:P,frameRate:F}){let{fire:T}=Y(),y=te(null),w=te(!1);return pe(()=>{if(!s){y.current&&(y.current.stop(),y.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},x=typeof o=="number"?[o*.5,o*1.5]:o?[o.min,o.max]:[4,10],R=typeof i=="number"?[i*.5,i*1.5]:i?[i.min,i.max]:[10,30],A=(e??window.innerWidth)/2,H=0;return y.current=T({x:A,y:H},{particleCount:n,particle:{colors:p??["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff"],opacity:[u*.8,u],shapes:["square","circle","rectangle"],drawShape:f},physics:{gravity:c*10,wind:l*5,windVariation:x[1]-x[0]},direction:{velocity:R},mode:"continuous",spawnArea:d,continuous:{recycle:a,numberOfPieces:n,spawnRate:30,run:s,tweenDuration:m},canvas:{width:e,height:t,frameRate:F,autoResize:!e&&!t},onComplete:P}),()=>{y.current&&(y.current.stop(),y.current=null)}},[s,e,t,n,r,o,i,a,c,l,u,f,m,p,P,F,T]),pe(()=>{y.current},[a]),null}pn.displayName="Confetti";var Wn=Math.PI*2,hn=Math.PI/180,pt=1e3/60;function v(){if(typeof crypto<"u"&&crypto.getRandomValues){let e=new Uint32Array(1);return crypto.getRandomValues(e),e[0]/4294967296}return Math.random()}function he(e){return e*hn}function N(e,t,n){return Math.min(Math.max(e,t),n)}function Se(e,t){let n=Math.max(0,e-t),r=n/pt;return Object.freeze({value:n,factor:r})}function ht(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 o,i,a,s=255;if(r.length===3)o=parseInt(r[0]+r[0],16),i=parseInt(r[1]+r[1],16),a=parseInt(r[2]+r[2],16);else if(r.length===6)o=parseInt(r.slice(0,2),16),i=parseInt(r.slice(2,4),16),a=parseInt(r.slice(4,6),16);else if(r.length===8)o=parseInt(r.slice(0,2),16),i=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:o,g:i,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 Oe(e,t){let n=ht(e);if(!n)return e;let{r,g:o,b:i,a}=n,s=N(r+t,0,255),c=N(o+t,0,255),l=N(i+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 q(){if(typeof window>"u")return!1;try{return window.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1}catch{return!1}}var gn=0;function ne(){return++gn}function ge(e){if(e.length===0)return;let t=Math.floor(v()*e.length);return e[t]}function be(e){return typeof requestAnimationFrame<"u"?requestAnimationFrame(e):setTimeout(e,pt)}function De(e){typeof cancelAnimationFrame<"u"?cancelAnimationFrame(e):clearTimeout(e)}function Me(){return typeof window>"u"?1:Math.min(window.devicePixelRatio||1,2)}var gt=Object.freeze(["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"]),bn=Object.freeze(["square","circle"]),Ce=Math.PI*2,ye=class e{constructor(t,n,r,o,i,a,s,c,l,u,f,m,p,P,F,T,y){this.id=t,this.position=n,this.velocity=r,this.angle2D=o,this.gravity=i,this.drift=a,this.decay=s,this.wobble=c,this.tilt=l,this.roll=u,this.rotate=f,this.color=m,this.shape=p,this.size=P,this.scalar=F,this.flat=T,this.tick=0,this.totalTicks=y,this.destroyed=!1,this.opacity=1}static create(t,n,r={}){let{angle:o=90,spread:i=45,startVelocity:a=45,decay:s=.94,gravity:c=1,drift:l=0,flat:u=!1,ticks:f=200,origin:m={x:.5,y:.5},colors:p=gt,shapes:P=bn,scalar:F=1,size:T=4}=r,y={x:m.x*t,y:m.y*n},w=he(o),d=he(i),x=-w+(.5*d-v()*d),R=a*.5+v()*a,A={angle:v()*Ce,angleSpeed:v()*.1+.05,moveSpeed:-15+v()*30,distance:25+v()*15},H={value:v()*Ce,sinDirection:v()>=.5?1:-1,cosDirection:v()>=.5?1:-1,speed:(v()*.4+.3)*(v()>.5?1:-1),enable:!u},oe={angle:v()*Ce,speed:(15+v()*10)/60,horizontal:v()>.3,vertical:v()>.7,enable:!u},_={angle:v()*Ce,speed:(v()*2-1)*.1,enable:!u},j=ge(p)??gt[0],ie=ge(P)??"square";return new e(ne(),y,R,x,c*3,l,s,A,H,oe,_,j,ie,T,F,u,f)}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}},ve=class{constructor(t=1e3){this.pool=[];this.maxSize=t}acquire(t,n,r){let o=this.pool.pop();return o?this.resetParticle(o,t,n,r):ye.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,o){let i=ye.create(n,r,o);return Object.assign(t,i,{id:t.id}),t.destroyed=!1,t}};var S=Math.PI*2,_e=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,o=Math.sin(t.angle2D)*t.velocity;t.position.x+=r*n.factor+t.drift*n.factor,t.position.y+=o*n.factor+t.gravity*n.factor,t.velocity*=t.decay,t.tick++;let i=t.tick/t.totalTicks;t.opacity=1-Math.pow(i,2),t.tick>=t.totalTicks&&(t.destroyed=!0)}},Be=class{constructor(){this.id="wobble"}init(t){t.wobble||(t.wobble={angle:Math.random()*S,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>S&&(r.angle-=S);let o=Math.cos(r.angle)*r.distance*.1;t.position.x+=o*n.factor}},Le=class{constructor(){this.id="tilt"}init(t){t.tilt||(t.tilt={value:Math.random()*S,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>S?r.value-=S:r.value<0&&(r.value+=S)}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}}},Ne=class{constructor(){this.id="roll"}init(t){t.roll||(t.roll={angle:Math.random()*S,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>S&&(r.angle-=S)}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}},ke=class{constructor(){this.id="rotate"}init(t){t.rotate||(t.rotate={angle:Math.random()*S,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>S?r.angle-=S:r.angle<0&&(r.angle+=S)}},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 bt(){return[new _e,new Be,new Le,new Ne,new ke,new He]}var Ct=Math.PI*2,ze=class{constructor(){this.type="circle"}draw(t,n,r){let o=n.flat?1:.6+Math.sin(n.wobble.angle)*.4;t.ellipse(0,0,r*o,r*(1-o*.3),n.tilt?.value??0,0,Ct)}},Ue=class{constructor(){this.type="square"}draw(t,n,r){let o=n.flat?0:Math.sin(n.wobble.angle)*r*.3;t.moveTo(-r+o,-r),t.lineTo(r+o,-r*.5),t.lineTo(r-o,r),t.lineTo(-r-o,r*.5)}},We=class{constructor(){this.type="rectangle"}draw(t,n,r){let o=r*1.5,i=r*.6,a=n.flat?0:Math.sin(n.wobble.angle)*i*.2;t.moveTo(-o+a,-i),t.lineTo(o+a,-i*.5),t.lineTo(o-a,i),t.lineTo(-o-a,i*.5)}},Ge=class{constructor(){this.type="star"}draw(t,n,r){let o=r,i=r*.5,a=5,s=Math.PI/a,c=-Math.PI/2;t.moveTo(0,-o);for(let l=0;l<a;l++)t.lineTo(Math.cos(c)*o,Math.sin(c)*o),c+=s,t.lineTo(Math.cos(c)*i,Math.sin(c)*i),c+=s}},Ye=class{constructor(){this.type="triangle"}draw(t,n,r){let o=r*Math.sqrt(3)/2;t.moveTo(0,-o),t.lineTo(-r,o),t.lineTo(r,o)}},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)}},Ve=class{constructor(){this.type="heart"}draw(t,n,r){let i=-r*.3,a=r*.3;t.moveTo(0,i+a),t.bezierCurveTo(0-r,i,0-r,i-a*2,0,i-a),t.bezierCurveTo(0+r,i-a*2,0+r,i,0,i+a)}},$e=class{constructor(){this.type="hexagon"}draw(t,n,r){let i=Ct/6;for(let a=0;a<6;a++){let s=i*a-Math.PI/2,c=Math.cos(s)*r,l=Math.sin(s)*r;a===0?t.moveTo(c,l):t.lineTo(c,l)}}},je=class{constructor(){this.drawers=new Map;this.register(new ze),this.register(new Ue),this.register(new We),this.register(new Ge),this.register(new Ye),this.register(new qe),this.register(new Ve),this.register(new $e)}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()}},V=new je;var k=class{constructor(t={}){this.destroyed=!1;this.t=[];this.n=null;this.p=0;this.o=null;this.m=!1;this.i=null;this.P=t=>{if(this.destroyed)return;let n=Se(t,this.p);this.p=t,this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);let r=!1,o=[];for(let i=0;i<this.t.length;i++){let a=this.t[i];if(a.destroyed){o.push(i);continue}for(let s of this.e)s.isEnabled(a)&&s.update(a,n);if(a.destroyed){o.push(i);continue}r=!0,this.E(a)}for(let i=o.length-1;i>=0;i--){let a=o[i],s=this.t[a];this.l.release(s),this.t.splice(a,1)}r?this.n=be(this.P):(this.n=null,this.o?.(),this.o=null)};this.I=()=>{this.v()};this.id=`confetti-${ne()}`,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.m=!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 ve(500),this.f.resize&&this.F(),this.v()}get particles(){return this.t}async fire(t={}){if(this.f.disableForReducedMotion&&q())return Promise.resolve();if(this.destroyed)throw new Error("Cannot fire on destroyed container");let n=t.particleCount??100,r=this.canvas.width,o=this.canvas.height;for(let i=0;i<n;i++){let a=this.l.acquire(r,o,t);for(let s of this.e)s.init(a);this.t.push(a)}return this.n?new Promise(i=>{let a=this.o;this.o=()=>{a?.(),i()}}):new Promise(i=>{this.o=i,this.p=performance.now(),this.n=be(this.P)})}stop(){this.n&&(De(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.o?.(),this.o=null}reset(){this.stop(),this.l.clear()}destroy(){this.destroyed||(this.stop(),this.i&&(this.i.disconnect(),this.i=null),this.m&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.destroyed=!0)}E(t){let n=this.ctx,r=t.size*t.scalar,o={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&&(o.a=u.a),u.b!==void 0&&(o.b=u.b),u.c!==void 0&&(o.c=u.c),u.d!==void 0&&(o.d=u.d)}let a=this.e.find(l=>l.id==="roll")?.getDarkenAmount(t)??0,s=a>0?Oe(t.color,-a):t.color;n.save(),n.translate(t.position.x,t.position.y),n.rotate(t.rotate?.angle??0),n.transform(o.a??1,o.b??0,o.c??0,o.d??1,0,0),n.fillStyle=s,n.globalAlpha=t.opacity,n.beginPath();let c=V.get(t.shape);c?c.draw(n,t,r):V.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 X=["#FF6B6B","#4ECDC4","#FFE66D","#95E1D3","#F38181","#AA96DA","#FCBAD3","#A
14
14
  height: 100%;
15
15
  pointer-events: none;
16
16
  z-index: ${this.f.zIndex};
17
- `,document.body.appendChild(t),t}F(){if(typeof ResizeObserver>"u"){window.addEventListener("resize",this.I);return}this.i=new ResizeObserver(this.I),this.m?this.i.observe(document.body):this.canvas.parentElement&&this.i.observe(this.canvas.parentElement)}v(){let t=Me();if(this.m){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 we=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){V.register(t)}getUpdaters(){return Object.freeze([...this.e])}getMovers(){return Object.freeze([...this.C])}getShapeDrawer(t){return V.get(t)}createContainer(t){let n=new k(t);return this.u.push(n),n}getDefaultContainer(){return(!this.s||this.s.destroyed)&&(this.s=new k,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 we),Xe}var re=new Map;function yt(e,t){let n=re.get(e);if(!n||n.destroyed){let r=e==="default"?{resize:!0,...t}:{canvas:e,resize:t?.resize??!1,...t};n=new k(r),re.set(e,n)}return n}function vt(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 E(e={}){if(e.disableForReducedMotion&&q())return Promise.resolve();try{return yt("default").fire(vt(e))}catch{return null}}E.create=function(e,t={}){let n=yt(e,t),r=(o={})=>{if((o.disableForReducedMotion??t.disableForReducedMotion)&&q())return Promise.resolve();try{return n.fire(vt(o))}catch{return null}};return r.reset=()=>{n.stop()},r};E.reset=function(){let e=re.get("default");e&&!e.destroyed&&e.stop()};E.fireworks=async function(e={}){let t={particleCount:30,spread:55,...e};await Promise.all([E({...t,angle:60,origin:{x:0,y:.65}}),E({...t,angle:120,origin:{x:1,y:.65}})])};E.schoolPride=function(e={}){let t=Date.now()+3e3,n=e.colors??["#bb0000","#ffffff"];function r(){E({particleCount:2,angle:60,spread:55,origin:{x:0,y:.6},colors:n,...e}),E({particleCount:2,angle:120,spread:55,origin:{x:1,y:.6},colors:n,...e}),Date.now()<t&&requestAnimationFrame(r)}r()};E.snow=function(e={}){let{duration:t=5e3,...n}=e,r=Date.now()+t;function o(){E({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(o)}o()};E.burst=function(e,t={}){return E({particleCount:80,spread:360,startVelocity:30,decay:.92,scalar:1.2,origin:e,...t})};E.destroyAll=function(){for(let e of re.values())e.destroy();re.clear(),Ze().destroyAll()};E.getShapes=function(){return["square","circle","star","triangle","rectangle","diamond","heart","hexagon"]};var wt={rainbow:X,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"]},$={celebration:["🎉","🎊","🥳","✨","🎈"],hearts:["❤️","💕","💖","💗","💓","💘"],stars:["⭐","🌟","✨","💫","⚡"],money:["💰","💵","💸","🤑","💎"],christmas:["🎄","🎅","🎁","❄️","⭐"],halloween:["🎃","👻","🦇","🕷️","💀"],birthday:["🎂","🎁","🎈","🎉","🥳"],food:["🍕","🍔","🍟","🌭","🍿"]},Je={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:[...X],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:[...wt.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:$.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:$.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:[...wt.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:$.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:$.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:$.birthday.map(e=>({src:e,isEmoji:!0})),size:[12,20],lifespan:5e3},direction:{direction:"up",spread:80,velocity:[25,45]}}}};function vr(e){let t=Je[e];if(!t)throw new Error(`Preset "${e}" not found. Available presets: ${Object.keys(Je).join(", ")}`);return t}function wr(){return Object.keys(Je)}function Cn(e){let{path:t,matrix:n,fillColor:r,strokeColor:o,strokeWidth:i}=e,a=wn(t);return{type:"path",path:t,matrix:n?[...n]:void 0,fillColor:r,strokeColor:o,strokeWidth:i,bounds:a}}function Pt(e){let{text:t,scalar:n=1,color:r,fontFamily:o="serif",fontWeight:i="normal",fontStyle:a="normal"}=e;return{type:"text",text:t,scalar:n,color:r,fontFamily:o,fontWeight:String(i),fontStyle:a}}async function yn(e){let{src:t,scalar:n=1}=e;return typeof t!="string"?{type:"text",text:"",scalar:n,fontFamily:`url(${t.src})`}:(await Pn(t),{type:"text",text:"",scalar:n,fontFamily:`url(${t})`,color:void 0})}function vn(e,t={}){return e.map(n=>Pt({...t,text:n}))}function wn(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,o=-1/0,i=-1/0;for(let a=0;a<t.length-1;a+=2){let s=parseFloat(t[a]),c=parseFloat(t[a+1]);!isNaN(s)&&!isNaN(c)&&(n=Math.min(n,s),r=Math.min(r,c),o=Math.max(o,s),i=Math.max(i,c))}return isFinite(n)?{minX:n,minY:r,maxX:o,maxY:i}:{minX:-1,minY:-1,maxX:1,maxY:1}}function Pn(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{wt as COLOR_PALETTES,fn as ConfettiBurst,ft as ConfettiButton,fe as ConfettiEngine,X as DEFAULT_COLORS,D as DEFAULT_CONFIG,se as DEFAULT_DIRECTION,le as DEFAULT_PARTICLE,ae as DEFAULT_PHYSICS,Te as DIRECTION_ANGLES,It as EASING_FUNCTIONS,$ as EMOJI_SETS,Je as PRESETS,M as clamp,E as confetti,me as createConfettiExplosion,E as default,O as degToRad,Ae as fireFromElement,sn as forceCleanup,an as getActiveAnimationCount,ce as getDirectionAngle,St as getElementCenter,en as getMaxPoolSize,vr as getPreset,wr as getPresetNames,z as isBrowser,Ft as lerp,Ee as mergeConfig,K as parseColor,xt as radToDeg,J as randomFromArray,h as randomInRange,Tt as randomInt,Q as rgbaToString,Qt as setMaxPoolSize,yn as shapeFromImage,Cn as shapeFromPath,Pt as shapeFromText,vn as shapesFromEmoji,Y 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};
@@ -115,10 +115,26 @@ export interface TextShape {
115
115
  /** Cached bitmap for performance */
116
116
  readonly _bitmap?: ImageBitmap | HTMLCanvasElement;
117
117
  }
118
+ /**
119
+ * Custom shape created from an image (URL or HTMLImageElement)
120
+ */
121
+ export interface ImageShape {
122
+ readonly type: "image";
123
+ /** Image source URL */
124
+ readonly src: string;
125
+ /** Pre-loaded image element */
126
+ readonly image?: HTMLImageElement;
127
+ /** Scale factor. Default: 1 */
128
+ readonly scalar?: number;
129
+ /** Display width */
130
+ readonly width?: number;
131
+ /** Display height */
132
+ readonly height?: number;
133
+ }
118
134
  /**
119
135
  * Custom shape union type
120
136
  */
121
- export type CustomShape = PathShape | TextShape;
137
+ export type CustomShape = PathShape | TextShape | ImageShape;
122
138
  /**
123
139
  * Shape types for confetti particles
124
140
  */
@@ -392,7 +408,7 @@ export interface CanvasConfig {
392
408
  readonly height: number | null;
393
409
  /** Auto-resize on window resize. Default: true */
394
410
  readonly autoResize: boolean;
395
- /** Resize debounce delay (ms). Default: 100 */
411
+ /** @deprecated Currently unused. Resize events are handled immediately via ResizeObserver. */
396
412
  readonly resizeDebounce: number;
397
413
  /** Frame rate cap (null = uncapped/60fps). Default: null */
398
414
  readonly frameRate: number | null;
@@ -709,6 +725,66 @@ export interface ConfettiButtonProps extends React$1.ButtonHTMLAttributes<HTMLBu
709
725
  readonly fireOnClick?: boolean;
710
726
  /** Children elements */
711
727
  readonly children: React$1.ReactNode;
728
+ /** Offset the burst origin from the button center (in pixels) */
729
+ readonly originOffset?: {
730
+ x?: number;
731
+ y?: number;
732
+ };
733
+ /** Shorthand direction for the burst (e.g., 'up', 'down') */
734
+ readonly direction?: BurstDirection;
735
+ }
736
+ /**
737
+ * Props for the Confetti component (react-confetti compatible API)
738
+ */
739
+ export interface ConfettiProps {
740
+ /** Canvas width */
741
+ readonly width?: number;
742
+ /** Canvas height */
743
+ readonly height?: number;
744
+ /** Number of confetti pieces at one time */
745
+ readonly numberOfPieces?: number;
746
+ /** Rectangle where confetti should spawn */
747
+ readonly confettiSource?: SpawnArea;
748
+ /** Friction coefficient */
749
+ readonly friction?: number;
750
+ /** Wind force */
751
+ readonly wind?: number;
752
+ /** Gravity strength */
753
+ readonly gravity?: number;
754
+ /** Initial horizontal velocity */
755
+ readonly initialVelocityX?: number | {
756
+ min: number;
757
+ max: number;
758
+ };
759
+ /** Initial vertical velocity */
760
+ readonly initialVelocityY?: number | {
761
+ min: number;
762
+ max: number;
763
+ };
764
+ /** Colors array */
765
+ readonly colors?: string[];
766
+ /** Opacity */
767
+ readonly opacity?: number;
768
+ /** Keep spawning confetti */
769
+ readonly recycle?: boolean;
770
+ /** Run the animation */
771
+ readonly run?: boolean;
772
+ /** Frame rate cap */
773
+ readonly frameRate?: number;
774
+ /** Tween duration */
775
+ readonly tweenDuration?: number;
776
+ /** Tween function */
777
+ readonly tweenFunction?: EasingFunction;
778
+ /** Custom draw function */
779
+ readonly drawShape?: (ctx: CanvasRenderingContext2D) => void;
780
+ /** Callback when all confetti has fallen */
781
+ readonly onConfettiComplete?: () => void;
782
+ /** Canvas ref */
783
+ readonly canvasRef?: React$1.RefObject<HTMLCanvasElement>;
784
+ /** Canvas class name */
785
+ readonly className?: string;
786
+ /** Canvas style */
787
+ readonly style?: React$1.CSSProperties;
712
788
  }
713
789
  /**
714
790
  * Preset configuration names
@@ -722,6 +798,38 @@ export interface PresetConfig {
722
798
  readonly options: ConfettiBurstOptions;
723
799
  readonly description: string;
724
800
  }
801
+ /**
802
+ * Confetti instance created by confetti.create()
803
+ */
804
+ export interface ConfettiInstance {
805
+ (options?: CanvasConfettiOptions): Promise<void> | null;
806
+ reset(): void;
807
+ }
808
+ /**
809
+ * The confetti function type with all attached convenience methods.
810
+ * This provides proper TypeScript types for the functional API's
811
+ * attached methods like confetti.fireworks(), confetti.snow(), etc.
812
+ */
813
+ export interface ConfettiFunction {
814
+ (options?: CanvasConfettiOptions): Promise<void> | null;
815
+ create(canvas: HTMLCanvasElement, options?: ConfettiCreateOptions): ConfettiInstance;
816
+ reset(): void;
817
+ fireworks(options?: Partial<CanvasConfettiOptions>): Promise<void>;
818
+ schoolPride(options?: Partial<CanvasConfettiOptions>): {
819
+ cancel: () => void;
820
+ };
821
+ snow(options?: {
822
+ duration?: number;
823
+ } & Partial<CanvasConfettiOptions>): {
824
+ cancel: () => void;
825
+ };
826
+ burst(origin: {
827
+ x: number;
828
+ y: number;
829
+ }, options?: Partial<CanvasConfettiOptions>): Promise<void> | null;
830
+ destroyAll(): void;
831
+ getShapes(): string[];
832
+ }
725
833
  /**
726
834
  * Default vibrant color palette for confetti particles
727
835
  * Designed for high visibility on both light and dark backgrounds
@@ -742,6 +850,34 @@ export declare const DEFAULT_DIRECTION: DirectionConfig;
742
850
  * Optimized for realistic confetti appearance
743
851
  */
744
852
  export declare const DEFAULT_PARTICLE: ParticleConfig;
853
+ /**
854
+ * Default trail configuration
855
+ */
856
+ export declare const DEFAULT_TRAIL: TrailConfig;
857
+ /**
858
+ * Default glow configuration
859
+ */
860
+ export declare const DEFAULT_GLOW: GlowConfig;
861
+ /**
862
+ * Default continuous mode configuration
863
+ */
864
+ export declare const DEFAULT_CONTINUOUS: ContinuousConfig;
865
+ /**
866
+ * Default firework configuration
867
+ */
868
+ export declare const DEFAULT_FIREWORK: FireworkConfig;
869
+ /**
870
+ * Default canvas configuration
871
+ */
872
+ export declare const DEFAULT_CANVAS: CanvasConfig;
873
+ /**
874
+ * Default accessibility configuration
875
+ */
876
+ export declare const DEFAULT_ACCESSIBILITY: {
877
+ readonly disableForReducedMotion: false;
878
+ readonly ariaLabel: "Confetti animation";
879
+ readonly ariaHidden: true;
880
+ };
745
881
  /**
746
882
  * Complete default configuration
747
883
  */
@@ -883,6 +1019,77 @@ export declare function forceCleanup(): void;
883
1019
  * ```
884
1020
  */
885
1021
  export declare function useConfetti(): UseConfettiReturn;
1022
+ /**
1023
+ * Hook for confetti triggered by a ref element
1024
+ *
1025
+ * @param options - Confetti configuration options
1026
+ * @returns Ref to attach to trigger element and fire function
1027
+ *
1028
+ * @example
1029
+ * ```tsx
1030
+ * const { ref, fire } = useConfettiTrigger();
1031
+ *
1032
+ * return (
1033
+ * <button ref={ref} onClick={fire}>
1034
+ * Celebrate!
1035
+ * </button>
1036
+ * );
1037
+ * ```
1038
+ */
1039
+ export declare function useConfettiTrigger<T extends HTMLElement = HTMLElement>(options?: ConfettiBurstOptions): {
1040
+ ref: React$1.RefObject<T>;
1041
+ fire: () => ExplosionHandle | null;
1042
+ isActive: boolean;
1043
+ };
1044
+ /**
1045
+ * Hook for auto-firing confetti when a condition becomes true
1046
+ *
1047
+ * @param condition - When true, fires confetti
1048
+ * @param origin - Origin point for the burst
1049
+ * @param options - Confetti configuration options
1050
+ *
1051
+ * @example
1052
+ * ```tsx
1053
+ * const [isComplete, setIsComplete] = useState(false);
1054
+ *
1055
+ * useConfettiOnCondition(isComplete, { x: 500, y: 300 });
1056
+ * ```
1057
+ */
1058
+ export declare function useConfettiOnCondition(condition: boolean, origin: BurstOrigin, options?: ConfettiBurstOptions): void;
1059
+ /**
1060
+ * Hook for sequencing multiple confetti bursts
1061
+ *
1062
+ * @param bursts - Array of burst configurations with delays
1063
+ * @returns Start function and active state
1064
+ *
1065
+ * @example
1066
+ * ```tsx
1067
+ * const { start, isActive } = useConfettiSequence([
1068
+ * { origin: { x: 100, y: 100 }, delay: 0 },
1069
+ * { origin: { x: 300, y: 100 }, delay: 200 },
1070
+ * { origin: { x: 500, y: 100 }, delay: 400 },
1071
+ * ]);
1072
+ * ```
1073
+ */
1074
+ export declare function useConfettiSequence(bursts: Array<{
1075
+ origin: BurstOrigin;
1076
+ options?: ConfettiBurstOptions;
1077
+ delay: number;
1078
+ }>): {
1079
+ start: () => void;
1080
+ isActive: boolean;
1081
+ cancel: () => void;
1082
+ };
1083
+ /**
1084
+ * Hook for viewport-centered confetti
1085
+ *
1086
+ * @param options - Confetti configuration options
1087
+ * @returns Fire function for center-screen confetti
1088
+ */
1089
+ export declare function useConfettiCenter(options?: ConfettiBurstOptions): {
1090
+ fire: () => ExplosionHandle;
1091
+ isActive: boolean;
1092
+ };
886
1093
  /**
887
1094
  * Declarative confetti component that fires when active prop changes
888
1095
  *
@@ -905,6 +1112,33 @@ export declare function useConfetti(): UseConfettiReturn;
905
1112
  * ```
906
1113
  */
907
1114
  export declare function ConfettiBurst({ active, origin, triggerRef, options, onComplete, }: ConfettiBurstProps): null;
1115
+ /**
1116
+ * Handle type for ConfettiTrigger ref
1117
+ */
1118
+ export interface ConfettiTriggerHandle {
1119
+ fire: () => ExplosionHandle | null;
1120
+ }
1121
+ /**
1122
+ * Invisible trigger component that fires confetti from its position
1123
+ *
1124
+ * @example
1125
+ * ```tsx
1126
+ * const triggerRef = useRef<ConfettiTriggerHandle>(null);
1127
+ *
1128
+ * return (
1129
+ * <div style={{ position: 'relative' }}>
1130
+ * <ConfettiTrigger ref={triggerRef} options={{ particleCount: 100 }} />
1131
+ * <button onClick={() => triggerRef.current?.fire()}>
1132
+ * Fire!
1133
+ * </button>
1134
+ * </div>
1135
+ * );
1136
+ * ```
1137
+ */
1138
+ export declare const ConfettiTrigger: React$1.ForwardRefExoticComponent<{
1139
+ options?: ConfettiBurstProps["options"];
1140
+ style?: React$1.CSSProperties;
1141
+ } & React$1.RefAttributes<ConfettiTriggerHandle>>;
908
1142
  /**
909
1143
  * Button component that automatically fires confetti on click
910
1144
  *
@@ -921,6 +1155,150 @@ export declare function ConfettiBurst({ active, origin, triggerRef, options, onC
921
1155
  * ```
922
1156
  */
923
1157
  export declare const ConfettiButton: React$1.ForwardRefExoticComponent<ConfettiButtonProps & React$1.RefAttributes<HTMLButtonElement>>;
1158
+ /**
1159
+ * Props for ConfettiOnMount component
1160
+ */
1161
+ export interface ConfettiOnMountProps {
1162
+ origin?: BurstOrigin;
1163
+ options?: ConfettiBurstProps["options"];
1164
+ onComplete?: () => void;
1165
+ delay?: number;
1166
+ }
1167
+ /**
1168
+ * Component that fires confetti when mounted
1169
+ *
1170
+ * @example
1171
+ * ```tsx
1172
+ * // Fire confetti when a success page loads
1173
+ * function SuccessPage() {
1174
+ * return (
1175
+ * <div>
1176
+ * <ConfettiOnMount
1177
+ * origin={{ x: window.innerWidth / 2, y: window.innerHeight / 3 }}
1178
+ * options={{ particleCount: 100 }}
1179
+ * />
1180
+ * <h1>Success!</h1>
1181
+ * </div>
1182
+ * );
1183
+ * }
1184
+ * ```
1185
+ */
1186
+ export declare function ConfettiOnMount({ origin, options, onComplete, delay, }: ConfettiOnMountProps): null;
1187
+ /**
1188
+ * Props for ConfettiCannon component
1189
+ */
1190
+ export interface ConfettiCannonProps {
1191
+ /** Position from left (percentage or pixels) */
1192
+ left?: number | string;
1193
+ /** Position from top (percentage or pixels) */
1194
+ top?: number | string;
1195
+ /** Angle in degrees (0 = right, 90 = up) */
1196
+ angle?: number;
1197
+ /** Confetti options */
1198
+ options?: ConfettiBurstProps["options"];
1199
+ /** When true, fires the cannon */
1200
+ fire?: boolean;
1201
+ /** Callback when animation completes */
1202
+ onComplete?: () => void;
1203
+ }
1204
+ /**
1205
+ * Positioned cannon component for directional confetti bursts
1206
+ *
1207
+ * @example
1208
+ * ```tsx
1209
+ * <ConfettiCannon
1210
+ * left="10%"
1211
+ * top="80%"
1212
+ * angle={60}
1213
+ * fire={shouldFire}
1214
+ * options={{ particleCount: 50 }}
1215
+ * />
1216
+ * ```
1217
+ */
1218
+ export declare function ConfettiCannon({ left, top, angle, options, fire: shouldFire, onComplete, }: ConfettiCannonProps): null;
1219
+ /**
1220
+ * React-confetti compatible Confetti component
1221
+ *
1222
+ * This component provides a drop-in replacement for react-confetti
1223
+ * with continuous confetti that falls from the top of the screen.
1224
+ *
1225
+ * @example
1226
+ * ```tsx
1227
+ * // Basic usage - continuous confetti
1228
+ * <Confetti />
1229
+ *
1230
+ * // With options
1231
+ * <Confetti
1232
+ * width={window.innerWidth}
1233
+ * height={window.innerHeight}
1234
+ * numberOfPieces={200}
1235
+ * recycle={true}
1236
+ * run={true}
1237
+ * />
1238
+ *
1239
+ * // With custom draw function
1240
+ * <Confetti
1241
+ * drawShape={ctx => {
1242
+ * ctx.beginPath();
1243
+ * ctx.arc(0, 0, 5, 0, Math.PI * 2);
1244
+ * ctx.fill();
1245
+ * }}
1246
+ * />
1247
+ * ```
1248
+ */
1249
+ export interface ConfettiComponentProps {
1250
+ /** Width of the canvas in pixels (default: window.innerWidth) */
1251
+ width?: number;
1252
+ /** Height of the canvas in pixels (default: window.innerHeight) */
1253
+ height?: number;
1254
+ /** Number of confetti pieces (default: 200) */
1255
+ numberOfPieces?: number;
1256
+ /** Spawn area for confetti pieces */
1257
+ confettiSource?: {
1258
+ x: number;
1259
+ y: number;
1260
+ w?: number;
1261
+ h?: number;
1262
+ };
1263
+ /** Initial horizontal velocity range (default: [4, 10]) */
1264
+ initialVelocityX?: number | {
1265
+ min: number;
1266
+ max: number;
1267
+ };
1268
+ /** Initial vertical velocity range (default: [10, 30]) */
1269
+ initialVelocityY?: number | {
1270
+ min: number;
1271
+ max: number;
1272
+ };
1273
+ /** Whether to recycle confetti (default: true) */
1274
+ recycle?: boolean;
1275
+ /** Whether the animation is running (default: true) */
1276
+ run?: boolean;
1277
+ /** Gravity value (default: 0.3) */
1278
+ gravity?: number;
1279
+ /** Wind value (default: 0) */
1280
+ wind?: number;
1281
+ /** Opacity of confetti pieces (0-1, default: 1) */
1282
+ opacity?: number;
1283
+ /** Custom draw function */
1284
+ drawShape?: (ctx: CanvasRenderingContext2D) => void;
1285
+ /** Tween duration when recycle changes (ms) */
1286
+ tweenDuration?: number;
1287
+ /** Array of colors */
1288
+ colors?: string[];
1289
+ /** Callback when confetti is created */
1290
+ onConfettiComplete?: (confetti: any) => void;
1291
+ /** Frame rate limit */
1292
+ frameRate?: number;
1293
+ /** Z-index of the canvas */
1294
+ style?: React$1.CSSProperties;
1295
+ /** Class name for the canvas */
1296
+ className?: string;
1297
+ }
1298
+ export declare function Confetti({ width, height, numberOfPieces, confettiSource, initialVelocityX, initialVelocityY, recycle, run, gravity, wind, opacity, drawShape, tweenDuration, colors, onConfettiComplete, frameRate, }: ConfettiComponentProps): null;
1299
+ export declare namespace Confetti {
1300
+ var displayName: string;
1301
+ }
924
1302
  /**
925
1303
  * Generates a random number within a range (inclusive min, exclusive max)
926
1304
  * @param min - Minimum value (inclusive)
@@ -1031,10 +1409,14 @@ export declare namespace confetti {
1031
1409
  };
1032
1410
  var reset: () => void;
1033
1411
  var fireworks: (options?: Partial<CanvasConfettiOptions>) => Promise<void>;
1034
- var schoolPride: (options?: Partial<CanvasConfettiOptions>) => void;
1412
+ var schoolPride: (options?: Partial<CanvasConfettiOptions>) => {
1413
+ cancel: () => void;
1414
+ };
1035
1415
  var snow: (options?: {
1036
1416
  duration?: number;
1037
- } & Partial<CanvasConfettiOptions>) => void;
1417
+ } & Partial<CanvasConfettiOptions>) => {
1418
+ cancel: () => void;
1419
+ };
1038
1420
  var burst: (origin: {
1039
1421
  x: number;
1040
1422
  y: number;
@@ -1186,6 +1568,26 @@ export declare function getPreset(name: PresetName): PresetConfig;
1186
1568
  * Get all available preset names
1187
1569
  */
1188
1570
  export declare function getPresetNames(): readonly PresetName[];
1571
+ /**
1572
+ * Convert a preset's ConfettiBurstOptions to CanvasConfettiOptions
1573
+ * for use with the confetti() functional API.
1574
+ *
1575
+ * Presets use the nested ConfettiBurstOptions format (particle.colors,
1576
+ * physics.gravity, direction.spread), but confetti() expects the flat
1577
+ * CanvasConfettiOptions format (colors, gravity, spread).
1578
+ *
1579
+ * @example
1580
+ * ```ts
1581
+ * import { getPreset, presetToCanvasOptions, confetti } from 'react-confetti-burst';
1582
+ *
1583
+ * const preset = getPreset('celebration');
1584
+ * confetti(presetToCanvasOptions(preset.options));
1585
+ * ```
1586
+ *
1587
+ * @param options - ConfettiBurstOptions from a preset (or any hook/component options)
1588
+ * @returns Equivalent CanvasConfettiOptions for use with confetti()
1589
+ */
1590
+ export declare function presetToCanvasOptions(options: ConfettiBurstOptions): CanvasConfettiOptions;
1189
1591
  /**
1190
1592
  * Options for creating a shape from an SVG path
1191
1593
  */
@@ -1298,7 +1700,7 @@ export declare function shapeFromImage(options: {
1298
1700
  readonly width?: number;
1299
1701
  readonly height?: number;
1300
1702
  readonly scalar?: number;
1301
- }): Promise<CustomShape>;
1703
+ }): Promise<ImageShape>;
1302
1704
  /**
1303
1705
  * Create multiple shapes from an array of emoji.
1304
1706
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-confetti-burst",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "A high-performance, zero-dependency React confetti component with directional bursts using Canvas API",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -40,7 +40,8 @@
40
40
  "typecheck": "tsc --noEmit",
41
41
  "prepare": "husky",
42
42
  "prepublishOnly": "npm run build",
43
- "size": "node -e \"const f=require('fs');const e=f.statSync('dist/esm/index.js').size;const c=f.statSync('dist/cjs/index.js').size;console.log('ESM:',(e/1024).toFixed(2)+'KB','CJS:',(c/1024).toFixed(2)+'KB','Total:',((e+c)/1024).toFixed(2)+'KB')\""
43
+ "size": "node -e \"const f=require('fs');const e=f.statSync('dist/esm/index.js').size;const c=f.statSync('dist/cjs/index.js').size;console.log('ESM:',(e/1024).toFixed(2)+'KB','CJS:',(c/1024).toFixed(2)+'KB','Total:',((e+c)/1024).toFixed(2)+'KB')\"",
44
+ "playground": "npm run dev --prefix playground"
44
45
  },
45
46
  "keywords": [
46
47
  "react",