! function(e) { let product = { galleries: { thumbs: null, main: null, fixed: null }, createSlide: function() { this.galleries.thumbs = new Swiper(".nav-swiper", { direction: "vertical", slidesPerView: 4, updateOnWindowResize: !0, watchSlidesProgress: !0, watchSlidesVisibility: !0, lazy: { loadPrevNext: !0 }, navigation: { nextEl: ".product-next", prevEl: ".product-prev" } }), this.galleries.main = new Swiper(".featured-swiper", { slidesPerView: 1, keyboard: !0, lazy: { loadPrevNext: !0 }, pagination: { clickable: !0, el: document.querySelector(".featured-swiper .swiper-pagination") }, navigation: { nextEl: ".product-mob-next", prevEl: ".product-mob-prev" }, thumbs: { autoScrollOffset: 3, multipleActiveThumbs: !1, swiper: this.galleries.thumbs } }), this.galleries.fixed = new Swiper(".slide-fixed", { speed: 0, loopedSlides: 1, lazy: { loadPrevNext: !0 }, navigation: { nextEl: ".fixed-next", prevEl: ".fixed-prev" } }), e(".featured-swiper .click-to-zoom").on("click", (function() { let t = e(".featured-swiper .swiper-slide.swiper-slide-active").data("index"); e(".fixed-modal").addClass("active"), product.galleries.fixed.slideTo(t, 0, !1) })), e(".nav-swiper .swiper-slide").on("focusin", (function() { product.galleries.thumbs.slideTo(e(this).data("index")), product.galleries.main.slideTo(e(this).data("index")) })) }, variantImage: function(e) { jQuery.ajax({ method: "get", url: e, success: function(e) { if (e.Variant.VariantImage && e.Variant.VariantImage.length) { if (-1 === e.Variant.VariantImage[0].https.indexOf("variacao_")) return; product.resetSlider(e.Variant.VariantImage) } } }) }, resetSlider: function(t) { if (void 0 !== this.galleries.thumbs) { this.galleries.thumbs.destroy(), this.galleries.main.destroy(), this.galleries.fixed.destroy(), jQuery(".gallery .swiper-slide, .fixed-modal .swiper-slide").each((function() { jQuery(this).remove() })); let r = "", a = ""; e.each(t, (function() { r += `\n
\n image\n
\n `, a += `\n
\n image\n
\n ` })), jQuery(".gallery .featured-swiper .swiper-wrapper,.fixed-modal .swiper-wrapper").html(r), jQuery(".gallery .nav-swiper .swiper-wrapper").html(a), this.createSlide() } }, fixedModal: function() { e(".fixed-modal .exit, .fixed-modal .shad").on("click", (function() { e(".fixed-modal").removeClass("active") })) }, forVisited: function(e) { var t = [], r = 0; e.forEach((function(a) { jQuery.ajax({ method: "GET", url: "/web_api/products/" + a.id }).success((function(a) { if (a.Product && t.push(a), r++, e.length == r) return product.appendVisited(t) })).fail((function(a) { var i = jQuery.parseJSON(a.responseText); if ("Nenhum registro encontrado" == i.name) { var o = i.url.replace(/\D/g, ""), s = e.filter((function(e) { if (e.id != Number(o)) return e })); localStorage.setItem("visited", JSON.stringify(s)) } if (r++, e.length == r) return product.appendVisited(t) })) })) }, appendVisited: function(e) { var t = jQuery(".visited-section .list-append"), r = ""; e.forEach((function(e) { var product = e.Product, t = '
{name}
{boxPrice}
'.replace(/{link}/g, product.url.https).replace(/{image}/g, product.ProductImage[0].https).replace(/{name}/g, product.name), a = Number(product.promotional_price); t = product.available && Number(product.price) ? t.replace("{boxPrice}", '
{before} {price}
{payment}
'.replace("{before}", a ? '
{price}
'.replace("{price}", toReal(Number(product.price), "R$")) : "").replace("{price}", a ? toReal(a, "R$") : toReal(Number(product.price), "R$"))).replace("{payment}", product.payment_option_html) : t.replace("{boxPrice}", product.available ? '

Sob Consulta

' : '

Indisponível

'), r += '
' + t + "
" })); var a = '
' + r + "
"; t.append(a); new LazyLoad({ elements_selector: ".list-append", threshold: 300, callback_enter: function(e) { var t = e.querySelectorAll(".item").length; new Swiper(e.querySelector(".swiper-container"), { slidesPerView: 4, lazy: { loadPrevNext: !1 }, navigation: { nextEl: e.querySelector(".next"), prevEl: e.querySelector(".prev") }, loop: t > 4, breakpoints: { 0: { slidesPerView: 1, loop: t > 1 }, 320: { slidesPerView: 2, loop: t > 2 }, 640: { slidesPerView: 3, loop: t > 3 }, 1024: { slidesPerView: 4, loop: t > 4 } } }) } }) }, productVisitedNew: function() { var e = jQuery("#form_comprar").data("id"), t = localStorage.getItem("visited"), r = []; t && (r = JSON.parse(t).reverse()), r.length ? product.forVisited(r) : jQuery(".visited-section").remove(), 10 == r.length && (r.pop(), r.reverse()); var a = !0; if (r.forEach((function(t) { t.id == e && (a = !1) })), a && !jQuery("#form_comprar").hasClass("unavailable")) { r.push({ id: e }); var i = JSON.stringify(r); localStorage.setItem("visited", i) } }, shipping: function() { jQuery(".crazy_cep").mask("00000-000"); var e = 1; jQuery(".new-frete").submit((function(t) { t.preventDefault(), jQuery("#quant:visible").is(":visible") && (e = jQuery("#quant:visible").val()); var r = jQuery("#shippingSimulatorButton").attr("data-url"), a = jQuery(this).find("input").val().split("-"), i = jQuery("#product-container").find("#selectedVariant").val() ? jQuery("#product-container").find("#selectedVariant").val() : 0; r = r.replace("cep1=%s", "cep1=" + a[0]).replace("cep2=%s", "cep2=" + a[1]).replace("acao=%s", "acao=" + i).replace("dade=%s", "dade=" + e), "" !== jQuery("#selectedVariant").val() ? (jQuery(".box-frete .result").html('
'), jQuery.ajax({ method: "GET", url: r, success: function(e) { jQuery(".box-frete .result").html(e), jQuery(".box-frete .result").find("table:first, p").remove(), jQuery(".box-frete .result").find("img").parent().remove(), jQuery(".box-frete .result").find("th:last").text("Prazo:"), jQuery(".box-frete .result").find('th[colspan="2"]').removeAttr("colspan"), jQuery(".box-frete .result").find("[width]").removeAttr("width"), 1 == jQuery(".box-frete .result").find("tr").length && (jQuery(".box-frete .result").find("tr").after('Não foi encontrado formas de envio para o CEP'), jQuery(".box-frete .result").find("tr:first").remove()) } })) : jQuery(".box-frete .result").html("Escolha uma variação") })) }, productVariant: function() { this.tabs(), jQuery(".compreJunto form .fotosCompreJunto").append('
=
'), jQuery(".box-variants").on("click", ".lista_cor_variacao li[data-id]", (function() { var e = "/web_api/variants/" + jQuery(this).data("id"); product.variantImage(e) })), jQuery(".box-variants").on("click", ".lista-radios-input", (function() { var e = "/web_api/variants/" + jQuery(this).find("input").val(); product.variantImage(e) })), jQuery(".box-variants").on("change", "select", (function() { var e = "/web_api/variants/" + jQuery(this).val(); product.variantImage(e) })), jQuery(".produto img").each((function() { jQuery(this).attr("src", jQuery(this).attr("src").replace("/90_", "/")); var e = ""; "" !== jQuery(this).parent().attr("href") && (e = 'href="' + jQuery(this).parent().attr("href") + '"'), jQuery(this).parents("span").after("' + jQuery(this).attr("alt") + "") })), jQuery(".page-product").on("click", "#detalhes_formas", (function() { var e = jQuery("#form_comprar").data("id"), t = jQuery("#preco_atual").val(), r = "/mvc/store/product/payment_options_details?loja=" + theme.storeId() + "&IdProd=" + e + "&preco=" + t; jQuery(".payment-modal").addClass("active"), jQuery(".payment-modal .append").html('
'), jQuery.ajax({ method: "GET", url: r, success: function(e) { jQuery(".payment-modal .append").html(e).find(".tablePage").wrap('
') } }) })), jQuery("#form_comprar").bind("submit", (function() { if (!jQuery(".labelMultiVariacao").length && jQuery("#selectedVariant").length && !jQuery("#selectedVariant").val()) return jQuery("#span_erro_carrinho").css("display", "block"), !1; if (jQuery(this).hasClass("is-kit")) { let e = !1; if (jQuery(this).find('input[type="hidden"][name="variants_kit[]"]').each((function(t, r) { if ("" === jQuery(r).val()) return jQuery("#span_erro_carrinho").css("display", "block"), e = !0, !1 })), e) return !1 } jQuery("#loading-product-container").show(), jQuery("body").removeClass("modal-open").removeAttr("style"), jQuery("body").find(".modal-backdrop").remove(); var e = setInterval((function() { jQuery("body").find(".modal-backdrop").remove(), jQuery(".cart-preview-loading-modal").hasClass("tray-hide") && (cart.showCart(), jQuery("#loading-product-container").hide(), jQuery("body").find(".botao-continuar-comprando .botao-commerce-img").trigger("click"), clearInterval(e)) }), 50) })), jQuery(".compreJunto form").bind("submit.botao-compre-junto", (function() { if (!jQuery(this).find(".blocoAlerta").is(":visible")) { jQuery("#loading-product-comprejunto").show(), jQuery("body").removeClass("modal-open").removeAttr("style"), jQuery("body").find(".modal-backdrop").remove(); var e = setInterval((function() { jQuery(".cart-preview-loading-modal").hasClass("tray-hide") && (jQuery("#loading-product-comprejunto").hide(), jQuery("body").find(".botao-continuar-comprando .botao-commerce-img").trigger("click"), clearInterval(e)) }), 50) } })); var e = jQuery("#variation_second_select").prev(), t = jQuery('[data-tray-tst="variation_first_select"]'); e.is(":visible") && !t.val() && e.hide(), t.change((function() { e.show() })) }, tabs: function() { if (jQuery('[data-id*="AbaPersonalizada"]').each((function() { var e = jQuery(this).data("id"); jQuery(e).removeAttr("style").appendTo(jQuery(this)) })), jQuery(".section-box.comments").length) { jQuery(".section-box.comments").appendTo(".comments-modal .append"), jQuery(".section-box.comments #comentario_cliente").wrap('
'); let e = jQuery(".section-box.comments .comments-form").detach(); jQuery(".section-box.comments").wrapInner('
'), jQuery(".section-box.comments").append(e), jQuery(".section-box.comments .customer-comments .tray-hide").remove(), jQuery(".section-box.comments .customer-comments br").remove(), jQuery(".section-box.comments .customer-comments .line").remove(), jQuery(".section-box.comments .customer-comments .title-section").removeClass("title-section").addClass("title-section-comments"), jQuery(".section-box.comments .customer-comments .title-section-comments + h2.color").detach().prependTo(".section-box.comments .comments-form"), jQuery(".section-box.comments .customer-comments h2.color").remove(), jQuery(".section-box.comments .customer-comments .blocoSucesso").detach().appendTo(".section-box.comments .comments-form"), jQuery(".section-box.comments .customer-comments .title-section-comments").detach().prependTo(".section-box.comments"), jQuery(".section-box.comments .comments-form br").remove(); let t = jQuery(".section-box.comments .comments-form #form-comments h5").html().replace("- Máximo", "Máximo"); jQuery(".section-box.comments .comments-form #form-comments h5").html(t), jQuery(".section-box.comments .comments-form h2").html("Deixe sua avaliação sobre esse produto"), 0 === jQuery(".section-box.comments .customer-comments").children().length && jQuery(".section-box.comments .customer-comments").html('Nenhuma avaliação disponível. Seja o primeiro a avaliar.') } jQuery(".list-star.cursor").click((function() { jQuery(".comments-modal").addClass("active") })), jQuery(".ranking .rating").each((function() { var e = Number(jQuery(this).attr("class").replace(/[^0-9]/g, "")); for (i = 1; i <= 5; i++) i <= e ? jQuery(this).append('
') : jQuery(this).append('
') })) }, incrementPage: function() { if (this.templateIncrement(), jQuery(".increment-page .low").click((function() { var e = jQuery(".page-product").find("#quantidade #quant"); e.val(1 == parseInt(e.val()) ? 1 : parseInt(e.val()) - 1) })), 0 == jQuery(".value-max-stock").attr("data-variant")) { var e = jQuery(".page-product").find("#quantidade #quant"), t = parseInt(jQuery(".value-max-stock").text()); jQuery(".increment-page .add").click((function() { var r = parseInt(e.val()); r < t && e.val(r + 1) })) } else jQuery(".increment-page .add").click((function() { var e = jQuery(".page-product").find("#quantidade #quant"); e.val(parseInt(e.val()) + 1) })) }, templateIncrement: function() { jQuery('#product-form-box [name="quant"]').length || jQuery("#product-form-box").prepend('
\t\t\t\t\t\t\t\t\t\t \t\t\t\t
') } }; product.productVisitedNew(), product.shipping(), product.createSlide(), product.productVariant(), product.fixedModal(), product.incrementPage() }(jQuery);