1import{a as f,r as x,j as u,B as F}from"./index-ns1xYkE3.js";import{T as A}from"./ToolContent-CAEuGU2l.js";import{r as w,f as v}from"./ffmpeg-CTRWRy29.js";import{T}from"./ToolVideoInput-CWzt9xJ3.js";import{T as h}from"./ToolFileResult-Cin1i_-a.js";import{S as y}from"./SelectWithDesc-B_K4fkvO.js";import{g as b}from"./file-Be1gT3Sr.js";import"./TextField-C2-ggeEL.js";import"./defineProperty-Ct2sN5ge.js";import"./slicedToArray-CxZxnLFV.js";import"./objectWithoutProperties-C690kux4.js";import"./BaseFileInput-vaUgi8Aj.js";import"./ContentPaste-BtIU-5c9.js";import"./InputFooter-DxcfFvIG.js";import"./grey-pattern-DMflWW5d.js";import"./lodash-DrB30ugC.js";import"./ResultFooter-D3pWGvfO.js";async function j(r,o){return w(async({ffmpeg:a,tempFile:n})=>{const{outputFormat:t}=o,l=n(".mp4"),i=n(`.${t}`);await a.writeFile(l,await v(r));const e=["-i",l,"-vn"];t==="mp3"?e.push("-ar","44100","-ac","2","-b:a","192k","-f","mp3",i):t==="wav"?e.push("-acodec","pcm_s16le","-ar","44100","-ac","2","-f","wav",i):e.push("-acodec","copy",i),await a.exec(e);const p=await a.readFile(i),m=new Blob([new Uint8Array(p)],{type:`audio/${t}`});return new File([m],`${r.name.replace(/\.[^/.]+$/,"")}_audio.${t}`,{type:`audio/${t}`})})}const g={outputFormat:"aac"};function P({title:r}){const{t:o}=f("audio"),[a,n]=x.useState(null),[t,l]=x.useState(null),[i,e]=x.useState(!1),p=({values:d,updateField:c})=>[{title:o("extractAudio.outputFormat"),component:u.jsx(F,{children:u.jsx(y,{selected:d.outputFormat,onChange:s=>{c("outputFormat",s)},options:[{label:"AAC",value:"aac"},{label:"MP3",value:"mp3"},{label:"WAV",value:"wav"}],description:o("extractAudio.outputFormatDescription")})})}],m=async(d,c)=>{if(c)try{e(!0);const s=await j(c,d);l(s)}catch(s){console.error(s)}finally{e(!1)}};return u.jsx(A,{title:r,input:a,inputComponent:u.jsx(T,{value:a,onChange:n,title:o("extractAudio.inputTitle")}),resultComponent:u.jsx(h,{title:o("extractAudio.resultTitle"),loading:i,value:t,extension:t?b(t.name):void 0}),initialValues:g,getGroups:p,compute:m,toolInfo:{title:o("extractAudio.toolInfo.title",{title:r}),description:o("extractAudio.toolInfo.description")},setInput:n})}export{P 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.