@tsparticles/preset-links 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,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
- /* Preset v4.0.5 */
2
+ /* Preset v4.1.1 */
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
5
5
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
@@ -51,13 +51,13 @@
51
51
  return Math.atan2(this.y, this.x);
52
52
  }
53
53
  set angle(angle) {
54
- this._updateFromAngle(angle, this.length);
54
+ this.#updateFromAngle(angle, this.length);
55
55
  }
56
56
  get length() {
57
57
  return Math.sqrt(this.getLengthSq());
58
58
  }
59
59
  set length(length) {
60
- this._updateFromAngle(this.angle, length);
60
+ this.#updateFromAngle(this.angle, length);
61
61
  }
62
62
  static clone(source) {
63
63
  return Vector3d.create(source.x, source.y, getZ(source));
@@ -120,7 +120,7 @@
120
120
  this.y -= v.y;
121
121
  this.z -= getZ(v);
122
122
  }
123
- _updateFromAngle(angle, length) {
123
+ #updateFromAngle(angle, length) {
124
124
  this.x = Math.cos(angle) * length;
125
125
  this.y = Math.sin(angle) * length;
126
126
  }
@@ -714,38 +714,38 @@
714
714
  }
715
715
 
716
716
  class EventDispatcher {
717
- _listeners;
717
+ #listeners;
718
718
  constructor() {
719
- this._listeners = new Map();
719
+ this.#listeners = new Map();
720
720
  }
721
721
  addEventListener(type, listener) {
722
722
  this.removeEventListener(type, listener);
723
- let arr = this._listeners.get(type);
723
+ let arr = this.#listeners.get(type);
724
724
  if (!arr) {
725
725
  arr = [];
726
- this._listeners.set(type, arr);
726
+ this.#listeners.set(type, arr);
727
727
  }
728
728
  arr.push(listener);
729
729
  }
730
730
  dispatchEvent(type, args) {
731
- const listeners = this._listeners.get(type);
731
+ const listeners = this.#listeners.get(type);
732
732
  listeners?.forEach(handler => {
733
733
  handler(args);
734
734
  });
735
735
  }
736
736
  hasEventListener(type) {
737
- return !!this._listeners.get(type);
737
+ return !!this.#listeners.get(type);
738
738
  }
739
739
  removeAllEventListeners(type) {
740
740
  if (!type) {
741
- this._listeners = new Map();
741
+ this.#listeners = new Map();
742
742
  }
743
743
  else {
744
- this._listeners.delete(type);
744
+ this.#listeners.delete(type);
745
745
  }
746
746
  }
747
747
  removeEventListener(type, listener) {
748
- const arr = this._listeners.get(type);
748
+ const arr = this.#listeners.get(type);
749
749
  if (!arr) {
750
750
  return;
751
751
  }
@@ -754,7 +754,7 @@
754
754
  return;
755
755
  }
756
756
  if (length === deleteCount) {
757
- this._listeners.delete(type);
757
+ this.#listeners.delete(type);
758
758
  }
759
759
  else {
760
760
  arr.splice(idx, deleteCount);
@@ -792,19 +792,19 @@
792
792
  presets = new Map();
793
793
  shapeDrawers = new Map();
794
794
  updaters = new Map();
795
- _allLoadersSet = new Set();
796
- _configs = new Map();
797
- _engine;
798
- _executedSet = new Set();
799
- _initialized = false;
800
- _isRunningLoaders = false;
801
- _loadPromises = new Set();
795
+ #allLoadersSet = new Set();
796
+ #configs = new Map();
797
+ #engine;
798
+ #executedSet = new Set();
799
+ #initialized = false;
800
+ #isRunningLoaders = false;
801
+ #loadPromises = new Set();
802
802
  constructor(engine) {
803
- this._engine = engine;
803
+ this.#engine = engine;
804
804
  }
805
805
  get configs() {
806
806
  const res = {};
807
- for (const [name, config] of this._configs) {
807
+ for (const [name, config] of this.#configs) {
808
808
  res[name] = config;
809
809
  }
810
810
  return res;
@@ -814,8 +814,8 @@
814
814
  }
815
815
  addConfig(config) {
816
816
  const key = config.key ?? config.name ?? "default";
817
- this._configs.set(key, config);
818
- this._engine.dispatchEvent(EventType.configAdded, { data: { name: key, config } });
817
+ this.#configs.set(key, config);
818
+ this.#engine.dispatchEvent(EventType.configAdded, { data: { name: key, config } });
819
819
  }
820
820
  addEasing(name, easing) {
821
821
  if (this.easingFunctions.get(name)) {
@@ -876,21 +876,21 @@
876
876
  return getItemsFromInitializer(container, this.updaters, this.initializers.updaters, force);
877
877
  }
878
878
  async init() {
879
- if (this._initialized || this._isRunningLoaders) {
879
+ if (this.#initialized || this.#isRunningLoaders) {
880
880
  return;
881
881
  }
882
- this._isRunningLoaders = true;
883
- this._executedSet = new Set();
884
- this._allLoadersSet = new Set(this._loadPromises);
882
+ this.#isRunningLoaders = true;
883
+ this.#executedSet = new Set();
884
+ this.#allLoadersSet = new Set(this.#loadPromises);
885
885
  try {
886
- for (const loader of this._allLoadersSet) {
887
- await this._runLoader(loader, this._executedSet, this._allLoadersSet);
886
+ for (const loader of this.#allLoadersSet) {
887
+ await this.#runLoader(loader, this.#executedSet, this.#allLoadersSet);
888
888
  }
889
889
  }
890
890
  finally {
891
- this._loadPromises.clear();
892
- this._isRunningLoaders = false;
893
- this._initialized = true;
891
+ this.#loadPromises.clear();
892
+ this.#isRunningLoaders = false;
893
+ this.#initialized = true;
894
894
  }
895
895
  }
896
896
  loadParticlesOptions(container, options, ...sourceOptions) {
@@ -901,24 +901,24 @@
901
901
  updaters.forEach(updater => updater.loadOptions?.(options, ...sourceOptions));
902
902
  }
903
903
  async register(...loaders) {
904
- if (this._initialized) {
904
+ if (this.#initialized) {
905
905
  throw new Error("Register plugins can only be done before calling tsParticles.load()");
906
906
  }
907
907
  for (const loader of loaders) {
908
- if (this._isRunningLoaders) {
909
- await this._runLoader(loader, this._executedSet, this._allLoadersSet);
908
+ if (this.#isRunningLoaders) {
909
+ await this.#runLoader(loader, this.#executedSet, this.#allLoadersSet);
910
910
  }
911
911
  else {
912
- this._loadPromises.add(loader);
912
+ this.#loadPromises.add(loader);
913
913
  }
914
914
  }
915
915
  }
916
- async _runLoader(loader, executed, allLoaders) {
916
+ async #runLoader(loader, executed, allLoaders) {
917
917
  if (executed.has(loader))
918
918
  return;
919
919
  executed.add(loader);
920
920
  allLoaders.add(loader);
921
- await loader(this._engine);
921
+ await loader(this.#engine);
922
922
  }
923
923
  }
924
924
 
@@ -998,17 +998,17 @@
998
998
  };
999
999
  class Engine {
1000
1000
  pluginManager = new PluginManager(this);
1001
- _domArray = [];
1002
- _eventDispatcher = new EventDispatcher();
1003
- _initialized = false;
1001
+ #domArray = [];
1002
+ #eventDispatcher = new EventDispatcher();
1003
+ #initialized = false;
1004
1004
  get items() {
1005
- return this._domArray;
1005
+ return this.#domArray;
1006
1006
  }
1007
1007
  get version() {
1008
- return "4.0.5";
1008
+ return "4.1.1";
1009
1009
  }
1010
1010
  addEventListener(type, listener) {
1011
- this._eventDispatcher.addEventListener(type, listener);
1011
+ this.#eventDispatcher.addEventListener(type, listener);
1012
1012
  }
1013
1013
  checkVersion(pluginVersion) {
1014
1014
  if (this.version === pluginVersion) {
@@ -1017,17 +1017,17 @@
1017
1017
  throw new Error(`The tsParticles version is different from the loaded plugins version. Engine version: ${this.version}. Plugin version: ${pluginVersion}`);
1018
1018
  }
1019
1019
  dispatchEvent(type, args) {
1020
- this._eventDispatcher.dispatchEvent(type, args);
1020
+ this.#eventDispatcher.dispatchEvent(type, args);
1021
1021
  }
1022
1022
  async init() {
1023
- if (this._initialized) {
1023
+ if (this.#initialized) {
1024
1024
  return;
1025
1025
  }
1026
1026
  await this.pluginManager.init();
1027
- this._initialized = true;
1027
+ this.#initialized = true;
1028
1028
  }
1029
1029
  item(index) {
1030
- const { items } = this, item = items[index];
1030
+ const items = this.items, item = items[index];
1031
1031
  if (item?.destroyed) {
1032
1032
  items.splice(index, removeDeleteCount);
1033
1033
  return;
@@ -1081,7 +1081,7 @@
1081
1081
  await Promise.all(this.items.map(t => t.refresh()));
1082
1082
  }
1083
1083
  removeEventListener(type, listener) {
1084
- this._eventDispatcher.removeEventListener(type, listener);
1084
+ this.#eventDispatcher.removeEventListener(type, listener);
1085
1085
  }
1086
1086
  }
1087
1087
 
@@ -1852,43 +1852,6 @@
1852
1852
  }
1853
1853
  }
1854
1854
 
1855
- class OpacityAnimation extends RangedAnimationOptions {
1856
- destroy;
1857
- constructor() {
1858
- super();
1859
- this.destroy = DestroyType.none;
1860
- this.speed = 2;
1861
- }
1862
- load(data) {
1863
- super.load(data);
1864
- if (isNull(data)) {
1865
- return;
1866
- }
1867
- if (data.destroy !== undefined) {
1868
- this.destroy = data.destroy;
1869
- }
1870
- }
1871
- }
1872
-
1873
- class Opacity extends RangedAnimationValueWithRandom {
1874
- animation;
1875
- constructor() {
1876
- super();
1877
- this.animation = new OpacityAnimation();
1878
- this.value = 1;
1879
- }
1880
- load(data) {
1881
- if (isNull(data)) {
1882
- return;
1883
- }
1884
- super.load(data);
1885
- const animation = data.animation;
1886
- if (animation !== undefined) {
1887
- this.animation.load(animation);
1888
- }
1889
- }
1890
- }
1891
-
1892
1855
  class Stroke {
1893
1856
  color;
1894
1857
  opacity;
@@ -2056,43 +2019,6 @@
2056
2019
  }
2057
2020
  }
2058
2021
 
2059
- class SizeAnimation extends RangedAnimationOptions {
2060
- destroy;
2061
- constructor() {
2062
- super();
2063
- this.destroy = DestroyType.none;
2064
- this.speed = 5;
2065
- }
2066
- load(data) {
2067
- super.load(data);
2068
- if (isNull(data)) {
2069
- return;
2070
- }
2071
- if (data.destroy !== undefined) {
2072
- this.destroy = data.destroy;
2073
- }
2074
- }
2075
- }
2076
-
2077
- class Size extends RangedAnimationValueWithRandom {
2078
- animation;
2079
- constructor() {
2080
- super();
2081
- this.animation = new SizeAnimation();
2082
- this.value = 3;
2083
- }
2084
- load(data) {
2085
- super.load(data);
2086
- if (isNull(data)) {
2087
- return;
2088
- }
2089
- const animation = data.animation;
2090
- if (animation !== undefined) {
2091
- this.animation.load(animation);
2092
- }
2093
- }
2094
- }
2095
-
2096
2022
  class ZIndex extends ValueWithRandom {
2097
2023
  opacityRate;
2098
2024
  sizeRate;
@@ -2126,24 +2052,21 @@
2126
2052
  groups;
2127
2053
  move;
2128
2054
  number;
2129
- opacity;
2130
2055
  paint;
2131
2056
  palette;
2132
2057
  reduceDuplicates;
2133
2058
  shape;
2134
- size;
2135
2059
  zIndex;
2136
- _container;
2137
- _pluginManager;
2060
+ #container;
2061
+ #pluginManager;
2138
2062
  constructor(pluginManager, container) {
2139
- this._pluginManager = pluginManager;
2140
- this._container = container;
2063
+ this.#pluginManager = pluginManager;
2064
+ this.#container = container;
2141
2065
  this.bounce = new ParticlesBounce();
2142
2066
  this.effect = new Effect();
2143
2067
  this.groups = {};
2144
2068
  this.move = new Move();
2145
2069
  this.number = new ParticlesNumber();
2146
- this.opacity = new Opacity();
2147
2070
  this.paint = new Paint();
2148
2071
  this.paint.color = new AnimatableColor();
2149
2072
  this.paint.color.value = "#fff";
@@ -2151,7 +2074,6 @@
2151
2074
  this.paint.fill.enable = true;
2152
2075
  this.reduceDuplicates = false;
2153
2076
  this.shape = new Shape();
2154
- this.size = new Size();
2155
2077
  this.zIndex = new ZIndex();
2156
2078
  }
2157
2079
  load(data) {
@@ -2160,7 +2082,7 @@
2160
2082
  }
2161
2083
  if (data.palette) {
2162
2084
  this.palette = data.palette;
2163
- this._importPalette(this.palette);
2085
+ this.#importPalette(this.palette);
2164
2086
  }
2165
2087
  if (data.groups !== undefined) {
2166
2088
  for (const group of Object.keys(data.groups)) {
@@ -2180,7 +2102,6 @@
2180
2102
  this.effect.load(data.effect);
2181
2103
  this.move.load(data.move);
2182
2104
  this.number.load(data.number);
2183
- this.opacity.load(data.opacity);
2184
2105
  const paintToLoad = data.paint;
2185
2106
  if (paintToLoad) {
2186
2107
  if (isArray(paintToLoad)) {
@@ -2199,15 +2120,14 @@
2199
2120
  }
2200
2121
  }
2201
2122
  this.shape.load(data.shape);
2202
- this.size.load(data.size);
2203
2123
  this.zIndex.load(data.zIndex);
2204
- if (this._container) {
2205
- for (const plugin of this._pluginManager.plugins) {
2124
+ if (this.#container) {
2125
+ for (const plugin of this.#pluginManager.plugins) {
2206
2126
  if (plugin.loadParticlesOptions) {
2207
- plugin.loadParticlesOptions(this._container, this, data);
2127
+ plugin.loadParticlesOptions(this.#container, this, data);
2208
2128
  }
2209
2129
  }
2210
- const updaters = this._pluginManager.updaters.get(this._container);
2130
+ const updaters = this.#pluginManager.updaters.get(this.#container);
2211
2131
  if (updaters) {
2212
2132
  for (const updater of updaters) {
2213
2133
  if (updater.loadOptions) {
@@ -2217,8 +2137,8 @@
2217
2137
  }
2218
2138
  }
2219
2139
  }
2220
- _importPalette = (palette) => {
2221
- const paletteData = this._pluginManager.getPalette(palette);
2140
+ #importPalette = (palette) => {
2141
+ const paletteData = this.#pluginManager.getPalette(palette);
2222
2142
  if (!paletteData) {
2223
2143
  return;
2224
2144
  }
@@ -2297,11 +2217,11 @@
2297
2217
  smooth;
2298
2218
  style;
2299
2219
  zLayers;
2300
- _container;
2301
- _pluginManager;
2220
+ #container;
2221
+ #pluginManager;
2302
2222
  constructor(pluginManager, container) {
2303
- this._pluginManager = pluginManager;
2304
- this._container = container;
2223
+ this.#pluginManager = pluginManager;
2224
+ this.#container = container;
2305
2225
  this.autoPlay = true;
2306
2226
  this.background = new Background();
2307
2227
  this.clear = true;
@@ -2312,7 +2232,7 @@
2312
2232
  this.duration = 0;
2313
2233
  this.fpsLimit = 120;
2314
2234
  this.hdr = true;
2315
- this.particles = loadParticlesOptions(this._pluginManager, this._container);
2235
+ this.particles = loadParticlesOptions(this.#pluginManager, this.#container);
2316
2236
  this.pauseOnBlur = true;
2317
2237
  this.pauseOnOutsideViewport = true;
2318
2238
  this.resize = new ResizeEvent();
@@ -2327,12 +2247,12 @@
2327
2247
  if (data.preset !== undefined) {
2328
2248
  this.preset = data.preset;
2329
2249
  executeOnSingleOrMultiple(this.preset, preset => {
2330
- this._importPreset(preset);
2250
+ this.#importPreset(preset);
2331
2251
  });
2332
2252
  }
2333
2253
  if (data.palette !== undefined) {
2334
2254
  this.palette = data.palette;
2335
- this._importPalette(this.palette);
2255
+ this.#importPalette(this.palette);
2336
2256
  }
2337
2257
  if (data.autoPlay !== undefined) {
2338
2258
  this.autoPlay = data.autoPlay;
@@ -2386,12 +2306,12 @@
2386
2306
  if (data.smooth !== undefined) {
2387
2307
  this.smooth = data.smooth;
2388
2308
  }
2389
- this._pluginManager.plugins.forEach(plugin => {
2390
- plugin.loadOptions(this._container, this, data);
2309
+ this.#pluginManager.plugins.forEach(plugin => {
2310
+ plugin.loadOptions(this.#container, this, data);
2391
2311
  });
2392
2312
  }
2393
- _importPalette = palette => {
2394
- const paletteData = this._pluginManager.getPalette(palette);
2313
+ #importPalette = palette => {
2314
+ const paletteData = this.#pluginManager.getPalette(palette);
2395
2315
  if (!paletteData) {
2396
2316
  return;
2397
2317
  }
@@ -2408,8 +2328,8 @@
2408
2328
  },
2409
2329
  });
2410
2330
  };
2411
- _importPreset = preset => {
2412
- this.load(this._pluginManager.getPreset(preset));
2331
+ #importPreset = preset => {
2332
+ this.load(this.#pluginManager.getPreset(preset));
2413
2333
  };
2414
2334
  }
2415
2335
 
@@ -2935,7 +2855,7 @@
2935
2855
  }
2936
2856
 
2937
2857
  async function loadBlendPlugin(engine) {
2938
- engine.checkVersion("4.0.5");
2858
+ engine.checkVersion("4.1.1");
2939
2859
  await engine.pluginManager.register(e => {
2940
2860
  e.pluginManager.addPlugin(new BlendPlugin());
2941
2861
  });
@@ -2972,7 +2892,7 @@
2972
2892
  }
2973
2893
 
2974
2894
  async function loadCircleShape(engine) {
2975
- engine.checkVersion("4.0.5");
2895
+ engine.checkVersion("4.1.1");
2976
2896
  await engine.pluginManager.register(e => {
2977
2897
  e.pluginManager.addShape(["circle"], () => {
2978
2898
  return Promise.resolve(new CircleDrawer());
@@ -2993,15 +2913,15 @@
2993
2913
  return input.startsWith("#");
2994
2914
  }
2995
2915
  handleColor(color) {
2996
- return this._parseString(color.value);
2916
+ return this.#parseString(color.value);
2997
2917
  }
2998
2918
  handleRangeColor(color) {
2999
- return this._parseString(color.value);
2919
+ return this.#parseString(color.value);
3000
2920
  }
3001
2921
  parseString(input) {
3002
- return this._parseString(input);
2922
+ return this.#parseString(input);
3003
2923
  }
3004
- _parseString(hexColor) {
2924
+ #parseString(hexColor) {
3005
2925
  if (typeof hexColor !== "string" || !this.accepts(hexColor)) {
3006
2926
  return;
3007
2927
  }
@@ -3020,7 +2940,7 @@
3020
2940
  }
3021
2941
 
3022
2942
  async function loadHexColorPlugin(engine) {
3023
- engine.checkVersion("4.0.5");
2943
+ engine.checkVersion("4.1.1");
3024
2944
  await engine.pluginManager.register(e => {
3025
2945
  e.pluginManager.addColorManager("hex", new HexColorManager());
3026
2946
  });
@@ -3073,7 +2993,7 @@
3073
2993
  }
3074
2994
 
3075
2995
  async function loadHslColorPlugin(engine) {
3076
- engine.checkVersion("4.0.5");
2996
+ engine.checkVersion("4.1.1");
3077
2997
  await engine.pluginManager.register(e => {
3078
2998
  e.pluginManager.addColorManager("hsl", new HslColorManager());
3079
2999
  });
@@ -3081,13 +3001,13 @@
3081
3001
 
3082
3002
  class MovePlugin {
3083
3003
  id = "move";
3084
- _pluginManager;
3004
+ #pluginManager;
3085
3005
  constructor(pluginManager) {
3086
- this._pluginManager = pluginManager;
3006
+ this.#pluginManager = pluginManager;
3087
3007
  }
3088
3008
  async getPlugin(container) {
3089
3009
  const { MovePluginInstance } = await Promise.resolve().then(function () { return MovePluginInstance$1; });
3090
- return new MovePluginInstance(this._pluginManager, container);
3010
+ return new MovePluginInstance(this.#pluginManager, container);
3091
3011
  }
3092
3012
  loadOptions() {
3093
3013
  }
@@ -3097,7 +3017,7 @@
3097
3017
  }
3098
3018
 
3099
3019
  async function loadMovePlugin(engine) {
3100
- engine.checkVersion("4.0.5");
3020
+ engine.checkVersion("4.1.1");
3101
3021
  await engine.pluginManager.register(e => {
3102
3022
  const moveEngine = e, movePluginManager = moveEngine.pluginManager;
3103
3023
  movePluginManager.initializers.pathGenerators ??= new Map();
@@ -3115,18 +3035,58 @@
3115
3035
  });
3116
3036
  }
3117
3037
 
3038
+ class OpacityAnimation extends RangedAnimationOptions {
3039
+ destroy;
3040
+ constructor() {
3041
+ super();
3042
+ this.destroy = DestroyType.none;
3043
+ this.speed = 2;
3044
+ }
3045
+ load(data) {
3046
+ super.load(data);
3047
+ if (isNull(data)) {
3048
+ return;
3049
+ }
3050
+ if (data.destroy !== undefined) {
3051
+ this.destroy = data.destroy;
3052
+ }
3053
+ }
3054
+ }
3055
+
3056
+ class Opacity extends RangedAnimationValueWithRandom {
3057
+ animation;
3058
+ constructor() {
3059
+ super();
3060
+ this.animation = new OpacityAnimation();
3061
+ this.value = 1;
3062
+ }
3063
+ load(data) {
3064
+ if (isNull(data)) {
3065
+ return;
3066
+ }
3067
+ super.load(data);
3068
+ const animation = data.animation;
3069
+ if (animation !== undefined) {
3070
+ this.animation.load(animation);
3071
+ }
3072
+ }
3073
+ }
3074
+
3118
3075
  class OpacityUpdater {
3119
- container;
3076
+ #container;
3120
3077
  constructor(container) {
3121
- this.container = container;
3078
+ this.#container = container;
3122
3079
  }
3123
3080
  init(particle) {
3124
3081
  const opacityOptions = particle.options.opacity, pxRatio = 1;
3082
+ if (!opacityOptions) {
3083
+ return;
3084
+ }
3125
3085
  particle.opacity = initParticleNumericAnimationValue(opacityOptions, pxRatio);
3126
3086
  const opacityAnimation = opacityOptions.animation;
3127
3087
  if (opacityAnimation.enable) {
3128
3088
  particle.opacity.velocity =
3129
- (getRangeValue(opacityAnimation.speed) / percentDenominator) * this.container.retina.reduceFactor;
3089
+ (getRangeValue(opacityAnimation.speed) / percentDenominator) * this.#container.retina.reduceFactor;
3130
3090
  if (!opacityAnimation.sync) {
3131
3091
  particle.opacity.velocity *= getRandom();
3132
3092
  }
@@ -3142,6 +3102,12 @@
3142
3102
  ((particle.opacity.maxLoops ?? none) > none &&
3143
3103
  (particle.opacity.loops ?? none) < (particle.opacity.maxLoops ?? none))));
3144
3104
  }
3105
+ loadOptions(options, ...sources) {
3106
+ options.opacity ??= new Opacity();
3107
+ for (const source of sources) {
3108
+ options.opacity.load(source?.opacity);
3109
+ }
3110
+ }
3145
3111
  reset(particle) {
3146
3112
  if (!particle.opacity) {
3147
3113
  return;
@@ -3150,7 +3116,7 @@
3150
3116
  particle.opacity.loops = 0;
3151
3117
  }
3152
3118
  update(particle, delta) {
3153
- if (!this.isEnabled(particle) || !particle.opacity) {
3119
+ if (!this.isEnabled(particle) || !particle.opacity || !particle.options.opacity) {
3154
3120
  return;
3155
3121
  }
3156
3122
  updateAnimation(particle, particle.opacity, true, particle.options.opacity.animation.destroy, delta);
@@ -3158,7 +3124,7 @@
3158
3124
  }
3159
3125
 
3160
3126
  async function loadOpacityUpdater(engine) {
3161
- engine.checkVersion("4.0.5");
3127
+ engine.checkVersion("4.1.1");
3162
3128
  await engine.pluginManager.register(e => {
3163
3129
  e.pluginManager.addParticleUpdater("opacity", container => {
3164
3130
  return Promise.resolve(new OpacityUpdater(container));
@@ -3180,10 +3146,9 @@
3180
3146
  }
3181
3147
  const velocity = data.particle.velocity.x;
3182
3148
  let bounced = false;
3183
- if ((data.direction === OutModeDirection.right &&
3184
- data.bounds.right >= data.canvasSize.width &&
3185
- velocity > minVelocity$4) ||
3186
- (data.direction === OutModeDirection.left && data.bounds.left <= boundsMin && velocity < minVelocity$4)) {
3149
+ if (data.outOfCanvas &&
3150
+ ((data.direction === OutModeDirection.right && velocity > minVelocity$4) ||
3151
+ (data.direction === OutModeDirection.left && velocity < minVelocity$4))) {
3187
3152
  const newVelocity = getRangeValue(data.particle.options.bounce.horizontal.value);
3188
3153
  data.particle.velocity.x *= -newVelocity;
3189
3154
  bounced = true;
@@ -3192,10 +3157,10 @@
3192
3157
  return;
3193
3158
  }
3194
3159
  const minPos = data.offset.x + data.size;
3195
- if (data.bounds.right >= data.canvasSize.width && data.direction === OutModeDirection.right) {
3160
+ if (data.outOfCanvas && data.direction === OutModeDirection.right) {
3196
3161
  data.particle.position.x = data.canvasSize.width - minPos;
3197
3162
  }
3198
- else if (data.bounds.left <= boundsMin && data.direction === OutModeDirection.left) {
3163
+ else if (data.outOfCanvas && data.direction === OutModeDirection.left) {
3199
3164
  data.particle.position.x = minPos;
3200
3165
  }
3201
3166
  if (data.outMode === OutMode.split) {
@@ -3215,10 +3180,9 @@
3215
3180
  }
3216
3181
  const velocity = data.particle.velocity.y;
3217
3182
  let bounced = false;
3218
- if ((data.direction === OutModeDirection.bottom &&
3219
- data.bounds.bottom >= data.canvasSize.height &&
3220
- velocity > minVelocity$4) ||
3221
- (data.direction === OutModeDirection.top && data.bounds.top <= boundsMin && velocity < minVelocity$4)) {
3183
+ if (data.outOfCanvas &&
3184
+ ((data.direction === OutModeDirection.bottom && velocity > minVelocity$4) ||
3185
+ (data.direction === OutModeDirection.top && velocity < minVelocity$4))) {
3222
3186
  const newVelocity = getRangeValue(data.particle.options.bounce.vertical.value);
3223
3187
  data.particle.velocity.y *= -newVelocity;
3224
3188
  bounced = true;
@@ -3227,10 +3191,10 @@
3227
3191
  return;
3228
3192
  }
3229
3193
  const minPos = data.offset.y + data.size;
3230
- if (data.bounds.bottom >= data.canvasSize.height && data.direction === OutModeDirection.bottom) {
3194
+ if (data.outOfCanvas && data.direction === OutModeDirection.bottom) {
3231
3195
  data.particle.position.y = data.canvasSize.height - minPos;
3232
3196
  }
3233
- else if (data.bounds.top <= boundsMin && data.direction === OutModeDirection.top) {
3197
+ else if (data.outOfCanvas && data.direction === OutModeDirection.top) {
3234
3198
  data.particle.position.y = minPos;
3235
3199
  }
3236
3200
  if (data.outMode === OutMode.split) {
@@ -3239,24 +3203,24 @@
3239
3203
  }
3240
3204
 
3241
3205
  class BounceOutMode {
3242
- container;
3243
3206
  modes;
3244
- _particleBouncePlugins;
3207
+ #container;
3208
+ #particleBouncePlugins;
3245
3209
  constructor(container) {
3246
- this.container = container;
3210
+ this.#container = container;
3247
3211
  this.modes = [
3248
3212
  OutMode.bounce,
3249
3213
  OutMode.split,
3250
3214
  ];
3251
- this._particleBouncePlugins = container.plugins.filter(p => p.particleBounce !== undefined);
3215
+ this.#particleBouncePlugins = container.plugins.filter(p => p.particleBounce !== undefined);
3252
3216
  }
3253
3217
  update(particle, direction, delta, outMode) {
3254
3218
  if (!this.modes.includes(outMode)) {
3255
3219
  return;
3256
3220
  }
3257
- const container = this.container;
3221
+ const container = this.#container;
3258
3222
  let handled = false;
3259
- for (const plugin of this._particleBouncePlugins) {
3223
+ for (const plugin of this.#particleBouncePlugins) {
3260
3224
  handled = plugin.particleBounce?.(particle, delta, direction) ?? false;
3261
3225
  if (handled) {
3262
3226
  break;
@@ -3265,29 +3229,26 @@
3265
3229
  if (handled) {
3266
3230
  return;
3267
3231
  }
3268
- const pos = particle.getPosition(), offset = particle.offset, size = particle.getRadius(), bounds = calculateBounds(pos, size), canvasSize = container.canvas.size;
3269
- bounceHorizontal({ particle, outMode, direction, bounds, canvasSize, offset, size });
3270
- bounceVertical({ particle, outMode, direction, bounds, canvasSize, offset, size });
3232
+ const pos = particle.getPosition(), offset = particle.offset, size = particle.getRadius(), bounds = calculateBounds(pos, size), canvasSize = container.canvas.size, outOfCanvas = !particle.isInsideCanvasForOutMode(outMode, direction);
3233
+ bounceHorizontal({ particle, outMode, direction, bounds, canvasSize, offset, outOfCanvas, size });
3234
+ bounceVertical({ particle, outMode, direction, bounds, canvasSize, offset, outOfCanvas, size });
3271
3235
  }
3272
3236
  }
3273
3237
 
3274
3238
  const minVelocity$3 = 0;
3275
3239
  class DestroyOutMode {
3276
- container;
3277
3240
  modes;
3278
- constructor(container) {
3279
- this.container = container;
3241
+ constructor(_container) {
3280
3242
  this.modes = [OutMode.destroy];
3281
3243
  }
3282
3244
  update(particle, direction, _delta, outMode) {
3283
3245
  if (!this.modes.includes(outMode)) {
3284
3246
  return;
3285
3247
  }
3286
- const container = this.container;
3287
3248
  switch (particle.outType) {
3288
3249
  case ParticleOutType.normal:
3289
3250
  case ParticleOutType.outside:
3290
- if (isPointInside(particle.position, container.canvas.size, originPoint, particle.getRadius(), direction)) {
3251
+ if (particle.isInsideCanvasForOutMode(outMode, direction)) {
3291
3252
  return;
3292
3253
  }
3293
3254
  break;
@@ -3308,10 +3269,10 @@
3308
3269
 
3309
3270
  const minVelocity$2 = 0;
3310
3271
  class NoneOutMode {
3311
- container;
3312
3272
  modes;
3273
+ #container;
3313
3274
  constructor(container) {
3314
- this.container = container;
3275
+ this.#container = container;
3315
3276
  this.modes = [OutMode.none];
3316
3277
  }
3317
3278
  update(particle, direction, _delta, outMode) {
@@ -3324,7 +3285,7 @@
3324
3285
  (direction === OutModeDirection.top || direction === OutModeDirection.bottom))) {
3325
3286
  return;
3326
3287
  }
3327
- const gravityOptions = particle.options.move.gravity, container = this.container, canvasSize = container.canvas.size, pRadius = particle.getRadius();
3288
+ const gravityOptions = particle.options.move.gravity, container = this.#container, canvasSize = container.canvas.size, pRadius = particle.getRadius();
3328
3289
  if (!gravityOptions.enable) {
3329
3290
  if ((particle.velocity.y > minVelocity$2 && particle.position.y <= canvasSize.height + pRadius) ||
3330
3291
  (particle.velocity.y < minVelocity$2 && particle.position.y >= -pRadius) ||
@@ -3350,17 +3311,17 @@
3350
3311
 
3351
3312
  const minVelocity$1 = 0, minDistance$2 = 0, updateVector = Vector.origin;
3352
3313
  class OutOutMode {
3353
- container;
3354
3314
  modes;
3315
+ #container;
3355
3316
  constructor(container) {
3356
- this.container = container;
3317
+ this.#container = container;
3357
3318
  this.modes = [OutMode.out];
3358
3319
  }
3359
3320
  update(particle, direction, _delta, outMode) {
3360
3321
  if (!this.modes.includes(outMode)) {
3361
3322
  return;
3362
3323
  }
3363
- const container = this.container;
3324
+ const container = this.#container;
3364
3325
  switch (particle.outType) {
3365
3326
  case ParticleOutType.inside: {
3366
3327
  const { x: vx, y: vy } = particle.velocity;
@@ -3390,7 +3351,7 @@
3390
3351
  break;
3391
3352
  }
3392
3353
  default: {
3393
- if (isPointInside(particle.position, container.canvas.size, originPoint, particle.getRadius(), direction)) {
3354
+ if (particle.isInsideCanvasForOutMode(outMode, direction)) {
3394
3355
  return;
3395
3356
  }
3396
3357
  switch (particle.outType) {
@@ -3474,16 +3435,16 @@
3474
3435
  };
3475
3436
  class OutOfCanvasUpdater {
3476
3437
  updaters;
3477
- container;
3438
+ #container;
3478
3439
  constructor(container) {
3479
- this.container = container;
3440
+ this.#container = container;
3480
3441
  this.updaters = new Map();
3481
3442
  }
3482
3443
  init(particle) {
3483
- this._addUpdaterIfMissing(particle, OutMode.bounce, container => new BounceOutMode(container));
3484
- this._addUpdaterIfMissing(particle, OutMode.out, container => new OutOutMode(container));
3485
- this._addUpdaterIfMissing(particle, OutMode.destroy, container => new DestroyOutMode(container));
3486
- this._addUpdaterIfMissing(particle, OutMode.none, container => new NoneOutMode(container));
3444
+ this.#addUpdaterIfMissing(particle, OutMode.bounce, container => new BounceOutMode(container));
3445
+ this.#addUpdaterIfMissing(particle, OutMode.out, container => new OutOutMode(container));
3446
+ this.#addUpdaterIfMissing(particle, OutMode.destroy, container => new DestroyOutMode(container));
3447
+ this.#addUpdaterIfMissing(particle, OutMode.none, container => new NoneOutMode(container));
3487
3448
  }
3488
3449
  isEnabled(particle) {
3489
3450
  return !particle.destroyed && !particle.spawning;
@@ -3491,18 +3452,18 @@
3491
3452
  update(particle, delta) {
3492
3453
  const outModes = particle.options.move.outModes;
3493
3454
  particle.justWarped = false;
3494
- this._updateOutMode(particle, delta, outModes.bottom ?? outModes.default, OutModeDirection.bottom);
3495
- this._updateOutMode(particle, delta, outModes.left ?? outModes.default, OutModeDirection.left);
3496
- this._updateOutMode(particle, delta, outModes.right ?? outModes.default, OutModeDirection.right);
3497
- this._updateOutMode(particle, delta, outModes.top ?? outModes.default, OutModeDirection.top);
3455
+ this.#updateOutMode(particle, delta, outModes.bottom ?? outModes.default, OutModeDirection.bottom);
3456
+ this.#updateOutMode(particle, delta, outModes.left ?? outModes.default, OutModeDirection.left);
3457
+ this.#updateOutMode(particle, delta, outModes.right ?? outModes.default, OutModeDirection.right);
3458
+ this.#updateOutMode(particle, delta, outModes.top ?? outModes.default, OutModeDirection.top);
3498
3459
  }
3499
- _addUpdaterIfMissing = (particle, outMode, getUpdater) => {
3460
+ #addUpdaterIfMissing = (particle, outMode, getUpdater) => {
3500
3461
  const outModes = particle.options.move.outModes;
3501
3462
  if (!this.updaters.has(outMode) && checkOutMode(outModes, outMode)) {
3502
- this.updaters.set(outMode, getUpdater(this.container));
3463
+ this.updaters.set(outMode, getUpdater(this.#container));
3503
3464
  }
3504
3465
  };
3505
- _updateOutMode = (particle, delta, outMode, direction) => {
3466
+ #updateOutMode = (particle, delta, outMode, direction) => {
3506
3467
  for (const updater of this.updaters.values()) {
3507
3468
  updater.update(particle, direction, delta, outMode);
3508
3469
  }
@@ -3510,7 +3471,7 @@
3510
3471
  }
3511
3472
 
3512
3473
  async function loadOutModesUpdater(engine) {
3513
- engine.checkVersion("4.0.5");
3474
+ engine.checkVersion("4.1.1");
3514
3475
  await engine.pluginManager.register(e => {
3515
3476
  e.pluginManager.addParticleUpdater("outModes", container => {
3516
3477
  return Promise.resolve(new OutOfCanvasUpdater(container));
@@ -3520,20 +3481,20 @@
3520
3481
 
3521
3482
  const defaultOpacity = 1;
3522
3483
  class PaintUpdater {
3523
- _container;
3524
- _pluginManager;
3484
+ #container;
3485
+ #pluginManager;
3525
3486
  constructor(pluginManager, container) {
3526
- this._container = container;
3527
- this._pluginManager = pluginManager;
3487
+ this.#container = container;
3488
+ this.#pluginManager = pluginManager;
3528
3489
  }
3529
3490
  init(particle) {
3530
- const container = this._container, options = particle.options, paint = itemFromSingleOrMultiple(options.paint, particle.id, options.reduceDuplicates), color = paint?.color, paintColor = color ?? undefined, fill = paint?.fill, stroke = paint?.stroke;
3491
+ const container = this.#container, options = particle.options, paint = itemFromSingleOrMultiple(options.paint, particle.id, options.reduceDuplicates), color = paint?.color, paintColor = color ?? undefined, fill = paint?.fill, stroke = paint?.stroke;
3531
3492
  if (fill) {
3532
3493
  const fillColor = AnimatableColor.create(paintColor === undefined ? undefined : AnimatableColor.create(undefined, paintColor), fill.color);
3533
3494
  particle.fillEnabled = fill.enable;
3534
3495
  particle.fillOpacity = getRangeValue(fill.opacity);
3535
3496
  particle.fillAnimation = fillColor.animation;
3536
- const fillHslColor = rangeColorToHsl(this._pluginManager, fillColor);
3497
+ const fillHslColor = rangeColorToHsl(this.#pluginManager, fillColor);
3537
3498
  if (fillHslColor) {
3538
3499
  particle.fillColor = getHslAnimationFromHsl(fillHslColor, particle.fillAnimation, container.retina.reduceFactor);
3539
3500
  }
@@ -3549,7 +3510,7 @@
3549
3510
  particle.strokeWidth = getRangeValue(stroke.width) * container.retina.pixelRatio;
3550
3511
  particle.strokeOpacity = getRangeValue(stroke.opacity ?? defaultOpacity);
3551
3512
  particle.strokeAnimation = strokeColor.animation;
3552
- const strokeHslColor = rangeColorToHsl(this._pluginManager, strokeColor) ?? particle.getFillColor();
3513
+ const strokeHslColor = rangeColorToHsl(this.#pluginManager, strokeColor) ?? particle.getFillColor();
3553
3514
  if (strokeHslColor) {
3554
3515
  particle.strokeColor = getHslAnimationFromHsl(strokeHslColor, particle.strokeAnimation, container.retina.reduceFactor);
3555
3516
  }
@@ -3581,7 +3542,7 @@
3581
3542
  }
3582
3543
 
3583
3544
  async function loadPaintUpdater(engine) {
3584
- engine.checkVersion("4.0.5");
3545
+ engine.checkVersion("4.1.1");
3585
3546
  await engine.pluginManager.register(e => {
3586
3547
  e.pluginManager.addParticleUpdater("paint", container => {
3587
3548
  return Promise.resolve(new PaintUpdater(e.pluginManager, container));
@@ -3636,27 +3597,69 @@
3636
3597
  }
3637
3598
 
3638
3599
  async function loadRgbColorPlugin(engine) {
3639
- engine.checkVersion("4.0.5");
3600
+ engine.checkVersion("4.1.1");
3640
3601
  await engine.pluginManager.register(e => {
3641
3602
  e.pluginManager.addColorManager("rgb", new RgbColorManager());
3642
3603
  });
3643
3604
  }
3644
3605
 
3606
+ class SizeAnimation extends RangedAnimationOptions {
3607
+ destroy;
3608
+ constructor() {
3609
+ super();
3610
+ this.destroy = DestroyType.none;
3611
+ this.speed = 5;
3612
+ }
3613
+ load(data) {
3614
+ super.load(data);
3615
+ if (isNull(data)) {
3616
+ return;
3617
+ }
3618
+ if (data.destroy !== undefined) {
3619
+ this.destroy = data.destroy;
3620
+ }
3621
+ }
3622
+ }
3623
+
3624
+ class Size extends RangedAnimationValueWithRandom {
3625
+ animation;
3626
+ constructor() {
3627
+ super();
3628
+ this.animation = new SizeAnimation();
3629
+ this.value = 3;
3630
+ }
3631
+ load(data) {
3632
+ super.load(data);
3633
+ if (isNull(data)) {
3634
+ return;
3635
+ }
3636
+ const animation = data.animation;
3637
+ if (animation !== undefined) {
3638
+ this.animation.load(animation);
3639
+ }
3640
+ }
3641
+ }
3642
+
3645
3643
  const minLoops = 0;
3646
3644
  class SizeUpdater {
3647
- _container;
3645
+ #container;
3648
3646
  constructor(container) {
3649
- this._container = container;
3647
+ this.#container = container;
3650
3648
  }
3651
3649
  init(particle) {
3652
- const container = this._container, sizeOptions = particle.options.size, sizeAnimation = sizeOptions.animation;
3653
- if (sizeAnimation.enable) {
3654
- particle.size.velocity =
3655
- (particle.retina.sizeAnimationSpeed / percentDenominator) * container.retina.reduceFactor;
3656
- if (!sizeAnimation.sync) {
3657
- particle.size.velocity *= getRandom();
3658
- }
3650
+ const container = this.#container, sizeOptions = particle.options.size;
3651
+ if (!sizeOptions) {
3652
+ return;
3653
+ }
3654
+ const sizeAnimation = sizeOptions.animation;
3655
+ if (!sizeAnimation.enable) {
3656
+ return;
3659
3657
  }
3658
+ particle.size.velocity = (particle.retina.sizeAnimationSpeed / percentDenominator) * container.retina.reduceFactor;
3659
+ if (sizeAnimation.sync) {
3660
+ return;
3661
+ }
3662
+ particle.size.velocity *= getRandom();
3660
3663
  }
3661
3664
  isEnabled(particle) {
3662
3665
  return (!particle.destroyed &&
@@ -3666,12 +3669,26 @@
3666
3669
  ((particle.size.maxLoops ?? minLoops) > minLoops &&
3667
3670
  (particle.size.loops ?? minLoops) < (particle.size.maxLoops ?? minLoops))));
3668
3671
  }
3672
+ loadOptions(options, ...sources) {
3673
+ options.size ??= new Size();
3674
+ for (const source of sources) {
3675
+ options.size.load(source?.size);
3676
+ }
3677
+ }
3678
+ preInit(particle) {
3679
+ const pxRatio = this.#container.retina.pixelRatio, options = particle.options, sizeOptions = options.size;
3680
+ if (!sizeOptions) {
3681
+ return;
3682
+ }
3683
+ particle.size = initParticleNumericAnimationValue(sizeOptions, pxRatio);
3684
+ particle.retina.sizeAnimationSpeed = getRangeValue(sizeOptions.animation.speed) * pxRatio;
3685
+ }
3669
3686
  reset(particle) {
3670
3687
  particle.size.time = 0;
3671
3688
  particle.size.loops = 0;
3672
3689
  }
3673
3690
  update(particle, delta) {
3674
- if (!this.isEnabled(particle)) {
3691
+ if (!this.isEnabled(particle) || !particle.options.size) {
3675
3692
  return;
3676
3693
  }
3677
3694
  updateAnimation(particle, particle.size, true, particle.options.size.animation.destroy, delta);
@@ -3679,7 +3696,7 @@
3679
3696
  }
3680
3697
 
3681
3698
  async function loadSizeUpdater(engine) {
3682
- engine.checkVersion("4.0.5");
3699
+ engine.checkVersion("4.1.1");
3683
3700
  await engine.pluginManager.register(e => {
3684
3701
  e.pluginManager.addParticleUpdater("size", container => {
3685
3702
  return Promise.resolve(new SizeUpdater(container));
@@ -3688,7 +3705,7 @@
3688
3705
  }
3689
3706
 
3690
3707
  async function loadBasic(engine) {
3691
- engine.checkVersion("4.0.5");
3708
+ engine.checkVersion("4.1.1");
3692
3709
  await engine.pluginManager.register(async (e) => {
3693
3710
  await Promise.all([
3694
3711
  loadBlendPlugin(e),
@@ -3815,20 +3832,20 @@
3815
3832
  })(InteractivityDetect || (InteractivityDetect = {}));
3816
3833
 
3817
3834
  class Modes {
3818
- _container;
3819
- _pluginManager;
3835
+ #container;
3836
+ #pluginManager;
3820
3837
  constructor(pluginManager, container) {
3821
- this._pluginManager = pluginManager;
3822
- this._container = container;
3838
+ this.#pluginManager = pluginManager;
3839
+ this.#container = container;
3823
3840
  }
3824
3841
  load(data) {
3825
3842
  if (isNull(data)) {
3826
3843
  return;
3827
3844
  }
3828
- if (!this._container) {
3845
+ if (!this.#container) {
3829
3846
  return;
3830
3847
  }
3831
- const interactors = this._pluginManager.interactors?.get(this._container);
3848
+ const interactors = this.#pluginManager.interactors?.get(this.#container);
3832
3849
  if (!interactors) {
3833
3850
  return;
3834
3851
  }
@@ -3865,13 +3882,13 @@
3865
3882
 
3866
3883
  class InteractivityPlugin {
3867
3884
  id = "interactivity";
3868
- _pluginManager;
3885
+ #pluginManager;
3869
3886
  constructor(pluginManager) {
3870
- this._pluginManager = pluginManager;
3887
+ this.#pluginManager = pluginManager;
3871
3888
  }
3872
3889
  async getPlugin(container) {
3873
3890
  const { InteractivityPluginInstance } = await Promise.resolve().then(function () { return InteractivityPluginInstance$1; });
3874
- return new InteractivityPluginInstance(this._pluginManager, container);
3891
+ return new InteractivityPluginInstance(this.#pluginManager, container);
3875
3892
  }
3876
3893
  loadOptions(container, options, source) {
3877
3894
  if (!this.needsPlugin()) {
@@ -3879,10 +3896,10 @@
3879
3896
  }
3880
3897
  let interactivityOptions = options.interactivity;
3881
3898
  if (!interactivityOptions?.load) {
3882
- options.interactivity = interactivityOptions = new Interactivity(this._pluginManager, container);
3899
+ options.interactivity = interactivityOptions = new Interactivity(this.#pluginManager, container);
3883
3900
  }
3884
3901
  interactivityOptions.load(source?.interactivity);
3885
- const interactors = this._pluginManager.interactors?.get(container);
3902
+ const interactors = this.#pluginManager.interactors?.get(container);
3886
3903
  if (!interactors) {
3887
3904
  return;
3888
3905
  }
@@ -3896,7 +3913,7 @@
3896
3913
  if (source?.interactivity) {
3897
3914
  options.interactivity = deepExtend({}, source.interactivity);
3898
3915
  }
3899
- const interactors = this._pluginManager.interactors?.get(container);
3916
+ const interactors = this.#pluginManager.interactors?.get(container);
3900
3917
  if (!interactors) {
3901
3918
  return;
3902
3919
  }
@@ -3926,7 +3943,7 @@
3926
3943
  const clickEvent = "click", mouseDownEvent = "pointerdown", mouseUpEvent = "pointerup", mouseLeaveEvent = "pointerleave", mouseMoveEvent = "pointermove", touchStartEvent = "touchstart", touchEndEvent = "touchend", touchMoveEvent = "touchmove", touchCancelEvent = "touchcancel";
3927
3944
 
3928
3945
  async function loadInteractivityPlugin(engine) {
3929
- engine.checkVersion("4.0.5");
3946
+ engine.checkVersion("4.1.1");
3930
3947
  await engine.pluginManager.register(e => {
3931
3948
  const interactivityEngine = e, interactivityPluginManager = interactivityEngine.pluginManager;
3932
3949
  interactivityPluginManager.addPlugin(new InteractivityPlugin(interactivityPluginManager));
@@ -3960,15 +3977,15 @@
3960
3977
  }
3961
3978
 
3962
3979
  class CircleWarp extends Circle {
3963
- canvasSize;
3980
+ #canvasSize;
3964
3981
  constructor(x, y, radius, canvasSize) {
3965
3982
  super(x, y, radius);
3966
- this.canvasSize = canvasSize;
3983
+ this.#canvasSize = canvasSize;
3967
3984
  }
3968
3985
  contains(point) {
3969
3986
  if (super.contains(point))
3970
3987
  return true;
3971
- const { width, height } = this.canvasSize, { x, y } = point;
3988
+ const { width, height } = this.#canvasSize, { x, y } = point;
3972
3989
  return (super.contains({ x: x - width, y }) ||
3973
3990
  super.contains({ x: x + width, y }) ||
3974
3991
  super.contains({ x, y: y - height }) ||
@@ -3981,7 +3998,7 @@
3981
3998
  intersects(range) {
3982
3999
  if (super.intersects(range))
3983
4000
  return true;
3984
- const { width, height } = this.canvasSize, pos = range.position, shifts = [
4001
+ const { width, height } = this.#canvasSize, pos = range.position, shifts = [
3985
4002
  { x: -width, y: 0 },
3986
4003
  { x: width, y: 0 },
3987
4004
  { x: 0, y: -height },
@@ -4133,15 +4150,15 @@
4133
4150
  return Math.hypot(warpDistances.x, warpDistances.y);
4134
4151
  }
4135
4152
  class Linker extends ParticlesInteractorBase {
4136
- _maxDistance;
4137
- _pluginManager;
4153
+ #maxDistance;
4154
+ #pluginManager;
4138
4155
  constructor(pluginManager, container) {
4139
4156
  super(container);
4140
- this._pluginManager = pluginManager;
4141
- this._maxDistance = 0;
4157
+ this.#pluginManager = pluginManager;
4158
+ this.#maxDistance = 0;
4142
4159
  }
4143
4160
  get maxDistance() {
4144
- return this._maxDistance;
4161
+ return this.#maxDistance;
4145
4162
  }
4146
4163
  clear() {
4147
4164
  }
@@ -4154,8 +4171,8 @@
4154
4171
  return;
4155
4172
  }
4156
4173
  p1.links = [];
4157
- if (p1.linksDistance && p1.linksDistance > this._maxDistance) {
4158
- this._maxDistance = p1.linksDistance;
4174
+ if (p1.linksDistance && p1.linksDistance > this.#maxDistance) {
4175
+ this.#maxDistance = p1.linksDistance;
4159
4176
  }
4160
4177
  const pos1 = p1.getPosition(), container = this.container, canvasSize = container.canvas.size;
4161
4178
  if (pos1.x < originPoint.x || pos1.y < originPoint.y || pos1.x > canvasSize.width || pos1.y > canvasSize.height) {
@@ -4183,11 +4200,11 @@
4183
4200
  continue;
4184
4201
  }
4185
4202
  const opacityLine = (opacityOffset - distance / optDistance) * optOpacity;
4186
- this._setColor(p1);
4203
+ this.#setColor(p1);
4187
4204
  p1.links.push({
4188
4205
  destination: p2,
4189
4206
  opacity: opacityLine,
4190
- color: this._getLinkColor(p1, p2),
4207
+ color: this.#getLinkColor(p1, p2),
4191
4208
  isWarped: distWarp < distDirect,
4192
4209
  });
4193
4210
  }
@@ -4203,7 +4220,7 @@
4203
4220
  }
4204
4221
  reset() {
4205
4222
  }
4206
- _getLinkColor(p1, p2) {
4223
+ #getLinkColor(p1, p2) {
4207
4224
  const container = this.container, linksOptions = p1.options.links;
4208
4225
  if (!linksOptions) {
4209
4226
  return;
@@ -4213,7 +4230,7 @@
4213
4230
  : container.particles.linksColor;
4214
4231
  return getLinkColor(p1, p2, linkColor);
4215
4232
  }
4216
- _setColor(p1) {
4233
+ #setColor(p1) {
4217
4234
  if (!p1.options.links) {
4218
4235
  return;
4219
4236
  }
@@ -4224,7 +4241,7 @@
4224
4241
  if (linkColor) {
4225
4242
  return;
4226
4243
  }
4227
- linkColor = getLinkRandomColor(this._pluginManager, linksOptions.color, linksOptions.blink, linksOptions.consent);
4244
+ linkColor = getLinkRandomColor(this.#pluginManager, linksOptions.color, linksOptions.blink, linksOptions.consent);
4228
4245
  if (linksOptions.id === undefined) {
4229
4246
  container.particles.linksColor = linkColor;
4230
4247
  }
@@ -4236,13 +4253,13 @@
4236
4253
 
4237
4254
  class LinksPlugin {
4238
4255
  id = "links";
4239
- _pluginManager;
4256
+ #pluginManager;
4240
4257
  constructor(pluginManager) {
4241
- this._pluginManager = pluginManager;
4258
+ this.#pluginManager = pluginManager;
4242
4259
  }
4243
4260
  async getPlugin(container) {
4244
4261
  const { LinkInstance } = await Promise.resolve().then(function () { return LinkInstance$1; });
4245
- return new LinkInstance(this._pluginManager, container);
4262
+ return new LinkInstance(this.#pluginManager, container);
4246
4263
  }
4247
4264
  loadOptions() {
4248
4265
  }
@@ -4252,7 +4269,7 @@
4252
4269
  }
4253
4270
 
4254
4271
  async function loadParticlesLinksInteraction(engine) {
4255
- engine.checkVersion("4.0.5");
4272
+ engine.checkVersion("4.1.1");
4256
4273
  await engine.pluginManager.register((e) => {
4257
4274
  const pluginManager = e.pluginManager;
4258
4275
  ensureInteractivityPluginLoaded(e);
@@ -4320,58 +4337,58 @@
4320
4337
  }
4321
4338
  }
4322
4339
  class RenderManager {
4323
- _canvasClearPlugins;
4324
- _canvasManager;
4325
- _canvasPaintPlugins;
4326
- _clearDrawPlugins;
4327
- _colorPlugins;
4328
- _container;
4329
- _context;
4330
- _contextSettings;
4331
- _drawParticlePlugins;
4332
- _drawParticlesCleanupPlugins;
4333
- _drawParticlesSetupPlugins;
4334
- _drawPlugins;
4335
- _drawSettingsCleanupPlugins;
4336
- _drawSettingsSetupPlugins;
4337
- _pluginManager;
4338
- _postDrawUpdaters;
4339
- _preDrawUpdaters;
4340
- _reusableColorStyles = {};
4341
- _reusablePluginColors = [undefined, undefined];
4342
- _reusableTransform = {};
4340
+ #canvasClearPlugins;
4341
+ #canvasManager;
4342
+ #canvasPaintPlugins;
4343
+ #clearDrawPlugins;
4344
+ #colorPlugins;
4345
+ #container;
4346
+ #context;
4347
+ #contextSettings;
4348
+ #drawParticlePlugins;
4349
+ #drawParticlesCleanupPlugins;
4350
+ #drawParticlesSetupPlugins;
4351
+ #drawPlugins;
4352
+ #drawSettingsCleanupPlugins;
4353
+ #drawSettingsSetupPlugins;
4354
+ #pluginManager;
4355
+ #postDrawUpdaters;
4356
+ #preDrawUpdaters;
4357
+ #reusableColorStyles = {};
4358
+ #reusablePluginColors = [undefined, undefined];
4359
+ #reusableTransform = {};
4343
4360
  constructor(pluginManager, container, canvasManager) {
4344
- this._pluginManager = pluginManager;
4345
- this._container = container;
4346
- this._canvasManager = canvasManager;
4347
- this._context = null;
4348
- this._preDrawUpdaters = [];
4349
- this._postDrawUpdaters = [];
4350
- this._colorPlugins = [];
4351
- this._canvasClearPlugins = [];
4352
- this._canvasPaintPlugins = [];
4353
- this._clearDrawPlugins = [];
4354
- this._drawParticlePlugins = [];
4355
- this._drawParticlesCleanupPlugins = [];
4356
- this._drawParticlesSetupPlugins = [];
4357
- this._drawPlugins = [];
4358
- this._drawSettingsSetupPlugins = [];
4359
- this._drawSettingsCleanupPlugins = [];
4361
+ this.#pluginManager = pluginManager;
4362
+ this.#container = container;
4363
+ this.#canvasManager = canvasManager;
4364
+ this.#context = null;
4365
+ this.#preDrawUpdaters = [];
4366
+ this.#postDrawUpdaters = [];
4367
+ this.#colorPlugins = [];
4368
+ this.#canvasClearPlugins = [];
4369
+ this.#canvasPaintPlugins = [];
4370
+ this.#clearDrawPlugins = [];
4371
+ this.#drawParticlePlugins = [];
4372
+ this.#drawParticlesCleanupPlugins = [];
4373
+ this.#drawParticlesSetupPlugins = [];
4374
+ this.#drawPlugins = [];
4375
+ this.#drawSettingsSetupPlugins = [];
4376
+ this.#drawSettingsCleanupPlugins = [];
4360
4377
  }
4361
4378
  get settings() {
4362
- return this._contextSettings;
4379
+ return this.#contextSettings;
4363
4380
  }
4364
4381
  canvasClear() {
4365
- if (!this._container.actualOptions.clear) {
4382
+ if (!this.#container.actualOptions.clear) {
4366
4383
  return;
4367
4384
  }
4368
4385
  this.draw(ctx => {
4369
- clear(ctx, this._canvasManager.size);
4386
+ clear(ctx, this.#canvasManager.size);
4370
4387
  });
4371
4388
  }
4372
4389
  clear() {
4373
4390
  let pluginHandled = false;
4374
- for (const plugin of this._canvasClearPlugins) {
4391
+ for (const plugin of this.#canvasClearPlugins) {
4375
4392
  pluginHandled = plugin.canvasClear?.() ?? false;
4376
4393
  if (pluginHandled) {
4377
4394
  break;
@@ -4384,21 +4401,21 @@
4384
4401
  }
4385
4402
  destroy() {
4386
4403
  this.stop();
4387
- this._preDrawUpdaters = [];
4388
- this._postDrawUpdaters = [];
4389
- this._colorPlugins = [];
4390
- this._canvasClearPlugins = [];
4391
- this._canvasPaintPlugins = [];
4392
- this._clearDrawPlugins = [];
4393
- this._drawParticlePlugins = [];
4394
- this._drawParticlesCleanupPlugins = [];
4395
- this._drawParticlesSetupPlugins = [];
4396
- this._drawPlugins = [];
4397
- this._drawSettingsSetupPlugins = [];
4398
- this._drawSettingsCleanupPlugins = [];
4404
+ this.#preDrawUpdaters = [];
4405
+ this.#postDrawUpdaters = [];
4406
+ this.#colorPlugins = [];
4407
+ this.#canvasClearPlugins = [];
4408
+ this.#canvasPaintPlugins = [];
4409
+ this.#clearDrawPlugins = [];
4410
+ this.#drawParticlePlugins = [];
4411
+ this.#drawParticlesCleanupPlugins = [];
4412
+ this.#drawParticlesSetupPlugins = [];
4413
+ this.#drawPlugins = [];
4414
+ this.#drawSettingsSetupPlugins = [];
4415
+ this.#drawSettingsCleanupPlugins = [];
4399
4416
  }
4400
4417
  draw(cb) {
4401
- const ctx = this._context;
4418
+ const ctx = this.#context;
4402
4419
  if (!ctx) {
4403
4420
  return;
4404
4421
  }
@@ -4413,21 +4430,21 @@
4413
4430
  return;
4414
4431
  }
4415
4432
  const pfColor = particle.getFillColor(), psColor = particle.getStrokeColor();
4416
- let [fColor, sColor] = this._getPluginParticleColors(particle);
4433
+ let [fColor, sColor] = this.#getPluginParticleColors(particle);
4417
4434
  fColor ??= pfColor;
4418
4435
  sColor ??= psColor;
4419
4436
  if (!fColor && !sColor) {
4420
4437
  return;
4421
4438
  }
4422
- const container = this._container, zIndexOptions = particle.options.zIndex, zIndexFactor = zIndexFactorOffset - particle.zIndexFactor, { fillOpacity, opacity, strokeOpacity } = particle.getOpacity(), transform = this._reusableTransform, colorStyles = this._reusableColorStyles, fill = fColor ? getStyleFromHsl(fColor, container.hdr, fillOpacity * opacity) : undefined, stroke = sColor ? getStyleFromHsl(sColor, container.hdr, strokeOpacity * opacity) : fill;
4439
+ const container = this.#container, zIndexOptions = particle.options.zIndex, zIndexFactor = zIndexFactorOffset - particle.zIndexFactor, { fillOpacity, opacity, strokeOpacity } = particle.getOpacity(), transform = this.#reusableTransform, colorStyles = this.#reusableColorStyles, fill = fColor ? getStyleFromHsl(fColor, container.hdr, fillOpacity * opacity) : undefined, stroke = sColor ? getStyleFromHsl(sColor, container.hdr, strokeOpacity * opacity) : fill;
4423
4440
  transform.a = transform.b = transform.c = transform.d = undefined;
4424
4441
  colorStyles.fill = fill;
4425
4442
  colorStyles.stroke = stroke;
4426
4443
  this.draw((context) => {
4427
- for (const plugin of this._drawParticlesSetupPlugins) {
4444
+ for (const plugin of this.#drawParticlesSetupPlugins) {
4428
4445
  plugin.drawParticleSetup?.(context, particle, delta);
4429
4446
  }
4430
- this._applyPreDrawUpdaters(context, particle, radius, opacity, colorStyles, transform);
4447
+ this.#applyPreDrawUpdaters(context, particle, radius, opacity, colorStyles, transform);
4431
4448
  drawParticle({
4432
4449
  container,
4433
4450
  context,
@@ -4438,35 +4455,35 @@
4438
4455
  opacity: opacity,
4439
4456
  transform,
4440
4457
  });
4441
- this._applyPostDrawUpdaters(particle);
4442
- for (const plugin of this._drawParticlesCleanupPlugins) {
4458
+ this.#applyPostDrawUpdaters(particle);
4459
+ for (const plugin of this.#drawParticlesCleanupPlugins) {
4443
4460
  plugin.drawParticleCleanup?.(context, particle, delta);
4444
4461
  }
4445
4462
  });
4446
4463
  }
4447
4464
  drawParticlePlugins(particle, delta) {
4448
4465
  this.draw(ctx => {
4449
- for (const plugin of this._drawParticlePlugins) {
4466
+ for (const plugin of this.#drawParticlePlugins) {
4450
4467
  drawParticlePlugin(ctx, plugin, particle, delta);
4451
4468
  }
4452
4469
  });
4453
4470
  }
4454
4471
  drawParticles(delta) {
4455
- const { particles } = this._container;
4472
+ const { particles } = this.#container;
4456
4473
  this.clear();
4457
4474
  particles.update(delta);
4458
4475
  this.draw(ctx => {
4459
- for (const plugin of this._drawSettingsSetupPlugins) {
4476
+ for (const plugin of this.#drawSettingsSetupPlugins) {
4460
4477
  plugin.drawSettingsSetup?.(ctx, delta);
4461
4478
  }
4462
- for (const plugin of this._drawPlugins) {
4479
+ for (const plugin of this.#drawPlugins) {
4463
4480
  plugin.draw?.(ctx, delta);
4464
4481
  }
4465
4482
  particles.drawParticles(delta);
4466
- for (const plugin of this._clearDrawPlugins) {
4483
+ for (const plugin of this.#clearDrawPlugins) {
4467
4484
  plugin.clearDraw?.(ctx, delta);
4468
4485
  }
4469
- for (const plugin of this._drawSettingsCleanupPlugins) {
4486
+ for (const plugin of this.#drawSettingsCleanupPlugins) {
4470
4487
  plugin.drawSettingsCleanup?.(ctx, delta);
4471
4488
  }
4472
4489
  });
@@ -4477,64 +4494,64 @@
4477
4494
  this.paint();
4478
4495
  }
4479
4496
  initPlugins() {
4480
- this._colorPlugins = [];
4481
- this._canvasClearPlugins = [];
4482
- this._canvasPaintPlugins = [];
4483
- this._clearDrawPlugins = [];
4484
- this._drawParticlePlugins = [];
4485
- this._drawParticlesSetupPlugins = [];
4486
- this._drawParticlesCleanupPlugins = [];
4487
- this._drawPlugins = [];
4488
- this._drawSettingsSetupPlugins = [];
4489
- this._drawSettingsCleanupPlugins = [];
4490
- for (const plugin of this._container.plugins) {
4497
+ this.#colorPlugins = [];
4498
+ this.#canvasClearPlugins = [];
4499
+ this.#canvasPaintPlugins = [];
4500
+ this.#clearDrawPlugins = [];
4501
+ this.#drawParticlePlugins = [];
4502
+ this.#drawParticlesSetupPlugins = [];
4503
+ this.#drawParticlesCleanupPlugins = [];
4504
+ this.#drawPlugins = [];
4505
+ this.#drawSettingsSetupPlugins = [];
4506
+ this.#drawSettingsCleanupPlugins = [];
4507
+ for (const plugin of this.#container.plugins) {
4491
4508
  if (plugin.particleFillColor ?? plugin.particleStrokeColor) {
4492
- this._colorPlugins.push(plugin);
4509
+ this.#colorPlugins.push(plugin);
4493
4510
  }
4494
4511
  if (plugin.canvasClear) {
4495
- this._canvasClearPlugins.push(plugin);
4512
+ this.#canvasClearPlugins.push(plugin);
4496
4513
  }
4497
4514
  if (plugin.canvasPaint) {
4498
- this._canvasPaintPlugins.push(plugin);
4515
+ this.#canvasPaintPlugins.push(plugin);
4499
4516
  }
4500
4517
  if (plugin.drawParticle) {
4501
- this._drawParticlePlugins.push(plugin);
4518
+ this.#drawParticlePlugins.push(plugin);
4502
4519
  }
4503
4520
  if (plugin.drawParticleSetup) {
4504
- this._drawParticlesSetupPlugins.push(plugin);
4521
+ this.#drawParticlesSetupPlugins.push(plugin);
4505
4522
  }
4506
4523
  if (plugin.drawParticleCleanup) {
4507
- this._drawParticlesCleanupPlugins.push(plugin);
4524
+ this.#drawParticlesCleanupPlugins.push(plugin);
4508
4525
  }
4509
4526
  if (plugin.draw) {
4510
- this._drawPlugins.push(plugin);
4527
+ this.#drawPlugins.push(plugin);
4511
4528
  }
4512
4529
  if (plugin.drawSettingsSetup) {
4513
- this._drawSettingsSetupPlugins.push(plugin);
4530
+ this.#drawSettingsSetupPlugins.push(plugin);
4514
4531
  }
4515
4532
  if (plugin.drawSettingsCleanup) {
4516
- this._drawSettingsCleanupPlugins.push(plugin);
4533
+ this.#drawSettingsCleanupPlugins.push(plugin);
4517
4534
  }
4518
4535
  if (plugin.clearDraw) {
4519
- this._clearDrawPlugins.push(plugin);
4536
+ this.#clearDrawPlugins.push(plugin);
4520
4537
  }
4521
4538
  }
4522
4539
  }
4523
4540
  initUpdaters() {
4524
- this._preDrawUpdaters = [];
4525
- this._postDrawUpdaters = [];
4526
- for (const updater of this._container.particleUpdaters) {
4541
+ this.#preDrawUpdaters = [];
4542
+ this.#postDrawUpdaters = [];
4543
+ for (const updater of this.#container.particleUpdaters) {
4527
4544
  if (updater.afterDraw) {
4528
- this._postDrawUpdaters.push(updater);
4545
+ this.#postDrawUpdaters.push(updater);
4529
4546
  }
4530
4547
  if (updater.getColorStyles ?? updater.getTransformValues ?? updater.beforeDraw) {
4531
- this._preDrawUpdaters.push(updater);
4548
+ this.#preDrawUpdaters.push(updater);
4532
4549
  }
4533
4550
  }
4534
4551
  }
4535
4552
  paint() {
4536
4553
  let handled = false;
4537
- for (const plugin of this._canvasPaintPlugins) {
4554
+ for (const plugin of this.#canvasPaintPlugins) {
4538
4555
  handled = plugin.canvasPaint?.() ?? false;
4539
4556
  if (handled) {
4540
4557
  break;
@@ -4547,35 +4564,35 @@
4547
4564
  }
4548
4565
  paintBase(baseColor) {
4549
4566
  this.draw(ctx => {
4550
- paintBase(ctx, this._canvasManager.size, baseColor);
4567
+ paintBase(ctx, this.#canvasManager.size, baseColor);
4551
4568
  });
4552
4569
  }
4553
4570
  paintImage(image, opacity) {
4554
4571
  this.draw(ctx => {
4555
- paintImage(ctx, this._canvasManager.size, image, opacity);
4572
+ paintImage(ctx, this.#canvasManager.size, image, opacity);
4556
4573
  });
4557
4574
  }
4558
4575
  setContext(context) {
4559
- this._context = context;
4560
- if (this._context) {
4561
- this._context.globalCompositeOperation = defaultCompositeValue;
4576
+ this.#context = context;
4577
+ if (this.#context) {
4578
+ this.#context.globalCompositeOperation = defaultCompositeValue;
4562
4579
  }
4563
4580
  }
4564
4581
  setContextSettings(settings) {
4565
- this._contextSettings = settings;
4582
+ this.#contextSettings = settings;
4566
4583
  }
4567
4584
  stop() {
4568
4585
  this.draw(ctx => {
4569
- clear(ctx, this._canvasManager.size);
4586
+ clear(ctx, this.#canvasManager.size);
4570
4587
  });
4571
4588
  }
4572
- _applyPostDrawUpdaters = particle => {
4573
- for (const updater of this._postDrawUpdaters) {
4589
+ #applyPostDrawUpdaters = particle => {
4590
+ for (const updater of this.#postDrawUpdaters) {
4574
4591
  updater.afterDraw?.(particle);
4575
4592
  }
4576
4593
  };
4577
- _applyPreDrawUpdaters = (ctx, particle, radius, zOpacity, colorStyles, transform) => {
4578
- for (const updater of this._preDrawUpdaters) {
4594
+ #applyPreDrawUpdaters = (ctx, particle, radius, zOpacity, colorStyles, transform) => {
4595
+ for (const updater of this.#preDrawUpdaters) {
4579
4596
  if (updater.getColorStyles) {
4580
4597
  const { fill, stroke } = updater.getColorStyles(particle, ctx, radius, zOpacity);
4581
4598
  if (fill) {
@@ -4594,22 +4611,22 @@
4594
4611
  updater.beforeDraw?.(particle);
4595
4612
  }
4596
4613
  };
4597
- _getPluginParticleColors = particle => {
4614
+ #getPluginParticleColors = particle => {
4598
4615
  let fColor, sColor;
4599
- for (const plugin of this._colorPlugins) {
4616
+ for (const plugin of this.#colorPlugins) {
4600
4617
  if (!fColor && plugin.particleFillColor) {
4601
- fColor = rangeColorToHsl(this._pluginManager, plugin.particleFillColor(particle));
4618
+ fColor = rangeColorToHsl(this.#pluginManager, plugin.particleFillColor(particle));
4602
4619
  }
4603
4620
  if (!sColor && plugin.particleStrokeColor) {
4604
- sColor = rangeColorToHsl(this._pluginManager, plugin.particleStrokeColor(particle));
4621
+ sColor = rangeColorToHsl(this.#pluginManager, plugin.particleStrokeColor(particle));
4605
4622
  }
4606
4623
  if (fColor && sColor) {
4607
4624
  break;
4608
4625
  }
4609
4626
  }
4610
- this._reusablePluginColors[fColorIndex] = fColor;
4611
- this._reusablePluginColors[sColorIndex] = sColor;
4612
- return this._reusablePluginColors;
4627
+ this.#reusablePluginColors[fColorIndex] = fColor;
4628
+ this.#reusablePluginColors[sColorIndex] = sColor;
4629
+ return this.#reusablePluginColors;
4613
4630
  };
4614
4631
  }
4615
4632
 
@@ -4667,53 +4684,53 @@
4667
4684
  renderCanvas;
4668
4685
  size;
4669
4686
  zoom = defaultZoom;
4670
- _container;
4671
- _generated;
4672
- _mutationObserver;
4673
- _originalStyle;
4674
- _pluginManager;
4675
- _pointerEvents;
4676
- _resizePlugins;
4677
- _standardSize;
4678
- _zoomCenter;
4687
+ #container;
4688
+ #generated;
4689
+ #mutationObserver;
4690
+ #originalStyle;
4691
+ #pluginManager;
4692
+ #pointerEvents;
4693
+ #resizePlugins;
4694
+ #standardSize;
4695
+ #zoomCenter;
4679
4696
  constructor(pluginManager, container) {
4680
- this._pluginManager = pluginManager;
4681
- this._container = container;
4697
+ this.#pluginManager = pluginManager;
4698
+ this.#container = container;
4682
4699
  this.render = new RenderManager(pluginManager, container, this);
4683
- this._standardSize = {
4700
+ this.#standardSize = {
4684
4701
  height: 0,
4685
4702
  width: 0,
4686
4703
  };
4687
- const pxRatio = container.retina.pixelRatio, stdSize = this._standardSize;
4704
+ const pxRatio = container.retina.pixelRatio, stdSize = this.#standardSize;
4688
4705
  this.size = {
4689
4706
  height: stdSize.height * pxRatio,
4690
4707
  width: stdSize.width * pxRatio,
4691
4708
  };
4692
- this._generated = false;
4693
- this._resizePlugins = [];
4694
- this._pointerEvents = "none";
4709
+ this.#generated = false;
4710
+ this.#resizePlugins = [];
4711
+ this.#pointerEvents = "none";
4695
4712
  }
4696
- get _fullScreen() {
4697
- return this._container.actualOptions.fullScreen.enable;
4713
+ get #fullScreen() {
4714
+ return this.#container.actualOptions.fullScreen.enable;
4698
4715
  }
4699
4716
  destroy() {
4700
4717
  this.stop();
4701
- if (this._generated) {
4718
+ if (this.#generated) {
4702
4719
  const element = this.domElement;
4703
4720
  element?.remove();
4704
4721
  this.domElement = undefined;
4705
4722
  this.renderCanvas = undefined;
4706
4723
  }
4707
4724
  else {
4708
- this._resetOriginalStyle();
4725
+ this.#resetOriginalStyle();
4709
4726
  }
4710
4727
  this.render.destroy();
4711
- this._resizePlugins = [];
4728
+ this.#resizePlugins = [];
4712
4729
  }
4713
4730
  getZoomCenter() {
4714
- const pxRatio = this._container.retina.pixelRatio, { width, height } = this.size;
4715
- if (this._zoomCenter) {
4716
- return this._zoomCenter;
4731
+ const pxRatio = this.#container.retina.pixelRatio, { width, height } = this.size;
4732
+ if (this.#zoomCenter) {
4733
+ return this.#zoomCenter;
4717
4734
  }
4718
4735
  return {
4719
4736
  x: (width * half) / pxRatio,
@@ -4721,20 +4738,20 @@
4721
4738
  };
4722
4739
  }
4723
4740
  init() {
4724
- this._safeMutationObserver(obs => {
4741
+ this.#safeMutationObserver(obs => {
4725
4742
  obs.disconnect();
4726
4743
  });
4727
- this._mutationObserver = safeMutationObserver(records => {
4744
+ this.#mutationObserver = safeMutationObserver(records => {
4728
4745
  for (const record of records) {
4729
4746
  if (record.type === "attributes" && record.attributeName === "style") {
4730
- this._repairStyle();
4747
+ this.#repairStyle();
4731
4748
  }
4732
4749
  }
4733
4750
  });
4734
4751
  this.resize();
4735
- this._initStyle();
4752
+ this.#initStyle();
4736
4753
  this.initBackground();
4737
- this._safeMutationObserver(obs => {
4754
+ this.#safeMutationObserver(obs => {
4738
4755
  const element = this.domElement;
4739
4756
  if (!element || !(element instanceof Node)) {
4740
4757
  return;
@@ -4745,13 +4762,13 @@
4745
4762
  this.render.init();
4746
4763
  }
4747
4764
  initBackground() {
4748
- const { _container } = this, options = _container.actualOptions, background = options.background, element = this.domElement;
4765
+ const container = this.#container, options = container.actualOptions, background = options.background, element = this.domElement;
4749
4766
  if (!element) {
4750
4767
  return;
4751
4768
  }
4752
- const elementStyle = element.style, color = rangeColorToRgb(this._pluginManager, background.color);
4769
+ const elementStyle = element.style, color = rangeColorToRgb(this.#pluginManager, background.color);
4753
4770
  if (color) {
4754
- elementStyle.backgroundColor = getStyleFromRgb(color, _container.hdr, background.opacity);
4771
+ elementStyle.backgroundColor = getStyleFromRgb(color, container.hdr, background.opacity);
4755
4772
  }
4756
4773
  else {
4757
4774
  elementStyle.backgroundColor = "";
@@ -4762,27 +4779,27 @@
4762
4779
  elementStyle.backgroundSize = background.size || "";
4763
4780
  }
4764
4781
  initPlugins() {
4765
- this._resizePlugins = [];
4766
- for (const plugin of this._container.plugins) {
4782
+ this.#resizePlugins = [];
4783
+ for (const plugin of this.#container.plugins) {
4767
4784
  if (plugin.resize) {
4768
- this._resizePlugins.push(plugin);
4785
+ this.#resizePlugins.push(plugin);
4769
4786
  }
4770
4787
  }
4771
4788
  }
4772
4789
  loadCanvas(canvas) {
4773
- if (this._generated && this.domElement) {
4790
+ if (this.#generated && this.domElement) {
4774
4791
  this.domElement.remove();
4775
4792
  }
4776
- const container = this._container, domCanvas = isHtmlCanvasElement(canvas) ? canvas : undefined;
4793
+ const container = this.#container, domCanvas = isHtmlCanvasElement(canvas) ? canvas : undefined;
4777
4794
  this.domElement = domCanvas;
4778
- this._generated = domCanvas ? domCanvas.dataset[generatedAttribute] === "true" : false;
4795
+ this.#generated = domCanvas ? domCanvas.dataset[generatedAttribute] === "true" : false;
4779
4796
  this.renderCanvas = domCanvas ? getTransferredCanvas(domCanvas) : canvas;
4780
4797
  const domElement = this.domElement;
4781
4798
  if (domElement) {
4782
4799
  domElement.ariaHidden = "true";
4783
- this._originalStyle = cloneStyle(domElement.style);
4800
+ this.#originalStyle = cloneStyle(domElement.style);
4784
4801
  }
4785
- const standardSize = this._standardSize, renderCanvas = this.renderCanvas;
4802
+ const standardSize = this.#standardSize, renderCanvas = this.renderCanvas;
4786
4803
  if (domElement) {
4787
4804
  standardSize.height = domElement.offsetHeight;
4788
4805
  standardSize.width = domElement.offsetWidth;
@@ -4791,7 +4808,7 @@
4791
4808
  standardSize.height = renderCanvas.height;
4792
4809
  standardSize.width = renderCanvas.width;
4793
4810
  }
4794
- const pxRatio = this._container.retina.pixelRatio, retinaSize = this.size;
4811
+ const pxRatio = this.#container.retina.pixelRatio, retinaSize = this.size;
4795
4812
  renderCanvas.height = retinaSize.height = standardSize.height * pxRatio;
4796
4813
  renderCanvas.width = retinaSize.width = standardSize.width * pxRatio;
4797
4814
  const canSupportHdrQuery = safeMatchMedia("(color-gamut: p3)");
@@ -4802,12 +4819,12 @@
4802
4819
  willReadFrequently: false,
4803
4820
  });
4804
4821
  this.render.setContext(renderCanvas.getContext("2d", this.render.settings));
4805
- this._safeMutationObserver(obs => {
4822
+ this.#safeMutationObserver(obs => {
4806
4823
  obs.disconnect();
4807
4824
  });
4808
4825
  container.retina.init();
4809
4826
  this.initBackground();
4810
- this._safeMutationObserver(obs => {
4827
+ this.#safeMutationObserver(obs => {
4811
4828
  const element = this.domElement;
4812
4829
  if (!element || !(element instanceof Node)) {
4813
4830
  return;
@@ -4820,11 +4837,11 @@
4820
4837
  if (!element) {
4821
4838
  return false;
4822
4839
  }
4823
- const container = this._container, renderCanvas = this.renderCanvas;
4840
+ const container = this.#container, renderCanvas = this.renderCanvas;
4824
4841
  if (renderCanvas === undefined) {
4825
4842
  return false;
4826
4843
  }
4827
- const currentSize = container.canvas._standardSize, newSize = {
4844
+ const currentSize = container.canvas.#standardSize, newSize = {
4828
4845
  width: element.offsetWidth,
4829
4846
  height: element.offsetHeight,
4830
4847
  }, pxRatio = container.retina.pixelRatio, retinaSize = {
@@ -4843,7 +4860,7 @@
4843
4860
  const canvasSize = this.size;
4844
4861
  renderCanvas.width = canvasSize.width = retinaSize.width;
4845
4862
  renderCanvas.height = canvasSize.height = retinaSize.height;
4846
- if (this._container.started) {
4863
+ if (this.#container.started) {
4847
4864
  container.particles.setResizeFactor({
4848
4865
  width: currentSize.width / oldSize.width,
4849
4866
  height: currentSize.height / oldSize.height,
@@ -4856,46 +4873,46 @@
4856
4873
  if (!element) {
4857
4874
  return;
4858
4875
  }
4859
- this._pointerEvents = type;
4860
- this._repairStyle();
4876
+ this.#pointerEvents = type;
4877
+ this.#repairStyle();
4861
4878
  }
4862
4879
  setZoom(zoomLevel, center) {
4863
4880
  this.zoom = zoomLevel;
4864
- this._zoomCenter = center;
4881
+ this.#zoomCenter = center;
4865
4882
  }
4866
4883
  stop() {
4867
- this._safeMutationObserver(obs => {
4884
+ this.#safeMutationObserver(obs => {
4868
4885
  obs.disconnect();
4869
4886
  });
4870
- this._mutationObserver = undefined;
4887
+ this.#mutationObserver = undefined;
4871
4888
  this.render.stop();
4872
4889
  }
4873
4890
  async windowResize() {
4874
4891
  if (!this.domElement || !this.resize()) {
4875
4892
  return;
4876
4893
  }
4877
- const container = this._container, needsRefresh = container.updateActualOptions();
4894
+ const container = this.#container, needsRefresh = container.updateActualOptions();
4878
4895
  container.particles.setDensity();
4879
- this._applyResizePlugins();
4896
+ this.#applyResizePlugins();
4880
4897
  if (needsRefresh) {
4881
4898
  await container.refresh();
4882
4899
  }
4883
4900
  }
4884
- _applyResizePlugins = () => {
4885
- for (const plugin of this._resizePlugins) {
4901
+ #applyResizePlugins = () => {
4902
+ for (const plugin of this.#resizePlugins) {
4886
4903
  plugin.resize?.();
4887
4904
  }
4888
4905
  };
4889
- _initStyle = () => {
4890
- const element = this.domElement, options = this._container.actualOptions;
4906
+ #initStyle = () => {
4907
+ const element = this.domElement, options = this.#container.actualOptions;
4891
4908
  if (!element) {
4892
4909
  return;
4893
4910
  }
4894
- if (this._fullScreen) {
4895
- this._setFullScreenStyle();
4911
+ if (this.#fullScreen) {
4912
+ this.#setFullScreenStyle();
4896
4913
  }
4897
4914
  else {
4898
- this._resetOriginalStyle();
4915
+ this.#resetOriginalStyle();
4899
4916
  }
4900
4917
  for (const key in options.style) {
4901
4918
  if (!key || !(key in options.style)) {
@@ -4908,72 +4925,72 @@
4908
4925
  element.style.setProperty(key, value, "important");
4909
4926
  }
4910
4927
  };
4911
- _repairStyle = () => {
4928
+ #repairStyle = () => {
4912
4929
  const element = this.domElement;
4913
4930
  if (!element) {
4914
4931
  return;
4915
4932
  }
4916
- this._safeMutationObserver(observer => {
4933
+ this.#safeMutationObserver(observer => {
4917
4934
  observer.disconnect();
4918
4935
  });
4919
- this._initStyle();
4936
+ this.#initStyle();
4920
4937
  this.initBackground();
4921
- const pointerEvents = this._pointerEvents;
4938
+ const pointerEvents = this.#pointerEvents;
4922
4939
  element.style.pointerEvents = pointerEvents;
4923
4940
  element.style.setProperty("pointer-events", pointerEvents);
4924
- this._safeMutationObserver(observer => {
4941
+ this.#safeMutationObserver(observer => {
4925
4942
  if (!(element instanceof Node)) {
4926
4943
  return;
4927
4944
  }
4928
4945
  observer.observe(element, { attributes: true });
4929
4946
  });
4930
4947
  };
4931
- _resetOriginalStyle = () => {
4932
- const element = this.domElement, originalStyle = this._originalStyle;
4948
+ #resetOriginalStyle = () => {
4949
+ const element = this.domElement, originalStyle = this.#originalStyle;
4933
4950
  if (!element || !originalStyle) {
4934
4951
  return;
4935
4952
  }
4936
4953
  setStyle(element, originalStyle, true);
4937
4954
  };
4938
- _safeMutationObserver = callback => {
4939
- if (!this._mutationObserver) {
4955
+ #safeMutationObserver = callback => {
4956
+ if (!this.#mutationObserver) {
4940
4957
  return;
4941
4958
  }
4942
- callback(this._mutationObserver);
4959
+ callback(this.#mutationObserver);
4943
4960
  };
4944
- _setFullScreenStyle = () => {
4961
+ #setFullScreenStyle = () => {
4945
4962
  const element = this.domElement;
4946
4963
  if (!element) {
4947
4964
  return;
4948
4965
  }
4949
- setStyle(element, getFullScreenStyle(this._container.actualOptions.fullScreen.zIndex), true);
4966
+ setStyle(element, getFullScreenStyle(this.#container.actualOptions.fullScreen.zIndex), true);
4950
4967
  };
4951
4968
  }
4952
4969
 
4953
4970
  class EventListeners {
4954
- container;
4955
- _handlers;
4956
- _resizeObserver;
4957
- _resizeTimeout;
4971
+ #container;
4972
+ #handlers;
4973
+ #resizeObserver;
4974
+ #resizeTimeout;
4958
4975
  constructor(container) {
4959
- this.container = container;
4960
- this._handlers = {
4976
+ this.#container = container;
4977
+ this.#handlers = {
4961
4978
  visibilityChange: () => {
4962
- this._handleVisibilityChange();
4979
+ this.#handleVisibilityChange();
4963
4980
  },
4964
4981
  resize: () => {
4965
- this._handleWindowResize();
4982
+ this.#handleWindowResize();
4966
4983
  },
4967
4984
  };
4968
4985
  }
4969
4986
  addListeners() {
4970
- this._manageListeners(true);
4987
+ this.#manageListeners(true);
4971
4988
  }
4972
4989
  removeListeners() {
4973
- this._manageListeners(false);
4990
+ this.#manageListeners(false);
4974
4991
  }
4975
- _handleVisibilityChange = () => {
4976
- const container = this.container, options = container.actualOptions;
4992
+ #handleVisibilityChange = () => {
4993
+ const container = this.#container, options = container.actualOptions;
4977
4994
  if (!options.pauseOnBlur) {
4978
4995
  return;
4979
4996
  }
@@ -4991,24 +5008,24 @@
4991
5008
  }
4992
5009
  }
4993
5010
  };
4994
- _handleWindowResize = () => {
4995
- if (this._resizeTimeout) {
4996
- clearTimeout(this._resizeTimeout);
4997
- delete this._resizeTimeout;
5011
+ #handleWindowResize = () => {
5012
+ if (this.#resizeTimeout) {
5013
+ clearTimeout(this.#resizeTimeout);
5014
+ this.#resizeTimeout = undefined;
4998
5015
  }
4999
5016
  const handleResize = async () => {
5000
- const canvas = this.container.canvas;
5017
+ const canvas = this.#container.canvas;
5001
5018
  await canvas.windowResize();
5002
5019
  };
5003
- this._resizeTimeout = setTimeout(() => void handleResize(), this.container.actualOptions.resize.delay * millisecondsToSeconds);
5020
+ this.#resizeTimeout = setTimeout(() => void handleResize(), this.#container.actualOptions.resize.delay * millisecondsToSeconds);
5004
5021
  };
5005
- _manageListeners = add => {
5006
- const handlers = this._handlers;
5007
- this._manageResize(add);
5022
+ #manageListeners = add => {
5023
+ const handlers = this.#handlers;
5024
+ this.#manageResize(add);
5008
5025
  manageListener(document, visibilityChangeEvent, handlers.visibilityChange, add, false);
5009
5026
  };
5010
- _manageResize = add => {
5011
- const handlers = this._handlers, container = this.container, options = container.actualOptions;
5027
+ #manageResize = add => {
5028
+ const handlers = this.#handlers, container = this.#container, options = container.actualOptions;
5012
5029
  if (!options.resize.enable) {
5013
5030
  return;
5014
5031
  }
@@ -5017,22 +5034,22 @@
5017
5034
  return;
5018
5035
  }
5019
5036
  const canvasEl = container.canvas.domElement;
5020
- if (this._resizeObserver && !add) {
5037
+ if (this.#resizeObserver && !add) {
5021
5038
  if (canvasEl) {
5022
- this._resizeObserver.unobserve(canvasEl);
5039
+ this.#resizeObserver.unobserve(canvasEl);
5023
5040
  }
5024
- this._resizeObserver.disconnect();
5025
- delete this._resizeObserver;
5041
+ this.#resizeObserver.disconnect();
5042
+ this.#resizeObserver = undefined;
5026
5043
  }
5027
- else if (!this._resizeObserver && add && canvasEl) {
5028
- this._resizeObserver = new ResizeObserver((entries) => {
5044
+ else if (!this.#resizeObserver && add && canvasEl) {
5045
+ this.#resizeObserver = new ResizeObserver((entries) => {
5029
5046
  const entry = entries.find(e => e.target === canvasEl);
5030
5047
  if (!entry) {
5031
5048
  return;
5032
5049
  }
5033
- this._handleWindowResize();
5050
+ this.#handleWindowResize();
5034
5051
  });
5035
- this._resizeObserver.observe(canvasEl);
5052
+ this.#resizeObserver.observe(canvasEl);
5036
5053
  }
5037
5054
  };
5038
5055
  }
@@ -5105,24 +5122,24 @@
5105
5122
  unbreakable;
5106
5123
  velocity;
5107
5124
  zIndexFactor;
5108
- _cachedOpacityData = {
5125
+ #cachedOpacityData = {
5109
5126
  fillOpacity: defaultOpacity$1,
5110
5127
  opacity: defaultOpacity$1,
5111
5128
  strokeOpacity: defaultOpacity$1,
5112
5129
  };
5113
- _cachedPosition = Vector3d.origin;
5114
- _cachedRotateData = { sin: 0, cos: 0 };
5115
- _cachedTransform = {
5130
+ #cachedPosition = Vector3d.origin;
5131
+ #cachedRotateData = { sin: 0, cos: 0 };
5132
+ #cachedTransform = {
5116
5133
  a: 1,
5117
5134
  b: 0,
5118
5135
  c: 0,
5119
5136
  d: 1,
5120
5137
  };
5121
- _container;
5122
- _pluginManager;
5138
+ #container;
5139
+ #pluginManager;
5123
5140
  constructor(pluginManager, container) {
5124
- this._pluginManager = pluginManager;
5125
- this._container = container;
5141
+ this.#pluginManager = pluginManager;
5142
+ this.#container = container;
5126
5143
  }
5127
5144
  destroy(override) {
5128
5145
  if (this.unbreakable || this.destroyed) {
@@ -5131,7 +5148,7 @@
5131
5148
  this.destroyed = true;
5132
5149
  this.bubble.inRange = false;
5133
5150
  this.slow.inRange = false;
5134
- const container = this._container, shapeDrawer = this.shape ? container.shapeDrawers.get(this.shape) : undefined;
5151
+ const container = this.#container, shapeDrawer = this.shape ? container.shapeDrawers.get(this.shape) : undefined;
5135
5152
  shapeDrawer?.particleDestroy?.(this);
5136
5153
  for (const plugin of container.particleDestroyedPlugins) {
5137
5154
  plugin.particleDestroyed?.(this, override);
@@ -5139,12 +5156,12 @@
5139
5156
  for (const updater of container.particleUpdaters) {
5140
5157
  updater.particleDestroyed?.(this, override);
5141
5158
  }
5142
- this._container.dispatchEvent(EventType.particleDestroyed, {
5159
+ this.#container.dispatchEvent(EventType.particleDestroyed, {
5143
5160
  particle: this,
5144
5161
  });
5145
5162
  }
5146
5163
  draw(delta) {
5147
- const container = this._container, render = container.canvas.render;
5164
+ const container = this.#container, render = container.canvas.render;
5148
5165
  render.drawParticlePlugins(this, delta);
5149
5166
  render.drawParticle(this, delta);
5150
5167
  }
@@ -5152,50 +5169,50 @@
5152
5169
  return this.rotation + (this.pathRotation ? this.velocity.angle : defaultAngle);
5153
5170
  }
5154
5171
  getFillColor() {
5155
- return this._getRollColor(this.bubble.color ?? getHslFromAnimation(this.fillColor));
5172
+ return this.#getRollColor(this.bubble.color ?? getHslFromAnimation(this.fillColor));
5156
5173
  }
5157
5174
  getMass() {
5158
5175
  return this.getRadius() ** squareExp * Math.PI * half;
5159
5176
  }
5160
5177
  getOpacity() {
5161
5178
  const zIndexOptions = this.options.zIndex, zIndexFactor = zIndexFactorOffset - this.zIndexFactor, zOpacityFactor = zIndexFactor ** zIndexOptions.opacityRate, opacity = this.bubble.opacity ?? getRangeValue(this.opacity?.value ?? defaultOpacity$1), fillOpacity = this.fillOpacity ?? defaultOpacity$1, strokeOpacity = this.strokeOpacity ?? defaultOpacity$1;
5162
- this._cachedOpacityData.fillOpacity = opacity * fillOpacity * zOpacityFactor;
5163
- this._cachedOpacityData.opacity = opacity * zOpacityFactor;
5164
- this._cachedOpacityData.strokeOpacity = opacity * strokeOpacity * zOpacityFactor;
5165
- return this._cachedOpacityData;
5179
+ this.#cachedOpacityData.fillOpacity = opacity * fillOpacity * zOpacityFactor;
5180
+ this.#cachedOpacityData.opacity = opacity * zOpacityFactor;
5181
+ this.#cachedOpacityData.strokeOpacity = opacity * strokeOpacity * zOpacityFactor;
5182
+ return this.#cachedOpacityData;
5166
5183
  }
5167
5184
  getPosition() {
5168
- this._cachedPosition.x = this.position.x + this.offset.x;
5169
- this._cachedPosition.y = this.position.y + this.offset.y;
5170
- this._cachedPosition.z = this.position.z;
5171
- return this._cachedPosition;
5185
+ this.#cachedPosition.x = this.position.x + this.offset.x;
5186
+ this.#cachedPosition.y = this.position.y + this.offset.y;
5187
+ this.#cachedPosition.z = this.position.z;
5188
+ return this.#cachedPosition;
5172
5189
  }
5173
5190
  getRadius() {
5174
5191
  return this.bubble.radius ?? this.size.value;
5175
5192
  }
5176
5193
  getRotateData() {
5177
5194
  const angle = this.getAngle();
5178
- this._cachedRotateData.sin = Math.sin(angle);
5179
- this._cachedRotateData.cos = Math.cos(angle);
5180
- return this._cachedRotateData;
5195
+ this.#cachedRotateData.sin = Math.sin(angle);
5196
+ this.#cachedRotateData.cos = Math.cos(angle);
5197
+ return this.#cachedRotateData;
5181
5198
  }
5182
5199
  getStrokeColor() {
5183
- return this._getRollColor(this.bubble.color ?? getHslFromAnimation(this.strokeColor));
5200
+ return this.#getRollColor(this.bubble.color ?? getHslFromAnimation(this.strokeColor));
5184
5201
  }
5185
5202
  getTransformData(externalTransform) {
5186
5203
  const rotateData = this.getRotateData(), rotating = this.isRotating;
5187
- this._cachedTransform.a = rotateData.cos * (externalTransform.a ?? defaultTransform.a);
5188
- this._cachedTransform.b = rotating
5204
+ this.#cachedTransform.a = rotateData.cos * (externalTransform.a ?? defaultTransform.a);
5205
+ this.#cachedTransform.b = rotating
5189
5206
  ? rotateData.sin * (externalTransform.b ?? identity$1)
5190
5207
  : (externalTransform.b ?? defaultTransform.b);
5191
- this._cachedTransform.c = rotating
5208
+ this.#cachedTransform.c = rotating
5192
5209
  ? -rotateData.sin * (externalTransform.c ?? identity$1)
5193
5210
  : (externalTransform.c ?? defaultTransform.c);
5194
- this._cachedTransform.d = rotateData.cos * (externalTransform.d ?? defaultTransform.d);
5195
- return this._cachedTransform;
5211
+ this.#cachedTransform.d = rotateData.cos * (externalTransform.d ?? defaultTransform.d);
5212
+ return this.#cachedTransform;
5196
5213
  }
5197
5214
  init(id, position, overrideOptions, group) {
5198
- const container = this._container;
5215
+ const container = this.#container;
5199
5216
  this.id = id;
5200
5217
  this.group = group;
5201
5218
  this.justWarped = false;
@@ -5215,21 +5232,27 @@
5215
5232
  moveSpeed: 0,
5216
5233
  sizeAnimationSpeed: 0,
5217
5234
  };
5235
+ this.size = {
5236
+ value: 1,
5237
+ max: 1,
5238
+ min: 1,
5239
+ enable: false,
5240
+ };
5218
5241
  this.outType = ParticleOutType.normal;
5219
5242
  this.ignoresResizeRatio = true;
5220
- const pxRatio = container.retina.pixelRatio, mainOptions = container.actualOptions, particlesOptions = loadParticlesOptions(this._pluginManager, container, mainOptions.particles), reduceDuplicates = particlesOptions.reduceDuplicates, effectType = particlesOptions.effect.type, shapeType = particlesOptions.shape.type;
5243
+ const mainOptions = container.actualOptions, particlesOptions = loadParticlesOptions(this.#pluginManager, container, mainOptions.particles), reduceDuplicates = particlesOptions.reduceDuplicates, effectType = particlesOptions.effect.type, shapeType = particlesOptions.shape.type;
5221
5244
  this.effect = itemFromSingleOrMultiple(effectType, this.id, reduceDuplicates);
5222
5245
  this.shape = itemFromSingleOrMultiple(shapeType, this.id, reduceDuplicates);
5223
5246
  const effectOptions = particlesOptions.effect, shapeOptions = particlesOptions.shape;
5224
5247
  if (overrideOptions) {
5225
- if (overrideOptions.effect?.type) {
5248
+ if (overrideOptions.effect?.type && overrideOptions.effect.type !== this.effect) {
5226
5249
  const overrideEffectType = overrideOptions.effect.type, effect = itemFromSingleOrMultiple(overrideEffectType, this.id, reduceDuplicates);
5227
5250
  if (effect) {
5228
5251
  this.effect = effect;
5229
5252
  effectOptions.load(overrideOptions.effect);
5230
5253
  }
5231
5254
  }
5232
- if (overrideOptions.shape?.type) {
5255
+ if (overrideOptions.shape?.type && overrideOptions.shape.type !== this.shape) {
5233
5256
  const overrideShapeType = overrideOptions.shape.type, shape = itemFromSingleOrMultiple(overrideShapeType, this.id, reduceDuplicates);
5234
5257
  if (shape) {
5235
5258
  this.shape = shape;
@@ -5238,21 +5261,20 @@
5238
5261
  }
5239
5262
  }
5240
5263
  if (this.effect === randomColorValue) {
5241
- const availableEffects = [...this._container.effectDrawers.keys()];
5264
+ const availableEffects = [...this.#container.effectDrawers.keys()];
5242
5265
  this.effect = availableEffects[Math.floor(getRandom() * availableEffects.length)];
5243
5266
  }
5244
5267
  if (this.shape === randomColorValue) {
5245
- const availableShapes = [...this._container.shapeDrawers.keys()];
5268
+ const availableShapes = [...this.#container.shapeDrawers.keys()];
5246
5269
  this.shape = availableShapes[Math.floor(getRandom() * availableShapes.length)];
5247
5270
  }
5248
5271
  this.effectData = this.effect ? loadEffectData(this.effect, effectOptions, this.id, reduceDuplicates) : undefined;
5249
5272
  this.shapeData = this.shape ? loadShapeData(this.shape, shapeOptions, this.id, reduceDuplicates) : undefined;
5250
5273
  particlesOptions.load(overrideOptions);
5251
- const effectData = this.effectData;
5274
+ const effectData = this.effectData, shapeData = this.shapeData;
5252
5275
  if (effectData) {
5253
5276
  particlesOptions.load(effectData.particles);
5254
5277
  }
5255
- const shapeData = this.shapeData;
5256
5278
  if (shapeData) {
5257
5279
  particlesOptions.load(shapeData.particles);
5258
5280
  }
@@ -5260,7 +5282,9 @@
5260
5282
  this.shapeClose = shapeData?.close ?? particlesOptions.shape.close;
5261
5283
  this.options = particlesOptions;
5262
5284
  container.retina.initParticle(this);
5263
- this.size = initParticleNumericAnimationValue(this.options.size, pxRatio);
5285
+ for (const updater of container.particleUpdaters) {
5286
+ updater.preInit?.(this);
5287
+ }
5264
5288
  this.bubble = {
5265
5289
  inRange: false,
5266
5290
  };
@@ -5268,8 +5292,8 @@
5268
5292
  inRange: false,
5269
5293
  factor: 1,
5270
5294
  };
5271
- this._initPosition(position);
5272
- this.initialVelocity = this._calculateVelocity();
5295
+ this.#initPosition(position);
5296
+ this.initialVelocity = this.#calculateVelocity();
5273
5297
  this.velocity = this.initialVelocity.copy();
5274
5298
  this.zIndexFactor = this.position.z / container.zLayers;
5275
5299
  this.sides = 24;
@@ -5300,12 +5324,11 @@
5300
5324
  plugin.particleCreated?.(this);
5301
5325
  }
5302
5326
  }
5303
- isInsideCanvas() {
5304
- const radius = this.getRadius(), canvasSize = this._container.canvas.size, position = this.position;
5305
- return (position.x >= -radius &&
5306
- position.y >= -radius &&
5307
- position.y <= canvasSize.height + radius &&
5308
- position.x <= canvasSize.width + radius);
5327
+ isInsideCanvas(direction) {
5328
+ return this.#getInsideCanvasResult({ direction }).inside;
5329
+ }
5330
+ isInsideCanvasForOutMode(outMode, direction) {
5331
+ return this.#getInsideCanvasResult({ direction, outMode }).inside;
5309
5332
  }
5310
5333
  isShowingBack() {
5311
5334
  if (!this.roll) {
@@ -5330,13 +5353,13 @@
5330
5353
  return !this.destroyed && !this.spawning && this.isInsideCanvas();
5331
5354
  }
5332
5355
  reset() {
5333
- for (const updater of this._container.particleUpdaters) {
5356
+ for (const updater of this.#container.particleUpdaters) {
5334
5357
  updater.reset?.(this);
5335
5358
  }
5336
5359
  }
5337
- _calcPosition = (position, zIndex) => {
5360
+ #calcPosition = (position, zIndex) => {
5338
5361
  let tryCount = defaultRetryCount, posVec = position ? Vector3d.create(position.x, position.y, zIndex) : undefined;
5339
- const container = this._container, plugins = container.particlePositionPlugins, outModes = this.options.move.outModes, radius = this.getRadius(), canvasSize = container.canvas.size, abortController = new AbortController(), { signal } = abortController;
5362
+ const container = this.#container, plugins = container.particlePositionPlugins, outModes = this.options.move.outModes, radius = this.getRadius(), canvasSize = container.canvas.size, abortController = new AbortController(), { signal } = abortController;
5340
5363
  while (!signal.aborted) {
5341
5364
  for (const plugin of plugins) {
5342
5365
  const pluginPos = plugin.particlePosition?.(posVec, this);
@@ -5348,10 +5371,10 @@
5348
5371
  size: canvasSize,
5349
5372
  position: posVec,
5350
5373
  }), pos = Vector3d.create(exactPosition.x, exactPosition.y, zIndex);
5351
- this._fixHorizontal(pos, radius, outModes.left ?? outModes.default);
5352
- this._fixHorizontal(pos, radius, outModes.right ?? outModes.default);
5353
- this._fixVertical(pos, radius, outModes.top ?? outModes.default);
5354
- this._fixVertical(pos, radius, outModes.bottom ?? outModes.default);
5374
+ this.#fixHorizontal(pos, radius, outModes.left ?? outModes.default);
5375
+ this.#fixHorizontal(pos, radius, outModes.right ?? outModes.default);
5376
+ this.#fixVertical(pos, radius, outModes.top ?? outModes.default);
5377
+ this.#fixVertical(pos, radius, outModes.bottom ?? outModes.default);
5355
5378
  let isValidPosition = true;
5356
5379
  for (const plugin of container.particles.checkParticlePositionPlugins) {
5357
5380
  isValidPosition = plugin.checkParticlePosition?.(this, pos, tryCount) ?? true;
@@ -5367,8 +5390,8 @@
5367
5390
  }
5368
5391
  return posVec;
5369
5392
  };
5370
- _calculateVelocity = () => {
5371
- const baseVelocity = getParticleBaseVelocity(this.direction), res = baseVelocity.copy(), moveOptions = this.options.move;
5393
+ #calculateVelocity = () => {
5394
+ const moveOptions = this.options.move, baseVelocity = getParticleBaseVelocity(this.direction), res = baseVelocity.copy();
5372
5395
  if (moveOptions.direction === MoveDirection.inside || moveOptions.direction === MoveDirection.outside) {
5373
5396
  return res;
5374
5397
  }
@@ -5384,27 +5407,86 @@
5384
5407
  }
5385
5408
  return res;
5386
5409
  };
5387
- _fixHorizontal = (pos, radius, outMode) => {
5410
+ #fixHorizontal = (pos, radius, outMode) => {
5388
5411
  fixOutMode({
5389
5412
  outMode,
5390
5413
  checkModes: [OutMode.bounce],
5391
5414
  coord: pos.x,
5392
- maxCoord: this._container.canvas.size.width,
5415
+ maxCoord: this.#container.canvas.size.width,
5393
5416
  setCb: (value) => (pos.x += value),
5394
5417
  radius,
5395
5418
  });
5396
5419
  };
5397
- _fixVertical = (pos, radius, outMode) => {
5420
+ #fixVertical = (pos, radius, outMode) => {
5398
5421
  fixOutMode({
5399
5422
  outMode,
5400
5423
  checkModes: [OutMode.bounce],
5401
5424
  coord: pos.y,
5402
- maxCoord: this._container.canvas.size.height,
5425
+ maxCoord: this.#container.canvas.size.height,
5403
5426
  setCb: (value) => (pos.y += value),
5404
5427
  radius,
5405
5428
  });
5406
5429
  };
5407
- _getRollColor = color => {
5430
+ #getDefaultInsideCanvasResult = (direction, outMode) => {
5431
+ const radius = this.getRadius(), canvasSize = this.#container.canvas.size, position = this.position, isBounce = outMode === OutMode.bounce;
5432
+ if (direction === OutModeDirection.bottom) {
5433
+ return {
5434
+ inside: isBounce ? position.y + radius < canvasSize.height : position.y - radius < canvasSize.height,
5435
+ reason: "default",
5436
+ };
5437
+ }
5438
+ if (direction === OutModeDirection.left) {
5439
+ return {
5440
+ inside: isBounce ? position.x - radius > defaultAngle : position.x + radius > defaultAngle,
5441
+ reason: "default",
5442
+ };
5443
+ }
5444
+ if (direction === OutModeDirection.right) {
5445
+ return {
5446
+ inside: isBounce ? position.x + radius < canvasSize.width : position.x - radius < canvasSize.width,
5447
+ reason: "default",
5448
+ };
5449
+ }
5450
+ if (direction === OutModeDirection.top) {
5451
+ return {
5452
+ inside: isBounce ? position.y - radius > defaultAngle : position.y + radius > defaultAngle,
5453
+ reason: "default",
5454
+ };
5455
+ }
5456
+ return {
5457
+ inside: position.x >= -radius &&
5458
+ position.y >= -radius &&
5459
+ position.y <= canvasSize.height + radius &&
5460
+ position.x <= canvasSize.width + radius,
5461
+ reason: "default",
5462
+ };
5463
+ };
5464
+ #getInsideCanvasCallbackData = (direction, outMode) => {
5465
+ return {
5466
+ canvasSize: this.#container.canvas.size,
5467
+ direction,
5468
+ outMode,
5469
+ particle: this,
5470
+ radius: this.getRadius(),
5471
+ };
5472
+ };
5473
+ #getInsideCanvasResult = (data) => {
5474
+ const defaultResult = this.#getDefaultInsideCanvasResult(data.direction, data.outMode), container = this.#container, shapeDrawer = this.shape ? container.shapeDrawers.get(this.shape) : undefined, effectDrawer = this.effect ? container.effectDrawers.get(this.effect) : undefined, shapeCheck = shapeDrawer?.isInsideCanvas, effectCheck = effectDrawer?.isInsideCanvas;
5475
+ if (!shapeCheck && !effectCheck) {
5476
+ return defaultResult;
5477
+ }
5478
+ const callbackData = this.#getInsideCanvasCallbackData(data.direction, data.outMode), shapeResult = shapeCheck ? this.#normalizeInsideCanvasResult(shapeCheck(callbackData), "shape") : undefined, effectResult = effectCheck ? this.#normalizeInsideCanvasResult(effectCheck(callbackData), "effect") : undefined;
5479
+ if (shapeResult && effectResult) {
5480
+ const margin = Math.max(shapeResult.margin ?? defaultAngle, effectResult.margin ?? defaultAngle);
5481
+ return {
5482
+ inside: shapeResult.inside && effectResult.inside,
5483
+ margin: margin > defaultAngle ? margin : undefined,
5484
+ reason: "combined",
5485
+ };
5486
+ }
5487
+ return shapeResult ?? effectResult ?? defaultResult;
5488
+ };
5489
+ #getRollColor = color => {
5408
5490
  if (!color || !this.roll || (!this.backColor && !this.roll.alter)) {
5409
5491
  return color;
5410
5492
  }
@@ -5419,8 +5501,8 @@
5419
5501
  }
5420
5502
  return color;
5421
5503
  };
5422
- _initPosition = position => {
5423
- const container = this._container, zIndexValue = Math.floor(getRangeValue(this.options.zIndex.value)), initialPosition = this._calcPosition(position, clamp(zIndexValue, minZ, container.zLayers));
5504
+ #initPosition = position => {
5505
+ const container = this.#container, zIndexValue = Math.floor(getRangeValue(this.options.zIndex.value)), initialPosition = this.#calcPosition(position, clamp(zIndexValue, minZ, container.zLayers));
5424
5506
  if (!initialPosition) {
5425
5507
  throw new Error("a valid position cannot be found for particle");
5426
5508
  }
@@ -5443,45 +5525,58 @@
5443
5525
  }
5444
5526
  this.offset = Vector.origin;
5445
5527
  };
5528
+ #normalizeInsideCanvasResult = (result, reason) => {
5529
+ if (typeof result === "boolean") {
5530
+ return {
5531
+ inside: result,
5532
+ reason,
5533
+ };
5534
+ }
5535
+ return {
5536
+ inside: result.inside,
5537
+ margin: result.margin,
5538
+ reason: result.reason ?? reason,
5539
+ };
5540
+ };
5446
5541
  }
5447
5542
 
5448
5543
  class SpatialHashGrid {
5449
- _cellSize;
5450
- _cells = new Map();
5451
- _circlePool = [];
5452
- _circlePoolIdx;
5453
- _pendingCellSize;
5454
- _rectanglePool = [];
5455
- _rectanglePoolIdx;
5544
+ #cellSize;
5545
+ #cells = new Map();
5546
+ #circlePool = [];
5547
+ #circlePoolIdx;
5548
+ #pendingCellSize;
5549
+ #rectanglePool = [];
5550
+ #rectanglePoolIdx;
5456
5551
  constructor(cellSize) {
5457
- this._cellSize = cellSize;
5458
- this._circlePoolIdx = 0;
5459
- this._rectanglePoolIdx = 0;
5552
+ this.#cellSize = cellSize;
5553
+ this.#circlePoolIdx = 0;
5554
+ this.#rectanglePoolIdx = 0;
5460
5555
  }
5461
5556
  clear() {
5462
- this._cells.clear();
5463
- const pendingCellSize = this._pendingCellSize;
5557
+ this.#cells.clear();
5558
+ const pendingCellSize = this.#pendingCellSize;
5464
5559
  if (pendingCellSize) {
5465
- this._cellSize = pendingCellSize;
5560
+ this.#cellSize = pendingCellSize;
5466
5561
  }
5467
- this._pendingCellSize = undefined;
5562
+ this.#pendingCellSize = undefined;
5468
5563
  }
5469
5564
  insert(particle) {
5470
- const { x, y } = particle.getPosition(), key = this._cellKeyFromCoords(x, y);
5471
- if (!this._cells.has(key)) {
5472
- this._cells.set(key, []);
5565
+ const { x, y } = particle.getPosition(), key = this.#cellKeyFromCoords(x, y);
5566
+ if (!this.#cells.has(key)) {
5567
+ this.#cells.set(key, []);
5473
5568
  }
5474
- this._cells.get(key)?.push(particle);
5569
+ this.#cells.get(key)?.push(particle);
5475
5570
  }
5476
5571
  query(range, check, out = []) {
5477
- const bounds = this._getRangeBounds(range);
5572
+ const bounds = this.#getRangeBounds(range);
5478
5573
  if (!bounds) {
5479
5574
  return out;
5480
5575
  }
5481
- const minCellX = Math.floor(bounds.minX / this._cellSize), maxCellX = Math.floor(bounds.maxX / this._cellSize), minCellY = Math.floor(bounds.minY / this._cellSize), maxCellY = Math.floor(bounds.maxY / this._cellSize);
5576
+ const minCellX = Math.floor(bounds.minX / this.#cellSize), maxCellX = Math.floor(bounds.maxX / this.#cellSize), minCellY = Math.floor(bounds.minY / this.#cellSize), maxCellY = Math.floor(bounds.maxY / this.#cellSize);
5482
5577
  for (let cx = minCellX; cx <= maxCellX; cx++) {
5483
5578
  for (let cy = minCellY; cy <= maxCellY; cy++) {
5484
- const key = `${cx}_${cy}`, cellParticles = this._cells.get(key);
5579
+ const key = `${cx}_${cy}`, cellParticles = this.#cells.get(key);
5485
5580
  if (!cellParticles) {
5486
5581
  continue;
5487
5582
  }
@@ -5498,29 +5593,29 @@
5498
5593
  return out;
5499
5594
  }
5500
5595
  queryCircle(position, radius, check, out = []) {
5501
- const circle = this._acquireCircle(position.x, position.y, radius), result = this.query(circle, check, out);
5502
- this._releaseShapes();
5596
+ const circle = this.#acquireCircle(position.x, position.y, radius), result = this.query(circle, check, out);
5597
+ this.#releaseShapes();
5503
5598
  return result;
5504
5599
  }
5505
5600
  queryRectangle(position, size, check, out = []) {
5506
- const rect = this._acquireRectangle(position.x, position.y, size.width, size.height), result = this.query(rect, check, out);
5507
- this._releaseShapes();
5601
+ const rect = this.#acquireRectangle(position.x, position.y, size.width, size.height), result = this.query(rect, check, out);
5602
+ this.#releaseShapes();
5508
5603
  return result;
5509
5604
  }
5510
5605
  setCellSize(cellSize) {
5511
- this._pendingCellSize = cellSize;
5606
+ this.#pendingCellSize = cellSize;
5512
5607
  }
5513
- _acquireCircle(x, y, r) {
5514
- return (this._circlePool[this._circlePoolIdx++] ??= new Circle(x, y, r)).reset(x, y, r);
5608
+ #acquireCircle(x, y, r) {
5609
+ return (this.#circlePool[this.#circlePoolIdx++] ??= new Circle(x, y, r)).reset(x, y, r);
5515
5610
  }
5516
- _acquireRectangle(x, y, w, h) {
5517
- return (this._rectanglePool[this._rectanglePoolIdx++] ??= new Rectangle(x, y, w, h)).reset(x, y, w, h);
5611
+ #acquireRectangle(x, y, w, h) {
5612
+ return (this.#rectanglePool[this.#rectanglePoolIdx++] ??= new Rectangle(x, y, w, h)).reset(x, y, w, h);
5518
5613
  }
5519
- _cellKeyFromCoords(x, y) {
5520
- const cellX = Math.floor(x / this._cellSize), cellY = Math.floor(y / this._cellSize);
5614
+ #cellKeyFromCoords(x, y) {
5615
+ const cellX = Math.floor(x / this.#cellSize), cellY = Math.floor(y / this.#cellSize);
5521
5616
  return `${cellX}_${cellY}`;
5522
5617
  }
5523
- _getRangeBounds(range) {
5618
+ #getRangeBounds(range) {
5524
5619
  if (range instanceof Circle) {
5525
5620
  const r = range.radius, { x, y } = range.position;
5526
5621
  return {
@@ -5541,53 +5636,53 @@
5541
5636
  }
5542
5637
  return null;
5543
5638
  }
5544
- _releaseShapes() {
5545
- this._circlePoolIdx = 0;
5546
- this._rectanglePoolIdx = 0;
5639
+ #releaseShapes() {
5640
+ this.#circlePoolIdx = 0;
5641
+ this.#rectanglePoolIdx = 0;
5547
5642
  }
5548
5643
  }
5549
5644
 
5550
5645
  class ParticlesManager {
5551
5646
  checkParticlePositionPlugins;
5552
5647
  grid;
5553
- _array;
5554
- _container;
5555
- _groupLimits;
5556
- _limit;
5557
- _nextId;
5558
- _particleBuckets;
5559
- _particleResetPlugins;
5560
- _particleUpdatePlugins;
5561
- _pluginManager;
5562
- _pool;
5563
- _postParticleUpdatePlugins;
5564
- _postUpdatePlugins;
5565
- _resizeFactor;
5566
- _updatePlugins;
5567
- _zBuckets;
5648
+ #array;
5649
+ #container;
5650
+ #groupLimits;
5651
+ #limit;
5652
+ #nextId;
5653
+ #particleBuckets;
5654
+ #particleResetPlugins;
5655
+ #particleUpdatePlugins;
5656
+ #pluginManager;
5657
+ #pool;
5658
+ #postParticleUpdatePlugins;
5659
+ #postUpdatePlugins;
5660
+ #resizeFactor;
5661
+ #updatePlugins;
5662
+ #zBuckets;
5568
5663
  constructor(pluginManager, container) {
5569
- this._pluginManager = pluginManager;
5570
- this._container = container;
5571
- this._nextId = 0;
5572
- this._array = [];
5573
- this._pool = [];
5574
- this._limit = 0;
5575
- this._groupLimits = new Map();
5576
- this._particleBuckets = new Map();
5577
- this._zBuckets = this._createBuckets(this._container.zLayers);
5664
+ this.#pluginManager = pluginManager;
5665
+ this.#container = container;
5666
+ this.#nextId = 0;
5667
+ this.#array = [];
5668
+ this.#pool = [];
5669
+ this.#limit = 0;
5670
+ this.#groupLimits = new Map();
5671
+ this.#particleBuckets = new Map();
5672
+ this.#zBuckets = this.#createBuckets(this.#container.zLayers);
5578
5673
  this.grid = new SpatialHashGrid(spatialHashGridCellSize);
5579
5674
  this.checkParticlePositionPlugins = [];
5580
- this._particleResetPlugins = [];
5581
- this._particleUpdatePlugins = [];
5582
- this._postUpdatePlugins = [];
5583
- this._postParticleUpdatePlugins = [];
5584
- this._updatePlugins = [];
5675
+ this.#particleResetPlugins = [];
5676
+ this.#particleUpdatePlugins = [];
5677
+ this.#postUpdatePlugins = [];
5678
+ this.#postParticleUpdatePlugins = [];
5679
+ this.#updatePlugins = [];
5585
5680
  }
5586
5681
  get count() {
5587
- return this._array.length;
5682
+ return this.#array.length;
5588
5683
  }
5589
5684
  addParticle(position, overrideOptions, group, initializer) {
5590
- const limitMode = this._container.actualOptions.particles.number.limit.mode, limit = group === undefined ? this._limit : (this._groupLimits.get(group) ?? this._limit), currentCount = this.count;
5685
+ const limitMode = this.#container.actualOptions.particles.number.limit.mode, limit = group === undefined ? this.#limit : (this.#groupLimits.get(group) ?? this.#limit), currentCount = this.count;
5591
5686
  if (limit > minLimit) {
5592
5687
  switch (limitMode) {
5593
5688
  case LimitMode.delete: {
@@ -5605,20 +5700,20 @@
5605
5700
  }
5606
5701
  }
5607
5702
  try {
5608
- const particle = this._pool.pop() ?? new Particle(this._pluginManager, this._container);
5609
- particle.init(this._nextId, position, overrideOptions, group);
5703
+ const particle = this.#pool.pop() ?? new Particle(this.#pluginManager, this.#container);
5704
+ particle.init(this.#nextId, position, overrideOptions, group);
5610
5705
  let canAdd = true;
5611
5706
  if (initializer) {
5612
5707
  canAdd = initializer(particle);
5613
5708
  }
5614
5709
  if (!canAdd) {
5615
- this._pool.push(particle);
5710
+ this.#pool.push(particle);
5616
5711
  return;
5617
5712
  }
5618
- this._array.push(particle);
5619
- this._insertParticleIntoBucket(particle);
5620
- this._nextId++;
5621
- this._container.dispatchEvent(EventType.particleAdded, {
5713
+ this.#array.push(particle);
5714
+ this.#insertParticleIntoBucket(particle);
5715
+ this.#nextId++;
5716
+ this.#container.dispatchEvent(EventType.particleAdded, {
5622
5717
  particle,
5623
5718
  });
5624
5719
  return particle;
@@ -5629,25 +5724,25 @@
5629
5724
  return undefined;
5630
5725
  }
5631
5726
  clear() {
5632
- this._array = [];
5633
- this._particleBuckets.clear();
5634
- this._resetBuckets(this._container.zLayers);
5727
+ this.#array = [];
5728
+ this.#particleBuckets.clear();
5729
+ this.#resetBuckets(this.#container.zLayers);
5635
5730
  }
5636
5731
  destroy() {
5637
- this._array = [];
5638
- this._pool.length = 0;
5639
- this._particleBuckets.clear();
5640
- this._zBuckets = [];
5732
+ this.#array = [];
5733
+ this.#pool.length = 0;
5734
+ this.#particleBuckets.clear();
5735
+ this.#zBuckets = [];
5641
5736
  this.checkParticlePositionPlugins = [];
5642
- this._particleResetPlugins = [];
5643
- this._particleUpdatePlugins = [];
5644
- this._postUpdatePlugins = [];
5645
- this._postParticleUpdatePlugins = [];
5646
- this._updatePlugins = [];
5737
+ this.#particleResetPlugins = [];
5738
+ this.#particleUpdatePlugins = [];
5739
+ this.#postUpdatePlugins = [];
5740
+ this.#postParticleUpdatePlugins = [];
5741
+ this.#updatePlugins = [];
5647
5742
  }
5648
5743
  drawParticles(delta) {
5649
- for (let i = this._zBuckets.length - one; i >= minIndex; i--) {
5650
- const bucket = this._zBuckets[i];
5744
+ for (let i = this.#zBuckets.length - one; i >= minIndex; i--) {
5745
+ const bucket = this.#zBuckets[i];
5651
5746
  if (!bucket) {
5652
5747
  continue;
5653
5748
  }
@@ -5657,24 +5752,24 @@
5657
5752
  }
5658
5753
  }
5659
5754
  filter(condition) {
5660
- return this._array.filter(condition);
5755
+ return this.#array.filter(condition);
5661
5756
  }
5662
5757
  find(condition) {
5663
- return this._array.find(condition);
5758
+ return this.#array.find(condition);
5664
5759
  }
5665
5760
  get(index) {
5666
- return this._array[index];
5761
+ return this.#array[index];
5667
5762
  }
5668
5763
  async init() {
5669
- const container = this._container, options = container.actualOptions;
5764
+ const container = this.#container, options = container.actualOptions;
5670
5765
  this.checkParticlePositionPlugins = [];
5671
- this._updatePlugins = [];
5672
- this._particleUpdatePlugins = [];
5673
- this._postUpdatePlugins = [];
5674
- this._particleResetPlugins = [];
5675
- this._postParticleUpdatePlugins = [];
5676
- this._particleBuckets.clear();
5677
- this._resetBuckets(container.zLayers);
5766
+ this.#updatePlugins = [];
5767
+ this.#particleUpdatePlugins = [];
5768
+ this.#postUpdatePlugins = [];
5769
+ this.#particleResetPlugins = [];
5770
+ this.#postParticleUpdatePlugins = [];
5771
+ this.#particleBuckets.clear();
5772
+ this.#resetBuckets(container.zLayers);
5678
5773
  this.grid = new SpatialHashGrid(spatialHashGridCellSize * container.retina.pixelRatio);
5679
5774
  for (const plugin of container.plugins) {
5680
5775
  if (plugin.redrawInit) {
@@ -5684,26 +5779,26 @@
5684
5779
  this.checkParticlePositionPlugins.push(plugin);
5685
5780
  }
5686
5781
  if (plugin.update) {
5687
- this._updatePlugins.push(plugin);
5782
+ this.#updatePlugins.push(plugin);
5688
5783
  }
5689
5784
  if (plugin.particleUpdate) {
5690
- this._particleUpdatePlugins.push(plugin);
5785
+ this.#particleUpdatePlugins.push(plugin);
5691
5786
  }
5692
5787
  if (plugin.postUpdate) {
5693
- this._postUpdatePlugins.push(plugin);
5788
+ this.#postUpdatePlugins.push(plugin);
5694
5789
  }
5695
5790
  if (plugin.particleReset) {
5696
- this._particleResetPlugins.push(plugin);
5791
+ this.#particleResetPlugins.push(plugin);
5697
5792
  }
5698
5793
  if (plugin.postParticleUpdate) {
5699
- this._postParticleUpdatePlugins.push(plugin);
5794
+ this.#postParticleUpdatePlugins.push(plugin);
5700
5795
  }
5701
5796
  }
5702
- await this._container.initDrawersAndUpdaters();
5703
- for (const drawer of this._container.effectDrawers.values()) {
5797
+ await this.#container.initDrawersAndUpdaters();
5798
+ for (const drawer of this.#container.effectDrawers.values()) {
5704
5799
  await drawer.init?.(container);
5705
5800
  }
5706
- for (const drawer of this._container.shapeDrawers.values()) {
5801
+ for (const drawer of this.#container.shapeDrawers.values()) {
5707
5802
  await drawer.init?.(container);
5708
5803
  }
5709
5804
  let handled = false;
@@ -5737,10 +5832,10 @@
5737
5832
  async redraw() {
5738
5833
  this.clear();
5739
5834
  await this.init();
5740
- this._container.canvas.render.drawParticles({ value: 0, factor: 0 });
5835
+ this.#container.canvas.render.drawParticles({ value: 0, factor: 0 });
5741
5836
  }
5742
5837
  remove(particle, group, override) {
5743
- this.removeAt(this._array.indexOf(particle), undefined, group, override);
5838
+ this.removeAt(this.#array.indexOf(particle), undefined, group, override);
5744
5839
  }
5745
5840
  removeAt(index, quantity = defaultRemoveQuantity, group, override) {
5746
5841
  if (index < minIndex || index > this.count) {
@@ -5748,7 +5843,7 @@
5748
5843
  }
5749
5844
  let deleted = 0;
5750
5845
  for (let i = index; deleted < quantity && i < this.count; i++) {
5751
- if (this._removeParticle(i, group, override)) {
5846
+ if (this.#removeParticle(i, group, override)) {
5752
5847
  i--;
5753
5848
  deleted++;
5754
5849
  }
@@ -5758,9 +5853,9 @@
5758
5853
  this.removeAt(minIndex, quantity, group);
5759
5854
  }
5760
5855
  setDensity() {
5761
- const options = this._container.actualOptions, groups = options.particles.groups;
5856
+ const options = this.#container.actualOptions, groups = options.particles.groups;
5762
5857
  let pluginsCount = 0;
5763
- for (const plugin of this._container.plugins) {
5858
+ for (const plugin of this.#container.plugins) {
5764
5859
  if (plugin.particlesDensityCount) {
5765
5860
  pluginsCount += plugin.particlesDensityCount();
5766
5861
  }
@@ -5770,51 +5865,51 @@
5770
5865
  if (!groupData) {
5771
5866
  continue;
5772
5867
  }
5773
- const groupDataOptions = loadParticlesOptions(this._pluginManager, this._container, groupData);
5774
- this._applyDensity(groupDataOptions, pluginsCount, group);
5868
+ const groupDataOptions = loadParticlesOptions(this.#pluginManager, this.#container, groupData);
5869
+ this.#applyDensity(groupDataOptions, pluginsCount, group);
5775
5870
  }
5776
- this._applyDensity(options.particles, pluginsCount);
5871
+ this.#applyDensity(options.particles, pluginsCount);
5777
5872
  }
5778
5873
  setResizeFactor(factor) {
5779
- this._resizeFactor = factor;
5874
+ this.#resizeFactor = factor;
5780
5875
  }
5781
5876
  update(delta) {
5782
5877
  this.grid.clear();
5783
- for (const plugin of this._updatePlugins) {
5878
+ for (const plugin of this.#updatePlugins) {
5784
5879
  plugin.update?.(delta);
5785
5880
  }
5786
- const particlesToDelete = this._updateParticlesPhase1(delta);
5787
- for (const plugin of this._postUpdatePlugins) {
5881
+ const particlesToDelete = this.#updateParticlesPhase1(delta);
5882
+ for (const plugin of this.#postUpdatePlugins) {
5788
5883
  plugin.postUpdate?.(delta);
5789
5884
  }
5790
- this._updateParticlesPhase2(delta, particlesToDelete);
5885
+ this.#updateParticlesPhase2(delta, particlesToDelete);
5791
5886
  if (particlesToDelete.size) {
5792
5887
  for (const particle of particlesToDelete) {
5793
5888
  this.remove(particle);
5794
5889
  }
5795
5890
  }
5796
- delete this._resizeFactor;
5891
+ this.#resizeFactor = undefined;
5797
5892
  }
5798
- _addToPool = (...particles) => {
5799
- this._pool.push(...particles);
5893
+ #addToPool = (...particles) => {
5894
+ this.#pool.push(...particles);
5800
5895
  };
5801
- _applyDensity = (options, pluginsCount, group, groupOptions) => {
5896
+ #applyDensity = (options, pluginsCount, group, groupOptions) => {
5802
5897
  const numberOptions = options.number;
5803
5898
  if (!numberOptions.density.enable) {
5804
5899
  if (group === undefined) {
5805
- this._limit = numberOptions.limit.value;
5900
+ this.#limit = numberOptions.limit.value;
5806
5901
  }
5807
5902
  else if (groupOptions?.number.limit.value ?? numberOptions.limit.value) {
5808
- this._groupLimits.set(group, groupOptions?.number.limit.value ?? numberOptions.limit.value);
5903
+ this.#groupLimits.set(group, groupOptions?.number.limit.value ?? numberOptions.limit.value);
5809
5904
  }
5810
5905
  return;
5811
5906
  }
5812
- const densityFactor = this._initDensityFactor(numberOptions.density), optParticlesNumber = numberOptions.value, optParticlesLimit = numberOptions.limit.value > minLimit ? numberOptions.limit.value : optParticlesNumber, particlesNumber = Math.min(optParticlesNumber, optParticlesLimit) * densityFactor + pluginsCount, particlesCount = Math.min(this.count, this.filter(t => t.group === group).length);
5907
+ const densityFactor = this.#initDensityFactor(numberOptions.density), optParticlesNumber = numberOptions.value, optParticlesLimit = numberOptions.limit.value > minLimit ? numberOptions.limit.value : optParticlesNumber, particlesNumber = Math.min(optParticlesNumber, optParticlesLimit) * densityFactor + pluginsCount, particlesCount = Math.min(this.count, this.filter(t => t.group === group).length);
5813
5908
  if (group === undefined) {
5814
- this._limit = numberOptions.limit.value * densityFactor;
5909
+ this.#limit = numberOptions.limit.value * densityFactor;
5815
5910
  }
5816
5911
  else {
5817
- this._groupLimits.set(group, numberOptions.limit.value * densityFactor);
5912
+ this.#groupLimits.set(group, numberOptions.limit.value * densityFactor);
5818
5913
  }
5819
5914
  if (particlesCount < particlesNumber) {
5820
5915
  this.push(Math.abs(particlesNumber - particlesCount), undefined, options, group);
@@ -5823,18 +5918,18 @@
5823
5918
  this.removeQuantity(particlesCount - particlesNumber, group);
5824
5919
  }
5825
5920
  };
5826
- _createBuckets = (zLayers) => {
5921
+ #createBuckets = (zLayers) => {
5827
5922
  const bucketCount = Math.max(Math.floor(zLayers), one);
5828
5923
  return Array.from({ length: bucketCount }, () => []);
5829
5924
  };
5830
- _getBucketIndex = (zIndex) => {
5831
- const maxBucketIndex = this._zBuckets.length - one;
5925
+ #getBucketIndex = (zIndex) => {
5926
+ const maxBucketIndex = this.#zBuckets.length - one;
5832
5927
  if (maxBucketIndex <= minIndex) {
5833
5928
  return minIndex;
5834
5929
  }
5835
5930
  return Math.min(Math.max(Math.floor(zIndex), minIndex), maxBucketIndex);
5836
5931
  };
5837
- _getParticleInsertIndex = (bucket, particleId) => {
5932
+ #getParticleInsertIndex = (bucket, particleId) => {
5838
5933
  let start = minIndex, end = bucket.length;
5839
5934
  while (start < end) {
5840
5935
  const middle = Math.floor((start + end) / double), middleParticle = bucket[middle];
@@ -5851,8 +5946,8 @@
5851
5946
  }
5852
5947
  return start;
5853
5948
  };
5854
- _initDensityFactor = densityOptions => {
5855
- const container = this._container;
5949
+ #initDensityFactor = densityOptions => {
5950
+ const container = this.#container;
5856
5951
  if (!densityOptions.enable) {
5857
5952
  return defaultDensityFactor;
5858
5953
  }
@@ -5862,82 +5957,82 @@
5862
5957
  }
5863
5958
  return ((canvasSize.width * canvasSize.height) / (densityOptions.height * densityOptions.width * pxRatio ** squareExp));
5864
5959
  };
5865
- _insertParticleIntoBucket = (particle) => {
5866
- const bucketIndex = this._getBucketIndex(particle.position.z), bucket = this._zBuckets[bucketIndex];
5960
+ #insertParticleIntoBucket = (particle) => {
5961
+ const bucketIndex = this.#getBucketIndex(particle.position.z), bucket = this.#zBuckets[bucketIndex];
5867
5962
  if (!bucket) {
5868
5963
  return;
5869
5964
  }
5870
- bucket.splice(this._getParticleInsertIndex(bucket, particle.id), empty, particle);
5871
- this._particleBuckets.set(particle.id, bucketIndex);
5965
+ bucket.splice(this.#getParticleInsertIndex(bucket, particle.id), empty, particle);
5966
+ this.#particleBuckets.set(particle.id, bucketIndex);
5872
5967
  };
5873
- _removeParticle = (index, group, override) => {
5874
- const particle = this._array[index];
5968
+ #removeParticle = (index, group, override) => {
5969
+ const particle = this.#array[index];
5875
5970
  if (!particle) {
5876
5971
  return false;
5877
5972
  }
5878
5973
  if (particle.group !== group) {
5879
5974
  return false;
5880
5975
  }
5881
- this._array.splice(index, deleteCount);
5882
- this._removeParticleFromBucket(particle);
5976
+ this.#array.splice(index, deleteCount);
5977
+ this.#removeParticleFromBucket(particle);
5883
5978
  particle.destroy(override);
5884
- this._container.dispatchEvent(EventType.particleRemoved, {
5979
+ this.#container.dispatchEvent(EventType.particleRemoved, {
5885
5980
  particle,
5886
5981
  });
5887
- this._addToPool(particle);
5982
+ this.#addToPool(particle);
5888
5983
  return true;
5889
5984
  };
5890
- _removeParticleFromBucket = (particle) => {
5891
- const bucketIndex = this._particleBuckets.get(particle.id) ?? this._getBucketIndex(particle.position.z), bucket = this._zBuckets[bucketIndex];
5985
+ #removeParticleFromBucket = (particle) => {
5986
+ const bucketIndex = this.#particleBuckets.get(particle.id) ?? this.#getBucketIndex(particle.position.z), bucket = this.#zBuckets[bucketIndex];
5892
5987
  if (!bucket) {
5893
- this._particleBuckets.delete(particle.id);
5988
+ this.#particleBuckets.delete(particle.id);
5894
5989
  return;
5895
5990
  }
5896
- const particleIndex = this._getParticleInsertIndex(bucket, particle.id);
5991
+ const particleIndex = this.#getParticleInsertIndex(bucket, particle.id);
5897
5992
  if (bucket[particleIndex]?.id !== particle.id) {
5898
- this._particleBuckets.delete(particle.id);
5993
+ this.#particleBuckets.delete(particle.id);
5899
5994
  return;
5900
5995
  }
5901
5996
  bucket.splice(particleIndex, deleteCount);
5902
- this._particleBuckets.delete(particle.id);
5997
+ this.#particleBuckets.delete(particle.id);
5903
5998
  };
5904
- _resetBuckets = (zLayers) => {
5999
+ #resetBuckets = (zLayers) => {
5905
6000
  const bucketCount = Math.max(Math.floor(zLayers), one);
5906
- if (this._zBuckets.length !== bucketCount) {
5907
- this._zBuckets = this._createBuckets(bucketCount);
6001
+ if (this.#zBuckets.length !== bucketCount) {
6002
+ this.#zBuckets = this.#createBuckets(bucketCount);
5908
6003
  return;
5909
6004
  }
5910
- for (const bucket of this._zBuckets) {
6005
+ for (const bucket of this.#zBuckets) {
5911
6006
  bucket.length = minIndex;
5912
6007
  }
5913
6008
  };
5914
- _updateParticleBucket = (particle) => {
5915
- const newBucketIndex = this._getBucketIndex(particle.position.z), currentBucketIndex = this._particleBuckets.get(particle.id);
6009
+ #updateParticleBucket = (particle) => {
6010
+ const newBucketIndex = this.#getBucketIndex(particle.position.z), currentBucketIndex = this.#particleBuckets.get(particle.id);
5916
6011
  if (currentBucketIndex === undefined) {
5917
- this._insertParticleIntoBucket(particle);
6012
+ this.#insertParticleIntoBucket(particle);
5918
6013
  return;
5919
6014
  }
5920
6015
  if (currentBucketIndex === newBucketIndex) {
5921
6016
  return;
5922
6017
  }
5923
- const currentBucket = this._zBuckets[currentBucketIndex];
6018
+ const currentBucket = this.#zBuckets[currentBucketIndex];
5924
6019
  if (currentBucket) {
5925
- const particleIndex = this._getParticleInsertIndex(currentBucket, particle.id);
6020
+ const particleIndex = this.#getParticleInsertIndex(currentBucket, particle.id);
5926
6021
  if (currentBucket[particleIndex]?.id === particle.id) {
5927
6022
  currentBucket.splice(particleIndex, deleteCount);
5928
6023
  }
5929
6024
  }
5930
- const newBucket = this._zBuckets[newBucketIndex];
6025
+ const newBucket = this.#zBuckets[newBucketIndex];
5931
6026
  if (!newBucket) {
5932
- this._particleBuckets.set(particle.id, newBucketIndex);
6027
+ this.#particleBuckets.set(particle.id, newBucketIndex);
5933
6028
  return;
5934
6029
  }
5935
- newBucket.splice(this._getParticleInsertIndex(newBucket, particle.id), empty, particle);
5936
- this._particleBuckets.set(particle.id, newBucketIndex);
6030
+ newBucket.splice(this.#getParticleInsertIndex(newBucket, particle.id), empty, particle);
6031
+ this.#particleBuckets.set(particle.id, newBucketIndex);
5937
6032
  };
5938
- _updateParticlesPhase1 = (delta) => {
5939
- const particlesToDelete = new Set(), resizeFactor = this._resizeFactor;
5940
- for (const particle of this._array) {
6033
+ #updateParticlesPhase1 = (delta) => {
6034
+ const particlesToDelete = new Set(), resizeFactor = this.#resizeFactor;
6035
+ for (const particle of this.#array) {
5941
6036
  if (resizeFactor && !particle.ignoresResizeRatio) {
5942
6037
  particle.position.x *= resizeFactor.width;
5943
6038
  particle.position.y *= resizeFactor.height;
@@ -5945,10 +6040,10 @@
5945
6040
  particle.initialPosition.y *= resizeFactor.height;
5946
6041
  }
5947
6042
  particle.ignoresResizeRatio = false;
5948
- for (const plugin of this._particleResetPlugins) {
6043
+ for (const plugin of this.#particleResetPlugins) {
5949
6044
  plugin.particleReset?.(particle);
5950
6045
  }
5951
- for (const plugin of this._particleUpdatePlugins) {
6046
+ for (const plugin of this.#particleUpdatePlugins) {
5952
6047
  if (particle.destroyed) {
5953
6048
  break;
5954
6049
  }
@@ -5962,36 +6057,36 @@
5962
6057
  }
5963
6058
  return particlesToDelete;
5964
6059
  };
5965
- _updateParticlesPhase2 = (delta, particlesToDelete) => {
5966
- for (const particle of this._array) {
6060
+ #updateParticlesPhase2 = (delta, particlesToDelete) => {
6061
+ for (const particle of this.#array) {
5967
6062
  if (particle.destroyed) {
5968
6063
  particlesToDelete.add(particle);
5969
6064
  continue;
5970
6065
  }
5971
- for (const updater of this._container.particleUpdaters) {
6066
+ for (const updater of this.#container.particleUpdaters) {
5972
6067
  updater.update(particle, delta);
5973
6068
  }
5974
6069
  if (!particle.spawning) {
5975
- for (const plugin of this._postParticleUpdatePlugins) {
6070
+ for (const plugin of this.#postParticleUpdatePlugins) {
5976
6071
  plugin.postParticleUpdate?.(particle, delta);
5977
6072
  }
5978
6073
  }
5979
- this._updateParticleBucket(particle);
6074
+ this.#updateParticleBucket(particle);
5980
6075
  }
5981
6076
  };
5982
6077
  }
5983
6078
 
5984
6079
  class Retina {
5985
- container;
5986
6080
  pixelRatio;
5987
6081
  reduceFactor;
6082
+ #container;
5988
6083
  constructor(container) {
5989
- this.container = container;
6084
+ this.#container = container;
5990
6085
  this.pixelRatio = defaultRatio;
5991
6086
  this.reduceFactor = defaultReduceFactor;
5992
6087
  }
5993
6088
  init() {
5994
- const container = this.container, options = container.actualOptions;
6089
+ const container = this.#container, options = container.actualOptions;
5995
6090
  this.pixelRatio = options.detectRetina ? devicePixelRatio : defaultRatio;
5996
6091
  this.reduceFactor = defaultReduceFactor;
5997
6092
  const ratio = this.pixelRatio, canvas = container.canvas, element = canvas.domElement;
@@ -6005,7 +6100,6 @@
6005
6100
  props.maxSpeed = getRangeValue(moveOptions.gravity.maxSpeed) * ratio;
6006
6101
  props.moveDrift = getRangeValue(moveOptions.drift) * ratio;
6007
6102
  props.moveSpeed = getRangeValue(moveOptions.speed) * ratio;
6008
- props.sizeAnimationSpeed = getRangeValue(options.size.animation.speed) * ratio;
6009
6103
  const maxDistance = props.maxDistance;
6010
6104
  maxDistance.horizontal = moveDistance.horizontal === undefined ? undefined : moveDistance.horizontal * ratio;
6011
6105
  maxDistance.vertical = moveDistance.vertical === undefined ? undefined : moveDistance.vertical * ratio;
@@ -6043,73 +6137,73 @@
6043
6137
  shapeDrawers;
6044
6138
  started;
6045
6139
  zLayers;
6046
- _delay;
6047
- _delayTimeout;
6048
- _delta = { value: 0, factor: 0 };
6049
- _dispatchCallback;
6050
- _drawAnimationFrame;
6051
- _duration;
6052
- _eventListeners;
6053
- _firstStart;
6054
- _initialSourceOptions;
6055
- _lastFrameTime;
6056
- _lifeTime;
6057
- _onDestroy;
6058
- _options;
6059
- _paused;
6060
- _pluginManager;
6061
- _smooth;
6062
- _sourceOptions;
6140
+ #delay;
6141
+ #delayTimeout;
6142
+ #delta = { value: 0, factor: 0 };
6143
+ #dispatchCallback;
6144
+ #drawAnimationFrame;
6145
+ #duration;
6146
+ #eventListeners;
6147
+ #firstStart;
6148
+ #initialSourceOptions;
6149
+ #lastFrameTime;
6150
+ #lifeTime;
6151
+ #onDestroy;
6152
+ #options;
6153
+ #paused;
6154
+ #pluginManager;
6155
+ #smooth;
6156
+ #sourceOptions;
6063
6157
  constructor(params) {
6064
6158
  const { dispatchCallback, pluginManager, id, onDestroy, sourceOptions } = params;
6065
- this._pluginManager = pluginManager;
6066
- this._dispatchCallback = dispatchCallback;
6067
- this._onDestroy = onDestroy;
6159
+ this.#pluginManager = pluginManager;
6160
+ this.#dispatchCallback = dispatchCallback;
6161
+ this.#onDestroy = onDestroy;
6068
6162
  this.id = Symbol(id);
6069
6163
  this.fpsLimit = 120;
6070
6164
  this.hdr = false;
6071
- this._smooth = false;
6072
- this._delay = 0;
6073
- this._duration = 0;
6074
- this._lifeTime = 0;
6075
- this._firstStart = true;
6165
+ this.#smooth = false;
6166
+ this.#delay = 0;
6167
+ this.#duration = 0;
6168
+ this.#lifeTime = 0;
6169
+ this.#firstStart = true;
6076
6170
  this.started = false;
6077
6171
  this.destroyed = false;
6078
- this._paused = true;
6079
- this._lastFrameTime = 0;
6172
+ this.#paused = true;
6173
+ this.#lastFrameTime = 0;
6080
6174
  this.zLayers = 100;
6081
6175
  this.pageHidden = false;
6082
- this._sourceOptions = sourceOptions;
6083
- this._initialSourceOptions = sourceOptions;
6176
+ this.#sourceOptions = sourceOptions;
6177
+ this.#initialSourceOptions = sourceOptions;
6084
6178
  this.effectDrawers = new Map();
6085
6179
  this.shapeDrawers = new Map();
6086
6180
  this.particleUpdaters = [];
6087
6181
  this.retina = new Retina(this);
6088
- this.canvas = new CanvasManager(this._pluginManager, this);
6089
- this.particles = new ParticlesManager(this._pluginManager, this);
6182
+ this.canvas = new CanvasManager(this.#pluginManager, this);
6183
+ this.particles = new ParticlesManager(this.#pluginManager, this);
6090
6184
  this.plugins = [];
6091
6185
  this.particleDestroyedPlugins = [];
6092
6186
  this.particleCreatedPlugins = [];
6093
6187
  this.particlePositionPlugins = [];
6094
- this._options = loadContainerOptions(this._pluginManager, this);
6095
- this.actualOptions = loadContainerOptions(this._pluginManager, this);
6096
- this._eventListeners = new EventListeners(this);
6188
+ this.#options = loadContainerOptions(this.#pluginManager, this);
6189
+ this.actualOptions = loadContainerOptions(this.#pluginManager, this);
6190
+ this.#eventListeners = new EventListeners(this);
6097
6191
  this.dispatchEvent(EventType.containerBuilt);
6098
6192
  }
6099
6193
  get animationStatus() {
6100
- return !this._paused && !this.pageHidden && guardCheck(this);
6194
+ return !this.#paused && !this.pageHidden && guardCheck(this);
6101
6195
  }
6102
6196
  get options() {
6103
- return this._options;
6197
+ return this.#options;
6104
6198
  }
6105
6199
  get sourceOptions() {
6106
- return this._sourceOptions;
6200
+ return this.#sourceOptions;
6107
6201
  }
6108
6202
  addLifeTime(value) {
6109
- this._lifeTime += value;
6203
+ this.#lifeTime += value;
6110
6204
  }
6111
6205
  alive() {
6112
- return !this._duration || this._lifeTime <= this._duration;
6206
+ return !this.#duration || this.#lifeTime <= this.#duration;
6113
6207
  }
6114
6208
  destroy(remove = true) {
6115
6209
  if (!guardCheck(this)) {
@@ -6131,13 +6225,13 @@
6131
6225
  this.shapeDrawers = new Map();
6132
6226
  this.particleUpdaters = [];
6133
6227
  this.plugins.length = 0;
6134
- this._pluginManager.clearPlugins(this);
6228
+ this.#pluginManager.clearPlugins(this);
6135
6229
  this.destroyed = true;
6136
- this._onDestroy(remove);
6230
+ this.#onDestroy(remove);
6137
6231
  this.dispatchEvent(EventType.containerDestroyed);
6138
6232
  }
6139
6233
  dispatchEvent(type, data) {
6140
- this._dispatchCallback(type, {
6234
+ this.#dispatchCallback(type, {
6141
6235
  container: this,
6142
6236
  data,
6143
6237
  });
@@ -6147,12 +6241,12 @@
6147
6241
  return;
6148
6242
  }
6149
6243
  let refreshTime = force;
6150
- this._drawAnimationFrame = animate((timestamp) => {
6244
+ this.#drawAnimationFrame = animate((timestamp) => {
6151
6245
  if (refreshTime) {
6152
- this._lastFrameTime = undefined;
6246
+ this.#lastFrameTime = undefined;
6153
6247
  refreshTime = false;
6154
6248
  }
6155
- this._nextFrame(timestamp);
6249
+ this.#nextFrame(timestamp);
6156
6250
  });
6157
6251
  }
6158
6252
  async export(type, options = {}) {
@@ -6174,7 +6268,7 @@
6174
6268
  return;
6175
6269
  }
6176
6270
  const allContainerPlugins = new Map();
6177
- for (const plugin of this._pluginManager.plugins) {
6271
+ for (const plugin of this.#pluginManager.plugins) {
6178
6272
  const containerPlugin = await plugin.getPlugin(this);
6179
6273
  if (containerPlugin.preInit) {
6180
6274
  await containerPlugin.preInit();
@@ -6182,8 +6276,8 @@
6182
6276
  allContainerPlugins.set(plugin, containerPlugin);
6183
6277
  }
6184
6278
  await this.initDrawersAndUpdaters();
6185
- this._options = loadContainerOptions(this._pluginManager, this, this._initialSourceOptions, this.sourceOptions);
6186
- this.actualOptions = loadContainerOptions(this._pluginManager, this, this._options);
6279
+ this.#options = loadContainerOptions(this.#pluginManager, this, this.#initialSourceOptions, this.sourceOptions);
6280
+ this.actualOptions = loadContainerOptions(this.#pluginManager, this, this.#options);
6187
6281
  this.plugins.length = 0;
6188
6282
  this.particleDestroyedPlugins.length = 0;
6189
6283
  this.particleCreatedPlugins.length = 0;
@@ -6210,11 +6304,11 @@
6210
6304
  const { delay, duration, fpsLimit, hdr, smooth, zLayers } = this.actualOptions;
6211
6305
  this.hdr = hdr;
6212
6306
  this.zLayers = zLayers;
6213
- this._duration = getRangeValue(duration) * millisecondsToSeconds;
6214
- this._delay = getRangeValue(delay) * millisecondsToSeconds;
6215
- this._lifeTime = 0;
6307
+ this.#duration = getRangeValue(duration) * millisecondsToSeconds;
6308
+ this.#delay = getRangeValue(delay) * millisecondsToSeconds;
6309
+ this.#lifeTime = 0;
6216
6310
  this.fpsLimit = fpsLimit > minFpsLimit ? fpsLimit : defaultFpsLimit;
6217
- this._smooth = smooth;
6311
+ this.#smooth = smooth;
6218
6312
  for (const plugin of this.plugins) {
6219
6313
  await plugin.init?.();
6220
6314
  }
@@ -6227,7 +6321,7 @@
6227
6321
  this.dispatchEvent(EventType.particlesSetup);
6228
6322
  }
6229
6323
  async initDrawersAndUpdaters() {
6230
- const pluginManager = this._pluginManager;
6324
+ const pluginManager = this.#pluginManager;
6231
6325
  this.effectDrawers = await pluginManager.getEffectDrawers(this, true);
6232
6326
  this.shapeDrawers = await pluginManager.getShapeDrawers(this, true);
6233
6327
  this.particleUpdaters = await pluginManager.getUpdaters(this, true);
@@ -6236,18 +6330,18 @@
6236
6330
  if (!guardCheck(this)) {
6237
6331
  return;
6238
6332
  }
6239
- if (this._drawAnimationFrame !== undefined) {
6240
- cancelAnimation(this._drawAnimationFrame);
6241
- delete this._drawAnimationFrame;
6333
+ if (this.#drawAnimationFrame !== undefined) {
6334
+ cancelAnimation(this.#drawAnimationFrame);
6335
+ this.#drawAnimationFrame = undefined;
6242
6336
  }
6243
- if (this._paused) {
6337
+ if (this.#paused) {
6244
6338
  return;
6245
6339
  }
6246
6340
  for (const plugin of this.plugins) {
6247
6341
  plugin.pause?.();
6248
6342
  }
6249
6343
  if (!this.pageHidden) {
6250
- this._paused = true;
6344
+ this.#paused = true;
6251
6345
  }
6252
6346
  this.dispatchEvent(EventType.containerPaused);
6253
6347
  }
@@ -6255,13 +6349,13 @@
6255
6349
  if (!guardCheck(this)) {
6256
6350
  return;
6257
6351
  }
6258
- const needsUpdate = this._paused || force;
6259
- if (this._firstStart && !this.actualOptions.autoPlay) {
6260
- this._firstStart = false;
6352
+ const needsUpdate = this.#paused || force;
6353
+ if (this.#firstStart && !this.actualOptions.autoPlay) {
6354
+ this.#firstStart = false;
6261
6355
  return;
6262
6356
  }
6263
- if (this._paused) {
6264
- this._paused = false;
6357
+ if (this.#paused) {
6358
+ this.#paused = false;
6265
6359
  }
6266
6360
  if (needsUpdate) {
6267
6361
  for (const plugin of this.plugins) {
@@ -6284,10 +6378,10 @@
6284
6378
  if (!guardCheck(this)) {
6285
6379
  return;
6286
6380
  }
6287
- this._initialSourceOptions = sourceOptions;
6288
- this._sourceOptions = sourceOptions;
6289
- this._options = loadContainerOptions(this._pluginManager, this, this._initialSourceOptions, this.sourceOptions);
6290
- this.actualOptions = loadContainerOptions(this._pluginManager, this, this._options);
6381
+ this.#initialSourceOptions = sourceOptions;
6382
+ this.#sourceOptions = sourceOptions;
6383
+ this.#options = loadContainerOptions(this.#pluginManager, this, this.#initialSourceOptions, this.sourceOptions);
6384
+ this.actualOptions = loadContainerOptions(this.#pluginManager, this, this.#options);
6291
6385
  return this.refresh();
6292
6386
  }
6293
6387
  async start() {
@@ -6298,7 +6392,7 @@
6298
6392
  this.started = true;
6299
6393
  await new Promise(resolve => {
6300
6394
  const start = async () => {
6301
- this._eventListeners.addListeners();
6395
+ this.#eventListeners.addListeners();
6302
6396
  for (const plugin of this.plugins) {
6303
6397
  await plugin.start?.();
6304
6398
  }
@@ -6306,20 +6400,20 @@
6306
6400
  this.play();
6307
6401
  resolve();
6308
6402
  };
6309
- this._delayTimeout = setTimeout(() => void start(), this._delay);
6403
+ this.#delayTimeout = setTimeout(() => void start(), this.#delay);
6310
6404
  });
6311
6405
  }
6312
6406
  stop() {
6313
6407
  if (!guardCheck(this) || !this.started) {
6314
6408
  return;
6315
6409
  }
6316
- if (this._delayTimeout) {
6317
- clearTimeout(this._delayTimeout);
6318
- delete this._delayTimeout;
6410
+ if (this.#delayTimeout) {
6411
+ clearTimeout(this.#delayTimeout);
6412
+ this.#delayTimeout = undefined;
6319
6413
  }
6320
- this._firstStart = true;
6414
+ this.#firstStart = true;
6321
6415
  this.started = false;
6322
- this._eventListeners.removeListeners();
6416
+ this.#eventListeners.removeListeners();
6323
6417
  this.pause();
6324
6418
  this.particles.clear();
6325
6419
  this.canvas.stop();
@@ -6329,7 +6423,7 @@
6329
6423
  this.particleCreatedPlugins.length = 0;
6330
6424
  this.particleDestroyedPlugins.length = 0;
6331
6425
  this.particlePositionPlugins.length = 0;
6332
- this._sourceOptions = this._options;
6426
+ this.#sourceOptions = this.#options;
6333
6427
  this.dispatchEvent(EventType.containerStopped);
6334
6428
  }
6335
6429
  updateActualOptions() {
@@ -6341,23 +6435,23 @@
6341
6435
  }
6342
6436
  return refresh;
6343
6437
  }
6344
- _nextFrame = (timestamp) => {
6438
+ #nextFrame = (timestamp) => {
6345
6439
  try {
6346
- if (!this._smooth &&
6347
- this._lastFrameTime !== undefined &&
6348
- timestamp < this._lastFrameTime + millisecondsToSeconds / this.fpsLimit) {
6440
+ if (!this.#smooth &&
6441
+ this.#lastFrameTime !== undefined &&
6442
+ timestamp < this.#lastFrameTime + millisecondsToSeconds / this.fpsLimit) {
6349
6443
  this.draw(false);
6350
6444
  return;
6351
6445
  }
6352
- this._lastFrameTime ??= timestamp;
6353
- updateDelta(this._delta, timestamp - this._lastFrameTime, this.fpsLimit, this._smooth);
6354
- this.addLifeTime(this._delta.value);
6355
- this._lastFrameTime = timestamp;
6356
- if (this._delta.value > millisecondsToSeconds) {
6446
+ this.#lastFrameTime ??= timestamp;
6447
+ updateDelta(this.#delta, timestamp - this.#lastFrameTime, this.fpsLimit, this.#smooth);
6448
+ this.addLifeTime(this.#delta.value);
6449
+ this.#lastFrameTime = timestamp;
6450
+ if (this.#delta.value > millisecondsToSeconds) {
6357
6451
  this.draw(false);
6358
6452
  return;
6359
6453
  }
6360
- this.canvas.render.drawParticles(this._delta);
6454
+ this.canvas.render.drawParticles(this.#delta);
6361
6455
  if (!this.alive()) {
6362
6456
  this.destroy();
6363
6457
  return;
@@ -6378,10 +6472,10 @@
6378
6472
  });
6379
6473
 
6380
6474
  class BlendPluginInstance {
6381
- _container;
6382
- _defaultCompositeValue;
6475
+ #container;
6476
+ #defaultCompositeValue;
6383
6477
  constructor(container) {
6384
- this._container = container;
6478
+ this.#container = container;
6385
6479
  }
6386
6480
  drawParticleCleanup(context, particle) {
6387
6481
  if (!particle.options.blend?.enable) {
@@ -6398,14 +6492,14 @@
6398
6492
  context.globalCompositeOperation = particle.options.blend.mode;
6399
6493
  }
6400
6494
  drawSettingsCleanup(context) {
6401
- if (!this._defaultCompositeValue) {
6495
+ if (!this.#defaultCompositeValue) {
6402
6496
  return;
6403
6497
  }
6404
- context.globalCompositeOperation = this._defaultCompositeValue;
6498
+ context.globalCompositeOperation = this.#defaultCompositeValue;
6405
6499
  }
6406
6500
  drawSettingsSetup(context) {
6407
- const previousComposite = context.globalCompositeOperation, blend = this._container.actualOptions.blend;
6408
- this._defaultCompositeValue = previousComposite;
6501
+ const previousComposite = context.globalCompositeOperation, blend = this.#container.actualOptions.blend;
6502
+ this.#defaultCompositeValue = previousComposite;
6409
6503
  context.globalCompositeOperation = blend?.enable ? blend.mode : previousComposite;
6410
6504
  }
6411
6505
  }
@@ -6548,11 +6642,11 @@
6548
6642
  class MovePluginInstance {
6549
6643
  availablePathGenerators;
6550
6644
  pathGenerators;
6551
- _container;
6552
- _pluginManager;
6645
+ #container;
6646
+ #pluginManager;
6553
6647
  constructor(pluginManager, container) {
6554
- this._pluginManager = pluginManager;
6555
- this._container = container;
6648
+ this.#pluginManager = pluginManager;
6649
+ this.#container = container;
6556
6650
  this.availablePathGenerators = new Map();
6557
6651
  this.pathGenerators = new Map();
6558
6652
  }
@@ -6583,7 +6677,7 @@
6583
6677
  acceleration: getRangeValue(gravityOptions.acceleration),
6584
6678
  inverse: gravityOptions.inverse,
6585
6679
  };
6586
- initSpin(this._container, particle);
6680
+ initSpin(this.#container, particle);
6587
6681
  }
6588
6682
  particleDestroyed(particle) {
6589
6683
  const pathGenerator = particle.pathGenerator;
@@ -6594,7 +6688,7 @@
6594
6688
  if (!moveOptions.enable) {
6595
6689
  return;
6596
6690
  }
6597
- const container = this._container, pxRatio = container.retina.pixelRatio, slowFactor = getProximitySpeedFactor(particle), reduceFactor = container.retina.reduceFactor, baseSpeed = particle.retina.moveSpeed, moveDrift = particle.retina.moveDrift, maxSize = getRangeMax(particleOptions.size.value) * pxRatio, sizeFactor = moveOptions.size ? particle.getRadius() / maxSize : defaultSizeFactor, deltaFactor = delta.factor || defaultDeltaFactor, moveSpeed = baseSpeed * sizeFactor * slowFactor * deltaFactor * half, maxSpeed = particle.retina.maxSpeed;
6691
+ const container = this.#container, slowFactor = getProximitySpeedFactor(particle), reduceFactor = container.retina.reduceFactor, baseSpeed = particle.retina.moveSpeed, moveDrift = particle.retina.moveDrift, maxSize = particle.size.max, sizeFactor = moveOptions.size ? particle.getRadius() / maxSize : defaultSizeFactor, deltaFactor = delta.factor || defaultDeltaFactor, moveSpeed = baseSpeed * sizeFactor * slowFactor * deltaFactor * half, maxSpeed = particle.retina.maxSpeed;
6598
6692
  if (moveOptions.spin.enable) {
6599
6693
  spin(container, particle, moveSpeed, reduceFactor);
6600
6694
  }
@@ -6604,18 +6698,18 @@
6604
6698
  applyDistance(particle);
6605
6699
  }
6606
6700
  preInit() {
6607
- return this._init();
6701
+ return this.#init();
6608
6702
  }
6609
6703
  redrawInit() {
6610
- return this._init();
6704
+ return this.#init();
6611
6705
  }
6612
6706
  update() {
6613
6707
  for (const pathGenerator of this.pathGenerators.values()) {
6614
6708
  pathGenerator.update();
6615
6709
  }
6616
6710
  }
6617
- async _init() {
6618
- const availablePathGenerators = await this._pluginManager.getPathGenerators?.(this._container, true);
6711
+ async #init() {
6712
+ const availablePathGenerators = await this.#pluginManager.getPathGenerators?.(this.#container, true);
6619
6713
  if (!availablePathGenerators) {
6620
6714
  return;
6621
6715
  }
@@ -6634,65 +6728,65 @@
6634
6728
 
6635
6729
  const touchDelay = 500;
6636
6730
  class InteractivityEventListeners {
6637
- _canPush = true;
6638
- _clickPositionPlugins;
6639
- _container;
6640
- _handlers;
6641
- _interactionManager;
6642
- _touches;
6731
+ #canPush = true;
6732
+ #clickPositionPlugins;
6733
+ #container;
6734
+ #handlers;
6735
+ #interactionManager;
6736
+ #touches;
6643
6737
  constructor(container, interactionManager) {
6644
- this._container = container;
6645
- this._clickPositionPlugins = [];
6646
- this._interactionManager = interactionManager;
6647
- this._touches = new Map();
6648
- this._handlers = {
6738
+ this.#container = container;
6739
+ this.#clickPositionPlugins = [];
6740
+ this.#interactionManager = interactionManager;
6741
+ this.#touches = new Map();
6742
+ this.#handlers = {
6649
6743
  mouseDown: () => {
6650
- this._mouseDown();
6744
+ this.#mouseDown();
6651
6745
  },
6652
6746
  mouseLeave: () => {
6653
- this._mouseTouchFinish();
6747
+ this.#mouseTouchFinish();
6654
6748
  },
6655
6749
  mouseMove: (e) => {
6656
- this._mouseTouchMove(e);
6750
+ this.#mouseTouchMove(e);
6657
6751
  },
6658
6752
  mouseUp: (e) => {
6659
- this._mouseTouchClick(e);
6753
+ this.#mouseTouchClick(e);
6660
6754
  },
6661
6755
  touchStart: (e) => {
6662
- this._touchStart(e);
6756
+ this.#touchStart(e);
6663
6757
  },
6664
6758
  touchMove: (e) => {
6665
- this._mouseTouchMove(e);
6759
+ this.#mouseTouchMove(e);
6666
6760
  },
6667
6761
  touchEnd: (e) => {
6668
- this._touchEnd(e);
6762
+ this.#touchEnd(e);
6669
6763
  },
6670
6764
  touchCancel: (e) => {
6671
- this._touchEnd(e);
6765
+ this.#touchEnd(e);
6672
6766
  },
6673
6767
  touchEndClick: (e) => {
6674
- this._touchEndClick(e);
6768
+ this.#touchEndClick(e);
6675
6769
  },
6676
6770
  visibilityChange: () => {
6677
- this._handleVisibilityChange();
6771
+ this.#handleVisibilityChange();
6678
6772
  },
6679
6773
  };
6680
6774
  }
6681
6775
  addListeners() {
6682
- this._manageListeners(true);
6776
+ this.#manageListeners(true);
6683
6777
  }
6684
6778
  init() {
6685
- this._clickPositionPlugins.length = 0;
6686
- for (const plugin of this._container.plugins.filter(p => !!p.clickPositionValid)) {
6687
- this._clickPositionPlugins.push(plugin);
6779
+ this.#clickPositionPlugins.length = 0;
6780
+ for (const plugin of this.#container.plugins.filter(p => !!p.clickPositionValid)) {
6781
+ this.#clickPositionPlugins.push(plugin);
6688
6782
  }
6689
6783
  }
6690
6784
  removeListeners() {
6691
- this._manageListeners(false);
6785
+ this.#manageListeners(false);
6692
6786
  }
6693
- _doMouseTouchClick = e => {
6694
- const container = this._container, interactionManager = this._interactionManager, options = container.actualOptions;
6695
- if (this._canPush) {
6787
+ #doMouseTouchClick = e => {
6788
+ const container = this.#container, interactionManager = this.#interactionManager, options = container.actualOptions;
6789
+ if (this.#canPush) {
6696
6790
  const mouseInteractivity = interactionManager.interactivityData.mouse, mousePos = mouseInteractivity.position;
6697
6791
  if (!mousePos) {
6698
6792
  return;
@@ -6709,15 +6803,15 @@
6709
6803
  }
6710
6804
  if (e.type === "touchend") {
6711
6805
  setTimeout(() => {
6712
- this._mouseTouchFinish();
6806
+ this.#mouseTouchFinish();
6713
6807
  }, touchDelay);
6714
6808
  }
6715
6809
  };
6716
- _handleVisibilityChange = () => {
6717
- this._mouseTouchFinish();
6810
+ #handleVisibilityChange = () => {
6811
+ this.#mouseTouchFinish();
6718
6812
  };
6719
- _manageInteractivityListeners = add => {
6720
- const handlers = this._handlers, container = this._container, interactionManager = this._interactionManager, options = container.actualOptions, interactivityEl = interactionManager.interactivityData.element;
6813
+ #manageInteractivityListeners = add => {
6814
+ const handlers = this.#handlers, container = this.#container, interactionManager = this.#interactionManager, options = container.actualOptions, interactivityEl = interactionManager.interactivityData.element;
6721
6815
  if (!interactivityEl) {
6722
6816
  return;
6723
6817
  }
@@ -6748,8 +6842,8 @@
6748
6842
  manageListener(interactivityEl, mouseLeaveEvent, handlers.mouseLeave, add);
6749
6843
  manageListener(interactivityEl, touchCancelEvent, handlers.touchCancel, add);
6750
6844
  };
6751
- _manageListeners = add => {
6752
- const handlers = this._handlers, container = this._container, interactionManager = this._interactionManager, options = container.actualOptions, detectType = options.interactivity?.detectsOn, canvasEl = container.canvas.domElement;
6845
+ #manageListeners = add => {
6846
+ const handlers = this.#handlers, container = this.#container, interactionManager = this.#interactionManager, options = container.actualOptions, detectType = options.interactivity?.detectsOn, canvasEl = container.canvas.domElement;
6753
6847
  if (detectType === InteractivityDetect.window) {
6754
6848
  interactionManager.interactivityData.element = safeDocument();
6755
6849
  }
@@ -6759,35 +6853,35 @@
6759
6853
  else {
6760
6854
  interactionManager.interactivityData.element = canvasEl;
6761
6855
  }
6762
- this._manageInteractivityListeners(add);
6856
+ this.#manageInteractivityListeners(add);
6763
6857
  manageListener(document, visibilityChangeEvent, handlers.visibilityChange, add, false);
6764
6858
  };
6765
- _mouseDown = () => {
6766
- const { interactivityData } = this._interactionManager, { mouse } = interactivityData;
6859
+ #mouseDown = () => {
6860
+ const { interactivityData } = this.#interactionManager, { mouse } = interactivityData;
6767
6861
  mouse.clicking = true;
6768
6862
  mouse.downPosition = mouse.position;
6769
6863
  };
6770
- _mouseTouchClick = e => {
6771
- const container = this._container, interactionManager = this._interactionManager, options = container.actualOptions, { mouse } = interactionManager.interactivityData;
6864
+ #mouseTouchClick = e => {
6865
+ const container = this.#container, interactionManager = this.#interactionManager, options = container.actualOptions, { mouse } = interactionManager.interactivityData;
6772
6866
  mouse.inside = true;
6773
6867
  let handled = false;
6774
6868
  const mousePosition = mouse.position;
6775
6869
  if (!mousePosition || !options.interactivity?.events.onClick.enable) {
6776
6870
  return;
6777
6871
  }
6778
- for (const plugin of this._clickPositionPlugins) {
6872
+ for (const plugin of this.#clickPositionPlugins) {
6779
6873
  handled = plugin.clickPositionValid?.(mousePosition) ?? false;
6780
6874
  if (handled) {
6781
6875
  break;
6782
6876
  }
6783
6877
  }
6784
6878
  if (!handled) {
6785
- this._doMouseTouchClick(e);
6879
+ this.#doMouseTouchClick(e);
6786
6880
  }
6787
6881
  mouse.clicking = false;
6788
6882
  };
6789
- _mouseTouchFinish = () => {
6790
- const { interactivityData } = this._interactionManager, { mouse } = interactivityData;
6883
+ #mouseTouchFinish = () => {
6884
+ const { interactivityData } = this.#interactionManager, { mouse } = interactivityData;
6791
6885
  delete mouse.position;
6792
6886
  delete mouse.clickPosition;
6793
6887
  delete mouse.downPosition;
@@ -6795,15 +6889,15 @@
6795
6889
  mouse.inside = false;
6796
6890
  mouse.clicking = false;
6797
6891
  };
6798
- _mouseTouchMove = e => {
6799
- const container = this._container, interactionManager = this._interactionManager, options = container.actualOptions, interactivity = interactionManager.interactivityData, canvasEl = container.canvas.domElement;
6892
+ #mouseTouchMove = e => {
6893
+ const container = this.#container, interactionManager = this.#interactionManager, options = container.actualOptions, interactivity = interactionManager.interactivityData, canvasEl = container.canvas.domElement;
6800
6894
  if (!interactivity.element) {
6801
6895
  return;
6802
6896
  }
6803
6897
  interactivity.mouse.inside = true;
6804
6898
  let pos;
6805
6899
  if (e.type.startsWith("pointer")) {
6806
- this._canPush = true;
6900
+ this.#canPush = true;
6807
6901
  const mouseEvent = e;
6808
6902
  if (interactivity.element === safeDocument()) {
6809
6903
  if (canvasEl) {
@@ -6838,7 +6932,7 @@
6838
6932
  }
6839
6933
  }
6840
6934
  else {
6841
- this._canPush = e.type !== "touchmove";
6935
+ this.#canPush = e.type !== "touchmove";
6842
6936
  if (canvasEl) {
6843
6937
  const touchEvent = e, lastTouch = touchEvent.touches[touchEvent.touches.length - lengthOffset], canvasRect = canvasEl.getBoundingClientRect();
6844
6938
  if (!lastTouch) {
@@ -6858,60 +6952,60 @@
6858
6952
  interactivity.mouse.position = pos;
6859
6953
  interactivity.status = mouseMoveEvent;
6860
6954
  };
6861
- _touchEnd = e => {
6955
+ #touchEnd = e => {
6862
6956
  const evt = e, touches = Array.from(evt.changedTouches);
6863
6957
  for (const touch of touches) {
6864
- this._touches.delete(touch.identifier);
6958
+ this.#touches.delete(touch.identifier);
6865
6959
  }
6866
- this._mouseTouchFinish();
6960
+ this.#mouseTouchFinish();
6867
6961
  };
6868
- _touchEndClick = e => {
6962
+ #touchEndClick = e => {
6869
6963
  const evt = e, touches = Array.from(evt.changedTouches);
6870
6964
  for (const touch of touches) {
6871
- this._touches.delete(touch.identifier);
6965
+ this.#touches.delete(touch.identifier);
6872
6966
  }
6873
- this._mouseTouchClick(e);
6967
+ this.#mouseTouchClick(e);
6874
6968
  };
6875
- _touchStart = e => {
6969
+ #touchStart = e => {
6876
6970
  const evt = e, touches = Array.from(evt.changedTouches);
6877
6971
  for (const touch of touches) {
6878
- this._touches.set(touch.identifier, performance.now());
6972
+ this.#touches.set(touch.identifier, performance.now());
6879
6973
  }
6880
- this._mouseTouchMove(e);
6974
+ this.#mouseTouchMove(e);
6881
6975
  };
6882
6976
  }
6883
6977
 
6884
6978
  const clickRadius = 1, touchEndLengthOffset = 1, minCoordinate = 0;
6885
6979
  class InteractionManager {
6886
- container;
6887
6980
  interactivityData;
6888
- _clickHandlers;
6889
- _eventListeners;
6890
- _externalInteractors;
6891
- _interactors;
6892
- _intersectionObserver;
6893
- _particleInteractors;
6894
- _pluginManager;
6981
+ #clickHandlers;
6982
+ #container;
6983
+ #eventListeners;
6984
+ #externalInteractors;
6985
+ #interactors;
6986
+ #intersectionObserver;
6987
+ #particleInteractors;
6988
+ #pluginManager;
6895
6989
  constructor(pluginManager, container) {
6896
- this.container = container;
6897
- this._pluginManager = pluginManager;
6898
- this._interactors = [];
6899
- this._externalInteractors = [];
6900
- this._particleInteractors = [];
6901
- this._clickHandlers = new Map();
6902
- this._eventListeners = new InteractivityEventListeners(container, this);
6990
+ this.#container = container;
6991
+ this.#pluginManager = pluginManager;
6992
+ this.#interactors = [];
6993
+ this.#externalInteractors = [];
6994
+ this.#particleInteractors = [];
6995
+ this.#clickHandlers = new Map();
6996
+ this.#eventListeners = new InteractivityEventListeners(container, this);
6903
6997
  this.interactivityData = {
6904
6998
  mouse: {
6905
6999
  clicking: false,
6906
7000
  inside: false,
6907
7001
  },
6908
7002
  };
6909
- this._intersectionObserver = safeIntersectionObserver(entries => {
6910
- this._intersectionManager(entries);
7003
+ this.#intersectionObserver = safeIntersectionObserver(entries => {
7004
+ this.#intersectionManager(entries);
6911
7005
  });
6912
7006
  }
6913
7007
  addClickHandler(callback) {
6914
- const { container, interactivityData } = this;
7008
+ const container = this.#container, interactivityData = this.interactivityData;
6915
7009
  if (container.destroyed) {
6916
7010
  return;
6917
7011
  }
@@ -6973,119 +7067,119 @@
6973
7067
  touchMoved = false;
6974
7068
  };
6975
7069
  let touched = false, touchMoved = false;
6976
- this._clickHandlers.set(clickEvent, clickHandler);
6977
- this._clickHandlers.set(touchStartEvent, touchStartHandler);
6978
- this._clickHandlers.set(touchMoveEvent, touchMoveHandler);
6979
- this._clickHandlers.set(touchEndEvent, touchEndHandler);
6980
- this._clickHandlers.set(touchCancelEvent, touchCancelHandler);
6981
- for (const [key, handler] of this._clickHandlers) {
7070
+ this.#clickHandlers.set(clickEvent, clickHandler);
7071
+ this.#clickHandlers.set(touchStartEvent, touchStartHandler);
7072
+ this.#clickHandlers.set(touchMoveEvent, touchMoveHandler);
7073
+ this.#clickHandlers.set(touchEndEvent, touchEndHandler);
7074
+ this.#clickHandlers.set(touchCancelEvent, touchCancelHandler);
7075
+ for (const [key, handler] of this.#clickHandlers) {
6982
7076
  el.addEventListener(key, handler);
6983
7077
  }
6984
7078
  }
6985
7079
  addListeners() {
6986
- this._eventListeners.addListeners();
7080
+ this.#eventListeners.addListeners();
6987
7081
  }
6988
7082
  clearClickHandlers() {
6989
- const { container, interactivityData } = this;
7083
+ const container = this.#container, interactivityData = this.interactivityData;
6990
7084
  if (container.destroyed) {
6991
7085
  return;
6992
7086
  }
6993
- for (const [key, handler] of this._clickHandlers) {
7087
+ for (const [key, handler] of this.#clickHandlers) {
6994
7088
  interactivityData.element?.removeEventListener(key, handler);
6995
7089
  }
6996
- this._clickHandlers.clear();
7090
+ this.#clickHandlers.clear();
6997
7091
  }
6998
7092
  externalInteract(delta) {
6999
- for (const interactor of this._externalInteractors) {
7000
- const { interactivityData } = this;
7093
+ for (const interactor of this.#externalInteractors) {
7094
+ const interactivityData = this.interactivityData;
7001
7095
  if (interactor.isEnabled(interactivityData)) {
7002
7096
  interactor.interact(interactivityData, delta);
7003
7097
  }
7004
7098
  }
7005
7099
  }
7006
7100
  handleClickMode(mode) {
7007
- if (this.container.destroyed) {
7101
+ if (this.#container.destroyed) {
7008
7102
  return;
7009
7103
  }
7010
- const { interactivityData } = this;
7011
- for (const interactor of this._externalInteractors) {
7104
+ const interactivityData = this.interactivityData;
7105
+ for (const interactor of this.#externalInteractors) {
7012
7106
  interactor.handleClickMode?.(mode, interactivityData);
7013
7107
  }
7014
7108
  }
7015
7109
  init() {
7016
- this._eventListeners.init();
7017
- for (const interactor of this._interactors) {
7110
+ this.#eventListeners.init();
7111
+ for (const interactor of this.#interactors) {
7018
7112
  switch (interactor.type) {
7019
7113
  case InteractorType.external:
7020
- this._externalInteractors.push(interactor);
7114
+ this.#externalInteractors.push(interactor);
7021
7115
  break;
7022
7116
  case InteractorType.particles:
7023
- this._particleInteractors.push(interactor);
7117
+ this.#particleInteractors.push(interactor);
7024
7118
  break;
7025
7119
  }
7026
7120
  interactor.init();
7027
7121
  }
7028
7122
  }
7029
7123
  async initInteractors() {
7030
- const interactors = await this._pluginManager.getInteractors?.(this.container, true);
7124
+ const interactors = await this.#pluginManager.getInteractors?.(this.#container, true);
7031
7125
  if (!interactors) {
7032
7126
  return;
7033
7127
  }
7034
- this._interactors = interactors;
7035
- this._externalInteractors = [];
7036
- this._particleInteractors = [];
7128
+ this.#interactors = interactors;
7129
+ this.#externalInteractors = [];
7130
+ this.#particleInteractors = [];
7037
7131
  }
7038
7132
  particlesInteract(particle, delta) {
7039
- const { interactivityData } = this;
7040
- for (const interactor of this._externalInteractors) {
7133
+ const interactivityData = this.interactivityData;
7134
+ for (const interactor of this.#externalInteractors) {
7041
7135
  interactor.clear(particle, delta);
7042
7136
  }
7043
- for (const interactor of this._particleInteractors) {
7137
+ for (const interactor of this.#particleInteractors) {
7044
7138
  if (interactor.isEnabled(particle, interactivityData)) {
7045
7139
  interactor.interact(particle, interactivityData, delta);
7046
7140
  }
7047
7141
  }
7048
7142
  }
7049
7143
  removeListeners() {
7050
- this._eventListeners.removeListeners();
7144
+ this.#eventListeners.removeListeners();
7051
7145
  }
7052
7146
  reset(particle) {
7053
- const { interactivityData } = this;
7054
- for (const interactor of this._externalInteractors) {
7147
+ const interactivityData = this.interactivityData;
7148
+ for (const interactor of this.#externalInteractors) {
7055
7149
  if (interactor.isEnabled(interactivityData)) {
7056
7150
  interactor.reset(interactivityData, particle);
7057
7151
  }
7058
7152
  }
7059
- for (const interactor of this._particleInteractors) {
7153
+ for (const interactor of this.#particleInteractors) {
7060
7154
  if (interactor.isEnabled(particle, interactivityData)) {
7061
7155
  interactor.reset(interactivityData, particle);
7062
7156
  }
7063
7157
  }
7064
7158
  }
7065
7159
  startObserving() {
7066
- const { interactivityData } = this;
7067
- if (interactivityData.element instanceof HTMLElement && this._intersectionObserver) {
7068
- this._intersectionObserver.observe(interactivityData.element);
7160
+ const interactivityData = this.interactivityData;
7161
+ if (interactivityData.element instanceof HTMLElement && this.#intersectionObserver) {
7162
+ this.#intersectionObserver.observe(interactivityData.element);
7069
7163
  }
7070
7164
  }
7071
7165
  stopObserving() {
7072
- const { interactivityData } = this;
7073
- if (interactivityData.element instanceof HTMLElement && this._intersectionObserver) {
7074
- this._intersectionObserver.unobserve(interactivityData.element);
7166
+ const interactivityData = this.interactivityData;
7167
+ if (interactivityData.element instanceof HTMLElement && this.#intersectionObserver) {
7168
+ this.#intersectionObserver.unobserve(interactivityData.element);
7075
7169
  }
7076
7170
  }
7077
7171
  updateMaxDistance() {
7078
7172
  let maxTotalDistance = 0;
7079
- for (const interactor of this._interactors) {
7173
+ for (const interactor of this.#interactors) {
7080
7174
  if (interactor.maxDistance > maxTotalDistance) {
7081
7175
  maxTotalDistance = interactor.maxDistance;
7082
7176
  }
7083
7177
  }
7084
- const container = this.container;
7178
+ const container = this.#container;
7085
7179
  container.particles.grid.setCellSize(maxTotalDistance * container.retina.pixelRatio);
7086
7180
  }
7087
- _intersectionManager = entries => {
7088
- const { container } = this;
7181
+ #intersectionManager = entries => {
7182
+ const container = this.#container;
7089
7183
  if (container.destroyed || !container.actualOptions.pauseOnOutsideViewport) {
7090
7184
  return;
7091
7185
  }
@@ -7105,13 +7199,13 @@
7105
7199
 
7106
7200
  class InteractivityPluginInstance {
7107
7201
  interactionManager;
7108
- _container;
7109
- _pluginManager;
7202
+ #container;
7203
+ #pluginManager;
7110
7204
  constructor(pluginManager, container) {
7111
- this._container = container;
7112
- this._pluginManager = pluginManager;
7205
+ this.#container = container;
7206
+ this.#pluginManager = pluginManager;
7113
7207
  this.interactionManager = new InteractionManager(pluginManager, container);
7114
- this._container.addClickHandler = (callback) => {
7208
+ this.#container.addClickHandler = (callback) => {
7115
7209
  this.interactionManager.addClickHandler(callback);
7116
7210
  };
7117
7211
  }
@@ -7123,11 +7217,11 @@
7123
7217
  }
7124
7218
  destroy() {
7125
7219
  this.clearClickHandlers();
7126
- this._pluginManager.interactors?.delete(this._container);
7220
+ this.#pluginManager.interactors?.delete(this.#container);
7127
7221
  }
7128
7222
  particleCreated(particle) {
7129
- const interactivityParticle = particle, interactivity = new Interactivity(this._pluginManager, this._container);
7130
- interactivity.load(this._container.actualOptions.interactivity);
7223
+ const interactivityParticle = particle, interactivity = new Interactivity(this.#pluginManager, this.#container);
7224
+ interactivity.load(this.#container.actualOptions.interactivity);
7131
7225
  interactivity.load(interactivityParticle.options.interactivity);
7132
7226
  interactivityParticle.interactivity = interactivity;
7133
7227
  }
@@ -7180,14 +7274,14 @@
7180
7274
 
7181
7275
  const minOpacity = 0, minWidth = 0, minDistance = 0, maxFrequency = 1, defaultFrequency = 0;
7182
7276
  class LinkInstance {
7183
- _colorCache = new Map();
7184
- _container;
7185
- _freqs;
7186
- _pluginManager;
7277
+ #colorCache = new Map();
7278
+ #container;
7279
+ #freqs;
7280
+ #pluginManager;
7187
7281
  constructor(pluginManager, container) {
7188
- this._pluginManager = pluginManager;
7189
- this._container = container;
7190
- this._freqs = { links: new Map(), triangles: new Map() };
7282
+ this.#pluginManager = pluginManager;
7283
+ this.#container = container;
7284
+ this.#freqs = { links: new Map(), triangles: new Map() };
7191
7285
  }
7192
7286
  drawParticle(context, particle) {
7193
7287
  const { links, options } = particle;
@@ -7204,13 +7298,13 @@
7204
7298
  };
7205
7299
  for (const link of links) {
7206
7300
  if (linkOpts.frequency < maxFrequency &&
7207
- this._getLinkFrequency(particle, link.destination) > linkOpts.frequency) {
7301
+ this.#getLinkFrequency(particle, link.destination) > linkOpts.frequency) {
7208
7302
  continue;
7209
7303
  }
7210
7304
  const pos2 = link.destination.getPosition();
7211
7305
  if (trianglesEnabled && !link.isWarped && p1Destinations) {
7212
7306
  flushLines();
7213
- this._drawTriangles(options, particle, link, p1Destinations, pos1, pos2, context);
7307
+ this.#drawTriangles(options, particle, link, p1Destinations, pos1, pos2, context);
7214
7308
  }
7215
7309
  if (link.opacity <= minOpacity || width <= minWidth) {
7216
7310
  continue;
@@ -7220,7 +7314,7 @@
7220
7314
  }
7221
7315
  let opacity = link.opacity, colorLine = link.color;
7222
7316
  const twinkleRgb = twinkle?.enable && getRandom() < twinkle.frequency
7223
- ? rangeColorToRgb(this._pluginManager, twinkle.color)
7317
+ ? rangeColorToRgb(this.#pluginManager, twinkle.color)
7224
7318
  : undefined;
7225
7319
  if (twinkle && twinkleRgb) {
7226
7320
  colorLine = twinkleRgb;
@@ -7228,14 +7322,14 @@
7228
7322
  }
7229
7323
  if (!colorLine) {
7230
7324
  const linkColor = linkOpts.id !== undefined
7231
- ? this._container.particles.linksColors.get(linkOpts.id)
7232
- : this._container.particles.linksColor;
7325
+ ? this.#container.particles.linksColors.get(linkOpts.id)
7326
+ : this.#container.particles.linksColor;
7233
7327
  colorLine = getLinkColor(particle, link.destination, linkColor);
7234
7328
  }
7235
7329
  if (!colorLine) {
7236
7330
  continue;
7237
7331
  }
7238
- const colorStyle = this._getCachedStyle(colorLine);
7332
+ const colorStyle = this.#getCachedStyle(colorLine);
7239
7333
  if (colorStyle !== currentColorStyle || width !== currentWidth || opacity !== currentAlpha) {
7240
7334
  flushLines();
7241
7335
  context.strokeStyle = colorStyle;
@@ -7248,7 +7342,7 @@
7248
7342
  pathOpen = true;
7249
7343
  }
7250
7344
  if (link.isWarped) {
7251
- const canvasSize = this._container.canvas.size, dx = pos2.x - pos1.x, dy = pos2.y - pos1.y;
7345
+ const canvasSize = this.#container.canvas.size, dx = pos2.x - pos1.x, dy = pos2.y - pos1.y;
7252
7346
  let sx = originPoint.x, sy = originPoint.y;
7253
7347
  if (Math.abs(dx) > canvasSize.width * half) {
7254
7348
  sx = dx > minDistance ? -canvasSize.width : canvasSize.width;
@@ -7270,9 +7364,9 @@
7270
7364
  context.globalAlpha = originalAlpha;
7271
7365
  }
7272
7366
  init() {
7273
- this._freqs.links.clear();
7274
- this._freqs.triangles.clear();
7275
- this._colorCache.clear();
7367
+ this.#freqs.links.clear();
7368
+ this.#freqs.triangles.clear();
7369
+ this.#colorCache.clear();
7276
7370
  return Promise.resolve();
7277
7371
  }
7278
7372
  particleCreated(particle) {
@@ -7282,14 +7376,14 @@
7282
7376
  }
7283
7377
  particle.linksDistance = particle.options.links.distance;
7284
7378
  particle.linksWidth = particle.options.links.width;
7285
- const ratio = this._container.retina.pixelRatio;
7379
+ const ratio = this.#container.retina.pixelRatio;
7286
7380
  particle.retina.linksDistance = particle.linksDistance * ratio;
7287
7381
  particle.retina.linksWidth = particle.linksWidth * ratio;
7288
7382
  }
7289
7383
  particleDestroyed(particle) {
7290
7384
  particle.links = [];
7291
7385
  }
7292
- _drawTriangles(options, p1, link, p1Destinations, pos1, pos2, context) {
7386
+ #drawTriangles(options, p1, link, p1Destinations, pos1, pos2, context) {
7293
7387
  const p2 = link.destination, triangleOptions = options.links?.triangles;
7294
7388
  if (!triangleOptions?.enable || !p2.options.links?.triangles.enable) {
7295
7389
  return;
@@ -7300,21 +7394,21 @@
7300
7394
  }
7301
7395
  for (const vertex of p2Links) {
7302
7396
  if (vertex.isWarped ||
7303
- this._getLinkFrequency(p2, vertex.destination) > p2.options.links.frequency ||
7397
+ this.#getLinkFrequency(p2, vertex.destination) > p2.options.links.frequency ||
7304
7398
  !p1Destinations.has(vertex.destination.id)) {
7305
7399
  continue;
7306
7400
  }
7307
7401
  const p3 = vertex.destination;
7308
- if (this._getTriangleFrequency(p1, p2, p3) > (options.links?.triangles.frequency ?? defaultFrequency)) {
7402
+ if (this.#getTriangleFrequency(p1, p2, p3) > (options.links?.triangles.frequency ?? defaultFrequency)) {
7309
7403
  continue;
7310
7404
  }
7311
- const opacityTriangle = triangleOptions.opacity ?? (link.opacity + vertex.opacity) * half, colorTriangle = rangeColorToRgb(this._pluginManager, triangleOptions.color) ?? link.color;
7405
+ const opacityTriangle = triangleOptions.opacity ?? (link.opacity + vertex.opacity) * half, colorTriangle = rangeColorToRgb(this.#pluginManager, triangleOptions.color) ?? link.color;
7312
7406
  if (!colorTriangle || opacityTriangle <= minOpacity) {
7313
7407
  continue;
7314
7408
  }
7315
7409
  const pos3 = p3.getPosition();
7316
7410
  context.save();
7317
- context.fillStyle = this._getCachedStyle(colorTriangle);
7411
+ context.fillStyle = this.#getCachedStyle(colorTriangle);
7318
7412
  context.globalAlpha = opacityTriangle;
7319
7413
  context.beginPath();
7320
7414
  context.moveTo(pos1.x, pos1.y);
@@ -7325,20 +7419,20 @@
7325
7419
  context.restore();
7326
7420
  }
7327
7421
  }
7328
- _getCachedStyle(rgb) {
7422
+ #getCachedStyle(rgb) {
7329
7423
  const key = `${rgb.r},${rgb.g},${rgb.b}`;
7330
- let style = this._colorCache.get(key);
7424
+ let style = this.#colorCache.get(key);
7331
7425
  if (!style) {
7332
- style = getStyleFromRgb(rgb, this._container.hdr);
7333
- this._colorCache.set(key, style);
7426
+ style = getStyleFromRgb(rgb, this.#container.hdr);
7427
+ this.#colorCache.set(key, style);
7334
7428
  }
7335
7429
  return style;
7336
7430
  }
7337
- _getLinkFrequency(p1, p2) {
7338
- return setLinkFrequency([p1, p2], this._freqs.links);
7431
+ #getLinkFrequency(p1, p2) {
7432
+ return setLinkFrequency([p1, p2], this.#freqs.links);
7339
7433
  }
7340
- _getTriangleFrequency(p1, p2, p3) {
7341
- return setLinkFrequency([p1, p2, p3], this._freqs.triangles);
7434
+ #getTriangleFrequency(p1, p2, p3) {
7435
+ return setLinkFrequency([p1, p2, p3], this.#freqs.triangles);
7342
7436
  }
7343
7437
  }
7344
7438