1import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-Biaal4sZ.js";import{n,t as r}from"./createServerFn-Bk23-1SV.js";import{t as i}from"./link-C4uCqMsc.js";import{t as a}from"./jsx-runtime-By8HlURe.js";import{t as o}from"./useServerFn-C-Yze0_2.js";import{t as s}from"./useQuery-Bk0o1c0V.js";import{t as c}from"./createLucideIcon-CcVDtW7H.js";import{r as l}from"./dist-BL0fwDEj.js";import{t as u}from"./circle-check-BQq9JdX_.js";import{t as d}from"./loader-circle-CXkiI-T3.js";import{t as f}from"./mail-DqjEX6SN.js";import{t as p}from"./search-gisWYDL1.js";import{t as m}from"./input-Biu6TUDg.js";import{c as h,d as g,f as _}from"./blog.functions-82jzHC3K.js";import{$ as v,F as y,L as b,N as x,P as S,R as C,Z as w,b as T,ct as E,et as D,it as O,nt as k,rt as A,tt as j}from"./index-D1jmmC4H.js";import{t as M}from"./badge-CNFZSuEx.js";var N=c(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),P=c(`rss`,[[`path`,{d:`M4 11a9 9 0 0 1 9 9`,key:`pv89mb`}],[`path`,{d:`M4 4a16 16 0 0 1 16 16`,key:`k0647b`}],[`circle`,{cx:`5`,cy:`19`,r:`1`,key:`bfqh0e`}]]),F=e(t(),1),I=r({method:`POST`}).handler(n(`8e869d38cb61f8d64eb9365f27b7dc439e41638483ca9fba7842ba044026cb06`)),L=a(),R={rate_limited:`Too many tries just now. Please wait a few minutes and try again.`,unavailable:`Subscriptions aren't available right now. Please try again later.`,failed:`That didn't go through. Please try again.`};function z({open:e,onOpenChange:t}){let n=o(I),[r,i]=(0,F.useState)(``),[a,s]=(0,F.useState)(``),[c,l]=(0,F.useState)(`idle`),[f,p]=(0,F.useState)(null);(0,F.useEffect)(()=>{e||(l(`idle`),p(null),i(``),s(``))},[e]);async function h(e){e.preventDefault();let t=r.trim();if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)){p(`Please enter a valid email address.`);return}p(null),l(`submitting`);try{let e=await n({data:{email:t,website:a}});e.ok?l(`done`):(l(`idle`),p(R[e.error??`failed`]??R.failed))}catch{l(`idle`),p(R.failed)}}return(0,L.jsx)(x,{open:e,onOpenChange:t,children:(0,L.jsxs)(S,{className:`max-h-[calc(100dvh-2rem)] w-[calc(100vw-2rem)] max-w-md overflow-y-auto`,children:[(0,L.jsxs)(b,{children:[(0,L.jsx)(C,{children:`Subscribe to the Alleba Blog`}),(0,L.jsx)(y,{children:c===`done`?`You're on the list.`:`Get new posts delivered to your inbox.`})]}),c===`done`?(0,L.jsxs)(`div`,{className:`grid gap-4 py-2`,children:[(0,L.jsxs)(`p`,{className:`flex items-start gap-2 text-sm text-muted-foreground`,children:[(0,L.jsx)(u,{"aria-hidden":`true`,className:`mt-0.5 size-4 text-primary`}),(0,L.jsx)(`span`,{children:`Thanks for subscribing â new Alleba Blog posts will land in your inbox.`})]}),(0,L.jsx)(E,{type:`button`,onClick:()=>t(!1),children:`Done`})]}):(0,L.jsxs)(`form`,{className:`grid gap-3`,onSubmit:h,children:[(0,L.jsx)(`label`,{className:`sr-only`,htmlFor:`blog-subscribe-email`,children:`Email address`}),(0,L.jsx)(m,{id:`blog-subscribe-email`,type:`email`,autoComplete:`email`,placeholder:`[email protected]`,value:r,onChange:e=>i(e.target.value),disabled:c===`submitting`,required:!0}),(0,L.jsx)(`input`,{"aria-hidden":`true`,className:`hidden`,tabIndex:-1,autoComplete:`off`,name:`website`,value:a,onChange:e=>s(e.target.value)}),f&&(0,L.jsx)(`p`,{className:`text-sm text-destructive`,children:f}),(0,L.jsxs)(E,{type:`submit`,disabled:c===`submitting`,children:[c===`submitting`&&(0,L.jsx)(d,{"aria-hidden":`true`,className:`animate-spin`}),`Subscribe`]})]})]})})}var B=`https://www.alleba.com/blog/feed/`;function V(e){return e?new Date(e).toLocaleDateString(`en-PH`,{year:`numeric`,month:`long`,day:`numeric`}):``}function H(){let{page:e=1,q:t,term:n}=T.useSearch(),[r,a]=(0,F.useState)(t??``),[o,c]=(0,F.useState)(!1),{data:u}=s({queryKey:[`blog-subtitle`],queryFn:()=>h({})}),{data:d,isLoading:y,error:b}=s({queryKey:[`blog-posts`,e,t??``,n??``],queryFn:()=>g({data:{page:e,search:t,term:n}})}),{data:x}=s({queryKey:[`blog-terms`],queryFn:()=>_(),staleTime:600*1e3}),S=x?.find(e=>e.slug===n);return(0,L.jsxs)(`main`,{className:`mx-auto max-w-5xl px-4 py-12`,children:[(0,L.jsx)(`p`,{className:`label-mono text-muted-foreground`,children:`Since 2001`}),(0,L.jsx)(`h1`,{className:`mt-2 text-4xl font-extrabold`,children:`Alleba Blog`}),(0,L.jsx)(`p`,{className:`mt-2 max-w-2xl text-muted-foreground`,children:u?.subtitle??`Notes on Philippine tech, the web, gadgets and everything in between.`}),(0,L.jsxs)(`form`,{className:`mt-6 flex max-w-md gap-2`,onSubmit:e=>{e.preventDefault();let t=r.trim();window.location.href=t?`/blog?q=${encodeURIComponent(t)}`:`/blog`},children:[(0,L.jsx)(m,{value:r,onChange:e=>a(e.target.value),placeholder:`Search the archive`,"aria-label":`Search the blog archive`}),(0,L.jsxs)(E,{type:`submit`,variant:`outline`,children:[(0,L.jsx)(p,{className:`h-4 w-4`}),(0,L.jsx)(`span`,{className:`sr-only`,children:`Search`})]})]}),(0,L.jsxs)(`div`,{className:`mt-10 grid gap-10 md:grid-cols-[1fr_220px]`,children:[(0,L.jsxs)(`div`,{children:[(t||S)&&(0,L.jsxs)(`p`,{className:`mb-6 text-sm text-muted-foreground`,children:[d?.total??0,` post`,(d?.total??0)===1?``:`s`,t?` matching â${t}â`:``,S?` in ${S.name}`:``,` ·`,` `,(0,L.jsx)(i,{to:`/blog`,search:{},className:`underline`,children:`clear`})]}),y&&(0,L.jsx)(`p`,{className:`text-muted-foreground`,children:`Loading postsâ¦`}),b&&(0,L.jsx)(`p`,{className:`text-muted-foreground`,children:`The blog archive is temporarily unavailable. Please try again shortly.`}),d&&d.posts.length===0&&!y&&(0,L.jsx)(`p`,{className:`text-muted-foreground`,children:`No posts found.`}),(0,L.jsx)(`div`,{className:`space-y-8`,children:d?.posts.map(e=>(0,L.jsxs)(`article`,{className:`border-b border-border pb-8`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(`time`,{className:`label-mono text-muted-foreground`,dateTime:e.date,children:V(e.date)}),e.categories.slice(0,2).map(e=>(0,L.jsx)(i,{to:`/blog/category/$slug`,params:{slug:e.slug},children:(0,L.jsx)(M,{variant:`secondary`,children:e.name})},e.slug))]}),(0,L.jsx)(`h2`,{className:`mt-2 text-2xl font-bold`,children:(0,L.jsx)(i,{to:`/blog/$`,params:{_splat:e.path},className:`hover:underline`,children:e.title})}),(0,L.jsx)(`p`,{className:`mt-2 text-muted-foreground`,children:e.excerpt})]},e.id))}),d&&d.totalPages>1&&(0,L.jsxs)(`div`,{className:`mt-10 flex items-center justify-between`,children:[(0,L.jsx)(E,{asChild:!0,variant:`outline`,disabled:e<=1,children:(0,L.jsx)(i,{to:`/blog`,search:{page:Math.max(1,e-1),q:t,term:n},children:`â Newer`})}),(0,L.jsxs)(`span`,{className:`label-mono text-muted-foreground`,children:[`Page `,e,` of `,d.totalPages]}),(0,L.jsx)(E,{asChild:!0,variant:`outline`,disabled:e>=d.totalPages,children:(0,L.jsx)(i,{to:`/blog`,search:{page:Math.min(d.totalPages,e+1),q:t,term:n},children:`Older â`})})]})]}),(0,L.jsxs)(`aside`,{className:`flex flex-col gap-3`,children:[(0,L.jsxs)(v,{children:[(0,L.jsx)(O,{asChild:!0,children:(0,L.jsxs)(E,{className:`w-full`,children:[(0,L.jsx)(N,{"aria-hidden":`true`}),`Subscribe`]})}),(0,L.jsxs)(D,{align:`end`,className:`w-[var(--radix-dropdown-menu-trigger-width)]`,children:[(0,L.jsxs)(j,{onSelect:()=>c(!0),children:[(0,L.jsx)(f,{"aria-hidden":`true`}),`Email updates`]}),(0,L.jsxs)(j,{onSelect:async()=>{try{await navigator.clipboard.writeText(B),w.success(`RSS link copied`)}catch{window.prompt(`Copy the Alleba Blog RSS link:`,B)}},children:[(0,L.jsx)(P,{"aria-hidden":`true`}),`Copy RSS link`]})]})]}),(0,L.jsx)(E,{asChild:!0,variant:`outline`,className:`w-full`,children:(0,L.jsx)(i,{to:`/blog/$`,params:{_splat:`guestbook`},children:`Guestbook`})}),(0,L.jsxs)(v,{children:[(0,L.jsx)(O,{asChild:!0,children:(0,L.jsxs)(E,{variant:`outline`,className:`w-full justify-between`,children:[(0,L.jsx)(`span`,{className:`truncate`,children:S?.name??`Categories`}),(0,L.jsx)(l,{"aria-hidden":`true`})]})}),(0,L.jsxs)(D,{align:`end`,className:`w-[var(--radix-dropdown-menu-trigger-width)]`,children:[(0,L.jsx)(k,{children:`Browse by category`}),(0,L.jsx)(A,{}),(0,L.jsx)(j,{asChild:!0,children:(0,L.jsx)(i,{to:`/blog`,search:{},children:`All categories`})}),x?.map(e=>(0,L.jsx)(j,{asChild:!0,children:(0,L.jsx)(i,{to:`/blog/category/$slug`,params:{slug:e.slug},children:e.name})},e.id))]})]})]})]}),(0,L.jsx)(z,{open:o,onOpenChange:c})]})}export{H as component};
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.