var __assign=function(){return(__assign=Object.assign||function(e){for(var o,t=1,i=arguments.length;t";else if(l.vimeo){var a="lg-vimeo"+t,c=getVimeoURLParams(this.settings.vimeoPlayerParams,l);s='"}else if(l.wistia){e="lg-wistia"+t,c=param(this.settings.wistiaPlayerParams);s='"}else if(l.html5){for(var u="",g=0;g';if(i.tracks)for(g=0;g"}(g);var f="",p=i.attributes||{};Object.keys(p||{}).forEach(function(e){f+=e+'="'+p[e]+'" '}),s='"}return s},e.prototype.appendVideos=function(e,o){var t=this.getVideoHtml(o.src,o.addClass,o.index,o.html5Video),t=(e.find(".lg-video-cont").append(t),e.find(".lg-video-object").first());if(o.html5Video&&t.on("mousedown.lg.video",function(e){e.stopPropagation()}),this.settings.videojs&&null!=(e=this.core.galleryItems[o.index].__slideVideoInfo)&&e.html5)try{return videojs(t.get(),this.settings.videojsOptions)}catch(e){console.error("lightGallery:- Make sure you have included videojs")}},e.prototype.gotoNextSlideOnVideoEnd=function(e,o){var t=this,i=this.core.getSlideItem(o).find(".lg-video-object").first(),o=this.core.galleryItems[o].__slideVideoInfo||{};if(this.settings.gotoNextSlideOnVideoEnd)if(o.html5)i.on("ended",function(){t.core.goToNextSlide()});else if(o.vimeo)try{new Vimeo.Player(i.get()).on("ended",function(){t.core.goToNextSlide()})}catch(e){console.error("lightGallery:- Make sure you have included //github.com/vimeo/player.js")}else if(o.wistia)try{window._wq=window._wq||[],window._wq.push({id:i.attr("id"),onReady:function(e){e.bind("end",function(){t.core.goToNextSlide()})}})}catch(e){console.error("lightGallery:- Make sure you have included //fast.wistia.com/assets/external/E-v1.js")}},e.prototype.controlVideo=function(e,o){var t=this.core.getSlideItem(e).find(".lg-video-object").first(),e=this.core.galleryItems[e].__slideVideoInfo||{};if(t.get())if(e.youtube)try{t.get().contentWindow.postMessage('{"event":"command","func":"'+o+'Video","args":""}',"*")}catch(e){console.error("lightGallery:- "+e)}else if(e.vimeo)try{new Vimeo.Player(t.get())[o]()}catch(e){console.error("lightGallery:- Make sure you have included //github.com/vimeo/player.js")}else if(e.html5)if(this.settings.videojs)try{videojs(t.get())[o]()}catch(e){console.error("lightGallery:- Make sure you have included videojs")}else t.get()[o]();else if(e.wistia)try{window._wq=window._wq||[],window._wq.push({id:t.attr("id"),onReady:function(e){e[o]()}})}catch(e){console.error("lightGallery:- Make sure you have included //fast.wistia.com/assets/external/E-v1.js")}},e.prototype.loadVideoOnPosterClick=function(e,o){var t,i,s,l=this;e.hasClass("lg-video-loaded")?o&&this.playVideo(this.core.index):e.hasClass("lg-has-video")?this.playVideo(this.core.index):(e.addClass("lg-has-video"),o=void 0,t=this.core.galleryItems[this.core.index].src,(s=this.core.galleryItems[this.core.index].video)&&(o="string"==typeof s?JSON.parse(s):s),i=this.appendVideos(e,{src:t,addClass:"",index:this.core.index,html5Video:o}),this.gotoNextSlideOnVideoEnd(t,this.core.index),s=e.find(".lg-object").first().get(),e.find(".lg-video-cont").first().append(s),e.addClass("lg-video-loading"),i&&i.ready(function(){i.on("loadedmetadata",function(){l.onVideoLoadAfterPosterClick(e,l.core.index)})}),e.find(".lg-video-object").first().on("load.lg error.lg loadedmetadata.lg",function(){setTimeout(function(){l.onVideoLoadAfterPosterClick(e,l.core.index)},50)}))},e.prototype.onVideoLoadAfterPosterClick=function(e,o){e.addClass("lg-video-loaded"),this.playVideo(o)},e.prototype.destroy=function(){this.core.LGel.off(".lg.video"),this.core.LGel.off(".video")},e}();export default Video;