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