1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4585],{74585:(e,t,a)=>{a.d(t,{O:()=>f});var s=a(95155),l=a(12115),r=a(35625),i=a(66609),n=a(2544),o=a(34426),d=a(37301),c=a(72930),m=a(62680),x=a(89515),p=a(55387),u=a(97539);function f({onUploadSuccess:e,replaceMasterMode:t,embedded:a=!1,extractionRedirectTo:h}){let w=(0,r.jE)(),k=(0,u.ei)(),[b,v]=(0,l.useState)(!1),[g,y]=(0,l.useState)(null),[j,C]=(0,l.useState)(!1);(0,l.useEffect)(()=>{C("u">typeof document&&document.cookie.includes("__e2e=1"))},[]);let[N,V]=(0,l.useState)(""),[D,S]=(0,l.useState)(!1),[F,_]=(0,l.useState)(!0),[M,P]=(0,l.useState)(!1),[T,z]=(0,l.useState)(null),L=k?.isExtractionInProgress??!1,U=M||L,B=["application/vnd.openxmlformats-officedocument.wordprocessingml.document","text/plain","text/csv","application/pdf"],E=async a=>{if(a.preventDefault(),!g)return void z("Please select a file.");if(g.size>0xa00000)return void z("File is too large. Maximum size is 10 MB.");P(!0),z(null);try{let a=new FormData;a.append("file",g),N&&a.append("name",N),a.append("is_draft",String(D)),a.append("update_profile_from_cv",String(F));let s=(await c.FH.post("/documents/cvs/upload",a)).data;y(null),V(""),z(null);let l=()=>{(0,p.Nt)(w)},r=!!(s?.status==="pending"&&s.id&&k);(0,x.sx)(m.R2.CV_UPLOADED,{surface:"documents",is_master:!!t,extraction_started:r}),r&&s.id&&k?k.startCvExtractionProgress(s.id,{redirectTo:h,onSuccess:l}):l(),e?.({cvId:s?.id??"",status:s?.status,extractionStarted:r})}catch(t){let e=(0,c.SU)(t,"Failed to upload CV");z(e),i.toast.error(e)}finally{P(!1)}},O=["upload-zone",b?"upload-zone-drag":"",a?"!min-h-[7.5rem] !px-3 !py-6 sm:!min-h-[8.5rem] sm:!px-5 sm:!py-8":""].filter(Boolean).join(" "),X=a?"text-sm leading-snug text-slate-700 break-words dark:text-slate-300":"text-sm text-slate-700 dark:text-slate-300";return(0,s.jsxs)("section",{className:a?"min-w-0 space-y-4":"card-modern p-6 dark:bg-slate-900",children:[a?null:(0,s.jsxs)("div",{className:"flex flex-wrap items-baseline gap-x-4 gap-y-1",children:[(0,s.jsx)("h3",{className:"text-lg font-semibold tracking-tight text-slate-900 dark:text-white","aria-hidden":!0,children:t?"Replace master CV":"Upload CV"}),(0,s.jsx)("p",{className:"text-sm text-slate-600 dark:text-slate-400",children:t?"Upload a new file to replace your current master CV. Existing experience will be removed and new experience will be extracted from the new file.":"Drag and drop or browse \xb7 DOCX, TXT, CSV, PDF"}),!t&&(0,s.jsx)("p",{className:"mt-1 text-xs text-slate-500 dark:text-slate-500",children:"We'll review your CV and extract employment, qualifications, skills, projects and more. This usually takes a few minutes, we'll show progress while it runs."})]}),(0,s.jsxs)("form",{onSubmit:E,className:a?"space-y-4":"mt-6 space-y-4","aria-describedby":T?"cv-upload-error":void 0,children:[(0,s.jsx)("div",{onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),v(!0)},onDragLeave:e=>{e.preventDefault(),e.stopPropagation(),v(!1)},onDragOver:e=>{e.preventDefault(),e.stopPropagation()},onDrop:e=>{e.preventDefault(),e.stopPropagation(),v(!1);let t=e.dataTransfer.files[0];if(t){if(!B.includes(t.type))return void z("Invalid file type. Only DOCX, TXT, CSV, or PDF are allowed.");if(t.size>0xa00000)return void z("File is too large. Maximum size is 10 MB.");y(t),N||V(t.name.replace(/\.[^/.]+$/,"")),z(null)}},className:O,children:g?(0,s.jsxs)("div",{className:`flex w-full min-w-0 max-w-full gap-3 rounded-2xl border border-slate-200/80 bg-white/90 px-3 py-4 shadow-sm dark:border-slate-700 dark:bg-slate-800/90 sm:px-5 sm:py-5 ${a?"flex-col sm:flex-row sm:items-center sm:justify-between":"flex-wrap items-center justify-center sm:justify-between"}`,children:[(0,s.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[(0,s.jsx)("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br from-cyan-100 to-emerald-100 sm:h-12 sm:w-12 dark:from-cyan-900/40 dark:to-emerald-900/30",children:(0,s.jsx)("svg",{className:"h-6 w-6 text-cyan-600 dark:text-cyan-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:"truncate text-sm font-semibold text-slate-900 dark:text-white",title:g.name,children:g.name}),(0,s.jsxs)("p",{className:"text-xs text-slate-500 dark:text-slate-400",children:[(g.size/1024).toFixed(2)," KB \xb7 ready to upload"]})]})]}),(0,s.jsx)("button",{type:"button",onClick:()=>{U||(y(null),z(null))},disabled:U,className:`shrink-0 rounded-xl p-2 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-600 disabled:cursor-not-allowed disabled:opacity-40 dark:hover:bg-slate-700 dark:hover:text-slate-300 ${a?"self-end sm:self-auto":""}`,"aria-label":"Remove file",children:(0,s.jsx)("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"flex h-12 w-12 shrink-0 items-center justify-center rounded-2xl bg-gradient-to-br from-cyan-100 to-emerald-100 sm:h-14 sm:w-14 dark:from-cyan-900/40 dark:to-emerald-900/30",children:(0,s.jsx)("svg",{className:"h-7 w-7 text-cyan-600 dark:text-cyan-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"})})}),(0,s.jsxs)("p",{className:"mt-3 max-w-full break-words px-1 text-sm font-medium text-slate-900 sm:mt-4 sm:text-base dark:text-white",children:["Drop your CV here or"," ",(0,s.jsx)("label",{htmlFor:a?"file-upload-embedded":"file-upload",className:"cursor-pointer text-cyan-600 underline decoration-2 underline-offset-2 hover:text-cyan-500 dark:text-cyan-400",children:"browse"})]}),(0,s.jsxs)("p",{className:"mt-1.5 max-w-full break-words px-1 text-xs text-slate-500 sm:text-sm dark:text-slate-400",children:["DOCX, TXT, CSV, PDF \xb7 up to ",10,"MB"]}),(0,s.jsx)("input",{id:a?"file-upload-embedded":"file-upload",type:"file",accept:".docx,.txt,.csv,.pdf",onChange:e=>{let t=e.target.files?.[0];if(t){if(!B.includes(t.type))return void z("Invalid file type. Only DOCX, TXT, CSV, or PDF are allowed.");if(t.size>0xa00000)return void z("File is too large. Maximum size is 10 MB.");y(t),N||V(t.name.replace(/\.[^/.]+$/,"")),z(null)}},className:j?"mt-2 block w-full max-w-full text-sm text-slate-600 file:mr-2 file:rounded-xl file:border-0 file:bg-cyan-500 file:px-3 file:py-2 file:text-sm file:font-semibold file:text-white file:shadow-sm dark:text-slate-400 dark:file:bg-cyan-600 sm:file:mr-3 sm:file:px-4":"hidden"})]})}),g&&(0,s.jsxs)("div",{className:`border-t border-slate-200/80 pt-4 dark:border-slate-700 sm:pt-5 ${a?"flex flex-col gap-4":"flex flex-wrap items-center gap-4"}`,children:[(0,s.jsxs)("div",{className:`min-w-0 ${a?"flex w-full flex-col gap-3":"flex flex-1 flex-wrap items-center gap-4"}`,children:[(0,s.jsx)("label",{htmlFor:"cv-name",className:"sr-only",children:"CV Name (optional)"}),(0,s.jsx)("input",{id:"cv-name",type:"text",value:N,onChange:e=>V(e.target.value),placeholder:"CV name (optional)",className:`input-modern ${a?"w-full max-w-none":"max-w-xs"}`}),(0,s.jsx)(d.Checkbox,{checked:D,onCheckedChange:S,label:(0,s.jsx)("span",{className:X,children:"Save as draft (skip experience extraction)"}),className:a?"w-full items-start":"shrink-0"}),!D&&(0,s.jsx)(d.Checkbox,{checked:F,onCheckedChange:_,label:(0,s.jsx)("span",{className:X,children:"Update employment, education & projects from this CV (no duplicates)"}),className:a?"w-full items-start":"shrink-0"})]}),(0,s.jsx)(o.A,{type:"submit",disabled:M||L,className:a?"w-full shrink-0 sm:w-auto
1sm:self-end":"shrink-0","aria-label":t?"Replace master CV":"Upload CV","data-testid":"upload-cv-button",children:M?"Uploading...":t?"Replace master CV":"Upload CV"})]}),!g&&!a&&(0,s.jsx)("div",{className:"mt-5 border-t border-slate-200 pt-5 dark:border-slate-700",children:(0,s.jsx)(o.A,{type:"submit",disabled:!0,className:"shrink-0","aria-label":t?"Replace master CV":"Upload CV","data-testid":"upload-cv-button",children:"Upload CV"})}),T&&(0,s.jsx)(n.Alert,{id:"cv-upload-error",variant:"error",children:T})]})]})}}}]); 2//# sourceMappingURL=4585-406890afed58d535.js.map
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.