espcli 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +81 -80
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,133 +1,134 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{createRequire as
|
|
3
|
-
`)}displayWidth($){return
|
|
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,`
|
|
4
4
|
`+" ".repeat(q+Y));return H+Q+" ".repeat(Y)+U.replace(/\n/g,`
|
|
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
|
|
6
|
-
`)}}function
|
|
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}
|
|
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=
|
|
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`
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
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
|
|
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
|
|
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(`${$}
|
|
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=
|
|
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
|
|
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.
|
|
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 k3($){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 Y2(){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=G2;cX.useColor=Y2});var C3=A((dX)=>{var{Argument:x3}=k0(),{Command:K2}=F3(),{CommanderError:pX,InvalidArgumentError:j3}=e1(),{Help:lX}=X2(),{Option:M3}=Z2();dX.program=new K2;dX.createCommand=($)=>new K2($);dX.createOption=($,q)=>new M3($,q);dX.createArgument=($,q)=>new x3($,q);dX.Command=K2;dX.Option=M3;dX.Argument=x3;dX.Help=lX;dX.CommanderError=pX;dX.InvalidArgumentError=j3;dX.InvalidOptionArgumentError=j3});var V6=A((BV,L6)=>{L6.exports=B6;B6.sync=XQ;var U6=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 B6($,q,J){U6.stat($,function(X,Z){J(X,X?!1:z6(Z,$,q))})}function XQ($,q){return z6(U6.statSync($),$,q)}});var P6=A((LV,T6)=>{T6.exports=_6;_6.sync=ZQ;var W6=m("fs");function _6($,q,J){W6.stat($,function(X,Z){J(X,X?!1:R6(Z,q))})}function ZQ($,q){return R6(W6.statSync($),q)}function R6($,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,z=J&K||J&G&&Z===Q||J&Y&&X===H||J&U&&H===0;return z}});var F6=A((WV,k6)=>{var VV=m("fs"),h0;if(process.platform==="win32"||global.TESTING_WINDOWS)h0=V6();else h0=P6();k6.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)})})}h0($,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 h0.sync($,q||{})}catch(J){if(q&&q.ignoreErrors||J.code==="EACCES")return!1;else throw J}}});var A6=A((_V,I6)=>{var f1=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",x6=m("path"),YQ=f1?";":":",j6=F6(),M6=($)=>Object.assign(Error(`not found: ${$}`),{code:"ENOENT"}),C6=($,q)=>{let J=q.colon||YQ,X=$.match(/\//)||f1&&$.match(/\\/)?[""]:[...f1?[process.cwd()]:[],...(q.path||process.env.PATH||"").split(J)],Z=f1?q.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",H=f1?Z.split(J):[""];if(f1){if($.indexOf(".")!==-1&&H[0]!=="")H.unshift("")}return{pathEnv:X,pathExt:H,pathExtExe:Z}},w6=($,q,J)=>{if(typeof q==="function")J=q,q={};if(!q)q={};let{pathEnv:X,pathExt:Z,pathExtExe:H}=C6($,q),Q=[],Y=(K)=>new Promise((U,z)=>{if(K===X.length)return q.all&&Q.length?U(Q):z(M6($));let B=X[K],L=/^".*"$/.test(B)?B.slice(1,-1):B,_=x6.join(L,$),P=!L&&/^\.[\\\/]/.test($)?$.slice(0,2)+_:_;U(G(P,K,0))}),G=(K,U,z)=>new Promise((B,L)=>{if(z===Z.length)return B(Y(U+1));let _=Z[z];j6(K+_,{pathExt:H},(P,M)=>{if(!P&&M)if(q.all)Q.push(K+_);else return B(K+_);return B(G(K,U,z+1))})});return J?Y(0).then((K)=>J(null,K),J):Y(0)},GQ=($,q)=>{q=q||{};let{pathEnv:J,pathExt:X,pathExtExe:Z}=C6($,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 z=0;z<X.length;z++){let B=U+X[z];try{if(j6.sync(B,{pathExt:Z}))if(q.all)H.push(B);else return B}catch(L){}}}if(q.all&&H.length)return H;if(q.nothrow)return null;throw M6($)};I6.exports=w6;w6.sync=GQ});var y6=A((RV,j2)=>{var E6=($={})=>{let q=$.env||process.env;if(($.platform||process.platform)!=="win32")return"PATH";return Object.keys(q).reverse().find((X)=>X.toUpperCase()==="PATH")||"Path"};j2.exports=E6;j2.exports.default=E6});var v6=A((TV,D6)=>{var O6=m("path"),KQ=A6(),UQ=y6();function N6($,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?O6.delimiter:void 0})}catch(Y){}finally{if(H)process.chdir(X)}if(Q)Q=O6.resolve(Z?$.options.cwd:"",Q);return Q}function zQ($){return N6($)||N6($,!0)}D6.exports=zQ});var h6=A((VQ,C2)=>{var M2=/([()\][%!^"`<>&|;, *?])/g;function BQ($){return $=$.replace(M2,"^$1"),$}function LQ($,q){if($=`${$}`,$=$.replace(/(?=(\\+?)?)\1"/g,"$1$1\\\""),$=$.replace(/(?=(\\+?)?)\1$/,"$1$1"),$=`"${$}"`,$=$.replace(M2,"^$1"),q)$=$.replace(M2,"^$1");return $}VQ.command=BQ;VQ.argument=LQ});var S6=A((PV,f6)=>{f6.exports=/^#!(.*)/});var g6=A((kV,b6)=>{var RQ=S6();b6.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 m6=A((FV,c6)=>{var w2=m("fs"),TQ=g6();function PQ($){let J=Buffer.alloc(150),X;try{X=w2.openSync($,"r"),w2.readSync(X,J,0,150,0),w2.closeSync(X)}catch(Z){}return TQ(J.toString())}c6.exports=PQ});var d6=A((xV,l6)=>{var kQ=m("path"),u6=v6(),p6=h6(),FQ=m6(),xQ=process.platform==="win32",jQ=/\.(?:com|exe)$/i,MQ=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function CQ($){$.file=u6($);let q=$.file&&FQ($.file);if(q)return $.args.unshift($.file),$.command=q,u6($);return $.file}function wQ($){if(!xQ)return $;let q=CQ($),J=!jQ.test(q);if($.options.forceShell||J){let X=MQ.test(q);$.command=kQ.normalize($.command),$.command=p6.command($.command),$.args=$.args.map((H)=>p6.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)}l6.exports=IQ});var a6=A((jV,n6)=>{var I2=process.platform==="win32";function A2($,q){return Object.assign(Error(`${q} ${$.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${q} ${$.command}`,path:$.command,spawnargs:$.args})}function AQ($,q){if(!I2)return;let J=$.emit;$.emit=function(X,Z){if(X==="exit"){let H=i6(Z,q);if(H)return J.call($,"error",H)}return J.apply($,arguments)}}function i6($,q){if(I2&&$===1&&!q.file)return A2(q.original,"spawn");return null}function EQ($,q){if(I2&&$===1&&!q.file)return A2(q.original,"spawnSync");return null}n6.exports={hookChildProcess:AQ,verifyENOENT:i6,verifyENOENTSync:EQ,notFoundError:A2}});var r6=A((MV,S1)=>{var t6=m("child_process"),E2=d6(),y2=a6();function o6($,q,J){let X=E2($,q,J),Z=t6.spawn(X.command,X.args,X.options);return y2.hookChildProcess(Z,X),Z}function yQ($,q,J){let X=E2($,q,J),Z=t6.spawnSync(X.command,X.args,X.options);return Z.error=Z.error||y2.verifyENOENTSync(Z.status,X),Z}S1.exports=o6;S1.exports.spawn=o6;S1.exports.sync=yQ;S1.exports._parse=E2;S1.exports._enoent=y2});var l4=A((qM,$J)=>{var p4={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?p4.up():"");if($)q+=p4.left;return q}};$J.exports={cursor:p4,scroll:gU,erase:cU,beep:"\x07"}});var A1=A((JM,d4)=>{var S$=process||{},qJ=S$.argv||[],f$=S$.env||{},mU=!(!!f$.NO_COLOR||qJ.includes("--no-color"))&&(!!f$.FORCE_COLOR||qJ.includes("--color")||S$.platform==="win32"||(S$.stdout||{}).isTTY&&f$.TERM!=="dumb"||!!f$.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)},JJ=($=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")}};d4.exports=JJ();d4.exports.createColors=JJ});var w3=o(C3(),1),{program:WB,createCommand:_B,createArgument:RB,createOption:TB,CommanderError:PB,InvalidArgumentError:kB,InvalidOptionArgumentError:FB,Command:I3,Argument:xB,Option:jB,Help:MB}=w3.default;import{homedir as A3}from"os";import{join as E3}from"path";var y3=[{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}],U2=E3(A3(),"esp","esp-idf"),x0=E3(A3(),"esp"),O3="https://github.com/espressif/esp-idf.git",O1=460800,N1=115200,N3=[{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)"}],D3=[{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)"}}},v3={zsh:".zshrc",bash:".bashrc",fish:".config/fish/config.fish"},h3="0.0.1";class f3{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 f3;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 XZ}from"node:url";var D1=($,q)=>{let J=L2(ZZ($));if(typeof J!=="string")throw TypeError(`${q} must be a string or a file URL: ${J}.`);return J},ZZ=($)=>B2($)?$.toString():$,B2=($)=>typeof $!=="string"&&$&&Object.getPrototypeOf($)===String.prototype,L2=($)=>$ instanceof URL?XZ($):$;var j0=($,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 zZ}from"node:child_process";import{StringDecoder as QZ}from"node:string_decoder";var{toString:S3}=Object.prototype,b3=($)=>S3.call($)==="[object ArrayBuffer]",D=($)=>S3.call($)==="[object Uint8Array]",H1=($)=>new Uint8Array($.buffer,$.byteOffset,$.byteLength),HZ=new TextEncoder,g3=($)=>HZ.encode($),YZ=new TextDecoder,M0=($)=>YZ.decode($),c3=($,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"?g3(H):H).map((H)=>J.write(H)),Z=J.end();return Z===""?X:[...X,Z]},$0=($)=>{if($.length===1&&D($[0]))return $[0];return V2(KZ($))},KZ=($)=>$.map((q)=>typeof q==="string"?g3(q):q),V2=($)=>{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 l3=($)=>Array.isArray($)&&Array.isArray($.raw),d3=($,q)=>{let J=[];for(let[H,Q]of $.entries())J=BZ({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,{}]},BZ=({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=u3(J,H,Q);if(X===q.length)return G;let K=q[X],U=Array.isArray(K)?K.map((z)=>p3(z)):[p3(K)];return u3(G,U,Y)},LZ=($,q)=>{if(q.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let J=[],X=0,Z=m3.has(q[0]);for(let Q=0,Y=0;Q<$.length;Q+=1,Y+=1){let G=q[Y];if(m3.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}},
|
|
29
|
-
`]),VZ={x:3,u:5},
|
|
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.
|
|
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]},
|
|
32
|
-
`).map((q)=>
|
|
33
|
-
`),
|
|
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(`
|
|
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=
|
|
36
|
-
`).map((J)=>rZ({...q,message:J})),rZ=($)=>{return{verboseLine:
|
|
37
|
-
${
|
|
38
|
-
${
|
|
39
|
-
${
|
|
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=($)=>
|
|
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.
|
|
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
44
|
${n("getOneMessage",$)},
|
|
45
45
|
${n("sendMessage",$,"message, {strict: true}")},
|
|
46
|
-
]);`)},l0=($,q)=>Error(`${n("sendMessage",q)} failed when sending an acknowledgment response to the ${
|
|
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 "${$}".
|
|
47
47
|
It must be ${X} or "fd3", "fd4" (and so on).
|
|
48
|
-
It is optional and defaults to "${Z}".`)},
|
|
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.`)},
|
|
50
|
-
Please set this option with "pipe" instead.`},
|
|
51
|
-
Please rename it to ${J$(q)}.`);let J=[...
|
|
52
|
-
Please rename it to one of: ${J}.`)},
|
|
53
|
-
${$.message}`,$}},
|
|
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}.
|
|
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=
|
|
57
|
-
`,
|
|
58
|
-
${
|
|
59
|
-
`)].map((L1)=>q0(m1(
|
|
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(`
|
|
60
60
|
|
|
61
|
-
`);return{originalMessage:
|
|
62
|
-
`):I7($),I7=($)=>{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})=>E7({command:$,escapedCommand:q,cwd:H,durationMs:F2(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:z,all:B,ipcOutput:L,options:{timeoutDuration:_,timeout:P=_,forceKillAfterDelay:M,killSignal:F,cwd:O,maxBuffer:v},isSync:x})=>{let{exitCode:I,signal:N,signalDescription:c}=yH(K,U),{originalMessage:B1,shortMessage:L1,message:q2}=A7({stdio:z,all:B,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=q8($,q2,x);return Object.assign(s1,EH({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:z,all:B,ipcOutput:L,cwd:O,originalMessage:B1,shortMessage:L1})),s1},EH=({error:$,command:q,escapedCommand:J,startTime:X,timedOut:Z,isCanceled:H,isGracefullyCanceled:Q,isMaxBuffer:Y,isForcefullyTerminated:G,exitCode:K,signal:U,signalDescription:z,stdio:B,all:L,ipcOutput:_,cwd:P,originalMessage:M,shortMessage:F})=>E7({shortMessage:F,originalMessage:M,command:q,escapedCommand:J,cwd:P,durationMs:F2(X),failed:!0,timedOut:Z,isCanceled:H,isGracefullyCanceled:Q,isTerminated:U!==void 0,isMaxBuffer:Y,isForcefullyTerminated:G,exitCode:K,signal:U,signalDescription:z,code:$.cause?.code,stdout:B[1],stderr:B[2],all:L,stdio:B,ipcOutput:_,pipedFrom:[]}),E7=($)=>Object.fromEntries(Object.entries($).filter(([,q])=>q!==void 0)),yH=($,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 y7=($)=>Number.isFinite($)?$:0;function OH($){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(y7($*1000)%1000),nanoseconds:Math.trunc(y7($*1e6)%1000)}}function NH($){return{days:$/86400000n,hours:$/3600000n%24n,minutes:$/60000n%60n,seconds:$/1000n%60n,milliseconds:$%1000n,microseconds:0n,nanoseconds:0n}}function n2($){switch(typeof $){case"number":{if(Number.isFinite($))return OH($);break}case"bigint":return NH($)}throw TypeError("Expected a finite number or bigint")}var DH=($)=>$===0||$===0n,vH=($,q)=>q===1||q===1n?$:`${$}s`,hH=0.0000001,fH=24n*60n*60n*1000n;function a2($,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,z)=>{let B=Math.floor(U*10**z+hH);return(Math.round(B)/10**z).toFixed(z)},Q=(U,z,B,L)=>{if((Z.length===0||!q.colonNotation)&&DH(U)&&!(q.colonNotation&&B==="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?" "+vH(z,U):B;Z.push(L)},Y=n2($),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),z=Number(Y.milliseconds),B=Number(Y.microseconds),L=Number(Y.nanoseconds);if(Q(U,"second","s"),q.formatSubMilliseconds)Q(z,"millisecond","ms"),Q(B,"microsecond","µs"),Q(L,"nanosecond","ns");else{let _=z+B/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($%fH):$)/1000%60,z=typeof q.secondsDecimalDigits==="number"?q.secondsDecimalDigits:1,B=H(U,z),L=q.keepDecimalsOnWholeSeconds?B:B.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 O7=($,q)=>{if($.failed)r({type:"error",verboseMessage:$.shortMessage,verboseInfo:q,result:$})};var N7=($,q)=>{if(!v1(q))return;O7($,q),SH($,q)},SH=($,q)=>{let J=`(done in ${a2($.durationMs)})`;r({type:"duration",verboseMessage:J,verboseInfo:q,result:$})};var l1=($,q,{reject:J})=>{if(N7($,q),$.failed&&J)throw $;return $};import{readFileSync as Q5}from"node:fs";var h7=($,q)=>{if(j1($))return"asyncGenerator";if(b7($))return"generator";if(V$($))return"fileUrl";if(uH($))return"filePath";if(dH($))return"webStream";if(a($,{checkOpen:!1}))return"native";if(D($))return"uint8Array";if(iH($))return"asyncIterable";if(nH($))return"iterable";if(r2($))return f7({transform:$},q);if(mH($))return bH($,q);return"native"},bH=($,q)=>{if(l2($.transform,{checkOpen:!1}))return gH($,q);if(r2($.transform))return f7($,q);return cH($,q)},gH=($,q)=>{return S7($,q,"Duplex stream"),"duplex"},f7=($,q)=>{return S7($,q,"web TransformStream"),"webTransform"},S7=({final:$,binary:q,objectMode:J},X,Z)=>{D7($,`${X}.final`,Z),D7(q,`${X}.binary`,Z),t2(J,`${X}.objectMode`)},D7=($,q,J)=>{if($!==void 0)throw TypeError(`The \`${q}\` option can only be defined when using a generator, not a ${J}.`)},cH=({transform:$,final:q,binary:J,objectMode:X},Z)=>{if($!==void 0&&!v7($))throw TypeError(`The \`${Z}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(l2(q,{checkOpen:!1}))throw TypeError(`The \`${Z}.final\` option must not be a Duplex stream.`);if(r2(q))throw TypeError(`The \`${Z}.final\` option must not be a web TransformStream.`);if(q!==void 0&&!v7(q))throw TypeError(`The \`${Z}.final\` option must be a generator.`);return t2(J,`${Z}.binary`),t2(X,`${Z}.objectMode`),j1($)||j1(q)?"asyncGenerator":"generator"},t2=($,q)=>{if($!==void 0&&typeof $!=="boolean")throw TypeError(`The \`${q}\` option must use a boolean.`)},v7=($)=>j1($)||b7($),j1=($)=>Object.prototype.toString.call($)==="[object AsyncGeneratorFunction]",b7=($)=>Object.prototype.toString.call($)==="[object GeneratorFunction]",mH=($)=>E($)&&($.transform!==void 0||$.final!==void 0),V$=($)=>Object.prototype.toString.call($)==="[object URL]",g7=($)=>V$($)&&$.protocol!=="file:",uH=($)=>E($)&&Object.keys($).length>0&&Object.keys($).every((q)=>pH.has(q))&&o2($.file),pH=new Set(["file","append"]),o2=($)=>typeof $==="string",c7=($,q)=>$==="native"&&typeof q==="string"&&!lH.has(q),lH=new Set(["ipc","ignore","inherit","overlapped","pipe"]),m7=($)=>Object.prototype.toString.call($)==="[object ReadableStream]",W$=($)=>Object.prototype.toString.call($)==="[object WritableStream]",dH=($)=>m7($)||W$($),r2=($)=>m7($?.readable)&&W$($?.writable),iH=($)=>u7($)&&typeof $[Symbol.asyncIterator]==="function",nH=($)=>u7($)&&typeof $[Symbol.iterator]==="function",u7=($)=>typeof $==="object"&&$!==null,d=new Set(["generator","asyncGenerator","duplex","webTransform"]),_$=new Set(["fileUrl","filePath","fileNumber"]),s2=new Set(["fileUrl","filePath"]),p7=new Set([...s2,"webStream","nodeStream"]),l7=new Set(["webTransform","duplex"]),_1={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 e2=($,q,J,X)=>X==="output"?aH($,q,J):tH($,q,J),aH=($,q,J)=>{let X=q!==0&&J[q-1].value.readableObjectMode;return{writableObjectMode:X,readableObjectMode:$??X}},tH=($,q,J)=>{let X=q===0?$===!0:J[q-1].value.readableObjectMode,Z=q!==J.length-1&&($??X);return{writableObjectMode:X,readableObjectMode:Z}},d7=($,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 i7=($,q,J,X)=>[...$.filter(({type:Z})=>!d.has(Z)),...oH($,q,J,X)],oH=($,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]=rH({stdioItem:Y,index:Number(Q),newTransforms:H,optionName:q,direction:J,encoding:X});return qY(H,J)},rH=({stdioItem:$,stdioItem:{type:q},index:J,newTransforms:X,optionName:Z,direction:H,encoding:Q})=>{if(q==="duplex")return sH({stdioItem:$,optionName:Z});if(q==="webTransform")return eH({stdioItem:$,index:J,newTransforms:X,direction:H});return $Y({stdioItem:$,index:J,newTransforms:X,direction:H,encoding:Q})},sH=({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}}},eH=({stdioItem:$,stdioItem:{value:q},index:J,newTransforms:X,direction:Z})=>{let{transform:H,objectMode:Q}=E(q)?q:{transform:q},{writableObjectMode:Y,readableObjectMode:G}=e2(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},z=G||u.has(H),{writableObjectMode:B,readableObjectMode:L}=e2(U,J,X,Z);return{...$,value:{transform:Q,final:Y,binary:z,preserveNewlines:K,writableObjectMode:B,readableObjectMode:L}}},qY=($,q)=>q==="input"?$.reverse():$;import $4 from"node:process";var n7=($,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]??a7[$](q),XY=["input","output","output"],d1=()=>{return},q4=()=>"input",a7={generator:d1,asyncGenerator:d1,fileUrl:d1,filePath:d1,iterable:q4,asyncIterable:q4,uint8Array:q4,webStream:($)=>W$($)?"output":"input",nodeStream($){if(!x1($,{checkOpen:!1}))return"output";return p2($,{checkOpen:!1})?void 0:"input"},webTransform:d1,duplex:d1,native($){let q=ZY($);if(q!==void 0)return q;if(a($,{checkOpen:!1}))return a7.nodeStream($)}},ZY=($)=>{if([0,$4.stdin].includes($))return"input";if([1,2,$4.stdout,$4.stderr].includes($))return"output"},QY="output";var t7=($,q)=>q&&!$.includes("ipc")?[...$,"ipc"]:$;var o7=({stdio:$,ipc:q,buffer:J,...X},Z,H)=>{let Q=HY($,X).map((Y,G)=>r7(Y,G));return H?GY(Q,J,Z):t7(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),r7=($,q)=>{if(Array.isArray($))return $.map((J)=>r7(J,q));if($===null||$===void 0)return q>=l.length?"ignore":"pipe";return $},GY=($,q,J)=>$.map((X,Z)=>!q[Z]&&Z!==0&&!h1(J,Z)&&KY(X)?"ignore":X),KY=($)=>$==="pipe"||Array.isArray($)&&$.every((q)=>q==="pipe");import{readFileSync as UY}from"node:fs";import zY from"node:tty";var e7=({stdioItem:$,stdioItem:{type:q},isStdioArray:J,fdNumber:X,direction:Z,isSync:H})=>{if(!J||q!=="native")return $;return H?BY({stdioItem:$,fdNumber:X,direction:Z}):WY({stdioItem:$,fdNumber:X})},BY=({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(zY.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:s7(X,q,J),optionName:J};if(typeof q==="number")return{type:"nodeStream",value:s7(q,q,J),optionName:J};if(a(q,{checkOpen:!1}))return{type:"nodeStream",value:q,optionName:J};return $},s7=($,q,J)=>{let X=C0[$];if(X===void 0)throw TypeError(`The \`${J}: ${q}\` option is invalid: no such standard stream.`);return X};var $5=({input:$,inputFile:q},J)=>J===0?[..._Y($),...TY(q)]:[],_Y=($)=>$===void 0?[]:[{type:RY($),value:$,optionName:"input"}],RY=($)=>{if(x1($,{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(o2($))return{type:"filePath",value:{file:$}};throw Error("The `inputFile` option must be a file path string or a file URL.")};var q5=($)=>$.filter((q,J)=>$.every((X,Z)=>q.value!==X.value||J>=Z||q.type==="generator"||q.type==="asyncGenerator")),J5=({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(p7.has($))return X5({otherStdioItems:Q,type:$,value:q,optionName:J,direction:X});if(l7.has($))jY({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(s2.has(q))X5({otherStdioItems:$,type:q,value:J,optionName:X,direction:Z})},X5=({otherStdioItems:$,type:q,value:J,optionName:X,direction:Z})=>{let H=$.filter((Y)=>xY(Y,J));if(H.length===0)return;let Q=H.find((Y)=>Y.direction!==Z);return Z5(Q,X,q),Z==="output"?H[0].stream:void 0},xY=({type:$,value:q},J)=>{if($==="filePath")return q.file===J.file;if($==="fileUrl")return q.href===J.href;return q===J},jY=({otherStdioItems:$,type:q,value:J,optionName:X})=>{let Z=$.find(({value:{transform:H}})=>H===J.transform);Z5(Z,X,q)},Z5=($,q,J)=>{if($!==void 0)throw TypeError(`The \`${$.optionName}\` and \`${q}\` options must not target ${_1[J]} that is the same.`)};var R$=($,q,J,X)=>{let H=o7(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})=>hY(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=n7(H,q,Z),G=H.map((z)=>e7({stdioItem:z,isStdioArray:Q,fdNumber:q,direction:Y,isSync:X})),K=i7(G,Z,Y,J),U=d7(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)),...$5(J,q)],Q=q5(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(g7(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(
|
|
64
|
-
`){let Q=gY(J,H,q,$),Y=J.slice(Z+1,H+1-Q);if(X.length>0)Y=
|
|
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
|
|
65
65
|
`,unixNewline:`
|
|
66
66
|
`,LF:`
|
|
67
|
-
`,concatBytes:
|
|
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}\`.
|
|
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 W5}from"node:util";var H4=W5(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)},_5=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)},R5=W5(async({currentIterable:$},q)=>{if($!==void 0){await(q?$.throw(q):$.return());return}if(q)throw q}),qG=function*($){yield $};var Y4=($,q,J,X)=>{try{for(let Z of $(...q))J.push(Z);X()}catch(Z){X(Z)}},T5=($,q)=>[...q.flatMap((J)=>[...M1(J,$,0)]),...G0($)],M1=function*($,q,J){if(J===q.length){yield $;return}let{transform:X=XG}=q[J];for(let Z of X($))yield*M1(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*M1(X,J,q+1)},XG=function*($){yield $};var G4=({value:$,value:{transform:q,final:J,writableObjectMode:X,readableObjectMode:Z},optionName:H},{encoding:Q})=>{let Y={},G=k5($,Q,H),K=j1(q),U=j1(J),z=K?H4.bind(void 0,k$,Y):Y4.bind(void 0,M1),B=K||U?H4.bind(void 0,_5,Y):Y4.bind(void 0,G0),L=K||U?R5.bind(void 0,Y):void 0;return{stream:new ZG({writableObjectMode:X,writableHighWaterMark:P5(X),readableObjectMode:Z,readableHighWaterMark:P5(Z),transform(P,M,F){z([P,G,0],this,F)},flush(P){B([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=k5(Q,J,Y);$=T5(G,$)}return $},k5=({transform:$,final:q,binary:J,writableObjectMode:X,readableObjectMode:Z,preserveNewlines:H},Q,Y)=>{let G={};return[{transform:B5(X,Y)},P$(J,Q,X),T$(J,H,X,G),{transform:$,final:q},{transform:L5(Z,Y)},z5({binary:J,preserveNewlines:H,readableObjectMode:Z,state:G})].filter(Boolean)};var F5=($,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 ${_1[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 BG,appendFileSync as LG}from"node:fs";var x$=({stdioItems:$,encoding:q,verboseInfo:J,fdNumber:X})=>X!=="all"&&h1(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(!zG(q))M5(Z,J,X)},j5=($,q,J)=>{for(let X of $)M5(X,q,J)},zG=($)=>$._readableState.pipes.length>0,M5=($,q,J)=>{let X=N0($);r({type:"output",verboseMessage:X,fdNumber:q,verboseInfo:J})};var C5=({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:z})=>{if($===null)return;let B=w7($,H,z),L=H1(B),{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(x){return X.error=x,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=c3($,J);if(X[H])return{serializedResult:Q,finalResult:Q4(Q,!Z[H],q)};return{serializedResult:Q}},RG=({serializedResult:$,fdNumber:q,state:J,verboseInfo:X,encoding:Z,stdioItems:H,objectMode:Q})=>{if(!x$({stdioItems:H,encoding:Z,verboseInfo:X,fdNumber:q}))return;let Y=Q4($,!1,Q);try{j5(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),BG(X,$)}};var w5=([,$,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 V2([$,q]);return`${$}${q}`};import{once as K4}from"node:events";var I5=async($,q)=>{let[J,X]=await PG($);return q.isForcefullyTerminated??=!1,[J,X]},PG=async($)=>{let[q,J]=await Promise.allSettled([K4($,"spawn"),K4($,"exit")]);if(q.status==="rejected")return[];return J.status==="rejected"?A5($):J.value},A5=async($)=>{try{return await K4($,"exit")}catch{return A5($)}},E5=async($)=>{let[q,J]=await $;if(!kG(q,J)&&U4(q,J))throw new s;return[q,J]},kG=($,q)=>$===void 0&&q===void 0,U4=($,q)=>$!==0||q!==null;var y5=({error:$,status:q,signal:J,output:X},{maxBuffer:Z})=>{let H=FG($,q,J),Q=H?.code==="ETIMEDOUT",Y=C7(H,X,Z);return{resultError:H,exitCode:q,signal:J,timedOut:Q,isMaxBuffer:Y}},FG=($,q,J)=>{if($!==void 0)return $;return U4(q,J)?new s:void 0};var O5=($,q,J)=>{let{file:X,commandArguments:Z,command:H,escapedCommand:Q,startTime:Y,verboseInfo:G,options:K,fileDescriptors:U}=jG($,q,J),z=wG({file:X,commandArguments:Z,options:K,command:H,escapedCommand:Q,verboseInfo:G,fileDescriptors:U,startTime:Y});return l1(z,G,K)},jG=($,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 z=Y5(U,Q);return{file:G,commandArguments:K,command:X,escapedCommand:Z,startTime:H,verboseInfo:Q,options:U,fileDescriptors:z}},MG=($)=>$.node&&!$.ipc?{...$,ipc:!1}:$,CG=({ipc:$,ipcInput:q,detached:J,cancelSignal:X})=>{if(q)j$("ipcInput");if($)j$("ipc: true");if(J)j$("detached: true");if(X)j$("cancelSignal")},j$=($)=>{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:z,timedOut:B,isMaxBuffer:L}=y5(G,J),{output:_,error:P=K}=C5({fileDescriptors:Q,syncResult:G,options:J,isMaxBuffer:L,verboseInfo:H}),M=_.map((O,v)=>U1(O,J,v)),F=U1(w5(_,J),J,"all");return EG({error:P,exitCode:U,signal:z,timedOut:B,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{F5(H,J);let Y=AG(J);return xG(...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:B$(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 f5 from"node:process";import{once as z4,on as yG}from"node:events";var N5=({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=W1($,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}),R8(q)},vG=async($,q,{signal:J})=>{let[X]=await z4($,"strict:error",{signal:J});throw l0(X,q)};import{once as v5,on as hG}from"node:events";var h5=({anyProcess:$,channel:q,isSubprocess:J,ipc:X},{reference:Z=!0}={})=>B4({anyProcess:$,channel:q,isSubprocess:J,ipc:X,shouldAwait:!J,reference:Z}),B4=({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=W1($,q,J),Y=new AbortController,G={};return fG($,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})},fG=async($,q,J)=>{try{await v5(q,"disconnect",{signal:J.signal}),J.abort()}catch{}},SG=async({ipcEmitter:$,isSubprocess:q,controller:J,state:X})=>{try{let[Z]=await v5($,"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 hG(J,"message",{signal:H.signal}))D5(Q),yield G}catch{D5(Q)}finally{if(H.abort(),a0(q,Y),!X)g1($);if(Z)await $}},D5=({error:$})=>{if($)throw $};var S5=($,{ipc:q})=>{Object.assign($,g5($,!1,q))},b5=()=>{let $=f5,q=!0,J=f5.channel!==void 0;return{...g5($,!0,J),getCancelSignal:l8.bind(void 0,{anyProcess:$,channel:$.channel,isSubprocess:!0,ipc:J})}},g5=($,q,J)=>({sendMessage:q$.bind(void 0,{anyProcess:$,channel:$.channel,isSubprocess:q,ipc:J}),getOneMessage:N5.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 c5=({error:$,command:q,escapedCommand:J,fileDescriptors:X,options:Z,startTime:H,verboseInfo:Q})=>{J4(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 m5,createWriteStream as u5}from"node:fs";import{Buffer as tG}from"node:buffer";import{Readable as U0,Writable as oG,Duplex as rG}from"node:stream";var l5=($,q)=>R$(sG,$,q,!1),z0=({type:$,optionName:q})=>{throw TypeError(`The \`${q}\` option cannot be ${_1[$]}.`)},p5={fileNumber:z0,generator:G4,asyncGenerator:G4,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:{...p5,fileUrl:({value:$})=>({stream:m5($)}),filePath:({value:{file:$}})=>({stream:m5($)}),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:{...p5,fileUrl:({value:$})=>({stream:u5($)}),filePath:({value:{file:$,append:q}})=>({stream:u5($,q?{flags:"a"}:{})}),webStream:({value:$})=>({stream:oG.fromWeb($)}),iterable:z0,asyncIterable:z0,string:z0,uint8Array:z0}};import{on as eG,once as d5}from"node:events";import{PassThrough as $K,getDefaultHighWaterMark as qK}from"node:stream";import{finished as a5}from"node:stream/promises";function C1($){if(!Array.isArray($))throw TypeError(`Expected an array, got \`${typeof $}\`.`);for(let Z of $)L4(Z);let q=$.some(({readableObjectMode:Z})=>Z),J=JK($,q),X=new t5({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 t5 extends $K{#q=new Set([]);#J=new Set([]);#$=new Set([]);#X;#Q=Symbol("unpipe");#Z=new WeakMap;add($){if(L4($),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(L4($),!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$($,i5);let X=new AbortController;try{await Promise.race([ZK($,X),QK($,q,J,X)])}finally{X.abort(),M$($,-i5)}},ZK=async($,{signal:q})=>{try{await a5($,{signal:q,cleanup:!0})}catch(J){throw o5($,J),J}},QK=async($,q,J,{signal:X})=>{for await(let[Z]of eG($,"unpipe",{signal:X}))if(q.has(Z))Z.emit(J)},L4=($)=>{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$($,n5);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$($,-n5)}if(J.size>0&&J.size===X.size+Z.size)if(X.size===0&&Z.size>0)V4($);else UK($)},YK=async($,q,{signal:J})=>{try{if(await $,!J.aborted)V4(q)}catch(X){if(!J.aborted)o5(q,X)}},GK=async({passThroughStream:$,stream:q,streams:J,ended:X,aborted:Z,controller:{signal:H}})=>{try{if(await a5(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(r5(Q))Z.add(q);else s5($,Q)}},KK=async({stream:$,streams:q,ended:J,aborted:X,unpipeEvent:Z,controller:{signal:H}})=>{if(await d5($,Z,{signal:H}),!$.readable)return d5(H,"abort",{signal:H});q.delete($),J.delete($),X.delete($)},UK=($)=>{if($.writable)$.end()},o5=($,q)=>{if(r5(q))V4($);else s5($,q)},r5=($)=>$?.code==="ERR_STREAM_PREMATURE_CLOSE",V4=($)=>{if($.readable||$.writable)$.destroy()},s5=($,q)=>{if(!$.destroyed)$.once("error",zK),$.destroy(q)},zK=()=>{},M$=($,q)=>{let J=$.getMaxListeners();if(J!==0&&J!==Number.POSITIVE_INFINITY)$.setMaxListeners(J+q)},i5=2,n5=1;import{finished as e5}from"node:stream/promises";var i1=($,q)=>{$.pipe(q),BK($,q),LK($,q)},BK=async($,q)=>{if(i($)||i(q))return;try{await e5($,{cleanup:!0,readable:!0,writable:!1})}catch{}W4(q)},W4=($)=>{if($.writable)$.end()},LK=async($,q)=>{if(i($)||i(q))return;try{await e5(q,{cleanup:!0,readable:!1,writable:!0})}catch{}_4($)},_4=($)=>{if($.readable)$.destroy()};var $q=($,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]:C1(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($))F1($,TK,q)},TK=2;import{addAbortListener as FK}from"node:events";var w1=[];w1.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")w1.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")w1.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",R4=Symbol.for("signal-exit emitter"),T4=globalThis,PK=Object.defineProperty.bind(Object);class qq{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(T4[R4])return T4[R4];PK(T4,R4,{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 k4{}var kK=($)=>{return{onExit(q,J){return $.onExit(q,J)},load(){return $.load()},unload(){return $.unload()}}};class Jq extends k4{onExit(){return()=>{}}load(){}unload(){}}class Xq extends k4{#q=P4.platform==="win32"?"SIGINT":"SIGHUP";#J=new qq;#$;#X;#Q;#Z={};#H=!1;constructor($){super();this.#$=$,this.#Z={};for(let q of w1)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 w1)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,w1.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 P4=globalThis.process,{onExit:Zq,load:Nk,unload:Dk}=kK(C$(P4)?new Xq(P4):new Jq);var Qq=($,{cleanup:q,detached:J},{signal:X})=>{if(!q||J)return;let Z=Zq(()=>{$.kill()});FK(X,()=>{Z()})};var Yq=({source:$,sourcePromise:q,boundOptions:J,createNested:X},...Z)=>{let H=D0(),{destination:Q,destinationStream:Y,destinationError:G,from:K,unpipeSignal:U}=xK(J,X,Z),{sourceStream:z,sourceError:B}=MK($,K),{options:L,fileDescriptors:_}=$1.get($);return{sourcePromise:q,sourceStream:z,sourceOptions:L,sourceError:B,destination:Q,destinationStream:Y,destinationError:G,unpipeSignal:U,fileDescriptors:_,startTime:H}},xK=($,q,J)=>{try{let{destination:X,pipeOptions:{from:Z,to:H,unpipeSignal:Q}={}}=jK($,q,...J),Y=i0(X,H);return{destination:X,destinationStream:Y,from:Z,unpipeSignal:Q}}catch(X){return{destinationError:X}}},jK=($,q,J,...X)=>{if(Array.isArray(J))return{destination:q(Hq,$)(J,...X),pipeOptions:$};if(typeof J==="string"||J instanceof URL||B2(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]=j0(J,...X);return{destination:q(Hq)(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}`)},Hq=({options:$})=>({options:{...$,stdin:"pipe",piped:!0}}),MK=($,q)=>{try{return{sourceStream:c1($,q)}}catch(J){return{sourceError:J}}};var Kq=({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 F4({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 _4($),X;if(q!==void 0)return W4(J),q},F4=({error:$,fileDescriptors:q,sourceOptions:J,startTime:X})=>p1({error:$,command:Gq,escapedCommand:Gq,fileDescriptors:q,options:J,startTime:X,isSync:!1}),Gq="source.pipe(destination)";var Uq=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 F1($,yK,J.signal),F1(q,OK,J.signal),EK(q),X},IK=($,q)=>{let J=C1([$]);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 Bq=($,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 F4({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}=Yq($,...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=hK($,Z);Kq({sourceStream:q,sourceError:X,destinationStream:H,destinationError:Q,fileDescriptors:G,sourceOptions:J,startTime:K});let z=new AbortController;try{let B=zq(q,H,z);return await Promise.race([Uq(U),...Bq(Y,{sourceStream:q,mergedStream:B,sourceOptions:J,fileDescriptors:G,startTime:K})])}finally{z.abort()}},hK=($,q)=>Promise.allSettled([$,q]);import{setImmediate as uK}from"node:timers/promises";import{on as fK}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),Vq({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 Vq({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()}},Vq=({stream:$,controller:q,binary:J,shouldEncode:X,encoding:Z,shouldSplit:H,preserveNewlines:Q})=>{let Y=fK($,"data",{signal:q.signal,highWaterMark:Lq,highWatermark:Lq});return cK({onStdoutChunk:Y,controller:q,binary:J,shouldEncode:X,encoding:Z,shouldSplit:H,preserveNewlines:Q})},j4=SK(!0),Lq=j4,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*M1(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 Wq=async({stream:$,onStreamEnd:q,fdNumber:J,encoding:X,buffer:Z,maxBuffer:H,lines:Q,allMixed:Y,stripFinalNewline:G,verboseInfo:K,streamInfo:U})=>{let z=pK({stream:$,onStreamEnd:q,fdNumber:J,encoding:X,allMixed:Y,verboseInfo:K,streamInfo:U});if(!Z){await Promise.all([lK($),z]);return}let B=X4(G,J),L=x4({stream:$,onStreamEnd:q,lines:Q,encoding:X,stripFinalNewline:B,allMixed:Y}),[_]=await Promise.all([dK({stream:$,iterable:L,fdNumber:J,encoding:X,maxBuffer:H,lines:Q}),z]);return _},pK=async({stream:$,onStreamEnd:q,fdNumber:J,encoding:X,allMixed:Z,verboseInfo:H,streamInfo:{fileDescriptors:Q}})=>{if(!x$({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 z$(J,{maxBuffer:H})}catch(Y){return _q(x7({error:Y,stream:$,readableObjectMode:q,lines:Q,encoding:Z,fdNumber:X}))}},M4=async($)=>{try{return await $}catch(q){return _q(q)}},_q=({bufferedData:$})=>b3($)?new Uint8Array($):$;import{finished as iK}from"node:stream/promises";var B0=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 Rq($)||E$($);return J.propagating=!0,C4(J,q)===X?Rq($):E$($)},C4=({fileDescriptors:$},q)=>q!=="all"&&$[q].direction==="input",E$=($)=>$?.code==="ERR_STREAM_PREMATURE_CLOSE",Rq=($)=>$?.code==="EPIPE";var Tq=({subprocess:$,encoding:q,buffer:J,maxBuffer:X,lines:Z,stripFinalNewline:H,verboseInfo:Q,streamInfo:Y})=>$.stdio.map((G,K)=>w4({stream:G,fdNumber:K,encoding:q,buffer:J[K],maxBuffer:X[K],lines:Z[K],allMixed:!1,stripFinalNewline:H,verboseInfo:Q,streamInfo:Y})),w4=async({stream:$,fdNumber:q,encoding:J,buffer:X,maxBuffer:Z,lines:H,allMixed:Q,stripFinalNewline:Y,verboseInfo:G,streamInfo:K})=>{if(!$)return;let U=B0($,q,K);if(C4(K,q)){await U;return}let[z]=await Promise.all([Wq({stream:$,onStreamEnd:U,fdNumber:q,encoding:J,buffer:X,maxBuffer:Z,lines:H,allMixed:Q,stripFinalNewline:Y,verboseInfo:G,streamInfo:K}),U]);return z};var Pq=({stdout:$,stderr:q},{all:J})=>J&&($||q)?C1([$,q].filter(Boolean)):void 0,kq=({subprocess:$,encoding:q,buffer:J,maxBuffer:X,lines:Z,stripFinalNewline:H,verboseInfo:Q,streamInfo:Y})=>w4({...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 Fq=($)=>h1($,"ipc"),xq=($,q)=>{let J=N0($);r({type:"ipc",verboseMessage:J,fdNumber:"ipc",verboseInfo:q})};var jq=async({subprocess:$,buffer:q,maxBuffer:J,ipc:X,ipcOutput:Z,verboseInfo:H})=>{if(!X)return Z;let Q=Fq(H),Y=Y1(q,"ipc"),G=Y1(J,"ipc");for await(let K of B4({anyProcess:$,channel:$.channel,isSubprocess:!1,ipc:X,shouldAwait:!1,reference:!0})){if(Y)j7($,Z,G),Z.push(K);if(Q)xq(K,H)}return Z},Mq=async($,q)=>{return await Promise.allSettled([$]),q};var Cq=async({subprocess:$,options:{encoding:q,buffer:J,maxBuffer:X,lines:Z,timeoutDuration:H,cancelSignal:Q,gracefulCancel:Y,forceKillAfterDelay:G,stripFinalNewline:K,ipc:U,ipcInput:z},context:B,verboseInfo:L,fileDescriptors:_,originalStreams:P,onInternalError:M,controller:F})=>{let O=I5($,B),v={originalStreams:P,fileDescriptors:_,subprocess:$,exitPromise:O,propagating:!1},x=Tq({subprocess:$,encoding:q,buffer:J,maxBuffer:X,lines:Z,stripFinalNewline:K,verboseInfo:L,streamInfo:v}),I=kq({subprocess:$,encoding:q,buffer:J,maxBuffer:X,lines:Z,stripFinalNewline:K,verboseInfo:L,streamInfo:v}),N=[],c=jq({subprocess:$,buffer:J,maxBuffer:X,ipc:U,ipcOutput:N,verboseInfo:L}),B1=qU(P,$,v),L1=JU(_,v);try{return await Promise.race([Promise.all([{},E5(O),Promise.all(x),I,c,$7($,z),...B1,...L1]),M,XU($,F),...t8($,H,B,F),..._8({subprocess:$,cancelSignal:Q,gracefulCancel:Y,context:B,controller:F}),...n8({subprocess:$,cancelSignal:Q,gracefulCancel:Y,forceKillAfterDelay:G,context:B,controller:F})])}catch(q2){return B.terminationReason??="other",Promise.all([{error:q2},O,Promise.all(x.map((s1)=>M4(s1))),M4(I),Mq(c,N),Promise.allSettled(B1),Promise.allSettled(L1)])}},qU=($,q,J)=>$.map((X,Z)=>X===q.stdio[Z]?void 0:B0(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})=>B0(Q,X,q,{isSameDirection:d.has(Z),stopOnExit:Z==="native"}))),XU=async($,{signal:q})=>{let[J]=await $U($,"error",{signal:q});throw J};var wq=()=>({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 Iq}from"node:stream/promises";var I4=async($)=>{if($===void 0)return;try{await A4($)}catch{}},Aq=async($)=>{if($===void 0)return;try{await E4($)}catch{}},A4=async($)=>{await Iq($,{cleanup:!0,readable:!1,writable:!0})},E4=async($)=>{await Iq($,{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 Eq=({subprocess:$,concurrentStreams:q,encoding:J},{from:X,binary:Z=!0,preserveNewlines:H=!0}={})=>{let Q=Z||u.has(J),{subprocessStdout:Y,waitReadableDestroy:G}=y4($,X,q),{readableEncoding:K,readableObjectMode:U,readableHighWaterMark:z}=O4(Y,Q),{read:B,onStdoutDataDone:L}=N4({subprocessStdout:Y,subprocess:$,binary:Q,encoding:J,preserveNewlines:H}),_=new ZU({read:B,destroy:QU(v4.bind(void 0,{subprocessStdout:Y,subprocess:$,waitReadableDestroy:G})),highWaterMark:z,objectMode:U,encoding:K});return D4({subprocessStdout:Y,onStdoutDataDone:L,readable:_,subprocess:$}),_},y4=($,q,J)=>{let X=c1($,q),Z=L0(J,X,"readableDestroy");return{subprocessStdout:X,waitReadableDestroy:Z}},O4=({readableEncoding:$,readableObjectMode:q,readableHighWaterMark:J},X)=>X?{readableEncoding:$,readableObjectMode:q,readableHighWaterMark:J}:{readableEncoding:$,readableObjectMode:!0,readableHighWaterMark:j4},N4=({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{}},D4=async({subprocessStdout:$,onStdoutDataDone:q,readable:J,subprocess:X,subprocessStdin:Z})=>{try{if(await E4($),await X,await I4(Z),await q,J.readable)J.push(null)}catch(H){await I4(Z),yq(J,H)}},v4=async({subprocessStdout:$,subprocess:q,waitReadableDestroy:J},X)=>{if(await n1(J,q))yq($,X),await y$(q,X)},yq=($,q)=>{O$($,$.readable,q)};import{Writable as YU}from"node:stream";import{callbackify as Oq}from"node:util";var Nq=({subprocess:$,concurrentStreams:q},{to:J}={})=>{let{subprocessStdin:X,waitWritableFinal:Z,waitWritableDestroy:H}=h4($,J,q),Q=new YU({...f4(X,$,Z),destroy:Oq(b4.bind(void 0,{subprocessStdin:X,subprocess:$,waitWritableFinal:Z,waitWritableDestroy:H})),highWaterMark:X.writableHighWaterMark,objectMode:X.writableObjectMode});return S4(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}},f4=($,q,J)=>({write:GU.bind(void 0,$),final:Oq(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}},S4=async($,q,J)=>{try{if(await A4($),q.writable)q.end()}catch(X){await Aq(J),Dq(q,X)}},b4=async({subprocessStdin:$,subprocess:q,waitWritableFinal:J,waitWritableDestroy:X},Z)=>{if(await n1(J,q),await n1(X,q))Dq($,Z),await y$(q,Z)},Dq=($,q)=>{O$($,$.writable,q)};import{Duplex as UU}from"node:stream";import{callbackify as zU}from"node:util";var vq=({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}=y4($,X,q),{subprocessStdin:U,waitWritableFinal:z,waitWritableDestroy:B}=h4($,Z,q),{readableEncoding:L,readableObjectMode:_,readableHighWaterMark:P}=O4(G,Y),{read:M,onStdoutDataDone:F}=N4({subprocessStdout:G,subprocess:$,binary:Y,encoding:J,preserveNewlines:Q}),O=new UU({read:M,...f4(U,$,z),destroy:zU(BU.bind(void 0,{subprocessStdout:G,subprocessStdin:U,subprocess:$,waitReadableDestroy:K,waitWritableFinal:z,waitWritableDestroy:B})),readableHighWaterMark:P,writableHighWaterMark:U.writableHighWaterMark,readableObjectMode:_,writableObjectMode:U.writableObjectMode,encoding:L});return D4({subprocessStdout:G,onStdoutDataDone:F,readable:O,subprocess:$,subprocessStdin:U}),S4(U,O,G),O},BU=async({subprocessStdout:$,subprocessStdin:q,subprocess:J,waitReadableDestroy:X,waitWritableFinal:Z,waitWritableDestroy:H},Q)=>{await Promise.all([v4({subprocessStdout:$,subprocess:J,waitReadableDestroy:X},Q),b4({subprocessStdin:q,subprocess:J,waitWritableFinal:Z,waitWritableDestroy:H},Q)])};var g4=($,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=wq();$.readable=Eq.bind(void 0,{subprocess:$,concurrentStreams:J,encoding:q}),$.writable=Nq.bind(void 0,{subprocess:$,concurrentStreams:J}),$.duplex=vq.bind(void 0,{subprocess:$,concurrentStreams:J,encoding:q}),$.iterable=g4.bind(void 0,$,q),$[Symbol.asyncIterator]=g4.bind(void 0,$,q,{})};var fq=($,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 Sq=($,q,J,X)=>{let{file:Z,commandArguments:H,command:Q,escapedCommand:Y,startTime:G,verboseInfo:K,options:U,fileDescriptors:z}=TU($,q,J),{subprocess:B,promise:L}=kU({file:Z,commandArguments:H,options:U,startTime:G,verboseInfo:K,command:Q,escapedCommand:Y,fileDescriptors:z});return B.pipe=I$.bind(void 0,{source:B,sourcePromise:L,boundOptions:{},createNested:X}),fq(B,L),$1.set(B,{options:U,fileDescriptors:z}),B},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),z=l5(U,Q);return{file:Y,commandArguments:G,command:X,escapedCommand:Z,startTime:H,verboseInfo:Q,options:U,fileDescriptors:z}},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 c5({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];$q(G,Y,K),Qq(G,J,K);let z={},B=e();G.kill=V8.bind(void 0,{kill:G.kill.bind(G),options:J,onInternalError:B,context:z,controller:K}),G.all=Pq(G,J),hq(G,J),S5(G,J);let L=FU({subprocess:G,options:J,startTime:X,verboseInfo:Z,fileDescriptors:Y,originalStreams:U,command:H,escapedCommand:Q,context:z,onInternalError:B,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[z,[B,L],_,P,M]=await Cq({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(P,q,"all"),v=xU({errorInfo:z,exitCode:B,signal:L,stdio:F,all:O,ipcOutput:M,context:G,options:q,command:Q,escapedCommand:Y,startTime:J});return l1(v,X,q)},xU=({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,jU(X,$[X],Z)]));return{...$,...J}},jU=($,q,J)=>{if(MU.has($)&&E(q)&&E(J))return{...q,...J};return J},MU=new Set(["env",...T2]);var R1=($,q,J,X)=>{let Z=(Q,Y,G)=>R1(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?O5(Y,G,K):Sq(Y,G,K,Z)},wU=({mapArguments:$,firstArgument:q,nextArguments:J,deepOptions:X,boundOptions:Z})=>{let H=l3(q)?d3(q,J):[q,...J],[Q,Y,G]=j0(...H),K=N$(N$(X,Z),G),{file:U=Q,commandArguments:z=Y,options:B=K,isSync:L=!1}=$({file:Q,commandArguments:Y,options:K});return{file:U,commandArguments:z,options:B,isSync:L}};var bq=({file:$,commandArguments:q})=>cq($,q),gq=({file:$,commandArguments:q})=>({...cq($,q),isSync:!0}),cq=($,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 mq=($,q,J)=>{$.sync=q(EU,J),$.s=$.sync},uq=({options:$})=>pq($),EU=({options:$})=>({...pq($),isSync:!0}),pq=($)=>({options:{...yU($),...$}}),yU=({input:$,inputFile:q,stdio:J})=>$===void 0&&q===void 0&&J===void 0?{stdin:"inherit"}:{},lq={preferLocal:!0};var f=R1(()=>({})),xj=R1(()=>({isSync:!0})),jj=R1(bq),Mj=R1(gq),Cj=R1(r8),wj=R1(uq,{},lq,mq),{sendMessage:Ij,getOneMessage:Aj,getEachMessage:Ej,getCancelSignal:yj}=b5();import{access as dq,readFile as nq}from"fs/promises";import{join as c4,dirname as iq}from"path";async function D$(){if(process.env.IDF_PATH)try{return await dq(process.env.IDF_PATH),process.env.IDF_PATH}catch{}try{return await dq(U2),U2}catch{}return null}async function v$($){let q=c4($,"version.txt");try{return(await nq(q,"utf-8")).trim()}catch{}try{return(await f("git",["describe","--tags"],{cwd:$})).stdout.trim()}catch{}return null}async function aq(){let $=await D$();if(!$)return{installed:!1};let q=await v$($);return{installed:!0,path:$,version:q||void 0}}async function I1($){let q=c4($,"CMakeLists.txt");try{let J=await nq(q,"utf-8");return J.includes("$ENV{IDF_PATH}")||J.includes("idf_component_register")}catch{return!1}}async function J1($){let q=$;while(q!==iq(q)){if(await I1(q))return q;q=iq(q)}return null}function m4($){return c4($,"export.sh")}async function u4($,q,J={}){let{cwd:X,operationId:Z,env:H}=J,Q={cwd:X,env:{...process.env,...H},reject:!1};try{let Y=f($,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 ${m4(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=f(H,[],K);if(Y)U.stdout?.on("data",(B)=>{R.emit(Y,{type:"stdout",text:B.toString()})}),U.stderr?.on("data",(B)=>{R.emit(Y,{type:"stderr",text:B.toString()})});let z=await U;return{ok:!0,data:{stdout:String(z.stdout??""),stderr:String(z.stderr??""),exitCode:z.exitCode??0}}}catch(U){return{ok:!1,error:`Failed to execute ${$}: ${U}`}}}async function tq($,q,J={}){let X=await D$();if(!X)return null;let H=`source ${m4(X)} > /dev/null 2>&1 && ${$} ${q.join(" ")}`,{cwd:Q,operationId:Y,env:G,interactive:K}=J,U=f(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",(B)=>{R.emit(Y,{type:"stdout",text:B.toString()})}),U.stderr?.on("data",(B)=>{R.emit(Y,{type:"stderr",text:B.toString()})});let z=U.then(()=>{});return{proc:U,promise:z}}import{homedir as OU}from"os";import{join as NU}from"path";import{readFile as DU,appendFile as vU,access as dj}from"fs/promises";function oq(){let $=process.env.SHELL||"";if($.includes("zsh"))return"zsh";if($.includes("bash"))return"bash";if($.includes("fish"))return"fish";return"unknown"}function h$(){let $=oq(),q=v3[$]||"",J=q?NU(OU(),q):"";return{type:$,configPath:J}}async function hU($){let{configPath:q}=h$();if(!q)return!1;try{return(await DU(q,"utf-8")).includes($)}catch{return!1}}async function rq($){let{configPath:q,type:J}=h$();if(!q)return{ok:!1,error:`Unsupported shell: ${J}`};if(await hU($))return{ok:!0,data:void 0};try{return await vU(q,`
|
|
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,`
|
|
70
70
|
${$}
|
|
71
|
-
`),{ok:!0,data:void 0}}catch(Z){return{ok:!1,error:`Failed to modify ${q}: ${Z}`}}}function sq($){if(oq()==="fish")return`source ${$}/export.fish`;return`. ${$}/export.sh`}import{mkdir as fU,access as SU}from"fs/promises";import{join as bU}from"path";async function eq($={},q){let J=q||j(),X=$.path||x0,Z=$.target||"all",H=$.addToShell??!0,Q=bU(X,"esp-idf");try{await SU(Q);let B=await v$(Q);return R.emit(J,{type:"log",level:"info",message:`ESP-IDF already installed at ${Q}`}),{ok:!0,data:{idfPath:Q,version:B||"unknown",addedToShell:!1}}}catch{}R.emit(J,{type:"progress",message:"Creating ESP directory..."});try{await fU(X,{recursive:!0})}catch(B){return{ok:!1,error:`Failed to create directory: ${B}`}}R.emit(J,{type:"progress",message:"Cloning ESP-IDF repository...",percent:10});let Y=await u4("git",["clone","--recursive",O3],{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 u4("./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 B=sq(Q),L=await rq(B);if(L.ok)U=!0;else R.emit(J,{type:"log",level:"warn",message:L.error})}let z=await v$(Q);return R.emit(J,{type:"complete",result:{idfPath:Q,version:z,addedToShell:U}}),{ok:!0,data:{idfPath:Q,version:z||"unknown",addedToShell:U}}}import{stripVTControlCharacters as q3}from"node:util";var S=o(l4(),1),LJ=o(A1(),1);import{stdin as zJ,stdout as BJ}from"node:process";import*as T1 from"node:readline";import XJ 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 VJ($){if(typeof $!="string")throw TypeError(`Expected a \`string\`, got \`${typeof $}\``);return $.replace(iU,"")}function WJ($){return $&&$.__esModule&&Object.prototype.hasOwnProperty.call($,"default")?$.default:$}var _J={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],z=q.length(U);if(Y>=Z-(z==2?1:0))if(Y+z<=H)Q+=U;else break;Y+=z}return Q}})(_J);var nU=_J.exports,aU=WJ(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=WJ(tU);function V0($,q={}){if(typeof $!="string"||$.length===0||(q={ambiguousIsNarrow:!0,...q},$=VJ($),$.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 i4=10,ZJ=($=0)=>(q)=>`\x1B[${q+$}m`,QJ=($=0)=>(q)=>`\x1B[${38+$};5;${q}m`,HJ=($=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=ZJ(),C.color.ansi256=QJ(),C.color.ansi16m=HJ(),C.bgColor.ansi=ZJ(i4),C.bgColor.ansi256=QJ(i4),C.bgColor.ansi16m=HJ(i4),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 $z=eU(),c$=new Set(["\x1B",""]),qz=39,t4="\x07",RJ="[",Jz="]",TJ="m",o4=`${Jz}8;;`,YJ=($)=>`${c$.values().next().value}${RJ}${$}${TJ}`,GJ=($)=>`${c$.values().next().value}${o4}${$}${t4}`,Xz=($)=>$.split(" ").map((q)=>V0(q)),n4=($,q,J)=>{let X=[...q],Z=!1,H=!1,Q=V0(VJ($[$.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(o4)),Z){H?G===t4&&(Z=!1,H=!1):G===TJ&&(Z=!1);continue}Q+=K,Q===J&&Y<X.length-1&&($.push(""),Q=0)}!Q&&$[$.length-1].length>0&&$.length>1&&($[$.length-2]+=$.pop())},Zz=($)=>{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("")},Qz=($,q,J={})=>{if(J.trim!==!1&&$.trim()==="")return"";let X="",Z,H,Q=Xz($),Y=[""];for(let[K,U]of $.split(" ").entries()){J.trim!==!1&&(Y[Y.length-1]=Y[Y.length-1].trimStart());let z=V0(Y[Y.length-1]);if(K!==0&&(z>=q&&(J.wordWrap===!1||J.trim===!1)&&(Y.push(""),z=0),(z>0||J.trim===!1)&&(Y[Y.length-1]+=" ",z++)),J.hard&&Q[K]>q){let B=q-z,L=1+Math.floor((Q[K]-B-1)/q);Math.floor((Q[K]-1)/q)<L&&Y.push(""),n4(Y,U,q);continue}if(z+Q[K]>q&&z>0&&Q[K]>0){if(J.wordWrap===!1&&z<q){n4(Y,U,q);continue}Y.push("")}if(z+Q[K]>q&&J.wordWrap===!1){n4(Y,U,q);continue}Y[Y.length-1]+=U}J.trim!==!1&&(Y=Y.map((K)=>Zz(K)));let G=[...Y.join(`
|
|
72
|
-
`)];for(let[K,U]of G.entries()){if(X+=U,c$.has(U)){let{groups:
|
|
73
|
-
`?(H&&(X+=
|
|
74
|
-
`&&(Z&&
|
|
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,`
|
|
75
75
|
`).split(`
|
|
76
|
-
`).map((X)=>
|
|
77
|
-
`)}var
|
|
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(`
|
|
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
|
|
80
|
-
`),b$(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let $=
|
|
81
|
-
`).length-1;this.output.write(S.cursor.move(-999,$*-1))}render(){let $=
|
|
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(`
|
|
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
|
|
85
|
-
${
|
|
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
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
87
|
${W.default.yellow(w)} ${X}
|
|
88
88
|
${W.default.yellow(t1)} ${W.default.yellow(this.error)}
|
|
89
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
90
|
${W.default.gray(w)}`:""}`;default:return`${q}${W.default.cyan(w)} ${X}
|
|
91
91
|
${W.default.cyan(t1)}
|
|
92
|
-
`}}}).prompt();var
|
|
93
|
-
${
|
|
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
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(
|
|
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
96
|
${W.default.cyan(t1)}
|
|
97
|
-
`}}}).prompt()},
|
|
98
|
-
${
|
|
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
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)} ${
|
|
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
101
|
${W.default.cyan(w)} `)}
|
|
102
102
|
${W.default.cyan(t1)}
|
|
103
|
-
`}}}).prompt()};var
|
|
103
|
+
`}}}).prompt()};var IJ=($="",q="")=>{let J=`
|
|
104
104
|
${$}
|
|
105
105
|
`.split(`
|
|
106
|
-
`),X=
|
|
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
107
|
`);process.stdout.write(`${W.default.gray(w)}
|
|
108
|
-
${W.default.green(
|
|
108
|
+
${W.default.green(H3)} ${W.default.reset(q)} ${W.default.gray(FJ.repeat(Math.max(Z-X-1,1))+RB)}
|
|
109
109
|
${H}
|
|
110
|
-
${W.default.gray(
|
|
110
|
+
${W.default.gray(TB+FJ.repeat(Z+2)+PB)}
|
|
111
111
|
`)},o1=($="")=>{process.stdout.write(`${W.default.gray(t1)} ${W.default.red($)}
|
|
112
112
|
|
|
113
|
-
`)},
|
|
114
|
-
`)},
|
|
113
|
+
`)},AJ=($="")=>{process.stdout.write(`${W.default.gray(_B)} ${$}
|
|
114
|
+
`)},EJ=($="")=>{process.stdout.write(`${W.default.gray(w)}
|
|
115
115
|
${W.default.gray(t1)} ${$}
|
|
116
116
|
|
|
117
|
-
`)};var
|
|
118
|
-
`);let
|
|
119
|
-
`);process.stdout.write(u$.cursor.move(-999,
|
|
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
|
|
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)}
|
|
121
121
|
`):process.stdout.write(`${N} ${Y}
|
|
122
|
-
`),_(),Z()};return{start:O,stop:v,message:(
|
|
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}
|
|
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=
|
|
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)
|
|
126
127
|
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
|
127
128
|
project(${$})
|
|
128
|
-
`}function
|
|
129
|
+
`}function gJ($){return`idf_component_register(SRCS "${$}"
|
|
129
130
|
INCLUDE_DIRS ".")
|
|
130
|
-
`}function
|
|
131
|
+
`}function cJ($){return`#include <stdio.h>
|
|
131
132
|
#include "freertos/FreeRTOS.h"
|
|
132
133
|
#include "freertos/task.h"
|
|
133
134
|
|
|
@@ -138,7 +139,7 @@ void app_main(void)
|
|
|
138
139
|
vTaskDelay(pdMS_TO_TICKS(1000));
|
|
139
140
|
}
|
|
140
141
|
}
|
|
141
|
-
`}function
|
|
142
|
+
`}function mJ($){return`#include <cstdio>
|
|
142
143
|
#include "freertos/FreeRTOS.h"
|
|
143
144
|
#include "freertos/task.h"
|
|
144
145
|
|
|
@@ -149,13 +150,13 @@ extern "C" void app_main(void)
|
|
|
149
150
|
vTaskDelay(pdMS_TO_TICKS(1000));
|
|
150
151
|
}
|
|
151
152
|
}
|
|
152
|
-
`}function
|
|
153
|
+
`}function uJ(){return`build/
|
|
153
154
|
sdkconfig
|
|
154
155
|
sdkconfig.old
|
|
155
156
|
*.pyc
|
|
156
157
|
__pycache__/
|
|
157
158
|
.DS_Store
|
|
158
|
-
`}function
|
|
159
|
+
`}function pJ($,q){return`# ${$}
|
|
159
160
|
|
|
160
161
|
ESP-IDF project targeting ${q}.
|
|
161
162
|
|
|
@@ -176,7 +177,7 @@ idf.py -p PORT flash
|
|
|
176
177
|
\`\`\`bash
|
|
177
178
|
idf.py -p PORT monitor
|
|
178
179
|
\`\`\`
|
|
179
|
-
`}function
|
|
180
|
+
`}function lJ(){return`{
|
|
180
181
|
"version": 4,
|
|
181
182
|
"configurations": [
|
|
182
183
|
{
|
|
@@ -202,9 +203,9 @@ idf.py -p PORT monitor
|
|
|
202
203
|
}
|
|
203
204
|
]
|
|
204
205
|
}
|
|
205
|
-
`}function
|
|
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}
|
|
206
208
|
Language: ${X.toUpperCase()}
|
|
207
209
|
Target: ${Z}
|
|
208
|
-
Path: ${H.directory}/${H.name}`,"Project Configuration"),!await g("Create project?")){n$("Cancelled");return}let Y=d$();Y.start("Creating project...");let G=
|
|
209
|
-
`),H=null,Q="",Y="";for(let G of Z)if(G.startsWith("/dev/")){if(H){let K=aJ(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=aJ(H,Q,Y);if(G)X.push(G)}return await tz(q,X)}catch{return[]}}function aJ($,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=nz(Z),Y=az(Z,H);return{port:$,connectionType:Q,vendorId:Z,productId:H,manufacturer:z2[Z||""]?.name,chip:Y,description:q!=="n/a"?q:void 0}}function nz($){if(!$)return"unknown";return $.toUpperCase()===iz?"native-usb":"uart-bridge"}function az($,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 tz($,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 oz($,X.port);return{...X,espChip:H}}return X}))}async function oz($,q){try{let{stdout:J,stderr:X}=await f($,["-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 P1(){try{return{ok:!0,data:await r$()}}catch($){return{ok:!1,error:`Failed to list devices: ${$}`}}}var b=o(A1(),1);function rz($){return $.replace(/\x1b\[[0-9;]*m/g,"")}function tJ($){return rz($).length}function sz($,q){let J=$.map((K,U)=>{let z=Math.max(...q.map((B)=>tJ(B[U]||"")));return Math.max(K.length,z)}),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 z=tJ(K),B=U-z;return K+" ".repeat(Math.max(0,B))},G=(K)=>"│"+K.map((U,z)=>` ${Y(U||"",J[z])} `).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 oJ($){if($.length===0){console.log(b.default.dim("No devices found"));return}let q=["Port","Type","Chip","ESP"],J=$.map((H)=>{let Q=ez(H.connectionType),Y=H.espChip||(H.connectionType==="native-usb"?"?":"-");return[H.port,Q,H.chip||"-",Y]});sz(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 ez($){switch($){case"native-usb":return b.default.magenta("USB");case"uart-bridge":return b.default.cyan("UART");default:return b.default.dim("?")}}async function rJ(){V.info("Scanning for devices...");let $=await P1();if(!$.ok)V.error($.error),process.exit(1);V.newline(),oJ($.data),V.newline()}async function s$($,q){let J=q||j(),{projectDir:X,target:Z,clean:H}=$;if(!await I1(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 sJ($){let q=await J1(process.cwd());if(!q)V.error("Not in an ESP-IDF project directory"),process.exit(1);let J=j();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 s$({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 e$($,q){let J=q||j(),{projectDir:X,port:Z,baud:H=O1}=$;if(!await I1(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}}}import{readFile as $B,writeFile as qB,access as JB}from"fs/promises";import{join as eJ}from"path";var $X="espcli.json";async function y1($){let q=eJ($,$X);try{await JB(q);let J=await $B(q,"utf-8");return JSON.parse(J)}catch{return{}}}async function XB($,q){let J=eJ($,$X);try{let X=JSON.stringify(q,null,2)+`
|
|
210
|
-
`;return await qB(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 y1($),...q},Z=await XB($,X);if(!Z.ok)return Z;return{ok:!0,data:X}}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 y1(q),X=await P1();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 z1(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 z1(X.data),H=Z1(X.data,Z)}}let Q=$.baud||J.flashBaud||O1;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=j();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 e$({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 G3=new Map;async function $2($,q){let J=q||j(),{port:X,baud:Z=N1,projectDir:H}=$,Q=["-p",X,"-b",String(Z),"monitor"],Y=await tq("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 G3.set(J,G),K.then(()=>{G3.delete(J),R.emit(J,{type:"complete",result:{stopped:!0}})}),{ok:!0,data:{operationId:J,stop:()=>{G.kill("SIGTERM"),G3.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 y1(q),X=await P1();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 z1(X.data),H=Z1(X.data,Z);if(H){let G=vJ(H);if(!G.ok&&G.warning){if(V.warn(G.warning),!await g("Continue with this port?",!1))Z=await z1(X.data)}}let Q=$.baud||J.monitorBaud||N1;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 $2({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||j(),{projectDir:X,full:Z}=$;if(!await I1(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=j();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 y1(q),X=await P1();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 z1(X.data),H=Z1(X.data,Z);if(H){let B=p$(H);if(!B.ok&&B.warning){if(V.warn(B.warning),!await g("Continue with this port?",!1))Z=await z1(X.data)}}let Q=$.baud||J.flashBaud||O1,Y=J.monitorBaud||N1;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=(B)=>{if(B.data.type==="stdout"||B.data.type==="stderr")V.output(B.data.text)};if(!$.skipBuild){let B=j();R.subscribe(B,G),V.step("Building...");let L=await s$({projectDir:q},B);if(!L.ok)V.newline(),V.error(L.error),process.exit(1);V.newline(),V.success("Build complete")}let K=j();R.subscribe(K,G),V.step(`Flashing to ${Z} at ${Q} baud...`);let U=await e$({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 z=await $2({port:Z,baud:Y,projectDir:q});if(!z.ok)V.error(z.error),process.exit(1);await z.data.wait(),V.newline(),V.info("Monitor stopped")}var h=o(A1(),1);async function HX(){V.info("Checking system health..."),V.newline();let $=await Y3();if(P0($.python),P0($.git),P0($.idf),P0($.pyserial),P0($.esptool),V.newline(),await ZB(),V.newline(),$.python.ok&&$.git.ok&&$.idf.ok&&$.pyserial.ok&&$.esptool.ok)console.log(h.default.green("✓ All checks passed! Ready for ESP32 development."));else console.log(h.default.yellow("⚠ Some checks failed. See hints above to fix issues."));V.newline()}function P0($){let q=$.ok?h.default.green("✓"):h.default.red("✗"),J=$.name.padEnd(10),X=$.version?h.default.dim(`v${$.version}`):"",Z=$.path?h.default.dim(` (${$.path})`):"";if($.ok)console.log(` ${q} ${h.default.bold(J)} ${X}${Z}`);else if(console.log(` ${q} ${h.default.bold(J)} ${h.default.red($.error||"Not found")}`),$.hint)console.log(` ${h.default.dim("→")} ${h.default.yellow($.hint)}`)}async function ZB(){console.log(h.default.bold(" Devices:"));try{let $=await r$();if($.length===0)console.log(` ${h.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(` ${h.default.green("•")} ${q.port} ${h.default.dim(`(${J} via ${X})`)}`)}}catch{console.log(` ${h.default.dim("Could not check devices")}`)}}function YX(){let $=new I3;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(iJ),$.command("devices").alias("ports").description("List connected ESP devices").action(rJ),$.command("build").description("Build the current project").option("-t, --target <target>","Set target before build").option("-c, --clean","Clean before build").action(sJ),$.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 QB=YX();QB.parse();
|
|
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();
|