{"version":3,"sources":["../assets/scripts/smooth-scroll.polyfills.js"],"names":["window","Element","prototype","closest","s","i","matches","this","document","ownerDocument","querySelectorAll","el","length","item","parentElement","CustomEvent","event","params","bubbles","cancelable","detail","undefined","evt","createEvent","initCustomEvent","Event","lastTime","vendors","x","requestAnimationFrame","cancelAnimationFrame","callback","element","currTime","Date","getTime","timeToCall","Math","max","id","setTimeout","clearTimeout","root","factory","define","amd","exports","module","SmoothScroll","global","defaults","ignore","header","topOnEmptyHash","speed","speedAsDuration","durationMax","durationMin","clip","offset","easing","customEasing","updateURL","popstate","emitEvents","supports","extend","merged","Array","forEach","call","arguments","obj","key","hasOwnProperty","reduceMotion","settings","matchMedia","getHeight","elem","parseInt","getComputedStyle","height","escapeCharacters","charAt","substr","codeUnit","string","String","index","result","firstCodeUnit","charCodeAt","InvalidCharacterError","toString","easingPattern","time","pattern","getDocumentHeight","body","scrollHeight","documentElement","offsetHeight","clientHeight","getEndLocation","anchor","headerHeight","location","offsetParent","offsetTop","min","innerHeight","getHeaderHeight","getSpeed","distance","abs","setHistory","options","history","replaceState","state","hash","pageYOffset","smoothScroll","JSON","stringify","title","href","isNum","pushState","adjustFocus","endLocation","focus","activeElement","setAttribute","style","outline","scrollTo","emitEvent","type","toggle","dispatchEvent","selector","fixedHeader","eventTimeout","animationInterval","cancelScroll","noEvent","animateScroll","_settings","Object","anchorElem","tagName","startLocation","querySelector","start","percentage","position","documentHeight","timeLapsed","stopAnimateScroll","currentLocation","loopAnimateScroll","timestamp","floor","clickHandler","button","metaKey","ctrlKey","target","toLowerCase","hostname","pathname","test","preventDefault","popstateHandler","destroy","removeEventListener","init","addEventListener"],"mappings":"AAYAA,OAAAC,UAAAA,QAAAC,UAAAC,UACAF,QAAAC,UAAAC,QAAA,SAAAC,GACA,GACAC,GADAC,GAAAC,KAAAC,UAAAD,KAAAE,eAAAC,iBAAAN,GAEAO,EAAAJ,IACA,GAEA,KADAF,EAAAC,EAAAM,SACAP,GAAA,GAAAC,EAAA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,CAOA,GAAA6B,GAAAa,QAAAE,MAAAf,MACAA,IAAA,IAAAA,KACAA,EAAAjG,SAAAkJ,cAAAvE,EAAAmC,QAAAE,MAAAf,WAKAkB,EAAAyB,cAAA3C,EAAA,MACA3C,WAAA,KAoEA,OA5DA6D,GAAAqD,QAAA,WAGApG,IAGApE,SAAAyK,oBAAA,QAAAZ,GAAA,GACArK,EAAAiL,oBAAA,WAAAF,GAAA,GAGApD,EAAAuB,eAGAtE,EAAA,KACA6B,EAAA,KACAmC,EAAA,KACAG,EAAA,KACAC,EAAA,KACAC,EAAA,OAQAtB,EAAAuD,KAAA,SAAA7D,GAGA,IAAApD,IAAA,KAAA,gGAGA0D,GAAAqD,UAGApG,EAAAV,EAAAhB,EAAAmE,OACA0B,EAAAnE,EAAAxB,OAAA5C,SAAAkJ,cAAA9E,EAAAxB,QAAA,KAGA5C,SAAA2K,iBAAA,QAAAd,GAAA,GAGAzF,EAAAd,WAAAc,EAAAb,UACA/D,EAAAmL,iBAAA,WAAAJ,GAAA,IAUApD,EAAAuD,KAAA7D,GAOAM,EAIA,OAAA3E","file":"smooth-scroll.polyfills.js","sourcesContent":["/*!\n * smooth-scroll v15.2.0\n * Animate scrolling to anchor links\n * (c) 2019 Chris Ferdinandi\n * MIT License\n * http://github.com/cferdinandi/smooth-scroll\n */\n\n/**\n * closest() polyfill\n * @link https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Polyfill\n */\nif (window.Element && !Element.prototype.closest) {\n Element.prototype.closest = function (s) {\n var matches = (this.document || this.ownerDocument).querySelectorAll(s),\n i,\n el = this;\n do {\n i = matches.length;\n while (--i >= 0 && matches.item(i) !== el) {}\n } while ((i < 0) && (el = el.parentElement));\n return el;\n };\n}\n\n/**\n * CustomEvent() polyfill\n * https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill\n */\n(function () {\n\n if (typeof window.CustomEvent === \"function\") return false;\n\n function CustomEvent(event, params) {\n params = params || {\n bubbles: false,\n cancelable: false,\n detail: undefined\n };\n var evt = document.createEvent('CustomEvent');\n evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n return evt;\n }\n\n CustomEvent.prototype = window.Event.prototype;\n\n window.CustomEvent = CustomEvent;\n})();\n/**\n * requestAnimationFrame() polyfill\n * By Erik Möller. Fixes from Paul Irish and Tino Zijdel.\n * @link http://paulirish.com/2011/requestanimationframe-for-smart-animating/\n * @link http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating\n * @license MIT\n */\n(function () {\n var lastTime = 0;\n var vendors = ['ms', 'moz', 'webkit', 'o'];\n for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {\n window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];\n window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] ||\n window[vendors[x] + 'CancelRequestAnimationFrame'];\n }\n\n if (!window.requestAnimationFrame) {\n window.requestAnimationFrame = function (callback, element) {\n var currTime = new Date().getTime();\n var timeToCall = Math.max(0, 16 - (currTime - lastTime));\n var id = window.setTimeout((function () {\n callback(currTime + timeToCall);\n }),\n timeToCall);\n lastTime = currTime + timeToCall;\n return id;\n };\n }\n\n if (!window.cancelAnimationFrame) {\n window.cancelAnimationFrame = function (id) {\n clearTimeout(id);\n };\n }\n}());\n\n(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define([], (function () {\n return factory(root);\n }));\n } else if (typeof exports === 'object') {\n module.exports = factory(root);\n } else {\n root.SmoothScroll = factory(root);\n }\n})(typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : this, (function (window) {\n\n 'use strict';\n\n //\n // Default settings\n //\n\n var defaults = {\n\n // Selectors\n ignore: '[data-scroll-ignore]',\n header: null,\n topOnEmptyHash: true,\n\n // Speed & Duration\n speed: 1000,\n speedAsDuration: false,\n durationMax: null,\n durationMin: null,\n clip: true,\n offset: 0,\n\n // Easing\n easing: 'linear',\n customEasing: null,\n\n // History\n updateURL: true,\n popstate: true,\n\n // Custom Events\n emitEvents: true\n\n };\n\n\n //\n // Utility Methods\n //\n\n /**\n * Check if browser supports required methods\n * @return {Boolean} Returns true if all required methods are supported\n */\n var supports = function () {\n return (\n 'querySelector' in document &&\n 'addEventListener' in window &&\n 'requestAnimationFrame' in window &&\n 'closest' in window.Element.prototype\n );\n };\n\n /**\n * Merge two or more objects together.\n * @param {Object} objects The objects to merge together\n * @returns {Object} Merged values of defaults and options\n */\n var extend = function () {\n var merged = {};\n Array.prototype.forEach.call(arguments, (function (obj) {\n for (var key in obj) {\n if (!obj.hasOwnProperty(key)) return;\n merged[key] = obj[key];\n }\n }));\n return merged;\n };\n\n /**\n * Check to see if user prefers reduced motion\n * @param {Object} settings Script settings\n */\n var reduceMotion = function (settings) {\n if ('matchMedia' in window && window.matchMedia('(prefers-reduced-motion)').matches) {\n return true;\n }\n return false;\n };\n\n /**\n * Get the height of an element.\n * @param {Node} elem The element to get the height of\n * @return {Number} The element's height in pixels\n */\n var getHeight = function (elem) {\n return parseInt(window.getComputedStyle(elem).height, 10);\n };\n\n /**\n * Escape special characters for use with querySelector\n * @author Mathias Bynens\n * @link https://github.com/mathiasbynens/CSS.escape\n * @param {String} id The anchor ID to escape\n */\n var escapeCharacters = function (id) {\n\n // Remove leading hash\n if (id.charAt(0) === '#') {\n id = id.substr(1);\n }\n\n var string = String(id);\n var length = string.length;\n var index = -1;\n var codeUnit;\n var result = '';\n var firstCodeUnit = string.charCodeAt(0);\n while (++index < length) {\n codeUnit = string.charCodeAt(index);\n // Note: there’s no need to special-case astral symbols, surrogate\n // pairs, or lone surrogates.\n\n // If the character is NULL (U+0000), then throw an\n // `InvalidCharacterError` exception and terminate these steps.\n if (codeUnit === 0x0000) {\n throw new InvalidCharacterError(\n 'Invalid character: the input contains U+0000.'\n );\n }\n\n if (\n // If the character is in the range [\\1-\\1F] (U+0001 to U+001F) or is\n // U+007F, […]\n (codeUnit >= 0x0001 && codeUnit <= 0x001F) || codeUnit == 0x007F ||\n // If the character is the first character and is in the range [0-9]\n // (U+0030 to U+0039), […]\n (index === 0 && codeUnit >= 0x0030 && codeUnit <= 0x0039) ||\n // If the character is the second character and is in the range [0-9]\n // (U+0030 to U+0039) and the first character is a `-` (U+002D), […]\n (\n index === 1 &&\n codeUnit >= 0x0030 && codeUnit <= 0x0039 &&\n firstCodeUnit === 0x002D\n )\n ) {\n // http://dev.w3.org/csswg/cssom/#escape-a-character-as-code-point\n result += '\\\\' + codeUnit.toString(16) + ' ';\n continue;\n }\n\n // If the character is not handled by one of the above rules and is\n // greater than or equal to U+0080, is `-` (U+002D) or `_` (U+005F), or\n // is in one of the ranges [0-9] (U+0030 to U+0039), [A-Z] (U+0041 to\n // U+005A), or [a-z] (U+0061 to U+007A), […]\n if (\n codeUnit >= 0x0080 ||\n codeUnit === 0x002D ||\n codeUnit === 0x005F ||\n codeUnit >= 0x0030 && codeUnit <= 0x0039 ||\n codeUnit >= 0x0041 && codeUnit <= 0x005A ||\n codeUnit >= 0x0061 && codeUnit <= 0x007A\n ) {\n // the character itself\n result += string.charAt(index);\n continue;\n }\n\n // Otherwise, the escaped character.\n // http://dev.w3.org/csswg/cssom/#escape-a-character\n result += '\\\\' + string.charAt(index);\n\n }\n\n // Return sanitized hash\n return '#' + result;\n\n };\n\n /**\n * Calculate the easing pattern\n * @link https://gist.github.com/gre/1650294\n * @param {String} type Easing pattern\n * @param {Number} time Time animation should take to complete\n * @returns {Number}\n */\n var easingPattern = function (settings, time) {\n var pattern;\n\n // Default Easing Patterns\n if (settings.easing === 'easeInQuad') pattern = time * time; // accelerating from zero velocity\n if (settings.easing === 'easeOutQuad') pattern = time * (2 - time); // decelerating to zero velocity\n if (settings.easing === 'easeInOutQuad') pattern = time < 0.5 ? 2 * time * time : -1 + (4 - 2 * time) * time; // acceleration until halfway, then deceleration\n if (settings.easing === 'easeInCubic') pattern = time * time * time; // accelerating from zero velocity\n if (settings.easing === 'easeOutCubic') pattern = (--time) * time * time + 1; // decelerating to zero velocity\n if (settings.easing === 'easeInOutCubic') pattern = time < 0.5 ? 4 * time * time * time : (time - 1) * (2 * time - 2) * (2 * time - 2) + 1; // acceleration until halfway, then deceleration\n if (settings.easing === 'easeInQuart') pattern = time * time * time * time; // accelerating from zero velocity\n if (settings.easing === 'easeOutQuart') pattern = 1 - (--time) * time * time * time; // decelerating to zero velocity\n if (settings.easing === 'easeInOutQuart') pattern = time < 0.5 ? 8 * time * time * time * time : 1 - 8 * (--time) * time * time * time; // acceleration until halfway, then deceleration\n if (settings.easing === 'easeInQuint') pattern = time * time * time * time * time; // accelerating from zero velocity\n if (settings.easing === 'easeOutQuint') pattern = 1 + (--time) * time * time * time * time; // decelerating to zero velocity\n if (settings.easing === 'easeInOutQuint') pattern = time < 0.5 ? 16 * time * time * time * time * time : 1 + 16 * (--time) * time * time * time * time; // acceleration until halfway, then deceleration\n\n // Custom Easing Patterns\n if (!!settings.customEasing) pattern = settings.customEasing(time);\n\n return pattern || time; // no easing, no acceleration\n };\n\n /**\n * Determine the document's height\n * @returns {Number}\n */\n var getDocumentHeight = function () {\n return Math.max(\n document.body.scrollHeight, document.documentElement.scrollHeight,\n document.body.offsetHeight, document.documentElement.offsetHeight,\n document.body.clientHeight, document.documentElement.clientHeight\n );\n };\n\n /**\n * Calculate how far to scroll\n * Clip support added by robjtede - https://github.com/cferdinandi/smooth-scroll/issues/405\n * @param {Element} anchor The anchor element to scroll to\n * @param {Number} headerHeight Height of a fixed header, if any\n * @param {Number} offset Number of pixels by which to offset scroll\n * @param {Boolean} clip If true, adjust scroll distance to prevent abrupt stops near the bottom of the page\n * @returns {Number}\n */\n var getEndLocation = function (anchor, headerHeight, offset, clip) {\n var location = 0;\n if (anchor.offsetParent) {\n do {\n location += anchor.offsetTop;\n anchor = anchor.offsetParent;\n } while (anchor);\n }\n location = Math.max(location - headerHeight - offset, 0);\n if (clip) {\n location = Math.min(location, getDocumentHeight() - window.innerHeight);\n }\n return location;\n };\n\n /**\n * Get the height of the fixed header\n * @param {Node} header The header\n * @return {Number} The height of the header\n */\n var getHeaderHeight = function (header) {\n return !header ? 0 : (getHeight(header) + header.offsetTop);\n };\n\n /**\n * Calculate the speed to use for the animation\n * @param {Number} distance The distance to travel\n * @param {Object} settings The plugin settings\n * @return {Number} How fast to animate\n */\n var getSpeed = function (distance, settings) {\n var speed = settings.speedAsDuration ? settings.speed : Math.abs(distance / 1000 * settings.speed);\n if (settings.durationMax && speed > settings.durationMax) return settings.durationMax;\n if (settings.durationMin && speed < settings.durationMin) return settings.durationMin;\n return parseInt(speed, 10);\n };\n\n var setHistory = function (options) {\n\n // Make sure this should run\n if (!history.replaceState || !options.updateURL || history.state) return;\n\n // Get the hash to use\n var hash = window.location.hash;\n hash = hash ? hash : window.pageYOffset;\n\n // Set a default history\n history.replaceState({\n smoothScroll: JSON.stringify(options),\n anchor: hash ? hash : window.pageYOffset\n },\n document.title,\n hash ? hash : window.location.href\n );\n\n };\n\n /**\n * Update the URL\n * @param {Node} anchor The anchor that was scrolled to\n * @param {Boolean} isNum If true, anchor is a number\n * @param {Object} options Settings for Smooth Scroll\n */\n var updateURL = function (anchor, isNum, options) {\n\n // Bail if the anchor is a number\n if (isNum) return;\n\n // Verify that pushState is supported and the updateURL option is enabled\n if (!history.pushState || !options.updateURL) return;\n\n // Update URL\n history.pushState({\n smoothScroll: JSON.stringify(options),\n anchor: anchor.id\n },\n document.title,\n anchor === document.documentElement ? '#top' : '#' + anchor.id\n );\n\n };\n\n /**\n * Bring the anchored element into focus\n * @param {Node} anchor The anchor element\n * @param {Number} endLocation The end location to scroll to\n * @param {Boolean} isNum If true, scroll is to a position rather than an element\n */\n var adjustFocus = function (anchor, endLocation, isNum) {\n\n // Is scrolling to top of page, blur\n if (anchor === 0) {\n document.body.focus();\n }\n\n // Don't run if scrolling to a number on the page\n if (isNum) return;\n\n // Otherwise, bring anchor element into focus\n anchor.focus();\n if (document.activeElement !== anchor) {\n anchor.setAttribute('tabindex', '-1');\n anchor.focus();\n anchor.style.outline = 'none';\n }\n window.scrollTo(0, endLocation);\n\n };\n\n /**\n * Emit a custom event\n * @param {String} type The event type\n * @param {Object} options The settings object\n * @param {Node} anchor The anchor element\n * @param {Node} toggle The toggle element\n */\n var emitEvent = function (type, options, anchor, toggle) {\n if (!options.emitEvents || typeof window.CustomEvent !== 'function') return;\n var event = new CustomEvent(type, {\n bubbles: true,\n detail: {\n anchor: anchor,\n toggle: toggle\n }\n });\n document.dispatchEvent(event);\n };\n\n\n //\n // SmoothScroll Constructor\n //\n\n var SmoothScroll = function (selector, options) {\n\n //\n // Variables\n //\n\n var smoothScroll = {}; // Object for public APIs\n var settings, anchor, toggle, fixedHeader, eventTimeout, animationInterval;\n\n\n //\n // Methods\n //\n\n /**\n * Cancel a scroll-in-progress\n */\n smoothScroll.cancelScroll = function (noEvent) {\n cancelAnimationFrame(animationInterval);\n animationInterval = null;\n if (noEvent) return;\n emitEvent('scrollCancel', settings);\n };\n\n /**\n * Start/stop the scrolling animation\n * @param {Node|Number} anchor The element or position to scroll to\n * @param {Element} toggle The element that toggled the scroll event\n * @param {Object} options\n */\n smoothScroll.animateScroll = function (anchor, toggle, options) {\n\n // Cancel any in progress scrolls\n smoothScroll.cancelScroll();\n\n // Local settings\n var _settings = extend(settings || defaults, options || {}); // Merge user options with defaults\n\n // Selectors and variables\n var isNum = Object.prototype.toString.call(anchor) === '[object Number]' ? true : false;\n var anchorElem = isNum || !anchor.tagName ? null : anchor;\n if (!isNum && !anchorElem) return;\n var startLocation = window.pageYOffset; // Current location on the page\n if (_settings.header && !fixedHeader) {\n // Get the fixed header if not already set\n fixedHeader = document.querySelector(_settings.header);\n }\n var headerHeight = getHeaderHeight(fixedHeader);\n var endLocation = isNum ? anchor : getEndLocation(anchorElem, headerHeight, parseInt((typeof _settings.offset === 'function' ? _settings.offset(anchor, toggle) : _settings.offset), 10), _settings.clip); // Location to scroll to\n var distance = endLocation - startLocation; // distance to travel\n var documentHeight = getDocumentHeight();\n var timeLapsed = 0;\n var speed = getSpeed(distance, _settings);\n var start, percentage, position;\n\n /**\n * Stop the scroll animation when it reaches its target (or the bottom/top of page)\n * @param {Number} position Current position on the page\n * @param {Number} endLocation Scroll to location\n * @param {Number} animationInterval How much to scroll on this loop\n */\n var stopAnimateScroll = function (position, endLocation) {\n\n // Get the current location\n var currentLocation = window.pageYOffset;\n\n // Check if the end location has been reached yet (or we've hit the end of the document)\n if (position == endLocation || currentLocation == endLocation || ((startLocation < endLocation && window.innerHeight + currentLocation) >= documentHeight)) {\n\n // Clear the animation timer\n smoothScroll.cancelScroll(true);\n\n // Bring the anchored element into focus\n adjustFocus(anchor, endLocation, isNum);\n\n // Emit a custom event\n emitEvent('scrollStop', _settings, anchor, toggle);\n\n // Reset start\n start = null;\n animationInterval = null;\n\n return true;\n\n }\n };\n\n /**\n * Loop scrolling animation\n */\n var loopAnimateScroll = function (timestamp) {\n if (!start) {\n start = timestamp;\n }\n timeLapsed += timestamp - start;\n percentage = speed === 0 ? 0 : (timeLapsed / speed);\n percentage = (percentage > 1) ? 1 : percentage;\n position = startLocation + (distance * easingPattern(_settings, percentage));\n window.scrollTo(0, Math.floor(position));\n if (!stopAnimateScroll(position, endLocation)) {\n animationInterval = window.requestAnimationFrame(loopAnimateScroll);\n start = timestamp;\n }\n };\n\n /**\n * Reset position to fix weird iOS bug\n * @link https://github.com/cferdinandi/smooth-scroll/issues/45\n */\n if (window.pageYOffset === 0) {\n window.scrollTo(0, 0);\n }\n\n // Update the URL\n updateURL(anchor, isNum, _settings);\n\n // Emit a custom event\n emitEvent('scrollStart', _settings, anchor, toggle);\n\n // Start scrolling animation\n smoothScroll.cancelScroll(true);\n window.requestAnimationFrame(loopAnimateScroll);\n\n };\n\n /**\n * If smooth scroll element clicked, animate scroll\n */\n var clickHandler = function (event) {\n\n // Don't run if the user prefers reduced motion\n if (reduceMotion(settings)) return;\n\n // Don't run if right-click or command/control + click\n if (event.button !== 0 || event.metaKey || event.ctrlKey) return;\n\n // Check if event.target has closest() method\n // By @totegi - https://github.com/cferdinandi/smooth-scroll/pull/401/\n if (!('closest' in event.target)) return;\n\n // Check if a smooth scroll link was clicked\n toggle = event.target.closest(selector);\n if (!toggle || toggle.tagName.toLowerCase() !== 'a' || event.target.closest(settings.ignore)) return;\n\n // Only run if link is an anchor and points to the current page\n if (toggle.hostname !== window.location.hostname || toggle.pathname !== window.location.pathname || !/#/.test(toggle.href)) return;\n\n // Get an escaped version of the hash\n var hash = escapeCharacters(toggle.hash);\n\n // Get the anchored element\n var anchor = settings.topOnEmptyHash && hash === '#' ? document.documentElement : document.querySelector(hash);\n anchor = !anchor && hash === '#top' ? document.documentElement : anchor;\n\n // If anchored element exists, scroll to it\n if (!anchor) return;\n event.preventDefault();\n setHistory(settings);\n smoothScroll.animateScroll(anchor, toggle);\n\n };\n\n /**\n * Animate scroll on popstate events\n */\n var popstateHandler = function (event) {\n\n // Stop if history.state doesn't exist (ex. if clicking on a broken anchor link).\n // fixes `Cannot read property 'smoothScroll' of null` error getting thrown.\n if (history.state === null) return;\n\n // Only run if state is a popstate record for this instantiation\n if (!history.state.smoothScroll || history.state.smoothScroll !== JSON.stringify(settings)) return;\n\n // Only run if state includes an anchor\n\n // if (!history.state.anchor && history.state.anchor !== 0) return;\n\n // Get the anchor\n var anchor = history.state.anchor;\n if (anchor && anchor !== 0) {\n anchor = document.querySelector(escapeCharacters(history.state.anchor));\n if (!anchor) return;\n }\n\n // Animate scroll to anchor link\n smoothScroll.animateScroll(anchor, null, {\n updateURL: false\n });\n\n };\n\n /**\n * Destroy the current initialization.\n */\n smoothScroll.destroy = function () {\n\n // If plugin isn't already initialized, stop\n if (!settings) return;\n\n // Remove event listeners\n document.removeEventListener('click', clickHandler, false);\n window.removeEventListener('popstate', popstateHandler, false);\n\n // Cancel any scrolls-in-progress\n smoothScroll.cancelScroll();\n\n // Reset variables\n settings = null;\n anchor = null;\n toggle = null;\n fixedHeader = null;\n eventTimeout = null;\n animationInterval = null;\n\n };\n\n /**\n * Initialize Smooth Scroll\n * @param {Object} options User settings\n */\n smoothScroll.init = function (options) {\n\n // feature test\n if (!supports()) throw 'Smooth Scroll: This browser does not support the required JavaScript methods and browser APIs.';\n\n // Destroy any existing initializations\n smoothScroll.destroy();\n\n // Selectors and variables\n settings = extend(defaults, options || {}); // Merge user options with defaults\n fixedHeader = settings.header ? document.querySelector(settings.header) : null; // Get the fixed header\n\n // When a toggle is clicked, run the click handler\n document.addEventListener('click', clickHandler, false);\n\n // If updateURL and popState are enabled, listen for pop events\n if (settings.updateURL && settings.popstate) {\n window.addEventListener('popstate', popstateHandler, false);\n }\n\n };\n\n\n //\n // Initialize plugin\n //\n\n smoothScroll.init(options);\n\n\n //\n // Public APIs\n //\n\n return smoothScroll;\n\n };\n\n return SmoothScroll;\n\n}));\n"],"sourceRoot":"assets/scripts/"}