PageSourceSearch

https://haystack.cv/assets/AiLabsHiringTab-D4ydBhBq.js

js haystack.cv collected 2026-10-04 23:32:07 UTC 80,010 bytes, 18 lines download raw bytes

1import{ax as ys,v as se,j as e,r as x,D as Ne,a as be,B as y,a2 as Ks,a3 as Qs,c as ke,t as Ce,aA as te,M as ue,Y as ve,ca as _s,p as ne,q as qe,bN as ss,C as ce,s as de,bu as me,cb as Ys,ao as Ws,cc as Xs,aM as Zs,af as ze,c9 as ws,W as U,T as xe,w,F as et,bj as Me,b5 as Re,o as Y,cG as st,cH as tt,cI as at,cJ as nt,cK as rt,cL as Ns,cM as lt,cN as it,cO as ot,b as He,aQ as Je,S as V,i as q,k as z,l as H,m as P,a7 as ct,I as D,cP as dt,az as je,e as bs,f as ks,g as Q,ab as ye,U as Fe,aa as Cs,V as ts,cQ as mt,a0 as ut,L as $,x as ae,by as xt,av as ht,aw as pt,am as gt,n as ft,br as as,cR as vt,bf as Le,bS as Ae,b6 as ns,h as De,a4 as pe,a9 as ge,al as rs,ag as ls,ah as is,cz as os,aj as cs,ak as X,at as jt,cF as yt}from"./index-CERo9Lrd.js";import{T as _t,a as ds}from"./toggle-group-Dd4wD95A.js";import{f as ms}from"./format-Bh4RquCw.js";import{P as us}from"./power-CYbLwCAj.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const wt=ys("Kanban",[["path",{d:"M6 5v11",key:"mdvv1e"}],["path",{d:"M12 5v6",key:"14ar3b"}],["path",{d:"M18 5v14",key:"7ji314"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const Ie=ys("MailOpen",[["path",{d:"M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z",key:"1jhwl8"}],["path",{d:"m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10",key:"1qfld7"}]]),Be="https://haystackapp.io",Nt=[{value:"yes_no",label:"Yes / No"},{value:"single_select",label:"Pick one"},{value:"multi_select",label:"Pick any"},{value:"number",label:"Number"},{value:"short_text",label:"Short answer"},{value:"long_text",label:"Long answer"}],W=se;async function bt(){const{data:s,error:t}=await W.from("ai_lab_partners").select("id,name,logo_url,website,description,next_steps_note,archived_at,company_id").order("name");if(t)throw t;return s??[]}async function kt(){const{data:s,error:t}=await W.rpc("admin_ai_labs_jobs");if(t)throw t;return s??[]}async function Ct(s){const{data:t,error:l}=await W.rpc("admin_ai_labs_applicants",{p_job_id:s,p_partner_id:null});if(l)throw l;return t??[]}async function Ss(s){const{data:t,error:l}=await W.rpc("admin_ai_labs_save_partner",{p:s});if(l)throw l;return t}async function $s(s){const{data:t,error:l}=await W.rpc("admin_ai_labs_save_job",{p:s});if(l)throw l;return t}async function St(s,t){const{error:l}=await W.from("ai_lab_applications").update({stage:t}).in("id",s);if(l)throw l}async function $t(s,t){var u;const l=t?{reviewed_at:new Date().toISOString(),reviewed_by:((u=(await se.auth.getUser()).data.user)==null?void 0:u.id)??null}:{reviewed_at:null,reviewed_by:null},{error:i}=await W.from("ai_lab_applications").update(l).in("id",s);if(i)throw i}async function Et(s,t){const{error:l}=await W.from("ai_lab_applications").update({admin_note:t.trim()||null}).eq("id",s);if(l)throw l}async function Te(s,t){return Es("ai-labs-progress",{action:s,application_ids:t})}async function Pt(s){return Es("ai-labs-parse-job",{text:s})}async function Es(s,t){const{data:l,error:i}=await se.functions.invoke(s,{body:t});if(i){const u=i.context,g=u&&typeof u.json=="function"?await u.json().catch(()=>null):null;throw new Error((g==null?void 0:g.error)||i.message)}if(l!=null&&l.error)throw new Error(l.error);return l}async function Mt(s,t=300){const{data:l,error:i}=await se.storage.from("resumes").createSignedUrl(s,t);if(i||!(l!=null&&l.signedUrl))throw i??new Error("Could not open the CV");return l.signedUrl}function xs(s){var l;if(!s)return null;const t=(l=s.split("?")[0].split(".").pop())==null?void 0:l.toLowerCase();return t==="pdf"?"pdf":t==="doc"||t==="docx"?"word":"other"}function Lt(s){return s?decodeURIComponent(s.split("?")[0].split("/").pop()??"CV"):"CV"}async function At(s){const t=s.name.replace(/[^a-zA-Z0-9._-]/g,"-"),l=`ai-labs/${crypto.randomUUID()}-${t}`,{error:i}=await se.storage.from("company-logos").upload(l,s,{cacheControl:"3600",upsert:!1,contentType:s.type});if(i)throw i;return se.storage.from("company-logos").getPublicUrl(l).data.publicUrl}const hs=["image/png","image/jpeg","image/jpg","image/svg+xml","
11image/webp"],Dt=2*1024*1024;function Se(s){return(s||"").split(/\s+/).filter(Boolean).slice(0,2).map(t=>{var l;return(l=t[0])==null?void 0:l.toUpperCase()}).join("")||"?"}const ps=["bg-emerald-100 text-emerald-800","bg-indigo-100 text-indigo-800","bg-amber-100 text-amber-800","bg-pink-100 text-pink-800","bg-sky-100 text-sky-800","bg-violet-100 text-violet-800"];function $e(s){let t=0;for(let l=0;l<s.length;l++)t=t*31+s.charCodeAt(l)>>>0;return ps[t%ps.length]}function _e({name:s,url:t,size:l=36}){const i={width:l,height:l};return t?e.jsx("img",{src:t,alt:`${s} logo`,style:i,className:"shrink-0 rounded-lg border bg-white object-contain p-0.5"}):e.jsx("div",{style:i,className:`flex shrink-0 items-center justify-center rounded-lg text-xs font-semibold ${$e(s)}`,children:Se(s)})}const Ps={USD:"$",GBP:"£",EUR:"€"};function Tt(s){if(s.salary_min==null&&s.salary_max==null)return null;const t=Ps[(s.salary_currency||"").toUpperCase()]??(s.salary_currency?`${s.salary_currency} `:""),l=g=>g>=1e3?`${t}${Math.round(g/1e3)}k`:`${t}${g}`,i=s.salary_min!=null&&s.salary_max!=null&&s.salary_min!==s.salary_max?`${l(s.salary_min)}–${l(s.salary_max)}`:l(s.salary_min??s.salary_max),u=s.salary_period==="hourly"?"/hr":s.salary_period==="monthly"?"/mo":s.salary_period==="yearly"?"/yr":"";return`${i}${u}`}function Ut(s){const t=[s.city,s.country].filter(Boolean).join(", ");return[s.work_mode==="remote"?"Remote":s.work_mode==="hybrid"?"Hybrid":s.work_mode==="on-site"?"On-site":null,t].filter(Boolean).join(" · ")||"—"}function Rt(s,t){return s==null?null:`${Ps[(t||"").toUpperCase()]??(t?`${t} `:"$")}${s.toLocaleString("en-GB")} one-time payment`}
11function gs(s){return[s.start_asap?"Starts ASAP":s.start_date?`Starts ${new Date(s.start_date).toLocaleDateString("en-GB",{day:"numeric",month:"short"})}`:null,s.engagement_length,s.commitment,s.positions?`${s.positions} opening${s.positions===1?"":"s"}`:null].filter(Boolean)}function we(s){return s.answer==null||s.answer===""?"—":Array.isArray(s.answer)?s.answer.join(", "):String(s.answer)}function fs(s){const t=s==null?"":String(s);return/[",\n]/.test(t)?`"${t.replace(/"/g,'""')}"`:t}async function Ft(s){const t=s.map(m=>m.resume_path).filter(m=>!!m),l=new Map;if(t.length){const{data:m}=await se.storage.from("resumes").createSignedUrls(t,604800);for(const h of m??[])h.path&&h.signedUrl&&l.set(h.path,h.signedUrl)}const i=[];for(const m of s)for(const h of m.answers)i.includes(h.prompt)||i.push(h.prompt);const u=["Partner ref","Name","Email","Phone","LinkedIn","Location","Headline","Years experience","Education","Skills","Job","Partner","Stage","Meets criteria","Applied","CV (link valid 7 days)",...i],g=s.map(m=>{const h=new Map(m.answers.map(p=>[p.prompt,we(p)]));return[m.partner_ref,m.full_name,m.email,m.phone,m.linkedin_url,m.location,m.headline,m.years_experience,m.education,m.skills.slice(0,15).join(", "),m.job_title,m.partner_name,m.stage,m.qualified?"Yes":"No",m.created_at.slice(0,10),m.resume_path?l.get(m.resume_path)??"":"",...i.map(p=>h.get(p)??"")].map(fs).join(",")}),o=new Blob([[u.map(fs).join(","),...g].join(`
12`)],{type:"text/csv"}),v=document.createElement("a");v.href=URL.createObjectURL(o),v.download=`ai-labs-applicants-${new Date().toISOString().slice(0,10)}.csv`,v.click(),URL.revokeObjectURL(v.href)}function It(s,t){const l=t.query.trim().toLowerCase();return s.filter(i=>t.stage!=="all"&&i.stage!==t.stage||t.fit==="qualified"&&!i.qualified||t.fit==="missed"&&i.qualified||t.read==="unread"&&i.reviewed_at||t.read==="read"&&!i.reviewed_at?!1:l?[i.full_name,i.email,i.headline,i.location,i.education,i.job_title,...i.skills].some(u=>(u||"").toLowerCase().includes(l)):!0)}function vs(s,t,l){const i=s.indexOf(t);if(i<0)return null;const u=i+l;return u>=0&&u<s.length?s[u]:null}function Bt(s){return s.some(t=>!t.reviewed_at)?"read":"unread"}function Ot(s,t){return s.map(l=>l.id in t&&t[l.id]!==l.reviewed_at?{...l,reviewed_at:t[l.id]}:l)}function Vt(s){return typeof HTMLElement>"u"||!(s instanceof HTMLElement)?!1:s.isContentEditable?!0:s.tagName==="INPUT"||s.tagName==="TEXTAREA"||s.tagName==="SELECT"}async function fe(s,t){try{return await navigator.clipboard.writeText(s),w.success(`Copied ${t}`),!0}catch{return w.error("Could not copy. Select the text and copy it by hand."),!1}}function Oe({text:s,what:t,className:l="",size:i="sm"}){const[u,g]=x.useState(!1),o=x.useCallback(async h=>{h.stopPropagation(),await fe(s,t)&&(g(!0),window.setTimeout(()=>g(!1),1500))},[s,t]),v=i==="xs"?"h-6 w-6":"h-7 w-7",m=i==="xs"?"h-3 w-3":"h-3.5 w-3.5";return e.jsx("button",{type:"button",onClick:h=>void o(h),"aria-label":`Copy ${t}`,title:`Copy ${t}`,className:`inline-flex ${v} shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground ${l}`,children:u?e.jsx(et,{className:`${m} text-emerald-600`}):e.jsx(me,{className:m})})}function Z({href:s,icon:t,label:l,copy:i,what:u}){return e.jsxs("div",{className:"group flex min-w-0 items-center gap-2 text-sm",children:[e.jsx(t,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),s?e.jsx("a",{href:s,target:"_blank",rel:"noreferrer",className:"min-w-0 flex-1 truncate hover:text-primary",title:i,children:l}):e.jsx("span",{className:"min-w-0 flex-1 truncate",title:i,children:l}),e.jsx(Oe,{text:i,what:u,className:"opacity-50 group-hover:opacity-100"})]})}const J=s=>/^https?:\/\//i.test(s)?s:`https://${s}`;function qt(s){return[["Name",s.full_name],["Email",s.email],["Phone",s.phone],["LinkedIn",s.linkedin_url?J(s.linkedin_url):null],["GitHub",s.github_url?J(s.github_url):null],["Portfolio",s.portfolio_url?J(s.portfolio_url):null],["Location",s.location],["Education",s.education]].filter(([,t])=>t).map(([t,l])=>`${t}: ${l}`).join(`
13`)}function zt(s){return s.answers.map((t,l)=>`${l+1}. ${t.prompt}
14${we(t)}`).join(`
15
16`)}function le(s,t){return s?`${t?`by ${t}, `:""}${te(new Date(s),{addSuffix:!0})}`:null}function ee({children:s}){return e.jsx("kbd",{className:"rounded border bg-muted px-1.5 py-0.5 font-mono text-[10px] text-foreground",children:s})}function Ht({path:s}){const[t,l]=x.useState(null),[i,u]=x.useState(null),[g,o]=x.useState(null),[v,m]=x.useState(!1),h=xs(s);if(x.useEffect(()=>{if(l(null),u(null),o(null),!s)return;let N=!1,j=null;return m(!0),(async()=>{try{const S=await Mt(s,900);if(N)return;if(l(S),xs(s)==="pdf"){const C=await fetch(S);if(!C.ok)throw new Error("Could not load the CV");const E=await C.blob();if(N)return;j=URL.createObjectURL(E),u(j)}}catch(S){N||o(S instanceof Error?S.message:"Could not load the CV")}finally{N||m(!1)}})(),()=>{N=!0,j&&URL.revokeObjectURL(j)}},[s]),!s)return e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-8 text-center text-muted-foreground",children:[e.jsx(Me,{className:"h-8 w-8"}),e.jsx("p",{className:"text-sm",children:"No CV on file for this applicant."})]});const p=Lt(s);return e.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 border-b bg-background/60 px-3 py-2 text-xs",children:[e.jsx(Me,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",title:p,children:p}),t?e.jsxs(e.Fragment,{children:[e.jsxs("a",{href:t,download:p,className:"inline-flex items-center gap-1 rounded-md border px-2 py-1 hover:bg-muted",children:[e.jsx(Re,{className:"h-3.5 w-3.5"}),"Download"]}),e.jsxs("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 rounded-md border px-2 py-1 hover:bg-muted",children:[e.jsx(ve,{className:"h-3.5 w-3.5"}),"New tab"]})]}):null]}),e.jsx("div",{className:"min-h-0 flex-1",children:g?e.jsx("div",{className:"flex h-full items-center justify-center p-8 text-center text-sm text-destructive",children:g}):v&&!t?e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx(Y,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):h==="pdf"&&t?e.jsx("iframe",{src:i??t,title:`CV: ${p}`,className:"h-full w-full bg-white"},i??t):t?e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 p-8 text-center",children:[e.jsx(Me,{className:"h-10 w-10 text-muted-foreground"}),e.jsxs("p",{className:"text-sm font-medium",children:[h==="word"?"Word document":"This file type"," does not preview inline."]}),e.jsx("p",{className:"max-w-sm text-sm text-muted-foreground",children:"Download it or open it in a new tab. The link is signed and lasts 15 minutes."}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(y,{asChild:!0,size:"sm",children:e.jsxs("a",{href:t,download:p,children:[e.jsx(Re,{className:"mr-2 h-4 w-4"}),"Download"]})}),e.jsx(y,{asChild:!0,size:"sm",variant:"outline",children:e.jsxs("a",{href:t,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(ve,{className:"mr-2 h-4 w-4"}),"New tab"]})})]})]}):null})]})}function Jt({applicant:s,position:t,total:l,onPrev:i,onNext:u,onOpenChange:g,onProgress:o,onNotProgressed:v,onReopen:m,onSubmitted:h,onUnsubmit:p,onToggleRead:N,onChanged:j,hotkeys:S}){const[C,E]=x.useState("");x.useEffect(()=>E((s==null?void 0:s.admin_note)??""),[s==null?void 0:s.id,s==null?void 0:s.admin_note]),x.useEffect(()=>{if(!s||!S)return;const _=d=>{if(!(d.metaKey||d.ctrlKey||d.altKey||Vt(d.target)))switch(d.key){case"ArrowRight":u&&(d.preventDefault(),u());break;case"ArrowLeft":i&&(d.preventDefault(),i());break;case"p":case"P":(s.stage==="applied"||s.stage==="not_progressed")&&(d.preventDefault(),o(s.id));break;case"s":case"S":s.stage==="progressed"&&(d.preventDefault(),h(s.id));break;case"x":case"X":s.stage==="applied"&&(d.preventDefault(),v(s.id));break;case"u":case"U":d.preventDefault(),N(s.id);break}};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[s,S,u,i,o,v,h,N]);const I=async()=>
16{if(s)try{await Et(s.id,C),w.success("Note saved"),j()}catch(_){w.error(_ instanceof Error?_.message:"Could not save")}};return e.jsx(Ne,{open:!!s,onOpenChange:g,children:e.jsx(be,{className:"flex h-[94vh] w-[96vw] max-w-[1400px] flex-col gap-0 overflow-hidden p-0 sm:rounded-xl",children:s?e.jsxs(e.Fragment,{children:[e.jsxs("header",{className:"flex items-center gap-3 border-b px-4 py-3 pr-12",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(y,{variant:"outline",size:"icon",className:"h-8 w-8",disabled:!i,onClick:i,"aria-label":"Previous applicant",children:e.jsx(Ks,{className:"h-4 w-4"})}),e.jsx(y,{variant:"outline",size:"icon",className:"h-8 w-8",disabled:!u,onClick:u,"aria-label":"Next applicant",children:e.jsx(Qs,{className:"h-4 w-4"})})]}),e.jsxs("span",{className:"hidden w-14 text-xs tabular-nums text-muted-foreground sm:block",children:[t," of ",l]}),e.jsx("div",{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-full text-sm font-semibold ${$e(s.user_id)}`,children:Se(s.full_name||s.email)}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs(ke,{className:"flex items-center gap-1 truncate text-lg",children:[e.jsx("span",{className:"truncate",children:s.full_name||s.email}),s.full_name?e.jsx(Oe,{text:s.full_name,what:"name"}):null]}),e.jsx(Ce,{className:"truncate",children:[s.headline,s.years_experience!=null?`${s.years_experience} years' experience`:null,`${s.job_title} · ${s.partner_name}`].filter(Boolean).join(" · ")})]}),e.jsx(y,{variant:"ghost",size:"sm",onClick:()=>N(s.id),title:s.reviewed_at?`Read ${te(new Date(s.reviewed_at),{addSuffix:!0})}${s.reviewed_by_email?` by ${s.reviewed_by_email}`:""}`:"Nobody has opened this applicant yet",children:s.reviewed_at?e.jsxs(e.Fragment,{children:[e.jsx(Ie,{className:"mr-2 h-4 w-4"}),"Mark unread"]}):e.jsxs(e.Fragment,{children:[e.jsx(ue,{className:"mr-2 h-4 w-4"}),"Mark read"]})})]}),e.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-1 overflow-y-auto lg:grid-cols-[minmax(0,2fr)_minmax(0,3fr)] lg:overflow-hidden",children:[e.jsxs("div",{className:"min-h-0 p-5 lg:overflow-y-auto lg:border-r",children:[e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border bg-muted/30 p-2.5",children:[e.jsx(_e,{name:s.partner_name,url:s.partner_logo_url,size:28}),e.jsxs("div",{className:"min-w-0 flex-1 text-sm",children:[e.jsx("p",{className:"truncate font-medium",children:s.job_title}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s.partner_name," · applied ",ms(new Date(s.created_at),"d MMM yyyy, HH:mm")]})]}),e.jsx("a",{href:`${Be}/jobs/${s.job_id}`,target:"_blank",rel:"noreferrer",className:"text-muted-foreground hover:text-foreground","aria-label":"Open job",children:e.jsx(ve,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[s.stage==="applied"||s.stage==="not_progressed"?e.jsxs(y,{onClick:()=>
16o(s.id),children:["Progress to ",s.partner_name," ",e.jsx(_s,{className:"ml-1 h-4 w-4"})]}):s.stage==="progressed"?e.jsxs(y,{className:"bg-violet-600 hover:bg-violet-700",onClick:()=>h(s.id),children:[e.jsx(ne,{className:"mr-2 h-4 w-4"}),"Mark submitted to ",s.partner_name]}):null,s.stage==="applied"?e.jsxs(y,{variant:"outline",onClick:()=>v(s.id),children:[e.jsx(qe,{className:"mr-2 h-4 w-4"}),"Not progressing"]}):s.stage==="not_progressed"?e.jsxs(y,{variant:"outline",onClick:()=>m(s.id),children:[e.jsx(ss,{className:"mr-2 h-4 w-4"}),"Back to review"]}):s.stage==="submitted"?e.jsxs(y,{variant:"outline",onClick:()=>p(s.id),children:[e.jsx(ss,{className:"mr-2 h-4 w-4"}),"Back to Progressed"]}):null]}),s.stage==="progressed"||s.stage==="submitted"?e.jsxs("div",{className:`mt-4 space-y-1.5 rounded-lg border p-3 text-sm ${s.progress_email_error&&!s.progress_email_sent_at?"border-destructive/40 bg-destructive/5":s.stage==="submitted"?"border-violet-200 bg-violet-50":"border-emerald-200 bg-emerald-50"}`,children:[s.stage==="submitted"?e.jsxs("p",{className:"flex items-center gap-2 font-medium text-violet-900",children:[e.jsx(ne,{className:"h-4 w-4"}),"Submitted to ",s.partner_name," ",le(s.submitted_at,s.submitted_by_email),"."]}):null,s.progress_email_sent_at?e.jsxs("p",{className:`flex items-center gap-2 ${s.stage==="submitted"?"text-violet-900/80":"text-emerald-800"}`,children:[e.jsx(ce,{className:"h-4 w-4"}),"Progressed ",le(s.progressed_at,s.progressed_by_email),". Email sent ",ms(new Date(s.progress_email_sent_at),"d MMM, HH:mm"),"."]}):e.jsxs("div",{className:"space-y-2",children:[e.jsxs("p",{className:"flex items-center gap-2 text-destructive",children:[e.jsx(de,{className:"h-4 w-4"}),"Progressed ",le(s.progressed_at,s.progressed_by_email),", but the email didn't send",s.progress_email_error?`: ${s.progress_email_error}`:"."]}),e.jsx(y,{size:"sm",variant:"outline",onClick:()=>
16o(s.id),children:"Retry the email"})]})]}):s.stage==="not_progressed"?e.jsxs("p",{className:"mt-4 rounded-lg border bg-muted/30 p-3 text-sm text-muted-foreground",children:["Marked as not progressing ",le(s.stage_changed_at,s.stage_changed_by_email),". The candidate has not been told."]}):s.stage_changed_at?e.jsxs("p",{className:"mt-4 rounded-lg border bg-muted/30 p-3 text-sm text-muted-foreground",children:["Moved back to review ",le(s.stage_changed_at,s.stage_changed_by_email),"."]}):null,e.jsxs("section",{className:"mt-6",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[e.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Contact"}),e.jsxs("button",{type:"button",onClick:()=>void fe(qt(s),"contact details"),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",children:[e.jsx(me,{className:"h-3 w-3"}),"Copy all"]})]}),e.jsxs("div",{className:"grid gap-1.5 sm:grid-cols-2",children:[s.email?e.jsx(Z,{href:`mailto:${s.email}`,icon:ue,label:s.email,copy:s.email,what:"email"}):null,s.phone?e.jsx(Z,{href:`tel:${s.phone.replace(/\s+/g,"")}`,icon:Ys,label:s.phone,copy:s.phone,what:"phone number"}):null,s.linkedin_url?e.jsx(Z,{href:J(s.linkedin_url),icon:Ws,label:J(s.linkedin_url),copy:J(s.linkedin_url),what:"LinkedIn URL"}):null,s.github_url?e.jsx(Z,{href:J(s.github_url),icon:Xs,label:"GitHub",copy:J(s.github_url),what:"GitHub URL"}):null,s.portfolio_url?e.jsx(Z,{href:J(s.portfolio_url),icon:Zs,label:"Portfolio",copy:J(s.portfolio_url),what:"portfolio URL"}):null,s.location?e.jsx(Z,{icon:ze,label:s.location,copy:s.location,what:"location"}):null,s.education?e.jsx("div",{className:"sm:col-span-2",children:e.jsx(Z,{icon:ws,label:s.education,copy:s.education,what:"education"})}):null]})]}),s.skills.length?e.jsxs("section",{className:"mt-6",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[e.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Skills from CV"}),e.jsxs("button",{type:"button",onClick:()=>void fe(s.skills.join(", "),"skills"),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",children:[e.jsx(me,{className:"h-3 w-3"}),"Copy all"]})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.skills.slice(0,30).map(_=>e.jsx(U,{variant:"secondary",className:"font-normal",children:_},_))})]}):null,e.jsxs("section",{className:"mt-6",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between gap-3",children:[e.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Screening answers"}),e.jsxs("div",{className:"flex items-center gap-3",children:[s.qualified?e.jsxs("span",{className:"flex items-center gap-1 text-xs text-emerald-700",children:[e.jsx(ce,{className:"h-3.5 w-3.5"}),"Meets criteria"]}):e.jsxs("span",{className:"flex items-center gap-1 text-xs text-amber-700",children:[e.jsx(de,{className:"h-3.5 w-3.5"}),"Missed criteria"]}),s.answers.length?e.jsxs("button",{type:"button",onClick:()=>void fe(zt(s),"screening answers"),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",children:[e.jsx(me,{className:"h-3 w-3"}),"Copy all"]}):null]})]}),s.answers.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"This job had no screening questions."}):e.jsx("ol",{className:"space-y-3",children:s.answers.map((_,d)=>e.jsxs("li",{className:`group relative rounded-lg border p-3 pr-9 ${_.qualifies===!1?"border-amber-300 bg-amber-50":""}`,children:[e.jsx(Oe,{text:we(_),what:`answer ${d+1}`,className:"absolute right-1.5 top-1.5 opacity-50 group-hover:opacity-100"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[d+1,". ",_.prompt]}),e.jsxs("p",{className:"mt-1 flex items-start gap-2 whitespace-pre-wrap text-sm font-medium",children:[_.qualifies===!0?e.jsx(ce,{className:"mt-0.5 h-4 w-4 shrink-0 text-emerald-600"}):null,_.qualifies===!1?e.jsx(de,{className:"mt-0.5 h-4 w-4 shrink-0 text-amber-600"}):null,we(_)]})]},_.question_id))})]}),e.jsxs("section",{className:"mt-6 space-y-2 pb-2",children:[e.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Internal note"}),e.jsx(xe,{rows:3,value:C,onChange:_=>E(_.target.value),placeholder:"Only admins see this."}),e.jsx(y,{size:"sm",variant:"outline",disabled:C===(s.admin_note??""),onClick:()=>void I(),children:"Save note"})]})]}),e.jsx("div",{className:"min-h-[60vh] border-t bg-muted/30 lg:min-h-0 lg:border-t-0",children:e.jsx(Ht,{path:s.resume_path})})]}),e.jsxs("footer",{className:"hidden flex-wrap items-center gap-x-4 gap-y-1 border-t px-4 py-2 text-xs text-muted-foreground sm:flex",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ee,{children:"←"}),e.jsx(ee,{children:"→"})," previous / next"]}),s.stage==="applied"||s.stage==="not_progressed"?e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ee,{children:"P"})," progress"]}
16):null,s.stage==="progressed"?e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ee,{children:"S"})," mark submitted"]}):null,s.stage==="applied"?e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ee,{children:"X"})," not progressing"]}):null,e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ee,{children:"U"})," ",s.reviewed_at?"mark unread":"mark read"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ee,{children:"Esc"})," close"]}),s.reviewed_at?e.jsxs("span",{className:"ml-auto",children:["Read ",te(new Date(s.reviewed_at),{addSuffix:!0}),s.reviewed_by_email?` by ${s.reviewed_by_email}`:""]}):null]})]}):null})})}const Gt=[{stage:"applied",label:"To review",icon:rt,tone:"text-sky-700"},{stage:"progressed",label:"Progressed",icon:Ns,tone:"text-emerald-700"},{stage:"submitted",label:"Submitted",icon:ne,tone:"text-violet-700"},{stage:"not_progressed",label:"Not progressed",icon:qe,tone:"text-muted-foreground"}];function Kt(s){const t=s.stage==="submitted"?s.submitted_at??s.stage_changed_at:s.stage==="progressed"?s.progressed_at??s.stage_changed_at:s.stage_changed_at;if(!t)return null;const l=s.stage==="submitted"?s.submitted_by_email??s.stage_changed_by_email:s.stage==="progressed"?s.progressed_by_email??s.stage_changed_by_email:s.stage_changed_by_email,i=l?l.split("@")[0]:null;return`${i?`${i} · `:""}${te(new Date(t),{addSuffix:!0})}`}function Ms({a:s,showJob:t,dragging:l=!1}){const i=!s.reviewed_at,u=Kt(s);return e.jsxs("div",{className:`rounded-lg border bg-card p-3 text-sm shadow-sm transition-shadow ${l?"shadow-lg ring-2 ring-primary/30":"hover:shadow"} ${i&&s.stage==="applied"?"border-sky-200":""}`,children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-xs font-semibold ${$e(s.user_id)}`,children:Se(s.full_name||s.email)}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("p",{className:`flex items-center gap-1.5 truncate ${i&&s.stage==="applied"?"font-semibold":"font-medium"}`,children:[i&&s.stage==="applied"?e.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-sky-500","aria-label":"Unread"}):null,e.jsx("span",{className:"truncate",children:s.full_name||s.email})]}),e.jsx("p",{className:"truncate text-xs text-muted-foreground",children:[s.headline,s.years_experience!=null?`${s.years_experience} yrs`:null].filter(Boolean).join(" · ")||s.email})]}),s.qualified?e.jsx(ce,{className:"h-4 w-4 shrink-0 text-emerald-600","aria-label":"Meets criteria"}):e.jsx(de,{className:"h-4 w-4 shrink-0 text-amber-600","aria-label":"Missed criteria"})]}),s.location||t?e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[s.location?e.jsxs("span",{className:"flex items-center gap-1 truncate",children:[e.jsx(ze,{className:"h-3 w-3 shrink-0"}),s.location]}):null,t?e.jsx("span",{className:"truncate",children:s.job_title}):null]}):null,s.skills.length?e.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:s.skills.slice(0,4).map(g=>e.jsx(U,{variant:"secondary",className:"px-1.5 py-0 text-[10px] font-normal",children:g},g))}
16):null,s.progress_email_error&&!s.progress_email_sent_at?e.jsx(U,{variant:"destructive",className:"mt-2",children:"Email failed"}):null,e.jsx("p",{className:"mt-2 truncate text-[11px] text-muted-foreground",title:u??void 0,children:u??`applied ${te(new Date(s.created_at),{addSuffix:!0})}`})]})}function Qt({a:s,showJob:t,onOpen:l}){const{attributes:i,listeners:u,setNodeRef:g,isDragging:o}=ot({id:s.id});return e.jsx("div",{ref:g,...i,...u,className:`cursor-grab active:cursor-grabbing ${o?"opacity-30":""}`,onClick:()=>l(s.id),role:"button",tabIndex:0,onKeyDown:v=>{v.key==="Enter"&&l(s.id)},children:e.jsx(Ms,{a:s,showJob:t})})}function Yt({stage:s,label:t,icon:l,tone:i,rows:u,showJob:g,onOpen:o,active:v}){const{setNodeRef:m,isOver:h}=lt({id:s});return e.jsxs("div",{className:"flex min-h-[420px] min-w-[260px] flex-1 flex-col rounded-xl border bg-muted/30",children:[e.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2.5",children:[e.jsx(l,{className:`h-4 w-4 ${i}`}),e.jsx("span",{className:"text-sm font-medium",children:t}),e.jsx(U,{variant:"secondary",className:"ml-auto tabular-nums",children:u.length})]}),e.jsxs("div",{ref:m,className:`flex-1 space-y-2 overflow-y-auto p-2 transition-colors ${h?"bg-primary/5":v?"bg-muted/50":""}`,children:[u.map(p=>e.jsx(Qt,{a:p,showJob:g,onOpen:o},p.id)),u.length===0?e.jsx("p",{className:"px-2 py-6 text-center text-xs text-muted-foreground",children:v?"Drop here":"Nobody here"}):null]})]})}function Wt({rows:s,showJob:t,onOpen:l,onMove:i}){const u=st(tt(it,{activationConstraint:{distance:6}})),[g,o]=x.useState(null),v=g?s.find(p=>p.id===g)??null:null,m=p=>o(String(p.active.id)),h=p=>{var S;o(null);const N=s.find(C=>C.id===p.active.id),j=(S=p.over)==null?void 0:S.id;if(!(!N||!j||j===N.stage)){if(j==="submitted"&&N.stage!=="progressed"){w.error(`Progress ${N.full_name||"the candidate"} first, so they get the email, then mark them submitted.`);return}i(N,j)}};return e.jsxs(at,{sensors:u,onDragStart:m,onDragEnd:h,onDragCancel:()=>o(null),children:[e.jsx("div",{className:"flex gap-3 overflow-x-auto pb-2",children:Gt.map(p=>e.jsx(Yt,{...p,rows:s.filter(N=>N.stage===p.stage),showJob:t,onOpen:l,active:!!v&&v.stage!==p.stage},p.stage))}),e.jsx(nt,{children:v?e.jsx("div",{className:"w-[260px]",children:e.jsx(Ms,{a:v,showJob:t,dragging:!0})}):null})]})}function Xt({applicants:s,open:t,onOpenChange:l,onDone:i}){const[u,g]=x.useState(null),[o,v]=x.useState(null),[m,h]=x.useState(!1),[p,N]=x.useState(!1),j=s.filter(n=>!((n.stage==="progressed"||n.stage==="submitted")&&n.progress_email_sent_at)),S=[...new Set(s.map(n=>n.partner_name))],C=S.length===1?S[0]:"their partner",E=j[0]??s[0];x.useEffect(()=>{if(!t||!E)return;let n=!1;return g(null),v(null),Te("preview",[E.id]).then(b=>{n||g(b)}).catch(b=>{n||v(b instanceof Error?b.message:"Preview failed")}),()=>{n=!0}},[t,E==null?void 0:E.id]);const I=async()=>{if(E){h(!0);try{const n=await Te("test",[E.id]);w.success(`Test email sent to ${n.sent_to}`)}catch(n){w.error(n instanceof Error?n.message:"Test failed")}finally{h(!1)}}},_=async()=>{if(j.length){N(!0);try{const n=await Te("progress",j.map(b=>b.id));n.failed?w.error(`${n.sent} emailed, ${n.failed} failed. Open a failed candidate to retry.`):w.success(`${n.sent} candidate${n.sent===1?"":"s"} progressed to ${C} and emailed`),i()}catch(n){w.error(n instanceof Error?n.message:"Could not progress")}finally{N(!1)}}},d=j.slice(0,3).map(n=>n.full_name||n.email).join(", ");return e.jsx(Ne,{open:t,onOpenChange:l,children:e.jsxs(be,{className:"max-h-[92vh] overflow-y-auto sm:max-w-2xl",children:[e.jsxs(He,{children:[e.jsxs(ke,{children:["Progress ",j.length," candidate",j.length===1?"":"s"," to ",C]}),e.jsx(Ce,{children:j.length?e.jsxs(e.Fragment,{children:[d,j.length>3?` and ${j.length-3} more`:""," will move to Progressed and get this email, telling them to expect next steps from ",C,"."]}):"Everyone selected has already been progressed and emailed."})]}),e.jsxs("div",{className:"overflow-hidden rounded-xl border",children:[e.jsxs("div",{className:"flex items-center gap-2 border-b bg-muted/40 px-3 py-2 text-sm",children:[e.jsx(ue,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"truncate font-medium",children:(u==null?void 0:u.subject)??"Loading preview..."})]}),o?e.jsx("p",{className:"p-4 text-sm text-destructive",children:o}):u?e.jsx("iframe",{title:"Email preview",srcDoc:u.html,className:"h-[420px] w-full bg-[#f6f7f9]",sandbox:""}):e.jsx("div",{className:"flex h-[420px] items-center justify-center",children:e.jsx(Y,{className:"h-6 w-6 animate-spin text-muted-foreground"})})]}),E?e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Preview shown for ",E.full_name||E.email,". Each candidate gets their own name and job."]}):null,e.jsxs(Je,{className:"gap-2 sm:gap-0",children:[e.jsxs(y,{variant:"outline",onClick:()=>void I(),disabled:m||!E,children:[m?e.jsx(Y,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Send me a test"]}),e.jsxs(y,{onClick:()=>void _(),disabled:p||!j.length,children:[p?e.jsx(Y,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(ne,{className:"mr-2 h-4 w-4"}),"Progress and email ",j.length]})]})]})})}const Ls="ai-labs-applicants-view",Zt=()=>{try{return localStorage.getItem(Ls)==="board"?"board":"list"}catch{return"list"}};function ea(s){const t=s.stage==="submitted"?s.submitted_at??s.stage_changed_at:s.stage==="progressed"?s.progressed_at??s.stage_changed_at:s.stage_changed_at;if(!t)return null;const l=s.stage==="submitted"?s.submitted_by_email??s.stage_changed_by_email:s.stage==="progressed"?s.progressed_by_email??s.stage_changed_by_email:s.stage_changed_by_email;return`${l?`by ${l.split("@")[0]} · `:""}${te(new Date(t),{addSuffix:!0})}`}function sa({applicants:s,loading:t,jobs:l,jobId:i,onJobChange:u,onChanged:g}){const[o,v]=x.useState(Zt),[m,h]=x.useState("applied"),[p,N]=x.useState("all"),[j,S]=x.useState("all"),[C,E]=x.useState(""),[I,_]=x.useState(new Set),[d,n]=x.useState(null),[b,f]=x.use
16State([]),[R,K]=x.useState(null),[Ee,a]=x.useState(!1),[M,T]=x.useState({}),c=x.useMemo(()=>Ot(s,M),[s,M]),L=x.useMemo(()=>{const r={applied:0,progressed:0,submitted:0,not_progressed:0,all:c.length,unread:0};for(const k of c)r[k.stage]++,k.stage==="applied"&&!k.reviewed_at&&r.unread++;return r},[c]),O=x.useMemo(()=>It(c,{stage:o==="board"?"all":m,fit:p,read:j,query:C}),[c,o,m,p,j,C]),As=r=>{v(r),_(new Set);try{localStorage.setItem(Ls,r)}catch{}},B=c.filter(r=>I.has(r.id)),Ge=O.length>0&&O.every(r=>I.has(r.id)),Ke=[...new Set(B.map(r=>r.partner_name))],Ds=Ke.length===1?`Progress to ${Ke[0]}`:"Progress to partner",Pe=Bt(B),Ts=B.length>0&&B.every(r=>r.stage==="progressed"),Us=B.some(r=>r.stage!=="submitted"),Rs=r=>_(k=>{const A=new Set(k);return A.has(r)?A.delete(r):A.add(r),A}),Fs=()=>_(r=>{const k=new Set(r);return Ge?O.forEach(A=>k.delete(A.id)):O.forEach(A=>k.add(A.id)),k}),he=x.useCallback(async(r,k)=>{const A=k?new Date().toISOString():null;T(F=>{const G={...F};for(const Gs of r)G[Gs]=A;return G});try{await $t(r,k)}catch(F){w.error(F instanceof Error?F.message:"Could not update")}},[]);x.useEffect(()=>{if(!d)return;const r=c.find(k=>k.id===d);r&&!r.reviewed_at&&he([d],!0)},[d]);const Qe=r=>{f(O.map(k=>k.id)),n(r)},Is=()=>{n(null),f([]),g()},Ye=x.useCallback(r=>{const k=c.find(A=>A.id===r);k&&he([r],!k.reviewed_at)},[c,he]),re=async(r,k)=>{const A=[...new Set(c.filter(G=>r.includes(G.id)).map(G=>G.partner_name))],F=A.length===1?A[0]:"the partner";try{await St(r,k),w.success(k==="applied"?"Moved back to review":k==="progressed"?"Moved back to Progressed":k==="submitted"?`${r.length} marked as submitted to ${F}`:`${r.length} marked as not progressed`),_(new Set),g()}catch(G){w.error(G instanceof Error?G.message:"Could not update")}},We=r=>void re(r,"not_progressed"),Bs=r=>void re([r],"applied"),Xe=r=>void re(r,"submitted"),Os=r=>void re([r],"progressed"),Vs=(r,k)=>{k==="progressed"&&r.stage!=="submitted"?K([r.id]):re([r.id],k)},qs=r=>K([r]),zs=async()=>{const r=B.map(k=>k.id);await he(r,Pe==="read"),w.success(`${r.length} marked as ${Pe}`),_(new Set)},Hs=async r=>{a(!0);try{await Ft(r)}catch(k){w.error(k instanceof Error?k.message:"Export failed")}finally{a(!1)}},Js=d?c.find(r=>r.id===d)??null:null,Ze=d?vs(b,d,-1):null,es=d?vs(b,d,1):null;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs(V,{value:i??"all",onValueChange:r=>{_(new Set),u(r==="all"?null:r)},children:[e.jsx(q,{className:"w-full sm:w-80",children:e.jsx(z,{})}
16),e.jsxs(H,{children:[e.jsx(P,{value:"all",children:"All jobs"}),l.map(r=>e.jsxs(P,{value:r.id,children:[r.title," · ",r.partner_name,r.status!=="live"?` (${r.status})`:""]},r.id))]})]}),e.jsxs("div",{className:"relative min-w-[220px] flex-1",children:[e.jsx(ct,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(D,{value:C,onChange:r=>E(r.target.value),placeholder:"Search name, skill, school, location",className:"pl-9"})]}),e.jsxs(V,{value:p,onValueChange:r=>N(r),children:[e.jsx(q,{className:"w-48",children:e.jsx(z,{})}),e.jsxs(H,{children:[e.jsx(P,{value:"all",children:"Any screening result"}),e.jsx(P,{value:"qualified",children:"Meets criteria"}),e.jsx(P,{value:"missed",children:"Missed criteria"})]})]}),e.jsxs(V,{value:j,onValueChange:r=>S(r),children:[e.jsx(q,{className:"w-36",children:e.jsx(z,{})}),e.jsxs(H,{children:[e.jsx(P,{value:"all",children:"Read or unread"}),e.jsx(P,{value:"unread",children:"Unread only"}),e.jsx(P,{value:"read",children:"Read only"})]})]}),e.jsxs(y,{variant:"outline",disabled:Ee||!O.length,onClick:()=>void Hs(B.length?B:O),children:[e.jsx(Re,{className:"mr-2 h-4 w-4"}),"Export ",B.length?`${B.length} selected`:"CSV"]}),e.jsxs(_t,{type:"single",value:o,onValueChange:r=>{r&&As(r)},className:"rounded-md border p-0.5","aria-label":"View",children:[e.jsx(ds,{value:"list",size:"sm","aria-label":"List view",title:"List",children:e.jsx(dt,{className:"h-4 w-4"})}),e.jsx(ds,{value:"board",size:"sm","aria-label":"Board view",title:"Board",children:e.jsx(wt,{className:"h-4 w-4"})})]})]}),o==="board"?t?e.jsx("div",{className:"flex gap-3",children:[0,1,2,3].map(r=>e.jsx(je,{className:"h-[420px] flex-1"},r))}):e.jsx(Wt,{rows:O,showJob:!i,onOpen:Qe,onMove:Vs}):null,e.jsx(bs,{value:m,onValueChange:r=>h(r),className:o==="board"?"hidden":"",children:e.jsxs(ks,{children:[e.jsxs(Q,{value:"applied",children:["To review ",e.jsx(U,{variant:"secondary",className:"ml-2",children:L.applied}),L.unread?e.jsxs(U,{className:"ml-1 bg-sky-600 hover:bg-sky-600",children:[L.unread," unread"]}):null]}),e.jsxs(Q,{value:"progressed",children:["Progressed ",e.jsx(U,{variant:"secondary",className:"ml-2",children:L.progressed})]}),e.jsxs(Q,{value:"submitted",children:["Submitted ",e.jsx(U,{variant:"secondary",className:"ml-2",children:L.submitted})]}),e.jsxs(Q,{value:"not_progressed",children:["Not progressed ",e.jsx(U,{variant:"secondary",className:"ml-2",children:L.not_progressed})]}),e.jsxs(Q,{value:"all",children:["All ",e.jsx(U,{variant:"secondary",className:"ml-2",children:L.all})]})]})}),e.jsxs("div",{className:`overflow-hidden rounded-xl border bg-card ${o==="board"?"hidden":""}`,children:[e.jsxs("div",{className:"flex items-center gap-3 border-b bg-muted/40 px-4 py-2.5 text-xs font-medium uppercase tracking-wide text-muted-foreground",children:[e.jsx(ye,{checked:Ge,onCheckedChange:Fs,"aria-label":"Select all shown"}),e.jsx("span",{className:"w-2"}),e.jsx("span",{className:"flex-1",children:"Candidate"}),e.jsx("span",{className:"hidden w-56 lg:block",children:"Backgroun
16d"}),e.jsx("span",{className:"hidden w-40 md:block",children:"Screening"}),e.jsx("span",{className:"w-28 text-right",children:"Applied"}),e.jsx("span",{className:"w-8"})]}),t?e.jsx("div",{className:"space-y-2 p-4",children:[0,1,2,3].map(r=>e.jsx(je,{className:"h-16 w-full"},r))}):O.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-2 px-4 py-14 text-center text-muted-foreground",children:[e.jsx(Fe,{className:"h-8 w-8"}),e.jsx("p",{className:"font-medium text-foreground",children:"No applicants here yet"}),e.jsx("p",{className:"text-sm",children:c.length?"Try another tab or filter.":"Applicants appear as soon as someone uses Quick Apply on a live job."})]}):e.jsx("ul",{className:"divide-y",children:O.map(r=>{const k=r.answers.filter(F=>F.qualifies===!1).length,A=!r.reviewed_at;return e.jsxs("li",{className:`group flex cursor-pointer items-center gap-3 px-4 py-3 transition-colors hover:bg-muted/40 ${I.has(r.id)?"bg-primary/5":A?"bg-sky-50/50":""}`,onClick:()=>Qe(r.id),children:[e.jsx("span",{onClick:F=>F.stopPropagation(),children:e.jsx(ye,{checked:I.has(r.id),onCheckedChange:()=>Rs(r.id),"aria-label":`Select ${r.full_name??r.email}`})}),e.jsx("span",{className:`h-2 w-2 shrink-0 rounded-full ${A?"bg-sky-500":"bg-transparent"}`,title:A?"Unread":void 0,"aria-label":A?"Unread":"Read"}),e.jsx("div",{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-full text-sm font-semibold ${$e(r.user_id)}`,children:Se(r.full_name||r.email)}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:`truncate ${A?"font-semibold":"font-medium text-foreground/90"}`,children:r.full_name||r.email}),r.stage==="submitted"?e.jsxs(U,{className:"gap-1 bg-violet-600 hover:bg-violet-600",children:[e.jsx(ne,{className:"h-3 w-3"}),"Submitted to ",r.partner_name]}):r.stage==="progressed"?e.jsxs(U,{className:"gap-1 bg-emerald-600 hover:bg-emerald-600",children:[e.jsx(Ns,{className:"h-3 w-3"}),r.progress_email_sent_at?"Progressed":"Progressed, email pending"]}):r.stage==="not_progressed"?e.jsx(U,{variant:"outline",className:"text-muted-foreground",children:"Not progressed"}):null,r.progress_email_error&&!r.progress_email_sent_at?e.jsx(U,{variant:"destructive",children:"Email failed"}):null,r.stage!=="applied"||r.stage_changed_at?(()=>{const F=ea(r);return F?e.jsx("span",{className:"text-xs text-muted-foreground",children:F}):null})():null]}),e.jsx("p",{className:"truncate text-sm text-muted-foreground",children:[r.headline,r.years_experience!=null?`${r.years_experience} yrs`:null].filter(Boolean).join(" · ")||r.email}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[r.skills.slice(0,5).map(F=>e.jsx(U,{variant:"secondary",className:"px-1.5 py-0 text-[11px] font-normal",children:F},F)),i?null:e.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["for ",r.job_title]})]})]}),e.jsxs("div",{className:"hidden w-56 space-y-1 text-xs text-muted-foreground lg:block",children:[r.location?e.jsxs("p",{className:"flex items-center gap-1.5 truncate",children:[e.jsx(ze,{className:"h-3.5 w-3.5 shrink-0"}),r.location]}):null,r.education?e.jsxs("p",{className:"flex items-center gap-1.5 truncate",children:[e.jsx(ws,{className:"h-3.5 w-3.5 shrink-0"}),r.education]}):null]}),e.jsx("div",{className:"hidden w-40 md:block",children:r.qualified?e.jsxs("span",{className:"inline-flex items-center gap-1 text-sm text-emerald-700",children:[e.jsx(ce,{className:"h-4 w-4"}),"Meets criteria"]}):e.jsxs("span",{className:"inline-flex items-center gap-1 text-sm text-amber-700",children:[e.jsx(de,{className:"h-4 w-4"}),"Missed ",k||1]})}),e.jsx("span",{className:"w-28 text-right text-xs text-muted-foreground",children:te(new Date(r.created_at),{addSuffix:!0})}),e.jsx(y,{size:"icon",variant:"ghost",className:"h-8 w-8 shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100 focus:opacity-100","aria-label":A?"Mark read":"Mark unread",title:A?"Mark read":"Mark unread",onClick:F=>{F.stopPropagation(),Ye(r.id)},children:A?e.jsx(Ie,{className:"h-4 w-4"}):e.jsx(ue,{className:"h-4 w-4"})})]},r.id)})})]}),B.length>0?e.jsxs("div",{className:"sticky bottom-4 z-20 mx-auto flex w-fit flex-wrap items-center gap-3 rounded-full border bg-background/95 px-4 py-2 shadow-lg backdrop-blur",children:[e.jsxs("span",{className:"text-sm font-medium",children:[B.length," selected"]}),Us?e.jsxs(y,{size:"sm",className:"rounded-full",onClick:()=>K(B.map(r=>r.id)),children:[Ds," ",e.jsx(_s,{className:"ml-1 h-4 w-4"})]}):null,Ts?e.jsxs(y,{size:"sm",className:"rounded-full bg-violet-600 hover:bg-violet-700",onClick:()=>void Xe(B.map(r=>r.id)),children:[e.jsx(ne,{className:"mr-1 h-4 w-4"})," Mark submitted"]}):null,e.jsxs(y,{size:"sm",variant:"outline",className:"rounded-full",onClick:()=>void We(B.map(r=>r.id)),children:[e.jsx(qe,{className:"mr-1 h-4 w-4"})," Not progressing"]}),e.jsx(y,{size:"sm",variant:"outline",className:"rounded-full",onClick:()=>void zs(),children:Pe==="read"?e.jsxs(e.Fragment,{children:[e.jsx(Ie,{className:"mr-1 h-4 w-4"})," Mark read"]}):e.jsxs(e.Fragment,{children:[e.jsx(ue,{className:"mr-1 h-4 w-4"})," Mark unread"]})}),e.jsx(y,{size:"icon",variant:"ghost",className:"h-8 w-8 rounded-full",onClick:()=>
16_(new Set),"aria-label":"Clear selection",children:e.jsx(Cs,{className:"h-4 w-4"})})]}):null,e.jsx(Jt,{applicant:Js,position:d?b.indexOf(d)+1:0,total:b.length,onPrev:Ze?()=>n(Ze):void 0,onNext:es?()=>n(es):void 0,onOpenChange:r=>{r||Is()},onProgress:qs,onNotProgressed:r=>We([r]),onReopen:Bs,onSubmitted:r=>Xe([r]),onUnsubmit:Os,onToggleRead:Ye,onChanged:g,hotkeys:R===null}),e.jsx(Xt,{applicants:c.filter(r=>R==null?void 0:R.includes(r.id)),open:R!==null,onOpenChange:r=>{r||K(null)},onDone:()=>{_(new Set),K(null),g()}})]})}const ta=["United States","United Kingdom","Canada","Germany","France","Netherlands","Ireland","Spain","India","Australia","Austria","Belgium","Switzerland","Luxembourg","Italy","Poland"],Ue="__none__";function aa(s){const t=/<(p|div|h[1-6])(?:\s[^>]*)?>(?:\s|&nbsp;|&#160;|\u00a0|<br\s*\/?>)*<\/\1>/gi;let l=s;for(let i=0;i<3&&t.test(l);i++)l=l.replace(t,"");return l.replace(/(?:<br\s*\/?>\s*){2,}/gi,"<br>").trim()}const Ve=()=>crypto.randomUUID();function oe(s="yes_no"){return{key:Ve(),prompt:"",help_text:null,kind:s,options:s==="yes_no"?["Yes","No"]:[],required:!0,qualifying_options:[],min_number:null}}const na=[{label:"Work authorisation",q:()=>({...oe("yes_no"),prompt:"Are you authorised to work in the country this role is based in?",qualifying_options:["Yes"]})},{label:"Years of experience",q:()=>({...oe("number"),prompt:"How many years of professional experience do you have in this field?",min_number:2})},{label:"Hours per week",q:()=>({...oe("single_select"),prompt:"How many hours a week can you commit?",options:["Under 10","10-20","20-40","40+"]})},{label:"Highest degree",q:()=>({...oe("single_select"),prompt:"What is your highest completed degree?",options:["Bachelor's","Master's","PhD","Other"]})}];function js(s,t){var l;return{partner_id:(s==null?void 0:s.partner_id)??((l=t.find(i=>!i.archived_at))==null?void 0:l.id)??"",status:(s==null?void 0:s.status)??"live",title:(s==null?void 0:s.title)??"",description:(s==null?void 0:s.description)??"",work_mode:(s==null?void 0:s.work_mode)??"remote",city:(s==null?void 0:s.city)??"",country:(s==null?void 0:s.country)??"United States",job_type:(s==null?void 0:s.job_type)??"Contract",seniority_level:(s==null?void 0:s.seniority_level)??"",salary_min:(s==null?void 0:s.salary_min)!=null?String(s.salary_min):"",salary_max:(s==null?void 0:s.salary_max)!=null?String(s.salary_max):"",salary_currency:(s==null?void 0:s.salary_currency)||"USD",salary_period:(s==null?void 0:s.salary_period)??"hourly",skills:((s==null?void 0:s.skills)??[]).join(", "),start_asap:(s==null?void 0:s.start_asap)??!1,start_date:(s==null?void 0:s.start_date)??"",engagement_length:(s==null?void 0:s.engagement_length)??"",commitment:(s==null?void 0:s.commitment)??"",positions:(s==null?void 0:s.positions)!=null?String(s.positions):"",one_time_payment_amount:(s==null?void 0:s.one_time_payment_amount)!=null?String(s.one_time_payment_amount):"",one_time_payment_note:(s==null?void 0:s.one_time_payment_note)??"",location_note:(s==null?void 0:s.location_note)??"",partner_ref:(s==null?void 0:s.partner_ref)??"",partner_fee:(s==null?void 0:s.partner_fee)??""}}function ra({open:s,job:t,partners:l,onOpenChange:i,onSaved:u,onNewPartner:g}){const[o,v]=x.useState(()=>js(t,l)),[m,h]=x.useState([]),[p,N]=x.useState(!1),[j,S]=x.useState(!0),[C,E]=x.useState(""),[I,_]=x.useState(!1);x.useEffect(()=>{s&&(v(js(t,l)),h(((t==null?void 0:t.questions)??[]).map(a=>({...a,key:a.id??Ve()}))),S(!t),E(""))},[s,t]),x.useEffect(()=>{s&&!o.partner_id&&l.length&&v(a=>{var M;return{...a,partner_id:((M=l.find(T=>!T.archived_at))==null?void 0:M.id)??""}})},[s,l,o.partner_id]);const d=(a,M)=>v(T=>({...T,[a]:M})),n=(a,M)=>h(T=>T.map(c=>c.key===a?{...c,...M}:c)),b=(a,M)=>h(T=>{const c=[...T],[L]=c.splice(a,1);return c.splice(a+M,0,L),c}),f=a=>{v(c=>{var L;return{...c,title:a.title??c.title,work_mode:a.work_mode??c.work_mode,country:a.country??c.country,city:a.city??(a.work_mode==="remote"?"":c.city),job_type:a.job_type??c.job_type,seniority_level:a.seniority_level??c.seniority_level,salary_min:a.salary_min!=null?String(a.salary_min):c.salary_min,salary_max:a.salary_max!=null?String(a.salary_max):c.salary_max,salary_currency:a.salary_currency??c.salary_currency,salary_period:a.salary_period??c.salary_period,skills:(L=a.skills)!=null&&L.length?a.skills.join(", "):c.skills,description:a.description_html??c.description,start_asap:a.start_asap??(a.start_date?!1:c.start_asap),start_date:a.start_date??(a.start_asap?"":c.start_date),engagement_length:a.engagement_length??c.engagement_length,commitment:a.commitment??c.commitment,positions:a.positions!=null?String(a.positions):c.positions,one_time_payment_amount:a.one_time_payment_amount!=null?String(a.one_time_payment_amount):c.one_time_payment_amount,one_time_payment_note:a.one_time_payment_note??c.one_time_payment_note,location_note:a.location_note??c.location_note,partner_ref:a.partner_ref??c.partner_ref,partner_fee:a.partner_fee??c.partner_fee}});const M=a.questions.length>0&&m.length===0;M&&h(a.questions.map(c=>({...c,key:Ve()})));const T=[!a.title&&"title",a.salary_min==null&&a.salary_max==null&&"pay",!a.description_html&&"description"].filter(
16Boolean);w.success(`Form filled${M?` with ${a.questions.length} suggested screening question${a.questions.length===1?"":"s"}`:""}. Check it before publishing.`+(T.length?` Not found in the text: ${T.join(", ")}.`:""))},R=async()=>{if(C.trim().length<80){w.error("Paste the full job description (at least a few sentences).");return}_(!0);try{f(await Pt(C)),S(!1)}catch(a){w.error(a instanceof Error?a.message:"Couldn't read that job description")}finally{_(!1)}},K=async a=>{if(!o.partner_id){w.error("Choose a partner");return}if(!o.title.trim()){w.error("Give the job a title");return}const M=o.description.replace(/<[^>]+>/g,"").trim();if((o.salary_min||o.salary_max)&&!o.salary_currency){w.error("Choose the pay currency");return}if((a??o.status)==="live"&&M.length<50){w.error("Add a job description before publishing");return}N(!0);try{await $s({id:t==null?void 0:t.id,...o,description:aa(o.description),status:a??o.status,city:o.work_mode==="remote"?"":o.city,seniority_level:o.seniority_level,skills:o.skills.split(",").map(T=>T.trim()).filter(Boolean),questions:m.map(({key:T,...c})=>c)}),w.success(t?"Job saved":(a??o.status)==="live"?"Job is live on haystackapp.io":"Draft saved"),u(),i(!1)}catch(T){w.error(T instanceof Error?T.message:"Could not save the job")}finally{N(!1)}},Ee=l.filter(a=>!a.archived_at||a.id===o.partner_id);return e.jsx(Ne,{open:s,onOpenChange:i,children:e.jsxs(be,{className:"max-h-[92vh] overflow-y-auto sm:max-w-3xl",children:[e.jsxs(He,{children:[e.jsx(ke,{children:t?"Edit job":"New AI lab job"}),e.jsx(Ce,{children:"Live jobs show on haystackapp.io with a Quick Apply button. Candidates sign up with their CV and answer your screening questions."})]}),e.jsxs("section",{className:"rounded-xl border border-dashed border-violet-300 bg-gradient-to-br from-violet-50 to-emerald-50 p-4 dark:border-violet-800 dark:from-violet-950/30 dark:to-emerald-950/30",children:[e.jsxs("button",{type:"button",className:"flex w-full items-center justify-between text-left",onClick:()=>S(a=>!a),children:[e.jsxs("span",{className:"flex items-center gap-2 font-medium",children:[e.jsx(ts,{className:"h-4 w-4 text-violet-600"}),"Paste a job description to fill the form"]}),j?e.jsx(mt,{className:"h-4 w-4"}):e.jsx(ut,{className:"h-4 w-4"})]}),j?e.jsxs("div",{className:"mt-3 space-y-2",children:[e.jsx(xe,{rows:7,value:C,onChange:a=>E(a.target.value),placeholder:"Paste the partner's job description here: title, pay, location, requirements, the lot.",className:"bg-background"}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("p",{className:"text-xs text-muted-foreground",children:["AI fills in the fields",m.length===0?" and suggests screening questions from the requirements":"",". You review everything before it goes live."]}),e.jsxs(y,{type:"button",size:"sm",disabled:I||C.trim().length<80,onClick:()=>void R(),children:[I?e.jsx(Y,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(ts,{className:"mr-2 h-4 w-4"}),I?"Reading...":"Fill the form"]})]})]}):null]}),e.jsxs("section",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4 sm:grid-cols-[1fr_auto]",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{children:"Partner"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(V,{value:o.partner_id,onValueChange:a=>{a&&d("partner_id",a)},children:[e.jsx(q,{children:e.jsx(z,{placeholder:"Choose a partner"})}),e.jsx(H,{children:Ee.map(a=>e.jsx(P,{value:a.id,children:a.name},a.id))})]}),e.jsxs(y,{type:"button",variant:"outline",onClick:g,children:[e.jsx(ae,{className:"mr-1 h-4 w-4"}),"New"]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{children:"Status"}),e.jsxs(V,{value:o.status,onValueChange:a=>{a&&d("status",a)},children:[e.jsx(q,{className:"w-36",children:e.jsx(z,{})}
16),e.jsxs(H,{children:[e.jsx(P,{value:"draft",children:"Draft"}),e.jsx(P,{value:"live",children:"Live"}),e.jsx(P,{value:"closed",children:"Closed"})]})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{htmlFor:"job-title",children:"Job title"}),e.jsx(D,{id:"job-title",value:o.title,onChange:a=>d("title",a.target.value),placeholder:"Senior Python Engineer (AI Training)"})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{children:"Work mode"}),e.jsxs(V,{value:o.work_mode,onValueChange:a=>{a&&d("work_mode",a)},children:[e.jsx(q,{children:e.jsx(z,{})}),e.jsxs(H,{children:[e.jsx(P,{value:"remote",children:"Remote"}),e.jsx(P,{value:"hybrid",children:"Hybrid"}),e.jsx(P,{value:"on-site",children:"On-site"})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{htmlFor:"job-country",children:"Country"}),e.jsx(D,{id:"job-country",list:"ai-labs-countries",value:o.country,onChange:a=>d("country",a.target.value)}),e.jsx("datalist",{id:"ai-labs-countries",children:ta.map(a=>e.jsx("option",{value:a},a))})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{htmlFor:"job-city",children:"City"}),e.jsx(D,{id:"job-city",value:o.work_mode==="remote"?"":o.city,disabled:o.work_mode==="remote",onChange:a=>d("city",a.target.value),placeholder:o.work_mode==="remote"?"Remote":"San Francisco"})]})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{children:"Employment type"}),e.jsxs(V,{value:o.job_type,onValueChange:a=>{a&&d("job_type",a)},children:[e.jsx(q,{children:e.jsx(z,{})}),e.jsx(H,{children:["Contract","Full-time","Part-time","Freelance","Internship"].map(a=>e.jsx(P,{value:a,children:a},a))})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{children:"Seniority"}),e.jsxs(V,{value:o.seniority_level||Ue,onValueChange:a=>{a&&d("seniority_level",a===Ue?"":a)},children:[e.jsx(q,{children:e.jsx(z,{})}
16),e.jsxs(H,{children:[e.jsx(P,{value:Ue,children:"Not specified"}),e.jsx(P,{value:"entry-level",children:"Entry level"}),e.jsx(P,{value:"junior",children:"Junior"}),e.jsx(P,{value:"mid-senior",children:"Mid-senior"}),e.jsx(P,{value:"leader",children:"Lead / principal"})]})]})]})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{htmlFor:"pay-min",children:"Pay from"}),e.jsx(D,{id:"pay-min",inputMode:"numeric",value:o.salary_min,onChange:a=>d("salary_min",a.target.value.replace(/[^0-9]/g,"")),placeholder:"50"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{htmlFor:"pay-max",children:"Pay to"}),e.jsx(D,{id:"pay-max",inputMode:"numeric",value:o.salary_max,onChange:a=>d("salary_max",a.target.value.replace(/[^0-9]/g,"")),placeholder:"100"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{children:"Currency"}),e.jsxs(V,{value:o.salary_currency,onValueChange:a=>{a&&d("salary_currency",a)},children:[e.jsx(q,{children:e.jsx(z,{})}),e.jsx(H,{children:["USD","GBP","EUR"].map(a=>e.jsx(P,{value:a,children:a},a))})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{children:"Per"}),e.jsxs(V,{value:o.salary_period,onValueChange:a=>{a&&d("salary_period",a)},children:[e.jsx(q,{children:e.jsx(z,{})}
16),e.jsxs(H,{children:[e.jsx(P,{value:"hourly",children:"Hour"}),e.jsx(P,{value:"monthly",children:"Month"}),e.jsx(P,{value:"yearly",children:"Year"})]})]})]})]}),e.jsxs("div",{className:"space-y-3 rounded-xl border p-4",children:[e.jsx("p",{className:"text-sm font-semibold",children:"Engagement"}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{htmlFor:"job-start",children:"Start"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("label",{className:"flex shrink-0 items-center gap-1.5 text-sm",children:[e.jsx(ye,{checked:o.start_asap,onCheckedChange:a=>d("start_asap",a===!0)}),"ASAP"]}),e.jsx(D,{id:"job-start",type:"date",disabled:o.start_asap,value:o.start_asap?"":o.start_date,onChange:a=>d("start_date",a.target.value)})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{htmlFor:"job-length",children:"Engagement length"}),e.jsx(D,{id:"job-length",value:o.engagement_length,onChange:a=>d("engagement_length",a.target.value),placeholder:"16 weeks"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{htmlFor:"job-commitment",children:"Commitment"}),e.jsx(D,{id:"job-commitment",value:o.commitment,onChange:a=>d("commitment",a.target.value),placeholder:"Full-time"})]})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-[120px_140px_1fr]",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{htmlFor:"job-positions",children:"Openings"}),e.jsx(D,{id:"job-positions",inputMode:"numeric",value:o.positions,onChange:a=>d("positions",a.target.value.replace(/[^0-9]/g,"")),placeholder:"100"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{htmlFor:"job-bonus",children:"One-time payment"}),e.jsx(D,{id:"job-bonus",inputMode:"decimal",value:o.one_time_payment_amount,onChange:a=>d("one_time_payment_amount",a.target.value.replace(/[^0-9.]/g,"")),placeholder:`${o.salary_currency} 50`})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{htmlFor:"job-bonus-note",children:"Paid when"}),e.jsx(D,{id:"job-bonus-note",value:o.one_time_payment_note,disabled:!o.one_time_payment_amount,onChange:a=>d("one_time_payment_note",a.target.value),placeholder:"if you submit the JSON file and are hired"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{htmlFor:"job-location-note",children:"Location eligibility"}),e.jsx(D,{id:"job-location-note",value:o.location_note,onChange:a=>d("location_note",a.target.value),placeholder:"All US states except Texas, Illinois, California, Connecticut, Massachusetts, New Jersey and Vermont"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"All shown to candidates on the job and Quick Apply pages."})]}),e.jsxs("div",{className:"space-y-3 rounded-xl border border-amber-200 bg-amber-50/50 p-4 dark:border-amber-900 dark:bg-amber-950/20",children:[e.jsxs("p",{className:"text-sm font-semibold",children:["Internal ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"(admins only, never shown to candidates)"})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-[160px_1fr]",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{htmlFor:"job-ref",children:"Partner reference"}),e.jsx(D,{id:"job-ref",value:o.partner_ref,onChange:a=>d("partner_ref",a.target.value),placeholder:"100063"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{htmlFor:"job-fee",children:"Partner fee"}),e.jsx(D,{id:"job-fee",value:o.partner_fee,onChange:a=>d("partner_fee",a.target.value),placeholder:"$350 flat fee after 2 weeks of active engagement"})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{htmlFor:"job-skills",children:"Skills"}),e.jsx(D,{id:"job-skills",value:o.skills,onChange:a=>d("skills",a.target.value),placeholder:"Python, PyTorch, LLM evaluation"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Comma separated. Leave empty and we'll pick them out of the description."})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{children:"Description"}),e.jsx(xt,{value:o.description,onChange:a=>d("description",a),placeholder:"What the role involves, who it suits, how it pays..."})]})]}),e.jsxs("section",{className:"mt-2 space-y-3 border-t pt-5",children:[e.jsx("div",{className:"flex flex-wrap items-end justify-between gap-2",children:e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold",children:"Screening questions"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Candidates answer these when they apply. Set a filter on a question and anyone who misses it is flagged, so you can review the rest first."})]})}),m.map((a,M)=>{const T=a.kind==="yes_no"||a.kind==="single_select"||a.kind==="multi_select";return e.jsxs("div",{className:"space-y-3 rounded-xl border bg-muted/20 p-4",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsxs("span",{className:"mt-2 w-6 shrink-0 text-sm font-semibold text-muted-foreground",children:[M+1,"."]}
16),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(D,{value:a.prompt,onChange:c=>n(a.key,{prompt:c.target.value}),placeholder:"Ask a question"}),e.jsx(D,{value:a.help_text??"",onChange:c=>n(a.key,{help_text:c.target.value||null}),placeholder:"Hint shown under the question (optional)",className:"h-8 text-sm"})]}),e.jsxs(V,{value:a.kind,onValueChange:c=>{if(!c)return;const L=c;n(a.key,{kind:L,options:L==="yes_no"?["Yes","No"]:L==="single_select"||L==="multi_select"?a.kind==="yes_no"?[]:a.options:[],qualifying_options:[],min_number:null})},children:[e.jsx(q,{className:"w-36",children:e.jsx(z,{})}),e.jsx(H,{children:Nt.map(c=>e.jsx(P,{value:c.value,children:c.label},c.value))})]}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx(y,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",disabled:M===0,onClick:()=>b(M,-1),"aria-label":"Move up",children:e.jsx(ht,{className:"h-3.5 w-3.5"})}),e.jsx(y,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",disabled:M===m.length-1,onClick:()=>b(M,1),"aria-label":"Move down",children:e.jsx(pt,{className:"h-3.5 w-3.5"})})]}),e.jsx(y,{type:"button",variant:"ghost",size:"icon",onClick:()=>h(c=>c.filter(L=>L.key!==a.key)),"aria-label":"Remove question",children:e.jsx(gt,{className:"h-4 w-4 text-muted-foreground"})})]}),a.kind==="single_select"||a.kind==="multi_select"?e.jsxs("div",{className:"ml-8 space-y-1.5",children:[e.jsx($,{className:"text-xs text-muted-foreground",children:"Options, one per line"}),e.jsx(xe,{rows:3,value:a.options.join(`
17`),onChange:c=>{const L=c.target.value.split(`
18`);n(a.key,{options:L,qualifying_options:a.qualifying_options.filter(O=>L.includes(O))})}})]}):null,e.jsxs("div",{className:"ml-8 flex flex-wrap items-center gap-x-6 gap-y-3",children:[e.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[e.jsx(ft,{checked:a.required,onCheckedChange:c=>n(a.key,{required:c})}),"Required"]}),T?e.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-sm",children:[e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",children:[e.jsx(as,{className:"h-3.5 w-3.5"}),"Meets criteria if"]}),a.options.map(c=>c.trim()).filter(Boolean).map(c=>e.jsxs("label",{className:"flex items-center gap-1.5",children:[e.jsx(ye,{checked:a.qualifying_options.includes(c),onCheckedChange:L=>n(a.key,{qualifying_options:L===!0?[...a.qualifying_options,c]:a.qualifying_options.filter(O=>O!==c)})}),c]},c)),a.qualifying_options.length===0?e.jsx("span",{className:"text-xs text-muted-foreground",children:"(any answer)"}):null]}):a.kind==="number"?e.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",children:[e.jsx(as,{className:"h-3.5 w-3.5"}),"Meets criteria at"]}),e.jsx(D,{className:"h-8 w-20",inputMode:"decimal",value:a.min_number??"",onChange:c=>n(a.key,{min_number:c.target.value===""?null:Number(c.target.value.replace(/[^0-9.]/g,""))})}),e.jsx("span",{className:"text-muted-foreground",children:"or more"})]}):e.jsx("span",{className:"text-xs text-muted-foreground",children:"Free text answers are never filtered."})]})]},a.key)}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(y,{type:"button",variant:"outline",size:"sm",onClick:()=>h(a=>[...a,oe()]),children:[e.jsx(ae,{className:"mr-1 h-4 w-4"})," Add question"]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"or start from"}),na.map(a=>e.jsx(U,{variant:"secondary",className:"cursor-pointer hover:bg-secondary/70",onClick:()=>h(M=>[...M,a.q()]),children:a.label},a.label))]})]}),e.jsxs(Je,{className:"mt-2 gap-2 sm:gap-0",children:[e.jsx(y,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),t?null:e.jsx(y,{variant:"secondary",disabled:p,onClick:()=>void K("draft"),children:"Save as draft"}),e.jsxs(y,{disabled:p,onClick:()=>void K(t?void 0:"live"),children:[p?e.jsx(Y,{className:"mr-2 h-4 w-4 animate-spin"}):null,t?"Save changes":"Publish job"]})]})]})})}function la({open:s,partner:t,onOpenChange:l,onSaved:i}){const[u,g]=x.useState(""),[o,v]=x.useState(""),[m,h]=x.useState(""),[p,N]=x.useState(""),[j,S]=x.useState(null),[C,E]=x.useState(!1),[I,_]=x.useState(!1),d=x.useRef(null);x.useEffect(()=>{s&&(g((t==null?void 0:t.name)??""),v((t==null?void 0:t.website)??""),h((t==null?void 0:t.description)??""),N((t==null?void 0:t.next_steps_note)??""),S((t==null?void 0:t.logo_url)??null))},[s,t]);const n=async f=>{if(f){if(!hs.includes(f.type)){w.error("Logo must be png, jpg, svg or webp");return}
18if(f.size>Dt){w.error("Logo must be 2MB or smaller");return}E(!0);try{S(await At(f))}catch(R){w.error(R instanceof Error?R.message:"Upload failed")}finally{E(!1),d.current&&(d.current.value="")}}},b=async()=>{if(!u.trim()){w.error("Give the partner a name");return}_(!0);try{const f=await Ss({id:t==null?void 0:t.id,name:u,website:o,description:m,next_steps_note:p,logo_url:j});w.success(t?"Partner updated":"Partner created"),i(f),l(!1)}catch(f){w.error(f instanceof Error?f.message:"Could not save")}finally{_(!1)}};return e.jsx(Ne,{open:s,onOpenChange:l,children:e.jsxs(be,{className:"sm:max-w-lg",children:[e.jsxs(He,{children:[e.jsx(ke,{children:t?`Edit ${t.name}`:"New AI lab partner"}),e.jsx(Ce,{children:"The name and logo show on the partner's jobs on haystackapp.io and in the email candidates get when you progress them."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(_e,{name:u||"?",url:j,size:64}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("input",{ref:d,type:"file",accept:hs.join(","),className:"hidden",onChange:f=>{var R;return void n((R=f.target.files)==null?void 0:R[0])}}),e.jsxs(y,{type:"button",variant:"outline",size:"sm",disabled:C,onClick:()=>{var f;return(f=d.current)==null?void 0:f.click()},children:[C?e.jsx(Y,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(vt,{className:"mr-2 h-4 w-4"}),j?"Replace logo":"Upload logo"]}),j?e.jsxs(y,{type:"button",variant:"ghost",size:"sm",onClick:()=>S(null),children:[e.jsx(Cs,{className:"mr-1 h-4 w-4"})," Remove"]}):null,e.jsx("p",{className:"w-full text-xs text-muted-foreground",children:"Square png, svg or webp works best. 2MB max."})]})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{htmlFor:"partner-name",children:"Name"}),e.jsx(D,{id:"partner-name",value:u,onChange:f=>g(f.target.value),placeholder:"Turing"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{htmlFor:"partner-website",children:"Website"}),e.jsx(D,{id:"partner-website",value:o,onChange:f=>v(f.target.value),placeholder:"turing.com"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{htmlFor:"partner-description",children:"About (optional)"}),e.jsx(xe,{id:"partner-description",rows:3,value:m,onChange:f=>h(f.target.value),placeholder:"Turing works with the world's leading AI labs to train and evaluate frontier models."})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{htmlFor:"partner-note",children:"Extra note in the progress email (optional)"}),e.jsx(xe,{id:"partner-note",rows:2,value:p,onChange:f=>N(f.target.value),placeholder:"Turing's next step is a short online assessment. It takes about 45 minutes."}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'Shown under "What happens next". The email already says to expect an email from the partner.'})]})]}),e.jsxs(Je,{children:[e.jsx(y,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsxs(y,{onClick:()=>void b(),disabled:I||C,children:[I?e.jsx(Y,{className:"mr-2 h-4 w-4 animate-spin"}):null,t?"Save changes":"Create partner"]})]})]})})}const ia={live:"bg-emerald-100 text-emerald-800 hover:bg-emerald-100",draft:"bg-slate-100 text-slate-700 hover:bg-slate-100",closed:"bg-rose-100 text-rose-800 hover:bg-rose-100"};function ie({label:s,value:t,hint:l}){return e.jsxs("div",{className:"rounded-xl border bg-card px-4 py-3",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:s}),e.jsxs("p",{className:"text-2xl font-semibold tabular-nums",children:[t,l?e.jsx("span",{className:"ml-2 text-sm font-medium text-sky-700",children:l}):null]})]})}function ua(){const[s,t]=x.useState("applicants"),[l,i]=x.useState(null),[u,g]=x.useState(void 0),[o,v]=x.useState(void 0),m=Le({queryKey:["ai-labs-partners"],queryFn:bt}),h=Le({queryKey:["ai-labs-jobs"],queryFn:kt}),p=Le({queryKey:["ai-labs-applicants",l],queryFn:()=>Ct(l)}),N=m.data??[],j=h.data??[],S=()=>{m.refetch(),h.refetch(),p.refetch()},C=j.reduce((n,b)=>({live:n.live+(b.status==="live"?1:0),applicants:n.applicants+b.applicants,review:n.review+b.to_review,unread:n.unread+(b.unread??0),progressed:n.progressed+b.progressed,submitted:n.submitted+(b.submitted??0)}),{live:0,applicants:0,review:0,unread:0,progressed:0,submitted:0}),E=async(n,b)=>{try{await $s({id:n.id,partner_id:n.partner_id,status:b,title:n.title,de
18scription:n.description??"",city:n.city??"",country:n.country??"",work_mode:n.work_mode??"",job_type:n.job_type??"",seniority_level:n.seniority_level??"",salary_min:n.salary_min??"",salary_max:n.salary_max??"",salary_currency:n.salary_currency??"",salary_period:n.salary_period??"",skills:n.skills??[],questions:n.questions,start_asap:n.start_asap,start_date:n.start_date??"",engagement_length:n.engagement_length??"",commitment:n.commitment??"",positions:n.positions??"",one_time_payment_amount:n.one_time_payment_amount??"",one_time_payment_note:n.one_time_payment_note??"",location_note:n.location_note??"",partner_ref:n.partner_ref??"",partner_fee:n.partner_fee??""}),w.success(b==="live"?"Job is live":"Job closed"),S()}catch(f){w.error(f instanceof Error?f.message:"Could not update the job")}},I=async(n,b)=>{try{await Ss({...n,archived:b}),w.success(b?`${n.name} archived`:`${n.name} restored`),m.refetch()}catch(f){w.error(f instanceof Error?f.message:"Could not update")}},_=async n=>{await navigator.clipboard.writeText(`${Be}/jobs/${n}`),w.success("Job link copied")},d=()=>{if(!N.some(n=>!n.archived_at)){w.info("Create a partner first"),v(null);return}g(null)};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-11 w-11 items-center justify-center rounded-xl bg-gradient-to-br from-violet-500 to-emerald-500 text-white shadow",children:e.jsx(Ae,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-semibold tracking-tight",children:"AI Labs Hiring"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Jobs for AI lab partners, their Quick Apply candidates, and who goes forward."})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(y,{variant:"outline",onClick:()=>v(null),children:[e.jsx(ae,{className:"mr-1 h-4 w-4"}),"Partner"]}),e.jsxs(y,{onClick:d,children:[e.jsx(ae,{className:"mr-1 h-4 w-4"}),"New job"]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 md:grid-cols-5",children:[e.jsx(ie,{label:"Live jobs",value:C.live}),e.jsx(ie,{label:"Applicants",value:C.applicants}),e.jsx(ie,{label:"To review",value:C.review,hint:C.unread?`${C.unread} unread`:null}),e.jsx(ie,{label:"Progressed",value:C.progressed}),e.jsx(ie,{label:"Submitted",value:C.submitted})]}),e.jsxs(bs,{value:s,onValueChange:t,children:[e.jsxs(ks,{children:[e.jsxs(Q,{value:"applicants",children:[e.jsx(Fe,{className:"mr-2 h-4 w-4"}),"Applicants"]}),e.jsxs(Q,{value:"jobs",children:[e.jsx(ns,{className:"mr-2 h-4 w-4"}),"Jobs ",e.jsx(U,{variant:"secondary",className:"ml-2",children:j.length})]}),e.jsxs(Q,{value:"partners",children:[e.jsx(Ae,{className:"mr-2 h-4 w-4"}),"Partners ",e.jsx(U,{variant:"secondary",className:"ml-2",children:N.filter(n=>!n.archived_at).length})]})]}),e.jsx(De,{value:"applicants",className:"mt-4",children:e.jsx(sa,{applicants:p.data??[],loading:p.isLoading,jobs:j,jobId:l,onJobChange:i,onChanged:S})}),e.jsx(De,{value:"jobs",className:"mt-4 space-y-3",children:h.isLoading?[0,1].map(n=>e.jsx(je,{className:"h-24 w-full"},n)):j.length===0?e.jsx(pe,{children:e.jsxs(ge,{className:"flex flex-col items-center gap-3 py-12 text-center",children:[e.jsx(ns,{className:"h-8 w-8 text-muted-foreground"}),e.jsx("p",{className:"font-medium",children:"No AI lab jobs yet"}),e.jsxs(y,{onClick:d,children:[e.jsx(ae,{className:"mr-1 h-4 w-4"}),"Create the first job"]})]})}):j.map(n=>e.jsx(pe,{className:"transition-shadow hover:shadow-md",children:e.jsxs(ge,{className:"flex flex-wrap items-center gap-4 p-4",children:[e.jsx(_e,{name:n.partner_name,url:n.partner_logo_url,size:44}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.partner_ref?e.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-muted-foreground",children:n.partner_ref}):null,e.jsx("p",{className:"truncate font-semibold",children:n.title}),e.jsx(U,{className:ia[n.status],children:n.status})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:[n.partner_name,Ut(n),[Tt(n),Rt(n.one_time_payment_amount,n.salary_currency)].filter(
18Boolean).join(" + "),n.job_type].filter(Boolean).join(" · ")}),gs(n).length?e.jsx("p",{className:"text-xs text-muted-foreground",children:gs(n).join(" · ")}):null,n.partner_fee?e.jsxs("p",{className:"text-xs text-amber-700 dark:text-amber-400",children:["Fee: ",n.partner_fee]}):null,e.jsxs("p",{className:"mt-0.5 text-xs text-muted-foreground",children:[n.questions.length," screening question",n.questions.length===1?"":"s"]})]}),e.jsxs("button",{type:"button",className:"grid grid-cols-4 gap-4 rounded-lg px-2 py-1 text-center hover:bg-muted",onClick:()=>{i(n.id),t("applicants")},children:[e.jsxs("span",{children:[e.jsx("span",{className:"block text-lg font-semibold tabular-nums",children:n.applicants}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"applied"})]}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-lg font-semibold tabular-nums",children:n.to_review}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["to review",n.unread?e.jsxs("span",{className:"text-sky-700",children:[" · ",n.unread," unread"]}):null]})]}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-lg font-semibold tabular-nums",children:n.progressed}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"progressed"})]}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-lg font-semibold tabular-nums",children:n.submitted??0}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"submitted"})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs(y,{variant:"outline",size:"sm",onClick:()=>g(n),children:[e.jsx(rs,{className:"mr-1 h-3.5 w-3.5"}),"Edit"]}),e.jsxs(ls,{children:[e.jsx(is,{asChild:!0,children:e.jsx(y,{variant:"ghost",size:"icon","aria-label":"More",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(cs,{align:"end",children:[e.jsxs(X,{onClick:()=>
18{i(n.id),t("applicants")},children:[e.jsx(Fe,{className:"mr-2 h-4 w-4"}),"View applicants"]}),n.status==="live"?e.jsxs(e.Fragment,{children:[e.jsx(X,{asChild:!0,children:e.jsxs("a",{href:`${Be}/jobs/${n.id}`,target:"_blank",rel:"noreferrer",children:[e.jsx(ve,{className:"mr-2 h-4 w-4"}),"Open on haystackapp.io"]})}),e.jsxs(X,{onClick:()=>void _(n.id),children:[e.jsx(me,{className:"mr-2 h-4 w-4"}),"Copy job link"]})]}):null,e.jsx(jt,{}),n.status==="live"?e.jsxs(X,{onClick:()=>void E(n,"closed"),children:[e.jsx(us,{className:"mr-2 h-4 w-4"}),"Close job"]}):e.jsxs(X,{onClick:()=>void E(n,"live"),children:[e.jsx(us,{className:"mr-2 h-4 w-4"}),"Publish job"]})]})]})]})]})},n.id))}),e.jsx(De,{value:"partners",className:"mt-4",children:m.isLoading?e.jsx(je,{className:"h-24 w-full"}):N.length===0?e.jsx(pe,{children:e.jsxs(ge,{className:"flex flex-col items-center gap-3 py-12 text-center",children:[e.jsx(Ae,{className:"h-8 w-8 text-muted-foreground"}),e.jsx("p",{className:"font-medium",children:"Add your first AI lab partner"}),e.jsxs(y,{onClick:()=>v(null),children:[e.jsx(ae,{className:"mr-1 h-4 w-4"}),"New partner"]})]})}):e.jsx("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-3",children:N.map(n=>{const b=j.filter(f=>f.partner_id===n.id);return e.jsx(pe,{className:n.archived_at?"opacity-60":"",children:e.jsxs(ge,{className:"space-y-3 p-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(_e,{name:n.name,url:n.logo_url,size:48}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("p",{className:"truncate font-semibold",children:[n.name,n.archived_at?e.jsx(U,{variant:"outline",className:"ml-2",children:"archived"}):null]}),n.website?e.jsx("a",{href:n.website,target:"_blank",rel:"noreferrer",className:"truncate text-sm text-muted-foreground hover:underline",children:n.website.replace(/^https?:\/\//,"")}):null]}),e.jsxs(ls,{children:[e.jsx(is,{asChild:!0,children:e.jsx(y,{variant:"ghost",size:"icon","aria-label":"More",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(cs,{align:"end",children:[e.jsxs(X,{onClick:()=>v(n),children:[e.jsx(rs,{className:"mr-2 h-4 w-4"}),"Edit"]}),e.jsxs(X,{onClick:()=>void I(n,!n.archived_at),children:[e.jsx(yt,{className:"mr-2 h-4 w-4"}),n.archived_at?"Restore":"Archive"]})]})]})]}),n.description?e.jsx("p",{className:"line-clamp-2 text-sm text-muted-foreground",children:n.description}):null,e.jsxs("div",{className:"flex gap-4 border-t pt-3 text-sm",children:[e.jsxs("span",{children:[e.jsx("b",{className:"tabular-nums",children:b.filter(f=>f.status==="live").length})," ",e.jsx("span",{className:"text-muted-foreground",children:"live jobs"})]}),e.jsxs("span",{children:[e.jsx("b",{className:"tabular-nums",children:b.reduce((f,R)=>f+R.applicants,0)})," ",e.jsx("span",{className:"text-muted-foreground",children:"applicants"})]}),e.jsxs("span",{children:[e.jsx("b",{className:"tabular-nums",children:b.reduce((f,R)=>f+R.progressed,0)})," ",e.jsx("span",{className:"text-muted-foreground",children:"progressed"})]}),e.jsxs("span",{children:[e.jsx("b",{className:"tabular-nums",children:b.reduce((f,R)=>f+(R.submitted??0),0)})," ",e.jsx("span",{className:"text-muted-foreground",children:"submitted"})]})]})]})},n.id)})})})]}),e.jsx(ra,{open:u!==void 0,job:u??null,partners:N,onOpenChange:n=>{n||g(void 0)},onSaved:S,onNewPartner:()=>v(null)}),e.jsx(la,{open:o!==void 0,partner:o??null,onOpenChange:n=>{n||v(void 0)},onSaved:()=>{m.refetch(),h.refetch()}})]})}export{ua 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.