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0B,GAEnD,EAAY,sBAAsB,KAMlC,EAAgB,SAAS,EAAG,GAC5B,qBAAqB,GAErB,IAEA,iBAAiB,OAAO,EAAgB,SAAS,GAEjD,GAAQ,GACZ,EAGJ,EAAY,sBAAsB,EAAK,GAE/C,GACJ,CACA,QAAQ,QAAU","file":"/npm/animated-scroll-to@2.3.1/dist/cjs/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.37.0.\n * Original file: /npm/animated-scroll-to@2.3.1/dist/cjs/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n    return new (P || (P = Promise))(function (resolve, reject) {\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\n    });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n// --------- HELPERS\nfunction getElementOffset(el) {\n    let top = 0;\n    let left = 0;\n    let element = el;\n    // Loop through the DOM tree\n    // and add it's parent's offset to get page offset\n    do {\n        top += element.offsetTop || 0;\n        left += element.offsetLeft || 0;\n        element = element.offsetParent;\n    } while (element);\n    return {\n        top,\n        left,\n    };\n}\n// --------- SCROLL INTERFACES\n// ScrollDomElement and ScrollWindow have identical interfaces\nclass ScrollDomElement {\n    constructor(element) {\n        this.element = element;\n    }\n    getHorizontalScroll() {\n        return this.element.scrollLeft;\n    }\n    getVerticalScroll() {\n        return this.element.scrollTop;\n    }\n    getMaxHorizontalScroll() {\n        return this.element.scrollWidth - this.element.clientWidth;\n    }\n    getMaxVerticalScroll() {\n        return this.element.scrollHeight - this.element.clientHeight;\n    }\n    getHorizontalElementScrollOffset(elementToScrollTo, elementToScroll) {\n        return (getElementOffset(elementToScrollTo).left -\n            getElementOffset(elementToScroll).left);\n    }\n    getVerticalElementScrollOffset(elementToScrollTo, elementToScroll) {\n        return (getElementOffset(elementToScrollTo).top -\n            getElementOffset(elementToScroll).top);\n    }\n    scrollTo(x, y) {\n        this.element.scrollLeft = x;\n        this.element.scrollTop = y;\n    }\n}\nclass ScrollWindow {\n    constructor() {\n        this.element = window;\n    }\n    getHorizontalScroll() {\n        return window.scrollX || document.documentElement.scrollLeft;\n    }\n    getVerticalScroll() {\n        return window.scrollY || document.documentElement.scrollTop;\n    }\n    getMaxHorizontalScroll() {\n        return (Math.max(document.body.scrollWidth, document.documentElement.scrollWidth, document.body.offsetWidth, document.documentElement.offsetWidth, document.body.clientWidth, document.documentElement.clientWidth) - window.innerWidth);\n    }\n    getMaxVerticalScroll() {\n        return (Math.max(document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.offsetHeight, document.body.clientHeight, document.documentElement.clientHeight) - window.innerHeight);\n    }\n    getHorizontalElementScrollOffset(elementToScrollTo) {\n        const scrollLeft = window.scrollX || document.documentElement.scrollLeft;\n        return scrollLeft + elementToScrollTo.getBoundingClientRect().left;\n    }\n    getVerticalElementScrollOffset(elementToScrollTo) {\n        const scrollTop = window.scrollY || document.documentElement.scrollTop;\n        return scrollTop + elementToScrollTo.getBoundingClientRect().top;\n    }\n    scrollTo(x, y) {\n        window.scrollTo(x, y);\n    }\n}\nconst activeAnimations = {\n    elements: [],\n    cancelMethods: [],\n    add: (element, cancelAnimation) => {\n        activeAnimations.elements.push(element);\n        activeAnimations.cancelMethods.push(cancelAnimation);\n    },\n    remove: (element, shouldStop) => {\n        const index = activeAnimations.elements.indexOf(element);\n        if (index > -1) {\n            // Stop animation\n            if (shouldStop) {\n                activeAnimations.cancelMethods[index]();\n            }\n            // Remove it\n            activeAnimations.elements.splice(index, 1);\n            activeAnimations.cancelMethods.splice(index, 1);\n        }\n    },\n};\n// --------- CHECK IF CODE IS RUNNING IN A BROWSER\nconst WINDOW_EXISTS = typeof window !== 'undefined';\n// --------- ANIMATE SCROLL TO\nconst defaultOptions = {\n    cancelOnUserAction: true,\n    easing: (t) => --t * t * t + 1, // easeOutCubic\n    elementToScroll: WINDOW_EXISTS ? window : null, // Check for server side rendering\n    horizontalOffset: 0,\n    maxDuration: 3000,\n    minDuration: 250,\n    speed: 500,\n    verticalOffset: 0,\n};\nfunction animateScrollTo(numberOrCoordsOrElement_1) {\n    return __awaiter(this, arguments, void 0, function* (numberOrCoordsOrElement, userOptions = {}) {\n        // Check for server rendering\n        if (!WINDOW_EXISTS) {\n            // @ts-ignore\n            // If it still gets called on server, return Promise for API consistency\n            return new Promise((resolve) => {\n                resolve(false); // Returning false on server\n            });\n        }\n        else if (!window.Promise) {\n            throw \"Browser doesn't support Promises, and animated-scroll-to depends on it, please provide a polyfill.\";\n        }\n        let x;\n        let y;\n        let scrollToElement;\n        let options = Object.assign(Object.assign({}, defaultOptions), userOptions);\n        const isWindow = options.elementToScroll === window;\n        const isElement = !!options.elementToScroll.nodeName;\n        if (!isWindow && !isElement) {\n            throw 'Element to scroll needs to be either window or DOM element.';\n        }\n        // Check for a few properties that can break the animation\n        // \"scroll-behavior: smooth\"\n        // \"scroll-snap-type: [x/y] mandatory\"\n        // https://github.com/Stanko/animated-scroll-to/issues/55\n        // https://github.com/Stanko/animated-scroll-to/issues/71\n        const WARN_ABOUT = [\n            { property: 'scroll-behavior', value: 'smooth' },\n            { property: 'scroll-snap-type', value: 'mandatory' },\n        ];\n        const scrollBehaviorElement = isWindow\n            ? document.documentElement\n            : options.elementToScroll;\n        const computedStyles = getComputedStyle(scrollBehaviorElement);\n        WARN_ABOUT.forEach(({ property, value }) => {\n            const cssValue = computedStyles.getPropertyValue(property);\n            if (cssValue.includes(value)) {\n                console.warn(`${scrollBehaviorElement.tagName} has \"${property}: ${cssValue}\" which can break animated-scroll-to's animations`);\n            }\n        });\n        // Select the correct scrolling interface\n        const elementToScroll = isWindow\n            ? new ScrollWindow()\n            : new ScrollDomElement(options.elementToScroll);\n        if (numberOrCoordsOrElement instanceof Element) {\n            scrollToElement = numberOrCoordsOrElement;\n            // If \"elementToScroll\" is not a parent of \"scrollToElement\"\n            if (isElement &&\n                (!options.elementToScroll.contains(scrollToElement) ||\n                    options.elementToScroll.isSameNode(scrollToElement))) {\n                throw 'options.elementToScroll has to be a parent of scrollToElement';\n            }\n            x = elementToScroll.getHorizontalElementScrollOffset(scrollToElement, options.elementToScroll);\n            y = elementToScroll.getVerticalElementScrollOffset(scrollToElement, options.elementToScroll);\n        }\n        else if (typeof numberOrCoordsOrElement === 'number') {\n            x = elementToScroll.getHorizontalScroll();\n            y = numberOrCoordsOrElement;\n        }\n        else if (Array.isArray(numberOrCoordsOrElement) &&\n            numberOrCoordsOrElement.length === 2) {\n            x =\n                numberOrCoordsOrElement[0] === null\n                    ? elementToScroll.getHorizontalScroll()\n                    : numberOrCoordsOrElement[0];\n            y =\n                numberOrCoordsOrElement[1] === null\n                    ? elementToScroll.getVerticalScroll()\n                    : numberOrCoordsOrElement[1];\n        }\n        else {\n            // ERROR\n            throw ('Wrong function signature. Check documentation.\\n' +\n                'Available method signatures are:\\n' +\n                '  animateScrollTo(y:number, options)\\n' +\n                '  animateScrollTo([x:number | null, y:number | null], options)\\n' +\n                '  animateScrollTo(scrollToElement:Element, options)');\n        }\n        // Add offsets\n        x += options.horizontalOffset;\n        y += options.verticalOffset;\n        // Horizontal scroll distance\n        const maxHorizontalScroll = elementToScroll.getMaxHorizontalScroll();\n        const initialHorizontalScroll = elementToScroll.getHorizontalScroll();\n        // If user specified scroll position is greater than maximum available scroll\n        if (x > maxHorizontalScroll) {\n            x = maxHorizontalScroll;\n        }\n        // Calculate distance to scroll\n        const horizontalDistanceToScroll = x - initialHorizontalScroll;\n        // Vertical scroll distance distance\n        const maxVerticalScroll = elementToScroll.getMaxVerticalScroll();\n        const initialVerticalScroll = elementToScroll.getVerticalScroll();\n        // If user specified scroll position is greater than maximum available scroll\n        if (y > maxVerticalScroll) {\n            y = maxVerticalScroll;\n        }\n        // Calculate distance to scroll\n        const verticalDistanceToScroll = y - initialVerticalScroll;\n        // Calculate duration of the scroll\n        const horizontalDuration = Math.abs(Math.round((horizontalDistanceToScroll / 1000) * options.speed));\n        const verticalDuration = Math.abs(Math.round((verticalDistanceToScroll / 1000) * options.speed));\n        let duration = horizontalDuration > verticalDuration\n            ? horizontalDuration\n            : verticalDuration;\n        // Set minimum and maximum duration\n        if (duration < options.minDuration) {\n            duration = options.minDuration;\n        }\n        else if (duration > options.maxDuration) {\n            duration = options.maxDuration;\n        }\n        // @ts-ignore\n        return new Promise((resolve, reject) => {\n            // Scroll is already in place, nothing to do\n            if (horizontalDistanceToScroll === 0 && verticalDistanceToScroll === 0) {\n                // Resolve promise with a boolean hasScrolledToPosition set to true\n                resolve(true);\n            }\n            // Cancel existing animation if it is already running on the same element\n            activeAnimations.remove(elementToScroll.element, true);\n            // To cancel animation we have to store request animation frame ID\n            let requestID;\n            // Cancel animation handler\n            const cancelAnimation = () => {\n                removeListeners();\n                cancelAnimationFrame(requestID);\n                // Resolve promise with a boolean hasScrolledToPosition set to false\n                resolve(false);\n            };\n            // Registering animation so it can be canceled if function\n            // gets called again on the same element\n            activeAnimations.add(elementToScroll.element, cancelAnimation);\n            // Prevent user actions handler\n            const preventDefaultHandler = (e) => e.preventDefault();\n            const handler = options.cancelOnUserAction\n                ? cancelAnimation\n                : preventDefaultHandler;\n            // If animation is not cancelable by the user, we can't use passive events\n            const eventOptions = options.cancelOnUserAction\n                ? { passive: true }\n                : { passive: false };\n            const events = ['wheel', 'touchstart', 'keydown', 'mousedown'];\n            // Function to remove listeners after animation is finished\n            const removeListeners = () => {\n                events.forEach((eventName) => {\n                    elementToScroll.element.removeEventListener(eventName, handler, eventOptions);\n                });\n            };\n            // Add listeners\n            events.forEach((eventName) => {\n                elementToScroll.element.addEventListener(eventName, handler, eventOptions);\n            });\n            // Animation\n            const startingTime = Date.now();\n            const step = () => {\n                var timeDiff = Date.now() - startingTime;\n                var t = timeDiff / duration;\n                const horizontalScrollPosition = Math.round(initialHorizontalScroll +\n                    horizontalDistanceToScroll * options.easing(t));\n                const verticalScrollPosition = Math.round(initialVerticalScroll + verticalDistanceToScroll * options.easing(t));\n                if (timeDiff < duration &&\n                    (horizontalScrollPosition !== x || verticalScrollPosition !== y)) {\n                    // If scroll didn't reach desired position or time is not elapsed\n                    // Scroll to a new position\n                    elementToScroll.scrollTo(horizontalScrollPosition, verticalScrollPosition);\n                    // And request a new step\n                    requestID = requestAnimationFrame(step);\n                }\n                else {\n                    // If the time elapsed or we reached the desired offset\n                    // Set scroll to the desired offset (when rounding made it to be off a pixel or two)\n                    // Clear animation frame to be sure\n                    elementToScroll.scrollTo(x, y);\n                    cancelAnimationFrame(requestID);\n                    // Remove listeners\n                    removeListeners();\n                    // Remove animation from the active animations coordinator\n                    activeAnimations.remove(elementToScroll.element, false);\n                    // Resolve promise with a boolean hasScrolledToPosition set to true\n                    resolve(true);\n                }\n            };\n            // Start animating scroll\n            requestID = requestAnimationFrame(step);\n        });\n    });\n}\nexports.default = animateScrollTo;\n"]}