PageSourceSearch

https://internup.org/_next/static/chunks/5770-0cb7cdea96e86098.js

js internup.org collected 2026-10-02 02:05:11 UTC 99,943 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5770],{5646:function(e,s,t){t.d(s,{l:function(){return u}});var i=t(850),n=t(98776),l=t(73527),a=t(72784),r=t(69124),o=t(11336),d=t(38420),c=t(69229),m=t(98111),x=t(15741);function u(e){let{job:s,className:u="",buttonClassName:h="",buttonSize:p="default"}=e,{toast:f}=(0,o.pm)(),{user:g}=(0,d.a)(),b=(0,x.useRouter)(),[v,j]=(0,n.useState)(!1),[w,y]=(0,n.useState)(null),[N,k]=(0,n.useState)(!1),[z,_]=(0,n.useState)(!1),[S,C]=(0,n.useState)(!1),[A,E]=(0,n.useState)(!0),R=(0,n.useCallback)(async()=>{if(!(null==g?void 0:g.id)||!s.id){C(!1),E(!1);return}E(!0);try{let e=(await Promise.resolve().then(t.bind(t,613))).createClient(),{data:i,error:n}=await e.from("resume_versions").select("id").eq("user_id",g.id).eq("job_id",s.id).not("full_resume_json","is",null).order("version_number",{ascending:!1}).limit(1).maybeSingle();n||C(!!i)}catch(e){console.error("Error checking tailored resume state:",e)}finally{E(!1)}},[s.id,null==g?void 0:g.id]);(0,n.useEffect)(()=>{R()},[R]);let T=async()=>{if(!(null==g?void 0:g.id))return console.log("[getPrimaryResumeId] No user ID"),null;try{let e=(await Promise.resolve().then(t.bind(t,613))).createClient();console.log("[getPrimaryResumeId] Looking for resumes for user:",g.id);let{data:s,error:i}=await e.from("user_documents").select("id, type, is_primary, deleted_at, status, title").eq("user_id",g.id).eq("type","resume");console.log("[getPrimaryResumeId] All resumes found:",s,"Error:",i);let{data:n,error:l}=await e.from("user_documents").select("id").eq("user_id",g.id).eq("type","resume").eq("is_primary",!0).is("deleted_at",null).maybeSingle();if(console.log("[getPrimaryResumeId] Primary resume:",n,"Error:",l),null==n?void 0:n.id)return n.id;let{data:a,error:r}=await e.from("user_documents").select("id").eq("user_id",g.id).eq("type","resume").is("deleted_at",null).order("updated_at",{ascending:!1}).limit(1).maybeSingle();return console.log("[getPrimaryResumeId] Any resume fallback:",a,"Error:",r),(null==a?void 0:a.id)||null}catch(e){return console.error("Error fetching primary resume:",e),null}},M=async()=>{if(!g){f({title:"Authentication Required",description:"Please sign in to tailor your submission",variant:"destructive"});return}k(!0);try{let e=await T();if(!e){_(!0);return}y(e),j(!0)}catch(e){console.error("Error opening tailoring modal:",e),f({title:"Error",description:"Failed to open tailoring view. Please try again.",variant:"destructive"})}finally{k(!1)}};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{className:u,children:(0,i.jsx)(l.z,{variant:"outline",onClick:M,disabled:N||A||!g,size:p,className:"flex items-center rounded-[10px] border border-brand bg-brand text-white hover:border-brand-600 hover:bg-brand-600 hover:text-white ".concat(h),children:N||A?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(a.Z,{className:"h-4 w-4 mr-2 animate-spin"}),N?"Opening…":"Checking resume…"]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.Z,{className:"mr-2 h-4 w-4 text-current"}),S?"Open tailored resume":"Tailor Resume"]})})}),v&&w&&(0,i.jsx)(c.bv,{isOpen:v,onClose:()=>{j(!1),y(null),R()},job:s,resumeId:w}),(0,i.jsx)(m.Vq,{open:z,onOpenChange:_,children:(0,i.jsxs)(m.cZ,{className:"sm:max-w-md",children:[(0,i.jsx)(m.fK,{children:(0,i.jsx)(m.$N,{children:"Add your resume to tailor submissions"})}),(0,i.jsx)("p",{className:"text-sm text-gray-600",children:"Upload or create a resume so we can tailor it to this job. You can add one now and come back to tailor instantly."}),(0,i.jsxs)(m.cN,{className:"gap-2 sm:gap-0",children:[(0,i.jsx)(l.z,{variant:"outline",onClick:()=>_(!1),children:"Cancel"}),(0,i.jsx)(l.z,{onClick:()=>{_(!1),b.push("/users/resume-builder")},children:"Go to Resume Manager"})]})]})})]})}},69229:function(e,s,t){t.d(s,{bv:function(){return eC}});var i=t(850),n=t(98776),l=t(81101),a=t(72784),r=t(15754),o=t(98111),d=t(73527),c=t(11336),m=t(38420),x=t(7731),u=t(73474),h=t(54463),p=t(92647),f=t(30199),g=t(71934),b=t(2008),v=t(11700);let j=(0,n.memo)(function(e){let{score:s,isAnalyzing:t=!1,size:n=180,label:l="Match score"}
1=e,r=Math.min(Math.max(Math.round(s),0),100),o=(n-12)/2,d=2*o*Math.PI/2;return(0,i.jsx)("div",{className:"relative flex select-none flex-col items-center justify-center",style:{width:n,height:n/1.45},role:"img","aria-label":"".concat(r,"% ").concat(l.toLowerCase()),children:t?(0,i.jsxs)("div",{className:"flex flex-col items-center justify-center h-full pb-8",children:[(0,i.jsx)(a.Z,{className:"h-10 w-10 animate-spin text-brand mb-2"}),(0,i.jsx)("span",{className:"text-xs text-gray-400 font-medium",children:"Calculating..."})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"relative",style:{width:n,height:n/2},children:[(0,i.jsxs)("svg",{width:n,height:n/2,viewBox:"0 0 ".concat(n," ").concat(n/2),className:"overflow-visible",children:[(0,i.jsx)("path",{d:"M ".concat(6,",").concat(n/2," A ").concat(o," ").concat(o," 0 0 1 ").concat(n-6,",").concat(n/2),fill:"none",stroke:"#E5E7EB",strokeWidth:12,strokeLinecap:"round"}),(0,i.jsx)("path",{d:"M ".concat(6,",").concat(n/2," A ").concat(o," ").concat(o," 0 0 1 ").concat(n-6,",").concat(n/2),fill:"none",stroke:r>=70?"#36BA98":r>=50?"#D97706":"#71717A",strokeWidth:12,strokeDasharray:d,strokeDashoffset:d-r/100*d,strokeLinecap:"round",className:"transition-all duration-1000 ease-out"})]}),(0,i.jsx)("div",{className:"absolute inset-0 flex flex-col items-center justify-end pb-1",children:(0,i.jsxs)("div",{className:"text-[34px] font-bold leading-none tracking-[-0.05em] text-zinc-950 transition-all duration-700",children:[r,"%"]})})]}),(0,i.jsx)("div",{className:"mt-2 text-xs font-semibold text-zinc-500",children:l})]})})});var w=t(32480);let y=e=>Math.max(0,Math.min(100,Math.round(e))),N=e=>Array.from(new Set(e.map(e=>null==e?void 0:e.trim()).filter(e=>!!e)));function k(e,s){var t,i,n,l,a,r,o,d,c,m,x;let u=(0,w.d)(e.recommendationScore),h=e.recommendationBreakdown,p=h?[{label:"Skills coverage",value:y(h.skillsScore)},{label:"Profile fit",value:y(h.contentScore)},..."number"==typeof h.requirementsScore?[{label:"Must-haves",value:y(h.requirementsScore)}]:[],..."number"==typeof h.responsibilitiesScore?[{label:"Day-to-day",value:y(h.responsibilitiesScore)}]:[],{label:"Preferences",value:y(h.preferencesScore)}]:[],f=N(null!==(d=null!==(o=(null===(t=e.matchedSkills)||void 0===t?void 0:t.length)?[...e.matchedSkills].sort((e,s)=>{var t,i;return(null!==(t=s.similarity)&&void 0!==t?t:0)-(null!==(i=e.similarity)&&void 0!==i?i:0)}).map(e=>e.name):null===(n=e.semanticSkillMatch)||void 0===n?void 0:null===(i=n.matched)||void 0===i?void 0:i.map(e=>e.name))&&void 0!==o?o:null==s?void 0:s.skills.matched.map(e=>e.jobSkill))&&void 0!==d?d:[]),g=new Set(f.map(e=>e.toLowerCase())),b=N([...null!==(c=null===(l=e.semanticSkillMatch)||void 0===l?void 0:l.partial)&&void 0!==c?c:[],...null!==(m=null===(a=e.semanticSkillMatch)||void 0===a?void 0:a.missing)&&void 0!==m?m:[]].map(e=>e.name)).filter(e=>!g.has(e.toLowerCase()));return 0===b.length&&(null===(r=e.skills)||void 0===r?void 0:r.length)&&(b=N(e.skills.map(e=>e.name)).filter(e=>!g.has(e.toLowerCase()))),0===b.length&&(b=N(null!==(x=null==s?void 0:s.skills.missing.map(e=>e.skill))&&void 0!==x?x:[])),{overallScore:null!=u?u:null==s?void 0:s.score.overall,metrics:p,matchedSkills:f,missingSkills:b,usesJobPageAnalysis:void 0!==u}}function z(e){let{operation:s}=e,t="loading_saved"===s,n=t?"Loading your saved analysis":"Generating a new analysis";return(0,i.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-3","aria-label":n,children:[(0,i.jsxs)("div",{className:"flex shrink-0 items-start gap-3",children:[(0,i.jsx)(a.Z,{className:"mt-0.5 h-4 w-4 shrink-0 animate-spin text-zinc-700","aria-hidden":"true"}),(0,i.jsxs)("div",{children:[(0,i.jsx)("h2",{className:"text-sm font-bold text-zinc-950",children:n}),(0,i.jsx)("p",{className:"mt-0.5 text-xs leading-5 text-zinc-500",children:t?"Restoring the latest analysis for this resume and job.":"Comparing this resume with the job requirements. This can take a moment."})]})]}),(0,i.jsxs)("div",{className:"grid min-h-0 flex-1 grid-rows-[190px_minmax(0,1fr)] gap-3",children:[(0,i.jsxs)("section",{className:"grid overflow-hidden rounded-[14px] bg-zinc-100 md:grid-cols-[200px_minmax(0,1fr)]",children:[(0,i.jsx)("div",{className:"flex items-center justify-center border-b border-zinc-200 px-4 py-3 md:border-b-0 md:border-r",children:(0,i.jsx)(g.O,{className:"h-[136px] w-[136px] rounded-full"})}),(0,i.jsxs)("div",{className:"min-w-0 px-5 py-4",children:[(0,i.jsxs)("div",{className:"border-b border-zinc-200 pb-3",children:[(0,i.jsx)(g.O,{className:"h-4 w-32 rounded-[8px]"}),(0,i.jsx)(g.O,{className:"mt-2 h-3 w-full max-w-[560px] rounded-[8px]"}),(0,i.jsx)(g.O,{className:"mt-1.5 h-3 w-4/5 max-w-[440px] rounded-[8px]"})]}),(0,i.jsx)("div",{className:"mt-3 grid grid-cols-2 gap-x-7 gap-y-3 lg:grid-cols-5",children:[0,1,2,3,4].map(e=>(0,i.jsxs)("div",{children:[(0,i.jsx)(g.O,{className:"h-3 w-20 rounded-[8px]"}),(0,i.jsx)(g.O,{className:"mt-2 h-5 w-12 rounded-[8px]"})]},e))})]})]}),(0,i.jsxs)("section",{className:"flex min-h-0 flex-col overflow-hidden rounded-[14px] border border-zinc-200 bg-white",children:[(0,i.jsxs)("div",{className:"flex shrink-0 items-center justify-between border-b border-zinc-200 px-5 py-3",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)(g.O,{className:"h-4 w-24 rounded-[8px]"}),(0,i.jsx)(g.O,{className:"mt-2 h-3 w-32 rounded-[8px]"})]}),(0,i.jsx)(g.O,{className:"h-3 w-40 rounded-[8px]"})]}),(0,i.jsx)("div",{className:"grid min-h-0 flex-1 md:grid-cols-2",children:[0,1].map(e=>(0,i.jsxs)("div",{className:"px-5 py-4 first:border-b first:border-zinc-200 md:first:border-b-0 md:first:border-r",children:[(0,i.jsx)(g.O,{className:"h-3 w-28 rounded-[8px]"}),(0,i.jsx)("div",{className:"mt-3 flex flex-wrap gap-2",children:[88,112,72,128,96].map((s,t)=>(0,i.jsx)(g.O,{className:"h-7 rounded-[8px]",style:{width:s}},"".concat(e,"-").concat(t)))})]},e))})]})]})]})}function _(e){let{skills:s,matched:t}=e;return 0===s.length?(0,i.jsx)("p",{className:"text-sm text-zinc-500",children:"None identified."}):(0,i.jsx)("div",{className:"flex flex-wrap gap-2",children:s.map(e=>(0,i.jsx)("span",{className:(0,v.cn)("rounded-[8px] px-2.5 py-1.5 text-xs font-semibold leading-none",t?"bg-brand text-white":"border border-zinc-300 bg-white text-zinc-800"),children:e},"".concat(t?"matched":"missing","-").concat(e)))})}let S=(0,n.memo)(function(e){var s,t,n;let{job:l,analysis:r,analysisState:o,analysisOperation:c="generating",resumes:m,selectedResumeId:x,loadingResumes:u,onResumeChange:h,analysisHistory:g,selectedAnalysisRunId:w,onAnalysisRunChange:y,onCustomize:N,onGenerate:S,onOpenExisting:C,onRetry:A}=e,E=m.find(e=>e.id===x),R="analyzing"===o||"idle"===o,T=k(l,r),M=Math.round(null!==(n=null!==(t=T.overallScore)&&void 0!==t?t:null==r?void 0:r.score.overall)&&void 0!==n?n:0),O=T.matchedSkills.length+T.missingSkills.length,D=(null==r?void 0:null===(s=r.score.explanation)||void 0===s?void 0:s.trim())||function(e,s,t){if(0===e.length)return t>0?"You match ".concat(s," of ").concat(t," identified job skills. Review the missing skills below before choosing what to tailor."):"Your resume was checked against this role. Review the skill match below before choosing what to tailor.";let i=e.reduce((e,s)=>s.value>e.value?s:e),n=e.reduce((e,s)=>s.value<e.value?s:e);return"You are strongest in ".concat(i.label.toLowerCase()," at ").concat(i.value,"%. ").concat(n.label," has the most room to improve at ").concat(n.value,"%.")}(T.metrics,T.matchedSkills.length,O);return(0,i.jsxs)("div",{className:"flex h-full flex-col overflow-hidden bg-white font-dm-sans",children:[(0,i.jsxs)("main",{className:"mx-auto flex min-h-0 w-full max-w-[1040px] flex-1 flex-col px-6 py-3.5",children:[(0,i.jsxs)("div",{className:"mb-3 flex shrink-0 flex-col justify-between gap-3 sm:flex-row sm:items-end",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h1",{className:"text-xl font-bold tracking-[-0.02em] text-zinc-950",children:"Resume analysis"}),(0,i.jsx)("p",{className:"mt-1 text-sm leading-5 text-zinc-600",children:"Understand the match, then choose what to improve."})]}),(0,i.jsxs)("div",{className:"flex w-full flex-col gap-3 sm:w-auto 
1sm:flex-row",children:[g.length>1&&(0,i.jsxs)("div",{className:"w-full sm:w-[220px]",children:[(0,i.jsx)("label",{className:"mb-1.5 block text-xs font-semibold text-zinc-700",htmlFor:"tailor-analysis-history-select",children:"Analysis history"}),(0,i.jsxs)(f.Ph,{value:w||void 0,onValueChange:y,children:[(0,i.jsx)(f.i4,{id:"tailor-analysis-history-select",className:"h-10 rounded-[10px] border-zinc-300 bg-white px-3 text-sm",children:(0,i.jsx)(f.ki,{placeholder:"Choose an analysis"})}),(0,i.jsx)(f.Bw,{children:g.map((e,s)=>(0,i.jsxs)(f.Ql,{value:e.id,children:[0===s?"Latest \xb7 ":"",new Date(e.createdAt).toLocaleString([],{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})]},e.id))})]})]}),(0,i.jsxs)("div",{className:"w-full sm:w-[300px]",children:[(0,i.jsx)("label",{className:"mb-1.5 block text-xs font-semibold text-zinc-700",htmlFor:"tailor-resume-select",children:"Resume being analyzed"}),(0,i.jsxs)(f.Ph,{value:x,onValueChange:h,disabled:u,children:[(0,i.jsx)(f.i4,{id:"tailor-resume-select",className:"h-10 rounded-[10px] border-zinc-300 bg-white px-3 text-sm",children:(0,i.jsx)(f.ki,{placeholder:u?"Loading resumes…":"Choose a resume",children:(null==E?void 0:E.title)||void 0})}),(0,i.jsx)(f.Bw,{children:m.map(e=>(0,i.jsx)(f.Ql,{value:e.id,children:e.title||"Untitled resume"},e.id))})]})]})]})]}),R&&(0,i.jsx)(z,{operation:c}),"error"===o&&!r&&(0,i.jsx)("div",{className:"flex min-h-0 flex-1 items-center justify-center rounded-[14px] border border-zinc-200 bg-white p-8 text-center",children:(0,i.jsxs)("div",{children:[(0,i.jsx)(p.Z,{className:"mx-auto h-6 w-6 text-zinc-500","aria-hidden":"true"}),(0,i.jsx)("h2",{className:"mt-4 text-base font-bold text-zinc-950",children:"Resume analysis is unavailable"}),(0,i.jsx)("p",{className:"mx-auto mt-2 max-w-md text-sm leading-6 text-zinc-600",children:"Try the analysis again, customize the defaults, or generate the resume immediately."}),(0,i.jsx)(d.z,{variant:"outline",onClick:A,className:"mt-5 rounded-[10px] border-zinc-300",children:"Try again"})]})}),r&&!R&&(0,i.jsxs)("div",{className:"grid min-h-0 flex-1 grid-rows-[190px_minmax(0,1fr)] gap-3",children:[(0,i.jsxs)("section",{className:"grid overflow-hidden rounded-[14px] bg-zinc-100 md:grid-cols-[200px_minmax(0,1fr)]",children:[(0,i.jsx)("div",{className:"flex items-center justify-center border-b border-zinc-200 px-4 py-3 md:border-b-0 md:border-r",children:(0,i.jsx)(j,{score:M,size:154,label:"Overall match"})}),(0,i.jsxs)("div",{className:"min-w-0 px-5 py-4",children:[(0,i.jsxs)("div",{className:"border-b border-zinc-200 pb-3",children:[(0,i.jsx)("h2",{className:"text-sm font-bold text-zinc-950",children:"Analysis summary"}),(0,i.jsx)("p",{className:"mt-1 text-sm leading-5 text-zinc-600",children:D})]}),T.metrics.length>0?(0,i.jsx)("div",{className:"mt-3 grid grid-cols-2 gap-x-7 gap-y-3 lg:grid-cols-5",children:T.metrics.map(e=>{let s=(0,b.o)(e.value);return(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsx)("p",{className:"truncate text-xs font-medium text-zinc-600",children:e.label}),(0,i.jsxs)("p",{className:(0,v.cn)("mt-1 text-xl font-bold leading-none tabular-nums",s.score),children:[e.value,"%"]})]},e.label)})}):(0,i.jsx)("p",{className:"mt-3 text-sm text-zinc-500",children:"A detailed score breakdown is not available for this job."})]})]}),(0,i.jsxs)("section",{className:"flex min-h-0 flex-col overflow-hidden rounded-[14px] border border-zinc-200 bg-white",children:[(0,i.jsxs)("div",{className:"flex shrink-0 items-center justify-between gap-4 border-b border-zinc-200 px-5 py-3",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h2",{className:"text-sm font-bold text-zinc-950",children:"Skills match"}),(0,i.jsxs)("p",{className:"mt-0.5 text-xs text-zinc-500",children:[T.matchedSkills.length," matched \xb7"," ",T.missingSkills.length," missing"]})]}),(0,i.jsx)("p",{className:"text-xs font-medium text-zinc-500",children:"Based on the job requirements"})]}),(0,i.jsxs)("div",{className:"grid min-h-0 flex-1 md:grid-cols-2",children:[(0,i.jsxs)("div",{className:"flex min-h-0 flex-col border-b border-zinc-200 px-5 py-3 md:border-b-0 md:border-r",children:[(0,i.jsxs)("div",{className:"mb-2 flex shrink-0 items-center justify-between gap-3",children:[(0,i.jsx)("h3",{className:"text-xs font-semibold text-zinc-700",children:"Matched skills"}),(0,i.jsx)("span",{className:"text-xs font-semibold tabular-nums text-zinc-400",children:T.matchedSkills.length})]}),(0,i.jsx)("div",{className:"min-h-0 overflow-y-auto pr-1",children:(0,i.jsx)(_,{skills:T.matchedSkills,matched:!0})})]}),(0,i.jsxs)("div",{className:"flex min-h-0 flex-col px-5 py-3",children:[(0,i.jsxs)("div",{className:"mb-2 flex shrink-0 items-center justify-between gap-3",children:[(0,i.jsx)("h3",{className:"text-xs font-semibold text-zinc-700",children:"Missing skills"}),(0,i.jsx)("span",{className:"text-xs font-semibold tabular-nums text-zinc-400",children:T.missingSkills.length})]}),(0,i.jsx)("div",{className:"min-h-0 overflow-y-auto pr-1",children:(0,i.jsx)(_,{skills:T.missingSkills,matched:!1})})]})]})]})]})]}),(0,i.jsx)("footer",{className:"shrink-0 border-t border-zinc-200 bg-white px-6 py-2.5",children:(0,i.jsxs)("div",{className:"mx-auto flex max-w-[1040px] items-center justify-end gap-4",children:[R&&(0,i.jsxs)("span",{className:"mr-auto flex items-center gap-2 text-sm text-zinc-500",children:[(0,i.jsx)(a.Z,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}),"loading_saved"===c?"Loading saved analysis…":"Generating analysis…"]}),(0,i.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[C&&
1(0,i.jsx)(d.z,{variant:"ghost",onClick:C,className:"h-9 rounded-[10px] px-3 text-sm font-semibold text-zinc-700",children:"Open existing version"}),(0,i.jsx)(d.z,{variant:"outline",onClick:N,disabled:R,className:"h-9 rounded-[10px] border-zinc-300 px-4 text-sm font-semibold text-zinc-900 hover:bg-zinc-50",children:"Customize"}),(0,i.jsx)(d.z,{onClick:S,disabled:R,className:"h-9 rounded-[10px] bg-brand px-4 text-sm font-semibold text-white hover:bg-brand-600",children:"Generate resume"})]})]})})]})});var C=t(19630),A=t(5895),E=t(24322),R=t(63113),T=t(47665),M=t(88513),O=t(35759);let D={summary:"Professional summary",skills:"Skills",experience:"Work experience",projects:"Projects",education:"Education"},F={aggressive:"Rewrites more content for stronger job alignment.",balanced:"Improves key sections while preserving your wording.",conservative:"Makes minimal changes and adds only supported terms."},L=[{key:"noNewSkills",label:"Use only supported skills",description:"Do not claim skills without evidence in your resume."},{key:"noFabricatedMetrics",label:"Do not invent metrics",description:"Keep achievements factual when the source has no numbers."},{key:"preserveDates",label:"Keep dates unchanged",description:"Preserve employment and education dates."},{key:"preserveJobTitles",label:"Keep job titles unchanged",description:"Do not rename previous roles."},{key:"preserveCompanyNames",label:"Keep company names unchanged",description:"Do not alter employer names."}];function I(e){let{id:s,checked:t,label:n,description:l,onCheckedChange:a,className:r}=e;return(0,i.jsxs)(T._,{htmlFor:s,className:(0,v.cn)("flex min-h-[48px] cursor-pointer items-start gap-3 rounded-[10px] bg-zinc-50 px-3 py-3 text-zinc-950 transition-colors hover:bg-zinc-100",r),children:[(0,i.jsx)(E.X,{id:s,checked:t,onCheckedChange:e=>a(!0===e),className:"mt-0.5 shrink-0 data-[state=checked]:border-brand data-[state=checked]:bg-brand"}),(0,i.jsxs)("span",{className:"min-w-0",children:[(0,i.jsx)("span",{className:"block text-sm font-semibold leading-5",children:n}),l&&(0,i.jsx)("span",{className:"mt-0.5 block truncate text-xs font-normal leading-4 text-zinc-500",children:l})]})]})}function P(e){var s;let{config:t,onChange:n}=e,l=D[s=t.name]||s.replace(/[_-]+/g," ").replace(/^./,e=>e.toUpperCase()),a="tailor-section-".concat(t.name);return(0,i.jsxs)("div",{className:"flex min-h-[52px] items-center border-b border-zinc-200 py-2 last:border-0",children:[(0,i.jsx)(E.X,{id:a,checked:t.enabled,onCheckedChange:e=>n(!0===e),className:"shrink-0 data-[state=checked]:border-brand data-[state=checked]:bg-brand"}),(0,i.jsx)(T._,{htmlFor:a,className:"ml-3 cursor-pointer text-sm font-semibold text-zinc-900",children:l})]})}function Z(e){let{skill:s,selected:t,onToggle:n}=e,l="tailor-skill-".concat(s.toLowerCase().replace(/[^a-z0-9]+/g,"-"));return(0,i.jsx)(I,{id:l,checked:t,label:s,onCheckedChange:n})}let B=(0,n.memo)(function(e){let{job:s,analysis:t,presets:l,selectedPreset:r,customSettings:c,selectedKeywords:m,customKeywords:x,additionalInstructions:u,isLoadingPresets:h,isGenerating:p,onPresetChange:f,onSettingsUpdate:b,onKeywordToggle:j,onCustomKeywordsChange:w,onAdditionalInstructionsChange:y,onBack:N,onGenerate:z}=e,[_,S]=(0,n.useState)(""),[E,D]=(0,n.useState)(!1),I=(0,n.useMemo)(()=>k(s,t).missingSkills,[s,t]),B=L.filter(e=>{let{key:s}=e;return c.guardrails[s]}).length,J=c.sections.filter(e=>e.enabled).length,q=I.length>0&&I.every(e=>m.includes(e)),U=(e,s)=>{b({sections:c.sections.map(t=>t.name===e?{...t,enabled:s,scope:"experience"===t.name?"full":t.scope}:t)})},G=(e,s)=>{b({guardrails:{...c.guardrails,[e]:s}})},K=()=>{let e=_.trim();!e||x.includes(e)||(w([...x,e]),S(""))};return(0,i.jsxs)("div",{className:"flex h-full flex-col overflow-hidden bg-white font-dm-sans",children:[(0,i.jsxs)("main",{className:"mx-auto flex min-h-0 w-full max-w-[1160px] flex-1 flex-col overflow-y-auto px-6 py-5",children:[(0,i.jsxs)("div",{className:"mb-5 shrink-0",children:[(0,i.jsx)("h1",{className:"text-xl font-bold tracking-[-0.02em] text-zinc-950",children:"Tailoring settings"}),(0,i.jsx)("p",{className:"mt-1 text-sm leading-5 text-zinc-600",children:"Choose how the resume should be tailored before generating it."})]}),(0,i.jsxs)("div",{className:"grid min-h-0 flex-1 gap-10 lg:grid-cols-2",children:[(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsxs)("section",{children:[(0,i.jsx)("h2",{className:"text-sm font-bold text-zinc-950",children:"Tailoring style"}),(0,i.jsx)("p",{className:"mt-0.5 text-xs text-zinc-500",children:"Choose edit strength."}),(0,i.jsx)("div",{className:"mt-3 grid min-w-0 gap-2 sm:grid-cols-3",children:h?[0,1,2].map(e=>(0,i.jsx)(g.O,{className:"h-[78px] rounded-[10px]"},e)):l.map(e=>{let s=(null==r?void 0:r.id)===e.id,t=F[e.name.toLowerCase()]||e.description;return(0,i.jsxs)("button",{type:"button",onClick:()=>f(e),className:(0,v.cn)("min-h-[78px] rounded-[10px] border px-3 py-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-950 focus-visible:ring-offset-2",s?"border-zinc-950 bg-zinc-950 text-white":"border-zinc-300 bg-white text-zinc-800 hover:border-zinc-500"),children:[(0,i.jsx)("span",{className:"block text-sm font-bold",children:e.name}),(0,i.jsx)("span",{className:(0,v.cn)("mt-0.5 block text-[11px] font-normal leading-4",s?"text-zinc-300":"text-zinc-500"),children:t})]},e.id)})})]}),(0,i.jsxs)("section",{className:"mt-6",children:[(0,i.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,i.jsx)("h2",{className:"text-sm font-bold text-zinc-950",children:"Sections to tailor"}),(0,i.jsxs)("span",{className:"shrink-0 text-xs font-semibold text-zinc-500",children:[J," selected"]})]}),(0,i.jsx)("div",{className:"mt-2",children:c.sections.map(e=>
1(0,i.jsx)(P,{config:e,onChange:s=>U(e.name,s)},e.name))})]})]}),(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsxs)("section",{children:[(0,i.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h2",{className:"text-sm font-bold text-zinc-950",children:"Skills to add"}),(0,i.jsx)("p",{className:"mt-0.5 text-xs text-zinc-500",children:"Nothing is selected automatically. Add only skills your experience supports."})]}),I.length>0&&(0,i.jsx)(d.z,{variant:"ghost",size:"sm",onClick:()=>{I.forEach(e=>{let s=m.includes(e);(q&&s||!q&&!s)&&j(e)})},className:"h-8 shrink-0 rounded-[10px] px-2.5 text-xs font-semibold text-zinc-700",children:q?"Clear all":"Select all"})]}),(0,i.jsx)("div",{className:"mt-4 min-h-[84px]",children:I.length>0||x.length>0?(0,i.jsxs)("div",{className:"grid gap-2 sm:grid-cols-2",children:[I.map(e=>(0,i.jsx)(Z,{skill:e,selected:m.includes(e),onToggle:()=>j(e)},e)),x.map(e=>(0,i.jsx)(Z,{skill:e,selected:!0,onToggle:()=>w(x.filter(s=>s!==e))},e))]}):(0,i.jsx)("p",{className:"text-sm text-zinc-500",children:"No missing job skills were identified."})}),(0,i.jsx)(T._,{htmlFor:"custom-skill",className:"sr-only",children:"Add a custom skill"}),(0,i.jsxs)("div",{className:"mt-4 flex gap-2",children:[(0,i.jsx)(R.I,{id:"custom-skill",value:_,onChange:e=>S(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),K())},placeholder:"Add another skill",className:"h-10 rounded-[10px] border-zinc-300 text-sm"}),(0,i.jsx)(d.z,{type:"button",variant:"outline",onClick:K,className:"h-10 rounded-[10px] border-zinc-300 px-3","aria-label":"Add custom skill",children:(0,i.jsx)(C.Z,{className:"h-4 w-4","aria-hidden":"true"})})]})]}),(0,i.jsxs)("section",{className:"mt-6",children:[(0,i.jsx)(T._,{htmlFor:"tailoring-instructions",className:"text-sm font-bold text-zinc-950",children:"Additional instructions"}),(0,i.jsx)(O.g,{id:"tailoring-instructions",value:u,onChange:e=>y(e.target.value),placeholder:"For example, emphasize QA automation experience.",className:"mt-3 min-h-[152px] resize-none rounded-[10px] border-zinc-300 text-sm"})]})]})]})]}),(0,i.jsx)("footer",{className:"shrink-0 border-t border-zinc-200 bg-white px-6 py-2.5",children:(0,i.jsxs)("div",{className:"mx-auto flex max-w-[1160px] items-center justify-between gap-4",children:[(0,i.jsxs)(d.z,{variant:"outline",onClick:N,disabled:p,className:"h-9 rounded-[10px] border-zinc-300 px-4",children:[(0,i.jsx)(A.Z,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),"Back to analysis"]}),(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsxs)(d.z,{type:"button",variant:"ghost",onClick:()=>D(!0),className:"h-9 rounded-[10px] px-3 text-xs font-semibold text-zinc-700",children:["Accuracy safeguards \xb7 ",B,"/",L.length]}),(0,i.jsxs)(d.z,{onClick:z,disabled:p||!r||0===J,className:"h-9 rounded-[10px] bg-brand px-5 text-sm font-semibold text-white hover:bg-brand-600",children:[p&&(0,i.jsx)(a.Z,{className:"mr-2 h-4 w-4 animate-spin","aria-hidden":"true"}),"Generate tailored resume"]})]})]})}),(0,i.jsx)(o.Vq,{open:E,onOpenChange:D,children:(0,i.jsxs)(o.cZ,{className:"rounded-[14px] font-dm-sans sm:max-w-[560px]",children:[(0,i.jsxs)(o.fK,{children:[(0,i.jsx)(o.$N,{className:"text-xl font-bold",children:"Accuracy safeguards"}),(0,i.jsx)(o.Be,{children:"These rules protect factual information while the resume is tailored."})]}),(0,i.jsx)("div",{className:"mt-2 divide-y divide-zinc-200",children:L.map(e=>(0,i.jsxs)("div",{className:"flex items-start justify-between gap-5 py-3",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)(T._,{htmlFor:"guardrail-".concat(e.key),className:"cursor-pointer text-sm font-semibold text-zinc-900",children:e.label}),(0,i.jsx)("p",{className:"mt-0.5 text-xs leading-4 text-zinc-500",children:e.description})]}),(0,i.jsx)(M.r,{id:"guardrail-".concat(e.key),checked:c.guardrails[e.key],onCheckedChange:s=>G(e.key,s),className:"mt-0.5 shrink-0 data-[state=checked]:bg-brand"})]},e.key))}),(0,i.jsx)(d.z,{onClick:()=>D(!1),className:"mt-2 h-10 rounded-[10px] bg-zinc-950 text-white hover:bg-zinc-800",children:"Done"})]})})]})});var J=t(51788),q=t(30604),U=t(69791),G=t(83973),K=t(20213),V=t(27885),W=t(57702),H=t(16980),$=t(59692),X=t(50609),Y=t(42572),Q=t(16009),ee=t(36414),es=t(2769),et=t(85872),ei=t(62394),en=t(31627),el=t(15764),ea=t(23564);let er={formal:{label:"Formal",description:"Professional tone for enterprise/consulting roles"},enthusiastic:{label:"Enthusiastic",description:"Energetic tone for startups and creative roles"},technical:{label:"Technical",description:"Emphasize technical depth and expertise"},story:{label:"Story-driven",description:"Narrative arc focusing on impact"}},eo={concise:{label:"Concise",words:250},standard:{label:"Standard",words:350},detailed:{label:"Detailed",words:500}};function ed(e){var s,t;
1let{isOpen:l,onClose:r,job:m,resumeData:x}=e,{toast:u}=(0,c.pm)(),[h,p]=(0,n.useState)("enthusiastic"),[g,b]=(0,n.useState)("standard"),[v,j]=(0,n.useState)(""),[w,y]=(0,n.useState)(!1),[N,k]=(0,n.useState)(""),[z,_]=(0,n.useState)(""),S=async()=>{y(!0);try{let e="Target approximately ".concat(eo[g].words," words."),s=[m.description||"","","Style guidance: ".concat({formal:"Use highly professional, formal language appropriate for enterprise/consulting roles.",enthusiastic:"Use energetic, passionate language suitable for startups and creative roles.",technical:"Emphasize technical depth and specific technologies. Use precise technical terminology.",story:"Structure as a narrative arc focusing on impact and transformation."}[h]),e,v?"Additional instructions: ".concat(v):""].filter(Boolean).join("\n"),t=await fetch(el.Pn.GENERATE_COVER_LETTER,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({job_description:s,user_name:(null==x?void 0:x.name)||"Candidate",resume_json:x})}),i=await t.json();if(!t.ok||!i.content)throw Error("Failed to generate cover letter");k(i.content),_(i.content),u({title:"Success",description:"Cover letter generated successfully!"})}catch(e){console.error("Error generating cover letter:",e),u({title:"Error",description:"Failed to generate cover letter. Please try again.",variant:"destructive"})}finally{y(!1)}};return(0,i.jsx)(o.Vq,{open:l,onOpenChange:r,children:(0,i.jsxs)(o.cZ,{className:"max-w-5xl h-[90vh] p-0 flex flex-col overflow-hidden",children:[(0,i.jsx)(o.fK,{className:"border-b px-6 py-4 shrink-0",children:(0,i.jsxs)("div",{className:"flex items-center gap-3",children:[(null===(s=m.company)||void 0===s?void 0:s.logo_url)&&(0,i.jsx)("img",{src:m.company.logo_url,alt:m.company.name||"Company",className:"w-10 h-10 rounded-lg object-cover"}),(0,i.jsxs)("div",{children:[(0,i.jsx)(o.$N,{className:"text-lg font-semibold",children:"Generate Cover Letter"}),(0,i.jsxs)("p",{className:"text-sm text-muted-foreground",children:[m.title," at ",null===(t=m.company)||void 0===t?void 0:t.name]})]})]})}),(0,i.jsxs)("div",{className:"flex-1 flex min-h-0 overflow-hidden",children:[(0,i.jsx)("div",{className:"w-80 border-r bg-gray-50/50 p-6 overflow-y-auto",children:(0,i.jsxs)("div",{className:"space-y-6",children:[(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsx)(T._,{className:"text-sm font-semibold",children:"Style Preset"}),(0,i.jsx)("div",{className:"grid grid-cols-2 gap-2",children:Object.keys(er).map(e=>(0,i.jsxs)("button",{onClick:()=>p(e),className:"p-3 rounded-lg border-2 text-left transition-all ".concat(h===e?"border-brand bg-brand/5":"border-gray-200 hover:border-brand/50 bg-white"),children:[(0,i.jsx)("div",{className:"text-sm font-semibold",children:er[e].label}),(0,i.jsx)("div",{className:"text-[10px] text-gray-500 mt-1",children:er[e].description})]},e))})]}),(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsx)(T._,{className:"text-sm font-semibold",children:"Length"}),(0,i.jsxs)(f.Ph,{value:g,onValueChange:e=>b(e),children:[(0,i.jsx)(f.i4,{className:"bg-white",children:(0,i.jsx)(f.ki,{})}),(0,i.jsx)(f.Bw,{children:Object.keys(eo).map(e=>(0,i.jsxs)(f.Ql,{value:e,children:[eo[e].label," (~",eo[e].words," words)"]},e))})]})]}),(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsx)(T._,{className:"text-sm font-semibold",children:"Custom Instructions (Optional)"}),(0,i.jsx)(O.g,{value:v,onChange:e=>j(e.target.value),placeholder:"e.g., Emphasize leadership experience, mention certifications...",rows:4,className:"resize-none text-sm bg-white"})]}),(0,i.jsx)(d.z,{onClick:S,disabled:w,className:"w-full h-11 bg-brand hover:bg-brand/90",children:w?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(a.Z,{className:"mr-2 h-4 w-4 animate-spin"}),"Generating..."]}):(0,i.jsx)(i.Fragment,{children:"Generate Cover Letter"})}),(0,i.jsx)("div",{className:"text-center mt-2",children:(0,i.jsx)(ea.eM,{feature:"cover_letter_gen"})})]})}),(0,i.jsx)("div",{className:"flex-1 flex flex-col min-w-0",children:N?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{className:"flex-1 p-6 overflow-y-auto",children:(0,i.jsx)(O.g,{value:z,onChange:e=>_(e.target.value),className:"min-h-full font-serif text-base leading-relaxed resize-none border-none focus-visible:ring-0 p-4",placeholder:"Your cover letter will appear here..."})}),(0,i.jsxs)("div",{className:"border-t p-4 bg-gray-50/50 flex items-center justify-between shrink-0",children:[(0,i.jsxs)("div",{className:"text-xs text-gray-500",children:[z.split(/\s+/).filter(
1Boolean).length," words"]}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsxs)(d.z,{variant:"outline",size:"sm",onClick:()=>{navigator.clipboard.writeText(z),u({title:"Copied!",description:"Cover letter copied to clipboard"})},children:[(0,i.jsx)(en.Z,{className:"h-4 w-4 mr-2"}),"Copy"]}),(0,i.jsxs)(d.z,{variant:"outline",size:"sm",onClick:()=>{var e;let s=new Blob([z],{type:"application/msword"}),t=URL.createObjectURL(s),i=document.createElement("a");i.href=t,i.download="cover-letter-".concat((null===(e=m.company)||void 0===e?void 0:e.name)||"job",".doc"),i.click(),URL.revokeObjectURL(t),u({title:"Downloaded",description:"Cover letter downloaded as Word document"})},children:[(0,i.jsx)(H.Z,{className:"h-4 w-4 mr-2"}),"Download Word"]})]})]})]}):(0,i.jsx)("div",{className:"flex-1 flex items-center justify-center text-center p-8",children:(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsx)(U.Z,{className:"h-16 w-16 text-gray-300 mx-auto"}),(0,i.jsxs)("div",{children:[(0,i.jsx)("h3",{className:"font-semibold text-lg text-gray-900",children:"No cover letter yet"}),(0,i.jsx)("p",{className:"text-sm text-gray-500 max-w-xs mx-auto mt-1",children:'Configure your preferences and click "Generate Cover Letter" to create one'})]})]})})})]})]})})}var ec=t(72137);function em(e){let{resumeId:s,jobTitle:t,companyName:n}=e;return(0,i.jsx)("div",{className:"h-full min-h-0 bg-white",children:(0,i.jsx)(ec.N,{isExpanded:!0,onToggle:()=>void 0,resumeId:s,variant:"job-tailoring",jobTitle:t,companyName:n})})}var ex=t(53610),eu=t(50394),eh=t(12457),ep=t(12627),ef=t(12317),eg=t(58086);let eb=(0,n.memo)(function(e){var s;let{job:t,generatedResume:l,originalResume:r,resumeId:o,onRegenerate:d,onReanalyze:c,versions:m=[],onVersionSelect:x,onLoadAllVersions:u}=e,[h,p]=(0,n.useState)("tailored"),f=(null==l?void 0:l.tailoredResumeJson)||(null==l?void 0:l.fullResumeJson);if(!l||!f)return(0,i.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,i.jsxs)("div",{className:"text-center space-y-4",children:[(0,i.jsx)(a.Z,{className:"h-8 w-8 animate-spin mx-auto text-brand"}),(0,i.jsx)("p",{className:"text-gray-600",children:"Loading generated resume..."})]})});let g="Resume for ".concat((null===(s=t.company)||void 0===s?void 0:s.name)||"Job Application");return(0,i.jsx)(ex.K,{resumeId:o,resumeTitle:g,initialData:f,children:(0,i.jsx)(ev,{resumeId:o,resumeTitle:g,originalResume:r,generatedResume:l,viewMode:h,onToggleViewMode:p,onRegenerate:d,onReanalyze:c,versions:m,onVersionSelect:x,onLoadAllVersions:u,currentVersionId:l.versionId,jobApplyLink:t.apply_link,job:t})},l.versionId||"new-tailored-resume")});function ev(e){var s;let{resumeId:t,resumeTitle:l,originalResume:r,generatedResume:o,viewMode:m,onToggleViewMode:x,onRegenerate:u,onReanalyze:h,versions:p,onVersionSelect:g,onLoadAllVersions:b,currentVersionId:j,jobApplyLink:w,job:y}=e,{state:N,setTailoringContext:k,switchVersion:z}=(0,ex._)(),{toast:_}=(0,c.pm)(),[S,C]=(0,n.useState)("ai-edit"),[A,E]=(0,n.useState)(1.25),[R,T]=(0,n.use
1State)(!1),[M,O]=(0,n.useState)(!1),D=o.diffOperations;(0,n.useEffect)(()=>{z(o.tailoredResumeJson||o.fullResumeJson,j||null,D,o.keywordsAdded,!0)},[j,D,o,z]),(0,n.useEffect)(()=>{k(y.id,p,!0)},[y.id,k,p]);let F="original"===m&&r||N.resume,L="tailored"===m&&o.keywordsAdded||[],I="tailored"===m?N.diffOperations:void 0,P=Math.round(o.scoreBefore||0),Z=Math.round(o.scoreAfter||0),B=Z-P,en=new Set((o.changes||[]).map(e=>e.section).filter(Boolean)).size,el=[en>0?"".concat(en," ").concat(1===en?"section":"sections"," updated"):null,L.length>0?"".concat(L.length," ").concat(1===L.length?"skill":"skills"," added"):null].filter(Boolean).join(" \xb7 "),ea=e=>{let s=l.replace(/[^a-zA-Z0-9]/g,"_");return"resume-".concat(s,".").concat(e)},er=(e,s)=>{let t=URL.createObjectURL(e),i=document.createElement("a");i.href=t,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(t)},eo=async()=>{T(!0);try{let e=await (0,Q.eA)((0,i.jsx)(eg.q,{resume:N.resume})).toBlob();er(e,ea("pdf")),_({title:"PDF downloaded"})}catch(e){console.error("Download error:",e),_({title:"Download Failed",description:"Failed to generate PDF",variant:"destructive"})}finally{T(!1)}},ec=async()=>{T(!0);try{let e=N.resume,s=(0,ei.L)(e,l),t=await et.UDs.toBuffer(s),i=new Blob([new Uint8Array(t)],{type:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"});er(i,ea("docx")),_({title:"Word document downloaded"})}catch(e){console.error("Word download error:",e),_({title:"Word export failed",description:e instanceof Error?e.message:"Unable to export Word document",variant:"destructive"})}finally{T(!1)}};return(0,i.jsxs)("div",{className:"flex h-full flex-col bg-white font-dm-sans",children:[(0,i.jsxs)("div",{className:"flex min-h-[64px] flex-shrink-0 items-center justify-between gap-4 border-b border-zinc-200 bg-white px-4",children:[(0,i.jsxs)("div",{className:"flex min-w-0 items-center gap-4",children:[(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsx)("h1",{className:"max-w-[220px] truncate text-sm font-bold text-zinc-950",children:l}),(0,i.jsxs)("p",{className:"mt-0.5 max-w-[300px] truncate text-xs text-zinc-500",children:["Tailored for ",y.title," \xb7 Original preserved"]})]}),(0,i.jsx)("div",{className:"hidden h-9 items-center rounded-[10px] border border-zinc-200 bg-zinc-50 p-0.5 sm:flex",children:["original","tailored"].map(e=>(0,i.jsx)("button",{type:"button",onClick:()=>x(e),className:(0,v.cn)("h-8 rounded-[8px] px-3 text-xs font-semibold transition-colors",m===e?"bg-white text-zinc-950 shadow-sm":"text-zinc-500 hover:text-zinc-900"),children:"original"===e?"Original":"Tailored version"},e))}),"tailored"===m&&(0,i.jsx)("div",{className:"hidden h-9 items-center rounded-[10px] border border-zinc-200 bg-white p-0.5 lg:flex",children:["ai-edit","editor","design"].map(e=>(0,i.jsx)("button",{type:"button",onClick:()=>C(e),className:(0,v.cn)("h-8 rounded-[8px] px-3 text-xs font-semibold transition-colors",S===e?"bg-zinc-950 text-white":"text-zinc-500 hover:bg-zinc-100 hover:text-zinc-900"),children:"ai-edit"===e?(0,i.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,i.jsx)(J.Z,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"AI edit"]}):"editor"===e?"Edit":"Design"},e))}),p.length>0&&(0,i.jsxs)(f.Ph,{value:j,onValueChange:e=>null==g?void 0:g(e),children:[(0,i.jsx)(f.i4,{onPointerDown:()=>void(null==b||b()),className:"hidden h-9 w-[150px] rounded-[10px] border-zinc-300 text-xs xl:flex",children:(0,i.jsx)(f.ki,{placeholder:"Version history"})}),(0,i.jsx)(f.Bw,{children:p.map((e,s)=>(0,i.jsxs)(f.Ql,{value:e.id,children:["Version ",p.length-s,0===s?" \xb7 Latest":""]},e.id))})]})]}),(0,i.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[(0,i.jsx)(eh.N,{disabled:"tailored"!==m}),"tailored"===m&&(0,i.jsx)("div",{className:"hidden xl:block",children:(0,i.jsx)(ep.h,{})}),(0,i.jsx)("div",{className:"hidden h-6 w-px bg-zinc-200 lg:block"}),(0,i.jsx)(d.z,{onClick:()=>O(!0),variant:"outline",size:"sm",className:"hidden h-9 rounded-[10px] border-zinc-300 px-3 text-xs font-semibold lg:flex",children:"Cover letter"}),(0,i.jsxs)(es.h_,{children:[(0,i.jsx)(es.$F,{asChild:!0,children:(0,i.jsx)(d.z,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-[9px] text-zinc-600 hover:bg-zinc-100 hover:text-zinc-950","aria-label":"More resume actions",children:(0,i.jsx)(q.Z,{className:"h-4 w-4","aria-hidden":"true"})})}),(0,i.jsxs)(es.AW,{align:"end",className:"w-48",children:[(0,i.jsxs)(es.Xi,{onClick:()=>O(!0),className:"lg:hidden",children:[(0,i.jsx)(U.Z,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),"Create cover letter"]}),(0,i.jsxs)(es.Xi,{onClick:h,children:[(0,i.jsx)(G.Z,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),"Reanalyze fit"]}),(0,i.jsxs)(es.Xi,{onClick:u,children:[(0,i.jsx)(K.Z,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),"Retailor resume"]})]})]}),(0,i.jsxs)(es.h_,{children:[(0,i.jsx)(es.$F,{asChild:!0,children:(0,i.jsxs)(d.z,{size:"sm",disabled:R,className:"h-9 rounded-[10px] bg-brand text-xs font-semibold text-white hover:bg-brand-600",children:[R?(0,i.jsx)(a.Z,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,i.jsx)(V.Z,{className:"mr-1.5 h-3.5 w-3.5"}),"Download",(0,i.jsx)(W.Z,{className:"ml-1 h-3.5 w-3.5","aria-hidden":"true"})]})}),(0,i.jsxs)(es.AW,{align:"end",children:[(0,i.jsxs)(es.Xi,{onClick:eo,children:[(0,i.jsx)(U.Z,{className:"mr-2 h-4 w-4"}),"Download PDF"]}),(0,i.jsxs)(es.Xi,{onClick:ec,children:[(0,i.jsx)(H.Z,{className:"mr-2 h-4 w-4"}),"Download Word"]})]})]})]})]}),"tailored"===m&&P>0&&Z>0&&(0,i.jsxs)("div",{className:"flex min-h-12 shrink-0 items-center gap-3 border-b border-zinc-200 bg-white px-4 text-xs",children:[(0,i.jsx)("span",{className:"font-semibold text-zinc-600",children:"Resume fit"}),(0,i.jsxs)("span",{className:"font-bold tabular-nums text-zinc-500",children:[P,"%"]}),(0,i.jsx)($.Z,{className:"h-3.5 w-3.5 text-zinc-400","aria-hidden":"true"}),(0,i.jsxs)("span",{className:"text-base font-bold tabular-nums text-brand-700",children:[Z,"%"]}),0!==B&&(0,i.jsxs)("span",{className:(0,v.cn)("font-bold tabular-nums",B>0?"text-brand-700":"text-red-600"),children:[B>0?"+":"",B]}),el&&(0,i.jsx)("span",{className:"ml-auto truncate font-medium text-zinc-500",children:el})]}),M&&(0,i.jsx)(ed,{isOpen:M,onClose:()=>O(!1),job:y,resumeData:N.resume}),(0,i.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,i.jsxs)(ee.ZA,{orientation:"horizontal",children:[(0,i.jsx)(ee.s_,{id:"editor",defaultSize:50,minSize:30,maxSize:70,children:(0,i.jsx)("div",{className:"h-full overflow-hidden border-r border-zinc-200 bg-white",children:"tailored"===m?"ai-edit"===S?(0,i.jsx)(em,{resumeId:t,jobTitle:y.title,companyName:null===(s=y.company)||void 0===s?void 0:s.name}):(0,i.jsx)(eu.z,{mode:S,showAiAssistant:!1,resumeId:t}):(0,i.jsx)("div",{className:"flex h-full items-center justify-center p-8",children:(0,i.jsxs)("div",{className:"max-w-xs text-center",children:[(0,i.jsx)("h2",{className:"text-base font-bold text-zinc-950",children:"Original resume"}),(0,i.jsx)("p",{className:"mt-2 text-sm leading-6 text-zinc-600",children:"This is a read-only reference. Switch to the tailored version to make edits."}),(0,i.jsx)(d.z,{onClick:()=>x("tailored"),className:"mt-5 rounded-[10px] bg-zinc-950 text-white hover:bg-zinc-800",children:"Edit tailored version"})]})})})}),(0,i.jsx)(ee.Z0,{className:"group flex w-2 items-center justify-center bg-zinc-100 transition-colors hover:bg-zinc-200",children:(0,i.jsx)(X.Z,{className:"h-4 w-4 text-zinc-400"})}),(0,i.jsx)(ee.s_,{id:"preview",defaultSize:50,minSize:30,maxSize:70,children:(0,i.jsx)("div",{className:"h-full overflow-y-auto bg-zinc-100",children:(0,i.jsx)(ef.k,{resume:F,scale:A,fit:"width",onScaleChange:E,diffOperations:I})})})]})}),w&&(0,i.jsx)("div",{className:"flex shrink-0 justify-center border-t border-zinc-200 bg-white px-4 py-2",children:(0,i.jsxs)(d.z,{onClick:()=>window.open(w,"_blank"),variant:"ghost",className:"flex h-9 items-center gap-2 rounded-[10px] text-sm font-semibold text-zinc-700 hover:bg-zinc-100 hover:text-zinc-950",children:["Apply for this job",(0,i.jsx)(Y.Z,{className:"h-4 w-4"})]})})]})}var ej=t(39844);let ew=[{id:"analysis",label:"Analysis"},{id:"customize",label:"Customize"},{id:"editor",label:"Resume editor"}
1],ey={analysis:0,customize:1,editor:2};function eN(e){let{current:s,availableStages:t=ew.map(e=>e.id),onStageChange:n,className:l,compact:a=!1}=e,r=ey[s],o=Math.max(...t.map(e=>ey[e]));return(0,i.jsx)("nav",{"aria-label":"Tailor resume progress",className:(0,v.cn)(!a&&"border-b border-zinc-200 bg-white",l),children:(0,i.jsx)("ol",{className:(0,v.cn)("mx-auto flex items-center",a?"h-auto max-w-none px-0":"h-14 max-w-[1180px] px-6"),children:ew.map((e,s)=>{let l=t.includes(e.id),d=s===r,c=s<o&&!d;return(0,i.jsxs)("li",{className:"flex min-w-0 flex-1 items-center last:flex-none",children:[(0,i.jsxs)("button",{type:"button",disabled:!l,onClick:()=>null==n?void 0:n(e.id),"aria-label":e.label,className:(0,v.cn)("flex items-center font-medium outline-none focus-visible:ring-2 focus-visible:ring-zinc-950 focus-visible:ring-offset-2 disabled:cursor-not-allowed",a?"gap-1.5 text-xs":"gap-2 text-sm",d?"text-zinc-950":l?"cursor-pointer text-zinc-700 hover:text-zinc-950":"text-zinc-400"),"aria-current":d?"step":void 0,children:[(0,i.jsx)("span",{className:(0,v.cn)("flex shrink-0 items-center justify-center rounded-full border font-semibold",a?"h-5 w-5 text-[10px]":"h-6 w-6 text-xs",d&&"border-zinc-950 bg-zinc-950 text-white",c&&"border-brand bg-brand text-white",!d&&!c&&"border-zinc-300 bg-white text-zinc-500"),children:c?(0,i.jsx)(ej.Z,{className:"h-3.5 w-3.5","aria-hidden":"true"}):s+1}),(0,i.jsx)("span",{className:"truncate",children:e.label})]}),s<ew.length-1&&(0,i.jsx)("span",{"aria-hidden":"true",className:(0,v.cn)("h-px flex-1",a?"mx-2 min-w-4":"mx-4 min-w-8",s<o?"bg-brand":"bg-zinc-200")})]},e.id)})})})}var ek=t(38954),ez=t(34982);let e_=[{name:"summary",enabled:!0,editDepth:"moderate"},{name:"skills",enabled:!0,editDepth:"moderate"},{name:"experience",enabled:!0,editDepth:"moderate",scope:"quick"},{name:"projects",enabled:!1,editDepth:"light"},{name:"education",enabled:!1,editDepth:"light"}],eS={noNewSkills:!0,preserveDates:!0,preserveJobTitles:!0,preserveCompanyNames:!0,noFabricatedMetrics:!0,maxBulletsPerExperience:null};function eC(e){var s,p,f,g,b,j,w;let{isOpen:y,onClose:N,job:z,resumeId:_}=e,{toast:C}=(0,c.pm)(),{user:A}=(0,m.a)(),E=(0,n.useRef)(0),R=(0,n.useCallback)((e,s)=>{let t=performance.now(),i=s?t-s:t-E.current;return console.log("[MaterialGenerator] ".concat(e,": ").concat(i.toFixed(2),"ms")),t},[]),[T,M]=(0,n.useState)("loading"),[O,D]=(0,n.useState)("Checking for an existing tailored resume…"),[F,L]=(0,n.useState)("idle"),[I,P]=(0,n.useState)([]),[Z,J]=(0,n.use
1State)(!0),[q,U]=(0,n.useState)(_),[G,K]=(0,n.useState)(null),{analysis:V,history:W,analysisRunId:H,operation:$,error:X,analyze:Y,selectAnalysisRun:Q,reset:ee}=function(){let[e,s]=(0,n.useState)(null),[t,i]=(0,n.useState)([]),[l,a]=(0,n.useState)(null),[r,o]=(0,n.useState)(!1),[d,c]=(0,n.useState)("idle"),[m,x]=(0,n.useState)(null),u=(0,n.useCallback)(async(e,t)=>{if(!e){x("Job ID is required");return}o(!0),x(null);let n=performance.now();try{var l,r,d,m,u,h;let o=!(null==t?void 0:t.forceRefresh)&&!(null==t?void 0:t.customResumeJson)&&!!(null==t?void 0:t.resumeId);if(o){c("loading_saved");let n=new URLSearchParams({resumeId:t.resumeId}),l=await fetch("/api/jobs/".concat(e,"/analyze?").concat(n.toString()),{method:"GET",signal:AbortSignal.timeout(45e3)}),o=await l.json();if(l.ok&&o.success&&o.found){s(o.data),i(o.history||[]),a((null===(r=o.analysisRun)||void 0===r?void 0:r.id)||null),x(null);return}l.ok&&o.success&&!1===o.found||console.warn("[useJobAnalysis] Saved analysis lookup failed; falling back to the analysis endpoint")}c("generating");let p=await fetch("/api/jobs/".concat(e,"/analyze"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({resumeId:null==t?void 0:t.resumeId,includeEmbeddings:null===(d=null==t?void 0:t.includeEmbeddings)||void 0===d||d,forceRefresh:null!==(m=null==t?void 0:t.forceRefresh)&&void 0!==m&&m,origin:null!==(u=null==t?void 0:t.origin)&&void 0!==u?u:"jobs_page",idempotencyKey:null!==(h=null==t?void 0:t.idempotencyKey)&&void 0!==h?h:crypto.randomUUID(),customResumeJson:null==t?void 0:t.customResumeJson}),signal:AbortSignal.timeout(45e3)}),f=await p.json(),g=performance.now()-n;if(console.log("[useJobAnalysis] Analysis completed in ".concat(g.toFixed(2),"ms")),!p.ok||!f.success)throw Error(f.error||"Analysis failed: ".concat(p.status));s(f.data),i(f.history||[]),a((null===(l=f.analysisRun)||void 0===l?void 0:l.id)||null),x(null)}catch(t){let e=t instanceof Error?t.message:"Analysis service unavailable";x(e),s(null),console.error("[useJobAnalysis] Analysis failed:",e)}finally{o(!1),c("idle")}},[]),h=(0,n.useCallback)(e=>{let i=t.find(s=>s.id===e);i&&(s(i.result),a(i.id),x(null))},[t]);return{analysis:e,history:t,analysisRunId:l,isLoading:r,operation:d,error:m,analyze:u,selectAnalysisRun:h,reset:(0,n.useCallback)(()=>{s(null),i([]),a(null),o(!1),c("idle"),x(null)},[])}}(),es="analysis"===T||"customize"===T,{presets:et,isLoading:ei}=(0,h.Z)({enabled:es}
1),[en,el]=(0,n.useState)(null),[ea,er]=(0,n.useState)({sections:e_,keywordsToAdd:[],keywordsToExclude:[],customKeywords:[],additionalInstructions:"",guardrails:eS,tone:"professional"}),[eo,ed]=(0,n.useState)([]),[ec,em]=(0,n.useState)([]),[ex,eu]=(0,n.useState)(""),[eh,ep]=(0,n.useState)(null),[ef,eg]=(0,n.useState)(!1),[ev,ej]=(0,n.useState)(0),[ew,ey]=(0,n.useState)([]),eC=(0,n.useRef)(!1);(0,n.useEffect)(()=>{if(!ef){ej(0);return}let e=[window.setTimeout(()=>ej(1),3500),window.setTimeout(()=>ej(2),10500),window.setTimeout(()=>ej(3),22e3)];return()=>e.forEach(window.clearTimeout)},[ef]);let eA=(0,n.useCallback)(function(e){let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!(null==z?void 0:z.id)||!e||eC.current)return;eC.current=!0;let t=performance.now();R("Starting analysis"),ee(),Y(z.id,{resumeId:e,includeEmbeddings:!0,forceRefresh:s}).then(()=>{R("Analysis complete",t)}).catch(e=>{R("Analysis failed",t),console.error("Analysis error:",e)})},[null==z?void 0:z.id,Y,ee,R]);(0,n.useEffect)(()=>{if(!y){M("loading"),eC.current=!1,E.current=0;return}(null==z?void 0:z.id)&&(null==A?void 0:A.id)&&(async()=>{E.current=performance.now(),R("Modal opened"),M("loading"),D("Checking for an existing tailored resume…"),U(_);try{let e=performance.now(),s=(await Promise.resolve().then(t.bind(t,613))).createClient(),{data:i,error:n}=await s.from("resume_versions").select("*").eq("user_id",A.id).or("job_id.eq.".concat(z.id,",settings_snapshot->>user_application_id.eq.").concat(z.id)).not("full_resume_json","is",null).order("version_number",{ascending:!1}).limit(1).maybeSingle();if(R("Version check complete",e),!n&&i){ey([i]),ep({tailoredResumeJson:i.full_resume_json,fullResumeJson:i.full_resume_json,diffOperations:i.diff_operations||[],changes:[],keywordsAdded:i.skills_added||[],processingTimeMs:0,versionId:i.id,scoreBefore:i.score_before||0,scoreAfter:i.score_after||0});let e=i.base_resume_id||_;U(e),M("review"),L("idle"),R("Loaded existing tailored resume, showing editor")}else M("analysis"),L("analyzing"),R("No existing resume, showing analysis view"),setTimeout(()=>{eA(_)},0)}catch(e){console.error("Failed to check versions:",e),M("analysis"),L("analyzing"),setTimeout(()=>{eA(_)},0)}})()},[y,null==z?void 0:z.id,null==A?void 0:A.id,_,R,eA]);let eE=(0,n.useRef)(!1);(0,n.useEffect)(()=>{y&&(null==A?void 0:A.id)&&["analysis","customize"].includes(T)&&!eE.current&&(async()=>{J(!0);let e=performance.now();try{var s;let t=await (0,u.OB)(A.id,A.id,(null===(s=A.role)||void 0===s?void 0:s.toLowerCase())||"candidate");t.success&&t.documents&&(P(t.documents),eE.current=!0),R("Resumes fetched",e)}catch(e){console.error("Error fetching resumes:",e)}finally{J(!1)}})()},[y,null==A?void 0:A.id,null==A?void 0:A.role,T,R]),(0,n.useEffect)(()=>{y&&q&&"review"===T&&(async()=>{let e=performance.now();try{let{data:s,error:t}=await (0,x.t0)(q);if(t||!s){C({title:"Error",description:"Failed to load resume",variant:"destructive"});return}let i=s.data||s.content;i&&(K(i),R("Resume data loaded",e))}catch(e){console.error("Error loading resume:",e)}})()},[y,q,T,C,R]);let eR=(0,n.useCallback)(()=>{ee(),el(null),ep(null),ed([]),em([]),eu(""),K(null),ey([]),eC.current=!1,eE.current=!1,D("Checking for an existing tailored resume…"),N()},[ee,N]),eT=(0,n.useCallback)(e=>{e!==q&&(U(e),ep(null),ed([]),em([]),eu(""),K(null),L("analyzing"),eC.current=!1,ee(),setTimeout(()=>eA(e),0))},[q,eA,ee]);(0,n.useEffect)(()=>{if(et.length>0&&!en){let e=et.find(e=>e.isDefault&&!e.isSystem)||et.find(e=>"Balanced"===e.name&&e.isSystem)||et[0];e&&(el(e),er({sections:e.sectionsConfig.map(e=>"experience"===e.name?{...e,scope:"full"}:e),keywordsToAdd:[],keywordsToExclude:[],customKeywords:[],additionalInstructions:"",guardrails:e.guardrails,tone:"professional"}))}},[et,en]),(0,n.useEffect)(()=>{V&&(L("complete"),ed([]))},[V]),(0,n.useEffect)(()=>{X&&"analyzing"===F&&(console.error("[MaterialGenerator] Analysis error:",X),L("error"),ed([]),C({title:"Analysis Unavailable",description:"Unable to analyze resume. You can still generate using default settings.",variant:"default"}))},[X,F,z,C]);let eM=(0,n.useCallback)(e=>{el(e),er(s=>({sections:e.sectionsConfig.map(e=>{var t;let i=s.sections.find(s=>s.name===e.name);return{...structuredClone(e),enabled:null!==(t=null==i?void 0:i.enabled)&&void 0!==t?t:e.enabled,scope:"experience"===e.name?"full":e.scope}}),keywordsToAdd:[...eo],keywordsToExclude:[],customKeywords:[...ec],additionalInstructions:ex,guardrails:structuredClone(e.guardrails),tone:"professional"}))},[eo,ec,ex]),eO=(0,n.useCallback)(e=>{er(s=>({...structuredClone(s),...e}))},[]),eD=(0,n.useCallback)(e=>{ed(s=>s.includes(e)?s.filter(s=>s!==e):[...s,e])},[]),eF=async function(){let{settings:e=ea,keywords:s=eo,custom:t=ec,instructions:i=ex,preset
1:n=en}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if((null==z?void 0:z.id)&&q){eg(!0),D("Generating tailored resume...");try{var l,a,r,o,d;let c=[...s,...t],m=await fetch("/api/jobs/".concat(z.id,"/generate"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({resumeId:q,settings:{...e,keywordsToAdd:s,customKeywords:t,additionalInstructions:i},keywordsToAdd:c,customKeywords:t,additionalInstructions:i,presetId:null==n?void 0:n.id})}),x=await m.json();if(!m.ok||!x.success)throw Error(x.error||"Generation failed");let u={tailoredResumeJson:x.data.tailoredResumeJson,fullResumeJson:x.data.tailoredResumeJson,diffOperations:x.data.diffOperations||[],changes:x.data.changes||[],keywordsAdded:x.data.keywordsAdded||[],processingTimeMs:x.data.processingTimeMs||0,scoreBefore:null!==(o=null!==(r=x.data.scoreBefore)&&void 0!==r?r:null==V?void 0:null===(l=V.score)||void 0===l?void 0:l.overall)&&void 0!==o?o:0,scoreAfter:null!==(d=x.data.scoreAfter)&&void 0!==d?d:(null==V?void 0:null===(a=V.score)||void 0===a?void 0:a.overall)||0};ep(u);let h=k(z,V);if(x.data.versionId&&(null==A?void 0:A.id)){let s={id:x.data.versionId,user_id:A.id,job_id:z.id,base_resume_id:q,parent_version_id:null,version_number:ew.length+1,version_type:"tailored",full_resume_json:u.tailoredResumeJson,diff_operations:u.diffOperations||[],settings_snapshot:e,score_before:u.scoreBefore,score_after:u.scoreAfter,matched_skills:h.matchedSkills,missing_skills:h.missingSkills,skills_added:u.keywordsAdded,change_summary:"Generated version",created_at:new Date().toISOString(),updated_at:new Date().toISOString()};ey(e=>[s,...e]),ep(e=>e?{...e,versionId:x.data.versionId}:null)}M("review")}catch(e){console.error("Generation error:",e),C({title:"Generation Failed",description:e instanceof Error?e.message:"Failed to generate tailored resume",variant:"destructive"})}finally{eg(!1)}}},eL=(0,n.useCallback)(()=>{M("customize"),V||(eC.current=!1,eA(q))},[V,q,eA]),eI=(0,n.useCallback)(()=>{M("analysis"),L("analyzing"),eC.current=!1,ee(),setTimeout(()=>eA(q,!0),0)},[ee,q,eA]),eP=(0,n.useCallback)(e=>{if("editor"===e){eh&&M("review");return}if("customize"===e){if(!V&&!eh&&"error"!==F)return;M("customize"),V||"analyzing"===F||(L("analyzing"),eC.current=!1,setTimeout(()=>eA(q),0));return}M("analysis"),V||"analyzing"===F||(L("analyzing"),eC.current=!1,setTimeout(()=>eA(q),0))},[V,F,eh,q,eA]),eZ=(0,n.useCallback)(async()=>{if(!(null==z?void 0:z.id)||!(null==A?void 0:A.id)||ew.length>1)return ew;let e=performance.now();try{let s=await (0,ek.pW)({job_id:z.id,user_id:A.id});if(s.success&&s.data)return ey(s.data),R("All versions loaded",e),s.data}catch(e){console.error("Failed to load all versions:",e)}return ew},[null==z?void 0:z.id,null==A?void 0:A.id,ew,R]),eB=(0,n.useCallback)(async()=>{await eZ()},[eZ]),eJ=(0,n.useCallback)(async e=>{let s=(ew.length<=1?await eZ():ew).find(s=>s.id===e);s&&ep({tailoredResumeJson:s.full_resume_json,fullResumeJson:s.full_resume_json,diffOperations:s.diff_operations||[],changes:[],keywordsAdded:s.skills_added||[],processingTimeMs:0,versionId:s.id,scoreBefore:s.score_before||0,scoreAfter:s.score_after||0})},[ew,eZ]),eq="review"===T?"editor":"customize"===T?"customize":"analysis",eU=["analysis",...V||eh||"error"===F?["customize"]:[],...eh?["editor"]:[]];return(0,i.jsx)(o.Vq,{open:y,onOpenChange:e=>{e||eR()},children:(0,i.jsxs)(o.cZ,{className:(0,v.cn)("flex min-h-[650px] flex-col overflow-hidden rounded-[14px] bg-white p-0 font-dm-sans [&>button]:hidden","review"===T?"h-[94vh] w-[97vw] max-w-[1600px]":"h-[min(88vh,840px)] w-[94vw] max-w-[1280px]"),children:[(0,i.jsxs)("div",{className:"grid shrink-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-5 border-b border-zinc-200 bg-white px-6 py-3 lg:grid-cols-[minmax(0,1fr)_minmax(420px,0.9fr)_auto]",children:[(0,i.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(null===(s=z.company)||void 0===s?void 0:s.logo_url)||(null===(p=z.company)||void 0===p?void 0:p.logoUrl)?(0,i.jsx)(l.default,{src:z.company.logo_url||(null===(f=z.company)||void 0===f?void 0:f.logoUrl),alt:z.company.name||"Company",width:32,height:32,unoptimized:!0,className:"w-8 h-8 rounded-lg object-cover"}):(0,i.jsx)("div",{className:"flex h-8 w-8 items-center justify-center rounded-[8px] border border-zinc-200 bg-white text-sm font-bold text-zinc-700",children:(null===(b=z.company)||void 0===b?void 0:null===(g=b.name)||void 0===g?void 0:g.charAt(0))||(null===(j=z.title)||void 0===j?void 0:j.charAt(0))||"J"}),(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsx)("h2",{className:"truncate text-base font-bold tracking-[-0.01em] text-zinc-950",children:z.title}),(0,i.jsx)("p",{className:"truncate text-xs text-zinc-500",children:null===(w=z.company)||void 0===w?void 0:w.name})]})]}),"loading"===T||ef?(0,i.jsx)("div",{className:"hidden lg:block"}
1):(0,i.jsx)(eN,{current:eq,availableStages:eU,onStageChange:eP,compact:!0,className:"hidden min-w-0 lg:block"}),(0,i.jsx)(d.z,{variant:"ghost",size:"icon",onClick:eR,className:"h-9 w-9 rounded-[8px] text-zinc-600 hover:bg-zinc-100","aria-label":"Close tailor resume",children:(0,i.jsx)(r.Z,{className:"h-4 w-4"})})]}),(0,i.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:"loading"===T?(0,i.jsx)("div",{className:"flex h-full items-center justify-center bg-white",children:(0,i.jsxs)("div",{className:"text-center",children:[(0,i.jsx)(a.Z,{className:"mx-auto h-6 w-6 animate-spin text-brand","aria-hidden":"true"}),(0,i.jsx)("p",{className:"mt-4 text-base font-bold text-zinc-950",children:O}),(0,i.jsx)("p",{className:"mt-1 text-sm text-zinc-500",children:"This should only take a moment."})]})}):ef?(0,i.jsx)(ez.S,{stage:ev,role:z.title}):"analysis"===T?(0,i.jsx)(S,{job:z,analysis:V,analysisState:F,analysisOperation:$,resumes:I,selectedResumeId:q,loadingResumes:Z,onResumeChange:eT,analysisHistory:W,selectedAnalysisRunId:H,onAnalysisRunChange:Q,onCustomize:()=>M("customize"),onGenerate:()=>{let e=et.find(e=>e.isDefault&&!e.isSystem)||et.find(e=>"balanced"===e.name.toLowerCase()&&e.isSystem)||et[0]||null,s=k(z,V).missingSkills;return eF({settings:e?{sections:structuredClone(e.sectionsConfig),keywordsToAdd:[...s],keywordsToExclude:[],customKeywords:[],additionalInstructions:"",guardrails:structuredClone(e.guardrails),tone:"professional"}:{sections:structuredClone(e_),keywordsToAdd:[...s],keywordsToExclude:[],customKeywords:[],additionalInstructions:"",guardrails:structuredClone(eS),tone:"professional"},keywords:s,custom:[],instructions:"",preset:e})},onOpenExisting:eh?()=>M("review"):void 0,onRetry:()=>{eC.current=!1,L("analyzing"),eA(q)}}):"customize"===T?(0,i.jsx)(B,{job:z,analysis:V,presets:et,selectedPreset:en,customSettings:ea,selectedKeywords:eo,customKeywords:ec,additionalInstructions:ex,isLoadingPresets:ei,isGenerating:ef,onPresetChange:eM,onSettingsUpdate:eO,onKeywordToggle:eD,onCustomKeywordsChange:em,onAdditionalInstructionsChange:eu,onBack:()=>M("analysis"),onGenerate:()=>eF({settings:{...ea,sections:ea.sections.map(e=>"experience"===e.name?{...e,scope:"full"}:e)}})}):"review"===T?(0,i.jsx)(eb,{job:z,generatedResume:eh,originalResume:G,resumeId:q,onRegenerate:eL,onReanalyze:eI,versions:ew,onVersionSelect:eJ,onLoadAllVersions:eB}):null})]})})}t(5733),t(97157)},23564:function(e,s,t){t.d(s,{eM:function(){return i.e}}),t(850),t(98776),t(60675),t(73327);var i=t(12736)},35770:function(e,s,t){t.d(s,{L:function(){return er}});var i=t(850),n=t(98776),l=t(81101),a=t(63829),r=t(92013),o=t(78745),d=t(97600),c=t(19747),m=t(24385);let x=e=>{var s;return(0,c.u)(null===(s=e.company)||void 0===s?void 0:s.logo_url)},u=e=>{var s;return(null===(s=e.company)||void 0===s?void 0:s.name)||""},h=e=>(0,m.T7)(e.location,"No location specified",e.work_mode),p=e=>e.salary_min&&e.salary_max?"".concat(e.salary_min,"-").concat(e.salary_max," ").concat(e.salary_currency||""):"";function f(e){var s,t,n;let{job:c,actions:f,showCategoryBadge:g=!1}=e,b=[],v=(null===(s=c.category)||void 0===s?void 0:s.name)||"";return c.term&&b.push({icon:(0,i.jsx)(a.Z,{className:"h-3.5 w-3.5 text-foreground/50 flex-shrink-0"}),text:(0,m.WW)(c.term),ariaLabel:"Job Type"}),h(c)&&b.push({icon:(0,i.jsx)(r.Z,{className:"h-3.5 w-3.5 text-foreground/50 flex-shrink-0"}),text:h(c),ariaLabel:"Location"}),p(c)&&b.push({icon:(0,i.jsx)(o.Z,{className:"h-3.5 w-3.5 text-foreground/50 flex-shrink-0"}),text:p(c),ariaLabel:"Salary"}),c.sponsorship&&"Not Specified"!==c.sponsorship&&b.push({icon:(0,i.jsx)(d.Z,{className:"h-3.5 w-3.5 text-foreground/50 flex-shrink-0"}),text:c.sponsorship,ariaLabel:"Sponsorship"}),(0,i.jsxs)("div",{className:"flex w-full flex-col gap-4 xl:flex-row xl:items-start xl:justify-between xl:gap-6",children:[(0,i.jsxs)("div",{className:"flex items-start gap-3.5 flex-1 min-w-0 xl:pr-2",children:[(0,i.jsx)("div",{className:"relative w-11 h-11 sm:w-12 sm:h-12 rounded-xl overflow-hidden border border-[#E6E6E6] bg-background flex-shrink-0",children:x(c)?(0,i.jsx)(l.default,{src:x(c),alt:"".concat(u(c)," logo"),fill:!0,sizes:"48px",className:"object-contain"}):(0,i.jsx)("div",{className:"w-full h-full flex items-center justify-center text-sm sm:text-base font-bold text-gray-400 bg-gray-50",children:(null===(t=u(c))||void 0===t?void 0:t[0])||(null===(n=c.title)||void 0===n?void 0:n[0])||"?"})}),(0,i.jsxs)("div",{className:"flex flex-col gap-0 justify-center min-w-0 pt-0.5",children:[(0,i.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,i.jsx)("h3",{className:"min-w-0 overflow-hidden text-[19px] font-semibold leading-[1.2] tracking-[-0.02em] text-foreground whitespace-normal break-words sm:text-[22px]",children:c.title}),g&&v&&(0,i.jsx)("span",{className:"inline-flex h-6 shrink-0 items-center rounded-[12px] border border-zinc-200 bg-white px-2.5 text-[11px] font-semibold text-zinc-900",children:v})]}),(0,i.jsxs)("div",{className:"mt-1.5 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-[13px] leading-none text-muted-foreground",children:[(0,i.jsx)("span",{className:"min-w-0 max-w-full truncate font-medium text-[#5F6673]",children:u(c)}),c.created_at&&(0,i.jsxs)("span",{className:"inline-flex items-center gap-1 text-[#6B7280] flex-shrink-0",children:[(0,i.jsx)("span",{className:"text-[#98A2B3]","aria-hidden":"true",children:"•"}),(0,i.jsxs)("span",{className:"whitespace-nowrap",suppressHydrationWarning:!0,children:["Posted on ",new Date(c.created_at).toLocaleDateString()]})]})]}),(0,i.jsx)("div",{className:"mt-0.5 flex flex-wrap items-center gap-x-2.5 gap-y-1.5",children:b.map((e,s)=>(0,i.jsxs)("div",{className:"contents",children:[(0,i.jsxs)("div",{className:"inline-flex items-center gap-1.5 min-w-0",role:"listitem",children:[(0,i.jsx)("span",{className:"inline-flex items-center justify-center text-[#64748B]","aria-label":e.ariaLabel,children:e.icon}),(0,i.jsx)("span",{className:"truncate text-[12px] text-[#5F6673]",children:e.text})]}),s<b.length-1&&(0,i.jsx)("span",{className:"hidden sm:inline text-[#98A2B3]","aria-hidden":"true",children:"•"})]},"".concat(e.ariaLabel,"-").concat(e.text)))})]})]}),f?(0,i.jsx)("div",{className:"w-full xl:w-auto xl:flex-shrink-0 xl:self-start",children:f}):null]})}var g=t(73527),b=t(69992),v=t(57702);function j(e){let{job:s}
1=e,[t,l]=(0,n.useState)(!1);return(0,i.jsx)("section",{className:"rounded-[18px] border border-[#EAECF0] bg-white px-4 py-4 sm:px-5 sm:py-5",children:s.description&&(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsx)("p",{className:"text-[16px] font-semibold leading-5 text-[#101828]",children:"Job Description"}),(0,i.jsxs)("div",{className:"relative",children:[(0,i.jsx)("div",{className:"job-description prose prose-sm max-w-none text-[14px] leading-6 text-[#101828] break-words transition-all duration-300 ease-in-out [&_h1]:mb-3 [&_h1]:text-[16px] [&_h1]:font-semibold [&_h2]:mb-3 [&_h2]:text-[16px] [&_h2]:font-semibold [&_h3]:mb-2 [&_h3]:text-[16px] [&_h3]:font-semibold [&_p]:mb-3 [&_p:last-child]:mb-0 [&_ul]:mb-3 [&_ul]:pl-5 [&_ol]:mb-3 [&_ol]:pl-5 ".concat(t?"max-h-none":"max-h-56 overflow-hidden"),dangerouslySetInnerHTML:{__html:(0,m.og)(s.description)}}),!t&&(0,i.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-14 bg-gradient-to-t from-white to-transparent pointer-events-none"})]}),(0,i.jsx)(g.z,{variant:"outline",size:"sm",onClick:()=>{l(!t)},className:"self-start rounded-[10px] border-zinc-200 bg-white px-3 text-[12px] font-semibold text-zinc-700 shadow-none hover:bg-zinc-50","aria-label":t?"Collapse description":"Expand description",children:t?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(b.Z,{className:"mr-2 h-4 w-4"}),"Show less"]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(v.Z,{className:"mr-2 h-4 w-4"}),"Expand"]})})]})})}var w=t(57968),y=t(5109),N=t(91594);t(84343),t(2548),t(64864);var k=t(86438),z=(0,k.$)("f7b00340c2fa3250d44c4a890b17a538ad7345cb");(0,k.$)("f408a9701779ead184ffef8452bb70148f35260e");var _=t(26879);function S(e){let{companyName:s,companyLogo:t,title:n,type:a,onClick:r}=e,o=(0,c.u)(t);return(0,i.jsx)(g.z,{variant:"outline",className:"w-full p-4 h-full flex flex-col items-start hover:border-emerald-600 group rounded-[15px]",onClick:r,children:(0,i.jsxs)("div",{className:"flex gap-3 items-start w-full",children:[(0,i.jsx)("div",{className:"w-10 h-10 rounded-lg border bg-white flex items-center justify-center overflow-hidden flex-shrink-0",children:o?(0,i.jsx)(l.default,{src:o,alt:"".concat(s," logo"),width:40,height:40,className:"object-contain"}):(0,i.jsx)(_.Z,{className:"w-5 h-5 text-gray-400"})}),(0,i.jsxs)("div",{className:"flex-1 min-w-0 text-left",children:[(0,i.jsx)("h3",{className:"font-medium text-sm group-hover:text-emerald-600 truncate",children:n}),(0,i.jsx)("p",{className:"text-sm text-muted-foreground truncate",children:s}),(0,i.jsx)("p",{className:"mt-2 text-xs text-muted-foreground",children:a})]})]})})}let C=e=>{var s;return null===(s=e.company)||void 0===s?void 0:s.logo_url},A=e=>{var s;return(null===(s=e.company)||void 0===s?void 0:s.name)||""},E=e=>e.salary_min&&e.salary_max?"".concat(e.salary_min,"-").concat(e.salary_max," ").concat(e.salary_currency||""):"";function R(e){let{job:s,onSimilarJobClick:t}=e,[l,a]=(0,n.useState)([]),[r,o]=(0,n.useState)(0);if((0,n.useEffect)(()=>{(async function(){try{let e=await z(s.id,5);e.success&&e.jobs?a(e.jobs):a([])}catch(e){a([])}})()},[s.id]),0===l.length)return null;let d=Math.ceil(l.length/3),c=l.slice(3*r,(r+1)*3);return(0,i.jsx)("section",{className:"rounded-[18px] border border-[#EAECF0] bg-white px-4 py-4 sm:px-5 sm:py-5",children:(0,i.jsxs)("div",{className:"space-y-4",children:[(0,i.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[(0,i.jsx)("h2",{className:"text-[0.95rem] font-semibold text-[#101828]",children:"Similar Opportunities"}),(0,i.jsxs)("div",{className:"flex items-center gap-2 self-start sm:self-auto",children:[(0,i.jsx)(g.z,{variant:"outline",size:"icon",className:"h-8 w-8 flex-shrink-0",onClick:()=>{r>0&&o(e=>e-1)},disabled:0===r,children:(0,i.jsx)(w.Z,{className:"h-4 w-4"})}),(0,i.jsx)(g.z,{variant:"outline",size:"icon",className:"h-8 w-8 flex-shrink-0",onClick:()=>{r<d-1&&o(e=>e+1)},disabled:r>=d-1,children:(0,i.jsx)(y.Z,{className:"h-4 w-4"})})]})]}),(0,i.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 sm:gap-4",children:c.map(e=>{var s;return(0,i.jsx)(S,{id:e.id,companyName:A(e),companyLogo:C(e)||"",title:e.title,type:(0,m.WW)(null!==(s=e.term)&&void 0!==s?s:null==e?void 0:e.work_type),salary:E(e),sponsored:e.sponsorship===N.xH.H1B_SPONSORED||e.sponsorship===N.xH.H1B_POSSIBLE||e.sponsorship===N.xH.H1B_ONLY,onClick:()=>null==t?void 0:t(e)}
1,e.id)})})]})})}var T=t(38669);let M=e=>{var s;return(0,c.u)(null===(s=e.company)||void 0===s?void 0:s.logo_url)},O=e=>{var s;return(null===(s=e.company)||void 0===s?void 0:s.name)||""};var D=function(e){var s,t;let{job:n}=e;return(0,i.jsxs)("div",{className:"flex items-center justify-between w-full gap-2 sm:gap-4",children:[(0,i.jsxs)("div",{className:"flex items-center gap-3 sm:gap-4 flex-1 min-w-0",children:[(0,i.jsx)("div",{className:"w-10 h-10 sm:w-12 sm:h-12 rounded-xl border border-[#E4E7EC] bg-white flex items-center justify-center overflow-hidden flex-shrink-0",children:M(n)?(0,i.jsx)(l.default,{src:M(n),alt:"".concat(O(n)," logo"),width:64,height:64,className:"object-contain"}):(0,i.jsx)(_.Z,{className:"w-6 h-6 sm:w-8 sm:h-8 text-gray-400"})}),(0,i.jsxs)("div",{className:"flex flex-col gap-1 justify-center min-w-0",children:[(0,i.jsx)("h3",{className:"text-base font-semibold leading-tight text-[#101828] break-words whitespace-normal",children:O(n)}),(0,i.jsx)("span",{className:"text-[0.85rem] font-medium text-[#667085] break-words whitespace-normal",children:null===(s=n.company)||void 0===s?void 0:s.employees})]})]}),(null===(t=n.company)||void 0===t?void 0:t.linkedin_url)&&(0,i.jsx)("a",{href:"".concat(n.company.linkedin_url),target:"_blank",rel:"noopener noreferrer",className:"flex-shrink-0",children:(0,i.jsxs)(g.z,{variant:"outline",size:"sm",className:"flex items-center gap-1.5 sm:gap-2.5 rounded-xl border border-[#D0D5DD] bg-white text-[#344054] font-medium py-1.5 px-3 sm:py-2 sm:px-4 text-xs hover:bg-[#F9FAFB]",children:[(0,i.jsx)(T.Z,{className:"h-4 w-4 sm:h-5 sm:w-5 text-[#0A66C2]"}),(0,i.jsx)("span",{className:"hidden sm:inline",children:"View Company Profile"}),(0,i.jsx)("span",{className:"sm:hidden",children:"Profile"})]})})]})};function F(e){var s;let{job:t}=e;return(null===(s=t.company)||void 0===s?void 0:s.description)?(0,i.jsx)("section",{className:"rounded-[18px] border border-[#EAECF0] bg-white px-4 py-4 sm:px-5 sm:py-5",children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsx)(D,{job:t}),(0,i.jsx)("p",{className:"text-[14px] leading-6 text-[#101828] whitespace-pre-wrap break-words",children:t.company.description})]})}):null}var L=t(72784),I=t(32480),P=t(2008),Z=t(5646),B=t(61153);let J=e=>Math.max(0,Math.min(100,Math.round(e)));function q(e){return null==e?void 0:e.trim().toLocaleLowerCase()}function U(e){let{skill:s}=e;return(0,i.jsx)("span",{className:"inline-flex h-8 items-center rounded-[10px] border px-2.5 text-[12px] font-medium leading-none transition-colors ".concat(s.isOwned?"border-brand bg-brand text-ink":"border-zinc-200 bg-white text-zinc-900"),children:s.name})}function G(e){let{label:s,value:t}=e;return(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsxs)("p",{className:"text-[22px] font-semibold leading-none tracking-[-0.025em] ".concat((0,P.o)(t).score),children:[t,"%"]}),(0,i.jsx)("p",{className:"mt-1.5 text-[12px] font-medium leading-4 text-zinc-600",children:s})]})}let K=["role","jobType","location","careerStage","sponsorship","freshness","quality"];function V(e){var s;let{job:t,overallScore:n,isLoading:l,showMaterialActions:a,roleSkills:r}=e,o=(0,P.o)(n),d=[...null!==(s=t.preferenceMatchBreakdown)&&void 0!==s?s:[]].filter(e=>e.weight>0).sort((e,s)=>{let t=K.indexOf(e.key),i=K.indexOf(s.key);return(t<0?99:t)-(i<0?99:i)}).slice(0,4),c=r.length;return(0,i.jsxs)("section",{className:"grid gap-4 font-dm-sans xl:grid-cols-[minmax(0,1.08fr)_minmax(340px,0.92fr)]",children:[(0,i.jsxs)("div",{className:"flex h-full flex-col overflow-hidden rounded-[18px] border border-zinc-200 bg-white shadow-[0_8px_24px_rgba(24,24,27,0.04)]",children:[(0,i.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 border-b border-zinc-200 px-4 py-3.5 sm:px-5",children:[(0,i.jsxs)("div",{children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("h3",{className:"text-[16px] font-semibold leading-5 text-zinc-900",children:"Match summary"}),l&&(0,i.jsxs)("span",{className:"inline-flex items-center gap-1 text-[11px] font-medium text-zinc-500",children:[(0,i.jsx)(L.Z,{className:"h-3 w-3 animate-spin"}),"Updating"]})]}),(0,i.jsx)("p",{className:"mt-1 text-[12px] leading-4 text-zinc-500",children:"How this role aligns with your preferences"})]}),a&&(0,i.jsx)(Z.l,{job:t,buttonSize:"sm",buttonClassName:"!h-9 !rounded-[10px] !border-zinc-950 !bg-zinc-950 !px-3 !text-[13px] !font-semibold !text-white !shadow-none hover:!border-zinc-800 hover:!bg-zinc-800 hover:!text-white"})]}),(0,i.jsxs)("div",{className:"grid flex-1 md:grid-cols-[152px_minmax(0,1fr)]",children:[(0,i.jsxs)("div",{className:"flex flex-col justify-center border-b border-zinc-200 px-4 py-5 sm:px-5 md:border-b-0 md:border-r",children:[(0,i.jsxs)("p",{className:"text-[48px] font-semibold leading-none tracking-[-0.05em] ".concat(o.score),children:[J(n),"%"]}),(0,i.jsx)("p",{className:"mt-2 text-[12px] font-medium text-zinc-600",children:"Overall match"})]}),(0,i.jsxs)("div",{className:"flex min-w-0 flex-col justify-center px-4 py-4 sm:px-5",children:[(0,i.jsx)("p",{className:"text-[12px] font-medium text-zinc-500",children:"Score details"}),(0,i.jsx)("div",{className:"mt-3 grid grid-cols-2 gap-x-5 gap-y-5 sm:grid-cols-3",children:d.map(e=>(0,i.jsx)(G,{label:e.label,value:J(e.score)},e.key))})]})]})]}),c>0&&(0,i.jsxs)("div",{className:"h-full rounded-[18px] border border-zinc-200 bg-white px-4 py-4 shadow-[0_8px_24px_rgba(24,24,27,0.04)] sm:px-5",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("h3",{className:"text-[16px] font-semibold leading-5 text-zinc-900",children:"Role skills"}),(0,i.jsx)("span",{className:"text-[12px] font-medium text-zinc-500",children:c})]}),(0,i.jsx)("p",{className:"mt-1 text-[12px] leading-4 text-zinc-500",children:"Skills listed for this position"}),(0,i.jsx)("div",{className:"mt-4",children:(0,i.jsx)("div",{className:"flex flex-wrap gap-2",children:r.map(e=>(0,i.jsx)(U,{skill:{...e,isOwned:!1}},e.name))})})]})]})}let W=n.memo(function(e){var s,t,n,l,a,r,o,d,c,m,x;let{job:u,isLoading:h=!1,showMaterialActions:p=!0}=e,f=(0,I.d)(u.recommendationScore),g=(0,P.o)(f),b=(0,B.a)(u),v=u.recommendationBreakdown,j={requirements:"number"==typeof(null==v?void 0:v.requirementsScore)?Math.round(v.requirementsScore):"number"==typeof(null==u?void 0:u.requirementsScore)?Math.round(u.requirementsScore):void 0,responsibilities:"number"==typeof(null==v?void 0:v.responsibilitiesScore)?Math.round(v.responsibilitiesScore):"number"==typeof(null==u?void 0:u.responsibilitiesScore)?Math.round(u.responsibilitiesScore):void 0},w=function(e){var s,t,i,n,l,a,r,o,d,c,m,x;let u=new Set;
1(null!==(l=e.matchedSkills)&&void 0!==l?l:[]).forEach(e=>{let s=q(null==e?void 0:e.name);s&&u.add(s)}),(null!==(a=null===(s=e.semanticSkillMatch)||void 0===s?void 0:s.matched)&&void 0!==a?a:[]).forEach(e=>{let s=q(null==e?void 0:e.name);s&&u.add(s)});let h=new Map,p=e=>{let s=null==e?void 0:e.trim(),t=q(s);!s||!t||h.has(t)||h.set(t,{name:s,isOwned:u.has(t)})};return(null!==(r=e.matchedSkills)&&void 0!==r?r:[]).filter(e=>!!(null==e?void 0:e.name)).sort((e,s)=>{var t,i;return(null!==(t=s.similarity)&&void 0!==t?t:0)-(null!==(i=e.similarity)&&void 0!==i?i:0)}).forEach(e=>p(e.name)),(null!==(o=null===(t=e.semanticSkillMatch)||void 0===t?void 0:t.matched)&&void 0!==o?o:[]).forEach(e=>p(e.name)),(null!==(d=e.skills)&&void 0!==d?d:[]).forEach(e=>p(null==e?void 0:e.name)),(null!==(c=null===(i=e.semanticSkillMatch)||void 0===i?void 0:i.partial)&&void 0!==c?c:[]).forEach(e=>p(e.name)),(null!==(m=null===(n=e.semanticSkillMatch)||void 0===n?void 0:n.missing)&&void 0!==m?m:[]).forEach(e=>p(e.name)),(null!==(x=e.ai_key_skills)&&void 0!==x?x:[]).forEach(p),Array.from(h.values())}(u),y=w.filter(e=>e.isOwned).length;if("pending"===b&&void 0===f)return(0,i.jsx)("section",{className:"overflow-hidden rounded-[18px] border border-[#EAECF0] bg-white px-4 py-4 sm:px-5",children:(0,i.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h3",{className:"text-[0.95rem] font-semibold text-[#101828]",children:"Match Summary"}),(0,i.jsx)("p",{className:"mt-1 text-[13px] leading-5 text-[#475467]",children:"Match analysis is still warming up for this role. You can keep browsing and apply while we prepare deeper fit details."})]}),h?(0,i.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-[12px] border border-[#D0D5DD] bg-white px-2.5 py-1 text-[11px] font-medium text-[#475467]",children:[(0,i.jsx)(L.Z,{className:"h-3 w-3 animate-spin"}),"Loading"]}):(0,i.jsx)("span",{className:"inline-flex items-center rounded-[12px] border border-[#D0D5DD] bg-[#F9FAFB] px-2.5 py-1 text-[11px] font-medium text-[#475467]",children:"Match pending"})]})});if(void 0===f)return null;let N=!!v||(null!==(d=null===(s=u.matchedSkills)||void 0===s?void 0:s.length)&&void 0!==d?d:0)>0||(null!==(c=null===(n=u.semanticSkillMatch)||void 0===n?void 0:null===(t=n.matched)||void 0===t?void 0:t.length)&&void 0!==c?c:0)>0||(null!==(m=null===(a=u.semanticSkillMatch)||void 0===a?void 0:null===(l=a.partial)||void 0===l?void 0:l.length)&&void 0!==m?m:0)>0||(null!==(x=null===(o=u.semanticSkillMatch)||void 0===o?void 0:null===(r=o.missing)||void 0===r?void 0:r.length)&&void 0!==x?x:0)>0;if("preference"===u.recommendationStrategy&&!N)return(0,i.jsx)(V,{job:u,overallScore:f,isLoading:h,showMaterialActions:p,roleSkills:w});let k=[...v?[{label:"Skills Coverage",value:J(v.skillsScore)},{label:"Profile Fit",value:J(v.contentScore)}]:[],...void 0!==j.requirements?[{label:"Must-haves",value:J(j.requirements)}]:[],...void 0!==j.responsibilities?[{label:"Day-to-day",value:J(j.responsibilities)}]:[],...v?[{label:"Preferences",value:J(v.preferencesScore)}]:[]];return(0,i.jsxs)("section",{className:"grid gap-4 font-dm-sans xl:grid-cols-[minmax(0,1.08fr)_minmax(340px,0.92fr)]",children:[(0,i.jsxs)("div",{className:"flex h-full flex-col overflow-hidden rounded-[18px] border border-zinc-200 bg-white shadow-[0_8px_24px_rgba(24,24,27,0.04)]",children:[(0,i.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 border-b border-zinc-200 px-4 py-3.5 sm:px-5",children:[(0,i.jsxs)("div",{children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("h3",{className:"text-[16px] font-semibold leading-5 text-zinc-900",children:"Match summary"}),h&&(0,i.jsxs)("span",{className:"inline-flex items-center gap-1 text-[11px] font-medium text-zinc-500",children:[(0,i.jsx)(L.Z,{className:"h-3 w-3 animate-spin"}),"Updating"]})]}),(0,i.jsx)("p",{className:"mt-1 text-[12px] leading-4 text-zinc-500",children:"How your profile aligns with this role"})]}),p&&(0,i.jsx)(Z.l,{job:u,buttonSize:"sm",buttonClassName:"!h-9 !rounded-[10px] !border-zinc-950 !bg-zinc-950 !px-3 !text-[13px] !font-semibold !text-white !shadow-none hover:!border-zinc-800 hover:!bg-zinc-800 hover:!text-white"})]}),(0,i.jsxs)("div",{className:"grid flex-1 md:grid-cols-[152px_minmax(0,1fr)]",children:[(0,i.jsxs)("div",{className:"flex flex-col justify-center border-b border-zinc-200 px-4 py-5 sm:px-5 md:border-b-0 md:border-r",children:[(0,i.jsxs)("p",{className:"text-[48px] font-semibold leading-none tracking-[-0.05em] ".concat(g.score),children:[J(f),"%"]}),(0,i.jsx)("p",{className:"mt-2 text-[12px] font-medium text-zinc-600",children:"Overall match"})]}),(0,i.jsxs)("div",{className:"flex min-w-0 flex-col justify-center px-4 py-4 sm:px-5",children:[(0,i.jsx)("p",{className:"text-[12px] font-medium text-zinc-500",children:"Score details"}),(0,i.jsx)("div",{className:"mt-3 grid grid-cols-2 gap-x-5 gap-y-5 sm:grid-cols-3",children:k.map(e=>(0,i.jsx)(G,{label:e.label,value:e.value},e.label))})]})]})]}),w.length>0&&(0,i.jsxs)("div",{className:"h-full rounded-[18px] border border-zinc-200 bg-white px-4 py-4 shadow-[0_8px_24px_rgba(24,24,27,0.04)] sm:px-5",children:[(0,i.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,i.jsxs)("div",{children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("h3",{className:"text-[16px] font-semibold leading-5 text-zinc-900",children:"Recommended skills"}),(0,i.jsx)("span",{className:"text-[12px] font-medium text-zinc-500",children:w.length})]}),(0,i.jsx)("p",{className:"mt-1 text-[12px] leading-4 text-zinc-500",children:"Highlighted skills are already in your profile"})]}),(0,i.jsxs)("span",{className:"shrink-0 text-[12px] font-semibold text-brand-600",children:[y," matches"]})]}),(0,i.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",children:w.map(e=>(0,i.jsx)(U,{skill:e},"".concat(e.name,"-").concat(e.isOwned?"owned":"recommended")))})]})]})}
1),H=e=>{var s;return(null===(s=e.category)||void 0===s?void 0:s.name)||""};function $(e){var s,t,n,l,a,r,o,d;let{job:c,hideSkills:m=!1,hideCategory:x=!1,hideTags:u=!1,hideMatchSummary:h=!1,hideRecentMarker:p=!1,wrap:f=!1}=e,g=m?[]:c.skills||[],b=u?[]:(null===(s=c.tags)||void 0===s?void 0:s.slice(0,3))||[],v=u?0:Math.max(0,((null===(t=c.tags)||void 0===t?void 0:t.length)||0)-3),j=new Date(c.created_at),w=new Date(new Date().getTime()-864e5),y=36e5>Math.abs(j.getTime()-w.getTime()),N=c.semanticSkillMatch,k=null!==(a=null==N?void 0:null===(n=N.matched)||void 0===n?void 0:n.length)&&void 0!==a?a:0,z=null!==(r=null==N?void 0:null===(l=N.partial)||void 0===l?void 0:l.length)&&void 0!==r?r:0,_=new Set((null!==(o=null==N?void 0:N.matched)&&void 0!==o?o:[]).map(e=>e.jobSkillId)),S=new Set((null!==(d=null==N?void 0:N.partial)&&void 0!==d?d:[]).map(e=>e.jobSkillId));return(0,i.jsxs)("div",{className:f?"flex flex-wrap items-center gap-2":"flex items-center gap-2 overflow-x-auto scrollbar-hide pb-1",children:[!p&&c.created_at&&y&&(0,i.jsx)("div",{className:"flex h-7 flex-shrink-0 items-center gap-1 rounded-[14px] border border-zinc-200 bg-white px-3 text-zinc-900 sm:gap-2 sm:px-4",children:(0,i.jsx)("span",{className:"text-xs font-medium whitespace-nowrap",children:"1 day ago"})}),!x&&H(c)&&(0,i.jsx)("div",{className:"flex h-7 flex-shrink-0 items-center gap-1 rounded-[14px] border border-zinc-200 bg-white px-3 text-zinc-900 sm:gap-2 sm:px-4",children:(0,i.jsx)("span",{className:"text-xs font-medium whitespace-nowrap",children:H(c)})}),!m&&!h&&(k>0||z>0)&&(0,i.jsx)("div",{className:"flex h-7 flex-shrink-0 items-center gap-2 rounded-[14px] bg-zinc-100 px-3 text-zinc-800 sm:px-4",children:(0,i.jsxs)("span",{className:"text-xs font-medium whitespace-nowrap",children:[k," matched",z>0?" \xb7 ".concat(z," partial"):""]})}),g.map(e=>{let s="string"==typeof(null==e?void 0:e.id)?e.id:"",t=((null==e?void 0:e.name)||"").toString();if(!t)return null;let n=s&&_.has(s),l=!n&&s&&S.has(s);return(0,i.jsx)("div",{className:"flex h-7 flex-shrink-0 items-center gap-1 rounded-[14px] px-3 sm:gap-2 sm:px-4 ".concat(n?"bg-brand text-ink":l?"border border-[#F3D19B] bg-[#FFF3D8] text-[#8A4B12]":"bg-zinc-100 text-zinc-800"),title:t,children:(0,i.jsx)("span",{className:"text-xs font-medium whitespace-nowrap",children:t})},s||t)}),b.map(e=>{let s="string"==typeof(null==e?void 0:e.id)?e.id:"",t=((null==e?void 0:e.name)||"").toString();return t?(0,i.jsx)("div",{className:"flex h-7 flex-shrink-0 items-center gap-1 rounded-[14px] border border-zinc-200 bg-white px-3 text-zinc-800 sm:gap-2 sm:px-4",title:t,children:(0,i.jsx)("span",{className:"text-xs font-medium whitespace-nowrap",children:t})},s||t):null}),v>0&&(0,i.jsx)("div",{className:"flex h-7 flex-shrink-0 items-center gap-1 rounded-[14px] border border-zinc-200 bg-white px-3 text-zinc-800 sm:gap-2 sm:px-4",children:(0,i.jsxs)("span",{className:"text-xs font-medium whitespace-nowrap",children:["+",v," tags"]})})]})}var X=t(87379);function Y(e){return"string"==typeof e&&e.trim().length>0}function Q(e){return e.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim()}function ee(e){if(!e)return null;if(Y(e)){let s=Q(e);return s.length>0?s:null}if(Array.isArray(e)){let s=e.map(e=>Y(e)?Q(e):"").map(e=>e.trim()).filter(e=>e.length>0);return s.length>0?s.join("\n"):null}if("object"==typeof e)for(let s of[e.items,e.bullets,e.points,e.list,e.summary,e.text,e.content]){let e=ee(s);if(e)return e}return null}function es(e,s){return e.length<=s?e:e.slice(0,s)}let et=["bachelor's degree","bachelor’s degree","bachelor's or master's degree","bachelor’s or master’s degree","bachelor's or masters degree","bachelor’s or masters degree","master's degree","master’s degree","undergraduate","graduate","undergraduate or graduate","phd","doctorate","computer science","software engineering","data engineering","analytical thinking","problem-solving","communication skills","project management","software development","backend development","frontend development","cloud technologies","code review","scalable software"];function ei(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function en(e,s){if(!e||0===s.length)return e;
1let t=RegExp("(".concat(s.map(ei).join("|"),")"),"gi"),l=new Set(s.map(e=>e.toLowerCase()));return e.split(t).map((e,s)=>l.has(e.toLowerCase())?(0,i.jsx)("strong",{className:"font-semibold text-[#101828]",children:e},"".concat(e,"-").concat(s)):(0,i.jsx)(n.Fragment,{children:e},"".concat(e,"-").concat(s)))}function el(){return(0,i.jsxs)("section",{className:"overflow-hidden rounded-[18px] border border-[#EAECF0] bg-white px-4 py-4 sm:px-5",children:[(0,i.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h3",{className:"text-[16px] font-semibold leading-5 text-[#101828]",children:"Match Summary"}),(0,i.jsx)("p",{className:"mt-1 text-[13px] leading-5 text-[#475467]",children:"Sign up to see how well this role matches your profile, including skill coverage, fit score, and tailored insights."})]}),(0,i.jsx)("a",{href:"/signup",className:"inline-flex flex-shrink-0 items-center rounded-full border border-[#ABEFC6] bg-[#ECFDF3] px-3 py-1 text-[11px] font-semibold text-[#067647] hover:bg-[#D1FAE5] transition-colors",children:"Join free"})]}),(0,i.jsxs)("div",{className:"mt-4 flex items-center gap-6 select-none pointer-events-none",children:[(0,i.jsx)("div",{className:"h-[88px] w-[88px] rounded-full border-[6px] border-[#EAECF0] flex items-center justify-center",children:(0,i.jsx)("span",{className:"text-[1.55rem] font-semibold text-[#101828] blur-sm",children:"--"})}),(0,i.jsx)("div",{className:"flex-1 space-y-2",children:["Skills Coverage","Profile Fit","Preferences"].map(e=>(0,i.jsxs)("div",{className:"grid grid-cols-[minmax(92px,112px)_1fr_auto] items-center gap-3",children:[(0,i.jsx)("span",{className:"text-[12px] text-[#344054]",children:e}),(0,i.jsx)("div",{className:"h-1.5 rounded-full bg-[#EAECF0]"}),(0,i.jsx)("span",{className:"text-[12px] font-semibold text-[#101828] blur-sm",children:"--%"})]},e))})]})]})}function ea(e){var s,t;let{job:n}=e,l=null!==(t=null===(s=n.skills)||void 0===s?void 0:s.length)&&void 0!==t?t:0;return l?(0,i.jsx)("section",{className:"rounded-[18px] border border-[#EAECF0] bg-white px-4 py-4 shadow-[0_10px_28px_rgba(24,24,27,0.035)] sm:px-5",children:(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"text-[13px] font-semibold text-[#18181B]",children:"Skills"}),l>0&&(0,i.jsx)("span",{className:"rounded-full bg-zinc-100 px-2 py-0.5 text-[11px] font-semibold leading-none text-zinc-500",children:l})]}),(0,i.jsx)("div",{className:"min-w-0 flex-1",children:(0,i.jsx)($,{job:n,hideCategory:!0,hideTags:!0,hideMatchSummary:!0,hideRecentMarker:!0,wrap:!0})})]})}):null}function er(e){var s;let{job:t,onSimilarJobClick:l,isMobile:a=!1,hideMatchScore:r=!1,headerActions:o,matchLoading:d=!1,isLoggedIn:c=!0,trackInteractions:m=!0,showSimilarJobs:x=!0,showMaterialActions:u=!0,showRoleOverview:h=!1}=e,p=(0,n.useRef)(null),g=(0,n.useRef)(null),b=(0,n.useRef)(new Set);if((0,n.useEffect)(()=>{if((null==t?void 0:t.id)&&g.current!==t.id&&(g.current=t.id,b.current=new Set,p.current&&p.current.scrollTo({top:0,behavior:"auto"}),m)){var e,s,i;let n=null!==(i=null===(e=t.category)||void 0===e?void 0:e.name)&&void 0!==i?i:null===(s=t.category)||void 0===s?void 0:s.toString();(0,X.mJ)(t.id,t.title,n,"jobs_list")}},[null==t?void 0:t.id,null==t?void 0:t.title,null==t?void 0:t.category,m]),(0,n.useEffect)(()=>{let e=p.current;if(!e||!(null==t?void 0:t.id)||!m)return;let s=!1,i=[25,50,75,100],n=()=>{s||(s=!0,requestAnimationFrame(()=>{let n=e.scrollHeight-e.clientHeight,l=n>0?Math.min(100,Math.max(0,Math.round(e.scrollTop/n*100))):100;i.forEach(e=>{if(l>=e&&!b.current.has(e)){var s,i,n;b.current.add(e);let l=null!==(n=null===(s=t.category)||void 0===s?void 0:s.name)&&void 0!==n?n:null===(i=t.category)||void 0===i?void 0:i.toString();(0,X.A0)(t.id,t.title,l,e,"jobs_detail")}}),s=!1}))};return e.addEventListener("scroll",n,{passive:!0}),n(),()=>{e.removeEventListener("scroll",n)}},[null==t?void 0:t.id,null==t?void 0:t.title,null==t?void 0:t.category,m]),!t)return(0,i.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:"Select a job to view details"});let v=!r,{purposeText:w,requirementsText:y,responsibilitiesText:N}=function(e){var s;let t=e&&"object"==typeof e?e:null;if(!t)return{purposeText:null,requirementsText:null,responsibilitiesText:null,cultureText:null};let i=null!==(s=ee(t.job_purpose))&&void 0!==s?s:ee(t.ai_summary),n=ee(t.ai_requirements_summary),l=ee(t.required_qualifications),a=ee(t.preferred_qualifications),r=null!=n?n:l||a?[l,a].filter(
1Boolean).join("\n\n"):null,o=ee(t.ai_core_responsibilities),d=ee(t.job_duties_and_responsibilities),c=ee(t.job_purpose),m=null!=o?o:d||c?[d,c].filter(Boolean).join("\n\n"):null,x=ee(t.company_details);return{purposeText:i?es(i,1200):null,requirementsText:r?es(r,2e3):null,responsibilitiesText:m?es(m,2e3):null,cultureText:x?es(x,2e3):null}}(t.job_details_json),k=function(e,s){var t,i,n;let l=s.filter(Boolean).join("\n"),a=Array.from(new Map([...null!==(i=null===(t=e.skills)||void 0===t?void 0:t.map(e=>e.name))&&void 0!==i?i:[],...null!==(n=e.ai_key_skills)&&void 0!==n?n:[]].map(e=>null==e?void 0:e.trim()).filter(e=>!!e&&e.length>=3).map(e=>[e.toLowerCase(),e])).values()),r=et.filter(e=>l.toLowerCase().includes(e.toLowerCase())),o=Array.from(l.matchAll(/\b(?:bachelor(?:'s|’s)?|master(?:'s|’s)?)(?:\s+or\s+(?:bachelor(?:'s|’s)?|master(?:'s|’s)?))?\s+degree\b/gi),e=>e[0]),d=Array.from(l.matchAll(/\bundergraduate\s+or\s+graduate\b/gi),e=>e[0]),c=Array.from(l.matchAll(/\b\d+\+?\s*(?:years?|yrs?)\s+(?:of\s+)?experience\b/gi),e=>e[0]);return Array.from(new Map([...a,...r,...o,...d,...Array.from(l.matchAll(/\b(?:relevant\s+field|degree|background|experience)\s+(?:such as|including)\s+([^.;\n]+)/gi),e=>e[1]).flatMap(e=>e.split(/,|\bor\b|\band\b/gi).map(e=>e.replace(/^[\s:]+/,"").replace(/\b(?:a|an|the)\b/gi,"").trim()).filter(e=>e.length>=3).filter(e=>e.split(/\s+/).length<=4)),...c].map(e=>[e.toLowerCase(),e])).values()).sort((e,s)=>s.length-e.length).slice(0,12)}(t,[w,y,N]),z=[y?{title:"Requirements Summary",body:y}:null,N?{title:"Core Responsibilities",body:N}:null].filter(e=>!!e);return(0,i.jsx)("div",{className:"flex h-full w-full flex-col font-dm-sans",children:(0,i.jsxs)("div",{ref:p,className:"flex-1 overflow-y-auto px-4 lg:px-7 xl:px-8 pt-4 lg:pt-6 pb-8 lg:pb-12 space-y-4 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-gray-300 [&::-webkit-scrollbar-track]:rounded-full [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar]:bg-transparent ".concat(a?"pb-24 px-3 pt-2":""),children:[(0,i.jsxs)("section",{className:"py-1",children:[(0,i.jsxs)("div",{className:"space-y-2.5",children:[(0,i.jsx)(f,{job:t,actions:o,showCategoryBadge:!!(null===(s=t.category)||void 0===s?void 0:s.name)}),!v&&(0,i.jsx)(ea,{job:t})]}),v&&(0,i.jsx)("div",{className:"mt-4",children:!1===c?(0,i.jsx)(el,{}):(0,i.jsx)(W,{job:t,isLoading:d,showMaterialActions:u})})]}),h&&w&&(0,i.jsxs)("section",{className:"rounded-[18px] border border-[#EAECF0] bg-white px-4 py-4 sm:px-5",children:[(0,i.jsx)("h3",{className:"text-[16px] font-semibold leading-5 text-[#101828]",children:"Role Overview"}),(0,i.jsx)("p",{className:"mt-3 whitespace-pre-wrap text-[14px] leading-6 text-[#101828]",children:en(w,k)})]}),z.length>0&&(0,i.jsx)("div",{className:"grid gap-4 xl:grid-cols-2",children:z.map(e=>(0,i.jsxs)("section",{className:"rounded-[18px] border border-[#EAECF0] bg-white px-4 py-4 sm:px-5",children:[(0,i.jsx)("h3",{className:"text-[16px] font-semibold leading-5 text-[#101828]",children:e.title}),(0,i.jsx)("p",{className:"mt-3 whitespace-pre-wrap text-[14px] leading-6 text-[#101828]",children:en(e.body,k)})]},e.title))}),(0,i.jsx)(j,{job:t}),(0,i.jsx)(F,{job:t}),x&&(0,i.jsx)(R,{job:t,onSimilarJobClick:l})]})})}},19747:function(e,s,t){t.d(s,{u:function(){return i}});function i(e){if(!e)return null;let s=e.trim();return s?s.startsWith("//")?"https:".concat(s):/^https?:\/\//i.test(s)?s:"https://".concat(s.replace(/^\/+/,"")):null}},32480:function(e,s,t){t.d(s,{d:function(){return i}});let i=e=>{if(null==e)return;if(e>=0&&e<=100)return Math.round(e);let s=e;return e>=1e3?s-=1e3:e>=500?s-=500:e>=100&&(s-=100),Math.max(0,Math.min(100,Math.round(s)))}},2008:function(e,s,t){t.d(s,{o:function(){return i}});function i(e){return void 0===e?{score:"text-zinc-600",label:"text-zinc-500"}:e>=70?{score:"text-brand",label:"text-zinc-500"}:e>=50?{score:"text-amber-600",label:"text-zinc-500"}:{score:"text-zinc-600",label:"text-zinc-500"}}},5733:function(e,s,t){t.d(s,{x:function(){return r}});var i=t(850),n=t(98776),l=t(82246),a=t(25634);let r=n.forwardRef((e,s)=>{let{className:t,children:n,...r}=e;return(0,i.jsxs)(l.Root,{ref:s,className:(0,a.cn)("relative overflow-hidden",t),...r,children:[(0,i.jsx)(l.Viewport,{className:"h-full w-full rounded-[inherit]",children:n}),(0,i.jsx)(o,{}),(0,i.jsx)(o,{orientation:"horizontal"}),(0,i.jsx)(l.Corner,{})]})});r.displayName=l.Root.displayName;let o=n.forwardRef((e,s)=>{let{className:t,orientation:n="vertical",...r}=e;return(0,i.jsx)(l.ScrollAreaScrollbar,{ref:s,orientation:n,className:(0,a.cn)("flex touch-none select-none transition-colors","vertical"===n&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===n&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...r,children:(0,i.jsx)(l.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-zinc-200 dark:bg-zinc-800"})})});o.displayName=l.ScrollAreaScrollbar.displayName},2548:function(e,s,t){t.d(s,{G:function(){return i}}),t(64864);var i=(0,t(86438).$)("5d80ebf0f789b44723341c916d1ce35f7320f31a")},84343:function(e,s,t){t.d(s,{X:function(){return i}}),t(64864);var i=(0,t(86438).$)("2ad0e185738b0fc0badbfa0338fbbd91000164b3")},61153:function(e,s,t){t.d(s,{a:function(){return i}});function i(e){var s,t,i;return"ready"===e.scoreState||"partial"===e.scoreState?e.scoreState:"number"!=typeof e.recommendationScore||Number.isNaN(e.recommendationScore)?"pending":(i=e.semanticSkillMatch)&&"object"==typeof i&&(Array.isArray(i.matched)?i.matched.length:0)+(Array.isArray(i.partial)?i.partial.length:0)+(Array.isArray(i.missing)?i.missing.length:0)>0||(s=e.recommendationBreakdown)&&"object"==typeof s||Array.isArray(t=e.matchedSkills)&&t.length>0?"ready":"partial"}},87379:function(e,s,t){t.d(s,{A0:function(){return a},Nw:function(){return n},Ps:function(){return d},_C:function(){return o},mJ:function(){return l},wq:function(){return r}});let i="job_attribution";async function n(e){console.log("[trackJobInteractionEvent] RAW params received:",e);let{eventName:s,jobId:t,jobTitle:n,jobCategory:l,positionInList:a,sourcePage:r,metadata:o={}}=e;console.log("[trackJobInteractionEvent] After destructuring:",{eventName:s,jobId:t,jobTitle:n,jobCategory:l,positionInList:a,sourcePage:r});try{let e=sessionStorage.getItem("job_session_id");e||(e="job_".concat(Date.now(),"_").concat(Math.random().toString(36).substr(2,9)),sessionStorage.setItem("job_session_id",e));let d=document.referrer,c=function(){try{let e=sessionStorage.getItem(i);if(!e)return{};return JSON.parse(e)}catch(e){return{}}}(),m=function(){let e=new URLSearchParams(window.location.search),s=e.get("utm_source")||void 0,t=e.get("utm_medium")||void 0,i=e.get("utm_campaign")||void 0,n=e.get("email_token")||void 0;return s||t||i||n?{utmSource:s,utmMedium:t,utmCampaign:i,emailToken:n}:{}}(),x={...c,...m};Object.keys(m).length>0&&function(e){try{sessionStorage.setItem(i,JSON.stringify(e))}catch(e){}}(x);let u=navigator.userAgent.toLowerCase(),h="desktop";/mobile|android|iphone|ipod|blackberry|windows phone/i.test(u)?h="mobile":/ipad|tablet|playbook|silk/i.test(u)&&(h="tablet");let p={...o,...x.emailToken?{email_token:x.emailToken}:{}},f={session_id:e,event_name:s,job_id:t,job_title:n,job_category:l,position_in_list:a,source_page:r,referrer:d||null,utm_source:x.utmSource,utm_medium:x.utmMedium,utm_campaign:x.utmCampaign,device_type:h,metadata:p};console.log("[trackJobInteractionEvent] Sending payload:",f);let g=await fetch("/api/analytics/job-interaction-events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)});if(g.ok)console.log("[trackJobInteractionEvent] Successfully tracked:",s);else{let e=await g.json();console.error("[trackJobInteractionEvent] API error:",g.status,e)}}catch(e){console.error("Failed to track job interaction event:",e)}}function l(e,s,t,i){console.log("[trackJobDetailOpen] Received params:",{jobId:e,jobTitle:s,jobCategory:t,sourcePage:i});let l={eventName:"job_detail_open",jobId:e,jobTitle:s,jobCategory:t,sourcePage:i||"jobs_list"};console.log("[trackJobDetailOpen] Event data to send:",l),n(l)}function a(e,s,t,i,l){n({eventName:"job_detail_scroll",jobId:e,jobTitle:s,jobCategory:t,sourcePage:l||"jobs_detail",metadata:{scroll_depth:i}})}function r(e,s,t){console.log("[trackJobSaveClick] Called with:",{jobId:e,jobTitle:s,jobCategory:t}),n({eventName:"job_save_click",jobId:e,jobTitle:s,jobCategory:t})}function o(e,s,t){n({eventName:"job_apply_click",jobId:e,jobTitle:s,jobCategory:t})}
1function d(e,s,t,i){n({eventName:"job_apply_complete",jobId:e,jobTitle:s,jobCategory:t,metadata:i})}}}]);

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.