!function(e){var o={};function t(n){if(o[n])return o[n].exports;var i=o[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}t.m=e,t.c=o,t.d=function(e,o,n){t.o(e,o)||Object.defineProperty(e,o,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,o){if(1&o&&(e=t(e)),8&o)return e;if(4&o&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&o&&"string"!=typeof e)for(var i in e)t.d(n,i,function(o){return e[o]}.bind(null,i));return n},t.n=function(e){var o=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(o,"a",o),o},t.o=function(e,o){return Object.prototype.hasOwnProperty.call(e,o)},t.p="",t(t.s=0)}([function(e,o,t){"use strict";function n(e,o){for(var t=0;t<o.length;t++){var n=o[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}t.r(o);var i=function(){function e(){!function(e,o){if(!(e instanceof o))throw new TypeError("Cannot call a class as a function")}(this,e)}var o,t,i;return o=e,i=[{key:"init",value:function(){var o=document.querySelector(e.element.videoBoundary),t=document.querySelector(e.element.body);return o&&!t.classList.contains("video-processed")&&(t.classList.add("video-processed"),e.prepIDs(),e.checkYoutube(),e.checkVimeo()),self}},{key:"prepIDs",value:function(){this.videoBoundaries=Array.prototype.slice.call(document.querySelectorAll(e.element.videoBoundary)),this.videoBoundaries?this.videoBoundaries.forEach((function(o,t){var n=o.getAttribute("data-video-type");if(n){var i=o.querySelector(e.element.videoContainer);i?i.setAttribute("id",n+"-"+t):console.log("Video component: No videoContainer found")}else console.log("Video component: Video type was not found")})):console.log("Video component: No videoBoundaries found")}},{key:"checkYoutube",value:function(){var o=this.videoBoundaries.filter(e.isYoutube);o&&e.loadAPI("https://www.youtube.com/player_api",e.initYoutube,o)}},{key:"checkVimeo",value:function(){var o=this.videoBoundaries.filter(e.isVimeo);o&&e.loadAPI("https://player.vimeo.com/api/player.js",e.initVimeo,o)}},{key:"loadAPI",value:function(e,o,t){var n=document.getElementsByTagName("HEAD")[0],i=document.createElement("script");i.type="text/javascript",i.src=e,n.appendChild(i),i.addEventListener("load",o(t))}},{key:"initYoutube",value:function(o){window.onYouTubePlayerAPIReady=function(){o.forEach((function(o){o.getAttribute("data-video-type");var t=o.querySelector(e.element.videoContainer),n=o.getAttribute("data-video-id"),i=o.querySelector(e.element.videoPosterImageContainer);if(t&&n&&i){var r=t.getAttribute("id");r?new YT.Player(r,{width:"900",height:"506",videoId:n,playerVars:{modestbranding:1,playsinline:0},enablejsapi:1,events:{onReady:function(e){i?i.addEventListener("click",(function(){i.classList.add("active"),e.target.playVideo()})):console.log("Video component: videoPosterImageContainer not found")}}}):console.log("Video component: videoElementID not found")}else console.log("Video component: videoContainer, videoID, or videoPosterImageContainer not found")}))}}},{key:"initVimeo",value:function(o){setTimeout((function(){o.forEach((function(o){o.getAttribute("data-video-type");var t=o.querySelector(e.element.videoContainer),n=o.getAttribute("data-video-id"),i=o.querySelector(e.element.videoPosterImageContainer);if(t&&n&&i){var r=t.getAttribute("id");if(r){var a={id:n,width:640,loop:!0},d=new Vimeo.Player(r,a);d.ready().then((function(){i.addEventListener("click",(function(){i.classList.add("active"),d.play()}))}))}else console.log("Video component: videoElementID not found")}else console.log("Video component: videoContainer, videoID, or videoPosterImageContainer not found")}))}),500)}},{key:"isYoutube",value:function(e){var o=e.getAttribute("data-video-type");return o?"youtube"==o:void console.log("Video component: data-video-type not found")}},{key:"isVimeo",value:function(e){var o=e.getAttribute("data-video-type");return o?"vimeo"==o:void console.log("Video component: data-video-type not found")}},{key:"element",get:function(){return{videoBoundary:".videoembed__boundary",videoContainer:".videoembed__embed",videoPosterImageContainer:".videoembed__posterimage",body:"body"}}},{key:"options",get:function(){return{vimeoApiUrl:"https://player.vimeo.com/api/player.js"}}}],(t=null)&&n(o.prototype,t),i&&n(o,i),e}();Drupal.behaviors.videoEmbed={attach:function(e,o){e===document&&i.init()}}}]);