1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[507],{25328:(e,i,l)=>{l.d(i,{MediaBrowser:()=>T});var a=l(61929),t=l(189),s=l(54844),r=l(97075),d=l(60181),n=l(16561),c=l(37487),o=l(46803),h=l(32945),u=l(46300),m=l(64491),p=l(63795),x=l(1580),j=l(24535),v=l(18925),g=l(88769),f=l(1338),b=l(84872),w=l(96980),y=l(47959),N=l(23386),_=l(73651);let C={podcast:j.A,youtube:v.A,interview:g.A,article:f.A},S={podcast:"Podcast",youtube:"YouTube",interview:"Interview",article:"Article"};function T(e){let{initialMediaItems:i,isAdminView:l=!1,title:j="Media",description:v,className:f=""}=e,{toast:T}=(0,_.dj)(),[k,A]=(0,t.useState)(i||[]),[E,F]=(0,t.useState)(!i),[L,z]=(0,t.useState)(""),[J,D]=(0,t.useState)("all"),[I,M]=(0,t.useState)([]),[P,V]=(0,t.useState)([]),[$,R]=(0,t.useState)(!1),[X,Y]=(0,t.useState)(!1),[O,U]=(0,t.useState)({title:"",description:"",media_type:"",url:"",platform:"",thumbnail_url:"",published_at:"",person_id:"",organization_ids:[]}),[q,B]=(0,t.useState)(!1),[G,W]=(0,t.useState)(null),[Z,Q]=(0,t.useState)(!1);(0,t.useEffect)(()=>{i||H()},[i]),(0,t.useEffect)(()=>{l&&(fetch("/api/admin/organizations").then(e=>e.ok?e.json():{organizations:[]}).then(e=>M(e.organizations||[])).catch(()=>M([])),fetch("/api/admin/people").then(e=>e.ok?e.json():{people:[]}).then(e=>V(e.people||[])).catch(()=>V([])))},[l]);let H=async()=>{try{F(!0);let e=await fetch("/api/admin/media",{method:"GET",headers:{"Content-Type":"application/json"}});if(!e.ok)return void A([]);let i=await e.json();A(i.mediaItems||[])}catch(e){console.error("Error fetching media items:",e),A([])}finally{F(!1)}},K=(0,t.useMemo)(()=>k&&0!==k.length?k.filter(e=>{var i,l;let a=(null==(i=e.title)?void 0:i.toLowerCase().includes(L.toLowerCase()))||(null==(l=e.description)?void 0:l.toLowerCase().includes(L.toLowerCase())),t="all"===J||e.media_type===J;return a&&t}).sort((e,i)=>{let l=e.published_at?new Date(e.published_at).getTime():0;return(i.published_at?new Date(i.published_at).getTime():0)-l}):[],[k,L,J]),ee=async()=>{if(G){Q(!0);try{let e=await fetch("/api/admin/media/".concat(G.id),{method:"DELETE"});if(!e.ok){let i=await e.json();throw Error(i.error||"Failed to delete media item")}A(e=>e.filter(e=>e.id!==G.id)),T({title:"Media item deleted",description:"".concat(G.title," has been deleted")}),B(!1),W(null)}catch(e){T({title:"Delete failed",description:e instanceof Error?e.message:"Failed to delete media item",variant:"destructive"})}finally{Q(!1)}}},ei=()=>{U({title:"",description:"",media_type:"",url:"",platform:"",thumbnail_url:"",published_at:"",person_id:"",organization_ids:[]})},el=async()=>{if(!O.title.trim()||!O.media_type||!O.url.trim())return void T({title:"Validation Error",description:"Title, type, and URL are required",variant:"destructive"});Y(!0);try{let e=await fetch("/api/admin/media",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:O.title,description:O.description||void 0,media_type:O.media_type,url:O.url,platform:O.platform||void 0,thumbnail_url:O.thumbnail_url||void 0,published_at:O.published_at||void 0,person_id:O.person_id||void 0,organization_ids:O.organization_ids})});if(!e.ok){let i=await e.json();throw Error(i.error||"Failed to create media item")}let i=await e.json();A(e=>[i.mediaItem,...e]),R(!1),ei(),T({title:"Success",description:'"'.concat(i.mediaItem.title,'" created')})}catch(e){T({title:"Error",description:e instanceof Error?e.message:"Failed to create media item",variant:"destructive"})}finally{Y(!1)}};return(0,a.jsxs)("div",{className:"space-y-6 ".concat(f),children:[(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-4xl font-bold mb-4",children:j}),v&&(0,a.jsx)("p",{className:"text-xl text-muted-foreground",children:v})]}),l&&(0,a.jsxs)(r.$,{onClick:()=>R(!0),className:"sm:mt-2",children:[(0,a.jsx)(b.A,{className:"w-4 h-4 mr-2"}),"Add Media"]})]}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(w.A,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,a.jsx)(d.p,{placeholder:"Search interviews, podcasts, videos...",value:L,onChange:e=>z(e.target.value),className:"pl-10"})]}),(0,a.jsx)(p.tU,{value:J,onValueChange:e=>D(e),children:(0,a.jsxs)(p.j7,{children:[(0,a.jsx)(p.Xi,{value:"all",children:"All"}),(0,a.jsx)(p.Xi,{value:"podcast",children:"Podcasts"}),(0,a.jsx)(p.Xi,{value:"youtube",children:"YouTube"}),(0,a.jsx)(p.Xi,{value:"interview",children:"Interviews"}),(0,a.jsx)(p.Xi,{value:"article",children:"Articles"})]})})]}),E?(0,a.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,a.jsx)("div",{className:"text-muted-foreground",children:"Loading media..."})}):(0,a.jsx)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",children:K.map(e=>{var i;let t=C[e.media_type];return(0,a.jsxs)(n.Zp,{className:"h-full flex flex-col",children:[e.thumbnail_url&&(0,a.jsx)("div",{className:"aspect-video w-full overflow-hidden rounded-t-lg bg-muted",children:(0,a.jsx)("img",{src:e.thumbnail_url,alt:e.title,className:"h-full w-full object-cover"})}),(0,a.jsxs)(n.aR,{className:"pb-2",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,a.jsxs)(s.E,{variant:"secondary",className:"text-xs flex items-center gap-1",children:[(0,a.jsx)(t,{className:"h-3 w-3"}),S[e.media_type]]}),l&&(0,a.jsxs)(x.rI,{children:[(0,a.jsx)(x.ty,{asChild:!0,children:(0,a.jsx)(r.$,{variant:"ghost",size:"icon",className:"h-6 w-6",children:(0,a.jsx)(y.A,{className:"h-4 w-4"})})}),(0,a.jsx)(x.SQ,{align:"end",children:(0,a.jsx)(x._2,{onClick:i=>{null==i||i.stopPropagation(),W(e),B(!0)},children:"Delete"})})]})]}),(0,a.jsx)(n.ZB,{className:"text-base line-clamp-2 mt-1",children:e.title})]}),(0,a.jsxs)(n.Wu,{className:"pt-0 flex-1 flex flex-col justify-between",children:[e.description&&(0,a.jsx)(n.BT,{className:"line-clamp-3 mb-3",children:e.description}),(0,a.jsxs)("div",{className:"flex items-center justify-between text-sm text-muted-foreground mt-auto",children:[(0,a.jsx)("span",{children:(null==(i=e.people)?void 0:i.name)||""}),(0,a.jsxs)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-blue-600 hover:underline",children:["Watch/Listen",(0,a.jsx)(N.A,{className:"h-3 w-3"})]})]})]})]},e.id)})}),!E&&0===K.length&&(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)(g.A,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),(0,a.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"No Media Found"}),(0,a.jsx)("p",{className:"text-muted-foreground",children:L||"all"!==J?"Try adjusting your search or filters":"There are currently no interviews, podcasts, or videos to display"})]}),(0,a.jsx)(c.lG,{open:$,onOpenChange:R,children:(0,a.jsxs)(c.Cf,{className:"sm:max-w-[550
1px] max-h-[85vh] overflow-y-auto",children:[(0,a.jsxs)(c.c7,{children:[(0,a.jsx)(c.L3,{children:"Add Media"}),(0,a.jsx)(c.rr,{children:"Link an interview, podcast episode, YouTube video, or article."})]}),(0,a.jsxs)("div",{className:"grid gap-4 py-4",children:[(0,a.jsxs)("div",{className:"grid gap-2",children:[(0,a.jsx)(o.J,{htmlFor:"media-title",children:"Title *"}),(0,a.jsx)(d.p,{id:"media-title",value:O.title,onChange:e=>U(i=>({...i,title:e.target.value})),placeholder:"Episode or video title"})]}),(0,a.jsxs)("div",{className:"grid gap-2",children:[(0,a.jsx)(o.J,{htmlFor:"media-description",children:"Description"}),(0,a.jsx)(h.T,{id:"media-description",value:O.description,onChange:e=>U(i=>({...i,description:e.target.value})),rows:3})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{className:"grid gap-2",children:[(0,a.jsx)(o.J,{htmlFor:"media-type",children:"Type *"}),(0,a.jsxs)(m.l6,{value:O.media_type,onValueChange:e=>U(i=>({...i,media_type:e})),children:[(0,a.jsx)(m.bq,{children:(0,a.jsx)(m.yv,{placeholder:"Select type"})}),(0,a.jsxs)(m.gC,{children:[(0,a.jsx)(m.eb,{value:"podcast",children:"Podcast"}),(0,a.jsx)(m.eb,{value:"youtube",children:"YouTube"}),(0,a.jsx)(m.eb,{value:"interview",children:"Interview"}),(0,a.jsx)(m.eb,{value:"article",children:"Article"})]})]})]}),(0,a.jsxs)("div",{className:"grid gap-2",children:[(0,a.jsx)(o.J,{htmlFor:"media-platform",children:"Platform"}),(0,a.jsx)(d.p,{id:"media-platform",value:O.platform,onChange:e=>U(i=>({...i,platform:e.target.value})),placeholder:"spotify, youtube, substack..."})]})]}),(0,a.jsxs)("div",{className:"grid gap-2",children:[(0,a.jsx)(o.J,{htmlFor:"media-url",children:"URL *"}),(0,a.jsx)(d.p,{id:"media-url",type:"url",value:O.url,onChange:e=>U(i=>({...i,url:e.target.value})),placeholder:"https://..."})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{className:"grid gap-2",children:[(0,a.jsx)(o.J,{htmlFor:"media-thumbnail",children:"Thumbnail URL"}),(0,a.jsx)(d.p,{id:"media-thumbnail",value:O.thumbnail_url,onChange:e=>U(i=>({...i,thumbnail_url:e.target.value})),placeholder:"https://..."})]}),(0,a.jsxs)("div",{className:"grid gap-2",children:[(0,a.jsx)(o.J,{htmlFor:"media-published",children:"Published date"}),(0,a.jsx)(d.p,{id:"media-published",type:"date",value:O.published_at,onChange:e=>U(i=>({...i,published_at:e.target.value}))})]})]}),(0,a.jsxs)("div",{className:"grid gap-2",children:[(0,a.jsx)(o.J,{htmlFor:"media-person",children:"Featured person"}),(0,a.jsxs)(m.l6,{value:O.person_id,onValueChange:e=>U(i=>({...i,person_id:e})),children:[(0,a.jsx)(m.bq,{children:(0,a.jsx)(m.yv,{placeholder:"None"})}),(0,a.jsx)(m.gC,{children:P.map(e=>(0,a.jsx)(m.eb,{value:e.id,children:e.name},e.id))})]})]}),I.length>0&&(0,a.jsxs)("div",{className:"grid gap-2",children:[(0,a.jsx)(o.J,{children:"Featured organizations"}),(0,a.jsx)("div",{className:"grid gap-2 max-h-32 overflow-y-auto border rounded-md p-2",children:I.map(e=>(0,a.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,a.jsx)(u.S,{checked:O.organization_ids.includes(e.id),onCheckedChange:i=>{U(l=>({...l,organization_ids:i?[...l.organization_ids,e.id]:l.organization_ids.filter(i=>i!==e.id)}))}}),e.name]},e.id))})]})]}),(0,a.jsxs)(c.Es,{children:[(0,a.jsx)(r.$,{variant:"outline",onClick:()=>{R(!1),ei()},disabled:X,children:"Cancel"}),(0,a.jsx)(r.$,{onClick:el,disabled:X,children:X?"Adding...":"Add Media"})]})]})}),(0,a.jsx)(c.lG,{open:q,onOpenChange:B,children:(0,a.jsxs)(c.Cf,{children:[(0,a.jsxs)(c.c7,{children:[(0,a.jsx)(c.L3,{children:"Delete Media Item"}),(0,a.jsxs)(c.rr,{children:['Are you sure you want to delete "',null==G?void 0:G.title,'"? This will mark it as deleted, but it can be restored later if needed.']})]}),(0,a.jsxs)(c.Es,{children:[(0,a.jsx)(r.$,{variant:"outline",onClick:()=>B(!1),disabled:Z,children:"Cancel"}),(0,a.jsx)(r.$,{variant:"destructive",onClick:ee,disabled:Z,children:Z?"Deleting...":"Delete"})]})]})})]})}},93509:(e,i,l)=>{l.d(i,{default:()=>n});var a=l(61929),t=l(189),s=l(38106),r=l(15638),d=l(45076);function n(e){let{children:i,className:l=""}
1=e,[n,c]=(0,t.useState)(!1),[o,h]=(0,t.useState)(!1),[u,m]=(0,t.useState)(!0),[p,x]=(0,t.useState)(0),j=(0,t.useRef)(null),v=(0,s.usePathname)(),g=(null==v?void 0:v.startsWith("/cards/"))&&"/cards"!==v;return(0,t.useEffect)(()=>{let e=()=>{let e=window.scrollY;if(c(e>100),e>50&&!o&&h(!0),g){let i=e>p;e<100?m(!0):i&&e>100?m(!1):i||m(!0),x(e)}else m(!0)};return window.addEventListener("scroll",e,{passive:!0}),()=>window.removeEventListener("scroll",e)},[o,p,g]),(0,a.jsxs)("div",{className:"min-h-screen bg-background ".concat(l),children:[(0,a.jsx)("div",{ref:j,children:(0,a.jsx)(r.A,{scrolled:n,hasScrolled:o,activeSection:"",navItems:[{id:"about",label:"About",href:null,ref:null},{id:"focus",label:"Focus Areas",href:null,ref:null},{id:"team",label:"Team",href:null,ref:null},{id:"connect",label:"Connect",href:null,ref:null},{id:"cards",label:"Cards",href:"/cards",ref:null}],scrollToSection:e=>{window.scrollTo({top:0,behavior:"smooth"})},forceVisible:!g,headerVisible:u})}),(0,a.jsx)("main",{className:"pt-20",children:i}),(0,a.jsx)(d.A,{})]})}}}]);
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.