@tsparticles/interaction-particles-collisions 4.0.5 → 4.1.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.
@@ -1,14 +1,14 @@
1
1
  import { getDistance } from "@tsparticles/engine";
2
2
  const minRetries = 0;
3
3
  export class OverlapPluginInstance {
4
- _container;
4
+ #container;
5
5
  constructor(container) {
6
- this._container = container;
6
+ this.#container = container;
7
7
  }
8
8
  checkParticlePosition(particle, position, tryCount) {
9
- return !this._hasOverlaps(particle, position, tryCount);
9
+ return !this.#hasOverlaps(particle, position, tryCount);
10
10
  }
11
- _hasOverlaps = (particle, pos, tryCount) => {
11
+ #hasOverlaps = (particle, pos, tryCount) => {
12
12
  const collisionsOptions = particle.options.collisions;
13
13
  if (!collisionsOptions?.enable) {
14
14
  return false;
@@ -21,6 +21,6 @@ export class OverlapPluginInstance {
21
21
  if (retries >= minRetries && tryCount > retries) {
22
22
  throw new Error(`Particle is overlapping and can't be placed`);
23
23
  }
24
- return !!this._container.particles.find(p => getDistance(pos, p.position) < particle.getRadius() + p.getRadius());
24
+ return !!this.#container.particles.find(p => getDistance(pos, p.position) < particle.getRadius() + p.getRadius());
25
25
  };
26
26
  }
package/browser/index.js CHANGED
@@ -2,7 +2,7 @@ import { ensureInteractivityPluginLoaded } from "@tsparticles/plugin-interactivi
2
2
  import { Collider } from "./Collider.js";
3
3
  import { OverlapPlugin } from "./OverlapPlugin.js";
4
4
  export async function loadParticlesCollisionsInteraction(engine) {
5
- engine.checkVersion("4.0.5");
5
+ engine.checkVersion("4.1.1");
6
6
  await engine.pluginManager.register((e) => {
7
7
  ensureInteractivityPluginLoaded(e);
8
8
  e.pluginManager.addPlugin(new OverlapPlugin());
@@ -1,5 +1,5 @@
1
1
  export async function loadParticlesCollisionsInteraction(engine) {
2
- engine.checkVersion("4.0.5");
2
+ engine.checkVersion("4.1.1");
3
3
  await engine.pluginManager.register(async (e) => {
4
4
  const [{ ensureInteractivityPluginLoaded }, { OverlapPlugin },] = await Promise.all([
5
5
  import("@tsparticles/plugin-interactivity/lazy"),
@@ -1,14 +1,14 @@
1
1
  import { getDistance } from "@tsparticles/engine";
2
2
  const minRetries = 0;
3
3
  export class OverlapPluginInstance {
4
- _container;
4
+ #container;
5
5
  constructor(container) {
6
- this._container = container;
6
+ this.#container = container;
7
7
  }
8
8
  checkParticlePosition(particle, position, tryCount) {
9
- return !this._hasOverlaps(particle, position, tryCount);
9
+ return !this.#hasOverlaps(particle, position, tryCount);
10
10
  }
11
- _hasOverlaps = (particle, pos, tryCount) => {
11
+ #hasOverlaps = (particle, pos, tryCount) => {
12
12
  const collisionsOptions = particle.options.collisions;
13
13
  if (!collisionsOptions?.enable) {
14
14
  return false;
@@ -21,6 +21,6 @@ export class OverlapPluginInstance {
21
21
  if (retries >= minRetries && tryCount > retries) {
22
22
  throw new Error(`Particle is overlapping and can't be placed`);
23
23
  }
24
- return !!this._container.particles.find(p => getDistance(pos, p.position) < particle.getRadius() + p.getRadius());
24
+ return !!this.#container.particles.find(p => getDistance(pos, p.position) < particle.getRadius() + p.getRadius());
25
25
  };
26
26
  }
package/cjs/index.js CHANGED
@@ -2,7 +2,7 @@ import { ensureInteractivityPluginLoaded } from "@tsparticles/plugin-interactivi
2
2
  import { Collider } from "./Collider.js";
3
3
  import { OverlapPlugin } from "./OverlapPlugin.js";
4
4
  export async function loadParticlesCollisionsInteraction(engine) {
5
- engine.checkVersion("4.0.5");
5
+ engine.checkVersion("4.1.1");
6
6
  await engine.pluginManager.register((e) => {
7
7
  ensureInteractivityPluginLoaded(e);
8
8
  e.pluginManager.addPlugin(new OverlapPlugin());
package/cjs/index.lazy.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export async function loadParticlesCollisionsInteraction(engine) {
2
- engine.checkVersion("4.0.5");
2
+ engine.checkVersion("4.1.1");
3
3
  await engine.pluginManager.register(async (e) => {
4
4
  const [{ ensureInteractivityPluginLoaded }, { OverlapPlugin },] = await Promise.all([
5
5
  import("@tsparticles/plugin-interactivity/lazy"),
@@ -1,14 +1,14 @@
1
1
  import { getDistance } from "@tsparticles/engine";
2
2
  const minRetries = 0;
3
3
  export class OverlapPluginInstance {
4
- _container;
4
+ #container;
5
5
  constructor(container) {
6
- this._container = container;
6
+ this.#container = container;
7
7
  }
8
8
  checkParticlePosition(particle, position, tryCount) {
9
- return !this._hasOverlaps(particle, position, tryCount);
9
+ return !this.#hasOverlaps(particle, position, tryCount);
10
10
  }
11
- _hasOverlaps = (particle, pos, tryCount) => {
11
+ #hasOverlaps = (particle, pos, tryCount) => {
12
12
  const collisionsOptions = particle.options.collisions;
13
13
  if (!collisionsOptions?.enable) {
14
14
  return false;
@@ -21,6 +21,6 @@ export class OverlapPluginInstance {
21
21
  if (retries >= minRetries && tryCount > retries) {
22
22
  throw new Error(`Particle is overlapping and can't be placed`);
23
23
  }
24
- return !!this._container.particles.find(p => getDistance(pos, p.position) < particle.getRadius() + p.getRadius());
24
+ return !!this.#container.particles.find(p => getDistance(pos, p.position) < particle.getRadius() + p.getRadius());
25
25
  };
26
26
  }
package/esm/index.js CHANGED
@@ -2,7 +2,7 @@ import { ensureInteractivityPluginLoaded } from "@tsparticles/plugin-interactivi
2
2
  import { Collider } from "./Collider.js";
3
3
  import { OverlapPlugin } from "./OverlapPlugin.js";
4
4
  export async function loadParticlesCollisionsInteraction(engine) {
5
- engine.checkVersion("4.0.5");
5
+ engine.checkVersion("4.1.1");
6
6
  await engine.pluginManager.register((e) => {
7
7
  ensureInteractivityPluginLoaded(e);
8
8
  e.pluginManager.addPlugin(new OverlapPlugin());
package/esm/index.lazy.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export async function loadParticlesCollisionsInteraction(engine) {
2
- engine.checkVersion("4.0.5");
2
+ engine.checkVersion("4.1.1");
3
3
  await engine.pluginManager.register(async (e) => {
4
4
  const [{ ensureInteractivityPluginLoaded }, { OverlapPlugin },] = await Promise.all([
5
5
  import("@tsparticles/plugin-interactivity/lazy"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/interaction-particles-collisions",
3
- "version": "4.0.5",
3
+ "version": "4.1.1",
4
4
  "description": "tsParticles collisions particles interaction",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -97,7 +97,7 @@
97
97
  },
98
98
  "type": "module",
99
99
  "peerDependencies": {
100
- "@tsparticles/engine": "4.0.5",
101
- "@tsparticles/plugin-interactivity": "4.0.5"
100
+ "@tsparticles/engine": "4.1.1",
101
+ "@tsparticles/plugin-interactivity": "4.1.1"
102
102
  }
103
103
  }
@@ -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
- /* Particles Interaction v4.0.5 */
2
+ /* Particles Interaction v4.1.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) :
@@ -237,7 +237,7 @@
237
237
  }
238
238
 
239
239
  async function loadParticlesCollisionsInteraction(engine) {
240
- engine.checkVersion("4.0.5");
240
+ engine.checkVersion("4.1.1");
241
241
  await engine.pluginManager.register((e) => {
242
242
  pluginInteractivity.ensureInteractivityPluginLoaded(e);
243
243
  e.pluginManager.addPlugin(new OverlapPlugin());
@@ -253,14 +253,14 @@
253
253
 
254
254
  const minRetries = 0;
255
255
  class OverlapPluginInstance {
256
- _container;
256
+ #container;
257
257
  constructor(container) {
258
- this._container = container;
258
+ this.#container = container;
259
259
  }
260
260
  checkParticlePosition(particle, position, tryCount) {
261
- return !this._hasOverlaps(particle, position, tryCount);
261
+ return !this.#hasOverlaps(particle, position, tryCount);
262
262
  }
263
- _hasOverlaps = (particle, pos, tryCount) => {
263
+ #hasOverlaps = (particle, pos, tryCount) => {
264
264
  const collisionsOptions = particle.options.collisions;
265
265
  if (!collisionsOptions?.enable) {
266
266
  return false;
@@ -273,7 +273,7 @@
273
273
  if (retries >= minRetries && tryCount > retries) {
274
274
  throw new Error(`Particle is overlapping and can't be placed`);
275
275
  }
276
- return !!this._container.particles.find(p => engine.getDistance(pos, p.position) < particle.getRadius() + p.getRadius());
276
+ return !!this.#container.particles.find(p => engine.getDistance(pos, p.position) < particle.getRadius() + p.getRadius());
277
277
  };
278
278
  }
279
279
 
@@ -1 +1 @@
1
- !function(s){s.__tsParticlesInternals=s.__tsParticlesInternals||{},s.__tsParticlesInternals.bundles=s.__tsParticlesInternals.bundles||{},s.__tsParticlesInternals.effects=s.__tsParticlesInternals.effects||{},s.__tsParticlesInternals.engine=s.__tsParticlesInternals.engine||{},s.__tsParticlesInternals.interactions=s.__tsParticlesInternals.interactions||{},s.__tsParticlesInternals.palettes=s.__tsParticlesInternals.palettes||{},s.__tsParticlesInternals.paths=s.__tsParticlesInternals.paths||{},s.__tsParticlesInternals.plugins=s.__tsParticlesInternals.plugins||{},s.__tsParticlesInternals.plugins=s.__tsParticlesInternals.plugins||{},s.__tsParticlesInternals.plugins.emittersShapes=s.__tsParticlesInternals.plugins.emittersShapes||{},s.__tsParticlesInternals.presets=s.__tsParticlesInternals.presets||{},s.__tsParticlesInternals.shapes=s.__tsParticlesInternals.shapes||{},s.__tsParticlesInternals.updaters=s.__tsParticlesInternals.updaters||{},s.__tsParticlesInternals.utils=s.__tsParticlesInternals.utils||{},s.__tsParticlesInternals.canvas=s.__tsParticlesInternals.canvas||{},s.__tsParticlesInternals.canvas=s.__tsParticlesInternals.canvas||{},s.__tsParticlesInternals.canvas.utils=s.__tsParticlesInternals.canvas.utils||{},s.__tsParticlesInternals.path=s.__tsParticlesInternals.path||{},s.__tsParticlesInternals.path=s.__tsParticlesInternals.path||{},s.__tsParticlesInternals.path.utils=s.__tsParticlesInternals.path.utils||{};var t="undefined"!=typeof Proxy?function(s){return new Proxy(s,{get:function(s,t){return t in s||(s[t]={}),s[t]}})}:function(s){return s};s.__tsParticlesInternals.bundles=t(s.__tsParticlesInternals.bundles),s.__tsParticlesInternals.effects=t(s.__tsParticlesInternals.effects),s.__tsParticlesInternals.interactions=t(s.__tsParticlesInternals.interactions),s.__tsParticlesInternals.palettes=t(s.__tsParticlesInternals.palettes),s.__tsParticlesInternals.paths=t(s.__tsParticlesInternals.paths),s.__tsParticlesInternals.plugins=t(s.__tsParticlesInternals.plugins),s.__tsParticlesInternals.plugins.emittersShapes=t(s.__tsParticlesInternals.plugins.emittersShapes),s.__tsParticlesInternals.presets=t(s.__tsParticlesInternals.presets),s.__tsParticlesInternals.shapes=t(s.__tsParticlesInternals.shapes),s.__tsParticlesInternals.updaters=t(s.__tsParticlesInternals.updaters),s.__tsParticlesInternals.utils=t(s.__tsParticlesInternals.utils),s.__tsParticlesInternals.canvas=t(s.__tsParticlesInternals.canvas),s.__tsParticlesInternals.path=t(s.__tsParticlesInternals.path),s.tsparticlesInternalExports=s.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(s,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(((s="undefined"!=typeof globalThis?globalThis:s||self).__tsParticlesInternals=s.__tsParticlesInternals||{},s.__tsParticlesInternals.interactions=s.__tsParticlesInternals.interactions||{},s.__tsParticlesInternals.interactions.particlesCollisions=s.__tsParticlesInternals.interactions.particlesCollisions||{}),s.__tsParticlesInternals.plugins.interactivity,s.__tsParticlesInternals.engine)}(this,function(s,t,e){"use strict";var n;!function(s){s.absorb="absorb",s.bounce="bounce",s.destroy="destroy"}(n||(n={}));class a{speed;constructor(){this.speed=2}load(s){e.isNull(s)||void 0!==s.speed&&(this.speed=s.speed)}}class i{enable;retries;constructor(){this.enable=!0,this.retries=0}load(s){e.isNull(s)||(void 0!==s.enable&&(this.enable=s.enable),void 0!==s.retries&&(this.retries=s.retries))}}class l{absorb;bounce;enable;maxSpeed;mode;overlap;constructor(){this.absorb=new a,this.bounce=new e.ParticlesBounce,this.enable=!1,this.maxSpeed=50,this.mode=n.bounce,this.overlap=new i}load(s){e.isNull(s)||(this.absorb.load(s.absorb),this.bounce.load(s.bounce),void 0!==s.enable&&(this.enable=s.enable),void 0!==s.maxSpeed&&(this.maxSpeed=e.setRangeValue(s.maxSpeed)),void 0!==s.mode&&(this.mode=s.mode),this.overlap.load(s.overlap))}}function r(s,t,n,a,i,l){if(!s.options.collisions||!n.options.collisions)return;const r=s.options.collisions.absorb.speed,o=e.clamp(r*i.factor,0,a);s.size.value=Math.sqrt(t*t+o*o),n.size.value-=o,n.size.value<=l&&(n.size.value=0,n.destroy())}const o=s=>{s.options.collisions&&(s.collisionMaxSpeed??=e.getRangeValue(s.options.collisions.maxSpeed),s.velocity.length>s.collisionMaxSpeed&&(s.velocity.length=s.collisionMaxSpeed))};function c(s,t){const n=s.getMass(),a=t.getMass(),i=s.velocity.length,l=t.velocity.length,r=n*i*i+a*l*l;e.circleBounce(e.circleBounceDataFromParticle(s),e.circleBounceDataFromParticle(t));const c=s.velocity.length,_=t.velocity.length,p=n*c*c+a*_*_;if(p>1e-6*r){const e=Math.sqrt(r/p);Math.abs(e-1)>1e-4&&(s.velocity.length=c*e,t.velocity.length=_*e)}o(s),o(t)}function _(s,t,e,a){if(s.options.collisions&&t.options.collisions)switch(s.options.collisions.mode){case n.absorb:!function(s,t,e,n){const a=s.getRadius(),i=t.getRadius();!a&&i?s.destroy():a&&!i?t.destroy():a&&i&&(a>=i?r(s,a,t,i,e,n):r(t,i,s,a,e,n))}(s,t,e,a);break;case n.bounce:c(s,t);break;case n.destroy:!function(s,t){s.unbreakable||t.unbreakable||c(s,t);const e=s.getRadius(),n=t.getRadius();!e&&n?s.destroy():e&&!n?t.destroy():e&&n&&(s.getRadius()>=t.getRadius()?t:s).destroy()}(s,t)}}class p extends t.ParticlesInteractorBase{maxDistance;constructor(s){super(s),this.maxDistance=0}clear(){}init(){}interact(s,t,n){if(s.destroyed||s.spawning)return;const a=this.container,i=s.getPosition(),l=s.getRadius(),r=a.particles.grid.queryCircle(i,l*e.double);for(const t of r){if(s===t||s.id>=t.id||!s.options.collisions?.enable||!t.options.collisions?.enable||s.options.collisions.mode!==t.options.collisions.mode||t.destroyed||t.spawning)continue;const r=t.getPosition(),o=t.getRadius();if(Math.abs(Math.round(i.z)-Math.round(r.z))>l+o)continue;e.getDistance(i,r)>l+o||_(s,t,n,a.retina.pixelRatio)}}isEnabled(s){return!!s.options.collisions?.enable}loadParticlesOptions(s,...t){s.collisions??=new l;for(const e of t)s.collisions.load(e?.collisions)}reset(){}}class u{id="overlap";async getPlugin(s){const{OverlapPluginInstance:t}=await Promise.resolve().then(function(){return I});return new t(s)}loadOptions(){}needsPlugin(){return!0}}async function d(s){s.checkVersion("4.0.5"),await s.pluginManager.register(s=>{t.ensureInteractivityPluginLoaded(s),s.pluginManager.addPlugin(new u),s.pluginManager.addInteractor?.("particlesCollisions",s=>Promise.resolve(new p(s)))})}const P=globalThis;P.__tsParticlesInternals=P.__tsParticlesInternals??{},P.loadParticlesCollisionsInteraction=d;var I=Object.freeze({__proto__:null,OverlapPluginInstance:class{_container;constructor(s){this._container=s}checkParticlePosition(s,t,e){return!this._hasOverlaps(s,t,e)}_hasOverlaps=(s,t,n)=>{const a=s.options.collisions;if(!a?.enable)return!1;const i=a.overlap;if(i.enable)return!1;const l=i.retries;if(l>=0&&n>l)throw new Error("Particle is overlapping and can't be placed");return!!this._container.particles.find(n=>e.getDistance(t,n.position)<s.getRadius()+n.getRadius())}}});s.loadParticlesCollisionsInteraction=d}),Object.assign(globalThis.window||globalThis,{loadParticlesCollisionsInteraction:(globalThis.__tsParticlesInternals.interactions.particlesCollisions||{}).loadParticlesCollisionsInteraction}),delete(globalThis.window||globalThis).tsparticlesInternalExports;
1
+ !function(s){s.__tsParticlesInternals=s.__tsParticlesInternals||{},s.__tsParticlesInternals.bundles=s.__tsParticlesInternals.bundles||{},s.__tsParticlesInternals.effects=s.__tsParticlesInternals.effects||{},s.__tsParticlesInternals.engine=s.__tsParticlesInternals.engine||{},s.__tsParticlesInternals.interactions=s.__tsParticlesInternals.interactions||{},s.__tsParticlesInternals.palettes=s.__tsParticlesInternals.palettes||{},s.__tsParticlesInternals.paths=s.__tsParticlesInternals.paths||{},s.__tsParticlesInternals.plugins=s.__tsParticlesInternals.plugins||{},s.__tsParticlesInternals.plugins=s.__tsParticlesInternals.plugins||{},s.__tsParticlesInternals.plugins.emittersShapes=s.__tsParticlesInternals.plugins.emittersShapes||{},s.__tsParticlesInternals.presets=s.__tsParticlesInternals.presets||{},s.__tsParticlesInternals.shapes=s.__tsParticlesInternals.shapes||{},s.__tsParticlesInternals.updaters=s.__tsParticlesInternals.updaters||{},s.__tsParticlesInternals.utils=s.__tsParticlesInternals.utils||{},s.__tsParticlesInternals.canvas=s.__tsParticlesInternals.canvas||{},s.__tsParticlesInternals.canvas=s.__tsParticlesInternals.canvas||{},s.__tsParticlesInternals.canvas.utils=s.__tsParticlesInternals.canvas.utils||{},s.__tsParticlesInternals.path=s.__tsParticlesInternals.path||{},s.__tsParticlesInternals.path=s.__tsParticlesInternals.path||{},s.__tsParticlesInternals.path.utils=s.__tsParticlesInternals.path.utils||{};var t="undefined"!=typeof Proxy?function(s){return new Proxy(s,{get:function(s,t){return t in s||(s[t]={}),s[t]}})}:function(s){return s};s.__tsParticlesInternals.bundles=t(s.__tsParticlesInternals.bundles),s.__tsParticlesInternals.effects=t(s.__tsParticlesInternals.effects),s.__tsParticlesInternals.interactions=t(s.__tsParticlesInternals.interactions),s.__tsParticlesInternals.palettes=t(s.__tsParticlesInternals.palettes),s.__tsParticlesInternals.paths=t(s.__tsParticlesInternals.paths),s.__tsParticlesInternals.plugins=t(s.__tsParticlesInternals.plugins),s.__tsParticlesInternals.plugins.emittersShapes=t(s.__tsParticlesInternals.plugins.emittersShapes),s.__tsParticlesInternals.presets=t(s.__tsParticlesInternals.presets),s.__tsParticlesInternals.shapes=t(s.__tsParticlesInternals.shapes),s.__tsParticlesInternals.updaters=t(s.__tsParticlesInternals.updaters),s.__tsParticlesInternals.utils=t(s.__tsParticlesInternals.utils),s.__tsParticlesInternals.canvas=t(s.__tsParticlesInternals.canvas),s.__tsParticlesInternals.path=t(s.__tsParticlesInternals.path),s.tsparticlesInternalExports=s.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(s,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(((s="undefined"!=typeof globalThis?globalThis:s||self).__tsParticlesInternals=s.__tsParticlesInternals||{},s.__tsParticlesInternals.interactions=s.__tsParticlesInternals.interactions||{},s.__tsParticlesInternals.interactions.particlesCollisions=s.__tsParticlesInternals.interactions.particlesCollisions||{}),s.__tsParticlesInternals.plugins.interactivity,s.__tsParticlesInternals.engine)}(this,function(s,t,e){"use strict";var n;!function(s){s.absorb="absorb",s.bounce="bounce",s.destroy="destroy"}(n||(n={}));class a{speed;constructor(){this.speed=2}load(s){e.isNull(s)||void 0!==s.speed&&(this.speed=s.speed)}}class i{enable;retries;constructor(){this.enable=!0,this.retries=0}load(s){e.isNull(s)||(void 0!==s.enable&&(this.enable=s.enable),void 0!==s.retries&&(this.retries=s.retries))}}class l{absorb;bounce;enable;maxSpeed;mode;overlap;constructor(){this.absorb=new a,this.bounce=new e.ParticlesBounce,this.enable=!1,this.maxSpeed=50,this.mode=n.bounce,this.overlap=new i}load(s){e.isNull(s)||(this.absorb.load(s.absorb),this.bounce.load(s.bounce),void 0!==s.enable&&(this.enable=s.enable),void 0!==s.maxSpeed&&(this.maxSpeed=e.setRangeValue(s.maxSpeed)),void 0!==s.mode&&(this.mode=s.mode),this.overlap.load(s.overlap))}}function r(s,t,n,a,i,l){if(!s.options.collisions||!n.options.collisions)return;const r=s.options.collisions.absorb.speed,o=e.clamp(r*i.factor,0,a);s.size.value=Math.sqrt(t*t+o*o),n.size.value-=o,n.size.value<=l&&(n.size.value=0,n.destroy())}const o=s=>{s.options.collisions&&(s.collisionMaxSpeed??=e.getRangeValue(s.options.collisions.maxSpeed),s.velocity.length>s.collisionMaxSpeed&&(s.velocity.length=s.collisionMaxSpeed))};function c(s,t){const n=s.getMass(),a=t.getMass(),i=s.velocity.length,l=t.velocity.length,r=n*i*i+a*l*l;e.circleBounce(e.circleBounceDataFromParticle(s),e.circleBounceDataFromParticle(t));const c=s.velocity.length,_=t.velocity.length,p=n*c*c+a*_*_;if(p>1e-6*r){const e=Math.sqrt(r/p);Math.abs(e-1)>1e-4&&(s.velocity.length=c*e,t.velocity.length=_*e)}o(s),o(t)}function _(s,t,e,a){if(s.options.collisions&&t.options.collisions)switch(s.options.collisions.mode){case n.absorb:!function(s,t,e,n){const a=s.getRadius(),i=t.getRadius();!a&&i?s.destroy():a&&!i?t.destroy():a&&i&&(a>=i?r(s,a,t,i,e,n):r(t,i,s,a,e,n))}(s,t,e,a);break;case n.bounce:c(s,t);break;case n.destroy:!function(s,t){s.unbreakable||t.unbreakable||c(s,t);const e=s.getRadius(),n=t.getRadius();!e&&n?s.destroy():e&&!n?t.destroy():e&&n&&(s.getRadius()>=t.getRadius()?t:s).destroy()}(s,t)}}class p extends t.ParticlesInteractorBase{maxDistance;constructor(s){super(s),this.maxDistance=0}clear(){}init(){}interact(s,t,n){if(s.destroyed||s.spawning)return;const a=this.container,i=s.getPosition(),l=s.getRadius(),r=a.particles.grid.queryCircle(i,l*e.double);for(const t of r){if(s===t||s.id>=t.id||!s.options.collisions?.enable||!t.options.collisions?.enable||s.options.collisions.mode!==t.options.collisions.mode||t.destroyed||t.spawning)continue;const r=t.getPosition(),o=t.getRadius();if(Math.abs(Math.round(i.z)-Math.round(r.z))>l+o)continue;e.getDistance(i,r)>l+o||_(s,t,n,a.retina.pixelRatio)}}isEnabled(s){return!!s.options.collisions?.enable}loadParticlesOptions(s,...t){s.collisions??=new l;for(const e of t)s.collisions.load(e?.collisions)}reset(){}}class u{id="overlap";async getPlugin(s){const{OverlapPluginInstance:t}=await Promise.resolve().then(function(){return I});return new t(s)}loadOptions(){}needsPlugin(){return!0}}async function d(s){s.checkVersion("4.1.1"),await s.pluginManager.register(s=>{t.ensureInteractivityPluginLoaded(s),s.pluginManager.addPlugin(new u),s.pluginManager.addInteractor?.("particlesCollisions",s=>Promise.resolve(new p(s)))})}const P=globalThis;P.__tsParticlesInternals=P.__tsParticlesInternals??{},P.loadParticlesCollisionsInteraction=d;var I=Object.freeze({__proto__:null,OverlapPluginInstance:class{#s;constructor(s){this.#s=s}checkParticlePosition(s,t,e){return!this.#t(s,t,e)}#t=(s,t,n)=>{const a=s.options.collisions;if(!a?.enable)return!1;const i=a.overlap;if(i.enable)return!1;const l=i.retries;if(l>=0&&n>l)throw new Error("Particle is overlapping and can't be placed");return!!this.#s.particles.find(n=>e.getDistance(t,n.position)<s.getRadius()+n.getRadius())}}});s.loadParticlesCollisionsInteraction=d}),Object.assign(globalThis.window||globalThis,{loadParticlesCollisionsInteraction:(globalThis.__tsParticlesInternals.interactions.particlesCollisions||{}).loadParticlesCollisionsInteraction}),delete(globalThis.window||globalThis).tsparticlesInternalExports;
@@ -1,8 +1,7 @@
1
1
  import { type Container, type IContainerPlugin, type ICoordinates } from "@tsparticles/engine";
2
2
  import type { CollisionParticle } from "./Types.js";
3
3
  export declare class OverlapPluginInstance implements IContainerPlugin {
4
- private readonly _container;
4
+ #private;
5
5
  constructor(container: Container);
6
6
  checkParticlePosition(particle: CollisionParticle, position: ICoordinates, tryCount: number): boolean;
7
- private readonly _hasOverlaps;
8
7
  }