1import{r as u,a as j,p as P,j as e,d as w,B as v,i as y,e as S,u as E,f as m,g as $,h as I,k as U,l as A,t as n,I as C,m as Q,n as R}from"./index-BoxzjoAB.js";import{E as f}from"./EpisodeCard-Cb5qjgF6.js";import{P as k}from"./plus-CQmqf73o.js";import{P as z}from"./PodcastLinkCard-DYiANnZG.js";import"./placements-BLWnIkOX.js";import"./dialog-DAnxO7oC.js";const F={idle:"Add to Pastime",adding:"Adding...",added:"Added â",failed:"Failed â retry"};function p({podcast:a,isAdmin:h=!1}){const[d,o]=u.useState("idle"),[x,t]=u.useState(!1),i=x?j.logo:P(a);return e.jsxs("article",{className:"episode-card group flex flex-col overflow-hidden rounded-xl border border-border bg-card text-card-foreground shadow-[var(--shadow)] transition-[transform,box-shadow] duration-200 hover:-translate-y-0.5 hover:shadow-[var(--shadow-lg)]",children:[e.jsxs("div",{className:"flex min-[720px]:flex-1 min-[720px]:flex-col",children:[e.jsx("div",{className:"shrink-0 self-start overflow-hidden min-[720px]:w-full min-[720px]:self-auto min-[720px]:bg-muted",children:e.jsx("img",{className:"episode-card-art m-2 h-[130px] w-[130px] rounded-lg object-contain transition-transform duration-300 group-hover:scale-[1.03] min-[720px]:m-0 min-[720px]:aspect-square min-[720px]:h-auto min-[720px]:w-full min-[720px]:rounded-none min-[720px]:p-2.5",src:i,alt:a.title||a.name||"Podcast",loading:"lazy",onError:()=>t(!0)})}),e.jsxs("div",{className:"flex-1 p-3.5",children:[e.jsx("strong",{className:"text-[15px] leading-snug font-semibold",children:w(a.title||a.name||"",80)}),a.author?e.jsx("p",{className:"mt-2 mb-0 text-[13px] font-medium text-muted-foreground",children:a.author}):null]})]}),h&&a.isExternal&&a.feedUrl?e.jsx("div",{className:"p-3.5 pt-0",children:e.jsxs(v,{type:"button",disabled:d==="adding"||d==="added",onClick:l,children:[e.jsx(k,{size:16})," ",F[d]]})}):null]});async function l(){if(a.feedUrl){o("adding");try{await y(a.feedUrl),o("added")}catch(c){console.warn("error ingesting podcast",c),o("failed")}}}}function W(){const{q:a=""}=S.useSearch(),h=E({from:"/search"}),[d,o]=u.useState(a),x=m(R()),t=m($(a)),i=m(I(a)),l=m(U(a)),c=!!x.data?.isAdmin,g=t.isError||i.isError,b=[t.error,i.error].some(s=>A(s,429));return e.jsxs("main",{className:"page",children:[e.jsx("h1",{children:n("search.title")}),e.jsxs("form",{className:"mt-5 mb-7 flex gap-2.5",onSubmit:N,children:[e.jsx(C,{autoFocus:!0,value:d,onChange:s=>o(s.target.value),placeholder:n("search.placeholder")}),e.jsxs(v,{variant:"accent",size:"lg",className:"min-h-11",type:"submit",children:[e.jsx(Q,{size:16})," ",n("search.search-button")]})]}),a&&g?e.jsx("p",{className:"rounded-md border border-border bg-card px-4 py-3 text-muted-foreground",children:b?n("search.rate-limited"):n("search.failed")}):null,a&&!g?j.themeName==="PODNL"?e.jsxs(e.Fragment,{children:[e.jsxs("section",{children:[e.jsxs("h2",{children:[(i.data??[]).length," ",n("search.podcast-results")," '",a,"'"]}),e.jsx("div",{className:"grid",children:(i.data??[]).map((s,r)=>e.jsx(z,{podcast:s},`${s.slug||s.id}-${r}`))})]}),e.jsxs("section",{children:[e.jsxs("h2",{children:[(t.data??[]).length," ",n("search.search-results")," '",a,"'"]}),e.jsx("div",{className:"grid",children:(t.data??[]).map((s,r)=>e.jsx(f,{episode:s},`${s.id}-${r}`))})]}),c?e.jsxs("section",{children:[e.jsxs("h2",{children:[(l.data??[]).length," podcasts from PodcastIndex"]}),e.jsx("div",{className:"grid",children:(l.data??[]).map((s,r)=>e.jsx(p,{podcast:s,isAdmin:c},`${s.feedUrl||s.title}-${r}`))})]}):null]}):e.jsxs(e.Fragment,{children:[e.jsxs("section",{children:[e.jsxs("h2",{children:[(t.data??[]).length," ",n("search.search-results")," '",a,"'"]}),e.jsx("div",{className:"grid",children:(t.data??[]).map((s,r)=>e.jsx(f,{episode:s},`${s.id}-${r}`))})]}),e.jsxs("section",{children:[e.jsxs("h2",{children:[(l.data??[]).length," podcasts from PodcastIndex"]}),e.jsx("div",{className:"grid",children:(l.data??[]).map((s,r)=>e.jsx(p,{podcast:s,isAdmin:c},`${s.feedUrl||s.title}-${r}`))})]})]}):null]});function N(s){s.preventDefault(),h({search:{q:d.trim()}})}}export{W 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.