/* Socket Lib - Built with esbuild */
var R=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var F=(e,n)=>{for(var r in n)R(e,r,{get:n[r],enumerable:!0})},L=(e,n,r,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of H(n))!q.call(e,i)&&i!==r&&R(e,i,{get:()=>n[i],enumerable:!(o=j(n,i))||o.enumerable});return e};var M=e=>L(R({},"__esModule",{value:!0}),e);var Q={};F(Q,{isSpawnError:()=>D,isStdioType:()=>v,spawn:()=>G,spawnSync:()=>K});module.exports=M(Q);var w=require("#constants/process"),J=require("./arrays"),f=require("./objects"),k=require("./strings");const U=(0,w.getAbortSignal)(),z=(0,w.getSpinner)(),T=/\.(?:cmd|bat|ps1)$/i;let x;function V(){return x===void 0&&(x=require("node:child_process")),x}let E;function $(){return E===void 0&&(E=require("./external/@npmcli/promise-spawn")),E}let P;function B(){return P===void 0&&(P=require("node:path")),P}function D(e){if(e===null||typeof e!="object")return!1;const n=e;return(0,f.hasOwn)(n,"code")&&typeof n.code<"u"||(0,f.hasOwn)(n,"errno")&&typeof n.errno<"u"||(0,f.hasOwn)(n,"syscall")&&typeof n.syscall=="string"}function v(e,n){return arguments.length===1?typeof e=="string"&&["pipe","ignore","inherit","overlapped"].includes(e):e===n||e==null&&n==="pipe"||(0,J.isArray)(e)&&e.length>2&&e[0]===n&&e[1]===n&&e[2]===n}function N(e){const n=e,{stderr:r,stdout:o}=n;return typeof o=="string"&&(n.stdout=(0,k.stripAnsi)(o)),typeof r=="string"&&(n.stderr=(0,k.stripAnsi)(r)),n}function G(e,n,r,o){const i=(0,f.getOwn)(r,"shell"),l=process.platform==="win32";let u=e;if(l&&i&&T.test(u)){const t=B();u=t.basename(u,t.extname(u))}const{spinner:m=z,stripAnsi:b=!0,...s}={__proto__:null,...r},S=m,{env:g,stdio:d,stdioString:a=!0}=s,O=!!S?.isSpinning&&!v(d,"ignore")&&!v(d,"pipe"),C=O;O&&S.stop();const A=$(),W=g?{__proto__:null,...process.env,...g}:process.env,I={__proto__:null,cwd:typeof s.cwd=="string"?s.cwd:void 0,env:W,signal:U,stdio:s.stdio,stdioString:a,shell:s.shell,timeout:s.timeout,uid:s.uid,gid:s.gid},h=A(u,n?[...n]:[],I,o),_=h;let p;return b&&a?p=h.then(t=>{const c=N(t);return"code"in c&&(c.exitCode=c.code),c}).catch(t=>{throw N(t)}):p=h.then(t=>{if("code"in t){const c=t;return c.exitCode=t.code,c}return t}),C&&(p=p.finally(()=>{S.start()})),p.process=_.process,p.stdin=_.stdin,p}function K(e,n,r){const o=(0,f.getOwn)(r,"shell"),i=process.platform==="win32";let l=e;if(i&&o&&T.test(l)){const a=B();l=a.basename(l,a.extname(l))}const{stripAnsi:u=!0,...m}={__proto__:null,...r},{stdioString:b=!0}=m,S={encoding:b?"utf8":"buffer",...m},g=S.encoding!=="buffer",d=V().spawnSync(l,n,S);if(g){const{stderr:a,stdout:y}=d;y&&(d.stdout=y.toString().trim()),a&&(d.stderr=a.toString().trim())}return u&&g?N(d):d}0&&(module.exports={isSpawnError,isStdioType,spawn,spawnSync});
//# sourceMappingURL=spawn.js.map
