import{d as e,f as t,t as n,u as r}from"./src-C0xjWfnx.js";import{n as i}from"./trpc-client-QrVjRqP1.js";import{t as a}from"./map-pin-DbTySZl1.js";t();var o=e();function s(){let e=i.useUtils(),{data:t}=i.user.address.getUserAddresses.useQuery(),s=i.user.address.deleteAddress.useMutation({onSuccess:()=>e.user.address.getUserAddresses.invalidate()}),c=t?.data||[];return(0,o.jsxs)(n,{children:[(0,o.jsx)(r,{weight:`bold`,className:`mb-4 text-xl`,children:`My Addresses`}),c.length===0?(0,o.jsxs)(`div`,{className:`flex flex-col items-center gap-4 py-20`,children:[(0,o.jsx)(a,{className:`h-12 w-12 text-gray-300`}),(0,o.jsx)(r,{className:`text-gray-500`,children:`No addresses saved`})]}):(0,o.jsx)(`div`,{className:`flex flex-col gap-3`,children:c.map(e=>(0,o.jsx)(`div`,{className:`rounded-xl border border-gray-100 bg-white p-4 shadow-sm`,children:(0,o.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,o.jsxs)(`div`,{className:`flex-1`,children:[(0,o.jsx)(r,{weight:`semibold`,children:e.name}),(0,o.jsxs)(r,{className:`text-sm text-gray-600`,children:[e.addressLine1,e.addressLine2?`, ${e.addressLine2}`:``]}),(0,o.jsxs)(r,{className:`text-sm text-gray-600`,children:[e.city,`, `,e.state,` - `,e.pincode]}),(0,o.jsx)(r,{className:`text-sm text-gray-500`,children:e.phone}),e.isDefault&&(0,o.jsx)(`span`,{className:`mt-1 inline-block rounded-full bg-brand-100 px-2 py-0.5 text-xs text-brand-700`,children:`Default`})]}),(0,o.jsx)(`button`,{onClick:()=>s.mutate({id:e.id}),className:`text-sm text-red-500 hover:text-red-700`,children:`Delete`})]})},e.id))})]})}export{s as component};