1function r(o){o.data("wishlistButton",e=>({productId:e,inWishlist:!1,loading:!1,async init(){if(document.querySelector('meta[name="customer-token"]')?.content)try{const n=await fetch((window.STORE_BASE_URL||"")+"/conta/api/wishlist");if(n.ok){const i=await n.json(),s=Array.isArray(i.data)?i.data:[];this.inWishlist=s.some(a=>a.productId===this.productId)}}catch{}},async toggle(){this.loading=!0;try{const t=document.querySelector('meta[name="csrf-token"]')?.content,n={"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"};t&&(n["X-CSRF-TOKEN"]=t);const i=await fetch((window.STORE_BASE_URL||"")+`/conta/api/wishlist/${this.productId}`,{method:"POST",headers:n});if(i.ok){const s=await i.json();this.inWishlist=s.data?.added??!this.inWishlist}else i.status===401&&(window.location.href=(window.STORE_BASE_URL||"")+"/conta/login?redirect="+encodeURIComponent(window.location.pathname))}catch{}finally{this.loading=!1}}})),o.data("wishlistPage",()=>({items:[],loading:!0,removing:null,async init(){await this.loadWishlist()},async loadWishlist(){this.loading=!0;try{const e=await fetch((window.STORE_BASE_URL||"")+"/conta/api/wishlist");if(e.ok){const t=await e.json();this.items=(Array.isArray(t.data)?t.data:[]).map(n=>({...n,product:n.product?{...n.product,featuredImageUrl:n.product.images?.[0]?.url||null,price:n.product.variants?.[0]?.price||0}:null}))}}catch{}finally{this.loading=!1}},async remove(e){this.removing=e;try{const t=document.querySelector('meta[name="csrf-token"]')?.content,n={"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"};t&&(n["X-CSRF-TOKEN"]=t),(await fetch((window.STORE_BASE_URL||"")+`/conta/api/wishlist/${e}`,{method:"POST",headers:n})).ok&&(this.items=this.items.filter(s=>s.productId!==e))}catch{}finally{this.removing=null}},normalizePriceToCents(e){const t=Number(e)||0;return t<=0?0:t>0&&t<1?Math.round(t*1e4):t>1e4?Math.round(t):Math.round(t*100)},formatCurrency(e){const t=this.normalizePriceToCents(e);return t<=0?window.storefrontPriceLabels?.list??"Sob consulta":new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"}).format(t/100)}}))}export{r as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.