animated-backgrounds
Version:
A feature-rich React package for stunning animated backgrounds with interactive controls, themes, performance monitoring, and layered compositions.
3 lines (2 loc) • 47.9 kB
JavaScript
import t,{useEffect as e,useState as a,useRef as r,useCallback as n,useMemo as i}from"react";function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var a=0,r=Array(e);a<e;a++)r[a]=t[a];return r}function h(t,e,a){return e=s(e),function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,u()?Reflect.construct(e,a||[],s(t).constructor):e.apply(t,a))}function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function c(t,e){for(var a=0;a<e.length;a++){var r=e[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,b(r.key),r)}}function d(t,e,a){return e&&c(t.prototype,e),a&&c(t,a),Object.defineProperty(t,"prototype",{writable:!1}),t}function f(t,e,a){return(e=b(e))in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function s(t){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},s(t)}function u(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(u=function(){return!!t})()}function g(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,r)}return a}function m(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{};e%2?g(Object(a),!0).forEach((function(e){f(t,e,a[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):g(Object(a)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))}))}return t}function y(t,e){return y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},y(t,e)}function p(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=a){var r,n,i,o,h=[],l=!0,c=!1;try{if(i=(a=a.call(t)).next,0===e){if(Object(a)!==a)return;l=!1}else for(;!(l=(r=i.call(a)).done)&&(h.push(r.value),h.length!==e);l=!0);}catch(t){c=!0,n=t}finally{try{if(!l&&null!=a.return&&(o=a.return(),Object(o)!==o))return}finally{if(c)throw n}}return h}}(t,e)||M(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(t){return function(t){if(Array.isArray(t))return o(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||M(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var a=t[Symbol.toPrimitive];if(void 0!==a){var r=a.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}function M(t,e){if(t){if("string"==typeof t)return o(t,e);var a={}.toString.call(t).slice(8,-1);return"Object"===a&&t.constructor&&(a=t.constructor.name),"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?o(t,e):void 0}}var w=function(t,e){for(var a=[],r=0;r<150;r++)a.push({x:Math.random()*t.width,y:Math.random()*t.height,radius:2*Math.random(),vx:Math.floor(50*Math.random())-25,vy:Math.floor(50*Math.random())-25,twinkle:Math.random(),color:"hsla(".concat(360*Math.random(),", 70%, 70%, 0.8)")});return function(){e.fillStyle="rgba(15, 23, 42, 0.1)",e.fillRect(0,0,t.width,t.height),a.forEach((function(a){a.twinkle+=.02;var r=Math.abs(Math.sin(a.twinkle)),n=e.createRadialGradient(a.x,a.y,0,a.x,a.y,4*a.radius);n.addColorStop(0,a.color),n.addColorStop(1,"transparent"),e.beginPath(),e.arc(a.x,a.y,4*a.radius,0,2*Math.PI),e.fillStyle=n,e.fill(),e.beginPath(),e.arc(a.x,a.y,a.radius,0,2*Math.PI),e.fillStyle="rgba(255, 255, 255, ".concat(r,")"),e.fill(),a.x+=a.vx/60,a.y+=a.vy/60,(a.x<0||a.x>t.width)&&(a.vx=-a.vx),(a.y<0||a.y>t.height)&&(a.vy=-a.vy)}))}},x=function(t,e){for(var a=[],r=0;r<75;r++)a.push({x:Math.random()*t.width,y:Math.random()*t.height,radius:30*Math.random()+5,speed:.7*Math.random()+.1,color:"hsla(".concat(360*Math.random(),", 70%, 60%, 0.6)"),glowColor:"hsla(".concat(360*Math.random(),", 70%, 60%, 0.3)")});return function(){e.fillStyle="rgba(30, 41, 59, 0.1)",e.fillRect(0,0,t.width,t.height),a.forEach((function(a){var r=e.createRadialGradient(a.x,a.y,0,a.x,a.y,2*a.radius);r.addColorStop(0,a.glowColor),r.addColorStop(1,"transparent"),e.beginPath(),e.arc(a.x,a.y,2*a.radius,0,2*Math.PI),e.fillStyle=r,e.fill(),e.beginPath(),e.arc(a.x,a.y,a.radius,0,2*Math.PI),e.fillStyle=a.color,e.fill(),e.beginPath(),e.arc(a.x-.3*a.radius,a.y-.3*a.radius,.2*a.radius,0,2*Math.PI),e.fillStyle="rgba(255, 255, 255, 0.6)",e.fill(),a.y-=a.speed,a.x+=.5*Math.sin(.03*a.y),a.y+a.radius<0&&(a.y=t.height+a.radius,a.x=Math.random()*t.width)}))}},S=function(t,e){var a=0;return function(){a+=.01;var r=e.createLinearGradient(0,0,t.width,t.height);r.addColorStop(0,"hsl(".concat(10*a%360,", 70%, 50%)")),r.addColorStop(1,"hsl(".concat((10*a+180)%360,", 70%, 50%)")),e.fillStyle=r,e.fillRect(0,0,t.width,t.height);for(var n=0;n<7;n++){e.beginPath(),e.moveTo(0,.15*t.height*n+30*Math.sin(a+n));for(var i=0;i<t.width;i+=10)e.lineTo(i,.15*t.height*n+30*Math.sin(a+n+.01*i));e.strokeStyle="rgba(255, 255, 255, ".concat(.1-.01*n,")"),e.lineWidth=2,e.stroke()}}},P=function(t,e){for(var a=[],r=0;r<150;r++)a.push({x:Math.random()*t.width,y:Math.random()*t.height,radius:3*Math.random()+1,vx:1.5*Math.random()-.75,vy:1.5*Math.random()-.75,color:"hsl(".concat(360*Math.random(),", 70%, 70%)")});return function(){e.fillStyle="rgba(15, 23, 42, 0.1)",e.fillRect(0,0,t.width,t.height),a.forEach((function(a){a.x+=a.vx,a.y+=a.vy,(a.x<0||a.x>t.width)&&(a.vx*=-1),(a.y<0||a.y>t.height)&&(a.vy*=-1),e.beginPath(),e.arc(a.x,a.y,a.radius,0,2*Math.PI),e.fillStyle=a.color,e.fill()}));for(var r=0;r<a.length;r++)for(var n=r+1;n<a.length;n++){var i=a[r].x-a[n].x,o=a[r].y-a[n].y,h=Math.sqrt(i*i+o*o);h<120&&(e.beginPath(),e.moveTo(a[r].x,a[r].y),e.lineTo(a[n].x,a[n].y),e.strokeStyle="rgba(255, 255, 255, ".concat(1-h/120,")"),e.lineWidth=.5,e.stroke())}}},E=function(t,e){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e-4,r=function(t,e){for(var a=[],r=0;r<e;r++){var n=Math.random()*t.width*.4,i=Math.random()*Math.PI*2;a.push({x:Math.cos(i)*n,y:Math.sin(i)*n,radius:1.5*Math.random()+.5,color:"hsl(".concat(60*Math.random()+200,", 80%, 70%)"),angle:i,distance:n})}return a}(t,2e3),n=0;return function(){e.fillStyle="rgba(10, 10, 30, 0.1)",e.fillRect(0,0,t.width,t.height),e.save(),e.translate(t.width/2,t.height/2),e.rotate(n),function(t,e,a,r){e.forEach((function(e){var a=Math.cos(e.angle)*e.distance,n=Math.sin(e.angle)*e.distance;t.beginPath(),t.arc(a,n,e.radius,0,2*Math.PI),t.fillStyle=e.color,t.fill(),e.angle+=r/(8e-5*e.distance)}))}(e,r,0,a),e.restore(),n+=a}},C=function(t,e){var a=0,r=["#FF0000","#FF7F00","#FFFF00","#00FF00","#0000FF","#4B0082","#8B00FF"];return function(){e.fillStyle="rgba(0, 0, 0, 0.05)",e.fillRect(0,0,t.width,t.height),a+=.02;for(var n=0;n<7;n++){e.beginPath(),e.moveTo(0,t.height/2);for(var i=0;i<t.width;i++){var o=50*Math.sin(.01*i+a+.5*n)+25*Math.cos(.02*i+.7*a+.3*n)+t.height/2;e.lineTo(i,o)}e.strokeStyle=r[n%r.length],e.lineWidth=4,e.stroke()}}},k=function(t,e){var a=0,r=[{pos:0,color:"rgba(0, 255, 128, 0.5)"},{pos:.5,color:"rgba(0, 128, 255, 0.5)"},{pos:1,color:"rgba(128, 0, 255, 0.5)"}];return function(){e.fillStyle="rgba(0, 0, 20, 0.1)",e.fillRect(0,0,t.width,t.height),a+=.005;for(var n=function(){var n=e.createLinearGradient(0,0,t.width,0);r.forEach((function(t){n.addColorStop(t.pos,t.color)})),e.beginPath();for(var o=0;o<t.width;o++){var h=50*Math.sin(.01*o+a+i)+30*Math.sin(.02*o-1.5*a+i)+t.height*(.4+.2*i);e.lineTo(o,h)}e.lineTo(t.width,t.height),e.lineTo(0,t.height),e.closePath(),e.fillStyle=n,e.fill()},i=0;i<3;i++)n()}},T=function(t,e){for(var a=[],r=["#FF00FF","#00FFFF","#FFFF00","#FF00AA"],n=0;n<20;n++)a.push({x:Math.random()*t.width,y:Math.random()*t.height,radius:50*Math.random()+20,color:r[Math.floor(Math.random()*r.length)],phase:Math.random()*Math.PI*2});return function(){e.fillStyle="rgba(0, 0, 0, 0.1)",e.fillRect(0,0,t.width,t.height),a.forEach((function(t){var a=20*Math.sin(t.phase)+30,r=e.createRadialGradient(t.x,t.y,0,t.x,t.y,t.radius);r.addColorStop(0,t.color),r.addColorStop(1,"rgba(0, 0, 0, 0)"),e.beginPath(),e.arc(t.x,t.y,t.radius+a,0,2*Math.PI),e.fillStyle=r,e.fill(),t.phase+=.05}))}},z=function(t,e){for(var a=[],r=0;r<300;r++)a.push({x:Math.random()*t.width,y:Math.random()*t.height,size:2*Math.random()+.5,speedX:.5*(Math.random()-.5),speedY:.5*(Math.random()-.5),color:"hsl(".concat(60*Math.random()+180,", 100%, 70%)")});return function(){e.fillStyle="rgba(0, 0, 20, 0.05)",e.fillRect(0,0,t.width,t.height),a.forEach((function(a){e.beginPath(),e.arc(a.x,a.y,a.size,0,2*Math.PI),e.fillStyle=a.color,e.fill(),a.x+=a.speedX,a.y+=a.speedY,(a.x<0||a.x>t.width)&&(a.speedX*=-1),(a.y<0||a.y>t.height)&&(a.speedY*=-1)}))}},I=function(t,e){var a=[];return function(){e.fillStyle="rgba(0, 0, 20, 0.2)",e.fillRect(0,0,t.width,t.height),Math.random()<.1&&a.push(function(){for(var e=Math.random()*t.width,a=0,r=[{x:e,y:a}];a<t.height;)e+=50*(Math.random()-.5),a+=20*Math.random()+10,r.push({x:e,y:a});return{points:r,life:5+5*Math.random(),width:3*Math.random()+1}}()),a.forEach((function(t,r){e.beginPath(),e.moveTo(t.points[0].x,t.points[0].y);for(var n=1;n<t.points.length;n++)e.lineTo(t.points[n].x,t.points[n].y);e.strokeStyle="rgba(180, 220, 255, ".concat(t.life/10,")"),e.lineWidth=t.width,e.stroke(),t.life-=.2,t.life<=0&&a.splice(r,1)}))}},R=function(t,e){for(var a=[],r=0;r<100;r++)a.push({x:Math.random()*t.width,y:Math.random()*t.height,size:4*Math.random()+1,speedX:2*(Math.random()-.5),speedY:2*(Math.random()-.5),hue:360*Math.random()});return function(){e.fillStyle="rgba(0, 0, 0, 0.05)",e.fillRect(0,0,t.width,t.height),a.forEach((function(r){r.x+=r.speedX,r.y+=r.speedY,(r.x<0||r.x>t.width)&&(r.speedX*=-1),(r.y<0||r.y>t.height)&&(r.speedY*=-1),e.beginPath(),e.arc(r.x,r.y,r.size,0,2*Math.PI),e.fillStyle="hsla(".concat(r.hue,", 100%, 50%, 0.8)"),e.fill(),a.forEach((function(t){var a=r.x-t.x,n=r.y-t.y,i=Math.sqrt(a*a+n*n);i<100&&(e.beginPath(),e.moveTo(r.x,r.y),e.lineTo(t.x,t.y),e.strokeStyle="hsla(".concat((r.hue+t.hue)/2,", 100%, 50%, ").concat(1-i/100,")"),e.stroke())})),r.hue=(r.hue+.5)%360}))}},F=function(t,e){for(var a=[],r=0;r<50;r++)a.push({x:Math.random()*t.width,y:Math.random()*t.height,size:30*Math.random()+10,type:Math.floor(3*Math.random()),rotation:Math.random()*Math.PI*2,speed:.5*Math.random()+.1,color:"hsl(".concat(360*Math.random(),", 70%, 50%)")});return function(){e.clearRect(0,0,t.width,t.height),a.forEach((function(a){switch(e.save(),e.translate(a.x,a.y),e.rotate(a.rotation),e.fillStyle=a.color,a.type){case 0:e.fillRect(-a.size/2,-a.size/2,a.size,a.size);break;case 1:e.beginPath(),e.arc(0,0,a.size/2,0,2*Math.PI),e.fill();break;case 2:e.beginPath(),e.moveTo(0,-a.size/2),e.lineTo(a.size/2,a.size/2),e.lineTo(-a.size/2,a.size/2),e.closePath(),e.fill()}e.restore(),a.rotation+=.05*a.speed,a.y+=a.speed,a.y>t.height+a.size&&(a.y=-a.size,a.x=Math.random()*t.width)}))}},A=function(t,e){for(var a=[],r=0;r<100;r++)a.push({x:Math.random()*t.width,y:Math.random()*t.height,size:3*Math.random()+1,speed:.5*Math.random()+.1,brightness:Math.random(),angle:Math.random()*Math.PI*2});return function(){e.fillStyle="rgba(0, 0, 0, 0.1)",e.fillRect(0,0,t.width,t.height),a.forEach((function(a){a.brightness+=.1*Math.random()-.05,a.brightness=Math.max(0,Math.min(1,a.brightness)),e.beginPath(),e.arc(a.x,a.y,a.size,0,2*Math.PI),e.fillStyle="rgba(255, 255, 100, ".concat(a.brightness,")"),e.fill(),a.x+=Math.cos(a.angle)*a.speed,a.y+=Math.sin(a.angle)*a.speed,(a.x<0||a.x>t.width||a.y<0||a.y>t.height)&&(a.angle+=Math.PI),Math.random()<.01&&(a.angle=Math.random()*Math.PI*2)}))}},O=function(t,e){for(var a=Math.floor(t.width/20),r=[],n=0;n<a;n++)r[n]=Math.random()*t.height;var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@#$%^&*()_+[]{}|;:,.<>?";return function(){e.fillStyle="rgba(0, 0, 0, 0.05)",e.fillRect(0,0,t.width,t.height),e.fillStyle="#0F0",e.font="15px monospace";for(var a=0;a<r.length;a++){var n=i[Math.floor(85*Math.random())];e.fillText(n,20*a,20*r[a]),20*r[a]>t.height&&Math.random()>.975&&(r[a]=0),r[a]+=.6}}},L=function(t,e){var a=0;return function(){e.fillStyle="rgba(0, 0, 0, 0.1)",e.fillRect(0,0,t.width,t.height),e.save(),e.translate(t.width/2,t.height/2);for(var r=0;r<2;r++){e.beginPath();for(var n=-t.width/2;n<t.width/2;n+=10){var i=100+50*Math.sin(.01*n+a+r*Math.PI);e.lineTo(n,i)}e.strokeStyle=0===r?"rgba(255, 0, 0, 0.5)":"rgba(0, 0, 255, 0.5)",e.lineWidth=2,e.stroke();for(var o=-t.width/2;o<t.width/2;o+=40){var h=100+50*Math.sin(.01*o+a+r*Math.PI);e.fillStyle=0===r?"rgba(255, 255, 0, 0.8)":"rgba(0, 255, 0, 0.8)",e.beginPath(),e.arc(o,h,5,0,2*Math.PI),e.fill()}}e.restore(),a+=.02}},j=function(t,e){var a=[],r=[],n=e.createLinearGradient(0,0,t.width,t.height);n.addColorStop(0,"#000000"),n.addColorStop(1,"#1a1a2e");for(var i=0;i<30;i++)a.push({x:Math.random()*t.width,y:Math.random()*t.height,vx:.3*(Math.random()-.5),vy:.3*(Math.random()-.5),size:2*Math.random()+2});for(var o=0;o<a.length;o++)for(var h=o+1;h<a.length;h++)Math.random()<.2&&r.push([o,h]);return function(){e.fillStyle=n,e.fillRect(0,0,t.width,t.height),a.forEach((function(a,r){a.x+=a.vx,a.y+=a.vy,(a.x<0||a.x>t.width)&&(a.vx*=-1),(a.y<0||a.y>t.height)&&(a.vy*=-1),e.beginPath(),e.arc(a.x,a.y,a.size,0,2*Math.PI),e.fillStyle="hsl(".concat(12*r,", 100%, 50%)"),e.fill(),e.beginPath(),e.arc(a.x,a.y,a.size+3,0,2*Math.PI);var n=e.createRadialGradient(a.x,a.y,a.size,a.x,a.y,a.size+3);n.addColorStop(0,"hsla(".concat(12*r,", 100%, 50%, 0.8)")),n.addColorStop(1,"hsla(".concat(12*r,", 100%, 50%, 0)")),e.fillStyle=n,e.fill()})),r.forEach((function(r){var n=p(r,2),i=n[0],o=n[1],h=a[i].x-a[o].x,l=a[i].y-a[o].y,c=1-Math.sqrt(h*h+l*l)/Math.max(t.width,t.height);e.beginPath(),e.moveTo(a[i].x,a[i].y),e.lineTo(a[o].x,a[o].y),e.strokeStyle="rgba(255, 255, 255, ".concat(.2*c,")"),e.stroke()}));for(var i=0;i<5;i++)e.beginPath(),e.arc(Math.random()*t.width,Math.random()*t.height,1.5*Math.random(),0,2*Math.PI),e.fillStyle="rgba(255, 255, 255, 0.5)",e.fill()}},W=function(t,e){var a=0,r=e.createLinearGradient(0,0,0,.6*t.height);r.addColorStop(0,"#87CEEB"),r.addColorStop(1,"#E0F6FF");var n={x:.8*t.width,y:.2*t.height,radius:40,glow:20},i=[{x:.1*t.width,y:.15*t.height,radius:30},{x:.3*t.width,y:.1*t.height,radius:40},{x:.6*t.width,y:.2*t.height,radius:35}];return function(){e.fillStyle=r,e.fillRect(0,0,t.width,.6*t.height),e.save(),e.beginPath(),e.arc(n.x,n.y,n.radius,0,2*Math.PI);var o=e.createRadialGradient(n.x,n.y,n.radius-n.glow,n.x,n.y,n.radius+n.glow);o.addColorStop(0,"rgba(255, 255, 0, 1)"),o.addColorStop(.8,"rgba(255, 255, 0, 0.3)"),o.addColorStop(1,"rgba(255, 255, 0, 0)"),e.fillStyle=o,e.fill(),e.restore(),i.forEach((function(t){e.beginPath(),e.arc(t.x,t.y,t.radius,0,2*Math.PI),e.fillStyle="rgba(255, 255, 255, 0.8)",e.fill()}));for(var h=0;h<7;h++){e.beginPath(),e.moveTo(0,t.height);for(var l=0;l<=t.width;l+=5){var c=30*Math.sin(.02*l+a+.5*h)*(1+.1*h)+(t.height-(h+1)*(.4*t.height/7));e.lineTo(l,c)}e.lineTo(t.width,t.height);var d=e.createLinearGradient(0,0,0,t.height);d.addColorStop(0,"rgba(0, 100, 255, ".concat(.1+h/7*.15,")")),d.addColorStop(1,"rgba(0, 50, 200, ".concat(.1+h/7*.15,")")),e.fillStyle=d,e.fill()}a+=.03}},B=function(t,e){var a=[],r=e.createLinearGradient(0,0,0,t.height);r.addColorStop(0,"#0c1445"),r.addColorStop(1,"#1c2754");for(var n={x:.8*t.width,y:.2*t.height,radius:50,glow:20},i=[{points:[[0,t.height],[.3*t.width,.7*t.height],[.5*t.width,t.height]],color:"#0a1128"},{points:[[.4*t.width,t.height],[.7*t.width,.75*t.height],[t.width,t.height]],color:"#0d1636"}],o=0;o<200;o++)a.push({x:Math.random()*t.width,y:Math.random()*t.height,vx:1.5*(Math.random()-.5),vy:1*Math.random()+.5,size:3*Math.random()+1,opacity:.5*Math.random()+.5});return function(){e.fillStyle=r,e.fillRect(0,0,t.width,t.height),e.save(),e.beginPath(),e.arc(n.x,n.y,n.radius,0,2*Math.PI);var o=e.createRadialGradient(n.x,n.y,n.radius-n.glow,n.x,n.y,n.radius+n.glow);o.addColorStop(0,"rgba(255, 255, 230, 1)"),o.addColorStop(.5,"rgba(255, 255, 230, 0.3)"),o.addColorStop(1,"rgba(255, 255, 230, 0)"),e.fillStyle=o,e.fill(),e.restore(),i.forEach((function(t){e.beginPath(),e.moveTo(t.points[0][0],t.points[0][1]),t.points.forEach((function(t){return e.lineTo(t[0],t[1])})),e.fillStyle=t.color,e.fill()})),a.forEach((function(a){a.x+=a.vx+.3*Math.sin(.01*a.y),a.y+=a.vy,a.y>t.height&&(a.x=Math.random()*t.width,a.y=-a.size,a.vx=1.5*(Math.random()-.5),a.vy=1*Math.random()+.5),e.beginPath(),e.arc(a.x,a.y,a.size,0,2*Math.PI),e.fillStyle="rgba(255, 255, 255, ".concat(a.opacity,")"),e.fill()})),e.fillStyle="rgba(255, 255, 255, 0.03)",e.fillRect(0,0,t.width,t.height)}},G=function(t,e){for(var a=[],r=[],n=0;n<5;n++)r.push({x:Math.random()*t.width,y:t.height,height:200*Math.random()+300,width:100*Math.random()+50});for(var i=0;i<100;i++)a.push({x:Math.random()*t.width,y:Math.random()*t.height,radius:2*Math.random()+1,speed:.5*Math.random()+.1,angle:Math.random()*Math.PI*2,angleSpeed:.01*(Math.random()-.5),glowIntensity:Math.random()});return function(){e.fillStyle="rgba(0, 0, 20, 0.1)",e.fillRect(0,0,t.width,t.height),r.forEach((function(t){e.beginPath(),e.moveTo(t.x,t.y),e.lineTo(t.x-t.width/2,t.y-t.height),e.lineTo(t.x+t.width/2,t.y-t.height),e.closePath(),e.fillStyle="rgba(0, 50, 0, 0.8)",e.fill()})),a.forEach((function(a){a.x+=Math.cos(a.angle)*a.speed,a.y+=Math.sin(a.angle)*a.speed,a.angle+=a.angleSpeed,(a.x<0||a.x>t.width)&&(a.angle=Math.PI-a.angle),(a.y<0||a.y>t.height)&&(a.angle=-a.angle),a.glowIntensity=.5*Math.sin(.002*Date.now()+.1*a.x)+.5,e.beginPath(),e.arc(a.x,a.y,a.radius,0,2*Math.PI),e.fillStyle="rgba(255, 255, 100, ".concat(a.glowIntensity,")"),e.fill(),e.beginPath(),e.arc(a.x,a.y,3*a.radius,0,2*Math.PI);var r=e.createRadialGradient(a.x,a.y,0,a.x,a.y,3*a.radius);r.addColorStop(0,"rgba(255, 255, 100, ".concat(.5*a.glowIntensity,")")),r.addColorStop(1,"rgba(255, 255, 100, 0)"),e.fillStyle=r,e.fill()}))}},Y=function(t,e){var a,r=[];function n(t,e){for(var a=Math.floor(50*Math.random())+50,r=[],n=0;n<a;n++)r.push({x:t+200*Math.random()-100,y:e+100*Math.random()-50,radius:30*Math.random()+10});return{particles:r,x:t,y:e,speed:.5*Math.random()+.1}}for(var i=0;i<10;i++)r.push(n(Math.random()*t.width,Math.random()*(t.height/2)));var o=function(){a=t.height;var r=e.createLinearGradient(0,0,0,a);return r.addColorStop(0,"#1e90ff"),r.addColorStop(.5,"#87ceeb"),r.addColorStop(1,"#e6f3ff"),r},h=o();return function(){a!==t.height&&(h=o()),e.fillStyle=h,e.fillRect(0,0,t.width,t.height),r.forEach((function(a){a.x+=a.speed,a.x>t.width+200&&(a.x=-200),e.save(),e.translate(a.x,a.y),a.particles.forEach((function(t){e.beginPath(),e.arc(t.x+5,t.y+5,t.radius,0,2*Math.PI),e.fillStyle="rgba(0, 0, 0, 0.1)",e.fill()})),a.particles.forEach((function(t){e.beginPath(),e.arc(t.x,t.y,t.radius,0,2*Math.PI);var a=e.createRadialGradient(t.x,t.y,0,t.x,t.y,t.radius);a.addColorStop(0,"rgba(255, 255, 255, 0.8)"),a.addColorStop(1,"rgba(255, 255, 255, 0.2)"),e.fillStyle=a,e.fill()})),e.restore()}));e.beginPath(),e.arc(t.width-100,100,40,0,2*Math.PI);var n=e.createRadialGradient(t.width-100,100,0,t.width-100,100,60);n.addColorStop(0,"rgba(255, 255, 200, 1)"),n.addColorStop(.8,"rgba(255, 255, 0, 0.3)"),n.addColorStop(1,"rgba(255, 255, 0, 0)"),e.fillStyle=n,e.fill()}},X=function(t,e){var a,r=[],n=["#ff6b6b","#feca57","#ff9ff3","#ff9f43","#e17055"],i=["1.jpg","2.jpg"],o=[],h=!1;a=0,i.forEach((function(t,e){var r=new Image;r.onload=function(){o[e]=r,++a===i.length&&(h=!0)},r.onerror=function(){++a===i.length&&(h=!0)},r.src=t}));for(var l=0;l<100;l++)r.push({x:Math.random()*t.width,y:Math.random()*t.height,size:20*Math.random()+10,speed:2*Math.random()+1,amplitude:20*Math.random()+10,angle:Math.random()*Math.PI*2,angleSpeed:.05*(Math.random()-.5),imageIndex:Math.floor(Math.random()*i.length),color:n[Math.floor(Math.random()*n.length)]});return function(){e.fillStyle="rgba(135, 206, 235, 0.1)",e.fillRect(0,0,t.width,t.height),r.forEach((function(a){a.y+=a.speed,a.x+=Math.sin(.01*a.y)*a.amplitude*.05,a.angle+=a.angleSpeed,a.y>t.height&&(a.y=-a.size,a.x=Math.random()*t.width),function(t){e.save(),e.translate(t.x,t.y),e.rotate(t.angle),h&&o[t.imageIndex]?e.drawImage(o[t.imageIndex],-t.size/2,-t.size/2,t.size,t.size):(e.beginPath(),e.ellipse(0,0,t.size/2,t.size/4,0,0,2*Math.PI),e.fillStyle=t.color,e.fill()),e.restore()}(a)}))}},D=function(t,e){for(var a=[],r=[],n=0;n<1e3;n++)a.push({x:Math.random()*t.width,y:Math.random()*t.height,length:20*Math.random()+10,speed:10*Math.random()+15});return function(){e.fillStyle="rgba(0, 0, 0, 0.1)",e.fillRect(0,0,t.width,t.height),e.strokeStyle="rgba(174, 194, 224, 0.5)",e.lineWidth=1,a.forEach((function(a){e.beginPath(),e.moveTo(a.x,a.y),e.lineTo(a.x,a.y+a.length),e.stroke(),a.y+=a.speed,a.y>t.height&&(a.y=-a.length,r.push({x:a.x,y:t.height,radius:3*Math.random()+1,opacity:1}))})),r.forEach((function(t,a){e.beginPath(),e.arc(t.x,t.y,t.radius,0,2*Math.PI),e.fillStyle="rgba(174, 194, 224, ".concat(t.opacity,")"),e.fill(),t.radius+=.1,t.opacity-=.03,t.opacity<=0&&r.splice(a,1)}))}},N=function(t,e){for(var a=[],r=["🍔","🍕","🌭","🍟","🌮","🍣","🍩","🍦","🍎","🍇","🍓","🍑","🍍","🥑","🥕","🥪","🥨","🧀","🥐","🥯","🍱","🍜","🍙","🍗","🥟","🥘","🍤","🥞","🧇","🥓"],n=[{r:255,g:102,b:102},{r:255,g:178,b:102},{r:255,g:255,b:153},{r:153,g:255,b:153},{r:153,g:204,b:255},{r:178,g:102,b:255},{r:255,g:153,b:255}],i=0,o=1,h=0,l=0;l<50;l++)a.push({x:Math.random()*t.width,y:Math.random()*t.height-t.height,emoji:r[Math.floor(Math.random()*r.length)],size:20*Math.random()+30,speed:1.5*Math.random()+.5,rotation:Math.random()*Math.PI*2,rotationSpeed:.02*(2*Math.random()-1)});return function(){(h+=.005)>=1&&(h=0,i=o,o=(o+1)%n.length);var r,l,c,d=(r=n[i],l=n[o],c=h,{r:Math.round(r.r+(l.r-r.r)*c),g:Math.round(r.g+(l.g-r.g)*c),b:Math.round(r.b+(l.b-r.b)*c)}),f=e.createLinearGradient(0,0,t.width,t.height);f.addColorStop(0,"rgb(".concat(d.r,", ").concat(d.g,", ").concat(d.b,")")),f.addColorStop(1,"rgb(".concat(255-d.r,", ").concat(255-d.g,", ").concat(255-d.b,")")),e.filter="blur(5px)",e.fillStyle=f,e.fillRect(0,0,t.width,t.height),e.filter="none",a.forEach((function(a){e.save(),e.translate(a.x,a.y),e.rotate(a.rotation),e.font="".concat(a.size,"px Arial"),e.textAlign="center",e.textBaseline="middle",e.strokeStyle="white",e.lineWidth=3,e.strokeText(a.emoji,0,0),e.fillStyle="black",e.fillText(a.emoji,0,0),e.restore(),a.y+=a.speed,a.rotation+=a.rotationSpeed,a.y>t.height+a.size&&(a.y=-a.size,a.x=Math.random()*t.width)}))}},q=function(t,e){for(var a=[],r=[],n=[],i=0;i<20;i++)a.push({x:Math.random()*t.width,height:200*Math.random()+100,width:20*Math.random()+10});for(var o=0;o<50;o++)r.push({x:Math.random()*t.width,y:Math.random()*t.height,radius:2*Math.random()+1,speed:.5*Math.random()+.1,opacity:Math.random()});for(var h=0;h<100;h++)n.push({x:Math.random()*t.width,y:Math.random()*t.height,radius:50*Math.random()+20,speed:.2*Math.random()+.1});return function(){e.fillStyle="#0a0a0a",e.fillRect(0,0,t.width,t.height),e.fillStyle="#1a1a1a",a.forEach((function(a){e.beginPath(),e.moveTo(a.x,t.height),e.lineTo(a.x-a.width/2,t.height-a.height),e.lineTo(a.x+a.width/2,t.height-a.height),e.closePath(),e.fill()})),e.fillStyle="rgba(200, 200, 200, 0.05)",n.forEach((function(a){e.beginPath(),e.arc(a.x,a.y,a.radius,0,2*Math.PI),e.fill(),a.x+=a.speed,a.x>t.width+a.radius&&(a.x=-a.radius)})),r.forEach((function(a){e.beginPath(),e.arc(a.x,a.y,a.radius,0,2*Math.PI),e.fillStyle="rgba(255, 255, 100, ".concat(a.opacity,")"),e.fill(),a.x+=Math.sin(.001*Date.now())*a.speed,a.y+=Math.cos(.001*Date.now())*a.speed,a.opacity=.5*Math.sin(.01*Date.now())+.5,a.x<0&&(a.x=t.width),a.x>t.width&&(a.x=0),a.y<0&&(a.y=t.height),a.y>t.height&&(a.y=0)}))}},H=function(t,e){for(var a=[],r=0;r<5;r++)a.push({x:Math.random()*t.width,y:Math.random()*t.height,size:50*Math.random()+30,speed:.5*Math.random()+.1,opacity:.5*Math.random()});return function(){e.fillStyle="#000033",e.fillRect(0,0,t.width,t.height),a.forEach((function(a){e.beginPath(),e.moveTo(a.x,a.y),e.bezierCurveTo(a.x-a.size/2,a.y-a.size/2,a.x-a.size/2,a.y+a.size/2,a.x,a.y+a.size),e.bezierCurveTo(a.x+a.size/2,a.y+a.size/2,a.x+a.size/2,a.y-a.size/2,a.x,a.y);var r=e.createRadialGradient(a.x,a.y,0,a.x,a.y,a.size);r.addColorStop(0,"rgba(255, 255, 255, ".concat(a.opacity,")")),r.addColorStop(1,"rgba(255, 255, 255, 0)"),e.fillStyle=r,e.fill(),a.y-=a.speed,a.opacity=.2*Math.sin(.001*Date.now())+.3,a.y+a.size<0&&(a.y=t.height+a.size,a.x=Math.random()*t.width)}))}},U=function(t,e){for(var a=[],r=0;r<20;r++)a.push({x:Math.random()*t.width,y:Math.random()*t.height,size:100*Math.random()+50,rotation:Math.random()*Math.PI*2});return function(){e.clearRect(0,0,t.width,t.height),a.forEach((function(t){!function(t,a,r,n){e.save(),e.translate(t,a),e.rotate(n),e.beginPath();for(var i=0;i<8;i++){var o=2*Math.PI/8*i;e.moveTo(0,0),e.lineTo(Math.cos(o)*r,Math.sin(o)*r)}for(var h=r/4;h<r;h+=r/4){e.moveTo(h,0);for(var l=1;l<8;l++){var c=2*Math.PI/8*l;e.lineTo(Math.cos(c)*h,Math.sin(c)*h)}e.closePath()}e.strokeStyle="rgba(255, 255, 255, 0.1)",e.stroke(),e.restore()}(t.x,t.y,t.size,t.rotation)}))}},_=function(t,e){for(var a=[],r=[],n=[],i=0;i<15;i++)a.push({x:Math.random()*t.width,y:t.height-100*Math.random()-50,width:30*Math.random()+20,height:40*Math.random()+30});for(var o=0;o<10;o++)r.push({x:Math.random()*t.width,y:t.height,speed:.5*Math.random()+.1,size:30*Math.random()+20});for(var h=0;h<50;h++)n.push({x:Math.random()*t.width,y:Math.random()*t.height,radius:100*Math.random()+50,speed:.2*Math.random()+.1});return function(){var i=e.createLinearGradient(0,0,0,t.height);i.addColorStop(0,"#0a0a1a"),i.addColorStop(1,"#1a0a1a"),e.fillStyle=i,e.fillRect(0,0,t.width,t.height),e.beginPath(),e.arc(.8*t.width,.2*t.height,40,0,2*Math.PI),e.fillStyle="rgba(255, 255, 200, 0.8)",e.fill(),e.fillStyle="#333",a.forEach((function(t){e.fillRect(t.x,t.y,t.width,t.height),e.fillStyle="#222",e.fillRect(t.x+.1*t.width,t.y,.8*t.width,.1*t.height)})),r.forEach((function(a){e.beginPath(),e.arc(a.x,a.y-a.size,.5*a.size,0,2*Math.PI),e.fillStyle="#3a5",e.fill(),e.beginPath(),e.moveTo(a.x,a.y-a.size),e.lineTo(a.x-.5*a.size,a.y),e.lineTo(a.x+.5*a.size,a.y),e.closePath(),e.fillStyle="#3a5",e.fill(),a.y-=a.speed,a.y<.7*t.height&&(a.y=t.height,a.x=Math.random()*t.width)})),e.fillStyle="rgba(255, 255, 255, 0.05)",n.forEach((function(a){e.beginPath(),e.arc(a.x,a.y,a.radius,0,2*Math.PI),e.fill(),a.x+=a.speed,a.x>t.width+a.radius&&(a.x=-a.radius)}))}},J=function(t,e){for(var a=[],r=[],n=0;n<200;n++)a.push({x:Math.random()*t.width,y:Math.random()*t.height,length:20*Math.random()+10,speed:5*Math.random()+5});return function(){e.fillStyle="rgba(20, 0, 0, 0.1)",e.fillRect(0,0,t.width,t.height),e.strokeStyle="#800",e.lineWidth=1,a.forEach((function(a){e.beginPath(),e.moveTo(a.x,a.y),e.lineTo(a.x,a.y+a.length),e.stroke(),a.y+=a.speed,a.y>t.height&&(a.y=0,a.x=Math.random()*t.width,r.push({x:a.x,y:t.height,size:5*Math.random()+2,opacity:1}))})),r.forEach((function(t,a){e.beginPath(),e.arc(t.x,t.y,t.size,0,2*Math.PI),e.fillStyle="rgba(128, 0, 0, ".concat(t.opacity,")"),e.fill(),t.opacity-=.005,t.opacity<=0&&r.splice(a,1)}))}},$=function(t,e){for(var a=[],r=[],n=0;n<50;n++)a.push({x:Math.random()*t.width,y:Math.random()*t.height,size:5*Math.random()+2,speedX:2*Math.random()-1,speedY:2*Math.random()-1});for(var i=0;i<20;i++)r.push({x:Math.random()*t.width,y:Math.random()*t.height});return function(){e.fillStyle="rgba(0, 0, 0, 0.1)",e.fillRect(0,0,t.width,t.height),e.strokeStyle="rgba(255, 255, 255, 0.1)",e.beginPath(),r.forEach((function(t,a){r.slice(a+1).forEach((function(a){e.moveTo(t.x,t.y),e.lineTo(a.x,a.y)}))})),e.stroke(),e.fillStyle="#400",a.forEach((function(a){e.beginPath(),e.arc(a.x,a.y,a.size,0,2*Math.PI),e.fill(),a.x+=a.speedX,a.y+=a.speedY,(a.x<0||a.x>t.width)&&(a.speedX*=-1),(a.y<0||a.y>t.height)&&(a.speedY*=-1),Math.random()<.01&&(a.speedX=2*Math.random()-1,a.speedY=2*Math.random()-1)}))}},K=function(e){function a(){var t;l(this,a);for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return f(t=h(this,a,[].concat(r)),"state",{hasError:!1}),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&y(t,e)}(a,t.Component),d(a,[{key:"render",value:function(){return this.state.hasError?t.createElement("span",null,"Animation failed to load."):this.props.children}}],[{key:"getDerivedStateFromError",value:function(t){return{hasError:!0}}}])}(),Q=function(r){var n=r.text,i=void 0===n?"":n,o=r.effect,h=void 0===o?"typewriter":o,l=r.config,c=void 0===l?{}:l,d=r.styles,f=void 0===d?{}:d,s=m({speed:100,loop:!1,delay:0,color:"currentColor"},c),u={base:{display:"inline-block",fontFamily:"inherit",color:s.color},typewriter:{whiteSpace:"pre",overflow:"hidden",borderRight:"0.15em solid currentColor"},fadeIn:{opacity:0,animation:"fadeIn 2s forwards"},bounce:{display:"inline-block"},glitch:{position:"relative",animation:"glitch 1s linear infinite"},rainbow:{background:"linear-gradient(to right, #6666ff, #0099ff , #00ff00, #ff3399, #6666ff)",backgroundSize:"400%",backgroundClip:"text",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",animation:"rainbow 8s ease infinite"}},g={typewriter:function(r){var n=p(a(""),2),i=n[0],o=n[1],h=p(a(!0),2),l=h[0],c=h[1];return e((function(){if(r){var t=setTimeout((function t(){var e=0;o(""),c(!0);var a=setInterval((function(){try{e<r.length?(o((function(t){return t+r[e]})),e++):(c(!1),s.loop&&setTimeout(t,s.delay),clearInterval(a))}catch(t){console.error("Animation error:",t),clearInterval(a),c(!1)}}),s.speed);return a}),s.delay);return function(){return clearTimeout(t)}}c(!1)}),[r,s.loop,s.speed,s.delay]),t.createElement("span",{style:m(m(m(m({},u.base),u.typewriter),f),{},{borderRight:l?"0.15em solid currentColor":"none"}),"aria-label":r},i)},fadeIn:function(e){return t.createElement("span",{style:m(m(m({},u.base),u.fadeIn),f)},e)},bounce:function(e){return t.createElement("span",{style:m(m({},u.base),f)},e.split("").map((function(e,a){return t.createElement("span",{key:a,style:m(m({},u.bounce),{},{animation:"bounce 0.5s ease infinite",animationDelay:"".concat(.1*a,"s")})},e)})))},glitch:function(e){return t.createElement("span",{style:m(m(m({},u.base),u.glitch),f)},e,t.createElement("span",{className:"glitch-effect","data-text":e}))},rainbow:function(e){return t.createElement("span",{style:m(m(m({},u.base),u.rainbow),f)},e)}};e((function(){var t=document.createElement("style");return t.textContent="\n @keyframes fadeIn {\n to { opacity: 1; }\n }\n @keyframes bounce {\n 0%, 100% { transform: translateY(0); }\n 50% { transform: translateY(-10px); }\n }\n @keyframes glitch {\n 2%, 64% { transform: translate(2px,0) skew(0deg); }\n 4%, 60% { transform: translate(-2px,0) skew(0deg); }\n 62% { transform: translate(0,0) skew(5deg); }\n }\n @keyframes rainbow { \n 0% { background-position: 0% 50%; }\n 50% { background-position: 100% 50%; }\n 100% { background-position: 0% 50%; }\n }\n ",document.head.appendChild(t),function(){return document.head.removeChild(t)}}),[]);var y="string"==typeof i?i:String(i||""),v=g.hasOwnProperty(h)?h:"typewriter";return t.createElement(K,null,g[v](y))},V=function(a){var i=a.layers,o=void 0===i?[]:i,h=a.fps,l=void 0===h?60:h,c=a.style;a.enablePerformanceMonitoring;var d=r(null),f=r(null),s=r([]),u={starryNight:w,floatingBubbles:x,gradientWave:S,particleNetwork:P,galaxySpiral:E,rainbowWaves:C,geometricShapes:F,fireflies:A,matrixRain:O,quantumField:R,electricStorm:I,cosmicDust:z,neonPulse:T,auroraBorealis:k,oceanWaves:W,neuralNetwork:j,dnaHelix:L,snowFall:B,realisticRain:D,realisticClouds:Y,fireflyForest:G,autumnLeaves:X,fallingFoodFiesta:N,hauntedForest:q,ghostlyApparitions:H,spiderwebOverlay:U,undeadGraveyard:_,bloodRain:J,creepyCrawlies:$},g=n((function(){var t=d.current;return t.getContext("2d"),t.width=window.innerWidth,t.height=window.innerHeight,s.current=o.map((function(e,a){var r=u[e.animation];if(!r)return console.warn('Animation "'.concat(e.animation,'" not found in layer ').concat(a)),null;var n=document.createElement("canvas");n.width=t.width,n.height=t.height;var i=n.getContext("2d");return{canvas:n,ctx:i,animation:r(n,i,e.config||{}),opacity:e.opacity||1,blendMode:e.blendMode||"normal",speed:e.speed||1,lastUpdate:0}})).filter(Boolean),s.current}),[o]),y=n((function(t){var e=d.current,a=e.getContext("2d");a.clearRect(0,0,e.width,e.height),s.current.forEach((function(e,r){o[r];var n=1e3/l/e.speed;t-e.lastUpdate>=n&&(e.ctx.clearRect(0,0,e.canvas.width,e.canvas.height),e.animation(),e.lastUpdate=t),a.save(),a.globalAlpha=e.opacity,a.globalCompositeOperation=e.blendMode,a.drawImage(e.canvas,0,0),a.restore()}))}),[o,l]);return e((function(){g();var t;t=0,f.current=requestAnimationFrame((function e(a){f.current=requestAnimationFrame(e),a-t>=16&&(y(a),t=a)}));var e=function(){d.current&&(d.current.width=window.innerWidth,d.current.height=window.innerHeight,g())};return window.addEventListener("resize",e),function(){f.current&&cancelAnimationFrame(f.current),window.removeEventListener("resize",e)}}),[g,y]),t.createElement("canvas",{ref:d,style:m({position:"fixed",top:0,left:0,width:"100%",height:"100%",zIndex:-1},c)})},Z=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.initialSpeed,i=void 0===e?1:e,o=t.autoPlay,h=p(a(void 0===o||o),2),l=h[0],c=h[1],d=p(a(i),2),f=d[0],s=d[1],u=r(null),g=r(0);return{isPlaying:l,speed:f,play:n((function(){c(!0)}),[]),pause:n((function(){c(!1)}),[]),reset:n((function(){c(!1),g.current=0}),[]),setSpeed:n((function(t){var e=Math.max(.1,Math.min(5,t));s(e)}),[]),toggle:n((function(){c((function(t){return!t}))}),[]),animationRef:u,lastTimeRef:g}},tt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.sampleSize,i=void 0===e?60:e,o=t.warningThreshold,h=void 0===o?30:o;t.autoOptimize;var l=p(a(60),2),c=l[0],d=l[1],f=p(a(60),2),s=f[0],u=f[1],g=p(a(0),2),m=g[0],y=g[1],v=p(a([]),2),b=v[0],M=v[1],w=r(0),x=r(performance.now()),S=r([]),P=r(new Set),E=n((function(t){return t>=55?"excellent":t>=40?"good":t>=25?"fair":"poor"}),[]),C=n((function(){var t=performance.now(),e=t-x.current;if(e>=1e3){var a=Math.round(1e3*w.current/e);d(a),S.current.push(a),S.current.length>i&&S.current.shift();var r=S.current.reduce((function(t,e){return t+e}),0)/S.current.length;u(Math.round(r));var n=new Set(P.current);if(a<h?n.add("Low FPS detected: ".concat(a)):n.delete("Low FPS detected: ".concat(a)),e>100&&n.add("Frame rendering lag detected"),performance.memory){var o=Math.round(performance.memory.usedJSHeapSize/1024/1024);y(o),o>100&&n.add("High memory usage: ".concat(o,"MB"))}P.current=n,M(Array.from(n)),w.current=0,x.current=t}}),[i,h]),k=n((function(){w.current++,C()}),[C]),T=n((function(){var t=[];return s<30&&(t.push("Reduce animation complexity"),t.push("Lower FPS target"),t.push("Use simpler blend modes")),m>100&&(t.push("Reduce particle count"),t.push("Optimize canvas size")),t}),[s,m]),z=E(s);return{fps:c,avgFps:s,memoryUsage:m,performanceLevel:z,warnings:b,isOptimal:"excellent"===z||"good"===z,recordFrame:k,getOptimizationSuggestions:T,reset:function(){S.current=[],M([]),P.current.clear()}}},et=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=e.effect,r=void 0===a?"attract":a,n=e.strength,i=void 0===n?.5:n,o=e.radius,h=void 0===o?100:o,l=e.continuous,c=void 0!==l&&l,d=!1,f=[],s=new Map,u=function(e){var a=t.getBoundingClientRect(),r=t.width/a.width,n=t.height/a.height;if(e.type.startsWith("touch")){var i=e.touches[0]||e.changedTouches[0];return{x:(i.clientX-a.left)*r,y:(i.clientY-a.top)*n,force:i.force||.5,type:"touch"}}return{x:(e.clientX-a.left)*r,y:(e.clientY-a.top)*n,force:.5,type:"mouse"}},g=function(t){d=!0;var e=u(t);e&&(f=[e])},m=function(t){if(d||c){var e=u(t);e&&(f=[e])}},y=function(){d=!1,c||(f=[])},p=function(e){e.preventDefault(),Array.from(e.touches).forEach((function(e,a){var r={x:(e.clientX-t.getBoundingClientRect().left)*(t.width/t.getBoundingClientRect().width),y:(e.clientY-t.getBoundingClientRect().top)*(t.height/t.getBoundingClientRect().height),force:e.force||.5,type:"touch"};s.set(e.identifier,r)})),f=Array.from(s.values())},v=function(e){e.preventDefault(),Array.from(e.touches).forEach((function(e){var a={x:(e.clientX-t.getBoundingClientRect().left)*(t.width/t.getBoundingClientRect().width),y:(e.clientY-t.getBoundingClientRect().top)*(t.height/t.getBoundingClientRect().height),force:e.force||.5,type:"touch"};s.set(e.identifier,a)})),f=Array.from(s.values())},b=function(t){t.preventDefault(),Array.from(t.changedTouches).forEach((function(t){s.delete(t.identifier)})),f=Array.from(s.values())};return{attachListeners:function(){t.addEventListener("mousedown",g),t.addEventListener("mousemove",m),t.addEventListener("mouseup",y),t.addEventListener("mouseleave",y),t.addEventListener("touchstart",p,{passive:!1}),t.addEventListener("touchmove",v,{passive:!1}),t.addEventListener("touchend",b,{passive:!1}),t.addEventListener("touchcancel",b,{passive:!1})},removeListeners:function(){t.removeEventListener("mousedown",g),t.removeEventListener("mousemove",m),t.removeEventListener("mouseup",y),t.removeEventListener("mouseleave",y),t.removeEventListener("touchstart",p),t.removeEventListener("touchmove",v),t.removeEventListener("touchend",b),t.removeEventListener("touchcancel",b)},calculateInteractionForce:function(t,e){var a=e.x-t.x,n=e.y-t.y,o=Math.sqrt(a*a+n*n);if(0===o||o>h)return{fx:0,fy:0,distance:o};var l=(1-o/h)*i*e.force;switch(r){case"attract":l*=1;break;case"repel":l*=-1;break;case"gravity":l*=1/(o*o+1);break;case"burst":l*=o<.3*h?-2:0;break;default:l=0}return{fx:a/o*l,fy:n/o*l,distance:o}},getInteractionPoints:function(){return f},isInteracting:function(){return d},updateConfig:function(t){Object.assign(e,t)}}},at={detectPinch:function(t){if(2!==t.touches.length)return null;var e=t.touches[0],a=t.touches[1];return{distance:Math.sqrt(Math.pow(a.clientX-e.clientX,2)+Math.pow(a.clientY-e.clientY,2)),centerX:(e.clientX+a.clientX)/2,centerY:(e.clientY+a.clientY)/2,rotation:Math.atan2(a.clientY-e.clientY,a.clientX-e.clientX)}},detectSwipe:function(t,e){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:50,r=e.x-t.x,n=e.y-t.y,i=Math.sqrt(r*r+n*n);if(i<a)return null;var o=Math.atan2(n,r)*(180/Math.PI);return{direction:o>=-45&&o<45?"right":o>=45&&o<135?"down":o>=135||o<-135?"left":"up",distance:i,deltaX:r,deltaY:n,velocity:i/(e.time-t.time)}}},rt={cyberpunk:{name:"Cyberpunk",colors:["#ff0080","#00ffff","#ff8000","#8000ff","#ff0040"],gradients:{primary:["#ff0080","#8000ff"],secondary:["#00ffff","#ff8000"],accent:["#ff0040","#ff0080"]},effects:{glow:"#00ffff",highlight:"#ff0080",shadow:"#000040"}},nature:{name:"Nature",colors:["#4a7c59","#a7d0cd","#f2e7d5","#6d9773","#99c7a1"],gradients:{primary:["#4a7c59","#99c7a1"],secondary:["#a7d0cd","#f2e7d5"],accent:["#6d9773","#a7d0cd"]},effects:{glow:"#a7d0cd",highlight:"#f2e7d5",shadow:"#2d4832"}},ocean:{name:"Ocean",colors:["#003d5c","#0074b7","#0099cc","#00bfff","#87ceeb"],gradients:{primary:["#003d5c","#0099cc"],secondary:["#0074b7","#87ceeb"],accent:["#00bfff","#87ceeb"]},effects:{glow:"#00bfff",highlight:"#87ceeb",shadow:"#001f2e"}},sunset:{name:"Sunset",colors:["#ff6b35","#f7931e","#ffd23f","#ee4266","#540d6e"],gradients:{primary:["#ff6b35","#ffd23f"],secondary:["#f7931e","#ee4266"],accent:["#ee4266","#540d6e"]},effects:{glow:"#ffd23f",highlight:"#ff6b35",shadow:"#2a0637"}},monochrome:{name:"Monochrome",colors:["#000000","#333333","#666666","#999999","#ffffff"],gradients:{primary:["#000000","#666666"],secondary:["#333333","#999999"],accent:["#666666","#ffffff"]},effects:{glow:"#ffffff",highlight:"#cccccc",shadow:"#000000"}},neon:{name:"Neon",colors:["#ff073a","#39ff14","#ffff00","#ff1493","#00ffff"],gradients:{primary:["#ff073a","#39ff14"],secondary:["#ffff00","#ff1493"],accent:["#ff1493","#00ffff"]},effects:{glow:"#39ff14",highlight:"#ffff00",shadow:"#0a0a0a"}},space:{name:"Space",colors:["#0b0c2a","#1b263b","#415a77","#778da9","#e0e1dd"],gradients:{primary:["#0b0c2a","#415a77"],secondary:["#1b263b","#778da9"],accent:["#415a77","#e0e1dd"]},effects:{glow:"#778da9",highlight:"#e0e1dd",shadow:"#050511"}},retro:{name:"Retro",colors:["#ff6b9d","#c44569","#f8b500","#40e0d0","#ee82ee"],gradients:{primary:["#ff6b9d","#f8b500"],secondary:["#c44569","#40e0d0"],accent:["#40e0d0","#ee82ee"]},effects:{glow:"#f8b500",highlight:"#ff6b9d",shadow:"#2d1b3d"}}},nt={gaming:{name:"Gaming",colorScheme:rt.cyberpunk,animationSettings:{intensity:"high",speed:1.2,particleCount:150,glowEffect:!0},recommendedAnimations:["matrixRain","electricStorm","neonPulse","particleNetwork"]},portfolio:{name:"Portfolio",colorScheme:rt.monochrome,animationSettings:{intensity:"medium",speed:.8,particleCount:80,glowEffect:!1},recommendedAnimations:["geometricShapes","floatingBubbles","gradientWave"]},landing:{name:"Landing Page",colorScheme:rt.sunset,animationSettings:{intensity:"medium",speed:1,particleCount:100,glowEffect:!0},recommendedAnimations:["galaxySpiral","rainbowWaves","auroraBorealis"]},presentation:{name:"Presentation",colorScheme:rt.space,animationSettings:{intensity:"low",speed:.6,particleCount:50,glowEffect:!1},recommendedAnimations:["starryNight","cosmicDust","quantumField"]},wellness:{name:"Wellness",colorScheme:rt.nature,animationSettings:{intensity:"low",speed:.7,particleCount:60,glowEffect:!1},recommendedAnimations:["oceanWaves","autumnLeaves","fireflyForest"]},party:{name:"Party",colorScheme:rt.neon,animationSettings:{intensity:"high",speed:1.5,particleCount:200,glowEffect:!0},recommendedAnimations:["rainbowWaves","neonPulse","electricStorm"]}},it=function(){return d((function t(){l(this,t),this.currentTheme=null,this.customThemes=new Map}),[{key:"applyTheme",value:function(t){var e=nt[t]||this.customThemes.get(t);return e?(this.currentTheme=e,e):(console.warn('Theme "'.concat(t,'" not found. Using default.')),nt.portfolio)}},{key:"getRandomColor",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"colors";if(!this.currentTheme)return"#ffffff";var e,a=this.currentTheme.colorScheme;switch(t){case"primary":e=a.gradients.primary;break;case"secondary":e=a.gradients.secondary;break;case"accent":e=a.gradients.accent;break;default:e=a.colors}return e[Math.floor(Math.random()*e.length)]}},{key:"createGradient",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"primary",a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{x1:0,y1:0,x2:0,y2:100};if(!this.currentTheme)return null;var r=this.currentTheme.colorScheme.gradients[e],n=t.createLinearGradient(a.x1,a.y1,a.x2,a.y2);return r.forEach((function(t,e){n.addColorStop(e/(r.length-1),t)})),n}},{key:"createCustomTheme",value:function(t,e){this.customThemes.set(t,e)}},{key:"getEffectColor",value:function(t){return this.currentTheme&&this.currentTheme.colorScheme.effects[t]||"#ffffff"}},{key:"getAnimationSettings",value:function(t){if(!this.currentTheme)return{};var e=this.currentTheme.animationSettings,a=m({},e);switch(t){case"particleNetwork":case"matrixRain":a.particleCount=Math.floor(1.2*e.particleCount);break;case"starryNight":case"cosmicDust":a.particleCount=Math.floor(.8*e.particleCount);break;case"electricStorm":case"neonPulse":a.glowEffect=!0,a.intensity="high"}return a}},{key:"getAvailableThemes",value:function(){return[].concat(v(Object.keys(nt)),v(Array.from(this.customThemes.keys())))}},{key:"getRecommendedAnimations",value:function(){return this.currentTheme&&this.currentTheme.recommendedAnimations||[]}}])}(),ot=new it,ht=t.memo((function(a){var o=a.animationName,h=a.fallbackAnimation,l=void 0===h?"geometricShapes":h,c=a.fps,d=void 0===c?60:c,f=a.blendMode,s=void 0===f?"normal":f,u=a.style,g=a.interactive,y=void 0!==g&&g,p=a.interactionConfig,v=void 0===p?{}:p,b=a.theme;a.preset;var M=a.animationControls,K=a.enablePerformanceMonitoring,Q=void 0!==K&&K,V=a.adaptivePerformance,Z=void 0!==V&&V,at=r(null),rt=r(null),nt=r(null),it=Q?tt():null;e((function(){b&&ot.applyTheme(b)}),[b]);var ht=["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],lt=i((function(){return{starryNight:w,floatingBubbles:x,gradientWave:S,particleNetwork:P,galaxySpiral:E,rainbowWaves:C,geometricShapes:F,fireflies:A,matrixRain:O,quantumField:R,electricStorm:I,cosmicDust:z,neonPulse:T,auroraBorealis:k,oceanWaves:W,neuralNetwork:j,dnaHelix:L,snowFall:B,realisticRain:D,realisticClouds:Y,fireflyForest:G,autumnLeaves:X,fallingFoodFiesta:N,hauntedForest:q,ghostlyApparitions:H,spiderwebOverlay:U,undeadGraveyard:_,bloodRain:J,creepyCrawlies:$}}),[]),ct=n((function(){var t=at.current,e=t.getContext("2d");t.width=window.innerWidth,t.height=window.innerHeight,e.globalCompositeOperation=ht.includes(s)?s:"normal";var a=lt[o];a||(console.warn('Animation "'.concat(o,'" not found. Using fallback animation.')),a=lt[l]||lt.geometricShapes),y&&!nt.current&&(nt.current=et(t,v),nt.current.attachListeners());var r=b?ot.getAnimationSettings(o):{};return a(t,e,m({themeManager:b?ot:null,interactionHandler:nt.current,performanceMonitor:it,adaptivePerformance:Z},r))}),[o,l,s,y,b,lt]);return e((function(){var t=ct(),e=0,a=1e3/d;return rt.current=requestAnimationFrame((function r(n){if(!M||M.isPlaying){rt.current=requestAnimationFrame(r);var i=n-e,o=M?M.speed:1,h=a/o;if(i>=h&&(e=n-i%h,it&&it.recordFrame(),t(),Z&&it)){var l=it.avgFps;"poor"===it.performanceLevel&&l<20&&console.warn("Poor performance detected. Consider reducing animation complexity.")}}else rt.current=requestAnimationFrame(r)})),function(){rt.current&&cancelAnimationFrame(rt.current)}}),[ct,d,M]),e((function(){var t=function(){at.current&&(at.current.width=window.innerWidth,at.current.height=window.innerHeight,ct())};return window.addEventListener("resize",t),function(){nt.current&&nt.current.removeListeners(),window.removeEventListener("resize",t)}}),[ct]),t.createElement("canvas",{ref:at,style:m({position:"fixed",top:0,left:0,width:"100%",height:"100%",zIndex:-1},u)})}));export{ht as AnimatedBackground,Q as AnimatedText,rt as COLOR_SCHEMES,at as GestureRecognizer,V as LayeredBackground,nt as THEMES,it as ThemeManager,k as auroraBorealis,J as bloodRain,z as cosmicDust,et as createInteractionHandler,$ as creepyCrawlies,I as electricStorm,N as fallingFoodFiesta,A as fireflies,x as floatingBubbles,E as galaxySpiral,F as geometricShapes,H as ghostlyApparitions,S as gradientWave,q as hauntedForest,O as matrixRain,T as neonPulse,P as particleNetwork,R as quantumField,C as rainbowWaves,U as spiderwebOverlay,w as starryNight,ot as themeManager,_ as undeadGraveyard,Z as useAnimationControls,tt as usePerformanceMonitor};
//# sourceMappingURL=index.esm.js.map