!function(e,t){if("function"==typeof define&&define.amd)define("GLightbox",["module"],t);else if("undefined"!=typeof exports)t(module);else{var i={exports:{}};t(i),e.GLightbox=i.exports}}(this,function(e){"use strict";var t=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n=navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(Android)|(PlayBook)|(BB10)|(BlackBerry)|(Opera Mini)|(IEMobile)|(webOS)|(MeeGo)/i),s=null!==n||void 0!==document.createTouch||"ontouchstart"in window||"onmsgesturechange"in window||navigator.msMaxTouchPoints,o=document.getElementsByTagName("html")[0],l=function(){var e=void 0,t=document.createElement("fakeelement"),i={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(e in i)if(void 0!==t.style[e])return i[e]}(),r=function(){var e=void 0,t=document.createElement("fakeelement"),i={animation:"animationend",OAnimation:"oAnimationEnd",MozAnimation:"animationend",WebkitAnimation:"webkitAnimationEnd"};for(e in i)if(void 0!==t.style[e])return i[e]}(),a=Date.now(),d=[],c={},u={selector:"glightbox",skin:"clean",closeButton:!0,startAt:0,autoplayVideos:!0,descPosition:"bottom",width:900,height:506,videosWidth:960,videosHeight:540,beforeSlideChange:null,afterSlideChange:null,beforeSlideLoad:null,afterSlideLoad:null,onOpen:null,onClose:null,loopAtEnd:!1,touchNavigation:!0,keyboardNavigation:!0,closeOnOutsideClick:!0,jwplayer:{api:null,licenseKey:null,params:{width:"100%",aspectratio:"16:9",stretching:"uniform"}},vimeo:{api:"https://player.vimeo.com/api/player.js",params:{api:1,title:0,byline:0,portrait:0}},youtube:{api:"https://www.youtube.com/iframe_api",params:{enablejsapi:1,showinfo:0}},openEffect:"zoomIn",closeEffect:"zoomOut",slideEffect:"slide",moreText:"See more",moreLength:60,lightboxHtml:"",cssEfects:{fade:{in:"fadeIn",out:"fadeOut"},zoom:{in:"zoomIn",out:"zoomOut"},slide:{in:"slideInRight",out:"slideOutLeft"},slide_back:{in:"slideInLeft",out:"slideOutRight"}}};u.slideHtml='<div class="gslide"> <div class="gslide-inner-content"> <div class="ginner-container"> <div class="gslide-media"> </div> <div class="gslide-description"> <div class="gdesc-inner"> <h4 class="gslide-title"></h4> <div class="gslide-desc"></div> </div> </div> </div> </div> </div>';function h(){var e={},t=!1,i=0,n=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(t=arguments[0],i++);for(var s=function(i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t&&"[object Object]"===Object.prototype.toString.call(i[n])?e[n]=h(!0,e[n],i[n]):e[n]=i[n])};i<n;i++){s(arguments[i])}return e}u.lightboxHtml='<div id="glightbox-body" class="glightbox-container"> <div class="gloader visible"></div> <div class="goverlay"></div> <div class="gcontainer"> <div id="glightbox-slider" class="gslider"></div> <a class="gnext"></a> <a class="gprev"></a> <a class="gclose"></a> </div> </div>';var v={isFunction:function(e){return"function"==typeof e},isString:function(e){return"string"==typeof e},isNode:function(e){return!(!e||!e.nodeType||1!=e.nodeType)},isArray:function(e){return Array.isArray(e)},isArrayLike:function(e){return e&&e.length&&isFinite(e.length)},isObject:function(e){return"object"===(void 0===e?"undefined":i(e))&&null!=e&&!v.isFunction(e)&&!v.isArray(e)},isNil:function(e){return null==e},has:function(e,t){return null!==e&&hasOwnProperty.call(e,t)},size:function(e){if(v.isObject(e)){if(e.keys)return e.keys().length;var t=0;for(var i in e)v.has(e,i)&&t++;return t}return e.length},isNumber:function(e){return!isNaN(parseFloat(e))&&isFinite(e)}};function f(e,t){if((v.isNode(e)||e===window||e===document)&&(e=[e]),v.isArrayLike(e)||v.isObject(e)||(e=[e]),0!=v.size(e))if(v.isArrayLike(e)&&!v.isObject(e))for(var i=e.length,n=0;n<i&&!1!==t.call(e[n],e[n],n,e);n++);else if(v.isObject(e))for(var s in e)if(v.has(e,s)&&!1===t.call(e[s],e[s],s,e))break}function g(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=e[a]=e[a]||[],s={all:n,evt:null,found:null};return t&&i&&v.size(n)>0&&f(n,function(e,n){if(e.eventName==t&&e.fn.toString()==i.toString())return s.found=!0,s.evt=n,!1}),s}function p(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=t.onElement,n=t.withCallback,s=t.avoidDuplicate,o=void 0===s||s,l=t.once,r=void 0!==l&&l,a=t.useCapture,d=void 0!==a&&a,c=arguments[2],u=i||[];function h(e){v.isFunction(n)&&n.call(c,e,this),r&&h.destroy()}return v.isString(u)&&(u=document.querySelectorAll(u)),h.destroy=function(){f(u,function(t){var i=g(t,e,h);i.found&&i.all.splice(i.evt,1),t.removeEventListener&&t.removeEventListener(e,h,d)})},f(u,function(t){var i=g(t,e,h);(t.addEventListener&&o&&!i.found||!o)&&(t.addEventListener(e,h,d),i.all.push({eventName:e,fn:h}))}),h}function y(e,t){b(e,t)||(e.classList?e.classList.add(t):e.className+=" "+t)}function m(e,t){var i=t.split(" ");i.length>1?f(i,function(t){m(e,t)}):e.classList?e.classList.remove(t):e.className=e.className.replace(t,"")}function b(e,t){return e.classList?e.classList.contains(t):new RegExp("(^| )"+t+"( |$)","gi").test(e.className)}function w(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!e||""===t)return!1;if("none"==t)return v.isFunction(i)&&i(),!1;var n=t.split(" ");f(n,function(t){y(e,"g"+t)}),p(r,{onElement:e,avoidDuplicate:!1,once:!0,withCallback:function(e,t){f(n,function(e){m(t,"g"+e)}),v.isFunction(i)&&i()}})}function S(e){var t=document.createDocumentFragment(),i=document.createElement("div");for(i.innerHTML=e;i.firstChild;)t.appendChild(i.firstChild);return t}function x(e,t){for(;e!==document.body;){if("function"==typeof(e=e.parentElement).matches?e.matches(t):e.msMatchesSelector(t))return e}}function k(e){e.style.display="block"}function E(e){e.style.display="none"}var C=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments[1],i={href:"",title:"",type:"",description:"",descPosition:"bottom",effect:"",node:e};if(v.isObject(e)&&!v.isNode(e))return h(i,e);var n="",s=e.getAttribute("data-glightbox"),o=e.nodeName.toLowerCase();if("a"===o&&(n=e.href),"img"===o&&(n=e.src),i.href=n,f(i,function(n,s){v.has(t,s)&&(i[s]=t[s]);var o=e.dataset[s];v.isNil(o)||(i[s]=o)}),i.type||(i.type=j(n)),v.isNil(s)){if("a"==o){var l=e.title;v.isNil(l)||""===l||(i.title=l)}if("img"==o){var r=e.alt;v.isNil(r)||""===r||(i.title=r)}var a=e.getAttribute("data-description");v.isNil(a)||""===a||(i.description=a)}else{var d=[];f(i,function(e,t){d.push(";\\s?"+t)}),d=d.join("\\s?:|"),""!==s.trim()&&f(i,function(e,t){var n=s,o=new RegExp("s?"+t+"s?:s?(.*?)("+d+"s?:|$)"),l=n.match(o);if(l&&l.length&&l[1]){var r=l[1].trim().replace(/;\s*$/,"");i[t]=r}})}var c=e.querySelector(".glightbox-desc");c&&(i.description=c.innerHTML);var u="video"==i.type?t.videosWidth:t.width,g="video"==i.type?t.videosHeight:t.height;return i.width=v.has(i,"width")?i.width:u,i.height=v.has(i,"height")?i.height:g,i},A=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(b(e,"loaded"))return!1;v.isFunction(this.settings.beforeSlideLoad)&&this.settings.beforeSlideLoad(e,i);var o=i.type,l=i.descPosition,r=e.querySelector(".gslide-media"),a=e.querySelector(".gslide-title"),u=e.querySelector(".gslide-desc"),f=e.querySelector(".gdesc-inner"),g=s;if(v.isFunction(this.settings.afterSlideLoad)&&(g=function(){v.isFunction(s)&&s(),t.settings.afterSlideLoad(e,i)}),""==i.title&&""==i.description?f&&f.parentNode.removeChild(f):(a&&""!==i.title?a.innerHTML=i.title:a.parentNode.removeChild(a),u&&""!==i.description?n&&this.settings.moreLength>0?(i.smallDescription=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:50,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=i;if((e=e.trim()).length<=t)return e;var s=e.substr(0,t-1);if(!n)return s;return s+'... <a href="#" class="desc-more">'+i+"</a>"}(i.description,this.settings.moreLength,this.settings.moreText),u.innerHTML=i.smallDescription,function e(t,i){var n=t.querySelector(".desc-more");if(!n)return!1;p("click",{onElement:n,withCallback:function(t,n){t.preventDefault();var s=x(n,".gslide-desc");if(!s)return!1;s.innerHTML=i.description,y(body,"gdesc-open");var o=p("click",{onElement:[body,x(s,".gslide-description")],withCallback:function(t,n){"a"!==t.target.nodeName.toLowerCase()&&(m(body,"gdesc-open"),y(body,"gdesc-closed"),s.innerHTML=i.smallDescription,e(s,i),setTimeout(function(){m(body,"gdesc-closed")},400),o.destroy())}})}})}.apply(this,[u,i])):u.innerHTML=i.description:u.parentNode.removeChild(u),y(r.parentNode,"desc-"+l),y(f.parentNode,"description-"+l)),y(r,"gslide-"+o),y(e,"loaded"),"video"===o)return r.innerHTML='<div class="gvideo-wrapper"></div>',void function(e,t,i){var s=this,o="gvideo"+t.index,l=e.querySelector(".gvideo-wrapper"),r=t.href,a=location.protocol.replace(":","");"file"==a&&(a="http");if(r.match(/vimeo\.com\/([0-9]*)/)){var u=/vimeo.*\/(\d+)/i.exec(r),f=L(this.settings.vimeo.params),g=a+"://player.vimeo.com/video/"+u[1]+"?"+f;N(this.settings.vimeo.api);l.parentNode.style.maxWidth=t.width+"px",l.style.width=t.width+"px",l.style.maxHeight=t.height+"px";var p=T({url:g,callback:function(){q(function(){return"undefined"!=typeof Vimeo},function(){var e=new Vimeo.Player(p);c[o]=e,v.isFunction(i)&&i()})},allow:"autoplay; fullscreen",appendTo:l});p.id=o,p.className="vimeo-video gvideo",this.settings.autoplayVideos&&!n&&(p.className+=" wait-autoplay")}if(r.match(/(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/)||r.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/)){var m=h(this.settings.youtube.params,{playerapiid:o}),b=L(m),w=function(e){var t="";t=void 0!==(e=e.replace(/(>|<)/gi,"").split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/))[2]?(t=e[2].split(/[^0-9a-z_\-]/i))[0]:e;return t}(r),x=a+"://www.youtube.com/embed/"+w+"?"+b;N(this.settings.youtube.api);l.parentNode.style.maxWidth=t.width+"px",l.style.width=t.width+"px",l.style.maxHeight=t.height+"px";var k=T({url:x,callback:function(){if(!v.isNil(YT)&&YT.loaded){var e=new YT.Player(k);c[o]=e}else d.push(k);v.isFunction(i)&&i()},allow:"autoplay; fullscreen",appendTo:l});k.id=o,k.className="youtube-video gvideo",this.settings.autoplayVideos&&!n&&(k.className+=" wait-autoplay")}if(null!==r.match(/\.(mp4|ogg|webm)$/)){var E='<video id="'+o+'" ';E+='style="background:#000; width: '+t.width+"px; height: "+t.height+'px;" ',E+='preload="metadata" ',E+='x-webkit-airplay="allow" ',E+='webkit-playsinline="" ',E+="controls ",E+='class="gvideo">';var C=r.toLowerCase().split(".").pop(),A={mp4:"",ogg:"",webm:""};for(var O in A[C]=r,A)if(A.hasOwnProperty(O)){var j=A[O];t.hasOwnProperty(O)&&(j=t[O]),""!==j&&(E+='<source src="'+j+'" type="video/'+O+'">')}var I=S(E+="</video>");l.appendChild(I);var B=document.getElementById(o);if(null!==this.settings.jwplayer&&null!==this.settings.jwplayer.api){this.settings.jwplayer;var F=this.settings.jwplayer.api;if(!F)return console.warn("Missing jwplayer api file"),v.isFunction(i)&&i(),!1;N(F,function(){var e=h(s.settings.jwplayer.params,{width:t.width+"px",height:t.height+"px",file:r});jwplayer.key=s.settings.jwplayer.licenseKey;var n=jwplayer(o);n.setup(e),c[o]=n,n.on("ready",function(){y(B=l.querySelector(".jw-video"),"gvideo"),B.id=o,v.isFunction(i)&&i()})})}else y(B,"html5-video"),c[o]=B,v.isFunction(i)&&i()}}.apply(this,[e,i,g]);if("external"!==o)if("inline"!==o){if("image"===o){var w=new Image;return w.addEventListener("load",function(){v.isFunction(g)&&g()},!1),w.src=i.href,void r.appendChild(w)}v.isFunction(g)&&g()}else(function(e,t,i){var n=e.querySelector(".gslide-media"),s=t.href.split("#").pop().trim(),o=document.getElementById(s);if(!o)return!1;var l=o.cloneNode(!0);l.style.height=t.height+"px",l.style.maxWidth=t.width+"px",y(l,"ginlined-content"),n.appendChild(l),v.isFunction(i)&&i();return}).apply(this,[e,i,g]);else{var k=T({url:i.href,width:i.width,height:i.height,callback:g});r.appendChild(k)}};function T(e){var t=e.url,i=e.width,s=e.height,o=e.allow,l=e.callback,r=e.appendTo,a=document.createElement("iframe"),d=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;return a.className="vimeo-video gvideo",a.src=t,s&&(a.style.height=n&&d<767?"":s+"px"),i&&(a.style.width=i+"px"),o&&a.setAttribute("allow",o),a.onload=function(){y(a,"iframe-ready"),v.isFunction(l)&&l()},r&&r.appendChild(a),a}function N(e,t){if(v.isNil(e))console.error("Inject videos api error");else{var i=document.querySelectorAll('script[src="'+e+'"]');if(v.isNil(i)||0==i.length){var n=document.createElement("script");return n.type="text/javascript",n.src=e,n.onload=function(){v.isFunction(t)&&t()},document.body.appendChild(n),!1}v.isFunction(t)&&t()}}function O(){for(var e=0;e<d.length;e++){var t=d[e],i=new YT.Player(t);c[t.id]=i}}function q(e,t,i,n){if(e())t();else{i||(i=100);var s=void 0,o=setInterval(function(){e()&&(clearInterval(o),s&&clearTimeout(s),t())},i);n&&(s=setTimeout(function(){clearInterval(o)},n))}}function L(e){var t="",i=0;return f(e,function(e,n){i>0&&(t+="&"),t+=n+"="+e,i+=1}),t}void 0!==window.onYouTubeIframeAPIReady?window.onYouTubeIframeAPIReady=function(){window.onYouTubeIframeAPIReady(),O()}:window.onYouTubeIframeAPIReady=O;var j=function(e){var t=e;if(null!==(e=e.toLowerCase()).match(/\.(jpeg|jpg|gif|png|apn|webp|svg)$/))return"image";if(e.match(/(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/)||e.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/))return"video";if(e.match(/vimeo\.com\/([0-9]*)/))return"video";if(null!==e.match(/\.(mp4|ogg|webm)$/))return"video";if(e.indexOf("#")>-1&&""!==t.split("#").pop().trim())return"inline";return e.includes("gajax=true")?"ajax":"external"};function I(){var e=this;if(this.events.hasOwnProperty("touchStart"))return!1;var t=void 0,i=void 0,n=void 0,s=!1,o=!1,l=!1,r=!1,a={},d={},c=(this.slidesContainer,null),u=0,h=0,v=null,f=null,g=null,w=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;this.events.doctouchmove=p("touchmove",{onElement:document,withCallback:function(e,t){if(b(body,"gdesc-open"))return e.preventDefault(),!1}}),this.events.touchStart=p("touchstart",{onElement:body,withCallback:function(t,i){b(body,"gdesc-open")||(y(body,"touching"),c=e.getActiveSlide(),v=c.querySelector(".gslide-image"),f=c.querySelector(".gslide-media"),g=c.querySelector(".gslide-description"),e.index,d=t.targetTouches[0],a.pageX=t.targetTouches[0].pageX,a.pageY=t.targetTouches[0].pageY,u=t.targetTouches[0].clientX,h=t.targetTouches[0].clientY)}}),this.events.gestureStart=p("gesturestart",{onElement:body,withCallback:function(e,t){v&&(e.preventDefault(),l=!0)}}),this.events.gestureChange=p("gesturechange",{onElement:body,withCallback:function(e,t){e.preventDefault(),B(v,"scale("+e.scale+")")}}),this.events.gesturEend=p("gestureend",{onElement:body,withCallback:function(e,t){l=!1,e.scale<1?(r=!1,B(v,"scale(1)")):r=!0}}),this.events.touchMove=p("touchmove",{onElement:body,withCallback:function(v,p){if(b(body,"touching")&&!(b(body,"gdesc-open")||l||r)){v.preventDefault(),d=v.targetTouches[0];var y=c.querySelector(".gslide-inner-content").offsetHeight,m=c.querySelector(".gslide-inner-content").offsetWidth,S=v.targetTouches[0].clientX,x=v.targetTouches[0].clientY,k=u-S,E=h-x;if(Math.abs(k)>Math.abs(E)?(s=!1,o=!0):(o=!1,s=!0),s){if(i,i=d.pageY-a.pageY,Math.abs(i)>=0||s){var C=.75-Math.abs(i)/y;f.style.opacity=C,g&&(g.style.opacity=C),B(f,"translate3d(0, "+i+"px, 0)")}}else if(t,t=d.pageX-a.pageX,n=100*t/w,o){if(e.index+1==e.elements.length&&t<-60)return F(c),!1;if(e.index-1<0&&t>60)return F(c),!1;var A=.75-Math.abs(t)/m;f.style.opacity=A,g&&(g.style.opacity=A),B(f,"translate3d("+n+"%, 0, 0)")}}}}),this.events.touchEnd=p("touchend",{onElement:body,withCallback:function(l,r){i=d.pageY-a.pageY,t=d.pageX-a.pageX,n=100*t/w,m(body,"touching");var u=c.querySelector(".gslide-inner-content").offsetHeight,h=c.querySelector(".gslide-inner-content").offsetWidth;if(s){var v=u/2;return s=!1,Math.abs(i)>=v?void e.close():void F(c)}if(o){o=!1;var f="prev",g=!0;if(t<0&&(f="next",t=Math.abs(t)),"prev"==f&&e.index-1<0&&(g=!1),"next"==f&&e.index+1>=e.elements.length&&(g=!1),g&&t>=h/2-90)return void("next"==f?e.nextSlide():e.prevSlide());F(c)}}})}function B(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(""==t)return e.style.webkitTransform="",e.style.MozTransform="",e.style.msTransform="",e.style.OTransform="",e.style.transform="",!1;e.style.webkitTransform=t,e.style.MozTransform=t,e.style.msTransform=t,e.style.OTransform=t,e.style.transform=t}function F(e){var t=e.querySelector(".gslide-media"),i=e.querySelector(".gslide-description");y(t,"greset"),B(t,"translate3d(0, 0, 0)");p(l,{onElement:t,once:!0,withCallback:function(e,i){m(t,"greset")}});t.style.opacity="",i&&(i.style.opacity="")}var M=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.settings=h(u,t||{}),this.effectsClasses=this.getAnimationClasses()}return t(e,[{key:"init",value:function(){var e=this;this.baseEvents=p("click",{onElement:"."+this.settings.selector,withCallback:function(t,i){t.preventDefault(),e.open(i)}})}},{key:"open",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(this.elements=this.getElements(e),0==this.elements.length)return!1;this.activeSlide=null,this.prevActiveSlideIndex=null,this.prevActiveSlide=null;var t=this.settings.startAt;e&&(t=this.elements.indexOf(e))<0&&(t=0),this.build(),w(this.overlay,"none"==this.settings.openEffect?"none":this.settings.cssEfects.fade.in);var i=document.body;if(i.style.width=i.offsetWidth+"px",y(i,"glightbox-open"),y(o,"glightbox-open"),n&&(y(o,"glightbox-mobile"),this.settings.slideEffect="slide"),this.showSlide(t,!0),1==this.elements.length?(E(this.prevButton),E(this.nextButton)):(k(this.prevButton),k(this.nextButton)),this.lightboxOpen=!0,v.isFunction(this.settings.onOpen)&&this.settings.onOpen(),n&&s&&this.settings.touchNavigation)return I.apply(this),!1;this.settings.keyboardNavigation&&function(){var e=this;if(this.events.hasOwnProperty("keyboard"))return!1;this.events.keyboard=p("keydown",{onElement:window,withCallback:function(t,i){var n=(t=t||window.event).keyCode;39==n&&e.nextSlide(),37==n&&e.prevSlide(),27==n&&e.close()}})}.apply(this)}},{key:"showSlide",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];k(this.loader),this.index=t;var n=this.slidesContainer.querySelector(".current");n&&m(n,"current"),this.slideAnimateOut();var s=this.slidesContainer.querySelectorAll(".gslide")[t];if(k(this.slidesContainer),b(s,"loaded"))this.slideAnimateIn(s,i),E(this.loader);else{k(this.loader);var o=C(this.elements[t],this.settings);o.index=t,A.apply(this,[s,o,function(){E(e.loader),e.slideAnimateIn(s,i)}])}this.preloadSlide(t+1),this.preloadSlide(t-1),m(this.nextButton,"disabled"),m(this.prevButton,"disabled"),0===t?y(this.prevButton,"disabled"):t===this.elements.length-1&&!0!==this.settings.loopAtEnd&&y(this.nextButton,"disabled"),this.activeSlide=s}},{key:"preloadSlide",value:function(e){var t=this;if(e<0||e>this.elements.length)return!1;if(v.isNil(this.elements[e]))return!1;var i=this.slidesContainer.querySelectorAll(".gslide")[e];if(b(i,"loaded"))return!1;var n=C(this.elements[e],this.settings);n.index=e;var s=n.sourcetype;"video"==s||"external"==s?setTimeout(function(){A.apply(t,[i,n])},200):A.apply(this,[i,n])}},{key:"prevSlide",value:function(){var e=this.index-1;if(e<0)return!1;this.goToSlide(e)}},{key:"nextSlide",value:function(){var e=this.index+1;if(e>this.elements.length)return!1;this.goToSlide(e)}},{key:"goToSlide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e>-1&&(this.prevActiveSlide=this.activeSlide,this.prevActiveSlideIndex=this.index,e<this.elements.length?this.showSlide(e):!0===this.settings.loopAtEnd&&(e=0,this.showSlide(e)))}},{key:"slideAnimateIn",value:function(e,t){var i=this,s=e.querySelector(".gslide-media"),o=e.querySelector(".gslide-description"),l={index:this.prevActiveSlideIndex,slide:this.prevActiveSlide},r={index:this.index,slide:this.activeSlide};if(s.offsetWidth>0&&o&&(E(o),e.querySelector(".ginner-container").style.maxWidth=s.offsetWidth+"px",o.style.display=""),m(e,this.effectsClasses),t)w(e,this.settings.openEffect,function(){!n&&i.settings.autoplayVideos&&i.playSlideVideo(e),v.isFunction(i.settings.afterSlideChange)&&i.settings.afterSlideChange.apply(i,[l,r])});else{var a=this.settings.slideEffect,d="none"!==a?this.settings.cssEfects[a].in:a;this.prevActiveSlideIndex>this.index&&"slide"==this.settings.slideEffect&&(d=this.settings.cssEfects.slide_back.in),w(e,d,function(){!n&&i.settings.autoplayVideos&&i.playSlideVideo(e),v.isFunction(i.settings.afterSlideChange)&&i.settings.afterSlideChange.apply(i,[l,r])})}y(e,"current")}},{key:"slideAnimateOut",value:function(){if(!this.prevActiveSlide)return!1;var e=this.prevActiveSlide;m(e,this.effectsClasses),y(e,"prev");var t=this.settings.slideEffect,i="none"!==t?this.settings.cssEfects[t].out:t;this.stopSlideVideo(e),v.isFunction(this.settings.beforeSlideChange)&&this.settings.beforeSlideChange.apply(this,[{index:this.prevActiveSlideIndex,slide:this.prevActiveSlide},{index:this.index,slide:this.activeSlide}]),this.prevActiveSlideIndex>this.index&&"slide"==this.settings.slideEffect&&(i=this.settings.cssEfects.slide_back.out),w(e,i,function(){var t=e.querySelector(".gslide-media"),i=e.querySelector(".gslide-description");t.style.transform="",m(t,"greset"),t.style.opacity="",i&&(i.style.opacity=""),m(e,"prev")})}},{key:"stopSlideVideo",value:function(e){v.isNumber(e)&&(e=this.slidesContainer.querySelectorAll(".gslide")[e]);var t=e?e.querySelector(".gvideo"):null;if(!t)return!1;var i=t.id;if(c&&c.hasOwnProperty(i)){var n=c[i];b(t,"vimeo-video")&&n.pause(),b(t,"youtube-video")&&n.pauseVideo(),b(t,"jw-video")&&n.pause(!0),b(t,"html5-video")&&n.pause()}}},{key:"playSlideVideo",value:function(e){v.isNumber(e)&&(e=this.slidesContainer.querySelectorAll(".gslide")[e]);var t=e.querySelector(".gvideo");if(!t)return!1;var i=t.id;return c&&(v.has(c,i)||b(t,"wait-autoplay"))?(q(function(){return b(t,"iframe-ready")&&v.has(c,i)},function(){var e=c[i];b(t,"vimeo-video")&&q(function(){return e.play},function(){e.play()}),b(t,"youtube-video")&&q(function(){return e.playVideo},function(){e.playVideo()}),b(t,"jw-video")&&q(function(){return e.play},function(){e.play()}),b(t,"html5-video")&&e.play(),setTimeout(function(){m(t,"wait-autoplay")},300)},50,4e3),!1):void 0}},{key:"setElements",value:function(e){this.settings.elements=e}},{key:"getElements",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(this.elements=[],!v.isNil(this.settings.elements)&&v.isArray(this.settings.elements))return this.settings.elements;var t=!1;if(null!==e){var i=e.getAttribute("data-gallery");i&&""!==i&&(t=document.querySelectorAll('[data-gallery="'+i+'"]'))}return 0==t&&(t=document.querySelectorAll("."+this.settings.selector)),t=Array.prototype.slice.call(t)}},{key:"getActiveSlide",value:function(){return this.slidesContainer.querySelectorAll(".gslide")[this.index]}},{key:"getActiveSlideIndex",value:function(){return this.index}},{key:"getAnimationClasses",value:function(){var e=[];for(var t in this.settings.cssEfects)if(this.settings.cssEfects.hasOwnProperty(t)){var i=this.settings.cssEfects[t];e.push("g"+i.in),e.push("g"+i.out)}return e.join(" ")}},{key:"build",value:function(){var e=this;if(this.built)return!1;var t=S(this.settings.lightboxHtml);document.body.appendChild(t);var i=document.getElementById("glightbox-body");this.modal=i;var n=i.querySelector(".gclose");this.prevButton=i.querySelector(".gprev"),this.nextButton=i.querySelector(".gnext"),this.overlay=i.querySelector(".goverlay"),this.loader=i.querySelector(".gloader"),this.slidesContainer=document.getElementById("glightbox-slider"),this.events={},y(this.modal,"glightbox-"+this.settings.skin),this.settings.closeButton&&n&&(this.events.close=p("click",{onElement:n,withCallback:function(t,i){t.preventDefault(),e.close()}})),n&&!this.settings.closeButton&&n.parentNode.removeChild(n),this.nextButton&&(this.events.next=p("click",{onElement:this.nextButton,withCallback:function(t,i){t.preventDefault(),e.nextSlide()}})),this.prevButton&&(this.events.prev=p("click",{onElement:this.prevButton,withCallback:function(t,i){t.preventDefault(),e.prevSlide()}})),this.settings.closeOnOutsideClick&&(this.events.outClose=p("click",{onElement:i,withCallback:function(t,i){x(t.target,".ginner-container")||b(t.target,"gnext")||b(t.target,"gprev")||e.close()}})),f(this.elements,function(){var t=S(e.settings.slideHtml);e.slidesContainer.appendChild(t)}),s&&y(o,"glightbox-touch"),this.built=!0}},{key:"reload",value:function(){this.init()}},{key:"close",value:function(){var e=this;if(this.closing)return!1;this.closing=!0,this.stopSlideVideo(this.activeSlide),y(this.modal,"glightbox-closing"),w(this.overlay,"none"==this.settings.openEffect?"none":this.settings.cssEfects.fade.out),w(this.activeSlide,this.settings.closeEffect,function(){if(e.activeSlide=null,e.prevActiveSlideIndex=null,e.prevActiveSlide=null,e.built=!1,e.events)for(var t in e.events)e.events.hasOwnProperty(t)&&e.events[t].destroy();var i=document.body;m(i,"glightbox-open"),m(o,"glightbox-open"),m(i,"touching"),m(i,"gdesc-open"),i.style.width="",e.modal.parentNode.removeChild(e.modal),v.isFunction(e.settings.onClose)&&e.settings.onClose(),e.closing=null})}},{key:"destroy",value:function(){this.close(),this.baseEvents.destroy()}}]),e}();e.exports=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=new M(e);return t.init(),t}});