@fmdzc/cli-ai 3.1.2 → 3.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/anthropic-TJJHMK4P.js +47 -0
- package/dist/chunk-BAM5DR4L.js +2 -0
- package/dist/chunk-DYGVT5PG.js +27 -0
- package/dist/chunk-KWCGINWB.js +2 -0
- package/dist/chunk-QPVTJWSV.js +2 -0
- package/dist/cli.js +54 -0
- package/dist/clipboardy-2ZYXPDO4.js +7 -0
- package/dist/devtools-32J76P22.js +8 -0
- package/dist/execa-HQCA4V7K.js +44 -0
- package/dist/index.js +76 -72
- package/dist/openai-IPOZE2MF.js +30 -0
- package/dist/openrouter-2JMS534N.js +42 -0
- package/package.json +2 -3
- package/dist/index.d.ts +0 -2
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as wa,b as Nt,c as en}from"./chunk-KWCGINWB.js";import{d as ba}from"./chunk-QPVTJWSV.js";function y(e){if(typeof e!="object"||e===null)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)}import{fileURLToPath as xa}from"url";var te=(e,t)=>{let r=jt(Ea(e));if(typeof r!="string")throw new TypeError(`${t} must be a string or a file URL: ${r}.`);return r},Ea=e=>_t(e)?e.toString():e,_t=e=>typeof e!="string"&&e&&Object.getPrototypeOf(e)===String.prototype,jt=e=>e instanceof URL?xa(e):e;var Be=(e,t=[],r={})=>{let n=te(e,"First argument"),[o,i]=y(t)?[[],t]:[t,r];if(!Array.isArray(o))throw new TypeError(`Second argument must be either an array of arguments or an options object: ${o}`);if(o.some(c=>typeof c=="object"&&c!==null))throw new TypeError(`Second argument must be an array of strings: ${o}`);let s=o.map(String),a=s.find(c=>c.includes("\0"));if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!y(i))throw new TypeError(`Last argument must be an options object: ${i}`);return[n,s,i]};import{ChildProcess as Ma}from"child_process";import{StringDecoder as Ta}from"string_decoder";var{toString:tn}=Object.prototype,rn=e=>tn.call(e)==="[object ArrayBuffer]",b=e=>tn.call(e)==="[object Uint8Array]",N=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),Oa=new TextEncoder,nn=e=>Oa.encode(e),Da=new TextDecoder,Le=e=>Da.decode(e),on=(e,t)=>Aa(e,t).join(""),Aa=(e,t)=>{if(t==="utf8"&&e.every(i=>typeof i=="string"))return e;let r=new Ta(t),n=e.map(i=>typeof i=="string"?nn(i):i).map(i=>r.write(i)),o=r.end();return o===""?n:[...n,o]},Se=e=>e.length===1&&b(e[0])?e[0]:vt(Ia(e)),Ia=e=>e.map(t=>typeof t=="string"?nn(t):t),vt=e=>{let t=new Uint8Array(Ra(e)),r=0;for(let n of e)t.set(n,r),r+=n.length;return t},Ra=e=>{let t=0;for(let r of e)t+=r.length;return t};var ln=e=>Array.isArray(e)&&Array.isArray(e.raw),fn=(e,t)=>{let r=[];for(let[i,s]of e.entries())r=Ca({templates:e,expressions:t,tokens:r,index:i,template:s});if(r.length===0)throw new TypeError("Template script must not be empty");let[n,...o]=r;return[n,o,{}]},Ca=({templates:e,expressions:t,tokens:r,index:n,template:o})=>{if(o===void 0)throw new TypeError(`Invalid backslash sequence: ${e.raw[n]}`);let{nextTokens:i,leadingWhitespaces:s,trailingWhitespaces:a}=Ba(o,e.raw[n]),c=an(r,i,s);if(n===t.length)return c;let f=t[n],l=Array.isArray(f)?f.map(d=>cn(d)):[cn(f)];return an(c,l,a)},Ba=(e,t)=>{if(t.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,o=sn.has(t[0]);for(let s=0,a=0;s<e.length;s+=1,a+=1){let c=t[a];if(sn.has(c))n!==s&&r.push(e.slice(n,s)),n=s+1;else if(c==="\\"){let f=t[a+1];f===`
|
|
3
|
+
`?(s-=1,a+=1):f==="u"&&t[a+2]==="{"?a=t.indexOf("}",a+3):a+=La[f]??1}}let i=n===e.length;return i||r.push(e.slice(n)),{nextTokens:r,leadingWhitespaces:o,trailingWhitespaces:i}},sn=new Set([" "," ","\r",`
|
|
4
|
+
`]),La={x:3,u:5},an=(e,t,r)=>r||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t[0]}`,...t.slice(1)],cn=e=>{let t=typeof e;if(t==="string")return e;if(t==="number")return String(e);if(y(e)&&("stdout"in e||"isMaxBuffer"in e))return Fa(e);throw e instanceof Ma||Object.prototype.toString.call(e)==="[object Promise]"?new TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):new TypeError(`Unexpected "${t}" in template expression`)},Fa=({stdout:e})=>{if(typeof e=="string")return e;if(b(e))return Le(e);throw e===void 0?new TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`):new TypeError(`Unexpected "${typeof e}" stdout in template expression`)};import{spawnSync as pp}from"child_process";import{debuglog as Pa}from"util";import kt from"process";var I=e=>Fe.includes(e),Fe=[kt.stdin,kt.stdout,kt.stderr],D=["stdin","stdout","stderr"],Pe=e=>D[e]??`stdio[${e}]`;var pn=e=>{let t={...e};for(let r of Wt)t[r]=Gt(e,r);return t},Gt=(e,t)=>{let r=Array.from({length:Ua(e)+1}),n=$a(e[t],r,t);return ka(n,t)},Ua=({stdio:e})=>Array.isArray(e)?Math.max(e.length,D.length):D.length,$a=(e,t,r)=>y(e)?Na(e,t,r):t.fill(e),Na=(e,t,r)=>{for(let n of Object.keys(e).sort(_a))for(let o of ja(n,r,t))t[o]=e[n];return t},_a=(e,t)=>dn(e)<dn(t)?1:-1,dn=e=>e==="stdout"||e==="stderr"?0:e==="all"?2:1,ja=(e,t,r)=>{if(e==="ipc")return[r.length-1];let n=zt(e);if(n===void 0||n===0)throw new TypeError(`"${t}.${e}" is invalid.
|
|
5
|
+
It must be "${t}.stdout", "${t}.stderr", "${t}.all", "${t}.ipc", or "${t}.fd3", "${t}.fd4" (and so on).`);if(n>=r.length)throw new TypeError(`"${t}.${e}" is invalid: that file descriptor does not exist.
|
|
6
|
+
Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},zt=e=>{if(e==="all")return e;if(D.includes(e))return D.indexOf(e);let t=va.exec(e);if(t!==null)return Number(t[1])},va=/^fd(\d+)$/,ka=(e,t)=>e.map(r=>r===void 0?za[t]:r),Ga=Pa("execa").enabled?"full":"none",za={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:Ga,stripFinalNewline:!0},Wt=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],_=(e,t)=>t==="ipc"?e.at(-1):e[t];var re=({verbose:e},t)=>Vt(e,t)!=="none",ne=({verbose:e},t)=>!["none","short"].includes(Vt(e,t)),mn=({verbose:e},t)=>{let r=Vt(e,t);return Ue(r)?r:void 0},Vt=(e,t)=>t===void 0?Wa(e):_(e,t),Wa=e=>e.find(t=>Ue(t))??$e.findLast(t=>e.includes(t)),Ue=e=>typeof e=="function",$e=["none","short","full"];import{inspect as pc}from"util";import{platform as Va}from"process";import{stripVTControlCharacters as Ya}from"util";var un=(e,t)=>{let r=[e,...t],n=r.join(" "),o=r.map(i=>Za(hn(i))).join(" ");return{command:n,escapedCommand:o}},ye=e=>Ya(e).split(`
|
|
7
|
+
`).map(t=>hn(t)).join(`
|
|
8
|
+
`),hn=e=>e.replaceAll(Ka,t=>Ha(t)),Ha=e=>{let t=Xa[e];if(t!==void 0)return t;let r=e.codePointAt(0),n=r.toString(16);return r<=Ja?`\\u${n.padStart(4,"0")}`:`\\U${n}`},qa=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},Ka=qa(),Xa={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},Ja=65535,Za=e=>Qa.test(e)?e:Va==="win32"?`"${e.replaceAll('"','""')}"`:`'${e.replaceAll("'","'\\''")}'`,Qa=/^[\w./-]+$/;import gn from"process";function Yt(){let{env:e}=gn,{TERM:t,TERM_PROGRAM:r}=e;return gn.platform!=="win32"?t!=="linux":!!e.WT_SESSION||!!e.TERMINUS_SUBLIME||e.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||t==="xterm-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Sn={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},yn={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},ec={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},tc={...Sn,...yn},rc={...Sn,...ec},nc=Yt(),oc=nc?tc:rc,Ne=oc,Wu=Object.entries(yn);import ic from"tty";var sc=ic?.WriteStream?.prototype?.hasColors?.()??!1,h=(e,t)=>{if(!sc)return o=>o;let r=`\x1B[${e}m`,n=`\x1B[${t}m`;return o=>{let i=o+"",s=i.indexOf(n);if(s===-1)return r+i+n;let a=r,c=0,l=(t===22?n:"")+r;for(;s!==-1;)a+=i.slice(c,s)+l,c=s+n.length,s=i.indexOf(n,c);return a+=i.slice(c)+n,a}},Hu=h(0,0),bn=h(1,22),qu=h(2,22),Ku=h(3,23),Xu=h(4,24),Ju=h(53,55),Zu=h(7,27),Qu=h(8,28),eh=h(9,29),th=h(30,39),rh=h(31,39),nh=h(32,39),oh=h(33,39),ih=h(34,39),sh=h(35,39),ah=h(36,39),ch=h(37,39),_e=h(90,39),lh=h(40,49),fh=h(41,49),dh=h(42,49),ph=h(43,49),mh=h(44,49),uh=h(45,49),hh=h(46,49),gh=h(47,49),Sh=h(100,49),wn=h(91,39),yh=h(92,39),xn=h(93,39),bh=h(94,39),wh=h(95,39),xh=h(96,39),Eh=h(97,39),Th=h(101,49),Oh=h(102,49),Dh=h(103,49),Ah=h(104,49),Ih=h(105,49),Rh=h(106,49),Mh=h(107,49);var On=({type:e,message:t,timestamp:r,piped:n,commandId:o,result:{failed:i=!1}={},options:{reject:s=!0}})=>{let a=ac(r),c=cc[e]({failed:i,reject:s,piped:n}),f=lc[e]({reject:s});return`${_e(`[${a}]`)} ${_e(`[${o}]`)} ${f(c)} ${f(t)}`},ac=e=>`${je(e.getHours(),2)}:${je(e.getMinutes(),2)}:${je(e.getSeconds(),2)}.${je(e.getMilliseconds(),3)}`,je=(e,t)=>String(e).padStart(t,"0"),En=({failed:e,reject:t})=>e?t?Ne.cross:Ne.warning:Ne.tick,cc={command:({piped:e})=>e?"|":"$",output:()=>" ",ipc:()=>"*",error:En,duration:En},Tn=e=>e,lc={command:()=>bn,output:()=>Tn,ipc:()=>Tn,error:({reject:e})=>e?wn:xn,duration:()=>_e};var Dn=(e,t,r)=>{let n=mn(t,r);return e.map(({verboseLine:o,verboseObject:i})=>fc(o,i,n)).filter(o=>o!==void 0).map(o=>dc(o)).join("")},fc=(e,t,r)=>{if(r===void 0)return e;let n=r(e,t);if(typeof n=="string")return n},dc=e=>e.endsWith(`
|
|
9
|
+
`)?e:`${e}
|
|
10
|
+
`;var B=({type:e,verboseMessage:t,fdNumber:r,verboseInfo:n,result:o})=>{let i=mc({type:e,result:o,verboseInfo:n}),s=uc(t,i),a=Dn(s,n,r);a!==""&&console.warn(a.slice(0,-1))},mc=({type:e,result:t,verboseInfo:{escapedCommand:r,commandId:n,rawOptions:{piped:o=!1,...i}}})=>({type:e,escapedCommand:r,commandId:`${n}`,timestamp:new Date,piped:o,result:t,options:i}),uc=(e,t)=>e.split(`
|
|
11
|
+
`).map(r=>hc({...t,message:r})),hc=e=>({verboseLine:On(e),verboseObject:e}),ve=e=>{let t=typeof e=="string"?e:pc(e);return ye(t).replaceAll(" "," ".repeat(gc))},gc=2;var An=(e,t)=>{re(t)&&B({type:"command",verboseMessage:e,verboseInfo:t})};var In=(e,t,r)=>{bc(e);let n=Sc(e);return{verbose:e,escapedCommand:t,commandId:n,rawOptions:r}},Sc=e=>re({verbose:e})?yc++:void 0,yc=0n,bc=e=>{for(let t of e){if(t===!1)throw new TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(t===!0)throw new TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!$e.includes(t)&&!Ue(t)){let r=$e.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${t}. Allowed values are: ${r} or a function.`)}}};import{hrtime as Rn}from"process";var ke=()=>Rn.bigint(),Ht=e=>Number(Rn.bigint()-e)/1e6;var Ge=(e,t,r)=>{let n=ke(),{command:o,escapedCommand:i}=un(e,t),s=Gt(r,"verbose"),a=In(s,i,{...r});return An(i,a),{command:o,escapedCommand:i,startTime:n,verboseInfo:a}};var vo=ba(wa(),1);import Cl from"path";import jo from"process";import We from"process";import q from"path";import{promisify as wc}from"util";import{execFile as xc,execFileSync as rg}from"child_process";import Mn from"path";import{fileURLToPath as Ec}from"url";var ig=wc(xc);function ze(e){return e instanceof URL?Ec(e):e}function Cn(e){return{*[Symbol.iterator](){let t=Mn.resolve(ze(e)),r;for(;r!==t;)yield t,r=t,t=Mn.resolve(t,"..")}}}var sg=10*1024*1024;var Tc=({cwd:e=We.cwd(),path:t=We.env[Nt()],preferLocal:r=!0,execPath:n=We.execPath,addExecPath:o=!0}={})=>{let i=q.resolve(ze(e)),s=[],a=t.split(q.delimiter);return r&&Oc(s,a,i),o&&Dc(s,a,n,i),t===""||t===q.delimiter?`${s.join(q.delimiter)}${t}`:[...s,t].join(q.delimiter)},Oc=(e,t,r)=>{for(let n of Cn(r)){let o=q.join(n,"node_modules/.bin");t.includes(o)||e.push(o)}},Dc=(e,t,r,n)=>{let o=q.resolve(n,ze(r),"..");t.includes(o)||e.push(o)},Bn=({env:e=We.env,...t}={})=>{e={...e};let r=Nt({env:e});return t.path=e[r],e[r]=Tc(t),e};import{setTimeout as vc}from"timers/promises";var Ln=(e,t,r)=>{let n=r?ie:oe,o=e instanceof R?{}:{cause:e};return new n(t,o)},R=class extends Error{},Fn=(e,t)=>{Object.defineProperty(e.prototype,"name",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,Un,{value:!0,writable:!1,enumerable:!1,configurable:!1})},Pn=e=>Ve(e)&&Un in e,Un=Symbol("isExecaError"),Ve=e=>Object.prototype.toString.call(e)==="[object Error]",oe=class extends Error{};Fn(oe,oe.name);var ie=class extends Error{};Fn(ie,ie.name);import{constants as be}from"os";import{constants as Mc}from"os";var $n=()=>{let e=_n-Nn+1;return Array.from({length:e},Ac)},Ac=(e,t)=>({name:`SIGRT${t+1}`,number:Nn+t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),Nn=34,_n=64;import{constants as Ic}from"os";var jn=[{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"}];var qt=()=>{let e=$n();return[...jn,...e].map(Rc)},Rc=({name:e,number:t,description:r,action:n,forced:o=!1,standard:i})=>{let{signals:{[e]:s}}=Ic,a=s!==void 0;return{name:e,number:a?s:t,description:r,supported:a,action:n,forced:o,standard:i}};var Cc=()=>{let e=qt();return Object.fromEntries(e.map(Bc))},Bc=({name:e,number:t,description:r,supported:n,action:o,forced:i,standard:s})=>[e,{name:e,number:t,description:r,supported:n,action:o,forced:i,standard:s}],vn=Cc(),Lc=()=>{let e=qt(),t=65,r=Array.from({length:t},(n,o)=>Fc(o,e));return Object.assign({},...r)},Fc=(e,t)=>{let r=Pc(e,t);if(r===void 0)return{};let{name:n,description:o,supported:i,action:s,forced:a,standard:c}=r;return{[e]:{name:n,number:e,description:o,supported:i,action:s,forced:a,standard:c}}},Pc=(e,t)=>{let r=t.find(({name:n})=>Mc.signals[n]===e);return r!==void 0?r:t.find(n=>n.number===e)},Tg=Lc();var Gn=e=>{let t="option `killSignal`";if(e===0)throw new TypeError(`Invalid ${t}: 0 cannot be used.`);return Wn(e,t)},zn=e=>e===0?e:Wn(e,"`subprocess.kill()`'s argument"),Wn=(e,t)=>{if(Number.isInteger(e))return Uc(e,t);if(typeof e=="string")return Nc(e,t);throw new TypeError(`Invalid ${t} ${String(e)}: it must be a string or an integer.
|
|
12
|
+
${Kt()}`)},Uc=(e,t)=>{if(kn.has(e))return kn.get(e);throw new TypeError(`Invalid ${t} ${e}: this signal integer does not exist.
|
|
13
|
+
${Kt()}`)},$c=()=>new Map(Object.entries(be.signals).reverse().map(([e,t])=>[t,e])),kn=$c(),Nc=(e,t)=>{if(e in be.signals)return e;throw e.toUpperCase()in be.signals?new TypeError(`Invalid ${t} '${e}': please rename it to '${e.toUpperCase()}'.`):new TypeError(`Invalid ${t} '${e}': this signal name does not exist.
|
|
14
|
+
${Kt()}`)},Kt=()=>`Available signal names: ${_c()}.
|
|
15
|
+
Available signal numbers: ${jc()}.`,_c=()=>Object.keys(be.signals).sort().map(e=>`'${e}'`).join(", "),jc=()=>[...new Set(Object.values(be.signals).sort((e,t)=>e-t))].join(", "),Ye=e=>vn[e].description;var Vn=e=>{if(e===!1)return e;if(e===!0)return kc;if(!Number.isFinite(e)||e<0)throw new TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},kc=1e3*5,Yn=({kill:e,options:{forceKillAfterDelay:t,killSignal:r},onInternalError:n,context:o,controller:i},s,a)=>{let{signal:c,error:f}=Gc(s,a,r);zc(f,n);let l=e(c);return Wc({kill:e,signal:c,forceKillAfterDelay:t,killSignal:r,killResult:l,context:o,controller:i}),l},Gc=(e,t,r)=>{let[n=r,o]=Ve(e)?[void 0,e]:[e,t];if(typeof n!="string"&&!Number.isInteger(n))throw new TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(n)}`);if(o!==void 0&&!Ve(o))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${o}`);return{signal:zn(n),error:o}},zc=(e,t)=>{e!==void 0&&t.reject(e)},Wc=async({kill:e,signal:t,forceKillAfterDelay:r,killSignal:n,killResult:o,context:i,controller:s})=>{t===n&&o&&Xt({kill:e,forceKillAfterDelay:r,context:i,controllerSignal:s.signal})},Xt=async({kill:e,forceKillAfterDelay:t,context:r,controllerSignal:n})=>{if(t!==!1)try{await vc(t,void 0,{signal:n}),e("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}};import{once as Vc}from"events";var He=async(e,t)=>{e.aborted||await Vc(e,"abort",{signal:t})};var Hn=({cancelSignal:e})=>{if(e!==void 0&&Object.prototype.toString.call(e)!=="[object AbortSignal]")throw new Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(e)}`)},qn=({subprocess:e,cancelSignal:t,gracefulCancel:r,context:n,controller:o})=>t===void 0||r?[]:[Yc(e,t,n,o)],Yc=async(e,t,r,{signal:n})=>{throw await He(t,n),r.terminationReason??="cancel",e.kill(),t.reason};import{scheduler as ml}from"timers/promises";import{promisify as fl}from"util";var se=({methodName:e,isSubprocess:t,ipc:r,isConnected:n})=>{Hc(e,t,r),Jt(e,t,n)},Hc=(e,t,r)=>{if(!r)throw new Error(`${M(e,t)} can only be used if the \`ipc\` option is \`true\`.`)},Jt=(e,t,r)=>{if(!r)throw new Error(`${M(e,t)} cannot be used: the ${z(t)} has already exited or disconnected.`)},Kn=e=>{throw new Error(`${M("getOneMessage",e)} could not complete: the ${z(e)} exited or disconnected.`)},Xn=e=>{throw new Error(`${M("sendMessage",e)} failed: the ${z(e)} is sending a message too, instead of listening to incoming messages.
|
|
16
|
+
This can be fixed by both sending a message and listening to incoming messages at the same time:
|
|
17
|
+
|
|
18
|
+
const [receivedMessage] = await Promise.all([
|
|
19
|
+
${M("getOneMessage",e)},
|
|
20
|
+
${M("sendMessage",e,"message, {strict: true}")},
|
|
21
|
+
]);`)},qe=(e,t)=>new Error(`${M("sendMessage",t)} failed when sending an acknowledgment response to the ${z(t)}.`,{cause:e}),Jn=e=>{throw new Error(`${M("sendMessage",e)} failed: the ${z(e)} is not listening to incoming messages.`)},Zn=e=>{throw new Error(`${M("sendMessage",e)} failed: the ${z(e)} exited without listening to incoming messages.`)},Qn=()=>new Error(`\`cancelSignal\` aborted: the ${z(!0)} disconnected.`),eo=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},to=({error:e,methodName:t,isSubprocess:r})=>{if(e.code==="EPIPE")throw new Error(`${M(t,r)} cannot be used: the ${z(r)} is disconnecting.`,{cause:e})},ro=({error:e,methodName:t,isSubprocess:r,message:n})=>{if(qc(e))throw new Error(`${M(t,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:e})},qc=({code:e,message:t})=>Kc.has(e)||Xc.some(r=>t.includes(r)),Kc=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),Xc=["could not be cloned","circular structure","call stack size exceeded"],M=(e,t,r="")=>e==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${Jc(t)}${e}(${r})`,Jc=e=>e?"":"subprocess.",z=e=>e?"parent process":"subprocess",ae=e=>{e.connected&&e.disconnect()};var L=()=>{let e={},t=new Promise((r,n)=>{Object.assign(e,{resolve:r,reject:n})});return Object.assign(t,e)};var Xe=(e,t="stdin")=>{let{options:n,fileDescriptors:o}=F.get(e),i=no(o,t,!0),s=e.stdio[i];if(s===null)throw new TypeError(oo(i,t,n,!0));return s},ce=(e,t="stdout")=>{let{options:n,fileDescriptors:o}=F.get(e),i=no(o,t,!1),s=i==="all"?e.all:e.stdio[i];if(s==null)throw new TypeError(oo(i,t,n,!1));return s},F=new WeakMap,no=(e,t,r)=>{let n=Zc(t,r);return Qc(n,t,r,e),n},Zc=(e,t)=>{let r=zt(e);if(r!==void 0)return r;let{validOptions:n,defaultValue:o}=t?{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw new TypeError(`"${we(t)}" must not be "${e}".
|
|
22
|
+
It must be ${n} or "fd3", "fd4" (and so on).
|
|
23
|
+
It is optional and defaults to "${o}".`)},Qc=(e,t,r,n)=>{let o=n[io(e)];if(o===void 0)throw new TypeError(`"${we(r)}" must not be ${t}. That file descriptor does not exist.
|
|
24
|
+
Please set the "stdio" option to ensure that file descriptor exists.`);if(o.direction==="input"&&!r)throw new TypeError(`"${we(r)}" must not be ${t}. It must be a readable stream, not writable.`);if(o.direction!=="input"&&r)throw new TypeError(`"${we(r)}" must not be ${t}. It must be a writable stream, not readable.`)},oo=(e,t,r,n)=>{if(e==="all"&&!r.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:o,optionValue:i}=el(e,r);return`The "${o}: ${Ke(i)}" option is incompatible with using "${we(n)}: ${Ke(t)}".
|
|
25
|
+
Please set this option with "pipe" instead.`},el=(e,{stdin:t,stdout:r,stderr:n,stdio:o})=>{let i=io(e);return i===0&&t!==void 0?{optionName:"stdin",optionValue:t}:i===1&&r!==void 0?{optionName:"stdout",optionValue:r}:i===2&&n!==void 0?{optionName:"stderr",optionValue:n}:{optionName:`stdio[${i}]`,optionValue:o[i]}},io=e=>e==="all"?1:e,we=e=>e?"to":"from",Ke=e=>typeof e=="string"?`'${e}'`:typeof e=="number"?`${e}`:"Stream";import{once as sl}from"events";import{addAbortListener as tl}from"events";var K=(e,t,r)=>{let n=e.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(e.setMaxListeners(n+t),tl(r,()=>{e.setMaxListeners(e.getMaxListeners()-t)}))};import{EventEmitter as ol}from"events";import{once as rl}from"events";import{scheduler as nl}from"timers/promises";var Je=(e,t)=>{t&&Zt(e)},Zt=e=>{e.refCounted()},Ze=(e,t)=>{t&&Qt(e)},Qt=e=>{e.unrefCounted()},so=(e,t)=>{t&&(Qt(e),Qt(e))},ao=(e,t)=>{t&&(Zt(e),Zt(e))};var co=async({anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:n},o)=>{if(po(o)||uo(o))return;Qe.has(e)||Qe.set(e,[]);let i=Qe.get(e);if(i.push(o),!(i.length>1))for(;i.length>0;){await mo(e,n,o),await nl.yield();let s=await fo({wrappedMessage:i[0],anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:n});i.shift(),n.emit("message",s),n.emit("message:done")}},lo=async({anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:n,boundOnMessage:o})=>{er();let i=Qe.get(e);for(;i?.length>0;)await rl(n,"message:done");e.removeListener("message",o),ao(t,r),n.connected=!1,n.emit("disconnect")},Qe=new WeakMap;var W=(e,t,r)=>{if(et.has(e))return et.get(e);let n=new ol;return n.connected=!0,et.set(e,n),il({ipcEmitter:n,anyProcess:e,channel:t,isSubprocess:r}),n},et=new WeakMap,il=({ipcEmitter:e,anyProcess:t,channel:r,isSubprocess:n})=>{let o=co.bind(void 0,{anyProcess:t,channel:r,isSubprocess:n,ipcEmitter:e});t.on("message",o),t.once("disconnect",lo.bind(void 0,{anyProcess:t,channel:r,isSubprocess:n,ipcEmitter:e,boundOnMessage:o})),so(r,n)},tt=e=>{let t=et.get(e);return t===void 0?e.channel!==null:t.connected};var ho=({anyProcess:e,channel:t,isSubprocess:r,message:n,strict:o})=>{if(!o)return n;let i=W(e,t,r),s=ot(e,i);return{id:al++,type:nt,message:n,hasListeners:s}},al=0n,go=(e,t)=>{if(!(t?.type!==nt||t.hasListeners))for(let{id:r}of e)r!==void 0&&rt[r].resolve({isDeadlock:!0,hasListeners:!1})},fo=async({wrappedMessage:e,anyProcess:t,channel:r,isSubprocess:n,ipcEmitter:o})=>{if(e?.type!==nt||!t.connected)return e;let{id:i,message:s}=e,a={id:i,type:yo,message:ot(t,o)};try{await it({anyProcess:t,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){o.emit("strict:error",c)}return s},po=e=>{if(e?.type!==yo)return!1;let{id:t,message:r}=e;return rt[t]?.resolve({isDeadlock:!1,hasListeners:r}),!0},So=async(e,t,r)=>{if(e?.type!==nt)return;let n=L();rt[e.id]=n;let o=new AbortController;try{let{isDeadlock:i,hasListeners:s}=await Promise.race([n,cl(t,r,o)]);i&&Xn(r),s||Jn(r)}finally{o.abort(),delete rt[e.id]}},rt={},cl=async(e,t,{signal:r})=>{K(e,1,r),await sl(e,"disconnect",{signal:r}),Zn(t)},nt="execa:ipc:request",yo="execa:ipc:response";var bo=(e,t,r)=>{xe.has(e)||xe.set(e,new Set);let n=xe.get(e),o=L(),i=r?t.id:void 0,s={onMessageSent:o,id:i};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},wo=({outgoingMessages:e,outgoingMessage:t})=>{e.delete(t),t.onMessageSent.resolve()},mo=async(e,t,r)=>{for(;!ot(e,t)&&xe.get(e)?.size>0;){let n=[...xe.get(e)];go(n,r),await Promise.all(n.map(({onMessageSent:o})=>o))}},xe=new WeakMap,ot=(e,t)=>t.listenerCount("message")>ll(e),ll=e=>F.has(e)&&!_(F.get(e).options.buffer,"ipc")?1:0;var it=({anyProcess:e,channel:t,isSubprocess:r,ipc:n},o,{strict:i=!1}={})=>{let s="sendMessage";return se({methodName:s,isSubprocess:r,ipc:n,isConnected:e.connected}),dl({anyProcess:e,channel:t,methodName:s,isSubprocess:r,message:o,strict:i})},dl=async({anyProcess:e,channel:t,methodName:r,isSubprocess:n,message:o,strict:i})=>{let s=ho({anyProcess:e,channel:t,isSubprocess:n,message:o,strict:i}),a=bo(e,s,i);try{await rr({anyProcess:e,methodName:r,isSubprocess:n,wrappedMessage:s,message:o})}catch(c){throw ae(e),c}finally{wo(a)}},rr=async({anyProcess:e,methodName:t,isSubprocess:r,wrappedMessage:n,message:o})=>{let i=pl(e);try{await Promise.all([So(n,e,r),i(n)])}catch(s){throw to({error:s,methodName:t,isSubprocess:r}),ro({error:s,methodName:t,isSubprocess:r,message:o}),s}},pl=e=>{if(tr.has(e))return tr.get(e);let t=fl(e.send.bind(e));return tr.set(e,t),t},tr=new WeakMap;var Eo=(e,t)=>{let r="cancelSignal";return Jt(r,!1,e.connected),rr({anyProcess:e,methodName:r,isSubprocess:!1,wrappedMessage:{type:Oo,message:t},message:t})},To=async({anyProcess:e,channel:t,isSubprocess:r,ipc:n})=>(await ul({anyProcess:e,channel:t,isSubprocess:r,ipc:n}),nr.signal),ul=async({anyProcess:e,channel:t,isSubprocess:r,ipc:n})=>{if(!xo){if(xo=!0,!n){eo();return}if(t===null){er();return}W(e,t,r),await ml.yield()}},xo=!1,uo=e=>e?.type!==Oo?!1:(nr.abort(e.message),!0),Oo="execa:ipc:cancel",er=()=>{nr.abort(Qn())},nr=new AbortController;var Do=({gracefulCancel:e,cancelSignal:t,ipc:r,serialization:n})=>{if(e){if(t===void 0)throw new Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!r)throw new Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(n==="json")throw new Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")}},Ao=({subprocess:e,cancelSignal:t,gracefulCancel:r,forceKillAfterDelay:n,context:o,controller:i})=>r?[hl({subprocess:e,cancelSignal:t,forceKillAfterDelay:n,context:o,controller:i})]:[],hl=async({subprocess:e,cancelSignal:t,forceKillAfterDelay:r,context:n,controller:{signal:o}})=>{await He(t,o);let i=gl(t);throw await Eo(e,i),Xt({kill:e.kill,forceKillAfterDelay:r,context:n,controllerSignal:o}),n.terminationReason??="gracefulCancel",t.reason},gl=({reason:e})=>{if(!(e instanceof DOMException))return e;let t=new Error(e.message);return Object.defineProperty(t,"stack",{value:e.stack,enumerable:!1,configurable:!0,writable:!0}),t};import{setTimeout as Sl}from"timers/promises";var Io=({timeout:e})=>{if(e!==void 0&&(!Number.isFinite(e)||e<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`)},Ro=(e,t,r,n)=>t===0||t===void 0?[]:[yl(e,t,r,n)],yl=async(e,t,r,{signal:n})=>{throw await Sl(t,void 0,{signal:n}),r.terminationReason??="timeout",e.kill(),new R};import{execPath as bl,execArgv as wl}from"process";import Mo from"path";var Co=({options:e})=>{if(e.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...e,node:!0}}},Bo=(e,t,{node:r=!1,nodePath:n=bl,nodeOptions:o=wl.filter(c=>!c.startsWith("--inspect")),cwd:i,execPath:s,...a})=>{if(s!==void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');let c=te(n,'The "nodePath" option'),f=Mo.resolve(i,c),l={...a,nodePath:f,node:r,cwd:i};if(!r)return[e,t,l];if(Mo.basename(e,".exe")==="node")throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');return[f,[...o,e,...t],{ipc:!0,...l,shell:!1}]};import{serialize as xl}from"v8";var Lo=({ipcInput:e,ipc:t,serialization:r})=>{if(e!==void 0){if(!t)throw new Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");Ol[r](e)}},El=e=>{try{xl(e)}catch(t){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:t})}},Tl=e=>{try{JSON.stringify(e)}catch(t){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:t})}},Ol={advanced:El,json:Tl},Fo=async(e,t)=>{t!==void 0&&await e.sendMessage(t)};var Uo=({encoding:e})=>{if(or.has(e))return;let t=Al(e);if(t!==void 0)throw new TypeError(`Invalid option \`encoding: ${st(e)}\`.
|
|
26
|
+
Please rename it to ${st(t)}.`);let r=[...or].map(n=>st(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${st(e)}\`.
|
|
27
|
+
Please rename it to one of: ${r}.`)},Dl=new Set(["utf8","utf16le"]),T=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),or=new Set([...Dl,...T]),Al=e=>{if(e===null)return"buffer";if(typeof e!="string")return;let t=e.toLowerCase();if(t in Po)return Po[t];if(or.has(t))return t},Po={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},st=e=>typeof e=="string"?`"${e}"`:String(e);import{statSync as Il}from"fs";import Rl from"path";import Ml from"process";var $o=(e=No())=>{let t=te(e,'The "cwd" option');return Rl.resolve(t)},No=()=>{try{return Ml.cwd()}catch(e){throw e.message=`The current directory does not exist.
|
|
28
|
+
${e.message}`,e}},_o=(e,t)=>{if(t===No())return e;let r;try{r=Il(t)}catch(n){return`The "cwd" option is invalid: ${t}.
|
|
29
|
+
${n.message}
|
|
30
|
+
${e}`}return r.isDirectory()?e:`The "cwd" option is not a directory: ${t}.
|
|
31
|
+
${e}`};var at=(e,t,r)=>{r.cwd=$o(r.cwd);let[n,o,i]=Bo(e,t,r),{command:s,args:a,options:c}=vo.default._parse(n,o,i),f=pn(c),l=Bl(f);return Io(l),Uo(l),Lo(l),Hn(l),Do(l),l.shell=jt(l.shell),l.env=Ll(l),l.killSignal=Gn(l.killSignal),l.forceKillAfterDelay=Vn(l.forceKillAfterDelay),l.lines=l.lines.map((d,p)=>d&&!T.has(l.encoding)&&l.buffer[p]),jo.platform==="win32"&&Cl.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:l}},Bl=({extendEnv:e=!0,preferLocal:t=!1,cwd:r,localDir:n=r,encoding:o="utf8",reject:i=!0,cleanup:s=!0,all:a=!1,windowsHide:c=!0,killSignal:f="SIGTERM",forceKillAfterDelay:l=!0,gracefulCancel:d=!1,ipcInput:p,ipc:m=p!==void 0||d,serialization:u="advanced",...g})=>({...g,extendEnv:e,preferLocal:t,cwd:r,localDirectory:n,encoding:o,reject:i,cleanup:s,all:a,windowsHide:c,killSignal:f,forceKillAfterDelay:l,gracefulCancel:d,ipcInput:p,ipc:m,serialization:u}),Ll=({env:e,extendEnv:t,preferLocal:r,node:n,localDirectory:o,nodePath:i})=>{let s=t?{...jo.env,...e}:e;return r||n?Bn({env:s,cwd:o,execPath:i,preferLocal:r,addExecPath:n}):s};var ct=(e,t,r)=>r.shell&&t.length>0?[[e,...t].join(" "),[],r]:[e,t,r];import{inspect as mf}from"util";function le(e){if(typeof e=="string")return Fl(e);if(!(ArrayBuffer.isView(e)&&e.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return Pl(e)}var Fl=e=>e.at(-1)===ko?e.slice(0,e.at(-2)===Go?-2:-1):e,Pl=e=>e.at(-1)===Ul?e.subarray(0,e.at(-2)===$l?-2:-1):e,ko=`
|
|
32
|
+
`,Ul=ko.codePointAt(0),Go="\r",$l=Go.codePointAt(0);import{on as lf}from"events";import{finished as ff}from"stream/promises";function C(e,{checkOpen:t=!0}={}){return e!==null&&typeof e=="object"&&(e.writable||e.readable||!t||e.writable===void 0&&e.readable===void 0)&&typeof e.pipe=="function"}function ir(e,{checkOpen:t=!0}={}){return C(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 X(e,{checkOpen:t=!0}={}){return C(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 sr(e,t){return ir(e,t)&&X(e,t)}var Nl=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),ar=class{#e;#o;#r=!1;#t=void 0;constructor(t,r){this.#e=t,this.#o=r}next(){let t=()=>this.#i();return this.#t=this.#t?this.#t.then(t,t):t(),this.#t}return(t){let r=()=>this.#n(t);return this.#t?this.#t.then(r,r):r()}async#i(){if(this.#r)return{done:!0,value:void 0};let t;try{t=await this.#e.read()}catch(r){throw this.#t=void 0,this.#r=!0,this.#e.releaseLock(),r}return t.done&&(this.#t=void 0,this.#r=!0,this.#e.releaseLock()),t}async#n(t){if(this.#r)return{done:!0,value:t};if(this.#r=!0,!this.#o){let r=this.#e.cancel(t);return this.#e.releaseLock(),await r,{done:!0,value:t}}return this.#e.releaseLock(),{done:!0,value:t}}},cr=Symbol();function zo(){return this[cr].next()}Object.defineProperty(zo,"name",{value:"next"});function Wo(e){return this[cr].return(e)}Object.defineProperty(Wo,"name",{value:"return"});var _l=Object.create(Nl,{next:{enumerable:!0,configurable:!0,writable:!0,value:zo},return:{enumerable:!0,configurable:!0,writable:!0,value:Wo}});function lr({preventCancel:e=!1}={}){let t=this.getReader(),r=new ar(t,e),n=Object.create(_l);return n[cr]=r,n}var Vo=e=>{if(X(e,{checkOpen:!1})&&Ee.on!==void 0)return vl(e);if(typeof e?.[Symbol.asyncIterator]=="function")return e;if(jl.call(e)==="[object ReadableStream]")return lr.call(e);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:jl}=Object.prototype,vl=async function*(e){let t=new AbortController,r={};kl(e,t,r);try{for await(let[n]of Ee.on(e,"data",{signal:t.signal}))yield n}catch(n){if(r.error!==void 0)throw r.error;if(!t.signal.aborted)throw n}finally{e.destroy()}},kl=async(e,t,r)=>{try{await Ee.finished(e,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{t.abort()}},Ee={};var fe=async(e,{init:t,convertChunk:r,getSize:n,truncateChunk:o,addChunk:i,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let f=Vo(e),l=t();l.length=0;try{for await(let d of f){let p=zl(d),m=r[p](d,l);qo({convertedChunk:m,state:l,getSize:n,truncateChunk:o,addChunk:i,maxBuffer:c})}return Gl({state:l,convertChunk:r,getSize:n,truncateChunk:o,addChunk:i,getFinalChunk:s,maxBuffer:c}),a(l)}catch(d){let p=typeof d=="object"&&d!==null?d:new Error(d);throw p.bufferedData=a(l),p}},Gl=({state:e,getSize:t,truncateChunk:r,addChunk:n,getFinalChunk:o,maxBuffer:i})=>{let s=o(e);s!==void 0&&qo({convertedChunk:s,state:e,getSize:t,truncateChunk:r,addChunk:n,maxBuffer:i})},qo=({convertedChunk:e,state:t,getSize:r,truncateChunk:n,addChunk:o,maxBuffer:i})=>{let s=r(e),a=t.length+s;if(a<=i){Yo(e,t,o,a);return}let c=n(e,i-t.length);throw c!==void 0&&Yo(c,t,o,i),new P},Yo=(e,t,r,n)=>{t.contents=r(e,t,n),t.length=n},zl=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 r=Ho.call(e);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(e.byteLength)&&Number.isInteger(e.byteOffset)&&Ho.call(e.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:Ho}=Object.prototype,P=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}};var j=e=>e,Te=()=>{},lt=({contents:e})=>e,ft=e=>{throw new Error(`Streams in object mode are not supported: ${String(e)}`)},dt=e=>e.length;async function pt(e,t){return fe(e,Hl,t)}var Wl=()=>({contents:[]}),Vl=()=>1,Yl=(e,{contents:t})=>(t.push(e),t),Hl={init:Wl,convertChunk:{string:j,buffer:j,arrayBuffer:j,dataView:j,typedArray:j,others:j},getSize:Vl,truncateChunk:Te,addChunk:Yl,getFinalChunk:Te,finalize:lt};async function mt(e,t){return fe(e,rf,t)}var ql=()=>({contents:new ArrayBuffer(0)}),Kl=e=>Xl.encode(e),Xl=new TextEncoder,Ko=e=>new Uint8Array(e),Xo=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),Jl=(e,t)=>e.slice(0,t),Zl=(e,{contents:t,length:r},n)=>{let o=Qo()?ef(t,n):Ql(t,n);return new Uint8Array(o).set(e,r),o},Ql=(e,t)=>{if(t<=e.byteLength)return e;let r=new ArrayBuffer(Zo(t));return new Uint8Array(r).set(new Uint8Array(e),0),r},ef=(e,t)=>{if(t<=e.maxByteLength)return e.resize(t),e;let r=new ArrayBuffer(t,{maxByteLength:Zo(t)});return new Uint8Array(r).set(new Uint8Array(e),0),r},Zo=e=>Jo**Math.ceil(Math.log(e)/Math.log(Jo)),Jo=2,tf=({contents:e,length:t})=>Qo()?e:e.slice(0,t),Qo=()=>"resize"in ArrayBuffer.prototype,rf={init:ql,convertChunk:{string:Kl,buffer:Ko,arrayBuffer:Ko,dataView:Xo,typedArray:Xo,others:ft},getSize:dt,truncateChunk:Jl,addChunk:Zl,getFinalChunk:Te,finalize:tf};async function ht(e,t){return fe(e,cf,t)}var nf=()=>({contents:"",textDecoder:new TextDecoder}),ut=(e,{textDecoder:t})=>t.decode(e,{stream:!0}),of=(e,{contents:t})=>t+e,sf=(e,t)=>e.slice(0,t),af=({textDecoder:e})=>{let t=e.decode();return t===""?void 0:t},cf={init:nf,convertChunk:{string:j,buffer:ut,arrayBuffer:ut,dataView:ut,typedArray:ut,others:ft},getSize:dt,truncateChunk:sf,addChunk:of,getFinalChunk:af,finalize:lt};Object.assign(Ee,{on:lf,finished:ff});var ei=({error:e,stream:t,readableObjectMode:r,lines:n,encoding:o,fdNumber:i})=>{if(!(e instanceof P))throw e;if(i==="all")return e;let s=df(r,n,o);throw e.maxBufferInfo={fdNumber:i,unit:s},t.destroy(),e},df=(e,t,r)=>e?"objects":t?"lines":r==="buffer"?"bytes":"characters",ti=(e,t,r)=>{if(t.length!==r)return;let n=new P;throw n.maxBufferInfo={fdNumber:"ipc"},n},ri=(e,t)=>{let{streamName:r,threshold:n,unit:o}=pf(e,t);return`Command's ${r} was larger than ${n} ${o}`},pf=(e,t)=>{if(e?.maxBufferInfo===void 0)return{streamName:"output",threshold:t[1],unit:"bytes"};let{maxBufferInfo:{fdNumber:r,unit:n}}=e;delete e.maxBufferInfo;let o=_(t,r);return r==="ipc"?{streamName:"IPC output",threshold:o,unit:"messages"}:{streamName:Pe(r),threshold:o,unit:n}},ni=(e,t,r)=>e?.code==="ENOBUFS"&&t!==null&&t.some(n=>n!==null&&n.length>gt(r)),oi=(e,t,r)=>{if(!t)return e;let n=gt(r);return e.length>n?e.slice(0,n):e},gt=([,e])=>e;var si=({stdio:e,all:t,ipcOutput:r,originalError:n,signal:o,signalDescription:i,exitCode:s,escapedCommand:a,timedOut:c,isCanceled:f,isGracefullyCanceled:l,isMaxBuffer:d,isForcefullyTerminated:p,forceKillAfterDelay:m,killSignal:u,maxBuffer:g,timeout:w,cwd:S})=>{let x=n?.code,E=uf({originalError:n,timedOut:c,timeout:w,isMaxBuffer:d,maxBuffer:g,errorCode:x,signal:o,signalDescription:i,exitCode:s,isCanceled:f,isGracefullyCanceled:l,isForcefullyTerminated:p,forceKillAfterDelay:m,killSignal:u}),O=gf(n,S),$=O===void 0?"":`
|
|
33
|
+
${O}`,k=`${E}: ${a}${$}`,H=t===void 0?[e[2],e[1]]:[t],ee=[k,...H,...e.slice(3),r.map(G=>Sf(G)).join(`
|
|
34
|
+
`)].map(G=>ye(le(yf(G)))).filter(Boolean).join(`
|
|
35
|
+
|
|
36
|
+
`);return{originalMessage:O,shortMessage:k,message:ee}},uf=({originalError:e,timedOut:t,timeout:r,isMaxBuffer:n,maxBuffer:o,errorCode:i,signal:s,signalDescription:a,exitCode:c,isCanceled:f,isGracefullyCanceled:l,isForcefullyTerminated:d,forceKillAfterDelay:p,killSignal:m})=>{let u=hf(d,p);return t?`Command timed out after ${r} milliseconds${u}`:l?s===void 0?`Command was gracefully canceled with exit code ${c}`:d?`Command was gracefully canceled${u}`:`Command was gracefully canceled with ${s} (${a})`:f?`Command was canceled${u}`:n?`${ri(e,o)}${u}`:i!==void 0?`Command failed with ${i}${u}`:d?`Command was killed with ${m} (${Ye(m)})${u}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},hf=(e,t)=>e?` and was forcefully terminated after ${t} milliseconds`:"",gf=(e,t)=>{if(e instanceof R)return;let r=Pn(e)?e.originalMessage:String(e?.message??e),n=ye(_o(r,t));return n===""?void 0:n},Sf=e=>typeof e=="string"?e:mf(e),yf=e=>Array.isArray(e)?e.map(t=>le(ii(t))).filter(Boolean).join(`
|
|
37
|
+
`):ii(e),ii=e=>typeof e=="string"?e:b(e)?Le(e):"";var St=({command:e,escapedCommand:t,stdio:r,all:n,ipcOutput:o,options:{cwd:i},startTime:s})=>ai({command:e,escapedCommand:t,cwd:i,durationMs:Ht(s),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:r[1],stderr:r[2],all:n,stdio:r,ipcOutput:o,pipedFrom:[]}),de=({error:e,command:t,escapedCommand:r,fileDescriptors:n,options:o,startTime:i,isSync:s})=>Oe({error:e,command:t,escapedCommand:r,startTime:i,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:n.length}),ipcOutput:[],options:o,isSync:s}),Oe=({error:e,command:t,escapedCommand:r,startTime:n,timedOut:o,isCanceled:i,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:f,signal:l,stdio:d,all:p,ipcOutput:m,options:{timeoutDuration:u,timeout:g=u,forceKillAfterDelay:w,killSignal:S,cwd:x,maxBuffer:E},isSync:O})=>{let{exitCode:$,signal:k,signalDescription:H}=wf(f,l),{originalMessage:ee,shortMessage:G,message:$t}=si({stdio:d,all:p,ipcOutput:m,originalError:e,signal:k,signalDescription:H,exitCode:$,escapedCommand:r,timedOut:o,isCanceled:i,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:w,killSignal:S,maxBuffer:E,timeout:g,cwd:x}),ge=Ln(e,$t,O);return Object.assign(ge,bf({error:ge,command:t,escapedCommand:r,startTime:n,timedOut:o,isCanceled:i,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:$,signal:k,signalDescription:H,stdio:d,all:p,ipcOutput:m,cwd:x,originalMessage:ee,shortMessage:G})),ge},bf=({error:e,command:t,escapedCommand:r,startTime:n,timedOut:o,isCanceled:i,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:f,signal:l,signalDescription:d,stdio:p,all:m,ipcOutput:u,cwd:g,originalMessage:w,shortMessage:S})=>ai({shortMessage:S,originalMessage:w,command:t,escapedCommand:r,cwd:g,durationMs:Ht(n),failed:!0,timedOut:o,isCanceled:i,isGracefullyCanceled:s,isTerminated:l!==void 0,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:f,signal:l,signalDescription:d,code:e.cause?.code,stdout:p[1],stderr:p[2],all:m,stdio:p,ipcOutput:u,pipedFrom:[]}),ai=e=>Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0)),wf=(e,t)=>{let r=e===null?void 0:e,n=t===null?void 0:t,o=n===void 0?void 0:Ye(t);return{exitCode:r,signal:n,signalDescription:o}};var ci=e=>Number.isFinite(e)?e:0;function xf(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(ci(e*1e3)%1e3),nanoseconds:Math.trunc(ci(e*1e6)%1e3)}}function Ef(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 fr(e){switch(typeof e){case"number":{if(Number.isFinite(e))return xf(e);break}case"bigint":return Ef(e)}throw new TypeError("Expected a finite number or bigint")}var Tf=e=>e===0||e===0n,Of=(e,t)=>t===1||t===1n?e:`${e}s`,Df=1e-7,Af=24n*60n*60n*1000n;function dr(e,t){let r=typeof e=="bigint";if(!r&&!Number.isFinite(e))throw new TypeError("Expected a finite number or bigint");t={...t};let n=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 o=[],i=(l,d)=>{let p=Math.floor(l*10**d+Df);return(Math.round(p)/10**d).toFixed(d)},s=(l,d,p,m)=>{if(!((o.length===0||!t.colonNotation)&&Tf(l)&&!(t.colonNotation&&p==="m"))){if(m??=String(l),t.colonNotation){let u=m.includes(".")?m.split(".")[0].length:m.length,g=o.length>0?2:1;m="0".repeat(Math.max(0,g-u))+m}else m+=t.verbose?" "+Of(d,l):p;o.push(m)}},a=fr(e),c=BigInt(a.days);if(t.hideYearAndDays?s(BigInt(c)*24n+BigInt(a.hours),"hour","h"):(t.hideYear?s(c,"day","d"):(s(c/365n,"year","y"),s(c%365n,"day","d")),s(Number(a.hours),"hour","h")),s(Number(a.minutes),"minute","m"),!t.hideSeconds)if(t.separateMilliseconds||t.formatSubMilliseconds||!t.colonNotation&&e<1e3&&!t.subSecondsAsDecimals){let l=Number(a.seconds),d=Number(a.milliseconds),p=Number(a.microseconds),m=Number(a.nanoseconds);if(s(l,"second","s"),t.formatSubMilliseconds)s(d,"millisecond","ms"),s(p,"microsecond","\xB5s"),s(m,"nanosecond","ns");else{let u=d+p/1e3+m/1e6,g=typeof t.millisecondsDecimalDigits=="number"?t.millisecondsDecimalDigits:0,w=u>=1?Math.round(u):Math.ceil(u),S=g?u.toFixed(g):w;s(Number.parseFloat(S),"millisecond","ms",S)}}else{let l=(r?Number(e%Af):e)/1e3%60,d=typeof t.secondsDecimalDigits=="number"?t.secondsDecimalDigits:1,p=i(l,d),m=t.keepDecimalsOnWholeSeconds?p:p.replace(/\.0+$/,"");s(Number.parseFloat(m),"second","s",m)}if(o.length===0)return n+"0"+(t.verbose?" milliseconds":"ms");let f=t.colonNotation?":":" ";return typeof t.unitCount=="number"&&(o=o.slice(0,Math.max(t.unitCount,1))),n+o.join(f)}var li=(e,t)=>{e.failed&&B({type:"error",verboseMessage:e.shortMessage,verboseInfo:t,result:e})};var fi=(e,t)=>{re(t)&&(li(e,t),If(e,t))},If=(e,t)=>{let r=`(done in ${dr(e.durationMs)})`;B({type:"duration",verboseMessage:r,verboseInfo:t,result:e})};var pe=(e,t,{reject:r})=>{if(fi(e,t),e.failed&&r)throw e;return e};import{readFileSync as Ni}from"fs";var mi=(e,t)=>J(e)?"asyncGenerator":gi(e)?"generator":yt(e)?"fileUrl":Lf(e)?"filePath":Uf(e)?"webStream":C(e,{checkOpen:!1})?"native":b(e)?"uint8Array":$f(e)?"asyncIterable":Nf(e)?"iterable":ur(e)?ui({transform:e},t):Bf(e)?Rf(e,t):"native",Rf=(e,t)=>sr(e.transform,{checkOpen:!1})?Mf(e,t):ur(e.transform)?ui(e,t):Cf(e,t),Mf=(e,t)=>(hi(e,t,"Duplex stream"),"duplex"),ui=(e,t)=>(hi(e,t,"web TransformStream"),"webTransform"),hi=({final:e,binary:t,objectMode:r},n,o)=>{di(e,`${n}.final`,o),di(t,`${n}.binary`,o),pr(r,`${n}.objectMode`)},di=(e,t,r)=>{if(e!==void 0)throw new TypeError(`The \`${t}\` option can only be defined when using a generator, not a ${r}.`)},Cf=({transform:e,final:t,binary:r,objectMode:n},o)=>{if(e!==void 0&&!pi(e))throw new TypeError(`The \`${o}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(sr(t,{checkOpen:!1}))throw new TypeError(`The \`${o}.final\` option must not be a Duplex stream.`);if(ur(t))throw new TypeError(`The \`${o}.final\` option must not be a web TransformStream.`);if(t!==void 0&&!pi(t))throw new TypeError(`The \`${o}.final\` option must be a generator.`);return pr(r,`${o}.binary`),pr(n,`${o}.objectMode`),J(e)||J(t)?"asyncGenerator":"generator"},pr=(e,t)=>{if(e!==void 0&&typeof e!="boolean")throw new TypeError(`The \`${t}\` option must use a boolean.`)},pi=e=>J(e)||gi(e),J=e=>Object.prototype.toString.call(e)==="[object AsyncGeneratorFunction]",gi=e=>Object.prototype.toString.call(e)==="[object GeneratorFunction]",Bf=e=>y(e)&&(e.transform!==void 0||e.final!==void 0),yt=e=>Object.prototype.toString.call(e)==="[object URL]",Si=e=>yt(e)&&e.protocol!=="file:",Lf=e=>y(e)&&Object.keys(e).length>0&&Object.keys(e).every(t=>Ff.has(t))&&mr(e.file),Ff=new Set(["file","append"]),mr=e=>typeof e=="string",yi=(e,t)=>e==="native"&&typeof t=="string"&&!Pf.has(t),Pf=new Set(["ipc","ignore","inherit","overlapped","pipe"]),bi=e=>Object.prototype.toString.call(e)==="[object ReadableStream]",bt=e=>Object.prototype.toString.call(e)==="[object WritableStream]",Uf=e=>bi(e)||bt(e),ur=e=>bi(e?.readable)&&bt(e?.writable),$f=e=>wi(e)&&typeof e[Symbol.asyncIterator]=="function",Nf=e=>wi(e)&&typeof e[Symbol.iterator]=="function",wi=e=>typeof e=="object"&&e!==null,A=new Set(["generator","asyncGenerator","duplex","webTransform"]),wt=new Set(["fileUrl","filePath","fileNumber"]),hr=new Set(["fileUrl","filePath"]),xi=new Set([...hr,"webStream","nodeStream"]),Ei=new Set(["webTransform","duplex"]),V={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a string",uint8Array:"a Uint8Array"};var gr=(e,t,r,n)=>n==="output"?_f(e,t,r):jf(e,t,r),_f=(e,t,r)=>{let n=t!==0&&r[t-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:e??n}},jf=(e,t,r)=>{let n=t===0?e===!0:r[t-1].value.readableObjectMode,o=t!==r.length-1&&(e??n);return{writableObjectMode:n,readableObjectMode:o}},Ti=(e,t)=>{let r=e.findLast(({type:n})=>A.has(n));return r===void 0?!1:t==="input"?r.value.writableObjectMode:r.value.readableObjectMode};var Oi=(e,t,r,n)=>[...e.filter(({type:o})=>!A.has(o)),...vf(e,t,r,n)],vf=(e,t,r,{encoding:n})=>{let o=e.filter(({type:s})=>A.has(s)),i=Array.from({length:o.length});for(let[s,a]of Object.entries(o))i[s]=kf({stdioItem:a,index:Number(s),newTransforms:i,optionName:t,direction:r,encoding:n});return Vf(i,r)},kf=({stdioItem:e,stdioItem:{type:t},index:r,newTransforms:n,optionName:o,direction:i,encoding:s})=>t==="duplex"?Gf({stdioItem:e,optionName:o}):t==="webTransform"?zf({stdioItem:e,index:r,newTransforms:n,direction:i}):Wf({stdioItem:e,index:r,newTransforms:n,direction:i,encoding:s}),Gf=({stdioItem:e,stdioItem:{value:{transform:t,transform:{writableObjectMode:r,readableObjectMode:n},objectMode:o=n}},optionName:i})=>{if(o&&!n)throw new TypeError(`The \`${i}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!o&&n)throw new TypeError(`The \`${i}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...e,value:{transform:t,writableObjectMode:r,readableObjectMode:n}}},zf=({stdioItem:e,stdioItem:{value:t},index:r,newTransforms:n,direction:o})=>{let{transform:i,objectMode:s}=y(t)?t:{transform:t},{writableObjectMode:a,readableObjectMode:c}=gr(s,r,n,o);return{...e,value:{transform:i,writableObjectMode:a,readableObjectMode:c}}},Wf=({stdioItem:e,stdioItem:{value:t},index:r,newTransforms:n,direction:o,encoding:i})=>{let{transform:s,final:a,binary:c=!1,preserveNewlines:f=!1,objectMode:l}=y(t)?t:{transform:t},d=c||T.has(i),{writableObjectMode:p,readableObjectMode:m}=gr(l,r,n,o);return{...e,value:{transform:s,final:a,binary:d,preserveNewlines:f,writableObjectMode:p,readableObjectMode:m}}},Vf=(e,t)=>t==="input"?e.reverse():e;import Sr from"process";var Di=(e,t,r)=>{let n=e.map(o=>Yf(o,t));if(n.includes("input")&&n.includes("output"))throw new TypeError(`The \`${r}\` option must not be an array of both readable and writable values.`);return n.find(Boolean)??Kf},Yf=({type:e,value:t},r)=>Hf[r]??Ai[e](t),Hf=["input","output","output"],me=()=>{},yr=()=>"input",Ai={generator:me,asyncGenerator:me,fileUrl:me,filePath:me,iterable:yr,asyncIterable:yr,uint8Array:yr,webStream:e=>bt(e)?"output":"input",nodeStream(e){return X(e,{checkOpen:!1})?ir(e,{checkOpen:!1})?void 0:"input":"output"},webTransform:me,duplex:me,native(e){let t=qf(e);if(t!==void 0)return t;if(C(e,{checkOpen:!1}))return Ai.nodeStream(e)}},qf=e=>{if([0,Sr.stdin].includes(e))return"input";if([1,2,Sr.stdout,Sr.stderr].includes(e))return"output"},Kf="output";var Ii=(e,t)=>t&&!e.includes("ipc")?[...e,"ipc"]:e;var Ri=({stdio:e,ipc:t,buffer:r,...n},o,i)=>{let s=Xf(e,n).map((a,c)=>Mi(a,c));return i?Zf(s,r,o):Ii(s,t)},Xf=(e,t)=>{if(e===void 0)return D.map(n=>t[n]);if(Jf(t))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${D.map(n=>`\`${n}\``).join(", ")}`);if(typeof e=="string")return[e,e,e];if(!Array.isArray(e))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof e}\``);let r=Math.max(e.length,D.length);return Array.from({length:r},(n,o)=>e[o])},Jf=e=>D.some(t=>e[t]!==void 0),Mi=(e,t)=>Array.isArray(e)?e.map(r=>Mi(r,t)):e??(t>=D.length?"ignore":"pipe"),Zf=(e,t,r)=>e.map((n,o)=>!t[o]&&o!==0&&!ne(r,o)&&Qf(n)?"ignore":n),Qf=e=>e==="pipe"||Array.isArray(e)&&e.every(t=>t==="pipe");import{readFileSync as ed}from"fs";import td from"tty";var Bi=({stdioItem:e,stdioItem:{type:t},isStdioArray:r,fdNumber:n,direction:o,isSync:i})=>!r||t!=="native"?e:i?rd({stdioItem:e,fdNumber:n,direction:o}):id({stdioItem:e,fdNumber:n}),rd=({stdioItem:e,stdioItem:{value:t,optionName:r},fdNumber:n,direction:o})=>{let i=nd({value:t,optionName:r,fdNumber:n,direction:o});if(i!==void 0)return i;if(C(t,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return e},nd=({value:e,optionName:t,fdNumber:r,direction:n})=>{let o=od(e,r);if(o!==void 0){if(n==="output")return{type:"fileNumber",value:o,optionName:t};if(td.isatty(o))throw new TypeError(`The \`${t}: ${Ke(e)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:N(ed(o)),optionName:t}}},od=(e,t)=>{if(e==="inherit")return t;if(typeof e=="number")return e;let r=Fe.indexOf(e);if(r!==-1)return r},id=({stdioItem:e,stdioItem:{value:t,optionName:r},fdNumber:n})=>t==="inherit"?{type:"nodeStream",value:Ci(n,t,r),optionName:r}:typeof t=="number"?{type:"nodeStream",value:Ci(t,t,r),optionName:r}:C(t,{checkOpen:!1})?{type:"nodeStream",value:t,optionName:r}:e,Ci=(e,t,r)=>{let n=Fe[e];if(n===void 0)throw new TypeError(`The \`${r}: ${t}\` option is invalid: no such standard stream.`);return n};var Li=({input:e,inputFile:t},r)=>r===0?[...sd(e),...cd(t)]:[],sd=e=>e===void 0?[]:[{type:ad(e),value:e,optionName:"input"}],ad=e=>{if(X(e,{checkOpen:!1}))return"nodeStream";if(typeof e=="string")return"string";if(b(e))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},cd=e=>e===void 0?[]:[{...ld(e),optionName:"inputFile"}],ld=e=>{if(yt(e))return{type:"fileUrl",value:e};if(mr(e))return{type:"filePath",value:{file:e}};throw new Error("The `inputFile` option must be a file path string or a file URL.")};var Fi=e=>e.filter((t,r)=>e.every((n,o)=>t.value!==n.value||r>=o||t.type==="generator"||t.type==="asyncGenerator")),Pi=({stdioItem:{type:e,value:t,optionName:r},direction:n,fileDescriptors:o,isSync:i})=>{let s=fd(o,e);if(s.length!==0){if(i){dd({otherStdioItems:s,type:e,value:t,optionName:r,direction:n});return}if(xi.has(e))return Ui({otherStdioItems:s,type:e,value:t,optionName:r,direction:n});Ei.has(e)&&md({otherStdioItems:s,type:e,value:t,optionName:r})}},fd=(e,t)=>e.flatMap(({direction:r,stdioItems:n})=>n.filter(o=>o.type===t).map((o=>({...o,direction:r})))),dd=({otherStdioItems:e,type:t,value:r,optionName:n,direction:o})=>{hr.has(t)&&Ui({otherStdioItems:e,type:t,value:r,optionName:n,direction:o})},Ui=({otherStdioItems:e,type:t,value:r,optionName:n,direction:o})=>{let i=e.filter(a=>pd(a,r));if(i.length===0)return;let s=i.find(a=>a.direction!==o);return $i(s,n,t),o==="output"?i[0].stream:void 0},pd=({type:e,value:t},r)=>e==="filePath"?t.file===r.file:e==="fileUrl"?t.href===r.href:t===r,md=({otherStdioItems:e,type:t,value:r,optionName:n})=>{let o=e.find(({value:{transform:i}})=>i===r.transform);$i(o,n,t)},$i=(e,t,r)=>{if(e!==void 0)throw new TypeError(`The \`${e.optionName}\` and \`${t}\` options must not target ${V[r]} that is the same.`)};var xt=(e,t,r,n)=>{let i=Ri(t,r,n).map((a,c)=>ud({stdioOption:a,fdNumber:c,options:t,isSync:n})),s=Ed({initialFileDescriptors:i,addProperties:e,options:t,isSync:n});return t.stdio=s.map(({stdioItems:a})=>Dd(a)),s},ud=({stdioOption:e,fdNumber:t,options:r,isSync:n})=>{let o=Pe(t),{stdioItems:i,isStdioArray:s}=hd({stdioOption:e,fdNumber:t,options:r,optionName:o}),a=Di(i,t,o),c=i.map(d=>Bi({stdioItem:d,isStdioArray:s,fdNumber:t,direction:a,isSync:n})),f=Oi(c,o,a,r),l=Ti(f,a);return xd(f,l),{direction:a,objectMode:l,stdioItems:f}},hd=({stdioOption:e,fdNumber:t,options:r,optionName:n})=>{let i=[...(Array.isArray(e)?e:[e]).map(c=>gd(c,n)),...Li(r,t)],s=Fi(i),a=s.length>1;return Sd(s,a,n),bd(s),{stdioItems:s,isStdioArray:a}},gd=(e,t)=>({type:mi(e,t),value:e,optionName:t}),Sd=(e,t,r)=>{if(e.length===0)throw new TypeError(`The \`${r}\` option must not be an empty array.`);if(t){for(let{value:n,optionName:o}of e)if(yd.has(n))throw new Error(`The \`${o}\` option must not include \`${n}\`.`)}},yd=new Set(["ignore","ipc"]),bd=e=>{for(let t of e)wd(t)},wd=({type:e,value:t,optionName:r})=>{if(Si(t))throw new TypeError(`The \`${r}: URL\` option must use the \`file:\` scheme.
|
|
38
|
+
For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(yi(e,t))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},xd=(e,t)=>{if(!t)return;let r=e.find(({type:n})=>wt.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},Ed=({initialFileDescriptors:e,addProperties:t,options:r,isSync:n})=>{let o=[];try{for(let i of e)o.push(Td({fileDescriptor:i,fileDescriptors:o,addProperties:t,options:r,isSync:n}));return o}catch(i){throw br(o),i}},Td=({fileDescriptor:{direction:e,objectMode:t,stdioItems:r},fileDescriptors:n,addProperties:o,options:i,isSync:s})=>{let a=r.map(c=>Od({stdioItem:c,addProperties:o,direction:e,options:i,fileDescriptors:n,isSync:s}));return{direction:e,objectMode:t,stdioItems:a}},Od=({stdioItem:e,addProperties:t,direction:r,options:n,fileDescriptors:o,isSync:i})=>{let s=Pi({stdioItem:e,direction:r,fileDescriptors:o,isSync:i});return s!==void 0?{...e,stream:s}:{...e,...t[r][e.type](e,n)}},br=e=>{for(let{stdioItems:t}of e)for(let{stream:r}of t)r!==void 0&&!I(r)&&r.destroy()},Dd=e=>{if(e.length>1)return e.some(({value:n})=>n==="overlapped")?"overlapped":"pipe";let[{type:t,value:r}]=e;return t==="native"?r:"pipe"};var ji=(e,t)=>xt(Id,e,t,!0),U=({type:e,optionName:t})=>{vi(t,V[e])},Ad=({optionName:e,value:t})=>((t==="ipc"||t==="overlapped")&&vi(e,`"${t}"`),{}),vi=(e,t)=>{throw new TypeError(`The \`${e}\` option cannot be ${t} with synchronous methods.`)},_i={generator(){},asyncGenerator:U,webStream:U,nodeStream:U,webTransform:U,duplex:U,asyncIterable:U,native:Ad},Id={input:{..._i,fileUrl:({value:e})=>({contents:[N(Ni(e))]}),filePath:({value:{file:e}})=>({contents:[N(Ni(e))]}),fileNumber:U,iterable:({value:e})=>({contents:[...e]}),string:({value:e})=>({contents:[e]}),uint8Array:({value:e})=>({contents:[e]})},output:{..._i,fileUrl:({value:e})=>({path:e}),filePath:({value:{file:e,append:t}})=>({path:e,append:t}),fileNumber:({value:e})=>({path:e}),iterable:U,string:U,uint8Array:U}};var v=(e,{stripFinalNewline:t},r)=>wr(t,r)&&e!==void 0&&!Array.isArray(e)?le(e):e,wr=(e,t)=>t==="all"?e[1]||e[2]:e[t];import{Transform as qd,getDefaultHighWaterMark as Ji}from"stream";var Et=(e,t,r,n)=>e||r?void 0:Gi(t,n),Er=(e,t,r)=>r?e.flatMap(n=>ki(n,t)):ki(e,t),ki=(e,t)=>{let{transform:r,final:n}=Gi(t,{});return[...r(e),...n()]},Gi=(e,t)=>(t.previousChunks="",{transform:Rd.bind(void 0,t,e),final:Cd.bind(void 0,t)}),Rd=function*(e,t,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=e,o=-1;for(let i=0;i<r.length;i+=1)if(r[i]===`
|
|
39
|
+
`){let s=Md(r,i,t,e),a=r.slice(o+1,i+1-s);n.length>0&&(a=xr(n,a),n=""),yield a,o=i}o!==r.length-1&&(n=xr(n,r.slice(o+1))),e.previousChunks=n},Md=(e,t,r,n)=>r?0:(n.isWindowsNewline=t!==0&&e[t-1]==="\r",n.isWindowsNewline?2:1),Cd=function*({previousChunks:e}){e.length>0&&(yield e)},zi=({binary:e,preserveNewlines:t,readableObjectMode:r,state:n})=>e||t||r?void 0:{transform:Bd.bind(void 0,n)},Bd=function*({isWindowsNewline:e=!1},t){let{unixNewline:r,windowsNewline:n,LF:o,concatBytes:i}=typeof t=="string"?Ld:Pd;if(t.at(-1)===o){yield t;return}yield i(t,e?n:r)},xr=(e,t)=>`${e}${t}`,Ld={windowsNewline:`\r
|
|
40
|
+
`,unixNewline:`
|
|
41
|
+
`,LF:`
|
|
42
|
+
`,concatBytes:xr},Fd=(e,t)=>{let r=new Uint8Array(e.length+t.length);return r.set(e,0),r.set(t,e.length),r},Pd={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:Fd};import{Buffer as Ud}from"buffer";var Wi=(e,t)=>e?void 0:$d.bind(void 0,t),$d=function*(e,t){if(typeof t!="string"&&!b(t)&&!Ud.isBuffer(t))throw new TypeError(`The \`${e}\` option's transform must use "objectMode: true" to receive as input: ${typeof t}.`);yield t},Vi=(e,t)=>e?Nd.bind(void 0,t):_d.bind(void 0,t),Nd=function*(e,t){Yi(e,t),yield t},_d=function*(e,t){if(Yi(e,t),typeof t!="string"&&!b(t))throw new TypeError(`The \`${e}\` option's function must yield a string or an Uint8Array, not ${typeof t}.`);yield t},Yi=(e,t)=>{if(t==null)throw new TypeError(`The \`${e}\` option's function must not call \`yield ${t}\`.
|
|
43
|
+
Instead, \`yield\` should either be called with a value, or not be called at all. For example:
|
|
44
|
+
if (condition) { yield value; }`)};import{Buffer as jd}from"buffer";import{StringDecoder as vd}from"string_decoder";var Tt=(e,t,r)=>{if(r)return;if(e)return{transform:kd.bind(void 0,new TextEncoder)};let n=new vd(t);return{transform:Gd.bind(void 0,n),final:zd.bind(void 0,n)}},kd=function*(e,t){jd.isBuffer(t)?yield N(t):typeof t=="string"?yield e.encode(t):yield t},Gd=function*(e,t){yield b(t)?e.write(t):t},zd=function*(e){let t=e.end();t!==""&&(yield t)};import{callbackify as Hi}from"util";var Tr=Hi(async(e,t,r,n)=>{t.currentIterable=e(...r);try{for await(let o of t.currentIterable)n.push(o)}finally{delete t.currentIterable}}),Ot=async function*(e,t,r){if(r===t.length){yield e;return}let{transform:n=Vd}=t[r];for await(let o of n(e))yield*Ot(o,t,r+1)},qi=async function*(e){for(let[t,{final:r}]of Object.entries(e))yield*Wd(r,Number(t),e)},Wd=async function*(e,t,r){if(e!==void 0)for await(let n of e())yield*Ot(n,r,t+1)},Ki=Hi(async({currentIterable:e},t)=>{if(e!==void 0){await(t?e.throw(t):e.return());return}if(t)throw t}),Vd=function*(e){yield e};var Or=(e,t,r,n)=>{try{for(let o of e(...t))r.push(o);n()}catch(o){n(o)}},Xi=(e,t)=>[...t.flatMap(r=>[...Z(r,e,0)]),...De(e)],Z=function*(e,t,r){if(r===t.length){yield e;return}let{transform:n=Hd}=t[r];for(let o of n(e))yield*Z(o,t,r+1)},De=function*(e){for(let[t,{final:r}]of Object.entries(e))yield*Yd(r,Number(t),e)},Yd=function*(e,t,r){if(e!==void 0)for(let n of e())yield*Z(n,r,t+1)},Hd=function*(e){yield e};var Dr=({value:e,value:{transform:t,final:r,writableObjectMode:n,readableObjectMode:o},optionName:i},{encoding:s})=>{let a={},c=Zi(e,s,i),f=J(t),l=J(r),d=f?Tr.bind(void 0,Ot,a):Or.bind(void 0,Z),p=f||l?Tr.bind(void 0,qi,a):Or.bind(void 0,De),m=f||l?Ki.bind(void 0,a):void 0;return{stream:new qd({writableObjectMode:n,writableHighWaterMark:Ji(n),readableObjectMode:o,readableHighWaterMark:Ji(o),transform(g,w,S){d([g,c,0],this,S)},flush(g){p([c],this,g)},destroy:m})}},Dt=(e,t,r,n)=>{let o=t.filter(({type:s})=>s==="generator"),i=n?o.reverse():o;for(let{value:s,optionName:a}of i){let c=Zi(s,r,a);e=Xi(c,e)}return e},Zi=({transform:e,final:t,binary:r,writableObjectMode:n,readableObjectMode:o,preserveNewlines:i},s,a)=>{let c={};return[{transform:Wi(n,a)},Tt(r,s,n),Et(r,i,n,c),{transform:e,final:t},{transform:Vi(o,a)},zi({binary:r,preserveNewlines:i,readableObjectMode:o,state:c})].filter(Boolean)};var Qi=(e,t)=>{for(let r of Kd(e))Xd(e,r,t)},Kd=e=>new Set(Object.entries(e).filter(([,{direction:t}])=>t==="input").map(([t])=>Number(t))),Xd=(e,t,r)=>{let{stdioItems:n}=e[t],o=n.filter(({contents:a})=>a!==void 0);if(o.length===0)return;if(t!==0){let[{type:a,optionName:c}]=o;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${V[a]} with synchronous methods.`)}let s=o.map(({contents:a})=>a).map(a=>Jd(a,n));r.input=Se(s)},Jd=(e,t)=>{let r=Dt(e,t,"utf8",!0);return Zd(r),Se(r)},Zd=e=>{let t=e.find(r=>typeof r!="string"&&!b(r));if(t!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${t}.`)};import{writeFileSync as rp,appendFileSync as np}from"fs";var At=({stdioItems:e,encoding:t,verboseInfo:r,fdNumber:n})=>n!=="all"&&ne(r,n)&&!T.has(t)&&Qd(n)&&(e.some(({type:o,value:i})=>o==="native"&&ep.has(i))||e.every(({type:o})=>A.has(o))),Qd=e=>e===1||e===2,ep=new Set(["pipe","overlapped"]),es=async(e,t,r,n)=>{for await(let o of e)tp(t)||rs(o,r,n)},ts=(e,t,r)=>{for(let n of e)rs(n,t,r)},tp=e=>e._readableState.pipes.length>0,rs=(e,t,r)=>{let n=ve(e);B({type:"output",verboseMessage:n,fdNumber:t,verboseInfo:r})};var ns=({fileDescriptors:e,syncResult:{output:t},options:r,isMaxBuffer:n,verboseInfo:o})=>{if(t===null)return{output:Array.from({length:3})};let i={},s=new Set([]);return{output:t.map((c,f)=>op({result:c,fileDescriptors:e,fdNumber:f,state:i,outputFiles:s,isMaxBuffer:n,verboseInfo:o},r)),...i}},op=({result:e,fileDescriptors:t,fdNumber:r,state:n,outputFiles:o,isMaxBuffer:i,verboseInfo:s},{buffer:a,encoding:c,lines:f,stripFinalNewline:l,maxBuffer:d})=>{if(e===null)return;let p=oi(e,i,d),m=N(p),{stdioItems:u,objectMode:g}=t[r],w=ip([m],u,c,n),{serializedResult:S,finalResult:x=S}=sp({chunks:w,objectMode:g,encoding:c,lines:f,stripFinalNewline:l,fdNumber:r});ap({serializedResult:S,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:u,objectMode:g});let E=a[r]?x:void 0;try{return n.error===void 0&&cp(S,u,o),E}catch(O){return n.error=O,E}},ip=(e,t,r,n)=>{try{return Dt(e,t,r,!1)}catch(o){return n.error=o,e}},sp=({chunks:e,objectMode:t,encoding:r,lines:n,stripFinalNewline:o,fdNumber:i})=>{if(t)return{serializedResult:e};if(r==="buffer")return{serializedResult:Se(e)};let s=on(e,r);return n[i]?{serializedResult:s,finalResult:Er(s,!o[i],t)}:{serializedResult:s}},ap=({serializedResult:e,fdNumber:t,state:r,verboseInfo:n,encoding:o,stdioItems:i,objectMode:s})=>{if(!At({stdioItems:i,encoding:o,verboseInfo:n,fdNumber:t}))return;let a=Er(e,!1,s);try{ts(a,t,n)}catch(c){r.error??=c}},cp=(e,t,r)=>{for(let{path:n,append:o}of t.filter(({type:i})=>wt.has(i))){let i=typeof n=="string"?n:n.toString();o||r.has(i)?np(n,e):(r.add(i),rp(n,e))}};var os=([,e,t],r)=>{if(r.all)return e===void 0?t:t===void 0?e:Array.isArray(e)?Array.isArray(t)?[...e,...t]:[...e,v(t,r,"all")]:Array.isArray(t)?[v(e,r,"all"),...t]:b(e)&&b(t)?vt([e,t]):`${e}${t}`};import{once as Ar}from"events";var is=async(e,t)=>{let[r,n]=await lp(e);return t.isForcefullyTerminated??=!1,[r,n]},lp=async e=>{let[t,r]=await Promise.allSettled([Ar(e,"spawn"),Ar(e,"exit")]);return t.status==="rejected"?[]:r.status==="rejected"?ss(e):r.value},ss=async e=>{try{return await Ar(e,"exit")}catch{return ss(e)}},as=async e=>{let[t,r]=await e;if(!fp(t,r)&&Ir(t,r))throw new R;return[t,r]},fp=(e,t)=>e===void 0&&t===void 0,Ir=(e,t)=>e!==0||t!==null;var cs=({error:e,status:t,signal:r,output:n},{maxBuffer:o})=>{let i=dp(e,t,r),s=i?.code==="ETIMEDOUT",a=ni(i,n,o);return{resultError:i,exitCode:t,signal:r,timedOut:s,isMaxBuffer:a}},dp=(e,t,r)=>e!==void 0?e:Ir(t,r)?new R:void 0;var ls=(e,t,r)=>{let{file:n,commandArguments:o,command:i,escapedCommand:s,startTime:a,verboseInfo:c,options:f,fileDescriptors:l}=mp(e,t,r),d=gp({file:n,commandArguments:o,options:f,command:i,escapedCommand:s,verboseInfo:c,fileDescriptors:l,startTime:a});return pe(d,c,f)},mp=(e,t,r)=>{let{command:n,escapedCommand:o,startTime:i,verboseInfo:s}=Ge(e,t,r),a=up(r),{file:c,commandArguments:f,options:l}=at(e,t,a);hp(l);let d=ji(l,s);return{file:c,commandArguments:f,command:n,escapedCommand:o,startTime:i,verboseInfo:s,options:l,fileDescriptors:d}},up=e=>e.node&&!e.ipc?{...e,ipc:!1}:e,hp=({ipc:e,ipcInput:t,detached:r,cancelSignal:n})=>{t&&It("ipcInput"),e&&It("ipc: true"),r&&It("detached: true"),n&&It("cancelSignal")},It=e=>{throw new TypeError(`The "${e}" option cannot be used with synchronous methods.`)},gp=({file:e,commandArguments:t,options:r,command:n,escapedCommand:o,verboseInfo:i,fileDescriptors:s,startTime:a})=>{let c=Sp({file:e,commandArguments:t,options:r,command:n,escapedCommand:o,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:f,exitCode:l,signal:d,timedOut:p,isMaxBuffer:m}=cs(c,r),{output:u,error:g=f}=ns({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:m,verboseInfo:i}),w=u.map((x,E)=>v(x,r,E)),S=v(os(u,r),r,"all");return bp({error:g,exitCode:l,signal:d,timedOut:p,isMaxBuffer:m,stdio:w,all:S,options:r,command:n,escapedCommand:o,startTime:a})},Sp=({file:e,commandArguments:t,options:r,command:n,escapedCommand:o,fileDescriptors:i,startTime:s})=>{try{Qi(i,r);let a=yp(r);return pp(...ct(e,t,a))}catch(a){return de({error:a,command:n,escapedCommand:o,fileDescriptors:i,options:r,startTime:s,isSync:!0})}},yp=({encoding:e,maxBuffer:t,...r})=>({...r,encoding:"buffer",maxBuffer:gt(t)}),bp=({error:e,exitCode:t,signal:r,timedOut:n,isMaxBuffer:o,stdio:i,all:s,options:a,command:c,escapedCommand:f,startTime:l})=>e===void 0?St({command:c,escapedCommand:f,stdio:i,all:s,ipcOutput:[],options:a,startTime:l}):Oe({error:e,command:c,escapedCommand:f,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:o,isForcefullyTerminated:!1,exitCode:t,signal:r,stdio:i,all:s,ipcOutput:[],options:a,startTime:l,isSync:!0});import{setMaxListeners as ou}from"events";import{spawn as iu}from"child_process";import us from"process";import{once as Rr,on as wp}from"events";var fs=({anyProcess:e,channel:t,isSubprocess:r,ipc:n},{reference:o=!0,filter:i}={})=>(se({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:tt(e)}),xp({anyProcess:e,channel:t,isSubprocess:r,filter:i,reference:o})),xp=async({anyProcess:e,channel:t,isSubprocess:r,filter:n,reference:o})=>{Je(t,o);let i=W(e,t,r),s=new AbortController;try{return await Promise.race([Ep(i,n,s),Tp(i,r,s),Op(i,r,s)])}catch(a){throw ae(e),a}finally{s.abort(),Ze(t,o)}},Ep=async(e,t,{signal:r})=>{if(t===void 0){let[n]=await Rr(e,"message",{signal:r});return n}for await(let[n]of wp(e,"message",{signal:r}))if(t(n))return n},Tp=async(e,t,{signal:r})=>{await Rr(e,"disconnect",{signal:r}),Kn(t)},Op=async(e,t,{signal:r})=>{let[n]=await Rr(e,"strict:error",{signal:r});throw qe(n,t)};import{once as ps,on as Dp}from"events";var ms=({anyProcess:e,channel:t,isSubprocess:r,ipc:n},{reference:o=!0}={})=>Mr({anyProcess:e,channel:t,isSubprocess:r,ipc:n,shouldAwait:!r,reference:o}),Mr=({anyProcess:e,channel:t,isSubprocess:r,ipc:n,shouldAwait:o,reference:i})=>{se({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:tt(e)}),Je(t,i);let s=W(e,t,r),a=new AbortController,c={};return Ap(e,s,a),Ip({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),Rp({anyProcess:e,channel:t,ipcEmitter:s,isSubprocess:r,shouldAwait:o,controller:a,state:c,reference:i})},Ap=async(e,t,r)=>{try{await ps(t,"disconnect",{signal:r.signal}),r.abort()}catch{}},Ip=async({ipcEmitter:e,isSubprocess:t,controller:r,state:n})=>{try{let[o]=await ps(e,"strict:error",{signal:r.signal});n.error=qe(o,t),r.abort()}catch{}},Rp=async function*({anyProcess:e,channel:t,ipcEmitter:r,isSubprocess:n,shouldAwait:o,controller:i,state:s,reference:a}){try{for await(let[c]of Dp(r,"message",{signal:i.signal}))ds(s),yield c}catch{ds(s)}finally{i.abort(),Ze(t,a),n||ae(e),o&&await e}},ds=({error:e})=>{if(e)throw e};var hs=(e,{ipc:t})=>{Object.assign(e,Ss(e,!1,t))},gs=()=>{let e=us,t=!0,r=us.channel!==void 0;return{...Ss(e,t,r),getCancelSignal:To.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r})}},Ss=(e,t,r)=>({sendMessage:it.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r}),getOneMessage:fs.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r}),getEachMessage:ms.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r})});import{ChildProcess as Mp}from"child_process";import{PassThrough as Cp,Readable as Bp,Writable as Lp,Duplex as Fp}from"stream";var ys=({error:e,command:t,escapedCommand:r,fileDescriptors:n,options:o,startTime:i,verboseInfo:s})=>{br(n);let a=new Mp;Pp(a,n),Object.assign(a,{readable:Up,writable:$p,duplex:Np});let c=de({error:e,command:t,escapedCommand:r,fileDescriptors:n,options:o,startTime:i,isSync:!1}),f=_p(c,s,o);return{subprocess:a,promise:f}},Pp=(e,t)=>{let r=Ae(),n=Ae(),o=Ae(),i=Array.from({length:t.length-3},Ae),s=Ae(),a=[r,n,o,...i];Object.assign(e,{stdin:r,stdout:n,stderr:o,all:s,stdio:a})},Ae=()=>{let e=new Cp;return e.end(),e},Up=()=>new Bp({read(){}}),$p=()=>new Lp({write(){}}),Np=()=>new Fp({read(){},write(){}}),_p=async(e,t,r)=>pe(e,t,r);import{createReadStream as bs,createWriteStream as ws}from"fs";import{Buffer as jp}from"buffer";import{Readable as Ie,Writable as vp,Duplex as kp}from"stream";var Es=(e,t)=>xt(Gp,e,t,!1),Re=({type:e,optionName:t})=>{throw new TypeError(`The \`${t}\` option cannot be ${V[e]}.`)},xs={fileNumber:Re,generator:Dr,asyncGenerator:Dr,nodeStream:({value:e})=>({stream:e}),webTransform({value:{transform:e,writableObjectMode:t,readableObjectMode:r}}){let n=t||r;return{stream:kp.fromWeb(e,{objectMode:n})}},duplex:({value:{transform:e}})=>({stream:e}),native(){}},Gp={input:{...xs,fileUrl:({value:e})=>({stream:bs(e)}),filePath:({value:{file:e}})=>({stream:bs(e)}),webStream:({value:e})=>({stream:Ie.fromWeb(e)}),iterable:({value:e})=>({stream:Ie.from(e)}),asyncIterable:({value:e})=>({stream:Ie.from(e)}),string:({value:e})=>({stream:Ie.from(e)}),uint8Array:({value:e})=>({stream:Ie.from(jp.from(e))})},output:{...xs,fileUrl:({value:e})=>({stream:ws(e)}),filePath:({value:{file:e,append:t}})=>({stream:ws(e,t?{flags:"a"}:{})}),webStream:({value:e})=>({stream:vp.fromWeb(e)}),iterable:Re,asyncIterable:Re,string:Re,uint8Array:Re}};import{on as zp,once as Ts}from"events";import{PassThrough as Wp,getDefaultHighWaterMark as Vp}from"stream";import{finished as As}from"stream/promises";function Q(e){if(!Array.isArray(e))throw new TypeError(`Expected an array, got \`${typeof e}\`.`);for(let o of e)Br(o);let t=e.some(({readableObjectMode:o})=>o),r=Yp(e,t),n=new Cr({objectMode:t,writableHighWaterMark:r,readableHighWaterMark:r});for(let o of e)n.add(o);return n}var Yp=(e,t)=>{if(e.length===0)return Vp(t);let r=e.filter(({readableObjectMode:n})=>n===t).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},Cr=class extends Wp{#e=new Set([]);#o=new Set([]);#r=new Set([]);#t;#i=Symbol("unpipe");#n=new WeakMap;add(t){if(Br(t),this.#e.has(t))return;this.#e.add(t),this.#t??=Hp(this,this.#e,this.#i);let r=Xp({passThroughStream:this,stream:t,streams:this.#e,ended:this.#o,aborted:this.#r,onFinished:this.#t,unpipeEvent:this.#i});this.#n.set(t,r),t.pipe(this,{end:!1})}async remove(t){if(Br(t),!this.#e.has(t))return!1;let r=this.#n.get(t);return r===void 0?!1:(this.#n.delete(t),t.unpipe(this),await r,!0)}},Hp=async(e,t,r)=>{Rt(e,Os);let n=new AbortController;try{await Promise.race([qp(e,n),Kp(e,t,r,n)])}finally{n.abort(),Rt(e,-Os)}},qp=async(e,{signal:t})=>{try{await As(e,{signal:t,cleanup:!0})}catch(r){throw Is(e,r),r}},Kp=async(e,t,r,{signal:n})=>{for await(let[o]of zp(e,"unpipe",{signal:n}))t.has(o)&&o.emit(r)},Br=e=>{if(typeof e?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof e}\`.`)},Xp=async({passThroughStream:e,stream:t,streams:r,ended:n,aborted:o,onFinished:i,unpipeEvent:s})=>{Rt(e,Ds);let a=new AbortController;try{await Promise.race([Jp(i,t,a),Zp({passThroughStream:e,stream:t,streams:r,ended:n,aborted:o,controller:a}),Qp({stream:t,streams:r,ended:n,aborted:o,unpipeEvent:s,controller:a})])}finally{a.abort(),Rt(e,-Ds)}r.size>0&&r.size===n.size+o.size&&(n.size===0&&o.size>0?Lr(e):em(e))},Jp=async(e,t,{signal:r})=>{try{await e,r.aborted||Lr(t)}catch(n){r.aborted||Is(t,n)}},Zp=async({passThroughStream:e,stream:t,streams:r,ended:n,aborted:o,controller:{signal:i}})=>{try{await As(t,{signal:i,cleanup:!0,readable:!0,writable:!1}),r.has(t)&&n.add(t)}catch(s){if(i.aborted||!r.has(t))return;Rs(s)?o.add(t):Ms(e,s)}},Qp=async({stream:e,streams:t,ended:r,aborted:n,unpipeEvent:o,controller:{signal:i}})=>{if(await Ts(e,o,{signal:i}),!e.readable)return Ts(i,"abort",{signal:i});t.delete(e),r.delete(e),n.delete(e)},em=e=>{e.writable&&e.end()},Is=(e,t)=>{Rs(t)?Lr(e):Ms(e,t)},Rs=e=>e?.code==="ERR_STREAM_PREMATURE_CLOSE",Lr=e=>{(e.readable||e.writable)&&e.destroy()},Ms=(e,t)=>{e.destroyed||(e.once("error",tm),e.destroy(t))},tm=()=>{},Rt=(e,t)=>{let r=e.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&e.setMaxListeners(r+t)},Os=2,Ds=1;import{finished as Cs}from"stream/promises";var ue=(e,t)=>{e.pipe(t),rm(e,t),nm(e,t)},rm=async(e,t)=>{if(!(I(e)||I(t))){try{await Cs(e,{cleanup:!0,readable:!0,writable:!1})}catch{}Fr(t)}},Fr=e=>{e.writable&&e.end()},nm=async(e,t)=>{if(!(I(e)||I(t))){try{await Cs(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Pr(e)}},Pr=e=>{e.readable&&e.destroy()};var Bs=(e,t,r)=>{let n=new Map;for(let[o,{stdioItems:i,direction:s}]of Object.entries(t)){for(let{stream:a}of i.filter(({type:c})=>A.has(c)))om(e,a,s,o);for(let{stream:a}of i.filter(({type:c})=>!A.has(c)))sm({subprocess:e,stream:a,direction:s,fdNumber:o,pipeGroups:n,controller:r})}for(let[o,i]of n.entries()){let s=i.length===1?i[0]:Q(i);ue(s,o)}},om=(e,t,r,n)=>{r==="output"?ue(e.stdio[n],t):ue(t,e.stdio[n]);let o=im[n];o!==void 0&&(e[o]=t),e.stdio[n]=t},im=["stdin","stdout","stderr"],sm=({subprocess:e,stream:t,direction:r,fdNumber:n,pipeGroups:o,controller:i})=>{if(t===void 0)return;am(t,i);let[s,a]=r==="output"?[t,e.stdio[n]]:[e.stdio[n],t],c=o.get(s)??[];o.set(s,[...c,a])},am=(e,{signal:t})=>{I(e)&&K(e,cm,t)},cm=2;import{addAbortListener as lm}from"events";var Ls=(e,{cleanup:t,detached:r},{signal:n})=>{if(!t||r)return;let o=en(()=>{e.kill()});lm(n,()=>{o()})};var Ps=({source:e,sourcePromise:t,boundOptions:r,createNested:n},...o)=>{let i=ke(),{destination:s,destinationStream:a,destinationError:c,from:f,unpipeSignal:l}=fm(r,n,o),{sourceStream:d,sourceError:p}=pm(e,f),{options:m,fileDescriptors:u}=F.get(e);return{sourcePromise:t,sourceStream:d,sourceOptions:m,sourceError:p,destination:s,destinationStream:a,destinationError:c,unpipeSignal:l,fileDescriptors:u,startTime:i}},fm=(e,t,r)=>{try{let{destination:n,pipeOptions:{from:o,to:i,unpipeSignal:s}={}}=dm(e,t,...r),a=Xe(n,i);return{destination:n,destinationStream:a,from:o,unpipeSignal:s}}catch(n){return{destinationError:n}}},dm=(e,t,r,...n)=>{if(Array.isArray(r))return{destination:t(Fs,e)(r,...n),pipeOptions:e};if(typeof r=="string"||r instanceof URL||_t(r)){if(Object.keys(e).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[o,i,s]=Be(r,...n);return{destination:t(Fs)(o,i,s),pipeOptions:s}}if(F.has(r)){if(Object.keys(e).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},Fs=({options:e})=>({options:{...e,stdin:"pipe",piped:!0}}),pm=(e,t)=>{try{return{sourceStream:ce(e,t)}}catch(r){return{sourceError:r}}};var $s=({sourceStream:e,sourceError:t,destinationStream:r,destinationError:n,fileDescriptors:o,sourceOptions:i,startTime:s})=>{let a=mm({sourceStream:e,sourceError:t,destinationStream:r,destinationError:n});if(a!==void 0)throw Ur({error:a,fileDescriptors:o,sourceOptions:i,startTime:s})},mm=({sourceStream:e,sourceError:t,destinationStream:r,destinationError:n})=>{if(t!==void 0&&n!==void 0)return n;if(n!==void 0)return Pr(e),n;if(t!==void 0)return Fr(r),t},Ur=({error:e,fileDescriptors:t,sourceOptions:r,startTime:n})=>de({error:e,command:Us,escapedCommand:Us,fileDescriptors:t,options:r,startTime:n,isSync:!1}),Us="source.pipe(destination)";var Ns=async e=>{let[{status:t,reason:r,value:n=r},{status:o,reason:i,value:s=i}]=await e;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),o==="rejected")throw s;if(t==="rejected")throw n;return s};import{finished as um}from"stream/promises";var _s=(e,t,r)=>{let n=Mt.has(t)?gm(e,t):hm(e,t);return K(e,ym,r.signal),K(t,bm,r.signal),Sm(t),n},hm=(e,t)=>{let r=Q([e]);return ue(r,t),Mt.set(t,r),r},gm=(e,t)=>{let r=Mt.get(t);return r.add(e),r},Sm=async e=>{try{await um(e,{cleanup:!0,readable:!1,writable:!0})}catch{}Mt.delete(e)},Mt=new WeakMap,ym=2,bm=1;import{aborted as wm}from"util";var js=(e,t)=>e===void 0?[]:[xm(e,t)],xm=async(e,{sourceStream:t,mergedStream:r,fileDescriptors:n,sourceOptions:o,startTime:i})=>{await wm(e,t),await r.remove(t);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw Ur({error:s,fileDescriptors:n,sourceOptions:o,startTime:i})};var Ct=(e,...t)=>{if(y(t[0]))return Ct.bind(void 0,{...e,boundOptions:{...e.boundOptions,...t[0]}});let{destination:r,...n}=Ps(e,...t),o=Em({...n,destination:r});return o.pipe=Ct.bind(void 0,{...e,source:r,sourcePromise:o,boundOptions:{}}),o},Em=async({sourcePromise:e,sourceStream:t,sourceOptions:r,sourceError:n,destination:o,destinationStream:i,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:f})=>{let l=Tm(e,o);$s({sourceStream:t,sourceError:n,destinationStream:i,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:f});let d=new AbortController;try{let p=_s(t,i,d);return await Promise.race([Ns(l),...js(a,{sourceStream:t,mergedStream:p,sourceOptions:r,fileDescriptors:c,startTime:f})])}finally{d.abort()}},Tm=(e,t)=>Promise.allSettled([e,t]);import{setImmediate as Cm}from"timers/promises";import{on as Om}from"events";import{getDefaultHighWaterMark as Dm}from"stream";var Bt=({subprocessStdout:e,subprocess:t,binary:r,shouldEncode:n,encoding:o,preserveNewlines:i})=>{let s=new AbortController;return Am(t,s),ks({stream:e,controller:s,binary:r,shouldEncode:!e.readableObjectMode&&n,encoding:o,shouldSplit:!e.readableObjectMode,preserveNewlines:i})},Am=async(e,t)=>{try{await e}catch{}finally{t.abort()}},$r=({stream:e,onStreamEnd:t,lines:r,encoding:n,stripFinalNewline:o,allMixed:i})=>{let s=new AbortController;Im(t,s,e);let a=e.readableObjectMode&&!i;return ks({stream:e,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!o})},Im=async(e,t,r)=>{try{await e}catch{r.destroy()}finally{t.abort()}},ks=({stream:e,controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:i,preserveNewlines:s})=>{let a=Om(e,"data",{signal:t.signal,highWaterMark:vs,highWatermark:vs});return Rm({onStdoutChunk:a,controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:i,preserveNewlines:s})},Nr=Dm(!0),vs=Nr,Rm=async function*({onStdoutChunk:e,controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:i,preserveNewlines:s}){let a=Mm({binary:r,shouldEncode:n,encoding:o,shouldSplit:i,preserveNewlines:s});try{for await(let[c]of e)yield*Z(c,a,0)}catch(c){if(!t.signal.aborted)throw c}finally{yield*De(a)}},Mm=({binary:e,shouldEncode:t,encoding:r,shouldSplit:n,preserveNewlines:o})=>[Tt(e,r,!t),Et(e,o,!n,{})].filter(Boolean);var Gs=async({stream:e,onStreamEnd:t,fdNumber:r,encoding:n,buffer:o,maxBuffer:i,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:f,streamInfo:l})=>{let d=Bm({stream:e,onStreamEnd:t,fdNumber:r,encoding:n,allMixed:a,verboseInfo:f,streamInfo:l});if(!o){await Promise.all([Lm(e),d]);return}let p=wr(c,r),m=$r({stream:e,onStreamEnd:t,lines:s,encoding:n,stripFinalNewline:p,allMixed:a}),[u]=await Promise.all([Fm({stream:e,iterable:m,fdNumber:r,encoding:n,maxBuffer:i,lines:s}),d]);return u},Bm=async({stream:e,onStreamEnd:t,fdNumber:r,encoding:n,allMixed:o,verboseInfo:i,streamInfo:{fileDescriptors:s}})=>{if(!At({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:i,fdNumber:r}))return;let a=$r({stream:e,onStreamEnd:t,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:o});await es(a,e,r,i)},Lm=async e=>{await Cm(),e.readableFlowing===null&&e.resume()},Fm=async({stream:e,stream:{readableObjectMode:t},iterable:r,fdNumber:n,encoding:o,maxBuffer:i,lines:s})=>{try{return t||s?await pt(r,{maxBuffer:i}):o==="buffer"?new Uint8Array(await mt(r,{maxBuffer:i})):await ht(r,{maxBuffer:i})}catch(a){return zs(ei({error:a,stream:e,readableObjectMode:t,lines:s,encoding:o,fdNumber:n}))}},_r=async e=>{try{return await e}catch(t){return zs(t)}},zs=({bufferedData:e})=>rn(e)?new Uint8Array(e):e;import{finished as Pm}from"stream/promises";var Me=async(e,t,r,{isSameDirection:n,stopOnExit:o=!1}={})=>{let i=Um(e,r),s=new AbortController;try{await Promise.race([...o?[r.exitPromise]:[],Pm(e,{cleanup:!0,signal:s.signal})])}catch(a){i.stdinCleanedUp||_m(a,t,r,n)}finally{s.abort()}},Um=(e,{originalStreams:[t],subprocess:r})=>{let n={stdinCleanedUp:!1};return e===t&&$m(e,r,n),n},$m=(e,t,r)=>{let{_destroy:n}=e;e._destroy=(...o)=>{Nm(t,r),n.call(e,...o)}},Nm=({exitCode:e,signalCode:t},r)=>{(e!==null||t!==null)&&(r.stdinCleanedUp=!0)},_m=(e,t,r,n)=>{if(!jm(e,t,r,n))throw e},jm=(e,t,r,n=!0)=>r.propagating?Ws(e)||Lt(e):(r.propagating=!0,jr(r,t)===n?Ws(e):Lt(e)),jr=({fileDescriptors:e},t)=>t!=="all"&&e[t].direction==="input",Lt=e=>e?.code==="ERR_STREAM_PREMATURE_CLOSE",Ws=e=>e?.code==="EPIPE";var Vs=({subprocess:e,encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:i,verboseInfo:s,streamInfo:a})=>e.stdio.map((c,f)=>vr({stream:c,fdNumber:f,encoding:t,buffer:r[f],maxBuffer:n[f],lines:o[f],allMixed:!1,stripFinalNewline:i,verboseInfo:s,streamInfo:a})),vr=async({stream:e,fdNumber:t,encoding:r,buffer:n,maxBuffer:o,lines:i,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:f})=>{if(!e)return;let l=Me(e,t,f);if(jr(f,t)){await l;return}let[d]=await Promise.all([Gs({stream:e,onStreamEnd:l,fdNumber:t,encoding:r,buffer:n,maxBuffer:o,lines:i,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:f}),l]);return d};var Ys=({stdout:e,stderr:t},{all:r})=>r&&(e||t)?Q([e,t].filter(Boolean)):void 0,Hs=({subprocess:e,encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:i,verboseInfo:s,streamInfo:a})=>vr({...vm(e,r),fdNumber:"all",encoding:t,maxBuffer:n[1]+n[2],lines:o[1]||o[2],allMixed:km(e),stripFinalNewline:i,verboseInfo:s,streamInfo:a}),vm=({stdout:e,stderr:t,all:r},[,n,o])=>{let i=n||o;return i?n?o?{stream:r,buffer:i}:{stream:e,buffer:i}:{stream:t,buffer:i}:{stream:r,buffer:i}},km=({all:e,stdout:t,stderr:r})=>e&&t&&r&&t.readableObjectMode!==r.readableObjectMode;import{once as Gm}from"events";var qs=e=>ne(e,"ipc"),Ks=(e,t)=>{let r=ve(e);B({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:t})};var Xs=async({subprocess:e,buffer:t,maxBuffer:r,ipc:n,ipcOutput:o,verboseInfo:i})=>{if(!n)return o;let s=qs(i),a=_(t,"ipc"),c=_(r,"ipc");for await(let f of Mr({anyProcess:e,channel:e.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(ti(e,o,c),o.push(f)),s&&Ks(f,i);return o},Js=async(e,t)=>(await Promise.allSettled([e]),t);var Zs=async({subprocess:e,options:{encoding:t,buffer:r,maxBuffer:n,lines:o,timeoutDuration:i,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:f,ipc:l,ipcInput:d},context:p,verboseInfo:m,fileDescriptors:u,originalStreams:g,onInternalError:w,controller:S})=>{let x=is(e,p),E={originalStreams:g,fileDescriptors:u,subprocess:e,exitPromise:x,propagating:!1},O=Vs({subprocess:e,encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:f,verboseInfo:m,streamInfo:E}),$=Hs({subprocess:e,encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:f,verboseInfo:m,streamInfo:E}),k=[],H=Xs({subprocess:e,buffer:r,maxBuffer:n,ipc:l,ipcOutput:k,verboseInfo:m}),ee=zm(g,e,E),G=Wm(u,E);try{return await Promise.race([Promise.all([{},as(x),Promise.all(O),$,H,Fo(e,d),...ee,...G]),w,Vm(e,S),...Ro(e,i,p,S),...qn({subprocess:e,cancelSignal:s,gracefulCancel:a,context:p,controller:S}),...Ao({subprocess:e,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:p,controller:S})])}catch($t){return p.terminationReason??="other",Promise.all([{error:$t},x,Promise.all(O.map(ge=>_r(ge))),_r($),Js(H,k),Promise.allSettled(ee),Promise.allSettled(G)])}},zm=(e,t,r)=>e.map((n,o)=>n===t.stdio[o]?void 0:Me(n,o,r)),Wm=(e,t)=>e.flatMap(({stdioItems:r},n)=>r.filter(({value:o,stream:i=o})=>C(i,{checkOpen:!1})&&!I(i)).map(({type:o,value:i,stream:s=i})=>Me(s,n,t,{isSameDirection:A.has(o),stopOnExit:o==="native"}))),Vm=async(e,{signal:t})=>{let[r]=await Gm(e,"error",{signal:t});throw r};var Qs=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),Ce=(e,t,r)=>{let n=e[r];n.has(t)||n.set(t,[]);let o=n.get(t),i=L();return o.push(i),{resolve:i.resolve.bind(i),promises:o}},he=async({resolve:e,promises:t},r)=>{e();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...t])]);return!n};import{Readable as Ym}from"stream";import{callbackify as Hm}from"util";import{finished as ea}from"stream/promises";var kr=async e=>{if(e!==void 0)try{await Gr(e)}catch{}},ta=async e=>{if(e!==void 0)try{await zr(e)}catch{}},Gr=async e=>{await ea(e,{cleanup:!0,readable:!1,writable:!0})},zr=async e=>{await ea(e,{cleanup:!0,readable:!0,writable:!1})},Ft=async(e,t)=>{if(await e,t)throw t},Pt=(e,t,r)=>{r&&!Lt(r)?e.destroy(r):t&&e.destroy()};var ra=({subprocess:e,concurrentStreams:t,encoding:r},{from:n,binary:o=!0,preserveNewlines:i=!0}={})=>{let s=o||T.has(r),{subprocessStdout:a,waitReadableDestroy:c}=Wr(e,n,t),{readableEncoding:f,readableObjectMode:l,readableHighWaterMark:d}=Vr(a,s),{read:p,onStdoutDataDone:m}=Yr({subprocessStdout:a,subprocess:e,binary:s,encoding:r,preserveNewlines:i}),u=new Ym({read:p,destroy:Hm(qr.bind(void 0,{subprocessStdout:a,subprocess:e,waitReadableDestroy:c})),highWaterMark:d,objectMode:l,encoding:f});return Hr({subprocessStdout:a,onStdoutDataDone:m,readable:u,subprocess:e}),u},Wr=(e,t,r)=>{let n=ce(e,t),o=Ce(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:o}},Vr=({readableEncoding:e,readableObjectMode:t,readableHighWaterMark:r},n)=>n?{readableEncoding:e,readableObjectMode:t,readableHighWaterMark:r}:{readableEncoding:e,readableObjectMode:!0,readableHighWaterMark:Nr},Yr=({subprocessStdout:e,subprocess:t,binary:r,encoding:n,preserveNewlines:o})=>{let i=L(),s=Bt({subprocessStdout:e,subprocess:t,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:o});return{read(){qm(this,s,i)},onStdoutDataDone:i}},qm=async(e,t,r)=>{try{let{value:n,done:o}=await t.next();o?r.resolve():e.push(n)}catch{}},Hr=async({subprocessStdout:e,onStdoutDataDone:t,readable:r,subprocess:n,subprocessStdin:o})=>{try{await zr(e),await n,await kr(o),await t,r.readable&&r.push(null)}catch(i){await kr(o),na(r,i)}},qr=async({subprocessStdout:e,subprocess:t,waitReadableDestroy:r},n)=>{await he(r,t)&&(na(e,n),await Ft(t,n))},na=(e,t)=>{Pt(e,e.readable,t)};import{Writable as Km}from"stream";import{callbackify as oa}from"util";var ia=({subprocess:e,concurrentStreams:t},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:o,waitWritableDestroy:i}=Kr(e,r,t),s=new Km({...Xr(n,e,o),destroy:oa(Zr.bind(void 0,{subprocessStdin:n,subprocess:e,waitWritableFinal:o,waitWritableDestroy:i})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return Jr(n,s),s},Kr=(e,t,r)=>{let n=Xe(e,t),o=Ce(r,n,"writableFinal"),i=Ce(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:o,waitWritableDestroy:i}},Xr=(e,t,r)=>({write:Xm.bind(void 0,e),final:oa(Jm.bind(void 0,e,t,r))}),Xm=(e,t,r,n)=>{e.write(t,r)?n():e.once("drain",n)},Jm=async(e,t,r)=>{await he(r,t)&&(e.writable&&e.end(),await t)},Jr=async(e,t,r)=>{try{await Gr(e),t.writable&&t.end()}catch(n){await ta(r),sa(t,n)}},Zr=async({subprocessStdin:e,subprocess:t,waitWritableFinal:r,waitWritableDestroy:n},o)=>{await he(r,t),await he(n,t)&&(sa(e,o),await Ft(t,o))},sa=(e,t)=>{Pt(e,e.writable,t)};import{Duplex as Zm}from"stream";import{callbackify as Qm}from"util";var aa=({subprocess:e,concurrentStreams:t,encoding:r},{from:n,to:o,binary:i=!0,preserveNewlines:s=!0}={})=>{let a=i||T.has(r),{subprocessStdout:c,waitReadableDestroy:f}=Wr(e,n,t),{subprocessStdin:l,waitWritableFinal:d,waitWritableDestroy:p}=Kr(e,o,t),{readableEncoding:m,readableObjectMode:u,readableHighWaterMark:g}=Vr(c,a),{read:w,onStdoutDataDone:S}=Yr({subprocessStdout:c,subprocess:e,binary:a,encoding:r,preserveNewlines:s}),x=new Zm({read:w,...Xr(l,e,d),destroy:Qm(eu.bind(void 0,{subprocessStdout:c,subprocessStdin:l,subprocess:e,waitReadableDestroy:f,waitWritableFinal:d,waitWritableDestroy:p})),readableHighWaterMark:g,writableHighWaterMark:l.writableHighWaterMark,readableObjectMode:u,writableObjectMode:l.writableObjectMode,encoding:m});return Hr({subprocessStdout:c,onStdoutDataDone:S,readable:x,subprocess:e,subprocessStdin:l}),Jr(l,x,c),x},eu=async({subprocessStdout:e,subprocessStdin:t,subprocess:r,waitReadableDestroy:n,waitWritableFinal:o,waitWritableDestroy:i},s)=>{await Promise.all([qr({subprocessStdout:e,subprocess:r,waitReadableDestroy:n},s),Zr({subprocessStdin:t,subprocess:r,waitWritableFinal:o,waitWritableDestroy:i},s)])};var Qr=(e,t,{from:r,binary:n=!1,preserveNewlines:o=!1}={})=>{let i=n||T.has(t),s=ce(e,r),a=Bt({subprocessStdout:s,subprocess:e,binary:i,shouldEncode:!0,encoding:t,preserveNewlines:o});return tu(a,s,e)},tu=async function*(e,t,r){try{yield*e}finally{t.readable&&t.destroy(),await r}};var ca=(e,{encoding:t})=>{let r=Qs();e.readable=ra.bind(void 0,{subprocess:e,concurrentStreams:r,encoding:t}),e.writable=ia.bind(void 0,{subprocess:e,concurrentStreams:r}),e.duplex=aa.bind(void 0,{subprocess:e,concurrentStreams:r,encoding:t}),e.iterable=Qr.bind(void 0,e,t),e[Symbol.asyncIterator]=Qr.bind(void 0,e,t,{})};var la=(e,t)=>{for(let[r,n]of nu){let o=n.value.bind(t);Reflect.defineProperty(e,r,{...n,value:o})}},ru=(async()=>{})().constructor.prototype,nu=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(ru,e)]);var fa=(e,t,r,n)=>{let{file:o,commandArguments:i,command:s,escapedCommand:a,startTime:c,verboseInfo:f,options:l,fileDescriptors:d}=su(e,t,r),{subprocess:p,promise:m}=cu({file:o,commandArguments:i,options:l,startTime:c,verboseInfo:f,command:s,escapedCommand:a,fileDescriptors:d});return p.pipe=Ct.bind(void 0,{source:p,sourcePromise:m,boundOptions:{},createNested:n}),la(p,m),F.set(p,{options:l,fileDescriptors:d}),p},su=(e,t,r)=>{let{command:n,escapedCommand:o,startTime:i,verboseInfo:s}=Ge(e,t,r),{file:a,commandArguments:c,options:f}=at(e,t,r),l=au(f),d=Es(l,s);return{file:a,commandArguments:c,command:n,escapedCommand:o,startTime:i,verboseInfo:s,options:l,fileDescriptors:d}},au=({timeout:e,signal:t,...r})=>{if(t!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:e}},cu=({file:e,commandArguments:t,options:r,startTime:n,verboseInfo:o,command:i,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=iu(...ct(e,t,r))}catch(u){return ys({error:u,command:i,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:o})}let f=new AbortController;ou(Number.POSITIVE_INFINITY,f.signal);let l=[...c.stdio];Bs(c,a,f),Ls(c,r,f);let d={},p=L();c.kill=Yn.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:p,context:d,controller:f}),c.all=Ys(c,r),ca(c,r),hs(c,r);let m=lu({subprocess:c,options:r,startTime:n,verboseInfo:o,fileDescriptors:a,originalStreams:l,command:i,escapedCommand:s,context:d,onInternalError:p,controller:f});return{subprocess:c,promise:m}},lu=async({subprocess:e,options:t,startTime:r,verboseInfo:n,fileDescriptors:o,originalStreams:i,command:s,escapedCommand:a,context:c,onInternalError:f,controller:l})=>{let[d,[p,m],u,g,w]=await Zs({subprocess:e,options:t,context:c,verboseInfo:n,fileDescriptors:o,originalStreams:i,onInternalError:f,controller:l});l.abort(),f.resolve();let S=u.map((O,$)=>v(O,t,$)),x=v(g,t,"all"),E=fu({errorInfo:d,exitCode:p,signal:m,stdio:S,all:x,ipcOutput:w,context:c,options:t,command:s,escapedCommand:a,startTime:r});return pe(E,n,t)},fu=({errorInfo:e,exitCode:t,signal:r,stdio:n,all:o,ipcOutput:i,context:s,options:a,command:c,escapedCommand:f,startTime:l})=>"error"in e?Oe({error:e.error,command:c,escapedCommand:f,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:e.error instanceof P,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:t,signal:r,stdio:n,all:o,ipcOutput:i,options:a,startTime:l,isSync:!1}):St({command:c,escapedCommand:f,stdio:n,all:o,ipcOutput:i,options:a,startTime:l});var Ut=(e,t)=>{let r=Object.fromEntries(Object.entries(t).map(([n,o])=>[n,du(n,e[n],o)]));return{...e,...r}},du=(e,t,r)=>pu.has(e)&&y(t)&&y(r)?{...t,...r}:r,pu=new Set(["env",...Wt]);var Y=(e,t,r,n)=>{let o=(s,a,c)=>Y(s,a,r,c),i=(...s)=>mu({mapArguments:e,deepOptions:r,boundOptions:t,setBoundExeca:n,createNested:o},...s);return n!==void 0&&n(i,o,t),i},mu=({mapArguments:e,deepOptions:t={},boundOptions:r={},setBoundExeca:n,createNested:o},i,...s)=>{if(y(i))return o(e,Ut(r,i),n);let{file:a,commandArguments:c,options:f,isSync:l}=uu({mapArguments:e,firstArgument:i,nextArguments:s,deepOptions:t,boundOptions:r});return l?ls(a,c,f):fa(a,c,f,o)},uu=({mapArguments:e,firstArgument:t,nextArguments:r,deepOptions:n,boundOptions:o})=>{let i=ln(t)?fn(t,r):[t,...r],[s,a,c]=Be(...i),f=Ut(Ut(n,o),c),{file:l=s,commandArguments:d=a,options:p=f,isSync:m=!1}=e({file:s,commandArguments:a,options:f});return{file:l,commandArguments:d,options:p,isSync:m}};var da=({file:e,commandArguments:t})=>ma(e,t),pa=({file:e,commandArguments:t})=>({...ma(e,t),isSync:!0}),ma=(e,t)=>{if(t.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${e} ${t}.`);let[r,...n]=ua(e);return{file:r,commandArguments:n}},ua=e=>{if(typeof e!="string")throw new TypeError(`The command must be a string: ${String(e)}.`);let t=e.trim();if(t==="")return[];let r=[];for(let n of t.split(hu)){let o=r.at(-1);o&&o.endsWith("\\")?r[r.length-1]=`${o.slice(0,-1)} ${n}`:r.push(n)}return r},hu=/ +/g;var ha=(e,t,r)=>{e.sync=t(gu,r),e.s=e.sync},ga=({options:e})=>Sa(e),gu=({options:e})=>({...Sa(e),isSync:!0}),Sa=e=>({options:{...Su(e),...e}}),Su=({input:e,inputFile:t,stdio:r})=>e===void 0&&t===void 0&&r===void 0?{stdin:"inherit"}:{},ya={preferLocal:!0};var VO=Y(()=>({})),YO=Y(()=>({isSync:!0})),HO=Y(da),qO=Y(pa),KO=Y(Co),XO=Y(ga,{},ya,ha),{sendMessage:JO,getOneMessage:ZO,getEachMessage:QO,getCancelSignal:eD}=gs();export{XO as $,oe as ExecaError,ie as ExecaSyncError,VO as execa,HO as execaCommand,qO as execaCommandSync,KO as execaNode,YO as execaSync,eD as getCancelSignal,QO as getEachMessage,ZO as getOneMessage,ua as parseCommandString,JO as sendMessage};
|