import{$ as e,C as t,D as n,E as r,F as i,H as a,I as o,Q as s,S as c,X as l,Y as u,_ as d,b as f,g as p,n as m}from"./app-BZJNHjlg.js";import{t as h}from"./i18n-C08nwg9u.js";import{n as g,t as _}from"./AppLayout-CNIbQyGo.js";var v={class:`mx-auto max-w-[760px]`},y={class:`mb-5 flex items-center justify-between`},b={class:`text-2xl font-extrabold tracking-tight`},x={class:`flex items-center gap-2`},S={class:`overflow-hidden rounded-c border border-line bg-surface`},C=[`onClick`],w={class:`min-w-0 flex-1`},T={class:`text-sm leading-snug text-ink`},E={key:0,class:`mt-1 truncate text-sm text-ink-muted`},D={class:`mt-1 text-xs text-ink-muted`},O={key:0,class:`mt-1.5 h-2.5 w-2.5 shrink-0 rounded-full bg-primary`},k=[`title`,`onClick`],A={key:0,class:`px-5 py-16 text-center text-ink-muted`},j={class:`mt-2 text-sm`},M=n({__name:`Index`,props:{items:{},unread:{}},setup(n){let M=n;function N(e){return e.type===`badge`?e.text||h(`You earned a badge`):e.type===`mention`?h(`{name} mentioned you in {topic}`,{name:e.actor.name,topic:e.topic.title}):e.type===`reaction`?h(`{name} reacted {emoji} to your post`,{name:e.actor.name,emoji:e.emoji??``}):h(`{name} replied in {topic}`,{name:e.actor.name,topic:e.topic.title})}function P(t){t.read||e.post(`/notifications/${t.id}/read`,{},{preserveScroll:!0}),e.visit(t.url)}function F(){e.post(`/notifications/read`,{},{preserveScroll:!0})}function I(){window.confirm(h(`Clear all notifications? This cannot be undone.`))&&e.delete(`/notifications`,{preserveScroll:!0})}function L(t){e.delete(`/notifications/${t.id}`,{preserveScroll:!0})}return(e,n)=>(i(),t(d,null,[r(u(m),{title:u(h)(`Notifications`)},null,8,[`title`]),r(_,null,{default:a(()=>[f(`div`,v,[f(`div`,y,[f(`h1`,b,s(u(h)(`Notifications`)),1),f(`div`,x,[M.unread>0?(i(),t(`button`,{key:0,type:`button`,class:`rounded-lg border border-line bg-surface px-3 py-2 text-sm font-semibold text-ink-2 hover:bg-surface-2`,onClick:F},s(u(h)(`Mark all read`)),1)):c(``,!0),M.items.length?(i(),t(`button`,{key:1,type:`button`,class:`rounded-lg border border-line bg-surface px-3 py-2 text-sm font-semibold text-ink-2 hover:border-red-500/40 hover:text-red-500`,onClick:I},s(u(h)(`Clear all`)),1)):c(``,!0)])]),f(`div`,S,[(i(!0),t(d,null,o(M.items,e=>(i(),t(`div`,{key:e.id,class:l([`group flex w-full cursor-pointer items-start gap-3 border-b border-line/60 px-5 py-4 text-left last:border-0 hover:bg-surface-2`,e.read?``:`bg-primary/10`]),onClick:t=>P(e)},[r(g,{avatar:{initials:e.actor.initials,color:e.actor.color},size:40},null,8,[`avatar`]),f(`div`,w,[f(`div`,T,s(N(e)),1),e.excerpt?(i(),t(`div`,E,s(e.excerpt),1)):c(``,!0),f(`div`,D,s(e.time),1)]),e.read?c(``,!0):(i(),t(`span`,O)),f(`button`,{type:`button`,title:u(h)(`Dismiss`),class:`-mr-1 shrink-0 rounded-md p-1 text-ink-muted opacity-0 transition hover:bg-red-500/10 hover:text-red-500 focus:opacity-100 group-hover:opacity-100`,onClick:p(t=>L(e),[`stop`])},[...n[0]||=[f(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`},[f(`path`,{d:`M18 6 6 18M6 6l12 12`})],-1)]],8,k)],10,C))),128)),M.items.length?c(``,!0):(i(),t(`div`,A,[n[1]||=f(`div`,{class:`text-3xl`},`🎉`,-1),f(`p`,j,s(u(h)(`No notifications yet — you're all caught up.`)),1)]))])])]),_:1})],64))}});export{M as default};