1import{c as L,j as e,b as D,S as b,U as T,k as U,d as H,e as W,h as X,r as y,f as x,g as c,l as g,a as $,I as V,A as j,m as o,M as Y,X as K,C as O,o as Q,t}from"./index-DlLmRa-c.js";import{E as v,a as N,b as k,c as w,d as E}from"./empty-0FJvJWV0.js";import{A as G}from"./arrow-left-BZ16b-dl.js";import{U as J}from"./user-check-D_bzhyZP.js";import{B as C}from"./bell-CKj6v3cr.js";import{S as Z}from"./search-C0v2wDat.js";import{E as ee}from"./ellipsis-vertical-CrAQ8-CH.js";import{U as se}from"./user-x-BL1nDYST.js";const ae=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m4.243 5.21 14.39 12.472",key:"1c9a7c"}]],re=L("shield-ban",ae),u=["https://images.unsplash.com/photo-1506157786151-b8491531f063?w=80&q=80","https://images.unsplash.com/photo-1493225457124-a3eb161ffa5f?w=80&q=80","https://images.unsplash.com/photo-1516450360452-9312f5e86fc7?w=80&q=80","https://images.unsplash.com/photo-1571266752807-fe72c420580e?w=80&q=80"];function te(d,r,i){if(i?.[0])return i[0];if(r?.[0])return r[0];const n=Math.abs(d.charCodeAt(0)+(d.charCodeAt(1)||0))%u.length;return u[n]}function ge(){return e.jsxs(e.Fragment,{children:[e.jsx(D,{"data-hercules-id":"src/pages/friends/page.tsx:40:6","data-hercules-name":"AuthLoading",children:e.jsx("div",{"data-hercules-id":"src/pages/friends/page.tsx:41:8","data-hercules-name":"div",className:"p-4 space-y-3",children:Array.from({length:5}).map((d,r)=>e.jsx(b,{"data-hercules-id":"src/pages/friends/page.tsx:43:12","data-hercules-name":"Skeleton",className:"h-16 w-full rounded-2xl"},r))})}),e.jsx(T,{"data-hercules-id":"src/pages/friends/page.tsx:47:6","data-hercules-name":"Unauthenticated",children:e.jsxs("div",{"data-hercules-id":"src/pages/friends/page.tsx:48:8","data-hercules-name":"div",className:"flex flex-col items-center justify-center h-screen gap-4 px-6 text-center",children:[e.jsx(U,{"data-hercules-id":"src/pages/friends/page.tsx:49:10","data-hercules-name":"Users",size:40,className:"text-primary"}),e.jsx("p",{"data-hercules-id":"src/pages/friends/page.tsx:50:10","data-hercules-name":"p",className:"text-muted-foreground",children:"Sign in to see your friends"}),e.jsx(H,{"data-hercules-id":"src/pages/friends/page.tsx:51:10","data-hercules-name":"SignInButton"})]})}),e.jsx(W,{"data-hercules-id":"src/pages/friends/page.tsx:54:6","data-hercules-name":"Authenticated",children:e.jsx(de,{"data-hercules-id":"src/pages/friends/page.tsx:55:8","data-hercules-name":"FriendsInner"})})]})}function de(){const d=X(),[r,i]=y.useState("friends"),[n,M]=y.useState(""),[p,h]=y.useState(null),l=x(c.friends.getMyFriends,{search:n||void 0}),m=x(c.friends.getPendingRequests,{}),S=g(c.friends.unfriend),A=g(c.friends.blockUser),F=g(c.friends.acceptFriendRequest),q=g(c.friends.declineFriendRequest);x(c.friends.getMatchWithUser,p?{otherUserId:p}:"skip");const _=async(s,a)=>{try{await S({otherUserId:s}),t.success(`Unfriended ${a}`),h(null)}catch{t.error("Failed to unfriend")}},I=async(s,a)=>{try{await A({blockedId:s}),t.success(`${a} has been blocked`),h(null)}catch{t.error("Failed to block user")}},z=async(s,a)=>{try{await F({friendshipId:s}),t.success(`You and ${a} are now friends!`)}catch{t.error("Failed to accept")}},P=async s=>{try{await q({friendshipId:s}),t.success("Request declined")}catch{t.error("Failed to decline")}},R=m?.length??0;return e.jsxs("div",{"data-hercules-id":"src/pages/friends/page.tsx:135:4","data-hercules-name":"div",className:"flex flex-col min-h-screen bg-background",children:[e.jsxs("div",{"data-hercules-id":"src/pages/friends/page.tsx:137:6","data-hercules-name":"div",className:"sticky top-0 z-20 bg-background/95 backdrop-blur border-b border-border",children:[e.jsxs("div",{"data-hercules-id":"src/pages/friends/page.tsx:138:8","data-hercules-name":"div",className:"flex items-center gap-3 px-4 pt-4 pb-2",children:[e.jsx("button",{"data-hercules-id":"src/pages/friends/page.tsx:139:10","data-hercules-name":"button",onClick:()=>d(-1),className:"cursor-pointer text-muted-foreground hover:text-foreground",children:e.jsx(G,{"data-hercules-id":"src/pages/friends/page.tsx:140:12","data-hercules-name":"ArrowLeft",size:20})}),e.jsx("h1",{"data-hercules-id":"src/pages/friends/page.tsx:142:10","data-hercules-name":"h1",className:"font-serif text-2xl tracking-wide flex-1",children:"FRIENDS"})]}),e.jsx("div",{"data-hercules-id":"src/pages/friends/page.tsx:146:8","data-hercules-name":"div",className:"flex px-4 gap-1 pb-3",children:[{key:"friends",label:"My Friends",icon:J,badge:void 0},{key:"requests",label:"Requests",icon:C,badge:R}].map(({key:s,label:a,icon:B,badge:f})=>e.jsxs("button",{"data-hercules-id":"src/pages/friends/page.tsx:151:12","data-hercules-name":"button",onClick:()=>i(s),className:$("flex items-center gap-1.5 px-4 py-2 rounded-full text-sm font-medium transition-all cursor-pointer relative",r===s?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:text-foreground"),children:[e.jsx(B,{"data-hercules-id":"src/pages/friends/page.tsx:161:14","data-hercules-name":"Icon",size:14}),a,f!==void 0&&f>0&&e.jsx("span",{"data-hercules-id":"src/pages/friends/page.tsx:164:16","data-hercules-name":"span",className:"ml-1 w-4 h-4 rounded-full bg-destructive text-white text-[10px] font-bold flex items-center justify-center",children:f})]},s))}),r==="friends"&&e.jsx("div",{"data-hercules-id":"src/pages/friends/page.tsx:174:10","data-hercules-name":"div",className:"px-4 pb-3",children:e.jsxs("div",{"data-hercules-id":"src/pages/friends/page.tsx:175:12","data-hercules-name":"div",className:"relative",children:[e.jsx(Z,{"data-hercules-id":"src/pages/friends/page.tsx:176:14","data-hercules-name":"Search",size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),e.jsx(V,{"data-hercules-id":"src/pages/friends/page.tsx:177:14","data-hercules-name":"Input",placeholder:"Search friends by nameâ¦",value:n,onChange:s=>M(s.target.value),className:"pl-8 rounded-xl h-9 text-sm"})]})})]}),e.jsx("div",{"data-hercules-id":"src/pages/friends/page.tsx:189:6","data-hercules-name":"div",className:"flex-1 px-4 py-4",onClick:()=>h(null),children:e.jsxs(j,{"data-hercules-id":"src/pages/friends/page.tsx:190:8","data-hercules-name":"AnimatePresence",mode:"wait",children:[r==="friends"&&e.jsx(o.div,{"data-hercules-id":"src/pages/friends/page.tsx:193:12","data-hercules-name":"motion.div",initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},children:l===void 0?e.jsx("div",{"data-hercules-id":"src/pages/friends/page.tsx:195:16","data-hercules-name":"div",className:"space-y-3",children:Array.from({length:5}).map((s,a)=>e.jsx(b,{"data-hercules-id":"src/pages/friends/page.tsx:196:59","data-hercules-name":"Skeleton",className:"h-16 rounded-2xl"},a))}):l.length===0?e.jsx(v,{"data-hercules-id":"src/pages/friends/page.tsx:199:16","data-hercules-name":"Empty",children:e.jsxs(N,{"data-hercules-id":"src/pages/friends/page.tsx:200:18","data-hercules-name":"EmptyHeader",children:[e.jsx(k,{"data-hercules-id":"src/pages/friends/page.tsx:201:20","data-hercules-name":"EmptyMedia",variant:"icon",children:e.jsx(U,{"data-hercules-id":"src/pages/friends/page.tsx:201:47","data-hercules-name":"Users"})}),e.jsx(w,{"data-hercules-id":"src/pages/friends/page.tsx:202:20","data-hercules-name":"EmptyTitle",children:"No friends yet"}),e.jsx(E,{"data-hercules-id":"src/pages/friends/page.tsx:203:20","data-hercules-name":"EmptyDescription",children:n?"No friends match your search":"Send a friend request from a match's profile to stay connected"})]})}):e.jsxs("div",{"data-hercules-id":"src/pages/friends/page.tsx:209:16","data-hercules-name":"div",className:"space-y-2",children:[e.jsxs("p",{"data-hercules-id":"src/pages/friends/page.tsx:210:18","data-hercules-name":"p",className:"text-xs text-muted-foreground mb-3",children:[l.length," friend",l.length!==1?"s":""]}),l.map(s=>e.jsxs(o.div,{"data-hercules-id":"src/pages/friends/page.tsx:212:20","data-hercules-name":"motion.div",layout:!0,initial:{opacity:0,y:8},animate:{opacity:1,y:0},className:"flex items-center gap-3 bg-card border border-border rounded-2xl px-4 py-3 relative",children:[e.jsxs("div",{"data-hercules-id":"src/pages/friends/page.tsx:220:22","data-hercules-name":"div",className:"relative shrink-0",children:[e.jsx("img",{"data-hercules-id":"src/pages/friends/page.tsx:221:24","data-hercules-name":"img",src:te(s._id,s.photos,s.resolvedPhotos),alt:s.displayName,className:"w-12 h-12 rounded-full object-cover",onError:a=>{a.target.src=u[0]}}),e.jsx("div",{"data-hercules-id":"src/pages/friends/page.tsx:227:24","data-hercules-name":"div",className:"absolute -bottom-0.5 -right-0.5 w-3.5 h-3.5 rounded-full bg-accent border-2 border-background"})]}),e.jsxs("div",{"data-hercules-id":"src/pages/friends/page.tsx:231:22","data-hercules-name":"div",className:"flex-1 min-w-0",children:[e.jsx("p",{"data-hercules-id":"src/pages/friends/page.tsx:232:24","data-hercules-name":"p",className:"font-semibold text-sm truncate",children:s.displayName??"Raver"}),s.city&&e.jsxs("p",{"data-hercules-id":"src/pages/friends/page.tsx:234:26","data-hercules-name":"p",className:"text-xs text-muted-foreground flex items-center gap-1 mt-0.5",children:[e.jsx(Y,{"data-hercules-id":"src/pages/friends/page.tsx:235:28","data-hercules-name":"MapPin",size:10})," ",s.city]}),s.vibeType&&e.jsx("p",{"data-hercules-id":"src/pages/friends/page.tsx:239:26","data-hercules-name":"p",className:"text-xs text-primary/70 mt-0.5 truncate",children:s.vibeType})]}),e.jsxs("div",{"data-hercules-id":"src/pages/friends/page.tsx:244:22","data-hercules-name":"div",className:"flex items-center gap-1 shrink-0",children:[e.jsx(ce,{"data-hercules-id":"src/pages/friends/page.tsx:245:24","data-hercules-name":"FriendMessageButton",userId:s._id,navigate:d}),e.jsx("button",{"data-hercules-id":"src/pages/friends/page.tsx:246:24","data-hercules-name":"button",onClick:a=>{a.stopPropagation(),h(p===s._id?null:s._id)},className:"w-8 h-8 rounded-full flex items-center justify-center hover:bg-muted transition-colors cursor-pointer text-muted-foreground",children:e.jsx(ee,{"data-hercules-id":"src/pages/friends/page.tsx:250:26","data-hercules-name":"MoreVertical",size:16})})]}),e.jsx(j,{"data-hercules-id":"src/pages/friends/page.tsx:255:22","data-hercules-name":"AnimatePresence",children:p===s._id&&e.jsxs(o.div,{"data-hercules-id":"src/pages/friends/page.tsx:257:26","data-hercules-name":"motion.div",initial:{opacity:0,scale:.9,y:-5},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.9},onClick:a=>a.stopPropagation(),className:"absolute right-4 top-14 z-30 bg-card border border-border rounded-2xl shadow-xl overflow-hidden min-w-[160px]",children:[e.jsxs("button",{"data-hercules-id":"src/pages/friends/page.tsx:264:28","data-hercules-name":"button",onClick:()=>_(s._id,s.displayName??"this person"),className:"w-full flex items-center gap-2.5 px-4 py-3 text-sm hover:bg-muted transition-colors cursor-pointer text-left border-b border-border",children:[e.jsx(se,{"data-hercules-id":"src/pages/friends/page.tsx:268:30","data-hercules-name":"UserX",size:15,className:"text-destructive"}),e.jsx("span",{"data-hercules-id":"src/pages/friends/page.tsx:269:30","data-hercules-name":"span",children:"Unfriend"})]}),e.jsxs("button",{"data-hercules-id":"src/pages/friends/page.tsx:271:28","data-hercules-name":"button",onClick:()=>I(s._id,s.displayName??"this person"),className:"w-full flex items-center gap-2.5 px-4 py-3 text-sm hover:bg-muted transition-colors cursor-pointer text-left",children:[e.jsx(re,{"data-hercules-id":"src/pages/friends/page.tsx:275:30","data-hercules-name":"ShieldBan",size:15,className:"text-orange-400"}),e.jsx("span",{"data-hercules-id":"src/pages/friends/page.tsx:276:30","data-hercules-name":"span",children:"Block"})]})]})})]},s._id))]})},"friends"),r==="requests"&&e.jsx(o.div,{"data-hercules-id":"src/pages/friends/page.tsx:290:12","data-hercules-name":"motion.div",initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},children:m===void 0?e.jsx("div",{"data-hercules-id":"src/pages/friends/page.tsx:292:16","data-hercules-name":"div",className:"space-y-3",children:Array.from({length:3}).map((s,a)=>e.jsx(b,{"data-hercules-id":"src/pages/friends/page.tsx:293:59","data-hercules-name":"Skeleton",className:"h-16 rounded-2xl"},a))}):m.length===0?e.jsx(v,{"data-hercules-id":"src/pages/friends/page.tsx:296:16","data-hercules-name":"Empty",children:e.jsxs(N,{"data-hercules-id":"src/pages/friends/page.tsx:297:18","data-hercules-name":"EmptyHeader",children:[e.jsx(k,{"data-hercules-id":"src/pages/friends/page.tsx:298:20","data-hercules-name":"EmptyMedia",variant:"icon",children:e.jsx(C,{"data-hercules-id":"src/pages/friends/page.tsx:298:47","data-hercules-name":"Bell"})}),e.jsx(w,{"data-hercules-id":"src/pages/friends/page.tsx:299:20","data-hercules-name":"EmptyTitle",children:"No pending requests"}),e.jsx(E,{"data-hercules-id":"src/pages/friends/page.tsx:300:20","data-hercules-name":"EmptyDescription",children:"When someone sends you a friend request, it'll show here"})]})}):e.jsx("div",{"data-hercules-id":"src/pages/friends/page.tsx:304:16","data-hercules-name":"div",className:"space-y-2",children:m.map(s=>e.jsxs(o.div,{"data-hercules-id":"src/pages/friends/page.tsx:306:20","data-hercules-name":"motion.div",layout:!0,initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,scale:.97},className:"flex items-center gap-3 bg-card border border-border rounded-2xl px-4 py-3",children:[e.jsx("img",{"data-hercules-id":"src/pages/friends/page.tsx:314:22","data-hercules-name":"img",src:s.requesterPhoto??u[0],alt:s.requesterName,className:"w-12 h-12 rounded-full object-cover shrink-0",onError:a=>{a.target.src=u[0]}}),e.jsxs("div",{"data-hercules-id":"src/pages/friends/page.tsx:320:22","data-hercules-name":"div",className:"flex-1 min-w-0",children:[e.jsx("p",{"data-hercules-id":"src/pages/friends/page.tsx:321:24","data-hercules-name":"p",className:"font-semibold text-sm truncate",children:s.requesterName??"A Raver"}),e.jsx("p",{"data-hercules-id":"src/pages/friends/page.tsx:322:24","data-hercules-name":"p",className:"text-xs text-muted-foreground mt-0.5",children:"Wants to be friends"})]}),e.jsxs("div",{"data-hercules-id":"src/pages/friends/page.tsx:324:22","data-hercules-name":"div",className:"flex gap-2 shrink-0",children:[e.jsx("button",{"data-hercules-id":"src/pages/friends/page.tsx:325:24","data-hercules-name":"button",onClick:()=>P(s._id),className:"w-9 h-9 rounded-full border border-border flex items-center justify-center hover:bg-muted transition-colors cursor-pointer",children:e.jsx(K,{"data-hercules-id":"src/pages/friends/page.tsx:329:26","data-hercules-name":"X",size:15,className:"text-muted-foreground"})}),e.jsx("button",{"data-hercules-id":"src/pages/friends/page.tsx:331:24","data-hercules-name":"button",onClick:()=>z(s._id,s.requesterName??"this person"),className:"w-9 h-9 rounded-full bg-primary flex items-center justify-center hover:bg-primary/90 transition-colors cursor-pointer",children:e.jsx(O,{"data-hercules-id":"src/pages/friends/page.tsx:335:26","data-hercules-name":"Check",size:15,className:"text-primary-foreground"})})]})]},s._id))})},"requests")]})})]})}function ce({userId:d,navigate:r}){const i=x(c.friends.getMatchWithUser,{otherUserId:d}),n=()=>{i?r(`/matches/${i}`):t.info("You need a match with this friend to message them. Keep swiping!")};return e.jsx("button",{"data-hercules-id":"src/pages/friends/page.tsx:363:4","data-hercules-name":"button",onClick:n,className:"w-8 h-8 rounded-full flex items-center justify-center hover:bg-primary/10 transition-colors cursor-pointer text-primary",title:"Message",children:e.jsx(Q,{"data-hercules-id":"src/pages/friends/page.tsx:368:6","data-hercules-name":"MessageCircle",size:16})})}export{ge as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.