File: /mnt/data/smarthr-co-in/demo/angular/template_bk/chunk-VCEBA7JU.js
var I=function(){return I=Object.assign||function(e){for(var t,o=1,i=arguments.length;o<i;o++){t=arguments[o];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},I.apply(this,arguments)},G={scale:1,zoom:!0,infiniteZoom:!0,actualSize:!0,showZoomInOutIcons:!1,actualSizeIcons:{zoomIn:"lg-zoom-in",zoomOut:"lg-zoom-out"},enableZoomAfter:300,zoomPluginStrings:{zoomIn:"Zoom in",zoomOut:"Zoom out",viewActualSize:"View actual size"}},v={afterAppendSlide:"lgAfterAppendSlide",init:"lgInit",hasVideo:"lgHasVideo",containerResize:"lgContainerResize",updateSlides:"lgUpdateSlides",afterAppendSubHtml:"lgAfterAppendSubHtml",beforeOpen:"lgBeforeOpen",afterOpen:"lgAfterOpen",slideItemLoad:"lgSlideItemLoad",beforeSlide:"lgBeforeSlide",afterSlide:"lgAfterSlide",posterClick:"lgPosterClick",dragStart:"lgDragStart",dragMove:"lgDragMove",dragEnd:"lgDragEnd",beforeNextSlide:"lgBeforeNextSlide",beforePrevSlide:"lgBeforePrevSlide",beforeClose:"lgBeforeClose",afterClose:"lgAfterClose",rotateLeft:"lgRotateLeft",rotateRight:"lgRotateRight",flipHorizontal:"lgFlipHorizontal",flipVertical:"lgFlipVertical",autoplay:"lgAutoplay",autoplayStart:"lgAutoplayStart",autoplayStop:"lgAutoplayStop"},z=500,X=(function(){function a(e,t){return this.core=e,this.$LG=t,this.settings=I(I({},G),this.core.settings),this}return a.prototype.buildTemplates=function(){var e=this.settings.showZoomInOutIcons?'<button id="'+this.core.getIdName("lg-zoom-in")+'" type="button" aria-label="'+this.settings.zoomPluginStrings.zoomIn+'" class="lg-zoom-in lg-icon"></button><button id="'+this.core.getIdName("lg-zoom-out")+'" type="button" aria-label="'+this.settings.zoomPluginStrings.zoomOut+'" class="lg-zoom-out lg-icon"></button>':"";this.settings.actualSize&&(e+='<button id="'+this.core.getIdName("lg-actual-size")+'" type="button" aria-label="'+this.settings.zoomPluginStrings.viewActualSize+'" class="'+this.settings.actualSizeIcons.zoomIn+' lg-icon"></button>'),this.core.outer.addClass("lg-use-transition-for-zoom"),this.core.$toolbar.first().append(e)},a.prototype.enableZoom=function(e){var t=this,o=this.settings.enableZoomAfter+e.detail.delay;this.$LG("body").first().hasClass("lg-from-hash")&&e.detail.delay?o=0:this.$LG("body").first().removeClass("lg-from-hash"),this.zoomableTimeout=setTimeout(function(){t.isImageSlide(t.core.index)&&(t.core.getSlideItem(e.detail.index).addClass("lg-zoomable"),e.detail.index===t.core.index&&t.setZoomEssentials())},o+30)},a.prototype.enableZoomOnSlideItemLoad=function(){this.core.LGel.on(v.slideItemLoad+".zoom",this.enableZoom.bind(this))},a.prototype.getDragCords=function(e){return{x:e.pageX,y:e.pageY}},a.prototype.getSwipeCords=function(e){var t=e.touches[0].pageX,o=e.touches[0].pageY;return{x:t,y:o}},a.prototype.getDragAllowedAxises=function(e,t){if(!this.containerRect)return{allowX:!1,allowY:!1};var o=this.core.getSlideItem(this.core.index).find(".lg-image").first().get(),i=0,r=0,s=o.getBoundingClientRect();e?(i=o.offsetHeight*e,r=o.offsetWidth*e):t?(i=s.height+t*s.height,r=s.width+t*s.width):(i=s.height,r=s.width);var l=i>this.containerRect.height,g=r>this.containerRect.width;return{allowX:g,allowY:l}},a.prototype.setZoomEssentials=function(){this.containerRect=this.core.$content.get().getBoundingClientRect()},a.prototype.zoomImage=function(e,t,o,i){if(!(!this.containerRect||Math.abs(t)<=0)){var r=this.containerRect.width/2+this.containerRect.left,s=this.containerRect.height/2+this.containerRect.top+this.scrollTop,l,g;e===1&&(this.positionChanged=!1);var d=this.getDragAllowedAxises(0,t),m=d.allowY,c=d.allowX;this.positionChanged&&(l=this.left/(this.scale-t),g=this.top/(this.scale-t),this.pageX=r-l,this.pageY=s-g,this.positionChanged=!1);var n=this.getPossibleSwipeDragCords(t),u,h,y=r-this.pageX,p=s-this.pageY;if(e-t>1){var f=(e-t)/Math.abs(t);y=(t<0?-y:y)+this.left*(f+(t<0?-1:1)),p=(t<0?-p:p)+this.top*(f+(t<0?-1:1)),u=y/f,h=p/f}else{var f=(e-t)*t;u=y*f,h=p*f}o&&(c?this.isBeyondPossibleLeft(u,n.minX)?u=n.minX:this.isBeyondPossibleRight(u,n.maxX)&&(u=n.maxX):e>1&&(u<n.minX?u=n.minX:u>n.maxX&&(u=n.maxX)),m?this.isBeyondPossibleTop(h,n.minY)?h=n.minY:this.isBeyondPossibleBottom(h,n.maxY)&&(h=n.maxY):e>1&&(h<n.minY?h=n.minY:h>n.maxY&&(h=n.maxY))),this.setZoomStyles({x:u,y:h,scale:e}),this.left=u,this.top=h,i&&this.setZoomImageSize()}},a.prototype.resetImageTranslate=function(e){if(this.isImageSlide(e)){var t=this.core.getSlideItem(e).find(".lg-image").first();this.imageReset=!1,t.removeClass("reset-transition reset-transition-y reset-transition-x"),this.core.outer.removeClass("lg-actual-size"),t.css("width","auto").css("height","auto"),setTimeout(function(){t.removeClass("no-transition")},10)}},a.prototype.setZoomImageSize=function(){var e=this,t=this.core.getSlideItem(this.core.index).find(".lg-image").first();setTimeout(function(){var o=e.getCurrentImageActualSizeScale();e.scale>=o&&(t.addClass("no-transition"),e.imageReset=!0)},z),setTimeout(function(){var o=e.getCurrentImageActualSizeScale();if(e.scale>=o){var i=e.getDragAllowedAxises(e.scale);t.css("width",t.get().naturalWidth+"px").css("height",t.get().naturalHeight+"px"),e.core.outer.addClass("lg-actual-size"),i.allowX&&i.allowY?t.addClass("reset-transition"):i.allowX&&!i.allowY?t.addClass("reset-transition-x"):!i.allowX&&i.allowY&&t.addClass("reset-transition-y")}},z+50)},a.prototype.setZoomStyles=function(e){var t=this.core.getSlideItem(this.core.index).find(".lg-img-wrap").first(),o=this.core.getSlideItem(this.core.index).find(".lg-image").first(),i=this.core.outer.find(".lg-current .lg-dummy-img").first();this.scale=e.scale,o.css("transform","scale3d("+e.scale+", "+e.scale+", 1)"),i.css("transform","scale3d("+e.scale+", "+e.scale+", 1)");var r="translate3d("+e.x+"px, "+e.y+"px, 0)";t.css("transform",r)},a.prototype.setActualSize=function(e,t){var o=this;if(!this.zoomInProgress){this.zoomInProgress=!0;var i=this.core.galleryItems[this.core.index];this.resetImageTranslate(e),setTimeout(function(){if(!(!i.src||o.core.outer.hasClass("lg-first-slide-loading"))){var r=o.getCurrentImageActualSizeScale(),s=o.scale;o.core.outer.hasClass("lg-zoomed")?o.scale=1:o.scale=o.getScale(r),o.setPageCords(t),o.beginZoom(o.scale),o.zoomImage(o.scale,o.scale-s,!0,!0)}},50),setTimeout(function(){o.core.outer.removeClass("lg-grabbing").addClass("lg-grab")},60),setTimeout(function(){o.zoomInProgress=!1},z+110)}},a.prototype.getNaturalWidth=function(e){var t=this.core.getSlideItem(e).find(".lg-image").first(),o=this.core.galleryItems[e].width;return o?parseFloat(o):t.get().naturalWidth},a.prototype.getActualSizeScale=function(e,t){var o,i;return e>=t?(o=e/t,i=o||2):i=1,i},a.prototype.getCurrentImageActualSizeScale=function(){var e=this.core.getSlideItem(this.core.index).find(".lg-image").first(),t=e.get().offsetWidth,o=this.getNaturalWidth(this.core.index)||t;return this.getActualSizeScale(o,t)},a.prototype.getPageCords=function(e){var t={};if(e)t.x=e.pageX||e.touches[0].pageX,t.y=e.pageY||e.touches[0].pageY;else{var o=this.core.$content.get().getBoundingClientRect();t.x=o.width/2+o.left,t.y=o.height/2+this.scrollTop+o.top}return t},a.prototype.setPageCords=function(e){var t=this.getPageCords(e);this.pageX=t.x,this.pageY=t.y},a.prototype.manageActualPixelClassNames=function(){var e=this.core.getElementById("lg-actual-size");e.removeClass(this.settings.actualSizeIcons.zoomIn).addClass(this.settings.actualSizeIcons.zoomOut)},a.prototype.beginZoom=function(e){return this.core.outer.removeClass("lg-zoom-drag-transition lg-zoom-dragging"),e>1?(this.core.outer.addClass("lg-zoomed"),this.manageActualPixelClassNames()):this.resetZoom(),e>1},a.prototype.getScale=function(e){var t=this.getCurrentImageActualSizeScale();return e<1?e=1:e>t&&(e=t),e},a.prototype.init=function(){var e=this;if(this.settings.zoom){this.buildTemplates(),this.enableZoomOnSlideItemLoad();var t=null;this.core.outer.on("dblclick.lg",function(o){e.$LG(o.target).hasClass("lg-image")&&e.setActualSize(e.core.index,o)}),this.core.outer.on("touchstart.lg",function(o){var i=e.$LG(o.target);o.touches.length===1&&i.hasClass("lg-image")&&(t?(clearTimeout(t),t=null,o.preventDefault(),e.setActualSize(e.core.index,o)):t=setTimeout(function(){t=null},300))}),this.core.LGel.on(v.containerResize+".zoom "+v.rotateRight+".zoom "+v.rotateLeft+".zoom "+v.flipHorizontal+".zoom "+v.flipVertical+".zoom",function(){if(!(!e.core.lgOpened||!e.isImageSlide(e.core.index)||e.core.touchAction)){var o=e.core.getSlideItem(e.core.index).find(".lg-img-wrap").first();e.top=0,e.left=0,e.setZoomEssentials(),e.setZoomSwipeStyles(o,{x:0,y:0}),e.positionChanged=!0}}),this.$LG(window).on("scroll.lg.zoom.global"+this.core.lgId,function(){e.core.lgOpened&&(e.scrollTop=e.$LG(window).scrollTop())}),this.core.getElementById("lg-zoom-out").on("click.lg",function(){if(e.isImageSlide(e.core.index)){var o=0;e.imageReset&&(e.resetImageTranslate(e.core.index),o=50),setTimeout(function(){var i=e.scale-e.settings.scale;i<1&&(i=1),e.beginZoom(i),e.zoomImage(i,-e.settings.scale,!0,!e.settings.infiniteZoom)},o)}}),this.core.getElementById("lg-zoom-in").on("click.lg",function(){e.zoomIn()}),this.core.getElementById("lg-actual-size").on("click.lg",function(){e.setActualSize(e.core.index)}),this.core.LGel.on(v.beforeOpen+".zoom",function(){e.core.outer.find(".lg-item").removeClass("lg-zoomable")}),this.core.LGel.on(v.afterOpen+".zoom",function(){e.scrollTop=e.$LG(window).scrollTop(),e.pageX=e.core.outer.width()/2,e.pageY=e.core.outer.height()/2+e.scrollTop,e.scale=1}),this.core.LGel.on(v.afterSlide+".zoom",function(o){var i=o.detail.prevIndex;e.scale=1,e.positionChanged=!1,e.zoomInProgress=!1,e.resetZoom(i),e.resetImageTranslate(i),e.isImageSlide(e.core.index)&&e.setZoomEssentials()}),this.zoomDrag(),this.pinchZoom(),this.zoomSwipe(),this.zoomableTimeout=!1,this.positionChanged=!1,this.zoomInProgress=!1}},a.prototype.zoomIn=function(){if(this.isImageSlide(this.core.index)){var e=this.scale+this.settings.scale;this.settings.infiniteZoom||(e=this.getScale(e)),this.beginZoom(e),this.zoomImage(e,Math.min(this.settings.scale,e-this.scale),!0,!this.settings.infiniteZoom)}},a.prototype.resetZoom=function(e){this.core.outer.removeClass("lg-zoomed lg-zoom-drag-transition");var t=this.core.getElementById("lg-actual-size"),o=this.core.getSlideItem(e!==void 0?e:this.core.index);t.removeClass(this.settings.actualSizeIcons.zoomOut).addClass(this.settings.actualSizeIcons.zoomIn),o.find(".lg-img-wrap").first().removeAttr("style"),o.find(".lg-image").first().removeAttr("style"),this.scale=1,this.left=0,this.top=0,this.setPageCords()},a.prototype.getTouchDistance=function(e){return Math.sqrt((e.touches[0].pageX-e.touches[1].pageX)*(e.touches[0].pageX-e.touches[1].pageX)+(e.touches[0].pageY-e.touches[1].pageY)*(e.touches[0].pageY-e.touches[1].pageY))},a.prototype.pinchZoom=function(){var e=this,t=0,o=!1,i=1,r=0,s=this.core.getSlideItem(this.core.index);this.core.outer.on("touchstart.lg",function(l){if(s=e.core.getSlideItem(e.core.index),!!e.isImageSlide(e.core.index)&&l.touches.length===2){if(l.preventDefault(),e.core.outer.hasClass("lg-first-slide-loading"))return;i=e.scale||1,e.core.outer.removeClass("lg-zoom-drag-transition lg-zoom-dragging"),e.setPageCords(l),e.resetImageTranslate(e.core.index),e.core.touchAction="pinch",t=e.getTouchDistance(l)}}),this.core.$inner.on("touchmove.lg",function(l){if(l.touches.length===2&&e.core.touchAction==="pinch"&&(e.$LG(l.target).hasClass("lg-item")||s.get().contains(l.target))){l.preventDefault();var g=e.getTouchDistance(l),d=t-g;if(!o&&Math.abs(d)>5&&(o=!0),o){r=e.scale;var m=Math.max(1,i+-d*.02);e.scale=Math.round((m+Number.EPSILON)*100)/100;var c=e.scale-r;e.zoomImage(e.scale,Math.round((c+Number.EPSILON)*100)/100,!1,!1)}}}),this.core.$inner.on("touchend.lg",function(l){if(e.core.touchAction==="pinch"&&(e.$LG(l.target).hasClass("lg-item")||s.get().contains(l.target))){if(o=!1,t=0,e.scale<=1)e.resetZoom();else{var g=e.getCurrentImageActualSizeScale();if(e.scale>=g){var d=g-e.scale;d===0&&(d=.01),e.zoomImage(g,d,!1,!0)}e.manageActualPixelClassNames(),e.core.outer.addClass("lg-zoomed")}e.core.touchAction=void 0}})},a.prototype.touchendZoom=function(e,t,o,i,r){var s=t.x-e.x,l=t.y-e.y,g=Math.abs(s)/r+1,d=Math.abs(l)/r+1;g>2&&(g+=1),d>2&&(d+=1),s=s*g,l=l*d;var m=this.core.getSlideItem(this.core.index).find(".lg-img-wrap").first(),c={};c.x=this.left+s,c.y=this.top+l;var n=this.getPossibleSwipeDragCords();(Math.abs(s)>15||Math.abs(l)>15)&&(i&&(this.isBeyondPossibleTop(c.y,n.minY)?c.y=n.minY:this.isBeyondPossibleBottom(c.y,n.maxY)&&(c.y=n.maxY)),o&&(this.isBeyondPossibleLeft(c.x,n.minX)?c.x=n.minX:this.isBeyondPossibleRight(c.x,n.maxX)&&(c.x=n.maxX)),i?this.top=c.y:c.y=this.top,o?this.left=c.x:c.x=this.left,this.setZoomSwipeStyles(m,c),this.positionChanged=!0)},a.prototype.getZoomSwipeCords=function(e,t,o,i,r){var s={};if(i){if(s.y=this.top+(t.y-e.y),this.isBeyondPossibleTop(s.y,r.minY)){var l=r.minY-s.y;s.y=r.minY-l/6}else if(this.isBeyondPossibleBottom(s.y,r.maxY)){var g=s.y-r.maxY;s.y=r.maxY+g/6}}else s.y=this.top;if(o){if(s.x=this.left+(t.x-e.x),this.isBeyondPossibleLeft(s.x,r.minX)){var d=r.minX-s.x;s.x=r.minX-d/6}else if(this.isBeyondPossibleRight(s.x,r.maxX)){var m=s.x-r.maxX;s.x=r.maxX+m/6}}else s.x=this.left;return s},a.prototype.isBeyondPossibleLeft=function(e,t){return e>=t},a.prototype.isBeyondPossibleRight=function(e,t){return e<=t},a.prototype.isBeyondPossibleTop=function(e,t){return e>=t},a.prototype.isBeyondPossibleBottom=function(e,t){return e<=t},a.prototype.isImageSlide=function(e){var t=this.core.galleryItems[e];return this.core.getSlideType(t)==="image"},a.prototype.getPossibleSwipeDragCords=function(e){var t=this.core.getSlideItem(this.core.index).find(".lg-image").first(),o=this.core.mediaContainerPosition.bottom,i=t.get().getBoundingClientRect(),r=i.height,s=i.width;e&&(r=r+e*r,s=s+e*s);var l=(r-this.containerRect.height)/2,g=(this.containerRect.height-r)/2+o,d=(s-this.containerRect.width)/2,m=(this.containerRect.width-s)/2,c={minY:l,maxY:g,minX:d,maxX:m};return c},a.prototype.setZoomSwipeStyles=function(e,t){e.css("transform","translate3d("+t.x+"px, "+t.y+"px, 0)")},a.prototype.zoomSwipe=function(){var e=this,t={},o={},i=!1,r=!1,s=!1,l=new Date,g=new Date,d,m,c=this.core.getSlideItem(this.core.index);this.core.$inner.on("touchstart.lg",function(n){if(e.isImageSlide(e.core.index)&&(c=e.core.getSlideItem(e.core.index),(e.$LG(n.target).hasClass("lg-item")||c.get().contains(n.target))&&n.touches.length===1&&e.core.outer.hasClass("lg-zoomed"))){n.preventDefault(),l=new Date,e.core.touchAction="zoomSwipe",m=e.core.getSlideItem(e.core.index).find(".lg-img-wrap").first();var u=e.getDragAllowedAxises(0);s=u.allowY,r=u.allowX,(r||s)&&(t=e.getSwipeCords(n)),d=e.getPossibleSwipeDragCords(),e.core.outer.addClass("lg-zoom-dragging lg-zoom-drag-transition")}}),this.core.$inner.on("touchmove.lg",function(n){if(n.touches.length===1&&e.core.touchAction==="zoomSwipe"&&(e.$LG(n.target).hasClass("lg-item")||c.get().contains(n.target))){n.preventDefault(),e.core.touchAction="zoomSwipe",o=e.getSwipeCords(n);var u=e.getZoomSwipeCords(t,o,r,s,d);(Math.abs(o.x-t.x)>15||Math.abs(o.y-t.y)>15)&&(i=!0,e.setZoomSwipeStyles(m,u))}}),this.core.$inner.on("touchend.lg",function(n){if(e.core.touchAction==="zoomSwipe"&&(e.$LG(n.target).hasClass("lg-item")||c.get().contains(n.target))){if(n.preventDefault(),e.core.touchAction=void 0,e.core.outer.removeClass("lg-zoom-dragging"),!i)return;i=!1,g=new Date;var u=g.valueOf()-l.valueOf();e.touchendZoom(t,o,r,s,u)}})},a.prototype.zoomDrag=function(){var e=this,t={},o={},i=!1,r=!1,s=!1,l=!1,g,d,m,c;this.core.outer.on("mousedown.lg.zoom",function(n){if(e.isImageSlide(e.core.index)){var u=e.core.getSlideItem(e.core.index);if(e.$LG(n.target).hasClass("lg-item")||u.get().contains(n.target)){g=new Date,c=e.core.getSlideItem(e.core.index).find(".lg-img-wrap").first();var h=e.getDragAllowedAxises(0);l=h.allowY,s=h.allowX,e.core.outer.hasClass("lg-zoomed")&&e.$LG(n.target).hasClass("lg-object")&&(s||l)&&(n.preventDefault(),t=e.getDragCords(n),m=e.getPossibleSwipeDragCords(),i=!0,e.core.outer.removeClass("lg-grab").addClass("lg-grabbing lg-zoom-drag-transition lg-zoom-dragging"))}}}),this.$LG(window).on("mousemove.lg.zoom.global"+this.core.lgId,function(n){if(i){r=!0,o=e.getDragCords(n);var u=e.getZoomSwipeCords(t,o,s,l,m);e.setZoomSwipeStyles(c,u)}}),this.$LG(window).on("mouseup.lg.zoom.global"+this.core.lgId,function(n){if(i){if(d=new Date,i=!1,e.core.outer.removeClass("lg-zoom-dragging"),r&&(t.x!==o.x||t.y!==o.y)){o=e.getDragCords(n);var u=d.valueOf()-g.valueOf();e.touchendZoom(t,o,s,l,u)}r=!1}e.core.outer.removeClass("lg-grabbing").addClass("lg-grab")})},a.prototype.closeGallery=function(){this.resetZoom(),this.zoomInProgress=!1},a.prototype.destroy=function(){this.$LG(window).off(".lg.zoom.global"+this.core.lgId),this.core.LGel.off(".lg.zoom"),this.core.LGel.off(".zoom"),clearTimeout(this.zoomableTimeout),this.zoomableTimeout=!1},a})(),k=X;var S=function(){return S=Object.assign||function(e){for(var t,o=1,i=arguments.length;o<i;o++){t=arguments[o];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},S.apply(this,arguments)},Z={autoplayFirstVideo:!0,youTubePlayerParams:!1,vimeoPlayerParams:!1,wistiaPlayerParams:!1,gotoNextSlideOnVideoEnd:!0,autoplayVideoOnSlide:!1,videojs:!1,videojsTheme:"",videojsOptions:{}},b={afterAppendSlide:"lgAfterAppendSlide",init:"lgInit",hasVideo:"lgHasVideo",containerResize:"lgContainerResize",updateSlides:"lgUpdateSlides",afterAppendSubHtml:"lgAfterAppendSubHtml",beforeOpen:"lgBeforeOpen",afterOpen:"lgAfterOpen",slideItemLoad:"lgSlideItemLoad",beforeSlide:"lgBeforeSlide",afterSlide:"lgAfterSlide",posterClick:"lgPosterClick",dragStart:"lgDragStart",dragMove:"lgDragMove",dragEnd:"lgDragEnd",beforeNextSlide:"lgBeforeNextSlide",beforePrevSlide:"lgBeforePrevSlide",beforeClose:"lgBeforeClose",afterClose:"lgAfterClose",rotateLeft:"lgRotateLeft",rotateRight:"lgRotateRight",flipHorizontal:"lgFlipHorizontal",flipVertical:"lgFlipVertical",autoplay:"lgAutoplay",autoplayStart:"lgAutoplayStart",autoplayStop:"lgAutoplayStop"},x=function(a){return Object.keys(a).map(function(e){return encodeURIComponent(e)+"="+encodeURIComponent(a[e])}).join("&")},_=function(a){var e=a.slice(1).split("&").map(function(t){return t.split("=")}).reduce(function(t,o){var i=o.map(decodeURIComponent),r=i[0],s=i[1];return t[r]=s,t},{});return e},R=function(a,e){if(!a.youtube)return"";var t=a.youtube[2]?_(a.youtube[2]):"",o={wmode:"opaque",autoplay:0,mute:1,enablejsapi:1},i=e||{},r=S(S(S({},o),i),t),s="?"+x(r);return s},B=function(a){return a.includes("youtube-nocookie.com")},j=function(a,e){if(!e||!e.vimeo)return"";var t=e.vimeo[2]||"",o=Object.assign({},{autoplay:0,muted:1},a),i=o&&Object.keys(o).length!==0?x(o):"",r=e.vimeo[0].split("/").pop()||"",s=r.split("?")[0]||"",l=s.split("#")[0],g=e.vimeo[1]!==l;g&&(t=t.replace("/"+l,"")),t=t[0]=="?"?"&"+t.slice(1):t||"";var d=g?"h="+l:"";i=d?"&"+i:i;var m="?"+d+i+t;return m},$=(function(){function a(e){return this.core=e,this.settings=S(S({},Z),this.core.settings),this}return a.prototype.init=function(){var e=this;this.core.LGel.on(b.hasVideo+".video",this.onHasVideo.bind(this)),this.core.LGel.on(b.posterClick+".video",function(){var t=e.core.getSlideItem(e.core.index);e.loadVideoOnPosterClick(t)}),this.core.LGel.on(b.slideItemLoad+".video",this.onSlideItemLoad.bind(this)),this.core.LGel.on(b.beforeSlide+".video",this.onBeforeSlide.bind(this)),this.core.LGel.on(b.afterSlide+".video",this.onAfterSlide.bind(this))},a.prototype.onSlideItemLoad=function(e){var t=this,o=e.detail,i=o.isFirstSlide,r=o.index;this.settings.autoplayFirstVideo&&i&&r===this.core.index&&setTimeout(function(){t.loadAndPlayVideo(r)},200),!i&&this.settings.autoplayVideoOnSlide&&r===this.core.index&&this.loadAndPlayVideo(r)},a.prototype.onHasVideo=function(e){var t=e.detail,o=t.index,i=t.src,r=t.html5Video,s=t.hasPoster;s||(this.appendVideos(this.core.getSlideItem(o),{src:i,addClass:"lg-object",index:o,html5Video:r}),this.gotoNextSlideOnVideoEnd(i,o))},a.prototype.onBeforeSlide=function(e){if(this.core.lGalleryOn){var t=e.detail.prevIndex;this.pauseVideo(t)}},a.prototype.onAfterSlide=function(e){var t=this,o=e.detail,i=o.index,r=o.prevIndex,s=this.core.getSlideItem(i);this.settings.autoplayVideoOnSlide&&i!==r&&s.hasClass("lg-complete")&&setTimeout(function(){t.loadAndPlayVideo(i)},100)},a.prototype.loadAndPlayVideo=function(e){var t=this.core.getSlideItem(e),o=this.core.galleryItems[e];o.poster?this.loadVideoOnPosterClick(t,!0):this.playVideo(e)},a.prototype.playVideo=function(e){this.controlVideo(e,"play")},a.prototype.pauseVideo=function(e){this.controlVideo(e,"pause")},a.prototype.getVideoHtml=function(e,t,o,i){var r="",s=this.core.galleryItems[o].__slideVideoInfo||{},l=this.core.galleryItems[o],g=l.title||l.alt;g=g?'title="'+g+'"':"";var d=`allowtransparency="true"
frameborder="0"
scrolling="no"
allowfullscreen
mozallowfullscreen
webkitallowfullscreen
oallowfullscreen
msallowfullscreen`;if(s.youtube){var m="lg-youtube"+o,c=R(s,this.settings.youTubePlayerParams),n=B(e),u=n?"//www.youtube-nocookie.com/":"//www.youtube.com/";r='<iframe allow="autoplay" id='+m+' class="lg-video-object lg-youtube '+t+'" '+g+' src="'+u+"embed/"+(s.youtube[1]+c)+'" '+d+"></iframe>"}else if(s.vimeo){var m="lg-vimeo"+o,h=j(this.settings.vimeoPlayerParams,s);r='<iframe allow="autoplay" id='+m+' class="lg-video-object lg-vimeo '+t+'" '+g+' src="//player.vimeo.com/video/'+(s.vimeo[1]+h)+'" '+d+"></iframe>"}else if(s.wistia){var y="lg-wistia"+o,h=x(this.settings.wistiaPlayerParams);h=h?"?"+h:"",r='<iframe allow="autoplay" id="'+y+'" src="//fast.wistia.net/embed/iframe/'+(s.wistia[4]+h)+'" '+g+' class="wistia_embed lg-video-object lg-wistia '+t+'" name="wistia_embed" '+d+"></iframe>"}else if(s.html5){for(var p="",f=0;f<i.source.length;f++){var C=i.source[f].type,V=C?'type="'+C+'"':"";p+='<source src="'+i.source[f].src+'" '+V+">"}if(i.tracks)for(var Y=function(w){var T="",L=i.tracks[w];Object.keys(L||{}).forEach(function(O){T+=O+'="'+L[O]+'" '}),p+="<track "+T+">"},f=0;f<i.tracks.length;f++)Y(f);var P="",A=i.attributes||{};Object.keys(A||{}).forEach(function(w){P+=w+'="'+A[w]+'" '}),r='<video class="lg-video-object lg-html5 '+(this.settings.videojs&&this.settings.videojsTheme?this.settings.videojsTheme+" ":"")+" "+(this.settings.videojs?" video-js":"")+'" '+P+`>
`+p+`
Your browser does not support HTML5 video.
</video>`}return r},a.prototype.appendVideos=function(e,t){var o,i=this.getVideoHtml(t.src,t.addClass,t.index,t.html5Video);e.find(".lg-video-cont").append(i);var r=e.find(".lg-video-object").first();if(t.html5Video&&r.on("mousedown.lg.video",function(s){s.stopPropagation()}),this.settings.videojs&&(!((o=this.core.galleryItems[t.index].__slideVideoInfo)===null||o===void 0)&&o.html5))try{return videojs(r.get(),this.settings.videojsOptions)}catch{console.error("lightGallery:- Make sure you have included videojs")}},a.prototype.gotoNextSlideOnVideoEnd=function(e,t){var o=this,i=this.core.getSlideItem(t).find(".lg-video-object").first(),r=this.core.galleryItems[t].__slideVideoInfo||{};if(this.settings.gotoNextSlideOnVideoEnd){if(r.html5)i.on("ended",function(){o.core.goToNextSlide()});else if(r.vimeo)try{new Vimeo.Player(i.get()).on("ended",function(){o.core.goToNextSlide()})}catch{console.error("lightGallery:- Make sure you have included //github.com/vimeo/player.js")}else if(r.wistia)try{window._wq=window._wq||[],window._wq.push({id:i.attr("id"),onReady:function(s){s.bind("end",function(){o.core.goToNextSlide()})}})}catch{console.error("lightGallery:- Make sure you have included //fast.wistia.com/assets/external/E-v1.js")}}},a.prototype.controlVideo=function(e,t){var o=this.core.getSlideItem(e).find(".lg-video-object").first(),i=this.core.galleryItems[e].__slideVideoInfo||{};if(o.get()){if(i.youtube)try{o.get().contentWindow.postMessage('{"event":"command","func":"'+t+'Video","args":""}',"*")}catch(r){console.error("lightGallery:- "+r)}else if(i.vimeo)try{new Vimeo.Player(o.get())[t]()}catch{console.error("lightGallery:- Make sure you have included //github.com/vimeo/player.js")}else if(i.html5)if(this.settings.videojs)try{videojs(o.get())[t]()}catch{console.error("lightGallery:- Make sure you have included videojs")}else o.get()[t]();else if(i.wistia)try{window._wq=window._wq||[],window._wq.push({id:o.attr("id"),onReady:function(r){r[t]()}})}catch{console.error("lightGallery:- Make sure you have included //fast.wistia.com/assets/external/E-v1.js")}}},a.prototype.loadVideoOnPosterClick=function(e,t){var o=this;if(e.hasClass("lg-video-loaded"))t&&this.playVideo(this.core.index);else if(e.hasClass("lg-has-video"))this.playVideo(this.core.index);else{e.addClass("lg-has-video");var i=void 0,r=this.core.galleryItems[this.core.index].src,s=this.core.galleryItems[this.core.index].video;s&&(i=typeof s=="string"?JSON.parse(s):s);var l=this.appendVideos(e,{src:r,addClass:"",index:this.core.index,html5Video:i});this.gotoNextSlideOnVideoEnd(r,this.core.index);var g=e.find(".lg-object").first().get();e.find(".lg-video-cont").first().append(g),e.addClass("lg-video-loading"),l&&l.ready(function(){l.on("loadedmetadata",function(){o.onVideoLoadAfterPosterClick(e,o.core.index)})}),e.find(".lg-video-object").first().on("load.lg error.lg loadedmetadata.lg",function(){setTimeout(function(){o.onVideoLoadAfterPosterClick(e,o.core.index)},50)})}},a.prototype.onVideoLoadAfterPosterClick=function(e,t){e.addClass("lg-video-loaded"),this.playVideo(t)},a.prototype.destroy=function(){this.core.LGel.off(".lg.video"),this.core.LGel.off(".video")},a})(),N=$;export{k as a,N as b};