import{i as e}from"./jsx-runtime-CutOxEx1.js";import{r as t}from"./norm-f7iXVy-b.js";import{t as n}from"./pdfUtils-BDq1qMVd.js";import{c as r,l as i,t as a}from"./proxyOps-DSvg656Q.js";import{n as o}from"./aiRecognition-C9ioM0a4.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)));return{pages:r,costCents:i,billedPoints:e?.billedPoints!=null||t.billedPoints!=null?Math.max(0,Number(e?.billedPoints||0)+Number(t.billedPoints||0)):void 0,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`?5:2,f=()=>({pages:s,costCents:s*d,displayPoints:s*d/100,pointsPerPage:d/100}),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};