1import{u as e,r as a,j as s,L as t}from"./vendor-react-BH6F5oQJ.js";import{s as r,H as i,g as l,I as n,B as c,C as d,m as o,k as m}from"./index-dRqPaCFl.js";import{S as x}from"./ScholarMetrics-BYFFLWMJ.js";import{m as h,E as u}from"./vendor-icons-CaI5__By.js";import{f as p}from"./format-hXGQLsWs.js";import"./vendor-ui-B4WC06Sp.js";import"./vendor-query-CC4VRGyP.js";import"./vendor-supabase-COwyE4EW.js";import"./en-US-DUAJ-5Wt.js";const f=()=>{var f;const{id:_}=e(),[j,g]=a.useState(null),[b,v]=a.useState([]),[N,y]=a.useState([]),[w,k]=a.useState(!0);a.useEffect(()=>{S()},[_]);const S=async()=>{if(_)try{k(!0);const{data:e}=await r.from("fellows").select("id,slug,name,title,bio,expertise,avatar_url,linkedin_url,twitter_url,scholar_id,scholar_profile_url,scholar_h_index,scholar_i10_index,scholar_citations,scholar_last_synced,display_order,is_active").eq("id",_).maybeSingle(),{data:a}=e?{data:null}:await r.from("authors").select("id,name,role,bio,specialty,avatar_url,linkedin_url,twitter_url,scholar_id,scholar_profile_url,scholar_h_index,scholar_i10_index,scholar_citations,scholar_last_synced,publications_count,display_order,is_active").eq("id",_).maybeSingle(),s=e||a;if(!s)return g(null),v([]),void k(!1);const t={id:s.id,name:s.name,title:("title"in s?s.title:void 0)||("role"in s?s.role:void 0),role:("role"in s?s.role:void 0)||("title"in s?s.title:void 0),bio:s.bio,avatar_url:s.avatar_url,linkedin_url:s.linkedin_url,twitter_url:s.twitter_url,expertise:"expertise"in s?s.expertise:void 0,is_active:s.is_active};g(t);const{data:i}=await r.from("article_authors").select("article_id").eq("author_id",_);if(i&&i.length>0){const e=i.map(e=>e.article_id),{data:a}=await r.from("articles").select("id, title, subtitle, slug, published_at, featured_image_url").in("id",e).eq("status","published").order("published_at",{ascending:!1});v(a||[])}const{data:l}=await r.from("media_item_authors").select("media_item_id").eq("author_id",_);if(l&&l.length>0){const e=l.map(e=>e.media_item_id),{data:a}=await r.from("media_items").select("*").in("id",e).order("date",{ascending:!1});y(a||[])}else y([])}catch(e){g(null),v([]),y([])}finally{k(!1)}};return w?s.jsx("div",{className:"min-h-screen flex flex-col",children:s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx(h,{className:"h-8 w-8 animate-spin text-primary"})})}):j?s.jsxs("div",{className:"min-h-screen flex flex-col",children:[s.jsxs(i,{children:[s.jsxs("title",{children:[j.name," - Delphi Research"]}),s.jsx("meta",{name:"description",content:(null==(f=j.bio)?void 0:f.substring(0,160))||`Profile and publications by ${j.name}`})]}),s.jsxs("main",{className:"flex-1",children:[s.jsx("section",{className:"bg-gradient-to-b from-primary/5 to-background py-16",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs("div",{className:"max-w-4xl mx-auto",children:[s.jsxs("div",{className:"flex flex-col md:flex-row gap-8 items-start",children:[j.avatar_url?s.jsx("img",{src:l(j.avatar_url,{width:n.avatarLarge}),alt:j.name,decoding:"async",width:128,height:128,className:"w-32 h-32 rounded-full object-cover border-4 border-background shadow-lg"}):s.jsx("div",{className:"w-32 h-32 rounded-full bg-primary/10 flex items-center justify-center text-4xl font-bold text-primary border-4 border-background shadow-lg",children:j.name.charAt(0)}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h1",{className:"text-4xl font-bold mb-2",children:j.name}),j.title&&s.jsx("p",{className:"text-xl text-muted-foreground mb-4",children:j.title}),j.expertise&&j.expertise.length>0&&s.jsx("div",{className:"flex flex-wrap gap-2 mb-4",children:j.expertise.map((e,a)=>s.jsx(c,{variant:"secondary",children:e},a))}),s.jsxs("div",{className:"flex gap-4",children:[j.linkedin_url&&s.jsxs("a",{href:j.linkedin_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:text-primary/80 transition-colors flex items-center gap-1",children:["LinkedIn ",s.jsx(u,{className:"h-4 w-4"})]}),j.twitter_url&&s.jsxs("a",{href:j.twitter_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:text-primary/80 transition-colors flex items-center gap-1",children:["Twitter ",s.jsx(u,{className:"h-4 w-4"})]})]}),s.jsx(x,{hIndex:j.scholar_h_index,i10Index:j.scholar_i10_index,citations:j.scholar_citations,profileUrl:j.scholar_profile_url,lastSynced:j.scholar_last_synced,variant:"compact",className:"mt-4"})]})]}),j.bio&&s.jsx("div",{className:"mt-8 prose prose-lg max-w-none",children:s.jsx("p",{className:"text-muted-foreground leading-relaxed whitespace-pre-wrap",children:j.bio})})]})})}),s.jsx("section",{className:"py-16 bg-background",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs("div",{className:"max-w-4xl mx-auto",children:[s.jsx("h2",{className:"text-3xl font-bold mb-8",children:"Publications"}),0===b.length?s.jsx("p",{className:"text-muted-foreground",children:"No publications foun
1d."}):s.jsx("div",{className:"grid gap-6",children:b.map(e=>s.jsx(t,{to:`/articles/${e.slug}`,children:s.jsx(d,{className:"hover:shadow-lg transition-shadow cursor-pointer",children:s.jsx(o,{className:"p-6",children:s.jsxs("div",{className:"flex gap-6",children:[e.featured_image_url&&s.jsx("img",{src:l(e.featured_image_url,{width:n.avatarLarge}),alt:e.title,loading:"lazy",decoding:"async",width:128,height:128,className:"w-32 h-32 object-cover rounded"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h3",{className:"text-xl font-bold mb-2 hover:text-primary transition-colors",children:e.title}),e.subtitle&&s.jsx("p",{className:"text-muted-foreground mb-3",children:e.subtitle}),e.published_at&&s.jsx("p",{className:"text-sm text-muted-foreground",children:p(new Date(e.published_at),"MMMM d, yyyy")})]})]})})})},e.id))})]})})}),N.length>0&&s.jsx("section",{className:"py-16 bg-muted/20",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs("div",{className:"max-w-4xl mx-auto",children:[s.jsx("h2",{className:"text-3xl font-bold mb-8",children:"Media Appearances"}),s.jsx("div",{className:"grid gap-6",children:N.map(e=>s.jsx(d,{className:"hover:shadow-lg transition-shadow",children:s.jsx(o,{className:"p-6",children:s.jsxs("div",{className:"flex gap-6",children:[e.thumbnail_url&&s.jsx("img",{src:l(e.thumbnail_url,{width:n.avatarLarge}),alt:e.title,loading:"lazy",decoding:"async",width:128,height:128,className:"w-32 h-32 object-cover rounded"}),s.jsxs("div",{className:"flex-1",children:[s.jsx(c,{variant:"secondary",className:"mb-2",children:"press"===e.category?"Press":"Audio & Video"}),s.jsx("h3",{className:"text-xl font-bold mb-2",children:e.title}),s.jsx("p",{className:"text-muted-foreground mb-3 line-clamp-2",dangerouslySetInnerHTML:{__html:m(e.description)}}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:e.date}),e.url&&s.jsxs("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:text-primary/80 transition-colors flex items-center gap-1",children:["View ",s.jsx(u,{className:"h-4 w-4"})]})]})]})]})})},e.id))})]})})})]})]}):s.jsx("div",{className:"min-h-screen flex flex-col",children:s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h1",{className:"text-2xl font-bold mb-4",children:"Author not found"}),s.jsx(t,{to:"/articles",className:"text-primary hover:underline",children:"Back to Articles"})]})})})};export{f 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.