1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8060],{38060:function(e,a,t){t.r(a),t.d(a,{default:function(){return f}});var s=t(850),r=t(98776),n=t(5895),i=t(72784),l=t(27885),o=t(63829),d=t(69791),c=t(73527),u=t(92023),m=t(11336),x=t(38420),p=t(74837),h=t(15764),j=t(62260),b=t(68757),w=t(39722);function f(e){let{resumeId:a,resumeData:t,updateResumeData:f,updateSection:v,isDirty:g,lastSaved:_,saveToServer:N,canUndo:y,canRedo:T,onUndo:k,onRedo:C,job:R,onClose:E}=e,{toast:S}=(0,m.pm)(),{user:Z}=(0,x.a)(),[z,P]=(0,r.useState)("resume"),[U,D]=(0,r.useState)(!1),L=async e=>{let a=new FormData;a.append("resume_json",JSON.stringify(e.resume_json)),e.job_details_json&&a.append("job_details_json",JSON.stringify(e.job_details_json)),e.job_text&&a.append("job_text",e.job_text),a.append("user_id",e.user_id),a.append("optimization_level",e.optimization_level),a.append("json_output","false"),e.renderer&&a.append("renderer",e.renderer),e.template_engine&&a.append("template_engine",e.template_engine),e.latex_template&&a.append("latex_template",e.latex_template);let t=await fetch(h.Pn.OPTIMIZE_RESUME_JSON,{method:"POST",body:a});if(!t.ok){let e=await t.text().catch(()=>"Unknown error");throw Error("HTTP ".concat(t.status,": ").concat(e))}return t.blob()},O=async()=>{if(!Z||!R||!t){S({title:"Error",description:"Missing required information to download resume",variant:"destructive"});return}D(!0);try{var e;let a=null,s=!1,r=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;try{if(R.id)return await (0,p.Wx)(R.id,R.description||"","jobs");return await (0,p.zX)(R.description||"")}catch(a){if(e<2)return await new Promise(a=>setTimeout(a,1e3*(e+1))),r(e+1);throw a}};try{let e=await Promise.race([r(),new Promise((e,a)=>setTimeout(()=>a(Error("Job parsing timeout")),15e3))]);e.success&&e.data?(a=e.data.job_details,s=!0):s=!1}catch(e){console.warn("Job parsing error or timeout, will fallback to raw text:",e),s=!1}let n=await L({resume_json:t,job_details_json:a||void 0,job_text:s?void 0:R.description||"",user_id:Z.id,optimization_level:"standard",renderer:"latex",template_engine:"jinja2"}),i=window.URL.createObjectURL(n),l=document.createElement("a");l.href=i;let o=(null===(e=R.title)||void 0===e?void 0:e.replace(/[^a-zA-Z0-9]/g,"_"))||"resume";l.download="tailored_resume_".concat(o,".pdf"),document.body.appendChild(l),l.click(),document.body.removeChild(l),window.URL.revokeObjectURL(i),S({title:"Resume Downloaded!",description:"Your tailored resume has been downloaded successfully",variant:"default"})}catch(e){console.error("Error downloading resume:",e),S({title:"Error",description:"Failed to download resume. Please try again.",variant:"destructive"})}finally{D(!1)}},F=async()=>{await N()&&S({title:"Success",description:"Resume saved successfully"})};return(0,s.jsxs)("div",{className:"flex flex-col h-full bg-gray-50",children:[(0,s.jsx)("div",{className:"sticky top-0 z-20 bg-white border-b border-gray-200 px-4 py-3",children:(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)(c.z,{variant:"ghost",onClick:()=>{E()},className:"flex items-center",children:[(0,s.jsx)(n.Z,{className:"h-4 w-4 mr-2"}),"Close"]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(c.z,{variant:"outline",onClick:O,disabled:U||!Z||!R,className:"bg-brand text-white hover:bg-brand/90",children:U?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.Z,{className:"h-4 w-4 mr-2 animate-spin"}),"Generating..."]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.Z,{className:"h-4 w-4 mr-2"}),"Download PDF"]})}),(0,s.jsx)(c.z,{variant:"outline",onClick:F,disabled:!g,children:"Save Resume"})]})]})}),(0,s.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[(0,s.jsx)("div",{className:"w-80 border-r border-gray-200 bg-white overflow-y-auto",children:(0,s.jsx)(w.Z,{job:R,isLoading:!1})}),(0,s.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,s.jsx)("div",{className:"border-b border-gray-200 bg-white px-6",children:(0,s.jsx)(u.Tabs,{value:z,onValueChange:e=>P(e),children:(0,s.jsxs)(u.TabsList,{className:"grid w-full max-w-md grid-cols-2",children:[(0,s.jsxs)(u.TabsTrigger,{value:"resume",className:"flex items-center gap-2",children:[(0,s.jsx)(o.Z,{className:"h-4 w-4"}),"Resume"]}),(0,s.jsxs)(u.TabsTrigger,{value:"cover-letter",className:"flex items-center gap-2",children:[(0,s.jsx)(d.Z,{className:"h-4 w-4"}),"Cover Letter"]})]})})}),(0,s.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,s.jsxs)(u.Tabs,{value:z,onValueChange:e=>P(e),children:[(0,s.jsx)(u.TabsContent,{value:"resume",className:"m-0 h-full",children:(0,s.jsx)(j.Z,{resumeId:a,resumeData:t,updateResumeData:f,updateSection:v,job:R,canUndo:y,canRedo:T,onUndo:k,onRedo:C})}),(0,s.jsx)(u.TabsContent,{value:"cover-letter",className:"m-0 h-full",children:(0,s.jsx)(b.Z,{job:R,resumeData:t,resumeId:a})})]})})]})]})]})}}}]);
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.