1import{r as i,f as H,j as e,o as q,B as n,m as x,h as B,I as M,H as y,F as b,d as Q,L as $,n as z}from"./index-QiiZ-xPT.js";import{N as v}from"./Navigation-r93ZBuy6.js";import{F as R}from"./Footer-3JNsJayo.js";import{S as L,a as F,b as I,c as E,d as U}from"./select-B1P2Vx_w.js";import{u as G}from"./useTranslation-XedzLvcK.js";import{G as K,L as O}from"./list-BTE2cUaq.js";import{P as J}from"./play-F_iIYdsj.js";import"./label-BA9Xin3m.js";import"./checkbox-CrGTwbPu.js";import"./index-DqZlRfV5.js";import"./check-KTa2Xihg.js";import"./dialog-D2VXyQJN.js";import"./Combination-TP2Egp2x.js";import"./save-BsB7cS8F.js";import"./dropdown-menu-D4zjGRmc.js";import"./index-BMyKsIJE.js";import"./index-Bj3iuRQR.js";import"./chevron-right-f4G5e4zR.js";import"./circle-2nw1jhuN.js";import"./globe-3tsuvpPT.js";import"./chevron-down-BWOHa16b.js";import"./log-out-CqAuLeet.js";import"./building-2-Bz-h5bHH.js";import"./BrandSponsor-DEW6i_On.js";import"./card-DkXabqFf.js";import"./mail-Cr62Xklx.js";import"./twitter-BzZd48jL.js";function o(s){if(!s)return"";const a=document.createElement("textarea");return a.innerHTML=s,a.value}function P(s){return s?s.replace(/<[^>]*>/g,"").trim():""}function Ne(){const{t:s}=G(),[a,N]=i.useState(""),[m,w]=i.useState(""),[c,S]=i.useState("All"),[r,h]=i.useState("All"),[f,C]=i.useState("grid");i.useEffect(()=>{const t=setTimeout(()=>{w(a)},300);return()=>clearTimeout(t)},[a]);const d=new URLSearchParams;m&&d.set("search",m),c!=="All"&&d.set("category",c),r!=="All"&&d.set("type",r);const{data:u,isLoading:T,error:V}=H({queryKey:["/api/library",m,c,r],queryFn:async()=>{const t=`/api/library${d.toString()?`?${d.toString()}`:""}`,l=await fetch(t);if(!l.ok)throw new Error("Failed to fetch library");return l.json()}}),p=u?.items||[],D=u?.filters?.categories||["All"],k=u?.filters?.types||["All"];if(T&&!u)return e.jsxs("div",{className:"bg-background text-foreground min-h-screen",children:[e.jsx(v,{}),e.jsx("div",{className:"flex items-center justify-center min-h-[60vh]",children:e.jsx(q,{className:"w-8 h-8 animate-spin text-primary","data-testid":"loading-spinner"})})]});if(V)return e.jsxs("div",{className:"bg-background text-foreground min-h-screen",children:[e.jsx(v,{}),e.jsx("div",{className:"flex items-center justify-center min-h-[60vh]",children:e.jsxs("div",{className:"text-center","data-testid":"error-message",children:[e.jsx("p",{className:"text-muted-foreground mb-4",children:"Failed to load content. Please try again."}),e.jsx(n,{onClick:()=>window.location.reload(),children:"Reload"})]})})]});const A=()=>{N(""),w(""),S("All"),h("All")};return e.jsxs("div",{className:"bg-background text-foreground min-h-screen",children:[e.jsx(v,{}),e.jsxs("section",{className:"pt-32 pb-8 relative overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-primary/10 via-trans
1parent to-accent/10"}),e.jsxs("div",{className:"max-w-7xl mx-auto px-6 relative",children:[e.jsx(x.h1,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"font-display text-4xl md:text-5xl font-bold mb-4",children:"Content Library"}),e.jsx(x.p,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},className:"text-lg text-muted-foreground max-w-2xl",children:"Explore our collection of podcasts, articles, and resources."})]})]}),e.jsx("section",{className:"py-8",children:e.jsxs("div",{className:"max-w-7xl mx-auto px-6",children:[e.jsxs(x.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},className:"flex flex-col md:flex-row gap-4 mb-8",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(B,{className:"absolute left-4 top-1/2 -translate-y-1/2 w-5 h-5 text-muted-foreground"}),e.jsx(M,{placeholder:"Search by title, category, or content...",value:a,onChange:t=>N(t.target.value),className:"pl-12 h-12 rounded-full","data-testid":"input-search"})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs(L,{value:c,onValueChange:S,children:[e.jsx(F,{className:"w-[180px] h-12 rounded-full","data-testid":"select-category",children:e.jsx(I,{placeholder:"Category"})}),e.jsx(E,{children:D.map(t=>e.jsx(U,{value:t,children:t},t))})]}),e.jsxs(L,{value:r,onValueChange:h,children:[e.jsx(F,{className:"w-[140px] h-12 rounded-full","data-testid":"select-type",children:e.jsx(I,{placeholder:"Type"})}),e.jsx(E,{children:k.map(t=>e.jsx(U,{value:t,children:t},t))})]}),e.jsxs("div",{className:"flex border border-border rounded-full overflow-hidden",children:[e.jsx(n,{variant:f==="grid"?"secondary":"ghost",size:"icon",className:"rounded-none h-12 w-12",onClick:()=>C("grid"),"data-testid":"button-view-grid",children:e.jsx(K,{size:18})}),e.jsx(n,{variant:f==="list"?"secondary":"ghost",size:"icon",className:"rounded-none h-12 w-12",onClick:()=>C("list"),"data-testid":"button-view-list",children:e.jsx(O,{size:18})})]})]})]}),e.jsx("div",{className:"flex items-center gap-2 mb-6 flex-wrap",children:k.map(t=>e.jsxs(n,{variant:r===t?"default":"outline",size:"sm",className:"rounded-full",onClick:()=>h(t),"data-testid":`button-type-${t.toLowerCase()}`,children:[t==="Podcast"&&e.jsx(y,{size:14,className:"mr-1"}),t==="Article"&&e.jsx(b,{size:14,className:"mr-1"}),t]},t))}),e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground","data-testid":"text-results-count",children:T?"Loading...":`Showing ${p.length} results`}),(m||c!=="All"||r!=="All")&&e.jsx(n,{variant:"ghost",size:"sm",onClick:A,"data-testid":"button-clear-all",children:"Clear filters"})]}),p.length===0?e.jsxs("div",{className:"text-center py-12","data-testid":"empty-results",children:[e.jsx(Q,{className:"w-16 h-16 mx-auto mb-4 text-muted-foreground"}),e.jsx("p",{className:"text-lg text-muted-foreground mb-2",children:"No content found"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Try adjusting your search or filters"}),e.jsx(n,{onClick:A,"data-testid":"button-clear-filters",children:"Clear Filters"})]}):f==="grid"?e.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:p.map((t,l)=>{const g=t.contentType==="podcast"?`/podcasts/${t.slug}`:`/articles/${t.slug}`,j=t.featuredImage?.url||"https://images.unsplash.com/photo-1522071820081-009f0129c71c?w=400&h=250&fit=crop";return e.jsx($,{href:g,children:e.jsxs(x.div,{initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{delay:l*.03},className:"group rounded-2xl bg-card border border-border overflow-hidden hover:border-primary/50 transition-all cursor-pointer","data-testid":`card-content-${t.id}`,children:[e.jsxs("div",{className:"aspect-video relative overflow-hidden",children:[e.jsx("img",{src:j,alt:o(t.title),className:"w-full h-full object-cover group-hover:scale-105 transition-transform"}),e.jsx("div",{className:"absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:e.jsx("div",{className:"w-14 h-14 roun
1ded-full bg-white/90 flex items-center justify-center",children:e.jsx(J,{className:"w-6 h-6 text-background ml-1",fill:"currentColor"})})})]}),e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("span",{className:"text-xs text-primary font-medium flex items-center gap-1","data-testid":`text-type-${t.id}`,children:[t.contentType==="podcast"?e.jsx(y,{size:12}):e.jsx(b,{size:12}),t.contentType.charAt(0).toUpperCase()+t.contentType.slice(1)]}),e.jsx("span",{className:"text-xs text-muted-foreground","data-testid":`text-category-${t.id}`,children:t.category})]}),e.jsx("h3",{className:"font-semibold mb-2 line-clamp-2","data-testid":`text-title-${t.id}`,children:o(t.title)}),e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-2",children:P(o(t.excerpt))}),e.jsxs("div",{className:"flex items-center text-xs text-muted-foreground",children:[e.jsx(z,{size:12,className:"mr-1"}),new Date(t.publishedAt).toLocaleDateString()]})]})]})},t.id)})}):e.jsx("div",{className:"space-y-4",children:p.map((t,l)=>{const g=t.contentType==="podcast"?`/podcasts/${t.slug}`:`/articles/${t.slug}`,j=t.featuredImage?.url||"https://images.unsplash.com/photo-1522071820081-009f0129c71c?w=400&h=250&fit=crop";return e.jsx($,{href:g,children:e.jsxs(x.div,{initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{delay:l*.03},className:"flex gap-4 p-4 rounded-2xl bg-card border border-border hover:border-primary/50 transition-all cursor-pointer","data-testid":`card-content-list-${t.id}`,children:[e.jsx("div",{className:"w-48 aspect-video rounded-xl overflow-hidden flex-shrink-0",children:e.jsx("img",{src:j,alt:o(t.title),className:"w-full h-full object-cover"})}),e.jsxs("div",{className:"flex-1 flex flex-col justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsxs("span",{className:"text-xs text-primary font-medium flex items-center gap-1","data-testid":`text-list-type-${t.id}`,children:[t.contentType==="podcast"?e.jsx(y,{size:12}):e.jsx(b,{size:12}),t.contentType.charAt(0).toUpperCase()+t.contentType.slice(1)]}),e.jsx("span",{className:"text-xs text-muted-foreground px-2 py-0.5 rounded-full bg-muted",children:t.category})]}),e.jsx("h3",{className:"font-semibold text-lg mb-2","data-testid":`text-list-title-${t.id}`,children:o(t.title)}),e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:P(o(t.excerpt))})]}),e.jsxs("div",{className:"flex items-center text-xs text-muted-foreground mt-2",children:[e.jsx(z,{size:12,className:"mr-1"}),new Date(t.publishedAt).toLocaleDateString()]})]})]})},t.id)})})]})}),e.jsx(R,{})]})}export{Ne 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.