@tsparticles/interaction-external-repulse 4.0.0-beta.15 → 4.0.0-beta.16

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-beta.15");
4
+ engine.checkVersion("4.0.0-beta.16");
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-beta.15");
2
+ engine.checkVersion("4.0.0-beta.16");
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-beta.15");
4
+ engine.checkVersion("4.0.0-beta.16");
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-beta.15");
2
+ engine.checkVersion("4.0.0-beta.16");
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-beta.15");
4
+ engine.checkVersion("4.0.0-beta.16");
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-beta.15");
2
+ engine.checkVersion("4.0.0-beta.16");
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-beta.15",
3
+ "version": "4.0.0-beta.16",
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-beta.15",
105
- "@tsparticles/plugin-interactivity": "4.0.0-beta.15"
104
+ "@tsparticles/engine": "4.0.0-beta.16",
105
+ "@tsparticles/plugin-interactivity": "4.0.0-beta.16"
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-beta.15 */
2
+ /* External Interaction v4.0.0-beta.16 */
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) :
@@ -251,7 +251,7 @@
251
251
  }
252
252
 
253
253
  async function loadExternalRepulseInteraction(engine) {
254
- engine.checkVersion("4.0.0-beta.15");
254
+ engine.checkVersion("4.0.0-beta.16");
255
255
  await engine.pluginManager.register((e) => {
256
256
  pluginInteractivity.ensureInteractivityPluginLoaded(e);
257
257
  const pluginManager = e.pluginManager;
@@ -1 +1 @@
1
- !function(t){t.__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.bundles=t.__tsParticlesInternals.bundles||{},t.__tsParticlesInternals.effects=t.__tsParticlesInternals.effects||{},t.__tsParticlesInternals.engine=t.__tsParticlesInternals.engine||{},t.__tsParticlesInternals.interactions=t.__tsParticlesInternals.interactions||{},t.__tsParticlesInternals.palettes=t.__tsParticlesInternals.palettes||{},t.__tsParticlesInternals.paths=t.__tsParticlesInternals.paths||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins.emittersShapes=t.__tsParticlesInternals.plugins.emittersShapes||{},t.__tsParticlesInternals.presets=t.__tsParticlesInternals.presets||{},t.__tsParticlesInternals.shapes=t.__tsParticlesInternals.shapes||{},t.__tsParticlesInternals.updaters=t.__tsParticlesInternals.updaters||{},t.__tsParticlesInternals.utils=t.__tsParticlesInternals.utils||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas.utils=t.__tsParticlesInternals.canvas.utils||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path.utils=t.__tsParticlesInternals.path.utils||{};var e="undefined"!=typeof Proxy?function(t){return new Proxy(t,{get:function(t,e){return e in t||(t[e]={}),t[e]}})}:function(t){return t};t.__tsParticlesInternals.bundles=e(t.__tsParticlesInternals.bundles),t.__tsParticlesInternals.effects=e(t.__tsParticlesInternals.effects),t.__tsParticlesInternals.interactions=e(t.__tsParticlesInternals.interactions),t.__tsParticlesInternals.palettes=e(t.__tsParticlesInternals.palettes),t.__tsParticlesInternals.paths=e(t.__tsParticlesInternals.paths),t.__tsParticlesInternals.plugins=e(t.__tsParticlesInternals.plugins),t.__tsParticlesInternals.plugins.emittersShapes=e(t.__tsParticlesInternals.plugins.emittersShapes),t.__tsParticlesInternals.presets=e(t.__tsParticlesInternals.presets),t.__tsParticlesInternals.shapes=e(t.__tsParticlesInternals.shapes),t.__tsParticlesInternals.updaters=e(t.__tsParticlesInternals.updaters),t.__tsParticlesInternals.utils=e(t.__tsParticlesInternals.utils),t.__tsParticlesInternals.canvas=e(t.__tsParticlesInternals.canvas),t.__tsParticlesInternals.path=e(t.__tsParticlesInternals.path),t.tsparticlesInternalExports=t.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@tsparticles/plugin-interactivity"),require("@tsparticles/engine")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/plugin-interactivity","@tsparticles/engine"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.interactions=t.__tsParticlesInternals.interactions||{},t.__tsParticlesInternals.interactions.externalRepulse=t.__tsParticlesInternals.interactions.externalRepulse||{}),t.__tsParticlesInternals.plugins.interactivity,t.__tsParticlesInternals.engine)}(this,function(t,e,s){"use strict";class n{distance;duration;easing;factor;maxSpeed;speed;constructor(){this.distance=200,this.duration=.4,this.factor=100,this.speed=1,this.maxSpeed=50,this.easing=s.EasingType.easeOutQuad}load(t){s.isNull(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.speed&&(this.speed=t.speed),void 0!==t.maxSpeed&&(this.maxSpeed=t.maxSpeed))}}class i extends n{selectors;constructor(){super(),this.selectors=[]}load(t){super.load(t),s.isNull(t)||void 0!==t.selectors&&(this.selectors=t.selectors)}}class a extends n{divs;load(t){super.load(t),s.isNull(t)||(this.divs=s.executeOnSingleOrMultiple(t.divs,t=>{const e=new i;return e.load(t),e}))}}const r="repulse";class l extends e.ExternalInteractorBase{handleClickMode;_clickVec;_maxDistance;_normVec;_pluginManager;constructor(t,e){super(e),this._pluginManager=t,this._maxDistance=0,this._normVec=s.Vector.origin,this._clickVec=s.Vector.origin,e.repulse??={particles:[]},this.handleClickMode=(t,n)=>{const i=this.container.actualOptions,a=i.interactivity?.modes.repulse;if(!a||t!==r)return;e.repulse??={particles:[]};const l=e.repulse;l.clicking=!0,l.count=0;for(const t of e.repulse.particles)this.isEnabled(n,t)&&t.velocity.setTo(t.initialVelocity);l.particles=[],l.finish=!1,setTimeout(()=>{e.destroyed||(l.clicking=!1)},a.duration*s.millisecondsToSeconds)}}get maxDistance(){return this._maxDistance}clear(){}init(){const t=this.container,e=t.actualOptions.interactivity?.modes.repulse;e&&(this._maxDistance=e.distance,t.retina.repulseModeDistance=e.distance*t.retina.pixelRatio)}interact(t){const n=this.container.actualOptions,i=t.status===e.mouseMoveEvent,a=n.interactivity?.events;if(!a)return;const l=a.onHover,c=l.enable,o=l.mode,_=a.onClick,p=_.enable,u=_.mode,d=a.onDiv;i&&c&&s.isInArray(r,o)?this._hoverRepulse(t):p&&s.isInArray(r,u)?this._clickRepulse(t):e.divModeExecute(r,d,(e,s)=>{this._singleSelectorRepulse(t,e,s)})}isEnabled(t,n){const i=this.container.actualOptions,a=t.mouse,l=(n?.interactivity??i.interactivity)?.events;if(!l)return!1;const c=l.onDiv,o=l.onHover,_=l.onClick,p=e.isDivModeEnabled(r,c);if(!(p||o.enable&&a.position||_.enable&&a.clickPosition))return!1;const u=o.mode,d=_.mode;return s.isInArray(r,u)||s.isInArray(r,d)||p}loadModeOptions(t,...e){t.repulse??=new a;for(const s of e)t.repulse.load(s?.repulse)}reset(){}_clickRepulse=t=>{const e=this.container,n=e.actualOptions.interactivity?.modes.repulse;if(!n)return;const i=e.repulse??{particles:[]};if(i.finish||(i.count??=0,i.count++,i.count===e.particles.count&&(i.finish=!0)),i.clicking){const a=e.retina.repulseModeDistance;if(!a||a<0)return;const r=Math.pow(a/6,3),l=t.mouse.clickPosition;if(void 0===l)return;const c=new s.Circle(l.x,l.y,r),o=e.particles.grid.query(c,e=>this.isEnabled(t,e));for(const t of o){const{dx:e,dy:a,distance:c}=s.getDistances(l,t.position),o=c**2,_=-r*n.speed/o;o<=r&&(i.particles.push(t),this._clickVec.x=e,this._clickVec.y=a,this._clickVec.length=_,t.velocity.setTo(this._clickVec))}}else if(!1===i.clicking){for(const t of i.particles)t.velocity.setTo(t.initialVelocity);i.particles=[]}};_hoverRepulse=t=>{const e=this.container,n=t.mouse.position,i=e.retina.repulseModeDistance;!i||i<0||!n||this._processRepulse(t,n,i,new s.Circle(n.x,n.y,i))};_processRepulse=(t,e,n,i,a)=>{const r=this.container,l=r.particles.grid.query(i,e=>this.isEnabled(t,e)),c=r.actualOptions.interactivity?.modes.repulse;if(!c)return;const{easing:o,speed:_,factor:p,maxSpeed:u}=c,d=this._pluginManager.getEasing(o),h=(a?.speed??_)*p;for(const t of l){const{dx:i,dy:a,distance:r}=s.getDistances(t.position,e),l=s.clamp(d(1-r/n)*h,0,u);this._normVec.x=r?i/r*l:h,this._normVec.y=r?a/r*l:h,t.position.addTo(this._normVec)}};_singleSelectorRepulse=(t,n,i)=>{const a=this.container,r=a.actualOptions.interactivity?.modes.repulse;if(!r)return;const l=s.safeDocument().querySelectorAll(n);l.length&&l.forEach(n=>{const l=n,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=i.type===e.DivType.circle?new s.Circle(o.x,o.y,_):new s.Rectangle(l.offsetLeft*c,l.offsetTop*c,l.offsetWidth*c,l.offsetHeight*c),u=r.divs,d=e.divMode(u,l);this._processRepulse(t,o,_,p,d)})}}async function c(t){t.checkVersion("4.0.0-beta.15"),await t.pluginManager.register(t=>{e.ensureInteractivityPluginLoaded(t);const s=t.pluginManager;s.addInteractor?.("externalRepulse",t=>Promise.resolve(new l(s,t)))})}const o=globalThis;o.__tsParticlesInternals=o.__tsParticlesInternals??{},o.loadExternalRepulseInteraction=c,t.Repulse=a,t.RepulseBase=n,t.RepulseDiv=i,t.loadExternalRepulseInteraction=c}),Object.assign(globalThis.window||globalThis,{loadExternalRepulseInteraction:(globalThis.__tsParticlesInternals.interactions.externalRepulse||{}).loadExternalRepulseInteraction}),delete(globalThis.window||globalThis).tsparticlesInternalExports;
1
+ !function(t){t.__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.bundles=t.__tsParticlesInternals.bundles||{},t.__tsParticlesInternals.effects=t.__tsParticlesInternals.effects||{},t.__tsParticlesInternals.engine=t.__tsParticlesInternals.engine||{},t.__tsParticlesInternals.interactions=t.__tsParticlesInternals.interactions||{},t.__tsParticlesInternals.palettes=t.__tsParticlesInternals.palettes||{},t.__tsParticlesInternals.paths=t.__tsParticlesInternals.paths||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins.emittersShapes=t.__tsParticlesInternals.plugins.emittersShapes||{},t.__tsParticlesInternals.presets=t.__tsParticlesInternals.presets||{},t.__tsParticlesInternals.shapes=t.__tsParticlesInternals.shapes||{},t.__tsParticlesInternals.updaters=t.__tsParticlesInternals.updaters||{},t.__tsParticlesInternals.utils=t.__tsParticlesInternals.utils||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas.utils=t.__tsParticlesInternals.canvas.utils||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path.utils=t.__tsParticlesInternals.path.utils||{};var e="undefined"!=typeof Proxy?function(t){return new Proxy(t,{get:function(t,e){return e in t||(t[e]={}),t[e]}})}:function(t){return t};t.__tsParticlesInternals.bundles=e(t.__tsParticlesInternals.bundles),t.__tsParticlesInternals.effects=e(t.__tsParticlesInternals.effects),t.__tsParticlesInternals.interactions=e(t.__tsParticlesInternals.interactions),t.__tsParticlesInternals.palettes=e(t.__tsParticlesInternals.palettes),t.__tsParticlesInternals.paths=e(t.__tsParticlesInternals.paths),t.__tsParticlesInternals.plugins=e(t.__tsParticlesInternals.plugins),t.__tsParticlesInternals.plugins.emittersShapes=e(t.__tsParticlesInternals.plugins.emittersShapes),t.__tsParticlesInternals.presets=e(t.__tsParticlesInternals.presets),t.__tsParticlesInternals.shapes=e(t.__tsParticlesInternals.shapes),t.__tsParticlesInternals.updaters=e(t.__tsParticlesInternals.updaters),t.__tsParticlesInternals.utils=e(t.__tsParticlesInternals.utils),t.__tsParticlesInternals.canvas=e(t.__tsParticlesInternals.canvas),t.__tsParticlesInternals.path=e(t.__tsParticlesInternals.path),t.tsparticlesInternalExports=t.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@tsparticles/plugin-interactivity"),require("@tsparticles/engine")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/plugin-interactivity","@tsparticles/engine"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.interactions=t.__tsParticlesInternals.interactions||{},t.__tsParticlesInternals.interactions.externalRepulse=t.__tsParticlesInternals.interactions.externalRepulse||{}),t.__tsParticlesInternals.plugins.interactivity,t.__tsParticlesInternals.engine)}(this,function(t,e,s){"use strict";class n{distance;duration;easing;factor;maxSpeed;speed;constructor(){this.distance=200,this.duration=.4,this.factor=100,this.speed=1,this.maxSpeed=50,this.easing=s.EasingType.easeOutQuad}load(t){s.isNull(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.speed&&(this.speed=t.speed),void 0!==t.maxSpeed&&(this.maxSpeed=t.maxSpeed))}}class i extends n{selectors;constructor(){super(),this.selectors=[]}load(t){super.load(t),s.isNull(t)||void 0!==t.selectors&&(this.selectors=t.selectors)}}class a extends n{divs;load(t){super.load(t),s.isNull(t)||(this.divs=s.executeOnSingleOrMultiple(t.divs,t=>{const e=new i;return e.load(t),e}))}}const r="repulse";class l extends e.ExternalInteractorBase{handleClickMode;_clickVec;_maxDistance;_normVec;_pluginManager;constructor(t,e){super(e),this._pluginManager=t,this._maxDistance=0,this._normVec=s.Vector.origin,this._clickVec=s.Vector.origin,e.repulse??={particles:[]},this.handleClickMode=(t,n)=>{const i=this.container.actualOptions,a=i.interactivity?.modes.repulse;if(!a||t!==r)return;e.repulse??={particles:[]};const l=e.repulse;l.clicking=!0,l.count=0;for(const t of e.repulse.particles)this.isEnabled(n,t)&&t.velocity.setTo(t.initialVelocity);l.particles=[],l.finish=!1,setTimeout(()=>{e.destroyed||(l.clicking=!1)},a.duration*s.millisecondsToSeconds)}}get maxDistance(){return this._maxDistance}clear(){}init(){const t=this.container,e=t.actualOptions.interactivity?.modes.repulse;e&&(this._maxDistance=e.distance,t.retina.repulseModeDistance=e.distance*t.retina.pixelRatio)}interact(t){const n=this.container.actualOptions,i=t.status===e.mouseMoveEvent,a=n.interactivity?.events;if(!a)return;const l=a.onHover,c=l.enable,o=l.mode,_=a.onClick,p=_.enable,u=_.mode,d=a.onDiv;i&&c&&s.isInArray(r,o)?this._hoverRepulse(t):p&&s.isInArray(r,u)?this._clickRepulse(t):e.divModeExecute(r,d,(e,s)=>{this._singleSelectorRepulse(t,e,s)})}isEnabled(t,n){const i=this.container.actualOptions,a=t.mouse,l=(n?.interactivity??i.interactivity)?.events;if(!l)return!1;const c=l.onDiv,o=l.onHover,_=l.onClick,p=e.isDivModeEnabled(r,c);if(!(p||o.enable&&a.position||_.enable&&a.clickPosition))return!1;const u=o.mode,d=_.mode;return s.isInArray(r,u)||s.isInArray(r,d)||p}loadModeOptions(t,...e){t.repulse??=new a;for(const s of e)t.repulse.load(s?.repulse)}reset(){}_clickRepulse=t=>{const e=this.container,n=e.actualOptions.interactivity?.modes.repulse;if(!n)return;const i=e.repulse??{particles:[]};if(i.finish||(i.count??=0,i.count++,i.count===e.particles.count&&(i.finish=!0)),i.clicking){const a=e.retina.repulseModeDistance;if(!a||a<0)return;const r=Math.pow(a/6,3),l=t.mouse.clickPosition;if(void 0===l)return;const c=new s.Circle(l.x,l.y,r),o=e.particles.grid.query(c,e=>this.isEnabled(t,e));for(const t of o){const{dx:e,dy:a,distance:c}=s.getDistances(l,t.position),o=c**2,_=-r*n.speed/o;o<=r&&(i.particles.push(t),this._clickVec.x=e,this._clickVec.y=a,this._clickVec.length=_,t.velocity.setTo(this._clickVec))}}else if(!1===i.clicking){for(const t of i.particles)t.velocity.setTo(t.initialVelocity);i.particles=[]}};_hoverRepulse=t=>{const e=this.container,n=t.mouse.position,i=e.retina.repulseModeDistance;!i||i<0||!n||this._processRepulse(t,n,i,new s.Circle(n.x,n.y,i))};_processRepulse=(t,e,n,i,a)=>{const r=this.container,l=r.particles.grid.query(i,e=>this.isEnabled(t,e)),c=r.actualOptions.interactivity?.modes.repulse;if(!c)return;const{easing:o,speed:_,factor:p,maxSpeed:u}=c,d=this._pluginManager.getEasing(o),h=(a?.speed??_)*p;for(const t of l){const{dx:i,dy:a,distance:r}=s.getDistances(t.position,e),l=s.clamp(d(1-r/n)*h,0,u);this._normVec.x=r?i/r*l:h,this._normVec.y=r?a/r*l:h,t.position.addTo(this._normVec)}};_singleSelectorRepulse=(t,n,i)=>{const a=this.container,r=a.actualOptions.interactivity?.modes.repulse;if(!r)return;const l=s.safeDocument().querySelectorAll(n);l.length&&l.forEach(n=>{const l=n,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=i.type===e.DivType.circle?new s.Circle(o.x,o.y,_):new s.Rectangle(l.offsetLeft*c,l.offsetTop*c,l.offsetWidth*c,l.offsetHeight*c),u=r.divs,d=e.divMode(u,l);this._processRepulse(t,o,_,p,d)})}}async function c(t){t.checkVersion("4.0.0-beta.16"),await t.pluginManager.register(t=>{e.ensureInteractivityPluginLoaded(t);const s=t.pluginManager;s.addInteractor?.("externalRepulse",t=>Promise.resolve(new l(s,t)))})}const o=globalThis;o.__tsParticlesInternals=o.__tsParticlesInternals??{},o.loadExternalRepulseInteraction=c,t.Repulse=a,t.RepulseBase=n,t.RepulseDiv=i,t.loadExternalRepulseInteraction=c}),Object.assign(globalThis.window||globalThis,{loadExternalRepulseInteraction:(globalThis.__tsParticlesInternals.interactions.externalRepulse||{}).loadExternalRepulseInteraction}),delete(globalThis.window||globalThis).tsparticlesInternalExports;