espcli 0.0.5 → 0.0.7

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.
Files changed (3) hide show
  1. package/README.md +2 -0
  2. package/dist/index.js +99 -97
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,134 +1,136 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as zX}from"node:module";var GX=Object.create;var{getPrototypeOf:KX,defineProperty:U3,getOwnPropertyNames:UX}=Object;var BX=Object.prototype.hasOwnProperty;var o=($,q,J)=>{J=$!=null?GX(KX($)):{};let X=q||!$||!$.__esModule?U3(J,"default",{value:$,enumerable:!0}):J;for(let Z of UX($))if(!BX.call(X,Z))U3(X,Z,{get:()=>$[Z],enumerable:!0});return X};var A=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports);var m=zX(import.meta.url);var e1=A((LX)=>{class X2 extends Error{constructor($,q,J){super(J);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=q,this.exitCode=$,this.nestedError=void 0}}class B3 extends X2{constructor($){super(1,"commander.invalidArgument",$);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}LX.CommanderError=X2;LX.InvalidArgumentError=B3});var k0=A((TX)=>{var{InvalidArgumentError:_X}=e1();class z3{constructor($,q){switch(this.description=q||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,$[0]){case"<":this.required=!0,this._name=$.slice(1,-1);break;case"[":this.required=!1,this._name=$.slice(1,-1);break;default:this.required=!0,this._name=$;break}if(this._name.endsWith("..."))this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_collectValue($,q){if(q===this.defaultValue||!Array.isArray(q))return[$];return q.push($),q}default($,q){return this.defaultValue=$,this.defaultValueDescription=q,this}argParser($){return this.parseArg=$,this}choices($){return this.argChoices=$.slice(),this.parseArg=(q,J)=>{if(!this.argChoices.includes(q))throw new _X(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(q,J);return q},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function RX($){let q=$.name()+($.variadic===!0?"...":"");return $.required?"<"+q+">":"["+q+"]"}TX.Argument=z3;TX.humanReadableArgName=RX});var Z2=A((jX)=>{var{humanReadableArgName:FX}=k0();class L3{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext($){this.helpWidth=this.helpWidth??$.helpWidth??80}visibleCommands($){let q=$.commands.filter((X)=>!X._hidden),J=$._getHelpCommand();if(J&&!J._hidden)q.push(J);if(this.sortSubcommands)q.sort((X,Z)=>{return X.name().localeCompare(Z.name())});return q}compareOptions($,q){let J=(X)=>{return X.short?X.short.replace(/^-/,""):X.long.replace(/^--/,"")};return J($).localeCompare(J(q))}visibleOptions($){let q=$.options.filter((X)=>!X.hidden),J=$._getHelpOption();if(J&&!J.hidden){let X=J.short&&$._findOption(J.short),Z=J.long&&$._findOption(J.long);if(!X&&!Z)q.push(J);else if(J.long&&!Z)q.push($.createOption(J.long,J.description));else if(J.short&&!X)q.push($.createOption(J.short,J.description))}if(this.sortOptions)q.sort(this.compareOptions);return q}visibleGlobalOptions($){if(!this.showGlobalOptions)return[];let q=[];for(let J=$.parent;J;J=J.parent){let X=J.options.filter((Z)=>!Z.hidden);q.push(...X)}if(this.sortOptions)q.sort(this.compareOptions);return q}visibleArguments($){if($._argsDescription)$.registeredArguments.forEach((q)=>{q.description=q.description||$._argsDescription[q.name()]||""});if($.registeredArguments.find((q)=>q.description))return $.registeredArguments;return[]}subcommandTerm($){let q=$.registeredArguments.map((J)=>FX(J)).join(" ");return $._name+($._aliases[0]?"|"+$._aliases[0]:"")+($.options.length?" [options]":"")+(q?" "+q:"")}optionTerm($){return $.flags}argumentTerm($){return $.name()}longestSubcommandTermLength($,q){return q.visibleCommands($).reduce((J,X)=>{return Math.max(J,this.displayWidth(q.styleSubcommandTerm(q.subcommandTerm(X))))},0)}longestOptionTermLength($,q){return q.visibleOptions($).reduce((J,X)=>{return Math.max(J,this.displayWidth(q.styleOptionTerm(q.optionTerm(X))))},0)}longestGlobalOptionTermLength($,q){return q.visibleGlobalOptions($).reduce((J,X)=>{return Math.max(J,this.displayWidth(q.styleOptionTerm(q.optionTerm(X))))},0)}longestArgumentTermLength($,q){return q.visibleArguments($).reduce((J,X)=>{return Math.max(J,this.displayWidth(q.styleArgumentTerm(q.argumentTerm(X))))},0)}commandUsage($){let q=$._name;if($._aliases[0])q=q+"|"+$._aliases[0];let J="";for(let X=$.parent;X;X=X.parent)J=X.name()+" "+J;return J+q+" "+$.usage()}commandDescription($){return $.description()}subcommandDescription($){return $.summary()||$.description()}optionDescription($){let q=[];if($.argChoices)q.push(`choices: ${$.argChoices.map((J)=>JSON.stringify(J)).join(", ")}`);if($.defaultValue!==void 0){if($.required||$.optional||$.isBoolean()&&typeof $.defaultValue==="boolean")q.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`)}if($.presetArg!==void 0&&$.optional)q.push(`preset: ${JSON.stringify($.presetArg)}`);if($.envVar!==void 0)q.push(`env: ${$.envVar}`);if(q.length>0){let J=`(${q.join(", ")})`;if($.description)return`${$.description} ${J}`;return J}return $.description}argumentDescription($){let q=[];if($.argChoices)q.push(`choices: ${$.argChoices.map((J)=>JSON.stringify(J)).join(", ")}`);if($.defaultValue!==void 0)q.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`);if(q.length>0){let J=`(${q.join(", ")})`;if($.description)return`${$.description} ${J}`;return J}return $.description}formatItemList($,q,J){if(q.length===0)return[];return[J.styleTitle($),...q,""]}groupItems($,q,J){let X=new Map;return $.forEach((Z)=>{let H=J(Z);if(!X.has(H))X.set(H,[])}),q.forEach((Z)=>{let H=J(Z);if(!X.has(H))X.set(H,[]);X.get(H).push(Z)}),X}formatHelp($,q){let J=q.padWidth($,q),X=q.helpWidth??80;function Z(U,B){return q.formatItem(U,J,B,q)}let H=[`${q.styleTitle("Usage:")} ${q.styleUsage(q.commandUsage($))}`,""],Q=q.commandDescription($);if(Q.length>0)H=H.concat([q.boxWrap(q.styleCommandDescription(Q),X),""]);let Y=q.visibleArguments($).map((U)=>{return Z(q.styleArgumentTerm(q.argumentTerm(U)),q.styleArgumentDescription(q.argumentDescription(U)))});if(H=H.concat(this.formatItemList("Arguments:",Y,q)),this.groupItems($.options,q.visibleOptions($),(U)=>U.helpGroupHeading??"Options:").forEach((U,B)=>{let z=U.map((L)=>{return Z(q.styleOptionTerm(q.optionTerm(L)),q.styleOptionDescription(q.optionDescription(L)))});H=H.concat(this.formatItemList(B,z,q))}),q.showGlobalOptions){let U=q.visibleGlobalOptions($).map((B)=>{return Z(q.styleOptionTerm(q.optionTerm(B)),q.styleOptionDescription(q.optionDescription(B)))});H=H.concat(this.formatItemList("Global Options:",U,q))}return this.groupItems($.commands,q.visibleCommands($),(U)=>U.helpGroup()||"Commands:").forEach((U,B)=>{let z=U.map((L)=>{return Z(q.styleSubcommandTerm(q.subcommandTerm(L)),q.styleSubcommandDescription(q.subcommandDescription(L)))});H=H.concat(this.formatItemList(B,z,q))}),H.join(`
3
- `)}displayWidth($){return V3($).length}styleTitle($){return $}styleUsage($){return $.split(" ").map((q)=>{if(q==="[options]")return this.styleOptionText(q);if(q==="[command]")return this.styleSubcommandText(q);if(q[0]==="["||q[0]==="<")return this.styleArgumentText(q);return this.styleCommandText(q)}).join(" ")}styleCommandDescription($){return this.styleDescriptionText($)}styleOptionDescription($){return this.styleDescriptionText($)}styleSubcommandDescription($){return this.styleDescriptionText($)}styleArgumentDescription($){return this.styleDescriptionText($)}styleDescriptionText($){return $}styleOptionTerm($){return this.styleOptionText($)}styleSubcommandTerm($){return $.split(" ").map((q)=>{if(q==="[options]")return this.styleOptionText(q);if(q[0]==="["||q[0]==="<")return this.styleArgumentText(q);return this.styleSubcommandText(q)}).join(" ")}styleArgumentTerm($){return this.styleArgumentText($)}styleOptionText($){return $}styleArgumentText($){return $}styleSubcommandText($){return $}styleCommandText($){return $}padWidth($,q){return Math.max(q.longestOptionTermLength($,q),q.longestGlobalOptionTermLength($,q),q.longestSubcommandTermLength($,q),q.longestArgumentTermLength($,q))}preformatted($){return/\n[^\S\r\n]/.test($)}formatItem($,q,J,X){let H=" ".repeat(2);if(!J)return H+$;let Q=$.padEnd(q+$.length-X.displayWidth($)),Y=2,K=(this.helpWidth??80)-q-Y-2,U;if(K<this.minWidthToWrap||X.preformatted(J))U=J;else U=X.boxWrap(J,K).replace(/\n/g,`
2
+ import{createRequire as RX}from"node:module";var LX=Object.create;var{getPrototypeOf:WX,defineProperty:W3,getOwnPropertyNames:VX}=Object;var _X=Object.prototype.hasOwnProperty;var n=($,q,J)=>{J=$!=null?LX(WX($)):{};let X=q||!$||!$.__esModule?W3(J,"default",{value:$,enumerable:!0}):J;for(let Z of VX($))if(!_X.call(X,Z))W3(X,Z,{get:()=>$[Z],enumerable:!0});return X};var A=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports);var m=RX(import.meta.url);var q0=A((PX)=>{class H2 extends Error{constructor($,q,J){super(J);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=q,this.exitCode=$,this.nestedError=void 0}}class V3 extends H2{constructor($){super(1,"commander.invalidArgument",$);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}PX.CommanderError=H2;PX.InvalidArgumentError=V3});var j0=A((jX)=>{var{InvalidArgumentError:FX}=q0();class _3{constructor($,q){switch(this.description=q||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,$[0]){case"<":this.required=!0,this._name=$.slice(1,-1);break;case"[":this.required=!1,this._name=$.slice(1,-1);break;default:this.required=!0,this._name=$;break}if(this._name.endsWith("..."))this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_collectValue($,q){if(q===this.defaultValue||!Array.isArray(q))return[$];return q.push($),q}default($,q){return this.defaultValue=$,this.defaultValueDescription=q,this}argParser($){return this.parseArg=$,this}choices($){return this.argChoices=$.slice(),this.parseArg=(q,J)=>{if(!this.argChoices.includes(q))throw new FX(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(q,J);return q},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function xX($){let q=$.name()+($.variadic===!0?"...":"");return $.required?"<"+q+">":"["+q+"]"}jX.Argument=_3;jX.humanReadableArgName=xX});var Y2=A((IX)=>{var{humanReadableArgName:wX}=j0();class R3{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext($){this.helpWidth=this.helpWidth??$.helpWidth??80}visibleCommands($){let q=$.commands.filter((X)=>!X._hidden),J=$._getHelpCommand();if(J&&!J._hidden)q.push(J);if(this.sortSubcommands)q.sort((X,Z)=>{return X.name().localeCompare(Z.name())});return q}compareOptions($,q){let J=(X)=>{return X.short?X.short.replace(/^-/,""):X.long.replace(/^--/,"")};return J($).localeCompare(J(q))}visibleOptions($){let q=$.options.filter((X)=>!X.hidden),J=$._getHelpOption();if(J&&!J.hidden){let X=J.short&&$._findOption(J.short),Z=J.long&&$._findOption(J.long);if(!X&&!Z)q.push(J);else if(J.long&&!Z)q.push($.createOption(J.long,J.description));else if(J.short&&!X)q.push($.createOption(J.short,J.description))}if(this.sortOptions)q.sort(this.compareOptions);return q}visibleGlobalOptions($){if(!this.showGlobalOptions)return[];let q=[];for(let J=$.parent;J;J=J.parent){let X=J.options.filter((Z)=>!Z.hidden);q.push(...X)}if(this.sortOptions)q.sort(this.compareOptions);return q}visibleArguments($){if($._argsDescription)$.registeredArguments.forEach((q)=>{q.description=q.description||$._argsDescription[q.name()]||""});if($.registeredArguments.find((q)=>q.description))return $.registeredArguments;return[]}subcommandTerm($){let q=$.registeredArguments.map((J)=>wX(J)).join(" ");return $._name+($._aliases[0]?"|"+$._aliases[0]:"")+($.options.length?" [options]":"")+(q?" "+q:"")}optionTerm($){return $.flags}argumentTerm($){return $.name()}longestSubcommandTermLength($,q){return q.visibleCommands($).reduce((J,X)=>{return Math.max(J,this.displayWidth(q.styleSubcommandTerm(q.subcommandTerm(X))))},0)}longestOptionTermLength($,q){return q.visibleOptions($).reduce((J,X)=>{return Math.max(J,this.displayWidth(q.styleOptionTerm(q.optionTerm(X))))},0)}longestGlobalOptionTermLength($,q){return q.visibleGlobalOptions($).reduce((J,X)=>{return Math.max(J,this.displayWidth(q.styleOptionTerm(q.optionTerm(X))))},0)}longestArgumentTermLength($,q){return q.visibleArguments($).reduce((J,X)=>{return Math.max(J,this.displayWidth(q.styleArgumentTerm(q.argumentTerm(X))))},0)}commandUsage($){let q=$._name;if($._aliases[0])q=q+"|"+$._aliases[0];let J="";for(let X=$.parent;X;X=X.parent)J=X.name()+" "+J;return J+q+" "+$.usage()}commandDescription($){return $.description()}subcommandDescription($){return $.summary()||$.description()}optionDescription($){let q=[];if($.argChoices)q.push(`choices: ${$.argChoices.map((J)=>JSON.stringify(J)).join(", ")}`);if($.defaultValue!==void 0){if($.required||$.optional||$.isBoolean()&&typeof $.defaultValue==="boolean")q.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`)}if($.presetArg!==void 0&&$.optional)q.push(`preset: ${JSON.stringify($.presetArg)}`);if($.envVar!==void 0)q.push(`env: ${$.envVar}`);if(q.length>0){let J=`(${q.join(", ")})`;if($.description)return`${$.description} ${J}`;return J}return $.description}argumentDescription($){let q=[];if($.argChoices)q.push(`choices: ${$.argChoices.map((J)=>JSON.stringify(J)).join(", ")}`);if($.defaultValue!==void 0)q.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`);if(q.length>0){let J=`(${q.join(", ")})`;if($.description)return`${$.description} ${J}`;return J}return $.description}formatItemList($,q,J){if(q.length===0)return[];return[J.styleTitle($),...q,""]}groupItems($,q,J){let X=new Map;return $.forEach((Z)=>{let H=J(Z);if(!X.has(H))X.set(H,[])}),q.forEach((Z)=>{let H=J(Z);if(!X.has(H))X.set(H,[]);X.get(H).push(Z)}),X}formatHelp($,q){let J=q.padWidth($,q),X=q.helpWidth??80;function Z(U,B){return q.formatItem(U,J,B,q)}let H=[`${q.styleTitle("Usage:")} ${q.styleUsage(q.commandUsage($))}`,""],Q=q.commandDescription($);if(Q.length>0)H=H.concat([q.boxWrap(q.styleCommandDescription(Q),X),""]);let Y=q.visibleArguments($).map((U)=>{return Z(q.styleArgumentTerm(q.argumentTerm(U)),q.styleArgumentDescription(q.argumentDescription(U)))});if(H=H.concat(this.formatItemList("Arguments:",Y,q)),this.groupItems($.options,q.visibleOptions($),(U)=>U.helpGroupHeading??"Options:").forEach((U,B)=>{let z=U.map((W)=>{return Z(q.styleOptionTerm(q.optionTerm(W)),q.styleOptionDescription(q.optionDescription(W)))});H=H.concat(this.formatItemList(B,z,q))}),q.showGlobalOptions){let U=q.visibleGlobalOptions($).map((B)=>{return Z(q.styleOptionTerm(q.optionTerm(B)),q.styleOptionDescription(q.optionDescription(B)))});H=H.concat(this.formatItemList("Global Options:",U,q))}return this.groupItems($.commands,q.visibleCommands($),(U)=>U.helpGroup()||"Commands:").forEach((U,B)=>{let z=U.map((W)=>{return Z(q.styleSubcommandTerm(q.subcommandTerm(W)),q.styleSubcommandDescription(q.subcommandDescription(W)))});H=H.concat(this.formatItemList(B,z,q))}),H.join(`
3
+ `)}displayWidth($){return P3($).length}styleTitle($){return $}styleUsage($){return $.split(" ").map((q)=>{if(q==="[options]")return this.styleOptionText(q);if(q==="[command]")return this.styleSubcommandText(q);if(q[0]==="["||q[0]==="<")return this.styleArgumentText(q);return this.styleCommandText(q)}).join(" ")}styleCommandDescription($){return this.styleDescriptionText($)}styleOptionDescription($){return this.styleDescriptionText($)}styleSubcommandDescription($){return this.styleDescriptionText($)}styleArgumentDescription($){return this.styleDescriptionText($)}styleDescriptionText($){return $}styleOptionTerm($){return this.styleOptionText($)}styleSubcommandTerm($){return $.split(" ").map((q)=>{if(q==="[options]")return this.styleOptionText(q);if(q[0]==="["||q[0]==="<")return this.styleArgumentText(q);return this.styleSubcommandText(q)}).join(" ")}styleArgumentTerm($){return this.styleArgumentText($)}styleOptionText($){return $}styleArgumentText($){return $}styleSubcommandText($){return $}styleCommandText($){return $}padWidth($,q){return Math.max(q.longestOptionTermLength($,q),q.longestGlobalOptionTermLength($,q),q.longestSubcommandTermLength($,q),q.longestArgumentTermLength($,q))}preformatted($){return/\n[^\S\r\n]/.test($)}formatItem($,q,J,X){let H=" ".repeat(2);if(!J)return H+$;let Q=$.padEnd(q+$.length-X.displayWidth($)),Y=2,K=(this.helpWidth??80)-q-Y-2,U;if(K<this.minWidthToWrap||X.preformatted(J))U=J;else U=X.boxWrap(J,K).replace(/\n/g,`
4
4
  `+" ".repeat(q+Y));return H+Q+" ".repeat(Y)+U.replace(/\n/g,`
5
5
  ${H}`)}boxWrap($,q){if(q<this.minWidthToWrap)return $;let J=$.split(/\r\n|\n/),X=/[\s]*[^\s]+/g,Z=[];return J.forEach((H)=>{let Q=H.match(X);if(Q===null){Z.push("");return}let Y=[Q.shift()],G=this.displayWidth(Y[0]);Q.forEach((K)=>{let U=this.displayWidth(K);if(G+U<=q){Y.push(K),G+=U;return}Z.push(Y.join(""));let B=K.trimStart();Y=[B],G=this.displayWidth(B)}),Z.push(Y.join(""))}),Z.join(`
6
- `)}}function V3($){let q=/\x1b\[\d*(;\d*)*m/g;return $.replace(q,"")}jX.Help=L3;jX.stripColor=V3});var Q2=A((IX)=>{var{InvalidArgumentError:CX}=e1();class _3{constructor($,q){this.flags=$,this.description=q||"",this.required=$.includes("<"),this.optional=$.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test($),this.mandatory=!1;let J=wX($);if(this.short=J.shortFlag,this.long=J.longFlag,this.negate=!1,this.long)this.negate=this.long.startsWith("--no-");this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default($,q){return this.defaultValue=$,this.defaultValueDescription=q,this}preset($){return this.presetArg=$,this}conflicts($){return this.conflictsWith=this.conflictsWith.concat($),this}implies($){let q=$;if(typeof $==="string")q={[$]:!0};return this.implied=Object.assign(this.implied||{},q),this}env($){return this.envVar=$,this}argParser($){return this.parseArg=$,this}makeOptionMandatory($=!0){return this.mandatory=!!$,this}hideHelp($=!0){return this.hidden=!!$,this}_collectValue($,q){if(q===this.defaultValue||!Array.isArray(q))return[$];return q.push($),q}choices($){return this.argChoices=$.slice(),this.parseArg=(q,J)=>{if(!this.argChoices.includes(q))throw new CX(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(q,J);return q},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){if(this.negate)return W3(this.name().replace(/^no-/,""));return W3(this.name())}helpGroup($){return this.helpGroupHeading=$,this}is($){return this.short===$||this.long===$}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class R3{constructor($){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,$.forEach((q)=>{if(q.negate)this.negativeOptions.set(q.attributeName(),q);else this.positiveOptions.set(q.attributeName(),q)}),this.negativeOptions.forEach((q,J)=>{if(this.positiveOptions.has(J))this.dualOptions.add(J)})}valueFromOption($,q){let J=q.attributeName();if(!this.dualOptions.has(J))return!0;let X=this.negativeOptions.get(J).presetArg,Z=X!==void 0?X:!1;return q.negate===(Z===$)}}function W3($){return $.split("-").reduce((q,J)=>{return q+J[0].toUpperCase()+J.slice(1)})}function wX($){let q,J,X=/^-[^-]$/,Z=/^--[^-]/,H=$.split(/[ |,]+/).concat("guard");if(X.test(H[0]))q=H.shift();if(Z.test(H[0]))J=H.shift();if(!q&&X.test(H[0]))q=H.shift();if(!q&&Z.test(H[0]))q=J,J=H.shift();if(H[0].startsWith("-")){let Q=H[0],Y=`option creation failed due to '${Q}' in option flags '${$}'`;if(/^-[^-][^-]/.test(Q))throw Error(`${Y}
6
+ `)}}function P3($){let q=/\x1b\[\d*(;\d*)*m/g;return $.replace(q,"")}IX.Help=R3;IX.stripColor=P3});var G2=A((NX)=>{var{InvalidArgumentError:yX}=q0();class k3{constructor($,q){this.flags=$,this.description=q||"",this.required=$.includes("<"),this.optional=$.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test($),this.mandatory=!1;let J=OX($);if(this.short=J.shortFlag,this.long=J.longFlag,this.negate=!1,this.long)this.negate=this.long.startsWith("--no-");this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default($,q){return this.defaultValue=$,this.defaultValueDescription=q,this}preset($){return this.presetArg=$,this}conflicts($){return this.conflictsWith=this.conflictsWith.concat($),this}implies($){let q=$;if(typeof $==="string")q={[$]:!0};return this.implied=Object.assign(this.implied||{},q),this}env($){return this.envVar=$,this}argParser($){return this.parseArg=$,this}makeOptionMandatory($=!0){return this.mandatory=!!$,this}hideHelp($=!0){return this.hidden=!!$,this}_collectValue($,q){if(q===this.defaultValue||!Array.isArray(q))return[$];return q.push($),q}choices($){return this.argChoices=$.slice(),this.parseArg=(q,J)=>{if(!this.argChoices.includes(q))throw new yX(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(q,J);return q},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){if(this.negate)return T3(this.name().replace(/^no-/,""));return T3(this.name())}helpGroup($){return this.helpGroupHeading=$,this}is($){return this.short===$||this.long===$}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class F3{constructor($){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,$.forEach((q)=>{if(q.negate)this.negativeOptions.set(q.attributeName(),q);else this.positiveOptions.set(q.attributeName(),q)}),this.negativeOptions.forEach((q,J)=>{if(this.positiveOptions.has(J))this.dualOptions.add(J)})}valueFromOption($,q){let J=q.attributeName();if(!this.dualOptions.has(J))return!0;let X=this.negativeOptions.get(J).presetArg,Z=X!==void 0?X:!1;return q.negate===(Z===$)}}function T3($){return $.split("-").reduce((q,J)=>{return q+J[0].toUpperCase()+J.slice(1)})}function OX($){let q,J,X=/^-[^-]$/,Z=/^--[^-]/,H=$.split(/[ |,]+/).concat("guard");if(X.test(H[0]))q=H.shift();if(Z.test(H[0]))J=H.shift();if(!q&&X.test(H[0]))q=H.shift();if(!q&&Z.test(H[0]))q=J,J=H.shift();if(H[0].startsWith("-")){let Q=H[0],Y=`option creation failed due to '${Q}' in option flags '${$}'`;if(/^-[^-][^-]/.test(Q))throw Error(`${Y}
7
7
  - a short flag is a single dash and a single character
8
8
  - either use a single dash and a single character (for a short flag)
9
9
  - or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(X.test(Q))throw Error(`${Y}
10
10
  - too many short flags`);if(Z.test(Q))throw Error(`${Y}
11
11
  - too many long flags`);throw Error(`${Y}
12
- - unrecognised flag format`)}if(q===void 0&&J===void 0)throw Error(`option creation failed due to no flags found in '${$}'.`);return{shortFlag:q,longFlag:J}}IX.Option=_3;IX.DualOptions=R3});var T3=A((NX)=>{function yX($,q){if(Math.abs($.length-q.length)>3)return Math.max($.length,q.length);let J=[];for(let X=0;X<=$.length;X++)J[X]=[X];for(let X=0;X<=q.length;X++)J[0][X]=X;for(let X=1;X<=q.length;X++)for(let Z=1;Z<=$.length;Z++){let H=1;if($[Z-1]===q[X-1])H=0;else H=1;if(J[Z][X]=Math.min(J[Z-1][X]+1,J[Z][X-1]+1,J[Z-1][X-1]+H),Z>1&&X>1&&$[Z-1]===q[X-2]&&$[Z-2]===q[X-1])J[Z][X]=Math.min(J[Z][X],J[Z-2][X-2]+1)}return J[$.length][q.length]}function OX($,q){if(!q||q.length===0)return"";q=Array.from(new Set(q));let J=$.startsWith("--");if(J)$=$.slice(2),q=q.map((Q)=>Q.slice(2));let X=[],Z=3,H=0.4;if(q.forEach((Q)=>{if(Q.length<=1)return;let Y=yX($,Q),G=Math.max($.length,Q.length);if((G-Y)/G>H){if(Y<Z)Z=Y,X=[Q];else if(Y===Z)X.push(Q)}}),X.sort((Q,Y)=>Q.localeCompare(Y)),J)X=X.map((Q)=>`--${Q}`);if(X.length>1)return`
12
+ - unrecognised flag format`)}if(q===void 0&&J===void 0)throw Error(`option creation failed due to no flags found in '${$}'.`);return{shortFlag:q,longFlag:J}}NX.Option=k3;NX.DualOptions=F3});var x3=A((SX)=>{function fX($,q){if(Math.abs($.length-q.length)>3)return Math.max($.length,q.length);let J=[];for(let X=0;X<=$.length;X++)J[X]=[X];for(let X=0;X<=q.length;X++)J[0][X]=X;for(let X=1;X<=q.length;X++)for(let Z=1;Z<=$.length;Z++){let H=1;if($[Z-1]===q[X-1])H=0;else H=1;if(J[Z][X]=Math.min(J[Z-1][X]+1,J[Z][X-1]+1,J[Z-1][X-1]+H),Z>1&&X>1&&$[Z-1]===q[X-2]&&$[Z-2]===q[X-1])J[Z][X]=Math.min(J[Z][X],J[Z-2][X-2]+1)}return J[$.length][q.length]}function hX($,q){if(!q||q.length===0)return"";q=Array.from(new Set(q));let J=$.startsWith("--");if(J)$=$.slice(2),q=q.map((Q)=>Q.slice(2));let X=[],Z=3,H=0.4;if(q.forEach((Q)=>{if(Q.length<=1)return;let Y=fX($,Q),G=Math.max($.length,Q.length);if((G-Y)/G>H){if(Y<Z)Z=Y,X=[Q];else if(Y===Z)X.push(Q)}}),X.sort((Q,Y)=>Q.localeCompare(Y)),J)X=X.map((Q)=>`--${Q}`);if(X.length>1)return`
13
13
  (Did you mean one of ${X.join(", ")}?)`;if(X.length===1)return`
14
- (Did you mean ${X[0]}?)`;return""}NX.suggestSimilar=OX});var j3=A((cX)=>{var vX=m("node:events").EventEmitter,H2=m("node:child_process"),Q1=m("node:path"),F0=m("node:fs"),k=m("node:process"),{Argument:fX,humanReadableArgName:hX}=k0(),{CommanderError:Y2}=e1(),{Help:SX,stripColor:bX}=Z2(),{Option:P3,DualOptions:gX}=Q2(),{suggestSimilar:k3}=T3();class K2 extends vX{constructor($){super();this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=$||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:(q)=>k.stdout.write(q),writeErr:(q)=>k.stderr.write(q),outputError:(q,J)=>J(q),getOutHelpWidth:()=>k.stdout.isTTY?k.stdout.columns:void 0,getErrHelpWidth:()=>k.stderr.isTTY?k.stderr.columns:void 0,getOutHasColors:()=>G2()??(k.stdout.isTTY&&k.stdout.hasColors?.()),getErrHasColors:()=>G2()??(k.stderr.isTTY&&k.stderr.hasColors?.()),stripColor:(q)=>bX(q)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings($){return this._outputConfiguration=$._outputConfiguration,this._helpOption=$._helpOption,this._helpCommand=$._helpCommand,this._helpConfiguration=$._helpConfiguration,this._exitCallback=$._exitCallback,this._storeOptionsAsProperties=$._storeOptionsAsProperties,this._combineFlagAndOptionalValue=$._combineFlagAndOptionalValue,this._allowExcessArguments=$._allowExcessArguments,this._enablePositionalOptions=$._enablePositionalOptions,this._showHelpAfterError=$._showHelpAfterError,this._showSuggestionAfterError=$._showSuggestionAfterError,this}_getCommandAndAncestors(){let $=[];for(let q=this;q;q=q.parent)$.push(q);return $}command($,q,J){let X=q,Z=J;if(typeof X==="object"&&X!==null)Z=X,X=null;Z=Z||{};let[,H,Q]=$.match(/([^ ]+) *(.*)/),Y=this.createCommand(H);if(X)Y.description(X),Y._executableHandler=!0;if(Z.isDefault)this._defaultCommandName=Y._name;if(Y._hidden=!!(Z.noHelp||Z.hidden),Y._executableFile=Z.executableFile||null,Q)Y.arguments(Q);if(this._registerCommand(Y),Y.parent=this,Y.copyInheritedSettings(this),X)return this;return Y}createCommand($){return new K2($)}createHelp(){return Object.assign(new SX,this.configureHelp())}configureHelp($){if($===void 0)return this._helpConfiguration;return this._helpConfiguration=$,this}configureOutput($){if($===void 0)return this._outputConfiguration;return this._outputConfiguration={...this._outputConfiguration,...$},this}showHelpAfterError($=!0){if(typeof $!=="string")$=!!$;return this._showHelpAfterError=$,this}showSuggestionAfterError($=!0){return this._showSuggestionAfterError=!!$,this}addCommand($,q){if(!$._name)throw Error(`Command passed to .addCommand() must have a name
15
- - specify the name in Command constructor or using .name()`);if(q=q||{},q.isDefault)this._defaultCommandName=$._name;if(q.noHelp||q.hidden)$._hidden=!0;return this._registerCommand($),$.parent=this,$._checkForBrokenPassThrough(),this}createArgument($,q){return new fX($,q)}argument($,q,J,X){let Z=this.createArgument($,q);if(typeof J==="function")Z.default(X).argParser(J);else Z.default(J);return this.addArgument(Z),this}arguments($){return $.trim().split(/ +/).forEach((q)=>{this.argument(q)}),this}addArgument($){let q=this.registeredArguments.slice(-1)[0];if(q?.variadic)throw Error(`only the last argument can be variadic '${q.name()}'`);if($.required&&$.defaultValue!==void 0&&$.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${$.name()}'`);return this.registeredArguments.push($),this}helpCommand($,q){if(typeof $==="boolean"){if(this._addImplicitHelpCommand=$,$&&this._defaultCommandGroup)this._initCommandGroup(this._getHelpCommand());return this}let J=$??"help [command]",[,X,Z]=J.match(/([^ ]+) *(.*)/),H=q??"display help for command",Q=this.createCommand(X);if(Q.helpOption(!1),Z)Q.arguments(Z);if(H)Q.description(H);if(this._addImplicitHelpCommand=!0,this._helpCommand=Q,$||q)this._initCommandGroup(Q);return this}addHelpCommand($,q){if(typeof $!=="object")return this.helpCommand($,q),this;return this._addImplicitHelpCommand=!0,this._helpCommand=$,this._initCommandGroup($),this}_getHelpCommand(){if(this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))){if(this._helpCommand===void 0)this.helpCommand(void 0,void 0);return this._helpCommand}return null}hook($,q){let J=["preSubcommand","preAction","postAction"];if(!J.includes($))throw Error(`Unexpected value for event passed to hook : '${$}'.
16
- Expecting one of '${J.join("', '")}'`);if(this._lifeCycleHooks[$])this._lifeCycleHooks[$].push(q);else this._lifeCycleHooks[$]=[q];return this}exitOverride($){if($)this._exitCallback=$;else this._exitCallback=(q)=>{if(q.code!=="commander.executeSubCommandAsync")throw q};return this}_exit($,q,J){if(this._exitCallback)this._exitCallback(new Y2($,q,J));k.exit($)}action($){let q=(J)=>{let X=this.registeredArguments.length,Z=J.slice(0,X);if(this._storeOptionsAsProperties)Z[X]=this;else Z[X]=this.opts();return Z.push(this),$.apply(this,Z)};return this._actionHandler=q,this}createOption($,q){return new P3($,q)}_callParseArg($,q,J,X){try{return $.parseArg(q,J)}catch(Z){if(Z.code==="commander.invalidArgument"){let H=`${X} ${Z.message}`;this.error(H,{exitCode:Z.exitCode,code:Z.code})}throw Z}}_registerOption($){let q=$.short&&this._findOption($.short)||$.long&&this._findOption($.long);if(q){let J=$.long&&this._findOption($.long)?$.long:$.short;throw Error(`Cannot add option '${$.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${J}'
17
- - already used by option '${q.flags}'`)}this._initOptionGroup($),this.options.push($)}_registerCommand($){let q=(X)=>{return[X.name()].concat(X.aliases())},J=q($).find((X)=>this._findCommand(X));if(J){let X=q(this._findCommand(J)).join("|"),Z=q($).join("|");throw Error(`cannot add command '${Z}' as already have command '${X}'`)}this._initCommandGroup($),this.commands.push($)}addOption($){this._registerOption($);let q=$.name(),J=$.attributeName();if($.negate){let Z=$.long.replace(/^--no-/,"--");if(!this._findOption(Z))this.setOptionValueWithSource(J,$.defaultValue===void 0?!0:$.defaultValue,"default")}else if($.defaultValue!==void 0)this.setOptionValueWithSource(J,$.defaultValue,"default");let X=(Z,H,Q)=>{if(Z==null&&$.presetArg!==void 0)Z=$.presetArg;let Y=this.getOptionValue(J);if(Z!==null&&$.parseArg)Z=this._callParseArg($,Z,Y,H);else if(Z!==null&&$.variadic)Z=$._collectValue(Z,Y);if(Z==null)if($.negate)Z=!1;else if($.isBoolean()||$.optional)Z=!0;else Z="";this.setOptionValueWithSource(J,Z,Q)};if(this.on("option:"+q,(Z)=>{let H=`error: option '${$.flags}' argument '${Z}' is invalid.`;X(Z,H,"cli")}),$.envVar)this.on("optionEnv:"+q,(Z)=>{let H=`error: option '${$.flags}' value '${Z}' from env '${$.envVar}' is invalid.`;X(Z,H,"env")});return this}_optionEx($,q,J,X,Z){if(typeof q==="object"&&q instanceof P3)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let H=this.createOption(q,J);if(H.makeOptionMandatory(!!$.mandatory),typeof X==="function")H.default(Z).argParser(X);else if(X instanceof RegExp){let Q=X;X=(Y,G)=>{let K=Q.exec(Y);return K?K[0]:G},H.default(Z).argParser(X)}else H.default(X);return this.addOption(H)}option($,q,J,X){return this._optionEx({},$,q,J,X)}requiredOption($,q,J,X){return this._optionEx({mandatory:!0},$,q,J,X)}combineFlagAndOptionalValue($=!0){return this._combineFlagAndOptionalValue=!!$,this}allowUnknownOption($=!0){return this._allowUnknownOption=!!$,this}allowExcessArguments($=!0){return this._allowExcessArguments=!!$,this}enablePositionalOptions($=!0){return this._enablePositionalOptions=!!$,this}passThroughOptions($=!0){return this._passThroughOptions=!!$,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties($=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!$,this}getOptionValue($){if(this._storeOptionsAsProperties)return this[$];return this._optionValues[$]}setOptionValue($,q){return this.setOptionValueWithSource($,q,void 0)}setOptionValueWithSource($,q,J){if(this._storeOptionsAsProperties)this[$]=q;else this._optionValues[$]=q;return this._optionValueSources[$]=J,this}getOptionValueSource($){return this._optionValueSources[$]}getOptionValueSourceWithGlobals($){let q;return this._getCommandAndAncestors().forEach((J)=>{if(J.getOptionValueSource($)!==void 0)q=J.getOptionValueSource($)}),q}_prepareUserArgs($,q){if($!==void 0&&!Array.isArray($))throw Error("first parameter to parse must be array or undefined");if(q=q||{},$===void 0&&q.from===void 0){if(k.versions?.electron)q.from="electron";let X=k.execArgv??[];if(X.includes("-e")||X.includes("--eval")||X.includes("-p")||X.includes("--print"))q.from="eval"}if($===void 0)$=k.argv;this.rawArgs=$.slice();let J;switch(q.from){case void 0:case"node":this._scriptPath=$[1],J=$.slice(2);break;case"electron":if(k.defaultApp)this._scriptPath=$[1],J=$.slice(2);else J=$.slice(1);break;case"user":J=$.slice(0);break;case"eval":J=$.slice(1);break;default:throw Error(`unexpected parse option { from: '${q.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",J}parse($,q){this._prepareForParse();let J=this._prepareUserArgs($,q);return this._parseCommand([],J),this}async parseAsync($,q){this._prepareForParse();let J=this._prepareUserArgs($,q);return await this._parseCommand([],J),this}_prepareForParse(){if(this._savedState===null)this.saveStateBeforeParse();else this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
18
- - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable($,q,J){if(F0.existsSync($))return;let X=q?`searched for local subcommand relative to directory '${q}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",Z=`'${$}' does not exist
14
+ (Did you mean ${X[0]}?)`;return""}SX.suggestSimilar=hX});var w3=A((dX)=>{var gX=m("node:events").EventEmitter,K2=m("node:child_process"),Q1=m("node:path"),M0=m("node:fs"),k=m("node:process"),{Argument:cX,humanReadableArgName:mX}=j0(),{CommanderError:U2}=q0(),{Help:uX,stripColor:pX}=Y2(),{Option:j3,DualOptions:lX}=G2(),{suggestSimilar:M3}=x3();class z2 extends gX{constructor($){super();this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=$||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:(q)=>k.stdout.write(q),writeErr:(q)=>k.stderr.write(q),outputError:(q,J)=>J(q),getOutHelpWidth:()=>k.stdout.isTTY?k.stdout.columns:void 0,getErrHelpWidth:()=>k.stderr.isTTY?k.stderr.columns:void 0,getOutHasColors:()=>B2()??(k.stdout.isTTY&&k.stdout.hasColors?.()),getErrHasColors:()=>B2()??(k.stderr.isTTY&&k.stderr.hasColors?.()),stripColor:(q)=>pX(q)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings($){return this._outputConfiguration=$._outputConfiguration,this._helpOption=$._helpOption,this._helpCommand=$._helpCommand,this._helpConfiguration=$._helpConfiguration,this._exitCallback=$._exitCallback,this._storeOptionsAsProperties=$._storeOptionsAsProperties,this._combineFlagAndOptionalValue=$._combineFlagAndOptionalValue,this._allowExcessArguments=$._allowExcessArguments,this._enablePositionalOptions=$._enablePositionalOptions,this._showHelpAfterError=$._showHelpAfterError,this._showSuggestionAfterError=$._showSuggestionAfterError,this}_getCommandAndAncestors(){let $=[];for(let q=this;q;q=q.parent)$.push(q);return $}command($,q,J){let X=q,Z=J;if(typeof X==="object"&&X!==null)Z=X,X=null;Z=Z||{};let[,H,Q]=$.match(/([^ ]+) *(.*)/),Y=this.createCommand(H);if(X)Y.description(X),Y._executableHandler=!0;if(Z.isDefault)this._defaultCommandName=Y._name;if(Y._hidden=!!(Z.noHelp||Z.hidden),Y._executableFile=Z.executableFile||null,Q)Y.arguments(Q);if(this._registerCommand(Y),Y.parent=this,Y.copyInheritedSettings(this),X)return this;return Y}createCommand($){return new z2($)}createHelp(){return Object.assign(new uX,this.configureHelp())}configureHelp($){if($===void 0)return this._helpConfiguration;return this._helpConfiguration=$,this}configureOutput($){if($===void 0)return this._outputConfiguration;return this._outputConfiguration={...this._outputConfiguration,...$},this}showHelpAfterError($=!0){if(typeof $!=="string")$=!!$;return this._showHelpAfterError=$,this}showSuggestionAfterError($=!0){return this._showSuggestionAfterError=!!$,this}addCommand($,q){if(!$._name)throw Error(`Command passed to .addCommand() must have a name
15
+ - specify the name in Command constructor or using .name()`);if(q=q||{},q.isDefault)this._defaultCommandName=$._name;if(q.noHelp||q.hidden)$._hidden=!0;return this._registerCommand($),$.parent=this,$._checkForBrokenPassThrough(),this}createArgument($,q){return new cX($,q)}argument($,q,J,X){let Z=this.createArgument($,q);if(typeof J==="function")Z.default(X).argParser(J);else Z.default(J);return this.addArgument(Z),this}arguments($){return $.trim().split(/ +/).forEach((q)=>{this.argument(q)}),this}addArgument($){let q=this.registeredArguments.slice(-1)[0];if(q?.variadic)throw Error(`only the last argument can be variadic '${q.name()}'`);if($.required&&$.defaultValue!==void 0&&$.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${$.name()}'`);return this.registeredArguments.push($),this}helpCommand($,q){if(typeof $==="boolean"){if(this._addImplicitHelpCommand=$,$&&this._defaultCommandGroup)this._initCommandGroup(this._getHelpCommand());return this}let J=$??"help [command]",[,X,Z]=J.match(/([^ ]+) *(.*)/),H=q??"display help for command",Q=this.createCommand(X);if(Q.helpOption(!1),Z)Q.arguments(Z);if(H)Q.description(H);if(this._addImplicitHelpCommand=!0,this._helpCommand=Q,$||q)this._initCommandGroup(Q);return this}addHelpCommand($,q){if(typeof $!=="object")return this.helpCommand($,q),this;return this._addImplicitHelpCommand=!0,this._helpCommand=$,this._initCommandGroup($),this}_getHelpCommand(){if(this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))){if(this._helpCommand===void 0)this.helpCommand(void 0,void 0);return this._helpCommand}return null}hook($,q){let J=["preSubcommand","preAction","postAction"];if(!J.includes($))throw Error(`Unexpected value for event passed to hook : '${$}'.
16
+ Expecting one of '${J.join("', '")}'`);if(this._lifeCycleHooks[$])this._lifeCycleHooks[$].push(q);else this._lifeCycleHooks[$]=[q];return this}exitOverride($){if($)this._exitCallback=$;else this._exitCallback=(q)=>{if(q.code!=="commander.executeSubCommandAsync")throw q};return this}_exit($,q,J){if(this._exitCallback)this._exitCallback(new U2($,q,J));k.exit($)}action($){let q=(J)=>{let X=this.registeredArguments.length,Z=J.slice(0,X);if(this._storeOptionsAsProperties)Z[X]=this;else Z[X]=this.opts();return Z.push(this),$.apply(this,Z)};return this._actionHandler=q,this}createOption($,q){return new j3($,q)}_callParseArg($,q,J,X){try{return $.parseArg(q,J)}catch(Z){if(Z.code==="commander.invalidArgument"){let H=`${X} ${Z.message}`;this.error(H,{exitCode:Z.exitCode,code:Z.code})}throw Z}}_registerOption($){let q=$.short&&this._findOption($.short)||$.long&&this._findOption($.long);if(q){let J=$.long&&this._findOption($.long)?$.long:$.short;throw Error(`Cannot add option '${$.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${J}'
17
+ - already used by option '${q.flags}'`)}this._initOptionGroup($),this.options.push($)}_registerCommand($){let q=(X)=>{return[X.name()].concat(X.aliases())},J=q($).find((X)=>this._findCommand(X));if(J){let X=q(this._findCommand(J)).join("|"),Z=q($).join("|");throw Error(`cannot add command '${Z}' as already have command '${X}'`)}this._initCommandGroup($),this.commands.push($)}addOption($){this._registerOption($);let q=$.name(),J=$.attributeName();if($.negate){let Z=$.long.replace(/^--no-/,"--");if(!this._findOption(Z))this.setOptionValueWithSource(J,$.defaultValue===void 0?!0:$.defaultValue,"default")}else if($.defaultValue!==void 0)this.setOptionValueWithSource(J,$.defaultValue,"default");let X=(Z,H,Q)=>{if(Z==null&&$.presetArg!==void 0)Z=$.presetArg;let Y=this.getOptionValue(J);if(Z!==null&&$.parseArg)Z=this._callParseArg($,Z,Y,H);else if(Z!==null&&$.variadic)Z=$._collectValue(Z,Y);if(Z==null)if($.negate)Z=!1;else if($.isBoolean()||$.optional)Z=!0;else Z="";this.setOptionValueWithSource(J,Z,Q)};if(this.on("option:"+q,(Z)=>{let H=`error: option '${$.flags}' argument '${Z}' is invalid.`;X(Z,H,"cli")}),$.envVar)this.on("optionEnv:"+q,(Z)=>{let H=`error: option '${$.flags}' value '${Z}' from env '${$.envVar}' is invalid.`;X(Z,H,"env")});return this}_optionEx($,q,J,X,Z){if(typeof q==="object"&&q instanceof j3)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let H=this.createOption(q,J);if(H.makeOptionMandatory(!!$.mandatory),typeof X==="function")H.default(Z).argParser(X);else if(X instanceof RegExp){let Q=X;X=(Y,G)=>{let K=Q.exec(Y);return K?K[0]:G},H.default(Z).argParser(X)}else H.default(X);return this.addOption(H)}option($,q,J,X){return this._optionEx({},$,q,J,X)}requiredOption($,q,J,X){return this._optionEx({mandatory:!0},$,q,J,X)}combineFlagAndOptionalValue($=!0){return this._combineFlagAndOptionalValue=!!$,this}allowUnknownOption($=!0){return this._allowUnknownOption=!!$,this}allowExcessArguments($=!0){return this._allowExcessArguments=!!$,this}enablePositionalOptions($=!0){return this._enablePositionalOptions=!!$,this}passThroughOptions($=!0){return this._passThroughOptions=!!$,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties($=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!$,this}getOptionValue($){if(this._storeOptionsAsProperties)return this[$];return this._optionValues[$]}setOptionValue($,q){return this.setOptionValueWithSource($,q,void 0)}setOptionValueWithSource($,q,J){if(this._storeOptionsAsProperties)this[$]=q;else this._optionValues[$]=q;return this._optionValueSources[$]=J,this}getOptionValueSource($){return this._optionValueSources[$]}getOptionValueSourceWithGlobals($){let q;return this._getCommandAndAncestors().forEach((J)=>{if(J.getOptionValueSource($)!==void 0)q=J.getOptionValueSource($)}),q}_prepareUserArgs($,q){if($!==void 0&&!Array.isArray($))throw Error("first parameter to parse must be array or undefined");if(q=q||{},$===void 0&&q.from===void 0){if(k.versions?.electron)q.from="electron";let X=k.execArgv??[];if(X.includes("-e")||X.includes("--eval")||X.includes("-p")||X.includes("--print"))q.from="eval"}if($===void 0)$=k.argv;this.rawArgs=$.slice();let J;switch(q.from){case void 0:case"node":this._scriptPath=$[1],J=$.slice(2);break;case"electron":if(k.defaultApp)this._scriptPath=$[1],J=$.slice(2);else J=$.slice(1);break;case"user":J=$.slice(0);break;case"eval":J=$.slice(1);break;default:throw Error(`unexpected parse option { from: '${q.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",J}parse($,q){this._prepareForParse();let J=this._prepareUserArgs($,q);return this._parseCommand([],J),this}async parseAsync($,q){this._prepareForParse();let J=this._prepareUserArgs($,q);return await this._parseCommand([],J),this}_prepareForParse(){if(this._savedState===null)this.saveStateBeforeParse();else this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
18
+ - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable($,q,J){if(M0.existsSync($))return;let X=q?`searched for local subcommand relative to directory '${q}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",Z=`'${$}' does not exist
19
19
  - if '${J}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
20
20
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
21
- - ${X}`;throw Error(Z)}_executeSubCommand($,q){q=q.slice();let J=!1,X=[".js",".ts",".tsx",".mjs",".cjs"];function Z(K,U){let B=Q1.resolve(K,U);if(F0.existsSync(B))return B;if(X.includes(Q1.extname(U)))return;let z=X.find((L)=>F0.existsSync(`${B}${L}`));if(z)return`${B}${z}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let H=$._executableFile||`${this._name}-${$._name}`,Q=this._executableDir||"";if(this._scriptPath){let K;try{K=F0.realpathSync(this._scriptPath)}catch{K=this._scriptPath}Q=Q1.resolve(Q1.dirname(K),Q)}if(Q){let K=Z(Q,H);if(!K&&!$._executableFile&&this._scriptPath){let U=Q1.basename(this._scriptPath,Q1.extname(this._scriptPath));if(U!==this._name)K=Z(Q,`${U}-${$._name}`)}H=K||H}J=X.includes(Q1.extname(H));let Y;if(k.platform!=="win32")if(J)q.unshift(H),q=F3(k.execArgv).concat(q),Y=H2.spawn(k.argv[0],q,{stdio:"inherit"});else Y=H2.spawn(H,q,{stdio:"inherit"});else this._checkForMissingExecutable(H,Q,$._name),q.unshift(H),q=F3(k.execArgv).concat(q),Y=H2.spawn(k.execPath,q,{stdio:"inherit"});if(!Y.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((U)=>{k.on(U,()=>{if(Y.killed===!1&&Y.exitCode===null)Y.kill(U)})});let G=this._exitCallback;Y.on("close",(K)=>{if(K=K??1,!G)k.exit(K);else G(new Y2(K,"commander.executeSubCommandAsync","(close)"))}),Y.on("error",(K)=>{if(K.code==="ENOENT")this._checkForMissingExecutable(H,Q,$._name);else if(K.code==="EACCES")throw Error(`'${H}' not executable`);if(!G)k.exit(1);else{let U=new Y2(1,"commander.executeSubCommandAsync","(error)");U.nestedError=K,G(U)}}),this.runningCommand=Y}_dispatchSubcommand($,q,J){let X=this._findCommand($);if(!X)this.help({error:!0});X._prepareForParse();let Z;return Z=this._chainOrCallSubCommandHook(Z,X,"preSubcommand"),Z=this._chainOrCall(Z,()=>{if(X._executableHandler)this._executeSubCommand(X,q.concat(J));else return X._parseCommand(q,J)}),Z}_dispatchHelpCommand($){if(!$)this.help();let q=this._findCommand($);if(q&&!q._executableHandler)q.help();return this._dispatchSubcommand($,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach(($,q)=>{if($.required&&this.args[q]==null)this.missingArgument($.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let $=(J,X,Z)=>{let H=X;if(X!==null&&J.parseArg){let Q=`error: command-argument value '${X}' is invalid for argument '${J.name()}'.`;H=this._callParseArg(J,X,Z,Q)}return H};this._checkNumberOfArguments();let q=[];this.registeredArguments.forEach((J,X)=>{let Z=J.defaultValue;if(J.variadic){if(X<this.args.length){if(Z=this.args.slice(X),J.parseArg)Z=Z.reduce((H,Q)=>{return $(J,Q,H)},J.defaultValue)}else if(Z===void 0)Z=[]}else if(X<this.args.length){if(Z=this.args[X],J.parseArg)Z=$(J,Z,J.defaultValue)}q[X]=Z}),this.processedArgs=q}_chainOrCall($,q){if($?.then&&typeof $.then==="function")return $.then(()=>q());return q()}_chainOrCallHooks($,q){let J=$,X=[];if(this._getCommandAndAncestors().reverse().filter((Z)=>Z._lifeCycleHooks[q]!==void 0).forEach((Z)=>{Z._lifeCycleHooks[q].forEach((H)=>{X.push({hookedCommand:Z,callback:H})})}),q==="postAction")X.reverse();return X.forEach((Z)=>{J=this._chainOrCall(J,()=>{return Z.callback(Z.hookedCommand,this)})}),J}_chainOrCallSubCommandHook($,q,J){let X=$;if(this._lifeCycleHooks[J]!==void 0)this._lifeCycleHooks[J].forEach((Z)=>{X=this._chainOrCall(X,()=>{return Z(this,q)})});return X}_parseCommand($,q){let J=this.parseOptions(q);if(this._parseOptionsEnv(),this._parseOptionsImplied(),$=$.concat(J.operands),q=J.unknown,this.args=$.concat(q),$&&this._findCommand($[0]))return this._dispatchSubcommand($[0],$.slice(1),q);if(this._getHelpCommand()&&$[0]===this._getHelpCommand().name())return this._dispatchHelpCommand($[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(q),this._dispatchSubcommand(this._defaultCommandName,$,q);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(J.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let X=()=>{if(J.unknown.length>0)this.unknownOption(J.unknown[0])},Z=`command:${this.name()}`;if(this._actionHandler){X(),this._processArguments();let H;if(H=this._chainOrCallHooks(H,"preAction"),H=this._chainOrCall(H,()=>this._actionHandler(this.processedArgs)),this.parent)H=this._chainOrCall(H,()=>{this.parent.emit(Z,$,q)});return H=this._chainOrCallHooks(H,"postAction"),H}if(this.parent?.listenerCount(Z))X(),this._processArguments(),this.parent.emit(Z,$,q);else if($.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",$,q);if(this.listenerCount("command:*"))this.emit("command:*",$,q);else if(this.commands.length)this.unknownCommand();else X(),this._processArguments()}else if(this.commands.length)X(),this.help({error:!0});else X(),this._processArguments()}_findCommand($){if(!$)return;return this.commands.find((q)=>q._name===$||q._aliases.includes($))}_findOption($){return this.options.find((q)=>q.is($))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(($)=>{$.options.forEach((q)=>{if(q.mandatory&&$.getOptionValue(q.attributeName())===void 0)$.missingMandatoryOptionValue(q)})})}_checkForConflictingLocalOptions(){let $=this.options.filter((J)=>{let X=J.attributeName();if(this.getOptionValue(X)===void 0)return!1;return this.getOptionValueSource(X)!=="default"});$.filter((J)=>J.conflictsWith.length>0).forEach((J)=>{let X=$.find((Z)=>J.conflictsWith.includes(Z.attributeName()));if(X)this._conflictingOption(J,X)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(($)=>{$._checkForConflictingLocalOptions()})}parseOptions($){let q=[],J=[],X=q;function Z(K){return K.length>1&&K[0]==="-"}let H=(K)=>{if(!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(K))return!1;return!this._getCommandAndAncestors().some((U)=>U.options.map((B)=>B.short).some((B)=>/^-\d$/.test(B)))},Q=null,Y=null,G=0;while(G<$.length||Y){let K=Y??$[G++];if(Y=null,K==="--"){if(X===J)X.push(K);X.push(...$.slice(G));break}if(Q&&(!Z(K)||H(K))){this.emit(`option:${Q.name()}`,K);continue}if(Q=null,Z(K)){let U=this._findOption(K);if(U){if(U.required){let B=$[G++];if(B===void 0)this.optionMissingArgument(U);this.emit(`option:${U.name()}`,B)}else if(U.optional){let B=null;if(G<$.length&&(!Z($[G])||H($[G])))B=$[G++];this.emit(`option:${U.name()}`,B)}else this.emit(`option:${U.name()}`);Q=U.variadic?U:null;continue}}if(K.length>2&&K[0]==="-"&&K[1]!=="-"){let U=this._findOption(`-${K[1]}`);if(U){if(U.required||U.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${U.name()}`,K.slice(2));else this.emit(`option:${U.name()}`),Y=`-${K.slice(2)}`;continue}}if(/^--[^=]+=/.test(K)){let U=K.indexOf("="),B=this._findOption(K.slice(0,U));if(B&&(B.required||B.optional)){this.emit(`option:${B.name()}`,K.slice(U+1));continue}}if(X===q&&Z(K)&&!(this.commands.length===0&&H(K)))X=J;if((this._enablePositionalOptions||this._passThroughOptions)&&q.length===0&&J.length===0){if(this._findCommand(K)){q.push(K),J.push(...$.slice(G));break}else if(this._getHelpCommand()&&K===this._getHelpCommand().name()){q.push(K,...$.slice(G));break}else if(this._defaultCommandName){J.push(K,...$.slice(G));break}}if(this._passThroughOptions){X.push(K,...$.slice(G));break}X.push(K)}return{operands:q,unknown:J}}opts(){if(this._storeOptionsAsProperties){let $={},q=this.options.length;for(let J=0;J<q;J++){let X=this.options[J].attributeName();$[X]=X===this._versionOptionName?this._version:this[X]}return $}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce(($,q)=>Object.assign($,q.opts()),{})}error($,q){if(this._outputConfiguration.outputError(`${$}
21
+ - ${X}`;throw Error(Z)}_executeSubCommand($,q){q=q.slice();let J=!1,X=[".js",".ts",".tsx",".mjs",".cjs"];function Z(K,U){let B=Q1.resolve(K,U);if(M0.existsSync(B))return B;if(X.includes(Q1.extname(U)))return;let z=X.find((W)=>M0.existsSync(`${B}${W}`));if(z)return`${B}${z}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let H=$._executableFile||`${this._name}-${$._name}`,Q=this._executableDir||"";if(this._scriptPath){let K;try{K=M0.realpathSync(this._scriptPath)}catch{K=this._scriptPath}Q=Q1.resolve(Q1.dirname(K),Q)}if(Q){let K=Z(Q,H);if(!K&&!$._executableFile&&this._scriptPath){let U=Q1.basename(this._scriptPath,Q1.extname(this._scriptPath));if(U!==this._name)K=Z(Q,`${U}-${$._name}`)}H=K||H}J=X.includes(Q1.extname(H));let Y;if(k.platform!=="win32")if(J)q.unshift(H),q=C3(k.execArgv).concat(q),Y=K2.spawn(k.argv[0],q,{stdio:"inherit"});else Y=K2.spawn(H,q,{stdio:"inherit"});else this._checkForMissingExecutable(H,Q,$._name),q.unshift(H),q=C3(k.execArgv).concat(q),Y=K2.spawn(k.execPath,q,{stdio:"inherit"});if(!Y.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((U)=>{k.on(U,()=>{if(Y.killed===!1&&Y.exitCode===null)Y.kill(U)})});let G=this._exitCallback;Y.on("close",(K)=>{if(K=K??1,!G)k.exit(K);else G(new U2(K,"commander.executeSubCommandAsync","(close)"))}),Y.on("error",(K)=>{if(K.code==="ENOENT")this._checkForMissingExecutable(H,Q,$._name);else if(K.code==="EACCES")throw Error(`'${H}' not executable`);if(!G)k.exit(1);else{let U=new U2(1,"commander.executeSubCommandAsync","(error)");U.nestedError=K,G(U)}}),this.runningCommand=Y}_dispatchSubcommand($,q,J){let X=this._findCommand($);if(!X)this.help({error:!0});X._prepareForParse();let Z;return Z=this._chainOrCallSubCommandHook(Z,X,"preSubcommand"),Z=this._chainOrCall(Z,()=>{if(X._executableHandler)this._executeSubCommand(X,q.concat(J));else return X._parseCommand(q,J)}),Z}_dispatchHelpCommand($){if(!$)this.help();let q=this._findCommand($);if(q&&!q._executableHandler)q.help();return this._dispatchSubcommand($,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach(($,q)=>{if($.required&&this.args[q]==null)this.missingArgument($.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let $=(J,X,Z)=>{let H=X;if(X!==null&&J.parseArg){let Q=`error: command-argument value '${X}' is invalid for argument '${J.name()}'.`;H=this._callParseArg(J,X,Z,Q)}return H};this._checkNumberOfArguments();let q=[];this.registeredArguments.forEach((J,X)=>{let Z=J.defaultValue;if(J.variadic){if(X<this.args.length){if(Z=this.args.slice(X),J.parseArg)Z=Z.reduce((H,Q)=>{return $(J,Q,H)},J.defaultValue)}else if(Z===void 0)Z=[]}else if(X<this.args.length){if(Z=this.args[X],J.parseArg)Z=$(J,Z,J.defaultValue)}q[X]=Z}),this.processedArgs=q}_chainOrCall($,q){if($?.then&&typeof $.then==="function")return $.then(()=>q());return q()}_chainOrCallHooks($,q){let J=$,X=[];if(this._getCommandAndAncestors().reverse().filter((Z)=>Z._lifeCycleHooks[q]!==void 0).forEach((Z)=>{Z._lifeCycleHooks[q].forEach((H)=>{X.push({hookedCommand:Z,callback:H})})}),q==="postAction")X.reverse();return X.forEach((Z)=>{J=this._chainOrCall(J,()=>{return Z.callback(Z.hookedCommand,this)})}),J}_chainOrCallSubCommandHook($,q,J){let X=$;if(this._lifeCycleHooks[J]!==void 0)this._lifeCycleHooks[J].forEach((Z)=>{X=this._chainOrCall(X,()=>{return Z(this,q)})});return X}_parseCommand($,q){let J=this.parseOptions(q);if(this._parseOptionsEnv(),this._parseOptionsImplied(),$=$.concat(J.operands),q=J.unknown,this.args=$.concat(q),$&&this._findCommand($[0]))return this._dispatchSubcommand($[0],$.slice(1),q);if(this._getHelpCommand()&&$[0]===this._getHelpCommand().name())return this._dispatchHelpCommand($[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(q),this._dispatchSubcommand(this._defaultCommandName,$,q);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(J.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let X=()=>{if(J.unknown.length>0)this.unknownOption(J.unknown[0])},Z=`command:${this.name()}`;if(this._actionHandler){X(),this._processArguments();let H;if(H=this._chainOrCallHooks(H,"preAction"),H=this._chainOrCall(H,()=>this._actionHandler(this.processedArgs)),this.parent)H=this._chainOrCall(H,()=>{this.parent.emit(Z,$,q)});return H=this._chainOrCallHooks(H,"postAction"),H}if(this.parent?.listenerCount(Z))X(),this._processArguments(),this.parent.emit(Z,$,q);else if($.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",$,q);if(this.listenerCount("command:*"))this.emit("command:*",$,q);else if(this.commands.length)this.unknownCommand();else X(),this._processArguments()}else if(this.commands.length)X(),this.help({error:!0});else X(),this._processArguments()}_findCommand($){if(!$)return;return this.commands.find((q)=>q._name===$||q._aliases.includes($))}_findOption($){return this.options.find((q)=>q.is($))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(($)=>{$.options.forEach((q)=>{if(q.mandatory&&$.getOptionValue(q.attributeName())===void 0)$.missingMandatoryOptionValue(q)})})}_checkForConflictingLocalOptions(){let $=this.options.filter((J)=>{let X=J.attributeName();if(this.getOptionValue(X)===void 0)return!1;return this.getOptionValueSource(X)!=="default"});$.filter((J)=>J.conflictsWith.length>0).forEach((J)=>{let X=$.find((Z)=>J.conflictsWith.includes(Z.attributeName()));if(X)this._conflictingOption(J,X)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(($)=>{$._checkForConflictingLocalOptions()})}parseOptions($){let q=[],J=[],X=q;function Z(K){return K.length>1&&K[0]==="-"}let H=(K)=>{if(!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(K))return!1;return!this._getCommandAndAncestors().some((U)=>U.options.map((B)=>B.short).some((B)=>/^-\d$/.test(B)))},Q=null,Y=null,G=0;while(G<$.length||Y){let K=Y??$[G++];if(Y=null,K==="--"){if(X===J)X.push(K);X.push(...$.slice(G));break}if(Q&&(!Z(K)||H(K))){this.emit(`option:${Q.name()}`,K);continue}if(Q=null,Z(K)){let U=this._findOption(K);if(U){if(U.required){let B=$[G++];if(B===void 0)this.optionMissingArgument(U);this.emit(`option:${U.name()}`,B)}else if(U.optional){let B=null;if(G<$.length&&(!Z($[G])||H($[G])))B=$[G++];this.emit(`option:${U.name()}`,B)}else this.emit(`option:${U.name()}`);Q=U.variadic?U:null;continue}}if(K.length>2&&K[0]==="-"&&K[1]!=="-"){let U=this._findOption(`-${K[1]}`);if(U){if(U.required||U.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${U.name()}`,K.slice(2));else this.emit(`option:${U.name()}`),Y=`-${K.slice(2)}`;continue}}if(/^--[^=]+=/.test(K)){let U=K.indexOf("="),B=this._findOption(K.slice(0,U));if(B&&(B.required||B.optional)){this.emit(`option:${B.name()}`,K.slice(U+1));continue}}if(X===q&&Z(K)&&!(this.commands.length===0&&H(K)))X=J;if((this._enablePositionalOptions||this._passThroughOptions)&&q.length===0&&J.length===0){if(this._findCommand(K)){q.push(K),J.push(...$.slice(G));break}else if(this._getHelpCommand()&&K===this._getHelpCommand().name()){q.push(K,...$.slice(G));break}else if(this._defaultCommandName){J.push(K,...$.slice(G));break}}if(this._passThroughOptions){X.push(K,...$.slice(G));break}X.push(K)}return{operands:q,unknown:J}}opts(){if(this._storeOptionsAsProperties){let $={},q=this.options.length;for(let J=0;J<q;J++){let X=this.options[J].attributeName();$[X]=X===this._versionOptionName?this._version:this[X]}return $}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce(($,q)=>Object.assign($,q.opts()),{})}error($,q){if(this._outputConfiguration.outputError(`${$}
22
22
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==="string")this._outputConfiguration.writeErr(`${this._showHelpAfterError}
23
23
  `);else if(this._showHelpAfterError)this._outputConfiguration.writeErr(`
24
- `),this.outputHelp({error:!0});let J=q||{},X=J.exitCode||1,Z=J.code||"commander.error";this._exit(X,Z,$)}_parseOptionsEnv(){this.options.forEach(($)=>{if($.envVar&&$.envVar in k.env){let q=$.attributeName();if(this.getOptionValue(q)===void 0||["default","config","env"].includes(this.getOptionValueSource(q)))if($.required||$.optional)this.emit(`optionEnv:${$.name()}`,k.env[$.envVar]);else this.emit(`optionEnv:${$.name()}`)}})}_parseOptionsImplied(){let $=new gX(this.options),q=(J)=>{return this.getOptionValue(J)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(J))};this.options.filter((J)=>J.implied!==void 0&&q(J.attributeName())&&$.valueFromOption(this.getOptionValue(J.attributeName()),J)).forEach((J)=>{Object.keys(J.implied).filter((X)=>!q(X)).forEach((X)=>{this.setOptionValueWithSource(X,J.implied[X],"implied")})})}missingArgument($){let q=`error: missing required argument '${$}'`;this.error(q,{code:"commander.missingArgument"})}optionMissingArgument($){let q=`error: option '${$.flags}' argument missing`;this.error(q,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue($){let q=`error: required option '${$.flags}' not specified`;this.error(q,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption($,q){let J=(H)=>{let Q=H.attributeName(),Y=this.getOptionValue(Q),G=this.options.find((U)=>U.negate&&Q===U.attributeName()),K=this.options.find((U)=>!U.negate&&Q===U.attributeName());if(G&&(G.presetArg===void 0&&Y===!1||G.presetArg!==void 0&&Y===G.presetArg))return G;return K||H},X=(H)=>{let Q=J(H),Y=Q.attributeName();if(this.getOptionValueSource(Y)==="env")return`environment variable '${Q.envVar}'`;return`option '${Q.flags}'`},Z=`error: ${X($)} cannot be used with ${X(q)}`;this.error(Z,{code:"commander.conflictingOption"})}unknownOption($){if(this._allowUnknownOption)return;let q="";if($.startsWith("--")&&this._showSuggestionAfterError){let X=[],Z=this;do{let H=Z.createHelp().visibleOptions(Z).filter((Q)=>Q.long).map((Q)=>Q.long);X=X.concat(H),Z=Z.parent}while(Z&&!Z._enablePositionalOptions);q=k3($,X)}let J=`error: unknown option '${$}'${q}`;this.error(J,{code:"commander.unknownOption"})}_excessArguments($){if(this._allowExcessArguments)return;let q=this.registeredArguments.length,J=q===1?"":"s",Z=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${q} argument${J} but got ${$.length}.`;this.error(Z,{code:"commander.excessArguments"})}unknownCommand(){let $=this.args[0],q="";if(this._showSuggestionAfterError){let X=[];this.createHelp().visibleCommands(this).forEach((Z)=>{if(X.push(Z.name()),Z.alias())X.push(Z.alias())}),q=k3($,X)}let J=`error: unknown command '${$}'${q}`;this.error(J,{code:"commander.unknownCommand"})}version($,q,J){if($===void 0)return this._version;this._version=$,q=q||"-V, --version",J=J||"output the version number";let X=this.createOption(q,J);return this._versionOptionName=X.attributeName(),this._registerOption(X),this.on("option:"+X.name(),()=>{this._outputConfiguration.writeOut(`${$}
25
- `),this._exit(0,"commander.version",$)}),this}description($,q){if($===void 0&&q===void 0)return this._description;if(this._description=$,q)this._argsDescription=q;return this}summary($){if($===void 0)return this._summary;return this._summary=$,this}alias($){if($===void 0)return this._aliases[0];let q=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)q=this.commands[this.commands.length-1];if($===q._name)throw Error("Command alias can't be the same as its name");let J=this.parent?._findCommand($);if(J){let X=[J.name()].concat(J.aliases()).join("|");throw Error(`cannot add alias '${$}' to command '${this.name()}' as already have command '${X}'`)}return q._aliases.push($),this}aliases($){if($===void 0)return this._aliases;return $.forEach((q)=>this.alias(q)),this}usage($){if($===void 0){if(this._usage)return this._usage;let q=this.registeredArguments.map((J)=>{return hX(J)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?q:[]).join(" ")}return this._usage=$,this}name($){if($===void 0)return this._name;return this._name=$,this}helpGroup($){if($===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=$,this}commandsGroup($){if($===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=$,this}optionsGroup($){if($===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=$,this}_initOptionGroup($){if(this._defaultOptionGroup&&!$.helpGroupHeading)$.helpGroup(this._defaultOptionGroup)}_initCommandGroup($){if(this._defaultCommandGroup&&!$.helpGroup())$.helpGroup(this._defaultCommandGroup)}nameFromFilename($){return this._name=Q1.basename($,Q1.extname($)),this}executableDir($){if($===void 0)return this._executableDir;return this._executableDir=$,this}helpInformation($){let q=this.createHelp(),J=this._getOutputContext($);q.prepareContext({error:J.error,helpWidth:J.helpWidth,outputHasColors:J.hasColors});let X=q.formatHelp(this,q);if(J.hasColors)return X;return this._outputConfiguration.stripColor(X)}_getOutputContext($){$=$||{};let q=!!$.error,J,X,Z;if(q)J=(Q)=>this._outputConfiguration.writeErr(Q),X=this._outputConfiguration.getErrHasColors(),Z=this._outputConfiguration.getErrHelpWidth();else J=(Q)=>this._outputConfiguration.writeOut(Q),X=this._outputConfiguration.getOutHasColors(),Z=this._outputConfiguration.getOutHelpWidth();return{error:q,write:(Q)=>{if(!X)Q=this._outputConfiguration.stripColor(Q);return J(Q)},hasColors:X,helpWidth:Z}}outputHelp($){let q;if(typeof $==="function")q=$,$=void 0;let J=this._getOutputContext($),X={error:J.error,write:J.write,command:this};this._getCommandAndAncestors().reverse().forEach((H)=>H.emit("beforeAllHelp",X)),this.emit("beforeHelp",X);let Z=this.helpInformation({error:J.error});if(q){if(Z=q(Z),typeof Z!=="string"&&!Buffer.isBuffer(Z))throw Error("outputHelp callback must return a string or a Buffer")}if(J.write(Z),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",X),this._getCommandAndAncestors().forEach((H)=>H.emit("afterAllHelp",X))}helpOption($,q){if(typeof $==="boolean"){if($){if(this._helpOption===null)this._helpOption=void 0;if(this._defaultOptionGroup)this._initOptionGroup(this._getHelpOption())}else this._helpOption=null;return this}if(this._helpOption=this.createOption($??"-h, --help",q??"display help for command"),$||q)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption($){return this._helpOption=$,this._initOptionGroup($),this}help($){this.outputHelp($);let q=Number(k.exitCode??0);if(q===0&&$&&typeof $!=="function"&&$.error)q=1;this._exit(q,"commander.help","(outputHelp)")}addHelpText($,q){let J=["beforeAll","before","after","afterAll"];if(!J.includes($))throw Error(`Unexpected value for position to addHelpText.
24
+ `),this.outputHelp({error:!0});let J=q||{},X=J.exitCode||1,Z=J.code||"commander.error";this._exit(X,Z,$)}_parseOptionsEnv(){this.options.forEach(($)=>{if($.envVar&&$.envVar in k.env){let q=$.attributeName();if(this.getOptionValue(q)===void 0||["default","config","env"].includes(this.getOptionValueSource(q)))if($.required||$.optional)this.emit(`optionEnv:${$.name()}`,k.env[$.envVar]);else this.emit(`optionEnv:${$.name()}`)}})}_parseOptionsImplied(){let $=new lX(this.options),q=(J)=>{return this.getOptionValue(J)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(J))};this.options.filter((J)=>J.implied!==void 0&&q(J.attributeName())&&$.valueFromOption(this.getOptionValue(J.attributeName()),J)).forEach((J)=>{Object.keys(J.implied).filter((X)=>!q(X)).forEach((X)=>{this.setOptionValueWithSource(X,J.implied[X],"implied")})})}missingArgument($){let q=`error: missing required argument '${$}'`;this.error(q,{code:"commander.missingArgument"})}optionMissingArgument($){let q=`error: option '${$.flags}' argument missing`;this.error(q,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue($){let q=`error: required option '${$.flags}' not specified`;this.error(q,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption($,q){let J=(H)=>{let Q=H.attributeName(),Y=this.getOptionValue(Q),G=this.options.find((U)=>U.negate&&Q===U.attributeName()),K=this.options.find((U)=>!U.negate&&Q===U.attributeName());if(G&&(G.presetArg===void 0&&Y===!1||G.presetArg!==void 0&&Y===G.presetArg))return G;return K||H},X=(H)=>{let Q=J(H),Y=Q.attributeName();if(this.getOptionValueSource(Y)==="env")return`environment variable '${Q.envVar}'`;return`option '${Q.flags}'`},Z=`error: ${X($)} cannot be used with ${X(q)}`;this.error(Z,{code:"commander.conflictingOption"})}unknownOption($){if(this._allowUnknownOption)return;let q="";if($.startsWith("--")&&this._showSuggestionAfterError){let X=[],Z=this;do{let H=Z.createHelp().visibleOptions(Z).filter((Q)=>Q.long).map((Q)=>Q.long);X=X.concat(H),Z=Z.parent}while(Z&&!Z._enablePositionalOptions);q=M3($,X)}let J=`error: unknown option '${$}'${q}`;this.error(J,{code:"commander.unknownOption"})}_excessArguments($){if(this._allowExcessArguments)return;let q=this.registeredArguments.length,J=q===1?"":"s",Z=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${q} argument${J} but got ${$.length}.`;this.error(Z,{code:"commander.excessArguments"})}unknownCommand(){let $=this.args[0],q="";if(this._showSuggestionAfterError){let X=[];this.createHelp().visibleCommands(this).forEach((Z)=>{if(X.push(Z.name()),Z.alias())X.push(Z.alias())}),q=M3($,X)}let J=`error: unknown command '${$}'${q}`;this.error(J,{code:"commander.unknownCommand"})}version($,q,J){if($===void 0)return this._version;this._version=$,q=q||"-V, --version",J=J||"output the version number";let X=this.createOption(q,J);return this._versionOptionName=X.attributeName(),this._registerOption(X),this.on("option:"+X.name(),()=>{this._outputConfiguration.writeOut(`${$}
25
+ `),this._exit(0,"commander.version",$)}),this}description($,q){if($===void 0&&q===void 0)return this._description;if(this._description=$,q)this._argsDescription=q;return this}summary($){if($===void 0)return this._summary;return this._summary=$,this}alias($){if($===void 0)return this._aliases[0];let q=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)q=this.commands[this.commands.length-1];if($===q._name)throw Error("Command alias can't be the same as its name");let J=this.parent?._findCommand($);if(J){let X=[J.name()].concat(J.aliases()).join("|");throw Error(`cannot add alias '${$}' to command '${this.name()}' as already have command '${X}'`)}return q._aliases.push($),this}aliases($){if($===void 0)return this._aliases;return $.forEach((q)=>this.alias(q)),this}usage($){if($===void 0){if(this._usage)return this._usage;let q=this.registeredArguments.map((J)=>{return mX(J)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?q:[]).join(" ")}return this._usage=$,this}name($){if($===void 0)return this._name;return this._name=$,this}helpGroup($){if($===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=$,this}commandsGroup($){if($===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=$,this}optionsGroup($){if($===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=$,this}_initOptionGroup($){if(this._defaultOptionGroup&&!$.helpGroupHeading)$.helpGroup(this._defaultOptionGroup)}_initCommandGroup($){if(this._defaultCommandGroup&&!$.helpGroup())$.helpGroup(this._defaultCommandGroup)}nameFromFilename($){return this._name=Q1.basename($,Q1.extname($)),this}executableDir($){if($===void 0)return this._executableDir;return this._executableDir=$,this}helpInformation($){let q=this.createHelp(),J=this._getOutputContext($);q.prepareContext({error:J.error,helpWidth:J.helpWidth,outputHasColors:J.hasColors});let X=q.formatHelp(this,q);if(J.hasColors)return X;return this._outputConfiguration.stripColor(X)}_getOutputContext($){$=$||{};let q=!!$.error,J,X,Z;if(q)J=(Q)=>this._outputConfiguration.writeErr(Q),X=this._outputConfiguration.getErrHasColors(),Z=this._outputConfiguration.getErrHelpWidth();else J=(Q)=>this._outputConfiguration.writeOut(Q),X=this._outputConfiguration.getOutHasColors(),Z=this._outputConfiguration.getOutHelpWidth();return{error:q,write:(Q)=>{if(!X)Q=this._outputConfiguration.stripColor(Q);return J(Q)},hasColors:X,helpWidth:Z}}outputHelp($){let q;if(typeof $==="function")q=$,$=void 0;let J=this._getOutputContext($),X={error:J.error,write:J.write,command:this};this._getCommandAndAncestors().reverse().forEach((H)=>H.emit("beforeAllHelp",X)),this.emit("beforeHelp",X);let Z=this.helpInformation({error:J.error});if(q){if(Z=q(Z),typeof Z!=="string"&&!Buffer.isBuffer(Z))throw Error("outputHelp callback must return a string or a Buffer")}if(J.write(Z),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",X),this._getCommandAndAncestors().forEach((H)=>H.emit("afterAllHelp",X))}helpOption($,q){if(typeof $==="boolean"){if($){if(this._helpOption===null)this._helpOption=void 0;if(this._defaultOptionGroup)this._initOptionGroup(this._getHelpOption())}else this._helpOption=null;return this}if(this._helpOption=this.createOption($??"-h, --help",q??"display help for command"),$||q)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption($){return this._helpOption=$,this._initOptionGroup($),this}help($){this.outputHelp($);let q=Number(k.exitCode??0);if(q===0&&$&&typeof $!=="function"&&$.error)q=1;this._exit(q,"commander.help","(outputHelp)")}addHelpText($,q){let J=["beforeAll","before","after","afterAll"];if(!J.includes($))throw Error(`Unexpected value for position to addHelpText.
26
26
  Expecting one of '${J.join("', '")}'`);let X=`${$}Help`;return this.on(X,(Z)=>{let H;if(typeof q==="function")H=q({error:Z.error,command:Z.command});else H=q;if(H)Z.write(`${H}
27
- `)}),this}_outputHelpIfRequested($){let q=this._getHelpOption();if(q&&$.find((X)=>q.is(X)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function F3($){return $.map((q)=>{if(!q.startsWith("--inspect"))return q;let J,X="127.0.0.1",Z="9229",H;if((H=q.match(/^(--inspect(-brk)?)$/))!==null)J=H[1];else if((H=q.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(J=H[1],/^\d+$/.test(H[3]))Z=H[3];else X=H[3];else if((H=q.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)J=H[1],X=H[3],Z=H[4];if(J&&Z!=="0")return`${J}=${X}:${parseInt(Z)+1}`;return q})}function G2(){if(k.env.NO_COLOR||k.env.FORCE_COLOR==="0"||k.env.FORCE_COLOR==="false")return!1;if(k.env.FORCE_COLOR||k.env.CLICOLOR_FORCE!==void 0)return!0;return}cX.Command=K2;cX.useColor=G2});var w3=A((dX)=>{var{Argument:x3}=k0(),{Command:U2}=j3(),{CommanderError:pX,InvalidArgumentError:M3}=e1(),{Help:lX}=Z2(),{Option:C3}=Q2();dX.program=new U2;dX.createCommand=($)=>new U2($);dX.createOption=($,q)=>new C3($,q);dX.createArgument=($,q)=>new x3($,q);dX.Command=U2;dX.Option=C3;dX.Argument=x3;dX.Help=lX;dX.CommanderError=pX;dX.InvalidArgumentError=M3;dX.InvalidOptionArgumentError=M3});var W6=A((LV,V6)=>{V6.exports=L6;L6.sync=XQ;var B6=m("fs");function JQ($,q){var J=q.pathExt!==void 0?q.pathExt:process.env.PATHEXT;if(!J)return!0;if(J=J.split(";"),J.indexOf("")!==-1)return!0;for(var X=0;X<J.length;X++){var Z=J[X].toLowerCase();if(Z&&$.substr(-Z.length).toLowerCase()===Z)return!0}return!1}function z6($,q,J){if(!$.isSymbolicLink()&&!$.isFile())return!1;return JQ(q,J)}function L6($,q,J){B6.stat($,function(X,Z){J(X,X?!1:z6(Z,$,q))})}function XQ($,q){return z6(B6.statSync($),$,q)}});var k6=A((VV,P6)=>{P6.exports=R6;R6.sync=ZQ;var _6=m("fs");function R6($,q,J){_6.stat($,function(X,Z){J(X,X?!1:T6(Z,q))})}function ZQ($,q){return T6(_6.statSync($),q)}function T6($,q){return $.isFile()&&QQ($,q)}function QQ($,q){var{mode:J,uid:X,gid:Z}=$,H=q.uid!==void 0?q.uid:process.getuid&&process.getuid(),Q=q.gid!==void 0?q.gid:process.getgid&&process.getgid(),Y=parseInt("100",8),G=parseInt("010",8),K=parseInt("001",8),U=Y|G,B=J&K||J&G&&Z===Q||J&Y&&X===H||J&U&&H===0;return B}});var j6=A((_V,F6)=>{var WV=m("fs"),f0;if(process.platform==="win32"||global.TESTING_WINDOWS)f0=W6();else f0=k6();F6.exports=x2;x2.sync=HQ;function x2($,q,J){if(typeof q==="function")J=q,q={};if(!J){if(typeof Promise!=="function")throw TypeError("callback not provided");return new Promise(function(X,Z){x2($,q||{},function(H,Q){if(H)Z(H);else X(Q)})})}f0($,q||{},function(X,Z){if(X){if(X.code==="EACCES"||q&&q.ignoreErrors)X=null,Z=!1}J(X,Z)})}function HQ($,q){try{return f0.sync($,q||{})}catch(J){if(q&&q.ignoreErrors||J.code==="EACCES")return!1;else throw J}}});var E6=A((RV,A6)=>{var h1=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",x6=m("path"),YQ=h1?";":":",M6=j6(),C6=($)=>Object.assign(Error(`not found: ${$}`),{code:"ENOENT"}),w6=($,q)=>{let J=q.colon||YQ,X=$.match(/\//)||h1&&$.match(/\\/)?[""]:[...h1?[process.cwd()]:[],...(q.path||process.env.PATH||"").split(J)],Z=h1?q.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",H=h1?Z.split(J):[""];if(h1){if($.indexOf(".")!==-1&&H[0]!=="")H.unshift("")}return{pathEnv:X,pathExt:H,pathExtExe:Z}},I6=($,q,J)=>{if(typeof q==="function")J=q,q={};if(!q)q={};let{pathEnv:X,pathExt:Z,pathExtExe:H}=w6($,q),Q=[],Y=(K)=>new Promise((U,B)=>{if(K===X.length)return q.all&&Q.length?U(Q):B(C6($));let z=X[K],L=/^".*"$/.test(z)?z.slice(1,-1):z,_=x6.join(L,$),P=!L&&/^\.[\\\/]/.test($)?$.slice(0,2)+_:_;U(G(P,K,0))}),G=(K,U,B)=>new Promise((z,L)=>{if(B===Z.length)return z(Y(U+1));let _=Z[B];M6(K+_,{pathExt:H},(P,M)=>{if(!P&&M)if(q.all)Q.push(K+_);else return z(K+_);return z(G(K,U,B+1))})});return J?Y(0).then((K)=>J(null,K),J):Y(0)},GQ=($,q)=>{q=q||{};let{pathEnv:J,pathExt:X,pathExtExe:Z}=w6($,q),H=[];for(let Q=0;Q<J.length;Q++){let Y=J[Q],G=/^".*"$/.test(Y)?Y.slice(1,-1):Y,K=x6.join(G,$),U=!G&&/^\.[\\\/]/.test($)?$.slice(0,2)+K:K;for(let B=0;B<X.length;B++){let z=U+X[B];try{if(M6.sync(z,{pathExt:Z}))if(q.all)H.push(z);else return z}catch(L){}}}if(q.all&&H.length)return H;if(q.nothrow)return null;throw C6($)};A6.exports=I6;I6.sync=GQ});var O6=A((TV,M2)=>{var y6=($={})=>{let q=$.env||process.env;if(($.platform||process.platform)!=="win32")return"PATH";return Object.keys(q).reverse().find((X)=>X.toUpperCase()==="PATH")||"Path"};M2.exports=y6;M2.exports.default=y6});var f6=A((PV,v6)=>{var N6=m("path"),KQ=E6(),UQ=O6();function D6($,q){let J=$.options.env||process.env,X=process.cwd(),Z=$.options.cwd!=null,H=Z&&process.chdir!==void 0&&!process.chdir.disabled;if(H)try{process.chdir($.options.cwd)}catch(Y){}let Q;try{Q=KQ.sync($.command,{path:J[UQ({env:J})],pathExt:q?N6.delimiter:void 0})}catch(Y){}finally{if(H)process.chdir(X)}if(Q)Q=N6.resolve(Z?$.options.cwd:"",Q);return Q}function BQ($){return D6($)||D6($,!0)}v6.exports=BQ});var h6=A((VQ,w2)=>{var C2=/([()\][%!^"`<>&|;, *?])/g;function zQ($){return $=$.replace(C2,"^$1"),$}function LQ($,q){if($=`${$}`,$=$.replace(/(?=(\\+?)?)\1"/g,"$1$1\\\""),$=$.replace(/(?=(\\+?)?)\1$/,"$1$1"),$=`"${$}"`,$=$.replace(C2,"^$1"),q)$=$.replace(C2,"^$1");return $}VQ.command=zQ;VQ.argument=LQ});var b6=A((kV,S6)=>{S6.exports=/^#!(.*)/});var c6=A((FV,g6)=>{var RQ=b6();g6.exports=($="")=>{let q=$.match(RQ);if(!q)return null;let[J,X]=q[0].replace(/#! ?/,"").split(" "),Z=J.split("/").pop();if(Z==="env")return X;return X?`${Z} ${X}`:Z}});var u6=A((jV,m6)=>{var I2=m("fs"),TQ=c6();function PQ($){let J=Buffer.alloc(150),X;try{X=I2.openSync($,"r"),I2.readSync(X,J,0,150,0),I2.closeSync(X)}catch(Z){}return TQ(J.toString())}m6.exports=PQ});var i6=A((xV,d6)=>{var kQ=m("path"),p6=f6(),l6=h6(),FQ=u6(),jQ=process.platform==="win32",xQ=/\.(?:com|exe)$/i,MQ=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function CQ($){$.file=p6($);let q=$.file&&FQ($.file);if(q)return $.args.unshift($.file),$.command=q,p6($);return $.file}function wQ($){if(!jQ)return $;let q=CQ($),J=!xQ.test(q);if($.options.forceShell||J){let X=MQ.test(q);$.command=kQ.normalize($.command),$.command=l6.command($.command),$.args=$.args.map((H)=>l6.argument(H,X));let Z=[$.command].concat($.args).join(" ");$.args=["/d","/s","/c",`"${Z}"`],$.command=process.env.comspec||"cmd.exe",$.options.windowsVerbatimArguments=!0}return $}function IQ($,q,J){if(q&&!Array.isArray(q))J=q,q=null;q=q?q.slice(0):[],J=Object.assign({},J);let X={command:$,args:q,options:J,file:void 0,original:{command:$,args:q}};return J.shell?X:wQ(X)}d6.exports=IQ});var t6=A((MV,a6)=>{var A2=process.platform==="win32";function E2($,q){return Object.assign(Error(`${q} ${$.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${q} ${$.command}`,path:$.command,spawnargs:$.args})}function AQ($,q){if(!A2)return;let J=$.emit;$.emit=function(X,Z){if(X==="exit"){let H=n6(Z,q);if(H)return J.call($,"error",H)}return J.apply($,arguments)}}function n6($,q){if(A2&&$===1&&!q.file)return E2(q.original,"spawn");return null}function EQ($,q){if(A2&&$===1&&!q.file)return E2(q.original,"spawnSync");return null}a6.exports={hookChildProcess:AQ,verifyENOENT:n6,verifyENOENTSync:EQ,notFoundError:E2}});var s6=A((CV,S1)=>{var o6=m("child_process"),y2=i6(),O2=t6();function r6($,q,J){let X=y2($,q,J),Z=o6.spawn(X.command,X.args,X.options);return O2.hookChildProcess(Z,X),Z}function yQ($,q,J){let X=y2($,q,J),Z=o6.spawnSync(X.command,X.args,X.options);return Z.error=Z.error||O2.verifyENOENTSync(Z.status,X),Z}S1.exports=r6;S1.exports.spawn=r6;S1.exports.sync=yQ;S1.exports._parse=y2;S1.exports._enoent=O2});var d4=A((JM,qJ)=>{var l4={to($,q){if(!q)return`\x1B[${$+1}G`;return`\x1B[${q+1};${$+1}H`},move($,q){let J="";if($<0)J+=`\x1B[${-$}D`;else if($>0)J+=`\x1B[${$}C`;if(q<0)J+=`\x1B[${-q}A`;else if(q>0)J+=`\x1B[${q}B`;return J},up:($=1)=>`\x1B[${$}A`,down:($=1)=>`\x1B[${$}B`,forward:($=1)=>`\x1B[${$}C`,backward:($=1)=>`\x1B[${$}D`,nextLine:($=1)=>"\x1B[E".repeat($),prevLine:($=1)=>"\x1B[F".repeat($),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},gU={up:($=1)=>"\x1B[S".repeat($),down:($=1)=>"\x1B[T".repeat($)},cU={screen:"\x1B[2J",up:($=1)=>"\x1B[1J".repeat($),down:($=1)=>"\x1B[J".repeat($),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines($){let q="";for(let J=0;J<$;J++)q+=this.line+(J<$-1?l4.up():"");if($)q+=l4.left;return q}};qJ.exports={cursor:l4,scroll:gU,erase:cU,beep:"\x07"}});var y1=A((XM,i4)=>{var S$=process||{},JJ=S$.argv||[],h$=S$.env||{},mU=!(!!h$.NO_COLOR||JJ.includes("--no-color"))&&(!!h$.FORCE_COLOR||JJ.includes("--color")||S$.platform==="win32"||(S$.stdout||{}).isTTY&&h$.TERM!=="dumb"||!!h$.CI),uU=($,q,J=$)=>(X)=>{let Z=""+X,H=Z.indexOf(q,$.length);return~H?$+pU(Z,q,J,H)+q:$+Z+q},pU=($,q,J,X)=>{let Z="",H=0;do Z+=$.substring(H,X)+J,H=X+q.length,X=$.indexOf(q,H);while(~X);return Z+$.substring(H)},XJ=($=mU)=>{let q=$?uU:()=>String;return{isColorSupported:$,reset:q("\x1B[0m","\x1B[0m"),bold:q("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:q("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:q("\x1B[3m","\x1B[23m"),underline:q("\x1B[4m","\x1B[24m"),inverse:q("\x1B[7m","\x1B[27m"),hidden:q("\x1B[8m","\x1B[28m"),strikethrough:q("\x1B[9m","\x1B[29m"),black:q("\x1B[30m","\x1B[39m"),red:q("\x1B[31m","\x1B[39m"),green:q("\x1B[32m","\x1B[39m"),yellow:q("\x1B[33m","\x1B[39m"),blue:q("\x1B[34m","\x1B[39m"),magenta:q("\x1B[35m","\x1B[39m"),cyan:q("\x1B[36m","\x1B[39m"),white:q("\x1B[37m","\x1B[39m"),gray:q("\x1B[90m","\x1B[39m"),bgBlack:q("\x1B[40m","\x1B[49m"),bgRed:q("\x1B[41m","\x1B[49m"),bgGreen:q("\x1B[42m","\x1B[49m"),bgYellow:q("\x1B[43m","\x1B[49m"),bgBlue:q("\x1B[44m","\x1B[49m"),bgMagenta:q("\x1B[45m","\x1B[49m"),bgCyan:q("\x1B[46m","\x1B[49m"),bgWhite:q("\x1B[47m","\x1B[49m"),blackBright:q("\x1B[90m","\x1B[39m"),redBright:q("\x1B[91m","\x1B[39m"),greenBright:q("\x1B[92m","\x1B[39m"),yellowBright:q("\x1B[93m","\x1B[39m"),blueBright:q("\x1B[94m","\x1B[39m"),magentaBright:q("\x1B[95m","\x1B[39m"),cyanBright:q("\x1B[96m","\x1B[39m"),whiteBright:q("\x1B[97m","\x1B[39m"),bgBlackBright:q("\x1B[100m","\x1B[49m"),bgRedBright:q("\x1B[101m","\x1B[49m"),bgGreenBright:q("\x1B[102m","\x1B[49m"),bgYellowBright:q("\x1B[103m","\x1B[49m"),bgBlueBright:q("\x1B[104m","\x1B[49m"),bgMagentaBright:q("\x1B[105m","\x1B[49m"),bgCyanBright:q("\x1B[106m","\x1B[49m"),bgWhiteBright:q("\x1B[107m","\x1B[49m")}};i4.exports=XJ();i4.exports.createColors=XJ});var I3=o(w3(),1),{program:_z,createCommand:Rz,createArgument:Tz,createOption:Pz,CommanderError:kz,InvalidArgumentError:Fz,InvalidOptionArgumentError:jz,Command:A3,Argument:xz,Option:Mz,Help:Cz}=I3.default;import{homedir as E3}from"os";import{join as y3}from"path";var O3=[{id:"esp32",name:"ESP32",description:"Original dual-core Xtensa",stable:!0},{id:"esp32s2",name:"ESP32-S2",description:"Single-core Xtensa with USB OTG",stable:!0},{id:"esp32s3",name:"ESP32-S3",description:"Dual-core Xtensa with AI acceleration",stable:!0},{id:"esp32s31",name:"ESP32-S3 (rev1)",description:"ESP32-S3 revision 1",stable:!1},{id:"esp32c2",name:"ESP32-C2",description:"Single-core RISC-V (cost-optimized)",stable:!0},{id:"esp32c3",name:"ESP32-C3",description:"Single-core RISC-V",stable:!0},{id:"esp32c5",name:"ESP32-C5",description:"RISC-V with WiFi 6",stable:!1},{id:"esp32c6",name:"ESP32-C6",description:"RISC-V with WiFi 6 & 802.15.4",stable:!0},{id:"esp32c61",name:"ESP32-C61",description:"ESP32-C6 variant",stable:!1},{id:"esp32h2",name:"ESP32-H2",description:"RISC-V with 802.15.4/Zigbee/Thread",stable:!0},{id:"esp32h21",name:"ESP32-H21",description:"ESP32-H2 variant",stable:!1},{id:"esp32h4",name:"ESP32-H4",description:"RISC-V 802.15.4",stable:!1},{id:"esp32p4",name:"ESP32-P4",description:"High-performance dual-core RISC-V",stable:!1}],B2=y3(E3(),"esp","esp-idf"),j0=y3(E3(),"esp"),N3="https://github.com/espressif/esp-idf.git",V1=460800,W1=115200,D3=[{value:115200,label:"115200",hint:"Slow but reliable"},{value:230400,label:"230400",hint:"Balanced"},{value:460800,label:"460800",hint:"Default - fast and stable"},{value:921600,label:"921600",hint:"Very fast (may be unstable)"},{value:1500000,label:"1500000",hint:"Maximum (native USB only)"}],v3=[{value:74880,label:"74880",hint:"ESP8266 boot messages"},{value:115200,label:"115200",hint:"Default - standard rate"},{value:230400,label:"230400",hint:"High speed logging"},{value:921600,label:"921600",hint:"Very high speed"}],z2={"10C4":{name:"Silicon Labs",chips:{EA60:"CP210x",EA70:"CP2105"}},"1A86":{name:"QinHeng Electronics",chips:{"7523":"CH340","5523":"CH341","55D3":"CH343","55D4":"CH9102"}},"0403":{name:"FTDI",chips:{"6001":"FT232R","6010":"FT2232","6011":"FT4232","6014":"FT232H"}},"303A":{name:"Espressif",chips:{"1001":"ESP32 (USB-JTAG)","1002":"ESP32 (USB-OTG)"}}},f3={zsh:".zshrc",bash:".bashrc",fish:".config/fish/config.fish"},h3="0.0.1";class S3{handlers=new Map;globalHandlers=new Set;subscribe($,q){if(!this.handlers.has($))this.handlers.set($,new Set);return this.handlers.get($).add(q),()=>{this.handlers.get($)?.delete(q)}}subscribeAll($){return this.globalHandlers.add($),()=>{this.globalHandlers.delete($)}}emit($,q){let J={type:q.type,timestamp:Date.now(),operationId:$,data:q};this.handlers.get($)?.forEach((X)=>X(J)),this.globalHandlers.forEach((X)=>X(J))}cleanup($){this.handlers.delete($)}}var R=new S3;function x(){return`op_${Date.now()}_${Math.random().toString(36).slice(2,8)}`}function E($){if(typeof $!=="object"||$===null)return!1;let q=Object.getPrototypeOf($);return(q===null||q===Object.prototype||Object.getPrototypeOf(q)===null)&&!(Symbol.toStringTag in $)&&!(Symbol.iterator in $)}import{fileURLToPath as XZ}from"node:url";var D1=($,q)=>{let J=V2(ZZ($));if(typeof J!=="string")throw TypeError(`${q} must be a string or a file URL: ${J}.`);return J},ZZ=($)=>L2($)?$.toString():$,L2=($)=>typeof $!=="string"&&$&&Object.getPrototypeOf($)===String.prototype,V2=($)=>$ instanceof URL?XZ($):$;var x0=($,q=[],J={})=>{let X=D1($,"First argument"),[Z,H]=E(q)?[[],q]:[q,J];if(!Array.isArray(Z))throw TypeError(`Second argument must be either an array of arguments or an options object: ${Z}`);if(Z.some((G)=>typeof G==="object"&&G!==null))throw TypeError(`Second argument must be an array of strings: ${Z}`);let Q=Z.map(String),Y=Q.find((G)=>G.includes("\x00"));if(Y!==void 0)throw TypeError(`Arguments cannot contain null bytes ("\\0"): ${Y}`);if(!E(H))throw TypeError(`Last argument must be an options object: ${H}`);return[X,Q,H]};import{ChildProcess as BZ}from"node:child_process";import{StringDecoder as QZ}from"node:string_decoder";var{toString:b3}=Object.prototype,g3=($)=>b3.call($)==="[object ArrayBuffer]",D=($)=>b3.call($)==="[object Uint8Array]",H1=($)=>new Uint8Array($.buffer,$.byteOffset,$.byteLength),HZ=new TextEncoder,c3=($)=>HZ.encode($),YZ=new TextDecoder,M0=($)=>YZ.decode($),m3=($,q)=>{return GZ($,q).join("")},GZ=($,q)=>{if(q==="utf8"&&$.every((H)=>typeof H==="string"))return $;let J=new QZ(q),X=$.map((H)=>typeof H==="string"?c3(H):H).map((H)=>J.write(H)),Z=J.end();return Z===""?X:[...X,Z]},$0=($)=>{if($.length===1&&D($[0]))return $[0];return W2(KZ($))},KZ=($)=>$.map((q)=>typeof q==="string"?c3(q):q),W2=($)=>{let q=new Uint8Array(UZ($)),J=0;for(let X of $)q.set(X,J),J+=X.length;return q},UZ=($)=>{let q=0;for(let J of $)q+=J.length;return q};var d3=($)=>Array.isArray($)&&Array.isArray($.raw),i3=($,q)=>{let J=[];for(let[H,Q]of $.entries())J=zZ({templates:$,expressions:q,tokens:J,index:H,template:Q});if(J.length===0)throw TypeError("Template script must not be empty");let[X,...Z]=J;return[X,Z,{}]},zZ=({templates:$,expressions:q,tokens:J,index:X,template:Z})=>{if(Z===void 0)throw TypeError(`Invalid backslash sequence: ${$.raw[X]}`);let{nextTokens:H,leadingWhitespaces:Q,trailingWhitespaces:Y}=LZ(Z,$.raw[X]),G=p3(J,H,Q);if(X===q.length)return G;let K=q[X],U=Array.isArray(K)?K.map((B)=>l3(B)):[l3(K)];return p3(G,U,Y)},LZ=($,q)=>{if(q.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let J=[],X=0,Z=u3.has(q[0]);for(let Q=0,Y=0;Q<$.length;Q+=1,Y+=1){let G=q[Y];if(u3.has(G)){if(X!==Q)J.push($.slice(X,Q));X=Q+1}else if(G==="\\"){let K=q[Y+1];if(K===`
28
- `)Q-=1,Y+=1;else if(K==="u"&&q[Y+2]==="{")Y=q.indexOf("}",Y+3);else Y+=VZ[K]??1}}let H=X===$.length;if(!H)J.push($.slice(X));return{nextTokens:J,leadingWhitespaces:Z,trailingWhitespaces:H}},u3=new Set([" ","\t","\r",`
29
- `]),VZ={x:3,u:5},p3=($,q,J)=>J||$.length===0||q.length===0?[...$,...q]:[...$.slice(0,-1),`${$.at(-1)}${q[0]}`,...q.slice(1)],l3=($)=>{let q=typeof $;if(q==="string")return $;if(q==="number")return String($);if(E($)&&(("stdout"in $)||("isMaxBuffer"in $)))return WZ($);if($ instanceof BZ||Object.prototype.toString.call($)==="[object Promise]")throw TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}.");throw TypeError(`Unexpected "${q}" in template expression`)},WZ=({stdout:$})=>{if(typeof $==="string")return $;if(D($))return M0($);if($===void 0)throw TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`);throw TypeError(`Unexpected "${typeof $}" stdout in template expression`)};import{spawnSync as jG}from"node:child_process";import{debuglog as _Z}from"node:util";import _2 from"node:process";var i=($)=>C0.includes($),C0=[_2.stdin,_2.stdout,_2.stderr],l=["stdin","stdout","stderr"],w0=($)=>l[$]??`stdio[${$}]`;var a3=($)=>{let q={...$};for(let J of P2)q[J]=R2($,J);return q},R2=($,q)=>{let J=Array.from({length:RZ($)+1}),X=TZ($[q],J,q);return xZ(X,q)},RZ=({stdio:$})=>Array.isArray($)?Math.max($.length,l.length):l.length,TZ=($,q,J)=>E($)?PZ($,q,J):q.fill($),PZ=($,q,J)=>{for(let X of Object.keys($).sort(kZ))for(let Z of FZ(X,J,q))q[Z]=$[X];return q},kZ=($,q)=>n3($)<n3(q)?1:-1,n3=($)=>{if($==="stdout"||$==="stderr")return 0;return $==="all"?2:1},FZ=($,q,J)=>{if($==="ipc")return[J.length-1];let X=T2($);if(X===void 0||X===0)throw TypeError(`"${q}.${$}" is invalid.
27
+ `)}),this}_outputHelpIfRequested($){let q=this._getHelpOption();if(q&&$.find((X)=>q.is(X)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function C3($){return $.map((q)=>{if(!q.startsWith("--inspect"))return q;let J,X="127.0.0.1",Z="9229",H;if((H=q.match(/^(--inspect(-brk)?)$/))!==null)J=H[1];else if((H=q.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(J=H[1],/^\d+$/.test(H[3]))Z=H[3];else X=H[3];else if((H=q.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)J=H[1],X=H[3],Z=H[4];if(J&&Z!=="0")return`${J}=${X}:${parseInt(Z)+1}`;return q})}function B2(){if(k.env.NO_COLOR||k.env.FORCE_COLOR==="0"||k.env.FORCE_COLOR==="false")return!1;if(k.env.FORCE_COLOR||k.env.CLICOLOR_FORCE!==void 0)return!0;return}dX.Command=z2;dX.useColor=B2});var y3=A((oX)=>{var{Argument:I3}=j0(),{Command:L2}=w3(),{CommanderError:aX,InvalidArgumentError:A3}=q0(),{Help:tX}=Y2(),{Option:E3}=G2();oX.program=new L2;oX.createCommand=($)=>new L2($);oX.createOption=($,q)=>new E3($,q);oX.createArgument=($,q)=>new I3($,q);oX.Command=L2;oX.Option=E3;oX.Argument=I3;oX.Help=tX;oX.CommanderError=aX;oX.InvalidArgumentError=A3;oX.InvalidOptionArgumentError=A3});var T6=A((TW,P6)=>{P6.exports=R6;R6.sync=GQ;var V6=m("fs");function YQ($,q){var J=q.pathExt!==void 0?q.pathExt:process.env.PATHEXT;if(!J)return!0;if(J=J.split(";"),J.indexOf("")!==-1)return!0;for(var X=0;X<J.length;X++){var Z=J[X].toLowerCase();if(Z&&$.substr(-Z.length).toLowerCase()===Z)return!0}return!1}function _6($,q,J){if(!$.isSymbolicLink()&&!$.isFile())return!1;return YQ(q,J)}function R6($,q,J){V6.stat($,function(X,Z){J(X,X?!1:_6(Z,$,q))})}function GQ($,q){return _6(V6.statSync($),$,q)}});var M6=A((kW,j6)=>{j6.exports=F6;F6.sync=KQ;var k6=m("fs");function F6($,q,J){k6.stat($,function(X,Z){J(X,X?!1:x6(Z,q))})}function KQ($,q){return x6(k6.statSync($),q)}function x6($,q){return $.isFile()&&UQ($,q)}function UQ($,q){var{mode:J,uid:X,gid:Z}=$,H=q.uid!==void 0?q.uid:process.getuid&&process.getuid(),Q=q.gid!==void 0?q.gid:process.getgid&&process.getgid(),Y=parseInt("100",8),G=parseInt("010",8),K=parseInt("001",8),U=Y|G,B=J&K||J&G&&Z===Q||J&Y&&X===H||J&U&&H===0;return B}});var w6=A((xW,C6)=>{var FW=m("fs"),b0;if(process.platform==="win32"||global.TESTING_WINDOWS)b0=T6();else b0=M6();C6.exports=w2;w2.sync=BQ;function w2($,q,J){if(typeof q==="function")J=q,q={};if(!J){if(typeof Promise!=="function")throw TypeError("callback not provided");return new Promise(function(X,Z){w2($,q||{},function(H,Q){if(H)Z(H);else X(Q)})})}b0($,q||{},function(X,Z){if(X){if(X.code==="EACCES"||q&&q.ignoreErrors)X=null,Z=!1}J(X,Z)})}function BQ($,q){try{return b0.sync($,q||{})}catch(J){if(q&&q.ignoreErrors||J.code==="EACCES")return!1;else throw J}}});var D6=A((jW,N6)=>{var S1=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",I6=m("path"),zQ=S1?";":":",A6=w6(),E6=($)=>Object.assign(Error(`not found: ${$}`),{code:"ENOENT"}),y6=($,q)=>{let J=q.colon||zQ,X=$.match(/\//)||S1&&$.match(/\\/)?[""]:[...S1?[process.cwd()]:[],...(q.path||process.env.PATH||"").split(J)],Z=S1?q.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",H=S1?Z.split(J):[""];if(S1){if($.indexOf(".")!==-1&&H[0]!=="")H.unshift("")}return{pathEnv:X,pathExt:H,pathExtExe:Z}},O6=($,q,J)=>{if(typeof q==="function")J=q,q={};if(!q)q={};let{pathEnv:X,pathExt:Z,pathExtExe:H}=y6($,q),Q=[],Y=(K)=>new Promise((U,B)=>{if(K===X.length)return q.all&&Q.length?U(Q):B(E6($));let z=X[K],W=/^".*"$/.test(z)?z.slice(1,-1):z,_=I6.join(W,$),T=!W&&/^\.[\\\/]/.test($)?$.slice(0,2)+_:_;U(G(T,K,0))}),G=(K,U,B)=>new Promise((z,W)=>{if(B===Z.length)return z(Y(U+1));let _=Z[B];A6(K+_,{pathExt:H},(T,M)=>{if(!T&&M)if(q.all)Q.push(K+_);else return z(K+_);return z(G(K,U,B+1))})});return J?Y(0).then((K)=>J(null,K),J):Y(0)},LQ=($,q)=>{q=q||{};let{pathEnv:J,pathExt:X,pathExtExe:Z}=y6($,q),H=[];for(let Q=0;Q<J.length;Q++){let Y=J[Q],G=/^".*"$/.test(Y)?Y.slice(1,-1):Y,K=I6.join(G,$),U=!G&&/^\.[\\\/]/.test($)?$.slice(0,2)+K:K;for(let B=0;B<X.length;B++){let z=U+X[B];try{if(A6.sync(z,{pathExt:Z}))if(q.all)H.push(z);else return z}catch(W){}}}if(q.all&&H.length)return H;if(q.nothrow)return null;throw E6($)};N6.exports=O6;O6.sync=LQ});var f6=A((MW,I2)=>{var v6=($={})=>{let q=$.env||process.env;if(($.platform||process.platform)!=="win32")return"PATH";return Object.keys(q).reverse().find((X)=>X.toUpperCase()==="PATH")||"Path"};I2.exports=v6;I2.exports.default=v6});var g6=A((CW,b6)=>{var h6=m("path"),WQ=D6(),VQ=f6();function S6($,q){let J=$.options.env||process.env,X=process.cwd(),Z=$.options.cwd!=null,H=Z&&process.chdir!==void 0&&!process.chdir.disabled;if(H)try{process.chdir($.options.cwd)}catch(Y){}let Q;try{Q=WQ.sync($.command,{path:J[VQ({env:J})],pathExt:q?h6.delimiter:void 0})}catch(Y){}finally{if(H)process.chdir(X)}if(Q)Q=h6.resolve(Z?$.options.cwd:"",Q);return Q}function _Q($){return S6($)||S6($,!0)}b6.exports=_Q});var c6=A((TQ,E2)=>{var A2=/([()\][%!^"`<>&|;, *?])/g;function RQ($){return $=$.replace(A2,"^$1"),$}function PQ($,q){if($=`${$}`,$=$.replace(/(?=(\\+?)?)\1"/g,"$1$1\\\""),$=$.replace(/(?=(\\+?)?)\1$/,"$1$1"),$=`"${$}"`,$=$.replace(A2,"^$1"),q)$=$.replace(A2,"^$1");return $}TQ.command=RQ;TQ.argument=PQ});var u6=A((wW,m6)=>{m6.exports=/^#!(.*)/});var l6=A((IW,p6)=>{var xQ=u6();p6.exports=($="")=>{let q=$.match(xQ);if(!q)return null;let[J,X]=q[0].replace(/#! ?/,"").split(" "),Z=J.split("/").pop();if(Z==="env")return X;return X?`${Z} ${X}`:Z}});var i6=A((AW,d6)=>{var y2=m("fs"),jQ=l6();function MQ($){let J=Buffer.alloc(150),X;try{X=y2.openSync($,"r"),y2.readSync(X,J,0,150,0),y2.closeSync(X)}catch(Z){}return jQ(J.toString())}d6.exports=MQ});var o6=A((EW,t6)=>{var CQ=m("path"),n6=g6(),a6=c6(),wQ=i6(),IQ=process.platform==="win32",AQ=/\.(?:com|exe)$/i,EQ=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function yQ($){$.file=n6($);let q=$.file&&wQ($.file);if(q)return $.args.unshift($.file),$.command=q,n6($);return $.file}function OQ($){if(!IQ)return $;let q=yQ($),J=!AQ.test(q);if($.options.forceShell||J){let X=EQ.test(q);$.command=CQ.normalize($.command),$.command=a6.command($.command),$.args=$.args.map((H)=>a6.argument(H,X));let Z=[$.command].concat($.args).join(" ");$.args=["/d","/s","/c",`"${Z}"`],$.command=process.env.comspec||"cmd.exe",$.options.windowsVerbatimArguments=!0}return $}function NQ($,q,J){if(q&&!Array.isArray(q))J=q,q=null;q=q?q.slice(0):[],J=Object.assign({},J);let X={command:$,args:q,options:J,file:void 0,original:{command:$,args:q}};return J.shell?X:OQ(X)}t6.exports=NQ});var e6=A((yW,s6)=>{var O2=process.platform==="win32";function N2($,q){return Object.assign(Error(`${q} ${$.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${q} ${$.command}`,path:$.command,spawnargs:$.args})}function DQ($,q){if(!O2)return;let J=$.emit;$.emit=function(X,Z){if(X==="exit"){let H=r6(Z,q);if(H)return J.call($,"error",H)}return J.apply($,arguments)}}function r6($,q){if(O2&&$===1&&!q.file)return N2(q.original,"spawn");return null}function vQ($,q){if(O2&&$===1&&!q.file)return N2(q.original,"spawnSync");return null}s6.exports={hookChildProcess:DQ,verifyENOENT:r6,verifyENOENTSync:vQ,notFoundError:N2}});var J8=A((OW,b1)=>{var $8=m("child_process"),D2=o6(),v2=e6();function q8($,q,J){let X=D2($,q,J),Z=$8.spawn(X.command,X.args,X.options);return v2.hookChildProcess(Z,X),Z}function fQ($,q,J){let X=D2($,q,J),Z=$8.spawnSync(X.command,X.args,X.options);return Z.error=Z.error||v2.verifyENOENTSync(Z.status,X),Z}b1.exports=q8;b1.exports.spawn=q8;b1.exports.sync=fQ;b1.exports._parse=D2;b1.exports._enoent=v2});var a4=A((GM,XJ)=>{var n4={to($,q){if(!q)return`\x1B[${$+1}G`;return`\x1B[${q+1};${$+1}H`},move($,q){let J="";if($<0)J+=`\x1B[${-$}D`;else if($>0)J+=`\x1B[${$}C`;if(q<0)J+=`\x1B[${-q}A`;else if(q>0)J+=`\x1B[${q}B`;return J},up:($=1)=>`\x1B[${$}A`,down:($=1)=>`\x1B[${$}B`,forward:($=1)=>`\x1B[${$}C`,backward:($=1)=>`\x1B[${$}D`,nextLine:($=1)=>"\x1B[E".repeat($),prevLine:($=1)=>"\x1B[F".repeat($),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},lU={up:($=1)=>"\x1B[S".repeat($),down:($=1)=>"\x1B[T".repeat($)},dU={screen:"\x1B[2J",up:($=1)=>"\x1B[1J".repeat($),down:($=1)=>"\x1B[J".repeat($),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines($){let q="";for(let J=0;J<$;J++)q+=this.line+(J<$-1?n4.up():"");if($)q+=n4.left;return q}};XJ.exports={cursor:n4,scroll:lU,erase:dU,beep:"\x07"}});var F1=A((KM,t4)=>{var m$=process||{},ZJ=m$.argv||[],c$=m$.env||{},iU=!(!!c$.NO_COLOR||ZJ.includes("--no-color"))&&(!!c$.FORCE_COLOR||ZJ.includes("--color")||m$.platform==="win32"||(m$.stdout||{}).isTTY&&c$.TERM!=="dumb"||!!c$.CI),nU=($,q,J=$)=>(X)=>{let Z=""+X,H=Z.indexOf(q,$.length);return~H?$+aU(Z,q,J,H)+q:$+Z+q},aU=($,q,J,X)=>{let Z="",H=0;do Z+=$.substring(H,X)+J,H=X+q.length,X=$.indexOf(q,H);while(~X);return Z+$.substring(H)},QJ=($=iU)=>{let q=$?nU:()=>String;return{isColorSupported:$,reset:q("\x1B[0m","\x1B[0m"),bold:q("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:q("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:q("\x1B[3m","\x1B[23m"),underline:q("\x1B[4m","\x1B[24m"),inverse:q("\x1B[7m","\x1B[27m"),hidden:q("\x1B[8m","\x1B[28m"),strikethrough:q("\x1B[9m","\x1B[29m"),black:q("\x1B[30m","\x1B[39m"),red:q("\x1B[31m","\x1B[39m"),green:q("\x1B[32m","\x1B[39m"),yellow:q("\x1B[33m","\x1B[39m"),blue:q("\x1B[34m","\x1B[39m"),magenta:q("\x1B[35m","\x1B[39m"),cyan:q("\x1B[36m","\x1B[39m"),white:q("\x1B[37m","\x1B[39m"),gray:q("\x1B[90m","\x1B[39m"),bgBlack:q("\x1B[40m","\x1B[49m"),bgRed:q("\x1B[41m","\x1B[49m"),bgGreen:q("\x1B[42m","\x1B[49m"),bgYellow:q("\x1B[43m","\x1B[49m"),bgBlue:q("\x1B[44m","\x1B[49m"),bgMagenta:q("\x1B[45m","\x1B[49m"),bgCyan:q("\x1B[46m","\x1B[49m"),bgWhite:q("\x1B[47m","\x1B[49m"),blackBright:q("\x1B[90m","\x1B[39m"),redBright:q("\x1B[91m","\x1B[39m"),greenBright:q("\x1B[92m","\x1B[39m"),yellowBright:q("\x1B[93m","\x1B[39m"),blueBright:q("\x1B[94m","\x1B[39m"),magentaBright:q("\x1B[95m","\x1B[39m"),cyanBright:q("\x1B[96m","\x1B[39m"),whiteBright:q("\x1B[97m","\x1B[39m"),bgBlackBright:q("\x1B[100m","\x1B[49m"),bgRedBright:q("\x1B[101m","\x1B[49m"),bgGreenBright:q("\x1B[102m","\x1B[49m"),bgYellowBright:q("\x1B[103m","\x1B[49m"),bgBlueBright:q("\x1B[104m","\x1B[49m"),bgMagentaBright:q("\x1B[105m","\x1B[49m"),bgCyanBright:q("\x1B[106m","\x1B[49m"),bgWhiteBright:q("\x1B[107m","\x1B[49m")}};t4.exports=QJ();t4.exports.createColors=QJ});var O3=n(y3(),1),{program:xz,createCommand:jz,createArgument:Mz,createOption:Cz,CommanderError:wz,InvalidArgumentError:Iz,InvalidOptionArgumentError:Az,Command:N3,Argument:Ez,Option:yz,Help:Oz}=O3.default;import{homedir as D3}from"os";import{join as v3}from"path";var f3=[{id:"esp32",name:"ESP32",description:"Original dual-core Xtensa",stable:!0},{id:"esp32s2",name:"ESP32-S2",description:"Single-core Xtensa with USB OTG",stable:!0},{id:"esp32s3",name:"ESP32-S3",description:"Dual-core Xtensa with AI acceleration",stable:!0},{id:"esp32s31",name:"ESP32-S3 (rev1)",description:"ESP32-S3 revision 1",stable:!1},{id:"esp32c2",name:"ESP32-C2",description:"Single-core RISC-V (cost-optimized)",stable:!0},{id:"esp32c3",name:"ESP32-C3",description:"Single-core RISC-V",stable:!0},{id:"esp32c5",name:"ESP32-C5",description:"RISC-V with WiFi 6",stable:!1},{id:"esp32c6",name:"ESP32-C6",description:"RISC-V with WiFi 6 & 802.15.4",stable:!0},{id:"esp32c61",name:"ESP32-C61",description:"ESP32-C6 variant",stable:!1},{id:"esp32h2",name:"ESP32-H2",description:"RISC-V with 802.15.4/Zigbee/Thread",stable:!0},{id:"esp32h21",name:"ESP32-H21",description:"ESP32-H2 variant",stable:!1},{id:"esp32h4",name:"ESP32-H4",description:"RISC-V 802.15.4",stable:!1},{id:"esp32p4",name:"ESP32-P4",description:"High-performance dual-core RISC-V",stable:!1}],W2=v3(D3(),"esp","esp-idf"),C0=v3(D3(),"esp"),h3="https://github.com/espressif/esp-idf.git",V1=460800,_1=115200,S3=[{value:115200,label:"115200",hint:"Slow but reliable"},{value:230400,label:"230400",hint:"Balanced"},{value:460800,label:"460800",hint:"Default - fast and stable"},{value:921600,label:"921600",hint:"Very fast (may be unstable)"},{value:1500000,label:"1500000",hint:"Maximum (native USB only)"}],b3=[{value:74880,label:"74880",hint:"ESP8266 boot messages"},{value:115200,label:"115200",hint:"Default - standard rate"},{value:230400,label:"230400",hint:"High speed logging"},{value:921600,label:"921600",hint:"Very high speed"}],V2={"10C4":{name:"Silicon Labs",chips:{EA60:"CP210x",EA70:"CP2105"}},"1A86":{name:"QinHeng Electronics",chips:{"7523":"CH340","5523":"CH341","55D3":"CH343","55D4":"CH9102"}},"0403":{name:"FTDI",chips:{"6001":"FT232R","6010":"FT2232","6011":"FT4232","6014":"FT232H"}},"303A":{name:"Espressif",chips:{"1001":"ESP32 (USB-JTAG)","1002":"ESP32 (USB-OTG)"}}},g3={zsh:".zshrc",bash:".bashrc",fish:".config/fish/config.fish"},c3="0.0.7";class m3{handlers=new Map;globalHandlers=new Set;subscribe($,q){if(!this.handlers.has($))this.handlers.set($,new Set);return this.handlers.get($).add(q),()=>{this.handlers.get($)?.delete(q)}}subscribeAll($){return this.globalHandlers.add($),()=>{this.globalHandlers.delete($)}}emit($,q){let J={type:q.type,timestamp:Date.now(),operationId:$,data:q};this.handlers.get($)?.forEach((X)=>X(J)),this.globalHandlers.forEach((X)=>X(J))}cleanup($){this.handlers.delete($)}}var R=new m3;function j(){return`op_${Date.now()}_${Math.random().toString(36).slice(2,8)}`}function E($){if(typeof $!=="object"||$===null)return!1;let q=Object.getPrototypeOf($);return(q===null||q===Object.prototype||Object.getPrototypeOf(q)===null)&&!(Symbol.toStringTag in $)&&!(Symbol.iterator in $)}import{fileURLToPath as GZ}from"node:url";var v1=($,q)=>{let J=R2(KZ($));if(typeof J!=="string")throw TypeError(`${q} must be a string or a file URL: ${J}.`);return J},KZ=($)=>_2($)?$.toString():$,_2=($)=>typeof $!=="string"&&$&&Object.getPrototypeOf($)===String.prototype,R2=($)=>$ instanceof URL?GZ($):$;var w0=($,q=[],J={})=>{let X=v1($,"First argument"),[Z,H]=E(q)?[[],q]:[q,J];if(!Array.isArray(Z))throw TypeError(`Second argument must be either an array of arguments or an options object: ${Z}`);if(Z.some((G)=>typeof G==="object"&&G!==null))throw TypeError(`Second argument must be an array of strings: ${Z}`);let Q=Z.map(String),Y=Q.find((G)=>G.includes("\x00"));if(Y!==void 0)throw TypeError(`Arguments cannot contain null bytes ("\\0"): ${Y}`);if(!E(H))throw TypeError(`Last argument must be an options object: ${H}`);return[X,Q,H]};import{ChildProcess as _Z}from"node:child_process";import{StringDecoder as UZ}from"node:string_decoder";var{toString:u3}=Object.prototype,p3=($)=>u3.call($)==="[object ArrayBuffer]",D=($)=>u3.call($)==="[object Uint8Array]",H1=($)=>new Uint8Array($.buffer,$.byteOffset,$.byteLength),BZ=new TextEncoder,l3=($)=>BZ.encode($),zZ=new TextDecoder,I0=($)=>zZ.decode($),d3=($,q)=>{return LZ($,q).join("")},LZ=($,q)=>{if(q==="utf8"&&$.every((H)=>typeof H==="string"))return $;let J=new UZ(q),X=$.map((H)=>typeof H==="string"?l3(H):H).map((H)=>J.write(H)),Z=J.end();return Z===""?X:[...X,Z]},J0=($)=>{if($.length===1&&D($[0]))return $[0];return P2(WZ($))},WZ=($)=>$.map((q)=>typeof q==="string"?l3(q):q),P2=($)=>{let q=new Uint8Array(VZ($)),J=0;for(let X of $)q.set(X,J),J+=X.length;return q},VZ=($)=>{let q=0;for(let J of $)q+=J.length;return q};var t3=($)=>Array.isArray($)&&Array.isArray($.raw),o3=($,q)=>{let J=[];for(let[H,Q]of $.entries())J=RZ({templates:$,expressions:q,tokens:J,index:H,template:Q});if(J.length===0)throw TypeError("Template script must not be empty");let[X,...Z]=J;return[X,Z,{}]},RZ=({templates:$,expressions:q,tokens:J,index:X,template:Z})=>{if(Z===void 0)throw TypeError(`Invalid backslash sequence: ${$.raw[X]}`);let{nextTokens:H,leadingWhitespaces:Q,trailingWhitespaces:Y}=PZ(Z,$.raw[X]),G=n3(J,H,Q);if(X===q.length)return G;let K=q[X],U=Array.isArray(K)?K.map((B)=>a3(B)):[a3(K)];return n3(G,U,Y)},PZ=($,q)=>{if(q.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let J=[],X=0,Z=i3.has(q[0]);for(let Q=0,Y=0;Q<$.length;Q+=1,Y+=1){let G=q[Y];if(i3.has(G)){if(X!==Q)J.push($.slice(X,Q));X=Q+1}else if(G==="\\"){let K=q[Y+1];if(K===`
28
+ `)Q-=1,Y+=1;else if(K==="u"&&q[Y+2]==="{")Y=q.indexOf("}",Y+3);else Y+=TZ[K]??1}}let H=X===$.length;if(!H)J.push($.slice(X));return{nextTokens:J,leadingWhitespaces:Z,trailingWhitespaces:H}},i3=new Set([" ","\t","\r",`
29
+ `]),TZ={x:3,u:5},n3=($,q,J)=>J||$.length===0||q.length===0?[...$,...q]:[...$.slice(0,-1),`${$.at(-1)}${q[0]}`,...q.slice(1)],a3=($)=>{let q=typeof $;if(q==="string")return $;if(q==="number")return String($);if(E($)&&(("stdout"in $)||("isMaxBuffer"in $)))return kZ($);if($ instanceof _Z||Object.prototype.toString.call($)==="[object Promise]")throw TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}.");throw TypeError(`Unexpected "${q}" in template expression`)},kZ=({stdout:$})=>{if(typeof $==="string")return $;if(D($))return I0($);if($===void 0)throw TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`);throw TypeError(`Unexpected "${typeof $}" stdout in template expression`)};import{spawnSync as IG}from"node:child_process";import{debuglog as FZ}from"node:util";import T2 from"node:process";var a=($)=>A0.includes($),A0=[T2.stdin,T2.stdout,T2.stderr],l=["stdin","stdout","stderr"],E0=($)=>l[$]??`stdio[${$}]`;var s3=($)=>{let q={...$};for(let J of x2)q[J]=k2($,J);return q},k2=($,q)=>{let J=Array.from({length:xZ($)+1}),X=jZ($[q],J,q);return AZ(X,q)},xZ=({stdio:$})=>Array.isArray($)?Math.max($.length,l.length):l.length,jZ=($,q,J)=>E($)?MZ($,q,J):q.fill($),MZ=($,q,J)=>{for(let X of Object.keys($).sort(CZ))for(let Z of wZ(X,J,q))q[Z]=$[X];return q},CZ=($,q)=>r3($)<r3(q)?1:-1,r3=($)=>{if($==="stdout"||$==="stderr")return 0;return $==="all"?2:1},wZ=($,q,J)=>{if($==="ipc")return[J.length-1];let X=F2($);if(X===void 0||X===0)throw TypeError(`"${q}.${$}" is invalid.
30
30
  It must be "${q}.stdout", "${q}.stderr", "${q}.all", "${q}.ipc", or "${q}.fd3", "${q}.fd4" (and so on).`);if(X>=J.length)throw TypeError(`"${q}.${$}" is invalid: that file descriptor does not exist.
31
- Please set the "stdio" option to ensure that file descriptor exists.`);return X==="all"?[1,2]:[X]},T2=($)=>{if($==="all")return $;if(l.includes($))return l.indexOf($);let q=jZ.exec($);if(q!==null)return Number(q[1])},jZ=/^fd(\d+)$/,xZ=($,q)=>$.map((J)=>J===void 0?CZ[q]:J),MZ=_Z("execa").enabled?"full":"none",CZ={lines:!1,buffer:!0,maxBuffer:1e8,verbose:MZ,stripFinalNewline:!0},P2=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],Y1=($,q)=>q==="ipc"?$.at(-1):$[q];var v1=({verbose:$},q)=>k2($,q)!=="none",f1=({verbose:$},q)=>!["none","short"].includes(k2($,q)),t3=({verbose:$},q)=>{let J=k2($,q);return I0(J)?J:void 0},k2=($,q)=>q===void 0?wZ($):Y1($,q),wZ=($)=>$.find((q)=>I0(q))??A0.findLast((q)=>$.includes(q)),I0=($)=>typeof $==="function",A0=["none","short","full"];import{inspect as aZ}from"node:util";import{platform as IZ}from"node:process";import{stripVTControlCharacters as AZ}from"node:util";var o3=($,q)=>{let J=[$,...q],X=J.join(" "),Z=J.map((H)=>vZ(r3(H))).join(" ");return{command:X,escapedCommand:Z}},q0=($)=>AZ($).split(`
32
- `).map((q)=>r3(q)).join(`
33
- `),r3=($)=>$.replaceAll(OZ,(q)=>EZ(q)),EZ=($)=>{let q=NZ[$];if(q!==void 0)return q;let J=$.codePointAt(0),X=J.toString(16);return J<=DZ?`\\u${X.padStart(4,"0")}`:`\\U${X}`},yZ=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},OZ=yZ(),NZ={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},DZ=65535,vZ=($)=>{if(fZ.test($))return $;return IZ==="win32"?`"${$.replaceAll('"','""')}"`:`'${$.replaceAll("'","'\\''")}'`},fZ=/^[\w./-]+$/;import s3 from"node:process";function F2(){let{env:$}=s3,{TERM:q,TERM_PROGRAM:J}=$;if(s3.platform!=="win32")return q!=="linux";return Boolean($.WT_SESSION)||Boolean($.TERMINUS_SUBLIME)||$.ConEmuTask==="{cmd::Cmder}"||J==="Terminus-Sublime"||J==="vscode"||q==="xterm-256color"||q==="alacritty"||q==="rxvt-unicode"||q==="rxvt-unicode-256color"||$.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var e3={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:"╱"},$6={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:"⅒"},hZ={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"},SZ={...e3,...$6},bZ={...e3,...hZ},gZ=F2(),cZ=gZ?SZ:bZ,E0=cZ,XL=Object.entries($6);import mZ from"node:tty";var uZ=mZ?.WriteStream?.prototype?.hasColors?.()??!1,T=($,q)=>{if(!uZ)return(Z)=>Z;let J=`\x1B[${$}m`,X=`\x1B[${q}m`;return(Z)=>{let H=Z+"",Q=H.indexOf(X);if(Q===-1)return J+H+X;let Y=J,G=0,U=(q===22?X:"")+J;while(Q!==-1)Y+=H.slice(G,Q)+U,G=Q+X.length,Q=H.indexOf(X,G);return Y+=H.slice(G)+X,Y}},HL=T(0,0),q6=T(1,22),YL=T(2,22),GL=T(3,23),KL=T(4,24),UL=T(53,55),BL=T(7,27),zL=T(8,28),LL=T(9,29),VL=T(30,39),WL=T(31,39),_L=T(32,39),RL=T(33,39),TL=T(34,39),PL=T(35,39),kL=T(36,39),FL=T(37,39),y0=T(90,39),jL=T(40,49),xL=T(41,49),ML=T(42,49),CL=T(43,49),wL=T(44,49),IL=T(45,49),AL=T(46,49),EL=T(47,49),yL=T(100,49),J6=T(91,39),OL=T(92,39),X6=T(93,39),NL=T(94,39),DL=T(95,39),vL=T(96,39),fL=T(97,39),hL=T(101,49),SL=T(102,49),bL=T(103,49),gL=T(104,49),cL=T(105,49),mL=T(106,49),uL=T(107,49);var H6=({type:$,message:q,timestamp:J,piped:X,commandId:Z,result:{failed:H=!1}={},options:{reject:Q=!0}})=>{let Y=pZ(J),G=lZ[$]({failed:H,reject:Q,piped:X}),K=dZ[$]({reject:Q});return`${y0(`[${Y}]`)} ${y0(`[${Z}]`)} ${K(G)} ${K(q)}`},pZ=($)=>`${O0($.getHours(),2)}:${O0($.getMinutes(),2)}:${O0($.getSeconds(),2)}.${O0($.getMilliseconds(),3)}`,O0=($,q)=>String($).padStart(q,"0"),Z6=({failed:$,reject:q})=>{if(!$)return E0.tick;return q?E0.cross:E0.warning},lZ={command:({piped:$})=>$?"|":"$",output:()=>" ",ipc:()=>"*",error:Z6,duration:Z6},Q6=($)=>$,dZ={command:()=>q6,output:()=>Q6,ipc:()=>Q6,error:({reject:$})=>$?J6:X6,duration:()=>y0};var Y6=($,q,J)=>{let X=t3(q,J);return $.map(({verboseLine:Z,verboseObject:H})=>iZ(Z,H,X)).filter((Z)=>Z!==void 0).map((Z)=>nZ(Z)).join("")},iZ=($,q,J)=>{if(J===void 0)return $;let X=J($,q);if(typeof X==="string")return X},nZ=($)=>$.endsWith(`
31
+ Please set the "stdio" option to ensure that file descriptor exists.`);return X==="all"?[1,2]:[X]},F2=($)=>{if($==="all")return $;if(l.includes($))return l.indexOf($);let q=IZ.exec($);if(q!==null)return Number(q[1])},IZ=/^fd(\d+)$/,AZ=($,q)=>$.map((J)=>J===void 0?yZ[q]:J),EZ=FZ("execa").enabled?"full":"none",yZ={lines:!1,buffer:!0,maxBuffer:1e8,verbose:EZ,stripFinalNewline:!0},x2=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],Y1=($,q)=>q==="ipc"?$.at(-1):$[q];var f1=({verbose:$},q)=>j2($,q)!=="none",h1=({verbose:$},q)=>!["none","short"].includes(j2($,q)),e3=({verbose:$},q)=>{let J=j2($,q);return y0(J)?J:void 0},j2=($,q)=>q===void 0?OZ($):Y1($,q),OZ=($)=>$.find((q)=>y0(q))??O0.findLast((q)=>$.includes(q)),y0=($)=>typeof $==="function",O0=["none","short","full"];import{inspect as eZ}from"node:util";import{platform as NZ}from"node:process";import{stripVTControlCharacters as DZ}from"node:util";var $6=($,q)=>{let J=[$,...q],X=J.join(" "),Z=J.map((H)=>gZ(q6(H))).join(" ");return{command:X,escapedCommand:Z}},X0=($)=>DZ($).split(`
32
+ `).map((q)=>q6(q)).join(`
33
+ `),q6=($)=>$.replaceAll(hZ,(q)=>vZ(q)),vZ=($)=>{let q=SZ[$];if(q!==void 0)return q;let J=$.codePointAt(0),X=J.toString(16);return J<=bZ?`\\u${X.padStart(4,"0")}`:`\\U${X}`},fZ=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},hZ=fZ(),SZ={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},bZ=65535,gZ=($)=>{if(cZ.test($))return $;return NZ==="win32"?`"${$.replaceAll('"','""')}"`:`'${$.replaceAll("'","'\\''")}'`},cZ=/^[\w./-]+$/;import J6 from"node:process";function M2(){let{env:$}=J6,{TERM:q,TERM_PROGRAM:J}=$;if(J6.platform!=="win32")return q!=="linux";return Boolean($.WT_SESSION)||Boolean($.TERMINUS_SUBLIME)||$.ConEmuTask==="{cmd::Cmder}"||J==="Terminus-Sublime"||J==="vscode"||q==="xterm-256color"||q==="alacritty"||q==="rxvt-unicode"||q==="rxvt-unicode-256color"||$.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var X6={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:"╱"},Z6={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:"⅒"},mZ={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"},uZ={...X6,...Z6},pZ={...X6,...mZ},lZ=M2(),dZ=lZ?uZ:pZ,N0=dZ,KL=Object.entries(Z6);import iZ from"node:tty";var nZ=iZ?.WriteStream?.prototype?.hasColors?.()??!1,P=($,q)=>{if(!nZ)return(Z)=>Z;let J=`\x1B[${$}m`,X=`\x1B[${q}m`;return(Z)=>{let H=Z+"",Q=H.indexOf(X);if(Q===-1)return J+H+X;let Y=J,G=0,U=(q===22?X:"")+J;while(Q!==-1)Y+=H.slice(G,Q)+U,G=Q+X.length,Q=H.indexOf(X,G);return Y+=H.slice(G)+X,Y}},zL=P(0,0),Q6=P(1,22),LL=P(2,22),WL=P(3,23),VL=P(4,24),_L=P(53,55),RL=P(7,27),PL=P(8,28),TL=P(9,29),kL=P(30,39),FL=P(31,39),xL=P(32,39),jL=P(33,39),ML=P(34,39),CL=P(35,39),wL=P(36,39),IL=P(37,39),D0=P(90,39),AL=P(40,49),EL=P(41,49),yL=P(42,49),OL=P(43,49),NL=P(44,49),DL=P(45,49),vL=P(46,49),fL=P(47,49),hL=P(100,49),H6=P(91,39),SL=P(92,39),Y6=P(93,39),bL=P(94,39),gL=P(95,39),cL=P(96,39),mL=P(97,39),uL=P(101,49),pL=P(102,49),lL=P(103,49),dL=P(104,49),iL=P(105,49),nL=P(106,49),aL=P(107,49);var U6=({type:$,message:q,timestamp:J,piped:X,commandId:Z,result:{failed:H=!1}={},options:{reject:Q=!0}})=>{let Y=aZ(J),G=tZ[$]({failed:H,reject:Q,piped:X}),K=oZ[$]({reject:Q});return`${D0(`[${Y}]`)} ${D0(`[${Z}]`)} ${K(G)} ${K(q)}`},aZ=($)=>`${v0($.getHours(),2)}:${v0($.getMinutes(),2)}:${v0($.getSeconds(),2)}.${v0($.getMilliseconds(),3)}`,v0=($,q)=>String($).padStart(q,"0"),G6=({failed:$,reject:q})=>{if(!$)return N0.tick;return q?N0.cross:N0.warning},tZ={command:({piped:$})=>$?"|":"$",output:()=>" ",ipc:()=>"*",error:G6,duration:G6},K6=($)=>$,oZ={command:()=>Q6,output:()=>K6,ipc:()=>K6,error:({reject:$})=>$?H6:Y6,duration:()=>D0};var B6=($,q,J)=>{let X=e3(q,J);return $.map(({verboseLine:Z,verboseObject:H})=>rZ(Z,H,X)).filter((Z)=>Z!==void 0).map((Z)=>sZ(Z)).join("")},rZ=($,q,J)=>{if(J===void 0)return $;let X=J($,q);if(typeof X==="string")return X},sZ=($)=>$.endsWith(`
34
34
  `)?$:`${$}
35
- `;var r=({type:$,verboseMessage:q,fdNumber:J,verboseInfo:X,result:Z})=>{let H=tZ({type:$,result:Z,verboseInfo:X}),Q=oZ(q,H),Y=Y6(Q,X,J);if(Y!=="")console.warn(Y.slice(0,-1))},tZ=({type:$,result:q,verboseInfo:{escapedCommand:J,commandId:X,rawOptions:{piped:Z=!1,...H}}})=>({type:$,escapedCommand:J,commandId:`${X}`,timestamp:new Date,piped:Z,result:q,options:H}),oZ=($,q)=>$.split(`
36
- `).map((J)=>rZ({...q,message:J})),rZ=($)=>{return{verboseLine:H6($),verboseObject:$}},N0=($)=>{let q=typeof $==="string"?$:aZ($);return q0(q).replaceAll("\t"," ".repeat(sZ))},sZ=2;var G6=($,q)=>{if(!v1(q))return;r({type:"command",verboseMessage:$,verboseInfo:q})};var K6=($,q,J)=>{qQ($);let X=eZ($);return{verbose:$,escapedCommand:q,commandId:X,rawOptions:J}},eZ=($)=>v1({verbose:$})?$Q++:void 0,$Q=0n,qQ=($)=>{for(let q of $){if(q===!1)throw TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(q===!0)throw TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!A0.includes(q)&&!I0(q)){let J=A0.map((X)=>`'${X}'`).join(", ");throw TypeError(`The "verbose" option must not be ${q}. Allowed values are: ${J} or a function.`)}}};import{hrtime as U6}from"node:process";var D0=()=>U6.bigint(),j2=($)=>Number(U6.bigint()-$)/1e6;var v0=($,q,J)=>{let X=D0(),{command:Z,escapedCommand:H}=o3($,q),Q=R2(J,"verbose"),Y=K6(Q,H,{...J});return G6(H,Y),{command:Z,escapedCommand:H,startTime:X,verboseInfo:Y}};var G7=o(s6(),1);import mH from"node:path";import Y7 from"node:process";import b0 from"node:process";import j1 from"node:path";function h0($={}){let{env:q=process.env,platform:J=process.platform}=$;if(J!=="win32")return"PATH";return Object.keys(q).reverse().find((X)=>X.toUpperCase()==="PATH")||"Path"}import{promisify as OQ}from"node:util";import{execFile as NQ,execFileSync as EV}from"node:child_process";import e6 from"node:path";import{fileURLToPath as DQ}from"node:url";var NV=OQ(NQ);function S0($){return $ instanceof URL?DQ($):$}function $8($){return{*[Symbol.iterator](){let q=e6.resolve(S0($)),J;while(J!==q)yield q,J=q,q=e6.resolve(q,"..")}}}var vQ=({cwd:$=b0.cwd(),path:q=b0.env[h0()],preferLocal:J=!0,execPath:X=b0.execPath,addExecPath:Z=!0}={})=>{let H=j1.resolve(S0($)),Q=[],Y=q.split(j1.delimiter);if(J)fQ(Q,Y,H);if(Z)hQ(Q,Y,X,H);return q===""||q===j1.delimiter?`${Q.join(j1.delimiter)}${q}`:[...Q,q].join(j1.delimiter)},fQ=($,q,J)=>{for(let X of $8(J)){let Z=j1.join(X,"node_modules/.bin");if(!q.includes(Z))$.push(Z)}},hQ=($,q,J,X)=>{let Z=j1.resolve(X,S0(J),"..");if(!q.includes(Z))$.push(Z)},q8=({env:$=b0.env,...q}={})=>{$={...$};let J=h0({env:$});return q.path=$[J],$[J]=vQ(q),$};import{setTimeout as rQ}from"node:timers/promises";var J8=($,q,J)=>{let X=J?c0:g0,Z=$ instanceof s?{}:{cause:$};return new X(q,Z)};class s extends Error{}var X8=($,q)=>{Object.defineProperty($.prototype,"name",{value:q,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,Q8,{value:!0,writable:!1,enumerable:!1,configurable:!1})},Z8=($)=>m0($)&&(Q8 in $),Q8=Symbol("isExecaError"),m0=($)=>Object.prototype.toString.call($)==="[object Error]";class g0 extends Error{}X8(g0,g0.name);class c0 extends Error{}X8(c0,c0.name);import{constants as J0}from"node:os";import{constants as cQ}from"node:os";var H8=()=>{let $=N2-Y8+1;return Array.from({length:$},SQ)},SQ=($,q)=>({name:`SIGRT${q+1}`,number:Y8+q,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),Y8=34,N2=64;import{constants as bQ}from"node:os";var G8=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}];var D2=()=>{let $=H8();return[...G8,...$].map(gQ)},gQ=({name:$,number:q,description:J,action:X,forced:Z=!1,standard:H})=>{let{signals:{[$]:Q}}=bQ,Y=Q!==void 0;return{name:$,number:Y?Q:q,description:J,supported:Y,action:X,forced:Z,standard:H}};var mQ=()=>{let $=D2();return Object.fromEntries($.map(uQ))},uQ=({name:$,number:q,description:J,supported:X,action:Z,forced:H,standard:Q})=>[$,{name:$,number:q,description:J,supported:X,action:Z,forced:H,standard:Q}],K8=mQ(),pQ=()=>{let $=D2(),q=N2+1,J=Array.from({length:q},(X,Z)=>lQ(Z,$));return Object.assign({},...J)},lQ=($,q)=>{let J=dQ($,q);if(J===void 0)return{};let{name:X,description:Z,supported:H,action:Q,forced:Y,standard:G}=J;return{[$]:{name:X,number:$,description:Z,supported:H,action:Q,forced:Y,standard:G}}},dQ=($,q)=>{let J=q.find(({name:X})=>cQ.signals[X]===$);if(J!==void 0)return J;return q.find((X)=>X.number===$)},oV=pQ();var B8=($)=>{if($===0)throw TypeError("Invalid option `killSignal`: 0 cannot be used.");return L8($,"option `killSignal`")},z8=($)=>$===0?$:L8($,"`subprocess.kill()`'s argument"),L8=($,q)=>{if(Number.isInteger($))return iQ($,q);if(typeof $==="string")return aQ($,q);throw TypeError(`Invalid ${q} ${String($)}: it must be a string or an integer.
37
- ${v2()}`)},iQ=($,q)=>{if(U8.has($))return U8.get($);throw TypeError(`Invalid ${q} ${$}: this signal integer does not exist.
38
- ${v2()}`)},nQ=()=>new Map(Object.entries(J0.signals).reverse().map(([$,q])=>[q,$])),U8=nQ(),aQ=($,q)=>{if($ in J0.signals)return $;if($.toUpperCase()in J0.signals)throw TypeError(`Invalid ${q} '${$}': please rename it to '${$.toUpperCase()}'.`);throw TypeError(`Invalid ${q} '${$}': this signal name does not exist.
39
- ${v2()}`)},v2=()=>`Available signal names: ${tQ()}.
40
- Available signal numbers: ${oQ()}.`,tQ=()=>Object.keys(J0.signals).sort().map(($)=>`'${$}'`).join(", "),oQ=()=>[...new Set(Object.values(J0.signals).sort(($,q)=>$-q))].join(", "),u0=($)=>K8[$].description;var V8=($)=>{if($===!1)return $;if($===!0)return sQ;if(!Number.isFinite($)||$<0)throw TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${$}\` (${typeof $})`);return $},sQ=5000,W8=({kill:$,options:{forceKillAfterDelay:q,killSignal:J},onInternalError:X,context:Z,controller:H},Q,Y)=>{let{signal:G,error:K}=eQ(Q,Y,J);$H(K,X);let U=$(G);return qH({kill:$,signal:G,forceKillAfterDelay:q,killSignal:J,killResult:U,context:Z,controller:H}),U},eQ=($,q,J)=>{let[X=J,Z]=m0($)?[void 0,$]:[$,q];if(typeof X!=="string"&&!Number.isInteger(X))throw TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(X)}`);if(Z!==void 0&&!m0(Z))throw TypeError(`The second argument is optional. If specified, it must be an error instance: ${Z}`);return{signal:z8(X),error:Z}},$H=($,q)=>{if($!==void 0)q.reject($)},qH=async({kill:$,signal:q,forceKillAfterDelay:J,killSignal:X,killResult:Z,context:H,controller:Q})=>{if(q===X&&Z)f2({kill:$,forceKillAfterDelay:J,context:H,controllerSignal:Q.signal})},f2=async({kill:$,forceKillAfterDelay:q,context:J,controllerSignal:X})=>{if(q===!1)return;try{if(await rQ(q,void 0,{signal:X}),$("SIGKILL"))J.isForcefullyTerminated??=!0}catch{}};import{once as JH}from"node:events";var p0=async($,q)=>{if(!$.aborted)await JH($,"abort",{signal:q})};var _8=({cancelSignal:$})=>{if($!==void 0&&Object.prototype.toString.call($)!=="[object AbortSignal]")throw Error(`The \`cancelSignal\` option must be an AbortSignal: ${String($)}`)},R8=({subprocess:$,cancelSignal:q,gracefulCancel:J,context:X,controller:Z})=>q===void 0||J?[]:[XH($,q,X,Z)],XH=async($,q,J,{signal:X})=>{throw await p0(q,X),J.terminationReason??="cancel",$.kill(),q.reason};import{scheduler as MH}from"node:timers/promises";import{promisify as FH}from"node:util";var b1=({methodName:$,isSubprocess:q,ipc:J,isConnected:X})=>{ZH($,q,J),h2($,q,X)},ZH=($,q,J)=>{if(!J)throw Error(`${n($,q)} can only be used if the \`ipc\` option is \`true\`.`)},h2=($,q,J)=>{if(!J)throw Error(`${n($,q)} cannot be used: the ${_1(q)} has already exited or disconnected.`)},T8=($)=>{throw Error(`${n("getOneMessage",$)} could not complete: the ${_1($)} exited or disconnected.`)},P8=($)=>{throw Error(`${n("sendMessage",$)} failed: the ${_1($)} is sending a message too, instead of listening to incoming messages.
35
+ `;var s=({type:$,verboseMessage:q,fdNumber:J,verboseInfo:X,result:Z})=>{let H=$Q({type:$,result:Z,verboseInfo:X}),Q=qQ(q,H),Y=B6(Q,X,J);if(Y!=="")console.warn(Y.slice(0,-1))},$Q=({type:$,result:q,verboseInfo:{escapedCommand:J,commandId:X,rawOptions:{piped:Z=!1,...H}}})=>({type:$,escapedCommand:J,commandId:`${X}`,timestamp:new Date,piped:Z,result:q,options:H}),qQ=($,q)=>$.split(`
36
+ `).map((J)=>JQ({...q,message:J})),JQ=($)=>{return{verboseLine:U6($),verboseObject:$}},f0=($)=>{let q=typeof $==="string"?$:eZ($);return X0(q).replaceAll("\t"," ".repeat(XQ))},XQ=2;var z6=($,q)=>{if(!f1(q))return;s({type:"command",verboseMessage:$,verboseInfo:q})};var L6=($,q,J)=>{HQ($);let X=ZQ($);return{verbose:$,escapedCommand:q,commandId:X,rawOptions:J}},ZQ=($)=>f1({verbose:$})?QQ++:void 0,QQ=0n,HQ=($)=>{for(let q of $){if(q===!1)throw TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(q===!0)throw TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!O0.includes(q)&&!y0(q)){let J=O0.map((X)=>`'${X}'`).join(", ");throw TypeError(`The "verbose" option must not be ${q}. Allowed values are: ${J} or a function.`)}}};import{hrtime as W6}from"node:process";var h0=()=>W6.bigint(),C2=($)=>Number(W6.bigint()-$)/1e6;var S0=($,q,J)=>{let X=h0(),{command:Z,escapedCommand:H}=$6($,q),Q=k2(J,"verbose"),Y=L6(Q,H,{...J});return z6(H,Y),{command:Z,escapedCommand:H,startTime:X,verboseInfo:Y}};var z7=n(J8(),1);import iH from"node:path";import B7 from"node:process";import m0 from"node:process";import M1 from"node:path";function g0($={}){let{env:q=process.env,platform:J=process.platform}=$;if(J!=="win32")return"PATH";return Object.keys(q).reverse().find((X)=>X.toUpperCase()==="PATH")||"Path"}import{promisify as hQ}from"node:util";import{execFile as SQ,execFileSync as fW}from"node:child_process";import X8 from"node:path";import{fileURLToPath as bQ}from"node:url";var bW=hQ(SQ);function c0($){return $ instanceof URL?bQ($):$}function Z8($){return{*[Symbol.iterator](){let q=X8.resolve(c0($)),J;while(J!==q)yield q,J=q,q=X8.resolve(q,"..")}}}var gQ=({cwd:$=m0.cwd(),path:q=m0.env[g0()],preferLocal:J=!0,execPath:X=m0.execPath,addExecPath:Z=!0}={})=>{let H=M1.resolve(c0($)),Q=[],Y=q.split(M1.delimiter);if(J)cQ(Q,Y,H);if(Z)mQ(Q,Y,X,H);return q===""||q===M1.delimiter?`${Q.join(M1.delimiter)}${q}`:[...Q,q].join(M1.delimiter)},cQ=($,q,J)=>{for(let X of Z8(J)){let Z=M1.join(X,"node_modules/.bin");if(!q.includes(Z))$.push(Z)}},mQ=($,q,J,X)=>{let Z=M1.resolve(X,c0(J),"..");if(!q.includes(Z))$.push(Z)},Q8=({env:$=m0.env,...q}={})=>{$={...$};let J=g0({env:$});return q.path=$[J],$[J]=gQ(q),$};import{setTimeout as JH}from"node:timers/promises";var H8=($,q,J)=>{let X=J?p0:u0,Z=$ instanceof e?{}:{cause:$};return new X(q,Z)};class e extends Error{}var Y8=($,q)=>{Object.defineProperty($.prototype,"name",{value:q,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,K8,{value:!0,writable:!1,enumerable:!1,configurable:!1})},G8=($)=>l0($)&&(K8 in $),K8=Symbol("isExecaError"),l0=($)=>Object.prototype.toString.call($)==="[object Error]";class u0 extends Error{}Y8(u0,u0.name);class p0 extends Error{}Y8(p0,p0.name);import{constants as Z0}from"node:os";import{constants as dQ}from"node:os";var U8=()=>{let $=f2-B8+1;return Array.from({length:$},uQ)},uQ=($,q)=>({name:`SIGRT${q+1}`,number:B8+q,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),B8=34,f2=64;import{constants as pQ}from"node:os";var z8=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}];var h2=()=>{let $=U8();return[...z8,...$].map(lQ)},lQ=({name:$,number:q,description:J,action:X,forced:Z=!1,standard:H})=>{let{signals:{[$]:Q}}=pQ,Y=Q!==void 0;return{name:$,number:Y?Q:q,description:J,supported:Y,action:X,forced:Z,standard:H}};var iQ=()=>{let $=h2();return Object.fromEntries($.map(nQ))},nQ=({name:$,number:q,description:J,supported:X,action:Z,forced:H,standard:Q})=>[$,{name:$,number:q,description:J,supported:X,action:Z,forced:H,standard:Q}],L8=iQ(),aQ=()=>{let $=h2(),q=f2+1,J=Array.from({length:q},(X,Z)=>tQ(Z,$));return Object.assign({},...J)},tQ=($,q)=>{let J=oQ($,q);if(J===void 0)return{};let{name:X,description:Z,supported:H,action:Q,forced:Y,standard:G}=J;return{[$]:{name:X,number:$,description:Z,supported:H,action:Q,forced:Y,standard:G}}},oQ=($,q)=>{let J=q.find(({name:X})=>dQ.signals[X]===$);if(J!==void 0)return J;return q.find((X)=>X.number===$)},JV=aQ();var V8=($)=>{if($===0)throw TypeError("Invalid option `killSignal`: 0 cannot be used.");return R8($,"option `killSignal`")},_8=($)=>$===0?$:R8($,"`subprocess.kill()`'s argument"),R8=($,q)=>{if(Number.isInteger($))return rQ($,q);if(typeof $==="string")return eQ($,q);throw TypeError(`Invalid ${q} ${String($)}: it must be a string or an integer.
37
+ ${S2()}`)},rQ=($,q)=>{if(W8.has($))return W8.get($);throw TypeError(`Invalid ${q} ${$}: this signal integer does not exist.
38
+ ${S2()}`)},sQ=()=>new Map(Object.entries(Z0.signals).reverse().map(([$,q])=>[q,$])),W8=sQ(),eQ=($,q)=>{if($ in Z0.signals)return $;if($.toUpperCase()in Z0.signals)throw TypeError(`Invalid ${q} '${$}': please rename it to '${$.toUpperCase()}'.`);throw TypeError(`Invalid ${q} '${$}': this signal name does not exist.
39
+ ${S2()}`)},S2=()=>`Available signal names: ${$H()}.
40
+ Available signal numbers: ${qH()}.`,$H=()=>Object.keys(Z0.signals).sort().map(($)=>`'${$}'`).join(", "),qH=()=>[...new Set(Object.values(Z0.signals).sort(($,q)=>$-q))].join(", "),d0=($)=>L8[$].description;var P8=($)=>{if($===!1)return $;if($===!0)return XH;if(!Number.isFinite($)||$<0)throw TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${$}\` (${typeof $})`);return $},XH=5000,T8=({kill:$,options:{forceKillAfterDelay:q,killSignal:J},onInternalError:X,context:Z,controller:H},Q,Y)=>{let{signal:G,error:K}=ZH(Q,Y,J);QH(K,X);let U=$(G);return HH({kill:$,signal:G,forceKillAfterDelay:q,killSignal:J,killResult:U,context:Z,controller:H}),U},ZH=($,q,J)=>{let[X=J,Z]=l0($)?[void 0,$]:[$,q];if(typeof X!=="string"&&!Number.isInteger(X))throw TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(X)}`);if(Z!==void 0&&!l0(Z))throw TypeError(`The second argument is optional. If specified, it must be an error instance: ${Z}`);return{signal:_8(X),error:Z}},QH=($,q)=>{if($!==void 0)q.reject($)},HH=async({kill:$,signal:q,forceKillAfterDelay:J,killSignal:X,killResult:Z,context:H,controller:Q})=>{if(q===X&&Z)b2({kill:$,forceKillAfterDelay:J,context:H,controllerSignal:Q.signal})},b2=async({kill:$,forceKillAfterDelay:q,context:J,controllerSignal:X})=>{if(q===!1)return;try{if(await JH(q,void 0,{signal:X}),$("SIGKILL"))J.isForcefullyTerminated??=!0}catch{}};import{once as YH}from"node:events";var i0=async($,q)=>{if(!$.aborted)await YH($,"abort",{signal:q})};var k8=({cancelSignal:$})=>{if($!==void 0&&Object.prototype.toString.call($)!=="[object AbortSignal]")throw Error(`The \`cancelSignal\` option must be an AbortSignal: ${String($)}`)},F8=({subprocess:$,cancelSignal:q,gracefulCancel:J,context:X,controller:Z})=>q===void 0||J?[]:[GH($,q,X,Z)],GH=async($,q,J,{signal:X})=>{throw await i0(q,X),J.terminationReason??="cancel",$.kill(),q.reason};import{scheduler as EH}from"node:timers/promises";import{promisify as wH}from"node:util";var g1=({methodName:$,isSubprocess:q,ipc:J,isConnected:X})=>{KH($,q,J),g2($,q,X)},KH=($,q,J)=>{if(!J)throw Error(`${t($,q)} can only be used if the \`ipc\` option is \`true\`.`)},g2=($,q,J)=>{if(!J)throw Error(`${t($,q)} cannot be used: the ${R1(q)} has already exited or disconnected.`)},x8=($)=>{throw Error(`${t("getOneMessage",$)} could not complete: the ${R1($)} exited or disconnected.`)},j8=($)=>{throw Error(`${t("sendMessage",$)} failed: the ${R1($)} is sending a message too, instead of listening to incoming messages.
41
41
  This can be fixed by both sending a message and listening to incoming messages at the same time:
42
42
 
43
43
  const [receivedMessage] = await Promise.all([
44
- ${n("getOneMessage",$)},
45
- ${n("sendMessage",$,"message, {strict: true}")},
46
- ]);`)},l0=($,q)=>Error(`${n("sendMessage",q)} failed when sending an acknowledgment response to the ${_1(q)}.`,{cause:$}),k8=($)=>{throw Error(`${n("sendMessage",$)} failed: the ${_1($)} is not listening to incoming messages.`)},F8=($)=>{throw Error(`${n("sendMessage",$)} failed: the ${_1($)} exited without listening to incoming messages.`)},j8=()=>Error(`\`cancelSignal\` aborted: the ${_1(!0)} disconnected.`),x8=()=>{throw Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},M8=({error:$,methodName:q,isSubprocess:J})=>{if($.code==="EPIPE")throw Error(`${n(q,J)} cannot be used: the ${_1(J)} is disconnecting.`,{cause:$})},C8=({error:$,methodName:q,isSubprocess:J,message:X})=>{if(QH($))throw Error(`${n(q,J)}'s argument type is invalid: the message cannot be serialized: ${String(X)}.`,{cause:$})},QH=({code:$,message:q})=>HH.has($)||YH.some((J)=>q.includes(J)),HH=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),YH=["could not be cloned","circular structure","call stack size exceeded"],n=($,q,J="")=>$==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${GH(q)}${$}(${J})`,GH=($)=>$?"":"subprocess.",_1=($)=>$?"parent process":"subprocess",g1=($)=>{if($.connected)$.disconnect()};var e=()=>{let $={},q=new Promise((J,X)=>{Object.assign($,{resolve:J,reject:X})});return Object.assign(q,$)};var i0=($,q="stdin")=>{let{options:X,fileDescriptors:Z}=$1.get($),H=w8(Z,q,!0),Q=$.stdio[H];if(Q===null)throw TypeError(I8(H,q,X,!0));return Q},c1=($,q="stdout")=>{let{options:X,fileDescriptors:Z}=$1.get($),H=w8(Z,q,!1),Q=H==="all"?$.all:$.stdio[H];if(Q===null||Q===void 0)throw TypeError(I8(H,q,X,!1));return Q},$1=new WeakMap,w8=($,q,J)=>{let X=KH(q,J);return UH(X,q,J,$),X},KH=($,q)=>{let J=T2($);if(J!==void 0)return J;let{validOptions:X,defaultValue:Z}=q?{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw TypeError(`"${X0(q)}" must not be "${$}".
44
+ ${t("getOneMessage",$)},
45
+ ${t("sendMessage",$,"message, {strict: true}")},
46
+ ]);`)},n0=($,q)=>Error(`${t("sendMessage",q)} failed when sending an acknowledgment response to the ${R1(q)}.`,{cause:$}),M8=($)=>{throw Error(`${t("sendMessage",$)} failed: the ${R1($)} is not listening to incoming messages.`)},C8=($)=>{throw Error(`${t("sendMessage",$)} failed: the ${R1($)} exited without listening to incoming messages.`)},w8=()=>Error(`\`cancelSignal\` aborted: the ${R1(!0)} disconnected.`),I8=()=>{throw Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},A8=({error:$,methodName:q,isSubprocess:J})=>{if($.code==="EPIPE")throw Error(`${t(q,J)} cannot be used: the ${R1(J)} is disconnecting.`,{cause:$})},E8=({error:$,methodName:q,isSubprocess:J,message:X})=>{if(UH($))throw Error(`${t(q,J)}'s argument type is invalid: the message cannot be serialized: ${String(X)}.`,{cause:$})},UH=({code:$,message:q})=>BH.has($)||zH.some((J)=>q.includes(J)),BH=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),zH=["could not be cloned","circular structure","call stack size exceeded"],t=($,q,J="")=>$==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${LH(q)}${$}(${J})`,LH=($)=>$?"":"subprocess.",R1=($)=>$?"parent process":"subprocess",c1=($)=>{if($.connected)$.disconnect()};var $1=()=>{let $={},q=new Promise((J,X)=>{Object.assign($,{resolve:J,reject:X})});return Object.assign(q,$)};var t0=($,q="stdin")=>{let{options:X,fileDescriptors:Z}=q1.get($),H=y8(Z,q,!0),Q=$.stdio[H];if(Q===null)throw TypeError(O8(H,q,X,!0));return Q},m1=($,q="stdout")=>{let{options:X,fileDescriptors:Z}=q1.get($),H=y8(Z,q,!1),Q=H==="all"?$.all:$.stdio[H];if(Q===null||Q===void 0)throw TypeError(O8(H,q,X,!1));return Q},q1=new WeakMap,y8=($,q,J)=>{let X=WH(q,J);return VH(X,q,J,$),X},WH=($,q)=>{let J=F2($);if(J!==void 0)return J;let{validOptions:X,defaultValue:Z}=q?{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw TypeError(`"${Q0(q)}" must not be "${$}".
47
47
  It must be ${X} or "fd3", "fd4" (and so on).
48
- It is optional and defaults to "${Z}".`)},UH=($,q,J,X)=>{let Z=X[A8($)];if(Z===void 0)throw TypeError(`"${X0(J)}" must not be ${q}. That file descriptor does not exist.
49
- Please set the "stdio" option to ensure that file descriptor exists.`);if(Z.direction==="input"&&!J)throw TypeError(`"${X0(J)}" must not be ${q}. It must be a readable stream, not writable.`);if(Z.direction!=="input"&&J)throw TypeError(`"${X0(J)}" must not be ${q}. It must be a writable stream, not readable.`)},I8=($,q,J,X)=>{if($==="all"&&!J.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:Z,optionValue:H}=BH($,J);return`The "${Z}: ${d0(H)}" option is incompatible with using "${X0(X)}: ${d0(q)}".
50
- Please set this option with "pipe" instead.`},BH=($,{stdin:q,stdout:J,stderr:X,stdio:Z})=>{let H=A8($);if(H===0&&q!==void 0)return{optionName:"stdin",optionValue:q};if(H===1&&J!==void 0)return{optionName:"stdout",optionValue:J};if(H===2&&X!==void 0)return{optionName:"stderr",optionValue:X};return{optionName:`stdio[${H}]`,optionValue:Z[H]}},A8=($)=>$==="all"?1:$,X0=($)=>$?"to":"from",d0=($)=>{if(typeof $==="string")return`'${$}'`;return typeof $==="number"?`${$}`:"Stream"};import{once as RH}from"node:events";import{addAbortListener as zH}from"node:events";var x1=($,q,J)=>{let X=$.getMaxListeners();if(X===0||X===Number.POSITIVE_INFINITY)return;$.setMaxListeners(X+q),zH(J,()=>{$.setMaxListeners($.getMaxListeners()-q)})};import{EventEmitter as WH}from"node:events";import{once as LH}from"node:events";import{scheduler as VH}from"node:timers/promises";var n0=($,q)=>{if(q)S2($)},S2=($)=>{$.refCounted()},a0=($,q)=>{if(q)b2($)},b2=($)=>{$.unrefCounted()},E8=($,q)=>{if(q)b2($),b2($)},y8=($,q)=>{if(q)S2($),S2($)};var O8=async({anyProcess:$,channel:q,isSubprocess:J,ipcEmitter:X},Z)=>{if(v8(Z)||h8(Z))return;if(!t0.has($))t0.set($,[]);let H=t0.get($);if(H.push(Z),H.length>1)return;while(H.length>0){await f8($,X,Z),await VH.yield();let Q=await D8({wrappedMessage:H[0],anyProcess:$,channel:q,isSubprocess:J,ipcEmitter:X});H.shift(),X.emit("message",Q),X.emit("message:done")}},N8=async({anyProcess:$,channel:q,isSubprocess:J,ipcEmitter:X,boundOnMessage:Z})=>{g2();let H=t0.get($);while(H?.length>0)await LH(X,"message:done");$.removeListener("message",Z),y8(q,J),X.connected=!1,X.emit("disconnect")},t0=new WeakMap;var R1=($,q,J)=>{if(o0.has($))return o0.get($);let X=new WH;return X.connected=!0,o0.set($,X),_H({ipcEmitter:X,anyProcess:$,channel:q,isSubprocess:J}),X},o0=new WeakMap,_H=({ipcEmitter:$,anyProcess:q,channel:J,isSubprocess:X})=>{let Z=O8.bind(void 0,{anyProcess:q,channel:J,isSubprocess:X,ipcEmitter:$});q.on("message",Z),q.once("disconnect",N8.bind(void 0,{anyProcess:q,channel:J,isSubprocess:X,ipcEmitter:$,boundOnMessage:Z})),E8(J,X)},r0=($)=>{let q=o0.get($);return q===void 0?$.channel!==null:q.connected};var S8=({anyProcess:$,channel:q,isSubprocess:J,message:X,strict:Z})=>{if(!Z)return X;let H=R1($,q,J),Q=$$($,H);return{id:TH++,type:e0,message:X,hasListeners:Q}},TH=0n,b8=($,q)=>{if(q?.type!==e0||q.hasListeners)return;for(let{id:J}of $)if(J!==void 0)s0[J].resolve({isDeadlock:!0,hasListeners:!1})},D8=async({wrappedMessage:$,anyProcess:q,channel:J,isSubprocess:X,ipcEmitter:Z})=>{if($?.type!==e0||!q.connected)return $;let{id:H,message:Q}=$,Y={id:H,type:c8,message:$$(q,Z)};try{await q$({anyProcess:q,channel:J,isSubprocess:X,ipc:!0},Y)}catch(G){Z.emit("strict:error",G)}return Q},v8=($)=>{if($?.type!==c8)return!1;let{id:q,message:J}=$;return s0[q]?.resolve({isDeadlock:!1,hasListeners:J}),!0},g8=async($,q,J)=>{if($?.type!==e0)return;let X=e();s0[$.id]=X;let Z=new AbortController;try{let{isDeadlock:H,hasListeners:Q}=await Promise.race([X,PH(q,J,Z)]);if(H)P8(J);if(!Q)k8(J)}finally{Z.abort(),delete s0[$.id]}},s0={},PH=async($,q,{signal:J})=>{x1($,1,J),await RH($,"disconnect",{signal:J}),F8(q)},e0="execa:ipc:request",c8="execa:ipc:response";var m8=($,q,J)=>{if(!Z0.has($))Z0.set($,new Set);let X=Z0.get($),Z=e(),H=J?q.id:void 0,Q={onMessageSent:Z,id:H};return X.add(Q),{outgoingMessages:X,outgoingMessage:Q}},u8=({outgoingMessages:$,outgoingMessage:q})=>{$.delete(q),q.onMessageSent.resolve()},f8=async($,q,J)=>{while(!$$($,q)&&Z0.get($)?.size>0){let X=[...Z0.get($)];b8(X,J),await Promise.all(X.map(({onMessageSent:Z})=>Z))}},Z0=new WeakMap,$$=($,q)=>q.listenerCount("message")>kH($),kH=($)=>$1.has($)&&!Y1($1.get($).options.buffer,"ipc")?1:0;var q$=({anyProcess:$,channel:q,isSubprocess:J,ipc:X},Z,{strict:H=!1}={})=>{return b1({methodName:"sendMessage",isSubprocess:J,ipc:X,isConnected:$.connected}),jH({anyProcess:$,channel:q,methodName:"sendMessage",isSubprocess:J,message:Z,strict:H})},jH=async({anyProcess:$,channel:q,methodName:J,isSubprocess:X,message:Z,strict:H})=>{let Q=S8({anyProcess:$,channel:q,isSubprocess:X,message:Z,strict:H}),Y=m8($,Q,H);try{await m2({anyProcess:$,methodName:J,isSubprocess:X,wrappedMessage:Q,message:Z})}catch(G){throw g1($),G}finally{u8(Y)}},m2=async({anyProcess:$,methodName:q,isSubprocess:J,wrappedMessage:X,message:Z})=>{let H=xH($);try{await Promise.all([g8(X,$,J),H(X)])}catch(Q){throw M8({error:Q,methodName:q,isSubprocess:J}),C8({error:Q,methodName:q,isSubprocess:J,message:Z}),Q}},xH=($)=>{if(c2.has($))return c2.get($);let q=FH($.send.bind($));return c2.set($,q),q},c2=new WeakMap;var l8=($,q)=>{return h2("cancelSignal",!1,$.connected),m2({anyProcess:$,methodName:"cancelSignal",isSubprocess:!1,wrappedMessage:{type:i8,message:q},message:q})},d8=async({anyProcess:$,channel:q,isSubprocess:J,ipc:X})=>{return await CH({anyProcess:$,channel:q,isSubprocess:J,ipc:X}),u2.signal},CH=async({anyProcess:$,channel:q,isSubprocess:J,ipc:X})=>{if(p8)return;if(p8=!0,!X){x8();return}if(q===null){g2();return}R1($,q,J),await MH.yield()},p8=!1,h8=($)=>{if($?.type!==i8)return!1;return u2.abort($.message),!0},i8="execa:ipc:cancel",g2=()=>{u2.abort(j8())},u2=new AbortController;var n8=({gracefulCancel:$,cancelSignal:q,ipc:J,serialization:X})=>{if(!$)return;if(q===void 0)throw Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!J)throw Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(X==="json")throw Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")},a8=({subprocess:$,cancelSignal:q,gracefulCancel:J,forceKillAfterDelay:X,context:Z,controller:H})=>J?[wH({subprocess:$,cancelSignal:q,forceKillAfterDelay:X,context:Z,controller:H})]:[],wH=async({subprocess:$,cancelSignal:q,forceKillAfterDelay:J,context:X,controller:{signal:Z}})=>{await p0(q,Z);let H=IH(q);throw await l8($,H),f2({kill:$.kill,forceKillAfterDelay:J,context:X,controllerSignal:Z}),X.terminationReason??="gracefulCancel",q.reason},IH=({reason:$})=>{if(!($ instanceof DOMException))return $;let q=Error($.message);return Object.defineProperty(q,"stack",{value:$.stack,enumerable:!1,configurable:!0,writable:!0}),q};import{setTimeout as AH}from"node:timers/promises";var t8=({timeout:$})=>{if($!==void 0&&(!Number.isFinite($)||$<0))throw TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${$}\` (${typeof $})`)},o8=($,q,J,X)=>q===0||q===void 0?[]:[EH($,q,J,X)],EH=async($,q,J,{signal:X})=>{throw await AH(q,void 0,{signal:X}),J.terminationReason??="timeout",$.kill(),new s};import{execPath as yH,execArgv as OH}from"node:process";import r8 from"node:path";var s8=({options:$})=>{if($.node===!1)throw TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...$,node:!0}}},e8=($,q,{node:J=!1,nodePath:X=yH,nodeOptions:Z=OH.filter((G)=>!G.startsWith("--inspect")),cwd:H,execPath:Q,...Y})=>{if(Q!==void 0)throw TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');let G=D1(X,'The "nodePath" option'),K=r8.resolve(H,G),U={...Y,nodePath:K,node:J,cwd:H};if(!J)return[$,q,U];if(r8.basename($,".exe")==="node")throw TypeError('When the "node" option is true, the first argument does not need to be "node".');return[K,[...Z,$,...q],{ipc:!0,...U,shell:!1}]};import{serialize as NH}from"node:v8";var $7=({ipcInput:$,ipc:q,serialization:J})=>{if($===void 0)return;if(!q)throw Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");fH[J]($)},DH=($)=>{try{NH($)}catch(q){throw Error("The `ipcInput` option is not serializable with a structured clone.",{cause:q})}},vH=($)=>{try{JSON.stringify($)}catch(q){throw Error("The `ipcInput` option is not serializable with JSON.",{cause:q})}},fH={advanced:DH,json:vH},q7=async($,q)=>{if(q===void 0)return;await $.sendMessage(q)};var X7=({encoding:$})=>{if(p2.has($))return;let q=SH($);if(q!==void 0)throw TypeError(`Invalid option \`encoding: ${J$($)}\`.
51
- Please rename it to ${J$(q)}.`);let J=[...p2].map((X)=>J$(X)).join(", ");throw TypeError(`Invalid option \`encoding: ${J$($)}\`.
52
- Please rename it to one of: ${J}.`)},hH=new Set(["utf8","utf16le"]),u=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),p2=new Set([...hH,...u]),SH=($)=>{if($===null)return"buffer";if(typeof $!=="string")return;let q=$.toLowerCase();if(q in J7)return J7[q];if(p2.has(q))return q},J7={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},J$=($)=>typeof $==="string"?`"${$}"`:String($);import{statSync as bH}from"node:fs";import gH from"node:path";import cH from"node:process";var Z7=($=Q7())=>{let q=D1($,'The "cwd" option');return gH.resolve(q)},Q7=()=>{try{return cH.cwd()}catch($){throw $.message=`The current directory does not exist.
53
- ${$.message}`,$}},H7=($,q)=>{if(q===Q7())return $;let J;try{J=bH(q)}catch(X){return`The "cwd" option is invalid: ${q}.
48
+ It is optional and defaults to "${Z}".`)},VH=($,q,J,X)=>{let Z=X[N8($)];if(Z===void 0)throw TypeError(`"${Q0(J)}" must not be ${q}. That file descriptor does not exist.
49
+ Please set the "stdio" option to ensure that file descriptor exists.`);if(Z.direction==="input"&&!J)throw TypeError(`"${Q0(J)}" must not be ${q}. It must be a readable stream, not writable.`);if(Z.direction!=="input"&&J)throw TypeError(`"${Q0(J)}" must not be ${q}. It must be a writable stream, not readable.`)},O8=($,q,J,X)=>{if($==="all"&&!J.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:Z,optionValue:H}=_H($,J);return`The "${Z}: ${a0(H)}" option is incompatible with using "${Q0(X)}: ${a0(q)}".
50
+ Please set this option with "pipe" instead.`},_H=($,{stdin:q,stdout:J,stderr:X,stdio:Z})=>{let H=N8($);if(H===0&&q!==void 0)return{optionName:"stdin",optionValue:q};if(H===1&&J!==void 0)return{optionName:"stdout",optionValue:J};if(H===2&&X!==void 0)return{optionName:"stderr",optionValue:X};return{optionName:`stdio[${H}]`,optionValue:Z[H]}},N8=($)=>$==="all"?1:$,Q0=($)=>$?"to":"from",a0=($)=>{if(typeof $==="string")return`'${$}'`;return typeof $==="number"?`${$}`:"Stream"};import{once as xH}from"node:events";import{addAbortListener as RH}from"node:events";var C1=($,q,J)=>{let X=$.getMaxListeners();if(X===0||X===Number.POSITIVE_INFINITY)return;$.setMaxListeners(X+q),RH(J,()=>{$.setMaxListeners($.getMaxListeners()-q)})};import{EventEmitter as kH}from"node:events";import{once as PH}from"node:events";import{scheduler as TH}from"node:timers/promises";var o0=($,q)=>{if(q)c2($)},c2=($)=>{$.refCounted()},r0=($,q)=>{if(q)m2($)},m2=($)=>{$.unrefCounted()},D8=($,q)=>{if(q)m2($),m2($)},v8=($,q)=>{if(q)c2($),c2($)};var f8=async({anyProcess:$,channel:q,isSubprocess:J,ipcEmitter:X},Z)=>{if(b8(Z)||c8(Z))return;if(!s0.has($))s0.set($,[]);let H=s0.get($);if(H.push(Z),H.length>1)return;while(H.length>0){await g8($,X,Z),await TH.yield();let Q=await S8({wrappedMessage:H[0],anyProcess:$,channel:q,isSubprocess:J,ipcEmitter:X});H.shift(),X.emit("message",Q),X.emit("message:done")}},h8=async({anyProcess:$,channel:q,isSubprocess:J,ipcEmitter:X,boundOnMessage:Z})=>{u2();let H=s0.get($);while(H?.length>0)await PH(X,"message:done");$.removeListener("message",Z),v8(q,J),X.connected=!1,X.emit("disconnect")},s0=new WeakMap;var P1=($,q,J)=>{if(e0.has($))return e0.get($);let X=new kH;return X.connected=!0,e0.set($,X),FH({ipcEmitter:X,anyProcess:$,channel:q,isSubprocess:J}),X},e0=new WeakMap,FH=({ipcEmitter:$,anyProcess:q,channel:J,isSubprocess:X})=>{let Z=f8.bind(void 0,{anyProcess:q,channel:J,isSubprocess:X,ipcEmitter:$});q.on("message",Z),q.once("disconnect",h8.bind(void 0,{anyProcess:q,channel:J,isSubprocess:X,ipcEmitter:$,boundOnMessage:Z})),D8(J,X)},$$=($)=>{let q=e0.get($);return q===void 0?$.channel!==null:q.connected};var m8=({anyProcess:$,channel:q,isSubprocess:J,message:X,strict:Z})=>{if(!Z)return X;let H=P1($,q,J),Q=X$($,H);return{id:jH++,type:J$,message:X,hasListeners:Q}},jH=0n,u8=($,q)=>{if(q?.type!==J$||q.hasListeners)return;for(let{id:J}of $)if(J!==void 0)q$[J].resolve({isDeadlock:!0,hasListeners:!1})},S8=async({wrappedMessage:$,anyProcess:q,channel:J,isSubprocess:X,ipcEmitter:Z})=>{if($?.type!==J$||!q.connected)return $;let{id:H,message:Q}=$,Y={id:H,type:l8,message:X$(q,Z)};try{await Z$({anyProcess:q,channel:J,isSubprocess:X,ipc:!0},Y)}catch(G){Z.emit("strict:error",G)}return Q},b8=($)=>{if($?.type!==l8)return!1;let{id:q,message:J}=$;return q$[q]?.resolve({isDeadlock:!1,hasListeners:J}),!0},p8=async($,q,J)=>{if($?.type!==J$)return;let X=$1();q$[$.id]=X;let Z=new AbortController;try{let{isDeadlock:H,hasListeners:Q}=await Promise.race([X,MH(q,J,Z)]);if(H)j8(J);if(!Q)M8(J)}finally{Z.abort(),delete q$[$.id]}},q$={},MH=async($,q,{signal:J})=>{C1($,1,J),await xH($,"disconnect",{signal:J}),C8(q)},J$="execa:ipc:request",l8="execa:ipc:response";var d8=($,q,J)=>{if(!H0.has($))H0.set($,new Set);let X=H0.get($),Z=$1(),H=J?q.id:void 0,Q={onMessageSent:Z,id:H};return X.add(Q),{outgoingMessages:X,outgoingMessage:Q}},i8=({outgoingMessages:$,outgoingMessage:q})=>{$.delete(q),q.onMessageSent.resolve()},g8=async($,q,J)=>{while(!X$($,q)&&H0.get($)?.size>0){let X=[...H0.get($)];u8(X,J),await Promise.all(X.map(({onMessageSent:Z})=>Z))}},H0=new WeakMap,X$=($,q)=>q.listenerCount("message")>CH($),CH=($)=>q1.has($)&&!Y1(q1.get($).options.buffer,"ipc")?1:0;var Z$=({anyProcess:$,channel:q,isSubprocess:J,ipc:X},Z,{strict:H=!1}={})=>{return g1({methodName:"sendMessage",isSubprocess:J,ipc:X,isConnected:$.connected}),IH({anyProcess:$,channel:q,methodName:"sendMessage",isSubprocess:J,message:Z,strict:H})},IH=async({anyProcess:$,channel:q,methodName:J,isSubprocess:X,message:Z,strict:H})=>{let Q=m8({anyProcess:$,channel:q,isSubprocess:X,message:Z,strict:H}),Y=d8($,Q,H);try{await l2({anyProcess:$,methodName:J,isSubprocess:X,wrappedMessage:Q,message:Z})}catch(G){throw c1($),G}finally{i8(Y)}},l2=async({anyProcess:$,methodName:q,isSubprocess:J,wrappedMessage:X,message:Z})=>{let H=AH($);try{await Promise.all([p8(X,$,J),H(X)])}catch(Q){throw A8({error:Q,methodName:q,isSubprocess:J}),E8({error:Q,methodName:q,isSubprocess:J,message:Z}),Q}},AH=($)=>{if(p2.has($))return p2.get($);let q=wH($.send.bind($));return p2.set($,q),q},p2=new WeakMap;var a8=($,q)=>{return g2("cancelSignal",!1,$.connected),l2({anyProcess:$,methodName:"cancelSignal",isSubprocess:!1,wrappedMessage:{type:o8,message:q},message:q})},t8=async({anyProcess:$,channel:q,isSubprocess:J,ipc:X})=>{return await yH({anyProcess:$,channel:q,isSubprocess:J,ipc:X}),d2.signal},yH=async({anyProcess:$,channel:q,isSubprocess:J,ipc:X})=>{if(n8)return;if(n8=!0,!X){I8();return}if(q===null){u2();return}P1($,q,J),await EH.yield()},n8=!1,c8=($)=>{if($?.type!==o8)return!1;return d2.abort($.message),!0},o8="execa:ipc:cancel",u2=()=>{d2.abort(w8())},d2=new AbortController;var r8=({gracefulCancel:$,cancelSignal:q,ipc:J,serialization:X})=>{if(!$)return;if(q===void 0)throw Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!J)throw Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(X==="json")throw Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")},s8=({subprocess:$,cancelSignal:q,gracefulCancel:J,forceKillAfterDelay:X,context:Z,controller:H})=>J?[OH({subprocess:$,cancelSignal:q,forceKillAfterDelay:X,context:Z,controller:H})]:[],OH=async({subprocess:$,cancelSignal:q,forceKillAfterDelay:J,context:X,controller:{signal:Z}})=>{await i0(q,Z);let H=NH(q);throw await a8($,H),b2({kill:$.kill,forceKillAfterDelay:J,context:X,controllerSignal:Z}),X.terminationReason??="gracefulCancel",q.reason},NH=({reason:$})=>{if(!($ instanceof DOMException))return $;let q=Error($.message);return Object.defineProperty(q,"stack",{value:$.stack,enumerable:!1,configurable:!0,writable:!0}),q};import{setTimeout as DH}from"node:timers/promises";var e8=({timeout:$})=>{if($!==void 0&&(!Number.isFinite($)||$<0))throw TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${$}\` (${typeof $})`)},$7=($,q,J,X)=>q===0||q===void 0?[]:[vH($,q,J,X)],vH=async($,q,J,{signal:X})=>{throw await DH(q,void 0,{signal:X}),J.terminationReason??="timeout",$.kill(),new e};import{execPath as fH,execArgv as hH}from"node:process";import q7 from"node:path";var J7=({options:$})=>{if($.node===!1)throw TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...$,node:!0}}},X7=($,q,{node:J=!1,nodePath:X=fH,nodeOptions:Z=hH.filter((G)=>!G.startsWith("--inspect")),cwd:H,execPath:Q,...Y})=>{if(Q!==void 0)throw TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');let G=v1(X,'The "nodePath" option'),K=q7.resolve(H,G),U={...Y,nodePath:K,node:J,cwd:H};if(!J)return[$,q,U];if(q7.basename($,".exe")==="node")throw TypeError('When the "node" option is true, the first argument does not need to be "node".');return[K,[...Z,$,...q],{ipc:!0,...U,shell:!1}]};import{serialize as SH}from"node:v8";var Z7=({ipcInput:$,ipc:q,serialization:J})=>{if($===void 0)return;if(!q)throw Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");cH[J]($)},bH=($)=>{try{SH($)}catch(q){throw Error("The `ipcInput` option is not serializable with a structured clone.",{cause:q})}},gH=($)=>{try{JSON.stringify($)}catch(q){throw Error("The `ipcInput` option is not serializable with JSON.",{cause:q})}},cH={advanced:bH,json:gH},Q7=async($,q)=>{if(q===void 0)return;await $.sendMessage(q)};var Y7=({encoding:$})=>{if(i2.has($))return;let q=uH($);if(q!==void 0)throw TypeError(`Invalid option \`encoding: ${Q$($)}\`.
51
+ Please rename it to ${Q$(q)}.`);let J=[...i2].map((X)=>Q$(X)).join(", ");throw TypeError(`Invalid option \`encoding: ${Q$($)}\`.
52
+ Please rename it to one of: ${J}.`)},mH=new Set(["utf8","utf16le"]),u=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),i2=new Set([...mH,...u]),uH=($)=>{if($===null)return"buffer";if(typeof $!=="string")return;let q=$.toLowerCase();if(q in H7)return H7[q];if(i2.has(q))return q},H7={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},Q$=($)=>typeof $==="string"?`"${$}"`:String($);import{statSync as pH}from"node:fs";import lH from"node:path";import dH from"node:process";var G7=($=K7())=>{let q=v1($,'The "cwd" option');return lH.resolve(q)},K7=()=>{try{return dH.cwd()}catch($){throw $.message=`The current directory does not exist.
53
+ ${$.message}`,$}},U7=($,q)=>{if(q===K7())return $;let J;try{J=pH(q)}catch(X){return`The "cwd" option is invalid: ${q}.
54
54
  ${X.message}
55
55
  ${$}`}if(!J.isDirectory())return`The "cwd" option is not a directory: ${q}.
56
- ${$}`;return $};var X$=($,q,J)=>{J.cwd=Z7(J.cwd);let[X,Z,H]=e8($,q,J),{command:Q,args:Y,options:G}=G7.default._parse(X,Z,H),K=a3(G),U=uH(K);if(t8(U),X7(U),$7(U),_8(U),n8(U),U.shell=V2(U.shell),U.env=pH(U),U.killSignal=B8(U.killSignal),U.forceKillAfterDelay=V8(U.forceKillAfterDelay),U.lines=U.lines.map((B,z)=>B&&!u.has(U.encoding)&&U.buffer[z]),Y7.platform==="win32"&&mH.basename(Q,".exe")==="cmd")Y.unshift("/q");return{file:Q,commandArguments:Y,options:U}},uH=({extendEnv:$=!0,preferLocal:q=!1,cwd:J,localDir:X=J,encoding:Z="utf8",reject:H=!0,cleanup:Q=!0,all:Y=!1,windowsHide:G=!0,killSignal:K="SIGTERM",forceKillAfterDelay:U=!0,gracefulCancel:B=!1,ipcInput:z,ipc:L=z!==void 0||B,serialization:_="advanced",...P})=>({...P,extendEnv:$,preferLocal:q,cwd:J,localDirectory:X,encoding:Z,reject:H,cleanup:Q,all:Y,windowsHide:G,killSignal:K,forceKillAfterDelay:U,gracefulCancel:B,ipcInput:z,ipc:L,serialization:_}),pH=({env:$,extendEnv:q,preferLocal:J,node:X,localDirectory:Z,nodePath:H})=>{let Q=q?{...Y7.env,...$}:$;if(J||X)return q8({env:Q,cwd:Z,execPath:H,preferLocal:J,addExecPath:X});return Q};var Z$=($,q,J)=>J.shell&&q.length>0?[[$,...q].join(" "),[],J]:[$,q,J];import{inspect as x9}from"node:util";function m1($){if(typeof $==="string")return lH($);if(!(ArrayBuffer.isView($)&&$.BYTES_PER_ELEMENT===1))throw Error("Input must be a string or a Uint8Array");return dH($)}var lH=($)=>$.at(-1)===K7?$.slice(0,$.at(-2)===U7?-2:-1):$,dH=($)=>$.at(-1)===iH?$.subarray(0,$.at(-2)===nH?-2:-1):$,K7=`
57
- `,iH=K7.codePointAt(0),U7="\r",nH=U7.codePointAt(0);import{on as P9}from"node:events";import{finished as k9}from"node:stream/promises";function a($,{checkOpen:q=!0}={}){return $!==null&&typeof $==="object"&&($.writable||$.readable||!q||$.writable===void 0&&$.readable===void 0)&&typeof $.pipe==="function"}function l2($,{checkOpen:q=!0}={}){return a($,{checkOpen:q})&&($.writable||!q)&&typeof $.write==="function"&&typeof $.end==="function"&&typeof $.writable==="boolean"&&typeof $.writableObjectMode==="boolean"&&typeof $.destroy==="function"&&typeof $.destroyed==="boolean"}function M1($,{checkOpen:q=!0}={}){return a($,{checkOpen:q})&&($.readable||!q)&&typeof $.read==="function"&&typeof $.readable==="boolean"&&typeof $.readableObjectMode==="boolean"&&typeof $.destroy==="function"&&typeof $.destroyed==="boolean"}function d2($,q){return l2($,q)&&M1($,q)}var aH=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);class B7{#q;#J;#$=!1;#X=void 0;constructor($,q){this.#q=$,this.#J=q}next(){let $=()=>this.#Q();return this.#X=this.#X?this.#X.then($,$):$(),this.#X}return($){let q=()=>this.#Z($);return this.#X?this.#X.then(q,q):q()}async#Q(){if(this.#$)return{done:!0,value:void 0};let $;try{$=await this.#q.read()}catch(q){throw this.#X=void 0,this.#$=!0,this.#q.releaseLock(),q}return $.done&&(this.#X=void 0,this.#$=!0,this.#q.releaseLock()),$}async#Z($){if(this.#$)return{done:!0,value:$};if(this.#$=!0,!this.#J){let q=this.#q.cancel($);return this.#q.releaseLock(),await q,{done:!0,value:$}}return this.#q.releaseLock(),{done:!0,value:$}}}var i2=Symbol();function z7(){return this[i2].next()}Object.defineProperty(z7,"name",{value:"next"});function L7($){return this[i2].return($)}Object.defineProperty(L7,"name",{value:"return"});var tH=Object.create(aH,{next:{enumerable:!0,configurable:!0,writable:!0,value:z7},return:{enumerable:!0,configurable:!0,writable:!0,value:L7}});function n2({preventCancel:$=!1}={}){let q=this.getReader(),J=new B7(q,$),X=Object.create(tH);return X[i2]=J,X}var V7=($)=>{if(M1($,{checkOpen:!1})&&Q0.on!==void 0)return rH($);if(typeof $?.[Symbol.asyncIterator]==="function")return $;if(oH.call($)==="[object ReadableStream]")return n2.call($);throw TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:oH}=Object.prototype,rH=async function*($){let q=new AbortController,J={};sH($,q,J);try{for await(let[X]of Q0.on($,"data",{signal:q.signal}))yield X}catch(X){if(J.error!==void 0)throw J.error;else if(!q.signal.aborted)throw X}finally{$.destroy()}},sH=async($,q,J)=>{try{await Q0.finished($,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(X){J.error=X}finally{q.abort()}},Q0={};var u1=async($,{init:q,convertChunk:J,getSize:X,truncateChunk:Z,addChunk:H,getFinalChunk:Q,finalize:Y},{maxBuffer:G=Number.POSITIVE_INFINITY}={})=>{let K=V7($),U=q();U.length=0;try{for await(let B of K){let z=$9(B),L=J[z](B,U);R7({convertedChunk:L,state:U,getSize:X,truncateChunk:Z,addChunk:H,maxBuffer:G})}return eH({state:U,convertChunk:J,getSize:X,truncateChunk:Z,addChunk:H,getFinalChunk:Q,maxBuffer:G}),Y(U)}catch(B){let z=typeof B==="object"&&B!==null?B:Error(B);throw z.bufferedData=Y(U),z}},eH=({state:$,getSize:q,truncateChunk:J,addChunk:X,getFinalChunk:Z,maxBuffer:H})=>{let Q=Z($);if(Q!==void 0)R7({convertedChunk:Q,state:$,getSize:q,truncateChunk:J,addChunk:X,maxBuffer:H})},R7=({convertedChunk:$,state:q,getSize:J,truncateChunk:X,addChunk:Z,maxBuffer:H})=>{let Q=J($),Y=q.length+Q;if(Y<=H){W7($,q,Z,Y);return}let G=X($,H-q.length);if(G!==void 0)W7(G,q,Z,H);throw new G1},W7=($,q,J,X)=>{q.contents=J($,q,X),q.length=X},$9=($)=>{let q=typeof $;if(q==="string")return"string";if(q!=="object"||$===null)return"others";if(globalThis.Buffer?.isBuffer($))return"buffer";let J=_7.call($);if(J==="[object ArrayBuffer]")return"arrayBuffer";if(J==="[object DataView]")return"dataView";if(Number.isInteger($.byteLength)&&Number.isInteger($.byteOffset)&&_7.call($.buffer)==="[object ArrayBuffer]")return"typedArray";return"others"},{toString:_7}=Object.prototype;class G1 extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}var K1=($)=>$,H0=()=>{return},Q$=({contents:$})=>$,H$=($)=>{throw Error(`Streams in object mode are not supported: ${String($)}`)},Y$=($)=>$.length;async function G$($,q){return u1($,Z9,q)}var q9=()=>({contents:[]}),J9=()=>1,X9=($,{contents:q})=>{return q.push($),q},Z9={init:q9,convertChunk:{string:K1,buffer:K1,arrayBuffer:K1,dataView:K1,typedArray:K1,others:K1},getSize:J9,truncateChunk:H0,addChunk:X9,getFinalChunk:H0,finalize:Q$};async function K$($,q){return u1($,L9,q)}var Q9=()=>({contents:new ArrayBuffer(0)}),H9=($)=>Y9.encode($),Y9=new TextEncoder,T7=($)=>new Uint8Array($),P7=($)=>new Uint8Array($.buffer,$.byteOffset,$.byteLength),G9=($,q)=>$.slice(0,q),K9=($,{contents:q,length:J},X)=>{let Z=j7()?B9(q,X):U9(q,X);return new Uint8Array(Z).set($,J),Z},U9=($,q)=>{if(q<=$.byteLength)return $;let J=new ArrayBuffer(F7(q));return new Uint8Array(J).set(new Uint8Array($),0),J},B9=($,q)=>{if(q<=$.maxByteLength)return $.resize(q),$;let J=new ArrayBuffer(q,{maxByteLength:F7(q)});return new Uint8Array(J).set(new Uint8Array($),0),J},F7=($)=>k7**Math.ceil(Math.log($)/Math.log(k7)),k7=2,z9=({contents:$,length:q})=>j7()?$:$.slice(0,q),j7=()=>("resize"in ArrayBuffer.prototype),L9={init:Q9,convertChunk:{string:H9,buffer:T7,arrayBuffer:T7,dataView:P7,typedArray:P7,others:H$},getSize:Y$,truncateChunk:G9,addChunk:K9,getFinalChunk:H0,finalize:z9};async function B$($,q){return u1($,T9,q)}var V9=()=>({contents:"",textDecoder:new TextDecoder}),U$=($,{textDecoder:q})=>q.decode($,{stream:!0}),W9=($,{contents:q})=>q+$,_9=($,q)=>$.slice(0,q),R9=({textDecoder:$})=>{let q=$.decode();return q===""?void 0:q},T9={init:V9,convertChunk:{string:K1,buffer:U$,arrayBuffer:U$,dataView:U$,typedArray:U$,others:H$},getSize:Y$,truncateChunk:_9,addChunk:W9,getFinalChunk:R9,finalize:Q$};Object.assign(Q0,{on:P9,finished:k9});var x7=({error:$,stream:q,readableObjectMode:J,lines:X,encoding:Z,fdNumber:H})=>{if(!($ instanceof G1))throw $;if(H==="all")return $;let Q=F9(J,X,Z);throw $.maxBufferInfo={fdNumber:H,unit:Q},q.destroy(),$},F9=($,q,J)=>{if($)return"objects";if(q)return"lines";if(J==="buffer")return"bytes";return"characters"},M7=($,q,J)=>{if(q.length!==J)return;let X=new G1;throw X.maxBufferInfo={fdNumber:"ipc"},X},C7=($,q)=>{let{streamName:J,threshold:X,unit:Z}=j9($,q);return`Command's ${J} was larger than ${X} ${Z}`},j9=($,q)=>{if($?.maxBufferInfo===void 0)return{streamName:"output",threshold:q[1],unit:"bytes"};let{maxBufferInfo:{fdNumber:J,unit:X}}=$;delete $.maxBufferInfo;let Z=Y1(q,J);if(J==="ipc")return{streamName:"IPC output",threshold:Z,unit:"messages"};return{streamName:w0(J),threshold:Z,unit:X}},w7=($,q,J)=>$?.code==="ENOBUFS"&&q!==null&&q.some((X)=>X!==null&&X.length>z$(J)),I7=($,q,J)=>{if(!q)return $;let X=z$(J);return $.length>X?$.slice(0,X):$},z$=([,$])=>$;var E7=({stdio:$,all:q,ipcOutput:J,originalError:X,signal:Z,signalDescription:H,exitCode:Q,escapedCommand:Y,timedOut:G,isCanceled:K,isGracefullyCanceled:U,isMaxBuffer:B,isForcefullyTerminated:z,forceKillAfterDelay:L,killSignal:_,maxBuffer:P,timeout:M,cwd:F})=>{let O=X?.code,v=M9({originalError:X,timedOut:G,timeout:M,isMaxBuffer:B,maxBuffer:P,errorCode:O,signal:Z,signalDescription:H,exitCode:Q,isCanceled:K,isGracefullyCanceled:U,isForcefullyTerminated:z,forceKillAfterDelay:L,killSignal:_}),j=w9(X,F),I=j===void 0?"":`
58
- ${j}`,N=`${v}: ${Y}${I}`,c=q===void 0?[$[2],$[1]]:[q],z1=[N,...c,...$.slice(3),J.map((L1)=>I9(L1)).join(`
59
- `)].map((L1)=>q0(m1(A9(L1)))).filter(Boolean).join(`
56
+ ${$}`;return $};var H$=($,q,J)=>{J.cwd=G7(J.cwd);let[X,Z,H]=X7($,q,J),{command:Q,args:Y,options:G}=z7.default._parse(X,Z,H),K=s3(G),U=nH(K);if(e8(U),Y7(U),Z7(U),k8(U),r8(U),U.shell=R2(U.shell),U.env=aH(U),U.killSignal=V8(U.killSignal),U.forceKillAfterDelay=P8(U.forceKillAfterDelay),U.lines=U.lines.map((B,z)=>B&&!u.has(U.encoding)&&U.buffer[z]),B7.platform==="win32"&&iH.basename(Q,".exe")==="cmd")Y.unshift("/q");return{file:Q,commandArguments:Y,options:U}},nH=({extendEnv:$=!0,preferLocal:q=!1,cwd:J,localDir:X=J,encoding:Z="utf8",reject:H=!0,cleanup:Q=!0,all:Y=!1,windowsHide:G=!0,killSignal:K="SIGTERM",forceKillAfterDelay:U=!0,gracefulCancel:B=!1,ipcInput:z,ipc:W=z!==void 0||B,serialization:_="advanced",...T})=>({...T,extendEnv:$,preferLocal:q,cwd:J,localDirectory:X,encoding:Z,reject:H,cleanup:Q,all:Y,windowsHide:G,killSignal:K,forceKillAfterDelay:U,gracefulCancel:B,ipcInput:z,ipc:W,serialization:_}),aH=({env:$,extendEnv:q,preferLocal:J,node:X,localDirectory:Z,nodePath:H})=>{let Q=q?{...B7.env,...$}:$;if(J||X)return Q8({env:Q,cwd:Z,execPath:H,preferLocal:J,addExecPath:X});return Q};var Y$=($,q,J)=>J.shell&&q.length>0?[[$,...q].join(" "),[],J]:[$,q,J];import{inspect as A9}from"node:util";function u1($){if(typeof $==="string")return tH($);if(!(ArrayBuffer.isView($)&&$.BYTES_PER_ELEMENT===1))throw Error("Input must be a string or a Uint8Array");return oH($)}var tH=($)=>$.at(-1)===L7?$.slice(0,$.at(-2)===W7?-2:-1):$,oH=($)=>$.at(-1)===rH?$.subarray(0,$.at(-2)===sH?-2:-1):$,L7=`
57
+ `,rH=L7.codePointAt(0),W7="\r",sH=W7.codePointAt(0);import{on as M9}from"node:events";import{finished as C9}from"node:stream/promises";function o($,{checkOpen:q=!0}={}){return $!==null&&typeof $==="object"&&($.writable||$.readable||!q||$.writable===void 0&&$.readable===void 0)&&typeof $.pipe==="function"}function n2($,{checkOpen:q=!0}={}){return o($,{checkOpen:q})&&($.writable||!q)&&typeof $.write==="function"&&typeof $.end==="function"&&typeof $.writable==="boolean"&&typeof $.writableObjectMode==="boolean"&&typeof $.destroy==="function"&&typeof $.destroyed==="boolean"}function w1($,{checkOpen:q=!0}={}){return o($,{checkOpen:q})&&($.readable||!q)&&typeof $.read==="function"&&typeof $.readable==="boolean"&&typeof $.readableObjectMode==="boolean"&&typeof $.destroy==="function"&&typeof $.destroyed==="boolean"}function a2($,q){return n2($,q)&&w1($,q)}var eH=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);class V7{#q;#J;#$=!1;#X=void 0;constructor($,q){this.#q=$,this.#J=q}next(){let $=()=>this.#Q();return this.#X=this.#X?this.#X.then($,$):$(),this.#X}return($){let q=()=>this.#Z($);return this.#X?this.#X.then(q,q):q()}async#Q(){if(this.#$)return{done:!0,value:void 0};let $;try{$=await this.#q.read()}catch(q){throw this.#X=void 0,this.#$=!0,this.#q.releaseLock(),q}return $.done&&(this.#X=void 0,this.#$=!0,this.#q.releaseLock()),$}async#Z($){if(this.#$)return{done:!0,value:$};if(this.#$=!0,!this.#J){let q=this.#q.cancel($);return this.#q.releaseLock(),await q,{done:!0,value:$}}return this.#q.releaseLock(),{done:!0,value:$}}}var t2=Symbol();function _7(){return this[t2].next()}Object.defineProperty(_7,"name",{value:"next"});function R7($){return this[t2].return($)}Object.defineProperty(R7,"name",{value:"return"});var $9=Object.create(eH,{next:{enumerable:!0,configurable:!0,writable:!0,value:_7},return:{enumerable:!0,configurable:!0,writable:!0,value:R7}});function o2({preventCancel:$=!1}={}){let q=this.getReader(),J=new V7(q,$),X=Object.create($9);return X[t2]=J,X}var P7=($)=>{if(w1($,{checkOpen:!1})&&Y0.on!==void 0)return J9($);if(typeof $?.[Symbol.asyncIterator]==="function")return $;if(q9.call($)==="[object ReadableStream]")return o2.call($);throw TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:q9}=Object.prototype,J9=async function*($){let q=new AbortController,J={};X9($,q,J);try{for await(let[X]of Y0.on($,"data",{signal:q.signal}))yield X}catch(X){if(J.error!==void 0)throw J.error;else if(!q.signal.aborted)throw X}finally{$.destroy()}},X9=async($,q,J)=>{try{await Y0.finished($,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(X){J.error=X}finally{q.abort()}},Y0={};var p1=async($,{init:q,convertChunk:J,getSize:X,truncateChunk:Z,addChunk:H,getFinalChunk:Q,finalize:Y},{maxBuffer:G=Number.POSITIVE_INFINITY}={})=>{let K=P7($),U=q();U.length=0;try{for await(let B of K){let z=Q9(B),W=J[z](B,U);F7({convertedChunk:W,state:U,getSize:X,truncateChunk:Z,addChunk:H,maxBuffer:G})}return Z9({state:U,convertChunk:J,getSize:X,truncateChunk:Z,addChunk:H,getFinalChunk:Q,maxBuffer:G}),Y(U)}catch(B){let z=typeof B==="object"&&B!==null?B:Error(B);throw z.bufferedData=Y(U),z}},Z9=({state:$,getSize:q,truncateChunk:J,addChunk:X,getFinalChunk:Z,maxBuffer:H})=>{let Q=Z($);if(Q!==void 0)F7({convertedChunk:Q,state:$,getSize:q,truncateChunk:J,addChunk:X,maxBuffer:H})},F7=({convertedChunk:$,state:q,getSize:J,truncateChunk:X,addChunk:Z,maxBuffer:H})=>{let Q=J($),Y=q.length+Q;if(Y<=H){T7($,q,Z,Y);return}let G=X($,H-q.length);if(G!==void 0)T7(G,q,Z,H);throw new G1},T7=($,q,J,X)=>{q.contents=J($,q,X),q.length=X},Q9=($)=>{let q=typeof $;if(q==="string")return"string";if(q!=="object"||$===null)return"others";if(globalThis.Buffer?.isBuffer($))return"buffer";let J=k7.call($);if(J==="[object ArrayBuffer]")return"arrayBuffer";if(J==="[object DataView]")return"dataView";if(Number.isInteger($.byteLength)&&Number.isInteger($.byteOffset)&&k7.call($.buffer)==="[object ArrayBuffer]")return"typedArray";return"others"},{toString:k7}=Object.prototype;class G1 extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}var K1=($)=>$,G0=()=>{return},G$=({contents:$})=>$,K$=($)=>{throw Error(`Streams in object mode are not supported: ${String($)}`)},U$=($)=>$.length;async function B$($,q){return p1($,K9,q)}var H9=()=>({contents:[]}),Y9=()=>1,G9=($,{contents:q})=>{return q.push($),q},K9={init:H9,convertChunk:{string:K1,buffer:K1,arrayBuffer:K1,dataView:K1,typedArray:K1,others:K1},getSize:Y9,truncateChunk:G0,addChunk:G9,getFinalChunk:G0,finalize:G$};async function z$($,q){return p1($,P9,q)}var U9=()=>({contents:new ArrayBuffer(0)}),B9=($)=>z9.encode($),z9=new TextEncoder,x7=($)=>new Uint8Array($),j7=($)=>new Uint8Array($.buffer,$.byteOffset,$.byteLength),L9=($,q)=>$.slice(0,q),W9=($,{contents:q,length:J},X)=>{let Z=w7()?_9(q,X):V9(q,X);return new Uint8Array(Z).set($,J),Z},V9=($,q)=>{if(q<=$.byteLength)return $;let J=new ArrayBuffer(C7(q));return new Uint8Array(J).set(new Uint8Array($),0),J},_9=($,q)=>{if(q<=$.maxByteLength)return $.resize(q),$;let J=new ArrayBuffer(q,{maxByteLength:C7(q)});return new Uint8Array(J).set(new Uint8Array($),0),J},C7=($)=>M7**Math.ceil(Math.log($)/Math.log(M7)),M7=2,R9=({contents:$,length:q})=>w7()?$:$.slice(0,q),w7=()=>("resize"in ArrayBuffer.prototype),P9={init:U9,convertChunk:{string:B9,buffer:x7,arrayBuffer:x7,dataView:j7,typedArray:j7,others:K$},getSize:U$,truncateChunk:L9,addChunk:W9,getFinalChunk:G0,finalize:R9};async function W$($,q){return p1($,j9,q)}var T9=()=>({contents:"",textDecoder:new TextDecoder}),L$=($,{textDecoder:q})=>q.decode($,{stream:!0}),k9=($,{contents:q})=>q+$,F9=($,q)=>$.slice(0,q),x9=({textDecoder:$})=>{let q=$.decode();return q===""?void 0:q},j9={init:T9,convertChunk:{string:K1,buffer:L$,arrayBuffer:L$,dataView:L$,typedArray:L$,others:K$},getSize:U$,truncateChunk:F9,addChunk:k9,getFinalChunk:x9,finalize:G$};Object.assign(Y0,{on:M9,finished:C9});var I7=({error:$,stream:q,readableObjectMode:J,lines:X,encoding:Z,fdNumber:H})=>{if(!($ instanceof G1))throw $;if(H==="all")return $;let Q=w9(J,X,Z);throw $.maxBufferInfo={fdNumber:H,unit:Q},q.destroy(),$},w9=($,q,J)=>{if($)return"objects";if(q)return"lines";if(J==="buffer")return"bytes";return"characters"},A7=($,q,J)=>{if(q.length!==J)return;let X=new G1;throw X.maxBufferInfo={fdNumber:"ipc"},X},E7=($,q)=>{let{streamName:J,threshold:X,unit:Z}=I9($,q);return`Command's ${J} was larger than ${X} ${Z}`},I9=($,q)=>{if($?.maxBufferInfo===void 0)return{streamName:"output",threshold:q[1],unit:"bytes"};let{maxBufferInfo:{fdNumber:J,unit:X}}=$;delete $.maxBufferInfo;let Z=Y1(q,J);if(J==="ipc")return{streamName:"IPC output",threshold:Z,unit:"messages"};return{streamName:E0(J),threshold:Z,unit:X}},y7=($,q,J)=>$?.code==="ENOBUFS"&&q!==null&&q.some((X)=>X!==null&&X.length>V$(J)),O7=($,q,J)=>{if(!q)return $;let X=V$(J);return $.length>X?$.slice(0,X):$},V$=([,$])=>$;var D7=({stdio:$,all:q,ipcOutput:J,originalError:X,signal:Z,signalDescription:H,exitCode:Q,escapedCommand:Y,timedOut:G,isCanceled:K,isGracefullyCanceled:U,isMaxBuffer:B,isForcefullyTerminated:z,forceKillAfterDelay:W,killSignal:_,maxBuffer:T,timeout:M,cwd:F})=>{let O=X?.code,v=E9({originalError:X,timedOut:G,timeout:M,isMaxBuffer:B,maxBuffer:T,errorCode:O,signal:Z,signalDescription:H,exitCode:Q,isCanceled:K,isGracefullyCanceled:U,isForcefullyTerminated:z,forceKillAfterDelay:W,killSignal:_}),x=O9(X,F),I=x===void 0?"":`
58
+ ${x}`,N=`${v}: ${Y}${I}`,c=q===void 0?[$[2],$[1]]:[q],L1=[N,...c,...$.slice(3),J.map((W1)=>N9(W1)).join(`
59
+ `)].map((W1)=>X0(u1(D9(W1)))).filter(Boolean).join(`
60
60
 
61
- `);return{originalMessage:j,shortMessage:N,message:z1}},M9=({originalError:$,timedOut:q,timeout:J,isMaxBuffer:X,maxBuffer:Z,errorCode:H,signal:Q,signalDescription:Y,exitCode:G,isCanceled:K,isGracefullyCanceled:U,isForcefullyTerminated:B,forceKillAfterDelay:z,killSignal:L})=>{let _=C9(B,z);if(q)return`Command timed out after ${J} milliseconds${_}`;if(U){if(Q===void 0)return`Command was gracefully canceled with exit code ${G}`;return B?`Command was gracefully canceled${_}`:`Command was gracefully canceled with ${Q} (${Y})`}if(K)return`Command was canceled${_}`;if(X)return`${C7($,Z)}${_}`;if(H!==void 0)return`Command failed with ${H}${_}`;if(B)return`Command was killed with ${L} (${u0(L)})${_}`;if(Q!==void 0)return`Command was killed with ${Q} (${Y})`;if(G!==void 0)return`Command failed with exit code ${G}`;return"Command failed"},C9=($,q)=>$?` and was forcefully terminated after ${q} milliseconds`:"",w9=($,q)=>{if($ instanceof s)return;let J=Z8($)?$.originalMessage:String($?.message??$),X=q0(H7(J,q));return X===""?void 0:X},I9=($)=>typeof $==="string"?$:x9($),A9=($)=>Array.isArray($)?$.map((q)=>m1(A7(q))).filter(Boolean).join(`
62
- `):A7($),A7=($)=>{if(typeof $==="string")return $;if(D($))return M0($);return""};var L$=({command:$,escapedCommand:q,stdio:J,all:X,ipcOutput:Z,options:{cwd:H},startTime:Q})=>y7({command:$,escapedCommand:q,cwd:H,durationMs:j2(Q),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:J[1],stderr:J[2],all:X,stdio:J,ipcOutput:Z,pipedFrom:[]}),p1=({error:$,command:q,escapedCommand:J,fileDescriptors:X,options:Z,startTime:H,isSync:Q})=>Y0({error:$,command:q,escapedCommand:J,startTime:H,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:X.length}),ipcOutput:[],options:Z,isSync:Q}),Y0=({error:$,command:q,escapedCommand:J,startTime:X,timedOut:Z,isCanceled:H,isGracefullyCanceled:Q,isMaxBuffer:Y,isForcefullyTerminated:G,exitCode:K,signal:U,stdio:B,all:z,ipcOutput:L,options:{timeoutDuration:_,timeout:P=_,forceKillAfterDelay:M,killSignal:F,cwd:O,maxBuffer:v},isSync:j})=>{let{exitCode:I,signal:N,signalDescription:c}=y9(K,U),{originalMessage:z1,shortMessage:L1,message:J2}=E7({stdio:B,all:z,ipcOutput:L,originalError:$,signal:N,signalDescription:c,exitCode:I,escapedCommand:J,timedOut:Z,isCanceled:H,isGracefullyCanceled:Q,isMaxBuffer:Y,isForcefullyTerminated:G,forceKillAfterDelay:M,killSignal:F,maxBuffer:v,timeout:P,cwd:O}),s1=J8($,J2,j);return Object.assign(s1,E9({error:s1,command:q,escapedCommand:J,startTime:X,timedOut:Z,isCanceled:H,isGracefullyCanceled:Q,isMaxBuffer:Y,isForcefullyTerminated:G,exitCode:I,signal:N,signalDescription:c,stdio:B,all:z,ipcOutput:L,cwd:O,originalMessage:z1,shortMessage:L1})),s1},E9=({error:$,command:q,escapedCommand:J,startTime:X,timedOut:Z,isCanceled:H,isGracefullyCanceled:Q,isMaxBuffer:Y,isForcefullyTerminated:G,exitCode:K,signal:U,signalDescription:B,stdio:z,all:L,ipcOutput:_,cwd:P,originalMessage:M,shortMessage:F})=>y7({shortMessage:F,originalMessage:M,command:q,escapedCommand:J,cwd:P,durationMs:j2(X),failed:!0,timedOut:Z,isCanceled:H,isGracefullyCanceled:Q,isTerminated:U!==void 0,isMaxBuffer:Y,isForcefullyTerminated:G,exitCode:K,signal:U,signalDescription:B,code:$.cause?.code,stdout:z[1],stderr:z[2],all:L,stdio:z,ipcOutput:_,pipedFrom:[]}),y7=($)=>Object.fromEntries(Object.entries($).filter(([,q])=>q!==void 0)),y9=($,q)=>{let J=$===null?void 0:$,X=q===null?void 0:q,Z=X===void 0?void 0:u0(q);return{exitCode:J,signal:X,signalDescription:Z}};var O7=($)=>Number.isFinite($)?$:0;function O9($){return{days:Math.trunc($/86400000),hours:Math.trunc($/3600000%24),minutes:Math.trunc($/60000%60),seconds:Math.trunc($/1000%60),milliseconds:Math.trunc($%1000),microseconds:Math.trunc(O7($*1000)%1000),nanoseconds:Math.trunc(O7($*1e6)%1000)}}function N9($){return{days:$/86400000n,hours:$/3600000n%24n,minutes:$/60000n%60n,seconds:$/1000n%60n,milliseconds:$%1000n,microseconds:0n,nanoseconds:0n}}function a2($){switch(typeof $){case"number":{if(Number.isFinite($))return O9($);break}case"bigint":return N9($)}throw TypeError("Expected a finite number or bigint")}var D9=($)=>$===0||$===0n,v9=($,q)=>q===1||q===1n?$:`${$}s`,f9=0.0000001,h9=24n*60n*60n*1000n;function t2($,q){let J=typeof $==="bigint";if(!J&&!Number.isFinite($))throw TypeError("Expected a finite number or bigint");q={...q};let X=$<0?"-":"";if($=$<0?-$:$,q.colonNotation)q.compact=!1,q.formatSubMilliseconds=!1,q.separateMilliseconds=!1,q.verbose=!1;if(q.compact)q.unitCount=1,q.secondsDecimalDigits=0,q.millisecondsDecimalDigits=0;let Z=[],H=(U,B)=>{let z=Math.floor(U*10**B+f9);return(Math.round(z)/10**B).toFixed(B)},Q=(U,B,z,L)=>{if((Z.length===0||!q.colonNotation)&&D9(U)&&!(q.colonNotation&&z==="m"))return;if(L??=String(U),q.colonNotation){let _=L.includes(".")?L.split(".")[0].length:L.length,P=Z.length>0?2:1;L="0".repeat(Math.max(0,P-_))+L}else L+=q.verbose?" "+v9(B,U):z;Z.push(L)},Y=a2($),G=BigInt(Y.days);if(q.hideYearAndDays)Q(BigInt(G)*24n+BigInt(Y.hours),"hour","h");else{if(q.hideYear)Q(G,"day","d");else Q(G/365n,"year","y"),Q(G%365n,"day","d");Q(Number(Y.hours),"hour","h")}if(Q(Number(Y.minutes),"minute","m"),!q.hideSeconds)if(q.separateMilliseconds||q.formatSubMilliseconds||!q.colonNotation&&$<1000&&!q.subSecondsAsDecimals){let U=Number(Y.seconds),B=Number(Y.milliseconds),z=Number(Y.microseconds),L=Number(Y.nanoseconds);if(Q(U,"second","s"),q.formatSubMilliseconds)Q(B,"millisecond","ms"),Q(z,"microsecond","µs"),Q(L,"nanosecond","ns");else{let _=B+z/1000+L/1e6,P=typeof q.millisecondsDecimalDigits==="number"?q.millisecondsDecimalDigits:0,M=_>=1?Math.round(_):Math.ceil(_),F=P?_.toFixed(P):M;Q(Number.parseFloat(F),"millisecond","ms",F)}}else{let U=(J?Number($%h9):$)/1000%60,B=typeof q.secondsDecimalDigits==="number"?q.secondsDecimalDigits:1,z=H(U,B),L=q.keepDecimalsOnWholeSeconds?z:z.replace(/\.0+$/,"");Q(Number.parseFloat(L),"second","s",L)}if(Z.length===0)return X+"0"+(q.verbose?" milliseconds":"ms");let K=q.colonNotation?":":" ";if(typeof q.unitCount==="number")Z=Z.slice(0,Math.max(q.unitCount,1));return X+Z.join(K)}var N7=($,q)=>{if($.failed)r({type:"error",verboseMessage:$.shortMessage,verboseInfo:q,result:$})};var D7=($,q)=>{if(!v1(q))return;N7($,q),S9($,q)},S9=($,q)=>{let J=`(done in ${t2($.durationMs)})`;r({type:"duration",verboseMessage:J,verboseInfo:q,result:$})};var l1=($,q,{reject:J})=>{if(D7($,q),$.failed&&J)throw $;return $};import{readFileSync as H5}from"node:fs";var h7=($,q)=>{if(C1($))return"asyncGenerator";if(g7($))return"generator";if(V$($))return"fileUrl";if(u9($))return"filePath";if(d9($))return"webStream";if(a($,{checkOpen:!1}))return"native";if(D($))return"uint8Array";if(i9($))return"asyncIterable";if(n9($))return"iterable";if(s2($))return S7({transform:$},q);if(m9($))return b9($,q);return"native"},b9=($,q)=>{if(d2($.transform,{checkOpen:!1}))return g9($,q);if(s2($.transform))return S7($,q);return c9($,q)},g9=($,q)=>{return b7($,q,"Duplex stream"),"duplex"},S7=($,q)=>{return b7($,q,"web TransformStream"),"webTransform"},b7=({final:$,binary:q,objectMode:J},X,Z)=>{v7($,`${X}.final`,Z),v7(q,`${X}.binary`,Z),o2(J,`${X}.objectMode`)},v7=($,q,J)=>{if($!==void 0)throw TypeError(`The \`${q}\` option can only be defined when using a generator, not a ${J}.`)},c9=({transform:$,final:q,binary:J,objectMode:X},Z)=>{if($!==void 0&&!f7($))throw TypeError(`The \`${Z}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(d2(q,{checkOpen:!1}))throw TypeError(`The \`${Z}.final\` option must not be a Duplex stream.`);if(s2(q))throw TypeError(`The \`${Z}.final\` option must not be a web TransformStream.`);if(q!==void 0&&!f7(q))throw TypeError(`The \`${Z}.final\` option must be a generator.`);return o2(J,`${Z}.binary`),o2(X,`${Z}.objectMode`),C1($)||C1(q)?"asyncGenerator":"generator"},o2=($,q)=>{if($!==void 0&&typeof $!=="boolean")throw TypeError(`The \`${q}\` option must use a boolean.`)},f7=($)=>C1($)||g7($),C1=($)=>Object.prototype.toString.call($)==="[object AsyncGeneratorFunction]",g7=($)=>Object.prototype.toString.call($)==="[object GeneratorFunction]",m9=($)=>E($)&&($.transform!==void 0||$.final!==void 0),V$=($)=>Object.prototype.toString.call($)==="[object URL]",c7=($)=>V$($)&&$.protocol!=="file:",u9=($)=>E($)&&Object.keys($).length>0&&Object.keys($).every((q)=>p9.has(q))&&r2($.file),p9=new Set(["file","append"]),r2=($)=>typeof $==="string",m7=($,q)=>$==="native"&&typeof q==="string"&&!l9.has(q),l9=new Set(["ipc","ignore","inherit","overlapped","pipe"]),u7=($)=>Object.prototype.toString.call($)==="[object ReadableStream]",W$=($)=>Object.prototype.toString.call($)==="[object WritableStream]",d9=($)=>u7($)||W$($),s2=($)=>u7($?.readable)&&W$($?.writable),i9=($)=>p7($)&&typeof $[Symbol.asyncIterator]==="function",n9=($)=>p7($)&&typeof $[Symbol.iterator]==="function",p7=($)=>typeof $==="object"&&$!==null,d=new Set(["generator","asyncGenerator","duplex","webTransform"]),_$=new Set(["fileUrl","filePath","fileNumber"]),e2=new Set(["fileUrl","filePath"]),l7=new Set([...e2,"webStream","nodeStream"]),d7=new Set(["webTransform","duplex"]),T1={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a string",uint8Array:"a Uint8Array"};var $4=($,q,J,X)=>X==="output"?a9($,q,J):t9($,q,J),a9=($,q,J)=>{let X=q!==0&&J[q-1].value.readableObjectMode;return{writableObjectMode:X,readableObjectMode:$??X}},t9=($,q,J)=>{let X=q===0?$===!0:J[q-1].value.readableObjectMode,Z=q!==J.length-1&&($??X);return{writableObjectMode:X,readableObjectMode:Z}},i7=($,q)=>{let J=$.findLast(({type:X})=>d.has(X));if(J===void 0)return!1;return q==="input"?J.value.writableObjectMode:J.value.readableObjectMode};var n7=($,q,J,X)=>[...$.filter(({type:Z})=>!d.has(Z)),...o9($,q,J,X)],o9=($,q,J,{encoding:X})=>{let Z=$.filter(({type:Q})=>d.has(Q)),H=Array.from({length:Z.length});for(let[Q,Y]of Object.entries(Z))H[Q]=r9({stdioItem:Y,index:Number(Q),newTransforms:H,optionName:q,direction:J,encoding:X});return qY(H,J)},r9=({stdioItem:$,stdioItem:{type:q},index:J,newTransforms:X,optionName:Z,direction:H,encoding:Q})=>{if(q==="duplex")return s9({stdioItem:$,optionName:Z});if(q==="webTransform")return e9({stdioItem:$,index:J,newTransforms:X,direction:H});return $Y({stdioItem:$,index:J,newTransforms:X,direction:H,encoding:Q})},s9=({stdioItem:$,stdioItem:{value:{transform:q,transform:{writableObjectMode:J,readableObjectMode:X},objectMode:Z=X}},optionName:H})=>{if(Z&&!X)throw TypeError(`The \`${H}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!Z&&X)throw TypeError(`The \`${H}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...$,value:{transform:q,writableObjectMode:J,readableObjectMode:X}}},e9=({stdioItem:$,stdioItem:{value:q},index:J,newTransforms:X,direction:Z})=>{let{transform:H,objectMode:Q}=E(q)?q:{transform:q},{writableObjectMode:Y,readableObjectMode:G}=$4(Q,J,X,Z);return{...$,value:{transform:H,writableObjectMode:Y,readableObjectMode:G}}},$Y=({stdioItem:$,stdioItem:{value:q},index:J,newTransforms:X,direction:Z,encoding:H})=>{let{transform:Q,final:Y,binary:G=!1,preserveNewlines:K=!1,objectMode:U}=E(q)?q:{transform:q},B=G||u.has(H),{writableObjectMode:z,readableObjectMode:L}=$4(U,J,X,Z);return{...$,value:{transform:Q,final:Y,binary:B,preserveNewlines:K,writableObjectMode:z,readableObjectMode:L}}},qY=($,q)=>q==="input"?$.reverse():$;import q4 from"node:process";var a7=($,q,J)=>{let X=$.map((Z)=>JY(Z,q));if(X.includes("input")&&X.includes("output"))throw TypeError(`The \`${J}\` option must not be an array of both readable and writable values.`);return X.find(Boolean)??QY},JY=({type:$,value:q},J)=>XY[J]??t7[$](q),XY=["input","output","output"],d1=()=>{return},J4=()=>"input",t7={generator:d1,asyncGenerator:d1,fileUrl:d1,filePath:d1,iterable:J4,asyncIterable:J4,uint8Array:J4,webStream:($)=>W$($)?"output":"input",nodeStream($){if(!M1($,{checkOpen:!1}))return"output";return l2($,{checkOpen:!1})?void 0:"input"},webTransform:d1,duplex:d1,native($){let q=ZY($);if(q!==void 0)return q;if(a($,{checkOpen:!1}))return t7.nodeStream($)}},ZY=($)=>{if([0,q4.stdin].includes($))return"input";if([1,2,q4.stdout,q4.stderr].includes($))return"output"},QY="output";var o7=($,q)=>q&&!$.includes("ipc")?[...$,"ipc"]:$;var r7=({stdio:$,ipc:q,buffer:J,...X},Z,H)=>{let Q=HY($,X).map((Y,G)=>s7(Y,G));return H?GY(Q,J,Z):o7(Q,q)},HY=($,q)=>{if($===void 0)return l.map((X)=>q[X]);if(YY(q))throw Error(`It's not possible to provide \`stdio\` in combination with one of ${l.map((X)=>`\`${X}\``).join(", ")}`);if(typeof $==="string")return[$,$,$];if(!Array.isArray($))throw TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof $}\``);let J=Math.max($.length,l.length);return Array.from({length:J},(X,Z)=>$[Z])},YY=($)=>l.some((q)=>$[q]!==void 0),s7=($,q)=>{if(Array.isArray($))return $.map((J)=>s7(J,q));if($===null||$===void 0)return q>=l.length?"ignore":"pipe";return $},GY=($,q,J)=>$.map((X,Z)=>!q[Z]&&Z!==0&&!f1(J,Z)&&KY(X)?"ignore":X),KY=($)=>$==="pipe"||Array.isArray($)&&$.every((q)=>q==="pipe");import{readFileSync as UY}from"node:fs";import BY from"node:tty";var $5=({stdioItem:$,stdioItem:{type:q},isStdioArray:J,fdNumber:X,direction:Z,isSync:H})=>{if(!J||q!=="native")return $;return H?zY({stdioItem:$,fdNumber:X,direction:Z}):WY({stdioItem:$,fdNumber:X})},zY=({stdioItem:$,stdioItem:{value:q,optionName:J},fdNumber:X,direction:Z})=>{let H=LY({value:q,optionName:J,fdNumber:X,direction:Z});if(H!==void 0)return H;if(a(q,{checkOpen:!1}))throw TypeError(`The \`${J}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return $},LY=({value:$,optionName:q,fdNumber:J,direction:X})=>{let Z=VY($,J);if(Z===void 0)return;if(X==="output")return{type:"fileNumber",value:Z,optionName:q};if(BY.isatty(Z))throw TypeError(`The \`${q}: ${d0($)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:H1(UY(Z)),optionName:q}},VY=($,q)=>{if($==="inherit")return q;if(typeof $==="number")return $;let J=C0.indexOf($);if(J!==-1)return J},WY=({stdioItem:$,stdioItem:{value:q,optionName:J},fdNumber:X})=>{if(q==="inherit")return{type:"nodeStream",value:e7(X,q,J),optionName:J};if(typeof q==="number")return{type:"nodeStream",value:e7(q,q,J),optionName:J};if(a(q,{checkOpen:!1}))return{type:"nodeStream",value:q,optionName:J};return $},e7=($,q,J)=>{let X=C0[$];if(X===void 0)throw TypeError(`The \`${J}: ${q}\` option is invalid: no such standard stream.`);return X};var q5=({input:$,inputFile:q},J)=>J===0?[..._Y($),...TY(q)]:[],_Y=($)=>$===void 0?[]:[{type:RY($),value:$,optionName:"input"}],RY=($)=>{if(M1($,{checkOpen:!1}))return"nodeStream";if(typeof $==="string")return"string";if(D($))return"uint8Array";throw Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},TY=($)=>$===void 0?[]:[{...PY($),optionName:"inputFile"}],PY=($)=>{if(V$($))return{type:"fileUrl",value:$};if(r2($))return{type:"filePath",value:{file:$}};throw Error("The `inputFile` option must be a file path string or a file URL.")};var J5=($)=>$.filter((q,J)=>$.every((X,Z)=>q.value!==X.value||J>=Z||q.type==="generator"||q.type==="asyncGenerator")),X5=({stdioItem:{type:$,value:q,optionName:J},direction:X,fileDescriptors:Z,isSync:H})=>{let Q=kY(Z,$);if(Q.length===0)return;if(H){FY({otherStdioItems:Q,type:$,value:q,optionName:J,direction:X});return}if(l7.has($))return Z5({otherStdioItems:Q,type:$,value:q,optionName:J,direction:X});if(d7.has($))xY({otherStdioItems:Q,type:$,value:q,optionName:J})},kY=($,q)=>$.flatMap(({direction:J,stdioItems:X})=>X.filter((Z)=>Z.type===q).map((Z)=>({...Z,direction:J}))),FY=({otherStdioItems:$,type:q,value:J,optionName:X,direction:Z})=>{if(e2.has(q))Z5({otherStdioItems:$,type:q,value:J,optionName:X,direction:Z})},Z5=({otherStdioItems:$,type:q,value:J,optionName:X,direction:Z})=>{let H=$.filter((Y)=>jY(Y,J));if(H.length===0)return;let Q=H.find((Y)=>Y.direction!==Z);return Q5(Q,X,q),Z==="output"?H[0].stream:void 0},jY=({type:$,value:q},J)=>{if($==="filePath")return q.file===J.file;if($==="fileUrl")return q.href===J.href;return q===J},xY=({otherStdioItems:$,type:q,value:J,optionName:X})=>{let Z=$.find(({value:{transform:H}})=>H===J.transform);Q5(Z,X,q)},Q5=($,q,J)=>{if($!==void 0)throw TypeError(`The \`${$.optionName}\` and \`${q}\` options must not target ${T1[J]} that is the same.`)};var R$=($,q,J,X)=>{let H=r7(q,J,X).map((Y,G)=>MY({stdioOption:Y,fdNumber:G,options:q,isSync:X})),Q=NY({initialFileDescriptors:H,addProperties:$,options:q,isSync:X});return q.stdio=Q.map(({stdioItems:Y})=>fY(Y)),Q},MY=({stdioOption:$,fdNumber:q,options:J,isSync:X})=>{let Z=w0(q),{stdioItems:H,isStdioArray:Q}=CY({stdioOption:$,fdNumber:q,options:J,optionName:Z}),Y=a7(H,q,Z),G=H.map((B)=>$5({stdioItem:B,isStdioArray:Q,fdNumber:q,direction:Y,isSync:X})),K=n7(G,Z,Y,J),U=i7(K,Y);return OY(K,U),{direction:Y,objectMode:U,stdioItems:K}},CY=({stdioOption:$,fdNumber:q,options:J,optionName:X})=>{let H=[...(Array.isArray($)?$:[$]).map((G)=>wY(G,X)),...q5(J,q)],Q=J5(H),Y=Q.length>1;return IY(Q,Y,X),EY(Q),{stdioItems:Q,isStdioArray:Y}},wY=($,q)=>({type:h7($,q),value:$,optionName:q}),IY=($,q,J)=>{if($.length===0)throw TypeError(`The \`${J}\` option must not be an empty array.`);if(!q)return;for(let{value:X,optionName:Z}of $)if(AY.has(X))throw Error(`The \`${Z}\` option must not include \`${X}\`.`)},AY=new Set(["ignore","ipc"]),EY=($)=>{for(let q of $)yY(q)},yY=({type:$,value:q,optionName:J})=>{if(c7(q))throw TypeError(`The \`${J}: URL\` option must use the \`file:\` scheme.
63
- For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(m7($,q))throw TypeError(`The \`${J}: { file: '...' }\` option must be used instead of \`${J}: '...'\`.`)},OY=($,q)=>{if(!q)return;let J=$.find(({type:X})=>_$.has(X));if(J!==void 0)throw TypeError(`The \`${J.optionName}\` option cannot use both files and transforms in objectMode.`)},NY=({initialFileDescriptors:$,addProperties:q,options:J,isSync:X})=>{let Z=[];try{for(let H of $)Z.push(DY({fileDescriptor:H,fileDescriptors:Z,addProperties:q,options:J,isSync:X}));return Z}catch(H){throw X4(Z),H}},DY=({fileDescriptor:{direction:$,objectMode:q,stdioItems:J},fileDescriptors:X,addProperties:Z,options:H,isSync:Q})=>{let Y=J.map((G)=>vY({stdioItem:G,addProperties:Z,direction:$,options:H,fileDescriptors:X,isSync:Q}));return{direction:$,objectMode:q,stdioItems:Y}},vY=({stdioItem:$,addProperties:q,direction:J,options:X,fileDescriptors:Z,isSync:H})=>{let Q=X5({stdioItem:$,direction:J,fileDescriptors:Z,isSync:H});if(Q!==void 0)return{...$,stream:Q};return{...$,...q[J][$.type]($,X)}},X4=($)=>{for(let{stdioItems:q}of $)for(let{stream:J}of q)if(J!==void 0&&!i(J))J.destroy()},fY=($)=>{if($.length>1)return $.some(({value:X})=>X==="overlapped")?"overlapped":"pipe";let[{type:q,value:J}]=$;return q==="native"?J:"pipe"};var G5=($,q)=>R$(SY,$,q,!0),q1=({type:$,optionName:q})=>{K5(q,T1[$])},hY=({optionName:$,value:q})=>{if(q==="ipc"||q==="overlapped")K5($,`"${q}"`);return{}},K5=($,q)=>{throw TypeError(`The \`${$}\` option cannot be ${q} with synchronous methods.`)},Y5={generator(){},asyncGenerator:q1,webStream:q1,nodeStream:q1,webTransform:q1,duplex:q1,asyncIterable:q1,native:hY},SY={input:{...Y5,fileUrl:({value:$})=>({contents:[H1(H5($))]}),filePath:({value:{file:$}})=>({contents:[H1(H5($))]}),fileNumber:q1,iterable:({value:$})=>({contents:[...$]}),string:({value:$})=>({contents:[$]}),uint8Array:({value:$})=>({contents:[$]})},output:{...Y5,fileUrl:({value:$})=>({path:$}),filePath:({value:{file:$,append:q}})=>({path:$,append:q}),fileNumber:({value:$})=>({path:$}),iterable:q1,string:q1,uint8Array:q1}};var U1=($,{stripFinalNewline:q},J)=>Z4(q,J)&&$!==void 0&&!Array.isArray($)?m1($):$,Z4=($,q)=>q==="all"?$[1]||$[2]:$[q];import{Transform as ZG,getDefaultHighWaterMark as k5}from"node:stream";var T$=($,q,J,X)=>$||J?void 0:B5(q,X),H4=($,q,J)=>J?$.flatMap((X)=>U5(X,q)):U5($,q),U5=($,q)=>{let{transform:J,final:X}=B5(q,{});return[...J($),...X()]},B5=($,q)=>{return q.previousChunks="",{transform:bY.bind(void 0,q,$),final:cY.bind(void 0,q)}},bY=function*($,q,J){if(typeof J!=="string"){yield J;return}let{previousChunks:X}=$,Z=-1;for(let H=0;H<J.length;H+=1)if(J[H]===`
64
- `){let Q=gY(J,H,q,$),Y=J.slice(Z+1,H+1-Q);if(X.length>0)Y=Q4(X,Y),X="";yield Y,Z=H}if(Z!==J.length-1)X=Q4(X,J.slice(Z+1));$.previousChunks=X},gY=($,q,J,X)=>{if(J)return 0;return X.isWindowsNewline=q!==0&&$[q-1]==="\r",X.isWindowsNewline?2:1},cY=function*({previousChunks:$}){if($.length>0)yield $},z5=({binary:$,preserveNewlines:q,readableObjectMode:J,state:X})=>$||q||J?void 0:{transform:mY.bind(void 0,X)},mY=function*({isWindowsNewline:$=!1},q){let{unixNewline:J,windowsNewline:X,LF:Z,concatBytes:H}=typeof q==="string"?uY:lY;if(q.at(-1)===Z){yield q;return}yield H(q,$?X:J)},Q4=($,q)=>`${$}${q}`,uY={windowsNewline:`\r
61
+ `);return{originalMessage:x,shortMessage:N,message:L1}},E9=({originalError:$,timedOut:q,timeout:J,isMaxBuffer:X,maxBuffer:Z,errorCode:H,signal:Q,signalDescription:Y,exitCode:G,isCanceled:K,isGracefullyCanceled:U,isForcefullyTerminated:B,forceKillAfterDelay:z,killSignal:W})=>{let _=y9(B,z);if(q)return`Command timed out after ${J} milliseconds${_}`;if(U){if(Q===void 0)return`Command was gracefully canceled with exit code ${G}`;return B?`Command was gracefully canceled${_}`:`Command was gracefully canceled with ${Q} (${Y})`}if(K)return`Command was canceled${_}`;if(X)return`${E7($,Z)}${_}`;if(H!==void 0)return`Command failed with ${H}${_}`;if(B)return`Command was killed with ${W} (${d0(W)})${_}`;if(Q!==void 0)return`Command was killed with ${Q} (${Y})`;if(G!==void 0)return`Command failed with exit code ${G}`;return"Command failed"},y9=($,q)=>$?` and was forcefully terminated after ${q} milliseconds`:"",O9=($,q)=>{if($ instanceof e)return;let J=G8($)?$.originalMessage:String($?.message??$),X=X0(U7(J,q));return X===""?void 0:X},N9=($)=>typeof $==="string"?$:A9($),D9=($)=>Array.isArray($)?$.map((q)=>u1(N7(q))).filter(Boolean).join(`
62
+ `):N7($),N7=($)=>{if(typeof $==="string")return $;if(D($))return I0($);return""};var _$=({command:$,escapedCommand:q,stdio:J,all:X,ipcOutput:Z,options:{cwd:H},startTime:Q})=>v7({command:$,escapedCommand:q,cwd:H,durationMs:C2(Q),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:J[1],stderr:J[2],all:X,stdio:J,ipcOutput:Z,pipedFrom:[]}),l1=({error:$,command:q,escapedCommand:J,fileDescriptors:X,options:Z,startTime:H,isSync:Q})=>K0({error:$,command:q,escapedCommand:J,startTime:H,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:X.length}),ipcOutput:[],options:Z,isSync:Q}),K0=({error:$,command:q,escapedCommand:J,startTime:X,timedOut:Z,isCanceled:H,isGracefullyCanceled:Q,isMaxBuffer:Y,isForcefullyTerminated:G,exitCode:K,signal:U,stdio:B,all:z,ipcOutput:W,options:{timeoutDuration:_,timeout:T=_,forceKillAfterDelay:M,killSignal:F,cwd:O,maxBuffer:v},isSync:x})=>{let{exitCode:I,signal:N,signalDescription:c}=f9(K,U),{originalMessage:L1,shortMessage:W1,message:Q2}=D7({stdio:B,all:z,ipcOutput:W,originalError:$,signal:N,signalDescription:c,exitCode:I,escapedCommand:J,timedOut:Z,isCanceled:H,isGracefullyCanceled:Q,isMaxBuffer:Y,isForcefullyTerminated:G,forceKillAfterDelay:M,killSignal:F,maxBuffer:v,timeout:T,cwd:O}),$0=H8($,Q2,x);return Object.assign($0,v9({error:$0,command:q,escapedCommand:J,startTime:X,timedOut:Z,isCanceled:H,isGracefullyCanceled:Q,isMaxBuffer:Y,isForcefullyTerminated:G,exitCode:I,signal:N,signalDescription:c,stdio:B,all:z,ipcOutput:W,cwd:O,originalMessage:L1,shortMessage:W1})),$0},v9=({error:$,command:q,escapedCommand:J,startTime:X,timedOut:Z,isCanceled:H,isGracefullyCanceled:Q,isMaxBuffer:Y,isForcefullyTerminated:G,exitCode:K,signal:U,signalDescription:B,stdio:z,all:W,ipcOutput:_,cwd:T,originalMessage:M,shortMessage:F})=>v7({shortMessage:F,originalMessage:M,command:q,escapedCommand:J,cwd:T,durationMs:C2(X),failed:!0,timedOut:Z,isCanceled:H,isGracefullyCanceled:Q,isTerminated:U!==void 0,isMaxBuffer:Y,isForcefullyTerminated:G,exitCode:K,signal:U,signalDescription:B,code:$.cause?.code,stdout:z[1],stderr:z[2],all:W,stdio:z,ipcOutput:_,pipedFrom:[]}),v7=($)=>Object.fromEntries(Object.entries($).filter(([,q])=>q!==void 0)),f9=($,q)=>{let J=$===null?void 0:$,X=q===null?void 0:q,Z=X===void 0?void 0:d0(q);return{exitCode:J,signal:X,signalDescription:Z}};var f7=($)=>Number.isFinite($)?$:0;function h9($){return{days:Math.trunc($/86400000),hours:Math.trunc($/3600000%24),minutes:Math.trunc($/60000%60),seconds:Math.trunc($/1000%60),milliseconds:Math.trunc($%1000),microseconds:Math.trunc(f7($*1000)%1000),nanoseconds:Math.trunc(f7($*1e6)%1000)}}function S9($){return{days:$/86400000n,hours:$/3600000n%24n,minutes:$/60000n%60n,seconds:$/1000n%60n,milliseconds:$%1000n,microseconds:0n,nanoseconds:0n}}function r2($){switch(typeof $){case"number":{if(Number.isFinite($))return h9($);break}case"bigint":return S9($)}throw TypeError("Expected a finite number or bigint")}var b9=($)=>$===0||$===0n,g9=($,q)=>q===1||q===1n?$:`${$}s`,c9=0.0000001,m9=24n*60n*60n*1000n;function s2($,q){let J=typeof $==="bigint";if(!J&&!Number.isFinite($))throw TypeError("Expected a finite number or bigint");q={...q};let X=$<0?"-":"";if($=$<0?-$:$,q.colonNotation)q.compact=!1,q.formatSubMilliseconds=!1,q.separateMilliseconds=!1,q.verbose=!1;if(q.compact)q.unitCount=1,q.secondsDecimalDigits=0,q.millisecondsDecimalDigits=0;let Z=[],H=(U,B)=>{let z=Math.floor(U*10**B+c9);return(Math.round(z)/10**B).toFixed(B)},Q=(U,B,z,W)=>{if((Z.length===0||!q.colonNotation)&&b9(U)&&!(q.colonNotation&&z==="m"))return;if(W??=String(U),q.colonNotation){let _=W.includes(".")?W.split(".")[0].length:W.length,T=Z.length>0?2:1;W="0".repeat(Math.max(0,T-_))+W}else W+=q.verbose?" "+g9(B,U):z;Z.push(W)},Y=r2($),G=BigInt(Y.days);if(q.hideYearAndDays)Q(BigInt(G)*24n+BigInt(Y.hours),"hour","h");else{if(q.hideYear)Q(G,"day","d");else Q(G/365n,"year","y"),Q(G%365n,"day","d");Q(Number(Y.hours),"hour","h")}if(Q(Number(Y.minutes),"minute","m"),!q.hideSeconds)if(q.separateMilliseconds||q.formatSubMilliseconds||!q.colonNotation&&$<1000&&!q.subSecondsAsDecimals){let U=Number(Y.seconds),B=Number(Y.milliseconds),z=Number(Y.microseconds),W=Number(Y.nanoseconds);if(Q(U,"second","s"),q.formatSubMilliseconds)Q(B,"millisecond","ms"),Q(z,"microsecond","µs"),Q(W,"nanosecond","ns");else{let _=B+z/1000+W/1e6,T=typeof q.millisecondsDecimalDigits==="number"?q.millisecondsDecimalDigits:0,M=_>=1?Math.round(_):Math.ceil(_),F=T?_.toFixed(T):M;Q(Number.parseFloat(F),"millisecond","ms",F)}}else{let U=(J?Number($%m9):$)/1000%60,B=typeof q.secondsDecimalDigits==="number"?q.secondsDecimalDigits:1,z=H(U,B),W=q.keepDecimalsOnWholeSeconds?z:z.replace(/\.0+$/,"");Q(Number.parseFloat(W),"second","s",W)}if(Z.length===0)return X+"0"+(q.verbose?" milliseconds":"ms");let K=q.colonNotation?":":" ";if(typeof q.unitCount==="number")Z=Z.slice(0,Math.max(q.unitCount,1));return X+Z.join(K)}var h7=($,q)=>{if($.failed)s({type:"error",verboseMessage:$.shortMessage,verboseInfo:q,result:$})};var S7=($,q)=>{if(!f1(q))return;h7($,q),u9($,q)},u9=($,q)=>{let J=`(done in ${s2($.durationMs)})`;s({type:"duration",verboseMessage:J,verboseInfo:q,result:$})};var d1=($,q,{reject:J})=>{if(S7($,q),$.failed&&J)throw $;return $};import{readFileSync as U5}from"node:fs";var c7=($,q)=>{if(I1($))return"asyncGenerator";if(p7($))return"generator";if(R$($))return"fileUrl";if(n9($))return"filePath";if(o9($))return"webStream";if(o($,{checkOpen:!1}))return"native";if(D($))return"uint8Array";if(r9($))return"asyncIterable";if(s9($))return"iterable";if(q4($))return m7({transform:$},q);if(i9($))return p9($,q);return"native"},p9=($,q)=>{if(a2($.transform,{checkOpen:!1}))return l9($,q);if(q4($.transform))return m7($,q);return d9($,q)},l9=($,q)=>{return u7($,q,"Duplex stream"),"duplex"},m7=($,q)=>{return u7($,q,"web TransformStream"),"webTransform"},u7=({final:$,binary:q,objectMode:J},X,Z)=>{b7($,`${X}.final`,Z),b7(q,`${X}.binary`,Z),e2(J,`${X}.objectMode`)},b7=($,q,J)=>{if($!==void 0)throw TypeError(`The \`${q}\` option can only be defined when using a generator, not a ${J}.`)},d9=({transform:$,final:q,binary:J,objectMode:X},Z)=>{if($!==void 0&&!g7($))throw TypeError(`The \`${Z}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(a2(q,{checkOpen:!1}))throw TypeError(`The \`${Z}.final\` option must not be a Duplex stream.`);if(q4(q))throw TypeError(`The \`${Z}.final\` option must not be a web TransformStream.`);if(q!==void 0&&!g7(q))throw TypeError(`The \`${Z}.final\` option must be a generator.`);return e2(J,`${Z}.binary`),e2(X,`${Z}.objectMode`),I1($)||I1(q)?"asyncGenerator":"generator"},e2=($,q)=>{if($!==void 0&&typeof $!=="boolean")throw TypeError(`The \`${q}\` option must use a boolean.`)},g7=($)=>I1($)||p7($),I1=($)=>Object.prototype.toString.call($)==="[object AsyncGeneratorFunction]",p7=($)=>Object.prototype.toString.call($)==="[object GeneratorFunction]",i9=($)=>E($)&&($.transform!==void 0||$.final!==void 0),R$=($)=>Object.prototype.toString.call($)==="[object URL]",l7=($)=>R$($)&&$.protocol!=="file:",n9=($)=>E($)&&Object.keys($).length>0&&Object.keys($).every((q)=>a9.has(q))&&$4($.file),a9=new Set(["file","append"]),$4=($)=>typeof $==="string",d7=($,q)=>$==="native"&&typeof q==="string"&&!t9.has(q),t9=new Set(["ipc","ignore","inherit","overlapped","pipe"]),i7=($)=>Object.prototype.toString.call($)==="[object ReadableStream]",P$=($)=>Object.prototype.toString.call($)==="[object WritableStream]",o9=($)=>i7($)||P$($),q4=($)=>i7($?.readable)&&P$($?.writable),r9=($)=>n7($)&&typeof $[Symbol.asyncIterator]==="function",s9=($)=>n7($)&&typeof $[Symbol.iterator]==="function",n7=($)=>typeof $==="object"&&$!==null,d=new Set(["generator","asyncGenerator","duplex","webTransform"]),T$=new Set(["fileUrl","filePath","fileNumber"]),J4=new Set(["fileUrl","filePath"]),a7=new Set([...J4,"webStream","nodeStream"]),t7=new Set(["webTransform","duplex"]),T1={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a string",uint8Array:"a Uint8Array"};var X4=($,q,J,X)=>X==="output"?e9($,q,J):$Y($,q,J),e9=($,q,J)=>{let X=q!==0&&J[q-1].value.readableObjectMode;return{writableObjectMode:X,readableObjectMode:$??X}},$Y=($,q,J)=>{let X=q===0?$===!0:J[q-1].value.readableObjectMode,Z=q!==J.length-1&&($??X);return{writableObjectMode:X,readableObjectMode:Z}},o7=($,q)=>{let J=$.findLast(({type:X})=>d.has(X));if(J===void 0)return!1;return q==="input"?J.value.writableObjectMode:J.value.readableObjectMode};var r7=($,q,J,X)=>[...$.filter(({type:Z})=>!d.has(Z)),...qY($,q,J,X)],qY=($,q,J,{encoding:X})=>{let Z=$.filter(({type:Q})=>d.has(Q)),H=Array.from({length:Z.length});for(let[Q,Y]of Object.entries(Z))H[Q]=JY({stdioItem:Y,index:Number(Q),newTransforms:H,optionName:q,direction:J,encoding:X});return HY(H,J)},JY=({stdioItem:$,stdioItem:{type:q},index:J,newTransforms:X,optionName:Z,direction:H,encoding:Q})=>{if(q==="duplex")return XY({stdioItem:$,optionName:Z});if(q==="webTransform")return ZY({stdioItem:$,index:J,newTransforms:X,direction:H});return QY({stdioItem:$,index:J,newTransforms:X,direction:H,encoding:Q})},XY=({stdioItem:$,stdioItem:{value:{transform:q,transform:{writableObjectMode:J,readableObjectMode:X},objectMode:Z=X}},optionName:H})=>{if(Z&&!X)throw TypeError(`The \`${H}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!Z&&X)throw TypeError(`The \`${H}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...$,value:{transform:q,writableObjectMode:J,readableObjectMode:X}}},ZY=({stdioItem:$,stdioItem:{value:q},index:J,newTransforms:X,direction:Z})=>{let{transform:H,objectMode:Q}=E(q)?q:{transform:q},{writableObjectMode:Y,readableObjectMode:G}=X4(Q,J,X,Z);return{...$,value:{transform:H,writableObjectMode:Y,readableObjectMode:G}}},QY=({stdioItem:$,stdioItem:{value:q},index:J,newTransforms:X,direction:Z,encoding:H})=>{let{transform:Q,final:Y,binary:G=!1,preserveNewlines:K=!1,objectMode:U}=E(q)?q:{transform:q},B=G||u.has(H),{writableObjectMode:z,readableObjectMode:W}=X4(U,J,X,Z);return{...$,value:{transform:Q,final:Y,binary:B,preserveNewlines:K,writableObjectMode:z,readableObjectMode:W}}},HY=($,q)=>q==="input"?$.reverse():$;import Z4 from"node:process";var s7=($,q,J)=>{let X=$.map((Z)=>YY(Z,q));if(X.includes("input")&&X.includes("output"))throw TypeError(`The \`${J}\` option must not be an array of both readable and writable values.`);return X.find(Boolean)??UY},YY=({type:$,value:q},J)=>GY[J]??e7[$](q),GY=["input","output","output"],i1=()=>{return},Q4=()=>"input",e7={generator:i1,asyncGenerator:i1,fileUrl:i1,filePath:i1,iterable:Q4,asyncIterable:Q4,uint8Array:Q4,webStream:($)=>P$($)?"output":"input",nodeStream($){if(!w1($,{checkOpen:!1}))return"output";return n2($,{checkOpen:!1})?void 0:"input"},webTransform:i1,duplex:i1,native($){let q=KY($);if(q!==void 0)return q;if(o($,{checkOpen:!1}))return e7.nodeStream($)}},KY=($)=>{if([0,Z4.stdin].includes($))return"input";if([1,2,Z4.stdout,Z4.stderr].includes($))return"output"},UY="output";var $5=($,q)=>q&&!$.includes("ipc")?[...$,"ipc"]:$;var q5=({stdio:$,ipc:q,buffer:J,...X},Z,H)=>{let Q=BY($,X).map((Y,G)=>J5(Y,G));return H?LY(Q,J,Z):$5(Q,q)},BY=($,q)=>{if($===void 0)return l.map((X)=>q[X]);if(zY(q))throw Error(`It's not possible to provide \`stdio\` in combination with one of ${l.map((X)=>`\`${X}\``).join(", ")}`);if(typeof $==="string")return[$,$,$];if(!Array.isArray($))throw TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof $}\``);let J=Math.max($.length,l.length);return Array.from({length:J},(X,Z)=>$[Z])},zY=($)=>l.some((q)=>$[q]!==void 0),J5=($,q)=>{if(Array.isArray($))return $.map((J)=>J5(J,q));if($===null||$===void 0)return q>=l.length?"ignore":"pipe";return $},LY=($,q,J)=>$.map((X,Z)=>!q[Z]&&Z!==0&&!h1(J,Z)&&WY(X)?"ignore":X),WY=($)=>$==="pipe"||Array.isArray($)&&$.every((q)=>q==="pipe");import{readFileSync as VY}from"node:fs";import _Y from"node:tty";var Z5=({stdioItem:$,stdioItem:{type:q},isStdioArray:J,fdNumber:X,direction:Z,isSync:H})=>{if(!J||q!=="native")return $;return H?RY({stdioItem:$,fdNumber:X,direction:Z}):kY({stdioItem:$,fdNumber:X})},RY=({stdioItem:$,stdioItem:{value:q,optionName:J},fdNumber:X,direction:Z})=>{let H=PY({value:q,optionName:J,fdNumber:X,direction:Z});if(H!==void 0)return H;if(o(q,{checkOpen:!1}))throw TypeError(`The \`${J}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return $},PY=({value:$,optionName:q,fdNumber:J,direction:X})=>{let Z=TY($,J);if(Z===void 0)return;if(X==="output")return{type:"fileNumber",value:Z,optionName:q};if(_Y.isatty(Z))throw TypeError(`The \`${q}: ${a0($)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:H1(VY(Z)),optionName:q}},TY=($,q)=>{if($==="inherit")return q;if(typeof $==="number")return $;let J=A0.indexOf($);if(J!==-1)return J},kY=({stdioItem:$,stdioItem:{value:q,optionName:J},fdNumber:X})=>{if(q==="inherit")return{type:"nodeStream",value:X5(X,q,J),optionName:J};if(typeof q==="number")return{type:"nodeStream",value:X5(q,q,J),optionName:J};if(o(q,{checkOpen:!1}))return{type:"nodeStream",value:q,optionName:J};return $},X5=($,q,J)=>{let X=A0[$];if(X===void 0)throw TypeError(`The \`${J}: ${q}\` option is invalid: no such standard stream.`);return X};var Q5=({input:$,inputFile:q},J)=>J===0?[...FY($),...jY(q)]:[],FY=($)=>$===void 0?[]:[{type:xY($),value:$,optionName:"input"}],xY=($)=>{if(w1($,{checkOpen:!1}))return"nodeStream";if(typeof $==="string")return"string";if(D($))return"uint8Array";throw Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},jY=($)=>$===void 0?[]:[{...MY($),optionName:"inputFile"}],MY=($)=>{if(R$($))return{type:"fileUrl",value:$};if($4($))return{type:"filePath",value:{file:$}};throw Error("The `inputFile` option must be a file path string or a file URL.")};var H5=($)=>$.filter((q,J)=>$.every((X,Z)=>q.value!==X.value||J>=Z||q.type==="generator"||q.type==="asyncGenerator")),Y5=({stdioItem:{type:$,value:q,optionName:J},direction:X,fileDescriptors:Z,isSync:H})=>{let Q=CY(Z,$);if(Q.length===0)return;if(H){wY({otherStdioItems:Q,type:$,value:q,optionName:J,direction:X});return}if(a7.has($))return G5({otherStdioItems:Q,type:$,value:q,optionName:J,direction:X});if(t7.has($))AY({otherStdioItems:Q,type:$,value:q,optionName:J})},CY=($,q)=>$.flatMap(({direction:J,stdioItems:X})=>X.filter((Z)=>Z.type===q).map((Z)=>({...Z,direction:J}))),wY=({otherStdioItems:$,type:q,value:J,optionName:X,direction:Z})=>{if(J4.has(q))G5({otherStdioItems:$,type:q,value:J,optionName:X,direction:Z})},G5=({otherStdioItems:$,type:q,value:J,optionName:X,direction:Z})=>{let H=$.filter((Y)=>IY(Y,J));if(H.length===0)return;let Q=H.find((Y)=>Y.direction!==Z);return K5(Q,X,q),Z==="output"?H[0].stream:void 0},IY=({type:$,value:q},J)=>{if($==="filePath")return q.file===J.file;if($==="fileUrl")return q.href===J.href;return q===J},AY=({otherStdioItems:$,type:q,value:J,optionName:X})=>{let Z=$.find(({value:{transform:H}})=>H===J.transform);K5(Z,X,q)},K5=($,q,J)=>{if($!==void 0)throw TypeError(`The \`${$.optionName}\` and \`${q}\` options must not target ${T1[J]} that is the same.`)};var k$=($,q,J,X)=>{let H=q5(q,J,X).map((Y,G)=>EY({stdioOption:Y,fdNumber:G,options:q,isSync:X})),Q=SY({initialFileDescriptors:H,addProperties:$,options:q,isSync:X});return q.stdio=Q.map(({stdioItems:Y})=>cY(Y)),Q},EY=({stdioOption:$,fdNumber:q,options:J,isSync:X})=>{let Z=E0(q),{stdioItems:H,isStdioArray:Q}=yY({stdioOption:$,fdNumber:q,options:J,optionName:Z}),Y=s7(H,q,Z),G=H.map((B)=>Z5({stdioItem:B,isStdioArray:Q,fdNumber:q,direction:Y,isSync:X})),K=r7(G,Z,Y,J),U=o7(K,Y);return hY(K,U),{direction:Y,objectMode:U,stdioItems:K}},yY=({stdioOption:$,fdNumber:q,options:J,optionName:X})=>{let H=[...(Array.isArray($)?$:[$]).map((G)=>OY(G,X)),...Q5(J,q)],Q=H5(H),Y=Q.length>1;return NY(Q,Y,X),vY(Q),{stdioItems:Q,isStdioArray:Y}},OY=($,q)=>({type:c7($,q),value:$,optionName:q}),NY=($,q,J)=>{if($.length===0)throw TypeError(`The \`${J}\` option must not be an empty array.`);if(!q)return;for(let{value:X,optionName:Z}of $)if(DY.has(X))throw Error(`The \`${Z}\` option must not include \`${X}\`.`)},DY=new Set(["ignore","ipc"]),vY=($)=>{for(let q of $)fY(q)},fY=({type:$,value:q,optionName:J})=>{if(l7(q))throw TypeError(`The \`${J}: URL\` option must use the \`file:\` scheme.
63
+ For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(d7($,q))throw TypeError(`The \`${J}: { file: '...' }\` option must be used instead of \`${J}: '...'\`.`)},hY=($,q)=>{if(!q)return;let J=$.find(({type:X})=>T$.has(X));if(J!==void 0)throw TypeError(`The \`${J.optionName}\` option cannot use both files and transforms in objectMode.`)},SY=({initialFileDescriptors:$,addProperties:q,options:J,isSync:X})=>{let Z=[];try{for(let H of $)Z.push(bY({fileDescriptor:H,fileDescriptors:Z,addProperties:q,options:J,isSync:X}));return Z}catch(H){throw H4(Z),H}},bY=({fileDescriptor:{direction:$,objectMode:q,stdioItems:J},fileDescriptors:X,addProperties:Z,options:H,isSync:Q})=>{let Y=J.map((G)=>gY({stdioItem:G,addProperties:Z,direction:$,options:H,fileDescriptors:X,isSync:Q}));return{direction:$,objectMode:q,stdioItems:Y}},gY=({stdioItem:$,addProperties:q,direction:J,options:X,fileDescriptors:Z,isSync:H})=>{let Q=Y5({stdioItem:$,direction:J,fileDescriptors:Z,isSync:H});if(Q!==void 0)return{...$,stream:Q};return{...$,...q[J][$.type]($,X)}},H4=($)=>{for(let{stdioItems:q}of $)for(let{stream:J}of q)if(J!==void 0&&!a(J))J.destroy()},cY=($)=>{if($.length>1)return $.some(({value:X})=>X==="overlapped")?"overlapped":"pipe";let[{type:q,value:J}]=$;return q==="native"?J:"pipe"};var z5=($,q)=>k$(uY,$,q,!0),J1=({type:$,optionName:q})=>{L5(q,T1[$])},mY=({optionName:$,value:q})=>{if(q==="ipc"||q==="overlapped")L5($,`"${q}"`);return{}},L5=($,q)=>{throw TypeError(`The \`${$}\` option cannot be ${q} with synchronous methods.`)},B5={generator(){},asyncGenerator:J1,webStream:J1,nodeStream:J1,webTransform:J1,duplex:J1,asyncIterable:J1,native:mY},uY={input:{...B5,fileUrl:({value:$})=>({contents:[H1(U5($))]}),filePath:({value:{file:$}})=>({contents:[H1(U5($))]}),fileNumber:J1,iterable:({value:$})=>({contents:[...$]}),string:({value:$})=>({contents:[$]}),uint8Array:({value:$})=>({contents:[$]})},output:{...B5,fileUrl:({value:$})=>({path:$}),filePath:({value:{file:$,append:q}})=>({path:$,append:q}),fileNumber:({value:$})=>({path:$}),iterable:J1,string:J1,uint8Array:J1}};var U1=($,{stripFinalNewline:q},J)=>Y4(q,J)&&$!==void 0&&!Array.isArray($)?u1($):$,Y4=($,q)=>q==="all"?$[1]||$[2]:$[q];import{Transform as KG,getDefaultHighWaterMark as M5}from"node:stream";var F$=($,q,J,X)=>$||J?void 0:V5(q,X),K4=($,q,J)=>J?$.flatMap((X)=>W5(X,q)):W5($,q),W5=($,q)=>{let{transform:J,final:X}=V5(q,{});return[...J($),...X()]},V5=($,q)=>{return q.previousChunks="",{transform:pY.bind(void 0,q,$),final:dY.bind(void 0,q)}},pY=function*($,q,J){if(typeof J!=="string"){yield J;return}let{previousChunks:X}=$,Z=-1;for(let H=0;H<J.length;H+=1)if(J[H]===`
64
+ `){let Q=lY(J,H,q,$),Y=J.slice(Z+1,H+1-Q);if(X.length>0)Y=G4(X,Y),X="";yield Y,Z=H}if(Z!==J.length-1)X=G4(X,J.slice(Z+1));$.previousChunks=X},lY=($,q,J,X)=>{if(J)return 0;return X.isWindowsNewline=q!==0&&$[q-1]==="\r",X.isWindowsNewline?2:1},dY=function*({previousChunks:$}){if($.length>0)yield $},_5=({binary:$,preserveNewlines:q,readableObjectMode:J,state:X})=>$||q||J?void 0:{transform:iY.bind(void 0,X)},iY=function*({isWindowsNewline:$=!1},q){let{unixNewline:J,windowsNewline:X,LF:Z,concatBytes:H}=typeof q==="string"?nY:tY;if(q.at(-1)===Z){yield q;return}yield H(q,$?X:J)},G4=($,q)=>`${$}${q}`,nY={windowsNewline:`\r
65
65
  `,unixNewline:`
66
66
  `,LF:`
67
- `,concatBytes:Q4},pY=($,q)=>{let J=new Uint8Array($.length+q.length);return J.set($,0),J.set(q,$.length),J},lY={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:pY};import{Buffer as dY}from"node:buffer";var L5=($,q)=>$?void 0:iY.bind(void 0,q),iY=function*($,q){if(typeof q!=="string"&&!D(q)&&!dY.isBuffer(q))throw TypeError(`The \`${$}\` option's transform must use "objectMode: true" to receive as input: ${typeof q}.`);yield q},V5=($,q)=>$?nY.bind(void 0,q):aY.bind(void 0,q),nY=function*($,q){W5($,q),yield q},aY=function*($,q){if(W5($,q),typeof q!=="string"&&!D(q))throw TypeError(`The \`${$}\` option's function must yield a string or an Uint8Array, not ${typeof q}.`);yield q},W5=($,q)=>{if(q===null||q===void 0)throw TypeError(`The \`${$}\` option's function must not call \`yield ${q}\`.
67
+ `,concatBytes:G4},aY=($,q)=>{let J=new Uint8Array($.length+q.length);return J.set($,0),J.set(q,$.length),J},tY={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:aY};import{Buffer as oY}from"node:buffer";var R5=($,q)=>$?void 0:rY.bind(void 0,q),rY=function*($,q){if(typeof q!=="string"&&!D(q)&&!oY.isBuffer(q))throw TypeError(`The \`${$}\` option's transform must use "objectMode: true" to receive as input: ${typeof q}.`);yield q},P5=($,q)=>$?sY.bind(void 0,q):eY.bind(void 0,q),sY=function*($,q){T5($,q),yield q},eY=function*($,q){if(T5($,q),typeof q!=="string"&&!D(q))throw TypeError(`The \`${$}\` option's function must yield a string or an Uint8Array, not ${typeof q}.`);yield q},T5=($,q)=>{if(q===null||q===void 0)throw TypeError(`The \`${$}\` option's function must not call \`yield ${q}\`.
68
68
  Instead, \`yield\` should either be called with a value, or not be called at all. For example:
69
- if (condition) { yield value; }`)};import{Buffer as tY}from"node:buffer";import{StringDecoder as oY}from"node:string_decoder";var P$=($,q,J)=>{if(J)return;if($)return{transform:rY.bind(void 0,new TextEncoder)};let X=new oY(q);return{transform:sY.bind(void 0,X),final:eY.bind(void 0,X)}},rY=function*($,q){if(tY.isBuffer(q))yield H1(q);else if(typeof q==="string")yield $.encode(q);else yield q},sY=function*($,q){yield D(q)?$.write(q):q},eY=function*($){let q=$.end();if(q!=="")yield q};import{callbackify as _5}from"node:util";var Y4=_5(async($,q,J,X)=>{q.currentIterable=$(...J);try{for await(let Z of q.currentIterable)X.push(Z)}finally{delete q.currentIterable}}),k$=async function*($,q,J){if(J===q.length){yield $;return}let{transform:X=qG}=q[J];for await(let Z of X($))yield*k$(Z,q,J+1)},R5=async function*($){for(let[q,{final:J}]of Object.entries($))yield*$G(J,Number(q),$)},$G=async function*($,q,J){if($===void 0)return;for await(let X of $())yield*k$(X,J,q+1)},T5=_5(async({currentIterable:$},q)=>{if($!==void 0){await(q?$.throw(q):$.return());return}if(q)throw q}),qG=function*($){yield $};var G4=($,q,J,X)=>{try{for(let Z of $(...q))J.push(Z);X()}catch(Z){X(Z)}},P5=($,q)=>[...q.flatMap((J)=>[...w1(J,$,0)]),...G0($)],w1=function*($,q,J){if(J===q.length){yield $;return}let{transform:X=XG}=q[J];for(let Z of X($))yield*w1(Z,q,J+1)},G0=function*($){for(let[q,{final:J}]of Object.entries($))yield*JG(J,Number(q),$)},JG=function*($,q,J){if($===void 0)return;for(let X of $())yield*w1(X,J,q+1)},XG=function*($){yield $};var K4=({value:$,value:{transform:q,final:J,writableObjectMode:X,readableObjectMode:Z},optionName:H},{encoding:Q})=>{let Y={},G=F5($,Q,H),K=C1(q),U=C1(J),B=K?Y4.bind(void 0,k$,Y):G4.bind(void 0,w1),z=K||U?Y4.bind(void 0,R5,Y):G4.bind(void 0,G0),L=K||U?T5.bind(void 0,Y):void 0;return{stream:new ZG({writableObjectMode:X,writableHighWaterMark:k5(X),readableObjectMode:Z,readableHighWaterMark:k5(Z),transform(P,M,F){B([P,G,0],this,F)},flush(P){z([G],this,P)},destroy:L})}},F$=($,q,J,X)=>{let Z=q.filter(({type:Q})=>Q==="generator"),H=X?Z.reverse():Z;for(let{value:Q,optionName:Y}of H){let G=F5(Q,J,Y);$=P5(G,$)}return $},F5=({transform:$,final:q,binary:J,writableObjectMode:X,readableObjectMode:Z,preserveNewlines:H},Q,Y)=>{let G={};return[{transform:L5(X,Y)},P$(J,Q,X),T$(J,H,X,G),{transform:$,final:q},{transform:V5(Z,Y)},z5({binary:J,preserveNewlines:H,readableObjectMode:Z,state:G})].filter(Boolean)};var j5=($,q)=>{for(let J of QG($))HG($,J,q)},QG=($)=>new Set(Object.entries($).filter(([,{direction:q}])=>q==="input").map(([q])=>Number(q))),HG=($,q,J)=>{let{stdioItems:X}=$[q],Z=X.filter(({contents:Y})=>Y!==void 0);if(Z.length===0)return;if(q!==0){let[{type:Y,optionName:G}]=Z;throw TypeError(`Only the \`stdin\` option, not \`${G}\`, can be ${T1[Y]} with synchronous methods.`)}let Q=Z.map(({contents:Y})=>Y).map((Y)=>YG(Y,X));J.input=$0(Q)},YG=($,q)=>{let J=F$($,q,"utf8",!0);return GG(J),$0(J)},GG=($)=>{let q=$.find((J)=>typeof J!=="string"&&!D(J));if(q!==void 0)throw TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${q}.`)};import{writeFileSync as zG,appendFileSync as LG}from"node:fs";var j$=({stdioItems:$,encoding:q,verboseInfo:J,fdNumber:X})=>X!=="all"&&f1(J,X)&&!u.has(q)&&KG(X)&&($.some(({type:Z,value:H})=>Z==="native"&&UG.has(H))||$.every(({type:Z})=>d.has(Z))),KG=($)=>$===1||$===2,UG=new Set(["pipe","overlapped"]),x5=async($,q,J,X)=>{for await(let Z of $)if(!BG(q))C5(Z,J,X)},M5=($,q,J)=>{for(let X of $)C5(X,q,J)},BG=($)=>$._readableState.pipes.length>0,C5=($,q,J)=>{let X=N0($);r({type:"output",verboseMessage:X,fdNumber:q,verboseInfo:J})};var w5=({fileDescriptors:$,syncResult:{output:q},options:J,isMaxBuffer:X,verboseInfo:Z})=>{if(q===null)return{output:Array.from({length:3})};let H={},Q=new Set([]);return{output:q.map((G,K)=>VG({result:G,fileDescriptors:$,fdNumber:K,state:H,outputFiles:Q,isMaxBuffer:X,verboseInfo:Z},J)),...H}},VG=({result:$,fileDescriptors:q,fdNumber:J,state:X,outputFiles:Z,isMaxBuffer:H,verboseInfo:Q},{buffer:Y,encoding:G,lines:K,stripFinalNewline:U,maxBuffer:B})=>{if($===null)return;let z=I7($,H,B),L=H1(z),{stdioItems:_,objectMode:P}=q[J],M=WG([L],_,G,X),{serializedResult:F,finalResult:O=F}=_G({chunks:M,objectMode:P,encoding:G,lines:K,stripFinalNewline:U,fdNumber:J});RG({serializedResult:F,fdNumber:J,state:X,verboseInfo:Q,encoding:G,stdioItems:_,objectMode:P});let v=Y[J]?O:void 0;try{if(X.error===void 0)TG(F,_,Z);return v}catch(j){return X.error=j,v}},WG=($,q,J,X)=>{try{return F$($,q,J,!1)}catch(Z){return X.error=Z,$}},_G=({chunks:$,objectMode:q,encoding:J,lines:X,stripFinalNewline:Z,fdNumber:H})=>{if(q)return{serializedResult:$};if(J==="buffer")return{serializedResult:$0($)};let Q=m3($,J);if(X[H])return{serializedResult:Q,finalResult:H4(Q,!Z[H],q)};return{serializedResult:Q}},RG=({serializedResult:$,fdNumber:q,state:J,verboseInfo:X,encoding:Z,stdioItems:H,objectMode:Q})=>{if(!j$({stdioItems:H,encoding:Z,verboseInfo:X,fdNumber:q}))return;let Y=H4($,!1,Q);try{M5(Y,q,X)}catch(G){J.error??=G}},TG=($,q,J)=>{for(let{path:X,append:Z}of q.filter(({type:H})=>_$.has(H))){let H=typeof X==="string"?X:X.toString();if(Z||J.has(H))LG(X,$);else J.add(H),zG(X,$)}};var I5=([,$,q],J)=>{if(!J.all)return;if($===void 0)return q;if(q===void 0)return $;if(Array.isArray($))return Array.isArray(q)?[...$,...q]:[...$,U1(q,J,"all")];if(Array.isArray(q))return[U1($,J,"all"),...q];if(D($)&&D(q))return W2([$,q]);return`${$}${q}`};import{once as U4}from"node:events";var A5=async($,q)=>{let[J,X]=await PG($);return q.isForcefullyTerminated??=!1,[J,X]},PG=async($)=>{let[q,J]=await Promise.allSettled([U4($,"spawn"),U4($,"exit")]);if(q.status==="rejected")return[];return J.status==="rejected"?E5($):J.value},E5=async($)=>{try{return await U4($,"exit")}catch{return E5($)}},y5=async($)=>{let[q,J]=await $;if(!kG(q,J)&&B4(q,J))throw new s;return[q,J]},kG=($,q)=>$===void 0&&q===void 0,B4=($,q)=>$!==0||q!==null;var O5=({error:$,status:q,signal:J,output:X},{maxBuffer:Z})=>{let H=FG($,q,J),Q=H?.code==="ETIMEDOUT",Y=w7(H,X,Z);return{resultError:H,exitCode:q,signal:J,timedOut:Q,isMaxBuffer:Y}},FG=($,q,J)=>{if($!==void 0)return $;return B4(q,J)?new s:void 0};var N5=($,q,J)=>{let{file:X,commandArguments:Z,command:H,escapedCommand:Q,startTime:Y,verboseInfo:G,options:K,fileDescriptors:U}=xG($,q,J),B=wG({file:X,commandArguments:Z,options:K,command:H,escapedCommand:Q,verboseInfo:G,fileDescriptors:U,startTime:Y});return l1(B,G,K)},xG=($,q,J)=>{let{command:X,escapedCommand:Z,startTime:H,verboseInfo:Q}=v0($,q,J),Y=MG(J),{file:G,commandArguments:K,options:U}=X$($,q,Y);CG(U);let B=G5(U,Q);return{file:G,commandArguments:K,command:X,escapedCommand:Z,startTime:H,verboseInfo:Q,options:U,fileDescriptors:B}},MG=($)=>$.node&&!$.ipc?{...$,ipc:!1}:$,CG=({ipc:$,ipcInput:q,detached:J,cancelSignal:X})=>{if(q)x$("ipcInput");if($)x$("ipc: true");if(J)x$("detached: true");if(X)x$("cancelSignal")},x$=($)=>{throw TypeError(`The "${$}" option cannot be used with synchronous methods.`)},wG=({file:$,commandArguments:q,options:J,command:X,escapedCommand:Z,verboseInfo:H,fileDescriptors:Q,startTime:Y})=>{let G=IG({file:$,commandArguments:q,options:J,command:X,escapedCommand:Z,fileDescriptors:Q,startTime:Y});if(G.failed)return G;let{resultError:K,exitCode:U,signal:B,timedOut:z,isMaxBuffer:L}=O5(G,J),{output:_,error:P=K}=w5({fileDescriptors:Q,syncResult:G,options:J,isMaxBuffer:L,verboseInfo:H}),M=_.map((O,v)=>U1(O,J,v)),F=U1(I5(_,J),J,"all");return EG({error:P,exitCode:U,signal:B,timedOut:z,isMaxBuffer:L,stdio:M,all:F,options:J,command:X,escapedCommand:Z,startTime:Y})},IG=({file:$,commandArguments:q,options:J,command:X,escapedCommand:Z,fileDescriptors:H,startTime:Q})=>{try{j5(H,J);let Y=AG(J);return jG(...Z$($,q,Y))}catch(Y){return p1({error:Y,command:X,escapedCommand:Z,fileDescriptors:H,options:J,startTime:Q,isSync:!0})}},AG=({encoding:$,maxBuffer:q,...J})=>({...J,encoding:"buffer",maxBuffer:z$(q)}),EG=({error:$,exitCode:q,signal:J,timedOut:X,isMaxBuffer:Z,stdio:H,all:Q,options:Y,command:G,escapedCommand:K,startTime:U})=>$===void 0?L$({command:G,escapedCommand:K,stdio:H,all:Q,ipcOutput:[],options:Y,startTime:U}):Y0({error:$,command:G,escapedCommand:K,timedOut:X,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:Z,isForcefullyTerminated:!1,exitCode:q,signal:J,stdio:H,all:Q,ipcOutput:[],options:Y,startTime:U,isSync:!0});import{setMaxListeners as _U}from"node:events";import{spawn as RU}from"node:child_process";import S5 from"node:process";import{once as z4,on as yG}from"node:events";var D5=({anyProcess:$,channel:q,isSubprocess:J,ipc:X},{reference:Z=!0,filter:H}={})=>{return b1({methodName:"getOneMessage",isSubprocess:J,ipc:X,isConnected:r0($)}),OG({anyProcess:$,channel:q,isSubprocess:J,filter:H,reference:Z})},OG=async({anyProcess:$,channel:q,isSubprocess:J,filter:X,reference:Z})=>{n0(q,Z);let H=R1($,q,J),Q=new AbortController;try{return await Promise.race([NG(H,X,Q),DG(H,J,Q),vG(H,J,Q)])}catch(Y){throw g1($),Y}finally{Q.abort(),a0(q,Z)}},NG=async($,q,{signal:J})=>{if(q===void 0){let[X]=await z4($,"message",{signal:J});return X}for await(let[X]of yG($,"message",{signal:J}))if(q(X))return X},DG=async($,q,{signal:J})=>{await z4($,"disconnect",{signal:J}),T8(q)},vG=async($,q,{signal:J})=>{let[X]=await z4($,"strict:error",{signal:J});throw l0(X,q)};import{once as f5,on as fG}from"node:events";var h5=({anyProcess:$,channel:q,isSubprocess:J,ipc:X},{reference:Z=!0}={})=>L4({anyProcess:$,channel:q,isSubprocess:J,ipc:X,shouldAwait:!J,reference:Z}),L4=({anyProcess:$,channel:q,isSubprocess:J,ipc:X,shouldAwait:Z,reference:H})=>{b1({methodName:"getEachMessage",isSubprocess:J,ipc:X,isConnected:r0($)}),n0(q,H);let Q=R1($,q,J),Y=new AbortController,G={};return hG($,Q,Y),SG({ipcEmitter:Q,isSubprocess:J,controller:Y,state:G}),bG({anyProcess:$,channel:q,ipcEmitter:Q,isSubprocess:J,shouldAwait:Z,controller:Y,state:G,reference:H})},hG=async($,q,J)=>{try{await f5(q,"disconnect",{signal:J.signal}),J.abort()}catch{}},SG=async({ipcEmitter:$,isSubprocess:q,controller:J,state:X})=>{try{let[Z]=await f5($,"strict:error",{signal:J.signal});X.error=l0(Z,q),J.abort()}catch{}},bG=async function*({anyProcess:$,channel:q,ipcEmitter:J,isSubprocess:X,shouldAwait:Z,controller:H,state:Q,reference:Y}){try{for await(let[G]of fG(J,"message",{signal:H.signal}))v5(Q),yield G}catch{v5(Q)}finally{if(H.abort(),a0(q,Y),!X)g1($);if(Z)await $}},v5=({error:$})=>{if($)throw $};var b5=($,{ipc:q})=>{Object.assign($,c5($,!1,q))},g5=()=>{let $=S5,q=!0,J=S5.channel!==void 0;return{...c5($,!0,J),getCancelSignal:d8.bind(void 0,{anyProcess:$,channel:$.channel,isSubprocess:!0,ipc:J})}},c5=($,q,J)=>({sendMessage:q$.bind(void 0,{anyProcess:$,channel:$.channel,isSubprocess:q,ipc:J}),getOneMessage:D5.bind(void 0,{anyProcess:$,channel:$.channel,isSubprocess:q,ipc:J}),getEachMessage:h5.bind(void 0,{anyProcess:$,channel:$.channel,isSubprocess:q,ipc:J})});import{ChildProcess as gG}from"node:child_process";import{PassThrough as cG,Readable as mG,Writable as uG,Duplex as pG}from"node:stream";var m5=({error:$,command:q,escapedCommand:J,fileDescriptors:X,options:Z,startTime:H,verboseInfo:Q})=>{X4(X);let Y=new gG;lG(Y,X),Object.assign(Y,{readable:dG,writable:iG,duplex:nG});let G=p1({error:$,command:q,escapedCommand:J,fileDescriptors:X,options:Z,startTime:H,isSync:!1}),K=aG(G,Q,Z);return{subprocess:Y,promise:K}},lG=($,q)=>{let J=K0(),X=K0(),Z=K0(),H=Array.from({length:q.length-3},K0),Q=K0(),Y=[J,X,Z,...H];Object.assign($,{stdin:J,stdout:X,stderr:Z,all:Q,stdio:Y})},K0=()=>{let $=new cG;return $.end(),$},dG=()=>new mG({read(){}}),iG=()=>new uG({write(){}}),nG=()=>new pG({read(){},write(){}}),aG=async($,q,J)=>l1($,q,J);import{createReadStream as u5,createWriteStream as p5}from"node:fs";import{Buffer as tG}from"node:buffer";import{Readable as U0,Writable as oG,Duplex as rG}from"node:stream";var d5=($,q)=>R$(sG,$,q,!1),B0=({type:$,optionName:q})=>{throw TypeError(`The \`${q}\` option cannot be ${T1[$]}.`)},l5={fileNumber:B0,generator:K4,asyncGenerator:K4,nodeStream:({value:$})=>({stream:$}),webTransform({value:{transform:$,writableObjectMode:q,readableObjectMode:J}}){let X=q||J;return{stream:rG.fromWeb($,{objectMode:X})}},duplex:({value:{transform:$}})=>({stream:$}),native(){}},sG={input:{...l5,fileUrl:({value:$})=>({stream:u5($)}),filePath:({value:{file:$}})=>({stream:u5($)}),webStream:({value:$})=>({stream:U0.fromWeb($)}),iterable:({value:$})=>({stream:U0.from($)}),asyncIterable:({value:$})=>({stream:U0.from($)}),string:({value:$})=>({stream:U0.from($)}),uint8Array:({value:$})=>({stream:U0.from(tG.from($))})},output:{...l5,fileUrl:({value:$})=>({stream:p5($)}),filePath:({value:{file:$,append:q}})=>({stream:p5($,q?{flags:"a"}:{})}),webStream:({value:$})=>({stream:oG.fromWeb($)}),iterable:B0,asyncIterable:B0,string:B0,uint8Array:B0}};import{on as eG,once as i5}from"node:events";import{PassThrough as $K,getDefaultHighWaterMark as qK}from"node:stream";import{finished as t5}from"node:stream/promises";function I1($){if(!Array.isArray($))throw TypeError(`Expected an array, got \`${typeof $}\`.`);for(let Z of $)V4(Z);let q=$.some(({readableObjectMode:Z})=>Z),J=JK($,q),X=new o5({objectMode:q,writableHighWaterMark:J,readableHighWaterMark:J});for(let Z of $)X.add(Z);return X}var JK=($,q)=>{if($.length===0)return qK(q);let J=$.filter(({readableObjectMode:X})=>X===q).map(({readableHighWaterMark:X})=>X);return Math.max(...J)};class o5 extends $K{#q=new Set([]);#J=new Set([]);#$=new Set([]);#X;#Q=Symbol("unpipe");#Z=new WeakMap;add($){if(V4($),this.#q.has($))return;this.#q.add($),this.#X??=XK(this,this.#q,this.#Q);let q=HK({passThroughStream:this,stream:$,streams:this.#q,ended:this.#J,aborted:this.#$,onFinished:this.#X,unpipeEvent:this.#Q});this.#Z.set($,q),$.pipe(this,{end:!1})}async remove($){if(V4($),!this.#q.has($))return!1;let q=this.#Z.get($);if(q===void 0)return!1;return this.#Z.delete($),$.unpipe(this),await q,!0}}var XK=async($,q,J)=>{M$($,n5);let X=new AbortController;try{await Promise.race([ZK($,X),QK($,q,J,X)])}finally{X.abort(),M$($,-n5)}},ZK=async($,{signal:q})=>{try{await t5($,{signal:q,cleanup:!0})}catch(J){throw r5($,J),J}},QK=async($,q,J,{signal:X})=>{for await(let[Z]of eG($,"unpipe",{signal:X}))if(q.has(Z))Z.emit(J)},V4=($)=>{if(typeof $?.pipe!=="function")throw TypeError(`Expected a readable stream, got: \`${typeof $}\`.`)},HK=async({passThroughStream:$,stream:q,streams:J,ended:X,aborted:Z,onFinished:H,unpipeEvent:Q})=>{M$($,a5);let Y=new AbortController;try{await Promise.race([YK(H,q,Y),GK({passThroughStream:$,stream:q,streams:J,ended:X,aborted:Z,controller:Y}),KK({stream:q,streams:J,ended:X,aborted:Z,unpipeEvent:Q,controller:Y})])}finally{Y.abort(),M$($,-a5)}if(J.size>0&&J.size===X.size+Z.size)if(X.size===0&&Z.size>0)W4($);else UK($)},YK=async($,q,{signal:J})=>{try{if(await $,!J.aborted)W4(q)}catch(X){if(!J.aborted)r5(q,X)}},GK=async({passThroughStream:$,stream:q,streams:J,ended:X,aborted:Z,controller:{signal:H}})=>{try{if(await t5(q,{signal:H,cleanup:!0,readable:!0,writable:!1}),J.has(q))X.add(q)}catch(Q){if(H.aborted||!J.has(q))return;if(s5(Q))Z.add(q);else e5($,Q)}},KK=async({stream:$,streams:q,ended:J,aborted:X,unpipeEvent:Z,controller:{signal:H}})=>{if(await i5($,Z,{signal:H}),!$.readable)return i5(H,"abort",{signal:H});q.delete($),J.delete($),X.delete($)},UK=($)=>{if($.writable)$.end()},r5=($,q)=>{if(s5(q))W4($);else e5($,q)},s5=($)=>$?.code==="ERR_STREAM_PREMATURE_CLOSE",W4=($)=>{if($.readable||$.writable)$.destroy()},e5=($,q)=>{if(!$.destroyed)$.once("error",BK),$.destroy(q)},BK=()=>{},M$=($,q)=>{let J=$.getMaxListeners();if(J!==0&&J!==Number.POSITIVE_INFINITY)$.setMaxListeners(J+q)},n5=2,a5=1;import{finished as $q}from"node:stream/promises";var i1=($,q)=>{$.pipe(q),zK($,q),LK($,q)},zK=async($,q)=>{if(i($)||i(q))return;try{await $q($,{cleanup:!0,readable:!0,writable:!1})}catch{}_4(q)},_4=($)=>{if($.writable)$.end()},LK=async($,q)=>{if(i($)||i(q))return;try{await $q(q,{cleanup:!0,readable:!1,writable:!0})}catch{}R4($)},R4=($)=>{if($.readable)$.destroy()};var qq=($,q,J)=>{let X=new Map;for(let[Z,{stdioItems:H,direction:Q}]of Object.entries(q)){for(let{stream:Y}of H.filter(({type:G})=>d.has(G)))VK($,Y,Q,Z);for(let{stream:Y}of H.filter(({type:G})=>!d.has(G)))_K({subprocess:$,stream:Y,direction:Q,fdNumber:Z,pipeGroups:X,controller:J})}for(let[Z,H]of X.entries()){let Q=H.length===1?H[0]:I1(H);i1(Q,Z)}},VK=($,q,J,X)=>{if(J==="output")i1($.stdio[X],q);else i1(q,$.stdio[X]);let Z=WK[X];if(Z!==void 0)$[Z]=q;$.stdio[X]=q},WK=["stdin","stdout","stderr"],_K=({subprocess:$,stream:q,direction:J,fdNumber:X,pipeGroups:Z,controller:H})=>{if(q===void 0)return;RK(q,H);let[Q,Y]=J==="output"?[q,$.stdio[X]]:[$.stdio[X],q],G=Z.get(Q)??[];Z.set(Q,[...G,Y])},RK=($,{signal:q})=>{if(i($))x1($,TK,q)},TK=2;import{addAbortListener as FK}from"node:events";var A1=[];A1.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")A1.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")A1.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var C$=($)=>!!$&&typeof $==="object"&&typeof $.removeListener==="function"&&typeof $.emit==="function"&&typeof $.reallyExit==="function"&&typeof $.listeners==="function"&&typeof $.kill==="function"&&typeof $.pid==="number"&&typeof $.on==="function",T4=Symbol.for("signal-exit emitter"),P4=globalThis,PK=Object.defineProperty.bind(Object);class Jq{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(P4[T4])return P4[T4];PK(P4,T4,{value:this,writable:!1,enumerable:!1,configurable:!1})}on($,q){this.listeners[$].push(q)}removeListener($,q){let J=this.listeners[$],X=J.indexOf(q);if(X===-1)return;if(X===0&&J.length===1)J.length=0;else J.splice(X,1)}emit($,q,J){if(this.emitted[$])return!1;this.emitted[$]=!0;let X=!1;for(let Z of this.listeners[$])X=Z(q,J)===!0||X;if($==="exit")X=this.emit("afterExit",q,J)||X;return X}}class F4{}var kK=($)=>{return{onExit(q,J){return $.onExit(q,J)},load(){return $.load()},unload(){return $.unload()}}};class Xq extends F4{onExit(){return()=>{}}load(){}unload(){}}class Zq extends F4{#q=k4.platform==="win32"?"SIGINT":"SIGHUP";#J=new Jq;#$;#X;#Q;#Z={};#H=!1;constructor($){super();this.#$=$,this.#Z={};for(let q of A1)this.#Z[q]=()=>{let J=this.#$.listeners(q),{count:X}=this.#J,Z=$;if(typeof Z.__signal_exit_emitter__==="object"&&typeof Z.__signal_exit_emitter__.count==="number")X+=Z.__signal_exit_emitter__.count;if(J.length===X){this.unload();let H=this.#J.emit("exit",null,q),Q=q==="SIGHUP"?this.#q:q;if(!H)$.kill($.pid,Q)}};this.#Q=$.reallyExit,this.#X=$.emit}onExit($,q){if(!C$(this.#$))return()=>{};if(this.#H===!1)this.load();let J=q?.alwaysLast?"afterExit":"exit";return this.#J.on(J,$),()=>{if(this.#J.removeListener(J,$),this.#J.listeners.exit.length===0&&this.#J.listeners.afterExit.length===0)this.unload()}}load(){if(this.#H)return;this.#H=!0,this.#J.count+=1;for(let $ of A1)try{let q=this.#Z[$];if(q)this.#$.on($,q)}catch(q){}this.#$.emit=($,...q)=>{return this.#G($,...q)},this.#$.reallyExit=($)=>{return this.#Y($)}}unload(){if(!this.#H)return;this.#H=!1,A1.forEach(($)=>{let q=this.#Z[$];if(!q)throw Error("Listener not defined for signal: "+$);try{this.#$.removeListener($,q)}catch(J){}}),this.#$.emit=this.#X,this.#$.reallyExit=this.#Q,this.#J.count-=1}#Y($){if(!C$(this.#$))return 0;return this.#$.exitCode=$||0,this.#J.emit("exit",this.#$.exitCode,null),this.#Q.call(this.#$,this.#$.exitCode)}#G($,...q){let J=this.#X;if($==="exit"&&C$(this.#$)){if(typeof q[0]==="number")this.#$.exitCode=q[0];let X=J.call(this.#$,$,...q);return this.#J.emit("exit",this.#$.exitCode,null),X}else return J.call(this.#$,$,...q)}}var k4=globalThis.process,{onExit:Qq,load:Dk,unload:vk}=kK(C$(k4)?new Zq(k4):new Xq);var Hq=($,{cleanup:q,detached:J},{signal:X})=>{if(!q||J)return;let Z=Qq(()=>{$.kill()});FK(X,()=>{Z()})};var Gq=({source:$,sourcePromise:q,boundOptions:J,createNested:X},...Z)=>{let H=D0(),{destination:Q,destinationStream:Y,destinationError:G,from:K,unpipeSignal:U}=jK(J,X,Z),{sourceStream:B,sourceError:z}=MK($,K),{options:L,fileDescriptors:_}=$1.get($);return{sourcePromise:q,sourceStream:B,sourceOptions:L,sourceError:z,destination:Q,destinationStream:Y,destinationError:G,unpipeSignal:U,fileDescriptors:_,startTime:H}},jK=($,q,J)=>{try{let{destination:X,pipeOptions:{from:Z,to:H,unpipeSignal:Q}={}}=xK($,q,...J),Y=i0(X,H);return{destination:X,destinationStream:Y,from:Z,unpipeSignal:Q}}catch(X){return{destinationError:X}}},xK=($,q,J,...X)=>{if(Array.isArray(J))return{destination:q(Yq,$)(J,...X),pipeOptions:$};if(typeof J==="string"||J instanceof URL||L2(J)){if(Object.keys($).length>0)throw TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[Z,H,Q]=x0(J,...X);return{destination:q(Yq)(Z,H,Q),pipeOptions:Q}}if($1.has(J)){if(Object.keys($).length>0)throw TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:J,pipeOptions:X[0]}}throw TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${J}`)},Yq=({options:$})=>({options:{...$,stdin:"pipe",piped:!0}}),MK=($,q)=>{try{return{sourceStream:c1($,q)}}catch(J){return{sourceError:J}}};var Uq=({sourceStream:$,sourceError:q,destinationStream:J,destinationError:X,fileDescriptors:Z,sourceOptions:H,startTime:Q})=>{let Y=CK({sourceStream:$,sourceError:q,destinationStream:J,destinationError:X});if(Y!==void 0)throw j4({error:Y,fileDescriptors:Z,sourceOptions:H,startTime:Q})},CK=({sourceStream:$,sourceError:q,destinationStream:J,destinationError:X})=>{if(q!==void 0&&X!==void 0)return X;if(X!==void 0)return R4($),X;if(q!==void 0)return _4(J),q},j4=({error:$,fileDescriptors:q,sourceOptions:J,startTime:X})=>p1({error:$,command:Kq,escapedCommand:Kq,fileDescriptors:q,options:J,startTime:X,isSync:!1}),Kq="source.pipe(destination)";var Bq=async($)=>{let[{status:q,reason:J,value:X=J},{status:Z,reason:H,value:Q=H}]=await $;if(!Q.pipedFrom.includes(X))Q.pipedFrom.push(X);if(Z==="rejected")throw Q;if(q==="rejected")throw X;return Q};import{finished as wK}from"node:stream/promises";var zq=($,q,J)=>{let X=w$.has(q)?AK($,q):IK($,q);return x1($,yK,J.signal),x1(q,OK,J.signal),EK(q),X},IK=($,q)=>{let J=I1([$]);return i1(J,q),w$.set(q,J),J},AK=($,q)=>{let J=w$.get(q);return J.add($),J},EK=async($)=>{try{await wK($,{cleanup:!0,readable:!1,writable:!0})}catch{}w$.delete($)},w$=new WeakMap,yK=2,OK=1;import{aborted as NK}from"node:util";var Lq=($,q)=>$===void 0?[]:[DK($,q)],DK=async($,{sourceStream:q,mergedStream:J,fileDescriptors:X,sourceOptions:Z,startTime:H})=>{await NK($,q),await J.remove(q);let Q=Error("Pipe canceled by `unpipeSignal` option.");throw j4({error:Q,fileDescriptors:X,sourceOptions:Z,startTime:H})};var I$=($,...q)=>{if(E(q[0]))return I$.bind(void 0,{...$,boundOptions:{...$.boundOptions,...q[0]}});let{destination:J,...X}=Gq($,...q),Z=vK({...X,destination:J});return Z.pipe=I$.bind(void 0,{...$,source:J,sourcePromise:Z,boundOptions:{}}),Z},vK=async({sourcePromise:$,sourceStream:q,sourceOptions:J,sourceError:X,destination:Z,destinationStream:H,destinationError:Q,unpipeSignal:Y,fileDescriptors:G,startTime:K})=>{let U=fK($,Z);Uq({sourceStream:q,sourceError:X,destinationStream:H,destinationError:Q,fileDescriptors:G,sourceOptions:J,startTime:K});let B=new AbortController;try{let z=zq(q,H,B);return await Promise.race([Bq(U),...Lq(Y,{sourceStream:q,mergedStream:z,sourceOptions:J,fileDescriptors:G,startTime:K})])}finally{B.abort()}},fK=($,q)=>Promise.allSettled([$,q]);import{setImmediate as uK}from"node:timers/promises";import{on as hK}from"node:events";import{getDefaultHighWaterMark as SK}from"node:stream";var A$=({subprocessStdout:$,subprocess:q,binary:J,shouldEncode:X,encoding:Z,preserveNewlines:H})=>{let Q=new AbortController;return bK(q,Q),Wq({stream:$,controller:Q,binary:J,shouldEncode:!$.readableObjectMode&&X,encoding:Z,shouldSplit:!$.readableObjectMode,preserveNewlines:H})},bK=async($,q)=>{try{await $}catch{}finally{q.abort()}},x4=({stream:$,onStreamEnd:q,lines:J,encoding:X,stripFinalNewline:Z,allMixed:H})=>{let Q=new AbortController;gK(q,Q,$);let Y=$.readableObjectMode&&!H;return Wq({stream:$,controller:Q,binary:X==="buffer",shouldEncode:!Y,encoding:X,shouldSplit:!Y&&J,preserveNewlines:!Z})},gK=async($,q,J)=>{try{await $}catch{J.destroy()}finally{q.abort()}},Wq=({stream:$,controller:q,binary:J,shouldEncode:X,encoding:Z,shouldSplit:H,preserveNewlines:Q})=>{let Y=hK($,"data",{signal:q.signal,highWaterMark:Vq,highWatermark:Vq});return cK({onStdoutChunk:Y,controller:q,binary:J,shouldEncode:X,encoding:Z,shouldSplit:H,preserveNewlines:Q})},M4=SK(!0),Vq=M4,cK=async function*({onStdoutChunk:$,controller:q,binary:J,shouldEncode:X,encoding:Z,shouldSplit:H,preserveNewlines:Q}){let Y=mK({binary:J,shouldEncode:X,encoding:Z,shouldSplit:H,preserveNewlines:Q});try{for await(let[G]of $)yield*w1(G,Y,0)}catch(G){if(!q.signal.aborted)throw G}finally{yield*G0(Y)}},mK=({binary:$,shouldEncode:q,encoding:J,shouldSplit:X,preserveNewlines:Z})=>[P$($,J,!q),T$($,Z,!X,{})].filter(Boolean);var _q=async({stream:$,onStreamEnd:q,fdNumber:J,encoding:X,buffer:Z,maxBuffer:H,lines:Q,allMixed:Y,stripFinalNewline:G,verboseInfo:K,streamInfo:U})=>{let B=pK({stream:$,onStreamEnd:q,fdNumber:J,encoding:X,allMixed:Y,verboseInfo:K,streamInfo:U});if(!Z){await Promise.all([lK($),B]);return}let z=Z4(G,J),L=x4({stream:$,onStreamEnd:q,lines:Q,encoding:X,stripFinalNewline:z,allMixed:Y}),[_]=await Promise.all([dK({stream:$,iterable:L,fdNumber:J,encoding:X,maxBuffer:H,lines:Q}),B]);return _},pK=async({stream:$,onStreamEnd:q,fdNumber:J,encoding:X,allMixed:Z,verboseInfo:H,streamInfo:{fileDescriptors:Q}})=>{if(!j$({stdioItems:Q[J]?.stdioItems,encoding:X,verboseInfo:H,fdNumber:J}))return;let Y=x4({stream:$,onStreamEnd:q,lines:!0,encoding:X,stripFinalNewline:!0,allMixed:Z});await x5(Y,$,J,H)},lK=async($)=>{if(await uK(),$.readableFlowing===null)$.resume()},dK=async({stream:$,stream:{readableObjectMode:q},iterable:J,fdNumber:X,encoding:Z,maxBuffer:H,lines:Q})=>{try{if(q||Q)return await G$(J,{maxBuffer:H});if(Z==="buffer")return new Uint8Array(await K$(J,{maxBuffer:H}));return await B$(J,{maxBuffer:H})}catch(Y){return Rq(x7({error:Y,stream:$,readableObjectMode:q,lines:Q,encoding:Z,fdNumber:X}))}},C4=async($)=>{try{return await $}catch(q){return Rq(q)}},Rq=({bufferedData:$})=>g3($)?new Uint8Array($):$;import{finished as iK}from"node:stream/promises";var z0=async($,q,J,{isSameDirection:X,stopOnExit:Z=!1}={})=>{let H=nK($,J),Q=new AbortController;try{await Promise.race([...Z?[J.exitPromise]:[],iK($,{cleanup:!0,signal:Q.signal})])}catch(Y){if(!H.stdinCleanedUp)oK(Y,q,J,X)}finally{Q.abort()}},nK=($,{originalStreams:[q],subprocess:J})=>{let X={stdinCleanedUp:!1};if($===q)aK($,J,X);return X},aK=($,q,J)=>{let{_destroy:X}=$;$._destroy=(...Z)=>{tK(q,J),X.call($,...Z)}},tK=({exitCode:$,signalCode:q},J)=>{if($!==null||q!==null)J.stdinCleanedUp=!0},oK=($,q,J,X)=>{if(!rK($,q,J,X))throw $},rK=($,q,J,X=!0)=>{if(J.propagating)return Tq($)||E$($);return J.propagating=!0,w4(J,q)===X?Tq($):E$($)},w4=({fileDescriptors:$},q)=>q!=="all"&&$[q].direction==="input",E$=($)=>$?.code==="ERR_STREAM_PREMATURE_CLOSE",Tq=($)=>$?.code==="EPIPE";var Pq=({subprocess:$,encoding:q,buffer:J,maxBuffer:X,lines:Z,stripFinalNewline:H,verboseInfo:Q,streamInfo:Y})=>$.stdio.map((G,K)=>I4({stream:G,fdNumber:K,encoding:q,buffer:J[K],maxBuffer:X[K],lines:Z[K],allMixed:!1,stripFinalNewline:H,verboseInfo:Q,streamInfo:Y})),I4=async({stream:$,fdNumber:q,encoding:J,buffer:X,maxBuffer:Z,lines:H,allMixed:Q,stripFinalNewline:Y,verboseInfo:G,streamInfo:K})=>{if(!$)return;let U=z0($,q,K);if(w4(K,q)){await U;return}let[B]=await Promise.all([_q({stream:$,onStreamEnd:U,fdNumber:q,encoding:J,buffer:X,maxBuffer:Z,lines:H,allMixed:Q,stripFinalNewline:Y,verboseInfo:G,streamInfo:K}),U]);return B};var kq=({stdout:$,stderr:q},{all:J})=>J&&($||q)?I1([$,q].filter(Boolean)):void 0,Fq=({subprocess:$,encoding:q,buffer:J,maxBuffer:X,lines:Z,stripFinalNewline:H,verboseInfo:Q,streamInfo:Y})=>I4({...sK($,J),fdNumber:"all",encoding:q,maxBuffer:X[1]+X[2],lines:Z[1]||Z[2],allMixed:eK($),stripFinalNewline:H,verboseInfo:Q,streamInfo:Y}),sK=({stdout:$,stderr:q,all:J},[,X,Z])=>{let H=X||Z;if(!H)return{stream:J,buffer:H};if(!X)return{stream:q,buffer:H};if(!Z)return{stream:$,buffer:H};return{stream:J,buffer:H}},eK=({all:$,stdout:q,stderr:J})=>$&&q&&J&&q.readableObjectMode!==J.readableObjectMode;import{once as $U}from"node:events";var jq=($)=>f1($,"ipc"),xq=($,q)=>{let J=N0($);r({type:"ipc",verboseMessage:J,fdNumber:"ipc",verboseInfo:q})};var Mq=async({subprocess:$,buffer:q,maxBuffer:J,ipc:X,ipcOutput:Z,verboseInfo:H})=>{if(!X)return Z;let Q=jq(H),Y=Y1(q,"ipc"),G=Y1(J,"ipc");for await(let K of L4({anyProcess:$,channel:$.channel,isSubprocess:!1,ipc:X,shouldAwait:!1,reference:!0})){if(Y)M7($,Z,G),Z.push(K);if(Q)xq(K,H)}return Z},Cq=async($,q)=>{return await Promise.allSettled([$]),q};var wq=async({subprocess:$,options:{encoding:q,buffer:J,maxBuffer:X,lines:Z,timeoutDuration:H,cancelSignal:Q,gracefulCancel:Y,forceKillAfterDelay:G,stripFinalNewline:K,ipc:U,ipcInput:B},context:z,verboseInfo:L,fileDescriptors:_,originalStreams:P,onInternalError:M,controller:F})=>{let O=A5($,z),v={originalStreams:P,fileDescriptors:_,subprocess:$,exitPromise:O,propagating:!1},j=Pq({subprocess:$,encoding:q,buffer:J,maxBuffer:X,lines:Z,stripFinalNewline:K,verboseInfo:L,streamInfo:v}),I=Fq({subprocess:$,encoding:q,buffer:J,maxBuffer:X,lines:Z,stripFinalNewline:K,verboseInfo:L,streamInfo:v}),N=[],c=Mq({subprocess:$,buffer:J,maxBuffer:X,ipc:U,ipcOutput:N,verboseInfo:L}),z1=qU(P,$,v),L1=JU(_,v);try{return await Promise.race([Promise.all([{},y5(O),Promise.all(j),I,c,q7($,B),...z1,...L1]),M,XU($,F),...o8($,H,z,F),...R8({subprocess:$,cancelSignal:Q,gracefulCancel:Y,context:z,controller:F}),...a8({subprocess:$,cancelSignal:Q,gracefulCancel:Y,forceKillAfterDelay:G,context:z,controller:F})])}catch(J2){return z.terminationReason??="other",Promise.all([{error:J2},O,Promise.all(j.map((s1)=>C4(s1))),C4(I),Cq(c,N),Promise.allSettled(z1),Promise.allSettled(L1)])}},qU=($,q,J)=>$.map((X,Z)=>X===q.stdio[Z]?void 0:z0(X,Z,J)),JU=($,q)=>$.flatMap(({stdioItems:J},X)=>J.filter(({value:Z,stream:H=Z})=>a(H,{checkOpen:!1})&&!i(H)).map(({type:Z,value:H,stream:Q=H})=>z0(Q,X,q,{isSameDirection:d.has(Z),stopOnExit:Z==="native"}))),XU=async($,{signal:q})=>{let[J]=await $U($,"error",{signal:q});throw J};var Iq=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),L0=($,q,J)=>{let X=$[J];if(!X.has(q))X.set(q,[]);let Z=X.get(q),H=e();return Z.push(H),{resolve:H.resolve.bind(H),promises:Z}},n1=async({resolve:$,promises:q},J)=>{$();let[X]=await Promise.race([Promise.allSettled([!0,J]),Promise.all([!1,...q])]);return!X};import{Readable as ZU}from"node:stream";import{callbackify as QU}from"node:util";import{finished as Aq}from"node:stream/promises";var A4=async($)=>{if($===void 0)return;try{await E4($)}catch{}},Eq=async($)=>{if($===void 0)return;try{await y4($)}catch{}},E4=async($)=>{await Aq($,{cleanup:!0,readable:!1,writable:!0})},y4=async($)=>{await Aq($,{cleanup:!0,readable:!0,writable:!1})},y$=async($,q)=>{if(await $,q)throw q},O$=($,q,J)=>{if(J&&!E$(J))$.destroy(J);else if(q)$.destroy()};var yq=({subprocess:$,concurrentStreams:q,encoding:J},{from:X,binary:Z=!0,preserveNewlines:H=!0}={})=>{let Q=Z||u.has(J),{subprocessStdout:Y,waitReadableDestroy:G}=O4($,X,q),{readableEncoding:K,readableObjectMode:U,readableHighWaterMark:B}=N4(Y,Q),{read:z,onStdoutDataDone:L}=D4({subprocessStdout:Y,subprocess:$,binary:Q,encoding:J,preserveNewlines:H}),_=new ZU({read:z,destroy:QU(f4.bind(void 0,{subprocessStdout:Y,subprocess:$,waitReadableDestroy:G})),highWaterMark:B,objectMode:U,encoding:K});return v4({subprocessStdout:Y,onStdoutDataDone:L,readable:_,subprocess:$}),_},O4=($,q,J)=>{let X=c1($,q),Z=L0(J,X,"readableDestroy");return{subprocessStdout:X,waitReadableDestroy:Z}},N4=({readableEncoding:$,readableObjectMode:q,readableHighWaterMark:J},X)=>X?{readableEncoding:$,readableObjectMode:q,readableHighWaterMark:J}:{readableEncoding:$,readableObjectMode:!0,readableHighWaterMark:M4},D4=({subprocessStdout:$,subprocess:q,binary:J,encoding:X,preserveNewlines:Z})=>{let H=e(),Q=A$({subprocessStdout:$,subprocess:q,binary:J,shouldEncode:!J,encoding:X,preserveNewlines:Z});return{read(){HU(this,Q,H)},onStdoutDataDone:H}},HU=async($,q,J)=>{try{let{value:X,done:Z}=await q.next();if(Z)J.resolve();else $.push(X)}catch{}},v4=async({subprocessStdout:$,onStdoutDataDone:q,readable:J,subprocess:X,subprocessStdin:Z})=>{try{if(await y4($),await X,await A4(Z),await q,J.readable)J.push(null)}catch(H){await A4(Z),Oq(J,H)}},f4=async({subprocessStdout:$,subprocess:q,waitReadableDestroy:J},X)=>{if(await n1(J,q))Oq($,X),await y$(q,X)},Oq=($,q)=>{O$($,$.readable,q)};import{Writable as YU}from"node:stream";import{callbackify as Nq}from"node:util";var Dq=({subprocess:$,concurrentStreams:q},{to:J}={})=>{let{subprocessStdin:X,waitWritableFinal:Z,waitWritableDestroy:H}=h4($,J,q),Q=new YU({...S4(X,$,Z),destroy:Nq(g4.bind(void 0,{subprocessStdin:X,subprocess:$,waitWritableFinal:Z,waitWritableDestroy:H})),highWaterMark:X.writableHighWaterMark,objectMode:X.writableObjectMode});return b4(X,Q),Q},h4=($,q,J)=>{let X=i0($,q),Z=L0(J,X,"writableFinal"),H=L0(J,X,"writableDestroy");return{subprocessStdin:X,waitWritableFinal:Z,waitWritableDestroy:H}},S4=($,q,J)=>({write:GU.bind(void 0,$),final:Nq(KU.bind(void 0,$,q,J))}),GU=($,q,J,X)=>{if($.write(q,J))X();else $.once("drain",X)},KU=async($,q,J)=>{if(await n1(J,q)){if($.writable)$.end();await q}},b4=async($,q,J)=>{try{if(await E4($),q.writable)q.end()}catch(X){await Eq(J),vq(q,X)}},g4=async({subprocessStdin:$,subprocess:q,waitWritableFinal:J,waitWritableDestroy:X},Z)=>{if(await n1(J,q),await n1(X,q))vq($,Z),await y$(q,Z)},vq=($,q)=>{O$($,$.writable,q)};import{Duplex as UU}from"node:stream";import{callbackify as BU}from"node:util";var fq=({subprocess:$,concurrentStreams:q,encoding:J},{from:X,to:Z,binary:H=!0,preserveNewlines:Q=!0}={})=>{let Y=H||u.has(J),{subprocessStdout:G,waitReadableDestroy:K}=O4($,X,q),{subprocessStdin:U,waitWritableFinal:B,waitWritableDestroy:z}=h4($,Z,q),{readableEncoding:L,readableObjectMode:_,readableHighWaterMark:P}=N4(G,Y),{read:M,onStdoutDataDone:F}=D4({subprocessStdout:G,subprocess:$,binary:Y,encoding:J,preserveNewlines:Q}),O=new UU({read:M,...S4(U,$,B),destroy:BU(zU.bind(void 0,{subprocessStdout:G,subprocessStdin:U,subprocess:$,waitReadableDestroy:K,waitWritableFinal:B,waitWritableDestroy:z})),readableHighWaterMark:P,writableHighWaterMark:U.writableHighWaterMark,readableObjectMode:_,writableObjectMode:U.writableObjectMode,encoding:L});return v4({subprocessStdout:G,onStdoutDataDone:F,readable:O,subprocess:$,subprocessStdin:U}),b4(U,O,G),O},zU=async({subprocessStdout:$,subprocessStdin:q,subprocess:J,waitReadableDestroy:X,waitWritableFinal:Z,waitWritableDestroy:H},Q)=>{await Promise.all([f4({subprocessStdout:$,subprocess:J,waitReadableDestroy:X},Q),g4({subprocessStdin:q,subprocess:J,waitWritableFinal:Z,waitWritableDestroy:H},Q)])};var c4=($,q,{from:J,binary:X=!1,preserveNewlines:Z=!1}={})=>{let H=X||u.has(q),Q=c1($,J),Y=A$({subprocessStdout:Q,subprocess:$,binary:H,shouldEncode:!0,encoding:q,preserveNewlines:Z});return LU(Y,Q,$)},LU=async function*($,q,J){try{yield*$}finally{if(q.readable)q.destroy();await J}};var hq=($,{encoding:q})=>{let J=Iq();$.readable=yq.bind(void 0,{subprocess:$,concurrentStreams:J,encoding:q}),$.writable=Dq.bind(void 0,{subprocess:$,concurrentStreams:J}),$.duplex=fq.bind(void 0,{subprocess:$,concurrentStreams:J,encoding:q}),$.iterable=c4.bind(void 0,$,q),$[Symbol.asyncIterator]=c4.bind(void 0,$,q,{})};var Sq=($,q)=>{for(let[J,X]of WU){let Z=X.value.bind(q);Reflect.defineProperty($,J,{...X,value:Z})}},VU=(async()=>{})().constructor.prototype,WU=["then","catch","finally"].map(($)=>[$,Reflect.getOwnPropertyDescriptor(VU,$)]);var bq=($,q,J,X)=>{let{file:Z,commandArguments:H,command:Q,escapedCommand:Y,startTime:G,verboseInfo:K,options:U,fileDescriptors:B}=TU($,q,J),{subprocess:z,promise:L}=kU({file:Z,commandArguments:H,options:U,startTime:G,verboseInfo:K,command:Q,escapedCommand:Y,fileDescriptors:B});return z.pipe=I$.bind(void 0,{source:z,sourcePromise:L,boundOptions:{},createNested:X}),Sq(z,L),$1.set(z,{options:U,fileDescriptors:B}),z},TU=($,q,J)=>{let{command:X,escapedCommand:Z,startTime:H,verboseInfo:Q}=v0($,q,J),{file:Y,commandArguments:G,options:K}=X$($,q,J),U=PU(K),B=d5(U,Q);return{file:Y,commandArguments:G,command:X,escapedCommand:Z,startTime:H,verboseInfo:Q,options:U,fileDescriptors:B}},PU=({timeout:$,signal:q,...J})=>{if(q!==void 0)throw TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...J,timeoutDuration:$}},kU=({file:$,commandArguments:q,options:J,startTime:X,verboseInfo:Z,command:H,escapedCommand:Q,fileDescriptors:Y})=>{let G;try{G=RU(...Z$($,q,J))}catch(_){return m5({error:_,command:H,escapedCommand:Q,fileDescriptors:Y,options:J,startTime:X,verboseInfo:Z})}let K=new AbortController;_U(Number.POSITIVE_INFINITY,K.signal);let U=[...G.stdio];qq(G,Y,K),Hq(G,J,K);let B={},z=e();G.kill=W8.bind(void 0,{kill:G.kill.bind(G),options:J,onInternalError:z,context:B,controller:K}),G.all=kq(G,J),hq(G,J),b5(G,J);let L=FU({subprocess:G,options:J,startTime:X,verboseInfo:Z,fileDescriptors:Y,originalStreams:U,command:H,escapedCommand:Q,context:B,onInternalError:z,controller:K});return{subprocess:G,promise:L}},FU=async({subprocess:$,options:q,startTime:J,verboseInfo:X,fileDescriptors:Z,originalStreams:H,command:Q,escapedCommand:Y,context:G,onInternalError:K,controller:U})=>{let[B,[z,L],_,P,M]=await wq({subprocess:$,options:q,context:G,verboseInfo:X,fileDescriptors:Z,originalStreams:H,onInternalError:K,controller:U});U.abort(),K.resolve();let F=_.map((j,I)=>U1(j,q,I)),O=U1(P,q,"all"),v=jU({errorInfo:B,exitCode:z,signal:L,stdio:F,all:O,ipcOutput:M,context:G,options:q,command:Q,escapedCommand:Y,startTime:J});return l1(v,X,q)},jU=({errorInfo:$,exitCode:q,signal:J,stdio:X,all:Z,ipcOutput:H,context:Q,options:Y,command:G,escapedCommand:K,startTime:U})=>("error"in $)?Y0({error:$.error,command:G,escapedCommand:K,timedOut:Q.terminationReason==="timeout",isCanceled:Q.terminationReason==="cancel"||Q.terminationReason==="gracefulCancel",isGracefullyCanceled:Q.terminationReason==="gracefulCancel",isMaxBuffer:$.error instanceof G1,isForcefullyTerminated:Q.isForcefullyTerminated,exitCode:q,signal:J,stdio:X,all:Z,ipcOutput:H,options:Y,startTime:U,isSync:!1}):L$({command:G,escapedCommand:K,stdio:X,all:Z,ipcOutput:H,options:Y,startTime:U});var N$=($,q)=>{let J=Object.fromEntries(Object.entries(q).map(([X,Z])=>[X,xU(X,$[X],Z)]));return{...$,...J}},xU=($,q,J)=>{if(MU.has($)&&E(q)&&E(J))return{...q,...J};return J},MU=new Set(["env",...P2]);var P1=($,q,J,X)=>{let Z=(Q,Y,G)=>P1(Q,Y,J,G),H=(...Q)=>CU({mapArguments:$,deepOptions:J,boundOptions:q,setBoundExeca:X,createNested:Z},...Q);if(X!==void 0)X(H,Z,q);return H},CU=({mapArguments:$,deepOptions:q={},boundOptions:J={},setBoundExeca:X,createNested:Z},H,...Q)=>{if(E(H))return Z($,N$(J,H),X);let{file:Y,commandArguments:G,options:K,isSync:U}=wU({mapArguments:$,firstArgument:H,nextArguments:Q,deepOptions:q,boundOptions:J});return U?N5(Y,G,K):bq(Y,G,K,Z)},wU=({mapArguments:$,firstArgument:q,nextArguments:J,deepOptions:X,boundOptions:Z})=>{let H=d3(q)?i3(q,J):[q,...J],[Q,Y,G]=x0(...H),K=N$(N$(X,Z),G),{file:U=Q,commandArguments:B=Y,options:z=K,isSync:L=!1}=$({file:Q,commandArguments:Y,options:K});return{file:U,commandArguments:B,options:z,isSync:L}};var gq=({file:$,commandArguments:q})=>mq($,q),cq=({file:$,commandArguments:q})=>({...mq($,q),isSync:!0}),mq=($,q)=>{if(q.length>0)throw TypeError(`The command and its arguments must be passed as a single string: ${$} ${q}.`);let[J,...X]=IU($);return{file:J,commandArguments:X}},IU=($)=>{if(typeof $!=="string")throw TypeError(`The command must be a string: ${String($)}.`);let q=$.trim();if(q==="")return[];let J=[];for(let X of q.split(AU)){let Z=J.at(-1);if(Z&&Z.endsWith("\\"))J[J.length-1]=`${Z.slice(0,-1)} ${X}`;else J.push(X)}return J},AU=/ +/g;var uq=($,q,J)=>{$.sync=q(EU,J),$.s=$.sync},pq=({options:$})=>lq($),EU=({options:$})=>({...lq($),isSync:!0}),lq=($)=>({options:{...yU($),...$}}),yU=({input:$,inputFile:q,stdio:J})=>$===void 0&&q===void 0&&J===void 0?{stdin:"inherit"}:{},dq={preferLocal:!0};var h=P1(()=>({})),xx=P1(()=>({isSync:!0})),Mx=P1(gq),Cx=P1(cq),wx=P1(s8),Ix=P1(pq,{},dq,uq),{sendMessage:Ax,getOneMessage:Ex,getEachMessage:yx,getCancelSignal:Ox}=g5();import{access as iq,readFile as aq}from"fs/promises";import{join as m4,dirname as nq}from"path";async function D$(){if(process.env.IDF_PATH)try{return await iq(process.env.IDF_PATH),process.env.IDF_PATH}catch{}try{return await iq(B2),B2}catch{}return null}async function v$($){let q=m4($,"version.txt");try{return(await aq(q,"utf-8")).trim()}catch{}try{return(await h("git",["describe","--tags"],{cwd:$})).stdout.trim()}catch{}return null}async function tq(){let $=await D$();if(!$)return{installed:!1};let q=await v$($);return{installed:!0,path:$,version:q||void 0}}async function E1($){let q=m4($,"CMakeLists.txt");try{let J=await aq(q,"utf-8");return J.includes("$ENV{IDF_PATH}")||J.includes("idf_component_register")}catch{return!1}}async function J1($){let q=$;while(q!==nq(q)){if(await E1(q))return q;q=nq(q)}return null}function u4($){return m4($,"export.sh")}async function p4($,q,J={}){let{cwd:X,operationId:Z,env:H}=J,Q={cwd:X,env:{...process.env,...H},reject:!1};try{let Y=h($,q,Q);if(Z)Y.stdout?.on("data",(K)=>{R.emit(Z,{type:"stdout",text:K.toString()})}),Y.stderr?.on("data",(K)=>{R.emit(Z,{type:"stderr",text:K.toString()})});let G=await Y;return{ok:!0,data:{stdout:String(G.stdout??""),stderr:String(G.stderr??""),exitCode:G.exitCode??0}}}catch(Y){return{ok:!1,error:`Failed to execute ${$}: ${Y}`}}}async function X1($,q,J={}){let X=await D$();if(!X)return{ok:!1,error:"ESP-IDF not found. Run `espcli install` first.",code:"IDF_NOT_FOUND"};let H=`source ${u4(X)} > /dev/null 2>&1 && ${$} ${q.join(" ")}`,{cwd:Q,operationId:Y,env:G}=J,K={cwd:Q,env:{...process.env,...G},shell:!0,reject:!1};try{let U=h(H,[],K);if(Y)U.stdout?.on("data",(z)=>{R.emit(Y,{type:"stdout",text:z.toString()})}),U.stderr?.on("data",(z)=>{R.emit(Y,{type:"stderr",text:z.toString()})});let B=await U;return{ok:!0,data:{stdout:String(B.stdout??""),stderr:String(B.stderr??""),exitCode:B.exitCode??0}}}catch(U){return{ok:!1,error:`Failed to execute ${$}: ${U}`}}}async function oq($,q,J={}){let X=await D$();if(!X)return null;let H=`source ${u4(X)} > /dev/null 2>&1 && ${$} ${q.join(" ")}`,{cwd:Q,operationId:Y,env:G,interactive:K}=J,U=h(H,[],{cwd:Q,env:{...process.env,...G},shell:!0,reject:!1,stdin:K?"inherit":"pipe",stdout:K?"inherit":"pipe",stderr:K?"inherit":"pipe"});if(Y&&!K)U.stdout?.on("data",(z)=>{R.emit(Y,{type:"stdout",text:z.toString()})}),U.stderr?.on("data",(z)=>{R.emit(Y,{type:"stderr",text:z.toString()})});let B=U.then(()=>{});return{proc:U,promise:B}}import{homedir as OU}from"os";import{join as NU}from"path";import{readFile as DU,appendFile as vU,access as ix}from"fs/promises";function rq(){let $=process.env.SHELL||"";if($.includes("zsh"))return"zsh";if($.includes("bash"))return"bash";if($.includes("fish"))return"fish";return"unknown"}function f$(){let $=rq(),q=f3[$]||"",J=q?NU(OU(),q):"";return{type:$,configPath:J}}async function fU($){let{configPath:q}=f$();if(!q)return!1;try{return(await DU(q,"utf-8")).includes($)}catch{return!1}}async function sq($){let{configPath:q,type:J}=f$();if(!q)return{ok:!1,error:`Unsupported shell: ${J}`};if(await fU($))return{ok:!0,data:void 0};try{return await vU(q,`
69
+ if (condition) { yield value; }`)};import{Buffer as $G}from"node:buffer";import{StringDecoder as qG}from"node:string_decoder";var x$=($,q,J)=>{if(J)return;if($)return{transform:JG.bind(void 0,new TextEncoder)};let X=new qG(q);return{transform:XG.bind(void 0,X),final:ZG.bind(void 0,X)}},JG=function*($,q){if($G.isBuffer(q))yield H1(q);else if(typeof q==="string")yield $.encode(q);else yield q},XG=function*($,q){yield D(q)?$.write(q):q},ZG=function*($){let q=$.end();if(q!=="")yield q};import{callbackify as k5}from"node:util";var U4=k5(async($,q,J,X)=>{q.currentIterable=$(...J);try{for await(let Z of q.currentIterable)X.push(Z)}finally{delete q.currentIterable}}),j$=async function*($,q,J){if(J===q.length){yield $;return}let{transform:X=HG}=q[J];for await(let Z of X($))yield*j$(Z,q,J+1)},F5=async function*($){for(let[q,{final:J}]of Object.entries($))yield*QG(J,Number(q),$)},QG=async function*($,q,J){if($===void 0)return;for await(let X of $())yield*j$(X,J,q+1)},x5=k5(async({currentIterable:$},q)=>{if($!==void 0){await(q?$.throw(q):$.return());return}if(q)throw q}),HG=function*($){yield $};var B4=($,q,J,X)=>{try{for(let Z of $(...q))J.push(Z);X()}catch(Z){X(Z)}},j5=($,q)=>[...q.flatMap((J)=>[...A1(J,$,0)]),...U0($)],A1=function*($,q,J){if(J===q.length){yield $;return}let{transform:X=GG}=q[J];for(let Z of X($))yield*A1(Z,q,J+1)},U0=function*($){for(let[q,{final:J}]of Object.entries($))yield*YG(J,Number(q),$)},YG=function*($,q,J){if($===void 0)return;for(let X of $())yield*A1(X,J,q+1)},GG=function*($){yield $};var z4=({value:$,value:{transform:q,final:J,writableObjectMode:X,readableObjectMode:Z},optionName:H},{encoding:Q})=>{let Y={},G=C5($,Q,H),K=I1(q),U=I1(J),B=K?U4.bind(void 0,j$,Y):B4.bind(void 0,A1),z=K||U?U4.bind(void 0,F5,Y):B4.bind(void 0,U0),W=K||U?x5.bind(void 0,Y):void 0;return{stream:new KG({writableObjectMode:X,writableHighWaterMark:M5(X),readableObjectMode:Z,readableHighWaterMark:M5(Z),transform(T,M,F){B([T,G,0],this,F)},flush(T){z([G],this,T)},destroy:W})}},M$=($,q,J,X)=>{let Z=q.filter(({type:Q})=>Q==="generator"),H=X?Z.reverse():Z;for(let{value:Q,optionName:Y}of H){let G=C5(Q,J,Y);$=j5(G,$)}return $},C5=({transform:$,final:q,binary:J,writableObjectMode:X,readableObjectMode:Z,preserveNewlines:H},Q,Y)=>{let G={};return[{transform:R5(X,Y)},x$(J,Q,X),F$(J,H,X,G),{transform:$,final:q},{transform:P5(Z,Y)},_5({binary:J,preserveNewlines:H,readableObjectMode:Z,state:G})].filter(Boolean)};var w5=($,q)=>{for(let J of UG($))BG($,J,q)},UG=($)=>new Set(Object.entries($).filter(([,{direction:q}])=>q==="input").map(([q])=>Number(q))),BG=($,q,J)=>{let{stdioItems:X}=$[q],Z=X.filter(({contents:Y})=>Y!==void 0);if(Z.length===0)return;if(q!==0){let[{type:Y,optionName:G}]=Z;throw TypeError(`Only the \`stdin\` option, not \`${G}\`, can be ${T1[Y]} with synchronous methods.`)}let Q=Z.map(({contents:Y})=>Y).map((Y)=>zG(Y,X));J.input=J0(Q)},zG=($,q)=>{let J=M$($,q,"utf8",!0);return LG(J),J0(J)},LG=($)=>{let q=$.find((J)=>typeof J!=="string"&&!D(J));if(q!==void 0)throw TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${q}.`)};import{writeFileSync as RG,appendFileSync as PG}from"node:fs";var C$=({stdioItems:$,encoding:q,verboseInfo:J,fdNumber:X})=>X!=="all"&&h1(J,X)&&!u.has(q)&&WG(X)&&($.some(({type:Z,value:H})=>Z==="native"&&VG.has(H))||$.every(({type:Z})=>d.has(Z))),WG=($)=>$===1||$===2,VG=new Set(["pipe","overlapped"]),I5=async($,q,J,X)=>{for await(let Z of $)if(!_G(q))E5(Z,J,X)},A5=($,q,J)=>{for(let X of $)E5(X,q,J)},_G=($)=>$._readableState.pipes.length>0,E5=($,q,J)=>{let X=f0($);s({type:"output",verboseMessage:X,fdNumber:q,verboseInfo:J})};var y5=({fileDescriptors:$,syncResult:{output:q},options:J,isMaxBuffer:X,verboseInfo:Z})=>{if(q===null)return{output:Array.from({length:3})};let H={},Q=new Set([]);return{output:q.map((G,K)=>TG({result:G,fileDescriptors:$,fdNumber:K,state:H,outputFiles:Q,isMaxBuffer:X,verboseInfo:Z},J)),...H}},TG=({result:$,fileDescriptors:q,fdNumber:J,state:X,outputFiles:Z,isMaxBuffer:H,verboseInfo:Q},{buffer:Y,encoding:G,lines:K,stripFinalNewline:U,maxBuffer:B})=>{if($===null)return;let z=O7($,H,B),W=H1(z),{stdioItems:_,objectMode:T}=q[J],M=kG([W],_,G,X),{serializedResult:F,finalResult:O=F}=FG({chunks:M,objectMode:T,encoding:G,lines:K,stripFinalNewline:U,fdNumber:J});xG({serializedResult:F,fdNumber:J,state:X,verboseInfo:Q,encoding:G,stdioItems:_,objectMode:T});let v=Y[J]?O:void 0;try{if(X.error===void 0)jG(F,_,Z);return v}catch(x){return X.error=x,v}},kG=($,q,J,X)=>{try{return M$($,q,J,!1)}catch(Z){return X.error=Z,$}},FG=({chunks:$,objectMode:q,encoding:J,lines:X,stripFinalNewline:Z,fdNumber:H})=>{if(q)return{serializedResult:$};if(J==="buffer")return{serializedResult:J0($)};let Q=d3($,J);if(X[H])return{serializedResult:Q,finalResult:K4(Q,!Z[H],q)};return{serializedResult:Q}},xG=({serializedResult:$,fdNumber:q,state:J,verboseInfo:X,encoding:Z,stdioItems:H,objectMode:Q})=>{if(!C$({stdioItems:H,encoding:Z,verboseInfo:X,fdNumber:q}))return;let Y=K4($,!1,Q);try{A5(Y,q,X)}catch(G){J.error??=G}},jG=($,q,J)=>{for(let{path:X,append:Z}of q.filter(({type:H})=>T$.has(H))){let H=typeof X==="string"?X:X.toString();if(Z||J.has(H))PG(X,$);else J.add(H),RG(X,$)}};var O5=([,$,q],J)=>{if(!J.all)return;if($===void 0)return q;if(q===void 0)return $;if(Array.isArray($))return Array.isArray(q)?[...$,...q]:[...$,U1(q,J,"all")];if(Array.isArray(q))return[U1($,J,"all"),...q];if(D($)&&D(q))return P2([$,q]);return`${$}${q}`};import{once as L4}from"node:events";var N5=async($,q)=>{let[J,X]=await MG($);return q.isForcefullyTerminated??=!1,[J,X]},MG=async($)=>{let[q,J]=await Promise.allSettled([L4($,"spawn"),L4($,"exit")]);if(q.status==="rejected")return[];return J.status==="rejected"?D5($):J.value},D5=async($)=>{try{return await L4($,"exit")}catch{return D5($)}},v5=async($)=>{let[q,J]=await $;if(!CG(q,J)&&W4(q,J))throw new e;return[q,J]},CG=($,q)=>$===void 0&&q===void 0,W4=($,q)=>$!==0||q!==null;var f5=({error:$,status:q,signal:J,output:X},{maxBuffer:Z})=>{let H=wG($,q,J),Q=H?.code==="ETIMEDOUT",Y=y7(H,X,Z);return{resultError:H,exitCode:q,signal:J,timedOut:Q,isMaxBuffer:Y}},wG=($,q,J)=>{if($!==void 0)return $;return W4(q,J)?new e:void 0};var h5=($,q,J)=>{let{file:X,commandArguments:Z,command:H,escapedCommand:Q,startTime:Y,verboseInfo:G,options:K,fileDescriptors:U}=AG($,q,J),B=OG({file:X,commandArguments:Z,options:K,command:H,escapedCommand:Q,verboseInfo:G,fileDescriptors:U,startTime:Y});return d1(B,G,K)},AG=($,q,J)=>{let{command:X,escapedCommand:Z,startTime:H,verboseInfo:Q}=S0($,q,J),Y=EG(J),{file:G,commandArguments:K,options:U}=H$($,q,Y);yG(U);let B=z5(U,Q);return{file:G,commandArguments:K,command:X,escapedCommand:Z,startTime:H,verboseInfo:Q,options:U,fileDescriptors:B}},EG=($)=>$.node&&!$.ipc?{...$,ipc:!1}:$,yG=({ipc:$,ipcInput:q,detached:J,cancelSignal:X})=>{if(q)w$("ipcInput");if($)w$("ipc: true");if(J)w$("detached: true");if(X)w$("cancelSignal")},w$=($)=>{throw TypeError(`The "${$}" option cannot be used with synchronous methods.`)},OG=({file:$,commandArguments:q,options:J,command:X,escapedCommand:Z,verboseInfo:H,fileDescriptors:Q,startTime:Y})=>{let G=NG({file:$,commandArguments:q,options:J,command:X,escapedCommand:Z,fileDescriptors:Q,startTime:Y});if(G.failed)return G;let{resultError:K,exitCode:U,signal:B,timedOut:z,isMaxBuffer:W}=f5(G,J),{output:_,error:T=K}=y5({fileDescriptors:Q,syncResult:G,options:J,isMaxBuffer:W,verboseInfo:H}),M=_.map((O,v)=>U1(O,J,v)),F=U1(O5(_,J),J,"all");return vG({error:T,exitCode:U,signal:B,timedOut:z,isMaxBuffer:W,stdio:M,all:F,options:J,command:X,escapedCommand:Z,startTime:Y})},NG=({file:$,commandArguments:q,options:J,command:X,escapedCommand:Z,fileDescriptors:H,startTime:Q})=>{try{w5(H,J);let Y=DG(J);return IG(...Y$($,q,Y))}catch(Y){return l1({error:Y,command:X,escapedCommand:Z,fileDescriptors:H,options:J,startTime:Q,isSync:!0})}},DG=({encoding:$,maxBuffer:q,...J})=>({...J,encoding:"buffer",maxBuffer:V$(q)}),vG=({error:$,exitCode:q,signal:J,timedOut:X,isMaxBuffer:Z,stdio:H,all:Q,options:Y,command:G,escapedCommand:K,startTime:U})=>$===void 0?_$({command:G,escapedCommand:K,stdio:H,all:Q,ipcOutput:[],options:Y,startTime:U}):K0({error:$,command:G,escapedCommand:K,timedOut:X,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:Z,isForcefullyTerminated:!1,exitCode:q,signal:J,stdio:H,all:Q,ipcOutput:[],options:Y,startTime:U,isSync:!0});import{setMaxListeners as FU}from"node:events";import{spawn as xU}from"node:child_process";import m5 from"node:process";import{once as V4,on as fG}from"node:events";var S5=({anyProcess:$,channel:q,isSubprocess:J,ipc:X},{reference:Z=!0,filter:H}={})=>{return g1({methodName:"getOneMessage",isSubprocess:J,ipc:X,isConnected:$$($)}),hG({anyProcess:$,channel:q,isSubprocess:J,filter:H,reference:Z})},hG=async({anyProcess:$,channel:q,isSubprocess:J,filter:X,reference:Z})=>{o0(q,Z);let H=P1($,q,J),Q=new AbortController;try{return await Promise.race([SG(H,X,Q),bG(H,J,Q),gG(H,J,Q)])}catch(Y){throw c1($),Y}finally{Q.abort(),r0(q,Z)}},SG=async($,q,{signal:J})=>{if(q===void 0){let[X]=await V4($,"message",{signal:J});return X}for await(let[X]of fG($,"message",{signal:J}))if(q(X))return X},bG=async($,q,{signal:J})=>{await V4($,"disconnect",{signal:J}),x8(q)},gG=async($,q,{signal:J})=>{let[X]=await V4($,"strict:error",{signal:J});throw n0(X,q)};import{once as g5,on as cG}from"node:events";var c5=({anyProcess:$,channel:q,isSubprocess:J,ipc:X},{reference:Z=!0}={})=>_4({anyProcess:$,channel:q,isSubprocess:J,ipc:X,shouldAwait:!J,reference:Z}),_4=({anyProcess:$,channel:q,isSubprocess:J,ipc:X,shouldAwait:Z,reference:H})=>{g1({methodName:"getEachMessage",isSubprocess:J,ipc:X,isConnected:$$($)}),o0(q,H);let Q=P1($,q,J),Y=new AbortController,G={};return mG($,Q,Y),uG({ipcEmitter:Q,isSubprocess:J,controller:Y,state:G}),pG({anyProcess:$,channel:q,ipcEmitter:Q,isSubprocess:J,shouldAwait:Z,controller:Y,state:G,reference:H})},mG=async($,q,J)=>{try{await g5(q,"disconnect",{signal:J.signal}),J.abort()}catch{}},uG=async({ipcEmitter:$,isSubprocess:q,controller:J,state:X})=>{try{let[Z]=await g5($,"strict:error",{signal:J.signal});X.error=n0(Z,q),J.abort()}catch{}},pG=async function*({anyProcess:$,channel:q,ipcEmitter:J,isSubprocess:X,shouldAwait:Z,controller:H,state:Q,reference:Y}){try{for await(let[G]of cG(J,"message",{signal:H.signal}))b5(Q),yield G}catch{b5(Q)}finally{if(H.abort(),r0(q,Y),!X)c1($);if(Z)await $}},b5=({error:$})=>{if($)throw $};var u5=($,{ipc:q})=>{Object.assign($,l5($,!1,q))},p5=()=>{let $=m5,q=!0,J=m5.channel!==void 0;return{...l5($,!0,J),getCancelSignal:t8.bind(void 0,{anyProcess:$,channel:$.channel,isSubprocess:!0,ipc:J})}},l5=($,q,J)=>({sendMessage:Z$.bind(void 0,{anyProcess:$,channel:$.channel,isSubprocess:q,ipc:J}),getOneMessage:S5.bind(void 0,{anyProcess:$,channel:$.channel,isSubprocess:q,ipc:J}),getEachMessage:c5.bind(void 0,{anyProcess:$,channel:$.channel,isSubprocess:q,ipc:J})});import{ChildProcess as lG}from"node:child_process";import{PassThrough as dG,Readable as iG,Writable as nG,Duplex as aG}from"node:stream";var d5=({error:$,command:q,escapedCommand:J,fileDescriptors:X,options:Z,startTime:H,verboseInfo:Q})=>{H4(X);let Y=new lG;tG(Y,X),Object.assign(Y,{readable:oG,writable:rG,duplex:sG});let G=l1({error:$,command:q,escapedCommand:J,fileDescriptors:X,options:Z,startTime:H,isSync:!1}),K=eG(G,Q,Z);return{subprocess:Y,promise:K}},tG=($,q)=>{let J=B0(),X=B0(),Z=B0(),H=Array.from({length:q.length-3},B0),Q=B0(),Y=[J,X,Z,...H];Object.assign($,{stdin:J,stdout:X,stderr:Z,all:Q,stdio:Y})},B0=()=>{let $=new dG;return $.end(),$},oG=()=>new iG({read(){}}),rG=()=>new nG({write(){}}),sG=()=>new aG({read(){},write(){}}),eG=async($,q,J)=>d1($,q,J);import{createReadStream as i5,createWriteStream as n5}from"node:fs";import{Buffer as $K}from"node:buffer";import{Readable as z0,Writable as qK,Duplex as JK}from"node:stream";var t5=($,q)=>k$(XK,$,q,!1),L0=({type:$,optionName:q})=>{throw TypeError(`The \`${q}\` option cannot be ${T1[$]}.`)},a5={fileNumber:L0,generator:z4,asyncGenerator:z4,nodeStream:({value:$})=>({stream:$}),webTransform({value:{transform:$,writableObjectMode:q,readableObjectMode:J}}){let X=q||J;return{stream:JK.fromWeb($,{objectMode:X})}},duplex:({value:{transform:$}})=>({stream:$}),native(){}},XK={input:{...a5,fileUrl:({value:$})=>({stream:i5($)}),filePath:({value:{file:$}})=>({stream:i5($)}),webStream:({value:$})=>({stream:z0.fromWeb($)}),iterable:({value:$})=>({stream:z0.from($)}),asyncIterable:({value:$})=>({stream:z0.from($)}),string:({value:$})=>({stream:z0.from($)}),uint8Array:({value:$})=>({stream:z0.from($K.from($))})},output:{...a5,fileUrl:({value:$})=>({stream:n5($)}),filePath:({value:{file:$,append:q}})=>({stream:n5($,q?{flags:"a"}:{})}),webStream:({value:$})=>({stream:qK.fromWeb($)}),iterable:L0,asyncIterable:L0,string:L0,uint8Array:L0}};import{on as ZK,once as o5}from"node:events";import{PassThrough as QK,getDefaultHighWaterMark as HK}from"node:stream";import{finished as e5}from"node:stream/promises";function E1($){if(!Array.isArray($))throw TypeError(`Expected an array, got \`${typeof $}\`.`);for(let Z of $)R4(Z);let q=$.some(({readableObjectMode:Z})=>Z),J=YK($,q),X=new $q({objectMode:q,writableHighWaterMark:J,readableHighWaterMark:J});for(let Z of $)X.add(Z);return X}var YK=($,q)=>{if($.length===0)return HK(q);let J=$.filter(({readableObjectMode:X})=>X===q).map(({readableHighWaterMark:X})=>X);return Math.max(...J)};class $q extends QK{#q=new Set([]);#J=new Set([]);#$=new Set([]);#X;#Q=Symbol("unpipe");#Z=new WeakMap;add($){if(R4($),this.#q.has($))return;this.#q.add($),this.#X??=GK(this,this.#q,this.#Q);let q=BK({passThroughStream:this,stream:$,streams:this.#q,ended:this.#J,aborted:this.#$,onFinished:this.#X,unpipeEvent:this.#Q});this.#Z.set($,q),$.pipe(this,{end:!1})}async remove($){if(R4($),!this.#q.has($))return!1;let q=this.#Z.get($);if(q===void 0)return!1;return this.#Z.delete($),$.unpipe(this),await q,!0}}var GK=async($,q,J)=>{I$($,r5);let X=new AbortController;try{await Promise.race([KK($,X),UK($,q,J,X)])}finally{X.abort(),I$($,-r5)}},KK=async($,{signal:q})=>{try{await e5($,{signal:q,cleanup:!0})}catch(J){throw qq($,J),J}},UK=async($,q,J,{signal:X})=>{for await(let[Z]of ZK($,"unpipe",{signal:X}))if(q.has(Z))Z.emit(J)},R4=($)=>{if(typeof $?.pipe!=="function")throw TypeError(`Expected a readable stream, got: \`${typeof $}\`.`)},BK=async({passThroughStream:$,stream:q,streams:J,ended:X,aborted:Z,onFinished:H,unpipeEvent:Q})=>{I$($,s5);let Y=new AbortController;try{await Promise.race([zK(H,q,Y),LK({passThroughStream:$,stream:q,streams:J,ended:X,aborted:Z,controller:Y}),WK({stream:q,streams:J,ended:X,aborted:Z,unpipeEvent:Q,controller:Y})])}finally{Y.abort(),I$($,-s5)}if(J.size>0&&J.size===X.size+Z.size)if(X.size===0&&Z.size>0)P4($);else VK($)},zK=async($,q,{signal:J})=>{try{if(await $,!J.aborted)P4(q)}catch(X){if(!J.aborted)qq(q,X)}},LK=async({passThroughStream:$,stream:q,streams:J,ended:X,aborted:Z,controller:{signal:H}})=>{try{if(await e5(q,{signal:H,cleanup:!0,readable:!0,writable:!1}),J.has(q))X.add(q)}catch(Q){if(H.aborted||!J.has(q))return;if(Jq(Q))Z.add(q);else Xq($,Q)}},WK=async({stream:$,streams:q,ended:J,aborted:X,unpipeEvent:Z,controller:{signal:H}})=>{if(await o5($,Z,{signal:H}),!$.readable)return o5(H,"abort",{signal:H});q.delete($),J.delete($),X.delete($)},VK=($)=>{if($.writable)$.end()},qq=($,q)=>{if(Jq(q))P4($);else Xq($,q)},Jq=($)=>$?.code==="ERR_STREAM_PREMATURE_CLOSE",P4=($)=>{if($.readable||$.writable)$.destroy()},Xq=($,q)=>{if(!$.destroyed)$.once("error",_K),$.destroy(q)},_K=()=>{},I$=($,q)=>{let J=$.getMaxListeners();if(J!==0&&J!==Number.POSITIVE_INFINITY)$.setMaxListeners(J+q)},r5=2,s5=1;import{finished as Zq}from"node:stream/promises";var n1=($,q)=>{$.pipe(q),RK($,q),PK($,q)},RK=async($,q)=>{if(a($)||a(q))return;try{await Zq($,{cleanup:!0,readable:!0,writable:!1})}catch{}T4(q)},T4=($)=>{if($.writable)$.end()},PK=async($,q)=>{if(a($)||a(q))return;try{await Zq(q,{cleanup:!0,readable:!1,writable:!0})}catch{}k4($)},k4=($)=>{if($.readable)$.destroy()};var Qq=($,q,J)=>{let X=new Map;for(let[Z,{stdioItems:H,direction:Q}]of Object.entries(q)){for(let{stream:Y}of H.filter(({type:G})=>d.has(G)))TK($,Y,Q,Z);for(let{stream:Y}of H.filter(({type:G})=>!d.has(G)))FK({subprocess:$,stream:Y,direction:Q,fdNumber:Z,pipeGroups:X,controller:J})}for(let[Z,H]of X.entries()){let Q=H.length===1?H[0]:E1(H);n1(Q,Z)}},TK=($,q,J,X)=>{if(J==="output")n1($.stdio[X],q);else n1(q,$.stdio[X]);let Z=kK[X];if(Z!==void 0)$[Z]=q;$.stdio[X]=q},kK=["stdin","stdout","stderr"],FK=({subprocess:$,stream:q,direction:J,fdNumber:X,pipeGroups:Z,controller:H})=>{if(q===void 0)return;xK(q,H);let[Q,Y]=J==="output"?[q,$.stdio[X]]:[$.stdio[X],q],G=Z.get(Q)??[];Z.set(Q,[...G,Y])},xK=($,{signal:q})=>{if(a($))C1($,jK,q)},jK=2;import{addAbortListener as wK}from"node:events";var y1=[];y1.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")y1.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")y1.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var A$=($)=>!!$&&typeof $==="object"&&typeof $.removeListener==="function"&&typeof $.emit==="function"&&typeof $.reallyExit==="function"&&typeof $.listeners==="function"&&typeof $.kill==="function"&&typeof $.pid==="number"&&typeof $.on==="function",F4=Symbol.for("signal-exit emitter"),x4=globalThis,MK=Object.defineProperty.bind(Object);class Hq{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(x4[F4])return x4[F4];MK(x4,F4,{value:this,writable:!1,enumerable:!1,configurable:!1})}on($,q){this.listeners[$].push(q)}removeListener($,q){let J=this.listeners[$],X=J.indexOf(q);if(X===-1)return;if(X===0&&J.length===1)J.length=0;else J.splice(X,1)}emit($,q,J){if(this.emitted[$])return!1;this.emitted[$]=!0;let X=!1;for(let Z of this.listeners[$])X=Z(q,J)===!0||X;if($==="exit")X=this.emit("afterExit",q,J)||X;return X}}class M4{}var CK=($)=>{return{onExit(q,J){return $.onExit(q,J)},load(){return $.load()},unload(){return $.unload()}}};class Yq extends M4{onExit(){return()=>{}}load(){}unload(){}}class Gq extends M4{#q=j4.platform==="win32"?"SIGINT":"SIGHUP";#J=new Hq;#$;#X;#Q;#Z={};#H=!1;constructor($){super();this.#$=$,this.#Z={};for(let q of y1)this.#Z[q]=()=>{let J=this.#$.listeners(q),{count:X}=this.#J,Z=$;if(typeof Z.__signal_exit_emitter__==="object"&&typeof Z.__signal_exit_emitter__.count==="number")X+=Z.__signal_exit_emitter__.count;if(J.length===X){this.unload();let H=this.#J.emit("exit",null,q),Q=q==="SIGHUP"?this.#q:q;if(!H)$.kill($.pid,Q)}};this.#Q=$.reallyExit,this.#X=$.emit}onExit($,q){if(!A$(this.#$))return()=>{};if(this.#H===!1)this.load();let J=q?.alwaysLast?"afterExit":"exit";return this.#J.on(J,$),()=>{if(this.#J.removeListener(J,$),this.#J.listeners.exit.length===0&&this.#J.listeners.afterExit.length===0)this.unload()}}load(){if(this.#H)return;this.#H=!0,this.#J.count+=1;for(let $ of y1)try{let q=this.#Z[$];if(q)this.#$.on($,q)}catch(q){}this.#$.emit=($,...q)=>{return this.#G($,...q)},this.#$.reallyExit=($)=>{return this.#Y($)}}unload(){if(!this.#H)return;this.#H=!1,y1.forEach(($)=>{let q=this.#Z[$];if(!q)throw Error("Listener not defined for signal: "+$);try{this.#$.removeListener($,q)}catch(J){}}),this.#$.emit=this.#X,this.#$.reallyExit=this.#Q,this.#J.count-=1}#Y($){if(!A$(this.#$))return 0;return this.#$.exitCode=$||0,this.#J.emit("exit",this.#$.exitCode,null),this.#Q.call(this.#$,this.#$.exitCode)}#G($,...q){let J=this.#X;if($==="exit"&&A$(this.#$)){if(typeof q[0]==="number")this.#$.exitCode=q[0];let X=J.call(this.#$,$,...q);return this.#J.emit("exit",this.#$.exitCode,null),X}else return J.call(this.#$,$,...q)}}var j4=globalThis.process,{onExit:Kq,load:gk,unload:ck}=CK(A$(j4)?new Gq(j4):new Yq);var Uq=($,{cleanup:q,detached:J},{signal:X})=>{if(!q||J)return;let Z=Kq(()=>{$.kill()});wK(X,()=>{Z()})};var zq=({source:$,sourcePromise:q,boundOptions:J,createNested:X},...Z)=>{let H=h0(),{destination:Q,destinationStream:Y,destinationError:G,from:K,unpipeSignal:U}=IK(J,X,Z),{sourceStream:B,sourceError:z}=EK($,K),{options:W,fileDescriptors:_}=q1.get($);return{sourcePromise:q,sourceStream:B,sourceOptions:W,sourceError:z,destination:Q,destinationStream:Y,destinationError:G,unpipeSignal:U,fileDescriptors:_,startTime:H}},IK=($,q,J)=>{try{let{destination:X,pipeOptions:{from:Z,to:H,unpipeSignal:Q}={}}=AK($,q,...J),Y=t0(X,H);return{destination:X,destinationStream:Y,from:Z,unpipeSignal:Q}}catch(X){return{destinationError:X}}},AK=($,q,J,...X)=>{if(Array.isArray(J))return{destination:q(Bq,$)(J,...X),pipeOptions:$};if(typeof J==="string"||J instanceof URL||_2(J)){if(Object.keys($).length>0)throw TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[Z,H,Q]=w0(J,...X);return{destination:q(Bq)(Z,H,Q),pipeOptions:Q}}if(q1.has(J)){if(Object.keys($).length>0)throw TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:J,pipeOptions:X[0]}}throw TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${J}`)},Bq=({options:$})=>({options:{...$,stdin:"pipe",piped:!0}}),EK=($,q)=>{try{return{sourceStream:m1($,q)}}catch(J){return{sourceError:J}}};var Wq=({sourceStream:$,sourceError:q,destinationStream:J,destinationError:X,fileDescriptors:Z,sourceOptions:H,startTime:Q})=>{let Y=yK({sourceStream:$,sourceError:q,destinationStream:J,destinationError:X});if(Y!==void 0)throw C4({error:Y,fileDescriptors:Z,sourceOptions:H,startTime:Q})},yK=({sourceStream:$,sourceError:q,destinationStream:J,destinationError:X})=>{if(q!==void 0&&X!==void 0)return X;if(X!==void 0)return k4($),X;if(q!==void 0)return T4(J),q},C4=({error:$,fileDescriptors:q,sourceOptions:J,startTime:X})=>l1({error:$,command:Lq,escapedCommand:Lq,fileDescriptors:q,options:J,startTime:X,isSync:!1}),Lq="source.pipe(destination)";var Vq=async($)=>{let[{status:q,reason:J,value:X=J},{status:Z,reason:H,value:Q=H}]=await $;if(!Q.pipedFrom.includes(X))Q.pipedFrom.push(X);if(Z==="rejected")throw Q;if(q==="rejected")throw X;return Q};import{finished as OK}from"node:stream/promises";var _q=($,q,J)=>{let X=E$.has(q)?DK($,q):NK($,q);return C1($,fK,J.signal),C1(q,hK,J.signal),vK(q),X},NK=($,q)=>{let J=E1([$]);return n1(J,q),E$.set(q,J),J},DK=($,q)=>{let J=E$.get(q);return J.add($),J},vK=async($)=>{try{await OK($,{cleanup:!0,readable:!1,writable:!0})}catch{}E$.delete($)},E$=new WeakMap,fK=2,hK=1;import{aborted as SK}from"node:util";var Rq=($,q)=>$===void 0?[]:[bK($,q)],bK=async($,{sourceStream:q,mergedStream:J,fileDescriptors:X,sourceOptions:Z,startTime:H})=>{await SK($,q),await J.remove(q);let Q=Error("Pipe canceled by `unpipeSignal` option.");throw C4({error:Q,fileDescriptors:X,sourceOptions:Z,startTime:H})};var y$=($,...q)=>{if(E(q[0]))return y$.bind(void 0,{...$,boundOptions:{...$.boundOptions,...q[0]}});let{destination:J,...X}=zq($,...q),Z=gK({...X,destination:J});return Z.pipe=y$.bind(void 0,{...$,source:J,sourcePromise:Z,boundOptions:{}}),Z},gK=async({sourcePromise:$,sourceStream:q,sourceOptions:J,sourceError:X,destination:Z,destinationStream:H,destinationError:Q,unpipeSignal:Y,fileDescriptors:G,startTime:K})=>{let U=cK($,Z);Wq({sourceStream:q,sourceError:X,destinationStream:H,destinationError:Q,fileDescriptors:G,sourceOptions:J,startTime:K});let B=new AbortController;try{let z=_q(q,H,B);return await Promise.race([Vq(U),...Rq(Y,{sourceStream:q,mergedStream:z,sourceOptions:J,fileDescriptors:G,startTime:K})])}finally{B.abort()}},cK=($,q)=>Promise.allSettled([$,q]);import{setImmediate as nK}from"node:timers/promises";import{on as mK}from"node:events";import{getDefaultHighWaterMark as uK}from"node:stream";var O$=({subprocessStdout:$,subprocess:q,binary:J,shouldEncode:X,encoding:Z,preserveNewlines:H})=>{let Q=new AbortController;return pK(q,Q),Tq({stream:$,controller:Q,binary:J,shouldEncode:!$.readableObjectMode&&X,encoding:Z,shouldSplit:!$.readableObjectMode,preserveNewlines:H})},pK=async($,q)=>{try{await $}catch{}finally{q.abort()}},w4=({stream:$,onStreamEnd:q,lines:J,encoding:X,stripFinalNewline:Z,allMixed:H})=>{let Q=new AbortController;lK(q,Q,$);let Y=$.readableObjectMode&&!H;return Tq({stream:$,controller:Q,binary:X==="buffer",shouldEncode:!Y,encoding:X,shouldSplit:!Y&&J,preserveNewlines:!Z})},lK=async($,q,J)=>{try{await $}catch{J.destroy()}finally{q.abort()}},Tq=({stream:$,controller:q,binary:J,shouldEncode:X,encoding:Z,shouldSplit:H,preserveNewlines:Q})=>{let Y=mK($,"data",{signal:q.signal,highWaterMark:Pq,highWatermark:Pq});return dK({onStdoutChunk:Y,controller:q,binary:J,shouldEncode:X,encoding:Z,shouldSplit:H,preserveNewlines:Q})},I4=uK(!0),Pq=I4,dK=async function*({onStdoutChunk:$,controller:q,binary:J,shouldEncode:X,encoding:Z,shouldSplit:H,preserveNewlines:Q}){let Y=iK({binary:J,shouldEncode:X,encoding:Z,shouldSplit:H,preserveNewlines:Q});try{for await(let[G]of $)yield*A1(G,Y,0)}catch(G){if(!q.signal.aborted)throw G}finally{yield*U0(Y)}},iK=({binary:$,shouldEncode:q,encoding:J,shouldSplit:X,preserveNewlines:Z})=>[x$($,J,!q),F$($,Z,!X,{})].filter(Boolean);var kq=async({stream:$,onStreamEnd:q,fdNumber:J,encoding:X,buffer:Z,maxBuffer:H,lines:Q,allMixed:Y,stripFinalNewline:G,verboseInfo:K,streamInfo:U})=>{let B=aK({stream:$,onStreamEnd:q,fdNumber:J,encoding:X,allMixed:Y,verboseInfo:K,streamInfo:U});if(!Z){await Promise.all([tK($),B]);return}let z=Y4(G,J),W=w4({stream:$,onStreamEnd:q,lines:Q,encoding:X,stripFinalNewline:z,allMixed:Y}),[_]=await Promise.all([oK({stream:$,iterable:W,fdNumber:J,encoding:X,maxBuffer:H,lines:Q}),B]);return _},aK=async({stream:$,onStreamEnd:q,fdNumber:J,encoding:X,allMixed:Z,verboseInfo:H,streamInfo:{fileDescriptors:Q}})=>{if(!C$({stdioItems:Q[J]?.stdioItems,encoding:X,verboseInfo:H,fdNumber:J}))return;let Y=w4({stream:$,onStreamEnd:q,lines:!0,encoding:X,stripFinalNewline:!0,allMixed:Z});await I5(Y,$,J,H)},tK=async($)=>{if(await nK(),$.readableFlowing===null)$.resume()},oK=async({stream:$,stream:{readableObjectMode:q},iterable:J,fdNumber:X,encoding:Z,maxBuffer:H,lines:Q})=>{try{if(q||Q)return await B$(J,{maxBuffer:H});if(Z==="buffer")return new Uint8Array(await z$(J,{maxBuffer:H}));return await W$(J,{maxBuffer:H})}catch(Y){return Fq(I7({error:Y,stream:$,readableObjectMode:q,lines:Q,encoding:Z,fdNumber:X}))}},A4=async($)=>{try{return await $}catch(q){return Fq(q)}},Fq=({bufferedData:$})=>p3($)?new Uint8Array($):$;import{finished as rK}from"node:stream/promises";var W0=async($,q,J,{isSameDirection:X,stopOnExit:Z=!1}={})=>{let H=sK($,J),Q=new AbortController;try{await Promise.race([...Z?[J.exitPromise]:[],rK($,{cleanup:!0,signal:Q.signal})])}catch(Y){if(!H.stdinCleanedUp)qU(Y,q,J,X)}finally{Q.abort()}},sK=($,{originalStreams:[q],subprocess:J})=>{let X={stdinCleanedUp:!1};if($===q)eK($,J,X);return X},eK=($,q,J)=>{let{_destroy:X}=$;$._destroy=(...Z)=>{$U(q,J),X.call($,...Z)}},$U=({exitCode:$,signalCode:q},J)=>{if($!==null||q!==null)J.stdinCleanedUp=!0},qU=($,q,J,X)=>{if(!JU($,q,J,X))throw $},JU=($,q,J,X=!0)=>{if(J.propagating)return xq($)||N$($);return J.propagating=!0,E4(J,q)===X?xq($):N$($)},E4=({fileDescriptors:$},q)=>q!=="all"&&$[q].direction==="input",N$=($)=>$?.code==="ERR_STREAM_PREMATURE_CLOSE",xq=($)=>$?.code==="EPIPE";var jq=({subprocess:$,encoding:q,buffer:J,maxBuffer:X,lines:Z,stripFinalNewline:H,verboseInfo:Q,streamInfo:Y})=>$.stdio.map((G,K)=>y4({stream:G,fdNumber:K,encoding:q,buffer:J[K],maxBuffer:X[K],lines:Z[K],allMixed:!1,stripFinalNewline:H,verboseInfo:Q,streamInfo:Y})),y4=async({stream:$,fdNumber:q,encoding:J,buffer:X,maxBuffer:Z,lines:H,allMixed:Q,stripFinalNewline:Y,verboseInfo:G,streamInfo:K})=>{if(!$)return;let U=W0($,q,K);if(E4(K,q)){await U;return}let[B]=await Promise.all([kq({stream:$,onStreamEnd:U,fdNumber:q,encoding:J,buffer:X,maxBuffer:Z,lines:H,allMixed:Q,stripFinalNewline:Y,verboseInfo:G,streamInfo:K}),U]);return B};var Mq=({stdout:$,stderr:q},{all:J})=>J&&($||q)?E1([$,q].filter(Boolean)):void 0,Cq=({subprocess:$,encoding:q,buffer:J,maxBuffer:X,lines:Z,stripFinalNewline:H,verboseInfo:Q,streamInfo:Y})=>y4({...XU($,J),fdNumber:"all",encoding:q,maxBuffer:X[1]+X[2],lines:Z[1]||Z[2],allMixed:ZU($),stripFinalNewline:H,verboseInfo:Q,streamInfo:Y}),XU=({stdout:$,stderr:q,all:J},[,X,Z])=>{let H=X||Z;if(!H)return{stream:J,buffer:H};if(!X)return{stream:q,buffer:H};if(!Z)return{stream:$,buffer:H};return{stream:J,buffer:H}},ZU=({all:$,stdout:q,stderr:J})=>$&&q&&J&&q.readableObjectMode!==J.readableObjectMode;import{once as QU}from"node:events";var wq=($)=>h1($,"ipc"),Iq=($,q)=>{let J=f0($);s({type:"ipc",verboseMessage:J,fdNumber:"ipc",verboseInfo:q})};var Aq=async({subprocess:$,buffer:q,maxBuffer:J,ipc:X,ipcOutput:Z,verboseInfo:H})=>{if(!X)return Z;let Q=wq(H),Y=Y1(q,"ipc"),G=Y1(J,"ipc");for await(let K of _4({anyProcess:$,channel:$.channel,isSubprocess:!1,ipc:X,shouldAwait:!1,reference:!0})){if(Y)A7($,Z,G),Z.push(K);if(Q)Iq(K,H)}return Z},Eq=async($,q)=>{return await Promise.allSettled([$]),q};var yq=async({subprocess:$,options:{encoding:q,buffer:J,maxBuffer:X,lines:Z,timeoutDuration:H,cancelSignal:Q,gracefulCancel:Y,forceKillAfterDelay:G,stripFinalNewline:K,ipc:U,ipcInput:B},context:z,verboseInfo:W,fileDescriptors:_,originalStreams:T,onInternalError:M,controller:F})=>{let O=N5($,z),v={originalStreams:T,fileDescriptors:_,subprocess:$,exitPromise:O,propagating:!1},x=jq({subprocess:$,encoding:q,buffer:J,maxBuffer:X,lines:Z,stripFinalNewline:K,verboseInfo:W,streamInfo:v}),I=Cq({subprocess:$,encoding:q,buffer:J,maxBuffer:X,lines:Z,stripFinalNewline:K,verboseInfo:W,streamInfo:v}),N=[],c=Aq({subprocess:$,buffer:J,maxBuffer:X,ipc:U,ipcOutput:N,verboseInfo:W}),L1=HU(T,$,v),W1=YU(_,v);try{return await Promise.race([Promise.all([{},v5(O),Promise.all(x),I,c,Q7($,B),...L1,...W1]),M,GU($,F),...$7($,H,z,F),...F8({subprocess:$,cancelSignal:Q,gracefulCancel:Y,context:z,controller:F}),...s8({subprocess:$,cancelSignal:Q,gracefulCancel:Y,forceKillAfterDelay:G,context:z,controller:F})])}catch(Q2){return z.terminationReason??="other",Promise.all([{error:Q2},O,Promise.all(x.map(($0)=>A4($0))),A4(I),Eq(c,N),Promise.allSettled(L1),Promise.allSettled(W1)])}},HU=($,q,J)=>$.map((X,Z)=>X===q.stdio[Z]?void 0:W0(X,Z,J)),YU=($,q)=>$.flatMap(({stdioItems:J},X)=>J.filter(({value:Z,stream:H=Z})=>o(H,{checkOpen:!1})&&!a(H)).map(({type:Z,value:H,stream:Q=H})=>W0(Q,X,q,{isSameDirection:d.has(Z),stopOnExit:Z==="native"}))),GU=async($,{signal:q})=>{let[J]=await QU($,"error",{signal:q});throw J};var Oq=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),V0=($,q,J)=>{let X=$[J];if(!X.has(q))X.set(q,[]);let Z=X.get(q),H=$1();return Z.push(H),{resolve:H.resolve.bind(H),promises:Z}},a1=async({resolve:$,promises:q},J)=>{$();let[X]=await Promise.race([Promise.allSettled([!0,J]),Promise.all([!1,...q])]);return!X};import{Readable as KU}from"node:stream";import{callbackify as UU}from"node:util";import{finished as Nq}from"node:stream/promises";var O4=async($)=>{if($===void 0)return;try{await N4($)}catch{}},Dq=async($)=>{if($===void 0)return;try{await D4($)}catch{}},N4=async($)=>{await Nq($,{cleanup:!0,readable:!1,writable:!0})},D4=async($)=>{await Nq($,{cleanup:!0,readable:!0,writable:!1})},D$=async($,q)=>{if(await $,q)throw q},v$=($,q,J)=>{if(J&&!N$(J))$.destroy(J);else if(q)$.destroy()};var vq=({subprocess:$,concurrentStreams:q,encoding:J},{from:X,binary:Z=!0,preserveNewlines:H=!0}={})=>{let Q=Z||u.has(J),{subprocessStdout:Y,waitReadableDestroy:G}=v4($,X,q),{readableEncoding:K,readableObjectMode:U,readableHighWaterMark:B}=f4(Y,Q),{read:z,onStdoutDataDone:W}=h4({subprocessStdout:Y,subprocess:$,binary:Q,encoding:J,preserveNewlines:H}),_=new KU({read:z,destroy:UU(b4.bind(void 0,{subprocessStdout:Y,subprocess:$,waitReadableDestroy:G})),highWaterMark:B,objectMode:U,encoding:K});return S4({subprocessStdout:Y,onStdoutDataDone:W,readable:_,subprocess:$}),_},v4=($,q,J)=>{let X=m1($,q),Z=V0(J,X,"readableDestroy");return{subprocessStdout:X,waitReadableDestroy:Z}},f4=({readableEncoding:$,readableObjectMode:q,readableHighWaterMark:J},X)=>X?{readableEncoding:$,readableObjectMode:q,readableHighWaterMark:J}:{readableEncoding:$,readableObjectMode:!0,readableHighWaterMark:I4},h4=({subprocessStdout:$,subprocess:q,binary:J,encoding:X,preserveNewlines:Z})=>{let H=$1(),Q=O$({subprocessStdout:$,subprocess:q,binary:J,shouldEncode:!J,encoding:X,preserveNewlines:Z});return{read(){BU(this,Q,H)},onStdoutDataDone:H}},BU=async($,q,J)=>{try{let{value:X,done:Z}=await q.next();if(Z)J.resolve();else $.push(X)}catch{}},S4=async({subprocessStdout:$,onStdoutDataDone:q,readable:J,subprocess:X,subprocessStdin:Z})=>{try{if(await D4($),await X,await O4(Z),await q,J.readable)J.push(null)}catch(H){await O4(Z),fq(J,H)}},b4=async({subprocessStdout:$,subprocess:q,waitReadableDestroy:J},X)=>{if(await a1(J,q))fq($,X),await D$(q,X)},fq=($,q)=>{v$($,$.readable,q)};import{Writable as zU}from"node:stream";import{callbackify as hq}from"node:util";var Sq=({subprocess:$,concurrentStreams:q},{to:J}={})=>{let{subprocessStdin:X,waitWritableFinal:Z,waitWritableDestroy:H}=g4($,J,q),Q=new zU({...c4(X,$,Z),destroy:hq(u4.bind(void 0,{subprocessStdin:X,subprocess:$,waitWritableFinal:Z,waitWritableDestroy:H})),highWaterMark:X.writableHighWaterMark,objectMode:X.writableObjectMode});return m4(X,Q),Q},g4=($,q,J)=>{let X=t0($,q),Z=V0(J,X,"writableFinal"),H=V0(J,X,"writableDestroy");return{subprocessStdin:X,waitWritableFinal:Z,waitWritableDestroy:H}},c4=($,q,J)=>({write:LU.bind(void 0,$),final:hq(WU.bind(void 0,$,q,J))}),LU=($,q,J,X)=>{if($.write(q,J))X();else $.once("drain",X)},WU=async($,q,J)=>{if(await a1(J,q)){if($.writable)$.end();await q}},m4=async($,q,J)=>{try{if(await N4($),q.writable)q.end()}catch(X){await Dq(J),bq(q,X)}},u4=async({subprocessStdin:$,subprocess:q,waitWritableFinal:J,waitWritableDestroy:X},Z)=>{if(await a1(J,q),await a1(X,q))bq($,Z),await D$(q,Z)},bq=($,q)=>{v$($,$.writable,q)};import{Duplex as VU}from"node:stream";import{callbackify as _U}from"node:util";var gq=({subprocess:$,concurrentStreams:q,encoding:J},{from:X,to:Z,binary:H=!0,preserveNewlines:Q=!0}={})=>{let Y=H||u.has(J),{subprocessStdout:G,waitReadableDestroy:K}=v4($,X,q),{subprocessStdin:U,waitWritableFinal:B,waitWritableDestroy:z}=g4($,Z,q),{readableEncoding:W,readableObjectMode:_,readableHighWaterMark:T}=f4(G,Y),{read:M,onStdoutDataDone:F}=h4({subprocessStdout:G,subprocess:$,binary:Y,encoding:J,preserveNewlines:Q}),O=new VU({read:M,...c4(U,$,B),destroy:_U(RU.bind(void 0,{subprocessStdout:G,subprocessStdin:U,subprocess:$,waitReadableDestroy:K,waitWritableFinal:B,waitWritableDestroy:z})),readableHighWaterMark:T,writableHighWaterMark:U.writableHighWaterMark,readableObjectMode:_,writableObjectMode:U.writableObjectMode,encoding:W});return S4({subprocessStdout:G,onStdoutDataDone:F,readable:O,subprocess:$,subprocessStdin:U}),m4(U,O,G),O},RU=async({subprocessStdout:$,subprocessStdin:q,subprocess:J,waitReadableDestroy:X,waitWritableFinal:Z,waitWritableDestroy:H},Q)=>{await Promise.all([b4({subprocessStdout:$,subprocess:J,waitReadableDestroy:X},Q),u4({subprocessStdin:q,subprocess:J,waitWritableFinal:Z,waitWritableDestroy:H},Q)])};var p4=($,q,{from:J,binary:X=!1,preserveNewlines:Z=!1}={})=>{let H=X||u.has(q),Q=m1($,J),Y=O$({subprocessStdout:Q,subprocess:$,binary:H,shouldEncode:!0,encoding:q,preserveNewlines:Z});return PU(Y,Q,$)},PU=async function*($,q,J){try{yield*$}finally{if(q.readable)q.destroy();await J}};var cq=($,{encoding:q})=>{let J=Oq();$.readable=vq.bind(void 0,{subprocess:$,concurrentStreams:J,encoding:q}),$.writable=Sq.bind(void 0,{subprocess:$,concurrentStreams:J}),$.duplex=gq.bind(void 0,{subprocess:$,concurrentStreams:J,encoding:q}),$.iterable=p4.bind(void 0,$,q),$[Symbol.asyncIterator]=p4.bind(void 0,$,q,{})};var mq=($,q)=>{for(let[J,X]of kU){let Z=X.value.bind(q);Reflect.defineProperty($,J,{...X,value:Z})}},TU=(async()=>{})().constructor.prototype,kU=["then","catch","finally"].map(($)=>[$,Reflect.getOwnPropertyDescriptor(TU,$)]);var uq=($,q,J,X)=>{let{file:Z,commandArguments:H,command:Q,escapedCommand:Y,startTime:G,verboseInfo:K,options:U,fileDescriptors:B}=jU($,q,J),{subprocess:z,promise:W}=CU({file:Z,commandArguments:H,options:U,startTime:G,verboseInfo:K,command:Q,escapedCommand:Y,fileDescriptors:B});return z.pipe=y$.bind(void 0,{source:z,sourcePromise:W,boundOptions:{},createNested:X}),mq(z,W),q1.set(z,{options:U,fileDescriptors:B}),z},jU=($,q,J)=>{let{command:X,escapedCommand:Z,startTime:H,verboseInfo:Q}=S0($,q,J),{file:Y,commandArguments:G,options:K}=H$($,q,J),U=MU(K),B=t5(U,Q);return{file:Y,commandArguments:G,command:X,escapedCommand:Z,startTime:H,verboseInfo:Q,options:U,fileDescriptors:B}},MU=({timeout:$,signal:q,...J})=>{if(q!==void 0)throw TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...J,timeoutDuration:$}},CU=({file:$,commandArguments:q,options:J,startTime:X,verboseInfo:Z,command:H,escapedCommand:Q,fileDescriptors:Y})=>{let G;try{G=xU(...Y$($,q,J))}catch(_){return d5({error:_,command:H,escapedCommand:Q,fileDescriptors:Y,options:J,startTime:X,verboseInfo:Z})}let K=new AbortController;FU(Number.POSITIVE_INFINITY,K.signal);let U=[...G.stdio];Qq(G,Y,K),Uq(G,J,K);let B={},z=$1();G.kill=T8.bind(void 0,{kill:G.kill.bind(G),options:J,onInternalError:z,context:B,controller:K}),G.all=Mq(G,J),cq(G,J),u5(G,J);let W=wU({subprocess:G,options:J,startTime:X,verboseInfo:Z,fileDescriptors:Y,originalStreams:U,command:H,escapedCommand:Q,context:B,onInternalError:z,controller:K});return{subprocess:G,promise:W}},wU=async({subprocess:$,options:q,startTime:J,verboseInfo:X,fileDescriptors:Z,originalStreams:H,command:Q,escapedCommand:Y,context:G,onInternalError:K,controller:U})=>{let[B,[z,W],_,T,M]=await yq({subprocess:$,options:q,context:G,verboseInfo:X,fileDescriptors:Z,originalStreams:H,onInternalError:K,controller:U});U.abort(),K.resolve();let F=_.map((x,I)=>U1(x,q,I)),O=U1(T,q,"all"),v=IU({errorInfo:B,exitCode:z,signal:W,stdio:F,all:O,ipcOutput:M,context:G,options:q,command:Q,escapedCommand:Y,startTime:J});return d1(v,X,q)},IU=({errorInfo:$,exitCode:q,signal:J,stdio:X,all:Z,ipcOutput:H,context:Q,options:Y,command:G,escapedCommand:K,startTime:U})=>("error"in $)?K0({error:$.error,command:G,escapedCommand:K,timedOut:Q.terminationReason==="timeout",isCanceled:Q.terminationReason==="cancel"||Q.terminationReason==="gracefulCancel",isGracefullyCanceled:Q.terminationReason==="gracefulCancel",isMaxBuffer:$.error instanceof G1,isForcefullyTerminated:Q.isForcefullyTerminated,exitCode:q,signal:J,stdio:X,all:Z,ipcOutput:H,options:Y,startTime:U,isSync:!1}):_$({command:G,escapedCommand:K,stdio:X,all:Z,ipcOutput:H,options:Y,startTime:U});var f$=($,q)=>{let J=Object.fromEntries(Object.entries(q).map(([X,Z])=>[X,AU(X,$[X],Z)]));return{...$,...J}},AU=($,q,J)=>{if(EU.has($)&&E(q)&&E(J))return{...q,...J};return J},EU=new Set(["env",...x2]);var k1=($,q,J,X)=>{let Z=(Q,Y,G)=>k1(Q,Y,J,G),H=(...Q)=>yU({mapArguments:$,deepOptions:J,boundOptions:q,setBoundExeca:X,createNested:Z},...Q);if(X!==void 0)X(H,Z,q);return H},yU=({mapArguments:$,deepOptions:q={},boundOptions:J={},setBoundExeca:X,createNested:Z},H,...Q)=>{if(E(H))return Z($,f$(J,H),X);let{file:Y,commandArguments:G,options:K,isSync:U}=OU({mapArguments:$,firstArgument:H,nextArguments:Q,deepOptions:q,boundOptions:J});return U?h5(Y,G,K):uq(Y,G,K,Z)},OU=({mapArguments:$,firstArgument:q,nextArguments:J,deepOptions:X,boundOptions:Z})=>{let H=t3(q)?o3(q,J):[q,...J],[Q,Y,G]=w0(...H),K=f$(f$(X,Z),G),{file:U=Q,commandArguments:B=Y,options:z=K,isSync:W=!1}=$({file:Q,commandArguments:Y,options:K});return{file:U,commandArguments:B,options:z,isSync:W}};var pq=({file:$,commandArguments:q})=>dq($,q),lq=({file:$,commandArguments:q})=>({...dq($,q),isSync:!0}),dq=($,q)=>{if(q.length>0)throw TypeError(`The command and its arguments must be passed as a single string: ${$} ${q}.`);let[J,...X]=NU($);return{file:J,commandArguments:X}},NU=($)=>{if(typeof $!=="string")throw TypeError(`The command must be a string: ${String($)}.`);let q=$.trim();if(q==="")return[];let J=[];for(let X of q.split(DU)){let Z=J.at(-1);if(Z&&Z.endsWith("\\"))J[J.length-1]=`${Z.slice(0,-1)} ${X}`;else J.push(X)}return J},DU=/ +/g;var iq=($,q,J)=>{$.sync=q(vU,J),$.s=$.sync},nq=({options:$})=>aq($),vU=({options:$})=>({...aq($),isSync:!0}),aq=($)=>({options:{...fU($),...$}}),fU=({input:$,inputFile:q,stdio:J})=>$===void 0&&q===void 0&&J===void 0?{stdin:"inherit"}:{},tq={preferLocal:!0};var h=k1(()=>({})),Ej=k1(()=>({isSync:!0})),yj=k1(pq),Oj=k1(lq),Nj=k1(J7),Dj=k1(nq,{},tq,iq),{sendMessage:vj,getOneMessage:fj,getEachMessage:hj,getCancelSignal:Sj}=p5();import{access as oq,readFile as sq}from"fs/promises";import{join as l4,dirname as rq}from"path";async function t1(){if(process.env.IDF_PATH)try{return await oq(process.env.IDF_PATH),process.env.IDF_PATH}catch{}try{return await oq(W2),W2}catch{}return null}async function h$($){let q=l4($,"version.txt");try{return(await sq(q,"utf-8")).trim()}catch{}try{return(await h("git",["describe","--tags"],{cwd:$})).stdout.trim()}catch{}return null}async function eq(){let $=await t1();if(!$)return{installed:!1};let q=await h$($);return{installed:!0,path:$,version:q||void 0}}async function O1($){let q=l4($,"CMakeLists.txt");try{let J=await sq(q,"utf-8");return J.includes("$ENV{IDF_PATH}")||J.includes("idf_component_register")}catch{return!1}}async function i($){let q=$;while(q!==rq(q)){if(await O1(q))return q;q=rq(q)}return null}function d4($){return l4($,"export.sh")}async function i4($,q,J={}){let{cwd:X,operationId:Z,env:H}=J,Q={cwd:X,env:{...process.env,...H},reject:!1};try{let Y=h($,q,Q);if(Z)Y.stdout?.on("data",(K)=>{R.emit(Z,{type:"stdout",text:K.toString()})}),Y.stderr?.on("data",(K)=>{R.emit(Z,{type:"stderr",text:K.toString()})});let G=await Y;return{ok:!0,data:{stdout:String(G.stdout??""),stderr:String(G.stderr??""),exitCode:G.exitCode??0}}}catch(Y){return{ok:!1,error:`Failed to execute ${$}: ${Y}`}}}async function X1($,q,J={}){let X=await t1();if(!X)return{ok:!1,error:"ESP-IDF not found. Run `espcli install` first.",code:"IDF_NOT_FOUND"};let H=`source ${d4(X)} > /dev/null 2>&1 && ${$} ${q.join(" ")}`,{cwd:Q,operationId:Y,env:G}=J,K={cwd:Q,env:{...process.env,...G},shell:!0,reject:!1};try{let U=h(H,[],K);if(Y)U.stdout?.on("data",(z)=>{R.emit(Y,{type:"stdout",text:z.toString()})}),U.stderr?.on("data",(z)=>{R.emit(Y,{type:"stderr",text:z.toString()})});let B=await U;return{ok:!0,data:{stdout:String(B.stdout??""),stderr:String(B.stderr??""),exitCode:B.exitCode??0}}}catch(U){return{ok:!1,error:`Failed to execute ${$}: ${U}`}}}async function S$($,q,J={}){let X=await t1();if(!X)return null;let H=`source ${d4(X)} > /dev/null 2>&1 && ${$} ${q.join(" ")}`,{cwd:Q,operationId:Y,env:G,interactive:K}=J,U=h(H,[],{cwd:Q,env:{...process.env,...G},shell:!0,reject:!1,stdin:K?"inherit":"pipe",stdout:K?"inherit":"pipe",stderr:K?"inherit":"pipe"});if(Y&&!K)U.stdout?.on("data",(z)=>{R.emit(Y,{type:"stdout",text:z.toString()})}),U.stderr?.on("data",(z)=>{R.emit(Y,{type:"stderr",text:z.toString()})});let B=U.then(()=>{});return{proc:U,promise:B}}import{homedir as hU}from"os";import{join as SU}from"path";import{readFile as bU,appendFile as gU,access as sj}from"fs/promises";function $J(){let $=process.env.SHELL||"";if($.includes("zsh"))return"zsh";if($.includes("bash"))return"bash";if($.includes("fish"))return"fish";return"unknown"}function b$(){let $=$J(),q=g3[$]||"",J=q?SU(hU(),q):"";return{type:$,configPath:J}}async function cU($){let{configPath:q}=b$();if(!q)return!1;try{return(await bU(q,"utf-8")).includes($)}catch{return!1}}async function qJ($){let{configPath:q,type:J}=b$();if(!q)return{ok:!1,error:`Unsupported shell: ${J}`};if(await cU($))return{ok:!0,data:void 0};try{return await gU(q,`
70
70
  ${$}
71
- `),{ok:!0,data:void 0}}catch(Z){return{ok:!1,error:`Failed to modify ${q}: ${Z}`}}}function eq($){if(rq()==="fish")return`source ${$}/export.fish`;return`. ${$}/export.sh`}import{mkdir as hU,access as SU}from"fs/promises";import{join as bU}from"path";async function $J($={},q){let J=q||x(),X=$.path||j0,Z=$.target||"all",H=$.addToShell??!0,Q=bU(X,"esp-idf");try{await SU(Q);let z=await v$(Q);return R.emit(J,{type:"log",level:"info",message:`ESP-IDF already installed at ${Q}`}),{ok:!0,data:{idfPath:Q,version:z||"unknown",addedToShell:!1}}}catch{}R.emit(J,{type:"progress",message:"Creating ESP directory..."});try{await hU(X,{recursive:!0})}catch(z){return{ok:!1,error:`Failed to create directory: ${z}`}}R.emit(J,{type:"progress",message:"Cloning ESP-IDF repository...",percent:10});let Y=await p4("git",["clone","--recursive",N3],{cwd:X,operationId:J});if(!Y.ok)return{ok:!1,error:Y.error};if(Y.data.exitCode!==0)return{ok:!1,error:`Git clone failed with exit code ${Y.data.exitCode}`};R.emit(J,{type:"progress",message:"Running install script...",percent:50});let K=await p4("./install.sh",Z==="all"?["all"]:[Z],{cwd:Q,operationId:J});if(!K.ok)return{ok:!1,error:K.error};if(K.data.exitCode!==0)return{ok:!1,error:`Install script failed with exit code ${K.data.exitCode}`};let U=!1;if(H){R.emit(J,{type:"progress",message:"Configuring shell...",percent:90});let z=eq(Q),L=await sq(z);if(L.ok)U=!0;else R.emit(J,{type:"log",level:"warn",message:L.error})}let B=await v$(Q);return R.emit(J,{type:"complete",result:{idfPath:Q,version:B,addedToShell:U}}),{ok:!0,data:{idfPath:Q,version:B||"unknown",addedToShell:U}}}import{stripVTControlCharacters as J3}from"node:util";var S=o(d4(),1),VJ=o(y1(),1);import{stdin as zJ,stdout as LJ}from"node:process";import*as k1 from"node:readline";import ZJ from"node:readline";import{Writable as lU}from"node:stream";function dU({onlyFirst:$=!1}={}){let q=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(q,$?void 0:"g")}var iU=dU();function WJ($){if(typeof $!="string")throw TypeError(`Expected a \`string\`, got \`${typeof $}\``);return $.replace(iU,"")}function _J($){return $&&$.__esModule&&Object.prototype.hasOwnProperty.call($,"default")?$.default:$}var RJ={exports:{}};(function($){var q={};$.exports=q,q.eastAsianWidth=function(X){var Z=X.charCodeAt(0),H=X.length==2?X.charCodeAt(1):0,Q=Z;return 55296<=Z&&Z<=56319&&56320<=H&&H<=57343&&(Z&=1023,H&=1023,Q=Z<<10|H,Q+=65536),Q==12288||65281<=Q&&Q<=65376||65504<=Q&&Q<=65510?"F":Q==8361||65377<=Q&&Q<=65470||65474<=Q&&Q<=65479||65482<=Q&&Q<=65487||65490<=Q&&Q<=65495||65498<=Q&&Q<=65500||65512<=Q&&Q<=65518?"H":4352<=Q&&Q<=4447||4515<=Q&&Q<=4519||4602<=Q&&Q<=4607||9001<=Q&&Q<=9002||11904<=Q&&Q<=11929||11931<=Q&&Q<=12019||12032<=Q&&Q<=12245||12272<=Q&&Q<=12283||12289<=Q&&Q<=12350||12353<=Q&&Q<=12438||12441<=Q&&Q<=12543||12549<=Q&&Q<=12589||12593<=Q&&Q<=12686||12688<=Q&&Q<=12730||12736<=Q&&Q<=12771||12784<=Q&&Q<=12830||12832<=Q&&Q<=12871||12880<=Q&&Q<=13054||13056<=Q&&Q<=19903||19968<=Q&&Q<=42124||42128<=Q&&Q<=42182||43360<=Q&&Q<=43388||44032<=Q&&Q<=55203||55216<=Q&&Q<=55238||55243<=Q&&Q<=55291||63744<=Q&&Q<=64255||65040<=Q&&Q<=65049||65072<=Q&&Q<=65106||65108<=Q&&Q<=65126||65128<=Q&&Q<=65131||110592<=Q&&Q<=110593||127488<=Q&&Q<=127490||127504<=Q&&Q<=127546||127552<=Q&&Q<=127560||127568<=Q&&Q<=127569||131072<=Q&&Q<=194367||177984<=Q&&Q<=196605||196608<=Q&&Q<=262141?"W":32<=Q&&Q<=126||162<=Q&&Q<=163||165<=Q&&Q<=166||Q==172||Q==175||10214<=Q&&Q<=10221||10629<=Q&&Q<=10630?"Na":Q==161||Q==164||167<=Q&&Q<=168||Q==170||173<=Q&&Q<=174||176<=Q&&Q<=180||182<=Q&&Q<=186||188<=Q&&Q<=191||Q==198||Q==208||215<=Q&&Q<=216||222<=Q&&Q<=225||Q==230||232<=Q&&Q<=234||236<=Q&&Q<=237||Q==240||242<=Q&&Q<=243||247<=Q&&Q<=250||Q==252||Q==254||Q==257||Q==273||Q==275||Q==283||294<=Q&&Q<=295||Q==299||305<=Q&&Q<=307||Q==312||319<=Q&&Q<=322||Q==324||328<=Q&&Q<=331||Q==333||338<=Q&&Q<=339||358<=Q&&Q<=359||Q==363||Q==462||Q==464||Q==466||Q==468||Q==470||Q==472||Q==474||Q==476||Q==593||Q==609||Q==708||Q==711||713<=Q&&Q<=715||Q==717||Q==720||728<=Q&&Q<=731||Q==733||Q==735||768<=Q&&Q<=879||913<=Q&&Q<=929||931<=Q&&Q<=937||945<=Q&&Q<=961||963<=Q&&Q<=969||Q==1025||1040<=Q&&Q<=1103||Q==1105||Q==8208||8211<=Q&&Q<=8214||8216<=Q&&Q<=8217||8220<=Q&&Q<=8221||8224<=Q&&Q<=8226||8228<=Q&&Q<=8231||Q==8240||8242<=Q&&Q<=8243||Q==8245||Q==8251||Q==8254||Q==8308||Q==8319||8321<=Q&&Q<=8324||Q==8364||Q==8451||Q==8453||Q==8457||Q==8467||Q==8470||8481<=Q&&Q<=8482||Q==8486||Q==8491||8531<=Q&&Q<=8532||8539<=Q&&Q<=8542||8544<=Q&&Q<=8555||8560<=Q&&Q<=8569||Q==8585||8592<=Q&&Q<=8601||8632<=Q&&Q<=8633||Q==8658||Q==8660||Q==8679||Q==8704||8706<=Q&&Q<=8707||8711<=Q&&Q<=8712||Q==8715||Q==8719||Q==8721||Q==8725||Q==8730||8733<=Q&&Q<=8736||Q==8739||Q==8741||8743<=Q&&Q<=8748||Q==8750||8756<=Q&&Q<=8759||8764<=Q&&Q<=8765||Q==8776||Q==8780||Q==8786||8800<=Q&&Q<=8801||8804<=Q&&Q<=8807||8810<=Q&&Q<=8811||8814<=Q&&Q<=8815||8834<=Q&&Q<=8835||8838<=Q&&Q<=8839||Q==8853||Q==8857||Q==8869||Q==8895||Q==8978||9312<=Q&&Q<=9449||9451<=Q&&Q<=9547||9552<=Q&&Q<=9587||9600<=Q&&Q<=9615||9618<=Q&&Q<=9621||9632<=Q&&Q<=9633||9635<=Q&&Q<=9641||9650<=Q&&Q<=9651||9654<=Q&&Q<=9655||9660<=Q&&Q<=9661||9664<=Q&&Q<=9665||9670<=Q&&Q<=9672||Q==9675||9678<=Q&&Q<=9681||9698<=Q&&Q<=9701||Q==9711||9733<=Q&&Q<=9734||Q==9737||9742<=Q&&Q<=9743||9748<=Q&&Q<=9749||Q==9756||Q==9758||Q==9792||Q==9794||9824<=Q&&Q<=9825||9827<=Q&&Q<=9829||9831<=Q&&Q<=9834||9836<=Q&&Q<=9837||Q==9839||9886<=Q&&Q<=9887||9918<=Q&&Q<=9919||9924<=Q&&Q<=9933||9935<=Q&&Q<=9953||Q==9955||9960<=Q&&Q<=9983||Q==10045||Q==10071||10102<=Q&&Q<=10111||11093<=Q&&Q<=11097||12872<=Q&&Q<=12879||57344<=Q&&Q<=63743||65024<=Q&&Q<=65039||Q==65533||127232<=Q&&Q<=127242||127248<=Q&&Q<=127277||127280<=Q&&Q<=127337||127344<=Q&&Q<=127386||917760<=Q&&Q<=917999||983040<=Q&&Q<=1048573||1048576<=Q&&Q<=1114109?"A":"N"},q.characterLength=function(X){var Z=this.eastAsianWidth(X);return Z=="F"||Z=="W"||Z=="A"?2:1};function J(X){return X.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}q.length=function(X){for(var Z=J(X),H=0,Q=0;Q<Z.length;Q++)H=H+this.characterLength(Z[Q]);return H},q.slice=function(X,Z,H){textLen=q.length(X),Z=Z||0,H=H||1,Z<0&&(Z=textLen+Z),H<0&&(H=textLen+H);for(var Q="",Y=0,G=J(X),K=0;K<G.length;K++){var U=G[K],B=q.length(U);if(Y>=Z-(B==2?1:0))if(Y+B<=H)Q+=U;else break;Y+=B}return Q}})(RJ);var nU=RJ.exports,aU=_J(nU),tU=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},oU=_J(tU);function V0($,q={}){if(typeof $!="string"||$.length===0||(q={ambiguousIsNarrow:!0,...q},$=WJ($),$.length===0))return 0;$=$.replace(oU()," ");let J=q.ambiguousIsNarrow?1:2,X=0;for(let Z of $){let H=Z.codePointAt(0);if(H<=31||H>=127&&H<=159||H>=768&&H<=879)continue;switch(aU.eastAsianWidth(Z)){case"F":case"W":X+=2;break;case"A":X+=J;break;default:X+=1}}return X}var n4=10,QJ=($=0)=>(q)=>`\x1B[${q+$}m`,HJ=($=0)=>(q)=>`\x1B[${38+$};5;${q}m`,YJ=($=0)=>(q,J,X)=>`\x1B[${38+$};2;${q};${J};${X}m`,C={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(C.modifier);var rU=Object.keys(C.color),sU=Object.keys(C.bgColor);[...rU,...sU];function eU(){let $=new Map;for(let[q,J]of Object.entries(C)){for(let[X,Z]of Object.entries(J))C[X]={open:`\x1B[${Z[0]}m`,close:`\x1B[${Z[1]}m`},J[X]=C[X],$.set(Z[0],Z[1]);Object.defineProperty(C,q,{value:J,enumerable:!1})}return Object.defineProperty(C,"codes",{value:$,enumerable:!1}),C.color.close="\x1B[39m",C.bgColor.close="\x1B[49m",C.color.ansi=QJ(),C.color.ansi256=HJ(),C.color.ansi16m=YJ(),C.bgColor.ansi=QJ(n4),C.bgColor.ansi256=HJ(n4),C.bgColor.ansi16m=YJ(n4),Object.defineProperties(C,{rgbToAnsi256:{value:(q,J,X)=>q===J&&J===X?q<8?16:q>248?231:Math.round((q-8)/247*24)+232:16+36*Math.round(q/255*5)+6*Math.round(J/255*5)+Math.round(X/255*5),enumerable:!1},hexToRgb:{value:(q)=>{let J=/[a-f\d]{6}|[a-f\d]{3}/i.exec(q.toString(16));if(!J)return[0,0,0];let[X]=J;X.length===3&&(X=[...X].map((H)=>H+H).join(""));let Z=Number.parseInt(X,16);return[Z>>16&255,Z>>8&255,Z&255]},enumerable:!1},hexToAnsi256:{value:(q)=>C.rgbToAnsi256(...C.hexToRgb(q)),enumerable:!1},ansi256ToAnsi:{value:(q)=>{if(q<8)return 30+q;if(q<16)return 90+(q-8);let J,X,Z;if(q>=232)J=((q-232)*10+8)/255,X=J,Z=J;else{q-=16;let Y=q%36;J=Math.floor(q/36)/5,X=Math.floor(Y/6)/5,Z=Y%6/5}let H=Math.max(J,X,Z)*2;if(H===0)return 30;let Q=30+(Math.round(Z)<<2|Math.round(X)<<1|Math.round(J));return H===2&&(Q+=60),Q},enumerable:!1},rgbToAnsi:{value:(q,J,X)=>C.ansi256ToAnsi(C.rgbToAnsi256(q,J,X)),enumerable:!1},hexToAnsi:{value:(q)=>C.ansi256ToAnsi(C.hexToAnsi256(q)),enumerable:!1}}),C}var $B=eU(),c$=new Set(["\x1B","›"]),qB=39,o4="\x07",TJ="[",JB="]",PJ="m",r4=`${JB}8;;`,GJ=($)=>`${c$.values().next().value}${TJ}${$}${PJ}`,KJ=($)=>`${c$.values().next().value}${r4}${$}${o4}`,XB=($)=>$.split(" ").map((q)=>V0(q)),a4=($,q,J)=>{let X=[...q],Z=!1,H=!1,Q=V0(WJ($[$.length-1]));for(let[Y,G]of X.entries()){let K=V0(G);if(Q+K<=J?$[$.length-1]+=G:($.push(G),Q=0),c$.has(G)&&(Z=!0,H=X.slice(Y+1).join("").startsWith(r4)),Z){H?G===o4&&(Z=!1,H=!1):G===PJ&&(Z=!1);continue}Q+=K,Q===J&&Y<X.length-1&&($.push(""),Q=0)}!Q&&$[$.length-1].length>0&&$.length>1&&($[$.length-2]+=$.pop())},ZB=($)=>{let q=$.split(" "),J=q.length;for(;J>0&&!(V0(q[J-1])>0);)J--;return J===q.length?$:q.slice(0,J).join(" ")+q.slice(J).join("")},QB=($,q,J={})=>{if(J.trim!==!1&&$.trim()==="")return"";let X="",Z,H,Q=XB($),Y=[""];for(let[K,U]of $.split(" ").entries()){J.trim!==!1&&(Y[Y.length-1]=Y[Y.length-1].trimStart());let B=V0(Y[Y.length-1]);if(K!==0&&(B>=q&&(J.wordWrap===!1||J.trim===!1)&&(Y.push(""),B=0),(B>0||J.trim===!1)&&(Y[Y.length-1]+=" ",B++)),J.hard&&Q[K]>q){let z=q-B,L=1+Math.floor((Q[K]-z-1)/q);Math.floor((Q[K]-1)/q)<L&&Y.push(""),a4(Y,U,q);continue}if(B+Q[K]>q&&B>0&&Q[K]>0){if(J.wordWrap===!1&&B<q){a4(Y,U,q);continue}Y.push("")}if(B+Q[K]>q&&J.wordWrap===!1){a4(Y,U,q);continue}Y[Y.length-1]+=U}J.trim!==!1&&(Y=Y.map((K)=>ZB(K)));let G=[...Y.join(`
72
- `)];for(let[K,U]of G.entries()){if(X+=U,c$.has(U)){let{groups:z}=new RegExp(`(?:\\${TJ}(?<code>\\d+)m|\\${r4}(?<uri>.*)${o4})`).exec(G.slice(K).join(""))||{groups:{}};if(z.code!==void 0){let L=Number.parseFloat(z.code);Z=L===qB?void 0:L}else z.uri!==void 0&&(H=z.uri.length===0?void 0:z.uri)}let B=$B.codes.get(Number(Z));G[K+1]===`
73
- `?(H&&(X+=KJ("")),Z&&B&&(X+=GJ(B))):U===`
74
- `&&(Z&&B&&(X+=GJ(Z)),H&&(X+=KJ(H)))}return X};function UJ($,q,J){return String($).normalize().replace(/\r\n/g,`
71
+ `),{ok:!0,data:void 0}}catch(Z){return{ok:!1,error:`Failed to modify ${q}: ${Z}`}}}function g$($){if($J()==="fish")return`source ${$}/export.fish`;return`. ${$}/export.sh`}import{mkdir as mU,access as uU}from"fs/promises";import{join as pU}from"path";async function JJ($={},q){let J=q||j(),X=$.path||C0,Z=$.target||"all",H=$.addToShell??!0,Q=pU(X,"esp-idf");try{await uU(Q);let z=await h$(Q);return R.emit(J,{type:"log",level:"info",message:`ESP-IDF already installed at ${Q}`}),{ok:!0,data:{idfPath:Q,version:z||"unknown",addedToShell:!1}}}catch{}R.emit(J,{type:"progress",message:"Creating ESP directory..."});try{await mU(X,{recursive:!0})}catch(z){return{ok:!1,error:`Failed to create directory: ${z}`}}R.emit(J,{type:"progress",message:"Cloning ESP-IDF repository...",percent:10});let Y=await i4("git",["clone","--recursive",h3],{cwd:X,operationId:J});if(!Y.ok)return{ok:!1,error:Y.error};if(Y.data.exitCode!==0)return{ok:!1,error:`Git clone failed with exit code ${Y.data.exitCode}`};R.emit(J,{type:"progress",message:"Running install script...",percent:50});let K=await i4("./install.sh",Z==="all"?["all"]:[Z],{cwd:Q,operationId:J});if(!K.ok)return{ok:!1,error:K.error};if(K.data.exitCode!==0)return{ok:!1,error:`Install script failed with exit code ${K.data.exitCode}`};let U=!1;if(H){R.emit(J,{type:"progress",message:"Configuring shell...",percent:90});let z=g$(Q),W=await qJ(z);if(W.ok)U=!0;else R.emit(J,{type:"log",level:"warn",message:W.error})}let B=await h$(Q);return R.emit(J,{type:"complete",result:{idfPath:Q,version:B,addedToShell:U}}),{ok:!0,data:{idfPath:Q,version:B||"unknown",addedToShell:U}}}import{stripVTControlCharacters as Q3}from"node:util";var S=n(a4(),1),_J=n(F1(),1);import{stdin as WJ,stdout as VJ}from"node:process";import*as x1 from"node:readline";import HJ from"node:readline";import{Writable as tU}from"node:stream";function oU({onlyFirst:$=!1}={}){let q=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(q,$?void 0:"g")}var rU=oU();function RJ($){if(typeof $!="string")throw TypeError(`Expected a \`string\`, got \`${typeof $}\``);return $.replace(rU,"")}function PJ($){return $&&$.__esModule&&Object.prototype.hasOwnProperty.call($,"default")?$.default:$}var TJ={exports:{}};(function($){var q={};$.exports=q,q.eastAsianWidth=function(X){var Z=X.charCodeAt(0),H=X.length==2?X.charCodeAt(1):0,Q=Z;return 55296<=Z&&Z<=56319&&56320<=H&&H<=57343&&(Z&=1023,H&=1023,Q=Z<<10|H,Q+=65536),Q==12288||65281<=Q&&Q<=65376||65504<=Q&&Q<=65510?"F":Q==8361||65377<=Q&&Q<=65470||65474<=Q&&Q<=65479||65482<=Q&&Q<=65487||65490<=Q&&Q<=65495||65498<=Q&&Q<=65500||65512<=Q&&Q<=65518?"H":4352<=Q&&Q<=4447||4515<=Q&&Q<=4519||4602<=Q&&Q<=4607||9001<=Q&&Q<=9002||11904<=Q&&Q<=11929||11931<=Q&&Q<=12019||12032<=Q&&Q<=12245||12272<=Q&&Q<=12283||12289<=Q&&Q<=12350||12353<=Q&&Q<=12438||12441<=Q&&Q<=12543||12549<=Q&&Q<=12589||12593<=Q&&Q<=12686||12688<=Q&&Q<=12730||12736<=Q&&Q<=12771||12784<=Q&&Q<=12830||12832<=Q&&Q<=12871||12880<=Q&&Q<=13054||13056<=Q&&Q<=19903||19968<=Q&&Q<=42124||42128<=Q&&Q<=42182||43360<=Q&&Q<=43388||44032<=Q&&Q<=55203||55216<=Q&&Q<=55238||55243<=Q&&Q<=55291||63744<=Q&&Q<=64255||65040<=Q&&Q<=65049||65072<=Q&&Q<=65106||65108<=Q&&Q<=65126||65128<=Q&&Q<=65131||110592<=Q&&Q<=110593||127488<=Q&&Q<=127490||127504<=Q&&Q<=127546||127552<=Q&&Q<=127560||127568<=Q&&Q<=127569||131072<=Q&&Q<=194367||177984<=Q&&Q<=196605||196608<=Q&&Q<=262141?"W":32<=Q&&Q<=126||162<=Q&&Q<=163||165<=Q&&Q<=166||Q==172||Q==175||10214<=Q&&Q<=10221||10629<=Q&&Q<=10630?"Na":Q==161||Q==164||167<=Q&&Q<=168||Q==170||173<=Q&&Q<=174||176<=Q&&Q<=180||182<=Q&&Q<=186||188<=Q&&Q<=191||Q==198||Q==208||215<=Q&&Q<=216||222<=Q&&Q<=225||Q==230||232<=Q&&Q<=234||236<=Q&&Q<=237||Q==240||242<=Q&&Q<=243||247<=Q&&Q<=250||Q==252||Q==254||Q==257||Q==273||Q==275||Q==283||294<=Q&&Q<=295||Q==299||305<=Q&&Q<=307||Q==312||319<=Q&&Q<=322||Q==324||328<=Q&&Q<=331||Q==333||338<=Q&&Q<=339||358<=Q&&Q<=359||Q==363||Q==462||Q==464||Q==466||Q==468||Q==470||Q==472||Q==474||Q==476||Q==593||Q==609||Q==708||Q==711||713<=Q&&Q<=715||Q==717||Q==720||728<=Q&&Q<=731||Q==733||Q==735||768<=Q&&Q<=879||913<=Q&&Q<=929||931<=Q&&Q<=937||945<=Q&&Q<=961||963<=Q&&Q<=969||Q==1025||1040<=Q&&Q<=1103||Q==1105||Q==8208||8211<=Q&&Q<=8214||8216<=Q&&Q<=8217||8220<=Q&&Q<=8221||8224<=Q&&Q<=8226||8228<=Q&&Q<=8231||Q==8240||8242<=Q&&Q<=8243||Q==8245||Q==8251||Q==8254||Q==8308||Q==8319||8321<=Q&&Q<=8324||Q==8364||Q==8451||Q==8453||Q==8457||Q==8467||Q==8470||8481<=Q&&Q<=8482||Q==8486||Q==8491||8531<=Q&&Q<=8532||8539<=Q&&Q<=8542||8544<=Q&&Q<=8555||8560<=Q&&Q<=8569||Q==8585||8592<=Q&&Q<=8601||8632<=Q&&Q<=8633||Q==8658||Q==8660||Q==8679||Q==8704||8706<=Q&&Q<=8707||8711<=Q&&Q<=8712||Q==8715||Q==8719||Q==8721||Q==8725||Q==8730||8733<=Q&&Q<=8736||Q==8739||Q==8741||8743<=Q&&Q<=8748||Q==8750||8756<=Q&&Q<=8759||8764<=Q&&Q<=8765||Q==8776||Q==8780||Q==8786||8800<=Q&&Q<=8801||8804<=Q&&Q<=8807||8810<=Q&&Q<=8811||8814<=Q&&Q<=8815||8834<=Q&&Q<=8835||8838<=Q&&Q<=8839||Q==8853||Q==8857||Q==8869||Q==8895||Q==8978||9312<=Q&&Q<=9449||9451<=Q&&Q<=9547||9552<=Q&&Q<=9587||9600<=Q&&Q<=9615||9618<=Q&&Q<=9621||9632<=Q&&Q<=9633||9635<=Q&&Q<=9641||9650<=Q&&Q<=9651||9654<=Q&&Q<=9655||9660<=Q&&Q<=9661||9664<=Q&&Q<=9665||9670<=Q&&Q<=9672||Q==9675||9678<=Q&&Q<=9681||9698<=Q&&Q<=9701||Q==9711||9733<=Q&&Q<=9734||Q==9737||9742<=Q&&Q<=9743||9748<=Q&&Q<=9749||Q==9756||Q==9758||Q==9792||Q==9794||9824<=Q&&Q<=9825||9827<=Q&&Q<=9829||9831<=Q&&Q<=9834||9836<=Q&&Q<=9837||Q==9839||9886<=Q&&Q<=9887||9918<=Q&&Q<=9919||9924<=Q&&Q<=9933||9935<=Q&&Q<=9953||Q==9955||9960<=Q&&Q<=9983||Q==10045||Q==10071||10102<=Q&&Q<=10111||11093<=Q&&Q<=11097||12872<=Q&&Q<=12879||57344<=Q&&Q<=63743||65024<=Q&&Q<=65039||Q==65533||127232<=Q&&Q<=127242||127248<=Q&&Q<=127277||127280<=Q&&Q<=127337||127344<=Q&&Q<=127386||917760<=Q&&Q<=917999||983040<=Q&&Q<=1048573||1048576<=Q&&Q<=1114109?"A":"N"},q.characterLength=function(X){var Z=this.eastAsianWidth(X);return Z=="F"||Z=="W"||Z=="A"?2:1};function J(X){return X.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}q.length=function(X){for(var Z=J(X),H=0,Q=0;Q<Z.length;Q++)H=H+this.characterLength(Z[Q]);return H},q.slice=function(X,Z,H){textLen=q.length(X),Z=Z||0,H=H||1,Z<0&&(Z=textLen+Z),H<0&&(H=textLen+H);for(var Q="",Y=0,G=J(X),K=0;K<G.length;K++){var U=G[K],B=q.length(U);if(Y>=Z-(B==2?1:0))if(Y+B<=H)Q+=U;else break;Y+=B}return Q}})(TJ);var sU=TJ.exports,eU=PJ(sU),$B=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},qB=PJ($B);function _0($,q={}){if(typeof $!="string"||$.length===0||(q={ambiguousIsNarrow:!0,...q},$=RJ($),$.length===0))return 0;$=$.replace(qB()," ");let J=q.ambiguousIsNarrow?1:2,X=0;for(let Z of $){let H=Z.codePointAt(0);if(H<=31||H>=127&&H<=159||H>=768&&H<=879)continue;switch(eU.eastAsianWidth(Z)){case"F":case"W":X+=2;break;case"A":X+=J;break;default:X+=1}}return X}var o4=10,YJ=($=0)=>(q)=>`\x1B[${q+$}m`,GJ=($=0)=>(q)=>`\x1B[${38+$};5;${q}m`,KJ=($=0)=>(q,J,X)=>`\x1B[${38+$};2;${q};${J};${X}m`,C={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(C.modifier);var JB=Object.keys(C.color),XB=Object.keys(C.bgColor);[...JB,...XB];function ZB(){let $=new Map;for(let[q,J]of Object.entries(C)){for(let[X,Z]of Object.entries(J))C[X]={open:`\x1B[${Z[0]}m`,close:`\x1B[${Z[1]}m`},J[X]=C[X],$.set(Z[0],Z[1]);Object.defineProperty(C,q,{value:J,enumerable:!1})}return Object.defineProperty(C,"codes",{value:$,enumerable:!1}),C.color.close="\x1B[39m",C.bgColor.close="\x1B[49m",C.color.ansi=YJ(),C.color.ansi256=GJ(),C.color.ansi16m=KJ(),C.bgColor.ansi=YJ(o4),C.bgColor.ansi256=GJ(o4),C.bgColor.ansi16m=KJ(o4),Object.defineProperties(C,{rgbToAnsi256:{value:(q,J,X)=>q===J&&J===X?q<8?16:q>248?231:Math.round((q-8)/247*24)+232:16+36*Math.round(q/255*5)+6*Math.round(J/255*5)+Math.round(X/255*5),enumerable:!1},hexToRgb:{value:(q)=>{let J=/[a-f\d]{6}|[a-f\d]{3}/i.exec(q.toString(16));if(!J)return[0,0,0];let[X]=J;X.length===3&&(X=[...X].map((H)=>H+H).join(""));let Z=Number.parseInt(X,16);return[Z>>16&255,Z>>8&255,Z&255]},enumerable:!1},hexToAnsi256:{value:(q)=>C.rgbToAnsi256(...C.hexToRgb(q)),enumerable:!1},ansi256ToAnsi:{value:(q)=>{if(q<8)return 30+q;if(q<16)return 90+(q-8);let J,X,Z;if(q>=232)J=((q-232)*10+8)/255,X=J,Z=J;else{q-=16;let Y=q%36;J=Math.floor(q/36)/5,X=Math.floor(Y/6)/5,Z=Y%6/5}let H=Math.max(J,X,Z)*2;if(H===0)return 30;let Q=30+(Math.round(Z)<<2|Math.round(X)<<1|Math.round(J));return H===2&&(Q+=60),Q},enumerable:!1},rgbToAnsi:{value:(q,J,X)=>C.ansi256ToAnsi(C.rgbToAnsi256(q,J,X)),enumerable:!1},hexToAnsi:{value:(q)=>C.ansi256ToAnsi(C.hexToAnsi256(q)),enumerable:!1}}),C}var QB=ZB(),l$=new Set(["\x1B","›"]),HB=39,e4="\x07",kJ="[",YB="]",FJ="m",$3=`${YB}8;;`,UJ=($)=>`${l$.values().next().value}${kJ}${$}${FJ}`,BJ=($)=>`${l$.values().next().value}${$3}${$}${e4}`,GB=($)=>$.split(" ").map((q)=>_0(q)),r4=($,q,J)=>{let X=[...q],Z=!1,H=!1,Q=_0(RJ($[$.length-1]));for(let[Y,G]of X.entries()){let K=_0(G);if(Q+K<=J?$[$.length-1]+=G:($.push(G),Q=0),l$.has(G)&&(Z=!0,H=X.slice(Y+1).join("").startsWith($3)),Z){H?G===e4&&(Z=!1,H=!1):G===FJ&&(Z=!1);continue}Q+=K,Q===J&&Y<X.length-1&&($.push(""),Q=0)}!Q&&$[$.length-1].length>0&&$.length>1&&($[$.length-2]+=$.pop())},KB=($)=>{let q=$.split(" "),J=q.length;for(;J>0&&!(_0(q[J-1])>0);)J--;return J===q.length?$:q.slice(0,J).join(" ")+q.slice(J).join("")},UB=($,q,J={})=>{if(J.trim!==!1&&$.trim()==="")return"";let X="",Z,H,Q=GB($),Y=[""];for(let[K,U]of $.split(" ").entries()){J.trim!==!1&&(Y[Y.length-1]=Y[Y.length-1].trimStart());let B=_0(Y[Y.length-1]);if(K!==0&&(B>=q&&(J.wordWrap===!1||J.trim===!1)&&(Y.push(""),B=0),(B>0||J.trim===!1)&&(Y[Y.length-1]+=" ",B++)),J.hard&&Q[K]>q){let z=q-B,W=1+Math.floor((Q[K]-z-1)/q);Math.floor((Q[K]-1)/q)<W&&Y.push(""),r4(Y,U,q);continue}if(B+Q[K]>q&&B>0&&Q[K]>0){if(J.wordWrap===!1&&B<q){r4(Y,U,q);continue}Y.push("")}if(B+Q[K]>q&&J.wordWrap===!1){r4(Y,U,q);continue}Y[Y.length-1]+=U}J.trim!==!1&&(Y=Y.map((K)=>KB(K)));let G=[...Y.join(`
72
+ `)];for(let[K,U]of G.entries()){if(X+=U,l$.has(U)){let{groups:z}=new RegExp(`(?:\\${kJ}(?<code>\\d+)m|\\${$3}(?<uri>.*)${e4})`).exec(G.slice(K).join(""))||{groups:{}};if(z.code!==void 0){let W=Number.parseFloat(z.code);Z=W===HB?void 0:W}else z.uri!==void 0&&(H=z.uri.length===0?void 0:z.uri)}let B=QB.codes.get(Number(Z));G[K+1]===`
73
+ `?(H&&(X+=BJ("")),Z&&B&&(X+=UJ(B))):U===`
74
+ `&&(Z&&B&&(X+=UJ(Z)),H&&(X+=BJ(H)))}return X};function zJ($,q,J){return String($).normalize().replace(/\r\n/g,`
75
75
  `).split(`
76
- `).map((X)=>QB(X,q,J)).join(`
77
- `)}var HB=["up","down","left","right","space","enter","cancel"],g$={actions:new Set(HB),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]])};function s4($,q){if(typeof $=="string")return g$.aliases.get($)===q;for(let J of $)if(J!==void 0&&s4(J,q))return!0;return!1}function YB($,q){if($===q)return;let J=$.split(`
76
+ `).map((X)=>UB(X,q,J)).join(`
77
+ `)}var BB=["up","down","left","right","space","enter","cancel"],p$={actions:new Set(BB),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]])};function q3($,q){if(typeof $=="string")return p$.aliases.get($)===q;for(let J of $)if(J!==void 0&&q3(J,q))return!0;return!1}function zB($,q){if($===q)return;let J=$.split(`
78
78
  `),X=q.split(`
79
- `),Z=[];for(let H=0;H<Math.max(J.length,X.length);H++)J[H]!==X[H]&&Z.push(H);return Z}var GB=globalThis.process.platform.startsWith("win"),t4=Symbol("clack:cancel");function a1($){return $===t4}function b$($,q){let J=$;J.isTTY&&J.setRawMode(q)}function kJ({input:$=zJ,output:q=LJ,overwrite:J=!0,hideCursor:X=!0}={}){let Z=k1.createInterface({input:$,output:q,prompt:"",tabSize:1});k1.emitKeypressEvents($,Z),$.isTTY&&$.setRawMode(!0);let H=(Q,{name:Y,sequence:G})=>{let K=String(Q);if(s4([K,Y,G],"cancel")){X&&q.write(S.cursor.show),process.exit(0);return}if(!J)return;k1.moveCursor(q,Y==="return"?0:-1,Y==="return"?-1:0,()=>{k1.clearLine(q,1,()=>{$.once("keypress",H)})})};return X&&q.write(S.cursor.hide),$.once("keypress",H),()=>{$.off("keypress",H),X&&q.write(S.cursor.show),$.isTTY&&!GB&&$.setRawMode(!1),Z.terminal=!1,Z.close()}}var KB=Object.defineProperty,UB=($,q,J)=>(q in $)?KB($,q,{enumerable:!0,configurable:!0,writable:!0,value:J}):$[q]=J,p=($,q,J)=>(UB($,typeof q!="symbol"?q+"":q,J),J);class m${constructor($,q=!0){p(this,"input"),p(this,"output"),p(this,"_abortSignal"),p(this,"rl"),p(this,"opts"),p(this,"_render"),p(this,"_track",!1),p(this,"_prevFrame",""),p(this,"_subscribers",new Map),p(this,"_cursor",0),p(this,"state","initial"),p(this,"error",""),p(this,"value");let{input:J=zJ,output:X=LJ,render:Z,signal:H,...Q}=$;this.opts=Q,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=Z.bind(this),this._track=q,this._abortSignal=H,this.input=J,this.output=X}unsubscribe(){this._subscribers.clear()}setSubscriber($,q){let J=this._subscribers.get($)??[];J.push(q),this._subscribers.set($,J)}on($,q){this.setSubscriber($,{cb:q})}once($,q){this.setSubscriber($,{cb:q,once:!0})}emit($,...q){let J=this._subscribers.get($)??[],X=[];for(let Z of J)Z.cb(...q),Z.once&&X.push(()=>J.splice(J.indexOf(Z),1));for(let Z of X)Z()}prompt(){return new Promise(($,q)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),$(t4);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let J=new lU;J._write=(X,Z,H)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),H()},this.input.pipe(J),this.rl=ZJ.createInterface({input:this.input,output:J,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),ZJ.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),b$(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(S.cursor.show),this.output.off("resize",this.render),b$(this.input,!1),$(this.value)}),this.once("cancel",()=>{this.output.write(S.cursor.show),this.output.off("resize",this.render),b$(this.input,!1),$(t4)})})}onKeypress($,q){if(this.state==="error"&&(this.state="active"),q?.name&&(!this._track&&g$.aliases.has(q.name)&&this.emit("cursor",g$.aliases.get(q.name)),g$.actions.has(q.name)&&this.emit("cursor",q.name)),$&&($.toLowerCase()==="y"||$.toLowerCase()==="n")&&this.emit("confirm",$.toLowerCase()==="y"),$==="\t"&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),$&&this.emit("key",$.toLowerCase()),q?.name==="return"){if(this.opts.validate){let J=this.opts.validate(this.value);J&&(this.error=J instanceof Error?J.message:J,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}s4([$,q?.name,q?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
80
- `),b$(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let $=UJ(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
81
- `).length-1;this.output.write(S.cursor.move(-999,$*-1))}render(){let $=UJ(this._render(this)??"",process.stdout.columns,{hard:!0});if($!==this._prevFrame){if(this.state==="initial")this.output.write(S.cursor.hide);else{let q=YB(this._prevFrame,$);if(this.restoreCursor(),q&&q?.length===1){let J=q[0];this.output.write(S.cursor.move(0,J)),this.output.write(S.erase.lines(1));let X=$.split(`
79
+ `),Z=[];for(let H=0;H<Math.max(J.length,X.length);H++)J[H]!==X[H]&&Z.push(H);return Z}var LB=globalThis.process.platform.startsWith("win"),s4=Symbol("clack:cancel");function o1($){return $===s4}function u$($,q){let J=$;J.isTTY&&J.setRawMode(q)}function xJ({input:$=WJ,output:q=VJ,overwrite:J=!0,hideCursor:X=!0}={}){let Z=x1.createInterface({input:$,output:q,prompt:"",tabSize:1});x1.emitKeypressEvents($,Z),$.isTTY&&$.setRawMode(!0);let H=(Q,{name:Y,sequence:G})=>{let K=String(Q);if(q3([K,Y,G],"cancel")){X&&q.write(S.cursor.show),process.exit(0);return}if(!J)return;x1.moveCursor(q,Y==="return"?0:-1,Y==="return"?-1:0,()=>{x1.clearLine(q,1,()=>{$.once("keypress",H)})})};return X&&q.write(S.cursor.hide),$.once("keypress",H),()=>{$.off("keypress",H),X&&q.write(S.cursor.show),$.isTTY&&!LB&&$.setRawMode(!1),Z.terminal=!1,Z.close()}}var WB=Object.defineProperty,VB=($,q,J)=>(q in $)?WB($,q,{enumerable:!0,configurable:!0,writable:!0,value:J}):$[q]=J,p=($,q,J)=>(VB($,typeof q!="symbol"?q+"":q,J),J);class d${constructor($,q=!0){p(this,"input"),p(this,"output"),p(this,"_abortSignal"),p(this,"rl"),p(this,"opts"),p(this,"_render"),p(this,"_track",!1),p(this,"_prevFrame",""),p(this,"_subscribers",new Map),p(this,"_cursor",0),p(this,"state","initial"),p(this,"error",""),p(this,"value");let{input:J=WJ,output:X=VJ,render:Z,signal:H,...Q}=$;this.opts=Q,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=Z.bind(this),this._track=q,this._abortSignal=H,this.input=J,this.output=X}unsubscribe(){this._subscribers.clear()}setSubscriber($,q){let J=this._subscribers.get($)??[];J.push(q),this._subscribers.set($,J)}on($,q){this.setSubscriber($,{cb:q})}once($,q){this.setSubscriber($,{cb:q,once:!0})}emit($,...q){let J=this._subscribers.get($)??[],X=[];for(let Z of J)Z.cb(...q),Z.once&&X.push(()=>J.splice(J.indexOf(Z),1));for(let Z of X)Z()}prompt(){return new Promise(($,q)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),$(s4);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let J=new tU;J._write=(X,Z,H)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),H()},this.input.pipe(J),this.rl=HJ.createInterface({input:this.input,output:J,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),HJ.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),u$(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(S.cursor.show),this.output.off("resize",this.render),u$(this.input,!1),$(this.value)}),this.once("cancel",()=>{this.output.write(S.cursor.show),this.output.off("resize",this.render),u$(this.input,!1),$(s4)})})}onKeypress($,q){if(this.state==="error"&&(this.state="active"),q?.name&&(!this._track&&p$.aliases.has(q.name)&&this.emit("cursor",p$.aliases.get(q.name)),p$.actions.has(q.name)&&this.emit("cursor",q.name)),$&&($.toLowerCase()==="y"||$.toLowerCase()==="n")&&this.emit("confirm",$.toLowerCase()==="y"),$==="\t"&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),$&&this.emit("key",$.toLowerCase()),q?.name==="return"){if(this.opts.validate){let J=this.opts.validate(this.value);J&&(this.error=J instanceof Error?J.message:J,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}q3([$,q?.name,q?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
80
+ `),u$(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let $=zJ(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
81
+ `).length-1;this.output.write(S.cursor.move(-999,$*-1))}render(){let $=zJ(this._render(this)??"",process.stdout.columns,{hard:!0});if($!==this._prevFrame){if(this.state==="initial")this.output.write(S.cursor.hide);else{let q=zB(this._prevFrame,$);if(this.restoreCursor(),q&&q?.length===1){let J=q[0];this.output.write(S.cursor.move(0,J)),this.output.write(S.erase.lines(1));let X=$.split(`
82
82
  `);this.output.write(X[J]),this._prevFrame=$,this.output.write(S.cursor.move(0,X.length-J-1));return}if(q&&q?.length>1){let J=q[0];this.output.write(S.cursor.move(0,J)),this.output.write(S.erase.down());let X=$.split(`
83
83
  `).slice(J);this.output.write(X.join(`
84
- `)),this._prevFrame=$;return}this.output.write(S.erase.down())}this.output.write($),this.state==="initial"&&(this.state="active"),this._prevFrame=$}}}class e4 extends m${get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor($){super($,!1),this.value=!!$.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",(q)=>{this.output.write(S.cursor.move(0,-1)),this.value=q,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}var BB;BB=new WeakMap;var zB=Object.defineProperty,LB=($,q,J)=>(q in $)?zB($,q,{enumerable:!0,configurable:!0,writable:!0,value:J}):$[q]=J,BJ=($,q,J)=>(LB($,typeof q!="symbol"?q+"":q,J),J);class $3 extends m${constructor($){super($,!1),BJ(this,"options"),BJ(this,"cursor",0),this.options=$.options,this.cursor=this.options.findIndex(({value:q})=>q===$.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",(q)=>{switch(q){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}}class q3 extends m${get valueWithCursor(){if(this.state==="submit")return this.value;if(this.cursor>=this.value.length)return`${this.value}█`;let $=this.value.slice(0,this.cursor),[q,...J]=this.value.slice(this.cursor);return`${$}${VJ.default.inverse(q)}${J.join("")}`}get cursor(){return this._cursor}constructor($){super($),this.on("finalize",()=>{this.value||(this.value=$.defaultValue)})}}var W=o(y1(),1),u$=o(d4(),1);import t from"node:process";function VB(){return t.platform!=="win32"?t.env.TERM!=="linux":!!t.env.CI||!!t.env.WT_SESSION||!!t.env.TERMINUS_SUBLIME||t.env.ConEmuTask==="{cmd::Cmder}"||t.env.TERM_PROGRAM==="Terminus-Sublime"||t.env.TERM_PROGRAM==="vscode"||t.env.TERM==="xterm-256color"||t.env.TERM==="alacritty"||t.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var X3=VB(),y=($,q)=>X3?$:q,WB=y("◆","*"),jJ=y("■","x"),xJ=y("▲","x"),H3=y("◇","o"),_B=y("┌","T"),w=y("│","|"),t1=y("└","—"),Z3=y("●",">"),Q3=y("○"," "),_M=y("◻","[•]"),RM=y("◼","[+]"),TM=y("◻","[ ]"),PM=y("▪","•"),FJ=y("─","-"),RB=y("╮","+"),TB=y("├","+"),PB=y("╯","+"),kM=y("●","•"),FM=y("◆","*"),jM=y("▲","!"),xM=y("■","x"),Y3=($)=>{switch($){case"initial":case"active":return W.default.cyan(WB);case"cancel":return W.default.red(jJ);case"error":return W.default.yellow(xJ);case"submit":return W.default.green(H3)}},kB=($)=>{let{cursor:q,options:J,style:X}=$,Z=$.maxItems??Number.POSITIVE_INFINITY,H=Math.max(process.stdout.rows-4,0),Q=Math.min(H,Math.max(Z,5)),Y=0;q>=Y+Q-3?Y=Math.max(Math.min(q-Q+3,J.length-Q),0):q<Y+2&&(Y=Math.max(q-2,0));let G=Q<J.length&&Y>0,K=Q<J.length&&Y+Q<J.length;return J.slice(Y,Y+Q).map((U,B,z)=>{let L=B===0&&G,_=B===z.length-1&&K;return L||_?W.default.dim("..."):X(U,B+Y===q)})},MJ=($)=>new q3({validate:$.validate,placeholder:$.placeholder,defaultValue:$.defaultValue,initialValue:$.initialValue,render(){let q=`${W.default.gray(w)}
85
- ${Y3(this.state)} ${$.message}
86
- `,J=$.placeholder?W.default.inverse($.placeholder[0])+W.default.dim($.placeholder.slice(1)):W.default.inverse(W.default.hidden("_")),X=this.value?this.valueWithCursor:J;switch(this.state){case"error":return`${q.trim()}
87
- ${W.default.yellow(w)} ${X}
88
- ${W.default.yellow(t1)} ${W.default.yellow(this.error)}
89
- `;case"submit":return`${q}${W.default.gray(w)} ${W.default.dim(this.value||$.placeholder)}`;case"cancel":return`${q}${W.default.gray(w)} ${W.default.strikethrough(W.default.dim(this.value??""))}${this.value?.trim()?`
90
- ${W.default.gray(w)}`:""}`;default:return`${q}${W.default.cyan(w)} ${X}
91
- ${W.default.cyan(t1)}
92
- `}}}).prompt();var CJ=($)=>{let q=$.active??"Yes",J=$.inactive??"No";return new e4({active:q,inactive:J,initialValue:$.initialValue??!0,render(){let X=`${W.default.gray(w)}
93
- ${Y3(this.state)} ${$.message}
94
- `,Z=this.value?q:J;switch(this.state){case"submit":return`${X}${W.default.gray(w)} ${W.default.dim(Z)}`;case"cancel":return`${X}${W.default.gray(w)} ${W.default.strikethrough(W.default.dim(Z))}
95
- ${W.default.gray(w)}`;default:return`${X}${W.default.cyan(w)} ${this.value?`${W.default.green(Z3)} ${q}`:`${W.default.dim(Q3)} ${W.default.dim(q)}`} ${W.default.dim("/")} ${this.value?`${W.default.dim(Q3)} ${W.default.dim(J)}`:`${W.default.green(Z3)} ${J}`}
96
- ${W.default.cyan(t1)}
97
- `}}}).prompt()},wJ=($)=>{let q=(J,X)=>{let Z=J.label??String(J.value);switch(X){case"selected":return`${W.default.dim(Z)}`;case"active":return`${W.default.green(Z3)} ${Z} ${J.hint?W.default.dim(`(${J.hint})`):""}`;case"cancelled":return`${W.default.strikethrough(W.default.dim(Z))}`;default:return`${W.default.dim(Q3)} ${W.default.dim(Z)}`}};return new $3({options:$.options,initialValue:$.initialValue,render(){let J=`${W.default.gray(w)}
98
- ${Y3(this.state)} ${$.message}
99
- `;switch(this.state){case"submit":return`${J}${W.default.gray(w)} ${q(this.options[this.cursor],"selected")}`;case"cancel":return`${J}${W.default.gray(w)} ${q(this.options[this.cursor],"cancelled")}
100
- ${W.default.gray(w)}`;default:return`${J}${W.default.cyan(w)} ${kB({cursor:this.cursor,options:this.options,maxItems:$.maxItems,style:(X,Z)=>q(X,Z?"active":"inactive")}).join(`
101
- ${W.default.cyan(w)} `)}
102
- ${W.default.cyan(t1)}
103
- `}}}).prompt()};var IJ=($="",q="")=>{let J=`
84
+ `)),this._prevFrame=$;return}this.output.write(S.erase.down())}this.output.write($),this.state==="initial"&&(this.state="active"),this._prevFrame=$}}}class J3 extends d${get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor($){super($,!1),this.value=!!$.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",(q)=>{this.output.write(S.cursor.move(0,-1)),this.value=q,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}var _B;_B=new WeakMap;var RB=Object.defineProperty,PB=($,q,J)=>(q in $)?RB($,q,{enumerable:!0,configurable:!0,writable:!0,value:J}):$[q]=J,LJ=($,q,J)=>(PB($,typeof q!="symbol"?q+"":q,J),J);class X3 extends d${constructor($){super($,!1),LJ(this,"options"),LJ(this,"cursor",0),this.options=$.options,this.cursor=this.options.findIndex(({value:q})=>q===$.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",(q)=>{switch(q){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}}class Z3 extends d${get valueWithCursor(){if(this.state==="submit")return this.value;if(this.cursor>=this.value.length)return`${this.value}█`;let $=this.value.slice(0,this.cursor),[q,...J]=this.value.slice(this.cursor);return`${$}${_J.default.inverse(q)}${J.join("")}`}get cursor(){return this._cursor}constructor($){super($),this.on("finalize",()=>{this.value||(this.value=$.defaultValue)})}}var V=n(F1(),1),i$=n(a4(),1);import r from"node:process";function TB(){return r.platform!=="win32"?r.env.TERM!=="linux":!!r.env.CI||!!r.env.WT_SESSION||!!r.env.TERMINUS_SUBLIME||r.env.ConEmuTask==="{cmd::Cmder}"||r.env.TERM_PROGRAM==="Terminus-Sublime"||r.env.TERM_PROGRAM==="vscode"||r.env.TERM==="xterm-256color"||r.env.TERM==="alacritty"||r.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var H3=TB(),y=($,q)=>H3?$:q,kB=y("◆","*"),MJ=y("■","x"),CJ=y("▲","x"),K3=y("◇","o"),FB=y("┌","T"),w=y("│","|"),r1=y("└","—"),Y3=y("●",">"),G3=y("○"," "),xM=y("◻","[•]"),jM=y("◼","[+]"),MM=y("◻","[ ]"),CM=y("▪","•"),jJ=y("─","-"),xB=y("╮","+"),jB=y("├","+"),MB=y("╯","+"),wM=y("●","•"),IM=y("◆","*"),AM=y("▲","!"),EM=y("■","x"),U3=($)=>{switch($){case"initial":case"active":return V.default.cyan(kB);case"cancel":return V.default.red(MJ);case"error":return V.default.yellow(CJ);case"submit":return V.default.green(K3)}},CB=($)=>{let{cursor:q,options:J,style:X}=$,Z=$.maxItems??Number.POSITIVE_INFINITY,H=Math.max(process.stdout.rows-4,0),Q=Math.min(H,Math.max(Z,5)),Y=0;q>=Y+Q-3?Y=Math.max(Math.min(q-Q+3,J.length-Q),0):q<Y+2&&(Y=Math.max(q-2,0));let G=Q<J.length&&Y>0,K=Q<J.length&&Y+Q<J.length;return J.slice(Y,Y+Q).map((U,B,z)=>{let W=B===0&&G,_=B===z.length-1&&K;return W||_?V.default.dim("..."):X(U,B+Y===q)})},wJ=($)=>new Z3({validate:$.validate,placeholder:$.placeholder,defaultValue:$.defaultValue,initialValue:$.initialValue,render(){let q=`${V.default.gray(w)}
85
+ ${U3(this.state)} ${$.message}
86
+ `,J=$.placeholder?V.default.inverse($.placeholder[0])+V.default.dim($.placeholder.slice(1)):V.default.inverse(V.default.hidden("_")),X=this.value?this.valueWithCursor:J;switch(this.state){case"error":return`${q.trim()}
87
+ ${V.default.yellow(w)} ${X}
88
+ ${V.default.yellow(r1)} ${V.default.yellow(this.error)}
89
+ `;case"submit":return`${q}${V.default.gray(w)} ${V.default.dim(this.value||$.placeholder)}`;case"cancel":return`${q}${V.default.gray(w)} ${V.default.strikethrough(V.default.dim(this.value??""))}${this.value?.trim()?`
90
+ ${V.default.gray(w)}`:""}`;default:return`${q}${V.default.cyan(w)} ${X}
91
+ ${V.default.cyan(r1)}
92
+ `}}}).prompt();var IJ=($)=>{let q=$.active??"Yes",J=$.inactive??"No";return new J3({active:q,inactive:J,initialValue:$.initialValue??!0,render(){let X=`${V.default.gray(w)}
93
+ ${U3(this.state)} ${$.message}
94
+ `,Z=this.value?q:J;switch(this.state){case"submit":return`${X}${V.default.gray(w)} ${V.default.dim(Z)}`;case"cancel":return`${X}${V.default.gray(w)} ${V.default.strikethrough(V.default.dim(Z))}
95
+ ${V.default.gray(w)}`;default:return`${X}${V.default.cyan(w)} ${this.value?`${V.default.green(Y3)} ${q}`:`${V.default.dim(G3)} ${V.default.dim(q)}`} ${V.default.dim("/")} ${this.value?`${V.default.dim(G3)} ${V.default.dim(J)}`:`${V.default.green(Y3)} ${J}`}
96
+ ${V.default.cyan(r1)}
97
+ `}}}).prompt()},AJ=($)=>{let q=(J,X)=>{let Z=J.label??String(J.value);switch(X){case"selected":return`${V.default.dim(Z)}`;case"active":return`${V.default.green(Y3)} ${Z} ${J.hint?V.default.dim(`(${J.hint})`):""}`;case"cancelled":return`${V.default.strikethrough(V.default.dim(Z))}`;default:return`${V.default.dim(G3)} ${V.default.dim(Z)}`}};return new X3({options:$.options,initialValue:$.initialValue,render(){let J=`${V.default.gray(w)}
98
+ ${U3(this.state)} ${$.message}
99
+ `;switch(this.state){case"submit":return`${J}${V.default.gray(w)} ${q(this.options[this.cursor],"selected")}`;case"cancel":return`${J}${V.default.gray(w)} ${q(this.options[this.cursor],"cancelled")}
100
+ ${V.default.gray(w)}`;default:return`${J}${V.default.cyan(w)} ${CB({cursor:this.cursor,options:this.options,maxItems:$.maxItems,style:(X,Z)=>q(X,Z?"active":"inactive")}).join(`
101
+ ${V.default.cyan(w)} `)}
102
+ ${V.default.cyan(r1)}
103
+ `}}}).prompt()};var EJ=($="",q="")=>{let J=`
104
104
  ${$}
105
105
  `.split(`
106
- `),X=J3(q).length,Z=Math.max(J.reduce((Q,Y)=>{let G=J3(Y);return G.length>Q?G.length:Q},0),X)+2,H=J.map((Q)=>`${W.default.gray(w)} ${W.default.dim(Q)}${" ".repeat(Z-J3(Q).length)}${W.default.gray(w)}`).join(`
107
- `);process.stdout.write(`${W.default.gray(w)}
108
- ${W.default.green(H3)} ${W.default.reset(q)} ${W.default.gray(FJ.repeat(Math.max(Z-X-1,1))+RB)}
106
+ `),X=Q3(q).length,Z=Math.max(J.reduce((Q,Y)=>{let G=Q3(Y);return G.length>Q?G.length:Q},0),X)+2,H=J.map((Q)=>`${V.default.gray(w)} ${V.default.dim(Q)}${" ".repeat(Z-Q3(Q).length)}${V.default.gray(w)}`).join(`
107
+ `);process.stdout.write(`${V.default.gray(w)}
108
+ ${V.default.green(K3)} ${V.default.reset(q)} ${V.default.gray(jJ.repeat(Math.max(Z-X-1,1))+xB)}
109
109
  ${H}
110
- ${W.default.gray(TB+FJ.repeat(Z+2)+PB)}
111
- `)},o1=($="")=>{process.stdout.write(`${W.default.gray(t1)} ${W.default.red($)}
110
+ ${V.default.gray(jB+jJ.repeat(Z+2)+MB)}
111
+ `)},s1=($="")=>{process.stdout.write(`${V.default.gray(r1)} ${V.default.red($)}
112
112
 
113
- `)},AJ=($="")=>{process.stdout.write(`${W.default.gray(_B)} ${$}
114
- `)},EJ=($="")=>{process.stdout.write(`${W.default.gray(w)}
115
- ${W.default.gray(t1)} ${$}
113
+ `)},yJ=($="")=>{process.stdout.write(`${V.default.gray(FB)} ${$}
114
+ `)},OJ=($="")=>{process.stdout.write(`${V.default.gray(w)}
115
+ ${V.default.gray(r1)} ${$}
116
116
 
117
- `)};var MM=`${W.default.gray(w)} `;var yJ=({indicator:$="dots"}={})=>{let q=X3?["◒","◐","◓","◑"]:["•","o","O","0"],J=X3?80:120,X=process.env.CI==="true",Z,H,Q=!1,Y="",G,K=performance.now(),U=(j)=>{let I=j>1?"Something went wrong":"Canceled";Q&&v(I,j)},B=()=>U(2),z=()=>U(1),L=()=>{process.on("uncaughtExceptionMonitor",B),process.on("unhandledRejection",B),process.on("SIGINT",z),process.on("SIGTERM",z),process.on("exit",U)},_=()=>{process.removeListener("uncaughtExceptionMonitor",B),process.removeListener("unhandledRejection",B),process.removeListener("SIGINT",z),process.removeListener("SIGTERM",z),process.removeListener("exit",U)},P=()=>{if(G===void 0)return;X&&process.stdout.write(`
118
- `);let j=G.split(`
119
- `);process.stdout.write(u$.cursor.move(-999,j.length-1)),process.stdout.write(u$.erase.down(j.length))},M=(j)=>j.replace(/\.+$/,""),F=(j)=>{let I=(performance.now()-j)/1000,N=Math.floor(I/60),c=Math.floor(I%60);return N>0?`[${N}m ${c}s]`:`[${c}s]`},O=(j="")=>{Q=!0,Z=kJ(),Y=M(j),K=performance.now(),process.stdout.write(`${W.default.gray(w)}
120
- `);let I=0,N=0;L(),H=setInterval(()=>{if(X&&Y===G)return;P(),G=Y;let c=W.default.magenta(q[I]);if(X)process.stdout.write(`${c} ${Y}...`);else if($==="timer")process.stdout.write(`${c} ${Y} ${F(K)}`);else{let z1=".".repeat(Math.floor(N)).slice(0,3);process.stdout.write(`${c} ${Y}${z1}`)}I=I+1<q.length?I+1:0,N=N<q.length?N+0.125:0},J)},v=(j="",I=0)=>{Q=!1,clearInterval(H),P();let N=I===0?W.default.green(H3):I===1?W.default.red(jJ):W.default.red(xJ);Y=M(j??Y),$==="timer"?process.stdout.write(`${N} ${Y} ${F(K)}
117
+ `)};var yM=`${V.default.gray(w)} `;var NJ=({indicator:$="dots"}={})=>{let q=H3?["◒","◐","◓","◑"]:["•","o","O","0"],J=H3?80:120,X=process.env.CI==="true",Z,H,Q=!1,Y="",G,K=performance.now(),U=(x)=>{let I=x>1?"Something went wrong":"Canceled";Q&&v(I,x)},B=()=>U(2),z=()=>U(1),W=()=>{process.on("uncaughtExceptionMonitor",B),process.on("unhandledRejection",B),process.on("SIGINT",z),process.on("SIGTERM",z),process.on("exit",U)},_=()=>{process.removeListener("uncaughtExceptionMonitor",B),process.removeListener("unhandledRejection",B),process.removeListener("SIGINT",z),process.removeListener("SIGTERM",z),process.removeListener("exit",U)},T=()=>{if(G===void 0)return;X&&process.stdout.write(`
118
+ `);let x=G.split(`
119
+ `);process.stdout.write(i$.cursor.move(-999,x.length-1)),process.stdout.write(i$.erase.down(x.length))},M=(x)=>x.replace(/\.+$/,""),F=(x)=>{let I=(performance.now()-x)/1000,N=Math.floor(I/60),c=Math.floor(I%60);return N>0?`[${N}m ${c}s]`:`[${c}s]`},O=(x="")=>{Q=!0,Z=xJ(),Y=M(x),K=performance.now(),process.stdout.write(`${V.default.gray(w)}
120
+ `);let I=0,N=0;W(),H=setInterval(()=>{if(X&&Y===G)return;T(),G=Y;let c=V.default.magenta(q[I]);if(X)process.stdout.write(`${c} ${Y}...`);else if($==="timer")process.stdout.write(`${c} ${Y} ${F(K)}`);else{let L1=".".repeat(Math.floor(N)).slice(0,3);process.stdout.write(`${c} ${Y}${L1}`)}I=I+1<q.length?I+1:0,N=N<q.length?N+0.125:0},J)},v=(x="",I=0)=>{Q=!1,clearInterval(H),T();let N=I===0?V.default.green(K3):I===1?V.default.red(MJ):V.default.red(CJ);Y=M(x??Y),$==="timer"?process.stdout.write(`${N} ${Y} ${F(K)}
121
121
  `):process.stdout.write(`${N} ${Y}
122
- `),_(),Z()};return{start:O,stop:v,message:(j="")=>{Y=M(j??Y)}}};var OJ=o(y1(),1);async function g($,q=!0){let J=await CJ({message:$,initialValue:q});if(a1(J))o1("Operation cancelled"),process.exit(0);return J}async function NJ($,q,J){let X=await MJ({message:$,placeholder:q,initialValue:J});if(a1(X))o1("Operation cancelled"),process.exit(0);return X}async function W0($,q){let J=q.map((Z)=>({value:Z.value,label:Z.label,...Z.hint&&{hint:Z.hint}})),X=await wJ({message:$,options:J});if(a1(X))o1("Operation cancelled"),process.exit(0);return X}async function DJ(){return W0("Select target chip",O3.map(($)=>({value:$.id,label:$.name,hint:$.description+($.stable?"":" (preview)")})))}async function vJ(){return W0("Select language",[{value:"c",label:"C",hint:"Standard C project"},{value:"cpp",label:"C++",hint:'C++ with extern "C" linkage'}])}async function B1($){if($.length===0)o1("No devices found"),process.exit(1);return W0("Select device",$.map((q)=>({value:q.port,label:q.port,hint:jB(q)})))}function jB($){let q=[];if($.espChip)q.push($.espChip);else if($.chip)q.push($.chip);else if($.manufacturer)q.push($.manufacturer);if($.connectionType==="native-usb")q.push("USB");else if($.connectionType==="uart-bridge")q.push("UART");return q.join(" · ")}function Z1($,q){return $.find((J)=>J.port===q)}function p$($){if($.connectionType==="uart-bridge"&&$.espChip?.includes("S3"))return{ok:!1,warning:`Port ${$.port} is a UART bridge. ESP32-S3 flashing works better with native USB port.`};return{ok:!0}}function fJ($){return{ok:!0}}async function xB($){let q=D3.map((X)=>({value:String(X.value),label:X.label,hint:X.hint+(X.value===$?" (current)":"")})),J=await W0("Select flash baud rate",q);return parseInt(J,10)}async function MB($){let q=v3.map((X)=>({value:String(X.value),label:X.label,hint:X.hint+(X.value===$?" (current)":"")})),J=await W0("Select monitor baud rate",q);return parseInt(J,10)}async function l$($,q){if(await g(`Use ${$} baud rate ${q}?`,!0))return q;return $==="flash"?xB(q):MB(q)}function d$(){return yJ()}function i$($){AJ(OJ.default.inverse(` ${$} `))}function _0($){EJ($)}function n$($){o1($)}function a$($,q){IJ($,q)}var O1=o(y1(),1);function CB($){console.log(O1.default.blue("ℹ"),$)}function wB($){console.log(O1.default.green("✔"),$)}function IB($){console.log(O1.default.yellow("⚠"),$)}function AB($){console.log(O1.default.red("✖"),$)}function EB($){console.log(O1.default.cyan("→"),$)}function yB($){console.log(O1.default.dim($))}function OB($){process.stdout.write($)}function NB(){console.log()}var V={info:CB,success:wB,warn:IB,error:AB,step:EB,dim:yB,output:OB,newline:NB};async function hJ($){i$("ESP-IDF Installation");let q=await tq();if(q.installed){if(V.info(`ESP-IDF already installed at ${q.path}`),q.version)V.info(`Version: ${q.version}`);if(!await g("Reinstall ESP-IDF?",!1)){_0("Installation skipped");return}}let J=$.path||j0,X=$.target||"all",Z=f$();if(!$.yes){if(a$(`Install path: ${J}
122
+ `),_(),Z()};return{start:O,stop:v,message:(x="")=>{Y=M(x??Y)}}};var DJ=n(F1(),1);async function g($,q=!0){let J=await IJ({message:$,initialValue:q});if(o1(J))s1("Operation cancelled"),process.exit(0);return J}async function vJ($,q,J){let X=await wJ({message:$,placeholder:q,initialValue:J});if(o1(X))s1("Operation cancelled"),process.exit(0);return X}async function R0($,q){let J=q.map((Z)=>({value:Z.value,label:Z.label,...Z.hint&&{hint:Z.hint}})),X=await AJ({message:$,options:J});if(o1(X))s1("Operation cancelled"),process.exit(0);return X}async function fJ(){return R0("Select target chip",f3.map(($)=>({value:$.id,label:$.name,hint:$.description+($.stable?"":" (preview)")})))}async function hJ(){return R0("Select language",[{value:"c",label:"C",hint:"Standard C project"},{value:"cpp",label:"C++",hint:'C++ with extern "C" linkage'}])}async function B1($){if($.length===0)s1("No devices found"),process.exit(1);return R0("Select device",$.map((q)=>({value:q.port,label:q.port,hint:IB(q)})))}function IB($){let q=[];if($.espChip)q.push($.espChip);else if($.chip)q.push($.chip);else if($.manufacturer)q.push($.manufacturer);if($.connectionType==="native-usb")q.push("USB");else if($.connectionType==="uart-bridge")q.push("UART");return q.join(" · ")}function Z1($,q){return $.find((J)=>J.port===q)}function n$($){if($.connectionType==="uart-bridge"&&$.espChip?.includes("S3"))return{ok:!1,warning:`Port ${$.port} is a UART bridge. ESP32-S3 flashing works better with native USB port.`};return{ok:!0}}function SJ($){return{ok:!0}}async function AB($){let q=S3.map((X)=>({value:String(X.value),label:X.label,hint:X.hint+(X.value===$?" (current)":"")})),J=await R0("Select flash baud rate",q);return parseInt(J,10)}async function EB($){let q=b3.map((X)=>({value:String(X.value),label:X.label,hint:X.hint+(X.value===$?" (current)":"")})),J=await R0("Select monitor baud rate",q);return parseInt(J,10)}async function a$($,q){if(await g(`Use ${$} baud rate ${q}?`,!0))return q;return $==="flash"?AB(q):EB(q)}function t$(){return NJ()}function o$($){yJ(DJ.default.inverse(` ${$} `))}function P0($){OJ($)}function r$($){s1($)}function s$($,q){EJ($,q)}var N1=n(F1(),1);function yB($){console.log(N1.default.blue("ℹ"),$)}function OB($){console.log(N1.default.green("✔"),$)}function NB($){console.log(N1.default.yellow("⚠"),$)}function DB($){console.log(N1.default.red("✖"),$)}function vB($){console.log(N1.default.cyan("→"),$)}function fB($){console.log(N1.default.dim($))}function hB($){process.stdout.write($)}function SB(){console.log()}var L={info:yB,success:OB,warn:NB,error:DB,step:vB,dim:fB,output:hB,newline:SB};async function bJ($){o$("ESP-IDF Installation");let q=await eq();if(q.installed){if(L.info(`ESP-IDF already installed at ${q.path}`),q.version)L.info(`Version: ${q.version}`);if(!await g("Reinstall ESP-IDF?",!1)){P0("Installation skipped");return}}let J=$.path||C0,X=$.target||"all",Z=b$();if(!$.yes){if(s$(`Install path: ${J}
123
123
  Target: ${X}
124
124
  Shell: ${Z.type}
125
- Config: ${Z.configPath}`,"Installation Plan"),!await g("Proceed with installation?")){n$("Installation cancelled");return}}let H=x(),Q=d$();R.subscribe(H,(G)=>{if(G.data.type==="progress")Q.message(G.data.message);else if(G.data.type==="stdout"||G.data.type==="stderr")Q.stop(),V.output(G.data.text),Q.start()}),Q.start("Installing ESP-IDF...");let Y=await $J({path:J,target:X,addToShell:!0},H);if(Q.stop(),!Y.ok)V.error(Y.error),process.exit(1);if(V.success(`ESP-IDF installed at ${Y.data.idfPath}`),Y.data.addedToShell)V.info(`Added to ${Z.configPath}`),V.dim("Restart your shell or run: source "+Z.configPath);_0("Installation complete")}import{readFile as DB,writeFile as vB,access as fB}from"fs/promises";import{join as SJ}from"path";var t$="espcli.json";async function N1($){let q=SJ($,t$);try{await fB(q);let J=await DB(q,"utf-8");return JSON.parse(J)}catch{return{}}}async function hB($,q){let J=SJ($,t$);try{let X=JSON.stringify(q,null,2)+`
126
- `;return await vB(J,X,"utf-8"),{ok:!0,data:void 0}}catch(X){return{ok:!1,error:`Failed to save config: ${X}`}}}async function r1($,q){let X={...await N1($),...q},Z=await hB($,X);if(!Z.ok)return Z;return{ok:!0,data:X}}import{mkdir as dJ,writeFile as SB}from"fs/promises";import{join as o$}from"path";function bJ($){return`cmake_minimum_required(VERSION 3.16)
125
+ Config: ${Z.configPath}`,"Installation Plan"),!await g("Proceed with installation?")){r$("Installation cancelled");return}}let H=j(),Q=t$();R.subscribe(H,(G)=>{if(G.data.type==="progress")Q.message(G.data.message);else if(G.data.type==="stdout"||G.data.type==="stderr")Q.stop(),L.output(G.data.text),Q.start()}),Q.start("Installing ESP-IDF...");let Y=await JJ({path:J,target:X,addToShell:!0},H);if(Q.stop(),!Y.ok)L.error(Y.error),process.exit(1);if(L.success(`ESP-IDF installed at ${Y.data.idfPath}`),Y.data.addedToShell)L.info(`Added to ${Z.configPath}`),L.dim("Restart your shell or run: source "+Z.configPath);P0("Installation complete")}import{readFile as bB,writeFile as gB,access as gJ}from"fs/promises";import{join as B3}from"path";var k0=".espcli";function cB($){let q={};for(let J of $.split(`
126
+ `)){let X=J.trim();if(!X||X.startsWith("#"))continue;let Z=X.indexOf("=");if(Z===-1)continue;let H=X.slice(0,Z).trim(),Q=X.slice(Z+1).trim();switch(H){case"target":q.target=Q;break;case"port":q.port=Q;break;case"flash_baud":q.flashBaud=parseInt(Q,10)||void 0;break;case"monitor_baud":q.monitorBaud=parseInt(Q,10)||void 0;break}}return q}function mB($){let q=[];if($.target)q.push(`target=${$.target}`);if($.port)q.push(`port=${$.port}`);if($.flashBaud)q.push(`flash_baud=${$.flashBaud}`);if($.monitorBaud)q.push(`monitor_baud=${$.monitorBaud}`);return q.join(`
127
+ `)+`
128
+ `}async function e1($){let q=B3($,k0);try{return await gJ(q),!0}catch{return!1}}async function D1($){let q=B3($,k0);try{await gJ(q);let J=await bB(q,"utf-8");return cB(J)}catch{return{}}}async function uB($,q){let J=B3($,k0);try{let X=mB(q);return await gB(J,X,"utf-8"),{ok:!0,data:void 0}}catch(X){return{ok:!1,error:`Failed to save config: ${X}`}}}async function z1($,q){let X={...await D1($),...q},Z=await uB($,X);if(!Z.ok)return Z;return{ok:!0,data:X}}import{mkdir as nJ,writeFile as pB}from"fs/promises";import{join as e$}from"path";function cJ($){return`cmake_minimum_required(VERSION 3.16)
127
129
  include($ENV{IDF_PATH}/tools/cmake/project.cmake)
128
130
  project(${$})
129
- `}function gJ($){return`idf_component_register(SRCS "${$}"
131
+ `}function mJ($){return`idf_component_register(SRCS "${$}"
130
132
  INCLUDE_DIRS ".")
131
- `}function cJ($){return`#include <stdio.h>
133
+ `}function uJ($){return`#include <stdio.h>
132
134
  #include "freertos/FreeRTOS.h"
133
135
  #include "freertos/task.h"
134
136
 
@@ -139,7 +141,7 @@ void app_main(void)
139
141
  vTaskDelay(pdMS_TO_TICKS(1000));
140
142
  }
141
143
  }
142
- `}function mJ($){return`#include <cstdio>
144
+ `}function pJ($){return`#include <cstdio>
143
145
  #include "freertos/FreeRTOS.h"
144
146
  #include "freertos/task.h"
145
147
 
@@ -150,13 +152,13 @@ extern "C" void app_main(void)
150
152
  vTaskDelay(pdMS_TO_TICKS(1000));
151
153
  }
152
154
  }
153
- `}function uJ(){return`build/
155
+ `}function lJ(){return`build/
154
156
  sdkconfig
155
157
  sdkconfig.old
156
158
  *.pyc
157
159
  __pycache__/
158
160
  .DS_Store
159
- `}function pJ($,q){return`# ${$}
161
+ `}function dJ($,q){return`# ${$}
160
162
 
161
163
  ESP-IDF project targeting ${q}.
162
164
 
@@ -177,7 +179,7 @@ idf.py -p PORT flash
177
179
  \`\`\`bash
178
180
  idf.py -p PORT monitor
179
181
  \`\`\`
180
- `}function lJ(){return`{
182
+ `}function iJ(){return`{
181
183
  "version": 4,
182
184
  "configurations": [
183
185
  {
@@ -203,9 +205,9 @@ idf.py -p PORT monitor
203
205
  }
204
206
  ]
205
207
  }
206
- `}function bB($){return JSON.stringify({target:$,flashBaud:V1,monitorBaud:W1},null,2)+`
207
- `}function gB($){let{name:q,language:J,target:X}=$,Z=J==="cpp"?"main.cpp":"main.c",H=J==="cpp"?mJ(q):cJ(q);return[{path:"CMakeLists.txt",content:bJ(q)},{path:"main/CMakeLists.txt",content:gJ(Z)},{path:`main/${Z}`,content:H},{path:".gitignore",content:uJ()},{path:"README.md",content:pJ(q,X)},{path:".vscode/c_cpp_properties.json",content:lJ()},{path:t$,content:bB(X)}]}async function iJ($){let q=o$($.directory,$.name),J=gB($);try{await dJ(o$(q,"main"),{recursive:!0}),await dJ(o$(q,".vscode"),{recursive:!0});let X=[];for(let Z of J){let H=o$(q,Z.path);await SB(H,Z.content),X.push(Z.path)}return{ok:!0,data:{projectPath:q,files:X}}}catch(X){return{ok:!1,error:`Failed to create project: ${X}`}}}async function nJ($,q){let J=q||x();R.emit(J,{type:"progress",message:`Creating project ${$.name}...`});let X=await iJ($);if(!X.ok)return R.emit(J,{type:"error",message:X.error}),X;R.emit(J,{type:"progress",message:"Setting target...",percent:80});let Z=await X1("idf.py",["set-target",$.target],{cwd:X.data.projectPath,operationId:J});if(!Z.ok||Z.data.exitCode!==0)R.emit(J,{type:"log",level:"warn",message:"Failed to set target. You may need to run: idf.py set-target "+$.target});return R.emit(J,{type:"complete",result:X.data}),X}import{resolve as cB}from"path";async function aJ($,q){i$("Create ESP-IDF Project");let J=$||await NJ("Project name","my-esp-project"),X=q.lang||await vJ(),Z=q.target||await DJ(),H={name:J,directory:cB(process.cwd()),language:X,target:Z};if(a$(`Name: ${H.name}
208
+ `}function lB($){return JSON.stringify({target:$,flashBaud:V1,monitorBaud:_1},null,2)+`
209
+ `}function dB($){let{name:q,language:J,target:X}=$,Z=J==="cpp"?"main.cpp":"main.c",H=J==="cpp"?pJ(q):uJ(q);return[{path:"CMakeLists.txt",content:cJ(q)},{path:"main/CMakeLists.txt",content:mJ(Z)},{path:`main/${Z}`,content:H},{path:".gitignore",content:lJ()},{path:"README.md",content:dJ(q,X)},{path:".vscode/c_cpp_properties.json",content:iJ()},{path:k0,content:lB(X)}]}async function aJ($){let q=e$($.directory,$.name),J=dB($);try{await nJ(e$(q,"main"),{recursive:!0}),await nJ(e$(q,".vscode"),{recursive:!0});let X=[];for(let Z of J){let H=e$(q,Z.path);await pB(H,Z.content),X.push(Z.path)}return{ok:!0,data:{projectPath:q,files:X}}}catch(X){return{ok:!1,error:`Failed to create project: ${X}`}}}async function tJ($,q){let J=q||j();R.emit(J,{type:"progress",message:`Creating project ${$.name}...`});let X=await aJ($);if(!X.ok)return R.emit(J,{type:"error",message:X.error}),X;R.emit(J,{type:"progress",message:"Setting target...",percent:80});let Z=await X1("idf.py",["set-target",$.target],{cwd:X.data.projectPath,operationId:J});if(!Z.ok||Z.data.exitCode!==0)R.emit(J,{type:"log",level:"warn",message:"Failed to set target. You may need to run: idf.py set-target "+$.target});return R.emit(J,{type:"complete",result:X.data}),X}import{resolve as iB}from"path";async function oJ($,q){o$("Create ESP-IDF Project");let J=$||await vJ("Project name","my-esp-project"),X=q.lang||await hJ(),Z=q.target||await fJ(),H={name:J,directory:iB(process.cwd()),language:X,target:Z};if(s$(`Name: ${H.name}
208
210
  Language: ${X.toUpperCase()}
209
211
  Target: ${Z}
210
- Path: ${H.directory}/${H.name}`,"Project Configuration"),!await g("Create project?")){n$("Cancelled");return}let Y=d$();Y.start("Creating project...");let G=x(),K=await nJ(H,G);if(Y.stop(),!K.ok)V.error(K.error),process.exit(1);V.success(`Created project at ${K.data.projectPath}`),V.newline(),V.dim("Files created:"),K.data.files.forEach((U)=>V.dim(` ${U}`)),V.newline(),V.info(`cd ${J} && espcli build`),_0("Project ready")}import{readdir as mB,access as uB,readFile as pB}from"fs/promises";import{join as T0}from"path";var r$=null;async function G3(){if(r$)return r$;return r$=await lB(),r$}async function lB(){let[$,q]=await Promise.all([dB(),iB()]),J=await nB(),X=J.ok?await aB():void 0,[Z,H]=X?await Promise.all([tB(X),oB(X)]):[{ok:!1,name:"pyserial",error:"ESP-IDF not installed",hint:"Run: espcli install"},{ok:!1,name:"esptool",error:"ESP-IDF not installed",hint:"Run: espcli install"}];return{python:$,idf:J,pyserial:Z,esptool:H,git:q,idfPython:X}}async function dB(){try{let{stdout:$}=await h("python3",["--version"],{timeout:3000});return{ok:!0,name:"Python",version:$.replace("Python ","").trim()}}catch{return{ok:!1,name:"Python",error:"Python 3 not found",hint:"Install Python 3: https://www.python.org/downloads/"}}}async function iB(){try{let{stdout:$}=await h("git",["--version"],{timeout:3000});return{ok:!0,name:"Git",version:$.replace("git version ","").trim()}}catch{return{ok:!1,name:"Git",error:"Git not found",hint:"Install Git: https://git-scm.com/downloads"}}}async function nB(){let $=process.env.HOME||"",q=[process.env.IDF_PATH,T0($,"esp","esp-idf"),T0($,"esp-idf")].filter(Boolean);for(let J of q)try{await uB(J);let X;try{let Z=T0(J,"version.txt");X=(await pB(Z,"utf-8")).trim()}catch{try{let{stdout:Z}=await h("git",["describe","--tags"],{cwd:J,timeout:3000});X=Z.trim()}catch{X="unknown"}}return{ok:!0,name:"ESP-IDF",version:X,path:J}}catch{continue}return{ok:!1,name:"ESP-IDF",error:"ESP-IDF not found",hint:"Run: espcli install"}}async function aB(){let $=process.env.HOME||"",q=T0($,".espressif","python_env");try{let J=await mB(q);for(let X of J)if(X.startsWith("idf")){let Z=T0(q,X,"bin","python");try{return await h(Z,["--version"],{timeout:2000}),Z}catch{continue}}}catch{}return}async function tB($){try{let{stdout:q}=await h($,["-c","import serial; print(serial.__version__)"],{timeout:3000});return{ok:!0,name:"pyserial",version:q.trim()}}catch{return{ok:!1,name:"pyserial",error:"pyserial not installed in IDF environment",hint:"Reinstall ESP-IDF: espcli install"}}}async function oB($){try{let{stdout:q}=await h($,["-m","esptool","version"],{timeout:3000});return{ok:!0,name:"esptool",version:q.match(/v?([\d.]+)/)?.[1]||"unknown"}}catch{return{ok:!1,name:"esptool",error:"esptool not installed in IDF environment",hint:"Reinstall ESP-IDF: espcli install"}}}async function tJ(){let $=await G3();if(!$.idf.ok)return{ok:!1,error:`${$.idf.error}. ${$.idf.hint}`};if(!$.idfPython)return{ok:!1,error:"ESP-IDF Python environment not found. Run: espcli install"};return{ok:!0,python:$.idfPython}}var rB="303A";async function s$(){let $=await tJ();if(!$.ok)return[];let q=$.python;try{let{stdout:J}=await h(q,["-m","serial.tools.list_ports","-v"],{timeout:5000}),X=[],Z=J.split(`
211
- `),H=null,Q="",Y="";for(let G of Z)if(G.startsWith("/dev/")){if(H){let K=oJ(H,Q,Y);if(K)X.push(K)}H=G.trim(),Q="",Y=""}else if(G.includes("desc:"))Q=G.split("desc:")[1]?.trim()||"";else if(G.includes("hwid:"))Y=G.split("hwid:")[1]?.trim()||"";if(H){let G=oJ(H,Q,Y);if(G)X.push(G)}return await $z(q,X)}catch{return[]}}function oJ($,q,J){if(J==="n/a"||!J.includes("VID:PID="))return null;let X=J.match(/VID:PID=([0-9A-Fa-f]+):([0-9A-Fa-f]+)/),Z=X?.[1]?.toUpperCase(),H=X?.[2]?.toUpperCase(),Q=sB(Z),Y=eB(Z,H);return{port:$,connectionType:Q,vendorId:Z,productId:H,manufacturer:z2[Z||""]?.name,chip:Y,description:q!=="n/a"?q:void 0}}function sB($){if(!$)return"unknown";return $.toUpperCase()===rB?"native-usb":"uart-bridge"}function eB($,q){if(!$)return;let J=z2[$.toUpperCase()];if(!J)return;if(q){let X=J.chips[q.toUpperCase()];if(X)return X}return J.name}async function $z($,q){return await Promise.all(q.map(async(X)=>{if(X.connectionType==="native-usb"||X.chip?.includes("CH34")||X.chip?.includes("CP210")||X.chip?.includes("FT232")||X.chip?.includes("CH9")){let H=await qz($,X.port);return{...X,espChip:H}}return X}))}async function qz($,q){try{let{stdout:J,stderr:X}=await h($,["-m","esptool","--port",q,"chip_id"],{timeout:1e4,reject:!1}),Z=J+X,H=[/Chip is (ESP32[A-Za-z0-9-]*)/i,/Detecting chip type[.\s]*(ESP32[A-Za-z0-9-]*)/i,/Chip type:\s*(ESP32[A-Za-z0-9-]*)/i];for(let Q of H){let Y=Z.match(Q);if(Y)return Y[1].toUpperCase()}}catch{}return}async function F1(){try{return{ok:!0,data:await s$()}}catch($){return{ok:!1,error:`Failed to list devices: ${$}`}}}var b=o(y1(),1);function Jz($){return $.replace(/\x1b\[[0-9;]*m/g,"")}function rJ($){return Jz($).length}function Xz($,q){let J=$.map((K,U)=>{let B=Math.max(...q.map((z)=>rJ(z[U]||"")));return Math.max(K.length,B)}),X="─",Z="┌"+J.map((K)=>"─".repeat(K+2)).join("┬")+"┐",H="├"+J.map((K)=>"─".repeat(K+2)).join("┼")+"┤",Q="└"+J.map((K)=>"─".repeat(K+2)).join("┴")+"┘",Y=(K,U)=>{let B=rJ(K),z=U-B;return K+" ".repeat(Math.max(0,z))},G=(K)=>"│"+K.map((U,B)=>` ${Y(U||"",J[B])} `).join("│")+"│";console.log(b.default.dim(Z)),console.log(b.default.bold(G($))),console.log(b.default.dim(H)),q.forEach((K)=>console.log(G(K))),console.log(b.default.dim(Q))}function sJ($){if($.length===0){console.log(b.default.dim("No devices found"));return}let q=["Port","Type","Chip","ESP"],J=$.map((H)=>{let Q=Zz(H.connectionType),Y=H.espChip||(H.connectionType==="native-usb"?"?":"-");return[H.port,Q,H.chip||"-",Y]});Xz(q,J);let X=$.some((H)=>H.connectionType==="native-usb"),Z=$.some((H)=>H.connectionType==="uart-bridge");if(X&&Z)console.log(""),console.log(b.default.dim(" Hint: Multiple ports from same board")),console.log(b.default.dim(" • ")+b.default.cyan("UART")+b.default.dim(" - Reliable flashing & monitoring")),console.log(b.default.dim(" • ")+b.default.magenta("USB")+b.default.dim(" - JTAG debugging"))}function Zz($){switch($){case"native-usb":return b.default.magenta("USB");case"uart-bridge":return b.default.cyan("UART");default:return b.default.dim("?")}}async function eJ(){V.info("Scanning for devices...");let $=await F1();if(!$.ok)V.error($.error),process.exit(1);V.newline(),sJ($.data),V.newline()}async function e$($,q){let J=q||x(),{projectDir:X,target:Z,clean:H}=$;if(!await E1(X))return R.emit(J,{type:"error",message:"Not an ESP-IDF project directory"}),{ok:!1,error:"Not an ESP-IDF project directory"};if(Z){R.emit(J,{type:"progress",message:`Setting target to ${Z}...`});let G=await X1("idf.py",["set-target",Z],{cwd:X,operationId:J});if(!G.ok||G.data.exitCode!==0)return R.emit(J,{type:"error",message:"Failed to set target"}),{ok:!1,error:"Failed to set target"}}if(H)R.emit(J,{type:"progress",message:"Cleaning..."}),await X1("idf.py",["clean"],{cwd:X,operationId:J});R.emit(J,{type:"progress",message:"Building project..."});let Y=await X1("idf.py",["build"],{cwd:X,operationId:J});if(!Y.ok)return R.emit(J,{type:"error",message:Y.error}),{ok:!1,error:Y.error};if(Y.data.exitCode!==0)return R.emit(J,{type:"error",message:"Build failed"}),{ok:!1,error:"Build failed"};return R.emit(J,{type:"complete",result:{success:!0,projectDir:X}}),{ok:!0,data:{success:!0,projectDir:X}}}async function $X($){let q=await J1(process.cwd());if(!q)V.error("Not in an ESP-IDF project directory"),process.exit(1);let J=x();R.subscribe(J,(Z)=>{if(Z.data.type==="stdout")V.output(Z.data.text);else if(Z.data.type==="stderr")V.output(Z.data.text)}),V.step("Building project...");let X=await e$({projectDir:q,target:$.target,clean:$.clean},J);if(!X.ok)V.newline(),V.error(X.error),process.exit(1);V.newline(),V.success("Build complete")}async function $2($,q){let J=q||x(),{projectDir:X,port:Z,baud:H=V1}=$;if(!await E1(X))return R.emit(J,{type:"error",message:"Not an ESP-IDF project directory"}),{ok:!1,error:"Not an ESP-IDF project directory"};R.emit(J,{type:"progress",message:`Flashing to ${Z}...`});let Y=["-p",Z,"-b",String(H),"flash"],G=await X1("idf.py",Y,{cwd:X,operationId:J});if(!G.ok)return R.emit(J,{type:"error",message:G.error}),{ok:!1,error:G.error};if(G.data.exitCode!==0)return R.emit(J,{type:"error",message:"Flash failed"}),{ok:!1,error:"Flash failed"};return R.emit(J,{type:"complete",result:{success:!0,port:Z}}),{ok:!0,data:{success:!0,port:Z}}}async function qX($){let q=await J1(process.cwd());if(!q)V.error("Not in an ESP-IDF project directory"),process.exit(1);let J=await N1(q),X=await F1();if(!X.ok)V.error(X.error),process.exit(1);let Z=$.port||J.port,H=Z?Z1(X.data,Z):void 0;if(!Z||!H)Z=await B1(X.data),H=Z1(X.data,Z);if(H){let K=p$(H);if(!K.ok&&K.warning){if(V.warn(K.warning),!await g("Continue with this port?",!1))Z=await B1(X.data),H=Z1(X.data,Z)}}let Q=$.baud||J.flashBaud||V1;if(!$.baud&&!J.flashBaud)Q=await l$("flash",Q);if(Z!==J.port||Q!==J.flashBaud){if(await g("Save port and baud rate to project config?",!0))await r1(q,{port:Z,flashBaud:Q}),V.dim("Settings saved to espcli.json")}let Y=x();R.subscribe(Y,(K)=>{if(K.data.type==="stdout"||K.data.type==="stderr")V.output(K.data.text)}),V.step(`Flashing to ${Z} at ${Q} baud...`);let G=await $2({projectDir:q,port:Z,baud:Q},Y);if(!G.ok)V.newline(),V.error(G.error),process.exit(1);V.newline(),V.success("Flash complete")}var K3=new Map;async function q2($,q){let J=q||x(),{port:X,baud:Z=W1,projectDir:H}=$,Q=["-p",X,"-b",String(Z),"monitor"],Y=await oq("idf.py",Q,{cwd:H||process.cwd(),operationId:J,interactive:!0});if(!Y)return R.emit(J,{type:"error",message:"ESP-IDF not found"}),{ok:!1,error:"ESP-IDF not found"};let{proc:G,promise:K}=Y;return K3.set(J,G),K.then(()=>{K3.delete(J),R.emit(J,{type:"complete",result:{stopped:!0}})}),{ok:!0,data:{operationId:J,stop:()=>{G.kill("SIGTERM"),K3.delete(J)},wait:()=>K}}}async function JX($){let q=await J1(process.cwd());if(!q)V.error("Not an ESP-IDF project directory"),V.dim('Run this command from within an ESP-IDF project, or use "espcli init" to create one'),process.exit(1);let J=await N1(q),X=await F1();if(!X.ok)V.error(X.error),process.exit(1);let Z=$.port||J.port,H=Z?Z1(X.data,Z):void 0;if(!Z||!H)Z=await B1(X.data),H=Z1(X.data,Z);if(H){let G=fJ(H);if(!G.ok&&G.warning){if(V.warn(G.warning),!await g("Continue with this port?",!1))Z=await B1(X.data)}}let Q=$.baud||J.monitorBaud||W1;if(!$.baud&&!J.monitorBaud)Q=await l$("monitor",Q);if(Z!==J.port||Q!==J.monitorBaud){if(await g("Save port and baud rate to project config?",!0))await r1(q,{port:Z,monitorBaud:Q}),V.dim("Settings saved to espcli.json")}V.step(`Connecting to ${Z} at ${Q} baud...`),V.dim("Press Ctrl+] to exit"),V.newline();let Y=await q2({port:Z,baud:Q,projectDir:q});if(!Y.ok)V.error(Y.error),process.exit(1);await Y.data.wait(),V.newline(),V.info("Monitor stopped"),process.exit(0)}async function XX($,q){let J=q||x(),{projectDir:X,full:Z}=$;if(!await E1(X))return R.emit(J,{type:"error",message:"Not an ESP-IDF project directory"}),{ok:!1,error:"Not an ESP-IDF project directory"};let Q=Z?"fullclean":"clean";R.emit(J,{type:"progress",message:`Running ${Q}...`});let Y=await X1("idf.py",[Q],{cwd:X,operationId:J});if(!Y.ok)return R.emit(J,{type:"error",message:Y.error}),{ok:!1,error:Y.error};if(Y.data.exitCode!==0){let G=`${Q} failed`;return R.emit(J,{type:"error",message:G}),{ok:!1,error:G}}return R.emit(J,{type:"complete",result:null}),{ok:!0,data:void 0}}async function ZX($){let q=await J1(process.cwd());if(!q)V.error("Not in an ESP-IDF project directory"),process.exit(1);let J=x();V.step($.full?"Running fullclean...":"Cleaning build...");let X=await XX({projectDir:q,full:$.full},J);if(!X.ok)V.error(X.error),process.exit(1);V.success("Clean complete")}async function QX($){let q=await J1(process.cwd());if(!q)V.error("Not in an ESP-IDF project directory"),process.exit(1);let J=await N1(q),X=await F1();if(!X.ok)V.error(X.error),process.exit(1);let Z=$.port||J.port,H=Z?Z1(X.data,Z):void 0;if(!Z||!H)Z=await B1(X.data),H=Z1(X.data,Z);if(H){let z=p$(H);if(!z.ok&&z.warning){if(V.warn(z.warning),!await g("Continue with this port?",!1))Z=await B1(X.data)}}let Q=$.baud||J.flashBaud||V1,Y=J.monitorBaud||W1;if(Z!==J.port||Q!==J.flashBaud){if(await g("Save port and baud rate to project config?",!0))await r1(q,{port:Z,flashBaud:Q,monitorBaud:Y}),V.dim("Settings saved to espcli.json")}let G=(z)=>{if(z.data.type==="stdout"||z.data.type==="stderr")V.output(z.data.text)};if(!$.skipBuild){let z=x();R.subscribe(z,G),V.step("Building...");let L=await e$({projectDir:q},z);if(!L.ok)V.newline(),V.error(L.error),process.exit(1);V.newline(),V.success("Build complete")}let K=x();R.subscribe(K,G),V.step(`Flashing to ${Z} at ${Q} baud...`);let U=await $2({projectDir:q,port:Z,baud:Q},K);if(!U.ok)V.newline(),V.error(U.error),process.exit(1);V.newline(),V.success("Flash complete"),V.step(`Starting monitor at ${Y} baud...`),V.dim("Press Ctrl+] to exit"),V.newline();let B=await q2({port:Z,baud:Y,projectDir:q});if(!B.ok)V.error(B.error),process.exit(1);await B.data.wait(),V.newline(),V.info("Monitor stopped")}var f=o(y1(),1);async function HX(){V.info("Checking system health..."),V.newline();let $=await G3();if(P0($.python),P0($.git),P0($.idf),P0($.pyserial),P0($.esptool),V.newline(),await Qz(),V.newline(),$.python.ok&&$.git.ok&&$.idf.ok&&$.pyserial.ok&&$.esptool.ok)console.log(f.default.green("✓ All checks passed! Ready for ESP32 development."));else console.log(f.default.yellow("⚠ Some checks failed. See hints above to fix issues."));V.newline()}function P0($){let q=$.ok?f.default.green("✓"):f.default.red("✗"),J=$.name.padEnd(10),X=$.version?f.default.dim(`v${$.version}`):"",Z=$.path?f.default.dim(` (${$.path})`):"";if($.ok)console.log(` ${q} ${f.default.bold(J)} ${X}${Z}`);else if(console.log(` ${q} ${f.default.bold(J)} ${f.default.red($.error||"Not found")}`),$.hint)console.log(` ${f.default.dim("→")} ${f.default.yellow($.hint)}`)}async function Qz(){console.log(f.default.bold(" Devices:"));try{let $=await s$();if($.length===0)console.log(` ${f.default.dim("No ESP devices connected")}`);else for(let q of $){let J=q.espChip||q.chip||"Unknown",X=q.connectionType==="native-usb"?"USB":"UART";console.log(` ${f.default.green("•")} ${q.port} ${f.default.dim(`(${J} via ${X})`)}`)}}catch{console.log(` ${f.default.dim("Could not check devices")}`)}}function YX(){let $=new A3;return $.name("espcli").description("CLI tool for ESP-IDF development").version(h3),$.command("install").description("Install ESP-IDF framework").option("-p, --path <path>","Installation path").option("-t, --target <target>","Target chip (default: all)").option("-y, --yes","Skip confirmation prompts").action(hJ),$.command("init [name]").description("Create a new ESP-IDF project").option("-l, --lang <lang>","Language: c or cpp").option("-t, --target <target>","Target chip").action(aJ),$.command("devices").alias("ports").description("List connected ESP devices").action(eJ),$.command("build").description("Build the current project").option("-t, --target <target>","Set target before build").option("-c, --clean","Clean before build").action($X),$.command("flash").description("Flash firmware to device").option("-p, --port <port>","Serial port").option("-b, --baud <baud>","Flash baud rate",parseInt).action(qX),$.command("monitor").description("Open serial monitor").option("-p, --port <port>","Serial port").option("-b, --baud <baud>","Monitor baud rate",parseInt).action(JX),$.command("run").description("Build, flash, and monitor").option("-p, --port <port>","Serial port").option("-b, --baud <baud>","Baud rate",parseInt).option("--skip-build","Skip build step").action(QX),$.command("clean").description("Clean build artifacts").option("-f, --full","Full clean (includes sdkconfig)").action(ZX),$.command("doctor").alias("check").description("Check system health and dependencies").action(HX),$}var Hz=YX();Hz.parse();
212
+ Path: ${H.directory}/${H.name}`,"Project Configuration"),!await g("Create project?")){r$("Cancelled");return}let Y=t$();Y.start("Creating project...");let G=j(),K=await tJ(H,G);if(Y.stop(),!K.ok)L.error(K.error),process.exit(1);L.success(`Created project at ${K.data.projectPath}`),L.newline(),L.dim("Files created:"),K.data.files.forEach((U)=>L.dim(` ${U}`)),L.newline(),L.info(`cd ${J} && espcli build`),P0("Project ready")}import{readdir as nB,access as aB,readFile as tB}from"fs/promises";import{join as F0}from"path";var $2=null;async function z3(){if($2)return $2;return $2=await oB(),$2}async function oB(){let[$,q]=await Promise.all([rB(),sB()]),J=await eB(),X=J.ok?await $z():void 0,[Z,H]=X?await Promise.all([qz(X),Jz(X)]):[{ok:!1,name:"pyserial",error:"ESP-IDF not installed",hint:"Run: espcli install"},{ok:!1,name:"esptool",error:"ESP-IDF not installed",hint:"Run: espcli install"}];return{python:$,idf:J,pyserial:Z,esptool:H,git:q,idfPython:X}}async function rB(){try{let{stdout:$}=await h("python3",["--version"],{timeout:3000});return{ok:!0,name:"Python",version:$.replace("Python ","").trim()}}catch{return{ok:!1,name:"Python",error:"Python 3 not found",hint:"Install Python 3: https://www.python.org/downloads/"}}}async function sB(){try{let{stdout:$}=await h("git",["--version"],{timeout:3000});return{ok:!0,name:"Git",version:$.replace("git version ","").trim()}}catch{return{ok:!1,name:"Git",error:"Git not found",hint:"Install Git: https://git-scm.com/downloads"}}}async function eB(){let $=process.env.HOME||"",q=[process.env.IDF_PATH,F0($,"esp","esp-idf"),F0($,"esp-idf")].filter(Boolean);for(let J of q)try{await aB(J);let X;try{let Z=F0(J,"version.txt");X=(await tB(Z,"utf-8")).trim()}catch{try{let{stdout:Z}=await h("git",["describe","--tags"],{cwd:J,timeout:3000});X=Z.trim()}catch{X="unknown"}}return{ok:!0,name:"ESP-IDF",version:X,path:J}}catch{continue}return{ok:!1,name:"ESP-IDF",error:"ESP-IDF not found",hint:"Run: espcli install"}}async function $z(){let $=process.env.HOME||"",q=F0($,".espressif","python_env");try{let J=await nB(q);for(let X of J)if(X.startsWith("idf")){let Z=F0(q,X,"bin","python");try{return await h(Z,["--version"],{timeout:2000}),Z}catch{continue}}}catch{}return}async function qz($){try{let{stdout:q}=await h($,["-c","import serial; print(serial.__version__)"],{timeout:3000});return{ok:!0,name:"pyserial",version:q.trim()}}catch{return{ok:!1,name:"pyserial",error:"pyserial not installed in IDF environment",hint:"Reinstall ESP-IDF: espcli install"}}}async function Jz($){try{let{stdout:q}=await h($,["-m","esptool","version"],{timeout:3000});return{ok:!0,name:"esptool",version:q.match(/v?([\d.]+)/)?.[1]||"unknown"}}catch{return{ok:!1,name:"esptool",error:"esptool not installed in IDF environment",hint:"Reinstall ESP-IDF: espcli install"}}}async function rJ(){let $=await z3();if(!$.idf.ok)return{ok:!1,error:`${$.idf.error}. ${$.idf.hint}`};if(!$.idfPython)return{ok:!1,error:"ESP-IDF Python environment not found. Run: espcli install"};return{ok:!0,python:$.idfPython}}var Xz="303A";async function q2(){let $=await rJ();if(!$.ok)return[];let q=$.python;try{let{stdout:J}=await h(q,["-m","serial.tools.list_ports","-v"],{timeout:5000}),X=[],Z=J.split(`
213
+ `),H=null,Q="",Y="";for(let G of Z)if(G.startsWith("/dev/")){if(H){let K=sJ(H,Q,Y);if(K)X.push(K)}H=G.trim(),Q="",Y=""}else if(G.includes("desc:"))Q=G.split("desc:")[1]?.trim()||"";else if(G.includes("hwid:"))Y=G.split("hwid:")[1]?.trim()||"";if(H){let G=sJ(H,Q,Y);if(G)X.push(G)}return await Hz(q,X)}catch{return[]}}function sJ($,q,J){if(J==="n/a"||!J.includes("VID:PID="))return null;let X=J.match(/VID:PID=([0-9A-Fa-f]+):([0-9A-Fa-f]+)/),Z=X?.[1]?.toUpperCase(),H=X?.[2]?.toUpperCase(),Q=Zz(Z),Y=Qz(Z,H);return{port:$,connectionType:Q,vendorId:Z,productId:H,manufacturer:V2[Z||""]?.name,chip:Y,description:q!=="n/a"?q:void 0}}function Zz($){if(!$)return"unknown";return $.toUpperCase()===Xz?"native-usb":"uart-bridge"}function Qz($,q){if(!$)return;let J=V2[$.toUpperCase()];if(!J)return;if(q){let X=J.chips[q.toUpperCase()];if(X)return X}return J.name}async function Hz($,q){return await Promise.all(q.map(async(X)=>{if(X.connectionType==="native-usb"||X.chip?.includes("CH34")||X.chip?.includes("CP210")||X.chip?.includes("FT232")||X.chip?.includes("CH9")){let H=await Yz($,X.port);return{...X,espChip:H}}return X}))}async function Yz($,q){try{let{stdout:J,stderr:X}=await h($,["-m","esptool","--port",q,"chip_id"],{timeout:1e4,reject:!1}),Z=J+X,H=[/Chip is (ESP32[A-Za-z0-9-]*)/i,/Detecting chip type[.\s]*(ESP32[A-Za-z0-9-]*)/i,/Chip type:\s*(ESP32[A-Za-z0-9-]*)/i];for(let Q of H){let Y=Z.match(Q);if(Y)return Y[1].toUpperCase()}}catch{}return}async function j1(){try{return{ok:!0,data:await q2()}}catch($){return{ok:!1,error:`Failed to list devices: ${$}`}}}var b=n(F1(),1);function Gz($){return $.replace(/\x1b\[[0-9;]*m/g,"")}function eJ($){return Gz($).length}function Kz($,q){let J=$.map((K,U)=>{let B=Math.max(...q.map((z)=>eJ(z[U]||"")));return Math.max(K.length,B)}),X="─",Z="┌"+J.map((K)=>"─".repeat(K+2)).join("┬")+"┐",H="├"+J.map((K)=>"─".repeat(K+2)).join("┼")+"┤",Q="└"+J.map((K)=>"─".repeat(K+2)).join("┴")+"┘",Y=(K,U)=>{let B=eJ(K),z=U-B;return K+" ".repeat(Math.max(0,z))},G=(K)=>"│"+K.map((U,B)=>` ${Y(U||"",J[B])} `).join("│")+"│";console.log(b.default.dim(Z)),console.log(b.default.bold(G($))),console.log(b.default.dim(H)),q.forEach((K)=>console.log(G(K))),console.log(b.default.dim(Q))}function $X($){if($.length===0){console.log(b.default.dim("No devices found"));return}let q=["Port","Type","Chip","ESP"],J=$.map((H)=>{let Q=Uz(H.connectionType),Y=H.espChip||(H.connectionType==="native-usb"?"?":"-");return[H.port,Q,H.chip||"-",Y]});Kz(q,J);let X=$.some((H)=>H.connectionType==="native-usb"),Z=$.some((H)=>H.connectionType==="uart-bridge");if(X&&Z)console.log(""),console.log(b.default.dim(" Hint: Multiple ports from same board")),console.log(b.default.dim(" • ")+b.default.cyan("UART")+b.default.dim(" - Reliable flashing & monitoring")),console.log(b.default.dim(" • ")+b.default.magenta("USB")+b.default.dim(" - JTAG debugging"))}function Uz($){switch($){case"native-usb":return b.default.magenta("USB");case"uart-bridge":return b.default.cyan("UART");default:return b.default.dim("?")}}async function qX(){L.info("Scanning for devices...");let $=await j1();if(!$.ok)L.error($.error),process.exit(1);L.newline(),$X($.data),L.newline()}async function J2($,q){let J=q||j(),{projectDir:X,target:Z,clean:H}=$;if(!await O1(X))return R.emit(J,{type:"error",message:"Not an ESP-IDF project directory"}),{ok:!1,error:"Not an ESP-IDF project directory"};if(Z){R.emit(J,{type:"progress",message:`Setting target to ${Z}...`});let G=await X1("idf.py",["set-target",Z],{cwd:X,operationId:J});if(!G.ok||G.data.exitCode!==0)return R.emit(J,{type:"error",message:"Failed to set target"}),{ok:!1,error:"Failed to set target"}}if(H)R.emit(J,{type:"progress",message:"Cleaning..."}),await X1("idf.py",["clean"],{cwd:X,operationId:J});R.emit(J,{type:"progress",message:"Building project..."});let Y=await X1("idf.py",["build"],{cwd:X,operationId:J});if(!Y.ok)return R.emit(J,{type:"error",message:Y.error}),{ok:!1,error:Y.error};if(Y.data.exitCode!==0)return R.emit(J,{type:"error",message:"Build failed"}),{ok:!1,error:"Build failed"};return R.emit(J,{type:"complete",result:{success:!0,projectDir:X}}),{ok:!0,data:{success:!0,projectDir:X}}}async function JX($){let q=await i(process.cwd());if(!q)L.error("Not in an ESP-IDF project directory"),process.exit(1);let J=j();R.subscribe(J,(Z)=>{if(Z.data.type==="stdout")L.output(Z.data.text);else if(Z.data.type==="stderr")L.output(Z.data.text)}),L.step("Building project...");let X=await J2({projectDir:q,target:$.target,clean:$.clean},J);if(!X.ok)L.newline(),L.error(X.error),process.exit(1);L.newline(),L.success("Build complete")}async function X2($,q){let J=q||j(),{projectDir:X,port:Z,baud:H=V1}=$;if(!await O1(X))return R.emit(J,{type:"error",message:"Not an ESP-IDF project directory"}),{ok:!1,error:"Not an ESP-IDF project directory"};R.emit(J,{type:"progress",message:`Flashing to ${Z}...`});let Y=["-p",Z,"-b",String(H),"flash"],G=await X1("idf.py",Y,{cwd:X,operationId:J});if(!G.ok)return R.emit(J,{type:"error",message:G.error}),{ok:!1,error:G.error};if(G.data.exitCode!==0)return R.emit(J,{type:"error",message:"Flash failed"}),{ok:!1,error:"Flash failed"};return R.emit(J,{type:"complete",result:{success:!0,port:Z}}),{ok:!0,data:{success:!0,port:Z}}}async function XX($){let q=await i(process.cwd());if(!q)L.error("Not in an ESP-IDF project directory"),process.exit(1);let J=await D1(q),X=await j1();if(!X.ok)L.error(X.error),process.exit(1);let Z=$.port||J.port,H=Z?Z1(X.data,Z):void 0;if(!Z||!H)Z=await B1(X.data),H=Z1(X.data,Z);if(H){let K=n$(H);if(!K.ok&&K.warning){if(L.warn(K.warning),!await g("Continue with this port?",!1))Z=await B1(X.data),H=Z1(X.data,Z)}}let Q=$.baud||J.flashBaud||V1;if(!$.baud&&!J.flashBaud)Q=await a$("flash",Q);if(Z!==J.port||Q!==J.flashBaud){if(await e1(q))await z1(q,{port:Z,flashBaud:Q});else if(await g("Save port and baud rate to project config?",!0))await z1(q,{port:Z,flashBaud:Q}),L.dim("Settings saved to .espcli")}let Y=j();R.subscribe(Y,(K)=>{if(K.data.type==="stdout"||K.data.type==="stderr")L.output(K.data.text)}),L.step(`Flashing to ${Z} at ${Q} baud...`);let G=await X2({projectDir:q,port:Z,baud:Q},Y);if(!G.ok)L.newline(),L.error(G.error),process.exit(1);L.newline(),L.success("Flash complete")}var L3=new Map;async function Z2($,q){let J=q||j(),{port:X,baud:Z=_1,projectDir:H}=$,Q=["-p",X,"-b",String(Z),"monitor"],Y=await S$("idf.py",Q,{cwd:H||process.cwd(),operationId:J,interactive:!0});if(!Y)return R.emit(J,{type:"error",message:"ESP-IDF not found"}),{ok:!1,error:"ESP-IDF not found"};let{proc:G,promise:K}=Y;return L3.set(J,G),K.then(()=>{L3.delete(J),R.emit(J,{type:"complete",result:{stopped:!0}})}),{ok:!0,data:{operationId:J,stop:()=>{G.kill("SIGTERM"),L3.delete(J)},wait:()=>K}}}async function ZX($){let q=await i(process.cwd());if(!q)L.error("Not an ESP-IDF project directory"),L.dim('Run this command from within an ESP-IDF project, or use "espcli init" to create one'),process.exit(1);let J=await D1(q),X=await j1();if(!X.ok)L.error(X.error),process.exit(1);let Z=$.port||J.port,H=Z?Z1(X.data,Z):void 0;if(!Z||!H)Z=await B1(X.data),H=Z1(X.data,Z);if(H){let G=SJ(H);if(!G.ok&&G.warning){if(L.warn(G.warning),!await g("Continue with this port?",!1))Z=await B1(X.data)}}let Q=$.baud||J.monitorBaud||_1;if(!$.baud&&!J.monitorBaud)Q=await a$("monitor",Q);if(Z!==J.port||Q!==J.monitorBaud){if(await e1(q))await z1(q,{port:Z,monitorBaud:Q});else if(await g("Save port and baud rate to project config?",!0))await z1(q,{port:Z,monitorBaud:Q}),L.dim("Settings saved to .espcli")}L.step(`Connecting to ${Z} at ${Q} baud...`),L.dim("Press Ctrl+] to exit"),L.newline();let Y=await Z2({port:Z,baud:Q,projectDir:q});if(!Y.ok)L.error(Y.error),process.exit(1);await Y.data.wait(),L.newline(),L.info("Monitor stopped"),process.exit(0)}async function QX($,q){let J=q||j(),{projectDir:X,full:Z}=$;if(!await O1(X))return R.emit(J,{type:"error",message:"Not an ESP-IDF project directory"}),{ok:!1,error:"Not an ESP-IDF project directory"};let Q=Z?"fullclean":"clean";R.emit(J,{type:"progress",message:`Running ${Q}...`});let Y=await X1("idf.py",[Q],{cwd:X,operationId:J});if(!Y.ok)return R.emit(J,{type:"error",message:Y.error}),{ok:!1,error:Y.error};if(Y.data.exitCode!==0){let G=`${Q} failed`;return R.emit(J,{type:"error",message:G}),{ok:!1,error:G}}return R.emit(J,{type:"complete",result:null}),{ok:!0,data:void 0}}async function HX($){let q=await i(process.cwd());if(!q)L.error("Not in an ESP-IDF project directory"),process.exit(1);let J=j();L.step($.full?"Running fullclean...":"Cleaning build...");let X=await QX({projectDir:q,full:$.full},J);if(!X.ok)L.error(X.error),process.exit(1);L.success("Clean complete")}async function YX($){let q=await i(process.cwd());if(!q)L.error("Not in an ESP-IDF project directory"),process.exit(1);let J=await D1(q),X=await j1();if(!X.ok)L.error(X.error),process.exit(1);let Z=$.port||J.port,H=Z?Z1(X.data,Z):void 0;if(!Z||!H)Z=await B1(X.data),H=Z1(X.data,Z);if(H){let z=n$(H);if(!z.ok&&z.warning){if(L.warn(z.warning),!await g("Continue with this port?",!1))Z=await B1(X.data)}}let Q=$.baud||J.flashBaud||V1,Y=J.monitorBaud||_1;if(Z!==J.port||Q!==J.flashBaud){if(await e1(q))await z1(q,{port:Z,flashBaud:Q,monitorBaud:Y});else if(await g("Save port and baud rate to project config?",!0))await z1(q,{port:Z,flashBaud:Q,monitorBaud:Y}),L.dim("Settings saved to .espcli")}let G=(z)=>{if(z.data.type==="stdout"||z.data.type==="stderr")L.output(z.data.text)};if(!$.skipBuild){let z=j();R.subscribe(z,G),L.step("Building...");let W=await J2({projectDir:q},z);if(!W.ok)L.newline(),L.error(W.error),process.exit(1);L.newline(),L.success("Build complete")}let K=j();R.subscribe(K,G),L.step(`Flashing to ${Z} at ${Q} baud...`);let U=await X2({projectDir:q,port:Z,baud:Q},K);if(!U.ok)L.newline(),L.error(U.error),process.exit(1);L.newline(),L.success("Flash complete"),L.step(`Starting monitor at ${Y} baud...`),L.dim("Press Ctrl+] to exit"),L.newline();let B=await Z2({port:Z,baud:Y,projectDir:q});if(!B.ok)L.error(B.error),process.exit(1);await B.data.wait(),L.newline(),L.info("Monitor stopped")}var f=n(F1(),1);async function GX(){L.info("Checking system health..."),L.newline();let $=await z3();if(x0($.python),x0($.git),x0($.idf),x0($.pyserial),x0($.esptool),L.newline(),await Bz(),L.newline(),$.python.ok&&$.git.ok&&$.idf.ok&&$.pyserial.ok&&$.esptool.ok)console.log(f.default.green("✓ All checks passed! Ready for ESP32 development."));else console.log(f.default.yellow("⚠ Some checks failed. See hints above to fix issues."));L.newline()}function x0($){let q=$.ok?f.default.green("✓"):f.default.red("✗"),J=$.name.padEnd(10),X=$.version?f.default.dim(`v${$.version}`):"",Z=$.path?f.default.dim(` (${$.path})`):"";if($.ok)console.log(` ${q} ${f.default.bold(J)} ${X}${Z}`);else if(console.log(` ${q} ${f.default.bold(J)} ${f.default.red($.error||"Not found")}`),$.hint)console.log(` ${f.default.dim("→")} ${f.default.yellow($.hint)}`)}async function Bz(){console.log(f.default.bold(" Devices:"));try{let $=await q2();if($.length===0)console.log(` ${f.default.dim("No ESP devices connected")}`);else for(let q of $){let J=q.espChip||q.chip||"Unknown",X=q.connectionType==="native-usb"?"USB":"UART";console.log(` ${f.default.green("•")} ${q.port} ${f.default.dim(`(${J} via ${X})`)}`)}}catch{console.log(` ${f.default.dim("Could not check devices")}`)}}var KX=n(F1(),1);async function UX(){let $=await t1();if(!$)L.error("ESP-IDF not found. Run `espcli install` first."),process.exit(1);let q=g$($);L.newline(),L.info("To add idf.py to your current terminal session, run:"),L.newline(),console.log(` ${KX.default.cyan(q)}`),L.newline(),L.dim("Or copy and paste this command:"),console.log(q),L.newline()}async function BX(){let $=await i(process.cwd());if(!$)L.error("Not in an ESP-IDF project directory"),process.exit(1);L.step("Opening menuconfig...");let q=await S$("idf.py",["menuconfig"],{cwd:$,interactive:!0});if(!q)L.error("ESP-IDF not found. Run `espcli install` first."),process.exit(1);await q.promise}function zX(){let $=new N3;return $.name("espcli").description("CLI tool for ESP-IDF development").version(c3),$.command("install").description("Install ESP-IDF framework").option("-p, --path <path>","Installation path").option("-t, --target <target>","Target chip (default: all)").option("-y, --yes","Skip confirmation prompts").action(bJ),$.command("init [name]").description("Create a new ESP-IDF project").option("-l, --lang <lang>","Language: c or cpp").option("-t, --target <target>","Target chip").action(oJ),$.command("devices").alias("ports").description("List connected ESP devices").action(qX),$.command("build").description("Build the current project").option("-t, --target <target>","Set target before build").option("-c, --clean","Clean before build").action(JX),$.command("flash").description("Flash firmware to device").option("-p, --port <port>","Serial port").option("-b, --baud <baud>","Flash baud rate",parseInt).action(XX),$.command("monitor").description("Open serial monitor").option("-p, --port <port>","Serial port").option("-b, --baud <baud>","Monitor baud rate",parseInt).action(ZX),$.command("run").description("Build, flash, and monitor").option("-p, --port <port>","Serial port").option("-b, --baud <baud>","Baud rate",parseInt).option("--skip-build","Skip build step").action(YX),$.command("clean").description("Clean build artifacts").option("-f, --full","Full clean (includes sdkconfig)").action(HX),$.command("doctor").alias("check").description("Check system health and dependencies").action(GX),$.command("source").alias("env").description("Show command to add idf.py to current terminal").action(UX),$.command("menuconfig").description("Open ESP-IDF menuconfig").action(BX),$}var zz=zX();zz.parse();