"use strict";define(["youtubeFactory","debounce","modal","throttle"],function(e,t,o,i){var n={elements:{videoTags:".video-media",videoComponent:".video-component",videoWrapper:".video-media-wrapper",videoControls:".video-controls",audioControls:".audio-controls",progressBar:".progress-bar",youtubePosterImage:".youtube-poster-image",youtubeVideoTag:".youtube-video",hoverPlayVideo:".video-hover-play",inViewportPlayVideo:".video-inviewport-play",modalClose:".modal-close",openModal:".video-component__open-modal",fancyBoxOverlay:".fancybox-overlay",videoControlsCentered:".video-controlsCentered"},vars:{isMobile:window.matchMedia("all and (max-width: 991px)"),alreadyAttachedIndependentEvents:!1,hoverTimer:0,longHoverLimit:2e3,windowWidth:"",initializedInViewportListener:!1,initializedYoutubeResizeListener:!1,youtubeVideos:{}},init:function(){var i=this;$(this.elements.videoComponent).each(function(e,t){var o=$(t);o.hasClass("video-initialized")||(o.hasClass("youtube-video")&&i.initYoutube(o),i.bind(o),i.checkAutoplay(o),o.addClass("video-initialized"))}),this.vars.alreadyAttachedIndependentEvents||($(window).on("resize",t($.proxy(this.handleWindowResize,this),500)),this.vars.alreadyAttachedIndependentEvents=!0),$(this.elements.openModal).on("click",function(){var e=$(this).closest(".lxteaser-content").find("video");e.hasClass("autoplay-in-popup")&&e.get(0).play()})},initYoutube:function(e){var t=e.attr("data-source"),o=e.attr("data-componentVideoId"),i=/^.*(\.be\/|v=)([^#\&\?]*).*/g.exec(t)[2],n=require("youtubeFactory");e.find(".video-media").attr("poster");e.find(".youtube-media").removeClass("hide"),e.find(".youtube-container").attr("data-youtube-id",i),e.find(".youtube-player").attr("id",i);var s=n("#video-component_"+o+" .youtube-wrapper",{closeOnEnd:!1,autoplay:!1},"#video-component_"+o+" .youtube-media");s.initYoutube(),this.vars.youtubeVideos[o]=s},bind:function(e){var a=this;if(e.hasClass("youtube-video")&&!this.vars.initializedYoutubeResizeListener&&$(window).on("resize",function(){$(a.elements.youtubeVideoTag).each(function(e,t){a.vars.youtubeVideos[$(t).data("componentvideoid")].resizeYoutube()})}),$(document).on("click",this.elements.modalClose,function(e){var t=$(".fancybox-inner").find(a.elements.videoTags),o=t.get(0),i=$(".fancybox-inner").find(".video-component");if(0=o.vars.longHoverLimit&&t.addClass("long-hover")},200))},resetHoverTimer:function(e){$(e.target).closest(this.elements.videoComponent).removeClass("long-hover"),this.vars.hoverTimer=0,clearInterval(this.vars.intervalId)},videoReinit:function(e){var t=$(e.target),o=t.closest(this.elements.videoComponent),i=t.closest(".video-component").find(this.elements.progressBar).get(0);o.addClass("paused"),i.value=0},updateProgressBar:function(e){var t=e.target,o=$(t).closest(".video-component").find(this.elements.progressBar).get(0),i=Math.floor(100/t.duration*t.currentTime);isNaN(i)||(o.value=i)},handleContextMenu:function(e){return e.preventDefault(),!1},isInViewport:function(e,t){e instanceof jQuery&&(e=e[0]),t||(t=0);var o=e.getBoundingClientRect();return o.top<=(window.innerHeight||document.documentElement.clientHeight)-t&&0<=o.left&&o.bottom>=0+t&&o.right<=(window.innerWidth||document.documentElement.clientWidth)},handleInViewportVideo:function(e){var t=this;$(this.elements.inViewportPlayVideo+" video").each(function(){t.viewPortPlay(this)}),this.vars.isMobile.matches&&$(this.elements.hoverPlayVideo+" video").each(function(){t.viewPortPlay(this)})},viewPortPlay:function(e){var t=$(e).closest(".simple-banner_media, .lxteaser-media"),o=!$(e).data("loop"),i=$(e).closest(".video-component").attr("id"),n=sessionStorage.getItem(i+"_played"),s=$(e).closest(this.elements.videoComponent);if(this.isInViewport(t,100)){if(o&&n)return;$(e)[0].play(),s.removeClass("paused"),sessionStorage.setItem(i+"_played",!0)}else $(e)[0].pause(),s.addClass("paused"),sessionStorage.removeItem(i+"_played",!0)},handleHoverPlayVideo:function(e){if(!this.vars.isMobile.matches){var t=$(e.target).closest(".video-component").find("video"),o=t.closest(this.elements.videoComponent);"mouseover"===e.type?(t[0].play(),o.removeClass("paused")):(t[0].pause(),o.addClass("paused"))}},handleWindowResize:function(e){if(this.checkWindowWidth()){var t=this;$(".video-component").each(function(){t.loadVideo($(this))})}},loadVideo:function(e){var t=$(window).innerWidth(),o=e.find("video.video-media"),i=o.data("videodesktopurl"),n=o.data("videotableturl"),s=o.data("videomobileurl"),a="";o.get(0)&&(""===(a=1e3