import{u as n,s as p,x as h,H as m,b as g,o as e,c as o,h as f,j as _,an as v,a as c,F as k,l as x,e as P,t as b,p as y,r as B}from"./app-B-4i4xU3.js";import{P as w}from"./ProductCard-Bre1aBlK.js";const N={class:"p-3 md:p-4 xl:p-6"},V={class:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5 gap-6 items-start"},W={key:0,class:"p-3 md:p-4 xl:p-6 bg-white dark:bg-slate-800 rounded-lg md:rounded-2xl border border-slate-100 dark:border-slate-700 italic"},R={__name:"Wishlist",setup(A){const i=n(),u=p(),t=h(),a=B([]);m(()=>t.favoriteProducts,()=>{i.name==="wishlist"&&d()}),g(()=>{d()});const d=async()=>{axios.get("/favorite-products",{headers:{Authorization:t.token}}).then(s=>{var r;a.value=s.data.data.products,t.favoriteProducts=((r=s.data.data.products)==null?void 0:r.length)??0}).catch(s=>{s.response.status===401&&(t.token=null,t.user=null,t.addresses=[],t.favoriteProducts=0,u.push("/"))})};return(s,r)=>(e(),o("div",null,[f(v,{title:"Wishlist ("+_(t).favoriteProducts+")"},null,8,["title"]),c("div",N,[c("div",V,[(e(!0),o(k,null,x(a.value,l=>(e(),P(w,{key:l.id,product:l},null,8,["product"]))),128))]),a.value.length==0?(e(),o("div",W,b(s.$t("Wishlist is empty")),1)):y("",!0)])]))}};export{R as default};
