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O,CACtDuF,QAASM,EAAK/D,YAGZ+D,EAAK9D,aACP8D,EAAK9D,WAAW2C,aACdpF,EAAYgF,WAAW5E,oBACvB,GAGFmG,EAAK9D,WAAW2C,aACd,aACAmB,EAAKvF,QAAQ+D,aAAa/E,EAAYgF,WAAW3E,qBAIzD,CAAC,EAnBO,GA0BR0C,WAAcM,IACZ,MAAM,QAAE4C,GAAY5C,EAEhB4C,IAAYhF,KAAKuB,WACnBvB,KAAK0E,KAAK,CAAEG,WAAW,GACzB,EAQF9C,YAAeK,IACb,MAAM,QAAE4C,GAAY5C,EAEhB4C,IAAYhF,KAAKuB,WACnBvB,KAAK2E,MAAM,CAAEY,YAAY,GAC3B,EAMF5D,eAAiBA,KACf3B,KAAKQ,oBAAoBuE,KAAKhG,EAAY8C,OAAOnC,KAAM,CACrDsF,QAAShF,KAAKuB,YAEhBvB,KAAKc,iBACLd,KAAKgB,QAAQwE,MAAM,E,8ECjXR,SAAS5G,IAAuB,QAAA6G,EAAAjH,UAAAC,OAATiH,EAAO,IAAAC,MAAAF,GAAAG,EAAA,EAAAA,EAAAH,EAAAG,IAAPF,EAAOE,GAAApH,UAAAoH,GAC3C,OAAOF,EAAQG,OAAOC,SAASjH,KAAK,KACtC,C,iCCHO,SAASmF,EAAa+B,GAC3B,MAAMC,EAAKC,SAASC,cAAc,OAIlC,OAHAF,EAAGG,UAAYJ,EAAeK,OAG1BJ,EAAGK,WAAW5H,OAAS,EAClBuH,EAGFA,EAAGM,UACZ,CAOO,SAASC,EAAMxG,GACpB,KAAOA,EAAQuG,YACbvG,EAAQyG,YAAYzG,EAAQuG,WAEhC,CASO,SAASG,EAAOC,EAAMC,GAO3B,OALAJ,EAAMI,GAGNA,EAAUzC,YAAYwC,GAEfC,CACT,C","sources":["webpack://@hero-digital/masonite/./src/components/foundation/Icon/Icon.template.js","webpack://@hero-digital/masonite/./src/components/modules/PlayIcon/PlayIcon.template.js","webpack://@hero-digital/masonite/./src/components/modules/VideoPlayer/VideoPlayer.js","webpack://@hero-digital/masonite/./src/js/utilities/classnames.js","webpack://@hero-digital/masonite/./src/js/utilities/renderer.js"],"sourcesContent":["/**\n * @param {String} id component id\n * @param {Object} icon SVG icon to display\n * @param {String} addClassName Additional class name\n * @returns\n */\nconst IconTemplate = ({ id = '', icon, addClassName = '' }) =>\n icon\n ? `\n \n \n \n `\n : ''\n\nexport default IconTemplate\n","import Icon from 'foundation/Icon/Icon.template.js'\nimport classNames from 'utilities/classnames'\n\n/**\n * Play Icon Positions\n */\nexport const POSITIONS = {\n BOTTOM_LEFT: 'bottom-left',\n BOTTOM_RIGHT: 'bottom-right',\n CENTER: 'center',\n TOP_LEFT: 'top-left',\n TOP_RIGHT: 'top-right'\n}\n\n/**\n * Play Icon Sizes\n */\nexport const SIZES = {\n LARGE: 'large',\n SMALL: 'small'\n}\n\n/**\n * Render Video Play Icon template\n * @param {String} addClassName Additional class name to component\n * @param {Object} a11y Accessibility labels\n * @param {String} a11y.buttonLabel Accessibility label for button\n * @param {String} a11y.playLabel Accessibility label for play icon\n * @param {String} a11y.pauseLabel Accessibility label for pause icon\n * @param {Array} dataAttributes Data attributes to add to component\n * @param {String} id ID to add to component\n * @param {Boolean} isButton If true, component will render as a button\n * @param {Boolean} isInline If true, component will render inline vs the full contents of the parent\n * @param {String} position Position of play icon\n * @param {String} size Size of play icon (small or large)\n */\nconst PlayIcon = ({\n addClassName,\n a11y: { buttonLabel = '', playLabel = 'Play', pauseLabel = 'Pause' } = {},\n dataAttributes,\n id,\n isButton,\n isInline,\n position,\n size,\n isBlackAndWhite = false\n} = {}) => {\n const tag = isButton ? 'button' : 'div'\n\n return /* HTML */ `\n <${tag}\n class=\"${classNames(\n 'mod-play-icon',\n addClassName,\n isBlackAndWhite && `mod-play-icon--black-white`,\n isInline && `mod-play-icon--inline`,\n position && `mod-play-icon--position`,\n position && `mod-play-icon--position-${position}`,\n size && `mod-play-icon--size-${size}`\n )}\"\n ${id ? `id=\"${id}\"` : ''}\n ${buttonLabel ? `aria-label=\"${buttonLabel}\"` : ''}\n ${dataAttributes ? dataAttributes.join(' ') : ''}\n data-is-paused=\"true\"\n >\n
\n
\n ${Icon({\n icon: 'play'\n })}\n
\n
\n ${Icon({\n icon: 'pause'\n })}\n
\n
\n \n`\n}\n\nexport default PlayIcon\n","import Services from 'services'\nimport playIcon, { POSITIONS } from 'modules/PlayIcon/PlayIcon.template'\nimport { fromTemplate } from 'utilities/renderer'\nimport Analytics from 'services/Analytics/Analytics'\nimport { debounce } from 'utilities/utilities'\n\n/**\n * Video Player component\n */\nexport default class VideoPlayer {\n static SELECTORS = {\n VIDEO: '[data-video-player=\"video-player\"]',\n PLAY_BUTTON: '[data-video-payer=\"play-button\"]'\n }\n\n static ATTRIBUTES = {\n PLAY_BUTTON_STATUS: 'data-is-paused',\n PLAY_BUTTON_LABEL: 'data-play-label',\n PAUSE_BUTTON_LABEL: 'data-pause-label',\n PLAY_BUTTON_POSITION: 'data-play-button-position',\n HIDE_PLAY_BUTTON_AFTER_PLAY: 'data-hide-button-after-play'\n }\n\n static EVENTS = {\n PLAY: 'videoPlay',\n PAUSE: 'videoPause',\n STOP: 'videoStop',\n PLAY_VIDEO: 'playVideo', // Remote instruction to play video\n PAUSE_VIDEO: 'pauseVideo' // Remote instruction to pause video\n }\n\n static CLASSES = {\n HIDDEN: 'mod-player__play-button--hidden'\n }\n\n constructor(element) {\n this.element = element\n this.services = Services.getInstance()\n this.analyticsService = Analytics.getInstance() // ref to analytics service\n this.videoProgressMarkers = new Map()\n this.EventEmitterService = this.services.EventEmitterService\n this.trackInteractionDebounce = debounce(this.trackInteraction, 200)\n this.hasStarted = false\n\n this.cacheDom()\n this.initPlayButton()\n this.attachEvents()\n }\n\n /**\n * Cache DOM elements\n */\n cacheDom() {\n this.videoEl = this.element.querySelector(VideoPlayer.SELECTORS.VIDEO)\n this.videoProgressMarkers.set(this.videoEl, [25, 50, 75, 100])\n\n this.playButtonEl = this.element.querySelector(\n VideoPlayer.SELECTORS.PLAY_BUTTON\n )\n\n this.hasControls = this.videoEl?.hasAttribute('controls')\n\n this.videoElId = this.videoEl?.id || null\n }\n\n /**\n * Add event listeners\n */\n attachEvents() {\n this.playButton?.addEventListener('click', this.togglePlay)\n\n this.videoEl.addEventListener('ended', this.handleVideoEnd)\n this.videoEl.addEventListener('play', this.trackInteractionDebounce)\n this.videoEl.addEventListener('seeking', this.trackInteractionDebounce)\n this.videoEl.addEventListener('timeupdate', this.trackInteractionDebounce)\n this.videoEl.addEventListener('pause', this.trackInteractionDebounce)\n this.videoEl.addEventListener('ended', this.trackInteraction)\n\n this.EventEmitterService.on(VideoPlayer.EVENTS.PLAY_VIDEO, this.remotePlay)\n this.EventEmitterService.on(\n VideoPlayer.EVENTS.PAUSE_VIDEO,\n this.remotePause\n )\n }\n\n /**\n * Remove event listeners\n */\n removeEvents() {\n this.playButton?.removeEventListener('click', this.togglePlay)\n\n this.videoEl.removeEventListener('ended', this.handleVideoEnd)\n\n this.videoEl.removeEventListener('play', this.trackInteractionDebounce)\n this.videoEl.removeEventListener(\n 'timeupdate',\n this.trackInteractionDebounce\n )\n this.videoEl.removeEventListener('pause', this.trackInteractionDebounce)\n this.videoEl.removeEventListener('ended', this.trackInteraction)\n\n this.EventEmitterService.off(VideoPlayer.EVENTS.PLAY_VIDEO, this.remotePlay)\n this.EventEmitterService.off(\n VideoPlayer.EVENTS.PAUSE_VIDEO,\n this.remotePause\n )\n }\n\n /**\n * Destroy the modal instance and remove event listeners\n */\n destroy() {\n this.removeEvents()\n }\n\n /**\n * Track interaction\n */\n trackInteraction = (event) => {\n const { target } = event\n const videoType = target.dataset?.type\n\n if (\n (videoType !== 'poster' && videoType !== 'modal') ||\n this.filterAnalyticsEvent\n )\n return\n\n switch (event.type) {\n case 'play':\n if (this.hasStarted) return\n\n this.hasStarted = true\n this.analyticsService.trackInteraction('video', {\n video_title: target.dataset?.title || undefined,\n video_status: 'start',\n video_view: 1,\n video_url: target.currentSrc,\n video_provider: 'widen'\n })\n break\n case 'timeupdate': {\n const progress = Math.floor(\n (target.currentTime / target.duration) * 100\n )\n let progressMarkers = this.videoProgressMarkers.get(target)\n\n for (let i = 0; i < progressMarkers.length; i++) {\n if (progress >= progressMarkers[i]) {\n this.analyticsService.trackInteraction('video', {\n video_title: target.dataset?.title || undefined,\n video_status: 'progress',\n video_percent: progressMarkers[i],\n video_url: target.currentSrc,\n video_provider: 'widen'\n })\n progressMarkers = progressMarkers.slice(i + 1)\n this.videoProgressMarkers.set(target, progressMarkers)\n break\n }\n }\n break\n }\n case 'pause': {\n /**\n * This is a workaround to stop the video player firing the pause event\n * along with the ended event when a file finishes playing.\n */\n const eventThreshold = Math.floor(target.duration) - 2 // Stop registering events 2 seconds before end of video\n if (target.currentTime >= eventThreshold) return\n\n this.analyticsService.trackInteraction('video', {\n video_title: target.dataset?.title || undefined,\n video_status: 'pause',\n video_url: target.currentSrc,\n video_provider: 'widen'\n })\n break\n }\n case 'ended':\n this.hasStarted = false\n\n this.analyticsService.trackInteraction('video', {\n video_title: target.dataset?.title || undefined,\n video_status: 'complete',\n video_percent: 100,\n video_url: target.currentSrc,\n video_provider: 'widen'\n })\n break\n default:\n break\n }\n }\n\n /**\n * Initialize and render the play button if there is an element to render it to\n */\n initPlayButton() {\n const hasPlayButton = !!this.playButton\n\n if (this.playButtonEl) {\n const playButtonPosition =\n this.playButtonEl.getAttribute(\n VideoPlayer.ATTRIBUTES.PLAY_BUTTON_POSITION\n ) || POSITIONS.BOTTOM_RIGHT\n\n if (!hasPlayButton) {\n this.playButton = fromTemplate(\n playIcon({\n isButton: true,\n isInline: true,\n position: playButtonPosition\n })\n )\n\n this.playButtonEl.appendChild(this.playButton)\n }\n\n this.playButton.setAttribute(\n VideoPlayer.ATTRIBUTES.PLAY_BUTTON_STATUS,\n !this.videoEl.autoplay\n )\n\n this.playButton.setAttribute(\n 'aria-label',\n this.element.getAttribute(\n this.videoEl.autoplay\n ? VideoPlayer.ATTRIBUTES.PAUSE_BUTTON_LABEL\n : VideoPlayer.ATTRIBUTES.PLAY_BUTTON_LABEL\n )\n )\n\n if (this.hasControls) {\n // hide the controls when the custom play button is enabled\n this.videoEl.removeAttribute('controls')\n }\n\n this.playButtonEl.classList.remove(VideoPlayer.CLASSES.HIDDEN)\n }\n }\n\n /**\n * Toggle Video\n */\n togglePlay = () => {\n if (this.videoEl.paused) {\n this.play()\n } else {\n this.pause()\n }\n }\n\n /**\n * Play Video and update button\n * @param {object} event - Event object\n * @param {boolean} event.forcePause - Force the video to play without checking if it is already playing\n */\n play = ({ forcePlay = false, triggerAnalyticsEvent = false } = {}) => {\n if (this.videoEl?.paused || forcePlay) {\n this.videoEl.play()\n this.EventEmitterService.emit(VideoPlayer.EVENTS.PLAY, {\n videoId: this.videoElId\n })\n\n if (triggerAnalyticsEvent) {\n this.videoEl.dispatchEvent(new Event('play'))\n }\n\n if (this.playButton) {\n this.playButton.setAttribute(\n VideoPlayer.ATTRIBUTES.PLAY_BUTTON_STATUS,\n false\n )\n this.playButton.setAttribute(\n 'aria-label',\n this.element.getAttribute(VideoPlayer.ATTRIBUTES.PAUSE_BUTTON_LABEL)\n )\n\n if (\n this.playButtonEl.getAttribute(\n VideoPlayer.ATTRIBUTES.HIDE_PLAY_BUTTON_AFTER_PLAY\n ) === 'true'\n ) {\n this.playButtonEl.classList.add(VideoPlayer.CLASSES.HIDDEN)\n }\n\n if (this.hasControls && !this.videoEl.getAttribute('controls')) {\n // reenable the controls when the custom play button is enabled and controls has been set\n this.videoEl.setAttribute('controls', '')\n }\n }\n }\n }\n\n /**\n * Stop Video\n */\n stop = ({ triggerAnalyticsEvent = false }) => {\n this.hasStarted = false\n this.videoEl.pause()\n this.EventEmitterService.emit(VideoPlayer.EVENTS.STOP, {\n videoId: this.videoElId\n })\n\n if (triggerAnalyticsEvent) {\n this.videoEl.dispatchEvent(new Event('pause'))\n // reset the video to the beginning after a pause event\n // setting a timeout give the debounce function time to clear so that\n // timeupdate event is not fired\n setTimeout(() => {\n this.videoEl.currentTime = 0\n }, 500)\n } else {\n this.videoEl.currentTime = 0\n }\n }\n\n /**\n * Pause Video and update play button\n * @param {object} event - Event object\n * @param {boolean} event.forcePause - Force the video to pause without checking if it is already paused\n */\n pause = ({ forcePause = false } = {}) => {\n if (!this.videoEl?.paused || forcePause) {\n this.videoEl.pause()\n this.EventEmitterService.emit(VideoPlayer.EVENTS.PAUSE, {\n videoId: this.videoElId\n })\n\n if (this.playButton) {\n this.playButton.setAttribute(\n VideoPlayer.ATTRIBUTES.PLAY_BUTTON_STATUS,\n true\n )\n\n this.playButton.setAttribute(\n 'aria-label',\n this.element.getAttribute(VideoPlayer.ATTRIBUTES.PLAY_BUTTON_LABEL)\n )\n }\n }\n }\n\n /**\n * Process a Remote play event\n * @param {object} event - Event object\n * @param {string} event.videoId - Video ID\n */\n remotePlay = (event) => {\n const { videoId } = event\n\n if (videoId === this.videoElId) {\n this.play({ forcePlay: true })\n }\n }\n\n /**\n * Process a Remote pause event\n * @param {object} event - Event object\n * @param {string} event.videoId - Video ID\n */\n remotePause = (event) => {\n const { videoId } = event\n\n if (videoId === this.videoElId) {\n this.pause({ forcePause: true })\n }\n }\n\n /**\n * When the video ends, emit a STOP event, reset the poster image and show play button\n */\n handleVideoEnd = () => {\n this.EventEmitterService.emit(VideoPlayer.EVENTS.STOP, {\n videoId: this.videoElId\n })\n this.initPlayButton()\n this.videoEl.load()\n }\n}\n","/**\n * Conditionally returns a list of class names based\n * on the value's truthyness\n * @param {(boolean | undefined | ?string)[]} classes - An array of class names to be joined together\n * @returns {string} - A string of joined class names\n *\n * @example\n * classNames(true && 'foo', false && 'bar', 'baz', undefined && '') // => 'foo baz'\n */\nexport default function classNames(...classes) {\n return classes.filter(Boolean).join(' ')\n}\n","// Utility for rendering HTML elements\n\n/**\n * @function fromTemplate\n * @description Converts an HTML element string to a DOM object\n * @param {string} templateString String representation of a DOM element (e.g. '
content
')\n * @returns {Node} DOM Node\n */\nexport function fromTemplate(templateString) {\n const el = document.createElement('div')\n el.innerHTML = templateString.trim()\n\n // If there are multiple child nodes return the wrapped elements in a div\n if (el.childNodes.length > 1) {\n return el\n }\n\n return el.firstChild\n}\n\n/**\n * @function empty\n * @description Empties all of the inner elements from an element\n * @param {Node} element Element to empty\n */\nexport function empty(element) {\n while (element.firstChild) {\n element.removeChild(element.firstChild)\n }\n}\n\n/**\n * @function insert\n * @description Replaced the inner content of an element with a new node\n * @param {Node} node The DOM node element to insert\n * @param {Node} toElement The DOM node element to insert node into\n * @returns {Node}\n */\nexport function insert(node, toElement) {\n // dump the inner nodes before appending new content\n empty(toElement)\n\n // append the new node\n toElement.appendChild(node)\n\n return toElement\n}\n"],"names":["_ref","id","icon","addClassName","POSITIONS","BOTTOM_LEFT","BOTTOM_RIGHT","CENTER","TOP_LEFT","TOP_RIGHT","SIZES","LARGE","SMALL","a11y","buttonLabel","playLabel","pauseLabel","dataAttributes","isButton","isInline","position","size","isBlackAndWhite","arguments","length","undefined","tag","classNames","join","Icon","VideoPlayer","static","VIDEO","PLAY_BUTTON","PLAY_BUTTON_STATUS","PLAY_BUTTON_LABEL","PAUSE_BUTTON_LABEL","PLAY_BUTTON_POSITION","HIDE_PLAY_BUTTON_AFTER_PLAY","PLAY","PAUSE","STOP","PLAY_VIDEO","PAUSE_VIDEO","HIDDEN","constructor","element","this","services","Services","getInstance","analyticsService","Analytics","videoProgressMarkers","Map","EventEmitterService","trackInteractionDebounce","debounce","trackInteraction","hasStarted","cacheDom","initPlayButton","attachEvents","videoEl","querySelector","SELECTORS","set","playButtonEl","hasControls","hasAttribute","videoElId","playButton","addEventListener","togglePlay","handleVideoEnd","on","EVENTS","remotePlay","remotePause","removeEvents","removeEventListener","off","destroy","event","target","videoType","dataset","type","filterAnalyticsEvent","video_title","title","video_status","video_view","video_url","currentSrc","video_provider","progress","Math","floor","currentTime","duration","progressMarkers","get","i","video_percent","slice","eventThreshold","hasPlayButton","playButtonPosition","getAttribute","ATTRIBUTES","fromTemplate","playIcon","appendChild","setAttribute","autoplay","removeAttribute","classList","remove","CLASSES","paused","play","pause","_this","forcePlay","triggerAnalyticsEvent","emit","videoId","dispatchEvent","Event","add","stop","setTimeout","_this2","forcePause","load","_len","classes","Array","_key","filter","Boolean","templateString","el","document","createElement","innerHTML","trim","childNodes","firstChild","empty","removeChild","insert","node","toElement"],"sourceRoot":""}