@courtneyring/components-library 1.0.14 → 1.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Particles-O0-WQKRj.js +2786 -0
- package/dist/animations/FadeInMotion.js +25 -6
- package/dist/assets/Banner.css +1 -1
- package/dist/assets/Button.css +1 -1
- package/dist/assets/Container.css +1 -1
- package/dist/assets/Fifty.css +1 -1
- package/dist/assets/HorizontalScrollImages.css +1 -0
- package/dist/assets/IconDetail.css +1 -1
- package/dist/assets/ImageTextBlock.css +1 -1
- package/dist/assets/MenuButton.css +1 -1
- package/dist/assets/Navbar.css +1 -1
- package/dist/assets/Overlay.css +1 -1
- package/dist/assets/OverlayHero.css +1 -1
- package/dist/assets/ParallaxImageGrid.css +1 -1
- package/dist/assets/PromoGroup.css +1 -1
- package/dist/assets/index.css +1 -0
- package/dist/components/Banner/Banner.js +18 -13
- package/dist/components/Button/Button.js +21 -20
- package/dist/components/Container/Container.js +4 -3
- package/dist/components/Fifty/Fifty.js +26 -24
- package/dist/components/GenericOverlay/GenericOverlay.js +15 -16
- package/dist/components/HorizontalScrollImages/HorizontalScrollImages.js +47 -0
- package/dist/components/IconDetail/IconDetail.js +10 -10
- package/dist/components/ImageTextBlock/ImageTextBlock.js +32 -32
- package/dist/components/MenuButton/MenuButton.js +7 -7
- package/dist/components/Navbar/Navbar.js +33 -33
- package/dist/components/Overlay/Overlay.js +24 -23
- package/dist/components/OverlayHero/OverlayHero.js +12 -11
- package/dist/components/ParallaxImageGrid/ParallaxImageGrid.js +85 -27
- package/dist/components/PromoGroup/PromoGroup.js +28 -27
- package/dist/hooks/useFadeIn.js +43 -19
- package/dist/index.js +65 -42
- package/package.json +4 -2
|
@@ -0,0 +1,2786 @@
|
|
|
1
|
+
import ge, { Component as Ne } from "react";
|
|
2
|
+
const B = "generated", qe = "pointerdown", Xe = "pointerup", ye = "pointerleave", Ye = "pointerout", ve = "pointermove", Ze = "touchstart", _e = "touchend", Qe = "touchmove", Je = "touchcancel", je = "resize", Ke = "visibilitychange", I = "tsParticles - Error";
|
|
3
|
+
class M {
|
|
4
|
+
constructor(e, t, i) {
|
|
5
|
+
if (this._updateFromAngle = (s, r) => {
|
|
6
|
+
this.x = Math.cos(s) * r, this.y = Math.sin(s) * r;
|
|
7
|
+
}, !k(e) && e) {
|
|
8
|
+
this.x = e.x, this.y = e.y;
|
|
9
|
+
const s = e;
|
|
10
|
+
this.z = s.z ? s.z : 0;
|
|
11
|
+
} else if (e !== void 0 && t !== void 0)
|
|
12
|
+
this.x = e, this.y = t, this.z = i ?? 0;
|
|
13
|
+
else
|
|
14
|
+
throw new Error(`${I} Vector3d not initialized correctly`);
|
|
15
|
+
}
|
|
16
|
+
static get origin() {
|
|
17
|
+
return M.create(0, 0, 0);
|
|
18
|
+
}
|
|
19
|
+
get angle() {
|
|
20
|
+
return Math.atan2(this.y, this.x);
|
|
21
|
+
}
|
|
22
|
+
set angle(e) {
|
|
23
|
+
this._updateFromAngle(e, this.length);
|
|
24
|
+
}
|
|
25
|
+
get length() {
|
|
26
|
+
return Math.sqrt(this.getLengthSq());
|
|
27
|
+
}
|
|
28
|
+
set length(e) {
|
|
29
|
+
this._updateFromAngle(this.angle, e);
|
|
30
|
+
}
|
|
31
|
+
static clone(e) {
|
|
32
|
+
return M.create(e.x, e.y, e.z);
|
|
33
|
+
}
|
|
34
|
+
static create(e, t, i) {
|
|
35
|
+
return new M(e, t, i);
|
|
36
|
+
}
|
|
37
|
+
add(e) {
|
|
38
|
+
return M.create(this.x + e.x, this.y + e.y, this.z + e.z);
|
|
39
|
+
}
|
|
40
|
+
addTo(e) {
|
|
41
|
+
this.x += e.x, this.y += e.y, this.z += e.z;
|
|
42
|
+
}
|
|
43
|
+
copy() {
|
|
44
|
+
return M.clone(this);
|
|
45
|
+
}
|
|
46
|
+
distanceTo(e) {
|
|
47
|
+
return this.sub(e).length;
|
|
48
|
+
}
|
|
49
|
+
distanceToSq(e) {
|
|
50
|
+
return this.sub(e).getLengthSq();
|
|
51
|
+
}
|
|
52
|
+
div(e) {
|
|
53
|
+
return M.create(this.x / e, this.y / e, this.z / e);
|
|
54
|
+
}
|
|
55
|
+
divTo(e) {
|
|
56
|
+
this.x /= e, this.y /= e, this.z /= e;
|
|
57
|
+
}
|
|
58
|
+
getLengthSq() {
|
|
59
|
+
return this.x ** 2 + this.y ** 2;
|
|
60
|
+
}
|
|
61
|
+
mult(e) {
|
|
62
|
+
return M.create(this.x * e, this.y * e, this.z * e);
|
|
63
|
+
}
|
|
64
|
+
multTo(e) {
|
|
65
|
+
this.x *= e, this.y *= e, this.z *= e;
|
|
66
|
+
}
|
|
67
|
+
normalize() {
|
|
68
|
+
const e = this.length;
|
|
69
|
+
e != 0 && this.multTo(1 / e);
|
|
70
|
+
}
|
|
71
|
+
rotate(e) {
|
|
72
|
+
return M.create(this.x * Math.cos(e) - this.y * Math.sin(e), this.x * Math.sin(e) + this.y * Math.cos(e), 0);
|
|
73
|
+
}
|
|
74
|
+
setTo(e) {
|
|
75
|
+
this.x = e.x, this.y = e.y;
|
|
76
|
+
const t = e;
|
|
77
|
+
this.z = t.z ? t.z : 0;
|
|
78
|
+
}
|
|
79
|
+
sub(e) {
|
|
80
|
+
return M.create(this.x - e.x, this.y - e.y, this.z - e.z);
|
|
81
|
+
}
|
|
82
|
+
subFrom(e) {
|
|
83
|
+
this.x -= e.x, this.y -= e.y, this.z -= e.z;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
class L extends M {
|
|
87
|
+
constructor(e, t) {
|
|
88
|
+
super(e, t, 0);
|
|
89
|
+
}
|
|
90
|
+
static get origin() {
|
|
91
|
+
return L.create(0, 0);
|
|
92
|
+
}
|
|
93
|
+
static clone(e) {
|
|
94
|
+
return L.create(e.x, e.y);
|
|
95
|
+
}
|
|
96
|
+
static create(e, t) {
|
|
97
|
+
return new L(e, t);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
let et = Math.random;
|
|
101
|
+
function T() {
|
|
102
|
+
return Re(et(), 0, 1 - 1e-16);
|
|
103
|
+
}
|
|
104
|
+
function Re(n, e, t) {
|
|
105
|
+
return Math.min(Math.max(n, e), t);
|
|
106
|
+
}
|
|
107
|
+
function F(n) {
|
|
108
|
+
const e = ue(n);
|
|
109
|
+
let t = ce(n);
|
|
110
|
+
return e === t && (t = 0), T() * (e - t) + t;
|
|
111
|
+
}
|
|
112
|
+
function g(n) {
|
|
113
|
+
return k(n) ? n : F(n);
|
|
114
|
+
}
|
|
115
|
+
function ce(n) {
|
|
116
|
+
return k(n) ? n : n.min;
|
|
117
|
+
}
|
|
118
|
+
function ue(n) {
|
|
119
|
+
return k(n) ? n : n.max;
|
|
120
|
+
}
|
|
121
|
+
function p(n, e) {
|
|
122
|
+
if (n === e || e === void 0 && k(n))
|
|
123
|
+
return n;
|
|
124
|
+
const t = ce(n), i = ue(n);
|
|
125
|
+
return e !== void 0 ? {
|
|
126
|
+
min: Math.min(t, e),
|
|
127
|
+
max: Math.max(i, e)
|
|
128
|
+
} : p(t, i);
|
|
129
|
+
}
|
|
130
|
+
function tt(n) {
|
|
131
|
+
const e = n.random, { enable: t, minimumValue: i } = R(e) ? {
|
|
132
|
+
enable: e,
|
|
133
|
+
minimumValue: 0
|
|
134
|
+
} : e;
|
|
135
|
+
return g(t ? p(n.value, i) : n.value);
|
|
136
|
+
}
|
|
137
|
+
function it(n, e) {
|
|
138
|
+
const t = n.x - e.x, i = n.y - e.y;
|
|
139
|
+
return { dx: t, dy: i, distance: Math.sqrt(t ** 2 + i ** 2) };
|
|
140
|
+
}
|
|
141
|
+
function fe(n, e) {
|
|
142
|
+
return it(n, e).distance;
|
|
143
|
+
}
|
|
144
|
+
function st(n, e, t) {
|
|
145
|
+
if (k(n))
|
|
146
|
+
return n * Math.PI / 180;
|
|
147
|
+
switch (n) {
|
|
148
|
+
case "top":
|
|
149
|
+
return -Math.PI / 2;
|
|
150
|
+
case "top-right":
|
|
151
|
+
return -Math.PI / 4;
|
|
152
|
+
case "right":
|
|
153
|
+
return 0;
|
|
154
|
+
case "bottom-right":
|
|
155
|
+
return Math.PI / 4;
|
|
156
|
+
case "bottom":
|
|
157
|
+
return Math.PI / 2;
|
|
158
|
+
case "bottom-left":
|
|
159
|
+
return 3 * Math.PI / 4;
|
|
160
|
+
case "left":
|
|
161
|
+
return Math.PI;
|
|
162
|
+
case "top-left":
|
|
163
|
+
return -3 * Math.PI / 4;
|
|
164
|
+
case "inside":
|
|
165
|
+
return Math.atan2(t.y - e.y, t.x - e.x);
|
|
166
|
+
case "outside":
|
|
167
|
+
return Math.atan2(e.y - t.y, e.x - t.x);
|
|
168
|
+
default:
|
|
169
|
+
return T() * Math.PI * 2;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
function nt(n) {
|
|
173
|
+
const e = L.origin;
|
|
174
|
+
return e.length = 1, e.angle = n, e;
|
|
175
|
+
}
|
|
176
|
+
function rt(n) {
|
|
177
|
+
return {
|
|
178
|
+
x: n.position?.x ?? T() * n.size.width,
|
|
179
|
+
y: n.position?.y ?? T() * n.size.height
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
function Ie(n) {
|
|
183
|
+
return n ? n.endsWith("%") ? parseFloat(n) / 100 : parseFloat(n) : 1;
|
|
184
|
+
}
|
|
185
|
+
const ot = {
|
|
186
|
+
debug: console.debug,
|
|
187
|
+
error: console.error,
|
|
188
|
+
info: console.info,
|
|
189
|
+
log: console.log,
|
|
190
|
+
verbose: console.log,
|
|
191
|
+
warning: console.warn
|
|
192
|
+
};
|
|
193
|
+
function $() {
|
|
194
|
+
return ot;
|
|
195
|
+
}
|
|
196
|
+
function Z() {
|
|
197
|
+
return typeof window > "u" || !window || typeof window.document > "u" || !window.document;
|
|
198
|
+
}
|
|
199
|
+
function at() {
|
|
200
|
+
return !Z() && typeof matchMedia < "u";
|
|
201
|
+
}
|
|
202
|
+
function Ee(n) {
|
|
203
|
+
if (at())
|
|
204
|
+
return matchMedia(n);
|
|
205
|
+
}
|
|
206
|
+
function ht(n) {
|
|
207
|
+
if (!(Z() || typeof MutationObserver > "u"))
|
|
208
|
+
return new MutationObserver(n);
|
|
209
|
+
}
|
|
210
|
+
function lt(n, e) {
|
|
211
|
+
return n === e || S(e) && e.indexOf(n) > -1;
|
|
212
|
+
}
|
|
213
|
+
function ct(n) {
|
|
214
|
+
return Math.floor(T() * n.length);
|
|
215
|
+
}
|
|
216
|
+
function de(n, e, t = !0) {
|
|
217
|
+
return n[e !== void 0 && t ? e % n.length : ct(n)];
|
|
218
|
+
}
|
|
219
|
+
function x(n, ...e) {
|
|
220
|
+
for (const t of e) {
|
|
221
|
+
if (t == null)
|
|
222
|
+
continue;
|
|
223
|
+
if (!U(t)) {
|
|
224
|
+
n = t;
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
const i = Array.isArray(t);
|
|
228
|
+
i && (U(n) || !n || !Array.isArray(n)) ? n = [] : !i && (U(n) || !n || Array.isArray(n)) && (n = {});
|
|
229
|
+
for (const s in t) {
|
|
230
|
+
if (s === "__proto__")
|
|
231
|
+
continue;
|
|
232
|
+
const r = t, o = r[s], a = n;
|
|
233
|
+
a[s] = U(o) && Array.isArray(o) ? o.map((h) => x(a[s], h)) : x(a[s], o);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return n;
|
|
237
|
+
}
|
|
238
|
+
function E(n, e) {
|
|
239
|
+
return S(n) ? n.map((t, i) => e(t, i)) : e(n, 0);
|
|
240
|
+
}
|
|
241
|
+
function W(n, e, t) {
|
|
242
|
+
return S(n) ? de(n, e, t) : n;
|
|
243
|
+
}
|
|
244
|
+
function ut(n, e) {
|
|
245
|
+
const t = n.value, i = n.animation, s = {
|
|
246
|
+
delayTime: g(i.delay) * 1e3,
|
|
247
|
+
enable: i.enable,
|
|
248
|
+
value: g(n.value) * e,
|
|
249
|
+
max: ue(t) * e,
|
|
250
|
+
min: ce(t) * e,
|
|
251
|
+
loops: 0,
|
|
252
|
+
maxLoops: g(i.count),
|
|
253
|
+
time: 0
|
|
254
|
+
};
|
|
255
|
+
if (i.enable) {
|
|
256
|
+
switch (s.decay = 1 - g(i.decay), i.mode) {
|
|
257
|
+
case "increase":
|
|
258
|
+
s.status = "increasing";
|
|
259
|
+
break;
|
|
260
|
+
case "decrease":
|
|
261
|
+
s.status = "decreasing";
|
|
262
|
+
break;
|
|
263
|
+
case "random":
|
|
264
|
+
s.status = T() >= 0.5 ? "increasing" : "decreasing";
|
|
265
|
+
break;
|
|
266
|
+
}
|
|
267
|
+
const r = i.mode === "auto";
|
|
268
|
+
switch (i.startValue) {
|
|
269
|
+
case "min":
|
|
270
|
+
s.value = s.min, r && (s.status = "increasing");
|
|
271
|
+
break;
|
|
272
|
+
case "max":
|
|
273
|
+
s.value = s.max, r && (s.status = "decreasing");
|
|
274
|
+
break;
|
|
275
|
+
case "random":
|
|
276
|
+
default:
|
|
277
|
+
s.value = F(s), r && (s.status = T() >= 0.5 ? "increasing" : "decreasing");
|
|
278
|
+
break;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
return s.initialValue = s.value, s;
|
|
282
|
+
}
|
|
283
|
+
function ft(n, e) {
|
|
284
|
+
if (!(n.mode === "percent")) {
|
|
285
|
+
const { mode: s, ...r } = n;
|
|
286
|
+
return r;
|
|
287
|
+
}
|
|
288
|
+
return "x" in n ? {
|
|
289
|
+
x: n.x / 100 * e.width,
|
|
290
|
+
y: n.y / 100 * e.height
|
|
291
|
+
} : {
|
|
292
|
+
width: n.width / 100 * e.width,
|
|
293
|
+
height: n.height / 100 * e.height
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
function De(n, e) {
|
|
297
|
+
return ft(n, e);
|
|
298
|
+
}
|
|
299
|
+
function R(n) {
|
|
300
|
+
return typeof n == "boolean";
|
|
301
|
+
}
|
|
302
|
+
function C(n) {
|
|
303
|
+
return typeof n == "string";
|
|
304
|
+
}
|
|
305
|
+
function k(n) {
|
|
306
|
+
return typeof n == "number";
|
|
307
|
+
}
|
|
308
|
+
function Ae(n) {
|
|
309
|
+
return typeof n == "function";
|
|
310
|
+
}
|
|
311
|
+
function U(n) {
|
|
312
|
+
return typeof n == "object" && n !== null;
|
|
313
|
+
}
|
|
314
|
+
function S(n) {
|
|
315
|
+
return Array.isArray(n);
|
|
316
|
+
}
|
|
317
|
+
const dt = "random", Q = /* @__PURE__ */ new Map();
|
|
318
|
+
function we(n) {
|
|
319
|
+
Q.set(n.key, n);
|
|
320
|
+
}
|
|
321
|
+
function j(n, e, t) {
|
|
322
|
+
return t < 0 && (t += 1), t > 1 && (t -= 1), t < 1 / 6 ? n + (e - n) * 6 * t : t < 1 / 2 ? e : t < 2 / 3 ? n + (e - n) * (2 / 3 - t) * 6 : n;
|
|
323
|
+
}
|
|
324
|
+
function pt(n) {
|
|
325
|
+
for (const [, r] of Q)
|
|
326
|
+
if (n.startsWith(r.stringPrefix))
|
|
327
|
+
return r.parseString(n);
|
|
328
|
+
const e = /^#?([a-f\d])([a-f\d])([a-f\d])([a-f\d])?$/i, t = n.replace(e, (r, o, a, h, l) => o + o + a + a + h + h + (l !== void 0 ? l + l : "")), i = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i, s = i.exec(t);
|
|
329
|
+
return s ? {
|
|
330
|
+
a: s[4] !== void 0 ? parseInt(s[4], 16) / 255 : 1,
|
|
331
|
+
b: parseInt(s[3], 16),
|
|
332
|
+
g: parseInt(s[2], 16),
|
|
333
|
+
r: parseInt(s[1], 16)
|
|
334
|
+
} : void 0;
|
|
335
|
+
}
|
|
336
|
+
function V(n, e, t = !0) {
|
|
337
|
+
if (!n)
|
|
338
|
+
return;
|
|
339
|
+
const i = C(n) ? { value: n } : n;
|
|
340
|
+
if (C(i.value))
|
|
341
|
+
return Le(i.value, e, t);
|
|
342
|
+
if (S(i.value))
|
|
343
|
+
return V({
|
|
344
|
+
value: de(i.value, e, t)
|
|
345
|
+
});
|
|
346
|
+
for (const [, s] of Q) {
|
|
347
|
+
const r = s.handleRangeColor(i);
|
|
348
|
+
if (r)
|
|
349
|
+
return r;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
function Le(n, e, t = !0) {
|
|
353
|
+
if (!n)
|
|
354
|
+
return;
|
|
355
|
+
const i = C(n) ? { value: n } : n;
|
|
356
|
+
if (C(i.value))
|
|
357
|
+
return i.value === dt ? vt() : gt(i.value);
|
|
358
|
+
if (S(i.value))
|
|
359
|
+
return Le({
|
|
360
|
+
value: de(i.value, e, t)
|
|
361
|
+
});
|
|
362
|
+
for (const [, s] of Q) {
|
|
363
|
+
const r = s.handleColor(i);
|
|
364
|
+
if (r)
|
|
365
|
+
return r;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
function be(n, e, t = !0) {
|
|
369
|
+
const i = V(n, e, t);
|
|
370
|
+
return i ? mt(i) : void 0;
|
|
371
|
+
}
|
|
372
|
+
function mt(n) {
|
|
373
|
+
const e = n.r / 255, t = n.g / 255, i = n.b / 255, s = Math.max(e, t, i), r = Math.min(e, t, i), o = {
|
|
374
|
+
h: 0,
|
|
375
|
+
l: (s + r) / 2,
|
|
376
|
+
s: 0
|
|
377
|
+
};
|
|
378
|
+
return s !== r && (o.s = o.l < 0.5 ? (s - r) / (s + r) : (s - r) / (2 - s - r), o.h = e === s ? (t - i) / (s - r) : o.h = t === s ? 2 + (i - e) / (s - r) : 4 + (e - t) / (s - r)), o.l *= 100, o.s *= 100, o.h *= 60, o.h < 0 && (o.h += 360), o.h >= 360 && (o.h -= 360), o;
|
|
379
|
+
}
|
|
380
|
+
function gt(n) {
|
|
381
|
+
return pt(n);
|
|
382
|
+
}
|
|
383
|
+
function he(n) {
|
|
384
|
+
const e = { b: 0, g: 0, r: 0 }, t = {
|
|
385
|
+
h: n.h / 360,
|
|
386
|
+
l: n.l / 100,
|
|
387
|
+
s: n.s / 100
|
|
388
|
+
};
|
|
389
|
+
if (!t.s)
|
|
390
|
+
e.r = e.g = e.b = t.l;
|
|
391
|
+
else {
|
|
392
|
+
const i = t.l < 0.5 ? t.l * (1 + t.s) : t.l + t.s - t.l * t.s, s = 2 * t.l - i;
|
|
393
|
+
e.r = j(s, i, t.h + 1 / 3), e.g = j(s, i, t.h), e.b = j(s, i, t.h - 1 / 3);
|
|
394
|
+
}
|
|
395
|
+
return e.r = Math.floor(e.r * 255), e.g = Math.floor(e.g * 255), e.b = Math.floor(e.b * 255), e;
|
|
396
|
+
}
|
|
397
|
+
function yt(n) {
|
|
398
|
+
const e = he(n);
|
|
399
|
+
return {
|
|
400
|
+
a: n.a,
|
|
401
|
+
b: e.b,
|
|
402
|
+
g: e.g,
|
|
403
|
+
r: e.r
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
function vt(n) {
|
|
407
|
+
return {
|
|
408
|
+
b: Math.floor(F(p(0, 256))),
|
|
409
|
+
g: Math.floor(F(p(0, 256))),
|
|
410
|
+
r: Math.floor(F(p(0, 256)))
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
function q(n, e) {
|
|
414
|
+
return `rgba(${n.r}, ${n.g}, ${n.b}, ${e ?? 1})`;
|
|
415
|
+
}
|
|
416
|
+
function xe(n, e) {
|
|
417
|
+
return `hsla(${n.h}, ${n.s}%, ${n.l}%, ${e ?? 1})`;
|
|
418
|
+
}
|
|
419
|
+
function ze(n) {
|
|
420
|
+
return n !== void 0 ? {
|
|
421
|
+
h: n.h.value,
|
|
422
|
+
s: n.s.value,
|
|
423
|
+
l: n.l.value
|
|
424
|
+
} : void 0;
|
|
425
|
+
}
|
|
426
|
+
function _t(n, e, t) {
|
|
427
|
+
n.fillStyle = t ?? "rgba(0,0,0,0)", n.fillRect(0, 0, e.width, e.height);
|
|
428
|
+
}
|
|
429
|
+
function wt(n, e, t, i) {
|
|
430
|
+
t && (n.globalAlpha = i, n.drawImage(t, 0, 0, e.width, e.height), n.globalAlpha = 1);
|
|
431
|
+
}
|
|
432
|
+
function K(n, e) {
|
|
433
|
+
n.clearRect(0, 0, e.width, e.height);
|
|
434
|
+
}
|
|
435
|
+
function bt(n) {
|
|
436
|
+
const { container: e, context: t, particle: i, delta: s, colorStyles: r, backgroundMask: o, composite: a, radius: h, opacity: l, shadow: c, transform: u } = n, f = i.getPosition(), d = i.rotation + (i.pathRotation ? i.velocity.angle : 0), y = {
|
|
437
|
+
sin: Math.sin(d),
|
|
438
|
+
cos: Math.cos(d)
|
|
439
|
+
}, m = {
|
|
440
|
+
a: y.cos * (u.a ?? 1),
|
|
441
|
+
b: y.sin * (u.b ?? 1),
|
|
442
|
+
c: -y.sin * (u.c ?? 1),
|
|
443
|
+
d: y.cos * (u.d ?? 1)
|
|
444
|
+
};
|
|
445
|
+
t.setTransform(m.a, m.b, m.c, m.d, f.x, f.y), t.beginPath(), o && (t.globalCompositeOperation = a);
|
|
446
|
+
const b = i.shadowColor;
|
|
447
|
+
c.enable && b && (t.shadowBlur = c.blur, t.shadowColor = q(b), t.shadowOffsetX = c.offset.x, t.shadowOffsetY = c.offset.y), r.fill && (t.fillStyle = r.fill);
|
|
448
|
+
const _ = i.strokeWidth ?? 0;
|
|
449
|
+
t.lineWidth = _, r.stroke && (t.strokeStyle = r.stroke), xt(e, t, i, h, l, s), _ > 0 && t.stroke(), i.close && t.closePath(), i.fill && t.fill(), zt(e, t, i, h, l, s), t.globalCompositeOperation = "source-over", t.setTransform(1, 0, 0, 1, 0, 0);
|
|
450
|
+
}
|
|
451
|
+
function xt(n, e, t, i, s, r) {
|
|
452
|
+
if (!t.shape)
|
|
453
|
+
return;
|
|
454
|
+
const o = n.drawers.get(t.shape);
|
|
455
|
+
o && o.draw(e, t, i, s, r, n.retina.pixelRatio);
|
|
456
|
+
}
|
|
457
|
+
function zt(n, e, t, i, s, r) {
|
|
458
|
+
if (!t.shape)
|
|
459
|
+
return;
|
|
460
|
+
const o = n.drawers.get(t.shape);
|
|
461
|
+
!o || !o.afterEffect || o.afterEffect(e, t, i, s, r, n.retina.pixelRatio);
|
|
462
|
+
}
|
|
463
|
+
function Mt(n, e, t) {
|
|
464
|
+
e.draw && e.draw(n, t);
|
|
465
|
+
}
|
|
466
|
+
function Pt(n, e, t, i) {
|
|
467
|
+
e.drawParticle && e.drawParticle(n, t, i);
|
|
468
|
+
}
|
|
469
|
+
function kt(n, e, t) {
|
|
470
|
+
return {
|
|
471
|
+
h: n.h,
|
|
472
|
+
s: n.s,
|
|
473
|
+
l: n.l + (e === "darken" ? -1 : 1) * t
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
function Ct(n, e, t) {
|
|
477
|
+
const i = e[t];
|
|
478
|
+
i !== void 0 && (n[t] = (n[t] ?? 1) * i);
|
|
479
|
+
}
|
|
480
|
+
class St {
|
|
481
|
+
constructor(e) {
|
|
482
|
+
this.container = e, this._applyPostDrawUpdaters = (t) => {
|
|
483
|
+
for (const i of this._postDrawUpdaters)
|
|
484
|
+
i.afterDraw && i.afterDraw(t);
|
|
485
|
+
}, this._applyPreDrawUpdaters = (t, i, s, r, o, a) => {
|
|
486
|
+
for (const h of this._preDrawUpdaters) {
|
|
487
|
+
if (h.getColorStyles) {
|
|
488
|
+
const { fill: l, stroke: c } = h.getColorStyles(i, t, s, r);
|
|
489
|
+
l && (o.fill = l), c && (o.stroke = c);
|
|
490
|
+
}
|
|
491
|
+
if (h.getTransformValues) {
|
|
492
|
+
const l = h.getTransformValues(i);
|
|
493
|
+
for (const c in l)
|
|
494
|
+
Ct(a, l, c);
|
|
495
|
+
}
|
|
496
|
+
h.beforeDraw && h.beforeDraw(i);
|
|
497
|
+
}
|
|
498
|
+
}, this._applyResizePlugins = () => {
|
|
499
|
+
for (const t of this._resizePlugins)
|
|
500
|
+
t.resize && t.resize();
|
|
501
|
+
}, this._getPluginParticleColors = (t) => {
|
|
502
|
+
let i, s;
|
|
503
|
+
for (const r of this._colorPlugins)
|
|
504
|
+
if (!i && r.particleFillColor && (i = be(r.particleFillColor(t))), !s && r.particleStrokeColor && (s = be(r.particleStrokeColor(t))), i && s)
|
|
505
|
+
break;
|
|
506
|
+
return [i, s];
|
|
507
|
+
}, this._initCover = () => {
|
|
508
|
+
const t = this.container.actualOptions, i = t.backgroundMask.cover, s = i.color, r = V(s);
|
|
509
|
+
if (r) {
|
|
510
|
+
const o = {
|
|
511
|
+
...r,
|
|
512
|
+
a: i.opacity
|
|
513
|
+
};
|
|
514
|
+
this._coverColorStyle = q(o, o.a);
|
|
515
|
+
}
|
|
516
|
+
}, this._initStyle = () => {
|
|
517
|
+
const t = this.element, i = this.container.actualOptions;
|
|
518
|
+
if (t) {
|
|
519
|
+
this._fullScreen ? (this._originalStyle = x({}, t.style), this._setFullScreenStyle()) : this._resetOriginalStyle();
|
|
520
|
+
for (const s in i.style) {
|
|
521
|
+
if (!s || !i.style)
|
|
522
|
+
continue;
|
|
523
|
+
const r = i.style[s];
|
|
524
|
+
r && t.style.setProperty(s, r, "important");
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
}, this._initTrail = async () => {
|
|
528
|
+
const t = this.container.actualOptions, i = t.particles.move.trail, s = i.fill;
|
|
529
|
+
if (i.enable)
|
|
530
|
+
if (s.color) {
|
|
531
|
+
const r = V(s.color);
|
|
532
|
+
if (!r)
|
|
533
|
+
return;
|
|
534
|
+
const o = t.particles.move.trail;
|
|
535
|
+
this._trailFill = {
|
|
536
|
+
color: {
|
|
537
|
+
...r
|
|
538
|
+
},
|
|
539
|
+
opacity: 1 / o.length
|
|
540
|
+
};
|
|
541
|
+
} else
|
|
542
|
+
await new Promise((r, o) => {
|
|
543
|
+
if (!s.image)
|
|
544
|
+
return;
|
|
545
|
+
const a = document.createElement("img");
|
|
546
|
+
a.addEventListener("load", () => {
|
|
547
|
+
this._trailFill = {
|
|
548
|
+
image: a,
|
|
549
|
+
opacity: 1 / i.length
|
|
550
|
+
}, r();
|
|
551
|
+
}), a.addEventListener("error", (h) => {
|
|
552
|
+
o(h.error);
|
|
553
|
+
}), a.src = s.image;
|
|
554
|
+
});
|
|
555
|
+
}, this._paintBase = (t) => {
|
|
556
|
+
this.draw((i) => _t(i, this.size, t));
|
|
557
|
+
}, this._paintImage = (t, i) => {
|
|
558
|
+
this.draw((s) => wt(s, this.size, t, i));
|
|
559
|
+
}, this._repairStyle = () => {
|
|
560
|
+
const t = this.element;
|
|
561
|
+
t && (this._safeMutationObserver((i) => i.disconnect()), this._initStyle(), this.initBackground(), this._safeMutationObserver((i) => i.observe(t, { attributes: !0 })));
|
|
562
|
+
}, this._resetOriginalStyle = () => {
|
|
563
|
+
const t = this.element, i = this._originalStyle;
|
|
564
|
+
if (!(t && i))
|
|
565
|
+
return;
|
|
566
|
+
const s = t.style;
|
|
567
|
+
s.position = i.position, s.zIndex = i.zIndex, s.top = i.top, s.left = i.left, s.width = i.width, s.height = i.height;
|
|
568
|
+
}, this._safeMutationObserver = (t) => {
|
|
569
|
+
this._mutationObserver && t(this._mutationObserver);
|
|
570
|
+
}, this._setFullScreenStyle = () => {
|
|
571
|
+
const t = this.element;
|
|
572
|
+
if (!t)
|
|
573
|
+
return;
|
|
574
|
+
const i = "important", s = t.style;
|
|
575
|
+
s.setProperty("position", "fixed", i), s.setProperty("z-index", this.container.actualOptions.fullScreen.zIndex.toString(10), i), s.setProperty("top", "0", i), s.setProperty("left", "0", i), s.setProperty("width", "100%", i), s.setProperty("height", "100%", i);
|
|
576
|
+
}, this.size = {
|
|
577
|
+
height: 0,
|
|
578
|
+
width: 0
|
|
579
|
+
}, this._context = null, this._generated = !1, this._preDrawUpdaters = [], this._postDrawUpdaters = [], this._resizePlugins = [], this._colorPlugins = [];
|
|
580
|
+
}
|
|
581
|
+
get _fullScreen() {
|
|
582
|
+
return this.container.actualOptions.fullScreen.enable;
|
|
583
|
+
}
|
|
584
|
+
clear() {
|
|
585
|
+
const e = this.container.actualOptions, t = e.particles.move.trail, i = this._trailFill;
|
|
586
|
+
e.backgroundMask.enable ? this.paint() : t.enable && t.length > 0 && i ? i.color ? this._paintBase(q(i.color, i.opacity)) : i.image && this._paintImage(i.image, i.opacity) : this.draw((s) => {
|
|
587
|
+
K(s, this.size);
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
destroy() {
|
|
591
|
+
if (this.stop(), this._generated) {
|
|
592
|
+
const e = this.element;
|
|
593
|
+
e && e.remove();
|
|
594
|
+
} else
|
|
595
|
+
this._resetOriginalStyle();
|
|
596
|
+
this._preDrawUpdaters = [], this._postDrawUpdaters = [], this._resizePlugins = [], this._colorPlugins = [];
|
|
597
|
+
}
|
|
598
|
+
draw(e) {
|
|
599
|
+
const t = this._context;
|
|
600
|
+
if (t)
|
|
601
|
+
return e(t);
|
|
602
|
+
}
|
|
603
|
+
drawParticle(e, t) {
|
|
604
|
+
if (e.spawning || e.destroyed)
|
|
605
|
+
return;
|
|
606
|
+
const i = e.getRadius();
|
|
607
|
+
if (i <= 0)
|
|
608
|
+
return;
|
|
609
|
+
const s = e.getFillColor(), r = e.getStrokeColor() ?? s;
|
|
610
|
+
let [o, a] = this._getPluginParticleColors(e);
|
|
611
|
+
o || (o = s), a || (a = r), !(!o && !a) && this.draw((h) => {
|
|
612
|
+
const l = this.container, c = l.actualOptions, u = e.options.zIndex, f = (1 - e.zIndexFactor) ** u.opacityRate, d = e.bubble.opacity ?? e.opacity?.value ?? 1, y = e.strokeOpacity ?? d, m = d * f, b = y * f, _ = {}, z = {
|
|
613
|
+
fill: o ? xe(o, m) : void 0
|
|
614
|
+
};
|
|
615
|
+
z.stroke = a ? xe(a, b) : z.fill, this._applyPreDrawUpdaters(h, e, i, m, z, _), bt({
|
|
616
|
+
container: l,
|
|
617
|
+
context: h,
|
|
618
|
+
particle: e,
|
|
619
|
+
delta: t,
|
|
620
|
+
colorStyles: z,
|
|
621
|
+
backgroundMask: c.backgroundMask.enable,
|
|
622
|
+
composite: c.backgroundMask.composite,
|
|
623
|
+
radius: i * (1 - e.zIndexFactor) ** u.sizeRate,
|
|
624
|
+
opacity: m,
|
|
625
|
+
shadow: e.options.shadow,
|
|
626
|
+
transform: _
|
|
627
|
+
}), this._applyPostDrawUpdaters(e);
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
drawParticlePlugin(e, t, i) {
|
|
631
|
+
this.draw((s) => Pt(s, e, t, i));
|
|
632
|
+
}
|
|
633
|
+
drawPlugin(e, t) {
|
|
634
|
+
this.draw((i) => Mt(i, e, t));
|
|
635
|
+
}
|
|
636
|
+
async init() {
|
|
637
|
+
this._safeMutationObserver((e) => e.disconnect()), this._mutationObserver = ht((e) => {
|
|
638
|
+
for (const t of e)
|
|
639
|
+
t.type === "attributes" && t.attributeName === "style" && this._repairStyle();
|
|
640
|
+
}), this.resize(), this._initStyle(), this._initCover();
|
|
641
|
+
try {
|
|
642
|
+
await this._initTrail();
|
|
643
|
+
} catch (e) {
|
|
644
|
+
$().error(e);
|
|
645
|
+
}
|
|
646
|
+
this.initBackground(), this._safeMutationObserver((e) => {
|
|
647
|
+
this.element && e.observe(this.element, { attributes: !0 });
|
|
648
|
+
}), this.initUpdaters(), this.initPlugins(), this.paint();
|
|
649
|
+
}
|
|
650
|
+
initBackground() {
|
|
651
|
+
const e = this.container.actualOptions, t = e.background, i = this.element;
|
|
652
|
+
if (!i)
|
|
653
|
+
return;
|
|
654
|
+
const s = i.style;
|
|
655
|
+
if (s) {
|
|
656
|
+
if (t.color) {
|
|
657
|
+
const r = V(t.color);
|
|
658
|
+
s.backgroundColor = r ? q(r, t.opacity) : "";
|
|
659
|
+
} else
|
|
660
|
+
s.backgroundColor = "";
|
|
661
|
+
s.backgroundImage = t.image || "", s.backgroundPosition = t.position || "", s.backgroundRepeat = t.repeat || "", s.backgroundSize = t.size || "";
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
initPlugins() {
|
|
665
|
+
this._resizePlugins = [];
|
|
666
|
+
for (const [, e] of this.container.plugins)
|
|
667
|
+
e.resize && this._resizePlugins.push(e), (e.particleFillColor || e.particleStrokeColor) && this._colorPlugins.push(e);
|
|
668
|
+
}
|
|
669
|
+
initUpdaters() {
|
|
670
|
+
this._preDrawUpdaters = [], this._postDrawUpdaters = [];
|
|
671
|
+
for (const e of this.container.particles.updaters)
|
|
672
|
+
e.afterDraw && this._postDrawUpdaters.push(e), (e.getColorStyles || e.getTransformValues || e.beforeDraw) && this._preDrawUpdaters.push(e);
|
|
673
|
+
}
|
|
674
|
+
loadCanvas(e) {
|
|
675
|
+
this._generated && this.element && this.element.remove(), this._generated = e.dataset && B in e.dataset ? e.dataset[B] === "true" : this._generated, this.element = e, this.element.ariaHidden = "true", this._originalStyle = x({}, this.element.style), this.size.height = e.offsetHeight, this.size.width = e.offsetWidth, this._context = this.element.getContext("2d"), this._safeMutationObserver((t) => {
|
|
676
|
+
this.element && t.observe(this.element, { attributes: !0 });
|
|
677
|
+
}), this.container.retina.init(), this.initBackground();
|
|
678
|
+
}
|
|
679
|
+
paint() {
|
|
680
|
+
const e = this.container.actualOptions;
|
|
681
|
+
this.draw((t) => {
|
|
682
|
+
e.backgroundMask.enable && e.backgroundMask.cover ? (K(t, this.size), this._paintBase(this._coverColorStyle)) : this._paintBase();
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
resize() {
|
|
686
|
+
if (!this.element)
|
|
687
|
+
return !1;
|
|
688
|
+
const e = this.container, t = e.retina.pixelRatio, i = e.canvas.size, s = {
|
|
689
|
+
width: this.element.offsetWidth * t,
|
|
690
|
+
height: this.element.offsetHeight * t
|
|
691
|
+
};
|
|
692
|
+
if (s.height === i.height && s.width === i.width && s.height === this.element.height && s.width === this.element.width)
|
|
693
|
+
return !1;
|
|
694
|
+
const r = { ...i };
|
|
695
|
+
return this.element.width = i.width = this.element.offsetWidth * t, this.element.height = i.height = this.element.offsetHeight * t, this.container.started && (this.resizeFactor = {
|
|
696
|
+
width: i.width / r.width,
|
|
697
|
+
height: i.height / r.height
|
|
698
|
+
}), !0;
|
|
699
|
+
}
|
|
700
|
+
stop() {
|
|
701
|
+
this._safeMutationObserver((e) => e.disconnect()), this._mutationObserver = void 0, this.draw((e) => K(e, this.size));
|
|
702
|
+
}
|
|
703
|
+
async windowResize() {
|
|
704
|
+
if (!this.element || !this.resize())
|
|
705
|
+
return;
|
|
706
|
+
const e = this.container, t = e.updateActualOptions();
|
|
707
|
+
e.particles.setDensity(), this._applyResizePlugins(), t && await e.refresh();
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
function P(n, e, t, i, s) {
|
|
711
|
+
if (i) {
|
|
712
|
+
let r = { passive: !0 };
|
|
713
|
+
R(s) ? r.capture = s : s !== void 0 && (r = s), n.addEventListener(e, t, r);
|
|
714
|
+
} else {
|
|
715
|
+
const r = s;
|
|
716
|
+
n.removeEventListener(e, t, r);
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
class Ot {
|
|
720
|
+
constructor(e) {
|
|
721
|
+
this.container = e, this._doMouseTouchClick = (t) => {
|
|
722
|
+
const i = this.container, s = i.actualOptions;
|
|
723
|
+
if (this._canPush) {
|
|
724
|
+
const r = i.interactivity.mouse, o = r.position;
|
|
725
|
+
if (!o)
|
|
726
|
+
return;
|
|
727
|
+
r.clickPosition = { ...o }, r.clickTime = (/* @__PURE__ */ new Date()).getTime();
|
|
728
|
+
const a = s.interactivity.events.onClick;
|
|
729
|
+
E(a.mode, (h) => this.container.handleClickMode(h));
|
|
730
|
+
}
|
|
731
|
+
t.type === "touchend" && setTimeout(() => this._mouseTouchFinish(), 500);
|
|
732
|
+
}, this._handleThemeChange = (t) => {
|
|
733
|
+
const i = t, s = this.container, r = s.options, o = r.defaultThemes, a = i.matches ? o.dark : o.light, h = r.themes.find((l) => l.name === a);
|
|
734
|
+
h && h.default.auto && s.loadTheme(a);
|
|
735
|
+
}, this._handleVisibilityChange = () => {
|
|
736
|
+
const t = this.container, i = t.actualOptions;
|
|
737
|
+
this._mouseTouchFinish(), i.pauseOnBlur && (document && document.hidden ? (t.pageHidden = !0, t.pause()) : (t.pageHidden = !1, t.getAnimationStatus() ? t.play(!0) : t.draw(!0)));
|
|
738
|
+
}, this._handleWindowResize = async () => {
|
|
739
|
+
this._resizeTimeout && (clearTimeout(this._resizeTimeout), delete this._resizeTimeout), this._resizeTimeout = setTimeout(async () => {
|
|
740
|
+
const t = this.container.canvas;
|
|
741
|
+
t && await t.windowResize();
|
|
742
|
+
}, this.container.actualOptions.interactivity.events.resize.delay * 1e3);
|
|
743
|
+
}, this._manageInteractivityListeners = (t, i) => {
|
|
744
|
+
const s = this._handlers, r = this.container, o = r.actualOptions, a = r.interactivity.element;
|
|
745
|
+
if (!a)
|
|
746
|
+
return;
|
|
747
|
+
const h = a, l = r.canvas.element;
|
|
748
|
+
l && (l.style.pointerEvents = h === l ? "initial" : "none"), (o.interactivity.events.onHover.enable || o.interactivity.events.onClick.enable) && (P(a, ve, s.mouseMove, i), P(a, Ze, s.touchStart, i), P(a, Qe, s.touchMove, i), o.interactivity.events.onClick.enable ? (P(a, _e, s.touchEndClick, i), P(a, Xe, s.mouseUp, i), P(a, qe, s.mouseDown, i)) : P(a, _e, s.touchEnd, i), P(a, t, s.mouseLeave, i), P(a, Je, s.touchCancel, i));
|
|
749
|
+
}, this._manageListeners = (t) => {
|
|
750
|
+
const i = this._handlers, s = this.container, r = s.actualOptions, o = r.interactivity.detectsOn, a = s.canvas.element;
|
|
751
|
+
let h = ye;
|
|
752
|
+
o === "window" ? (s.interactivity.element = window, h = Ye) : o === "parent" && a ? s.interactivity.element = a.parentElement ?? a.parentNode : s.interactivity.element = a, this._manageMediaMatch(t), this._manageResize(t), this._manageInteractivityListeners(h, t), document && P(document, Ke, i.visibilityChange, t, !1);
|
|
753
|
+
}, this._manageMediaMatch = (t) => {
|
|
754
|
+
const i = this._handlers, s = Ee("(prefers-color-scheme: dark)");
|
|
755
|
+
if (s) {
|
|
756
|
+
if (s.addEventListener !== void 0) {
|
|
757
|
+
P(s, "change", i.themeChange, t);
|
|
758
|
+
return;
|
|
759
|
+
}
|
|
760
|
+
s.addListener !== void 0 && (t ? s.addListener(i.oldThemeChange) : s.removeListener(i.oldThemeChange));
|
|
761
|
+
}
|
|
762
|
+
}, this._manageResize = (t) => {
|
|
763
|
+
const i = this._handlers, s = this.container;
|
|
764
|
+
if (!s.actualOptions.interactivity.events.resize)
|
|
765
|
+
return;
|
|
766
|
+
if (typeof ResizeObserver > "u") {
|
|
767
|
+
P(window, je, i.resize, t);
|
|
768
|
+
return;
|
|
769
|
+
}
|
|
770
|
+
const o = s.canvas.element;
|
|
771
|
+
this._resizeObserver && !t ? (o && this._resizeObserver.unobserve(o), this._resizeObserver.disconnect(), delete this._resizeObserver) : !this._resizeObserver && t && o && (this._resizeObserver = new ResizeObserver(async (a) => {
|
|
772
|
+
a.find((l) => l.target === o) && await this._handleWindowResize();
|
|
773
|
+
}), this._resizeObserver.observe(o));
|
|
774
|
+
}, this._mouseDown = () => {
|
|
775
|
+
const { interactivity: t } = this.container;
|
|
776
|
+
if (!t)
|
|
777
|
+
return;
|
|
778
|
+
const { mouse: i } = t;
|
|
779
|
+
i.clicking = !0, i.downPosition = i.position;
|
|
780
|
+
}, this._mouseTouchClick = (t) => {
|
|
781
|
+
const i = this.container, s = i.actualOptions, { mouse: r } = i.interactivity;
|
|
782
|
+
r.inside = !0;
|
|
783
|
+
let o = !1;
|
|
784
|
+
const a = r.position;
|
|
785
|
+
if (!(!a || !s.interactivity.events.onClick.enable)) {
|
|
786
|
+
for (const [, h] of i.plugins)
|
|
787
|
+
if (h.clickPositionValid && (o = h.clickPositionValid(a), o))
|
|
788
|
+
break;
|
|
789
|
+
o || this._doMouseTouchClick(t), r.clicking = !1;
|
|
790
|
+
}
|
|
791
|
+
}, this._mouseTouchFinish = () => {
|
|
792
|
+
const t = this.container.interactivity;
|
|
793
|
+
if (!t)
|
|
794
|
+
return;
|
|
795
|
+
const i = t.mouse;
|
|
796
|
+
delete i.position, delete i.clickPosition, delete i.downPosition, t.status = ye, i.inside = !1, i.clicking = !1;
|
|
797
|
+
}, this._mouseTouchMove = (t) => {
|
|
798
|
+
const i = this.container, s = i.actualOptions, r = i.interactivity, o = i.canvas.element;
|
|
799
|
+
if (!r || !r.element)
|
|
800
|
+
return;
|
|
801
|
+
r.mouse.inside = !0;
|
|
802
|
+
let a;
|
|
803
|
+
if (t.type.startsWith("pointer")) {
|
|
804
|
+
this._canPush = !0;
|
|
805
|
+
const l = t;
|
|
806
|
+
if (r.element === window) {
|
|
807
|
+
if (o) {
|
|
808
|
+
const c = o.getBoundingClientRect();
|
|
809
|
+
a = {
|
|
810
|
+
x: l.clientX - c.left,
|
|
811
|
+
y: l.clientY - c.top
|
|
812
|
+
};
|
|
813
|
+
}
|
|
814
|
+
} else if (s.interactivity.detectsOn === "parent") {
|
|
815
|
+
const c = l.target, u = l.currentTarget;
|
|
816
|
+
if (c && u && o) {
|
|
817
|
+
const f = c.getBoundingClientRect(), d = u.getBoundingClientRect(), y = o.getBoundingClientRect();
|
|
818
|
+
a = {
|
|
819
|
+
x: l.offsetX + 2 * f.left - (d.left + y.left),
|
|
820
|
+
y: l.offsetY + 2 * f.top - (d.top + y.top)
|
|
821
|
+
};
|
|
822
|
+
} else
|
|
823
|
+
a = {
|
|
824
|
+
x: l.offsetX ?? l.clientX,
|
|
825
|
+
y: l.offsetY ?? l.clientY
|
|
826
|
+
};
|
|
827
|
+
} else l.target === o && (a = {
|
|
828
|
+
x: l.offsetX ?? l.clientX,
|
|
829
|
+
y: l.offsetY ?? l.clientY
|
|
830
|
+
});
|
|
831
|
+
} else if (this._canPush = t.type !== "touchmove", o) {
|
|
832
|
+
const l = t, c = l.touches[l.touches.length - 1], u = o.getBoundingClientRect();
|
|
833
|
+
a = {
|
|
834
|
+
x: c.clientX - (u.left ?? 0),
|
|
835
|
+
y: c.clientY - (u.top ?? 0)
|
|
836
|
+
};
|
|
837
|
+
}
|
|
838
|
+
const h = i.retina.pixelRatio;
|
|
839
|
+
a && (a.x *= h, a.y *= h), r.mouse.position = a, r.status = ve;
|
|
840
|
+
}, this._touchEnd = (t) => {
|
|
841
|
+
const i = t, s = Array.from(i.changedTouches);
|
|
842
|
+
for (const r of s)
|
|
843
|
+
this._touches.delete(r.identifier);
|
|
844
|
+
this._mouseTouchFinish();
|
|
845
|
+
}, this._touchEndClick = (t) => {
|
|
846
|
+
const i = t, s = Array.from(i.changedTouches);
|
|
847
|
+
for (const r of s)
|
|
848
|
+
this._touches.delete(r.identifier);
|
|
849
|
+
this._mouseTouchClick(t);
|
|
850
|
+
}, this._touchStart = (t) => {
|
|
851
|
+
const i = t, s = Array.from(i.changedTouches);
|
|
852
|
+
for (const r of s)
|
|
853
|
+
this._touches.set(r.identifier, performance.now());
|
|
854
|
+
this._mouseTouchMove(t);
|
|
855
|
+
}, this._canPush = !0, this._touches = /* @__PURE__ */ new Map(), this._handlers = {
|
|
856
|
+
mouseDown: () => this._mouseDown(),
|
|
857
|
+
mouseLeave: () => this._mouseTouchFinish(),
|
|
858
|
+
mouseMove: (t) => this._mouseTouchMove(t),
|
|
859
|
+
mouseUp: (t) => this._mouseTouchClick(t),
|
|
860
|
+
touchStart: (t) => this._touchStart(t),
|
|
861
|
+
touchMove: (t) => this._mouseTouchMove(t),
|
|
862
|
+
touchEnd: (t) => this._touchEnd(t),
|
|
863
|
+
touchCancel: (t) => this._touchEnd(t),
|
|
864
|
+
touchEndClick: (t) => this._touchEndClick(t),
|
|
865
|
+
visibilityChange: () => this._handleVisibilityChange(),
|
|
866
|
+
themeChange: (t) => this._handleThemeChange(t),
|
|
867
|
+
oldThemeChange: (t) => this._handleThemeChange(t),
|
|
868
|
+
resize: () => {
|
|
869
|
+
this._handleWindowResize();
|
|
870
|
+
}
|
|
871
|
+
};
|
|
872
|
+
}
|
|
873
|
+
addListeners() {
|
|
874
|
+
this._manageListeners(!0);
|
|
875
|
+
}
|
|
876
|
+
removeListeners() {
|
|
877
|
+
this._manageListeners(!1);
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
class O {
|
|
881
|
+
constructor() {
|
|
882
|
+
this.value = "";
|
|
883
|
+
}
|
|
884
|
+
static create(e, t) {
|
|
885
|
+
const i = new O();
|
|
886
|
+
return i.load(e), t !== void 0 && (C(t) || S(t) ? i.load({ value: t }) : i.load(t)), i;
|
|
887
|
+
}
|
|
888
|
+
load(e) {
|
|
889
|
+
e?.value !== void 0 && (this.value = e.value);
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
class Tt {
|
|
893
|
+
constructor() {
|
|
894
|
+
this.color = new O(), this.color.value = "", this.image = "", this.position = "", this.repeat = "", this.size = "", this.opacity = 1;
|
|
895
|
+
}
|
|
896
|
+
load(e) {
|
|
897
|
+
e && (e.color !== void 0 && (this.color = O.create(this.color, e.color)), e.image !== void 0 && (this.image = e.image), e.position !== void 0 && (this.position = e.position), e.repeat !== void 0 && (this.repeat = e.repeat), e.size !== void 0 && (this.size = e.size), e.opacity !== void 0 && (this.opacity = e.opacity));
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
class Rt {
|
|
901
|
+
constructor() {
|
|
902
|
+
this.color = new O(), this.color.value = "#fff", this.opacity = 1;
|
|
903
|
+
}
|
|
904
|
+
load(e) {
|
|
905
|
+
e && (e.color !== void 0 && (this.color = O.create(this.color, e.color)), e.opacity !== void 0 && (this.opacity = e.opacity));
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
class It {
|
|
909
|
+
constructor() {
|
|
910
|
+
this.composite = "destination-out", this.cover = new Rt(), this.enable = !1;
|
|
911
|
+
}
|
|
912
|
+
load(e) {
|
|
913
|
+
if (e) {
|
|
914
|
+
if (e.composite !== void 0 && (this.composite = e.composite), e.cover !== void 0) {
|
|
915
|
+
const t = e.cover, i = C(e.cover) ? { color: e.cover } : e.cover;
|
|
916
|
+
this.cover.load(t.color !== void 0 ? t : { color: i });
|
|
917
|
+
}
|
|
918
|
+
e.enable !== void 0 && (this.enable = e.enable);
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
class Et {
|
|
923
|
+
constructor() {
|
|
924
|
+
this.enable = !0, this.zIndex = 0;
|
|
925
|
+
}
|
|
926
|
+
load(e) {
|
|
927
|
+
e && (e.enable !== void 0 && (this.enable = e.enable), e.zIndex !== void 0 && (this.zIndex = e.zIndex));
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
class Dt {
|
|
931
|
+
constructor() {
|
|
932
|
+
this.enable = !1, this.mode = [];
|
|
933
|
+
}
|
|
934
|
+
load(e) {
|
|
935
|
+
e && (e.enable !== void 0 && (this.enable = e.enable), e.mode !== void 0 && (this.mode = e.mode));
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
class Me {
|
|
939
|
+
constructor() {
|
|
940
|
+
this.selectors = [], this.enable = !1, this.mode = [], this.type = "circle";
|
|
941
|
+
}
|
|
942
|
+
get el() {
|
|
943
|
+
return this.elementId;
|
|
944
|
+
}
|
|
945
|
+
set el(e) {
|
|
946
|
+
this.elementId = e;
|
|
947
|
+
}
|
|
948
|
+
get elementId() {
|
|
949
|
+
return this.ids;
|
|
950
|
+
}
|
|
951
|
+
set elementId(e) {
|
|
952
|
+
this.ids = e;
|
|
953
|
+
}
|
|
954
|
+
get ids() {
|
|
955
|
+
return E(this.selectors, (e) => e.replace("#", ""));
|
|
956
|
+
}
|
|
957
|
+
set ids(e) {
|
|
958
|
+
this.selectors = E(e, (t) => `#${t}`);
|
|
959
|
+
}
|
|
960
|
+
load(e) {
|
|
961
|
+
if (!e)
|
|
962
|
+
return;
|
|
963
|
+
const t = e.ids ?? e.elementId ?? e.el;
|
|
964
|
+
t !== void 0 && (this.ids = t), e.selectors !== void 0 && (this.selectors = e.selectors), e.enable !== void 0 && (this.enable = e.enable), e.mode !== void 0 && (this.mode = e.mode), e.type !== void 0 && (this.type = e.type);
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
class At {
|
|
968
|
+
constructor() {
|
|
969
|
+
this.enable = !1, this.force = 2, this.smooth = 10;
|
|
970
|
+
}
|
|
971
|
+
load(e) {
|
|
972
|
+
e && (e.enable !== void 0 && (this.enable = e.enable), e.force !== void 0 && (this.force = e.force), e.smooth !== void 0 && (this.smooth = e.smooth));
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
class Lt {
|
|
976
|
+
constructor() {
|
|
977
|
+
this.enable = !1, this.mode = [], this.parallax = new At();
|
|
978
|
+
}
|
|
979
|
+
load(e) {
|
|
980
|
+
e && (e.enable !== void 0 && (this.enable = e.enable), e.mode !== void 0 && (this.mode = e.mode), this.parallax.load(e.parallax));
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
class Ft {
|
|
984
|
+
constructor() {
|
|
985
|
+
this.delay = 0.5, this.enable = !0;
|
|
986
|
+
}
|
|
987
|
+
load(e) {
|
|
988
|
+
e !== void 0 && (e.delay !== void 0 && (this.delay = e.delay), e.enable !== void 0 && (this.enable = e.enable));
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
class Vt {
|
|
992
|
+
constructor() {
|
|
993
|
+
this.onClick = new Dt(), this.onDiv = new Me(), this.onHover = new Lt(), this.resize = new Ft();
|
|
994
|
+
}
|
|
995
|
+
get onclick() {
|
|
996
|
+
return this.onClick;
|
|
997
|
+
}
|
|
998
|
+
set onclick(e) {
|
|
999
|
+
this.onClick = e;
|
|
1000
|
+
}
|
|
1001
|
+
get ondiv() {
|
|
1002
|
+
return this.onDiv;
|
|
1003
|
+
}
|
|
1004
|
+
set ondiv(e) {
|
|
1005
|
+
this.onDiv = e;
|
|
1006
|
+
}
|
|
1007
|
+
get onhover() {
|
|
1008
|
+
return this.onHover;
|
|
1009
|
+
}
|
|
1010
|
+
set onhover(e) {
|
|
1011
|
+
this.onHover = e;
|
|
1012
|
+
}
|
|
1013
|
+
load(e) {
|
|
1014
|
+
if (!e)
|
|
1015
|
+
return;
|
|
1016
|
+
this.onClick.load(e.onClick ?? e.onclick);
|
|
1017
|
+
const t = e.onDiv ?? e.ondiv;
|
|
1018
|
+
t !== void 0 && (this.onDiv = E(t, (i) => {
|
|
1019
|
+
const s = new Me();
|
|
1020
|
+
return s.load(i), s;
|
|
1021
|
+
})), this.onHover.load(e.onHover ?? e.onhover), R(e.resize) ? this.resize.enable = e.resize : this.resize.load(e.resize);
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
class Ht {
|
|
1025
|
+
constructor(e, t) {
|
|
1026
|
+
this._engine = e, this._container = t;
|
|
1027
|
+
}
|
|
1028
|
+
load(e) {
|
|
1029
|
+
if (!e || !this._container)
|
|
1030
|
+
return;
|
|
1031
|
+
const t = this._engine.plugins.interactors.get(this._container);
|
|
1032
|
+
if (t)
|
|
1033
|
+
for (const i of t)
|
|
1034
|
+
i.loadModeOptions && i.loadModeOptions(this, e);
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
class Fe {
|
|
1038
|
+
constructor(e, t) {
|
|
1039
|
+
this.detectsOn = "window", this.events = new Vt(), this.modes = new Ht(e, t);
|
|
1040
|
+
}
|
|
1041
|
+
get detect_on() {
|
|
1042
|
+
return this.detectsOn;
|
|
1043
|
+
}
|
|
1044
|
+
set detect_on(e) {
|
|
1045
|
+
this.detectsOn = e;
|
|
1046
|
+
}
|
|
1047
|
+
load(e) {
|
|
1048
|
+
if (!e)
|
|
1049
|
+
return;
|
|
1050
|
+
const t = e.detectsOn ?? e.detect_on;
|
|
1051
|
+
t !== void 0 && (this.detectsOn = t), this.events.load(e.events), this.modes.load(e.modes);
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
class Ut {
|
|
1055
|
+
load(e) {
|
|
1056
|
+
e && (e.position && (this.position = {
|
|
1057
|
+
x: e.position.x ?? 50,
|
|
1058
|
+
y: e.position.y ?? 50,
|
|
1059
|
+
mode: e.position.mode ?? "percent"
|
|
1060
|
+
}), e.options && (this.options = x({}, e.options)));
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
class Bt {
|
|
1064
|
+
constructor() {
|
|
1065
|
+
this.maxWidth = 1 / 0, this.options = {}, this.mode = "canvas";
|
|
1066
|
+
}
|
|
1067
|
+
load(e) {
|
|
1068
|
+
e && (e.maxWidth !== void 0 && (this.maxWidth = e.maxWidth), e.mode !== void 0 && (e.mode === "screen" ? this.mode = "screen" : this.mode = "canvas"), e.options !== void 0 && (this.options = x({}, e.options)));
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
class Wt {
|
|
1072
|
+
constructor() {
|
|
1073
|
+
this.auto = !1, this.mode = "any", this.value = !1;
|
|
1074
|
+
}
|
|
1075
|
+
load(e) {
|
|
1076
|
+
e && (e.auto !== void 0 && (this.auto = e.auto), e.mode !== void 0 && (this.mode = e.mode), e.value !== void 0 && (this.value = e.value));
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
class $t {
|
|
1080
|
+
constructor() {
|
|
1081
|
+
this.name = "", this.default = new Wt();
|
|
1082
|
+
}
|
|
1083
|
+
load(e) {
|
|
1084
|
+
e && (e.name !== void 0 && (this.name = e.name), this.default.load(e.default), e.options !== void 0 && (this.options = x({}, e.options)));
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
class ee {
|
|
1088
|
+
constructor() {
|
|
1089
|
+
this.count = 0, this.enable = !1, this.offset = 0, this.speed = 1, this.delay = 0, this.decay = 0, this.sync = !0;
|
|
1090
|
+
}
|
|
1091
|
+
load(e) {
|
|
1092
|
+
e && (e.count !== void 0 && (this.count = p(e.count)), e.enable !== void 0 && (this.enable = e.enable), e.offset !== void 0 && (this.offset = p(e.offset)), e.speed !== void 0 && (this.speed = p(e.speed)), e.decay !== void 0 && (this.decay = p(e.decay)), e.delay !== void 0 && (this.delay = p(e.delay)), e.sync !== void 0 && (this.sync = e.sync));
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
class Gt {
|
|
1096
|
+
constructor() {
|
|
1097
|
+
this.h = new ee(), this.s = new ee(), this.l = new ee();
|
|
1098
|
+
}
|
|
1099
|
+
load(e) {
|
|
1100
|
+
e && (this.h.load(e.h), this.s.load(e.s), this.l.load(e.l));
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
class G extends O {
|
|
1104
|
+
constructor() {
|
|
1105
|
+
super(), this.animation = new Gt();
|
|
1106
|
+
}
|
|
1107
|
+
static create(e, t) {
|
|
1108
|
+
const i = new G();
|
|
1109
|
+
return i.load(e), t !== void 0 && (C(t) || S(t) ? i.load({ value: t }) : i.load(t)), i;
|
|
1110
|
+
}
|
|
1111
|
+
load(e) {
|
|
1112
|
+
if (super.load(e), !e)
|
|
1113
|
+
return;
|
|
1114
|
+
const t = e.animation;
|
|
1115
|
+
t !== void 0 && (t.enable !== void 0 ? this.animation.h.load(t) : this.animation.load(e.animation));
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
class Nt {
|
|
1119
|
+
constructor() {
|
|
1120
|
+
this.speed = 2;
|
|
1121
|
+
}
|
|
1122
|
+
load(e) {
|
|
1123
|
+
e && e.speed !== void 0 && (this.speed = e.speed);
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
class qt {
|
|
1127
|
+
constructor() {
|
|
1128
|
+
this.enable = !0, this.retries = 0;
|
|
1129
|
+
}
|
|
1130
|
+
load(e) {
|
|
1131
|
+
e && (e.enable !== void 0 && (this.enable = e.enable), e.retries !== void 0 && (this.retries = e.retries));
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
class Xt {
|
|
1135
|
+
constructor() {
|
|
1136
|
+
this.count = 0, this.enable = !1, this.speed = 1, this.decay = 0, this.delay = 0, this.sync = !1;
|
|
1137
|
+
}
|
|
1138
|
+
load(e) {
|
|
1139
|
+
e && (e.count !== void 0 && (this.count = p(e.count)), e.enable !== void 0 && (this.enable = e.enable), e.speed !== void 0 && (this.speed = p(e.speed)), e.decay !== void 0 && (this.decay = p(e.decay)), e.delay !== void 0 && (this.delay = p(e.delay)), e.sync !== void 0 && (this.sync = e.sync));
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
class Ve extends Xt {
|
|
1143
|
+
constructor() {
|
|
1144
|
+
super(), this.mode = "auto", this.startValue = "random";
|
|
1145
|
+
}
|
|
1146
|
+
load(e) {
|
|
1147
|
+
super.load(e), e && (e.minimumValue !== void 0 && (this.minimumValue = e.minimumValue), e.mode !== void 0 && (this.mode = e.mode), e.startValue !== void 0 && (this.startValue = e.startValue));
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
class Yt {
|
|
1151
|
+
constructor() {
|
|
1152
|
+
this.enable = !1, this.minimumValue = 0;
|
|
1153
|
+
}
|
|
1154
|
+
load(e) {
|
|
1155
|
+
e && (e.enable !== void 0 && (this.enable = e.enable), e.minimumValue !== void 0 && (this.minimumValue = e.minimumValue));
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
class N {
|
|
1159
|
+
constructor() {
|
|
1160
|
+
this.random = new Yt(), this.value = 0;
|
|
1161
|
+
}
|
|
1162
|
+
load(e) {
|
|
1163
|
+
e && (R(e.random) ? this.random.enable = e.random : this.random.load(e.random), e.value !== void 0 && (this.value = p(e.value, this.random.enable ? this.random.minimumValue : void 0)));
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
class Pe extends N {
|
|
1167
|
+
constructor() {
|
|
1168
|
+
super(), this.random.minimumValue = 0.1, this.value = 1;
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
class He {
|
|
1172
|
+
constructor() {
|
|
1173
|
+
this.horizontal = new Pe(), this.vertical = new Pe();
|
|
1174
|
+
}
|
|
1175
|
+
load(e) {
|
|
1176
|
+
e && (this.horizontal.load(e.horizontal), this.vertical.load(e.vertical));
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
class Zt {
|
|
1180
|
+
constructor() {
|
|
1181
|
+
this.absorb = new Nt(), this.bounce = new He(), this.enable = !1, this.maxSpeed = 50, this.mode = "bounce", this.overlap = new qt();
|
|
1182
|
+
}
|
|
1183
|
+
load(e) {
|
|
1184
|
+
e && (this.absorb.load(e.absorb), this.bounce.load(e.bounce), e.enable !== void 0 && (this.enable = e.enable), e.maxSpeed !== void 0 && (this.maxSpeed = p(e.maxSpeed)), e.mode !== void 0 && (this.mode = e.mode), this.overlap.load(e.overlap));
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
class Qt {
|
|
1188
|
+
constructor() {
|
|
1189
|
+
this.offset = 0, this.value = 90;
|
|
1190
|
+
}
|
|
1191
|
+
load(e) {
|
|
1192
|
+
e && (e.offset !== void 0 && (this.offset = p(e.offset)), e.value !== void 0 && (this.value = p(e.value)));
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
class Jt {
|
|
1196
|
+
constructor() {
|
|
1197
|
+
this.distance = 200, this.enable = !1, this.rotate = {
|
|
1198
|
+
x: 3e3,
|
|
1199
|
+
y: 3e3
|
|
1200
|
+
};
|
|
1201
|
+
}
|
|
1202
|
+
get rotateX() {
|
|
1203
|
+
return this.rotate.x;
|
|
1204
|
+
}
|
|
1205
|
+
set rotateX(e) {
|
|
1206
|
+
this.rotate.x = e;
|
|
1207
|
+
}
|
|
1208
|
+
get rotateY() {
|
|
1209
|
+
return this.rotate.y;
|
|
1210
|
+
}
|
|
1211
|
+
set rotateY(e) {
|
|
1212
|
+
this.rotate.y = e;
|
|
1213
|
+
}
|
|
1214
|
+
load(e) {
|
|
1215
|
+
if (!e)
|
|
1216
|
+
return;
|
|
1217
|
+
e.distance !== void 0 && (this.distance = p(e.distance)), e.enable !== void 0 && (this.enable = e.enable);
|
|
1218
|
+
const t = e.rotate?.x ?? e.rotateX;
|
|
1219
|
+
t !== void 0 && (this.rotate.x = t);
|
|
1220
|
+
const i = e.rotate?.y ?? e.rotateY;
|
|
1221
|
+
i !== void 0 && (this.rotate.y = i);
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
class jt {
|
|
1225
|
+
constructor() {
|
|
1226
|
+
this.x = 50, this.y = 50, this.mode = "percent", this.radius = 0;
|
|
1227
|
+
}
|
|
1228
|
+
load(e) {
|
|
1229
|
+
e && (e.x !== void 0 && (this.x = e.x), e.y !== void 0 && (this.y = e.y), e.mode !== void 0 && (this.mode = e.mode), e.radius !== void 0 && (this.radius = e.radius));
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
class Kt {
|
|
1233
|
+
constructor() {
|
|
1234
|
+
this.acceleration = 9.81, this.enable = !1, this.inverse = !1, this.maxSpeed = 50;
|
|
1235
|
+
}
|
|
1236
|
+
load(e) {
|
|
1237
|
+
e && (e.acceleration !== void 0 && (this.acceleration = p(e.acceleration)), e.enable !== void 0 && (this.enable = e.enable), e.inverse !== void 0 && (this.inverse = e.inverse), e.maxSpeed !== void 0 && (this.maxSpeed = p(e.maxSpeed)));
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
class ei {
|
|
1241
|
+
constructor() {
|
|
1242
|
+
this.clamp = !0, this.delay = new N(), this.enable = !1, this.options = {};
|
|
1243
|
+
}
|
|
1244
|
+
load(e) {
|
|
1245
|
+
e && (e.clamp !== void 0 && (this.clamp = e.clamp), this.delay.load(e.delay), e.enable !== void 0 && (this.enable = e.enable), this.generator = e.generator, e.options && (this.options = x(this.options, e.options)));
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
class ti {
|
|
1249
|
+
load(e) {
|
|
1250
|
+
e && (e.color !== void 0 && (this.color = O.create(this.color, e.color)), e.image !== void 0 && (this.image = e.image));
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
class ii {
|
|
1254
|
+
constructor() {
|
|
1255
|
+
this.enable = !1, this.length = 10, this.fill = new ti();
|
|
1256
|
+
}
|
|
1257
|
+
get fillColor() {
|
|
1258
|
+
return this.fill.color;
|
|
1259
|
+
}
|
|
1260
|
+
set fillColor(e) {
|
|
1261
|
+
this.fill.load({ color: e });
|
|
1262
|
+
}
|
|
1263
|
+
load(e) {
|
|
1264
|
+
e && (e.enable !== void 0 && (this.enable = e.enable), (e.fill !== void 0 || e.fillColor !== void 0) && this.fill.load(e.fill || { color: e.fillColor }), e.length !== void 0 && (this.length = e.length));
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
class si {
|
|
1268
|
+
constructor() {
|
|
1269
|
+
this.default = "out";
|
|
1270
|
+
}
|
|
1271
|
+
load(e) {
|
|
1272
|
+
e && (e.default !== void 0 && (this.default = e.default), this.bottom = e.bottom ?? e.default, this.left = e.left ?? e.default, this.right = e.right ?? e.default, this.top = e.top ?? e.default);
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
class ni {
|
|
1276
|
+
constructor() {
|
|
1277
|
+
this.acceleration = 0, this.enable = !1;
|
|
1278
|
+
}
|
|
1279
|
+
load(e) {
|
|
1280
|
+
e && (e.acceleration !== void 0 && (this.acceleration = p(e.acceleration)), e.enable !== void 0 && (this.enable = e.enable), e.position && (this.position = x({}, e.position)));
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
class ri {
|
|
1284
|
+
constructor() {
|
|
1285
|
+
this.angle = new Qt(), this.attract = new Jt(), this.center = new jt(), this.decay = 0, this.distance = {}, this.direction = "none", this.drift = 0, this.enable = !1, this.gravity = new Kt(), this.path = new ei(), this.outModes = new si(), this.random = !1, this.size = !1, this.speed = 2, this.spin = new ni(), this.straight = !1, this.trail = new ii(), this.vibrate = !1, this.warp = !1;
|
|
1286
|
+
}
|
|
1287
|
+
get bounce() {
|
|
1288
|
+
return this.collisions;
|
|
1289
|
+
}
|
|
1290
|
+
set bounce(e) {
|
|
1291
|
+
this.collisions = e;
|
|
1292
|
+
}
|
|
1293
|
+
get collisions() {
|
|
1294
|
+
return !1;
|
|
1295
|
+
}
|
|
1296
|
+
set collisions(e) {
|
|
1297
|
+
}
|
|
1298
|
+
get noise() {
|
|
1299
|
+
return this.path;
|
|
1300
|
+
}
|
|
1301
|
+
set noise(e) {
|
|
1302
|
+
this.path = e;
|
|
1303
|
+
}
|
|
1304
|
+
get outMode() {
|
|
1305
|
+
return this.outModes.default;
|
|
1306
|
+
}
|
|
1307
|
+
set outMode(e) {
|
|
1308
|
+
this.outModes.default = e;
|
|
1309
|
+
}
|
|
1310
|
+
get out_mode() {
|
|
1311
|
+
return this.outMode;
|
|
1312
|
+
}
|
|
1313
|
+
set out_mode(e) {
|
|
1314
|
+
this.outMode = e;
|
|
1315
|
+
}
|
|
1316
|
+
load(e) {
|
|
1317
|
+
if (!e)
|
|
1318
|
+
return;
|
|
1319
|
+
this.angle.load(k(e.angle) ? { value: e.angle } : e.angle), this.attract.load(e.attract), this.center.load(e.center), e.decay !== void 0 && (this.decay = p(e.decay)), e.direction !== void 0 && (this.direction = e.direction), e.distance !== void 0 && (this.distance = k(e.distance) ? {
|
|
1320
|
+
horizontal: e.distance,
|
|
1321
|
+
vertical: e.distance
|
|
1322
|
+
} : { ...e.distance }), e.drift !== void 0 && (this.drift = p(e.drift)), e.enable !== void 0 && (this.enable = e.enable), this.gravity.load(e.gravity);
|
|
1323
|
+
const t = e.outModes ?? e.outMode ?? e.out_mode;
|
|
1324
|
+
t !== void 0 && (U(t) ? this.outModes.load(t) : this.outModes.load({
|
|
1325
|
+
default: t
|
|
1326
|
+
})), this.path.load(e.path ?? e.noise), e.random !== void 0 && (this.random = e.random), e.size !== void 0 && (this.size = e.size), e.speed !== void 0 && (this.speed = p(e.speed)), this.spin.load(e.spin), e.straight !== void 0 && (this.straight = e.straight), this.trail.load(e.trail), e.vibrate !== void 0 && (this.vibrate = e.vibrate), e.warp !== void 0 && (this.warp = e.warp);
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
class oi extends Ve {
|
|
1330
|
+
constructor() {
|
|
1331
|
+
super(), this.destroy = "none", this.speed = 2;
|
|
1332
|
+
}
|
|
1333
|
+
get opacity_min() {
|
|
1334
|
+
return this.minimumValue;
|
|
1335
|
+
}
|
|
1336
|
+
set opacity_min(e) {
|
|
1337
|
+
this.minimumValue = e;
|
|
1338
|
+
}
|
|
1339
|
+
load(e) {
|
|
1340
|
+
e?.opacity_min !== void 0 && e.minimumValue === void 0 && (e.minimumValue = e.opacity_min), super.load(e), e && e.destroy !== void 0 && (this.destroy = e.destroy);
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
class ai extends N {
|
|
1344
|
+
constructor() {
|
|
1345
|
+
super(), this.animation = new oi(), this.random.minimumValue = 0.1, this.value = 1;
|
|
1346
|
+
}
|
|
1347
|
+
get anim() {
|
|
1348
|
+
return this.animation;
|
|
1349
|
+
}
|
|
1350
|
+
set anim(e) {
|
|
1351
|
+
this.animation = e;
|
|
1352
|
+
}
|
|
1353
|
+
load(e) {
|
|
1354
|
+
if (!e)
|
|
1355
|
+
return;
|
|
1356
|
+
super.load(e);
|
|
1357
|
+
const t = e.animation ?? e.anim;
|
|
1358
|
+
t !== void 0 && (this.animation.load(t), this.value = p(this.value, this.animation.enable ? this.animation.minimumValue : void 0));
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
class hi {
|
|
1362
|
+
constructor() {
|
|
1363
|
+
this.enable = !1, this.width = 1920, this.height = 1080;
|
|
1364
|
+
}
|
|
1365
|
+
get area() {
|
|
1366
|
+
return this.width;
|
|
1367
|
+
}
|
|
1368
|
+
set area(e) {
|
|
1369
|
+
this.width = e;
|
|
1370
|
+
}
|
|
1371
|
+
get factor() {
|
|
1372
|
+
return this.height;
|
|
1373
|
+
}
|
|
1374
|
+
set factor(e) {
|
|
1375
|
+
this.height = e;
|
|
1376
|
+
}
|
|
1377
|
+
get value_area() {
|
|
1378
|
+
return this.area;
|
|
1379
|
+
}
|
|
1380
|
+
set value_area(e) {
|
|
1381
|
+
this.area = e;
|
|
1382
|
+
}
|
|
1383
|
+
load(e) {
|
|
1384
|
+
if (!e)
|
|
1385
|
+
return;
|
|
1386
|
+
e.enable !== void 0 && (this.enable = e.enable);
|
|
1387
|
+
const t = e.width ?? e.area ?? e.value_area;
|
|
1388
|
+
t !== void 0 && (this.width = t);
|
|
1389
|
+
const i = e.height ?? e.factor;
|
|
1390
|
+
i !== void 0 && (this.height = i);
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
class li {
|
|
1394
|
+
constructor() {
|
|
1395
|
+
this.density = new hi(), this.limit = 0, this.value = 0;
|
|
1396
|
+
}
|
|
1397
|
+
get max() {
|
|
1398
|
+
return this.limit;
|
|
1399
|
+
}
|
|
1400
|
+
set max(e) {
|
|
1401
|
+
this.limit = e;
|
|
1402
|
+
}
|
|
1403
|
+
load(e) {
|
|
1404
|
+
if (!e)
|
|
1405
|
+
return;
|
|
1406
|
+
this.density.load(e.density);
|
|
1407
|
+
const t = e.limit ?? e.max;
|
|
1408
|
+
t !== void 0 && (this.limit = t), e.value !== void 0 && (this.value = e.value);
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
class ci {
|
|
1412
|
+
constructor() {
|
|
1413
|
+
this.blur = 0, this.color = new O(), this.enable = !1, this.offset = {
|
|
1414
|
+
x: 0,
|
|
1415
|
+
y: 0
|
|
1416
|
+
}, this.color.value = "#000";
|
|
1417
|
+
}
|
|
1418
|
+
load(e) {
|
|
1419
|
+
e && (e.blur !== void 0 && (this.blur = e.blur), this.color = O.create(this.color, e.color), e.enable !== void 0 && (this.enable = e.enable), e.offset !== void 0 && (e.offset.x !== void 0 && (this.offset.x = e.offset.x), e.offset.y !== void 0 && (this.offset.y = e.offset.y)));
|
|
1420
|
+
}
|
|
1421
|
+
}
|
|
1422
|
+
const te = "character", ie = "char", se = "image", ne = "images", re = "polygon", oe = "star";
|
|
1423
|
+
class ui {
|
|
1424
|
+
constructor() {
|
|
1425
|
+
this.loadShape = (e, t, i, s) => {
|
|
1426
|
+
if (!e)
|
|
1427
|
+
return;
|
|
1428
|
+
const r = S(e), o = r ? [] : {}, a = r !== S(this.options[t]), h = r !== S(this.options[i]);
|
|
1429
|
+
a && (this.options[t] = o), h && s && (this.options[i] = o), this.options[t] = x(this.options[t] ?? o, e), (!this.options[i] || s) && (this.options[i] = x(this.options[i] ?? o, e));
|
|
1430
|
+
}, this.close = !0, this.fill = !0, this.options = {}, this.type = "circle";
|
|
1431
|
+
}
|
|
1432
|
+
get character() {
|
|
1433
|
+
return this.options[te] ?? this.options[ie];
|
|
1434
|
+
}
|
|
1435
|
+
set character(e) {
|
|
1436
|
+
this.options[ie] = this.options[te] = e;
|
|
1437
|
+
}
|
|
1438
|
+
get custom() {
|
|
1439
|
+
return this.options;
|
|
1440
|
+
}
|
|
1441
|
+
set custom(e) {
|
|
1442
|
+
this.options = e;
|
|
1443
|
+
}
|
|
1444
|
+
get image() {
|
|
1445
|
+
return this.options[se] ?? this.options[ne];
|
|
1446
|
+
}
|
|
1447
|
+
set image(e) {
|
|
1448
|
+
this.options[ne] = this.options[se] = e;
|
|
1449
|
+
}
|
|
1450
|
+
get images() {
|
|
1451
|
+
return this.image;
|
|
1452
|
+
}
|
|
1453
|
+
set images(e) {
|
|
1454
|
+
this.image = e;
|
|
1455
|
+
}
|
|
1456
|
+
get polygon() {
|
|
1457
|
+
return this.options[re] ?? this.options[oe];
|
|
1458
|
+
}
|
|
1459
|
+
set polygon(e) {
|
|
1460
|
+
this.options[oe] = this.options[re] = e;
|
|
1461
|
+
}
|
|
1462
|
+
get stroke() {
|
|
1463
|
+
return [];
|
|
1464
|
+
}
|
|
1465
|
+
set stroke(e) {
|
|
1466
|
+
}
|
|
1467
|
+
load(e) {
|
|
1468
|
+
if (!e)
|
|
1469
|
+
return;
|
|
1470
|
+
const t = e.options ?? e.custom;
|
|
1471
|
+
if (t !== void 0)
|
|
1472
|
+
for (const i in t) {
|
|
1473
|
+
const s = t[i];
|
|
1474
|
+
s && (this.options[i] = x(this.options[i] ?? {}, s));
|
|
1475
|
+
}
|
|
1476
|
+
this.loadShape(e.character, te, ie, !0), this.loadShape(e.polygon, re, oe, !1), this.loadShape(e.image ?? e.images, se, ne, !0), e.close !== void 0 && (this.close = e.close), e.fill !== void 0 && (this.fill = e.fill), e.type !== void 0 && (this.type = e.type);
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
class fi extends Ve {
|
|
1480
|
+
constructor() {
|
|
1481
|
+
super(), this.destroy = "none", this.speed = 5;
|
|
1482
|
+
}
|
|
1483
|
+
get size_min() {
|
|
1484
|
+
return this.minimumValue;
|
|
1485
|
+
}
|
|
1486
|
+
set size_min(e) {
|
|
1487
|
+
this.minimumValue = e;
|
|
1488
|
+
}
|
|
1489
|
+
load(e) {
|
|
1490
|
+
e?.size_min !== void 0 && e.minimumValue === void 0 && (e.minimumValue = e.size_min), super.load(e), e && e.destroy !== void 0 && (this.destroy = e.destroy);
|
|
1491
|
+
}
|
|
1492
|
+
}
|
|
1493
|
+
class di extends N {
|
|
1494
|
+
constructor() {
|
|
1495
|
+
super(), this.animation = new fi(), this.random.minimumValue = 1, this.value = 3;
|
|
1496
|
+
}
|
|
1497
|
+
get anim() {
|
|
1498
|
+
return this.animation;
|
|
1499
|
+
}
|
|
1500
|
+
set anim(e) {
|
|
1501
|
+
this.animation = e;
|
|
1502
|
+
}
|
|
1503
|
+
load(e) {
|
|
1504
|
+
if (super.load(e), !e)
|
|
1505
|
+
return;
|
|
1506
|
+
const t = e.animation ?? e.anim;
|
|
1507
|
+
t !== void 0 && (this.animation.load(t), this.value = p(this.value, this.animation.enable ? this.animation.minimumValue : void 0));
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
class ke {
|
|
1511
|
+
constructor() {
|
|
1512
|
+
this.width = 0;
|
|
1513
|
+
}
|
|
1514
|
+
load(e) {
|
|
1515
|
+
e && (e.color !== void 0 && (this.color = G.create(this.color, e.color)), e.width !== void 0 && (this.width = p(e.width)), e.opacity !== void 0 && (this.opacity = p(e.opacity)));
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
class pi extends N {
|
|
1519
|
+
constructor() {
|
|
1520
|
+
super(), this.opacityRate = 1, this.sizeRate = 1, this.velocityRate = 1;
|
|
1521
|
+
}
|
|
1522
|
+
load(e) {
|
|
1523
|
+
super.load(e), e && (e.opacityRate !== void 0 && (this.opacityRate = e.opacityRate), e.sizeRate !== void 0 && (this.sizeRate = e.sizeRate), e.velocityRate !== void 0 && (this.velocityRate = e.velocityRate));
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
class mi {
|
|
1527
|
+
constructor(e, t) {
|
|
1528
|
+
this._engine = e, this._container = t, this.bounce = new He(), this.collisions = new Zt(), this.color = new G(), this.color.value = "#fff", this.groups = {}, this.move = new ri(), this.number = new li(), this.opacity = new ai(), this.reduceDuplicates = !1, this.shadow = new ci(), this.shape = new ui(), this.size = new di(), this.stroke = new ke(), this.zIndex = new pi();
|
|
1529
|
+
}
|
|
1530
|
+
load(e) {
|
|
1531
|
+
if (!e)
|
|
1532
|
+
return;
|
|
1533
|
+
if (this.bounce.load(e.bounce), this.color.load(G.create(this.color, e.color)), e.groups !== void 0)
|
|
1534
|
+
for (const s in e.groups) {
|
|
1535
|
+
const r = e.groups[s];
|
|
1536
|
+
r !== void 0 && (this.groups[s] = x(this.groups[s] ?? {}, r));
|
|
1537
|
+
}
|
|
1538
|
+
this.move.load(e.move), this.number.load(e.number), this.opacity.load(e.opacity), e.reduceDuplicates !== void 0 && (this.reduceDuplicates = e.reduceDuplicates), this.shape.load(e.shape), this.size.load(e.size), this.shadow.load(e.shadow), this.zIndex.load(e.zIndex);
|
|
1539
|
+
const t = e.move?.collisions ?? e.move?.bounce;
|
|
1540
|
+
t !== void 0 && (this.collisions.enable = t), this.collisions.load(e.collisions), e.interactivity !== void 0 && (this.interactivity = x({}, e.interactivity));
|
|
1541
|
+
const i = e.stroke ?? e.shape?.stroke;
|
|
1542
|
+
if (i && (this.stroke = E(i, (s) => {
|
|
1543
|
+
const r = new ke();
|
|
1544
|
+
return r.load(s), r;
|
|
1545
|
+
})), this._container) {
|
|
1546
|
+
const s = this._engine.plugins.updaters.get(this._container);
|
|
1547
|
+
if (s)
|
|
1548
|
+
for (const o of s)
|
|
1549
|
+
o.loadOptions && o.loadOptions(this, e);
|
|
1550
|
+
const r = this._engine.plugins.interactors.get(this._container);
|
|
1551
|
+
if (r)
|
|
1552
|
+
for (const o of r)
|
|
1553
|
+
o.loadParticlesOptions && o.loadParticlesOptions(this, e);
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
function Ue(n, ...e) {
|
|
1558
|
+
for (const t of e)
|
|
1559
|
+
n.load(t);
|
|
1560
|
+
}
|
|
1561
|
+
function Be(n, e, ...t) {
|
|
1562
|
+
const i = new mi(n, e);
|
|
1563
|
+
return Ue(i, ...t), i;
|
|
1564
|
+
}
|
|
1565
|
+
class gi {
|
|
1566
|
+
constructor(e, t) {
|
|
1567
|
+
this._findDefaultTheme = (i) => this.themes.find((s) => s.default.value && s.default.mode === i) ?? this.themes.find((s) => s.default.value && s.default.mode === "any"), this._importPreset = (i) => {
|
|
1568
|
+
this.load(this._engine.plugins.getPreset(i));
|
|
1569
|
+
}, this._engine = e, this._container = t, this.autoPlay = !0, this.background = new Tt(), this.backgroundMask = new It(), this.defaultThemes = {}, this.delay = 0, this.fullScreen = new Et(), this.detectRetina = !0, this.duration = 0, this.fpsLimit = 120, this.interactivity = new Fe(e, t), this.manualParticles = [], this.particles = Be(this._engine, this._container), this.pauseOnBlur = !0, this.pauseOnOutsideViewport = !0, this.responsive = [], this.smooth = !1, this.style = {}, this.themes = [], this.zLayers = 100;
|
|
1570
|
+
}
|
|
1571
|
+
get backgroundMode() {
|
|
1572
|
+
return this.fullScreen;
|
|
1573
|
+
}
|
|
1574
|
+
set backgroundMode(e) {
|
|
1575
|
+
this.fullScreen.load(e);
|
|
1576
|
+
}
|
|
1577
|
+
get fps_limit() {
|
|
1578
|
+
return this.fpsLimit;
|
|
1579
|
+
}
|
|
1580
|
+
set fps_limit(e) {
|
|
1581
|
+
this.fpsLimit = e;
|
|
1582
|
+
}
|
|
1583
|
+
get retina_detect() {
|
|
1584
|
+
return this.detectRetina;
|
|
1585
|
+
}
|
|
1586
|
+
set retina_detect(e) {
|
|
1587
|
+
this.detectRetina = e;
|
|
1588
|
+
}
|
|
1589
|
+
load(e) {
|
|
1590
|
+
if (!e)
|
|
1591
|
+
return;
|
|
1592
|
+
e.preset !== void 0 && E(e.preset, (o) => this._importPreset(o)), e.autoPlay !== void 0 && (this.autoPlay = e.autoPlay), e.delay !== void 0 && (this.delay = p(e.delay));
|
|
1593
|
+
const t = e.detectRetina ?? e.retina_detect;
|
|
1594
|
+
t !== void 0 && (this.detectRetina = t), e.duration !== void 0 && (this.duration = p(e.duration));
|
|
1595
|
+
const i = e.fpsLimit ?? e.fps_limit;
|
|
1596
|
+
i !== void 0 && (this.fpsLimit = i), e.pauseOnBlur !== void 0 && (this.pauseOnBlur = e.pauseOnBlur), e.pauseOnOutsideViewport !== void 0 && (this.pauseOnOutsideViewport = e.pauseOnOutsideViewport), e.zLayers !== void 0 && (this.zLayers = e.zLayers), this.background.load(e.background);
|
|
1597
|
+
const s = e.fullScreen ?? e.backgroundMode;
|
|
1598
|
+
R(s) ? this.fullScreen.enable = s : this.fullScreen.load(s), this.backgroundMask.load(e.backgroundMask), this.interactivity.load(e.interactivity), e.manualParticles && (this.manualParticles = e.manualParticles.map((o) => {
|
|
1599
|
+
const a = new Ut();
|
|
1600
|
+
return a.load(o), a;
|
|
1601
|
+
})), this.particles.load(e.particles), this.style = x(this.style, e.style), this._engine.plugins.loadOptions(this, e), e.smooth !== void 0 && (this.smooth = e.smooth);
|
|
1602
|
+
const r = this._engine.plugins.interactors.get(this._container);
|
|
1603
|
+
if (r)
|
|
1604
|
+
for (const o of r)
|
|
1605
|
+
o.loadOptions && o.loadOptions(this, e);
|
|
1606
|
+
if (e.responsive !== void 0)
|
|
1607
|
+
for (const o of e.responsive) {
|
|
1608
|
+
const a = new Bt();
|
|
1609
|
+
a.load(o), this.responsive.push(a);
|
|
1610
|
+
}
|
|
1611
|
+
if (this.responsive.sort((o, a) => o.maxWidth - a.maxWidth), e.themes !== void 0)
|
|
1612
|
+
for (const o of e.themes) {
|
|
1613
|
+
const a = this.themes.find((h) => h.name === o.name);
|
|
1614
|
+
if (a)
|
|
1615
|
+
a.load(o);
|
|
1616
|
+
else {
|
|
1617
|
+
const h = new $t();
|
|
1618
|
+
h.load(o), this.themes.push(h);
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1621
|
+
this.defaultThemes.dark = this._findDefaultTheme("dark")?.name, this.defaultThemes.light = this._findDefaultTheme("light")?.name;
|
|
1622
|
+
}
|
|
1623
|
+
setResponsive(e, t, i) {
|
|
1624
|
+
this.load(i);
|
|
1625
|
+
const s = this.responsive.find((r) => r.mode === "screen" && screen ? r.maxWidth > screen.availWidth : r.maxWidth * t > e);
|
|
1626
|
+
return this.load(s?.options), s?.maxWidth;
|
|
1627
|
+
}
|
|
1628
|
+
setTheme(e) {
|
|
1629
|
+
if (e) {
|
|
1630
|
+
const t = this.themes.find((i) => i.name === e);
|
|
1631
|
+
t && this.load(t.options);
|
|
1632
|
+
} else {
|
|
1633
|
+
const t = Ee("(prefers-color-scheme: dark)"), i = t && t.matches, s = this._findDefaultTheme(i ? "dark" : "light");
|
|
1634
|
+
s && this.load(s.options);
|
|
1635
|
+
}
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
class yi {
|
|
1639
|
+
constructor(e, t) {
|
|
1640
|
+
this.container = t, this._engine = e, this._interactors = e.plugins.getInteractors(this.container, !0), this._externalInteractors = [], this._particleInteractors = [];
|
|
1641
|
+
}
|
|
1642
|
+
async externalInteract(e) {
|
|
1643
|
+
for (const t of this._externalInteractors)
|
|
1644
|
+
t.isEnabled() && await t.interact(e);
|
|
1645
|
+
}
|
|
1646
|
+
handleClickMode(e) {
|
|
1647
|
+
for (const t of this._externalInteractors)
|
|
1648
|
+
t.handleClickMode && t.handleClickMode(e);
|
|
1649
|
+
}
|
|
1650
|
+
init() {
|
|
1651
|
+
this._externalInteractors = [], this._particleInteractors = [];
|
|
1652
|
+
for (const e of this._interactors) {
|
|
1653
|
+
switch (e.type) {
|
|
1654
|
+
case "external":
|
|
1655
|
+
this._externalInteractors.push(e);
|
|
1656
|
+
break;
|
|
1657
|
+
case "particles":
|
|
1658
|
+
this._particleInteractors.push(e);
|
|
1659
|
+
break;
|
|
1660
|
+
}
|
|
1661
|
+
e.init();
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
async particlesInteract(e, t) {
|
|
1665
|
+
for (const i of this._externalInteractors)
|
|
1666
|
+
i.clear(e, t);
|
|
1667
|
+
for (const i of this._particleInteractors)
|
|
1668
|
+
i.isEnabled(e) && await i.interact(e, t);
|
|
1669
|
+
}
|
|
1670
|
+
async reset(e) {
|
|
1671
|
+
for (const t of this._externalInteractors)
|
|
1672
|
+
t.isEnabled() && t.reset(e);
|
|
1673
|
+
for (const t of this._particleInteractors)
|
|
1674
|
+
t.isEnabled(e) && t.reset(e);
|
|
1675
|
+
}
|
|
1676
|
+
}
|
|
1677
|
+
const Ce = (n) => {
|
|
1678
|
+
if (!lt(n.outMode, n.checkModes))
|
|
1679
|
+
return;
|
|
1680
|
+
const e = n.radius * 2;
|
|
1681
|
+
n.coord > n.maxCoord - e ? n.setCb(-n.radius) : n.coord < e && n.setCb(n.radius);
|
|
1682
|
+
};
|
|
1683
|
+
class vi {
|
|
1684
|
+
constructor(e, t, i, s, r, o) {
|
|
1685
|
+
this.container = i, this._calcPosition = (a, h, l, c = 0) => {
|
|
1686
|
+
for (const [, z] of a.plugins) {
|
|
1687
|
+
const w = z.particlePosition !== void 0 ? z.particlePosition(h, this) : void 0;
|
|
1688
|
+
if (w)
|
|
1689
|
+
return M.create(w.x, w.y, l);
|
|
1690
|
+
}
|
|
1691
|
+
const u = a.canvas.size, f = rt({
|
|
1692
|
+
size: u,
|
|
1693
|
+
position: h
|
|
1694
|
+
}), d = M.create(f.x, f.y, l), y = this.getRadius(), m = this.options.move.outModes, b = (z) => {
|
|
1695
|
+
Ce({
|
|
1696
|
+
outMode: z,
|
|
1697
|
+
checkModes: ["bounce", "bounce-horizontal"],
|
|
1698
|
+
coord: d.x,
|
|
1699
|
+
maxCoord: a.canvas.size.width,
|
|
1700
|
+
setCb: (w) => d.x += w,
|
|
1701
|
+
radius: y
|
|
1702
|
+
});
|
|
1703
|
+
}, _ = (z) => {
|
|
1704
|
+
Ce({
|
|
1705
|
+
outMode: z,
|
|
1706
|
+
checkModes: ["bounce", "bounce-vertical"],
|
|
1707
|
+
coord: d.y,
|
|
1708
|
+
maxCoord: a.canvas.size.height,
|
|
1709
|
+
setCb: (w) => d.y += w,
|
|
1710
|
+
radius: y
|
|
1711
|
+
});
|
|
1712
|
+
};
|
|
1713
|
+
return b(m.left ?? m.default), b(m.right ?? m.default), _(m.top ?? m.default), _(m.bottom ?? m.default), this._checkOverlap(d, c) ? this._calcPosition(a, void 0, l, c + 1) : d;
|
|
1714
|
+
}, this._calculateVelocity = () => {
|
|
1715
|
+
const a = nt(this.direction), h = a.copy(), l = this.options.move;
|
|
1716
|
+
if (l.direction === "inside" || l.direction === "outside")
|
|
1717
|
+
return h;
|
|
1718
|
+
const c = Math.PI / 180 * g(l.angle.value), u = Math.PI / 180 * g(l.angle.offset), f = {
|
|
1719
|
+
left: u - c / 2,
|
|
1720
|
+
right: u + c / 2
|
|
1721
|
+
};
|
|
1722
|
+
return l.straight || (h.angle += F(p(f.left, f.right))), l.random && typeof l.speed == "number" && (h.length *= T()), h;
|
|
1723
|
+
}, this._checkOverlap = (a, h = 0) => {
|
|
1724
|
+
const l = this.options.collisions, c = this.getRadius();
|
|
1725
|
+
if (!l.enable)
|
|
1726
|
+
return !1;
|
|
1727
|
+
const u = l.overlap;
|
|
1728
|
+
if (u.enable)
|
|
1729
|
+
return !1;
|
|
1730
|
+
const f = u.retries;
|
|
1731
|
+
if (f >= 0 && h > f)
|
|
1732
|
+
throw new Error(`${I} particle is overlapping and can't be placed`);
|
|
1733
|
+
return !!this.container.particles.find((d) => fe(a, d.position) < c + d.getRadius());
|
|
1734
|
+
}, this._getRollColor = (a) => {
|
|
1735
|
+
if (!a || !this.roll || !this.backColor && !this.roll.alter)
|
|
1736
|
+
return a;
|
|
1737
|
+
const h = this.roll.horizontal && this.roll.vertical ? 2 : 1, l = this.roll.horizontal ? Math.PI / 2 : 0;
|
|
1738
|
+
return Math.floor(((this.roll.angle ?? 0) + l) / (Math.PI / h)) % 2 ? this.backColor ? this.backColor : this.roll.alter ? kt(a, this.roll.alter.type, this.roll.alter.value) : a : a;
|
|
1739
|
+
}, this._initPosition = (a) => {
|
|
1740
|
+
const h = this.container, l = g(this.options.zIndex.value);
|
|
1741
|
+
this.position = this._calcPosition(h, a, Re(l, 0, h.zLayers)), this.initialPosition = this.position.copy();
|
|
1742
|
+
const c = h.canvas.size;
|
|
1743
|
+
switch (this.moveCenter = {
|
|
1744
|
+
...De(this.options.move.center, c),
|
|
1745
|
+
radius: this.options.move.center.radius ?? 0,
|
|
1746
|
+
mode: this.options.move.center.mode ?? "percent"
|
|
1747
|
+
}, this.direction = st(this.options.move.direction, this.position, this.moveCenter), this.options.move.direction) {
|
|
1748
|
+
case "inside":
|
|
1749
|
+
this.outType = "inside";
|
|
1750
|
+
break;
|
|
1751
|
+
case "outside":
|
|
1752
|
+
this.outType = "outside";
|
|
1753
|
+
break;
|
|
1754
|
+
}
|
|
1755
|
+
this.offset = L.origin;
|
|
1756
|
+
}, this._loadShapeData = (a, h) => {
|
|
1757
|
+
const l = a.options[this.shape];
|
|
1758
|
+
if (l)
|
|
1759
|
+
return x({
|
|
1760
|
+
close: a.close,
|
|
1761
|
+
fill: a.fill
|
|
1762
|
+
}, W(l, this.id, h));
|
|
1763
|
+
}, this._engine = e, this.init(t, s, r, o);
|
|
1764
|
+
}
|
|
1765
|
+
destroy(e) {
|
|
1766
|
+
if (this.unbreakable || this.destroyed)
|
|
1767
|
+
return;
|
|
1768
|
+
this.destroyed = !0, this.bubble.inRange = !1, this.slow.inRange = !1;
|
|
1769
|
+
const t = this.container, i = this.pathGenerator;
|
|
1770
|
+
for (const [, s] of t.plugins)
|
|
1771
|
+
s.particleDestroyed && s.particleDestroyed(this, e);
|
|
1772
|
+
for (const s of t.particles.updaters)
|
|
1773
|
+
s.particleDestroyed && s.particleDestroyed(this, e);
|
|
1774
|
+
i && i.reset(this);
|
|
1775
|
+
}
|
|
1776
|
+
draw(e) {
|
|
1777
|
+
const t = this.container;
|
|
1778
|
+
for (const [, i] of t.plugins)
|
|
1779
|
+
t.canvas.drawParticlePlugin(i, this, e);
|
|
1780
|
+
t.canvas.drawParticle(this, e);
|
|
1781
|
+
}
|
|
1782
|
+
getFillColor() {
|
|
1783
|
+
return this._getRollColor(this.bubble.color ?? ze(this.color));
|
|
1784
|
+
}
|
|
1785
|
+
getMass() {
|
|
1786
|
+
return this.getRadius() ** 2 * Math.PI / 2;
|
|
1787
|
+
}
|
|
1788
|
+
getPosition() {
|
|
1789
|
+
return {
|
|
1790
|
+
x: this.position.x + this.offset.x,
|
|
1791
|
+
y: this.position.y + this.offset.y,
|
|
1792
|
+
z: this.position.z
|
|
1793
|
+
};
|
|
1794
|
+
}
|
|
1795
|
+
getRadius() {
|
|
1796
|
+
return this.bubble.radius ?? this.size.value;
|
|
1797
|
+
}
|
|
1798
|
+
getStrokeColor() {
|
|
1799
|
+
return this._getRollColor(this.bubble.color ?? ze(this.strokeColor));
|
|
1800
|
+
}
|
|
1801
|
+
init(e, t, i, s) {
|
|
1802
|
+
const r = this.container, o = this._engine;
|
|
1803
|
+
this.id = e, this.group = s, this.fill = !0, this.pathRotation = !1, this.close = !0, this.lastPathTime = 0, this.destroyed = !1, this.unbreakable = !1, this.rotation = 0, this.misplaced = !1, this.retina = {
|
|
1804
|
+
maxDistance: {}
|
|
1805
|
+
}, this.outType = "normal", this.ignoresResizeRatio = !0;
|
|
1806
|
+
const a = r.retina.pixelRatio, h = r.actualOptions, l = Be(this._engine, r, h.particles), c = l.shape.type, { reduceDuplicates: u } = l;
|
|
1807
|
+
this.shape = W(c, this.id, u);
|
|
1808
|
+
const f = l.shape;
|
|
1809
|
+
if (i && i.shape && i.shape.type) {
|
|
1810
|
+
const w = i.shape.type, me = W(w, this.id, u);
|
|
1811
|
+
me && (this.shape = me, f.load(i.shape));
|
|
1812
|
+
}
|
|
1813
|
+
this.shapeData = this._loadShapeData(f, u), l.load(i);
|
|
1814
|
+
const d = this.shapeData;
|
|
1815
|
+
d && l.load(d.particles);
|
|
1816
|
+
const y = new Fe(o, r);
|
|
1817
|
+
y.load(r.actualOptions.interactivity), y.load(l.interactivity), this.interactivity = y, this.fill = d?.fill ?? l.shape.fill, this.close = d?.close ?? l.shape.close, this.options = l;
|
|
1818
|
+
const m = this.options.move.path;
|
|
1819
|
+
this.pathDelay = tt(m.delay) * 1e3, m.generator && (this.pathGenerator = this._engine.plugins.getPathGenerator(m.generator), this.pathGenerator && r.addPath(m.generator, this.pathGenerator) && this.pathGenerator.init(r)), r.retina.initParticle(this), this.size = ut(this.options.size, a), this.bubble = {
|
|
1820
|
+
inRange: !1
|
|
1821
|
+
}, this.slow = {
|
|
1822
|
+
inRange: !1,
|
|
1823
|
+
factor: 1
|
|
1824
|
+
}, this._initPosition(t), this.initialVelocity = this._calculateVelocity(), this.velocity = this.initialVelocity.copy(), this.moveDecay = 1 - g(this.options.move.decay);
|
|
1825
|
+
const b = r.particles;
|
|
1826
|
+
b.needsSort = b.needsSort || b.lastZIndex < this.position.z, b.lastZIndex = this.position.z, this.zIndexFactor = this.position.z / r.zLayers, this.sides = 24;
|
|
1827
|
+
let _ = r.drawers.get(this.shape);
|
|
1828
|
+
_ || (_ = this._engine.plugins.getShapeDrawer(this.shape), _ && r.drawers.set(this.shape, _)), _ && _.loadShape && _.loadShape(this);
|
|
1829
|
+
const z = _?.getSidesCount;
|
|
1830
|
+
z && (this.sides = z(this)), this.spawning = !1, this.shadowColor = V(this.options.shadow.color);
|
|
1831
|
+
for (const w of r.particles.updaters)
|
|
1832
|
+
w.init(this);
|
|
1833
|
+
for (const w of r.particles.movers)
|
|
1834
|
+
w.init && w.init(this);
|
|
1835
|
+
_ && _.particleInit && _.particleInit(r, this);
|
|
1836
|
+
for (const [, w] of r.plugins)
|
|
1837
|
+
w.particleCreated && w.particleCreated(this);
|
|
1838
|
+
}
|
|
1839
|
+
isInsideCanvas() {
|
|
1840
|
+
const e = this.getRadius(), t = this.container.canvas.size, i = this.position;
|
|
1841
|
+
return i.x >= -e && i.y >= -e && i.y <= t.height + e && i.x <= t.width + e;
|
|
1842
|
+
}
|
|
1843
|
+
isVisible() {
|
|
1844
|
+
return !this.destroyed && !this.spawning && this.isInsideCanvas();
|
|
1845
|
+
}
|
|
1846
|
+
reset() {
|
|
1847
|
+
for (const e of this.container.particles.updaters)
|
|
1848
|
+
e.reset && e.reset(this);
|
|
1849
|
+
}
|
|
1850
|
+
}
|
|
1851
|
+
class _i {
|
|
1852
|
+
constructor(e, t) {
|
|
1853
|
+
this.position = e, this.particle = t;
|
|
1854
|
+
}
|
|
1855
|
+
}
|
|
1856
|
+
class We {
|
|
1857
|
+
constructor(e, t) {
|
|
1858
|
+
this.position = {
|
|
1859
|
+
x: e,
|
|
1860
|
+
y: t
|
|
1861
|
+
};
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1864
|
+
class H extends We {
|
|
1865
|
+
constructor(e, t, i, s) {
|
|
1866
|
+
super(e, t), this.size = {
|
|
1867
|
+
height: s,
|
|
1868
|
+
width: i
|
|
1869
|
+
};
|
|
1870
|
+
}
|
|
1871
|
+
contains(e) {
|
|
1872
|
+
const t = this.size.width, i = this.size.height, s = this.position;
|
|
1873
|
+
return e.x >= s.x && e.x <= s.x + t && e.y >= s.y && e.y <= s.y + i;
|
|
1874
|
+
}
|
|
1875
|
+
intersects(e) {
|
|
1876
|
+
e instanceof J && e.intersects(this);
|
|
1877
|
+
const t = this.size.width, i = this.size.height, s = this.position, r = e.position, o = e instanceof H ? e.size : { width: 0, height: 0 }, a = o.width, h = o.height;
|
|
1878
|
+
return r.x < s.x + t && r.x + a > s.x && r.y < s.y + i && r.y + h > s.y;
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
class J extends We {
|
|
1882
|
+
constructor(e, t, i) {
|
|
1883
|
+
super(e, t), this.radius = i;
|
|
1884
|
+
}
|
|
1885
|
+
contains(e) {
|
|
1886
|
+
return fe(e, this.position) <= this.radius;
|
|
1887
|
+
}
|
|
1888
|
+
intersects(e) {
|
|
1889
|
+
const t = this.position, i = e.position, s = { x: Math.abs(i.x - t.x), y: Math.abs(i.y - t.y) }, r = this.radius;
|
|
1890
|
+
if (e instanceof J) {
|
|
1891
|
+
const o = r + e.radius, a = Math.sqrt(s.x ** 2 + s.y ** 2);
|
|
1892
|
+
return o > a;
|
|
1893
|
+
} else if (e instanceof H) {
|
|
1894
|
+
const { width: o, height: a } = e.size;
|
|
1895
|
+
return Math.pow(s.x - o, 2) + Math.pow(s.y - a, 2) <= r ** 2 || s.x <= r + o && s.y <= r + a || s.x <= o || s.y <= a;
|
|
1896
|
+
}
|
|
1897
|
+
return !1;
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
class X {
|
|
1901
|
+
constructor(e, t) {
|
|
1902
|
+
this.rectangle = e, this.capacity = t, this._subdivide = () => {
|
|
1903
|
+
const { x: i, y: s } = this.rectangle.position, { width: r, height: o } = this.rectangle.size, { capacity: a } = this;
|
|
1904
|
+
for (let h = 0; h < 4; h++)
|
|
1905
|
+
this._subs.push(new X(new H(i + r / 2 * (h % 2), s + o / 2 * (Math.round(h / 2) - h % 2), r / 2, o / 2), a));
|
|
1906
|
+
this._divided = !0;
|
|
1907
|
+
}, this._points = [], this._divided = !1, this._subs = [];
|
|
1908
|
+
}
|
|
1909
|
+
insert(e) {
|
|
1910
|
+
return this.rectangle.contains(e.position) ? this._points.length < this.capacity ? (this._points.push(e), !0) : (this._divided || this._subdivide(), this._subs.some((t) => t.insert(e))) : !1;
|
|
1911
|
+
}
|
|
1912
|
+
query(e, t, i) {
|
|
1913
|
+
const s = i || [];
|
|
1914
|
+
if (!e.intersects(this.rectangle))
|
|
1915
|
+
return [];
|
|
1916
|
+
for (const r of this._points)
|
|
1917
|
+
!e.contains(r.position) && fe(e.position, r.position) > r.particle.getRadius() && (!t || t(r.particle)) || s.push(r.particle);
|
|
1918
|
+
if (this._divided)
|
|
1919
|
+
for (const r of this._subs)
|
|
1920
|
+
r.query(e, t, s);
|
|
1921
|
+
return s;
|
|
1922
|
+
}
|
|
1923
|
+
queryCircle(e, t, i) {
|
|
1924
|
+
return this.query(new J(e.x, e.y, t), i);
|
|
1925
|
+
}
|
|
1926
|
+
queryRectangle(e, t, i) {
|
|
1927
|
+
return this.query(new H(e.x, e.y, t.width, t.height), i);
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1930
|
+
const Se = 4, Oe = (n) => new H(-n.width / 4, -n.height / 4, n.width * 3 / 2, n.height * 3 / 2);
|
|
1931
|
+
let wi = class {
|
|
1932
|
+
constructor(e, t) {
|
|
1933
|
+
this._applyDensity = (s, r, o) => {
|
|
1934
|
+
if (!s.number.density?.enable)
|
|
1935
|
+
return;
|
|
1936
|
+
const a = s.number, h = this._initDensityFactor(a.density), l = a.value, c = a.limit > 0 ? a.limit : l, u = Math.min(l, c) * h + r, f = Math.min(this.count, this.filter((d) => d.group === o).length);
|
|
1937
|
+
this.limit = a.limit * h, f < u ? this.push(Math.abs(u - f), void 0, s, o) : f > u && this.removeQuantity(f - u, o);
|
|
1938
|
+
}, this._initDensityFactor = (s) => {
|
|
1939
|
+
const r = this._container;
|
|
1940
|
+
if (!r.canvas.element || !s.enable)
|
|
1941
|
+
return 1;
|
|
1942
|
+
const o = r.canvas.element, a = r.retina.pixelRatio;
|
|
1943
|
+
return o.width * o.height / (s.factor * a ** 2 * s.area);
|
|
1944
|
+
}, this._pushParticle = (s, r, o, a) => {
|
|
1945
|
+
try {
|
|
1946
|
+
let h = this.pool.pop();
|
|
1947
|
+
h ? h.init(this._nextId, s, r, o) : h = new vi(this._engine, this._nextId, this._container, s, r, o);
|
|
1948
|
+
let l = !0;
|
|
1949
|
+
return a && (l = a(h)), l ? (this._array.push(h), this._zArray.push(h), this._nextId++, this._engine.dispatchEvent("particleAdded", {
|
|
1950
|
+
container: this._container,
|
|
1951
|
+
data: {
|
|
1952
|
+
particle: h
|
|
1953
|
+
}
|
|
1954
|
+
}), h) : void 0;
|
|
1955
|
+
} catch (h) {
|
|
1956
|
+
$().warning(`${I} adding particle: ${h}`);
|
|
1957
|
+
return;
|
|
1958
|
+
}
|
|
1959
|
+
}, this._removeParticle = (s, r, o) => {
|
|
1960
|
+
const a = this._array[s];
|
|
1961
|
+
if (!a || a.group !== r)
|
|
1962
|
+
return !1;
|
|
1963
|
+
a.destroy(o);
|
|
1964
|
+
const h = this._zArray.indexOf(a);
|
|
1965
|
+
return this._array.splice(s, 1), this._zArray.splice(h, 1), this.pool.push(a), this._engine.dispatchEvent("particleRemoved", {
|
|
1966
|
+
container: this._container,
|
|
1967
|
+
data: {
|
|
1968
|
+
particle: a
|
|
1969
|
+
}
|
|
1970
|
+
}), !0;
|
|
1971
|
+
}, this._engine = e, this._container = t, this._nextId = 0, this._array = [], this._zArray = [], this.pool = [], this.limit = 0, this.needsSort = !1, this.lastZIndex = 0, this._interactionManager = new yi(e, t);
|
|
1972
|
+
const i = t.canvas.size;
|
|
1973
|
+
this.quadTree = new X(Oe(i), Se), this.movers = this._engine.plugins.getMovers(t, !0), this.updaters = this._engine.plugins.getUpdaters(t, !0);
|
|
1974
|
+
}
|
|
1975
|
+
get count() {
|
|
1976
|
+
return this._array.length;
|
|
1977
|
+
}
|
|
1978
|
+
addManualParticles() {
|
|
1979
|
+
const e = this._container, t = e.actualOptions;
|
|
1980
|
+
for (const i of t.manualParticles)
|
|
1981
|
+
this.addParticle(i.position ? De(i.position, e.canvas.size) : void 0, i.options);
|
|
1982
|
+
}
|
|
1983
|
+
addParticle(e, t, i, s) {
|
|
1984
|
+
const r = this._container, o = r.actualOptions, a = o.particles.number.limit;
|
|
1985
|
+
if (a > 0) {
|
|
1986
|
+
const h = this.count + 1 - a;
|
|
1987
|
+
h > 0 && this.removeQuantity(h);
|
|
1988
|
+
}
|
|
1989
|
+
return this._pushParticle(e, t, i, s);
|
|
1990
|
+
}
|
|
1991
|
+
clear() {
|
|
1992
|
+
this._array = [], this._zArray = [];
|
|
1993
|
+
}
|
|
1994
|
+
destroy() {
|
|
1995
|
+
this._array = [], this._zArray = [], this.movers = [], this.updaters = [];
|
|
1996
|
+
}
|
|
1997
|
+
async draw(e) {
|
|
1998
|
+
const t = this._container;
|
|
1999
|
+
t.canvas.clear(), await this.update(e);
|
|
2000
|
+
for (const [, i] of t.plugins)
|
|
2001
|
+
t.canvas.drawPlugin(i, e);
|
|
2002
|
+
for (const i of this._zArray)
|
|
2003
|
+
i.draw(e);
|
|
2004
|
+
}
|
|
2005
|
+
filter(e) {
|
|
2006
|
+
return this._array.filter(e);
|
|
2007
|
+
}
|
|
2008
|
+
find(e) {
|
|
2009
|
+
return this._array.find(e);
|
|
2010
|
+
}
|
|
2011
|
+
handleClickMode(e) {
|
|
2012
|
+
this._interactionManager.handleClickMode(e);
|
|
2013
|
+
}
|
|
2014
|
+
init() {
|
|
2015
|
+
const e = this._container, t = e.actualOptions;
|
|
2016
|
+
this.lastZIndex = 0, this.needsSort = !1;
|
|
2017
|
+
let i = !1;
|
|
2018
|
+
this.updaters = this._engine.plugins.getUpdaters(e, !0), this._interactionManager.init();
|
|
2019
|
+
for (const [, s] of e.plugins)
|
|
2020
|
+
if (s.particlesInitialization !== void 0 && (i = s.particlesInitialization()), i)
|
|
2021
|
+
break;
|
|
2022
|
+
this._interactionManager.init();
|
|
2023
|
+
for (const [, s] of e.pathGenerators)
|
|
2024
|
+
s.init(e);
|
|
2025
|
+
if (this.addManualParticles(), !i) {
|
|
2026
|
+
for (const s in t.particles.groups) {
|
|
2027
|
+
const r = t.particles.groups[s];
|
|
2028
|
+
for (let o = this.count, a = 0; a < r.number?.value && o < t.particles.number.value; o++, a++)
|
|
2029
|
+
this.addParticle(void 0, r, s);
|
|
2030
|
+
}
|
|
2031
|
+
for (let s = this.count; s < t.particles.number.value; s++)
|
|
2032
|
+
this.addParticle();
|
|
2033
|
+
}
|
|
2034
|
+
}
|
|
2035
|
+
push(e, t, i, s) {
|
|
2036
|
+
this.pushing = !0;
|
|
2037
|
+
for (let r = 0; r < e; r++)
|
|
2038
|
+
this.addParticle(t?.position, i, s);
|
|
2039
|
+
this.pushing = !1;
|
|
2040
|
+
}
|
|
2041
|
+
async redraw() {
|
|
2042
|
+
this.clear(), this.init(), await this.draw({ value: 0, factor: 0 });
|
|
2043
|
+
}
|
|
2044
|
+
remove(e, t, i) {
|
|
2045
|
+
this.removeAt(this._array.indexOf(e), void 0, t, i);
|
|
2046
|
+
}
|
|
2047
|
+
removeAt(e, t = 1, i, s) {
|
|
2048
|
+
if (e < 0 || e > this.count)
|
|
2049
|
+
return;
|
|
2050
|
+
let r = 0;
|
|
2051
|
+
for (let o = e; r < t && o < this.count; o++)
|
|
2052
|
+
this._removeParticle(o--, i, s) && r++;
|
|
2053
|
+
}
|
|
2054
|
+
removeQuantity(e, t) {
|
|
2055
|
+
this.removeAt(0, e, t);
|
|
2056
|
+
}
|
|
2057
|
+
setDensity() {
|
|
2058
|
+
const e = this._container.actualOptions, t = e.particles.groups;
|
|
2059
|
+
for (const i in t)
|
|
2060
|
+
this._applyDensity(t[i], 0, i);
|
|
2061
|
+
this._applyDensity(e.particles, e.manualParticles.length);
|
|
2062
|
+
}
|
|
2063
|
+
async update(e) {
|
|
2064
|
+
const t = this._container, i = /* @__PURE__ */ new Set();
|
|
2065
|
+
this.quadTree = new X(Oe(t.canvas.size), Se);
|
|
2066
|
+
for (const [, s] of t.pathGenerators)
|
|
2067
|
+
s.update();
|
|
2068
|
+
for (const [, s] of t.plugins)
|
|
2069
|
+
s.update && s.update(e);
|
|
2070
|
+
for (const s of this._array) {
|
|
2071
|
+
const r = t.canvas.resizeFactor;
|
|
2072
|
+
r && !s.ignoresResizeRatio && (s.position.x *= r.width, s.position.y *= r.height, s.initialPosition.x *= r.width, s.initialPosition.y *= r.height), s.ignoresResizeRatio = !1, await this._interactionManager.reset(s);
|
|
2073
|
+
for (const [, o] of this._container.plugins) {
|
|
2074
|
+
if (s.destroyed)
|
|
2075
|
+
break;
|
|
2076
|
+
o.particleUpdate && o.particleUpdate(s, e);
|
|
2077
|
+
}
|
|
2078
|
+
for (const o of this.movers)
|
|
2079
|
+
o.isEnabled(s) && o.move(s, e);
|
|
2080
|
+
if (s.destroyed) {
|
|
2081
|
+
i.add(s);
|
|
2082
|
+
continue;
|
|
2083
|
+
}
|
|
2084
|
+
this.quadTree.insert(new _i(s.getPosition(), s));
|
|
2085
|
+
}
|
|
2086
|
+
if (i.size) {
|
|
2087
|
+
const s = (r) => !i.has(r);
|
|
2088
|
+
this._array = this.filter(s), this._zArray = this._zArray.filter(s), this.pool.push(...i);
|
|
2089
|
+
}
|
|
2090
|
+
await this._interactionManager.externalInteract(e);
|
|
2091
|
+
for (const s of this._array) {
|
|
2092
|
+
for (const r of this.updaters)
|
|
2093
|
+
r.update(s, e);
|
|
2094
|
+
!s.destroyed && !s.spawning && await this._interactionManager.particlesInteract(s, e);
|
|
2095
|
+
}
|
|
2096
|
+
if (delete t.canvas.resizeFactor, this.needsSort) {
|
|
2097
|
+
const s = this._zArray;
|
|
2098
|
+
s.sort((r, o) => o.position.z - r.position.z || r.id - o.id), this.lastZIndex = s[s.length - 1].position.z, this.needsSort = !1;
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2101
|
+
};
|
|
2102
|
+
class bi {
|
|
2103
|
+
constructor(e) {
|
|
2104
|
+
this.container = e, this.pixelRatio = 1, this.reduceFactor = 1;
|
|
2105
|
+
}
|
|
2106
|
+
init() {
|
|
2107
|
+
const e = this.container, t = e.actualOptions;
|
|
2108
|
+
this.pixelRatio = !t.detectRetina || Z() ? 1 : window.devicePixelRatio, this.reduceFactor = 1;
|
|
2109
|
+
const i = this.pixelRatio;
|
|
2110
|
+
if (e.canvas.element) {
|
|
2111
|
+
const o = e.canvas.element;
|
|
2112
|
+
e.canvas.size.width = o.offsetWidth * i, e.canvas.size.height = o.offsetHeight * i;
|
|
2113
|
+
}
|
|
2114
|
+
const s = t.particles, r = s.move;
|
|
2115
|
+
this.attractDistance = g(r.attract.distance) * i, this.maxSpeed = g(r.gravity.maxSpeed) * i, this.sizeAnimationSpeed = g(s.size.animation.speed) * i;
|
|
2116
|
+
}
|
|
2117
|
+
initParticle(e) {
|
|
2118
|
+
const t = e.options, i = this.pixelRatio, s = t.move, r = s.distance, o = e.retina;
|
|
2119
|
+
o.attractDistance = g(s.attract.distance) * i, o.moveDrift = g(s.drift) * i, o.moveSpeed = g(s.speed) * i, o.sizeAnimationSpeed = g(t.size.animation.speed) * i;
|
|
2120
|
+
const a = o.maxDistance;
|
|
2121
|
+
a.horizontal = r.horizontal !== void 0 ? r.horizontal * i : void 0, a.vertical = r.vertical !== void 0 ? r.vertical * i : void 0, o.maxSpeed = g(s.gravity.maxSpeed) * i;
|
|
2122
|
+
}
|
|
2123
|
+
}
|
|
2124
|
+
function v(n) {
|
|
2125
|
+
return n && !n.destroyed;
|
|
2126
|
+
}
|
|
2127
|
+
function xi(n, e = 60, t = !1) {
|
|
2128
|
+
return {
|
|
2129
|
+
value: n,
|
|
2130
|
+
factor: t ? 60 / e : 60 * n / 1e3
|
|
2131
|
+
};
|
|
2132
|
+
}
|
|
2133
|
+
function D(n, e, ...t) {
|
|
2134
|
+
const i = new gi(n, e);
|
|
2135
|
+
return Ue(i, ...t), i;
|
|
2136
|
+
}
|
|
2137
|
+
const zi = "default", Te = {
|
|
2138
|
+
generate: (n) => n.velocity,
|
|
2139
|
+
init: () => {
|
|
2140
|
+
},
|
|
2141
|
+
update: () => {
|
|
2142
|
+
},
|
|
2143
|
+
reset: () => {
|
|
2144
|
+
}
|
|
2145
|
+
};
|
|
2146
|
+
class Mi {
|
|
2147
|
+
constructor(e, t, i) {
|
|
2148
|
+
this.id = t, this._intersectionManager = (s) => {
|
|
2149
|
+
if (!(!v(this) || !this.actualOptions.pauseOnOutsideViewport))
|
|
2150
|
+
for (const r of s)
|
|
2151
|
+
r.target === this.interactivity.element && (r.isIntersecting ? this.play : this.pause)();
|
|
2152
|
+
}, this._nextFrame = async (s) => {
|
|
2153
|
+
try {
|
|
2154
|
+
if (!this.smooth && this.lastFrameTime !== void 0 && s < this.lastFrameTime + 1e3 / this.fpsLimit) {
|
|
2155
|
+
this.draw(!1);
|
|
2156
|
+
return;
|
|
2157
|
+
}
|
|
2158
|
+
this.lastFrameTime ??= s;
|
|
2159
|
+
const r = xi(s - this.lastFrameTime, this.fpsLimit, this.smooth);
|
|
2160
|
+
if (this.addLifeTime(r.value), this.lastFrameTime = s, r.value > 1e3) {
|
|
2161
|
+
this.draw(!1);
|
|
2162
|
+
return;
|
|
2163
|
+
}
|
|
2164
|
+
if (await this.particles.draw(r), !this.alive()) {
|
|
2165
|
+
this.destroy();
|
|
2166
|
+
return;
|
|
2167
|
+
}
|
|
2168
|
+
this.getAnimationStatus() && this.draw(!1);
|
|
2169
|
+
} catch (r) {
|
|
2170
|
+
$().error(`${I} in animation loop`, r);
|
|
2171
|
+
}
|
|
2172
|
+
}, this._engine = e, this.fpsLimit = 120, this.smooth = !1, this._delay = 0, this._duration = 0, this._lifeTime = 0, this._firstStart = !0, this.started = !1, this.destroyed = !1, this._paused = !0, this.lastFrameTime = 0, this.zLayers = 100, this.pageHidden = !1, this._sourceOptions = i, this._initialSourceOptions = i, this.retina = new bi(this), this.canvas = new St(this), this.particles = new wi(this._engine, this), this.pathGenerators = /* @__PURE__ */ new Map(), this.interactivity = {
|
|
2173
|
+
mouse: {
|
|
2174
|
+
clicking: !1,
|
|
2175
|
+
inside: !1
|
|
2176
|
+
}
|
|
2177
|
+
}, this.plugins = /* @__PURE__ */ new Map(), this.drawers = /* @__PURE__ */ new Map(), this._options = D(this._engine, this), this.actualOptions = D(this._engine, this), this._eventListeners = new Ot(this), typeof IntersectionObserver < "u" && IntersectionObserver && (this._intersectionObserver = new IntersectionObserver((s) => this._intersectionManager(s))), this._engine.dispatchEvent("containerBuilt", { container: this });
|
|
2178
|
+
}
|
|
2179
|
+
get options() {
|
|
2180
|
+
return this._options;
|
|
2181
|
+
}
|
|
2182
|
+
get sourceOptions() {
|
|
2183
|
+
return this._sourceOptions;
|
|
2184
|
+
}
|
|
2185
|
+
addClickHandler(e) {
|
|
2186
|
+
if (!v(this))
|
|
2187
|
+
return;
|
|
2188
|
+
const t = this.interactivity.element;
|
|
2189
|
+
if (!t)
|
|
2190
|
+
return;
|
|
2191
|
+
const i = (u, f, d) => {
|
|
2192
|
+
if (!v(this))
|
|
2193
|
+
return;
|
|
2194
|
+
const y = this.retina.pixelRatio, m = {
|
|
2195
|
+
x: f.x * y,
|
|
2196
|
+
y: f.y * y
|
|
2197
|
+
}, b = this.particles.quadTree.queryCircle(m, d * y);
|
|
2198
|
+
e(u, b);
|
|
2199
|
+
}, s = (u) => {
|
|
2200
|
+
if (!v(this))
|
|
2201
|
+
return;
|
|
2202
|
+
const f = u, d = {
|
|
2203
|
+
x: f.offsetX || f.clientX,
|
|
2204
|
+
y: f.offsetY || f.clientY
|
|
2205
|
+
};
|
|
2206
|
+
i(u, d, 1);
|
|
2207
|
+
}, r = () => {
|
|
2208
|
+
v(this) && (l = !0, c = !1);
|
|
2209
|
+
}, o = () => {
|
|
2210
|
+
v(this) && (c = !0);
|
|
2211
|
+
}, a = (u) => {
|
|
2212
|
+
if (v(this)) {
|
|
2213
|
+
if (l && !c) {
|
|
2214
|
+
const f = u;
|
|
2215
|
+
let d = f.touches[f.touches.length - 1];
|
|
2216
|
+
if (!d && (d = f.changedTouches[f.changedTouches.length - 1], !d))
|
|
2217
|
+
return;
|
|
2218
|
+
const y = this.canvas.element, m = y ? y.getBoundingClientRect() : void 0, b = {
|
|
2219
|
+
x: d.clientX - (m ? m.left : 0),
|
|
2220
|
+
y: d.clientY - (m ? m.top : 0)
|
|
2221
|
+
};
|
|
2222
|
+
i(u, b, Math.max(d.radiusX, d.radiusY));
|
|
2223
|
+
}
|
|
2224
|
+
l = !1, c = !1;
|
|
2225
|
+
}
|
|
2226
|
+
}, h = () => {
|
|
2227
|
+
v(this) && (l = !1, c = !1);
|
|
2228
|
+
};
|
|
2229
|
+
let l = !1, c = !1;
|
|
2230
|
+
t.addEventListener("click", s), t.addEventListener("touchstart", r), t.addEventListener("touchmove", o), t.addEventListener("touchend", a), t.addEventListener("touchcancel", h);
|
|
2231
|
+
}
|
|
2232
|
+
addLifeTime(e) {
|
|
2233
|
+
this._lifeTime += e;
|
|
2234
|
+
}
|
|
2235
|
+
addPath(e, t, i = !1) {
|
|
2236
|
+
return !v(this) || !i && this.pathGenerators.has(e) ? !1 : (this.pathGenerators.set(e, t ?? Te), !0);
|
|
2237
|
+
}
|
|
2238
|
+
alive() {
|
|
2239
|
+
return !this._duration || this._lifeTime <= this._duration;
|
|
2240
|
+
}
|
|
2241
|
+
destroy() {
|
|
2242
|
+
if (!v(this))
|
|
2243
|
+
return;
|
|
2244
|
+
this.stop(), this.particles.destroy(), this.canvas.destroy();
|
|
2245
|
+
for (const [, i] of this.drawers)
|
|
2246
|
+
i.destroy && i.destroy(this);
|
|
2247
|
+
for (const i of this.drawers.keys())
|
|
2248
|
+
this.drawers.delete(i);
|
|
2249
|
+
this._engine.plugins.destroy(this), this.destroyed = !0;
|
|
2250
|
+
const e = this._engine.dom(), t = e.findIndex((i) => i === this);
|
|
2251
|
+
t >= 0 && e.splice(t, 1), this._engine.dispatchEvent("containerDestroyed", { container: this });
|
|
2252
|
+
}
|
|
2253
|
+
draw(e) {
|
|
2254
|
+
if (!v(this))
|
|
2255
|
+
return;
|
|
2256
|
+
let t = e;
|
|
2257
|
+
this._drawAnimationFrame = requestAnimationFrame(async (i) => {
|
|
2258
|
+
t && (this.lastFrameTime = void 0, t = !1), await this._nextFrame(i);
|
|
2259
|
+
});
|
|
2260
|
+
}
|
|
2261
|
+
async export(e, t = {}) {
|
|
2262
|
+
for (const [, i] of this.plugins) {
|
|
2263
|
+
if (!i.export)
|
|
2264
|
+
continue;
|
|
2265
|
+
const s = await i.export(e, t);
|
|
2266
|
+
if (s.supported)
|
|
2267
|
+
return s.blob;
|
|
2268
|
+
}
|
|
2269
|
+
$().error(`${I} - Export plugin with type ${e} not found`);
|
|
2270
|
+
}
|
|
2271
|
+
getAnimationStatus() {
|
|
2272
|
+
return !this._paused && !this.pageHidden && v(this);
|
|
2273
|
+
}
|
|
2274
|
+
handleClickMode(e) {
|
|
2275
|
+
if (v(this)) {
|
|
2276
|
+
this.particles.handleClickMode(e);
|
|
2277
|
+
for (const [, t] of this.plugins)
|
|
2278
|
+
t.handleClickMode && t.handleClickMode(e);
|
|
2279
|
+
}
|
|
2280
|
+
}
|
|
2281
|
+
async init() {
|
|
2282
|
+
if (!v(this))
|
|
2283
|
+
return;
|
|
2284
|
+
const e = this._engine.plugins.getSupportedShapes();
|
|
2285
|
+
for (const i of e) {
|
|
2286
|
+
const s = this._engine.plugins.getShapeDrawer(i);
|
|
2287
|
+
s && this.drawers.set(i, s);
|
|
2288
|
+
}
|
|
2289
|
+
this._options = D(this._engine, this, this._initialSourceOptions, this.sourceOptions), this.actualOptions = D(this._engine, this, this._options);
|
|
2290
|
+
const t = this._engine.plugins.getAvailablePlugins(this);
|
|
2291
|
+
for (const [i, s] of t)
|
|
2292
|
+
this.plugins.set(i, s);
|
|
2293
|
+
this.retina.init(), await this.canvas.init(), this.updateActualOptions(), this.canvas.initBackground(), this.canvas.resize(), this.zLayers = this.actualOptions.zLayers, this._duration = g(this.actualOptions.duration) * 1e3, this._delay = g(this.actualOptions.delay) * 1e3, this._lifeTime = 0, this.fpsLimit = this.actualOptions.fpsLimit > 0 ? this.actualOptions.fpsLimit : 120, this.smooth = this.actualOptions.smooth;
|
|
2294
|
+
for (const [, i] of this.drawers)
|
|
2295
|
+
i.init && await i.init(this);
|
|
2296
|
+
for (const [, i] of this.plugins)
|
|
2297
|
+
i.init && await i.init();
|
|
2298
|
+
this._engine.dispatchEvent("containerInit", { container: this }), this.particles.init(), this.particles.setDensity();
|
|
2299
|
+
for (const [, i] of this.plugins)
|
|
2300
|
+
i.particlesSetup && i.particlesSetup();
|
|
2301
|
+
this._engine.dispatchEvent("particlesSetup", { container: this });
|
|
2302
|
+
}
|
|
2303
|
+
async loadTheme(e) {
|
|
2304
|
+
v(this) && (this._currentTheme = e, await this.refresh());
|
|
2305
|
+
}
|
|
2306
|
+
pause() {
|
|
2307
|
+
if (v(this) && (this._drawAnimationFrame !== void 0 && (cancelAnimationFrame(this._drawAnimationFrame), delete this._drawAnimationFrame), !this._paused)) {
|
|
2308
|
+
for (const [, e] of this.plugins)
|
|
2309
|
+
e.pause && e.pause();
|
|
2310
|
+
this.pageHidden || (this._paused = !0), this._engine.dispatchEvent("containerPaused", { container: this });
|
|
2311
|
+
}
|
|
2312
|
+
}
|
|
2313
|
+
play(e) {
|
|
2314
|
+
if (!v(this))
|
|
2315
|
+
return;
|
|
2316
|
+
const t = this._paused || e;
|
|
2317
|
+
if (this._firstStart && !this.actualOptions.autoPlay) {
|
|
2318
|
+
this._firstStart = !1;
|
|
2319
|
+
return;
|
|
2320
|
+
}
|
|
2321
|
+
if (this._paused && (this._paused = !1), t)
|
|
2322
|
+
for (const [, i] of this.plugins)
|
|
2323
|
+
i.play && i.play();
|
|
2324
|
+
this._engine.dispatchEvent("containerPlay", { container: this }), this.draw(t || !1);
|
|
2325
|
+
}
|
|
2326
|
+
async refresh() {
|
|
2327
|
+
if (v(this))
|
|
2328
|
+
return this.stop(), this.start();
|
|
2329
|
+
}
|
|
2330
|
+
async reset() {
|
|
2331
|
+
if (v(this))
|
|
2332
|
+
return this._initialSourceOptions = void 0, this._options = D(this._engine, this), this.actualOptions = D(this._engine, this, this._options), this.refresh();
|
|
2333
|
+
}
|
|
2334
|
+
setNoise(e, t, i) {
|
|
2335
|
+
v(this) && this.setPath(e, t, i);
|
|
2336
|
+
}
|
|
2337
|
+
setPath(e, t, i) {
|
|
2338
|
+
if (!e || !v(this))
|
|
2339
|
+
return;
|
|
2340
|
+
const s = { ...Te };
|
|
2341
|
+
if (Ae(e))
|
|
2342
|
+
s.generate = e, t && (s.init = t), i && (s.update = i);
|
|
2343
|
+
else {
|
|
2344
|
+
const r = s;
|
|
2345
|
+
s.generate = e.generate || r.generate, s.init = e.init || r.init, s.update = e.update || r.update;
|
|
2346
|
+
}
|
|
2347
|
+
this.addPath(zi, s, !0);
|
|
2348
|
+
}
|
|
2349
|
+
async start() {
|
|
2350
|
+
!v(this) || this.started || (await this.init(), this.started = !0, await new Promise((e) => {
|
|
2351
|
+
this._delayTimeout = setTimeout(async () => {
|
|
2352
|
+
this._eventListeners.addListeners(), this.interactivity.element instanceof HTMLElement && this._intersectionObserver && this._intersectionObserver.observe(this.interactivity.element);
|
|
2353
|
+
for (const [, t] of this.plugins)
|
|
2354
|
+
t.start && await t.start();
|
|
2355
|
+
this._engine.dispatchEvent("containerStarted", { container: this }), this.play(), e();
|
|
2356
|
+
}, this._delay);
|
|
2357
|
+
}));
|
|
2358
|
+
}
|
|
2359
|
+
stop() {
|
|
2360
|
+
if (!(!v(this) || !this.started)) {
|
|
2361
|
+
this._delayTimeout && (clearTimeout(this._delayTimeout), delete this._delayTimeout), this._firstStart = !0, this.started = !1, this._eventListeners.removeListeners(), this.pause(), this.particles.clear(), this.canvas.stop(), this.interactivity.element instanceof HTMLElement && this._intersectionObserver && this._intersectionObserver.unobserve(this.interactivity.element);
|
|
2362
|
+
for (const [, e] of this.plugins)
|
|
2363
|
+
e.stop && e.stop();
|
|
2364
|
+
for (const e of this.plugins.keys())
|
|
2365
|
+
this.plugins.delete(e);
|
|
2366
|
+
this._sourceOptions = this._options, this._engine.dispatchEvent("containerStopped", { container: this });
|
|
2367
|
+
}
|
|
2368
|
+
}
|
|
2369
|
+
updateActualOptions() {
|
|
2370
|
+
this.actualOptions.responsive = [];
|
|
2371
|
+
const e = this.actualOptions.setResponsive(this.canvas.size.width, this.retina.pixelRatio, this._options);
|
|
2372
|
+
return this.actualOptions.setTheme(this._currentTheme), this.responsiveMaxWidth === e ? !1 : (this.responsiveMaxWidth = e, !0);
|
|
2373
|
+
}
|
|
2374
|
+
}
|
|
2375
|
+
class Pi {
|
|
2376
|
+
constructor() {
|
|
2377
|
+
this._listeners = /* @__PURE__ */ new Map();
|
|
2378
|
+
}
|
|
2379
|
+
addEventListener(e, t) {
|
|
2380
|
+
this.removeEventListener(e, t);
|
|
2381
|
+
let i = this._listeners.get(e);
|
|
2382
|
+
i || (i = [], this._listeners.set(e, i)), i.push(t);
|
|
2383
|
+
}
|
|
2384
|
+
dispatchEvent(e, t) {
|
|
2385
|
+
const i = this._listeners.get(e);
|
|
2386
|
+
i && i.forEach((s) => s(t));
|
|
2387
|
+
}
|
|
2388
|
+
hasEventListener(e) {
|
|
2389
|
+
return !!this._listeners.get(e);
|
|
2390
|
+
}
|
|
2391
|
+
removeAllEventListeners(e) {
|
|
2392
|
+
e ? this._listeners.delete(e) : this._listeners = /* @__PURE__ */ new Map();
|
|
2393
|
+
}
|
|
2394
|
+
removeEventListener(e, t) {
|
|
2395
|
+
const i = this._listeners.get(e);
|
|
2396
|
+
if (!i)
|
|
2397
|
+
return;
|
|
2398
|
+
const s = i.length, r = i.indexOf(t);
|
|
2399
|
+
r < 0 || (s === 1 ? this._listeners.delete(e) : i.splice(r, 1));
|
|
2400
|
+
}
|
|
2401
|
+
}
|
|
2402
|
+
function ae(n, e, t, i = !1) {
|
|
2403
|
+
let s = e.get(n);
|
|
2404
|
+
return (!s || i) && (s = [...t.values()].map((r) => r(n)), e.set(n, s)), s;
|
|
2405
|
+
}
|
|
2406
|
+
class ki {
|
|
2407
|
+
constructor(e) {
|
|
2408
|
+
this._engine = e, this.plugins = [], this._initializers = {
|
|
2409
|
+
interactors: /* @__PURE__ */ new Map(),
|
|
2410
|
+
movers: /* @__PURE__ */ new Map(),
|
|
2411
|
+
updaters: /* @__PURE__ */ new Map()
|
|
2412
|
+
}, this.interactors = /* @__PURE__ */ new Map(), this.movers = /* @__PURE__ */ new Map(), this.updaters = /* @__PURE__ */ new Map(), this.presets = /* @__PURE__ */ new Map(), this.drawers = /* @__PURE__ */ new Map(), this.pathGenerators = /* @__PURE__ */ new Map();
|
|
2413
|
+
}
|
|
2414
|
+
addInteractor(e, t) {
|
|
2415
|
+
this._initializers.interactors.set(e, t);
|
|
2416
|
+
}
|
|
2417
|
+
addParticleMover(e, t) {
|
|
2418
|
+
this._initializers.movers.set(e, t);
|
|
2419
|
+
}
|
|
2420
|
+
addParticleUpdater(e, t) {
|
|
2421
|
+
this._initializers.updaters.set(e, t);
|
|
2422
|
+
}
|
|
2423
|
+
addPathGenerator(e, t) {
|
|
2424
|
+
!this.getPathGenerator(e) && this.pathGenerators.set(e, t);
|
|
2425
|
+
}
|
|
2426
|
+
addPlugin(e) {
|
|
2427
|
+
!this.getPlugin(e.id) && this.plugins.push(e);
|
|
2428
|
+
}
|
|
2429
|
+
addPreset(e, t, i = !1) {
|
|
2430
|
+
(i || !this.getPreset(e)) && this.presets.set(e, t);
|
|
2431
|
+
}
|
|
2432
|
+
addShapeDrawer(e, t) {
|
|
2433
|
+
E(e, (i) => {
|
|
2434
|
+
!this.getShapeDrawer(i) && this.drawers.set(i, t);
|
|
2435
|
+
});
|
|
2436
|
+
}
|
|
2437
|
+
destroy(e) {
|
|
2438
|
+
this.updaters.delete(e), this.movers.delete(e), this.interactors.delete(e);
|
|
2439
|
+
}
|
|
2440
|
+
getAvailablePlugins(e) {
|
|
2441
|
+
const t = /* @__PURE__ */ new Map();
|
|
2442
|
+
for (const i of this.plugins)
|
|
2443
|
+
i.needsPlugin(e.actualOptions) && t.set(i.id, i.getPlugin(e));
|
|
2444
|
+
return t;
|
|
2445
|
+
}
|
|
2446
|
+
getInteractors(e, t = !1) {
|
|
2447
|
+
return ae(e, this.interactors, this._initializers.interactors, t);
|
|
2448
|
+
}
|
|
2449
|
+
getMovers(e, t = !1) {
|
|
2450
|
+
return ae(e, this.movers, this._initializers.movers, t);
|
|
2451
|
+
}
|
|
2452
|
+
getPathGenerator(e) {
|
|
2453
|
+
return this.pathGenerators.get(e);
|
|
2454
|
+
}
|
|
2455
|
+
getPlugin(e) {
|
|
2456
|
+
return this.plugins.find((t) => t.id === e);
|
|
2457
|
+
}
|
|
2458
|
+
getPreset(e) {
|
|
2459
|
+
return this.presets.get(e);
|
|
2460
|
+
}
|
|
2461
|
+
getShapeDrawer(e) {
|
|
2462
|
+
return this.drawers.get(e);
|
|
2463
|
+
}
|
|
2464
|
+
getSupportedShapes() {
|
|
2465
|
+
return this.drawers.keys();
|
|
2466
|
+
}
|
|
2467
|
+
getUpdaters(e, t = !1) {
|
|
2468
|
+
return ae(e, this.updaters, this._initializers.updaters, t);
|
|
2469
|
+
}
|
|
2470
|
+
loadOptions(e, t) {
|
|
2471
|
+
for (const i of this.plugins)
|
|
2472
|
+
i.loadOptions(e, t);
|
|
2473
|
+
}
|
|
2474
|
+
loadParticlesOptions(e, t, ...i) {
|
|
2475
|
+
const s = this.updaters.get(e);
|
|
2476
|
+
if (s)
|
|
2477
|
+
for (const r of s)
|
|
2478
|
+
r.loadOptions && r.loadOptions(t, ...i);
|
|
2479
|
+
}
|
|
2480
|
+
}
|
|
2481
|
+
async function Ci(n) {
|
|
2482
|
+
const e = W(n.url, n.index);
|
|
2483
|
+
if (!e)
|
|
2484
|
+
return n.fallback;
|
|
2485
|
+
const t = await fetch(e);
|
|
2486
|
+
return t.ok ? t.json() : ($().error(`${I} ${t.status} while retrieving config file`), n.fallback);
|
|
2487
|
+
}
|
|
2488
|
+
function Si(n) {
|
|
2489
|
+
return !n.id && !n.element && !n.url && !n.options;
|
|
2490
|
+
}
|
|
2491
|
+
function Oi(n) {
|
|
2492
|
+
return !Si(n);
|
|
2493
|
+
}
|
|
2494
|
+
class Ti {
|
|
2495
|
+
constructor() {
|
|
2496
|
+
this._configs = /* @__PURE__ */ new Map(), this._domArray = [], this._eventDispatcher = new Pi(), this._initialized = !1, this.plugins = new ki(this);
|
|
2497
|
+
}
|
|
2498
|
+
get configs() {
|
|
2499
|
+
const e = {};
|
|
2500
|
+
for (const [t, i] of this._configs)
|
|
2501
|
+
e[t] = i;
|
|
2502
|
+
return e;
|
|
2503
|
+
}
|
|
2504
|
+
get version() {
|
|
2505
|
+
return "2.12.0";
|
|
2506
|
+
}
|
|
2507
|
+
addConfig(e, t) {
|
|
2508
|
+
C(e) ? t && (t.name = e, this._configs.set(e, t)) : this._configs.set(e.name ?? "default", e);
|
|
2509
|
+
}
|
|
2510
|
+
addEventListener(e, t) {
|
|
2511
|
+
this._eventDispatcher.addEventListener(e, t);
|
|
2512
|
+
}
|
|
2513
|
+
async addInteractor(e, t, i = !0) {
|
|
2514
|
+
this.plugins.addInteractor(e, t), await this.refresh(i);
|
|
2515
|
+
}
|
|
2516
|
+
async addMover(e, t, i = !0) {
|
|
2517
|
+
this.plugins.addParticleMover(e, t), await this.refresh(i);
|
|
2518
|
+
}
|
|
2519
|
+
async addParticleUpdater(e, t, i = !0) {
|
|
2520
|
+
this.plugins.addParticleUpdater(e, t), await this.refresh(i);
|
|
2521
|
+
}
|
|
2522
|
+
async addPathGenerator(e, t, i = !0) {
|
|
2523
|
+
this.plugins.addPathGenerator(e, t), await this.refresh(i);
|
|
2524
|
+
}
|
|
2525
|
+
async addPlugin(e, t = !0) {
|
|
2526
|
+
this.plugins.addPlugin(e), await this.refresh(t);
|
|
2527
|
+
}
|
|
2528
|
+
async addPreset(e, t, i = !1, s = !0) {
|
|
2529
|
+
this.plugins.addPreset(e, t, i), await this.refresh(s);
|
|
2530
|
+
}
|
|
2531
|
+
async addShape(e, t, i, s, r, o = !0) {
|
|
2532
|
+
let a, h = o, l, c, u;
|
|
2533
|
+
R(i) ? (h = i, l = void 0) : l = i, R(s) ? (h = s, c = void 0) : c = s, R(r) ? (h = r, u = void 0) : u = r, Ae(t) ? a = {
|
|
2534
|
+
afterEffect: c,
|
|
2535
|
+
destroy: u,
|
|
2536
|
+
draw: t,
|
|
2537
|
+
init: l
|
|
2538
|
+
} : a = t, this.plugins.addShapeDrawer(e, a), await this.refresh(h);
|
|
2539
|
+
}
|
|
2540
|
+
dispatchEvent(e, t) {
|
|
2541
|
+
this._eventDispatcher.dispatchEvent(e, t);
|
|
2542
|
+
}
|
|
2543
|
+
dom() {
|
|
2544
|
+
return this._domArray;
|
|
2545
|
+
}
|
|
2546
|
+
domItem(e) {
|
|
2547
|
+
const t = this.dom(), i = t[e];
|
|
2548
|
+
if (!i || i.destroyed) {
|
|
2549
|
+
t.splice(e, 1);
|
|
2550
|
+
return;
|
|
2551
|
+
}
|
|
2552
|
+
return i;
|
|
2553
|
+
}
|
|
2554
|
+
init() {
|
|
2555
|
+
this._initialized || (this._initialized = !0);
|
|
2556
|
+
}
|
|
2557
|
+
async load(e, t) {
|
|
2558
|
+
return this.loadFromArray(e, t);
|
|
2559
|
+
}
|
|
2560
|
+
async loadFromArray(e, t, i) {
|
|
2561
|
+
let s;
|
|
2562
|
+
return Oi(e) ? s = e : (s = {}, C(e) ? s.id = e : s.options = e, k(t) ? s.index = t : s.options = t ?? s.options, s.index = i ?? s.index), this._loadParams(s);
|
|
2563
|
+
}
|
|
2564
|
+
async loadJSON(e, t, i) {
|
|
2565
|
+
let s, r;
|
|
2566
|
+
return k(t) || t === void 0 ? s = e : (r = e, s = t), this._loadParams({ id: r, url: s, index: i });
|
|
2567
|
+
}
|
|
2568
|
+
async refresh(e = !0) {
|
|
2569
|
+
e && this.dom().forEach((t) => t.refresh());
|
|
2570
|
+
}
|
|
2571
|
+
removeEventListener(e, t) {
|
|
2572
|
+
this._eventDispatcher.removeEventListener(e, t);
|
|
2573
|
+
}
|
|
2574
|
+
async set(e, t, i, s) {
|
|
2575
|
+
const r = { index: s };
|
|
2576
|
+
return C(e) ? r.id = e : r.element = e, t instanceof HTMLElement ? r.element = t : r.options = t, k(i) ? r.index = i : r.options = i ?? r.options, this._loadParams(r);
|
|
2577
|
+
}
|
|
2578
|
+
async setJSON(e, t, i, s) {
|
|
2579
|
+
const r = {};
|
|
2580
|
+
return e instanceof HTMLElement ? (r.element = e, r.url = t, r.index = i) : (r.id = e, r.element = t, r.url = i, r.index = s), this._loadParams(r);
|
|
2581
|
+
}
|
|
2582
|
+
setOnClickHandler(e) {
|
|
2583
|
+
const t = this.dom();
|
|
2584
|
+
if (!t.length)
|
|
2585
|
+
throw new Error(`${I} can only set click handlers after calling tsParticles.load()`);
|
|
2586
|
+
for (const i of t)
|
|
2587
|
+
i.addClickHandler(e);
|
|
2588
|
+
}
|
|
2589
|
+
async _loadParams(e) {
|
|
2590
|
+
const t = e.id ?? `tsparticles${Math.floor(T() * 1e4)}`, { index: i, url: s } = e, r = s ? await Ci({ fallback: e.options, url: s, index: i }) : e.options;
|
|
2591
|
+
let o = e.element ?? document.getElementById(t);
|
|
2592
|
+
o || (o = document.createElement("div"), o.id = t, document.body.append(o));
|
|
2593
|
+
const a = W(r, i), h = this.dom(), l = h.findIndex((f) => f.id === t);
|
|
2594
|
+
if (l >= 0) {
|
|
2595
|
+
const f = this.domItem(l);
|
|
2596
|
+
f && !f.destroyed && (f.destroy(), h.splice(l, 1));
|
|
2597
|
+
}
|
|
2598
|
+
let c;
|
|
2599
|
+
if (o.tagName.toLowerCase() === "canvas")
|
|
2600
|
+
c = o, c.dataset[B] = "false";
|
|
2601
|
+
else {
|
|
2602
|
+
const f = o.getElementsByTagName("canvas");
|
|
2603
|
+
f.length ? (c = f[0], c.dataset[B] = "false") : (c = document.createElement("canvas"), c.dataset[B] = "true", o.appendChild(c));
|
|
2604
|
+
}
|
|
2605
|
+
c.style.width || (c.style.width = "100%"), c.style.height || (c.style.height = "100%");
|
|
2606
|
+
const u = new Mi(this, t, a);
|
|
2607
|
+
return l >= 0 ? h.splice(l, 0, u) : h.push(u), u.canvas.loadCanvas(c), await u.start(), u;
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2610
|
+
class Ri {
|
|
2611
|
+
constructor() {
|
|
2612
|
+
this.key = "hsl", this.stringPrefix = "hsl";
|
|
2613
|
+
}
|
|
2614
|
+
handleColor(e) {
|
|
2615
|
+
const t = e.value, i = t.hsl ?? e.value;
|
|
2616
|
+
if (i.h !== void 0 && i.s !== void 0 && i.l !== void 0)
|
|
2617
|
+
return he(i);
|
|
2618
|
+
}
|
|
2619
|
+
handleRangeColor(e) {
|
|
2620
|
+
const t = e.value, i = t.hsl ?? e.value;
|
|
2621
|
+
if (i.h !== void 0 && i.l !== void 0)
|
|
2622
|
+
return he({
|
|
2623
|
+
h: g(i.h),
|
|
2624
|
+
l: g(i.l),
|
|
2625
|
+
s: g(i.s)
|
|
2626
|
+
});
|
|
2627
|
+
}
|
|
2628
|
+
parseString(e) {
|
|
2629
|
+
if (!e.startsWith("hsl"))
|
|
2630
|
+
return;
|
|
2631
|
+
const t = /hsla?\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([\d.%]+)\s*)?\)/i, i = t.exec(e);
|
|
2632
|
+
return i ? yt({
|
|
2633
|
+
a: i.length > 4 ? Ie(i[5]) : 1,
|
|
2634
|
+
h: parseInt(i[1], 10),
|
|
2635
|
+
l: parseInt(i[3], 10),
|
|
2636
|
+
s: parseInt(i[2], 10)
|
|
2637
|
+
}) : void 0;
|
|
2638
|
+
}
|
|
2639
|
+
}
|
|
2640
|
+
class Ii {
|
|
2641
|
+
constructor() {
|
|
2642
|
+
this.key = "rgb", this.stringPrefix = "rgb";
|
|
2643
|
+
}
|
|
2644
|
+
handleColor(e) {
|
|
2645
|
+
const t = e.value, i = t.rgb ?? e.value;
|
|
2646
|
+
if (i.r !== void 0)
|
|
2647
|
+
return i;
|
|
2648
|
+
}
|
|
2649
|
+
handleRangeColor(e) {
|
|
2650
|
+
const t = e.value, i = t.rgb ?? e.value;
|
|
2651
|
+
if (i.r !== void 0)
|
|
2652
|
+
return {
|
|
2653
|
+
r: g(i.r),
|
|
2654
|
+
g: g(i.g),
|
|
2655
|
+
b: g(i.b)
|
|
2656
|
+
};
|
|
2657
|
+
}
|
|
2658
|
+
parseString(e) {
|
|
2659
|
+
if (!e.startsWith(this.stringPrefix))
|
|
2660
|
+
return;
|
|
2661
|
+
const t = /rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([\d.%]+)\s*)?\)/i, i = t.exec(e);
|
|
2662
|
+
return i ? {
|
|
2663
|
+
a: i.length > 4 ? Ie(i[5]) : 1,
|
|
2664
|
+
b: parseInt(i[3], 10),
|
|
2665
|
+
g: parseInt(i[2], 10),
|
|
2666
|
+
r: parseInt(i[1], 10)
|
|
2667
|
+
} : void 0;
|
|
2668
|
+
}
|
|
2669
|
+
}
|
|
2670
|
+
function Ei() {
|
|
2671
|
+
const n = new Ii(), e = new Ri();
|
|
2672
|
+
we(n), we(e);
|
|
2673
|
+
const t = new Ti();
|
|
2674
|
+
return t.init(), t;
|
|
2675
|
+
}
|
|
2676
|
+
const le = Ei();
|
|
2677
|
+
Z() || (window.tsParticles = le);
|
|
2678
|
+
const A = (n) => typeof n == "object" && n !== null;
|
|
2679
|
+
function Y(n, e, t = () => !1) {
|
|
2680
|
+
if (!A(n) || !A(e))
|
|
2681
|
+
return n === e;
|
|
2682
|
+
const i = Object.keys(n).filter((r) => !t(r)), s = Object.keys(e).filter((r) => !t(r));
|
|
2683
|
+
if (i.length !== s.length)
|
|
2684
|
+
return !1;
|
|
2685
|
+
for (const r of i) {
|
|
2686
|
+
const o = n[r], a = e[r];
|
|
2687
|
+
if (A(o) && A(a)) {
|
|
2688
|
+
if (o === e && a === n)
|
|
2689
|
+
continue;
|
|
2690
|
+
if (!Y(o, a, t))
|
|
2691
|
+
return !1;
|
|
2692
|
+
} else if (Array.isArray(o) && Array.isArray(a)) {
|
|
2693
|
+
if (!$e(o, a, t))
|
|
2694
|
+
return !1;
|
|
2695
|
+
} else if (o !== a)
|
|
2696
|
+
return !1;
|
|
2697
|
+
}
|
|
2698
|
+
return !0;
|
|
2699
|
+
}
|
|
2700
|
+
function $e(n, e, t) {
|
|
2701
|
+
if (n.length !== e.length)
|
|
2702
|
+
return !1;
|
|
2703
|
+
for (let i = 0; i < n.length; i++) {
|
|
2704
|
+
const s = n[i], r = e[i];
|
|
2705
|
+
if (Array.isArray(s) && Array.isArray(r)) {
|
|
2706
|
+
if (!$e(s, r, t))
|
|
2707
|
+
return !1;
|
|
2708
|
+
} else if (A(s) && A(r)) {
|
|
2709
|
+
if (!Y(s, r, t))
|
|
2710
|
+
return !1;
|
|
2711
|
+
} else if (s !== r)
|
|
2712
|
+
return !1;
|
|
2713
|
+
}
|
|
2714
|
+
return !0;
|
|
2715
|
+
}
|
|
2716
|
+
const Ge = "tsparticles";
|
|
2717
|
+
class pe extends Ne {
|
|
2718
|
+
constructor(e) {
|
|
2719
|
+
super(e), this.state = {
|
|
2720
|
+
init: !1,
|
|
2721
|
+
library: void 0
|
|
2722
|
+
};
|
|
2723
|
+
}
|
|
2724
|
+
destroy() {
|
|
2725
|
+
this.state.library && (this.state.library.destroy(), this.setState({
|
|
2726
|
+
library: void 0
|
|
2727
|
+
}));
|
|
2728
|
+
}
|
|
2729
|
+
shouldComponentUpdate(e) {
|
|
2730
|
+
const t = e.options ?? e.params, i = this.props.options ?? this.props.params;
|
|
2731
|
+
return e.url !== this.props.url || e.id !== this.props.id || e.canvasClassName !== this.props.canvasClassName || e.className !== this.props.className || e.height !== this.props.height || e.width !== this.props.width || !Y(e.style, this.props.style) || e.init !== this.props.init || e.loaded !== this.props.loaded || !Y(t, i, (s) => s.startsWith("_"));
|
|
2732
|
+
}
|
|
2733
|
+
componentDidUpdate() {
|
|
2734
|
+
this.refresh();
|
|
2735
|
+
}
|
|
2736
|
+
forceUpdate() {
|
|
2737
|
+
this.refresh().then(() => {
|
|
2738
|
+
super.forceUpdate();
|
|
2739
|
+
});
|
|
2740
|
+
}
|
|
2741
|
+
componentDidMount() {
|
|
2742
|
+
(async () => (this.props.init && await this.props.init(le), this.setState({
|
|
2743
|
+
init: !0
|
|
2744
|
+
}, async () => {
|
|
2745
|
+
await this.loadParticles();
|
|
2746
|
+
})))();
|
|
2747
|
+
}
|
|
2748
|
+
componentWillUnmount() {
|
|
2749
|
+
this.destroy();
|
|
2750
|
+
}
|
|
2751
|
+
render() {
|
|
2752
|
+
const { width: e, height: t, className: i, canvasClassName: s, id: r } = this.props;
|
|
2753
|
+
return ge.createElement(
|
|
2754
|
+
"div",
|
|
2755
|
+
{ className: i, id: r },
|
|
2756
|
+
ge.createElement("canvas", { className: s, style: {
|
|
2757
|
+
...this.props.style,
|
|
2758
|
+
width: e,
|
|
2759
|
+
height: t
|
|
2760
|
+
} })
|
|
2761
|
+
);
|
|
2762
|
+
}
|
|
2763
|
+
async refresh() {
|
|
2764
|
+
this.destroy(), await this.loadParticles();
|
|
2765
|
+
}
|
|
2766
|
+
async loadParticles() {
|
|
2767
|
+
if (!this.state.init)
|
|
2768
|
+
return;
|
|
2769
|
+
const e = this.props.id ?? pe.defaultProps.id ?? Ge, t = await le.load({
|
|
2770
|
+
url: this.props.url,
|
|
2771
|
+
id: e,
|
|
2772
|
+
options: this.props.options ?? this.props.params
|
|
2773
|
+
});
|
|
2774
|
+
this.props.container && (this.props.container.current = t), this.setState({
|
|
2775
|
+
library: t
|
|
2776
|
+
}), this.props.loaded && await this.props.loaded(t);
|
|
2777
|
+
}
|
|
2778
|
+
}
|
|
2779
|
+
pe.defaultProps = {
|
|
2780
|
+
width: "100%",
|
|
2781
|
+
height: "100%",
|
|
2782
|
+
options: {},
|
|
2783
|
+
style: {},
|
|
2784
|
+
url: void 0,
|
|
2785
|
+
id: Ge
|
|
2786
|
+
};
|