1import{aH as f}from"./index-CpeGhXo5.js";async function m(n){return new Uint8Array(await n.arrayBuffer())}function d(n,c=200){return new TextDecoder().decode(n.slice(0,Math.min(c,n.length))).trim()}async function h(n,c){const e=await m(n),s=d(e);if(s.startsWith("{")||s.startsWith("<!")){let o=`Export returned an invalid ${c.toUpperCase()} payload`;try{const t=JSON.parse(d(e,e.length));o=t?.message||t?.data?.message||(typeof t?.data=="string"?t.data:null)||o,t?.success===!0&&t?.data!=null&&typeof t.data=="object"&&(o="Server wrapped the file as JSON. Restart the backend so binary export bypasses the response interceptor.")}catch{}throw new Error(o)}if(String.fromCharCode(e[0]||0,e[1]||0,e[2]||0,e[3]||0)!=="%PDF")throw new Error(`Export did not return a valid PDF (got "${s.slice(0,40).replace(/\s+/g," ")}â¦")`);return new Blob([e],{type:"application/pdf"})}async function u(n,c,e){const s={};e?.templateId&&(s.template=e.templateId),e?.themeId&&(s.theme=e.themeId),e?.font&&(s.font=e.font);const o=await f.get(`/resumes/${n}/export/${c}`,{responseType:"blob",timeout:18e4,params:s,transformResponse:[p=>p],headers:{Accept:"application/pdf"}}),t=String(o.headers?.["content-type"]||""),r=o.data;let a;if(r instanceof Blob?a=r:r instanceof ArrayBuffer?a=new Blob([r]):r instanceof Uint8Array?a=new Blob([r]):typeof r=="string"?a=new Blob([r]):a=new Blob([JSON.stringify(r)]),t.includes("application/json")||t.includes("text/html")){const p=await a.text();let i=`Export failed (${t||"unknown type"})`;try{const l=JSON.parse(p);i=l?.message||l?.data?.message||i}catch{i=p.slice(0,180)||i}throw new Error(i)}return h(a,c)}async function b(n,c,e,s){const o=await u(n,c,s),t=(e||"Resume").replace(/[<>:"/\\|?*]+/g,"").trim().replace(/\s+/g,"_").slice(0,80)||"Resume",r=URL.createObjectURL(o),a=document.createElement("a");a.href=r,a.download=`${t}.${c}`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(r)}export{b as d,u as f};
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.