UNPKG

321 kBJavaScriptView Raw
1/*!
2 * Author : Matteo Bruni
3 * MIT license: https://opensource.org/licenses/MIT
4 * Demo / Generator : https://particles.js.org/
5 * GitHub : https://www.github.com/matteobruni/tsparticles
6 * How to use? : Check the GitHub README
7 * v2.0.6
8 */
9(function webpackUniversalModuleDefinition(root, factory) {
10 if(typeof exports === 'object' && typeof module === 'object')
11 module.exports = factory();
12 else if(typeof define === 'function' && define.amd)
13 define([], factory);
14 else {
15 var a = factory();
16 for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
17 }
18})(this, () => {
19return /******/ (() => { // webpackBootstrap
20/******/ "use strict";
21/******/ // The require scope
22/******/ var __webpack_require__ = {};
23/******/
24/************************************************************************/
25/******/ /* webpack/runtime/define property getters */
26/******/ (() => {
27/******/ // define getter functions for harmony exports
28/******/ __webpack_require__.d = (exports, definition) => {
29/******/ for(var key in definition) {
30/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
31/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
32/******/ }
33/******/ }
34/******/ };
35/******/ })();
36/******/
37/******/ /* webpack/runtime/hasOwnProperty shorthand */
38/******/ (() => {
39/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
40/******/ })();
41/******/
42/******/ /* webpack/runtime/make namespace object */
43/******/ (() => {
44/******/ // define __esModule on exports
45/******/ __webpack_require__.r = (exports) => {
46/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
47/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
48/******/ }
49/******/ Object.defineProperty(exports, '__esModule', { value: true });
50/******/ };
51/******/ })();
52/******/
53/************************************************************************/
54var __webpack_exports__ = {};
55// ESM COMPAT FLAG
56__webpack_require__.r(__webpack_exports__);
57
58// EXPORTS
59__webpack_require__.d(__webpack_exports__, {
60 "AnimatableColor": () => (/* reexport */ AnimatableColor),
61 "AnimatableGradient": () => (/* reexport */ AnimatableGradient),
62 "AnimatableGradientColor": () => (/* reexport */ AnimatableGradientColor),
63 "AnimationOptions": () => (/* reexport */ AnimationOptions),
64 "Attract": () => (/* reexport */ Attract),
65 "Background": () => (/* reexport */ Background),
66 "BackgroundMask": () => (/* reexport */ BackgroundMask),
67 "BackgroundMaskCover": () => (/* reexport */ BackgroundMaskCover),
68 "Bounce": () => (/* reexport */ Bounce),
69 "Bubble": () => (/* reexport */ Bubble),
70 "BubbleBase": () => (/* reexport */ BubbleBase),
71 "BubbleDiv": () => (/* reexport */ BubbleDiv),
72 "Canvas": () => (/* reexport */ Canvas),
73 "Circle": () => (/* reexport */ Circle),
74 "CircleWarp": () => (/* reexport */ CircleWarp),
75 "ClickEvent": () => (/* reexport */ ClickEvent),
76 "Collisions": () => (/* reexport */ Collisions),
77 "CollisionsOverlap": () => (/* reexport */ CollisionsOverlap),
78 "ColorAnimation": () => (/* reexport */ ColorAnimation),
79 "Connect": () => (/* reexport */ Connect),
80 "ConnectLinks": () => (/* reexport */ ConnectLinks),
81 "Container": () => (/* reexport */ Container),
82 "Destroy": () => (/* reexport */ Destroy),
83 "DivEvent": () => (/* reexport */ DivEvent),
84 "Engine": () => (/* reexport */ Engine),
85 "EventListeners": () => (/* reexport */ EventListeners),
86 "Events": () => (/* reexport */ Events),
87 "ExternalInteractorBase": () => (/* reexport */ ExternalInteractorBase),
88 "FrameManager": () => (/* reexport */ FrameManager),
89 "FullScreen": () => (/* reexport */ FullScreen),
90 "Grab": () => (/* reexport */ Grab),
91 "GrabLinks": () => (/* reexport */ GrabLinks),
92 "GradientAngle": () => (/* reexport */ GradientAngle),
93 "GradientAngleAnimation": () => (/* reexport */ GradientAngleAnimation),
94 "GradientColorOpacity": () => (/* reexport */ GradientColorOpacity),
95 "GradientColorOpacityAnimation": () => (/* reexport */ GradientColorOpacityAnimation),
96 "HoverEvent": () => (/* reexport */ HoverEvent),
97 "HslAnimation": () => (/* reexport */ HslAnimation),
98 "InteractionManager": () => (/* reexport */ InteractionManager),
99 "Interactivity": () => (/* reexport */ Interactivity),
100 "Life": () => (/* reexport */ Life),
101 "LifeDelay": () => (/* reexport */ LifeDelay),
102 "LifeDuration": () => (/* reexport */ LifeDuration),
103 "Light": () => (/* reexport */ Light),
104 "LightArea": () => (/* reexport */ LightArea),
105 "LightGradient": () => (/* reexport */ LightGradient),
106 "LightShadow": () => (/* reexport */ LightShadow),
107 "Links": () => (/* reexport */ Links),
108 "LinksShadow": () => (/* reexport */ LinksShadow),
109 "LinksTriangle": () => (/* reexport */ LinksTriangle),
110 "Loader": () => (/* reexport */ Loader),
111 "Main": () => (/* reexport */ Engine),
112 "ManualParticle": () => (/* reexport */ ManualParticle),
113 "Modes": () => (/* reexport */ Modes),
114 "Motion": () => (/* reexport */ Motion),
115 "MotionReduce": () => (/* reexport */ MotionReduce),
116 "Move": () => (/* reexport */ Move),
117 "MoveAngle": () => (/* reexport */ MoveAngle),
118 "MoveAttract": () => (/* reexport */ MoveAttract),
119 "MoveGravity": () => (/* reexport */ MoveGravity),
120 "MovePath": () => (/* reexport */ MovePath),
121 "MovePathDelay": () => (/* reexport */ MovePathDelay),
122 "MoveTrail": () => (/* reexport */ MoveTrail),
123 "Opacity": () => (/* reexport */ Opacity),
124 "OpacityAnimation": () => (/* reexport */ OpacityAnimation),
125 "Options": () => (/* reexport */ Options),
126 "OptionsColor": () => (/* reexport */ OptionsColor),
127 "Orbit": () => (/* reexport */ Orbit),
128 "OrbitRotation": () => (/* reexport */ OrbitRotation),
129 "OutModes": () => (/* reexport */ OutModes),
130 "Parallax": () => (/* reexport */ Parallax),
131 "Particle": () => (/* reexport */ Particle),
132 "Particles": () => (/* reexport */ Particles),
133 "ParticlesBounce": () => (/* reexport */ ParticlesBounce),
134 "ParticlesBounceFactor": () => (/* reexport */ ParticlesBounceFactor),
135 "ParticlesDensity": () => (/* reexport */ ParticlesDensity),
136 "ParticlesInteractorBase": () => (/* reexport */ ParticlesInteractorBase),
137 "ParticlesNumber": () => (/* reexport */ ParticlesNumber),
138 "ParticlesOptions": () => (/* reexport */ ParticlesOptions),
139 "ParticlesRepulse": () => (/* reexport */ ParticlesRepulse),
140 "Plugins": () => (/* reexport */ Plugins),
141 "Point": () => (/* reexport */ Point),
142 "Push": () => (/* reexport */ Push),
143 "QuadTree": () => (/* reexport */ QuadTree),
144 "Range": () => (/* reexport */ Range),
145 "Rectangle": () => (/* reexport */ Rectangle),
146 "Remove": () => (/* reexport */ Remove),
147 "Repulse": () => (/* reexport */ Repulse),
148 "RepulseBase": () => (/* reexport */ RepulseBase),
149 "RepulseDiv": () => (/* reexport */ RepulseDiv),
150 "Responsive": () => (/* reexport */ Responsive),
151 "Retina": () => (/* reexport */ Retina),
152 "Roll": () => (/* reexport */ Roll),
153 "RollLight": () => (/* reexport */ RollLight),
154 "Rotate": () => (/* reexport */ Rotate),
155 "RotateAnimation": () => (/* reexport */ RotateAnimation),
156 "Shadow": () => (/* reexport */ Shadow),
157 "Shape": () => (/* reexport */ Shape),
158 "Size": () => (/* reexport */ Size),
159 "SizeAnimation": () => (/* reexport */ SizeAnimation),
160 "Slow": () => (/* reexport */ Slow),
161 "Spin": () => (/* reexport */ Spin),
162 "Split": () => (/* reexport */ Split),
163 "SplitFactor": () => (/* reexport */ SplitFactor),
164 "SplitRate": () => (/* reexport */ SplitRate),
165 "Stroke": () => (/* reexport */ Stroke),
166 "Theme": () => (/* reexport */ Theme),
167 "ThemeDefault": () => (/* reexport */ ThemeDefault),
168 "Tilt": () => (/* reexport */ Tilt),
169 "TiltAnimation": () => (/* reexport */ TiltAnimation),
170 "Trail": () => (/* reexport */ Trail),
171 "Twinkle": () => (/* reexport */ Twinkle),
172 "TwinkleValues": () => (/* reexport */ TwinkleValues),
173 "ValueWithRandom": () => (/* reexport */ ValueWithRandom),
174 "Vector": () => (/* reexport */ Vector),
175 "Vector3d": () => (/* reexport */ Vector3d),
176 "Wobble": () => (/* reexport */ Wobble),
177 "ZIndex": () => (/* reexport */ ZIndex),
178 "alterHsl": () => (/* reexport */ alterHsl),
179 "animate": () => (/* reexport */ animate),
180 "areBoundsInside": () => (/* reexport */ areBoundsInside),
181 "arrayRandomIndex": () => (/* reexport */ arrayRandomIndex),
182 "calcEasing": () => (/* reexport */ calcEasing),
183 "calcExactPositionOrRandomFromSize": () => (/* reexport */ calcExactPositionOrRandomFromSize),
184 "calcExactPositionOrRandomFromSizeRanged": () => (/* reexport */ calcExactPositionOrRandomFromSizeRanged),
185 "calcPositionFromSize": () => (/* reexport */ calcPositionFromSize),
186 "calcPositionOrRandomFromSize": () => (/* reexport */ calcPositionOrRandomFromSize),
187 "calcPositionOrRandomFromSizeRanged": () => (/* reexport */ calcPositionOrRandomFromSizeRanged),
188 "calculateBounds": () => (/* reexport */ calculateBounds),
189 "cancelAnimation": () => (/* reexport */ cancelAnimation),
190 "circleBounce": () => (/* reexport */ circleBounce),
191 "circleBounceDataFromParticle": () => (/* reexport */ circleBounceDataFromParticle),
192 "clamp": () => (/* reexport */ clamp),
193 "clear": () => (/* reexport */ clear),
194 "collisionVelocity": () => (/* reexport */ collisionVelocity),
195 "colorMix": () => (/* reexport */ colorMix),
196 "colorToHsl": () => (/* reexport */ colorToHsl),
197 "colorToRgb": () => (/* reexport */ colorToRgb),
198 "deepExtend": () => (/* reexport */ deepExtend),
199 "divMode": () => (/* reexport */ divMode),
200 "divModeExecute": () => (/* reexport */ divModeExecute),
201 "drawConnectLine": () => (/* reexport */ drawConnectLine),
202 "drawEllipse": () => (/* reexport */ drawEllipse),
203 "drawGrabLine": () => (/* reexport */ drawGrabLine),
204 "drawLine": () => (/* reexport */ drawLine),
205 "drawParticle": () => (/* reexport */ drawParticle),
206 "drawParticlePlugin": () => (/* reexport */ drawParticlePlugin),
207 "drawPlugin": () => (/* reexport */ drawPlugin),
208 "drawShape": () => (/* reexport */ drawShape),
209 "drawShapeAfterEffect": () => (/* reexport */ drawShapeAfterEffect),
210 "drawTriangle": () => (/* reexport */ drawTriangle),
211 "generatedAttribute": () => (/* reexport */ generatedAttribute),
212 "getDistance": () => (/* reexport */ getDistance),
213 "getDistances": () => (/* reexport */ getDistances),
214 "getHslAnimationFromHsl": () => (/* reexport */ getHslAnimationFromHsl),
215 "getHslFromAnimation": () => (/* reexport */ getHslFromAnimation),
216 "getLinkColor": () => (/* reexport */ getLinkColor),
217 "getLinkRandomColor": () => (/* reexport */ getLinkRandomColor),
218 "getParticleBaseVelocity": () => (/* reexport */ getParticleBaseVelocity),
219 "getParticleDirectionAngle": () => (/* reexport */ getParticleDirectionAngle),
220 "getRandomRgbColor": () => (/* reexport */ getRandomRgbColor),
221 "getRangeMax": () => (/* reexport */ getRangeMax),
222 "getRangeMin": () => (/* reexport */ getRangeMin),
223 "getRangeValue": () => (/* reexport */ getRangeValue),
224 "getStyleFromHsl": () => (/* reexport */ getStyleFromHsl),
225 "getStyleFromHsv": () => (/* reexport */ getStyleFromHsv),
226 "getStyleFromRgb": () => (/* reexport */ getStyleFromRgb),
227 "getValue": () => (/* reexport */ getValue),
228 "gradient": () => (/* reexport */ gradient),
229 "hslToHsv": () => (/* reexport */ hslToHsv),
230 "hslToRgb": () => (/* reexport */ hslToRgb),
231 "hslaToHsva": () => (/* reexport */ hslaToHsva),
232 "hslaToRgba": () => (/* reexport */ hslaToRgba),
233 "hsvToHsl": () => (/* reexport */ hsvToHsl),
234 "hsvToRgb": () => (/* reexport */ hsvToRgb),
235 "hsvaToHsla": () => (/* reexport */ hsvaToHsla),
236 "hsvaToRgba": () => (/* reexport */ hsvaToRgba),
237 "isDivModeEnabled": () => (/* reexport */ isDivModeEnabled),
238 "isInArray": () => (/* reexport */ isInArray),
239 "isPointInside": () => (/* reexport */ isPointInside),
240 "isSsr": () => (/* reexport */ isSsr),
241 "itemFromArray": () => (/* reexport */ itemFromArray),
242 "loadContainerOptions": () => (/* reexport */ loadContainerOptions),
243 "loadFont": () => (/* reexport */ loadFont),
244 "loadParticlesOptions": () => (/* reexport */ loadParticlesOptions),
245 "loadSlim": () => (/* reexport */ loadSlim),
246 "midColorValue": () => (/* reexport */ midColorValue),
247 "mix": () => (/* reexport */ mix),
248 "mouseDownEvent": () => (/* reexport */ mouseDownEvent),
249 "mouseLeaveEvent": () => (/* reexport */ mouseLeaveEvent),
250 "mouseMoveEvent": () => (/* reexport */ mouseMoveEvent),
251 "mouseOutEvent": () => (/* reexport */ mouseOutEvent),
252 "mouseUpEvent": () => (/* reexport */ mouseUpEvent),
253 "noPolygonDataLoaded": () => (/* reexport */ noPolygonDataLoaded),
254 "noPolygonFound": () => (/* reexport */ noPolygonFound),
255 "paintBase": () => (/* reexport */ paintBase),
256 "randomColorValue": () => (/* reexport */ randomColorValue),
257 "randomInRange": () => (/* reexport */ randomInRange),
258 "rectBounce": () => (/* reexport */ rectBounce),
259 "resizeEvent": () => (/* reexport */ resizeEvent),
260 "rgbToHsl": () => (/* reexport */ rgbToHsl),
261 "rgbToHsv": () => (/* reexport */ rgbToHsv),
262 "rgbaToHsva": () => (/* reexport */ rgbaToHsva),
263 "setRangeValue": () => (/* reexport */ setRangeValue),
264 "singleDivModeExecute": () => (/* reexport */ singleDivModeExecute),
265 "stringToAlpha": () => (/* reexport */ stringToAlpha),
266 "stringToRgb": () => (/* reexport */ stringToRgb),
267 "touchCancelEvent": () => (/* reexport */ touchCancelEvent),
268 "touchEndEvent": () => (/* reexport */ touchEndEvent),
269 "touchMoveEvent": () => (/* reexport */ touchMoveEvent),
270 "touchStartEvent": () => (/* reexport */ touchStartEvent),
271 "tsParticles": () => (/* reexport */ tsParticles),
272 "visibilityChangeEvent": () => (/* reexport */ visibilityChangeEvent)
273});
274
275;// CONCATENATED MODULE: ../pjs/dist/esm/index.js
276const initPjs = engine => {
277 const particlesJS = (tagId, options) => {
278 return engine.load(tagId, options);
279 };
280
281 particlesJS.load = (tagId, pathConfigJson, callback) => {
282 engine.loadJSON(tagId, pathConfigJson).then(container => {
283 if (container) {
284 callback(container);
285 }
286 }).catch(() => {
287 callback(undefined);
288 });
289 };
290
291 particlesJS.setOnClickHandler = callback => {
292 engine.setOnClickHandler(callback);
293 };
294
295 const pJSDom = engine.dom();
296 return {
297 particlesJS,
298 pJSDom
299 };
300};
301
302
303;// CONCATENATED MODULE: ../../engine/dist/esm/Utils/EventDispatcher.js
304var __classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function (receiver, state, value, kind, f) {
305 if (kind === "m") throw new TypeError("Private method is not writable");
306 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
307 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
308 return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
309};
310
311var __classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function (receiver, state, kind, f) {
312 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
313 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
314 return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
315};
316
317var _EventDispatcher_listeners;
318
319class EventDispatcher {
320 constructor() {
321 _EventDispatcher_listeners.set(this, void 0);
322
323 __classPrivateFieldSet(this, _EventDispatcher_listeners, new Map(), "f");
324 }
325
326 addEventListener(type, listener) {
327 var _a;
328
329 this.removeEventListener(type, listener);
330
331 if (!__classPrivateFieldGet(this, _EventDispatcher_listeners, "f").get(type)) {
332 __classPrivateFieldGet(this, _EventDispatcher_listeners, "f").set(type, []);
333 }
334
335 (_a = __classPrivateFieldGet(this, _EventDispatcher_listeners, "f").get(type)) === null || _a === void 0 ? void 0 : _a.push(listener);
336 }
337
338 removeEventListener(type, listener) {
339 const arr = __classPrivateFieldGet(this, _EventDispatcher_listeners, "f").get(type);
340
341 if (!arr) {
342 return;
343 }
344
345 const length = arr.length,
346 idx = arr.indexOf(listener);
347
348 if (idx < 0) {
349 return;
350 }
351
352 if (length === 1) {
353 __classPrivateFieldGet(this, _EventDispatcher_listeners, "f").delete(type);
354 } else {
355 arr.splice(idx, 1);
356 }
357 }
358
359 removeAllEventListeners(type) {
360 if (!type) {
361 __classPrivateFieldSet(this, _EventDispatcher_listeners, new Map(), "f");
362 } else {
363 __classPrivateFieldGet(this, _EventDispatcher_listeners, "f").delete(type);
364 }
365 }
366
367 dispatchEvent(type, args) {
368 var _a;
369
370 (_a = __classPrivateFieldGet(this, _EventDispatcher_listeners, "f").get(type)) === null || _a === void 0 ? void 0 : _a.forEach(handler => handler(args));
371 }
372
373 hasEventListener(type) {
374 return !!__classPrivateFieldGet(this, _EventDispatcher_listeners, "f").get(type);
375 }
376
377}
378_EventDispatcher_listeners = new WeakMap();
379;// CONCATENATED MODULE: ../../engine/dist/esm/Core/Utils/Vector.js
380class Vector {
381 constructor(xOrCoords, y) {
382 if (typeof xOrCoords !== "number" && xOrCoords) {
383 this.x = xOrCoords.x;
384 this.y = xOrCoords.y;
385 } else if (xOrCoords !== undefined && y !== undefined) {
386 this.x = xOrCoords;
387 this.y = y;
388 } else {
389 throw new Error("tsParticles - Vector not initialized correctly");
390 }
391 }
392
393 static clone(source) {
394 return Vector.create(source.x, source.y);
395 }
396
397 static create(x, y) {
398 return new Vector(x, y);
399 }
400
401 static get origin() {
402 return Vector.create(0, 0);
403 }
404
405 get angle() {
406 return Math.atan2(this.y, this.x);
407 }
408
409 set angle(angle) {
410 this.updateFromAngle(angle, this.length);
411 }
412
413 get length() {
414 return Math.sqrt(this.getLengthSq());
415 }
416
417 set length(length) {
418 this.updateFromAngle(this.angle, length);
419 }
420
421 add(v) {
422 return Vector.create(this.x + v.x, this.y + v.y);
423 }
424
425 addTo(v) {
426 this.x += v.x;
427 this.y += v.y;
428 }
429
430 sub(v) {
431 return Vector.create(this.x - v.x, this.y - v.y);
432 }
433
434 subFrom(v) {
435 this.x -= v.x;
436 this.y -= v.y;
437 }
438
439 mult(n) {
440 return Vector.create(this.x * n, this.y * n);
441 }
442
443 multTo(n) {
444 this.x *= n;
445 this.y *= n;
446 }
447
448 div(n) {
449 return Vector.create(this.x / n, this.y / n);
450 }
451
452 divTo(n) {
453 this.x /= n;
454 this.y /= n;
455 }
456
457 distanceTo(v) {
458 return this.sub(v).length;
459 }
460
461 getLengthSq() {
462 return this.x ** 2 + this.y ** 2;
463 }
464
465 distanceToSq(v) {
466 return this.sub(v).getLengthSq();
467 }
468
469 manhattanDistanceTo(v) {
470 return Math.abs(v.x - this.x) + Math.abs(v.y - this.y);
471 }
472
473 copy() {
474 return Vector.clone(this);
475 }
476
477 setTo(v) {
478 this.x = v.x;
479 this.y = v.y;
480 }
481
482 rotate(angle) {
483 return Vector.create(this.x * Math.cos(angle) - this.y * Math.sin(angle), this.x * Math.sin(angle) + this.y * Math.cos(angle));
484 }
485
486 updateFromAngle(angle, length) {
487 this.x = Math.cos(angle) * length;
488 this.y = Math.sin(angle) * length;
489 }
490
491}
492;// CONCATENATED MODULE: ../../engine/dist/esm/Utils/NumberUtils.js
493
494function clamp(num, min, max) {
495 return Math.min(Math.max(num, min), max);
496}
497function mix(comp1, comp2, weight1, weight2) {
498 return Math.floor((comp1 * weight1 + comp2 * weight2) / (weight1 + weight2));
499}
500function randomInRange(r) {
501 const max = getRangeMax(r);
502 let min = getRangeMin(r);
503
504 if (max === min) {
505 min = 0;
506 }
507
508 return Math.random() * (max - min) + min;
509}
510function getRangeValue(value) {
511 return typeof value === "number" ? value : randomInRange(value);
512}
513function getRangeMin(value) {
514 return typeof value === "number" ? value : value.min;
515}
516function getRangeMax(value) {
517 return typeof value === "number" ? value : value.max;
518}
519function setRangeValue(source, value) {
520 if (source === value || value === undefined && typeof source === "number") {
521 return source;
522 }
523
524 const min = getRangeMin(source),
525 max = getRangeMax(source);
526 return value !== undefined ? {
527 min: Math.min(min, value),
528 max: Math.max(max, value)
529 } : setRangeValue(min, max);
530}
531function getValue(options) {
532 const random = options.random,
533 {
534 enable,
535 minimumValue
536 } = typeof random === "boolean" ? {
537 enable: random,
538 minimumValue: 0
539 } : random;
540 return enable ? getRangeValue(setRangeValue(options.value, minimumValue)) : getRangeValue(options.value);
541}
542function getDistances(pointA, pointB) {
543 const dx = pointA.x - pointB.x,
544 dy = pointA.y - pointB.y;
545 return {
546 dx: dx,
547 dy: dy,
548 distance: Math.sqrt(dx * dx + dy * dy)
549 };
550}
551function getDistance(pointA, pointB) {
552 return getDistances(pointA, pointB).distance;
553}
554function getParticleDirectionAngle(direction, position, center) {
555 if (typeof direction === "number") {
556 return direction * Math.PI / 180;
557 } else {
558 switch (direction) {
559 case "top":
560 return -Math.PI / 2;
561
562 case "top-right":
563 return -Math.PI / 4;
564
565 case "right":
566 return 0;
567
568 case "bottom-right":
569 return Math.PI / 4;
570
571 case "bottom":
572 return Math.PI / 2;
573
574 case "bottom-left":
575 return 3 * Math.PI / 4;
576
577 case "left":
578 return Math.PI;
579
580 case "top-left":
581 return -3 * Math.PI / 4;
582
583 case "inside":
584 return Math.atan2(center.y - position.y, center.x - position.x);
585
586 case "outside":
587 return Math.atan2(position.y - center.y, position.x - center.x);
588
589 case "none":
590 default:
591 return Math.random() * Math.PI * 2;
592 }
593 }
594}
595function getParticleBaseVelocity(direction) {
596 const baseVelocity = Vector.origin;
597 baseVelocity.length = 1;
598 baseVelocity.angle = direction;
599 return baseVelocity;
600}
601function collisionVelocity(v1, v2, m1, m2) {
602 return Vector.create(v1.x * (m1 - m2) / (m1 + m2) + v2.x * 2 * m2 / (m1 + m2), v1.y);
603}
604function calcEasing(value, type) {
605 switch (type) {
606 case "ease-out-quad":
607 return 1 - (1 - value) ** 2;
608
609 case "ease-out-cubic":
610 return 1 - (1 - value) ** 3;
611
612 case "ease-out-quart":
613 return 1 - (1 - value) ** 4;
614
615 case "ease-out-quint":
616 return 1 - (1 - value) ** 5;
617
618 case "ease-out-expo":
619 return value === 1 ? 1 : 1 - Math.pow(2, -10 * value);
620
621 case "ease-out-sine":
622 return Math.sin(value * Math.PI / 2);
623
624 case "ease-out-back":
625 {
626 const c1 = 1.70158,
627 c3 = c1 + 1;
628 return 1 + c3 * Math.pow(value - 1, 3) + c1 * Math.pow(value - 1, 2);
629 }
630
631 case "ease-out-circ":
632 return Math.sqrt(1 - Math.pow(value - 1, 2));
633
634 default:
635 return value;
636 }
637}
638function calcPositionFromSize(data) {
639 var _a, _b;
640
641 return ((_a = data.position) === null || _a === void 0 ? void 0 : _a.x) !== undefined && ((_b = data.position) === null || _b === void 0 ? void 0 : _b.y) !== undefined ? {
642 x: data.position.x * data.size.width / 100,
643 y: data.position.y * data.size.height / 100
644 } : undefined;
645}
646function calcPositionOrRandomFromSize(data) {
647 var _a, _b, _c, _d;
648
649 return {
650 x: ((_b = (_a = data.position) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : Math.random() * 100) * data.size.width / 100,
651 y: ((_d = (_c = data.position) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : Math.random() * 100) * data.size.height / 100
652 };
653}
654function calcPositionOrRandomFromSizeRanged(data) {
655 var _a, _b;
656
657 const position = {
658 x: ((_a = data.position) === null || _a === void 0 ? void 0 : _a.x) !== undefined ? getRangeValue(data.position.x) : undefined,
659 y: ((_b = data.position) === null || _b === void 0 ? void 0 : _b.y) !== undefined ? getRangeValue(data.position.y) : undefined
660 };
661 return calcPositionOrRandomFromSize({
662 size: data.size,
663 position
664 });
665}
666function calcExactPositionOrRandomFromSize(data) {
667 var _a, _b, _c, _d;
668
669 return {
670 x: (_b = (_a = data.position) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : Math.random() * data.size.width,
671 y: (_d = (_c = data.position) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : Math.random() * data.size.height
672 };
673}
674function calcExactPositionOrRandomFromSizeRanged(data) {
675 var _a, _b;
676
677 const position = {
678 x: ((_a = data.position) === null || _a === void 0 ? void 0 : _a.x) !== undefined ? getRangeValue(data.position.x) : undefined,
679 y: ((_b = data.position) === null || _b === void 0 ? void 0 : _b.y) !== undefined ? getRangeValue(data.position.y) : undefined
680 };
681 return calcExactPositionOrRandomFromSize({
682 size: data.size,
683 position
684 });
685}
686;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/OptionsColor.js
687class OptionsColor {
688 constructor() {
689 this.value = "";
690 }
691
692 static create(source, data) {
693 const color = new OptionsColor();
694 color.load(source);
695
696 if (data !== undefined) {
697 if (typeof data === "string" || data instanceof Array) {
698 color.load({
699 value: data
700 });
701 } else {
702 color.load(data);
703 }
704 }
705
706 return color;
707 }
708
709 load(data) {
710 if ((data === null || data === void 0 ? void 0 : data.value) === undefined) {
711 return;
712 }
713
714 this.value = data.value;
715 }
716
717}
718;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Background/Background.js
719
720class Background {
721 constructor() {
722 this.color = new OptionsColor();
723 this.color.value = "";
724 this.image = "";
725 this.position = "";
726 this.repeat = "";
727 this.size = "";
728 this.opacity = 1;
729 }
730
731 load(data) {
732 if (!data) {
733 return;
734 }
735
736 if (data.color !== undefined) {
737 this.color = OptionsColor.create(this.color, data.color);
738 }
739
740 if (data.image !== undefined) {
741 this.image = data.image;
742 }
743
744 if (data.position !== undefined) {
745 this.position = data.position;
746 }
747
748 if (data.repeat !== undefined) {
749 this.repeat = data.repeat;
750 }
751
752 if (data.size !== undefined) {
753 this.size = data.size;
754 }
755
756 if (data.opacity !== undefined) {
757 this.opacity = data.opacity;
758 }
759 }
760
761}
762;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/BackgroundMask/BackgroundMaskCover.js
763
764class BackgroundMaskCover {
765 constructor() {
766 this.color = new OptionsColor();
767 this.color.value = "#fff";
768 this.opacity = 1;
769 }
770
771 load(data) {
772 if (!data) {
773 return;
774 }
775
776 if (data.color !== undefined) {
777 this.color = OptionsColor.create(this.color, data.color);
778 }
779
780 if (data.opacity !== undefined) {
781 this.opacity = data.opacity;
782 }
783 }
784
785}
786;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/BackgroundMask/BackgroundMask.js
787
788class BackgroundMask {
789 constructor() {
790 this.composite = "destination-out";
791 this.cover = new BackgroundMaskCover();
792 this.enable = false;
793 }
794
795 load(data) {
796 if (!data) {
797 return;
798 }
799
800 if (data.composite !== undefined) {
801 this.composite = data.composite;
802 }
803
804 if (data.cover !== undefined) {
805 const cover = data.cover;
806 const color = typeof data.cover === "string" ? {
807 color: data.cover
808 } : data.cover;
809 this.cover.load(cover.color !== undefined ? cover : {
810 color: color
811 });
812 }
813
814 if (data.enable !== undefined) {
815 this.enable = data.enable;
816 }
817 }
818
819}
820;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/FullScreen/FullScreen.js
821class FullScreen {
822 constructor() {
823 this.enable = true;
824 this.zIndex = 0;
825 }
826
827 load(data) {
828 if (!data) {
829 return;
830 }
831
832 if (data.enable !== undefined) {
833 this.enable = data.enable;
834 }
835
836 if (data.zIndex !== undefined) {
837 this.zIndex = data.zIndex;
838 }
839 }
840
841}
842;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Interactivity/Events/ClickEvent.js
843class ClickEvent {
844 constructor() {
845 this.enable = false;
846 this.mode = [];
847 }
848
849 load(data) {
850 if (!data) {
851 return;
852 }
853
854 if (data.enable !== undefined) {
855 this.enable = data.enable;
856 }
857
858 if (data.mode !== undefined) {
859 this.mode = data.mode;
860 }
861 }
862
863}
864;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Interactivity/Events/DivEvent.js
865class DivEvent {
866 constructor() {
867 this.selectors = [];
868 this.enable = false;
869 this.mode = [];
870 this.type = "circle";
871 }
872
873 get elementId() {
874 return this.ids;
875 }
876
877 set elementId(value) {
878 this.ids = value;
879 }
880
881 get el() {
882 return this.elementId;
883 }
884
885 set el(value) {
886 this.elementId = value;
887 }
888
889 get ids() {
890 return this.selectors instanceof Array ? this.selectors.map(t => t.replace("#", "")) : this.selectors.replace("#", "");
891 }
892
893 set ids(value) {
894 this.selectors = value instanceof Array ? value.map(t => `#${t}`) : `#${value}`;
895 }
896
897 load(data) {
898 var _a, _b;
899
900 if (!data) {
901 return;
902 }
903
904 const ids = (_b = (_a = data.ids) !== null && _a !== void 0 ? _a : data.elementId) !== null && _b !== void 0 ? _b : data.el;
905
906 if (ids !== undefined) {
907 this.ids = ids;
908 }
909
910 if (data.selectors !== undefined) {
911 this.selectors = data.selectors;
912 }
913
914 if (data.enable !== undefined) {
915 this.enable = data.enable;
916 }
917
918 if (data.mode !== undefined) {
919 this.mode = data.mode;
920 }
921
922 if (data.type !== undefined) {
923 this.type = data.type;
924 }
925 }
926
927}
928;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Interactivity/Events/Parallax.js
929class Parallax {
930 constructor() {
931 this.enable = false;
932 this.force = 2;
933 this.smooth = 10;
934 }
935
936 load(data) {
937 if (!data) {
938 return;
939 }
940
941 if (data.enable !== undefined) {
942 this.enable = data.enable;
943 }
944
945 if (data.force !== undefined) {
946 this.force = data.force;
947 }
948
949 if (data.smooth !== undefined) {
950 this.smooth = data.smooth;
951 }
952 }
953
954}
955;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Interactivity/Events/HoverEvent.js
956
957class HoverEvent {
958 constructor() {
959 this.enable = false;
960 this.mode = [];
961 this.parallax = new Parallax();
962 }
963
964 load(data) {
965 if (!data) {
966 return;
967 }
968
969 if (data.enable !== undefined) {
970 this.enable = data.enable;
971 }
972
973 if (data.mode !== undefined) {
974 this.mode = data.mode;
975 }
976
977 this.parallax.load(data.parallax);
978 }
979
980}
981;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Interactivity/Events/Events.js
982
983
984
985class Events {
986 constructor() {
987 this.onClick = new ClickEvent();
988 this.onDiv = new DivEvent();
989 this.onHover = new HoverEvent();
990 this.resize = true;
991 }
992
993 get onclick() {
994 return this.onClick;
995 }
996
997 set onclick(value) {
998 this.onClick = value;
999 }
1000
1001 get ondiv() {
1002 return this.onDiv;
1003 }
1004
1005 set ondiv(value) {
1006 this.onDiv = value;
1007 }
1008
1009 get onhover() {
1010 return this.onHover;
1011 }
1012
1013 set onhover(value) {
1014 this.onHover = value;
1015 }
1016
1017 load(data) {
1018 var _a, _b, _c;
1019
1020 if (!data) {
1021 return;
1022 }
1023
1024 this.onClick.load((_a = data.onClick) !== null && _a !== void 0 ? _a : data.onclick);
1025 const onDiv = (_b = data.onDiv) !== null && _b !== void 0 ? _b : data.ondiv;
1026
1027 if (onDiv !== undefined) {
1028 if (onDiv instanceof Array) {
1029 this.onDiv = onDiv.map(div => {
1030 const tmp = new DivEvent();
1031 tmp.load(div);
1032 return tmp;
1033 });
1034 } else {
1035 this.onDiv = new DivEvent();
1036 this.onDiv.load(onDiv);
1037 }
1038 }
1039
1040 this.onHover.load((_c = data.onHover) !== null && _c !== void 0 ? _c : data.onhover);
1041
1042 if (data.resize !== undefined) {
1043 this.resize = data.resize;
1044 }
1045 }
1046
1047}
1048;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Interactivity/Modes/Attract.js
1049class Attract {
1050 constructor() {
1051 this.distance = 200;
1052 this.duration = 0.4;
1053 this.easing = "ease-out-quad";
1054 this.factor = 1;
1055 this.maxSpeed = 50;
1056 this.speed = 1;
1057 }
1058
1059 load(data) {
1060 if (!data) {
1061 return;
1062 }
1063
1064 if (data.distance !== undefined) {
1065 this.distance = data.distance;
1066 }
1067
1068 if (data.duration !== undefined) {
1069 this.duration = data.duration;
1070 }
1071
1072 if (data.easing !== undefined) {
1073 this.easing = data.easing;
1074 }
1075
1076 if (data.factor !== undefined) {
1077 this.factor = data.factor;
1078 }
1079
1080 if (data.maxSpeed !== undefined) {
1081 this.maxSpeed = data.maxSpeed;
1082 }
1083
1084 if (data.speed !== undefined) {
1085 this.speed = data.speed;
1086 }
1087 }
1088
1089}
1090;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Interactivity/Modes/Bounce.js
1091class Bounce {
1092 constructor() {
1093 this.distance = 200;
1094 }
1095
1096 load(data) {
1097 if (!data) {
1098 return;
1099 }
1100
1101 if (data.distance !== undefined) {
1102 this.distance = data.distance;
1103 }
1104 }
1105
1106}
1107;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Interactivity/Modes/BubbleBase.js
1108
1109class BubbleBase {
1110 constructor() {
1111 this.distance = 200;
1112 this.duration = 0.4;
1113 this.mix = false;
1114 }
1115
1116 load(data) {
1117 if (!data) {
1118 return;
1119 }
1120
1121 if (data.distance !== undefined) {
1122 this.distance = data.distance;
1123 }
1124
1125 if (data.duration !== undefined) {
1126 this.duration = data.duration;
1127 }
1128
1129 if (data.mix !== undefined) {
1130 this.mix = data.mix;
1131 }
1132
1133 if (data.opacity !== undefined) {
1134 this.opacity = data.opacity;
1135 }
1136
1137 if (data.color !== undefined) {
1138 if (data.color instanceof Array) {
1139 this.color = data.color.map(s => OptionsColor.create(undefined, s));
1140 } else {
1141 if (this.color instanceof Array) {
1142 this.color = new OptionsColor();
1143 }
1144
1145 this.color = OptionsColor.create(this.color, data.color);
1146 }
1147 }
1148
1149 if (data.size !== undefined) {
1150 this.size = data.size;
1151 }
1152 }
1153
1154}
1155;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Interactivity/Modes/BubbleDiv.js
1156
1157class BubbleDiv extends BubbleBase {
1158 constructor() {
1159 super();
1160 this.selectors = [];
1161 }
1162
1163 get ids() {
1164 return this.selectors instanceof Array ? this.selectors.map(t => t.replace("#", "")) : this.selectors.replace("#", "");
1165 }
1166
1167 set ids(value) {
1168 this.selectors = value instanceof Array ? value.map(t => `#${t}`) : `#${value}`;
1169 }
1170
1171 load(data) {
1172 super.load(data);
1173
1174 if (!data) {
1175 return;
1176 }
1177
1178 if (data.ids !== undefined) {
1179 this.ids = data.ids;
1180 }
1181
1182 if (data.selectors !== undefined) {
1183 this.selectors = data.selectors;
1184 }
1185 }
1186
1187}
1188;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Interactivity/Modes/Bubble.js
1189
1190
1191class Bubble extends BubbleBase {
1192 load(data) {
1193 super.load(data);
1194
1195 if (!data) {
1196 return;
1197 }
1198
1199 if (data.divs instanceof Array) {
1200 this.divs = data.divs.map(s => {
1201 const tmp = new BubbleDiv();
1202 tmp.load(s);
1203 return tmp;
1204 });
1205 } else {
1206 if (this.divs instanceof Array || !this.divs) {
1207 this.divs = new BubbleDiv();
1208 }
1209
1210 this.divs.load(data.divs);
1211 }
1212 }
1213
1214}
1215;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Interactivity/Modes/ConnectLinks.js
1216class ConnectLinks {
1217 constructor() {
1218 this.opacity = 0.5;
1219 }
1220
1221 load(data) {
1222 if (!(data !== undefined && data.opacity !== undefined)) {
1223 return;
1224 }
1225
1226 if (data.opacity !== undefined) {
1227 this.opacity = data.opacity;
1228 }
1229 }
1230
1231}
1232;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Interactivity/Modes/Connect.js
1233
1234class Connect {
1235 constructor() {
1236 this.distance = 80;
1237 this.links = new ConnectLinks();
1238 this.radius = 60;
1239 }
1240
1241 get line_linked() {
1242 return this.links;
1243 }
1244
1245 set line_linked(value) {
1246 this.links = value;
1247 }
1248
1249 get lineLinked() {
1250 return this.links;
1251 }
1252
1253 set lineLinked(value) {
1254 this.links = value;
1255 }
1256
1257 load(data) {
1258 var _a, _b;
1259
1260 if (!data) {
1261 return;
1262 }
1263
1264 if (data.distance !== undefined) {
1265 this.distance = data.distance;
1266 }
1267
1268 this.links.load((_b = (_a = data.links) !== null && _a !== void 0 ? _a : data.lineLinked) !== null && _b !== void 0 ? _b : data.line_linked);
1269
1270 if (data.radius !== undefined) {
1271 this.radius = data.radius;
1272 }
1273 }
1274
1275}
1276;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Interactivity/Modes/GrabLinks.js
1277
1278class GrabLinks {
1279 constructor() {
1280 this.blink = false;
1281 this.consent = false;
1282 this.opacity = 1;
1283 }
1284
1285 load(data) {
1286 if (!data) {
1287 return;
1288 }
1289
1290 if (data.blink !== undefined) {
1291 this.blink = data.blink;
1292 }
1293
1294 if (data.color !== undefined) {
1295 this.color = OptionsColor.create(this.color, data.color);
1296 }
1297
1298 if (data.consent !== undefined) {
1299 this.consent = data.consent;
1300 }
1301
1302 if (data.opacity !== undefined) {
1303 this.opacity = data.opacity;
1304 }
1305 }
1306
1307}
1308;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Interactivity/Modes/Grab.js
1309
1310class Grab {
1311 constructor() {
1312 this.distance = 100;
1313 this.links = new GrabLinks();
1314 }
1315
1316 get line_linked() {
1317 return this.links;
1318 }
1319
1320 set line_linked(value) {
1321 this.links = value;
1322 }
1323
1324 get lineLinked() {
1325 return this.links;
1326 }
1327
1328 set lineLinked(value) {
1329 this.links = value;
1330 }
1331
1332 load(data) {
1333 var _a, _b;
1334
1335 if (!data) {
1336 return;
1337 }
1338
1339 if (data.distance !== undefined) {
1340 this.distance = data.distance;
1341 }
1342
1343 this.links.load((_b = (_a = data.links) !== null && _a !== void 0 ? _a : data.lineLinked) !== null && _b !== void 0 ? _b : data.line_linked);
1344 }
1345
1346}
1347;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Interactivity/Modes/LightGradient.js
1348
1349class LightGradient {
1350 constructor() {
1351 this.start = new OptionsColor();
1352 this.stop = new OptionsColor();
1353 this.start.value = "#ffffff";
1354 this.stop.value = "#000000";
1355 }
1356
1357 load(data) {
1358 if (!data) {
1359 return;
1360 }
1361
1362 this.start = OptionsColor.create(this.start, data.start);
1363 this.stop = OptionsColor.create(this.stop, data.stop);
1364 }
1365
1366}
1367;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Interactivity/Modes/LightArea.js
1368
1369class LightArea {
1370 constructor() {
1371 this.gradient = new LightGradient();
1372 this.radius = 1000;
1373 }
1374
1375 load(data) {
1376 if (!data) {
1377 return;
1378 }
1379
1380 this.gradient.load(data.gradient);
1381
1382 if (data.radius !== undefined) {
1383 this.radius = data.radius;
1384 }
1385 }
1386
1387}
1388;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Interactivity/Modes/LightShadow.js
1389
1390class LightShadow {
1391 constructor() {
1392 this.color = new OptionsColor();
1393 this.color.value = "#000000";
1394 this.length = 2000;
1395 }
1396
1397 load(data) {
1398 if (!data) {
1399 return;
1400 }
1401
1402 this.color = OptionsColor.create(this.color, data.color);
1403
1404 if (data.length !== undefined) {
1405 this.length = data.length;
1406 }
1407 }
1408
1409}
1410;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Interactivity/Modes/Light.js
1411
1412
1413class Light {
1414 constructor() {
1415 this.area = new LightArea();
1416 this.shadow = new LightShadow();
1417 }
1418
1419 load(data) {
1420 if (!data) {
1421 return;
1422 }
1423
1424 this.area.load(data.area);
1425 this.shadow.load(data.shadow);
1426 }
1427
1428}
1429;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Interactivity/Modes/Push.js
1430class Push {
1431 constructor() {
1432 this.default = true;
1433 this.groups = [];
1434 this.quantity = 4;
1435 }
1436
1437 get particles_nb() {
1438 return this.quantity;
1439 }
1440
1441 set particles_nb(value) {
1442 this.quantity = value;
1443 }
1444
1445 load(data) {
1446 var _a;
1447
1448 if (!data) {
1449 return;
1450 }
1451
1452 if (data.default !== undefined) {
1453 this.default = data.default;
1454 }
1455
1456 if (data.groups !== undefined) {
1457 this.groups = data.groups.map(t => t);
1458 }
1459
1460 if (!this.groups.length) {
1461 this.default = true;
1462 }
1463
1464 const quantity = (_a = data.quantity) !== null && _a !== void 0 ? _a : data.particles_nb;
1465
1466 if (quantity !== undefined) {
1467 this.quantity = quantity;
1468 }
1469 }
1470
1471}
1472;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Interactivity/Modes/Remove.js
1473class Remove {
1474 constructor() {
1475 this.quantity = 2;
1476 }
1477
1478 get particles_nb() {
1479 return this.quantity;
1480 }
1481
1482 set particles_nb(value) {
1483 this.quantity = value;
1484 }
1485
1486 load(data) {
1487 var _a;
1488
1489 if (!data) {
1490 return;
1491 }
1492
1493 const quantity = (_a = data.quantity) !== null && _a !== void 0 ? _a : data.particles_nb;
1494
1495 if (quantity !== undefined) {
1496 this.quantity = quantity;
1497 }
1498 }
1499
1500}
1501;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Interactivity/Modes/RepulseBase.js
1502class RepulseBase {
1503 constructor() {
1504 this.distance = 200;
1505 this.duration = 0.4;
1506 this.factor = 100;
1507 this.speed = 1;
1508 this.maxSpeed = 50;
1509 this.easing = "ease-out-quad";
1510 }
1511
1512 load(data) {
1513 if (!data) {
1514 return;
1515 }
1516
1517 if (data.distance !== undefined) {
1518 this.distance = data.distance;
1519 }
1520
1521 if (data.duration !== undefined) {
1522 this.duration = data.duration;
1523 }
1524
1525 if (data.easing !== undefined) {
1526 this.easing = data.easing;
1527 }
1528
1529 if (data.factor !== undefined) {
1530 this.factor = data.factor;
1531 }
1532
1533 if (data.speed !== undefined) {
1534 this.speed = data.speed;
1535 }
1536
1537 if (data.maxSpeed !== undefined) {
1538 this.maxSpeed = data.maxSpeed;
1539 }
1540 }
1541
1542}
1543;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Interactivity/Modes/RepulseDiv.js
1544
1545class RepulseDiv extends RepulseBase {
1546 constructor() {
1547 super();
1548 this.selectors = [];
1549 }
1550
1551 get ids() {
1552 if (this.selectors instanceof Array) {
1553 return this.selectors.map(t => t.replace("#", ""));
1554 } else {
1555 return this.selectors.replace("#", "");
1556 }
1557 }
1558
1559 set ids(value) {
1560 if (value instanceof Array) {
1561 this.selectors = value.map(() => `#${value}`);
1562 } else {
1563 this.selectors = `#${value}`;
1564 }
1565 }
1566
1567 load(data) {
1568 super.load(data);
1569
1570 if (!data) {
1571 return;
1572 }
1573
1574 if (data.ids !== undefined) {
1575 this.ids = data.ids;
1576 }
1577
1578 if (data.selectors !== undefined) {
1579 this.selectors = data.selectors;
1580 }
1581 }
1582
1583}
1584;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Interactivity/Modes/Repulse.js
1585
1586
1587class Repulse extends RepulseBase {
1588 load(data) {
1589 super.load(data);
1590
1591 if (!data) {
1592 return;
1593 }
1594
1595 if (data.divs instanceof Array) {
1596 this.divs = data.divs.map(s => {
1597 const tmp = new RepulseDiv();
1598 tmp.load(s);
1599 return tmp;
1600 });
1601 } else {
1602 if (this.divs instanceof Array || !this.divs) {
1603 this.divs = new RepulseDiv();
1604 }
1605
1606 this.divs.load(data.divs);
1607 }
1608 }
1609
1610}
1611;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Interactivity/Modes/Slow.js
1612class Slow {
1613 constructor() {
1614 this.factor = 3;
1615 this.radius = 200;
1616 }
1617
1618 get active() {
1619 return false;
1620 }
1621
1622 set active(_value) {}
1623
1624 load(data) {
1625 if (!data) {
1626 return;
1627 }
1628
1629 if (data.factor !== undefined) {
1630 this.factor = data.factor;
1631 }
1632
1633 if (data.radius !== undefined) {
1634 this.radius = data.radius;
1635 }
1636 }
1637
1638}
1639;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Interactivity/Modes/Trail.js
1640
1641class Trail {
1642 constructor() {
1643 this.delay = 1;
1644 this.pauseOnStop = false;
1645 this.quantity = 1;
1646 }
1647
1648 load(data) {
1649 if (!data) {
1650 return;
1651 }
1652
1653 if (data.delay !== undefined) {
1654 this.delay = data.delay;
1655 }
1656
1657 if (data.quantity !== undefined) {
1658 this.quantity = data.quantity;
1659 }
1660
1661 if (data.particles !== undefined) {
1662 this.particles = deepExtend({}, data.particles);
1663 }
1664
1665 if (data.pauseOnStop !== undefined) {
1666 this.pauseOnStop = data.pauseOnStop;
1667 }
1668 }
1669
1670}
1671;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Interactivity/Modes/Modes.js
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683class Modes {
1684 constructor() {
1685 this.attract = new Attract();
1686 this.bounce = new Bounce();
1687 this.bubble = new Bubble();
1688 this.connect = new Connect();
1689 this.grab = new Grab();
1690 this.light = new Light();
1691 this.push = new Push();
1692 this.remove = new Remove();
1693 this.repulse = new Repulse();
1694 this.slow = new Slow();
1695 this.trail = new Trail();
1696 }
1697
1698 load(data) {
1699 if (!data) {
1700 return;
1701 }
1702
1703 this.attract.load(data.attract);
1704 this.bubble.load(data.bubble);
1705 this.connect.load(data.connect);
1706 this.grab.load(data.grab);
1707 this.light.load(data.light);
1708 this.push.load(data.push);
1709 this.remove.load(data.remove);
1710 this.repulse.load(data.repulse);
1711 this.slow.load(data.slow);
1712 this.trail.load(data.trail);
1713 }
1714
1715}
1716;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Interactivity/Interactivity.js
1717
1718
1719class Interactivity {
1720 constructor() {
1721 this.detectsOn = "window";
1722 this.events = new Events();
1723 this.modes = new Modes();
1724 }
1725
1726 get detect_on() {
1727 return this.detectsOn;
1728 }
1729
1730 set detect_on(value) {
1731 this.detectsOn = value;
1732 }
1733
1734 load(data) {
1735 var _a, _b, _c;
1736
1737 if (!data) {
1738 return;
1739 }
1740
1741 const detectsOn = (_a = data.detectsOn) !== null && _a !== void 0 ? _a : data.detect_on;
1742
1743 if (detectsOn !== undefined) {
1744 this.detectsOn = detectsOn;
1745 }
1746
1747 this.events.load(data.events);
1748 this.modes.load(data.modes);
1749
1750 if (((_c = (_b = data.modes) === null || _b === void 0 ? void 0 : _b.slow) === null || _c === void 0 ? void 0 : _c.active) === true) {
1751 if (this.events.onHover.mode instanceof Array) {
1752 if (this.events.onHover.mode.indexOf("slow") < 0) {
1753 this.events.onHover.mode.push("slow");
1754 }
1755 } else if (this.events.onHover.mode !== "slow") {
1756 this.events.onHover.mode = [this.events.onHover.mode, "slow"];
1757 }
1758 }
1759 }
1760
1761}
1762;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/ManualParticle.js
1763
1764class ManualParticle {
1765 load(data) {
1766 var _a, _b;
1767
1768 if (!data) {
1769 return;
1770 }
1771
1772 if (data.position !== undefined) {
1773 this.position = {
1774 x: (_a = data.position.x) !== null && _a !== void 0 ? _a : 50,
1775 y: (_b = data.position.y) !== null && _b !== void 0 ? _b : 50
1776 };
1777 }
1778
1779 if (data.options !== undefined) {
1780 this.options = deepExtend({}, data.options);
1781 }
1782 }
1783
1784}
1785;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Motion/MotionReduce.js
1786class MotionReduce {
1787 constructor() {
1788 this.factor = 4;
1789 this.value = true;
1790 }
1791
1792 load(data) {
1793 if (!data) {
1794 return;
1795 }
1796
1797 if (data.factor !== undefined) {
1798 this.factor = data.factor;
1799 }
1800
1801 if (data.value !== undefined) {
1802 this.value = data.value;
1803 }
1804 }
1805
1806}
1807;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Motion/Motion.js
1808
1809class Motion {
1810 constructor() {
1811 this.disable = false;
1812 this.reduce = new MotionReduce();
1813 }
1814
1815 load(data) {
1816 if (!data) {
1817 return;
1818 }
1819
1820 if (data.disable !== undefined) {
1821 this.disable = data.disable;
1822 }
1823
1824 this.reduce.load(data.reduce);
1825 }
1826
1827}
1828;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Responsive.js
1829
1830class Responsive {
1831 constructor() {
1832 this.maxWidth = Infinity;
1833 this.options = {};
1834 this.mode = "canvas";
1835 }
1836
1837 load(data) {
1838 if (!data) {
1839 return;
1840 }
1841
1842 if (data.maxWidth !== undefined) {
1843 this.maxWidth = data.maxWidth;
1844 }
1845
1846 if (data.mode !== undefined) {
1847 if (data.mode === "screen") {
1848 this.mode = "screen";
1849 } else {
1850 this.mode = "canvas";
1851 }
1852 }
1853
1854 if (data.options !== undefined) {
1855 this.options = deepExtend({}, data.options);
1856 }
1857 }
1858
1859}
1860;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Theme/ThemeDefault.js
1861class ThemeDefault {
1862 constructor() {
1863 this.auto = false;
1864 this.mode = "any";
1865 this.value = false;
1866 }
1867
1868 load(data) {
1869 if (!data) {
1870 return;
1871 }
1872
1873 if (data.auto !== undefined) {
1874 this.auto = data.auto;
1875 }
1876
1877 if (data.mode !== undefined) {
1878 this.mode = data.mode;
1879 }
1880
1881 if (data.value !== undefined) {
1882 this.value = data.value;
1883 }
1884 }
1885
1886}
1887;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Theme/Theme.js
1888
1889
1890class Theme {
1891 constructor() {
1892 this.name = "";
1893 this.default = new ThemeDefault();
1894 }
1895
1896 load(data) {
1897 if (!data) {
1898 return;
1899 }
1900
1901 if (data.name !== undefined) {
1902 this.name = data.name;
1903 }
1904
1905 this.default.load(data.default);
1906
1907 if (data.options !== undefined) {
1908 this.options = deepExtend({}, data.options);
1909 }
1910 }
1911
1912}
1913;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Options.js
1914var Options_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function (receiver, state, value, kind, f) {
1915 if (kind === "m") throw new TypeError("Private method is not writable");
1916 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
1917 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
1918 return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
1919};
1920
1921var Options_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function (receiver, state, kind, f) {
1922 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
1923 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
1924 return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
1925};
1926
1927var _Options_instances, _Options_engine, _Options_findDefaultTheme;
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938class Options {
1939 constructor(engine) {
1940 _Options_instances.add(this);
1941
1942 _Options_engine.set(this, void 0);
1943
1944 Options_classPrivateFieldSet(this, _Options_engine, engine, "f");
1945
1946 this.autoPlay = true;
1947 this.background = new Background();
1948 this.backgroundMask = new BackgroundMask();
1949 this.fullScreen = new FullScreen();
1950 this.detectRetina = true;
1951 this.duration = 0;
1952 this.fpsLimit = 120;
1953 this.interactivity = new Interactivity();
1954 this.manualParticles = [];
1955 this.motion = new Motion();
1956 this.particles = loadParticlesOptions();
1957 this.pauseOnBlur = true;
1958 this.pauseOnOutsideViewport = true;
1959 this.responsive = [];
1960 this.style = {};
1961 this.themes = [];
1962 this.zLayers = 100;
1963 }
1964
1965 get fps_limit() {
1966 return this.fpsLimit;
1967 }
1968
1969 set fps_limit(value) {
1970 this.fpsLimit = value;
1971 }
1972
1973 get retina_detect() {
1974 return this.detectRetina;
1975 }
1976
1977 set retina_detect(value) {
1978 this.detectRetina = value;
1979 }
1980
1981 get backgroundMode() {
1982 return this.fullScreen;
1983 }
1984
1985 set backgroundMode(value) {
1986 this.fullScreen.load(value);
1987 }
1988
1989 load(data) {
1990 var _a, _b, _c, _d, _e;
1991
1992 if (!data) {
1993 return;
1994 }
1995
1996 if (data.preset !== undefined) {
1997 if (data.preset instanceof Array) {
1998 for (const preset of data.preset) {
1999 this.importPreset(preset);
2000 }
2001 } else {
2002 this.importPreset(data.preset);
2003 }
2004 }
2005
2006 if (data.autoPlay !== undefined) {
2007 this.autoPlay = data.autoPlay;
2008 }
2009
2010 const detectRetina = (_a = data.detectRetina) !== null && _a !== void 0 ? _a : data.retina_detect;
2011
2012 if (detectRetina !== undefined) {
2013 this.detectRetina = detectRetina;
2014 }
2015
2016 if (data.duration !== undefined) {
2017 this.duration = data.duration;
2018 }
2019
2020 const fpsLimit = (_b = data.fpsLimit) !== null && _b !== void 0 ? _b : data.fps_limit;
2021
2022 if (fpsLimit !== undefined) {
2023 this.fpsLimit = fpsLimit;
2024 }
2025
2026 if (data.pauseOnBlur !== undefined) {
2027 this.pauseOnBlur = data.pauseOnBlur;
2028 }
2029
2030 if (data.pauseOnOutsideViewport !== undefined) {
2031 this.pauseOnOutsideViewport = data.pauseOnOutsideViewport;
2032 }
2033
2034 if (data.zLayers !== undefined) {
2035 this.zLayers = data.zLayers;
2036 }
2037
2038 this.background.load(data.background);
2039 const fullScreen = (_c = data.fullScreen) !== null && _c !== void 0 ? _c : data.backgroundMode;
2040
2041 if (typeof fullScreen === "boolean") {
2042 this.fullScreen.enable = fullScreen;
2043 } else {
2044 this.fullScreen.load(fullScreen);
2045 }
2046
2047 this.backgroundMask.load(data.backgroundMask);
2048 this.interactivity.load(data.interactivity);
2049
2050 if (data.manualParticles !== undefined) {
2051 this.manualParticles = data.manualParticles.map(t => {
2052 const tmp = new ManualParticle();
2053 tmp.load(t);
2054 return tmp;
2055 });
2056 }
2057
2058 this.motion.load(data.motion);
2059 this.particles.load(data.particles);
2060 this.style = deepExtend(this.style, data.style);
2061
2062 Options_classPrivateFieldGet(this, _Options_engine, "f").plugins.loadOptions(this, data);
2063
2064 if (data.responsive !== undefined) {
2065 for (const responsive of data.responsive) {
2066 const optResponsive = new Responsive();
2067 optResponsive.load(responsive);
2068 this.responsive.push(optResponsive);
2069 }
2070 }
2071
2072 this.responsive.sort((a, b) => a.maxWidth - b.maxWidth);
2073
2074 if (data.themes !== undefined) {
2075 for (const theme of data.themes) {
2076 const optTheme = new Theme();
2077 optTheme.load(theme);
2078 this.themes.push(optTheme);
2079 }
2080 }
2081
2082 this.defaultDarkTheme = (_d = Options_classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "dark")) === null || _d === void 0 ? void 0 : _d.name;
2083 this.defaultLightTheme = (_e = Options_classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "light")) === null || _e === void 0 ? void 0 : _e.name;
2084 }
2085
2086 setTheme(name) {
2087 if (name) {
2088 const chosenTheme = this.themes.find(theme => theme.name === name);
2089
2090 if (chosenTheme) {
2091 this.load(chosenTheme.options);
2092 }
2093 } else {
2094 const mediaMatch = typeof matchMedia !== "undefined" && matchMedia("(prefers-color-scheme: dark)"),
2095 clientDarkMode = mediaMatch && mediaMatch.matches,
2096 defaultTheme = Options_classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, clientDarkMode ? "dark" : "light");
2097
2098 if (defaultTheme) {
2099 this.load(defaultTheme.options);
2100 }
2101 }
2102 }
2103
2104 setResponsive(width, pxRatio, defaultOptions) {
2105 this.load(defaultOptions);
2106 const responsiveOptions = this.responsive.find(t => t.mode === "screen" && screen ? t.maxWidth * pxRatio > screen.availWidth : t.maxWidth * pxRatio > width);
2107 this.load(responsiveOptions === null || responsiveOptions === void 0 ? void 0 : responsiveOptions.options);
2108 return responsiveOptions === null || responsiveOptions === void 0 ? void 0 : responsiveOptions.maxWidth;
2109 }
2110
2111 importPreset(preset) {
2112 this.load(Options_classPrivateFieldGet(this, _Options_engine, "f").plugins.getPreset(preset));
2113 }
2114
2115}
2116_Options_engine = new WeakMap(), _Options_instances = new WeakSet(), _Options_findDefaultTheme = function _Options_findDefaultTheme(mode) {
2117 var _a;
2118
2119 return (_a = this.themes.find(theme => theme.default.value && theme.default.mode === mode)) !== null && _a !== void 0 ? _a : this.themes.find(theme => theme.default.value && theme.default.mode === "any");
2120};
2121;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/ColorAnimation.js
2122
2123class ColorAnimation {
2124 constructor() {
2125 this.count = 0;
2126 this.enable = false;
2127 this.offset = 0;
2128 this.speed = 1;
2129 this.sync = true;
2130 }
2131
2132 load(data) {
2133 if (!data) {
2134 return;
2135 }
2136
2137 if (data.count !== undefined) {
2138 this.count = setRangeValue(data.count);
2139 }
2140
2141 if (data.enable !== undefined) {
2142 this.enable = data.enable;
2143 }
2144
2145 if (data.offset !== undefined) {
2146 this.offset = setRangeValue(data.offset);
2147 }
2148
2149 if (data.speed !== undefined) {
2150 this.speed = setRangeValue(data.speed);
2151 }
2152
2153 if (data.sync !== undefined) {
2154 this.sync = data.sync;
2155 }
2156 }
2157
2158}
2159;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/HslAnimation.js
2160
2161class HslAnimation {
2162 constructor() {
2163 this.h = new ColorAnimation();
2164 this.s = new ColorAnimation();
2165 this.l = new ColorAnimation();
2166 }
2167
2168 load(data) {
2169 if (!data) {
2170 return;
2171 }
2172
2173 this.h.load(data.h);
2174 this.s.load(data.s);
2175 this.l.load(data.l);
2176 }
2177
2178}
2179;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/AnimatableColor.js
2180
2181
2182class AnimatableColor extends OptionsColor {
2183 constructor() {
2184 super();
2185 this.animation = new HslAnimation();
2186 }
2187
2188 static create(source, data) {
2189 const color = new AnimatableColor();
2190 color.load(source);
2191
2192 if (data !== undefined) {
2193 if (typeof data === "string" || data instanceof Array) {
2194 color.load({
2195 value: data
2196 });
2197 } else {
2198 color.load(data);
2199 }
2200 }
2201
2202 return color;
2203 }
2204
2205 load(data) {
2206 super.load(data);
2207
2208 if (!data) {
2209 return;
2210 }
2211
2212 const colorAnimation = data.animation;
2213
2214 if (colorAnimation !== undefined) {
2215 if (colorAnimation.enable !== undefined) {
2216 this.animation.h.load(colorAnimation);
2217 } else {
2218 this.animation.load(data.animation);
2219 }
2220 }
2221 }
2222
2223}
2224;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/AnimatableGradient.js
2225
2226
2227class AnimatableGradient {
2228 constructor() {
2229 this.angle = new GradientAngle();
2230 this.colors = [];
2231 this.type = "random";
2232 }
2233
2234 load(data) {
2235 if (!data) {
2236 return;
2237 }
2238
2239 this.angle.load(data.angle);
2240
2241 if (data.colors !== undefined) {
2242 this.colors = data.colors.map(s => {
2243 const tmp = new AnimatableGradientColor();
2244 tmp.load(s);
2245 return tmp;
2246 });
2247 }
2248
2249 if (data.type !== undefined) {
2250 this.type = data.type;
2251 }
2252 }
2253
2254}
2255class GradientAngle {
2256 constructor() {
2257 this.value = 0;
2258 this.animation = new GradientAngleAnimation();
2259 this.direction = "clockwise";
2260 }
2261
2262 load(data) {
2263 if (!data) {
2264 return;
2265 }
2266
2267 this.animation.load(data.animation);
2268
2269 if (data.value !== undefined) {
2270 this.value = data.value;
2271 }
2272
2273 if (data.direction !== undefined) {
2274 this.direction = data.direction;
2275 }
2276 }
2277
2278}
2279class GradientColorOpacity {
2280 constructor() {
2281 this.value = 0;
2282 this.animation = new GradientColorOpacityAnimation();
2283 }
2284
2285 load(data) {
2286 if (!data) {
2287 return;
2288 }
2289
2290 this.animation.load(data.animation);
2291
2292 if (data.value !== undefined) {
2293 this.value = setRangeValue(data.value);
2294 }
2295 }
2296
2297}
2298class AnimatableGradientColor {
2299 constructor() {
2300 this.stop = 0;
2301 this.value = new AnimatableColor();
2302 }
2303
2304 load(data) {
2305 if (!data) {
2306 return;
2307 }
2308
2309 if (data.stop !== undefined) {
2310 this.stop = data.stop;
2311 }
2312
2313 this.value = AnimatableColor.create(this.value, data.value);
2314
2315 if (data.opacity !== undefined) {
2316 this.opacity = new GradientColorOpacity();
2317
2318 if (typeof data.opacity === "number") {
2319 this.opacity.value = data.opacity;
2320 } else {
2321 this.opacity.load(data.opacity);
2322 }
2323 }
2324 }
2325
2326}
2327class GradientAngleAnimation {
2328 constructor() {
2329 this.count = 0;
2330 this.enable = false;
2331 this.speed = 0;
2332 this.sync = false;
2333 }
2334
2335 load(data) {
2336 if (!data) {
2337 return;
2338 }
2339
2340 if (data.count !== undefined) {
2341 this.count = setRangeValue(data.count);
2342 }
2343
2344 if (data.enable !== undefined) {
2345 this.enable = data.enable;
2346 }
2347
2348 if (data.speed !== undefined) {
2349 this.speed = setRangeValue(data.speed);
2350 }
2351
2352 if (data.sync !== undefined) {
2353 this.sync = data.sync;
2354 }
2355 }
2356
2357}
2358class GradientColorOpacityAnimation {
2359 constructor() {
2360 this.count = 0;
2361 this.enable = false;
2362 this.speed = 0;
2363 this.sync = false;
2364 this.startValue = "random";
2365 }
2366
2367 load(data) {
2368 if (!data) {
2369 return;
2370 }
2371
2372 if (data.count !== undefined) {
2373 this.count = setRangeValue(data.count);
2374 }
2375
2376 if (data.enable !== undefined) {
2377 this.enable = data.enable;
2378 }
2379
2380 if (data.speed !== undefined) {
2381 this.speed = setRangeValue(data.speed);
2382 }
2383
2384 if (data.sync !== undefined) {
2385 this.sync = data.sync;
2386 }
2387
2388 if (data.startValue !== undefined) {
2389 this.startValue = data.startValue;
2390 }
2391 }
2392
2393}
2394;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Collisions/CollisionsOverlap.js
2395class CollisionsOverlap {
2396 constructor() {
2397 this.enable = true;
2398 this.retries = 0;
2399 }
2400
2401 load(data) {
2402 if (!data) {
2403 return;
2404 }
2405
2406 if (data.enable !== undefined) {
2407 this.enable = data.enable;
2408 }
2409
2410 if (data.retries !== undefined) {
2411 this.retries = data.retries;
2412 }
2413 }
2414
2415}
2416;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Random.js
2417class Random {
2418 constructor() {
2419 this.enable = false;
2420 this.minimumValue = 0;
2421 }
2422
2423 load(data) {
2424 if (!data) {
2425 return;
2426 }
2427
2428 if (data.enable !== undefined) {
2429 this.enable = data.enable;
2430 }
2431
2432 if (data.minimumValue !== undefined) {
2433 this.minimumValue = data.minimumValue;
2434 }
2435 }
2436
2437}
2438;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/ValueWithRandom.js
2439
2440
2441class ValueWithRandom {
2442 constructor() {
2443 this.random = new Random();
2444 this.value = 0;
2445 }
2446
2447 load(data) {
2448 if (!data) {
2449 return;
2450 }
2451
2452 if (typeof data.random === "boolean") {
2453 this.random.enable = data.random;
2454 } else {
2455 this.random.load(data.random);
2456 }
2457
2458 if (data.value !== undefined) {
2459 this.value = setRangeValue(data.value, this.random.enable ? this.random.minimumValue : undefined);
2460 }
2461 }
2462
2463}
2464;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Bounce/ParticlesBounceFactor.js
2465
2466class ParticlesBounceFactor extends ValueWithRandom {
2467 constructor() {
2468 super();
2469 this.random.minimumValue = 0.1;
2470 this.value = 1;
2471 }
2472
2473}
2474;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Bounce/ParticlesBounce.js
2475
2476class ParticlesBounce {
2477 constructor() {
2478 this.horizontal = new ParticlesBounceFactor();
2479 this.vertical = new ParticlesBounceFactor();
2480 }
2481
2482 load(data) {
2483 if (!data) {
2484 return;
2485 }
2486
2487 this.horizontal.load(data.horizontal);
2488 this.vertical.load(data.vertical);
2489 }
2490
2491}
2492;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Collisions/Collisions.js
2493
2494
2495class Collisions {
2496 constructor() {
2497 this.bounce = new ParticlesBounce();
2498 this.enable = false;
2499 this.mode = "bounce";
2500 this.overlap = new CollisionsOverlap();
2501 }
2502
2503 load(data) {
2504 if (!data) {
2505 return;
2506 }
2507
2508 this.bounce.load(data.bounce);
2509
2510 if (data.enable !== undefined) {
2511 this.enable = data.enable;
2512 }
2513
2514 if (data.mode !== undefined) {
2515 this.mode = data.mode;
2516 }
2517
2518 this.overlap.load(data.overlap);
2519 }
2520
2521}
2522;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Destroy/SplitFactor.js
2523
2524class SplitFactor extends ValueWithRandom {
2525 constructor() {
2526 super();
2527 this.value = 3;
2528 }
2529
2530}
2531;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Destroy/SplitRate.js
2532
2533class SplitRate extends ValueWithRandom {
2534 constructor() {
2535 super();
2536 this.value = {
2537 min: 4,
2538 max: 9
2539 };
2540 }
2541
2542}
2543;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Destroy/Split.js
2544
2545
2546
2547class Split {
2548 constructor() {
2549 this.count = 1;
2550 this.factor = new SplitFactor();
2551 this.rate = new SplitRate();
2552 this.sizeOffset = true;
2553 }
2554
2555 load(data) {
2556 if (!data) {
2557 return;
2558 }
2559
2560 if (data.count !== undefined) {
2561 this.count = data.count;
2562 }
2563
2564 this.factor.load(data.factor);
2565 this.rate.load(data.rate);
2566
2567 if (data.particles !== undefined) {
2568 this.particles = deepExtend({}, data.particles);
2569 }
2570
2571 if (data.sizeOffset !== undefined) {
2572 this.sizeOffset = data.sizeOffset;
2573 }
2574 }
2575
2576}
2577;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Destroy/Destroy.js
2578
2579class Destroy {
2580 constructor() {
2581 this.mode = "none";
2582 this.split = new Split();
2583 }
2584
2585 load(data) {
2586 if (!data) {
2587 return;
2588 }
2589
2590 if (data.mode !== undefined) {
2591 this.mode = data.mode;
2592 }
2593
2594 this.split.load(data.split);
2595 }
2596
2597}
2598;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Life/LifeDelay.js
2599
2600class LifeDelay extends ValueWithRandom {
2601 constructor() {
2602 super();
2603 this.sync = false;
2604 }
2605
2606 load(data) {
2607 if (!data) {
2608 return;
2609 }
2610
2611 super.load(data);
2612
2613 if (data.sync !== undefined) {
2614 this.sync = data.sync;
2615 }
2616 }
2617
2618}
2619;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Life/LifeDuration.js
2620
2621class LifeDuration extends ValueWithRandom {
2622 constructor() {
2623 super();
2624 this.random.minimumValue = 0.0001;
2625 this.sync = false;
2626 }
2627
2628 load(data) {
2629 if (!data) {
2630 return;
2631 }
2632
2633 super.load(data);
2634
2635 if (data.sync !== undefined) {
2636 this.sync = data.sync;
2637 }
2638 }
2639
2640}
2641;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Life/Life.js
2642
2643
2644class Life {
2645 constructor() {
2646 this.count = 0;
2647 this.delay = new LifeDelay();
2648 this.duration = new LifeDuration();
2649 }
2650
2651 load(data) {
2652 if (!data) {
2653 return;
2654 }
2655
2656 if (data.count !== undefined) {
2657 this.count = data.count;
2658 }
2659
2660 this.delay.load(data.delay);
2661 this.duration.load(data.duration);
2662 }
2663
2664}
2665;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Links/LinksShadow.js
2666
2667class LinksShadow {
2668 constructor() {
2669 this.blur = 5;
2670 this.color = new OptionsColor();
2671 this.color.value = "#000";
2672 this.enable = false;
2673 }
2674
2675 load(data) {
2676 if (!data) {
2677 return;
2678 }
2679
2680 if (data.blur !== undefined) {
2681 this.blur = data.blur;
2682 }
2683
2684 this.color = OptionsColor.create(this.color, data.color);
2685
2686 if (data.enable !== undefined) {
2687 this.enable = data.enable;
2688 }
2689 }
2690
2691}
2692;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Links/LinksTriangle.js
2693
2694class LinksTriangle {
2695 constructor() {
2696 this.enable = false;
2697 this.frequency = 1;
2698 }
2699
2700 load(data) {
2701 if (!data) {
2702 return;
2703 }
2704
2705 if (data.color !== undefined) {
2706 this.color = OptionsColor.create(this.color, data.color);
2707 }
2708
2709 if (data.enable !== undefined) {
2710 this.enable = data.enable;
2711 }
2712
2713 if (data.frequency !== undefined) {
2714 this.frequency = data.frequency;
2715 }
2716
2717 if (data.opacity !== undefined) {
2718 this.opacity = data.opacity;
2719 }
2720 }
2721
2722}
2723;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Links/Links.js
2724
2725
2726
2727class Links {
2728 constructor() {
2729 this.blink = false;
2730 this.color = new OptionsColor();
2731 this.color.value = "#fff";
2732 this.consent = false;
2733 this.distance = 100;
2734 this.enable = false;
2735 this.frequency = 1;
2736 this.opacity = 1;
2737 this.shadow = new LinksShadow();
2738 this.triangles = new LinksTriangle();
2739 this.width = 1;
2740 this.warp = false;
2741 }
2742
2743 load(data) {
2744 if (!data) {
2745 return;
2746 }
2747
2748 if (data.id !== undefined) {
2749 this.id = data.id;
2750 }
2751
2752 if (data.blink !== undefined) {
2753 this.blink = data.blink;
2754 }
2755
2756 this.color = OptionsColor.create(this.color, data.color);
2757
2758 if (data.consent !== undefined) {
2759 this.consent = data.consent;
2760 }
2761
2762 if (data.distance !== undefined) {
2763 this.distance = data.distance;
2764 }
2765
2766 if (data.enable !== undefined) {
2767 this.enable = data.enable;
2768 }
2769
2770 if (data.frequency !== undefined) {
2771 this.frequency = data.frequency;
2772 }
2773
2774 if (data.opacity !== undefined) {
2775 this.opacity = data.opacity;
2776 }
2777
2778 this.shadow.load(data.shadow);
2779 this.triangles.load(data.triangles);
2780
2781 if (data.width !== undefined) {
2782 this.width = data.width;
2783 }
2784
2785 if (data.warp !== undefined) {
2786 this.warp = data.warp;
2787 }
2788 }
2789
2790}
2791;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Move/MoveAngle.js
2792
2793class MoveAngle {
2794 constructor() {
2795 this.offset = 0;
2796 this.value = 90;
2797 }
2798
2799 load(data) {
2800 if (!data) {
2801 return;
2802 }
2803
2804 if (data.offset !== undefined) {
2805 this.offset = setRangeValue(data.offset);
2806 }
2807
2808 if (data.value !== undefined) {
2809 this.value = setRangeValue(data.value);
2810 }
2811 }
2812
2813}
2814;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Move/MoveAttract.js
2815
2816class MoveAttract {
2817 constructor() {
2818 this.distance = 200;
2819 this.enable = false;
2820 this.rotate = {
2821 x: 3000,
2822 y: 3000
2823 };
2824 }
2825
2826 get rotateX() {
2827 return this.rotate.x;
2828 }
2829
2830 set rotateX(value) {
2831 this.rotate.x = value;
2832 }
2833
2834 get rotateY() {
2835 return this.rotate.y;
2836 }
2837
2838 set rotateY(value) {
2839 this.rotate.y = value;
2840 }
2841
2842 load(data) {
2843 var _a, _b, _c, _d;
2844
2845 if (!data) {
2846 return;
2847 }
2848
2849 if (data.distance !== undefined) {
2850 this.distance = setRangeValue(data.distance);
2851 }
2852
2853 if (data.enable !== undefined) {
2854 this.enable = data.enable;
2855 }
2856
2857 const rotateX = (_b = (_a = data.rotate) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : data.rotateX;
2858
2859 if (rotateX !== undefined) {
2860 this.rotate.x = rotateX;
2861 }
2862
2863 const rotateY = (_d = (_c = data.rotate) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : data.rotateY;
2864
2865 if (rotateY !== undefined) {
2866 this.rotate.y = rotateY;
2867 }
2868 }
2869
2870}
2871;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Move/MoveGravity.js
2872
2873class MoveGravity {
2874 constructor() {
2875 this.acceleration = 9.81;
2876 this.enable = false;
2877 this.inverse = false;
2878 this.maxSpeed = 50;
2879 }
2880
2881 load(data) {
2882 if (!data) {
2883 return;
2884 }
2885
2886 if (data.acceleration !== undefined) {
2887 this.acceleration = setRangeValue(data.acceleration);
2888 }
2889
2890 if (data.enable !== undefined) {
2891 this.enable = data.enable;
2892 }
2893
2894 if (data.inverse !== undefined) {
2895 this.inverse = data.inverse;
2896 }
2897
2898 if (data.maxSpeed !== undefined) {
2899 this.maxSpeed = setRangeValue(data.maxSpeed);
2900 }
2901 }
2902
2903}
2904;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Move/Path/MovePathDelay.js
2905
2906class MovePathDelay extends ValueWithRandom {
2907 constructor() {
2908 super();
2909 }
2910
2911}
2912;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Move/Path/MovePath.js
2913
2914
2915class MovePath {
2916 constructor() {
2917 this.clamp = true;
2918 this.delay = new MovePathDelay();
2919 this.enable = false;
2920 this.options = {};
2921 }
2922
2923 load(data) {
2924 if (!data) {
2925 return;
2926 }
2927
2928 if (data.clamp !== undefined) {
2929 this.clamp = data.clamp;
2930 }
2931
2932 this.delay.load(data.delay);
2933
2934 if (data.enable !== undefined) {
2935 this.enable = data.enable;
2936 }
2937
2938 this.generator = data.generator;
2939
2940 if (data.options) {
2941 this.options = deepExtend(this.options, data.options);
2942 }
2943 }
2944
2945}
2946;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Move/MoveTrail.js
2947
2948class MoveTrail {
2949 constructor() {
2950 this.enable = false;
2951 this.length = 10;
2952 this.fillColor = new OptionsColor();
2953 this.fillColor.value = "#000000";
2954 }
2955
2956 load(data) {
2957 if (!data) {
2958 return;
2959 }
2960
2961 if (data.enable !== undefined) {
2962 this.enable = data.enable;
2963 }
2964
2965 this.fillColor = OptionsColor.create(this.fillColor, data.fillColor);
2966
2967 if (data.length !== undefined) {
2968 this.length = data.length;
2969 }
2970 }
2971
2972}
2973;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Move/OutModes.js
2974class OutModes {
2975 constructor() {
2976 this.default = "out";
2977 }
2978
2979 load(data) {
2980 var _a, _b, _c, _d;
2981
2982 if (!data) {
2983 return;
2984 }
2985
2986 if (data.default !== undefined) {
2987 this.default = data.default;
2988 }
2989
2990 this.bottom = (_a = data.bottom) !== null && _a !== void 0 ? _a : data.default;
2991 this.left = (_b = data.left) !== null && _b !== void 0 ? _b : data.default;
2992 this.right = (_c = data.right) !== null && _c !== void 0 ? _c : data.default;
2993 this.top = (_d = data.top) !== null && _d !== void 0 ? _d : data.default;
2994 }
2995
2996}
2997;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Move/Spin.js
2998
2999
3000class Spin {
3001 constructor() {
3002 this.acceleration = 0;
3003 this.enable = false;
3004 }
3005
3006 load(data) {
3007 if (!data) {
3008 return;
3009 }
3010
3011 if (data.acceleration !== undefined) {
3012 this.acceleration = setRangeValue(data.acceleration);
3013 }
3014
3015 if (data.enable !== undefined) {
3016 this.enable = data.enable;
3017 }
3018
3019 this.position = data.position ? deepExtend({}, data.position) : undefined;
3020 }
3021
3022}
3023;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Move/Move.js
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033class Move {
3034 constructor() {
3035 this.angle = new MoveAngle();
3036 this.attract = new MoveAttract();
3037 this.center = {
3038 x: 50,
3039 y: 50,
3040 radius: 0
3041 };
3042 this.decay = 0;
3043 this.distance = {};
3044 this.direction = "none";
3045 this.drift = 0;
3046 this.enable = false;
3047 this.gravity = new MoveGravity();
3048 this.path = new MovePath();
3049 this.outModes = new OutModes();
3050 this.random = false;
3051 this.size = false;
3052 this.speed = 2;
3053 this.spin = new Spin();
3054 this.straight = false;
3055 this.trail = new MoveTrail();
3056 this.vibrate = false;
3057 this.warp = false;
3058 }
3059
3060 get collisions() {
3061 return false;
3062 }
3063
3064 set collisions(value) {}
3065
3066 get bounce() {
3067 return this.collisions;
3068 }
3069
3070 set bounce(value) {
3071 this.collisions = value;
3072 }
3073
3074 get out_mode() {
3075 return this.outMode;
3076 }
3077
3078 set out_mode(value) {
3079 this.outMode = value;
3080 }
3081
3082 get outMode() {
3083 return this.outModes.default;
3084 }
3085
3086 set outMode(value) {
3087 this.outModes.default = value;
3088 }
3089
3090 get noise() {
3091 return this.path;
3092 }
3093
3094 set noise(value) {
3095 this.path = value;
3096 }
3097
3098 load(data) {
3099 var _a, _b, _c;
3100
3101 if (!data) {
3102 return;
3103 }
3104
3105 if (data.angle !== undefined) {
3106 if (typeof data.angle === "number") {
3107 this.angle.value = data.angle;
3108 } else {
3109 this.angle.load(data.angle);
3110 }
3111 }
3112
3113 this.attract.load(data.attract);
3114 this.center = deepExtend(this.center, data.center);
3115
3116 if (data.decay !== undefined) {
3117 this.decay = data.decay;
3118 }
3119
3120 if (data.direction !== undefined) {
3121 this.direction = data.direction;
3122 }
3123
3124 if (data.distance !== undefined) {
3125 this.distance = typeof data.distance === "number" ? {
3126 horizontal: data.distance,
3127 vertical: data.distance
3128 } : deepExtend({}, data.distance);
3129 }
3130
3131 if (data.drift !== undefined) {
3132 this.drift = setRangeValue(data.drift);
3133 }
3134
3135 if (data.enable !== undefined) {
3136 this.enable = data.enable;
3137 }
3138
3139 this.gravity.load(data.gravity);
3140 const outMode = (_a = data.outMode) !== null && _a !== void 0 ? _a : data.out_mode;
3141
3142 if (data.outModes !== undefined || outMode !== undefined) {
3143 if (typeof data.outModes === "string" || data.outModes === undefined && outMode !== undefined) {
3144 this.outModes.load({
3145 default: (_b = data.outModes) !== null && _b !== void 0 ? _b : outMode
3146 });
3147 } else {
3148 this.outModes.load(data.outModes);
3149 }
3150 }
3151
3152 this.path.load((_c = data.path) !== null && _c !== void 0 ? _c : data.noise);
3153
3154 if (data.random !== undefined) {
3155 this.random = data.random;
3156 }
3157
3158 if (data.size !== undefined) {
3159 this.size = data.size;
3160 }
3161
3162 if (data.speed !== undefined) {
3163 this.speed = setRangeValue(data.speed);
3164 }
3165
3166 this.spin.load(data.spin);
3167
3168 if (data.straight !== undefined) {
3169 this.straight = data.straight;
3170 }
3171
3172 this.trail.load(data.trail);
3173
3174 if (data.vibrate !== undefined) {
3175 this.vibrate = data.vibrate;
3176 }
3177
3178 if (data.warp !== undefined) {
3179 this.warp = data.warp;
3180 }
3181 }
3182
3183}
3184;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/AnimationOptions.js
3185
3186class AnimationOptions {
3187 constructor() {
3188 this.count = 0;
3189 this.enable = false;
3190 this.speed = 1;
3191 this.sync = false;
3192 }
3193
3194 load(data) {
3195 if (!data) {
3196 return;
3197 }
3198
3199 if (data.count !== undefined) {
3200 this.count = setRangeValue(data.count);
3201 }
3202
3203 if (data.enable !== undefined) {
3204 this.enable = data.enable;
3205 }
3206
3207 if (data.speed !== undefined) {
3208 this.speed = setRangeValue(data.speed);
3209 }
3210
3211 if (data.sync !== undefined) {
3212 this.sync = data.sync;
3213 }
3214 }
3215
3216}
3217;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Opacity/OpacityAnimation.js
3218
3219class OpacityAnimation extends AnimationOptions {
3220 constructor() {
3221 super();
3222 this.destroy = "none";
3223 this.enable = false;
3224 this.speed = 2;
3225 this.startValue = "random";
3226 this.sync = false;
3227 }
3228
3229 get opacity_min() {
3230 return this.minimumValue;
3231 }
3232
3233 set opacity_min(value) {
3234 this.minimumValue = value;
3235 }
3236
3237 load(data) {
3238 var _a;
3239
3240 if (!data) {
3241 return;
3242 }
3243
3244 super.load(data);
3245
3246 if (data.destroy !== undefined) {
3247 this.destroy = data.destroy;
3248 }
3249
3250 if (data.enable !== undefined) {
3251 this.enable = data.enable;
3252 }
3253
3254 this.minimumValue = (_a = data.minimumValue) !== null && _a !== void 0 ? _a : data.opacity_min;
3255
3256 if (data.speed !== undefined) {
3257 this.speed = data.speed;
3258 }
3259
3260 if (data.startValue !== undefined) {
3261 this.startValue = data.startValue;
3262 }
3263
3264 if (data.sync !== undefined) {
3265 this.sync = data.sync;
3266 }
3267 }
3268
3269}
3270;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Opacity/Opacity.js
3271
3272
3273
3274class Opacity extends ValueWithRandom {
3275 constructor() {
3276 super();
3277 this.animation = new OpacityAnimation();
3278 this.random.minimumValue = 0.1;
3279 this.value = 1;
3280 }
3281
3282 get anim() {
3283 return this.animation;
3284 }
3285
3286 set anim(value) {
3287 this.animation = value;
3288 }
3289
3290 load(data) {
3291 var _a;
3292
3293 if (!data) {
3294 return;
3295 }
3296
3297 super.load(data);
3298 const animation = (_a = data.animation) !== null && _a !== void 0 ? _a : data.anim;
3299
3300 if (animation !== undefined) {
3301 this.animation.load(animation);
3302 this.value = setRangeValue(this.value, this.animation.enable ? this.animation.minimumValue : undefined);
3303 }
3304 }
3305
3306}
3307;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Orbit/OrbitRotation.js
3308
3309class OrbitRotation extends ValueWithRandom {
3310 constructor() {
3311 super();
3312 this.value = 45;
3313 this.random.enable = false;
3314 this.random.minimumValue = 0;
3315 }
3316
3317 load(data) {
3318 if (data === undefined) {
3319 return;
3320 }
3321
3322 super.load(data);
3323 }
3324
3325}
3326;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Orbit/Orbit.js
3327
3328
3329
3330
3331class Orbit {
3332 constructor() {
3333 this.animation = new AnimationOptions();
3334 this.enable = false;
3335 this.opacity = 1;
3336 this.rotation = new OrbitRotation();
3337 this.width = 1;
3338 }
3339
3340 load(data) {
3341 if (!data) {
3342 return;
3343 }
3344
3345 this.animation.load(data.animation);
3346 this.rotation.load(data.rotation);
3347
3348 if (data.enable !== undefined) {
3349 this.enable = data.enable;
3350 }
3351
3352 if (data.opacity !== undefined) {
3353 this.opacity = setRangeValue(data.opacity);
3354 }
3355
3356 if (data.width !== undefined) {
3357 this.width = setRangeValue(data.width);
3358 }
3359
3360 if (data.radius !== undefined) {
3361 this.radius = setRangeValue(data.radius);
3362 }
3363
3364 if (data.color !== undefined) {
3365 this.color = OptionsColor.create(this.color, data.color);
3366 }
3367 }
3368
3369}
3370;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Number/ParticlesDensity.js
3371class ParticlesDensity {
3372 constructor() {
3373 this.enable = false;
3374 this.area = 800;
3375 this.factor = 1000;
3376 }
3377
3378 get value_area() {
3379 return this.area;
3380 }
3381
3382 set value_area(value) {
3383 this.area = value;
3384 }
3385
3386 load(data) {
3387 var _a;
3388
3389 if (!data) {
3390 return;
3391 }
3392
3393 if (data.enable !== undefined) {
3394 this.enable = data.enable;
3395 }
3396
3397 const area = (_a = data.area) !== null && _a !== void 0 ? _a : data.value_area;
3398
3399 if (area !== undefined) {
3400 this.area = area;
3401 }
3402
3403 if (data.factor !== undefined) {
3404 this.factor = data.factor;
3405 }
3406 }
3407
3408}
3409;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Number/ParticlesNumber.js
3410
3411class ParticlesNumber {
3412 constructor() {
3413 this.density = new ParticlesDensity();
3414 this.limit = 0;
3415 this.value = 100;
3416 }
3417
3418 get max() {
3419 return this.limit;
3420 }
3421
3422 set max(value) {
3423 this.limit = value;
3424 }
3425
3426 load(data) {
3427 var _a;
3428
3429 if (!data) {
3430 return;
3431 }
3432
3433 this.density.load(data.density);
3434 const limit = (_a = data.limit) !== null && _a !== void 0 ? _a : data.max;
3435
3436 if (limit !== undefined) {
3437 this.limit = limit;
3438 }
3439
3440 if (data.value !== undefined) {
3441 this.value = data.value;
3442 }
3443 }
3444
3445}
3446;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Repulse/ParticlesRepulse.js
3447
3448
3449class ParticlesRepulse extends ValueWithRandom {
3450 constructor() {
3451 super();
3452 this.enabled = false;
3453 this.distance = 1;
3454 this.duration = 1;
3455 this.factor = 1;
3456 this.speed = 1;
3457 }
3458
3459 load(data) {
3460 super.load(data);
3461
3462 if (!data) {
3463 return;
3464 }
3465
3466 if (data.enabled !== undefined) {
3467 this.enabled = data.enabled;
3468 }
3469
3470 if (data.distance !== undefined) {
3471 this.distance = setRangeValue(data.distance);
3472 }
3473
3474 if (data.duration !== undefined) {
3475 this.duration = setRangeValue(data.duration);
3476 }
3477
3478 if (data.factor !== undefined) {
3479 this.factor = setRangeValue(data.factor);
3480 }
3481
3482 if (data.speed !== undefined) {
3483 this.speed = setRangeValue(data.speed);
3484 }
3485 }
3486
3487}
3488;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Roll/RollLight.js
3489
3490class RollLight {
3491 constructor() {
3492 this.enable = false;
3493 this.value = 0;
3494 }
3495
3496 load(data) {
3497 if (!data) {
3498 return;
3499 }
3500
3501 if (data.enable !== undefined) {
3502 this.enable = data.enable;
3503 }
3504
3505 if (data.value !== undefined) {
3506 this.value = setRangeValue(data.value);
3507 }
3508 }
3509
3510}
3511;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Roll/Roll.js
3512
3513
3514
3515class Roll {
3516 constructor() {
3517 this.darken = new RollLight();
3518 this.enable = false;
3519 this.enlighten = new RollLight();
3520 this.mode = "vertical";
3521 this.speed = 25;
3522 }
3523
3524 load(data) {
3525 if (!data) {
3526 return;
3527 }
3528
3529 if (data.backColor !== undefined) {
3530 this.backColor = OptionsColor.create(this.backColor, data.backColor);
3531 }
3532
3533 this.darken.load(data.darken);
3534
3535 if (data.enable !== undefined) {
3536 this.enable = data.enable;
3537 }
3538
3539 this.enlighten.load(data.enlighten);
3540
3541 if (data.mode !== undefined) {
3542 this.mode = data.mode;
3543 }
3544
3545 if (data.speed !== undefined) {
3546 this.speed = setRangeValue(data.speed);
3547 }
3548 }
3549
3550}
3551;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Rotate/RotateAnimation.js
3552
3553class RotateAnimation {
3554 constructor() {
3555 this.enable = false;
3556 this.speed = 0;
3557 this.sync = false;
3558 }
3559
3560 load(data) {
3561 if (!data) {
3562 return;
3563 }
3564
3565 if (data.enable !== undefined) {
3566 this.enable = data.enable;
3567 }
3568
3569 if (data.speed !== undefined) {
3570 this.speed = setRangeValue(data.speed);
3571 }
3572
3573 if (data.sync !== undefined) {
3574 this.sync = data.sync;
3575 }
3576 }
3577
3578}
3579;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Rotate/Rotate.js
3580
3581
3582class Rotate extends ValueWithRandom {
3583 constructor() {
3584 super();
3585 this.animation = new RotateAnimation();
3586 this.direction = "clockwise";
3587 this.path = false;
3588 this.value = 0;
3589 }
3590
3591 load(data) {
3592 if (!data) {
3593 return;
3594 }
3595
3596 super.load(data);
3597
3598 if (data.direction !== undefined) {
3599 this.direction = data.direction;
3600 }
3601
3602 this.animation.load(data.animation);
3603
3604 if (data.path !== undefined) {
3605 this.path = data.path;
3606 }
3607 }
3608
3609}
3610;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Shadow.js
3611
3612class Shadow {
3613 constructor() {
3614 this.blur = 0;
3615 this.color = new OptionsColor();
3616 this.enable = false;
3617 this.offset = {
3618 x: 0,
3619 y: 0
3620 };
3621 this.color.value = "#000";
3622 }
3623
3624 load(data) {
3625 if (!data) {
3626 return;
3627 }
3628
3629 if (data.blur !== undefined) {
3630 this.blur = data.blur;
3631 }
3632
3633 this.color = OptionsColor.create(this.color, data.color);
3634
3635 if (data.enable !== undefined) {
3636 this.enable = data.enable;
3637 }
3638
3639 if (data.offset === undefined) {
3640 return;
3641 }
3642
3643 if (data.offset.x !== undefined) {
3644 this.offset.x = data.offset.x;
3645 }
3646
3647 if (data.offset.y !== undefined) {
3648 this.offset.y = data.offset.y;
3649 }
3650 }
3651
3652}
3653;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Shape/Shape.js
3654
3655class Shape {
3656 constructor() {
3657 this.options = {};
3658 this.type = "circle";
3659 }
3660
3661 get image() {
3662 var _a;
3663
3664 return (_a = this.options["image"]) !== null && _a !== void 0 ? _a : this.options["images"];
3665 }
3666
3667 set image(value) {
3668 this.options["image"] = value;
3669 this.options["images"] = value;
3670 }
3671
3672 get custom() {
3673 return this.options;
3674 }
3675
3676 set custom(value) {
3677 this.options = value;
3678 }
3679
3680 get images() {
3681 return this.image;
3682 }
3683
3684 set images(value) {
3685 this.image = value;
3686 }
3687
3688 get stroke() {
3689 return [];
3690 }
3691
3692 set stroke(_value) {}
3693
3694 get character() {
3695 var _a;
3696
3697 return (_a = this.options["character"]) !== null && _a !== void 0 ? _a : this.options["char"];
3698 }
3699
3700 set character(value) {
3701 this.options["character"] = value;
3702 this.options["char"] = value;
3703 }
3704
3705 get polygon() {
3706 var _a;
3707
3708 return (_a = this.options["polygon"]) !== null && _a !== void 0 ? _a : this.options["star"];
3709 }
3710
3711 set polygon(value) {
3712 this.options["polygon"] = value;
3713 this.options["star"] = value;
3714 }
3715
3716 load(data) {
3717 var _a, _b, _c;
3718
3719 if (!data) {
3720 return;
3721 }
3722
3723 const options = (_a = data.options) !== null && _a !== void 0 ? _a : data.custom;
3724
3725 if (options !== undefined) {
3726 for (const shape in options) {
3727 const item = options[shape];
3728
3729 if (item) {
3730 this.options[shape] = deepExtend((_b = this.options[shape]) !== null && _b !== void 0 ? _b : {}, item);
3731 }
3732 }
3733 }
3734
3735 this.loadShape(data.character, "character", "char", true);
3736 this.loadShape(data.polygon, "polygon", "star", false);
3737 this.loadShape((_c = data.image) !== null && _c !== void 0 ? _c : data.images, "image", "images", true);
3738
3739 if (data.type !== undefined) {
3740 this.type = data.type;
3741 }
3742 }
3743
3744 loadShape(item, mainKey, altKey, altOverride) {
3745 var _a, _b, _c, _d;
3746
3747 if (item === undefined) {
3748 return;
3749 }
3750
3751 if (item instanceof Array) {
3752 if (!(this.options[mainKey] instanceof Array)) {
3753 this.options[mainKey] = [];
3754
3755 if (!this.options[altKey] || altOverride) {
3756 this.options[altKey] = [];
3757 }
3758 }
3759
3760 this.options[mainKey] = deepExtend((_a = this.options[mainKey]) !== null && _a !== void 0 ? _a : [], item);
3761
3762 if (!this.options[altKey] || altOverride) {
3763 this.options[altKey] = deepExtend((_b = this.options[altKey]) !== null && _b !== void 0 ? _b : [], item);
3764 }
3765 } else {
3766 if (this.options[mainKey] instanceof Array) {
3767 this.options[mainKey] = {};
3768
3769 if (!this.options[altKey] || altOverride) {
3770 this.options[altKey] = {};
3771 }
3772 }
3773
3774 this.options[mainKey] = deepExtend((_c = this.options[mainKey]) !== null && _c !== void 0 ? _c : {}, item);
3775
3776 if (!this.options[altKey] || altOverride) {
3777 this.options[altKey] = deepExtend((_d = this.options[altKey]) !== null && _d !== void 0 ? _d : {}, item);
3778 }
3779 }
3780 }
3781
3782}
3783;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Size/SizeAnimation.js
3784
3785class SizeAnimation extends AnimationOptions {
3786 constructor() {
3787 super();
3788 this.destroy = "none";
3789 this.enable = false;
3790 this.speed = 5;
3791 this.startValue = "random";
3792 this.sync = false;
3793 }
3794
3795 get size_min() {
3796 return this.minimumValue;
3797 }
3798
3799 set size_min(value) {
3800 this.minimumValue = value;
3801 }
3802
3803 load(data) {
3804 var _a;
3805
3806 super.load(data);
3807
3808 if (!data) {
3809 return;
3810 }
3811
3812 if (data.destroy !== undefined) {
3813 this.destroy = data.destroy;
3814 }
3815
3816 if (data.enable !== undefined) {
3817 this.enable = data.enable;
3818 }
3819
3820 this.minimumValue = (_a = data.minimumValue) !== null && _a !== void 0 ? _a : data.size_min;
3821
3822 if (data.speed !== undefined) {
3823 this.speed = data.speed;
3824 }
3825
3826 if (data.startValue !== undefined) {
3827 this.startValue = data.startValue;
3828 }
3829
3830 if (data.sync !== undefined) {
3831 this.sync = data.sync;
3832 }
3833 }
3834
3835}
3836;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Size/Size.js
3837
3838
3839
3840class Size extends ValueWithRandom {
3841 constructor() {
3842 super();
3843 this.animation = new SizeAnimation();
3844 this.random.minimumValue = 1;
3845 this.value = 3;
3846 }
3847
3848 get anim() {
3849 return this.animation;
3850 }
3851
3852 set anim(value) {
3853 this.animation = value;
3854 }
3855
3856 load(data) {
3857 var _a;
3858
3859 super.load(data);
3860
3861 if (!data) {
3862 return;
3863 }
3864
3865 const animation = (_a = data.animation) !== null && _a !== void 0 ? _a : data.anim;
3866
3867 if (animation !== undefined) {
3868 this.animation.load(animation);
3869 this.value = setRangeValue(this.value, this.animation.enable ? this.animation.minimumValue : undefined);
3870 }
3871 }
3872
3873}
3874;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Stroke.js
3875
3876class Stroke {
3877 constructor() {
3878 this.width = 0;
3879 }
3880
3881 load(data) {
3882 if (!data) {
3883 return;
3884 }
3885
3886 if (data.color !== undefined) {
3887 this.color = AnimatableColor.create(this.color, data.color);
3888 }
3889
3890 if (data.width !== undefined) {
3891 this.width = data.width;
3892 }
3893
3894 if (data.opacity !== undefined) {
3895 this.opacity = data.opacity;
3896 }
3897 }
3898
3899}
3900;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Tilt/TiltAnimation.js
3901
3902class TiltAnimation {
3903 constructor() {
3904 this.enable = false;
3905 this.speed = 0;
3906 this.sync = false;
3907 }
3908
3909 load(data) {
3910 if (!data) {
3911 return;
3912 }
3913
3914 if (data.enable !== undefined) {
3915 this.enable = data.enable;
3916 }
3917
3918 if (data.speed !== undefined) {
3919 this.speed = setRangeValue(data.speed);
3920 }
3921
3922 if (data.sync !== undefined) {
3923 this.sync = data.sync;
3924 }
3925 }
3926
3927}
3928;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Tilt/Tilt.js
3929
3930
3931class Tilt extends ValueWithRandom {
3932 constructor() {
3933 super();
3934 this.animation = new TiltAnimation();
3935 this.direction = "clockwise";
3936 this.enable = false;
3937 this.value = 0;
3938 }
3939
3940 load(data) {
3941 super.load(data);
3942
3943 if (!data) {
3944 return;
3945 }
3946
3947 this.animation.load(data.animation);
3948
3949 if (data.direction !== undefined) {
3950 this.direction = data.direction;
3951 }
3952
3953 if (data.enable !== undefined) {
3954 this.enable = data.enable;
3955 }
3956 }
3957
3958}
3959;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Twinkle/TwinkleValues.js
3960
3961
3962class TwinkleValues {
3963 constructor() {
3964 this.enable = false;
3965 this.frequency = 0.05;
3966 this.opacity = 1;
3967 }
3968
3969 load(data) {
3970 if (!data) {
3971 return;
3972 }
3973
3974 if (data.color !== undefined) {
3975 this.color = OptionsColor.create(this.color, data.color);
3976 }
3977
3978 if (data.enable !== undefined) {
3979 this.enable = data.enable;
3980 }
3981
3982 if (data.frequency !== undefined) {
3983 this.frequency = data.frequency;
3984 }
3985
3986 if (data.opacity !== undefined) {
3987 this.opacity = setRangeValue(data.opacity);
3988 }
3989 }
3990
3991}
3992;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Twinkle/Twinkle.js
3993
3994class Twinkle {
3995 constructor() {
3996 this.lines = new TwinkleValues();
3997 this.particles = new TwinkleValues();
3998 }
3999
4000 load(data) {
4001 if (!data) {
4002 return;
4003 }
4004
4005 this.lines.load(data.lines);
4006 this.particles.load(data.particles);
4007 }
4008
4009}
4010;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Wobble/Wobble.js
4011
4012class Wobble {
4013 constructor() {
4014 this.distance = 5;
4015 this.enable = false;
4016 this.speed = 50;
4017 }
4018
4019 load(data) {
4020 if (!data) {
4021 return;
4022 }
4023
4024 if (data.distance !== undefined) {
4025 this.distance = setRangeValue(data.distance);
4026 }
4027
4028 if (data.enable !== undefined) {
4029 this.enable = data.enable;
4030 }
4031
4032 if (data.speed !== undefined) {
4033 this.speed = setRangeValue(data.speed);
4034 }
4035 }
4036
4037}
4038;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/ZIndex/ZIndex.js
4039
4040class ZIndex extends ValueWithRandom {
4041 constructor() {
4042 super();
4043 this.opacityRate = 1;
4044 this.sizeRate = 1;
4045 this.velocityRate = 1;
4046 }
4047
4048 load(data) {
4049 super.load(data);
4050
4051 if (!data) {
4052 return;
4053 }
4054
4055 if (data.opacityRate !== undefined) {
4056 this.opacityRate = data.opacityRate;
4057 }
4058
4059 if (data.sizeRate !== undefined) {
4060 this.sizeRate = data.sizeRate;
4061 }
4062
4063 if (data.velocityRate !== undefined) {
4064 this.velocityRate = data.velocityRate;
4065 }
4066 }
4067
4068}
4069;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/ParticlesOptions.js
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093class ParticlesOptions {
4094 constructor() {
4095 this.bounce = new ParticlesBounce();
4096 this.collisions = new Collisions();
4097 this.color = new AnimatableColor();
4098 this.color.value = "#fff";
4099 this.destroy = new Destroy();
4100 this.gradient = [];
4101 this.groups = {};
4102 this.life = new Life();
4103 this.links = new Links();
4104 this.move = new Move();
4105 this.number = new ParticlesNumber();
4106 this.opacity = new Opacity();
4107 this.orbit = new Orbit();
4108 this.reduceDuplicates = false;
4109 this.repulse = new ParticlesRepulse();
4110 this.roll = new Roll();
4111 this.rotate = new Rotate();
4112 this.shadow = new Shadow();
4113 this.shape = new Shape();
4114 this.size = new Size();
4115 this.stroke = new Stroke();
4116 this.tilt = new Tilt();
4117 this.twinkle = new Twinkle();
4118 this.wobble = new Wobble();
4119 this.zIndex = new ZIndex();
4120 }
4121
4122 get line_linked() {
4123 return this.links;
4124 }
4125
4126 set line_linked(value) {
4127 this.links = value;
4128 }
4129
4130 get lineLinked() {
4131 return this.links;
4132 }
4133
4134 set lineLinked(value) {
4135 this.links = value;
4136 }
4137
4138 load(data) {
4139 var _a, _b, _c, _d, _e, _f, _g, _h;
4140
4141 if (!data) {
4142 return;
4143 }
4144
4145 this.bounce.load(data.bounce);
4146 this.color.load(AnimatableColor.create(this.color, data.color));
4147 this.destroy.load(data.destroy);
4148 this.life.load(data.life);
4149 const links = (_b = (_a = data.links) !== null && _a !== void 0 ? _a : data.lineLinked) !== null && _b !== void 0 ? _b : data.line_linked;
4150
4151 if (links !== undefined) {
4152 this.links.load(links);
4153 }
4154
4155 if (data.groups !== undefined) {
4156 for (const group in data.groups) {
4157 const item = data.groups[group];
4158
4159 if (item !== undefined) {
4160 this.groups[group] = deepExtend((_c = this.groups[group]) !== null && _c !== void 0 ? _c : {}, item);
4161 }
4162 }
4163 }
4164
4165 this.move.load(data.move);
4166 this.number.load(data.number);
4167 this.opacity.load(data.opacity);
4168 this.orbit.load(data.orbit);
4169
4170 if (data.reduceDuplicates !== undefined) {
4171 this.reduceDuplicates = data.reduceDuplicates;
4172 }
4173
4174 this.repulse.load(data.repulse);
4175 this.roll.load(data.roll);
4176 this.rotate.load(data.rotate);
4177 this.shape.load(data.shape);
4178 this.size.load(data.size);
4179 this.shadow.load(data.shadow);
4180 this.tilt.load(data.tilt);
4181 this.twinkle.load(data.twinkle);
4182 this.wobble.load(data.wobble);
4183 this.zIndex.load(data.zIndex);
4184 const collisions = (_e = (_d = data.move) === null || _d === void 0 ? void 0 : _d.collisions) !== null && _e !== void 0 ? _e : (_f = data.move) === null || _f === void 0 ? void 0 : _f.bounce;
4185
4186 if (collisions !== undefined) {
4187 this.collisions.enable = collisions;
4188 }
4189
4190 this.collisions.load(data.collisions);
4191 const strokeToLoad = (_g = data.stroke) !== null && _g !== void 0 ? _g : (_h = data.shape) === null || _h === void 0 ? void 0 : _h.stroke;
4192
4193 if (strokeToLoad) {
4194 if (strokeToLoad instanceof Array) {
4195 this.stroke = strokeToLoad.map(s => {
4196 const tmp = new Stroke();
4197 tmp.load(s);
4198 return tmp;
4199 });
4200 } else {
4201 if (this.stroke instanceof Array) {
4202 this.stroke = new Stroke();
4203 }
4204
4205 this.stroke.load(strokeToLoad);
4206 }
4207 }
4208
4209 const gradientToLoad = data.gradient;
4210
4211 if (gradientToLoad) {
4212 if (gradientToLoad instanceof Array) {
4213 this.gradient = gradientToLoad.map(s => {
4214 const tmp = new AnimatableGradient();
4215 tmp.load(s);
4216 return tmp;
4217 });
4218 } else {
4219 if (this.gradient instanceof Array) {
4220 this.gradient = new AnimatableGradient();
4221 }
4222
4223 this.gradient.load(gradientToLoad);
4224 }
4225 }
4226 }
4227
4228}
4229;// CONCATENATED MODULE: ../../engine/dist/esm/Utils/Utils.js
4230
4231
4232
4233
4234
4235function rectSideBounce(pSide, pOtherSide, rectSide, rectOtherSide, velocity, factor) {
4236 const res = {
4237 bounced: false
4238 };
4239
4240 if (pOtherSide.min < rectOtherSide.min || pOtherSide.min > rectOtherSide.max || pOtherSide.max < rectOtherSide.min || pOtherSide.max > rectOtherSide.max) {
4241 return res;
4242 }
4243
4244 if (pSide.max >= rectSide.min && pSide.max <= (rectSide.max + rectSide.min) / 2 && velocity > 0 || pSide.min <= rectSide.max && pSide.min > (rectSide.max + rectSide.min) / 2 && velocity < 0) {
4245 res.velocity = velocity * -factor;
4246 res.bounced = true;
4247 }
4248
4249 return res;
4250}
4251
4252function checkSelector(element, selectors) {
4253 if (!(selectors instanceof Array)) {
4254 return element.matches(selectors);
4255 }
4256
4257 for (const selector of selectors) {
4258 if (element.matches(selector)) {
4259 return true;
4260 }
4261 }
4262
4263 return false;
4264}
4265
4266function isSsr() {
4267 return typeof window === "undefined" || !window || typeof window.document === "undefined" || !window.document;
4268}
4269function animate() {
4270 return isSsr() ? callback => setTimeout(callback) : callback => (window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || window.setTimeout)(callback);
4271}
4272function cancelAnimation() {
4273 return isSsr() ? handle => clearTimeout(handle) : handle => (window.cancelAnimationFrame || window.webkitCancelRequestAnimationFrame || window.mozCancelRequestAnimationFrame || window.oCancelRequestAnimationFrame || window.msCancelRequestAnimationFrame || window.clearTimeout)(handle);
4274}
4275function isInArray(value, array) {
4276 return value === array || array instanceof Array && array.indexOf(value) > -1;
4277}
4278async function loadFont(font, weight) {
4279 try {
4280 await document.fonts.load(`${weight !== null && weight !== void 0 ? weight : "400"} 36px '${font !== null && font !== void 0 ? font : "Verdana"}'`);
4281 } catch (_a) {}
4282}
4283function arrayRandomIndex(array) {
4284 return Math.floor(Math.random() * array.length);
4285}
4286function itemFromArray(array, index, useIndex = true) {
4287 const fixedIndex = index !== undefined && useIndex ? index % array.length : arrayRandomIndex(array);
4288 return array[fixedIndex];
4289}
4290function isPointInside(point, size, offset, radius, direction) {
4291 return areBoundsInside(calculateBounds(point, radius !== null && radius !== void 0 ? radius : 0), size, offset, direction);
4292}
4293function areBoundsInside(bounds, size, offset, direction) {
4294 let inside = true;
4295
4296 if (!direction || direction === "bottom") {
4297 inside = bounds.top < size.height + offset.x;
4298 }
4299
4300 if (inside && (!direction || direction === "left")) {
4301 inside = bounds.right > offset.x;
4302 }
4303
4304 if (inside && (!direction || direction === "right")) {
4305 inside = bounds.left < size.width + offset.y;
4306 }
4307
4308 if (inside && (!direction || direction === "top")) {
4309 inside = bounds.bottom > offset.y;
4310 }
4311
4312 return inside;
4313}
4314function calculateBounds(point, radius) {
4315 return {
4316 bottom: point.y + radius,
4317 left: point.x - radius,
4318 right: point.x + radius,
4319 top: point.y - radius
4320 };
4321}
4322function deepExtend(destination, ...sources) {
4323 for (const source of sources) {
4324 if (source === undefined || source === null) {
4325 continue;
4326 }
4327
4328 if (typeof source !== "object") {
4329 destination = source;
4330 continue;
4331 }
4332
4333 const sourceIsArray = Array.isArray(source);
4334
4335 if (sourceIsArray && (typeof destination !== "object" || !destination || !Array.isArray(destination))) {
4336 destination = [];
4337 } else if (!sourceIsArray && (typeof destination !== "object" || !destination || Array.isArray(destination))) {
4338 destination = {};
4339 }
4340
4341 for (const key in source) {
4342 if (key === "__proto__") {
4343 continue;
4344 }
4345
4346 const sourceDict = source,
4347 value = sourceDict[key],
4348 isObject = typeof value === "object",
4349 destDict = destination;
4350 destDict[key] = isObject && Array.isArray(value) ? value.map(v => deepExtend(destDict[key], v)) : deepExtend(destDict[key], value);
4351 }
4352 }
4353
4354 return destination;
4355}
4356function isDivModeEnabled(mode, divs) {
4357 return divs instanceof Array ? !!divs.find(t => t.enable && isInArray(mode, t.mode)) : isInArray(mode, divs.mode);
4358}
4359function divModeExecute(mode, divs, callback) {
4360 if (divs instanceof Array) {
4361 for (const div of divs) {
4362 const divMode = div.mode,
4363 divEnabled = div.enable;
4364
4365 if (divEnabled && isInArray(mode, divMode)) {
4366 singleDivModeExecute(div, callback);
4367 }
4368 }
4369 } else {
4370 const divMode = divs.mode,
4371 divEnabled = divs.enable;
4372
4373 if (divEnabled && isInArray(mode, divMode)) {
4374 singleDivModeExecute(divs, callback);
4375 }
4376 }
4377}
4378function singleDivModeExecute(div, callback) {
4379 const selectors = div.selectors;
4380
4381 if (selectors instanceof Array) {
4382 for (const selector of selectors) {
4383 callback(selector, div);
4384 }
4385 } else {
4386 callback(selectors, div);
4387 }
4388}
4389function divMode(divs, element) {
4390 if (!element || !divs) {
4391 return;
4392 }
4393
4394 if (divs instanceof Array) {
4395 return divs.find(d => checkSelector(element, d.selectors));
4396 } else if (checkSelector(element, divs.selectors)) {
4397 return divs;
4398 }
4399}
4400function circleBounceDataFromParticle(p) {
4401 return {
4402 position: p.getPosition(),
4403 radius: p.getRadius(),
4404 mass: p.getMass(),
4405 velocity: p.velocity,
4406 factor: Vector.create(getValue(p.options.bounce.horizontal), getValue(p.options.bounce.vertical))
4407 };
4408}
4409function circleBounce(p1, p2) {
4410 const {
4411 x: xVelocityDiff,
4412 y: yVelocityDiff
4413 } = p1.velocity.sub(p2.velocity),
4414 [pos1, pos2] = [p1.position, p2.position],
4415 {
4416 dx: xDist,
4417 dy: yDist
4418 } = getDistances(pos2, pos1);
4419
4420 if (xVelocityDiff * xDist + yVelocityDiff * yDist < 0) {
4421 return;
4422 }
4423
4424 const angle = -Math.atan2(yDist, xDist),
4425 m1 = p1.mass,
4426 m2 = p2.mass,
4427 u1 = p1.velocity.rotate(angle),
4428 u2 = p2.velocity.rotate(angle),
4429 v1 = collisionVelocity(u1, u2, m1, m2),
4430 v2 = collisionVelocity(u2, u1, m1, m2),
4431 vFinal1 = v1.rotate(-angle),
4432 vFinal2 = v2.rotate(-angle);
4433 p1.velocity.x = vFinal1.x * p1.factor.x;
4434 p1.velocity.y = vFinal1.y * p1.factor.y;
4435 p2.velocity.x = vFinal2.x * p2.factor.x;
4436 p2.velocity.y = vFinal2.y * p2.factor.y;
4437}
4438function rectBounce(particle, divBounds) {
4439 const pPos = particle.getPosition(),
4440 size = particle.getRadius(),
4441 bounds = calculateBounds(pPos, size);
4442 const resH = rectSideBounce({
4443 min: bounds.left,
4444 max: bounds.right
4445 }, {
4446 min: bounds.top,
4447 max: bounds.bottom
4448 }, {
4449 min: divBounds.left,
4450 max: divBounds.right
4451 }, {
4452 min: divBounds.top,
4453 max: divBounds.bottom
4454 }, particle.velocity.x, getValue(particle.options.bounce.horizontal));
4455
4456 if (resH.bounced) {
4457 if (resH.velocity !== undefined) {
4458 particle.velocity.x = resH.velocity;
4459 }
4460
4461 if (resH.position !== undefined) {
4462 particle.position.x = resH.position;
4463 }
4464 }
4465
4466 const resV = rectSideBounce({
4467 min: bounds.top,
4468 max: bounds.bottom
4469 }, {
4470 min: bounds.left,
4471 max: bounds.right
4472 }, {
4473 min: divBounds.top,
4474 max: divBounds.bottom
4475 }, {
4476 min: divBounds.left,
4477 max: divBounds.right
4478 }, particle.velocity.y, getValue(particle.options.bounce.vertical));
4479
4480 if (resV.bounced) {
4481 if (resV.velocity !== undefined) {
4482 particle.velocity.y = resV.velocity;
4483 }
4484
4485 if (resV.position !== undefined) {
4486 particle.position.y = resV.position;
4487 }
4488 }
4489}
4490
4491function loadOptions(options, ...sourceOptionsArr) {
4492 for (const sourceOptions of sourceOptionsArr) {
4493 options.load(sourceOptions);
4494 }
4495}
4496
4497function loadContainerOptions(engine, ...sourceOptionsArr) {
4498 const options = new Options(engine);
4499 loadOptions(options, ...sourceOptionsArr);
4500 return options;
4501}
4502function loadParticlesOptions(...sourceOptionsArr) {
4503 const options = new ParticlesOptions();
4504 loadOptions(options, ...sourceOptionsArr);
4505 return options;
4506}
4507;// CONCATENATED MODULE: ../../engine/dist/esm/Core/Utils/Constants.js
4508const generatedAttribute = "generated";
4509const randomColorValue = "random";
4510const midColorValue = "mid";
4511const touchEndEvent = "touchend";
4512const mouseDownEvent = "mousedown";
4513const mouseUpEvent = "mouseup";
4514const mouseMoveEvent = "mousemove";
4515const touchStartEvent = "touchstart";
4516const touchMoveEvent = "touchmove";
4517const mouseLeaveEvent = "mouseleave";
4518const mouseOutEvent = "mouseout";
4519const touchCancelEvent = "touchcancel";
4520const resizeEvent = "resize";
4521const visibilityChangeEvent = "visibilitychange";
4522const noPolygonDataLoaded = "No polygon data loaded.";
4523const noPolygonFound = "No polygon found, you need to specify SVG url in config.";
4524;// CONCATENATED MODULE: ../../engine/dist/esm/Utils/ColorUtils.js
4525
4526
4527
4528
4529function hue2rgb(p, q, t) {
4530 let tCalc = t;
4531
4532 if (tCalc < 0) {
4533 tCalc += 1;
4534 }
4535
4536 if (tCalc > 1) {
4537 tCalc -= 1;
4538 }
4539
4540 if (tCalc < 1 / 6) {
4541 return p + (q - p) * 6 * tCalc;
4542 }
4543
4544 if (tCalc < 1 / 2) {
4545 return q;
4546 }
4547
4548 if (tCalc < 2 / 3) {
4549 return p + (q - p) * (2 / 3 - tCalc) * 6;
4550 }
4551
4552 return p;
4553}
4554
4555function stringToRgba(input) {
4556 if (input.startsWith("rgb")) {
4557 const regex = /rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([\d.]+)\s*)?\)/i;
4558 const result = regex.exec(input);
4559 return result ? {
4560 a: result.length > 4 ? parseFloat(result[5]) : 1,
4561 b: parseInt(result[3], 10),
4562 g: parseInt(result[2], 10),
4563 r: parseInt(result[1], 10)
4564 } : undefined;
4565 } else if (input.startsWith("hsl")) {
4566 const regex = /hsla?\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([\d.]+)\s*)?\)/i;
4567 const result = regex.exec(input);
4568 return result ? hslaToRgba({
4569 a: result.length > 4 ? parseFloat(result[5]) : 1,
4570 h: parseInt(result[1], 10),
4571 l: parseInt(result[3], 10),
4572 s: parseInt(result[2], 10)
4573 }) : undefined;
4574 } else if (input.startsWith("hsv")) {
4575 const regex = /hsva?\(\s*(\d+)°\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([\d.]+)\s*)?\)/i;
4576 const result = regex.exec(input);
4577 return result ? hsvaToRgba({
4578 a: result.length > 4 ? parseFloat(result[5]) : 1,
4579 h: parseInt(result[1], 10),
4580 s: parseInt(result[2], 10),
4581 v: parseInt(result[3], 10)
4582 }) : undefined;
4583 } else {
4584 const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])([a-f\d])?$/i;
4585 const hexFixed = input.replace(shorthandRegex, (_m, r, g, b, a) => {
4586 return r + r + g + g + b + b + (a !== undefined ? a + a : "");
4587 });
4588 const regex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i;
4589 const result = regex.exec(hexFixed);
4590 return result ? {
4591 a: result[4] !== undefined ? parseInt(result[4], 16) / 0xff : 1,
4592 b: parseInt(result[3], 16),
4593 g: parseInt(result[2], 16),
4594 r: parseInt(result[1], 16)
4595 } : undefined;
4596 }
4597}
4598
4599function colorToRgb(input, index, useIndex = true) {
4600 var _a, _b, _c;
4601
4602 if (input === undefined) {
4603 return;
4604 }
4605
4606 const color = typeof input === "string" ? {
4607 value: input
4608 } : input;
4609 let res;
4610
4611 if (typeof color.value === "string") {
4612 res = color.value === randomColorValue ? getRandomRgbColor() : stringToRgb(color.value);
4613 } else {
4614 if (color.value instanceof Array) {
4615 const colorSelected = itemFromArray(color.value, index, useIndex);
4616 res = colorToRgb({
4617 value: colorSelected
4618 });
4619 } else {
4620 const colorValue = color.value,
4621 rgbColor = (_a = colorValue.rgb) !== null && _a !== void 0 ? _a : color.value;
4622
4623 if (rgbColor.r !== undefined) {
4624 res = rgbColor;
4625 } else {
4626 const hslColor = (_b = colorValue.hsl) !== null && _b !== void 0 ? _b : color.value;
4627
4628 if (hslColor.h !== undefined && hslColor.l !== undefined) {
4629 res = hslToRgb(hslColor);
4630 } else {
4631 const hsvColor = (_c = colorValue.hsv) !== null && _c !== void 0 ? _c : color.value;
4632
4633 if (hsvColor.h !== undefined && hsvColor.v !== undefined) {
4634 res = hsvToRgb(hsvColor);
4635 }
4636 }
4637 }
4638 }
4639 }
4640
4641 return res;
4642}
4643function colorToHsl(color, index, useIndex = true) {
4644 const rgb = colorToRgb(color, index, useIndex);
4645 return rgb !== undefined ? rgbToHsl(rgb) : undefined;
4646}
4647function rgbToHsl(color) {
4648 const r1 = color.r / 255,
4649 g1 = color.g / 255,
4650 b1 = color.b / 255;
4651 const max = Math.max(r1, g1, b1),
4652 min = Math.min(r1, g1, b1);
4653 const res = {
4654 h: 0,
4655 l: (max + min) / 2,
4656 s: 0
4657 };
4658
4659 if (max !== min) {
4660 res.s = res.l < 0.5 ? (max - min) / (max + min) : (max - min) / (2.0 - max - min);
4661 res.h = r1 === max ? (g1 - b1) / (max - min) : res.h = g1 === max ? 2.0 + (b1 - r1) / (max - min) : 4.0 + (r1 - g1) / (max - min);
4662 }
4663
4664 res.l *= 100;
4665 res.s *= 100;
4666 res.h *= 60;
4667
4668 if (res.h < 0) {
4669 res.h += 360;
4670 }
4671
4672 return res;
4673}
4674function stringToAlpha(input) {
4675 var _a;
4676
4677 return (_a = stringToRgba(input)) === null || _a === void 0 ? void 0 : _a.a;
4678}
4679function stringToRgb(input) {
4680 return stringToRgba(input);
4681}
4682function hslToRgb(hsl) {
4683 const result = {
4684 b: 0,
4685 g: 0,
4686 r: 0
4687 },
4688 hslPercent = {
4689 h: hsl.h / 360,
4690 l: hsl.l / 100,
4691 s: hsl.s / 100
4692 };
4693
4694 if (hslPercent.s === 0) {
4695 result.b = hslPercent.l;
4696 result.g = hslPercent.l;
4697 result.r = hslPercent.l;
4698 } else {
4699 const q = hslPercent.l < 0.5 ? hslPercent.l * (1 + hslPercent.s) : hslPercent.l + hslPercent.s - hslPercent.l * hslPercent.s,
4700 p = 2 * hslPercent.l - q;
4701 result.r = hue2rgb(p, q, hslPercent.h + 1 / 3);
4702 result.g = hue2rgb(p, q, hslPercent.h);
4703 result.b = hue2rgb(p, q, hslPercent.h - 1 / 3);
4704 }
4705
4706 result.r = Math.floor(result.r * 255);
4707 result.g = Math.floor(result.g * 255);
4708 result.b = Math.floor(result.b * 255);
4709 return result;
4710}
4711function hslaToRgba(hsla) {
4712 const rgbResult = hslToRgb(hsla);
4713 return {
4714 a: hsla.a,
4715 b: rgbResult.b,
4716 g: rgbResult.g,
4717 r: rgbResult.r
4718 };
4719}
4720function hslToHsv(hsl) {
4721 const l = hsl.l / 100,
4722 sl = hsl.s / 100,
4723 v = l + sl * Math.min(l, 1 - l),
4724 sv = !v ? 0 : 2 * (1 - l / v);
4725 return {
4726 h: hsl.h,
4727 s: sv * 100,
4728 v: v * 100
4729 };
4730}
4731function hslaToHsva(hsla) {
4732 const hsvResult = hslToHsv(hsla);
4733 return {
4734 a: hsla.a,
4735 h: hsvResult.h,
4736 s: hsvResult.s,
4737 v: hsvResult.v
4738 };
4739}
4740function hsvToHsl(hsv) {
4741 const v = hsv.v / 100,
4742 sv = hsv.s / 100,
4743 l = v * (1 - sv / 2),
4744 sl = l === 0 || l === 1 ? 0 : (v - l) / Math.min(l, 1 - l);
4745 return {
4746 h: hsv.h,
4747 l: l * 100,
4748 s: sl * 100
4749 };
4750}
4751function hsvaToHsla(hsva) {
4752 const hslResult = hsvToHsl(hsva);
4753 return {
4754 a: hsva.a,
4755 h: hslResult.h,
4756 l: hslResult.l,
4757 s: hslResult.s
4758 };
4759}
4760function hsvToRgb(hsv) {
4761 const result = {
4762 b: 0,
4763 g: 0,
4764 r: 0
4765 },
4766 hsvPercent = {
4767 h: hsv.h / 60,
4768 s: hsv.s / 100,
4769 v: hsv.v / 100
4770 };
4771 const c = hsvPercent.v * hsvPercent.s,
4772 x = c * (1 - Math.abs(hsvPercent.h % 2 - 1));
4773 let tempRgb;
4774
4775 if (hsvPercent.h >= 0 && hsvPercent.h <= 1) {
4776 tempRgb = {
4777 r: c,
4778 g: x,
4779 b: 0
4780 };
4781 } else if (hsvPercent.h > 1 && hsvPercent.h <= 2) {
4782 tempRgb = {
4783 r: x,
4784 g: c,
4785 b: 0
4786 };
4787 } else if (hsvPercent.h > 2 && hsvPercent.h <= 3) {
4788 tempRgb = {
4789 r: 0,
4790 g: c,
4791 b: x
4792 };
4793 } else if (hsvPercent.h > 3 && hsvPercent.h <= 4) {
4794 tempRgb = {
4795 r: 0,
4796 g: x,
4797 b: c
4798 };
4799 } else if (hsvPercent.h > 4 && hsvPercent.h <= 5) {
4800 tempRgb = {
4801 r: x,
4802 g: 0,
4803 b: c
4804 };
4805 } else if (hsvPercent.h > 5 && hsvPercent.h <= 6) {
4806 tempRgb = {
4807 r: c,
4808 g: 0,
4809 b: x
4810 };
4811 }
4812
4813 if (tempRgb) {
4814 const m = hsvPercent.v - c;
4815 result.r = Math.floor((tempRgb.r + m) * 255);
4816 result.g = Math.floor((tempRgb.g + m) * 255);
4817 result.b = Math.floor((tempRgb.b + m) * 255);
4818 }
4819
4820 return result;
4821}
4822function hsvaToRgba(hsva) {
4823 const rgbResult = hsvToRgb(hsva);
4824 return {
4825 a: hsva.a,
4826 b: rgbResult.b,
4827 g: rgbResult.g,
4828 r: rgbResult.r
4829 };
4830}
4831function rgbToHsv(rgb) {
4832 const rgbPercent = {
4833 r: rgb.r / 255,
4834 g: rgb.g / 255,
4835 b: rgb.b / 255
4836 },
4837 xMax = Math.max(rgbPercent.r, rgbPercent.g, rgbPercent.b),
4838 xMin = Math.min(rgbPercent.r, rgbPercent.g, rgbPercent.b),
4839 v = xMax,
4840 c = xMax - xMin;
4841 let h = 0;
4842
4843 if (v === rgbPercent.r) {
4844 h = 60 * ((rgbPercent.g - rgbPercent.b) / c);
4845 } else if (v === rgbPercent.g) {
4846 h = 60 * (2 + (rgbPercent.b - rgbPercent.r) / c);
4847 } else if (v === rgbPercent.b) {
4848 h = 60 * (4 + (rgbPercent.r - rgbPercent.g) / c);
4849 }
4850
4851 const s = !v ? 0 : c / v;
4852 return {
4853 h,
4854 s: s * 100,
4855 v: v * 100
4856 };
4857}
4858function rgbaToHsva(rgba) {
4859 const hsvResult = rgbToHsv(rgba);
4860 return {
4861 a: rgba.a,
4862 h: hsvResult.h,
4863 s: hsvResult.s,
4864 v: hsvResult.v
4865 };
4866}
4867function getRandomRgbColor(min) {
4868 const fixedMin = min !== null && min !== void 0 ? min : 0;
4869 return {
4870 b: Math.floor(randomInRange(setRangeValue(fixedMin, 256))),
4871 g: Math.floor(randomInRange(setRangeValue(fixedMin, 256))),
4872 r: Math.floor(randomInRange(setRangeValue(fixedMin, 256)))
4873 };
4874}
4875function getStyleFromRgb(color, opacity) {
4876 return `rgba(${color.r}, ${color.g}, ${color.b}, ${opacity !== null && opacity !== void 0 ? opacity : 1})`;
4877}
4878function getStyleFromHsl(color, opacity) {
4879 return `hsla(${color.h}, ${color.s}%, ${color.l}%, ${opacity !== null && opacity !== void 0 ? opacity : 1})`;
4880}
4881function getStyleFromHsv(color, opacity) {
4882 return getStyleFromHsl(hsvToHsl(color), opacity);
4883}
4884function colorMix(color1, color2, size1, size2) {
4885 let rgb1 = color1,
4886 rgb2 = color2;
4887
4888 if (rgb1.r === undefined) {
4889 rgb1 = hslToRgb(color1);
4890 }
4891
4892 if (rgb2.r === undefined) {
4893 rgb2 = hslToRgb(color2);
4894 }
4895
4896 return {
4897 b: mix(rgb1.b, rgb2.b, size1, size2),
4898 g: mix(rgb1.g, rgb2.g, size1, size2),
4899 r: mix(rgb1.r, rgb2.r, size1, size2)
4900 };
4901}
4902function getLinkColor(p1, p2, linkColor) {
4903 var _a, _b;
4904
4905 if (linkColor === randomColorValue) {
4906 return getRandomRgbColor();
4907 } else if (linkColor === "mid") {
4908 const sourceColor = (_a = p1.getFillColor()) !== null && _a !== void 0 ? _a : p1.getStrokeColor(),
4909 destColor = (_b = p2 === null || p2 === void 0 ? void 0 : p2.getFillColor()) !== null && _b !== void 0 ? _b : p2 === null || p2 === void 0 ? void 0 : p2.getStrokeColor();
4910
4911 if (sourceColor && destColor && p2) {
4912 return colorMix(sourceColor, destColor, p1.getRadius(), p2.getRadius());
4913 } else {
4914 const hslColor = sourceColor !== null && sourceColor !== void 0 ? sourceColor : destColor;
4915
4916 if (hslColor) {
4917 return hslToRgb(hslColor);
4918 }
4919 }
4920 } else {
4921 return linkColor;
4922 }
4923}
4924function getLinkRandomColor(optColor, blink, consent) {
4925 const color = typeof optColor === "string" ? optColor : optColor.value;
4926
4927 if (color === randomColorValue) {
4928 if (consent) {
4929 return colorToRgb({
4930 value: color
4931 });
4932 } else if (blink) {
4933 return randomColorValue;
4934 } else {
4935 return midColorValue;
4936 }
4937 } else {
4938 return colorToRgb({
4939 value: color
4940 });
4941 }
4942}
4943function getHslFromAnimation(animation) {
4944 return animation !== undefined ? {
4945 h: animation.h.value,
4946 s: animation.s.value,
4947 l: animation.l.value
4948 } : undefined;
4949}
4950function getHslAnimationFromHsl(hsl, animationOptions, reduceFactor) {
4951 const resColor = {
4952 h: {
4953 enable: false,
4954 value: hsl.h
4955 },
4956 s: {
4957 enable: false,
4958 value: hsl.s
4959 },
4960 l: {
4961 enable: false,
4962 value: hsl.l
4963 }
4964 };
4965
4966 if (animationOptions) {
4967 setColorAnimation(resColor.h, animationOptions.h, reduceFactor);
4968 setColorAnimation(resColor.s, animationOptions.s, reduceFactor);
4969 setColorAnimation(resColor.l, animationOptions.l, reduceFactor);
4970 }
4971
4972 return resColor;
4973}
4974
4975function setColorAnimation(colorValue, colorAnimation, reduceFactor) {
4976 colorValue.enable = colorAnimation.enable;
4977
4978 if (colorValue.enable) {
4979 colorValue.velocity = getRangeValue(colorAnimation.speed) / 100 * reduceFactor;
4980
4981 if (colorAnimation.sync) {
4982 return;
4983 }
4984
4985 colorValue.status = 0;
4986 colorValue.velocity *= Math.random();
4987
4988 if (colorValue.value) {
4989 colorValue.value *= Math.random();
4990 }
4991 } else {
4992 colorValue.velocity = 0;
4993 }
4994}
4995;// CONCATENATED MODULE: ../../engine/dist/esm/Utils/CanvasUtils.js
4996
4997function drawLine(context, begin, end) {
4998 context.beginPath();
4999 context.moveTo(begin.x, begin.y);
5000 context.lineTo(end.x, end.y);
5001 context.closePath();
5002}
5003function drawTriangle(context, p1, p2, p3) {
5004 context.beginPath();
5005 context.moveTo(p1.x, p1.y);
5006 context.lineTo(p2.x, p2.y);
5007 context.lineTo(p3.x, p3.y);
5008 context.closePath();
5009}
5010function paintBase(context, dimension, baseColor) {
5011 context.save();
5012 context.fillStyle = baseColor !== null && baseColor !== void 0 ? baseColor : "rgba(0,0,0,0)";
5013 context.fillRect(0, 0, dimension.width, dimension.height);
5014 context.restore();
5015}
5016function clear(context, dimension) {
5017 context.clearRect(0, 0, dimension.width, dimension.height);
5018}
5019function drawConnectLine(context, width, lineStyle, begin, end) {
5020 context.save();
5021 drawLine(context, begin, end);
5022 context.lineWidth = width;
5023 context.strokeStyle = lineStyle;
5024 context.stroke();
5025 context.restore();
5026}
5027function gradient(context, p1, p2, opacity) {
5028 const gradStop = Math.floor(p2.getRadius() / p1.getRadius()),
5029 color1 = p1.getFillColor(),
5030 color2 = p2.getFillColor();
5031
5032 if (!color1 || !color2) {
5033 return;
5034 }
5035
5036 const sourcePos = p1.getPosition(),
5037 destPos = p2.getPosition(),
5038 midRgb = colorMix(color1, color2, p1.getRadius(), p2.getRadius()),
5039 grad = context.createLinearGradient(sourcePos.x, sourcePos.y, destPos.x, destPos.y);
5040 grad.addColorStop(0, getStyleFromHsl(color1, opacity));
5041 grad.addColorStop(gradStop > 1 ? 1 : gradStop, getStyleFromRgb(midRgb, opacity));
5042 grad.addColorStop(1, getStyleFromHsl(color2, opacity));
5043 return grad;
5044}
5045function drawGrabLine(context, width, begin, end, colorLine, opacity) {
5046 context.save();
5047 drawLine(context, begin, end);
5048 context.strokeStyle = getStyleFromRgb(colorLine, opacity);
5049 context.lineWidth = width;
5050 context.stroke();
5051 context.restore();
5052}
5053function drawParticle(container, context, particle, delta, colorStyles, backgroundMask, composite, radius, opacity, shadow) {
5054 var _a, _b, _c, _d;
5055
5056 const pos = particle.getPosition(),
5057 tiltOptions = particle.options.tilt,
5058 rollOptions = particle.options.roll;
5059 context.save();
5060
5061 if (tiltOptions.enable || rollOptions.enable) {
5062 const roll = rollOptions.enable && particle.roll,
5063 tilt = tiltOptions.enable && particle.tilt,
5064 rollHorizontal = roll && (rollOptions.mode === "horizontal" || rollOptions.mode === "both"),
5065 rollVertical = roll && (rollOptions.mode === "vertical" || rollOptions.mode === "both");
5066 context.setTransform(rollHorizontal ? Math.cos(particle.roll.angle) : 1, tilt ? Math.cos(particle.tilt.value) * particle.tilt.cosDirection : 0, tilt ? Math.sin(particle.tilt.value) * particle.tilt.sinDirection : 0, rollVertical ? Math.sin(particle.roll.angle) : 1, pos.x, pos.y);
5067 } else {
5068 context.translate(pos.x, pos.y);
5069 }
5070
5071 context.beginPath();
5072 const angle = ((_b = (_a = particle.rotate) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 0) + (particle.options.rotate.path ? particle.velocity.angle : 0);
5073
5074 if (angle !== 0) {
5075 context.rotate(angle);
5076 }
5077
5078 if (backgroundMask) {
5079 context.globalCompositeOperation = composite;
5080 }
5081
5082 const shadowColor = particle.shadowColor;
5083
5084 if (shadow.enable && shadowColor) {
5085 context.shadowBlur = shadow.blur;
5086 context.shadowColor = getStyleFromRgb(shadowColor);
5087 context.shadowOffsetX = shadow.offset.x;
5088 context.shadowOffsetY = shadow.offset.y;
5089 }
5090
5091 if (colorStyles.fill) {
5092 context.fillStyle = colorStyles.fill;
5093 }
5094
5095 const stroke = particle.stroke;
5096 context.lineWidth = (_c = particle.strokeWidth) !== null && _c !== void 0 ? _c : 0;
5097
5098 if (colorStyles.stroke) {
5099 context.strokeStyle = colorStyles.stroke;
5100 }
5101
5102 drawShape(container, context, particle, radius, opacity, delta);
5103
5104 if (((_d = stroke === null || stroke === void 0 ? void 0 : stroke.width) !== null && _d !== void 0 ? _d : 0) > 0) {
5105 context.stroke();
5106 }
5107
5108 if (particle.close) {
5109 context.closePath();
5110 }
5111
5112 if (particle.fill) {
5113 context.fill();
5114 }
5115
5116 context.restore();
5117 context.save();
5118
5119 if (tiltOptions.enable && particle.tilt) {
5120 context.setTransform(1, Math.cos(particle.tilt.value) * particle.tilt.cosDirection, Math.sin(particle.tilt.value) * particle.tilt.sinDirection, 1, pos.x, pos.y);
5121 } else {
5122 context.translate(pos.x, pos.y);
5123 }
5124
5125 if (angle !== 0) {
5126 context.rotate(angle);
5127 }
5128
5129 if (backgroundMask) {
5130 context.globalCompositeOperation = composite;
5131 }
5132
5133 drawShapeAfterEffect(container, context, particle, radius, opacity, delta);
5134 context.restore();
5135}
5136function drawShape(container, context, particle, radius, opacity, delta) {
5137 if (!particle.shape) {
5138 return;
5139 }
5140
5141 const drawer = container.drawers.get(particle.shape);
5142
5143 if (!drawer) {
5144 return;
5145 }
5146
5147 drawer.draw(context, particle, radius, opacity, delta, container.retina.pixelRatio);
5148}
5149function drawShapeAfterEffect(container, context, particle, radius, opacity, delta) {
5150 if (!particle.shape) {
5151 return;
5152 }
5153
5154 const drawer = container.drawers.get(particle.shape);
5155
5156 if (!(drawer === null || drawer === void 0 ? void 0 : drawer.afterEffect)) {
5157 return;
5158 }
5159
5160 drawer.afterEffect(context, particle, radius, opacity, delta, container.retina.pixelRatio);
5161}
5162function drawPlugin(context, plugin, delta) {
5163 if (!plugin.draw) {
5164 return;
5165 }
5166
5167 context.save();
5168 plugin.draw(context, delta);
5169 context.restore();
5170}
5171function drawParticlePlugin(context, plugin, particle, delta) {
5172 if (!plugin.drawParticle) {
5173 return;
5174 }
5175
5176 context.save();
5177 plugin.drawParticle(context, particle, delta);
5178 context.restore();
5179}
5180function drawEllipse(context, particle, fillColorValue, radius, opacity, width, rotation, start, end) {
5181 if (width <= 0) {
5182 return;
5183 }
5184
5185 const pos = particle.getPosition();
5186
5187 if (fillColorValue) {
5188 context.strokeStyle = getStyleFromHsl(fillColorValue, opacity);
5189 }
5190
5191 context.lineWidth = width;
5192 const rotationRadian = rotation * Math.PI / 180;
5193 context.beginPath();
5194 context.ellipse(pos.x, pos.y, radius / 2, radius * 2, rotationRadian, start, end);
5195 context.stroke();
5196}
5197function alterHsl(color, type, value) {
5198 return {
5199 h: color.h,
5200 s: color.s,
5201 l: color.l + (type === "darken" ? -1 : 1) * value
5202 };
5203}
5204;// CONCATENATED MODULE: ../../engine/dist/esm/Core/Canvas.js
5205
5206
5207
5208
5209class Canvas {
5210 constructor(container) {
5211 this.container = container;
5212 this.size = {
5213 height: 0,
5214 width: 0
5215 };
5216 this.context = null;
5217 this.generatedCanvas = false;
5218 }
5219
5220 init() {
5221 this.resize();
5222 this.initStyle();
5223 this.initCover();
5224 this.initTrail();
5225 this.initBackground();
5226 this.paint();
5227 }
5228
5229 loadCanvas(canvas) {
5230 var _a;
5231
5232 if (this.generatedCanvas) {
5233 (_a = this.element) === null || _a === void 0 ? void 0 : _a.remove();
5234 }
5235
5236 this.generatedCanvas = canvas.dataset && generatedAttribute in canvas.dataset ? canvas.dataset[generatedAttribute] === "true" : this.generatedCanvas;
5237 this.element = canvas;
5238 this.originalStyle = deepExtend({}, this.element.style);
5239 this.size.height = canvas.offsetHeight;
5240 this.size.width = canvas.offsetWidth;
5241 this.context = this.element.getContext("2d");
5242 this.container.retina.init();
5243 this.initBackground();
5244 }
5245
5246 destroy() {
5247 var _a;
5248
5249 if (this.generatedCanvas) {
5250 (_a = this.element) === null || _a === void 0 ? void 0 : _a.remove();
5251 }
5252
5253 this.draw(ctx => {
5254 clear(ctx, this.size);
5255 });
5256 }
5257
5258 paint() {
5259 const options = this.container.actualOptions;
5260 this.draw(ctx => {
5261 if (options.backgroundMask.enable && options.backgroundMask.cover) {
5262 clear(ctx, this.size);
5263 this.paintBase(this.coverColorStyle);
5264 } else {
5265 this.paintBase();
5266 }
5267 });
5268 }
5269
5270 clear() {
5271 const options = this.container.actualOptions,
5272 trail = options.particles.move.trail;
5273
5274 if (options.backgroundMask.enable) {
5275 this.paint();
5276 } else if (trail.enable && trail.length > 0 && this.trailFillColor) {
5277 this.paintBase(getStyleFromRgb(this.trailFillColor, 1 / trail.length));
5278 } else {
5279 this.draw(ctx => {
5280 clear(ctx, this.size);
5281 });
5282 }
5283 }
5284
5285 async windowResize() {
5286 if (!this.element) {
5287 return;
5288 }
5289
5290 this.resize();
5291 const container = this.container,
5292 needsRefresh = container.updateActualOptions();
5293 container.particles.setDensity();
5294
5295 for (const [, plugin] of container.plugins) {
5296 if (plugin.resize !== undefined) {
5297 plugin.resize();
5298 }
5299 }
5300
5301 if (needsRefresh) {
5302 await container.refresh();
5303 }
5304 }
5305
5306 resize() {
5307 if (!this.element) {
5308 return;
5309 }
5310
5311 const container = this.container,
5312 pxRatio = container.retina.pixelRatio,
5313 size = container.canvas.size,
5314 newSize = {
5315 width: this.element.offsetWidth * pxRatio,
5316 height: this.element.offsetHeight * pxRatio
5317 };
5318
5319 if (newSize.height === size.height && newSize.width === size.width && newSize.height === this.element.height && newSize.width === this.element.width) {
5320 return;
5321 }
5322
5323 const oldSize = Object.assign({}, size);
5324 this.element.width = size.width = this.element.offsetWidth * pxRatio;
5325 this.element.height = size.height = this.element.offsetHeight * pxRatio;
5326
5327 if (this.container.started) {
5328 this.resizeFactor = {
5329 width: size.width / oldSize.width,
5330 height: size.height / oldSize.height
5331 };
5332 }
5333 }
5334
5335 drawConnectLine(p1, p2) {
5336 this.draw(ctx => {
5337 var _a;
5338
5339 const lineStyle = this.lineStyle(p1, p2);
5340
5341 if (!lineStyle) {
5342 return;
5343 }
5344
5345 const pos1 = p1.getPosition(),
5346 pos2 = p2.getPosition();
5347 drawConnectLine(ctx, (_a = p1.retina.linksWidth) !== null && _a !== void 0 ? _a : this.container.retina.linksWidth, lineStyle, pos1, pos2);
5348 });
5349 }
5350
5351 drawGrabLine(particle, lineColor, opacity, mousePos) {
5352 const container = this.container;
5353 this.draw(ctx => {
5354 var _a;
5355
5356 const beginPos = particle.getPosition();
5357 drawGrabLine(ctx, (_a = particle.retina.linksWidth) !== null && _a !== void 0 ? _a : container.retina.linksWidth, beginPos, mousePos, lineColor, opacity);
5358 });
5359 }
5360
5361 drawParticle(particle, delta) {
5362 var _a, _b, _c, _d, _e, _f;
5363
5364 if (particle.spawning || particle.destroyed) {
5365 return;
5366 }
5367
5368 const radius = particle.getRadius();
5369
5370 if (radius <= 0) {
5371 return;
5372 }
5373
5374 const pfColor = particle.getFillColor(),
5375 psColor = (_a = particle.getStrokeColor()) !== null && _a !== void 0 ? _a : pfColor;
5376
5377 if (!pfColor && !psColor) {
5378 return;
5379 }
5380
5381 let [fColor, sColor] = this.getPluginParticleColors(particle);
5382
5383 if (!fColor || !sColor) {
5384 if (!fColor) {
5385 fColor = pfColor ? pfColor : undefined;
5386 }
5387
5388 if (!sColor) {
5389 sColor = psColor ? psColor : undefined;
5390 }
5391 }
5392
5393 const options = this.container.actualOptions,
5394 zIndexOptions = particle.options.zIndex,
5395 zOpacityFactor = (1 - particle.zIndexFactor) ** zIndexOptions.opacityRate,
5396 opacity = (_d = (_b = particle.bubble.opacity) !== null && _b !== void 0 ? _b : (_c = particle.opacity) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : 1,
5397 strokeOpacity = (_f = (_e = particle.stroke) === null || _e === void 0 ? void 0 : _e.opacity) !== null && _f !== void 0 ? _f : opacity,
5398 zOpacity = opacity * zOpacityFactor,
5399 zStrokeOpacity = strokeOpacity * zOpacityFactor;
5400 const colorStyles = {
5401 fill: fColor ? getStyleFromHsl(fColor, zOpacity) : undefined
5402 };
5403 colorStyles.stroke = sColor ? getStyleFromHsl(sColor, zStrokeOpacity) : colorStyles.fill;
5404 this.draw(ctx => {
5405 const zSizeFactor = (1 - particle.zIndexFactor) ** zIndexOptions.sizeRate,
5406 container = this.container;
5407
5408 for (const updater of container.particles.updaters) {
5409 if (updater.beforeDraw) {
5410 updater.beforeDraw(particle);
5411 }
5412
5413 if (updater.getColorStyles) {
5414 const {
5415 fill,
5416 stroke
5417 } = updater.getColorStyles(particle, ctx, radius, zOpacity);
5418
5419 if (fill) {
5420 colorStyles.fill = fill;
5421 }
5422
5423 if (stroke) {
5424 colorStyles.stroke = stroke;
5425 }
5426 }
5427 }
5428
5429 drawParticle(container, ctx, particle, delta, colorStyles, options.backgroundMask.enable, options.backgroundMask.composite, radius * zSizeFactor, zOpacity, particle.options.shadow);
5430
5431 for (const updater of container.particles.updaters) {
5432 if (updater.afterDraw) {
5433 updater.afterDraw(particle);
5434 }
5435 }
5436 });
5437 }
5438
5439 drawPlugin(plugin, delta) {
5440 this.draw(ctx => {
5441 drawPlugin(ctx, plugin, delta);
5442 });
5443 }
5444
5445 drawParticlePlugin(plugin, particle, delta) {
5446 this.draw(ctx => {
5447 drawParticlePlugin(ctx, plugin, particle, delta);
5448 });
5449 }
5450
5451 initBackground() {
5452 const options = this.container.actualOptions,
5453 background = options.background,
5454 element = this.element,
5455 elementStyle = element === null || element === void 0 ? void 0 : element.style;
5456
5457 if (!elementStyle) {
5458 return;
5459 }
5460
5461 if (background.color) {
5462 const color = colorToRgb(background.color);
5463 elementStyle.backgroundColor = color ? getStyleFromRgb(color, background.opacity) : "";
5464 } else {
5465 elementStyle.backgroundColor = "";
5466 }
5467
5468 elementStyle.backgroundImage = background.image || "";
5469 elementStyle.backgroundPosition = background.position || "";
5470 elementStyle.backgroundRepeat = background.repeat || "";
5471 elementStyle.backgroundSize = background.size || "";
5472 }
5473
5474 draw(cb) {
5475 if (!this.context) {
5476 return;
5477 }
5478
5479 return cb(this.context);
5480 }
5481
5482 initCover() {
5483 const options = this.container.actualOptions,
5484 cover = options.backgroundMask.cover,
5485 color = cover.color,
5486 coverRgb = colorToRgb(color);
5487
5488 if (coverRgb) {
5489 const coverColor = {
5490 r: coverRgb.r,
5491 g: coverRgb.g,
5492 b: coverRgb.b,
5493 a: cover.opacity
5494 };
5495 this.coverColorStyle = getStyleFromRgb(coverColor, coverColor.a);
5496 }
5497 }
5498
5499 initTrail() {
5500 const options = this.container.actualOptions,
5501 trail = options.particles.move.trail,
5502 fillColor = colorToRgb(trail.fillColor);
5503
5504 if (fillColor) {
5505 const trail = options.particles.move.trail;
5506 this.trailFillColor = {
5507 r: fillColor.r,
5508 g: fillColor.g,
5509 b: fillColor.b,
5510 a: 1 / trail.length
5511 };
5512 }
5513 }
5514
5515 getPluginParticleColors(particle) {
5516 let fColor, sColor;
5517
5518 for (const [, plugin] of this.container.plugins) {
5519 if (!fColor && plugin.particleFillColor) {
5520 fColor = colorToHsl(plugin.particleFillColor(particle));
5521 }
5522
5523 if (!sColor && plugin.particleStrokeColor) {
5524 sColor = colorToHsl(plugin.particleStrokeColor(particle));
5525 }
5526
5527 if (fColor && sColor) {
5528 break;
5529 }
5530 }
5531
5532 return [fColor, sColor];
5533 }
5534
5535 initStyle() {
5536 const element = this.element,
5537 options = this.container.actualOptions;
5538
5539 if (!element) {
5540 return;
5541 }
5542
5543 const originalStyle = this.originalStyle;
5544
5545 if (options.fullScreen.enable) {
5546 this.originalStyle = deepExtend({}, element.style);
5547 element.style.setProperty("position", "fixed", "important");
5548 element.style.setProperty("z-index", options.fullScreen.zIndex.toString(10), "important");
5549 element.style.setProperty("top", "0", "important");
5550 element.style.setProperty("left", "0", "important");
5551 element.style.setProperty("width", "100%", "important");
5552 element.style.setProperty("height", "100%", "important");
5553 } else if (originalStyle) {
5554 element.style.position = originalStyle.position;
5555 element.style.zIndex = originalStyle.zIndex;
5556 element.style.top = originalStyle.top;
5557 element.style.left = originalStyle.left;
5558 element.style.width = originalStyle.width;
5559 element.style.height = originalStyle.height;
5560 }
5561
5562 for (const key in options.style) {
5563 if (!key || !options.style) {
5564 continue;
5565 }
5566
5567 const value = options.style[key];
5568
5569 if (!value) {
5570 continue;
5571 }
5572
5573 element.style.setProperty(key, value, "important");
5574 }
5575 }
5576
5577 paintBase(baseColor) {
5578 this.draw(ctx => {
5579 paintBase(ctx, this.size, baseColor);
5580 });
5581 }
5582
5583 lineStyle(p1, p2) {
5584 return this.draw(ctx => {
5585 const options = this.container.actualOptions,
5586 connectOptions = options.interactivity.modes.connect;
5587 return gradient(ctx, p1, p2, connectOptions.links.opacity);
5588 });
5589 }
5590
5591}
5592;// CONCATENATED MODULE: ../../engine/dist/esm/Core/Utils/EventListeners.js
5593
5594
5595
5596function manageListener(element, event, handler, add, options) {
5597 if (add) {
5598 let addOptions = {
5599 passive: true
5600 };
5601
5602 if (typeof options === "boolean") {
5603 addOptions.capture = options;
5604 } else if (options !== undefined) {
5605 addOptions = options;
5606 }
5607
5608 element.addEventListener(event, handler, addOptions);
5609 } else {
5610 const removeOptions = options;
5611 element.removeEventListener(event, handler, removeOptions);
5612 }
5613}
5614
5615class EventListeners {
5616 constructor(container) {
5617 this.container = container;
5618 this.canPush = true;
5619
5620 this.mouseMoveHandler = e => this.mouseTouchMove(e);
5621
5622 this.touchStartHandler = e => this.mouseTouchMove(e);
5623
5624 this.touchMoveHandler = e => this.mouseTouchMove(e);
5625
5626 this.touchEndHandler = () => this.mouseTouchFinish();
5627
5628 this.mouseLeaveHandler = () => this.mouseTouchFinish();
5629
5630 this.touchCancelHandler = () => this.mouseTouchFinish();
5631
5632 this.touchEndClickHandler = e => this.mouseTouchClick(e);
5633
5634 this.mouseUpHandler = e => this.mouseTouchClick(e);
5635
5636 this.mouseDownHandler = () => this.mouseDown();
5637
5638 this.visibilityChangeHandler = () => this.handleVisibilityChange();
5639
5640 this.themeChangeHandler = e => this.handleThemeChange(e);
5641
5642 this.oldThemeChangeHandler = e => this.handleThemeChange(e);
5643
5644 this.resizeHandler = () => this.handleWindowResize();
5645 }
5646
5647 addListeners() {
5648 this.manageListeners(true);
5649 }
5650
5651 removeListeners() {
5652 this.manageListeners(false);
5653 }
5654
5655 manageListeners(add) {
5656 var _a;
5657
5658 const container = this.container,
5659 options = container.actualOptions,
5660 detectType = options.interactivity.detectsOn;
5661 let mouseLeaveTmpEvent = mouseLeaveEvent;
5662
5663 if (detectType === "window") {
5664 container.interactivity.element = window;
5665 mouseLeaveTmpEvent = mouseOutEvent;
5666 } else if (detectType === "parent" && container.canvas.element) {
5667 const canvasEl = container.canvas.element;
5668 container.interactivity.element = (_a = canvasEl.parentElement) !== null && _a !== void 0 ? _a : canvasEl.parentNode;
5669 } else {
5670 container.interactivity.element = container.canvas.element;
5671 }
5672
5673 const mediaMatch = !isSsr() && typeof matchMedia !== "undefined" && matchMedia("(prefers-color-scheme: dark)");
5674
5675 if (mediaMatch) {
5676 if (mediaMatch.addEventListener !== undefined) {
5677 manageListener(mediaMatch, "change", this.themeChangeHandler, add);
5678 } else if (mediaMatch.addListener !== undefined) {
5679 if (add) {
5680 mediaMatch.addListener(this.oldThemeChangeHandler);
5681 } else {
5682 mediaMatch.removeListener(this.oldThemeChangeHandler);
5683 }
5684 }
5685 }
5686
5687 const interactivityEl = container.interactivity.element;
5688
5689 if (!interactivityEl) {
5690 return;
5691 }
5692
5693 const html = interactivityEl;
5694
5695 if (options.interactivity.events.onHover.enable || options.interactivity.events.onClick.enable) {
5696 manageListener(interactivityEl, mouseMoveEvent, this.mouseMoveHandler, add);
5697 manageListener(interactivityEl, touchStartEvent, this.touchStartHandler, add);
5698 manageListener(interactivityEl, touchMoveEvent, this.touchMoveHandler, add);
5699
5700 if (!options.interactivity.events.onClick.enable) {
5701 manageListener(interactivityEl, touchEndEvent, this.touchEndHandler, add);
5702 } else {
5703 manageListener(interactivityEl, touchEndEvent, this.touchEndClickHandler, add);
5704 manageListener(interactivityEl, mouseUpEvent, this.mouseUpHandler, add);
5705 manageListener(interactivityEl, mouseDownEvent, this.mouseDownHandler, add);
5706 }
5707
5708 manageListener(interactivityEl, mouseLeaveTmpEvent, this.mouseLeaveHandler, add);
5709 manageListener(interactivityEl, touchCancelEvent, this.touchCancelHandler, add);
5710 }
5711
5712 if (container.canvas.element) {
5713 container.canvas.element.style.pointerEvents = html === container.canvas.element ? "initial" : "none";
5714 }
5715
5716 if (options.interactivity.events.resize) {
5717 if (typeof ResizeObserver !== "undefined") {
5718 if (this.resizeObserver && !add) {
5719 if (container.canvas.element) {
5720 this.resizeObserver.unobserve(container.canvas.element);
5721 }
5722
5723 this.resizeObserver.disconnect();
5724 delete this.resizeObserver;
5725 } else if (!this.resizeObserver && add && container.canvas.element) {
5726 this.resizeObserver = new ResizeObserver(entries => {
5727 const entry = entries.find(e => e.target === container.canvas.element);
5728
5729 if (!entry) {
5730 return;
5731 }
5732
5733 this.handleWindowResize();
5734 });
5735 this.resizeObserver.observe(container.canvas.element);
5736 }
5737 } else {
5738 manageListener(window, resizeEvent, this.resizeHandler, add);
5739 }
5740 }
5741
5742 if (document) {
5743 manageListener(document, visibilityChangeEvent, this.visibilityChangeHandler, add, false);
5744 }
5745 }
5746
5747 handleWindowResize() {
5748 if (this.resizeTimeout) {
5749 clearTimeout(this.resizeTimeout);
5750 delete this.resizeTimeout;
5751 }
5752
5753 this.resizeTimeout = setTimeout(async () => {
5754 var _a;
5755
5756 return (_a = this.container.canvas) === null || _a === void 0 ? void 0 : _a.windowResize();
5757 }, 500);
5758 }
5759
5760 handleVisibilityChange() {
5761 const container = this.container,
5762 options = container.actualOptions;
5763 this.mouseTouchFinish();
5764
5765 if (!options.pauseOnBlur) {
5766 return;
5767 }
5768
5769 if (document === null || document === void 0 ? void 0 : document.hidden) {
5770 container.pageHidden = true;
5771 container.pause();
5772 } else {
5773 container.pageHidden = false;
5774
5775 if (container.getAnimationStatus()) {
5776 container.play(true);
5777 } else {
5778 container.draw(true);
5779 }
5780 }
5781 }
5782
5783 mouseDown() {
5784 const interactivity = this.container.interactivity;
5785
5786 if (interactivity) {
5787 const mouse = interactivity.mouse;
5788 mouse.clicking = true;
5789 mouse.downPosition = mouse.position;
5790 }
5791 }
5792
5793 mouseTouchMove(e) {
5794 var _a, _b, _c, _d, _e, _f, _g;
5795
5796 const container = this.container,
5797 options = container.actualOptions;
5798
5799 if (!((_a = container.interactivity) === null || _a === void 0 ? void 0 : _a.element)) {
5800 return;
5801 }
5802
5803 container.interactivity.mouse.inside = true;
5804 let pos;
5805 const canvas = container.canvas.element;
5806
5807 if (e.type.startsWith("mouse")) {
5808 this.canPush = true;
5809 const mouseEvent = e;
5810
5811 if (container.interactivity.element === window) {
5812 if (canvas) {
5813 const clientRect = canvas.getBoundingClientRect();
5814 pos = {
5815 x: mouseEvent.clientX - clientRect.left,
5816 y: mouseEvent.clientY - clientRect.top
5817 };
5818 }
5819 } else if (options.interactivity.detectsOn === "parent") {
5820 const source = mouseEvent.target;
5821 const target = mouseEvent.currentTarget;
5822 const canvasEl = container.canvas.element;
5823
5824 if (source && target && canvasEl) {
5825 const sourceRect = source.getBoundingClientRect();
5826 const targetRect = target.getBoundingClientRect();
5827 const canvasRect = canvasEl.getBoundingClientRect();
5828 pos = {
5829 x: mouseEvent.offsetX + 2 * sourceRect.left - (targetRect.left + canvasRect.left),
5830 y: mouseEvent.offsetY + 2 * sourceRect.top - (targetRect.top + canvasRect.top)
5831 };
5832 } else {
5833 pos = {
5834 x: (_b = mouseEvent.offsetX) !== null && _b !== void 0 ? _b : mouseEvent.clientX,
5835 y: (_c = mouseEvent.offsetY) !== null && _c !== void 0 ? _c : mouseEvent.clientY
5836 };
5837 }
5838 } else {
5839 if (mouseEvent.target === container.canvas.element) {
5840 pos = {
5841 x: (_d = mouseEvent.offsetX) !== null && _d !== void 0 ? _d : mouseEvent.clientX,
5842 y: (_e = mouseEvent.offsetY) !== null && _e !== void 0 ? _e : mouseEvent.clientY
5843 };
5844 }
5845 }
5846 } else {
5847 this.canPush = e.type !== "touchmove";
5848 const touchEvent = e;
5849 const lastTouch = touchEvent.touches[touchEvent.touches.length - 1];
5850 const canvasRect = canvas === null || canvas === void 0 ? void 0 : canvas.getBoundingClientRect();
5851 pos = {
5852 x: lastTouch.clientX - ((_f = canvasRect === null || canvasRect === void 0 ? void 0 : canvasRect.left) !== null && _f !== void 0 ? _f : 0),
5853 y: lastTouch.clientY - ((_g = canvasRect === null || canvasRect === void 0 ? void 0 : canvasRect.top) !== null && _g !== void 0 ? _g : 0)
5854 };
5855 }
5856
5857 const pxRatio = container.retina.pixelRatio;
5858
5859 if (pos) {
5860 pos.x *= pxRatio;
5861 pos.y *= pxRatio;
5862 }
5863
5864 container.interactivity.mouse.position = pos;
5865 container.interactivity.status = mouseMoveEvent;
5866 }
5867
5868 mouseTouchFinish() {
5869 const interactivity = this.container.interactivity;
5870
5871 if (!interactivity) {
5872 return;
5873 }
5874
5875 const mouse = interactivity.mouse;
5876 delete mouse.position;
5877 delete mouse.clickPosition;
5878 delete mouse.downPosition;
5879 interactivity.status = mouseLeaveEvent;
5880 mouse.inside = false;
5881 mouse.clicking = false;
5882 }
5883
5884 mouseTouchClick(e) {
5885 const container = this.container,
5886 options = container.actualOptions,
5887 mouse = container.interactivity.mouse;
5888 mouse.inside = true;
5889 let handled = false;
5890 const mousePosition = mouse.position;
5891
5892 if (!mousePosition || !options.interactivity.events.onClick.enable) {
5893 return;
5894 }
5895
5896 for (const [, plugin] of container.plugins) {
5897 if (!plugin.clickPositionValid) {
5898 continue;
5899 }
5900
5901 handled = plugin.clickPositionValid(mousePosition);
5902
5903 if (handled) {
5904 break;
5905 }
5906 }
5907
5908 if (!handled) {
5909 this.doMouseTouchClick(e);
5910 }
5911
5912 mouse.clicking = false;
5913 }
5914
5915 doMouseTouchClick(e) {
5916 const container = this.container,
5917 options = container.actualOptions;
5918
5919 if (this.canPush) {
5920 const mousePos = container.interactivity.mouse.position;
5921
5922 if (!mousePos) {
5923 return;
5924 }
5925
5926 container.interactivity.mouse.clickPosition = {
5927 x: mousePos.x,
5928 y: mousePos.y
5929 };
5930 container.interactivity.mouse.clickTime = new Date().getTime();
5931 const onClick = options.interactivity.events.onClick;
5932
5933 if (onClick.mode instanceof Array) {
5934 for (const mode of onClick.mode) {
5935 this.handleClickMode(mode);
5936 }
5937 } else {
5938 this.handleClickMode(onClick.mode);
5939 }
5940 }
5941
5942 if (e.type === "touchend") {
5943 setTimeout(() => this.mouseTouchFinish(), 500);
5944 }
5945 }
5946
5947 handleThemeChange(e) {
5948 const mediaEvent = e,
5949 themeName = mediaEvent.matches ? this.container.options.defaultDarkTheme : this.container.options.defaultLightTheme,
5950 theme = this.container.options.themes.find(theme => theme.name === themeName);
5951
5952 if (theme && theme.default.auto) {
5953 this.container.loadTheme(themeName);
5954 }
5955 }
5956
5957 handleClickMode(mode) {
5958 this.container.handleClickMode(mode);
5959 }
5960
5961}
5962;// CONCATENATED MODULE: ../../engine/dist/esm/Core/Utils/FrameManager.js
5963class FrameManager {
5964 constructor(container) {
5965 this.container = container;
5966 }
5967
5968 async nextFrame(timestamp) {
5969 var _a;
5970
5971 try {
5972 const container = this.container;
5973
5974 if (container.lastFrameTime !== undefined && timestamp < container.lastFrameTime + 1000 / container.fpsLimit) {
5975 container.draw(false);
5976 return;
5977 }
5978
5979 (_a = container.lastFrameTime) !== null && _a !== void 0 ? _a : container.lastFrameTime = timestamp;
5980 const deltaValue = timestamp - container.lastFrameTime,
5981 delta = {
5982 value: deltaValue,
5983 factor: 60 * deltaValue / 1000
5984 };
5985 container.lifeTime += delta.value;
5986 container.lastFrameTime = timestamp;
5987
5988 if (deltaValue > 1000) {
5989 container.draw(false);
5990 return;
5991 }
5992
5993 await container.particles.draw(delta);
5994
5995 if (container.duration > 0 && container.lifeTime > container.duration) {
5996 container.destroy();
5997 return;
5998 }
5999
6000 if (container.getAnimationStatus()) {
6001 container.draw(false);
6002 }
6003 } catch (e) {
6004 console.error("tsParticles error in animation loop", e);
6005 }
6006 }
6007
6008}
6009;// CONCATENATED MODULE: ../../engine/dist/esm/Core/Utils/InteractionManager.js
6010var InteractionManager_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function (receiver, state, value, kind, f) {
6011 if (kind === "m") throw new TypeError("Private method is not writable");
6012 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
6013 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6014 return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
6015};
6016
6017var InteractionManager_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function (receiver, state, kind, f) {
6018 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
6019 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
6020 return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6021};
6022
6023var _InteractionManager_engine;
6024
6025class InteractionManager {
6026 constructor(engine, container) {
6027 this.container = container;
6028
6029 _InteractionManager_engine.set(this, void 0);
6030
6031 InteractionManager_classPrivateFieldSet(this, _InteractionManager_engine, engine, "f");
6032
6033 this.externalInteractors = [];
6034 this.particleInteractors = [];
6035 this.init();
6036 }
6037
6038 init() {
6039 const interactors = InteractionManager_classPrivateFieldGet(this, _InteractionManager_engine, "f").plugins.getInteractors(this.container, true);
6040
6041 this.externalInteractors = [];
6042 this.particleInteractors = [];
6043
6044 for (const interactor of interactors) {
6045 switch (interactor.type) {
6046 case 0:
6047 this.externalInteractors.push(interactor);
6048 break;
6049
6050 case 1:
6051 this.particleInteractors.push(interactor);
6052 break;
6053 }
6054 }
6055 }
6056
6057 async externalInteract(delta) {
6058 for (const interactor of this.externalInteractors) {
6059 if (interactor.isEnabled()) {
6060 await interactor.interact(delta);
6061 }
6062 }
6063 }
6064
6065 async particlesInteract(particle, delta) {
6066 for (const interactor of this.externalInteractors) {
6067 interactor.reset(particle);
6068 }
6069
6070 for (const interactor of this.particleInteractors) {
6071 if (interactor.isEnabled(particle)) {
6072 await interactor.interact(particle, delta);
6073 }
6074 }
6075 }
6076
6077 handleClickMode(mode) {
6078 for (const interactor of this.externalInteractors) {
6079 if (interactor.handleClickMode) {
6080 interactor.handleClickMode(mode);
6081 }
6082 }
6083 }
6084
6085}
6086_InteractionManager_engine = new WeakMap();
6087;// CONCATENATED MODULE: ../../engine/dist/esm/Core/Utils/Vector3d.js
6088
6089class Vector3d extends Vector {
6090 constructor(xOrCoords, y, z) {
6091 super(xOrCoords, y);
6092
6093 if (typeof xOrCoords !== "number" && xOrCoords) {
6094 this.z = xOrCoords.z;
6095 } else if (z !== undefined) {
6096 this.z = z;
6097 } else {
6098 throw new Error("tsParticles - Vector not initialized correctly");
6099 }
6100 }
6101
6102 static clone(source) {
6103 return Vector3d.create(source.x, source.y, source.z);
6104 }
6105
6106 static create(x, y, z) {
6107 return new Vector3d(x, y, z);
6108 }
6109
6110 static get origin() {
6111 return Vector3d.create(0, 0, 0);
6112 }
6113
6114 add(v) {
6115 return v instanceof Vector3d ? Vector3d.create(this.x + v.x, this.y + v.y, this.z + v.z) : super.add(v);
6116 }
6117
6118 addTo(v) {
6119 super.addTo(v);
6120
6121 if (v instanceof Vector3d) {
6122 this.z += v.z;
6123 }
6124 }
6125
6126 sub(v) {
6127 return v instanceof Vector3d ? Vector3d.create(this.x - v.x, this.y - v.y, this.z - v.z) : super.sub(v);
6128 }
6129
6130 subFrom(v) {
6131 super.subFrom(v);
6132
6133 if (v instanceof Vector3d) {
6134 this.z -= v.z;
6135 }
6136 }
6137
6138 mult(n) {
6139 return Vector3d.create(this.x * n, this.y * n, this.z * n);
6140 }
6141
6142 multTo(n) {
6143 super.multTo(n);
6144 this.z *= n;
6145 }
6146
6147 div(n) {
6148 return Vector3d.create(this.x / n, this.y / n, this.z / n);
6149 }
6150
6151 divTo(n) {
6152 super.divTo(n);
6153 this.z /= n;
6154 }
6155
6156 copy() {
6157 return Vector3d.clone(this);
6158 }
6159
6160 setTo(v) {
6161 super.setTo(v);
6162 const v3d = v;
6163
6164 if (v3d.z !== undefined) {
6165 this.z = v3d.z;
6166 }
6167 }
6168
6169}
6170;// CONCATENATED MODULE: ../../engine/dist/esm/Core/Particle.js
6171var Particle_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function (receiver, state, value, kind, f) {
6172 if (kind === "m") throw new TypeError("Private method is not writable");
6173 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
6174 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6175 return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
6176};
6177
6178var Particle_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function (receiver, state, kind, f) {
6179 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
6180 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
6181 return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6182};
6183
6184var _Particle_engine;
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194const fixOutMode = data => {
6195 if (!(isInArray(data.outMode, data.checkModes) || isInArray(data.outMode, data.checkModes))) {
6196 return;
6197 }
6198
6199 if (data.coord > data.maxCoord - data.radius * 2) {
6200 data.setCb(-data.radius);
6201 } else if (data.coord < data.radius * 2) {
6202 data.setCb(data.radius);
6203 }
6204};
6205
6206class Particle {
6207 constructor(engine, id, container, position, overrideOptions, group) {
6208 var _a, _b, _c, _d, _e, _f, _g;
6209
6210 this.id = id;
6211 this.container = container;
6212 this.group = group;
6213
6214 _Particle_engine.set(this, void 0);
6215
6216 Particle_classPrivateFieldSet(this, _Particle_engine, engine, "f");
6217
6218 this.fill = true;
6219 this.close = true;
6220 this.lastPathTime = 0;
6221 this.destroyed = false;
6222 this.unbreakable = false;
6223 this.splitCount = 0;
6224 this.misplaced = false;
6225 this.retina = {
6226 maxDistance: {}
6227 };
6228 this.outType = "normal";
6229 this.ignoresResizeRatio = true;
6230 const pxRatio = container.retina.pixelRatio,
6231 mainOptions = container.actualOptions,
6232 particlesOptions = loadParticlesOptions(mainOptions.particles);
6233 const shapeType = particlesOptions.shape.type,
6234 reduceDuplicates = particlesOptions.reduceDuplicates;
6235 this.shape = shapeType instanceof Array ? itemFromArray(shapeType, this.id, reduceDuplicates) : shapeType;
6236
6237 if (overrideOptions === null || overrideOptions === void 0 ? void 0 : overrideOptions.shape) {
6238 if (overrideOptions.shape.type) {
6239 const overrideShapeType = overrideOptions.shape.type;
6240 this.shape = overrideShapeType instanceof Array ? itemFromArray(overrideShapeType, this.id, reduceDuplicates) : overrideShapeType;
6241 }
6242
6243 const shapeOptions = new Shape();
6244 shapeOptions.load(overrideOptions.shape);
6245
6246 if (this.shape) {
6247 this.shapeData = this.loadShapeData(shapeOptions, reduceDuplicates);
6248 }
6249 } else {
6250 this.shapeData = this.loadShapeData(particlesOptions.shape, reduceDuplicates);
6251 }
6252
6253 if (overrideOptions !== undefined) {
6254 particlesOptions.load(overrideOptions);
6255 }
6256
6257 if (((_a = this.shapeData) === null || _a === void 0 ? void 0 : _a.particles) !== undefined) {
6258 particlesOptions.load((_b = this.shapeData) === null || _b === void 0 ? void 0 : _b.particles);
6259 }
6260
6261 this.fill = (_d = (_c = this.shapeData) === null || _c === void 0 ? void 0 : _c.fill) !== null && _d !== void 0 ? _d : this.fill;
6262 this.close = (_f = (_e = this.shapeData) === null || _e === void 0 ? void 0 : _e.close) !== null && _f !== void 0 ? _f : this.close;
6263 this.options = particlesOptions;
6264 this.pathDelay = getValue(this.options.move.path.delay) * 1000;
6265 const zIndexValue = getRangeValue(this.options.zIndex.value);
6266 container.retina.initParticle(this);
6267 const sizeOptions = this.options.size,
6268 sizeRange = sizeOptions.value;
6269 this.size = {
6270 enable: sizeOptions.animation.enable,
6271 value: getRangeValue(sizeOptions.value) * container.retina.pixelRatio,
6272 max: getRangeMax(sizeRange) * pxRatio,
6273 min: getRangeMin(sizeRange) * pxRatio,
6274 loops: 0,
6275 maxLoops: getRangeValue(sizeOptions.animation.count)
6276 };
6277 const sizeAnimation = sizeOptions.animation;
6278
6279 if (sizeAnimation.enable) {
6280 this.size.status = 0;
6281
6282 switch (sizeAnimation.startValue) {
6283 case "min":
6284 this.size.value = this.size.min;
6285 this.size.status = 0;
6286 break;
6287
6288 case "random":
6289 this.size.value = randomInRange(this.size) * pxRatio;
6290 this.size.status = Math.random() >= 0.5 ? 0 : 1;
6291 break;
6292
6293 case "max":
6294 default:
6295 this.size.value = this.size.max;
6296 this.size.status = 1;
6297 break;
6298 }
6299
6300 this.size.velocity = ((_g = this.retina.sizeAnimationSpeed) !== null && _g !== void 0 ? _g : container.retina.sizeAnimationSpeed) / 100 * container.retina.reduceFactor;
6301
6302 if (!sizeAnimation.sync) {
6303 this.size.velocity *= Math.random();
6304 }
6305 }
6306
6307 this.bubble = {
6308 inRange: false
6309 };
6310 this.position = this.calcPosition(container, position, clamp(zIndexValue, 0, container.zLayers));
6311 this.initialPosition = this.position.copy();
6312 const canvasSize = container.canvas.size,
6313 moveCenterPerc = this.options.move.center;
6314 this.moveCenter = {
6315 x: canvasSize.width * moveCenterPerc.x / 100,
6316 y: canvasSize.height * moveCenterPerc.y / 100,
6317 radius: this.options.move.center.radius
6318 };
6319 this.direction = getParticleDirectionAngle(this.options.move.direction, this.position, this.moveCenter);
6320
6321 switch (this.options.move.direction) {
6322 case "inside":
6323 this.outType = "inside";
6324 break;
6325
6326 case "outside":
6327 this.outType = "outside";
6328 break;
6329 }
6330
6331 this.initialVelocity = this.calculateVelocity();
6332 this.velocity = this.initialVelocity.copy();
6333 this.moveDecay = 1 - getRangeValue(this.options.move.decay);
6334 const gravityOptions = this.options.move.gravity;
6335 this.gravity = {
6336 enable: gravityOptions.enable,
6337 acceleration: getRangeValue(gravityOptions.acceleration),
6338 inverse: gravityOptions.inverse
6339 };
6340 this.offset = Vector.origin;
6341 const particles = container.particles;
6342 particles.needsSort = particles.needsSort || particles.lastZIndex < this.position.z;
6343 particles.lastZIndex = this.position.z;
6344 this.zIndexFactor = this.position.z / container.zLayers;
6345 this.sides = 24;
6346 let drawer = container.drawers.get(this.shape);
6347
6348 if (!drawer) {
6349 drawer = Particle_classPrivateFieldGet(this, _Particle_engine, "f").plugins.getShapeDrawer(this.shape);
6350
6351 if (drawer) {
6352 container.drawers.set(this.shape, drawer);
6353 }
6354 }
6355
6356 if (drawer === null || drawer === void 0 ? void 0 : drawer.loadShape) {
6357 drawer === null || drawer === void 0 ? void 0 : drawer.loadShape(this);
6358 }
6359
6360 const sideCountFunc = drawer === null || drawer === void 0 ? void 0 : drawer.getSidesCount;
6361
6362 if (sideCountFunc) {
6363 this.sides = sideCountFunc(this);
6364 }
6365
6366 this.life = this.loadLife();
6367 this.spawning = this.life.delay > 0;
6368 this.shadowColor = colorToRgb(this.options.shadow.color);
6369
6370 for (const updater of container.particles.updaters) {
6371 if (updater.init) {
6372 updater.init(this);
6373 }
6374 }
6375
6376 for (const mover of container.particles.movers) {
6377 if (mover.init) {
6378 mover.init(this);
6379 }
6380 }
6381
6382 if (drawer && drawer.particleInit) {
6383 drawer.particleInit(container, this);
6384 }
6385
6386 for (const [, plugin] of container.plugins) {
6387 if (plugin.particleCreated) {
6388 plugin.particleCreated(this);
6389 }
6390 }
6391 }
6392
6393 isVisible() {
6394 return !this.destroyed && !this.spawning && this.isInsideCanvas();
6395 }
6396
6397 isInsideCanvas() {
6398 const radius = this.getRadius(),
6399 canvasSize = this.container.canvas.size;
6400 return this.position.x >= -radius && this.position.y >= -radius && this.position.y <= canvasSize.height + radius && this.position.x <= canvasSize.width + radius;
6401 }
6402
6403 draw(delta) {
6404 const container = this.container;
6405
6406 for (const [, plugin] of container.plugins) {
6407 container.canvas.drawParticlePlugin(plugin, this, delta);
6408 }
6409
6410 container.canvas.drawParticle(this, delta);
6411 }
6412
6413 getPosition() {
6414 return {
6415 x: this.position.x + this.offset.x,
6416 y: this.position.y + this.offset.y,
6417 z: this.position.z
6418 };
6419 }
6420
6421 getRadius() {
6422 var _a;
6423
6424 return (_a = this.bubble.radius) !== null && _a !== void 0 ? _a : this.size.value;
6425 }
6426
6427 getMass() {
6428 return this.getRadius() ** 2 * Math.PI / 2;
6429 }
6430
6431 getFillColor() {
6432 var _a, _b;
6433
6434 const color = (_a = this.bubble.color) !== null && _a !== void 0 ? _a : getHslFromAnimation(this.color);
6435
6436 if (color && this.roll && (this.backColor || this.roll.alter)) {
6437 const backFactor = this.options.roll.mode === "both" ? 2 : 1,
6438 backSum = this.options.roll.mode === "horizontal" ? Math.PI / 2 : 0,
6439 rolled = Math.floor((((_b = this.roll.angle) !== null && _b !== void 0 ? _b : 0) + backSum) / (Math.PI / backFactor)) % 2;
6440
6441 if (rolled) {
6442 if (this.backColor) {
6443 return this.backColor;
6444 }
6445
6446 if (this.roll.alter) {
6447 return alterHsl(color, this.roll.alter.type, this.roll.alter.value);
6448 }
6449 }
6450 }
6451
6452 return color;
6453 }
6454
6455 getStrokeColor() {
6456 var _a, _b;
6457
6458 return (_b = (_a = this.bubble.color) !== null && _a !== void 0 ? _a : getHslFromAnimation(this.strokeColor)) !== null && _b !== void 0 ? _b : this.getFillColor();
6459 }
6460
6461 destroy(override) {
6462 this.destroyed = true;
6463 this.bubble.inRange = false;
6464
6465 if (this.unbreakable) {
6466 return;
6467 }
6468
6469 this.destroyed = true;
6470 this.bubble.inRange = false;
6471
6472 for (const [, plugin] of this.container.plugins) {
6473 if (plugin.particleDestroyed) {
6474 plugin.particleDestroyed(this, override);
6475 }
6476 }
6477
6478 if (override) {
6479 return;
6480 }
6481
6482 const destroyOptions = this.options.destroy;
6483
6484 if (destroyOptions.mode === "split") {
6485 this.split();
6486 }
6487 }
6488
6489 reset() {
6490 if (this.opacity) {
6491 this.opacity.loops = 0;
6492 }
6493
6494 this.size.loops = 0;
6495 }
6496
6497 split() {
6498 const splitOptions = this.options.destroy.split;
6499
6500 if (splitOptions.count >= 0 && this.splitCount++ > splitOptions.count) {
6501 return;
6502 }
6503
6504 const rate = getValue(splitOptions.rate);
6505
6506 for (let i = 0; i < rate; i++) {
6507 this.container.particles.addSplitParticle(this);
6508 }
6509 }
6510
6511 calcPosition(container, position, zIndex, tryCount = 0) {
6512 var _a, _b, _c, _d;
6513
6514 for (const [, plugin] of container.plugins) {
6515 const pluginPos = plugin.particlePosition !== undefined ? plugin.particlePosition(position, this) : undefined;
6516
6517 if (pluginPos !== undefined) {
6518 return Vector3d.create(pluginPos.x, pluginPos.y, zIndex);
6519 }
6520 }
6521
6522 const canvasSize = container.canvas.size,
6523 exactPosition = calcExactPositionOrRandomFromSize({
6524 size: canvasSize,
6525 position: position
6526 }),
6527 pos = Vector3d.create(exactPosition.x, exactPosition.y, zIndex),
6528 radius = this.getRadius(),
6529 outModes = this.options.move.outModes,
6530 fixHorizontal = outMode => {
6531 fixOutMode({
6532 outMode,
6533 checkModes: ["bounce", "bounce-horizontal"],
6534 coord: pos.x,
6535 maxCoord: container.canvas.size.width,
6536 setCb: value => pos.x += value,
6537 radius
6538 });
6539 },
6540 fixVertical = outMode => {
6541 fixOutMode({
6542 outMode,
6543 checkModes: ["bounce", "bounce-vertical"],
6544 coord: pos.y,
6545 maxCoord: container.canvas.size.height,
6546 setCb: value => pos.y += value,
6547 radius
6548 });
6549 };
6550
6551 fixHorizontal((_a = outModes.left) !== null && _a !== void 0 ? _a : outModes.default);
6552 fixHorizontal((_b = outModes.right) !== null && _b !== void 0 ? _b : outModes.default);
6553 fixVertical((_c = outModes.top) !== null && _c !== void 0 ? _c : outModes.default);
6554 fixVertical((_d = outModes.bottom) !== null && _d !== void 0 ? _d : outModes.default);
6555
6556 if (this.checkOverlap(pos, tryCount)) {
6557 return this.calcPosition(container, undefined, zIndex, tryCount + 1);
6558 }
6559
6560 return pos;
6561 }
6562
6563 checkOverlap(pos, tryCount = 0) {
6564 const collisionsOptions = this.options.collisions,
6565 radius = this.getRadius();
6566
6567 if (!collisionsOptions.enable) {
6568 return false;
6569 }
6570
6571 const overlapOptions = collisionsOptions.overlap;
6572
6573 if (overlapOptions.enable) {
6574 return false;
6575 }
6576
6577 const retries = overlapOptions.retries;
6578
6579 if (retries >= 0 && tryCount > retries) {
6580 throw new Error("Particle is overlapping and can't be placed");
6581 }
6582
6583 let overlaps = false;
6584
6585 for (const particle of this.container.particles.array) {
6586 if (getDistance(pos, particle.position) < radius + particle.getRadius()) {
6587 overlaps = true;
6588 break;
6589 }
6590 }
6591
6592 return overlaps;
6593 }
6594
6595 calculateVelocity() {
6596 const baseVelocity = getParticleBaseVelocity(this.direction);
6597 const res = baseVelocity.copy();
6598 const moveOptions = this.options.move;
6599
6600 if (moveOptions.direction === "inside" || moveOptions.direction === "outside") {
6601 return res;
6602 }
6603
6604 const rad = Math.PI / 180 * getRangeValue(moveOptions.angle.value);
6605 const radOffset = Math.PI / 180 * getRangeValue(moveOptions.angle.offset);
6606 const range = {
6607 left: radOffset - rad / 2,
6608 right: radOffset + rad / 2
6609 };
6610
6611 if (!moveOptions.straight) {
6612 res.angle += randomInRange(setRangeValue(range.left, range.right));
6613 }
6614
6615 if (moveOptions.random && typeof moveOptions.speed === "number") {
6616 res.length *= Math.random();
6617 }
6618
6619 return res;
6620 }
6621
6622 loadShapeData(shapeOptions, reduceDuplicates) {
6623 const shapeData = shapeOptions.options[this.shape];
6624
6625 if (shapeData) {
6626 return deepExtend({}, shapeData instanceof Array ? itemFromArray(shapeData, this.id, reduceDuplicates) : shapeData);
6627 }
6628 }
6629
6630 loadLife() {
6631 const container = this.container,
6632 particlesOptions = this.options,
6633 lifeOptions = particlesOptions.life,
6634 life = {
6635 delay: container.retina.reduceFactor ? getRangeValue(lifeOptions.delay.value) * (lifeOptions.delay.sync ? 1 : Math.random()) / container.retina.reduceFactor * 1000 : 0,
6636 delayTime: 0,
6637 duration: container.retina.reduceFactor ? getRangeValue(lifeOptions.duration.value) * (lifeOptions.duration.sync ? 1 : Math.random()) / container.retina.reduceFactor * 1000 : 0,
6638 time: 0,
6639 count: particlesOptions.life.count
6640 };
6641
6642 if (life.duration <= 0) {
6643 life.duration = -1;
6644 }
6645
6646 if (life.count <= 0) {
6647 life.count = -1;
6648 }
6649
6650 return life;
6651 }
6652
6653}
6654_Particle_engine = new WeakMap();
6655;// CONCATENATED MODULE: ../../engine/dist/esm/Core/Utils/Point.js
6656class Point {
6657 constructor(position, particle) {
6658 this.position = position;
6659 this.particle = particle;
6660 }
6661
6662}
6663;// CONCATENATED MODULE: ../../engine/dist/esm/Core/Utils/Range.js
6664class Range {
6665 constructor(x, y) {
6666 this.position = {
6667 x: x,
6668 y: y
6669 };
6670 }
6671
6672}
6673;// CONCATENATED MODULE: ../../engine/dist/esm/Core/Utils/Circle.js
6674
6675
6676class Circle extends Range {
6677 constructor(x, y, radius) {
6678 super(x, y);
6679 this.radius = radius;
6680 }
6681
6682 contains(point) {
6683 return getDistance(point, this.position) <= this.radius;
6684 }
6685
6686 intersects(range) {
6687 const rect = range,
6688 circle = range,
6689 pos1 = this.position,
6690 pos2 = range.position,
6691 xDist = Math.abs(pos2.x - pos1.x),
6692 yDist = Math.abs(pos2.y - pos1.y),
6693 r = this.radius;
6694
6695 if (circle.radius !== undefined) {
6696 const rSum = r + circle.radius,
6697 dist = Math.sqrt(xDist * xDist + yDist + yDist);
6698 return rSum > dist;
6699 } else if (rect.size !== undefined) {
6700 const w = rect.size.width,
6701 h = rect.size.height,
6702 edges = Math.pow(xDist - w, 2) + Math.pow(yDist - h, 2);
6703
6704 if (xDist > r + w || yDist > r + h) {
6705 return false;
6706 }
6707
6708 if (xDist <= w || yDist <= h) {
6709 return true;
6710 }
6711
6712 return edges <= r * r;
6713 }
6714
6715 return false;
6716 }
6717
6718}
6719;// CONCATENATED MODULE: ../../engine/dist/esm/Core/Utils/Rectangle.js
6720
6721class Rectangle extends Range {
6722 constructor(x, y, width, height) {
6723 super(x, y);
6724 this.size = {
6725 height: height,
6726 width: width
6727 };
6728 }
6729
6730 contains(point) {
6731 const w = this.size.width,
6732 h = this.size.height,
6733 pos = this.position;
6734 return point.x >= pos.x && point.x <= pos.x + w && point.y >= pos.y && point.y <= pos.y + h;
6735 }
6736
6737 intersects(range) {
6738 const rect = range,
6739 circle = range,
6740 w = this.size.width,
6741 h = this.size.height,
6742 pos1 = this.position,
6743 pos2 = range.position;
6744
6745 if (circle.radius !== undefined) {
6746 return circle.intersects(this);
6747 }
6748
6749 if (!rect.size) {
6750 return false;
6751 }
6752
6753 const size2 = rect.size,
6754 w2 = size2.width,
6755 h2 = size2.height;
6756 return pos2.x < pos1.x + w && pos2.x + w2 > pos1.x && pos2.y < pos1.y + h && pos2.y + h2 > pos1.y;
6757 }
6758
6759}
6760;// CONCATENATED MODULE: ../../engine/dist/esm/Core/Utils/CircleWarp.js
6761
6762
6763class CircleWarp extends Circle {
6764 constructor(x, y, radius, canvasSize) {
6765 super(x, y, radius);
6766 this.canvasSize = canvasSize;
6767 this.canvasSize = Object.assign({}, canvasSize);
6768 }
6769
6770 contains(point) {
6771 if (super.contains(point)) {
6772 return true;
6773 }
6774
6775 const posNE = {
6776 x: point.x - this.canvasSize.width,
6777 y: point.y
6778 };
6779
6780 if (super.contains(posNE)) {
6781 return true;
6782 }
6783
6784 const posSE = {
6785 x: point.x - this.canvasSize.width,
6786 y: point.y - this.canvasSize.height
6787 };
6788
6789 if (super.contains(posSE)) {
6790 return true;
6791 }
6792
6793 const posSW = {
6794 x: point.x,
6795 y: point.y - this.canvasSize.height
6796 };
6797 return super.contains(posSW);
6798 }
6799
6800 intersects(range) {
6801 if (super.intersects(range)) {
6802 return true;
6803 }
6804
6805 const rect = range,
6806 circle = range,
6807 newPos = {
6808 x: range.position.x - this.canvasSize.width,
6809 y: range.position.y - this.canvasSize.height
6810 };
6811
6812 if (circle.radius !== undefined) {
6813 const biggerCircle = new Circle(newPos.x, newPos.y, circle.radius * 2);
6814 return super.intersects(biggerCircle);
6815 } else if (rect.size !== undefined) {
6816 const rectSW = new Rectangle(newPos.x, newPos.y, rect.size.width * 2, rect.size.height * 2);
6817 return super.intersects(rectSW);
6818 }
6819
6820 return false;
6821 }
6822
6823}
6824;// CONCATENATED MODULE: ../../engine/dist/esm/Core/Utils/QuadTree.js
6825
6826
6827
6828
6829class QuadTree {
6830 constructor(rectangle, capacity) {
6831 this.rectangle = rectangle;
6832 this.capacity = capacity;
6833 this.points = [];
6834 this.divided = false;
6835 }
6836
6837 insert(point) {
6838 var _a, _b, _c, _d, _e;
6839
6840 if (!this.rectangle.contains(point.position)) {
6841 return false;
6842 }
6843
6844 if (this.points.length < this.capacity) {
6845 this.points.push(point);
6846 return true;
6847 }
6848
6849 if (!this.divided) {
6850 this.subdivide();
6851 }
6852
6853 return (_e = ((_a = this.northEast) === null || _a === void 0 ? void 0 : _a.insert(point)) || ((_b = this.northWest) === null || _b === void 0 ? void 0 : _b.insert(point)) || ((_c = this.southEast) === null || _c === void 0 ? void 0 : _c.insert(point)) || ((_d = this.southWest) === null || _d === void 0 ? void 0 : _d.insert(point))) !== null && _e !== void 0 ? _e : false;
6854 }
6855
6856 queryCircle(position, radius) {
6857 return this.query(new Circle(position.x, position.y, radius));
6858 }
6859
6860 queryCircleWarp(position, radius, containerOrSize) {
6861 const container = containerOrSize,
6862 size = containerOrSize;
6863 return this.query(new CircleWarp(position.x, position.y, radius, container.canvas !== undefined ? container.canvas.size : size));
6864 }
6865
6866 queryRectangle(position, size) {
6867 return this.query(new Rectangle(position.x, position.y, size.width, size.height));
6868 }
6869
6870 query(range, found) {
6871 var _a, _b, _c, _d;
6872
6873 const res = found !== null && found !== void 0 ? found : [];
6874
6875 if (!range.intersects(this.rectangle)) {
6876 return [];
6877 }
6878
6879 for (const p of this.points) {
6880 if (!range.contains(p.position) && getDistance(range.position, p.position) > p.particle.getRadius()) {
6881 continue;
6882 }
6883
6884 res.push(p.particle);
6885 }
6886
6887 if (this.divided) {
6888 (_a = this.northEast) === null || _a === void 0 ? void 0 : _a.query(range, res);
6889 (_b = this.northWest) === null || _b === void 0 ? void 0 : _b.query(range, res);
6890 (_c = this.southEast) === null || _c === void 0 ? void 0 : _c.query(range, res);
6891 (_d = this.southWest) === null || _d === void 0 ? void 0 : _d.query(range, res);
6892 }
6893
6894 return res;
6895 }
6896
6897 subdivide() {
6898 const x = this.rectangle.position.x,
6899 y = this.rectangle.position.y,
6900 w = this.rectangle.size.width,
6901 h = this.rectangle.size.height,
6902 capacity = this.capacity;
6903 this.northEast = new QuadTree(new Rectangle(x, y, w / 2, h / 2), capacity);
6904 this.northWest = new QuadTree(new Rectangle(x + w / 2, y, w / 2, h / 2), capacity);
6905 this.southEast = new QuadTree(new Rectangle(x, y + h / 2, w / 2, h / 2), capacity);
6906 this.southWest = new QuadTree(new Rectangle(x + w / 2, y + h / 2, w / 2, h / 2), capacity);
6907 this.divided = true;
6908 }
6909
6910}
6911;// CONCATENATED MODULE: ../../engine/dist/esm/Core/Particles.js
6912var Particles_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function (receiver, state, value, kind, f) {
6913 if (kind === "m") throw new TypeError("Private method is not writable");
6914 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
6915 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6916 return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
6917};
6918
6919var Particles_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function (receiver, state, kind, f) {
6920 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
6921 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
6922 return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6923};
6924
6925var _Particles_engine;
6926
6927
6928
6929
6930
6931
6932
6933
6934class Particles {
6935 constructor(engine, container) {
6936 this.container = container;
6937
6938 _Particles_engine.set(this, void 0);
6939
6940 Particles_classPrivateFieldSet(this, _Particles_engine, engine, "f");
6941
6942 this.nextId = 0;
6943 this.array = [];
6944 this.zArray = [];
6945 this.limit = 0;
6946 this.needsSort = false;
6947 this.lastZIndex = 0;
6948 this.freqs = {
6949 links: new Map(),
6950 triangles: new Map()
6951 };
6952 this.interactionManager = new InteractionManager(Particles_classPrivateFieldGet(this, _Particles_engine, "f"), container);
6953 const canvasSize = this.container.canvas.size;
6954 this.linksColors = new Map();
6955 this.quadTree = new QuadTree(new Rectangle(-canvasSize.width / 4, -canvasSize.height / 4, canvasSize.width * 3 / 2, canvasSize.height * 3 / 2), 4);
6956 this.movers = Particles_classPrivateFieldGet(this, _Particles_engine, "f").plugins.getMovers(container, true);
6957 this.updaters = Particles_classPrivateFieldGet(this, _Particles_engine, "f").plugins.getUpdaters(container, true);
6958 }
6959
6960 get count() {
6961 return this.array.length;
6962 }
6963
6964 init() {
6965 var _a;
6966
6967 const container = this.container,
6968 options = container.actualOptions;
6969 this.lastZIndex = 0;
6970 this.needsSort = false;
6971 this.freqs.links = new Map();
6972 this.freqs.triangles = new Map();
6973 let handled = false;
6974 this.updaters = Particles_classPrivateFieldGet(this, _Particles_engine, "f").plugins.getUpdaters(container, true);
6975 this.interactionManager.init();
6976
6977 for (const [, plugin] of container.plugins) {
6978 if (plugin.particlesInitialization !== undefined) {
6979 handled = plugin.particlesInitialization();
6980 }
6981
6982 if (handled) {
6983 break;
6984 }
6985 }
6986
6987 this.addManualParticles();
6988
6989 if (!handled) {
6990 for (const group in options.particles.groups) {
6991 const groupOptions = options.particles.groups[group];
6992
6993 for (let i = this.count, j = 0; j < ((_a = groupOptions.number) === null || _a === void 0 ? void 0 : _a.value) && i < options.particles.number.value; i++, j++) {
6994 this.addParticle(undefined, groupOptions, group);
6995 }
6996 }
6997
6998 for (let i = this.count; i < options.particles.number.value; i++) {
6999 this.addParticle();
7000 }
7001 }
7002
7003 container.pathGenerator.init(container);
7004 }
7005
7006 async redraw() {
7007 this.clear();
7008 this.init();
7009 await this.draw({
7010 value: 0,
7011 factor: 0
7012 });
7013 }
7014
7015 removeAt(index, quantity = 1, group, override) {
7016 if (!(index >= 0 && index <= this.count)) {
7017 return;
7018 }
7019
7020 let deleted = 0;
7021
7022 for (let i = index; deleted < quantity && i < this.count; i++) {
7023 const particle = this.array[i];
7024
7025 if (!particle || particle.group !== group) {
7026 continue;
7027 }
7028
7029 particle.destroy(override);
7030 this.array.splice(i--, 1);
7031 const zIdx = this.zArray.indexOf(particle);
7032 this.zArray.splice(zIdx, 1);
7033 deleted++;
7034
7035 Particles_classPrivateFieldGet(this, _Particles_engine, "f").dispatchEvent("particleRemoved", {
7036 container: this.container,
7037 data: {
7038 particle
7039 }
7040 });
7041 }
7042 }
7043
7044 remove(particle, group, override) {
7045 this.removeAt(this.array.indexOf(particle), undefined, group, override);
7046 }
7047
7048 async update(delta) {
7049 const container = this.container,
7050 particlesToDelete = [];
7051 container.pathGenerator.update();
7052
7053 for (const [, plugin] of container.plugins) {
7054 if (plugin.update !== undefined) {
7055 plugin.update(delta);
7056 }
7057 }
7058
7059 for (const particle of this.array) {
7060 const resizeFactor = container.canvas.resizeFactor;
7061
7062 if (resizeFactor && !particle.ignoresResizeRatio) {
7063 particle.position.x *= resizeFactor.width;
7064 particle.position.y *= resizeFactor.height;
7065 }
7066
7067 particle.ignoresResizeRatio = false;
7068 particle.bubble.inRange = false;
7069
7070 for (const [, plugin] of this.container.plugins) {
7071 if (particle.destroyed) {
7072 break;
7073 }
7074
7075 if (plugin.particleUpdate) {
7076 plugin.particleUpdate(particle, delta);
7077 }
7078 }
7079
7080 for (const mover of this.movers) {
7081 if (mover.isEnabled(particle)) {
7082 mover.move(particle, delta);
7083 }
7084 }
7085
7086 if (particle.destroyed) {
7087 particlesToDelete.push(particle);
7088 continue;
7089 }
7090
7091 this.quadTree.insert(new Point(particle.getPosition(), particle));
7092 }
7093
7094 for (const particle of particlesToDelete) {
7095 this.remove(particle);
7096 }
7097
7098 await this.interactionManager.externalInteract(delta);
7099
7100 for (const particle of container.particles.array) {
7101 for (const updater of this.updaters) {
7102 updater.update(particle, delta);
7103 }
7104
7105 if (!particle.destroyed && !particle.spawning) {
7106 await this.interactionManager.particlesInteract(particle, delta);
7107 }
7108 }
7109
7110 delete container.canvas.resizeFactor;
7111 }
7112
7113 async draw(delta) {
7114 const container = this.container,
7115 canvasSize = this.container.canvas.size;
7116 this.quadTree = new QuadTree(new Rectangle(-canvasSize.width / 4, -canvasSize.height / 4, canvasSize.width * 3 / 2, canvasSize.height * 3 / 2), 4);
7117 container.canvas.clear();
7118 await this.update(delta);
7119
7120 if (this.needsSort) {
7121 this.zArray.sort((a, b) => b.position.z - a.position.z || a.id - b.id);
7122 this.lastZIndex = this.zArray[this.zArray.length - 1].position.z;
7123 this.needsSort = false;
7124 }
7125
7126 for (const [, plugin] of container.plugins) {
7127 container.canvas.drawPlugin(plugin, delta);
7128 }
7129
7130 for (const p of this.zArray) {
7131 p.draw(delta);
7132 }
7133 }
7134
7135 clear() {
7136 this.array = [];
7137 this.zArray = [];
7138 }
7139
7140 push(nb, mouse, overrideOptions, group) {
7141 this.pushing = true;
7142
7143 for (let i = 0; i < nb; i++) {
7144 this.addParticle(mouse === null || mouse === void 0 ? void 0 : mouse.position, overrideOptions, group);
7145 }
7146
7147 this.pushing = false;
7148 }
7149
7150 addParticle(position, overrideOptions, group) {
7151 const container = this.container,
7152 options = container.actualOptions,
7153 limit = options.particles.number.limit * container.density;
7154
7155 if (limit > 0) {
7156 const countToRemove = this.count + 1 - limit;
7157
7158 if (countToRemove > 0) {
7159 this.removeQuantity(countToRemove);
7160 }
7161 }
7162
7163 return this.pushParticle(position, overrideOptions, group);
7164 }
7165
7166 addSplitParticle(parent) {
7167 const splitOptions = parent.options.destroy.split;
7168 const options = loadParticlesOptions(parent.options);
7169 const factor = getValue(splitOptions.factor);
7170 options.color.load({
7171 value: {
7172 hsl: parent.getFillColor()
7173 }
7174 });
7175
7176 if (typeof options.size.value === "number") {
7177 options.size.value /= factor;
7178 } else {
7179 options.size.value.min /= factor;
7180 options.size.value.max /= factor;
7181 }
7182
7183 options.load(splitOptions.particles);
7184 const offset = splitOptions.sizeOffset ? setRangeValue(-parent.size.value, parent.size.value) : 0,
7185 position = {
7186 x: parent.position.x + randomInRange(offset),
7187 y: parent.position.y + randomInRange(offset)
7188 };
7189 return this.pushParticle(position, options, parent.group, particle => {
7190 if (particle.size.value < 0.5) {
7191 return false;
7192 }
7193
7194 particle.velocity.length = randomInRange(setRangeValue(parent.velocity.length, particle.velocity.length));
7195 particle.splitCount = parent.splitCount + 1;
7196 particle.unbreakable = true;
7197 setTimeout(() => {
7198 particle.unbreakable = false;
7199 }, 500);
7200 return true;
7201 });
7202 }
7203
7204 removeQuantity(quantity, group) {
7205 this.removeAt(0, quantity, group);
7206 }
7207
7208 getLinkFrequency(p1, p2) {
7209 const range = setRangeValue(p1.id, p2.id),
7210 key = `${getRangeMin(range)}_${getRangeMax(range)}`;
7211 let res = this.freqs.links.get(key);
7212
7213 if (res === undefined) {
7214 res = Math.random();
7215 this.freqs.links.set(key, res);
7216 }
7217
7218 return res;
7219 }
7220
7221 getTriangleFrequency(p1, p2, p3) {
7222 let [id1, id2, id3] = [p1.id, p2.id, p3.id];
7223
7224 if (id1 > id2) {
7225 [id2, id1] = [id1, id2];
7226 }
7227
7228 if (id2 > id3) {
7229 [id3, id2] = [id2, id3];
7230 }
7231
7232 if (id1 > id3) {
7233 [id3, id1] = [id1, id3];
7234 }
7235
7236 const key = `${id1}_${id2}_${id3}`;
7237 let res = this.freqs.triangles.get(key);
7238
7239 if (res === undefined) {
7240 res = Math.random();
7241 this.freqs.triangles.set(key, res);
7242 }
7243
7244 return res;
7245 }
7246
7247 addManualParticles() {
7248 const container = this.container,
7249 options = container.actualOptions;
7250
7251 for (const particle of options.manualParticles) {
7252 this.addParticle(calcPositionFromSize({
7253 size: container.canvas.size,
7254 position: particle.position
7255 }), particle.options);
7256 }
7257 }
7258
7259 setDensity() {
7260 const options = this.container.actualOptions;
7261
7262 for (const group in options.particles.groups) {
7263 this.applyDensity(options.particles.groups[group], 0, group);
7264 }
7265
7266 this.applyDensity(options.particles, options.manualParticles.length);
7267 }
7268
7269 handleClickMode(mode) {
7270 this.interactionManager.handleClickMode(mode);
7271 }
7272
7273 applyDensity(options, manualCount, group) {
7274 var _a;
7275
7276 if (!((_a = options.number.density) === null || _a === void 0 ? void 0 : _a.enable)) {
7277 return;
7278 }
7279
7280 const numberOptions = options.number,
7281 densityFactor = this.initDensityFactor(numberOptions.density),
7282 optParticlesNumber = numberOptions.value,
7283 optParticlesLimit = numberOptions.limit > 0 ? numberOptions.limit : optParticlesNumber,
7284 particlesNumber = Math.min(optParticlesNumber, optParticlesLimit) * densityFactor + manualCount,
7285 particlesCount = Math.min(this.count, this.array.filter(t => t.group === group).length);
7286 this.limit = numberOptions.limit * densityFactor;
7287
7288 if (particlesCount < particlesNumber) {
7289 this.push(Math.abs(particlesNumber - particlesCount), undefined, options, group);
7290 } else if (particlesCount > particlesNumber) {
7291 this.removeQuantity(particlesCount - particlesNumber, group);
7292 }
7293 }
7294
7295 initDensityFactor(densityOptions) {
7296 const container = this.container;
7297
7298 if (!container.canvas.element || !densityOptions.enable) {
7299 return 1;
7300 }
7301
7302 const canvas = container.canvas.element,
7303 pxRatio = container.retina.pixelRatio;
7304 return canvas.width * canvas.height / (densityOptions.factor * pxRatio ** 2 * densityOptions.area);
7305 }
7306
7307 pushParticle(position, overrideOptions, group, initializer) {
7308 try {
7309 const particle = new Particle(Particles_classPrivateFieldGet(this, _Particles_engine, "f"), this.nextId, this.container, position, overrideOptions, group);
7310 let canAdd = true;
7311
7312 if (initializer) {
7313 canAdd = initializer(particle);
7314 }
7315
7316 if (!canAdd) {
7317 return;
7318 }
7319
7320 this.array.push(particle);
7321 this.zArray.push(particle);
7322 this.nextId++;
7323
7324 Particles_classPrivateFieldGet(this, _Particles_engine, "f").dispatchEvent("particleAdded", {
7325 container: this.container,
7326 data: {
7327 particle
7328 }
7329 });
7330
7331 return particle;
7332 } catch (e) {
7333 console.warn(`error adding particle: ${e}`);
7334 return;
7335 }
7336 }
7337
7338}
7339_Particles_engine = new WeakMap();
7340;// CONCATENATED MODULE: ../../engine/dist/esm/Core/Retina.js
7341
7342
7343class Retina {
7344 constructor(container) {
7345 this.container = container;
7346 }
7347
7348 init() {
7349 const container = this.container,
7350 options = container.actualOptions;
7351 this.pixelRatio = !options.detectRetina || isSsr() ? 1 : window.devicePixelRatio;
7352 const motionOptions = this.container.actualOptions.motion;
7353
7354 if (motionOptions && (motionOptions.disable || motionOptions.reduce.value)) {
7355 if (isSsr() || typeof matchMedia === "undefined" || !matchMedia) {
7356 this.reduceFactor = 1;
7357 } else {
7358 const mediaQuery = matchMedia("(prefers-reduced-motion: reduce)");
7359
7360 if (mediaQuery) {
7361 this.handleMotionChange(mediaQuery);
7362
7363 const handleChange = () => {
7364 this.handleMotionChange(mediaQuery);
7365 container.refresh().catch(() => {});
7366 };
7367
7368 if (mediaQuery.addEventListener !== undefined) {
7369 mediaQuery.addEventListener("change", handleChange);
7370 } else if (mediaQuery.addListener !== undefined) {
7371 mediaQuery.addListener(handleChange);
7372 }
7373 }
7374 }
7375 } else {
7376 this.reduceFactor = 1;
7377 }
7378
7379 const ratio = this.pixelRatio;
7380
7381 if (container.canvas.element) {
7382 const element = container.canvas.element;
7383 container.canvas.size.width = element.offsetWidth * ratio;
7384 container.canvas.size.height = element.offsetHeight * ratio;
7385 }
7386
7387 const particles = options.particles;
7388 this.attractDistance = getRangeValue(particles.move.attract.distance) * ratio;
7389 this.linksDistance = particles.links.distance * ratio;
7390 this.linksWidth = particles.links.width * ratio;
7391 this.sizeAnimationSpeed = getRangeValue(particles.size.animation.speed) * ratio;
7392 this.maxSpeed = getRangeValue(particles.move.gravity.maxSpeed) * ratio;
7393 const modes = options.interactivity.modes;
7394 this.connectModeDistance = modes.connect.distance * ratio;
7395 this.connectModeRadius = modes.connect.radius * ratio;
7396 this.grabModeDistance = modes.grab.distance * ratio;
7397 this.repulseModeDistance = modes.repulse.distance * ratio;
7398 this.bounceModeDistance = modes.bounce.distance * ratio;
7399 this.attractModeDistance = modes.attract.distance * ratio;
7400 this.slowModeRadius = modes.slow.radius * ratio;
7401 this.bubbleModeDistance = modes.bubble.distance * ratio;
7402
7403 if (modes.bubble.size) {
7404 this.bubbleModeSize = modes.bubble.size * ratio;
7405 }
7406 }
7407
7408 initParticle(particle) {
7409 const options = particle.options,
7410 ratio = this.pixelRatio,
7411 moveDistance = options.move.distance,
7412 props = particle.retina;
7413 props.attractDistance = getRangeValue(options.move.attract.distance) * ratio;
7414 props.linksDistance = options.links.distance * ratio;
7415 props.linksWidth = options.links.width * ratio;
7416 props.moveDrift = getRangeValue(options.move.drift) * ratio;
7417 props.moveSpeed = getRangeValue(options.move.speed) * ratio;
7418 props.sizeAnimationSpeed = getRangeValue(options.size.animation.speed) * ratio;
7419 const maxDistance = props.maxDistance;
7420 maxDistance.horizontal = moveDistance.horizontal !== undefined ? moveDistance.horizontal * ratio : undefined;
7421 maxDistance.vertical = moveDistance.vertical !== undefined ? moveDistance.vertical * ratio : undefined;
7422 props.maxSpeed = getRangeValue(options.move.gravity.maxSpeed) * ratio;
7423 }
7424
7425 handleMotionChange(mediaQuery) {
7426 const options = this.container.actualOptions;
7427
7428 if (mediaQuery.matches) {
7429 const motion = options.motion;
7430 this.reduceFactor = motion.disable ? 0 : motion.reduce.value ? 1 / motion.reduce.factor : 1;
7431 } else {
7432 this.reduceFactor = 1;
7433 }
7434 }
7435
7436}
7437;// CONCATENATED MODULE: ../../engine/dist/esm/Core/Container.js
7438var Container_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function (receiver, state, value, kind, f) {
7439 if (kind === "m") throw new TypeError("Private method is not writable");
7440 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
7441 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
7442 return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
7443};
7444
7445var Container_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function (receiver, state, kind, f) {
7446 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
7447 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
7448 return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
7449};
7450
7451var _Container_engine;
7452
7453
7454
7455
7456
7457
7458
7459
7460class Container {
7461 constructor(engine, id, sourceOptions) {
7462 this.id = id;
7463
7464 _Container_engine.set(this, void 0);
7465
7466 Container_classPrivateFieldSet(this, _Container_engine, engine, "f");
7467
7468 this.fpsLimit = 120;
7469 this.duration = 0;
7470 this.lifeTime = 0;
7471 this.firstStart = true;
7472 this.started = false;
7473 this.destroyed = false;
7474 this.paused = true;
7475 this.lastFrameTime = 0;
7476 this.zLayers = 100;
7477 this.pageHidden = false;
7478 this._sourceOptions = sourceOptions;
7479 this._initialSourceOptions = sourceOptions;
7480 this.retina = new Retina(this);
7481 this.canvas = new Canvas(this);
7482 this.particles = new Particles(Container_classPrivateFieldGet(this, _Container_engine, "f"), this);
7483 this.drawer = new FrameManager(this);
7484 this.pathGenerator = {
7485 generate: p => {
7486 const v = p.velocity.copy();
7487 v.angle += v.length * Math.PI / 180;
7488 return v;
7489 },
7490 init: () => {},
7491 update: () => {}
7492 };
7493 this.interactivity = {
7494 mouse: {
7495 clicking: false,
7496 inside: false
7497 }
7498 };
7499 this.plugins = new Map();
7500 this.drawers = new Map();
7501 this.density = 1;
7502 this._options = loadContainerOptions(Container_classPrivateFieldGet(this, _Container_engine, "f"));
7503 this.actualOptions = loadContainerOptions(Container_classPrivateFieldGet(this, _Container_engine, "f"));
7504 this.eventListeners = new EventListeners(this);
7505
7506 if (typeof IntersectionObserver !== "undefined" && IntersectionObserver) {
7507 this.intersectionObserver = new IntersectionObserver(entries => this.intersectionManager(entries));
7508 }
7509
7510 Container_classPrivateFieldGet(this, _Container_engine, "f").dispatchEvent("containerBuilt", {
7511 container: this
7512 });
7513 }
7514
7515 get options() {
7516 return this._options;
7517 }
7518
7519 get sourceOptions() {
7520 return this._sourceOptions;
7521 }
7522
7523 play(force) {
7524 const needsUpdate = this.paused || force;
7525
7526 if (this.firstStart && !this.actualOptions.autoPlay) {
7527 this.firstStart = false;
7528 return;
7529 }
7530
7531 if (this.paused) {
7532 this.paused = false;
7533 }
7534
7535 if (needsUpdate) {
7536 for (const [, plugin] of this.plugins) {
7537 if (plugin.play) {
7538 plugin.play();
7539 }
7540 }
7541 }
7542
7543 Container_classPrivateFieldGet(this, _Container_engine, "f").dispatchEvent("containerPlay", {
7544 container: this
7545 });
7546
7547 this.draw(needsUpdate || false);
7548 }
7549
7550 pause() {
7551 if (this.drawAnimationFrame !== undefined) {
7552 cancelAnimation()(this.drawAnimationFrame);
7553 delete this.drawAnimationFrame;
7554 }
7555
7556 if (this.paused) {
7557 return;
7558 }
7559
7560 for (const [, plugin] of this.plugins) {
7561 if (plugin.pause) {
7562 plugin.pause();
7563 }
7564 }
7565
7566 if (!this.pageHidden) {
7567 this.paused = true;
7568 }
7569
7570 Container_classPrivateFieldGet(this, _Container_engine, "f").dispatchEvent("containerPaused", {
7571 container: this
7572 });
7573 }
7574
7575 draw(force) {
7576 let refreshTime = force;
7577 this.drawAnimationFrame = animate()(async timestamp => {
7578 if (refreshTime) {
7579 this.lastFrameTime = undefined;
7580 refreshTime = false;
7581 }
7582
7583 await this.drawer.nextFrame(timestamp);
7584 });
7585 }
7586
7587 getAnimationStatus() {
7588 return !this.paused && !this.pageHidden;
7589 }
7590
7591 setNoise(noiseOrGenerator, init, update) {
7592 this.setPath(noiseOrGenerator, init, update);
7593 }
7594
7595 setPath(pathOrGenerator, init, update) {
7596 var _a, _b, _c;
7597
7598 if (!pathOrGenerator) {
7599 return;
7600 }
7601
7602 if (typeof pathOrGenerator === "function") {
7603 this.pathGenerator.generate = pathOrGenerator;
7604
7605 if (init) {
7606 this.pathGenerator.init = init;
7607 }
7608
7609 if (update) {
7610 this.pathGenerator.update = update;
7611 }
7612 } else {
7613 const oldGenerator = this.pathGenerator;
7614 this.pathGenerator = pathOrGenerator;
7615 (_a = this.pathGenerator).generate || (_a.generate = oldGenerator.generate);
7616 (_b = this.pathGenerator).init || (_b.init = oldGenerator.init);
7617 (_c = this.pathGenerator).update || (_c.update = oldGenerator.update);
7618 }
7619 }
7620
7621 destroy() {
7622 this.stop();
7623 this.canvas.destroy();
7624
7625 for (const [, drawer] of this.drawers) {
7626 if (drawer.destroy) {
7627 drawer.destroy(this);
7628 }
7629 }
7630
7631 for (const key of this.drawers.keys()) {
7632 this.drawers.delete(key);
7633 }
7634
7635 this.destroyed = true;
7636
7637 Container_classPrivateFieldGet(this, _Container_engine, "f").dispatchEvent("containerDestroyed", {
7638 container: this
7639 });
7640 }
7641
7642 exportImg(callback) {
7643 this.exportImage(callback);
7644 }
7645
7646 exportImage(callback, type, quality) {
7647 var _a;
7648
7649 return (_a = this.canvas.element) === null || _a === void 0 ? void 0 : _a.toBlob(callback, type !== null && type !== void 0 ? type : "image/png", quality);
7650 }
7651
7652 exportConfiguration() {
7653 return JSON.stringify(this.actualOptions, undefined, 2);
7654 }
7655
7656 refresh() {
7657 this.stop();
7658 return this.start();
7659 }
7660
7661 reset() {
7662 this._options = loadContainerOptions(Container_classPrivateFieldGet(this, _Container_engine, "f"));
7663 return this.refresh();
7664 }
7665
7666 stop() {
7667 if (!this.started) {
7668 return;
7669 }
7670
7671 this.firstStart = true;
7672 this.started = false;
7673 this.eventListeners.removeListeners();
7674 this.pause();
7675 this.particles.clear();
7676 this.canvas.clear();
7677
7678 if (this.interactivity.element instanceof HTMLElement && this.intersectionObserver) {
7679 this.intersectionObserver.unobserve(this.interactivity.element);
7680 }
7681
7682 for (const [, plugin] of this.plugins) {
7683 if (plugin.stop) {
7684 plugin.stop();
7685 }
7686 }
7687
7688 for (const key of this.plugins.keys()) {
7689 this.plugins.delete(key);
7690 }
7691
7692 this.particles.linksColors = new Map();
7693 delete this.particles.grabLineColor;
7694 delete this.particles.linksColor;
7695 this._sourceOptions = this._options;
7696
7697 Container_classPrivateFieldGet(this, _Container_engine, "f").dispatchEvent("containerStopped", {
7698 container: this
7699 });
7700 }
7701
7702 async loadTheme(name) {
7703 this.currentTheme = name;
7704 await this.refresh();
7705 }
7706
7707 async start() {
7708 if (this.started) {
7709 return;
7710 }
7711
7712 await this.init();
7713 this.started = true;
7714 this.eventListeners.addListeners();
7715
7716 if (this.interactivity.element instanceof HTMLElement && this.intersectionObserver) {
7717 this.intersectionObserver.observe(this.interactivity.element);
7718 }
7719
7720 for (const [, plugin] of this.plugins) {
7721 if (plugin.startAsync !== undefined) {
7722 await plugin.startAsync();
7723 } else if (plugin.start !== undefined) {
7724 plugin.start();
7725 }
7726 }
7727
7728 Container_classPrivateFieldGet(this, _Container_engine, "f").dispatchEvent("containerStarted", {
7729 container: this
7730 });
7731
7732 this.play();
7733 }
7734
7735 addClickHandler(callback) {
7736 const el = this.interactivity.element;
7737
7738 if (!el) {
7739 return;
7740 }
7741
7742 const clickOrTouchHandler = (e, pos, radius) => {
7743 if (this.destroyed) {
7744 return;
7745 }
7746
7747 const pxRatio = this.retina.pixelRatio,
7748 posRetina = {
7749 x: pos.x * pxRatio,
7750 y: pos.y * pxRatio
7751 },
7752 particles = this.particles.quadTree.queryCircle(posRetina, radius * pxRatio);
7753 callback(e, particles);
7754 };
7755
7756 const clickHandler = e => {
7757 if (this.destroyed) {
7758 return;
7759 }
7760
7761 const mouseEvent = e,
7762 pos = {
7763 x: mouseEvent.offsetX || mouseEvent.clientX,
7764 y: mouseEvent.offsetY || mouseEvent.clientY
7765 };
7766 clickOrTouchHandler(e, pos, 1);
7767 };
7768
7769 const touchStartHandler = () => {
7770 if (this.destroyed) {
7771 return;
7772 }
7773
7774 touched = true;
7775 touchMoved = false;
7776 };
7777
7778 const touchMoveHandler = () => {
7779 if (this.destroyed) {
7780 return;
7781 }
7782
7783 touchMoved = true;
7784 };
7785
7786 const touchEndHandler = e => {
7787 var _a, _b, _c;
7788
7789 if (this.destroyed) {
7790 return;
7791 }
7792
7793 if (touched && !touchMoved) {
7794 const touchEvent = e;
7795 let lastTouch = touchEvent.touches[touchEvent.touches.length - 1];
7796
7797 if (!lastTouch) {
7798 lastTouch = touchEvent.changedTouches[touchEvent.changedTouches.length - 1];
7799
7800 if (!lastTouch) {
7801 return;
7802 }
7803 }
7804
7805 const canvasRect = (_a = this.canvas.element) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect(),
7806 pos = {
7807 x: lastTouch.clientX - ((_b = canvasRect === null || canvasRect === void 0 ? void 0 : canvasRect.left) !== null && _b !== void 0 ? _b : 0),
7808 y: lastTouch.clientY - ((_c = canvasRect === null || canvasRect === void 0 ? void 0 : canvasRect.top) !== null && _c !== void 0 ? _c : 0)
7809 };
7810 clickOrTouchHandler(e, pos, Math.max(lastTouch.radiusX, lastTouch.radiusY));
7811 }
7812
7813 touched = false;
7814 touchMoved = false;
7815 };
7816
7817 const touchCancelHandler = () => {
7818 if (this.destroyed) {
7819 return;
7820 }
7821
7822 touched = false;
7823 touchMoved = false;
7824 };
7825
7826 let touched = false;
7827 let touchMoved = false;
7828 el.addEventListener("click", clickHandler);
7829 el.addEventListener("touchstart", touchStartHandler);
7830 el.addEventListener("touchmove", touchMoveHandler);
7831 el.addEventListener("touchend", touchEndHandler);
7832 el.addEventListener("touchcancel", touchCancelHandler);
7833 }
7834
7835 handleClickMode(mode) {
7836 this.particles.handleClickMode(mode);
7837
7838 for (const [, plugin] of this.plugins) {
7839 if (plugin.handleClickMode) {
7840 plugin.handleClickMode(mode);
7841 }
7842 }
7843 }
7844
7845 updateActualOptions() {
7846 this.actualOptions.responsive = [];
7847 const newMaxWidth = this.actualOptions.setResponsive(this.canvas.size.width, this.retina.pixelRatio, this._options);
7848 this.actualOptions.setTheme(this.currentTheme);
7849
7850 if (this.responsiveMaxWidth != newMaxWidth) {
7851 this.responsiveMaxWidth = newMaxWidth;
7852 return true;
7853 }
7854
7855 return false;
7856 }
7857
7858 async init() {
7859 const shapes = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getSupportedShapes();
7860
7861 for (const type of shapes) {
7862 const drawer = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getShapeDrawer(type);
7863
7864 if (drawer) {
7865 this.drawers.set(type, drawer);
7866 }
7867 }
7868
7869 this._options = loadContainerOptions(Container_classPrivateFieldGet(this, _Container_engine, "f"), this._initialSourceOptions, this.sourceOptions);
7870 this.actualOptions = loadContainerOptions(Container_classPrivateFieldGet(this, _Container_engine, "f"), this._options);
7871 this.retina.init();
7872 this.canvas.init();
7873 this.updateActualOptions();
7874 this.canvas.initBackground();
7875 this.canvas.resize();
7876 this.zLayers = this.actualOptions.zLayers;
7877 this.duration = getRangeValue(this.actualOptions.duration);
7878 this.lifeTime = 0;
7879 this.fpsLimit = this.actualOptions.fpsLimit > 0 ? this.actualOptions.fpsLimit : 120;
7880
7881 const availablePlugins = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getAvailablePlugins(this);
7882
7883 for (const [id, plugin] of availablePlugins) {
7884 this.plugins.set(id, plugin);
7885 }
7886
7887 for (const [, drawer] of this.drawers) {
7888 if (drawer.init) {
7889 await drawer.init(this);
7890 }
7891 }
7892
7893 for (const [, plugin] of this.plugins) {
7894 if (plugin.init) {
7895 plugin.init(this.actualOptions);
7896 } else if (plugin.initAsync !== undefined) {
7897 await plugin.initAsync(this.actualOptions);
7898 }
7899 }
7900
7901 const pathOptions = this.actualOptions.particles.move.path;
7902
7903 if (pathOptions.generator) {
7904 this.setPath(Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getPathGenerator(pathOptions.generator));
7905 }
7906
7907 Container_classPrivateFieldGet(this, _Container_engine, "f").dispatchEvent("containerInit", {
7908 container: this
7909 });
7910
7911 this.particles.init();
7912 this.particles.setDensity();
7913
7914 for (const [, plugin] of this.plugins) {
7915 if (plugin.particlesSetup !== undefined) {
7916 plugin.particlesSetup();
7917 }
7918 }
7919
7920 Container_classPrivateFieldGet(this, _Container_engine, "f").dispatchEvent("particlesSetup", {
7921 container: this
7922 });
7923 }
7924
7925 intersectionManager(entries) {
7926 if (!this.actualOptions.pauseOnOutsideViewport) {
7927 return;
7928 }
7929
7930 for (const entry of entries) {
7931 if (entry.target !== this.interactivity.element) {
7932 continue;
7933 }
7934
7935 if (entry.isIntersecting) {
7936 this.play();
7937 } else {
7938 this.pause();
7939 }
7940 }
7941 }
7942
7943}
7944_Container_engine = new WeakMap();
7945;// CONCATENATED MODULE: ../../engine/dist/esm/Core/Loader.js
7946var Loader_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function (receiver, state, value, kind, f) {
7947 if (kind === "m") throw new TypeError("Private method is not writable");
7948 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
7949 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
7950 return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
7951};
7952
7953var Loader_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function (receiver, state, kind, f) {
7954 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
7955 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
7956 return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
7957};
7958
7959var _Loader_engine;
7960
7961
7962
7963
7964
7965function fetchError(statusCode) {
7966 console.error(`Error tsParticles - fetch status: ${statusCode}`);
7967 console.error("Error tsParticles - File config not found");
7968}
7969
7970class Loader {
7971 constructor(engine) {
7972 _Loader_engine.set(this, void 0);
7973
7974 Loader_classPrivateFieldSet(this, _Loader_engine, engine, "f");
7975 }
7976
7977 dom() {
7978 return Loader_classPrivateFieldGet(this, _Loader_engine, "f").domArray;
7979 }
7980
7981 domItem(index) {
7982 const dom = this.dom();
7983 const item = dom[index];
7984
7985 if (item && !item.destroyed) {
7986 return item;
7987 }
7988
7989 dom.splice(index, 1);
7990 }
7991
7992 async loadOptions(params) {
7993 var _a, _b, _c;
7994
7995 const tagId = (_a = params.tagId) !== null && _a !== void 0 ? _a : `tsparticles${Math.floor(Math.random() * 10000)}`,
7996 {
7997 options,
7998 index
7999 } = params;
8000 let domContainer = (_b = params.element) !== null && _b !== void 0 ? _b : document.getElementById(tagId);
8001
8002 if (!domContainer) {
8003 domContainer = document.createElement("div");
8004 domContainer.id = tagId;
8005 (_c = document.querySelector("body")) === null || _c === void 0 ? void 0 : _c.append(domContainer);
8006 }
8007
8008 const currentOptions = options instanceof Array ? itemFromArray(options, index) : options,
8009 dom = this.dom(),
8010 oldIndex = dom.findIndex(v => v.id === tagId);
8011
8012 if (oldIndex >= 0) {
8013 const old = this.domItem(oldIndex);
8014
8015 if (old && !old.destroyed) {
8016 old.destroy();
8017 dom.splice(oldIndex, 1);
8018 }
8019 }
8020
8021 let canvasEl;
8022
8023 if (domContainer.tagName.toLowerCase() === "canvas") {
8024 canvasEl = domContainer;
8025 canvasEl.dataset[generatedAttribute] = "false";
8026 } else {
8027 const existingCanvases = domContainer.getElementsByTagName("canvas");
8028
8029 if (existingCanvases.length) {
8030 canvasEl = existingCanvases[0];
8031 canvasEl.dataset[generatedAttribute] = "false";
8032 } else {
8033 canvasEl = document.createElement("canvas");
8034 canvasEl.dataset[generatedAttribute] = "true";
8035 canvasEl.style.width = "100%";
8036 canvasEl.style.height = "100%";
8037 domContainer.appendChild(canvasEl);
8038 }
8039 }
8040
8041 const newItem = new Container(Loader_classPrivateFieldGet(this, _Loader_engine, "f"), tagId, currentOptions);
8042
8043 if (oldIndex >= 0) {
8044 dom.splice(oldIndex, 0, newItem);
8045 } else {
8046 dom.push(newItem);
8047 }
8048
8049 newItem.canvas.loadCanvas(canvasEl);
8050 await newItem.start();
8051 return newItem;
8052 }
8053
8054 async loadRemoteOptions(params) {
8055 const {
8056 url: jsonUrl,
8057 index
8058 } = params,
8059 url = jsonUrl instanceof Array ? itemFromArray(jsonUrl, index) : jsonUrl;
8060
8061 if (!url) {
8062 return;
8063 }
8064
8065 const response = await fetch(url);
8066
8067 if (!response.ok) {
8068 fetchError(response.status);
8069 return;
8070 }
8071
8072 const data = await response.json();
8073 return this.loadOptions({
8074 tagId: params.tagId,
8075 element: params.element,
8076 index,
8077 options: data
8078 });
8079 }
8080
8081 load(tagId, options, index) {
8082 const params = {
8083 index
8084 };
8085
8086 if (typeof tagId === "string") {
8087 params.tagId = tagId;
8088 } else {
8089 params.options = tagId;
8090 }
8091
8092 if (typeof options === "number") {
8093 params.index = options !== null && options !== void 0 ? options : params.index;
8094 } else {
8095 params.options = options !== null && options !== void 0 ? options : params.options;
8096 }
8097
8098 return this.loadOptions(params);
8099 }
8100
8101 async set(id, domContainer, options, index) {
8102 const params = {
8103 index
8104 };
8105
8106 if (typeof id === "string") {
8107 params.tagId = id;
8108 } else {
8109 params.element = id;
8110 }
8111
8112 if (domContainer instanceof HTMLElement) {
8113 params.element = domContainer;
8114 } else {
8115 params.options = domContainer;
8116 }
8117
8118 if (typeof options === "number") {
8119 params.index = options;
8120 } else {
8121 params.options = options !== null && options !== void 0 ? options : params.options;
8122 }
8123
8124 return this.loadOptions(params);
8125 }
8126
8127 async loadJSON(tagId, jsonUrl, index) {
8128 let url, id;
8129
8130 if (typeof jsonUrl === "number" || jsonUrl === undefined) {
8131 url = tagId;
8132 } else {
8133 id = tagId;
8134 url = jsonUrl;
8135 }
8136
8137 return this.loadRemoteOptions({
8138 tagId: id,
8139 url,
8140 index
8141 });
8142 }
8143
8144 async setJSON(id, domContainer, jsonUrl, index) {
8145 let url, newId, newIndex, element;
8146
8147 if (id instanceof HTMLElement) {
8148 element = id;
8149 url = domContainer;
8150 newIndex = jsonUrl;
8151 } else {
8152 newId = id;
8153 element = domContainer;
8154 url = jsonUrl;
8155 newIndex = index;
8156 }
8157
8158 return this.loadRemoteOptions({
8159 tagId: newId,
8160 url,
8161 index: newIndex,
8162 element
8163 });
8164 }
8165
8166 setOnClickHandler(callback) {
8167 const dom = this.dom();
8168
8169 if (!dom.length) {
8170 throw new Error("Can only set click handlers after calling tsParticles.load() or tsParticles.loadJSON()");
8171 }
8172
8173 for (const domItem of dom) {
8174 domItem.addClickHandler(callback);
8175 }
8176 }
8177
8178 addEventListener(type, listener) {
8179 Loader_classPrivateFieldGet(this, _Loader_engine, "f").eventDispatcher.addEventListener(type, listener);
8180 }
8181
8182 removeEventListener(type, listener) {
8183 Loader_classPrivateFieldGet(this, _Loader_engine, "f").eventDispatcher.removeEventListener(type, listener);
8184 }
8185
8186 dispatchEvent(type, args) {
8187 Loader_classPrivateFieldGet(this, _Loader_engine, "f").eventDispatcher.dispatchEvent(type, args);
8188 }
8189
8190}
8191_Loader_engine = new WeakMap();
8192;// CONCATENATED MODULE: ../../engine/dist/esm/Core/Utils/Plugins.js
8193var Plugins_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function (receiver, state, value, kind, f) {
8194 if (kind === "m") throw new TypeError("Private method is not writable");
8195 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
8196 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
8197 return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
8198};
8199
8200var _Plugins_engine;
8201
8202class Plugins {
8203 constructor(engine) {
8204 _Plugins_engine.set(this, void 0);
8205
8206 Plugins_classPrivateFieldSet(this, _Plugins_engine, engine, "f");
8207
8208 this.plugins = [];
8209 this.interactorsInitializers = new Map();
8210 this.moversInitializers = new Map();
8211 this.updatersInitializers = new Map();
8212 this.interactors = new Map();
8213 this.movers = new Map();
8214 this.updaters = new Map();
8215 this.presets = new Map();
8216 this.drawers = new Map();
8217 this.pathGenerators = new Map();
8218 }
8219
8220 getPlugin(plugin) {
8221 return this.plugins.find(t => t.id === plugin);
8222 }
8223
8224 addPlugin(plugin) {
8225 if (!this.getPlugin(plugin.id)) {
8226 this.plugins.push(plugin);
8227 }
8228 }
8229
8230 getAvailablePlugins(container) {
8231 const res = new Map();
8232
8233 for (const plugin of this.plugins) {
8234 if (!plugin.needsPlugin(container.actualOptions)) {
8235 continue;
8236 }
8237
8238 res.set(plugin.id, plugin.getPlugin(container));
8239 }
8240
8241 return res;
8242 }
8243
8244 loadOptions(options, sourceOptions) {
8245 for (const plugin of this.plugins) {
8246 plugin.loadOptions(options, sourceOptions);
8247 }
8248 }
8249
8250 getPreset(preset) {
8251 return this.presets.get(preset);
8252 }
8253
8254 addPreset(presetKey, options, override = false) {
8255 if (override || !this.getPreset(presetKey)) {
8256 this.presets.set(presetKey, options);
8257 }
8258 }
8259
8260 getShapeDrawer(type) {
8261 return this.drawers.get(type);
8262 }
8263
8264 addShapeDrawer(type, drawer) {
8265 if (!this.getShapeDrawer(type)) {
8266 this.drawers.set(type, drawer);
8267 }
8268 }
8269
8270 getSupportedShapes() {
8271 return this.drawers.keys();
8272 }
8273
8274 getPathGenerator(type) {
8275 return this.pathGenerators.get(type);
8276 }
8277
8278 addPathGenerator(type, pathGenerator) {
8279 if (!this.getPathGenerator(type)) {
8280 this.pathGenerators.set(type, pathGenerator);
8281 }
8282 }
8283
8284 getInteractors(container, force = false) {
8285 let res = this.interactors.get(container);
8286
8287 if (!res || force) {
8288 res = [...this.interactorsInitializers.values()].map(t => t(container));
8289 this.interactors.set(container, res);
8290 }
8291
8292 return res;
8293 }
8294
8295 addInteractor(name, initInteractor) {
8296 this.interactorsInitializers.set(name, initInteractor);
8297 }
8298
8299 getUpdaters(container, force = false) {
8300 let res = this.updaters.get(container);
8301
8302 if (!res || force) {
8303 res = [...this.updatersInitializers.values()].map(t => t(container));
8304 this.updaters.set(container, res);
8305 }
8306
8307 return res;
8308 }
8309
8310 addParticleUpdater(name, initUpdater) {
8311 this.updatersInitializers.set(name, initUpdater);
8312 }
8313
8314 getMovers(container, force = false) {
8315 let res = this.movers.get(container);
8316
8317 if (!res || force) {
8318 res = [...this.moversInitializers.values()].map(t => t(container));
8319 this.movers.set(container, res);
8320 }
8321
8322 return res;
8323 }
8324
8325 addParticleMover(name, initMover) {
8326 this.moversInitializers.set(name, initMover);
8327 }
8328
8329}
8330_Plugins_engine = new WeakMap();
8331;// CONCATENATED MODULE: ../../engine/dist/esm/engine.js
8332var engine_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function (receiver, state, value, kind, f) {
8333 if (kind === "m") throw new TypeError("Private method is not writable");
8334 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
8335 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
8336 return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
8337};
8338
8339var engine_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function (receiver, state, kind, f) {
8340 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
8341 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
8342 return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
8343};
8344
8345var _Engine_initialized, _Engine_loader;
8346
8347
8348
8349
8350class Engine {
8351 constructor() {
8352 _Engine_initialized.set(this, void 0);
8353
8354 _Engine_loader.set(this, void 0);
8355
8356 this.domArray = [];
8357 this.eventDispatcher = new EventDispatcher();
8358
8359 engine_classPrivateFieldSet(this, _Engine_initialized, false, "f");
8360
8361 engine_classPrivateFieldSet(this, _Engine_loader, new Loader(this), "f");
8362
8363 this.plugins = new Plugins(this);
8364 }
8365
8366 init() {
8367 if (!engine_classPrivateFieldGet(this, _Engine_initialized, "f")) {
8368 engine_classPrivateFieldSet(this, _Engine_initialized, true, "f");
8369 }
8370 }
8371
8372 async loadFromArray(tagId, options, index) {
8373 return engine_classPrivateFieldGet(this, _Engine_loader, "f").load(tagId, options, index);
8374 }
8375
8376 async load(tagId, options) {
8377 return engine_classPrivateFieldGet(this, _Engine_loader, "f").load(tagId, options);
8378 }
8379
8380 async set(id, element, options) {
8381 return engine_classPrivateFieldGet(this, _Engine_loader, "f").set(id, element, options);
8382 }
8383
8384 async loadJSON(tagId, pathConfigJson, index) {
8385 return engine_classPrivateFieldGet(this, _Engine_loader, "f").loadJSON(tagId, pathConfigJson, index);
8386 }
8387
8388 async setJSON(id, element, pathConfigJson, index) {
8389 return engine_classPrivateFieldGet(this, _Engine_loader, "f").setJSON(id, element, pathConfigJson, index);
8390 }
8391
8392 setOnClickHandler(callback) {
8393 engine_classPrivateFieldGet(this, _Engine_loader, "f").setOnClickHandler(callback);
8394 }
8395
8396 dom() {
8397 return engine_classPrivateFieldGet(this, _Engine_loader, "f").dom();
8398 }
8399
8400 domItem(index) {
8401 return engine_classPrivateFieldGet(this, _Engine_loader, "f").domItem(index);
8402 }
8403
8404 async refresh() {
8405 for (const instance of this.dom()) {
8406 await instance.refresh();
8407 }
8408 }
8409
8410 async addShape(shape, drawer, init, afterEffect, destroy) {
8411 let customDrawer;
8412
8413 if (typeof drawer === "function") {
8414 customDrawer = {
8415 afterEffect: afterEffect,
8416 destroy: destroy,
8417 draw: drawer,
8418 init: init
8419 };
8420 } else {
8421 customDrawer = drawer;
8422 }
8423
8424 this.plugins.addShapeDrawer(shape, customDrawer);
8425 await this.refresh();
8426 }
8427
8428 async addPreset(preset, options, override = false) {
8429 this.plugins.addPreset(preset, options, override);
8430 await this.refresh();
8431 }
8432
8433 async addPlugin(plugin) {
8434 this.plugins.addPlugin(plugin);
8435 await this.refresh();
8436 }
8437
8438 async addPathGenerator(name, generator) {
8439 this.plugins.addPathGenerator(name, generator);
8440 await this.refresh();
8441 }
8442
8443 async addInteractor(name, interactorInitializer) {
8444 this.plugins.addInteractor(name, interactorInitializer);
8445 await this.refresh();
8446 }
8447
8448 async addMover(name, moverInitializer) {
8449 this.plugins.addParticleMover(name, moverInitializer);
8450 await this.refresh();
8451 }
8452
8453 async addParticleUpdater(name, updaterInitializer) {
8454 this.plugins.addParticleUpdater(name, updaterInitializer);
8455 await this.refresh();
8456 }
8457
8458 addEventListener(type, listener) {
8459 engine_classPrivateFieldGet(this, _Engine_loader, "f").addEventListener(type, listener);
8460 }
8461
8462 removeEventListener(type, listener) {
8463 engine_classPrivateFieldGet(this, _Engine_loader, "f").removeEventListener(type, listener);
8464 }
8465
8466 dispatchEvent(type, args) {
8467 engine_classPrivateFieldGet(this, _Engine_loader, "f").dispatchEvent(type, args);
8468 }
8469
8470}
8471_Engine_initialized = new WeakMap(), _Engine_loader = new WeakMap();
8472;// CONCATENATED MODULE: ../../engine/dist/esm/Core/Utils/ExternalInteractorBase.js
8473class ExternalInteractorBase {
8474 constructor(container) {
8475 this.container = container;
8476 this.type = 0;
8477 }
8478
8479}
8480;// CONCATENATED MODULE: ../../engine/dist/esm/Core/Utils/ParticlesInteractorBase.js
8481class ParticlesInteractorBase {
8482 constructor(container) {
8483 this.container = container;
8484 this.type = 1;
8485 }
8486
8487}
8488;// CONCATENATED MODULE: ../../engine/dist/esm/index.js
8489
8490const tsParticles = new Engine();
8491tsParticles.init();
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770;// CONCATENATED MODULE: ../../updaters/angle/dist/esm/AngleUpdater.js
8771
8772
8773function updateAngle(particle, delta) {
8774 var _a;
8775
8776 const rotate = particle.rotate;
8777
8778 if (!rotate) {
8779 return;
8780 }
8781
8782 const rotateOptions = particle.options.rotate;
8783 const rotateAnimation = rotateOptions.animation;
8784 const speed = ((_a = rotate.velocity) !== null && _a !== void 0 ? _a : 0) * delta.factor;
8785 const max = 2 * Math.PI;
8786
8787 if (!rotateAnimation.enable) {
8788 return;
8789 }
8790
8791 switch (rotate.status) {
8792 case 0:
8793 rotate.value += speed;
8794
8795 if (rotate.value > max) {
8796 rotate.value -= max;
8797 }
8798
8799 break;
8800
8801 case 1:
8802 default:
8803 rotate.value -= speed;
8804
8805 if (rotate.value < 0) {
8806 rotate.value += max;
8807 }
8808
8809 break;
8810 }
8811}
8812
8813class AngleUpdater {
8814 constructor(container) {
8815 this.container = container;
8816 }
8817
8818 init(particle) {
8819 const rotateOptions = particle.options.rotate;
8820 particle.rotate = {
8821 enable: rotateOptions.animation.enable,
8822 value: getRangeValue(rotateOptions.value) * Math.PI / 180
8823 };
8824 let rotateDirection = rotateOptions.direction;
8825
8826 if (rotateDirection === "random") {
8827 const index = Math.floor(Math.random() * 2);
8828 rotateDirection = index > 0 ? "counter-clockwise" : "clockwise";
8829 }
8830
8831 switch (rotateDirection) {
8832 case "counter-clockwise":
8833 case "counterClockwise":
8834 particle.rotate.status = 1;
8835 break;
8836
8837 case "clockwise":
8838 particle.rotate.status = 0;
8839 break;
8840 }
8841
8842 const rotateAnimation = particle.options.rotate.animation;
8843
8844 if (rotateAnimation.enable) {
8845 particle.rotate.velocity = getRangeValue(rotateAnimation.speed) / 360 * this.container.retina.reduceFactor;
8846
8847 if (!rotateAnimation.sync) {
8848 particle.rotate.velocity *= Math.random();
8849 }
8850 }
8851 }
8852
8853 isEnabled(particle) {
8854 const rotate = particle.options.rotate;
8855 const rotateAnimation = rotate.animation;
8856 return !particle.destroyed && !particle.spawning && !rotate.path && rotateAnimation.enable;
8857 }
8858
8859 update(particle, delta) {
8860 if (!this.isEnabled(particle)) {
8861 return;
8862 }
8863
8864 updateAngle(particle, delta);
8865 }
8866
8867}
8868;// CONCATENATED MODULE: ../../updaters/angle/dist/esm/index.js
8869
8870async function loadAngleUpdater(engine) {
8871 await engine.addParticleUpdater("angle", container => new AngleUpdater(container));
8872}
8873;// CONCATENATED MODULE: ../../move/base/dist/esm/Utils.js
8874
8875function applyDistance(particle) {
8876 const initialPosition = particle.initialPosition;
8877 const {
8878 dx,
8879 dy
8880 } = getDistances(initialPosition, particle.position);
8881 const dxFixed = Math.abs(dx),
8882 dyFixed = Math.abs(dy);
8883 const hDistance = particle.retina.maxDistance.horizontal;
8884 const vDistance = particle.retina.maxDistance.vertical;
8885
8886 if (!hDistance && !vDistance) {
8887 return;
8888 }
8889
8890 if ((hDistance && dxFixed >= hDistance || vDistance && dyFixed >= vDistance) && !particle.misplaced) {
8891 particle.misplaced = !!hDistance && dxFixed > hDistance || !!vDistance && dyFixed > vDistance;
8892
8893 if (hDistance) {
8894 particle.velocity.x = particle.velocity.y / 2 - particle.velocity.x;
8895 }
8896
8897 if (vDistance) {
8898 particle.velocity.y = particle.velocity.x / 2 - particle.velocity.y;
8899 }
8900 } else if ((!hDistance || dxFixed < hDistance) && (!vDistance || dyFixed < vDistance) && particle.misplaced) {
8901 particle.misplaced = false;
8902 } else if (particle.misplaced) {
8903 const pos = particle.position,
8904 vel = particle.velocity;
8905
8906 if (hDistance && (pos.x < initialPosition.x && vel.x < 0 || pos.x > initialPosition.x && vel.x > 0)) {
8907 vel.x *= -Math.random();
8908 }
8909
8910 if (vDistance && (pos.y < initialPosition.y && vel.y < 0 || pos.y > initialPosition.y && vel.y > 0)) {
8911 vel.y *= -Math.random();
8912 }
8913 }
8914}
8915function spin(particle, moveSpeed) {
8916 const container = particle.container;
8917
8918 if (!particle.spin) {
8919 return;
8920 }
8921
8922 const updateFunc = {
8923 x: particle.spin.direction === "clockwise" ? Math.cos : Math.sin,
8924 y: particle.spin.direction === "clockwise" ? Math.sin : Math.cos
8925 };
8926 particle.position.x = particle.spin.center.x + particle.spin.radius * updateFunc.x(particle.spin.angle);
8927 particle.position.y = particle.spin.center.y + particle.spin.radius * updateFunc.y(particle.spin.angle);
8928 particle.spin.radius += particle.spin.acceleration;
8929 const maxCanvasSize = Math.max(container.canvas.size.width, container.canvas.size.height);
8930
8931 if (particle.spin.radius > maxCanvasSize / 2) {
8932 particle.spin.radius = maxCanvasSize / 2;
8933 particle.spin.acceleration *= -1;
8934 } else if (particle.spin.radius < 0) {
8935 particle.spin.radius = 0;
8936 particle.spin.acceleration *= -1;
8937 }
8938
8939 particle.spin.angle += moveSpeed / 100 * (1 - particle.spin.radius / maxCanvasSize);
8940}
8941function applyPath(particle, delta) {
8942 const particlesOptions = particle.options;
8943 const pathOptions = particlesOptions.move.path;
8944 const pathEnabled = pathOptions.enable;
8945
8946 if (!pathEnabled) {
8947 return;
8948 }
8949
8950 const container = particle.container;
8951
8952 if (particle.lastPathTime <= particle.pathDelay) {
8953 particle.lastPathTime += delta.value;
8954 return;
8955 }
8956
8957 const path = container.pathGenerator.generate(particle);
8958 particle.velocity.addTo(path);
8959
8960 if (pathOptions.clamp) {
8961 particle.velocity.x = clamp(particle.velocity.x, -1, 1);
8962 particle.velocity.y = clamp(particle.velocity.y, -1, 1);
8963 }
8964
8965 particle.lastPathTime -= particle.pathDelay;
8966}
8967function getProximitySpeedFactor(particle) {
8968 const container = particle.container;
8969 const options = container.actualOptions;
8970 const active = isInArray("slow", options.interactivity.events.onHover.mode);
8971
8972 if (!active) {
8973 return 1;
8974 }
8975
8976 const mousePos = particle.container.interactivity.mouse.position;
8977
8978 if (!mousePos) {
8979 return 1;
8980 }
8981
8982 const particlePos = particle.getPosition();
8983 const dist = getDistance(mousePos, particlePos);
8984 const radius = container.retina.slowModeRadius;
8985
8986 if (dist > radius) {
8987 return 1;
8988 }
8989
8990 const proximityFactor = dist / radius || 0;
8991 const slowFactor = options.interactivity.modes.slow.factor;
8992 return proximityFactor / slowFactor;
8993}
8994;// CONCATENATED MODULE: ../../move/base/dist/esm/BaseMover.js
8995
8996
8997class BaseMover {
8998 init(particle) {
8999 var _a;
9000
9001 const container = particle.container,
9002 options = particle.options,
9003 spinOptions = options.move.spin;
9004
9005 if (spinOptions.enable) {
9006 const spinPos = (_a = spinOptions.position) !== null && _a !== void 0 ? _a : {
9007 x: 50,
9008 y: 50
9009 };
9010 const spinCenter = {
9011 x: spinPos.x / 100 * container.canvas.size.width,
9012 y: spinPos.y / 100 * container.canvas.size.height
9013 };
9014 const pos = particle.getPosition();
9015 const distance = getDistance(pos, spinCenter);
9016 const spinAcceleration = getRangeValue(spinOptions.acceleration);
9017 particle.retina.spinAcceleration = spinAcceleration * container.retina.pixelRatio;
9018 particle.spin = {
9019 center: spinCenter,
9020 direction: particle.velocity.x >= 0 ? "clockwise" : "counter-clockwise",
9021 angle: particle.velocity.angle,
9022 radius: distance,
9023 acceleration: particle.retina.spinAcceleration
9024 };
9025 }
9026 }
9027
9028 isEnabled(particle) {
9029 return !particle.destroyed && particle.options.move.enable;
9030 }
9031
9032 move(particle, delta) {
9033 var _a, _b, _c;
9034
9035 var _d, _e;
9036
9037 const particleOptions = particle.options,
9038 moveOptions = particleOptions.move;
9039
9040 if (!moveOptions.enable) {
9041 return;
9042 }
9043
9044 const container = particle.container,
9045 slowFactor = getProximitySpeedFactor(particle),
9046 baseSpeed = ((_a = (_d = particle.retina).moveSpeed) !== null && _a !== void 0 ? _a : _d.moveSpeed = getRangeValue(moveOptions.speed) * container.retina.pixelRatio) * container.retina.reduceFactor,
9047 moveDrift = (_b = (_e = particle.retina).moveDrift) !== null && _b !== void 0 ? _b : _e.moveDrift = getRangeValue(particle.options.move.drift) * container.retina.pixelRatio,
9048 maxSize = getRangeMax(particleOptions.size.value) * container.retina.pixelRatio,
9049 sizeFactor = moveOptions.size ? particle.getRadius() / maxSize : 1,
9050 speedFactor = sizeFactor * slowFactor * (delta.factor || 1),
9051 diffFactor = 2,
9052 moveSpeed = baseSpeed * speedFactor / diffFactor;
9053 applyPath(particle, delta);
9054 const gravityOptions = particle.gravity,
9055 gravityFactor = gravityOptions.enable && gravityOptions.inverse ? -1 : 1;
9056
9057 if (gravityOptions.enable && moveSpeed) {
9058 particle.velocity.y += gravityFactor * (gravityOptions.acceleration * delta.factor) / (60 * moveSpeed);
9059 }
9060
9061 if (moveDrift && moveSpeed) {
9062 particle.velocity.x += moveDrift * delta.factor / (60 * moveSpeed);
9063 }
9064
9065 const decay = particle.moveDecay;
9066
9067 if (decay != 1) {
9068 particle.velocity.multTo(decay);
9069 }
9070
9071 const velocity = particle.velocity.mult(moveSpeed),
9072 maxSpeed = (_c = particle.retina.maxSpeed) !== null && _c !== void 0 ? _c : container.retina.maxSpeed;
9073
9074 if (gravityOptions.enable && maxSpeed > 0 && (!gravityOptions.inverse && velocity.y >= 0 && velocity.y >= maxSpeed || gravityOptions.inverse && velocity.y <= 0 && velocity.y <= -maxSpeed)) {
9075 velocity.y = gravityFactor * maxSpeed;
9076
9077 if (moveSpeed) {
9078 particle.velocity.y = velocity.y / moveSpeed;
9079 }
9080 }
9081
9082 const zIndexOptions = particle.options.zIndex,
9083 zVelocityFactor = (1 - particle.zIndexFactor) ** zIndexOptions.velocityRate;
9084
9085 if (moveOptions.spin.enable) {
9086 spin(particle, moveSpeed);
9087 } else {
9088 if (zVelocityFactor != 1) {
9089 velocity.multTo(zVelocityFactor);
9090 }
9091
9092 particle.position.addTo(velocity);
9093
9094 if (moveOptions.vibrate) {
9095 particle.position.x += Math.sin(particle.position.x * Math.cos(particle.position.y));
9096 particle.position.y += Math.cos(particle.position.y * Math.sin(particle.position.x));
9097 }
9098 }
9099
9100 applyDistance(particle);
9101 }
9102
9103}
9104;// CONCATENATED MODULE: ../../move/base/dist/esm/index.js
9105
9106async function loadBaseMover(engine) {
9107 engine.addMover("base", () => new BaseMover());
9108}
9109;// CONCATENATED MODULE: ../../shapes/circle/dist/esm/CircleDrawer.js
9110class CircleDrawer {
9111 getSidesCount() {
9112 return 12;
9113 }
9114
9115 draw(context, particle, radius) {
9116 context.arc(0, 0, radius, 0, Math.PI * 2, false);
9117 }
9118
9119}
9120;// CONCATENATED MODULE: ../../shapes/circle/dist/esm/index.js
9121
9122async function loadCircleShape(engine) {
9123 await engine.addShape("circle", new CircleDrawer());
9124}
9125;// CONCATENATED MODULE: ../../updaters/color/dist/esm/ColorUpdater.js
9126
9127
9128function updateColorValue(delta, value, valueAnimation, max, decrease) {
9129 var _a;
9130
9131 const colorValue = value;
9132
9133 if (!colorValue || !valueAnimation.enable) {
9134 return;
9135 }
9136
9137 const offset = randomInRange(valueAnimation.offset);
9138 const velocity = ((_a = value.velocity) !== null && _a !== void 0 ? _a : 0) * delta.factor + offset * 3.6;
9139
9140 if (!decrease || colorValue.status === 0) {
9141 colorValue.value += velocity;
9142
9143 if (decrease && colorValue.value > max) {
9144 colorValue.status = 1;
9145 colorValue.value -= colorValue.value % max;
9146 }
9147 } else {
9148 colorValue.value -= velocity;
9149
9150 if (colorValue.value < 0) {
9151 colorValue.status = 0;
9152 colorValue.value += colorValue.value;
9153 }
9154 }
9155
9156 if (colorValue.value > max) {
9157 colorValue.value %= max;
9158 }
9159}
9160
9161function updateColor(particle, delta) {
9162 var _a, _b, _c;
9163
9164 const animationOptions = particle.options.color.animation;
9165
9166 if (((_a = particle.color) === null || _a === void 0 ? void 0 : _a.h) !== undefined) {
9167 updateColorValue(delta, particle.color.h, animationOptions.h, 360, false);
9168 }
9169
9170 if (((_b = particle.color) === null || _b === void 0 ? void 0 : _b.s) !== undefined) {
9171 updateColorValue(delta, particle.color.s, animationOptions.s, 100, true);
9172 }
9173
9174 if (((_c = particle.color) === null || _c === void 0 ? void 0 : _c.l) !== undefined) {
9175 updateColorValue(delta, particle.color.l, animationOptions.l, 100, true);
9176 }
9177}
9178
9179class ColorUpdater {
9180 constructor(container) {
9181 this.container = container;
9182 }
9183
9184 init(particle) {
9185 const hslColor = colorToHsl(particle.options.color, particle.id, particle.options.reduceDuplicates);
9186
9187 if (hslColor) {
9188 particle.color = getHslAnimationFromHsl(hslColor, particle.options.color.animation, this.container.retina.reduceFactor);
9189 }
9190 }
9191
9192 isEnabled(particle) {
9193 var _a, _b, _c;
9194
9195 const animationOptions = particle.options.color.animation;
9196 return !particle.destroyed && !particle.spawning && (((_a = particle.color) === null || _a === void 0 ? void 0 : _a.h.value) !== undefined && animationOptions.h.enable || ((_b = particle.color) === null || _b === void 0 ? void 0 : _b.s.value) !== undefined && animationOptions.s.enable || ((_c = particle.color) === null || _c === void 0 ? void 0 : _c.l.value) !== undefined && animationOptions.l.enable);
9197 }
9198
9199 update(particle, delta) {
9200 updateColor(particle, delta);
9201 }
9202
9203}
9204;// CONCATENATED MODULE: ../../updaters/color/dist/esm/index.js
9205
9206async function loadColorUpdater(engine) {
9207 await engine.addParticleUpdater("color", container => new ColorUpdater(container));
9208}
9209;// CONCATENATED MODULE: ../../interactions/external/attract/dist/esm/Attractor.js
9210
9211class Attractor extends ExternalInteractorBase {
9212 constructor(container) {
9213 super(container);
9214
9215 if (!container.attract) {
9216 container.attract = {
9217 particles: []
9218 };
9219 }
9220
9221 this.handleClickMode = mode => {
9222 const options = this.container.actualOptions;
9223
9224 if (mode !== "attract") {
9225 return;
9226 }
9227
9228 if (!container.attract) {
9229 container.attract = {
9230 particles: []
9231 };
9232 }
9233
9234 container.attract.clicking = true;
9235 container.attract.count = 0;
9236
9237 for (const particle of container.attract.particles) {
9238 particle.velocity.setTo(particle.initialVelocity);
9239 }
9240
9241 container.attract.particles = [];
9242 container.attract.finish = false;
9243 setTimeout(() => {
9244 if (!container.destroyed) {
9245 if (!container.attract) {
9246 container.attract = {
9247 particles: []
9248 };
9249 }
9250
9251 container.attract.clicking = false;
9252 }
9253 }, options.interactivity.modes.attract.duration * 1000);
9254 };
9255 }
9256
9257 isEnabled() {
9258 const container = this.container,
9259 options = container.actualOptions,
9260 mouse = container.interactivity.mouse,
9261 events = options.interactivity.events;
9262
9263 if ((!mouse.position || !events.onHover.enable) && (!mouse.clickPosition || !events.onClick.enable)) {
9264 return false;
9265 }
9266
9267 const hoverMode = events.onHover.mode,
9268 clickMode = events.onClick.mode;
9269 return isInArray("attract", hoverMode) || isInArray("attract", clickMode);
9270 }
9271
9272 reset() {}
9273
9274 async interact() {
9275 const container = this.container,
9276 options = container.actualOptions,
9277 mouseMoveStatus = container.interactivity.status === mouseMoveEvent,
9278 events = options.interactivity.events,
9279 hoverEnabled = events.onHover.enable,
9280 hoverMode = events.onHover.mode,
9281 clickEnabled = events.onClick.enable,
9282 clickMode = events.onClick.mode;
9283
9284 if (mouseMoveStatus && hoverEnabled && isInArray("attract", hoverMode)) {
9285 this.hoverAttract();
9286 } else if (clickEnabled && isInArray("attract", clickMode)) {
9287 this.clickAttract();
9288 }
9289 }
9290
9291 hoverAttract() {
9292 const container = this.container;
9293 const mousePos = container.interactivity.mouse.position;
9294
9295 if (!mousePos) {
9296 return;
9297 }
9298
9299 const attractRadius = container.retina.attractModeDistance;
9300 this.processAttract(mousePos, attractRadius, new Circle(mousePos.x, mousePos.y, attractRadius));
9301 }
9302
9303 processAttract(position, attractRadius, area) {
9304 const container = this.container;
9305 const attractOptions = container.actualOptions.interactivity.modes.attract;
9306 const query = container.particles.quadTree.query(area);
9307
9308 for (const particle of query) {
9309 const {
9310 dx,
9311 dy,
9312 distance
9313 } = getDistances(particle.position, position);
9314 const velocity = attractOptions.speed * attractOptions.factor;
9315 const attractFactor = clamp(calcEasing(1 - distance / attractRadius, attractOptions.easing) * velocity, 0, attractOptions.maxSpeed);
9316 const normVec = Vector.create(distance === 0 ? velocity : dx / distance * attractFactor, distance === 0 ? velocity : dy / distance * attractFactor);
9317 particle.position.subFrom(normVec);
9318 }
9319 }
9320
9321 clickAttract() {
9322 const container = this.container;
9323
9324 if (!container.attract) {
9325 container.attract = {
9326 particles: []
9327 };
9328 }
9329
9330 if (!container.attract.finish) {
9331 if (!container.attract.count) {
9332 container.attract.count = 0;
9333 }
9334
9335 container.attract.count++;
9336
9337 if (container.attract.count === container.particles.count) {
9338 container.attract.finish = true;
9339 }
9340 }
9341
9342 if (container.attract.clicking) {
9343 const mousePos = container.interactivity.mouse.clickPosition;
9344
9345 if (!mousePos) {
9346 return;
9347 }
9348
9349 const attractRadius = container.retina.attractModeDistance;
9350 this.processAttract(mousePos, attractRadius, new Circle(mousePos.x, mousePos.y, attractRadius));
9351 } else if (container.attract.clicking === false) {
9352 container.attract.particles = [];
9353 }
9354
9355 return;
9356 }
9357
9358}
9359;// CONCATENATED MODULE: ../../interactions/external/attract/dist/esm/index.js
9360
9361async function loadExternalAttractInteraction(engine) {
9362 await engine.addInteractor("externalAttract", container => new Attractor(container));
9363}
9364;// CONCATENATED MODULE: ../../interactions/external/bounce/dist/esm/Bouncer.js
9365
9366class Bouncer extends ExternalInteractorBase {
9367 constructor(container) {
9368 super(container);
9369 }
9370
9371 isEnabled() {
9372 const container = this.container,
9373 options = container.actualOptions,
9374 mouse = container.interactivity.mouse,
9375 events = options.interactivity.events,
9376 divs = events.onDiv;
9377 return mouse.position && events.onHover.enable && isInArray("bounce", events.onHover.mode) || isDivModeEnabled("bounce", divs);
9378 }
9379
9380 async interact() {
9381 const container = this.container,
9382 options = container.actualOptions,
9383 events = options.interactivity.events,
9384 mouseMoveStatus = container.interactivity.status === mouseMoveEvent,
9385 hoverEnabled = events.onHover.enable,
9386 hoverMode = events.onHover.mode,
9387 divs = events.onDiv;
9388
9389 if (mouseMoveStatus && hoverEnabled && isInArray("bounce", hoverMode)) {
9390 this.processMouseBounce();
9391 } else {
9392 divModeExecute("bounce", divs, (selector, div) => this.singleSelectorBounce(selector, div));
9393 }
9394 }
9395
9396 reset() {}
9397
9398 processMouseBounce() {
9399 const container = this.container,
9400 pxRatio = container.retina.pixelRatio,
9401 tolerance = 10 * pxRatio,
9402 mousePos = container.interactivity.mouse.position,
9403 radius = container.retina.bounceModeDistance;
9404
9405 if (mousePos) {
9406 this.processBounce(mousePos, radius, new Circle(mousePos.x, mousePos.y, radius + tolerance));
9407 }
9408 }
9409
9410 singleSelectorBounce(selector, div) {
9411 const container = this.container,
9412 query = document.querySelectorAll(selector);
9413
9414 if (!query.length) {
9415 return;
9416 }
9417
9418 query.forEach(item => {
9419 const elem = item,
9420 pxRatio = container.retina.pixelRatio,
9421 pos = {
9422 x: (elem.offsetLeft + elem.offsetWidth / 2) * pxRatio,
9423 y: (elem.offsetTop + elem.offsetHeight / 2) * pxRatio
9424 },
9425 radius = elem.offsetWidth / 2 * pxRatio,
9426 tolerance = 10 * pxRatio,
9427 area = div.type === "circle" ? new Circle(pos.x, pos.y, radius + tolerance) : new Rectangle(elem.offsetLeft * pxRatio - tolerance, elem.offsetTop * pxRatio - tolerance, elem.offsetWidth * pxRatio + tolerance * 2, elem.offsetHeight * pxRatio + tolerance * 2);
9428 this.processBounce(pos, radius, area);
9429 });
9430 }
9431
9432 processBounce(position, radius, area) {
9433 const query = this.container.particles.quadTree.query(area);
9434
9435 for (const particle of query) {
9436 if (area instanceof Circle) {
9437 circleBounce(circleBounceDataFromParticle(particle), {
9438 position,
9439 radius,
9440 mass: radius ** 2 * Math.PI / 2,
9441 velocity: Vector.origin,
9442 factor: Vector.origin
9443 });
9444 } else if (area instanceof Rectangle) {
9445 rectBounce(particle, calculateBounds(position, radius));
9446 }
9447 }
9448 }
9449
9450}
9451;// CONCATENATED MODULE: ../../interactions/external/bounce/dist/esm/index.js
9452
9453async function loadExternalBounceInteraction(engine) {
9454 await engine.addInteractor("externalBounce", container => new Bouncer(container));
9455}
9456;// CONCATENATED MODULE: ../../interactions/external/bubble/dist/esm/Bubbler.js
9457
9458
9459function calculateBubbleValue(particleValue, modeValue, optionsValue, ratio) {
9460 if (modeValue >= optionsValue) {
9461 const value = particleValue + (modeValue - optionsValue) * ratio;
9462 return clamp(value, particleValue, modeValue);
9463 } else if (modeValue < optionsValue) {
9464 const value = particleValue - (optionsValue - modeValue) * ratio;
9465 return clamp(value, modeValue, particleValue);
9466 }
9467}
9468
9469class Bubbler extends ExternalInteractorBase {
9470 constructor(container) {
9471 super(container);
9472
9473 if (!container.bubble) {
9474 container.bubble = {};
9475 }
9476
9477 this.handleClickMode = mode => {
9478 if (mode !== "bubble") {
9479 return;
9480 }
9481
9482 if (!container.bubble) {
9483 container.bubble = {};
9484 }
9485
9486 container.bubble.clicking = true;
9487 };
9488 }
9489
9490 isEnabled() {
9491 const container = this.container,
9492 options = container.actualOptions,
9493 mouse = container.interactivity.mouse,
9494 events = options.interactivity.events,
9495 divs = events.onDiv,
9496 divBubble = isDivModeEnabled("bubble", divs);
9497
9498 if (!(divBubble || events.onHover.enable && mouse.position || events.onClick.enable && mouse.clickPosition)) {
9499 return false;
9500 }
9501
9502 const hoverMode = events.onHover.mode;
9503 const clickMode = events.onClick.mode;
9504 return isInArray("bubble", hoverMode) || isInArray("bubble", clickMode) || divBubble;
9505 }
9506
9507 reset(particle, force) {
9508 if (!(!particle.bubble.inRange || force)) {
9509 return;
9510 }
9511
9512 delete particle.bubble.div;
9513 delete particle.bubble.opacity;
9514 delete particle.bubble.radius;
9515 delete particle.bubble.color;
9516 }
9517
9518 async interact() {
9519 const options = this.container.actualOptions,
9520 events = options.interactivity.events,
9521 onHover = events.onHover,
9522 onClick = events.onClick,
9523 hoverEnabled = onHover.enable,
9524 hoverMode = onHover.mode,
9525 clickEnabled = onClick.enable,
9526 clickMode = onClick.mode,
9527 divs = events.onDiv;
9528
9529 if (hoverEnabled && isInArray("bubble", hoverMode)) {
9530 this.hoverBubble();
9531 } else if (clickEnabled && isInArray("bubble", clickMode)) {
9532 this.clickBubble();
9533 } else {
9534 divModeExecute("bubble", divs, (selector, div) => this.singleSelectorHover(selector, div));
9535 }
9536 }
9537
9538 singleSelectorHover(selector, div) {
9539 const container = this.container,
9540 selectors = document.querySelectorAll(selector);
9541
9542 if (!selectors.length) {
9543 return;
9544 }
9545
9546 selectors.forEach(item => {
9547 const elem = item,
9548 pxRatio = container.retina.pixelRatio,
9549 pos = {
9550 x: (elem.offsetLeft + elem.offsetWidth / 2) * pxRatio,
9551 y: (elem.offsetTop + elem.offsetHeight / 2) * pxRatio
9552 },
9553 repulseRadius = elem.offsetWidth / 2 * pxRatio,
9554 area = div.type === "circle" ? new Circle(pos.x, pos.y, repulseRadius) : new Rectangle(elem.offsetLeft * pxRatio, elem.offsetTop * pxRatio, elem.offsetWidth * pxRatio, elem.offsetHeight * pxRatio),
9555 query = container.particles.quadTree.query(area);
9556
9557 for (const particle of query) {
9558 if (!area.contains(particle.getPosition())) {
9559 continue;
9560 }
9561
9562 particle.bubble.inRange = true;
9563 const divs = container.actualOptions.interactivity.modes.bubble.divs;
9564 const divBubble = divMode(divs, elem);
9565
9566 if (!particle.bubble.div || particle.bubble.div !== elem) {
9567 this.reset(particle, true);
9568 particle.bubble.div = elem;
9569 }
9570
9571 this.hoverBubbleSize(particle, 1, divBubble);
9572 this.hoverBubbleOpacity(particle, 1, divBubble);
9573 this.hoverBubbleColor(particle, 1, divBubble);
9574 }
9575 });
9576 }
9577
9578 process(particle, distMouse, timeSpent, data) {
9579 const container = this.container,
9580 bubbleParam = data.bubbleObj.optValue;
9581
9582 if (bubbleParam === undefined) {
9583 return;
9584 }
9585
9586 const options = container.actualOptions,
9587 bubbleDuration = options.interactivity.modes.bubble.duration,
9588 bubbleDistance = container.retina.bubbleModeDistance,
9589 particlesParam = data.particlesObj.optValue,
9590 pObjBubble = data.bubbleObj.value,
9591 pObj = data.particlesObj.value || 0,
9592 type = data.type;
9593
9594 if (bubbleParam === particlesParam) {
9595 return;
9596 }
9597
9598 if (!container.bubble) {
9599 container.bubble = {};
9600 }
9601
9602 if (!container.bubble.durationEnd) {
9603 if (distMouse <= bubbleDistance) {
9604 const obj = pObjBubble !== null && pObjBubble !== void 0 ? pObjBubble : pObj;
9605
9606 if (obj !== bubbleParam) {
9607 const value = pObj - timeSpent * (pObj - bubbleParam) / bubbleDuration;
9608
9609 if (type === "size") {
9610 particle.bubble.radius = value;
9611 }
9612
9613 if (type === "opacity") {
9614 particle.bubble.opacity = value;
9615 }
9616 }
9617 } else {
9618 if (type === "size") {
9619 delete particle.bubble.radius;
9620 }
9621
9622 if (type === "opacity") {
9623 delete particle.bubble.opacity;
9624 }
9625 }
9626 } else if (pObjBubble) {
9627 if (type === "size") {
9628 delete particle.bubble.radius;
9629 }
9630
9631 if (type === "opacity") {
9632 delete particle.bubble.opacity;
9633 }
9634 }
9635 }
9636
9637 clickBubble() {
9638 var _a, _b;
9639
9640 const container = this.container,
9641 options = container.actualOptions,
9642 mouseClickPos = container.interactivity.mouse.clickPosition;
9643
9644 if (!mouseClickPos) {
9645 return;
9646 }
9647
9648 if (!container.bubble) {
9649 container.bubble = {};
9650 }
9651
9652 const distance = container.retina.bubbleModeDistance,
9653 query = container.particles.quadTree.queryCircle(mouseClickPos, distance);
9654
9655 for (const particle of query) {
9656 if (!container.bubble.clicking) {
9657 continue;
9658 }
9659
9660 particle.bubble.inRange = !container.bubble.durationEnd;
9661 const pos = particle.getPosition(),
9662 distMouse = getDistance(pos, mouseClickPos),
9663 timeSpent = (new Date().getTime() - (container.interactivity.mouse.clickTime || 0)) / 1000;
9664
9665 if (timeSpent > options.interactivity.modes.bubble.duration) {
9666 container.bubble.durationEnd = true;
9667 }
9668
9669 if (timeSpent > options.interactivity.modes.bubble.duration * 2) {
9670 container.bubble.clicking = false;
9671 container.bubble.durationEnd = false;
9672 }
9673
9674 const sizeData = {
9675 bubbleObj: {
9676 optValue: container.retina.bubbleModeSize,
9677 value: particle.bubble.radius
9678 },
9679 particlesObj: {
9680 optValue: getRangeMax(particle.options.size.value) * container.retina.pixelRatio,
9681 value: particle.size.value
9682 },
9683 type: "size"
9684 };
9685 this.process(particle, distMouse, timeSpent, sizeData);
9686 const opacityData = {
9687 bubbleObj: {
9688 optValue: options.interactivity.modes.bubble.opacity,
9689 value: particle.bubble.opacity
9690 },
9691 particlesObj: {
9692 optValue: getRangeMax(particle.options.opacity.value),
9693 value: (_b = (_a = particle.opacity) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 1
9694 },
9695 type: "opacity"
9696 };
9697 this.process(particle, distMouse, timeSpent, opacityData);
9698
9699 if (!container.bubble.durationEnd) {
9700 if (distMouse <= container.retina.bubbleModeDistance) {
9701 this.hoverBubbleColor(particle, distMouse);
9702 } else {
9703 delete particle.bubble.color;
9704 }
9705 } else {
9706 delete particle.bubble.color;
9707 }
9708 }
9709 }
9710
9711 hoverBubble() {
9712 const container = this.container,
9713 mousePos = container.interactivity.mouse.position;
9714
9715 if (mousePos === undefined) {
9716 return;
9717 }
9718
9719 const distance = container.retina.bubbleModeDistance,
9720 query = container.particles.quadTree.queryCircle(mousePos, distance);
9721
9722 for (const particle of query) {
9723 particle.bubble.inRange = true;
9724 const pos = particle.getPosition(),
9725 pointDistance = getDistance(pos, mousePos),
9726 ratio = 1 - pointDistance / distance;
9727
9728 if (pointDistance <= distance) {
9729 if (ratio >= 0 && container.interactivity.status === mouseMoveEvent) {
9730 this.hoverBubbleSize(particle, ratio);
9731 this.hoverBubbleOpacity(particle, ratio);
9732 this.hoverBubbleColor(particle, ratio);
9733 }
9734 } else {
9735 this.reset(particle);
9736 }
9737
9738 if (container.interactivity.status === mouseLeaveEvent) {
9739 this.reset(particle);
9740 }
9741 }
9742 }
9743
9744 hoverBubbleSize(particle, ratio, divBubble) {
9745 const container = this.container,
9746 modeSize = (divBubble === null || divBubble === void 0 ? void 0 : divBubble.size) ? divBubble.size * container.retina.pixelRatio : container.retina.bubbleModeSize;
9747
9748 if (modeSize === undefined) {
9749 return;
9750 }
9751
9752 const optSize = getRangeMax(particle.options.size.value) * container.retina.pixelRatio;
9753 const pSize = particle.size.value;
9754 const size = calculateBubbleValue(pSize, modeSize, optSize, ratio);
9755
9756 if (size !== undefined) {
9757 particle.bubble.radius = size;
9758 }
9759 }
9760
9761 hoverBubbleOpacity(particle, ratio, divBubble) {
9762 var _a, _b, _c;
9763
9764 const container = this.container,
9765 options = container.actualOptions,
9766 modeOpacity = (_a = divBubble === null || divBubble === void 0 ? void 0 : divBubble.opacity) !== null && _a !== void 0 ? _a : options.interactivity.modes.bubble.opacity;
9767
9768 if (!modeOpacity) {
9769 return;
9770 }
9771
9772 const optOpacity = particle.options.opacity.value;
9773 const pOpacity = (_c = (_b = particle.opacity) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : 1;
9774 const opacity = calculateBubbleValue(pOpacity, modeOpacity, getRangeMax(optOpacity), ratio);
9775
9776 if (opacity !== undefined) {
9777 particle.bubble.opacity = opacity;
9778 }
9779 }
9780
9781 hoverBubbleColor(particle, ratio, divBubble) {
9782 const options = this.container.actualOptions;
9783 const bubbleOptions = divBubble !== null && divBubble !== void 0 ? divBubble : options.interactivity.modes.bubble;
9784
9785 if (!particle.bubble.finalColor) {
9786 const modeColor = bubbleOptions.color;
9787
9788 if (!modeColor) {
9789 return;
9790 }
9791
9792 const bubbleColor = modeColor instanceof Array ? itemFromArray(modeColor) : modeColor;
9793 particle.bubble.finalColor = colorToHsl(bubbleColor);
9794 }
9795
9796 if (!particle.bubble.finalColor) {
9797 return;
9798 }
9799
9800 if (bubbleOptions.mix) {
9801 particle.bubble.color = undefined;
9802 const pColor = particle.getFillColor();
9803 particle.bubble.color = pColor ? rgbToHsl(colorMix(pColor, particle.bubble.finalColor, 1 - ratio, ratio)) : particle.bubble.finalColor;
9804 } else {
9805 particle.bubble.color = particle.bubble.finalColor;
9806 }
9807 }
9808
9809}
9810;// CONCATENATED MODULE: ../../interactions/external/bubble/dist/esm/index.js
9811
9812async function loadExternalBubbleInteraction(engine) {
9813 await engine.addInteractor("externalBubble", container => new Bubbler(container));
9814}
9815;// CONCATENATED MODULE: ../../interactions/external/connect/dist/esm/Connector.js
9816
9817class Connector extends ExternalInteractorBase {
9818 constructor(container) {
9819 super(container);
9820 }
9821
9822 isEnabled() {
9823 const container = this.container,
9824 mouse = container.interactivity.mouse,
9825 events = container.actualOptions.interactivity.events;
9826
9827 if (!(events.onHover.enable && mouse.position)) {
9828 return false;
9829 }
9830
9831 return isInArray("connect", events.onHover.mode);
9832 }
9833
9834 reset() {}
9835
9836 async interact() {
9837 const container = this.container,
9838 options = container.actualOptions;
9839
9840 if (options.interactivity.events.onHover.enable && container.interactivity.status === "mousemove") {
9841 const mousePos = container.interactivity.mouse.position;
9842
9843 if (!mousePos) {
9844 return;
9845 }
9846
9847 const distance = Math.abs(container.retina.connectModeRadius),
9848 query = container.particles.quadTree.queryCircle(mousePos, distance);
9849 let i = 0;
9850
9851 for (const p1 of query) {
9852 const pos1 = p1.getPosition();
9853
9854 for (const p2 of query.slice(i + 1)) {
9855 const pos2 = p2.getPosition(),
9856 distMax = Math.abs(container.retina.connectModeDistance),
9857 xDiff = Math.abs(pos1.x - pos2.x),
9858 yDiff = Math.abs(pos1.y - pos2.y);
9859
9860 if (xDiff < distMax && yDiff < distMax) {
9861 container.canvas.drawConnectLine(p1, p2);
9862 }
9863 }
9864
9865 ++i;
9866 }
9867 }
9868 }
9869
9870}
9871;// CONCATENATED MODULE: ../../interactions/external/connect/dist/esm/index.js
9872
9873async function loadExternalConnectInteraction(engine) {
9874 await engine.addInteractor("externalConnect", container => new Connector(container));
9875}
9876;// CONCATENATED MODULE: ../../interactions/external/grab/dist/esm/Grabber.js
9877
9878class Grabber extends ExternalInteractorBase {
9879 constructor(container) {
9880 super(container);
9881 }
9882
9883 isEnabled() {
9884 const container = this.container,
9885 mouse = container.interactivity.mouse,
9886 events = container.actualOptions.interactivity.events;
9887 return events.onHover.enable && !!mouse.position && isInArray("grab", events.onHover.mode);
9888 }
9889
9890 reset() {}
9891
9892 async interact() {
9893 var _a;
9894
9895 const container = this.container,
9896 options = container.actualOptions,
9897 interactivity = options.interactivity;
9898
9899 if (!interactivity.events.onHover.enable || container.interactivity.status !== mouseMoveEvent) {
9900 return;
9901 }
9902
9903 const mousePos = container.interactivity.mouse.position;
9904
9905 if (!mousePos) {
9906 return;
9907 }
9908
9909 const distance = container.retina.grabModeDistance,
9910 query = container.particles.quadTree.queryCircle(mousePos, distance);
9911
9912 for (const particle of query) {
9913 const pos = particle.getPosition(),
9914 pointDistance = getDistance(pos, mousePos);
9915
9916 if (pointDistance > distance) {
9917 continue;
9918 }
9919
9920 const grabLineOptions = interactivity.modes.grab.links,
9921 lineOpacity = grabLineOptions.opacity,
9922 opacityLine = lineOpacity - pointDistance * lineOpacity / distance;
9923
9924 if (opacityLine <= 0) {
9925 continue;
9926 }
9927
9928 const optColor = (_a = grabLineOptions.color) !== null && _a !== void 0 ? _a : particle.options.links.color;
9929
9930 if (!container.particles.grabLineColor) {
9931 const linksOptions = options.interactivity.modes.grab.links;
9932 container.particles.grabLineColor = getLinkRandomColor(optColor, linksOptions.blink, linksOptions.consent);
9933 }
9934
9935 const colorLine = getLinkColor(particle, undefined, container.particles.grabLineColor);
9936
9937 if (!colorLine) {
9938 return;
9939 }
9940
9941 container.canvas.drawGrabLine(particle, colorLine, opacityLine, mousePos);
9942 }
9943 }
9944
9945}
9946;// CONCATENATED MODULE: ../../interactions/external/grab/dist/esm/index.js
9947
9948async function loadExternalGrabInteraction(engine) {
9949 await engine.addInteractor("externalGrab", container => new Grabber(container));
9950}
9951;// CONCATENATED MODULE: ../../interactions/external/pause/dist/esm/Pauser.js
9952
9953class Pauser extends ExternalInteractorBase {
9954 constructor(container) {
9955 super(container);
9956
9957 this.handleClickMode = mode => {
9958 if (mode !== "pause") {
9959 return;
9960 }
9961
9962 const container = this.container;
9963
9964 if (container.getAnimationStatus()) {
9965 container.pause();
9966 } else {
9967 container.play();
9968 }
9969 };
9970 }
9971
9972 isEnabled() {
9973 return true;
9974 }
9975
9976 reset() {}
9977
9978 async interact() {}
9979
9980}
9981;// CONCATENATED MODULE: ../../interactions/external/pause/dist/esm/index.js
9982
9983function loadExternalPauseInteraction(engine) {
9984 engine.addInteractor("externalPause", container => new Pauser(container));
9985}
9986;// CONCATENATED MODULE: ../../interactions/external/push/dist/esm/Pusher.js
9987
9988
9989class Pusher extends ExternalInteractorBase {
9990 constructor(container) {
9991 super(container);
9992
9993 this.handleClickMode = mode => {
9994 if (mode !== "push") {
9995 return;
9996 }
9997
9998 const container = this.container;
9999 const options = container.actualOptions;
10000 const pushNb = options.interactivity.modes.push.quantity;
10001
10002 if (pushNb <= 0) {
10003 return;
10004 }
10005
10006 const pushOptions = options.interactivity.modes.push;
10007 const group = itemFromArray([undefined, ...pushOptions.groups]);
10008 const groupOptions = group !== undefined ? container.actualOptions.particles.groups[group] : undefined;
10009 container.particles.push(pushNb, container.interactivity.mouse, groupOptions, group);
10010 };
10011 }
10012
10013 isEnabled() {
10014 return true;
10015 }
10016
10017 reset() {}
10018
10019 async interact() {}
10020
10021}
10022;// CONCATENATED MODULE: ../../interactions/external/push/dist/esm/index.js
10023
10024async function loadExternalPushInteraction(engine) {
10025 await engine.addInteractor("externalPush", container => new Pusher(container));
10026}
10027;// CONCATENATED MODULE: ../../interactions/external/remove/dist/esm/Remover.js
10028
10029class Remover extends ExternalInteractorBase {
10030 constructor(container) {
10031 super(container);
10032
10033 this.handleClickMode = mode => {
10034 if (mode !== "remove") {
10035 return;
10036 }
10037
10038 const container = this.container;
10039 const options = container.actualOptions;
10040 const removeNb = options.interactivity.modes.remove.quantity;
10041 container.particles.removeQuantity(removeNb);
10042 };
10043 }
10044
10045 isEnabled() {
10046 return true;
10047 }
10048
10049 reset() {}
10050
10051 async interact() {}
10052
10053}
10054;// CONCATENATED MODULE: ../../interactions/external/remove/dist/esm/index.js
10055
10056function loadExternalRemoveInteraction(engine) {
10057 engine.addInteractor("externalRemove", container => new Remover(container));
10058}
10059;// CONCATENATED MODULE: ../../interactions/external/repulse/dist/esm/Repulser.js
10060
10061class Repulser extends ExternalInteractorBase {
10062 constructor(container) {
10063 super(container);
10064
10065 if (!container.repulse) {
10066 container.repulse = {
10067 particles: []
10068 };
10069 }
10070
10071 this.handleClickMode = mode => {
10072 const options = this.container.actualOptions;
10073
10074 if (mode !== "repulse") {
10075 return;
10076 }
10077
10078 if (!container.repulse) {
10079 container.repulse = {
10080 particles: []
10081 };
10082 }
10083
10084 container.repulse.clicking = true;
10085 container.repulse.count = 0;
10086
10087 for (const particle of container.repulse.particles) {
10088 particle.velocity.setTo(particle.initialVelocity);
10089 }
10090
10091 container.repulse.particles = [];
10092 container.repulse.finish = false;
10093 setTimeout(() => {
10094 if (!container.destroyed) {
10095 if (!container.repulse) {
10096 container.repulse = {
10097 particles: []
10098 };
10099 }
10100
10101 container.repulse.clicking = false;
10102 }
10103 }, options.interactivity.modes.repulse.duration * 1000);
10104 };
10105 }
10106
10107 isEnabled() {
10108 const container = this.container,
10109 options = container.actualOptions,
10110 mouse = container.interactivity.mouse,
10111 events = options.interactivity.events,
10112 divs = events.onDiv,
10113 divRepulse = isDivModeEnabled("repulse", divs);
10114
10115 if (!(divRepulse || events.onHover.enable && mouse.position || events.onClick.enable && mouse.clickPosition)) {
10116 return false;
10117 }
10118
10119 const hoverMode = events.onHover.mode,
10120 clickMode = events.onClick.mode;
10121 return isInArray("repulse", hoverMode) || isInArray("repulse", clickMode) || divRepulse;
10122 }
10123
10124 reset() {}
10125
10126 async interact() {
10127 const container = this.container,
10128 options = container.actualOptions,
10129 mouseMoveStatus = container.interactivity.status === mouseMoveEvent,
10130 events = options.interactivity.events,
10131 hoverEnabled = events.onHover.enable,
10132 hoverMode = events.onHover.mode,
10133 clickEnabled = events.onClick.enable,
10134 clickMode = events.onClick.mode,
10135 divs = events.onDiv;
10136
10137 if (mouseMoveStatus && hoverEnabled && isInArray("repulse", hoverMode)) {
10138 this.hoverRepulse();
10139 } else if (clickEnabled && isInArray("repulse", clickMode)) {
10140 this.clickRepulse();
10141 } else {
10142 divModeExecute("repulse", divs, (selector, div) => this.singleSelectorRepulse(selector, div));
10143 }
10144 }
10145
10146 singleSelectorRepulse(selector, div) {
10147 const container = this.container,
10148 query = document.querySelectorAll(selector);
10149
10150 if (!query.length) {
10151 return;
10152 }
10153
10154 query.forEach(item => {
10155 const elem = item,
10156 pxRatio = container.retina.pixelRatio,
10157 pos = {
10158 x: (elem.offsetLeft + elem.offsetWidth / 2) * pxRatio,
10159 y: (elem.offsetTop + elem.offsetHeight / 2) * pxRatio
10160 },
10161 repulseRadius = elem.offsetWidth / 2 * pxRatio,
10162 area = div.type === "circle" ? new Circle(pos.x, pos.y, repulseRadius) : new Rectangle(elem.offsetLeft * pxRatio, elem.offsetTop * pxRatio, elem.offsetWidth * pxRatio, elem.offsetHeight * pxRatio),
10163 divs = container.actualOptions.interactivity.modes.repulse.divs,
10164 divRepulse = divMode(divs, elem);
10165 this.processRepulse(pos, repulseRadius, area, divRepulse);
10166 });
10167 }
10168
10169 hoverRepulse() {
10170 const container = this.container,
10171 mousePos = container.interactivity.mouse.position;
10172
10173 if (!mousePos) {
10174 return;
10175 }
10176
10177 const repulseRadius = container.retina.repulseModeDistance;
10178 this.processRepulse(mousePos, repulseRadius, new Circle(mousePos.x, mousePos.y, repulseRadius));
10179 }
10180
10181 processRepulse(position, repulseRadius, area, divRepulse) {
10182 var _a;
10183
10184 const container = this.container,
10185 query = container.particles.quadTree.query(area),
10186 repulseOptions = container.actualOptions.interactivity.modes.repulse;
10187
10188 for (const particle of query) {
10189 const {
10190 dx,
10191 dy,
10192 distance
10193 } = getDistances(particle.position, position),
10194 velocity = ((_a = divRepulse === null || divRepulse === void 0 ? void 0 : divRepulse.speed) !== null && _a !== void 0 ? _a : repulseOptions.speed) * repulseOptions.factor,
10195 repulseFactor = clamp(calcEasing(1 - distance / repulseRadius, repulseOptions.easing) * velocity, 0, repulseOptions.maxSpeed),
10196 normVec = Vector.create(distance === 0 ? velocity : dx / distance * repulseFactor, distance === 0 ? velocity : dy / distance * repulseFactor);
10197 particle.position.addTo(normVec);
10198 }
10199 }
10200
10201 clickRepulse() {
10202 const container = this.container;
10203
10204 if (!container.repulse) {
10205 container.repulse = {
10206 particles: []
10207 };
10208 }
10209
10210 if (!container.repulse.finish) {
10211 if (!container.repulse.count) {
10212 container.repulse.count = 0;
10213 }
10214
10215 container.repulse.count++;
10216
10217 if (container.repulse.count === container.particles.count) {
10218 container.repulse.finish = true;
10219 }
10220 }
10221
10222 if (container.repulse.clicking) {
10223 const repulseDistance = container.retina.repulseModeDistance,
10224 repulseRadius = Math.pow(repulseDistance / 6, 3),
10225 mouseClickPos = container.interactivity.mouse.clickPosition;
10226
10227 if (mouseClickPos === undefined) {
10228 return;
10229 }
10230
10231 const range = new Circle(mouseClickPos.x, mouseClickPos.y, repulseRadius),
10232 query = container.particles.quadTree.query(range);
10233
10234 for (const particle of query) {
10235 const {
10236 dx,
10237 dy,
10238 distance
10239 } = getDistances(mouseClickPos, particle.position),
10240 d = distance ** 2,
10241 velocity = container.actualOptions.interactivity.modes.repulse.speed,
10242 force = -repulseRadius * velocity / d;
10243
10244 if (d <= repulseRadius) {
10245 container.repulse.particles.push(particle);
10246 const vect = Vector.create(dx, dy);
10247 vect.length = force;
10248 particle.velocity.setTo(vect);
10249 }
10250 }
10251 } else if (container.repulse.clicking === false) {
10252 for (const particle of container.repulse.particles) {
10253 particle.velocity.setTo(particle.initialVelocity);
10254 }
10255
10256 container.repulse.particles = [];
10257 }
10258 }
10259
10260}
10261;// CONCATENATED MODULE: ../../interactions/external/repulse/dist/esm/index.js
10262
10263async function loadExternalRepulseInteraction(engine) {
10264 await engine.addInteractor("externalRepulse", container => new Repulser(container));
10265}
10266;// CONCATENATED MODULE: ../../shapes/image/dist/esm/Utils.js
10267
10268const currentColorRegex = /(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d.]+%?\))|currentcolor/gi;
10269
10270function replaceColorSvg(imageShape, color, opacity) {
10271 const {
10272 svgData
10273 } = imageShape;
10274
10275 if (!svgData) {
10276 return "";
10277 }
10278
10279 const colorStyle = getStyleFromHsl(color, opacity);
10280
10281 if (svgData.includes("fill")) {
10282 return svgData.replace(currentColorRegex, () => colorStyle);
10283 }
10284
10285 const preFillIndex = svgData.indexOf(">");
10286 return `${svgData.substring(0, preFillIndex)} fill="${colorStyle}"${svgData.substring(preFillIndex)}`;
10287}
10288
10289async function loadImage(image) {
10290 return new Promise(resolve => {
10291 image.loading = true;
10292 const img = new Image();
10293 img.addEventListener("load", () => {
10294 image.element = img;
10295 image.loading = false;
10296 resolve();
10297 });
10298 img.addEventListener("error", () => {
10299 image.error = true;
10300 image.loading = false;
10301 console.error(`Error tsParticles - loading image: ${image.source}`);
10302 resolve();
10303 });
10304 img.src = image.source;
10305 });
10306}
10307async function downloadSvgImage(image) {
10308 if (image.type !== "svg") {
10309 await loadImage(image);
10310 return;
10311 }
10312
10313 image.loading = true;
10314 const response = await fetch(image.source);
10315 image.loading = false;
10316
10317 if (!response.ok) {
10318 console.error("Error tsParticles - Image not found");
10319 image.error = true;
10320 }
10321
10322 if (!image.error) {
10323 image.svgData = await response.text();
10324 }
10325}
10326function replaceImageColor(image, imageData, color, particle) {
10327 var _a, _b, _c;
10328
10329 const svgColoredData = replaceColorSvg(image, color, (_b = (_a = particle.opacity) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 1);
10330 const svg = new Blob([svgColoredData], {
10331 type: "image/svg+xml"
10332 });
10333 const domUrl = URL || window.URL || window.webkitURL || window;
10334 const url = domUrl.createObjectURL(svg);
10335 const img = new Image();
10336 const imageRes = {
10337 data: Object.assign(Object.assign({}, image), {
10338 svgData: svgColoredData
10339 }),
10340 ratio: imageData.width / imageData.height,
10341 replaceColor: (_c = imageData.replaceColor) !== null && _c !== void 0 ? _c : imageData.replace_color,
10342 source: imageData.src
10343 };
10344 img.addEventListener("load", () => {
10345 const pImage = particle.image;
10346
10347 if (pImage) {
10348 pImage.loaded = true;
10349 image.element = img;
10350 }
10351
10352 domUrl.revokeObjectURL(url);
10353 });
10354 img.addEventListener("error", () => {
10355 domUrl.revokeObjectURL(url);
10356 const img2 = Object.assign(Object.assign({}, image), {
10357 error: false,
10358 loading: true
10359 });
10360 loadImage(img2).then(() => {
10361 const pImage = particle.image;
10362
10363 if (pImage) {
10364 image.element = img2.element;
10365 pImage.loaded = true;
10366 }
10367 });
10368 });
10369 img.src = url;
10370 return imageRes;
10371}
10372;// CONCATENATED MODULE: ../../shapes/image/dist/esm/ImageDrawer.js
10373var ImageDrawer_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function (receiver, state, value, kind, f) {
10374 if (kind === "m") throw new TypeError("Private method is not writable");
10375 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
10376 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
10377 return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
10378};
10379
10380var ImageDrawer_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function (receiver, state, kind, f) {
10381 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10382 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10383 return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
10384};
10385
10386var _ImageDrawer_images;
10387
10388
10389class ImageDrawer {
10390 constructor() {
10391 _ImageDrawer_images.set(this, void 0);
10392
10393 ImageDrawer_classPrivateFieldSet(this, _ImageDrawer_images, [], "f");
10394 }
10395
10396 getSidesCount() {
10397 return 12;
10398 }
10399
10400 getImages(container) {
10401 const containerImages = ImageDrawer_classPrivateFieldGet(this, _ImageDrawer_images, "f").find(t => t.id === container.id);
10402
10403 if (!containerImages) {
10404 ImageDrawer_classPrivateFieldGet(this, _ImageDrawer_images, "f").push({
10405 id: container.id,
10406 images: []
10407 });
10408
10409 return this.getImages(container);
10410 } else {
10411 return containerImages;
10412 }
10413 }
10414
10415 addImage(container, image) {
10416 const containerImages = this.getImages(container);
10417 containerImages === null || containerImages === void 0 ? void 0 : containerImages.images.push(image);
10418 }
10419
10420 destroy() {
10421 ImageDrawer_classPrivateFieldSet(this, _ImageDrawer_images, [], "f");
10422 }
10423
10424 draw(context, particle, radius, opacity) {
10425 var _a, _b;
10426
10427 const image = particle.image;
10428 const element = (_a = image === null || image === void 0 ? void 0 : image.data) === null || _a === void 0 ? void 0 : _a.element;
10429
10430 if (!element) {
10431 return;
10432 }
10433
10434 const ratio = (_b = image === null || image === void 0 ? void 0 : image.ratio) !== null && _b !== void 0 ? _b : 1;
10435 const pos = {
10436 x: -radius,
10437 y: -radius
10438 };
10439
10440 if (!(image === null || image === void 0 ? void 0 : image.data.svgData) || !(image === null || image === void 0 ? void 0 : image.replaceColor)) {
10441 context.globalAlpha = opacity;
10442 }
10443
10444 context.drawImage(element, pos.x, pos.y, radius * 2, radius * 2 / ratio);
10445
10446 if (!(image === null || image === void 0 ? void 0 : image.data.svgData) || !(image === null || image === void 0 ? void 0 : image.replaceColor)) {
10447 context.globalAlpha = 1;
10448 }
10449 }
10450
10451 loadShape(particle) {
10452 var _a, _b, _c;
10453
10454 if (particle.shape !== "image" && particle.shape !== "images") {
10455 return;
10456 }
10457
10458 const images = this.getImages(particle.container).images;
10459 const imageData = particle.shapeData;
10460 const image = images.find(t => t.source === imageData.src);
10461 let imageRes;
10462
10463 if (!image) {
10464 this.loadImageShape(particle.container, imageData).then(() => {
10465 this.loadShape(particle);
10466 });
10467 return;
10468 }
10469
10470 if (image.error) {
10471 return;
10472 }
10473
10474 const color = particle.getFillColor();
10475
10476 if (image.svgData && imageData.replaceColor && color) {
10477 imageRes = replaceImageColor(image, imageData, color, particle);
10478 } else {
10479 imageRes = {
10480 data: image,
10481 loaded: true,
10482 ratio: imageData.width / imageData.height,
10483 replaceColor: (_a = imageData.replaceColor) !== null && _a !== void 0 ? _a : imageData.replace_color,
10484 source: imageData.src
10485 };
10486 }
10487
10488 if (!imageRes.ratio) {
10489 imageRes.ratio = 1;
10490 }
10491
10492 const fill = (_b = imageData.fill) !== null && _b !== void 0 ? _b : particle.fill;
10493 const close = (_c = imageData.close) !== null && _c !== void 0 ? _c : particle.close;
10494 const imageShape = {
10495 image: imageRes,
10496 fill,
10497 close
10498 };
10499 particle.image = imageShape.image;
10500 particle.fill = imageShape.fill;
10501 particle.close = imageShape.close;
10502 }
10503
10504 async loadImageShape(container, imageShape) {
10505 const source = imageShape.src;
10506
10507 if (!source) {
10508 throw new Error("Error tsParticles - No image.src");
10509 }
10510
10511 try {
10512 const image = {
10513 source: source,
10514 type: source.substr(source.length - 3),
10515 error: false,
10516 loading: true
10517 };
10518 this.addImage(container, image);
10519 const imageFunc = imageShape.replaceColor ? downloadSvgImage : loadImage;
10520 await imageFunc(image);
10521 } catch (_a) {
10522 throw new Error(`tsParticles error - ${imageShape.src} not found`);
10523 }
10524 }
10525
10526}
10527_ImageDrawer_images = new WeakMap();
10528;// CONCATENATED MODULE: ../../shapes/image/dist/esm/index.js
10529
10530async function loadImageShape(engine) {
10531 const imageDrawer = new ImageDrawer();
10532 await engine.addShape("image", imageDrawer);
10533 await engine.addShape("images", imageDrawer);
10534}
10535;// CONCATENATED MODULE: ../../updaters/life/dist/esm/LifeUpdater.js
10536
10537class LifeUpdater {
10538 constructor(container) {
10539 this.container = container;
10540 }
10541
10542 init() {}
10543
10544 isEnabled(particle) {
10545 return !particle.destroyed;
10546 }
10547
10548 update(particle, delta) {
10549 if (!this.isEnabled(particle)) {
10550 return;
10551 }
10552
10553 const life = particle.life;
10554 let justSpawned = false;
10555
10556 if (particle.spawning) {
10557 life.delayTime += delta.value;
10558
10559 if (life.delayTime >= particle.life.delay) {
10560 justSpawned = true;
10561 particle.spawning = false;
10562 life.delayTime = 0;
10563 life.time = 0;
10564 } else {
10565 return;
10566 }
10567 }
10568
10569 if (life.duration === -1) {
10570 return;
10571 }
10572
10573 if (particle.spawning) {
10574 return;
10575 }
10576
10577 if (justSpawned) {
10578 life.time = 0;
10579 } else {
10580 life.time += delta.value;
10581 }
10582
10583 if (life.time < life.duration) {
10584 return;
10585 }
10586
10587 life.time = 0;
10588
10589 if (particle.life.count > 0) {
10590 particle.life.count--;
10591 }
10592
10593 if (particle.life.count === 0) {
10594 particle.destroy();
10595 return;
10596 }
10597
10598 const canvasSize = this.container.canvas.size,
10599 widthRange = setRangeValue(0, canvasSize.width),
10600 heightRange = setRangeValue(0, canvasSize.width);
10601 particle.position.x = randomInRange(widthRange);
10602 particle.position.y = randomInRange(heightRange);
10603 particle.spawning = true;
10604 life.delayTime = 0;
10605 life.time = 0;
10606 particle.reset();
10607 const lifeOptions = particle.options.life;
10608 life.delay = getRangeValue(lifeOptions.delay.value) * 1000;
10609 life.duration = getRangeValue(lifeOptions.duration.value) * 1000;
10610 }
10611
10612}
10613;// CONCATENATED MODULE: ../../updaters/life/dist/esm/index.js
10614
10615async function loadLifeUpdater(engine) {
10616 await engine.addParticleUpdater("life", container => new LifeUpdater(container));
10617}
10618;// CONCATENATED MODULE: ../../shapes/line/dist/esm/LineDrawer.js
10619class LineDrawer {
10620 getSidesCount() {
10621 return 1;
10622 }
10623
10624 draw(context, particle, radius) {
10625 context.moveTo(-radius / 2, 0);
10626 context.lineTo(radius / 2, 0);
10627 }
10628
10629}
10630;// CONCATENATED MODULE: ../../shapes/line/dist/esm/index.js
10631
10632async function loadLineShape(engine) {
10633 await engine.addShape("line", new LineDrawer());
10634}
10635;// CONCATENATED MODULE: ../../updaters/opacity/dist/esm/OpacityUpdater.js
10636
10637
10638function checkDestroy(particle, value, minValue, maxValue) {
10639 switch (particle.options.opacity.animation.destroy) {
10640 case "max":
10641 if (value >= maxValue) {
10642 particle.destroy();
10643 }
10644
10645 break;
10646
10647 case "min":
10648 if (value <= minValue) {
10649 particle.destroy();
10650 }
10651
10652 break;
10653 }
10654}
10655
10656function updateOpacity(particle, delta) {
10657 var _a, _b, _c, _d, _e;
10658
10659 if (!particle.opacity) {
10660 return;
10661 }
10662
10663 const minValue = particle.opacity.min;
10664 const maxValue = particle.opacity.max;
10665
10666 if (particle.destroyed || !particle.opacity.enable || ((_a = particle.opacity.maxLoops) !== null && _a !== void 0 ? _a : 0) > 0 && ((_b = particle.opacity.loops) !== null && _b !== void 0 ? _b : 0) > ((_c = particle.opacity.maxLoops) !== null && _c !== void 0 ? _c : 0)) {
10667 return;
10668 }
10669
10670 switch (particle.opacity.status) {
10671 case 0:
10672 if (particle.opacity.value >= maxValue) {
10673 particle.opacity.status = 1;
10674
10675 if (!particle.opacity.loops) {
10676 particle.opacity.loops = 0;
10677 }
10678
10679 particle.opacity.loops++;
10680 } else {
10681 particle.opacity.value += ((_d = particle.opacity.velocity) !== null && _d !== void 0 ? _d : 0) * delta.factor;
10682 }
10683
10684 break;
10685
10686 case 1:
10687 if (particle.opacity.value <= minValue) {
10688 particle.opacity.status = 0;
10689
10690 if (!particle.opacity.loops) {
10691 particle.opacity.loops = 0;
10692 }
10693
10694 particle.opacity.loops++;
10695 } else {
10696 particle.opacity.value -= ((_e = particle.opacity.velocity) !== null && _e !== void 0 ? _e : 0) * delta.factor;
10697 }
10698
10699 break;
10700 }
10701
10702 checkDestroy(particle, particle.opacity.value, minValue, maxValue);
10703
10704 if (!particle.destroyed) {
10705 particle.opacity.value = clamp(particle.opacity.value, minValue, maxValue);
10706 }
10707}
10708
10709class OpacityUpdater {
10710 constructor(container) {
10711 this.container = container;
10712 }
10713
10714 init(particle) {
10715 const opacityOptions = particle.options.opacity;
10716 particle.opacity = {
10717 enable: opacityOptions.animation.enable,
10718 max: getRangeMax(opacityOptions.value),
10719 min: getRangeMin(opacityOptions.value),
10720 value: getRangeValue(opacityOptions.value),
10721 loops: 0,
10722 maxLoops: getRangeValue(opacityOptions.animation.count)
10723 };
10724 const opacityAnimation = opacityOptions.animation;
10725
10726 if (opacityAnimation.enable) {
10727 particle.opacity.status = 0;
10728 const opacityRange = opacityOptions.value;
10729 particle.opacity.min = getRangeMin(opacityRange);
10730 particle.opacity.max = getRangeMax(opacityRange);
10731
10732 switch (opacityAnimation.startValue) {
10733 case "min":
10734 particle.opacity.value = particle.opacity.min;
10735 particle.opacity.status = 0;
10736 break;
10737
10738 case "random":
10739 particle.opacity.value = randomInRange(particle.opacity);
10740 particle.opacity.status = Math.random() >= 0.5 ? 0 : 1;
10741 break;
10742
10743 case "max":
10744 default:
10745 particle.opacity.value = particle.opacity.max;
10746 particle.opacity.status = 1;
10747 break;
10748 }
10749
10750 particle.opacity.velocity = getRangeValue(opacityAnimation.speed) / 100 * this.container.retina.reduceFactor;
10751
10752 if (!opacityAnimation.sync) {
10753 particle.opacity.velocity *= Math.random();
10754 }
10755 }
10756 }
10757
10758 isEnabled(particle) {
10759 var _a, _b, _c, _d;
10760
10761 return !particle.destroyed && !particle.spawning && !!particle.opacity && particle.opacity.enable && (((_a = particle.opacity.maxLoops) !== null && _a !== void 0 ? _a : 0) <= 0 || ((_b = particle.opacity.maxLoops) !== null && _b !== void 0 ? _b : 0) > 0 && ((_c = particle.opacity.loops) !== null && _c !== void 0 ? _c : 0) < ((_d = particle.opacity.maxLoops) !== null && _d !== void 0 ? _d : 0));
10762 }
10763
10764 update(particle, delta) {
10765 if (!this.isEnabled(particle)) {
10766 return;
10767 }
10768
10769 updateOpacity(particle, delta);
10770 }
10771
10772}
10773;// CONCATENATED MODULE: ../../updaters/opacity/dist/esm/index.js
10774
10775async function loadOpacityUpdater(engine) {
10776 await engine.addParticleUpdater("opacity", container => new OpacityUpdater(container));
10777}
10778;// CONCATENATED MODULE: ../../updaters/outModes/dist/esm/Utils.js
10779
10780function bounceHorizontal(data) {
10781 if (!(data.outMode === "bounce" || data.outMode === "bounce-horizontal" || data.outMode === "bounceHorizontal" || data.outMode === "split")) {
10782 return;
10783 }
10784
10785 const velocity = data.particle.velocity.x;
10786 let bounced = false;
10787
10788 if (data.direction === "right" && data.bounds.right >= data.canvasSize.width && velocity > 0 || data.direction === "left" && data.bounds.left <= 0 && velocity < 0) {
10789 const newVelocity = getValue(data.particle.options.bounce.horizontal);
10790 data.particle.velocity.x *= -newVelocity;
10791 bounced = true;
10792 }
10793
10794 if (!bounced) {
10795 return;
10796 }
10797
10798 const minPos = data.offset.x + data.size;
10799
10800 if (data.bounds.right >= data.canvasSize.width) {
10801 data.particle.position.x = data.canvasSize.width - minPos;
10802 } else if (data.bounds.left <= 0) {
10803 data.particle.position.x = minPos;
10804 }
10805
10806 if (data.outMode === "split") {
10807 data.particle.destroy();
10808 }
10809}
10810function bounceVertical(data) {
10811 if (data.outMode === "bounce" || data.outMode === "bounce-vertical" || data.outMode === "bounceVertical" || data.outMode === "split") {
10812 const velocity = data.particle.velocity.y;
10813 let bounced = false;
10814
10815 if (data.direction === "bottom" && data.bounds.bottom >= data.canvasSize.height && velocity > 0 || data.direction === "top" && data.bounds.top <= 0 && velocity < 0) {
10816 const newVelocity = getValue(data.particle.options.bounce.vertical);
10817 data.particle.velocity.y *= -newVelocity;
10818 bounced = true;
10819 }
10820
10821 if (!bounced) {
10822 return;
10823 }
10824
10825 const minPos = data.offset.y + data.size;
10826
10827 if (data.bounds.bottom >= data.canvasSize.height) {
10828 data.particle.position.y = data.canvasSize.height - minPos;
10829 } else if (data.bounds.top <= 0) {
10830 data.particle.position.y = minPos;
10831 }
10832
10833 if (data.outMode === "split") {
10834 data.particle.destroy();
10835 }
10836 }
10837}
10838;// CONCATENATED MODULE: ../../updaters/outModes/dist/esm/BounceOutMode.js
10839
10840
10841class BounceOutMode {
10842 constructor(container) {
10843 this.container = container;
10844 this.modes = ["bounce", "bounce-vertical", "bounce-horizontal", "bounceVertical", "bounceHorizontal", "split"];
10845 }
10846
10847 update(particle, direction, delta, outMode) {
10848 if (!this.modes.includes(outMode)) {
10849 return;
10850 }
10851
10852 const container = this.container;
10853 let handled = false;
10854
10855 for (const [, plugin] of container.plugins) {
10856 if (plugin.particleBounce !== undefined) {
10857 handled = plugin.particleBounce(particle, delta, direction);
10858 }
10859
10860 if (handled) {
10861 break;
10862 }
10863 }
10864
10865 if (handled) {
10866 return;
10867 }
10868
10869 const pos = particle.getPosition(),
10870 offset = particle.offset,
10871 size = particle.getRadius(),
10872 bounds = calculateBounds(pos, size),
10873 canvasSize = container.canvas.size;
10874 bounceHorizontal({
10875 particle,
10876 outMode,
10877 direction,
10878 bounds,
10879 canvasSize,
10880 offset,
10881 size
10882 });
10883 bounceVertical({
10884 particle,
10885 outMode,
10886 direction,
10887 bounds,
10888 canvasSize,
10889 offset,
10890 size
10891 });
10892 }
10893
10894}
10895;// CONCATENATED MODULE: ../../updaters/outModes/dist/esm/DestroyOutMode.js
10896
10897class DestroyOutMode {
10898 constructor(container) {
10899 this.container = container;
10900 this.modes = ["destroy"];
10901 }
10902
10903 update(particle, direction, delta, outMode) {
10904 if (!this.modes.includes(outMode)) {
10905 return;
10906 }
10907
10908 const container = this.container;
10909
10910 switch (particle.outType) {
10911 case "normal":
10912 case "outside":
10913 if (isPointInside(particle.position, container.canvas.size, Vector.origin, particle.getRadius(), direction)) {
10914 return;
10915 }
10916
10917 break;
10918
10919 case "inside":
10920 {
10921 const {
10922 dx,
10923 dy
10924 } = getDistances(particle.position, particle.moveCenter);
10925 const {
10926 x: vx,
10927 y: vy
10928 } = particle.velocity;
10929
10930 if (vx < 0 && dx > particle.moveCenter.radius || vy < 0 && dy > particle.moveCenter.radius || vx >= 0 && dx < -particle.moveCenter.radius || vy >= 0 && dy < -particle.moveCenter.radius) {
10931 return;
10932 }
10933
10934 break;
10935 }
10936 }
10937
10938 container.particles.remove(particle, undefined, true);
10939 }
10940
10941}
10942;// CONCATENATED MODULE: ../../updaters/outModes/dist/esm/NoneOutMode.js
10943
10944class NoneOutMode {
10945 constructor(container) {
10946 this.container = container;
10947 this.modes = ["none"];
10948 }
10949
10950 update(particle, direction, delta, outMode) {
10951 if (!this.modes.includes(outMode)) {
10952 return;
10953 }
10954
10955 if (particle.options.move.distance.horizontal && (direction === "left" || direction === "right") || particle.options.move.distance.vertical && (direction === "top" || direction === "bottom")) {
10956 return;
10957 }
10958
10959 const gravityOptions = particle.options.move.gravity,
10960 container = this.container;
10961 const canvasSize = container.canvas.size;
10962 const pRadius = particle.getRadius();
10963
10964 if (!gravityOptions.enable) {
10965 if (particle.velocity.y > 0 && particle.position.y <= canvasSize.height + pRadius || particle.velocity.y < 0 && particle.position.y >= -pRadius || particle.velocity.x > 0 && particle.position.x <= canvasSize.width + pRadius || particle.velocity.x < 0 && particle.position.x >= -pRadius) {
10966 return;
10967 }
10968
10969 if (!isPointInside(particle.position, container.canvas.size, Vector.origin, pRadius, direction)) {
10970 container.particles.remove(particle);
10971 }
10972 } else {
10973 const position = particle.position;
10974
10975 if (!gravityOptions.inverse && position.y > canvasSize.height + pRadius && direction === "bottom" || gravityOptions.inverse && position.y < -pRadius && direction === "top") {
10976 container.particles.remove(particle);
10977 }
10978 }
10979 }
10980
10981}
10982;// CONCATENATED MODULE: ../../updaters/outModes/dist/esm/OutOutMode.js
10983
10984class OutOutMode {
10985 constructor(container) {
10986 this.container = container;
10987 this.modes = ["out"];
10988 }
10989
10990 update(particle, direction, delta, outMode) {
10991 if (!this.modes.includes(outMode)) {
10992 return;
10993 }
10994
10995 const container = this.container;
10996
10997 switch (particle.outType) {
10998 case "inside":
10999 {
11000 const {
11001 x: vx,
11002 y: vy
11003 } = particle.velocity;
11004 const circVec = Vector.origin;
11005 circVec.length = particle.moveCenter.radius;
11006 circVec.angle = particle.velocity.angle + Math.PI;
11007 circVec.addTo(Vector.create(particle.moveCenter));
11008 const {
11009 dx,
11010 dy
11011 } = getDistances(particle.position, circVec);
11012
11013 if (vx <= 0 && dx >= 0 || vy <= 0 && dy >= 0 || vx >= 0 && dx <= 0 || vy >= 0 && dy <= 0) {
11014 return;
11015 }
11016
11017 particle.position.x = Math.floor(randomInRange({
11018 min: 0,
11019 max: container.canvas.size.width
11020 }));
11021 particle.position.y = Math.floor(randomInRange({
11022 min: 0,
11023 max: container.canvas.size.height
11024 }));
11025 const {
11026 dx: newDx,
11027 dy: newDy
11028 } = getDistances(particle.position, particle.moveCenter);
11029 particle.direction = Math.atan2(-newDy, -newDx);
11030 particle.velocity.angle = particle.direction;
11031 break;
11032 }
11033
11034 default:
11035 {
11036 if (isPointInside(particle.position, container.canvas.size, Vector.origin, particle.getRadius(), direction)) {
11037 return;
11038 }
11039
11040 switch (particle.outType) {
11041 case "outside":
11042 {
11043 particle.position.x = Math.floor(randomInRange({
11044 min: -particle.moveCenter.radius,
11045 max: particle.moveCenter.radius
11046 })) + particle.moveCenter.x;
11047 particle.position.y = Math.floor(randomInRange({
11048 min: -particle.moveCenter.radius,
11049 max: particle.moveCenter.radius
11050 })) + particle.moveCenter.y;
11051 const {
11052 dx,
11053 dy
11054 } = getDistances(particle.position, particle.moveCenter);
11055
11056 if (particle.moveCenter.radius) {
11057 particle.direction = Math.atan2(dy, dx);
11058 particle.velocity.angle = particle.direction;
11059 }
11060
11061 break;
11062 }
11063
11064 case "normal":
11065 {
11066 const wrap = particle.options.move.warp,
11067 canvasSize = container.canvas.size,
11068 newPos = {
11069 bottom: canvasSize.height + particle.getRadius() + particle.offset.y,
11070 left: -particle.getRadius() - particle.offset.x,
11071 right: canvasSize.width + particle.getRadius() + particle.offset.x,
11072 top: -particle.getRadius() - particle.offset.y
11073 },
11074 sizeValue = particle.getRadius(),
11075 nextBounds = calculateBounds(particle.position, sizeValue);
11076
11077 if (direction === "right" && nextBounds.left > canvasSize.width + particle.offset.x) {
11078 particle.position.x = newPos.left;
11079 particle.initialPosition.x = particle.position.x;
11080
11081 if (!wrap) {
11082 particle.position.y = Math.random() * canvasSize.height;
11083 particle.initialPosition.y = particle.position.y;
11084 }
11085 } else if (direction === "left" && nextBounds.right < -particle.offset.x) {
11086 particle.position.x = newPos.right;
11087 particle.initialPosition.x = particle.position.x;
11088
11089 if (!wrap) {
11090 particle.position.y = Math.random() * canvasSize.height;
11091 particle.initialPosition.y = particle.position.y;
11092 }
11093 }
11094
11095 if (direction === "bottom" && nextBounds.top > canvasSize.height + particle.offset.y) {
11096 if (!wrap) {
11097 particle.position.x = Math.random() * canvasSize.width;
11098 particle.initialPosition.x = particle.position.x;
11099 }
11100
11101 particle.position.y = newPos.top;
11102 particle.initialPosition.y = particle.position.y;
11103 } else if (direction === "top" && nextBounds.bottom < -particle.offset.y) {
11104 if (!wrap) {
11105 particle.position.x = Math.random() * canvasSize.width;
11106 particle.initialPosition.x = particle.position.x;
11107 }
11108
11109 particle.position.y = newPos.bottom;
11110 particle.initialPosition.y = particle.position.y;
11111 }
11112
11113 break;
11114 }
11115 }
11116
11117 break;
11118 }
11119 }
11120 }
11121
11122}
11123;// CONCATENATED MODULE: ../../updaters/outModes/dist/esm/OutOfCanvasUpdater.js
11124
11125
11126
11127
11128class OutOfCanvasUpdater {
11129 constructor(container) {
11130 this.container = container;
11131 this.updaters = [new BounceOutMode(container), new DestroyOutMode(container), new OutOutMode(container), new NoneOutMode(container)];
11132 }
11133
11134 init() {}
11135
11136 isEnabled(particle) {
11137 return !particle.destroyed && !particle.spawning;
11138 }
11139
11140 update(particle, delta) {
11141 var _a, _b, _c, _d;
11142
11143 const outModes = particle.options.move.outModes;
11144 this.updateOutMode(particle, delta, (_a = outModes.bottom) !== null && _a !== void 0 ? _a : outModes.default, "bottom");
11145 this.updateOutMode(particle, delta, (_b = outModes.left) !== null && _b !== void 0 ? _b : outModes.default, "left");
11146 this.updateOutMode(particle, delta, (_c = outModes.right) !== null && _c !== void 0 ? _c : outModes.default, "right");
11147 this.updateOutMode(particle, delta, (_d = outModes.top) !== null && _d !== void 0 ? _d : outModes.default, "top");
11148 }
11149
11150 updateOutMode(particle, delta, outMode, direction) {
11151 for (const updater of this.updaters) {
11152 updater.update(particle, direction, delta, outMode);
11153 }
11154 }
11155
11156}
11157;// CONCATENATED MODULE: ../../updaters/outModes/dist/esm/index.js
11158
11159async function loadOutModesUpdater(engine) {
11160 await engine.addParticleUpdater("outModes", container => new OutOfCanvasUpdater(container));
11161}
11162;// CONCATENATED MODULE: ../../move/parallax/dist/esm/ParallaxMover.js
11163
11164class ParallaxMover {
11165 init() {}
11166
11167 isEnabled(particle) {
11168 return !isSsr() && !particle.destroyed && particle.container.actualOptions.interactivity.events.onHover.parallax.enable;
11169 }
11170
11171 move(particle) {
11172 const container = particle.container,
11173 options = container.actualOptions;
11174
11175 if (isSsr() || !options.interactivity.events.onHover.parallax.enable) {
11176 return;
11177 }
11178
11179 const parallaxForce = options.interactivity.events.onHover.parallax.force,
11180 mousePos = container.interactivity.mouse.position;
11181
11182 if (!mousePos) {
11183 return;
11184 }
11185
11186 const canvasCenter = {
11187 x: container.canvas.size.width / 2,
11188 y: container.canvas.size.height / 2
11189 },
11190 parallaxSmooth = options.interactivity.events.onHover.parallax.smooth,
11191 factor = particle.getRadius() / parallaxForce,
11192 centerDistance = {
11193 x: (mousePos.x - canvasCenter.x) * factor,
11194 y: (mousePos.y - canvasCenter.y) * factor
11195 };
11196 particle.offset.x += (centerDistance.x - particle.offset.x) / parallaxSmooth;
11197 particle.offset.y += (centerDistance.y - particle.offset.y) / parallaxSmooth;
11198 }
11199
11200}
11201;// CONCATENATED MODULE: ../../move/parallax/dist/esm/index.js
11202
11203async function loadParallaxMover(engine) {
11204 engine.addMover("parallax", () => new ParallaxMover());
11205}
11206;// CONCATENATED MODULE: ../../interactions/particles/attract/dist/esm/Attractor.js
11207
11208class Attractor_Attractor extends ParticlesInteractorBase {
11209 constructor(container) {
11210 super(container);
11211 }
11212
11213 async interact(p1) {
11214 var _a;
11215
11216 const container = this.container,
11217 distance = (_a = p1.retina.attractDistance) !== null && _a !== void 0 ? _a : container.retina.attractDistance,
11218 pos1 = p1.getPosition(),
11219 query = container.particles.quadTree.queryCircle(pos1, distance);
11220
11221 for (const p2 of query) {
11222 if (p1 === p2 || !p2.options.move.attract.enable || p2.destroyed || p2.spawning) {
11223 continue;
11224 }
11225
11226 const pos2 = p2.getPosition(),
11227 {
11228 dx,
11229 dy
11230 } = getDistances(pos1, pos2),
11231 rotate = p1.options.move.attract.rotate,
11232 ax = dx / (rotate.x * 1000),
11233 ay = dy / (rotate.y * 1000),
11234 p1Factor = p2.size.value / p1.size.value,
11235 p2Factor = 1 / p1Factor;
11236 p1.velocity.x -= ax * p1Factor;
11237 p1.velocity.y -= ay * p1Factor;
11238 p2.velocity.x += ax * p2Factor;
11239 p2.velocity.y += ay * p2Factor;
11240 }
11241 }
11242
11243 isEnabled(particle) {
11244 return particle.options.move.attract.enable;
11245 }
11246
11247 reset() {}
11248
11249}
11250;// CONCATENATED MODULE: ../../interactions/particles/attract/dist/esm/index.js
11251
11252async function loadParticlesAttractInteraction(engine) {
11253 await engine.addInteractor("particlesAttract", container => new Attractor_Attractor(container));
11254}
11255;// CONCATENATED MODULE: ../../interactions/particles/collisions/dist/esm/Absorb.js
11256
11257function absorb(p1, p2, fps, pixelRatio) {
11258 if (p1.getRadius() === undefined && p2.getRadius() !== undefined) {
11259 p1.destroy();
11260 } else if (p1.getRadius() !== undefined && p2.getRadius() === undefined) {
11261 p2.destroy();
11262 } else if (p1.getRadius() !== undefined && p2.getRadius() !== undefined) {
11263 if (p1.getRadius() >= p2.getRadius()) {
11264 const factor = clamp(p1.getRadius() / p2.getRadius(), 0, p2.getRadius()) * fps;
11265 p1.size.value += factor;
11266 p2.size.value -= factor;
11267
11268 if (p2.getRadius() <= pixelRatio) {
11269 p2.size.value = 0;
11270 p2.destroy();
11271 }
11272 } else {
11273 const factor = clamp(p2.getRadius() / p1.getRadius(), 0, p1.getRadius()) * fps;
11274 p1.size.value -= factor;
11275 p2.size.value += factor;
11276
11277 if (p1.getRadius() <= pixelRatio) {
11278 p1.size.value = 0;
11279 p1.destroy();
11280 }
11281 }
11282 }
11283}
11284;// CONCATENATED MODULE: ../../interactions/particles/collisions/dist/esm/Bounce.js
11285
11286function bounce(p1, p2) {
11287 circleBounce(circleBounceDataFromParticle(p1), circleBounceDataFromParticle(p2));
11288}
11289;// CONCATENATED MODULE: ../../interactions/particles/collisions/dist/esm/Destroy.js
11290
11291function destroy(p1, p2) {
11292 if (!p1.unbreakable && !p2.unbreakable) {
11293 bounce(p1, p2);
11294 }
11295
11296 if (p1.getRadius() === undefined && p2.getRadius() !== undefined) {
11297 p1.destroy();
11298 } else if (p1.getRadius() !== undefined && p2.getRadius() === undefined) {
11299 p2.destroy();
11300 } else if (p1.getRadius() !== undefined && p2.getRadius() !== undefined) {
11301 if (p1.getRadius() >= p2.getRadius()) {
11302 p2.destroy();
11303 } else {
11304 p1.destroy();
11305 }
11306 }
11307}
11308;// CONCATENATED MODULE: ../../interactions/particles/collisions/dist/esm/ResolveCollision.js
11309
11310
11311
11312function resolveCollision(p1, p2, fps, pixelRatio) {
11313 switch (p1.options.collisions.mode) {
11314 case "absorb":
11315 {
11316 absorb(p1, p2, fps, pixelRatio);
11317 break;
11318 }
11319
11320 case "bounce":
11321 {
11322 bounce(p1, p2);
11323 break;
11324 }
11325
11326 case "destroy":
11327 {
11328 destroy(p1, p2);
11329 break;
11330 }
11331 }
11332}
11333;// CONCATENATED MODULE: ../../interactions/particles/collisions/dist/esm/Collider.js
11334
11335
11336class Collider extends ParticlesInteractorBase {
11337 constructor(container) {
11338 super(container);
11339 }
11340
11341 isEnabled(particle) {
11342 return particle.options.collisions.enable;
11343 }
11344
11345 reset() {}
11346
11347 async interact(p1) {
11348 const container = this.container,
11349 pos1 = p1.getPosition(),
11350 radius1 = p1.getRadius(),
11351 query = container.particles.quadTree.queryCircle(pos1, radius1 * 2);
11352
11353 for (const p2 of query) {
11354 if (p1 === p2 || !p2.options.collisions.enable || p1.options.collisions.mode !== p2.options.collisions.mode || p2.destroyed || p2.spawning) {
11355 continue;
11356 }
11357
11358 const pos2 = p2.getPosition();
11359 const radius2 = p2.getRadius();
11360
11361 if (Math.abs(Math.round(pos1.z) - Math.round(pos2.z)) > radius1 + radius2) {
11362 continue;
11363 }
11364
11365 const dist = getDistance(pos1, pos2);
11366 const distP = radius1 + radius2;
11367
11368 if (dist > distP) {
11369 continue;
11370 }
11371
11372 resolveCollision(p1, p2, container.fpsLimit / 1000, container.retina.pixelRatio);
11373 }
11374 }
11375
11376}
11377;// CONCATENATED MODULE: ../../interactions/particles/collisions/dist/esm/index.js
11378
11379async function loadParticlesCollisionsInteraction(engine) {
11380 await engine.addInteractor("particlesCollisions", container => new Collider(container));
11381}
11382;// CONCATENATED MODULE: ../../interactions/particles/links/dist/esm/Linker.js
11383
11384
11385function getLinkDistance(pos1, pos2, optDistance, canvasSize, warp) {
11386 let distance = getDistance(pos1, pos2);
11387
11388 if (!warp || distance <= optDistance) {
11389 return distance;
11390 }
11391
11392 const pos2NE = {
11393 x: pos2.x - canvasSize.width,
11394 y: pos2.y
11395 };
11396 distance = getDistance(pos1, pos2NE);
11397
11398 if (distance <= optDistance) {
11399 return distance;
11400 }
11401
11402 const pos2SE = {
11403 x: pos2.x - canvasSize.width,
11404 y: pos2.y - canvasSize.height
11405 };
11406 distance = getDistance(pos1, pos2SE);
11407
11408 if (distance <= optDistance) {
11409 return distance;
11410 }
11411
11412 const pos2SW = {
11413 x: pos2.x,
11414 y: pos2.y - canvasSize.height
11415 };
11416 distance = getDistance(pos1, pos2SW);
11417 return distance;
11418}
11419
11420class Linker extends ParticlesInteractorBase {
11421 constructor(container) {
11422 super(container);
11423 }
11424
11425 isEnabled(particle) {
11426 return particle.options.links.enable;
11427 }
11428
11429 reset() {}
11430
11431 async interact(p1) {
11432 var _a;
11433
11434 p1.links = [];
11435 const pos1 = p1.getPosition(),
11436 container = this.container,
11437 canvasSize = container.canvas.size;
11438
11439 if (pos1.x < 0 || pos1.y < 0 || pos1.x > canvasSize.width || pos1.y > canvasSize.height) {
11440 return;
11441 }
11442
11443 const linkOpt1 = p1.options.links,
11444 optOpacity = linkOpt1.opacity,
11445 optDistance = (_a = p1.retina.linksDistance) !== null && _a !== void 0 ? _a : container.retina.linksDistance,
11446 warp = linkOpt1.warp,
11447 range = warp ? new CircleWarp(pos1.x, pos1.y, optDistance, canvasSize) : new Circle(pos1.x, pos1.y, optDistance),
11448 query = container.particles.quadTree.query(range);
11449
11450 for (const p2 of query) {
11451 const linkOpt2 = p2.options.links;
11452
11453 if (p1 === p2 || !linkOpt2.enable || linkOpt1.id !== linkOpt2.id || p2.spawning || p2.destroyed || p1.links.map(t => t.destination).indexOf(p2) !== -1 || p2.links.map(t => t.destination).indexOf(p1) !== -1) {
11454 continue;
11455 }
11456
11457 const pos2 = p2.getPosition();
11458
11459 if (pos2.x < 0 || pos2.y < 0 || pos2.x > canvasSize.width || pos2.y > canvasSize.height) {
11460 continue;
11461 }
11462
11463 const distance = getLinkDistance(pos1, pos2, optDistance, canvasSize, warp && linkOpt2.warp);
11464
11465 if (distance > optDistance) {
11466 return;
11467 }
11468
11469 const opacityLine = (1 - distance / optDistance) * optOpacity;
11470 this.setColor(p1);
11471 p1.links.push({
11472 destination: p2,
11473 opacity: opacityLine
11474 });
11475 }
11476 }
11477
11478 setColor(p1) {
11479 const container = this.container,
11480 linksOptions = p1.options.links;
11481 let linkColor = linksOptions.id === undefined ? container.particles.linksColor : container.particles.linksColors.get(linksOptions.id);
11482
11483 if (!linkColor) {
11484 const optColor = linksOptions.color;
11485 linkColor = getLinkRandomColor(optColor, linksOptions.blink, linksOptions.consent);
11486
11487 if (linksOptions.id === undefined) {
11488 container.particles.linksColor = linkColor;
11489 } else {
11490 container.particles.linksColors.set(linksOptions.id, linkColor);
11491 }
11492 }
11493 }
11494
11495}
11496;// CONCATENATED MODULE: ../../interactions/particles/links/dist/esm/interaction.js
11497
11498async function loadInteraction(engine) {
11499 await engine.addInteractor("particlesLinks", container => new Linker(container));
11500}
11501;// CONCATENATED MODULE: ../../interactions/particles/links/dist/esm/Utils.js
11502
11503function drawLinkLine(context, width, begin, end, maxDistance, canvasSize, warp, backgroundMask, composite, colorLine, opacity, shadow) {
11504 let drawn = false;
11505
11506 if (getDistance(begin, end) <= maxDistance) {
11507 drawLine(context, begin, end);
11508 drawn = true;
11509 } else if (warp) {
11510 let pi1;
11511 let pi2;
11512 const endNE = {
11513 x: end.x - canvasSize.width,
11514 y: end.y
11515 };
11516 const d1 = getDistances(begin, endNE);
11517
11518 if (d1.distance <= maxDistance) {
11519 const yi = begin.y - d1.dy / d1.dx * begin.x;
11520 pi1 = {
11521 x: 0,
11522 y: yi
11523 };
11524 pi2 = {
11525 x: canvasSize.width,
11526 y: yi
11527 };
11528 } else {
11529 const endSW = {
11530 x: end.x,
11531 y: end.y - canvasSize.height
11532 };
11533 const d2 = getDistances(begin, endSW);
11534
11535 if (d2.distance <= maxDistance) {
11536 const yi = begin.y - d2.dy / d2.dx * begin.x;
11537 const xi = -yi / (d2.dy / d2.dx);
11538 pi1 = {
11539 x: xi,
11540 y: 0
11541 };
11542 pi2 = {
11543 x: xi,
11544 y: canvasSize.height
11545 };
11546 } else {
11547 const endSE = {
11548 x: end.x - canvasSize.width,
11549 y: end.y - canvasSize.height
11550 };
11551 const d3 = getDistances(begin, endSE);
11552
11553 if (d3.distance <= maxDistance) {
11554 const yi = begin.y - d3.dy / d3.dx * begin.x;
11555 const xi = -yi / (d3.dy / d3.dx);
11556 pi1 = {
11557 x: xi,
11558 y: yi
11559 };
11560 pi2 = {
11561 x: pi1.x + canvasSize.width,
11562 y: pi1.y + canvasSize.height
11563 };
11564 }
11565 }
11566 }
11567
11568 if (pi1 && pi2) {
11569 drawLine(context, begin, pi1);
11570 drawLine(context, end, pi2);
11571 drawn = true;
11572 }
11573 }
11574
11575 if (!drawn) {
11576 return;
11577 }
11578
11579 context.lineWidth = width;
11580
11581 if (backgroundMask) {
11582 context.globalCompositeOperation = composite;
11583 }
11584
11585 context.strokeStyle = getStyleFromRgb(colorLine, opacity);
11586
11587 if (shadow.enable) {
11588 const shadowColor = colorToRgb(shadow.color);
11589
11590 if (shadowColor) {
11591 context.shadowBlur = shadow.blur;
11592 context.shadowColor = getStyleFromRgb(shadowColor);
11593 }
11594 }
11595
11596 context.stroke();
11597}
11598function drawLinkTriangle(context, pos1, pos2, pos3, backgroundMask, composite, colorTriangle, opacityTriangle) {
11599 drawTriangle(context, pos1, pos2, pos3);
11600
11601 if (backgroundMask) {
11602 context.globalCompositeOperation = composite;
11603 }
11604
11605 context.fillStyle = getStyleFromRgb(colorTriangle, opacityTriangle);
11606 context.fill();
11607}
11608;// CONCATENATED MODULE: ../../interactions/particles/links/dist/esm/LinkInstance.js
11609
11610
11611class LinkInstance {
11612 constructor(container) {
11613 this.container = container;
11614 }
11615
11616 particleCreated(particle) {
11617 const linkParticle = particle;
11618 linkParticle.links = [];
11619 }
11620
11621 particleDestroyed(particle) {
11622 const linkParticle = particle;
11623 linkParticle.links = [];
11624 }
11625
11626 drawParticle(context, particle) {
11627 const linkParticle = particle,
11628 container = this.container,
11629 particles = container.particles,
11630 pOptions = particle.options;
11631
11632 if (linkParticle.links.length <= 0) {
11633 return;
11634 }
11635
11636 context.save();
11637 const p1Links = linkParticle.links.filter(l => {
11638 const linkFreq = container.particles.getLinkFrequency(linkParticle, l.destination);
11639 return linkFreq <= pOptions.links.frequency;
11640 });
11641
11642 for (const link of p1Links) {
11643 const p2 = link.destination;
11644
11645 if (pOptions.links.triangles.enable) {
11646 const links = p1Links.map(l => l.destination),
11647 vertices = p2.links.filter(t => {
11648 const linkFreq = container.particles.getLinkFrequency(p2, t.destination);
11649 return linkFreq <= p2.options.links.frequency && links.indexOf(t.destination) >= 0;
11650 });
11651
11652 if (vertices.length) {
11653 for (const vertex of vertices) {
11654 const p3 = vertex.destination,
11655 triangleFreq = particles.getTriangleFrequency(linkParticle, p2, p3);
11656
11657 if (triangleFreq > pOptions.links.triangles.frequency) {
11658 continue;
11659 }
11660
11661 this.drawLinkTriangle(linkParticle, link, vertex);
11662 }
11663 }
11664 }
11665
11666 if (link.opacity > 0 && container.retina.linksWidth > 0) {
11667 this.drawLinkLine(linkParticle, link);
11668 }
11669 }
11670
11671 context.restore();
11672 }
11673
11674 drawLinkTriangle(p1, link1, link2) {
11675 var _a;
11676
11677 const container = this.container,
11678 options = container.actualOptions,
11679 p2 = link1.destination,
11680 p3 = link2.destination,
11681 triangleOptions = p1.options.links.triangles,
11682 opacityTriangle = (_a = triangleOptions.opacity) !== null && _a !== void 0 ? _a : (link1.opacity + link2.opacity) / 2;
11683
11684 if (opacityTriangle <= 0) {
11685 return;
11686 }
11687
11688 container.canvas.draw(ctx => {
11689 const pos1 = p1.getPosition();
11690 const pos2 = p2.getPosition();
11691 const pos3 = p3.getPosition();
11692
11693 if (getDistance(pos1, pos2) > container.retina.linksDistance || getDistance(pos3, pos2) > container.retina.linksDistance || getDistance(pos3, pos1) > container.retina.linksDistance) {
11694 return;
11695 }
11696
11697 let colorTriangle = colorToRgb(triangleOptions.color);
11698
11699 if (!colorTriangle) {
11700 const linksOptions = p1.options.links,
11701 linkColor = linksOptions.id !== undefined ? container.particles.linksColors.get(linksOptions.id) : container.particles.linksColor;
11702 colorTriangle = getLinkColor(p1, p2, linkColor);
11703 }
11704
11705 if (!colorTriangle) {
11706 return;
11707 }
11708
11709 drawLinkTriangle(ctx, pos1, pos2, pos3, options.backgroundMask.enable, options.backgroundMask.composite, colorTriangle, opacityTriangle);
11710 });
11711 }
11712
11713 drawLinkLine(p1, link) {
11714 const container = this.container,
11715 options = container.actualOptions,
11716 p2 = link.destination,
11717 pos1 = p1.getPosition(),
11718 pos2 = p2.getPosition();
11719 let opacity = link.opacity;
11720 container.canvas.draw(ctx => {
11721 var _a, _b;
11722
11723 let colorLine;
11724 const twinkle = p1.options.twinkle.lines;
11725
11726 if (twinkle.enable) {
11727 const twinkleFreq = twinkle.frequency,
11728 twinkleRgb = colorToRgb(twinkle.color),
11729 twinkling = Math.random() < twinkleFreq;
11730
11731 if (twinkling && twinkleRgb) {
11732 colorLine = twinkleRgb;
11733 opacity = getRangeValue(twinkle.opacity);
11734 }
11735 }
11736
11737 if (!colorLine) {
11738 const linksOptions = p1.options.links,
11739 linkColor = linksOptions.id !== undefined ? container.particles.linksColors.get(linksOptions.id) : container.particles.linksColor;
11740 colorLine = getLinkColor(p1, p2, linkColor);
11741 }
11742
11743 if (!colorLine) {
11744 return;
11745 }
11746
11747 const width = (_a = p1.retina.linksWidth) !== null && _a !== void 0 ? _a : container.retina.linksWidth,
11748 maxDistance = (_b = p1.retina.linksDistance) !== null && _b !== void 0 ? _b : container.retina.linksDistance;
11749 drawLinkLine(ctx, width, pos1, pos2, maxDistance, container.canvas.size, p1.options.links.warp, options.backgroundMask.enable, options.backgroundMask.composite, colorLine, opacity, p1.options.links.shadow);
11750 });
11751 }
11752
11753}
11754;// CONCATENATED MODULE: ../../interactions/particles/links/dist/esm/plugin.js
11755
11756
11757class LinksPlugin {
11758 constructor() {
11759 this.id = "links";
11760 }
11761
11762 getPlugin(container) {
11763 return new LinkInstance(container);
11764 }
11765
11766 needsPlugin() {
11767 return true;
11768 }
11769
11770 loadOptions() {}
11771
11772}
11773
11774async function loadPlugin(engine) {
11775 const plugin = new LinksPlugin();
11776 await engine.addPlugin(plugin);
11777}
11778;// CONCATENATED MODULE: ../../interactions/particles/links/dist/esm/index.js
11779
11780
11781async function loadParticlesLinksInteraction(engine) {
11782 await loadInteraction(engine);
11783 await loadPlugin(engine);
11784}
11785;// CONCATENATED MODULE: ../../shapes/polygon/dist/esm/PolygonDrawerBase.js
11786class PolygonDrawerBase {
11787 getSidesCount(particle) {
11788 var _a, _b;
11789
11790 const polygon = particle.shapeData;
11791 return (_b = (_a = polygon === null || polygon === void 0 ? void 0 : polygon.sides) !== null && _a !== void 0 ? _a : polygon === null || polygon === void 0 ? void 0 : polygon.nb_sides) !== null && _b !== void 0 ? _b : 5;
11792 }
11793
11794 draw(context, particle, radius) {
11795 const start = this.getCenter(particle, radius);
11796 const side = this.getSidesData(particle, radius);
11797 const sideCount = side.count.numerator * side.count.denominator;
11798 const decimalSides = side.count.numerator / side.count.denominator;
11799 const interiorAngleDegrees = 180 * (decimalSides - 2) / decimalSides;
11800 const interiorAngle = Math.PI - Math.PI * interiorAngleDegrees / 180;
11801
11802 if (!context) {
11803 return;
11804 }
11805
11806 context.beginPath();
11807 context.translate(start.x, start.y);
11808 context.moveTo(0, 0);
11809
11810 for (let i = 0; i < sideCount; i++) {
11811 context.lineTo(side.length, 0);
11812 context.translate(side.length, 0);
11813 context.rotate(interiorAngle);
11814 }
11815 }
11816
11817}
11818;// CONCATENATED MODULE: ../../shapes/polygon/dist/esm/PolygonDrawer.js
11819
11820class PolygonDrawer extends PolygonDrawerBase {
11821 getSidesData(particle, radius) {
11822 var _a, _b;
11823
11824 const polygon = particle.shapeData;
11825 const sides = (_b = (_a = polygon === null || polygon === void 0 ? void 0 : polygon.sides) !== null && _a !== void 0 ? _a : polygon === null || polygon === void 0 ? void 0 : polygon.nb_sides) !== null && _b !== void 0 ? _b : 5;
11826 return {
11827 count: {
11828 denominator: 1,
11829 numerator: sides
11830 },
11831 length: radius * 2.66 / (sides / 3)
11832 };
11833 }
11834
11835 getCenter(particle, radius) {
11836 const sides = this.getSidesCount(particle);
11837 return {
11838 x: -radius / (sides / 3.5),
11839 y: -radius / (2.66 / 3.5)
11840 };
11841 }
11842
11843}
11844;// CONCATENATED MODULE: ../../shapes/polygon/dist/esm/TriangleDrawer.js
11845
11846class TriangleDrawer extends PolygonDrawerBase {
11847 getSidesCount() {
11848 return 3;
11849 }
11850
11851 getSidesData(particle, radius) {
11852 return {
11853 count: {
11854 denominator: 2,
11855 numerator: 3
11856 },
11857 length: radius * 2
11858 };
11859 }
11860
11861 getCenter(particle, radius) {
11862 return {
11863 x: -radius,
11864 y: radius / 1.66
11865 };
11866 }
11867
11868}
11869;// CONCATENATED MODULE: ../../shapes/polygon/dist/esm/index.js
11870
11871
11872async function loadGenericPolygonShape(engine) {
11873 await engine.addShape("polygon", new PolygonDrawer());
11874}
11875async function loadTriangleShape(engine) {
11876 await engine.addShape("triangle", new TriangleDrawer());
11877}
11878async function loadPolygonShape(engine) {
11879 await loadGenericPolygonShape(engine);
11880 await loadTriangleShape(engine);
11881}
11882;// CONCATENATED MODULE: ../../updaters/size/dist/esm/SizeUpdater.js
11883
11884
11885function SizeUpdater_checkDestroy(particle, value, minValue, maxValue) {
11886 switch (particle.options.size.animation.destroy) {
11887 case "max":
11888 if (value >= maxValue) {
11889 particle.destroy();
11890 }
11891
11892 break;
11893
11894 case "min":
11895 if (value <= minValue) {
11896 particle.destroy();
11897 }
11898
11899 break;
11900 }
11901}
11902
11903function updateSize(particle, delta) {
11904 var _a, _b, _c, _d;
11905
11906 const sizeVelocity = ((_a = particle.size.velocity) !== null && _a !== void 0 ? _a : 0) * delta.factor;
11907 const minValue = particle.size.min;
11908 const maxValue = particle.size.max;
11909
11910 if (particle.destroyed || !particle.size.enable || ((_b = particle.size.maxLoops) !== null && _b !== void 0 ? _b : 0) > 0 && ((_c = particle.size.loops) !== null && _c !== void 0 ? _c : 0) > ((_d = particle.size.maxLoops) !== null && _d !== void 0 ? _d : 0)) {
11911 return;
11912 }
11913
11914 switch (particle.size.status) {
11915 case 0:
11916 if (particle.size.value >= maxValue) {
11917 particle.size.status = 1;
11918
11919 if (!particle.size.loops) {
11920 particle.size.loops = 0;
11921 }
11922
11923 particle.size.loops++;
11924 } else {
11925 particle.size.value += sizeVelocity;
11926 }
11927
11928 break;
11929
11930 case 1:
11931 if (particle.size.value <= minValue) {
11932 particle.size.status = 0;
11933
11934 if (!particle.size.loops) {
11935 particle.size.loops = 0;
11936 }
11937
11938 particle.size.loops++;
11939 } else {
11940 particle.size.value -= sizeVelocity;
11941 }
11942
11943 }
11944
11945 SizeUpdater_checkDestroy(particle, particle.size.value, minValue, maxValue);
11946
11947 if (!particle.destroyed) {
11948 particle.size.value = clamp(particle.size.value, minValue, maxValue);
11949 }
11950}
11951
11952class SizeUpdater {
11953 init() {}
11954
11955 isEnabled(particle) {
11956 var _a, _b, _c, _d;
11957
11958 return !particle.destroyed && !particle.spawning && particle.size.enable && (((_a = particle.size.maxLoops) !== null && _a !== void 0 ? _a : 0) <= 0 || ((_b = particle.size.maxLoops) !== null && _b !== void 0 ? _b : 0) > 0 && ((_c = particle.size.loops) !== null && _c !== void 0 ? _c : 0) < ((_d = particle.size.maxLoops) !== null && _d !== void 0 ? _d : 0));
11959 }
11960
11961 update(particle, delta) {
11962 if (!this.isEnabled(particle)) {
11963 return;
11964 }
11965
11966 updateSize(particle, delta);
11967 }
11968
11969}
11970;// CONCATENATED MODULE: ../../updaters/size/dist/esm/index.js
11971
11972async function loadSizeUpdater(engine) {
11973 await engine.addParticleUpdater("size", () => new SizeUpdater());
11974}
11975;// CONCATENATED MODULE: ../../shapes/square/dist/esm/SquareDrawer.js
11976const fixFactor = Math.sqrt(2);
11977class SquareDrawer {
11978 getSidesCount() {
11979 return 4;
11980 }
11981
11982 draw(context, particle, radius) {
11983 context.rect(-radius / fixFactor, -radius / fixFactor, radius * 2 / fixFactor, radius * 2 / fixFactor);
11984 }
11985
11986}
11987;// CONCATENATED MODULE: ../../shapes/square/dist/esm/index.js
11988
11989async function loadSquareShape(engine) {
11990 const drawer = new SquareDrawer();
11991 await engine.addShape("edge", drawer);
11992 await engine.addShape("square", drawer);
11993}
11994;// CONCATENATED MODULE: ../../shapes/star/dist/esm/StarDrawer.js
11995class StarDrawer {
11996 getSidesCount(particle) {
11997 var _a, _b;
11998
11999 const star = particle.shapeData;
12000 return (_b = (_a = star === null || star === void 0 ? void 0 : star.sides) !== null && _a !== void 0 ? _a : star === null || star === void 0 ? void 0 : star.nb_sides) !== null && _b !== void 0 ? _b : 5;
12001 }
12002
12003 draw(context, particle, radius) {
12004 var _a;
12005
12006 const star = particle.shapeData;
12007 const sides = this.getSidesCount(particle);
12008 const inset = (_a = star === null || star === void 0 ? void 0 : star.inset) !== null && _a !== void 0 ? _a : 2;
12009 context.moveTo(0, 0 - radius);
12010
12011 for (let i = 0; i < sides; i++) {
12012 context.rotate(Math.PI / sides);
12013 context.lineTo(0, 0 - radius * inset);
12014 context.rotate(Math.PI / sides);
12015 context.lineTo(0, 0 - radius);
12016 }
12017 }
12018
12019}
12020;// CONCATENATED MODULE: ../../shapes/star/dist/esm/index.js
12021
12022async function loadStarShape(engine) {
12023 await engine.addShape("star", new StarDrawer());
12024}
12025;// CONCATENATED MODULE: ../../updaters/strokeColor/dist/esm/StrokeColorUpdater.js
12026
12027
12028function StrokeColorUpdater_updateColorValue(delta, value, valueAnimation, max, decrease) {
12029 var _a;
12030
12031 const colorValue = value;
12032
12033 if (!colorValue || !colorValue.enable) {
12034 return;
12035 }
12036
12037 const offset = randomInRange(valueAnimation.offset);
12038 const velocity = ((_a = value.velocity) !== null && _a !== void 0 ? _a : 0) * delta.factor + offset * 3.6;
12039
12040 if (!decrease || colorValue.status === 0) {
12041 colorValue.value += velocity;
12042
12043 if (decrease && colorValue.value > max) {
12044 colorValue.status = 1;
12045 colorValue.value -= colorValue.value % max;
12046 }
12047 } else {
12048 colorValue.value -= velocity;
12049
12050 if (colorValue.value < 0) {
12051 colorValue.status = 0;
12052 colorValue.value += colorValue.value;
12053 }
12054 }
12055
12056 if (colorValue.value > max) {
12057 colorValue.value %= max;
12058 }
12059}
12060
12061function updateStrokeColor(particle, delta) {
12062 var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
12063
12064 if (!((_a = particle.stroke) === null || _a === void 0 ? void 0 : _a.color)) {
12065 return;
12066 }
12067
12068 const animationOptions = particle.stroke.color.animation;
12069 const h = (_c = (_b = particle.strokeColor) === null || _b === void 0 ? void 0 : _b.h) !== null && _c !== void 0 ? _c : (_d = particle.color) === null || _d === void 0 ? void 0 : _d.h;
12070
12071 if (h) {
12072 StrokeColorUpdater_updateColorValue(delta, h, animationOptions.h, 360, false);
12073 }
12074
12075 const s = (_f = (_e = particle.strokeColor) === null || _e === void 0 ? void 0 : _e.s) !== null && _f !== void 0 ? _f : (_g = particle.color) === null || _g === void 0 ? void 0 : _g.s;
12076
12077 if (s) {
12078 StrokeColorUpdater_updateColorValue(delta, s, animationOptions.s, 100, true);
12079 }
12080
12081 const l = (_j = (_h = particle.strokeColor) === null || _h === void 0 ? void 0 : _h.l) !== null && _j !== void 0 ? _j : (_k = particle.color) === null || _k === void 0 ? void 0 : _k.l;
12082
12083 if (l) {
12084 StrokeColorUpdater_updateColorValue(delta, l, animationOptions.l, 100, true);
12085 }
12086}
12087
12088class StrokeColorUpdater {
12089 constructor(container) {
12090 this.container = container;
12091 }
12092
12093 init(particle) {
12094 var _a, _b;
12095
12096 const container = this.container;
12097 particle.stroke = particle.options.stroke instanceof Array ? itemFromArray(particle.options.stroke, particle.id, particle.options.reduceDuplicates) : particle.options.stroke;
12098 particle.strokeWidth = particle.stroke.width * container.retina.pixelRatio;
12099 const strokeHslColor = (_a = colorToHsl(particle.stroke.color)) !== null && _a !== void 0 ? _a : particle.getFillColor();
12100
12101 if (strokeHslColor) {
12102 particle.strokeColor = getHslAnimationFromHsl(strokeHslColor, (_b = particle.stroke.color) === null || _b === void 0 ? void 0 : _b.animation, container.retina.reduceFactor);
12103 }
12104 }
12105
12106 isEnabled(particle) {
12107 var _a, _b, _c, _d;
12108
12109 const color = (_a = particle.stroke) === null || _a === void 0 ? void 0 : _a.color;
12110 return !particle.destroyed && !particle.spawning && !!color && (((_b = particle.strokeColor) === null || _b === void 0 ? void 0 : _b.h.value) !== undefined && color.animation.h.enable || ((_c = particle.strokeColor) === null || _c === void 0 ? void 0 : _c.s.value) !== undefined && color.animation.s.enable || ((_d = particle.strokeColor) === null || _d === void 0 ? void 0 : _d.l.value) !== undefined && color.animation.l.enable);
12111 }
12112
12113 update(particle, delta) {
12114 if (!this.isEnabled(particle)) {
12115 return;
12116 }
12117
12118 updateStrokeColor(particle, delta);
12119 }
12120
12121}
12122;// CONCATENATED MODULE: ../../updaters/strokeColor/dist/esm/index.js
12123
12124async function loadStrokeColorUpdater(engine) {
12125 await engine.addParticleUpdater("strokeColor", container => new StrokeColorUpdater(container));
12126}
12127;// CONCATENATED MODULE: ../../shapes/text/dist/esm/TextDrawer.js
12128
12129const validTypes = ["text", "character", "char"];
12130class TextDrawer {
12131 getSidesCount() {
12132 return 12;
12133 }
12134
12135 async init(container) {
12136 const options = container.actualOptions;
12137
12138 if (validTypes.find(t => isInArray(t, options.particles.shape.type))) {
12139 const shapeOptions = validTypes.map(t => options.particles.shape.options[t]).find(t => !!t);
12140
12141 if (shapeOptions instanceof Array) {
12142 const promises = [];
12143
12144 for (const character of shapeOptions) {
12145 const charShape = character;
12146 promises.push(loadFont(charShape.font, charShape.weight));
12147 }
12148
12149 await Promise.allSettled(promises);
12150 } else {
12151 if (shapeOptions !== undefined) {
12152 const charShape = shapeOptions;
12153 await loadFont(charShape.font, charShape.weight);
12154 }
12155 }
12156 }
12157 }
12158
12159 draw(context, particle, radius, opacity) {
12160 var _a, _b, _c;
12161
12162 const character = particle.shapeData;
12163
12164 if (character === undefined) {
12165 return;
12166 }
12167
12168 const textData = character.value;
12169
12170 if (textData === undefined) {
12171 return;
12172 }
12173
12174 const textParticle = particle;
12175
12176 if (textParticle.text === undefined) {
12177 textParticle.text = textData instanceof Array ? itemFromArray(textData, particle.randomIndexData) : textData;
12178 }
12179
12180 const text = textParticle.text;
12181 const style = (_a = character.style) !== null && _a !== void 0 ? _a : "";
12182 const weight = (_b = character.weight) !== null && _b !== void 0 ? _b : "400";
12183 const size = Math.round(radius) * 2;
12184 const font = (_c = character.font) !== null && _c !== void 0 ? _c : "Verdana";
12185 const fill = particle.fill;
12186 const offsetX = text.length * radius / 2;
12187 context.font = `${style} ${weight} ${size}px "${font}"`;
12188 const pos = {
12189 x: -offsetX,
12190 y: radius / 2
12191 };
12192 context.globalAlpha = opacity;
12193
12194 if (fill) {
12195 context.fillText(text, pos.x, pos.y);
12196 } else {
12197 context.strokeText(text, pos.x, pos.y);
12198 }
12199
12200 context.globalAlpha = 1;
12201 }
12202
12203}
12204;// CONCATENATED MODULE: ../../shapes/text/dist/esm/index.js
12205
12206async function loadTextShape(engine) {
12207 const drawer = new TextDrawer();
12208
12209 for (const type of validTypes) {
12210 await engine.addShape(type, drawer);
12211 }
12212}
12213;// CONCATENATED MODULE: ./dist/browser/index.js
12214
12215
12216
12217
12218
12219
12220
12221
12222
12223
12224
12225
12226
12227
12228
12229
12230
12231
12232
12233
12234
12235
12236
12237
12238
12239
12240
12241
12242
12243async function loadSlim(engine) {
12244 await loadBaseMover(engine);
12245 await loadParallaxMover(engine);
12246 await loadExternalAttractInteraction(engine);
12247 await loadExternalBounceInteraction(engine);
12248 await loadExternalBubbleInteraction(engine);
12249 await loadExternalConnectInteraction(engine);
12250 await loadExternalGrabInteraction(engine);
12251 await loadExternalPauseInteraction(engine);
12252 await loadExternalPushInteraction(engine);
12253 await loadExternalRemoveInteraction(engine);
12254 await loadExternalRepulseInteraction(engine);
12255 await loadParticlesAttractInteraction(engine);
12256 await loadParticlesCollisionsInteraction(engine);
12257 await loadParticlesLinksInteraction(engine);
12258 await loadCircleShape(engine);
12259 await loadImageShape(engine);
12260 await loadLineShape(engine);
12261 await loadPolygonShape(engine);
12262 await loadSquareShape(engine);
12263 await loadStarShape(engine);
12264 await loadTextShape(engine);
12265 await loadLifeUpdater(engine);
12266 await loadOpacityUpdater(engine);
12267 await loadSizeUpdater(engine);
12268 await loadAngleUpdater(engine);
12269 await loadColorUpdater(engine);
12270 await loadStrokeColorUpdater(engine);
12271 await loadOutModesUpdater(engine);
12272 await initPjs(engine);
12273}
12274;// CONCATENATED MODULE: ./dist/browser/bundle.js
12275
12276
12277loadSlim(tsParticles);
12278
12279
12280/******/ return __webpack_exports__;
12281/******/ })()
12282;
12283});
\No newline at end of file