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KAAKqF,MAAMrB,OAASmF,EACpBnJ,KAAKqF,MAAMI,MAAQgB,KAAKC,KAAKyC,EAAYnJ,KAAKgG,oBAC9ChG,KAAKqF,MAAMtB,IAAM,EACjB/D,KAAKqF,MAAMG,OAAS0D,EAAWlJ,KAAKqF,MAAMI,OAAS,GAAG2D,QAAQ,IAElEpJ,KAAKqF,MAAMb,GAAG6E,MAAS,QAAOrJ,KAAKqF,MAAMtB,gBAAgB/D,KAAKqF,MAAMG,kBAAkBxF,KAAKqF,MAAMI,oBAAoBzF,KAAKqF,MAAMrB,WACpI,EAKG,SAASsF,EAAWC,GACvBA,EAASC,SAASC,IAEQ,IAAlBA,EAAKlH,UACL,IAAIgC,EAAekF,EACvB,GAER,C","sources":["webpack://heligan.web/./node_modules/debounce/index.js","webpack://heligan.web/../src/throttle.js","webpack://heligan.web/../src/index.js","webpack://heligan.web/./wwwroot/app/src/js/hero-video-vimeo.js"],"sourcesContent":["/**\n * Returns a function, that, as long as it continues to be invoked, will not\n * be triggered. The function will be called after it stops being called for\n * N milliseconds. If `immediate` is passed, trigger the function on the\n * leading edge, instead of the trailing. The function also has a property 'clear' \n * that is a function which will clear the timer to prevent previously scheduled executions. \n *\n * @source underscore.js\n * @see http://unscriptable.com/2009/03/20/debouncing-javascript-methods/\n * @param {Function} function to wrap\n * @param {Number} timeout in ms (`100`)\n * @param {Boolean} whether to execute at the beginning (`false`)\n * @api public\n */\nfunction debounce(func, wait, immediate){\n var timeout, args, context, timestamp, result;\n if (null == wait) wait = 100;\n\n function later() {\n var last = Date.now() - timestamp;\n\n if (last < wait && last >= 0) {\n timeout = setTimeout(later, wait - last);\n } else {\n timeout = null;\n if (!immediate) {\n result = func.apply(context, args);\n context = args = null;\n }\n }\n };\n\n var debounced = function(){\n context = this;\n args = arguments;\n timestamp = Date.now();\n var callNow = immediate && !timeout;\n if (!timeout) timeout = setTimeout(later, wait);\n if (callNow) {\n result = func.apply(context, args);\n context = args = null;\n }\n\n return result;\n };\n\n debounced.clear = function() {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n }\n };\n \n debounced.flush = function() {\n if (timeout) {\n result = func.apply(context, args);\n context = args = null;\n \n clearTimeout(timeout);\n timeout = null;\n }\n };\n\n return debounced;\n};\n\n// Adds compatibility for ES modules\ndebounce.debounce = debounce;\n\nmodule.exports = debounce;\n","const DEFAULT_THROTTLE_INTERVAL = 100\n\n/**\n * Throttles method execution to prevent some performance bottlenecks\n * @param {Function} fn method to throttle\n * @param {Number} interval milliseconds for the method to be delayed\n */\nfunction throttle(fn, interval = DEFAULT_THROTTLE_INTERVAL) {\n let inThrottle\n let lastFunc\n let lastRan\n\n return function() {\n if (inThrottle === true) {\n clearTimeout(lastFunc)\n lastFunc = setTimeout(function() {\n if (Date.now() - lastRan >= interval) {\n fn.apply(this, arguments)\n lastRan = Date.now()\n }\n }, interval - (Date.now() - lastRan))\n } else {\n fn.apply(this, arguments)\n lastRan = Date.now()\n inThrottle = true\n }\n }\n}\n\nexport default throttle\n","import noop from './noop'\nimport throttle from './throttle'\n\n/**\n * Constructor for element that should be hunted\n * @constructor Hunted\n * @param {Node} element\n * @param {Object} config\n */\nclass Hunted {\n constructor(element, config) {\n this.element = element\n\n // instantiate element as not visible\n this.visible = false\n\n // extend properties from config or fallback to prototype values\n for (var prop in config) {\n if (Object.hasOwnProperty.call(config, prop)) {\n this[prop] = config[prop]\n }\n }\n\n // replace options with dataset if present\n if (typeof element.dataset !== 'undefined') {\n if (typeof element.dataset.huntPersist !== 'undefined') {\n try {\n this.persist = JSON.parse(element.dataset.huntPersist)\n } catch (e) {}\n }\n if (typeof element.dataset.huntOffset !== 'undefined') {\n try {\n this.offset = JSON.parse(element.dataset.huntOffset)\n } catch (e) {}\n }\n }\n }\n}\n\n// protoype values\nHunted.prototype.offset = 0\nHunted.prototype.persist = false\nHunted.prototype.enter = noop\nHunted.prototype.leave = noop\n\n/**\n * Creates and initializes observer\n * @constructor Hunt\n * @param {Node|NodeList|Array} target\n * @param {Object} options\n */\nclass Hunt {\n constructor(target, options) {\n // sanity check for first argument\n const isValidTarget =\n (target && target.nodeType === 1) || typeof target.length === 'number'\n if (!isValidTarget) {\n throw new TypeError(\n 'hunt: observer first argument should be a node or a list of nodes'\n )\n }\n // sanity check for second argument\n if (typeof options !== 'object') {\n throw new TypeError('hunt: observer second argument should be an object')\n }\n\n // turn target to array\n if (target.nodeType === 1) {\n this.__huntedElements__ = [new Hunted(target, options)]\n } else {\n const targetArray = [].slice.call(target)\n this.__huntedElements__ = targetArray.map((t) => new Hunted(t, options))\n }\n\n // hoist viewport metrics\n this.__viewportHeight__ = window.innerHeight\n\n // connect observer and pass in throttle interval\n this.__connect__(options.throttleInterval)\n }\n\n /**\n * Assign throttled actions and add listeners\n * @param {Number} throttleInterval\n * @method __connect__\n * @memberof Hunt\n */\n __connect__(throttleInterval) {\n // throttle actions\n this.__throttledHuntElements__ = throttle(\n this.__huntElements__.bind(this),\n throttleInterval\n )\n this.__throttledUpdateMetrics__ = throttle(\n this.__updateMetrics__.bind(this),\n throttleInterval\n )\n\n // add listeners\n window.addEventListener('scroll', this.__throttledHuntElements__)\n window.addEventListener('resize', this.__throttledUpdateMetrics__)\n\n // run first check\n this.__huntElements__()\n }\n\n /**\n * Checks if hunted elements are visible and apply callbacks\n * @method __huntElements__\n * @memberof Hunt\n */\n __huntElements__() {\n let position = this.__huntedElements__.length\n\n while (position) {\n --position\n const hunted = this.__huntedElements__[position]\n const rect = hunted.element.getBoundingClientRect()\n const isOnViewport =\n rect.top - hunted.offset < this.__viewportHeight__ &&\n rect.top >= -(rect.height + hunted.offset)\n\n /*\n * trigger (enter) event if element comes from a non visible state and the scrolled\n * viewport has reached the visible range of the element without exceeding it\n */\n if (hunted.visible === false && isOnViewport === true) {\n hunted.enter.call(null, hunted.element)\n hunted.visible = true\n // when the leave callback method is not set and hunting should not persist remove element\n if (hunted.leave === noop && hunted.persist !== true) {\n this.__huntedElements__.splice(position, 1)\n\n // end observer activity when there are no more elements\n if (this.__huntedElements__.length === 0) {\n this.disconnect()\n }\n }\n }\n\n /*\n * trigger (leave) event if element comes from a visible state\n * and it's out of the visible range its bottom or top limit\n */\n if (hunted.visible === true && isOnViewport === false) {\n hunted.leave.call(null, hunted.element)\n hunted.visible = false\n // when hunting should not persist remove element\n if (hunted.persist !== true) {\n this.__huntedElements__.splice(position, 1)\n\n // end observer activity when there are no more elements\n if (this.__huntedElements__.length === 0) {\n this.disconnect()\n }\n }\n }\n }\n }\n\n /**\n * Update viewport tracked height and runs a check\n * @method __updateMetrics__\n * @memberof Hunt\n */\n __updateMetrics__() {\n this.__viewportHeight__ = window.innerHeight\n this.__huntElements__()\n }\n\n /**\n * Remove listeners and stops observing elements\n * @method disconnect\n * @memberof Hunt\n */\n disconnect() {\n // remove listeners\n window.removeEventListener('scroll', this.__throttledHuntElements__)\n window.removeEventListener('resize', this.__throttledUpdateMetrics__)\n }\n\n /**\n * __huntElements__ public alias\n * @method trigger\n * @memberof Hunt\n */\n trigger() {\n this.__huntElements__()\n }\n}\n\nexport default Hunt\n","import { debounce } from 'debounce';\r\nimport hunt from 'huntjs';\r\nimport { ResizeObserver as Polyfill } from '@juggle/resize-observer';\r\nconst ResizeObserver = window.ResizeObserver || Polyfill;\r\n\r\nconst defaultPosterVideoInitDelay = 5000; // the delay, once the poster image has loaded, before we load the video iframe\r\n\r\nclass HeroVideoVimeo {\r\n\r\n constructor(el) {\r\n this.wrapper = el;\r\n this.controls = this.wrapper.querySelector('.hero--video--control');\r\n this.loadingSprite = this.wrapper.querySelector('.hero--video-loading-sprite');\r\n this.playButton = this.controls.querySelector('button.play');\r\n this.soundButton = this.controls.querySelector('button.sound');\r\n this.started = false;\r\n this.userPaused = false;\r\n this.muted = true;\r\n this.hasPoster = false;\r\n this.crossfadePoster = false;\r\n this.videoInitDelay = defaultPosterVideoInitDelay;\r\n this.inner = {\r\n poster : this.wrapper.querySelector('.hero--poster-image'),\r\n posterImg : this.wrapper.querySelector('.hero--poster-image img'),\r\n el : this.wrapper.querySelector('.hero--video-inner:first-child'),\r\n top : 0,\r\n left : 0,\r\n width : 0,\r\n height : 0\r\n }\r\n // are we dealing with a poster image?\r\n if(this.inner.posterImg != null) {\r\n this.hasPoster = true;\r\n this.inner.el.classList.add('has-poster');\r\n // crossfade?\r\n this.crossfadePoster = this.inner.poster.dataset.crossfade == 'true';\r\n if(this.crossfadePoster) this.inner.el.classList.add('crossfade-poster');\r\n // custom init delay value?\r\n let delay = parseInt(this.inner.poster.dataset.delay);\r\n if(delay > 0) this.videoInitDelay = delay;\r\n }\r\n this.ratioHeightByWidth = 9 / 16;\r\n this.ratioWidthByHeight = 16 / 9;\r\n // find video id in data attribute\r\n this.videoId = this.wrapper.dataset.heroVideoId;\r\n // add resize observer to hero element\r\n this.ro = new ResizeObserver(entries => {\r\n for (let entry of entries) {\r\n const cr = entry.contentRect;\r\n debounce(this.resize(Math.ceil(cr.width), Math.ceil(cr.height)), 200);\r\n }\r\n });\r\n this.ro.observe(this.wrapper);\r\n // init video based on poster image\r\n if(this.videoId != null) {\r\n if(this.hasPoster) {\r\n if (this.inner.posterImg.complete) {\r\n setTimeout(() => {\r\n this.loadPlayer();\r\n }, this.videoInitDelay);\r\n } else {\r\n let _this = this;\r\n this.inner.posterImg.addEventListener('load', () => {\r\n setTimeout(() => {\r\n _this.loadPlayer();\r\n }, _this.videoInitDelay);\r\n }, {once: true});\r\n }\r\n } else {\r\n this.loadPlayer();\r\n }\r\n }\r\n }\r\n\r\n async loadPlayer() {\r\n let script = document.createElement('script');\r\n script.type = 'text/javascript';\r\n script.src = 'https://player.vimeo.com/api/player.js';\r\n script.defer = true;\r\n script.async = true;\r\n document.head.appendChild(script);\r\n script.onload = () => {\r\n this.initVideo();\r\n };\r\n }\r\n\r\n initVideo() {\r\n // add video\r\n this.video = new Vimeo.Player(this.inner.el, {\r\n id: this.videoId,\r\n loop: true,\r\n background: true\r\n });\r\n let thisInstance = this;\r\n // hook up control button?\r\n if(this.playButton !== null) {\r\n this.playButton_play = this.playButton.querySelector('.hero--video--control--play');\r\n this.playButton_pause = this.playButton.querySelector('.hero--video--control--pause');\r\n this.playButton_pause.removeAttribute('hidden');\r\n // add behaviours\r\n this.video.on('play', ()=> {\r\n this.playButton_play.setAttribute('aria-hidden', true);\r\n this.playButton_pause.setAttribute('aria-hidden', false);\r\n // fade video in when it starts playback for the first time\r\n if(!this.started) {\r\n this.inner.el.classList.add('reveal');\r\n this.controls.classList.add('reveal');\r\n if(this.loadingSprite != null) this.loadingSprite.classList.add('hidden');\r\n this.started = true;\r\n }\r\n });\r\n this.video.on('pause', ()=> {\r\n this.playButton_play.setAttribute('aria-hidden', false);\r\n this.playButton_pause.setAttribute('aria-hidden', true);\r\n });\r\n this.playButton.onclick = () => {\r\n thisInstance.video.getPaused().then(function(paused) {\r\n if(!paused) {\r\n thisInstance.video.pause();\r\n thisInstance.userPaused = true;\r\n } else {\r\n thisInstance.video.play();\r\n thisInstance.userPaused = false;\r\n }\r\n });\r\n };\r\n }\r\n // hook up optional sound control button?\r\n if(this.soundButton !== null) {\r\n this.soundButton_on = this.soundButton.querySelector('.hero--video--control--sound-on');\r\n this.soundButton_off = this.soundButton.querySelector('.hero--video--control--sound-off');\r\n this.soundButton_off.removeAttribute('hidden');\r\n this.soundButton.onclick = () => {\r\n if(thisInstance.muted) {\r\n thisInstance.video.setMuted(false).then(() => {\r\n thisInstance.soundButton_on.setAttribute('aria-hidden', true);\r\n thisInstance.soundButton_off.setAttribute('aria-hidden', false);\r\n thisInstance.muted = false;\r\n });\r\n } else {\r\n thisInstance.video.setMuted(true).then(() => {\r\n thisInstance.soundButton_on.setAttribute('aria-hidden', false);\r\n thisInstance.soundButton_off.setAttribute('aria-hidden', true);\r\n thisInstance.muted = true;\r\n });\r\n }\r\n }\r\n }\r\n // add hunt to pause video if scrolled offscreen\r\n let fixedWrapper = document.querySelector('.hero--fixed-visual--wrapper');\r\n this.hunt = new hunt(fixedWrapper != null ? fixedWrapper : this.wrapper, {\r\n leave: function () {\r\n thisInstance.video.getPaused().then(function(paused) {\r\n if(!paused) thisInstance.video.pause();\r\n });\r\n },\r\n enter: function () {\r\n thisInstance.video.getPaused().then(function(paused) {\r\n if(paused && !thisInstance.userPaused) thisInstance.video.play();\r\n });\r\n },\r\n persist: true\r\n });\r\n }\r\n\r\n resize(getWidth, getHeight) {\r\n let ratio = getHeight/getWidth;\r\n if(ratio < this.ratioHeightByWidth) {\r\n // use full width\r\n this.inner.width = getWidth;\r\n this.inner.height = Math.ceil(getWidth * this.ratioHeightByWidth);\r\n this.inner.top = ((getHeight - this.inner.height) / 2).toFixed(1);\r\n this.inner.left = 0;\r\n } else {\r\n // use full height\r\n this.inner.height = getHeight;\r\n this.inner.width = Math.ceil(getHeight * this.ratioWidthByHeight);\r\n this.inner.top = 0;\r\n this.inner.left = ((getWidth - this.inner.width) / 2).toFixed(1);\r\n }\r\n this.inner.el.style = `top: ${this.inner.top}px; left: ${this.inner.left}px; width: ${this.inner.width}px; height: ${this.inner.height}px;`;\r\n }\r\n\r\n}\r\n\r\n// export the default function to create\r\nexport function createFrom(wrappers) {\r\n wrappers.forEach((node) => {\r\n // if node is an element\r\n if (node.nodeType === 1) {\r\n new HeroVideoVimeo(node);\r\n }\r\n });\r\n}"],"names":["debounce","func","wait","immediate","timeout","args","context","timestamp","result","later","last","Date","now","setTimeout","apply","debounced","this","arguments","callNow","clear","clearTimeout","flush","module","exports","DEFAULT_THROTTLE_INTERVAL","throttle","fn","interval","inThrottle","lastFunc","lastRan","Hunted","constructor","element","config","prop","visible","Object","hasOwnProperty","call","dataset","huntPersist","persist","JSON","parse","e","huntOffset","offset","prototype","enter","noop","leave","Hunt","target","options","nodeType","length","TypeError","__huntedElements__","targetArray","slice","map","t","__viewportHeight__","window","innerHeight","__connect__","throttleInterval","__throttledHuntElements__","__huntElements__","bind","__throttledUpdateMetrics__","__updateMetrics__","addEventListener","position","hunted","rect","getBoundingClientRect","isOnViewport","top","height","splice","disconnect","removeEventListener","trigger","ResizeObserver","Polyfill","HeroVideoVimeo","el","wrapper","controls","querySelector","loadingSprite","playButton","soundButton","started","userPaused","muted","hasPoster","crossfadePoster","videoInitDelay","inner","poster","posterImg","left","width","classList","add","crossfade","delay","parseInt","ratioHeightByWidth","ratioWidthByHeight","videoId","heroVideoId","ro","entries","entry","cr","contentRect","resize","Math","ceil","observe","complete","loadPlayer","_this","once","async","script","document","createElement","type","src","defer","head","appendChild","onload","initVideo","video","Vimeo","Player","id","loop","background","thisInstance","playButton_play","playButton_pause","removeAttribute","on","setAttribute","onclick","getPaused","then","paused","play","pause","soundButton_on","soundButton_off","setMuted","fixedWrapper","hunt","getWidth","getHeight","toFixed","style","createFrom","wrappers","forEach","node"],"sourceRoot":""}