import{a as e,n as t,t as n}from"./jsx-runtime-CutOxEx1.js";import{d as r}from"./chunk-6CSD65Y2-BjfinoX-.js";import{r as i}from"./authSession-Dulxhbeq.js";import{r as a}from"./norm-f7iXVy-b.js";import{r as o}from"./billingCopy-BVxszui8.js";import{f as s}from"./cloudModel-CkCu0fP6.js";import{n as c}from"./llmSettings-8VBl-FQI.js";import{t as l}from"./resumeAiConsent-3fYgyUHE.js";import{t as u}from"./createLucideIcon-D6B-X28I.js";import{t as d}from"./copy-DaLIBI5k.js";import{t as f}from"./download-BtyQsy17.js";import{t as p}from"./file-text-DsuuTZpm.js";import{t as m}from"./printer-xRe3kO9b.js";import{t as h}from"./refresh-cw-DzeRqf3I.js";import{t as g}from"./browser-r83hNUkq.js";import{t as _}from"./PlatformTokenUsage-BOBT9r1m.js";import{n as ee,r as v,t as y}from"./FallbackNoticeCard-huoe2-vu.js";import{i as te}from"./llm-DjSVhhgj.js";import{t as ne}from"./pdfUtils-BDq1qMVd.js";import{c as re,t as b,u as x}from"./proxyOps-DSvg656Q.js";import{t as S}from"./EditorialMarkdown-DmwukgX6.js";import{a as C,i as ie,l as ae,n as oe,s as w,t as se,u as T}from"./toolRuntime-CFu8ZbRX.js";import{n as E,t as ce}from"./ToolSidebarNav-Py6lZOex.js";import{t as D}from"./ThinkingPanel-DbDGAOQ7.js";import{t as O}from"./MarkdownText-Du4i1sv4.js";import{t as le}from"./ToolLiveStreamPanel-DOjuHZof.js";import{i as ue,r as de}from"./ToolConversationBilling-DMVcVppo.js";import{n as fe}from"./aiResumeOptimize-QdaSyeQb.js";import{n as pe}from"./taskPointGuard-DQLlEFVj.js";import{n as me,t as he}from"./toolSkillSummary-BaaCQSOG.js";import{t as ge}from"./cloudWorkspaceShares-DqtAxHNa.js";import{n as _e,t as ve}from"./resumeWebShare-D7EatTlw.js";import{n as ye,r as k,t as be}from"./ToolConversationPersistence-BXOyFMX0.js";import{a as xe,i as Se,r as Ce,t as A}from"./ToolConversationExecution-Do6biEtR.js";import{n as we,t as Te}from"./useToolRunState-BASJ0aoE.js";import{t as j}from"./JdBuzzwordDetector-nBzVD84Q.js";import{t as M}from"./ToolRunStatus-Bmkja9xq.js";import{n as Ee,t as De}from"./useRestoredFieldsHighlight-VU80wh2Z.js";import{t as N}from"./FilePicker-6mDBFbRF.js";var Oe=u(`Share2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),P=e(t(),1),F=n(),I=`deepseek_pro`,ke=`deepseek`,Ae=`deepseek-v4-pro`,L=e=>String(e||``).replace(/^\s*```(?:markdown|md|text)?\s*/i,``).replace(/\s*```\s*$/i,``).replace(/^-{3,}\s*\n?/,``).replace(/\n?-{3,}$/,``).trim(),je=e=>{let t=String(e||``).trim();return t?/^#{1,6}\s+/.test(t)||/^[【\[][^】\]]+[】\]]$/.test(t)||/^(?:\d+[.、]|[一二三四五六七八九十]+[、.])\s*/.test(t)?!0:t.length<=42&&/(完整简历|改写说明|优化说明|改写分析|ATS|关键词|投递建议|下一步)/i.test(t):!1},R=(e,t,n)=>{let r=String(e||``).replace(/\r/g,``).split(`
`),i=-1;for(let e=0;e<r.length;e++)if(t.test(r[e]||``)){i=e+1;break}if(i<0)return``;let a=r.length;for(let e=i;e<r.length;e++){let t=r[e]||``;if(n.test(t)&&je(t)){a=e;break}}return L(r.slice(i,a).join(`
`))},Me=e=>{let t=String(e||``),n=We(t,`optimizedResume`);if(n)return n;let r=R(t,/(改写后(?:的)?完整简历|优化后(?:的)?完整简历|最终(?:可投递)?简历|完整简历)/i,/(改写说明|重点优化说明|优化说明|改写分析|ATS|关键词|下一步|投递建议|风险提示|补充建议)/i);if(r)return r;let i=t.match(/(?:#+ *[📄]?[^\n]*(?:改写后|完整简历)[^\n]*\n+)([\s\S]*?)(?=\n{0,2}#+ *[📝]|\n{0,2}#+ *(?:改写说明|ATS|优化说明|分析)|$)/iu);return i?.[1]?L(i[1]):``},Ne=e=>{let t=String(e||``),n=[],r=t.match(/✅\s+([\u4e00-\u9fa5A-Za-z0-9·\/\-·•]+)/g)||[];n.push(...r.map(e=>e.replace(/^✅\s+/,``).trim()));let i=R(t,/(ATS|关键词)/i,/(下一步|投递建议|风险提示|改写说明|优化说明|改写分析)/i);return i&&n.push(...i.split(/[\n,，、；;|]/g).map(e=>e.replace(/^[-*•\d.、\s✅]+/,``).replace(/[:：].*$/,``).trim()).filter(e=>e.length>=2&&e.length<=24)),[...new Set(n)].slice(0,24)},Pe=e=>{let t=String(e||``),n=[],r=t.match(/^\|[^|\n]+\|[^|\n]+\|[^|\n]+\|[^|\n]+\|/gm)||[];for(let e of r){let t=e.split(`|`).filter(Boolean).map(e=>e.trim());if(!(!t.length||/^[-:]+$/.test(t[0])||t[0]===`改动`||t[0]===`模块`||t[0]===`项目`)&&(n.push(t.filter(Boolean).join(` → `)),n.length>=12))break}if(!n.length){let e=R(t,/(改写说明|重点优化说明|优化说明|改写分析)/i,/(ATS|关键词|下一步|投递建议|风险提示)/i);n.push(...e.split(`
`).map(e=>e.replace(/^[-*•\d.、\s]+/,``).trim()).filter(e=>e.length>=8&&e.length<=180).slice(0,12))}return n.slice(0,12)},Fe=e=>{let t=String(e||``).match(/\(requestId:([^)]+)\)/i);return t?.[1]?String(t[1]).trim():``},Ie=(e,t)=>{let n=Fe(t);return n?`${e} 请求ID：${n}`:e},Le=e=>{let t=String(e||``);return t.includes(`"code":"1305"`)||t.includes(`访问量过大`)||t.toLowerCase().includes(`rate limit`)},Re=e=>{let t=String(e||``);return Le(t)||t.includes(`timeout`)},ze=e=>new Promise(t=>{window.setTimeout(t,e)}),Be=e=>{let t=a(e);if(!t)return``;let n=t.replace(/\s+/g,` `).trim();return!n||n.length>36||/[：:]/.test(n)||/(职位描述|任职要求|岗位职责|工作职责|岗位要求|职责描述|JD)/i.test(n)||/\d+[、.．]/.test(n)||/[，,。；;]/.test(n)?``:n},Ve=()=>{try{let e=new Uint8Array(12);return crypto.getRandomValues(e),Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``)}catch{return`${Date.now().toString(16)}${Math.random().toString(16).slice(2)}`.replace(/[^a-f0-9]/gi,``).slice(0,24)}},He=(e,t)=>[a(e),a(t)].filter(Boolean).join(`:`).toLowerCase(),Ue=e=>e?[a(e.scoreText)?`综合匹配：${a(e.scoreText)}`:``,a(e.summary)?`匹配结论：${a(e.summary)}`:``,z(`最强优势`,Array.isArray(e.strengths)?e.strengths.map(a).filter(Boolean):[]),z(`关键缺口`,Array.isArray(e.gaps)?e.gaps.map(a).filter(Boolean):[]),z(`优先改写动作`,Array.isArray(e.actions)?e.actions.map(a).filter(Boolean):[]),z(`重点关键词`,Array.isArray(e.keywords)?e.keywords.map(a).filter(Boolean):[],8),`请基于以上匹配结论改写简历，优先补足缺口、保留真实经历，不要编造不存在的信息。`].filter(Boolean).join(`

`):``,We=(e,t)=>{let n=String(e||``),r=`"${t}"`,i=n.indexOf(r);if(i<0)return``;let a=n.indexOf(`:`,i+r.length);if(a<0)return``;let o=a+1;for(;o<n.length&&/\s/.test(n[o]);)o++;if(n[o]!==`"`)return``;o++;let s=``;for(let e=o;e<n.length;e++){let t=n[e];if(t===`"`)return s;if(t===`\\`){let t=n[e+1];if(t==null)return s;if(t===`n`){s+=`
`,e++;continue}if(t===`r`){s+=`\r`,e++;continue}if(t===`t`){s+=`	`,e++;continue}if(t===`"`||t===`\\`||t===`/`){s+=t,e++;continue}if(t===`u`){let t=n.slice(e+2,e+6);if(t.length<4)return s;if(/^[0-9a-fA-F]{4}$/.test(t)){s+=String.fromCharCode(parseInt(t,16)),e+=5;continue}return s}s+=t,e++;continue}s+=t}return s},Ge=(e,t,n=80)=>{let r=String(e||``),i=`"${t}"`,a=r.indexOf(i);if(a<0)return[];let o=r.indexOf(`:`,a+i.length);if(o<0)return[];let s=o+1;for(;s<r.length&&/\s/.test(r[s]);)s++;if(r[s]!==`[`)return[];s++;let c=[],l=``,u=!1;for(let e=s;e<r.length;e++){let t=r[e];if(!u){if(t===`]`)break;if(t===`"`){u=!0,l=``;continue}continue}if(t===`"`){let e=String(l||``).trim();if(e&&c.push(e),c.length>=n)break;u=!1;continue}if(t===`\\`){let t=r[e+1];if(t==null)break;if(t===`n`){l+=`
`,e++;continue}if(t===`r`){l+=`\r`,e++;continue}if(t===`t`){l+=`	`,e++;continue}if(t===`"`||t===`\\`||t===`/`){l+=t,e++;continue}if(t===`u`){let t=r.slice(e+2,e+6);if(t.length<4)break;if(/^[0-9a-fA-F]{4}$/.test(t)){l+=String.fromCharCode(parseInt(t,16)),e+=5;continue}break}l+=t,e++;continue}l+=t}return c},Ke=e=>{let t=a(e).toLowerCase();return t===`match`?`较高匹配`:t===`partial`?`基本匹配`:t===`miss`?`仍有缺口`:a(e)},qe=(e,t)=>{let n=String(e||``).replace(/\r\n/g,`
`).split(`
`),r=String(t||``).replace(/\r\n/g,`
`).split(`
`),i=Math.min(600,n.length),a=Math.min(600,r.length),o=n.slice(0,i),s=r.slice(0,a),c=Array.from({length:i+1},()=>Array(a+1).fill(0));for(let e=i-1;e>=0;e--)for(let t=a-1;t>=0;t--)c[e][t]=o[e]===s[t]?c[e+1][t+1]+1:Math.max(c[e+1][t],c[e][t+1]);let l=[],u=0,d=0;for(;u<i&&d<a;){if(o[u]===s[d]){l.push({kind:`ctx`,text:o[u]}),u++,d++;continue}if(c[u+1][d]>=c[u][d+1]){l.push({kind:`del`,text:o[u]}),u++;continue}l.push({kind:`add`,text:s[d]}),d++}for(;u<i;u++)l.push({kind:`del`,text:o[u]});for(;d<a;d++)l.push({kind:`add`,text:s[d]});return l},Je=e=>{let t=[];for(let n=0;n<e.length;n++){let r=e[n];if(r.kind===`ctx`){t.push({left:r.text,right:r.text,leftKind:`ctx`,rightKind:`ctx`});continue}if(r.kind===`del`){let r=[],i=[];for(;n<e.length&&e[n].kind===`del`;n++)r.push(e[n].text);for(;n<e.length&&e[n].kind===`add`;n++)i.push(e[n].text);n--;let a=Math.max(r.length,i.length);for(let e=0;e<a;e++){let n=r[e]??``,a=i[e]??``;t.push({left:n,right:a,leftKind:n?`del`:`empty`,rightKind:a?`add`:`empty`})}continue}if(r.kind===`add`){t.push({left:``,right:r.text,leftKind:`empty`,rightKind:`add`});continue}}return t},z=(e,t,n=4)=>{let r=t.slice(0,n).map(e=>String(e||``).trim()).filter(Boolean);return r.length?`${e}：\n${r.map(e=>`- ${e}`).join(`
`)}`:``},Ye=(e,t)=>{if(!t||typeof t!=`object`)return null;let n=Array.isArray(t.items)?t.items[0]:null,r=(Array.isArray(n?.strengths)?n.strengths:Array.isArray(t.highlights)?t.highlights:[]).map(e=>a(e)).filter(Boolean).slice(0,4),i=(Array.isArray(t.gapsSummary)?t.gapsSummary:Array.isArray(n?.gaps)?n.gaps:[]).map(e=>a(e)).filter(Boolean).slice(0,4),o=(Array.isArray(n?.actions)?n.actions:[]).map(e=>a(e)).filter(Boolean).slice(0,4),s=(Array.isArray(t.keywords)?t.keywords:[]).map(e=>a(e?.keyword||e)).filter(Boolean).slice(0,8),c=Number(t.overallScore),l=Number.isFinite(c)?`${Math.round(c)}%`:``,u=a(t.summary||n?.fit||``),d=[l?`综合匹配：${l}`:``,u?`匹配结论：${u}`:``,z(`最强优势`,r),z(`关键缺口`,i),z(`优先改写动作`,o),z(`重点关键词`,s,8),`请基于以上匹配结论改写简历，优先补足缺口、保留真实经历，不要编造不存在的信息。`].filter(Boolean).join(`

`);return{sourceRid:a(e),scoreText:l,summary:u,strengths:r,gaps:i,actions:o,keywords:s,prompt:d}},Xe=(e,t)=>{let n=Me(e);return n?[{jobId:``,jobTitle:Be(a(t).slice(0,60)),company:``,fitSummary:`Agent 改写完成，完整简历已提取至编辑区，可直接生成 PDF 或查看改动对比。`,gaps:[],optimizedResume:n,atsKeywords:Ne(e),highlights:[],changes:Pe(e),atsNotes:[],caveats:[]}]:[]};function Ze(){let[e,t]=(0,P.useState)(null),[n,u]=(0,P.useState)(``),[d]=r();(0,P.useEffect)(()=>{if(d.get(`cc_ref`)!==`career_coach`)return;let e=d.get(`cc_resume`)||``;e&&u(t=>t||e)},[]);let[f,p]=(0,P.useState)(``),[m,h]=(0,P.useState)(`professional`),[g,_]=(0,P.useState)(!1),[ee,v]=(0,P.useState)(``),[y,S]=(0,P.useState)([]),{runState:E,progress:ce,setProgress:D,setRunState:O,start:le,partial:ge,done:_e,failByMessage:ve}=we(),[A,j]=(0,P.useState)(null),[M,Ee]=(0,P.useState)(null),[N,Oe]=(0,P.useState)(null),[L,je]=(0,P.useState)(``),{restoredFields:R,setRestoredFields:z,isRestored:Ze,hasRestored:Qe}=De(),$e=(0,P.useRef)(null),et=(0,P.useRef)(null),tt=(0,P.useRef)(null),B=(0,P.useRef)(0),V=(0,P.useRef)(null),nt=(0,P.useRef)(``),rt=(0,P.useRef)(4),H=(0,P.useRef)(0),it=(0,P.useRef)(null),at=(0,P.useRef)(null),[U,W]=(0,P.useState)(``),[ot,G]=(0,P.useState)(``),[st,K]=(0,P.useState)(``),[ct,lt]=(0,P.useState)(``),[ut,q]=(0,P.useState)(null),[dt,J]=(0,P.useState)(``),[Y,ft]=(0,P.useState)(!1),[pt,X]=(0,P.useState)(``),[mt,ht]=(0,P.useState)(``),[gt,_t]=(0,P.useState)(!1),[vt,Z]=(0,P.useState)(``),[yt,Q]=(0,P.useState)(``),[bt,$]=(0,P.useState)(``),[xt,St]=(0,P.useState)(``),[Ct,wt]=(0,P.useState)(null),[Tt,Et]=(0,P.useState)(``),[Dt,Ot]=(0,P.useState)(``),[kt,At]=(0,P.useState)(``),[jt,Mt]=(0,P.useState)(!0),[Nt,Pt]=(0,P.useState)(`delivery`),[Ft,It]=(0,P.useState)(``),[Lt,Rt]=(0,P.useState)(!1),[zt,Bt]=(0,P.useState)(!0);(0,P.useEffect)(()=>{let e=!0,t=async()=>{let t=await i();e&&Rt(!!t)};t();let n=()=>{t()};try{window.addEventListener(`AUTH_SESSION_UPDATED_WEB`,n)}catch{}try{window.addEventListener(`focus`,n)}catch{}return()=>{e=!1;try{window.removeEventListener(`AUTH_SESSION_UPDATED_WEB`,n)}catch{}try{window.removeEventListener(`focus`,n)}catch{}}},[]),(0,P.useEffect)(()=>{let e=new URLSearchParams(window.location.search),t=a(e.get(`source`));if(t!==`career_coach`&&t!==`public_jobs`)return;let r=ie(a(e.get(`sid`)));r&&(a(r.resumeText)&&!a(n)&&u(a(r.resumeText)),a(r.jdText)&&!a(f)&&p(a(r.jdText)))},[]);let[Vt,Ht]=(0,P.useState)([]),[Ut,Wt]=(0,P.useState)(``),Gt=(0,P.useRef)(null),Kt=(0,P.useRef)(``),qt=(0,P.useRef)(0),Jt=(0,P.useMemo)(()=>a(f).length>20&&(a(n).length>30||!!e),[f,n,e]),Yt=(0,P.useMemo)(()=>We(U,`optimizedResume`),[U]),Xt=(0,P.useMemo)(()=>Ge(U,`atsKeywords`,40),[U]),Zt=(0,P.useMemo)(()=>Ge(U,`changes`,40),[U]),Qt=(0,P.useMemo)(()=>{let e=a(A?.[0]?.optimizedResume||``);return E===`running`||E===`partial`?Yt||e:e||Yt},[A,E,Yt]);(0,P.useEffect)(()=>{let e=a(Qt);!e||e===Kt.current||(Kt.current=e,It(e))},[Qt]);let $t=(0,P.useMemo)(()=>a(Ft)||a(Qt),[Ft,Qt]),en=(0,P.useMemo)(()=>{let e=Array.isArray(A?.[0]?.atsKeywords)?A[0].atsKeywords.map(e=>String(e||``).trim()).filter(Boolean):[];return E===`running`||E===`partial`?Xt.length?Xt:e:e.length?e:Xt},[A,E,Xt]),tn=(0,P.useMemo)(()=>{let e=Array.isArray(A?.[0]?.changes)?A?.[0]?.changes.map(e=>String(e||``).trim()).filter(Boolean):[];return E===`running`||E===`partial`?Zt.length?Zt:e:e.length?e:Zt},[A,E,Zt]),nn=()=>{_t(!1),Z(``),Q(``),$(``),St(``),wt(null),Et(``),Ot(``),At(``)},rn=(0,P.useMemo)(()=>{let e=String(dt||``).trim(),t=String($t||``).trim();return!e||!t||e.length>12e4||t.length>12e4?[]:Je(qe(e,t)).slice(0,2200)},[$t,dt]),an=(0,P.useMemo)(()=>a([...y].reverse().find(e=>e.role===`assistant`)?.id),[y]),on=(0,P.useMemo)(()=>{let e=A?.[0];return{fitSummary:Ke(e?.fitSummary||e?.fitLevel),fitLevel:a(e?.fitLevel),fitScore:Number.isFinite(Number(e?.fitScore))?Math.round(Number(e?.fitScore)):null,outputLength:String($t||``).trim().length,changeCount:tn.length,caveatCount:Array.isArray(e?.caveats)?e.caveats.length:0,highlightCount:Array.isArray(e?.highlights)?e.highlights.length:0,jobTitle:Be(a(e?.jobTitle)),company:a(e?.company)}},[$t,A,tn]),sn=(0,P.useMemo)(()=>A?.length?me(`resume_optimize`,{items:A}):null,[A]),cn=(0,P.useMemo)(()=>Array.isArray(A?.[0]?.missingCriticalKeywords)?A[0].missingCriticalKeywords.slice(0,8).map(e=>a(e)).filter(Boolean):[],[A]),ln=(0,P.useMemo)(()=>Array.isArray(A?.[0]?.atsNotes)?A[0].atsNotes.slice(0,6).map(e=>a(e)).filter(Boolean):[],[A]),un=(0,P.useMemo)(()=>Array.isArray(A?.[0]?.matchMatrix)?A[0].matchMatrix.slice(0,6):[],[A]),dn=()=>{let t=[];return a(f)&&t.push(`JD 已提供（${a(f).length} 字）`),a(n)&&t.push(`简历已提供（${a(n).length} 字）`),e&&t.push(`附件：${a(e.name)}`),M?.sourceRid&&t.push(`已承接上一轮简历匹配结论（${M.sourceRid.slice(-6)}）`),t.join(`
`)},fn=e=>{let t=[];return a(e?.fit)&&t.push(`我先给你一个判断：这版简历优化后，和目标岗位的贴合度会更接近“${a(e.fit)}”。`),Array.isArray(e?.changes)&&e.changes.length&&t.push(`这轮我重点改了这些地方：\n${e.changes.slice(0,4).map(e=>`- ${a(e)}`).join(`
`)}`),Array.isArray(e?.atsKeywords)&&e.atsKeywords.length&&t.push(`我补强了这些 ATS 关键词：\n${e.atsKeywords.slice(0,8).map(e=>`- ${a(e)}`).join(`
`)}`),a(e?.optimizedResume)&&t.push(`改写后的正文已经准备好，你可以继续调整，也可以直接查看下方详情。`),t.join(`

`)||`已生成简历优化建议。`};ye({tool:`resume_optimize`,onRestore:e=>{if(a(e.resumeText)&&u(a(e.resumeText)),a(e.jd)&&p(a(e.jd)),e&&typeof e.resumeStyle==`string`&&h(e.resumeStyle),Array.isArray(e.items))j(e.items);else if(a(e.streamText)){let t=Xe(a(e.streamText),a(e.jd)||a(f));t.length&&(j(t),It(t[0]?.optimizedResume||``))}e&&typeof e.fallbackInfo==`object`&&q(e.fallbackInfo),e.matchCarryover&&typeof e.matchCarryover==`object`&&(Ee(e.matchCarryover),Oe(e.matchCarryover)),Array.isArray(e.chatTurns)&&S(e.chatTurns.slice(-80)),a(e.streamText)&&(W(a(e.streamText)),Wt(a(e.streamText))),a(e.streamThinking)&&G(a(e.streamThinking)),a(e.streamStage)&&K(a(e.streamStage)),a(e.streamActor)&&lt(a(e.streamActor)),a(e.sourceResumeForRun)&&J(a(e.sourceResumeForRun)),Number.isFinite(Number(e.progress))&&D(Number(e.progress));let t=a(e.streamRequestId),n=Math.max(0,Number(e.streamLastEventId||0)),r=a(e.streamModelKey);(e.runState===`running`||e.runState===`partial`)&&t&&(Bt(!0),V.current={requestId:t,lastEventId:n,modelKey:r})},syncEntries:[{key:`items`,signature:e=>Array.isArray(e.items)?JSON.stringify(e.items):``,apply:e=>j(Array.isArray(e.items)?e.items:null)},{key:`fallbackInfo`,signature:e=>e&&typeof e.fallbackInfo==`object`?JSON.stringify(e.fallbackInfo):``,apply:e=>q(e&&typeof e.fallbackInfo==`object`?e.fallbackInfo:null)},{key:`streamText`,signature:e=>a(e.streamText),apply:e=>{let t=a(e.streamText);if(W(t),Wt(t),!Array.isArray(e.items)&&t){let n=Xe(t,a(e.jd)||a(f));n.length&&(j(n),It(n[0]?.optimizedResume||``))}}},{key:`streamThinking`,signature:e=>a(e.streamThinking),apply:e=>G(a(e.streamThinking))},{key:`streamStage`,signature:e=>a(e.streamStage),apply:e=>K(a(e.streamStage))},{key:`streamActor`,signature:e=>a(e.streamActor),apply:e=>lt(a(e.streamActor))},{key:`sourceResumeForRun`,signature:e=>a(e.sourceResumeForRun),apply:e=>J(a(e.sourceResumeForRun))},{key:`resumeStyle`,signature:e=>a(e?.resumeStyle),apply:e=>{a(e?.resumeStyle)&&h(e.resumeStyle)}},{key:`progress`,signature:e=>Number.isFinite(Number(e.progress))?String(Number(e.progress)):``,apply:e=>{Number.isFinite(Number(e.progress))&&D(Number(e.progress))}}],onRunState:(e,t)=>{e===`running`?(O(`running`),_(!0)):e===`partial`?(ge(),_(!0)):e===`done`?(_e(),_(!1)):e===`failed`?(ve(String(t.err||`生成失败`),v),_(!1)):e===`cancelled`&&(ve(`已取消`,v),_(!1))},shouldStop:e=>e!==`running`&&e!==`partial`}),(0,P.useEffect)(()=>{let e=Gt.current;if(e)try{e.scrollTop=e.scrollHeight}catch{}},[y.length,ot,U,g]),(0,P.useEffect)(()=>{try{at.current&&window.clearTimeout(at.current)}catch{}return at.current=window.setTimeout(()=>{k(`resume_optimize`,{resumeText:a(n),jd:a(f),matchCarryover:N||M,resumeStyle:m})},300),()=>{try{at.current&&window.clearTimeout(at.current)}catch{}at.current=null}},[N,f,M,m,n]),(0,P.useEffect)(()=>{if(!g)return;let e=window.setInterval(()=>{let e=Number(H.current||0);if(!e)return;let t=String(E||``).trim();if(!(t!==`running`&&t!==`partial`)&&!(Date.now()-e<12e4)){_(!1),ve(`生成停滞：请点击重新生成或切换模型后重试`,v),k(`resume_optimize`,{runState:`failed`,err:`stalled`});try{$e.current?.abort()}catch{}}},1e3);return()=>{try{window.clearInterval(e)}catch{}}},[g,E]),(0,P.useEffect)(()=>{let e=new URLSearchParams(window.location.search),t=String(e.get(`focus`)||``).trim(),r=String(e.get(`rid`)||``).trim(),i=String(e.get(`matchRid`)||``).trim();if(r&&!Qe){let e=C(r,`简历优化`);if(e&&typeof e==`object`){let t=[];if(je(`已恢复历史记录 ${r.slice(-6)}`),a(e?.resumeText)&&!a(n)&&(u(a(e.resumeText)),t.push(`简历文本`)),a(e?.jd)&&!a(f)&&(p(a(e.jd)),t.push(`JD`)),a(e?.resumeStyle)&&h(a(e.resumeStyle)),Array.isArray(e?.items)&&!A&&(j(e.items),t.push(`结果`)),e?.fallbackInfo&&typeof e.fallbackInfo==`object`&&q(e.fallbackInfo),e?.matchCarryover&&typeof e.matchCarryover==`object`&&!M)Ee(e.matchCarryover),Oe(e.matchCarryover),t.push(`匹配结论`);else if(a(e?.matchRid)&&!M){let n=C(a(e.matchRid),`简历匹配`),r=Ye(a(e.matchRid),n?.result);r&&(Ee(r),Oe(r),t.push(`匹配结论`))}z(t)}}else if(i&&!Qe){let e=C(i,`简历匹配`),t=ie(i),r=be(`resume_match`),o=a(r?.latestResultId)===i?r:null,s=Ye(i,e?.result||o?.out);if(e&&typeof e==`object`||t||o){let r=[];je(`已承接简历匹配 ${i.slice(-6)}`);let c=a(e?.resumeText)||a(t?.resumeText)||a(o?.resumeText),l=a(e?.jd)||a(t?.jdText)||a(o?.jd);c&&!a(n)&&(u(c),r.push(`简历文本`)),l&&!a(f)&&(p(l),r.push(`JD`)),a(e?.resumeStyle)&&h(a(e.resumeStyle)),s&&(Ee(s),Oe(s),r.push(`匹配结论`)),z(r)}}t===`result`&&window.setTimeout(()=>{try{it.current?.scrollIntoView({behavior:`smooth`,block:`start`})}catch{}},80)},[Qe,A,f,M,n]);let pn=async t=>{if(tt.current)return await tt.current;if(!e)throw Error(`请上传 PDF 简历或粘贴简历文本`);let n=e;if(String(n.type||``).toLowerCase()!==`application/pdf`&&!/\.pdf$/i.test(n.name||``))throw Error(`仅支持 PDF 格式`);if(n.size>1e7)throw Error(`PDF 文件过大（限制 10MB）`);et.current?.abort();let r=new AbortController;et.current=r,ht(``),ft(!0),X(t===`auto`?`自动解析中…`:`解析中…`);let a=(async()=>{if(!await i())throw Error(`请先登录后解析`);let e=await ne(n),t=await re({fileDataUrl:await b(n),fileName:n.name||`resume.pdf`,pages:e,minLength:800,signal:r.signal,onStage:X});if(!t)throw Error(`解析结果为空`);return u(t),X(`解析完成`),t})();tt.current=a;try{return await a}finally{tt.current=null,ft(!1);try{et.current=null}catch{}X(``)}},mn=async()=>a(n)||await pn(`run`);(0,P.useEffect)(()=>{if(!e){ft(!1),X(``),ht(``),et.current?.abort(),tt.current=null;return}(async()=>{if(await l())try{await pn(`auto`)}catch(e){ht(a(e?.message||`解析失败`))}})()},[e]);let hn=()=>({id:`web_${Math.random().toString(16).slice(2)}`,pool:`jobseeker`,title:`（网页输入 JD）`,company:``,salary:{min:0,max:0,currency:`CNY`,text:``},description:[a(f),Ue(N||M)?`上一步简历匹配结论（必须结合处理）：\n${Ue(N||M)}`:``].filter(Boolean).join(`

`).trim(),url:`https://bysjob.com`,platform:`import`,tags:[],created_at:Date.now(),updated_at:Date.now()}),gn=async()=>{if(g)return;let e=++B.current;if(!await _n()||(v(``),!await l()))return;nn(),j(null),q(null),W(``),G(``),K(``),lt(``),qt.current=0,It(``),Pt(`delivery`),le(),$e.current=new AbortController,_(!0);let t=await ue({rangeDays:1,pageSize:100}),r=N||M;k(`resume_optimize`,{runState:`running`,progress:0,resumeText:a(n),jd:a(f),chatTurns:y,matchCarryover:r,matchRid:a(r?.sourceRid),resumeStyle:m});try{q(null);let n=await mn();J(n),k(`resume_optimize`,{sourceResumeForRun:n,matchCarryover:r,matchRid:a(r?.sourceRid)});let i={},o=await T(fe([hn()],n,{provider:ke,model:Ae,thinking:!0,signal:$e.current.signal,onProgress:e=>{H.current=Date.now();let t=Math.max(1,Math.min(99,Math.round(e||0)));D(t),k(`resume_optimize`,{runState:`running`,progress:t})},onPartial:t=>{if(e!==B.current)return;H.current=Date.now(),ge();try{let e=Number(t?._attempt||0);e&&e!==qt.current&&(qt.current=e,W(``),G(``));let n=String(t?._streamStage||``).trim(),r=String(t?._streamActor||``).trim(),i=String(t?._streamText||``).trim(),a=String(t?._streamThinking||``).trim();n&&K(n),r&&lt(r),i&&W(i),a&&G(a)}catch{}Object.assign(i,t||{});let n=Array.isArray(i?.items)?i.items:[],r=t?._fallback||i?._fallback||null;r&&q(r),j(n),k(`resume_optimize`,{runState:`partial`,progress:ce,items:n,fallbackInfo:r,streamText:String(t?._streamText||``),streamThinking:String(t?._streamThinking||``),streamStage:String(t?._streamStage||``),streamActor:String(t?._streamActor||``)})}}),24e4,`简历优化生成`);if(e!==B.current)return;let s=Array.isArray(o?.items)?o.items:[],c=o?._fallback&&typeof o._fallback==`object`?o._fallback:null;q(c),j(s);let l=await de({beforeIds:t,aggregateAllNew:!0,pageSize:100,rangeDays:1,attempts:6,retryDelayMs:700}),u={id:`turn_a_${Date.now()}_${Math.random().toString(16).slice(2,8)}`,role:`assistant`,content:fn(s?.[0]),createdAt:Date.now(),billing:l},d=[...y,u].slice(-80);S(d),_e(),D(100);let p=`resume_opt_${Date.now()}_${Math.random().toString(16).slice(2,8)}`;_(!1),Mt(!0),Pt(`delivery`),k(`resume_optimize`,{runState:`done`,progress:100,items:s,fallbackInfo:c,chatTurns:d,matchCarryover:r,matchRid:a(r?.sourceRid),resumeStyle:m}),queueMicrotask(()=>{ae(he({id:p,toolLabel:`简历优化`,toolType:`resume_optimize`,title:`简历优化结果`,score:a(s?.[0]?.fit)||``,deepLink:oe(`/tools/resume-optimize`,`result`,{rid:p}),result:{items:s,...c?{_fallback:c}:{}}}),{resumeText:n,jd:a(f),items:s,fallbackInfo:c,resumeStyle:m,matchRid:a(r?.sourceRid),matchCarryover:r}).catch(()=>{})})}catch(t){if(e!==B.current)return;let n=w(t,`生成失败`);ve(n,v),k(`resume_optimize`,{runState:String(n||``).includes(`取消`)?`cancelled`:`failed`,err:String(n||``),progress:ce})}finally{_(!1)}},_n=async e=>{let t=await i();if(!t)return v((0,F.jsxs)(`p`,{style:{color:`var(--accent)`,fontSize:`13px`},children:[`请先`,(0,F.jsx)(`a`,{href:se(),children:`登录`}),`后使用简历优化功能`]})),null;if(!e?.skipQuote)try{let e=await pe({tool:`resume_optimize`,modelChoice:I,resumeChars:a(n).length,jdChars:a(f).length});if(!e.ok)return v((0,F.jsxs)(`p`,{style:{color:`var(--accent)`,fontSize:`13px`},children:[e.message,` `,(0,F.jsx)(`a`,{href:e.rechargeHref,children:`先充值`})]})),null}catch(e){return v((0,F.jsx)(`p`,{style:{color:`var(--accent)`,fontSize:`13px`},children:String(e?.message||`暂时无法校验积分余额，请稍后重试。`)})),null}return t},vn=async e=>{let t=!!e?.requestId;if(g&&!t)return;let r=++B.current,i=await _n({skipQuote:t});if(!i)return;v(``),t||(nn(),j(null),Ht([]),Wt(``),W(``),G(``),K(``),lt(``),It(``),q(null),Pt(`delivery`)),rt.current=4,H.current=Date.now(),le(),_(!0),$e.current=new AbortController;let o=await ue({rangeDays:1,pageSize:100});try{let l=await mn();J(l);let u=await c();if(!u.enabled||!u.proxyUrl)throw Error(`AI 服务未启用，请在设置中开启 AI 代理`);let d=s(I),p=He(d?.provider,d?.model),h=e?.requestId||Ve(),g=Math.max(0,Number(e?.lastEventId||0));k(`resume_optimize`,{runState:`running`,progress:0,err:``,...t?{}:{items:null},resumeText:a(n),jd:a(f),matchCarryover:N||M,matchRid:a((N||M)?.sourceRid),resumeStyle:m,...t?{}:{streamText:``,streamThinking:``},streamStage:t?st||`正在续传`:`准备开始`,streamActor:`agent`,streamRequestId:h,streamLastEventId:g,streamMode:`agent`,streamModelKey:p});let _=await te({op:`resume_optimize_agent`,proxyUrl:u.proxyUrl,gatewayApiKey:u.gatewayApiKey,clientId:i?.user?.id?`u:${i.user.id}`:void 0,thinking:!0,subProvider:d?.provider,subModel:d?.model,data:{resume:l,jd:a(f),jobTitle:Be(a(f).slice(0,60))},signal:$e.current.signal,requestId:h,resumeFromSeq:g,onToolStart:(e,t,n)=>{if(r!==B.current)return;H.current=Date.now(),rt.current=Math.max(1,Number(n||0)||1),Ht(t=>xe(t,e)),K(`步骤 ${t}/${n}`);let i=Te(t,n,`start`);D(i),k(`resume_optimize`,{runState:`running`,progress:i,streamStage:`步骤 ${t}/${n}`,streamActor:e})},onToolDone:(e,t)=>{if(r!==B.current)return;H.current=Date.now(),Ht(t=>Ce(t,e));let n=Te(t,rt.current,`done`);D(n),k(`resume_optimize`,{runState:`partial`,progress:n,streamStage:`已完成 ${t}/${rt.current}`,streamActor:e})},onProcess:e=>{r===B.current&&(H.current=Date.now(),G(t=>{let n=Se(t,String(e||``),12e3);return k(`resume_optimize`,{runState:`partial`,streamThinking:n}),n}))},onThinking:e=>{r===B.current&&(H.current=Date.now(),G(t=>{let n=Se(t,String(e||``),12e3);return k(`resume_optimize`,{runState:`partial`,streamThinking:n}),n}))},onText:e=>{r===B.current&&(H.current=Date.now(),Wt(e),W(e),k(`resume_optimize`,{runState:`partial`,streamText:e}))},onMeta:e=>{e.type===`start`&&k(`resume_optimize`,{streamRequestId:String(e.requestId||h),streamMode:`agent`,streamModelKey:p})},onHeartbeat:()=>{H.current=Date.now()},onEventId:e=>{g=Math.max(g,Number(e||0)),k(`resume_optimize`,{streamRequestId:h,streamLastEventId:g,streamMode:`agent`,streamModelKey:p})}});if(r!==B.current)return;Wt(_),W(_);let ee=Me(_),v=[];if(ee){It(ee);let e={jobId:``,jobTitle:Be(a(f).slice(0,60)),company:``,fitSummary:`Agent 改写完成，完整简历已提取至编辑区，可直接生成 PDF 或查看改动对比。`,gaps:[],optimizedResume:ee,atsKeywords:Ne(_),highlights:[],changes:Pe(_),atsNotes:[],caveats:[]};v.push(e),j(v)}let ne=N||M,re=await de({beforeIds:o,requestId:h,aggregateAllNew:!0,pageSize:100,rangeDays:1,attempts:6,retryDelayMs:700}),b={id:`turn_a_${Date.now()}_${Math.random().toString(16).slice(2,8)}`,role:`assistant`,content:fn(v?.[0]),createdAt:Date.now(),billing:re},x=[...y,b].slice(-80);S(x),k(`resume_optimize`,{runState:`done`,progress:100,streamText:_,streamStage:`分析完成`,streamActor:`agent`,sourceResumeForRun:l,resumeText:a(n)||l,jd:a(f),chatTurns:x,matchCarryover:ne,matchRid:a(ne?.sourceRid),resumeStyle:m,streamRequestId:h,streamLastEventId:g,streamMode:`agent`,streamModelKey:p,...v.length?{items:v}:{}}),_e(),H.current=0}catch(e){if(r!==B.current)return;let t=w(e,`生成失败`);k(`resume_optimize`,{runState:`failed`,err:t,streamMode:`agent`}),ve(t,v)}finally{H.current=0,_(!1)}};return(0,P.useEffect)(()=>{let e=V.current;if(!e)return;let t=`${e.requestId}:${e.lastEventId}:${a(e.modelKey)}`;nt.current!==t&&(nt.current=t,V.current=null,(async()=>{let t=!0;try{let n=s(I),r=He(n?.provider,n?.model),i=a(e.modelKey);i&&r&&i!==r&&(t=!1)}catch{}if(!t){je(`检测到模型已切换：当前进行中的简历优化流式结果已失效，请重新点击“Agent 深度改写”。`);return}await vn(e)})())},[n,f]),{isAuthed:Lt,resumeFile:e,setResumeFile:t,resumeText:n,setResumeText:u,jd:f,setJd:p,resumeStyle:m,setResumeStyle:h,busy:g,setBusy:_,runState:E,progress:ce,failByMessage:ve,err:ee,setErr:v,chatTurns:y,setChatTurns:S,items:A,setItems:j,matchCarryover:M,setMatchCarryover:Ee,editableCarryover:N,setEditableCarryover:Oe,restoredHint:L,setRestoredHint:je,restoredFields:R,isRestored:Ze,hasRestored:Qe,abortRef:$e,parseAbortRef:et,parsePromiseRef:tt,runSeqRef:B,lastStreamAtRef:H,resultCardRef:it,draftTimerRef:at,streamText:U,setStreamText:W,streamThinking:ot,setStreamThinking:G,streamStage:st,setStreamStage:K,streamActor:ct,setStreamActor:lt,fallbackInfo:ut,setFallbackInfo:q,sourceResumeForRun:dt,setSourceResumeForRun:J,parseBusy:Y,setParseBusy:ft,parseStage:pt,setParseStage:X,parseErrText:mt,setParseErrText:ht,resumePreviewBusy:gt,setResumePreviewBusy:_t,resumePreviewErrText:vt,setResumePreviewErrText:Z,resumePreviewHtml:yt,setResumePreviewHtml:Q,resumePreviewSourceHtml:bt,setResumePreviewSourceHtml:$,resumePreviewModel:xt,setResumePreviewModel:St,resumePreviewBilling:Ct,setResumePreviewBilling:wt,resumePreviewStep:Tt,setResumePreviewStep:Et,resumePreviewNoticeText:Dt,setResumePreviewNoticeText:Ot,clearResumePreviewState:nn,lastResumePreviewText:kt,setLastResumePreviewText:At,detailExpanded:jt,setDetailExpanded:Mt,resultTab:Nt,setResultTab:Pt,chatScrollRef:Gt,canRun:Jt,streamedOptimizedResume:Yt,streamedAtsKeywords:Xt,streamedChanges:Zt,shownOptimizedResume:Qt,effectiveOptimizedResume:$t,editableOptimizedResume:Ft,setEditableOptimizedResume:It,shownAtsKeywords:en,shownChanges:tn,sideBySideRows:rn,latestAssistantTurnId:an,optimizePrimary:on,unifiedSummary:sn,optimizeMissingKeywords:cn,optimizeAtsNotes:ln,optimizeMatchMatrix:un,buildUserRunSummary:dn,buildAssistantSummary:fn,runParseResume:pn,parseResumeIfNeeded:mn,buildJob:hn,run:gn,runAgent:vn,agentMode:zt,setAgentMode:Bt,agentSteps:Vt,agentText:Ut,runResumePdfPreview:async e=>{if(gt)return;if(!await i()){Z(`请先登录后再生成网页简历`);return}let t=String(e||$t||``).trim();if(!t){Z(`请先完成简历优化，再生成网页简历`);return}At(t),Z(``),Ot(``),$(``),wt(null),Et(`正在生成 HTML 简历…`),_t(!0);let n=await ue({rangeDays:1,pageSize:100}),r=``;try{Q(``),St(``);let e=await c(),i=``,o=``,s=null;for(let n=0;n<2;n++){i=``;try{n>0?($(``),Et(`正在自动重试生成网页简历…`),Ot(`系统正在自动重试本次网页简历生成，请稍候。`)):Et(`正在生成 HTML 源码，请稍候…`);let c=!1,l=0,u=``,d=()=>{l=0,u&&$(u)},f=await x({resumeText:t,styleVariant:m,timeoutMs:24e4,tier:e.tier,onMeta:e=>{e?.requestId&&(r=String(e.requestId)),e?.model&&(o=String(e.model))},onDelta:(e,t)=>{c||(c=!0,Et(`正在实时输出 HTML 源码…`)),u=t,l||=window.requestAnimationFrame(d)}});if(l&&=(window.cancelAnimationFrame(l),0),u&&$(u),i=String(f?.html||``).trim(),o=a(f?.model)||o,!i)throw Error(`生成失败：未返回 HTML`);s=null,Ot(``);break}catch(e){s=e;let r=a(e?.message||`生成失败`),i=Fe(r);if(console.warn(`[resume_html_pdf]`,{message:r,requestId:i||void 0,styleVariant:m,textLength:t.length,attempt:n+1}),n<1&&Re(r)){Z(``),Ot(Ie(`当前生成请求较多，正在自动重试一次。`,r)),await ze(Le(r)?1500:1e3);continue}throw e}}if(s)throw s;if(i=String(i||``).trim(),o&&St(`glm/${o}`),!i)throw Error(`生成失败：未返回 HTML`);$(i),Q(i),Ot(``),Et(`HTML 代码已生成，正在渲染网页简历预览`),wt(await de({beforeIds:n,requestId:r||void 0,aggregateAllNew:!0,pageSize:100,rangeDays:1,attempts:6,retryDelayMs:700}))}catch(e){wt(await de({beforeIds:n,requestId:r||void 0,aggregateAllNew:!0,pageSize:100,rangeDays:1,attempts:6,retryDelayMs:700}));let i=a(e?.message||`生成失败`),s=Fe(i);console.warn(`[resume_html_pdf]`,{message:i,requestId:s||void 0,styleVariant:m,textLength:t.length,attempt:`final`}),Ot(``),Le(i)?Z(Ie(`当前生成请求较多，请稍后重试。`,i)):i.includes(`invalid_html_output`)?Z(Ie(`模型输出格式异常，请重试。`,i)):i.includes(`insufficient_points`)?Z(Ie(`${o}。`,i)):i.includes(`billing_failed`)?Z(Ie(`扣费失败，请稍后重试。`,i)):i.includes(`timeout`)?Z(Ie(`请求超时，请检查网络后重试。`,i)):Z(Ie(i,i)),Et(``)}finally{_t(!1)}},printHtmlResume:()=>{let e=yt;if(!e)return;let t=new Blob([e],{type:`text/html;charset=utf-8`}),n=URL.createObjectURL(t),r=window.open(n,`_blank`);if(!r){URL.revokeObjectURL(n);return}r.addEventListener(`load`,()=>{r.print(),URL.revokeObjectURL(n)},{once:!0})}}}var Qe=e(g(),1),$e={jd_analysis:`正在解析岗位要求与关键词…`,resume_match:`正在评估简历与岗位的匹配度…`,resume_optimize:`正在逐条改写并注入关键词…`,orchestrator:`正在规划下一步…`,interview_questions:`正在生成面试题库…`,salary_research:`正在调研薪酬数据…`,career_assessment:`正在评估职业路径…`};function et({step:e,label:t,isLast:n,isActive:r}){let i=e.status===`done`;return(0,F.jsxs)(`div`,{className:`agent-progress-step`,"data-status":i?`done`:`active`,children:[(0,F.jsxs)(`div`,{className:`agent-progress-step-rail`,children:[(0,F.jsx)(`div`,{className:`agent-progress-step-dot ${i?`done`:`active`}`,children:i?(0,F.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:3.5,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,F.jsx)(`path`,{d:`M5 13l4 4L19 7`})}):(0,F.jsx)(`span`,{className:`agent-progress-pulse`})}),!n&&(0,F.jsx)(`div`,{className:`agent-progress-step-line ${i?`done`:``}`})]}),(0,F.jsxs)(`div`,{className:`agent-progress-step-body`,children:[(0,F.jsxs)(`div`,{className:`agent-progress-step-header`,children:[(0,F.jsx)(`span`,{className:`agent-progress-step-label ${i?`done`:`active`}`,children:t}),i&&(0,F.jsx)(`span`,{className:`agent-progress-step-badge`,children:`完成`}),r&&!i&&(0,F.jsx)(`span`,{className:`agent-progress-step-badge active`,children:`进行中`})]}),r&&!i&&(0,F.jsx)(`div`,{className:`agent-progress-step-desc`,children:$e[e.tool]||`处理中…`})]})]})}function tt({title:e,busy:t,progress:n=0,steps:r,labels:i,streamThinking:o,streamStage:s,streamActor:c,emptyText:l}){let[u,d]=(0,P.useState)(!0),f=Math.max(0,Math.min(100,Math.round(Number(n||0)))),p=r.filter(e=>e.status===`done`).length,m=r.length,h=!t&&m>0&&p===m,g=a(o),_=[a(s),a(c)].filter(Boolean).join(` · `),ee=(0,P.useMemo)(()=>r.map((e,t)=>({step:e,label:a(i[e.tool])||a(e.tool)||`步骤 ${t+1}`,isLast:t===r.length-1,isActive:e.status===`running`})),[r,i]);return r.length?(0,F.jsxs)(`div`,{className:`agent-progress-panel ${h?`completed`:``}`,children:[(0,F.jsxs)(`button`,{type:`button`,className:`agent-progress-header`,onClick:()=>d(!u),"aria-expanded":u,children:[(0,F.jsxs)(`div`,{className:`agent-progress-header-left`,children:[h?(0,F.jsx)(`span`,{className:`agent-progress-done-icon`,children:(0,F.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:3,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,F.jsx)(`path`,{d:`M5 13l4 4L19 7`})})}):(0,F.jsx)(`span`,{className:`agent-progress-spinner`}),(0,F.jsx)(`span`,{className:`agent-progress-title`,children:h?`${e} · 已完成`:e})]}),(0,F.jsxs)(`div`,{className:`agent-progress-header-right`,children:[!h&&(0,F.jsxs)(`span`,{className:`agent-progress-pct`,children:[f,`%`]}),_&&!h&&(0,F.jsx)(`span`,{className:`agent-progress-meta`,children:_}),(0,F.jsx)(`span`,{className:`agent-progress-chevron ${u?`open`:``}`,children:(0,F.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2.5,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,F.jsx)(`path`,{d:`M6 9l6 6 6-6`})})})]})]}),!h&&(0,F.jsx)(`div`,{className:`agent-progress-bar-track`,children:(0,F.jsx)(`div`,{className:`agent-progress-bar-fill`,style:{width:`${Math.max(4,f)}%`}})}),u&&(0,F.jsxs)(`div`,{className:`agent-progress-body`,children:[(0,F.jsx)(`div`,{className:`agent-progress-steps`,children:ee.map((e,t)=>(0,F.jsx)(et,{step:e.step,label:e.label,isLast:e.isLast,isActive:e.isActive},`${e.step.tool}_${t}`))}),g&&(0,F.jsx)(`div`,{className:`agent-progress-thinking`,children:(0,F.jsx)(D,{thinking:g,title:`思考过程`,stageText:_,defaultCollapsed:!1,maxHeight:160,fontSize:11,lineHeight:1.45,embedded:!0,collapsedPreview:g.split(`
`)[0]?.slice(0,60)||``})}),t&&l&&!g&&(0,F.jsx)(`div`,{className:`agent-progress-empty`,children:l})]})]}):null}var B=e=>e===`academic`?`强化结构、项目/研究经历与成果表达。`:e===`graduate`?`更轻量，适合应届与校招投递。`:`通用职场版，强调清晰度、业绩证据与 ATS 友好。`;function V({label:e,value:t,helper:n,tone:r=`neutral`}){return(0,F.jsxs)(`div`,{className:`he-opt-metric he-opt-metric-${r}`,children:[(0,F.jsx)(`div`,{className:`he-opt-metric-label`,children:e}),(0,F.jsx)(`div`,{className:`he-opt-metric-value`,children:t}),(0,F.jsx)(`div`,{className:`he-opt-metric-helper`,children:n})]})}function nt({items:e,limit:t=6}){let n=e.map(e=>a(e)).filter(Boolean).slice(0,t);return n.length?(0,F.jsx)(`div`,{className:`he-opt-bullet-list`,children:n.map((e,t)=>(0,F.jsxs)(`div`,{className:`he-opt-bullet-item`,children:[(0,F.jsx)(`span`,{className:`he-opt-bullet-index`,children:t+1}),(0,F.jsx)(`div`,{children:(0,F.jsx)(O,{text:e})})]},`${e}_${t}`))}):null}function rt({items:e,tone:t=`success`}){let n=e.map(e=>a(e)).filter(Boolean);return n.length?(0,F.jsx)(`div`,{className:`he-opt-keyword-cloud`,children:n.map((e,n)=>(0,F.jsx)(`span`,{className:`he-opt-keyword he-opt-keyword-${t}`,children:e},`${e}_${n}`))}):null}function H({text:e}){return(0,F.jsx)(`div`,{className:`he-opt-empty`,children:e})}var it={height:30,minHeight:30,padding:`0 10px`,gap:6,fontSize:12,fontWeight:600};function at({busy:e,resultHeading:t,optimizePrimary:n,items:r,resultTab:i,setResultTab:o,effectiveOptimizedResume:s,editableOptimizedResume:c,setEditableOptimizedResume:l,shownOptimizedResume:u,shownChanges:f,shownAtsKeywords:m,optimizeMissingKeywords:h,optimizeAtsNotes:g,optimizeMatchMatrix:_,sideBySideRows:ee,resumeStyle:v,setResumeStyle:y,resumeStyleOptions:te,resumePreviewBusy:ne,onGenerateWebResume:re}){let b=String(s||``).trim(),x=!!b,S=r?.[0],C=Array.isArray(S?.caveats)?S.caveats.map(e=>a(e)).filter(Boolean):[],ie=Array.isArray(S?.highlights)?S.highlights.map(e=>a(e)).filter(Boolean).slice(0,5):[],ae=[{key:`delivery`,label:`最终简历`,meta:x?`${b.length} 字`:``},{key:`diff`,label:`改动对比`,meta:f.length?`${f.length} 项`:``},{key:`insight`,label:`ATS 分析`,meta:m.length?`${m.length} 词`:``}];return(0,F.jsxs)(`div`,{className:`he-opt-result he-opt-editorial`,children:[(0,F.jsxs)(`div`,{className:`he-opt-hero`,children:[(0,F.jsxs)(`div`,{className:`he-opt-hero-main`,children:[(0,F.jsx)(`div`,{className:`he-opt-eyebrow`,children:`AI 简历优化报告`}),(0,F.jsx)(`div`,{className:`he-opt-title-row`,children:(0,F.jsx)(`h2`,{className:`he-opt-title`,children:t||`简历优化结果`})}),n.company?(0,F.jsxs)(`div`,{className:`he-opt-subtitle`,children:[`目标企业：`,n.company]}):null,(0,F.jsx)(`div`,{className:`he-opt-summary`,children:(0,F.jsx)(O,{text:n.fitSummary||`已完成针对目标岗位的专业化改写，你可以继续编辑正文、查看差异或生成网页简历。`})}),(0,F.jsxs)(`div`,{className:`he-opt-hero-actions`,children:[(0,F.jsxs)(`button`,{type:`button`,className:`ds-btn ds-btn-secondary ds-btn-sm`,style:it,onClick:async()=>{try{await navigator.clipboard.writeText(b)}catch{}},disabled:!x,children:[(0,F.jsx)(d,{size:13,"aria-hidden":`true`}),(0,F.jsx)(`span`,{children:`复制正文`})]}),(0,F.jsxs)(`button`,{type:`button`,className:`ds-btn ds-btn-primary ds-btn-sm`,style:it,onClick:re,disabled:!x||ne,children:[(0,F.jsx)(p,{size:13,"aria-hidden":`true`}),(0,F.jsx)(`span`,{children:ne?`排版生成中…`:`生成网页简历`})]})]})]}),(0,F.jsxs)(`div`,{className:`he-opt-metric-grid`,children:[(0,F.jsx)(V,{label:`改写长度`,value:x?`${b.length}`:`-`,helper:`可直接编辑并同步到排版`}),(0,F.jsx)(V,{label:`关键改动`,value:`${f.length||n.changeCount||0}`,helper:`结构、量化与表达优化`,tone:`success`}),(0,F.jsx)(V,{label:`ATS 关键词`,value:`${m.length}`,helper:`已注入岗位相关关键词`,tone:`success`}),(0,F.jsx)(V,{label:`待补充提醒`,value:`${C.length||n.caveatCount||0}`,helper:`避免把占位内容当作事实`,tone:C.length?`warning`:`neutral`})]})]}),ie.length?(0,F.jsxs)(`div`,{className:`he-opt-highlight-strip`,children:[(0,F.jsx)(`div`,{className:`he-opt-strip-title`,children:`本轮强化亮点`}),(0,F.jsx)(rt,{items:ie,tone:`success`})]}):null,(0,F.jsx)(`div`,{className:`he-opt-tabs`,role:`tablist`,"aria-label":`简历优化结果视图`,children:ae.map(e=>(0,F.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":i===e.key,className:`he-opt-tab ${i===e.key?`he-opt-tab-active`:``}`,onClick:()=>o(e.key),children:[(0,F.jsx)(`span`,{children:e.label}),e.meta?(0,F.jsx)(`small`,{children:e.meta}):null]},e.key))}),i===`delivery`?(0,F.jsxs)(`div`,{className:`he-opt-delivery-stack`,children:[(0,F.jsxs)(`div`,{className:`he-opt-resume-stage`,children:[(0,F.jsxs)(`div`,{className:`he-opt-paper-toolbar`,children:[(0,F.jsx)(`span`,{children:`最终可投递版本`}),(0,F.jsx)(`span`,{children:e?`生成中…`:x?`可编辑`:`等待生成`})]}),(0,F.jsx)(`textarea`,{className:`he-opt-resume-textarea`,"aria-label":`最终可投递简历正文`,value:c,onChange:e=>l(e.target.value),placeholder:e?`生成中…`:`改写后的简历内容将显示在这里`})]}),(0,F.jsxs)(`div`,{className:`he-opt-style-row`,children:[te.map(e=>(0,F.jsxs)(`button`,{type:`button`,className:`he-opt-style-chip ${v===e.value?`he-opt-style-chip-active`:``}`,"aria-pressed":v===e.value,onClick:()=>y(e.value),children:[(0,F.jsx)(`strong`,{children:e.label}),(0,F.jsx)(`span`,{children:B(String(e.value))})]},e.value)),(0,F.jsx)(`button`,{type:`button`,className:`he-opt-style-chip he-opt-style-chip-muted`,onClick:()=>{let e=String(u||``).trim();e&&window.confirm(`将回退到本次 AI 生成的未修改版本，你当前手动编辑的内容会被覆盖。回退不会退回本次已消耗的积分，是否继续？`)&&l(e)},disabled:!String(u||``).trim(),children:`回退到未修改版本`})]})]}):null,i===`diff`?(0,F.jsxs)(`div`,{className:`he-opt-stack`,children:[f.length?(0,F.jsxs)(`div`,{className:`he-opt-card`,children:[(0,F.jsxs)(`div`,{className:`he-opt-card-head`,children:[(0,F.jsx)(`span`,{children:`关键改动`}),(0,F.jsxs)(`small`,{children:[f.length,` 项`]})]}),(0,F.jsx)(nt,{items:f,limit:20})]}):null,(0,F.jsx)(`div`,{className:`he-opt-diff-legend`,children:`左侧为原始简历，右侧为改写结果；红色代表删除，绿色代表新增或强化。`}),(0,F.jsxs)(`div`,{className:`he-diff-shell he-opt-diff-shell`,children:[(0,F.jsxs)(`div`,{className:`he-diff-header`,children:[(0,F.jsx)(`div`,{className:`he-diff-title`,children:`原始简历`}),(0,F.jsx)(`div`,{className:`he-diff-title`,children:`改写结果`})]}),(0,F.jsx)(`div`,{className:`he-diff-scroll`,children:ee.length?ee.map((e,t)=>{let n=e.leftKind===`del`?{background:`rgba(239,68,68,0.07)`,color:`var(--danger)`,textDecoration:`line-through`,textDecorationThickness:`1.5px`}:e.leftKind===`empty`?{background:`transparent`,color:`transparent`}:{background:`transparent`,color:`var(--text-2)`},r=e.rightKind===`add`?{background:`rgba(34,197,94,0.07)`,color:`var(--success)`,boxShadow:`inset 3px 0 0 rgba(34,197,94,0.45)`}:e.rightKind===`empty`?{background:`transparent`,color:`transparent`}:{background:`transparent`,color:`var(--text-2)`};return(0,F.jsxs)(`div`,{className:`he-diff-row`,children:[(0,F.jsxs)(`div`,{className:`he-diff-cell`,style:{display:`grid`,gridTemplateColumns:`32px minmax(0,1fr)`,gap:8,alignItems:`start`,...n},children:[(0,F.jsx)(`span`,{className:`he-opt-line-no`,children:t+1}),(0,F.jsx)(`div`,{children:(0,F.jsx)(O,{text:e.left||` `})})]}),(0,F.jsxs)(`div`,{className:`he-diff-cell`,style:{display:`grid`,gridTemplateColumns:`32px minmax(0,1fr)`,gap:8,alignItems:`start`,...r},children:[(0,F.jsx)(`span`,{className:`he-opt-line-no`,children:t+1}),(0,F.jsx)(`div`,{children:(0,F.jsx)(O,{text:e.right||` `})})]})]},`resume_diff_${t}`)}):(0,F.jsx)(H,{text:e?`生成中…`:`暂无对比内容，请先完成改写。`})})]})]}):null,i===`insight`?(0,F.jsxs)(`div`,{className:`he-opt-insight-grid`,children:[(0,F.jsxs)(`div`,{className:`he-opt-card`,children:[(0,F.jsxs)(`div`,{className:`he-opt-card-head`,children:[(0,F.jsx)(`span`,{children:`已注入 ATS 关键词`}),(0,F.jsxs)(`small`,{children:[m.length,` 个`]})]}),m.length?(0,F.jsx)(rt,{items:m.slice(0,30),tone:`success`}):(0,F.jsx)(H,{text:`关键词会在改写完成后显示。`})]}),(0,F.jsxs)(`div`,{className:`he-opt-card he-opt-card-warning`,children:[(0,F.jsxs)(`div`,{className:`he-opt-card-head`,children:[(0,F.jsx)(`span`,{children:`建议补充关键词`}),(0,F.jsxs)(`small`,{children:[h.length,` 个`]})]}),h.length?(0,F.jsx)(rt,{items:h,tone:`warning`}):(0,F.jsx)(H,{text:`暂无明显缺失关键词。`})]}),g.length?(0,F.jsxs)(`div`,{className:`he-opt-card`,children:[(0,F.jsx)(`div`,{className:`he-opt-card-head`,children:(0,F.jsx)(`span`,{children:`ATS 建议`})}),(0,F.jsx)(nt,{items:g})]}):null,_.length?(0,F.jsxs)(`div`,{className:`he-opt-card`,children:[(0,F.jsxs)(`div`,{className:`he-opt-card-head`,children:[(0,F.jsx)(`span`,{children:`岗位要求覆盖`}),(0,F.jsxs)(`small`,{children:[_.length,` 项`]})]}),(0,F.jsx)(nt,{items:_.map(e=>`${a(e.requirement)}：${a(e.resumeStatus)}${a(e.gapType)?`（${a(e.gapType)}）`:``}`)})]}):null,C.length?(0,F.jsxs)(`div`,{className:`he-opt-card he-opt-card-danger`,children:[(0,F.jsx)(`div`,{className:`he-opt-card-head`,children:(0,F.jsx)(`span`,{children:`注意事项`})}),(0,F.jsx)(nt,{items:C})]}):null,!m.length&&!h.length&&!g.length?(0,F.jsx)(H,{text:`ATS 分析数据将在改写完成后显示。`}):null]}):null]})}var U=e=>{let t=String(e||``).replace(/\r/g,``).replace(/```[\s\S]*?```/g,``).split(`
`).map(e=>e.trimEnd()),n=[],r=``;for(let e of t){let t=String(e||``).trim();t&&(/output_schema|schema|compact_json|max_tokens|response_format|max_chars|字符|5200/i.test(t)||/^[\{\}\[\],]+$/.test(t)||t!==r&&(r=t,n.push(t)))}let i=n.join(`
`);return i.length<=12e3?i:`…\n${i.slice(-12e3)}`},W=(e,t)=>{let n=new Blob([String(t||``)],{type:`text/plain;charset=utf-8`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=e,document.body.appendChild(i),i.click(),i.remove(),setTimeout(()=>URL.revokeObjectURL(r),1e3)},ot=[{value:`professional`,label:`专业样式`},{value:`academic`,label:`学术样式`},{value:`graduate`,label:`应届生样式`}],G=e=>{let t=a(e);return t===`7d`?new Date(Date.now()+10080*60*1e3).toISOString():t===`30d`?new Date(Date.now()+720*60*60*1e3).toISOString():``},st=e=>{let t=a(e?.message||e),n=t.toLowerCase();return t===`Requested function was not found`||t===`NOT_FOUND`||n.includes(`requested function was not found`)?`分享服务未部署成功，请先部署 国内后端 workspace API 后再重试`:t||`请重试`},K={height:30,minHeight:30,padding:`0 10px`,gap:6,fontSize:12,fontWeight:600};function ct(){let[e]=r(),t=(0,P.useRef)(null),{isAuthed:n,resumeFile:i,setResumeFile:o,resumeText:s,setResumeText:c,jd:u,setJd:d,resumeStyle:p,setResumeStyle:g,busy:te,setBusy:ne,runState:re,progress:b,failByMessage:x,err:C,setErr:ie,chatTurns:ae,items:oe,matchCarryover:w,setMatchCarryover:se,editableCarryover:T,setEditableCarryover:D,restoredHint:O,restoredFields:ue,isRestored:de,abortRef:fe,parseAbortRef:pe,runSeqRef:me,resultCardRef:he,streamText:ye,streamThinking:k,streamStage:be,streamActor:xe,fallbackInfo:Se,parseBusy:Ce,parseStage:we,parseErrText:Te,setParseErrText:De,resumePreviewBusy:I,resumePreviewErrText:ke,setResumePreviewErrText:Ae,resumePreviewHtml:L,setResumePreviewHtml:je,resumePreviewSourceHtml:R,setResumePreviewSourceHtml:Me,resumePreviewBilling:Ne,resumePreviewStep:Pe,setResumePreviewStep:Fe,resumePreviewNoticeText:Ie,setResumePreviewNoticeText:Le,clearResumePreviewState:Re,lastResumePreviewText:ze,canRun:Be,shownOptimizedResume:Ve,effectiveOptimizedResume:He,editableOptimizedResume:Ue,setEditableOptimizedResume:We,shownAtsKeywords:Ge,shownChanges:Ke,sideBySideRows:qe,optimizePrimary:Je,optimizeMissingKeywords:z,optimizeAtsNotes:Ye,optimizeMatchMatrix:Xe,runParseResume:$e,run:et,runAgent:B,agentMode:V,agentSteps:nt,agentText:rt,resultTab:H,setResultTab:it,runResumePdfPreview:ct,printHtmlResume:lt}=Ze(),[ut,q]=(0,P.useState)(!1),[dt,J]=(0,P.useState)(``),[Y,ft]=(0,P.useState)(``),[pt,X]=(0,P.useState)(``),[mt,ht]=(0,P.useState)(`30d`);(0,P.useEffect)(()=>{if(!Y){X(``);return}let e=!0;return Qe.toDataURL(Y,{errorCorrectionLevel:`M`,margin:1,width:168,color:{dark:`#111827`,light:`#ffffff`}}).then(t=>{e&&X(t)}).catch(()=>{e&&X(``)}),()=>{e=!1}},[Y]),(0,P.useEffect)(()=>{if(!I||!R)return;let e=t.current;if(!e)return;let n=window.requestAnimationFrame(()=>{e.scrollTop=e.scrollHeight});return()=>window.cancelAnimationFrame(n)},[I,R]);let gt=(0,P.useMemo)(()=>ee(Se),[Se]),_t=(0,P.useMemo)(()=>v(Se),[Se]),vt=(0,P.useMemo)(()=>[...Array.isArray(ae)?ae:[]].reverse().find(e=>e?.role===`assistant`&&e?.billing)?.billing||null,[ae]),Z=V?`本次 Agent 深度改写`:`本次简历优化`,yt=(0,P.useMemo)(()=>a(Je.jobTitle)||`简历优化结果`,[Je.jobTitle]),Q=T||w,bt=(0,P.useMemo)(()=>{let e=[...Array.isArray(Q?.gaps)?Q.gaps:[],...Array.isArray(Q?.actions)?Q.actions:[],...Array.isArray(Q?.keywords)?Q.keywords:[]].map(e=>a(e)).filter(Boolean);return Array.from(new Set(e)).length},[Q]),$=(0,P.useMemo)(()=>a(e.get(`source`))===`resume_match`||a(e.get(`matchRid`))||a(O).includes(`承接简历匹配`)?!0:!!Q?.sourceRid,[Q?.sourceRid,O,e]),xt=(0,P.useMemo)(()=>{if(!$)return[];let e=new Set((Array.isArray(ue)?ue:[]).map(e=>a(e))),t=e.has(`简历文本`)||!!a(s),n=e.has(`JD`)||!!a(u),r=bt>0;return[{key:`resume`,active:t,text:t?`已自动带入简历`:`当前未自动带入简历`},{key:`jd`,active:n,text:n?`已自动带入 JD`:`当前未自动带入 JD`},{key:`carryover`,active:r,text:r?`已带入 ${bt} 条匹配建议`:`当前未带入匹配建议`}]},[bt,u,ue,s,$]),St=(e,t)=>{D(n=>n&&{...n,[e]:t.split(`
`).map(e=>a(e)).filter(Boolean)})},Ct=(0,P.useMemo)(()=>I?Pe||`正在排版…`:``,[I,Pe]),wt=(0,P.useMemo)(()=>n?``:`请先登录后使用简历优化功能`,[n]);return(0,F.jsx)(E,{title:`简历优化`,subTitle:`上传 PDF 简历（或粘贴文本）+ 粘贴 JD，生成针对该岗位的优化简历文本。`,forceThinkingEnabled:!0,hideThinkingToggle:!0,hideModelSelector:!0,defaultModelChoice:`deepseek_pro`,children:(0,F.jsxs)(`div`,{className:`he-tools-layout`,children:[(0,F.jsx)(`aside`,{className:`he-tools-sidebar`,children:(0,F.jsx)(ce,{current:`/tools/resume-optimize`})}),(0,F.jsxs)(`section`,{className:`he-tools-main`,children:[xt.length?(0,F.jsxs)(`div`,{className:`he-card`,style:{marginBottom:14,background:`color-mix(in srgb, var(--surface) 97%, rgba(59,130,246,0.04))`},children:[(0,F.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:12,flexWrap:`wrap`},children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`he-label`,children:`已自动承接上一轮简历匹配`}),(0,F.jsx)(`div`,{className:`he-muted`,style:{marginTop:6,fontSize:13,lineHeight:1.7},children:`当前会直接沿用匹配页带过来的简历、JD 和匹配建议，你可以在下方继续补充或修改。`})]}),(0,F.jsx)(`span`,{className:`he-chip`,children:Q?.scoreText||`已承接匹配上下文`})]}),(0,F.jsx)(`div`,{style:{marginTop:12,display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(180px, 1fr))`,gap:10},children:xt.map(e=>(0,F.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`10px 12px`,borderRadius:14,border:`1px solid ${e.active?`rgba(34,197,94,0.18)`:`var(--border-soft)`}`,background:e.active?`rgba(34,197,94,0.05)`:`var(--surface)`},children:[(0,F.jsx)(`span`,{style:{fontSize:11,lineHeight:1,padding:`3px 8px`,borderRadius:999,background:e.active?`rgba(34,197,94,0.10)`:`var(--surface2)`,color:e.active?`var(--success)`:`var(--text-3)`,fontWeight:700},children:e.active?`已带入`:`未带入`}),(0,F.jsx)(`span`,{style:{fontSize:13,color:e.active?`var(--text-1)`:`var(--text-3)`,fontWeight:e.active?600:500},children:e.text})]},e.key))})]}):null,(0,F.jsxs)(`div`,{className:`he-form-grid`,children:[(0,F.jsxs)(`div`,{className:`he-form-block he-accent-blue`,children:[n?null:(0,F.jsx)(`div`,{className:`ui-alert ui-alert-info text-[12px] leading-relaxed`,style:{marginBottom:12},children:`请先登录后使用简历优化功能。未登录状态下暂不支持上传、粘贴和生成。`}),(0,F.jsxs)(`div`,{className:`he-pill`,children:[(0,F.jsx)(`span`,{className:`he-pill-dot`}),`简历`]}),(0,F.jsxs)(`div`,{style:{marginTop:12},children:[(0,F.jsx)(N,{label:`PDF 简历（可选）`,accept:`application/pdf,.pdf`,file:i,onPick:o,disabled:!n,hint:`上传后会自动解析；也可直接粘贴简历文本。解析按页计费（会消耗积分），生成结果另按 token 计费。`}),i&&!a(s)?(0,F.jsxs)(`div`,{className:`he-muted he-parse-status`,children:[(0,F.jsx)(`div`,{className:`he-parse-status-text`,children:Ce?`解析中… ${we||``}`:Te?`解析失败：${Te}`:`等待解析…`}),(0,F.jsx)(`div`,{className:`he-inline-actions`,children:Ce?(0,F.jsx)(`button`,{type:`button`,className:`he-compact-action he-compact-action--secondary`,onClick:()=>{try{pe.current?.abort()}catch{}},children:`取消解析`}):(0,F.jsx)(`button`,{type:`button`,className:`he-compact-action he-compact-action--secondary`,disabled:!n,onClick:async()=>{if(await l())try{await $e(`run`)}catch(e){De(a(e?.message||`解析失败`))}},children:`重新解析`})})]}):null]}),(0,F.jsx)(`div`,{className:`he-sep`}),(0,F.jsx)(`div`,{className:`he-label`,children:`简历文本（可直接粘贴，优先使用）`}),(0,F.jsx)(`textarea`,{className:[`he-textarea`,de(`简历文本`)?`he-restored-field`:``].join(` `),value:s,onChange:e=>c(e.target.value),placeholder:wt||`粘贴简历文本…`,disabled:!n})]}),(0,F.jsxs)(`div`,{className:`he-form-block he-accent-orange`,children:[(0,F.jsxs)(`div`,{className:`he-pill`,children:[(0,F.jsx)(`span`,{className:`he-pill-dot`}),`职位`]}),(0,F.jsx)(`div`,{style:{marginTop:10},className:`he-label`,children:`职位描述 JD（必填）`}),(0,F.jsx)(`textarea`,{className:[`he-textarea`,de(`JD`)?`he-restored-field`:``].join(` `),value:u,onChange:e=>d(e.target.value),placeholder:wt||`粘贴职位描述 / 任职要求…`,disabled:!n}),(0,F.jsx)(j,{jd:u,sourceTool:`resume_optimize`,disabled:!n}),(0,F.jsx)(`div`,{style:{marginTop:14,display:`flex`,justifyContent:`flex-end`},children:(0,F.jsxs)(`div`,{className:`he-action-pill-group`,children:[(0,F.jsx)(`button`,{type:`button`,className:`he-action-pill`,onClick:()=>{V?B():et()},disabled:!n||!Be||te,children:te?V?`Agent 分析中…`:`生成中… ${Math.max(1,Math.min(100,Math.round(b||0)))}%`:n?V?`深度优化`:`开始生成`:`登录后使用`}),(0,F.jsx)(`button`,{type:`button`,className:`he-action-pill he-action-pill--ghost`,onClick:()=>A({tool:`resume_optimize`,runSeqRef:me,abortRef:fe,setBusy:ne,onCancelled:()=>x(`已取消`,ie)}),disabled:!te,children:`取消`})]})})]})]}),T||w?(0,F.jsxs)(`div`,{className:`he-card`,style:{marginTop:14,background:`color-mix(in srgb, var(--surface) 98%, rgba(244,136,53,0.03))`},children:[(0,F.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:12,flexWrap:`wrap`},children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`he-label`,children:`已承接上一轮匹配结论`}),(0,F.jsxs)(`div`,{className:`he-muted`,style:{marginTop:6,fontSize:13,lineHeight:1.75},children:[`已从上次匹配结果带入 `,bt||0,` 个改进点。现在可以直接编辑这些带入信息，确认哪些要保留、删减或重写。`]})]}),(0,F.jsx)(`span`,{className:`he-chip`,children:Q?.scoreText||`已带入改进点`})]}),(0,F.jsxs)(`div`,{style:{marginTop:12,display:`grid`,gap:10},children:[(0,F.jsx)(`textarea`,{className:`he-textarea`,value:a((T||w)?.summary),onChange:e=>D(t=>t&&{...t,summary:e.target.value}),placeholder:`匹配结论摘要`,disabled:!n}),(0,F.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(2, minmax(0, 1fr))`,gap:10},children:[(0,F.jsx)(`textarea`,{className:`he-textarea`,value:Array.isArray((T||w)?.strengths)?(T||w).strengths.join(`
`):``,onChange:e=>St(`strengths`,e.target.value),placeholder:`最强优势，每行一条`,disabled:!n}),(0,F.jsx)(`textarea`,{className:`he-textarea`,value:Array.isArray((T||w)?.gaps)?(T||w).gaps.join(`
`):``,onChange:e=>St(`gaps`,e.target.value),placeholder:`关键缺口，每行一条`,disabled:!n}),(0,F.jsx)(`textarea`,{className:`he-textarea`,value:Array.isArray((T||w)?.actions)?(T||w).actions.join(`
`):``,onChange:e=>St(`actions`,e.target.value),placeholder:`优先动作，每行一条`,disabled:!n}),(0,F.jsx)(`textarea`,{className:`he-textarea`,value:Array.isArray((T||w)?.keywords)?(T||w).keywords.join(`
`):``,onChange:e=>St(`keywords`,e.target.value),placeholder:`重点关键词，每行一条`,disabled:!n})]}),(0,F.jsx)(`div`,{style:{display:`flex`,gap:8,flexWrap:`wrap`},children:Array.isArray((T||w)?.keywords)?(T||w).keywords.slice(0,6).map(e=>(0,F.jsx)(`span`,{className:`he-chip`,children:e},e)):null}),(0,F.jsxs)(`div`,{className:`he-inline-actions`,children:[(0,F.jsx)(`button`,{type:`button`,className:`he-compact-action he-compact-action--secondary`,onClick:()=>D(w),disabled:!n,children:`恢复匹配原结论`}),(0,F.jsx)(`button`,{type:`button`,className:`he-compact-action he-compact-action--secondary`,onClick:()=>{D(null),se(null)},disabled:!n,children:`移除 carryover`})]})]})]}):null,(0,F.jsx)(M,{state:re,progress:b}),C?(0,F.jsx)(`div`,{className:`he-err`,children:C}):null,V&&(nt.length>0||a(k))?(0,F.jsx)(tt,{title:`简历优化 Agent`,busy:te,progress:b,steps:nt,labels:{orchestrator:`编排调度`,jd_analysis:`岗位解析`,resume_match:`匹配评估`,resume_optimize:`逐条优化`,resume_translate:`简历翻译`,resume_html:`HTML 排版`,resume_pdf_extract:`PDF 解析`,interview_questions:`面试题库`,salary_research:`薪酬调研`,career_assessment:`职业评估`,cover_letter:`求职信`,jd_optimize:`JD 优化`,session_note:`会话记录`,finalize:`结果整合`},streamThinking:U(k),streamStage:be,streamActor:xe,emptyText:`正在按岗位要求优化简历并整理改动原因…`}):null,V&&a(ye)?(0,F.jsxs)(`div`,{className:`he-opt-report-card`,children:[(0,F.jsx)(`div`,{className:`he-opt-report-card-head`,children:`Agent 分析报告`}),(0,F.jsx)(_,{billing:vt,label:Z,style:{marginTop:6,marginBottom:12}}),(0,F.jsx)(S,{text:ye||``})]}):null,!V&&(te||ye||k)?(0,F.jsx)(le,{assistantLabel:`简历优化助手`,busy:te,streamText:ye,streamThinking:U(k),streamStage:be,streamActor:xe,agentMode:!1,agentText:rt,agentSteps:nt,stepLabels:{jd_analysis:`岗位解析`,resume_match:`匹配评估`,resume_optimize:`逐条优化`},emptyText:`正在流式生成优化结果…`,fullWidth:!0}):null,V&&rt&&oe&&oe.length?(0,F.jsxs)(`div`,{style:{marginTop:24,padding:`16px 20px`,borderRadius:16,background:`var(--surface)`,border:`1px solid rgba(34,197,94,0.3)`,boxShadow:`0 4px 20px rgba(34,197,94,0.06)`},children:[(0,F.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,F.jsx)(`span`,{style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:24,height:24,borderRadius:`50%`,background:`rgba(34,197,94,0.15)`,color:`var(--success)`},children:(0,F.jsx)(`svg`,{width:`14`,height:`14`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:3,children:(0,F.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5 13l4 4L19 7`})})}),(0,F.jsx)(`div`,{style:{fontSize:14,fontWeight:700,color:`var(--text-1)`},children:`Agent 优化完成 · 已解析结构化结果`})]}),(0,F.jsx)(`div`,{className:`he-muted`,style:{fontSize:13,marginTop:6,paddingLeft:34},children:`简历正文已提取到编辑区，原文对比与 ATS 分析也已就绪，请在下方查看。`})]}):null,(0,F.jsx)(`div`,{style:{marginTop:24,width:`100%`},children:oe&&oe.length||O||gt?(0,F.jsxs)(`div`,{className:[`he-split-card`,O?`he-restored-focus`:``].join(` `),ref:he,style:{width:`100%`},children:[(0,F.jsx)(`div`,{className:`he-split-head`,children:(0,F.jsx)(`div`,{children:(0,F.jsx)(Ee,{restoredHint:O,restoredFields:ue,runState:re})})}),(0,F.jsxs)(`div`,{className:`he-split-body report-light-surface report-light-scrollbar`,children:[gt?(0,F.jsx)(y,{raw:Se,variant:`notice`,style:{marginBottom:12,padding:`10px 14px`,borderRadius:14,background:`rgba(244, 136, 53, 0.08)`,border:`1px solid rgba(244, 136, 53, 0.18)`},textStyle:{color:`var(--text-1)`,fontSize:13,fontWeight:600}}):null,V?null:(0,F.jsx)(_,{billing:vt,label:Z,style:{marginBottom:12}}),oe&&oe.length?(0,F.jsxs)(`div`,{children:[_t?(0,F.jsx)(y,{raw:Se,variant:`hint`,style:{marginBottom:12,padding:`10px 14px`,borderRadius:14,background:`rgba(244,136,53,0.07)`,border:`1px solid rgba(244,136,53,0.16)`},textStyle:{color:`var(--text-2)`,fontSize:13,lineHeight:1.65}}):null,(0,F.jsx)(at,{busy:te,resultHeading:yt,optimizePrimary:Je,items:oe,resultTab:H,setResultTab:it,effectiveOptimizedResume:String(He||``).trim(),editableOptimizedResume:Ue,setEditableOptimizedResume:We,shownOptimizedResume:Ve,shownChanges:Ke,shownAtsKeywords:Ge,optimizeMissingKeywords:z,optimizeAtsNotes:Ye,optimizeMatchMatrix:Xe,sideBySideRows:qe,resumeStyle:p,setResumeStyle:e=>g(e),resumeStyleOptions:ot,resumePreviewBusy:I,onGenerateWebResume:()=>{J(``),ft(``),Re(),Ae(``),ct(String(He||``).trim())}})]}):null]})]}):null}),I||L||R||ke?(0,F.jsxs)(`div`,{style:{margin:`16px 0`,border:`1px solid var(--border)`,borderRadius:12,background:`var(--surface)`,overflow:`hidden`},children:[(0,F.jsxs)(`div`,{style:{padding:`12px 16px`,borderBottom:`1px solid var(--border)`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:10},children:[(0,F.jsx)(`div`,{style:{fontSize:13,fontWeight:700,color:`var(--text-1)`},children:I?Pe||`生成中…`:L?`网页简历已生成`:`生成失败`}),I?null:(0,F.jsx)(`button`,{type:`button`,className:`btn-secondary`,style:{padding:`2px 10px`,fontSize:12},onClick:()=>{J(``),ft(``),je(``),Me(``),Ae(``),Fe(``),Le(``)},children:`关闭`})]}),(0,F.jsxs)(`div`,{style:{padding:`12px 16px`},children:[Ie?(0,F.jsx)(`div`,{style:{marginBottom:12,padding:`10px 12px`,borderRadius:12,border:`1px solid rgba(59,130,246,0.22)`,background:`rgba(239,246,255,0.85)`,color:`var(--text-1)`,fontSize:13,lineHeight:1.65},children:Ie}):null,ke?(0,F.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,flexWrap:`wrap`},children:[(0,F.jsx)(`div`,{className:`he-err`,style:{flex:`1 1 auto`},children:ke}),ze?(0,F.jsx)(`button`,{type:`button`,className:`btn-secondary`,style:{fontSize:12},onClick:()=>ct(ze),disabled:I,children:`重试`}):null]}):null,dt?(0,F.jsx)(`div`,{style:{marginBottom:12},className:dt.startsWith(`分享失败`)?`he-err`:`he-muted`,children:dt}):null,I?(0,F.jsx)(`div`,{className:`he-muted`,style:{marginBottom:12},children:Pe||`正在生成简历页面…`}):null,(0,F.jsx)(_,{billing:Ne,label:`本次 HTML 简历生成`,style:{marginBottom:12}}),I?(0,F.jsxs)(`div`,{style:{marginBottom:16},children:[(0,F.jsx)(`div`,{className:`he-label`,style:{marginBottom:8},children:`排版进度`}),(0,F.jsxs)(`div`,{style:{border:`1px solid var(--border)`,borderRadius:12,background:`var(--surface2)`,padding:12},children:[(0,F.jsx)(`div`,{style:{fontSize:14,color:`var(--text-1)`,lineHeight:1.7},children:Ct}),(0,F.jsx)(`div`,{className:`he-muted`,style:{marginTop:6,fontSize:12,lineHeight:1.65},children:`系统正在把确认后的内容排成可打印简历，可在下方查看实时生成的 HTML 代码。`})]})]}):null,R?(0,F.jsxs)(`div`,{style:{marginBottom:16,border:`1px solid var(--border)`,borderRadius:10,overflow:`hidden`,background:`#0f172a`},children:[(0,F.jsxs)(`div`,{style:{padding:`10px 12px`,borderBottom:`1px solid rgba(148,163,184,0.25)`,display:`flex`,justifyContent:`space-between`,alignItems:`center`,gap:10,flexWrap:`wrap`},children:[(0,F.jsx)(`div`,{style:{fontSize:12,fontWeight:800,color:`#e5e7eb`},children:I?R.length<80?`正在等待模型输出 HTML 代码`:`HTML 代码实时生成中`:`HTML 代码`}),(0,F.jsxs)(`div`,{style:{fontSize:12,color:`#94a3b8`},children:[R.length.toLocaleString(),` 字符`]})]}),(0,F.jsx)(`pre`,{ref:t,style:{margin:0,maxHeight:I?260:180,overflow:`auto`,padding:12,color:`#dbeafe`,fontSize:12,lineHeight:1.65,whiteSpace:`pre-wrap`,wordBreak:`break-word`,fontFamily:`var(--ds-font-mono)`},children:R})]}):null,L?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`iframe`,{title:`resume_html_preview`,srcDoc:L,style:{width:`100%`,height:480,border:`1px solid var(--border)`,borderRadius:8,background:`#fff`,display:`block`}}),(0,F.jsxs)(`div`,{style:{marginTop:10,display:`flex`,alignItems:`center`,gap:10,flexWrap:`wrap`},children:[(0,F.jsx)(`div`,{className:`he-muted`,style:{fontSize:12},children:`分享有效期`}),(0,F.jsxs)(`select`,{value:mt,onChange:e=>ht(e.target.value),style:{minHeight:32,borderRadius:10,border:`1px solid var(--border)`,background:`var(--surface)`,color:`var(--text-1)`,padding:`0 10px`,fontSize:12},children:[(0,F.jsx)(`option`,{value:`7d`,children:`7 天`}),(0,F.jsx)(`option`,{value:`30d`,children:`30 天`}),(0,F.jsx)(`option`,{value:`never`,children:`长期有效`})]})]}),(0,F.jsxs)(`div`,{style:{marginTop:10,display:`flex`,gap:8,flexWrap:`wrap`},children:[(0,F.jsxs)(`button`,{type:`button`,className:`ds-btn ds-btn-primary ds-btn-sm`,style:K,onClick:async()=>{if(!(!L||ut)){q(!0),J(``),X(``);try{let e=await ge({kind:`resume_web_page`,payload:await ve({html:L,styleVariant:p}),expiresAt:G(mt)||void 0});if(!e.ok||!e.id)throw Error(a(e?.error)||`share_failed`);let t=_e(e.id);ft(t);try{await navigator.clipboard.writeText(t)}catch{}J(t?`已生成并复制分享链接：${t}`:`已生成分享链接`)}catch(e){ft(``),X(``),J(`分享失败：${st(e)}`)}finally{q(!1)}}},disabled:ut,children:[(0,F.jsx)(Oe,{size:13,"aria-hidden":`true`}),(0,F.jsx)(`span`,{children:ut?`生成分享中…`:`生成分享链接`})]}),(0,F.jsxs)(`button`,{type:`button`,className:`ds-btn ds-btn-secondary ds-btn-sm`,style:K,onClick:lt,children:[(0,F.jsx)(m,{size:13,"aria-hidden":`true`}),(0,F.jsx)(`span`,{children:`打印 / 保存 PDF`})]}),(0,F.jsxs)(`button`,{type:`button`,className:`ds-btn ds-btn-secondary ds-btn-sm`,style:K,onClick:()=>W(`resume.html`,L),children:[(0,F.jsx)(f,{size:13,"aria-hidden":`true`}),(0,F.jsx)(`span`,{children:`下载 HTML`})]}),(0,F.jsxs)(`button`,{type:`button`,className:`ds-btn ds-btn-secondary ds-btn-sm`,style:K,onClick:()=>{J(``),ft(``),X(``),Ae(``),Le(``),Me(``),ct()},disabled:I,children:[(0,F.jsx)(h,{size:13,"aria-hidden":`true`}),(0,F.jsx)(`span`,{children:`重新生成`})]})]}),Y||pt?(0,F.jsxs)(`div`,{style:{marginTop:12,padding:`14px 16px`,borderRadius:14,border:`1px solid rgba(59,130,246,0.22)`,background:`linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(239,246,255,0.85) 100%)`},children:[(0,F.jsx)(`div`,{className:`he-label`,style:{marginBottom:10},children:`网页简历分享链接`}),(0,F.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`minmax(0, 1fr) auto`,gap:14,alignItems:`start`},children:[(0,F.jsxs)(`div`,{style:{minWidth:0},children:[(0,F.jsx)(`div`,{style:{fontSize:13,lineHeight:1.7,color:`var(--text-1)`,wordBreak:`break-all`},children:Y}),(0,F.jsx)(`div`,{className:`he-muted`,style:{marginTop:8,lineHeight:1.65},children:`任何人打开该链接，或扫描右侧二维码，都可以直接查看这份公开网页简历。`}),(0,F.jsxs)(`div`,{style:{marginTop:10,display:`flex`,gap:8,flexWrap:`wrap`},children:[(0,F.jsx)(`button`,{type:`button`,className:`btn-secondary`,style:{padding:`6px 12px`,fontSize:12},onClick:async()=>{if(Y)try{await navigator.clipboard.writeText(Y),J(`已复制分享链接：${Y}`)}catch{J(`复制失败，请手动复制分享链接`)}},children:`复制链接`}),Y?(0,F.jsx)(`a`,{href:Y,target:`_blank`,rel:`noreferrer`,className:`btn-secondary`,style:{padding:`6px 12px`,fontSize:12,textDecoration:`none`,display:`inline-flex`,alignItems:`center`},children:`打开链接`}):null]})]}),(0,F.jsxs)(`div`,{style:{width:184,display:`grid`,justifyItems:`center`,gap:8},children:[(0,F.jsx)(`div`,{style:{width:184,minHeight:184,borderRadius:16,border:`1px solid var(--border)`,background:`#fff`,display:`grid`,placeItems:`center`,padding:8},children:pt?(0,F.jsx)(`img`,{src:pt,alt:`网页简历分享二维码`,style:{width:168,height:168,display:`block`}}):(0,F.jsx)(`div`,{className:`he-muted`,style:{fontSize:12},children:`二维码生成中…`})}),(0,F.jsx)(`div`,{className:`he-muted`,style:{fontSize:12,textAlign:`center`,lineHeight:1.6},children:`扫码即可打开该网页简历`})]})]})]}):null]}):null]})]}):null]})]})})}export{ct as default};