gclass-anims 1.0.0-beta.21 → 1.0.0-beta.22

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.
@@ -0,0 +1,3268 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ let gsap = require("gsap");
3
+ let gsap_all = require("gsap/all");
4
+ //#region Config.js
5
+ var defaults = {
6
+ orderDivide: 5,
7
+ spawnDelayMultiplier: .2,
8
+ spawnOffset: 20,
9
+ clickOffset: 10,
10
+ clickExpandOffset: 15,
11
+ clickDuration: .2,
12
+ ease: "back",
13
+ effectDelay: .5,
14
+ effectDuration: 1,
15
+ effectOffset: 20,
16
+ progressStart: "top bottom",
17
+ progressEnd: "center center",
18
+ textStagger: .03,
19
+ typewriterSplitCharDuration: .05,
20
+ minTextPartDuration: .3,
21
+ revealDelay: 0,
22
+ characterlist: "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz",
23
+ bootTime: 5,
24
+ breakpoints: {
25
+ xs: 475,
26
+ s: 640,
27
+ m: 768,
28
+ l: 1024,
29
+ xl: 1280
30
+ }
31
+ };
32
+ var animations = [
33
+ {
34
+ sel: ".spawn-down",
35
+ from: {
36
+ opacity: 0,
37
+ y: -defaults.spawnOffset
38
+ },
39
+ play: (el, delay, dur, ease) => SpawnV(el, delay, -defaults.spawnOffset, dur, ease)
40
+ },
41
+ {
42
+ sel: ".spawn-up",
43
+ from: {
44
+ opacity: 0,
45
+ y: defaults.spawnOffset
46
+ },
47
+ play: (el, delay, dur, ease) => SpawnV(el, delay, defaults.spawnOffset, dur, ease)
48
+ },
49
+ {
50
+ sel: ".spawn-left",
51
+ from: {
52
+ opacity: 0,
53
+ x: -defaults.spawnOffset
54
+ },
55
+ play: (el, delay, dur, ease) => SpawnH(el, delay, -defaults.spawnOffset, dur, ease)
56
+ },
57
+ {
58
+ sel: ".spawn-right",
59
+ from: {
60
+ opacity: 0,
61
+ x: defaults.spawnOffset
62
+ },
63
+ play: (el, delay, dur, ease) => SpawnH(el, delay, defaults.spawnOffset, dur, ease)
64
+ },
65
+ {
66
+ sel: ".spawn-cw",
67
+ from: {
68
+ scale: 0,
69
+ rotation: -360
70
+ },
71
+ play: (el, delay, dur, ease) => spawnSpinCW(el, delay, dur, ease)
72
+ },
73
+ {
74
+ sel: ".spawn-ccw",
75
+ from: {
76
+ scale: 0,
77
+ rotation: 360
78
+ },
79
+ play: (el, delay, dur, ease) => spawnSpinCCW(el, delay, dur, ease)
80
+ },
81
+ {
82
+ sel: ".spawn-fade",
83
+ from: { opacity: 0 },
84
+ play: (el, delay, dur, ease) => spawnFade(el, delay, dur, ease)
85
+ },
86
+ {
87
+ sel: ".spawn-blur",
88
+ from: {
89
+ opacity: 0,
90
+ filter: "blur(20px)"
91
+ },
92
+ play: (el, delay, dur, ease) => spawnBlur(el, delay, dur, ease)
93
+ },
94
+ {
95
+ sel: ".spawn-x-down",
96
+ from: {
97
+ scale: 0,
98
+ rotationX: -360
99
+ },
100
+ play: (el, delay, dur, ease) => spawnXDown(el, delay, dur, ease)
101
+ },
102
+ {
103
+ sel: ".spawn-x-up",
104
+ from: {
105
+ scale: 0,
106
+ rotationX: 360
107
+ },
108
+ play: (el, delay, dur, ease) => spawnXUp(el, delay, dur, ease)
109
+ },
110
+ {
111
+ sel: ".spawn-y-right",
112
+ from: {
113
+ scale: 0,
114
+ rotationY: -360
115
+ },
116
+ play: (el, delay, dur, ease) => spawnYRight(el, delay, dur, ease)
117
+ },
118
+ {
119
+ sel: ".spawn-y-left",
120
+ from: {
121
+ scale: 0,
122
+ rotationY: 360
123
+ },
124
+ play: (el, delay, dur, ease) => spawnYLeft(el, delay, dur, ease)
125
+ },
126
+ {
127
+ sel: ".expand-vertical",
128
+ from: {
129
+ opacity: 0,
130
+ scaleY: 0
131
+ },
132
+ play: (el, delay, dur, ease) => expandV(el, delay, dur, ease)
133
+ },
134
+ {
135
+ sel: ".expand-horizontal",
136
+ from: {
137
+ opacity: 0,
138
+ scaleX: 0
139
+ },
140
+ play: (el, delay, dur, ease) => expandH(el, delay, dur, ease)
141
+ },
142
+ {
143
+ sel: ".expand-right",
144
+ from: {
145
+ opacity: 0,
146
+ scaleX: 0
147
+ },
148
+ play: (el, delay, dur, ease) => expandRight(el, delay, dur, ease)
149
+ },
150
+ {
151
+ sel: ".expand-left",
152
+ from: {
153
+ opacity: 0,
154
+ scaleX: 0
155
+ },
156
+ play: (el, delay, dur, ease) => expandLeft(el, delay, dur, ease)
157
+ },
158
+ {
159
+ sel: ".expand-up",
160
+ from: {
161
+ opacity: 0,
162
+ scaleY: 0
163
+ },
164
+ play: (el, delay, dur, ease) => expandUp(el, delay, dur, ease)
165
+ },
166
+ {
167
+ sel: ".expand-down",
168
+ from: {
169
+ opacity: 0,
170
+ scaleY: 0
171
+ },
172
+ play: (el, delay, dur, ease) => expandDown(el, delay, dur, ease)
173
+ },
174
+ {
175
+ sel: ".expand-all",
176
+ from: {
177
+ opacity: 0,
178
+ scale: 0
179
+ },
180
+ play: (el, delay, dur, ease) => expandA(el, delay, dur, ease)
181
+ },
182
+ {
183
+ sel: ".typewriter",
184
+ typewriter: true,
185
+ from: { text: "" },
186
+ play: (el, delay, dur, ease) => typewriter(el, stashText(el), dur, delay, ease)
187
+ },
188
+ {
189
+ sel: ".typewriter-split",
190
+ typewriter: true,
191
+ typewriterSplit: true,
192
+ from: { opacity: 0 },
193
+ play: (el, delay, dur, ease) => null
194
+ },
195
+ {
196
+ sel: ".scramble",
197
+ scramble: true,
198
+ text: false,
199
+ play: (el, delay, dur, ease) => scramble(el, delay, dur, ease)
200
+ },
201
+ {
202
+ sel: ".scramble-all",
203
+ scramble: true,
204
+ text: false,
205
+ play: (el, delay, dur, ease) => scramble(el, delay, dur, ease)
206
+ },
207
+ {
208
+ sel: ".count",
209
+ count: true,
210
+ text: false,
211
+ from: { opacity: 0 },
212
+ play: (el, delay, dur, ease) => countUp(el, delay, dur, ease)
213
+ },
214
+ {
215
+ sel: ".clip-reveal-up",
216
+ text: false,
217
+ from: { clipPath: "inset(0% 0% 100% 0%)" },
218
+ play: (el, delay, dur, ease) => spawnClipReveal(el, delay, dur, ease, "up")
219
+ },
220
+ {
221
+ sel: ".clip-reveal-down",
222
+ text: false,
223
+ from: { clipPath: "inset(100% 0% 0% 0%)" },
224
+ play: (el, delay, dur, ease) => spawnClipReveal(el, delay, dur, ease, "down")
225
+ },
226
+ {
227
+ sel: ".clip-reveal-left",
228
+ text: false,
229
+ from: { clipPath: "inset(0% 0% 0% 100%)" },
230
+ play: (el, delay, dur, ease) => spawnClipReveal(el, delay, dur, ease, "left")
231
+ },
232
+ {
233
+ sel: ".clip-reveal-right",
234
+ text: false,
235
+ from: { clipPath: "inset(0% 100% 0% 0%)" },
236
+ play: (el, delay, dur, ease) => spawnClipReveal(el, delay, dur, ease, "right")
237
+ },
238
+ {
239
+ sel: ".clip-reveal",
240
+ text: false,
241
+ from: { clipPath: "inset(0% 0% 100% 0%)" },
242
+ play: (el, delay, dur, ease) => spawnClipReveal(el, delay, dur, ease, "up")
243
+ },
244
+ {
245
+ sel: ".curtain-horizontal",
246
+ text: false,
247
+ from: { clipPath: "inset(0% 50% 0% 50%)" },
248
+ play: (el, delay, dur, ease) => curtainHorizontal(el, delay, dur, ease)
249
+ },
250
+ {
251
+ sel: ".curtain-vertical",
252
+ text: false,
253
+ from: { clipPath: "inset(50% 0% 50% 0%)" },
254
+ play: (el, delay, dur, ease) => curtainVertical(el, delay, dur, ease)
255
+ },
256
+ {
257
+ sel: ".draw",
258
+ text: false,
259
+ from: { drawSVG: "0%" },
260
+ play: (el, delay, dur, ease) => drawsvg(el, delay, dur, ease)
261
+ },
262
+ {
263
+ sel: ".draw-split",
264
+ text: false,
265
+ from: { drawSVG: "0%" },
266
+ play: (el, delay, dur, ease) => drawsvgSplit(el, delay, dur, ease)
267
+ },
268
+ {
269
+ sel: ".shake",
270
+ build: (el, { edelay, amount, etime, ease }) => shake(edelay, el, amount, etime, ease),
271
+ key: "shakeanim"
272
+ },
273
+ {
274
+ sel: ".spin-cw",
275
+ build: (el, { edelay, etime, ease }) => spinCW(el, edelay, etime, ease),
276
+ key: "spinCW"
277
+ },
278
+ {
279
+ sel: ".spin-ccw",
280
+ build: (el, { edelay, etime, ease }) => spinCCW(el, edelay, etime, ease),
281
+ key: "spinCW"
282
+ },
283
+ {
284
+ sel: ".bounce",
285
+ build: (el, { edelay, amount, etime, ease }) => bounce(edelay, el, amount, etime, ease),
286
+ key: "bounce"
287
+ },
288
+ {
289
+ sel: ".bell",
290
+ build: (el, { edelay, amount, etime, ease }) => bell(edelay, el, amount, etime, ease),
291
+ key: "bell"
292
+ },
293
+ {
294
+ sel: ".pulse",
295
+ build: (el, { edelay, amount, etime, ease }) => pulse(edelay, el, amount, etime, ease),
296
+ key: "pulse"
297
+ },
298
+ {
299
+ sel: ".radiate",
300
+ build: (el, { edelay, amount, etime, ease, radiateZ }) => radiate(edelay, el, amount, etime, ease, radiateZ),
301
+ key: "radiate"
302
+ },
303
+ {
304
+ sel: ".float",
305
+ build: (el, { edelay, amount, etime, ease }) => hover(edelay, el, amount, etime, ease),
306
+ key: "float"
307
+ },
308
+ {
309
+ sel: ".marquee-left",
310
+ build: (el, ctx) => marquee(el, "left", ctx.time, ctx.mH, ctx.mV, el.classList.contains("marquee-no-repeat")),
311
+ key: "marquee"
312
+ },
313
+ {
314
+ sel: ".marquee-right",
315
+ build: (el, ctx) => marquee(el, "right", ctx.time, ctx.mH, ctx.mV, el.classList.contains("marquee-no-repeat")),
316
+ key: "marquee"
317
+ },
318
+ {
319
+ sel: ".marquee-up",
320
+ build: (el, ctx) => marquee(el, "up", ctx.time, ctx.mH, ctx.mV, el.classList.contains("marquee-no-repeat")),
321
+ key: "marquee"
322
+ },
323
+ {
324
+ sel: ".marquee-down",
325
+ build: (el, ctx) => marquee(el, "down", ctx.time, ctx.mH, ctx.mV, el.classList.contains("marquee-no-repeat")),
326
+ key: "marquee"
327
+ }
328
+ ];
329
+ function normalize(extra = []) {
330
+ const all = animations.concat(extra);
331
+ return {
332
+ all,
333
+ spawnConfigs: all.filter((a) => a.play).map((a) => ({
334
+ sel: a.sel,
335
+ from: a.from,
336
+ play: a.play,
337
+ typewriter: a.typewriter,
338
+ typewriterSplit: a.typewriterSplit,
339
+ text: a.text !== false,
340
+ count: a.count,
341
+ scramble: a.scramble
342
+ })),
343
+ loopConfigs: all.filter((a) => a.build).map((a) => ({
344
+ sel: a.sel,
345
+ build: a.build,
346
+ key: a.key || a.sel.slice(1),
347
+ loop: a.loop !== false
348
+ }))
349
+ };
350
+ }
351
+ //#endregion
352
+ //#region Animations.js
353
+ gsap.gsap.registerPlugin(gsap_all.Flip);
354
+ gsap.gsap.registerPlugin(gsap_all.SplitText);
355
+ gsap.gsap.registerPlugin(gsap_all.TextPlugin);
356
+ gsap.gsap.registerPlugin(gsap_all.DrawSVGPlugin);
357
+ gsap.gsap.registerPlugin(gsap_all.MotionPathPlugin);
358
+ gsap.gsap.registerPlugin(gsap_all.ScrambleTextPlugin);
359
+ var getBpDataMod = () => {
360
+ const entries = Object.entries(defaults.breakpoints || {}).sort((a, b) => a[1] - b[1]);
361
+ const names = entries.map(([k]) => k);
362
+ return {
363
+ entries,
364
+ names,
365
+ map: Object.fromEntries(entries),
366
+ re: names.length ? new RegExp(`^(${names.join("|")}):(.+)$`) : /^$^/
367
+ };
368
+ };
369
+ var isBreakpointActiveMod = (bp) => {
370
+ if (!bp) return true;
371
+ const { map } = getBpDataMod();
372
+ const px = map[bp];
373
+ if (px == null) return true;
374
+ if (typeof window === "undefined" || !window.matchMedia) return true;
375
+ return window.matchMedia(`(min-width: ${px}px)`).matches;
376
+ };
377
+ var hasGClassMod = (el, name) => {
378
+ if (el.classList.contains(name)) return true;
379
+ const { names } = getBpDataMod();
380
+ for (const bp of names) if (el.classList.contains(`${bp}:${name}`) && isBreakpointActiveMod(bp)) return true;
381
+ return false;
382
+ };
383
+ var getActivePrefixedClassMod = (el, prefix) => {
384
+ const { names, map, re } = getBpDataMod();
385
+ let best = null, bestPx = -2;
386
+ for (const c of el.classList) {
387
+ let bp = null, core = c;
388
+ const m = c.match(re);
389
+ if (m) {
390
+ bp = m[1];
391
+ core = m[2];
392
+ }
393
+ if (!core.startsWith(prefix)) continue;
394
+ if (bp && !isBreakpointActiveMod(bp)) continue;
395
+ const px = bp ? map[bp] : -1;
396
+ if (px > bestPx) {
397
+ best = c;
398
+ bestPx = px;
399
+ }
400
+ }
401
+ return best;
402
+ };
403
+ var DEFAULT_EASE = "power3.out";
404
+ var easeOf = (e) => e || DEFAULT_EASE;
405
+ var finalOpacity = (target) => {
406
+ const had = target.style.opacity;
407
+ target.style.removeProperty("opacity");
408
+ const v = parseFloat(getComputedStyle(target).opacity);
409
+ if (had !== "") target.style.opacity = had;
410
+ return isNaN(v) ? 1 : v;
411
+ };
412
+ var stashText = (el) => {
413
+ const busy = (el.typewriter || el._spawnTween || el._scrollTween)?.isActive?.();
414
+ const html = el.innerHTML;
415
+ if (!busy && html && html.trim()) el._gcText = html;
416
+ return el._gcText !== void 0 ? el._gcText : html;
417
+ };
418
+ function SpawnV(target, delay, dir, dur, ease) {
419
+ const e = easeOf(ease);
420
+ return gsap.gsap.fromTo(target, {
421
+ opacity: 0,
422
+ y: dir,
423
+ scale: .97
424
+ }, {
425
+ ease: e,
426
+ duration: dur,
427
+ delay,
428
+ y: 0,
429
+ opacity: finalOpacity(target),
430
+ scale: 1
431
+ });
432
+ }
433
+ function SpawnH(target, delay, dir, dur, ease) {
434
+ const e = easeOf(ease);
435
+ return gsap.gsap.fromTo(target, {
436
+ opacity: 0,
437
+ x: dir,
438
+ scale: .97
439
+ }, {
440
+ ease: e,
441
+ duration: dur,
442
+ delay,
443
+ x: 0,
444
+ opacity: finalOpacity(target),
445
+ scale: 1
446
+ });
447
+ }
448
+ function expandV(target, delay, dur, ease) {
449
+ const e = easeOf(ease);
450
+ return gsap.gsap.fromTo(target, {
451
+ opacity: 1,
452
+ scaleY: 0
453
+ }, {
454
+ ease: e,
455
+ duration: dur,
456
+ delay,
457
+ scaleY: 1,
458
+ opacity: finalOpacity(target),
459
+ transformOrigin: "50% 50%"
460
+ });
461
+ }
462
+ function expandH(target, delay, dur, ease) {
463
+ const e = easeOf(ease);
464
+ return gsap.gsap.fromTo(target, {
465
+ opacity: 1,
466
+ scaleX: 0
467
+ }, {
468
+ ease: e,
469
+ duration: dur,
470
+ delay,
471
+ scaleX: 1,
472
+ opacity: finalOpacity(target),
473
+ transformOrigin: "50% 50%"
474
+ });
475
+ }
476
+ function expandA(target, delay, dur, ease) {
477
+ const e = easeOf(ease);
478
+ return gsap.gsap.fromTo(target, {
479
+ opacity: 1,
480
+ scale: 0
481
+ }, {
482
+ ease: e,
483
+ duration: dur,
484
+ delay,
485
+ scale: 1,
486
+ opacity: finalOpacity(target),
487
+ transformOrigin: "50% 50%"
488
+ });
489
+ }
490
+ function typewriter(target, text, dur, delay, ease) {
491
+ gsap.gsap.utils.toArray(target).forEach((el) => {
492
+ if (el.style) el.style.whiteSpace = "pre-wrap";
493
+ });
494
+ const value = String(text).replace(/\n/g, "<br>");
495
+ return gsap.gsap.fromTo(target, { text: "" }, {
496
+ ease: easeOf(ease),
497
+ duration: dur,
498
+ delay,
499
+ text: { value }
500
+ });
501
+ }
502
+ function spawnSpinCCW(target, delay, dur, ease) {
503
+ const e = easeOf(ease);
504
+ return gsap.gsap.fromTo(target, {
505
+ scale: 0,
506
+ rotation: -90
507
+ }, {
508
+ ease: e,
509
+ duration: dur,
510
+ delay,
511
+ scale: 1,
512
+ rotation: 0,
513
+ transformOrigin: "50% 50%"
514
+ });
515
+ }
516
+ function spawnSpinCW(target, delay, dur, ease) {
517
+ const e = easeOf(ease);
518
+ return gsap.gsap.fromTo(target, {
519
+ scale: 0,
520
+ rotation: 90
521
+ }, {
522
+ ease: e,
523
+ duration: dur,
524
+ delay,
525
+ scale: 1,
526
+ rotation: 0,
527
+ transformOrigin: "50% 50%"
528
+ });
529
+ }
530
+ function spawnFade(target, delay, dur, ease) {
531
+ return gsap.gsap.fromTo(target, { opacity: 0 }, {
532
+ ease: easeOf(ease),
533
+ duration: dur,
534
+ delay,
535
+ opacity: finalOpacity(target)
536
+ });
537
+ }
538
+ function spawnBlur(target, delay, dur, ease) {
539
+ const e = easeOf(ease);
540
+ return gsap.gsap.fromTo(target, {
541
+ opacity: 0,
542
+ filter: "blur(20px)"
543
+ }, {
544
+ ease: e,
545
+ duration: dur,
546
+ delay,
547
+ opacity: finalOpacity(target),
548
+ filter: "blur(0px)"
549
+ });
550
+ }
551
+ var CLIP_FROM = {
552
+ up: "inset(0% 0% 100% 0%)",
553
+ down: "inset(100% 0% 0% 0%)",
554
+ left: "inset(0% 0% 0% 100%)",
555
+ right: "inset(0% 100% 0% 0%)"
556
+ };
557
+ function spawnClipReveal(target, delay, dur, ease, dir = "up") {
558
+ const from = CLIP_FROM[dir] || CLIP_FROM.up;
559
+ return gsap.gsap.fromTo(target, { clipPath: from }, {
560
+ clipPath: "inset(0% 0% 0% 0%)",
561
+ ease: easeOf(ease),
562
+ duration: dur,
563
+ delay
564
+ });
565
+ }
566
+ function curtainHorizontal(target, delay, dur, ease) {
567
+ return gsap.gsap.fromTo(target, { clipPath: "inset(0% 50% 0% 50%)" }, {
568
+ clipPath: "inset(0% 0% 0% 0%)",
569
+ ease: easeOf(ease),
570
+ duration: dur,
571
+ delay
572
+ });
573
+ }
574
+ function curtainVertical(target, delay, dur, ease) {
575
+ return gsap.gsap.fromTo(target, { clipPath: "inset(50% 0% 50% 0%)" }, {
576
+ clipPath: "inset(0% 0% 0% 0%)",
577
+ ease: easeOf(ease),
578
+ duration: dur,
579
+ delay
580
+ });
581
+ }
582
+ function spawnXUp(target, delay, dur, ease) {
583
+ const e = easeOf(ease);
584
+ return gsap.gsap.fromTo(target, {
585
+ scale: 0,
586
+ rotationX: 360,
587
+ opacity: 0
588
+ }, {
589
+ ease: e,
590
+ duration: dur,
591
+ delay,
592
+ scale: 1,
593
+ rotationX: 0,
594
+ opacity: finalOpacity(target),
595
+ transformOrigin: "50% 50%"
596
+ });
597
+ }
598
+ function spawnXDown(target, delay, dur, ease) {
599
+ const e = easeOf(ease);
600
+ return gsap.gsap.fromTo(target, {
601
+ scale: 0,
602
+ rotationX: -360,
603
+ opacity: 0
604
+ }, {
605
+ ease: e,
606
+ duration: dur,
607
+ delay,
608
+ scale: 1,
609
+ rotationX: 0,
610
+ opacity: finalOpacity(target),
611
+ transformOrigin: "50% 50%"
612
+ });
613
+ }
614
+ function spawnYRight(target, delay, dur, ease) {
615
+ const e = easeOf(ease);
616
+ return gsap.gsap.fromTo(target, {
617
+ scale: 0,
618
+ rotationY: 360,
619
+ opacity: 0
620
+ }, {
621
+ ease: e,
622
+ duration: dur,
623
+ delay,
624
+ scale: 1,
625
+ rotationY: 0,
626
+ opacity: finalOpacity(target),
627
+ transformOrigin: "50% 50%"
628
+ });
629
+ }
630
+ function spawnYLeft(target, delay, dur, ease) {
631
+ const e = easeOf(ease);
632
+ return gsap.gsap.fromTo(target, {
633
+ scale: 0,
634
+ rotationY: -360,
635
+ opacity: 0
636
+ }, {
637
+ ease: e,
638
+ duration: dur,
639
+ delay,
640
+ scale: 1,
641
+ rotationY: 0,
642
+ opacity: finalOpacity(target),
643
+ transformOrigin: "50% 50%"
644
+ });
645
+ }
646
+ function expandRight(target, delay, dur, ease) {
647
+ const e = easeOf(ease);
648
+ const tl = gsap.gsap.timeline();
649
+ tl.set(target, { transformOrigin: "100% 50%" }).fromTo(target, {
650
+ opacity: 1,
651
+ scaleX: 0
652
+ }, {
653
+ ease: e,
654
+ duration: dur,
655
+ delay,
656
+ scaleX: 1,
657
+ opacity: finalOpacity(target)
658
+ });
659
+ return tl;
660
+ }
661
+ function expandLeft(target, delay, dur, ease) {
662
+ const e = easeOf(ease);
663
+ const tl = gsap.gsap.timeline();
664
+ tl.set(target, { transformOrigin: "0% 50%" }).fromTo(target, {
665
+ opacity: 1,
666
+ scaleX: 0
667
+ }, {
668
+ ease: e,
669
+ duration: dur,
670
+ delay,
671
+ scaleX: 1,
672
+ opacity: finalOpacity(target)
673
+ });
674
+ return tl;
675
+ }
676
+ function expandUp(target, delay, dur, ease) {
677
+ const e = easeOf(ease);
678
+ const tl = gsap.gsap.timeline();
679
+ tl.set(target, { transformOrigin: "50% 100%" }).fromTo(target, {
680
+ opacity: 1,
681
+ scaleY: 0
682
+ }, {
683
+ ease: e,
684
+ duration: dur,
685
+ delay,
686
+ scaleY: 1,
687
+ opacity: finalOpacity(target)
688
+ });
689
+ return tl;
690
+ }
691
+ function expandDown(target, delay, dur, ease) {
692
+ const e = easeOf(ease);
693
+ const tl = gsap.gsap.timeline();
694
+ tl.set(target, { transformOrigin: "50% 0%" }).fromTo(target, {
695
+ opacity: 1,
696
+ scaleY: 0
697
+ }, {
698
+ ease: e,
699
+ duration: dur,
700
+ delay,
701
+ scaleY: 1,
702
+ opacity: finalOpacity(target)
703
+ });
704
+ return tl;
705
+ }
706
+ function countTargetVars(target) {
707
+ if (target._countTarget) return target._countTarget;
708
+ const match = (target.textContent || "0").replace(/,/g, "").match(/-?\d+(?:\.\d+)?/);
709
+ const end = match ? parseFloat(match[0]) : 0;
710
+ const decimals = match?.[0].includes(".") ? (match[0].split(".")[1] || "").length : 0;
711
+ const startCls = getActivePrefixedClassMod(target, "spawn-num-");
712
+ return target._countTarget = {
713
+ start: startCls ? parseFloat(startCls.slice(startCls.indexOf("spawn-num-") + 10)) : 0,
714
+ end,
715
+ decimals
716
+ };
717
+ }
718
+ function countUp(target, delay, dur, ease) {
719
+ const e = easeOf(ease);
720
+ const { start, end, decimals } = countTargetVars(target);
721
+ const obj = { n: start };
722
+ return gsap.gsap.timeline({ delay }).fromTo(obj, { n: start }, {
723
+ n: end,
724
+ duration: dur,
725
+ ease: e,
726
+ onUpdate: () => {
727
+ target.textContent = obj.n.toFixed(decimals);
728
+ }
729
+ }, 0);
730
+ }
731
+ var fillTimeOf = (el, fallback) => {
732
+ const m = getActivePrefixedClassMod(el, "fill-time-");
733
+ return m ? Number(m.slice(m.indexOf("fill-time-") + 10)) : fallback * .5;
734
+ };
735
+ var fillEaseOf = (el, fallbackEase) => {
736
+ const m = getActivePrefixedClassMod(el, "fill-ease-");
737
+ return m ? m.slice(m.indexOf("fill-ease-") + 10) : fallbackEase;
738
+ };
739
+ function drawsvg(target, delay, dur, ease) {
740
+ const e = easeOf(ease);
741
+ const first = gsap.gsap.utils.toArray(target)[0];
742
+ if (!(!!first && hasGClassMod(first, "fill-svg"))) return gsap.gsap.fromTo(target, { drawSVG: "0%" }, {
743
+ ease: e,
744
+ duration: dur,
745
+ delay,
746
+ drawSVG: "100%"
747
+ });
748
+ const fillDur = fillTimeOf(first, dur);
749
+ const fillEase = fillEaseOf(first, ease);
750
+ const fillTargets = gsap.gsap.utils.toArray(target).filter((el) => hasGClassMod(el, "fill-svg"));
751
+ const tl = gsap.gsap.timeline({ delay });
752
+ if (fillTargets.length) gsap.gsap.set(fillTargets, { fillOpacity: 0 });
753
+ tl.fromTo(target, { drawSVG: "0%" }, {
754
+ ease: e,
755
+ duration: dur,
756
+ drawSVG: "100%"
757
+ });
758
+ if (fillTargets.length) tl.fromTo(fillTargets, { fillOpacity: 0 }, {
759
+ ease: easeOf(fillEase),
760
+ duration: fillDur,
761
+ fillOpacity: 1
762
+ });
763
+ return tl;
764
+ }
765
+ function splitPaths(paths) {
766
+ const toSplit = gsap.gsap.utils.toArray(paths);
767
+ let newPaths = [];
768
+ if (toSplit.length > 1) {
769
+ toSplit.forEach((path) => newPaths.push(...splitPaths(path)));
770
+ return newPaths;
771
+ }
772
+ const path = toSplit[0];
773
+ if (!path) return newPaths;
774
+ if (path._gcSplitPaths?.[0]?.isConnected) return path._gcSplitPaths;
775
+ const rawPath = gsap_all.MotionPathPlugin.getRawPath(path);
776
+ const parent = path.parentNode;
777
+ const attributes = [...path.attributes];
778
+ newPaths = rawPath.map((segment) => {
779
+ const newPath = document.createElementNS("http://www.w3.org/2000/svg", "path");
780
+ let i = attributes.length;
781
+ while (i--) {
782
+ const attr = attributes[i];
783
+ if (attr.nodeName === "class") {
784
+ const filtered = attr.nodeValue.split(/\s+/).filter((c) => c && c !== "appear" && c !== "scroll" && c !== "scroll-progress" && c !== "draw" && c !== "draw-split").join(" ");
785
+ if (filtered) newPath.setAttributeNS(null, "class", filtered);
786
+ continue;
787
+ }
788
+ if (attr.nodeName.startsWith("data-gsap")) continue;
789
+ newPath.setAttributeNS(null, attr.nodeName, attr.nodeValue);
790
+ }
791
+ newPath.setAttributeNS(null, "d", "M" + segment[0] + "," + segment[1] + "C" + segment.slice(2).join(",") + (segment.closed ? "z" : ""));
792
+ newPath.dataset.gsapSplit = "1";
793
+ newPath.style.contain = "paint";
794
+ newPath.style.willChange = "transform";
795
+ parent.insertBefore(newPath, path);
796
+ return newPath;
797
+ });
798
+ parent.removeChild(path);
799
+ return path._gcSplitPaths = newPaths;
800
+ }
801
+ function drawsvgSplit(target, delay, dur, ease) {
802
+ const e = easeOf(ease);
803
+ const first = gsap.gsap.utils.toArray(target)[0];
804
+ const hasFill = !!first && hasGClassMod(first, "fill-svg");
805
+ const fillDur = hasFill ? fillTimeOf(first, dur) : 0;
806
+ const fillEase = hasFill ? fillEaseOf(first, ease) : ease;
807
+ const tl = gsap.gsap.timeline({ delay });
808
+ const paths = splitPaths(target);
809
+ let distance = 0;
810
+ paths.forEach((segment) => distance += segment.getTotalLength());
811
+ if (!distance) return tl;
812
+ if (hasFill && paths.length) gsap.gsap.set(paths, { fillOpacity: 0 });
813
+ paths.forEach((segment) => {
814
+ tl.fromTo(segment, { drawSVG: "0%" }, {
815
+ ease: e,
816
+ duration: dur * (segment.getTotalLength() / distance),
817
+ drawSVG: "100%"
818
+ });
819
+ });
820
+ if (hasFill && paths.length) tl.fromTo(paths, { fillOpacity: 0 }, {
821
+ ease: easeOf(fillEase),
822
+ duration: fillDur,
823
+ fillOpacity: 1
824
+ });
825
+ return tl;
826
+ }
827
+ var scrambleSegments = (target) => {
828
+ let wraps = target._gcScrambleSegs;
829
+ if (!wraps || !wraps.length || !wraps.every((w) => w.parentNode === target)) {
830
+ wraps = [];
831
+ [...target.childNodes].forEach((node) => {
832
+ if (node.nodeType !== 3 || !node.textContent.trim()) return;
833
+ const raw = node.textContent;
834
+ const core = raw.trim();
835
+ const leadIdx = raw.indexOf(core[0]);
836
+ const trailStart = leadIdx + core.length;
837
+ const frag = document.createDocumentFragment();
838
+ if (leadIdx > 0) frag.appendChild(document.createTextNode(raw.slice(0, leadIdx)));
839
+ const span = document.createElement("span");
840
+ span.textContent = core;
841
+ frag.appendChild(span);
842
+ if (trailStart < raw.length) frag.appendChild(document.createTextNode(raw.slice(trailStart)));
843
+ target.insertBefore(frag, node);
844
+ target.removeChild(node);
845
+ wraps.push(span);
846
+ });
847
+ target._gcScrambleSegs = wraps;
848
+ }
849
+ return wraps.map((w) => ({
850
+ t: w,
851
+ text: w.textContent
852
+ }));
853
+ };
854
+ function scrambleVars(target) {
855
+ const num = (prefix, fallback) => {
856
+ const c = getActivePrefixedClassMod(target, prefix);
857
+ if (!c) return fallback;
858
+ const idx = c.indexOf(prefix);
859
+ const n = Number(c.slice(idx + prefix.length));
860
+ return Number.isNaN(n) ? fallback : n;
861
+ };
862
+ let charsCls = null;
863
+ let bestPx = -2;
864
+ const { re: reChars, map: mapChars } = getBpDataMod();
865
+ for (const c of target.classList) {
866
+ let bp = null, core = c;
867
+ const m = c.match(reChars);
868
+ if (m) {
869
+ bp = m[1];
870
+ core = m[2];
871
+ }
872
+ if (!/^chars-\[(.*)\]$/.test(core)) continue;
873
+ if (bp && !isBreakpointActiveMod(bp)) continue;
874
+ const px = bp ? mapChars[bp] : -1;
875
+ if (px > bestPx) {
876
+ charsCls = core;
877
+ bestPx = px;
878
+ }
879
+ }
880
+ return {
881
+ segs: scrambleSegments(target),
882
+ chars: charsCls ? charsCls.slice(7, -1) : defaults.characterlist,
883
+ speed: num("amount-", 1),
884
+ revealDelay: num("reveal-delay-", defaults.revealDelay),
885
+ rtl: hasGClassMod(target, "scramble-rtl")
886
+ };
887
+ }
888
+ function scramble(target, delay, dur, ease) {
889
+ const e = getActivePrefixedClassMod(target, "ease-") ? easeOf(ease) : "none";
890
+ const { segs, chars, speed, revealDelay, rtl } = scrambleVars(target);
891
+ const all = hasGClassMod(target, "scramble-all");
892
+ const tl = gsap.gsap.timeline({ delay });
893
+ segs.forEach(({ t, text }) => {
894
+ if (all) tl.to(t, {
895
+ scrambleText: {
896
+ text,
897
+ chars,
898
+ speed,
899
+ revealDelay,
900
+ rightToLeft: rtl
901
+ },
902
+ ease: e,
903
+ duration: dur
904
+ }, 0);
905
+ else tl.fromTo(t, { scrambleText: {
906
+ text: "",
907
+ chars
908
+ } }, {
909
+ scrambleText: {
910
+ text,
911
+ chars,
912
+ speed,
913
+ revealDelay,
914
+ rightToLeft: rtl
915
+ },
916
+ ease: e,
917
+ duration: dur
918
+ }, 0);
919
+ });
920
+ return tl;
921
+ }
922
+ function verticalmove(target, amount, dur, ease) {
923
+ const e = easeOf(ease);
924
+ return gsap.gsap.to(target, {
925
+ y: amount,
926
+ scale: 1 + amount / 1e3,
927
+ duration: dur,
928
+ ease: e
929
+ });
930
+ }
931
+ function expandmove(target, amount, dur, ease) {
932
+ return gsap.gsap.to(target, {
933
+ scale: amount / 10,
934
+ duration: dur,
935
+ ease: easeOf(ease)
936
+ });
937
+ }
938
+ function magnet(target, x, y, scale, dur, ease) {
939
+ return gsap.gsap.to(target, {
940
+ x,
941
+ y,
942
+ scale,
943
+ duration: dur,
944
+ ease: easeOf(ease),
945
+ overwrite: "auto"
946
+ });
947
+ }
948
+ function magnet3d(target, x, y, scale, rotX, rotY, dur, ease) {
949
+ return gsap.gsap.to(target, {
950
+ x,
951
+ y,
952
+ scale,
953
+ rotationX: rotX,
954
+ rotationY: rotY,
955
+ transformOrigin: "50% 50%",
956
+ transformPerspective: 600,
957
+ duration: dur,
958
+ ease: easeOf(ease),
959
+ overwrite: "auto"
960
+ });
961
+ }
962
+ function reset(target, dur, ease) {
963
+ gsap.gsap.to(target, {
964
+ x: 0,
965
+ y: 0,
966
+ scale: 1,
967
+ duration: dur / 2,
968
+ ease
969
+ });
970
+ }
971
+ function spinCW(target, delay, dur, ease) {
972
+ const e = easeOf(ease);
973
+ const tl = gsap.gsap.timeline();
974
+ tl.fromTo(target, {
975
+ scale: 1,
976
+ rotation: 0
977
+ }, {
978
+ ease: e,
979
+ duration: dur,
980
+ delay,
981
+ rotation: 360
982
+ }).to(target, {
983
+ scale: 1,
984
+ duration: delay
985
+ });
986
+ return tl;
987
+ }
988
+ function spinCCW(target, delay, dur, ease) {
989
+ const e = easeOf(ease);
990
+ const tl = gsap.gsap.timeline();
991
+ tl.fromTo(target, {
992
+ scale: 1,
993
+ rotation: 0
994
+ }, {
995
+ ease: e,
996
+ duration: dur,
997
+ delay,
998
+ rotation: -360
999
+ }).to(target, {
1000
+ scale: 1,
1001
+ duration: delay
1002
+ });
1003
+ return tl;
1004
+ }
1005
+ function bounce(delay, target, amount, dur, ease) {
1006
+ const e = easeOf(ease);
1007
+ const tl = gsap.gsap.timeline();
1008
+ tl.set(target, { transformOrigin: "50% 100%" }).to(target, {
1009
+ y: -amount - amount * .25,
1010
+ scaleX: .97,
1011
+ scaleY: 1.03,
1012
+ duration: dur * .48,
1013
+ ease: "power1.out"
1014
+ }).to(target, {
1015
+ y: 0,
1016
+ scaleX: 1.08,
1017
+ scaleY: .88,
1018
+ duration: dur * .3,
1019
+ ease: "power2.in"
1020
+ }).to(target, {
1021
+ y: 0,
1022
+ scaleX: 1,
1023
+ scaleY: 1,
1024
+ duration: dur * .12,
1025
+ ease: e
1026
+ }).to(target, {
1027
+ x: 0,
1028
+ duration: delay
1029
+ });
1030
+ return tl;
1031
+ }
1032
+ function shake(delay, target, amount, dur, ease) {
1033
+ const tl = gsap.gsap.timeline();
1034
+ tl.to(target, {
1035
+ x: amount,
1036
+ duration: dur * .1,
1037
+ ease: "power2.out"
1038
+ }).to(target, {
1039
+ x: -amount * .8,
1040
+ duration: dur * .15,
1041
+ ease: "power2.inOut"
1042
+ }).to(target, {
1043
+ x: amount * .5,
1044
+ duration: dur * .2,
1045
+ ease: "power2.inOut"
1046
+ }).to(target, {
1047
+ x: -amount * .25,
1048
+ duration: dur * .2,
1049
+ ease: "power2.inOut"
1050
+ }).to(target, {
1051
+ x: 0,
1052
+ duration: dur * .2,
1053
+ ease: easeOf(ease)
1054
+ }).to(target, {
1055
+ x: 0,
1056
+ duration: delay
1057
+ });
1058
+ return tl;
1059
+ }
1060
+ function bell(delay, target, amount, dur, ease) {
1061
+ const tl = gsap.gsap.timeline();
1062
+ tl.set(target, { transformOrigin: "50% 0%" }).to(target, {
1063
+ rotate: amount,
1064
+ duration: dur * .12,
1065
+ ease: "power2.out"
1066
+ }).to(target, {
1067
+ rotate: -amount * .7,
1068
+ duration: dur * .18,
1069
+ ease: "power2.inOut"
1070
+ }).to(target, {
1071
+ rotate: amount * .4,
1072
+ duration: dur * .22,
1073
+ ease: "power2.inOut"
1074
+ }).to(target, {
1075
+ rotate: -amount * .15,
1076
+ duration: dur * .22,
1077
+ ease: "power2.inOut"
1078
+ }).to(target, {
1079
+ rotate: 0,
1080
+ duration: dur * .2,
1081
+ ease: easeOf(ease)
1082
+ }).to(target, {
1083
+ rotate: 0,
1084
+ duration: delay
1085
+ });
1086
+ return tl;
1087
+ }
1088
+ function pulse(delay, target, amount, dur, ease) {
1089
+ const e = easeOf(ease);
1090
+ const tl = gsap.gsap.timeline();
1091
+ tl.to(target, {
1092
+ scale: amount / 10 * 1.05,
1093
+ duration: dur * .35,
1094
+ ease: "power2.out"
1095
+ }).to(target, {
1096
+ scale: 1,
1097
+ duration: dur * .45,
1098
+ ease: e
1099
+ }).to(target, {
1100
+ scale: 1,
1101
+ duration: delay
1102
+ });
1103
+ return tl;
1104
+ }
1105
+ function radiate(delay, target, amount, dur, ease, zIndex) {
1106
+ const clone = target.cloneNode(true);
1107
+ clone.setAttribute("data-gsap-radiate", "1");
1108
+ clone.style.cssText = `position:fixed;left:0;top:0;right:auto;bottom:auto;margin:0;pointer-events:none;transform-origin:50% 50%;${zIndex != null ? `z-index:${zIndex};` : ""}`;
1109
+ let tick = false;
1110
+ const applyRect = () => {
1111
+ const r = target.getBoundingClientRect();
1112
+ clone.style.left = `${r.left}px`;
1113
+ clone.style.top = `${r.top}px`;
1114
+ clone.style.width = `${r.width}px`;
1115
+ clone.style.height = `${r.height}px`;
1116
+ };
1117
+ const schedule = () => {
1118
+ if (tick) return;
1119
+ tick = true;
1120
+ requestAnimationFrame(() => {
1121
+ tick = false;
1122
+ applyRect();
1123
+ });
1124
+ };
1125
+ if (!target.isConnected) return gsap.gsap.fromTo(clone, {}, { duration: 0 });
1126
+ document.body.appendChild(clone);
1127
+ applyRect();
1128
+ window.addEventListener("scroll", schedule, { passive: true });
1129
+ window.addEventListener("resize", schedule, { passive: true });
1130
+ let tween = null;
1131
+ const cleanup = () => {
1132
+ clone.remove();
1133
+ window.removeEventListener("scroll", schedule);
1134
+ window.removeEventListener("resize", schedule);
1135
+ if (observer) observer.disconnect();
1136
+ };
1137
+ const observer = new MutationObserver(() => {
1138
+ if (!target.isConnected) {
1139
+ if (tween) tween.kill();
1140
+ cleanup();
1141
+ }
1142
+ });
1143
+ observer.observe(document.body, {
1144
+ childList: true,
1145
+ subtree: true
1146
+ });
1147
+ tween = gsap.gsap.fromTo(clone, {
1148
+ scale: 1,
1149
+ opacity: 1
1150
+ }, {
1151
+ scale: amount / 10,
1152
+ opacity: 0,
1153
+ duration: dur,
1154
+ delay,
1155
+ ease: easeOf(ease),
1156
+ onComplete: () => {
1157
+ observer.disconnect();
1158
+ cleanup();
1159
+ },
1160
+ onInterrupt: () => {
1161
+ observer.disconnect();
1162
+ cleanup();
1163
+ }
1164
+ });
1165
+ return tween;
1166
+ }
1167
+ function hover(delay, target, amount, dur, ease) {
1168
+ const tl = gsap.gsap.timeline();
1169
+ tl.set(target, { transformOrigin: "50% 50%" }).to(target, {
1170
+ y: -amount,
1171
+ scaleX: .98,
1172
+ scaleY: 1.02,
1173
+ duration: dur / 2,
1174
+ ease: "sine.inOut"
1175
+ }).to(target, {
1176
+ y: 0,
1177
+ scaleX: 1,
1178
+ scaleY: 1,
1179
+ duration: dur / 2,
1180
+ ease: "sine.inOut"
1181
+ });
1182
+ return tl;
1183
+ }
1184
+ function marquee(target, dir, duration, xOffset = 0, yOffset = 0, noRepeat = false) {
1185
+ const horizontal = dir === "left" || dir === "right";
1186
+ target.style.position = "relative";
1187
+ target.style.overflow = "hidden";
1188
+ let track = target._gcTrack;
1189
+ if (!track || !track.isConnected) {
1190
+ track = document.createElement("div");
1191
+ track.style.cssText = `position:absolute;top:${yOffset}px;left:${xOffset}px;display:flex;flex-direction:${horizontal ? "row" : "column"};width:max-content;will-change:transform;`;
1192
+ while (target.firstChild) track.appendChild(target.firstChild);
1193
+ target.appendChild(track);
1194
+ while (track.children.length && [...track.children].every((c) => c.style.position === "absolute" && c.style.display === "flex")) {
1195
+ const inner = track.firstElementChild;
1196
+ while (inner.firstChild) track.insertBefore(inner.firstChild, inner);
1197
+ track.removeChild(inner);
1198
+ }
1199
+ target._gcUnitHtml = track.innerHTML;
1200
+ }
1201
+ track.style.flexDirection = horizontal ? "row" : "column";
1202
+ const unitHtml = target._gcUnitHtml;
1203
+ const measurer = document.createElement("div");
1204
+ measurer.style.cssText = track.style.cssText + "visibility:hidden;";
1205
+ measurer.innerHTML = unitHtml;
1206
+ target.appendChild(measurer);
1207
+ const unitSize = horizontal ? measurer.scrollWidth : measurer.scrollHeight;
1208
+ measurer.remove();
1209
+ if (!unitSize) return gsap.gsap.fromTo(track, {}, { duration: 0 });
1210
+ if (target.offsetHeight === 0 && track.offsetHeight > 0) target.style.height = track.offsetHeight + "px";
1211
+ let copies;
1212
+ if (noRepeat) copies = 2;
1213
+ else {
1214
+ const viewport = horizontal ? target.offsetWidth : target.offsetHeight;
1215
+ copies = Math.max(2, Math.ceil(viewport / unitSize) + 1);
1216
+ }
1217
+ track.innerHTML = unitHtml.repeat(copies);
1218
+ const dist = unitSize;
1219
+ const vars = {
1220
+ duration,
1221
+ ease: "none"
1222
+ };
1223
+ if (dir === "right") return gsap.gsap.fromTo(track, { x: -dist }, {
1224
+ x: 0,
1225
+ ...vars
1226
+ });
1227
+ if (dir === "up") return gsap.gsap.fromTo(track, { y: 0 }, {
1228
+ y: -dist,
1229
+ ...vars
1230
+ });
1231
+ if (dir === "down") return gsap.gsap.fromTo(track, { y: -dist }, {
1232
+ y: 0,
1233
+ ...vars
1234
+ });
1235
+ return gsap.gsap.fromTo(track, { x: 0 }, {
1236
+ x: -dist,
1237
+ ...vars
1238
+ });
1239
+ }
1240
+ function flip(state, ease, dur) {
1241
+ gsap_all.Flip.from(state, {
1242
+ duration: dur,
1243
+ ease: ease || DEFAULT_EASE
1244
+ });
1245
+ }
1246
+ function animatecss(target, dur, delay, ease, propertyS, propertySValue, propertyE, propertyEValue) {
1247
+ return gsap.gsap.fromTo(target, { [propertyS]: propertySValue }, {
1248
+ [propertyE]: propertyEValue,
1249
+ ease,
1250
+ duration: dur,
1251
+ delay
1252
+ });
1253
+ }
1254
+ //#endregion
1255
+ //#region CustomAnims.js
1256
+ var customAnims = [{
1257
+ sel: ".whirl",
1258
+ from: {
1259
+ opacity: 0,
1260
+ rotation: 90,
1261
+ scale: .7
1262
+ },
1263
+ play: (el, delay, dur, ease) => gsap.gsap.fromTo(el, {
1264
+ opacity: 0,
1265
+ rotation: 90,
1266
+ scale: .7
1267
+ }, {
1268
+ ease,
1269
+ duration: dur,
1270
+ delay,
1271
+ rotation: 0,
1272
+ scale: 1,
1273
+ opacity: 1,
1274
+ transformOrigin: "center"
1275
+ })
1276
+ }, {
1277
+ sel: ".bounce-in",
1278
+ from: {
1279
+ opacity: 0,
1280
+ scale: 0
1281
+ },
1282
+ play: (el, delay, dur, ease) => {
1283
+ const tl = gsap.gsap.timeline({
1284
+ delay,
1285
+ defaults: {
1286
+ ease,
1287
+ duration: dur / 3
1288
+ }
1289
+ });
1290
+ tl.fromTo(el, {
1291
+ scale: 0,
1292
+ opacity: 0
1293
+ }, {
1294
+ scale: 1.1,
1295
+ opacity: 1
1296
+ }).to(el, { scale: .95 }).to(el, { scale: 1 });
1297
+ return tl;
1298
+ }
1299
+ }];
1300
+ //#endregion
1301
+ //#region Listeners.js
1302
+ var TEXT_PREFIX = "spawn-text-";
1303
+ var TEXT_PREFIX_LEN = 11;
1304
+ var bpEntries = Object.entries(defaults.breakpoints || {}).sort((a, b) => a[1] - b[1]);
1305
+ var bpNames = bpEntries.map(([k]) => k);
1306
+ var bpMap = Object.fromEntries(bpEntries);
1307
+ var bpPrefixRE = bpNames.length ? new RegExp(`^(${bpNames.join("|")}):(.+)$`) : /^$^/;
1308
+ var isBreakpointActive = (bp) => {
1309
+ if (!bp) return true;
1310
+ const px = bpMap[bp];
1311
+ if (px == null) return true;
1312
+ if (typeof window === "undefined" || !window.matchMedia) return true;
1313
+ return window.matchMedia(`(min-width: ${px}px)`).matches;
1314
+ };
1315
+ var mqForBp = (bp) => `(min-width: ${bpMap[bp]}px)`;
1316
+ var elementMatchesSel = (el, sel) => {
1317
+ const base = sel.slice(1);
1318
+ if (el.classList.contains(base)) return true;
1319
+ for (const bp of bpNames) if (el.classList.contains(`${bp}:${base}`) && isBreakpointActive(bp)) return true;
1320
+ return false;
1321
+ };
1322
+ var hasGClass = (el, name) => {
1323
+ if (el.classList.contains(name)) return true;
1324
+ for (const bp of bpNames) if (el.classList.contains(`${bp}:${name}`) && isBreakpointActive(bp)) return true;
1325
+ return false;
1326
+ };
1327
+ var wrapQAll = (qAll) => (sel) => {
1328
+ if (sel.includes(",")) {
1329
+ const parts = sel.split(",").map((s) => s.trim()).filter(Boolean);
1330
+ const set = /* @__PURE__ */ new Set();
1331
+ parts.forEach((p) => wrapQAll(qAll)(p).forEach((e) => set.add(e)));
1332
+ return [...set];
1333
+ }
1334
+ if (sel === "body *") return qAll(sel);
1335
+ if (bpNames.some((bp) => sel.includes(`${bp}:`))) return qAll("body *").filter((el) => sel.split(",").some((s) => elementMatchesSel(el, s.trim())));
1336
+ try {
1337
+ const baseEls = qAll(sel);
1338
+ const variantEls = qAll("body *").filter((el) => {
1339
+ for (const bp of bpNames) if (el.classList.contains(`${bp}:${sel.slice(1)}`) && isBreakpointActive(bp)) return true;
1340
+ return false;
1341
+ });
1342
+ return [.../* @__PURE__ */ new Set([...baseEls, ...variantEls])];
1343
+ } catch {
1344
+ return qAll(sel);
1345
+ }
1346
+ };
1347
+ var completeHandlers = /* @__PURE__ */ new Map();
1348
+ function registerComplete(name, fn) {
1349
+ if (typeof fn === "function") completeHandlers.set(name, fn);
1350
+ return fn;
1351
+ }
1352
+ function resolveHandler(name) {
1353
+ if (completeHandlers.has(name)) return completeHandlers.get(name);
1354
+ if (typeof window !== "undefined" && typeof window[name] === "function") return window[name];
1355
+ return null;
1356
+ }
1357
+ var RANDOMIZE_RE = /^randomize-(\w+)-\[(-?[\d.]+)\]-\[(-?[\d.]+)\]$/;
1358
+ var hasRandom = (el) => typeof el.className === "string" && /\brandomize-/.test(el.className);
1359
+ var randomVars = (el) => {
1360
+ const rnd = {};
1361
+ for (const c of el.classList) {
1362
+ const m = c.match(RANDOMIZE_RE);
1363
+ if (m) rnd[m[1]] = () => gsap.gsap.utils.random(Number(m[2]), Number(m[3]));
1364
+ }
1365
+ return rnd;
1366
+ };
1367
+ var randomEnds = (keys) => Object.fromEntries(keys.map((k) => [k, k === "opacity" ? 1 : k === "filter" ? "blur(0px)" : k === "clipPath" ? "inset(0% 0% 0% 0%)" : k === "drawSVG" ? "100%" : k.startsWith("scale") ? 1 : 0]));
1368
+ var invokePlay = (config, el, delay, dur, ease) => {
1369
+ if (!hasRandom(el)) return config.play(el, delay, dur, ease);
1370
+ const rnd = randomVars(el);
1371
+ const keys = Object.keys(rnd);
1372
+ if (!keys.length) return config.play(el, delay, dur, ease);
1373
+ const ends = randomEnds(keys);
1374
+ const origFromTo = gsap.gsap.fromTo;
1375
+ gsap.gsap.fromTo = (t, from, to) => origFromTo(t, {
1376
+ ...from,
1377
+ ...rnd
1378
+ }, {
1379
+ ...ends,
1380
+ ...to
1381
+ });
1382
+ try {
1383
+ return config.play(el, delay, dur, ease);
1384
+ } finally {
1385
+ gsap.gsap.fromTo = origFromTo;
1386
+ }
1387
+ };
1388
+ function initListeners(root = document, throttlePerFrame) {
1389
+ if (typeof root === "number") {
1390
+ throttlePerFrame = root;
1391
+ root = document;
1392
+ }
1393
+ throttlePerFrame = Number(throttlePerFrame) || 0;
1394
+ gsap.gsap.registerPlugin(gsap_all.TextPlugin, gsap_all.ScrollTrigger, gsap_all.SplitText);
1395
+ const { all: animAll, spawnConfigs, loopConfigs } = normalize(customAnims);
1396
+ const qAll = (sel) => {
1397
+ if (root === document || root === document.documentElement || root === document.body) return gsap.gsap.utils.toArray(sel);
1398
+ if (sel === "body *") return gsap.gsap.utils.toArray(root.querySelectorAll("*"));
1399
+ try {
1400
+ const els = [...root.querySelectorAll ? root.querySelectorAll(sel) : []];
1401
+ if (root.matches?.(sel)) els.unshift(root);
1402
+ return els;
1403
+ } catch {
1404
+ return gsap.gsap.utils.toArray(sel);
1405
+ }
1406
+ };
1407
+ const mm = gsap.gsap.matchMedia();
1408
+ const breakpointContexts = [];
1409
+ const getGateBpForSel = (el, sel) => {
1410
+ const base = sel.slice(1);
1411
+ for (const bp of bpNames) if (el.classList.contains(`${bp}:${base}`)) return bp;
1412
+ return null;
1413
+ };
1414
+ const getElGateBp = (el) => {
1415
+ for (const c of el.classList) {
1416
+ const m = c.match(bpPrefixRE);
1417
+ if (m) return m[1];
1418
+ }
1419
+ return null;
1420
+ };
1421
+ const runWithBreakpoint = (el, fn) => {
1422
+ const bp = getElGateBp(el);
1423
+ if (!bp) {
1424
+ fn();
1425
+ return;
1426
+ }
1427
+ const mq = mqForBp(bp);
1428
+ const ret = mm.add(mq, fn);
1429
+ breakpointContexts.push(ret);
1430
+ };
1431
+ const runWithBreakpointForSel = (el, sel, fn) => {
1432
+ const bp = getGateBpForSel(el, sel);
1433
+ if (!bp) {
1434
+ fn();
1435
+ return;
1436
+ }
1437
+ const mq = mqForBp(bp);
1438
+ const ret = mm.add(mq, fn);
1439
+ breakpointContexts.push(ret);
1440
+ };
1441
+ const qAllAllVariants = (sel) => {
1442
+ const base = sel.slice(1);
1443
+ return qAll("body *").filter((el) => el.classList.contains(base) || bpNames.some((bp) => el.classList.contains(`${bp}:${base}`)));
1444
+ };
1445
+ const qAllActive = wrapQAll(qAll);
1446
+ const registeredListeners = [];
1447
+ const onCompleteTweens = [];
1448
+ const addListener = (el, type, fn) => {
1449
+ el.addEventListener(type, fn);
1450
+ registeredListeners.push({
1451
+ el,
1452
+ type,
1453
+ fn
1454
+ });
1455
+ };
1456
+ const getActivePrefixedClass = (el, prefix) => {
1457
+ let best = null;
1458
+ let bestPx = -2;
1459
+ for (const c of el.classList) {
1460
+ let bp = null;
1461
+ let core = c;
1462
+ const m = c.match(bpPrefixRE);
1463
+ if (m) {
1464
+ bp = m[1];
1465
+ core = m[2];
1466
+ }
1467
+ if (!core.startsWith(prefix)) continue;
1468
+ if (bp && !isBreakpointActive(bp)) continue;
1469
+ const px = bp ? bpMap[bp] : -1;
1470
+ if (px > bestPx) {
1471
+ best = c;
1472
+ bestPx = px;
1473
+ }
1474
+ }
1475
+ return best;
1476
+ };
1477
+ const extractNumber = (cls, prefix) => {
1478
+ const idx = cls.indexOf(prefix);
1479
+ if (idx === -1) return NaN;
1480
+ return Number(cls.slice(idx + prefix.length));
1481
+ };
1482
+ const readClassNumber = (el, prefix, fallback) => {
1483
+ const match = getActivePrefixedClass(el, prefix);
1484
+ if (!match) return fallback;
1485
+ const n = extractNumber(match, prefix);
1486
+ return Number.isNaN(n) ? fallback : n;
1487
+ };
1488
+ const getEase = (el) => {
1489
+ const match = getActivePrefixedClass(el, "ease-");
1490
+ if (!match) return defaults.ease;
1491
+ const idx = match.indexOf("ease-");
1492
+ return match.slice(idx + 5) || defaults.ease;
1493
+ };
1494
+ const reducedMotion = () => (typeof window !== "undefined" && window.matchMedia?.(`(prefers-reduced-motion: reduce)`)?.matches) ?? false;
1495
+ const isReduced = (el) => reducedMotion() && hasGClass(el, "reduced");
1496
+ const isPreserved = (el) => {
1497
+ if (!el.dataset.gsapWired) return false;
1498
+ for (let node = el; node && node.nodeType === 1; node = node.parentElement) if (node.classList.contains("preserve") && node.dataset.gsapPreserved) return true;
1499
+ return false;
1500
+ };
1501
+ const markPreserved = (el) => {
1502
+ for (let node = el; node && node.nodeType === 1; node = node.parentElement) if (node.classList.contains("preserve")) node.dataset.gsapPreserved = "1";
1503
+ };
1504
+ const underPreservedRoot = (el) => {
1505
+ for (let node = el; node && node.nodeType === 1; node = node.parentElement) if (node.classList.contains("preserve") && node.dataset.gsapPreserved) return true;
1506
+ return false;
1507
+ };
1508
+ const findSpawn = (el) => {
1509
+ const direct = spawnConfigs.find(({ sel }) => elementMatchesSel(el, sel));
1510
+ if (direct) return direct;
1511
+ for (const c of el.classList) {
1512
+ let base = c;
1513
+ let bp = null;
1514
+ const m = c.match(bpPrefixRE);
1515
+ if (m) {
1516
+ bp = m[1];
1517
+ base = m[2];
1518
+ }
1519
+ if (!base.startsWith(TEXT_PREFIX)) continue;
1520
+ if (bp && !isBreakpointActive(bp)) continue;
1521
+ const found = spawnConfigs.find(({ sel }) => sel === "." + base.slice(TEXT_PREFIX_LEN));
1522
+ if (found) return found;
1523
+ }
1524
+ return null;
1525
+ };
1526
+ const leaveStates = /* @__PURE__ */ new WeakMap();
1527
+ const captureLeave = (node) => {
1528
+ if (!hasGClass(node, "leave")) return;
1529
+ const config = findSpawn(node);
1530
+ if (!config || config.typewriter) return;
1531
+ leaveStates.set(node, {
1532
+ html: node.outerHTML,
1533
+ rect: node.getBoundingClientRect(),
1534
+ tween: node._spawnTween || node._scrollTween,
1535
+ from: config.from,
1536
+ ease: getEase(node),
1537
+ parent: node.parentNode,
1538
+ next: node.nextElementSibling,
1539
+ margin: getComputedStyle(node).margin,
1540
+ zIndex: getComputedStyle(node).zIndex
1541
+ });
1542
+ };
1543
+ const flipStates = /* @__PURE__ */ new WeakMap();
1544
+ const flipping = /* @__PURE__ */ new WeakSet();
1545
+ const flipPos = (node) => {
1546
+ const r = node.getBoundingClientRect();
1547
+ return {
1548
+ x: r.x + window.scrollX,
1549
+ y: r.y + window.scrollY,
1550
+ w: r.width,
1551
+ h: r.height
1552
+ };
1553
+ };
1554
+ const captureFlip = (node) => {
1555
+ if (!hasGClass(node, "flip")) return;
1556
+ const config = findSpawn(node);
1557
+ if (!config || config.typewriter) return;
1558
+ if (flipping.has(node)) return;
1559
+ flipStates.set(node, flipPos(node));
1560
+ };
1561
+ const playFlip = (node) => {
1562
+ if (node._flipTween) {
1563
+ node._flipTween.kill();
1564
+ node._flipTween = null;
1565
+ gsap.gsap.set(node, { clearProps: "transform" });
1566
+ flipping.delete(node);
1567
+ }
1568
+ const old = flipStates.get(node);
1569
+ const cur = flipPos(node);
1570
+ flipStates.set(node, cur);
1571
+ if (!old) return;
1572
+ const dx = Math.round(old.x - cur.x);
1573
+ const dy = Math.round(old.y - cur.y);
1574
+ if (!dx && !dy) return;
1575
+ flipping.add(node);
1576
+ node._flipTween = gsap.gsap.fromTo(node, {
1577
+ x: dx,
1578
+ y: dy
1579
+ }, {
1580
+ x: 0,
1581
+ y: 0,
1582
+ duration: readClassNumber(node, "time-", defaults.effectDuration),
1583
+ ease: getEase(node),
1584
+ onComplete: () => {
1585
+ flipping.delete(node);
1586
+ node._flipTween = null;
1587
+ }
1588
+ });
1589
+ };
1590
+ const playLeave = (node) => {
1591
+ const snap = leaveStates.get(node);
1592
+ leaveStates.delete(node);
1593
+ if (!snap || node._leaving) return;
1594
+ node._leaving = true;
1595
+ const placeSpacer = (snap) => {
1596
+ if (!snap.parent || snap.parent.nodeType !== 1) return null;
1597
+ const spacer = document.createElement("div");
1598
+ spacer.style.cssText = `box-sizing:border-box;width:${snap.rect.width}px;height:${snap.rect.height}px;`;
1599
+ if (snap.margin) spacer.style.margin = snap.margin;
1600
+ const next = snap.next && snap.next.parentNode === snap.parent ? snap.next : null;
1601
+ snap.parent.insertBefore(spacer, next);
1602
+ return spacer;
1603
+ };
1604
+ if (snap.tween) {
1605
+ const reattached = !node.isConnected;
1606
+ const spacer = reattached ? placeSpacer(snap) : null;
1607
+ if (reattached) {
1608
+ node.classList.remove("leave", "appear", "scroll", "scroll-progress");
1609
+ node.style.cssText = `position:fixed;z-index:${snap.zIndex};left:${snap.rect.left}px;top:${snap.rect.top}px;
1610
+ width:${snap.rect.width}px;height:${snap.rect.height}px;margin:0;`;
1611
+ document.body.appendChild(node);
1612
+ }
1613
+ snap.tween.reverse();
1614
+ snap.tween.eventCallback("onReverseComplete", () => {
1615
+ if (reattached) node.remove();
1616
+ else node.style.display = "none";
1617
+ spacer?.remove();
1618
+ });
1619
+ return;
1620
+ }
1621
+ const ghost = document.createElement("div");
1622
+ ghost.innerHTML = snap.html;
1623
+ const g = ghost.firstElementChild;
1624
+ g.classList.remove("leave", "appear", "scroll", "scroll-progress");
1625
+ g.style.cssText = `position:fixed;z-index:${snap.zIndex};left:${snap.rect.left}px;top:${snap.rect.top}px;
1626
+ width:${snap.rect.width}px;height:${snap.rect.height}px;margin:0;`;
1627
+ document.body.appendChild(g);
1628
+ const spacer = placeSpacer(snap);
1629
+ gsap.gsap.to(g, {
1630
+ ...snap.from,
1631
+ duration: defaults.effectDuration,
1632
+ ease: snap.ease || defaults.ease,
1633
+ onComplete: () => {
1634
+ g.remove();
1635
+ spacer?.remove();
1636
+ }
1637
+ });
1638
+ };
1639
+ const collectLeave = (node) => {
1640
+ if (!node || node.nodeType !== 1) return [];
1641
+ if (node.classList && hasGClass(node, "leave")) return [node];
1642
+ const found = gsap.gsap.utils.toArray(node.querySelectorAll?.(".leave") || []);
1643
+ qAll("body *").filter((el) => hasGClass(el, "leave") && node.contains?.(el) && !found.includes(el)).forEach((el) => found.push(el));
1644
+ if (hasGClass(node, "leave") && !found.includes(node)) found.unshift(node);
1645
+ return found;
1646
+ };
1647
+ const refreshLeaveRect = (el) => {
1648
+ const s = leaveStates.get(el);
1649
+ if (s) {
1650
+ s.rect = el.getBoundingClientRect();
1651
+ s.tween = el._spawnTween || el._scrollTween || s.tween;
1652
+ }
1653
+ };
1654
+ const orderSelector = () => spawnConfigs.map(({ sel }) => sel).join(",") + "," + spawnConfigs.map(({ sel }) => ".spawn-text-" + sel.slice(1)).join(",");
1655
+ const getOrderDelay = (el, priority) => {
1656
+ const samepri = qAllActive(orderSelector()).filter((e) => {
1657
+ if (!hasGClass(e, "order")) return false;
1658
+ const match = [...e.classList].find((p) => p.startsWith("priority-"));
1659
+ return (match ? Number(match.split("-")[1]) : 0) === priority;
1660
+ });
1661
+ let order = samepri.indexOf(el);
1662
+ if (hasGClass(el, "reverse")) order = samepri.length - 1 - order;
1663
+ return order / defaults.orderDivide;
1664
+ };
1665
+ const readTiming = (el) => {
1666
+ const priority = readClassNumber(el, "priority-", 0);
1667
+ return {
1668
+ delay: hasGClass(el, "order") ? getOrderDelay(el, priority) : priority * defaults.spawnDelayMultiplier,
1669
+ duration: readClassNumber(el, "time-", 1),
1670
+ ease: getEase(el)
1671
+ };
1672
+ };
1673
+ const playNamed = (el, name) => {
1674
+ const entry = animAll.find((a) => a.sel === "." + name);
1675
+ if (!entry) return;
1676
+ const delay = readClassNumber(el, "complete-delay-", 0);
1677
+ const dur = readClassNumber(el, "complete-time-", 1);
1678
+ const tween = entry.play ? invokePlay(entry, el, delay, dur, getEase(el)) : entry.build(el, readLoopCtx(el));
1679
+ if (!tween) return;
1680
+ if (!entry.play) tween.delay(delay);
1681
+ el[name] = tween;
1682
+ onCompleteTweens.push(tween);
1683
+ };
1684
+ const fireOnComplete = (el, kind) => {
1685
+ const prefix = `on-${kind}-complete-`;
1686
+ const cls = [...el.classList].find((c) => c.startsWith(prefix));
1687
+ if (!cls) return;
1688
+ const val = cls.slice(prefix.length);
1689
+ if (val.startsWith("anim-")) playNamed(el, val.slice(5));
1690
+ else {
1691
+ const fn = resolveHandler(val);
1692
+ if (fn) fn(el);
1693
+ }
1694
+ };
1695
+ const scrollTriggers = [];
1696
+ const computeTo = (from) => {
1697
+ const to = {};
1698
+ for (const [key] of Object.entries(from || {})) if (key === "opacity") to[key] = 1;
1699
+ else if (key === "filter") to[key] = "blur(0px)";
1700
+ else if (key === "clipPath") to[key] = "inset(0% 0% 0% 0%)";
1701
+ else if (key === "drawSVG") to[key] = "100%";
1702
+ else to[key] = key.startsWith("scale") ? 1 : 0;
1703
+ return to;
1704
+ };
1705
+ const textSplits = [];
1706
+ const splitCache = /* @__PURE__ */ new WeakMap();
1707
+ const RTL_RE = /[\u0590-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/;
1708
+ const isRTLText = (el) => RTL_RE.test(el.textContent || "");
1709
+ const getGranularity = (el) => {
1710
+ if (hasGClass(el, "lines")) return "lines";
1711
+ if (hasGClass(el, "words")) return "words";
1712
+ if (hasGClass(el, "letter")) return "chars";
1713
+ return "words";
1714
+ };
1715
+ const RTL_NON_JOINABLE = /[اأإآدذرزوؤءة]/;
1716
+ const RTL_DIACRITICS = /[\u064B-\u065F\u0670]/g;
1717
+ const RTL_JOIN_BREAK = /[\u200C\u200D\s]/;
1718
+ const RTL_LETTER = /[\u0621-\u064A\u066E-\u06D5\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/;
1719
+ const getRTLCharSplit = (el) => new gsap_all.SplitText(el, {
1720
+ type: "words",
1721
+ linesClass: "gsap-line",
1722
+ wordsClass: "gsap-word",
1723
+ charsClass: "gsap-char",
1724
+ onSplit(self) {
1725
+ const ZWJ = "‍";
1726
+ const connects = (s) => !RTL_NON_JOINABLE.test(s.replace(RTL_DIACRITICS, "").slice(-1));
1727
+ self.chars.length = 0;
1728
+ self.words.forEach((wordEl) => {
1729
+ const chars = Array.from(wordEl.textContent);
1730
+ const segs = [];
1731
+ let i = 0;
1732
+ while (i < chars.length) {
1733
+ const c = chars[i];
1734
+ if (RTL_JOIN_BREAK.test(c)) {
1735
+ segs.push({
1736
+ text: c,
1737
+ brk: true
1738
+ });
1739
+ i++;
1740
+ continue;
1741
+ }
1742
+ if (!RTL_LETTER.test(c)) {
1743
+ segs.push({
1744
+ text: c,
1745
+ brk: false,
1746
+ letter: false
1747
+ });
1748
+ i++;
1749
+ continue;
1750
+ }
1751
+ let g = c;
1752
+ if (c === "ل" && i + 1 < chars.length) {
1753
+ let j = i + 1;
1754
+ let d = "";
1755
+ while (j < chars.length && RTL_DIACRITICS.test(chars[j])) d += chars[j++];
1756
+ if (j < chars.length && /[\u0622\u0623\u0625\u0627]/.test(chars[j])) {
1757
+ g += d + chars[j];
1758
+ i = j;
1759
+ }
1760
+ }
1761
+ while (i + 1 < chars.length && RTL_DIACRITICS.test(chars[i + 1])) {
1762
+ g += chars[i + 1];
1763
+ i++;
1764
+ }
1765
+ i++;
1766
+ segs.push({
1767
+ text: g,
1768
+ brk: false,
1769
+ letter: true
1770
+ });
1771
+ }
1772
+ wordEl.textContent = "";
1773
+ let prevConnectable = false;
1774
+ segs.forEach((seg, si) => {
1775
+ if (seg.brk) {
1776
+ wordEl.appendChild(document.createTextNode(seg.text));
1777
+ prevConnectable = false;
1778
+ return;
1779
+ }
1780
+ if (!seg.letter) {
1781
+ const pEl = document.createElement("div");
1782
+ pEl.style.display = "inline-block";
1783
+ pEl.className = "gsap-char";
1784
+ pEl.textContent = seg.text;
1785
+ wordEl.appendChild(pEl);
1786
+ self.chars.push(pEl);
1787
+ prevConnectable = false;
1788
+ return;
1789
+ }
1790
+ const connectable = connects(seg.text);
1791
+ let s = seg.text;
1792
+ if (prevConnectable) s = ZWJ + s;
1793
+ if (si + 1 < segs.length && segs[si + 1].letter && connectable) s += ZWJ;
1794
+ const charEl = document.createElement("div");
1795
+ charEl.style.display = "inline-block";
1796
+ charEl.className = "gsap-char";
1797
+ charEl.textContent = s;
1798
+ wordEl.appendChild(charEl);
1799
+ self.chars.push(charEl);
1800
+ prevConnectable = connectable;
1801
+ });
1802
+ });
1803
+ self.words.forEach((w) => w.replaceWith(...w.childNodes));
1804
+ self.words.length = 0;
1805
+ }
1806
+ });
1807
+ const wrapFlexTarget = (el) => {
1808
+ if (!/^(inline-)?flex$/.test(getComputedStyle(el).display)) return null;
1809
+ const wrappers = [];
1810
+ let run = [];
1811
+ const flush = () => {
1812
+ if (!run.length) return;
1813
+ const w = document.createElement("div");
1814
+ el.insertBefore(w, run[0]);
1815
+ run.forEach((n) => w.appendChild(n));
1816
+ wrappers.push(w);
1817
+ run = [];
1818
+ };
1819
+ [...el.childNodes].forEach((n) => {
1820
+ if (n.nodeType === 3 && n.textContent.trim()) run.push(n);
1821
+ else flush();
1822
+ });
1823
+ flush();
1824
+ if (!wrappers.length) return null;
1825
+ return () => wrappers.forEach((w) => {
1826
+ while (w.firstChild) el.insertBefore(w.firstChild, w);
1827
+ w.remove();
1828
+ });
1829
+ };
1830
+ const revertSplitInstance = (s) => {
1831
+ s.revert();
1832
+ s._gcFlexUnwrap?.();
1833
+ };
1834
+ const getSplit = (el, gran) => {
1835
+ let s = splitCache.get(el);
1836
+ const rtlChars = gran === "chars" && isRTLText(el);
1837
+ const key = rtlChars ? "rtl-chars" : gran;
1838
+ if (!s || s.granularity !== key) {
1839
+ if (s) revertSplitInstance(s);
1840
+ const hasN = el.textContent.includes("\n");
1841
+ if (hasN && el.style) el.style.whiteSpace = "pre-wrap";
1842
+ s = rtlChars ? getRTLCharSplit(el) : new gsap_all.SplitText(el, {
1843
+ type: gran,
1844
+ reduceWhiteSpace: hasN ? false : void 0,
1845
+ linesClass: "gsap-line",
1846
+ wordsClass: "gsap-word",
1847
+ charsClass: "gsap-char",
1848
+ onSplit(self) {
1849
+ for (const c of self.chars || []) if (c.textContent === "\n") {
1850
+ c.textContent = "";
1851
+ c.style.display = "block";
1852
+ c.style.width = "100%";
1853
+ c.style.height = "0";
1854
+ }
1855
+ for (const w of self.words || []) if (w.textContent.includes("\n")) w.style.whiteSpace = "pre-wrap";
1856
+ }
1857
+ });
1858
+ s._gcFlexUnwrap = wrapFlexTarget(el);
1859
+ s.granularity = key;
1860
+ splitCache.set(el, s);
1861
+ textSplits.push(s);
1862
+ }
1863
+ return s;
1864
+ };
1865
+ const getParts = (el, gran) => {
1866
+ const s = getSplit(el, gran);
1867
+ const parts = gran === "chars" && isRTLText(el) ? s.chars || [] : s[gran] || [];
1868
+ for (let i = 0; i < parts.length; i++) {
1869
+ parts[i].style.willChange = "transform, opacity";
1870
+ if (gran === "chars" || gran === "words") parts[i].style.display = "inline-block";
1871
+ }
1872
+ return parts;
1873
+ };
1874
+ const revertSplit = (el) => {
1875
+ if (hasGClass(el, "no-revert")) return;
1876
+ const s = splitCache.get(el);
1877
+ if (!s) return;
1878
+ splitCache.delete(el);
1879
+ const idx = textSplits.indexOf(s);
1880
+ if (idx !== -1) textSplits.splice(idx, 1);
1881
+ revertSplitInstance(s);
1882
+ };
1883
+ const playText = (el, from, delay, dur, ease) => {
1884
+ const gran = getGranularity(el);
1885
+ const parts = getParts(el, gran);
1886
+ if (!parts.length) return;
1887
+ const requestedStagger = readClassNumber(el, "stagger-", null);
1888
+ let stagger, duration;
1889
+ if (requestedStagger != null) {
1890
+ stagger = requestedStagger;
1891
+ duration = Math.max(dur - stagger * (parts.length - 1), defaults.minTextPartDuration);
1892
+ } else {
1893
+ duration = Math.min(dur, Math.max(dur / 3, defaults.minTextPartDuration));
1894
+ stagger = parts.length > 1 ? (dur - duration) / (parts.length - 1) : 0;
1895
+ }
1896
+ let rnd = null;
1897
+ if (hasRandom(el)) {
1898
+ rnd = randomVars(el);
1899
+ if (!Object.keys(rnd).length) rnd = null;
1900
+ }
1901
+ const effFrom = {
1902
+ ...from,
1903
+ ...rnd
1904
+ };
1905
+ return gsap.gsap.fromTo(parts, effFrom, {
1906
+ ...computeTo(effFrom),
1907
+ ease,
1908
+ duration,
1909
+ delay,
1910
+ stagger,
1911
+ onComplete: () => {
1912
+ if (hasGClass(el, "leave")) refreshLeaveRect(el);
1913
+ revertSplit(el);
1914
+ fireOnComplete(el, "spawn");
1915
+ }
1916
+ });
1917
+ };
1918
+ const playTypewriterSplit = (el, delay, dur, ease) => {
1919
+ const gran = getGranularity(el);
1920
+ const parts = getParts(el, gran);
1921
+ if (!parts.length) return;
1922
+ const perChar = dur / Math.max(parts.length, 1);
1923
+ return gsap.gsap.fromTo(parts, { opacity: 0 }, {
1924
+ opacity: 1,
1925
+ ease,
1926
+ duration: Math.min(defaults.typewriterSplitCharDuration, perChar),
1927
+ delay,
1928
+ stagger: perChar,
1929
+ onComplete: () => revertSplit(el)
1930
+ });
1931
+ };
1932
+ const textClsFor = (el) => [...el.classList].find((c) => c.startsWith(TEXT_PREFIX));
1933
+ const isTextElement = (el) => {
1934
+ const cls = textClsFor(el);
1935
+ if (!cls) return false;
1936
+ return !!spawnConfigs.find(({ sel }) => sel === "." + cls.slice(TEXT_PREFIX_LEN));
1937
+ };
1938
+ const setupPin = (el) => {
1939
+ if (!hasGClass(el, "pin") || el.dataset.gsapPinned) return;
1940
+ const clamp = (n) => Math.min(100, Math.max(0, n));
1941
+ const startClass = readClassNumber(el, "progress-start-", null);
1942
+ const endClass = readClassNumber(el, "progress-end-", null);
1943
+ const start = startClass != null ? `top ${clamp(100 - startClass)}%` : "top top";
1944
+ const end = endClass != null ? `top ${clamp(100 - endClass)}%` : "bottom top";
1945
+ const t = gsap_all.ScrollTrigger.create({
1946
+ trigger: el,
1947
+ start,
1948
+ end,
1949
+ pin: true,
1950
+ pinSpacing: true,
1951
+ anticipatePin: 1
1952
+ });
1953
+ el.dataset.gsapPinned = "1";
1954
+ scrollTriggers.push(t);
1955
+ };
1956
+ qAllAllVariants(".pin").forEach((el) => runWithBreakpointForSel(el, ".pin", () => setupPin(el)));
1957
+ const setupScrollDriven = (el) => {
1958
+ if (el.dataset?.gsapScrollDriven) return;
1959
+ el.dataset.gsapScrollDriven = "1";
1960
+ if (isReduced(el)) return;
1961
+ [...el.classList];
1962
+ const clamp = (n) => Math.min(100, Math.max(0, n));
1963
+ const parallaxCls = getActivePrefixedClass(el, "parallax-");
1964
+ if (parallaxCls) {
1965
+ const factor = parseFloat(parallaxCls.slice(parallaxCls.indexOf("parallax-") + 9)) || 1;
1966
+ if (factor === 1) return;
1967
+ const amt = (factor - 1) * 50;
1968
+ const t = gsap.gsap.fromTo(el, { yPercent: -amt }, {
1969
+ yPercent: amt,
1970
+ ease: "none",
1971
+ scrollTrigger: {
1972
+ trigger: el,
1973
+ start: "top bottom",
1974
+ end: "bottom top",
1975
+ scrub: true
1976
+ }
1977
+ });
1978
+ scrollTriggers.push(t.scrollTrigger);
1979
+ return;
1980
+ }
1981
+ if (hasGClass(el, "progress-bar") || hasGClass(el, "scroll-fill")) {
1982
+ const startClass = readClassNumber(el, "progress-start-", null);
1983
+ const endClass = readClassNumber(el, "progress-end-", null);
1984
+ const reverse = hasGClass(el, "progress-reverse");
1985
+ const t = gsap.gsap.fromTo(el, { scaleX: reverse ? 1 : 0 }, {
1986
+ scaleX: reverse ? 0 : 1,
1987
+ ease: "none",
1988
+ transformOrigin: "left center",
1989
+ scrollTrigger: {
1990
+ trigger: el,
1991
+ start: startClass != null ? `top ${clamp(100 - startClass)}%` : "top bottom",
1992
+ end: endClass != null ? `top ${clamp(100 - endClass)}%` : "bottom top",
1993
+ scrub: true
1994
+ }
1995
+ });
1996
+ scrollTriggers.push(t.scrollTrigger);
1997
+ return;
1998
+ }
1999
+ if (hasGClass(el, "scroll-fade-bg")) {
2000
+ const t = gsap.gsap.fromTo(el, { backgroundPosition: "0% 0%" }, {
2001
+ backgroundPosition: "100% 100%",
2002
+ ease: "none",
2003
+ scrollTrigger: {
2004
+ trigger: el,
2005
+ start: "top bottom",
2006
+ end: "bottom top",
2007
+ scrub: true
2008
+ }
2009
+ });
2010
+ scrollTriggers.push(t.scrollTrigger);
2011
+ return;
2012
+ }
2013
+ if (hasGClass(el, "scroll-horizontal")) {
2014
+ const track = el.querySelector(".scroll-track");
2015
+ if (!track) return;
2016
+ const getAmount = () => track.scrollWidth - el.clientWidth;
2017
+ const t = gsap.gsap.to(track, {
2018
+ x: () => -getAmount(),
2019
+ ease: "none",
2020
+ scrollTrigger: {
2021
+ trigger: el,
2022
+ start: "top top",
2023
+ end: () => `+=${getAmount()}`,
2024
+ pin: true,
2025
+ scrub: 1,
2026
+ anticipatePin: 1,
2027
+ invalidateOnRefresh: true
2028
+ }
2029
+ });
2030
+ scrollTriggers.push(t.scrollTrigger);
2031
+ }
2032
+ };
2033
+ qAll("body *").filter((el) => hasGClass(el, "progress-bar") || hasGClass(el, "scroll-fill") || hasGClass(el, "scroll-fade-bg") || hasGClass(el, "scroll-horizontal") || [...el.classList].some((c) => c.startsWith("parallax-") || bpNames.some((bp) => c.startsWith(`${bp}:parallax-`)))).forEach((el) => setupScrollDriven(el));
2034
+ const getScroller = (el) => {
2035
+ const frame = el.closest?.(".scroll-frame");
2036
+ return frame && frame !== el ? frame : void 0;
2037
+ };
2038
+ const setupScroll = (el) => {
2039
+ if (el.dataset?.gsapScroll) return;
2040
+ if (isTextElement(el)) return;
2041
+ if (isReduced(el)) return;
2042
+ el.dataset.gsapScroll = "1";
2043
+ const config = findSpawn(el);
2044
+ if (!config) return;
2045
+ const { from, typewriter: isTypewriter, typewriterSplit, play } = config;
2046
+ if (hasGClass(el, "scroll-progress")) {
2047
+ const ease = isTypewriter ? [...el.classList].find((c) => c.startsWith("ease-"))?.split("-")[1] ?? "none" : getEase(el);
2048
+ const to = {};
2049
+ for (const [key] of Object.entries(from || {})) if (key === "opacity") to[key] = 1;
2050
+ else if (key === "filter") to[key] = "blur(0px)";
2051
+ else if (key === "text") to[key] = stashText(el);
2052
+ else if (key === "clipPath") to[key] = "inset(0% 0% 0% 0%)";
2053
+ else if (key === "drawSVG") to[key] = "100%";
2054
+ else to[key] = key.startsWith("scale") ? 1 : 0;
2055
+ const startClass = readClassNumber(el, "progress-start-", null);
2056
+ const endClass = readClassNumber(el, "progress-end-", null);
2057
+ const clamp = (n) => Math.min(100, Math.max(0, n));
2058
+ const reverse = hasGClass(el, "progress-reverse");
2059
+ const rnd = !reverse && hasRandom(el) ? randomVars(el) : null;
2060
+ const rndEnds = rnd ? randomEnds(Object.keys(rnd)) : null;
2061
+ const tl = gsap.gsap.timeline({ scrollTrigger: {
2062
+ trigger: el,
2063
+ scroller: getScroller(el),
2064
+ start: startClass != null ? `top ${clamp(100 - startClass)}%` : defaults.progressStart,
2065
+ end: endClass != null ? `top ${clamp(100 - endClass)}%` : defaults.progressEnd,
2066
+ scrub: true
2067
+ } });
2068
+ if (config.count) {
2069
+ const { start, end, decimals } = countTargetVars(el);
2070
+ const obj = { n: reverse ? end : start };
2071
+ tl.fromTo(obj, { n: reverse ? end : start }, {
2072
+ n: reverse ? start : end,
2073
+ ease,
2074
+ onUpdate: () => {
2075
+ el.textContent = obj.n.toFixed(decimals);
2076
+ }
2077
+ }, 0);
2078
+ } else if (config.scramble) {
2079
+ const { segs, chars, speed, revealDelay, rtl } = scrambleVars(el);
2080
+ const all = el.classList.contains("scramble-all");
2081
+ segs.forEach(({ t, text }) => {
2082
+ if (all) tl.to(t, {
2083
+ scrambleText: {
2084
+ text,
2085
+ chars,
2086
+ speed,
2087
+ revealDelay,
2088
+ rightToLeft: rtl
2089
+ },
2090
+ ease
2091
+ }, 0);
2092
+ else tl.fromTo(t, { scrambleText: {
2093
+ text: reverse ? text : "",
2094
+ chars
2095
+ } }, {
2096
+ scrambleText: {
2097
+ text: reverse ? "" : text,
2098
+ chars,
2099
+ speed,
2100
+ revealDelay,
2101
+ rightToLeft: rtl
2102
+ },
2103
+ ease
2104
+ }, 0);
2105
+ });
2106
+ } else if (typewriterSplit) {
2107
+ const parts = getParts(el, getGranularity(el));
2108
+ if (parts.length) tl.fromTo(parts, { opacity: reverse ? 1 : 0 }, {
2109
+ opacity: reverse ? 0 : 1,
2110
+ ease
2111
+ });
2112
+ } else if (hasGClass(el, "fill-svg") && (hasGClass(el, "draw") || hasGClass(el, "draw-split"))) {
2113
+ const fillEaseCls = [...el.classList].find((c) => c.startsWith("fill-ease-"));
2114
+ const fillEase = fillEaseCls ? fillEaseCls.slice(10) : ease;
2115
+ const fillTimeCls = [...el.classList].find((c) => c.startsWith("fill-time-"));
2116
+ const fillDur = fillTimeCls ? Number(fillTimeCls.slice(10)) : .5;
2117
+ const drawDur = 1;
2118
+ gsap.gsap.set(el, { fillOpacity: reverse ? 1 : 0 });
2119
+ if (!reverse) {
2120
+ tl.fromTo(el, {
2121
+ drawSVG: "0%",
2122
+ ...rnd
2123
+ }, {
2124
+ drawSVG: "100%",
2125
+ ...rndEnds,
2126
+ ease,
2127
+ duration: drawDur
2128
+ });
2129
+ tl.fromTo(el, { fillOpacity: 0 }, {
2130
+ fillOpacity: 1,
2131
+ ease: fillEase,
2132
+ duration: fillDur
2133
+ });
2134
+ } else {
2135
+ tl.fromTo(el, { fillOpacity: 1 }, {
2136
+ fillOpacity: 0,
2137
+ ease: fillEase,
2138
+ duration: fillDur
2139
+ });
2140
+ tl.fromTo(el, {
2141
+ drawSVG: "100%",
2142
+ ...rndEnds
2143
+ }, {
2144
+ drawSVG: "0%",
2145
+ ...rnd,
2146
+ ease,
2147
+ duration: drawDur
2148
+ });
2149
+ }
2150
+ } else tl.fromTo(el, {
2151
+ ...reverse ? to : from,
2152
+ ...rnd
2153
+ }, {
2154
+ ...rndEnds,
2155
+ ...reverse ? from : to,
2156
+ ease
2157
+ });
2158
+ scrollTriggers.push(tl.scrollTrigger);
2159
+ return;
2160
+ }
2161
+ if (!hasGClass(el, "scroll")) return;
2162
+ const { delay, duration } = readTiming(el);
2163
+ const ease = isTypewriter ? [...el.classList].find((c) => c.startsWith("ease-"))?.split("-")[1] ?? "none" : getEase(el);
2164
+ const fullText = stashText(el);
2165
+ const enter = () => {
2166
+ if (el._scrollTween) el._scrollTween.kill();
2167
+ el._scrollTween = isTypewriter ? typewriterSplit ? playTypewriterSplit(el, delay, duration, ease) : typewriter(el, fullText, duration, delay, ease) : invokePlay(config, el, delay, duration, ease);
2168
+ el._scrollTween.eventCallback("onComplete", () => fireOnComplete(el, "spawn"));
2169
+ };
2170
+ const reverseToStart = () => {
2171
+ if (config.count) {
2172
+ const t = el._scrollTween;
2173
+ if (t && t.progress() > 0 && !t.reversed()) t.reverse();
2174
+ return;
2175
+ }
2176
+ el._scrollTween?.kill();
2177
+ if (isTypewriter && !typewriterSplit) {
2178
+ el.innerHTML = fullText;
2179
+ return;
2180
+ }
2181
+ if (typewriterSplit) {
2182
+ const parts = getParts(el, getGranularity(el));
2183
+ if (parts.length) gsap.gsap.to(parts, {
2184
+ opacity: 0,
2185
+ ease,
2186
+ duration: .3
2187
+ });
2188
+ return;
2189
+ }
2190
+ el._scrollTween = gsap.gsap.to(el, {
2191
+ ...from,
2192
+ ease,
2193
+ duration: .3
2194
+ });
2195
+ };
2196
+ const st = gsap_all.ScrollTrigger.create({
2197
+ trigger: el,
2198
+ scroller: getScroller(el),
2199
+ start: "top bottom",
2200
+ end: "bottom top",
2201
+ onEnter: enter,
2202
+ onEnterBack: enter,
2203
+ onLeave: reverseToStart,
2204
+ onLeaveBack: reverseToStart
2205
+ });
2206
+ scrollTriggers.push(st);
2207
+ };
2208
+ qAll("body *").filter((el) => hasGClass(el, "scroll") || hasGClass(el, "scroll-progress")).forEach((el) => runWithBreakpoint(el, () => setupScroll(el)));
2209
+ spawnConfigs.forEach(({ sel, from, typewriter: isTypewriter, text }) => {
2210
+ if (isTypewriter || text === false) return;
2211
+ const tSel = ".spawn-text-" + sel.slice(1);
2212
+ qAll("body *").filter((el) => elementMatchesSel(el, tSel) && hasGClass(el, "scroll") && !hasGClass(el, "scroll-progress")).forEach((el) => {
2213
+ const run = () => {
2214
+ if (isReduced(el)) return;
2215
+ const { delay, duration } = readTiming(el);
2216
+ const ease = getEase(el);
2217
+ const enter = () => {
2218
+ el._scrollTween?.kill();
2219
+ el._scrollTween = playText(el, from, delay, duration, ease);
2220
+ };
2221
+ const reverseToStart = () => {
2222
+ el._scrollTween?.kill();
2223
+ const parts = getParts(el, getGranularity(el));
2224
+ if (parts.length) gsap.gsap.to(parts, {
2225
+ ...from,
2226
+ ease,
2227
+ duration: .3
2228
+ });
2229
+ };
2230
+ scrollTriggers.push(gsap_all.ScrollTrigger.create({
2231
+ trigger: el,
2232
+ scroller: getScroller(el),
2233
+ start: "top bottom",
2234
+ end: "top top",
2235
+ onEnter: enter,
2236
+ onEnterBack: enter,
2237
+ onLeave: reverseToStart,
2238
+ onLeaveBack: reverseToStart
2239
+ }));
2240
+ };
2241
+ runWithBreakpoint(el, run);
2242
+ });
2243
+ qAll("body *").filter((el) => elementMatchesSel(el, tSel) && hasGClass(el, "scroll-progress")).forEach((el) => {
2244
+ const run = () => {
2245
+ if (isReduced(el)) return;
2246
+ const ease = getEase(el);
2247
+ const parts = getParts(el, getGranularity(el));
2248
+ if (!parts.length) return;
2249
+ const to = computeTo(from);
2250
+ const startClass = readClassNumber(el, "progress-start-", null);
2251
+ const endClass = readClassNumber(el, "progress-end-", null);
2252
+ const clamp = (n) => Math.min(100, Math.max(0, n));
2253
+ const tl = gsap.gsap.timeline({ scrollTrigger: {
2254
+ trigger: el,
2255
+ scroller: getScroller(el),
2256
+ start: startClass != null ? `top ${clamp(100 - startClass)}%` : defaults.progressStart,
2257
+ end: endClass != null ? `top ${clamp(100 - endClass)}%` : defaults.progressEnd,
2258
+ scrub: true
2259
+ } });
2260
+ const reverse = hasGClass(el, "progress-reverse");
2261
+ const rnd = !reverse && hasRandom(el) ? randomVars(el) : null;
2262
+ tl.fromTo(parts, {
2263
+ ...reverse ? to : from,
2264
+ ...rnd
2265
+ }, {
2266
+ ...rnd ? randomEnds(Object.keys(rnd)) : null,
2267
+ ...reverse ? from : to,
2268
+ ease
2269
+ });
2270
+ scrollTriggers.push(tl.scrollTrigger);
2271
+ };
2272
+ runWithBreakpoint(el, run);
2273
+ });
2274
+ });
2275
+ gsap_all.ScrollTrigger.refresh();
2276
+ window.addEventListener("load", gsap_all.ScrollTrigger.refresh);
2277
+ let refreshTimer = null;
2278
+ const scheduleRefresh = () => {
2279
+ clearTimeout(refreshTimer);
2280
+ refreshTimer = setTimeout(() => {
2281
+ refreshTimer = null;
2282
+ gsap_all.ScrollTrigger.refresh();
2283
+ }, 60);
2284
+ };
2285
+ setTimeout(scheduleRefresh, 400);
2286
+ setTimeout(scheduleRefresh, 1200);
2287
+ spawnConfigs.forEach((config) => {
2288
+ const { sel, typewriter: isTypewriter, typewriterSplit } = config;
2289
+ qAllAllVariants(sel).forEach((el) => {
2290
+ const run = () => {
2291
+ if (hasGClass(el, "scroll") || hasGClass(el, "scroll-progress")) return;
2292
+ if (isPreserved(el)) return;
2293
+ if (isReduced(el)) return;
2294
+ if (!elementMatchesSel(el, sel)) return;
2295
+ const { delay, duration } = readTiming(el);
2296
+ if (isTypewriter) {
2297
+ const easeClass = getActivePrefixedClass(el, "ease-") || [...el.classList].find((c) => c.startsWith("ease-"));
2298
+ const elEase = easeClass ? easeClass.slice(easeClass.indexOf("ease-") + 5) : "none";
2299
+ if (typewriterSplit) el._spawnTween = playTypewriterSplit(el, delay, duration, elEase);
2300
+ else {
2301
+ el.typewriter?.kill();
2302
+ el.typewriter = typewriter(el, stashText(el), duration, delay, elEase);
2303
+ }
2304
+ } else {
2305
+ el._spawnTween = invokePlay(config, el, delay, duration, getEase(el));
2306
+ el._spawnTween.eventCallback("onComplete", () => {
2307
+ if (hasGClass(el, "leave")) refreshLeaveRect(el);
2308
+ if (hasGClass(el, "flip")) captureFlip(el);
2309
+ if (isCompatibility(el)) resumeCompatLoops(el);
2310
+ scheduleRefresh();
2311
+ fireOnComplete(el, "spawn");
2312
+ });
2313
+ }
2314
+ markPreserved(el);
2315
+ el.dataset.gsapWired = "1";
2316
+ };
2317
+ runWithBreakpointForSel(el, sel, run);
2318
+ });
2319
+ });
2320
+ spawnConfigs.forEach(({ sel, from, typewriter: isTypewriter, text }) => {
2321
+ if (isTypewriter || text === false) return;
2322
+ const tSel = ".spawn-text-" + sel.slice(1);
2323
+ qAllAllVariants(tSel).forEach((el) => {
2324
+ const run = () => {
2325
+ if (hasGClass(el, "scroll") || hasGClass(el, "scroll-progress")) return;
2326
+ if (isPreserved(el)) return;
2327
+ if (isReduced(el)) return;
2328
+ if (!elementMatchesSel(el, tSel)) return;
2329
+ const { delay, duration } = readTiming(el);
2330
+ el._spawnTween = playText(el, from, delay, duration, getEase(el));
2331
+ markPreserved(el);
2332
+ el.dataset.gsapWired = "1";
2333
+ };
2334
+ runWithBreakpointForSel(el, tSel, run);
2335
+ });
2336
+ });
2337
+ const magnetQuery = typeof window !== "undefined" ? window.matchMedia("(hover: none)") : null;
2338
+ const magnetState = [];
2339
+ const magnetListeners = [];
2340
+ const magnetOnMove = (el, pull, grow, duration, elEase) => (ev) => {
2341
+ const r = el.getBoundingClientRect();
2342
+ const dx = ev.clientX - (r.left + r.width / 2);
2343
+ const dy = ev.clientY - (r.top + r.height / 2);
2344
+ magnet(el, dx * pull, dy * pull, grow, duration, elEase);
2345
+ };
2346
+ const magnetOnLeave = (el, duration, elEase) => () => magnet(el, 0, 0, 1, duration, elEase);
2347
+ const magnet3dOnMove = (el, pull, grow, tilt, duration, elEase) => (ev) => {
2348
+ const r = el.getBoundingClientRect();
2349
+ const dx = ev.clientX - (r.left + r.width / 2);
2350
+ const dy = ev.clientY - (r.top + r.height / 2);
2351
+ const relX = r.width ? (ev.clientX - r.left) / r.width - .5 : 0;
2352
+ const relY = r.height ? (ev.clientY - r.top) / r.height - .5 : 0;
2353
+ magnet3d(el, dx * pull, dy * pull, grow, -relY * tilt, relX * tilt, duration, elEase);
2354
+ };
2355
+ const magnet3dOnLeave = (el, duration, elEase) => () => magnet3d(el, 0, 0, 1, 0, 0, duration, elEase);
2356
+ const applyMagnet = () => {
2357
+ if (!magnetQuery) return;
2358
+ const touch = magnetQuery.matches;
2359
+ magnetListeners.forEach(({ el, type, fn }) => el.removeEventListener(type, fn));
2360
+ magnetListeners.length = 0;
2361
+ if (touch) return;
2362
+ magnetState.forEach(({ el, onMove, onLeave }) => {
2363
+ el.addEventListener("mousemove", onMove);
2364
+ el.addEventListener("mouseleave", onLeave);
2365
+ magnetListeners.push({
2366
+ el,
2367
+ type: "mousemove",
2368
+ fn: onMove
2369
+ }, {
2370
+ el,
2371
+ type: "mouseleave",
2372
+ fn: onLeave
2373
+ });
2374
+ });
2375
+ };
2376
+ const setupMagnet = (el) => {
2377
+ if (!hasGClass(el, "magnet") && !hasGClass(el, "magnet3d")) return;
2378
+ const threeD = hasGClass(el, "magnet3d");
2379
+ const duration = readClassNumber(el, "mtime-", .4);
2380
+ const pull = readClassNumber(el, "amount-", .3);
2381
+ const grow = readClassNumber(el, "mgrow-", 1.1);
2382
+ const tilt = readClassNumber(el, "mtilt-", 12);
2383
+ const elEase = getEase(el);
2384
+ const onMove = threeD ? magnet3dOnMove(el, pull, grow, tilt, duration, elEase) : magnetOnMove(el, pull, grow, duration, elEase);
2385
+ const onLeave = threeD ? magnet3dOnLeave(el, duration, elEase) : magnetOnLeave(el, duration, elEase);
2386
+ magnetState.push({
2387
+ el,
2388
+ onMove,
2389
+ onLeave
2390
+ });
2391
+ };
2392
+ if (magnetQuery) magnetQuery.addEventListener("change", applyMagnet);
2393
+ const isCompatibility = (el) => hasGClass(el, "compatibility");
2394
+ const compatLoopsOf = (el) => {
2395
+ if (!el._gsapCompatLoops) el._gsapCompatLoops = [];
2396
+ return el._gsapCompatLoops;
2397
+ };
2398
+ const trackCompatLoop = (el, tween) => {
2399
+ if (tween && isCompatibility(el)) compatLoopsOf(el).push(tween);
2400
+ return tween;
2401
+ };
2402
+ const pauseCompatLoops = (el) => compatLoopsOf(el).forEach((t) => t.pause());
2403
+ const resumeCompatLoops = (el) => compatLoopsOf(el).forEach((t) => t.resume());
2404
+ const setupClicks = (el) => {
2405
+ if (isReduced(el)) return;
2406
+ setupMagnet(el);
2407
+ if (hasGClass(el, "click-hover")) {
2408
+ const area = wrapTarget(el);
2409
+ let touch = false;
2410
+ const duration = readClassNumber(el, "ctime-", defaults.clickDuration);
2411
+ const lift = readClassNumber(el, "amount-", defaults.clickOffset);
2412
+ const elEase = getEase(el);
2413
+ addListener(area, "mousedown", () => {
2414
+ if (!touch) {
2415
+ pauseCompatLoops(el);
2416
+ verticalmove(el, -lift / 2, duration, elEase);
2417
+ }
2418
+ });
2419
+ addListener(area, "mouseover", () => {
2420
+ if (!touch) {
2421
+ pauseCompatLoops(el);
2422
+ verticalmove(el, -lift, duration, elEase);
2423
+ }
2424
+ });
2425
+ addListener(area, "mouseleave", () => {
2426
+ if (!touch) {
2427
+ verticalmove(el, 0, duration, elEase);
2428
+ resumeCompatLoops(el);
2429
+ }
2430
+ });
2431
+ addListener(area, "mouseup", () => {
2432
+ if (!touch) verticalmove(el, -lift, duration, elEase);
2433
+ });
2434
+ addListener(area, "touchstart", () => {
2435
+ touch = true, pauseCompatLoops(el), verticalmove(el, lift / 2, duration, elEase);
2436
+ });
2437
+ addListener(area, "touchend", () => {
2438
+ touch = true, verticalmove(el, 0, duration, elEase), setTimeout(() => {
2439
+ touch = false;
2440
+ }, 0);
2441
+ });
2442
+ }
2443
+ if (hasGClass(el, "click-expand")) {
2444
+ let touch = false;
2445
+ const duration = readClassNumber(el, "ctime-", defaults.clickDuration);
2446
+ const lift = readClassNumber(el, "amount-", defaults.clickExpandOffset);
2447
+ const elEase = getEase(el);
2448
+ addListener(el, "mousedown", () => {
2449
+ if (!touch) {
2450
+ pauseCompatLoops(el);
2451
+ expandmove(el, 10, duration, elEase).eventCallback("onComplete", () => fireOnComplete(el, "click"));
2452
+ }
2453
+ });
2454
+ addListener(el, "mouseover", () => {
2455
+ if (!touch) {
2456
+ pauseCompatLoops(el);
2457
+ expandmove(el, lift, duration, elEase);
2458
+ }
2459
+ });
2460
+ addListener(el, "mouseleave", () => {
2461
+ if (!touch) {
2462
+ expandmove(el, 10, duration, elEase);
2463
+ resumeCompatLoops(el);
2464
+ }
2465
+ });
2466
+ addListener(el, "mouseup", () => {
2467
+ if (!touch) expandmove(el, lift, duration, elEase);
2468
+ });
2469
+ addListener(el, "touchstart", () => {
2470
+ touch = true, pauseCompatLoops(el), expandmove(el, lift, duration, elEase);
2471
+ });
2472
+ addListener(el, "touchend", () => {
2473
+ touch = true, expandmove(el, 10, duration, elEase).eventCallback("onComplete", () => fireOnComplete(el, "click")), setTimeout(() => {
2474
+ touch = false;
2475
+ }, 0);
2476
+ });
2477
+ }
2478
+ };
2479
+ const readLoopCtx = (el) => ({
2480
+ edelay: readClassNumber(el, "edelay-", defaults.effectDelay),
2481
+ amount: readClassNumber(el, "amount-", defaults.effectOffset),
2482
+ etime: readClassNumber(el, "etime-", defaults.effectDuration),
2483
+ ease: getEase(el),
2484
+ time: readClassNumber(el, "time-", 20),
2485
+ mH: readClassNumber(el, "marquee-horizontal-offset-", 0),
2486
+ mV: readClassNumber(el, "marquee-vertical-offset-", 0),
2487
+ radiateZ: readClassNumber(el, "radiate-z-", null)
2488
+ });
2489
+ const loopEls = [];
2490
+ const buildLoops = (el) => {
2491
+ if (isReduced(el)) return;
2492
+ const ctx = readLoopCtx(el);
2493
+ loopConfigs.forEach(({ sel, build, key, loop }) => {
2494
+ if (elementMatchesSel(el, sel)) {
2495
+ el[key]?.kill();
2496
+ el[key] = trackCompatLoop(el, build(el, ctx));
2497
+ if (loop) el[key].repeat(-1);
2498
+ if (!loopEls.some((l) => l.el === el && l.key === key)) loopEls.push({
2499
+ el,
2500
+ key
2501
+ });
2502
+ el[key].eventCallback(el[key].repeat() === -1 ? "onRepeat" : "onComplete", () => fireOnComplete(el, "loop"));
2503
+ }
2504
+ });
2505
+ };
2506
+ const findSpawnTween = (el) => {
2507
+ for (let node = el; node && node.nodeType === 1; node = node.parentElement) {
2508
+ const t = node._spawnTween;
2509
+ if (t && t.progress() < 1) return t;
2510
+ }
2511
+ return null;
2512
+ };
2513
+ const deferLoopBuild = (el, tween) => {
2514
+ if (!tween.__gsapPendingLoops) tween.__gsapPendingLoops = /* @__PURE__ */ new Set();
2515
+ tween.__gsapPendingLoops.add(el);
2516
+ if (tween.__gsapPendingHooked) return;
2517
+ tween.__gsapPendingHooked = true;
2518
+ const existing = tween.eventCallback("onComplete");
2519
+ tween.eventCallback("onComplete", function() {
2520
+ existing && existing.call(this);
2521
+ const pending = tween.__gsapPendingLoops;
2522
+ tween.__gsapPendingLoops = /* @__PURE__ */ new Set();
2523
+ tween.__gsapPendingHooked = false;
2524
+ pending.forEach((e) => buildLoops(e));
2525
+ });
2526
+ };
2527
+ const setupLoops = (el) => {
2528
+ const spawnTween = isCompatibility(el) ? findSpawnTween(el) : null;
2529
+ if (spawnTween) {
2530
+ deferLoopBuild(el, spawnTween);
2531
+ return;
2532
+ }
2533
+ buildLoops(el);
2534
+ };
2535
+ const wrapTarget = (el) => {
2536
+ if (!hasGClass(el, "wrapdiv")) return el;
2537
+ if (el._gsapWrap) return el._gsapWrap;
2538
+ const area = document.createElement("div");
2539
+ el.before(area);
2540
+ area.appendChild(el);
2541
+ el._gsapWrap = area;
2542
+ return area;
2543
+ };
2544
+ const setupHoverClick = (el) => {
2545
+ if (isReduced(el)) return;
2546
+ const ctx = readLoopCtx(el);
2547
+ loopConfigs.forEach(({ sel, build, key }) => {
2548
+ if (sel.startsWith(".marquee")) return;
2549
+ const name = sel.slice(1);
2550
+ if (hasGClass(el, "hover-" + name)) {
2551
+ const area = wrapTarget(el);
2552
+ addListener(area, "mouseenter", () => {
2553
+ pauseCompatLoops(el);
2554
+ el[key]?.kill();
2555
+ el[key] = build(el, ctx).repeat(-1);
2556
+ el[key].eventCallback("onRepeat", () => fireOnComplete(el, "loop"));
2557
+ });
2558
+ addListener(area, "mouseleave", () => {
2559
+ el[key]?.kill();
2560
+ el[key] = reset(el, readClassNumber(el, "etime-", defaults.effectDuration), getEase(el));
2561
+ resumeCompatLoops(el);
2562
+ });
2563
+ } else if (hasGClass(el, "click-" + name)) {
2564
+ const area = wrapTarget(el);
2565
+ addListener(area, "mousedown", () => {
2566
+ pauseCompatLoops(el);
2567
+ el[key]?.kill();
2568
+ el[key] = build(el, ctx);
2569
+ el[key].eventCallback("onComplete", () => fireOnComplete(el, "click"));
2570
+ });
2571
+ addListener(area, "mouseleave", () => {
2572
+ resumeCompatLoops(el);
2573
+ });
2574
+ }
2575
+ });
2576
+ };
2577
+ const CSS_VAL = "(-?\\d+(?:\\.\\d+)?|#[0-9a-fA-F]{3,8})";
2578
+ const CSS_ANIM_RE = new RegExp(`^((spawn|hover|click)-)?css-([a-zA-Z]+)-${CSS_VAL}-${CSS_VAL}$`);
2579
+ const CSS_SINGLE_RE = new RegExp(`^((hover|click)-)css-([a-zA-Z]+)-${CSS_VAL}$`);
2580
+ const parseCssVal = (s) => /^#/.test(s) ? s : Number(s);
2581
+ const parseCssAnim = (el) => {
2582
+ for (const c of el.classList) {
2583
+ let m = c.match(CSS_ANIM_RE);
2584
+ if (m) return {
2585
+ mode: m[2] || "loop",
2586
+ prop: m[3],
2587
+ from: parseCssVal(m[4]),
2588
+ to: parseCssVal(m[5])
2589
+ };
2590
+ m = c.match(CSS_SINGLE_RE);
2591
+ if (m) return {
2592
+ mode: m[2],
2593
+ prop: m[3],
2594
+ to: parseCssVal(m[4]),
2595
+ single: true
2596
+ };
2597
+ }
2598
+ return null;
2599
+ };
2600
+ const cssTweens = [];
2601
+ const setupCssAnims = (el) => {
2602
+ if (isReduced(el)) return;
2603
+ const anim = parseCssAnim(el);
2604
+ if (!anim) return;
2605
+ const dur = readClassNumber(el, "time-", 1);
2606
+ const ease = getEase(el);
2607
+ const key = "_cssAnim";
2608
+ const loopVars = {
2609
+ [anim.prop]: anim.to,
2610
+ duration: dur,
2611
+ ease,
2612
+ yoyo: true,
2613
+ repeat: -1
2614
+ };
2615
+ if (anim.mode === "loop") {
2616
+ el[key]?.kill();
2617
+ el[key] = gsap.gsap.fromTo(el, { [anim.prop]: anim.from }, loopVars);
2618
+ cssTweens.push(el[key]);
2619
+ } else if (anim.mode === "spawn") {
2620
+ el[key]?.kill();
2621
+ el[key] = gsap.gsap.fromTo(el, { [anim.prop]: anim.from }, {
2622
+ [anim.prop]: anim.to,
2623
+ duration: dur,
2624
+ ease
2625
+ });
2626
+ cssTweens.push(el[key]);
2627
+ } else if (anim.mode === "hover") {
2628
+ const area = wrapTarget(el);
2629
+ if (anim.single) {
2630
+ const original = gsap.gsap.getProperty(el, anim.prop);
2631
+ addListener(area, "mouseenter", () => {
2632
+ el[key]?.kill();
2633
+ el[key] = gsap.gsap.to(el, {
2634
+ [anim.prop]: anim.to,
2635
+ duration: dur,
2636
+ ease
2637
+ });
2638
+ cssTweens.push(el[key]);
2639
+ });
2640
+ addListener(area, "mouseleave", () => {
2641
+ el[key]?.kill();
2642
+ el[key] = gsap.gsap.to(el, {
2643
+ [anim.prop]: original,
2644
+ duration: dur,
2645
+ ease
2646
+ });
2647
+ cssTweens.push(el[key]);
2648
+ });
2649
+ } else {
2650
+ addListener(area, "mouseenter", () => {
2651
+ el[key]?.kill();
2652
+ el[key] = gsap.gsap.fromTo(el, { [anim.prop]: anim.from }, { ...loopVars });
2653
+ cssTweens.push(el[key]);
2654
+ });
2655
+ addListener(area, "mouseleave", () => {
2656
+ el[key]?.kill();
2657
+ el[key] = gsap.gsap.to(el, {
2658
+ [anim.prop]: anim.from,
2659
+ duration: dur,
2660
+ ease
2661
+ });
2662
+ cssTweens.push(el[key]);
2663
+ });
2664
+ }
2665
+ } else if (anim.mode === "click") {
2666
+ const area = wrapTarget(el);
2667
+ if (anim.single) {
2668
+ const original = gsap.gsap.getProperty(el, anim.prop);
2669
+ addListener(area, "mousedown", () => {
2670
+ el[key]?.kill();
2671
+ el[key] = gsap.gsap.to(el, {
2672
+ [anim.prop]: anim.to,
2673
+ duration: dur,
2674
+ ease
2675
+ });
2676
+ el[key].eventCallback("onComplete", () => fireOnComplete(el, "click"));
2677
+ cssTweens.push(el[key]);
2678
+ });
2679
+ addListener(area, "mouseup", () => {
2680
+ el[key]?.kill();
2681
+ el[key] = gsap.gsap.to(el, {
2682
+ [anim.prop]: original,
2683
+ duration: dur,
2684
+ ease
2685
+ });
2686
+ cssTweens.push(el[key]);
2687
+ });
2688
+ } else addListener(area, "mousedown", () => {
2689
+ el[key]?.kill();
2690
+ el[key] = gsap.gsap.fromTo(el, { [anim.prop]: anim.from }, {
2691
+ [anim.prop]: anim.to,
2692
+ duration: dur,
2693
+ ease,
2694
+ yoyo: true,
2695
+ repeat: 1
2696
+ });
2697
+ el[key].eventCallback("onComplete", () => fireOnComplete(el, "click"));
2698
+ cssTweens.push(el[key]);
2699
+ });
2700
+ }
2701
+ };
2702
+ const setupTeardowns = [];
2703
+ const runSetup = (el) => {
2704
+ if (isReduced(el)) return;
2705
+ const ctx = readLoopCtx(el);
2706
+ animAll.forEach((a) => {
2707
+ if (a.setup && elementMatchesSel(el, a.sel)) {
2708
+ const teardown = a.setup(el, ctx);
2709
+ if (typeof teardown === "function") setupTeardowns.push(teardown);
2710
+ }
2711
+ });
2712
+ };
2713
+ qAll("body *").forEach((el) => {
2714
+ if (el.dataset?.gsapSetup) return;
2715
+ el.dataset.gsapSetup = "1";
2716
+ setupClicks(el);
2717
+ setupLoops(el);
2718
+ setupHoverClick(el);
2719
+ setupCssAnims(el);
2720
+ runSetup(el);
2721
+ });
2722
+ applyMagnet();
2723
+ let flipRoots = /* @__PURE__ */ new Set();
2724
+ let flipPendingRaf = null;
2725
+ const flushFlipRoots = () => {
2726
+ if (!flipRoots.size) return;
2727
+ const toFlip = /* @__PURE__ */ new Set();
2728
+ flipRoots.forEach((scope) => {
2729
+ if (!scope) return;
2730
+ gsap.gsap.utils.toArray(scope.querySelectorAll?.(".flip") || []).forEach((el) => {
2731
+ if (el.isConnected) toFlip.add(el);
2732
+ });
2733
+ });
2734
+ toFlip.forEach(playFlip);
2735
+ gsap.gsap.utils.toArray(document.body.querySelectorAll?.(".flip") || []).forEach(captureFlip);
2736
+ flipRoots = /* @__PURE__ */ new Set();
2737
+ };
2738
+ let flipObserver = null;
2739
+ const animateAppear = (el) => {
2740
+ if (!hasGClass(el, "appear") || el._appeared) return;
2741
+ if (!isTextElement(el) && (hasGClass(el, "scroll") || hasGClass(el, "scroll-progress"))) return;
2742
+ if (isReduced(el)) return;
2743
+ el._appeared = true;
2744
+ const { delay, duration, ease } = readTiming(el);
2745
+ const config = findSpawn(el);
2746
+ if (isTextElement(el)) {
2747
+ el._spawnTween = playText(el, config.from, delay, duration, ease);
2748
+ return;
2749
+ }
2750
+ if (!config) return el._spawnTween = SpawnV(el, delay, -defaults.spawnOffset, duration, ease);
2751
+ if (config.typewriter) {
2752
+ const easeClass = [...el.classList].find((c) => c.startsWith("ease-"));
2753
+ const elEase = easeClass ? easeClass.split("-")[1] : "none";
2754
+ el._spawnTween = config.typewriterSplit ? playTypewriterSplit(el, delay, duration, elEase) : invokePlay(config, el, delay, duration, elEase);
2755
+ } else {
2756
+ el._spawnTween = invokePlay(config, el, delay, duration, ease);
2757
+ el._spawnTween.eventCallback("onComplete", () => {
2758
+ if (hasGClass(el, "leave")) refreshLeaveRect(el);
2759
+ if (hasGClass(el, "flip")) captureFlip(el);
2760
+ fireOnComplete(el, "spawn");
2761
+ });
2762
+ }
2763
+ };
2764
+ let appearObserver = null;
2765
+ let leaveObserver = null;
2766
+ let hubObserver = null;
2767
+ let hubRaf = null;
2768
+ let hubQueue = [];
2769
+ let hubCurrentBatch = null;
2770
+ let hubCursor = 0;
2771
+ const handleFlipBatch = (mutations) => {
2772
+ for (const mutation of mutations) {
2773
+ if (mutation.type !== "childList") continue;
2774
+ const target = mutation.target;
2775
+ if (target.nodeType !== 1) continue;
2776
+ flipRoots.add(target);
2777
+ }
2778
+ };
2779
+ const handleAppearBatch = (mutations) => {
2780
+ mutations.forEach((mutation) => {
2781
+ mutation.addedNodes.forEach((node) => {
2782
+ if (node.nodeType !== 1) return;
2783
+ const els = node.querySelectorAll?.("*") ? [node, ...node.querySelectorAll("*")] : [node];
2784
+ let pinned = false;
2785
+ els.forEach((el) => {
2786
+ if (!hasGClass(el, "appear")) return;
2787
+ animateAppear(el);
2788
+ setupScroll(el);
2789
+ setupScrollDriven(el);
2790
+ if (el.dataset?.gsapSetup) return;
2791
+ el.dataset.gsapSetup = "1";
2792
+ setupClicks(el);
2793
+ setupLoops(el);
2794
+ setupHoverClick(el);
2795
+ setupCssAnims(el);
2796
+ runSetup(el);
2797
+ const wasPinned = el.dataset.gsapPinned;
2798
+ setupPin(el);
2799
+ if (!wasPinned && el.dataset.gsapPinned) pinned = true;
2800
+ });
2801
+ applyMagnet();
2802
+ if (pinned) gsap_all.ScrollTrigger.refresh();
2803
+ });
2804
+ });
2805
+ };
2806
+ const handleLeaveBatch = (mutations) => {
2807
+ mutations.forEach((mutation) => {
2808
+ if (mutation.type !== "childList") return;
2809
+ mutation.addedNodes.forEach((n) => collectLeave(n).forEach(captureLeave));
2810
+ mutation.removedNodes.forEach((n) => collectLeave(n).forEach(playLeave));
2811
+ });
2812
+ };
2813
+ const hubHandlers = [
2814
+ handleFlipBatch,
2815
+ handleAppearBatch,
2816
+ handleLeaveBatch
2817
+ ];
2818
+ const hubDrain = () => {
2819
+ hubRaf = null;
2820
+ if (!hubCurrentBatch) {
2821
+ if (!hubQueue.length) return;
2822
+ hubCurrentBatch = hubQueue.splice(0, hubQueue.length);
2823
+ hubCursor = 0;
2824
+ }
2825
+ const end = Math.min(hubCursor + throttlePerFrame, hubHandlers.length);
2826
+ for (let i = hubCursor; i < end; i++) {
2827
+ hubHandlers[i](hubCurrentBatch);
2828
+ if (hubHandlers[i] === handleFlipBatch) flushFlipRoots();
2829
+ }
2830
+ hubCursor = end;
2831
+ if (hubCursor < hubHandlers.length) hubRaf = requestAnimationFrame(hubDrain);
2832
+ else {
2833
+ hubCurrentBatch = null;
2834
+ hubCursor = 0;
2835
+ if (hubQueue.length) hubRaf = requestAnimationFrame(hubDrain);
2836
+ }
2837
+ };
2838
+ const scheduleHub = () => {
2839
+ if (hubRaf) return;
2840
+ hubRaf = requestAnimationFrame(hubDrain);
2841
+ };
2842
+ if (throttlePerFrame > 0) {
2843
+ hubObserver = new MutationObserver((mutations) => {
2844
+ hubQueue.push(...mutations);
2845
+ scheduleHub();
2846
+ });
2847
+ hubObserver.observe(document.body, {
2848
+ childList: true,
2849
+ subtree: true
2850
+ });
2851
+ } else {
2852
+ flipObserver = new MutationObserver((mutations) => {
2853
+ handleFlipBatch(mutations);
2854
+ if (!flipPendingRaf) flipPendingRaf = requestAnimationFrame(() => {
2855
+ flipPendingRaf = null;
2856
+ flushFlipRoots();
2857
+ });
2858
+ });
2859
+ flipObserver.observe(document.body, {
2860
+ childList: true,
2861
+ subtree: true
2862
+ });
2863
+ appearObserver = new MutationObserver((mutations) => {
2864
+ handleAppearBatch(mutations);
2865
+ });
2866
+ appearObserver.observe(document.body, {
2867
+ childList: true,
2868
+ subtree: true
2869
+ });
2870
+ qAll("body *").filter((el) => hasGClass(el, "leave")).forEach(captureLeave);
2871
+ leaveObserver = new MutationObserver((mutations) => {
2872
+ handleLeaveBatch(mutations);
2873
+ });
2874
+ leaveObserver.observe(document.body, {
2875
+ childList: true,
2876
+ subtree: true
2877
+ });
2878
+ }
2879
+ if (throttlePerFrame > 0) qAll("body *").filter((el) => hasGClass(el, "leave")).forEach(captureLeave);
2880
+ const qAllLeaves = () => qAll("body *").filter((el) => hasGClass(el, "leave"));
2881
+ let positionTick = false;
2882
+ const refreshLeavePositions = () => {
2883
+ if (positionTick) return;
2884
+ positionTick = true;
2885
+ requestAnimationFrame(() => {
2886
+ qAllLeaves().forEach((el) => {
2887
+ const s = leaveStates.get(el);
2888
+ if (s) s.rect = el.getBoundingClientRect();
2889
+ });
2890
+ positionTick = false;
2891
+ });
2892
+ };
2893
+ window.addEventListener("scroll", refreshLeavePositions, { passive: true });
2894
+ window.addEventListener("resize", refreshLeavePositions, { passive: true });
2895
+ const bpMqls = bpEntries.map(([bp, px]) => {
2896
+ const mql = typeof window !== "undefined" && window.matchMedia ? window.matchMedia(`(min-width: ${px}px)`) : null;
2897
+ if (!mql) return null;
2898
+ const fn = () => gsap_all.ScrollTrigger.refresh();
2899
+ mql.addEventListener?.("change", fn);
2900
+ return {
2901
+ mql,
2902
+ fn
2903
+ };
2904
+ }).filter(Boolean);
2905
+ return () => {
2906
+ appearObserver?.disconnect();
2907
+ leaveObserver?.disconnect();
2908
+ flipObserver?.disconnect();
2909
+ if (hubObserver) hubObserver.disconnect();
2910
+ if (hubRaf) cancelAnimationFrame(hubRaf);
2911
+ if (flipPendingRaf) cancelAnimationFrame(flipPendingRaf);
2912
+ window.removeEventListener("scroll", refreshLeavePositions);
2913
+ window.removeEventListener("resize", refreshLeavePositions);
2914
+ bpMqls.forEach(({ mql, fn }) => mql.removeEventListener?.("change", fn));
2915
+ mm.revert();
2916
+ window.removeEventListener("load", gsap_all.ScrollTrigger.refresh);
2917
+ clearTimeout(refreshTimer);
2918
+ scrollTriggers.forEach((t) => {
2919
+ const tw = t.trigger._scrollTween;
2920
+ const cls = t.trigger.classList;
2921
+ if (tw && !tw.reversed() && (cls?.contains("typewriter") || cls?.contains("scramble"))) tw.progress(1);
2922
+ t.kill(true);
2923
+ t.trigger._scrollTween?.kill();
2924
+ delete t.trigger._scrollTween;
2925
+ });
2926
+ gsap_all.ScrollTrigger.refresh();
2927
+ qAll("[data-gsap-scroll],[data-gsap-setup],[data-gsap-pinned],[data-gsap-scroll-driven]").forEach((el) => {
2928
+ delete el.dataset.gsapScroll;
2929
+ delete el.dataset.gsapSetup;
2930
+ delete el.dataset.gsapPinned;
2931
+ delete el.dataset.gsapScrollDriven;
2932
+ delete el._appeared;
2933
+ });
2934
+ registeredListeners.forEach(({ el, type, fn }) => el.removeEventListener(type, fn));
2935
+ magnetListeners.forEach(({ el, type, fn }) => el.removeEventListener(type, fn));
2936
+ magnetQuery?.removeEventListener("change", applyMagnet);
2937
+ loopEls.forEach(({ el, key }) => el[key]?.kill());
2938
+ document.querySelectorAll("[data-gsap-radiate]").forEach((n) => n.remove());
2939
+ cssTweens.forEach((t) => t?.kill());
2940
+ cssTweens.length = 0;
2941
+ qAll(".typewriter, .scramble").forEach((el) => {
2942
+ const keep = el.isConnected && underPreservedRoot(el);
2943
+ const tw = el.typewriter || el._spawnTween || el._scrollTween;
2944
+ if (!keep && tw && !tw.reversed()) tw.progress(1);
2945
+ tw?.kill();
2946
+ });
2947
+ textSplits.forEach((s) => {
2948
+ if (!(s.elements || []).some((e) => e.isConnected && underPreservedRoot(e))) {
2949
+ (s.elements || []).forEach((e) => splitCache.delete(e));
2950
+ revertSplitInstance(s);
2951
+ }
2952
+ });
2953
+ textSplits.length = 0;
2954
+ onCompleteTweens.forEach((t) => t?.kill());
2955
+ onCompleteTweens.length = 0;
2956
+ setupTeardowns.forEach((fn) => {
2957
+ try {
2958
+ fn();
2959
+ } catch {}
2960
+ });
2961
+ setupTeardowns.length = 0;
2962
+ };
2963
+ }
2964
+ //#endregion
2965
+ //#region AnimToggle.js
2966
+ var STORAGE_KEY = "gclass-animations-enabled";
2967
+ var REDUCED_KEY = "gclass-reduced-motion";
2968
+ var reducedMotionQuery = typeof window !== "undefined" ? window.matchMedia("(prefers-reduced-motion: reduce)") : null;
2969
+ var stored = readStored();
2970
+ var reduced = reducedMotionQuery?.matches ?? false;
2971
+ var forcedReduced = readReducedOverride();
2972
+ var subscribers = /* @__PURE__ */ new Set();
2973
+ function readStored() {
2974
+ if (typeof window === "undefined") return null;
2975
+ try {
2976
+ const raw = localStorage.getItem(STORAGE_KEY);
2977
+ return raw === null ? null : raw === "true";
2978
+ } catch {
2979
+ return null;
2980
+ }
2981
+ }
2982
+ function readReducedOverride() {
2983
+ if (typeof window === "undefined") return false;
2984
+ try {
2985
+ return localStorage.getItem(REDUCED_KEY) === "true";
2986
+ } catch {
2987
+ return false;
2988
+ }
2989
+ }
2990
+ function getEnabled() {
2991
+ if (forcedReduced) return false;
2992
+ return stored === null ? !reduced : stored;
2993
+ }
2994
+ function emit() {
2995
+ subscribers.forEach((fn) => fn(getEnabled()));
2996
+ }
2997
+ if (reducedMotionQuery) reducedMotionQuery.addEventListener("change", () => {
2998
+ reduced = reducedMotionQuery.matches;
2999
+ emit();
3000
+ });
3001
+ function toggleAnimations() {
3002
+ stored = !getEnabled();
3003
+ try {
3004
+ localStorage.setItem(STORAGE_KEY, String(stored));
3005
+ } catch {}
3006
+ emit();
3007
+ if (typeof window !== "undefined") window.location.reload();
3008
+ }
3009
+ function enableReducedMotion() {
3010
+ forcedReduced = true;
3011
+ try {
3012
+ localStorage.setItem(REDUCED_KEY, "true");
3013
+ } catch {}
3014
+ emit();
3015
+ if (typeof window !== "undefined") window.location.reload();
3016
+ }
3017
+ function disableReducedMotion() {
3018
+ forcedReduced = false;
3019
+ try {
3020
+ localStorage.removeItem(REDUCED_KEY);
3021
+ } catch {}
3022
+ emit();
3023
+ if (typeof window !== "undefined") window.location.reload();
3024
+ }
3025
+ var cleanup = null;
3026
+ var bootCleanup = null;
3027
+ var bootTimeout = null;
3028
+ var bootStyle = null;
3029
+ var hasBooted = false;
3030
+ var currentThrottle = 0;
3031
+ var currentFps = 0;
3032
+ var configSubscribers = /* @__PURE__ */ new Set();
3033
+ function getConfigSnapshot() {
3034
+ return {
3035
+ throttlePerFrame: currentThrottle,
3036
+ fps: currentFps
3037
+ };
3038
+ }
3039
+ function emitConfig() {
3040
+ configSubscribers.forEach((fn) => fn(getConfigSnapshot()));
3041
+ }
3042
+ function applyFps(fps) {
3043
+ const v = Number(fps) || 0;
3044
+ currentFps = v;
3045
+ if (v > 0) gsap.gsap.ticker.fps(v);
3046
+ else gsap.gsap.ticker.fps(0);
3047
+ emitConfig();
3048
+ }
3049
+ function normalizeGclassArgs(throttlePerFrame, fps) {
3050
+ if (typeof throttlePerFrame === "object" && throttlePerFrame !== null) {
3051
+ fps = throttlePerFrame.fps;
3052
+ throttlePerFrame = throttlePerFrame.throttlePerFrame;
3053
+ }
3054
+ return {
3055
+ nextThrottle: throttlePerFrame == null ? 0 : Number(throttlePerFrame) || 0,
3056
+ nextFps: fps == null ? 0 : Number(fps) || 0
3057
+ };
3058
+ }
3059
+ /**
3060
+ * Change GClass runtime options on the fly without reload.
3061
+ * gclassOpts(throttlePerFrame, fps) — both optional numbers.
3062
+ * gclassOpts() or gclassOpts(undefined, undefined) resets to defaults (no throttle, default ticker).
3063
+ * Also accepts gclassOpts({throttlePerFrame, fps}).
3064
+ * Example low-end button: onClick={() => gclassOpts(1, 30)}
3065
+ * Example reset: onClick={() => gclassOpts()} // 0, 60fps rAF
3066
+ */
3067
+ function gclassOpts(throttlePerFrame, fps) {
3068
+ const { nextThrottle, nextFps } = normalizeGclassArgs(throttlePerFrame, fps);
3069
+ currentThrottle = nextThrottle;
3070
+ applyFps(nextFps);
3071
+ if (typeof window !== "undefined" && cleanup && !bootTimeout) {
3072
+ try {
3073
+ cleanup();
3074
+ } catch {}
3075
+ cleanup = null;
3076
+ if (getEnabled()) cleanup = initListeners(document, currentThrottle);
3077
+ }
3078
+ return getConfigSnapshot();
3079
+ }
3080
+ function getGClassConfig() {
3081
+ return getConfigSnapshot();
3082
+ }
3083
+ function subscribeGClassConfig(cb) {
3084
+ configSubscribers.add(cb);
3085
+ return () => configSubscribers.delete(cb);
3086
+ }
3087
+ var readBootTime = (els, fallback) => {
3088
+ let max = null;
3089
+ for (const el of els) {
3090
+ const cls = [...el.classList].find((c) => c.startsWith("boot-time-"));
3091
+ if (cls) {
3092
+ const n = Number(cls.slice(10));
3093
+ if (!Number.isNaN(n)) max = max === null ? n : Math.max(max, n);
3094
+ }
3095
+ }
3096
+ return max ?? fallback;
3097
+ };
3098
+ function initAnimations(throttlePerFrame, fps) {
3099
+ let effThrottle = currentThrottle;
3100
+ let effFps = currentFps;
3101
+ if (throttlePerFrame !== void 0 || fps !== void 0) {
3102
+ const { nextThrottle, nextFps } = normalizeGclassArgs(throttlePerFrame, fps);
3103
+ effThrottle = nextThrottle;
3104
+ effFps = nextFps;
3105
+ currentThrottle = effThrottle;
3106
+ currentFps = effFps;
3107
+ if (effFps > 0) gsap.gsap.ticker.fps(effFps);
3108
+ else gsap.gsap.ticker.fps(0);
3109
+ emitConfig();
3110
+ } else if (effFps > 0) gsap.gsap.ticker.fps(effFps);
3111
+ else gsap.gsap.ticker.fps(0);
3112
+ if (typeof window === "undefined" || !getEnabled()) return;
3113
+ if (bootTimeout) {
3114
+ console.log(`[initAnimations] boot already in progress - ignoring duplicate call`);
3115
+ return;
3116
+ }
3117
+ if (cleanup) {
3118
+ cleanup();
3119
+ cleanup = null;
3120
+ }
3121
+ if (bootCleanup) {
3122
+ bootCleanup();
3123
+ bootCleanup = null;
3124
+ }
3125
+ if (bootStyle) {
3126
+ bootStyle.remove();
3127
+ bootStyle = null;
3128
+ document.documentElement.classList.remove("gclass-booting");
3129
+ }
3130
+ const hideBootEls = (els) => {
3131
+ els.forEach((el) => {
3132
+ el.style.display = "none";
3133
+ el.setAttribute("hidden", "");
3134
+ el.setAttribute("data-gclass-boot-hidden", "1");
3135
+ });
3136
+ };
3137
+ const bootEls = typeof document !== "undefined" ? [...document.querySelectorAll(".boot-up")].filter((el) => !el.hasAttribute("data-gclass-boot-hidden")) : [];
3138
+ if (!bootEls.length) {} else if (bootEls.length > 1) {
3139
+ console.error(`[initAnimations] Multiple .boot-up elements detected (${bootEls.length}) - skipping all boot animations`, bootEls);
3140
+ hideBootEls(bootEls);
3141
+ hasBooted = true;
3142
+ } else if (hasBooted && !bootTimeout) {
3143
+ console.log(`[initAnimations] skipping boot on path change (already booted)`, bootEls);
3144
+ hideBootEls(bootEls);
3145
+ hasBooted = true;
3146
+ } else {
3147
+ const bootEl = bootEls[0];
3148
+ if (![...bootEl.classList].some((c) => c.startsWith("boot-end-"))) {}
3149
+ const bootTime = readBootTime(bootEls, defaults.bootTime ?? 2);
3150
+ console.log(`[initAnimations] .boot-up found: ${bootEls.length} - pausing DOM for ${bootTime}s`, bootEls);
3151
+ hasBooted = true;
3152
+ bootStyle = document.createElement("style");
3153
+ bootStyle.id = "gclass-boot-style";
3154
+ bootStyle.textContent = `html.gclass-booting{visibility:hidden} html.gclass-booting .boot-up,html.gclass-booting .boot-up *{visibility:visible} html.gclass-booting .boot-up{position:fixed;inset:0;z-index:9999;display:grid;place-items:center}`;
3155
+ document.head.appendChild(bootStyle);
3156
+ document.documentElement.classList.add("gclass-booting");
3157
+ bootEls.forEach((el) => {
3158
+ el.style.visibility = "visible";
3159
+ });
3160
+ bootCleanup = initListeners(bootEl, effThrottle);
3161
+ bootTimeout = setTimeout(() => {
3162
+ const bootEndCls = [...bootEl.classList].find((c) => c.startsWith("boot-end-"));
3163
+ if (!bootEndCls) {
3164
+ bootCleanup?.();
3165
+ bootCleanup = null;
3166
+ document.documentElement.classList.remove("gclass-booting");
3167
+ bootStyle?.remove();
3168
+ bootStyle = null;
3169
+ hideBootEls(bootEls);
3170
+ bootTimeout = null;
3171
+ cleanup = initListeners(document, effThrottle);
3172
+ return;
3173
+ }
3174
+ const name = bootEndCls.slice(9);
3175
+ const cfg = animations.find((a) => a.sel === "." + name);
3176
+ const from = cfg?.from;
3177
+ const easeCl = [...bootEl.classList].find((c) => c.startsWith("ease-"));
3178
+ const ease = easeCl ? easeCl.split("-")[1] : defaults.ease;
3179
+ const dur = readBootTime([bootEl], defaults.effectDuration ?? 1);
3180
+ const endTimeCls = [...bootEl.classList].find((c) => c.startsWith("boot-end-time-"));
3181
+ const endDur = endTimeCls ? Number(endTimeCls.slice(14)) : dur;
3182
+ const finish = () => {
3183
+ bootCleanup?.();
3184
+ bootCleanup = null;
3185
+ document.documentElement.classList.remove("gclass-booting");
3186
+ bootStyle?.remove();
3187
+ bootStyle = null;
3188
+ hideBootEls(bootEls);
3189
+ bootTimeout = null;
3190
+ cleanup = initListeners(document, effThrottle);
3191
+ };
3192
+ if (!cfg || !from) {
3193
+ console.warn(`[initAnimations] boot-end-${name} has no from state - removing without animation`);
3194
+ finish();
3195
+ return;
3196
+ }
3197
+ gsap.gsap.to(bootEl, {
3198
+ ...from,
3199
+ duration: endDur,
3200
+ ease,
3201
+ onComplete: finish
3202
+ });
3203
+ }, bootTime * 1e3);
3204
+ return;
3205
+ }
3206
+ cleanup = initListeners(document, effThrottle);
3207
+ }
3208
+ //#endregion
3209
+ exports.SpawnH = SpawnH;
3210
+ exports.SpawnV = SpawnV;
3211
+ exports.animatecss = animatecss;
3212
+ exports.animations = animations;
3213
+ exports.bell = bell;
3214
+ exports.bounce = bounce;
3215
+ exports.countTargetVars = countTargetVars;
3216
+ exports.countUp = countUp;
3217
+ exports.curtainHorizontal = curtainHorizontal;
3218
+ exports.curtainVertical = curtainVertical;
3219
+ exports.customAnims = customAnims;
3220
+ exports.defaults = defaults;
3221
+ exports.disableReducedMotion = disableReducedMotion;
3222
+ exports.drawsvg = drawsvg;
3223
+ exports.drawsvgSplit = drawsvgSplit;
3224
+ exports.enableReducedMotion = enableReducedMotion;
3225
+ exports.expandA = expandA;
3226
+ exports.expandDown = expandDown;
3227
+ exports.expandH = expandH;
3228
+ exports.expandLeft = expandLeft;
3229
+ exports.expandRight = expandRight;
3230
+ exports.expandUp = expandUp;
3231
+ exports.expandV = expandV;
3232
+ exports.expandmove = expandmove;
3233
+ exports.finalOpacity = finalOpacity;
3234
+ exports.flip = flip;
3235
+ exports.gclassOpts = gclassOpts;
3236
+ exports.getGClassConfig = getGClassConfig;
3237
+ exports.hover = hover;
3238
+ exports.initAnimations = initAnimations;
3239
+ exports.initListeners = initListeners;
3240
+ exports.magnet = magnet;
3241
+ exports.magnet3d = magnet3d;
3242
+ exports.marquee = marquee;
3243
+ exports.normalize = normalize;
3244
+ exports.pulse = pulse;
3245
+ exports.radiate = radiate;
3246
+ exports.registerComplete = registerComplete;
3247
+ exports.reset = reset;
3248
+ exports.scramble = scramble;
3249
+ exports.scrambleSegments = scrambleSegments;
3250
+ exports.scrambleVars = scrambleVars;
3251
+ exports.shake = shake;
3252
+ exports.spawnBlur = spawnBlur;
3253
+ exports.spawnClipReveal = spawnClipReveal;
3254
+ exports.spawnFade = spawnFade;
3255
+ exports.spawnSpinCCW = spawnSpinCCW;
3256
+ exports.spawnSpinCW = spawnSpinCW;
3257
+ exports.spawnXDown = spawnXDown;
3258
+ exports.spawnXUp = spawnXUp;
3259
+ exports.spawnYLeft = spawnYLeft;
3260
+ exports.spawnYRight = spawnYRight;
3261
+ exports.spinCCW = spinCCW;
3262
+ exports.spinCW = spinCW;
3263
+ exports.splitPaths = splitPaths;
3264
+ exports.stashText = stashText;
3265
+ exports.subscribeGClassConfig = subscribeGClassConfig;
3266
+ exports.toggleAnimations = toggleAnimations;
3267
+ exports.typewriter = typewriter;
3268
+ exports.verticalmove = verticalmove;