PageSourceSearch

https://www.thevoyage.ai/assets/blog-DmzgRaZ4.js

js thevoyage.ai collected 2026-09-24 13:30:25 UTC 9,564 bytes, 1 lines download raw bytes

1import{a as e}from"./chunk-BEqpzyXh.js";import{n as t}from"./createLucideIcon-CEDU0v2w.js";import{t as n}from"./link-74wx8yzR.js";import{t as r}from"./jsx-runtime-DOlcsXOY.js";import"./useRouterState-BamRzxzd.js";import{t as i}from"./useNavigate-DKl-NOEl.js";import"./analytics-Bu3-liUf.js";import"./supabase-browser-DrIxmP-5.js";import"./axios-DxGdMZ80.js";import"./telemetry-BzHmw3VF.js";import"./store-badges-gcPnmsEm.js";import{t as a}from"./chevron-left-BBz6J1sx.js";import{t as o}from"./chevron-right-Dd_rquck.js";import"./use-subscription-status-BuJ4iNC-.js";import"./seo-title-experiments-BM9eG6Aj.js";import"./seo-CVabGtHM.js";import"./voyage-blog-api-BaifH-wc.js";import{a as s,c,i as l,n as u,r as d,s as f,t as p}from"./blog-categories-CpLlvYAM.js";import{t as m}from"./format-date-BYQZIphq.js";import{At as h}from"./main-BS7EFwYa.js";import{n as g,t as _}from"./landing-nav-hZnYelFF.js";import"./nav-chrome-DROn8h3H.js";import"./proxy-CQpRYXm2.js";import{t as v}from"./animate-on-scroll-Ba3Aty4C.js";import{t as y}from"./blog-pagination-1GEzm9h0.js";var b=e(t()),x=r();function S(){let{posts:e}=h.useLoaderData(),{pet:t=`all`,symptom:r=`all`,page:S=1}=h.useSearch(),C=i(),[w,T]=(0,b.useState)(``),E=(0,b.useRef)(null),D=t,O=r,k=(0,b.useMemo)(()=>e.filter(e=>D===`all`||s(e.slug)===D),[e,D]),A=(0,b.useMemo)(()=>{let e=new Map;for(let t of k){let n=c(t);n&&e.set(n.key,(e.get(n.key)??0)+1)}return e},[k]),j=(0,b.useMemo)(()=>{let e=w.trim().toLowerCase();return k.filter(t=>O!==`all`&&c(t)?.key!==O?!1:e?t.title.toLowerCase().includes(e)||t.excerpt.toLowerCase().includes(e)||t.slug.toLowerCase().includes(e):!0)},[k,w,O]),M=(0,b.useMemo)(()=>{let t=new Map;for(let n of e){let e=s(n.slug);t.set(e,(t.get(e)??0)+1)}return t},[e]),N=Math.max(1,Math.ceil(j.length/24)),P=Math.min(Math.max(1,S),N),F=(P-1)*24,I=j.slice(F,F+24),L=()=>{E.current?.scrollIntoView({behavior:`smooth`,block:`start`})},R=e=>({pet:D===`all`?void 0:D,symptom:e===`all`?void 0:e,page:void 0}),z=e=>{T(e),P!==1&&C({to:`/blog`,search:e=>({...e,page:void 0}),replace:!0})},B=e=>{let t=Math.min(Math.max(1,e),N);return{pet:D===`all`?void 0:D,symptom:O===`all`?void 0:O,page:t<=1?void 0:t}},V=()=>{T(``),C({to:`/blog`,search:{}})},H=d.filter(e=>(A.get(e.key)??0)>0),U=u.map(e=>({key:e,meta:l(e),count:M.get(e)??0}
1)).filter(e=>e.count>0),W=w!==``||D!==`all`||O!==`all`;return(0,x.jsxs)(`div`,{className:`min-h-svh bg-surface-cream font-body`,children:[(0,x.jsx)(_,{}),(0,x.jsx)(`main`,{className:`landing-section`,children:(0,x.jsxs)(`div`,{className:`mx-auto max-w-7xl`,children:[(0,x.jsxs)(v,{className:`text-center`,children:[(0,x.jsx)(`h1`,{className:`font-heading text-4xl font-bold italic text-text-primary sm:text-5xl md:text-6xl`,children:`Pet Health Library`}),(0,x.jsx)(`p`,{className:`mx-auto mt-4 max-w-xl text-base text-text-secondary`,children:`Guides to pet symptoms and conditions, cited to the veterinary literature — what's normal, what's not, and when to see a vet.`})]}),(0,x.jsx)(`div`,{className:`mt-10 flex justify-center`,children:(0,x.jsxs)(`div`,{className:`relative w-full max-w-md`,children:[(0,x.jsxs)(`svg`,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-text-tertiary`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,"aria-hidden":`true`,children:[(0,x.jsx)(`title`,{children:`Search`}),(0,x.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M21 21l-4.35-4.35M17 11A6 6 0 1 1 5 11a6 6 0 0 1 12 0z`})]}),(0,x.jsx)(`input`,{type:`text`,placeholder:`Search articles...`,value:w,onChange:e=>z(e.target.value),className:`w-full rounded-full border border-surface-border bg-white py-2 pl-9 pr-4 text-sm text-text-primary placeholder:text-text-tertiary focus:outline-none focus:ring-2 focus:ring-brand-coral/25`})]})}),(0,x.jsx)(`p`,{className:`mt-8 text-center text-xs font-semibold uppercase tracking-wide text-text-tertiary`,children:`Browse by pet`}),(0,x.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-center gap-2`,children:[D!==`all`&&(0,x.jsxs)(n,{to:`/blog`,search:{pet:void 0,symptom:O===`all`?void 0:O,page:void 0},onClick:L,className:`rounded-full border border-surface-border bg-white px-4 py-1.5 text-sm font-medium text-text-secondary no-underline transition-colors hover:bg-surface-cream`,children:[`← All pets (`,e.length,`)`]}),U.map(({key:e,meta:t,count:r})=>(0,x.jsxs)(n,{to:p[e],className:`flex items-center gap-1 rounded-full border border-surface-border bg-white px-4 py-1.5 text-sm font-medium text-text-secondary no-underline transition-colors hover:bg-surface-cream`,children:[(0,x.jsx)(`span`,{children:t.emoji}),(0,x.jsx)(`span`,{children:t.plural}),(0,x.jsxs)(`span`,{className:`opacity-60`,children:[`(`,r,`)`]})]},e))]}),H.length>0&&(0,x.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-center gap-1.5`,children:[(0,x.jsx)(n,{to:`/blog`,search:R(`all`),onClick:L,className:`rounded-full px-3 py-1 text-xs font-medium no-underline transition-colors ${O===`all`?`bg-cta-black text-text-inverse`:`bg-white text-text-secondary hover:bg-surface-cream border border-surface-border`}`,children:`All topics`}),H.map(e=>{let t=A.get(e.key)??0,r=O===e.key;return(0,x.jsxs)(n,{to:`/blog`,search:R(r?`all`:e.key),onClick:L,className:`rounded-full px-3 py-1 text-xs font-medium no-underline transition-colors flex items-center gap-1 ${r?`${e.bg} ${e.text} ring-1 ring-current`:`bg-white text-text-secondary hover:bg-surface-cream border border-surface-border`}`,children:[(0,x.jsx)(`span`,{children:e.emoji}),(0,x.jsx)(`span`,{children:e.label}),(0,x.jsxs)(`span`,{className:`opacity-60`,children:[`(`,t,`)`]})]},e.key)})]}),(0,x.jsx)(`div`,{ref:E,className:`scroll-mt-24`}),j.length===0?(0,x.jsxs)(`div`,{className:`mt-16 text-center text-text-tertiary`,children:[(0,x.jsx)(`p`,{className:`text-lg`,children:`No articles found`}),(0,x.jsx)(`button`,{type:`button`,onClick:V,className:`mt-4 text-sm underline hover:text-text-primary`,children:`Clear filters`})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`p`,{className:`mt-6 text-center text-sm text-text-tertiary`,children:[`Showing `,F+1,`–`,Math.min(F+24,j.length),` of`,` `,j.length,` article`,j.length===1?``:`s`,W?` found`:``]}),(0,x.jsx)(`div`,{className:`mt-6 grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3`,children:I.map((e,t)=>{let r=f(e.slug),i=s(e.slug),a=c(e);return(0,x.jsx)(v,{delay:Math.min(t,8)*.05,animation:`fade-up`,children:(0,x.jsxs)(n,{to:`/blog/$slug`,params:{slug:e.slug},className:`group flex flex-col overflow-hidden rounded-2xl bg-white border border-surface-border transition-shadow hover:shadow-md h-full`,children:[(0,x.jsx)(`div`,{className:`${r.bg} px-5 pt-5 pb-4`,children:(0,x.jsxs)(`div`,{className:`flex items-center justify-between`,children:[i===`other`?(0,x.jsx)(`span`,{}):(0,x.jsxs)(`span`,{className:`text-xs font-medium ${r.text} flex items-center gap-1`,children:[(0,x.jsx)(`span`,{children:r.emoji}),(0,x.jsx)(`span`,{children:r.label})]}),(0,x.jsx)(`span`,{className:`text-xs text-text-tertiary`,children:m(e.publishedAt)})]})}),(0,x.jsxs)(`div`,{className:`flex flex-col flex-1 p-5`,children:[a&&(0,x.jsxs)(`span`,{className:`mb-2 inline-flex w-fit items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide ${a.bg} ${a.text}`,children:[(0,x.jsx)(`span`,{children:a.emoji}),(0,x.jsx)(`span`,{children:a.label})]}),(0,x.jsx)(`h2`,{className:`font-heading text-base font-semibold text-text-primary leading-snug group-hover:text-text-secondary transition-colors`,children:e.title}),(0,x.jsx)(`p`,{className:`mt-2 text-sm text-text-secondary leading-relaxed line-clamp-3 flex-1`,children:e.excerpt}),(0,x.jsx)(`p`,{className:`mt-4 text-xs font-medium text-text-tertiary group-hover:text-text-primary transition-colors`,children:`Read more →`})]})]})},e.slug)})}),N>1&&(0,x.jsxs)(`nav`,{"aria-label":`Pagination`,className:`mt-12 flex items-center justify-center gap-1.5`,children:[P===1?(0,x.jsx)(`span`,{"aria-hidden":`true`,className:`inline-flex h-9 w-9 items-center justify-center rounded-full border border-surface-border bg-white text-text-secondary opacity-40`,children:(0,x.jsx)(a,{className:`size-4`})}):(0,x.jsx)(n,{to:`/blog`,search:B(P-1),onClick:L,"aria-label":`Previous page`,className:`inline-flex h-9 w-9 items-center justify-center rounded-full border border-surface-border bg-white text-text-secondary no-u
1nderline transition-colors hover:bg-surface-cream`,children:(0,x.jsx)(a,{className:`size-4`,"aria-hidden":`true`})}),y(P,N).map(e=>typeof e==`string`?(0,x.jsx)(`span`,{className:`px-1 text-sm text-text-tertiary`,"aria-hidden":`true`,children:`…`},e):(0,x.jsx)(n,{to:`/blog`,search:B(e),onClick:L,"aria-current":e===P?`page`:void 0,className:`inline-flex h-9 min-w-9 items-center justify-center rounded-full px-3 text-sm font-medium no-underline transition-colors ${e===P?`bg-cta-black text-text-inverse`:`border border-surface-border bg-white text-text-secondary hover:bg-surface-cream`}`,children:e},e)),P===N?(0,x.jsx)(`span`,{"aria-hidden":`true`,className:`inline-flex h-9 w-9 items-center justify-center rounded-full border border-surface-border bg-white text-text-secondary opacity-40`,children:(0,x.jsx)(o,{className:`size-4`})}):(0,x.jsx)(n,{to:`/blog`,search:B(P+1),onClick:L,"aria-label":`Next page`,className:`inline-flex h-9 w-9 items-center justify-center rounded-full border border-surface-border bg-white text-text-secondary no-underline transition-colors hover:bg-surface-cream`,children:(0,x.jsx)(o,{className:`size-4`,"aria-hidden":`true`})})]})]})]})}),(0,x.jsx)(g,{})]})}export{S 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.