1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8303],{9199:(e,t,a)=>{a.d(t,{A:()=>s});let s=(0,a(78340).A)("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]])},68303:(e,t,a)=>{a.r(t),a.d(t,{default:()=>m});var s=a(95155),r=a(12115),n=a(13545),i=a(12651),l=a(20232),d=a(33210),c=a(6962),o=a(9199),x=a(40980);function m({file:e}){let[t,m]=(0,r.useState)(!1),u=(0,r.useRef)(!1),[h,p]=(0,r.useState)(null),[f,g]=(0,r.useState)(null),w=async()=>{if(!e)return;let t=e.path;m(!0),p(null),g(null);try{let{invoke:s}=await Promise.resolve().then(a.bind(a,3516)),{tempDir:r,join:n,isAbsolute:i}=await a.e(6618).then(a.bind(a,46618)),l=!t;if(t)try{l=!await i(t)}catch(e){l=!t.includes(":\\")}if(l){p({type:"info",text:"Preparing file for native conversion..."});let{writeFile:s}=await Promise.all([a.e(6618),a.e(6865)]).then(a.bind(a,6865)),i=await r(),l=e.name.replace(/[^a-zA-Z0-9._-]/g,"_");t=await n(i,`clientpdf_word_${Date.now()}_${l}.pdf`);let d=await e.arrayBuffer();await s(t,new Uint8Array(d))}let d=await r(),c=await n(d,`clientpdf_word_${Date.now()}.docx`),o=await s("convert_pdf_to_docx_native",{inputPath:t,outputPath:c});g(o),p({type:"success",text:"PDF successfully converted to Word!"})}catch(e){console.error("Failed to convert to Word:",e),p({type:"error",text:"Failed to convert PDF: "+(e||"")})}finally{m(!1)}},v=async()=>{if(f&&e)try{let{save:t}=await Promise.resolve().then(a.bind(a,28014)),{invoke:s}=await Promise.resolve().then(a.bind(a,3516)),r=await t({filters:[{name:"Word Document",extensions:["docx"]}],defaultPath:e.name.replace(/\.[^/.]+$/,"")+"_converted.docx"});r&&(await s("copy_file_native",{srcPath:f,destPath:r}),p({type:"success",text:`Saved to: ${r}`}))}catch(e){console.error("Save failed:",e),p({type:"error",text:"Failed to save the document."})}};return(0,s.jsxs)("div",{className:"space-y-5",children:[(0,s.jsxs)("div",{className:"p-3 rounded-lg bg-science/5 border border-science/20 flex flex-col gap-2",children:[(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)(n.A,{className:"w-4 h-4 text-science shrink-0 mt-0.5"}),(0,s.jsxs)("p",{className:"text-[10px] text-muted/80 leading-relaxed",children:["Extracts text, fonts, tables, and images into an editable ",(0,s.jsx)("strong",{children:".docx"})," file using a high-fidelity layout engine."]})]}),(0,s.jsxs)("div",{className:"flex items-start gap-3 opacity-75",children:[(0,s.jsx)("div",{className:"w-4 h-4 shrink-0"}),(0,s.jsx)("p",{className:"text-[10px] text-muted/80 leading-relaxed",children:(0,s.jsx)("em",{children:"Note: Layout reconstruction is computationally intensive and may take a minute for complex documents."})})]})]}),f&&(0,s.jsxs)("div",{className:"bg-surface-soft rounded-lg border border-line/50 p-3 space-y-2 animate-in fade-in",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 text-[11px]",children:[(0,s.jsx)(i.A,{className:"w-4 h-4 text-emerald-500"}),(0,s.jsx)("span",{className:"font-medium text-emerald-600",children:"Conversion complete"})]}),(0,s.jsxs)("div",{className:"flex justify-between text-[11px]",children:[(0,s.jsx)("span",{className:"text-muted/70",children:"Output"}),(0,s.jsx)("span",{className:"font-medium text-foreground/80 truncate max-w-[140px]",children:e?.name.replace(/\.[^/.]+$/,"")+".docx"})]})]}),(0,s.jsx)("div",{className:"space-y-2",children:f?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("button",{onClick:v,className:"w-full flex items-center justify-center gap-2 py-2.5 rounded-lg font-medium text-[13px] transition-all shadow-sm bg-green-600 text-white hover:bg-green-700 shadow-green-600/20",children:[(0,s.jsx)(c.A,{className:"w-4 h-4"}),"Save Word Document"]}),(0,s.jsxs)("button",{onClick:()=>{g(null),p(null)},className:"w-full py-2 text-[11px] font-medium text-muted hover:text-foreground transition-colors flex items-center justify-center gap-1.5",children:[(0,s.jsx)(o.A,{className:"w-3 h-3"}),"Convert again"]})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{onClick:w,disabled:!e||t,className:(0,x.cn)("w-full py-2.5 rounded-lg font-semibold text-[13px] transition-all flex items-center justify-center gap-2",!e||t?"bg-surface-active text-muted cursor-not-allowed opacity-70":"bg-science hover:bg-science-dark text-white shadow-md hover:shadow-lg active:scale-[0.98]"),children:t?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}
1),"Converting..."]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.A,{className:"w-4 h-4"}),"Convert to Word"]})}),t&&(0,s.jsxs)("button",{onClick:()=>{u.current=!0,m(!1)},className:"w-full py-2 rounded-lg text-[11px] font-medium text-red-500 hover:bg-red-50 dark:hover:bg-red-500/10 border border-red-200 dark:border-red-500/30 transition-colors flex items-center justify-center gap-1.5",children:[(0,s.jsx)(d.A,{className:"w-3.5 h-3.5"})," Cancel"]})]})}),h&&(0,s.jsx)("div",{className:(0,x.cn)("rounded-lg border p-2.5 text-[11px] font-medium animate-in fade-in","error"===h.type?"bg-red-50 border-red-200 text-red-600":"bg-emerald-50 border-emerald-200 text-emerald-600"),children:h.text})]})}}}]);
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.