import{e as h,r,p as e,L as c}from"./index-D3Q1knR6.js";import{T as f,S as g,B as p}from"./TopBar-C8rjlOhI.js";import{P as b}from"./plus-D4EVyMrX.js";import{c as m}from"./createLucideIcon-BLVTLNRa.js";import{B as j}from"./badge-check-DGvlYo-W.js";import"./flame-BaVgRNL-.js";import"./message-circle-CjeS-3Ff.js";const v=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],N=m("image",v);const w=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],y=m("sliders-horizontal",w),d=["23:09","22:34","11:09","mai 21","mai 18","mai 13","abr 28","jan 15","nov 24, 2025","out 02, 2025"];function z(){const{models:i}=h.useLoaderData(),[s,l]=r.useState(!1),[n,u]=r.useState(""),o=r.useMemo(()=>i.filter(a=>!a.comingSoon).map((a,t)=>{const x=a.chatPreview?.[a.chatPreview.length-1]?.text??"Toque para conversar";return{slug:a.slug,name:a.name,avatar:a.avatar,verified:a.verified,preview:x,isMedia:t%2===1,time:d[t%d.length],unread:t===0?3:t===1?1:0,online:t%3!==2}}),[i]).filter(a=>!(s&&!a.online||n&&!a.name.toLowerCase().includes(n.toLowerCase())));return e.jsxs("div",{className:"min-h-screen bg-background text-foreground",children:[e.jsx(f,{}),e.jsxs("main",{className:"mx-auto max-w-2xl px-4 pb-24 pt-4",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("h1",{className:"text-xl font-black tracking-tight",children:"Conversas"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(c,{to:"/busca","aria-label":"Nova conversa",className:"flex h-9 w-9 items-center justify-center rounded-full bg-soft-surface text-foreground ring-1 ring-hairline transition active:scale-95",children:e.jsx(b,{className:"h-4 w-4"})}),e.jsx("button",{type:"button","aria-label":"Filtrar online","aria-pressed":s,onClick:()=>l(a=>!a),className:`flex h-9 w-9 items-center justify-center rounded-full ring-1 ring-hairline transition active:scale-95 ${s?"bg-brand text-brand-foreground":"bg-soft-surface text-foreground"}`,children:e.jsx(y,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"mb-3 flex items-center gap-2 rounded-full bg-soft-surface px-4 py-2.5 ring-1 ring-hairline",children:[e.jsx(g,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("input",{value:n,onChange:a=>u(a.target.value),placeholder:"Pesquisar usuários",className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e.jsxs("label",{className:"mb-2 flex items-center justify-between py-1.5",children:[e.jsx("span",{className:"text-sm font-semibold",children:"Exibir apenas usuários online"}),e.jsx("button",{type:"button",role:"switch","aria-checked":s,onClick:()=>l(a=>!a),className:`relative h-6 w-11 rounded-full transition ${s?"bg-brand":"bg-soft-surface ring-1 ring-hairline"}`,children:e.jsx("span",{className:`absolute top-0.5 h-5 w-5 rounded-full bg-white shadow transition-transform ${s?"translate-x-[22px]":"translate-x-0.5"}`})})]}),e.jsx("ul",{className:"divide-y divide-hairline",children:o.map(a=>e.jsx("li",{children:e.jsxs(c,{to:"/chat/$slug",params:{slug:a.slug},className:"flex w-full items-center gap-3 py-3 text-left transition active:bg-soft-surface/60",children:[e.jsxs("div",{className:"relative shrink-0",children:[a.avatar?e.jsx("img",{src:a.avatar,alt:a.name,className:"h-12 w-12 rounded-full object-cover ring-1 ring-hairline"}):e.jsx("div",{className:"h-12 w-12 rounded-full bg-soft-surface ring-1 ring-hairline"}),a.online&&e.jsx("span",{className:"absolute -bottom-0.5 -right-0.5 h-3 w-3 rounded-full border-2 border-background bg-emerald-500"})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("p",{className:"truncate text-[15px] font-bold leading-tight",children:a.name}),a.verified&&e.jsx(j,{className:"h-3.5 w-3.5 shrink-0 fill-brand text-brand-foreground"})]}),e.jsxs("p",{className:"mt-0.5 flex items-center gap-1 truncate text-[13px] text-muted-foreground",children:[a.isMedia&&e.jsx(N,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:"truncate",children:a.preview})]})]}),e.jsxs("div",{className:"flex shrink-0 flex-col items-end gap-1",children:[e.jsx("span",{className:"text-[11px] font-medium text-muted-foreground",children:a.time}),a.unread>0&&e.jsx("span",{className:"flex h-5 min-w-5 items-center justify-center rounded-full bg-brand px-1.5 text-[11px] font-bold text-brand-foreground",children:a.unread>9?"+9":a.unread})]})]})},a.slug))}),o.length===0&&e.jsx("p",{className:"py-10 text-center text-sm text-muted-foreground",children:"Nenhuma conversa encontrada."})]}),e.jsx(p,{})]})}export{z as component};
