"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[6],{26:(i,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.useLogCollection=e.setupLogViewCart=e.logViewedProduct=e.logPageView=void 0;const n=t(89),a=t(9),o=t(3);e.logPageView=()=>{if("undefined"!=typeof window)try{(0,n.initBentoAnalytics)({elevar:!0}).then((()=>{console.log("Success on initBentoAnalytics()")}))}catch(i){console.error("Error in initBentoAnalytics():",i)}},e.logViewedProduct=(i,e)=>{var t;if(!i||"undefined"==typeof window)return;const o=null!==(t=null==i?void 0:i.variants.find((i=>i.variantId===e)))&&void 0!==t?t:null==i?void 0:i.variants[0];(0,n.initBentoAnalytics)({elevar:!0}).then((()=>{var e,t,l,r,d,c,u,s,v,p,g;const _=`${window.location.origin}${null===(e=o.image)||void 0===e?void 0:e.src}`,f=null!==(l=(0,a.safeParseFloat)(null!==(t=o.price)&&void 0!==t?t:"0"))&&void 0!==l?l:0,w=null!==(c=(0,a.safeParseFloat)(null!==(d=null!==(r=o.compareAtPrice)&&void 0!==r?r:o.price)&&void 0!==d?d:"0"))&&void 0!==c?c:0;(0,n.logViewContent)({discounted_price:f,discounts:[],featured_image:{aspect_ratio:1,alt:null!==(s=null===(u=o.image)||void 0===u?void 0:u.altText)&&void 0!==s?s:"",width:0,height:0,url:_},final_line_price:f,final_price:f,gift_card:!1,grams:0,handle:i.handle,id:null!==(v=o.id)&&void 0!==v?v:i.id,image:_,inventory:o.quantityAvailable,key:o.sku,line_level_discount_allocations:[],line_level_total_discount:0,line_price:f,options_with_values:o.selectedOptions,original_line_price:w,original_price:w,price:f,product_description:i.description,product_has_only_default_variant:1===i.variants.length,product_id:null!==(p=(0,a.safeParseInt)(i.id))&&void 0!==p?p:0,product_title:i.title,product_type:i.productType,properties:{},quantity:1,requires_shipping:!0,sku:o.sku,taxable:!0,title:i.title,total_discount:0,url:window.location.href,variant_id:null!==(g=(0,a.safeParseInt)(o.variantId))&&void 0!==g?g:0,variant_options:o.selectedOptions.map((i=>i.value)),variant_title:o.title,vendor:i.vendor})}))},e.setupLogViewCart=()=>{if("undefined"==typeof window)return;const i=document.querySelector("input#cart-toggle"),e=()=>{(0,n.initBentoAnalytics)({elevar:!0}).then(n.logViewCart)};(null==i?void 0:i.checked)&&e(),null==i||i.addEventListener("change",e)},e.useLogCollection=i=>(0,o.useEffect)((()=>{"undefined"!=typeof window&&(0,n.initBentoAnalytics)({elevar:!0}).then((()=>{var e;const t={title:i.title,id:0,url:i.handle};(0,n.logCollectionView)(Object.assign(Object.assign({},t),{title:null!==(e=t.title)&&void 0!==e?e:""}),i.products.map((e=>{var t,n,o,l,r,d,c,u,s,v,p;const g=e.variants[0],_={src:null===(t=g.image)||void 0===t?void 0:t.src,alt:null===(n=g.image)||void 0===n?void 0:n.altText,width:0,height:0,aspect_ratio:1},f=(0,a.safeParseFloat)(null!==(r=null!==(o=e.priceRange.minVariantPrice.amount)&&void 0!==o?o:null===(l=e.priceRange.maxVariantPrice)||void 0===l?void 0:l.amount)&&void 0!==r?r:"0"),w=(0,a.safeParseFloat)(null!==(p=null!==(v=null!==(u=null!==(c=null===(d=e.compareAtPriceRange.maxVariantPrice)||void 0===d?void 0:d.amount)&&void 0!==c?c:e.compareAtPriceRange.minVariantPrice.amount)&&void 0!==u?u:null===(s=e.priceRange.maxVariantPrice)||void 0===s?void 0:s.amount)&&void 0!==v?v:e.priceRange.minVariantPrice.amount)&&void 0!==p?p:"0");return{product:{compare_at_price:w,id:0,selectedOptions:[],url:window.location.href,title:e.title,type:i.title,image:_,price:f,vendor:e.vendor},selected_variant:{title:g.title,price:f,image:_,id:(0,a.safeParseInt)(g.id),compare_at_price:w,sku:g.sku,inventory_quantity:g.quantityAvailable,url:`${window.location.origin}/products/${e.handle}?variant=${g.id}`},quantity:1}})))}))}),[i])}}]);