var Cart=function(){function t(){if(Main.LoadCarousel(5),matchMedia){var t=window.matchMedia("(max-width: 991px)");t.addListener(n);n(t)}}function n(n){n.matches?$(".edit-btn").removeClass("btn theme-btn theme-btn-sm theme-btn-to-primary").empty().append("<i class='fa fa-pencil'><\/i>"):$(".edit-btn").addClass("btn theme-btn theme-btn-sm theme-btn-to-primary").empty().append("<i class='fa fa-pencil'><\/i> Edit")}return{Init:function(){t()}}}(),discountValue;$("section#my-cart #my-cart-items table.product-section").stacktable({headIndex:1,myClass:"mobile-cart",displayHeader:!1,orderIndex:[1,2,3,4,0],excludeRow:".decoration-options",getCustomTableHtml:function(n){return $('.decoration-options-section table.decoration-details-mobile[data-id="'+n+'"]').html()}});$(".product-show-details a").on("click",function(n){n.preventDefault();var t=parseInt($(this).data("id"));$('section#my-cart table#my-cart-items table.product-section[data-id="'+t+'"] tr.decoration-options').is(":visible")?($('section#my-cart table#my-cart-items table.product-section[data-id="'+t+'"] tr.edit-size-section').hide(),$('section#my-cart table#my-cart-items table.product-section[data-id="'+t+'"] tr.decoration-options').hide(),$('section#my-cart table#my-cart-items table.product-section[data-id="'+t+'"] tr td.product-show-details a').html('<i class="fa fa-eye"><\/i> Show Details')):($('section#my-cart table#my-cart-items table.product-section[data-id="'+t+'"] tr.edit-size-section').show(),$('section#my-cart table#my-cart-items table.product-section[data-id="'+t+'"] tr.decoration-options').show(),$('section#my-cart table#my-cart-items table.product-section[data-id="'+t+'"] tr td.product-show-details a').html('<i class="fa fa-eye-slash"><\/i> Hide Details'))});$("td.remove > a").popover({trigger:"manual",template:'<div class="popover remove-item-popover" role="tooltip"><div class="arrow"><\/div><h3 class="popover-title"><\/h3><div class="popover-content"><\/div><\/div>',html:!0,animation:!1,content:function(){return $("#removeItemTemplate").html()}}).on("mouseenter",function(){var n=this;$(this).popover("show");$(".remove-item-popover").on("mouseleave",function(){$(n).popover("hide")})}).on("mouseleave",function(){var n=this;setTimeout(function(){$(".remove-item-popover:hover").length||$(n).popover("hide")},300)}).on("shown.bs.popover",function(n){n.preventDefault();var t=parseInt($(this).closest("tr").data("id"));$("#remove-item-btn").off();$("#remove-item-btn").on("click",function(){$.form("/cart/removeitem/",{itemId:t},"POST").submit()})});$("td.remove button").on("click",function(){var n=parseInt($(this).data("item-id"));$.form("/cart/removeitem/",{itemId:n},"POST").submit()});$(".size-price div,.product-price div,.subtotal-price span,.total-price span,.decoration-price span,.decoration-price div,.product-quantity-total span,.size-quantity-total span,.setup-price span").each(function(){parseFloat($(this).html())&&$(this).html(numeral($(this).html()).format("$0,0.00"))});parseFloat($(".subtotal-discount-value span").html())&&(discountValue=-parseFloat($(".subtotal-discount-value span").html()),$(".subtotal-discount-value span").html(numeral(discountValue).format("$0.00")));$("#product-shipping").select2({minimumResultsForSearch:-1});$("#promo-code-form").on("submit",function(n){var t,i;n.preventDefault();t=$.trim($(this).find('input[name="promo-code"]').val());t&&(i="Promo code <strong>"+t+"<\/strong> not found.",$(".promo-code-error").length?$("p.promo-code-error").html(i):$("<p />",{html:i,"class":"error promo-code-error"}).insertAfter($("#promo-code-form div.input-group")))});$(".size-price div.sale-price,.product-price div.sale-price,.decoration-price div.sale-price").each(function(){$(this).parent().find("div.regular-price").css("text-decoration","line-through")})