import{n as e}from"./chunk-B3pr0VN8.js";import{r as t}from"./norm-CeclA1Tu.js";import{t as n}from"./pdfUtils-Bnt45Amd.js";import{c as r,l as i,t as a}from"./proxyOps-D3Awrk7b.js";import{n as o}from"./aiRecognition-Be_rgEBu.js";var s=e({parseStructuredResumePdf:()=>l}),c=(e,t,n)=>{let r=Math.max(1,Math.floor(Number(t.pages??e?.pages??n))),i=Math.max(0,Math.round(Number(e?.costCents||0)+Number(t.costCents||0))),a=e?.billedPointCents!=null||t.billedPointCents!=null?Math.max(0,Math.round(Number(e?.billedPointCents||0)+Number(t.billedPointCents||0))):void 0,o=e?.billedPoints!=null||t.billedPoints!=null?Math.max(0,Number(e?.billedPoints||0)+Number(t.billedPoints||0)):a==null?void 0:a/100;return{...e,...t,pages:r,costCents:i,billedPointCents:a,billedPoints:o,displayPoints:i/100,pointsPerPage:r>0?i/100/r:void 0}},l=async e=>{let s=await n(e.file).catch(()=>1),l=await a(e.file),u,d=e.parser===`textin`?s*5:1,f=()=>({pages:s,costCents:d,displayPoints:d/100,pointsPerPage:e.parser===`textin`&&s>0?.05:void 0}),p=await(e.parser===`textin`?i:r)({fileDataUrl:l,fileName:e.file.name||`resume.pdf`,pages:s,signal:e.signal,minLength:e.minLength,onStage:e.onStage,onUsage:e=>{u=c(u,e,s)}});if(!p)throw Error(`PDF 文本提取失败，请重试或更换更清晰的文件`);if(e.extractStructured===!1)return{rawText:p,structured:null,plainText:p,finalText:p,pages:s,pdfBilling:u||f()};e.onStage?.(`结构化提取…`);let m=await o(p,void 0,{signal:e.signal}),h=t(m?.plainText);return{rawText:p,structured:m,plainText:h,finalText:h||p,pages:s,pdfBilling:u||f()}};export{s as n,l as t};