@tsparticles/engine 3.3.0 → 3.5.0

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.
Files changed (272) hide show
  1. package/README.md +0 -4
  2. package/browser/Core/Canvas.js +27 -22
  3. package/browser/Core/Container.js +57 -44
  4. package/browser/Core/Engine.js +82 -74
  5. package/browser/Core/Particle.js +29 -15
  6. package/browser/Core/Particles.js +23 -24
  7. package/browser/Core/Utils/EventListeners.js +18 -17
  8. package/browser/Core/Utils/ExternalInteractorBase.js +2 -1
  9. package/browser/Core/Utils/InteractionManager.js +3 -2
  10. package/browser/Core/Utils/ParticlesInteractorBase.js +2 -1
  11. package/browser/Core/Utils/QuadTree.js +1 -1
  12. package/browser/Core/Utils/Ranges.js +5 -4
  13. package/browser/Enums/AnimationStatus.js +5 -1
  14. package/browser/Enums/Directions/MoveDirection.js +14 -1
  15. package/browser/Enums/Directions/OutModeDirection.js +7 -1
  16. package/browser/Enums/Directions/RotateDirection.js +6 -1
  17. package/browser/Enums/InteractivityDetect.js +6 -1
  18. package/browser/Enums/Modes/AnimationMode.js +7 -1
  19. package/browser/Enums/Modes/CollisionMode.js +6 -1
  20. package/browser/Enums/Modes/LimitMode.js +5 -1
  21. package/browser/Enums/Modes/OutMode.js +8 -1
  22. package/browser/Enums/Modes/PixelMode.js +5 -1
  23. package/browser/Enums/Modes/ResponsiveMode.js +5 -1
  24. package/browser/Enums/Modes/ThemeMode.js +6 -1
  25. package/browser/Enums/Types/AlterType.js +5 -1
  26. package/browser/Enums/Types/DestroyType.js +6 -1
  27. package/browser/Enums/Types/DivType.js +5 -1
  28. package/browser/Enums/Types/EasingType.js +30 -1
  29. package/browser/Enums/Types/EventType.js +15 -1
  30. package/browser/Enums/Types/GradientType.js +6 -1
  31. package/browser/Enums/Types/InteractorType.js +5 -1
  32. package/browser/Enums/Types/ParticleOutType.js +6 -1
  33. package/browser/Enums/Types/StartValueType.js +6 -1
  34. package/browser/Options/Classes/AnimationOptions.js +4 -2
  35. package/browser/Options/Classes/Interactivity/Events/DivEvent.js +2 -1
  36. package/browser/Options/Classes/Interactivity/Events/Events.js +1 -1
  37. package/browser/Options/Classes/Interactivity/Interactivity.js +2 -1
  38. package/browser/Options/Classes/ManualParticle.js +2 -1
  39. package/browser/Options/Classes/Options.js +14 -12
  40. package/browser/Options/Classes/Particles/Collisions/Collisions.js +2 -1
  41. package/browser/Options/Classes/Particles/Move/Move.js +2 -1
  42. package/browser/Options/Classes/Particles/Move/MoveCenter.js +2 -1
  43. package/browser/Options/Classes/Particles/Move/OutModes.js +2 -1
  44. package/browser/Options/Classes/Particles/Number/ParticlesNumberLimit.js +2 -1
  45. package/browser/Options/Classes/Particles/Opacity/OpacityAnimation.js +2 -1
  46. package/browser/Options/Classes/Particles/ParticlesOptions.js +1 -1
  47. package/browser/Options/Classes/Particles/Size/SizeAnimation.js +2 -1
  48. package/browser/Options/Classes/Responsive.js +5 -4
  49. package/browser/Options/Classes/Theme/ThemeDefault.js +2 -1
  50. package/browser/Types/RangeType.js +5 -1
  51. package/browser/Utils/CanvasUtils.js +13 -7
  52. package/browser/Utils/ColorUtils.js +17 -9
  53. package/browser/Utils/EventDispatcher.js +1 -1
  54. package/browser/Utils/HslColorManager.js +11 -4
  55. package/browser/Utils/NumberUtils.js +28 -14
  56. package/browser/Utils/RgbColorManager.js +11 -4
  57. package/browser/Utils/Utils.js +37 -31
  58. package/cjs/Core/Canvas.js +27 -22
  59. package/cjs/Core/Container.js +57 -44
  60. package/cjs/Core/Engine.js +82 -74
  61. package/cjs/Core/Particle.js +29 -15
  62. package/cjs/Core/Particles.js +23 -24
  63. package/cjs/Core/Utils/EventListeners.js +18 -17
  64. package/cjs/Core/Utils/ExternalInteractorBase.js +2 -1
  65. package/cjs/Core/Utils/InteractionManager.js +3 -2
  66. package/cjs/Core/Utils/ParticlesInteractorBase.js +2 -1
  67. package/cjs/Core/Utils/QuadTree.js +1 -1
  68. package/cjs/Core/Utils/Ranges.js +5 -4
  69. package/cjs/Enums/AnimationStatus.js +6 -0
  70. package/cjs/Enums/Directions/MoveDirection.js +15 -0
  71. package/cjs/Enums/Directions/OutModeDirection.js +8 -0
  72. package/cjs/Enums/Directions/RotateDirection.js +7 -0
  73. package/cjs/Enums/InteractivityDetect.js +7 -0
  74. package/cjs/Enums/Modes/AnimationMode.js +8 -0
  75. package/cjs/Enums/Modes/CollisionMode.js +7 -0
  76. package/cjs/Enums/Modes/LimitMode.js +6 -0
  77. package/cjs/Enums/Modes/OutMode.js +9 -0
  78. package/cjs/Enums/Modes/PixelMode.js +6 -0
  79. package/cjs/Enums/Modes/ResponsiveMode.js +6 -0
  80. package/cjs/Enums/Modes/ThemeMode.js +7 -0
  81. package/cjs/Enums/Types/AlterType.js +6 -0
  82. package/cjs/Enums/Types/DestroyType.js +7 -0
  83. package/cjs/Enums/Types/DivType.js +6 -0
  84. package/cjs/Enums/Types/EasingType.js +31 -0
  85. package/cjs/Enums/Types/EventType.js +16 -0
  86. package/cjs/Enums/Types/GradientType.js +7 -0
  87. package/cjs/Enums/Types/InteractorType.js +6 -0
  88. package/cjs/Enums/Types/ParticleOutType.js +7 -0
  89. package/cjs/Enums/Types/StartValueType.js +7 -0
  90. package/cjs/Options/Classes/AnimationOptions.js +4 -2
  91. package/cjs/Options/Classes/Interactivity/Events/DivEvent.js +2 -1
  92. package/cjs/Options/Classes/Interactivity/Events/Events.js +1 -1
  93. package/cjs/Options/Classes/Interactivity/Interactivity.js +2 -1
  94. package/cjs/Options/Classes/ManualParticle.js +2 -1
  95. package/cjs/Options/Classes/Options.js +14 -12
  96. package/cjs/Options/Classes/Particles/Collisions/Collisions.js +2 -1
  97. package/cjs/Options/Classes/Particles/Move/Move.js +2 -1
  98. package/cjs/Options/Classes/Particles/Move/MoveCenter.js +2 -1
  99. package/cjs/Options/Classes/Particles/Move/OutModes.js +2 -1
  100. package/cjs/Options/Classes/Particles/Number/ParticlesNumberLimit.js +2 -1
  101. package/cjs/Options/Classes/Particles/Opacity/OpacityAnimation.js +2 -1
  102. package/cjs/Options/Classes/Particles/ParticlesOptions.js +1 -1
  103. package/cjs/Options/Classes/Particles/Size/SizeAnimation.js +2 -1
  104. package/cjs/Options/Classes/Responsive.js +5 -4
  105. package/cjs/Options/Classes/Theme/ThemeDefault.js +2 -1
  106. package/cjs/Types/RangeType.js +6 -0
  107. package/cjs/Utils/CanvasUtils.js +24 -19
  108. package/cjs/Utils/ColorUtils.js +37 -30
  109. package/cjs/Utils/EventDispatcher.js +1 -1
  110. package/cjs/Utils/HslColorManager.js +11 -4
  111. package/cjs/Utils/NumberUtils.js +54 -38
  112. package/cjs/Utils/OptionsUtils.js +2 -3
  113. package/cjs/Utils/RgbColorManager.js +11 -4
  114. package/cjs/Utils/TypeUtils.js +6 -7
  115. package/cjs/Utils/Utils.js +66 -61
  116. package/cjs/init.js +1 -2
  117. package/esm/Core/Canvas.js +27 -22
  118. package/esm/Core/Container.js +57 -44
  119. package/esm/Core/Engine.js +82 -74
  120. package/esm/Core/Particle.js +29 -15
  121. package/esm/Core/Particles.js +23 -24
  122. package/esm/Core/Utils/EventListeners.js +18 -17
  123. package/esm/Core/Utils/ExternalInteractorBase.js +2 -1
  124. package/esm/Core/Utils/InteractionManager.js +3 -2
  125. package/esm/Core/Utils/ParticlesInteractorBase.js +2 -1
  126. package/esm/Core/Utils/QuadTree.js +1 -1
  127. package/esm/Core/Utils/Ranges.js +5 -4
  128. package/esm/Enums/AnimationStatus.js +5 -1
  129. package/esm/Enums/Directions/MoveDirection.js +14 -1
  130. package/esm/Enums/Directions/OutModeDirection.js +7 -1
  131. package/esm/Enums/Directions/RotateDirection.js +6 -1
  132. package/esm/Enums/InteractivityDetect.js +6 -1
  133. package/esm/Enums/Modes/AnimationMode.js +7 -1
  134. package/esm/Enums/Modes/CollisionMode.js +6 -1
  135. package/esm/Enums/Modes/LimitMode.js +5 -1
  136. package/esm/Enums/Modes/OutMode.js +8 -1
  137. package/esm/Enums/Modes/PixelMode.js +5 -1
  138. package/esm/Enums/Modes/ResponsiveMode.js +5 -1
  139. package/esm/Enums/Modes/ThemeMode.js +6 -1
  140. package/esm/Enums/Types/AlterType.js +5 -1
  141. package/esm/Enums/Types/DestroyType.js +6 -1
  142. package/esm/Enums/Types/DivType.js +5 -1
  143. package/esm/Enums/Types/EasingType.js +30 -1
  144. package/esm/Enums/Types/EventType.js +15 -1
  145. package/esm/Enums/Types/GradientType.js +6 -1
  146. package/esm/Enums/Types/InteractorType.js +5 -1
  147. package/esm/Enums/Types/ParticleOutType.js +6 -1
  148. package/esm/Enums/Types/StartValueType.js +6 -1
  149. package/esm/Options/Classes/AnimationOptions.js +4 -2
  150. package/esm/Options/Classes/Interactivity/Events/DivEvent.js +2 -1
  151. package/esm/Options/Classes/Interactivity/Events/Events.js +1 -1
  152. package/esm/Options/Classes/Interactivity/Interactivity.js +2 -1
  153. package/esm/Options/Classes/ManualParticle.js +2 -1
  154. package/esm/Options/Classes/Options.js +14 -12
  155. package/esm/Options/Classes/Particles/Collisions/Collisions.js +2 -1
  156. package/esm/Options/Classes/Particles/Move/Move.js +2 -1
  157. package/esm/Options/Classes/Particles/Move/MoveCenter.js +2 -1
  158. package/esm/Options/Classes/Particles/Move/OutModes.js +2 -1
  159. package/esm/Options/Classes/Particles/Number/ParticlesNumberLimit.js +2 -1
  160. package/esm/Options/Classes/Particles/Opacity/OpacityAnimation.js +2 -1
  161. package/esm/Options/Classes/Particles/ParticlesOptions.js +1 -1
  162. package/esm/Options/Classes/Particles/Size/SizeAnimation.js +2 -1
  163. package/esm/Options/Classes/Responsive.js +5 -4
  164. package/esm/Options/Classes/Theme/ThemeDefault.js +2 -1
  165. package/esm/Types/RangeType.js +5 -1
  166. package/esm/Utils/CanvasUtils.js +13 -7
  167. package/esm/Utils/ColorUtils.js +17 -9
  168. package/esm/Utils/EventDispatcher.js +1 -1
  169. package/esm/Utils/HslColorManager.js +11 -4
  170. package/esm/Utils/NumberUtils.js +28 -14
  171. package/esm/Utils/RgbColorManager.js +11 -4
  172. package/esm/Utils/Utils.js +37 -31
  173. package/package.json +1 -1
  174. package/report.html +1 -1
  175. package/tsparticles.engine.js +327 -225
  176. package/tsparticles.engine.min.js +1 -1
  177. package/tsparticles.engine.min.js.LICENSE.txt +1 -1
  178. package/types/Core/Container.d.ts +4 -2
  179. package/types/Core/Engine.d.ts +6 -5
  180. package/types/Core/Interfaces/IPlugin.d.ts +3 -4
  181. package/types/Core/Interfaces/IShapeDrawer.d.ts +1 -0
  182. package/types/Core/Particle.d.ts +1 -0
  183. package/types/Enums/AnimationStatus.d.ts +1 -1
  184. package/types/Enums/Directions/MoveDirection.d.ts +1 -1
  185. package/types/Enums/Directions/OutModeDirection.d.ts +1 -1
  186. package/types/Enums/Directions/RotateDirection.d.ts +1 -1
  187. package/types/Enums/InteractivityDetect.d.ts +1 -1
  188. package/types/Enums/Modes/AnimationMode.d.ts +1 -1
  189. package/types/Enums/Modes/CollisionMode.d.ts +1 -1
  190. package/types/Enums/Modes/LimitMode.d.ts +1 -1
  191. package/types/Enums/Modes/OutMode.d.ts +1 -1
  192. package/types/Enums/Modes/PixelMode.d.ts +1 -1
  193. package/types/Enums/Modes/ResponsiveMode.d.ts +1 -1
  194. package/types/Enums/Modes/ThemeMode.d.ts +1 -1
  195. package/types/Enums/Types/AlterType.d.ts +1 -1
  196. package/types/Enums/Types/DestroyType.d.ts +1 -1
  197. package/types/Enums/Types/DivType.d.ts +1 -1
  198. package/types/Enums/Types/EasingType.d.ts +1 -1
  199. package/types/Enums/Types/EventType.d.ts +1 -1
  200. package/types/Enums/Types/GradientType.d.ts +1 -1
  201. package/types/Enums/Types/InteractorType.d.ts +1 -1
  202. package/types/Enums/Types/ParticleOutType.d.ts +1 -1
  203. package/types/Enums/Types/StartValueType.d.ts +1 -1
  204. package/types/Options/Classes/Options.d.ts +2 -1
  205. package/types/Options/Classes/Responsive.d.ts +2 -2
  206. package/types/Options/Classes/Theme/Theme.d.ts +2 -2
  207. package/types/Options/Interfaces/IResponsive.d.ts +2 -3
  208. package/types/Options/Interfaces/Theme/ITheme.d.ts +2 -3
  209. package/types/Types/RangeType.d.ts +1 -1
  210. package/types/Utils/NumberUtils.d.ts +3 -0
  211. package/umd/Core/Canvas.js +27 -22
  212. package/umd/Core/Container.js +58 -45
  213. package/umd/Core/Engine.js +83 -99
  214. package/umd/Core/Particle.js +30 -16
  215. package/umd/Core/Particles.js +24 -25
  216. package/umd/Core/Utils/EventListeners.js +19 -18
  217. package/umd/Core/Utils/ExternalInteractorBase.js +3 -2
  218. package/umd/Core/Utils/InteractionManager.js +4 -3
  219. package/umd/Core/Utils/ParticlesInteractorBase.js +3 -2
  220. package/umd/Core/Utils/QuadTree.js +1 -1
  221. package/umd/Core/Utils/Ranges.js +6 -5
  222. package/umd/Enums/AnimationStatus.js +6 -0
  223. package/umd/Enums/Directions/MoveDirection.js +15 -0
  224. package/umd/Enums/Directions/OutModeDirection.js +8 -0
  225. package/umd/Enums/Directions/RotateDirection.js +7 -0
  226. package/umd/Enums/InteractivityDetect.js +7 -0
  227. package/umd/Enums/Modes/AnimationMode.js +8 -0
  228. package/umd/Enums/Modes/CollisionMode.js +7 -0
  229. package/umd/Enums/Modes/LimitMode.js +6 -0
  230. package/umd/Enums/Modes/OutMode.js +9 -0
  231. package/umd/Enums/Modes/PixelMode.js +6 -0
  232. package/umd/Enums/Modes/ResponsiveMode.js +6 -0
  233. package/umd/Enums/Modes/ThemeMode.js +7 -0
  234. package/umd/Enums/Types/AlterType.js +6 -0
  235. package/umd/Enums/Types/DestroyType.js +7 -0
  236. package/umd/Enums/Types/DivType.js +6 -0
  237. package/umd/Enums/Types/EasingType.js +31 -0
  238. package/umd/Enums/Types/EventType.js +16 -0
  239. package/umd/Enums/Types/GradientType.js +7 -0
  240. package/umd/Enums/Types/InteractorType.js +6 -0
  241. package/umd/Enums/Types/ParticleOutType.js +7 -0
  242. package/umd/Enums/Types/StartValueType.js +7 -0
  243. package/umd/Options/Classes/AnimationOptions.js +5 -3
  244. package/umd/Options/Classes/Interactivity/Events/DivEvent.js +3 -2
  245. package/umd/Options/Classes/Interactivity/Events/Events.js +1 -1
  246. package/umd/Options/Classes/Interactivity/Interactivity.js +3 -2
  247. package/umd/Options/Classes/ManualParticle.js +3 -2
  248. package/umd/Options/Classes/Options.js +15 -13
  249. package/umd/Options/Classes/Particles/Collisions/Collisions.js +3 -2
  250. package/umd/Options/Classes/Particles/Move/Move.js +3 -2
  251. package/umd/Options/Classes/Particles/Move/MoveCenter.js +3 -2
  252. package/umd/Options/Classes/Particles/Move/OutModes.js +3 -2
  253. package/umd/Options/Classes/Particles/Number/ParticlesNumberLimit.js +3 -2
  254. package/umd/Options/Classes/Particles/Opacity/OpacityAnimation.js +3 -2
  255. package/umd/Options/Classes/Particles/ParticlesOptions.js +1 -1
  256. package/umd/Options/Classes/Particles/Size/SizeAnimation.js +3 -2
  257. package/umd/Options/Classes/Responsive.js +6 -5
  258. package/umd/Options/Classes/Theme/ThemeDefault.js +3 -2
  259. package/umd/Types/RangeType.js +6 -0
  260. package/umd/Utils/CanvasUtils.js +25 -20
  261. package/umd/Utils/ColorUtils.js +38 -31
  262. package/umd/Utils/EventDispatcher.js +1 -1
  263. package/umd/Utils/HslColorManager.js +11 -4
  264. package/umd/Utils/NumberUtils.js +55 -39
  265. package/umd/Utils/OptionsUtils.js +2 -3
  266. package/umd/Utils/RgbColorManager.js +11 -4
  267. package/umd/Utils/TypeUtils.js +6 -7
  268. package/umd/Utils/Utils.js +67 -62
  269. package/umd/init.js +1 -2
  270. package/174.min.js +0 -2
  271. package/174.min.js.LICENSE.txt +0 -1
  272. package/dist_browser_Core_Container_js.js +0 -102
