1import{e as T,N as P,r as C,f as N,j as t,m as w,h as m,L as I,c as _,F as L,G,H as B}from"./index-QiiZ-xPT.js";import{N as D}from"./Navigation-r93ZBuy6.js";import{F as H}from"./Footer-3JNsJayo.js";import{u as K}from"./useTranslation-XedzLvcK.js";import"./label-BA9Xin3m.js";import"./checkbox-CrGTwbPu.js";import"./index-DqZlRfV5.js";import"./check-KTa2Xihg.js";import"./select-B1P2Vx_w.js";import"./index-BMyKsIJE.js";import"./Combination-TP2Egp2x.js";import"./chevron-down-BWOHa16b.js";import"./dialog-D2VXyQJN.js";import"./save-BsB7cS8F.js";import"./dropdown-menu-D4zjGRmc.js";import"./index-Bj3iuRQR.js";import"./chevron-right-f4G5e4zR.js";import"./circle-2nw1jhuN.js";import"./globe-3tsuvpPT.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";const M=[["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2",key:"1ksdt3"}],["path",{d:"M22 13a18.15 18.15 0 0 1-20 0",key:"12hx5q"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]],Q=T("briefcase-business",M),V=[{id:"enterprise-learning",slug:"enterprise",title:"E-Learning",excerpt:"Workplace learning for organizations, with curated modules, personalized paths, and enterprise solutions.",type:"service",url:"/learning/enterprise"},{id:"data-transformation",slug:"data-transformation",title:"Data Transformation",excerpt:"Transform workforce data into actionable insights with employee sentiment analysis, people and culture metrics, and predictive analytics.",type:"service",url:"/data-transformation"},{id:"brand-storytelling",slug:"brand-storytelling",title:"Brand Storytelling",excerpt:"Amplify your brand voice through podcasts, video content, and live events that tell authentic stories and resonate with diverse audiences.",type:"service",url:"/brand-storytelling"}],U=[{id:"individual-learning",slug:"learning",title:"Individual Learning",excerpt:"Grow your career with workplace learning on leadership, equity, and professional skills.",type:"learning",url:"/learning"},{id:"individual-subscription",slug:"pricing",title:"Individual Learning Subscription",excerpt:"Compare free and premium personal membership options for individual learners.",type:"learning",url:"/pricing"},{id:"learning-library",slug:"learning-modules",title:"Learning Library (sign-in required)",excerpt:"Sign in to browse the learning module library, personalized paths, and professional development content.",type:"learning",url:"/learning-modules"}],S=[{value:"all",label:"All"},{value:"podcast",label:"Episodes"},{value:"article",label:"Articles"},{value:"learning",label:"Learning"},{value:"service",label:"Services"}];function l(r){return r.replace(/<[^>]*>/g,"").trim()}function d(r,p){const x=p.toLowerCase();return[r.title,r.excerpt,r.content,r.acf?.description_a,r.acf?.featuring_a,r.acf?.descriptionl,r.acf?.title_description,...r.categories||[],...r.tags||[]].some(s=>s&&l(String(s)).toLowerCase().includes(x))}function be(){const{t:r}=K(),p=P(),a=new URLSearchParams(p).get("q")||"",[s,A]=C.useState("all"),{data:g,isLoading:k,error:E}=N({queryKey:["/api/wp/posts","all"],queryFn:async()=>{const e=await fetch("/api/wp/posts?perPage=100");
1if(!e.ok)throw new Error(`Articles search failed (${e.status})`);return e.json()},enabled:!!a}),{data:h,isLoading:F,error:$}=N({queryKey:["/api/wp/podcasts","all"],queryFn:async()=>{const e=await fetch("/api/wp/podcasts?perPage=100");if(!e.ok)throw new Error(`Episodes search failed (${e.status})`);return e.json()},enabled:!!a}),i=k||F,y=a&&g?g.filter(e=>d(e,a)).map(e=>({id:e.id,slug:e.slug,title:l(e.title),excerpt:l(e.excerpt||e.acf?.description_a||""),type:"article",publishedAt:e.publishedAt,url:`/thought-leadership/${e.slug}`,categories:e.categories||[],tags:e.tags||[]})):[],f=a&&h?h.filter(e=>d(e,a)).map(e=>({id:e.id,slug:e.slug,title:l(e.title),excerpt:l(e.excerpt||e.acf?.description_a||""),type:"podcast",publishedAt:e.publishedAt,url:`/podcasts/${e.slug}`,categories:e.categories||[],tags:e.tags||[]})):[],b=a?V.filter(e=>d(e,a)):[],v=a?U.filter(e=>d(e,a)):[],u=[...y,...f,...v,...b].sort((e,c)=>e.publishedAt&&c.publishedAt?new Date(c.publishedAt).getTime()-new Date(e.publishedAt).getTime():0),j={all:u.length,podcast:f.length,article:y.length,learning:v.length,service:b.length},o=s==="all"?u:u.filter(e=>e.type===s),z=!!(E||$),q=e=>{switch(e){case"article":return t.jsx(L,{size:16});case"podcast":return t.jsx(B,{size:16});case"learning":return t.jsx(G,{size:16});case"service":return t.jsx(Q,{size:16});default:return t.jsx(L,{size:16})}},R=e=>{switch(e){case"article":return r("search.typeArticle");case"podcast":return r("search.typePodcast");case"learning":return"Learning";case"service":return"Service";default:return r("search.typeContent")}};return t.jsxs("div",{className:"min-h-screen bg-background",children:[t.jsx(D,{}),t.jsx("section",{className:"pt-32 pb-8",children:t.jsx("div",{className:"max-w-4xl mx-auto px-6",children:t.jsxs(w.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5},children:[t.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[t.jsx(m,{size:32,className:"text-primary"}),t.jsx("h1",{className:"text-3xl md:text-4xl font-bold","data-testid":"text-search-title",children:r("search.title")})]}),a&&t.jsxs("p",{className:"text-muted-foreground text-lg","data-testid":"text-search-query",children:[r("search.showingResultsFor"),' "',t.jsx("span",{className:"text-foreground font-medium",children:a}),'"']})]})})}),t.jsx("section",{className:"pb-16",children:t.jsxs("div",{className:"max-w-4xl mx-auto px-6",children:[!a&&t.jsxs("div",{className:"text-center py-12","data-testid":"text-no-query",children:[t.jsx(m,{size:48,className:"mx-auto text-muted-foreground/50 mb-4"}),t.jsx("p",{className:"text-muted-foreground",children:r("search.enterSearchTerm")})]}),i&&t.jsx("div",{className:"space-y-4",children:[1,2,3].map(e=>t.jsxs("div",{className:"animate-pulse bg-card rounded-xl p-6",children:[t.jsx("div",{className:"h-4 bg-muted rounded w-1/4 mb-3"}),t.jsx("div",{className:"h-6 bg-muted rounded w-3/4 mb-2"}),t.jsx("div",{className:"h-4 bg-muted rounded w-full"})]},e))}),!i&&a&&t.jsx("div",{className:"flex flex-wrap gap-2 mb-6",role:"group","aria-label":"Filter search results by type","data-testid":"search-filters",children:S.map(e=>t.jsxs("button",{type:"button",onClick:()=>A(e.value),"aria-pressed":s===e.value,"aria-label":`${e.label}, ${j[e.value]} results`,className:`rounded-full border px-3 py-1.5 text-sm transition-colors ${s===e.value?"border-primary bg-primary text-primary-foreground":"border-border bg-card text-muted-foreground hover:border-primary/50 hover:text-foreground"}`,"data-testid":`filter-${e.value}`,children:[e.label," ",t.jsxs("span",{"aria-hidden":"true",children:["(",j[e.value],")"]})]},e.value))}),!i&&z&&t.jsx("div",{className:"mb-6 rounded-xl border border-destructive/40 bg-destructive/10 p-4 text-sm text-destructive",role:"alert",children:"Some search results could not be loaded. Please try again later."}),!i&&a&&o.length===0&&t.jsxs("div",{className:"text-center py-12","data-testid":"text-no-results",children:[t.jsx(m,{size:48,className:"mx-auto text-muted-foreground/50 mb-4"}),t.jsx("p",{className:"text-muted-foreground mb-2",children:s==="all"?r("search.noResultsFor",{query:a}):`No ${S.find(e=>e.value===s)?.label.toLowerCase()} found for "${a}".`}),t.jsx("p",{className:"text-sm text-muted-foreground",children:s==="all"?r("search.tryDifferentKeywords"):"Try another category or different keywords."})]}),!i&&o.length>0&&t.jsxs("div",{className:"space-y-4",children:[t.jsx("p",{className:"text-sm text-muted-foreground mb-6","data-testid":"text-result-count","aria-live":"polite",children:r("search.foundResults",{count:o.length})}),o.map((e,c)=>t.jsx(w.div,{initial:{opacity:0,y:10}
1,animate:{opacity:1,y:0},transition:{duration:.3,delay:c*.05},children:t.jsx(I,{href:e.url,children:t.jsxs("div",{className:"group bg-card rounded-xl p-6 border border-border hover:border-primary/50 transition-all cursor-pointer","data-testid":`card-result-${e.id}`,children:[t.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-2",children:[q(e.type),t.jsx("span",{children:R(e.type)})]}),t.jsx("h2",{className:"text-xl font-semibold mb-2 group-hover:text-primary transition-colors",children:e.title}),e.excerpt&&t.jsx("p",{className:"text-muted-foreground line-clamp-2",children:e.excerpt}),(e.categories&&e.categories.length>0||e.tags&&e.tags.length>0)&&t.jsxs("div",{className:"flex flex-wrap gap-2 mt-3",children:[e.categories?.slice(0,3).map(n=>t.jsx("span",{className:"text-xs px-2 py-1 bg-primary/10 text-primary rounded-full",children:n},n)),e.tags?.slice(0,3).map(n=>t.jsx("span",{className:"text-xs px-2 py-1 bg-muted text-muted-foreground rounded-full",children:n},n))]}),t.jsxs("div",{className:"mt-3 flex items-center text-primary text-sm font-medium",children:[r("search.view"),t.jsx(_,{size:14,className:"ml-1 group-hover:translate-x-1 transition-transform"})]})]})})},`${e.type}-${e.id}`))]})]})}),t.jsx(H,{})]})}export{be 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.