"use strict";(globalThis.webpackChunkwordpress_particles=globalThis.webpackChunkwordpress_particles||[]).push([[1651],{3151:(t,a,i)=>{i.d(a,{L:()=>c});class c{constructor(t){this.container=t,this.type="external"}}},1651:(t,a,i)=>{i.r(a),i.d(a,{Attract:()=>d,loadExternalAttractInteraction:()=>h});var c=i(3151),e=i(9201),s=i(5302),n=i(2613),r=i(8264),o=i(4684);class d{constructor(){this.distance=200,this.duration=.4,this.easing="ease-out-quad",this.factor=1,this.maxSpeed=50,this.speed=1}load(t){t&&(void 0!==t.distance&&(this.distance=t.distance),void 0!==t.duration&&(this.duration=t.duration),void 0!==t.easing&&(this.easing=t.easing),void 0!==t.factor&&(this.factor=t.factor),void 0!==t.maxSpeed&&(this.maxSpeed=t.maxSpeed),void 0!==t.speed&&(this.speed=t.speed))}}class l extends c.L{constructor(t,a){super(a),this._clickAttract=()=>{const t=this.container;t.attract||(t.attract={particles:[]});const{attract:a}=t;if(a.finish||(a.count||(a.count=0),a.count++,a.count===t.particles.count&&(a.finish=!0)),a.clicking){const a=t.interactivity.mouse.clickPosition,i=t.retina.attractModeDistance;if(!i||i<0||!a)return;this._processAttract(a,i,new e.C(a.x,a.y,i))}else!1===a.clicking&&(a.particles=[])},this._hoverAttract=()=>{const t=this.container,a=t.interactivity.mouse.position,i=t.retina.attractModeDistance;!i||i<0||!a||this._processAttract(a,i,new e.C(a.x,a.y,i))},this._processAttract=(t,a,i)=>{const c=this.container,e=c.actualOptions.interactivity.modes.attract;if(!e)return;const r=c.particles.quadTree.query(i,(t=>this.isEnabled(t)));for(const i of r){const{dx:c,dy:r,distance:o}=(0,s.oW)(i.position,t),d=e.speed*e.factor,l=(0,s.uZ)((0,s._X)(e.easing)(1-o/a)*d,0,e.maxSpeed),h=n.O.create(0===o?d:c/o*l,0===o?d:r/o*l);i.position.subFrom(h)}},this._engine=t,a.attract||(a.attract={particles:[]}),this.handleClickMode=t=>{const i=this.container.actualOptions.interactivity.modes.attract;if(i&&"attract"===t){a.attract||(a.attract={particles:[]}),a.attract.clicking=!0,a.attract.count=0;for(const t of a.attract.particles)this.isEnabled(t)&&t.velocity.setTo(t.initialVelocity);a.attract.particles=[],a.attract.finish=!1,setTimeout((()=>{a.destroyed||(a.attract||(a.attract={particles:[]}),a.attract.clicking=!1)}),1e3*i.duration)}}}clear(){}init(){const t=this.container,a=t.actualOptions.interactivity.modes.attract;a&&(t.retina.attractModeDistance=a.distance*t.retina.pixelRatio)}async interact(){const t=this.container,a=t.actualOptions,i=t.interactivity.status===r.Wt,c=a.interactivity.events,e=c.onHover.enable,s=c.onHover.mode,n=c.onClick.enable,d=c.onClick.mode;i&&e&&(0,o.dB)("attract",s)?this._hoverAttract():n&&(0,o.dB)("attract",d)&&this._clickAttract()}isEnabled(t){const a=this.container,i=a.actualOptions,c=a.interactivity.mouse,e=(t?.interactivity??i.interactivity).events;if(!(c.position&&e.onHover.enable||c.clickPosition&&e.onClick.enable))return!1;const s=e.onHover.mode,n=e.onClick.mode;return(0,o.dB)("attract",s)||(0,o.dB)("attract",n)}loadModeOptions(t,...a){t.attract||(t.attract=new d);for(const i of a)t.attract.load(i?.attract)}reset(){}}async function h(t,a=!0){await t.addInteractor("externalAttract",(a=>new l(t,a)),a)}}}]);