@@ -4,15 +4,49 @@
4
4
  if (v !== undefined) module.exports = v;
5
5
  }
6
6
  else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "./NumberUtils.js", "../Core/Utils/Constants.js", "./TypeUtils.js", "../Core/Utils/Vectors.js"], factory);
7
+ define(["require", "exports", "./NumberUtils.js", "../Core/Utils/Constants.js", "./TypeUtils.js", "../Enums/Modes/AnimationMode.js", "../Enums/AnimationStatus.js", "../Enums/Types/DestroyType.js", "../Enums/Directions/OutModeDirection.js", "../Enums/Modes/PixelMode.js", "../Enums/Types/StartValueType.js", "../Core/Utils/Vectors.js"], factory);
8
8
  }
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.updateAnimation = exports.getSize = exports.getPosition = exports.initParticleNumericAnimationValue = exports.findItemFromSingleOrMultiple = exports.itemFromSingleOrMultiple = exports.executeOnSingleOrMultiple = exports.rectBounce = exports.circleBounce = exports.circleBounceDataFromParticle = exports.divMode = exports.singleDivModeExecute = exports.divModeExecute = exports.isDivModeEnabled = exports.deepExtend = exports.calculateBounds = exports.areBoundsInside = exports.isPointInside = exports.itemFromArray = exports.arrayRandomIndex = exports.loadFont = exports.isInArray = exports.safeMutationObserver = exports.safeIntersectionObserver = exports.safeMatchMedia = exports.hasMatchMedia = exports.isSsr = exports.getLogger = exports.setLogger = void 0;
12
+ exports.setLogger = setLogger;
13
+ exports.getLogger = getLogger;
14
+ exports.isSsr = isSsr;
15
+ exports.hasMatchMedia = hasMatchMedia;
16
+ exports.safeMatchMedia = safeMatchMedia;
17
+ exports.safeIntersectionObserver = safeIntersectionObserver;
18
+ exports.safeMutationObserver = safeMutationObserver;
19
+ exports.isInArray = isInArray;
20
+ exports.loadFont = loadFont;
21
+ exports.arrayRandomIndex = arrayRandomIndex;
22
+ exports.itemFromArray = itemFromArray;
23
+ exports.isPointInside = isPointInside;
24
+ exports.areBoundsInside = areBoundsInside;
25
+ exports.calculateBounds = calculateBounds;
26
+ exports.deepExtend = deepExtend;
27
+ exports.isDivModeEnabled = isDivModeEnabled;
28
+ exports.divModeExecute = divModeExecute;
29
+ exports.singleDivModeExecute = singleDivModeExecute;
30
+ exports.divMode = divMode;
31
+ exports.circleBounceDataFromParticle = circleBounceDataFromParticle;
32
+ exports.circleBounce = circleBounce;
33
+ exports.rectBounce = rectBounce;
34
+ exports.executeOnSingleOrMultiple = executeOnSingleOrMultiple;
35
+ exports.itemFromSingleOrMultiple = itemFromSingleOrMultiple;
36
+ exports.findItemFromSingleOrMultiple = findItemFromSingleOrMultiple;
37
+ exports.initParticleNumericAnimationValue = initParticleNumericAnimationValue;
38
+ exports.getPosition = getPosition;
39
+ exports.getSize = getSize;
40
+ exports.updateAnimation = updateAnimation;
13
41
  const NumberUtils_js_1 = require("./NumberUtils.js");
