1import{f as C}from"./ctMediaConvertDownload-n0-64pPl.js";import{w as D,c as T}from"./ctPendingDownload-B21SXRKd.js";import{i as L}from"./mediaInputFromFilename-AaKRjYpC.js";import{g as k}from"./ffmpegVideoCompress-C_zYTcnz.js";import{c as y,s as R}from"./fileDropzone-CA_uaFcV.js";import{s as N}from"./ctToast-C2BAo121.js";import{w as S}from"./wireMediaToolPageOnce-DYtotjbx.js";import{c as M,w as W}from"./videoToolRuntime-BhBVPdre.js";import"./ctMediaProgressUi-wz6CtyvX.js";import"./ctFullscreenAd-CL-AA_Ul.js";import"./app-gOHIPY12.js";import"./videoEncodeHints-B5HbAqTP.js";import"./transientNotice-Ds_di7lD.js";import"./mediaMetadataDisplay-rUX1VKD5.js";import"./ffmpegProbeDuration-CZSGPlSL.js";import"./videoToolFilePick-DrReu7dZ.js";import"./ffmpegWasmProbe-Dr2SB0y0.js";import"./videoToolFfmpegSession-vgvYnhrp.js";import"./ctMediaSourceOutputName-BkKiostT.js";function E(l){const o=document.getElementById("ctVidBwToastBody"),t=document.getElementById("ctVidBwToast");!o||!t||N(t,{bodyEl:o,message:l,delay:12e3})}function oe(){const l=document.getElementById("ct-video-bw-root");if(!S(l,"ctVidBwWired"))return;const o=(l.dataset.ctFormat||"mp4").toLowerCase(),t=document.getElementById("ctVidBwFile"),c=document.getElementById("ctVidBwDrop"),d=document.getElementById("ctVidBwDropCaption"),f=document.getElementById("ctVidBwPreview"),m=document.getElementById("ctVidBwClr"),p=document.getElementById("ctVidBwBtn"),u=document.getElementById("ctVidBwDownload"),i=T();D(u,i);const r=document.getElementById("ctVidBwName"),V=document.getElementById("ctVidBwWasmStatus"),B=document.getElementById("ctVidBwMeta");if(!t||!p||!m)return;const e=M({statusEl:V,progressIds:{barId:"ctVidBwProgBar",labelId:"ctVidBwProgLabel",percentId:"ctVidBwProgPct"},routeFormat:o,probeReadyLabel:"Ready to convert"}),w=()=>{p.disabled=!e.currentFile||e.encodeInFlight};W({fileEl:t,dropEl:c,dropCaptionEl:d,runtime:e,clearBtn:m,nameInput:r,preview:f,metaEl:B,onEmpty:()=>{R(t,c,d),w()},onTooLarge:()=>{E("File size exceeds 500MB limit."),y(t,{drop:c,captionEl:d})},onProbeFailed:()=>{E("Failed to process the video file."),e.clearPickState({preview:f,metaEl:B}),y(t,{notify:!1,drop:c,captionEl:d})},onReady:()=>w()}),m.addEventListener("click",s=>{s.preventDefault(),i.clear(),i.syncDownloadButton(u),r&&(r.value="black_white_video"),e.clearPickState({preview:f,metaEl:B}),y(t,{notify:!1,drop:c,captionEl:d}),m.disabled=!0,w()}),p.addEventListener("click",async()=>{var b,I;if(!e.currentFile)return;const s=e.inputNameFor(e.currentFile),g=e.outputName(),v=k(o,e.metadata);i.clear(),i.syncDownloadButton(u),p.disabled=!0;try{const n=await e.runEncode({inName:s,args:["-y","-loglevel","warning","-stats","-i",s,"-vf","hue=s=0",...v,g],encodingLabel:"Convertingâ¦"}),a=await n.readFile(g),F=a.buffer?a.buffer.slice(a.byteOffset,a.byteOffset+a.byteLength):a,h=new Blob([F],{type:`video/${o}`}),P=((r==null?void 0:r.value)||"black_white_video").replace(/\.[^/.]+$/,"");await C(i,u,{blob:h,filename:`${P}.${o}`,progressUi:(b=e.setProg)==null?void 0:b.ui});try{await n.deleteFile(s),await n.deleteFile(g)}catch{}}catch(n){L(n)||E(n instanceof Error?n.message:"Conversion failed."),(I=e.setProg)==null||I.ui.hardReset("Ready to convert")}finally{w()}})}export{oe as initVideoBlackWhitePage};
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.