PageSourceSearch

https://radicalbit.ai/wp-content/themes/powerai/assets/js/ScrollSmoother.min.js?ver=1791203296

js radicalbit.ai collected 2026-10-05 12:29:17 UTC 22,834 bytes, 604 lines download raw bytes

1/*!
2 * ScrollSmoother 3.11.4
3 * https://greensock.com
4 * 
5 * @license Copyright 2022, GreenSock. All rights reserved.
6 * This plugin is a membership benefit of Club GreenSock and is only authorized for use in sites/apps/products developed by individuals/companies with an active Club GreenSock membership. See https://greensock.com/club
7 * @author: Jack Doyle, [email protected]
8 */
9
10!function(e, t) {
11    "object" == typeof exports && "undefined" != typeof module ? t(exports) : "function" == typeof define && define.amd ? define(["exports"], t) : t((e = e || self).window = e.window || {})
12}(this, function(e) {
13    "use strict";
14    function _defineProperties(e, t) {
15        for (var r = 0; r < t.length; r++) {
16            var n = t[r];
17            n.enumerable = n.enumerable || !1,
18            n.configurable = !0,
19            "value"in n && (n.writable = !0),
20            Object.defineProperty(e, n.key, n)
21        }
22    }
23    function s() {
24        return "undefined" != typeof window
25    }
26    function t() {
27        return D || s() && (D = window.gsap) && D.registerPlugin && D
28    }
29    var D, L, O, N, U, K, q, V, j, J, Y, W, G, Q, X, r = (ScrollSmoother.register = function register(e) {
30        return L || (D = e || t(),
31        s() && window.document && (O = window,
32        N = document,
33        U = N.documentElement,
34        K = N.body),
35        D && (q = D.utils.toArray,
36        V = D.utils.clamp,
37        Y = D.parseEase("expo"),
38        Q = D.core.context || function() {}
39        ,
40        X = D.delayedCall(.2, function() {
41            return j.isRefreshing || J && J.refresh()
42        }).pause(),
43        j = D.core.globals().ScrollTrigger,
44        D.core.globals("ScrollSmoother", ScrollSmoother),
45        K && j && (W = j.core._getVelocityProp,
46        G = j.core._inputObserver,
47        ScrollSmoother.refresh = j.refresh,
48        L = 1))),
49        L
50    }
51    ,
52    function _createClass(e, t, r) {
53        return t && _defineProperties(e.prototype, t),
54        r && _defineProperties(e, r),
55        e
56    }(ScrollSmoother, [{
57        key: "progress",
58        get: function get() {
59            return this.scrollTrigger ? this.scrollTrigger.animation._time / 100 : 0
60        }
61    }]),
62    ScrollSmoother);
63    function ScrollSmoother(t) {
64        var o = this;
65        L || ScrollSmoother.register(D) || console.warn("Please gsap.registerPlugin(ScrollSmoother)"),
66        t = this.vars = t || {},
67        J && J.kill(),
68        Q(J = this);
69        function za() {
70            return z.update(-A)
71        }
72        function Ba() {
73            return n.style.overflow = "visible"
74        }
75        function Da(e) {
76            e.update();
77            var t = e.getTween();
78            t && (t.pause(),
79            t._time = t._dur,
80            t._tTime = t._tDur),
81            d = !1,
82            e.animation.progress(e.progress, !0)
83        }
84        function Ea(e, t) {
85            (e !== A && !u || t) && (x && (e = Math.round(e)),
86            C && (n.style.transform = "matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, " + e + ", 0, 1)",
87            n._gsap.y = e + "px"),
88            F = e - A,
89            A = e,
90            j.isUpdating || j.update())
91        }
92        function Fa(e) {
93            return arguments.length ? (e < 0 && (e = 0),
94            M.y = -e,
95            d = !0,
96            u ? A = -e : Ea(-e),
97            j.isRefreshing ? i.update() : _(e),
98            this) : -A
99        }
100        function Ha(e) {
101            b.scrollTop = 0,
102            e.target.contains && e.target.contains(b) || E && !1 === E(o, e) || (j.isInViewport(e.target) || e.target === g || o.scrollTo(e.target, !1, "center center"),
103            g = e.target)
104        }
105        function Ia(e) {
106            var r, n, o, i;
107            S.forEach(function(t) {
108                r = t.pins,
109                i = t.markers,
110                e.forEach(function(e) {
111                    t.trigger && e.trigger && t !== e && (e.trigger === t.trigger || e.pinnedContainer === t.trigger || t.trigger.contains(e.trigger)) && (n = e.start,
112                    o = (n - t.start - t.offset) / t.ratio - (n - t.start),
113                    r.forEach(function(e) {
114                        return o -= e.distance / t.ratio - e.distance
115                    }),
116                    e.setPositions(n + o, e.end + o),
117                    e.markerStart && i.push(D.quickSetter([e.markerStart, e.markerEnd], "y", "px")),
118                    e.pin && 0 < e.end && (o = e.end - e.start,
119                    r.push({
120                        start: e.start,
121                        end: e.end,
122                        distance: o,
123                        trig: e
124                    }),
125                    t.setPositions(t.start, t.end + o),
126                    t.vars.onRefresh(t)))
127                })
128            })
129        }
130        function Ja() {
131            Ba(),
132            requestAnimationFrame(Ba),
133            S && (S.forEach(function(e) {
134                var t = e.start
135                  , r = e.auto ? Math.min(j.maxScroll(e.scroller), e.end) : t + (e.end - t) / e.ratio
136                  , n = (r - e.end) / 2;
137                t -= n,
138                r -= n,
139                e.offset = n || 1e-4,
140                e.pins.length = 0,
141                e.setPositions(Math.min(t, r), Math.max(t, r)),
142                e.vars.onRefresh(e)
143            }),
144            Ia(j.sort())),
145            z.reset()
146        }
147        function Ka() {
148            return j.addEventListener("refresh", Ja)
149        }
150        function La() {
vendor: 17,152 bytes, lines 151-604
151            return S && S.forEach(function(e) {
152                return e.vars.onRefresh(e)
153            })
154        }
155        function Ma() {
156            return S && S.forEach(function(e) {
157                return e.vars.onRefreshInit(e)
158            }),
159            La
160        }
161        function Na(t, r, n, o) {
162            return function() {
163                var e = "function" == typeof r ? r(n, o) : r;
164                return e || 0 === e || (e = o.getAttribute("data-" + k + t) || ("speed" === t ? 1 : 0)),
165                o.setAttribute("data-" + k + t, e),
166                "auto" === e ? e : parseFloat(e)
167            }
168        }
169        function Oa(r, e, t, n, o) {
170            function Db() {
171                e = f(),
172                t = h(),
173                i = parseFloat(e) || 1,
174                c = (a = "auto" === e) ? 0 : .5,
175                l && l.kill(),
176                l = t && D.to(r, {
177                    ease: Y,
178                    overwrite: !1,
179                    y: "+=0",
180                    duration: t
181                }),
182                s && (s.ratio = i,
183                s.autoSpeed = a)
184            }
185            function Eb() {
186                g.y = d + "px",
187                g.renderTransform(1),
188                Db()
189            }
190            function Ib(e) {
191                if (a) {
192                    Eb();
193                    var t = function _autoDistance(e, t) {
194                        var r, n, o = e.parentNode || U, i = e.getBoundingClientRect(), s = o.getBoundingClientRect(), a = s.top - i.top, l = s.bottom - i.bottom, c = (Math.abs(a) > Math.abs(l) ? a : l) / (1 - t), u = -c * t;
195                        return 0 < c && (n = .5 == (r = s.height / (O.innerHeight + s.height)) ? 2 * s.height : 2 * Math.min(s.height, -c * r / (2 * r - 1)) * (t || 1),
196                        u += t ? -n * t : -n / 2,
197                        c += n),
198                        {
199                            change: c,
200                            offset: u
201                        }
202                    }(r, V(0, 1, -e.start / (e.end - e.start)));
203                    m = t.change,
204                    u = t.offset
205                } else
206                    m = (e.end - e.start) * (1 - i),
207                    u = 0;
208                p.forEach(function(e) {
209                    return m -= e.distance * (1 - i)
210                }),
211                e.vars.onUpdate(e),
212                l && l.progress(1)
213            }
214            o = ("function" == typeof o ? o(n, r) : o) || 0;
215            var i, s, a, l, c, u, f = Na("speed", e, n, r), h = Na("lag", t, n, r), d = D.getProperty(r, "y"), g = r._gsap, p = [], v = [], m = 0;
216            return Db(),
217            (1 !== i || a || l) && (Ib(s = j.create({
218                trigger: a ? r.parentNode : r,
219                start: "top bottom+=" + o,
220                end: "bottom top-=" + o,
221                scroller: b,
222                scrub: !0,
223                refreshPriority: -999,
224                onRefreshInit: Eb,
225                onRefresh: Ib,
226                onKill: function onKill(e) {
227                    var t = S.indexOf(e);
228                    0 <= t && S.splice(t, 1),
229                    Eb()
230                },
231                onUpdate: function onUpdate(e) {
232                    var t, r, n, o = d + m * (e.progress - c), i = p.length, s = 0;
233                    if (e.offset) {
234                        if (i) {
235                            for (r = -A,
236                            n = e.end; i--; ) {
237                                if ((t = p[i]).trig.isActive || r >= t.start && r <= t.end)
238                                    return void (l && (t.trig.progress += t.trig.direction < 0 ? .001 : -.001,
239                                    t.trig.update(0, 0, 1),
240                                    l.resetTo("y", parseFloat(g.y), -F, !0),
241                                    I && l.progress(1)));
242                                r > t.end && (s += t.distance),
243                                n -= t.distance
244                            }
245                            o = d + s + m * ((D.utils.clamp(e.start, e.end, r) - e.start - s) / (n - e.start) - c)
246                        }
247                        o = function _round(e) {
248                            return Math.round(1e5 * e) / 1e5 || 0
249                        }(o + u),
250                        v.length && !a && v.forEach(function(e) {
251                            return e(o - s)
252                        }),
253                        l ? (l.resetTo("y", o, -F, !0),
254                        I && l.progress(1)) : (g.y = o + "px",
255                        g.renderTransform(1))
256                    }
257                }
258            })),
259            D.core.getCache(s.trigger).stRevert = Ma,
260            s.startY = d,
261            s.pins = p,
262            s.markers = v,
263            s.ratio = i,
264            s.autoSpeed = a,
265            r.style.willChange = "transform"),
266            s
267        }
268        var n, b, e, i, S, s, a, l, c, u, r, f, h, d, g, p = t.smoothTouch, v = t.onUpdate, m = t.onStop, w = t.smooth, E = t.onFocusIn, T = t.normalizeScroll, x = t.wholePixels, P = this, R = "undefined" != typeof ResizeObserver && !1 !== t.autoResize && new ResizeObserver(function() {
269            return j.isRefreshing || X.restart(!0)
270        }
271        ), k = t.effectsPrefix || "", _ = j.getScrollFunc(O), C = 1 === j.isTouch ? !0 === p ? .8 : parseFloat(p) || 0 : 0 === w || !1 === w ? 0 : parseFloat(w) || .8, H = C && +t.speed || 1, A = 0, F = 0, I = 1, z = W(0), M = {
272            y: 0
273        };
274        function refreshHeight() {
275            return e = n.clientHeight,
276            n.style.overflow = "visible",
277            K.style.height = O.innerHeight + (e - O.innerHeight) / H + "px",
278            e - O.innerHeight
279        }
280        Ka(),
281        j.addEventListener("killAll", Ka),
282        D.delayedCall(.5, function() {
283            return I = 0
284        }),
285        this.scrollTop = Fa,
286        this.scrollTo = function(e, t, r) {
287            var n = D.utils.clamp(0, j.maxScroll(O), isNaN(e) ? o.offset(e, r) : +e);
288            t ? u ? D.to(o, {
289                duration: C,
290                scrollTop: n,
291                overwrite: "auto",
292                ease: Y
293            }) : _(n) : Fa(n)
294        }
295        ,
296        this.offset = function(e, t) {
297            var r, n = (e = q(e)[0]).style.cssText, o = j.create({
298                trigger: e,
299                start: t || "top top"
300            });
301            return S && Ia([o]),
302            r = o.start,
303            o.kill(!1),
304            e.style.cssText = n,
305            D.core.getCache(e).uncache = 1,
306            r
307        }
308        ,
309        this.content = function(e) {
310            if (arguments.length) {
311                var t = q(e || "#smooth-content")[0] || console.warn("ScrollSmoother needs a valid content element.") || K.children[0];
312                return t !== n && (c = (n = t).getAttribute("style") || "",
313                R && R.observe(n),
314                D.set(n, {
315                    overflow: "visible",
316                    width: "100%",
317                    boxSizing: "border-box",
318                    y: "+=0"
319                }),
320                C || D.set(n, {
321                    clearProps: "transform"
322                })),
323                this
324            }
325            return n
326        }
327        ,
328        this.wrapper = function(e) {
329            return arguments.length ? (b = q(e || "#smooth-wrapper")[0] || function _wrap(e) {
330                var t = N.querySelector(".ScrollSmoother-wrapper");
331                return t || ((t = N.createElement("div")).classList.add("ScrollSmoother-wrapper"),
332                e.parentNode.insertBefore(t, e),
333                t.appendChild(e)),
334                t
335            }(n),
336            l = b.getAttribute("style") || "",
337            refreshHeight(),
338            D.set(b, C ? {
339                overflow: "hidden",
340                position: "fixed",
341                height: "100%",
342                width: "100%",
343                top: 0,
344                left: 0,
345                right: 0,
346                bottom: 0
347            } : {
348                overflow: "visible",
349                position: "relative",
350                width: "100%",
351                height: "auto",
352                top: "auto",
353                bottom: "auto",
354                left: "auto",
355                right: "auto"
356            }),
357            this) : b
358        }
359        ,
360        this.effects = function(e, t) {
361            if (S = S || [],
362            !e)
363                return S.slice(0);
364            (e = q(e)).forEach(function(e) {
365                for (var t = S.length; t--; )
366                    S[t].trigger === e && S[t].kill()
367            });
368            t = t || {};
369            var r, n, o = t.speed, i = t.lag, s = t.effectsPadding, a = [];
370            for (r = 0; r < e.length; r++)
371                (n = Oa(e[r], o, i, r, s)) && a.push(n);
372            return S.push.apply(S, a),
373            a
374        }
375        ,
376        this.sections = function(e, t) {
377            if (s = s || [],
378            !e)
379                return s.slice(0);
380            var r = q(e).map(function(t) {
381                return j.create({
382                    trigger: t,
383                    start: "top 120%",
384                    end: "bottom -20%",
385                    onToggle: function onToggle(e) {
386                        t.style.opacity = e.isActive ? "1" : "0",
387                        t.style.pointerEvents = e.isActive ? "all" : "none"
388                    }
389                })
390            });
391            return t && t.add ? s.push.apply(s, r) : s = r.slice(0),
392            r
393        }
394        ,
395        this.content(t.content),
396        this.wrapper(t.wrapper),
397        this.render = function(e) {
398            return Ea(e || 0 === e ? e : A)
399        }
400        ,
401        this.getVelocity = function() {
402            return z.getVelocity(-A)
403        }
404        ,
405        j.scrollerProxy(b, {
406            scrollTop: Fa,
407            scrollHeight: function scrollHeight() {
408                return refreshHeight() && K.scrollHeight
409            },
410            fixedMarkers: !1 !== t.fixedMarkers && !!C,
411            content: n,
412            getBoundingClientRect: function getBoundingClientRect() {
413                return {
414                    top: 0,
415                    left: 0,
416                    width: O.innerWidth,
417                    height: O.innerHeight
418                }
419            }
420        }),
421        j.defaults({
422            scroller: b
423        });
424        var B = j.getAll().filter(function(e) {
425            return e.scroller === O || e.scroller === b
426        });
427        B.forEach(function(e) {
428            return e.revert(!0, !0)
429        }),
430        i = j.create({
431            animation: D.fromTo(M, {
432                y: 0
433            }, {
434                y: function y() {
435                    return -refreshHeight()
436                },
437                immediateRender: !1,
438                ease: "none",
439                data: "ScrollSmoother",
440                duration: 100,
441                onUpdate: function onUpdate() {
442                    if (this._dur) {
443                        var e = d;
444                        e && (Da(i),
445                        M.y = A),
446                        Ea(M.y, e),
447                        za(),
448                        v && !u && v(P)
449                    }
450                }
451            }),
452            onRefreshInit: function onRefreshInit(e) {
453                if (S) {
454                    var t = j.getAll().filter(function(e) {
455                        return !!e.pin
456                    });
457                    S.forEach(function(r) {
458                        r.vars.pinnedContainer || t.forEach(function(e) {
459                            if (e.pin.contains(r.trigger)) {
460                                var t = r.vars;
461                                t.pinnedContainer = e.pin,
462                                r.vars = null,
463                                r.init(t, r.animation)
464                            }
465                        })
466                    })
467                }
468                var r = e.getTween();
469                h = r && r._end > r._dp._time,
470                f = A,
471                M.y = 0,
472                C && (b.style.pointerEvents = "none",
473                b.scrollTop = 0,
474                setTimeout(function() {
475                    return b.style.removeProperty("pointer-events")
476                }, 50))
477            },
478            onRefresh: function onRefresh(e) {
479                e.animation.invalidate(),
480                e.setPositions(e.start, refreshHeight() / H),
481                h || Da(e),
482                M.y = -_(),
483                Ea(M.y),
484                I || e.animation.progress(D.utils.clamp(0, 1, f / -e.end)),
485                h && (e.progress -= .001,
486                e.update())
487            },
488            id: "ScrollSmoother",
489            scroller: O,
490            invalidateOnRefresh: !0,
491            start: 0,
492            refreshPriority: -9999,
493            end: function end() {
494                return refreshHeight() / H
495            },
496            onScrubComplete: function onScrubComplete() {
497                z.reset(),
498                m && m(o)
499            },
500            scrub: C || !0
501        }),
502        this.smooth = function(e) {
503            return arguments.length && (H = (C = e || 0) && +t.speed || 1,
504            i.scrubDuration(e)),
505            i.getTween() ? i.getTween().duration() : 0
506        }
507        ,
508        i.getTween() && (i.getTween().vars.ease = t.ease || Y),
509        this.scrollTrigger = i,
510        t.effects && this.effects(!0 === t.effects ? "[data-" + k + "speed], [data-" + k + "lag]" : t.effects, {
511            effectsPadding: t.effectsPadding
512        }),
513        t.sections && this.sections(!0 === t.sections ? "[data-section]" : t.sections),
514        B.forEach(function(e) {
515            e.vars.scroller = b,
516            e.revert(!1, !0),
517            e.init(e.vars, e.animation)
518        }),
519        this.paused = function(e, t) {
520            return arguments.length ? (!!u !== e && (e ? (i.getTween() && i.getTween().pause(),
521            _(-A),
522            z.reset(),
523            (r = j.normalizeScroll()) && r.disable(),
524            (u = j.observe({
525                preventDefault: !0,
526                type: "wheel,touch,scroll",
527                debounce: !1,
528                allowClicks: !0,
529                onChangeY: function onChangeY() {
530                    return Fa(-A)
531                }
532            })).nested = G(U, "wheel,touch,scroll", !0, !1 !== t)) : (u.nested.kill(),
533            u.kill(),
534            u = 0,
535            r && r.enable(),
536            i.progress = (-A - i.start) / (i.end - i.start),
537            Da(i))),
538            this) : !!u
539        }
540        ,
541        this.kill = this.revert = function() {
542            o.paused(!1),
543            Da(i),
544            i.kill();
545            for (var e = (S || []).concat(s || []), t = e.length; t--; )
546                e[t].kill();
547            j.scrollerProxy(b),
548            j.removeEventListener("killAll", Ka),
549            j.removeEventListener("refresh", Ja),
550            b.style.cssText = l,
551            n.style.cssText = c;
552            var r = j.defaults({});
553            r && r.scroller === b && j.defaults({
554                scroller: O
555            }),
556            o.normalizer && j.normalizeScroll(!1),
557            clearInterval(a),
558            J = null,
559            R && R.disconnect(),
560            K.style.removeProperty("height"),
561            O.removeEventListener("focusin", Ha)
562        }
563        ,
564        this.refresh = function(e, t) {
565            return i.refresh(e, t)
566        }
567        ,
568        T && (this.normalizer = j.normalizeScroll(!0 === T ? {
569            debounce: !0,
570            content: !C && n
571        } : T)),
572        j.config(t),
573        "overscrollBehavior"in O.getComputedStyle(K) && D.set([K, U], {
574            overscrollBehavior: "none"
575        }),
576        "scrollBehavior"in O.getComputedStyle(K) && D.set([K, U], {
577            scrollBehavior: "auto"
578        }),
579        O.addEventListener("focusin", Ha),
580        a = setInterval(za, 250),
581        "loading" === N.readyState || requestAnimationFrame(function() {
582            return j.refresh()
583        })
584    }
585    r.version = "3.11.4",
586    r.create = function(e) {
587        return J && e && J.content() === q(e.content)[0] ? J : new r(e)
588    }
589    ,
590    r.get = function() {
591        return J
592    }
593    ,
594    t() && D.registerPlugin(r),
595    e.ScrollSmoother = r,
596    e.default = r;
597    if (typeof (window) === "undefined" || window !== e) {
598        Object.defineProperty(e, "__esModule", {
599            value: !0
600        })
601    } else {
602        delete e.default
603    }
604});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.