PageSourceSearch

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

js localpdf.online collected 2026-10-02 01:06:34 UTC 3,103 bytes, 1 lines download raw bytes

1import{r as n,j as t}from"./vendor-react-C_xdI0Ng.js";import{u as C}from"./index-DbFRh42P.js";import{r as k,P as E}from"./pdf-info-client-CO7HLkbQ.js";function A({inputFiles:r,onBack:h,onPickFiles:g,onClearFiles:x}){const{runtime:a}=C(),[c,s]=n.useState("ready"),[I,b]=n.useState(""),[N,u]=n.useState(null),[m,i]=n.useState(null),p=n.useRef(0),d=n.useRef(null),y=n.useRef(null);n.useEffect(()=>()=>{var e;return(e=d.current)==null?void 0:e.abort()},[]),n.useEffect(()=>{let e=!1;return(async()=>{if(r.length===0){b(""),y.current=null,u(null),i(null),s("ready");return}const o=await a.vfs.read(r[0]);e||b(o.getName())})(),()=>{e=!0}},[r,a.vfs]);const l=n.useCallback(async()=>{var j;if(r.length===0)return;(j=d.current)==null||j.abort();const e=++p.current,o=new AbortController;d.current=o,s("analyzing"),i(null),a.telemetry.track({type:"TOOL_RUN_STARTED",runId:crypto.randomUUID(),toolId:"pdf-info",inputCount:1});try{const f=await k(a,r[0],o.signal);if(e!==p.current)return;u(f),s("report"),a.telemetry.track({type:"TOOL_RUN_RESULT",runId:crypto.randomUUID(),toolId:"pdf-info",durationMs:0,outputCount:0})}catch(f){if(e!==p.current)return;if(o.signal.aborted){s("ready");return}const R=f instanceof Error?f.message:"Failed to analyze PDF";i(R),s("ready"),a.telemetry.track({type:"TOOL_RUN_ERROR",runId:crypto.randomUUID(),toolId:"pdf-info",durationMs:0,code:"PDF_INFO_FAILED",message:R})}},[r,a]);n.useEffect(()=>{const e=r[0];!e||e===y.current||(y.current=e,l())},[l,r]);const v=n.useCallback(()=>{var e;(e=d.current)==null||e.abort(),u(null),i(null),l()},[l]);return r.length===0?t.jsxs("div",{className:"tool-config-root",children:[t.jsx("p",{className:"tool-config-copy",children:"Upload a PDF to inspect its structure and metadata."}),g&&t.jsxs("div",{className:"tool-config-actions",children:[t.jsx("button",{className:"btn-ghost",onClick:h,children:"Back"}),t.jsx("button",{className:"btn-primary",onClick:()=>{const e=document.createElement("input");e.type="file",e.accept="application/pdf",e.onchange=()=>{const o=e.files?Array.from(e.files):[];o.length>0&&g(o)},e.click()},children:"Choose PDF"})]})]}):t.jsxs("div",{className:"tool-config-root",children:[t.jsxs("div",{className:"pdf-info-header",children:[t.jsx("p",{className:"pdf-info-file-name",children:I}),x&&t.jsx("button",{className:"btn-ghost",type:"button",onClick:()=>void x(),children:"Change file"})]}),c==="analyzing"&&t.jsxs("div",{className:"pdf-info-loading",children:[t.jsx("div",{className:"wz-spinner"}),t.jsx("span",{children:"Analyzing PDF locally…"})]}),m&&t.jsxs("div",{className:"pdf-info-alert pdf-info-alert--error",children:[t.jsx("strong",{children:"Analysis failed"}),t.jsx("p",{children:m})]}),c==="report"&&N&&t.jsx(E,{report:N}),t.jsxs("div",{className:"tool-config-actions",children:[t.jsx("button",{className:"btn-ghost",onClick:h,children:"Back"}),m&&c==="ready"&&t.jsx("button",{className:"btn-primary",type:"button",onClick:()=>void l(),children:"Retry analysis"}),c==="report"&&t.jsx("button",{className:"btn-secondary",type:"button",onClick:v,children:"Analyze again"})]})]})}export{A 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.