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.2 */\n\nimport { throttle } from 'Util/throttle';\nimport { debounce } from 'Util/debounce';\n\nconst passiveSupported = (() => {\n\tlet passiveSupported = false;\n\ttry {\n\t\t// https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#safely_detecting_option_support\n\t\tvar options = {};\n\n\t\t// The getter is called when the browser tries to access the 'passive' property\n\t\tObject.defineProperty(options, 'passive', {\n\t\t\tget: function () {\n\t\t\t\tpassiveSupported = true;\n\t\t\t\treturn false;\n\t\t\t}\n\t\t});\n\n\t\twindow.addEventListener('test', null, options);\n\t\twindow.removeEventListener('test', null, options);\n\t} catch (error) {\n\t\tpassiveSupported = false;\n\t}\n\n\treturn passiveSupported;\n})();\n\nconst selectors = Object.freeze({\n\tcontainer: '.js-scroll-appear__container',\n\tappear: '.js-scroll-appear:not([data-scroll-appear=\"true\"])'\n});\n\nconst dataAttributes = Object.freeze({\n\tqueueId: 'data-scroll-appear-queue',\n\n\tappear: 'data-scroll-appear',\n\tappearDelay: 'data-scroll-appear-delay',\n\n\tthreshold: 'data-scroll-appear-threshold'\n});\n\nconst delay = 100; // ms\nconst threshold = 100; // px\n\nconst Queues = Object.freeze({\n\t// Global queue for objects not in a container\n\tGLOBAL: 'global'\n});\n\n/*\n[\n\t{\n\t\tid: string,\n\t\tqueue: [\n\t\t\t{\n\t\t\t\t$element: Element,\n\t\t\t\tdelay: int?\n\t\t\t}\n\t\t],\n\t\ttimeout: int?\n\t}\n]\n*/\nconst queues = [];\n\nconst module = {\n\tinit: function () {\n\t\tmodule._addQueue(Queues.GLOBAL);\n\n\t\tmodule._initEvents();\n\n\t\t// Try to appear all elements at the start\n\t\tmodule._appearElementsInViewport();\n\t},\n\n\t_initEvents: function () {\n\t\tconst passiveOptions = passiveSupported ? { passive: true } : false;\n\n\t\tconst throttledAppear = throttle(module._appearElementsInViewportEvent, delay);\n\t\tconst debouncedAppear = debounce(module._appearElementsInViewportEvent, delay);\n\n\t\twindow.addEventListener('scroll', throttledAppear, passiveOptions);\n\t\twindow.addEventListener('scroll', debouncedAppear, passiveOptions);\n\n\t\twindow.addEventListener('resize', throttledAppear, passiveOptions);\n\t\twindow.addEventListener('resize', debouncedAppear, passiveOptions);\n\n\t\tdocument.addEventListener('focus', module._onFocus, { capture: true });\n\t},\n\n\t_appearElementsInViewportEvent: function (e) {\n\t\tconst $elements = document.querySelectorAll(selectors.appear);\n\n\t\tif ($elements) {\n\t\t\tmodule._appearElementsInViewport($elements);\n\t\t}\n\t},\n\n\t_appearElementsInViewport: function ($elements) {\n\t\t// Check all eligible elements by default\n\t\tif (!$elements) {\n\t\t\t$elements = document.querySelectorAll(selectors.appear);\n\t\t\tif (!$elements) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tfor (const $element of $elements) {\n\t\t\tmodule._appearElementInViewport($element);\n\t\t}\n\t},\n\n\t_appearElementInViewport: function ($element) {\n\t\tconst isQueued = module._isQueued($element);\n\t\tif (isQueued) {\n\t\t\t// $element is queued to appear, so don't check it again\n\t\t\treturn;\n\t\t}\n\n\t\tconst elThreshold = module._getElementThreshold($element);\n\t\tconst isInViewport = module._isInViewport($element, elThreshold);\n\t\tif (isInViewport) {\n\t\t\tmodule._addToQueue($element);\n\t\t}\n\t},\n\n\t_onFocus: function (e) {\n\t\tconst $focus = document.activeElement;\n\t\tconst $appear = $focus.closest(selectors.appear);\n\n\t\tif ($appear) {\n\t\t\tmodule._addToQueue($appear, true);\n\t\t}\n\t},\n\n\t_isQueued: function ($element) {\n\t\t// Check all queues to see if $element is queued to appear\n\t\tlet isQueued = false;\n\n\t\tfor (const queue of queues) {\n\t\t\tfor (const item of queue.items) {\n\t\t\t\tif (item.$element === $element) {\n\t\t\t\t\tisQueued = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (isQueued) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn isQueued;\n\t},\n\n\t_getQueueById: function (id) {\n\t\t// Find a matching queue if one exists\n\n\t\tlet queue = queues.filter(function (queue) {\n\t\t\treturn queue.id === id;\n\t\t});\n\n\t\tif (queue.length) {\n\t\t\tqueue = queue[0];\n\t\t} else {\n\t\t\tqueue = null;\n\t\t}\n\n\t\treturn queue;\n\t},\n\n\t_getQueueByElement: function ($element) {\n\t\t// If $element is in a container, get its queue if\n\t\t// it exists, otherwise create a new one and add it.\n\t\t// If $element is not in a container, get the global queue\n\n\t\tlet queue;\n\n\t\tconst $container = $element.closest(selectors.container);\n\t\tif ($container) {\n\t\t\t// If the item is in a container, use the container's queue\n\t\t\tlet queueId = $container.getAttribute(dataAttributes.queueId);\n\n\t\t\tif (queueId) {\n\t\t\t\t// If the container already has an ID, get its queue\n\t\t\t\tqueue = module._getQueueById(queueId);\n\n\t\t\t\tif (!queue) {\n\t\t\t\t\t// If the container's queue doesn't exist yet, create it\n\t\t\t\t\tqueue = module._addQueue(queueId);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// If the container has no ID, create a new queue with a new unique ID\n\t\t\t\tqueueId = module._generateUniqueQueueId();\n\t\t\t\tqueue = module._addQueue(queueId);\n\t\t\t\t$container.setAttribute(dataAttributes.queueId, queueId);\n\t\t\t}\n\t\t} else {\n\t\t\t// If the item is not in a container, use the global queue\n\t\t\tqueue = module._getQueueById(Queues.GLOBAL);\n\t\t}\n\n\t\treturn queue;\n\t},\n\n\t_addQueue: function (id) {\n\t\tconst queue = {\n\t\t\tid: id,\n\t\t\titems: [],\n\t\t\ttimeout: null\n\t\t};\n\n\t\tqueues.push(queue);\n\n\t\treturn queue;\n\t},\n\n\t_getElementThreshold: function ($element) {\n\t\tconst elThreshold = parseInt($element.getAttribute(dataAttributes.threshold), 10) || threshold;\n\n\t\treturn elThreshold;\n\t},\n\n\t_generateUniqueQueueId: function () {\n\t\tlet id = Math.random().toString();\n\t\t// Remove '0.' from start, and limit to 5 characters\n\t\tid = id.substr(2, 5);\n\n\t\tconst matchingId = queues.filter(function (queue) {\n\t\t\treturn queue.id === id;\n\t\t});\n\t\tif (matchingId.length) {\n\t\t\t// Regenerate until unique\n\t\t\tid = module._generateUniqueQueueId.apply(this, arguments);\n\t\t}\n\n\t\treturn id;\n\t},\n\n\t_addToQueue: function ($element, immediate) {\n\t\tconst queue = module._getQueueByElement($element);\n\t\tconst itemInQueue = queue.items.find((item) => item.$element === $element);\n\n\t\tif (itemInQueue) {\n\t\t\t// This element is already in the queue\n\t\t\tif (immediate) {\n\t\t\t\t// Remove it from the queue, it will be added back to the front\n\t\t\t\tconst itemInQueueIndex = queue.items.indexOf(itemInQueue);\n\t\t\t\tqueue.items.splice(itemInQueueIndex, 1);\n\t\t\t} else {\n\t\t\t\t// Leave it where it is\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tconst delayAttr = parseInt($element.getAttribute(dataAttributes.appearDelay), 10);\n\t\tconst elementDelay = isNaN(delayAttr) ? delay : delayAttr;\n\n\t\tconst queueItem = {\n\t\t\t$element: $element,\n\t\t\tdelay: elementDelay\n\t\t};\n\n\t\tif (immediate) {\n\t\t\t// If an item is waiting currently, cancel its timeout and inherit\n\t\t\t// the prior item's delay if it's longer than the current item's delay\n\t\t\tif (queue.timeout) {\n\t\t\t\twindow.clearTimeout(queue.timeout);\n\t\t\t\tqueue.timeout = null;\n\n\t\t\t\tif (queue.items.length && queue.items[0].priorDelay) {\n\t\t\t\t\tconst delay = parseInt($element.getAttribute(dataAttributes.appearDelay), 10);\n\n\t\t\t\t\tqueueItem.delay = Math.max(queueItem.delay, queue.items[0].priorDelay);\n\t\t\t\t} else {\n\t\t\t\t\t// This item was the only item in the queue, so leave its delay alone\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Add this item to the front of the queue\n\t\t\tqueue.items.unshift(queueItem);\n\t\t} else {\n\t\t\t// Add this item to the end of the queue\n\t\t\tqueue.items.push(queueItem);\n\t\t}\n\n\t\tif (queue.timeout === null) {\n\t\t\t// Use a small asynchronous delay so items entering the viewport\n\t\t\t// simultaneously will see one another sitting in the queue\n\t\t\tqueue.timeout = window.setTimeout(function () {\n\t\t\t\tmodule._popQueue(queue.id);\n\t\t\t}, 10);\n\t\t}\n\t},\n\n\t_popQueue: function (id) {\n\t\tconst queue = module._getQueueById(id);\n\t\tif (!queue) {\n\t\t\tqueue = module._getQueueById('global');\n\t\t}\n\n\t\tif (!queue.items.length) {\n\t\t\t// console.error('Cannot pop queue with no items', id);\n\t\t\treturn;\n\t\t}\n\n\t\t// Look at the first item in the queue\n\t\tconst queueItem = queue.items.shift();\n\t\tqueueItem.$element.setAttribute(dataAttributes.appear, true);\n\n\t\tif (queue.items.length) {\n\t\t\tconst nextItem = queue.items[0];\n\t\t\tconst elThreshold = module._getElementThreshold(nextItem.$element);\n\n\t\t\tif (module._isInViewport(nextItem.$element, elThreshold)) {\n\t\t\t\t// If the next item in the queue is still in the\n\t\t\t\t// viewport, prepare to show it after its delay\n\t\t\t\tqueue.timeout = window.setTimeout(function () {\n\t\t\t\t\tmodule._popQueue(queue.id);\n\t\t\t\t}, queueItem.delay);\n\n\t\t\t\t// Record the prior delay\n\t\t\t\tqueue.items[0].priorDelay = queueItem.delay;\n\t\t\t} else {\n\t\t\t\t// If the next item in the queue is no longer in\n\t\t\t\t// the viewport, show it immediately\n\t\t\t\tmodule._popQueue(queue.id);\n\t\t\t}\n\t\t} else {\n\t\t\t// No more items to show\n\t\t\tqueue.timeout = null;\n\t\t}\n\t},\n\n\t_isInViewport: function ($element, threshold) {\n\t\t// Pretend the viewport is smaller on each edge by threshold px\n\t\tthreshold = threshold || 0;\n\n\t\tconst windowHeight = window.innerHeight;\n\t\tconst maxThreshold = (windowHeight / 2) - 50;\n\t\tif (threshold > maxThreshold) {\n\t\t\tthreshold = maxThreshold;\n\t\t}\n\n\t\tconst coords = $element.getBoundingClientRect();\n\n\t\tconst viewportHeight = window.innerHeight || document.documentElement.clientWidth;\n\n\t\t// If an element is partially in the viewport:\n\t\t// Top of page above bottom of element\n\t\tconst bottom = coords.bottom >= threshold;\n\n\t\t// Bottom of page below top of element\n\t\tconst top = coords.top <= viewportHeight - threshold;\n\n\t\tconst isInViewport = bottom && top;\n\n\t\treturn isInViewport;\n\t}\n};\n\nexport { module as scrollAppear };\n"],"names":["passiveSupported","options","Object","defineProperty","get","window","addEventListener","removeEventListener","error","selectors","freeze","container","appear","dataAttributes","queueId","appearDelay","threshold","Queues","GLOBAL","queues","module","init","_addQueue","_initEvents","_appearElementsInViewport","passiveOptions","passive","throttledAppear","throttle","_appearElementsInViewportEvent","debouncedAppear","debounce","document","_onFocus","capture","e","$elements","querySelectorAll","_step","_iterator","_createForOfIteratorHelper","s","n","done","$element","value","_appearElementInViewport","err","f","_isQueued","elThreshold","_getElementThreshold","_isInViewport","_addToQueue","$appear","activeElement","closest","isQueued","_i","_queues","length","_step2","_iterator2","items","_getQueueById","id","queue","filter","_getQueueByElement","$container","getAttribute","_generateUniqueQueueId","setAttribute","timeout","push","parseInt","Math","random","toString","substr","apply","this","arguments","immediate","itemInQueue","find","item","itemInQueueIndex","indexOf","splice","delayAttr","elementDelay","isNaN","queueItem","delay","clearTimeout","priorDelay","max","unshift","setTimeout","_popQueue","_readOnlyError","shift","nextItem","maxThreshold","innerHeight","coords","getBoundingClientRect","viewportHeight","documentElement","clientWidth","bottom","top"],"sourceRoot":""}