(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,73474,e=>{"use strict";let t=(0,e.i(56420).default)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);e.s(["Trash2",0,t],73474)},37492,e=>{"use strict";var t=e.i(43476),s=e.i(859),r=e.i(68109),i=e.i(71645),a=e.i(73474);function l({item:e,onRemove:s,onMoveToCart:r}){let i=e.product_id;return(0,t.jsxs)("div",{className:"flex items-center gap-4 bg-white rounded-xl border p-3 mb-3 md:mb-4 transition",children:[(0,t.jsx)("div",{className:"relative w-20 h-20 flex-shrink-0 rounded-lg overflow-hidden",children:(0,t.jsx)("img",{src:i.defaultImage,alt:i.name,className:"object-cover"})}),(0,t.jsxs)("div",{className:"w-full",children:[(0,t.jsx)("h3",{className:"text-base md:text-lg font-semibold text-gray-800 line-clamp-2",children:i.name}),(0,t.jsxs)("p",{className:"text-sm text-gray-500 mt-1",children:["₹",i.price.toLocaleString("en-IN")]})]}),(0,t.jsx)("div",{className:"flex items-center justify-between text-nowrap mt-0",children:(0,t.jsx)("button",{onClick:()=>s?.(e._id),className:"w-10 h-10 inline-flex justify-center items-center rounded-full bg-red-500/25 hover:bg-red-500 text-red-500 hover:text-white transition duration-300",children:(0,t.jsx)(a.Trash2,{size:18})})})]})}var o=e.i(54338);e.s(["default",0,function(){let[e,a]=(0,i.useState)([]),[d,c]=(0,i.useState)(0),{clienttotken:n}=(0,o.default)(),u=async()=>{try{let e=localStorage.getItem("customer"),t=localStorage.getItem("guestId"),r=e?JSON.parse(e):null,i=r?.id,l="/clientapi/wishlist?";if(i)l+=`user_id=${i}`;else{if(!t)return void console.log("No user or guest found");l+=`guest_id=${t}`}let o=await (0,s.apiCall)(l,{headers:{Authorization:`Bearer ${n}`}});o?.data?.success&&(a(o.data?.data),c(o.data?.count))}catch(e){console.error("Error fetching wishlist",e)}},h=async({product_id:e})=>{try{let t=localStorage.getItem("customer"),r=localStorage.getItem("guestId"),i=t?JSON.parse(t):null,a={product_id:e};if(i?.id)a.user_id=i.id;else{if(!r)return void console.log("No user or guest found");a.guest_id=r}let l=await (0,s.apiCall)("/clientapi/wishlist",{method:"DELETE",body:a,headers:{Authorization:`Bearer ${n}`}});l?.data?.success&&u()}catch(e){throw console.error("Error removing wishlist item:",e),e}};return(0,i.useEffect)(()=>{u()},[]),(0,t.jsxs)("div",{children:[(0,t.jsxs)("h1",{className:"text-2xl font-semibold mb-4",children:["My Wishlist ",d??`(${d} Items)`]}),e?.length===0?(0,t.jsxs)("div",{className:"bg-white rounded-xl shadow p-8 text-center",children:[(0,t.jsx)(r.Heart,{size:48,className:"mx-auto text-gray-400 mb-4"}),(0,t.jsx)("p",{className:"text-gray-500",children:"Your wishlist is empty"})]}):e?.map(e=>(0,t.jsx)(l,{item:e,onRemove:()=>h({product_id:e?.product_id?._id})}))]})}],37492)}]);