import{r as e}from"./norm-f7iXVy-b.js";import{n as t}from"./toolSkillSummary-BaaCQSOG.js";var n=e=>{let t=Number(e);return Number.isFinite(t)?Math.max(0,Math.min(100,Math.round(t))):null},r=(t,n)=>(Array.isArray(t)?t:[]).map(t=>e(t)).filter(Boolean).slice(0,n),i=t=>{let n=t&&typeof t==`object`?t:null;if(!n)return null;let r={jobId:e(n.jobId),jobTitle:e(n.jobTitle),company:e(n.company)};return r.jobId||r.jobTitle||r.company?r:null},a=(t,n)=>(Array.isArray(t)?t:[]).map(t=>({keyword:e(t?.keyword),jd:Number.isFinite(Number(t?.jd))?Math.max(0,Math.min(10,Number(t.jd))):null,resume:Number.isFinite(Number(t?.resume))?Math.max(0,Math.min(10,Number(t.resume))):null,match:e(t?.match),note:e(t?.note)})).filter(e=>e.keyword).slice(0,n),o=e=>{let t=Array.isArray(e?.items)?e.items:[],n=t[0]||null,r=-1;for(let e of t){let t=Number(e?.score??-1);Number.isFinite(t)&&t>r&&(n=e,r=t)}return n},s=s=>{let c=s.result||null,l=t(`resume_match`,c||{}),u=o(c),d=Array.isArray(c?.items)?c.items:[],f=i(c?.focus)||(u?{jobId:e(u.jobId),jobTitle:e(u.jobTitle),company:e(u.company)}:null),p=n(c?.overallScore),m=n(u?.score);return{schema:`resume_match_v2`,reportType:`resume_match`,title:e(c?.title)||`简历匹配`,headline:e(l?.headline)||e(c?.summary)||void 0,summary:e(c?.summary),primaryAction:e(l?.primaryAction)||void 0,level:e(l?.level)||void 0,jobInput:{jobTitle:e(s.jobTitle),company:e(s.company),jobUrl:e(s.jobUrl),requirements:e(s.requirements),jdChars:e(s.jd).length,resumeChars:e(s.resumeText).length},focus:f,scores:{overall:p,objective:n(c?.objectiveScore),subjective:n(c?.subjectiveScore),bestItem:m},bestScore:p??m,highlights:r(c?.highlights,8),gapsSummary:r(c?.gapsSummary,10),riskSignals:r(c?.riskSignals,8),keywords:a(c?.keywords,12),itemsPreview:d.slice(0,3).map(t=>({jobId:e(t?.jobId),jobTitle:e(t?.jobTitle),company:e(t?.company),score:n(t?.score),fit:e(t?.fit),strengths:r(t?.strengths,4),gaps:r(t?.gaps,4),actions:r(t?.actions,4)})),caveats:r(c?.caveats,8)}};export{s as t};