"use strict";exports.id=8687,exports.ids=[8687],exports.modules={68687:(e,t,r)=>{r.d(t,{Q:()=>useBuyButton});var i=r(16689),a=r(16652),n=r(97358),d=r(71041);let useBuyButton=(e,t=!0)=>{let{openCart:u}=(0,a.l8)(),{currency:{code:m}}=(0,n.kP)(),s=Array.isArray(e),f=(0,i.useCallback)(i=>{if(i.preventDefault(),!e)return;let a=s?e.reduce((e,t)=>e+=t.price*t.quantity,0):e.price*e.quantity;function generatedItem(e){return{item_id:e.itemOffered.isVariantOf.productGroupID,item_name:e.itemOffered.isVariantOf.name,item_brand:e.itemOffered.brand.name,item_variant:e.itemOffered.sku,quantity:e.quantity,price:e.price,discount:e.listPrice-e.price,currency:m,item_variant_name:e.itemOffered.name,product_reference_id:e.itemOffered.gtin}}Promise.all([r.e(2792),r.e(6393)]).then(r.bind(r,66393)).then(({sendAnalyticsEvent:t})=>{t({name:"add_to_cart",params:{currency:m,value:a,items:s?e.map(generatedItem):[generatedItem(e)]}})}),s?e.forEach(e=>d.i8.addItem(e)):d.i8.addItem(e),t&&u()},[m,e,u,s]);return{onClick:f,"data-testid":"buy-button","data-sku":s?"sku-matrix-sidebar":e?.itemOffered.sku,"data-seller":s?e[0]?.seller.identifier:e?.seller.identifier}}}};