import{s as G,x as H,v as I,g as M,o as a,c as i,a as e,B as d,t as s,j as l,p as O,h as n,G as J}from"./app-B-4i4xU3.js";import{_ as K}from"./Bag-lpVf_nHP.js";import{r as T}from"./ArrowRightIcon-Bi8FwamD.js";const L={class:"grid grid-cols-3"},Q=["src"],U={class:"bg-white dark:bg-slate-800 p-2 flex flex-col items-start gap-2 col-span-2"},W={class:"text-primary text-base font-bold leading-normal"},X={key:0,class:"text-slate-400 text-sm font-normal line-through leading-tight"},Y={key:1,class:"px-1 py-0.5 bg-red-500 rounded-2xl text-white text-xs font-medium"},Z={class:"flex justify-between items-center w-full"},tt={class:"text-slate-950 dark:text-white text-sm font-bold leading-tight"},et={class:"text-slate-500 dark:text-slate-400 text-sm font-normal leading-tight"},st={key:0,class:"text-right text-slate-500 text-sm font-normal leading-tight"},ot={key:1,class:"text-right text-red-500 text-sm font-normal leading-tight"},rt={key:0,class:"justify-start items-center gap-3 flex"},at={class:"w-5 h-5"},it={class:"text-slate-600 dark:text-slate-300 text-sm font-normal leading-tight"},lt={key:1,class:"justify-start items-center gap-2 flex"},dt={class:"text-red-500 text-sm font-normal leading-tight"},ht={__name:"ProductCardHorizontal",props:{product:Object},setup(V){var h;const P=new G;H();const c=I(),u=M(),t=V,R={is_buy_now:!1,product_id:(h=t.product)==null?void 0:h.id,quantity:1,size:null,color:null,unit:null},A=o=>{c.addToCart(R,o)},E=()=>{var o,r;c.addToCart({product_id:(o=t.product)==null?void 0:o.id,is_buy_now:!0,quantity:1,size:null,color:null,unit:null},t.product),c.buyNowShopId=(r=t.product)==null?void 0:r.shop.id},p=()=>{t.product.quantity>0&&P.push({name:"productDetails",params:{slug:t.product.slug}})};return(o,r)=>{var m,g,x,_,f,y,w,b,v,k,q,C,$,S,j,B,N,z,F,D;return a(),i("div",{class:d(["rounded-lg border dark:border-slate-700 transition-all duration-300 group bg-white dark:bg-slate-800 overflow-hidden relative",((m=t.product)==null?void 0:m.quantity)>0?"hover:border-primary":""])},[e("div",L,[e("div",{class:d(["w-full h-[124px] overflow-hidden shrink-0 cursor-pointer",((g=t.product)==null?void 0:g.quantity)>0?"":"opacity-30"]),onClick:p},[e("img",{src:(x=t.product)==null?void 0:x.thumbnail,class:"w-full h-full group-hover:scale-110 transition duration-500 object-contain",loading:"lazy"},null,8,Q)],2),e("div",U,[e("div",{class:"flex flex-col items-start gap-2 w-full cursor-pointer",onClick:p},[e("div",{class:d(["text-slate-950 dark:text-white text-base font-normal leading-normal truncate w-full",((_=t.product)==null?void 0:_.quantity)>0?"":"opacity-30"])},s((f=t.product)==null?void 0:f.name),3),e("div",{class:d(["flex items-center gap-2 flex-wrap",((y=t.product)==null?void 0:y.quantity)>0?"":"opacity-30"])},[e("div",W,s(l(u).showCurrency(((w=t.product)==null?void 0:w.discount_price)>0?(b=t.product)==null?void 0:b.discount_price:(v=t.product)==null?void 0:v.price)),1),((k=t.product)==null?void 0:k.discount_price)>0?(a(),i("div",X,s(l(u).showCurrency((q=t.product)==null?void 0:q.price)),1)):O("",!0),((C=t.product)==null?void 0:C.discount_percentage)>0?(a(),i("div",Y,s(($=t.product)==null?void 0:$.discount)+" "+s(((S=t.product)==null?void 0:S.discount_type)==0?"%"+o.$t("OFF"):l(u).currency.symbol+" "+o.$t("OFF")),1)):O("",!0)],2),e("div",Z,[e("div",{class:d(["flex items-center gap-1",((j=t.product)==null?void 0:j.quantity)>0?"":"opacity-30"])},[n(l(J),{class:"w-4 h-4 text-yellow-400"}),e("div",tt,s((B=t.product)==null?void 0:B.rating.toFixed(1)),1),e("div",et," ("+s((N=t.product)==null?void 0:N.total_reviews)+") ",1)],2),r[1]||(r[1]=e("div",{class:"h-3 w-[0px] border border-slate-200 dark:border-slate-600"},null,-1)),((z=t.product)==null?void 0:z.quantity)>0?(a(),i("div",st,s((F=t.product)==null?void 0:F.total_sold)+" "+s(o.$t("Sold")),1)):(a(),i("div",ot,s(o.$t("Stock Out")),1))])]),((D=t.product)==null?void 0:D.quantity)>0?(a(),i("div",rt,[e("button",{class:"cursor-pointer",onClick:r[0]||(r[0]=nt=>A(t.product))},[e("div",at,[n(K)])]),r[2]||(r[2]=e("div",{class:"w-1.5 h-1.5 bg-slate-200 dark:bg-slate-600 rounded-md"},null,-1)),e("button",{class:"justify-center items-center gap-0.5 flex",onClick:E},[e("div",it,s(o.$t("Buy Now")),1),n(l(T),{class:"w-4 h-4 text-slate-600 dark:text-slate-400"})])])):(a(),i("button",lt,[e("div",dt,s(o.$t("Request Stock")),1),n(l(T),{class:"w-4 h-4 text-red-500"})]))])])],2)}}};export{ht as _};
