1import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{n as t,t as n}from"./jsx-runtime-zC2iXiZO.js";import{t as r}from"./calendar-days-CNKRTlL1.js";import{t as i}from"./clock-3-C3C0EGOi.js";import{t as a}from"./eye-DF2lmBDt.js";import{t as o}from"./rss-C0e59B_e.js";import{t as s}from"./search-DmL-Ik81.js";import{t as c}from"./tag-DdVz4JDi.js";import{B as l,F as u,H as d,L as f,R as p}from"./app-ChT5hii5.js";import{t as m}from"./ShareButton-DahdcamN.js";var h=e(t(),1),g=n();function _(e,t){e.srcset&&t&&(e.removeAttribute(`srcset`),e.src=t)}function v({posts:e,canonicalUrl:t}){let n=l(),v=(0,h.useMemo)(()=>new URL(n.url,t).searchParams,[n.url,t]),y=v.get(`q`)??``,b=v.get(`topic`)??``,[x,S]=(0,h.useState)(y);(0,h.useEffect)(()=>S(y),[y]);let C=(0,h.useMemo)(()=>{let t=new Map;return e.forEach(e=>{new Map(e.tags.map(e=>[e.slug,e])).forEach(e=>{let n=t.get(e.slug);t.set(e.slug,{...e,count:(n?.count??0)+1})})}),Array.from(t.values()).sort((e,t)=>e.name.localeCompare(t.name))},[e]),w=(0,h.useMemo)(()=>{let t=y.toLocaleLowerCase().trim().split(/\s+/).filter(Boolean);return e.filter(e=>{if(b&&!e.tags.some(e=>e.slug===b))return!1;let n=[e.title,e.brief,...e.tags.map(e=>e.name)].join(` `).toLocaleLowerCase();return t.every(e=>n.includes(e))})},[e,y,b]),T=(e,r)=>{let i=new URL(n.url,t);e.trim()?i.searchParams.set(`q`,e.trim()):i.searchParams.delete(`q`),r?i.searchParams.set(`topic`,r):i.searchParams.delete(`topic`);let a=e=>encodeURIComponent(e).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),o=Array.from(i.searchParams,([e,t])=>`${a(e)}=${a(t)}`).join(`&`);d.push({url:`${i.pathname}${o?`?${o}`:``}${i.hash}`,preserveScroll:!0,preserveState:!0})},E=e=>{e.preventDefault(),T(x,b)},D=e.reduce((e,t)=>e+t.responseCount+t.replyCount,0);return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(f,{children:(0,g.jsx)(`link`,{"head-key":`blog-rss`,rel:`alternate`,type:`application/rss+xml`,title:`Harun's Blog RSS Feed`,href:`/blog/feed.xml`})}),(0,g.jsxs)(`div`,{className:`pt-24`,children:[(0,g.jsx)(`section`,{className:`mx-auto max-w-7xl px-4 pb-6 sm:px-6 lg:px-8`,children:(0,g.jsxs)(`div`,{className:`flex flex-col gap-4 border-b border-slate-200 pb-5 sm:flex-row sm:items-end sm:justify-between sm:pb-8`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h1`,{className:`text-3xl font-bold tracking-tight text-slate-950 sm:text-5xl`,children:`Engineering notes`}),(0,g.jsx)(`p`,{className:`mt-2 max-w-2xl text-sm leading-6 text-slate-600 sm:text-base`,children:`Practical posts on AWS, DevOps, Laravel, and running software in production.`}),(0,g.jsxs)(`p`,{className:`mt-3 text-xs text-slate-500 sm:text-sm`,children:[e.length,` articles `,(0,g.jsx)(`span`,{"aria-hidden":`true`,className:`mx-2 text-slate-300`,children:`/`}),C.length,` topics `,(0,g.jsx)(`span`,{"aria-hidden":`true`,className:`mx-2 text-slate-300`,children:`/`}),D,` comments`]})]}),(0,g.jsxs)(`a`,{href:`/blog/feed.xml`,className:`inline-flex w-fit shrink-0 items-center gap-2 text-sm font-medium text-slate-600 hover:text-slate-950 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-amber-600`,children:[(0,g.jsx)(o,{className:`h-4 w-4`}),` RSS feed`]})]})}),(0,g.jsxs)(`section`,{id:`latest`,"aria-label":`Blog articles`,className:`mx-auto max-w-7xl px-4 pb-8 sm:px-6 lg:px-8`,children:[(0,g.jsx)(`h2`,{className:`sr-only`,children:`Articles`}),(0,g.jsxs)(`form`,{onSubmit:E,role:`search`,"aria-label":`Find articles`,className:`mb-4 grid gap-3 sm:grid-cols-[minmax(0,1fr)_minmax(12rem,18rem)]`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`label`,{htmlFor:`blog-search`,className:`mb-1.5 block text-sm font-medium text-slate-700`,children:`Search articles`}),(0,g.jsxs)(`div`,{className:`flex`,children:[(0,g.jsx)(`input`,{id:`blog-search`,type:`search`,name:`q`,value:x,onChange:e=>S(e.target.value),placeholder:`Title, description, or topic`,className:`min-w-0 flex-1 rounded-l-lg border border-r-0 border-slate-300 bg-white px-3 py-2.5 text-sm text-slate-950 placeholder:text-slate-400 focus:z-10 focus:border-amber-600 focus:outline-none focus:ring-1 focus:ring-amber-600`}),(0,g.jsxs)(`button`,{type:`submit`,className:`inline-flex items-center gap-2 rounded-r-lg bg-slate-900 px-4 py-2.5 text-sm font-medium text-white hover:bg-slate-700 focus-visible:z-10 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-amber-600`,children:[(0,g.jsx)(s,{className:`h-4 w-4`,"aria-hidden":`true`}),` Search`]})]})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`label`,{htmlFor:`blog-topic`,className:`mb-1.5 block text-sm font-medium text-slate-700`,children:`Topic`}),(0,g.jsxs)(`select`,{id:`blog-topic`,name:`topic`,value:b,onChange:e=>T(x,e.target.value),className:`w-full rounded-lg border border-slate-300 bg-white px-3 py-2.5 text-sm text-slate-950 focus:border-amber-600 focus:outline-none focus:ring-1 focus:ring-amber-600`,children:[(0,g.jsx)(`option`,{value:``,children:`All topics`}),b&&!C.some(e=>e.slug===b)&&(0,g.jsx)(`option`,{value:b,children:`Unknown topic`}),C.map(e=>(0,g.jsxs)(`option`,{value:e.slug,children:[e.name,` (`,e.count,`)`]},e.slug))]})]})]}),(0,g.jsxs)(`div`,{className:`mb-5 flex items-center justify-between gap-3 text-sm`,children:[(0,g.jsx)(`p`,{role:`status`,"aria-live":`polite`,className:`text-slate-500`,children:w.length===e.length?`${e.length} articles`:`${w.length} of ${e.length} articles`}),(y||b||x)&&(0,g.jsx)(`button`,{type:`button`,onClick:()=>{S(``),T(``,``)},className:`font-medium text-slate-700 underline underline-offset-4 hover:text-slate-950 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-amber-600`,children:`Clear filters`})]}),w.length===0&&(0,g.jsxs)(`div`,{className:`border-y border-slate-200 py-12 text-center`,children:[(0,g.jsx)(`h2`,{className:`text-xl font-semibold text-slate-950`,children:`No articles found`}),(0,g.jsx)(`p`,{className:`mt-2 text-sm text-slate-600`,children:`Try another search or choose a different topic.`}),(0,g.jsx)(`button`,{type:`button`,onClick:()=>{S(``),T(``,``)},className:`mt-5 rounded-lg bg-slate-900 px-4 py-2.5 text-sm font-medium text-white hover:bg-slate-700 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-amber-600`,children:`Show all articles`})]}),(0,g.jsx)(`div`,{className:`grid gap-6 md:grid-cols-2 xl:grid-cols-3`,children:w.map((e,t)=>(0,g.jsxs)(`article`,{className:`group relative overflow-hidden rounded-[2rem] border border-slate-200 bg-white shadow-sm transition-all duration-300 hover:-translate-y-1 hover:shadow-[0_24px_70px_-34px_rgba(15,23,42,0.45)]`,children:[(0,g.jsx)(p,{href:e.url,className:`absolute inset-0 z-10`,"aria-label":e.title}),(0,g.jsx)(`div`,{className:`pointer-events-none relative aspect-[16/10] overflow-hidden bg-slate-100`,children:e.coverImageUrl?(0,g.jsx)(`img`,{src:e.coverImageUrl,alt:e.coverImageAlt,className:`h-full w-full object-cover transition-transform duration-500 group-hover:scale-105`,loading:t===0?`eager`:`lazy`,fetchPriority:t===0?`high`:`auto`,decoding:`async`,ref:t=>
1{t?.complete&&t.naturalWidth===0&&_(t,e.coverImageFallbackUrl)},onError:t=>_(t.currentTarget,e.coverImageFallbackUrl),srcSet:e.coverImageSources?.map(e=>`${e.url} ${e.width}w`).join(`, `)||void 0,sizes:`(min-width: 1280px) 400px, (min-width: 768px) 50vw, 100vw`}):(0,g.jsx)(`div`,{className:`flex h-full items-end bg-[linear-gradient(135deg,#0f172a_0%,#1f2937_100%)] p-6 text-white`,children:(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.24em] text-white/70`,children:`Article`}),(0,g.jsx)(`p`,{className:`mt-3 text-2xl font-semibold tracking-tight`,children:e.title})]})})}),(0,g.jsxs)(`div`,{className:`pointer-events-none p-6`,children:[(0,g.jsx)(`h3`,{className:`text-2xl font-semibold tracking-tight text-slate-950 transition-colors group-hover:text-slate-700`,children:e.title}),(0,g.jsx)(`p`,{className:`mt-3 line-clamp-4 text-sm leading-7 text-slate-600`,children:e.brief}),(0,g.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-3 text-xs font-medium text-slate-500`,children:[(0,g.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,g.jsx)(r,{className:`h-3.5 w-3.5`}),e.publishedAtHuman]}),(0,g.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,g.jsx)(i,{className:`h-3.5 w-3.5`}),e.readTimeLabel]}),(0,g.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,g.jsx)(a,{className:`h-3.5 w-3.5`}),e.viewCount??0,` all-time views`]})]}),(0,g.jsx)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:e.tags.slice(0,4).map(e=>(0,g.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-slate-100 px-3 py-1 text-xs font-medium text-slate-600`,children:[(0,g.jsx)(c,{className:`h-3 w-3`}),e.name]},e.slug))}),(0,g.jsxs)(`div`,{className:`mt-6 inline-flex items-center gap-2 text-sm font-semibold text-slate-900`,children:[`Read article`,(0,g.jsx)(u,{className:`h-4 w-4`})]})]}),(0,g.jsx)(m,{url:e.shareUrl,title:e.title,shareTitle:e.title,label:`Share "${e.title}"`,theme:`slate`,wrapperClassName:`absolute right-4 top-4 z-20`,triggerClassName:`flex h-9 w-9 items-center justify-center rounded-full border border-slate-200 bg-white/90 text-slate-600 shadow-sm backdrop-blur transition hover:border-slate-300 hover:text-slate-950`})]},e.slug))})]}),(0,g.jsx)(`section`,{className:`mx-auto max-w-7xl px-4 pb-16 pt-8 sm:px-6 lg:px-8`,children:(0,g.jsx)(`div`,{className:`rounded-[2rem] border border-slate-200 bg-white p-8 shadow-sm`,children:(0,g.jsxs)(`div`,{className:`flex flex-col gap-5 md:flex-row md:items-center md:justify-between`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-sm font-semibold uppercase tracking-[0.24em] text-slate-500`,children:`Latest updates`}),(0,g.jsx)(`h2`,{className:`mt-2 text-2xl font-semibold text-slate-950`,children:`Get new articles in your feed.`}),(0,g.jsx)(`p`,{className:`mt-3 max-w-3xl text-slate-600`,children:`Follow the RSS feed to read new posts in your favorite reader.`})]}),(0,g.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:(0,g.jsxs)(`a`,{href:`/blog/feed.xml`,className:`inline-flex items-center gap-2 rounded-full border border-slate-200 px-5 py-3 text-sm font-semibold text-slate-700 transition-colors hover:border-slate-300 hover:text-slate-950`,children:[`RSS feed`,(0,g.jsx)(o,{className:`h-4 w-4`})]})})]})})})]})]})}export{v 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.