"use strict";(self.webpackChunkelement_web=self.webpackChunkelement_web||[]).push([[792],{"./node_modules/matrix-react-sdk/src/effects/rainfall/index.ts":(t,e,s)=>{s.d(e,{default:()=>a});var i=s("./node_modules/@babel/runtime/helpers/esm/defineProperty.js"),n=s("./node_modules/matrix-react-sdk/src/utils/arrays.ts");function o(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),s.push.apply(s,i)}return s}function r(t){for(var e=1;e<arguments.length;e++){var s=null!=arguments[e]?arguments[e]:{};e%2?o(Object(s),!0).forEach((function(e){(0,i.c)(t,e,s[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):o(Object(s)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(s,e))}))}return t}const c={maxCount:600,speed:12};class a{constructor(t){(0,i.c)(this,"options",void 0),(0,i.c)(this,"context",null),(0,i.c)(this,"particles",[]),(0,i.c)(this,"lastAnimationTime",0),(0,i.c)(this,"isRunning",!1),(0,i.c)(this,"start",(async(t,e=3e3)=>{if(!t)return;this.context=t.getContext("2d"),this.particles=[];const s=this.options.maxCount;for(;this.particles.length<s;)this.particles.push(this.resetParticle({},t.width,t.height));this.isRunning=!0,requestAnimationFrame(this.renderLoop),e&&window.setTimeout(this.stop,e)})),(0,i.c)(this,"stop",(async()=>{this.isRunning=!1})),(0,i.c)(this,"resetParticle",((t,e,s)=>(t.x=Math.random()*e,t.y=Math.random()*-s,t.width=1.5*Math.random(),t.height=15*t.width+4,t.speed=Math.random()*this.options.speed*4/5+this.options.speed,t))),(0,i.c)(this,"renderLoop",(()=>{if(this.context&&this.context.canvas)if(0===this.particles.length)this.context.clearRect(0,0,this.context.canvas.width,this.context.canvas.height);else{(Date.now()-this.lastAnimationTime>=15||!this.lastAnimationTime)&&(this.context.clearRect(0,0,this.context.canvas.width,this.context.canvas.height),this.lastAnimationTime=Date.now(),this.animateAndRenderRaindrops()),requestAnimationFrame(this.renderLoop)}})),(0,i.c)(this,"animateAndRenderRaindrops",(()=>{if(!this.context||!this.context.canvas)return;const t=this.context.canvas.height;for(const e of(0,n.ie)(this.particles)){e.y+=e.speed,this.context.save(),this.context.beginPath(),this.context.rect(e.x,e.y,e.width,e.height),this.context.fillStyle="#5dadec",this.context.fill(),this.context.closePath(),this.context.restore();const s=2*t;if(e.y>t+s){const t=this.particles.indexOf(e);this.particles.splice(t,1)}}})),this.options=r(r({},c),t)}}}}]);
//# sourceMappingURL=792.js.map