"use strict";(globalThis.webpackChunk_tsparticles_wordpress=globalThis.webpackChunk_tsparticles_wordpress||[]).push([[5272],{5272(e,t,i){i.d(t,{MovePluginInstance:()=>n});var a=i(3199);class n{availablePathGenerators;pathGenerators;#e;#t;constructor(e,t){this.#t=e,this.#e=t,this.availablePathGenerators=new Map,this.pathGenerators=new Map}destroy(){this.availablePathGenerators=new Map,this.pathGenerators=new Map}isEnabled(e){return!e.destroyed&&e.options.move.enable}particleCreated(e){const t=e.options.move,i=t.gravity,n=t.path;if(e.moveDecay=a.WH8-(0,a.VGA)(t.decay),e.pathDelay=(0,a.VGA)(n.delay.value)*a.XuV,n.generator){let t=this.pathGenerators.get(n.generator);t||(t=this.availablePathGenerators.get(n.generator),t&&(this.pathGenerators.set(n.generator,t),t.init())),e.pathGenerator=t}e.gravity={enable:i.enable,acceleration:(0,a.VGA)(i.acceleration),inverse:i.inverse},function(e,t){const i=t.options.move.spin;if(!i.enable)return;const n=i.position??{x:50,y:50},s={x:.01*n.x*e.canvas.size.width,y:.01*n.y*e.canvas.size.height},o=t.getPosition(),r=(0,a.YfF)(o,s),c=(0,a.VGA)(i.acceleration);t.retina.spinAcceleration=c*e.retina.pixelRatio,t.spin={center:s,direction:t.velocity.x>=a.GWL?a.pTR.clockwise:a.pTR.counterClockwise,angle:(0,a.G0i)()*a.R1e,radius:r,acceleration:t.retina.spinAcceleration}}(this.#e,e)}particleDestroyed(e){const t=e.pathGenerator;t?.reset(e)}particleUpdate(e,t){const i=e.options.move;if(!i.enable)return;const n=this.#e,s=function(e){return e.slow.inRange?e.slow.factor:a.D_O}(e),o=n.retina.reduceFactor,r=e.retina.moveSpeed,c=e.retina.moveDrift,l=e.size.max,p=r*(i.size?e.getRadius()/l:1)*s*(t.factor||1)*a.MXx,h=e.retina.maxSpeed;i.spin.enable?function(e,t,i,n){if(!t.spin)return;const s=t.spin.direction===a.pTR.clockwise,o={x:s?Math.cos:Math.sin,y:s?Math.sin:Math.cos};t.position.x=t.spin.center.x+t.spin.radius*o.x(t.spin.angle)*n,t.position.y=t.spin.center.y+t.spin.radius*o.y(t.spin.angle)*n,t.spin.radius+=t.spin.acceleration*n;const r=Math.max(e.canvas.size.width,e.canvas.size.height),c=r*a.MXx;t.spin.radius>c?(t.spin.radius=c,t.spin.acceleration*=-a.D_O):t.spin.radius<0&&(t.spin.radius=0,t.spin.acceleration*=-a.D_O),t.spin.angle+=.01*i*(a.D_O-t.spin.radius/r)}(n,e,p,o):function(e,t,i,n,s,o,r){!function(e,t){const i=e.options.move.path;if(!i.enable)return;const n=e.pathDelay??0;if(e.lastPathTime<=n)return void(e.lastPathTime+=t.value);const s=e.pathGenerator?.generate(e,t);s&&e.velocity.addTo(s),i.clamp&&(e.velocity.x=(0,a.qE8)(e.velocity.x,-a.D_O,a.D_O),e.velocity.y=(0,a.qE8)(e.velocity.y,-a.D_O,a.D_O)),e.lastPathTime-=n}(e,r);const c=e.gravity,l=c?.enable&&c.inverse?-a.D_O:a.D_O;s&&i&&(e.velocity.x+=s*r.factor/(60*i)),c?.enable&&i&&(e.velocity.y+=l*(c.acceleration*r.factor)/(60*i));const p=e.moveDecay;e.velocity.multTo(p??1);const h=e.velocity.mult(i);c?.enable&&n>a.GWL&&(!c.inverse&&h.y>=a.GWL&&h.y>=n||c.inverse&&h.y<=a.GWL&&h.y<=-n)&&(h.y=l*n,i&&(e.velocity.y=h.y/i));const y=e.options.zIndex,v=(a.D_O-e.zIndexFactor)**y.velocityRate;h.multTo(v),h.multTo(o);const{position:u}=e;u.addTo(h),t.vibrate&&(u.x+=Math.sin(u.x*Math.cos(u.y))*o,u.y+=Math.cos(u.y*Math.sin(u.x))*o)}(e,i,p,h,c,o,t),function(e){const t=e.initialPosition,{dx:i,dy:n}=(0,a.vrU)(t,e.position),s=Math.abs(i),o=Math.abs(n),{maxDistance:r}=e.retina,c=r.horizontal,l=r.vertical;if(c||l)if((c&&s>=c||l&&o>=l)&&!e.misplaced)e.misplaced=!!c&&s>c||!!l&&o>l,c&&(e.velocity.x=e.velocity.y*a.MXx-e.velocity.x),l&&(e.velocity.y=e.velocity.x*a.MXx-e.velocity.y);else if((!c||s<c)&&(!l||o<l)&&e.misplaced)e.misplaced=!1;else if(e.misplaced){const i=e.position,n=e.velocity;c&&(i.x<t.x&&n.x<a.GWL||i.x>t.x&&n.x>a.GWL)&&(n.x*=-(0,a.G0i)()),l&&(i.y<t.y&&n.y<a.GWL||i.y>t.y&&n.y>a.GWL)&&(n.y*=-(0,a.G0i)())}}(e)}preInit(){return this.#i()}redrawInit(){return this.#i()}update(){for(const e of this.pathGenerators.values())e.update()}async#i(){const e=await(this.#t.getPathGenerators?.(this.#e,!0));if(e){this.availablePathGenerators=e,this.pathGenerators=new Map;for(const e of this.pathGenerators.values())e.init()}}}}}]);