14
42
  const Constants_js_1 = require("../Core/Utils/Constants.js");
15
43
  const TypeUtils_js_1 = require("./TypeUtils.js");
44
+ const AnimationMode_js_1 = require("../Enums/Modes/AnimationMode.js");
45
+ const AnimationStatus_js_1 = require("../Enums/AnimationStatus.js");
46
+ const DestroyType_js_1 = require("../Enums/Types/DestroyType.js");
47
+ const OutModeDirection_js_1 = require("../Enums/Directions/OutModeDirection.js");
48
+ const PixelMode_js_1 = require("../Enums/Modes/PixelMode.js");
49
+ const StartValueType_js_1 = require("../Enums/Types/StartValueType.js");
16
50
  const Vectors_js_1 = require("../Core/Utils/Vectors.js");
17
51
  const _logger = {
18
52
  debug: console.debug,
@@ -30,11 +64,9 @@
30
64
  _logger.verbose = logger.verbose || _logger.verbose;
31
65
  _logger.warning = logger.warning || _logger.warning;
32
66
  }
33
- exports.setLogger = setLogger;
34
67
  function getLogger() {
35
68
  return _logger;
36
69
  }
37
- exports.getLogger = getLogger;
38
70
  function rectSideBounce(data) {
39
71
  const res = { bounced: false }, { pSide, pOtherSide, rectSide, rectOtherSide, velocity, factor } = data, half = 0.5, minVelocity = 0;
40
72
  if (pOtherSide.min < rectOtherSide.min ||
@@ -51,45 +83,39 @@
51
83
  return res;
52
84
  }
53
85
  function checkSelector(element, selectors) {
54
- const res = executeOnSingleOrMultiple(selectors, (selector) => {
86
+ const res = executeOnSingleOrMultiple(selectors, selector => {
55
87
  return element.matches(selector);
56
88
  });
57
- return (0, TypeUtils_js_1.isArray)(res) ? res.some((t) => t) : res;
89
+ return (0, TypeUtils_js_1.isArray)(res) ? res.some(t => t) : res;
58
90
  }
59
91
  function isSsr() {
60
92
  return typeof window === "undefined" || !window || typeof window.document === "undefined" || !window.document;
61
93
  }
62
- exports.isSsr = isSsr;
63
94
  function hasMatchMedia() {
64
95
  return !isSsr() && typeof matchMedia !== "undefined";
65
96
  }
66
- exports.hasMatchMedia = hasMatchMedia;
67
97
  function safeMatchMedia(query) {
68
98
  if (!hasMatchMedia()) {
69
99
  return;
70
100
  }
71
101
  return matchMedia(query);
72
102
  }
73
- exports.safeMatchMedia = safeMatchMedia;
74
103
  function safeIntersectionObserver(callback) {
75
104
  if (isSsr() || typeof IntersectionObserver === "undefined") {
76
105
  return;
77
106
  }
78
107
  return new IntersectionObserver(callback);
79
108
  }
80
- exports.safeIntersectionObserver = safeIntersectionObserver;
81
109
  function safeMutationObserver(callback) {
82
110
  if (isSsr() || typeof MutationObserver === "undefined") {
83
111
  return;
84
112
  }
85
113
  return new MutationObserver(callback);
86
114
  }
87
- exports.safeMutationObserver = safeMutationObserver;
88
115
  function isInArray(value, array) {
89
116
  const invalidIndex = -1;
90
117
  return value === array || ((0, TypeUtils_js_1.isArray)(array) && array.indexOf(value) > invalidIndex);
91
118
  }
92
- exports.isInArray = isInArray;
93
119
  async function loadFont(font, weight) {
94
120
  try {
95
121
  await document.fonts.load(`${weight ?? "400"} 36px '${font ?? "Verdana"}'`);
@@ -97,37 +123,32 @@
97
123
  catch {
98
124
  }
99
125
  }
100
- exports.loadFont = loadFont;
101
126
  function arrayRandomIndex(array) {
102
127
  return Math.floor((0, NumberUtils_js_1.getRandom)() * array.length);
103
128
  }
104
- exports.arrayRandomIndex = arrayRandomIndex;
105
129
  function itemFromArray(array, index, useIndex = true) {
106
130
  return array[index !== undefined && useIndex ? index % array.length : arrayRandomIndex(array)];
107
131
  }
108
- exports.itemFromArray = itemFromArray;
109
132
  function isPointInside(point, size, offset, radius, direction) {
110
133
  const minRadius = 0;
111
134
  return areBoundsInside(calculateBounds(point, radius ?? minRadius), size, offset, direction);
112
135
  }
113
- exports.isPointInside = isPointInside;
114
136
  function areBoundsInside(bounds, size, offset, direction) {
115
137
  let inside = true;
116
- if (!direction || direction === "bottom") {
138
+ if (!direction || direction === OutModeDirection_js_1.OutModeDirection.bottom) {
117
139
  inside = bounds.top < size.height + offset.x;
118
140
  }
119
- if (inside && (!direction || direction === "left")) {
141
+ if (inside && (!direction || direction === OutModeDirection_js_1.OutModeDirection.left)) {
120
142
  inside = bounds.right > offset.x;
121
143
  }
122
- if (inside && (!direction || direction === "right")) {
144
+ if (inside && (!direction || direction === OutModeDirection_js_1.OutModeDirection.right)) {
123
145
  inside = bounds.left < size.width + offset.y;
124
146
  }
125
- if (inside && (!direction || direction === "top")) {
147
+ if (inside && (!direction || direction === OutModeDirection_js_1.OutModeDirection.top)) {
126
148
  inside = bounds.bottom > offset.y;
127
149
  }
128
150
  return inside;
129
151
  }
130
- exports.areBoundsInside = areBoundsInside;
131
152
  function calculateBounds(point, radius) {
132
153
  return {
133
154
  bottom: point.y + radius,
@@ -136,7 +157,6 @@
136
157
  top: point.y - radius,
137
158
  };
138
159
  }
139
- exports.calculateBounds = calculateBounds;
140
160
  function deepExtend(destination, ...sources) {
141
161
  for (const source of sources) {
142
162
  if (source === undefined || source === null) {
@@ -160,42 +180,37 @@
160
180
  const sourceDict = source, value = sourceDict[key], destDict = destination;
161
181
  destDict[key] =
162
182
  (0, TypeUtils_js_1.isObject)(value) && Array.isArray(value)
163
- ? value.map((v) => deepExtend(destDict[key], v))
183
+ ? value.map(v => deepExtend(destDict[key], v))
164
184
  : deepExtend(destDict[key], value);
165
185
  }
166
186
  }
167
187
  return destination;
168
188
  }
169
- exports.deepExtend = deepExtend;
170
189
  function isDivModeEnabled(mode, divs) {
171
- return !!findItemFromSingleOrMultiple(divs, (t) => t.enable && isInArray(mode, t.mode));
190
+ return !!findItemFromSingleOrMultiple(divs, t => t.enable && isInArray(mode, t.mode));
172
191
  }
173
- exports.isDivModeEnabled = isDivModeEnabled;
174
192
  function divModeExecute(mode, divs, callback) {
175
- executeOnSingleOrMultiple(divs, (div) => {
193
+ executeOnSingleOrMultiple(divs, div => {
176
194
  const divMode = div.mode, divEnabled = div.enable;
177
195
  if (divEnabled && isInArray(mode, divMode)) {
178
196
  singleDivModeExecute(div, callback);
179
197
  }
180
198
  });
181
199
  }
182
- exports.divModeExecute = divModeExecute;
183
200
  function singleDivModeExecute(div, callback) {
184
201
  const selectors = div.selectors;
185
- executeOnSingleOrMultiple(selectors, (selector) => {
202
+ executeOnSingleOrMultiple(selectors, selector => {
186
203
  callback(selector, div);
187
204
  });
188
205
  }
189
- exports.singleDivModeExecute = singleDivModeExecute;
190
206
  function divMode(divs, element) {
191
207
  if (!element || !divs) {
192
208
  return;
193
209
  }
194
- return findItemFromSingleOrMultiple(divs, (div) => {
210
+ return findItemFromSingleOrMultiple(divs, div => {
195
211
  return checkSelector(element, div.selectors);
196
212
  });
197
213
  }
198
- exports.divMode = divMode;
199
214
  function circleBounceDataFromParticle(p) {
200
215
  return {
201
216
  position: p.getPosition(),
@@ -205,7 +220,6 @@
205
220
  factor: Vectors_js_1.Vector.create((0, NumberUtils_js_1.getRangeValue)(p.options.bounce.horizontal.value), (0, NumberUtils_js_1.getRangeValue)(p.options.bounce.vertical.value)),
206
221
  };
207
222
  }
208
- exports.circleBounceDataFromParticle = circleBounceDataFromParticle;
209
223
  function circleBounce(p1, p2) {
210
224
  const { x: xVelocityDiff, y: yVelocityDiff } = p1.velocity.sub(p2.velocity), [pos1, pos2] = [p1.position, p2.position], { dx: xDist, dy: yDist } = (0, NumberUtils_js_1.getDistances)(pos2, pos1), minimumDistance = 0;
211
225
  if (xVelocityDiff * xDist + yVelocityDiff * yDist < minimumDistance) {
@@ -217,7 +231,6 @@
217
231
  p2.velocity.x = vFinal2.x * p2.factor.x;
218
232
  p2.velocity.y = vFinal2.y * p2.factor.y;
219
233
  }
220
- exports.circleBounce = circleBounce;
221
234
  function rectBounce(particle, divBounds) {
222
235
  const pPos = particle.getPosition(), size = particle.getRadius(), bounds = calculateBounds(pPos, size), bounceOptions = particle.options.bounce, resH = rectSideBounce({
223
236
  pSide: {
@@ -276,16 +289,13 @@
276
289
  }
277
290
  }
278
291
  }
279
- exports.rectBounce = rectBounce;
280
292
  function executeOnSingleOrMultiple(obj, callback) {
281
293
  const defaultIndex = 0;
282
294
  return (0, TypeUtils_js_1.isArray)(obj) ? obj.map((item, index) => callback(item, index)) : callback(obj, defaultIndex);
283
295
  }
284
- exports.executeOnSingleOrMultiple = executeOnSingleOrMultiple;
285
296
  function itemFromSingleOrMultiple(obj, index, useIndex) {
286
297
  return (0, TypeUtils_js_1.isArray)(obj) ? itemFromArray(obj, index, useIndex) : obj;
287
298
  }
288
- exports.itemFromSingleOrMultiple = itemFromSingleOrMultiple;
289
299
  function findItemFromSingleOrMultiple(obj, callback) {
290
300
  if ((0, TypeUtils_js_1.isArray)(obj)) {
291
301
  return obj.find((t, index) => callback(t, index));
@@ -293,7 +303,6 @@
293
303
  const defaultIndex = 0;
294
304
  return callback(obj, defaultIndex) ? obj : undefined;
295
305
  }
296
- exports.findItemFromSingleOrMultiple = findItemFromSingleOrMultiple;
297
306
  function initParticleNumericAnimationValue(options, pxRatio) {
298
307
  const valueRange = options.value, animationOptions = options.animation, res = {
299
308
  delayTime: (0, NumberUtils_js_1.getRangeValue)(animationOptions.delay) * Constants_js_1.millisecondsToSeconds,
@@ -308,35 +317,35 @@
308
317
  if (animationOptions.enable) {
309
318
  res.decay = decayOffset - (0, NumberUtils_js_1.getRangeValue)(animationOptions.decay);
310
319
  switch (animationOptions.mode) {
311
- case "increase":
312
- res.status = "increasing";
320
+ case AnimationMode_js_1.AnimationMode.increase:
321
+ res.status = AnimationStatus_js_1.AnimationStatus.increasing;
313
322
  break;
314
- case "decrease":
315
- res.status = "decreasing";
323
+ case AnimationMode_js_1.AnimationMode.decrease:
324
+ res.status = AnimationStatus_js_1.AnimationStatus.decreasing;
316
325
  break;
317
- case "random":
318
- res.status = (0, NumberUtils_js_1.getRandom)() >= Constants_js_1.halfRandom ? "increasing" : "decreasing";
326
+ case AnimationMode_js_1.AnimationMode.random:
327
+ res.status = (0, NumberUtils_js_1.getRandom)() >= Constants_js_1.halfRandom ? AnimationStatus_js_1.AnimationStatus.increasing : AnimationStatus_js_1.AnimationStatus.decreasing;
319
328
  break;
320
329
  }
321
- const autoStatus = animationOptions.mode === "auto";
330
+ const autoStatus = animationOptions.mode === AnimationMode_js_1.AnimationMode.auto;
322
331
  switch (animationOptions.startValue) {
323
- case "min":
332
+ case StartValueType_js_1.StartValueType.min:
324
333
  res.value = res.min;
325
334
  if (autoStatus) {
326
- res.status = "increasing";
335
+ res.status = AnimationStatus_js_1.AnimationStatus.increasing;
327
336
  }
328
337
  break;
329
- case "max":
338
+ case StartValueType_js_1.StartValueType.max:
330
339
  res.value = res.max;
331
340
  if (autoStatus) {
332
- res.status = "decreasing";
341
+ res.status = AnimationStatus_js_1.AnimationStatus.decreasing;
333
342
  }
334
343
  break;
335
- case "random":
344
+ case StartValueType_js_1.StartValueType.random:
336
345
  default:
337
346
  res.value = (0, NumberUtils_js_1.randomInRange)(res);
338
347
  if (autoStatus) {
339
- res.status = (0, NumberUtils_js_1.getRandom)() >= Constants_js_1.halfRandom ? "increasing" : "decreasing";
348
+ res.status = (0, NumberUtils_js_1.getRandom)() >= Constants_js_1.halfRandom ? AnimationStatus_js_1.AnimationStatus.increasing : AnimationStatus_js_1.AnimationStatus.decreasing;
340
349
  }
341
350
  break;
342
351
  }
@@ -344,9 +353,8 @@
344
353
  res.initialValue = res.value;
345
354
  return res;
346
355
  }
347
- exports.initParticleNumericAnimationValue = initParticleNumericAnimationValue;
348
356
  function getPositionOrSize(positionOrSize, canvasSize) {
349
- const isPercent = positionOrSize.mode === "percent";
357
+ const isPercent = positionOrSize.mode === PixelMode_js_1.PixelMode.percent;
350
358
  if (!isPercent) {
351
359
  const { mode: _, ...rest } = positionOrSize;
352
360
  return rest;
@@ -368,19 +376,17 @@
368
376
  function getPosition(position, canvasSize) {
369
377
  return getPositionOrSize(position, canvasSize);
370
378
  }
371
- exports.getPosition = getPosition;
372
379
  function getSize(size, canvasSize) {
373
380
  return getPositionOrSize(size, canvasSize);
374
381
  }
375
- exports.getSize = getSize;
376
382
  function checkDestroy(particle, destroyType, value, minValue, maxValue) {
377
383
  switch (destroyType) {
378
- case "max":
384
+ case DestroyType_js_1.DestroyType.max:
379
385
  if (value >= maxValue) {
380
386
  particle.destroy();
381
387
  }
382
388
  break;
383
- case "min":
389
+ case DestroyType_js_1.DestroyType.min:
384
390
  if (value <= minValue) {
385
391
  particle.destroy();
386
392
  }
@@ -406,10 +412,10 @@
406
412
  return;
407
413
  }
408
414
  switch (data.status) {
409
- case "increasing":
415
+ case AnimationStatus_js_1.AnimationStatus.increasing:
410
416
  if (data.value >= maxValue) {
411
417
  if (changeDirection) {
412
- data.status = "decreasing";
418
+ data.status = AnimationStatus_js_1.AnimationStatus.decreasing;
413
419
  }
414
420
  else {
415
421
  data.value -= maxValue;
@@ -423,10 +429,10 @@
423
429
  data.value += velocity;
424
430
  }
425
431
  break;
426
- case "decreasing":
432
+ case AnimationStatus_js_1.AnimationStatus.decreasing:
427
433
  if (data.value <= minValue) {
428
434
  if (changeDirection) {
429
- data.status = "increasing";
435
+ data.status = AnimationStatus_js_1.AnimationStatus.increasing;
430
436
  }
431
437
  else {
432
438
  data.value += maxValue;
@@ -448,5 +454,4 @@
448
454
  data.value = (0, NumberUtils_js_1.clamp)(data.value, minValue, maxValue);
449
455
  }
450
456
  }
451
- exports.updateAnimation = updateAnimation;
452
457
  });
package/umd/init.js CHANGED
@@ -9,7 +9,7 @@
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.init = void 0;
12
+ exports.init = init;
13
13
  const Engine_js_1 = require("./Core/Engine.js");
14
14
  const HslColorManager_js_1 = require("./Utils/HslColorManager.js");
15
15
  const RgbColorManager_js_1 = require("./Utils/RgbColorManager.js");
@@ -22,5 +22,4 @@
22
22
  engine.init();
23
23
  return engine;
24
24
  }
25
- exports.init = init;
26
25
  });
package/174.min.js DELETED
@@ -1,2 +0,0 @@
1
- /*! For license information please see 174.min.js.LICENSE.txt */
2
- (this.webpackChunk_tsparticles_engine=this.webpackChunk_tsparticles_engine||[]).push([[174],{1174:(t,i,e)=>{e.d(i,{Container:()=>D});var s=e(6299),n=e(4013),o=e(1745),a=e(746);function r(t,i,e){const s=i[e];void 0!==s&&(t[e]=(t[e]??1)*s)}function h(t,i,e=!1){if(!i)return;if(!t)return;const s=t.style;if(s)for(const t in i){const n=i[t];n&&s.setProperty(t,n,e?"important":"")}}class c{constructor(t){this.container=t,this._applyPostDrawUpdaters=t=>{for(const i of this._postDrawUpdaters)i.afterDraw?.(t)},this._applyPreDrawUpdaters=(t,i,e,s,n,o)=>{for(const a of this._preDrawUpdaters){if(a.getColorStyles){const{fill:o,stroke:r}=a.getColorStyles(i,t,e,s);o&&(n.fill=o),r&&(n.stroke=r)}if(a.getTransformValues){const t=a.getTransformValues(i);for(const i in t)r(o,t,i)}a.beforeDraw?.(i)}},this._applyResizePlugins=()=>{for(const t of this._resizePlugins)t.resize?.()},this._getPluginParticleColors=t=>{let i,e;for(const s of this._colorPlugins)if(!i&&s.particleFillColor&&(i=(0,a.R5)(s.particleFillColor(t))),!e&&s.particleStrokeColor&&(e=(0,a.R5)(s.particleStrokeColor(t))),i&&e)break;return[i,e]},this._initCover=async()=>{const t=this.container.actualOptions.backgroundMask.cover,i=t.color;if(i){const e=(0,a.BN)(i);if(e){const i={...e,a:t.opacity};this._coverColorStyle=(0,a.xx)(i,i.a)}}else await new Promise(((i,e)=>{if(!t.image)return;const s=document.createElement("img");s.addEventListener("load",(()=>{this._coverImage={image:s,opacity:t.opacity},i()})),s.addEventListener("error",(t=>{e(t.error)})),s.src=t.image}))},this._initStyle=()=>{const t=this.element,i=this.container.actualOptions;if(t){this._fullScreen?(this._originalStyle=(0,n.zw)({},t.style),this._setFullScreenStyle()):this._resetOriginalStyle();for(const e in i.style){if(!e||!i.style)continue;const s=i.style[e];s&&t.style.setProperty(e,s,"important")}}},this._initTrail=async()=>{const t=this.container.actualOptions.particles.move.trail,i=t.fill;if(!t.enable)return;const e=1/t.length;if(i.color){const t=(0,a.BN)(i.color);if(!t)return;this._trailFill={color:{...t},opacity:e}}else await new Promise(((t,s)=>{if(!i.image)return;const n=document.createElement("img");n.addEventListener("load",(()=>{this._trailFill={image:n,opacity:e},t()})),n.addEventListener("error",(t=>{s(t.error)})),n.src=i.image}))},this._paintBase=t=>{this.draw((i=>(0,o.Sn)(i,this.size,t)))},this._paintImage=(t,i)=>{this.draw((e=>(0,o.Md)(e,this.size,t,i)))},this._repairStyle=()=>{const t=this.element;t&&(this._safeMutationObserver((t=>t.disconnect())),this._initStyle(),this.initBackground(),this._safeMutationObserver((i=>i.observe(t,{attributes:!0}))))},this._resetOriginalStyle=()=>{const t=this.element,i=this._originalStyle;t&&i&&h(t,i)},this._safeMutationObserver=t=>{this._mutationObserver&&t(this._mutationObserver)},this._setFullScreenStyle=()=>{const t=this.element;if(!t)return;h(t,{position:"fixed",zIndex:this.container.actualOptions.fullScreen.zIndex.toString(10),top:"0",left:"0",width:"100%",height:"100%"},!0)},this.size={height:0,width:0},this._context=null,this._generated=!1,this._preDrawUpdaters=[],this._postDrawUpdaters=[],this._resizePlugins=[],this._colorPlugins=[]}get _fullScreen(){return this.container.actualOptions.fullScreen.enable}clear(){const t=this.container.actualOptions,i=t.particles.move.trail,e=this._trailFill;t.backgroundMask.enable?this.paint():i.enable&&i.length>0&&e?e.color?this._paintBase((0,a.xx)(e.color,e.opacity)):e.image&&this._paintImage(e.image,e.opacity):t.clear&&this.draw((t=>{(0,o.IU)(t,this.size)}))}destroy(){if(this.stop(),this._generated){const t=this.element;t?.remove()}else this._resetOriginalStyle();this._preDrawUpdaters=[],this._postDrawUpdaters=[],this._resizePlugins=[],this._colorPlugins=[]}draw(t){const i=this._context;if(i)return t(i)}drawAsync(t){const i=this._context;if(i)return t(i)}drawParticle(t,i){if(t.spawning||t.destroyed)return;const e=t.getRadius();if(e<=0)return;const s=t.getFillColor(),n=t.getStrokeColor()??s;let[r,h]=this._getPluginParticleColors(t);r||(r=s),h||(h=n),(r||h)&&this.draw((s=>{const n=this.container,c=n.actualOptions,l=t.options.zIndex,d=1-t.zIndexFactor,u=d**l.opacityRate,p=t.bubble.opacity??t.opacity?.value??1,f=p*u,_=(t.strokeOpacity??p)*u,g={},m={fill:r?(0,a.LC)(r,f):void 0};m.stroke=h?(0,a.LC)(h,_):m.fill,this._applyPreDrawUpdaters(s,t,e,f,m,g),(0,o.p0)({container:n,context:s,particle:t,delta:i,colorStyles:m,backgroundMask:c.backgroundMask.enable,composite:c.backgroundMask.composite,radius:e*d**l.sizeRate,opacity:f,shadow:t.options.shadow,transform:g}),this._applyPostDrawUpdaters(t)}))}drawParticlePlugin(t,i,e){this.draw((s=>(0,o.Wb)(s,t,i,e)))}drawPlugin(t,i){this.draw((e=>(0,o.e_)(e,t,i)))}async init(){this._safeMutationObserver((t=>t.disconnect())),this._mutationObserver=(0,n.tG)((t=>{for(const i of t)"attributes"===i.type&&"style"===i.attributeName&&this._repairStyle()})),this.resize(),this._initStyle(),await this._initCover();try{await this._initTrail()}catch(t){(0,n.tZ)().error(t)}this.initBackground(),this._safeMutationObserver((t=>{this.element&&t.observe(this.element,{attributes:!0})})),this.initUpdaters(),this.initPlugins(),this.paint()}initBackground(){const t=this.container.actualOptions.background,i=this.element;if(!i)return;const e=i.style;if(e){if(t.color){const i=(0,a.BN)(t.color);e.backgroundColor=i?(0,a.xx)(i,t.opacity):""}else e.backgroundColor="";e.backgroundImage=t.image||"",e.backgroundPosition=t.position||"",e.backgroundRepeat=t.repeat||"",e.backgroundSize=t.size||""}}initPlugins(){this._resizePlugins=[];for(const[,t]of this.container.plugins)t.resize&&this._resizePlugins.push(t),(t.particleFillColor??t.particleStrokeColor)&&this._colorPlugins.push(t)}initUpdaters(){this._preDrawUpdaters=[],this._postDrawUpdaters=[];for(const t of this.container.particles.updaters)t.afterDraw&&this._postDrawUpdaters.push(t),(t.getColorStyles??t.getTransformValues??t.beforeDraw)&&this._preDrawUpdaters.push(t)}loadCanvas(t){this._generated&&this.element&&this.element.remove(),this._generated=t.dataset&&s.eb in t.dataset?"true"===t.dataset[s.eb]:this._generated,this.element=t,this.element.ariaHidden="true",this._originalStyle=(0,n.zw)({},this.element.style),this.size.height=t.offsetHeight,this.size.width=t.offsetWidth,this._context=this.element.getContext("2d"),this._safeMutationObserver((t=>{this.element&&t.observe(this.element,{attributes:!0})})),this.container.retina.init(),this.initBackground()}paint(){const t=this.container.actualOptions;this.draw((i=>{t.backgroundMask.enable&&t.backgroundMask.cover?((0,o.IU)(i,this.size),this._coverImage?this._paintImage(this._coverImage.image,this._coverImage.opacity):this._coverColorStyle?this._paintBase(this._coverColorStyle):this._paintBase()):this._paintBase()}))}resize(){if(!this.element)return!1;const t=this.container,i=t.retina.pixelRatio,e=t.canvas.size,s=this.element.offsetWidth*i,n=this.element.offsetHeight*i;if(n===e.height&&s===e.width&&n===this.element.height&&s===this.element.width)return!1;const o={...e};return this.element.width=e.width=this.element.offsetWidth*i,this.element.height=e.height=this.element.offsetHeight*i,this.container.started&&t.particles.setResizeFactor({width:e.width/o.width,height:e.height/o.height}),!0}stop(){this._safeMutationObserver((t=>t.disconnect())),this._mutationObserver=void 0,this.draw((t=>(0,o.IU)(t,this.size)))}async windowResize(){if(!this.element||!this.resize())return;const t=this.container,i=t.updateActualOptions();t.particles.setDensity(),this._applyResizePlugins(),i&&await t.refresh()}}var l=e(645);function d(t,i,e,s,n){if(s){let s={passive:!0};(0,l.Lm)(n)?s.capture=n:void 0!==n&&(s=n),t.addEventListener(i,e,s)}else{const s=n;t.removeEventListener(i,e,s)}}class u{constructor(t){this.container=t,this._doMouseTouchClick=t=>{const i=this.container,e=i.actualOptions;if(this._canPush){const t=i.interactivity.mouse,s=t.position;if(!s)return;t.clickPosition={...s},t.clickTime=(new Date).getTime();const o=e.interactivity.events.onClick;(0,n.wJ)(o.mode,(t=>this.container.handleClickMode(t)))}if("touchend"===t.type){setTimeout((()=>this._mouseTouchFinish()),500)}},this._handleThemeChange=t=>{const i=t,e=this.container,s=e.options,n=s.defaultThemes,o=i.matches?n.dark:n.light,a=s.themes.find((t=>t.name===o));a&&a.default.auto&&e.loadTheme(o)},this._handleVisibilityChange=()=>{const t=this.container,i=t.actualOptions;this._mouseTouchFinish(),i.pauseOnBlur&&(document&&document.hidden?(t.pageHidden=!0,t.pause()):(t.pageHidden=!1,t.animationStatus?t.play(!0):t.draw(!0)))},this._handleWindowResize=()=>{this._resizeTimeout&&(clearTimeout(this._resizeTimeout),delete this._resizeTimeout);const t=async()=>{const t=this.container.canvas;await(t?.windowResize())};this._resizeTimeout=setTimeout((()=>{t()}),this.container.actualOptions.interactivity.events.resize.delay*s.Xu)},this._manageInteractivityListeners=(t,i)=>{const e=this._handlers,n=this.container,o=n.actualOptions,a=n.interactivity.element;if(!a)return;const r=a,h=n.canvas.element;h&&(h.style.pointerEvents=r===h?"initial":"none"),(o.interactivity.events.onHover.enable||o.interactivity.events.onClick.enable)&&(d(a,s.Rb,e.mouseMove,i),d(a,s.s7,e.touchStart,i),d(a,s.DG,e.touchMove,i),o.interactivity.events.onClick.enable?(d(a,s.Bp,e.touchEndClick,i),d(a,s.vo,e.mouseUp,i),d(a,s.ms,e.mouseDown,i)):d(a,s.Bp,e.touchEnd,i),d(a,t,e.mouseLeave,i),d(a,s.G3,e.touchCancel,i))},this._manageListeners=t=>{const i=this._handlers,e=this.container,n=e.actualOptions.interactivity.detectsOn,o=e.canvas.element;let a=s.Z0;"window"===n?(e.interactivity.element=window,a=s.sf):e.interactivity.element="parent"===n&&o?o.parentElement??o.parentNode:o,this._manageMediaMatch(t),this._manageResize(t),this._manageInteractivityListeners(a,t),document&&d(document,s.nK,i.visibilityChange,t,!1)},this._manageMediaMatch=t=>{const i=this._handlers,e=(0,n.lV)("(prefers-color-scheme: dark)");e&&(void 0===e.addEventListener?void 0!==e.addListener&&(t?e.addListener(i.oldThemeChange):e.removeListener(i.oldThemeChange)):d(e,"change",i.themeChange,t))},this._manageResize=t=>{const i=this._handlers,e=this.container;if(!e.actualOptions.interactivity.events.resize)return;if("undefined"==typeof ResizeObserver)return void d(window,s.NF,i.resize,t);const n=e.canvas.element;this._resizeObserver&&!t?(n&&this._resizeObserver.unobserve(n),this._resizeObserver.disconnect(),delete this._resizeObserver):!this._resizeObserver&&t&&n&&(this._resizeObserver=new ResizeObserver((t=>{t.find((t=>t.target===n))&&this._handleWindowResize()})),this._resizeObserver.observe(n))},this._mouseDown=()=>{const{interactivity:t}=this.container;if(!t)return;const{mouse:i}=t;i.clicking=!0,i.downPosition=i.position},this._mouseTouchClick=t=>{const i=this.container,e=i.actualOptions,{mouse:s}=i.interactivity;s.inside=!0;let n=!1;const o=s.position;if(o&&e.interactivity.events.onClick.enable){for(const[,t]of i.plugins)if(t.clickPositionValid&&(n=t.clickPositionValid(o),n))break;n||this._doMouseTouchClick(t),s.clicking=!1}},this._mouseTouchFinish=()=>{const t=this.container.interactivity;if(!t)return;const i=t.mouse;delete i.position,delete i.clickPosition,delete i.downPosition,t.status=s.Z0,i.inside=!1,i.clicking=!1},this._mouseTouchMove=t=>{const i=this.container,e=i.actualOptions,n=i.interactivity,o=i.canvas.element;if(!n?.element)return;let a;if(n.mouse.inside=!0,t.type.startsWith("pointer")){this._canPush=!0;const i=t;if(n.element===window){if(o){const t=o.getBoundingClientRect();a={x:i.clientX-t.left,y:i.clientY-t.top}}}else if("parent"===e.interactivity.detectsOn){const t=i.target,e=i.currentTarget;if(t&&e&&o){const s=t.getBoundingClientRect(),n=e.getBoundingClientRect(),r=o.getBoundingClientRect();a={x:i.offsetX+2*s.left-(n.left+r.left),y:i.offsetY+2*s.top-(n.top+r.top)}}else a={x:i.offsetX??i.clientX,y:i.offsetY??i.clientY}}else i.target===o&&(a={x:i.offsetX??i.clientX,y:i.offsetY??i.clientY})}else if(this._canPush="touchmove"!==t.type,o){const i=t,e=1,s=i.touches[i.touches.length-e],n=o.getBoundingClientRect(),r=0;a={x:s.clientX-(n.left??r),y:s.clientY-(n.top??r)}}const r=i.retina.pixelRatio;a&&(a.x*=r,a.y*=r),n.mouse.position=a,n.status=s.Rb},this._touchEnd=t=>{const i=t,e=Array.from(i.changedTouches);for(const t of e)this._touches.delete(t.identifier);this._mouseTouchFinish()},this._touchEndClick=t=>{const i=t,e=Array.from(i.changedTouches);for(const t of e)this._touches.delete(t.identifier);this._mouseTouchClick(t)},this._touchStart=t=>{const i=t,e=Array.from(i.changedTouches);for(const t of e)this._touches.set(t.identifier,performance.now());this._mouseTouchMove(t)},this._canPush=!0,this._touches=new Map,this._handlers={mouseDown:()=>this._mouseDown(),mouseLeave:()=>this._mouseTouchFinish(),mouseMove:t=>this._mouseTouchMove(t),mouseUp:t=>this._mouseTouchClick(t),touchStart:t=>this._touchStart(t),touchMove:t=>this._mouseTouchMove(t),touchEnd:t=>this._touchEnd(t),touchCancel:t=>this._touchEnd(t),touchEndClick:t=>this._touchEndClick(t),visibilityChange:()=>this._handleVisibilityChange(),themeChange:t=>this._handleThemeChange(t),oldThemeChange:t=>this._handleThemeChange(t),resize:()=>{this._handleWindowResize()}}}addListeners(){this._manageListeners(!0)}removeListeners(){this._manageListeners(!1)}}var p=e(5890);class f{constructor(t,i){this.container=i,this._engine=t,this._interactors=[],this._externalInteractors=[],this._particleInteractors=[]}externalInteract(t){for(const i of this._externalInteractors)i.isEnabled()&&i.interact(t)}handleClickMode(t){for(const i of this._externalInteractors)i.handleClickMode?.(t)}async init(){this._interactors=await this._engine.getInteractors(this.container,!0),this._externalInteractors=[],this._particleInteractors=[];for(const t of this._interactors){switch(t.type){case"external":this._externalInteractors.push(t);break;case"particles":this._particleInteractors.push(t)}t.init()}}particlesInteract(t,i){for(const e of this._externalInteractors)e.clear(t,i);for(const e of this._particleInteractors)e.isEnabled(t)&&e.interact(t,i)}reset(t){for(const i of this._externalInteractors)i.isEnabled()&&i.reset(t);for(const i of this._particleInteractors)i.isEnabled(t)&&i.reset(t)}}var _=e(4930),g=e(4802),m=e(6051),v=e(7405);const y=.5;function w(t){if(!(0,n.hn)(t.outMode,t.checkModes))return;const i=2*t.radius;t.coord>t.maxCoord-i?t.setCb(-t.radius):t.coord<i&&t.setCb(t.radius)}class b{constructor(t,i){this.container=i,this._calcPosition=(t,i,e,s=0)=>{for(const[,s]of t.plugins){const t=void 0!==s.particlePosition?s.particlePosition(i,this):void 0;if(t)return _.p.create(t.x,t.y,e)}const n=t.canvas.size,o=(0,g.Nx)({size:n,position:i}),a=_.p.create(o.x,o.y,e),r=this.getRadius(),h=this.options.move.outModes,c=i=>{w({outMode:i,checkModes:["bounce"],coord:a.x,maxCoord:t.canvas.size.width,setCb:t=>a.x+=t,radius:r})},l=i=>{w({outMode:i,checkModes:["bounce"],coord:a.y,maxCoord:t.canvas.size.height,setCb:t=>a.y+=t,radius:r})};if(c(h.left??h.default),c(h.right??h.default),l(h.top??h.default),l(h.bottom??h.default),this._checkOverlap(a,s)){const i=1;return this._calcPosition(t,void 0,e,s+i)}return a},this._calculateVelocity=()=>{const t=(0,g.$m)(this.direction).copy(),i=this.options.move;if("inside"===i.direction||"outside"===i.direction)return t;const e=(0,g.pu)((0,g.VG)(i.angle.value)),s=(0,g.pu)((0,g.VG)(i.angle.offset)),n={left:s-e*y,right:s+e*y};return i.straight||(t.angle+=(0,g.U4)((0,g.DT)(n.left,n.right))),i.random&&"number"==typeof i.speed&&(t.length*=(0,g.G0)()),t},this._checkOverlap=(t,i=0)=>{const e=this.options.collisions,n=this.getRadius();if(!e.enable)return!1;const o=e.overlap;if(o.enable)return!1;const a=o.retries;if(a>=0&&i>a)throw new Error(`${s.dI} particle is overlapping and can't be placed`);return!!this.container.particles.find((i=>(0,g.Yf)(t,i.position)<n+i.getRadius()))},this._getRollColor=t=>{if(!t||!this.roll||!this.backColor&&!this.roll.alter)return t;const i=this.roll.horizontal&&this.roll.vertical?2:1,e=this.roll.horizontal?Math.PI*y:0;return Math.floor(((this.roll.angle??0)+e)/(Math.PI/i))%2?this.backColor?this.backColor:this.roll.alter?(0,o.yx)(t,this.roll.alter.type,this.roll.alter.value):t:t},this._initPosition=t=>{const i=this.container,e=(0,g.VG)(this.options.zIndex.value);this.position=this._calcPosition(i,t,(0,g.qE)(e,0,i.zLayers)),this.initialPosition=this.position.copy();const s=i.canvas.size;switch(this.moveCenter={...(0,n.E9)(this.options.move.center,s),radius:this.options.move.center.radius??0,mode:this.options.move.center.mode??"percent"},this.direction=(0,g.JY)(this.options.move.direction,this.position,this.moveCenter),this.options.move.direction){case"inside":this.outType="inside";break;case"outside":this.outType="outside"}this.offset=_.M.origin},this._engine=t}destroy(t){if(this.unbreakable||this.destroyed)return;this.destroyed=!0,this.bubble.inRange=!1,this.slow.inRange=!1;const i=this.container,e=this.pathGenerator,s=i.shapeDrawers.get(this.shape);s?.particleDestroy?.(this);for(const[,e]of i.plugins)e.particleDestroyed?.(this,t);for(const e of i.particles.updaters)e.particleDestroyed?.(this,t);e?.reset(this),this._engine.dispatchEvent("particleDestroyed",{container:this.container,data:{particle:this}})}draw(t){const i=this.container,e=i.canvas;for(const[,s]of i.plugins)e.drawParticlePlugin(s,this,t);e.drawParticle(this,t)}getFillColor(){return this._getRollColor(this.bubble.color??(0,a.O_)(this.color))}getMass(){return this.getRadius()**2*Math.PI*y}getPosition(){return{x:this.position.x+this.offset.x,y:this.position.y+this.offset.y,z:this.position.z}}getRadius(){return this.bubble.radius??this.size.value}getStrokeColor(){return this._getRollColor(this.bubble.color??(0,a.O_)(this.strokeColor))}init(t,i,e,o){const r=this.container,h=this._engine;this.id=t,this.group=o,this.effectClose=!0,this.effectFill=!0,this.shapeClose=!0,this.shapeFill=!0,this.pathRotation=!1,this.lastPathTime=0,this.destroyed=!1,this.unbreakable=!1,this.rotation=0,this.misplaced=!1,this.retina={maxDistance:{}},this.outType="normal",this.ignoresResizeRatio=!0;const c=r.retina.pixelRatio,l=r.actualOptions,d=(0,v.y)(this._engine,r,l.particles),u=d.effect.type,p=d.shape.type,{reduceDuplicates:f}=d;this.effect=(0,n.TA)(u,this.id,f),this.shape=(0,n.TA)(p,this.id,f);const _=d.effect,y=d.shape;if(e){if(e.effect?.type){const t=e.effect.type,i=(0,n.TA)(t,this.id,f);i&&(this.effect=i,_.load(e.effect))}if(e.shape?.type){const t=e.shape.type,i=(0,n.TA)(t,this.id,f);i&&(this.shape=i,y.load(e.shape))}}this.effectData=function(t,i,e,s){const o=i.options[t];if(o)return(0,n.zw)({close:i.close,fill:i.fill},(0,n.TA)(o,e,s))}(this.effect,_,this.id,f),this.shapeData=function(t,i,e,s){const o=i.options[t];if(o)return(0,n.zw)({close:i.close,fill:i.fill},(0,n.TA)(o,e,s))}(this.shape,y,this.id,f),d.load(e);const w=this.effectData;w&&d.load(w.particles);const b=this.shapeData;b&&d.load(b.particles);const z=new m.k(h,r);z.load(r.actualOptions.interactivity),z.load(d.interactivity),this.interactivity=z,this.effectFill=w?.fill??d.effect.fill,this.effectClose=w?.close??d.effect.close,this.shapeFill=b?.fill??d.shape.fill,this.shapeClose=b?.close??d.shape.close,this.options=d;const C=this.options.move.path;this.pathDelay=(0,g.VG)(C.delay.value)*s.Xu,C.generator&&(this.pathGenerator=this._engine.getPathGenerator(C.generator),this.pathGenerator&&r.addPath(C.generator,this.pathGenerator)&&this.pathGenerator.init(r)),r.retina.initParticle(this),this.size=(0,n.Xs)(this.options.size,c),this.bubble={inRange:!1},this.slow={inRange:!1,factor:1},this._initPosition(i),this.initialVelocity=this._calculateVelocity(),this.velocity=this.initialVelocity.copy();this.moveDecay=1-(0,g.VG)(this.options.move.decay);const x=r.particles;x.setLastZIndex(this.position.z),this.zIndexFactor=this.position.z/r.zLayers,this.sides=24;let k=r.effectDrawers.get(this.effect);k||(k=this._engine.getEffectDrawer(this.effect),k&&r.effectDrawers.set(this.effect,k)),k?.loadEffect&&k.loadEffect(this);let P=r.shapeDrawers.get(this.shape);P||(P=this._engine.getShapeDrawer(this.shape),P&&r.shapeDrawers.set(this.shape,P)),P?.loadShape&&P.loadShape(this);const O=P?.getSidesCount;O&&(this.sides=O(this)),this.spawning=!1,this.shadowColor=(0,a.BN)(this.options.shadow.color);for(const t of x.updaters)t.init(this);for(const t of x.movers)t.init?.(this);k?.particleInit?.(r,this),P?.particleInit?.(r,this);for(const[,t]of r.plugins)t.particleCreated?.(this)}isInsideCanvas(){const t=this.getRadius(),i=this.container.canvas.size,e=this.position;return e.x>=-t&&e.y>=-t&&e.y<=i.height+t&&e.x<=i.width+t}isVisible(){return!this.destroyed&&!this.spawning&&this.isInsideCanvas()}reset(){for(const t of this.container.particles.updaters)t.reset?.(this)}}var z=e(888),C=e(6858);const x=.5;class k{constructor(t,i){this.rectangle=t,this.capacity=i,this._subdivide=()=>{const{x:t,y:i}=this.rectangle.position,{width:e,height:s}=this.rectangle.size,{capacity:n}=this;for(let o=0;o<4;o++){const a=o%2;this._subs.push(new k(new C.M_(t+e*x*a,i+s*x*(Math.round(o*x)-a),e*x,s*x),n))}this._divided=!0},this._points=[],this._divided=!1,this._subs=[]}insert(t){return!!this.rectangle.contains(t.position)&&(this._points.length<this.capacity?(this._points.push(t),!0):(this._divided||this._subdivide(),this._subs.some((i=>i.insert(t)))))}query(t,i){const e=[];if(!t.intersects(this.rectangle))return[];for(const s of this._points)!t.contains(s.position)&&(0,g.Yf)(t.position,s.position)>s.particle.getRadius()&&(!i||i(s.particle))||e.push(s.particle);if(this._divided)for(const s of this._subs)e.push(...s.query(t,i));return e}queryCircle(t,i,e){return this.query(new C.jl(t.x,t.y,i),e)}queryRectangle(t,i,e){return this.query(new C.M_(t.x,t.y,i.width,i.height),e)}}const P=t=>{const{height:i,width:e}=t;return new C.M_(-.25*e,-.25*i,1.5*e,1.5*i)};class O{constructor(t,i){this._addToPool=(...t)=>{for(const i of t)this._pool.push(i)},this._applyDensity=(t,i,e)=>{const s=t.number;if(!t.number.density?.enable)return void(void 0===e?this._limit=s.limit.value:s.limit&&this._groupLimits.set(e,s.limit.value));const n=this._initDensityFactor(s.density),o=s.value,a=s.limit.value>0?s.limit.value:o,r=Math.min(o,a)*n+i,h=Math.min(this.count,this.filter((t=>t.group===e)).length);void 0===e?this._limit=s.limit.value*n:this._groupLimits.set(e,s.limit.value*n),h<r?this.push(Math.abs(r-h),void 0,t,e):h>r&&this.removeQuantity(h-r,e)},this._initDensityFactor=t=>{const i=this._container;if(!i.canvas.element||!t.enable)return 1;const e=i.canvas.element,s=i.retina.pixelRatio;return e.width*e.height/(t.height*t.width*s**2)},this._pushParticle=(t,i,e,o)=>{try{let s=this._pool.pop();s||(s=new b(this._engine,this._container)),s.init(this._nextId,t,i,e);let n=!0;if(o&&(n=o(s)),!n)return;return this._array.push(s),this._zArray.push(s),this._nextId++,this._engine.dispatchEvent("particleAdded",{container:this._container,data:{particle:s}}),s}catch(t){(0,n.tZ)().warning(`${s.dI} adding particle: ${t}`)}},this._removeParticle=(t,i,e)=>{const s=this._array[t];if(!s||s.group!==i)return!1;const n=this._zArray.indexOf(s);return this._array.splice(t,1),this._zArray.splice(n,1),s.destroy(e),this._engine.dispatchEvent("particleRemoved",{container:this._container,data:{particle:s}}),this._addToPool(s),!0},this._engine=t,this._container=i,this._nextId=0,this._array=[],this._zArray=[],this._pool=[],this._limit=0,this._groupLimits=new Map,this._needsSort=!1,this._lastZIndex=0,this._interactionManager=new f(t,i),this._pluginsInitialized=!1;const e=i.canvas.size;this.quadTree=new k(P(e),4),this.movers=[],this.updaters=[]}get count(){return this._array.length}addManualParticles(){const t=this._container,i=t.actualOptions;for(const e of i.manualParticles)this.addParticle(e.position?(0,n.E9)(e.position,t.canvas.size):void 0,e.options)}addParticle(t,i,e,s){const n=this._container.actualOptions.particles.number.limit,o=void 0===e?this._limit:this._groupLimits.get(e)??this._limit,a=this.count;if(o>0)if("delete"===n.mode){const t=a+1-o;t>0&&this.removeQuantity(t)}else if("wait"===n.mode&&a>=o)return;return this._pushParticle(t,i,e,s)}clear(){this._array=[],this._zArray=[],this._pluginsInitialized=!1}destroy(){this._array=[],this._zArray=[],this.movers=[],this.updaters=[]}draw(t){const i=this._container,e=i.canvas;e.clear(),this.update(t);for(const[,s]of i.plugins)e.drawPlugin(s,t);for(const i of this._zArray)i.draw(t)}filter(t){return this._array.filter(t)}find(t){return this._array.find(t)}get(t){return this._array[t]}handleClickMode(t){this._interactionManager.handleClickMode(t)}async init(){const t=this._container,i=t.actualOptions;this._lastZIndex=0,this._needsSort=!1,await this.initPlugins();let e=!1;for(const[,i]of t.plugins)if(void 0!==i.particlesInitialization&&(e=i.particlesInitialization()),e)break;if(this.addManualParticles(),!e){const t=i.particles,e=t.groups;for(const i in e){const s=e[i];for(let e=this.count,n=0;n<s.number?.value&&e<t.number.value;e++,n++)this.addParticle(void 0,s,i)}for(let i=this.count;i<t.number.value;i++)this.addParticle()}}async initPlugins(){if(this._pluginsInitialized)return;const t=this._container;this.movers=await this._engine.getMovers(t,!0),this.updaters=await this._engine.getUpdaters(t,!0),await this._interactionManager.init();for(const[,i]of t.pathGenerators)i.init(t)}push(t,i,e,s){for(let n=0;n<t;n++)this.addParticle(i?.position,e,s)}async redraw(){this.clear(),await this.init(),this.draw({value:0,factor:0})}remove(t,i,e){this.removeAt(this._array.indexOf(t),void 0,i,e)}removeAt(t,i=1,e,s){if(t<0||t>this.count)return;let n=0;for(let o=t;n<i&&o<this.count;o++)this._removeParticle(o--,e,s)&&n++}removeQuantity(t,i){this.removeAt(0,t,i)}setDensity(){const t=this._container.actualOptions,i=t.particles.groups;for(const t in i)this._applyDensity(i[t],0,t);this._applyDensity(t.particles,t.manualParticles.length)}setLastZIndex(t){this._lastZIndex=t,this._needsSort=this._needsSort||this._lastZIndex<t}setResizeFactor(t){this._resizeFactor=t}update(t){const i=this._container,e=new Set;this.quadTree=new k(P(i.canvas.size),4);for(const[,t]of i.pathGenerators)t.update();for(const[,e]of i.plugins)e.update?.(t);const s=this._resizeFactor;for(const i of this._array){s&&!i.ignoresResizeRatio&&(i.position.x*=s.width,i.position.y*=s.height,i.initialPosition.x*=s.width,i.initialPosition.y*=s.height),i.ignoresResizeRatio=!1,this._interactionManager.reset(i);for(const[,e]of this._container.plugins){if(i.destroyed)break;e.particleUpdate?.(i,t)}for(const e of this.movers)e.isEnabled(i)&&e.move(i,t);i.destroyed?e.add(i):this.quadTree.insert(new z.b(i.getPosition(),i))}if(e.size){const t=t=>!e.has(t);this._array=this.filter(t),this._zArray=this._zArray.filter(t);for(const t of e)this._engine.dispatchEvent("particleRemoved",{container:this._container,data:{particle:t}});this._addToPool(...e)}this._interactionManager.externalInteract(t);for(const i of this._array){for(const e of this.updaters)e.update(i,t);i.destroyed||i.spawning||this._interactionManager.particlesInteract(i,t)}if(delete this._resizeFactor,this._needsSort){const t=this._zArray;t.sort(((t,i)=>i.position.z-t.position.z||t.id-i.id));const i=1;this._lastZIndex=t[t.length-i].position.z,this._needsSort=!1}}}class T{constructor(t){this.container=t,this.pixelRatio=1,this.reduceFactor=1}init(){const t=this.container,i=t.actualOptions;this.pixelRatio=!i.detectRetina||(0,n.B9)()?1:window.devicePixelRatio,this.reduceFactor=1;const e=this.pixelRatio,s=t.canvas;if(s.element){const t=s.element;s.size.width=t.offsetWidth*e,s.size.height=t.offsetHeight*e}const o=i.particles,a=o.move;this.maxSpeed=(0,g.VG)(a.gravity.maxSpeed)*e,this.sizeAnimationSpeed=(0,g.VG)(o.size.animation.speed)*e}initParticle(t){const i=t.options,e=this.pixelRatio,s=i.move,n=s.distance,o=t.retina;o.moveDrift=(0,g.VG)(s.drift)*e,o.moveSpeed=(0,g.VG)(s.speed)*e,o.sizeAnimationSpeed=(0,g.VG)(i.size.animation.speed)*e;const a=o.maxDistance;a.horizontal=void 0!==n.horizontal?n.horizontal*e:void 0,a.vertical=void 0!==n.vertical?n.vertical*e:void 0,o.maxSpeed=(0,g.VG)(s.gravity.maxSpeed)*e}}function M(t){return t&&!t.destroyed}function S(t,i,...e){const s=new p.J(t,i);return(0,v.Z)(s,...e),s}class D{constructor(t,i,e){this._intersectionManager=t=>{if(M(this)&&this.actualOptions.pauseOnOutsideViewport)for(const i of t)i.target===this.interactivity.element&&(i.isIntersecting?this.play():this.pause())},this._nextFrame=t=>{try{if(!this._smooth&&void 0!==this._lastFrameTime&&t<this._lastFrameTime+s.Xu/this.fpsLimit)return void this.draw(!1);this._lastFrameTime??=t;const i=function(t,i=60,e=!1){return{value:t,factor:e?60/i:60*t/s.Xu}}(t-this._lastFrameTime,this.fpsLimit,this._smooth);if(this.addLifeTime(i.value),this._lastFrameTime=t,i.value>s.Xu)return void this.draw(!1);if(this.particles.draw(i),!this.alive())return void this.destroy();this.animationStatus&&this.draw(!1)}catch(t){(0,n.tZ)().error(`${s.dI} in animation loop`,t)}},this._engine=t,this.id=Symbol(i),this.fpsLimit=120,this._smooth=!1,this._delay=0,this._duration=0,this._lifeTime=0,this._firstStart=!0,this.started=!1,this.destroyed=!1,this._paused=!0,this._lastFrameTime=0,this.zLayers=100,this.pageHidden=!1,this._sourceOptions=e,this._initialSourceOptions=e,this.retina=new T(this),this.canvas=new c(this),this.particles=new O(this._engine,this),this.pathGenerators=new Map,this.interactivity={mouse:{clicking:!1,inside:!1}},this.plugins=new Map,this.effectDrawers=new Map,this.shapeDrawers=new Map,this._options=S(this._engine,this),this.actualOptions=S(this._engine,this),this._eventListeners=new u(this),this._intersectionObserver=(0,n.BR)((t=>this._intersectionManager(t))),this._engine.dispatchEvent("containerBuilt",{container:this})}get animationStatus(){return!this._paused&&!this.pageHidden&&M(this)}get options(){return this._options}get sourceOptions(){return this._sourceOptions}addClickHandler(t){if(!M(this))return;const i=this.interactivity.element;if(!i)return;const e=(i,e,s)=>{if(!M(this))return;const n=this.retina.pixelRatio,o={x:e.x*n,y:e.y*n},a=this.particles.quadTree.queryCircle(o,s*n);t(i,a)};let s=!1,n=!1;i.addEventListener("click",(t=>{if(!M(this))return;const i=t,s={x:i.offsetX||i.clientX,y:i.offsetY||i.clientY};e(t,s,1)})),i.addEventListener("touchstart",(()=>{M(this)&&(s=!0,n=!1)})),i.addEventListener("touchmove",(()=>{M(this)&&(n=!0)})),i.addEventListener("touchend",(t=>{if(M(this)){if(s&&!n){const i=t,s=1;let n=i.touches[i.touches.length-s];if(!n&&(n=i.changedTouches[i.changedTouches.length-s],!n))return;const o=this.canvas.element,a=o?o.getBoundingClientRect():void 0,r=0,h={x:n.clientX-(a?a.left:r),y:n.clientY-(a?a.top:r)};e(t,h,Math.max(n.radiusX,n.radiusY))}s=!1,n=!1}})),i.addEventListener("touchcancel",(()=>{M(this)&&(s=!1,n=!1)}))}addLifeTime(t){this._lifeTime+=t}addPath(t,i,e=!1){return!(!M(this)||!e&&this.pathGenerators.has(t))&&(this.pathGenerators.set(t,i),!0)}alive(){return!this._duration||this._lifeTime<=this._duration}destroy(){if(!M(this))return;this.stop(),this.particles.destroy(),this.canvas.destroy();for(const[,t]of this.effectDrawers)t.destroy?.(this);for(const[,t]of this.shapeDrawers)t.destroy?.(this);for(const t of this.effectDrawers.keys())this.effectDrawers.delete(t);for(const t of this.shapeDrawers.keys())this.shapeDrawers.delete(t);this._engine.clearPlugins(this),this.destroyed=!0;const t=this._engine.dom(),i=t.findIndex((t=>t===this));if(i>=0){const e=1;t.splice(i,e)}this._engine.dispatchEvent("containerDestroyed",{container:this})}draw(t){if(!M(this))return;let i=t;const e=t=>{i&&(this._lastFrameTime=void 0,i=!1),this._nextFrame(t)};this._drawAnimationFrame=requestAnimationFrame((t=>e(t)))}async export(t,i={}){for(const[,e]of this.plugins){if(!e.export)continue;const s=await e.export(t,i);if(s.supported)return s.blob}(0,n.tZ)().error(`${s.dI} - Export plugin with type ${t} not found`)}handleClickMode(t){if(M(this)){this.particles.handleClickMode(t);for(const[,i]of this.plugins)i.handleClickMode?.(t)}}async init(){if(!M(this))return;const t=this._engine.getSupportedEffects();for(const i of t){const t=this._engine.getEffectDrawer(i);t&&this.effectDrawers.set(i,t)}const i=this._engine.getSupportedShapes();for(const t of i){const i=this._engine.getShapeDrawer(t);i&&this.shapeDrawers.set(t,i)}await this.particles.initPlugins(),this._options=S(this._engine,this,this._initialSourceOptions,this.sourceOptions),this.actualOptions=S(this._engine,this,this._options);const e=await this._engine.getAvailablePlugins(this);for(const[t,i]of e)this.plugins.set(t,i);this.retina.init(),await this.canvas.init(),this.updateActualOptions(),this.canvas.initBackground(),this.canvas.resize(),this.zLayers=this.actualOptions.zLayers,this._duration=(0,g.VG)(this.actualOptions.duration)*s.Xu,this._delay=(0,g.VG)(this.actualOptions.delay)*s.Xu,this._lifeTime=0;this.fpsLimit=this.actualOptions.fpsLimit>0?this.actualOptions.fpsLimit:120,this._smooth=this.actualOptions.smooth;for(const[,t]of this.effectDrawers)await(t.init?.(this));for(const[,t]of this.shapeDrawers)await(t.init?.(this));for(const[,t]of this.plugins)await(t.init?.());this._engine.dispatchEvent("containerInit",{container:this}),await this.particles.init(),this.particles.setDensity();for(const[,t]of this.plugins)t.particlesSetup?.();this._engine.dispatchEvent("particlesSetup",{container:this})}async loadTheme(t){M(this)&&(this._currentTheme=t,await this.refresh())}pause(){if(M(this)&&(void 0!==this._drawAnimationFrame&&(cancelAnimationFrame(this._drawAnimationFrame),delete this._drawAnimationFrame),!this._paused)){for(const[,t]of this.plugins)t.pause?.();this.pageHidden||(this._paused=!0),this._engine.dispatchEvent("containerPaused",{container:this})}}play(t){if(!M(this))return;const i=this._paused||t;if(!this._firstStart||this.actualOptions.autoPlay){if(this._paused&&(this._paused=!1),i)for(const[,t]of this.plugins)t.play&&t.play();this._engine.dispatchEvent("containerPlay",{container:this}),this.draw(i??!1)}else this._firstStart=!1}async refresh(){if(M(this))return this.stop(),this.start()}async reset(){if(M(this))return this._initialSourceOptions=void 0,this._options=S(this._engine,this),this.actualOptions=S(this._engine,this,this._options),this.refresh()}async start(){M(this)&&!this.started&&(await this.init(),this.started=!0,await new Promise((t=>{const i=async()=>{this._eventListeners.addListeners(),this.interactivity.element instanceof HTMLElement&&this._intersectionObserver&&this._intersectionObserver.observe(this.interactivity.element);for(const[,t]of this.plugins)await(t.start?.());this._engine.dispatchEvent("containerStarted",{container:this}),this.play(),t()};this._delayTimeout=setTimeout((()=>{i()}),this._delay)})))}stop(){if(M(this)&&this.started){this._delayTimeout&&(clearTimeout(this._delayTimeout),delete this._delayTimeout),this._firstStart=!0,this.started=!1,this._eventListeners.removeListeners(),this.pause(),this.particles.clear(),this.canvas.stop(),this.interactivity.element instanceof HTMLElement&&this._intersectionObserver&&this._intersectionObserver.unobserve(this.interactivity.element);for(const[,t]of this.plugins)t.stop?.();for(const t of this.plugins.keys())this.plugins.delete(t);this._sourceOptions=this._options,this._engine.dispatchEvent("containerStopped",{container:this})}}updateActualOptions(){this.actualOptions.responsive=[];const t=this.actualOptions.setResponsive(this.canvas.size.width,this.retina.pixelRatio,this._options);return this.actualOptions.setTheme(this._currentTheme),this._responsiveMaxWidth!==t&&(this._responsiveMaxWidth=t,!0)}}}}]);
@@ -1 +0,0 @@
1
- /*! tsParticles Engine v3.3.0 by Matteo Bruni */