import{d as h,ac as R,ad as s,ae as g,af as V,ag as F,ah as W}from"./BDSHAsGJ.js";var q=(o=>(o.SHOP_CONNECT="SHOP_CONNECT",o.WEBSHOP="WEBSHOP",o))(q||{}),S=(o=>(o.SALES="SALES",o.MSC="MSC",o.EVENT="EVENT",o.ALL="ALL",o))(S||{}),L=(o=>(o.VAT_PERCENT="VATPERCENT",o))(L||{});function G(){const o=W(),I=h(()=>null,"$Gbapsh7Yoq"),b=h(()=>!1,"$b5SuBLGKyJ"),y={currency:h(()=>null,"$ub1JV10Q5g"),list:h(()=>[],"$qfu188ki3Z")},w={general:{addToCart(e,t){var a,i,r;e&&c({event:s.addToCart,product:{availability:{deliveryDays:(a=e.dataLayer)==null?void 0:a.deliveryDays,deliveryText:(i=e.availabilityIndicator)==null?void 0:i.availabilityText}},ecommerce_v2:{currencyCode:(r=e.price)==null?void 0:r.currencyIso,add:{products:[{...v(e),quantity:t||1}]}}})},removeFromCart(e,t,a){var i;e&&c({event:s.removeFromCart,cart_type:C(t),ecommerce_v2:{currencyCode:(i=e.price)==null?void 0:i.currencyIso,remove:{products:[{...v(e),quantity:a||1}]}}})}},pdp:{productDetailView(e){var t,a,i;e&&c({event:s.productDetailView,product:{availability:{deliveryDays:(t=e.dataLayer)==null?void 0:t.deliveryDays,deliveryText:(a=e.availabilityIndicator)==null?void 0:a.availabilityText}},ecommerce_v2:{currencyCode:(i=e.price)==null?void 0:i.currencyIso,detail:{products:[v(e)]}}})}},plp:{productClick(e,t){var a,i,r;e&&c({event:s.productClick,product:{availability:{deliveryDays:(a=e.dataLayer)==null?void 0:a.deliveryDays,deliveryText:(i=e.availabilityIndicator)==null?void 0:i.availabilityText}},ecommerce_v2:{currencyCode:(r=e.price)==null?void 0:r.currencyIso,click:{actionField:{list:"Category"},products:[{...v(e),position:t}]}}})}},search:{siteSearchTermInput(e,t){c({event:s.siteSearchTermEvent,siteSearchCategory:"General Site Search",siteSearchTerm:e,siteSearchResults:t.toString(),siteSearchFrom:"/search"})}},cart:{increaseCartProductQuantity(e,t,a){var i;e&&c({event:s.addToCart,cart_type:C(t),ecommerce_v2:{currencyCode:(i=e.price)==null?void 0:i.currencyIso,add:{products:[{...v(e),quantity:a||1}]}}})},viewCart(e){var r,l,d,u;if(!((r=e==null?void 0:e.entries)!=null&&r.length))return;const t=e.entries.map(_=>({...N(_.product),quantity:_.quantity||1}));let a=(l=e.subTotal)==null?void 0:l.value;const i=(d=e.totalTax)==null?void 0:d.value;i&&(a=a-i),c({event:s.viewCart,cart_type:C(e.processType),cart_notification:null,ecommerce:{currencyCode:(u=e.entries[0].product.price)==null?void 0:u.currencyIso,items:t,value:a}})},applyVoucherError(e,t){c({event:s.voucherError,voucher_code:e,error_message:t})},applyVoucherSuccess(e){c({event:s.voucherSuccess,voucher_code:e})}},myAppliances:{newApplianceRegistered({custom_item_id:e,custom_item_category:t}){c({event:"new_appliance_registered",custom_item_id:e,custom_item_category:t})},applianceRemoved({custom_item_id:e,custom_item_category:t}){c({event:"appliance_removed",custom_item_id:e,custom_item_category:t})},fileDownload(){c({event:"file_download"})},buyExtendedWarrantyClick(){c({event:"buy_extended_warranty_click"})},addPurchaseDateSuccess(){c({event:"add_purchase_date_success"})},warrantyAddToCart({formattedCode:e,name:t,price:a},{categoryName:i}){var r,l;c({event:s.addToCart,ecommerce_v2:{currencyCode:a==null?void 0:a.currencyIso,add:{products:[{id:e,name:t,price:(r=a==null?void 0:a.value)==null?void 0:r.toString(),full_price:(l=a==null?void 0:a.value)==null?void 0:l.toString(),price_reduction:void 0,brand:"",category:i,variant:"",quantity:1}]}}})}}},D={plp:{list:{filterSelected({option:e,category:t}){n({name:"filter_interaction",action:`Filter by ${t}`,category:"PLP - Filter refinement",label:e,interactionType:"filter_click",payload:{filter_category:t,filter_option:e}})},sortingSelected({option:e}){n({name:"sort_interaction",action:"Order by",category:"PLP - Filter refinement",label:e,interactionType:"sort_click",payload:{sort_option:e}})}},compare:{productAdded({productId:e}){n({name:"product_comparison_interaction",action:"PLP - Add to Comparison",category:"Product Comparison Tool",label:e,interactionType:"add",payload:{item_id:e}})},productRemoved(){n({name:"product_comparison_interaction",action:"Remove Comparison",category:"Product Comparison Tool",interactionType:"remove"})},comparisonCleared(){n({name:"product_comparison_interaction",action:"Clear Comparison",category:"Product Comparison Tool",interactionType:"clear"})}},product:{variantChanged({id:e,name:t}){n({name:"product_colour_interaction",action:"Colour variation",category:"PLP Interaction",label:t,interactionType:"button_click",payload:{item_variant:t,item_id:g(e)}})}}},pdp:{details:{variantChanged({id:e,name:t}){n({name:"product_colour_interaction",action:"Colour variation",category:"PDP Interaction",label:t,interactionType:"button_click",payload:{item_variant:t,item_id:g(e)}})},imageGalleryClicked({url:e}){n({name:"product_image_interaction",action:"image_gallery",category:"PDP Interaction",label:e,interactionType:"image_click",payload:{click_url:e}})}},reviews:{ratingClicked({code:e,category:t}){n({name:"reviews_click",action:"Reviews",category:"PDP Interaction",label:t,interactionType:"reviews_click",payload:{custom_item_category:t,custom_item_id:g(e)}})},viewAllClicked({code:e,category:t}){n({name:"view_all_reviews_click",action:"Reviews",category:"PDP Interaction",label:t,interactionType:"view_all_reviews_click",payload:{custom_item_category:t,custom_item_id:g(e)}})},showFullReviewClicked({code:e,category:t}){n({name:"show_full_review_click",action:"Reviews",category:"PDP Interaction",label:t,interactionType:"show_full_review_click",payload:{custom_item_category:t,custom_item_id:g(e)}})}},downloads:{itemClicked({label:e}){n({name:"product_download_interaction",action:"Technical information - Download",category:"PDP Interaction",label:e,interactionType:"button_click",payload:{click_text:e}})}},about:{accordionOpened({name:e}){n({name:"product_information_interaction",action:"About",category:"PDP Interaction",label:e,interactionType:"collapsible_click",payload:{click_text:e}})}},features:{highlightsReadMoreClicked({label:e,readMoreText:t}){n({name:"product_information_interaction",action:"Discover",category:"PDP Interaction",label:e,interactionType:"link_click",payload:{click_text:t,content_title:e}})},readMoreClicked({label:e,readMoreText:t}){n({name:"product_information_interaction",action:"Discover",category:"PDP Interaction",label:e,interactionType:"link_click",payload:{click_text:t,content_title:e}})},accordionOpened({name:e}){n({name:"product_information_interaction",action:"Discover",category:"PDP Interaction",label:e,interactionType:"tab_click",payload:{click_text:e,content_title:e}})}}},customerAssistance:{choosingCategory(e){n({name:"troubleshooting_interaction",category:"Troubleshooting",action:"Category",label:e,interactionType:"click",payload:{navigation_level:"Category",click_text:e}})},choosingSubCategory(e){n({name:"troubleshooting_interaction",category:"Troubleshooting",action:"Subcategory",label:e,interactionType:"click",payload:{navigation_level:"Subcategory",click_text:e}})},choosingArticle(e){n({name:"troubleshooting_interaction",category:"Troubleshooting",action:"Article list",label:e,interactionType:"click",payload:{navigation_level:"Article list",click_text:e}})},inputSearchValue(e,t){const i=t?"[redacted: possible email]":e;n({name:"troubleshooting_interaction",category:"Troubleshooting",action:"Article search",label:i,interactionType:"article_search",payload:{search_query:i}})},callToAction(e){n({name:"troubleshooting_interaction",category:"Troubleshooting",action:"Non article help",label:e,interactionType:"click",payload:{click_text:e}})},choosingFilterCategory(e){n({name:"troubleshooting_interaction",category:"Troubleshooting",action:"Filter",label:e,interactionType:"click",payload:{navigation_level:"Filter",click_text:e}})}}};R(y.list,()=>{y.list.value.length&&(c({event:s.impression,ecommerce_v2:{currencyCode:y.currency.value,impressions:y.list.value}}),y.list.value=[])},{debounce:V,maxWait:F});function x(e,t){var a;e&&(y.currency.value||(y.currency.value=(a=e.price)==null?void 0:a.currencyIso),y.list.value=[...y.list.value,{...v(e),position:t,list:"Category"}])}function A(){return o!=null&&o.dataLayer()?o==null?void 0:o.dataLayer():(window!=null&&window.dataLayer||(window.dataLayer=[]),window==null?void 0:window.dataLayer)}function P(e){var t,a,i;return((i=(a=(t=e.variantMatrix)==null?void 0:t.find(r=>{var l;return((l=r.variantOption)==null?void 0:l.code)===e.code}))==null?void 0:a.variantValueCategory)==null?void 0:i.name)||e.alternativeName}function v(e){var d,u,_,T,m,p,f,k,E;const a=((_=(u=(d=e.pricingFootnotesContainer)==null?void 0:d.pricingFootnotes)==null?void 0:u.find(O=>O.type===L.VAT_PERCENT))==null?void 0:_.value)/100+1,i=Math.round((parseFloat((T=e.dataLayer)==null?void 0:T.priceWithoutTax)+Number.EPSILON)*100)/100,r=Math.round(((((m=e.recommendedRetailPrice)==null?void 0:m.value)/a||i)+Number.EPSILON)*100)/100,l=i<r;return{id:e.formattedCode,name:(p=e.dataLayer)==null?void 0:p.name,price:(f=e.dataLayer)==null?void 0:f.priceWithoutTax,full_price:r.toString(),price_reduction:l?"Generic Price Discount":void 0,brand:(k=e.dataLayer)==null?void 0:k.brand,category:(E=e.dataLayer)==null?void 0:E.category,variant:P(e)}}function N(e){var i,r,l,d,u;const t={item_id:e.formattedCode,item_name:(i=e.dataLayer)==null?void 0:i.name,item_variant:P(e),price:(r=e.dataLayer)==null?void 0:r.priceWithoutTax,dimension29:(l=e==null?void 0:e.dataLayer)==null?void 0:l.deliveryDays,dimension30:(d=e==null?void 0:e.availabilityIndicator)==null?void 0:d.availabilityStatusColorCode},a=(u=e.dataLayer)==null?void 0:u.category;if(a){const _=RegExp("/(?!>)");a.split(_,4).forEach((T,m)=>{let p=`item_category${m+1}`;m==0&&(p="item_category"),t[p]=T})}return t}async function c(e){A().push(e)}function n(e){const t={event:s.interaction,event_name:e.name,eventCategory:e.category,eventAction:e.action,eventNonInteraction:0,eventLabel:e.label,interaction_type:e.interactionType,...e.payload||{}};c(t)}async function M(e){I.value=e,b.value=!0}return{isGtmEnabled:b,initialiseMetrics:M,pushImpression:x,events:w,interactions:D}}const C=o=>!o||o===S.ALL?"":`${o.toLowerCase()}_type`;export{S as C,q as a,G as u};