PageSourceSearch

https://localpdf.online/app/assets/index-CsMzNVq9.js

js localpdf.online collected 2026-10-02 01:08:49 UTC 6,751 bytes, 1 lines download raw bytes

1import{j as e}from"./jsx-runtime-0DLF9kdB.js";import{r}from"./index-DH-tsESH.js";import{u as I}from"./platform-context-pZZ_Wbof.js";function C(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(2)} MB`}function l({label:n,value:s}){if(s==null||s==="")return null;const d=typeof s=="boolean"?s?"Yes":"No":String(s);return e.jsxs("div",{className:"pdf-info-row",children:[e.jsx("span",{className:"pdf-info-label",children:n}),e.jsx("span",{className:"pdf-info-value",children:d})]})}function E({documentInfo:n}){const s=[["Title",n.title],["Author",n.author],["Subject",n.subject],["Keywords",n.keywords],["Creator",n.creator],["Producer",n.producer],["Created",n.creationDate],["Modified",n.modificationDate]];return s.some(([,o])=>!!o)?e.jsxs("section",{className:"pdf-info-section",children:[e.jsx("h3",{className:"pdf-info-section-title",children:"Document Info"}),e.jsx("div",{className:"pdf-info-grid",children:s.map(([o,a])=>e.jsx(l,{label:o,value:a},o))})]}):null}function D({xmp:n}){return n!=null&&n.present?e.jsxs("section",{className:"pdf-info-section",children:[e.jsx("h3",{className:"pdf-info-section-title",children:"XMP Metadata"}),n.pdfAClaim?e.jsxs("div",{className:"pdf-info-alert",children:[e.jsxs("strong",{children:["⚠️ Self-declared ",n.pdfAClaim]}),e.jsx("p",{children:"This PDF claims archival compliance in metadata. It has not been validated against ISO 19005."})]}):e.jsx("p",{className:"pdf-info-copy",children:"XMP packet found, but no PDF/A conformance claim detected."})]}):null}function S({fonts:n}){return e.jsxs("section",{className:"pdf-info-section",children:[e.jsxs("h3",{className:"pdf-info-section-title",children:["Fonts (",n.length,")"]}),n.length===0?e.jsx("p",{className:"pdf-info-copy",children:"No font resources detected."}):e.jsx("ul",{className:"pdf-info-font-list",children:n.map(s=>e.jsxs("li",{className:"pdf-info-font-item",children:[e.jsx("span",{className:"pdf-info-font-name",children:s.name}),e.jsx("span",{className:"pdf-info-font-meta",children:[s.type,s.embedded?"embedded":"not embedded",s.instances&&s.instances>1?`${s.instances} subsets`:null].filter(Boolean).join(" · ")})]},s.name))})]})}function k({report:n}){return e.jsxs("div",{className:"pdf-info-panel",children:[e.jsxs("section",{className:"pdf-info-section",children:[e.jsx("h3",{className:"pdf-info-section-title",children:"Overview"}),e.jsxs("div",{className:"pdf-info-grid",children:[e.jsx(l,{label:"File",value:n.fileName}),e.jsx(l,{label:"Size",value:C(n.fileSizeBytes)}),e.jsx(l,{label:"Pages",value:n.pageCount}),e.jsx(l,{label:"PDF version",value:n.pdfVersion?`PDF ${n.pdfVersion}`:"Unknown"}),e.jsx(l,{label:"Fast Web View",value:n.linearized}),e.jsx(l,{label:"Encrypted",value:n.encrypted}),n.encrypted&&e.jsx(l,{label:"Encryption",value:n.encryptionMethod??"Standard"}),n.passwordProtected&&e.jsx(l,{label:"Password required",value:!0})]})]}),e.jsx(E,{documentInfo:n.documentInfo}),e.jsx(D,{xmp:n.xmp}),e.jsx(S,{fonts:n.fonts}),n.error&&e.jsx("section",{className:"pdf-info-section",children:e.jsxs("div",{className:"pdf-info-alert pdf-info-alert--error",children:[e.jsx("strong",{children:"Partial analysis"}),e.jsx("p",{children:n.error})]})})]})}async function O(n,s,d){const o={id:crypto.randomUUID(),type:"COMMAND",payload:{type:"PROCESS_TOOL",payload:{toolId:"pdf-info",inputIds:[s]}}},a=await n.workerOrchestrator.dispatch(o,void 0,d);if(a.payload.type==="RESULT"){const i=a.payload.payload;
1if(i.outputIds.length===0)throw new Error("No analysis output returned");const x=await(await n.vfs.read(i.outputIds[0])).getText(),p=JSON.parse(x);return await n.vfs.delete(i.outputIds[0]),p}throw a.payload.type==="ERROR"?new Error(a.payload.payload.message||"PDF analysis failed"):new Error("Unexpected worker response")}function F({inputFiles:n,onBack:s,onPickFiles:d,onClearFiles:o}){const{runtime:a}=I(),[i,f]=r.useState("ready"),[x,p]=r.useState(""),[v,j]=r.useState(null),[N,m]=r.useState(null),g=r.useRef(0),h=r.useRef(null),b=r.useRef(null);r.useEffect(()=>()=>{var t;return(t=h.current)==null?void 0:t.abort()},[]),r.useEffect(()=>{let t=!1;return(async()=>{if(n.length===0){p(""),b.current=null,j(null),m(null),f("ready");return}const c=await a.vfs.read(n[0]);t||p(c.getName())})(),()=>{t=!0}},[n,a.vfs]);const u=r.useCallback(async()=>{var w;if(n.length===0)return;(w=h.current)==null||w.abort();const t=++g.current,c=new AbortController;h.current=c,f("analyzing"),m(null),a.telemetry.track({type:"TOOL_RUN_STARTED",runId:crypto.randomUUID(),toolId:"pdf-info",inputCount:1});try{const y=await O(a,n[0],c.signal);if(t!==g.current)return;j(y),f("report"),a.telemetry.track({type:"TOOL_RUN_RESULT",runId:crypto.randomUUID(),toolId:"pdf-info",durationMs:0,outputCount:0})}catch(y){if(t!==g.current)return;if(c.signal.aborted){f("ready");return}const R=y instanceof Error?y.message:"Failed to analyze PDF";m(R),f("ready"),a.telemetry.track({type:"TOOL_RUN_ERROR",runId:crypto.randomUUID(),toolId:"pdf-info",durationMs:0,code:"PDF_INFO_FAILED",message:R})}},[n,a]);r.useEffect(()=>{const t=n[0];!t||t===b.current||(b.current=t,u())},[u,n]);const P=r.useCallback(()=>{var t;(t=h.current)==null||t.abort(),j(null),m(null),u()},[u]);return n.length===0?e.jsxs("div",{className:"tool-config-root",children:[e.jsx("p",{className:"tool-config-copy",children:"Upload a PDF to inspect its structure and metadata."}),d&&e.jsxs("div",{className:"tool-config-actions",children:[e.jsx("button",{className:"btn-ghost",onClick:s,children:"Back"}),e.jsx("button",{className:"btn-primary",onClick:()=>{const t=document.createElement("input");t.type="file",t.accept="application/pdf",t.onchange=()=>{const c=t.files?Array.from(t.files):[];c.length>0&&d(c)},t.click()},children:"Choose PDF"})]})]}):e.jsxs("div",{className:"tool-config-root",children:[e.jsxs("div",{className:"pdf-info-header",children:[e.jsx("p",{className:"pdf-info-file-name",children:x}),o&&e.jsx("button",{className:"btn-ghost",type:"button",onClick:()=>void o(),children:"Change file"})]}),i==="analyzing"&&e.jsxs("div",{className:"pdf-info-loading",children:[e.jsx("div",{className:"wz-spinner"}),e.jsx("span",{children:"Analyzing PDF locally…"})]}),N&&e.jsxs("div",{className:"pdf-info-alert pdf-info-alert--error",children:[e.jsx("strong",{children:"Analysis failed"}),e.jsx("p",{children:N})]}),i==="report"&&v&&e.jsx(k,{report:v}),e.jsxs("div",{className:"tool-config-actions",children:[e.jsx("button",{className:"btn-ghost",onClick:s,children:"Back"}),N&&i==="ready"&&e.jsx("button",{className:"btn-primary",type:"button",onClick:()=>void u(),children:"Retry analysis"}),i==="report"&&e.jsx("button",{className:"btn-secondary",type:"button",onClick:P,children:"Analyze again"})]})]})}export{F as default};

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.