1import{u as Ms,r as d,j as e,B as f,M as Xe,a7 as Di,t as _,d as Ps,a as ft,b6 as Ii,ad as we,D as vt,f as $s,F as nt,G as ys,b as at,J as Fe,N as Me,Q as be,S as Ne,T as Ce,U as Se,V as ye,W as He,b7 as Pi,o as $i,I as Fi,bj as Mi,e as Hi}from"./index-BMTnbVbk.js";import{u as Oi}from"./useBlocker-B_Ill0vx.js";import{B as jt}from"./badge-DOY4ulTc.js";import{C as Ze}from"./ConfirmDialog-Cfjwfy9i.js";import{E as Li}from"./EmptyState-M8576AyU.js";import{F as _i,a as zi}from"./FilterPanel-BaTfrwbf.js";import{a as Ui,H as es}from"./HelpTooltip-DrrCVJbx.js";import{P as Ji}from"./Pagination-DCR8SKN3.js";import{H as ks,a as Ts,b as As,c as Wi}from"./hover-card-BPmivlQ4.js";import{S as Es}from"./SectionHeader-DWWyS2-Y.js";import{f as Bi,u as wt,a as qi}from"./SidebarContext-BMWbwsz9.js";import{I as Qi}from"./input-CBFzWtye.js";import{T as lt}from"./textarea-CaM1kI-2.js";import{C as bt}from"./checkbox-Dm2Ja1Jh.js";import{S as ue}from"./skeleton-DBq0WJrg.js";import{a as Vi}from"./ats-JOhPhzJ9.js";import{D as ss,a as ts,b as is,c as Oe,h as Ki}from"./dropdown-menu-B7tD1gMR.js";import{U as Nt}from"./unified-select-DGzCmwkJ.js";import{c as Gi,e as Yi}from"./hooks-BnudKAAv.js";import{i as Ct,a as Xi,f as Zi}from"./hooks-DQNZ7-lj.js";import{a as St}from"./validation-C4Vb3GTv.js";import{S as en,R as rt,c as sn,d as tn,u as nn,e as an,f as ln,I as rn,M as dt,F as Le,A as ot,Q as ct,J as dn,C as on}from"./CandidateDetailPanel-Ba7wv25r.js";import{X as yt}from"./x-Cjrou8Y1.js";import{P as cn}from"./progress-z4VaqZUX.js";import{a as Fs,f as mn,g as hn,e as un}from"./formatUtils-CZI4-7KU.js";import{e as kt,d as Tt,f as xn,g as pn,h as gn,i as fn}from"./hooks-bA7aG2-A.js";import{D as At,b as Et,c as Rt,d as Dt}from"./dialog-Cu8ebJqc.js";import{G as vn}from"./index-4D5XvB9c.js";import{u as jn,F as wn,a as bn,t as Nn,A as Cn}from"./useFileUpload-VLsLyQxS.js";import{u as Sn}from"./api-6qo2z7ZG.js";import{g as mt,b as ht,c as ut,a as yn,A as kn}from"./candidate-activity-5OH2Lo-S.js";import{C as Tn}from"./check-ALE3Cy0K.js";import{P as An}from"./plus-SnZUmSvm.js";import{S as En}from"./settings-BxuKa1Qt.js";import{L as xt}from"./lock-BXLlH5gr.js";import{C as Rs}from"./chevron-down-gjNhGAIq.js";import{T as Ds}from"./trash-2-BunSN3wc.js";import{A as Rn}from"./arrow-up-down-gqyue3rx.js";import{S as pt}from"./sliders-horizontal-cFc5DV8q.js";import{P as Dn}from"./phone-Cq3Hq8XT.js";import{U as In}from"./users-C_WJ0DJN.js";import{S as Pn}from"./search-DGsA21hs.js";import{m as $n}from"./proxy-BFkpLG_S.js";import{C as Fn}from"./circle-alert-Cd5TN_tI.js";import{C as Mn}from"./chevron-right-CnPCCBM2.js";import"./index-CeCoLOdX.js";import"./chevron-left-BA74HP4p.js";import"./index-BIo0l1-b.js";import"./index-DvWe22Mo.js";import"./useMutation-D4IOLLPn.js";import"./api-D8kVMU_z.js";import"./label-DT9b3rR4.js";import"./select-skeWivw3.js";import"./CopyButton-8gnmcb3Q.js";import"./EmailEditor-CJLkHhX0.js";import"./index-CmwF9ElO.js";import"./quote-5KfPuQId.js";import"./switch-T7-E3axb.js";import"./refresh-cw-D9XTkwQ8.js";import"./index-CphzGYkS.js";import"./play-CQYkZYqG.js";import"./mail-CudBT8Nk.js";import"./pen-BT1m-pja.js";import"./alert-DetzT-x8.js";import"./file-text-CqGb2IiR.js";import"./send-B-senXy2.js";import"./clock-BHlFKUDi.js";import"./circle-check-ymizAp3-.js";import"./ellipsis-vertical-CPIVBgBQ.js";import"./download-C-DuBXBc.js";import"./external-link-6hZDljIS.js";import"./format-CA2G4vmO.js";import"./upload-Csv9ile6.js";import"./eye-Bwz_xY3q.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};n.SENTRY_RELEASE={id:"aabf4ad"};var u=new n.Error().stack;u&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[u]="994bb717-e16e-45ef-93ab-1245ae82cf31",n._sentryDebugIdIdentifier="sentry-dbid-994bb717-e16e-45ef-93ab-1245ae82cf31")}catch{}})();function Hn({onDismiss:n,onInviteSent:u,jobId:c}){const{canEditJobs:v,user:g}=Ms(),x=Gi(),E=Ct(c?[c]:void 0),[N,$]=d.useState([]);if(!v)return null;const W=()=>{N.length!==0&&E.mutate(N,{onSuccess:()=>{u?.(N),$([])}})};return e.jsx("div",{className:"bg-slate-100 border border-slate-300 rounded-lg p-4 mb-6",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(en,{className:"w-5 h-5 text-slate-700 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("p",{className:"text-sm text-slate-900 mb-3",children:[e.jsx("span",{className:"font-medium",children:"All done!"})," Candidates screened. Share these results with your team."]}),e.jsxs("div",{className:"flex items-center gap-2 max-w-lg",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(Nt,{options:x,value:N,onChange:F=>$(F),placeholder:`e.g. john@${g?.email?.split("@")[1]||"company.com"}`,searchPlaceholder:"Search or add emails...",mode:"multi",allowCustom:!0,customValidator:St,emptyMessage:"Enter an email address"})}),e.jsx(f,{onClick:W,size:"sm",disabled:N.length===0||E.isPending,className:"flex-shrink-0",children:E.isPending?"Sending...":`Send ${N.length>0?`${N.length} `:""}invite${N.length!==1?"s":""}`})]})]}),e.jsx("button",{onClick:n,className:"text-slate-400 hover:text-slate-600 flex-shrink-0","aria-label":"Dismiss",type:"button",children:e.jsx(yt,{className:"w-4 h-4"})})]})})}function On({creditsUsed:n,totalCandidates:u,isTrialExhausted:c=!1,onClose:v,onUpgrade:g}){const x=c&&n>=u;return e.jsxs("div",{"data-testid":"screening-progress",className:"w-full sm:w-[400px] bg-white rounded-lg border border-slate-200 shadow-lg p-4 relative",children:[!x&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between text-xs mb-2 gap-2",children:[e.jsxs("span",{className:"text-slate-600 font-medium flex items-center gap-1.5",children:[e.jsx("span",{className:"w-3 h-3 border-2 border-slate-300 border-t-slate-600 rounded-full animate-spin inline-block flex-shrink-0"}
1),"Screening candidates"]}),e.jsxs("span",{className:"font-medium whitespace-nowrap text-slate-900",children:[n," / ",u]})]}),e.jsx(cn,{value:u?Math.min(100,n/u*100):0,className:"h-2 mb-3"})]}),c&&e.jsxs("div",{className:"flex items-center rounded-md",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("p",{className:"text-xs text-slate-700",children:x?e.jsxs(e.Fragment,{children:["All ",e.jsx("span",{className:"font-semibold text-slate-900",children:n})," trial resume credits used"]}):e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"font-semibold text-slate-900",children:[u-n," candidates"]})," waiting to be screened"]})})}),g&&e.jsx(f,{onClick:()=>{g(),v()},size:"sm",className:"text-xs h-7 px-3 flex-shrink-0",children:"Upgrade now"})]})]})}function Ln({jobId:n,csrfToken:u,open:c,onOpenChange:v,onSuccess:g}){const{files:x,setFiles:E,isDragging:N,removeFile:$,handleDragOver:W,handleDragEnter:F,handleDragLeave:B,handleDrop:oe,handleInputChange:q}=jn(Xe),[o,H]=d.useState(!1);d.useEffect(()=>{c&&E([])},[c,E]);const z=async()=>{if(!(x.length===0||x.some(r=>!r.isValid))){H(!0);try{const r=new FormData;x.forEach(R=>r.append("files",R.file));const{queued:T,batchId:C}=await Sn(n,r,u);T>0&&g({queued:T,batchId:C}),T<x.length?_.warning("Some resumes skipped",{description:`${T} of ${x.length} resumes queued â CV limit reached`}):_.success("Resumes uploaded",{description:`${T} ${T===1?"resume is":"resumes are"} being screened`}),v(!1),E([])}catch(r){_.error(r instanceof Ps&&r.code==="JOB_INACTIVE"?"Screening is paused â resume this job first":r instanceof Ps&&r.code==="QUOTA_EXCEEDED"?"You've reached your resume credit limit":vn)}finally{H(!1)}}};return e.jsx(At,{open:c,onOpenChange:v,children:e.jsxs(Et,{className:"sm:max-w-[600px] max-h-[80vh] overflow-hidden flex flex-col p-0 gap-0 border-0","data-testid":"spa-resume-upload-modal",onInteractOutside:r=>r.preventDefault(),onEscapeKeyDown:r=>{o&&r.preventDefault()},hideCloseButton:!0,children:[e.jsx(Rt,{className:"px-6 pt-6 pb-4",children:e.jsx(Dt,{children:"Add resumes"})}),e.jsx("div",{className:"flex-1 overflow-auto px-6 pb-4",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(wn,{id:"resume-file-upload",isDragging:N,onDragOver:W,onDragEnter:F,onDragLeave:B,onDrop:oe,onInputChange:q,label:"Select files",hint:`Up to ${Xe} files`,disabled:x.length>=Xe,multiple:!0,inputKey:`resume-file-upload-${x.length}`}),x.length>0&&e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium text-slate-700 mb-2",children:["Selected files (",x.length,"/",Xe,")"]}),e.jsx("div",{className:"space-y-2 max-h-[240px] overflow-auto",children:x.map((r,T)=>e.jsx(bn,{file:r,onRemove:()=>$(T),truncate:C=>Nn(C,60)},T))})]})]})}),e.jsxs("div",{className:"px-6 py-4 flex justify-end gap-3 border-t border-slate-200 bg-slate-50 rounded-b-lg flex-shrink-0",children:[e.jsx(f,{variant:"outline",onClick:()=>v(!1),disabled:o,children:"Cancel"}),e.jsx(f,{onClick:z,disabled:x.length===0||o||x.some(r=>!r.isValid),"data-testid":"spa-resume-upload-submit",children:o?e.jsxs(e.Fragment,{children:[e.jsx(Di,{className:"w-4 h-4 mr-2 animate-spin"}),"Uploading..."]}
1):x.length===0?"Screen":`Screen ${x.length} ${x.length===1?"resume":"resumes"}`})]})]})})}function _n({jobId:n,currentTeam:u,onOpenChange:c}){const[v,g]=d.useState(!0);d.useEffect(()=>{if(v)return;const r=setTimeout(()=>c(!1),200);return()=>clearTimeout(r)},[v,c]);const x=ft(),{user:E}=Ms(),{data:N}=Xi(),{data:$=[]}=Yi(),W=kt(n),F=Ct([n]),[B,oe]=d.useState(()=>u.map(r=>r.id)),q=N?N.map(r=>({value:r.id,label:r.name||r.email,sublabel:r.name?r.email:void 0})):u.map(r=>({value:r.id,label:r.name})),o=new Set((N||[]).map(r=>r.email.toLowerCase())),H=$.filter(r=>!o.has(r.value.toLowerCase())&&r.value.toLowerCase()!==E?.email?.toLowerCase()),z=async()=>{if(!N){_.error("Still loading team data â try again in a moment");return}const r=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,T=B.filter(R=>r.test(R)),C=B.filter(R=>!r.test(R));try{await W.mutateAsync({team:T}),C.length>0?(await F.mutateAsync(C),x.invalidateQueries({queryKey:["job",n]})):_.success("Team updated"),g(!1)}catch{}};return e.jsx(At,{open:v,onOpenChange:g,children:e.jsxs(Et,{className:"sm:max-w-md",onInteractOutside:r=>r.preventDefault(),children:[e.jsx(Rt,{children:e.jsx(Dt,{children:"Add team members"})}),e.jsx(Nt,{mode:"multi",options:[...q,...H],value:B,onChange:r=>oe(r),placeholder:`e.g. john@${E?.email?.split("@")[1]||"company.com"}`,searchPlaceholder:"Search or add emails...",allowCustom:!0,customValidator:St,emptyMessage:"Enter an email address"}),e.jsxs("div",{className:"flex justify-end gap-3",children:[e.jsx(f,{variant:"outline",onClick:()=>g(!1),children:"Cancel"}),e.jsx(f,{onClick:z,disabled:W.isPending||F.isPending,children:W.isPending||F.isPending?"Saving...":"Save"})]})]})})}function zn({candidate:n,currentStage:u,sortBy:c,isSelected:v,requirementFilterCount:g,onSelect:x,onClick:E}){const N=g>0?e.jsxs(jt,{variant:"outline",className:"bg-slate-50 text-slate-600 border-slate-200 text-[10px] px-1.5 py-0",children:[e.jsx(Tn,{className:"w-2.5 h-2.5 mr-0.5"}),g," filter",g>1?"s":""]}):null;return e.jsx("div",{"data-testid":"spa-candidate-item","data-candidate-id":n.id,onClick:()=>E(n.id),className:`bg-white border rounded-lg p-2 sm:p-3 hover:border-slate-300 hover:shadow-sm transition-all cursor-pointer ${v?"border-slate-900":"border-slate-200"} ${u==="interview"?n.interviewStatus==="abandoned"||n.interviewStatus==="no-show"||n.interviewStatus==="withdrawn"||n.interviewStatus==="invalid-email"||n.interviewStatus==="ats-archived"||n.interviewStatus==="completed"&&n.interviewRating==="no"?"opacity-50":"":u!=="archived"&&n.resumeFit!=="strong"&&!n.screeningFailed?"opacity-50":""}`,children:e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-4",children:[e.jsx("div",{onClick:$=>$.stopPropagation(),className:"flex-shrink-0",children:e.jsx(bt,{checked:v,onCheckedChange:()=>x(n.id)})}),e.jsxs("div",{className:"flex-1 flex items-center gap-2 sm:gap-4 min-w-0",children:[e.jsxs("div",{className:"flex-1 max-w-44 sm:max-w-none sm:flex-initial sm:w-56 lg:w-80 min-w-0 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5 min-w-0",children:[e.jsx("p",{className:`font-medium truncate min-w-0 ${n.name?"":"text-slate-400 font-normal"}`,children:n.name||"Unidentified Candidate"}),e.jsx("span",{className:"hidden sm:inline",children:N}),(!n.email||n.email.trim()==="")&&e.jsx("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-warning-background text-warning border border-warning whitespace-nowrap shrink-0",children:"No email"}),n.screeningFailed&&e.jsx("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-warning-background text-warning border border-warning whitespace-nowrap shrink-0",children:"Couldn't screen"})]}),e.jsx("p",{className:"text-xs text-slate-500 truncate",children:n.company})]}),u==="shortlisted"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden md:flex items-center gap-2 flex-shrink-0 ml-auto",children:[e.jsx(rt,{rating:n.myRating??void 0,notes:n.myNotePreview??void 0}),mt(n)]}),e.jsx("div",{className:"hidden md:block h-12 w-px bg-slate-200"}),e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-3 flex-shrink-0 ml-auto md:ml-0",children:[e.jsxs("div",{className:"flex flex-col items-center justify-between h-10 sm:h-auto gap-0.5 sm:gap-1 w-10 sm:w-16",children:[e.jsx("div",{className:`text-base sm:text-xl leading-none ${ht(n.resumeFit)}`,children:n.score??"â"}),e.jsx("div",{className:"text-[10px] sm:text-xs text-slate-500",children:"Resume"})]}),e.jsx("div",{className:"h-8 sm:h-12 w-px bg-slate-200"}),e.jsxs("div",{className:"flex flex-col items-center justify-between h-10 sm:h-auto gap-0.5 sm:gap-1 w-10 sm:w-16",children:[ut(n.interviewRating??void 0)||e.jsx("div",{className:"w-10 sm:w-14 px-1.5 sm:px-3 py-1.5 sm:py-2 rounded-md bg-slate-50 text-slate-400 text-[10px] sm:text-xs leading-none flex items-center justify-center",children:"â"}),e.jsx("div",{className:"text-[10px] sm:text-xs text-slate-500",children:"Interview"})]})]}),(c==="time"||c.includes("date-"))&&e.jsx("div",{title:n._rawAppliedDate?Fs(n._rawAppliedDate):void 0,className:"hidden sm:block text-xs text-slate-500
1w-20 text-right flex-shrink-0",children:n.appliedDate})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden md:flex items-center gap-2 flex-shrink-0 ml-auto",children:[e.jsx(rt,{rating:n.myRating??void 0,notes:n.myNotePreview??void 0}),e.jsx("div",{children:n.stage==="shortlisted"?mt(n):u!=="resume"&&yn(n.interviewStatus,n.interviewDate,n.liveOnCall)})]}),e.jsx("div",{className:"hidden md:block h-12 w-px bg-slate-200"}),e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-3 flex-shrink-0 ml-auto md:ml-0",children:[e.jsxs("div",{className:"flex flex-col items-center justify-between h-10 sm:h-auto gap-0.5 sm:gap-1 w-10 sm:w-16",children:[e.jsx("div",{className:`text-base sm:text-xl leading-none ${ht(n.resumeFit)}`,children:n.score??"â"}),e.jsx("div",{className:"text-[10px] sm:text-xs text-slate-500",children:"Resume"})]}),e.jsx("div",{className:"h-8 sm:h-12 w-px bg-slate-200"}),e.jsxs("div",{className:"flex flex-col items-center justify-between h-10 sm:h-auto gap-0.5 sm:gap-1 w-10 sm:w-16",children:[ut(n.interviewRating??void 0)||e.jsx("div",{className:"w-10 sm:w-14 px-1.5 sm:px-3 py-1.5 sm:py-2 rounded-md bg-slate-50 text-slate-400 text-[10px] sm:text-xs leading-none flex items-center justify-center",children:"â"}),e.jsx("div",{className:"text-[10px] sm:text-xs text-slate-500",children:"Interview"})]})]}),(c==="time"||c.includes("date-"))&&e.jsx("div",{title:n._rawAppliedDate?Fs(n._rawAppliedDate):void 0,className:"hidden sm:block text-xs text-slate-500 w-20 text-right flex-shrink-0",children:n.appliedDate})]})]})]})})}const Un=["requirements","signals","assessments"],_e=qi($i,Un),gt={recommended:"Recommended",score:"Resume score",time:"Date applied",rating:"Interview score","shortlisted-date":"Date shortlisted","date-archived":"Date archived","date-interviewed":"Date interviewed",name:"Name"},ns=["e.g., Degree from a top-100 ranked university","e.g., Has managed a team of 5+","e.g., 5+ years of relevant industry experience","e.g., Promoted at least twice in the last 5 years","e.g., Holds at least one professional certification","e.g., Owned a key metric and improved it by 15%+","e.g., Led a project with a team of 4+","e.g., Trained or onboarded 3+ team members","e.g., Led a new initiative to a quantified result","e.g., Experience at a company with 500+ employees","e.g., Reported to senior leadership (VP or above)"],Is={resume:["recommended","score","time","name"],interview:["rating","score","date-interviewed","time","name"],shortlisted:["shortlisted-date","time","rating","score","name"],archived:["date-archived","time","score","rating","name"]};function as({name:n,company:u,variant:c="loading"}){return e.jsx("div",{className:`${c==="locked"?"bg-white":"bg-slate-50"} border border-slate-200 rounded-lg p-2 sm:p-3`,children:e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-4",children:[e.jsx(ue,{className:"h-5 w-5 rounded flex-shrink-0"}),e.jsxs("div",{className:"flex-1 flex items-center gap-2 sm:gap-4 min-w-0",children:[e.jsx("div",{className:"flex-1 max-w-44 sm:max-w-none sm:flex-initial sm:w-56 lg:w-80 min-w-0",children:n?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"font-medium truncate mb-0.5",children:n}),e.jsx("p",{className:"text-xs text-slate-500 truncate",children:u||"Â "})]}):e.jsxs(e.Fragment,{children:[e.jsx(ue,{className:"h-4 w-32 sm:w-48 mb-1.5"}),e.jsx(ue,{className:"h-3 w-24 sm:w-36"})]})}),e.jsx(ue,{className:"h-8 w-10 sm:w-16 flex-shrink-0 ml-auto"}),e.jsx("div",{className:"hidden sm:block h-12 w-px bg-slate-200 flex-shrink-0"}),e.jsx(ue,{className:"hidden sm:block h-8 w-16 flex-shrink-0"})]})]})})}function ls({label:n,items:u}){const[c,v]=d.useState(!1);return u.length?e.jsxs("div",{className:`rounded-md ${c?"bg-slate-50":""}`,children:[e.jsxs("button",{type:"button","aria-expanded":c,onClick:()=>v(!c),className:"w-full flex items-center gap-3 px-3 py-2 rounded-md transition-colors bg-slate-50 text-slate-600 hover:bg-slate-100 hover:text-slate-900",children:[e.jsx(Fn,{className:"w-4 h-4"}),e.jsx("span",{className:"text-sm flex-1 text-left",children:n}),e.jsx(Mn,{className:`w-3 h-3 transition-transform ${c?"rotate-90":""}`})]}),c&&e.jsx("div",{className:"ml-6 space-y-0.5 pb-2",children:u.map(g=>e.jsxs("div",{className:"text-xs text-slate-600 px-3 py-1.5 flex justify-between items-center gap-3",children:[e.jsx("span",{children:g.name||"Unidentified"}),g.detail&&e.jsx("span",{className:"text-slate-400",children:g.detail})]},g.id))})]}):null}const Jn={mustHaves:[],niceToHaves:[],qualitySignals:[]};function ie(n){if(n.some(c=>c.text.trim()===""))return n;const u=Math.max(...n.map(c=>c.id),0)+1;return[...n,{id:u,text:"",label:null,matchRate:null}]}function Wn({jobId:n,onCandidateClick:u,isOnboardingJob:c=!1,creditsUsed:v=0,hasUpgraded:g=!1,isTrialExhausted:x=!1,showTeamInviteBanner:E=!1,onUpgrade:N,onDismissTeamInviteBanner:$,onTeamMemberInvited:W,connectedAts:
1F=null,requestedTabSwitch:B,onInterviewInviteSent:oe}){const q=ft(),{data:o,isLoading:H}=Tt(n,!0),z=o?n:void 0,r=o?.totalCandidates??0,{csrfToken:T,canEditJobs:C,subscription:R,user:X,companies:rs}=Ms(),ke=X?.role==="admin"||X?.role==="manager",ne=Ii(R),y=sn(n),ae=tn(n),[M,ds]=d.useState(null),[os,cs]=d.useState(!1),{isScreening:Z,isRescreening:It,isLoading:Pt,progress:$t,total:Ft,stageHint:ms}=xn(z,!!M||os),{data:le,isError:Hs,error:hs}=pn(z,M?.batchId??null),Te=!!M&&(!le||le.processed<le.total),us=!!M&&!!le&&le.processed>=le.total,ze=Te||us,Ae=It||Te,Os=Te?Math.min(Math.max(0,M.total-(le?.inserted??0)),we):0,Mt=kt(n),Ee=gn(n),A=vt({from:"/_app/jobs/$jobId"}),Re=A.candidate!=null,Ht=(o?.counts?.interview?o.counts.interview>0:!1)?"interview":"resume",Ot=s=>Is[s]?.[0]||"score",m=A.tab??Ht,ce=A.sort&&Is[m]?.includes(A.sort)?A.sort:Ot(m),De=$s({from:"/jobs/$jobId"}),I=d.useCallback((s,i=!1)=>De({search:t=>({...t,...s}),replace:!0,ignoreBlocker:i}),[De]),ee=A.page,Lt=s=>I({page:typeof s=="function"?s(ee):s}),xe=d.useCallback(s=>I({tab:s,page:1}),[I]),_t=s=>I({sort:s,page:1}),Ue=A.search,[zt,Ut,Jt]=nn(Ue||"",s=>I({search:s,page:1})),Q=A.requirements,Wt=s=>I({requirements:typeof s=="function"?s(Q):s,page:1}),se=A.signals,Bt=s=>I({signals:typeof s=="function"?s(se):s,page:1}),me=A.assessments,qt=s=>I({assessments:typeof s=="function"?s(me):s,page:1}),Ls=!!(Ue||Q.length||se.length||me.length),_s=Q.length>0||se.length>0||me.length>0,Qt=rs.find(s=>s.isActive)?.id,he=Bi(`job:${n}`,Qt,X?.id),{data:Je,isFetching:zs,isLoading:Us,isPlaceholderData:Vt}=fn(z,{stage:m,sort:ce,limit:we,page:ee,search:Ue||void 0,requirements:A.requirements?.length?A.requirements.join(","):void 0,signals:A.signals?.length?A.signals.join(","):void 0,assessments:A.assessments?.length?A.assessments.join(","):void 0},Z||!!M),Js=Je?.data??[],Kt=Je?.strongRates||null,We=c&&x&&!g?Math.min(v,Je?.total??0):Je?.total??0,Ie=Math.min(Math.ceil(We/we),2e3),S=o?.requirements||Jn,[h,D]=d.useState([]),[Gt,Be]=d.useState(!1),[Yt,Ws]=d.use
1State("resume"),[K,xs]=d.useState(o?.status==="paused"),ps=o?.status;d.useEffect(()=>{ps&&xs(ps==="paused")},[ps]);const O=Js.map(s=>({...s,company:s.recentCompany||"",_rawAppliedDate:s.appliedDate||"",appliedDate:mn(s.appliedDate)})),[w,p]=d.useState(null),[k,te]=d.useState(!1),[U,re]=d.useState(S?.mustHaves||[]),[V,de]=d.useState(S?.niceToHaves||[]),[pe,Xt]=d.useState(S?.qualitySignals||[]),gs=d.useRef({mustHaves:JSON.stringify(S?.mustHaves||[]),niceToHaves:JSON.stringify(S?.niceToHaves||[])});d.useEffect(()=>{k||(re(S?.mustHaves||[]),de(S?.niceToHaves||[]),Xt(S?.qualitySignals||[]),gs.current={mustHaves:JSON.stringify(S?.mustHaves||[]),niceToHaves:JSON.stringify(S?.niceToHaves||[])})},[S,k]);const[Zt,ge]=d.useState(!1),[Bs,qe]=d.useState(null),[ei,fs]=d.useState(!1),[Pe,vs]=d.useState({open:!1,id:null,type:null}),[si,qs]=d.useState(!1),[ti,js]=d.useState(!1),[G,fe]=d.useState(!1),{requestCollapse:Qs}=wt(),[Vs,Qe]=d.useState(!1);d.useEffect(()=>{if(c&&!g&&!G&&!Re){const s=setTimeout(()=>{Qe(!0)},2e3);return()=>clearTimeout(s)}else Qe(!1)},[c,g,G,Re]),d.useEffect(()=>{B&&xe(B)},[B,xe]);const ii=()=>Be(!0),Ve=s=>{Ws(s),Be(!0)},ve=d.useCallback(()=>JSON.stringify(U.filter(s=>s.text.trim()!==""))!==gs.current.mustHaves||JSON.stringify(V.filter(s=>s.text.trim()!==""))!==gs.current.niceToHaves,[U,V]),ws=()=>{if(k&&ve()){fs(!0),ge(!0);return}fe(!1),te(!1)};d.useEffect(()=>{Qs(G||Re)},[G,Re,Qs]);const bs=Oi({shouldBlockFn:()=>k&&ve(),enableBeforeUnload:k&&ve(),withResolver:!0});d.useEffect(()=>{if(us&&!Z){const s=setTimeout(()=>ds(null),2e3);return()=>clearTimeout(s)}},[us,Z]),d.useEffect(()=>{!M||!Hs||(ds(null),hs instanceof Ps&&hs.code==="NOT_FOUND"||cs(!0))},[M,Hs,hs]),d.useEffect(()=>{if(os){const s=setTimeout(()=>cs(!1),6e4);return()=>clearTimeout(s)}},[os]);const Ks=d.useRef(!1);d.useEffect(()=>{if(Ks.current)return;Ks.current=!0;const s=nt(he);s&&De({search:i=>_e.isSetInUrl(i)?i:{...i,..._e.hydrate(s),page:1},replace:!0})},[he,De]);const Gs=d.useRef(!1);d.useEffect(()=>{if(z){if(!Gs.current){Gs.current=!0;return}D([]),I({page:1,sort:void 0})}},[m,z,I]),d.useEffect(()=>{D([])},[Ue,Q,se,me,ee,ce]),d.useEffect(()=>{ee>Ie&&Ie>0&&I({page:Ie})},[ee,Ie,I]);const ni=[{id:"resume",label:"Resume",count:o?.counts?.resume??0},{id:"interview",label:"Interview",count:o?.counts?.interview??0,locked:(o?.counts?.interview??0)===0},{id:"shortlisted",label:"Shortlist",count:o?.counts?.shortlisted??0,locked:(o?.counts?.shortlisted??0)===0}],J={id:"archived",label:"Archived",count:o?.counts?.archived??0,locked:(o?.counts?.archived??0)===0},Ke=(o?.counts?.[m]??0)>0,Ge=s=>{Wt(i=>i.includes(s)?i.filter(t=>t!==s):[...i,s])},Ys=s=>{Bt(i=>i.includes(s)?i.filter(t=>t!==s):[...i,s])},ai=s=>{qt(i=>i.includes(s)?i.filter(t=>t!==s):[...i,s])},li=()=>{Fi(he,_e.pick(A)),_.success("Filters saved"),ws()},ri=()=>{ys(he),I({..._e.reset(),page:1})},Ye=s=>Kt?.[s]??null,$e=[{id:"experience",label:"Experience",rate:Ye("experience")},{id:"communication",label:"Communication",rate:Ye("communication")},{id:"motivation",label:"Culture Fit",rate:Ye("motivation")},{id:"problemSolving",label:"Problem Solving",rate:Ye("problemSolving")}].filter(s=>s.rate!==null),di=s=>{D(i=>i.includes(s)?i.filter(t=>t!==s):[...i,s])},oi=()=>{h.length===L.length&&L.every(s=>h.includes(s.id))?D([]):D(L.map(s=>s.id))},ci=()=>{D(L.map(s=>s.id))},mi=s=>{const i=L.slice(0,Math.min(s,L.length));D(i.map(t=>t.id))},hi=()=>{y.mutate({cvIds:h,action:"remove"},{onSuccess:()=>{D([]),p(null)}})},ui=()=>{const s=m==="resume"?"proceed_cv":"proceed";y.mutate({cvIds:h,action:s},{onSuccess:()=>{D([]),p(null)}})},xi=()=>{const s=h.filter(i=>{const t=Js.find(l=>l.id===i);return t?.email&&t.email.trim()!==""});s.length&&y.mutate({cvIds:s,action:"proceed_cv"},{onSuccess:()=>{D([]),p(null),oe?.()}})},pi=()=>{ae.mutate(h,{onSuccess:()=>{D([]),p(null)}})},gi=s=>{const i=s.filter(t=>t.interviewStatus==="scheduled"||t.interviewStatus==="invited"||t.interviewStatus==="to-be-scheduled").map(t=>{let l="";const a=t.interviewDate||void 0;return t.interviewStatus==="scheduled"?l=a?`Scheduled for ${Fs(a)}`:"Scheduled":(t.interviewStatus==="invited"||t.interviewStatus==="to-be-scheduled")&&(l="Invite pending"),{id:t.id,name:t.name||"Unknown",warning:l,interviewDate:a}}).sort((t,l)=>t.interviewDate&&!l.interviewDate?-1:!t.interviewDate&&l.interviewDate?1:t.warning.localeCompare(l.warning));return{warnings:i,hasWarnings:i.length>0,warningCount:i.length}},Xs=()=>{const s=O.filter(t=>h.includes(t.id)),i=gi(s);p({type:"archive",candidateCount:s.length,candidatesWithWarnings:i.warnings})},fi=()=>{y.mutate({cvIds:h,action:"restore"},{onSuccess:()=>{D([]),p(null)}})},vi=()=>{const s=h.length;p({type:"confirm",action:"restore",title:`Restore ${s} candidate${s>1?"s":""}`,description:"They go back to the Resume or Interview tab."})},ji=()=>{y.mutate({cvIds:h,action:"delete"},{onSuccess:()=>{D([]),p(null)}})},wi=()=>{const s=h.length;p({type:"confirm",action:"delete",title:`Permanently delete ${s} candidate${s>1?"s":""}`,description:`This permanently removes ${s>1?"their":"the candidate's"}
1 data from Screened. This can't be undone.`})},Zs=()=>{if(K){p({type:"interview-invite",candidateCount:0});return}const s=O.filter(a=>h.includes(a.id)&&a.stage==="resume");if(s.length===0){_.error("Select candidates from the Resume stage first");return}const i=O.filter(a=>h.includes(a.id)&&!s.some(b=>b.id===a.id)).map(a=>{let b="Not in resume stage";return a.stage==="interview"?b="Already in interview stage":a.stage==="shortlisted"?b="Already shortlisted":a.stage==="archived"&&(b="Candidate archived"),{id:a.id,name:a.name||"",reason:b}}).sort((a,b)=>a.reason.localeCompare(b.reason)),t=s.filter(a=>!a.email||a.email.trim()==="").map(a=>({id:a.id,name:a.name||""})),l=s.length-t.length;t.length>0?p({type:"missing-email",candidatesWithoutEmail:t,candidatesWithEmail:l}):p({type:"interview-invite",candidateCount:s.length,candidatesSkipped:i.length>0?i:[]})},et=s=>m==="resume"?s.stage==="resume":s.stage==="interview"&&s.interviewStatus==="completed",st=()=>{const s=O.filter(t=>h.includes(t.id)&&et(t));if(s.length===0){_.error(m==="resume"?"Select candidates from the Resume stage first":"Select candidates who have completed their interviews");return}const i=O.filter(t=>h.includes(t.id)&&!s.some(l=>l.id===t.id)).map(t=>{if(m==="resume"){let a="Not in resume stage";return t.stage==="interview"?a="Already in interview stage":t.stage==="shortlisted"?a="Already shortlisted":t.stage==="archived"&&(a="Candidate archived"),{id:t.id,name:t.name||"",reason:a}}let l="Interview not completed";return t.stage!=="interview"?l="Not in interview stage":t.interviewStatus==="scheduled"?l="Interview scheduled":t.interviewStatus==="invited"?l="Invite sent, awaiting scheduling":t.interviewStatus==="to-be-scheduled"?l="Interview not scheduled":t.interviewStatus==="no-show"?l="Candidate no-show":t.interviewStatus==="withdrawn"?l="Candidate withdrew":t.interviewStatus==="ats-archived"&&(l="Archived in ATS"),{id:t.id,name:t.name||"",reason:l}}).sort((t,l)=>t.reason.localeCompare(l.reason));p({type:"shortlist",candidateCount:s.length,candidatesSkipped:i.length>0?i:[]})},bi=()=>{const s=O.filter(i=>h.includes(i.id)&&et(i)).map(i=>i.id);y.mutate({cvIds:s,action:"proceed"},{onSuccess:()=>{D([]),p(null)}})},Ni=()=>{const s=O.filter(t=>h.includes(t.id)&&t.stage==="shortlisted");if(s.length===0){_.error("Select candidates from the Shortlist first");return}const i=s.length;p({type:"confirm",action:"advance",title:`Send ${i} candidate${i>1?"s":""} to team`,description:"Team will be notified to review and schedule."})},Ci=()=>{const s=h.length;p({type:"hired",candidateCount:s})},Si=()=>{y.mutate({cvIds:h,action:"hired"},{onSuccess:()=>{D([]),p(null)}})},yi=()=>{w?.type==="confirm"&&(w.action==="advance"?m==="shortlisted"?pi():ui():w.action==="restore"?fi():w.action==="delete"&&ji())},Ns=s=>s==="mustHave"?[U,re]:[V,de],tt=(s,i)=>{const[t,l]=Ns(s),a=t.find(b=>b.id===i);if(a&&a.text.trim()!=="")vs({open:!0,id:i,type:s});else{const b=t.filter(P=>P.id!==i);if(b.length===0)return;l(ie(b))}},ki=()=>{if(Pe.type&&Pe.id!==null){const[s,i]=Ns(Pe.type),t=s.filter(l=>l.id!==Pe.id);i(ie(t))}vs({open:!1,id:null,type:null})},Cs=(s,i,t)=>{const[l,a]=Ns(s),b=[...S.mustHaves,...S.niceToHaves].find(Y=>Y.text===t.trim())?.flag??null,P=l.map(Y=>Y.id===i?{...Y,text:t,flag:b}:Y);a(ie(P))},it=(s,i,t)=>{if(t.length>5e3){_.error("The suggested wording is too long for a requirement â shorten it as you type it in");return}Cs(s,i,t)},Ti=()=>
1{if(Ee.isPending)return;const s=U.filter(t=>t.text.trim()!=="").map(t=>t.text.trim()),i=V.filter(t=>t.text.trim()!=="").map(t=>t.text.trim());if(s.length<1||i.length<2){_.error("Add at least 1 must-have and 2 nice-to-haves to continue");return}re(U.filter(t=>t.text.trim()!=="")),de(V.filter(t=>t.text.trim()!=="")),ys(he),I({requirements:[],page:1},!0),Ee.mutate({must_haves:s,nice_to_haves:i},{onSuccess:t=>{te(!1),fe(!1),t.rescreening>0?_.success(`Rescreening ${t.rescreening} candidates`):_.success("Requirements saved")}})},Ai=()=>{ve()?ge(!0):(re(S?.mustHaves||[]),de(S?.niceToHaves||[]),te(!1))},Ei=()=>{re(S?.mustHaves||[]),de(S?.niceToHaves||[]),te(!1),ge(!1),Bs&&(xe(Bs),qe(null)),ei&&(fe(!1),fs(!1)),bs.proceed?.()},Ri=(x||Z||ze)&&!G;let L=O;if(c&&!g&&x){const s=v-(ee-1)*we;L=s>0?O.slice(0,s):[]}return e.jsxs("main",{className:"flex flex-1 h-full","data-testid":"spa-job-detail",children:[e.jsxs("div",{className:"flex flex-col flex-1 min-h-0 min-w-0",children:[e.jsxs("div",{className:"sticky top-0 z-20 bg-slate-50",children:[e.jsxs("div",{className:"px-4 sm:px-8 pt-4 pb-3 sm:pt-6 sm:pb-4 relative",children:[K&&e.jsx("div",{className:"absolute inset-0 opacity-[0.07] pointer-events-none z-0",style:{backgroundImage:"repeating-linear-gradient(45deg, #64748b 0, #64748b 1px, transparent 0, transparent 50%)",backgroundSize:"10px 10px"}}),e.jsx("div",{className:"max-w-5xl relative z-10",children:e.jsxs("div",{className:"flex items-start sm:items-center justify-between gap-3 sm:gap-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-1 sm:gap-2 flex-1 min-w-0 overflow-hidden",children:[H?e.jsxs(e.Fragment,{children:[e.jsx(ue,{className:"h-6 w-48"}),e.jsx(ue,{className:"hidden sm:block h-4 w-24"})]}):e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"text-lg font-semibold truncate min-w-0",children:o?.title||"Untitled Job"}),(o?.reqCode||o?.location||o?.department)&&(()=>{const s=o?.location?.split("; ").filter(Boolean)||[];return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"hidden sm:inline text-slate-400 flex-shrink-0",children:"·"}),e.jsxs("span",{className:"text-xs sm:text-sm text-slate-600 flex items-center gap-1 min-w-0",children:[o?.reqCode&&e.jsx("span",{className:"shrink-0",children:o.reqCode}),o?.reqCode&&s.length>0&&e.jsx("span",{className:"text-slate-400",children:"·"}),s.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"truncate min-w-0",children:s[0]}),s.length>1&&e.jsx(Ui,{className:"w-56",ariaLabel:"Locations",trigger:e.jsxs("button",{type:"button",className:"border-b border-dashed border-slate-300 cursor-help shrink-0",children:["+",s.length-1]}),children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-slate-900",children:"Locations"}),s.map((i,t)=>e.jsxs("div",{className:"text-sm text-slate-700",children:["⢠",i]},t))]})})]}),(o?.reqCode||s.length>0)&&o?.department&&e.jsx("span",{className:"text-slate-400",children:"·"}),o?.department&&e.jsx("span",{className:"truncate min-w-0",children:o.department})]})]})})()]}),K&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"hidden md:inline text-slate-400 flex-shrink-0",children:"·"}),e.jsxs("div",{className:"hidden xl:inline-flex items-center gap-2 text-sm bg-slate-100 border border-slate-200 rounded-lg px-3 py-2 whitespace-nowrap",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-slate-400"}),e.jsx("span",{className:"text-slate-600",children:"Screening paused"}),C&&e.jsx(f,{size:"sm",className:"text-xs h-7 ml-1",onClick:()=>{Be(!0),Ws("resume")},children:"Update"})]}),e.jsxs("div",{className:"hidden md:inline-flex xl:hidden items-center gap-2 text-sm bg-slate-100 border border-slate-200 rounded-lg px-3 py-2 whitespace-nowrap",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-slate-400"}),e.jsx("span",{className:"text-slate-600",children:"Screening paused"})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 flex-shrink-0",children:[o&&(C||o.team?.length>0)&&e.jsxs("div",{className:`items-center -space-x-2 ${G?"hidden xl:flex":"hidden lg:flex"}`,children:[o?.team?.map((s,i)=>e.jsxs("div",{className:"w-8 h-8 rounded-full bg-slate-200 border-2 border-slate-50 flex items-center justify-center text-xs text-slate-700 relative group cursor-default",children:[hn(s.name),e.jsx("div",{className:"absolute top-full mt-2 hidden group-hover:block pointer-events-none z-50",children:e.jsx("div",{className:"bg-slate-900 text-white text-xs px-2 py-1 rounded whitespace-nowrap",children:s.name})})]},`${n}-member-${i}-${s.name}`)),C&&e.jsxs("button",{onClick:()=>qs(!0),className:"w-8 h-8 rounded-full bg-white border border-dashed border-slate-300 hover:border-slate-400 flex items-center justify-center text-slate-400 hover:text-slate-600 transition-colors relative group","aria-label":"Add team",children:[e.jsx(An,{className:"w-3.5 h-3.5"}),e.jsx("div",{className:"absolute top-full mt-2 hidden group-hover:block pointer-events-none z-50",children:e.jsx("div",{className:"bg-slate-900 text-white text-xs px-2 py-1 rounded whitespace-nowrap",children:"Add team"})})]})]}),e.jsx(f,{variant:"outline",size:"sm",onClick:()=>js(!0),disabled:K,className:"hidden sm:flex","data-testid":"spa-add-resumes-btn",children:"Add resumes"}),C&&e.jsxs(f,{variant:"outline",size:"sm",onClick:ii,className:"gap-1.5 sm:gap-2","data-testid":"spa-job-settings-btn",children:[e.jsx(En,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Settings"})]})]})]})})]}),e.jsxs("div",{className:`border-b-2 border-slate-200 px-4 py-2 sm:py-3 sm:px-8 relative ${K?"":"bg-slate-50"}`,children:[K&&e.jsx("div",{className:"absolute inset-0 opacity-[0.07] pointer-events-none z-0",style:{backgroundImage:"repeating-linear-gradient(45deg, #64748b 0, #64748b 1px, transparent 0, transparent 50%)",backgroundSize:"10px 10px"}}),e.jsx("div",{className:"max-w-5xl relative z-10",children:e.jsxs("div",{role:"tablist",className:"flex flex-wrap items-center justify-between gap-1.5 sm:gap-2",children:[e.jsx("div",{className:"flex items-center gap-1 sm:gap-2",children:ni.map((s,i)=>{const t=s.locked||!1,l=m===s.id;return e.jsxs("div",{className:"flex items-center gap-1 sm:gap-2",children:[i>0&&e.jsx("svg",{className:"w-3 h-3 sm:w-4 sm:h-4 text-slate-300",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),e.jsxs(ks,{openDelay:200,children:[e.jsx(Ts,{asChild:!0,children:e.jsxs("button",{role:"tab","aria-selected":l,onClick:()=>
1{if(!t){if(k&&ve()){qe(s.id),ge(!0);return}k&&te(!1),xe(s.id)}},disabled:t,"data-testid":`spa-tab-${s.id}`,className:`flex items-center gap-1.5 sm:gap-2 px-2 sm:px-3 py-1 sm:py-1.5 rounded-md text-xs sm:text-sm font-medium transition-all ${l?s.id==="shortlisted"?"bg-success text-white hover:bg-success-hover":"bg-slate-900 text-white hover:bg-slate-800":t?"text-slate-400 cursor-not-allowed":"text-slate-500 hover:bg-accent"}`,children:[t&&e.jsx(xt,{className:"w-3 h-3"}),s.label,!t&&!H&&e.jsx("span",{className:`text-[10px] sm:text-xs ${l?s.id==="shortlisted"?"bg-success/80 text-white px-1 sm:px-1.5 py-0.5 rounded":"bg-slate-700 text-white px-1 sm:px-1.5 py-0.5 rounded":"text-slate-400"}`,children:s.count})]})}),t&&e.jsx(As,{className:"w-56",align:"start",children:e.jsx("p",{className:"text-sm",children:s.id==="interview"?"Advance candidates from Resume to unlock AI phone interviews":"Advance candidates from Interview to unlock"})})]})]},s.id)})}),e.jsx("div",{className:"flex items-center gap-1.5 sm:gap-2",children:e.jsxs(ks,{openDelay:200,children:[e.jsx(Ts,{asChild:!0,children:e.jsxs("button",{role:"tab","aria-selected":m===J.id,onClick:()=>{if(!J.locked){if(k&&ve()){qe(J.id),ge(!0);return}k&&te(!1),xe(J.id)}},"data-testid":"spa-tab-archived",className:`flex items-center gap-1.5 sm:gap-2 px-2 sm:px-3 py-1 sm:py-1.5 rounded-md text-xs sm:text-sm font-medium transition-all ${m===J.id?"bg-slate-900 text-white hover:bg-slate-800":J.locked?"text-slate-300 cursor-not-allowed":"text-slate-400 hover:bg-accent"}`,children:[J.locked&&e.jsx(xt,{className:"w-3 h-3"}),J.label,!J.locked&&e.jsx("span",{className:`text-[10px] sm:text-xs ${m===J.id?"bg-slate-700 text-white px-1 sm:px-1.5 py-0.5 rounded":"text-slate-300"}`,children:J.count})]})}),J.locked&&e.jsx(As,{className:"w-56",align:"start",children:e.jsx("p",{className:"text-sm",children:"Archive candidates to view them here"})})]})})]})})]}),e.jsx("div",{className:"bg-white px-4 py-2 sm:py-3",children:e.jsx("div",{className:"max-w-5xl",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[O.length>0&&e.jsxs("div",{className:"flex items-center gap-2 pl-3",children:[e.jsx(bt,{checked:h.length>0&&L.every(s=>h.includes(s.id)),onCheckedChange:oi}),h.length>0?e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("span",{className:"text-xs text-slate-500",children:[h.length," selected"]}),e.jsx("button",{onClick:()=>D([]),className:"p-0.5 hover:bg-slate-100 rounded transition-colors",title:"Clear selection","aria-label":"Clear selection",children:e.jsx(yt,{className:"w-3 h-3 text-slate-400"})})]}):e.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[e.jsx("button",{onClick:ci,className:"text-slate-900 px-1.5 py-0.5 rounded hover:underline hover:bg-slate-100 transition-colors",children:"All"}),e.jsx("span",{className:"text-slate-400",children:"|"}),e.jsxs("button",{onClick:()=>mi(m==="interview"||m==="shortlisted"?5:10),className:"text-slate-900 px-1.5 py-0.5 rounded hover:underline hover:bg-slate-100 transition-colors",children:["Top ",m==="interview"||m==="shortlisted"?5:10]})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:m==="archived"?e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsxs(f,{size:"sm",onClick:vi,disabled:h.length===0,className:h.length===0?`text-slate-400 border border-slate-200 bg-transparent hover:bg-transparent cursor-default ${ke?"rounded-r-none":""} text-xs sm:text-sm`:`${ke?"rounded-r-none":""} text-xs sm:text-sm`,children:[e.jsx(an,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Restore"})]}),ke&&e.jsxs(ss,{children:[e.jsx(ts,{asChild:!0,children:e.jsx(f,{size:"sm",disabled:h.length===0,className:h.length===0?"text-slate-400 border border-slate-200 bg-transparent hover:bg-transparent cursor-default rounded-l-none px-2":"rounded-l-none px-2 border-l border-slate-700","aria-label":"More actions",children:e.jsx(Rs,{className:"w-3 h-3"})})}),e.jsx(is,{align:"end",className:"min-w-[180px]",children:e.jsxs(Oe,{variant:"destructive",onClick:wi,children:[e.jsx(Ds,{className:"mr-2 h-4 w-4"}),"Delete"]})})]})]}):m==="shortlisted"?e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsxs(f,{size:"sm",onClick:Ni,disabled:h.length===0,className:h.length===0?"text-slate-400 border border-slate-200 bg-transparent hover:bg-transparent cursor-default rounded-r-none text-xs sm:text-sm":"rounded-r-none text-xs sm:text-sm",children:[e.jsx("span",{className:"hidden min-[1100px]:inline",children:"Share with Team"}),e.jsx("span",{className:"min-[1100px]:hidden",children:"Share"})]}),e.jsxs(ss,{children:[e.jsx(ts,{asChild:!0,children:e.jsx(f,{size:"sm",disabled:h.length===0,className:h.length===0?"text-slate-400 border border-slate-200 bg-transparent hover:bg-transparent cursor-default rounded-l-none px-2":"rounded-l-none px-2 border-l border-slate-700","aria-label":"More actions",children:e.jsx(Rs,{className:"w-3 h-3"})})}),e.jsxs(is,{align:"end",className:"min-w-[180px]",children:[e.jsx(Oe,{onClick:Ci,children:"Mark hired"}),e.jsx(Oe,{onClick:Xs,children:"Archive"})]})]})]}):e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx(f,{size:"sm",onClick:m==="resume"&&!ne?Zs:st,disabled:h.length===0,className:h.length===0?"text-slate-400 border border-slate-200 bg-transparent hover:bg-transparent cursor-default rounded-r-none text-xs sm:text-sm":"rounded-r-none text-xs sm:text-sm",children:m==="resume"&&!ne?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"hidden min-[1100px]:inline",children:"Send Interview Invite"}),e.jsx("span",{className:"min-[1100px]:hidden",children:"Invite"})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"hidden min-[1100px]:inline",children:"Move to Shortlist"}),e.jsx("span",{className:"min-[1100px]:hidden",children:"Shortlist"})]})}),e.jsxs(ss,{children:[e.jsx(ts,{asChild:!0,children:e.jsx(f,{size:"sm",disabled:h.length===0,className:h.length===0?"text-slate-400 border border-slate-200 bg-transparent hover:bg-transparent cursor-default rounded-l-none px-2":"rounded-l-none px-2 border-l border-slate-700","aria-label":"More actions",children:e.jsx(Rs,{className:"w-3 h-3"})})}),e.jsxs(is,{align:"end",className:"min-w-[180px]",children:[m==="resume"&&e.jsx(Oe,{onClick:ne?Zs:st,children:ne?"Send Interview Invite":"Move to Shortlist"}),e.jsx(Oe,{onClick:Xs,children:"Archive"})]})]})]})})]}),e.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-shrink",children:[e.jsx(Qi,{type:"text",placeholder:"Search",value:zt,onCh
1ange:s=>Ut(s.target.value),onKeyDown:s=>s.key==="Enter"&&Jt(),disabled:!Ke,className:"hidden lg:block w-full min-w-[120px] max-w-[256px] h-8 text-xs"}),e.jsxs(ss,{children:[e.jsx(ts,{asChild:!0,children:e.jsxs(f,{variant:"outline",size:"sm",disabled:!Ke,className:"h-8 text-xs px-2 sm:px-3",children:[e.jsx(Rn,{className:"w-3 h-3 sm:mr-1.5"}),e.jsx("span",{className:"hidden sm:inline",children:gt[ce]||ce})]})}),e.jsx(is,{align:"end",children:Is[m]?.map(s=>e.jsx(Ki,{checked:ce===s,onCheckedChange:()=>_t(s),children:gt[s]},s))})]}),e.jsxs(ks,{open:!G&&!Re&&Vs?!0:void 0,openDelay:300,onOpenChange:s=>{!s&&Vs&&Qe(!1)},children:[e.jsx(Ts,{asChild:!0,children:e.jsxs(f,{size:"sm",variant:"outline",onClick:()=>{if(Qe(!1),G){ws();return}fe(!0)},className:`h-8 text-xs px-2 sm:px-3 ${G?"bg-slate-100 text-slate-900 hover:bg-slate-200":Ke?"animate-borderGlow":""}`,children:[e.jsx(pt,{className:"w-3.5 h-3.5 sm:mr-1.5"}),e.jsx("span",{className:"hidden sm:inline",children:m==="resume"?"Requirements":"Filters"}),(Q.length>0||se.length>0||me.length>0)&&e.jsx(jt,{variant:"secondary",className:"ml-1.5 h-4 min-w-[16px] px-1 text-[10px] bg-slate-900 text-white hover:bg-slate-900",children:Q.length+se.length+me.length})]})}),e.jsxs(As,{className:"bg-blue-600 text-white border-blue-600 py-2 px-3 w-auto",align:"end",sideOffset:12,children:[e.jsx(Wi,{className:"fill-blue-600",width:12,height:6}),e.jsx("p",{className:"text-sm",children:Ke?"Update to rescreen candidates":"Next: Change your requirements"})]})]})]})]})})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto bg-white",children:e.jsx("div",{className:"px-4 pt-3 sm:pt-0.5 pb-8",children:e.jsxs("div",{className:"max-w-5xl",children:[E&&$&&r>10&&e.jsx(Hn,{jobId:n,onDismiss:$,onInviteSent:()=>W?.()}),e.jsxs("div",{className:`space-y-2 transition-opacity duration-200 ${Vt?"opacity-50":""}`,children:[H||Us||O.length===0&&Pt?[...Array(6)].map((s,i)=>e.jsx(as,{},`load-skeleton-${i}`)):O.length===0&&(Ls||!Z&&!Te&&!zs)?e.jsx("div",{className:"py-16",children:(()=>{const s=Ls,i=F?F==="merge"?"your ATS":Vi[F]?.displayName??"your ATS":null,t=F!==null,l={resume:{icon:In,title:"No candidates",subtitle:t?ms?`"${ms.intake}" stage is empty. Most candidates are in "${ms.suggested}". Change the intake stage and sync again.`:`New applications from ${i} will sync automatically. Or, change the intake stage now.`:"Add resumes or connect your ATS",cta:e.jsxs("div",{className:"flex gap-2 justify-center",children:[t?e.jsx(f,{variant:"outline",size:"sm",onClick:()=>De({to:"/settings/integrations"}),children:"Change intake stage"}):e.jsx(f,{variant:"outline",size:"sm",onClick:()=>js(!0),disabled:K,children:"Add resumes"}),C&&e.jsxs(f,{variant:"outline",size:"sm",disabled:Ae,onClick:()=>{re(ie(U)),de(ie(V)),te(!0),fe(!0)},children:[e.jsx(pt,{className:"w-3.5 h-3.5 mr-1.5"}),"Edit requirements"]})]})},interview:{icon:Dn,title:"No interview candidates yet",subtitle:"Invite candidates from Resume stage to begin."},shortlisted:{icon:ln,title:"No shortlisted candidates yet",subtitle:ne?"Shortlist strong candidates from the Resume stage.":"Advance candidates from Interview stage."},archived:{icon:kn,title:"No archived candidates",subtitle:"Archived candidates will appear here"}},a=l[m]||l.resume;return e.jsx(Li,{icon:s?Pn:a.icon,title:s?`No ${m}
1 candidates match your filters`:a.title,description:s?"Try adjusting your search or filter criteria":a.subtitle,action:s?e.jsx(f,{variant:"outline",size:"sm",onClick:()=>{ys(he),I({..._e.reset(),search:"",page:1})},children:"Clear filters"}):a.cta})})()}):(()=>{const s=i=>(Z||Te||zs)&&i.score===null&&!i.screeningFailed?e.jsx(as,{name:i.name,company:i.company},i.id):e.jsx(zn,{candidate:i,currentStage:m,sortBy:ce,isSelected:h.includes(i.id),requirementFilterCount:Q.length+se.length,onSelect:di,onClick:t=>u(t,L.map(l=>l.id))},i.id);if(m==="resume"&&ce==="recommended"){const i=L.filter(a=>a.resumeFit==="strong"),t=L.filter(a=>a.resumeFit==="not-fit"),l=L.filter(a=>a.resumeFit!=="strong"&&a.resumeFit!=="not-fit");return e.jsxs(e.Fragment,{children:[i.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(Es,{as:"h3",className:"px-1",tooltip:e.jsx(es,{iconSize:"w-3 h-3",width:"w-80",learnMoreHref:at.resultOutcomeScore,children:"Strong fit based on your screening criteria and matches all must-have requirements."}),children:"Strong Fit"}),i.map(s)]}),t.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(Es,{as:"h3",className:"px-1 mt-6",tooltip:e.jsx(es,{iconSize:"w-3 h-3",width:"w-80",children:"Does not meet your screening criteria or is missing must-have requirements."}),children:"Not a Fit"}),t.map(s)]}),l.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(Es,{as:"h3",className:"px-1 mt-6",tooltip:e.jsx(es,{iconSize:"w-3 h-3",width:"w-80",children:"No recommendation yet â these candidates are either still being scored, or their resume couldn't be read."}),children:"Awaiting Score"}),l.map(s)]})]})}else return L.map(s)})(),Os>0&&m==="resume"&&!Us&&[...Array(Os)].map((s,i)=>e.jsx(as,{},`upload-pending-${i}`)),c&&x&&v<r&&!g&&[...Array(Math.min(5,r-v))].map((s,i)=>e.jsx(as,{variant:"locked"},`skeleton-${i}`))]}),e.jsx(Ji,{currentPage:ee,totalPages:Ie,onPageChange:Lt,label:`Showing ${Math.min((ee-1)*we+1,We)}-${Math.min(ee*we,We)} of ${We}`,className:"mt-6"})]})})}),w?.type==="confirm"&&e.jsx(Ze,{open:!0,onOpenChange:s=>!s&&p(null),title:w.title,description:w.description,confirmLabel:w.action==="restore"?"Restore":w.action==="delete"?"Delete":w.action==="advance"&&m==="shortlisted"?"Share":"Confirm",pendingLabel:w.action==="delete"?"Deleting...":"Processing...",variant:w.action==="delete"?"destructive":"default",onConfirm:yi,isPending:y.isPending||ae.isPending}),w?.type==="missing-email"&&(()=>{const s=w;return e.jsx(Fe,{open:!0,onOpenChange:i=>{i||p(null)},children:e.jsx(Me,{className:"sm:max-w-md",children:s.candidatesWithEmail===0?e.jsxs(e.Fragment,{children:[e.jsxs(be,{children:[e.jsx(Ne,{children:"Can't send invitation"}),e.jsx(Ce,{children:s.candidatesWithoutEmail.length===1?`${s.candidatesWithoutEmail[0]?.name} is missing an email address.`:`All ${s.candidatesWithoutEmail.length} selected candidates are missing email addresses:`})]}),s.candidatesWithoutEmail.length>1&&e.jsx("div",{className:"space-y-1 px-1 pt-2",children:s.candidatesWithoutEmail.map(i=>e.jsx("div",{className:"text-sm text-muted-foreground py-0.5",children:i.name||"Unidentified"},i.id))}),e.jsx(Se,{children:e.jsx(ye,{children:"Close"})})]}):e.jsxs(e.Fragment,{children:[e.jsxs(be,{children:[e.jsxs(Ne,{children:["Send AI phone interview invite to ",s.candidatesWithEmail," of ",s.candidatesWithEmail+s.candidatesWithoutEmail.length," candidate",s.candidatesWithEmail+s.candidatesWithoutEmail.length>1?"s":""]}),e.jsx(Ce,{children:"Candidates will receive an email invitation to schedule an AI phone screen within 1 hour."}),e.jsx(ls,{label:`${s.candidatesWithoutEmail.length} ${s.candidatesWithoutEmail.length>1?"are":"is"} missing email ${s.candidatesWithoutEmail.length>1?"addresses":"address"}`,items:s.candidatesWithoutEmail.map(i=>({id:i.id,name:i.name}))})]}),e.jsxs(Se,{className:"flex-col sm:flex-row gap-2",children:[C&&e.jsx(f,{variant:"ghost",onClick:()=>{p(null),Ve("interview")},children:"Review settings"}),e.jsx(ye,{className:"mt-0",children:"Cancel"}),e.jsxs(He,{onClick:()=>{p({type:"interview-invite",candidateCount:s.candidatesWithEmail,candidatesSkipped:[]})},children:["Invite ",s.candidatesWithEmail]})]})]})})})})(),w?.type==="interview-invite"&&(()=>{if(K)return e.jsx(Fe,{open:!0,onOpenChange:j=>{j||p(null)},children:e.jsxs(Me,{className:"sm:max-w-md",children:[e.jsxs(be,{children:[e.jsx(Ne,{children:"Screening is paused"}),e.jsx(Ce,{children:"Candidates can't schedule interviews while this job is paused. Resume screening to send invites."})]}),e.jsxs(Se,{children:[e.jsx(ye,{children:"Close"}),C&&e.jsx(He,{onClick:()=>{p(null),Ve("resume")},children:"Resume screening"})]})]})});const s=w,i=R?.hasUsedInterview||!1,t=R?.interviews?.remaining??0,l=o?.availableAgents?.find(j=>j.id===o.settings?.interviewAgent)?.cost??1,a=Pi(R,l),b=s.candidatesSkipped?.length||0,P=b>0,Y=P?s.candidateCount+b:s.candidateCount,Ss=`Send AI phone interview invite to ${s.candidateCount} ${P?`of ${Y} `:""}candidate${Y>1?"s":""}`,je=P&&e.jsx(ls,{label:`${b} can't be invited`,items:s.candidatesSkipped?.map(j=>
1({id:j.id,name:j.name,detail:j.reason}))||[]});return e.jsx(Fe,{open:!0,onOpenChange:j=>{j||p(null)},children:e.jsxs(Me,{className:"sm:max-w-md",children:[e.jsxs(be,{children:[e.jsx(Ne,{children:Ss}),e.jsx(Ce,{children:!i||ne?`AI calls the candidate, interviews them about the role, sends you results. ${t} credit${t!==1?"s":""} remaining${R?.plan==="contract"?".":`â$${un(a)} per additional.`}`:"Candidates will receive an email invitation to schedule an AI phone screen within 1 hour."}),je]}),!i&&e.jsx("div",{className:"py-4",children:e.jsxs("div",{className:"bg-slate-50 rounded-lg p-4",children:[e.jsx(rn,{className:"mb-4"}),e.jsx("div",{className:"border-t border-slate-200 my-4"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-slate-500 mb-3",children:"Plus 4 written evaluations:"}),e.jsxs("div",{className:"space-y-2.5",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-900 font-medium mb-1",children:"Communication"}),e.jsx("div",{className:"h-1.5 bg-slate-200 rounded w-3/4"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-900 font-medium mb-1",children:"Problem Solving"}),e.jsx("div",{className:"h-1.5 bg-slate-200 rounded w-2/3"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-900 font-medium mb-1",children:"Experience"}),e.jsx("div",{className:"h-1.5 bg-slate-200 rounded w-4/5"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-900 font-medium mb-1",children:"Culture Fit"}),e.jsx("div",{className:"h-1.5 bg-slate-200 rounded w-1/2"})]})]})]})]})}),e.jsxs(Se,{children:[C&&e.jsx(f,{variant:"ghost",onClick:()=>{p(null),Ve("interview")},children:"Review settings"}),e.jsx(ye,{children:"Cancel"}),e.jsx(He,{onClick:xi,disabled:y.isPending,children:y.isPending?"Sending...":"Send invites"})]})]})})})(),w?.type==="shortlist"&&(()=>{const s=w,i=(o?.settings?.shortlistComms||!1)&&m!=="resume",t=s.candidatesSkipped?.length||0,l=t>0,a=l?s.candidateCount+t:s.candidateCount,b=l&&e.jsx(ls,{label:`${t} aren't ready to shortlist`,items:s.candidatesSkipped?.map(P=>({id:P.id,name:P.name,detail:P.reason}))||[]});return e.jsx(Fe,{open:!0,onOpenChange:P=>{P||p(null)},children:e.jsxs(Me,{className:"sm:max-w-md",children:[e.jsxs(be,{children:[e.jsxs(Ne,{children:["Move ",s.candidateCount," ",l?`of ${a} `:"","candidate",a>1?"s":""," to shortlist"]}),e.jsx(Ce,{children:i?`Candidate${s.candidateCount>1?"s":""} will receive an email notification within 1 hour.`:`${s.candidateCount} candidate${s.candidateCount>1?"s":""} will be moved to your shortlist${m==="resume"?"":" for the next interview stage"}.`}),b]}),e.jsxs(Se,{children:[C&&i&&e.jsx(f,{variant:"ghost",onClick:()=>{p(null),Ve("shortlist")},children:"Review email"}),e.jsx(ye,{children:"Cancel"}),e.jsx(He,{onClick:bi,disabled:y.isPending,children:y.isPending?"Moving...":`Move ${s.candidateCount} to shortlist`})]})]})})})(),w?.type==="archive"&&(()=>{const s=w,i=s.candidatesWithWarnings||[],t=i.length>0,l=i.filter(j=>j.interviewDate||j.warning.includes("Scheduled")).length,a=i.filter(j=>j.warning.includes("pending")).length,b=!K&&(o?.settings?.postInterviewComms||!1),P=O.filter(j=>h.includes(j.id)&&j.stage==="interview"&&j.interviewStatus==="completed").length,Y=b&&P>0?" Interviewed candidates will receive a rejection email in 2 days.":"",Ss=(l>0&&a>0?"This will cancel scheduled interviews and withdraw pending invites.":l>0?"This will cancel their scheduled interviews.":a>0?"This will withdraw their pending invites.":"They'll be removed from your active pipeline.")+Y;let je="";return l>0&&a>0?je=`${l} interview${l>1?"s":""} scheduled, ${a} invite${a>1?"s":""} pending`:l>0?je=`${l} interview${l>1?"s":""} scheduled`:a>0&&(je=`${a} invite${a>1?"s":""} pending`),e.jsx(Fe,{open:!0,onOpenChange:j=>{j||p(null)},children:e.jsxs(Me,{className:"sm:max-w-md",children:[e.jsxs(be,{children:[e.jsxs(Ne,{children:["Archive ",s.candidateCount," candidate",s.candidateCount>1?"s":""]}),e.jsx(Ce,{children:Ss}),t&&e.jsx(ls,{label:je,items:i.map(j=>({id:j.id,name:j.name,detail:j.warning}))})]}),e.jsxs(Se,{children:[e.jsx(ye,{children:"Cancel"}),e.jsx(He,{onClick:hi,disabled:y.isPending,className:"bg-destructive hover:bg-destructive/90 text-white",children:y.isPending?"Archiv
1ing...":"Archive"})]})]})})})(),w?.type==="hired"&&e.jsx(Ze,{open:!0,onOpenChange:s=>!s&&p(null),title:`Mark ${w.candidateCount} candidate${w.candidateCount>1?"s":""} as hired`,description:"This marks the candidate as hired. They will remain in the shortlisted stage with a hired badge.",confirmLabel:"Mark hired",pendingLabel:"Updating...",onConfirm:Si,isPending:y.isPending}),e.jsx(Ze,{open:Zt||bs.status==="blocked",onOpenChange:s=>{s||(ge(!1),qe(null),fs(!1),bs.reset?.())},title:"Unsaved changes",description:"Your changes haven't been saved.",confirmLabel:"Leave",onConfirm:Ei}),e.jsx(Ze,{open:Pe.open,onOpenChange:s=>!s&&vs({open:!1,id:null,type:null}),title:"Remove requirement",description:"This will permanently remove this requirement.",confirmLabel:"Remove",variant:"destructive",onConfirm:ki}),C&&si&&e.jsx(_n,{jobId:n,currentTeam:o?.team||[],onOpenChange:s=>{s||qs(!1)}}),e.jsx(Ln,{jobId:n,csrfToken:T||"",open:ti,onOpenChange:js,onSuccess:({queued:s,batchId:i})=>{i?ds({batchId:i,total:s}):cs(!0),q.invalidateQueries({queryKey:["job",n,"candidates"]}),q.invalidateQueries({queryKey:["job",n,"screening-status"]}),q.invalidateQueries({queryKey:["jobs"]})}})]}),e.jsxs(_i,{open:G,onClose:ws,title:k?"Edit Requirements":m==="resume"?"Requirements":"Filters",wide:k,hideCloseButton:k,hideBodyPadding:!0,actions:k?e.jsxs(e.Fragment,{children:[e.jsx(f,{variant:"outline",size:"sm",onClick:Ai,disabled:Ee.isPending,className:"text-xs h-8",children:"Cancel"}),e.jsx(f,{variant:"default",size:"sm",onClick:Ti,disabled:Ee.isPending,className:"text-xs h-8",children:Ee.isPending?"Saving...":"Save"})]}):m==="resume"&&C?e.jsx(f,{variant:"default",size:"sm",onClick:s=>{s.stopPropagation(),!Ae&&(re(ie(U)),de(ie(V)),te(!0))},disabled:Ae,className:`text-xs ${Ae?"cursor-not-allowed":""}`,children:"Edit"}):void 0,children:[S&&m==="resume"&&e.jsxs("div",{className:"p-4 sm:p-6",children:[!k&&e.jsx("div",{className:"mb-4 flex items-center justify-between gap-2",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:"Resume"}),e.jsx(dt,{})]})}),e.jsxs("div",{className:"mb-6",children:[e.jsx("div",{className:"mb-3",children:e.jsx("span",{className:"text-sm font-medium",children:"Must-Haves"})}),k?e.jsx("div",{className:"space-y-2",children:U.map((s,i)=>e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(ot,{flags:s.flag?[s.flag]:[],value:s.text,onApply:t=>it("mustHave",s.id,t),children:e.jsx(lt,{value:s.text,onChange:t=>Cs("mustHave",s.id,t.target.value),maxLength:5e3,className:"text-xs md:text-xs bg-white min-h-[32px] max-h-[66px] resize-none py-1.5 overflow-y-auto",placeholder:ns[i%ns.length],rows:1,style:{fieldSizing:"content"}})}),e.jsx("button",{onClick:()=>tt("mustHave",s.id),className:"text-slate-400 hover:text-destructive-hover hover:bg-destructive-background p-1.5 rounded mt-0.5","aria-label":"Delete requirement",children:e.jsx(Ds,{className:"w-3.5 h-3.5"})})]},s.id))}):e.jsx("div",{className:"flex flex-wrap gap-2",children:U.filter(s=>s.text.trim()!=="").map(s=>e.jsx(Le,{label:s.label||s.text,rate:s.matchRate,isSelected:Q.includes(s.id),onClick:()=>Ge(s.id),flag:s.flag?.reason},s.id))})]}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-3",children:e.jsx("span",{className:"text-sm font-medium",children:"Nice-to-Haves"})}),k?e.jsx("div",{className:"space-y-2",children:V.map((s,i)=>e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(ot,{flags:s.flag?[s.flag]:[],value:s.text,onApply:t=>it("niceToHave",s.id,t),children:e.jsx(lt,{value:s.text,onChange:t=>Cs("niceToHave",s.id,t.target.value),maxLength:5e3,className:"text-xs md:text-xs bg-white min-h-[32px] max-h-[66px] resize-none py-1.5 overflow-y-auto",placeholder:ns[(U.length+i)%ns.length],rows:1,style:{fieldSizing:"content"}})}),e.jsx("button",{onClick:()=>tt("niceToHave",s.id),className:"text-slate-400 hover:text-destructive-hover hover:bg-destructive-background p-1.5 rounded mt-0.5","aria-label":"Delete requirement",children:e.jsx(Ds,{className:"w-3.5 h-3.5"})})]},s.id))}):e.jsx("div",{className:"flex flex-wrap gap-2",children:V.filter(s=>s.text.trim()!=="").map(s=>e.jsx(Le,{label:s.label||s.text,rate:s.matchRate,isSelected:Q.includes(s.id
1),onClick:()=>Ge(s.id),flag:s.flag?.reason},s.id))})]}),!k&&pe&&pe.length>0&&e.jsx("div",{className:"mt-6",children:e.jsx(ct,{signals:pe,selectedSignals:se,onToggleSignal:Ys})})]}),m!=="resume"&&e.jsxs("div",{className:"p-4 sm:p-6",children:[$e.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mb-4 flex items-center justify-between gap-2",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Interview"}),e.jsxs(es,{iconSize:"w-3.5 h-3.5",width:"w-80",learnMoreHref:at.interviewAssessment,children:[e.jsx("p",{className:"mb-2",children:"Each interview is rated Strong, Questionable, or Weak in these areas:"}),e.jsxs("ul",{className:"space-y-1 ml-4 list-disc",children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Experience:"})," Relevant background / skills"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Communication:"})," Clarity and articulation"]}),$e.some(s=>s.id==="motivation")&&e.jsxs("li",{children:[e.jsx("strong",{children:"Culture Fit:"})," Alignment with your values"]}),$e.some(s=>s.id==="problemSolving")&&e.jsxs("li",{children:[e.jsx("strong",{children:"Problem Solving:"})," Analytical thinking"]})]})]})]})}),e.jsx("div",{className:"flex flex-wrap gap-2",children:$e.map(s=>e.jsx(Le,{label:s.label,rate:s.rate,isSelected:me.includes(s.id),onClick:()=>ai(s.id)},s.id))})]}),S&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`mb-4 flex items-center justify-between gap-2 ${$e.length>0?"mt-6":""}`,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Resume"}),e.jsx(dt,{iconSize:"w-3.5 h-3.5"})]})}),e.jsxs("div",{className:"mb-6",children:[e.jsx("div",{className:"mb-3",children:e.jsx("span",{className:"text-sm font-medium",children:"Must-Haves"})}),e.jsx("div",{className:"flex flex-wrap gap-2",children:U.filter(s=>s.text.trim()!=="").map(s=>e.jsx(Le,{label:s.label||s.text,rate:s.matchRate,isSelected:Q.includes(s.id),onClick:()=>Ge(s.id),flag:s.flag?.reason},s.id))})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("div",{className:"mb-3",children:e.jsx("span",{className:"text-sm font-medium",children:"Nice-to-Haves"})}),e.jsx("div",{className:"flex flex-wrap gap-2",children:V.filter(s=>s.text.trim()!=="").map(s=>e.jsx(Le,{label:s.label||s.text,rate:s.matchRate,isSelected:Q.includes(s.id),onClick:()=>Ge(s.id),flag:s.flag?.reason},s.id))})]}),pe&&pe.length>0&&e.jsx("div",{className:"mt-6",children:e.jsx(ct,{signals:pe,selectedSignals:se,onToggleSignal:Ys})})]})]}),!k&&e.jsx("div",{className:"px-4 sm:px-6 pb-6",children:e.jsx(zi,{canSave:_s,canClear:_s||nt(he)!=null,onClear:ri,onSave:li})})]}),e.jsx(Cn,{children:Ri&&e.jsx($n.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:20},transition:{duration:.2},className:"fixed bottom-6 right-6 z-50",children:e.jsx(On,{creditsUsed:ze?le?.processed??0:Z?$t:R?.cvs?.used??0,totalCandidates:ze?M?.total??0:Z?Ft:R?.cvs?.limit??0,isTrialExhausted:x&&!Z&&!ze,onClose:()=>{},onUpgrade:X?.role==="admin"?N:void 0})})}),Gt&&o&&e.jsx(dn,{jobId:n,apiJob:o,onOpenChange:Be,initialTab:Yt,isPaused:K,onPauseChange:s=>{xs(s),Mt.mutate({status:s?"paused":"active"},{onError:()=>{xs(!s)}})},onOpenEditRequirements:C&&!Ae?()=>{m!=="resume"&&xe("resume"),re(ie(U)),de(ie(V)),te(!0),fe(!0)}:void 0})]})}function hl(){const{jobId:n}=Mi.useParams(),{data:u}=Tt(n,!0);Hi(u?.title||"");const c=$s(),{onboardingJobId:v,creditsUsed:g,hasUpgraded:x,isTrialExhausted:E,checklistProgress:N,handleChecklistUpdate:$,showTeamInviteBanner:W,handleDismissTeamInviteBanner:F,handleTeamMemberInvited:B,connectedAts:oe}=Zi(),q=vt({from:"/_app/jobs/$jobId"}),o=$s({from:"/jobs/$jobId"}),H=ae=>o({search:M=>({...M,...ae}),replace:!0}),z=q.candidate??null,[r,T]=d.useState([]),[C,R]=d.useState(null),{requestCollapse:X}=wt();d.useEffect(()=>{q.candidate&&X(!0)},[q.candidate,X]),d.useEffect(()=>()=>X(!1),[X]);const rs=(ae,M)=>{H({candidate:ae}),M&&T(M)},ke=()=>{H({candidate:void 0}),T([])},ne=()=>{H({candidate:void 0}),T([])},y=()=>{$({hasScheduledInterview:!0}),R("interview"),setTimeout(()=>R(null),100)};return e.jsxs(e.Fragment,{children:[e.jsx(Wn,{jobId:n,onCandidateClick:rs,isOnboardingJob:n===v,creditsUsed:g,hasUpgraded:x,isTrialExhausted:E,showTeamInviteBanner:W&&n===v,onUpgrade:()=>c({to:"/settings/billing"}),onDismissTeamInviteBanner:F,onTeamMemberInvited:B,connectedAts:oe,requestedTabSwitch:C,onInterviewInviteSent:y},n),u&&z!==null&&e.jsx(on,{candidateId:z,onClose:ke,candidateIds:r,onNavigate:ae=>H({candidate:ae}),onInterviewInviteSent:y,isOnboardingJob:n===v,hasSeenInterviewTooltip:N.hasSeenInterviewTooltip,onInterviewTooltipShown:()=>$({hasSeenInterviewTooltip:!0}),onCandidateRestored:ne},n)]})}export{hl as component};
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.