// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-3.0-or-later
// @source: https://gitlab.com/soapbox-pub/ditto/-/tree/f0a3877c
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Sr as t,V as n,dn as r,qi as i}from"./lucide-icons-BdRF0moN.js";import{t as a}from"./jsx-runtime-By8HlURe.js";import{ct as o,lt as s,st as c}from"./EmbeddedNote-BKfkvcrg.js";import{t as l}from"./sanitizeUrl-Bk5f35GN.js";import{a as u}from"./downloadFile-kpATXaJi.js";import{t as d}from"./utils-BFSTDHdM.js";import{t as f}from"./button-Cs26nq0r.js";import{r as p,t as m}from"./lib-D6JeXc-v.js";import{t as h}from"./articleSmartypants-Bcj3a4SM.js";import{t as g}from"./markdownComponents-BiuuXc15.js";var _=e(i(),1),v=a();function y({event:e,expanded:t,className:n}){let r=(0,_.useMemo)(()=>s(e),[e]);return r?t?(0,v.jsx)(b,{listing:r,className:n}):(0,v.jsx)(x,{listing:r,className:n}):null}function b({listing:e,className:n}){let{event:i,title:a,summary:s,images:y,price:b,status:x,location:S,sourceUrl:C,hashtags:w}=e,T=(0,_.useMemo)(()=>g(i),[i]),E=(0,_.useMemo)(()=>o(e),[e]),[D,O]=(0,_.useState)(void 0),k=D&&y.includes(D)?D:y[0],A=x===`sold`,j=b?c(b):void 0,M=C?l(C):void 0;return(0,v.jsxs)(`div`,{className:d(`mt-4`,n),children:[(0,v.jsxs)(`div`,{className:d(`grid gap-5`,k&&`sm:grid-cols-2 sm:gap-7`),children:[k&&(0,v.jsxs)(`div`,{className:`space-y-2.5 min-w-0`,children:[(0,v.jsxs)(`div`,{className:`relative aspect-square overflow-hidden rounded-2xl bg-muted`,children:[(0,v.jsx)(`img`,{src:k,alt:a,decoding:`async`,className:d(`absolute inset-0 size-full object-cover`,A&&`opacity-60 grayscale`)}),A&&(0,v.jsx)(`span`,{className:`absolute left-4 top-4 rounded-full bg-foreground/90 px-3 py-1 text-xs font-bold uppercase tracking-widest text-background`,children:`Sold`})]}),y.length>1&&(0,v.jsx)(`div`,{className:`flex gap-2 overflow-x-auto pb-1`,role:`listbox`,"aria-label":`Listing photos`,children:y.map(e=>{let t=e===k;return(0,v.jsx)(`button`,{type:`button`,role:`option`,"aria-selected":t,onClick:()=>O(e),className:d(`relative size-16 shrink-0 overflow-hidden rounded-lg transition-all`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,t?`ring-2 ring-primary`:`opacity-60 hover:opacity-100`),children:(0,v.jsx)(`img`,{src:e,alt:``,loading:`lazy`,decoding:`async`,className:`absolute inset-0 size-full object-cover`})},e)})})]}),(0,v.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 sm:py-1`,children:[(0,v.jsx)(`h1`,{dir:`auto`,className:`text-2xl font-bold leading-tight break-words`,children:a}),(0,v.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-3 gap-y-1`,children:[j&&(0,v.jsx)(`span`,{className:d(`text-3xl font-extrabold tracking-tight`,A?`text-muted-foreground line-through decoration-2`:`text-primary`),children:j}),A&&(0,v.jsx)(`span`,{className:`rounded-full bg-secondary px-2.5 py-0.5 text-xs font-bold uppercase tracking-wide text-secondary-foreground`,children:`Sold`})]}),s&&(0,v.jsx)(`p`,{dir:`auto`,className:`text-[15px] leading-relaxed text-muted-foreground`,children:s}),S&&(0,v.jsxs)(`p`,{className:`flex items-center gap-1.5 min-w-0 text-sm text-muted-foreground`,children:[(0,v.jsx)(r,{className:`size-4 shrink-0`,"aria-hidden":`true`}),(0,v.jsx)(`span`,{className:`truncate`,children:S})]}),C&&!A&&(0,v.jsxs)(f,{size:`lg`,className:`mt-1 w-full rounded-xl text-base font-semibold sm:max-w-xs`,onClick:e=>{e.stopPropagation(),u(C)},children:[`View on `,M,(0,v.jsx)(t,{className:`ml-2 size-4`,"aria-hidden":`true`})]})]})]}),E&&(0,v.jsxs)(`div`,{className:`mt-7 border-t border-border pt-5`,children:[(0,v.jsx)(`h2`,{className:`mb-3 text-xs font-semibold uppercase tracking-widest text-muted-foreground`,children:`Description`}),(0,v.jsx)(`div`,{dir:`auto`,className:`prose prose-sm max-w-none break-words text-foreground prose-headings:text-foreground prose-headings:font-bold prose-strong:text-foreground prose-a:text-primary prose-a:no-underline hover:prose-a:underline prose-img:rounded-lg prose-li:marker:text-muted-foreground prose-blockquote:text-muted-foreground prose-blockquote:border-border prose-hr:border-border`,children:(0,v.jsx)(p,{remarkPlugins:[h],rehypePlugins:[m],components:T,children:E})})]}),w.length>0&&(0,v.jsx)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:w.map(e=>(0,v.jsxs)(`a`,{href:`/t/${encodeURIComponent(e)}`,className:`rounded-full bg-secondary px-3 py-1 text-xs font-medium text-secondary-foreground transition-colors hover:bg-primary/10 hover:text-primary`,onClick:e=>e.stopPropagation(),children:[`#`,e]},e))})]})}function x({listing:e,className:t}){let{title:i,images:a,price:o,status:s,location:l}=e,u=a[0],f=s===`sold`,p=o?c(o):void 0;return(0,v.jsxs)(`div`,{className:d(`isolate my-2.5 relative rounded-2xl border border-border overflow-hidden @container`,t),children:[(0,v.jsx)(`div`,{className:`absolute -z-10 top-0 left-0 w-44 h-44 bg-primary/[0.06] rounded-full blur-2xl`}),(0,v.jsxs)(`div`,{className:`flex gap-1`,children:[u&&(0,v.jsx)(`div`,{className:`shrink-0 p-3`,children:(0,v.jsx)(`div`,{className:`relative size-28 sm:size-40 overflow-hidden rounded-xl bg-muted`,children:(0,v.jsx)(`img`,{src:u,alt:i,loading:`lazy`,decoding:`async`,className:d(`absolute inset-0 size-full object-cover`,f&&`opacity-60 grayscale`)})})}),(0,v.jsxs)(`div`,{className:d(`flex min-w-0 flex-1 flex-col justify-center gap-1.5 py-3.5 pr-3.5`,!u&&`pl-3.5`),children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-1.5 whitespace-nowrap font-medium text-muted-foreground`,style:{fontSize:`clamp(0.8rem, 3.5cqw, 1.05rem)`},children:[(0,v.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-primary/15 sm:size-6`,children:(0,v.jsx)(n,{className:`size-3 text-primary sm:size-3.5`})}),f?`Sold`:`For Sale`]}),p&&(0,v.jsx)(`div`,{className:d(`whitespace-nowrap font-bold leading-none tracking-tight`,f&&`text-muted-foreground line-through decoration-2`),style:{fontSize:`clamp(1.5rem, 8cqw, 2.25rem)`},children:p}),(0,v.jsx)(`p`,{dir:`auto`,className:`line-clamp-2 break-words text-sm font-medium leading-snug sm:text-base`,children:i}),l&&(0,v.jsxs)(`p`,{className:`flex items-center gap-1 min-w-0 text-xs text-muted-foreground`,children:[(0,v.jsx)(r,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,v.jsx)(`span`,{className:`truncate`,children:l})]})]})]})]})}export{y as ClassifiedListingContent};
// @license-end
