import{_ as y,j as k,o as a,g as n,w as r,i as u,n as x,an as b,aC as V,q as v,s as l,t as o,v as f,h as c,N as q,p as T,f as _,A as h,D as C,k as w,G as P,F as H,au as B,x as L,y as M,T as N,M as D}from"./index-Bmj_12NV.js";const I={name:"ProductCard",props:["product","slider"],methods:{navigate(t,e){this.$router.push({name:t,params:e}).catch(()=>{})},productPrice(){if(this.product&&this.product.price)return"£"+this.product.price;if(this.product.forms&&this.product.forms.length>0){let t=[];for(let e in this.product.forms)for(let s in this.product.forms[e].sizes)t.push(this.product.forms[e].sizes[s].price);return t.sort(function(e,s){return e-s}),"Between £"+t[0]+" and £"+t[t.length-1]}else return null},hasDiscountGroupText(){if(this.product.price&&this.product.discount_groups&&this.product.discount_groups.length>0)for(let t in this.product.discount_groups){let e=this.product.discount_groups[t];if(e.products_count>1||e.products_count===1&&e.qualifying_quantity===1||e.products_count===1&&e.qualifying_quantity>1)return!0}return!1},discountGroupText(t){if(t.products_count>1||t.products_count===1&&t.qualifying_quantity===1){let e=this.$t("links.Buy any {quantity} get {discount} off",{quantity:t.qualifying_quantity,discount:t.discount+"%"});return this.product.exclude_from_discounts_in_uk?e+=" (discount restrictions apply in the UK)":this.product.is_restricted&&(e+=" (discount restrictions apply in "+this.product.restricted_from_country+")"),e}else if(t.products_count===1&&t.qualifying_quantity>1){let e=this.$t("Buy {quantity} or more get {discount} off",{quantity:t.qualifying_quantity,discount:t.discount+"%"});return this.product.exclude_from_discounts_in_uk&&(e+=" (discount restrictions apply in the UK)"),this.product.is_restricted&&(e+=" (discount restrictions apply in "+this.product.restricted_from_country+")"),e}return null},truncate(t,e){return t.length>e?t.substring(0,e)+"...":t},navigateToProduct(t){return"/"+this.$i18n.locale+"/"+this.$t("routes.shop")+"/"+t}},computed:{frontendHost(){return"https://helios.co.uk"},imagesHost(){return"https://images.helios.co.uk"}}},S={key:0,class:"text-body-1"},j=["innerHTML"],z={class:"text-subtitle-1 font-weight-bold mt-3"},A=["innerHTML"],F={class:"text-red"},K={key:0},U={key:1};function E(t,e,s,R,J,i){const d=k("router-link");return a(),n(D,null,{default:r(({isHovering:g,props:p})=>[u(N,{name:"fade"},{default:r(()=>[u(x,b(p,{class:"mx-auto d-flex flex-column",elevation:g?4:2,style:{height:"100%"}}),{default:r(()=>[u(V,null,{default:r(()=>[u(v,{class:"text-h5 text-primary text-left",style:{"white-space":"break-spaces!important"}},{default:r(()=>[u(d,{hreflang:t.$i18n.locale,to:i.navigateToProduct(s.product.slug)},{default:r(()=>[l(o(s.product.name),1)]),_:1},8,["hreflang","to"])]),_:1}),s.product.brand?(a(),n(f,{key:0,class:"text-subtitle-1 font-weight-regular"},{default:r(()=>[u(d,{to:{name:"brand",params:{slug:s.product.brand.slug}}},{default:r(()=>[l(o(t.$t("links.View all by"))+" "+o(s.product.brand.name),1)]),_:1},8,["to"])]),_:1})):c("",!0),s.product.book?(a(),n(f,{key:1,class:"text-subtitle-1 font-weight-regular"},{default:r(()=>[l(o(s.product.book.author),1)]),_:1})):c("",!0),s.product.common_name?(a(),n(f,{key:2,class:"text-subtitle-1 font-weight-regular pb-0"},{default:r(()=>[l(o(s.product.common_name),1)]),_:1})):c("",!0),s.product.is_remedy?(a(),n(f,{key:3,class:"text-overline font-weight-regular pt-0"},{default:r(()=>[l("Remedy")]),_:1})):c("",!0)]),_:1}),u(q,{class:"text--primary text-left pb-0"},{default:r(()=>[u(d,{hreflang:t.$i18n.locale,to:i.navigateToProduct(s.product.slug)},{default:r(()=>[s.product.path?(a(),n(T,{key:0,height:"200px",contain:"",src:i.imagesHost+"/assets/product-tile-medium/"+s.product.path,srcset:i.imagesHost+"/assets/product-tile-large/"+s.product.path+" 2x",class:"mb-3"},null,8,["src","srcset"])):c("",!0)]),_:1},8,["hreflang","to"]),s.product.summary?(a(),_("div",S,[h("span",{class:"block",innerHTML:i.truncate(s.product.summary,80)},null,8,j)])):c("",!0),h("div",z,[h("span",{innerHTML:i.productPrice()},null,8,A)]),i.hasDiscountGroupText?(a(),n(C,{key:1,class:"pa-0"},{default:r(()=>[(a(!0),_(H,null,w(s.product.discount_groups,m=>(a(),n(P,{key:m.slug,onClick:O=>i.navigate("discount",{slug:m.slug})},{default:r(()=>[h("span",F,o(i.discountGroupText(m)),1)]),_:2},1032,["onClick"]))),128))]),_:1})):c("",!0)]),_:1}),u(B),u(L,{class:"d-flex justify-center"},{default:r(()=>[u(d,{hreflang:t.$i18n.locale,to:i.navigateToProduct(s.product.slug),class:"contains-btn"},{default:r(()=>[u(M,{variant:"flat",class:"small mb-2",elevation:"0",color:"primary"},{default:r(()=>[s.product.is_remedy?(a(),_("span",K,o(t.$t("buttons.View remedy")),1)):(a(),_("span",U,o(t.$t("buttons.View product")),1))]),_:1})]),_:1},8,["hreflang","to"])]),_:1})]),_:2},1040,["elevation"])]),_:2},1024)]),_:1})}const W=y(I,[["render",E],["__scopeId","data-v-9ee15d7c"]]);export{W as P};
//# sourceMappingURL=ProductCard-B4PeaMUS.js.map