var $=jQuery.noConflict(),ST_WC_FRONT_SWATCH=ST_WC_FRONT_SWATCH||{},ST_WC_Chosen_attribute="",ST_WC_Show_selected_title=!1,ST_WC_Triggered_variations=[];!function(h){"use strict";ST_WC_FRONT_SWATCH.onSelect=function(){h("body").on("click","ul.st-swatch-preview span.st-custom-attribute",function(){var t,e,a;h(this).parents().is(".swiper-entry, .products-loop, .et-quick-view-wrapper, .etheme-product-grid-item, .etheme-product-list-item")||(t=h(this).closest("[data-attribute]").data("attribute"),t=h("select#"+t),e=h(this).data("value"),a=h(this).parent("li"),null==e||t.find('option[value="'+e+'"]').length?(a.hasClass("selected")?(a.removeClass("selected"),t.val(" "),1==sten_wc_params.is_singular_product&&(sten_wc_params.is_customize_preview&&a.css({"border-color":a.data("border-color")}),ST_WC_Show_selected_title)&&a.parents("tr").find(" > th label").attr("data-swatch-name",null)):(a.addClass("selected").siblings().removeClass("selected"),t.val(e),1==sten_wc_params.is_singular_product&&(sten_wc_params.is_customize_preview&&(a.removeAttr("style"),a.siblings().css({"border-color":a.data("border-color")}),a.css({"border-color":a.data("active-border-color")})),ST_WC_Show_selected_title)&&a.parents("tr").find(" > th label").attr("data-swatch-name",h(this).data("name")),ST_WC_Chosen_attribute=h(this).closest("[data-attribute]").data("attribute")),t.trigger("change"),h(".variations_form").find("ul.st-swatch-preview").each(function(t,e){ST_WC_FRONT_SWATCH.singleProductUpdateAttribute(e),a.removeClass("sten-li-disabled")})):(t.val(" ").trigger("change"),a.siblings().removeClass("selected"),window.alert(sten_wc_params.i18n_no_matching_variations_text)))}),h(document).on("click",".etheme-sticky-cart .st-custom-attribute",function(){var t=h(document).find(".et_product-block .woocommerce-variation-add-to-cart");(t.hasClass("disabled")||t.hasClass("woocommerce-variation-add-to-cart-disabled"))&&h(document).find(".etheme-sticky-cart .single_add_to_cart_button").addClass("disabled")})},ST_WC_FRONT_SWATCH.singleProductPrimaryAttribute=function(){h(document).find(".variations_form.cart").on("reset_data",function(){var i=h(this);etConfig.woocommerceSettings.primary_attribute&&"et_none"!=etConfig.woocommerceSettings.primary_attribute&&ST_WC_Chosen_attribute=="pa_"+etConfig.woocommerceSettings.primary_attribute&&(ST_WC_Chosen_attribute="",setTimeout(function(){var t,e=ST_WC_FRONT_SWATCH.productLoop.getChosenAttributes(i),a=e.data;e.count&&e.chosenCount&&e.count!=e.chosenCount&&(e=h.parseJSON(i.attr("data-product_variations")),e=ST_WC_FRONT_SWATCH.productLoop.findMatchingVariations(e,a).shift(),a=h(".woocommerce-main-image").first(),t=h(".thumbnail-item a").first(),a.find("img").attr("data-o_src")||a.find("img").attr("data-o_data-src")||(a.attr("data-o_href",a.attr("href")),a.find("img").attr({"data-o_src":a.find("img").attr("src"),"data-o_data-src":a.find("img").attr("src"),"data-o_data-large_image":a.find("img").attr("data-large_image")})),a.attr("href",e.image.full_src),a.find("img").attr({src:e.image.src,"data-src":e.image.src,"data-large_image":e.image.full_src,srcset:""}),a.parent().find("img.zoomImg").attr("src",a.find("img").attr("data-large_image")),t.attr("href",e.image.full_src).attr("data-large",e.image.full_src).attr("data-small",e.image.gallery_thumbnail_src),t.find("img").attr("src",e.image.gallery_thumbnail_src).attr("srcset",e.image.gallery_thumbnail_src))},50))})},ST_WC_FRONT_SWATCH.onSelectUpdateAttribute=function(){h("body.single-product form.variations_form").on("woocommerce_update_variation_values",function(){h(this).find("ul.st-swatch-preview").each(function(){var t=h(this).data("attribute"),t=document.getElementById(t),e=h(t).find("option"),a=h(t).find("option").eq(1),i=h(this).find("li"),s=h(t).find("option:selected"),r=[],o="";e.each(function(){""!==h(this).val()&&(r.push(h(this).val()),o=(s||a).val())}),i.each(function(){var t=this,e=h(t).find("span.st-custom-attribute").attr("data-value");h(t).removeClass("selected sten-li-disabled").addClass("sten-li-disabled"),-1!==r.indexOf(e.toString())&&(h(t).removeClass("sten-li-disabled"),e.toString()==o)&&h(t).addClass("selected")})})})},ST_WC_FRONT_SWATCH.singleProductUpdateAttribute=function(t){var e,a=h.parseJSON(h(t).parents(".variations_form").attr("data-product_variations")),i=ST_WC_FRONT_SWATCH.productLoop.getChosenAttributes(h(t).parents(".variations_form")).data,i=h.extend(!0,{},i),s=ST_WC_FRONT_SWATCH.productLoop.findMatchingVariations(a,i),r="attribute_"+h(t).data("attribute");for(e in s)if(void 0!==s[e]){var o,n,d=s[e].attributes;for(o in d)d.hasOwnProperty(o)&&(n=d[o],o!==r||s[e].is_in_stock||h(t).find('span.st-custom-attribute[data-value="'+n+'"]').parent().hasClass("sten-li-enabled")||h(t).find('span.st-custom-attribute[data-value="'+n+'"]').parent().addClass("sten-li-disabled"))}},ST_WC_FRONT_SWATCH.onClear=function(){h("body.single-product").on("click","a.reset_variations",function(){var t=h(this).closest("form.variations_form").find("ul.st-swatch-preview li.selected");t.removeClass("selected"),1==sten_wc_params.is_singular_product&&(sten_wc_params.is_customize_preview&&t.css({"border-color":t.data("border-color")}),ST_WC_Show_selected_title)&&h(this).closest("form.variations_form").find("label[data-swatch-name]").attr("data-swatch-name",null)})},ST_WC_FRONT_SWATCH.productLoop={init:function(){ST_WC_FRONT_SWATCH.productLoop.itemSwatches(),ST_WC_FRONT_SWATCH.productLoop.addToCart(),ST_WC_FRONT_SWATCH.productLoop.showMoreAttr()},itemSwatches:function(){h("div.st-swatch-in-loop").each(function(){var s=h(this),t=s.find("span.st-custom-attribute:not(.sten-disabled)"),r=s.find("a.sten-reset-loop-variation, .et-delete"),o=s.closest(".product-type-variable"),n=h.parseJSON(s.attr("data-product_variations")),e=s.find("ul.has-default-attribute"),a=s.find(".et_st-select-holder");if(o.find("a.add_to_cart_button").addClass("et-st-disabled"),h(".st-swatch-btn-ready").removeClass("et-st-disabled"),ST_WC_FRONT_SWATCH.productLoop.updateAttributes(s,n),a.length){if(1==a.length)a.removeClass("hidden"),a.find("li.type-select").each(function(){var t=h(this).find(".st-attribute-price"),e=t.find(">span").clone();t.html(e)});else{let t=!1;a.each(function(){h(this).find("ul.has-default-attribute").length?(h(this).removeClass("hidden"),h(this).data("was-changed",!0).parent().find(".et_st-select-holder.hidden").first().removeClass("hidden"),t=!0):h(this).addClass("hidden")}),t||a.first().removeClass("hidden")}a.last().addClass("et_st-select-holder-last"),s.find(".et_st-default-holder:not(.et_st-select-holder)").length||(o.addClass("has-select-swatch-only"),s.find("a.sten-reset-loop-variation").addClass("hidden"),o.find("a.add_to_cart_button").text(sten_wc_params.add_to_cart_btn_text))}e.each(function(){var t=h(this).parent("div.st-swatch-in-loop").find("a.sten-reset-loop-variation"),e=(t.show(),ST_WC_FRONT_SWATCH.productLoop.getChosenAttributes(s)),a=e.data;e.count===e.chosenCount?(ST_WC_FRONT_SWATCH.productLoop.updateAttributes(s,n),(e=ST_WC_FRONT_SWATCH.productLoop.findMatchingVariations(n,a).shift())?ST_WC_FRONT_SWATCH.productLoop.foundVariation(o,s,e):t.trigger("click")):ST_WC_FRONT_SWATCH.productLoop.updateAttributes(s,n)}),t.on("click",function(){var t=h(this),e=t.parent("li"),a=e.parents(".et_st-select-holder"),i=!!a.length&&a.find(".et_st-swatch-select-title");if(t.hasClass("sten-disabled"))return!1;o.find("span.st-custom-attribute").removeClass("sten-disabled sten-enabled"),o.find("span.st-custom-attribute").parent("li").removeClass("sten-li-disabled sten-li-enabled"),e.hasClass("selected")&&sten_wc_params.is_customize_preview&&e.css({"border-color":e.data("border-color")}),e.hasClass("selected")||(e.addClass("selected").siblings().removeClass("selected"),i&&i.html(h(this).html()),a.length&&(a.data("was-changed")||a.data("was-changed",!0).parent().find(".et_st-select-holder.hidden").first().removeClass("hidden"),a.find(".et_st-swatch-select-list").addClass("hidden"),setTimeout(function(){a.find(".et_st-swatch-select-wrapper").removeClass("active"),a.find(".et_st-swatch-select-list").removeClass("hidden")},300)),ST_WC_Show_selected_title&&t.parents().is(".et-quick-view-wrapper")&&e.parents(".st-swatch-in-loop").find(".et_attribute-name[data-for="+t.parents(".et_st-default-holder").attr("data-et-holder")+"]").attr("data-swatch-name",t.attr("data-name")),sten_wc_params.is_customize_preview&&(e.removeAttr("style"),e.siblings().css({"border-color":e.data("border-color")}),e.css({"border-color":e.data("active-border-color")})),r.slideDown());var i=ST_WC_FRONT_SWATCH.productLoop.getChosenAttributes(s),t=i.data;i.count===i.chosenCount?(ST_WC_FRONT_SWATCH.productLoop.updateAttributes(s,n),(e=ST_WC_FRONT_SWATCH.productLoop.findMatchingVariations(n,t).shift())?ST_WC_FRONT_SWATCH.productLoop.foundVariation(o,s,e):r.trigger("click")):(etConfig.woocommerceSettings.primary_attribute&&"et_none"!=etConfig.woocommerceSettings.primary_attribute&&h(this).closest("[data-attribute]").data("attribute")=="pa_"+etConfig.woocommerceSettings.primary_attribute&&(i=ST_WC_FRONT_SWATCH.productLoop.findMatchingVariations(n,t).shift(),ST_WC_FRONT_SWATCH.productLoop.variationsImageUpdate(o,i)),ST_WC_FRONT_SWATCH.productLoop.updateAttributes(s,n))}),r.on("click",function(){s.removeAttr("data-variation_id"),sten_wc_params.is_customize_preview&&(t=s.find("ul.st-swatch-preview li.selected")).css({"border-color":t.data("border-color")}),s.find(".et_st-swatch-select-title").text(sten_wc_params.select_options_btn_text),sten_wc_params.show_select_type_price&&o.removeClass("hide-product-price"),s.find("ul.st-swatch-preview li").removeClass("selected sten-li-disabled sten-li-enabled"),s.find("ul.st-swatch-preview span").removeClass("sten-disabled sten-enabled");var t=o.find("a.add_to_cart_button");let e=t;o.is(".etheme-product-grid-item, .etheme-product-list-item")&&(e=o.find(".st-swatch-popup").length&&!o.find(".st-swatch-popup .quantity-wrapper").length?o.find(".st-swatch-in-loop a.add_to_cart_button"):o.find(".etheme-product-grid-button .button-text, .etheme-product-list-button .button-text")),t.addClass("et-st-disabled").removeClass("st-swatch-btn-ready st-swatch-btn-readmore st-swatch-btn-text-changed added loading").attr("aria-label",sten_wc_params.select_options_btn_text+" "+sten_wc_params.read_more_for_btn_text+' "'+t.attr("data-product_name")+'"'),e.text(sten_wc_params.select_options_btn_text),o.find("a.added_to_cart").remove();var t=o.find("span.price").not(".price-cloned"),a=o.find(".price-cloned");a.length&&(t.html(a.html()),a.remove()),etConfig.woocommerceSettings.wishlist_for_variations&&s.trigger("reset_data"),n=h.parseJSON(s.attr("data-product_variations")),ST_WC_FRONT_SWATCH.productLoop.updateAttributes(s,n),ST_WC_FRONT_SWATCH.productLoop.variationsImageUpdate(o,!1),ST_WC_FRONT_SWATCH.productLoop.variationsCountdownUpdate(o,!1),ST_WC_FRONT_SWATCH.productLoop.variationsLoopQty(o,!1),h(this).parents().is(".et-quick-view-wrapper")&&(h(this).parents(".et-quick-view-wrapper").find(".price:not(.price_cloned)").remove(),h(this).parents(".et-quick-view-wrapper").find(".price_cloned").removeClass("price_cloned").attr("style",null),ST_WC_Show_selected_title)&&h(this).parents(".et-quick-view-wrapper").find(".et_attribute-name[data-swatch-name]").attr("data-swatch-name",null),h(this).slideUp()})})},getChosenAttributes:function(t){var a={},i=0,s=0;return t.find("ul.st-swatch-preview").each(function(){var t="attribute_"+h(this).data("attribute"),e=h(this).find("li.selected span.st-custom-attribute").attr("data-value")||"";0<(e=e.toString()).length&&s++,i++,a[t]=e}),{count:i,chosenCount:s,data:a}},updateAttributes:function(t,l){var p,u=ST_WC_FRONT_SWATCH.productLoop.getChosenAttributes(t).data;t.find("ul.st-swatch-preview").each(function(t,e){var a,i=h(e),s="attribute_"+i.data("attribute"),e=i.find("li.selected span.st-custom-attribute").data("value"),r=!0,o=h.extend(!0,{},u),n=(o[s]="",ST_WC_FRONT_SWATCH.productLoop.findMatchingVariations(l,o));for(a in n)if(void 0!==n[a]){var d,c,_=n[a].attributes;for(d in _)_.hasOwnProperty(d)&&(c=_[d],d===s)&&(n[a].variation_is_active,n[a].is_in_stock)&&(c?i.find('span.st-custom-attribute[data-value="'+c+'"]'):i.find("span.st-custom-attribute")).addClass("sten-enabled")}p=i.find("span.st-custom-attribute.sten-enabled").length,!e||0!==p&&0!==i.find('span.st-custom-attribute.sten-enabled[data-value="'+ST_WC_FRONT_SWATCH.productLoop.addSlashes(e)+'"]').length||(r=!1),i.find("span.st-custom-attribute:not(.sten-enabled)").addClass("sten-disabled"),i.find("span.st-custom-attribute:not(.sten-enabled)").parent("li").addClass("sten-li-disabled"),e&&r||i.find("li.selected").removeClass("selected")})},findMatchingVariations:function(t,e){for(var a=[],i=0;i<t.length;i++){var s=t[i];ST_WC_FRONT_SWATCH.productLoop.isMatch(s.attributes,e)&&a.push(s)}return a},isMatch:function(t,e){var a,i,s,r=!0;for(a in t)t.hasOwnProperty(a)&&(i=t[a],s=e[a],null!=i)&&null!=s&&0!==i.length&&0!==s.length&&i!==s&&(r=!1);return r},foundVariation:function(t,e,a){var i=t.find("span.price").not(".price-cloned"),s=i.clone().addClass("price-cloned").css("display","none"),r=e.find(".et_st-select-holder-last"),r=!!r.length&&r.find(".et_st-swatch-select-title").find(".st-attribute-price");e.attr("data-variation_id",a.variation_id),a.price_html?(t.find(".price-cloned").length||t.append(s),i.replaceWith(a.price_html),r.length&&(r.html(a.price_html),sten_wc_params.show_select_type_price)&&t.addClass("hide-product-price")):t.find(".price-cloned").length&&(i.replaceWith(s.html()),s.remove(),r.length)&&(r.html(s.html()),sten_wc_params.show_select_type_price)&&t.addClass("hide-product-price"),etConfig.woocommerceSettings.wishlist_for_variations&&e.trigger("found_variation",[a]),ST_WC_FRONT_SWATCH.productLoop.variationsImageUpdate(t,a),ST_WC_FRONT_SWATCH.productLoop.variationsCountdownUpdate(t,a),ST_WC_FRONT_SWATCH.productLoop.changeAddToCartBtnText(t,a)},variationsQuickViewUpdate:function(t,e){var a=h(".et-quick-view-wrapper"),i=(a.find(".stock, .product-stock, .cwginstock-subscribe-form, .cwg_popup_submit").remove(),e.availability_html&&a.find(".st-swatch-in-loop").before(e.availability_html),a.find(".sku_wrapper .sku")),i=(e.sku?(i.attr("data-o_content")||i.attr("data-o_content",i.html()),i.html(e.sku)):i.html(i.attr("data-o_content")),a.find(".gtin")),i=(e._et_gtin?(i.attr("data-o_content")||i.attr("data-o_content",i.text()),i.text(e._et_gtin)):void 0!==i.attr("data-o_content")&&i.text(i.attr("data-o_content")),a.find(".xstore-wishlist")),i=(i&&(e.variation_id?(i.attr("data-o_id")||i.attr("data-o_id",i.data("id")),i.attr("data-id",e.variation_id)):void 0!==i.attr("data-o_id")&&i.attr("data-id",i.attr("data-o_id")),etTheme.xstore_wishlist,void 0!==etTheme.xstore_wishlist)&&etTheme.xstore_wishlist.switch_variation_button(i,parseInt(e.variation_id)),a.find(".xstore-compare")),i=(i&&(e.variation_id?(i.attr("data-o_id")||i.attr("data-o_id",i.data("id")),i.attr("data-id",e.variation_id)):void 0!==i.attr("data-o_id")&&i.attr("data-id",i.attr("data-o_id")),etTheme.xstore_compare,void 0!==etTheme.xstore_compare)&&etTheme.xstore_compare.switch_variation_button(i,parseInt(e.variation_id)),a.find(".sales-booster-quantity-discounts-wrapper")),i=(i.length&&(e.is_purchasable&&e.is_in_stock&&e.variation_is_visible?(i.find("[data-product_id]").attr("data-product_id",e.variation_id),i.removeClass("hidden")):i.addClass("hidden")),a.find(".sales-booster-estimated-delivery .delivery-date"));e._et_estimated_delivery?(i.attr("data-o_content")||i.attr("data-o_content",i.text()),i.text(e._et_estimated_delivery)):void 0!==i.attr("data-o_content")&&i.text(i.attr("data-o_content")),ST_WC_FRONT_SWATCH.productLoop.variationsLoopQty(t,e,a.find("input.qty"))},normalizeProductId:function(t,e){var a=t.find(".st-swatch-in-loop").attr("data-product_id"),t=t.find("a.add_to_cart_button"),i=t.attr("data-product_id");a&&!i&&t.attr("data-product_id",a)},variationsLoopQty:function(t,i,s){if(i){if(s.length&&i.is_in_stock)if(i.max_qty)if("SELECT"==s[0].nodeName){var r=s.find("option");r.attr("disabled",1);let e=i.min_qty,a=i.max_qty;h(r).each(function(){var t=this.value;(""==a||t<=a)&&(t>=e||""==e)?h(this).attr("disabled",null):s.val(s.find("option:not([disabled]):first").val())})}else s.attr("min",i.min_qty),s.attr("max",i.max_qty),i.max_qty<s.val()&&s.parent().find(".plus").trigger("click");else"SELECT"==s[0].nodeName?s.find("option").attr("disabled",null):(null!==s.attr("data-o_max")&&(s.attr("data-o_min",s.attr("min")),s.attr("data-o_max",s.attr("max"))),s.attr("min",i.min_qty),s.attr("max",i.max_qty))}else{r=t.find("input.qty:not(.quantity-discount-qty-input)"),i=t.find("select.qty:not(.quantity-discount-qty-input)");r.length?(r.attr("max",r.attr("data-o_max")),r.attr("min",r.attr("data-o_min"))):i.length&&i.find("option").attr("disabled",null)}},variationsQuickViewQty:function(){let a=h(".et-quick-view-wrapper"),i=a.find("input.qty:not(.quantity-discount-qty-input), select.qty:not(.quantity-discount-qty-input)");i.length&&(i.attr("min")||i.attr("min",1),i.on("change",function(t){let e=i.val();0==e&&(e=1),a.find("a.button.product_type_variable").attr("data-quantity",e)}))},variationsImageUpdate:function(t,e){var a,i,s=t.find("img.wp-post-image, img.attachment-woocommerce_thumbnail, img.attachment-shop_catalog"),r=t.find(".st-swatch-in-loop");r.parents().is(".et-quick-view-wrapper")?(ST_WC_FRONT_SWATCH.productLoop.variationsQuickViewUpdate(t,e),r.parents(".et-quick-view-wrapper").find(".price_cloned").length<1&&(a=r.parents(".et-quick-view-wrapper").find("p.price:not(.price_cloned)")).after(a.clone().addClass("price_cloned").hide()),e.price_html&&r.parents(".et-quick-view-wrapper").find("p.price:not(.price_cloned)").html(e.price_html)):(ST_WC_FRONT_SWATCH.productLoop.normalizeProductId(t,e),ST_WC_FRONT_SWATCH.productLoop.variationsLoopQty(t,e,t.find("input.qty:not(.quantity-discount-qty-input), select.qty:not(.quantity-discount-qty-input)")),t.find(".show-quickly").attr("data-attributes",null),e&&t.find(".show-quickly").attr("data-attributes",JSON.stringify(e.attributes))),r.parents().is(".et-quick-view-wrapper")&&e&&e.st_image_src&&e.image.src&&1<e.st_image_src.length?(ST_WC_FRONT_SWATCH.productLoop.setVariationAttr(s,"src",e.image.full_src),s.attr("srcset")&&ST_WC_FRONT_SWATCH.productLoop.setVariationAttr(s,"srcset",e.image.srcset),ST_WC_FRONT_SWATCH.productLoop.setVariationAttr(s,"sizes",e.sizes)):e&&e.st_image_src&&e.image.src&&1<e.st_image_src.length?(s.parents().is(".product-image-wrapper")&&((i=h(s).parents(".product-image-wrapper")).find(".product-content-image"),r.is(".st-swatch-popup")||i.addClass("variation-changed")),ST_WC_FRONT_SWATCH.productLoop.setVariationAttr(s,"src",e.st_image_src[0]),s.attr("srcset")&&ST_WC_FRONT_SWATCH.productLoop.setVariationAttr(s,"srcset",e.st_image_srcset),ST_WC_FRONT_SWATCH.productLoop.setVariationAttr(s,"sizes",e.st_image_sizes)):(s.parents().is(".product-image-wrapper")&&((i=h(s).parents(".product-image-wrapper")).find(".product-content-image"),r.is(".st-swatch-popup")||i.removeClass("variation-changed")),ST_WC_FRONT_SWATCH.productLoop.resetVariationAttr(s,"src"),s.attr("srcset")&&ST_WC_FRONT_SWATCH.productLoop.resetVariationAttr(s,"srcset"),ST_WC_FRONT_SWATCH.productLoop.resetVariationAttr(s,"sizes"))},variationsCountdownUpdate:function(t,e){var a=t.find(".product-sale-counter"),i=(a.length&&(e&&e._sale_price_end?(a.attr("data-start",e._sale_price_start),a.attr("data-final",e._sale_price_end),void 0!==etTheme.countdown&&etTheme.countdown(),a.removeClass("hidden")):a.addClass("hidden")),t.find(".etheme-countdown-wrapper"));i.length&&(e&&e._sale_price_end_gmt?(i.data("date",e._sale_price_end_gmt),i.data("reinit","1"),i.removeClass("hidden").block({message:null,overlayCSS:{opacity:.6}}),setTimeout(function(){i.unblock()},1200)):i.addClass("hidden"))},changeAddToCartBtnText:function(t,e){var a=t.find("a.add_to_cart_button"),i=a,s="",r="",r=(t.is(".etheme-product-grid-item, .etheme-product-list-item")&&(i=t.find(".st-swatch-popup").length&&!t.find(".st-swatch-popup .quantity-wrapper").length?t.find(".st-swatch-in-loop a.add_to_cart_button"):t.find(".etheme-product-grid-button .button-text, .etheme-product-list-button .button-text")),a.removeClass("added"),Object.keys(e.attributes).length===t.find("ul.st-swatch-preview").length?!0===e.is_in_stock?(s=sten_wc_params.add_to_cart_btn_text,r=sten_wc_params.add_to_cart_btn_text,a.addClass("st-swatch-btn-ready").removeClass("st-swatch-btn-readmore").removeClass("et-st-disabled")):(s=sten_wc_params.read_more_btn_text,r=sten_wc_params.read_more_btn_text,r+=" "+sten_wc_params.read_more_about_btn_text,a.addClass("st-swatch-btn-readmore et-st-disabled").removeClass("st-swatch-btn-ready")):(s=sten_wc_params.select_options_btn_text,r=sten_wc_params.select_options_btn_text,r+=" "+sten_wc_params.read_more_for_btn_text,a.removeClass("st-swatch-btn-ready st-swatch-btn-readmore et-st-disabled")),r+=' "'+a.attr("data-product_name")+'"',a.attr("aria-label",r),a.addClass("st-swatch-btn-text-changed"),i.text(s),t.find("a.add_to_cart_button.et_product_variable-in-quick-view"));r.length&&e.is_in_stock&&r.text(r.attr("data-text"))},setVariationAttr:function(t,e,a){t.removeClass("hidden"),t.parent().find("video").addClass("hidden"),void 0===t.attr("data-o_"+e)&&t.attr("data-o_"+e,t.attr(e)?t.attr(e):""),!1===a?t.removeAttr(e):t.attr(e,a)},resetVariationAttr:function(t,e){var a=t.parent().find("video");a.length&&(t.addClass("hidden"),a.removeClass("hidden")),t.parents(".content-product, .product-content").find(".et-out-of-stock").removeClass("et-out-of-stock"),void 0!==t.attr("data-o_"+e)&&t.attr(e,t.attr("data-o_"+e)),t&&t.hasClass("lazyloaded")&&(t.removeClass("lazyloaded").addClass("lazyload"),etTheme.global_image_lazy())},addSlashes:function(t){return t=(t=(t=t.toString()).replace(/'/g,"\\'")).replace(/"/g,'\\"')},addToCart:function(){h(document).on("click",".et-st-disabled",function(t){if(etConfig.woocommerceSettings.is_smart_addtocart&&!h(this).parents().is(".et-quick-view-wrapper")&&t.preventDefault(),h(this).hasClass("et_product_variable-in-quick-view")||h(this).hasClass("product_type_variable"))return window.location=h(this).attr("href"),!1}),h(document).on("click","a.product_type_variable.add_to_cart_button.st-swatch-btn-ready",function(t){t.preventDefault();var a=h(this),e=a.closest(".product-type-variable").find("div.st-swatch-in-loop"),i=e.attr("data-variation_id");if(void 0===i||""==i)return!0;var s=a.data("product_id"),r=a.attr("data-quantity"),o={},e=(e.find("ul.st-swatch-preview").each(function(){var t=h(this).data("attribute"),e=h(this).find("li.selected span").data("value");o["attribute_"+t]=e}),a.removeClass("added"),a.addClass("loading"),{action:"sten_wc_product_loop_add_to_cart",product_id:s,quantity:r,variation_id:i,variation:o});h("body").trigger("adding_to_cart",[a,e]),h.ajax({type:"POST",url:sten_wc_params.ajax_url,data:e,success:function(t){var e;return!!t&&(t.error&&t.product_url?(window.location=t.product_url,!1):(e=t.fragments,t=t.cart_hash,e&&h.each(e,function(t,e){h(t).replaceWith(e)}),h(".quick-view-popup .mfp-close, .et-quick-view-canvas .et-close-popup").trigger("click"),a.addClass("added"),h("body").trigger("added_to_cart",[e,t,a]),a.parents(".product-type-variable").find(".st-swatch-in-loop .et-delete").trigger("click"),a.hasClass("et_product_variable-in-quick-view")&&a.attr("data-redirect")?(window.location=a.attr("data-redirect"),!1):void 0))},error:function(t){console.log(t)}}),t.preventDefault()}),h(document).on("click",".et_st-swatch-select-title",function(){(h(this).parent().hasClass("active")?h(this).parent():(h(this).parent().addClass("active"),h(this).parent().parent().siblings())).removeClass("active")})},showMoreAttr:function(){h(document).on("click",".et_show-more-attr",function(){var t=h(this).parents(".st-swatch-in-loop");t.find("ul.st-swatch-preview li.hidden:not(.et_show-more-attr)").removeClass("hidden"),t.find("ul.st-swatch-preview li.et_show-more-attr").addClass("hidden")})}},ST_WC_FRONT_SWATCH.documentOnReady={init:function(){var t;ST_WC_Show_selected_title="both"==sten_wc_params.show_selected_title,-1<h.inArray(sten_wc_params.show_selected_title,["mobile","desktop"])&&(t=h(window).width(),ST_WC_Show_selected_title="mobile"==sten_wc_params.show_selected_title&&t<992||"desktop"==sten_wc_params.show_selected_title&&993<=t),ST_WC_FRONT_SWATCH.onSelect(),ST_WC_FRONT_SWATCH.singleProductPrimaryAttribute(),ST_WC_FRONT_SWATCH.onClear(),ST_WC_FRONT_SWATCH.onSelectUpdateAttribute(),ST_WC_FRONT_SWATCH.productLoop.init()},ET_In_Popup:function(){h(document).on("click",".st-swatch-et-disabled li span",function(t){var e,a,i;h(this).parents().is(".et-quick-view-wrapper")||(a=(e=h(this).parents(".st-swatch-in-loop")).parents(".content-product"),e.addClass("active"),h(this).parents(".product-details").addClass("st-swatch-popup-active"),h.each(e.closest("div").find("div.et_st-default-holder"),function(){var t=h(this).html();t=(t=t.replace("st-swatch-size-small","st-swatch-size-normal")).replace("st-swatch-et-disabled","st-swatch-et-anabled"),h(this).parents(".st-swatch-in-loop").find(".st-swatch-preview-wrap .et_st-popup-holder").append(t)}),i=e.find("div.et_st-default-holder").height(),e.find("div.et_st-default-holder").css("min-height",i),e.find("div.et_st-default-holder ul").remove(),e.find(".sten-reset-loop-variation").remove(),a.find(".product-image-wrapper").is(".variation-changed")||a.find(".product-image-wrapper").addClass("variation-changed"),ST_WC_FRONT_SWATCH.productLoop.itemSwatches())}),h(document).on("click",".st-swatch-in-loop .et-delete",function(t){var e;h(this).parents().is(".et-quick-view-wrapper")||(e=h(this).parents(".st-swatch-in-loop").parents(".content-product"),h.each(h(this).parents(".st-swatch-in-loop").find("div.st-swatch-preview-wrap .et_st-popup-holder ul"),function(){var t=h(this).removeClass("st-swatch-et-anabled").addClass("st-swatch-et-disabled"),e=h(this).data("attribute");h(this).parents(".st-swatch-in-loop").find('div.et_st-default-holder[data-et-holder="'+e+'"]').prepend(t)}),h(this).parents(".st-swatch-in-loop").removeClass("active"),h(this).parents(".product-details").removeClass("st-swatch-popup-active"),h(this).parents(".st-swatch-in-loop").find(".st-swatch-preview-wrap .et_st-popup-holder ul").remove(),e.find(".product-image-wrapper").is(".variation-changed")&&e.find(".product-image-wrapper").removeClass("variation-changed"),ST_WC_FRONT_SWATCH.productLoop.itemSwatches())})}},h(document).ready(ST_WC_FRONT_SWATCH.documentOnReady.init),h(document).ready(ST_WC_FRONT_SWATCH.documentOnReady.ET_In_Popup)}(jQuery);