PageSourceSearch

https://hrmapping.lovable.app/assets/TalentSearch-BxkS0iWZ.js

js hrmapping.lovable.app collected 2026-10-03 03:30:07 UTC 43,637 bytes, 1 lines download raw bytes

1import{r,u as et,h as de,n as tt,j as e,a1 as st,I as ve,S as re,f as ne,g as ie,k as oe,l as S,B as H,a4 as ht,i as me,o as E,av as ft,aZ as Pe,D as Re,a as Ie,b as ke,d as Le,K as Ee,x as pt,ah as jt,F as _e,V as gt,W as Nt,X as ze,G as He,H as Ue,L as bt,U as yt,aW as vt,E as Ve,ck as We,a9 as Ge,a5 as Et,a6 as St,b6 as wt,Q as Tt,R as Ct,y as At,a7 as Je,am as Rt,w as It,_ as kt}from"./index-ClUcqVSE.js";import{e as Lt}from"./employerService-DV4R40RG.js";import Ot from"./AiBot-DR-lE7UN.js";import{F as Dt}from"./Footer-CNx2rue-.js";import{A as _t,a as Ft}from"./avatar-C5piOpBT.js";import{C as Pt}from"./checkbox-C_2nY1J7.js";import{R as Ht}from"./ResumeViewer-CVsJvafg.js";import{A as Ut,n as Mt,s as $t,f as Bt}from"./ExternalCandidateAnnotations-hRtzXE-u.js";import{T as at,a as lt,b as Oe,c as W,d as rt,e as T}from"./table-BAqIJJJg.js";import{A as zt}from"./arrow-up-down-C-bzA5NH.js";import{A as Vt}from"./arrow-up-CYi8_ym4.js";import{A as Wt}from"./arrow-down-D150keAG.js";import{G as Gt}from"./graduation-cap-BUd3Q7-Q.js";import{T as Jt}from"./tag-D5lkgBjS.js";import{B as Ye}from"./building-DqGqBA3K.js";import"./use-mobile-MNYKcll8.js";import"./minimize-2-Df6wOKO6.js";import"./maximize-2-CyYfCtdz.js";import"./ContactModal-XzY7sjeh.js";import"./candidateService-Cdjt4NMB.js";import"./screenerService-B96OTGu1.js";import"./square-pen-CHL1hk0e.js";import"./trash-2-BZ0MIRVP.js";import"./index-BcE3VY2B.js";import"./chevron-left-BuRQBTTN.js";import"./pencil-Cwxls-i2.js";import"./plus-CWrVi9FA.js";const Ke=[{value:"all",label:"All"},{value:"SHORTLIST",label:"Shortlisted"},{value:"PRESCREENED",label:"Prescreened"},{value:"REJECT",label:"Rejected"}],ce=(t,...l)=>{for(const o of l){const p=t[o];if(p!=null&&p!=="")return p}},b=(t,...l)=>String(ce(t,...l)??""),qe=t=>{let l=t;if(typeof l=="string")try{l=JSON.parse(l)}catch{return[]}return Array.isArray(l)?l.filter(o=>!!o&&typeof o=="object"&&!Array.isArray(o)):l&&typeof l=="object"&&!Array.isArray(l)?[l]:[]},Yt=t=>Array.isArray(t)?t.map(l=>typeof l=="string"?l:String((l==null?void 0:l.name)??"")).filter(Boolean):typeof t=="string"?t.split(/[,;|]+/).map(l=>l.trim()).filter(Boolean):[],Kt=t=>[b(t,"startDate","start_date","startYear"),t.current===!0||t.isCurrent===!0?"Present":b(t,"endDate","end_date","endYear")].filter(Boolean).join(" – "),Ze=(t,l)=>({title:b(t,...l==="work"?["title","jobTitle","position","role"]:["degree","degreeName","title"])||"—",organization:b(t,...l==="work"?["company","companyName","organization","employer"]:["institutionName","school","schoolName","university"]),period:Kt(t),location:b(t,"location","city"),extra:l==="work"?ce(t,"durationMonths","duration_months")!=null?`${ce(t,"durationMonths","duration_months")} months`:"":b(t,"fieldOfStudy","field_of_study","major")}),Fe=(t,l)=>{const o=ce(t,"experienceYears","experience_years","yearsOfExperience","experience");return{id:b(t,"id")||String(l),profileId:b(t,"profileId","profile_id")||b(t,"id")||String(l),name:b(t,"candidateName","name","fullName")||[b(t,"firstName","first_name"),b(t,"lastName","last_name")].filter(Boolean).join(" ")||"Unknown",title:b(t,"currentJobTitle","jobTitle","title")||"—",location:b(t,"location","city")||"—",country:b(t,"country"),industry:b(t,"industry"),experience:o==null?"—":/^\d+(\.\d+)?$/.test(String(o))?`${o} yrs`:String(o),skills:Yt(ce(t,"skills","skillSet","skillList")),work:qe(ce(t,"workExperience","workDetails","work_details")).map(p=>Ze(p,"work")),education:qe(ce(t,"educationDetails","education","educationHistory")).map(p=>Ze(p,"education")),status:b(t,"status","candidateStatus","candidate_status").toUpperCase(),linkedIn:b(t,"linkedinUrl","linkedin_url","profileUrl"),email:b(t,"personalEmail","businessEmail","email"),phone:b(t,"phoneNumber","phone","mobileNumber"),favourite:t.favourites===!0||t.favourite===!0,rag:Mt(t.ragStatus),notes:$t(t.notes),raw:t}},qt=t=>{const l=t,o=Array.isArray(t)?t:(l==null?void 0:l.content)??(l==null?void 0:l.candidates)??(l==null?void 0:l.data);return Array.isArray(o)?o:[]},Qe=({items:t,kind:l,name:o})=>{const[p,O]=r.useState(!1);if(!t.length)return e.jsx("span",{className:"text-muted-foreground",children:"—"});const U=l==="work"?Ee:Gt;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"max-w-[200px] text-sm",children:[e.jsx("div",{className:"truncate font-medium",title:t[0].title,children:t[0].title}),e.jsx("div",{className:"truncate text-xs text-muted-foreground",title:t[0].organization,children:t[0].organization}),t[0].period&&e.jsx("div",{className:"text-xs text-muted-foreground",children:t[0].period}),e.jsx(H,{variant:"link",size:"sm",className:"h-auto p-0 text-xs",onClick:()=>O(!0),children:t.length>1?`+${t.length-1} more`:"View details"})]}),e.jsx(Re,{open:p,onOpenChange:O,children:e.jsxs(Ie,{className:"w-[calc(100vw-2rem)] max-w-3xl",children:[e.jsx(ke,{children:e.jsxs(Le,{className:"flex items-center gap-2",children:[e.jsx(U,{className:"h-4 w-4"}),l==="work"?"Work Details":"Education Details"," — ",o]})}),e.jsx("div",{className:"max-h-[60vh] overflow-auto",children:e.jsxs(at,{children:[e.jsx(lt,{children:e.jsxs(Oe,{children:[e.jsx(W,{children:l==="work"?"Job Title":"Degree"}),e.jsx(W,{children:l==="work"?"Company":"School"}),e.jsx(W,{children:"Period"}),e.jsx(W,{children:"Location"}),e.jsx(W,{children:l==="work"?"Duration":"Field of study"})]})}),e.jsx(rt,{children:t.map((I,w)=>e.jsxs(Oe,{children:[e.jsx(T,{className:"font-medium",children:I.title}),e.jsx(T,{children:I.organization||"—"}),e.jsx(T,{className:"whitespace-nowrap",children:I.period||"—"}),e.jsx(T,{children:I.location||"—"}),e.jsx(T,{children:I.extra||"—"})]},w))})]})})]})})]})},le=({label:t,sortKey:l,sort:o,onSort:p,className:O})=>{const U=(o==null?void 0:o.key)===l,I=U?(o==null?void 0:o.dir)==="asc"?Vt:Wt:zt;return e.jsx(W,{className:O,children:e.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 whitespace-nowrap text-left font-medium hover:text-foreground",onClick:()=>p(l),children:[t,e.jsx(I,{className:`h-3 w-3 shrink-0 ${U?"text-primary":"text-muted-foreground
1/60"}`})]})})},Zt=t=>{const l=/([\d.]+)\s*yr/i.exec(t.experience||"");return l?parseFloat(l[1]):null},Xe=(t,l)=>{var o,p;switch(l){case"id":{const O=Number(t.id);return Number.isFinite(O)&&String(t.id).trim()!==""?O:String(t.id)}case"name":return(t.name||"").toLowerCase();case"title":return t.title&&t.title!=="—"?t.title.toLowerCase():"";case"location":return t.location&&t.location!=="—"?t.location.toLowerCase():"";case"experience":return Zt(t);case"work":return(o=t.work[0])!=null&&o.title&&t.work[0].title!=="—"?t.work[0].title.toLowerCase():"";case"education":return(p=t.education[0])!=null&&p.title&&t.education[0].title!=="—"?t.education[0].title.toLowerCase():"";default:return null}};function Qt(){const[t,l]=r.useState([]),[o,p]=r.useState(0),[O,U]=r.useState(0),[I,w]=r.useState(!1),[X,D]=r.useState(!0),[q,B]=r.useState(!1),[Z,y]=r.useState(""),[G,J]=r.useState(!1),[Y,xe]=r.useState(""),[ue,_]=r.useState({}),[z,M]=r.useState("all"),[se,ae]=r.useState({}),[F,he]=r.useState("all"),[C,fe]=r.useState("all"),[x,n]=r.useState(null),{toast:u}=et(),N=s=>n(i=>(i==null?void 0:i.key)===s?i.dir==="asc"?{key:s,dir:"desc"}:null:{key:s,dir:"asc"}),h=r.useCallback(async s=>{var i,f,v,j,A;s===0?D(!0):B(!0),y("");try{const R={page:s,size:100};z!=="all"&&(R.status=z),F!=="all"&&(R.favourites=F),C!=="all"&&(R.ragStatus=C);const Q=await de.get("/api/external-candidates",{params:R}),je=qt(Q.data).map(Fe),Ce=Number(((i=Q.data)==null?void 0:i.totalElements)??((f=Q.data)==null?void 0:f.total)??je.length);l(ge=>s===0?je:[...ge,...je.filter(De=>!ge.some(be=>be.id===De.id))]),p(Ce),U(s),w(typeof((v=Q.data)==null?void 0:v.totalPages)=="number"?s+1<Q.data.totalPages:typeof((j=Q.data)==null?void 0:j.totalElements)=="number"?(s+1)*100<Ce:je.length===100)}catch(R){((A=R==null?void 0:R.response)==null?void 0:A.status)===403?J(!0):y("Could not load external candidates. Please try again.")}finally{D(!1),B(!1)}},[z,F,C]),pe=(s,i)=>{const f=Fe(i,0);l(v=>v.map(j=>j.id===s.id?{...f,id:j.id,profileId:j.profileId}:j))};r.useEffect(()=>{h(0)},[h]);const[P,Se]=r.useState({}),K=r.useCallback(async()=>{const s=await Promise.all(Ke.map(async i=>{var f,v;try{const j={page:0,size:1};i.value!=="all"&&(j.status=i.value),F!=="all"&&(j.favourites=F),C!=="all"&&(j.ragStatus=C);const A=await de.get("/api/external-candidates",{params:j}),R=Number(((f=A.data)==null?void 0:f.totalElements)??((v=A.data)==null?void 0:v.total));return[i.value,Number.isFinite(R)?R:void 0]}catch{return[i.value,void 0]}}));Se(Object.fromEntries(s))},[F,C]);r.useEffect(()=>{K()},[K]);const we=tt(),ee=s=>{const i=new URLSearchParams;s.name&&s.name!=="Unknown"&&i.set("candidateName",s.name),s.email&&i.set("candidateEmail",s.email),s.phone&&i.set("candidatePhone",s.phone);const f=parseFloat(s.experience);Number.isFinite(f)&&i.set("candidateExperience",String(f)),we(`/employer/request-screening?${i.toString()}`)},Ne=async(s,i)=>{ae(f=>({...f,[s.id]:!0}));try{const f=await de.post(`/api/external-candidates/${s.profileId}/status`,{status:i}),v=f.data&&typeof f.data=="object"?Fe(f.data,0):null;l(j=>j.map(A=>A.id===s.id?v?{...v,id:A.id,profileId:A.profileId}:{...A,status:i}:A)),K(),u({title:"Status updated",description:`${s.name} marked as ${i}.`})}catch{u({title:"Could not update status",description:"Please try again.",variant:"destructive"})}finally{ae(f=>({...f,[s.id]:!1}))}},$=r.useMemo(()=>t.filter(s=>[s.name,s.title,s.location,s.country,...s.skills].join(" ").toLowerCase().includes(Y.trim().toLowerCase())),[t,Y]),Te=r.useMemo(()=>{if(!x)return $;const s=x.dir==="asc"?1:-1;return[...$].sort((i,f)=>{const v=Xe(i,x.key),j=Xe(f,x.key),A=v===null||v==="",R=j===null||j==="";return A&&R?0:A?1:R?-1:typeof v=="number"&&typeof j=="number"?(v-j)*s:String(v).localeCompare(String(j))*s})},[$,x]);return G?e.jsx("p",{className:"py-12 text-center text-sm text-muted-foreground",children:"External candidates are not available for this account."}):e.jsxs("div",{className:"space-y-4 min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold",children:"Exter
1nal Candidates"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[t.length," of ",o," loaded"]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("div",{className:"relative",children:[e.jsx(st,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(ve,{"aria-label":"Search external candidates",placeholder:"Search name, title, skills",value:Y,onChange:s=>xe(s.target.value),className:"pl-9 w-56 max-w-full"})]}),e.jsxs(re,{value:F,onValueChange:s=>he(s),children:[e.jsx(ne,{className:"w-36","aria-label":"Filter by favourites",children:e.jsx(ie,{placeholder:"Favourites"})}),e.jsxs(oe,{children:[e.jsx(S,{value:"all",children:"All Favourites"}),e.jsx(S,{value:"true",children:"Favourites only"}),e.jsx(S,{value:"false",children:"Not favourited"})]})]}),e.jsxs(re,{value:C,onValueChange:s=>fe(s),children:[e.jsx(ne,{className:"w-36","aria-label":"Filter by RAG status",children:e.jsx(ie,{placeholder:"RAG"})}),e.jsxs(oe,{children:[e.jsx(S,{value:"all",children:"All RAG"}),e.jsx(S,{value:"red",children:"Red"}),e.jsx(S,{value:"amber",children:"Amber"}),e.jsx(S,{value:"green",children:"Green"})]})]}),e.jsx(H,{variant:"outline",size:"icon",title:"Refresh","aria-label":"Refresh external candidates",onClick:()=>{h(0),K()},disabled:X,children:e.jsx(ht,{className:"h-4 w-4"})})]})]}),e.jsx("div",{role:"tablist","aria-label":"Filter by status",className:"flex flex-wrap gap-2",children:Ke.map(s=>{const i=z===s.value,f=P[s.value];return e.jsxs("button",{type:"button",role:"tab","aria-selected":i,onClick:()=>M(s.value),className:`rounded-lg border px-4 py-2 text-sm font-medium transition-colors ${i?"border-primary bg-primary text-primary-foreground shadow-sm":"border-border bg-card text-foreground hover:bg-muted"}`,children:[s.label,f!=null?` (${f})`:""]},s.value)})}),X?e.jsxs("div",{className:"flex justify-center py-14 text-muted-foreground",children:[e.jsx(me,{className:"mr-2 h-5 w-5 animate-spin"}),"Loading candidates…"]}):Z?e.jsxs("div",{className:"py-12 text-center text-sm text-destructive",children:[Z," ",e.jsx(H,{variant:"link",onClick:()=>h(0),children:"Retry"})]}):$.length===0?e.jsx("p",{className:"py-12 text-center text-sm text-muted-foreground",children:Y?"No candidates match your search.":"No external candidates found."}):e.jsx("div",{className:"overflow-x-auto rounded-md border bg-card",children:e.jsxs(at,{children:[e.jsx(lt,{children:e.jsxs(Oe,{children:[e.jsx(le,{label:"ID",sortKey:"id",sort:x,onSort:N,className:"w-16"}),e.jsx(le,{label:"Candidate",sortKey:"name",sort:x,onSort:N,className:"min-w-[140px]"}),e.jsx(le,{label:"Current Job Title",sortKey:"title",sort:x,onSort:N,className:"min-w-[140px]"}),e.jsx(le,{label:"Location",sortKey:"location",sort:x,onSort:N,className:"min-w-32"}),e.jsx(le,{label:"Experience",sortKey:"experience",sort:x,onSort:N,className:"min-w-[100px]"}),e.jsx(le,{label:"Work Details",sortKey:"work",sort:x,onSort:N,className:"min-w-[200px]"}),e.jsx(le,{label:"Education Details",sortKey:"education",sort:x,onSort:N,className:"min-w-[200px]"}),e.jsx(W,{children:"Skills"}),e.jsx(W,{children:"Status"}),e.jsx(W,{children:"Profile"}),e.jsx(W,{children:"Contact"}),e.jsx(W,{children:"Notes / RAG / Favourite"})]})}),e.jsx(rt,{children:Te.map(s=>e.jsxs(Oe,{children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:s.id}),e.jsx(T,{className:"font-medium whitespace-nowrap",children:s.name}),e.jsxs(T,{children:[s.title,s.industry&&e.jsx("span",{className:"block text-xs text-muted-foreground",children:s.industry})]}),e.jsxs(T,{className:"min-w-32",children:[s.location,s.country&&e.jsx("span",{className:"block text-xs text-muted-foreground",children:s.country})]}),e.jsx(T,{className:"whitespace-nowrap",children:s.experience}),e.jsx(T,{children:e.jsx(Qe,{items:s.work,kind:"work",name:s.name})}),e.jsx(T,{children:e.jsx(Qe,{items:s.education,kind:"education",name:s.name})}),e.jsx(T,{className:"min-w-48",children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[(ue[s.id]?s.skills:s.skills.slice(0,4)).map(i=>e.jsx(E,{variant:"secondary",className:"max-w-40 whitespace-normal break-words",children:i},i)),s.skills.length>4&&e.jsx(H,{variant:"link",size:"sm",className:"h-auto p-0 text-xs",onClick:()=>_(i=>({...i,[s.id]:!i[s.id]})),children:ue[s.id]?"Less":`+${s.skills.length-4} more`})]})}),e.jsx(T,{className:"min-w-[140px]",children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(re,{value:s.status||void 0,onValueChange:i=>{i==="PRESCREENED"?(Ne(s,"PRESCREENED"),ee(s)):Ne(s,i)},disabled:!!se[s.id],children:[e.jsx(ne,{className:`h-8 w-32 text-xs ${s.status==="SHORTLIST"?"border-emerald-500 text-emerald-700":s.status==="PRESCREENED"?"border-blue-500 text-blue-700":s.status==="REJECT"?"border-red-500 text-red-700":""}`,"aria-label":`Status for ${s.name}`,children:e.jsx(ie,{placeholder:"Set status"})}),e.jsxs(oe,{children:[e.jsx(S,{value:"SHORTLIST",children:"Shortlist"}),e.jsx(S,{value:"PRESCREENED",children:"Request Prescreening"}),e.jsx(S,{value:"REJECT",children:"Reject"})]})]}),se[s.id]&&e.jsx(me,{className:"h-3.5 w-3.5 animate-spin text-muted-foreground"})]}),z==="SHORTLIST"&&s.status==="SHORTLIST"&&e.jsxs(H,{size:"sm",className:"h-8 w-32 gap-1 text-xs",onClick:()=>ee(s),children:[e.jsx(ft,{className:"h-3.5 w-3.5"}),"Request Prescreen"]})]})}),e.jsx(T,{children:/^https:\/\/([\w-]+\.)?linkedin\.com\//i.test(s.linkedIn)?e.jsxs("a",{href:s.linkedIn,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-primary hover:underline",children:["View ",e.jsx(Pe,{className:"h-3 w-3"})]}):"—"}),e.jsxs(T,{className:"text-xs",children:[s.email&&e.jsx("a",{className:"block break-all text-primary hover:underline",href:`mailto:${s.email}`,children:s.email}),s.phone&&e.jsx("a",{className:"block text-primary hover:underline",href:`tel:${s.phone.replace(/[^\d+]/g,"")}`,children:s.phone}),!s.email&&!s.phone&&"—"]}),e.jsx(T,{children:e.jsx(Ut,{profileId:s.profileId,raw:s.raw,onUpdated:i=>pe(s,i)})})]},s.id))})]})}),I&&!X&&!Z&&e.jsx("div",{className:"text-center",children:e.jsxs(H,{variant:"outline",disabled:q,onClick:()=>h(O+1),children:[q&&e.jsx(me,{className:"mr-2 h-4 w-4 animate-spin"}),"Load more"]})})]})}const te={CITIZEN:"U.S. Citizen",GREEN_CARD:"Green Card / Permanent Resident",EAD:"Employment Authorization Document (EAD)",STUDENT_WORK_AUTHORIZATION:"Student Work Authorization",EMPLOYMENT_VISA:"Employment Visa",NOT_AUTHORIZED_IN_US:"Not Currently Authorized in the U.S.",OTHER:"Other"},Xt={H1B:"H-1B",L1:"L-1",O1:"O-1",TN:"TN",E3:"E-3",F1_OPT:"F-1 OPT",STEM_OPT:"STEM OPT",CPT:"CPT",J1:"J-1",H4_EAD:"H-4 EAD",L2_EAD:"L-2 EAD",OTHER:"Other"},es={DIRECT_HIRE:"Direct Hire",CONTRACT:"Contract",BOTH:"Direct Hire or Contract",FULL_TIME:"Full-time",PART_TIME:"Part-time",CONTRACT_TO_HIRE:"Contract to Hire",TEMPORARY_SEASONAL:"Temporary / Seasonal",TEMPORARY:"Temporary",INTERNSHIP:"Internship",INTERN:"Intern",OTHER:"Other",OTHER_NOT_LISTED:"Other — Not Listed"},ts={APPLIED:"Applied",SHORTLISTED:"Shortlisted",PRESCREENING_REQUESTED:"Private",PRESCREENING_COMPLETED:"Prescreen Completed",CLIENT_INTERVIEW_SCHEDULED:"Client Interview",CLIENT_INTERVIEW_DONE:"Interview Done",CLIENT_SELECTED:"Selected",OFFER_ACCEPTED:"Offer Accepted",OFFER_REJECTED:"Offer Rejected",WITHDRAWN:"Withdrawn",ONHOLD:"On Hold",REJECTED:"Rejected"},Me=t=>t==="SELF"||t==="SELF_SOCIAL"?"Global":ts[t]||t,ss=[{value:"CITI
1ZEN",label:te.CITIZEN},{value:"GREEN_CARD",label:te.GREEN_CARD},{value:"EAD",label:te.EAD},{value:"STUDENT_WORK_AUTHORIZATION",label:te.STUDENT_WORK_AUTHORIZATION},{value:"EMPLOYMENT_VISA",label:te.EMPLOYMENT_VISA},{value:"NOT_AUTHORIZED_IN_US",label:te.NOT_AUTHORIZED_IN_US},{value:"OTHER",label:te.OTHER}],as=[{value:"DIRECT_HIRE",label:"Direct Hire"},{value:"CONTRACT",label:"Contract"},{value:"BOTH",label:"Direct Hire or Contract"},{value:"FULL_TIME",label:"Full-time"},{value:"PART_TIME",label:"Part-time"},{value:"CONTRACT_TO_HIRE",label:"Contract to Hire"},{value:"TEMPORARY_SEASONAL",label:"Temporary / Seasonal"},{value:"TEMPORARY",label:"Temporary"},{value:"INTERNSHIP",label:"Internship"},{value:"INTERN",label:"Intern"},{value:"OTHER",label:"Other"},{value:"OTHER_NOT_LISTED",label:"Other — Not Listed"}],ls=t=>({APPLIED:"bg-blue-100 text-blue-800",SHORTLISTED:"bg-green-100 text-green-800",PRESCREENING_REQUESTED:"bg-yellow-100 text-yellow-800",PRESCREENING_COMPLETED:"bg-teal-100 text-teal-800",CLIENT_INTERVIEW_SCHEDULED:"bg-indigo-100 text-indigo-800",CLIENT_INTERVIEW_DONE:"bg-purple-100 text-purple-800",CLIENT_SELECTED:"bg-emerald-100 text-emerald-800",OFFER_ACCEPTED:"bg-emerald-100 text-emerald-800",OFFER_REJECTED:"bg-red-100 text-red-800",REJECTED:"bg-red-100 text-red-800",WITHDRAWN:"bg-gray-100 text-gray-800",ONHOLD:"bg-orange-100 text-orange-800"})[t]||"bg-gray-100 text-gray-800",Ae=t=>t?Array.isArray(t)?t.filter(Boolean):t.split(",").map(l=>l.trim()).filter(Boolean):[],rs=28,ns=({app:t,allTags:l,workAuthDisplay:o,getCandidateName:p,getInitial:O,getAvatarColor:U,getStatusColor:I,formatDate:w,handleViewResume:X})=>{const[D,q]=r.useState(!1),[B,Z]=r.useState(!1),y=t.overallRating!=null&&t.overallRating!==""?Number(t.overallRating):null,G=y!=null&&!isNaN(y),J=!!(t.overallComments&&String(t.overallComments).trim()),Y=vt.useRef(null),[xe,ue]=r.useState(!1),[_,z]=r.useState(null),[M,se]=r.useState(null),[ae,F]=r.useState(!1),[he,C]=r.useState(!1);r.useEffect(()=>{if(!t.candidateId)return;let n=!1;return(async()=>{var u,N;try{const h=await de.get(`/api/jobApplication/candidate/${t.candidateId}`,{params:{page:0,size:1,sortBy:"appliedAt",sortDir:"desc"}});if(n)return;const pe=((u=h.data)==null?void 0:u.totalElements)??(Array.isArray((N=h.data)==null?void 0:N.content)?h.data.content.length:0);z(Number(pe)||0)}catch{n||z(0)}})(),()=>{n=!0}},[t.candidateId]);const fe=async()=>{var n,u;if(F(!0),!(M!=null||he)){C(!0);try{const N=await de.get(`/api/jobApplication/candidate/${t.candidateId}`,{params:{page:0,size:100,sortBy:"appliedAt",sortDir:"desc"}}),h=((n=N.data)==null?void 0:n.content)??N.data??[];se(Array.isArray(h)?h:[]),z(Number(((u=N.data)==null?void 0:u.totalElements)??(Array.isArray(h)?h.length:0))||0)}catch{se([])}finally{C(!1)}}};r.useEffect(()=>{const n=Y.current;n&&ue(n.scrollHeight>rs+4)},[l]);const x=p(t);return e.jsxs(He,{className:"border-none shadow-sm hover:shadow-md transition-shadow",children:[e.jsx(Ue,{className:"p-4 sm:p-5",children:e.jsxs("div",{className:"flex flex-col sm:flex-row items-start gap-4 min-w-0",children:[e.jsx(_t,{className:`${U(t.candidateId||t.jobApplicationId)} text-white w-12 h-12 flex-shrink-0`,children:e.jsx(Ft,{className:`${U(t.candidateId||t.jobApplicationId)} text-white text-lg font-semibold`,children:O(t)})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-1.5",children:[e.jsx("h3",{className:"font-semibold text-lg text-foreground break-words min-w-0",children:x}),e.jsx("span",{className:"text-muted-foreground",children:"-"}),e.jsx("span",{className:"text-muted-foreground break-words min-w-0",children:t.jobTitle}),e.jsx(E,{className:`${I(t.status)} text-xs ml-1`,children:Me(t.status)}),t.profileVisibility&&(()=>{const n=t.profileVisibility.toUpperCase()==="PUBLIC",u=n?"Global":t.profileVisibility.charAt(0).toUpperCase()+t.profileVisibility.slice(1).toLowerCase();return e.jsxs(E,{variant:"outline",className:`text-xs ${n?"bg-emerald-50 text-emerald-700 border-emerald-200":"bg-slate-50 text-slate-700 border-slate-200"}`,title:`Profile visibility: ${u}`,children:[n?e.jsx(Ve,{className:"w-3 h-3 mr-1"}):e.jsx(We,{className:"w-3 h-3 mr-1"}),u]})})(),G&&e.jsxs(E,{variant:"outline",className:"text-xs bg-amber-50 text-amber-700 border-amber-200",title:`Overall Rating: ${y}`,children:[e.jsx(Ge,{className:"w-3 h-3 mr-1 fill-amber-500 text-amber-500"}),y]}),_!=null&&_>0&&e.jsx("button",{type:"button",onClick:fe,className:"inline-flex items-center",title:"View all jobs this candidate applied to",children:e.jsxs(E,{variant:"outline",className:"text-xs bg-primary/10 text-primary border-primary/30 hover:bg-primary/20 cursor-pointer",children:[e.jsx(Ee,{className:"w-3 h-3 mr-1"}),_," applied job",_>1?"s":""]})})]}),e.jsxs("div",{className:"flex items-center gap-3 flex-wrap text-sm text-muted-foreground mb-2",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Et,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:w(t.appliedAt)})]}),o&&e.jsxs(E,{variant:"outline",className:"bg-blue-50 text-blue-700 border-blue-200 text-xs",children:[e.jsx(We,{className:"w-3 h-3 mr-1"}),o]}),t.candidateVisaType&&e.jsxs(E,{variant:"outline",className:"bg-indigo-50 text-indigo-700 border-indigo-200 text-xs",children:["Visa: ",Xt[String(t.candidateVisaType)]||String(t.candidateVisaType)]}),t.candidateVisaExpirationDate&&e.jsxs(E,{variant:"outline",className:"bg-slate-50 text-slate-700 border-slate-200 text-xs",children:["Expires: ",w(t.candidateVisaExpirationDate)]}),t.candidateRequiresSponsorship!=null&&e.jsxs(E,{variant:"outline",className:`text-xs ${t.candidateRequiresSponsorship?"bg-amber-50 text-amber-700 border-amber-200":"bg-emerald-50 text-emerald-700 border-emerald-200"}`,children:["Sponsorship: ",t.candidateRequiresSponsorship?"Yes":"No"]}),t.candidateSponsorshipTransferNeeded&&e.jsx(E,{variant:"outline",className:"bg-amber-50 text-amber-700 border-amber-200 text-xs",children:"Transfer needed"}),t.candidateCanWorkImmediately!=null&&e.jsxs(E,{variant:"outline",className:`text-xs ${t.candidateCanWorkImmediately?"bg-emerald-50 text-emerald-700 border-emerald-200":"bg-slate-50 text-slate-700 border-slate-200"}`,children:["Immediate: ",t.candidateCanWorkImmediately?"Yes":"No"]}),Array.isArray(t.candidateAuthorizedCountries)&&t.candidateAuthorizedCountries.length>0&&e.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:t.candidateAuthorizedCountries.map(n=>e.jsx(E,{variant:"outline",className:"text-xs bg-teal-50 text-teal-700 border-teal-200",children:n},n))}),(t.candidatePreferredLocation||t.candidateLocation)&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(St,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:t.candidatePreferredLocation||t.candidateLocation})]}),t.readyToRelocate===!0||t.readyToRelocate==="true"||t.readyToRelocate==="YES"||t.readyToRelocate==="yes"?e.jsx(E,{variant:"outline",className:"text-xs bg-cyan-50 text-cyan-700 border-cyan-200",children:"Open to Relocate"}):null,(t.candidateEmploymentType||t.candidateMode)&&String(t.candidateEmploymentType||t.candidateMode).trim()&&(()=>{const n=String(t.candidateEmploymentType||t.candidateMode||""),u=es[n]||n.replace(/_/g," ");return e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Ee,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:u})]})})(),t.candidateExperience&&String(t.candidateExperience).trim()!==""&&parseFloat(String(t.candidateExperience))>0&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Ee,{className:"w-3.5 h-3.5 text-orange-500"}),e.jsxs("span",{children:[t.candidateExperience," yrs"]})]}),t.candidateMobileNo&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(wt,{className:"w-3.5 h-3.5 text-green-600"}),e.jsxs("span",{children:[t.candidateCountryCode?`${t.candidateCountryCode} `:"",t.candidateMobileNo]})]})]}),l.length>0&&e.jsxs("div",{className:"mb-2",children:[e.jsx("div",{ref:Y,className:`flex items-center gap-2 flex-wrap overflow-hidden transition-all ${D?"":"max-h-[28px]"}`,children:l.map((n,u)=>e.jsxs(E,{variant:"outline",className:`text-xs ${n.type==="skill"?"bg-purple-50 text-purple-700 border-purple-200":"bg-amber-50 text-amber-700 border-amber-200"}`,children:[n.type==="skill"&&e.jsx(Jt,{className:"w-3 h-3 mr-1"}),n.label]},`${n.type}-${u}`))}),xe&&e.jsx("button",{onClick:()=>q(n=>!n),className:"text-xs text-primary hover:underline mt-1 flex items-center gap-0.5",children:D?e.jsxs(e.Fragment,{children:[e.jsx(Tt,{className:"w-3 h-3"})," Show less"]}):e.jsxs(e.Fragment,{children:[e.jsx(Ct,{className:"w-3 h-3"})," More..."]})})]}),e.jsxs("div",{className:"flex items-center gap-3 flex-wrap text-xs",children:[t.candidateEmployerName&&e.jsxs(E,{variant:"outline",className:"text-xs bg-gray-50",children:[e.jsx(Ye,{className:"w-3 h-3 mr-1"}),t.candidateEmployerName]}),t.candidateEmail&&e.jsxs("a",{href:`mailto:${t.candidateEmail}`,className:"text-primary hover:underline flex items-center gap-1 break-all min-w-0",title:"Candidate Email",children:[e.jsx(At,{className:"w-3 h-3"}),t.candidateEmail]}),t.referralEmail&&e.jsxs("a",{href:`mailto:${t.referralEmail}`,className:"text-orange-600 hover:underline flex items-center gap-1 break-all min-w-0",title:"Employer/Referral Email",children:[e.jsx(Ye,{className:"w-3 h-3"}),t.referralEmail]}),t.linkedInUrl&&e.jsxs("a",{href:t.linkedInUrl.startsWith("http")?t.linkedInUrl:`https://${t.linkedInUrl}`,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline flex items-center gap-1",title:"LinkedIn Profile",children:[e.jsx(Pe,{className:"w-3 h-3"}),"LinkedIn"]})]})]}),e.jsxs("div",{className:"w-full sm:w-auto flex-shrink-0 text-left sm:text-right flex flex-wrap sm:flex-col items-start sm:items-end gap-2",children:[t.resumeId&&e.jsxs(H,{variant:"outline",size:"sm",className:"text-xs h-7",onClick:()=>X(t.resumeId,x),children:[e.jsx(Ve,{className:"w-3 h-3 mr-1"})," Resume"]}),t.latestPrescreenResultUrl&&e.jsxs(H,{variant:"outline",size:"sm",className:"text-xs h-7",onClick:()=>window.open(t.latestPrescreenResultUrl,"_blank","noopener,noreferrer"),children:[e.jsx(Pe,{className:"w-3 h-3 mr-1"})," Prescreen Result"]}),J&&e.jsxs("button",{onClick:()=>Z(!0),className:"text-xs text-primary hover:underline flex items-center gap-1",title:"View screener overall comments",children:[e.jsx(Je,{className:"w-3 h-3"})," Screener Comments"]})]})]})}),e.jsx(Re,{open:B,onOpenChange:Z,children:e.jsxs(Ie,{className:"w-[calc(100vw-2rem)] max-w-md overflow-x-hidden",children:[e.jsx(ke,{children:e.jsxs(Le,{className:"flex items-center gap-2",children:[e.jsx(Je,{className:"w-4 h-4 text-primary"}),"Screener Comments",G&&e.jsxs(E,{variant:"outline",className:"ml-2 text-xs bg-amber-50 text-amber-700 border-amber-200",children:[e.jsx(Ge,{className:"w-3 h-3 mr-1 fill-amber-500 text-amber-500"}),y]})]})}),e.jsx("div",{className:"text-sm text-foreground whitespace-pre-wrap leading-relaxed",children:t.overallComments})]})}),e.jsx(Re,{open:ae,onOpenChange:F,children:e.jsxs(Ie,{className:"w-[calc(100vw-2rem)] max-w-2xl max-h-[85vh] overflow-y-auto overflow-x-hidden",children:[e.jsx(ke,{children:e.jsxs(Le,{className:"flex items-center gap-2",children:[e.jsx(Ee,{className:"w-4 h-4 text-primary"}),"Applied Jobs — ",x,_!=null&&e.jsxs(E,{variant:"outline",className:"ml-2 text-xs",children:[_," total"]})]})}),he&&!M?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground py-6",children:[e.jsx(me,{className:"h-4 w-4 animate-spin"})," Loading applied jobs..."]}):!M||M.length===0?e.jsx("div",{className:"text-sm text-muted-foreground py-6 text-center",children:"No job applications foun
1d."}):e.jsx("div",{className:"space-y-2 mt-2",children:M.map(n=>{var u,N;return e.jsxs("div",{className:"border rounded p-3 text-xs",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2 mb-1.5",children:[e.jsxs("div",{className:"font-semibold text-sm",children:[n.jobTitle||`Job #${n.jobId}`,e.jsxs("span",{className:"ml-2 text-[10px] font-mono text-muted-foreground",children:["JID",n.jobId]})]}),e.jsx(E,{className:`${I(n.status)} text-xs`,children:Me(n.status)})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2 text-[11px]",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Applied:"})," ",w(n.appliedAt)]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Updated:"})," ",w(n.lastUpdatedAt)]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Source:"})," ",((u=n.source)==null?void 0:u.replace(/_/g," "))||"-"]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Mode:"})," ",((N=n.candidateMode)==null?void 0:N.replace(/_/g," "))||"-"]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Employer:"})," ",Bt(n)]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Resume:"})," ",n.resumeFileName||(n.resumeId?`#${n.resumeId}`:"-")]})]})]},n.jobApplicationId)})})]})})]})},Ds=()=>{const t=tt(),{currentUser:l}=pt(),{toast:o}=et(),[p,O]=r.useState(null),[U,I]=r.useState("internal"),[w,X]=r.useState([]),[D,q]=r.useState(!0),[B,Z]=r.useState(!1),[y,G]=r.useState(0),[J,Y]=r.useState(1),[xe,ue]=r.useState(0),[_,z]=r.useState("appliedAt"),[M,se]=r.useState("desc"),ae=r.useRef(null),[F,he]=r.useState({}),[C,fe]=r.useState(""),[x,n]=r.useState(""),[u,N]=r.useState(!1),[h,pe]=r.useState(""),[P,Se]=r.useState(""),[K,we]=r.useState(""),[ee,Ne]=r.useState(""),[$,Te]=r.useState("all"),[s,i]=r.useState(!1),[f,v]=r.useState(null),[j,A]=r.useState("pdf"),[R,Q]=r.useState(!1),[je,Ce]=r.useState("");r.useEffect(()=>{de.get("/api/skills").then(a=>{const c=Array.isArray(a.data)?a.data:[],m={};
1c.forEach(d=>{d.skillId!=null&&d.skillName&&(m[String(d.skillId)]=d.skillName),d.id!=null&&d.skillName&&(m[String(d.id)]=d.skillName)}),he(m)}).catch(()=>{})},[]),r.useEffect(()=>{(async()=>{try{let c=l==null?void 0:l.id;if(!c){const k=localStorage.getItem("token");k&&(c=Rt(k))}if(!c){t("/login");return}const m=await Lt.getEmployerByUserId(c),d=(m==null?void 0:m.employerId)??(m==null?void 0:m.id);d?O(d):(q(!1),o({title:"Error",description:"Employer ID not found.",variant:"destructive"}))}catch{o({title:"Error",description:"Failed to fetch employer profile.",variant:"destructive"}),q(!1)}})()},[l,t,o]),r.useEffect(()=>{X([]),G(0),Y(1)},[p,_,M,x,P,h,u]),r.useEffect(()=>{if(!p)return;let a=!1;return(async()=>{var m,d,k,V;y===0?q(!0):Z(!0);try{const L={employerId:p,sortBy:_,sortDir:M,page:y,size:50};x.trim()&&(L.location=x.trim()),P&&P!=="all_auth"&&(L.workAuthorizationStatus=P),h&&h!=="all_types"&&(L.employmentType=h),u&&(L.readyToRelocate=!0);const ye=await It.get("/api/jobApplication/employer/talent-search",{params:L});if(a)return;const g=ye.data,Be=(g==null?void 0:g.content)||[];X(ut=>y===0?Be:[...ut,...Be]),Y((g==null?void 0:g.totalPages)||1),ue((g==null?void 0:g.totalElements)||0)}catch(L){const ye=((d=(m=L==null?void 0:L.response)==null?void 0:m.data)==null?void 0:d.message)||((V=(k=L==null?void 0:L.response)==null?void 0:k.data)==null?void 0:V.error)||"",g=/No enum constant/i.test(String(ye))?"Filter error. Please refresh the page and try again.":"Failed to fetch applications.";o({title:"Error",description:g,variant:"destructive"})}finally{a||(q(!1),Z(!1))}})(),()=>{a=!0}},[p,_,M,y,x,P,h,u,o]),r.useEffect(()=>{const a=ae.current;if(!a)return;const c=new IntersectionObserver(m=>{m[0].isIntersecting&&!D&&!B&&y<J-1&&G(k=>k+1)},{rootMargin:"300px"});return c.observe(a),()=>c.disconnect()},[D,B,y,J,w.length]);const ge=!!(C.trim()||x.trim()||u||h||P||K||ee||$&&$!=="all");r.useEffect(()=>{ge&&(D||B||y<J-1&&G(a=>a+1))},[ge,D,B,y,J]);const De=r.useMemo(()=>{const a=new Set;return w.forEach(c=>a.add(c.status==="SELF"||c.status==="SELF_SOCIAL"?"GLOBAL":c.status)),Array.from(a).sort()},[w]),be=r.useMemo(()=>w.filter(a=>{if(C.trim()){const c=C.toLowerCase().split(/\s+/),m=Ae(a.skills||a.candidateSkills),d=Ae(a.domains||a.candidateDomains),k=[a.candidateEmail,a.candidateFirstName,a.candidateLastName,a.candidateEmployerName,a.jobTitle,a.candidateEmploymentType||a.candidateMode,a.candidateWorkAuthorizationStatus,a.candidatePreferredLocation,...m,...d].filter(Boolean).join(" ").toLowerCase();if(!c.some(V=>k.includes(V)))return!1}if(x.trim()&&u){const c=x.toLowerCase(),m=(a.candidatePreferredLocation||a.preferredLocation||a.candidateLocation||"").toLowerCase(),d=a.readyToRelocate,k=d===!0||d==="true"||d==="YES"||d==="yes";if(!m.includes(c)&&!k)return!1}if(h&&h!=="all_types"&&(a.candidateEmploymentType||a.candidateMode)!==h||P&&P!=="all_auth"&&a.candidateWorkAuthorizationStatus!==P||K&&parseFloat(a.candidateExperience||"0")<parseFloat(K)||ee&&parseFloat(a.candidateExperience||"0")>parseFloat(ee))return!1;if($==="GLOBAL"){if(a.status!=="SELF"&&a.status!=="SELF_SOCIAL")return!1}else if($!=="all"&&a.status!==$)return!1;return!0}),[w,C,x,u,h,P,K,ee,$]),nt=a=>{var m;const c=[a.candidateFirstName,a.candidateLastName].filter(Boolean);return c.length>0?c.join(" "):((m=a.candidateEmail)==null?void 0:m.split("@")[0])||"Unknown"},it=a=>a.candidateFirstName?a.candidateFirstName[0].toUpperCase():a.candidateEmail?a.candidateEmail[0].toUpperCase():"?",$e=["bg-red-600","bg-blue-600","bg-green-600","bg-purple-600","bg-orange-600","bg-teal-600","bg-pink-600","bg-indigo-600"],ot=a=>$e[a%$e.length],ct=a=>
1a?te[a]||a.replace(/_/g," "):null,dt=a=>{try{return kt(new Date(a),"MMM dd, yyyy")}catch{return a}},mt=async(a,c)=>{Ce(c),Q(!0),i(!0),v(null);try{const m=await de.get(`/api/files/${a}`,{responseType:"blob"}),d=String(m.headers["content-type"]||"application/octet-stream"),k=new Blob([m.data],{type:d});let V="unknown";d.includes("pdf")?V="pdf":d.includes("wordprocessingml")||d.includes("docx")?V="docx":d.includes("msword")&&(V="doc"),v(k),A(V)}catch{o({title:"Error",description:"Failed to load resume.",variant:"destructive"}),i(!1)}finally{Q(!1)}},xt=()=>{fe(""),n(""),N(!1),pe(""),Se(""),we(""),Ne(""),Te("all")};return e.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-[#F8FAFC] to-[#EDF2F7] w-full max-w-full overflow-x-hidden flex flex-col",children:[e.jsxs("header",{className:"border-b bg-primary flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 px-3 sm:px-4 py-2 sm:h-16 sticky top-0 z-10",children:[e.jsxs("div",{className:"flex items-center gap-1 sm:gap-4 min-w-0 overflow-x-auto max-w-full",children:[e.jsxs(H,{variant:"ghost",onClick:()=>t("/employer/dashboard"),className:"text-white hover:text-white hover:bg-white/10",children:[e.jsx(jt,{size:18,className:"mr-2"})," Dashboard"]}),e.jsx("span",{className:"hidden sm:inline text-white/30",children:"|"}),e.jsx(H,{variant:"ghost",onClick:()=>t("/employer/jobs"),className:"text-white hover:text-white hover:bg-white/10",children:"Job Listings"}),e.jsx("span",{className:"hidden sm:inline text-white/30",children:"|"}),e.jsxs(H,{variant:"ghost",onClick:()=>t("/employer/applications"),className:"text-white hover:text-white hover:bg-white/10",children:[e.jsx(_e,{size:16,className:"mr-1.5"})," Applications"]})]}),e.jsxs("h1",{className:"text-lg sm:text-xl font-semibold text-white",children:[e.jsx("span",{className:"text-orange-300",children:"Talent"})," Search"]}),e.jsx("div",{className:"hidden lg:block w-40"})]}),e.jsx("main",{className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"container mx-auto px-4 py-5 sm:py-8",children:[e.jsx(gt,{value:U,onValueChange:a=>I(a),className:"mb-5",children:e.jsxs(Nt,{className:"max-w-full",children:[e.jsx(ze,{value:"internal",children:"Talent Search"}),e.jsx(ze,{value:"external",children:"External Candidates"})]})}),U==="external"?e.jsx(Qt,{}):e.jsxs("div",{className:"flex flex-col lg:flex-row gap-6 min-w-0",children:[e.jsx("div",{className:"w-full lg:w-72 flex-shrink-0",children:e.jsx(He,{className:"border-none shadow-md lg:sticky lg:top-24",children:e.jsxs(Ue,{className:"p-5 space-y-5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Filters"}),e.jsx(H,{variant:"ghost",size:"sm",className:"text-xs h-7 text-muted-foreground",onClick:xt,children:"Clear all"})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium mb-2 text-sm text-foreground",children:"Search by Keywords"}),e.jsx(ve,{placeholder:"Keywords",value:C,onChange:a=>fe(a.target.value)})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium mb-2 text-sm text-foreground",children:"Location"}),e.jsx(ve,{placeholder:"Choose location",value:x,onChange:a=>n(a.target.value),className:"mb-2"}),e.jsxs("div",{className:"flex items-start space-x-2",children:[e.jsx(Pt,{id:"relocate",checked:u,onCheckedChange:a=>N(a===!0)}),e.jsx(bt,{htmlFor:"relocate",className:"text-xs leading-tight",children:"Include candidates open to relocating to the specified location."})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium mb-2 text-sm text-foreground",children:"Employment Type"}),e.jsxs(re,{value:h,onValueChange:pe,children:[e.jsx(ne,{children:e.jsx(ie,{placeholder:"Choose Employment Type"})}),e.jsxs(oe,{children:[e.jsx(S,{value:"all_types",children:"All Employment Types"}),as.map(a=>e.jsx(S,{value:a.value,children:a.label},a.value))]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium mb-2 text-sm text-foreground",children:"Work Authorization"}),e.jsxs(re,{value:P,onValueChange:Se,children:[e.jsx(ne,{children:e.jsx(ie,{placeholder:"Choose work authorization"})}),e.jsxs(oe,{children:[e.jsx(S,{value:"all_auth",children:"All Work Authorizations"}),ss.map(a=>e.jsx(S,{value:a.value,children:a.label},a.value))]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium mb-2 text-sm text-foreground",children:"Experience (years)"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ve,{placeholder:"0",value:K,onChange:a=>we(a.target.value),className:"w-20",type:"number"}),e.jsx("span",{className:"text-muted-foreground",children:"-"}),e.jsx(ve,{placeholder:"Any",value:ee,onChange:a=>Ne(a.target.value),className:"w-20",type:"number"})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium mb-2 text-sm text-foreground",children:"Status"}),e.jsxs(re,{value:$,onValueChange:Te,children:[e.jsx(ne,{children:e.jsx(ie,{placeholder:"All Statuses"})}),e.jsxs(oe,{children:[e.jsx(S,{value:"all",children:"All Statuses"}),De.map(a=>e.jsx(S,{value:a,children:Me(a)},a))]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium mb-2 text-sm text-foreground",children:"Sort By"}),e.jsxs(re,{value:`${_}-${M}`,onValueChange:a=>{const[c,m]=a.split("-");z(c),se(m),G(0)},children:[e.jsx(ne,{children:e.jsx(ie,{})}),e.jsxs(oe,{children:[e.jsx(S,{value:"appliedAt-desc",children:"Latest First"}),e.jsx(S,{value:"appliedAt-asc",children:"Oldest First"})]})]})]}
1),e.jsxs(H,{className:"w-full",onClick:()=>G(0),children:[e.jsx(st,{className:"w-4 h-4 mr-2"})," Search"]})]})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"mb-4",children:[e.jsxs("h1",{className:"text-2xl font-bold text-foreground mb-1",children:[e.jsx("span",{className:"text-orange-500",children:"Talent"})," Search"]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Showing: ",e.jsx("span",{className:"font-semibold text-foreground",children:w.length})," ","of ",e.jsx("span",{className:"font-semibold text-foreground",children:xe})," loaded",ge&&e.jsxs(e.Fragment,{children:[" · ",e.jsx("span",{className:"font-semibold text-foreground",children:be.length})," match filters"]})]})]}),D?e.jsxs("div",{className:"flex justify-center py-20",children:[e.jsx(me,{className:"h-8 w-8 animate-spin text-primary"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:"Loading applications..."})]}):be.length===0?e.jsx(He,{className:"border-none shadow-md",children:e.jsxs(Ue,{className:"p-8 text-center text-muted-foreground",children:[e.jsx(yt,{className:"h-12 w-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{children:"No applications found matching your criteria."})]})}):e.jsx("div",{className:"space-y-3",children:be.map((a,c)=>{const d=Ae(a.skills||a.candidateSkills).map(g=>F[String(g)]||g),V=Ae(a.domains||a.candidateDomains).map(g=>F[String(g)]||g),L=[...d.map(g=>({type:"skill",label:g})),...V.map(g=>({type:"domain",label:g}))],ye=ct(a.candidateWorkAuthorizationStatus);return e.jsx(ns,{app:a,allTags:L,workAuthDisplay:ye,getCandidateName:nt,getInitial:it,getAvatarColor:ot,getStatusColor:ls,formatDate:dt,handleViewResume:mt},`${a.jobApplicationId}-${a.candidateId}-${c}`)})}),!D&&w.length>0&&y<J-1&&e.jsx("div",{ref:ae,className:"h-10"}),B&&e.jsxs("div",{className:"flex justify-center mt-4",children:[e.jsx(me,{className:"h-5 w-5 animate-spin text-primary"}),e.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading more..."})]}),!D&&!B&&w.length>0&&y>=J-1&&e.jsxs("p",{className:"text-center text-xs text-muted-foreground mt-6",children:["All ",xe," applications loaded."]})]})]})]})}),e.jsx(Dt,{}),e.jsx(Ot,{}),e.jsx(Re,{open:s,onOpenChange:i,children:e.jsxs(Ie,{className:"w-[calc(100vw-2rem)] max-w-4xl max-h-[90vh] overflow-y-auto overflow-x-hidden",children:[e.jsx(ke,{children:e.jsxs(Le,{className:"flex items-center gap-2",children:[e.jsx(_e,{className:"h-5 w-5"}),"Resume - ",je]})}),R?e.jsxs("div",{className:"flex justify-center items-center py-16",children:[e.jsx(me,{className:"h-8 w-8 animate-spin text-primary"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:"Loading resume..."})]}):f?e.jsx(Ht,{fileBlob:f,fileType:j}):e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(_e,{className:"h-12 w-12 mx-auto mb-2 opacity-30"}),e.jsx("p",{className:"text-sm",children:"Resume could not be loaded."})]})]})})]})};export{Ds 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.