!function(e){"use strict";var t={init:function(){var o=t,i={"jet-woo-product-gallery-grid.default":o.productGalleryGrid,"jet-woo-product-gallery-modern.default":o.productGalleryModern,"jet-woo-product-gallery-anchor-nav.default":o.productGalleryAnchorNav,"jet-woo-product-gallery-slider.default":o.productGallerySlider};e.each(i,function(e,t){window.elementorFrontend.hooks.addAction("frontend/element_ready/"+e,t)}),window.elementorFrontend.elements.$window.on("elementor/nested-tabs/activate",(t,i)=>{o.elementorFrontendInit(e(i))});for(const t of window.jetWooProductGalleryData.product_types)e(".woocommerce div.product").hasClass("product-type-"+t)&&e(document).on("show_variation",function(e,t){o.showVariationImage(t)}).on("reset_image",function(e,t){o.showVariationImage(t)})},initBlocks:function(){JetPlugins.bulkBlocksInit([{block:"jet-gallery/gallery-anchor-nav",callback:t.productGalleryAnchorNav},{block:"jet-gallery/gallery-grid",callback:t.productGalleryGrid},{block:"jet-gallery/gallery-modern",callback:t.productGalleryModern},{block:"jet-gallery/gallery-slider",callback:t.productGallerySlider}])},showVariationImage:function(t){var o=e(document).find(".product").find(".jet-woo-product-gallery");e.each(o,function(){if(e(this).is("[data-variation-images]")){var o=e(this).data("variation-images"),i=e(this).find(".jet-woo-product-gallery-slider"),a=i.data("swiper-settings"),n=null,r=null,l=e(this).children().data("featured-image"),s=e(this).data("gallery-settings").videoFirst?1:0,d=i.find(".jet-woo-product-gallery__image-item").length;a&&a.loop&&d>1?(n=e(this).find('.jet-woo-product-gallery__image-item[data-swiper-slide-index = "'+s+'"]'),r=e(this).find('.jet-woo-swiper-control-thumbs__item[data-swiper-slide-index = "'+s+'"] img')):(n=e(this).find(".jet-woo-product-gallery__image-item").eq(s),r=e(this).find(".jet-woo-swiper-control-thumbs__item").eq(s).find("img"));var c=n.find(".wp-post-image"),p=n.find("a").eq(0);if(l||(c=n.find(".wp-post-gallery")),t&&t.image&&t.image.src&&t.image.src.length>1){var u=o[t.image_id];!function(e,t){c.wc_set_variation_attr("src",t.src),c.wc_set_variation_attr("height",t.src_h),c.wc_set_variation_attr("width",t.src_w),c.wc_set_variation_attr("srcset",t.srcset),c.wc_set_variation_attr("sizes",t.sizes),c.wc_set_variation_attr("title",e.image.title),c.wc_set_variation_attr("data-caption",e.image.caption),c.wc_set_variation_attr("alt",e.image.alt),c.wc_set_variation_attr("data-src",t.src),c.wc_set_variation_attr("data-large_image",t.full_src),c.wc_set_variation_attr("data-large_image_width",t.full_src_w),c.wc_set_variation_attr("data-large_image_height",t.full_src_h),n.wc_set_variation_attr("data-thumb",t.src),p.wc_set_variation_attr("href",e.image.full_src),r.wc_set_variation_attr("src",e.image.thumb_src),r.wc_set_variation_attr("width",e.image.thumb_src_w),r.wc_set_variation_attr("height",e.image.thumb_src_h),r.wc_set_variation_attr("srcset","")}(t,u)}else c.wc_reset_variation_attr("src"),c.wc_reset_variation_attr("width"),c.wc_reset_variation_attr("height"),c.wc_reset_variation_attr("srcset"),c.wc_reset_variation_attr("sizes"),c.wc_reset_variation_attr("title"),c.wc_reset_variation_attr("data-caption"),c.wc_reset_variation_attr("alt"),c.wc_reset_variation_attr("data-src"),c.wc_reset_variation_attr("data-large_image"),c.wc_reset_variation_attr("data-large_image_width"),c.wc_reset_variation_attr("data-large_image_height"),n.wc_reset_variation_attr("data-thumb"),p.wc_reset_variation_attr("href"),r.wc_reset_variation_attr("src"),r.wc_reset_variation_attr("width"),r.wc_reset_variation_attr("height")}}),e(document).trigger("jet-woo-gallery-variation-image-change")},productGallerySlider:function(o){const i=o.find(".jet-woo-product-gallery-slider"),a=i.data("swiper-settings"),n=o.find(".jet-woo-product-gallery").data("gallery-settings")||o.data("gallery-settings"),r=t.getElementorElementSettings(o);if(i.find(".jet-woo-product-gallery__image-item").length>1){let s={slidesPerView:1,touchReleaseOnEdges:!0,...a};if(delete s.paginationType,a.centeredSlides&&!e.isEmptyObject(r)){s.slidesPerView=+r.slider_center_mode_slides||4,s.spaceBetween=+r.slider_center_mode_space_between?+r.slider_center_mode_space_between:0;const e={slidesPerView:"slider_center_mode_slides_",spaceBetween:"slider_center_mode_space_between_"};s.breakpoints=t.handleSwiperBreakpoints(r,s,e)}if(a.showNavigation&&(s.navigation={nextEl:".jet-swiper-button-next",prevEl:".jet-swiper-button-prev"}),a.showPagination)if("thumbnails"===a.paginationType){const n=o.find(".jet-woo-swiper-gallery-thumbs"),l=i.data("swiper-thumb-settings");let d={freeMode:a.loop,slidesPerView:4,spaceBetween:10,watchSlidesVisibility:!0,watchSlidesProgress:!0,...l};if(l.showNavigation&&(d.navigation={nextEl:".jet-thumb-swiper-nav.jet-swiper-button-next",prevEl:".jet-thumb-swiper-nav.jet-swiper-button-prev"}),!e.isEmptyObject(r)){d.slidesPerView=+r.pagination_thumbnails_columns,d.spaceBetween=+r.pagination_thumbnails_space_between?+r.pagination_thumbnails_space_between:0;const e={slidesPerView:"pagination_thumbnails_columns_",spaceBetween:"pagination_thumbnails_space_between_"};d.breakpoints=t.handleSwiperBreakpoints(r,d,e)}s.thumbs={swiper:new Swiper(n,d)};let c=0;window.elementorFrontend&&!e.isEmptyObject(r)?(c=+r.pagination_thumbnails_columns,"desktop"!==window.elementorFrontend.getCurrentDeviceMode()&&(c=+r["pagination_thumbnails_columns_"+window.elementorFrontend.getCurrentDeviceMode()])):e.each(l.breakpoints,(t,o)=>{e(window).width()>t&&(c=o.slidesPerView)}),c>=n.find(".jet-woo-swiper-control-thumbs__item:not(.swiper-slide-duplicate)").length&&(n.addClass("jet-woo-swiper-gallery-thumbs-no-nav"),n.find(".jet-swiper-nav").hide(),n.find(".swiper-slide-duplicate").hide())}else s.pagination={el:".swiper-pagination",type:"dynamic"!==a.paginationControllerType?a.paginationControllerType:"bullets",clickable:!0,dynamicBullets:!("dynamic"!==a.paginationControllerType&&!a.dynamicBullets)};s.on={init:function(){n.hasVideo&&a.loop&&i.find(".swiper-slide-duplicate video.jet-woo-product-video-player").removeAttr("autoplay")},imagesReady:function(){if(n.hasVideo){const t=i.find(".jet-woo-product-gallery--with-video");"self_hosted"===n.videoType&&("horizontal"===a.direction?(n.videoAutoplay&&n.videoFirst&&(setTimeout(function(){d.updateAutoHeight(100)},300),a.autoHeight||l(t)),a.autoHeight&&t.on("click",()=>{setTimeout(function(){d.updateAutoHeight(100)},300)})):t.each(function(){n.videoAutoplay&&l(e(this)),e(this).on("click",()=>{l(e(this))})}))}if("vertical"===a.direction){i.find(".jet-woo-product-gallery__image-item img").each(function(){let t=e(this);t.height()>i.height()&&t.css({height:i.height()+"px",width:"auto"})})}let t=!1;e(document).on("jet-woo-gallery-variation-image-change",()=>{let e=0;t&&n.videoFirst&&(e=1),a.loop?d.slideToLoop(e,300,!0):d.slideTo(e,300,!0),t=!0})},slideChangeTransitionStart:function(){if(!n.hasVideo||!a.loop)return;const e=this.$wrapperEl,t=this.params;e.children("."+t.slideClass+"."+t.slideDuplicateClass).each(function(){const o=this.getAttribute("data-swiper-slide-index");this.innerHTML=e.children("."+t.slideClass+'[data-swiper-slide-index="'+o+'"]:not(.'+t.slideDuplicateClass+")").html()})},slideChangeTransitionEnd:function(){n.hasVideo&&a.loop&&this.slideToLoop(this.realIndex,0,!1)}};const d=new Swiper(i,s)}else o.find(".jet-swiper-nav").hide(),o.find(".swiper-pagination").hide();function l(e){e.find(".mejs-container").hasClass("mejs-container-fullscreen")?e.find(".mejs-controls").removeAttr("style"):setTimeout(function(){e.height()>i.height()&&e.find(".mejs-controls").css({top:i.height()+"px",bottom:"auto",transform:"translateY(-100%)"})},300)}t.productGallery(o)},productGalleryGrid:function(e){t.productGallery(e)},productGalleryModern:function(e){t.productGallery(e)},productGalleryAnchorNav:function(o){var i,a,n,r=o.find(".jet-woo-product-gallery__image-item"),l=o.find(".jet-woo-product-gallery-anchor-nav-items"),s=o.find(".jet-woo-product-gallery-anchor-nav-controller"),d=s.find("li a"),c=[],p=!1,u=0,w=0,_=e("#wpadminbar");function g(){e(r).each(function(){var t=e(this).attr("id");c[t]=e(this).offset().top})}function m(){for(var t in c)w>=c[t]-u&&(e(s).find("a.current-item").removeClass("current-item"),e(s).find('a[data-index="'+t+'"]').addClass("current-item"))}_.length&&(u=_.outerHeight()),t.productGallery(o),g(),i=!1,a=!1,n=!1,e(window).on("scroll",function(){var t=e(window).scrollTop(),o=e(l).outerHeight(!0),r=e(s).outerHeight(!0),d=e(l).offset().top,c=e(s).offset().top,p=d+o,w=c+r;p-r-u<=t||(!0===a&&!1===n&&e(s).css({top:t-d+u+"px"}),t<c&&t<w&&(i=!1,a=!0,e(s).css({top:t-d+u+"px"})),!1===i&&t>d&&(i=!0,a=!0,n=!1),!1===i&&d>t&&(i=!1,a=!1,n=!1,e(s).removeAttr("style")))}),e(window).scroll(function(){p||(g(),w=e(document).scrollTop(),m())}),w=e(document).scrollTop(),m(),e(d).on("click",function(){m();var t=e(this).data("index"),o=c[t];if(p=!0,e(s).find("a.current-item").removeClass("current-item"),e(this).addClass("current-item"),t,e(this).parents().hasClass("jet-popup")){let t=e(this).closest(".jet-popup__container-inner");e(t).animate({scrollTop:o-e(t).offset().top+1},"fast",function(){p=!1})}else e("html, body").animate({scrollTop:o-u+1},"fast",function(){p=!1});return!1})},productGallery:function(t){var o=t.data("id")||t.parent().data("block-id"),i=t.find(".jet-woo-product-gallery").data("gallery-settings")||t.data("gallery-settings"),a=t.find(".jet-woo-product-gallery__image-item:not(.swiper-slide-duplicate) .jet-woo-product-gallery__image:not(.image-with-placeholder)"),n=t.find(".jet-woo-product-gallery__image--with-zoom"),r=y(),l=t.find(".jet-woo-product-gallery__trigger"),s=e(".jet-woo-product-gallery-pswp")[0],d=t.find(".jet-woo-product-video__popup-button"),c=t.find(".jet-woo-product-video__popup-overlay"),p=t.find(".jet-woo-product-video-iframe"),u=!!p[0]&&p[0].src,w=t.find(".jet-woo-product-video-player"),_=t.find(".jet-woo-product-video-mejs-player"),g=_.data("controls")||["playpause","current","progress","duration","volume","fullscreen"],m=t.find(".jet-woo-product-video__overlay"),h=m.length>0;if(i){var f={mainClass:t.parent().data("block-id")?o+"-jet-woo-product-gallery":o?"jet-woo-product-gallery-"+o:"",captionEl:i.caption?i.caption:"",fullscreenEl:!!i.fullscreen&&i.fullscreen,zoomEl:!!i.zoom&&i.zoom,shareEl:!!i.share&&i.share,counterEl:!!i.counter&&i.counter,arrowEl:!!i.arrows&&i.arrows,closeOnScroll:!1,history:!1};i.enableGallery&&(l.on("click.JetWooProductGallery",function(o){if(o.preventDefault(),e("body").hasClass("elementor-editor-active"))return;var a,n=e(o.target),l=t.find(".jet-woo-product-gallery__image-item.featured").hasClass("no-image"),d=n.parents(".jet-woo-product-gallery__image-item"),c=d.data("swiper-slide-index");a=void 0!==c?c:e(d).index();(l||i.videoFirst)&&(a-=1);f.index=a,new PhotoSwipe(s,PhotoSwipeUI_Default,r,f).init()}),e(document).on("jet-woo-gallery-variation-image-change",function(){r=y()})),i.enableZoom&&(v(),e(document).on("jet-woo-gallery-variation-image-change",v)),i.hasVideo&&function(){switch(i.videoIn){case"content":m[0]&&(m.on("click.JetWooProductGallery",function(t){w[0]&&function(t){let o="";e(t).hasClass("jet-woo-product-video__overlay")?(o=e(t).siblings().find(".jet-woo-product-video-player")[1],e(t).remove()):(o=e(t).parents(".jet-woo-product-video__overlay").siblings().find(".jet-woo-product-video-player")[1],e(t).parents(".jet-woo-product-video__overlay").remove());o.play(),h=!1}(t.target),p[0]&&o(t)}),i.videoAutoplay&&p[0]&&o(event)),w&&w.each(function(){e(this).on("play.JetWooProductGallery",function(){h&&(m.remove(),h=!1)})}),_[0]&&t();break;case"popup":t(),d.on("click.JetWooProductGallery",function(e){!function(){d.siblings(".jet-woo-product-video__popup-content").addClass("jet-woo-product-video__popup--show"),w[0]&&(w[0].play(),i.videoAutoplay||(w[0].pause(),w[0].currentTime=0));p[0]&&(p[0].src=u,i.videoAutoplay&&(p[0].src=p[0].src.replace("&autoplay=0","&autoplay=1")))}()}),c.on("click.JetWooProductGallery",function(e){!function(){d.siblings(".jet-woo-product-video__popup-content").removeClass("jet-woo-product-video__popup--show"),p[0]&&(p[0].src="");w&&(w[0].currentTime=0,w[0].pause())}()})}function t(){_.mediaelementplayer({videoVolume:"horizontal",hideVolumeOnTouchDevices:!1,enableProgressTooltip:!1,features:g,autoplay:!1,pauseOtherPlayers:!1}).load()}function o(t){if(i.videoAutoplay)p.each(function(){e(this).parents(".jet-woo-product-gallery__image-item").hasClass("swiper-slide-duplicate")&&(e(this)[0].src=e(this)[0].src.replace("&autoplay=1","&autoplay=0"))});else{let o="";(o=e(t.target).hasClass("jet-woo-product-video__overlay")?e(t.target).siblings().find(".jet-woo-product-video-iframe"):e(t.target).parents(".jet-woo-product-video__overlay").siblings().find(".jet-woo-product-video-iframe"))[0].src=o[0].src.replace("&autoplay=0","&autoplay=1")}m.remove(),h=!1}}()}function v(){var t=!1,o={magnify:i.zoomMagnify,touch:!1};n.each(function(o,i){var a=e(i).find("img"),n=a.parent().width();a.data("large_image_width")>n&&(t=!0)}),t&&("ontouchstart"in document.documentElement&&(o.on="click"),n.trigger("zoom.destroy"),n.zoom(o))}function y(){var t=[];return a.length>0&&a.each(function(o,i){var a=e(i).find("img");if(a.length){var n={src:a.attr("data-large_image"),w:a.attr("data-large_image_width"),h:a.attr("data-large_image_height"),title:a.attr("data-caption")?a.attr("data-caption"):a.attr("title")};t.push(n)}}),t}e(".jet-woo-product-gallery__image-item").find("img").on("click",function(e){e.preventDefault()})},getElementorElementSettings:function(e){return window.elementorFrontend&&window.elementorFrontend.isEditMode()&&e.hasClass("elementor-element-edit-mode")?t.getEditorElementSettings(e):e.data("settings")||{}},getEditorElementSettings:function(e){var t,o=e.data("model-cid");return o&&window.elementorFrontend.hasOwnProperty("config")&&window.elementorFrontend.config.hasOwnProperty("elements")&&window.elementorFrontend.config.elements.hasOwnProperty("data")&&(t=window.elementorFrontend.config.elements.data[o])?t.toJSON():{}},handleSwiperBreakpoints:function(e,t,o){const i=window.elementorFrontend.config.responsive.activeBreakpoints,a=elementorFrontend.breakpoints.getBreakpointValues(),n={mobile:2,tablet:3};let r=t.slidesPerView,l=10;return t.breakpoints={},Object.keys(i).reverse().forEach(a=>{const s=n[a]?n[a]:r;l=+e[o.spaceBetween+a]?+e[o.spaceBetween+a]:0,t.breakpoints[i[a].value]={slidesPerView:+e[o.slidesPerView+a]||s,spaceBetween:l},r=+e[o.slidesPerView+a]||s}),Object.keys(t.breakpoints).forEach(e=>{const o=parseInt(e);let n;if(o===i.mobile.value||o+1===i.mobile.value)n=0;else if(!i.widescreen||o!==i.widescreen.value&&o+1!==i.widescreen.value){const e=a.findIndex(e=>o===e||o+1===e);n=a[e-1]}else n=o;t.breakpoints[n]=t.breakpoints[o],t.breakpoints[o]={slidesPerView:t.slidesPerView,spaceBetween:t.spaceBetween}}),t.breakpoints},elementorFrontendInit:function(t){const o=["jet-woo-product-gallery-grid.default","jet-woo-product-gallery-modern.default","jet-woo-product-gallery-anchor-nav.default","jet-woo-product-gallery-slider.default"];t.find("[data-element_type]").each(function(){let t=e(this).data("element_type");if(t){if("widget"===t){if(t=e(this).data("widget_type"),!o.includes(t))return;window.elementorFrontend.hooks.doAction("frontend/element_ready/widget",e(this),e)}window.elementorFrontend.hooks.doAction("frontend/element_ready/global",e(this),e),window.elementorFrontend.hooks.doAction("frontend/element_ready/"+t,e(this),e)}})}};e(window).on("elementor/frontend/init",t.init),window.JetPlugins&&(e(function(){JetPlugins.init()}),window.addEventListener("DOMContentLoaded",function(){t.initBlocks()})),window.JetGallery=t}(jQuery);