$(document).ready(function(){function setCookie(name,value,days){var expires="";if(days){var date=new Date;date.setTime(date.getTime()+days*24*60*60*1e3),expires="; expires="+date.toUTCString()}document.cookie=name+"="+(value||"")+expires+"; path=/"}}),$(document).ready(function(){$(".iframe").fancybox({modal:!0,toolbar:!0,smallBtn:!0,preload:!1,infocus:!0,autoFocus:!1,showCloseButton:!0,closeBtn:'',ajax:{preload:!1}})}),$(document).ready(function(){window.themeJsData.templateName!=="product"&&localStorage.removeItem("product-click"),localStorage.setItem("checkout-value",1),window.themeJsData.cartItemCount<=0&&(localStorage.setItem("cart",null),localStorage.removeItem("cart_updated"),localStorage.removeItem("search_value"));var pageName2=window.location.href;$(document).on("click",".disable-btn",function(event){event.preventDefault()}),$(document).on("click",".product-scratch-list",function(e){var item_id=$(this).find(".frequent-products-mpn").val(),item_name=$(this).find(".frequent-products-tittlr").val(),item_category=$(this).find(".item_category").val();if(pageName2.includes("products"))var mpn_handle=$("#mpn_handle").val(),item_list_page="ATTACH :: "+mpn_handle;else if(pageName2.includes("cart"))var item_list_page="ATTACH :: Cart Page";else var item_list_page="ATTACH :: "+formatString($(this).find(".item_list_page").val());var currency=$(this).find(".item_currency").val(),price=$(this).find(".item_price").val(),item_sku=$(this).find(".list-sku").val(),productcomPrice2=$(this).find(".item_compare_price").val();localStorage.setItem("product-click",item_list_page);var productPrice=Number(price.replace(/[^0-9.-]+/g,"")),discount=0;productcomPrice2&&(productcomPrice2=Number(productcomPrice2.replace(/[^0-9.-]+/g,"")),productcomPrice2>productPrice&&(discount=parseFloat(productcomPrice2)-parseFloat(productPrice),discount=parseFloat(discount))),dataLayer.push({ecommerce:null}),dataLayer.push({event:"select_item",ecommerce:{item_list_name:item_list_page,items:[{item_id:item_sku,item_name,item_category,item_list_name:item_list_page,price:parseFloat(productPrice),quantity:1}]}})}),$(document).on("click",".predictive-search__results-list .predictive-search__list-item--product",function(e){localStorage.setItem("product-click","Search Quick View")}),$(document).on("click",".predictive-search__search-for-button, .predictive-search__results-list .predictive-search__list-item--suggestions",function(e){localStorage.setItem("product-click","Search Results")}),$(document).on("click",".plp_page_ga",function(e){localStorage.setItem("product-click","PLP :: "+formatString(pageName2.split("/")[pageName2.split("/").length-1]))});var attch_prod=[];$(".product-list-contain").each(function(key,val){var id=$(this).attr("id"),sliderId="#"+id,item_list_name="",productPrice=0,discount=0,prodQuant=1;$(sliderId+" li").each(function(key1,val2){if(item_ga={},productPrice=$(this).find(".item_price").val(),productcomPrice=$(this).find(".item_compare_price").val(),productPrice&&(productPrice=Number(productPrice.replace(/[^0-9.-]+/g,""))),discount=0,productcomPrice&&(productcomPrice=Number(productcomPrice.replace(/[^0-9.-]+/g,"")),productcomPrice>productPrice&&(discount=parseFloat(productcomPrice)-parseFloat(productPrice),discount=parseFloat(discount),value_price=productcomPrice*parseInt(prodQuant))),item_ga.item_id=$(this).find(".list-sku").val(),item_ga.item_name=$(this).find(".frequent-products-tittlr").val(),item_ga.item_category=$(this).find(".item_category").val(),pageName2.includes("products")){var mpn_handle=$("#mpn_handle").val();item_list_name="ATTACH :: "+mpn_handle}else pageName2.includes("cart")?item_list_name="ATTACH :: Cart Page":item_list_name="ATTACH :: "+formatString($(this).find(".item_list_page").val());item_ga.item_list_name=item_list_name,item_ga.price=parseFloat(productPrice),item_ga.quantity=1,attch_prod.push(item_ga)}),attch_prod.length!=0&&(dataLayer.push({ecommerce:null}),dataLayer.push({event:"view_item_list",ecommerce:{item_list_name,items:attch_prod}})),attch_prod=[]}),$("#cart-notification").hide(),$("#cart-notification").removeClass("minicart-active"),$("#cart-icon-bubble").click(function(evt){evt.stopPropagation(),$("#cart-notification").toggle(),$("#cart-notification").toggleClass("minicart-active")}),$("#close-cart").click(function(evt){$("#cart-notification").hide(),$("#cart-notification").removeClass("minicart-active")})}),window.mobileSearchNormalLayout=!0,window.autocompleteFormSelector=".mob_search:visible, .search-modal__form:visible",$(document).on("click",".card-slider-buttons_2",function(e){e.preventDefault();var prodId=$(this).attr("data-productid"),prodQuant=1,prodMaxqut=$(this).attr("data-productmaxquantity");if(prodMaxqut!=""){var maxQuant=checkMaxquantity(prodId);if(maxQuant!="")var max_total_quantity=parseInt(prodQuant)+parseInt(maxQuant);else var max_total_quantity=parseInt(prodQuant);if(max_total_quantity>prodMaxqut)return alert(quantity_limit_error_message),!1}var slider_variantid=$(".prod_details_"+prodId).find(":selected").val(),slider_tag=$(this).attr("data-tag"),main_product_sku=$(this).attr("data-productsku"),productList=$(this).attr("data-productlist"),productCategory=$(this).attr("data-producttype"),productPrice=$(this).attr("data-productprice"),productCurrency=$(this).attr("data-productcurrency"),productTitle=$(this).attr("data-producttitle"),prohandle=$(this).attr("data-producthandle"),mpnHandle=$(this).attr("data-productMPN"),mpnHandleVariant="";if(vat_free_day==!0){var addtaxfree=slider_tag.indexOf("taxfree")!=-1;if(addtaxfree==!0&&getCookie("total_quantity")>=vat_free_quantity)return alert(vat_free_message),!1}$("#slider-form-"+slider_variantid).attr("aria-disabled",!0),$("#slider-form-"+slider_variantid).addClass("loading"),$(".loading-overlay__spinner-frequent").removeClass("hidden");var viewurl=`${window.Shopify.routes.root}products/' + prohandle + '?variant=' + slider_variantid + '&view=mpn`;return $.ajax({type:"GET",url:viewurl,async:!1,success:function(itemData){let arrprod=itemData.split("|");mpnHandle.length==0?arrprod[1]!=""?mpnHandleVariant=arrprod[1]:mpnHandleVariant=arrprod[0]:mpnHandleVariant=mpnHandle,productPrice=arrprod[2]}}),mpnHandleVariant=mpnHandleVariant.trim(),fetch(`${window.Shopify.routes.root}cart/add.js`,{method:"post",headers:{"content-type":"application/json"},body:JSON.stringify({items:[{id:slider_variantid,quantity:1,properties:{_uuid:prohandle}}]})}).then(response=>{response.json().then(d=>{var productList2="Search Results";cartCookie(mpnHandleVariant,d.items[0].key,productList2)}),checkQuantity(),triggerGAAddToCart(mpnHandleVariant,productTitle,productCategory,productList,productCurrency,productPrice,prodQuant,main_product_sku,slider_variantid),$.get(`${window.Shopify.routes.root}cart?view=minicart`,function(itemData){var item_count=jQuery(itemData).find("#cart-notification-button .count").text();$(".cart-count-bubble").length>0||$("#cart-icon-bubble").append('
'),$(".cart-count-bubble span").text(item_count),$("#cart-notification").text("");var textreplace="
";$("#cart-notification").append(textreplace),$("#cart-notification").replaceWith(itemData),$("#cart-notification").addClass("minicart-active")}),$("#slider-form-"+slider_variantid).attr("aria-disabled",!1),$("#slider-form-"+slider_variantid).removeClass("loading"),$(".loading-overlay__spinner-frequent").addClass("hidden")}).catch(error=>(console.log("Error:",error),!1)),!1});var pageName=window.location.href;if(pageName.includes("search")){var urlParams=new URLSearchParams(window.location.search),search_term_str=urlParams.get("q"),search_term=formatString(search_term_str);localStorage.setItem("search_value_term",search_term);var first_search=localStorage.getItem("search_value");$(".product-grid").each(function(key,val){var item_list_name="Search Results",productPrice=0,discount=0,prodQuant=1;$(".product-grid li").each(function(key1,val2){item_ga={},productPrice=$(this).find(".item_price").val(),productcomPrice=$(this).find(".item_compare_price").val(),productPrice&&(productPrice=Number(productPrice.replace(/[^0-9.-]+/g,""))),discount=0,productcomPrice&&(productcomPrice=Number(productcomPrice.replace(/[^0-9.-]+/g,"")),productcomPrice>productPrice&&(discount=parseFloat(productcomPrice)-parseFloat(productPrice),discount=parseFloat(discount),value_price=productcomPrice*parseInt(prodQuant))),item_ga.item_id=$(this).find(".list-sku").val(),item_ga.item_name=$(this).find(".frequent-products-tittlr").val(),item_ga.item_category=$(this).find(".item_category").val(),item_ga.item_list_name=item_list_name,item_ga.price=parseFloat(productPrice),item_ga.quantity=1,dataLayer.push({event:"view_item_list",ecommerce:{search_term,item_list_name:"Search Results",items:[item_ga]}})})})}function formatString(str){return str&&str.replace(/(\B)[^ ]*/g,match=>match.toLowerCase()).replace(/^[^ ]/g,match=>match.toUpperCase())}function cartCookie(mpnHandleVariant,prodVariantID,productList){if(first_search==null){localStorage.setItem("search_value",search_term);var first_search_str=localStorage.getItem("search_value");first_search=formatString(first_search_str)}var exphone=[],item_cart={};item_cart.cart_item_id=prodVariantID,item_cart.cart_item_list_name=productList,item_cart.cart_search_term=first_search,item_cart.cart_item_mpn=mpnHandleVariant,JSON.parse(localStorage.getItem("cart"))!=null&&(exphone=JSON.parse(localStorage.getItem("cart"))),exphone.push(item_cart),localStorage.setItem("cart",JSON.stringify(exphone))}function triggerGAAddToCart(prodVariantID,productTitle,productCategory,productList,productCurrency,productPrice,prodQuant,main_product_sku,slider_variantid){if(first_search==null){localStorage.setItem("search_value",search_term);var first_search_str=localStorage.getItem("search_value");first_search=formatString(first_search_str)}productPrice&&(productPrice=Number(productPrice.replace(/[^0-9.-]+/g,"")));var discount=0,prodQuant=1,productCurrency=window.themeJsData.shopCurrency,value_price2=productPrice*parseInt(prodQuant),value_price1=parseFloat(value_price2),productPrice1=parseFloat(productPrice);dataLayer.push({ecommerce:null}),dataLayer.push({event:"add_to_cart",ecommerce:{search_term,currency:productCurrency,value:value_price1,item_list_name:"Search Results",currency:window.themeJsData.shopCurrency,items:[{item_id:main_product_sku,item_name:productTitle,item_category:productCategory,price:productPrice,quantity:1}]}})}$(document).ready(function(){function eraseCookie(name){document.cookie=name+"=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;"}var template1=window.themeJsData.templateStrip;template1!="product"&&(eraseCookie("option1select"),eraseCookie("option2select"),eraseCookie("option3select"),eraseCookie("optionPIDlist"))}),document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll(".apl_lob_title").forEach(function(item){if(item.textContent.includes("iPad Air de 13 pulgadas M3")||item.textContent.includes("iPad Air de 11 pulgadas M3")||item.textContent.includes("A16")){const priceElement=item.closest(".apl_lob_content").querySelector(".apl_lob_price");priceElement&&(priceElement.style.display="none")}})}),document.addEventListener("DOMContentLoaded",function(){let imagenEspecifica="iPad_A16-Desktop";document.querySelectorAll('[id^="Slide-template--"]').forEach(function(banner){let imagen=banner.querySelector("img");imagen&&imagen.src.includes(imagenEspecifica)&&(console.log("Imagen encontrada en:",banner.id),banner.style.position="relative",banner.style.background="linear-gradient(to bottom, #aedcee 0%, #b0ddee 20%, #b7dfef 40%, #c8e6f1 60%, #dcedf3 80%, #ebf3f5 90%, #f1f6f7 100%)",banner.style.backgroundSize="cover",banner.style.backgroundPosition="center",banner.style.backgroundRepeat="no-repeat",banner.querySelectorAll('[style*="background-color: #f6f5f8"]').forEach(function(div){div.style.backgroundColor="transparent"}))})}); //# sourceMappingURL=/cdn/shop/t/39/assets/theme.js.map?v=117628404046644531341741368797