import{_ as O}from"./NuxtImg.vue.ab71dd3e.js";import{_ as U}from"./nuxt-link.8f403771.js";import{_ as x}from"./no-image.ca1c178e.js";import{_ as A,a as L,b as P}from"./trash-can.00152ee5.js";import{d as Q,A as z,ag as R,g as f,h as y,o,c as n,u as t,k as w,w as S,n as m,l as r,a,t as l,E,b as T,D as J,a4 as M}from"./entry.c2e76d15.js";const F=""+globalThis.__publicAssetsURL("fontawesome/darkest/regular/minus.svg"),G=""+globalThis.__publicAssetsURL("fontawesome/darkest/regular/plus.svg"),W={class:"MiniCartProduct flex w-full py-16 border-b border-light first:pt-0 last:border-none"},H={key:1,src:x,class:"aspect-product w-64 rounded-md",alt:"no image"},K={class:"type-xs mb-8"},X={key:0},Y={key:1,class:"type-tiny"},Z={key:0},ee={class:"text-tiny"},te={key:0,class:"text-error"},se={key:2,class:"text-tiny"},ie=a("img",{src:P,class:"w-12",alt:"trash"},null,-1),ae=[ie],oe={key:0,class:"basis-80 shrink-0"},ne=a("img",{src:L,class:"w-12 mr-4"},null,-1),re={key:1,class:"flex items-center basis-full"},le=["disabled"],ce=a("img",{src:F,class:"w-12",alt:"-"},null,-1),ue=[ce],me={class:"type-xs px-16"},de=a("img",{src:G,class:"w-12",alt:"+"},null,-1),pe=[de],fe={key:0,class:"type-xs text-darker whitespace-nowrap"},ye={key:1,class:"type-xs text-darker line-through whitespace-nowrap"},he=Q({__name:"MiniCartProduct",props:{item:{},disableInteraction:{type:Boolean}},setup($){const i=$,_=z(),N=R();let b;const u=f(!1),{productUrl:D}=J(),d=f(i.item.quantity),v=f(!1),g=f(!1),I=e=>{u.value=!0,v.value=!1;let s=d.value+e;s<=0&&(s=1);const k=new Date().toISOString().split("T")[0],p=i.item.stockStatus.estimatedDelivery&&i.item.stockStatus.estimatedDelivery>k;if(!Object.keys(M).includes(i.item.partNo)&&s>i.item.stockStatus.value&&!p){u.value=!1,v.value=!0;return}d.value=s,b&&clearTimeout(b),b=setTimeout(()=>{B()},800)},V=()=>{d.value=0,B()},B=async()=>{await N.updateCart(i.item.partNo,d.value,i.item.lineNo,!1,i.item,!0),u.value=!1},c=y(()=>{const e=i.item.infoTypes.find(s=>s.name==="nametag_json");return e?JSON.parse(e.value):!1}),j=y(()=>{var e;return(e=i.item.infoTypes.find(s=>s.name==="nametag_custom_bg_preview"))==null?void 0:e.value}),q=y(()=>{var e;return(e=i.item.infoTypes.find(s=>s.name==="nametag_custom_img_preview"))==null?void 0:e.value}),C=y(()=>{if(i.item.stockStatus.leadtimeDayCount){let e=i.item.stockStatus.leadtimeDayCount;return e=e<=0?5:e,`${e-1}-${e+1}`}return null});return(e,s)=>{const k=O,p=U;return o(),n("div",W,[t(c)?r("",!0):(o(),w(p,{key:0,to:t(D)(e.item.url),class:m(["basis-64 shrink-0 ratio-product block relative",{"opacity-50":t(u)}])},{default:S(()=>[e.item.image?(o(),w(k,{key:0,preset:"standard",provider:"norce",loading:"lazy",sizes:"sm:124px",src:e.item.image,class:"w-64 rounded-md"},null,8,["src"])):(o(),n("img",H))]),_:1},8,["to","class"])),a("div",{class:m(["w-full flex flex-col justify-between",{"ml-16":!t(c)}])},[a("div",{class:m(["flex justify-between items-start",{"opacity-50":t(u)}])},[a("div",K,[e.disableInteraction?(o(),n("span",X,l(i.item.quantity)+" x ",1)):r("",!0),E(p,{to:t(D)(e.item.url)},{default:S(()=>[T(l(e.item.name),1)]),_:1},8,["to"]),t(c)?(o(),n("div",Y,[a("span",null,l(t(c).text1),1),t(c).text2!==""?(o(),n("span",Z,", "+l(t(c).text2),1)):r("",!0)])):r("",!0),a("div",ee,[T(l(e.item.variantName)+" ",1),t(v)?(o(),n("div",te,l(e.$t("stock.lowstock",{num:e.item.stockStatus.value})),1)):r("",!0)]),t(C)?(o(),n("div",se,l(e.$t("stock.sendWithinDays",{num:t(C)})),1)):r("",!0)]),e.disableInteraction?r("",!0):(o(),n("button",{key:0,class:"pl-16 relative top-4",onClick:V},ae))],2),a("div",{class:m(["flex items-center",{"justify-between":!e.disableInteraction,"justify-end":e.disableInteraction}])},[t(c)?(o(),n("div",oe,[a("button",{class:"btn btn--secondary btn--notSelected btn--sm py-2",onClick:s[0]||(s[0]=h=>g.value=!0)},[ne,T(" "+l(e.$t("nametag.showFromCart")),1)])])):r("",!0),e.disableInteraction?r("",!0):(o(),n("div",re,[a("button",{class:"btn btn--secondary btn--notSelected btn--round btn--sm",disabled:i.item.quantity<=1,onClick:s[1]||(s[1]=h=>I(-1))},ue,8,le),a("div",me,l(i.item.quantity),1),a("button",{class:"btn btn--secondary btn--notSelected btn--round btn--sm",onClick:s[2]||(s[2]=h=>I(1))},pe)])),a("div",{class:m(["text-right",{"opacity-50":t(u)}])},[i.item.quantity>1?(o(),n("div",fe,l(e.$t("minicart.each",{price:t(_).isB2B?e.item.priceInfo.priceBeforeVatDisplay:e.item.priceInfo.priceDisplay})),1)):r("",!0),a("div",{class:m(["type-xs-medium whitespace-nowrap",{"text-error":e.item.priceInfoTotal.price!==e.item.priceInfoTotal.priceBeforeDiscount&&e.item.priceInfoTotal.isOnSale}])},l(t(_).isB2B?e.item.priceInfoTotal.priceBeforeVatDisplay:e.item.priceInfoTotal.priceDisplay),3),e.item.priceInfoTotal.price!==e.item.priceInfoTotal.priceBeforeDiscount&&e.item.priceInfoTotal.isOnSale?(o(),n("div",ye,l(t(_).isB2B?e.item.priceInfoTotal.priceBeforeDiscountBeforeVatDisplay:e.item.priceInfoTotal.priceBeforeDiscountDisplay),1)):r("",!0)],2)],2)],2),t(c)&&t(g)?(o(),w(A,{key:1,"selected-data":t(c),"bg-url":t(j),"img-url":t(q),onClosePreview:s[3]||(s[3]=h=>g.value=!1)},null,8,["selected-data","bg-url","img-url"])):r("",!0)])}}});export{he as _};
