1import{j as e,g as C,aH as W,c as q,e as Q}from"./feature-analytics-fWX_Npgk.js";import{a,e as X,h as J,F as K,X as Z,A as R,j as ee,C as se,B as te,G as re,U as ae}from"./vendor-icons-vlWn0JqW.js";import"./vendor-charts-BVFHRayN.js";import"./vendor-firebase-B_NFlp1G.js";const le={Bootcamp:{short:"BC",color:"bg-purple-100 text-purple-700"},Sprint:{short:"SP",color:"bg-blue-100 text-blue-700"},SLP:{short:"SLP",color:"bg-green-100 text-green-700"},"SLP Continuation":{short:"SLP+",color:"bg-green-200 text-green-800"},"Founders Fund Fellowship":{short:"FF",color:"bg-amber-100 text-amber-700"},"Tech Venture Workshop":{short:"TVW",color:"bg-indigo-100 text-indigo-700"},"Founders Fund Challenge":{short:"FFC",color:"bg-orange-100 text-orange-700"},"Tech Venture Accelerator":{short:"TVA",color:"bg-cyan-100 text-cyan-700"},TVC:{short:"TVC",color:"bg-teal-100 text-teal-700"},"Venture Exchange":{short:"VE",color:"bg-rose-100 text-rose-700"},"Ignite Alpha":{short:"IA",color:"bg-yellow-100 text-yellow-700"},"Ignite Beta":{short:"IB",color:"bg-yellow-200 text-yellow-800"},"Ignite SFC":{short:"ISFC",color:"bg-lime-100 text-lime-700"},"Prototyping Fund":{short:"PF",color:"bg-pink-100 text-pink-700"},"Summer Founders Circle":{short:"SFC",color:"bg-sky-100 text-sky-700"}};function M({name:t}){const o=le[t]||{short:t,color:"bg-gray-100 text-gray-600"};return e.jsx("span",{className:`inline-flex items-center px-1.5 py-0.5 text-xs font-medium rounded ${o.color}`,title:t,children:o.short})}function z({name:t}){return e.jsx("span",{className:"inline-flex items-center px-1.5 py-0.5 text-xs font-medium rounded bg-gray-100 text-gray-600",title:t,children:t})}function ne({status:t}){const o={Returning:"bg-green-100 text-green-700",New:"bg-blue-100 text-blue-700","New (Not Mapped)":"bg-amber-100 text-amber-700"};return e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 text-xs font-medium rounded-full ${o[t]||"bg-gray-100 text-gray-600"}`,children:t})}function oe({team:t,expanded:o,onToggle:j}){const x=t.programs||[],i=a.useMemo(()=>Object.entries(t.schools||{}).reduce((r,[m,c])=>(c&&r.push(m),r),[]),[t.schools]),h=a.useMemo(()=>Object.entries(t.demographics||{}).reduce((r,[m,c])=>(c&&r.push(m),r),[]),[t.demographics]);return e.jsxs(e.Fragment,{children:[e.jsxs("tr",{className:"border-b border-gray-100 hover:bg-gray-50 cursor-pointer transition-colors",onClick:j,children:[e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[o?e.jsx(ee,{size:14,className:"text-gray-400"}):e.jsx(se,{size:14,className:"text-gray-400"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-gray-900 text-sm",children:t.company_name}),t.is_returning_team&&e.jsx("p",{className:"text-xs text-green-600",children:"Returning team"})]})]})}),e.jsx("td",{className:"px-4 py-3 text-sm text-gray-600",children:t.academic_year}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[x.map(r=>e.jsx(M,{name:r},r)),x.length===0&&e.jsx("span",{className:"text-xs text-gray-400",children:"â"})]})}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[i.slice(0,3).map(r=>e.jsx(z,{name:r},r)),i.length>3&&e.jsxs("span",{className:"text-xs text-gray-400",children:["+",i.length-3]}),i.length===0&&e.jsx("span",{className:"text-xs text-gray-400",children:"â"})]})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx(ne,{status:t.is_returning_team?"Returning":"New"})})]}),o&&e.jsx("tr",{className:"bg-gray-50/50",children:e.jsx("td",{colSpan:5,className:"px-6 py-4",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsxs("h4",{className:"font-medium text-gray-700 mb-1 flex items-center gap-1",children:[e.jsx(te,{size:14})," Programs"]}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[x.map(r=>e.jsx(M,{name:r},r)),x.length===0&&e.jsx("span",{className:"text-gray-400",children:"None recorded"})]})]}),e.jsxs("div",{children:[e.jsxs("h4",{className:"font-medium text-gray-700 mb-1 flex items-center gap-1",children:[e.jsx(re,{size:14})," Schools"]}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[i.map(r=>e.jsx(z,{name:r},r)),i.length===0&&e.jsx("span",{className:"text-gray-400",children:"None recorded"})]})]}),e.jsxs("div",{children:[e.jsxs("h4",{className:"font-medium text-gray-700 mb-1 flex items-center gap-1",children:[e.jsx(ae,{size:14})," Demographics"]}),h.length>0?e.jsx("div",{className:"flex flex-wrap gap-1",children:h.map(r=>e.jsx("span",{className:"inline-flex items-center px-1.5 py-0.5 text-xs rounded bg-purple-50 text-purple-600",children:r},r))}):e.jsx("span",{className:"text-gray-400",children:"None recorded"})]})]})})})]})}
1function de(){const[t,o]=a.useState([]),[j,x]=a.useState(!0),[i,h]=a.useState(null),[r,m]=a.useState(""),[c,F]=a.useState(""),[d,_]=a.useState(""),[g,T]=a.useState(""),[u,V]=a.useState("company_name"),[v,k]=a.useState("asc"),[E,$]=a.useState(null),[I,O]=a.useState(!1),[P,A]=a.useState(!1),b=a.useDeferredValue(r),N=2e3;async function S(){try{x(!0),h(null);const s=await q.programs.teams(null,N),l=Q(s);o(l);const n=s?.meta?.count;A(l.length>=N||n!=null&&n>=N)}catch(s){h(s.message),o([]),A(!1)}finally{x(!1)}}a.useEffect(()=>{S()},[]);const B=a.useMemo(()=>{const s=new Set;return t.forEach(l=>{l.academic_year&&s.add(l.academic_year)}),[...s].sort().reverse()},[t]),D=a.useMemo(()=>{const s=new Set;return t.forEach(l=>(l.programs||[]).forEach(n=>s.add(n))),[...s].sort()},[t]),Y=a.useMemo(()=>[{value:"",label:"All Years"},...B.map(s=>({value:s,label:s}))],[B]),U=a.useMemo(()=>[{value:"",label:"All Programs"},...D.map(s=>({value:s,label:s}))],[D]),G=[{value:"",label:"All"},{value:"returning",label:"Returning"},{value:"new",label:"New"}],p=a.useMemo(()=>{let s=t;if(b||c||d||g){const l=b?b.toLowerCase():"";s=t.filter(n=>!(l&&!n.company_name?.toLowerCase().includes(l)||c&&n.academic_year!==c||d&&!(n.programs||[]).includes(d)||g==="returning"&&!n.is_returning_team||g==="new"&&n.is_returning_team))}return s=[...s].sort((l,n)=>{let f=l[u]||"",y=n[u]||"";return typeof f=="string"&&(f=f.toLowerCase()),typeof y=="string"&&(y=y.toLowerCase()),f<y?v==="asc"?-1:1:f>y?v==="asc"?1:-1:0}),s},[t,b,c,d,g,u,v]),L=s=>{u===s?k(l=>l==="asc"?"desc":"asc"):(V(s),k("asc"))},w=[c,d,g].filter(Boolean).length;function H(){F(""),_(""),T(""),m("")}return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold tracking-tight text-gray-900",children:"Teams Explorer"}),e.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:["Browse all teams from the Notion Teams database across academic years",P&&e.jsxs("span",{className:"block text-amber-700 mt-1",children:["Showing first ",N.toLocaleString()," teams; more may exist in BigQuery."]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[e.jsx("span",{children:i?"â":`${p.length} of ${t.length} teams${P?"+":""}`}),e.jsx("button",{onClick:S,className:"p-1.5 rounded-lg hover:bg-gray-100",title:"Refresh",children:e.jsx(X,{size:16,className:j?"animate-spin":""})})]})]}),e.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-200",children:[e.jsxs("div",{className:"p-4 border-b border-gray-200",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(J,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),e.jsx("input",{type:"text",placeholder:"Search teams...",value:r,onChange:s=>m(s.target.value),className:"w-full pl-9 pr-4 py-2 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 focus:border-transparent"})]}),e.jsxs("button",{onClick:()=>O(s=>!s),className:`inline-flex items-center gap-2 px-3 py-2 text-sm rounded-lg border transition-colors ${w>0?"bg-purple-50 border-purple-200 text-purple-700":"border-gray-200 text-gray-600 hover:bg-gray-50"}`,children:[e.jsx(K,{size:16}),"Filters",w>0&&e.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 text-xs font-bold bg-purple-600 text-white rounded-full",children:w})]})]}),I&&e.jsxs("div",{className:"mt-3 pt-3 border-t border-gray-100 flex flex-wrap gap-3 items-end",children:[e.jsxs("div",{className:"min-w-[140px] flex flex-col",children:[e.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Academic Year"}),e.jsx(C,{value:c,onChange:F,options:Y,className:"w-full",buttonClassName:"w-full justify-between"})]}),e.jsxs("div",{className:"min-w-[160px] flex flex-col",children:[e.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Program"}),e.jsx(C,{value:d,onChange:_,options:U,className:"w-full",buttonClassName:"w-full justify-between"})]}),e.jsxs("div",{className:"min-w-[130px] flex flex-col",children:[e.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Status"}),e.jsx(C,{value:g,onChange:T,options:G,className:"w-full",buttonClassName:"w-full justify-between"})]}),w>0&&e.jsxs("button",{onClick:H,className:"inline-flex items-center gap-1 px-3 py-1.5 text-xs font-medium text-gray-500 hover:text-gray-700 hover:bg-gray-100 rounded-lg",children:[e.jsx(Z,{size:14})," Clear all"]})]})]}),e.jsxs(W,{name:"Teams Table",loading:j,error:i,data:p,onRetry:S,emptyMessage:"No teams match the current filters.",minHeight:"300px",children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-gray-50 text-left text-xs font-medium text-gray-500 tracking-wide",children:[e.jsx("th",{className:"px-4 py-3 cursor-pointer hover:text-gray-700",onClick:()=>L("company_name"),children:e.jsxs("div",{className:"flex items-center gap-1",children:["Team Name",e.jsx(R,{size:12,className:u==="company_name"?"text-purple-600":""})]})}),e.jsx("th",{className:"px-4 py-3 cursor-pointer hover:text-gray-700",onClick:()=>L("academic_year"),children:e.jsxs("div",{className:"flex items-center gap-1",children:["Year",e.jsx(R,{size:12,className:u==="academic_year"?"text-purple-600":""})]})}),e.jsx("th",{className:"px-4 py-3",children:"Programs"}),e.jsx("th",{className:"px-4 py-3",children:"Schools"}),e.jsx("th",{className:"px-4 py-3",children:"Status"})]})}),e.jsx("tbody",{children:p.map((s,l)=>e.jsx(oe,{team:s,expanded:E===l,onToggle:()=>$(E===l?null:l)},`${s.company_name}-${s.academic_year}-${l}`))})]})}),p.length>0&&e.jsxs("div",{className:"px-4 py-3 border-t border-gray-100 text-xs text-gray-400 text-right",children:["Showing ",p.length," team",p.length!==1?"s":""," · Data from notion_sync.vw_unified_teams"]}
1)]})]})]})}export{de 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.