import"./chunk-DXB73IDG.js";function c(a){let s="",e=0;for(;e<a.length;)if(a[e]==="\\"){if(e+1>=a.length){s+="\\";break}let o=a[e+1];switch(o){case"\\":s+="\\",e+=2;break;case"n":s+=`
`,e+=2;break;case"t":s+="	",e+=2;break;case"r":s+="\r",e+=2;break;case"a":s+="\x07",e+=2;break;case"b":s+="\b",e+=2;break;case"f":s+="\f",e+=2;break;case"v":s+="\v",e+=2;break;case"e":case"E":s+="\x1B",e+=2;break;case"c":return{output:s,stop:!0};case"0":{let r="",t=e+2;for(;t<a.length&&t<e+5&&/[0-7]/.test(a[t]);)r+=a[t],t++;if(r.length===0)s+="\0";else{let l=parseInt(r,8)%256;s+=String.fromCharCode(l)}e=t;break}case"x":{let r="",t=e+2;for(;t<a.length&&t<e+4&&/[0-9a-fA-F]/.test(a[t]);)r+=a[t],t++;if(r.length===0)s+="\\x",e+=2;else{let l=parseInt(r,16);s+=String.fromCharCode(l),e=t}break}case"u":{let r="",t=e+2;for(;t<a.length&&t<e+6&&/[0-9a-fA-F]/.test(a[t]);)r+=a[t],t++;if(r.length===0)s+="\\u",e+=2;else{let l=parseInt(r,16);s+=String.fromCodePoint(l),e=t}break}case"U":{let r="",t=e+2;for(;t<a.length&&t<e+10&&/[0-9a-fA-F]/.test(a[t]);)r+=a[t],t++;if(r.length===0)s+="\\U",e+=2;else{let l=parseInt(r,16);try{s+=String.fromCodePoint(l)}catch{s+=`\\U${r}`}e=t}break}default:s+=`\\${o}`,e+=2}}else s+=a[e],e++;return{output:s,stop:!1}}var n={name:"echo",async execute(a,s){let e=!1,o=s.xpgEcho??!1,r=0;for(;r<a.length;){let l=a[r];if(l==="-n")e=!0,r++;else if(l==="-e")o=!0,r++;else if(l==="-E")o=!1,r++;else if(l==="-ne"||l==="-en")e=!0,o=!0,r++;else break}let t=a.slice(r).join(" ");if(o){let l=c(t);if(t=l.output,l.stop)return{stdout:t,stderr:"",exitCode:0}}return e||(t+=`
`),{stdout:t,stderr:"",exitCode:0}}};export{n as echoCommand};
