@nice-move/cli
Version:
Frontend develop helper for frontend development
28 lines (26 loc) • 102 kB
JavaScript
import{i as e,n as t}from"./rolldown-runtime-DSjMdhoD.mjs";import{n,r,t as i}from"./mjs-CGdxUWY6.mjs";import{fileURLToPath as a}from"node:url";import{ChildProcess as o,execFile as s,spawn as c,spawnSync as l}from"node:child_process";import{StringDecoder as u}from"node:string_decoder";import{aborted as d,callbackify as f,debuglog as p,inspect as m,promisify as h,stripVTControlCharacters as g}from"node:util";import _,{execArgv as v,execPath as y,hrtime as b,platform as x}from"node:process";import S from"node:tty";import C from"node:path";import{scheduler as w,setImmediate as ee,setTimeout as te}from"node:timers/promises";import{constants as T}from"node:os";import{EventEmitter as ne,addAbortListener as re,on as ie,once as E,setMaxListeners as ae}from"node:events";import{serialize as oe}from"node:v8";import{appendFileSync as se,createReadStream as ce,createWriteStream as le,readFileSync as ue,statSync as de,writeFileSync as fe}from"node:fs";import{Duplex as pe,PassThrough as me,Readable as D,Transform as he,Writable as ge,getDefaultHighWaterMark as _e}from"node:stream";import{Buffer as ve}from"node:buffer";import{finished as O}from"node:stream/promises";function k(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}const ye=(e,t)=>{let n=Se(be(e));if(typeof n!=`string`)throw TypeError(`${t} must be a string or a file URL: ${n}.`);return n},be=e=>xe(e)?e.toString():e,xe=e=>typeof e!=`string`&&e&&Object.getPrototypeOf(e)===String.prototype,Se=e=>e instanceof URL?a(e):e,Ce=(e,t=[],n={})=>{let r=ye(e,`First argument`),[i,a]=k(t)?[[],t]:[t,n];if(!Array.isArray(i))throw TypeError(`Second argument must be either an array of arguments or an options object: ${i}`);if(i.some(e=>typeof e==`object`&&!!e))throw TypeError(`Second argument must be an array of strings: ${i}`);let o=i.map(String),s=o.find(e=>e.includes(`\0`));if(s!==void 0)throw TypeError(`Arguments cannot contain null bytes ("\\0"): ${s}`);if(!k(a))throw TypeError(`Last argument must be an options object: ${a}`);return[r,o,a]},{toString:we}=Object.prototype,Te=e=>we.call(e)===`[object ArrayBuffer]`,A=e=>we.call(e)===`[object Uint8Array]`,j=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),Ee=new TextEncoder,De=e=>Ee.encode(e),Oe=new TextDecoder,ke=e=>Oe.decode(e),Ae=(e,t)=>je(e,t).join(``),je=(e,t)=>{if(t===`utf8`&&e.every(e=>typeof e==`string`))return e;let n=new u(t),r=e.map(e=>typeof e==`string`?De(e):e).map(e=>n.write(e)),i=n.end();return i===``?r:[...r,i]},Me=e=>e.length===1&&A(e[0])?e[0]:Pe(Ne(e)),Ne=e=>e.map(e=>typeof e==`string`?De(e):e),Pe=e=>{let t=new Uint8Array(Fe(e)),n=0;for(let r of e)t.set(r,n),n+=r.length;return t},Fe=e=>{let t=0;for(let n of e)t+=n.length;return t},Ie=e=>Array.isArray(e)&&Array.isArray(e.raw),Le=(e,t)=>{let n=[];for(let[r,i]of e.entries())n=Re({templates:e,expressions:t,tokens:n,index:r,template:i});if(n.length===0)throw TypeError(`Template script must not be empty`);let[r,...i]=n;return[r,i,{}]},Re=({templates:e,expressions:t,tokens:n,index:r,template:i})=>{if(i===void 0)throw TypeError(`Invalid backslash sequence: ${e.raw[r]}`);let{nextTokens:a,leadingWhitespaces:o,trailingWhitespaces:s}=ze(i,e.raw[r]),c=He(n,a,o);if(r===t.length)return c;let l=t[r];return He(c,Array.isArray(l)?l.map(e=>Ue(e)):[Ue(l)],s)},ze=(e,t)=>{if(t.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let n=[],r=0,i=Be.has(t[0]);for(let i=0,a=0;i<e.length;i+=1,a+=1){let o=t[a];if(Be.has(o))r!==i&&n.push(e.slice(r,i)),r=i+1;else if(o===`\\`){let e=t[a+1];e===`
`?(--i,a+=1):e===`u`&&t[a+2]===`{`?a=t.indexOf(`}`,a+3):a+=Ve[e]??1}}let a=r===e.length;return a||n.push(e.slice(r)),{nextTokens:n,leadingWhitespaces:i,trailingWhitespaces:a}},Be=new Set([` `,` `,`\r`,`
`]),Ve={x:3,u:5},He=(e,t,n)=>n||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t[0]}`,...t.slice(1)],Ue=e=>{let t=typeof e;if(t===`string`)return e;if(t===`number`)return String(e);if(k(e)&&(`stdout`in e||`isMaxBuffer`in e))return We(e);throw e instanceof o||Object.prototype.toString.call(e)===`[object Promise]`?TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):TypeError(`Unexpected "${t}" in template expression`)},We=({stdout:e})=>{if(typeof e==`string`)return e;if(A(e))return ke(e);throw TypeError(e===void 0?`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`:`Unexpected "${typeof e}" stdout in template expression`)},M=e=>Ge.includes(e),Ge=[_.stdin,_.stdout,_.stderr],N=[`stdin`,`stdout`,`stderr`],Ke=e=>N[e]??`stdio[${e}]`,qe=e=>{let t={...e};for(let n of at)t[n]=Je(e,n);return t},Je=(e,t)=>{let n=Array.from({length:Ye(e)+1});return rt(Xe(e[t],n,t),t)},Ye=({stdio:e})=>Array.isArray(e)?Math.max(e.length,N.length):N.length,Xe=(e,t,n)=>k(e)?Ze(e,t,n):t.fill(e),Ze=(e,t,n)=>{for(let r of Object.keys(e).sort(Qe))for(let i of et(r,n,t))t[i]=e[r];return t},Qe=(e,t)=>$e(e)<$e(t)?1:-1,$e=e=>e===`stdout`||e===`stderr`?0:e===`all`?2:1,et=(e,t,n)=>{if(e===`ipc`)return[n.length-1];let r=tt(e);if(r===void 0||r===0)throw TypeError(`"${t}.${e}" is invalid.
It must be "${t}.stdout", "${t}.stderr", "${t}.all", "${t}.ipc", or "${t}.fd3", "${t}.fd4" (and so on).`);if(r>=n.length)throw TypeError(`"${t}.${e}" is invalid: that file descriptor does not exist.
Please set the "stdio" option to ensure that file descriptor exists.`);return r===`all`?[1,2]:[r]},tt=e=>{if(e===`all`)return e;if(N.includes(e))return N.indexOf(e);let t=nt.exec(e);if(t!==null)return Number(t[1])},nt=/^fd(\d+)$/,rt=(e,t)=>e.map(e=>e===void 0?it[t]:e),it={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:p(`execa`).enabled?`full`:`none`,stripFinalNewline:!0},at=[`lines`,`buffer`,`maxBuffer`,`verbose`,`stripFinalNewline`],ot=(e,t)=>t===`ipc`?e.at(-1):e[t],st=({verbose:e},t)=>ut(e,t)!==`none`,ct=({verbose:e},t)=>![`none`,`short`].includes(ut(e,t)),lt=({verbose:e},t)=>{let n=ut(e,t);return ft(n)?n:void 0},ut=(e,t)=>t===void 0?dt(e):ot(e,t),dt=e=>e.find(e=>ft(e))??pt.findLast(t=>e.includes(t)),ft=e=>typeof e==`function`,pt=[`none`,`short`,`full`],mt=(e,t)=>{let n=[e,...t];return{command:n.join(` `),escapedCommand:n.map(e=>xt(gt(e))).join(` `)}},ht=e=>g(e).split(`
`).map(e=>gt(e)).join(`
`),gt=e=>e.replaceAll(vt,e=>_t(e)),_t=e=>{let t=yt[e];if(t!==void 0)return t;let n=e.codePointAt(0),r=n.toString(16);return n<=bt?`\\u${r.padStart(4,`0`)}`:`\\U${r}`},vt=(()=>{try{return RegExp(`\\p{Separator}|\\p{Other}`,`gu`)}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}})(),yt={" ":` `,"\b":`\\b`,"\f":`\\f`,"\n":`\\n`,"\r":`\\r`," ":`\\t`},bt=65535,xt=e=>St.test(e)?e:x===`win32`?`"${e.replaceAll(`"`,`""`)}"`:`'${e.replaceAll(`'`,`'\\''`)}'`,St=/^[\w./-]+$/;function Ct(){let{env:e}=_,{TERM:t,TERM_PROGRAM:n}=e;return _.platform===`win32`?!!e.WT_SESSION||!!e.TERMINUS_SUBLIME||e.ConEmuTask===`{cmd::Cmder}`||n===`Terminus-Sublime`||n===`vscode`||t===`xterm-256color`||t===`alacritty`||t===`rxvt-unicode`||t===`rxvt-unicode-256color`||e.TERMINAL_EMULATOR===`JetBrains-JediTerm`:t!==`linux`}const wt={circleQuestionMark:`(?)`,questionMarkPrefix:`(?)`,square:`█`,squareDarkShade:`▓`,squareMediumShade:`▒`,squareLightShade:`░`,squareTop:`▀`,squareBottom:`▄`,squareLeft:`▌`,squareRight:`▐`,squareCenter:`■`,bullet:`●`,dot:`․`,ellipsis:`…`,pointerSmall:`›`,triangleUp:`▲`,triangleUpSmall:`▴`,triangleDown:`▼`,triangleDownSmall:`▾`,triangleLeftSmall:`◂`,triangleRightSmall:`▸`,home:`⌂`,heart:`♥`,musicNote:`♪`,musicNoteBeamed:`♫`,arrowUp:`↑`,arrowDown:`↓`,arrowLeft:`←`,arrowRight:`→`,arrowLeftRight:`↔`,arrowUpDown:`↕`,almostEqual:`≈`,notEqual:`≠`,lessOrEqual:`≤`,greaterOrEqual:`≥`,identical:`≡`,infinity:`∞`,subscriptZero:`₀`,subscriptOne:`₁`,subscriptTwo:`₂`,subscriptThree:`₃`,subscriptFour:`₄`,subscriptFive:`₅`,subscriptSix:`₆`,subscriptSeven:`₇`,subscriptEight:`₈`,subscriptNine:`₉`,oneHalf:`½`,oneThird:`⅓`,oneQuarter:`¼`,oneFifth:`⅕`,oneSixth:`⅙`,oneEighth:`⅛`,twoThirds:`⅔`,twoFifths:`⅖`,threeQuarters:`¾`,threeFifths:`⅗`,threeEighths:`⅜`,fourFifths:`⅘`,fiveSixths:`⅚`,fiveEighths:`⅝`,sevenEighths:`⅞`,line:`─`,lineBold:`━`,lineDouble:`═`,lineDashed0:`┄`,lineDashed1:`┅`,lineDashed2:`┈`,lineDashed3:`┉`,lineDashed4:`╌`,lineDashed5:`╍`,lineDashed6:`╴`,lineDashed7:`╶`,lineDashed8:`╸`,lineDashed9:`╺`,lineDashed10:`╼`,lineDashed11:`╾`,lineDashed12:`−`,lineDashed13:`–`,lineDashed14:`‐`,lineDashed15:`⁃`,lineVertical:`│`,lineVerticalBold:`┃`,lineVerticalDouble:`║`,lineVerticalDashed0:`┆`,lineVerticalDashed1:`┇`,lineVerticalDashed2:`┊`,lineVerticalDashed3:`┋`,lineVerticalDashed4:`╎`,lineVerticalDashed5:`╏`,lineVerticalDashed6:`╵`,lineVerticalDashed7:`╷`,lineVerticalDashed8:`╹`,lineVerticalDashed9:`╻`,lineVerticalDashed10:`╽`,lineVerticalDashed11:`╿`,lineDownLeft:`┐`,lineDownLeftArc:`╮`,lineDownBoldLeftBold:`┓`,lineDownBoldLeft:`┒`,lineDownLeftBold:`┑`,lineDownDoubleLeftDouble:`╗`,lineDownDoubleLeft:`╖`,lineDownLeftDouble:`╕`,lineDownRight:`┌`,lineDownRightArc:`╭`,lineDownBoldRightBold:`┏`,lineDownBoldRight:`┎`,lineDownRightBold:`┍`,lineDownDoubleRightDouble:`╔`,lineDownDoubleRight:`╓`,lineDownRightDouble:`╒`,lineUpLeft:`┘`,lineUpLeftArc:`╯`,lineUpBoldLeftBold:`┛`,lineUpBoldLeft:`┚`,lineUpLeftBold:`┙`,lineUpDoubleLeftDouble:`╝`,lineUpDoubleLeft:`╜`,lineUpLeftDouble:`╛`,lineUpRight:`└`,lineUpRightArc:`╰`,lineUpBoldRightBold:`┗`,lineUpBoldRight:`┖`,lineUpRightBold:`┕`,lineUpDoubleRightDouble:`╚`,lineUpDoubleRight:`╙`,lineUpRightDouble:`╘`,lineUpDownLeft:`┤`,lineUpBoldDownBoldLeftBold:`┫`,lineUpBoldDownBoldLeft:`┨`,lineUpDownLeftBold:`┥`,lineUpBoldDownLeftBold:`┩`,lineUpDownBoldLeftBold:`┪`,lineUpDownBoldLeft:`┧`,lineUpBoldDownLeft:`┦`,lineUpDoubleDownDoubleLeftDouble:`╣`,lineUpDoubleDownDoubleLeft:`╢`,lineUpDownLeftDouble:`╡`,lineUpDownRight:`├`,lineUpBoldDownBoldRightBold:`┣`,lineUpBoldDownBoldRight:`┠`,lineUpDownRightBold:`┝`,lineUpBoldDownRightBold:`┡`,lineUpDownBoldRightBold:`┢`,lineUpDownBoldRight:`┟`,lineUpBoldDownRight:`┞`,lineUpDoubleDownDoubleRightDouble:`╠`,lineUpDoubleDownDoubleRight:`╟`,lineUpDownRightDouble:`╞`,lineDownLeftRight:`┬`,lineDownBoldLeftBoldRightBold:`┳`,lineDownLeftBoldRightBold:`┯`,lineDownBoldLeftRight:`┰`,lineDownBoldLeftBoldRight:`┱`,lineDownBoldLeftRightBold:`┲`,lineDownLeftRightBold:`┮`,lineDownLeftBoldRight:`┭`,lineDownDoubleLeftDoubleRightDouble:`╦`,lineDownDoubleLeftRight:`╥`,lineDownLeftDoubleRightDouble:`╤`,lineUpLeftRight:`┴`,lineUpBoldLeftBoldRightBold:`┻`,lineUpLeftBoldRightBold:`┷`,lineUpBoldLeftRight:`┸`,lineUpBoldLeftBoldRight:`┹`,lineUpBoldLeftRightBold:`┺`,lineUpLeftRightBold:`┶`,lineUpLeftBoldRight:`┵`,lineUpDoubleLeftDoubleRightDouble:`╩`,lineUpDoubleLeftRight:`╨`,lineUpLeftDoubleRightDouble:`╧`,lineUpDownLeftRight:`┼`,lineUpBoldDownBoldLeftBoldRightBold:`╋`,lineUpDownBoldLeftBoldRightBold:`╈`,lineUpBoldDownLeftBoldRightBold:`╇`,lineUpBoldDownBoldLeftRightBold:`╊`,lineUpBoldDownBoldLeftBoldRight:`╉`,lineUpBoldDownLeftRight:`╀`,lineUpDownBoldLeftRight:`╁`,lineUpDownLeftBoldRight:`┽`,lineUpDownLeftRightBold:`┾`,lineUpBoldDownBoldLeftRight:`╂`,lineUpDownLeftBoldRightBold:`┿`,lineUpBoldDownLeftBoldRight:`╃`,lineUpBoldDownLeftRightBold:`╄`,lineUpDownBoldLeftBoldRight:`╅`,lineUpDownBoldLeftRightBold:`╆`,lineUpDoubleDownDoubleLeftDoubleRightDouble:`╬`,lineUpDoubleDownDoubleLeftRight:`╫`,lineUpDownLeftDoubleRightDouble:`╪`,lineCross:`╳`,lineBackslash:`╲`,lineSlash:`╱`},Tt={tick:`✔`,info:`ℹ`,warning:`⚠`,cross:`✘`,squareSmall:`◻`,squareSmallFilled:`◼`,circle:`◯`,circleFilled:`◉`,circleDotted:`◌`,circleDouble:`◎`,circleCircle:`ⓞ`,circleCross:`ⓧ`,circlePipe:`Ⓘ`,radioOn:`◉`,radioOff:`◯`,checkboxOn:`☒`,checkboxOff:`☐`,checkboxCircleOn:`ⓧ`,checkboxCircleOff:`Ⓘ`,pointer:`❯`,triangleUpOutline:`△`,triangleLeft:`◀`,triangleRight:`▶`,lozenge:`◆`,lozengeOutline:`◇`,hamburger:`☰`,smiley:`㋡`,mustache:`෴`,star:`★`,play:`▶`,nodejs:`⬢`,oneSeventh:`⅐`,oneNinth:`⅑`,oneTenth:`⅒`},Et={tick:`√`,info:`i`,warning:`‼`,cross:`×`,squareSmall:`□`,squareSmallFilled:`■`,circle:`( )`,circleFilled:`(*)`,circleDotted:`( )`,circleDouble:`( )`,circleCircle:`(○)`,circleCross:`(×)`,circlePipe:`(│)`,radioOn:`(*)`,radioOff:`( )`,checkboxOn:`[×]`,checkboxOff:`[ ]`,checkboxCircleOn:`(×)`,checkboxCircleOff:`( )`,pointer:`>`,triangleUpOutline:`∆`,triangleLeft:`◄`,triangleRight:`►`,lozenge:`♦`,lozengeOutline:`◊`,hamburger:`≡`,smiley:`☺`,mustache:`┌─┐`,star:`✶`,play:`►`,nodejs:`♦`,oneSeventh:`1/7`,oneNinth:`1/9`,oneTenth:`1/10`},Dt={...wt,...Tt},Ot={...wt,...Et},kt=Ct()?Dt:Ot;Object.entries(Tt);const At=S?.WriteStream?.prototype?.hasColors?.()??!1,P=(e,t)=>{if(!At)return e=>e;let n=`\u001B[${e}m`,r=`\u001B[${t}m`;return e=>{let i=e+``,a=i.indexOf(r);if(a===-1)return n+i+r;let o=n,s=0,c=(t===22?r:``)+n;for(;a!==-1;)o+=i.slice(s,a)+c,s=a+r.length,a=i.indexOf(r,s);return o+=i.slice(s)+r,o}};P(0,0);const jt=P(1,22);P(2,22),P(3,23),P(4,24),P(53,55),P(7,27),P(8,28),P(9,29),P(30,39),P(31,39),P(32,39),P(33,39),P(34,39),P(35,39),P(36,39),P(37,39);const Mt=P(90,39);P(40,49),P(41,49),P(42,49),P(43,49),P(44,49),P(45,49),P(46,49),P(47,49),P(100,49);const Nt=P(91,39);P(92,39);const Pt=P(93,39);P(94,39),P(95,39),P(96,39),P(97,39),P(101,49),P(102,49),P(103,49),P(104,49),P(105,49),P(106,49),P(107,49);const Ft=({type:e,message:t,timestamp:n,piped:r,commandId:i,result:{failed:a=!1}={},options:{reject:o=!0}})=>{let s=It(n),c=zt[e]({failed:a,reject:o,piped:r}),l=Vt[e]({reject:o});return`${Mt(`[${s}]`)} ${Mt(`[${i}]`)} ${l(c)} ${l(t)}`},It=e=>`${Lt(e.getHours(),2)}:${Lt(e.getMinutes(),2)}:${Lt(e.getSeconds(),2)}.${Lt(e.getMilliseconds(),3)}`,Lt=(e,t)=>String(e).padStart(t,`0`),Rt=({failed:e,reject:t})=>e?t?kt.cross:kt.warning:kt.tick,zt={command:({piped:e})=>e?`|`:`$`,output:()=>` `,ipc:()=>`*`,error:Rt,duration:Rt},Bt=e=>e,Vt={command:()=>jt,output:()=>Bt,ipc:()=>Bt,error:({reject:e})=>e?Nt:Pt,duration:()=>Mt},Ht=(e,t,n)=>{let r=lt(t,n);return e.map(({verboseLine:e,verboseObject:t})=>Ut(e,t,r)).filter(e=>e!==void 0).map(e=>Wt(e)).join(``)},Ut=(e,t,n)=>{if(n===void 0)return e;let r=n(e,t);if(typeof r==`string`)return r},Wt=e=>e.endsWith(`
`)?e:`${e}\n`,F=({type:e,verboseMessage:t,fdNumber:n,verboseInfo:r,result:i})=>{let a=Ht(Kt(t,Gt({type:e,result:i,verboseInfo:r})),r,n);a!==``&&console.warn(a.slice(0,-1))},Gt=({type:e,result:t,verboseInfo:{escapedCommand:n,commandId:r,rawOptions:{piped:i=!1,...a}}})=>({type:e,escapedCommand:n,commandId:`${r}`,timestamp:new Date,piped:i,result:t,options:a}),Kt=(e,t)=>e.split(`
`).map(e=>qt({...t,message:e})),qt=e=>({verboseLine:Ft(e),verboseObject:e}),Jt=e=>ht(typeof e==`string`?e:m(e)).replaceAll(` `,` `.repeat(Yt)),Yt=2,Xt=(e,t)=>{st(t)&&F({type:`command`,verboseMessage:e,verboseInfo:t})},Zt=(e,t,n)=>(en(e),{verbose:e,escapedCommand:t,commandId:Qt(e),rawOptions:n}),Qt=e=>st({verbose:e})?$t++:void 0;let $t=0n;const en=e=>{for(let t of e){if(t===!1)throw TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(t===!0)throw TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!pt.includes(t)&&!ft(t)){let e=pt.map(e=>`'${e}'`).join(`, `);throw TypeError(`The "verbose" option must not be ${t}. Allowed values are: ${e} or a function.`)}}},tn=()=>b.bigint(),nn=e=>Number(b.bigint()-e)/1e6,rn=(e,t,n)=>{let r=tn(),{command:i,escapedCommand:a}=mt(e,t),o=Zt(Je(n,`verbose`),a,{...n});return Xt(a,o),{command:i,escapedCommand:a,startTime:r,verboseInfo:o}};var an=e(r(),1);h(s);function on(e){return e instanceof URL?a(e):e}function sn(e){return{*[Symbol.iterator](){let t=C.resolve(on(e)),n;for(;n!==t;)yield t,n=t,t=C.resolve(t,`..`)}}}const cn=({cwd:e=_.cwd(),path:t=_.env[n()],preferLocal:r=!0,execPath:i=_.execPath,addExecPath:a=!0}={})=>{let o=C.resolve(on(e)),s=[],c=t.split(C.delimiter);return r&&ln(s,c,o),a&&un(s,c,i,o),t===``||t===C.delimiter?`${s.join(C.delimiter)}${t}`:[...s,t].join(C.delimiter)},ln=(e,t,n)=>{for(let r of sn(n)){let n=C.join(r,`node_modules/.bin`);t.includes(n)||e.push(n)}},un=(e,t,n,r)=>{let i=C.resolve(r,on(n),`..`);t.includes(i)||e.push(i)},dn=({env:e=_.env,...t}={})=>{e={...e};let r=n({env:e});return t.path=e[r],e[r]=cn(t),e},fn=(e,t,n)=>new(n?vn:_n)(t,e instanceof I?{}:{cause:e});var I=class extends Error{};const pn=(e,t)=>{Object.defineProperty(e.prototype,"name",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,hn,{value:!0,writable:!1,enumerable:!1,configurable:!1})},mn=e=>gn(e)&&hn in e,hn=Symbol(`isExecaError`),gn=e=>Object.prototype.toString.call(e)===`[object Error]`;var _n=class extends Error{};pn(_n,_n.name);var vn=class extends Error{};pn(vn,vn.name);const yn=()=>{let e=64-xn+1;return Array.from({length:e},bn)},bn=(e,t)=>({name:`SIGRT${t+1}`,number:xn+t,action:`terminate`,description:`Application-specific signal (realtime)`,standard:`posix`}),xn=34,Sn=[{name:`SIGHUP`,number:1,action:`terminate`,description:`Terminal closed`,standard:`posix`},{name:`SIGINT`,number:2,action:`terminate`,description:`User interruption with CTRL-C`,standard:`ansi`},{name:`SIGQUIT`,number:3,action:`core`,description:`User interruption with CTRL-\\`,standard:`posix`},{name:`SIGILL`,number:4,action:`core`,description:`Invalid machine instruction`,standard:`ansi`},{name:`SIGTRAP`,number:5,action:`core`,description:`Debugger breakpoint`,standard:`posix`},{name:`SIGABRT`,number:6,action:`core`,description:`Aborted`,standard:`ansi`},{name:`SIGIOT`,number:6,action:`core`,description:`Aborted`,standard:`bsd`},{name:`SIGBUS`,number:7,action:`core`,description:`Bus error due to misaligned, non-existing address or paging error`,standard:`bsd`},{name:`SIGEMT`,number:7,action:`terminate`,description:`Command should be emulated but is not implemented`,standard:`other`},{name:`SIGFPE`,number:8,action:`core`,description:`Floating point arithmetic error`,standard:`ansi`},{name:`SIGKILL`,number:9,action:`terminate`,description:`Forced termination`,standard:`posix`,forced:!0},{name:`SIGUSR1`,number:10,action:`terminate`,description:`Application-specific signal`,standard:`posix`},{name:`SIGSEGV`,number:11,action:`core`,description:`Segmentation fault`,standard:`ansi`},{name:`SIGUSR2`,number:12,action:`terminate`,description:`Application-specific signal`,standard:`posix`},{name:`SIGPIPE`,number:13,action:`terminate`,description:`Broken pipe or socket`,standard:`posix`},{name:`SIGALRM`,number:14,action:`terminate`,description:`Timeout or timer`,standard:`posix`},{name:`SIGTERM`,number:15,action:`terminate`,description:`Termination`,standard:`ansi`},{name:`SIGSTKFLT`,number:16,action:`terminate`,description:`Stack is empty or overflowed`,standard:`other`},{name:`SIGCHLD`,number:17,action:`ignore`,description:`Child process terminated, paused or unpaused`,standard:`posix`},{name:`SIGCLD`,number:17,action:`ignore`,description:`Child process terminated, paused or unpaused`,standard:`other`},{name:`SIGCONT`,number:18,action:`unpause`,description:`Unpaused`,standard:`posix`,forced:!0},{name:`SIGSTOP`,number:19,action:`pause`,description:`Paused`,standard:`posix`,forced:!0},{name:`SIGTSTP`,number:20,action:`pause`,description:`Paused using CTRL-Z or "suspend"`,standard:`posix`},{name:`SIGTTIN`,number:21,action:`pause`,description:`Background process cannot read terminal input`,standard:`posix`},{name:`SIGBREAK`,number:21,action:`terminate`,description:`User interruption with CTRL-BREAK`,standard:`other`},{name:`SIGTTOU`,number:22,action:`pause`,description:`Background process cannot write to terminal output`,standard:`posix`},{name:`SIGURG`,number:23,action:`ignore`,description:`Socket received out-of-band data`,standard:`bsd`},{name:`SIGXCPU`,number:24,action:`core`,description:`Process timed out`,standard:`bsd`},{name:`SIGXFSZ`,number:25,action:`core`,description:`File too big`,standard:`bsd`},{name:`SIGVTALRM`,number:26,action:`terminate`,description:`Timeout or timer`,standard:`bsd`},{name:`SIGPROF`,number:27,action:`terminate`,description:`Timeout or timer`,standard:`bsd`},{name:`SIGWINCH`,number:28,action:`ignore`,description:`Terminal window size changed`,standard:`bsd`},{name:`SIGIO`,number:29,action:`terminate`,description:`I/O is available`,standard:`other`},{name:`SIGPOLL`,number:29,action:`terminate`,description:`Watched event`,standard:`other`},{name:`SIGINFO`,number:29,action:`ignore`,description:`Request for process information`,standard:`other`},{name:`SIGPWR`,number:30,action:`terminate`,description:`Device running out of power`,standard:`systemv`},{name:`SIGSYS`,number:31,action:`core`,description:`Invalid system call`,standard:`other`},{name:`SIGUNUSED`,number:31,action:`terminate`,description:`Invalid system call`,standard:`other`}],Cn=()=>{let e=yn();return[...Sn,...e].map(wn)},wn=({name:e,number:t,description:n,action:r,forced:i=!1,standard:a})=>{let{signals:{[e]:o}}=T,s=o!==void 0;return{name:e,number:s?o:t,description:n,supported:s,action:r,forced:i,standard:a}},Tn=()=>{let e=Cn();return Object.fromEntries(e.map(En))},En=({name:e,number:t,description:n,supported:r,action:i,forced:a,standard:o})=>[e,{name:e,number:t,description:n,supported:r,action:i,forced:a,standard:o}],Dn=Tn(),On=()=>{let e=Cn(),t=Array.from({length:65},(t,n)=>kn(n,e));return Object.assign({},...t)},kn=(e,t)=>{let n=An(e,t);if(n===void 0)return{};let{name:r,description:i,supported:a,action:o,forced:s,standard:c}=n;return{[e]:{name:r,number:e,description:i,supported:a,action:o,forced:s,standard:c}}},An=(e,t)=>{let n=t.find(({name:t})=>T.signals[t]===e);return n===void 0?t.find(t=>t.number===e):n};On();const jn=e=>{let t="option `killSignal`";if(e===0)throw TypeError(`Invalid ${t}: 0 cannot be used.`);return Nn(e,t)},Mn=e=>e===0?e:Nn(e,"`subprocess.kill()`'s argument"),Nn=(e,t)=>{if(Number.isInteger(e))return Pn(e,t);if(typeof e==`string`)return In(e,t);throw TypeError(`Invalid ${t} ${String(e)}: it must be a string or an integer.\n${Ln()}`)},Pn=(e,t)=>{if(Fn.has(e))return Fn.get(e);throw TypeError(`Invalid ${t} ${e}: this signal integer does not exist.\n${Ln()}`)},Fn=new Map(Object.entries(T.signals).reverse().map(([e,t])=>[t,e])),In=(e,t)=>{if(e in T.signals)return e;throw e.toUpperCase()in T.signals?TypeError(`Invalid ${t} '${e}': please rename it to '${e.toUpperCase()}'.`):TypeError(`Invalid ${t} '${e}': this signal name does not exist.\n${Ln()}`)},Ln=()=>`Available signal names: ${Rn()}.
Available signal numbers: ${zn()}.`,Rn=()=>Object.keys(T.signals).sort().map(e=>`'${e}'`).join(`, `),zn=()=>[...new Set(Object.values(T.signals).sort((e,t)=>e-t))].join(`, `),Bn=e=>Dn[e].description,Vn=e=>{if(e===!1)return e;if(e===!0)return Hn;if(!Number.isFinite(e)||e<0)throw TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},Hn=1e3*5,Un=({kill:e,options:{forceKillAfterDelay:t,killSignal:n},onInternalError:r,context:i,controller:a},o,s)=>{let{signal:c,error:l}=Wn(o,s,n);Gn(l,r);let u=e(c);return Kn({kill:e,signal:c,forceKillAfterDelay:t,killSignal:n,killResult:u,context:i,controller:a}),u},Wn=(e,t,n)=>{let[r=n,i]=gn(e)?[void 0,e]:[e,t];if(typeof r!=`string`&&!Number.isInteger(r))throw TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(r)}`);if(i!==void 0&&!gn(i))throw TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:Mn(r),error:i}},Gn=(e,t)=>{e!==void 0&&t.reject(e)},Kn=async({kill:e,signal:t,forceKillAfterDelay:n,killSignal:r,killResult:i,context:a,controller:o})=>{t===r&&i&&qn({kill:e,forceKillAfterDelay:n,context:a,controllerSignal:o.signal})},qn=async({kill:e,forceKillAfterDelay:t,context:n,controllerSignal:r})=>{if(t!==!1)try{await te(t,void 0,{signal:r}),e(`SIGKILL`)&&(n.isForcefullyTerminated??=!0)}catch{}},Jn=async(e,t)=>{e.aborted||await E(e,`abort`,{signal:t})},Yn=({cancelSignal:e})=>{if(e!==void 0&&Object.prototype.toString.call(e)!==`[object AbortSignal]`)throw Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(e)}`)},Xn=({subprocess:e,cancelSignal:t,gracefulCancel:n,context:r,controller:i})=>t===void 0||n?[]:[Zn(e,t,r,i)],Zn=async(e,t,n,{signal:r})=>{throw await Jn(t,r),n.terminationReason??=`cancel`,e.kill(),t.reason},Qn=({methodName:e,isSubprocess:t,ipc:n,isConnected:r})=>{$n(e,t,n),er(e,t,r)},$n=(e,t,n)=>{if(!n)throw Error(`${L(e,t)} can only be used if the \`ipc\` option is \`true\`.`)},er=(e,t,n)=>{if(!n)throw Error(`${L(e,t)} cannot be used: the ${R(t)} has already exited or disconnected.`)},tr=e=>{throw Error(`${L(`getOneMessage`,e)} could not complete: the ${R(e)} exited or disconnected.`)},nr=e=>{throw Error(`${L(`sendMessage`,e)} failed: the ${R(e)} is sending a message too, instead of listening to incoming messages.
This can be fixed by both sending a message and listening to incoming messages at the same time:
const [receivedMessage] = await Promise.all([
${L(`getOneMessage`,e)},
${L(`sendMessage`,e,`message, {strict: true}`)},
]);`)},rr=(e,t)=>Error(`${L(`sendMessage`,t)} failed when sending an acknowledgment response to the ${R(t)}.`,{cause:e}),ir=e=>{throw Error(`${L(`sendMessage`,e)} failed: the ${R(e)} is not listening to incoming messages.`)},ar=e=>{throw Error(`${L(`sendMessage`,e)} failed: the ${R(e)} exited without listening to incoming messages.`)},or=()=>Error(`\`cancelSignal\` aborted: the ${R(!0)} disconnected.`),sr=()=>{throw Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},cr=({error:e,methodName:t,isSubprocess:n})=>{if(e.code===`EPIPE`)throw Error(`${L(t,n)} cannot be used: the ${R(n)} is disconnecting.`,{cause:e})},lr=({error:e,methodName:t,isSubprocess:n,message:r})=>{if(ur(e))throw Error(`${L(t,n)}'s argument type is invalid: the message cannot be serialized: ${String(r)}.`,{cause:e})},ur=({code:e,message:t})=>dr.has(e)||fr.some(e=>t.includes(e)),dr=new Set([`ERR_MISSING_ARGS`,`ERR_INVALID_ARG_TYPE`]),fr=[`could not be cloned`,`circular structure`,`call stack size exceeded`],L=(e,t,n=``)=>e===`cancelSignal`?"`cancelSignal`'s `controller.abort()`":`${pr(t)}${e}(${n})`,pr=e=>e?``:`subprocess.`,R=e=>e?`parent process`:`subprocess`,mr=e=>{e.connected&&e.disconnect()},hr=()=>{let e={},t=new Promise((t,n)=>{Object.assign(e,{resolve:t,reject:n})});return Object.assign(t,e)},gr=(e,t=`stdin`)=>{let{options:n,fileDescriptors:r}=z.get(e),i=vr(r,t,!0),a=e.stdio[i];if(a===null)throw TypeError(xr(i,t,n,!0));return a},_r=(e,t=`stdout`)=>{let{options:n,fileDescriptors:r}=z.get(e),i=vr(r,t,!1),a=i===`all`?e.all:e.stdio[i];if(a==null)throw TypeError(xr(i,t,n,!1));return a},z=new WeakMap,vr=(e,t,n)=>{let r=yr(t,n);return br(r,t,n,e),r},yr=(e,t)=>{let n=tt(e);if(n!==void 0)return n;let{validOptions:r,defaultValue:i}=t?{validOptions:`"stdin"`,defaultValue:`stdin`}:{validOptions:`"stdout", "stderr", "all"`,defaultValue:`stdout`};throw TypeError(`"${B(t)}" must not be "${e}".
It must be ${r} or "fd3", "fd4" (and so on).
It is optional and defaults to "${i}".`)},br=(e,t,n,r)=>{let i=r[Cr(e)];if(i===void 0)throw TypeError(`"${B(n)}" must not be ${t}. That file descriptor does not exist.
Please set the "stdio" option to ensure that file descriptor exists.`);if(i.direction===`input`&&!n)throw TypeError(`"${B(n)}" must not be ${t}. It must be a readable stream, not writable.`);if(i.direction!==`input`&&n)throw TypeError(`"${B(n)}" must not be ${t}. It must be a writable stream, not readable.`)},xr=(e,t,n,r)=>{if(e===`all`&&!n.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:i,optionValue:a}=Sr(e,n);return`The "${i}: ${wr(a)}" option is incompatible with using "${B(r)}: ${wr(t)}".
Please set this option with "pipe" instead.`},Sr=(e,{stdin:t,stdout:n,stderr:r,stdio:i})=>{let a=Cr(e);return a===0&&t!==void 0?{optionName:`stdin`,optionValue:t}:a===1&&n!==void 0?{optionName:`stdout`,optionValue:n}:a===2&&r!==void 0?{optionName:`stderr`,optionValue:r}:{optionName:`stdio[${a}]`,optionValue:i[a]}},Cr=e=>e===`all`?1:e,B=e=>e?`to`:`from`,wr=e=>typeof e==`string`?`'${e}'`:typeof e==`number`?`${e}`:`Stream`,Tr=(e,t,n)=>{let r=e.getMaxListeners();r===0||r===1/0||(e.setMaxListeners(r+t),re(n,()=>{e.setMaxListeners(e.getMaxListeners()-t)}))},Er=(e,t)=>{t&&Dr(e)},Dr=e=>{e.refCounted()},Or=(e,t)=>{t&&kr(e)},kr=e=>{e.unrefCounted()},Ar=(e,t)=>{t&&(kr(e),kr(e))},jr=(e,t)=>{t&&(Dr(e),Dr(e))},Mr=async({anyProcess:e,channel:t,isSubprocess:n,ipcEmitter:r},i)=>{if(Ur(i)||li(i))return;Pr.has(e)||Pr.set(e,[]);let a=Pr.get(e);if(a.push(i),!(a.length>1))for(;a.length>0;){await Zr(e,r,i),await w.yield();let o=await Hr({wrappedMessage:a[0],anyProcess:e,channel:t,isSubprocess:n,ipcEmitter:r});a.shift(),r.emit(`message`,o),r.emit(`message:done`)}},Nr=async({anyProcess:e,channel:t,isSubprocess:n,ipcEmitter:r,boundOnMessage:i})=>{di();let a=Pr.get(e);for(;a?.length>0;)await E(r,`message:done`);e.removeListener(`message`,i),jr(t,n),r.connected=!1,r.emit(`disconnect`)},Pr=new WeakMap,Fr=(e,t,n)=>{if(Ir.has(e))return Ir.get(e);let r=new ne;return r.connected=!0,Ir.set(e,r),Lr({ipcEmitter:r,anyProcess:e,channel:t,isSubprocess:n}),r},Ir=new WeakMap,Lr=({ipcEmitter:e,anyProcess:t,channel:n,isSubprocess:r})=>{let i=Mr.bind(void 0,{anyProcess:t,channel:n,isSubprocess:r,ipcEmitter:e});t.on(`message`,i),t.once(`disconnect`,Nr.bind(void 0,{anyProcess:t,channel:n,isSubprocess:r,ipcEmitter:e,boundOnMessage:i})),Ar(n,r)},Rr=e=>{let t=Ir.get(e);return t===void 0?e.channel!==null:t.connected},zr=({anyProcess:e,channel:t,isSubprocess:n,message:r,strict:i})=>{if(!i)return r;let a=Qr(e,Fr(e,t,n));return{id:Br++,type:qr,message:r,hasListeners:a}};let Br=0n;const Vr=(e,t)=>{if(!(t?.type!==qr||t.hasListeners))for(let{id:t}of e)t!==void 0&&Gr[t].resolve({isDeadlock:!0,hasListeners:!1})},Hr=async({wrappedMessage:e,anyProcess:t,channel:n,isSubprocess:r,ipcEmitter:i})=>{if(e?.type!==qr||!t.connected)return e;let{id:a,message:o}=e,s={id:a,type:Jr,message:Qr(t,i)};try{await ei({anyProcess:t,channel:n,isSubprocess:r,ipc:!0},s)}catch(e){i.emit(`strict:error`,e)}return o},Ur=e=>{if(e?.type!==Jr)return!1;let{id:t,message:n}=e;return Gr[t]?.resolve({isDeadlock:!1,hasListeners:n}),!0},Wr=async(e,t,n)=>{if(e?.type!==qr)return;let r=hr();Gr[e.id]=r;let i=new AbortController;try{let{isDeadlock:e,hasListeners:a}=await Promise.race([r,Kr(t,n,i)]);e&&nr(n),a||ir(n)}finally{i.abort(),delete Gr[e.id]}},Gr={},Kr=async(e,t,{signal:n})=>{Tr(e,1,n),await E(e,`disconnect`,{signal:n}),ar(t)},qr=`execa:ipc:request`,Jr=`execa:ipc:response`,Yr=(e,t,n)=>{V.has(e)||V.set(e,new Set);let r=V.get(e),i={onMessageSent:hr(),id:n?t.id:void 0};return r.add(i),{outgoingMessages:r,outgoingMessage:i}},Xr=({outgoingMessages:e,outgoingMessage:t})=>{e.delete(t),t.onMessageSent.resolve()},Zr=async(e,t,n)=>{for(;!Qr(e,t)&&V.get(e)?.size>0;){let t=[...V.get(e)];Vr(t,n),await Promise.all(t.map(({onMessageSent:e})=>e))}},V=new WeakMap,Qr=(e,t)=>t.listenerCount(`message`)>$r(e),$r=e=>z.has(e)&&!ot(z.get(e).options.buffer,`ipc`)?1:0,ei=({anyProcess:e,channel:t,isSubprocess:n,ipc:r},i,{strict:a=!1}={})=>{let o=`sendMessage`;return Qn({methodName:o,isSubprocess:n,ipc:r,isConnected:e.connected}),ti({anyProcess:e,channel:t,methodName:o,isSubprocess:n,message:i,strict:a})},ti=async({anyProcess:e,channel:t,methodName:n,isSubprocess:r,message:i,strict:a})=>{let o=zr({anyProcess:e,channel:t,isSubprocess:r,message:i,strict:a}),s=Yr(e,o,a);try{await ni({anyProcess:e,methodName:n,isSubprocess:r,wrappedMessage:o,message:i})}catch(t){throw mr(e),t}finally{Xr(s)}},ni=async({anyProcess:e,methodName:t,isSubprocess:n,wrappedMessage:r,message:i})=>{let a=ri(e);try{await Promise.all([Wr(r,e,n),a(r)])}catch(e){throw cr({error:e,methodName:t,isSubprocess:n}),lr({error:e,methodName:t,isSubprocess:n,message:i}),e}},ri=e=>{if(ii.has(e))return ii.get(e);let t=h(e.send.bind(e));return ii.set(e,t),t},ii=new WeakMap,ai=(e,t)=>{let n=`cancelSignal`;return er(n,!1,e.connected),ni({anyProcess:e,methodName:n,isSubprocess:!1,wrappedMessage:{type:ui,message:t},message:t})},oi=async({anyProcess:e,channel:t,isSubprocess:n,ipc:r})=>(await si({anyProcess:e,channel:t,isSubprocess:n,ipc:r}),fi.signal),si=async({anyProcess:e,channel:t,isSubprocess:n,ipc:r})=>{if(!ci){if(ci=!0,!r){sr();return}if(t===null){di();return}Fr(e,t,n),await w.yield()}};let ci=!1;const li=e=>e?.type===ui?(fi.abort(e.message),!0):!1,ui=`execa:ipc:cancel`,di=()=>{fi.abort(or())},fi=new AbortController,pi=({gracefulCancel:e,cancelSignal:t,ipc:n,serialization:r})=>{if(e){if(t===void 0)throw Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!n)throw Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(r===`json`)throw Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")}},mi=({subprocess:e,cancelSignal:t,gracefulCancel:n,forceKillAfterDelay:r,context:i,controller:a})=>n?[hi({subprocess:e,cancelSignal:t,forceKillAfterDelay:r,context:i,controller:a})]:[],hi=async({subprocess:e,cancelSignal:t,forceKillAfterDelay:n,context:r,controller:{signal:i}})=>{throw await Jn(t,i),await ai(e,gi(t)),qn({kill:e.kill,forceKillAfterDelay:n,context:r,controllerSignal:i}),r.terminationReason??=`gracefulCancel`,t.reason},gi=({reason:e})=>{if(!(e instanceof DOMException))return e;let t=Error(e.message);return Object.defineProperty(t,"stack",{value:e.stack,enumerable:!1,configurable:!0,writable:!0}),t},_i=({timeout:e})=>{if(e!==void 0&&(!Number.isFinite(e)||e<0))throw TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`)},vi=(e,t,n,r)=>t===0||t===void 0?[]:[yi(e,t,n,r)],yi=async(e,t,n,{signal:r})=>{throw await te(t,void 0,{signal:r}),n.terminationReason??=`timeout`,e.kill(),new I},bi=({options:e})=>{if(e.node===!1)throw TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...e,node:!0}}},xi=(e,t,{node:n=!1,nodePath:r=y,nodeOptions:i=v.filter(e=>!e.startsWith(`--inspect`)),cwd:a,execPath:o,...s})=>{if(o!==void 0)throw TypeError(`The "execPath" option has been removed. Please use the "nodePath" option instead.`);let c=ye(r,`The "nodePath" option`),l=C.resolve(a,c),u={...s,nodePath:l,node:n,cwd:a};if(!n)return[e,t,u];if(C.basename(e,`.exe`)===`node`)throw TypeError(`When the "node" option is true, the first argument does not need to be "node".`);return[l,[...i,e,...t],{ipc:!0,...u,shell:!1}]},Si=({ipcInput:e,ipc:t,serialization:n})=>{if(e!==void 0){if(!t)throw Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");Ci[n](e)}},Ci={advanced:e=>{try{oe(e)}catch(e){throw Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},json:e=>{try{JSON.stringify(e)}catch(e){throw Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}}},wi=async(e,t)=>{t!==void 0&&await e.sendMessage(t)},Ti=({encoding:e})=>{if(Di.has(e))return;let t=Oi(e);if(t!==void 0)throw TypeError(`Invalid option \`encoding: ${Ai(e)}\`.
Please rename it to ${Ai(t)}.`);let n=[...Di].map(e=>Ai(e)).join(`, `);throw TypeError(`Invalid option \`encoding: ${Ai(e)}\`.
Please rename it to one of: ${n}.`)},Ei=new Set([`utf8`,`utf16le`]),H=new Set([`buffer`,`hex`,`base64`,`base64url`,`latin1`,`ascii`]),Di=new Set([...Ei,...H]),Oi=e=>{if(e===null)return`buffer`;if(typeof e!=`string`)return;let t=e.toLowerCase();if(t in ki)return ki[t];if(Di.has(t))return t},ki={"utf-8":`utf8`,"utf-16le":`utf16le`,"ucs-2":`utf16le`,ucs2:`utf16le`,binary:`latin1`},Ai=e=>typeof e==`string`?`"${e}"`:String(e),ji=(e=Mi())=>{let t=ye(e,`The "cwd" option`);return C.resolve(t)},Mi=()=>{try{return _.cwd()}catch(e){throw e.message=`The current directory does not exist.\n${e.message}`,e}},Ni=(e,t)=>{if(t===Mi())return e;let n;try{n=de(t)}catch(n){return`The "cwd" option is invalid: ${t}.\n${n.message}\n${e}`}return n.isDirectory()?e:`The "cwd" option is not a directory: ${t}.\n${e}`},Pi=(e,t,n)=>{n.cwd=ji(n.cwd);let[r,i,a]=xi(e,t,n),{command:o,args:s,options:c}=an.default._parse(r,i,a),l=Fi(qe(c));return _i(l),Ti(l),Si(l),Yn(l),pi(l),l.shell=Se(l.shell),l.env=Ii(l),l.killSignal=jn(l.killSignal),l.forceKillAfterDelay=Vn(l.forceKillAfterDelay),l.lines=l.lines.map((e,t)=>e&&!H.has(l.encoding)&&l.buffer[t]),_.platform===`win32`&&C.basename(o,`.exe`)===`cmd`&&s.unshift(`/q`),{file:o,commandArguments:s,options:l}},Fi=({extendEnv:e=!0,preferLocal:t=!1,cwd:n,localDir:r=n,encoding:i=`utf8`,reject:a=!0,cleanup:o=!0,all:s=!1,windowsHide:c=!0,killSignal:l=`SIGTERM`,forceKillAfterDelay:u=!0,gracefulCancel:d=!1,ipcInput:f,ipc:p=f!==void 0||d,serialization:m=`advanced`,...h})=>({...h,extendEnv:e,preferLocal:t,cwd:n,localDirectory:r,encoding:i,reject:a,cleanup:o,all:s,windowsHide:c,killSignal:l,forceKillAfterDelay:u,gracefulCancel:d,ipcInput:f,ipc:p,serialization:m}),Ii=({env:e,extendEnv:t,preferLocal:n,node:r,localDirectory:i,nodePath:a})=>{let o=t?{..._.env,...e}:e;return n||r?dn({env:o,cwd:i,execPath:a,preferLocal:n,addExecPath:r}):o},Li=(e,t,n)=>n.shell&&t.length>0?[[e,...t].join(` `),[],n]:[e,t,n];function Ri(e){if(typeof e==`string`)return zi(e);if(!(ArrayBuffer.isView(e)&&e.BYTES_PER_ELEMENT===1))throw Error(`Input must be a string or a Uint8Array`);return Bi(e)}const zi=e=>e.at(-1)===Vi?e.slice(0,e.at(-2)===Ui?-2:-1):e,Bi=e=>e.at(-1)===Hi?e.subarray(0,e.at(-2)===Wi?-2:-1):e,Vi=`
`,Hi=`
`.codePointAt(0),Ui=`\r`,Wi=`\r`.codePointAt(0);function U(e,{checkOpen:t=!0}={}){return typeof e==`object`&&!!e&&(e.writable||e.readable||!t||e.writable===void 0&&e.readable===void 0)&&typeof e.pipe==`function`}function Gi(e,{checkOpen:t=!0}={}){return U(e,{checkOpen:t})&&(e.writable||!t)&&typeof e.write==`function`&&typeof e.end==`function`&&typeof e.writable==`boolean`&&typeof e.writableObjectMode==`boolean`&&typeof e.destroy==`function`&&typeof e.destroyed==`boolean`}function Ki(e,{checkOpen:t=!0}={}){return U(e,{checkOpen:t})&&(e.readable||!t)&&typeof e.read==`function`&&typeof e.readable==`boolean`&&typeof e.readableObjectMode==`boolean`&&typeof e.destroy==`function`&&typeof e.destroyed==`boolean`}function qi(e,t){return Gi(e,t)&&Ki(e,t)}const Ji=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);var Yi=class{#e;#t;#n=!1;#r=void 0;constructor(e,t){this.#e=e,this.#t=t}next(){let e=()=>this.#i();return this.#r=this.#r?this.#r.then(e,e):e(),this.#r}return(e){let t=()=>this.#a(e);return this.#r?this.#r.then(t,t):t()}async#i(){if(this.#n)return{done:!0,value:void 0};let e;try{e=await this.#e.read()}catch(e){throw this.#r=void 0,this.#n=!0,this.#e.releaseLock(),e}return e.done&&(this.#r=void 0,this.#n=!0,this.#e.releaseLock()),e}async#a(e){if(this.#n)return{done:!0,value:e};if(this.#n=!0,!this.#t){let t=this.#e.cancel(e);return this.#e.releaseLock(),await t,{done:!0,value:e}}return this.#e.releaseLock(),{done:!0,value:e}}};const Xi=Symbol();function Zi(){return this[Xi].next()}Object.defineProperty(Zi,"name",{value:`next`});function Qi(e){return this[Xi].return(e)}Object.defineProperty(Qi,"name",{value:`return`});const $i=Object.create(Ji,{next:{enumerable:!0,configurable:!0,writable:!0,value:Zi},return:{enumerable:!0,configurable:!0,writable:!0,value:Qi}});function ea({preventCancel:e=!1}={}){let t=new Yi(this.getReader(),e),n=Object.create($i);return n[Xi]=t,n}const ta=e=>{if(Ki(e,{checkOpen:!1})&&aa.on!==void 0)return ra(e);if(typeof e?.[Symbol.asyncIterator]==`function`)return e;if(na.call(e)===`[object ReadableStream]`)return ea.call(e);throw TypeError(`The first argument must be a Readable, a ReadableStream, or an async iterable.`)},{toString:na}=Object.prototype,ra=async function*(e){let t=new AbortController,n={};ia(e,t,n);try{for await(let[n]of aa.on(e,`data`,{signal:t.signal}))yield n}catch(e){if(n.error!==void 0)throw n.error;if(!t.signal.aborted)throw e}finally{e.destroy()}},ia=async(e,t,n)=>{try{await aa.finished(e,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(e){n.error=e}finally{t.abort()}},aa={},oa=async(e,{init:t,convertChunk:n,getSize:r,truncateChunk:i,addChunk:a,getFinalChunk:o,finalize:s},{maxBuffer:c=1/0}={})=>{let l=ta(e),u=t();u.length=0;try{for await(let e of l)ca({convertedChunk:n[ua(e)](e,u),state:u,getSize:r,truncateChunk:i,addChunk:a,maxBuffer:c});return sa({state:u,convertChunk:n,getSize:r,truncateChunk:i,addChunk:a,getFinalChunk:o,maxBuffer:c}),s(u)}catch(e){let t=typeof e==`object`&&e?e:Error(e);throw t.bufferedData=s(u),t}},sa=({state:e,getSize:t,truncateChunk:n,addChunk:r,getFinalChunk:i,maxBuffer:a})=>{let o=i(e);o!==void 0&&ca({convertedChunk:o,state:e,getSize:t,truncateChunk:n,addChunk:r,maxBuffer:a})},ca=({convertedChunk:e,state:t,getSize:n,truncateChunk:r,addChunk:i,maxBuffer:a})=>{let o=n(e),s=t.length+o;if(s<=a){la(e,t,i,s);return}let c=r(e,a-t.length);throw c!==void 0&&la(c,t,i,a),new fa},la=(e,t,n,r)=>{t.contents=n(e,t,r),t.length=r},ua=e=>{let t=typeof e;if(t===`string`)return`string`;if(t!==`object`||e===null)return`others`;if(globalThis.Buffer?.isBuffer(e))return`buffer`;let n=da.call(e);return n===`[object ArrayBuffer]`?`arrayBuffer`:n===`[object DataView]`?`dataView`:Number.isInteger(e.byteLength)&&Number.isInteger(e.byteOffset)&&da.call(e.buffer)===`[object ArrayBuffer]`?`typedArray`:`others`},{toString:da}=Object.prototype;var fa=class extends Error{name=`MaxBufferError`;constructor(){super(`maxBuffer exceeded`)}};const W=e=>e,pa=()=>void 0,ma=({contents:e})=>e,ha=e=>{throw Error(`Streams in object mode are not supported: ${String(e)}`)},ga=e=>e.length;async function _a(e,t){return oa(e,va,t)}const va={init:()=>({contents:[]}),convertChunk:{string:W,buffer:W,arrayBuffer:W,dataView:W,typedArray:W,others:W},getSize:()=>1,truncateChunk:pa,addChunk:(e,{contents:t})=>(t.push(e),t),getFinalChunk:pa,finalize:ma};async function ya(e,t){return oa(e,Na,t)}const ba=()=>({contents:new ArrayBuffer(0)}),xa=e=>Sa.encode(e),Sa=new TextEncoder,Ca=e=>new Uint8Array(e),wa=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),Ta=(e,t)=>e.slice(0,t),Ea=(e,{contents:t,length:n},r)=>{let i=Ma()?Oa(t,r):Da(t,r);return new Uint8Array(i).set(e,n),i},Da=(e,t)=>{if(t<=e.byteLength)return e;let n=new ArrayBuffer(ka(t));return new Uint8Array(n).set(new Uint8Array(e),0),n},Oa=(e,t)=>{if(t<=e.maxByteLength)return e.resize(t),e;let n=new ArrayBuffer(t,{maxByteLength:ka(t)});return new Uint8Array(n).set(new Uint8Array(e),0),n},ka=e=>Aa**Math.ceil(Math.log(e)/Math.log(Aa)),Aa=2,ja=({contents:e,length:t})=>Ma()?e:e.slice(0,t),Ma=()=>`resize`in ArrayBuffer.prototype,Na={init:ba,convertChunk:{string:xa,buffer:Ca,arrayBuffer:Ca,dataView:wa,typedArray:wa,others:ha},getSize:ga,truncateChunk:Ta,addChunk:Ea,getFinalChunk:pa,finalize:ja};async function Pa(e,t){return oa(e,La,t)}const Fa=()=>({contents:``,textDecoder:new TextDecoder}),Ia=(e,{textDecoder:t})=>t.decode(e,{stream:!0}),La={init:Fa,convertChunk:{string:W,buffer:Ia,arrayBuffer:Ia,dataView:Ia,typedArray:Ia,others:ha},getSize:ga,truncateChunk:(e,t)=>e.slice(0,t),addChunk:(e,{contents:t})=>t+e,getFinalChunk:({textDecoder:e})=>{let t=e.decode();return t===``?void 0:t},finalize:ma},Ra=({error:e,stream:t,readableObjectMode:n,lines:r,encoding:i,fdNumber:a})=>{if(!(e instanceof fa))throw e;if(a===`all`)return e;throw e.maxBufferInfo={fdNumber:a,unit:za(n,r,i)},t.destroy(),e},za=(e,t,n)=>e?`objects`:t?`lines`:n===`buffer`?`bytes`:`characters`,Ba=(e,t,n)=>{if(t.length!==n)return;let r=new fa;throw r.maxBufferInfo={fdNumber:`ipc`},r},Va=(e,t)=>{let{streamName:n,threshold:r,unit:i}=Ha(e,t);return`Command's ${n} was larger than ${r} ${i}`},Ha=(e,t)=>{if(e?.maxBufferInfo===void 0)return{streamName:`output`,threshold:t[1],unit:`bytes`};let{maxBufferInfo:{fdNumber:n,unit:r}}=e;delete e.maxBufferInfo;let i=ot(t,n);return n===`ipc`?{streamName:`IPC output`,threshold:i,unit:`messages`}:{streamName:Ke(n),threshold:i,unit:r}},Ua=(e,t,n)=>e?.code===`ENOBUFS`&&t!==null&&t.some(e=>e!==null&&e.length>Ga(n)),Wa=(e,t,n)=>{if(!t)return e;let r=Ga(n);return e.length>r?e.slice(0,r):e},Ga=([,e])=>e,Ka=({stdio:e,all:t,ipcOutput:n,originalError:r,signal:i,signalDescription:a,exitCode:o,escapedCommand:s,timedOut:c,isCanceled:l,isGracefullyCanceled:u,isMaxBuffer:d,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m,maxBuffer:h,timeout:g,cwd:_})=>{let v=r?.code,y=qa({originalError:r,timedOut:c,timeout:g,isMaxBuffer:d,maxBuffer:h,errorCode:v,signal:i,signalDescription:a,exitCode:o,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m}),b=Ya(r,_),x=`${y}: ${s}${b===void 0?``:`\n${b}`}`;return{originalMessage:b,shortMessage:x,message:[x,...t===void 0?[e[2],e[1]]:[t],...e.slice(3),n.map(e=>Xa(e)).join(`
`)].map(e=>ht(Ri(Za(e)))).filter(Boolean).join(`
`)}},qa=({originalError:e,timedOut:t,timeout:n,isMaxBuffer:r,maxBuffer:i,errorCode:a,signal:o,signalDescription:s,exitCode:c,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:d,forceKillAfterDelay:f,killSignal:p})=>{let m=Ja(d,f);return t?`Command timed out after ${n} milliseconds${m}`:u?o===void 0?`Command was gracefully canceled with exit code ${c}`:d?`Command was gracefully canceled${m}`:`Command was gracefully canceled with ${o} (${s})`:l?`Command was canceled${m}`:r?`${Va(e,i)}${m}`:a===void 0?d?`Command was killed with ${p} (${Bn(p)})${m}`:o===void 0?c===void 0?`Command failed`:`Command failed with exit code ${c}`:`Command was killed with ${o} (${s})`:`Command failed with ${a}${m}`},Ja=(e,t)=>e?` and was forcefully terminated after ${t} milliseconds`:``,Ya=(e,t)=>{if(e instanceof I)return;let n=ht(Ni(mn(e)?e.originalMessage:String(e?.message??e),t));return n===``?void 0:n},Xa=e=>typeof e==`string`?e:m(e),Za=e=>Array.isArray(e)?e.map(e=>Ri(Qa(e))).filter(Boolean).join(`
`):Qa(e),Qa=e=>typeof e==`string`?e:A(e)?ke(e):``,$a=({command:e,escapedCommand:t,stdio:n,all:r,ipcOutput:i,options:{cwd:a},startTime:o})=>ro({command:e,escapedCommand:t,cwd:a,durationMs:nn(o),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:n[1],stderr:n[2],all:r,stdio:n,ipcOutput:i,pipedFrom:[]}),eo=({error:e,command:t,escapedCommand:n,fileDescriptors:r,options:i,startTime:a,isSync:o})=>to({error:e,command:t,escapedCommand:n,startTime:a,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:r.length}),ipcOutput:[],options:i,isSync:o}),to=({error:e,command:t,escapedCommand:n,startTime:r,timedOut:i,isCanceled:a,isGracefullyCanceled:o,isMaxBuffer:s,isForcefullyTerminated:c,exitCode:l,signal:u,stdio:d,all:f,ipcOutput:p,options:{timeoutDuration:m,timeout:h=m,forceKillAfterDelay:g,killSignal:_,cwd:v,maxBuffer:y},isSync:b})=>{let{exitCode:x,signal:S,signalDescription:C}=io(l,u),{originalMessage:w,shortMessage:ee,message:te}=Ka({stdio:d,all:f,ipcOutput:p,originalError:e,signal:S,signalDescription:C,exitCode:x,escapedCommand:n,timedOut:i,isCanceled:a,isGracefullyCanceled:o,isMaxBuffer:s,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:_,maxBuffer:y,timeout:h,cwd:v}),T=fn(e,te,b);return Object.assign(T,no({error:T,command:t,escapedCommand:n,startTime:r,timedOut:i,isCanceled:a,isGracefullyCanceled:o,isMaxBuffer:s,isForcefullyTerminated:c,exitCode:x,signal:S,signalDescription:C,stdio:d,all:f,ipcOutput:p,cwd:v,originalMessage:w,shortMessage:ee})),T},no=({error:e,command:t,escapedCommand:n,startTime:r,timedOut:i,isCanceled:a,isGracefullyCanceled:o,isMaxBuffer:s,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,stdio:f,all:p,ipcOutput:m,cwd:h,originalMessage:g,shortMessage:_})=>ro({shortMessage:_,originalMessage:g,command:t,escapedCommand:n,cwd:h,durationMs:nn(r),failed:!0,timedOut:i,isCanceled:a,isGracefullyCanceled:o,isTerminated:u!==void 0,isMaxBuffer:s,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,code:e.cause?.code,stdout:f[1],stderr:f[2],all:p,stdio:f,ipcOutput:m,pipedFrom:[]}),ro=e=>Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0)),io=(e,t)=>{let n=e===null?void 0:e,r=t===null?void 0:t;return{exitCode:n,signal:r,signalDescription:r===void 0?void 0:Bn(t)}},ao=e=>Number.isFinite(e)?e:0;function oo(e){return{days:Math.trunc(e/864e5),hours:Math.trunc(e/36e5%24),minutes:Math.trunc(e/6e4%60),seconds:Math.trunc(e/1e3%60),milliseconds:Math.trunc(e%1e3),microseconds:Math.trunc(ao(e*1e3)%1e3),nanoseconds:Math.trunc(ao(e*1e6)%1e3)}}function so(e){return{days:e/86400000n,hours:e/3600000n%24n,minutes:e/60000n%60n,seconds:e/1000n%60n,milliseconds:e%1000n,microseconds:0n,nanoseconds:0n}}function co(e){switch(typeof e){case`number`:if(Number.isFinite(e))return oo(e);break;case`bigint`:return so(e)}throw TypeError(`Expected a finite number or bigint`)}const lo=e=>e===0||e===0n,uo=(e,t)=>t===1||t===1n?e:`${e}s`,fo=24n*60n*60n*1000n;function po(e,t){let n=typeof e==`bigint`;if(!n&&!Number.isFinite(e))throw TypeError(`Expected a finite number or bigint`);t={...t};let r=e<0?`-`:``;e=e<0?-e:e,t.colonNotation&&(t.compact=!1,t.formatSubMilliseconds=!1,t.separateMilliseconds=!1,t.verbose=!1),t.compact&&(t.unitCount=1,t.secondsDecimalDigits=0,t.millisecondsDecimalDigits=0);let i=[],a=(e,t)=>{let n=Math.floor(e*10**t+1e-7);return(Math.round(n)/10**t).toFixed(t)},o=(e,n,r,a)=>{if(!((i.length===0||!t.colonNotation)&&lo(e)&&!(t.colonNotation&&r===`m`))){if(a??=String(e),t.colonNotation){let e=a.includes(`.`)?a.split(`.`)[0].length:a.length,t=i.length>0?2:1;a=`0`.repeat(Math.max(0,t-e))+a}else a+=t.verbose?` `+uo(n,e):r;i.push(a)}},s=co(e),c=BigInt(s.days);if(t.hideYearAndDays?o(BigInt(c)*24n+BigInt(s.hours),`hour`,`h`):(t.hideYear?o(c,`day`,`d`):(o(c/365n,`year`,`y`),o(c%365n,`day`,`d`)),o(Number(s.hours),`hour`,`h`)),o(Number(s.minutes),`minute`,`m`),!t.hideSeconds)if(t.separateMilliseconds||t.formatSubMilliseconds||!t.colonNotation&&e<1e3&&!t.subSecondsAsDecimals){let e=Number(s.seconds),n=Number(s.milliseconds),r=Number(s.microseconds),i=Number(s.nanoseconds);if(o(e,`second`,`s`),t.formatSubMilliseconds)o(n,`millisecond`,`ms`),o(r,`microsecond`,`µs`),o(i,`nanosecond`,`ns`);else{let e=n+r/1e3+i/1e6,a=typeof t.millisecondsDecimalDigits==`number`?t.millisecondsDecimalDigits:0,s=a?e.toFixed(a):e>=1?Math.round(e):Math.