@nice-move/cli 0.11.33 → 0.12.0

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.
@@ -0,0 +1,63 @@
1
+ import{n as e}from"./rolldown-runtime-9nwCUaSw.mjs";import{fileURLToPath as t}from"node:url";import{ChildProcess as n,execFile as r,spawn as i,spawnSync as a}from"node:child_process";import o,{execArgv as s,execPath as c,hrtime as l,platform as u}from"node:process";import{aborted as d,callbackify as f,debuglog as p,inspect as m,promisify as h,stripVTControlCharacters as g}from"node:util";import{StringDecoder as _}from"node:string_decoder";import v from"node:tty";import y from"node:path";import{scheduler as b,setImmediate as x,setTimeout as S}from"node:timers/promises";import{constants as C}from"node:os";import{EventEmitter as ee,addAbortListener as w,on as T,once as E,setMaxListeners as te}from"node:events";import{serialize as ne}from"node:v8";import re,{appendFileSync as ie,closeSync as ae,createReadStream as oe,createWriteStream as se,openSync as ce,readFileSync as le,readSync as ue,statSync as de,writeFileSync as fe}from"node:fs";import{Buffer as D}from"node:buffer";import"node:fs/promises";import{finished as O}from"node:stream/promises";import{Duplex as k,PassThrough as pe,Readable as A,Transform as me,Writable as j,getDefaultHighWaterMark as he}from"node:stream";import ge from"node:path/win32";function M(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}const _e=(e,t)=>{let n=be(ve(e));if(typeof n!=`string`)throw TypeError(`${t} must be a string or a file URL: ${n}.`);return n},ve=e=>ye(e)?e.toString():e,ye=e=>typeof e!=`string`&&e&&Object.getPrototypeOf(e)===String.prototype,be=e=>e instanceof URL?t(e):e,xe=(e,t=[],n,...r)=>{if(r.length>0)throw TypeError(`Execa accepts at most three arguments: file, arguments, options.`);if(n!==void 0&&M(t))throw TypeError(`Execa accepts at most one options object. Please merge the second and third arguments.`);let i=_e(e,`First argument`),[a,o={}]=M(t)?[[],t]:[t,n];if(!Array.isArray(a))throw TypeError(`Second argument must be either an array of arguments or an options object: ${a}`);if(a.some(e=>typeof e==`object`&&!!e))throw TypeError(`Second argument must be an array of strings: ${a}`);let s=a.map(String),c=s.find(e=>e.includes(`\0`));if(c!==void 0)throw TypeError(`Arguments cannot contain null bytes ("\\0"): ${c}`);if(!M(o))throw TypeError(`Last argument must be an options object: ${o}`);return[i,s,{__proto__:null,...o}]},Se=(e,t,n)=>{let r=[e,...t],i=r.join(` `);return{command:i,escapedCommand:n?we(i):r.map(e=>Oe(we(e))).join(` `)}},Ce=e=>g(e).split(`
2
+ `).map(e=>we(e)).join(`
3
+ `),we=e=>e.replaceAll(Ee,e=>Te(e)),Te=e=>{let t=De[e];if(t!==void 0)return t;let n=e.codePointAt(0),r=n.toString(16);return n<=65535?`\\u${r.padStart(4,`0`)}`:`\\U${r}`},Ee=(()=>{try{return/* @__PURE__ */ RegExp(`\\p{Separator}|\\p{Other}`,`gu`)}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}})(),De={" ":` `,"\b":`\\b`,"\f":`\\f`,"\n":`\\n`,"\r":`\\r`," ":`\\t`},Oe=e=>ke.test(e)?e:u===`win32`?`"${e.replaceAll(`"`,`""`)}"`:`'${e.replaceAll(`'`,`'\\''`)}'`,ke=/^[\w\-./]+$/,{toString:Ae}=Object.prototype,je=e=>Ae.call(e)===`[object ArrayBuffer]`,N=e=>Ae.call(e)===`[object Uint8Array]`,P=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),Me=new TextEncoder,Ne=e=>Me.encode(e),Pe=new TextDecoder,Fe=e=>Pe.decode(e),Ie=(e,t)=>Le(e,t).join(``),Le=(e,t)=>{if(t===`utf8`&&e.every(e=>typeof e==`string`))return e;let n=new _(t),r=e.map(e=>typeof e==`string`?Ne(e):e).map(e=>n.write(e)),i=n.end();return i===``?r:[...r,i]},Re=e=>e.length===1&&N(e[0])?e[0]:Be(ze(e)),ze=e=>e.map(e=>typeof e==`string`?Ne(e):e),Be=e=>{let t=new Uint8Array(Ve(e)),n=0;for(let r of e)t.set(r,n),n+=r.length;return t},Ve=e=>{let t=0;for(let n of e)t+=n.length;return t},He=(e,t,n)=>new(n?Ye:Je)(t,e instanceof Ue?{}:{cause:e});var Ue=class extends Error{};const We=(e,t)=>{Object.defineProperties(e.prototype,{name:{value:t,writable:!0,enumerable:!1,configurable:!0},[Ke]:{value:!0,writable:!1,enumerable:!1,configurable:!1}})},Ge=e=>qe(e)&&Ke in e,Ke=Symbol(`isExecaError`),qe=e=>e instanceof Error||Object.prototype.toString.call(e)===`[object Error]`;var Je=class extends Error{};We(Je,Je.name);var Ye=class extends Error{};We(Ye,Ye.name);const Xe=e=>e===null?`null`:typeof e,Ze=e=>Array.isArray(e)&&Array.isArray(e.raw),Qe=(e,t)=>{let n=[],r=!1;for(let[i,a]of e.entries())({tokens:n,isSeparated:r}=$e({templates:e,expressions:t,tokens:n,isSeparated:r,index:i,template:a}));if(n.length===0)throw TypeError(`Template script must not be empty`);let[i,...a]=n;return[i,a,{}]},$e=({templates:e,expressions:t,tokens:n,isSeparated:r,index:i,template:a})=>{if(a===void 0)throw TypeError(`Invalid backslash sequence: ${e.raw[i]}`);let{nextTokens:o,leadingWhitespaces:s,trailingWhitespaces:c}=et(a,e.raw[i]),l=it(n,o,r||s),u=c||o.length===0&&r;if(i===t.length)return{tokens:l,isSeparated:u};let d=t[i],f=Array.isArray(d)?d.map(e=>at(e)):[at(d)];return{tokens:it(l,f,u),isSeparated:f.length===0&&u}},et=(e,t)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let n=[],r=0,i=!1;for(let a=0,o=0;a<e.length;a+=1,o+=1){let s=t[o];if(nt.has(s))a===0&&(i=!0),r!==a&&n.push(e.slice(r,a)),r=a+1;else if(s===`\\`){let e=t[o+1];if(e===`
4
+ `)--a,o+=1;else if(e===`u`&&t[o+2]===`{`){let e=t.indexOf(`}`,o+3);tt(t.slice(o+3,e))&&(a+=1),o=e}else o+=rt[e]??1}}let a=r===e.length;return a||n.push(e.slice(r)),{nextTokens:n,leadingWhitespaces:i,trailingWhitespaces:a}},tt=e=>Number.parseInt(e,16)>65535,nt=/* @__PURE__ */ new Set([` `,` `,`\r`,`
5
+ `]),rt={x:3,u:5},it=(e,t,n)=>n||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t[0]}`,...t.slice(1)],at=e=>{let t=Xe(e);if(t===`string`)return e;if(t===`number`)return String(e);if((M(e)||Ge(e))&&(Object.hasOwn(e,`stdout`)||Object.hasOwn(e,`isMaxBuffer`)))return ot(e);throw e instanceof n||Object.prototype.toString.call(e)===`[object Promise]`?TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):TypeError(`Unexpected "${t}" in template expression`)},ot=e=>{let t=Object.hasOwn(e,`stdout`)?e.stdout:void 0;if(typeof t==`string`)return t;if(N(t))return Fe(t);throw TypeError(t===void 0?`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`:`Unexpected "${Xe(t)}" stdout in template expression`)},F=e=>st.includes(e),st=[o.stdin,o.stdout,o.stderr],I=[`stdin`,`stdout`,`stderr`],ct=e=>I[e]??`stdio[${e}]`,lt=Symbol(`execa.allStream`),ut=e=>Object.assign(e,{[lt]:!0}),dt=e=>e?.[lt]===!0,L=(e={})=>{if(e===null)throw TypeError("The options must be an object, not `null`.");return{__proto__:null,...e}},R=(e,t)=>{if(e!==void 0&&typeof e!=`boolean`)throw TypeError(`The \`${t}\` option must use a boolean.`)},ft=e=>{let t={__proto__:null,...e};for(let n of Et)t[n]=pt(e,n);return t},pt=(e,t)=>{let n=mt(e),r=Array.from({length:n+1}),i=ht(e[t],r,t,n);return St(i,t)},mt=({stdio:e})=>Array.isArray(e)?Math.max(e.length,I.length):I.length,ht=(e,t,n,r)=>M(e)?gt(e,t,n,r):(wt(e,n),t.fill(e)),gt=(e,t,n,r)=>{for(let i of Object.keys(e).sort(_t)){wt(e[i],n,`${n}.${i}`);for(let a of yt(i,n,r))t[a]=e[i]}return t},_t=(e,t)=>vt(e)<vt(t)?1:-1,vt=e=>e===`stdout`||e===`stderr`?0:e===`all`?2:1,yt=(e,t,n)=>{if(e===`ipc`)return[n];let r=bt(e);if(r===void 0||r===0)throw TypeError(`"${t}.${e}" is invalid.
6
+ It must be "${t}.stdout", "${t}.stderr", "${t}.all", "${t}.ipc", or "${t}.fd3", "${t}.fd4" (and so on).`);if(r!==`all`&&r>=n)throw TypeError(`"${t}.${e}" is invalid: that file descriptor does not exist.
7
+ Please set the "stdio" option to ensure that file descriptor exists.`);return r===`all`?[1,2]:[r]},bt=e=>{if(e===`all`)return e;if(I.includes(e))return I.indexOf(e);let t=xt.exec(e);if(t!==null)return Number(t.groups.fdNumber)},xt=/^fd(?<fdNumber>\d+)$/,St=(e,t)=>e.map(e=>e===void 0?Tt[t]:e),Ct=/* @__PURE__ */ new Set([`lines`,`buffer`,`stripFinalNewline`]),wt=(e,t,n=t)=>{if(Ct.has(t))R(e,n);else if(t===`maxBuffer`&&e!==void 0&&(typeof e!=`number`||Number.isNaN(e)))throw TypeError(`The \`${n}\` option must use a number.`)},Tt={lines:!1,buffer:!0,maxBuffer:1e8,verbose:p(`execa`).enabled?`full`:`none`,stripFinalNewline:!0},Et=[`lines`,`buffer`,`maxBuffer`,`verbose`,`stripFinalNewline`],Dt=(e,t)=>t===`ipc`?e.at(-1):e[t],Ot=({verbose:e},t)=>jt(e,t)!==`none`,kt=({verbose:e},t)=>![`none`,`short`].includes(jt(e,t)),At=({verbose:e},t)=>{let n=jt(e,t);return Nt(n)?n:void 0},jt=(e,t)=>t===void 0?Mt(e):Dt(e,t),Mt=e=>e.find(e=>Nt(e))??Pt.findLast(t=>e.includes(t)),Nt=e=>typeof e==`function`,Pt=[`none`,`short`,`full`];function Ft(){let{env:e}=o,{TERM:t,TERM_PROGRAM:n}=e;return o.platform===`win32`?!!e.WT_SESSION||!!e.TERMINUS_SUBLIME||e.ConEmuTask===`{cmd::Cmder}`||n===`Terminus-Sublime`||n===`vscode`||t===`xterm-256color`||t===`alacritty`||t===`rxvt-unicode`||t===`rxvt-unicode-256color`||e.TERMINAL_EMULATOR===`JetBrains-JediTerm`:t!==`linux`}const It={circleQuestionMark:`(?)`,questionMarkPrefix:`(?)`,square:`█`,squareDarkShade:`▓`,squareMediumShade:`▒`,squareLightShade:`░`,squareTop:`▀`,squareBottom:`▄`,squareLeft:`▌`,squareRight:`▐`,squareCenter:`■`,bullet:`●`,dot:`․`,ellipsis:`…`,pointerSmall:`›`,triangleUp:`▲`,triangleUpSmall:`▴`,triangleDown:`▼`,triangleDownSmall:`▾`,triangleLeftSmall:`◂`,triangleRightSmall:`▸`,home:`⌂`,heart:`♥`,musicNote:`♪`,musicNoteBeamed:`♫`,arrowUp:`↑`,arrowDown:`↓`,arrowLeft:`←`,arrowRight:`→`,arrowLeftRight:`↔`,arrowUpDown:`↕`,almostEqual:`≈`,notEqual:`≠`,lessOrEqual:`≤`,greaterOrEqual:`≥`,identical:`≡`,infinity:`∞`,subscriptZero:`₀`,subscriptOne:`₁`,subscriptTwo:`₂`,subscriptThree:`₃`,subscriptFour:`₄`,subscriptFive:`₅`,subscriptSix:`₆`,subscriptSeven:`₇`,subscriptEight:`₈`,subscriptNine:`₉`,oneHalf:`½`,oneThird:`⅓`,oneQuarter:`¼`,oneFifth:`⅕`,oneSixth:`⅙`,oneEighth:`⅛`,twoThirds:`⅔`,twoFifths:`⅖`,threeQuarters:`¾`,threeFifths:`⅗`,threeEighths:`⅜`,fourFifths:`⅘`,fiveSixths:`⅚`,fiveEighths:`⅝`,sevenEighths:`⅞`,line:`─`,lineBold:`━`,lineDouble:`═`,lineDashed0:`┄`,lineDashed1:`┅`,lineDashed2:`┈`,lineDashed3:`┉`,lineDashed4:`╌`,lineDashed5:`╍`,lineDashed6:`╴`,lineDashed7:`╶`,lineDashed8:`╸`,lineDashed9:`╺`,lineDashed10:`╼`,lineDashed11:`╾`,lineDashed12:`−`,lineDashed13:`–`,lineDashed14:`‐`,lineDashed15:`⁃`,lineVertical:`│`,lineVerticalBold:`┃`,lineVerticalDouble:`║`,lineVerticalDashed0:`┆`,lineVerticalDashed1:`┇`,lineVerticalDashed2:`┊`,lineVerticalDashed3:`┋`,lineVerticalDashed4:`╎`,lineVerticalDashed5:`╏`,lineVerticalDashed6:`╵`,lineVerticalDashed7:`╷`,lineVerticalDashed8:`╹`,lineVerticalDashed9:`╻`,lineVerticalDashed10:`╽`,lineVerticalDashed11:`╿`,lineDownLeft:`┐`,lineDownLeftArc:`╮`,lineDownBoldLeftBold:`┓`,lineDownBoldLeft:`┒`,lineDownLeftBold:`┑`,lineDownDoubleLeftDouble:`╗`,lineDownDoubleLeft:`╖`,lineDownLeftDouble:`╕`,lineDownRight:`┌`,lineDownRightArc:`╭`,lineDownBoldRightBold:`┏`,lineDownBoldRight:`┎`,lineDownRightBold:`┍`,lineDownDoubleRightDouble:`╔`,lineDownDoubleRight:`╓`,lineDownRightDouble:`╒`,lineUpLeft:`┘`,lineUpLeftArc:`╯`,lineUpBoldLeftBold:`┛`,lineUpBoldLeft:`┚`,lineUpLeftBold:`┙`,lineUpDoubleLeftDouble:`╝`,lineUpDoubleLeft:`╜`,lineUpLeftDouble:`╛`,lineUpRight:`└`,lineUpRightArc:`╰`,lineUpBoldRightBold:`┗`,lineUpBoldRight:`┖`,lineUpRightBold:`┕`,lineUpDoubleRightDouble:`╚`,lineUpDoubleRight:`╙`,lineUpRightDouble:`╘`,lineUpDownLeft:`┤`,lineUpBoldDownBoldLeftBold:`┫`,lineUpBoldDownBoldLeft:`┨`,lineUpDownLeftBold:`┥`,lineUpBoldDownLeftBold:`┩`,lineUpDownBoldLeftBold:`┪`,lineUpDownBoldLeft:`┧`,lineUpBoldDownLeft:`┦`,lineUpDoubleDownDoubleLeftDouble:`╣`,lineUpDoubleDownDoubleLeft:`╢`,lineUpDownLeftDouble:`╡`,lineUpDownRight:`├`,lineUpBoldDownBoldRightBold:`┣`,lineUpBoldDownBoldRight:`┠`,lineUpDownRightBold:`┝`,lineUpBoldDownRightBold:`┡`,lineUpDownBoldRightBold:`┢`,lineUpDownBoldRight:`┟`,lineUpBoldDownRight:`┞`,lineUpDoubleDownDoubleRightDouble:`╠`,lineUpDoubleDownDoubleRight:`╟`,lineUpDownRightDouble:`╞`,lineDownLeftRight:`┬`,lineDownBoldLeftBoldRightBold:`┳`,lineDownLeftBoldRightBold:`┯`,lineDownBoldLeftRight:`┰`,lineDownBoldLeftBoldRight:`┱`,lineDownBoldLeftRightBold:`┲`,lineDownLeftRightBold:`┮`,lineDownLeftBoldRight:`┭`,lineDownDoubleLeftDoubleRightDouble:`╦`,lineDownDoubleLeftRight:`╥`,lineDownLeftDoubleRightDouble:`╤`,lineUpLeftRight:`┴`,lineUpBoldLeftBoldRightBold:`┻`,lineUpLeftBoldRightBold:`┷`,lineUpBoldLeftRight:`┸`,lineUpBoldLeftBoldRight:`┹`,lineUpBoldLeftRightBold:`┺`,lineUpLeftRightBold:`┶`,lineUpLeftBoldRight:`┵`,lineUpDoubleLeftDoubleRightDouble:`╩`,lineUpDoubleLeftRight:`╨`,lineUpLeftDoubleRightDouble:`╧`,lineUpDownLeftRight:`┼`,lineUpBoldDownBoldLeftBoldRightBold:`╋`,lineUpDownBoldLeftBoldRightBold:`╈`,lineUpBoldDownLeftBoldRightBold:`╇`,lineUpBoldDownBoldLeftRightBold:`╊`,lineUpBoldDownBoldLeftBoldRight:`╉`,lineUpBoldDownLeftRight:`╀`,lineUpDownBoldLeftRight:`╁`,lineUpDownLeftBoldRight:`┽`,lineUpDownLeftRightBold:`┾`,lineUpBoldDownBoldLeftRight:`╂`,lineUpDownLeftBoldRightBold:`┿`,lineUpBoldDownLeftBoldRight:`╃`,lineUpBoldDownLeftRightBold:`╄`,lineUpDownBoldLeftBoldRight:`╅`,lineUpDownBoldLeftRightBold:`╆`,lineUpDoubleDownDoubleLeftDoubleRightDouble:`╬`,lineUpDoubleDownDoubleLeftRight:`╫`,lineUpDownLeftDoubleRightDouble:`╪`,lineCross:`╳`,lineBackslash:`╲`,lineSlash:`╱`},Lt={tick:`✔`,info:`ℹ`,warning:`⚠`,cross:`✘`,squareSmall:`◻`,squareSmallFilled:`◼`,circle:`◯`,circleFilled:`◉`,circleDotted:`◌`,circleDouble:`◎`,circleCircle:`ⓞ`,circleCross:`ⓧ`,circlePipe:`Ⓘ`,radioOn:`◉`,radioOff:`◯`,checkboxOn:`☒`,checkboxOff:`☐`,checkboxCircleOn:`ⓧ`,checkboxCircleOff:`Ⓘ`,pointer:`❯`,triangleUpOutline:`△`,triangleLeft:`◀`,triangleRight:`▶`,lozenge:`◆`,lozengeOutline:`◇`,hamburger:`☰`,smiley:`㋡`,mustache:`෴`,star:`★`,play:`▶`,nodejs:`⬢`,oneSeventh:`⅐`,oneNinth:`⅑`,oneTenth:`⅒`},Rt={tick:`√`,info:`i`,warning:`‼`,cross:`×`,squareSmall:`□`,squareSmallFilled:`■`,circle:`( )`,circleFilled:`(*)`,circleDotted:`( )`,circleDouble:`( )`,circleCircle:`(○)`,circleCross:`(×)`,circlePipe:`(│)`,radioOn:`(*)`,radioOff:`( )`,checkboxOn:`[×]`,checkboxOff:`[ ]`,checkboxCircleOn:`(×)`,checkboxCircleOff:`( )`,pointer:`>`,triangleUpOutline:`∆`,triangleLeft:`◄`,triangleRight:`►`,lozenge:`♦`,lozengeOutline:`◊`,hamburger:`≡`,smiley:`☺`,mustache:`┌─┐`,star:`✶`,play:`►`,nodejs:`♦`,oneSeventh:`1/7`,oneNinth:`1/9`,oneTenth:`1/10`},zt={...It,...Lt},Bt={...It,...Rt},Vt=Ft()?zt:Bt;Object.entries(Lt);const Ht=v?.WriteStream?.prototype?.hasColors?.()??!1,z=(e,t)=>{if(!Ht)return e=>e;let n=`\u001B[${e}m`,r=`\u001B[${t}m`;return e=>{let i=e+``,a=i.indexOf(r);if(a===-1)return n+i+r;let o=n,s=0,c=(t===22?r:``)+n;for(;a!==-1;)o+=i.slice(s,a)+c,s=a+r.length,a=i.indexOf(r,s);return o+=i.slice(s)+r,o}};z(0,0);const Ut=z(1,22);z(2,22),z(3,23),z(4,24),z(`4:2`,24),z(`4:3`,24),z(`4:4`,24),z(`4:5`,24),z(53,55),z(7,27),z(8,28),z(9,29),z(30,39),z(31,39),z(32,39),z(33,39),z(34,39),z(35,39),z(36,39),z(37,39);const Wt=z(90,39);z(40,49),z(41,49),z(42,49),z(43,49),z(44,49),z(45,49),z(46,49),z(47,49),z(100,49);const Gt=z(91,39);z(92,39);const Kt=z(93,39);z(94,39),z(95,39),z(96,39),z(97,39),z(101,49),z(102,49),z(103,49),z(104,49),z(105,49),z(106,49),z(107,49),z(`58;5;0`,59),z(`58;5;1`,59),z(`58;5;2`,59),z(`58;5;3`,59),z(`58;5;4`,59),z(`58;5;5`,59),z(`58;5;6`,59),z(`58;5;7`,59),z(`58;5;8`,59),z(`58;5;9`,59),z(`58;5;10`,59),z(`58;5;11`,59),z(`58;5;12`,59),z(`58;5;13`,59),z(`58;5;14`,59),z(`58;5;15`,59);const qt=o.env.FORCE_COLOR!==void 0||o.stderr.isTTY===!0,Jt=e=>e,Yt=e=>qt?e:Jt,Xt=Yt(Wt),Zt=Yt(Ut),Qt=Yt(Gt),$t=Yt(Kt),en=({type:e,message:t,timestamp:n,piped:r,commandId:i,result:{failed:a=!1}={},options:{reject:o=!0}})=>{let s=tn(n),c=an[e]({failed:a,reject:o,piped:r}),l=on[e]({reject:o});return`${Xt(`[${s}]`)} ${Xt(`[${i}]`)} ${l(c)} ${l(t)}`},tn=e=>`${nn(e.getHours(),2)}:${nn(e.getMinutes(),2)}:${nn(e.getSeconds(),2)}.${nn(e.getMilliseconds(),3)}`,nn=(e,t)=>String(e).padStart(t,`0`),rn=({failed:e,reject:t})=>e?t?Vt.cross:Vt.warning:Vt.tick,an={command:({piped:e})=>e?`|`:`$`,output:()=>` `,ipc:()=>`*`,error:rn,duration:rn},on={command:()=>Zt,output:()=>Jt,ipc:()=>Jt,error:({reject:e})=>e?Qt:$t,duration:()=>Xt},sn=(e,t,n)=>{let r=At(t,n);return e.map(({verboseLine:e,verboseObject:t})=>cn(e,t,r)).filter(e=>e!==void 0).map(e=>ln(e)).join(``)},cn=(e,t,n)=>{if(n===void 0)return e;let r=n(e,t);if(typeof r==`string`)return r},ln=e=>e.endsWith(`
8
+ `)?e:`${e}\n`,un=({type:e,verboseMessage:t,fdNumber:n,verboseInfo:r,result:i})=>{let a=dn({type:e,result:i,verboseInfo:r}),o=fn(t,a),s=sn(o,r,n);s!==``&&console.warn(s.slice(0,-1))},dn=({type:e,result:t,verboseInfo:n})=>{let{escapedCommand:r,commandId:i,rawOptions:a}=n,{piped:o=!1,...s}=a;return{type:e,escapedCommand:r,commandId:`${i}`,timestamp:/* @__PURE__ */ new Date,piped:o,result:t,options:s}},fn=(e,t)=>e.split(`
9
+ `).map(e=>pn({...t,message:e})),pn=e=>({verboseLine:en(e),verboseObject:e}),mn=e=>{let t=typeof e==`string`?e:m(e);return Ce(t)},hn=(e,t)=>{Ot(t)&&un({type:`command`,verboseMessage:e,verboseInfo:t})},gn=(e,t,n)=>(yn(e),{verbose:e,escapedCommand:t,commandId:_n(e),rawOptions:n}),_n=e=>Ot({verbose:e})?vn++:void 0;let vn=0n;const yn=e=>{for(let t of e){if(t===!1)throw TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(t===!0)throw TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!Pt.includes(t)&&!Nt(t)){let e=Pt.map(e=>`'${e}'`).join(`, `);throw TypeError(`The "verbose" option must not be ${t}. Allowed values are: ${e} or a function.`)}}},bn=()=>l.bigint(),xn=e=>Number(l.bigint()-e)/1e6,Sn=(e,t,n)=>{let r=bn(),{command:i,escapedCommand:a}=Se(e,t,n.shell&&!n.node),o=pt(n,`verbose`),s=gn(o,a,{__proto__:null,...n});return hn(a,s),{command:i,escapedCommand:a,startTime:r,verboseInfo:s}};function Cn(e={}){let{env:t=process.env,platform:n=process.platform}=e;return n===`win32`?Object.keys(t).reverse().find(e=>e.toUpperCase()===`PATH`)||`Path`:`PATH`}h(r);function wn(e){return e instanceof URL?t(e):e}function Tn(e){return{*[Symbol.iterator](){let t=y.resolve(wn(e)),n;for(;n!==t;)yield t,n=t,t=y.resolve(t,`..`)}}}const En=({cwd:e=o.cwd(),path:t=o.env[Cn()],preferLocal:n=!0,execPath:r=o.execPath,addExecPath:i=!0}={})=>{let a=y.resolve(wn(e)),s=[],c=t.split(y.delimiter);return n&&Dn(s,c,a),i&&On(s,c,r,a),t===``||t===y.delimiter?`${s.join(y.delimiter)}${t}`:[...s,t].join(y.delimiter)},Dn=(e,t,n)=>{for(let r of Tn(n)){let n=y.join(r,`node_modules/.bin`);t.includes(n)||e.push(n)}},On=(e,t,n,r)=>{let i=y.resolve(r,wn(n),`..`);t.includes(i)||e.push(i)},kn=({env:e=o.env,...t}={})=>{e={...e};let n=Cn({env:e});return t.path=e[n],e[n]=En(t),e},An=()=>{let e=64-Mn+1;return Array.from({length:e},jn)},jn=(e,t)=>({name:`SIGRT${t+1}`,number:Mn+t,action:`terminate`,description:`Application-specific signal (realtime)`,standard:`posix`}),Mn=34,Nn=[{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`}],Pn=()=>{let e=An();return[...Nn,...e].map(Fn)},Fn=({name:e,number:t,description:n,action:r,forced:i=!1,standard:a})=>{let{signals:{[e]:o}}=C,s=o!==void 0;return{name:e,number:s?o:t,description:n,supported:s,action:r,forced:i,standard:a}},In=()=>{let e=Pn();return Object.fromEntries(e.map(Ln))},Ln=({name:e,number:t,description:n,supported:r,action:i,forced:a,standard:o})=>[e,{name:e,number:t,description:n,supported:r,action:i,forced:a,standard:o}],Rn=In(),zn=()=>{let e=Pn(),t=Array.from({length:65},(t,n)=>Bn(n,e));return Object.assign({},...t)},Bn=(e,t)=>{let n=Vn(e,t);if(n===void 0)return{};let{name:r,description:i,supported:a,action:o,forced:s,standard:c}=n;return{[e]:{name:r,number:e,description:i,supported:a,action:o,forced:s,standard:c}}},Vn=(e,t)=>{let n=t.find(({name:t})=>C.signals[t]===e);return n===void 0?t.find(t=>t.number===e):n};zn();const Hn=e=>{let t="option `killSignal`";if(e===0)throw TypeError(`Invalid ${t}: 0 cannot be used.`);return Wn(e,t)},Un=e=>e===0?e:Wn(e,"`subprocess.kill()`'s argument"),Wn=(e,t)=>{if(Number.isInteger(e))return Gn(e,t);if(typeof e==`string`)return qn(e,t);throw TypeError(`Invalid ${t} ${String(e)}: it must be a string or an integer.\n${Jn()}`)},Gn=(e,t)=>{if(Kn.has(e))return Kn.get(e);throw TypeError(`Invalid ${t} ${e}: this signal integer does not exist.\n${Jn()}`)},Kn=new Map(Object.entries(C.signals).reverse().map(([e,t])=>[t,e])),qn=(e,t)=>{if(e in C.signals)return e;throw e.toUpperCase()in C.signals?TypeError(`Invalid ${t} '${e}': please rename it to '${e.toUpperCase()}'.`):TypeError(`Invalid ${t} '${e}': this signal name does not exist.\n${Jn()}`)},Jn=()=>`Available signal names: ${Yn()}.
10
+ Available signal numbers: ${Xn()}.`,Yn=()=>Object.keys(C.signals).sort().map(e=>`'${e}'`).join(`, `),Xn=()=>[...new Set(Object.values(C.signals).sort((e,t)=>e-t))].join(`, `),Zn=e=>Rn[e].description,Qn=({timeout:e})=>{e!==void 0&&$n(e,`timeout`)},$n=(e,t)=>{if(!Number.isInteger(e)||e<0||e>er)throw TypeError(`Expected the \`${t}\` option to be a non-negative integer up to ${er}, got \`${e}\` (${Xe(e)})`)},er=2**31-1,tr=(e,t,n,r)=>t===0||t===void 0?[]:[nr(e,t,n,r)],nr=async(e,t,n,{signal:r})=>{throw await S(t,void 0,{signal:r}),n.terminationReason??=`timeout`,e(),new Ue},rr=e=>e===!1?e:e===!0?ir:($n(e,`forceKillAfterDelay`),e),ir=5e3,ar=({kill:e,options:{forceKillAfterDelay:t,killSignal:n},onInternalError:r,context:i,controller:a},o,s)=>{let{signal:c,error:l}=or(o,s,n);sr(l,r);let u=e(c);return cr({kill:e,signal:c,forceKillAfterDelay:t,killSignal:n,killResult:u,context:i,controller:a}),u},or=(e,t,n)=>{let[r=n,i]=qe(e)?[void 0,e]:[e,t];if(typeof r!=`string`&&!Number.isInteger(r))throw TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(r)}`);if(i!==void 0&&!qe(i))throw TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:Un(r),error:i}},sr=(e,t)=>{e!==void 0&&t.reject(e)},cr=async({kill:e,signal:t,forceKillAfterDelay:n,killSignal:r,killResult:i,context:a,controller:o})=>{t===r&&i&&lr({kill:e,forceKillAfterDelay:n,context:a,controllerSignal:o.signal})},lr=async({kill:e,forceKillAfterDelay:t,context:n,controllerSignal:r})=>{if(t!==!1)try{await S(t,void 0,{signal:r}),e(`SIGKILL`)&&(n.isForcefullyTerminated??=!0)}catch{}},ur=async(e,t)=>{e.aborted||await E(e,`abort`,{signal:t})},dr=(e,t)=>{if(e!==void 0&&Object.prototype.toString.call(e)!==`[object AbortSignal]`)throw TypeError(`The \`${t}\` option must be an AbortSignal: ${String(e)}.`)},fr=({cancelSignal:e})=>{dr(e,`cancelSignal`)},pr=({signal:e})=>{if(e!==void 0)throw TypeError(`The "signal" option has been renamed to "cancelSignal" instead.`)},mr=({kill:e,cancelSignal:t,gracefulCancel:n,context:r,controller:i})=>t===void 0||n?[]:[hr(e,t,r,i)],hr=async(e,t,n,{signal:r})=>{throw await ur(t,r),n.terminationReason??=`cancel`,e(),t.reason},gr=({methodName:e,isSubprocess:t,ipc:n,isConnected:r})=>{_r(e,t,n),vr(e,t,r)},_r=(e,t,n)=>{if(!n)throw Error(`${B(e,t)} can only be used if the \`ipc\` option is \`true\`.`)},vr=(e,t,n)=>{if(!n)throw Error(`${B(e,t)} cannot be used: the ${V(t)} has already exited or disconnected.`)},yr=e=>{throw Error(`${B(`getOneMessage`,e)} could not complete: the ${V(e)} exited or disconnected.`)},br=e=>{throw Error(`${B(`sendMessage`,e)} failed: the ${V(e)} is sending a message too, instead of listening to incoming messages.
11
+ This can be fixed by both sending a message and listening to incoming messages at the same time:
12
+
13
+ const [receivedMessage] = await Promise.all([
14
+ ${B(`getOneMessage`,e)},
15
+ ${B(`sendMessage`,e,`message, {strict: true}`)},
16
+ ]);`)},xr=(e,t)=>Error(`${B(`sendMessage`,t)} failed when sending an acknowledgment response to the ${V(t)}.`,{cause:e}),Sr=e=>{throw Error(`${B(`sendMessage`,e)} failed: the ${V(e)} is not listening to incoming messages.`)},Cr=e=>{throw Error(`${B(`sendMessage`,e)} failed: the ${V(e)} exited without listening to incoming messages.`)},wr=()=>/* @__PURE__ */ Error(`\`cancelSignal\` aborted: the ${V(!0)} disconnected.`),Tr=()=>{throw Error("`getCancelSignal()` cannot be used without setting the `gracefulCancel` option to `true`.")},Er=({error:e,methodName:t,isSubprocess:n})=>{if(e.code===`EPIPE`)throw Error(`${B(t,n)} cannot be used: the ${V(n)} is disconnecting.`,{cause:e})},Dr=({error:e,methodName:t,isSubprocess:n,message:r})=>{if(kr(e))throw Error(`${B(t,n)}'s argument type is invalid: the message cannot be serialized: ${Or(r)}.`,{cause:e})},Or=e=>{try{return String(e)}catch{return m(e)}},kr=({code:e,message:t})=>Ar.has(e)||jr.some(e=>t.includes(e)),Ar=/* @__PURE__ */ new Set([`ERR_MISSING_ARGS`,`ERR_INVALID_ARG_TYPE`]),jr=[`could not be cloned`,`circular structure`,`call stack size exceeded`],B=(e,t,n=``)=>e===`cancelSignal`?"`cancelSignal`'s `controller.abort()`":`${Mr(t)}${e}(${n})`,Mr=e=>e?``:`subprocess.`,V=e=>e?`parent process`:`subprocess`,Nr=e=>{e.connected&&e.disconnect()},Pr=()=>{let e={},t=new Promise((t,n)=>{Object.assign(e,{resolve:t,reject:n})});return Object.assign(t,e)},Fr=(e,t,n)=>{let r=e.getMaxListeners();r!==0&&r!==1/0&&(e.setMaxListeners(r+t),w(n,()=>{e.setMaxListeners(e.getMaxListeners()-t)}))},Ir=(e,t)=>{t&&Lr(e)},Lr=e=>{e.refCounted()},Rr=(e,t)=>{t&&zr(e)},zr=e=>{e.unrefCounted()},Br=(e,t)=>{t&&(zr(e),zr(e))},Vr=(e,t)=>{t&&(Lr(e),Lr(e))},Hr=async({anyProcess:e,channel:t,isSubprocess:n,ipcEmitter:r},i)=>{if($r(i,e)||n&&wi(i))return;Wr.has(e)||Wr.set(e,[]);let a=Wr.get(e);if(a.push(i),!(a.length>1))for(;a.length>0;){await ci(e,r,a[0]),await b.yield();let i=await Qr({wrappedMessage:a[0],anyProcess:e,channel:t,isSubprocess:n,ipcEmitter:r});a.shift(),r.emit(`message`,i),r.emit(`message:done`)}},Ur=async({anyProcess:e,channel:t,isSubprocess:n,ipcEmitter:r,boundOnMessage:i})=>{n&&Ei();let a=Wr.get(e);for(;a?.length>0;)await E(r,`message:done`);e.removeListener(`message`,i),Vr(t,n),r.connected=!1,r.emit(`disconnect`)},Wr=/* @__PURE__ */ new WeakMap,Gr=(e,t,n)=>{if(Kr.has(e))return Kr.get(e);let r=new ee;return r.setMaxListeners(0),r.connected=!0,Kr.set(e,r),qr({ipcEmitter:r,anyProcess:e,channel:t,isSubprocess:n}),r},Kr=/* @__PURE__ */ new WeakMap,qr=({ipcEmitter:e,anyProcess:t,channel:n,isSubprocess:r})=>{let i=Hr.bind(void 0,{anyProcess:t,channel:n,isSubprocess:r,ipcEmitter:e});t.on(`message`,i),t.once(`disconnect`,Ur.bind(void 0,{anyProcess:t,channel:n,isSubprocess:r,ipcEmitter:e,boundOnMessage:i})),Br(n,r)},Jr=e=>{let t=Kr.get(e);return t===void 0?e.channel!==void 0&&e.channel!==null:t.connected},Yr=({anyProcess:e,channel:t,isSubprocess:n,message:r,strict:i})=>{if(!i)return r;let a=Gr(e,t,n),o=fi(e,a);return{id:Xr++,type:ri,message:r,hasListeners:o}};let Xr=0;const Zr=(e,t)=>{if(ai(t)&&!t.hasListeners)for(let{id:t}of e)t!==void 0&&ti[t].deferred.resolve({isDeadlock:!0,hasListeners:!1})},Qr=async({wrappedMessage:e,anyProcess:t,channel:n,isSubprocess:r,ipcEmitter:i})=>{if(!ai(e))return e;let{id:a,message:o}=e;if(!t.connected)return o;let s={id:a,type:ii,message:fi(t,i)};try{await hi({anyProcess:t,channel:n,isSubprocess:r,ipc:!0},s)}catch(e){e.cause?.code!==`EPIPE`&&i.emit(`strict:error`,e)}return o},$r=(e,t)=>{if(e?.type!==ii)return!1;let{id:n,message:r}=e,i=ti[n];return i?.anyProcess===t&&i.deferred.resolve({isDeadlock:!1,hasListeners:r}),!0},ei=async(e,t,n)=>{let r=Pr();ti[e.id]={deferred:r,anyProcess:t};let i=new AbortController;try{let{isDeadlock:e,hasListeners:a}=await Promise.race([r,ni(t,n,i)]);e&&br(n),a||Sr(n)}finally{i.abort(),delete ti[e.id]}},ti={__proto__:null},ni=async(e,t,{signal:n})=>{Fr(e,1,n),await E(e,`disconnect`,{signal:n}),Cr(t)},ri=`execa:ipc:request`,ii=`execa:ipc:response`,ai=e=>e?.type===ri&&Number.isInteger(e.id)&&typeof e.hasListeners==`boolean`,oi=(e,t,n)=>{li.has(e)||li.set(e,/* @__PURE__ */ new Set);let r=li.get(e),i={onMessageSent:Pr(),id:n?t.id:void 0};return r.add(i),{outgoingMessages:r,outgoingMessage:i}},si=({outgoingMessages:e,outgoingMessage:t})=>{e.delete(t),t.onMessageSent.resolve()},ci=async(e,t,n)=>{for(;!fi(e,t)&&li.get(e)?.size>0;){let t=[...li.get(e)];Zr(t,n),await Promise.all(t.map(({onMessageSent:e})=>e))}},li=/* @__PURE__ */ new WeakMap,ui=/* @__PURE__ */ new WeakMap,di=(e,t)=>{ui.set(e,t)},fi=(e,t)=>t.listenerCount(`message`)>pi(e),pi=e=>+(mi(e)!==void 0&&!Dt(mi(e).buffer,`ipc`)),mi=e=>ui.get(e),hi=({anyProcess:e,channel:t,isSubprocess:n,ipc:r},i,a)=>{let{strict:o=!1}=L(a);R(o,`strict`);let s=`sendMessage`;return gr({methodName:s,isSubprocess:n,ipc:r,isConnected:e.connected}),gi({anyProcess:e,channel:t,methodName:s,isSubprocess:n,message:i,strict:o})},gi=async({anyProcess:e,channel:t,methodName:n,isSubprocess:r,message:i,strict:a})=>{let o=Yr({anyProcess:e,channel:t,isSubprocess:r,message:i,strict:a}),s=oi(e,o,a);try{await _i({anyProcess:e,methodName:n,isSubprocess:r,wrappedMessage:o,message:i,strict:a})}catch(t){throw Nr(e),t}finally{si(s)}},_i=async({anyProcess:e,methodName:t,isSubprocess:n,wrappedMessage:r,message:i,strict:a=!1})=>{let o=vi(e);try{await Promise.all([a?ei(r,e,n):void 0,o(r)])}catch(e){throw Er({error:e,methodName:t,isSubprocess:n}),Dr({error:e,methodName:t,isSubprocess:n,message:i}),e}},vi=e=>{if(yi.has(e))return yi.get(e);let t=h(e.send.bind(e));return yi.set(e,t),t},yi=/* @__PURE__ */ new WeakMap,bi=(e,t)=>{let n=`cancelSignal`;return vr(n,!1,e.connected),_i({anyProcess:e,methodName:n,isSubprocess:!1,wrappedMessage:{type:Ti,message:t},message:t})},xi=async({anyProcess:e,channel:t,isSubprocess:n,ipc:r})=>(await Si({anyProcess:e,channel:t,isSubprocess:n,ipc:r}),Di.signal),Si=async({anyProcess:e,channel:t,isSubprocess:n,ipc:r})=>{Ci||(r?(Ci=!0,e.connected?(Gr(e,t,n),await b.yield()):Ei()):Tr())};let Ci=!1;const wi=e=>e?.type===Ti&&(Di.abort(e.message),!0),Ti=`execa:ipc:cancel`,Ei=()=>{Di.abort(wr())},Di=new AbortController,Oi=({gracefulCancel:e,cancelSignal:t,ipc:n,serialization:r})=>{if(e){if(t===void 0)throw Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!n)throw Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(r===`json`)throw Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")}},ki=({subprocess:e,kill:t,cancelSignal:n,gracefulCancel:r,forceKillAfterDelay:i,context:a,controller:o})=>r?[Ai({subprocess:e,kill:t,cancelSignal:n,forceKillAfterDelay:i,context:a,controller:o})]:[],Ai=async({subprocess:e,kill:t,cancelSignal:n,forceKillAfterDelay:r,context:i,controller:{signal:a}})=>{await ur(n,a);let o=ji(n);throw await bi(e,o),lr({kill:t,forceKillAfterDelay:r,context:i,controllerSignal:a}),i.terminationReason??=`gracefulCancel`,n.reason},ji=({reason:e})=>{if(!(e instanceof DOMException))return e;let t=Error(e.message);return Object.defineProperty(t,"stack",{value:e.stack,enumerable:!1,configurable:!0,writable:!0}),t},Mi=({options:e})=>{if(e.node===!1)throw TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{__proto__:null,...e,node:!0}}},Ni=()=>{let e=[];for(let t=0;t<s.length;t+=1){let n=s[t];Pi.has(n)?s[t+1]?.startsWith(`-`)||(t+=1):Fi.test(n)||e.push(n)}return e},Pi=/* @__PURE__ */ new Set([`-e`,`--eval`,`-p`,`--print`,`-pe`,`--input-type`,`--inspect-port`]),Fi=/^--(?:inspect|eval=|print=|input-type=)/,Ii=(e,t,{node:n=!1,nodePath:r=c,nodeOptions:i=Ni(),cwd:a,execPath:o,...s})=>{if(o!==void 0)throw TypeError(`The "execPath" option has been removed. Please use the "nodePath" option instead.`);if(!Array.isArray(i)||i.some(e=>typeof e!=`string`))throw TypeError(`The "nodeOptions" option must be an array of strings.`);let l=_e(r,`The "nodePath" option`),u=y.resolve(a,l),d={__proto__:null,shell:!1,...s,nodePath:u,node:n,cwd:a};if(!n)return[e,t,d];if(y.basename(e,`.exe`)===`node`)throw TypeError(`When the "node" option is true, the first argument does not need to be "node".`);return[u,[...i,e,...t],{__proto__:null,...d,ipc:d.ipc===void 0||d.ipc,shell:!1}]},Li=({ipcInput:e,ipc:t,serialization:n})=>{if(e!==void 0){if(!t)throw Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");Ri[n]?.(e)}},Ri={__proto__:null,advanced:e=>{try{ne(e)}catch(e){throw Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},json:e=>{try{if(JSON.stringify(e)===void 0)throw TypeError(`The value cannot be represented as JSON.`)}catch(e){throw Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}}},zi=async(e,t,n)=>{t!==void 0&&await hi({anyProcess:e,channel:e.channel,isSubprocess:!1,ipc:n},t)},Bi=({encoding:e})=>{if(Hi.has(e))return;let t=Gi(e);if(t!==void 0)throw TypeError(`Invalid option \`encoding: ${qi(e)}\`.
17
+ Please rename it to ${qi(t)}.`);let n=[...Hi].map(e=>qi(e)).join(`, `);throw TypeError(`Invalid option \`encoding: ${qi(e)}\`.
18
+ Please rename it to one of: ${n}.`)},Vi=/* @__PURE__ */ new Set([`utf8`,`utf16le`]),H=/* @__PURE__ */ new Set([`buffer`,`hex`,`base64`,`base64url`,`latin1`,`ascii`]),Hi=Vi.union(H),Ui=(e,t)=>e||!Vi.has(t)?`utf8`:t,Wi=e=>Vi.has(e)?`utf8`:e,Gi=e=>{if(e===null)return`buffer`;if(typeof e!=`string`)return;let t=e.toLowerCase();if(t in Ki)return Ki[t];if(Hi.has(t))return t},Ki={__proto__:null,"utf-8":`utf8`,"utf-16le":`utf16le`,"ucs-2":`utf16le`,ucs2:`utf16le`,binary:`latin1`},qi=e=>typeof e==`string`?`"${e}"`:String(e),U=o.platform===`win32`,Ji=U?/[\/\\]/v:/\//v;function Yi(e,t){if(typeof e!=`string`||e.length===0)throw TypeError(`Expected a non-empty string.`);let{cwd:n=o.cwd(),path:r=o.env.PATH??(U?o.env.Path:void 0)??``,pathExt:i=o.env.PATHEXT||`.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC`}=t;return{cwd:n,searchPath:r,pathExt:i}}function Xi(e,t){let n=t.split(y.delimiter).filter(Boolean),r=y.extname(e).toLowerCase();return r!==``&&n.some(e=>e.toLowerCase()===r)?[``,...n]:n}function*Zi(e,{cwd:t,searchPath:n,pathExt:r}){let i=U?Xi(e,r):[``];if(Ji.test(e)){let n=y.resolve(t,e);for(let e of i)yield n+e;return}let a=[...U?[t]:[],...n.split(y.delimiter)];for(let n of a){let r=U&&n.length>1&&n.startsWith(`"`)&&n.endsWith(`"`)?n.slice(1,-1):n;if(r===``)continue;let a=y.resolve(t,r,e);for(let e of i)yield a+e}}function Qi(e){let t;try{t=re.statSync(e)}catch(e){return U&&e.code===`EACCES`}if(!t.isFile())return!1;if(U)return!0;try{return re.accessSync(e,re.constants.X_OK),!0}catch{return!1}}function $i(e,t={}){let n=Yi(e,t);for(let t of Zi(e,n))if(Qi(t))return t}const ea=(e,t,n)=>{let r={file:e,commandArguments:[...t],options:n};return n.shell||o.platform!==`win32`?r:na(r)},ta=/\.(?:com|exe)$/i,na=e=>{let t=ra(e);if(t!==void 0&&ta.test(t))return e.options.argv0===void 0&&(e.options.argv0=e.file),e.file=t,e;for(let t of[e.file,...e.commandArguments])fa(t);let n=`"${[ma(y.normalize(t??e.file)),...e.commandArguments.map(e=>_a(e))].join(` `)}"`;return e.options.windowsVerbatimArguments=!0,{file:o.env.comspec||`cmd.exe`,commandArguments:[`/d`,`/e:on`,`/v:off`,`/s`,`/c`,n],options:e.options}},ra=e=>{let t=ia(e),n=t!==void 0&&ca(t);return n?(e.commandArguments.unshift(t),e.file=n,ia(e)):t},ia=e=>{let t=e.options.env||o.env,n=e.options.cwd??o.cwd(),r=W(t,`PATHEXT`),i=y.extname(e.file),a=i===``?r:`${i}${y.delimiter}${r??``}`;if(aa(e.file))return $i(y.resolve(n,e.file),{cwd:n,pathExt:a});let s={cwd:n,path:W(t,`PATH`)??W(o.env,`PATH`)??``,pathExt:a};return oa(t)?$i(e.file,s):sa(e.file,s)},aa=e=>e.includes(`/`)||e.includes(`\\`)||e.includes(`:`),oa=e=>W(o.env,`NODEFAULTCURRENTDIRECTORYINEXEPATH`)===void 0&&W(e,`NODEFAULTCURRENTDIRECTORYINEXEPATH`)===void 0,sa=(e,{cwd:t,path:n,pathExt:r})=>{for(let i of n.split(y.delimiter)){let n=i.length>1&&i.startsWith(`"`)&&i.endsWith(`"`)?i.slice(1,-1):i;if(n===``)continue;let a=$i(y.resolve(t,n,e),{cwd:t,pathExt:r});if(a!==void 0)return a}},W=(e,t)=>{let n=Object.keys(e).sort().find(e=>e.toUpperCase()===t);return n===void 0?void 0:e[n]},ca=e=>{let t=D.alloc(150),n=0;try{let r=ce(e,`r`);try{n=ue(r,t,0,150,0)}finally{ae(r)}}catch{return}return ua(t.toString(`utf8`,0,n))},la=/^#!(?<line>.*)/,ua=e=>{let t=e.match(la)?.groups.line.trim();if(!t)return;let[n,r]=t.split(` `,2),i=n.split(`/`).at(-1);return i===`env`?r:r?`${i} ${r}`:i},da=/[\n\r]/,fa=e=>{if(da.test(e))throw TypeError(`The command and its arguments cannot contain a line break on Windows without a shell.\nThis would allow a command injection with \`cmd.exe\`.\nInvalid value: ${JSON.stringify(`${e}`)}`)},pa=/[()\][%!^"`<>&|;, *?]/g,ma=e=>e.replaceAll(pa,`^$&`),ha=/\\+/g,ga=/[^\w#$*+\-./:?@\\\u{80}-\u{10FFFF}]|\p{Control}/u,_a=e=>{let t=`${e}`;return va(t)?`"${t.replaceAll(ha,(e,t,n)=>{let r=n[t+e.length];return r===`"`||r===void 0?e.repeat(2):e}).replaceAll(`"`,`""`).replaceAll(`%`,`%%cd:~,%`)}"`:t},va=e=>e===``||e.endsWith(`\\`)||ga.test(e),ya=(e=ba())=>{let t=_e(e,`The "cwd" option`);return y.resolve(t)},ba=()=>{try{return o.cwd()}catch(e){throw e.message=`The current directory does not exist.\n${e.message}`,e}},xa=()=>{try{return o.cwd()}catch{}},Sa=(e,t)=>{if(t===xa())return e;let n;try{n=de(t)}catch(n){return`The "cwd" option is invalid: ${t}.\n${n.message}\n${e}`}return n.isDirectory()?e:`The "cwd" option is not a directory: ${t}.\n${e}`},Ca=/^cmd(?:\.exe)?$/i,wa=(e,t,n)=>{let r={__proto__:null,...n};r.cwd=ya(r.cwd);let[i,a,s]=Ii(e,t,r),c=ft(s),l=Oa(c);Ea(l),Da(l),l.env=ka(l);let{file:u,commandArguments:d}=ea(i,a,l);return Qn(l),Bi(l),Li(l),fr(l),pr(l),Oi(l),l.shell=be(l.shell),l.killSignal=Hn(l.killSignal),l.forceKillAfterDelay=rr(l.forceKillAfterDelay),l.lines=l.lines.map((e,t)=>e&&!H.has(l.encoding)&&l.buffer[t]),o.platform===`win32`&&Ca.test(y.basename(u))&&d.unshift(`/q`),{file:u,commandArguments:d,options:l}},Ta=[`extendEnv`,`preferLocal`,`reject`,`cleanup`,`killDescendants`,`all`,`gracefulCancel`,`ipc`,`node`],Ea=e=>{for(let t of Ta)R(e[t],t)},Da=({env:e})=>{if(e!==void 0&&(typeof e!=`object`||!e||Array.isArray(e)))throw TypeError(`The \`env\` option must be an object: ${String(e)}.`)},Oa=({extendEnv:e=!0,preferLocal:t=!1,cwd:n,localDir:r=n,encoding:i=`utf8`,reject:a=!0,cleanup:o=!0,killDescendants:s=!1,all:c=!1,windowsHide:l=!0,killSignal:u=`SIGTERM`,forceKillAfterDelay:d=!0,gracefulCancel:f=!1,ipcInput:p,ipc:m=p!==void 0||f,serialization:h=`advanced`,...g})=>({__proto__:null,...g,extendEnv:e,preferLocal:t,cwd:n,localDirectory:r,encoding:i,reject:a,cleanup:o,killDescendants:s,all:c,windowsHide:l,killSignal:u,forceKillAfterDelay:d,gracefulCancel:f,ipcInput:p,ipc:m,serialization:h}),ka=e=>({__proto__:null,...Aa(e)}),Aa=({env:e,extendEnv:t,preferLocal:n,node:r,localDirectory:i,nodePath:a})=>{let s={__proto__:null,...t&&o.env,...e};return n||r?kn({env:s,cwd:i,execPath:a,preferLocal:n,addExecPath:r}):s},ja=(e,t,n)=>n.shell&&t.length>0?[[e,...t].join(` `),[],n]:[e,t,n],Ma=(e,t,n,r)=>e||n?void 0:Fa(t,r),Na=(e,t,n)=>n?e.flatMap(e=>Pa(e,t)):Pa(e,t),Pa=(e,t)=>{let{transform:n,final:r}=Fa(t,{});return[...n(e),...r()]},Fa=(e,t)=>(t.previousChunks=``,{transform:Ia.bind(void 0,t,e),final:Ra.bind(void 0,t)}),Ia=function*(e,t,n){if(typeof n!=`string`){yield n;return}let{previousChunks:r}=e,i=-1;for(let a=0;a<n.length;a+=1){if(n[a]!==`
19
+ `)continue;let o=n.slice(i+1,t?a+1:a);r.length>0&&(o=Ha(r,o),r=``),yield t?o:La(o,e),i=a}i!==n.length-1&&(r=Ha(r,n.slice(i+1))),e.previousChunks=r},La=(e,t)=>(t.isWindowsNewline=e.endsWith(`\r`),t.isWindowsNewline?e.slice(0,-1):e),Ra=function*({previousChunks:e}){e.length>0&&(yield e)},za=({binary:e,preserveNewlines:t,readableObjectMode:n,state:r,encoding:i})=>e||t||n?void 0:{transform:Ba.bind(void 0,r,Ui(e,i))},Ba=function*({isWindowsNewline:e=!1},t,n){let{unixNewline:r,windowsNewline:i,concat:a}=typeof n==`string`?Ua:Ga[t];Va(n,r)?yield n:yield a(n,e?i:r)},Va=(e,t)=>typeof e==`string`?e.endsWith(t):e.length>=t.length&&e.subarray(-t.length).every((e,n)=>e===t[n]),Ha=(e,t)=>`${e}${t}`,Ua={windowsNewline:`\r
20
+ `,unixNewline:`
21
+ `,concat:Ha},Wa=(e,t)=>{let n=new Uint8Array(e.length+t.length);return n.set(e,0),n.set(t,e.length),n},Ga={__proto__:null,utf8:{windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),concat:Wa},utf16le:{windowsNewline:new Uint8Array([13,0,10,0]),unixNewline:new Uint8Array([10,0]),concat:Wa}};function Ka(e){if(typeof e==`string`)return qa(e);if(!(ArrayBuffer.isView(e)&&e.BYTES_PER_ELEMENT===1))throw Error(`Input must be a string or a Uint8Array`);return Ja(e)}const qa=e=>e.at(-1)===Ya?e.slice(0,e.at(-2)===Za?-2:-1):e,Ja=e=>e.at(-1)===Xa?e.subarray(0,e.at(-2)===Qa?-2:-1):e,Ya=`
22
+ `,Xa=`
23
+ `.codePointAt(0),Za=`\r`,Qa=`\r`.codePointAt(0),$a=(e,{stripFinalNewline:t},n,r)=>e!==void 0&&!Array.isArray(e)&&eo(t,n,r)?Ka(e):e,eo=(e,t,n)=>t===`all`?n.some(t=>e[t]):e[t],to=([,e,t])=>[...e===void 0?[]:[1],...t===void 0?[]:[2]],no=([,e,t],n,r)=>{if(r.all)return e===void 0?oo(t,n,r):t===void 0?oo(e,n,r):ao(r)?[oo(e,n,r),oo(t,n,r)].flat():Array.isArray(e)||Array.isArray(t)?[e,t].filter(e=>e.length>0).flat():N(e)&&N(t)?Be([e,t]):io.has(r.encoding)?ro(e,t,r.encoding):`${e}${t}`},ro=(e,t,n)=>D.concat([D.from(e,n),D.from(t,n)]).toString(n),io=/* @__PURE__ */ new Set([`base64`,`base64url`]),ao=({lines:e})=>!!(e[1]||e[2]),oo=(e,t,n)=>e===void 0||Array.isArray(e)||!ao(n)?e:Na(e,!eo(n.stripFinalNewline,`all`,t),!1);function G(e,{checkOpen:t=!0}={}){return typeof e==`object`&&!!e&&(e.writable||e.readable||!t||e.writable===void 0&&e.readable===void 0)&&typeof e.pipe==`function`}function so(e,{checkOpen:t=!0}={}){return G(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 co(e,{checkOpen:t=!0}={}){return G(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 lo(e,t){return so(e,t)&&co(e,t)}const uo=Object.getPrototypeOf(Object.getPrototypeOf(
24
+ /* istanbul ignore next */
25
+ async function*(){}).prototype);var fo=class{#e;#t;#n=!1;#r=void 0;constructor(e,t){this.#e=e,this.#t=t}next(){let e=()=>this.#i();return this.#r=this.#r?this.#r.then(e,e):e(),this.#r}return(e){let t=()=>this.#a(e);return this.#r?this.#r.then(t,t):t()}async#i(){if(this.#n)return{done:!0,value:void 0};let e;try{e=await this.#e.read()}catch(e){throw this.#r=void 0,this.#n=!0,this.#e.releaseLock(),e}return e.done&&(this.#r=void 0,this.#n=!0,this.#e.releaseLock()),e}async#a(e){if(this.#n)return{done:!0,value:e};if(this.#n=!0,!this.#t){let t=this.#e.cancel(e);return this.#e.releaseLock(),await t,{done:!0,value:e}}return this.#e.releaseLock(),{done:!0,value:e}}};const po=Symbol();function mo(){return this[po].next()}Object.defineProperty(mo,"name",{value:`next`});function ho(e){return this[po].return(e)}Object.defineProperty(ho,"name",{value:`return`});const go=Object.create(uo,{next:{enumerable:!0,configurable:!0,writable:!0,value:mo},return:{enumerable:!0,configurable:!0,writable:!0,value:ho}});function _o({preventCancel:e=!1}={}){let t=new fo(this.getReader(),e),n=Object.create(go);return n[po]=t,n}const vo=e=>{if(co(e,{checkOpen:!1})&&So.on!==void 0)return bo(e);if(typeof e?.[Symbol.asyncIterator]==`function`)return e;if(yo.call(e)===`[object ReadableStream]`)return _o.call(e);throw TypeError(`The first argument must be a Readable, a ReadableStream, or an async iterable.`)},{toString:yo}=Object.prototype,bo=async function*(e){let t=new AbortController,n={};xo(e,t,n);try{for await(let[n]of So.on(e,`data`,{signal:t.signal}))yield n}catch(e){if(n.error!==void 0)throw n.error;if(!t.signal.aborted)throw e}finally{e.destroy()}},xo=async(e,t,n)=>{try{await So.finished(e,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(e){n.error=e}finally{t.abort()}},So={},Co=async(e,{init:t,convertChunk:n,getSize:r,truncateChunk:i,addChunk:a,getFinalChunk:o,finalize:s},{maxBuffer:c=1/0}={})=>{let l=vo(e),u=t();u.length=0;try{for await(let e of l){let t=n[Do(e)](e,u);To({convertedChunk:t,state:u,getSize:r,truncateChunk:i,addChunk:a,maxBuffer:c})}return wo({state:u,convertChunk:n,getSize:r,truncateChunk:i,addChunk:a,getFinalChunk:o,maxBuffer:c}),s(u)}catch(e){let t=typeof e==`object`&&e?e:Error(e);throw t.bufferedData=s(u),t}},wo=({state:e,getSize:t,truncateChunk:n,addChunk:r,getFinalChunk:i,maxBuffer:a})=>{let o=i(e);o!==void 0&&To({convertedChunk:o,state:e,getSize:t,truncateChunk:n,addChunk:r,maxBuffer:a})},To=({convertedChunk:e,state:t,getSize:n,truncateChunk:r,addChunk:i,maxBuffer:a})=>{let o=n(e),s=t.length+o;if(s<=a){Eo(e,t,i,s);return}let c=r(e,a-t.length);throw c!==void 0&&Eo(c,t,i,a),new K},Eo=(e,t,n,r)=>{t.contents=n(e,t,r),t.length=r},Do=e=>{let t=typeof e;if(t===`string`)return`string`;if(t!==`object`||e===null)return`others`;if(globalThis.Buffer?.isBuffer(e))return`buffer`;let n=Oo.call(e);return n===`[object ArrayBuffer]`?`arrayBuffer`:n===`[object DataView]`?`dataView`:Number.isInteger(e.byteLength)&&Number.isInteger(e.byteOffset)&&Oo.call(e.buffer)===`[object ArrayBuffer]`?`typedArray`:`others`},{toString:Oo}=Object.prototype;var K=class extends Error{name=`MaxBufferError`;constructor(){super(`maxBuffer exceeded`)}};const q=e=>e,ko=()=>void 0,Ao=({contents:e})=>e,jo=e=>{throw Error(`Streams in object mode are not supported: ${String(e)}`)},Mo=e=>e.length;async function No(e,t){return Co(e,Po,t)}const Po={init:()=>({contents:[]}),convertChunk:{string:q,buffer:q,arrayBuffer:q,dataView:q,typedArray:q,others:q},getSize:()=>1,truncateChunk:ko,addChunk:(e,{contents:t})=>(t.push(e),t),getFinalChunk:ko,finalize:Ao};async function Fo(e,t){return Co(e,Yo,t)}const Io=()=>({contents:/* @__PURE__ */ new ArrayBuffer(0)}),Lo=e=>Ro.encode(e),Ro=new TextEncoder,zo=e=>new Uint8Array(e),Bo=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),Vo=(e,t)=>e.slice(0,t),Ho=(e,{contents:t,length:n},r)=>{let i=Jo()?Wo(t,r):Uo(t,r);return new Uint8Array(i).set(e,n),i},Uo=(e,t)=>{if(t<=e.byteLength)return e;let n=new ArrayBuffer(Go(t));return new Uint8Array(n).set(new Uint8Array(e),0),n},Wo=(e,t)=>{if(t<=e.maxByteLength)return e.resize(t),e;let n=new ArrayBuffer(t,{maxByteLength:Go(t)});return new Uint8Array(n).set(new Uint8Array(e),0),n},Go=e=>Ko**Math.ceil(Math.log(e)/Math.log(Ko)),Ko=2,qo=({contents:e,length:t})=>Jo()?e:e.slice(0,t),Jo=()=>`resize`in ArrayBuffer.prototype,Yo={init:Io,convertChunk:{string:Lo,buffer:zo,arrayBuffer:zo,dataView:Bo,typedArray:Bo,others:jo},getSize:Mo,truncateChunk:Vo,addChunk:Ho,getFinalChunk:ko,finalize:qo};async function Xo(e,t){return Co(e,$o,t)}const Zo=()=>({contents:``,textDecoder:new TextDecoder}),Qo=(e,{textDecoder:t})=>t.decode(e,{stream:!0}),$o={init:Zo,convertChunk:{string:q,buffer:Qo,arrayBuffer:Qo,dataView:Qo,typedArray:Qo,others:jo},getSize:Mo,truncateChunk:(e,t)=>e.slice(0,t),addChunk:(e,{contents:t})=>t+e,getFinalChunk:({textDecoder:e})=>{let t=e.decode();return t===``?void 0:t},finalize:Ao},es=({error:e,stream:t,readableObjectMode:n,lines:r,encoding:i,fdNumber:a})=>{if(!(e instanceof K))throw e;if(a===`all`)return e;throw e.maxBufferInfo={fdNumber:a,unit:ts(n,r,i)},t.destroy(),e},ts=(e,t,n)=>e?`objects`:t?`lines`:n===`buffer`?`bytes`:`characters`,ns=(e,t)=>{if(e.length+1<=t)return;let n=new K;throw n.maxBufferInfo={fdNumber:`ipc`},n},rs=(e,t)=>{let{streamName:n,threshold:r,unit:i}=is(e,t);return`Command's ${n} was larger than ${r} ${i}`},is=(e,t)=>{if(e?.maxBufferInfo===void 0)return{streamName:`output`,threshold:t[1],unit:`bytes`};let{maxBufferInfo:{fdNumber:n,unit:r,threshold:i=Dt(t,n)}}=e;return delete e.maxBufferInfo,n===`ipc`?{streamName:`IPC output`,threshold:i,unit:`messages`}:{streamName:ct(n),threshold:i,unit:r}},as=([,e])=>e===0?Number.MIN_VALUE:e,os=({resultError:e,output:t,maxBuffer:n,buffer:r})=>{let i=ss(t,n,r);if(i===void 0)return{resultError:e,isMaxBuffer:e?.code===`ENOBUFS`};let a=cs(n,i),o=e??Object.assign(new K,{code:`ENOBUFS`});return o.maxBufferInfo={fdNumber:i,unit:`bytes`,threshold:a},{resultError:o,isMaxBuffer:!0}},ss=(e,t,n)=>{if(e===null)return;let r=e.findIndex((e,r)=>e!==null&&n[r]&&e.length>cs(t,r));return r===-1?void 0:r},cs=(e,t)=>Math.min(e[1],e[t]),ls=(e,t,{maxBuffer:n,buffer:r})=>{let i=cs(n,t);return r[t]&&e.length>i?e.slice(0,i):e},us=({stdio:e,all:t,ipcOutput:n,originalError:r,signal:i,signalDescription:a,exitCode:o,escapedCommand:s,timedOut:c,isCanceled:l,isGracefullyCanceled:u,isMaxBuffer:d,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m,maxBuffer:h,timeout:g,cwd:_})=>{let v=ds(r),y=fs({originalError:r,timedOut:c,timeout:g,isMaxBuffer:d,maxBuffer:h,errorCode:v,signal:i,signalDescription:a,exitCode:o,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m}),b=ms(r,_),x=`${y}: ${s}${b===void 0?``:`\n${b}`}`;return{originalMessage:b,shortMessage:x,message:[x,...t===void 0?[e[2],e[1]]:[t],...e.slice(3),n.map(e=>hs(e)).join(`
26
+ `)].map(e=>Ce(Ka(gs(e)))).filter(Boolean).join(`
27
+
28
+ `)}},ds=e=>typeof e?.code==`string`?e.code:void 0,fs=({originalError:e,timedOut:t,timeout:n,isMaxBuffer:r,maxBuffer:i,errorCode:a,signal:o,signalDescription:s,exitCode:c,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:d,forceKillAfterDelay:f,killSignal:p})=>{let m=ps(d,f);return t?`Command timed out after ${n} milliseconds${m}`:u?o===void 0?`Command was gracefully canceled with exit code ${c}`:d?`Command was gracefully canceled${m}`:`Command was gracefully canceled with ${o} (${s})`:l?`Command was canceled${m}`:r?`${rs(e,i)}${m}`:a===void 0?d?`Command was killed with ${p} (${Zn(p)})${m}`:o===void 0?c===void 0?`Command failed`:`Command failed with exit code ${c}`:`Command was killed with ${o} (${s})`:`Command failed with ${a}${m}`},ps=(e,t)=>e?` and was forcefully terminated after ${t} milliseconds`:``,ms=(e,t)=>{if(e instanceof Ue)return;let n=Ge(e)?e.originalMessage??``:String(e?.message??e),r=Ce(Sa(n,t));return r===``?void 0:r},hs=e=>typeof e==`string`?e:m(e),gs=e=>Array.isArray(e)?e.filter(e=>_s(e)).map(e=>Ka(vs(e))).join(`
29
+ `):vs(e),_s=e=>typeof e==`string`||N(e),vs=e=>typeof e==`string`?e:N(e)?Fe(e):``,ys=({command:e,escapedCommand:t,stdio:n,all:r,ipcOutput:i,options:{cwd:a},startTime:o})=>Es({command:e,escapedCommand:t,cwd:a,durationMs:xn(o),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:n[1],stderr:n[2],all:r,stdio:n,ipcOutput:i,pipedFrom:[]}),bs=({error:e,command:t,escapedCommand:n,fileDescriptors:r,options:i,startTime:a,isSync:o,stdio:s=Array.from({length:r.length}),all:c})=>ws({error:e,command:t,escapedCommand:n,startTime:a,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:s,all:c,ipcOutput:[],options:i,isSync:o}),xs=(e,t)=>{let n=e.map((e,n)=>Ss(e,n,t));return{stdio:n,all:no(n,to(n),t)}},Ss=({direction:e,objectMode:t},n,{stdio:r,buffer:i,lines:a,encoding:o})=>{if(e!==`input`&&Cs.has(r[n])&&i[n])return t||a[n]?[]:o===`buffer`?/* @__PURE__ */ new Uint8Array:``},Cs=/* @__PURE__ */ new Set([`pipe`,`overlapped`]),ws=({error:e,command:t,escapedCommand:n,startTime:r,timedOut:i,isCanceled:a,isGracefullyCanceled:o,isMaxBuffer:s,isForcefullyTerminated:c,exitCode:l,signal:u,stdio:d,all:f,ipcOutput:p,options:{timeoutDuration:m,timeout:h=m,forceKillAfterDelay:g,killSignal:_,cwd:v,maxBuffer:y},isSync:b})=>{let{exitCode:x,signal:S,signalDescription:C}=Ds(l,u),{originalMessage:ee,shortMessage:w,message:T}=us({stdio:d,all:f,ipcOutput:p,originalError:e,signal:S,signalDescription:C,exitCode:x,escapedCommand:n,timedOut:i,isCanceled:a,isGracefullyCanceled:o,isMaxBuffer:s,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:_,maxBuffer:y,timeout:h,cwd:v}),E=He(e,T,b);return Object.assign(E,Ts({error:E,command:t,escapedCommand:n,startTime:r,timedOut:i,isCanceled:a,isGracefullyCanceled:o,isMaxBuffer:s,isForcefullyTerminated:c,exitCode:x,signal:S,signalDescription:C,stdio:d,all:f,ipcOutput:p,cwd:v,originalMessage:ee,shortMessage:w})),E},Ts=({error:e,command:t,escapedCommand:n,startTime:r,timedOut:i,isCanceled:a,isGracefullyCanceled:o,isMaxBuffer:s,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,stdio:f,all:p,ipcOutput:m,cwd:h,originalMessage:g,shortMessage:_})=>Es({shortMessage:_,originalMessage:g,command:t,escapedCommand:n,cwd:h,durationMs:xn(r),failed:!0,timedOut:i,isCanceled:a,isGracefullyCanceled:o,isTerminated:u!==void 0,isMaxBuffer:s,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,code:ds(e.cause),stdout:f[1],stderr:f[2],all:p,stdio:f,ipcOutput:m,pipedFrom:[]}),Es=e=>Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0)),Ds=(e,t)=>{let n=e===null?void 0:e,r=t===null?void 0:t;return{exitCode:n,signal:r,signalDescription:r===void 0?void 0:Zn(t)}},Os=e=>Number.isFinite(e)?e:0;function ks(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(Os(e*1e3)%1e3),nanoseconds:Math.trunc(Os(e*1e6)%1e3)}}function As(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 js(e){switch(typeof e){case`number`:if(Number.isFinite(e))return ks(e);break;case`bigint`:return As(e)}throw TypeError(`Expected a finite number or bigint`)}const Ms=e=>e===0||e===0n,Ns=(e,t)=>t===1||t===1n?e:`${e}s`,Ps=24n*60n*60n*1000n;function Fs(e,t){let n=typeof e==`bigint`;if(!n&&!Number.isFinite(e))throw TypeError(`Expected a finite number or bigint`);t={...t};let r=e<0?`-`:``;e=e<0?-e:e,t.colonNotation&&(t.compact=!1,t.formatSubMilliseconds=!1,t.separateMilliseconds=!1,t.verbose=!1),t.compact&&(t.unitCount=1,t.secondsDecimalDigits=0,t.millisecondsDecimalDigits=0);let i=[],a=(e,t)=>{let n=Math.floor(e*10**t+1e-7);return(Math.round(n)/10**t).toFixed(t)},o=(e,n,r,a)=>{if(i.length!==0&&t.colonNotation||!Ms(e)||t.colonNotation&&r===`m`){if(a??=String(e),t.colonNotation){let e=a.includes(`.`)?a.split(`.`)[0].length:a.length,t=i.length>0?2:1;a=`0`.repeat(Math.max(0,t-e))+a}else a+=t.verbose?` `+Ns(n,e):r;i.push(a)}},s=js(e),c=BigInt(s.days);if(t.hideYearAndDays?o(BigInt(c)*24n+BigInt(s.hours),`hour`,`h`):(t.hideYear?o(c,`day`,`d`):(o(c/365n,`year`,`y`),o(c%365n,`day`,`d`)),o(Number(s.hours),`hour`,`h`)),o(Number(s.minutes),`minute`,`m`),!t.hideSeconds){if(t.separateMilliseconds||t.formatSubMilliseconds||!t.colonNotation&&e<1e3&&!t.subSecondsAsDecimals){let e=Number(s.seconds),n=Number(s.milliseconds),r=Number(s.microseconds),i=Number(s.nanoseconds);if(o(e,`second`,`s`),t.formatSubMilliseconds)o(n,`millisecond`,`ms`),o(r,`microsecond`,`µs`),o(i,`nanosecond`,`ns`);else{let e=n+r/1e3+i/1e6,a=typeof t.millisecondsDecimalDigits==`number`?t.millisecondsDecimalDigits:0,s=e>=1?Math.round(e):Math.ceil(e),c=1e3-10**-a,l=a?Math.min(e,c).toFixed(a):Math.min(s,c);o(Number.parseFloat(l),`millisecond`,`ms`,l)}}else{let r=a((n?Number(e%Ps):e)/1e3%60,typeof t.secondsDecimalDigits==`number`?t.secondsDecimalDigits:1),i=t.keepDecimalsOnWholeSeconds?r:r.replace(/\.0+$/,``);o(Number.parseFloat(i),`second`,`s`,i)}}if(i.length===0)return r+`0`+(t.verbose?` milliseconds`:`ms`);let l=t.colonNotation?`:`:` `;return typeof t.unitCount==`number`&&(i=i.slice(0,Math.max(t.unitCount,1))),r+i.join(l)}const Is=(e,t)=>{e.failed&&un({type:`error`,verboseMessage:e.shortMessage,verboseInfo:t,result:e})},Ls=(e,t)=>{Ot(t)&&(Is(e,t),Rs(e,t))},Rs=(e,t)=>{let n=`(done in ${Fs(e.durationMs)})`;un({type:`duration`,verboseMessage:n,verboseInfo:t,result:e})},zs=(e,t,{reject:n})=>{if(Ls(e,t),n&&e.failed)throw e;return e},Bs=(e,t)=>J(e)?`asyncGenerator`:Js(e)?`generator`:Xs(e)?`fileUrl`:Qs(e)?`filePath`:sc(e)?`webStream`:G(e,{checkOpen:!1})?`native`:N(e)?`uint8Array`:lc(e)?`asyncIterable`:uc(e)?`iterable`:cc(e)?Us({transform:e},t):Ys(e)?Vs(e,t):`native`,Vs=(e,t)=>lo(e.transform,{checkOpen:!1})?Hs(e,t):cc(e.transform)?Us(e,t):Ks(e,t),Hs=(e,t)=>(Ws(e,t,`Duplex stream`),`duplex`),Us=(e,t)=>(Ws(e,t,`web TransformStream`),`webTransform`),Ws=({final:e,binary:t,objectMode:n},r,i)=>{Gs(e,`${r}.final`,i),Gs(t,`${r}.binary`,i),R(n,`${r}.objectMode`)},Gs=(e,t,n)=>{if(e!==void 0)throw TypeError(`The \`${t}\` option can only be defined when using a generator, not a ${n}.`)},Ks=({transform:e,final:t,binary:n,objectMode:r},i)=>{if(e!==void 0&&!qs(e))throw TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(lo(t,{checkOpen:!1}))throw TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(cc(t))throw TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(t!==void 0&&!qs(t))throw TypeError(`The \`${i}.final\` option must be a generator.`);return R(n,`${i}.binary`),R(r,`${i}.objectMode`),J(e)||J(t)?`asyncGenerator`:`generator`},qs=e=>J(e)||Js(e),J=e=>Object.prototype.toString.call(e)===`[object AsyncGeneratorFunction]`,Js=e=>Object.prototype.toString.call(e)===`[object GeneratorFunction]`,Ys=e=>M(e)&&(e.transform!==void 0||e.final!==void 0),Xs=e=>Object.prototype.toString.call(e)===`[object URL]`,Zs=e=>Xs(e)&&e.protocol!==`file:`,Qs=e=>M(e)&&Object.keys(e).length>0&&Object.keys(e).every(e=>$s.has(e))&&ec(e.file),$s=/* @__PURE__ */ new Set([`file`,`append`]),ec=e=>typeof e==`string`,tc=e=>M(e)&&Object.keys(e).length>0&&Object.keys(e).every(e=>nc.has(e))&&`value`in e,nc=/* @__PURE__ */ new Set([`value`,`input`]),rc=(e,t)=>e===`native`&&typeof t==`string`&&!ic.has(t),ic=/* @__PURE__ */ new Set([`ipc`,`ignore`,`inherit`,`overlapped`,`pipe`]),ac=e=>Object.prototype.toString.call(e)===`[object ReadableStream]`,oc=e=>Object.prototype.toString.call(e)===`[object WritableStream]`,sc=e=>ac(e)||oc(e),cc=e=>ac(e?.readable)&&oc(e?.writable),lc=e=>dc(e)&&typeof e[Symbol.asyncIterator]==`function`,uc=e=>dc(e)&&typeof e[Symbol.iterator]==`function`,dc=e=>typeof e==`object`&&!!e,Y=/* @__PURE__ */ new Set([`generator`,`asyncGenerator`,`duplex`,`webTransform`]),fc=/* @__PURE__ */ new Set([`fileUrl`,`filePath`,`fileNumber`]),pc=/* @__PURE__ */ new Set([`fileUrl`,`filePath`]),mc=/* @__PURE__ */ new Set([...pc,`webStream`,`nodeStream`]),hc=/* @__PURE__ */ new Set([`webTransform`,`duplex`]),gc={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`},_c=(e,t,n,r)=>r===`output`?vc(e,t,n):yc(e,t,n),vc=(e,t,n)=>{let r=t!==0&&n[t-1].value.readableObjectMode;return{writableObjectMode:r,readableObjectMode:e??r}},yc=(e,t,n)=>{let r=t===0?e===!0:n[t-1].value.readableObjectMode;return{writableObjectMode:r,readableObjectMode:t!==n.length-1&&(e??r)}},bc=(e,t)=>{let n=e.findLast(({type:e})=>Y.has(e));return n===void 0?!1:t===`input`?n.value.writableObjectMode:n.value.readableObjectMode},xc=(e,t,n,r)=>[...e.filter(({type:e})=>!Y.has(e)),...Sc(e,t,n,r)],Sc=(e,t,n,{encoding:r})=>{let i=e.filter(({type:e})=>Y.has(e)),a=Array.from({length:i.length});for(let[e,o]of Object.entries(i))a[e]=Cc({stdioItem:o,index:Number(e),newTransforms:a,optionName:t,direction:n,encoding:r});return Dc(a,n)},Cc=({stdioItem:e,stdioItem:{type:t},index:n,newTransforms:r,optionName:i,direction:a,encoding:o})=>t===`duplex`?wc({stdioItem:e,optionName:i}):t===`webTransform`?Tc({stdioItem:e,index:n,newTransforms:r,direction:a}):Ec({stdioItem:e,index:n,newTransforms:r,direction:a,encoding:o}),wc=({stdioItem:e,optionName:t})=>{let{value:n}=e,{transform:r}=n,{writableObjectMode:i,readableObjectMode:a}=r,{objectMode:o=a}=n;if(o&&!a)throw TypeError(`The \`${t}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!o&&a)throw TypeError(`The \`${t}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...e,value:{transform:r,writableObjectMode:i,readableObjectMode:a}}},Tc=({stdioItem:e,stdioItem:{value:t},index:n,newTransforms:r,direction:i})=>{let{transform:a,objectMode:o}=M(t)?t:{transform:t},{writableObjectMode:s,readableObjectMode:c}=_c(o,n,r,i);return{...e,value:{transform:a,writableObjectMode:s,readableObjectMode:c}}},Ec=({stdioItem:e,stdioItem:{value:t},index:n,newTransforms:r,direction:i,encoding:a})=>{let{transform:o,final:s,binary:c=!1,preserveNewlines:l=!1,objectMode:u}=M(t)?t:{transform:t},d=c||H.has(a),{writableObjectMode:f,readableObjectMode:p}=_c(u,n,r,i);return{...e,value:{transform:o,final:s,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},Dc=(e,t)=>t===`input`?e.reverse():e,Oc=({stdioItems:e,isStdioArray:t,fdNumber:n,optionName:r})=>{let i=e.map(e=>kc(e,n,t));if(i.includes(`input`)&&i.includes(`output`))throw TypeError(`The \`${r}\` option must not be an array of both readable and writable values.`);return i.find(Boolean)??Lc},kc=(e,t,n)=>{let r=Nc[t],i=Ac(e);return r===void 0?i:(jc(e,r,n),r)},Ac=({type:e,value:t,direction:n,optionName:r})=>{let i=Fc[e](t);if(n===`input`&&i===`output`)throw TypeError(`The \`${r}\` option is invalid: \`input: true\` cannot be used with a writable value, which is always an output.`);return n??i},jc=({type:e,value:t,optionName:n},r,i)=>{if(!Mc.has(e)||!i&&Ic(t)!==void 0)return;let a=Fc[e](t);if(a!==void 0&&a!==r)throw TypeError(`The \`${n}\` option is invalid: a ${a===`input`?`readable`:`writable`} value is always an ${a}, but \`${n}\` is an ${r}.`)},Mc=/* @__PURE__ */ new Set([`native`,`nodeStream`,`webStream`]),Nc=[`input`,`output`,`output`],X=()=>void 0,Pc=()=>`input`,Fc={generator:X,asyncGenerator:X,fileUrl:X,filePath:X,iterable:Pc,asyncIterable:Pc,uint8Array:Pc,string:Pc,webStream:e=>oc(e)?`output`:`input`,nodeStream(e){return co(e,{checkOpen:!1})?so(e,{checkOpen:!1})?void 0:`input`:`output`},webTransform:X,duplex:X,native(e){let t=Ic(e);if(t!==void 0)return t;if(G(e,{checkOpen:!1}))return Fc.nodeStream(e)}},Ic=e=>{if([0,o.stdin].includes(e))return`input`;if([1,2,o.stdout,o.stderr].includes(e))return`output`},Lc=`output`,Rc=(e,t)=>t?[...e,`ipc`]:e,zc=(e,t,n)=>{let{stdio:r,ipc:i,buffer:a}=e,o=Uc(r,e).map((e,t)=>Gc(e,t));return Bc(o),n?Kc(o,a,t):Rc(o,i)},Bc=e=>{if(e.some(e=>Vc(e)))throw Error("The `ipc: true` option must be used instead of `stdio: 'ipc'`.")},Vc=e=>Array.isArray(e)?e.some(e=>Hc(e)):Hc(e),Hc=e=>tc(e)?e.value===`ipc`:e===`ipc`,Uc=(e,t)=>{if(e===void 0)return I.map(e=>t[e]);if(Wc(t))throw Error(`It's not possible to provide \`stdio\` in combination with one of ${I.map(e=>`\`${e}\``).join(`, `)}`);if(typeof e==`string`)return[e,e,e];if(!Array.isArray(e))throw TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${Xe(e)}\``);let n=Math.max(e.length,I.length);return Array.from({length:n},(t,n)=>e[n])},Wc=e=>I.some(t=>e[t]!==void 0),Gc=(e,t)=>Array.isArray(e)?e.map(e=>Gc(e,t)):e??(t>=I.length?`ignore`:`pipe`),Kc=(e,t,n)=>e.map((e,r)=>!t[r]&&Zc(r)&&!kt(n,r)&&qc(e,r)?`ignore`:e),qc=(e,t)=>Jc(e,t)||Array.isArray(e)&&e.length>0&&e.every(e=>Jc(e,t)),Jc=(e,t)=>e===`pipe`||Yc(e,t),Yc=(e,t)=>tc(e)&&e.value===`pipe`&&(e.input===void 0||e.input===!1||Xc(t,e.input)),Xc=(e,t)=>t===!0&&Zc(e),Zc=e=>e===1||e===2,Qc=(e,t=`stdin`)=>{let{options:n,fileDescriptors:r}=Z.get(e),i=el(r,t,!0),a=e.stdio[i];if(a===null)throw TypeError(rl(i,t,n,!0));return a},$c=(e,t=`stdout`)=>{let{options:n,fileDescriptors:r}=Z.get(e),i=el(r,t,!1),a=i===`all`?e.all:e.stdio[i];if(a==null)throw TypeError(rl(i,t,n,!1));return a},Z=/* @__PURE__ */ new WeakMap,el=(e,t,n)=>{let r=tl(t,n);return nl(r,t,n,e),r},tl=(e,t)=>{let n=bt(e);if(n!==void 0)return n;let{validOptions:r,defaultValue:i}=t?{validOptions:`"stdin"`,defaultValue:`stdin`}:{validOptions:`"stdout", "stderr", "all"`,defaultValue:`stdout`};throw TypeError(`"${ol(t)}" must not be "${e}".
30
+ It must be ${r} or "fd3", "fd4" (and so on).
31
+ It is optional and defaults to "${i}".`)},nl=(e,t,n,r)=>{let i=r[al(e)];if(i===void 0)throw TypeError(`"${ol(n)}" must not be ${t}. That file descriptor does not exist.
32
+ Please set the "stdio" option to ensure that file descriptor exists.`);if(!n&&i.direction===`input`)throw TypeError(`"${ol(n)}" must not be ${t}. It must be a readable stream, not writable.`);if(n&&i.direction!==`input`)throw TypeError(`"${ol(n)}" must not be ${t}. It must be a writable stream, not readable.
33
+ If you meant to use it as input, please set its "stdio" option to \`{value: 'pipe', input: true}\`.`)},rl=(e,t,n,r)=>{if(e===`all`&&!n.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:i,optionValue:a}=il(e,n);return`The "${i}: ${sl(a)}" option is incompatible with using "${ol(r)}: ${sl(t)}".
34
+ Please set this option with "pipe" instead.`},il=(e,{stdin:t,stdout:n,stderr:r,stdio:i})=>{let a=al(e);return a===0&&t!==void 0?{optionName:`stdin`,optionValue:t}:a===1&&n!==void 0?{optionName:`stdout`,optionValue:n}:a===2&&r!==void 0?{optionName:`stderr`,optionValue:r}:{optionName:`stdio[${a}]`,optionValue:i[a]}},al=e=>e===`all`?1:e,ol=e=>e?`to`:`from`,sl=e=>typeof e==`string`?`'${e}'`:typeof e==`number`?`${e}`:`Stream`,cl=({stdioItem:e,stdioItem:{type:t},isStdioArray:n,fdNumber:r,direction:i,isSync:a})=>!n||t!==`native`?e:a?ll({stdioItem:e,fdNumber:r,direction:i}):fl({stdioItem:e,fdNumber:r}),ll=({stdioItem:e,stdioItem:{value:t,optionName:n},fdNumber:r,direction:i})=>{let a=ul({value:t,optionName:n,fdNumber:r,direction:i});if(a!==void 0)return a;if(G(t,{checkOpen:!1}))throw TypeError(`The \`${n}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return e},ul=({value:e,optionName:t,fdNumber:n,direction:r})=>{let i=dl(e,n);if(i!==void 0){if(r===`output`)return{type:`fileNumber`,value:i,optionName:t};if(v.isatty(i))throw TypeError(`The \`${t}: ${sl(e)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:`uint8Array`,contents:()=>[P(le(i))],optionName:t}}},dl=(e,t)=>{if(e===`inherit`)return t;if(typeof e==`number`)return e;let n=st.indexOf(e);if(n!==-1)return n},fl=({stdioItem:e,stdioItem:{value:t,optionName:n},fdNumber:r})=>t===`inherit`?{type:`nodeStream`,value:pl(r,t,n),optionName:n}:typeof t==`number`?{type:`nodeStream`,value:pl(t,t,n),optionName:n}:G(t,{checkOpen:!1})?{type:`nodeStream`,value:t,optionName:n}:e,pl=(e,t,n)=>{let r=st[e];if(r===void 0)throw TypeError(`The \`${n}: ${t}\` option is invalid: no such standard stream.`);return r},ml=({input:e,inputFile:t},n)=>n===0?[...hl(e),..._l(t)]:[],hl=e=>e===void 0?[]:[{type:gl(e),value:e,optionName:`input`}],gl=e=>{if(co(e,{checkOpen:!1}))return`nodeStream`;if(typeof e==`string`)return`string`;if(N(e))return`uint8Array`;throw Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},_l=e=>e===void 0?[]:[{...vl(e),optionName:`inputFile`}],vl=e=>{if(Xs(e))return{type:`fileUrl`,value:e};if(ec(e))return{type:`filePath`,value:{file:e}};throw Error("The `inputFile` option must be a file path string or a file URL.")},yl=e=>pc.has(e),bl=({type:e,value:n})=>e===`filePath`?y.resolve(n.file):t(n),xl=e=>e.filter((t,n)=>e.every((e,r)=>!Sl(t,e)||n>=r||t.type===`generator`||t.type===`asyncGenerator`)),Sl=(e,t)=>e.value===t.value&&e.direction===t.direction,Cl=({stdioItem:{type:e,value:t,optionName:n},direction:r,fileDescriptors:i,isSync:a})=>{let o=wl(i,e);if(o.length!==0){if(a)El({otherStdioItems:o,type:e,value:t,optionName:n,direction:r});else{if(mc.has(e))return Dl({otherStdioItems:o,type:e,value:t,optionName:n,direction:r});hc.has(e)&&kl({otherStdioItems:o,type:e,value:t,optionName:n})}}},wl=(e,t)=>e.flatMap(({direction:e,stdioItems:t})=>t.map(t=>({...t,direction:e}))).filter(e=>Tl(e.type,t)),Tl=(e,t)=>e===t||yl(e)&&yl(t),El=({otherStdioItems:e,type:t,value:n,optionName:r,direction:i})=>{pc.has(t)&&Dl({otherStdioItems:e,type:t,value:n,optionName:r,direction:i})},Dl=({otherStdioItems:e,type:t,value:n,optionName:r,direction:i})=>{let a=e.filter(e=>Ol(e,t,n));if(a.length===0)return;let o=a.find(e=>e.direction!==i);return Al(o,r,t),i===`output`||t===`webStream`?a[0].stream:void 0},Ol=(e,t,n)=>yl(e.type)?bl(e)===bl({type:t,value:n}):e.value===n,kl=({otherStdioItems:e,type:t,value:n,optionName:r})=>{let i=e.find(({value:{transform:e}})=>e===n.transform);Al(i,r,t)},Al=(e,t,n)=>{if(e!==void 0)throw TypeError(`The \`${e.optionName}\` and \`${t}\` options must not target ${gc[n]} that is the same.`)},jl=(e,t,n,r)=>{let i=zc(t,n,r).map((e,n)=>Ml({stdioOption:e,fdNumber:n,options:t,isSync:r})),a=ql({initialFileDescriptors:i,addProperties:e,options:t,isSync:r});return t.stdio=a.map(({stdioItems:e})=>Zl(e)),a},Ml=({stdioOption:e,fdNumber:t,options:n,isSync:r})=>{let i=ct(t),{stdioItems:a,isStdioArray:o}=Nl({stdioOption:e,fdNumber:t,options:n,optionName:i}),s=Oc({stdioItems:a,isStdioArray:o,fdNumber:t,optionName:i}),c=a.map(e=>cl({stdioItem:e,isStdioArray:o,fdNumber:t,direction:s,isSync:r})),l=xc(c,i,s,n),u=bc(l,s);return Kl(l,u),{direction:s,objectMode:u,stdioItems:l}},Nl=({stdioOption:e,fdNumber:t,options:n,optionName:r})=>{let i=Array.isArray(e)?e:[e],a=ml(n,t),o=[...Pl(i.map(e=>Il(e,r)),a),...a],s=xl(o),c=s.length>1;return Rl(s,c,r),Bl(s,c),{stdioItems:s,isStdioArray:c}},Pl=(e,t)=>t.length>0&&Fl(e)?[]:e,Fl=e=>e.length===1&&e[0].type===`native`&&e[0].value===`inherit`,Il=(e,t)=>tc(e)?Ll(e,t):{type:Bs(e,t),value:e,optionName:t},Ll=({value:e,input:t},n)=>(R(t,`${n}.input`),{type:Bs(e,n),value:e,direction:t?`input`:void 0,optionName:n}),Rl=(e,t,n)=>{if(e.length===0)throw TypeError(`The \`${n}\` option must not be an empty array.`);if(t){for(let{value:t,optionName:n}of e)if(zl.has(t))throw Error(`The \`${n}\` option must not include \`${t}\`.`)}},zl=/* @__PURE__ */ new Set([`ignore`]),Bl=(e,t)=>{for(let n of e)Gl(n),Vl(n),Ul(n,t)},Vl=({type:e,value:t,optionName:n})=>{if(e!==`native`)return;let r=typeof t==`number`?t:t?.fd;if(typeof r==`number`&&(!Number.isInteger(r)||r<0||r>Hl))throw TypeError(`The \`${n}\` option must be a non-negative 32-bit integer: got ${r}.`)},Hl=2**31-1,Ul=({type:e,value:t,optionName:n},r)=>{if(e===`native`){if(Wl(t)){if(r)throw TypeError(`The \`${n}\` option cannot combine file handles with other values.`)}else if(typeof t!=`string`&&typeof t!=`number`&&!G(t,{checkOpen:!1}))throw TypeError(`The \`${n}\` option is invalid: ${String(t)} (${typeof t}).`)}},Wl=e=>typeof e?.fd==`number`&&!G(e,{checkOpen:!1}),Gl=({type:e,value:t,optionName:n})=>{if(Zs(t))throw TypeError(`The \`${n}: URL\` option must use the \`file:\` scheme.
35
+ For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(rc(e,t))throw TypeError(`The \`${n}: { file: '...' }\` option must be used instead of \`${n}: '...'\`.`)},Kl=(e,t)=>{if(!t)return;let n=e.find(({type:e})=>fc.has(e));if(n!==void 0)throw TypeError(`The \`${n.optionName}\` option cannot use both files and transforms in objectMode.`)},ql=({initialFileDescriptors:e,addProperties:t,options:n,isSync:r})=>{let i=[];try{for(let a of e)Jl({fileDescriptor:a,fileDescriptors:i,addProperties:t,options:n,isSync:r});return i}catch(e){throw Xl(i),e}},Jl=({fileDescriptor:e,fileDescriptors:t,addProperties:n,options:r,isSync:i})=>{let{direction:a,objectMode:o,stdioItems:s}=e,c={direction:a,objectMode:o,stdioItems:[]};t.push(c);for(let e of s)c.stdioItems.push(Yl({stdioItem:e,addProperties:n,direction:a,objectMode:o,options:r,fileDescriptors:t,isSync:i}))},Yl=({stdioItem:e,addProperties:t,direction:n,objectMode:r,options:i,fileDescriptors:a,isSync:o})=>{let s=Cl({stdioItem:e,direction:n,fileDescriptors:a,isSync:o});return s===void 0?{...e,...t[n][e.type](e,i,r)}:{...e,stream:s}},Xl=e=>{for(let{stream:t}of e.flatMap(({stdioItems:e})=>e))t===void 0||F(t)||(t.on(`error`,()=>{}),t.destroy())},Zl=e=>{if(e.length>1)return e.some(({value:e})=>e===`overlapped`)?`overlapped`:`pipe`;let[{type:t,value:n}]=e;return t===`native`?n:`pipe`},Ql=(e,t)=>jl(iu,e,t,!0),Q=({type:e,optionName:t})=>{nu(t,gc[e])},$l=({optionName:e,value:t})=>(t===`overlapped`&&nu(e,`"${t}"`),{}),eu=e=>{let{optionName:t,value:n}=e;if(n===`pipe`&&t!==`stdin`)throw TypeError(`Only the \`stdin\` option, not \`${t}\`, can be an input pipe with synchronous methods.`);return $l(e)},tu=({optionName:e})=>{if(e!==`stdin`)throw TypeError(`Only the \`stdin\` option, not \`${e}\`, can be an input transform with synchronous methods.`)},nu=(e,t)=>{throw TypeError(`The \`${e}\` option cannot be ${t} with synchronous methods.`)},ru={generator(){},asyncGenerator:Q,webStream:Q,nodeStream:Q,webTransform:Q,duplex:Q,asyncIterable:Q,native:$l},iu={input:{...ru,generator:tu,native:eu,fileUrl:({value:e})=>({contents:()=>[P(le(e))]}),filePath:({value:{file:e}})=>({contents:()=>[P(le(e))]}),fileNumber:Q,iterable:({value:e})=>({contents:()=>[...e]}),string:({value:e})=>({contents:[e]}),uint8Array:({value:e,contents:t=[e]})=>({contents:t})},output:{...ru,fileUrl:({value:e})=>({path:e}),filePath:({value:{file:e,append:t}})=>({path:e,append:t}),fileNumber:({value:e})=>({path:e}),iterable:Q,string:Q,uint8Array:Q}},au=(e,t)=>e?void 0:ou.bind(void 0,t),ou=function*(e,t){if(typeof t!=`string`&&!N(t)&&!D.isBuffer(t))throw TypeError(`The \`${e}\` option's transform must use "objectMode: true" to receive as input: ${typeof t}.`);yield t},su=(e,t)=>e?cu.bind(void 0,t):lu.bind(void 0,t),cu=function*(e,t){uu(e,t),yield t},lu=function*(e,t){if(uu(e,t),typeof t!=`string`&&!N(t))throw TypeError(`The \`${e}\` option's function must yield a string or an Uint8Array, not ${typeof t}.`);yield t},uu=(e,t)=>{if(t==null)throw TypeError(`The \`${e}\` option's function must not call \`yield ${t}\`.
36
+ Instead, \`yield\` should either be called with a value, or not be called at all. For example:
37
+ if (condition) { yield value; }`)},du=(e,t,n)=>{if(n)return;if(e)return{transform:fu.bind(void 0,new TextEncoder)};let r=new _(t);return{transform:pu.bind(void 0,r),final:mu.bind(void 0,r)}},fu=function*(e,t){D.isBuffer(t)?yield P(t):typeof t==`string`?yield e.encode(t):yield t},pu=function*(e,t){yield N(t)?e.write(t):t},mu=function*(e){let t=e.end();t!==``&&(yield t)},hu=(e,t,n)=>n||t===`utf8`?void 0:{transform:gu.bind(void 0,Ui(e,t))},gu=function*(e,t){yield typeof t==`string`?P(D.from(t,e)):t},_u=f(async(e,t,n,r)=>{t.currentIterable=e(...n);try{for await(let e of t.currentIterable)r.push(e)}finally{delete t.currentIterable}}),vu=async function*(e,t,n){if(n===t.length){yield e;return}let{transform:r=Su}=t[n];for await(let i of r(e))yield*vu(i,t,n+1)},yu=async function*(e){for(let[t,{final:n}]of Object.entries(e))yield*bu(n,Number(t),e)},bu=async function*(e,t,n){if(e!==void 0)for await(let r of e())yield*vu(r,n,t+1)},xu=f(async({currentIterable:e},t)=>{if(e!==void 0)await(t?e.throw(t):e.return());else if(t)throw t}),Su=function*(e){yield e},Cu=(e,t,n,r)=>{try{for(let r of e(...t))n.push(r);r()}catch(e){r(wu(e))}},wu=e=>e||Object.assign(/* @__PURE__ */ Error(`Promise was rejected with falsy value`),{code:`ERR_FALSY_VALUE_REJECTION`,reason:e}),Tu=(e,t)=>{try{return[...t.flatMap(t=>[...Eu(t,e,0)]),...Du(e)]}catch(e){throw wu(e)}},Eu=function*(e,t,n){if(n===t.length){yield e;return}let{transform:r=ku}=t[n];for(let i of r(e))yield*Eu(i,t,n+1)},Du=function*(e){for(let[t,{final:n}]of Object.entries(e))yield*Ou(n,Number(t),e)},Ou=function*(e,t,n){if(e!==void 0)for(let r of e())yield*Eu(r,n,t+1)},ku=function*(e){yield e},Au=({value:e,value:{transform:t,final:n,binary:r,writableObjectMode:i,readableObjectMode:a},optionName:o},{encoding:s})=>{let c={},l=Mu(e,s,o),u=J(t),d=J(n),f=u?_u.bind(void 0,vu,c):Cu.bind(void 0,Eu),p=u||d?_u.bind(void 0,yu,c):Cu.bind(void 0,Du),m=u||d?xu.bind(void 0,c):void 0;return{stream:new me({writableObjectMode:i,writableHighWaterMark:he(i),readableObjectMode:a,readableHighWaterMark:he(a),defaultEncoding:Ui(r,s),transform(e,t,n){f([e,l,0],this,n)},flush(e){p([l],this,e)},destroy:m})}},ju=(e,t,n,r)=>{let i=t.filter(({type:e})=>e===`generator`),a=r?i.reverse():i;for(let{value:t,optionName:r}of a){if(!t.writableObjectMode){let r=Ui(t.binary,n);e=e.map(e=>typeof e==`string`?D.from(e,r):e)}let i=Mu(t,n,r);e=Tu(i,e)}return e},Mu=({transform:e,final:t,binary:n,writableObjectMode:r,readableObjectMode:i,preserveNewlines:a},o,s)=>{let c={};return[{transform:au(r,s)},du(n,o,r),Ma(n,a,r,c),{transform:e,final:t},{transform:su(i,s)},za({binary:n,preserveNewlines:a,readableObjectMode:i,state:c,encoding:o}),hu(n,o,i)].filter(Boolean)},Nu=(e,t)=>{for(let n of Pu(e))Fu(e,n,t)},Pu=e=>new Set(Object.entries(e).filter(([,{direction:e}])=>e===`input`).map(([e])=>Number(e))),Fu=(e,t,n)=>{let{stdioItems:r}=e[t],i=r.filter(({contents:e})=>e!==void 0);if(i.length===0&&r.every(({type:e})=>e!==`generator`))return;if(t!==0){let[{type:e,optionName:t}]=i;throw TypeError(`Only the \`stdin\` option, not \`${t}\`, can be ${gc[e]} with synchronous methods.`)}let a=i.flatMap(({type:e,contents:t})=>Iu(e,typeof t==`function`?t():t));n.input=Lu(a,r,n.encoding)},Iu=(e,t)=>e===`iterable`?t:t.filter(e=>e.length>0),Lu=(e,t,n)=>{let r=ju(e,t,Wi(n),!0);return Ru(r),Re(r)},Ru=e=>{let t=e.find(e=>!zu(e));t!==void 0&&Bu(`stdin`,t)},zu=e=>typeof e==`string`||N(e),Bu=(e,t)=>{throw TypeError(`The \`${e}\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${t}.`)},Vu=({stdioItems:e,encoding:t,verboseInfo:n,fdNumber:r})=>r!==`all`&&kt(n,r)&&!H.has(t)&&Hu(r)&&(e.some(({type:e,value:t})=>e===`native`&&Uu.has(t))||e.every(({type:e})=>Y.has(e))),Hu=e=>e===1||e===2,Uu=/* @__PURE__ */ new Set([`pipe`,`overlapped`]),Wu=async(e,t,n,r)=>{for await(let i of e)Ku(t)||qu(i,n,r)},Gu=(e,t,n)=>{for(let r of e)qu(r,t,n)},Ku=e=>e._readableState.pipes.some(e=>!dt(e)||Ku(e)),qu=(e,t,n)=>{let r=mn(e);un({type:`output`,verboseMessage:r,fdNumber:t,verboseInfo:n})},Ju=({fileDescriptors:e,syncResult:t,options:n,verboseInfo:r})=>{let i=t.output??Yu(n),a=/* @__PURE__ */ new Set,o=[];return{output:i.map((t,i)=>Xu({result:t,fileDescriptors:e,fdNumber:i,errors:o,outputFiles:a,verboseInfo:r},n)),error:o.find(e=>e!==void 0)}},Yu=({stdio:e})=>e.map((e,t)=>t!==0&&e===`pipe`?/* @__PURE__ */ new Uint8Array:null),Xu=({result:e,fileDescriptors:t,fdNumber:n,errors:r,outputFiles:i,verboseInfo:a},{buffer:o,encoding:s,lines:c,stripFinalNewline:l,maxBuffer:u})=>{if(e===null)return;let d=ls(e,n,{maxBuffer:u,buffer:o}),f=P(d),{stdioItems:p,objectMode:m}=t[n],{chunks:h,error:g}=Zu(f.length===0?[]:[f],p,s),{serializedResult:_,finalResult:v}=Qu({chunks:h,objectMode:m,encoding:s,lines:c,stripFinalNewline:l,fdNumber:n}),y=$u({serializedResult:_,fdNumber:n,verboseInfo:a,encoding:s,stdioItems:p,objectMode:m}),b=g??y;r.push(b);let x=o[n]?v:void 0;try{return b===void 0&&ed(h,p,i),x}catch(e){return r.push(e),x}},Zu=(e,t,n)=>{try{return{chunks:ju(e,t,n,!1),error:void 0}}catch(e){return{chunks:[],error:e}}},Qu=({chunks:e,objectMode:t,encoding:n,lines:r,stripFinalNewline:i,fdNumber:a})=>{if(t)return{serializedResult:e,finalResult:e};if(n===`buffer`){let t=Re(e);return{serializedResult:t,finalResult:t}}let o=Ie(e,n);return{serializedResult:o,finalResult:r[a]?Na(o,!i[a],t):o}},$u=({serializedResult:e,fdNumber:t,verboseInfo:n,encoding:r,stdioItems:i,objectMode:a})=>{if(!Vu({stdioItems:i,encoding:r,verboseInfo:n,fdNumber:t}))return;let o=Na(e,!1,a);try{Gu(o,t,n)}catch(e){return e}},ed=(e,t,n)=>{let r=t.filter(({type:e})=>fc.has(e));if(r.length===0)return;let i=Re(e),a=/* @__PURE__ */ new Set;for(let e of r){let{type:t,append:r}=e,o=t===`fileNumber`?e.path:bl(e);a.has(o)||(a.add(o),r||n.has(o)?ie(o,i):fe(o,i),n.add(o))}},td=async(e,t)=>{let[n,r]=await nd(e);return t.isForcefullyTerminated??=!1,[n,r]},nd=async e=>{let[t,n]=await Promise.allSettled([E(e,`spawn`),E(e,`exit`)]);return t.status===`rejected`?[]:n.status===`rejected`?rd(e):n.value},rd=async e=>{try{return await E(e,`exit`)}catch{return rd(e)}},id=async e=>{let[t,n]=await e;if(!ad(t,n)&&od(t,n))throw new Ue;return[t,n]},ad=(e,t)=>e===void 0&&t===void 0,od=(e,t)=>e!==0||t!==null,sd=({error:e,status:t,signal:n,output:r},{maxBuffer:i,buffer:a})=>{let o=cd(e,t,n),s=o?.code===`ETIMEDOUT`,{resultError:c,isMaxBuffer:l}=s?{resultError:o,isMaxBuffer:!1}:os({resultError:o,output:r,maxBuffer:i,buffer:a});return{resultError:c,exitCode:t,signal:n,timedOut:s,isMaxBuffer:l}},cd=(e,t,n)=>e===void 0?od(t,n)?new Ue:void 0:e,ld=(e,t,n)=>{let{file:r,commandArguments:i,command:a,escapedCommand:o,startTime:s,verboseInfo:c,options:l,fileDescriptors:u}=ud(e,t,n),d=md({file:r,commandArguments:i,options:l,command:a,escapedCommand:o,verboseInfo:c,fileDescriptors:u,startTime:s});return zs(d,c,l)},ud=(e,t,n)=>{let{command:r,escapedCommand:i,startTime:a,verboseInfo:o}=Sn(e,t,n),s=dd(n),{file:c,commandArguments:l,options:u}=wa(e,t,s);return fd(u),{file:c,commandArguments:l,command:r,escapedCommand:i,startTime:a,verboseInfo:o,options:u,fileDescriptors:Ql(u,o)}},dd=e=>e.node&&!e.ipc?{...e,ipc:!1}:e,fd=({ipc:e,ipcInput:t,detached:n,cancelSignal:r,killDescendants:i})=>{t!==void 0&&pd(`ipcInput`),e&&pd(`ipc: true`),n&&pd(`detached: true`),i&&pd(`killDescendants: true`),r&&pd(`cancelSignal`)},pd=e=>{throw TypeError(`The "${e}" option cannot be used with synchronous methods.`)},md=({file:e,commandArguments:t,options:n,command:r,escapedCommand:i,verboseInfo:a,fileDescriptors:o,startTime:s})=>{let c=hd({file:e,commandArguments:t,options:n,command:r,escapedCommand:i,fileDescriptors:o,startTime:s});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=sd(c,n),{output:m,error:h=l}=Ju({fileDescriptors:o,syncResult:c,options:n,verboseInfo:a}),g=m.map((e,t)=>$a(e,n,t)),_=to(m),v=$a(no(m,_,n),n,`all`,_);return _d({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:v,options:n,command:r,escapedCommand:i,startTime:s})},hd=({file:e,commandArguments:t,options:n,command:r,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{Nu(o,n);let r=gd(n);return{__proto__:null,...a(...ja(e,t,r))}}catch(e){return bs({error:e,command:r,escapedCommand:i,fileDescriptors:o,options:n,startTime:s,isSync:!0,...xs(o,n)})}},gd=({encoding:e,maxBuffer:t,...n})=>({...n,encoding:`buffer`,maxBuffer:as(t)}),_d=({error:e,exitCode:t,signal:n,timedOut:r,isMaxBuffer:i,stdio:a,all:o,options:s,command:c,escapedCommand:l,startTime:u})=>e===void 0?ys({command:c,escapedCommand:l,stdio:a,all:o,ipcOutput:[],options:s,startTime:u}):ws({error:e,command:c,escapedCommand:l,timedOut:r,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:t,signal:n,stdio:a,all:o,ipcOutput:[],options:s,startTime:u,isSync:!0}),vd=Symbol(`internalGetOneMessageOptions`),yd=({anyProcess:e,channel:t,isSubprocess:n,ipc:r},i)=>{let a=L(i),{reference:o=!0,filter:s}=a,{signal:c}=a[vd]??{};return gr({methodName:`getOneMessage`,isSubprocess:n,ipc:r,isConnected:Jr(e)}),bd({anyProcess:e,channel:t,isSubprocess:n,filter:s,reference:o,signal:c})},bd=async({anyProcess:e,channel:t,isSubprocess:n,filter:r,reference:i,signal:a})=>{Ir(t,i);let o=Gr(e,t,n),s=new AbortController;xd(a,s);try{return await Promise.race([Sd(o,r,s),Cd(o,n,s),wd(o,n,s)])}catch(t){throw a?.aborted||Nr(e),t}finally{s.abort(),Rr(t,i)}},xd=(e,t)=>{e!==void 0&&(e.aborted?t.abort():e.addEventListener(`abort`,()=>{t.abort()},{once:!0,signal:t.signal}))},Sd=async(e,t,{signal:n})=>{if(t===void 0){let[t]=await E(e,`message`,{signal:n});return t}for await(let[r]of T(e,`message`,{signal:n}))if(t(r))return r},Cd=async(e,t,{signal:n})=>{await E(e,`disconnect`,{signal:n}),yr(t)},wd=async(e,t,{signal:n})=>{let[r]=await E(e,`strict:error`,{signal:n});throw xr(r,t)},Td=Symbol(`internalGetEachMessageOptions`),Ed=(e,t)=>{let n=L(t),{reference:r=!0}=n,{signal:i,shouldAwait:a=!e.isSubprocess}=n[Td]??{};return Dd({...e,shouldAwait:a,reference:r,signal:i})},Dd=({anyProcess:e,waitProcess:t=e,channel:n,isSubprocess:r,ipc:i,shouldAwait:a,reference:o,signal:s})=>{gr({methodName:`getEachMessage`,isSubprocess:r,ipc:i,isConnected:Jr(e)}),Ir(n,o);let c=Gr(e,n,r),l=new AbortController,u={};return Od(s,l),kd(e,c,l),Ad({ipcEmitter:c,isSubprocess:r,controller:l,state:u}),jd({anyProcess:e,waitProcess:t,channel:n,ipcEmitter:c,isSubprocess:r,shouldAwait:a,controller:l,state:u,reference:o,signal:s})},Od=(e,t)=>{e!==void 0&&(e.aborted?t.abort():e.addEventListener(`abort`,()=>{t.abort()},{once:!0,signal:t.signal}))},kd=async(e,t,n)=>{try{await E(t,`disconnect`,{signal:n.signal}),n.abort()}catch{}},Ad=async({ipcEmitter:e,isSubprocess:t,controller:n,state:r})=>{try{let[i]=await E(e,`strict:error`,{signal:n.signal});r.error=xr(i,t),n.abort()}catch{}},jd=async function*({anyProcess:e,waitProcess:t,channel:n,ipcEmitter:r,isSubprocess:i,shouldAwait:a,controller:o,state:s,reference:c,signal:l}){try{for await(let[e]of T(r,`message`,{signal:o.signal}))Md(s),yield e}catch{Md(s)}finally{o.abort(),Rr(n,c),!i&&!l?.aborted&&Nr(e),a&&await t}},Md=({error:e})=>{if(e)throw e},Nd=(e,t,{ipc:n})=>{Object.assign(e,Fd(t,!1,n,e))},Pd=()=>{let e=o,t=o.channel!==void 0;return{...Fd(e,!0,t),getCancelSignal:xi.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:!0,ipc:t})}},Fd=(e,t,n,r=e)=>({sendMessage:hi.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:n}),getOneMessage:yd.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:n}),getEachMessage:Ed.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:n,waitProcess:r})}),Id=({error:e,command:t,escapedCommand:r,fileDescriptors:i,options:a,startTime:o,verboseInfo:s})=>{Xl(i);let c=new n;c.kill=()=>!1;let l=Ld(c,i),u=Bd({error:e,command:t,escapedCommand:r,fileDescriptors:i,options:a,startTime:o,verboseInfo:s});return{subprocess:c,promise:u,all:a.all?l:void 0,convertedStreams:zd(u)}},Ld=(e,t)=>{let n=Rd(),r=Rd(),i=Rd(),a=Array.from({length:t.length-3},Rd),o=Rd(),s=[n,r,i,...a];return Object.assign(e,{stdin:n,stdout:r,stderr:i,stdio:s}),o},Rd=()=>{let e=new pe;return e.on(`error`,()=>{}),e.end(),e},zd=e=>{let t=async()=>{await e},n=function(){f(t)(e=>{e?this.destroy(e):this.push(null)})},r=f(t),i=(e,t,n)=>{r(n)},a=()=>new A({read:n}),o=()=>new j({write:i,final:r}),s=()=>new k({read:n,write:i,final:r}),c=()=>a()[Symbol.asyncIterator]();return{readable:a,writable:o,duplex:s,readableStream:()=>A.toWeb(a()),writableStream:()=>j.toWeb(o()),transformStream:()=>k.toWeb(s()),iterable:c,[Symbol.asyncIterator]:c}},Bd=async({error:e,command:t,escapedCommand:n,fileDescriptors:r,options:i,startTime:a,verboseInfo:o})=>{let s=bs({error:await e,command:t,escapedCommand:n,fileDescriptors:r,options:i,startTime:a,isSync:!1,...xs(r,i)});return zs(s,o,i)},Vd=(e,t)=>jl(Yd,e,t,!1),Hd=({type:e,optionName:t})=>{throw TypeError(`The \`${t}\` option cannot be ${gc[e]}.`)},Ud={fileNumber:Hd,generator:Au,asyncGenerator:Au,nodeStream:({value:e})=>({stream:e}),webTransform:({value:{transform:e,writableObjectMode:t,readableObjectMode:n}})=>({stream:k.from({writable:j.fromWeb(e.writable,{objectMode:t}),readable:A.fromWeb(e.readable,{objectMode:n})})}),duplex:({value:{transform:e}})=>({stream:e}),native(){}},Wd=function*(e,t){for(let n of e)Kd(n,t),yield n},Gd=async function*(e,t){for await(let n of e)Kd(n,t),yield n},Kd=(e,t)=>{zu(e)||Bu(t,e)},qd=e=>A.from(e.length===0?[]:[e]),Jd=(e,{encoding:t})=>Au(e,{encoding:Wi(t)}),Yd={input:{...Ud,generator:Jd,asyncGenerator:Jd,fileUrl:({value:e})=>({stream:oe(e)}),filePath:({value:{file:e}})=>({stream:oe(e)}),webStream:({value:e},t,n)=>({stream:A.fromWeb(e,{objectMode:n})}),iterable:({value:e,optionName:t},n,r)=>({stream:A.from(r?e:Wd(e,t))}),asyncIterable:({value:e,optionName:t},n,r)=>({stream:A.from(r?e:Gd(e,t))}),string:({value:e})=>({stream:qd(e)}),uint8Array:({value:e})=>({stream:qd(D.from(e))})},output:{...Ud,fileUrl:({value:e})=>({stream:se(e)}),filePath:({value:{file:e,append:t}})=>({stream:se(e,t?{flags:`a`}:{})}),webStream:({value:e})=>({stream:j.fromWeb(e,{objectMode:!0})}),iterable:Hd,asyncIterable:Hd,string:Hd,uint8Array:Hd}};function Xd(e){if(!Array.isArray(e))throw TypeError(`Expected an array, got \`${typeof e}\`.`);for(let t of e)nf(t);let t=e.some(({readableObjectMode:e})=>e),n=Zd(e,t),r=new Qd({objectMode:t,writableHighWaterMark:n,readableHighWaterMark:n});for(let t of e)r.add(t);return r}const Zd=(e,t)=>{if(e.length===0)return he(t);let n=e.filter(({readableObjectMode:e})=>e===t).map(({readableHighWaterMark:e})=>e);return Math.max(...n)};var Qd=class extends pe{#e=/* @__PURE__ */ new Set([]);#t=/* @__PURE__ */ new Set([]);#n=/* @__PURE__ */ new Set([]);#r;#i=Symbol(`unpipe`);#a=/* @__PURE__ */ new WeakMap;add(e){if(nf(e),this.#e.has(e))return;this.#e.add(e),this.#r??=$d(this,this.#e,this.#i);let t=rf({passThroughStream:this,stream:e,streams:this.#e,ended:this.#t,aborted:this.#n,onFinished:this.#r,unpipeEvent:this.#i});this.#a.set(e,t),e.pipe(this,{end:!1})}async remove(e){if(nf(e),!this.#e.has(e))return!1;let t=this.#a.get(e);return t!==void 0&&(this.#a.delete(e),e.unpipe(this),await t,!0)}};const $d=async(e,t,n)=>{mf(e,hf);let r=new AbortController;try{await Promise.race([ef(e,r),tf(e,t,n,r)])}finally{r.abort(),mf(e,-hf)}},ef=async(e,{signal:t})=>{try{await O(e,{signal:t,cleanup:!0})}catch(t){throw lf(e,t),t}},tf=async(e,t,n,{signal:r})=>{for await(let[i]of T(e,`unpipe`,{signal:r}))t.has(i)&&i.emit(n)},nf=e=>{if(typeof e?.pipe!=`function`)throw TypeError(`Expected a readable stream, got: \`${typeof e}\`.`)},rf=async({passThroughStream:e,stream:t,streams:n,ended:r,aborted:i,onFinished:a,unpipeEvent:o})=>{mf(e,gf);let s=new AbortController;try{await Promise.race([af(a,t,s),of({passThroughStream:e,stream:t,streams:n,ended:r,aborted:i,controller:s}),sf({stream:t,streams:n,ended:r,aborted:i,unpipeEvent:o,controller:s})])}finally{s.abort(),mf(e,-gf)}n.size>0&&n.size===r.size+i.size&&(r.size===0&&i.size>0?df(e):cf(e))},af=async(e,t,{signal:n})=>{try{await e,n.aborted||df(t)}catch(e){n.aborted||lf(t,e)}},of=async({passThroughStream:e,stream:t,streams:n,ended:r,aborted:i,controller:{signal:a}})=>{try{await O(t,{signal:a,cleanup:!0,readable:!0,writable:!1}),n.has(t)&&r.add(t)}catch(r){if(a.aborted||!n.has(t))return;uf(r)?i.add(t):ff(e,r)}},sf=async({stream:e,streams:t,ended:n,aborted:r,unpipeEvent:i,controller:{signal:a}})=>{if(await E(e,i,{signal:a}),!e.readable)return E(a,`abort`,{signal:a});t.delete(e),n.delete(e),r.delete(e)},cf=e=>{e.writable&&e.end()},lf=(e,t)=>{uf(t)?df(e):ff(e,t)},uf=e=>e?.code===`ERR_STREAM_PREMATURE_CLOSE`,df=e=>{(e.readable||e.writable)&&e.destroy()},ff=(e,t)=>{e.destroyed||(e.once(`error`,pf),e.destroy(t))},pf=()=>{},mf=(e,t)=>{let n=e.getMaxListeners();n!==0&&n!==1/0&&e.setMaxListeners(n+t)},hf=2,gf=1,_f=(e,t,n)=>{e.pipe(t),vf(e,t),bf(e,t,n)},vf=async(e,t)=>{if(!(F(e)||F(t))){try{await O(e,{cleanup:!0,readable:!0,writable:!1})}catch{}yf(t)}},yf=e=>{e.writable&&e.end()},bf=async(e,t,n)=>{if(!(F(e)||F(t))){try{await O(t,{cleanup:!0,readable:!1,writable:!0})}catch{}n!==void 0&&await n(),xf(e)}},xf=e=>{e.readable&&e.destroy()},Sf=(e,t,n)=>{let r=/* @__PURE__ */ new Map;for(let[i,{stdioItems:a,direction:o}]of Object.entries(t)){let t=a.filter(({type:e})=>Y.has(e));for(let{stream:n}of t)Cf(e,n,o,i);let s=a.filter(({type:e})=>!Y.has(e));for(let{stream:t}of s)Tf({subprocess:e,stream:t,direction:o,fdNumber:i,pipeGroups:r,controller:n})}for(let[e,t]of r){let n=t.length===1?t[0]:Xd(t);_f(n,e)}},Cf=(e,t,n,r)=>{n===`output`?_f(e.stdio[r],t):_f(t,e.stdio[r]);let i=wf[r];i!==void 0&&(e[i]=t),e.stdio[r]=t},wf=[`stdin`,`stdout`,`stderr`],Tf=({subprocess:e,stream:t,direction:n,fdNumber:r,pipeGroups:i,controller:a})=>{if(t===void 0)return;Ef(t,a);let[o,s]=n===`output`?[t,e.stdio[r]]:[e.stdio[r],t],c=i.get(o)??[];i.set(o,[...c,s])},Ef=(e,{signal:t})=>{F(e)&&Fr(e,Df,t)},Df=2,Of=o.platform===`win32`,kf=e=>!Of&&e.killDescendants?{...e,detached:!0}:e,Af=(e,{killDescendants:t})=>{if(!t){let t=e.kill.bind(e);return(...n)=>e.pid!==void 0&&t(...n)}return(Of?Pf:Nf).bind(void 0,e)},jf=e=>e.pid===void 0||Of&&Mf(e),Mf=({exitCode:e,signalCode:t})=>e!==null||t!==null,Nf=(e,t)=>{if(jf(e))return!1;try{return o.kill(-e.pid,t)}catch{return e.kill(t)}},Pf=(e,t)=>{if(jf(e))return!1;let n=Ff();return n===void 0?e.kill(t):(r(n,[`/pid`,`${e.pid}`,`/T`,`/F`],n=>{n&&e.kill(t)}),!0)},Ff=()=>{let e=[o.env.SystemRoot,o.env.windir].find(e=>e&&If(e));return e===void 0?void 0:ge.join(e,`System32`,`taskkill.exe`)},If=e=>{let{root:t}=ge.parse(e);return/^[a-z]:[/\\]/i.test(t)},$=[];$.push(`SIGHUP`,`SIGINT`,`SIGTERM`),process.platform!==`win32`&&$.push(`SIGALRM`,`SIGABRT`,`SIGVTALRM`,`SIGXCPU`,`SIGXFSZ`,`SIGUSR2`,`SIGTRAP`,`SIGSYS`,`SIGQUIT`,`SIGIOT`),process.platform===`linux`&&$.push(`SIGIO`,`SIGPOLL`,`SIGPWR`,`SIGSTKFLT`);const Lf=e=>!!e&&typeof e==`object`&&typeof e.removeListener==`function`&&typeof e.emit==`function`&&typeof e.reallyExit==`function`&&typeof e.listeners==`function`&&typeof e.kill==`function`&&typeof e.pid==`number`&&typeof e.on==`function`,Rf=Symbol.for(`signal-exit emitter`),zf=globalThis,Bf=Object.defineProperty.bind(Object);var Vf=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(zf[Rf])return zf[Rf];Bf(zf,Rf,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,t){this.listeners[e].push(t)}removeListener(e,t){let n=this.listeners[e],r=n.indexOf(t);
38
+ /* c8 ignore start */
39
+ r!==-1&&
40
+ /* c8 ignore stop */
41
+ (r===0&&n.length===1?n.length=0:n.splice(r,1))}emit(e,t,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let r=!1;for(let i of this.listeners[e])r=i(t,n)===!0||r;return e===`exit`&&(r=this.emit(`afterExit`,t,n)||r),r}},Hf=class{};const Uf=e=>({onExit(t,n){return e.onExit(t,n)},load(){return e.load()},unload(){return e.unload()}});var Wf=class extends Hf{onExit(){return()=>{}}load(){}unload(){}},Gf=class extends Hf{
42
+ /* c8 ignore start */
43
+ #e=Kf.platform===`win32`?`SIGINT`:`SIGHUP`;
44
+ /* c8 ignore stop */
45
+ #t=new Vf;#n;#r;#i;#a={};#o=!1;constructor(e){super(),this.#n=e,this.#a={};for(let t of $)this.#a[t]=()=>{let n=this.#n.listeners(t),{count:r}=this.#t,i=e;
46
+ /* c8 ignore stop */
47
+ if(typeof i.__signal_exit_emitter__==`object`&&typeof i.__signal_exit_emitter__.count==`number`&&(r+=i.__signal_exit_emitter__.count),n.length===r){this.unload();let n=this.#t.emit(`exit`,null,t),r=t===`SIGHUP`?this.#e:t;n||e.kill(e.pid,r)}};this.#i=e.reallyExit,this.#r=e.emit}onExit(e,t){
48
+ /* c8 ignore start */
49
+ if(!Lf(this.#n))return()=>{};
50
+ /* c8 ignore stop */
51
+ this.#o===!1&&this.load();let n=t?.alwaysLast?`afterExit`:`exit`;return this.#t.on(n,e),()=>{this.#t.removeListener(n,e),this.#t.listeners.exit.length===0&&this.#t.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#o){this.#o=!0,this.#t.count+=1;for(let e of $)try{let t=this.#a[e];t&&this.#n.on(e,t)}catch{}this.#n.emit=(e,...t)=>this.#c(e,...t),this.#n.reallyExit=e=>this.#s(e)}}unload(){this.#o&&(this.#o=!1,$.forEach(e=>{let t=this.#a[e];
52
+ /* c8 ignore start */
53
+ if(!t)throw Error(`Listener not defined for signal: `+e);
54
+ /* c8 ignore stop */
55
+ try{this.#n.removeListener(e,t)}catch{}
56
+ /* c8 ignore stop */
57
+ }),this.#n.emit=this.#r,this.#n.reallyExit=this.#i,--this.#t.count)}#s(e){return Lf(this.#n)?
58
+ /* c8 ignore stop */
59
+ (this.#n.exitCode=e||0,this.#t.emit(`exit`,this.#n.exitCode,null),this.#i.call(this.#n,this.#n.exitCode)):0}#c(e,...t){let n=this.#r;if(e===`exit`&&Lf(this.#n)){typeof t[0]==`number`&&(this.#n.exitCode=t[0]);
60
+ /* c8 ignore start */
61
+ let r=n.call(this.#n,e,...t);
62
+ /* c8 ignore stop */
63
+ return this.#t.emit(`exit`,this.#n.exitCode,null),r}return n.call(this.#n,e,...t)}};const Kf=globalThis.process,{onExit:qf,load:Jf,unload:Yf}=Uf(Lf(Kf)?new Gf(Kf):new Wf),Xf=(e,{cleanup:t,detached:n},{signal:r})=>{if(!t||n)return;let i=qf(()=>{e()});w(r,()=>{i()})},Zf=()=>({readableDestroy:/* @__PURE__ */ new WeakMap,writableFinal:/* @__PURE__ */ new WeakMap,writableDestroy:/* @__PURE__ */ new WeakMap}),Qf=(e,t,n)=>{let r=e[n];r.has(t)||r.set(t,[]);let i=r.get(t),a=Pr();return i.push(a),{resolve:a.resolve.bind(a),promises:i}},$f=async({resolve:e,promises:t},n)=>{e();let[r]=await Promise.race([Promise.allSettled([!0,n]),Promise.all([!1,...t])]);return!r},ep=({subprocessStdout:e,subprocess:t,binary:n,shouldEncode:r,encoding:i,preserveNewlines:a})=>{let o=new AbortController;return tp(t,o),ip({stream:e,controller:o,binary:n,shouldEncode:!e.readableObjectMode&&r,encoding:i,shouldSplit:!e.readableObjectMode,preserveNewlines:a})},tp=async(e,t)=>{try{await e}catch{}finally{t.abort()}},np=({stream:e,onStreamEnd:t,lines:n,encoding:r,stripFinalNewline:i,allMixed:a})=>{let o=new AbortController;rp(t,o,e);let s=e.readableObjectMode&&!a;return ip({stream:e,controller:o,binary:r===`buffer`,shouldEncode:!s,encoding:r,shouldSplit:!s&&n,preserveNewlines:!i})},rp=async(e,t,n)=>{try{await e}catch{n.destroy()}finally{t.abort()}},ip=({stream:e,controller:t,binary:n,shouldEncode:r,encoding:i,shouldSplit:a,preserveNewlines:o})=>{let s=T(e,`data`,{signal:t.signal,highWaterMark:op,highWatermark:op});return sp({onStdoutChunk:s,controller:t,binary:n,shouldEncode:r,encoding:i,shouldSplit:a,preserveNewlines:o})},ap=he(!0),op=ap,sp=async function*({onStdoutChunk:e,controller:t,binary:n,shouldEncode:r,encoding:i,shouldSplit:a,preserveNewlines:o}){let s=cp({binary:n,shouldEncode:r,encoding:i,shouldSplit:a,preserveNewlines:o});try{for await(let[t]of e)yield*Eu(t,s,0)}catch(e){if(!t.signal.aborted)throw e}finally{yield*Du(s)}},cp=({binary:e,shouldEncode:t,encoding:n,shouldSplit:r,preserveNewlines:i})=>[du(e,n,!t),Ma(e,i,!r,{})].filter(Boolean),lp=(e,t,n)=>{let{from:r,binary:i=!1,preserveNewlines:a=!1}=L(n);R(i,`binary`),R(a,`preserveNewlines`);let o=i||H.has(t),s=$c(e,r),c=ep({subprocessStdout:s,subprocess:e,binary:o,shouldEncode:!0,encoding:t,preserveNewlines:a});return up(c,s,e)},up=async function*(e,t,n){try{yield*e}finally{t.readable&&t.destroy(),await n}},dp=async(e,t,n,{isSameDirection:r,stopOnExit:i=!1,readable:a=!0,writable:o=!0}={})=>{let s=fp(e,n),c=new AbortController;try{await Promise.race([...i?[n.exitPromise]:[],O(e,{cleanup:!0,signal:c.signal,readable:a,writable:o})])}catch(i){!s.stdinCleanedUp&&!hp(e,t,n,i)&&gp(i,t,n,r)}finally{c.abort()}},fp=(e,{originalStreams:t,subprocess:n})=>{let[r]=t,i={stdinCleanedUp:!1};return(e===r||e===n.stdin)&&pp(e,n,i),i},pp=(e,t,n)=>{let{_destroy:r}=e;e._destroy=(...i)=>{mp(t,n),r.call(e,...i)}},mp=({exitCode:e,signalCode:t},n)=>{(e!==null||t!==null)&&(n.stdinCleanedUp=!0)},hp=(e,t,n,r)=>{let i=n.originalStreams[t];return e!==i&&vp(n,t)&&i?.destroyed===!0&&(yp(r)||r?.code===`ABORT_ERR`)},gp=(e,t,n,r)=>{if(!_p(e,t,n,r))throw e},_p=(e,t,n,r=!0)=>n.propagating?bp(e)||yp(e):(n.propagating=!0,vp(n,t)===r?bp(e):yp(e)),vp=({fileDescriptors:e},t)=>t!==`all`&&e[t].direction===`input`,yp=e=>e?.code===`ERR_STREAM_PREMATURE_CLOSE`,bp=e=>e?.code===`EPIPE`,xp=async e=>{if(e!==void 0)try{await Cp(e)}catch{}},Sp=async e=>{if(e!==void 0)try{await wp(e)}catch{}},Cp=async e=>{await O(e,{cleanup:!0,readable:!1,writable:!0})},wp=async e=>{await O(e,{cleanup:!0,readable:!0,writable:!1})},Tp=e=>{if(e)throw e},Ep=(e,t,n)=>{n&&!yp(n)?e.destroy(n):t&&e.destroy()},Dp=({subprocess:e,concurrentStreams:t,encoding:n},r)=>{let{from:i,binary:a=!0,preserveNewlines:o=!0}=L(r);R(a,`binary`),R(o,`preserveNewlines`);let s=a||H.has(n),c=$c(e,i),l=Qf(t,c,`readableDestroy`),{readableEncoding:u,readableObjectMode:d,readableHighWaterMark:p}=Op(c,s),{read:m,onStdoutDataDone:h}=kp({subprocessStdout:c,subprocess:e,binary:s,encoding:n,preserveNewlines:o}),g=new A({read:m,destroy:f(Np.bind(void 0,{subprocessStdout:c,subprocess:e,waitReadableDestroy:l})),highWaterMark:p,objectMode:d,encoding:u});return jp({subprocessStdout:c,onStdoutDataDone:h,readable:g,subprocess:e}),g},Op=({readableEncoding:e,readableObjectMode:t,readableHighWaterMark:n},r)=>r?{readableEncoding:e,readableObjectMode:t,readableHighWaterMark:n}:{readableEncoding:e,readableObjectMode:!0,readableHighWaterMark:ap},kp=({subprocessStdout:e,subprocess:t,binary:n,encoding:r,preserveNewlines:i})=>{let a=Pr(),o=ep({subprocessStdout:e,subprocess:t,binary:n,shouldEncode:!n,encoding:r,preserveNewlines:i});return{read(){Ap(this,o,a)},onStdoutDataDone:a}},Ap=async(e,t,n)=>{try{let{value:r,done:i}=await t.next();i?n.resolve():e.push(r)}catch{}},jp=async({subprocessStdout:e,onStdoutDataDone:t,readable:n,subprocess:r,subprocessStdin:i})=>{try{await wp(e),await r,await xp(i),await t,n.readable&&n.push(null)}catch(e){await xp(i),Pp(n,await Mp(r,e))}},Mp=async(e,t)=>{if(t.code!==`ERR_STREAM_PREMATURE_CLOSE`)return t;try{await e}catch(e){return e}return t},Np=async({subprocessStdout:e,subprocess:t,waitReadableDestroy:n},r)=>{await $f(n,t)&&(Pp(e,r?.code===`ABORT_ERR`?void 0:r),await t),Tp(r)},Pp=(e,t)=>{Ep(e,e.readable,t)},Fp=(e,t)=>A.toWeb(e.readable(t)),Ip=(e,t)=>j.toWeb(e.writable(t)),Lp=(e,t)=>k.toWeb(e.duplex(t)),Rp=({source:e,sourcePromise:t,boundOptions:n,createNested:r},...i)=>{let a=bn(),{destination:o,destinationStream:s,destinationError:c,from:l,unpipeSignal:u}=zp(n,r,i),{sourceStream:d,sourceError:f}=Up(e,l),{options:p,fileDescriptors:m}=Z.get(e);return{source:e,sourcePromise:t,sourceStream:d,sourceOptions:p,sourceError:f,destination:o,destinationStream:s,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:a}},zp=(e,t,n)=>{let r;try{r=Vp(e,t,...n)}catch(e){return{destinationError:e}}let{destination:i,pipeOptions:a}=r;try{let{from:e,to:t,unpipeSignal:n}=L(a);return dr(n,`unpipeSignal`),{destination:i,destinationStream:Qc(i,t),from:e,unpipeSignal:n}}catch(e){return Bp(i,n[0]),{destinationError:e}}},Bp=(e,t)=>{e!==t&&e.kill(),e.catch(()=>{})},Vp=(e,t,n,...r)=>{if(Array.isArray(n))return{destination:t(Hp,e)(n,...r),pipeOptions:e};if(typeof n==`string`||n instanceof URL||ye(n)){if(Object.keys(e).length>0)throw TypeError(`Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).`);let[i,a,o]=xe(n,...r);return{destination:t(Hp)(i,a,o),pipeOptions:o}}if(Z.has(n)){if(Object.keys(e).length>0)throw TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:n,pipeOptions:r[0]}}throw TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${n}`)},Hp=({options:e})=>({options:{__proto__:null,...e,...e.stdio===void 0&&{stdin:`pipe`},piped:!0}}),Up=(e,t)=>{try{return{sourceStream:$c(e,t)}}catch(e){return{sourceError:e}}},Wp=({sourceStream:e,sourceError:t,destinationStream:n,destinationError:r,fileDescriptors:i,sourceOptions:a,startTime:o})=>{let s=Gp({sourceStream:e,sourceError:t,destinationStream:n,destinationError:r});if(s!==void 0)throw Kp({error:s,fileDescriptors:i,sourceOptions:a,startTime:o})},Gp=({sourceStream:e,sourceError:t,destinationStream:n,destinationError:r})=>{if(t!==void 0&&r!==void 0)return r;if(r!==void 0)return xf(e),r;if(t!==void 0)return yf(n),t},Kp=({error:e,fileDescriptors:t,sourceOptions:n,startTime:r})=>bs({error:e,command:qp,escapedCommand:qp,fileDescriptors:t,options:n,startTime:r,isSync:!1}),qp=`source.pipe(destination)`,Jp=async e=>{let[{status:t,reason:n,value:r=n},{status:i,reason:a,value:o=a},{reason:s,value:c=s}]=await e;if(o.pipedFrom.includes(c)||o.pipedFrom.push(c),i===`rejected`)throw o;if(t===`rejected`)throw r;return o},Yp=(e,t,n)=>{let r=am.has(t)?Zp(e,t):Xp(e,t);return Fr(e,om,n.signal),Fr(t,sm,n.signal),im(t),r},Xp=(e,t)=>{let n=Xd([e]);return em(n,e),_f(n,t,()=>rm(n)),am.set(t,n),n},Zp=(e,t)=>{let n=am.get(t);return n.add(e),em(n,e),n},Qp=/* @__PURE__ */ new WeakMap,$p=/* @__PURE__ */ new WeakMap,em=(e,t)=>{tm(Qp,e,t),tm($p,t,e)},tm=(e,t,n)=>{e.has(t)||e.set(t,/* @__PURE__ */ new Set),e.get(t).add(n)},nm=async(e,t)=>{Qp.get(e)?.delete(t),$p.get(t)?.delete(e),await e.remove(t)},rm=async e=>{for(let t of Qp.get(e)){let n=$p.get(t);n.delete(e),n.size>0&&await e.remove(t)}},im=async e=>{try{await O(e,{cleanup:!0,readable:!1,writable:!0})}catch{}am.delete(e)},am=/* @__PURE__ */ new WeakMap,om=2,sm=1,cm=(e,t)=>e===void 0?[]:[lm(e,t)],lm=async(e,{sourceStream:t,mergedStream:n,fileDescriptors:r,sourceOptions:i,startTime:a})=>{throw await d(e,t),await nm(n,t),Kp({error:/* @__PURE__ */ Error("Pipe canceled by `unpipeSignal` option."),fileDescriptors:r,sourceOptions:i,startTime:a})},um=(e,...t)=>{if(M(t[0]))return um.bind(void 0,{...e,boundOptions:{...e.boundOptions,...t[0]}});if(e.source===void 0)return e.sourcePromise;let{destination:n,...r}=Rp(e,...t),i=new AbortController,a=Tm({...r,destination:n,pipeFailureController:i});return a.pipe=um.bind(void 0,{...e,source:n,sourcePromise:a,boundOptions:{}}),dm(a,n,i.signal),a},dm=(e,t,n)=>{t!==void 0&&(fm(e,t),_m(e,t,n))},fm=(e,t)=>{let n=Z.get(t);Z.set(e,n),e.stdio=t.stdio,e.all=t.all;let{options:{encoding:r}}=n,i=Zf();e[Symbol.asyncIterator]=lp.bind(void 0,e,r,{}),e.iterable=lp.bind(void 0,e,r),e.readable=hm.bind(void 0,e,{subprocess:e,concurrentStreams:i,encoding:r}),e.readableStream=Fp.bind(void 0,e),pm(e,t)},pm=(e,t)=>{t.all===void 0?e.all=void 0:Object.defineProperty(e,"all",{get(){mm(e,t.all);let n=e.readable({from:`all`});return n.on(`error`,()=>{}),mm(e,n),n},enumerable:!0,configurable:!0})},mm=(e,t)=>{Object.defineProperty(e,"all",{value:t,writable:!0,enumerable:!0,configurable:!0})},hm=(e,t,...n)=>{let r=Dp(t,...n);return gm(e,r),r},gm=async(e,t)=>{try{await e}catch(e){t.destroy(e)}},_m=(e,t,n)=>{e.sendMessage=t.sendMessage,e.getOneMessage=vm.bind(void 0,t,n),e.getEachMessage=xm.bind(void 0,e,t,n)},vm=(e,t,...n)=>{let r=new AbortController,i=e.getOneMessage(...Cm(n,r.signal,vd));return ym(t,i,r)},ym=async(e,t,n)=>{try{return await Promise.race([t,bm(e,n.signal)])}finally{n.abort()}},bm=(e,t)=>new Promise((n,r)=>{e.aborted?r(e.reason):e.addEventListener(`abort`,()=>{r(e.reason)},{once:!0,signal:t})}),xm=(e,t,n,...r)=>{let i=new AbortController,a=t.getEachMessage(...Cm(r,i.signal,Td));return wm(n,i),Sm(e,a,i)},Sm=async function*(e,t,n){try{yield*t}finally{n.abort(),await e}},Cm=(e,t,n)=>{if(e[0]===null)return e;let[r]=e;return[{...r,[n]:{signal:t,shouldAwait:!1}}]},wm=(e,t)=>{e.aborted?t.abort():e.addEventListener(`abort`,()=>{t.abort()},{once:!0,signal:t.signal})},Tm=async({source:e,sourcePromise:t,sourceStream:n,sourceOptions:r,sourceError:i,destination:a,destinationStream:o,destinationError:s,unpipeSignal:c,fileDescriptors:l,startTime:u,pipeFailureController:d})=>{let f=new AbortController;try{let d=Em(t,a,e);Wp({sourceStream:n,sourceError:i,destinationStream:o,destinationError:s,fileDescriptors:l,sourceOptions:r,startTime:u});let p=Yp(n,o,f);return await Promise.race([Jp(d),...cm(c,{sourceStream:n,mergedStream:p,sourceOptions:r,fileDescriptors:l,startTime:u})])}catch(e){throw d.abort(e),e}finally{f.abort()}},Em=(e,t,n)=>Promise.allSettled([e,t,n]),Dm=async({stream:e,onStreamEnd:t,fdNumber:n,encoding:r,buffer:i,maxBuffer:a,lines:o,allMixed:s,stripFinalNewline:c,allFds:l,verboseInfo:u,streamInfo:d})=>{let f=Om({stream:e,onStreamEnd:t,fdNumber:n,encoding:r,allMixed:s,verboseInfo:u,streamInfo:d});if(!i){await Promise.all([km(e),f]);return}let p=eo(c,n,l),m=np({stream:e,onStreamEnd:t,lines:o,encoding:r,stripFinalNewline:p,allMixed:s}),[h]=await Promise.all([Am({stream:e,iterable:m,fdNumber:n,encoding:r,maxBuffer:a,lines:o}),f]);return h},Om=async({stream:e,onStreamEnd:t,fdNumber:n,encoding:r,allMixed:i,verboseInfo:a,streamInfo:{fileDescriptors:o}})=>{if(!Vu({stdioItems:o[n]?.stdioItems,encoding:r,verboseInfo:a,fdNumber:n}))return;let s=np({stream:e,onStreamEnd:t,lines:!0,encoding:r,stripFinalNewline:!0,allMixed:i});await Wu(s,e,n,a)},km=async e=>{await x(),e.readableFlowing===null&&e.resume()},Am=async({stream:e,stream:{readableObjectMode:t},iterable:n,fdNumber:r,encoding:i,maxBuffer:a,lines:o})=>{try{return t||o?await No(n,{maxBuffer:a}):i===`buffer`?new Uint8Array(await Fo(n,{maxBuffer:a})):await Xo(n,{maxBuffer:a})}catch(n){return Mm(es({error:n,stream:e,readableObjectMode:t,lines:o,encoding:i,fdNumber:r}))}},jm=async e=>{try{return await e}catch(e){return Mm(e)}},Mm=e=>je(e?.bufferedData)?new Uint8Array(e.bufferedData):e?.bufferedData,Nm=({subprocess:e,encoding:t,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:a,verboseInfo:o,streamInfo:s})=>e.stdio.map((e,c)=>Pm({stream:e,fdNumber:c,encoding:t,buffer:n[c],maxBuffer:r[c],lines:i[c],allMixed:!1,stripFinalNewline:a,verboseInfo:o,streamInfo:s})),Pm=async({stream:e,fdNumber:t,encoding:n,buffer:r,maxBuffer:i,lines:a,allMixed:o,stripFinalNewline:s,allFds:c,verboseInfo:l,streamInfo:u})=>{if(!e)return;let d=dp(e,t,u);if(vp(u,t)){await d;return}let[f]=await Promise.all([Dm({stream:e,onStreamEnd:d,fdNumber:t,encoding:n,buffer:r,maxBuffer:i,lines:a,allMixed:o,stripFinalNewline:s,allFds:c,verboseInfo:l,streamInfo:u}),d]);return f},Fm=({stdout:e,stderr:t},{all:n})=>{if(!n)return;let r=[[e,1],[t,2]].filter(([e])=>e);return r.length===0?void 0:ut(Xd(r.map(([e])=>e)))},Im=({stdout:e,stderr:t},[,n,r])=>[...e!==null&&n?[1]:[],...t!==null&&r?[2]:[]],Lm=({subprocess:e,all:t,encoding:n,buffer:r,maxBuffer:i,lines:a,stripFinalNewline:o,verboseInfo:s,streamInfo:c})=>{let{stream:l,buffer:u,drainedStream:d}=Rm(e,t,r);return Promise.all([Pm({stream:l,buffer:u,fdNumber:`all`,encoding:n,maxBuffer:i[1]+i[2],lines:a[1]||a[2],allFds:Im(e,r),allMixed:l===t&&zm(e,t),stripFinalNewline:o,verboseInfo:s,streamInfo:c}),d===void 0?void 0:km(d)]).then(([e])=>e)},Rm=({stdout:e,stderr:t},n,[,r,i])=>{let a=r||i;return a?n?r?i?{stream:n,buffer:a}:{stream:e,buffer:a,drainedStream:n}:{stream:t,buffer:a,drainedStream:n}:{stream:void 0,buffer:a}:{stream:n,buffer:a}},zm=({stdout:e,stderr:t},n)=>n&&e&&t&&e.readableObjectMode!==t.readableObjectMode,Bm=e=>kt(e,`ipc`),Vm=(e,t)=>{let n=mn(e);un({type:`ipc`,verboseMessage:n,fdNumber:`ipc`,verboseInfo:t})},Hm=async({subprocess:e,buffer:t,maxBuffer:n,ipc:r,ipcOutput:i,verboseInfo:a})=>{if(!r)return i;let o=Bm(a),s=Dt(t,`ipc`),c=Dt(n,`ipc`),l=[];for await(let t of Dd({anyProcess:e,channel:e.channel,isSubprocess:!1,ipc:r,shouldAwait:!1,reference:!0}))if(s&&(ns(i,c),i.push(t)),o)try{Vm(t,a)}catch(e){l.push(e)}if(l.length>0)throw l[0];return i},Um=async(e,t)=>(await Promise.allSettled([e]),t),Wm=async({subprocess:e,kill:t,all:n,options:{encoding:r,buffer:i,maxBuffer:a,lines:o,timeoutDuration:s,cancelSignal:c,gracefulCancel:l,forceKillAfterDelay:u,stripFinalNewline:d,ipc:f,ipcInput:p},context:m,verboseInfo:h,fileDescriptors:g,originalStreams:_,onInternalError:v,controller:y})=>{let b=td(e,m),x={originalStreams:_,fileDescriptors:g,subprocess:e,exitPromise:b,propagating:!1},S=Nm({subprocess:e,encoding:r,buffer:i,maxBuffer:a,lines:o,stripFinalNewline:d,verboseInfo:h,streamInfo:x}),C=Lm({subprocess:e,all:n,encoding:r,buffer:i,maxBuffer:a,lines:o,stripFinalNewline:d,verboseInfo:h,streamInfo:x}),ee=[],w=Hm({subprocess:e,buffer:i,maxBuffer:a,ipc:f,ipcOutput:ee,verboseInfo:h}),T=Gm(_,e,x),E=Km(g,x);try{return await Promise.race([Promise.all([{},id(b),Promise.all(S),C,w,zi(e,p,f),...T,...E]),v,qm(e,y),...tr(t,s,m,y),...mr({kill:t,cancelSignal:c,gracefulCancel:l,context:m,controller:y}),...ki({subprocess:e,kill:t,cancelSignal:c,gracefulCancel:l,forceKillAfterDelay:u,context:m,controller:y})])}catch(e){return m.terminationReason??=`other`,e instanceof K&&t(),Promise.all([{error:e},b,Promise.all(S.map(e=>jm(e))),jm(C),Um(w,ee),Promise.allSettled(T),Promise.allSettled(E)])}},Gm=(e,t,n)=>e.map((e,r)=>e===t.stdio[r]?void 0:dp(e,r,n)),Km=(e,t)=>e.flatMap(({stdioItems:e,direction:n},r)=>e.filter(({value:e,stream:t=e})=>G(t,{checkOpen:!1})&&!F(t)).map(({type:e,value:i,stream:a=i})=>dp(a,r,t,{isSameDirection:Y.has(e),stopOnExit:e===`native`,readable:n!==`output`||Y.has(e)}))),qm=async(e,{signal:t})=>{let[n]=await E(e,`error`,{signal:t});throw n},Jm=({subprocess:e,concurrentStreams:t},n)=>{let{to:r}=L(n),i=Qc(e,r),{waitWritableFinal:a,waitWritableDestroy:o}=Ym(t,i),s=new j({...Xm(i,e,a),destroy:f(nh.bind(void 0,{subprocessStdin:i,subprocess:e,waitWritableFinal:a,waitWritableDestroy:o})),highWaterMark:i.writableHighWaterMark,objectMode:i.writableObjectMode});return $m(i,s,void 0,e),s},Ym=(e,t)=>({waitWritableFinal:Qf(e,t,`writableFinal`),waitWritableDestroy:Qf(e,t,`writableDestroy`)}),Xm=(e,t,n)=>({write:Zm.bind(void 0,e),final:f(Qm.bind(void 0,e,t,n))}),Zm=(e,t,n,r)=>{e.write(t,n)?r():e.once(`drain`,r)},Qm=async(e,t,n)=>{await $f(n,t)&&(e.writable&&e.end(),await t)},$m=async(e,t,n,r)=>{try{await Cp(e),await r,t.writable&&t.end()}catch(e){await Sp(n),Ep(t,!t.writableFinished,await eh(r,e))}},eh=async(e,t)=>{if(!th(t))return t;try{await e}catch(e){return e}return t},th=e=>e===void 0||yp(e)||e.code===`EPIPE`,nh=async({subprocessStdin:e,subprocess:t,waitWritableFinal:n,waitWritableDestroy:r},i)=>{await $f(n,t),await $f(r,t)&&(rh(e,i),await t),Tp(i)},rh=(e,t)=>{Ep(e,e.writable,t)},ih=({subprocess:e,concurrentStreams:t,encoding:n},r)=>{let{from:i,to:a,binary:o=!0,preserveNewlines:s=!0}=L(r);R(o,`binary`),R(s,`preserveNewlines`);let c=o||H.has(n),l=$c(e,i),u=Qc(e,a),d=Qf(t,l,`readableDestroy`),{waitWritableFinal:p,waitWritableDestroy:m}=Ym(t,u),{readableEncoding:h,readableObjectMode:g,readableHighWaterMark:_}=Op(l,c),{read:v,onStdoutDataDone:y}=kp({subprocessStdout:l,subprocess:e,binary:c,encoding:n,preserveNewlines:s}),b=new k({read:v,...Xm(u,e,p),destroy:f(ah.bind(void 0,{subprocessStdout:l,subprocessStdin:u,subprocess:e,waitReadableDestroy:d,waitWritableFinal:p,waitWritableDestroy:m})),readableHighWaterMark:_,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:g,writableObjectMode:u.writableObjectMode,encoding:h});return jp({subprocessStdout:l,onStdoutDataDone:y,readable:b,subprocess:e,subprocessStdin:u}),$m(u,b,l,e),b},ah=async({subprocessStdout:e,subprocessStdin:t,subprocess:n,waitReadableDestroy:r,waitWritableFinal:i,waitWritableDestroy:a},o)=>{await Promise.all([Np({subprocessStdout:e,subprocess:n,waitReadableDestroy:r},o),nh({subprocessStdin:t,subprocess:n,waitWritableFinal:i,waitWritableDestroy:a},o)])},oh=(e,{encoding:t})=>{let n=Zf();e.readable=Dp.bind(void 0,{subprocess:e,concurrentStreams:n,encoding:t}),e.writable=Jm.bind(void 0,{subprocess:e,concurrentStreams:n}),e.duplex=ih.bind(void 0,{subprocess:e,concurrentStreams:n,encoding:t}),e.readableStream=Fp.bind(void 0,e),e.writableStream=Ip.bind(void 0,e),e.transformStream=Lp.bind(void 0,e),e.iterable=lp.bind(void 0,e,t),e[Symbol.asyncIterator]=lp.bind(void 0,e,t,{})},sh=(e,t)=>Object.assign(e,t),ch=(e,t,n,r)=>{let{file:i,commandArguments:a,command:o,escapedCommand:s,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=lh(e,t,n),{subprocess:f,promise:p,kill:m,all:h,convertedStreams:g}=dh({file:i,commandArguments:a,options:u,startTime:c,verboseInfo:l,command:o,escapedCommand:s,fileDescriptors:d}),_=fh({promise:p,nodeChildProcess:f,kill:m,all:h,convertedStreams:g,options:u});return _.pipe=um.bind(void 0,{source:_,sourcePromise:p,boundOptions:{},createNested:r}),Z.set(_,{options:u,fileDescriptors:d}),_},lh=(e,t,n)=>{let{command:r,escapedCommand:i,startTime:a,verboseInfo:o}=Sn(e,t,n),{file:s,commandArguments:c,options:l}=wa(e,t,n),u=uh(l);return{file:s,commandArguments:c,command:r,escapedCommand:i,startTime:a,verboseInfo:o,options:u,fileDescriptors:Vd(u,o)}},uh=({timeout:e,signal:t,...n})=>({__proto__:null,...n,timeoutDuration:e}),dh=({file:e,commandArguments:t,options:n,startTime:r,verboseInfo:a,command:o,escapedCommand:s,fileDescriptors:c})=>{let l;try{l=i(...ja(e,t,kf(n)))}catch(e){return Id({error:e,command:o,escapedCommand:s,fileDescriptors:c,options:n,startTime:r,verboseInfo:a})}if(l.stdio===void 0)return Id({error:E(l,`error`).then(([e])=>e),command:o,escapedCommand:s,fileDescriptors:c,options:n,startTime:r,verboseInfo:a});let u=new AbortController;te(1/0,u.signal);let d=[...l.stdio];Sf(l,c,u),di(l,n);let f={},p=Pr(),m=ar.bind(void 0,{kill:Af(l,n),options:n,onInternalError:p,context:f,controller:u});Xf(m,n,u);let h=Fm(l,n),g=mh({subprocess:l,kill:m,all:h,options:n,startTime:r,verboseInfo:a,fileDescriptors:c,originalStreams:d,command:o,escapedCommand:s,context:f,onInternalError:p,controller:u});return{subprocess:l,promise:g,kill:m,all:h}},fh=({promise:e,nodeChildProcess:t,kill:n,all:r,convertedStreams:i,options:a})=>{let o=sh(e,ph(t,r));return o.kill=n??o.kill,i===void 0?oh(o,a):Object.assign(o,i),Nd(o,t,a),o},ph=(e,t)=>({nodeChildProcess:e,pid:e.pid,stdin:e.stdin,stdout:e.stdout,stderr:e.stderr,stdio:e.stdio,all:t,kill:e.kill.bind(e)}),mh=async({subprocess:e,kill:t,all:n,options:r,startTime:i,verboseInfo:a,fileDescriptors:o,originalStreams:s,command:c,escapedCommand:l,context:u,onInternalError:d,controller:f})=>{let[p,[m,h],g,_,v]=await Wm({subprocess:e,kill:t,all:n,options:r,context:u,verboseInfo:a,fileDescriptors:o,originalStreams:s,onInternalError:d,controller:f});f.abort(),d.resolve();let y=g.map((e,t)=>$a(e,r,t)),b=$a(_,r,`all`,Im(e,r.buffer)),x=hh({errorInfo:p,exitCode:m,signal:h,stdio:y,all:b,ipcOutput:v,context:u,options:r,command:c,escapedCommand:l,startTime:i});return zs(x,a,r)},hh=({errorInfo:e,exitCode:t,signal:n,stdio:r,all:i,ipcOutput:a,context:o,options:s,command:c,escapedCommand:l,startTime:u})=>Object.hasOwn(e,`error`)?ws({error:e.error,command:c,escapedCommand:l,timedOut:o.terminationReason===`timeout`,isCanceled:o.terminationReason===`cancel`||o.terminationReason===`gracefulCancel`,isGracefullyCanceled:o.terminationReason===`gracefulCancel`,isMaxBuffer:e.error instanceof K,isForcefullyTerminated:o.isForcefullyTerminated,exitCode:t,signal:n,stdio:r,all:i,ipcOutput:a,options:s,startTime:u,isSync:!1}):ys({command:c,escapedCommand:l,stdio:r,all:i,ipcOutput:a,options:s,startTime:u}),gh=(e,t)=>{let n={__proto__:null,...e},r=Object.fromEntries(Object.entries(t).map(([e,t])=>[e,_h(e,n[e],t)]));return{__proto__:null,...n,...r}},_h=(e,t,n)=>vh.has(e)&&M(t)&&M(n)?{...t,...n}:n,vh=/* @__PURE__ */ new Set([`env`,...Et]),yh=(e,t,n,r)=>{let i=(e,t,r)=>yh(e,t,n,r),a=(...a)=>bh({mapArguments:e,deepOptions:n,boundOptions:t,setBoundExeca:r,createNested:i},...a);return r!==void 0&&r(a,i,t),a},bh=({mapArguments:e,deepOptions:t={},boundOptions:n={},setBoundExeca:r,createNested:i},a,...o)=>{if(M(a))return i(e,gh(n,a),r);let{file:s,commandArguments:c,options:l,isSync:u}=xh({mapArguments:e,firstArgument:a,nextArguments:o,deepOptions:t,boundOptions:n});return u?ld(s,c,l):ch(s,c,l,i)},xh=({mapArguments:e,firstArgument:t,nextArguments:n,deepOptions:r,boundOptions:i})=>{let a=Ze(t)?Qe(t,n):[t,...n],[o,s,c]=xe(...a),l=gh(gh(r,i),c);for(let[e,t]of Object.entries(r))l[e]===void 0&&(l[e]=t);let{options:u=l,isSync:d=!1}={__proto__:null,...e({options:l})};return{file:o,commandArguments:s,options:u,isSync:d}},Sh=(e,t,n)=>{e.sync=t(wh,n),e.s=e.sync},Ch=({options:e})=>Th(e),wh=({options:e})=>({...Th(e),isSync:!0}),Th=e=>({options:{__proto__:null,...e,...Eh(e)}}),Eh=({stdin:e=`inherit`,input:t,inputFile:n,stdio:r})=>t===void 0&&n===void 0&&r===void 0?{stdin:e}:{},Dh={preferLocal:!0},Oh=yh(()=>({})),kh=yh(()=>({isSync:!0}));yh(Mi),yh(Ch,{},Dh,Sh);const{sendMessage:Ah,getOneMessage:jh,getEachMessage:Mh,getCancelSignal:Nh}=Pd();var Ph=/* @__PURE__ */ e({builder:()=>Hh,command:()=>`git`,description:()=>``});const Fh=`git`,Ih=``,Lh=process.cwd();function Rh(){try{return!!kh(`git`,[`--version`],{cwd:Lh}).stdout}catch{throw Error(`git is not installed`)}}function zh(){try{return kh(`git`,[`rev-parse`,`--is-inside-work-tree`],{cwd:Lh}).stdout===`true`}catch{throw Error(`not a git repository`)}}function Bh(){return Oh(`git`,[`config`,`core.hooksPath`,`.githooks`],{cwd:Lh})}function Vh(){try{return Rh()&&zh()}catch(e){return console.error(`Fail:`,e.message),!1}}function Hh(e){e.command(`hooks`,`Set .githooks as git.hooksPath`,{},()=>{Vh()&&Bh().then(()=>{console.log(`Done: set .githooks`)}).catch(()=>{console.error(`Fail:`,`setting hooks failed`),process.exitCode=1})}),e.demandCommand(1,"Typing `hooks`")}export{Oh as a,Ph as i,Fh as n,Ih as r,Hh as t};
@@ -0,0 +1,51 @@
1
+ import{i as e,t}from"./rolldown-runtime-9nwCUaSw.mjs";import{createRequire as n}from"node:module";import{fileURLToPath as r,pathToFileURL as i}from"node:url";import{exec as a,spawn as o}from"node:child_process";import{cwd as s}from"node:process";import c,{format as l,formatWithOptions as u,inspect as d,promisify as f}from"node:util";import p,{basename as m,delimiter as h,dirname as g,normalize as ee,resolve as _}from"node:path";import{closeSync as v,constants as y,openSync as b,readSync as x,statSync as S}from"node:fs";import C,{constants as w}from"node:fs/promises";import{pipeline as T}from"node:stream/promises";import{PassThrough as E}from"node:stream";import D from"node:readline";import O from"node:crypto";const te=`2.32.0`,ne=/git version\s+(\d+\.\d+\.\d+)/i,k=e=>e.match(ne)?.[1],A=/(\d+)\.(\d+)\.(\d+)/,j=e=>A.exec(e)?.slice(1,4).map(Number),M=(e,t)=>{let n=j(e),r=j(t);return n[0]===r[0]?n[1]===r[1]?n[2]>=r[2]:n[1]>r[1]:n[0]>r[0]},N=e=>{try{let t=k(e);return M(t,te)}catch{return!1}};let P=!1;const F=(e=process.stdout)=>c.styleText(`red`,`test`,{stream:e})!==`test`,I=e=>{P=!!e},L=e=>t=>P?c.styleText(e,t,{validateStream:!1}):t,R=L(`green`),z=L(`red`),B=L(`yellow`),V=L(`blue`),H=L(`dim`),U=L(`bold`),W=(...e)=>u({colors:P},...e);let G;const re=(e=console)=>{G=e},K=e=>{let t=process.hrtime.bigint();return(...n)=>{if(!G)return;let r=process.hrtime.bigint(),i=(r-t)/1000000n;t=r,G.debug(H(e+`: `)+W(...n)+H(` +${i}ms`))}},ie=/^path$/i,q={key:`PATH`,value:``};function ae(e){for(let t in e){if(!Object.prototype.hasOwnProperty.call(e,t)||!ie.test(t))continue;let n=e[t];return n?{key:t,value:n}:q}return q}function oe(e,t){let n=t.value.split(h),i=[],a=typeof e==`string`?e:r(e,{windows:!1}),o;do i.push(_(a,`node_modules`,`.bin`)),o=a,a=g(a);while(a!==o);i.push(g(process.execPath));let s=i.concat(n).join(h);return{key:t.key,value:s}}function se(e,t,n=!0){let r={...process.env,...t};if(!n)return r;let i=oe(e,ae(r));return r[i.key]=i.value,r}const ce=e=>{let t=e.length,n=new E,r=()=>{--t===0&&n.end()};for(let t of e)T(t,n,{end:!1}).then(r).catch(r);return n},le=/([()\][%!^"`<>&|;, *?])/g,ue=/^#!\s*(.+)/,de=/\.(?:com|exe)$/i,fe=/node_modules[\\/]\.bin[\\/][^\\/]+\.cmd$/i,pe=process.platform===`win32`,me=[`.EXE`,`.CMD`,`.BAT`,`.COM`],he=[``];function ge(e,t=[],n={}){if(n.shell===!0||!pe)return{command:e,args:t,options:n};let r=_e(e,n),i=null;if(r!==null){let e=Buffer.alloc(150),t=null;try{t=b(r,`r`),x(t,e,0,150,0)}catch{}finally{t!==null&&v(t)}let n=e.toString().match(ue);if(n!==null){let e=n[1].trim(),t=e.indexOf(` `),r=t===-1?e:e.slice(0,t),a=t===-1?``:e.slice(t+1),o=m(r);i=o===`env`?a||null:o}}if(i!==null&&r!==null&&(t=[r,...t],e=i,r=_e(e,n)),r===null||!de.test(r)){let i=r!==null&&fe.test(r);e=ee(e),e=e.replace(le,`^$1`),t=t.map(e=>(e=e.replace(/(?=(\\+?)?)\1"/g,`$1$1\\"`),e=e.replace(/(?=(\\+?)?)\1$/,`$1$1`),e=`"${e}"`,e=e.replace(le,`^$1`),i&&(e=e.replace(le,`^$1`)),e)),t=[`/d`,`/s`,`/c`,`"${[e,...t].join(` `)}"`],e=n.env?.comspec??`cmd.exe`,n={...n,windowsVerbatimArguments:!0}}return{command:e,args:t,options:n}}function _e(e,t){let n=(t.cwd??s()).toString(),r=t.env??process.env,i=ae(r).value,a=e.includes(`/`)||e.includes(`\\`)?[``]:[n,...i.split(h)],o=r.PATHEXT?r.PATHEXT.split(h):me;e.includes(`.`)&&o[0]!==``&&(o=[``,...o]);for(let t of[o,he])for(let r of a){let i=r.startsWith(`"`)&&r.endsWith(`"`)&&r.length>1?r.slice(1,-1):r,a=_(n,i,e);for(let e of t){let t=a+e;try{if(S(t).isFile())return t}catch{}}}return null}var ve=class extends Error{result;output;exitCode;get signalCode(){return this.result.signalCode}constructor(e,t,n,r){let i=`The process`;n&&(i=`The command \`${r?.length?`${n} ${r.map(e=>/[ "'`()]/.test(e)?JSON.stringify(e):e).join(` `)}`:n}\``);let a=e.exitCode??1;super(e.signalCode===null?`${i} exited with a non-zero status (${a})`:`${i} was killed by the signal ${e.signalCode}`),this.result=e,this.output=t,this.exitCode=a,Object.defineProperty(this,"result",{enumerable:!1,writable:!1,configurable:!1})}};const ye={timeout:void 0,persist:!1},be={windowsHide:!0};function xe(e){let t=new AbortController;for(let n of e){if(n.aborted)return t.abort(),n;n.addEventListener(`abort`,()=>{t.abort(n.reason)},{signal:t.signal})}return t.signal}async function Se(e){let t=``;try{for await(let n of e)t+=n.toString()}catch{}return t}var Ce=class{_process;_aborted=!1;_options;_command;_args;_resolveClose;_processClosed;_thrownError;get process(){return this._process}get pid(){return this._process?.pid}get exitCode(){if(this._process&&this._process.exitCode!==null)return this._process.exitCode}get signalCode(){return this._process?.signalCode??null}constructor(e,t,n){this._options={...ye,...n},this._command=e,this._args=t??[],this._processClosed=new Promise(e=>{this._resolveClose=e})}kill(e){return this._process?.kill(e)===!0}get aborted(){return this._aborted}get killed(){return this._process?.killed===!0}pipe(e,t,n){return we(e,t,{...n,stdin:this})}async*[Symbol.asyncIterator](){let e=this._process;if(!e)return;let t=[];this._streamErr&&t.push(this._streamErr),this._streamOut&&t.push(this._streamOut);let n=ce(t),r=D.createInterface({input:n});for await(let e of r)yield e.toString();if(await this._processClosed,e.removeAllListeners(),this._thrownError)throw this._thrownError;if(this._options?.throwOnError&&(this.exitCode!==0&&this.exitCode!==void 0||this.signalCode!==null))throw new ve(this,void 0,this._command,this._args)}async _waitForOutput(){let e=this._process;if(!e)throw Error(`No process was started`);let[t,n]=await Promise.all([this._streamOut?Se(this._streamOut):``,this._streamErr?Se(this._streamErr):``]);await this._processClosed;let{stdin:r}=this._options;if(r&&typeof r!=`string`&&await r,e.removeAllListeners(),this._thrownError)throw this._thrownError;let i={stderr:n,stdout:t,exitCode:this.exitCode};if(this._options.throwOnError&&(this.exitCode!==0&&this.exitCode!==void 0||this.signalCode!==null))throw new ve(this,i,this._command,this._args);return i}then(e,t){return this._waitForOutput().then(e,t)}_streamOut;_streamErr;spawn(){let e=this._options,t={...be,...e.nodeOptions},n=t?.cwd??s(),r=[];this._resetState(),e.timeout!==void 0&&r.push(AbortSignal.timeout(e.timeout)),e.signal!==void 0&&r.push(e.signal),e.persist===!0&&(t.detached=!0),r.length>0&&(t.signal=xe(r)),t.env=se(n,t.env,e.nodePath);let i=ge(this._command,this._args,t),a=o(i.command,i.args,i.options);if(a.stderr&&(this._streamErr=a.stderr),a.stdout&&(this._streamOut=a.stdout),this._process=a,a.once(`error`,this._onError),a.once(`close`,this._onClose),a.stdin){let{stdin:t}=e;typeof t==`string`?a.stdin.end(t):t?.process?.stdout?.pipe(a.stdin)}}_resetState(){this._aborted=!1,this._processClosed=new Promise(e=>{this._resolveClose=e}),this._thrownError=void 0}_onError=e=>{e.name===`AbortError`&&(!(e.cause instanceof Error)||e.cause.name!==`TimeoutError`)?this._aborted=!0:this._thrownError=e};_onClose=()=>{this._resolveClose&&this._resolveClose()}};const we=(e,t,n)=>{let r=new Ce(e,t,n);return r.spawn(),r},Te=K(`lint-staged:execGit`),Ee=[`-c`,`submodule.recurse=false`];[...Ee];const De=async(e,t)=>{Te(`Running git command:`,e);let n=await we(`git`,[...Ee,...e],{nodeOptions:{env:t?.env,cwd:t?.cwd}});if(n.exitCode>0)throw Error(n.stderr.trimEnd(),{cause:n});return t?.trim===!1?n.stdout:n.stdout.trimEnd()},J=()=>V(`⋯`),Oe=()=>R(`✔`),ke=()=>V(`→`),Y=()=>z(`✖`),Ae=()=>B(`⚠`),je=()=>H(`↓`),Me=()=>H(`┌`),Ne=()=>H(`│`),Pe=()=>H(`└`),Fe=(e,t,n)=>`${z(`${Y()} Validation Error:`)}
2
+
3
+ Invalid value for '${U(e)}': ${U(d(n))}
4
+
5
+ ${t}`,Ie=()=>z(`${Y()} Current directory is not a git directory!`),Le=()=>z(`${Y()} Failed to get staged files!`),Re=e=>`${z(`${Y()} lint-staged refused to run with files staged with "--intent-to-add":`)}
6
+
7
+ ${e.map(e=>`- ${e}`).join(`
8
+ `)}
9
+ `,ze=(e,t)=>B(`${Ae()} Detected incorrect braces with only single value: \`${e}\`. Reformatted as: \`${t}\`
10
+ `),Be=()=>`${Y()} lint-staged could not find any valid configuration.`,Ve=()=>`${ke()} lint-staged could not find any staged files.`,He=()=>`${ke()} lint-staged could not find any staged files matching configured tasks.`,Ue=(e,t,n)=>{let r=n===void 0?(e?"`--all` was used":t?"`--no-stash` was used":`there’s no initial commit yet`)+`. This might result in data loss`:"`--diff` was used";return B(`${Ae()} Skipping backup because ${r}.\n`)},We=()=>B(`${Ae()} Skipping hiding unstaged changes from partially staged files because \`--no-hide-partially-staged\` was used.\n`),Ge=()=>B(`${Ae()} Some of your tasks use \`git add\` command. Please remove it from the config since all modifications made by tasks will be automatically added to the git commit index.
11
+ `),Ke=()=>`Skipped because of errors from tasks.`,qe=()=>`\n${Y()} lint-staged failed because \`--fail-on-changes\` was used.`,Je=()=>`\n ${z(`${Y()} lint-staged failed due to a git error.`)}`,Ye=(e,t,n)=>`${z(`${Y()} Validation Error:`)}
12
+
13
+ Invalid value for option '${U(e)}': ${U(t)}
14
+
15
+ ${n}
16
+
17
+ See https://github.com/lint-staged/lint-staged#command-line-flags`,Xe=()=>`
18
+ ${B(`${Ae()} lint-staged prevented an empty git commit.
19
+ Use the --allow-empty option to continue, or check your task configuration`)}
20
+ `,Ze=(e=`<git-hash>`)=>`Any lost modifications can be restored from a git stash:
21
+
22
+ > git stash list --format="%h %s"
23
+ ${e} On main: lint-staged automatic backup
24
+ > git apply --index ${e}
25
+ `,Qe=e=>z(`${Y()} Failed to read config from file "${e}".`),$e=(e,t)=>`${z(`${Y()} Failed to parse config from file "${e}".`)}
26
+
27
+ ${t}
28
+
29
+ See https://github.com/lint-staged/lint-staged#configuration.`,et=()=>`Unstaged changes have been kept back in a patch file:`,tt=e=>z(`${Y()} lint-staged requires at least Git version ${U(e)}.
30
+
31
+ Please update Git: https://git-scm.com/downloads`),nt=(e=process.platform)=>{switch(e){case`darwin`:return 262144;case`win32`:return 8191;default:return 131072}},rt=K(`lint-staged:parseOptions`),it=({all:e,allowEmpty:t,color:n,concurrent:r,config:i,configPath:a,continueOnError:o,cwd:s,debug:c,diff:l,diffFilter:u,failOnChanges:d,hideAll:f,hidePartiallyStaged:p,hideUnstaged:m,maxArgLength:h,quiet:g,relative:ee,revert:_,stash:v,verbose:y}={})=>{e&&(v??=!1,t??=!0),f?(p=!1,m=!1):m&&(p=!1),e??=!1,t??=!1,n??=F(),r??=!0,o??=!1,c??=!1,d??=!1,f??=!1,m??=!1,p??=!0,h??=nt(),g??=!1,ee??=!1,v??=l===void 0,_??=!d&&!!v,y??=!1;let b={all:e,allowEmpty:t,color:n,concurrent:r,configObject:i,configPath:a,continueOnError:o,cwd:s,debug:c,diff:l,diffFilter:u,failOnChanges:d,hideAll:f,hidePartiallyStaged:p,hideUnstaged:m,maxArgLength:h,quiet:g,relative:ee,revert:_,stash:v,verbose:y};return rt(`Parsed options: %o`,b),b},at=(e={},t)=>{if(!Array.isArray(e.output))return;let n=e.errors?.size>0?t.error:t.log;for(let t of e.output)n(t)};var ot=/* @__PURE__ */ t(((e,t)=>{let n=`[^\\\\/]`,r=`[^/]`,i=`(?:\\/|$)`,a=`(?:^|\\/)`,o=`\\.{1,2}${i}`,s={DOT_LITERAL:`\\.`,PLUS_LITERAL:`\\+`,QMARK_LITERAL:`\\?`,SLASH_LITERAL:`\\/`,ONE_CHAR:`(?=.)`,QMARK:r,END_ANCHOR:i,DOTS_SLASH:o,NO_DOT:`(?!\\.)`,NO_DOTS:`(?!${a}${o})`,NO_DOT_SLASH:`(?!\\.{0,1}${i})`,NO_DOTS_SLASH:`(?!${o})`,QMARK_NO_DOT:`[^.\\/]`,STAR:`${r}*?`,START_ANCHOR:a,SEP:`/`},c={...s,SLASH_LITERAL:`[\\\\/]`,QMARK:n,STAR:`${n}*?`,DOTS_SLASH:`\\.{1,2}(?:[\\\\/]|$)`,NO_DOT:`(?!\\.)`,NO_DOTS:`(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))`,NO_DOT_SLASH:`(?!\\.{0,1}(?:[\\\\/]|$))`,NO_DOTS_SLASH:`(?!\\.{1,2}(?:[\\\\/]|$))`,QMARK_NO_DOT:`[^.\\\\/]`,START_ANCHOR:`(?:^|[\\\\/])`,END_ANCHOR:`(?:[\\\\/]|$)`,SEP:`\\`};t.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{__proto__:null,alnum:`a-zA-Z0-9`,alpha:`a-zA-Z`,ascii:`\\x00-\\x7F`,blank:` \\t`,cntrl:`\\x00-\\x1F\\x7F`,digit:`0-9`,graph:`\\x21-\\x7E`,lower:`a-z`,print:`\\x20-\\x7E `,punct:`\\-!"#$%&'()\\*+,./:;<=>?@[\\]^_\`{|}~`,space:` \\t\\r\\n\\v\\f`,upper:`A-Z`,word:`A-Za-z0-9_`,xdigit:`A-Fa-f0-9`},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":`*`,"**/**":`**`,"**/**/**":`**`},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(e){return{"!":{type:`negate`,open:`(?:(?!(?:`,close:`))${e.STAR})`},"?":{type:`qmark`,open:`(?:`,close:`)?`},"+":{type:`plus`,open:`(?:`,close:`)+`},"*":{type:`star`,open:`(?:`,close:`)*`},"@":{type:`at`,open:`(?:`,close:`)`}}},globChars(e){return e===!0?c:s}}})),st=/* @__PURE__ */ t((e=>{let{REGEX_BACKSLASH:t,REGEX_REMOVE_BACKSLASH:n,REGEX_SPECIAL_CHARS:r,REGEX_SPECIAL_CHARS_GLOBAL:i}=ot();e.isObject=e=>typeof e==`object`&&!!e&&!Array.isArray(e),e.hasRegexChars=e=>r.test(e),e.isRegexChar=t=>t.length===1&&e.hasRegexChars(t),e.escapeRegex=e=>e.replace(i,`\\$1`),e.toPosixSlashes=e=>e.replace(t,`/`),e.isWindows=()=>{if(typeof navigator<`u`&&navigator.platform){let e=navigator.platform.toLowerCase();return e===`win32`||e===`windows`}return typeof process<`u`&&process.platform?process.platform===`win32`:!1},e.removeBackslashes=e=>e.replace(n,e=>e===`\\`?``:e),e.escapeLast=(t,n,r)=>{let i=t.lastIndexOf(n,r);return i===-1?t:t[i-1]===`\\`?e.escapeLast(t,n,i-1):`${t.slice(0,i)}\\${t.slice(i)}`},e.removePrefix=(e,t={})=>{let n=e;return n.startsWith(`./`)&&(n=n.slice(2),t.prefix=`./`),n},e.wrapOutput=(e,t={},n={})=>{let r=`${n.contains?``:`^`}(?:${e})${n.contains?``:`$`}`;return t.negated===!0&&(r=`(?:^(?!${r}).*$)`),r},e.basename=(e,{windows:t}={})=>{let n=e.split(t?/[\\/]/:`/`),r=n[n.length-1];return r===``?n[n.length-2]:r}})),ct=/* @__PURE__ */ t(((e,t)=>{let n=st(),{CHAR_ASTERISK:r,CHAR_AT:i,CHAR_BACKWARD_SLASH:a,CHAR_COMMA:o,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:c,CHAR_FORWARD_SLASH:l,CHAR_LEFT_CURLY_BRACE:u,CHAR_LEFT_PARENTHESES:d,CHAR_LEFT_SQUARE_BRACKET:f,CHAR_PLUS:p,CHAR_QUESTION_MARK:m,CHAR_RIGHT_CURLY_BRACE:h,CHAR_RIGHT_PARENTHESES:g,CHAR_RIGHT_SQUARE_BRACKET:ee}=ot(),_=e=>e===l||e===a,v=e=>{e.isPrefix!==!0&&(e.depth=e.isGlobstar?1/0:1)};t.exports=(e,t)=>{let y=t||{},b=e.length-1,x=y.parts===!0||y.tokens===!0||y.scanToEnd===!0,S=[],C=[],w=[],T=e,E=-1,D=0,O=0,te=!1,ne=!1,k=!1,A=!1,j=!1,M=!1,N=!1,P=!1,F=!1,I=!1,L=0,R,z,B={value:``,depth:0,isGlob:!1},V=()=>E>=b,H=()=>T.charCodeAt(E+1),U=()=>(R=z,T.charCodeAt(++E));for(;E<b;){z=U();let e;if(z===a)N=B.backslashes=!0,z=U(),z===u&&(M=!0);else{if(M===!0||z===u){for(L++;V()!==!0&&(z=U());)if(z===a)N=B.backslashes=!0,U();else if(z===u)L++;else{if(M!==!0&&z===s&&(z=U())===s||M!==!0&&z===o){if(te=B.isBrace=!0,k=B.isGlob=!0,I=!0,x===!0)continue;break}if(z===h&&(L--,L===0)){M=!1,te=B.isBrace=!0,I=!0;break}}if(x===!0)continue;break}if(z===l){if(S.push(E),C.push(B),B={value:``,depth:0,isGlob:!1},I===!0)continue;if(R===s&&E===D+1){D+=2;continue}O=E+1}else{if(y.noext!==!0&&(z===p||z===i||z===r||z===m||z===c)&&H()===d){if(k=B.isGlob=!0,A=B.isExtglob=!0,I=!0,z===c&&E===D&&(F=!0),x===!0){let e=0;for(;V()!==!0&&(z=U());)if(z===a)N=B.backslashes=!0,U();else if(z===d)e++;else if(z===g&&--e===0){I=!0;break}continue}break}if(z===r){if(R===r&&(j=B.isGlobstar=!0),k=B.isGlob=!0,I=!0,x===!0)continue;break}if(z===m){if(k=B.isGlob=!0,I=!0,x===!0)continue;break}if(z===f){for(;V()!==!0&&(e=U());)if(e===a)N=B.backslashes=!0,U();else if(e===ee){ne=B.isBracket=!0,k=B.isGlob=!0,I=!0;break}if(x===!0)continue;break}if(y.nonegate!==!0&&z===c&&E===D)P=B.negated=!0,D++;else{if(y.noparen!==!0&&z===d){if(k=B.isGlob=!0,x===!0){let e=1;for(;V()!==!0&&(z=U());)if(z===a)N=B.backslashes=!0,U();else if(z===d)e++;else if(z===g&&--e===0){I=!0;break}continue}break}if(k===!0){if(I=!0,x===!0)continue;break}}}}}y.noext===!0&&(A=!1,k=!1);let W=T,G=``,re=``;D>0&&(G=T.slice(0,D),T=T.slice(D),O-=D),W&&k===!0&&O>0?(W=T.slice(0,O),re=T.slice(O)):k===!0?(W=``,re=T):W=T,W&&W!==``&&W!==`/`&&W!==T&&_(W.charCodeAt(W.length-1))&&(W=W.slice(0,-1)),y.unescape===!0&&(re&&=n.removeBackslashes(re),W&&N===!0&&(W=n.removeBackslashes(W)));let K={prefix:G,input:e,start:D,base:W,glob:re,isBrace:te,isBracket:ne,isGlob:k,isExtglob:A,isGlobstar:j,negated:P,negatedExtglob:F};if(y.tokens===!0&&(K.maxDepth=0,_(z)||C.push(B),K.tokens=C),y.parts===!0||y.tokens===!0){let t;for(let n=0;n<S.length;n++){let r=t===void 0?D:t+1,i=S[n],a=e.slice(r,i);y.tokens&&(n===0&&D!==0?(C[n].isPrefix=!0,C[n].value=G):C[n].value=a,v(C[n]),K.maxDepth+=C[n].depth),i>=D&&(w.push(a),t=i)}let n=t===void 0?D:t+1,r=e.slice(n);w.push(r),y.tokens&&t&&t+1<e.length&&(C[C.length-1].value=r,v(C[C.length-1]),K.maxDepth+=C[C.length-1].depth),K.slashes=S,K.parts=w}return K}})),lt=/* @__PURE__ */ t(((e,t)=>{let n=ot(),r=st(),{MAX_LENGTH:i,POSIX_REGEX_SOURCE:a,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:c}=n,l=(e,t)=>{if(typeof t.expandRange==`function`)return t.expandRange(...e,t);e.sort();let n=`[${e.join(`-`)}]`;try{new RegExp(n)}catch{return e.map(e=>r.escapeRegex(e)).join(`..`)}return n},u=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,d=e=>{let t=[],n=0,r=0,i=0,a=``,o=!1;for(let s of e)if(o===!0)a+=s,o=!1;else if(s===`\\`)a+=s,o=!0;else if(s===`"`)i=i===1?0:1,a+=s;else{if(i===0){if(s===`[`)n++;else if(s===`]`&&n>0)n--;else if(n===0){if(s===`(`)r++;else if(s===`)`&&r>0)r--;else if(s===`|`&&r===0){t.push(a),a=``;continue}}}a+=s}return t.push(a),t},f=e=>{let t=!1;for(let n of e)if(t===!0)t=!1;else if(n===`\\`)t=!0;else if(/[?*+@!()[\]{}]/.test(n))return!1;return!0},p=e=>{let t=e.trim(),n=!0;for(;n===!0;)n=!1,/^@\([^\\()[\]{}|]+\)$/.test(t)&&(t=t.slice(2,-1),n=!0);if(f(t))return t.replace(/\\(.)/g,`$1`)},m=e=>{let t=e.map(p).filter(Boolean);for(let e=0;e<t.length;e++)for(let n=e+1;n<t.length;n++){let r=t[e],i=t[n],a=r[0];if(a&&r===a.repeat(r.length)&&i===a.repeat(i.length)&&(r===i||r.startsWith(i)||i.startsWith(r)))return!0}return!1},h=(e,t=!0)=>{if(e[0]!==`+`&&e[0]!==`*`||e[1]!==`(`)return;let n=0,r=0,i=0,a=!1;for(let o=1;o<e.length;o++){let s=e[o];if(a===!0)a=!1;else if(s===`\\`)a=!0;else if(s===`"`)i=i===1?0:1;else if(i!==1){if(s===`[`)n++;else if(s===`]`&&n>0)n--;else if(!(n>0)){if(s===`(`)r++;else if(s===`)`&&(r--,r===0))return t===!0&&o!==e.length-1?void 0:{type:e[0],body:e.slice(2,o),end:o}}}}},g=e=>`${e.length===1?r.escapeRegex(e[0]):`[${e.map(e=>r.escapeRegex(e)).join(``)}]`}*`,ee=e=>{let t=0,n=[];for(;t<e.length;){let r=h(e.slice(t),!1);if(!r||r.type!==`*`)return;let i=d(r.body).map(e=>e.trim());if(i.length!==1)return;let a=p(i[0]);if(!a||a.length!==1)return;n.push(a),t+=r.end+1}if(!(n.length<1))return n},_=e=>{let t=0,n=e.trim(),r=h(n);for(;r;)t++,n=r.body.trim(),r=h(n);return t},v=(e,t)=>{if(t.maxExtglobRecursion===!1)return{risky:!1};let r=typeof t.maxExtglobRecursion==`number`?t.maxExtglobRecursion:n.DEFAULT_MAX_EXTGLOB_RECURSION,i=d(e).map(e=>e.trim());if(i.length>1&&(i.some(e=>e===``)||i.some(e=>/^[*?]+$/.test(e))||m(i)))return{risky:!0};let a=[],o=!1,s=!0;for(let e of i){let t=ee(e);if(t){o=!0,a.push(...t);continue}let n=p(e);if(n&&n.length===1)a.push(n);else if(s=!1,_(e)>r)return{risky:!0}}return o?s?{risky:!0,safeOutput:g([...new Set(a)])}:{risky:!0}:{risky:!1}},y=(e,t)=>{if(typeof e!=`string`)throw TypeError(`Expected a string`);e=c[e]||e;let d={...t},f=typeof d.maxLength==`number`?Math.min(i,d.maxLength):i,p=e.length;if(p>f)throw SyntaxError(`Input length: ${p}, exceeds maximum allowed length: ${f}`);let m={type:`bos`,value:``,output:d.prepend||``},h=[m],g=d.capture?``:`?:`,ee=n.globChars(d.windows),_=n.extglobChars(ee),{DOT_LITERAL:b,PLUS_LITERAL:x,SLASH_LITERAL:S,ONE_CHAR:C,DOTS_SLASH:w,NO_DOT:T,NO_DOT_SLASH:E,NO_DOTS_SLASH:D,QMARK:O,QMARK_NO_DOT:te,STAR:ne,START_ANCHOR:k}=ee,A=e=>`(${g}(?:(?!${k}${e.dot?w:b}).)*?)`,j=d.dot?``:T,M=d.dot?O:te,N=d.bash===!0?A(d):ne;d.capture&&(N=`(${N})`),typeof d.noext==`boolean`&&(d.noextglob=d.noext);let P={input:e,index:-1,start:0,dot:d.dot===!0,consumed:``,output:``,prefix:``,backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:h};e=r.removePrefix(e,P),p=e.length;let F=[],I=[],L=[],R=m,z,B=()=>P.index===p-1,V=P.peek=(t=1)=>e[P.index+t],H=P.advance=()=>e[++P.index]||``,U=()=>e.slice(P.index+1),W=(e=``,t=0)=>{P.consumed+=e,P.index+=t},G=e=>{P.output+=e.output==null?e.value:e.output,W(e.value)},re=()=>{let e=1;for(;V()===`!`&&(V(2)!==`(`||V(3)===`?`);)H(),P.start++,e++;return e%2!=0&&(P.negated=!0,P.start++,!0)},K=e=>{P[e]++,L.push(e)},ie=e=>{P[e]--,L.pop()},q=e=>{if(R.type===`globstar`){let t=P.braces>0&&(e.type===`comma`||e.type===`brace`),n=e.extglob===!0||F.length&&(e.type===`pipe`||e.type===`paren`);e.type!==`slash`&&e.type!==`paren`&&!t&&!n&&(P.output=P.output.slice(0,-R.output.length),R.type=`star`,R.value=`*`,R.output=N,P.output+=R.output)}F.length&&e.type!==`paren`&&(F[F.length-1].inner+=e.value),(e.value||e.output)&&G(e),R&&R.type===`text`&&e.type===`text`?(R.output=(R.output||R.value)+e.value,R.value+=e.value):(e.prev=R,h.push(e),R=e)},ae=(e,t)=>{let n={..._[t],conditions:1,inner:``};n.prev=R,n.parens=P.parens,n.output=P.output,n.startIndex=P.index,n.tokensIndex=h.length;let r=(d.capture?`(`:``)+n.open;K(`parens`),q({type:e,value:t,output:P.output?``:C}),q({type:`paren`,extglob:!0,value:H(),output:r}),F.push(n)},oe=n=>{let i=e.slice(n.startIndex,P.index+1),a=e.slice(n.startIndex+2,P.index),o=v(a,d);if((n.type===`plus`||n.type===`star`)&&o.risky){let e=o.safeOutput?(n.output?``:C)+(d.capture?`(${o.safeOutput})`:o.safeOutput):void 0,t=h[n.tokensIndex];t.type=`text`,t.value=i,t.output=e||r.escapeRegex(i);for(let e=n.tokensIndex+1;e<h.length;e++)h[e].value=``,h[e].output=``,delete h[e].suffix;P.output=n.output+t.output,P.backtrack=!0,q({type:`paren`,extglob:!0,value:z,output:``}),ie(`parens`);return}let s=n.close+(d.capture?`)`:``),c;if(n.type===`negate`){let e=N;n.inner&&n.inner.length>1&&n.inner.includes(`/`)&&(e=A(d)),(e!==N||B()||/^\)+$/.test(U()))&&(s=n.close=`)$))${e}`),n.inner.includes(`*`)&&(c=U())&&/^\.[^\\/.]+$/.test(c)&&(s=n.close=`)${y(c,{...t,fastpaths:!1}).output})${e})`),n.prev.type===`bos`&&(P.negatedExtglob=!0)}q({type:`paren`,extglob:!0,value:z,output:s}),ie(`parens`)};if(d.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(e)){let n=!1,i=e.replace(s,(e,t,r,i,a,o)=>i===`\\`?(n=!0,e):i===`?`?t?t+i+(a?O.repeat(a.length):``):o===0?M+(a?O.repeat(a.length):``):O.repeat(r.length):i===`.`?b.repeat(r.length):i===`*`?t?t+i+(a?N:``):N:t?e:`\\${e}`);return n===!0&&(i=d.unescape===!0?i.replace(/\\/g,``):i.replace(/\\+/g,e=>e.length%2==0?`\\\\`:e?`\\`:``)),i===e&&d.contains===!0?(P.output=e,P):(P.output=r.wrapOutput(i,P,t),P)}for(;!B();){if(z=H(),z===`\0`)continue;if(z===`\\`){let e=V();if(e===`/`&&d.bash!==!0||e===`.`||e===`;`)continue;if(!e){z+=`\\`,q({type:`text`,value:z});continue}let t=/^\\+/.exec(U()),n=0;if(t&&t[0].length>2&&(n=t[0].length,P.index+=n,n%2!=0&&(z+=`\\`)),d.unescape===!0?z=H():z+=H(),P.brackets===0){q({type:`text`,value:z});continue}}if(P.brackets>0&&(z!==`]`||R.value===`[`||R.value===`[^`)){if(d.posix!==!1&&z===`:`){let e=R.value.slice(1);if(e.includes(`[`)&&(R.posix=!0,e.includes(`:`))){let e=R.value.lastIndexOf(`[`),t=R.value.slice(0,e),n=R.value.slice(e+2),r=a[n];if(r){R.value=t+r,P.backtrack=!0,H(),!m.output&&h.indexOf(R)===1&&(m.output=C);continue}}}(z===`[`&&V()!==`:`||z===`-`&&V()===`]`)&&(z=`\\${z}`),z===`]`&&(R.value===`[`||R.value===`[^`)&&(z=`\\${z}`),d.posix===!0&&z===`!`&&R.value===`[`&&(z=`^`),R.value+=z,G({value:z});continue}if(P.quotes===1&&z!==`"`){z=r.escapeRegex(z),R.value+=z,G({value:z});continue}if(z===`"`){P.quotes=P.quotes===1?0:1,d.keepQuotes===!0&&q({type:`text`,value:z});continue}if(z===`(`){K(`parens`),q({type:`paren`,value:z});continue}if(z===`)`){if(P.parens===0&&d.strictBrackets===!0)throw SyntaxError(u(`opening`,`(`));let e=F[F.length-1];if(e&&P.parens===e.parens+1){oe(F.pop());continue}q({type:`paren`,value:z,output:P.parens?`)`:`\\)`}),ie(`parens`);continue}if(z===`[`){if(d.nobracket===!0||!U().includes(`]`)){if(d.nobracket!==!0&&d.strictBrackets===!0)throw SyntaxError(u(`closing`,`]`));z=`\\${z}`}else K(`brackets`);q({type:`bracket`,value:z});continue}if(z===`]`){if(d.nobracket===!0||R&&R.type===`bracket`&&R.value.length===1){q({type:`text`,value:z,output:`\\${z}`});continue}if(P.brackets===0){if(d.strictBrackets===!0)throw SyntaxError(u(`opening`,`[`));q({type:`text`,value:z,output:`\\${z}`});continue}ie(`brackets`);let e=R.value.slice(1);if(R.posix!==!0&&e[0]===`^`&&!e.includes(`/`)&&(z=`/${z}`),R.value+=z,G({value:z}),d.literalBrackets===!1||r.hasRegexChars(e))continue;let t=r.escapeRegex(R.value);if(P.output=P.output.slice(0,-R.value.length),d.literalBrackets===!0){P.output+=t,R.value=t;continue}R.value=`(${g}${t}|${R.value})`,P.output+=R.value;continue}if(z===`{`&&d.nobrace!==!0){K(`braces`);let e={type:`brace`,value:z,output:`(`,outputIndex:P.output.length,tokensIndex:P.tokens.length};I.push(e),q(e);continue}if(z===`}`){let e=I[I.length-1];if(d.nobrace===!0||!e){q({type:`text`,value:z,output:z});continue}let t=`)`;if(e.dots===!0){let e=h.slice(),n=[];for(let t=e.length-1;t>=0&&(h.pop(),e[t].type!==`brace`);t--)e[t].type!==`dots`&&n.unshift(e[t].value);t=l(n,d),P.backtrack=!0}if(e.comma!==!0&&e.dots!==!0){let n=P.output.slice(0,e.outputIndex),r=P.tokens.slice(e.tokensIndex);e.value=e.output=`\\{`,z=t=`\\}`,P.output=n;for(let e of r)P.output+=e.output||e.value}q({type:`brace`,value:z,output:t}),ie(`braces`),I.pop();continue}if(z===`|`){F.length>0&&F[F.length-1].conditions++,q({type:`text`,value:z});continue}if(z===`,`){let e=z,t=I[I.length-1];t&&L[L.length-1]===`braces`&&(t.comma=!0,e=`|`),q({type:`comma`,value:z,output:e});continue}if(z===`/`){if(R.type===`dot`&&P.index===P.start+1){P.start=P.index+1,P.consumed=``,P.output=``,h.pop(),R=m;continue}q({type:`slash`,value:z,output:S});continue}if(z===`.`){if(P.braces>0&&R.type===`dot`){R.value===`.`&&(R.output=b);let e=I[I.length-1];R.type=`dots`,R.output+=z,R.value+=z,e.dots=!0;continue}if(P.braces+P.parens===0&&R.type!==`bos`&&R.type!==`slash`){q({type:`text`,value:z,output:b});continue}q({type:`dot`,value:z,output:b});continue}if(z===`?`){if(!(R&&R.value===`(`)&&d.noextglob!==!0&&V()===`(`&&V(2)!==`?`){ae(`qmark`,z);continue}if(R&&R.type===`paren`){let e=V(),t=z;(R.value===`(`&&!/[!=<:]/.test(e)||e===`<`&&!/<([!=]|\w+>)/.test(U()))&&(t=`\\${z}`),q({type:`text`,value:z,output:t});continue}if(d.dot!==!0&&(R.type===`slash`||R.type===`bos`)){q({type:`qmark`,value:z,output:te});continue}q({type:`qmark`,value:z,output:O});continue}if(z===`!`){if(d.noextglob!==!0&&V()===`(`&&(V(2)!==`?`||!/[!=<:]/.test(V(3)))){ae(`negate`,z);continue}if(d.nonegate!==!0&&P.index===0){re();continue}}if(z===`+`){if(d.noextglob!==!0&&V()===`(`&&V(2)!==`?`){ae(`plus`,z);continue}if(R&&R.value===`(`||d.regex===!1){q({type:`plus`,value:z,output:x});continue}if(R&&(R.type===`bracket`||R.type===`paren`||R.type===`brace`)||P.parens>0){q({type:`plus`,value:z});continue}q({type:`plus`,value:x});continue}if(z===`@`){if(d.noextglob!==!0&&V()===`(`&&V(2)!==`?`){q({type:`at`,extglob:!0,value:z,output:``});continue}q({type:`text`,value:z});continue}if(z!==`*`){(z===`$`||z===`^`)&&(z=`\\${z}`);let e=o.exec(U());e&&(z+=e[0],P.index+=e[0].length),q({type:`text`,value:z});continue}if(R&&(R.type===`globstar`||R.star===!0)){R.type=`star`,R.star=!0,R.value+=z,R.output=N,P.backtrack=!0,P.globstar=!0,W(z);continue}let t=U();if(d.noextglob!==!0&&/^\([^?]/.test(t)){ae(`star`,z);continue}if(R.type===`star`){if(d.noglobstar===!0){W(z);continue}let n=R.prev,r=n.prev,i=n.type===`slash`||n.type===`bos`,a=r&&(r.type===`star`||r.type===`globstar`);if(d.bash===!0&&(!i||t[0]&&t[0]!==`/`)){q({type:`star`,value:z,output:``});continue}let o=P.braces>0&&(n.type===`comma`||n.type===`brace`),s=F.length&&(n.type===`pipe`||n.type===`paren`);if(!i&&n.type!==`paren`&&!o&&!s){q({type:`star`,value:z,output:``});continue}for(;t.slice(0,3)===`/**`;){let n=e[P.index+4];if(n&&n!==`/`)break;t=t.slice(3),W(`/**`,3)}let c=B()||P.parens>0&&t===`)`.repeat(P.parens)&&!F.some(e=>e.type===`negate`);if(n.type===`bos`&&B()){R.type=`globstar`,R.value+=z,R.output=A(d),P.output=R.output,P.globstar=!0,W(z);continue}if(n.type===`slash`&&n.prev.type!==`bos`&&!a&&c){P.output=P.output.slice(0,-(n.output+R.output).length),n.output=`(?:${n.output}`,R.type=`globstar`,R.output=A(d)+(d.strictSlashes?`)`:`|$)`),R.value+=z,P.globstar=!0,P.output+=n.output+R.output,W(z);continue}if(n.type===`slash`&&n.prev.type!==`bos`&&t[0]===`/`){let e=t[1]===void 0?``:`|$`;P.output=P.output.slice(0,-(n.output+R.output).length),n.output=`(?:${n.output}`,R.type=`globstar`,R.output=`${A(d)}${S}|${S}${e})`,R.value+=z,P.output+=n.output+R.output,P.globstar=!0,W(z+H()),q({type:`slash`,value:`/`,output:``});continue}if(n.type===`bos`&&t[0]===`/`){R.type=`globstar`,R.value+=z,R.output=`(?:^|${S}|${A(d)}${S})`,P.output=R.output,P.globstar=!0,W(z+H()),q({type:`slash`,value:`/`,output:``});continue}P.output=P.output.slice(0,-R.output.length),R.type=`globstar`,R.output=A(d),R.value+=z,P.output+=R.output,P.globstar=!0,W(z);continue}let n={type:`star`,value:z,output:N};d.bash===!0?(n.output=`.*?`,(R.type===`bos`||R.type===`slash`)&&(n.output=j+n.output),q(n)):R&&(R.type===`bracket`||R.type===`paren`)&&d.regex===!0?(n.output=z,q(n)):((P.index===P.start||R.type===`slash`||R.type===`dot`)&&(R.type===`dot`?(P.output+=E,R.output+=E):d.dot===!0?(P.output+=D,R.output+=D):(P.output+=j,R.output+=j),V()!==`*`&&(P.output+=C,R.output+=C)),q(n))}for(;P.brackets>0;){if(d.strictBrackets===!0)throw SyntaxError(u(`closing`,`]`));P.output=r.escapeLast(P.output,`[`),ie(`brackets`)}for(;P.parens>0;){if(d.strictBrackets===!0)throw SyntaxError(u(`closing`,`)`));P.output=r.escapeLast(P.output,`(`),ie(`parens`)}for(;P.braces>0;){if(d.strictBrackets===!0)throw SyntaxError(u(`closing`,`}`));P.output=r.escapeLast(P.output,`{`),ie(`braces`)}if(d.strictSlashes!==!0&&(R.type===`star`||R.type===`bracket`)&&q({type:`maybe_slash`,value:``,output:`${S}?`}),P.backtrack===!0){P.output=``;for(let e of P.tokens)P.output+=e.output==null?e.value:e.output,e.suffix&&(P.output+=e.suffix)}return P};y.fastpaths=(e,t)=>{let a={...t},o=typeof a.maxLength==`number`?Math.min(i,a.maxLength):i,s=e.length;if(s>o)throw SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${o}`);e=c[e]||e;let{DOT_LITERAL:l,SLASH_LITERAL:u,ONE_CHAR:d,DOTS_SLASH:f,NO_DOT:p,NO_DOTS:m,NO_DOTS_SLASH:h,STAR:g,START_ANCHOR:ee}=n.globChars(a.windows),_=a.dot?m:p,v=a.dot?h:p,y=a.capture?``:`?:`,b={negated:!1,prefix:``},x=a.bash===!0?`.*?`:g;a.capture&&(x=`(${x})`);let S=e=>e.noglobstar===!0?x:`(${y}(?:(?!${ee}${e.dot?f:l}).)*?)`,C=e=>{switch(e){case`*`:return`${_}${d}${x}`;case`.*`:return`${l}${d}${x}`;case`*.*`:return`${_}${x}${l}${d}${x}`;case`*/*`:return`${_}${x}${u}${d}${v}${x}`;case`**`:return _+S(a);case`**/*`:return`(?:${_}${S(a)}${u})?${v}${d}${x}`;case`**/*.*`:return`(?:${_}${S(a)}${u})?${v}${x}${l}${d}${x}`;case`**/.*`:return`(?:${_}${S(a)}${u})?${l}${d}${x}`;default:{let t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;let n=C(t[1]);return n?n+l+t[2]:void 0}}},w=C(r.removePrefix(e,b));return w&&a.strictSlashes!==!0&&(w+=`${u}?`),w},t.exports=y})),ut=/* @__PURE__ */ t(((e,t)=>{let n=ct(),r=lt(),i=st(),a=ot(),o=e=>e&&typeof e==`object`&&!Array.isArray(e),s=(e,t,n=!1)=>{if(Array.isArray(e)){let r=e.map(e=>s(e,t,n));return e=>{for(let t of r){let n=t(e);if(n)return n}return!1}}let r=o(e)&&e.tokens&&e.input;if(e===``||typeof e!=`string`&&!r)throw TypeError(`Expected pattern to be a non-empty string`);let i=t||{},a=i.windows,c=r?s.compileRe(e,t):s.makeRe(e,t,!1,!0),l=c.state;delete c.state;let u=()=>!1;if(i.ignore){let e={...t,ignore:null,onMatch:null,onResult:null};u=s(i.ignore,e,n)}let d=(n,r=!1)=>{let{isMatch:o,match:d,output:f}=s.test(n,c,t,{glob:e,posix:a}),p={glob:e,state:l,regex:c,posix:a,input:n,output:f,match:d,isMatch:o};return typeof i.onResult==`function`&&i.onResult(p),o===!1?(p.isMatch=!1,r?p:!1):u(n)?(typeof i.onIgnore==`function`&&i.onIgnore(p),p.isMatch=!1,r?p:!1):(typeof i.onMatch==`function`&&i.onMatch(p),!r||p)};return n&&(d.state=l),d};s.test=(e,t,n,{glob:r,posix:a}={})=>{if(typeof e!=`string`)throw TypeError(`Expected input to be a string`);if(e===``)return{isMatch:!1,output:``};let o=n||{},c=o.format||(a?i.toPosixSlashes:null),l=e===r,u=l&&c?c(e):e;return l===!1&&(u=c?c(e):e,l=u===r),(l===!1||o.capture===!0)&&(l=o.matchBase===!0||o.basename===!0?s.matchBase(e,t,n,a):t.exec(u)),{isMatch:!!l,match:l,output:u}},s.matchBase=(e,t,n,r=n&&n.windows)=>(t instanceof RegExp?t:s.makeRe(t,n)).test(i.basename(e,{windows:r})),s.isMatch=(e,t,n)=>s(t,n)(e),s.parse=(e,t)=>Array.isArray(e)?e.map(e=>s.parse(e,t)):r(e,{...t,fastpaths:!1}),s.scan=(e,t)=>n(e,t),s.compileRe=(e,t,n=!1,r=!1)=>{if(n===!0)return e.output;let i=t||{},a=i.contains?``:`^`,o=i.contains?``:`$`,c=`${a}(?:${e.output})${o}`;e&&e.negated===!0&&(c=`^(?!${c}).*$`);let l=s.toRegex(c,t);return r===!0&&(l.state=e),l},s.makeRe=(e,t={},n=!1,i=!1)=>{if(!e||typeof e!=`string`)throw TypeError(`Expected a non-empty string`);let a={negated:!1,fastpaths:!0};return t.fastpaths!==!1&&(e[0]===`.`||e[0]===`*`)&&(a.output=r.fastpaths(e,t)),a.output||(a=r(e,t)),s.compileRe(a,t,n,i)},s.toRegex=(e,t)=>{try{let n=t||{};return new RegExp(e,n.flags||(n.nocase?`i`:``))}catch(e){if(t&&t.debug===!0)throw e;return/$^/}},s.constants=a,t.exports=s})),dt=/* @__PURE__ */ e((/* @__PURE__ */ t(((e,t)=>{let n=ut(),r=st();function i(e,t,i=!1){return t&&(t.windows===null||t.windows===void 0)&&(t={...t,windows:r.isWindows()}),n(e,t,i)}Object.assign(i,n),t.exports=i})))(),1);const ft=(e,t,n=process.cwd())=>{let r=(0,dt.default)(t,{cwd:n,dot:!0,matchBase:!t.includes(`/`),posixSlashes:!0,strictBrackets:!0});return e.filter(e=>r(e.filepath))},pt=/[/\\]+/,mt=/^\/(\.|\?)/,X=e=>{
32
+ /*!
33
+ * normalize-path <https://github.com/jonschlinkert/normalize-path>
34
+ *
35
+ * Copyright (c) 2014-2018, Jon Schlinkert.
36
+ * Released under the MIT License.
37
+ */
38
+ if(e===p.posix.sep||e===p.win32.sep)return p.posix.sep;let t=e.split(pt).join(p.posix.sep);return(e.startsWith(`\\\\?\\`)||e.startsWith(`\\\\.\\`))&&(t=t.replace(mt,`//$1`)),t.endsWith(p.posix.sep)&&(t=t.slice(0,-1)),t},ht=K(`lint-staged:generateTasks`),gt=({config:e,cwd:t=process.cwd(),files:n,relative:r=!1})=>{ht(`Generating tasks`);let i=n.map(e=>({filepath:X(p.relative(t,e.filepath)),status:e.status}));return Object.entries(e).map(([e,n])=>{let a=e.startsWith(`../`),o=i.filter(e=>a?!0:!e.filepath.startsWith(`..`)&&!p.isAbsolute(e.filepath)),s={pattern:e,commands:n,fileList:ft(o,e,t).map(e=>({filepath:X(r?e.filepath:p.resolve(t,e.filepath)),status:e.status}))};return ht(`Generated task:
39
+ %O`,s),s})},_t={SIGINT:`SIGINT`,SIGKILL:`SIGKILL`},vt=(e=process)=>{let t=new AbortController;return e.on(_t.SIGINT,()=>{t.abort(_t.SIGINT)}),t};function yt(e,t,n){var r=/([^\s'"]([^\s'"]*(['"])([^\3]*?)\3)+[^\s'"]*)|[^\s'"]+|(['"])([^\5]*?)\5/gi,i=e,a=[];t&&a.push(t),n&&a.push(n);var o;do o=r.exec(i),o!==null&&a.push(bt(o[1],o[6],o[0]));while(o!==null);return a}function bt(){for(var e=[...arguments],t=0;t<e.length;t++){var n=e[t];if(typeof n==`string`)return n}}const xt=f(a),St=async e=>{await xt(`taskkill /pid ${e} /T /F`)},Ct=async e=>{process.kill(-e,`SIGKILL`)},wt=async(e,t=process.platform===`win32`)=>{try{t?await St(e):await Ct(e)}catch{}},Tt=Symbol(`ApplyEmptyCommitError`),Et=/* @__PURE__ */ Error(`Configuration could not be found`),Dt=/* @__PURE__ */ Error(`Configuration should be an object or a function`),Ot=/* @__PURE__ */ Error(`Configuration should not be empty`),kt=Symbol(`GetStagedFilesError`),At=Symbol(`IntentToAddError`),Z=Symbol(`GitError`),jt=Symbol(`GitRepoError`),Mt=Symbol(`HideUnstagedChangesError`),Nt=/* @__PURE__ */ Error(`Invalid Options`),Pt=Symbol(`RestoreMergeStatusError`),Ft=Symbol(`RestoreOriginalStateError`),It=Symbol(`RestoreUnstagedChangesError`),Lt=Symbol(`TaskError`),Rt=Symbol(`FailOnChangesError`),zt=({failOnChanges:e=!1,hideAll:t=!1,hideUnstaged:n=!1,hidePartiallyStaged:r=!(t||n),quiet:i=!1,revert:a=!0}={})=>{let o={backupHash:void 0,errors:/* @__PURE__ */ new Set([]),shouldFailOnChanges:e,hasFilesToHide:null,output:[],quiet:i,runId:O.randomBytes(4).toString(`hex`),shouldBackup:null,shouldHideAll:t,shouldHideUnstaged:n,shouldHidePartiallyStaged:r,shouldRevert:a,unstagedDiff:null,unstagedPatch:null};return o.shouldHideAll?(o.shouldHideUnstaged=!1,o.shouldHidePartiallyStaged=!1):o.shouldHideUnstaged&&(o.shouldHidePartiallyStaged=!1),o},Bt=e=>e.shouldHidePartiallyStaged&&e.hasFilesToHide,Vt=e=>(e.shouldHideAll||e.shouldHideUnstaged||e.shouldHidePartiallyStaged)&&e.hasFilesToHide,Ht=e=>!!e.shouldBackup&&!!e.shouldHideAll,Ut=e=>{if(!e.shouldRevert||!e.shouldBackup)return!1;if(e.errors.has(Z))return Je();if(e.errors.has(Lt))return Ke()},Wt=e=>{if(e.errors.has(Z))return Je();if(!e.shouldRevert)return!1;if(e.errors.has(Lt))return Ke()},Gt=e=>!!e.shouldRevert&&!!e.shouldBackup&&(e.errors.has(Rt)||e.errors.has(Lt)||e.errors.has(It)),Kt=e=>{if(e.errors.has(Z)&&!e.errors.has(It))return Je()},qt=e=>e.shouldBackup,Jt=e=>{if(e.errors.has(Rt)&&!e.shouldRevert)return!0;if(e.errors.has(It)&&!e.shouldRevert||Kt(e)||e.errors.has(Ft))return Je()},Yt=K(`lint-staged:getSpawnedTask`),Xt=(e,t,n,r,i)=>{if(t){let r=i?z(`${Y()} ${e}:`):`${ke()} ${e}:`;n.output.push([...n.quiet?[]:[``,r],t].join(`
40
+ `))}else n.quiet||(r===`SIGINT`?n.output.push(z(`\n${Y()} Task interrupted: ${e}`)):r===`SIGKILL`?n.output.push(z(`\n${Y()} Task killed: ${e}`)):i&&n.output.push(z(`\n${Y()} Task failed to spawn: ${e}`),r))},Zt=(e,t,n,r=`FAILED`)=>(n.errors.add(Lt),Error(`${z(e)} ${H(`[${r}]`)}`,{cause:t})),Qt=/^git(\.exe)?/i,$t=({abortController:e,command:t,continueOnError:n=!1,cwd:r=process.cwd(),files:i,topLevelDir:a,verbose:o=!1})=>{let[s,...c]=yt(t);Yt(`cmd:`,s),Yt(`args:`,c);let l={nodeOptions:{cwd:Qt.test(s)?a:r,env:P?{FORCE_COLOR:`true`}:{NO_COLOR:`true`}}};return Yt(`Tinyexec options:`,l),async(r=zt())=>{let a=we(s,[...c,...i],l),u=()=>a.exitCode>0||a.process?.signalCode,d;e.signal.addEventListener(`abort`,async()=>{if(u()||!a.process)return;d=e.signal.reason;let t=a.process.pid;a.process.kill(e.signal.reason),await wt(t)},{once:!0});let f=``;try{for await(let e of a)f+=e+`
41
+ `}catch(i){let o=i instanceof Error&&i.code||`FAILED`;throw n!==!0&&e.abort(_t.SIGKILL),Xt(t,f,r,o,a),Zt(t,a,r,o)}if(f=f.trimEnd(),u())throw n!==!0&&e.abort(_t.SIGKILL),a.process?.pid&&await wt(a.process.pid),Xt(t,f,r,d,a),Zt(t,a,r,a.process?.signalCode??d);o&&Xt(t,f,r,d)}},en=K(`lint-staged:getFunctionTasks`),tn=e=>typeof e==`object`&&!Array.isArray(e),nn=async({abortController:e,command:t,continueOnError:n,files:r,verbose:i})=>(en(`Creating task for function %o`,t),[{title:t.title,task:async a=>{let o=[],s=(...e)=>{o.push(l(...e))};try{let e=r.map(e=>e.filepath);await t.task(e,{log:s})}catch(r){n!==!0&&e.abort(_t.SIGKILL),s(`
42
+ %O`,r);let i=o.join(`
43
+ `).trimEnd();throw Xt(t.title,i,a,void 0,r),Zt(t.title,r,a)}i&&Xt(t.title,o.join(`
44
+ `).trimEnd(),a)}}]),rn=/\u0000$/,an=e=>e?e.replace(rn,``).split(`\0`):[],on=K(`lint-staged:getIntentToAddFiles`),sn=async({cwd:e})=>{let[t,n]=await Promise.all([De([`diff`,`--staged`,`--ita-visible-in-index`,`--name-only`,`-z`],{cwd:e}).then(an),De([`diff`,`--staged`,`--ita-invisible-in-index`,`--name-only`,`-z`],{cwd:e}).then(an)]),r=new Set(n),i=t.filter(e=>!r.has(e)).map(t=>X(p.join(e,t)));return on(`Detected ${i.length} files staged with "--intent-to-add":`,i),i},cn=()=>/(?<![\\$])({)(?:(?!(?<!\\),|\.\.|\{|\}).)*?(?<!\\)(})/g,ln=/{/,un=/}/,dn=e=>{let t=`${e}`,n=cn(),r=n.exec(t);for(;r;){let e=r[0],i=e.replace(ln,``).replace(un,``);t=t.replace(e,i),n.lastIndex=0,r=n.exec(t)}return t},fn=/{{[^}{]*}}/,pn=e=>{let t=`${e}`,n=fn.exec(e)?.[0];if(n){let e=n.replace(`{{`,`{`).replace(`}}`,`}`);t=t.replace(n,e)}return t},mn=(e,t)=>{let n=pn(dn(e));return n!==e&&t.warn(ze(e,n)),n},hn=K(`lint-staged:validateConfig`),gn=(e,t=0,n=!0)=>Array.isArray(e)?t<2&&e.every(e=>gn(e,t+1,n)):typeof e==`string`||n&&typeof e==`function`,_n=(e,t,n)=>{if(hn("Validating config from `%s`...",t),!e||typeof e!=`object`&&typeof e!=`function`)throw Dt;if(typeof e==`function`)return{"*":e};if(Object.entries(e).length===0)throw Ot;let r=[],i=Object.entries(e).reduce((e,[t,i])=>{Array.isArray(i)?gn(i)||r.push(Fe(t,`Should be an array of strings or functions, or single-level nested array or strings of functions.`,i)):typeof i==`object`?(typeof i.title!=`string`||typeof i.task!=`function`)&&r.push(Fe(t,"Function task should contain `title` and `task` fields, where `title` should be a string and `task` should be a function.",i)):typeof i!=`string`&&typeof i!=`function`&&r.push(Fe(t,`Should be a string, a function, an object or an array of strings and functions.`,i));let a=mn(t,n);return Object.assign(e,{[a]:i})},{});if(r.length){let e=r.join(`
45
+
46
+ `);throw n.error($e(t,e)),Error(e)}return hn("Validated config from `%s`:\n%O",t,e),i},vn=(e,t,n)=>{try{return _n(e,t,n)}catch(e){throw n.error($e(t,e)),e}},yn=K(`lint-staged:getSpawnedTasks`),bn=async(e,t,n,r=0)=>{let i=typeof e==`function`,a=i?await e([...t]):e;if(!gn(a,r,!i))throw Error(Fe(i?`[Function]`:`[Commands]`,`Commands must be strings, with at most one nested array inside the sequential task list. Function results must preserve this nesting limit.`,a));if(Array.isArray(e))return[(await Promise.all(e.map(e=>bn(e,t,n,r+1)))).flat()];let o=e=>Array.isArray(e)?e.map(o):{command:e,files:i?[]:t},s=o(a),c=e=>Array.isArray(e)?e.every(c):e.command.length+(e.files.length?1+e.files.join(` `).length:0)<=n;if(!n||n===1/0||t.length<=1||c(s))return[s];let l=Math.ceil(t.length/2);return yn(`Splitting %d files for maxArgLength of %d`,t.length,n),(await Promise.all([bn(e,t.slice(0,l),n,r),bn(e,t.slice(l),n,r)])).flat()},xn=async(e,t,n)=>t.length===0?[]:(await bn(e,t,n)).flat(),Sn=async({abortController:e,commands:t,continueOnError:n,cwd:r,files:i,maxArgLength:a,topLevelDir:o,verbose:s})=>{yn(`Creating tasks for commands %o`,t);let c=await xn(t,i.map(e=>e.filepath),a),l=t=>({title:t.command,task:$t({abortController:e,command:t.command,continueOnError:n,cwd:r,files:t.files,topLevelDir:o,verbose:s})});return c.map(e=>Array.isArray(e)?e.map(l):l(e))},Cn=K(`lint-staged:file`),wn=async e=>(Cn(`Ensuring directory exists: %s`,e),await C.mkdir(e,{recursive:!0}),e),Tn=async e=>{Cn(`Removing directory: %s`,e);try{await C.rm(e,{recursive:!0,force:!0})}catch{}},En=async(e,t=!0)=>{Cn("Reading file `%s`",e);try{return await C.readFile(e)}catch(n){if(t&&n.code===`ENOENT`)return Cn("File `%s` doesn't exist, ignoring...",e),null;throw n}},Dn=async(e,t)=>{Cn("Writing file `%s`",e),await C.writeFile(e,t)},On=(e,t)=>{let n=t===void 0?`ACMR`:t.trim(),r=e===void 0?[`--staged`]:e.trim().split(` `);return[`diff`,`--diff-filter=${n}`,...r]},kn=(e,t)=>e?e.slice(1).split(`\0:`).map(an).flatMap(([e,n,r])=>{let[,i,,,a]=e.split(` `);if(i===`160000`||i===`120000`)return[];let o=a[0],s=r??n;return[{filepath:X(p.resolve(t,s)),status:o}]}):[],An=async({all:e,cwd:t,gitConfigDir:n,diff:r,diffFilter:i})=>{try{if(e){let e=await De([`ls-files`,`--full-name`,`-z`]);return an(e).map(e=>({filepath:X(p.resolve(t,e)),status:`X`}))}let a=async e=>{let n=await De([...e,`--ita-visible-in-index`,`--raw`,`-z`],{cwd:t});return kn(n,t)},o=await a(On(r,i));if(r||o.length===0||!await En(p.resolve(n,`MERGE_HEAD`)))return o;let s=new Set((await a([`diff`,`--staged`,`MERGE_HEAD`])).map(({filepath:e})=>e));return o.filter(({filepath:e})=>s.has(e))}catch{return null}},Q=K(`lint-staged:runParallelTasks`),jn=e=>e===!0||e===1/0?1/0:e===!1||e<1||!Number.isInteger(e)?1:e,Mn=async(e,t,{abortController:n,concurrent:r=!0,logger:i})=>{let a=jn(r);Q(`Running parallel tasks with concurrency:`,a);let o=t.length>1?` `:` `,s=[];for(let e of t){e.skip()?Q(`Skipped configuration:`,e.title):(Q(`Running configuration:`,e.title),t.length>1&&i?.log(H(`${o}${e.title}`)));for(let t of e.task)if(!e.skip()){if(t.skip())Q(`Skipped glob from configuration:`,e.title,t.title);else{Q(`Running glob:`,t.title),i?.log(H(`${o} ${t.title}`));for(let e of t.task)Array.isArray(e)?(Q(`Running ${e.length} parallel tasks:`,...e.map(e=>e.title)),e.forEach((t,n)=>{if(n===0)i?.log(`${o} ${Me()} ${J()} ${t.title}`);else{let r=n===e.length-1?Pe():Ne();i?.log(`${o} ${r} ${J()} ${t.title}`)}})):(Q(`Running task:`,e.title),i?.log(`${o} ${J()} ${e.title}`));s.push(t.task)}}}i?.log(``);let c=async({title:t,task:r})=>{if(n.signal.aborted)Q(`Skipped task because aborted:`,t),i?.warn(`${je()} ${t}`);else try{Q(`Running task:`,t),await r(e),Q(`Done running task:`,t),i?.log(`${Oe()} ${t}`)}catch{Q(`Failed to run task:`,t),i?.error(z(`${Y()} ${t}`))}},l=async e=>{for(let t of e)Array.isArray(t)?await Promise.all(t.map(c)):await c(t)},u=0,d=async()=>{for(;u<s.length;){let e=s[u++];await l(e)}},f=Math.min(s.length,a);Q(`Running workers with concurrency:`,f),await Promise.all(Array.from({length:f},d)),Q(`Done running workers`),i?.log(``)},$=K(`lint-staged:GitWorkflow`),Nn=/\x00/,Pn=(e,t=!0)=>e.reduce((e,n)=>{if(Nn.test(n)){let[r,i]=n.split(Nn);t&&e.push(i),e.push(r)}else e.push(n);return e},[]),Fn=`unstaged.patch`,In=[`--binary`,`--unified=0`,`--no-color`,`--no-ext-diff`,`--src-prefix=a/`,`--dst-prefix=b/`,`--patch`,`--submodule=short`],Ln=[`-v`,`--whitespace=nowarn`,`--recount`,`--unidiff-zero`],Rn=/^diff --git /m,zn=e=>{if(!e)return/* @__PURE__ */ new Map;let[t,n]=e.split(`\0\0`),r=an(t).filter((e,t)=>t%2==1),i=n.split(Rn).slice(1),a=r.values(),o=/* @__PURE__ */ new Map,s,c;for(let e of i){let t=e.slice(0,e.indexOf(`
47
+ `));t!==s&&(c=a.next().value,s=t),o.set(c,(o.get(c)??``)+e)}return o},Bn=/^"(.*)"$/,Vn=e=>e.map(e=>e.replace(Bn,`$1`)),Hn=/\x00(?=[ AMDRCU?!]{2} |$)/;var Un=class{constructor({allowEmpty:e,diff:t,diffFilter:n,failOnChanges:r,gitConfigDir:i,logger:a,maxArgLength:o,topLevelDir:s}){this.execGit=(e,t={})=>De(e,{...t,cwd:s}),this.allowEmpty=e,this.diff=t,this.diffFilter=n,this.gitConfigDir=i,this.failOnChanges=!!r,this.logger=a,this.maxArgLength=o,this.topLevelDir=s,this.mergeHeadFilename=p.resolve(i,`MERGE_HEAD`),this.mergeModeFilename=p.resolve(i,`MERGE_MODE`),this.mergeMsgFilename=p.resolve(i,`MERGE_MSG`)}async backupMergeStatus(){$(`Backing up merge state...`),await Promise.all([En(this.mergeHeadFilename).then(e=>this.mergeHeadBuffer=e),En(this.mergeModeFilename).then(e=>this.mergeModeBuffer=e),En(this.mergeMsgFilename).then(e=>this.mergeMsgBuffer=e)]),$(`Done backing up merge state!`)}async restoreMergeStatus(e){$(`Restoring merge state...`);try{await Promise.all([this.mergeHeadBuffer&&Dn(this.mergeHeadFilename,this.mergeHeadBuffer),this.mergeModeBuffer&&Dn(this.mergeModeFilename,this.mergeModeBuffer),this.mergeMsgBuffer&&Dn(this.mergeMsgFilename,this.mergeMsgBuffer)]),$(`Done restoring merge state!`)}catch(t){throw e.errors.add(Z),e.errors.add(Pt),$(`Failed restoring merge state with error:`),$(t),t}}async getUnstagedFiles({onlyPartial:e=!1}={}){$(`Getting partially staged files...`);let t=(await this.execGit([`status`,`-z`,`--untracked-files=no`])).split(Hn).filter(t=>{let[n,r]=t,i=n!==` `,a=r!==` `;return e?i&&a:a}).map(e=>e.slice(3)).filter(Boolean);return $(`Found ${e?`partially staged`:`unstaged`} files:`,t),t.length?t:null}async listStashes(){return await this.execGit([`stash`,`list`,`--format="%H %s"`,`-z`]).then(an).then(Vn)}async prepare(e){this.logger.log(H(`${J()} ${e.shouldBackup?`Backing up original state…`:`Preparing lint-staged…`}`));try{if(this.hiddenPath=p.join(this.gitConfigDir,`./lint-staged/${e.runId}`),e.shouldBackup&&await this.backupMergeStatus(),e.shouldHideUnstaged||e.shouldHideAll?(this.unstagedFiles=await this.getUnstagedFiles({onlyPartial:!1}),e.hasFilesToHide=!!this.unstagedFiles):e.shouldHidePartiallyStaged&&(this.unstagedFiles=await this.getUnstagedFiles({onlyPartial:!0}),e.hasFilesToHide=!!this.unstagedFiles),this.unstagedFiles){await wn(this.hiddenPath),e.unstagedPatch=p.join(this.hiddenPath,Fn);let t=Pn(this.unstagedFiles);await this.execGit([`diff`,...In,`--output`,e.unstagedPatch,`--`,...t])}if(e.shouldBackup){let t=`lint-staged automatic backup (${e.runId})`;if(e.shouldHideUnstaged||e.shouldHideAll){let n=[`stash`,`push`,`--keep-index`,`--message`,t];e.shouldHideAll&&n.push(`--include-untracked`),await this.execGit(n),e.backupHash=(await this.listStashes()).find(t=>t.includes(e.runId))?.split(` `)[0],await this.restoreMergeStatus(e)}else e.backupHash=await this.execGit([`stash`,`create`]),await this.execGit([`stash`,`store`,`--quiet`,`--message`,t,e.backupHash]);$(`Created backup stash with commit hash %s`,e.backupHash)}this.logger.log(`${Oe()} ${e.shouldBackup?`Done backing up original state (${await this.execGit([`rev-parse`,`--short`,e.backupHash])})!`:`Done preparing lint-staged!`}`)}catch(t){e.errors.add(Z);let n=e.shouldBackup?`Failed to back up original state!`:`Failed to prepare lint-staged!`;this.logger.error(`${Y()} ${n}`),$(t)}}async hidePartiallyStagedChanges(e){this.logger.log(H(`${J()} Hiding unstaged changes to partially staged files…`));try{let e=Pn(this.unstagedFiles,!1);await this.execGit([`restore`,`--worktree`,`--`,...e]),this.logger.log(`${Oe()} Done hiding unstaged changes to partially staged files!`)}catch(t){e.errors.add(Z),e.errors.add(Mt);let n=`${Y()} Failed to hude unstaged changes to partially staged files!`;this.logger.error(n),$(t)}}async runTasks(e,t,{abortController:n,concurrent:r}){this.logger.log(H(`${J()} Running tasks for ${this.diff?`changed`:`staged`} files…`));try{e.unstagedDiff=await this.execGit([`diff`,...In,`--raw`,`-z`,`--no-renames`,`--no-textconv`],{trim:!1})}catch(t){e.errors.add(Z),this.logger.error(`Failed to get diff of unstaged changes!`),$(t);return}let i=`${Y()} Failed to run tasks for ${this.diff?`changed`:`staged`} files!`;try{await Mn(e,t,{abortController:n,concurrent:r,logger:this.logger}),this.logger.log(e.errors.has(Lt)?i:`${Oe()} Done running tasks for ${this.diff?`changed`:`staged`} files!`)}catch(t){e.errors.add(Lt),this.logger.error(i),$(t)}}async updateIndex(e){this.logger.log(H(`${J()} Staging changes from tasks…`));try{let t=await this.execGit([`diff`,...In,`--raw`,`-z`,`--no-renames`,`--no-textconv`],{trim:!1}),n=zn(e.unstagedDiff),r=zn(t),i=/* @__PURE__ */ new Set;for(let e of/* @__PURE__ */ new Set([...n.keys(),...r.keys()]))n.get(e)!==r.get(e)&&i.add(X(p.resolve(this.topLevelDir,e)));if(e.shouldFailOnChanges&&i.size>0){e.errors.add(Rt),this.logger.error(`${Y()} Tasks modified files and --fail-on-changes was used!`);return}if(i.size>0){let e=await xn(`git add --`,[...i],this.maxArgLength),t=process.env.GIT_INDEX_FILE?X(process.env.GIT_INDEX_FILE):process.env.GIT_INDEX_FILE,n=t?.endsWith(`.lock`)?X(await this.execGit([`rev-parse`,`--path-format=absolute`,`--git-path`,`index.lock`])):void 0;for(let{files:r}of e)$(`Updating active Git index: %s`,t),await this.execGit([`add`,`--`,...r]),$(`Done updating Git index: %s`,t),n&&t!==n&&($(`Updating default Git index again: %s`,n),await this.execGit([`add`,`--`,...r],{env:{GIT_INDEX_FILE:n}}),$(`Done updating default Git index lock: %s`,n))}if(!this.allowEmpty&&an(await this.execGit([...On(this.diff,this.diffFilter),`--name-only`,`-z`])).length===0){e.errors.add(Tt),this.logger.error(`${Y()} Prevented an empty git commit!`);return}this.logger.log(`${Oe()} Done staging changes from tasks!`)}catch(t){e.errors.add(Z),this.logger.log(`${Y()} Failed to stage changes from tasks!`),$(t)}}async restoreUnstagedChanges(e){this.logger.log(H(`${J()} Restoring unstaged changes…`));let t=p.join(this.hiddenPath,Fn);try{await this.execGit([`apply`,...Ln,t]),await Tn(this.hiddenPath)}catch(n){$(`Error while restoring changes:`),$(n),$(`Retrying with 3-way merge`);try{await this.execGit([`apply`,...Ln,`--3way`,t]),await Tn(this.hiddenPath)}catch(t){e.errors.add(Z),e.errors.add(It),this.logger.error(`${Y()} Failed to restore unstaged changes!`),$(t)}}}async restoreUntrackedFiles(e){this.logger.log(H(`${J()} Restoring untracked files…`));try{let t=`${e.backupHash}^3`,n=await this.execGit([`ls-tree`,`-r`,`--name-only`,`-z`,t]).then(an);n.length?($(`Found untracked files: %s`,n),await this.execGit([`restore`,`--source`,t,`--`,...n.map(X)]),this.logger.log(`${Oe()} Done restoring untracked files!`)):this.logger.log(`${je()} ${H(`No untracked files to restore!`)}`)}catch(t){e.errors.add(Z),e.errors.add(It),this.logger.error(`${Y()} Failed to restore untracked files!`),$(t)}}async restoreOriginalState(e){this.logger.log(H(`${J()} Reverting to original state because of errors…`));try{$(`Restoring original state...`),await this.execGit([`reset`,`--hard`,`HEAD`]),await this.execGit([`stash`,`apply`,`--quiet`,`--index`,e.backupHash]),await this.restoreMergeStatus(e),await Tn(this.hiddenPath),this.logger.log(`${Oe()} Done reverting to original state!`)}catch(t){e.errors.add(Z),e.errors.add(Ft),this.logger.error(`${Y()} Failed to revert to original state!`),$(t)}}async cleanup(e){this.logger.log(H(`${J()} Cleaning up temporary files…`));try{let t=(await this.listStashes()).findIndex(t=>t.startsWith(e.backupHash));t>-1?(await this.execGit([`stash`,`drop`,`--quiet`,String(t)]),this.logger.log(`${Oe()} Done cleaning up temporary files!`)):this.logger.error(`${Y()} lint-staged automatic backup is missing!`)}catch(t){e.errors.add(Z),this.logger.error(`${Y()} Failed to clean up temporary files!`),$(t)}}};const Wn=K(`lint-staged:groupFilesByConfig`),Gn=async({configs:e,files:t,singleConfigMode:n})=>{Wn(`Grouping %d files by %d configurations`,t.length,Object.keys(e).length);let r={},i=Object.entries(e);if(n){let e=i[0];if(e){let[n,i]=e;r[n]={config:i,files:t}}return r}let a=/* @__PURE__ */ new Map,o=1/0;for(let[e,[t,n]]of i.entries()){r[t]={config:n,files:[]};let i=p.dirname(t);a.has(i)||a.set(i,e),o===1/0&&Object.keys(n).some(e=>e.startsWith(`..`))&&(o=e)}let s=/* @__PURE__ */ new Map,c=e=>{let t=s.get(e);if(t!==void 0)return t;let n=a.get(e)??1/0,r=p.dirname(e);return r!==e&&(n=Math.min(n,c(r))),s.set(e,n),n};for(let e of new Set(t)){let t=c(p.dirname(e.filepath)),n=Math.min(t,o);if(n!==1/0){let[t]=i[n];r[t].files.push(e)}}return r},Kn=K(`lint-staged:resolveGitRepo`),qn=async(e=process.cwd())=>{try{Kn("Resolving git repo from `%s`",e),Kn("Unset GIT_DIR (was `%s`)",process.env.GIT_DIR),delete process.env.GIT_DIR,Kn("Unset GIT_WORK_TREE (was `%s`)",process.env.GIT_WORK_TREE),delete process.env.GIT_WORK_TREE;let[t,n,r]=(await De([`rev-parse`,`--show-cdup`,`--show-toplevel`,`--absolute-git-dir`],{cwd:e})).split(`
48
+ `),i=X(p.join(e,t));Kn("Resolved git repository top-level directory to be `%s`",i);let a=p.relative(n,r),o=X(p.join(i,a));return Kn("Resolved git config directory to be `%s`",o),{topLevelDir:i,gitConfigDir:o}}catch(e){return Kn(`Failed to resolve git repo with error:`,e),{error:e,topLevelDir:null,gitConfigDir:null}}},Jn=`lint-staged`,Yn=`package.json`,Xn=[`package.yaml`,`package.yml`],Zn=[Yn,...Xn,`.lintstagedrc`,`.lintstagedrc.json`,`.lintstagedrc.yaml`,`.lintstagedrc.yml`,`.lintstagedrc.mjs`,`.lintstagedrc.mts`,`.lintstagedrc.js`,`.lintstagedrc.ts`,`.lintstagedrc.cjs`,`.lintstagedrc.cts`,`lint-staged.config.mjs`,`lint-staged.config.mts`,`lint-staged.config.js`,`lint-staged.config.ts`,`lint-staged.config.cjs`,`lint-staged.config.cts`],Qn=n(import.meta.url);function $n(e){try{return Qn.resolve(e)}catch{return e}}const er=K(`lint-staged:loadConfig`),tr=async e=>C.readFile(p.resolve(e),`utf-8`),nr=async e=>{let t=Yn.includes(p.basename(e));try{let n=await tr(e),r=JSON.parse(n);return t?r[Jn]:r}catch(t){if(p.basename(e)===`package.json`){er(`Ignoring invalid JSON file %s`,e);return}throw t}},rr=async t=>{let n=Xn.includes(p.basename(t));try{let[r,i]=await Promise.all([import(`./dist-C92sbTTu.mjs`).then(t=>/* @__PURE__ */ e(t.default,1)),tr(t)]),a=r.parse(i);return n?a[Jn]:a}catch(e){if(n){er(`Ignoring invalid YAML file %s`,t);return}throw e}},ir=e=>import(i(e)).then(e=>e.default),ar=`noExt`,or={[ar]:rr,".cjs":ir,".cts":ir,".js":ir,".json":nr,".mjs":ir,".mts":ir,".ts":ir,".yaml":rr,".yml":rr},sr=async e=>{let t=p.resolve(e),n=p.extname(t)||ar,r=or[n];return{config:await r(t),filepath:t}},cr=async(e,t)=>{try{er("Loading configuration from `%s`...",e);let t=await sr($n(e)),n=await t.config??null,r=t.filepath;return n?er("Successfully loaded config from `%s`:\n%O",r,n):er(`Found no config in %s`,r),{config:n,filepath:r}}catch(n){return er("Failed to load configuration from `%s` with error:\n",e,n),t.error(Qe(e)),{}}},lr=K(`lint-staged:searchConfigs`),ur=Zn.map(e=>`:(glob)**/${e}`),dr=e=>e.split(`/`).length,fr=(e,t)=>dr(t)-dr(e)||e.localeCompare(t),pr=/^[HSMRCK?U] /,mr=async({cwd:e,topLevelDir:t})=>De([`ls-files`,`-z`,`--full-name`,`-t`,`--cached`,`--others`,`--exclude-standard`,`--`,...ur],{cwd:e}).then(an).then(e=>{let n=e.flatMap(e=>{if(e.startsWith(`S `))return[];let n=e.replace(pr,``);return[X(p.join(t,n))]});return lr(`Found possible config files from git:`,n),n}),hr=async({cwd:e})=>{lr(`Listing possible configs from filesystem starting from "%s"...`,e);let t=(await Promise.allSettled(Zn.map(async t=>{let n=p.join(e,t);return await C.access(n,w.F_OK),n}))).flatMap(e=>e.status===`fulfilled`?[X(e.value)]:[]);if(t.length>0)return lr(`Found possible config files from filesystem:`,t),t;let n=p.dirname(e);return n===e?[]:hr({cwd:n})},gr=async({configObject:e,configPath:t,cwd:n=process.cwd(),topLevelDir:r=n},i)=>{if(lr(`Searching for configuration files...`),e)return lr(`Using single direct configuration object...`),{"":vn(e,`config object`,i)};if(t){lr(`Using single configuration path...`);let{config:e,filepath:n}=await cr(t,i);return e?{[t]:vn(e,n,i)}:{}}let a=/* @__PURE__ */ new Set,o=e=>{e.forEach(e=>{a.add(e)})};await Promise.all([mr({cwd:n,topLevelDir:r}).then(o),hr({cwd:n}).then(o)]);let s=[...a].toSorted(fr).reduce((e,t)=>Object.assign(e,{[t]:null}),{});await Promise.all(Object.keys(s).map(e=>cr(e,i).then(({config:t,filepath:n})=>{t&&(e!==n&&lr(`Config file "%s" resolved to "%s"`,e,n),s[e]=vn(t,n,i))})));let c=Object.entries(s).reduce((e,[t,n])=>(n&&Object.assign(e,{[t]:n}),e),{});return lr(`Found %d config files`,Object.keys(c).length),c},_r=K(`lint-staged:runAll`),vr=(e,t)=>{if(t){let t=()=>{};return{error:e.error,log:t,warn:t}}return e},yr=(e,t)=>Object.assign(Error(`lint-staged failed`,{cause:t}),{ctx:e}),br=async({all:e,allowEmpty:t,concurrent:n,configObject:r,configPath:i,continueOnError:a,cwd:o,diff:s,diffFilter:c,failOnChanges:l,hideAll:u,hideUnstaged:d,hidePartiallyStaged:f,maxArgLength:m,quiet:h,relative:g,stash:ee,revert:_,verbose:v},y=console)=>{let b=vr(y,h);_r(`Running all tasks...`);let x=!!o;o=x?p.resolve(o):process.cwd(),_r("Using working directory `%s`",o);let S=zt({failOnChanges:l,hideAll:u,hideUnstaged:d,hidePartiallyStaged:f,quiet:h,revert:_}),{topLevelDir:C,gitConfigDir:w}=await qn(o);if(!C)throw h||S.output.push(Ie()),S.errors.add(jt),yr(S,jt);let T=await De([`log`,`-1`],{cwd:C}).then(()=>!0).catch(()=>!1);S.shouldBackup=T&&ee,S.shouldBackup||b.warn(Ue(e,T,s)),S.shouldHidePartiallyStaged||S.shouldHideUnstaged||S.shouldHideAll||b.warn(We());let[E,D,O]=await Promise.all([An({all:e,cwd:C,diff:s,diffFilter:c,gitConfigDir:w}),sn({cwd:C}),gr({configObject:r,configPath:i,cwd:o,topLevelDir:C},b)]);if(!E)throw h||S.output.push(Le()),S.errors.add(kt),yr(S,kt);if(_r(`Loaded list of staged files in git:
49
+ %O`,E),E.length===0)return h||S.output.push(Ve()),S;if(D.length>0)throw S.errors.add(At),yr(S,D);let te=Object.keys(O).length;if(te===0)throw S.errors.add(Et),yr(S,Et);let ne=await Gn({configs:O,files:E,singleConfigMode:r||i!==void 0}),k=te>1,A=!1,j=[],M=vt();for(let[e,{config:t,files:n}]of Object.entries(ne)){let r=e?X(p.relative(o,e)):`Config object`,i=x||!k?o:p.dirname(e),s=await Promise.all(gt({config:t,cwd:i,files:n,relative:g}).map(e=>(tn(e.commands)?nn({abortController:M,command:e.commands,continueOnError:a,files:e.fileList,verbose:v}):Sn({abortController:M,commands:e.commands,continueOnError:a,cwd:i,files:e.fileList,maxArgLength:m,topLevelDir:C,verbose:v})).then(t=>{let n=e=>e.title.includes(`git add`);A||=t.some(e=>Array.isArray(e)?e.some(n):n(e));let r=e.fileList.length;return{title:`${e.pattern}${H(` — ${r} ${r===1?`file`:`files`}`)}`,task:t,skip:()=>r===0&&`${e.pattern}${H(` — no files`)}`}})));j.push({title:`${r}${H(` — ${n.length} ${n.length>1?`files`:`file`}`)}`,task:s,skip:()=>s.every(e=>e.skip())?`${r}${H(` — no tasks to run`)}`:!1})}if(A&&b.warn(Ge()),j.every(e=>e.skip()))return h||S.output.push(He()),S;let N=new Un({allowEmpty:t,diff:s,diffFilter:c,failOnChanges:l,gitConfigDir:w,logger:b,maxArgLength:m,topLevelDir:C});if(await N.prepare(S),Bt(S)&&await N.hidePartiallyStagedChanges(S),M.signal.aborted||S.errors.size>0?b.log(`${je()} ${H(`Skipped running tasks…`)}`):await N.runTasks(S,j,{abortController:M,concurrent:n}),Ut(S)?b.log(`${je()} ${H(`Skipped staging changes from tasks…`)}`):await N.updateIndex(S),Vt(S)&&(Wt(S)?b.log(`${je()} ${H(`Skipped restoring unstaged changes…`)}`):await N.restoreUnstagedChanges(S)),Ht(S)&&(Wt(S)?b.log(`${je()} ${H(`Skipped restoring untracked files…`)}`):await N.restoreUntrackedFiles(S)),Gt(S)&&(Kt(S)?b.log(`${je()} ${H(`Skipped reverting to original state because of errors…`)}`):await N.restoreOriginalState(S)),qt(S)&&(Jt(S)?b.log(`${je()} ${H(`Skipped cleaning up temporary files…`)}`):await N.cleanup(S)),S.errors.size>0)throw yr(S);return S},xr=K(`lint-staged:validateOptions`),Sr=e=>Number.isInteger(e)||e===1/0,Cr=async(e={},t)=>{xr(`Validating options...`);let{concurrent:n,cwd:r,maxArgLength:i}=e;if(n!==void 0&&typeof n!=`boolean`&&(!Sr(n)||n<1))throw t.error(Ye(`concurrent`,`${n}`,`Must be boolean, positive integer or Infinite`)),Nt;if(typeof r==`string`)try{let e=p.resolve(r);await C.access(e,y.F_OK)}catch(n){throw xr(`Failed to validate options: %o`,e),t.error(Ye(`cwd`,r,n.message)),Nt}if(i!=null&&(!Sr(i)||i<1))throw t.error(Ye(`maxArgLength`,`${i}`,`Must be positive integer, or Infinite`)),Nt;xr(`Validated options: %o`,e)},wr=async()=>JSON.parse(await C.readFile(new URL(`../package.json`,import.meta.url))).version,Tr=K(`lint-staged`),Er=async(e={},t=console)=>{let n=it(e);I(n.color),n.debug&&(re(t),Tr("Running `lint-staged@%s` on Node.js %s (%s)",await wr(),process.version,process.platform));let r=await De([`version`,`--build-options`],{cwd:n.cwd});if(Tr(`%s`,r),!N(r))throw Error(tt(te,r),{cause:r});await Cr(n,t),Tr("Unset GIT_LITERAL_PATHSPECS (was `%s`)",process.env.GIT_LITERAL_PATHSPECS),delete process.env.GIT_LITERAL_PATHSPECS;try{let e=await br(n,t);return Tr(`Tasks were executed successfully!`),at(e,t),!0}catch(e){if(e?.ctx?.errors){let{ctx:n}=e;return n.errors.has(Et)?t.error(Be()):n.errors.has(At)?t.error(Re(e.cause)):n.errors.has(Tt)?t.warn(Xe()):n.errors.has(Rt)?(t.warn(qe()+`
50
+ `),t.warn(Ze(n.backupHash))):n.errors.has(It)?(t.warn(et()),t.warn(n.unstagedPatch)):(n.errors.has(Z)||Jt(n))&&(t.error(Je()),n.shouldBackup&&t.error(Ze(n.backupHash)+`
51
+ `)),at(n,t),!1}throw e}};export{Er as default};
@@ -0,0 +1,2 @@
1
+ import{i as e,t}from"./rolldown-runtime-9nwCUaSw.mjs";var n=/* @__PURE__ */ e((/* @__PURE__ */ t(((e,t)=>{let n=process||{},r=n.argv||[],i=n.env||{},a=!(i.NO_COLOR||r.includes(`--no-color`))&&(!!i.FORCE_COLOR||r.includes(`--color`)||n.platform===`win32`||(n.stdout||{}).isTTY&&i.TERM!==`dumb`||!!i.CI),o=(e,t,n=e)=>r=>{let i=``+r,a=i.indexOf(t,e.length);return~a?e+s(i,t,n,a)+t:e+i+t},s=(e,t,n,r)=>{let i=``,a=0;do i+=e.substring(a,r)+n,a=r+t.length,r=e.indexOf(t,a);while(~r);return i+e.substring(a)},c=(e=a)=>{let t=e?o:()=>String;return{isColorSupported:e,reset:t(`\x1B[0m`,`\x1B[0m`),bold:t(`\x1B[1m`,`\x1B[22m`,`\x1B[22m\x1B[1m`),dim:t(`\x1B[2m`,`\x1B[22m`,`\x1B[22m\x1B[2m`),italic:t(`\x1B[3m`,`\x1B[23m`),underline:t(`\x1B[4m`,`\x1B[24m`),inverse:t(`\x1B[7m`,`\x1B[27m`),hidden:t(`\x1B[8m`,`\x1B[28m`),strikethrough:t(`\x1B[9m`,`\x1B[29m`),black:t(`\x1B[30m`,`\x1B[39m`),red:t(`\x1B[31m`,`\x1B[39m`),green:t(`\x1B[32m`,`\x1B[39m`),yellow:t(`\x1B[33m`,`\x1B[39m`),blue:t(`\x1B[34m`,`\x1B[39m`),magenta:t(`\x1B[35m`,`\x1B[39m`),cyan:t(`\x1B[36m`,`\x1B[39m`),white:t(`\x1B[37m`,`\x1B[39m`),gray:t(`\x1B[90m`,`\x1B[39m`),bgBlack:t(`\x1B[40m`,`\x1B[49m`),bgRed:t(`\x1B[41m`,`\x1B[49m`),bgGreen:t(`\x1B[42m`,`\x1B[49m`),bgYellow:t(`\x1B[43m`,`\x1B[49m`),bgBlue:t(`\x1B[44m`,`\x1B[49m`),bgMagenta:t(`\x1B[45m`,`\x1B[49m`),bgCyan:t(`\x1B[46m`,`\x1B[49m`),bgWhite:t(`\x1B[47m`,`\x1B[49m`),blackBright:t(`\x1B[90m`,`\x1B[39m`),redBright:t(`\x1B[91m`,`\x1B[39m`),greenBright:t(`\x1B[92m`,`\x1B[39m`),yellowBright:t(`\x1B[93m`,`\x1B[39m`),blueBright:t(`\x1B[94m`,`\x1B[39m`),magentaBright:t(`\x1B[95m`,`\x1B[39m`),cyanBright:t(`\x1B[96m`,`\x1B[39m`),whiteBright:t(`\x1B[97m`,`\x1B[39m`),bgBlackBright:t(`\x1B[100m`,`\x1B[49m`),bgRedBright:t(`\x1B[101m`,`\x1B[49m`),bgGreenBright:t(`\x1B[102m`,`\x1B[49m`),bgYellowBright:t(`\x1B[103m`,`\x1B[49m`),bgBlueBright:t(`\x1B[104m`,`\x1B[49m`),bgMagentaBright:t(`\x1B[105m`,`\x1B[49m`),bgCyanBright:t(`\x1B[106m`,`\x1B[49m`),bgWhiteBright:t(`\x1B[107m`,`\x1B[49m`)}};t.exports=c(),t.exports.createColors=c})))(),1);const r=[` `,`⚠`,`✖`],i=[`white`,`yellow`,`red`];function a(e={},t={}){let{results:n=[]}=e,r=e=>o(e,t),i=e=>s(e,t);return n.filter(e=>Array.isArray(e.warnings)||Array.isArray(e.errors)).map(e=>[...r(e),...i(e)]).reduce((e,t)=>Array.isArray(t)?[...e,...t]:[...e,t],[]).join(`
2
+ `)}function o(e,t={}){let{color:r=!0,legacyOutput:i=!1}=t,{errors:a=[],warnings:o=[],input:s=``}=e;if(!s)return[``];let c=r?n.default.gray(`⧗`):`⧗`,l=r?n.default.bold(s):s,u=a.length>0||o.length>0;return t.verbose||u?i?[`${c} input: ${l}`]:[`${c} --- input ---\n${l}`]:[]}function s(e={},t={}){let{signs:a=r,colors:o=i,color:s=!0}=t,{errors:u=[],warnings:d=[]}=e,f=[...u,...d].map(e=>{let t=a[e.level]||``,r=o[e.level]||`white`,i=n.default[r],c=s?i(t):t,l=s?n.default.gray(`[${e.name}]`):`[${e.name}]`;return`${c} ${e.message} ${l}`}),p=c(e),m=l(e),h=s?n.default[m](p):p,g=u.length,_=d.length,v=f.length>0,y=t.verbose||v?`${h} found ${g} problems, ${_} warnings`:void 0,b=s&&typeof y==`string`?n.default.bold(y):y,x=v&&t.helpUrl?`ⓘ Get help: ${t.helpUrl}`:void 0;return[...f,v?``:void 0,b,x,v?``:void 0].filter(e=>typeof e==`string`)}function c(e){return(e.errors||[]).length>0?`✖`:(e.warnings||[]).length?`⚠`:`✔`}function l(e){return(e.errors||[]).length>0?`red`:(e.warnings||[]).length?`yellow`:`green`}export{a as default};