1function A(n){return n.replace(/^[A-Z]{6}\+/,"").trim()}function D(n){return/^g_[a-z0-9_]+$/i.test(n)||/^[a-z]\d+$/i.test(n)}let g=null;function w(n,e,t){if(!e||D(e))return;const o=A(e);if(!o)return;const r=(t==null?void 0:t.embedded)??!1,a=n.get(o);if(a){a.embedded=a.embedded||r,a.instances=(a.instances??1)+1,!a.type&&(t!=null&&t.type)&&(a.type=t.type);return}n.set(o,{name:o,type:t==null?void 0:t.type,embedded:r,instances:1})}function F(...n){const e=new Map;for(const t of n)for(const o of t){const r=A(o.name);if(!r)continue;const a=e.get(r);if(a){a.embedded=a.embedded||o.embedded,a.instances=Math.max(a.instances??1,o.instances??1),!a.type&&o.type&&(a.type=o.type);continue}e.set(r,{name:r,type:o.type,embedded:o.embedded,instances:o.instances??1})}return[...e.values()].sort((t,o)=>t.name.localeCompare(o.name))}async function C(){return g||(g=(async()=>{const n=[()=>import("./pdf-CgeV8iME.js"),()=>import("./pdf-CE_K4jFx.js"),()=>import("./pdf-CE_K4jFx.js")];for(const e of n)try{const t=await e();if(t&&typeof t.getDocument=="function"){if(t.GlobalWorkerOptions&&!t.GlobalWorkerOptions.workerSrc){const o=[()=>import("./pdf.worker.min-Dk6g9Itu.js"),()=>import("./pdf.worker.min-Dmd7UNYm.js")];for(const r of o)try{const a=await r();if(a.default){t.GlobalWorkerOptions.workerSrc=a.default;break}}catch{}}return t}}catch{}return null})()),g}function x(n){if(!(!n||Number.isNaN(n.getTime())))return n.toISOString()}function y(n){let e="";for(let t=0;t<n.length;t+=1)e+=String.fromCharCode(n[t]);return e}function k(n){const t=y(n.subarray(0,Math.min(n.length,1024))).match(/%PDF-(\d\.\d)/);return(t==null?void 0:t[1])??null}function z(n){const e=y(n.subarray(0,Math.min(n.length,4096)));return/\/Linearized\s+1/.test(e)}function v(n){const e=y(n.subarray(0,Math.min(n.length,65536)));if(!/\/Encrypt\b/.test(e))return{encrypted:!1};const t=e.match(/\/Filter\s*\/([A-Za-z0-9]+)/);return{encrypted:!0,method:(t==null?void 0:t[1])??null}}function O(n){var c;const e=n.match(/pdfaid:part(?:>|=)"?\s*(\d+)/i)??n.match(/<pdfaid:part>\s*(\d+)\s*<\/pdfaid:part>/i),t=n.match(/pdfaid:conformance(?:>|=)"?\s*([A-Za-z])/i)??n.match(/<pdfaid:conformance>\s*([A-Za-z])\s*<\/pdfaid:conformance>/i);if(!e&&!t)return null;const o=e==null?void 0:e[1],r=(c=t==null?void 0:t[1])==null?void 0:c.toUpperCase(),a=o&&r?`PDF/A-${o}${r.toLowerCase()}`:void 0;return{part:o,conformance:r,pdfAClaim:a}}function E(n){const e=y(n),t=e.indexOf("<?xpacket begin"),o=e.indexOf("<x:xmpmeta"),r=t>=0?t:o;if(r<0)return;const a=e.indexOf("<?xpacket end",r),c=a>=0?a+64:Math.min(e.length,r+12e3),s=e.slice(r,c);return{present:!0,selfDeclared:!0,...O(s)}}function I(n){const e=y(n),t=new Map,o=/\/Type\s*\/Font\b[\s\S]{0,1800}?\/BaseFont\s*\/([^\s/>[\]()]+)/g;for(const a of e.matchAll(o)){const c=a.index??0,s=e.slice(c,c+a[0].length),i=s.match(/\/Subtype\s*\/([A-Za-z0-9]+)/),d=/\/FontFile(?:2|3)?\b/.test(s)||/\/FontDescriptor\b/.test(s);w(t,a[1]??"",{type:i==null?void 0:i[1],embedded:d})}const r=/<<([\s\S]{0,3000}?)>>/g;for(const a of e.matchAll(r)){const c=a[1]??"";if(!/\/Type\s*\/Font\b/.test(c))continue;const s=c.split(/\/Type\s*\/Font\b/)[1]??"",i=s.match(/\/BaseFont\s*\/([^\s/>[\]()]+)/);if(!(i!=null&&i[1]))continue;const d=s.match(/\/Subtype\s*\/([A-Za-z0-9]+)/),f=/\/FontFile(?:2|3)?\b/.test(c)||/\/FontDescriptor\b/.test(c);w(t,i[1],{type:d==null?void 0:d[1],embedded:f})}return[...t.values()].sort((a,c)=>a.name.localeCompare(c.name))}async function S(n){var r,a,c;const e=await C();if(!e)return[];const t=new Map,o=new Set([(r=e.OPS)==null?void 0:r.setFont,(a=e.OPS)==null?void 0:a.setFontDict].filter(s=>typeof s=="number"));try{const s=await e.getDocument({data:n,disableWorker:!0,verbosity:(c=e.VerbosityLevel)==null?void 0:c.ERRORS}).promise;for(let i=1;i<=s.numPages;i+=1){const d=await s.getPage(i),f=await d.getOperatorList(),l=new Set;for(let p=0;p<f.fnArray.length;p+=1){if(!o.has(f.fnArray[p]))continue;const m=f.argsArray[p];if(!Array.isArray(m)||typeof m[0]!="string")continue;const h=m[0];if(!l.has(h)){l.add(h);try{const u=await d.commonObjs.get(h),b=(u==null?void 0:u.name)||(u==null?void 0:u.fallbackName);if(!b)continue;w(t,b,{type:u.type,embedded:!0})}catch{}}}}}catch{return[]}return[...t.values()].sort((s,i)=>s.name.localeCompare(i.name))}async function L(n){const{PDFDocument:e}=await import("./worker-entrypoint-Cpi_3YOf.js").then(function(r){return r.r});let t=!1;try{await e.load(n,{ignoreEncryption:!1})}catch(r){(r instanceof Error?r.message.toLowerCase():"").includes("encrypt")&&(t=!0)}const o=await e.load(n,{ignoreEncryption:!0}
1);return{pageCount:o.getPageCount(),passwordProtected:t,documentInfo:{title:o.getTitle()||void 0,author:o.getAuthor()||void 0,subject:o.getSubject()||void 0,keywords:o.getKeywords()||void 0,creator:o.getCreator()||void 0,producer:o.getProducer()||void 0,creationDate:x(o.getCreationDate()),modificationDate:x(o.getModificationDate())}}}async function R(n,e){const t=new Uint8Array(await n.arrayBuffer()),o=t.byteLength,r=k(t),a=z(t),c=v(t),s=E(t),i=I(t);try{const[{pageCount:d,documentInfo:f,passwordProtected:l},p]=await Promise.all([L(t.slice()),S(t.slice())]),m=F(i,p);return{fileName:e,fileSizeBytes:o,pageCount:d,pdfVersion:r,linearized:a,encrypted:c.encrypted||l,passwordProtected:l,encryptionMethod:c.method??(l?"Standard":null),documentInfo:f,fonts:m,xmp:s}}catch(d){return{fileName:e,fileSizeBytes:o,pageCount:0,pdfVersion:r,linearized:a,encrypted:c.encrypted,passwordProtected:c.encrypted,encryptionMethod:c.method??null,documentInfo:{},fonts:F(i,await S(t.slice()).catch(()=>[])),xmp:s,error:d instanceof Error?d.message:"Failed to analyze PDF"}}}const P=async({inputIds:n,fs:e,emitProgress:t})=>{if(n.length===0)throw new Error("PDF Info requires at least one input file");t==null||t(5);const o=await e.read(n[0]),r=await o.getBlob();t==null||t(20);const a=await R(r,o.getName());t==null||t(90);const c=await e.write(new Blob([JSON.stringify(a)],{type:"application/json"}));return t==null||t(100),{outputIds:[c.id]}};export{P as run};
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.