@tsparticles/interaction-external-repulse 4.0.0 → 4.0.1

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/browser/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ensureInteractivityPluginLoaded } from "@tsparticles/plugin-interactivity";
2
2
  import { Repulser } from "./Repulser.js";
3
3
  export async function loadExternalRepulseInteraction(engine) {
4
- engine.checkVersion("4.0.0");
4
+ engine.checkVersion("4.0.1");
5
5
  await engine.pluginManager.register((e) => {
6
6
  ensureInteractivityPluginLoaded(e);
7
7
  const pluginManager = e.pluginManager;
@@ -1,5 +1,5 @@
1
1
  export async function loadExternalRepulseInteraction(engine) {
2
- engine.checkVersion("4.0.0");
2
+ engine.checkVersion("4.0.1");
3
3
  await engine.pluginManager.register(async (e) => {
4
4
  const { ensureInteractivityPluginLoaded } = await import("@tsparticles/plugin-interactivity/lazy");
5
5
  ensureInteractivityPluginLoaded(e);
package/cjs/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ensureInteractivityPluginLoaded } from "@tsparticles/plugin-interactivity";
2
2
  import { Repulser } from "./Repulser.js";
3
3
  export async function loadExternalRepulseInteraction(engine) {
4
- engine.checkVersion("4.0.0");
4
+ engine.checkVersion("4.0.1");
5
5
  await engine.pluginManager.register((e) => {
6
6
  ensureInteractivityPluginLoaded(e);
7
7
  const pluginManager = e.pluginManager;
package/cjs/index.lazy.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export async function loadExternalRepulseInteraction(engine) {
2
- engine.checkVersion("4.0.0");
2
+ engine.checkVersion("4.0.1");
3
3
  await engine.pluginManager.register(async (e) => {
4
4
  const { ensureInteractivityPluginLoaded } = await import("@tsparticles/plugin-interactivity/lazy");
5
5
  ensureInteractivityPluginLoaded(e);
package/esm/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ensureInteractivityPluginLoaded } from "@tsparticles/plugin-interactivity";
2
2
  import { Repulser } from "./Repulser.js";
3
3
  export async function loadExternalRepulseInteraction(engine) {
4
- engine.checkVersion("4.0.0");
4
+ engine.checkVersion("4.0.1");
5
5
  await engine.pluginManager.register((e) => {
6
6
  ensureInteractivityPluginLoaded(e);
7
7
  const pluginManager = e.pluginManager;
package/esm/index.lazy.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export async function loadExternalRepulseInteraction(engine) {
2
- engine.checkVersion("4.0.0");
2
+ engine.checkVersion("4.0.1");
3
3
  await engine.pluginManager.register(async (e) => {
4
4
  const { ensureInteractivityPluginLoaded } = await import("@tsparticles/plugin-interactivity/lazy");
5
5
  ensureInteractivityPluginLoaded(e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/interaction-external-repulse",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "tsParticles repulse external interaction",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -101,7 +101,7 @@
101
101
  },
102
102
  "type": "module",
103
103
  "peerDependencies": {
104
- "@tsparticles/engine": "4.0.0",
105
- "@tsparticles/plugin-interactivity": "4.0.0"
104
+ "@tsparticles/engine": "4.0.1",
105
+ "@tsparticles/plugin-interactivity": "4.0.1"
106
106
  }
107
107
  }
@@ -1,5 +1,5 @@
1
1
  (function(g){g.__tsParticlesInternals=g.__tsParticlesInternals||{};g.__tsParticlesInternals.bundles=g.__tsParticlesInternals.bundles||{};g.__tsParticlesInternals.effects=g.__tsParticlesInternals.effects||{};g.__tsParticlesInternals.engine=g.__tsParticlesInternals.engine||{};g.__tsParticlesInternals.interactions=g.__tsParticlesInternals.interactions||{};g.__tsParticlesInternals.palettes=g.__tsParticlesInternals.palettes||{};g.__tsParticlesInternals.paths=g.__tsParticlesInternals.paths||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins.emittersShapes=g.__tsParticlesInternals.plugins.emittersShapes||{};g.__tsParticlesInternals.presets=g.__tsParticlesInternals.presets||{};g.__tsParticlesInternals.shapes=g.__tsParticlesInternals.shapes||{};g.__tsParticlesInternals.updaters=g.__tsParticlesInternals.updaters||{};g.__tsParticlesInternals.utils=g.__tsParticlesInternals.utils||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas.utils=g.__tsParticlesInternals.canvas.utils||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path.utils=g.__tsParticlesInternals.path.utils||{};var __tsProxyFactory=typeof Proxy!=="undefined"?function(obj){return new Proxy(obj,{get:function(target,key){if(!(key in target)){target[key]={};}return target[key];}});}:function(obj){return obj;};g.__tsParticlesInternals.bundles=__tsProxyFactory(g.__tsParticlesInternals.bundles);g.__tsParticlesInternals.effects=__tsProxyFactory(g.__tsParticlesInternals.effects);g.__tsParticlesInternals.interactions=__tsProxyFactory(g.__tsParticlesInternals.interactions);g.__tsParticlesInternals.palettes=__tsProxyFactory(g.__tsParticlesInternals.palettes);g.__tsParticlesInternals.paths=__tsProxyFactory(g.__tsParticlesInternals.paths);g.__tsParticlesInternals.plugins=__tsProxyFactory(g.__tsParticlesInternals.plugins);g.__tsParticlesInternals.plugins.emittersShapes=__tsProxyFactory(g.__tsParticlesInternals.plugins.emittersShapes);g.__tsParticlesInternals.presets=__tsProxyFactory(g.__tsParticlesInternals.presets);g.__tsParticlesInternals.shapes=__tsProxyFactory(g.__tsParticlesInternals.shapes);g.__tsParticlesInternals.updaters=__tsProxyFactory(g.__tsParticlesInternals.updaters);g.__tsParticlesInternals.utils=__tsProxyFactory(g.__tsParticlesInternals.utils);g.__tsParticlesInternals.canvas=__tsProxyFactory(g.__tsParticlesInternals.canvas);g.__tsParticlesInternals.path=__tsProxyFactory(g.__tsParticlesInternals.path);g.tsparticlesInternalExports=g.tsparticlesInternalExports||{};})(typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:this);
2
- /* External Interaction v4.0.0 */
2
+ /* External Interaction v4.0.1 */
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tsparticles/plugin-interactivity'), require('@tsparticles/engine')) :
5
5
  typeof define === 'function' && define.amd ? define(['exports', '@tsparticles/plugin-interactivity', '@tsparticles/engine'], factory) :
@@ -330,7 +330,7 @@
330
330
  }
331
331
 
332
332
  async function loadExternalRepulseInteraction(engine) {
333
- engine.checkVersion("4.0.0");
333
+ engine.checkVersion("4.0.1");
334
334
  await engine.pluginManager.register((e) => {
335
335
  pluginInteractivity.ensureInteractivityPluginLoaded(e);
336
336
  const pluginManager = e.pluginManager;
@@ -1 +1 @@
1
- !function(e){e.__tsParticlesInternals=e.__tsParticlesInternals||{},e.__tsParticlesInternals.bundles=e.__tsParticlesInternals.bundles||{},e.__tsParticlesInternals.effects=e.__tsParticlesInternals.effects||{},e.__tsParticlesInternals.engine=e.__tsParticlesInternals.engine||{},e.__tsParticlesInternals.interactions=e.__tsParticlesInternals.interactions||{},e.__tsParticlesInternals.palettes=e.__tsParticlesInternals.palettes||{},e.__tsParticlesInternals.paths=e.__tsParticlesInternals.paths||{},e.__tsParticlesInternals.plugins=e.__tsParticlesInternals.plugins||{},e.__tsParticlesInternals.plugins=e.__tsParticlesInternals.plugins||{},e.__tsParticlesInternals.plugins.emittersShapes=e.__tsParticlesInternals.plugins.emittersShapes||{},e.__tsParticlesInternals.presets=e.__tsParticlesInternals.presets||{},e.__tsParticlesInternals.shapes=e.__tsParticlesInternals.shapes||{},e.__tsParticlesInternals.updaters=e.__tsParticlesInternals.updaters||{},e.__tsParticlesInternals.utils=e.__tsParticlesInternals.utils||{},e.__tsParticlesInternals.canvas=e.__tsParticlesInternals.canvas||{},e.__tsParticlesInternals.canvas=e.__tsParticlesInternals.canvas||{},e.__tsParticlesInternals.canvas.utils=e.__tsParticlesInternals.canvas.utils||{},e.__tsParticlesInternals.path=e.__tsParticlesInternals.path||{},e.__tsParticlesInternals.path=e.__tsParticlesInternals.path||{},e.__tsParticlesInternals.path.utils=e.__tsParticlesInternals.path.utils||{};var t="undefined"!=typeof Proxy?function(e){return new Proxy(e,{get:function(e,t){return t in e||(e[t]={}),e[t]}})}:function(e){return e};e.__tsParticlesInternals.bundles=t(e.__tsParticlesInternals.bundles),e.__tsParticlesInternals.effects=t(e.__tsParticlesInternals.effects),e.__tsParticlesInternals.interactions=t(e.__tsParticlesInternals.interactions),e.__tsParticlesInternals.palettes=t(e.__tsParticlesInternals.palettes),e.__tsParticlesInternals.paths=t(e.__tsParticlesInternals.paths),e.__tsParticlesInternals.plugins=t(e.__tsParticlesInternals.plugins),e.__tsParticlesInternals.plugins.emittersShapes=t(e.__tsParticlesInternals.plugins.emittersShapes),e.__tsParticlesInternals.presets=t(e.__tsParticlesInternals.presets),e.__tsParticlesInternals.shapes=t(e.__tsParticlesInternals.shapes),e.__tsParticlesInternals.updaters=t(e.__tsParticlesInternals.updaters),e.__tsParticlesInternals.utils=t(e.__tsParticlesInternals.utils),e.__tsParticlesInternals.canvas=t(e.__tsParticlesInternals.canvas),e.__tsParticlesInternals.path=t(e.__tsParticlesInternals.path),e.tsparticlesInternalExports=e.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@tsparticles/plugin-interactivity"),require("@tsparticles/engine")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/plugin-interactivity","@tsparticles/engine"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).__tsParticlesInternals=e.__tsParticlesInternals||{},e.__tsParticlesInternals.interactions=e.__tsParticlesInternals.interactions||{},e.__tsParticlesInternals.interactions.externalRepulse=e.__tsParticlesInternals.interactions.externalRepulse||{}),e.__tsParticlesInternals.plugins.interactivity,e.__tsParticlesInternals.engine)}(this,function(e,t,s){"use strict";class i{distance;duration;easing;factor;maxSpeed;restore;speed;constructor(){this.distance=200,this.duration=.4,this.factor=100,this.speed=1,this.maxSpeed=50,this.easing=s.EasingType.easeOutQuad,this.restore={enable:!1,delay:0,speed:.08,follow:!0}}load(e){s.isNull(e)||(void 0!==e.distance&&(this.distance=e.distance),void 0!==e.duration&&(this.duration=e.duration),void 0!==e.easing&&(this.easing=e.easing),void 0!==e.factor&&(this.factor=e.factor),void 0!==e.speed&&(this.speed=e.speed),void 0!==e.maxSpeed&&(this.maxSpeed=e.maxSpeed),void 0!==e.restore&&(this.restore.enable=e.restore.enable??this.restore.enable,this.restore.delay=e.restore.delay??this.restore.delay,this.restore.speed=e.restore.speed??this.restore.speed,this.restore.follow=e.restore.follow??this.restore.follow))}}class n extends i{selectors;constructor(){super(),this.selectors=[]}load(e){super.load(e),s.isNull(e)||void 0!==e.selectors&&(this.selectors=e.selectors)}}class a extends i{divs;load(e){super.load(e),s.isNull(e)||(this.divs=s.executeOnSingleOrMultiple(e.divs,e=>{const t=new n;return t.load(e),t}))}}const r="repulse";class l extends t.ExternalInteractorBase{handleClickMode;_clickVec;_interactedThisFrame;_maxDistance;_normVec;_pluginManager;_restoreData;constructor(e,t){super(t),this._pluginManager=e,this._maxDistance=0,this._normVec=s.Vector.origin,this._interactedThisFrame=new Set,this._clickVec=s.Vector.origin,this._restoreData=new Map,t.repulse??={particles:[]},this.handleClickMode=(e,i)=>{const n=this.container.actualOptions,a=n.interactivity?.modes.repulse;if(!a||e!==r)return;t.repulse??={particles:[]};const l=t.repulse;l.clicking=!0,l.count=0;for(const e of t.repulse.particles)this.isEnabled(i,e)&&e.velocity.setTo(e.initialVelocity);l.particles=[],l.finish=!1,setTimeout(()=>{t.destroyed||(l.clicking=!1)},a.duration*s.millisecondsToSeconds)}}get maxDistance(){return this._maxDistance}clear(){}init(){const e=this.container,t=e.actualOptions.interactivity?.modes.repulse;t&&(this._maxDistance=t.distance,e.retina.repulseModeDistance=t.distance*e.retina.pixelRatio)}interact(e){this._interactedThisFrame.clear();const i=this.container.actualOptions,n=e.status===t.mouseMoveEvent,a=i.interactivity?.events;if(!a)return;const l=a.onHover,c=l.enable,o=l.mode,_=a.onClick,p=_.enable,d=_.mode,u=a.onDiv;n&&c&&s.isInArray(r,o)?this._hoverRepulse(e):p&&s.isInArray(r,d)?this._clickRepulse(e):t.divModeExecute(r,u,(t,s)=>{this._singleSelectorRepulse(e,t,s)}),this._restoreParticles()}isEnabled(e,i){const n=this.container.actualOptions,a=e.mouse,l=(i?.interactivity??n.interactivity)?.events;if(!l)return!1;const c=l.onDiv,o=l.onHover,_=l.onClick,p=t.isDivModeEnabled(r,c);if(!(p||o.enable&&a.position||_.enable&&a.clickPosition))return!1;const d=o.mode,u=_.mode;return s.isInArray(r,d)||s.isInArray(r,u)||p}loadModeOptions(e,...t){e.repulse??=new a;for(const s of t)e.repulse.load(s?.repulse)}reset(){}_clickRepulse=e=>{const t=this.container,i=t.actualOptions.interactivity?.modes.repulse;if(!i)return;const n=t.repulse??{particles:[]};if(n.finish||(n.count??=0,n.count++,n.count===t.particles.count&&(n.finish=!0)),n.clicking){const a=t.retina.repulseModeDistance;if(!a||a<0)return;const r=Math.pow(a/6,3),l=e.mouse.clickPosition;if(void 0===l)return;const c=new s.Circle(l.x,l.y,r),o=t.particles.grid.query(c,t=>this.isEnabled(e,t));for(const e of o){const{dx:t,dy:a,distance:c}=s.getDistances(l,e.position),o=c**2,_=-r*i.speed/o;o<=r&&(this._trackInteractedParticle(e),n.particles.push(e),this._clickVec.x=t,this._clickVec.y=a,this._clickVec.length=_,e.velocity.setTo(this._clickVec))}}else if(!1===n.clicking){for(const e of n.particles)e.velocity.setTo(e.initialVelocity);n.particles=[]}};_hoverRepulse=e=>{const t=this.container,i=e.mouse.position,n=t.retina.repulseModeDistance;!n||n<0||!i||this._processRepulse(e,i,n,new s.Circle(i.x,i.y,n))};_processRepulse=(e,t,i,n,a)=>{const r=this.container,l=r.particles.grid.query(n,t=>this.isEnabled(e,t)),c=r.actualOptions.interactivity?.modes.repulse;if(!c)return;const{easing:o,speed:_,factor:p,maxSpeed:d}=c,u=this._pluginManager.getEasing(o),h=(a?.speed??_)*p;for(const e of l){const{dx:n,dy:a,distance:r}=s.getDistances(e.position,t),l=s.clamp(u(1-r/i)*h,0,d);this._normVec.x=r?n/r*l:h,this._normVec.y=r?a/r*l:h,this._trackInteractedParticle(e),e.position.addTo(this._normVec)}};_restoreParticles(){const e=this.container.actualOptions.interactivity?.modes.repulse?.restore;if(!e?.enable||!this._restoreData.size)return;const t=Date.now(),i=e.delay*s.millisecondsToSeconds,n=Math.max(.001,Math.min(1,e.speed));for(const[s,a]of this._restoreData){if(this._interactedThisFrame.has(s))continue;if(s.destroyed){this._restoreData.delete(s);continue}const r=a.target;if(t-a.lastInteractionTime<i)continue;e.follow&&s.options.move.enable&&(r.x+=s.velocity.x,r.y+=s.velocity.y,r.z+=s.velocity.z);const l=r.x-s.position.x,c=r.y-s.position.y,o=r.z-s.position.z;s.position.x+=l*n,s.position.y+=c*n,s.position.z+=o*n,Math.abs(l)<=.5&&Math.abs(c)<=.5&&(s.position.x=r.x,s.position.y=r.y,s.position.z=r.z,this._restoreData.delete(s))}}_singleSelectorRepulse=(e,i,n)=>{const a=this.container,r=a.actualOptions.interactivity?.modes.repulse;if(!r)return;const l=s.safeDocument().querySelectorAll(i);l.length&&l.forEach(i=>{const l=i,c=a.retina.pixelRatio,o={x:(l.offsetLeft+l.offsetWidth*s.half)*c,y:(l.offsetTop+l.offsetHeight*s.half)*c},_=l.offsetWidth*s.half*c,p=n.type===t.DivType.circle?new s.Circle(o.x,o.y,_):new s.Rectangle(l.offsetLeft*c,l.offsetTop*c,l.offsetWidth*c,l.offsetHeight*c),d=r.divs,u=t.divMode(d,l);this._processRepulse(e,o,_,p,u)})};_trackInteractedParticle(e){this._interactedThisFrame.add(e);const t=this.container.actualOptions.interactivity?.modes.repulse?.restore;if(!t?.enable)return;const s=Date.now();let i=this._restoreData.get(e);i||(i={target:e.position.copy(),lastInteractionTime:s},this._restoreData.set(e,i)),i.lastInteractionTime=s,t.follow&&e.options.move.enable&&(i.target.x+=e.velocity.x,i.target.y+=e.velocity.y,i.target.z+=e.velocity.z)}}async function c(e){e.checkVersion("4.0.0"),await e.pluginManager.register(e=>{t.ensureInteractivityPluginLoaded(e);const s=e.pluginManager;s.addInteractor?.("externalRepulse",e=>Promise.resolve(new l(s,e)))})}const o=globalThis;o.__tsParticlesInternals=o.__tsParticlesInternals??{},o.loadExternalRepulseInteraction=c,e.Repulse=a,e.RepulseBase=i,e.RepulseDiv=n,e.loadExternalRepulseInteraction=c}),Object.assign(globalThis.window||globalThis,{loadExternalRepulseInteraction:(globalThis.__tsParticlesInternals.interactions.externalRepulse||{}).loadExternalRepulseInteraction}),delete(globalThis.window||globalThis).tsparticlesInternalExports;
1
+ !function(e){e.__tsParticlesInternals=e.__tsParticlesInternals||{},e.__tsParticlesInternals.bundles=e.__tsParticlesInternals.bundles||{},e.__tsParticlesInternals.effects=e.__tsParticlesInternals.effects||{},e.__tsParticlesInternals.engine=e.__tsParticlesInternals.engine||{},e.__tsParticlesInternals.interactions=e.__tsParticlesInternals.interactions||{},e.__tsParticlesInternals.palettes=e.__tsParticlesInternals.palettes||{},e.__tsParticlesInternals.paths=e.__tsParticlesInternals.paths||{},e.__tsParticlesInternals.plugins=e.__tsParticlesInternals.plugins||{},e.__tsParticlesInternals.plugins=e.__tsParticlesInternals.plugins||{},e.__tsParticlesInternals.plugins.emittersShapes=e.__tsParticlesInternals.plugins.emittersShapes||{},e.__tsParticlesInternals.presets=e.__tsParticlesInternals.presets||{},e.__tsParticlesInternals.shapes=e.__tsParticlesInternals.shapes||{},e.__tsParticlesInternals.updaters=e.__tsParticlesInternals.updaters||{},e.__tsParticlesInternals.utils=e.__tsParticlesInternals.utils||{},e.__tsParticlesInternals.canvas=e.__tsParticlesInternals.canvas||{},e.__tsParticlesInternals.canvas=e.__tsParticlesInternals.canvas||{},e.__tsParticlesInternals.canvas.utils=e.__tsParticlesInternals.canvas.utils||{},e.__tsParticlesInternals.path=e.__tsParticlesInternals.path||{},e.__tsParticlesInternals.path=e.__tsParticlesInternals.path||{},e.__tsParticlesInternals.path.utils=e.__tsParticlesInternals.path.utils||{};var t="undefined"!=typeof Proxy?function(e){return new Proxy(e,{get:function(e,t){return t in e||(e[t]={}),e[t]}})}:function(e){return e};e.__tsParticlesInternals.bundles=t(e.__tsParticlesInternals.bundles),e.__tsParticlesInternals.effects=t(e.__tsParticlesInternals.effects),e.__tsParticlesInternals.interactions=t(e.__tsParticlesInternals.interactions),e.__tsParticlesInternals.palettes=t(e.__tsParticlesInternals.palettes),e.__tsParticlesInternals.paths=t(e.__tsParticlesInternals.paths),e.__tsParticlesInternals.plugins=t(e.__tsParticlesInternals.plugins),e.__tsParticlesInternals.plugins.emittersShapes=t(e.__tsParticlesInternals.plugins.emittersShapes),e.__tsParticlesInternals.presets=t(e.__tsParticlesInternals.presets),e.__tsParticlesInternals.shapes=t(e.__tsParticlesInternals.shapes),e.__tsParticlesInternals.updaters=t(e.__tsParticlesInternals.updaters),e.__tsParticlesInternals.utils=t(e.__tsParticlesInternals.utils),e.__tsParticlesInternals.canvas=t(e.__tsParticlesInternals.canvas),e.__tsParticlesInternals.path=t(e.__tsParticlesInternals.path),e.tsparticlesInternalExports=e.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@tsparticles/plugin-interactivity"),require("@tsparticles/engine")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/plugin-interactivity","@tsparticles/engine"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).__tsParticlesInternals=e.__tsParticlesInternals||{},e.__tsParticlesInternals.interactions=e.__tsParticlesInternals.interactions||{},e.__tsParticlesInternals.interactions.externalRepulse=e.__tsParticlesInternals.interactions.externalRepulse||{}),e.__tsParticlesInternals.plugins.interactivity,e.__tsParticlesInternals.engine)}(this,function(e,t,s){"use strict";class i{distance;duration;easing;factor;maxSpeed;restore;speed;constructor(){this.distance=200,this.duration=.4,this.factor=100,this.speed=1,this.maxSpeed=50,this.easing=s.EasingType.easeOutQuad,this.restore={enable:!1,delay:0,speed:.08,follow:!0}}load(e){s.isNull(e)||(void 0!==e.distance&&(this.distance=e.distance),void 0!==e.duration&&(this.duration=e.duration),void 0!==e.easing&&(this.easing=e.easing),void 0!==e.factor&&(this.factor=e.factor),void 0!==e.speed&&(this.speed=e.speed),void 0!==e.maxSpeed&&(this.maxSpeed=e.maxSpeed),void 0!==e.restore&&(this.restore.enable=e.restore.enable??this.restore.enable,this.restore.delay=e.restore.delay??this.restore.delay,this.restore.speed=e.restore.speed??this.restore.speed,this.restore.follow=e.restore.follow??this.restore.follow))}}class n extends i{selectors;constructor(){super(),this.selectors=[]}load(e){super.load(e),s.isNull(e)||void 0!==e.selectors&&(this.selectors=e.selectors)}}class a extends i{divs;load(e){super.load(e),s.isNull(e)||(this.divs=s.executeOnSingleOrMultiple(e.divs,e=>{const t=new n;return t.load(e),t}))}}const r="repulse";class l extends t.ExternalInteractorBase{handleClickMode;_clickVec;_interactedThisFrame;_maxDistance;_normVec;_pluginManager;_restoreData;constructor(e,t){super(t),this._pluginManager=e,this._maxDistance=0,this._normVec=s.Vector.origin,this._interactedThisFrame=new Set,this._clickVec=s.Vector.origin,this._restoreData=new Map,t.repulse??={particles:[]},this.handleClickMode=(e,i)=>{const n=this.container.actualOptions,a=n.interactivity?.modes.repulse;if(!a||e!==r)return;t.repulse??={particles:[]};const l=t.repulse;l.clicking=!0,l.count=0;for(const e of t.repulse.particles)this.isEnabled(i,e)&&e.velocity.setTo(e.initialVelocity);l.particles=[],l.finish=!1,setTimeout(()=>{t.destroyed||(l.clicking=!1)},a.duration*s.millisecondsToSeconds)}}get maxDistance(){return this._maxDistance}clear(){}init(){const e=this.container,t=e.actualOptions.interactivity?.modes.repulse;t&&(this._maxDistance=t.distance,e.retina.repulseModeDistance=t.distance*e.retina.pixelRatio)}interact(e){this._interactedThisFrame.clear();const i=this.container.actualOptions,n=e.status===t.mouseMoveEvent,a=i.interactivity?.events;if(!a)return;const l=a.onHover,c=l.enable,o=l.mode,_=a.onClick,p=_.enable,d=_.mode,u=a.onDiv;n&&c&&s.isInArray(r,o)?this._hoverRepulse(e):p&&s.isInArray(r,d)?this._clickRepulse(e):t.divModeExecute(r,u,(t,s)=>{this._singleSelectorRepulse(e,t,s)}),this._restoreParticles()}isEnabled(e,i){const n=this.container.actualOptions,a=e.mouse,l=(i?.interactivity??n.interactivity)?.events;if(!l)return!1;const c=l.onDiv,o=l.onHover,_=l.onClick,p=t.isDivModeEnabled(r,c);if(!(p||o.enable&&a.position||_.enable&&a.clickPosition))return!1;const d=o.mode,u=_.mode;return s.isInArray(r,d)||s.isInArray(r,u)||p}loadModeOptions(e,...t){e.repulse??=new a;for(const s of t)e.repulse.load(s?.repulse)}reset(){}_clickRepulse=e=>{const t=this.container,i=t.actualOptions.interactivity?.modes.repulse;if(!i)return;const n=t.repulse??{particles:[]};if(n.finish||(n.count??=0,n.count++,n.count===t.particles.count&&(n.finish=!0)),n.clicking){const a=t.retina.repulseModeDistance;if(!a||a<0)return;const r=Math.pow(a/6,3),l=e.mouse.clickPosition;if(void 0===l)return;const c=new s.Circle(l.x,l.y,r),o=t.particles.grid.query(c,t=>this.isEnabled(e,t));for(const e of o){const{dx:t,dy:a,distance:c}=s.getDistances(l,e.position),o=c**2,_=-r*i.speed/o;o<=r&&(this._trackInteractedParticle(e),n.particles.push(e),this._clickVec.x=t,this._clickVec.y=a,this._clickVec.length=_,e.velocity.setTo(this._clickVec))}}else if(!1===n.clicking){for(const e of n.particles)e.velocity.setTo(e.initialVelocity);n.particles=[]}};_hoverRepulse=e=>{const t=this.container,i=e.mouse.position,n=t.retina.repulseModeDistance;!n||n<0||!i||this._processRepulse(e,i,n,new s.Circle(i.x,i.y,n))};_processRepulse=(e,t,i,n,a)=>{const r=this.container,l=r.particles.grid.query(n,t=>this.isEnabled(e,t)),c=r.actualOptions.interactivity?.modes.repulse;if(!c)return;const{easing:o,speed:_,factor:p,maxSpeed:d}=c,u=this._pluginManager.getEasing(o),h=(a?.speed??_)*p;for(const e of l){const{dx:n,dy:a,distance:r}=s.getDistances(e.position,t),l=s.clamp(u(1-r/i)*h,0,d);this._normVec.x=r?n/r*l:h,this._normVec.y=r?a/r*l:h,this._trackInteractedParticle(e),e.position.addTo(this._normVec)}};_restoreParticles(){const e=this.container.actualOptions.interactivity?.modes.repulse?.restore;if(!e?.enable||!this._restoreData.size)return;const t=Date.now(),i=e.delay*s.millisecondsToSeconds,n=Math.max(.001,Math.min(1,e.speed));for(const[s,a]of this._restoreData){if(this._interactedThisFrame.has(s))continue;if(s.destroyed){this._restoreData.delete(s);continue}const r=a.target;if(t-a.lastInteractionTime<i)continue;e.follow&&s.options.move.enable&&(r.x+=s.velocity.x,r.y+=s.velocity.y,r.z+=s.velocity.z);const l=r.x-s.position.x,c=r.y-s.position.y,o=r.z-s.position.z;s.position.x+=l*n,s.position.y+=c*n,s.position.z+=o*n,Math.abs(l)<=.5&&Math.abs(c)<=.5&&(s.position.x=r.x,s.position.y=r.y,s.position.z=r.z,this._restoreData.delete(s))}}_singleSelectorRepulse=(e,i,n)=>{const a=this.container,r=a.actualOptions.interactivity?.modes.repulse;if(!r)return;const l=s.safeDocument().querySelectorAll(i);l.length&&l.forEach(i=>{const l=i,c=a.retina.pixelRatio,o={x:(l.offsetLeft+l.offsetWidth*s.half)*c,y:(l.offsetTop+l.offsetHeight*s.half)*c},_=l.offsetWidth*s.half*c,p=n.type===t.DivType.circle?new s.Circle(o.x,o.y,_):new s.Rectangle(l.offsetLeft*c,l.offsetTop*c,l.offsetWidth*c,l.offsetHeight*c),d=r.divs,u=t.divMode(d,l);this._processRepulse(e,o,_,p,u)})};_trackInteractedParticle(e){this._interactedThisFrame.add(e);const t=this.container.actualOptions.interactivity?.modes.repulse?.restore;if(!t?.enable)return;const s=Date.now();let i=this._restoreData.get(e);i||(i={target:e.position.copy(),lastInteractionTime:s},this._restoreData.set(e,i)),i.lastInteractionTime=s,t.follow&&e.options.move.enable&&(i.target.x+=e.velocity.x,i.target.y+=e.velocity.y,i.target.z+=e.velocity.z)}}async function c(e){e.checkVersion("4.0.1"),await e.pluginManager.register(e=>{t.ensureInteractivityPluginLoaded(e);const s=e.pluginManager;s.addInteractor?.("externalRepulse",e=>Promise.resolve(new l(s,e)))})}const o=globalThis;o.__tsParticlesInternals=o.__tsParticlesInternals??{},o.loadExternalRepulseInteraction=c,e.Repulse=a,e.RepulseBase=i,e.RepulseDiv=n,e.loadExternalRepulseInteraction=c}),Object.assign(globalThis.window||globalThis,{loadExternalRepulseInteraction:(globalThis.__tsParticlesInternals.interactions.externalRepulse||{}).loadExternalRepulseInteraction}),delete(globalThis.window||globalThis).tsparticlesInternalExports;