import{n as e,r as t}from"./rolldown-runtime-QTnfLwEv.js";import{ki as n,kr as r,lr as i,rr as a}from"./lucide-icons-BjbcRgLk.js";import{t as o}from"./jsx-runtime-By8HlURe.js";import{u as s}from"./esm-CRVqHnq2.js";import{n as c,r as l,t as u}from"./sanitizeUrl-Bk5f35GN.js";import{a as d}from"./downloadFile-kpATXaJi.js";import{l as f}from"./useCurrentUser-boOMG5Xx.js";import{t as p}from"./utils-BFSTDHdM.js";import{n as m,o as h,r as g,t as _}from"./avatar-BQAt2c6L.js";import{c as v,n as y}from"./chunk-62JRHF6Z-BC2Zeguv.js";import{n as b}from"./CustomEmoji-I2Dzbi7x.js";import{t as x}from"./useProfileUrl-CaWgk1iO.js";import{r as S}from"./BioContent-DDUa8M5F.js";import{t as C}from"./ExternalFavicon-C4RKLGFC.js";import{n as w}from"./articleHelpers-Dhr_Z8YP.js";var T=t(n(),1),E=o();function D({url:e,className:t}){let n=c(e);return n?(0,E.jsxs)(`button`,{type:`button`,className:p(`flex items-center gap-1 px-2 py-0.5 rounded-full max-w-full min-w-0`,`text-xs text-muted-foreground`,`hover:bg-primary/10 hover:text-primary transition-colors`,t),onClick:e=>{e.preventDefault(),e.stopPropagation(),d(n)},children:[(0,E.jsx)(C,{url:n,size:14,className:`shrink-0`}),(0,E.jsx)(`span`,{className:`truncate`,children:u(n)}),(0,E.jsx)(i,{className:`size-3 shrink-0`})]}):null}var O=e({EmbeddedArticleCard:()=>A});function k(e){let t=t=>e.tags.find(([e])=>e===t)?.[1];return{title:t(`title`),summary:t(`summary`),image:l(t(`image`))}}function A({event:e,className:t,disableHoverCards:n,hideAuthor:i,sourceUrl:o}){let c=v(),l=f(e.pubkey),u=l.data?.metadata,d=u?.name||u?.display_name||`Anonymous`,S=x(e.pubkey,u),C=h(u),{title:O,summary:A,image:M}=(0,T.useMemo)(()=>k(e),[e]),N=(0,T.useMemo)(()=>w(e.content),[e]),P=(0,T.useMemo)(()=>{let t=e.tags.find(([e])=>e===`d`)?.[1]??``;return s.naddrEncode({kind:e.kind,pubkey:e.pubkey,identifier:t})},[e]);return(0,E.jsxs)(`div`,{className:p(`group block rounded-2xl border border-border overflow-hidden`,`hover:bg-secondary/40 transition-colors cursor-pointer`,t),role:`link`,tabIndex:0,onClick:e=>{e.stopPropagation(),c(`/${P}`)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),c(`/${P}`))},children:[M&&(0,E.jsx)(`div`,{className:`w-full overflow-hidden bg-muted`,children:(0,E.jsx)(`img`,{src:M,alt:``,loading:`lazy`,decoding:`async`,className:`w-full h-[180px] object-cover`,onError:e=>{e.currentTarget.parentElement.style.display=`none`}})}),(0,E.jsxs)(`div`,{className:`px-3.5 py-2.5 space-y-1`,children:[O&&(0,E.jsx)(`p`,{className:`text-base font-semibold leading-snug line-clamp-2`,children:O}),A&&(0,E.jsx)(`p`,{className:`text-sm text-muted-foreground leading-relaxed line-clamp-2`,children:A}),(0,E.jsxs)(`div`,{className:`flex items-center gap-1.5 pt-0.5 text-xs text-muted-foreground`,children:[!i&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(j,{pubkey:e.pubkey,disabled:n,children:(0,E.jsxs)(y,{to:S,className:`flex items-center gap-1.5 min-w-0 w-fit hover:underline`,onClick:e=>e.stopPropagation(),children:[(0,E.jsxs)(_,{shape:C,className:`size-5 shrink-0`,children:[(0,E.jsx)(g,{src:u?.picture,alt:d}),(0,E.jsx)(m,{className:`bg-primary/20 text-primary text-[10px]`,children:d[0]?.toUpperCase()})]}),(0,E.jsx)(`span`,{className:`font-medium text-muted-foreground truncate`,children:l.data?.event?(0,E.jsx)(b,{tags:l.data.event.tags,children:d}):d})]})}),(0,E.jsx)(`span`,{"aria-hidden":`true`,children:`·`})]}),(0,E.jsx)(a,{className:`size-3.5 shrink-0`}),(0,E.jsx)(`span`,{children:`Article`}),N&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,E.jsx)(r,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,E.jsx)(`span`,{children:N})]}),(0,E.jsx)(D,{url:o,className:`ml-auto`})]})]})]})}function j({pubkey:e,disabled:t,children:n}){return t?(0,E.jsx)(E.Fragment,{children:n}):(0,E.jsx)(S,{pubkey:e,asChild:!0,children:n})}export{O as n,D as r,A as t};