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cE,OACxC7B,OAAO2B,cAAcC,GAAc,EAAKf,aAG5CH,UAAW,WACPoB,EAAE,EAAKC,MAAMC,SAAS,8BAEtB7B,YAAW,WACP,EAAKU,YAAYH,YACjB,EAAKM,GAAGiB,QAAQC,KAAK,eAAe,KACrC,SArGM,2BAyGZ,CACL3B,UAAW,WACP,IAAMa,EAAU,EAAKJ,GAAGC,MAAMI,KAAK,YAEnCS,EAAE,EAAKC,MAAMC,SAAS,8BAEjBZ,GAILU,EAAE,EAAKC,MAAMb,KAAK,4BAA4BiB,KAA9C,wEACkDf,EADlD,qLAG4CA,EAH5C,+DAjHA5B,EAAQuC,OACRK,KAAKL,KAAOvC,EAAQuC,MAGpBK,KAAKL,OACLK,KAAKpB,GAAK,CACNqB,MAAOP,EAAEM,KAAKL,MAAMb,KAAK,6BACzBD,MAAOa,EAAEM,KAAKL,MAAMb,KAAK,uBACzBoB,OAAQR,EAAEM,KAAKL,MAAMb,KAAK,uBAAuBG,KAAK,WAAa,UACnEY,QAASH,EAAEM,KAAKL,MAAMb,KAAK,sBAC3BqB,cAAeT,EAAEM,KAAKL,MAAMb,KAAK,oBAIzCkB,KAAKI,gB,kDAGT,WAAgB,WACZJ,KAAKpB,GAAGiB,QAAQQ,GAAG,SAAS,WACxB,EAAKzB,GAAGiB,QAAQS,IAAI,gBAAiB,QACd,YAAnB,EAAK1B,GAAGsB,OACR,EAAK7B,GAAGF,YAGR,EAAKoC,OAAOpC,eAIpB6B,KAAKpB,GAAGuB,cAAcE,GAAG,SAAS,WAC9BX,EAAE,EAAKC,MAAMb,KAAK,gEAAgE0B,YAAY,YAC9Fd,EAAE,EAAKC,MAAMb,KAAK,sCAAsC0B,YAAY,uC,EAvC1ErD,G","sources":["webpack://umms-html/./node_modules/@babel/runtime/helpers/defineProperty.js","webpack://umms-html/./FrontEndSrc/modules/macro/media-video/media-video.js"],"sourcesContent":["function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nmodule.exports = _defineProperty, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","'use strict';\r\nclass MediaVideo {\r\n\r\n ui;\r\n videoReady = null;\r\n videoPlayer = null;\r\n wrap;\r\n\r\n constructor(options) {\r\n\r\n if (options.wrap) {\r\n this.wrap = options.wrap;\r\n }\r\n\r\n if (this.wrap) {\r\n this.ui = {\r\n cover: $(this.wrap).find('.media-video__placeholder'),\r\n video: $(this.wrap).find('.media-video__embed'),\r\n source: $(this.wrap).find('.media-video__embed').data('source') || 'youtube',\r\n btnPlay: $(this.wrap).find('.media-video__play'),\r\n btnTranscript: $(this.wrap).find('.js-transcript')\r\n };\r\n }\r\n\r\n this.bindUIActions();\r\n }\r\n\r\n bindUIActions() {\r\n this.ui.btnPlay.on('click', () => {\r\n this.ui.btnPlay.css('pointerEvents', 'none');\r\n if (this.ui.source === 'youtube') {\r\n this.yt.initVideo();\r\n }\r\n else {\r\n this.wistia.initVideo();\r\n }\r\n });\r\n\r\n this.ui.btnTranscript.on('click', () => {\r\n $(this.wrap).find('.accordion-title-toggle__show, .accordion-title-toggle__hide').toggleClass('u-hidden')\r\n $(this.wrap).find('.media-video__transcript.accordion').toggleClass('media-video__transcript-show')\r\n });\r\n }\r\n\r\n\r\n yt = {\r\n initYouTubeAPI: () => {\r\n const tag = document.createElement('script');\r\n\r\n tag.src = 'https://www.youtube.com/iframe_api';\r\n document.querySelector('head').insertAdjacentElement('beforeend', tag);\r\n\r\n window.YouTubeApiLoad = true;\r\n\r\n window.onYouTubeIframeAPIReady = () => {\r\n setTimeout(() => {\r\n const event = new Event('youtube:apiLoaded');\r\n\r\n document.dispatchEvent(event);\r\n }, 50);\r\n };\r\n },\r\n initVideo: () => {\r\n if (window.YouTubeApiLoad === true && this.videoReady) {\r\n this.yt.playVideo();\r\n }\r\n else if (window.YouTubeApiLoad === true) {\r\n this.yt.createVideo();\r\n }\r\n else {\r\n this.yt.initYouTubeAPI();\r\n\r\n document.addEventListener('youtube:apiLoaded', () => {\r\n this.yt.createVideo();\r\n });\r\n }\r\n },\r\n createVideo: () => {\r\n this.videoPlayer = new window.YT.Player(this.ui.video.find('.media-video__embed-wrap > div').get(0), {\r\n videoId: this.ui.video.data('video-id'),\r\n origin: window.location.origin,\r\n enablejsapi: 1,\r\n playerVars: {\r\n 'autoplay': 0,\r\n 'rel': 0,\r\n 'disablekb': 1,\r\n 'iv_load_policy': 3,\r\n 'loop': 1,\r\n 'playlist': this.ui.video.data('video-id'),\r\n 'modestbranding': 1\r\n },\r\n events: {\r\n 'onReady': () => {\r\n this.videoReady = true;\r\n this.yt.playVideo();\r\n }\r\n }\r\n });\r\n window.YouTubeVideos = window.YouTubeVideos || [];\r\n const videoIndex = window.YouTubeVideos.length;\r\n window.YouTubeVideos[videoIndex] = this.videoPlayer;\r\n },\r\n\r\n playVideo: () => {\r\n $(this.wrap).addClass('media-video--video-playing');\r\n\r\n setTimeout(() => {\r\n this.videoPlayer.playVideo();\r\n this.ui.btnPlay.attr('aria-hidden', true);\r\n }, 500);\r\n }\r\n }\r\n\r\n wistia = {\r\n initVideo: () => {\r\n const videoId = this.ui.video.data('video-id');\r\n\r\n $(this.wrap).addClass('media-video--video-playing');\r\n\r\n if (!videoId) {\r\n return;\r\n }\r\n\r\n $(this.wrap).find('.media-video__embed-wrap').html(`\r\n <script src=\"//fast.wistia.com/embed/medias/${videoId}.jsonp\" async></script>\r\n <script src=\"//fast.wistia.com/assets/external/E-v1.js\" async></script>\r\n <div class=\"wistia_embed wistia_async_${videoId} playerColor=cf4917 autoPlay=true\"></div>\r\n `);\r\n }\r\n }\r\n\r\n}\r\nexport default MediaVideo;\r\n"],"names":["module","exports","obj","key","value","Object","defineProperty","enumerable","configurable","writable","__esModule","MediaVideo","options","initYouTubeAPI","tag","document","createElement","src","querySelector","insertAdjacentElement","window","YouTubeApiLoad","onYouTubeIframeAPIReady","setTimeout","event","Event","dispatchEvent","initVideo","videoReady","yt","playVideo","createVideo","addEventListener","videoPlayer","YT","Player","ui","video","find","get","videoId","data","origin","location","enablejsapi","playerVars","events","YouTubeVideos","videoIndex","length","$","wrap","addClass","btnPlay","attr","html","this","cover","source","btnTranscript","bindUIActions","on","css","wistia","toggleClass"],"sourceRoot":""}