1import{b1 as H,aZ as K,bS as V,bs as _,aq as q,c8 as W,bw as h,bk as e,X,Y as $,g as w,j as k,k as S,i as F,h as E,f,K as C,D as G,x as Z,z as J,E as Q,y as ee,aD as se,bX as n,b$ as ae,by as re,bK as te,bE as le}from"./index-BdR958M7.js";import{B as R}from"./badge-DB8vyzPB.js";import{I as ie}from"./input-C8Uuo3Hp.js";import{L as U}from"./label-B2bNnO3u.js";import{T as ne}from"./textarea-xbFlfrGt.js";import{S as T}from"./switch-jrOVVUCY.js";import{C as oe}from"./country-select-CF9ypO39.js";import{A as ce}from"./activation-7wfSM1Bj.js";import{U as de,M as me}from"./apply-constants-Zd2eXN_U.js";import{B as xe,D as A}from"./download-CQYIlvir.js";import{F as B}from"./file-text-BlC7zoaz.js";import{C as ue}from"./circle-check-CP3bf0X1.js";import{E as pe}from"./eye-CwCli8jE.js";import{R as he}from"./refresh-cw-BAIXrhyY.js";import{T as fe}from"./trash-2-TXDOd-Yf.js";import{E as je}from"./external-link-Tu6E-dMr.js";const o=V().max(300);_({preferredName:o,pronouns:o,city:o,region:o,postalCode:o,currentTitle:o,currentCompany:o,school:o,degree:o,fieldOfStudy:o,gradYear:o,noticePeriod:o,startDate:o,salaryExpectation:o,headline:o,yearsExp:o,skills:V().max(4e3)});const ge=H({method:"POST"}).handler(K("933a21de4dcf859a8500f14822b70fc6ce9c343d034d507a8efbac146f5429ca"));function Ve(){const{profile:s,accountEmail:u}=q.useLoaderData(),d=W(),p=h.useRef(null),[m,i]=h.useState(""),[t,c]=h.useState(!1),[x,a]=h.useState(!1),[y,b]=h.useState(!1),[O,D]=h.useState(!1),g=s?.resumeKey?`/api/cv/${encodeURIComponent(s.resumeKey)}`:null;async function L(){c(!0);try{const l=await te({data:{resumeText:m}});if(!l.ok){n.error("error"in l&&l.error?l.error:"Could not save");return}n.success("Career memory updated"),i(""),await d.invalidate()}catch{n.error("Could not save")}finally{c(!1)}}async function I(l){if(!l.name.toLowerCase().endsWith(".pdf")){n.error("PDF only - please export your CV as a PDF");return}if(l.size>me){n.error("File too large (max 10MB)");return}a(!0);try{const N=new Uint8Array(await l.arrayBuffer());let z="";for(const Y of N)z+=String.fromCharCode(Y);const j=await ae({data:{filename:l.name,contentType:l.type||"application/pdf",dataBase64:btoa(z)}});j.ok?("built"in j&&j.built?n.success("Résumé uploaded & career memory refreshed"):"extracted"in j&&j.extracted===0?n.warning("Uploaded, but we couldn't read the text. Paste it below to build memory."):n.success("Résumé updated successfully"),await d.invalidate()):n.error("error"in j&&j.error?j.error:"Upload failed")}catch{n.error("Upload failed")}finally{a(!1)}}async function M(){if(window.confirm("Are you sure you want to remove your uploaded CV?")){b(!0);try{(await re()).ok?(n.success("CV removed"),await d.invalidate()):n.error("Could not remove CV")}catch{n.error("Could not remove CV")}finally{b(!1)}}}return e.jsxs(X,{children:[e.jsx($,{title:"Career memory & application details",description:"Who you are and the standard answers we use to apply on your behalf."}),e.jsxs("div",{className:"mt-6 grid gap-6 lg:grid-cols-2",children:[e.jsxs(w,{children:[e.jsxs(k,{children:[e.jsxs(S,{className:"flex items-center gap-2",children:[e.jsx(xe,{className:"text-primary size-4"})," Your résumé & CV"]}),e.jsx(F,{children:"Upload your CV (attached to applications) and preview or replace it anytime."})]}),e.jsxs(E,{className:"flex flex-col gap-4",children:[e.jsx("input",{ref:p,type:"file",accept:".pdf,application/pdf",className:"hidden",onChange:l=>{const N=l.target.files?.[0];N&&(I(N),l.target.value="")}}),s?.resumeKey?e.jsxs("div",{className:"border-border bg-secondary/30 flex flex-col gap-3 rounded-xl border p-4",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("div",{className:"bg-primary/10 text-primary flex size-10 shrink-0 items-center justify-center rounded-lg",children:e.jsx(B,{className:"size-5"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-foreground truncate text-sm font-medium",children:s.resumeFilename||"resume.pdf"}),e.jsx(R,{variant:"outline",className:"text-[10px] uppercase",children:s.resumeFilename?.split(".").pop()||"PDF"})]}),e.jsxs("p",{className:"text-muted-foreground mt-0.5 flex items-center gap-1 text-xs",children:[e.jsx(ue,{className:"size-3 text-emerald-500"}
1),"Saved in secure cloud storage"]})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-1 sm:pt-0",children:[e.jsxs(f,{type:"button",variant:"outline",size:"sm",className:"h-8 gap-1.5 text-xs",onClick:()=>D(!0),children:[e.jsx(pe,{className:"size-3.5"}),"Preview"]}),g&&e.jsx(f,{type:"button",asChild:!0,variant:"outline",size:"sm",className:"h-8 gap-1.5 text-xs",children:e.jsxs("a",{href:g,download:s.resumeFilename||"resume.pdf",children:[e.jsx(A,{className:"size-3.5"}),"Download"]})}),e.jsx(f,{type:"button",variant:"secondary",size:"sm",disabled:x,className:"h-8 gap-1.5 text-xs",onClick:()=>p.current?.click(),children:x?e.jsxs(e.Fragment,{children:[e.jsx(C,{className:"size-3.5 animate-spin"}),"Replacingâ¦"]}):e.jsxs(e.Fragment,{children:[e.jsx(he,{className:"size-3.5"}),"Replace"]})}),e.jsx(f,{type:"button",variant:"ghost",size:"sm",disabled:y,className:"text-muted-foreground hover:text-destructive hover:bg-destructive/10 h-8 gap-1.5 text-xs",onClick:M,title:"Remove CV",children:y?e.jsx(C,{className:"size-3.5 animate-spin"}):e.jsx(fe,{className:"size-3.5"})})]})]}),e.jsx(G,{open:O,onOpenChange:D,children:e.jsxs(Z,{className:"flex max-h-[92vh] flex-col gap-3 p-4 sm:max-w-4xl sm:p-6",children:[e.jsxs(J,{className:"flex flex-row items-center justify-between border-b pb-2",children:[e.jsxs("div",{className:"text-left",children:[e.jsxs(Q,{className:"flex items-center gap-2 text-base font-semibold",children:[e.jsx(B,{className:"text-primary size-4"}),s.resumeFilename||"Your Résumé"]}),e.jsx(ee,{className:"text-xs",children:"Candidate CV document preview"})]}),e.jsx("div",{className:"flex items-center gap-2 pr-6",children:g&&e.jsxs(e.Fragment,{children:[e.jsx(f,{asChild:!0,variant:"outline",size:"sm",className:"h-8 gap-1 text-xs",children:e.jsxs("a",{href:g,target:"_blank",rel:"noreferrer",children:[e.jsx(je,{className:"size-3.5"}),"Full View"]})}),e.jsx(f,{asChild:!0,size:"sm",className:"h-8 gap-1 text-xs",children:e.jsxs("a",{href:g,download:s.resumeFilename||"resume.pdf",children:[e.jsx(A,{className:"size-3.5"}),"Download PDF"]})})]})})]}),e.jsx("div",{className:"bg-muted/20 relative h-[65vh] min-h-[60vh] w-full overflow-hidden rounded-lg border",children:g?e.jsx("iframe",{src:g,title:"Candidate CV Preview",className:"h-full w-full border-0"}):e.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center text-sm",children:"No preview available"})})]})})]}):e.jsx("button",{type:"button",onClick:()=>p.current?.click(),disabled:x,className:"border-border bg-secondary/30 hover:bg-secondary/60 flex cursor-pointer flex-col items-center gap-2 rounded-xl border border-dashed px-6 py-7 text-center transition-colors",children:x?e.jsxs(e.Fragment,{children:[e.jsx(C,{className:"text-primary size-7 animate-spin"}),e.jsx("span",{className:"text-sm font-medium",children:"Uploading & parsing CVâ¦"})]}):e.jsxs(e.Fragment,{children:[e.jsx(de,{className:"text-primary size-7"}),e.jsx("span",{className:"text-sm font-medium",children:"Upload CV (PDF, max 2 pages, 10MB)"}),e.jsx("span",{className:"text-muted-foreground text-xs",children:"Max file size 5MB ⢠Used for matching & auto-apply"})]})}),e.jsxs("div",{className:"flex flex-col gap-2 pt-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(U,{htmlFor:"resume",className:"text-muted-foreground text-xs font-semibold tracking-wider uppercase",children:"Career Memory / Plaintext Résumé"}),s?.hasResume&&e.jsx(R,{variant:"secondary",className:"text-[10px]",children:"Memory active"})]}),e.jsx(ne,{id:"resume",value:m,onChange:l=>i(l.target.value),placeholder:s?.hasResume?"Optionally paste/edit raw text to refresh your career memoryâ¦":"Paste your résumé hereâ¦",className:"min-h-32 font-mono text-xs"}),e.jsx(f,{onClick:L,disabled:t||m.trim().length<30,size:"sm",className:"w-fit gap-1.5",children:t?e.jsxs(e.Fragment,{children:[e.jsx(C,{className:"size-3.5 animate-spin"}),"Analyzingâ¦"]}):e.jsxs(e.Fragment,{children:[e.jsx(se,{className:"size-3.5"}),"Build career memory"]})})]})]})]}),e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsxs(w,{children:[e.jsxs(k,{children:[e.jsx(S,{children:"What we understand about you"}),e.jsx(F,{children:"Derived from your résumé."})]}),e.jsx(E,{className:"flex flex-col gap-4",children:s?.hasResume?e.jsxs(e.Fragment,{children:[s.headline&&e.jsx(P,{label:"Headline",value:s.headline}),s.yearsExp!=null&&e.jsx(P,{label:"Experience",value:`${s.yearsExp} years`}),s.summary&&e.jsx(P,{label:"Summary",value:s.summary}),s.skills.length>0&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("p",{className:"text-muted-foreground text-xs font-medium tracking-wider up
1percase",children:"Skills"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.skills.map(l=>e.jsx(R,{variant:"secondary",children:l},l))})]})]}):e.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing yet - add your résumé and weâll build your profile."})})]}),e.jsx(ye,{profile:s,accountEmail:u,onSaved:()=>d.invalidate()},[s?.needsSponsorship,s?.willingToRelocate,s?.firstName,s?.lastName,s?.email,s?.phone,s?.location,s?.linkedinUrl,s?.githubUrl,s?.portfolioUrl].join("|"))]})]}),e.jsx(ve,{profile:s,onSaved:()=>d.invalidate()},[s?.city,s?.school,s?.headline,s?.skills.join(",")].join("|"))]})}function ye({profile:s,accountEmail:u,onSaved:d}){const[p,m]=h.useState(!1),[i,t]=h.useState({firstName:s?.firstName??"",lastName:s?.lastName??"",email:s?.email||u||"",phone:s?.phone??"",location:s?.location??"",linkedinUrl:s?.linkedinUrl??"",githubUrl:s?.githubUrl??"",portfolioUrl:s?.portfolioUrl??"",workAuth:s?.workAuth??"",needsSponsorship:s?.needsSponsorship??!1,willingToRelocate:s?.willingToRelocate??!1}),c=(a,y)=>t(b=>({...b,[a]:y}));async function x(){m(!0);try{await le({data:i}),n.success("Application details saved"),d()}catch{n.error("Could not save")}finally{m(!1)}}return e.jsxs(w,{id:ce,className:"scroll-mt-20",children:[e.jsxs(k,{children:[e.jsx(S,{children:"Application details"}),e.jsx(F,{children:"Used to auto-fill every application. EEO is always âdeclineâ."})]}),e.jsxs(E,{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsx(r,{label:"First name",value:i.firstName,onChange:a=>c("firstName",a)}),e.jsx(r,{label:"Last name",value:i.lastName,onChange:a=>c("lastName",a)}),e.jsx(r,{label:"Email",type:"email",value:i.email,onChange:a=>c("email",a)}),e.jsx(r,{label:"Phone",value:i.phone,onChange:a=>c("phone",a)}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(U,{children:"Location"}),e.jsx(oe,{value:i.location,onChange:a=>c("location",a)})]}),e.jsx(r,{label:"LinkedIn",type:"url",value:i.linkedinUrl,onChange:a=>c("linkedinUrl",a)}),e.jsx(r,{label:"GitHub",type:"url",value:i.githubUrl,onChange:a=>c("githubUrl",a)}),e.jsx(r,{label:"Portfolio",type:"url",value:i.portfolioUrl,onChange:a=>c("portfolioUrl",a)})]}),e.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[e.jsx(T,{checked:i.needsSponsorship,onCheckedChange:a=>c("needsSponsorship",a)})," ","I require visa sponsorship"]}),e.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[e.jsx(T,{checked:i.willingToRelocate,onCheckedChange:a=>c("willingToRelocate",a)})," ","Open to relocating"]}),e.jsx(f,{onClick:x,disabled:p,className:"w-fit",children:p?"Savingâ¦":"Save details"})]})]})}function ve({profile:s,onSaved:u}){const[d,p]=h.useState(!1),[m,i]=h.useState({preferredName:s?.preferredName??"",pronouns:s?.pronouns??"",city:s?.city??"",region:s?.region??"",postalCode:s?.postalCode??"",currentTitle:s?.currentTitle??"",currentCompany:s?.currentCompany??"",school:s?.school??"",degree:s?.degree??"",fieldOfStudy:s?.fieldOfStudy??"",gradYear:s?.gradYear?.toString()??"",noticePeriod:s?.noticePeriod??"",startDate:s?.startDate??"",salaryExpectation:s?.salaryExpectation??"",headline:s?.headline??"",yearsExp:s?.yearsExp?.toString()??"",skills:s?.skills.join(", ")??""}),t=x=>({value:m[x],onChange:a=>i(y=>({...y,[x]:a}))});async function c(){p(!0);try{const x=await ge({data:m});if(!x.ok){n.error(x.error);return}n.success("Profile saved"),u()}catch{n.error("Could not save")}finally{p(!1)}}return e.jsxs(w,{className:"mt-6",children:[e.jsxs(k,{children:[e.jsx(S,{children:"More about you"}),e.jsx(F,{children:"The other questions application forms ask. Anything you leave blank is left for you to answer on the form."})]}),e.jsxs(E,{className:"flex flex-col gap-6",children:[e.jsxs(v,{title:"For matching",children:[e.jsx(r,{label:"Headline",...t("headline")}),e.jsx(r,{label:"Years of experience",type:"number",...t("yearsExp")}),e.jsx("div",{className:"sm:col-span-2",children:e.jsx(r,{label:"Skills (comma-separated)",...t("skills")})})]}),e.jsxs(v,{title:"Address",children:[e.jsx(r,{label:"City",...t("city")}),e.jsx(r,{label:"State / province",...t("region")}),e.jsx(r,{label:"Postal code",...t("postalCode")})]}),e.jsxs(v,{title:"Current role",children:[e.jsx(r,{label:"Current title",...t("currentTitle")}),e.jsx(r,{label:"Current company",...t("currentCompany")})]}),e.jsxs(v,{title:"Education",children:[e.jsx(r,{label:"School or university",...t("school")}),e.jsx(r,{label:"Degree",...t("degree")}),e.jsx(r,{label:"Field of study",...t("fieldOfStudy")}),e.jsx(r,{label:"Graduation year",type:"number",...t("gradYear")}
1)]}),e.jsxs(v,{title:"Availability and pay",children:[e.jsx(r,{label:"Notice period",...t("noticePeriod")}),e.jsx(r,{label:"Earliest start date",...t("startDate")}),e.jsx(r,{label:"Salary expectation (with currency)",...t("salaryExpectation")})]}),e.jsxs(v,{title:"Personal",children:[e.jsx(r,{label:"Preferred name",...t("preferredName")}),e.jsx(r,{label:"Pronouns",...t("pronouns")})]}),e.jsx(f,{onClick:c,disabled:d,className:"w-fit",children:d?"Savingâ¦":"Save"})]})]})}function v({title:s,children:u}){return e.jsxs("section",{className:"flex flex-col gap-3",children:[e.jsx("h3",{className:"text-muted-foreground text-xs font-medium tracking-wider uppercase",children:s}),e.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:u})]})}function r({label:s,value:u,onChange:d,type:p}){const m=h.useId();return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(U,{htmlFor:m,children:s}),e.jsx(ie,{id:m,type:p,value:u,onChange:i=>d(i.target.value)})]})}function P({label:s,value:u}){return e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("p",{className:"text-muted-foreground text-xs font-medium tracking-wider uppercase",children:s}),e.jsx("p",{className:"text-foreground text-sm",children:u})]})}export{Ve 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.