(()=>{let e=!1,i="https://api.lerentools.com/";var t=LS.store.id,o=LS.product?.id;let a=t+"/products/labels/",n=t+"/products/"+o+"/labels/",d=null,c=null,s=null,p=null,m=!1,u=!1,b=!1;const g="lerentoolsLabelsProducts_"+LS.store.id,f="lerentoolsLabelsProductsLastRequestTimestamp_"+LS.store.id,l=window.localStorage||{},v=t=>{t=l.getItem(t);return t?JSON.parse(t):null},h=(t,e)=>{l.setItem(t,JSON.stringify(e))};var r,y,x,_;r=r=>{var t=v(f);const e=Math.floor(Date.now()/1e3);if(e-t<300&&(c=v(g)),"product"===LS.template){const l=e=>{if(d=e,m=!1,e.status&&e.product&&e.product.labels&&0"),"Trend"===LS.theme.name&&a.addClass("label-circle label-primary"),l=r("
"+s.description+"
"),o=r("
"),"image"===s.type?a.append(o):a.append(l),i[s.location].append(a)):(o=r("
"),l=r("
"),i=r("
"+s.description+"
"),a=r("
"),"image"===s.type?l.append(a):l.append(i),o.append(l),t.append(o)))}};d?s=s||setInterval(()=>{l(d)},1e3):m||(m=!0,r.get(i+n).done(l).fail(t=>{console.log("Error obteniendo cucardas personalizadas en PDP",t),m=!1}))}const o=t=>{if(c=t,b=!1,t&&t.status&&t.products&&t.products.length&&!u){u=!0;for(const n of t.products){var e,o,l,i,a=r("div[data-product-id='"+n.tn_id+"']");let t=a.find("div.js-product-container .item-image");0===(t=0===t.length?a.find("div.js-item-image-container"):t).length&&(t=a.find("div.item-image"));for(const s of n.labels)s.enabled&&s.show_at_grids&&(l={top_left:t.find("div.lerentools-custom-labels-top_left"),top_right:t.find("div.lerentools-custom-labels-top_right"),bottom_left:t.find("div.lerentools-custom-labels-bottom_left"),bottom_right:t.find("div.lerentools-custom-labels-bottom_right"),center:t.find("div.lerentools-custom-labels-center")},0==t.parent().find("div.lerentools-custom-label-"+s.id).length)&&(0"),"Trend"===LS.theme.name&&i.addClass("label-circle label-primary"),o=r("
"+s.description+"
"),e=r("
"),"image"===s.type?i.append(e):i.append(o),l[s.location].append(i)):(e=r("
"),o=r("
"),l=r("
"+s.description+"
"),i=r("
"),"image"===s.type?o.append(i):o.append(l),e.append(o),t.append(e)))}u=!1}};c?p=p||setInterval(()=>{o(c)},1e3):b||(b=!0,r.get(i+a).done(t=>{h(g,t),h(f,e),o(t)}).fail(t=>{console.log("Error obteniendo cucardas personalizadas en grid",t),b=!1}))},y=500,x=!0;const w=function(){var t=this,e=arguments,o=x&&!_;clearTimeout(_),_=setTimeout(function(){_=null,x||r.apply(t,e)},y),o&&r.apply(t,e)};const j=new MutationObserver(()=>{e?w(e):jQuery&&w(jQuery)}),S={attributes:!0,attributeFilter:["value"],childList:!0,subtree:!0,characterData:!0};t=[3,5,0],o="undefined"==typeof jQuery?[0,0,0]:$?.fn?.jquery?.split(".").map(t=>parseInt(t));if(o[0]{(e=jQuery.noConflict(!0))&&(j.observe(document.body,S),w(e))};let t=document.createElement("script");t.type="text/javascript",t.readyState?t.onreadystatechange=()=>{"loaded"!=t.readyState&&"complete"!=t.readyState||(t.onreadystatechange=null,L())}:t.onload=()=>{L()},t.src=o,document.getElementsByTagName("head")[0].appendChild(t)}else j.observe(document.body,S),w(jQuery);document.head.insertAdjacentHTML("beforeend",` `)})();