#!/usr/bin/env node
import{d as m}from"./chunk-63XSH3IT.js";async function $(o,u){let a="octal",r=[],i=[];for(let t=0;t<o.length;t++){let e=o[t];if(e==="-c")r.push("char");else if(e==="-An"||e==="-A"&&o[t+1]==="n")a="none",e==="-A"&&t++;else if(e==="-t"&&o[t+1]){let n=o[++t];n==="x1"?r.push("hex"):n==="c"?r.push("char"):n.startsWith("o")&&r.push("octal")}else(!e.startsWith("-")||e==="-")&&i.push(e)}r.length===0&&r.push("octal");let p=u.stdin;if(i.length>0&&i[0]!=="-"){let t=i[0].startsWith("/")?i[0]:`${u.cwd}/${i[0]}`;try{p=await m(u.fs,t)}catch{return{stdout:"",stderr:`od: ${i[0]}: No such file or directory
`,exitCode:1}}}let d=r.includes("char");function y(t){return t===0?"  \\0":t===7?"  \\a":t===8?"  \\b":t===9?"  \\t":t===10?"  \\n":t===11?"  \\v":t===12?"  \\f":t===13?"  \\r":t>=32&&t<127?`   ${String.fromCharCode(t)}`:` ${t.toString(8).padStart(3,"0")}`}function S(t){return d?`  ${t.toString(16).padStart(2,"0")}`:` ${t.toString(16).padStart(2,"0")}`}function x(t){return` ${t.toString(8).padStart(3,"0")}`}let s=[];for(let t of p)s.push(t.charCodeAt(0));let c=16,f=[];for(let t=0;t<s.length;t+=c){let e=s.slice(t,t+c);for(let n=0;n<r.length;n++){let g=r[n],l;g==="char"?l=e.map(y):g==="hex"?l=e.map(S):l=e.map(x);let h="";n===0&&a!=="none"?h=`${t.toString(8).padStart(7,"0")} `:(n>0||a==="none")&&(h=a==="none"?"":"        "),f.push(h+l.join(""))}}return a!=="none"&&s.length>0&&f.push(s.length.toString(8).padStart(7,"0")),{stdout:f.length>0?`${f.join(`
`)}
`:"",stderr:"",exitCode:0}}var F={name:"od",execute:$},A={name:"od",flags:[{flag:"-c",type:"boolean"},{flag:"-A",type:"value",valueHint:"string"},{flag:"-t",type:"value",valueHint:"string"},{flag:"-N",type:"value",valueHint:"number"}],stdinType:"text",needsFiles:!0};export{F as a,A as b};
