espcli 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +106 -81
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,128 +1,128 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as $X}from"node:module";var oJ=Object.create;var{getPrototypeOf:rJ,defineProperty:J3,getOwnPropertyNames:sJ}=Object;var eJ=Object.prototype.hasOwnProperty;var t=($,q,J)=>{J=$!=null?oJ(rJ($)):{};let X=q||!$||!$.__esModule?J3(J,"default",{value:$,enumerable:!0}):J;for(let Z of sJ($))if(!eJ.call(X,Z))J3(X,Z,{get:()=>$[Z],enumerable:!0});return X};var A=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports);var c=$X(import.meta.url);var n1=A((qX)=>{class i$ 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 X3 extends i${constructor($){super(1,"commander.invalidArgument",$);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}qX.CommanderError=i$;qX.InvalidArgumentError=X3});var _0=A((HX)=>{var{InvalidArgumentError:ZX}=n1();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 ZX(`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 QX($){let q=$.name()+($.variadic===!0?"...":"");return $.required?"<"+q+">":"["+q+"]"}HX.Argument=Z3;HX.humanReadableArgName=QX});var n$=A((UX)=>{var{humanReadableArgName:KX}=_0();class Q3{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)=>KX(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,z){return q.formatItem(U,J,z,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,z)=>{let B=U.map((L)=>{return Z(q.styleOptionTerm(q.optionTerm(L)),q.styleOptionDescription(q.optionDescription(L)))});H=H.concat(this.formatItemList(z,B,q))}),q.showGlobalOptions){let U=q.visibleGlobalOptions($).map((z)=>{return Z(q.styleOptionTerm(q.optionTerm(z)),q.styleOptionDescription(q.optionDescription(z)))});H=H.concat(this.formatItemList("Global Options:",U,q))}return this.groupItems($.commands,q.visibleCommands($),(U)=>U.helpGroup()||"Commands:").forEach((U,z)=>{let B=U.map((L)=>{return Z(q.styleSubcommandTerm(q.subcommandTerm(L)),q.styleSubcommandDescription(q.subcommandDescription(L)))});H=H.concat(this.formatItemList(z,B,q))}),H.join(`
2
+ import{createRequire as JX}from"node:module";var sJ=Object.create;var{getPrototypeOf:eJ,defineProperty:J3,getOwnPropertyNames:$X}=Object;var qX=Object.prototype.hasOwnProperty;var t=($,q,J)=>{J=$!=null?sJ(eJ($)):{};let X=q||!$||!$.__esModule?J3(J,"default",{value:$,enumerable:!0}):J;for(let Z of $X($))if(!qX.call(X,Z))J3(X,Z,{get:()=>$[Z],enumerable:!0});return X};var A=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports);var c=JX(import.meta.url);var n1=A((XX)=>{class n$ 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 X3 extends n${constructor($){super(1,"commander.invalidArgument",$);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}XX.CommanderError=n$;XX.InvalidArgumentError=X3});var V0=A((GX)=>{var{InvalidArgumentError:HX}=n1();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 HX(`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 YX($){let q=$.name()+($.variadic===!0?"...":"");return $.required?"<"+q+">":"["+q+"]"}GX.Argument=Z3;GX.humanReadableArgName=YX});var a$=A((BX)=>{var{humanReadableArgName:zX}=V0();class Q3{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)=>zX(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,z){return q.formatItem(U,J,z,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,z)=>{let B=U.map((L)=>{return Z(q.styleOptionTerm(q.optionTerm(L)),q.styleOptionDescription(q.optionDescription(L)))});H=H.concat(this.formatItemList(z,B,q))}),q.showGlobalOptions){let U=q.visibleGlobalOptions($).map((z)=>{return Z(q.styleOptionTerm(q.optionTerm(z)),q.styleOptionDescription(q.optionDescription(z)))});H=H.concat(this.formatItemList("Global Options:",U,q))}return this.groupItems($.commands,q.visibleCommands($),(U)=>U.helpGroup()||"Commands:").forEach((U,z)=>{let B=U.map((L)=>{return Z(q.styleSubcommandTerm(q.subcommandTerm(L)),q.styleSubcommandDescription(q.subcommandDescription(L)))});H=H.concat(this.formatItemList(z,B,q))}),H.join(`
3
3
  `)}displayWidth($){return H3($).length}styleTitle($){return $}styleUsage($){return $.split(" ").map((q)=>{if(q==="[options]")return this.styleOptionText(q);if(q==="[command]")return this.styleSubcommandText(q);if(q[0]==="["||q[0]==="<")return this.styleArgumentText(q);return this.styleCommandText(q)}).join(" ")}styleCommandDescription($){return this.styleDescriptionText($)}styleOptionDescription($){return this.styleDescriptionText($)}styleSubcommandDescription($){return this.styleDescriptionText($)}styleArgumentDescription($){return this.styleDescriptionText($)}styleDescriptionText($){return $}styleOptionTerm($){return this.styleOptionText($)}styleSubcommandTerm($){return $.split(" ").map((q)=>{if(q==="[options]")return this.styleOptionText(q);if(q[0]==="["||q[0]==="<")return this.styleArgumentText(q);return this.styleSubcommandText(q)}).join(" ")}styleArgumentTerm($){return this.styleArgumentText($)}styleOptionText($){return $}styleArgumentText($){return $}styleSubcommandText($){return $}styleCommandText($){return $}padWidth($,q){return Math.max(q.longestOptionTermLength($,q),q.longestGlobalOptionTermLength($,q),q.longestSubcommandTermLength($,q),q.longestArgumentTermLength($,q))}preformatted($){return/\n[^\S\r\n]/.test($)}formatItem($,q,J,X){let H=" ".repeat(2);if(!J)return H+$;let Q=$.padEnd(q+$.length-X.displayWidth($)),Y=2,K=(this.helpWidth??80)-q-Y-2,U;if(K<this.minWidthToWrap||X.preformatted(J))U=J;else U=X.boxWrap(J,K).replace(/\n/g,`
4
4
  `+" ".repeat(q+Y));return H+Q+" ".repeat(Y)+U.replace(/\n/g,`
5
5
  ${H}`)}boxWrap($,q){if(q<this.minWidthToWrap)return $;let J=$.split(/\r\n|\n/),X=/[\s]*[^\s]+/g,Z=[];return J.forEach((H)=>{let Q=H.match(X);if(Q===null){Z.push("");return}let Y=[Q.shift()],G=this.displayWidth(Y[0]);Q.forEach((K)=>{let U=this.displayWidth(K);if(G+U<=q){Y.push(K),G+=U;return}Z.push(Y.join(""));let z=K.trimStart();Y=[z],G=this.displayWidth(z)}),Z.push(Y.join(""))}),Z.join(`
6
- `)}}function H3($){let q=/\x1b\[\d*(;\d*)*m/g;return $.replace(q,"")}UX.Help=Q3;UX.stripColor=H3});var a$=A((VX)=>{var{InvalidArgumentError:LX}=n1();class G3{constructor($,q){this.flags=$,this.description=q||"",this.required=$.includes("<"),this.optional=$.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test($),this.mandatory=!1;let J=_X($);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 LX(`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 Y3(this.name().replace(/^no-/,""));return Y3(this.name())}helpGroup($){return this.helpGroupHeading=$,this}is($){return this.short===$||this.long===$}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class K3{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 Y3($){return $.split("-").reduce((q,J)=>{return q+J[0].toUpperCase()+J.slice(1)})}function _X($){let q,J,X=/^-[^-]$/,Z=/^--[^-]/,H=$.split(/[ |,]+/).concat("guard");if(X.test(H[0]))q=H.shift();if(Z.test(H[0]))J=H.shift();if(!q&&X.test(H[0]))q=H.shift();if(!q&&Z.test(H[0]))q=J,J=H.shift();if(H[0].startsWith("-")){let Q=H[0],Y=`option creation failed due to '${Q}' in option flags '${$}'`;if(/^-[^-][^-]/.test(Q))throw Error(`${Y}
6
+ `)}}function H3($){let q=/\x1b\[\d*(;\d*)*m/g;return $.replace(q,"")}BX.Help=Q3;BX.stripColor=H3});var t$=A((RX)=>{var{InvalidArgumentError:WX}=n1();class G3{constructor($,q){this.flags=$,this.description=q||"",this.required=$.includes("<"),this.optional=$.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test($),this.mandatory=!1;let J=_X($);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 WX(`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 Y3(this.name().replace(/^no-/,""));return Y3(this.name())}helpGroup($){return this.helpGroupHeading=$,this}is($){return this.short===$||this.long===$}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class K3{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 Y3($){return $.split("-").reduce((q,J)=>{return q+J[0].toUpperCase()+J.slice(1)})}function _X($){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}}VX.Option=G3;VX.DualOptions=K3});var U3=A((kX)=>{function TX($,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 PX($,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=TX($,Q),G=Math.max($.length,Q.length);if((G-Y)/G>H){if(Y<Z)Z=Y,X=[Q];else if(Y===Z)X.push(Q)}}),X.sort((Q,Y)=>Q.localeCompare(Y)),J)X=X.map((Q)=>`--${Q}`);if(X.length>1)return`
12
+ - unrecognised flag format`)}if(q===void 0&&J===void 0)throw Error(`option creation failed due to no flags found in '${$}'.`);return{shortFlag:q,longFlag:J}}RX.Option=G3;RX.DualOptions=K3});var U3=A((xX)=>{function kX($,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 FX($,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=kX($,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""}kX.suggestSimilar=PX});var _3=A((AX)=>{var xX=c("node:events").EventEmitter,t$=c("node:child_process"),X1=c("node:path"),V0=c("node:fs"),k=c("node:process"),{Argument:jX,humanReadableArgName:MX}=_0(),{CommanderError:o$}=n1(),{Help:CX,stripColor:IX}=n$(),{Option:z3,DualOptions:wX}=a$(),{suggestSimilar:B3}=U3();class s$ extends xX{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:()=>r$()??(k.stdout.isTTY&&k.stdout.hasColors?.()),getErrHasColors:()=>r$()??(k.stderr.isTTY&&k.stderr.hasColors?.()),stripColor:(q)=>IX(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 s$($)}createHelp(){return Object.assign(new CX,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 jX($,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 o$($,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 z3($,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}'
14
+ (Did you mean ${X[0]}?)`;return""}xX.suggestSimilar=FX});var V3=A((yX)=>{var MX=c("node:events").EventEmitter,o$=c("node:child_process"),X1=c("node:path"),W0=c("node:fs"),k=c("node:process"),{Argument:CX,humanReadableArgName:IX}=V0(),{CommanderError:r$}=n1(),{Help:wX,stripColor:AX}=a$(),{Option:z3,DualOptions:EX}=t$(),{suggestSimilar:B3}=U3();class e$ extends MX{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:()=>s$()??(k.stdout.isTTY&&k.stdout.hasColors?.()),getErrHasColors:()=>s$()??(k.stderr.isTTY&&k.stderr.hasColors?.()),stripColor:(q)=>AX(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 e$($)}createHelp(){return Object.assign(new wX,this.configureHelp())}configureHelp($){if($===void 0)return this._helpConfiguration;return this._helpConfiguration=$,this}configureOutput($){if($===void 0)return this._outputConfiguration;return this._outputConfiguration={...this._outputConfiguration,...$},this}showHelpAfterError($=!0){if(typeof $!=="string")$=!!$;return this._showHelpAfterError=$,this}showSuggestionAfterError($=!0){return this._showSuggestionAfterError=!!$,this}addCommand($,q){if(!$._name)throw Error(`Command passed to .addCommand() must have a name
15
+ - specify the name in Command constructor or using .name()`);if(q=q||{},q.isDefault)this._defaultCommandName=$._name;if(q.noHelp||q.hidden)$._hidden=!0;return this._registerCommand($),$.parent=this,$._checkForBrokenPassThrough(),this}createArgument($,q){return new CX($,q)}argument($,q,J,X){let Z=this.createArgument($,q);if(typeof J==="function")Z.default(X).argParser(J);else Z.default(J);return this.addArgument(Z),this}arguments($){return $.trim().split(/ +/).forEach((q)=>{this.argument(q)}),this}addArgument($){let q=this.registeredArguments.slice(-1)[0];if(q?.variadic)throw Error(`only the last argument can be variadic '${q.name()}'`);if($.required&&$.defaultValue!==void 0&&$.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${$.name()}'`);return this.registeredArguments.push($),this}helpCommand($,q){if(typeof $==="boolean"){if(this._addImplicitHelpCommand=$,$&&this._defaultCommandGroup)this._initCommandGroup(this._getHelpCommand());return this}let J=$??"help [command]",[,X,Z]=J.match(/([^ ]+) *(.*)/),H=q??"display help for command",Q=this.createCommand(X);if(Q.helpOption(!1),Z)Q.arguments(Z);if(H)Q.description(H);if(this._addImplicitHelpCommand=!0,this._helpCommand=Q,$||q)this._initCommandGroup(Q);return this}addHelpCommand($,q){if(typeof $!=="object")return this.helpCommand($,q),this;return this._addImplicitHelpCommand=!0,this._helpCommand=$,this._initCommandGroup($),this}_getHelpCommand(){if(this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))){if(this._helpCommand===void 0)this.helpCommand(void 0,void 0);return this._helpCommand}return null}hook($,q){let J=["preSubcommand","preAction","postAction"];if(!J.includes($))throw Error(`Unexpected value for event passed to hook : '${$}'.
16
+ Expecting one of '${J.join("', '")}'`);if(this._lifeCycleHooks[$])this._lifeCycleHooks[$].push(q);else this._lifeCycleHooks[$]=[q];return this}exitOverride($){if($)this._exitCallback=$;else this._exitCallback=(q)=>{if(q.code!=="commander.executeSubCommandAsync")throw q};return this}_exit($,q,J){if(this._exitCallback)this._exitCallback(new r$($,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 z3($,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
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 z3)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let H=this.createOption(q,J);if(H.makeOptionMandatory(!!$.mandatory),typeof X==="function")H.default(Z).argParser(X);else if(X instanceof RegExp){let Q=X;X=(Y,G)=>{let K=Q.exec(Y);return K?K[0]:G},H.default(Z).argParser(X)}else H.default(X);return this.addOption(H)}option($,q,J,X){return this._optionEx({},$,q,J,X)}requiredOption($,q,J,X){return this._optionEx({mandatory:!0},$,q,J,X)}combineFlagAndOptionalValue($=!0){return this._combineFlagAndOptionalValue=!!$,this}allowUnknownOption($=!0){return this._allowUnknownOption=!!$,this}allowExcessArguments($=!0){return this._allowExcessArguments=!!$,this}enablePositionalOptions($=!0){return this._enablePositionalOptions=!!$,this}passThroughOptions($=!0){return this._passThroughOptions=!!$,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties($=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!$,this}getOptionValue($){if(this._storeOptionsAsProperties)return this[$];return this._optionValues[$]}setOptionValue($,q){return this.setOptionValueWithSource($,q,void 0)}setOptionValueWithSource($,q,J){if(this._storeOptionsAsProperties)this[$]=q;else this._optionValues[$]=q;return this._optionValueSources[$]=J,this}getOptionValueSource($){return this._optionValueSources[$]}getOptionValueSourceWithGlobals($){let q;return this._getCommandAndAncestors().forEach((J)=>{if(J.getOptionValueSource($)!==void 0)q=J.getOptionValueSource($)}),q}_prepareUserArgs($,q){if($!==void 0&&!Array.isArray($))throw Error("first parameter to parse must be array or undefined");if(q=q||{},$===void 0&&q.from===void 0){if(k.versions?.electron)q.from="electron";let X=k.execArgv??[];if(X.includes("-e")||X.includes("--eval")||X.includes("-p")||X.includes("--print"))q.from="eval"}if($===void 0)$=k.argv;this.rawArgs=$.slice();let J;switch(q.from){case void 0:case"node":this._scriptPath=$[1],J=$.slice(2);break;case"electron":if(k.defaultApp)this._scriptPath=$[1],J=$.slice(2);else J=$.slice(1);break;case"user":J=$.slice(0);break;case"eval":J=$.slice(1);break;default:throw Error(`unexpected parse option { from: '${q.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",J}parse($,q){this._prepareForParse();let J=this._prepareUserArgs($,q);return this._parseCommand([],J),this}async parseAsync($,q){this._prepareForParse();let J=this._prepareUserArgs($,q);return await this._parseCommand([],J),this}_prepareForParse(){if(this._savedState===null)this.saveStateBeforeParse();else this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
18
- - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable($,q,J){if(V0.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
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(W0.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 z=X1.resolve(K,U);if(V0.existsSync(z))return z;if(X.includes(X1.extname(U)))return;let B=X.find((L)=>V0.existsSync(`${z}${L}`));if(B)return`${z}${B}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let H=$._executableFile||`${this._name}-${$._name}`,Q=this._executableDir||"";if(this._scriptPath){let K;try{K=V0.realpathSync(this._scriptPath)}catch{K=this._scriptPath}Q=X1.resolve(X1.dirname(K),Q)}if(Q){let K=Z(Q,H);if(!K&&!$._executableFile&&this._scriptPath){let U=X1.basename(this._scriptPath,X1.extname(this._scriptPath));if(U!==this._name)K=Z(Q,`${U}-${$._name}`)}H=K||H}J=X.includes(X1.extname(H));let Y;if(k.platform!=="win32")if(J)q.unshift(H),q=L3(k.execArgv).concat(q),Y=t$.spawn(k.argv[0],q,{stdio:"inherit"});else Y=t$.spawn(H,q,{stdio:"inherit"});else this._checkForMissingExecutable(H,Q,$._name),q.unshift(H),q=L3(k.execArgv).concat(q),Y=t$.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 o$(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 o$(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((z)=>z.short).some((z)=>/^-\d$/.test(z)))},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 z=$[G++];if(z===void 0)this.optionMissingArgument(U);this.emit(`option:${U.name()}`,z)}else if(U.optional){let z=null;if(G<$.length&&(!Z($[G])||H($[G])))z=$[G++];this.emit(`option:${U.name()}`,z)}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("="),z=this._findOption(K.slice(0,U));if(z&&(z.required||z.optional)){this.emit(`option:${z.name()}`,K.slice(U+1));continue}}if(X===q&&Z(K)&&!(this.commands.length===0&&H(K)))X=J;if((this._enablePositionalOptions||this._passThroughOptions)&&q.length===0&&J.length===0){if(this._findCommand(K)){q.push(K),J.push(...$.slice(G));break}else if(this._getHelpCommand()&&K===this._getHelpCommand().name()){q.push(K,...$.slice(G));break}else if(this._defaultCommandName){J.push(K,...$.slice(G));break}}if(this._passThroughOptions){X.push(K,...$.slice(G));break}X.push(K)}return{operands:q,unknown:J}}opts(){if(this._storeOptionsAsProperties){let $={},q=this.options.length;for(let J=0;J<q;J++){let X=this.options[J].attributeName();$[X]=X===this._versionOptionName?this._version:this[X]}return $}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce(($,q)=>Object.assign($,q.opts()),{})}error($,q){if(this._outputConfiguration.outputError(`${$}
21
+ - ${X}`;throw Error(Z)}_executeSubCommand($,q){q=q.slice();let J=!1,X=[".js",".ts",".tsx",".mjs",".cjs"];function Z(K,U){let z=X1.resolve(K,U);if(W0.existsSync(z))return z;if(X.includes(X1.extname(U)))return;let B=X.find((L)=>W0.existsSync(`${z}${L}`));if(B)return`${z}${B}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let H=$._executableFile||`${this._name}-${$._name}`,Q=this._executableDir||"";if(this._scriptPath){let K;try{K=W0.realpathSync(this._scriptPath)}catch{K=this._scriptPath}Q=X1.resolve(X1.dirname(K),Q)}if(Q){let K=Z(Q,H);if(!K&&!$._executableFile&&this._scriptPath){let U=X1.basename(this._scriptPath,X1.extname(this._scriptPath));if(U!==this._name)K=Z(Q,`${U}-${$._name}`)}H=K||H}J=X.includes(X1.extname(H));let Y;if(k.platform!=="win32")if(J)q.unshift(H),q=L3(k.execArgv).concat(q),Y=o$.spawn(k.argv[0],q,{stdio:"inherit"});else Y=o$.spawn(H,q,{stdio:"inherit"});else this._checkForMissingExecutable(H,Q,$._name),q.unshift(H),q=L3(k.execArgv).concat(q),Y=o$.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 r$(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 r$(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((z)=>z.short).some((z)=>/^-\d$/.test(z)))},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 z=$[G++];if(z===void 0)this.optionMissingArgument(U);this.emit(`option:${U.name()}`,z)}else if(U.optional){let z=null;if(G<$.length&&(!Z($[G])||H($[G])))z=$[G++];this.emit(`option:${U.name()}`,z)}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("="),z=this._findOption(K.slice(0,U));if(z&&(z.required||z.optional)){this.emit(`option:${z.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 wX(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=B3($,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=B3($,X)}let J=`error: unknown command '${$}'${q}`;this.error(J,{code:"commander.unknownCommand"})}version($,q,J){if($===void 0)return this._version;this._version=$,q=q||"-V, --version",J=J||"output the version number";let X=this.createOption(q,J);return this._versionOptionName=X.attributeName(),this._registerOption(X),this.on("option:"+X.name(),()=>{this._outputConfiguration.writeOut(`${$}
25
- `),this._exit(0,"commander.version",$)}),this}description($,q){if($===void 0&&q===void 0)return this._description;if(this._description=$,q)this._argsDescription=q;return this}summary($){if($===void 0)return this._summary;return this._summary=$,this}alias($){if($===void 0)return this._aliases[0];let q=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)q=this.commands[this.commands.length-1];if($===q._name)throw Error("Command alias can't be the same as its name");let J=this.parent?._findCommand($);if(J){let X=[J.name()].concat(J.aliases()).join("|");throw Error(`cannot add alias '${$}' to command '${this.name()}' as already have command '${X}'`)}return q._aliases.push($),this}aliases($){if($===void 0)return this._aliases;return $.forEach((q)=>this.alias(q)),this}usage($){if($===void 0){if(this._usage)return this._usage;let q=this.registeredArguments.map((J)=>{return MX(J)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?q:[]).join(" ")}return this._usage=$,this}name($){if($===void 0)return this._name;return this._name=$,this}helpGroup($){if($===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=$,this}commandsGroup($){if($===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=$,this}optionsGroup($){if($===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=$,this}_initOptionGroup($){if(this._defaultOptionGroup&&!$.helpGroupHeading)$.helpGroup(this._defaultOptionGroup)}_initCommandGroup($){if(this._defaultCommandGroup&&!$.helpGroup())$.helpGroup(this._defaultCommandGroup)}nameFromFilename($){return this._name=X1.basename($,X1.extname($)),this}executableDir($){if($===void 0)return this._executableDir;return this._executableDir=$,this}helpInformation($){let q=this.createHelp(),J=this._getOutputContext($);q.prepareContext({error:J.error,helpWidth:J.helpWidth,outputHasColors:J.hasColors});let X=q.formatHelp(this,q);if(J.hasColors)return X;return this._outputConfiguration.stripColor(X)}_getOutputContext($){$=$||{};let q=!!$.error,J,X,Z;if(q)J=(Q)=>this._outputConfiguration.writeErr(Q),X=this._outputConfiguration.getErrHasColors(),Z=this._outputConfiguration.getErrHelpWidth();else J=(Q)=>this._outputConfiguration.writeOut(Q),X=this._outputConfiguration.getOutHasColors(),Z=this._outputConfiguration.getOutHelpWidth();return{error:q,write:(Q)=>{if(!X)Q=this._outputConfiguration.stripColor(Q);return J(Q)},hasColors:X,helpWidth:Z}}outputHelp($){let q;if(typeof $==="function")q=$,$=void 0;let J=this._getOutputContext($),X={error:J.error,write:J.write,command:this};this._getCommandAndAncestors().reverse().forEach((H)=>H.emit("beforeAllHelp",X)),this.emit("beforeHelp",X);let Z=this.helpInformation({error:J.error});if(q){if(Z=q(Z),typeof Z!=="string"&&!Buffer.isBuffer(Z))throw Error("outputHelp callback must return a string or a Buffer")}if(J.write(Z),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",X),this._getCommandAndAncestors().forEach((H)=>H.emit("afterAllHelp",X))}helpOption($,q){if(typeof $==="boolean"){if($){if(this._helpOption===null)this._helpOption=void 0;if(this._defaultOptionGroup)this._initOptionGroup(this._getHelpOption())}else this._helpOption=null;return this}if(this._helpOption=this.createOption($??"-h, --help",q??"display help for command"),$||q)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption($){return this._helpOption=$,this._initOptionGroup($),this}help($){this.outputHelp($);let q=Number(k.exitCode??0);if(q===0&&$&&typeof $!=="function"&&$.error)q=1;this._exit(q,"commander.help","(outputHelp)")}addHelpText($,q){let J=["beforeAll","before","after","afterAll"];if(!J.includes($))throw Error(`Unexpected value for position to addHelpText.
24
+ `),this.outputHelp({error:!0});let J=q||{},X=J.exitCode||1,Z=J.code||"commander.error";this._exit(X,Z,$)}_parseOptionsEnv(){this.options.forEach(($)=>{if($.envVar&&$.envVar in k.env){let q=$.attributeName();if(this.getOptionValue(q)===void 0||["default","config","env"].includes(this.getOptionValueSource(q)))if($.required||$.optional)this.emit(`optionEnv:${$.name()}`,k.env[$.envVar]);else this.emit(`optionEnv:${$.name()}`)}})}_parseOptionsImplied(){let $=new EX(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=B3($,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=B3($,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 IX(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=X1.basename($,X1.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 L3($){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 r$(){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}AX.Command=s$;AX.useColor=r$});var T3=A((DX)=>{var{Argument:V3}=_0(),{Command:e$}=_3(),{CommanderError:OX,InvalidArgumentError:R3}=n1(),{Help:NX}=n$(),{Option:W3}=a$();DX.program=new e$;DX.createCommand=($)=>new e$($);DX.createOption=($,q)=>new W3($,q);DX.createArgument=($,q)=>new V3($,q);DX.Command=e$;DX.Option=W3;DX.Argument=V3;DX.Help=NX;DX.CommanderError=OX;DX.InvalidArgumentError=R3;DX.InvalidOptionArgumentError=R3});var Y6=A((aL,H6)=>{H6.exports=Q6;Q6.sync=dZ;var X6=c("fs");function lZ($,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 lZ(q,J)}function Q6($,q,J){X6.stat($,function(X,Z){J(X,X?!1:Z6(Z,$,q))})}function dZ($,q){return Z6(X6.statSync($),$,q)}});var B6=A((tL,z6)=>{z6.exports=K6;K6.sync=iZ;var G6=c("fs");function K6($,q,J){G6.stat($,function(X,Z){J(X,X?!1:U6(Z,q))})}function iZ($,q){return U6(G6.statSync($),q)}function U6($,q){return $.isFile()&&nZ($,q)}function nZ($,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 _6=A((rL,L6)=>{var oL=c("fs"),E0;if(process.platform==="win32"||global.TESTING_WINDOWS)E0=Y6();else E0=B6();L6.exports=B2;B2.sync=aZ;function B2($,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){B2($,q||{},function(H,Q){if(H)Z(H);else X(Q)})})}E0($,q||{},function(X,Z){if(X){if(X.code==="EACCES"||q&&q.ignoreErrors)X=null,Z=!1}J(X,Z)})}function aZ($,q){try{return E0.sync($,q||{})}catch(J){if(q&&q.ignoreErrors||J.code==="EACCES")return!1;else throw J}}});var F6=A((sL,k6)=>{var y1=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",V6=c("path"),tZ=y1?";":":",R6=_6(),W6=($)=>Object.assign(Error(`not found: ${$}`),{code:"ENOENT"}),T6=($,q)=>{let J=q.colon||tZ,X=$.match(/\//)||y1&&$.match(/\\/)?[""]:[...y1?[process.cwd()]:[],...(q.path||process.env.PATH||"").split(J)],Z=y1?q.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",H=y1?Z.split(J):[""];if(y1){if($.indexOf(".")!==-1&&H[0]!=="")H.unshift("")}return{pathEnv:X,pathExt:H,pathExtExe:Z}},P6=($,q,J)=>{if(typeof q==="function")J=q,q={};if(!q)q={};let{pathEnv:X,pathExt:Z,pathExtExe:H}=T6($,q),Q=[],Y=(K)=>new Promise((U,z)=>{if(K===X.length)return q.all&&Q.length?U(Q):z(W6($));let B=X[K],L=/^".*"$/.test(B)?B.slice(1,-1):B,W=V6.join(L,$),P=!L&&/^\.[\\\/]/.test($)?$.slice(0,2)+W:W;U(G(P,K,0))}),G=(K,U,z)=>new Promise((B,L)=>{if(z===Z.length)return B(Y(U+1));let W=Z[z];R6(K+W,{pathExt:H},(P,M)=>{if(!P&&M)if(q.all)Q.push(K+W);else return B(K+W);return B(G(K,U,z+1))})});return J?Y(0).then((K)=>J(null,K),J):Y(0)},oZ=($,q)=>{q=q||{};let{pathEnv:J,pathExt:X,pathExtExe:Z}=T6($,q),H=[];for(let Q=0;Q<J.length;Q++){let Y=J[Q],G=/^".*"$/.test(Y)?Y.slice(1,-1):Y,K=V6.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(R6.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 W6($)};k6.exports=P6;P6.sync=oZ});var j6=A((eL,L2)=>{var x6=($={})=>{let q=$.env||process.env;if(($.platform||process.platform)!=="win32")return"PATH";return Object.keys(q).reverse().find((X)=>X.toUpperCase()==="PATH")||"Path"};L2.exports=x6;L2.exports.default=x6});var w6=A(($_,I6)=>{var M6=c("path"),rZ=F6(),sZ=j6();function C6($,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=rZ.sync($.command,{path:J[sZ({env:J})],pathExt:q?M6.delimiter:void 0})}catch(Y){}finally{if(H)process.chdir(X)}if(Q)Q=M6.resolve(Z?$.options.cwd:"",Q);return Q}function eZ($){return C6($)||C6($,!0)}I6.exports=eZ});var A6=A((JQ,V2)=>{var _2=/([()\][%!^"`<>&|;, *?])/g;function $Q($){return $=$.replace(_2,"^$1"),$}function qQ($,q){if($=`${$}`,$=$.replace(/(?=(\\+?)?)\1"/g,"$1$1\\\""),$=$.replace(/(?=(\\+?)?)\1$/,"$1$1"),$=`"${$}"`,$=$.replace(_2,"^$1"),q)$=$.replace(_2,"^$1");return $}JQ.command=$Q;JQ.argument=qQ});var y6=A((q_,E6)=>{E6.exports=/^#!(.*)/});var N6=A((J_,O6)=>{var QQ=y6();O6.exports=($="")=>{let q=$.match(QQ);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 v6=A((X_,D6)=>{var R2=c("fs"),HQ=N6();function YQ($){let J=Buffer.alloc(150),X;try{X=R2.openSync($,"r"),R2.readSync(X,J,0,150,0),R2.closeSync(X)}catch(Z){}return HQ(J.toString())}D6.exports=YQ});var b6=A((Z_,S6)=>{var GQ=c("path"),f6=w6(),h6=A6(),KQ=v6(),UQ=process.platform==="win32",zQ=/\.(?:com|exe)$/i,BQ=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function LQ($){$.file=f6($);let q=$.file&&KQ($.file);if(q)return $.args.unshift($.file),$.command=q,f6($);return $.file}function _Q($){if(!UQ)return $;let q=LQ($),J=!zQ.test(q);if($.options.forceShell||J){let X=BQ.test(q);$.command=GQ.normalize($.command),$.command=h6.command($.command),$.args=$.args.map((H)=>h6.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 VQ($,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:_Q(X)}S6.exports=VQ});var m6=A((Q_,c6)=>{var W2=process.platform==="win32";function T2($,q){return Object.assign(Error(`${q} ${$.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${q} ${$.command}`,path:$.command,spawnargs:$.args})}function RQ($,q){if(!W2)return;let J=$.emit;$.emit=function(X,Z){if(X==="exit"){let H=g6(Z,q);if(H)return J.call($,"error",H)}return J.apply($,arguments)}}function g6($,q){if(W2&&$===1&&!q.file)return T2(q.original,"spawn");return null}function WQ($,q){if(W2&&$===1&&!q.file)return T2(q.original,"spawnSync");return null}c6.exports={hookChildProcess:RQ,verifyENOENT:g6,verifyENOENTSync:WQ,notFoundError:T2}});var l6=A((H_,O1)=>{var u6=c("child_process"),P2=b6(),k2=m6();function p6($,q,J){let X=P2($,q,J),Z=u6.spawn(X.command,X.args,X.options);return k2.hookChildProcess(Z,X),Z}function TQ($,q,J){let X=P2($,q,J),Z=u6.spawnSync(X.command,X.args,X.options);return Z.error=Z.error||k2.verifyENOENTSync(Z.status,X),Z}O1.exports=p6;O1.exports.spawn=p6;O1.exports.sync=TQ;O1.exports._parse=P2;O1.exports._enoent=k2});var f4=A((Sj,nq)=>{var v4={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"},wU={up:($=1)=>"\x1B[S".repeat($),down:($=1)=>"\x1B[T".repeat($)},AU={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?v4.up():"");if($)q+=v4.left;return q}};nq.exports={cursor:v4,scroll:wU,erase:AU,beep:"\x07"}});var C1=A((bj,h4)=>{var y$=process||{},aq=y$.argv||[],E$=y$.env||{},EU=!(!!E$.NO_COLOR||aq.includes("--no-color"))&&(!!E$.FORCE_COLOR||aq.includes("--color")||y$.platform==="win32"||(y$.stdout||{}).isTTY&&E$.TERM!=="dumb"||!!E$.CI),yU=($,q,J=$)=>(X)=>{let Z=""+X,H=Z.indexOf(q,$.length);return~H?$+OU(Z,q,J,H)+q:$+Z+q},OU=($,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)},tq=($=EU)=>{let q=$?yU:()=>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")}};h4.exports=tq();h4.exports.createColors=tq});var P3=t(T3(),1),{program:rz,createCommand:sz,createArgument:ez,createOption:$B,CommanderError:qB,InvalidArgumentError:JB,InvalidOptionArgumentError:XB,Command:k3,Argument:ZB,Option:QB,Help:HB}=P3.default;import{homedir as F3}from"os";import{join as x3}from"path";var j3=[{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}],$2=x3(F3(),"esp","esp-idf"),R0=x3(F3(),"esp"),M3="https://github.com/espressif/esp-idf.git",C3=460800,I3=115200,q2={"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)"}}},w3={zsh:".zshrc",bash:".bashrc",fish:".config/fish/config.fish"},A3="0.0.1";class E3{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 E3;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 dX}from"node:url";var w1=($,q)=>{let J=X2(iX($));if(typeof J!=="string")throw TypeError(`${q} must be a string or a file URL: ${J}.`);return J},iX=($)=>J2($)?$.toString():$,J2=($)=>typeof $!=="string"&&$&&Object.getPrototypeOf($)===String.prototype,X2=($)=>$ instanceof URL?dX($):$;var W0=($,q=[],J={})=>{let X=w1($,"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 eX}from"node:child_process";import{StringDecoder as nX}from"node:string_decoder";var{toString:y3}=Object.prototype,O3=($)=>y3.call($)==="[object ArrayBuffer]",D=($)=>y3.call($)==="[object Uint8Array]",Z1=($)=>new Uint8Array($.buffer,$.byteOffset,$.byteLength),aX=new TextEncoder,N3=($)=>aX.encode($),tX=new TextDecoder,T0=($)=>tX.decode($),D3=($,q)=>{return oX($,q).join("")},oX=($,q)=>{if(q==="utf8"&&$.every((H)=>typeof H==="string"))return $;let J=new nX(q),X=$.map((H)=>typeof H==="string"?N3(H):H).map((H)=>J.write(H)),Z=J.end();return Z===""?X:[...X,Z]},a1=($)=>{if($.length===1&&D($[0]))return $[0];return Z2(rX($))},rX=($)=>$.map((q)=>typeof q==="string"?N3(q):q),Z2=($)=>{let q=new Uint8Array(sX($)),J=0;for(let X of $)q.set(X,J),J+=X.length;return q},sX=($)=>{let q=0;for(let J of $)q+=J.length;return q};var S3=($)=>Array.isArray($)&&Array.isArray($.raw),b3=($,q)=>{let J=[];for(let[H,Q]of $.entries())J=$Z({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,{}]},$Z=({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}=qZ(Z,$.raw[X]),G=f3(J,H,Q);if(X===q.length)return G;let K=q[X],U=Array.isArray(K)?K.map((z)=>h3(z)):[h3(K)];return f3(G,U,Y)},qZ=($,q)=>{if(q.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let J=[],X=0,Z=v3.has(q[0]);for(let Q=0,Y=0;Q<$.length;Q+=1,Y+=1){let G=q[Y];if(v3.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+=JZ[K]??1}}let H=X===$.length;if(!H)J.push($.slice(X));return{nextTokens:J,leadingWhitespaces:Z,trailingWhitespaces:H}},v3=new Set([" ","\t","\r",`
29
- `]),JZ={x:3,u:5},f3=($,q,J)=>J||$.length===0||q.length===0?[...$,...q]:[...$.slice(0,-1),`${$.at(-1)}${q[0]}`,...q.slice(1)],h3=($)=>{let q=typeof $;if(q==="string")return $;if(q==="number")return String($);if(E($)&&(("stdout"in $)||("isMaxBuffer"in $)))return XZ($);if($ instanceof eX||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`)},XZ=({stdout:$})=>{if(typeof $==="string")return $;if(D($))return T0($);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 UG}from"node:child_process";import{debuglog as ZZ}from"node:util";import Q2 from"node:process";var d=($)=>P0.includes($),P0=[Q2.stdin,Q2.stdout,Q2.stderr],p=["stdin","stdout","stderr"],k0=($)=>p[$]??`stdio[${$}]`;var c3=($)=>{let q={...$};for(let J of G2)q[J]=H2($,J);return q},H2=($,q)=>{let J=Array.from({length:QZ($)+1}),X=HZ($[q],J,q);return zZ(X,q)},QZ=({stdio:$})=>Array.isArray($)?Math.max($.length,p.length):p.length,HZ=($,q,J)=>E($)?YZ($,q,J):q.fill($),YZ=($,q,J)=>{for(let X of Object.keys($).sort(GZ))for(let Z of KZ(X,J,q))q[Z]=$[X];return q},GZ=($,q)=>g3($)<g3(q)?1:-1,g3=($)=>{if($==="stdout"||$==="stderr")return 0;return $==="all"?2:1},KZ=($,q,J)=>{if($==="ipc")return[J.length-1];let X=Y2($);if(X===void 0||X===0)throw TypeError(`"${q}.${$}" is invalid.
27
+ `)}),this}_outputHelpIfRequested($){let q=this._getHelpOption();if(q&&$.find((X)=>q.is(X)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function L3($){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 s$(){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}yX.Command=e$;yX.useColor=s$});var T3=A((hX)=>{var{Argument:W3}=V0(),{Command:$2}=V3(),{CommanderError:DX,InvalidArgumentError:_3}=n1(),{Help:vX}=a$(),{Option:R3}=t$();hX.program=new $2;hX.createCommand=($)=>new $2($);hX.createOption=($,q)=>new R3($,q);hX.createArgument=($,q)=>new W3($,q);hX.Command=$2;hX.Option=R3;hX.Argument=W3;hX.Help=vX;hX.CommanderError=DX;hX.InvalidArgumentError=_3;hX.InvalidOptionArgumentError=_3});var Y6=A((tL,H6)=>{H6.exports=Q6;Q6.sync=nZ;var X6=c("fs");function iZ($,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 iZ(q,J)}function Q6($,q,J){X6.stat($,function(X,Z){J(X,X?!1:Z6(Z,$,q))})}function nZ($,q){return Z6(X6.statSync($),$,q)}});var B6=A((oL,z6)=>{z6.exports=K6;K6.sync=aZ;var G6=c("fs");function K6($,q,J){G6.stat($,function(X,Z){J(X,X?!1:U6(Z,q))})}function aZ($,q){return U6(G6.statSync($),q)}function U6($,q){return $.isFile()&&tZ($,q)}function tZ($,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 V6=A((sL,L6)=>{var rL=c("fs"),E0;if(process.platform==="win32"||global.TESTING_WINDOWS)E0=Y6();else E0=B6();L6.exports=L2;L2.sync=oZ;function L2($,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){L2($,q||{},function(H,Q){if(H)Z(H);else X(Q)})})}E0($,q||{},function(X,Z){if(X){if(X.code==="EACCES"||q&&q.ignoreErrors)X=null,Z=!1}J(X,Z)})}function oZ($,q){try{return E0.sync($,q||{})}catch(J){if(q&&q.ignoreErrors||J.code==="EACCES")return!1;else throw J}}});var F6=A((eL,k6)=>{var y1=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",W6=c("path"),rZ=y1?";":":",_6=V6(),R6=($)=>Object.assign(Error(`not found: ${$}`),{code:"ENOENT"}),T6=($,q)=>{let J=q.colon||rZ,X=$.match(/\//)||y1&&$.match(/\\/)?[""]:[...y1?[process.cwd()]:[],...(q.path||process.env.PATH||"").split(J)],Z=y1?q.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",H=y1?Z.split(J):[""];if(y1){if($.indexOf(".")!==-1&&H[0]!=="")H.unshift("")}return{pathEnv:X,pathExt:H,pathExtExe:Z}},P6=($,q,J)=>{if(typeof q==="function")J=q,q={};if(!q)q={};let{pathEnv:X,pathExt:Z,pathExtExe:H}=T6($,q),Q=[],Y=(K)=>new Promise((U,z)=>{if(K===X.length)return q.all&&Q.length?U(Q):z(R6($));let B=X[K],L=/^".*"$/.test(B)?B.slice(1,-1):B,R=W6.join(L,$),P=!L&&/^\.[\\\/]/.test($)?$.slice(0,2)+R:R;U(G(P,K,0))}),G=(K,U,z)=>new Promise((B,L)=>{if(z===Z.length)return B(Y(U+1));let R=Z[z];_6(K+R,{pathExt:H},(P,M)=>{if(!P&&M)if(q.all)Q.push(K+R);else return B(K+R);return B(G(K,U,z+1))})});return J?Y(0).then((K)=>J(null,K),J):Y(0)},sZ=($,q)=>{q=q||{};let{pathEnv:J,pathExt:X,pathExtExe:Z}=T6($,q),H=[];for(let Q=0;Q<J.length;Q++){let Y=J[Q],G=/^".*"$/.test(Y)?Y.slice(1,-1):Y,K=W6.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(_6.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 R6($)};k6.exports=P6;P6.sync=sZ});var j6=A(($V,V2)=>{var x6=($={})=>{let q=$.env||process.env;if(($.platform||process.platform)!=="win32")return"PATH";return Object.keys(q).reverse().find((X)=>X.toUpperCase()==="PATH")||"Path"};V2.exports=x6;V2.exports.default=x6});var w6=A((qV,I6)=>{var M6=c("path"),eZ=F6(),$Q=j6();function C6($,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=eZ.sync($.command,{path:J[$Q({env:J})],pathExt:q?M6.delimiter:void 0})}catch(Y){}finally{if(H)process.chdir(X)}if(Q)Q=M6.resolve(Z?$.options.cwd:"",Q);return Q}function qQ($){return C6($)||C6($,!0)}I6.exports=qQ});var A6=A((ZQ,_2)=>{var W2=/([()\][%!^"`<>&|;, *?])/g;function JQ($){return $=$.replace(W2,"^$1"),$}function XQ($,q){if($=`${$}`,$=$.replace(/(?=(\\+?)?)\1"/g,"$1$1\\\""),$=$.replace(/(?=(\\+?)?)\1$/,"$1$1"),$=`"${$}"`,$=$.replace(W2,"^$1"),q)$=$.replace(W2,"^$1");return $}ZQ.command=JQ;ZQ.argument=XQ});var y6=A((JV,E6)=>{E6.exports=/^#!(.*)/});var N6=A((XV,O6)=>{var YQ=y6();O6.exports=($="")=>{let q=$.match(YQ);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 v6=A((ZV,D6)=>{var R2=c("fs"),GQ=N6();function KQ($){let J=Buffer.alloc(150),X;try{X=R2.openSync($,"r"),R2.readSync(X,J,0,150,0),R2.closeSync(X)}catch(Z){}return GQ(J.toString())}D6.exports=KQ});var b6=A((QV,f6)=>{var UQ=c("path"),h6=w6(),S6=A6(),zQ=v6(),BQ=process.platform==="win32",LQ=/\.(?:com|exe)$/i,VQ=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function WQ($){$.file=h6($);let q=$.file&&zQ($.file);if(q)return $.args.unshift($.file),$.command=q,h6($);return $.file}function _Q($){if(!BQ)return $;let q=WQ($),J=!LQ.test(q);if($.options.forceShell||J){let X=VQ.test(q);$.command=UQ.normalize($.command),$.command=S6.command($.command),$.args=$.args.map((H)=>S6.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 RQ($,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:_Q(X)}f6.exports=RQ});var m6=A((HV,c6)=>{var T2=process.platform==="win32";function P2($,q){return Object.assign(Error(`${q} ${$.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${q} ${$.command}`,path:$.command,spawnargs:$.args})}function TQ($,q){if(!T2)return;let J=$.emit;$.emit=function(X,Z){if(X==="exit"){let H=g6(Z,q);if(H)return J.call($,"error",H)}return J.apply($,arguments)}}function g6($,q){if(T2&&$===1&&!q.file)return P2(q.original,"spawn");return null}function PQ($,q){if(T2&&$===1&&!q.file)return P2(q.original,"spawnSync");return null}c6.exports={hookChildProcess:TQ,verifyENOENT:g6,verifyENOENTSync:PQ,notFoundError:P2}});var l6=A((YV,O1)=>{var u6=c("child_process"),k2=b6(),F2=m6();function p6($,q,J){let X=k2($,q,J),Z=u6.spawn(X.command,X.args,X.options);return F2.hookChildProcess(Z,X),Z}function kQ($,q,J){let X=k2($,q,J),Z=u6.spawnSync(X.command,X.args,X.options);return Z.error=Z.error||F2.verifyENOENTSync(Z.status,X),Z}O1.exports=p6;O1.exports.spawn=p6;O1.exports.sync=kQ;O1.exports._parse=k2;O1.exports._enoent=F2});var S4=A((bj,nq)=>{var h4={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"},EU={up:($=1)=>"\x1B[S".repeat($),down:($=1)=>"\x1B[T".repeat($)},yU={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?h4.up():"");if($)q+=h4.left;return q}};nq.exports={cursor:h4,scroll:EU,erase:yU,beep:"\x07"}});var C1=A((gj,f4)=>{var y$=process||{},aq=y$.argv||[],E$=y$.env||{},OU=!(!!E$.NO_COLOR||aq.includes("--no-color"))&&(!!E$.FORCE_COLOR||aq.includes("--color")||y$.platform==="win32"||(y$.stdout||{}).isTTY&&E$.TERM!=="dumb"||!!E$.CI),NU=($,q,J=$)=>(X)=>{let Z=""+X,H=Z.indexOf(q,$.length);return~H?$+DU(Z,q,J,H)+q:$+Z+q},DU=($,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)},tq=($=OU)=>{let q=$?NU:()=>String;return{isColorSupported:$,reset:q("\x1B[0m","\x1B[0m"),bold:q("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:q("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:q("\x1B[3m","\x1B[23m"),underline:q("\x1B[4m","\x1B[24m"),inverse:q("\x1B[7m","\x1B[27m"),hidden:q("\x1B[8m","\x1B[28m"),strikethrough:q("\x1B[9m","\x1B[29m"),black:q("\x1B[30m","\x1B[39m"),red:q("\x1B[31m","\x1B[39m"),green:q("\x1B[32m","\x1B[39m"),yellow:q("\x1B[33m","\x1B[39m"),blue:q("\x1B[34m","\x1B[39m"),magenta:q("\x1B[35m","\x1B[39m"),cyan:q("\x1B[36m","\x1B[39m"),white:q("\x1B[37m","\x1B[39m"),gray:q("\x1B[90m","\x1B[39m"),bgBlack:q("\x1B[40m","\x1B[49m"),bgRed:q("\x1B[41m","\x1B[49m"),bgGreen:q("\x1B[42m","\x1B[49m"),bgYellow:q("\x1B[43m","\x1B[49m"),bgBlue:q("\x1B[44m","\x1B[49m"),bgMagenta:q("\x1B[45m","\x1B[49m"),bgCyan:q("\x1B[46m","\x1B[49m"),bgWhite:q("\x1B[47m","\x1B[49m"),blackBright:q("\x1B[90m","\x1B[39m"),redBright:q("\x1B[91m","\x1B[39m"),greenBright:q("\x1B[92m","\x1B[39m"),yellowBright:q("\x1B[93m","\x1B[39m"),blueBright:q("\x1B[94m","\x1B[39m"),magentaBright:q("\x1B[95m","\x1B[39m"),cyanBright:q("\x1B[96m","\x1B[39m"),whiteBright:q("\x1B[97m","\x1B[39m"),bgBlackBright:q("\x1B[100m","\x1B[49m"),bgRedBright:q("\x1B[101m","\x1B[49m"),bgGreenBright:q("\x1B[102m","\x1B[49m"),bgYellowBright:q("\x1B[103m","\x1B[49m"),bgBlueBright:q("\x1B[104m","\x1B[49m"),bgMagentaBright:q("\x1B[105m","\x1B[49m"),bgCyanBright:q("\x1B[106m","\x1B[49m"),bgWhiteBright:q("\x1B[107m","\x1B[49m")}};f4.exports=tq();f4.exports.createColors=tq});var P3=t(T3(),1),{program:sz,createCommand:ez,createArgument:$B,createOption:qB,CommanderError:JB,InvalidArgumentError:XB,InvalidOptionArgumentError:ZB,Command:k3,Argument:QB,Option:HB,Help:YB}=P3.default;import{homedir as F3}from"os";import{join as x3}from"path";var j3=[{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}],q2=x3(F3(),"esp","esp-idf"),_0=x3(F3(),"esp"),M3="https://github.com/espressif/esp-idf.git",C3=460800,I3=115200,J2={"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)"}}},w3={zsh:".zshrc",bash:".bashrc",fish:".config/fish/config.fish"},A3="0.0.1";class E3{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 _=new E3;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 nX}from"node:url";var w1=($,q)=>{let J=Z2(aX($));if(typeof J!=="string")throw TypeError(`${q} must be a string or a file URL: ${J}.`);return J},aX=($)=>X2($)?$.toString():$,X2=($)=>typeof $!=="string"&&$&&Object.getPrototypeOf($)===String.prototype,Z2=($)=>$ instanceof URL?nX($):$;var R0=($,q=[],J={})=>{let X=w1($,"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 qZ}from"node:child_process";import{StringDecoder as tX}from"node:string_decoder";var{toString:y3}=Object.prototype,O3=($)=>y3.call($)==="[object ArrayBuffer]",D=($)=>y3.call($)==="[object Uint8Array]",Z1=($)=>new Uint8Array($.buffer,$.byteOffset,$.byteLength),oX=new TextEncoder,N3=($)=>oX.encode($),rX=new TextDecoder,T0=($)=>rX.decode($),D3=($,q)=>{return sX($,q).join("")},sX=($,q)=>{if(q==="utf8"&&$.every((H)=>typeof H==="string"))return $;let J=new tX(q),X=$.map((H)=>typeof H==="string"?N3(H):H).map((H)=>J.write(H)),Z=J.end();return Z===""?X:[...X,Z]},a1=($)=>{if($.length===1&&D($[0]))return $[0];return Q2(eX($))},eX=($)=>$.map((q)=>typeof q==="string"?N3(q):q),Q2=($)=>{let q=new Uint8Array($Z($)),J=0;for(let X of $)q.set(X,J),J+=X.length;return q},$Z=($)=>{let q=0;for(let J of $)q+=J.length;return q};var f3=($)=>Array.isArray($)&&Array.isArray($.raw),b3=($,q)=>{let J=[];for(let[H,Q]of $.entries())J=JZ({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,{}]},JZ=({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}=XZ(Z,$.raw[X]),G=h3(J,H,Q);if(X===q.length)return G;let K=q[X],U=Array.isArray(K)?K.map((z)=>S3(z)):[S3(K)];return h3(G,U,Y)},XZ=($,q)=>{if(q.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let J=[],X=0,Z=v3.has(q[0]);for(let Q=0,Y=0;Q<$.length;Q+=1,Y+=1){let G=q[Y];if(v3.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+=ZZ[K]??1}}let H=X===$.length;if(!H)J.push($.slice(X));return{nextTokens:J,leadingWhitespaces:Z,trailingWhitespaces:H}},v3=new Set([" ","\t","\r",`
29
+ `]),ZZ={x:3,u:5},h3=($,q,J)=>J||$.length===0||q.length===0?[...$,...q]:[...$.slice(0,-1),`${$.at(-1)}${q[0]}`,...q.slice(1)],S3=($)=>{let q=typeof $;if(q==="string")return $;if(q==="number")return String($);if(E($)&&(("stdout"in $)||("isMaxBuffer"in $)))return QZ($);if($ instanceof qZ||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`)},QZ=({stdout:$})=>{if(typeof $==="string")return $;if(D($))return T0($);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 BG}from"node:child_process";import{debuglog as HZ}from"node:util";import H2 from"node:process";var d=($)=>P0.includes($),P0=[H2.stdin,H2.stdout,H2.stderr],p=["stdin","stdout","stderr"],k0=($)=>p[$]??`stdio[${$}]`;var c3=($)=>{let q={...$};for(let J of K2)q[J]=Y2($,J);return q},Y2=($,q)=>{let J=Array.from({length:YZ($)+1}),X=GZ($[q],J,q);return LZ(X,q)},YZ=({stdio:$})=>Array.isArray($)?Math.max($.length,p.length):p.length,GZ=($,q,J)=>E($)?KZ($,q,J):q.fill($),KZ=($,q,J)=>{for(let X of Object.keys($).sort(UZ))for(let Z of zZ(X,J,q))q[Z]=$[X];return q},UZ=($,q)=>g3($)<g3(q)?1:-1,g3=($)=>{if($==="stdout"||$==="stderr")return 0;return $==="all"?2:1},zZ=($,q,J)=>{if($==="ipc")return[J.length-1];let X=G2($);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]},Y2=($)=>{if($==="all")return $;if(p.includes($))return p.indexOf($);let q=UZ.exec($);if(q!==null)return Number(q[1])},UZ=/^fd(\d+)$/,zZ=($,q)=>$.map((J)=>J===void 0?LZ[q]:J),BZ=ZZ("execa").enabled?"full":"none",LZ={lines:!1,buffer:!0,maxBuffer:1e8,verbose:BZ,stripFinalNewline:!0},G2=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],Q1=($,q)=>q==="ipc"?$.at(-1):$[q];var A1=({verbose:$},q)=>K2($,q)!=="none",E1=({verbose:$},q)=>!["none","short"].includes(K2($,q)),m3=({verbose:$},q)=>{let J=K2($,q);return F0(J)?J:void 0},K2=($,q)=>q===void 0?_Z($):Q1($,q),_Z=($)=>$.find((q)=>F0(q))??x0.findLast((q)=>$.includes(q)),F0=($)=>typeof $==="function",x0=["none","short","full"];import{inspect as hZ}from"node:util";import{platform as VZ}from"node:process";import{stripVTControlCharacters as RZ}from"node:util";var u3=($,q)=>{let J=[$,...q],X=J.join(" "),Z=J.map((H)=>xZ(p3(H))).join(" ");return{command:X,escapedCommand:Z}},t1=($)=>RZ($).split(`
31
+ Please set the "stdio" option to ensure that file descriptor exists.`);return X==="all"?[1,2]:[X]},G2=($)=>{if($==="all")return $;if(p.includes($))return p.indexOf($);let q=BZ.exec($);if(q!==null)return Number(q[1])},BZ=/^fd(\d+)$/,LZ=($,q)=>$.map((J)=>J===void 0?WZ[q]:J),VZ=HZ("execa").enabled?"full":"none",WZ={lines:!1,buffer:!0,maxBuffer:1e8,verbose:VZ,stripFinalNewline:!0},K2=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],Q1=($,q)=>q==="ipc"?$.at(-1):$[q];var A1=({verbose:$},q)=>U2($,q)!=="none",E1=({verbose:$},q)=>!["none","short"].includes(U2($,q)),m3=({verbose:$},q)=>{let J=U2($,q);return F0(J)?J:void 0},U2=($,q)=>q===void 0?_Z($):Q1($,q),_Z=($)=>$.find((q)=>F0(q))??x0.findLast((q)=>$.includes(q)),F0=($)=>typeof $==="function",x0=["none","short","full"];import{inspect as bZ}from"node:util";import{platform as RZ}from"node:process";import{stripVTControlCharacters as TZ}from"node:util";var u3=($,q)=>{let J=[$,...q],X=J.join(" "),Z=J.map((H)=>MZ(p3(H))).join(" ");return{command:X,escapedCommand:Z}},t1=($)=>TZ($).split(`
32
32
  `).map((q)=>p3(q)).join(`
33
- `),p3=($)=>$.replaceAll(PZ,(q)=>WZ(q)),WZ=($)=>{let q=kZ[$];if(q!==void 0)return q;let J=$.codePointAt(0),X=J.toString(16);return J<=FZ?`\\u${X.padStart(4,"0")}`:`\\U${X}`},TZ=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},PZ=TZ(),kZ={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},FZ=65535,xZ=($)=>{if(jZ.test($))return $;return VZ==="win32"?`"${$.replaceAll('"','""')}"`:`'${$.replaceAll("'","'\\''")}'`},jZ=/^[\w./-]+$/;import l3 from"node:process";function U2(){let{env:$}=l3,{TERM:q,TERM_PROGRAM:J}=$;if(l3.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 d3={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:"╱"},i3={tick:"✔",info:"ℹ",warning:"⚠",cross:"✘",squareSmall:"◻",squareSmallFilled:"◼",circle:"◯",circleFilled:"◉",circleDotted:"◌",circleDouble:"◎",circleCircle:"ⓞ",circleCross:"ⓧ",circlePipe:"Ⓘ",radioOn:"◉",radioOff:"◯",checkboxOn:"☒",checkboxOff:"☐",checkboxCircleOn:"ⓧ",checkboxCircleOff:"Ⓘ",pointer:"❯",triangleUpOutline:"△",triangleLeft:"◀",triangleRight:"▶",lozenge:"◆",lozengeOutline:"◇",hamburger:"☰",smiley:"㋡",mustache:"෴",star:"★",play:"▶",nodejs:"⬢",oneSeventh:"⅐",oneNinth:"⅑",oneTenth:"⅒"},MZ={tick:"√",info:"i",warning:"‼",cross:"×",squareSmall:"□",squareSmallFilled:"■",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(○)",circleCross:"(×)",circlePipe:"(│)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[×]",checkboxOff:"[ ]",checkboxCircleOn:"(×)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"∆",triangleLeft:"◄",triangleRight:"►",lozenge:"♦",lozengeOutline:"◊",hamburger:"≡",smiley:"☺",mustache:"┌─┐",star:"✶",play:"►",nodejs:"♦",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},CZ={...d3,...i3},IZ={...d3,...MZ},wZ=U2(),AZ=wZ?CZ:IZ,j0=AZ,bB=Object.entries(i3);import EZ from"node:tty";var yZ=EZ?.WriteStream?.prototype?.hasColors?.()??!1,T=($,q)=>{if(!yZ)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}},mB=T(0,0),n3=T(1,22),uB=T(2,22),pB=T(3,23),lB=T(4,24),dB=T(53,55),iB=T(7,27),nB=T(8,28),aB=T(9,29),tB=T(30,39),oB=T(31,39),rB=T(32,39),sB=T(33,39),eB=T(34,39),$L=T(35,39),qL=T(36,39),JL=T(37,39),M0=T(90,39),XL=T(40,49),ZL=T(41,49),QL=T(42,49),HL=T(43,49),YL=T(44,49),GL=T(45,49),KL=T(46,49),UL=T(47,49),zL=T(100,49),a3=T(91,39),BL=T(92,39),t3=T(93,39),LL=T(94,39),_L=T(95,39),VL=T(96,39),RL=T(97,39),WL=T(101,49),TL=T(102,49),PL=T(103,49),kL=T(104,49),FL=T(105,49),xL=T(106,49),jL=T(107,49);var s3=({type:$,message:q,timestamp:J,piped:X,commandId:Z,result:{failed:H=!1}={},options:{reject:Q=!0}})=>{let Y=OZ(J),G=NZ[$]({failed:H,reject:Q,piped:X}),K=DZ[$]({reject:Q});return`${M0(`[${Y}]`)} ${M0(`[${Z}]`)} ${K(G)} ${K(q)}`},OZ=($)=>`${C0($.getHours(),2)}:${C0($.getMinutes(),2)}:${C0($.getSeconds(),2)}.${C0($.getMilliseconds(),3)}`,C0=($,q)=>String($).padStart(q,"0"),o3=({failed:$,reject:q})=>{if(!$)return j0.tick;return q?j0.cross:j0.warning},NZ={command:({piped:$})=>$?"|":"$",output:()=>" ",ipc:()=>"*",error:o3,duration:o3},r3=($)=>$,DZ={command:()=>n3,output:()=>r3,ipc:()=>r3,error:({reject:$})=>$?a3:t3,duration:()=>M0};var e3=($,q,J)=>{let X=m3(q,J);return $.map(({verboseLine:Z,verboseObject:H})=>vZ(Z,H,X)).filter((Z)=>Z!==void 0).map((Z)=>fZ(Z)).join("")},vZ=($,q,J)=>{if(J===void 0)return $;let X=J($,q);if(typeof X==="string")return X},fZ=($)=>$.endsWith(`
33
+ `),p3=($)=>$.replaceAll(FZ,(q)=>PZ(q)),PZ=($)=>{let q=xZ[$];if(q!==void 0)return q;let J=$.codePointAt(0),X=J.toString(16);return J<=jZ?`\\u${X.padStart(4,"0")}`:`\\U${X}`},kZ=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},FZ=kZ(),xZ={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},jZ=65535,MZ=($)=>{if(CZ.test($))return $;return RZ==="win32"?`"${$.replaceAll('"','""')}"`:`'${$.replaceAll("'","'\\''")}'`},CZ=/^[\w./-]+$/;import l3 from"node:process";function z2(){let{env:$}=l3,{TERM:q,TERM_PROGRAM:J}=$;if(l3.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 d3={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:"╱"},i3={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:"⅒"},IZ={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"},wZ={...d3,...i3},AZ={...d3,...IZ},EZ=z2(),yZ=EZ?wZ:AZ,j0=yZ,gB=Object.entries(i3);import OZ from"node:tty";var NZ=OZ?.WriteStream?.prototype?.hasColors?.()??!1,T=($,q)=>{if(!NZ)return(Z)=>Z;let J=`\x1B[${$}m`,X=`\x1B[${q}m`;return(Z)=>{let H=Z+"",Q=H.indexOf(X);if(Q===-1)return J+H+X;let Y=J,G=0,U=(q===22?X:"")+J;while(Q!==-1)Y+=H.slice(G,Q)+U,G=Q+X.length,Q=H.indexOf(X,G);return Y+=H.slice(G)+X,Y}},uB=T(0,0),n3=T(1,22),pB=T(2,22),lB=T(3,23),dB=T(4,24),iB=T(53,55),nB=T(7,27),aB=T(8,28),tB=T(9,29),oB=T(30,39),rB=T(31,39),sB=T(32,39),eB=T(33,39),$L=T(34,39),qL=T(35,39),JL=T(36,39),XL=T(37,39),M0=T(90,39),ZL=T(40,49),QL=T(41,49),HL=T(42,49),YL=T(43,49),GL=T(44,49),KL=T(45,49),UL=T(46,49),zL=T(47,49),BL=T(100,49),a3=T(91,39),LL=T(92,39),t3=T(93,39),VL=T(94,39),WL=T(95,39),_L=T(96,39),RL=T(97,39),TL=T(101,49),PL=T(102,49),kL=T(103,49),FL=T(104,49),xL=T(105,49),jL=T(106,49),ML=T(107,49);var s3=({type:$,message:q,timestamp:J,piped:X,commandId:Z,result:{failed:H=!1}={},options:{reject:Q=!0}})=>{let Y=DZ(J),G=vZ[$]({failed:H,reject:Q,piped:X}),K=hZ[$]({reject:Q});return`${M0(`[${Y}]`)} ${M0(`[${Z}]`)} ${K(G)} ${K(q)}`},DZ=($)=>`${C0($.getHours(),2)}:${C0($.getMinutes(),2)}:${C0($.getSeconds(),2)}.${C0($.getMilliseconds(),3)}`,C0=($,q)=>String($).padStart(q,"0"),o3=({failed:$,reject:q})=>{if(!$)return j0.tick;return q?j0.cross:j0.warning},vZ={command:({piped:$})=>$?"|":"$",output:()=>" ",ipc:()=>"*",error:o3,duration:o3},r3=($)=>$,hZ={command:()=>n3,output:()=>r3,ipc:()=>r3,error:({reject:$})=>$?a3:t3,duration:()=>M0};var e3=($,q,J)=>{let X=m3(q,J);return $.map(({verboseLine:Z,verboseObject:H})=>SZ(Z,H,X)).filter((Z)=>Z!==void 0).map((Z)=>fZ(Z)).join("")},SZ=($,q,J)=>{if(J===void 0)return $;let X=J($,q);if(typeof X==="string")return X},fZ=($)=>$.endsWith(`
34
34
  `)?$:`${$}
35
- `;var o=({type:$,verboseMessage:q,fdNumber:J,verboseInfo:X,result:Z})=>{let H=SZ({type:$,result:Z,verboseInfo:X}),Q=bZ(q,H),Y=e3(Q,X,J);if(Y!=="")console.warn(Y.slice(0,-1))},SZ=({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}),bZ=($,q)=>$.split(`
36
- `).map((J)=>gZ({...q,message:J})),gZ=($)=>{return{verboseLine:s3($),verboseObject:$}},I0=($)=>{let q=typeof $==="string"?$:hZ($);return t1(q).replaceAll("\t"," ".repeat(cZ))},cZ=2;var $6=($,q)=>{if(!A1(q))return;o({type:"command",verboseMessage:$,verboseInfo:q})};var q6=($,q,J)=>{pZ($);let X=mZ($);return{verbose:$,escapedCommand:q,commandId:X,rawOptions:J}},mZ=($)=>A1({verbose:$})?uZ++:void 0,uZ=0n,pZ=($)=>{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(!x0.includes(q)&&!F0(q)){let J=x0.map((X)=>`'${X}'`).join(", ");throw TypeError(`The "verbose" option must not be ${q}. Allowed values are: ${J} or a function.`)}}};import{hrtime as J6}from"node:process";var w0=()=>J6.bigint(),z2=($)=>Number(J6.bigint()-$)/1e6;var A0=($,q,J)=>{let X=w0(),{command:Z,escapedCommand:H}=u3($,q),Q=H2(J,"verbose"),Y=q6(Q,H,{...J});return $6(H,Y),{command:Z,escapedCommand:H,startTime:X,verboseInfo:Y}};var $7=t(l6(),1);import EH from"node:path";import e8 from"node:process";import N0 from"node:process";import W1 from"node:path";function y0($={}){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 PQ}from"node:util";import{execFile as kQ,execFileSync as U_}from"node:child_process";import d6 from"node:path";import{fileURLToPath as FQ}from"node:url";var L_=PQ(kQ);function O0($){return $ instanceof URL?FQ($):$}function i6($){return{*[Symbol.iterator](){let q=d6.resolve(O0($)),J;while(J!==q)yield q,J=q,q=d6.resolve(q,"..")}}}var xQ=({cwd:$=N0.cwd(),path:q=N0.env[y0()],preferLocal:J=!0,execPath:X=N0.execPath,addExecPath:Z=!0}={})=>{let H=W1.resolve(O0($)),Q=[],Y=q.split(W1.delimiter);if(J)jQ(Q,Y,H);if(Z)MQ(Q,Y,X,H);return q===""||q===W1.delimiter?`${Q.join(W1.delimiter)}${q}`:[...Q,q].join(W1.delimiter)},jQ=($,q,J)=>{for(let X of i6(J)){let Z=W1.join(X,"node_modules/.bin");if(!q.includes(Z))$.push(Z)}},MQ=($,q,J,X)=>{let Z=W1.resolve(X,O0(J),"..");if(!q.includes(Z))$.push(Z)},n6=({env:$=N0.env,...q}={})=>{$={...$};let J=y0({env:$});return q.path=$[J],$[J]=xQ(q),$};import{setTimeout as gQ}from"node:timers/promises";var a6=($,q,J)=>{let X=J?v0:D0,Z=$ instanceof r?{}:{cause:$};return new X(q,Z)};class r extends Error{}var t6=($,q)=>{Object.defineProperty($.prototype,"name",{value:q,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,r6,{value:!0,writable:!1,enumerable:!1,configurable:!1})},o6=($)=>f0($)&&(r6 in $),r6=Symbol("isExecaError"),f0=($)=>Object.prototype.toString.call($)==="[object Error]";class D0 extends Error{}t6(D0,D0.name);class v0 extends Error{}t6(v0,v0.name);import{constants as o1}from"node:os";import{constants as AQ}from"node:os";var s6=()=>{let $=F2-e6+1;return Array.from({length:$},CQ)},CQ=($,q)=>({name:`SIGRT${q+1}`,number:e6+q,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),e6=34,F2=64;import{constants as IQ}from"node:os";var $8=[{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 x2=()=>{let $=s6();return[...$8,...$].map(wQ)},wQ=({name:$,number:q,description:J,action:X,forced:Z=!1,standard:H})=>{let{signals:{[$]:Q}}=IQ,Y=Q!==void 0;return{name:$,number:Y?Q:q,description:J,supported:Y,action:X,forced:Z,standard:H}};var EQ=()=>{let $=x2();return Object.fromEntries($.map(yQ))},yQ=({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}],q8=EQ(),OQ=()=>{let $=x2(),q=F2+1,J=Array.from({length:q},(X,Z)=>NQ(Z,$));return Object.assign({},...J)},NQ=($,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})=>AQ.signals[X]===$);if(J!==void 0)return J;return q.find((X)=>X.number===$)},O_=OQ();var X8=($)=>{if($===0)throw TypeError("Invalid option `killSignal`: 0 cannot be used.");return Q8($,"option `killSignal`")},Z8=($)=>$===0?$:Q8($,"`subprocess.kill()`'s argument"),Q8=($,q)=>{if(Number.isInteger($))return vQ($,q);if(typeof $==="string")return hQ($,q);throw TypeError(`Invalid ${q} ${String($)}: it must be a string or an integer.
37
- ${j2()}`)},vQ=($,q)=>{if(J8.has($))return J8.get($);throw TypeError(`Invalid ${q} ${$}: this signal integer does not exist.
38
- ${j2()}`)},fQ=()=>new Map(Object.entries(o1.signals).reverse().map(([$,q])=>[q,$])),J8=fQ(),hQ=($,q)=>{if($ in o1.signals)return $;if($.toUpperCase()in o1.signals)throw TypeError(`Invalid ${q} '${$}': please rename it to '${$.toUpperCase()}'.`);throw TypeError(`Invalid ${q} '${$}': this signal name does not exist.
39
- ${j2()}`)},j2=()=>`Available signal names: ${SQ()}.
40
- Available signal numbers: ${bQ()}.`,SQ=()=>Object.keys(o1.signals).sort().map(($)=>`'${$}'`).join(", "),bQ=()=>[...new Set(Object.values(o1.signals).sort(($,q)=>$-q))].join(", "),h0=($)=>q8[$].description;var H8=($)=>{if($===!1)return $;if($===!0)return cQ;if(!Number.isFinite($)||$<0)throw TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${$}\` (${typeof $})`);return $},cQ=5000,Y8=({kill:$,options:{forceKillAfterDelay:q,killSignal:J},onInternalError:X,context:Z,controller:H},Q,Y)=>{let{signal:G,error:K}=mQ(Q,Y,J);uQ(K,X);let U=$(G);return pQ({kill:$,signal:G,forceKillAfterDelay:q,killSignal:J,killResult:U,context:Z,controller:H}),U},mQ=($,q,J)=>{let[X=J,Z]=f0($)?[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&&!f0(Z))throw TypeError(`The second argument is optional. If specified, it must be an error instance: ${Z}`);return{signal:Z8(X),error:Z}},uQ=($,q)=>{if($!==void 0)q.reject($)},pQ=async({kill:$,signal:q,forceKillAfterDelay:J,killSignal:X,killResult:Z,context:H,controller:Q})=>{if(q===X&&Z)M2({kill:$,forceKillAfterDelay:J,context:H,controllerSignal:Q.signal})},M2=async({kill:$,forceKillAfterDelay:q,context:J,controllerSignal:X})=>{if(q===!1)return;try{if(await gQ(q,void 0,{signal:X}),$("SIGKILL"))J.isForcefullyTerminated??=!0}catch{}};import{once as lQ}from"node:events";var S0=async($,q)=>{if(!$.aborted)await lQ($,"abort",{signal:q})};var G8=({cancelSignal:$})=>{if($!==void 0&&Object.prototype.toString.call($)!=="[object AbortSignal]")throw Error(`The \`cancelSignal\` option must be an AbortSignal: ${String($)}`)},K8=({subprocess:$,cancelSignal:q,gracefulCancel:J,context:X,controller:Z})=>q===void 0||J?[]:[dQ($,q,X,Z)],dQ=async($,q,J,{signal:X})=>{throw await S0(q,X),J.terminationReason??="cancel",$.kill(),q.reason};import{scheduler as BH}from"node:timers/promises";import{promisify as KH}from"node:util";var N1=({methodName:$,isSubprocess:q,ipc:J,isConnected:X})=>{iQ($,q,J),C2($,q,X)},iQ=($,q,J)=>{if(!J)throw Error(`${i($,q)} can only be used if the \`ipc\` option is \`true\`.`)},C2=($,q,J)=>{if(!J)throw Error(`${i($,q)} cannot be used: the ${z1(q)} has already exited or disconnected.`)},U8=($)=>{throw Error(`${i("getOneMessage",$)} could not complete: the ${z1($)} exited or disconnected.`)},z8=($)=>{throw Error(`${i("sendMessage",$)} failed: the ${z1($)} is sending a message too, instead of listening to incoming messages.
35
+ `;var o=({type:$,verboseMessage:q,fdNumber:J,verboseInfo:X,result:Z})=>{let H=gZ({type:$,result:Z,verboseInfo:X}),Q=cZ(q,H),Y=e3(Q,X,J);if(Y!=="")console.warn(Y.slice(0,-1))},gZ=({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}),cZ=($,q)=>$.split(`
36
+ `).map((J)=>mZ({...q,message:J})),mZ=($)=>{return{verboseLine:s3($),verboseObject:$}},I0=($)=>{let q=typeof $==="string"?$:bZ($);return t1(q).replaceAll("\t"," ".repeat(uZ))},uZ=2;var $6=($,q)=>{if(!A1(q))return;o({type:"command",verboseMessage:$,verboseInfo:q})};var q6=($,q,J)=>{dZ($);let X=pZ($);return{verbose:$,escapedCommand:q,commandId:X,rawOptions:J}},pZ=($)=>A1({verbose:$})?lZ++:void 0,lZ=0n,dZ=($)=>{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(!x0.includes(q)&&!F0(q)){let J=x0.map((X)=>`'${X}'`).join(", ");throw TypeError(`The "verbose" option must not be ${q}. Allowed values are: ${J} or a function.`)}}};import{hrtime as J6}from"node:process";var w0=()=>J6.bigint(),B2=($)=>Number(J6.bigint()-$)/1e6;var A0=($,q,J)=>{let X=w0(),{command:Z,escapedCommand:H}=u3($,q),Q=Y2(J,"verbose"),Y=q6(Q,H,{...J});return $6(H,Y),{command:Z,escapedCommand:H,startTime:X,verboseInfo:Y}};var $7=t(l6(),1);import OH from"node:path";import e8 from"node:process";import N0 from"node:process";import R1 from"node:path";function y0($={}){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 FQ}from"node:util";import{execFile as xQ,execFileSync as zV}from"node:child_process";import d6 from"node:path";import{fileURLToPath as jQ}from"node:url";var VV=FQ(xQ);function O0($){return $ instanceof URL?jQ($):$}function i6($){return{*[Symbol.iterator](){let q=d6.resolve(O0($)),J;while(J!==q)yield q,J=q,q=d6.resolve(q,"..")}}}var MQ=({cwd:$=N0.cwd(),path:q=N0.env[y0()],preferLocal:J=!0,execPath:X=N0.execPath,addExecPath:Z=!0}={})=>{let H=R1.resolve(O0($)),Q=[],Y=q.split(R1.delimiter);if(J)CQ(Q,Y,H);if(Z)IQ(Q,Y,X,H);return q===""||q===R1.delimiter?`${Q.join(R1.delimiter)}${q}`:[...Q,q].join(R1.delimiter)},CQ=($,q,J)=>{for(let X of i6(J)){let Z=R1.join(X,"node_modules/.bin");if(!q.includes(Z))$.push(Z)}},IQ=($,q,J,X)=>{let Z=R1.resolve(X,O0(J),"..");if(!q.includes(Z))$.push(Z)},n6=({env:$=N0.env,...q}={})=>{$={...$};let J=y0({env:$});return q.path=$[J],$[J]=MQ(q),$};import{setTimeout as mQ}from"node:timers/promises";var a6=($,q,J)=>{let X=J?v0:D0,Z=$ instanceof r?{}:{cause:$};return new X(q,Z)};class r extends Error{}var t6=($,q)=>{Object.defineProperty($.prototype,"name",{value:q,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,r6,{value:!0,writable:!1,enumerable:!1,configurable:!1})},o6=($)=>h0($)&&(r6 in $),r6=Symbol("isExecaError"),h0=($)=>Object.prototype.toString.call($)==="[object Error]";class D0 extends Error{}t6(D0,D0.name);class v0 extends Error{}t6(v0,v0.name);import{constants as o1}from"node:os";import{constants as yQ}from"node:os";var s6=()=>{let $=x2-e6+1;return Array.from({length:$},wQ)},wQ=($,q)=>({name:`SIGRT${q+1}`,number:e6+q,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),e6=34,x2=64;import{constants as AQ}from"node:os";var $8=[{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 j2=()=>{let $=s6();return[...$8,...$].map(EQ)},EQ=({name:$,number:q,description:J,action:X,forced:Z=!1,standard:H})=>{let{signals:{[$]:Q}}=AQ,Y=Q!==void 0;return{name:$,number:Y?Q:q,description:J,supported:Y,action:X,forced:Z,standard:H}};var OQ=()=>{let $=j2();return Object.fromEntries($.map(NQ))},NQ=({name:$,number:q,description:J,supported:X,action:Z,forced:H,standard:Q})=>[$,{name:$,number:q,description:J,supported:X,action:Z,forced:H,standard:Q}],q8=OQ(),DQ=()=>{let $=j2(),q=x2+1,J=Array.from({length:q},(X,Z)=>vQ(Z,$));return Object.assign({},...J)},vQ=($,q)=>{let J=hQ($,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}}},hQ=($,q)=>{let J=q.find(({name:X})=>yQ.signals[X]===$);if(J!==void 0)return J;return q.find((X)=>X.number===$)},NV=DQ();var X8=($)=>{if($===0)throw TypeError("Invalid option `killSignal`: 0 cannot be used.");return Q8($,"option `killSignal`")},Z8=($)=>$===0?$:Q8($,"`subprocess.kill()`'s argument"),Q8=($,q)=>{if(Number.isInteger($))return SQ($,q);if(typeof $==="string")return bQ($,q);throw TypeError(`Invalid ${q} ${String($)}: it must be a string or an integer.
37
+ ${M2()}`)},SQ=($,q)=>{if(J8.has($))return J8.get($);throw TypeError(`Invalid ${q} ${$}: this signal integer does not exist.
38
+ ${M2()}`)},fQ=()=>new Map(Object.entries(o1.signals).reverse().map(([$,q])=>[q,$])),J8=fQ(),bQ=($,q)=>{if($ in o1.signals)return $;if($.toUpperCase()in o1.signals)throw TypeError(`Invalid ${q} '${$}': please rename it to '${$.toUpperCase()}'.`);throw TypeError(`Invalid ${q} '${$}': this signal name does not exist.
39
+ ${M2()}`)},M2=()=>`Available signal names: ${gQ()}.
40
+ Available signal numbers: ${cQ()}.`,gQ=()=>Object.keys(o1.signals).sort().map(($)=>`'${$}'`).join(", "),cQ=()=>[...new Set(Object.values(o1.signals).sort(($,q)=>$-q))].join(", "),S0=($)=>q8[$].description;var H8=($)=>{if($===!1)return $;if($===!0)return uQ;if(!Number.isFinite($)||$<0)throw TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${$}\` (${typeof $})`);return $},uQ=5000,Y8=({kill:$,options:{forceKillAfterDelay:q,killSignal:J},onInternalError:X,context:Z,controller:H},Q,Y)=>{let{signal:G,error:K}=pQ(Q,Y,J);lQ(K,X);let U=$(G);return dQ({kill:$,signal:G,forceKillAfterDelay:q,killSignal:J,killResult:U,context:Z,controller:H}),U},pQ=($,q,J)=>{let[X=J,Z]=h0($)?[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&&!h0(Z))throw TypeError(`The second argument is optional. If specified, it must be an error instance: ${Z}`);return{signal:Z8(X),error:Z}},lQ=($,q)=>{if($!==void 0)q.reject($)},dQ=async({kill:$,signal:q,forceKillAfterDelay:J,killSignal:X,killResult:Z,context:H,controller:Q})=>{if(q===X&&Z)C2({kill:$,forceKillAfterDelay:J,context:H,controllerSignal:Q.signal})},C2=async({kill:$,forceKillAfterDelay:q,context:J,controllerSignal:X})=>{if(q===!1)return;try{if(await mQ(q,void 0,{signal:X}),$("SIGKILL"))J.isForcefullyTerminated??=!0}catch{}};import{once as iQ}from"node:events";var f0=async($,q)=>{if(!$.aborted)await iQ($,"abort",{signal:q})};var G8=({cancelSignal:$})=>{if($!==void 0&&Object.prototype.toString.call($)!=="[object AbortSignal]")throw Error(`The \`cancelSignal\` option must be an AbortSignal: ${String($)}`)},K8=({subprocess:$,cancelSignal:q,gracefulCancel:J,context:X,controller:Z})=>q===void 0||J?[]:[nQ($,q,X,Z)],nQ=async($,q,J,{signal:X})=>{throw await f0(q,X),J.terminationReason??="cancel",$.kill(),q.reason};import{scheduler as VH}from"node:timers/promises";import{promisify as zH}from"node:util";var N1=({methodName:$,isSubprocess:q,ipc:J,isConnected:X})=>{aQ($,q,J),I2($,q,X)},aQ=($,q,J)=>{if(!J)throw Error(`${i($,q)} can only be used if the \`ipc\` option is \`true\`.`)},I2=($,q,J)=>{if(!J)throw Error(`${i($,q)} cannot be used: the ${z1(q)} has already exited or disconnected.`)},U8=($)=>{throw Error(`${i("getOneMessage",$)} could not complete: the ${z1($)} exited or disconnected.`)},z8=($)=>{throw Error(`${i("sendMessage",$)} failed: the ${z1($)} 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
  ${i("getOneMessage",$)},
45
45
  ${i("sendMessage",$,"message, {strict: true}")},
46
- ]);`)},b0=($,q)=>Error(`${i("sendMessage",q)} failed when sending an acknowledgment response to the ${z1(q)}.`,{cause:$}),B8=($)=>{throw Error(`${i("sendMessage",$)} failed: the ${z1($)} is not listening to incoming messages.`)},L8=($)=>{throw Error(`${i("sendMessage",$)} failed: the ${z1($)} exited without listening to incoming messages.`)},_8=()=>Error(`\`cancelSignal\` aborted: the ${z1(!0)} disconnected.`),V8=()=>{throw Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},R8=({error:$,methodName:q,isSubprocess:J})=>{if($.code==="EPIPE")throw Error(`${i(q,J)} cannot be used: the ${z1(J)} is disconnecting.`,{cause:$})},W8=({error:$,methodName:q,isSubprocess:J,message:X})=>{if(nQ($))throw Error(`${i(q,J)}'s argument type is invalid: the message cannot be serialized: ${String(X)}.`,{cause:$})},nQ=({code:$,message:q})=>aQ.has($)||tQ.some((J)=>q.includes(J)),aQ=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),tQ=["could not be cloned","circular structure","call stack size exceeded"],i=($,q,J="")=>$==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${oQ(q)}${$}(${J})`,oQ=($)=>$?"":"subprocess.",z1=($)=>$?"parent process":"subprocess",D1=($)=>{if($.connected)$.disconnect()};var s=()=>{let $={},q=new Promise((J,X)=>{Object.assign($,{resolve:J,reject:X})});return Object.assign(q,$)};var c0=($,q="stdin")=>{let{options:X,fileDescriptors:Z}=e.get($),H=T8(Z,q,!0),Q=$.stdio[H];if(Q===null)throw TypeError(P8(H,q,X,!0));return Q},v1=($,q="stdout")=>{let{options:X,fileDescriptors:Z}=e.get($),H=T8(Z,q,!1),Q=H==="all"?$.all:$.stdio[H];if(Q===null||Q===void 0)throw TypeError(P8(H,q,X,!1));return Q},e=new WeakMap,T8=($,q,J)=>{let X=rQ(q,J);return sQ(X,q,J,$),X},rQ=($,q)=>{let J=Y2($);if(J!==void 0)return J;let{validOptions:X,defaultValue:Z}=q?{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw TypeError(`"${r1(q)}" must not be "${$}".
46
+ ]);`)},b0=($,q)=>Error(`${i("sendMessage",q)} failed when sending an acknowledgment response to the ${z1(q)}.`,{cause:$}),B8=($)=>{throw Error(`${i("sendMessage",$)} failed: the ${z1($)} is not listening to incoming messages.`)},L8=($)=>{throw Error(`${i("sendMessage",$)} failed: the ${z1($)} exited without listening to incoming messages.`)},V8=()=>Error(`\`cancelSignal\` aborted: the ${z1(!0)} disconnected.`),W8=()=>{throw Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},_8=({error:$,methodName:q,isSubprocess:J})=>{if($.code==="EPIPE")throw Error(`${i(q,J)} cannot be used: the ${z1(J)} is disconnecting.`,{cause:$})},R8=({error:$,methodName:q,isSubprocess:J,message:X})=>{if(tQ($))throw Error(`${i(q,J)}'s argument type is invalid: the message cannot be serialized: ${String(X)}.`,{cause:$})},tQ=({code:$,message:q})=>oQ.has($)||rQ.some((J)=>q.includes(J)),oQ=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),rQ=["could not be cloned","circular structure","call stack size exceeded"],i=($,q,J="")=>$==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${sQ(q)}${$}(${J})`,sQ=($)=>$?"":"subprocess.",z1=($)=>$?"parent process":"subprocess",D1=($)=>{if($.connected)$.disconnect()};var s=()=>{let $={},q=new Promise((J,X)=>{Object.assign($,{resolve:J,reject:X})});return Object.assign(q,$)};var c0=($,q="stdin")=>{let{options:X,fileDescriptors:Z}=e.get($),H=T8(Z,q,!0),Q=$.stdio[H];if(Q===null)throw TypeError(P8(H,q,X,!0));return Q},v1=($,q="stdout")=>{let{options:X,fileDescriptors:Z}=e.get($),H=T8(Z,q,!1),Q=H==="all"?$.all:$.stdio[H];if(Q===null||Q===void 0)throw TypeError(P8(H,q,X,!1));return Q},e=new WeakMap,T8=($,q,J)=>{let X=eQ(q,J);return $H(X,q,J,$),X},eQ=($,q)=>{let J=G2($);if(J!==void 0)return J;let{validOptions:X,defaultValue:Z}=q?{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw TypeError(`"${r1(q)}" must not be "${$}".
47
47
  It must be ${X} or "fd3", "fd4" (and so on).
48
- It is optional and defaults to "${Z}".`)},sQ=($,q,J,X)=>{let Z=X[k8($)];if(Z===void 0)throw TypeError(`"${r1(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(`"${r1(J)}" must not be ${q}. It must be a readable stream, not writable.`);if(Z.direction!=="input"&&J)throw TypeError(`"${r1(J)}" must not be ${q}. It must be a writable stream, not readable.`)},P8=($,q,J,X)=>{if($==="all"&&!J.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:Z,optionValue:H}=eQ($,J);return`The "${Z}: ${g0(H)}" option is incompatible with using "${r1(X)}: ${g0(q)}".
50
- Please set this option with "pipe" instead.`},eQ=($,{stdin:q,stdout:J,stderr:X,stdio:Z})=>{let H=k8($);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]}},k8=($)=>$==="all"?1:$,r1=($)=>$?"to":"from",g0=($)=>{if(typeof $==="string")return`'${$}'`;return typeof $==="number"?`${$}`:"Stream"};import{once as QH}from"node:events";import{addAbortListener as $H}from"node:events";var T1=($,q,J)=>{let X=$.getMaxListeners();if(X===0||X===Number.POSITIVE_INFINITY)return;$.setMaxListeners(X+q),$H(J,()=>{$.setMaxListeners($.getMaxListeners()-q)})};import{EventEmitter as XH}from"node:events";import{once as qH}from"node:events";import{scheduler as JH}from"node:timers/promises";var m0=($,q)=>{if(q)I2($)},I2=($)=>{$.refCounted()},u0=($,q)=>{if(q)w2($)},w2=($)=>{$.unrefCounted()},F8=($,q)=>{if(q)w2($),w2($)},x8=($,q)=>{if(q)I2($),I2($)};var j8=async({anyProcess:$,channel:q,isSubprocess:J,ipcEmitter:X},Z)=>{if(I8(Z)||A8(Z))return;if(!p0.has($))p0.set($,[]);let H=p0.get($);if(H.push(Z),H.length>1)return;while(H.length>0){await w8($,X,Z),await JH.yield();let Q=await C8({wrappedMessage:H[0],anyProcess:$,channel:q,isSubprocess:J,ipcEmitter:X});H.shift(),X.emit("message",Q),X.emit("message:done")}},M8=async({anyProcess:$,channel:q,isSubprocess:J,ipcEmitter:X,boundOnMessage:Z})=>{A2();let H=p0.get($);while(H?.length>0)await qH(X,"message:done");$.removeListener("message",Z),x8(q,J),X.connected=!1,X.emit("disconnect")},p0=new WeakMap;var B1=($,q,J)=>{if(l0.has($))return l0.get($);let X=new XH;return X.connected=!0,l0.set($,X),ZH({ipcEmitter:X,anyProcess:$,channel:q,isSubprocess:J}),X},l0=new WeakMap,ZH=({ipcEmitter:$,anyProcess:q,channel:J,isSubprocess:X})=>{let Z=j8.bind(void 0,{anyProcess:q,channel:J,isSubprocess:X,ipcEmitter:$});q.on("message",Z),q.once("disconnect",M8.bind(void 0,{anyProcess:q,channel:J,isSubprocess:X,ipcEmitter:$,boundOnMessage:Z})),F8(J,X)},d0=($)=>{let q=l0.get($);return q===void 0?$.channel!==null:q.connected};var E8=({anyProcess:$,channel:q,isSubprocess:J,message:X,strict:Z})=>{if(!Z)return X;let H=B1($,q,J),Q=a0($,H);return{id:HH++,type:n0,message:X,hasListeners:Q}},HH=0n,y8=($,q)=>{if(q?.type!==n0||q.hasListeners)return;for(let{id:J}of $)if(J!==void 0)i0[J].resolve({isDeadlock:!0,hasListeners:!1})},C8=async({wrappedMessage:$,anyProcess:q,channel:J,isSubprocess:X,ipcEmitter:Z})=>{if($?.type!==n0||!q.connected)return $;let{id:H,message:Q}=$,Y={id:H,type:N8,message:a0(q,Z)};try{await t0({anyProcess:q,channel:J,isSubprocess:X,ipc:!0},Y)}catch(G){Z.emit("strict:error",G)}return Q},I8=($)=>{if($?.type!==N8)return!1;let{id:q,message:J}=$;return i0[q]?.resolve({isDeadlock:!1,hasListeners:J}),!0},O8=async($,q,J)=>{if($?.type!==n0)return;let X=s();i0[$.id]=X;let Z=new AbortController;try{let{isDeadlock:H,hasListeners:Q}=await Promise.race([X,YH(q,J,Z)]);if(H)z8(J);if(!Q)B8(J)}finally{Z.abort(),delete i0[$.id]}},i0={},YH=async($,q,{signal:J})=>{T1($,1,J),await QH($,"disconnect",{signal:J}),L8(q)},n0="execa:ipc:request",N8="execa:ipc:response";var D8=($,q,J)=>{if(!s1.has($))s1.set($,new Set);let X=s1.get($),Z=s(),H=J?q.id:void 0,Q={onMessageSent:Z,id:H};return X.add(Q),{outgoingMessages:X,outgoingMessage:Q}},v8=({outgoingMessages:$,outgoingMessage:q})=>{$.delete(q),q.onMessageSent.resolve()},w8=async($,q,J)=>{while(!a0($,q)&&s1.get($)?.size>0){let X=[...s1.get($)];y8(X,J),await Promise.all(X.map(({onMessageSent:Z})=>Z))}},s1=new WeakMap,a0=($,q)=>q.listenerCount("message")>GH($),GH=($)=>e.has($)&&!Q1(e.get($).options.buffer,"ipc")?1:0;var t0=({anyProcess:$,channel:q,isSubprocess:J,ipc:X},Z,{strict:H=!1}={})=>{return N1({methodName:"sendMessage",isSubprocess:J,ipc:X,isConnected:$.connected}),UH({anyProcess:$,channel:q,methodName:"sendMessage",isSubprocess:J,message:Z,strict:H})},UH=async({anyProcess:$,channel:q,methodName:J,isSubprocess:X,message:Z,strict:H})=>{let Q=E8({anyProcess:$,channel:q,isSubprocess:X,message:Z,strict:H}),Y=D8($,Q,H);try{await y2({anyProcess:$,methodName:J,isSubprocess:X,wrappedMessage:Q,message:Z})}catch(G){throw D1($),G}finally{v8(Y)}},y2=async({anyProcess:$,methodName:q,isSubprocess:J,wrappedMessage:X,message:Z})=>{let H=zH($);try{await Promise.all([O8(X,$,J),H(X)])}catch(Q){throw R8({error:Q,methodName:q,isSubprocess:J}),W8({error:Q,methodName:q,isSubprocess:J,message:Z}),Q}},zH=($)=>{if(E2.has($))return E2.get($);let q=KH($.send.bind($));return E2.set($,q),q},E2=new WeakMap;var h8=($,q)=>{return C2("cancelSignal",!1,$.connected),y2({anyProcess:$,methodName:"cancelSignal",isSubprocess:!1,wrappedMessage:{type:b8,message:q},message:q})},S8=async({anyProcess:$,channel:q,isSubprocess:J,ipc:X})=>{return await LH({anyProcess:$,channel:q,isSubprocess:J,ipc:X}),O2.signal},LH=async({anyProcess:$,channel:q,isSubprocess:J,ipc:X})=>{if(f8)return;if(f8=!0,!X){V8();return}if(q===null){A2();return}B1($,q,J),await BH.yield()},f8=!1,A8=($)=>{if($?.type!==b8)return!1;return O2.abort($.message),!0},b8="execa:ipc:cancel",A2=()=>{O2.abort(_8())},O2=new AbortController;var g8=({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.")},c8=({subprocess:$,cancelSignal:q,gracefulCancel:J,forceKillAfterDelay:X,context:Z,controller:H})=>J?[_H({subprocess:$,cancelSignal:q,forceKillAfterDelay:X,context:Z,controller:H})]:[],_H=async({subprocess:$,cancelSignal:q,forceKillAfterDelay:J,context:X,controller:{signal:Z}})=>{await S0(q,Z);let H=VH(q);throw await h8($,H),M2({kill:$.kill,forceKillAfterDelay:J,context:X,controllerSignal:Z}),X.terminationReason??="gracefulCancel",q.reason},VH=({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 RH}from"node:timers/promises";var m8=({timeout:$})=>{if($!==void 0&&(!Number.isFinite($)||$<0))throw TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${$}\` (${typeof $})`)},u8=($,q,J,X)=>q===0||q===void 0?[]:[WH($,q,J,X)],WH=async($,q,J,{signal:X})=>{throw await RH(q,void 0,{signal:X}),J.terminationReason??="timeout",$.kill(),new r};import{execPath as TH,execArgv as PH}from"node:process";import p8 from"node:path";var l8=({options:$})=>{if($.node===!1)throw TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...$,node:!0}}},d8=($,q,{node:J=!1,nodePath:X=TH,nodeOptions:Z=PH.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=w1(X,'The "nodePath" option'),K=p8.resolve(H,G),U={...Y,nodePath:K,node:J,cwd:H};if(!J)return[$,q,U];if(p8.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 kH}from"node:v8";var i8=({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`.");jH[J]($)},FH=($)=>{try{kH($)}catch(q){throw Error("The `ipcInput` option is not serializable with a structured clone.",{cause:q})}},xH=($)=>{try{JSON.stringify($)}catch(q){throw Error("The `ipcInput` option is not serializable with JSON.",{cause:q})}},jH={advanced:FH,json:xH},n8=async($,q)=>{if(q===void 0)return;await $.sendMessage(q)};var t8=({encoding:$})=>{if(N2.has($))return;let q=CH($);if(q!==void 0)throw TypeError(`Invalid option \`encoding: ${o0($)}\`.
51
- Please rename it to ${o0(q)}.`);let J=[...N2].map((X)=>o0(X)).join(", ");throw TypeError(`Invalid option \`encoding: ${o0($)}\`.
52
- Please rename it to one of: ${J}.`)},MH=new Set(["utf8","utf16le"]),m=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),N2=new Set([...MH,...m]),CH=($)=>{if($===null)return"buffer";if(typeof $!=="string")return;let q=$.toLowerCase();if(q in a8)return a8[q];if(N2.has(q))return q},a8={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},o0=($)=>typeof $==="string"?`"${$}"`:String($);import{statSync as IH}from"node:fs";import wH from"node:path";import AH from"node:process";var o8=($=r8())=>{let q=w1($,'The "cwd" option');return wH.resolve(q)},r8=()=>{try{return AH.cwd()}catch($){throw $.message=`The current directory does not exist.
53
- ${$.message}`,$}},s8=($,q)=>{if(q===r8())return $;let J;try{J=IH(q)}catch(X){return`The "cwd" option is invalid: ${q}.
48
+ It is optional and defaults to "${Z}".`)},$H=($,q,J,X)=>{let Z=X[k8($)];if(Z===void 0)throw TypeError(`"${r1(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(`"${r1(J)}" must not be ${q}. It must be a readable stream, not writable.`);if(Z.direction!=="input"&&J)throw TypeError(`"${r1(J)}" must not be ${q}. It must be a writable stream, not readable.`)},P8=($,q,J,X)=>{if($==="all"&&!J.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:Z,optionValue:H}=qH($,J);return`The "${Z}: ${g0(H)}" option is incompatible with using "${r1(X)}: ${g0(q)}".
50
+ Please set this option with "pipe" instead.`},qH=($,{stdin:q,stdout:J,stderr:X,stdio:Z})=>{let H=k8($);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]}},k8=($)=>$==="all"?1:$,r1=($)=>$?"to":"from",g0=($)=>{if(typeof $==="string")return`'${$}'`;return typeof $==="number"?`${$}`:"Stream"};import{once as YH}from"node:events";import{addAbortListener as JH}from"node:events";var T1=($,q,J)=>{let X=$.getMaxListeners();if(X===0||X===Number.POSITIVE_INFINITY)return;$.setMaxListeners(X+q),JH(J,()=>{$.setMaxListeners($.getMaxListeners()-q)})};import{EventEmitter as QH}from"node:events";import{once as XH}from"node:events";import{scheduler as ZH}from"node:timers/promises";var m0=($,q)=>{if(q)w2($)},w2=($)=>{$.refCounted()},u0=($,q)=>{if(q)A2($)},A2=($)=>{$.unrefCounted()},F8=($,q)=>{if(q)A2($),A2($)},x8=($,q)=>{if(q)w2($),w2($)};var j8=async({anyProcess:$,channel:q,isSubprocess:J,ipcEmitter:X},Z)=>{if(I8(Z)||A8(Z))return;if(!p0.has($))p0.set($,[]);let H=p0.get($);if(H.push(Z),H.length>1)return;while(H.length>0){await w8($,X,Z),await ZH.yield();let Q=await C8({wrappedMessage:H[0],anyProcess:$,channel:q,isSubprocess:J,ipcEmitter:X});H.shift(),X.emit("message",Q),X.emit("message:done")}},M8=async({anyProcess:$,channel:q,isSubprocess:J,ipcEmitter:X,boundOnMessage:Z})=>{E2();let H=p0.get($);while(H?.length>0)await XH(X,"message:done");$.removeListener("message",Z),x8(q,J),X.connected=!1,X.emit("disconnect")},p0=new WeakMap;var B1=($,q,J)=>{if(l0.has($))return l0.get($);let X=new QH;return X.connected=!0,l0.set($,X),HH({ipcEmitter:X,anyProcess:$,channel:q,isSubprocess:J}),X},l0=new WeakMap,HH=({ipcEmitter:$,anyProcess:q,channel:J,isSubprocess:X})=>{let Z=j8.bind(void 0,{anyProcess:q,channel:J,isSubprocess:X,ipcEmitter:$});q.on("message",Z),q.once("disconnect",M8.bind(void 0,{anyProcess:q,channel:J,isSubprocess:X,ipcEmitter:$,boundOnMessage:Z})),F8(J,X)},d0=($)=>{let q=l0.get($);return q===void 0?$.channel!==null:q.connected};var E8=({anyProcess:$,channel:q,isSubprocess:J,message:X,strict:Z})=>{if(!Z)return X;let H=B1($,q,J),Q=a0($,H);return{id:GH++,type:n0,message:X,hasListeners:Q}},GH=0n,y8=($,q)=>{if(q?.type!==n0||q.hasListeners)return;for(let{id:J}of $)if(J!==void 0)i0[J].resolve({isDeadlock:!0,hasListeners:!1})},C8=async({wrappedMessage:$,anyProcess:q,channel:J,isSubprocess:X,ipcEmitter:Z})=>{if($?.type!==n0||!q.connected)return $;let{id:H,message:Q}=$,Y={id:H,type:N8,message:a0(q,Z)};try{await t0({anyProcess:q,channel:J,isSubprocess:X,ipc:!0},Y)}catch(G){Z.emit("strict:error",G)}return Q},I8=($)=>{if($?.type!==N8)return!1;let{id:q,message:J}=$;return i0[q]?.resolve({isDeadlock:!1,hasListeners:J}),!0},O8=async($,q,J)=>{if($?.type!==n0)return;let X=s();i0[$.id]=X;let Z=new AbortController;try{let{isDeadlock:H,hasListeners:Q}=await Promise.race([X,KH(q,J,Z)]);if(H)z8(J);if(!Q)B8(J)}finally{Z.abort(),delete i0[$.id]}},i0={},KH=async($,q,{signal:J})=>{T1($,1,J),await YH($,"disconnect",{signal:J}),L8(q)},n0="execa:ipc:request",N8="execa:ipc:response";var D8=($,q,J)=>{if(!s1.has($))s1.set($,new Set);let X=s1.get($),Z=s(),H=J?q.id:void 0,Q={onMessageSent:Z,id:H};return X.add(Q),{outgoingMessages:X,outgoingMessage:Q}},v8=({outgoingMessages:$,outgoingMessage:q})=>{$.delete(q),q.onMessageSent.resolve()},w8=async($,q,J)=>{while(!a0($,q)&&s1.get($)?.size>0){let X=[...s1.get($)];y8(X,J),await Promise.all(X.map(({onMessageSent:Z})=>Z))}},s1=new WeakMap,a0=($,q)=>q.listenerCount("message")>UH($),UH=($)=>e.has($)&&!Q1(e.get($).options.buffer,"ipc")?1:0;var t0=({anyProcess:$,channel:q,isSubprocess:J,ipc:X},Z,{strict:H=!1}={})=>{return N1({methodName:"sendMessage",isSubprocess:J,ipc:X,isConnected:$.connected}),BH({anyProcess:$,channel:q,methodName:"sendMessage",isSubprocess:J,message:Z,strict:H})},BH=async({anyProcess:$,channel:q,methodName:J,isSubprocess:X,message:Z,strict:H})=>{let Q=E8({anyProcess:$,channel:q,isSubprocess:X,message:Z,strict:H}),Y=D8($,Q,H);try{await O2({anyProcess:$,methodName:J,isSubprocess:X,wrappedMessage:Q,message:Z})}catch(G){throw D1($),G}finally{v8(Y)}},O2=async({anyProcess:$,methodName:q,isSubprocess:J,wrappedMessage:X,message:Z})=>{let H=LH($);try{await Promise.all([O8(X,$,J),H(X)])}catch(Q){throw _8({error:Q,methodName:q,isSubprocess:J}),R8({error:Q,methodName:q,isSubprocess:J,message:Z}),Q}},LH=($)=>{if(y2.has($))return y2.get($);let q=zH($.send.bind($));return y2.set($,q),q},y2=new WeakMap;var S8=($,q)=>{return I2("cancelSignal",!1,$.connected),O2({anyProcess:$,methodName:"cancelSignal",isSubprocess:!1,wrappedMessage:{type:b8,message:q},message:q})},f8=async({anyProcess:$,channel:q,isSubprocess:J,ipc:X})=>{return await WH({anyProcess:$,channel:q,isSubprocess:J,ipc:X}),N2.signal},WH=async({anyProcess:$,channel:q,isSubprocess:J,ipc:X})=>{if(h8)return;if(h8=!0,!X){W8();return}if(q===null){E2();return}B1($,q,J),await VH.yield()},h8=!1,A8=($)=>{if($?.type!==b8)return!1;return N2.abort($.message),!0},b8="execa:ipc:cancel",E2=()=>{N2.abort(V8())},N2=new AbortController;var g8=({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.")},c8=({subprocess:$,cancelSignal:q,gracefulCancel:J,forceKillAfterDelay:X,context:Z,controller:H})=>J?[_H({subprocess:$,cancelSignal:q,forceKillAfterDelay:X,context:Z,controller:H})]:[],_H=async({subprocess:$,cancelSignal:q,forceKillAfterDelay:J,context:X,controller:{signal:Z}})=>{await f0(q,Z);let H=RH(q);throw await S8($,H),C2({kill:$.kill,forceKillAfterDelay:J,context:X,controllerSignal:Z}),X.terminationReason??="gracefulCancel",q.reason},RH=({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 TH}from"node:timers/promises";var m8=({timeout:$})=>{if($!==void 0&&(!Number.isFinite($)||$<0))throw TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${$}\` (${typeof $})`)},u8=($,q,J,X)=>q===0||q===void 0?[]:[PH($,q,J,X)],PH=async($,q,J,{signal:X})=>{throw await TH(q,void 0,{signal:X}),J.terminationReason??="timeout",$.kill(),new r};import{execPath as kH,execArgv as FH}from"node:process";import p8 from"node:path";var l8=({options:$})=>{if($.node===!1)throw TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...$,node:!0}}},d8=($,q,{node:J=!1,nodePath:X=kH,nodeOptions:Z=FH.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=w1(X,'The "nodePath" option'),K=p8.resolve(H,G),U={...Y,nodePath:K,node:J,cwd:H};if(!J)return[$,q,U];if(p8.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 xH}from"node:v8";var i8=({ipcInput:$,ipc:q,serialization:J})=>{if($===void 0)return;if(!q)throw Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");CH[J]($)},jH=($)=>{try{xH($)}catch(q){throw Error("The `ipcInput` option is not serializable with a structured clone.",{cause:q})}},MH=($)=>{try{JSON.stringify($)}catch(q){throw Error("The `ipcInput` option is not serializable with JSON.",{cause:q})}},CH={advanced:jH,json:MH},n8=async($,q)=>{if(q===void 0)return;await $.sendMessage(q)};var t8=({encoding:$})=>{if(D2.has($))return;let q=wH($);if(q!==void 0)throw TypeError(`Invalid option \`encoding: ${o0($)}\`.
51
+ Please rename it to ${o0(q)}.`);let J=[...D2].map((X)=>o0(X)).join(", ");throw TypeError(`Invalid option \`encoding: ${o0($)}\`.
52
+ Please rename it to one of: ${J}.`)},IH=new Set(["utf8","utf16le"]),m=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),D2=new Set([...IH,...m]),wH=($)=>{if($===null)return"buffer";if(typeof $!=="string")return;let q=$.toLowerCase();if(q in a8)return a8[q];if(D2.has(q))return q},a8={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},o0=($)=>typeof $==="string"?`"${$}"`:String($);import{statSync as AH}from"node:fs";import EH from"node:path";import yH from"node:process";var o8=($=r8())=>{let q=w1($,'The "cwd" option');return EH.resolve(q)},r8=()=>{try{return yH.cwd()}catch($){throw $.message=`The current directory does not exist.
53
+ ${$.message}`,$}},s8=($,q)=>{if(q===r8())return $;let J;try{J=AH(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 r0=($,q,J)=>{J.cwd=o8(J.cwd);let[X,Z,H]=d8($,q,J),{command:Q,args:Y,options:G}=$7.default._parse(X,Z,H),K=c3(G),U=yH(K);if(m8(U),t8(U),i8(U),G8(U),g8(U),U.shell=X2(U.shell),U.env=OH(U),U.killSignal=X8(U.killSignal),U.forceKillAfterDelay=H8(U.forceKillAfterDelay),U.lines=U.lines.map((z,B)=>z&&!m.has(U.encoding)&&U.buffer[B]),e8.platform==="win32"&&EH.basename(Q,".exe")==="cmd")Y.unshift("/q");return{file:Q,commandArguments:Y,options:U}},yH=({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:z=!1,ipcInput:B,ipc:L=B!==void 0||z,serialization:W="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:z,ipcInput:B,ipc:L,serialization:W}),OH=({env:$,extendEnv:q,preferLocal:J,node:X,localDirectory:Z,nodePath:H})=>{let Q=q?{...e8.env,...$}:$;if(J||X)return n6({env:Q,cwd:Z,execPath:H,preferLocal:J,addExecPath:X});return Q};var s0=($,q,J)=>J.shell&&q.length>0?[[$,...q].join(" "),[],J]:[$,q,J];import{inspect as z9}from"node:util";function f1($){if(typeof $==="string")return NH($);if(!(ArrayBuffer.isView($)&&$.BYTES_PER_ELEMENT===1))throw Error("Input must be a string or a Uint8Array");return DH($)}var NH=($)=>$.at(-1)===q7?$.slice(0,$.at(-2)===J7?-2:-1):$,DH=($)=>$.at(-1)===vH?$.subarray(0,$.at(-2)===fH?-2:-1):$,q7=`
57
- `,vH=q7.codePointAt(0),J7="\r",fH=J7.codePointAt(0);import{on as Y9}from"node:events";import{finished as G9}from"node:stream/promises";function n($,{checkOpen:q=!0}={}){return $!==null&&typeof $==="object"&&($.writable||$.readable||!q||$.writable===void 0&&$.readable===void 0)&&typeof $.pipe==="function"}function D2($,{checkOpen:q=!0}={}){return n($,{checkOpen:q})&&($.writable||!q)&&typeof $.write==="function"&&typeof $.end==="function"&&typeof $.writable==="boolean"&&typeof $.writableObjectMode==="boolean"&&typeof $.destroy==="function"&&typeof $.destroyed==="boolean"}function P1($,{checkOpen:q=!0}={}){return n($,{checkOpen:q})&&($.readable||!q)&&typeof $.read==="function"&&typeof $.readable==="boolean"&&typeof $.readableObjectMode==="boolean"&&typeof $.destroy==="function"&&typeof $.destroyed==="boolean"}function v2($,q){return D2($,q)&&P1($,q)}var hH=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);class X7{#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 f2=Symbol();function Z7(){return this[f2].next()}Object.defineProperty(Z7,"name",{value:"next"});function Q7($){return this[f2].return($)}Object.defineProperty(Q7,"name",{value:"return"});var SH=Object.create(hH,{next:{enumerable:!0,configurable:!0,writable:!0,value:Z7},return:{enumerable:!0,configurable:!0,writable:!0,value:Q7}});function h2({preventCancel:$=!1}={}){let q=this.getReader(),J=new X7(q,$),X=Object.create(SH);return X[f2]=J,X}var H7=($)=>{if(P1($,{checkOpen:!1})&&e1.on!==void 0)return gH($);if(typeof $?.[Symbol.asyncIterator]==="function")return $;if(bH.call($)==="[object ReadableStream]")return h2.call($);throw TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:bH}=Object.prototype,gH=async function*($){let q=new AbortController,J={};cH($,q,J);try{for await(let[X]of e1.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()}},cH=async($,q,J)=>{try{await e1.finished($,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(X){J.error=X}finally{q.abort()}},e1={};var h1=async($,{init:q,convertChunk:J,getSize:X,truncateChunk:Z,addChunk:H,getFinalChunk:Q,finalize:Y},{maxBuffer:G=Number.POSITIVE_INFINITY}={})=>{let K=H7($),U=q();U.length=0;try{for await(let z of K){let B=uH(z),L=J[B](z,U);K7({convertedChunk:L,state:U,getSize:X,truncateChunk:Z,addChunk:H,maxBuffer:G})}return mH({state:U,convertChunk:J,getSize:X,truncateChunk:Z,addChunk:H,getFinalChunk:Q,maxBuffer:G}),Y(U)}catch(z){let B=typeof z==="object"&&z!==null?z:Error(z);throw B.bufferedData=Y(U),B}},mH=({state:$,getSize:q,truncateChunk:J,addChunk:X,getFinalChunk:Z,maxBuffer:H})=>{let Q=Z($);if(Q!==void 0)K7({convertedChunk:Q,state:$,getSize:q,truncateChunk:J,addChunk:X,maxBuffer:H})},K7=({convertedChunk:$,state:q,getSize:J,truncateChunk:X,addChunk:Z,maxBuffer:H})=>{let Q=J($),Y=q.length+Q;if(Y<=H){Y7($,q,Z,Y);return}let G=X($,H-q.length);if(G!==void 0)Y7(G,q,Z,H);throw new H1},Y7=($,q,J,X)=>{q.contents=J($,q,X),q.length=X},uH=($)=>{let q=typeof $;if(q==="string")return"string";if(q!=="object"||$===null)return"others";if(globalThis.Buffer?.isBuffer($))return"buffer";let J=G7.call($);if(J==="[object ArrayBuffer]")return"arrayBuffer";if(J==="[object DataView]")return"dataView";if(Number.isInteger($.byteLength)&&Number.isInteger($.byteOffset)&&G7.call($.buffer)==="[object ArrayBuffer]")return"typedArray";return"others"},{toString:G7}=Object.prototype;class H1 extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}var Y1=($)=>$,$0=()=>{return},e0=({contents:$})=>$,$$=($)=>{throw Error(`Streams in object mode are not supported: ${String($)}`)},q$=($)=>$.length;async function J$($,q){return h1($,iH,q)}var pH=()=>({contents:[]}),lH=()=>1,dH=($,{contents:q})=>{return q.push($),q},iH={init:pH,convertChunk:{string:Y1,buffer:Y1,arrayBuffer:Y1,dataView:Y1,typedArray:Y1,others:Y1},getSize:lH,truncateChunk:$0,addChunk:dH,getFinalChunk:$0,finalize:e0};async function X$($,q){return h1($,q9,q)}var nH=()=>({contents:new ArrayBuffer(0)}),aH=($)=>tH.encode($),tH=new TextEncoder,U7=($)=>new Uint8Array($),z7=($)=>new Uint8Array($.buffer,$.byteOffset,$.byteLength),oH=($,q)=>$.slice(0,q),rH=($,{contents:q,length:J},X)=>{let Z=_7()?eH(q,X):sH(q,X);return new Uint8Array(Z).set($,J),Z},sH=($,q)=>{if(q<=$.byteLength)return $;let J=new ArrayBuffer(L7(q));return new Uint8Array(J).set(new Uint8Array($),0),J},eH=($,q)=>{if(q<=$.maxByteLength)return $.resize(q),$;let J=new ArrayBuffer(q,{maxByteLength:L7(q)});return new Uint8Array(J).set(new Uint8Array($),0),J},L7=($)=>B7**Math.ceil(Math.log($)/Math.log(B7)),B7=2,$9=({contents:$,length:q})=>_7()?$:$.slice(0,q),_7=()=>("resize"in ArrayBuffer.prototype),q9={init:nH,convertChunk:{string:aH,buffer:U7,arrayBuffer:U7,dataView:z7,typedArray:z7,others:$$},getSize:q$,truncateChunk:oH,addChunk:rH,getFinalChunk:$0,finalize:$9};async function Q$($,q){return h1($,H9,q)}var J9=()=>({contents:"",textDecoder:new TextDecoder}),Z$=($,{textDecoder:q})=>q.decode($,{stream:!0}),X9=($,{contents:q})=>q+$,Z9=($,q)=>$.slice(0,q),Q9=({textDecoder:$})=>{let q=$.decode();return q===""?void 0:q},H9={init:J9,convertChunk:{string:Y1,buffer:Z$,arrayBuffer:Z$,dataView:Z$,typedArray:Z$,others:$$},getSize:q$,truncateChunk:Z9,addChunk:X9,getFinalChunk:Q9,finalize:e0};Object.assign(e1,{on:Y9,finished:G9});var V7=({error:$,stream:q,readableObjectMode:J,lines:X,encoding:Z,fdNumber:H})=>{if(!($ instanceof H1))throw $;if(H==="all")return $;let Q=K9(J,X,Z);throw $.maxBufferInfo={fdNumber:H,unit:Q},q.destroy(),$},K9=($,q,J)=>{if($)return"objects";if(q)return"lines";if(J==="buffer")return"bytes";return"characters"},R7=($,q,J)=>{if(q.length!==J)return;let X=new H1;throw X.maxBufferInfo={fdNumber:"ipc"},X},W7=($,q)=>{let{streamName:J,threshold:X,unit:Z}=U9($,q);return`Command's ${J} was larger than ${X} ${Z}`},U9=($,q)=>{if($?.maxBufferInfo===void 0)return{streamName:"output",threshold:q[1],unit:"bytes"};let{maxBufferInfo:{fdNumber:J,unit:X}}=$;delete $.maxBufferInfo;let Z=Q1(q,J);if(J==="ipc")return{streamName:"IPC output",threshold:Z,unit:"messages"};return{streamName:k0(J),threshold:Z,unit:X}},T7=($,q,J)=>$?.code==="ENOBUFS"&&q!==null&&q.some((X)=>X!==null&&X.length>H$(J)),P7=($,q,J)=>{if(!q)return $;let X=H$(J);return $.length>X?$.slice(0,X):$},H$=([,$])=>$;var F7=({stdio:$,all:q,ipcOutput:J,originalError:X,signal:Z,signalDescription:H,exitCode:Q,escapedCommand:Y,timedOut:G,isCanceled:K,isGracefullyCanceled:U,isMaxBuffer:z,isForcefullyTerminated:B,forceKillAfterDelay:L,killSignal:W,maxBuffer:P,timeout:M,cwd:F})=>{let O=X?.code,v=B9({originalError:X,timedOut:G,timeout:M,isMaxBuffer:z,maxBuffer:P,errorCode:O,signal:Z,signalDescription:H,exitCode:Q,isCanceled:K,isGracefullyCanceled:U,isForcefullyTerminated:B,forceKillAfterDelay:L,killSignal:W}),x=_9(X,F),w=x===void 0?"":`
58
- ${x}`,N=`${v}: ${Y}${w}`,g=q===void 0?[$[2],$[1]]:[q],K1=[N,...g,...$.slice(3),J.map((U1)=>V9(U1)).join(`
59
- `)].map((U1)=>t1(f1(R9(U1)))).filter(Boolean).join(`
56
+ ${$}`;return $};var r0=($,q,J)=>{J.cwd=o8(J.cwd);let[X,Z,H]=d8($,q,J),{command:Q,args:Y,options:G}=$7.default._parse(X,Z,H),K=c3(G),U=NH(K);if(m8(U),t8(U),i8(U),G8(U),g8(U),U.shell=Z2(U.shell),U.env=DH(U),U.killSignal=X8(U.killSignal),U.forceKillAfterDelay=H8(U.forceKillAfterDelay),U.lines=U.lines.map((z,B)=>z&&!m.has(U.encoding)&&U.buffer[B]),e8.platform==="win32"&&OH.basename(Q,".exe")==="cmd")Y.unshift("/q");return{file:Q,commandArguments:Y,options:U}},NH=({extendEnv:$=!0,preferLocal:q=!1,cwd:J,localDir:X=J,encoding:Z="utf8",reject:H=!0,cleanup:Q=!0,all:Y=!1,windowsHide:G=!0,killSignal:K="SIGTERM",forceKillAfterDelay:U=!0,gracefulCancel:z=!1,ipcInput:B,ipc:L=B!==void 0||z,serialization:R="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:z,ipcInput:B,ipc:L,serialization:R}),DH=({env:$,extendEnv:q,preferLocal:J,node:X,localDirectory:Z,nodePath:H})=>{let Q=q?{...e8.env,...$}:$;if(J||X)return n6({env:Q,cwd:Z,execPath:H,preferLocal:J,addExecPath:X});return Q};var s0=($,q,J)=>J.shell&&q.length>0?[[$,...q].join(" "),[],J]:[$,q,J];import{inspect as L9}from"node:util";function h1($){if(typeof $==="string")return vH($);if(!(ArrayBuffer.isView($)&&$.BYTES_PER_ELEMENT===1))throw Error("Input must be a string or a Uint8Array");return hH($)}var vH=($)=>$.at(-1)===q7?$.slice(0,$.at(-2)===J7?-2:-1):$,hH=($)=>$.at(-1)===SH?$.subarray(0,$.at(-2)===fH?-2:-1):$,q7=`
57
+ `,SH=q7.codePointAt(0),J7="\r",fH=J7.codePointAt(0);import{on as K9}from"node:events";import{finished as U9}from"node:stream/promises";function n($,{checkOpen:q=!0}={}){return $!==null&&typeof $==="object"&&($.writable||$.readable||!q||$.writable===void 0&&$.readable===void 0)&&typeof $.pipe==="function"}function v2($,{checkOpen:q=!0}={}){return n($,{checkOpen:q})&&($.writable||!q)&&typeof $.write==="function"&&typeof $.end==="function"&&typeof $.writable==="boolean"&&typeof $.writableObjectMode==="boolean"&&typeof $.destroy==="function"&&typeof $.destroyed==="boolean"}function P1($,{checkOpen:q=!0}={}){return n($,{checkOpen:q})&&($.readable||!q)&&typeof $.read==="function"&&typeof $.readable==="boolean"&&typeof $.readableObjectMode==="boolean"&&typeof $.destroy==="function"&&typeof $.destroyed==="boolean"}function h2($,q){return v2($,q)&&P1($,q)}var bH=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);class X7{#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 S2=Symbol();function Z7(){return this[S2].next()}Object.defineProperty(Z7,"name",{value:"next"});function Q7($){return this[S2].return($)}Object.defineProperty(Q7,"name",{value:"return"});var gH=Object.create(bH,{next:{enumerable:!0,configurable:!0,writable:!0,value:Z7},return:{enumerable:!0,configurable:!0,writable:!0,value:Q7}});function f2({preventCancel:$=!1}={}){let q=this.getReader(),J=new X7(q,$),X=Object.create(gH);return X[S2]=J,X}var H7=($)=>{if(P1($,{checkOpen:!1})&&e1.on!==void 0)return mH($);if(typeof $?.[Symbol.asyncIterator]==="function")return $;if(cH.call($)==="[object ReadableStream]")return f2.call($);throw TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:cH}=Object.prototype,mH=async function*($){let q=new AbortController,J={};uH($,q,J);try{for await(let[X]of e1.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()}},uH=async($,q,J)=>{try{await e1.finished($,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(X){J.error=X}finally{q.abort()}},e1={};var S1=async($,{init:q,convertChunk:J,getSize:X,truncateChunk:Z,addChunk:H,getFinalChunk:Q,finalize:Y},{maxBuffer:G=Number.POSITIVE_INFINITY}={})=>{let K=H7($),U=q();U.length=0;try{for await(let z of K){let B=lH(z),L=J[B](z,U);K7({convertedChunk:L,state:U,getSize:X,truncateChunk:Z,addChunk:H,maxBuffer:G})}return pH({state:U,convertChunk:J,getSize:X,truncateChunk:Z,addChunk:H,getFinalChunk:Q,maxBuffer:G}),Y(U)}catch(z){let B=typeof z==="object"&&z!==null?z:Error(z);throw B.bufferedData=Y(U),B}},pH=({state:$,getSize:q,truncateChunk:J,addChunk:X,getFinalChunk:Z,maxBuffer:H})=>{let Q=Z($);if(Q!==void 0)K7({convertedChunk:Q,state:$,getSize:q,truncateChunk:J,addChunk:X,maxBuffer:H})},K7=({convertedChunk:$,state:q,getSize:J,truncateChunk:X,addChunk:Z,maxBuffer:H})=>{let Q=J($),Y=q.length+Q;if(Y<=H){Y7($,q,Z,Y);return}let G=X($,H-q.length);if(G!==void 0)Y7(G,q,Z,H);throw new H1},Y7=($,q,J,X)=>{q.contents=J($,q,X),q.length=X},lH=($)=>{let q=typeof $;if(q==="string")return"string";if(q!=="object"||$===null)return"others";if(globalThis.Buffer?.isBuffer($))return"buffer";let J=G7.call($);if(J==="[object ArrayBuffer]")return"arrayBuffer";if(J==="[object DataView]")return"dataView";if(Number.isInteger($.byteLength)&&Number.isInteger($.byteOffset)&&G7.call($.buffer)==="[object ArrayBuffer]")return"typedArray";return"others"},{toString:G7}=Object.prototype;class H1 extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}var Y1=($)=>$,$0=()=>{return},e0=({contents:$})=>$,$$=($)=>{throw Error(`Streams in object mode are not supported: ${String($)}`)},q$=($)=>$.length;async function J$($,q){return S1($,aH,q)}var dH=()=>({contents:[]}),iH=()=>1,nH=($,{contents:q})=>{return q.push($),q},aH={init:dH,convertChunk:{string:Y1,buffer:Y1,arrayBuffer:Y1,dataView:Y1,typedArray:Y1,others:Y1},getSize:iH,truncateChunk:$0,addChunk:nH,getFinalChunk:$0,finalize:e0};async function X$($,q){return S1($,X9,q)}var tH=()=>({contents:new ArrayBuffer(0)}),oH=($)=>rH.encode($),rH=new TextEncoder,U7=($)=>new Uint8Array($),z7=($)=>new Uint8Array($.buffer,$.byteOffset,$.byteLength),sH=($,q)=>$.slice(0,q),eH=($,{contents:q,length:J},X)=>{let Z=V7()?q9(q,X):$9(q,X);return new Uint8Array(Z).set($,J),Z},$9=($,q)=>{if(q<=$.byteLength)return $;let J=new ArrayBuffer(L7(q));return new Uint8Array(J).set(new Uint8Array($),0),J},q9=($,q)=>{if(q<=$.maxByteLength)return $.resize(q),$;let J=new ArrayBuffer(q,{maxByteLength:L7(q)});return new Uint8Array(J).set(new Uint8Array($),0),J},L7=($)=>B7**Math.ceil(Math.log($)/Math.log(B7)),B7=2,J9=({contents:$,length:q})=>V7()?$:$.slice(0,q),V7=()=>("resize"in ArrayBuffer.prototype),X9={init:tH,convertChunk:{string:oH,buffer:U7,arrayBuffer:U7,dataView:z7,typedArray:z7,others:$$},getSize:q$,truncateChunk:sH,addChunk:eH,getFinalChunk:$0,finalize:J9};async function Q$($,q){return S1($,G9,q)}var Z9=()=>({contents:"",textDecoder:new TextDecoder}),Z$=($,{textDecoder:q})=>q.decode($,{stream:!0}),Q9=($,{contents:q})=>q+$,H9=($,q)=>$.slice(0,q),Y9=({textDecoder:$})=>{let q=$.decode();return q===""?void 0:q},G9={init:Z9,convertChunk:{string:Y1,buffer:Z$,arrayBuffer:Z$,dataView:Z$,typedArray:Z$,others:$$},getSize:q$,truncateChunk:H9,addChunk:Q9,getFinalChunk:Y9,finalize:e0};Object.assign(e1,{on:K9,finished:U9});var W7=({error:$,stream:q,readableObjectMode:J,lines:X,encoding:Z,fdNumber:H})=>{if(!($ instanceof H1))throw $;if(H==="all")return $;let Q=z9(J,X,Z);throw $.maxBufferInfo={fdNumber:H,unit:Q},q.destroy(),$},z9=($,q,J)=>{if($)return"objects";if(q)return"lines";if(J==="buffer")return"bytes";return"characters"},_7=($,q,J)=>{if(q.length!==J)return;let X=new H1;throw X.maxBufferInfo={fdNumber:"ipc"},X},R7=($,q)=>{let{streamName:J,threshold:X,unit:Z}=B9($,q);return`Command's ${J} was larger than ${X} ${Z}`},B9=($,q)=>{if($?.maxBufferInfo===void 0)return{streamName:"output",threshold:q[1],unit:"bytes"};let{maxBufferInfo:{fdNumber:J,unit:X}}=$;delete $.maxBufferInfo;let Z=Q1(q,J);if(J==="ipc")return{streamName:"IPC output",threshold:Z,unit:"messages"};return{streamName:k0(J),threshold:Z,unit:X}},T7=($,q,J)=>$?.code==="ENOBUFS"&&q!==null&&q.some((X)=>X!==null&&X.length>H$(J)),P7=($,q,J)=>{if(!q)return $;let X=H$(J);return $.length>X?$.slice(0,X):$},H$=([,$])=>$;var F7=({stdio:$,all:q,ipcOutput:J,originalError:X,signal:Z,signalDescription:H,exitCode:Q,escapedCommand:Y,timedOut:G,isCanceled:K,isGracefullyCanceled:U,isMaxBuffer:z,isForcefullyTerminated:B,forceKillAfterDelay:L,killSignal:R,maxBuffer:P,timeout:M,cwd:F})=>{let O=X?.code,v=V9({originalError:X,timedOut:G,timeout:M,isMaxBuffer:z,maxBuffer:P,errorCode:O,signal:Z,signalDescription:H,exitCode:Q,isCanceled:K,isGracefullyCanceled:U,isForcefullyTerminated:B,forceKillAfterDelay:L,killSignal:R}),x=_9(X,F),w=x===void 0?"":`
58
+ ${x}`,N=`${v}: ${Y}${w}`,g=q===void 0?[$[2],$[1]]:[q],K1=[N,...g,...$.slice(3),J.map((U1)=>R9(U1)).join(`
59
+ `)].map((U1)=>t1(h1(T9(U1)))).filter(Boolean).join(`
60
60
 
61
- `);return{originalMessage:x,shortMessage:N,message:K1}},B9=({originalError:$,timedOut:q,timeout:J,isMaxBuffer:X,maxBuffer:Z,errorCode:H,signal:Q,signalDescription:Y,exitCode:G,isCanceled:K,isGracefullyCanceled:U,isForcefullyTerminated:z,forceKillAfterDelay:B,killSignal:L})=>{let W=L9(z,B);if(q)return`Command timed out after ${J} milliseconds${W}`;if(U){if(Q===void 0)return`Command was gracefully canceled with exit code ${G}`;return z?`Command was gracefully canceled${W}`:`Command was gracefully canceled with ${Q} (${Y})`}if(K)return`Command was canceled${W}`;if(X)return`${W7($,Z)}${W}`;if(H!==void 0)return`Command failed with ${H}${W}`;if(z)return`Command was killed with ${L} (${h0(L)})${W}`;if(Q!==void 0)return`Command was killed with ${Q} (${Y})`;if(G!==void 0)return`Command failed with exit code ${G}`;return"Command failed"},L9=($,q)=>$?` and was forcefully terminated after ${q} milliseconds`:"",_9=($,q)=>{if($ instanceof r)return;let J=o6($)?$.originalMessage:String($?.message??$),X=t1(s8(J,q));return X===""?void 0:X},V9=($)=>typeof $==="string"?$:z9($),R9=($)=>Array.isArray($)?$.map((q)=>f1(k7(q))).filter(Boolean).join(`
62
- `):k7($),k7=($)=>{if(typeof $==="string")return $;if(D($))return T0($);return""};var Y$=({command:$,escapedCommand:q,stdio:J,all:X,ipcOutput:Z,options:{cwd:H},startTime:Q})=>x7({command:$,escapedCommand:q,cwd:H,durationMs:z2(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:[]}),S1=({error:$,command:q,escapedCommand:J,fileDescriptors:X,options:Z,startTime:H,isSync:Q})=>q0({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}),q0=({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:W,timeout:P=W,forceKillAfterDelay:M,killSignal:F,cwd:O,maxBuffer:v},isSync:x})=>{let{exitCode:w,signal:N,signalDescription:g}=T9(K,U),{originalMessage:K1,shortMessage:U1,message:d$}=F7({stdio:z,all:B,ipcOutput:L,originalError:$,signal:N,signalDescription:g,exitCode:w,escapedCommand:J,timedOut:Z,isCanceled:H,isGracefullyCanceled:Q,isMaxBuffer:Y,isForcefullyTerminated:G,forceKillAfterDelay:M,killSignal:F,maxBuffer:v,timeout:P,cwd:O}),i1=a6($,d$,x);return Object.assign(i1,W9({error:i1,command:q,escapedCommand:J,startTime:X,timedOut:Z,isCanceled:H,isGracefullyCanceled:Q,isMaxBuffer:Y,isForcefullyTerminated:G,exitCode:w,signal:N,signalDescription:g,stdio:z,all:B,ipcOutput:L,cwd:O,originalMessage:K1,shortMessage:U1})),i1},W9=({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:W,cwd:P,originalMessage:M,shortMessage:F})=>x7({shortMessage:F,originalMessage:M,command:q,escapedCommand:J,cwd:P,durationMs:z2(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:W,pipedFrom:[]}),x7=($)=>Object.fromEntries(Object.entries($).filter(([,q])=>q!==void 0)),T9=($,q)=>{let J=$===null?void 0:$,X=q===null?void 0:q,Z=X===void 0?void 0:h0(q);return{exitCode:J,signal:X,signalDescription:Z}};var j7=($)=>Number.isFinite($)?$:0;function P9($){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(j7($*1000)%1000),nanoseconds:Math.trunc(j7($*1e6)%1000)}}function k9($){return{days:$/86400000n,hours:$/3600000n%24n,minutes:$/60000n%60n,seconds:$/1000n%60n,milliseconds:$%1000n,microseconds:0n,nanoseconds:0n}}function S2($){switch(typeof $){case"number":{if(Number.isFinite($))return P9($);break}case"bigint":return k9($)}throw TypeError("Expected a finite number or bigint")}var F9=($)=>$===0||$===0n,x9=($,q)=>q===1||q===1n?$:`${$}s`,j9=0.0000001,M9=24n*60n*60n*1000n;function b2($,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+j9);return(Math.round(B)/10**z).toFixed(z)},Q=(U,z,B,L)=>{if((Z.length===0||!q.colonNotation)&&F9(U)&&!(q.colonNotation&&B==="m"))return;if(L??=String(U),q.colonNotation){let W=L.includes(".")?L.split(".")[0].length:L.length,P=Z.length>0?2:1;L="0".repeat(Math.max(0,P-W))+L}else L+=q.verbose?" "+x9(z,U):B;Z.push(L)},Y=S2($),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 W=z+B/1000+L/1e6,P=typeof q.millisecondsDecimalDigits==="number"?q.millisecondsDecimalDigits:0,M=W>=1?Math.round(W):Math.ceil(W),F=P?W.toFixed(P):M;Q(Number.parseFloat(F),"millisecond","ms",F)}}else{let U=(J?Number($%M9):$)/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 M7=($,q)=>{if($.failed)o({type:"error",verboseMessage:$.shortMessage,verboseInfo:q,result:$})};var C7=($,q)=>{if(!A1(q))return;M7($,q),C9($,q)},C9=($,q)=>{let J=`(done in ${b2($.durationMs)})`;o({type:"duration",verboseMessage:J,verboseInfo:q,result:$})};var b1=($,q,{reject:J})=>{if(C7($,q),$.failed&&J)throw $;return $};import{readFileSync as s7}from"node:fs";var A7=($,q)=>{if(k1($))return"asyncGenerator";if(O7($))return"generator";if(G$($))return"fileUrl";if(y9($))return"filePath";if(D9($))return"webStream";if(n($,{checkOpen:!1}))return"native";if(D($))return"uint8Array";if(v9($))return"asyncIterable";if(f9($))return"iterable";if(m2($))return E7({transform:$},q);if(E9($))return I9($,q);return"native"},I9=($,q)=>{if(v2($.transform,{checkOpen:!1}))return w9($,q);if(m2($.transform))return E7($,q);return A9($,q)},w9=($,q)=>{return y7($,q,"Duplex stream"),"duplex"},E7=($,q)=>{return y7($,q,"web TransformStream"),"webTransform"},y7=({final:$,binary:q,objectMode:J},X,Z)=>{I7($,`${X}.final`,Z),I7(q,`${X}.binary`,Z),g2(J,`${X}.objectMode`)},I7=($,q,J)=>{if($!==void 0)throw TypeError(`The \`${q}\` option can only be defined when using a generator, not a ${J}.`)},A9=({transform:$,final:q,binary:J,objectMode:X},Z)=>{if($!==void 0&&!w7($))throw TypeError(`The \`${Z}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(v2(q,{checkOpen:!1}))throw TypeError(`The \`${Z}.final\` option must not be a Duplex stream.`);if(m2(q))throw TypeError(`The \`${Z}.final\` option must not be a web TransformStream.`);if(q!==void 0&&!w7(q))throw TypeError(`The \`${Z}.final\` option must be a generator.`);return g2(J,`${Z}.binary`),g2(X,`${Z}.objectMode`),k1($)||k1(q)?"asyncGenerator":"generator"},g2=($,q)=>{if($!==void 0&&typeof $!=="boolean")throw TypeError(`The \`${q}\` option must use a boolean.`)},w7=($)=>k1($)||O7($),k1=($)=>Object.prototype.toString.call($)==="[object AsyncGeneratorFunction]",O7=($)=>Object.prototype.toString.call($)==="[object GeneratorFunction]",E9=($)=>E($)&&($.transform!==void 0||$.final!==void 0),G$=($)=>Object.prototype.toString.call($)==="[object URL]",N7=($)=>G$($)&&$.protocol!=="file:",y9=($)=>E($)&&Object.keys($).length>0&&Object.keys($).every((q)=>O9.has(q))&&c2($.file),O9=new Set(["file","append"]),c2=($)=>typeof $==="string",D7=($,q)=>$==="native"&&typeof q==="string"&&!N9.has(q),N9=new Set(["ipc","ignore","inherit","overlapped","pipe"]),v7=($)=>Object.prototype.toString.call($)==="[object ReadableStream]",K$=($)=>Object.prototype.toString.call($)==="[object WritableStream]",D9=($)=>v7($)||K$($),m2=($)=>v7($?.readable)&&K$($?.writable),v9=($)=>f7($)&&typeof $[Symbol.asyncIterator]==="function",f9=($)=>f7($)&&typeof $[Symbol.iterator]==="function",f7=($)=>typeof $==="object"&&$!==null,l=new Set(["generator","asyncGenerator","duplex","webTransform"]),U$=new Set(["fileUrl","filePath","fileNumber"]),u2=new Set(["fileUrl","filePath"]),h7=new Set([...u2,"webStream","nodeStream"]),S7=new Set(["webTransform","duplex"]),L1={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 p2=($,q,J,X)=>X==="output"?h9($,q,J):S9($,q,J),h9=($,q,J)=>{let X=q!==0&&J[q-1].value.readableObjectMode;return{writableObjectMode:X,readableObjectMode:$??X}},S9=($,q,J)=>{let X=q===0?$===!0:J[q-1].value.readableObjectMode,Z=q!==J.length-1&&($??X);return{writableObjectMode:X,readableObjectMode:Z}},b7=($,q)=>{let J=$.findLast(({type:X})=>l.has(X));if(J===void 0)return!1;return q==="input"?J.value.writableObjectMode:J.value.readableObjectMode};var g7=($,q,J,X)=>[...$.filter(({type:Z})=>!l.has(Z)),...b9($,q,J,X)],b9=($,q,J,{encoding:X})=>{let Z=$.filter(({type:Q})=>l.has(Q)),H=Array.from({length:Z.length});for(let[Q,Y]of Object.entries(Z))H[Q]=g9({stdioItem:Y,index:Number(Q),newTransforms:H,optionName:q,direction:J,encoding:X});return p9(H,J)},g9=({stdioItem:$,stdioItem:{type:q},index:J,newTransforms:X,optionName:Z,direction:H,encoding:Q})=>{if(q==="duplex")return c9({stdioItem:$,optionName:Z});if(q==="webTransform")return m9({stdioItem:$,index:J,newTransforms:X,direction:H});return u9({stdioItem:$,index:J,newTransforms:X,direction:H,encoding:Q})},c9=({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}}},m9=({stdioItem:$,stdioItem:{value:q},index:J,newTransforms:X,direction:Z})=>{let{transform:H,objectMode:Q}=E(q)?q:{transform:q},{writableObjectMode:Y,readableObjectMode:G}=p2(Q,J,X,Z);return{...$,value:{transform:H,writableObjectMode:Y,readableObjectMode:G}}},u9=({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||m.has(H),{writableObjectMode:B,readableObjectMode:L}=p2(U,J,X,Z);return{...$,value:{transform:Q,final:Y,binary:z,preserveNewlines:K,writableObjectMode:B,readableObjectMode:L}}},p9=($,q)=>q==="input"?$.reverse():$;import l2 from"node:process";var c7=($,q,J)=>{let X=$.map((Z)=>l9(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)??n9},l9=({type:$,value:q},J)=>d9[J]??m7[$](q),d9=["input","output","output"],g1=()=>{return},d2=()=>"input",m7={generator:g1,asyncGenerator:g1,fileUrl:g1,filePath:g1,iterable:d2,asyncIterable:d2,uint8Array:d2,webStream:($)=>K$($)?"output":"input",nodeStream($){if(!P1($,{checkOpen:!1}))return"output";return D2($,{checkOpen:!1})?void 0:"input"},webTransform:g1,duplex:g1,native($){let q=i9($);if(q!==void 0)return q;if(n($,{checkOpen:!1}))return m7.nodeStream($)}},i9=($)=>{if([0,l2.stdin].includes($))return"input";if([1,2,l2.stdout,l2.stderr].includes($))return"output"},n9="output";var u7=($,q)=>q&&!$.includes("ipc")?[...$,"ipc"]:$;var p7=({stdio:$,ipc:q,buffer:J,...X},Z,H)=>{let Q=a9($,X).map((Y,G)=>l7(Y,G));return H?o9(Q,J,Z):u7(Q,q)},a9=($,q)=>{if($===void 0)return p.map((X)=>q[X]);if(t9(q))throw Error(`It's not possible to provide \`stdio\` in combination with one of ${p.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,p.length);return Array.from({length:J},(X,Z)=>$[Z])},t9=($)=>p.some((q)=>$[q]!==void 0),l7=($,q)=>{if(Array.isArray($))return $.map((J)=>l7(J,q));if($===null||$===void 0)return q>=p.length?"ignore":"pipe";return $},o9=($,q,J)=>$.map((X,Z)=>!q[Z]&&Z!==0&&!E1(J,Z)&&r9(X)?"ignore":X),r9=($)=>$==="pipe"||Array.isArray($)&&$.every((q)=>q==="pipe");import{readFileSync as s9}from"node:fs";import e9 from"node:tty";var i7=({stdioItem:$,stdioItem:{type:q},isStdioArray:J,fdNumber:X,direction:Z,isSync:H})=>{if(!J||q!=="native")return $;return H?$Y({stdioItem:$,fdNumber:X,direction:Z}):XY({stdioItem:$,fdNumber:X})},$Y=({stdioItem:$,stdioItem:{value:q,optionName:J},fdNumber:X,direction:Z})=>{let H=qY({value:q,optionName:J,fdNumber:X,direction:Z});if(H!==void 0)return H;if(n(q,{checkOpen:!1}))throw TypeError(`The \`${J}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return $},qY=({value:$,optionName:q,fdNumber:J,direction:X})=>{let Z=JY($,J);if(Z===void 0)return;if(X==="output")return{type:"fileNumber",value:Z,optionName:q};if(e9.isatty(Z))throw TypeError(`The \`${q}: ${g0($)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:Z1(s9(Z)),optionName:q}},JY=($,q)=>{if($==="inherit")return q;if(typeof $==="number")return $;let J=P0.indexOf($);if(J!==-1)return J},XY=({stdioItem:$,stdioItem:{value:q,optionName:J},fdNumber:X})=>{if(q==="inherit")return{type:"nodeStream",value:d7(X,q,J),optionName:J};if(typeof q==="number")return{type:"nodeStream",value:d7(q,q,J),optionName:J};if(n(q,{checkOpen:!1}))return{type:"nodeStream",value:q,optionName:J};return $},d7=($,q,J)=>{let X=P0[$];if(X===void 0)throw TypeError(`The \`${J}: ${q}\` option is invalid: no such standard stream.`);return X};var n7=({input:$,inputFile:q},J)=>J===0?[...ZY($),...HY(q)]:[],ZY=($)=>$===void 0?[]:[{type:QY($),value:$,optionName:"input"}],QY=($)=>{if(P1($,{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.")},HY=($)=>$===void 0?[]:[{...YY($),optionName:"inputFile"}],YY=($)=>{if(G$($))return{type:"fileUrl",value:$};if(c2($))return{type:"filePath",value:{file:$}};throw Error("The `inputFile` option must be a file path string or a file URL.")};var a7=($)=>$.filter((q,J)=>$.every((X,Z)=>q.value!==X.value||J>=Z||q.type==="generator"||q.type==="asyncGenerator")),t7=({stdioItem:{type:$,value:q,optionName:J},direction:X,fileDescriptors:Z,isSync:H})=>{let Q=GY(Z,$);if(Q.length===0)return;if(H){KY({otherStdioItems:Q,type:$,value:q,optionName:J,direction:X});return}if(h7.has($))return o7({otherStdioItems:Q,type:$,value:q,optionName:J,direction:X});if(S7.has($))zY({otherStdioItems:Q,type:$,value:q,optionName:J})},GY=($,q)=>$.flatMap(({direction:J,stdioItems:X})=>X.filter((Z)=>Z.type===q).map((Z)=>({...Z,direction:J}))),KY=({otherStdioItems:$,type:q,value:J,optionName:X,direction:Z})=>{if(u2.has(q))o7({otherStdioItems:$,type:q,value:J,optionName:X,direction:Z})},o7=({otherStdioItems:$,type:q,value:J,optionName:X,direction:Z})=>{let H=$.filter((Y)=>UY(Y,J));if(H.length===0)return;let Q=H.find((Y)=>Y.direction!==Z);return r7(Q,X,q),Z==="output"?H[0].stream:void 0},UY=({type:$,value:q},J)=>{if($==="filePath")return q.file===J.file;if($==="fileUrl")return q.href===J.href;return q===J},zY=({otherStdioItems:$,type:q,value:J,optionName:X})=>{let Z=$.find(({value:{transform:H}})=>H===J.transform);r7(Z,X,q)},r7=($,q,J)=>{if($!==void 0)throw TypeError(`The \`${$.optionName}\` and \`${q}\` options must not target ${L1[J]} that is the same.`)};var z$=($,q,J,X)=>{let H=p7(q,J,X).map((Y,G)=>BY({stdioOption:Y,fdNumber:G,options:q,isSync:X})),Q=kY({initialFileDescriptors:H,addProperties:$,options:q,isSync:X});return q.stdio=Q.map(({stdioItems:Y})=>jY(Y)),Q},BY=({stdioOption:$,fdNumber:q,options:J,isSync:X})=>{let Z=k0(q),{stdioItems:H,isStdioArray:Q}=LY({stdioOption:$,fdNumber:q,options:J,optionName:Z}),Y=c7(H,q,Z),G=H.map((z)=>i7({stdioItem:z,isStdioArray:Q,fdNumber:q,direction:Y,isSync:X})),K=g7(G,Z,Y,J),U=b7(K,Y);return PY(K,U),{direction:Y,objectMode:U,stdioItems:K}},LY=({stdioOption:$,fdNumber:q,options:J,optionName:X})=>{let H=[...(Array.isArray($)?$:[$]).map((G)=>_Y(G,X)),...n7(J,q)],Q=a7(H),Y=Q.length>1;return VY(Q,Y,X),WY(Q),{stdioItems:Q,isStdioArray:Y}},_Y=($,q)=>({type:A7($,q),value:$,optionName:q}),VY=($,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(RY.has(X))throw Error(`The \`${Z}\` option must not include \`${X}\`.`)},RY=new Set(["ignore","ipc"]),WY=($)=>{for(let q of $)TY(q)},TY=({type:$,value:q,optionName:J})=>{if(N7(q))throw TypeError(`The \`${J}: URL\` option must use the \`file:\` scheme.
63
- For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(D7($,q))throw TypeError(`The \`${J}: { file: '...' }\` option must be used instead of \`${J}: '...'\`.`)},PY=($,q)=>{if(!q)return;let J=$.find(({type:X})=>U$.has(X));if(J!==void 0)throw TypeError(`The \`${J.optionName}\` option cannot use both files and transforms in objectMode.`)},kY=({initialFileDescriptors:$,addProperties:q,options:J,isSync:X})=>{let Z=[];try{for(let H of $)Z.push(FY({fileDescriptor:H,fileDescriptors:Z,addProperties:q,options:J,isSync:X}));return Z}catch(H){throw i2(Z),H}},FY=({fileDescriptor:{direction:$,objectMode:q,stdioItems:J},fileDescriptors:X,addProperties:Z,options:H,isSync:Q})=>{let Y=J.map((G)=>xY({stdioItem:G,addProperties:Z,direction:$,options:H,fileDescriptors:X,isSync:Q}));return{direction:$,objectMode:q,stdioItems:Y}},xY=({stdioItem:$,addProperties:q,direction:J,options:X,fileDescriptors:Z,isSync:H})=>{let Q=t7({stdioItem:$,direction:J,fileDescriptors:Z,isSync:H});if(Q!==void 0)return{...$,stream:Q};return{...$,...q[J][$.type]($,X)}},i2=($)=>{for(let{stdioItems:q}of $)for(let{stream:J}of q)if(J!==void 0&&!d(J))J.destroy()},jY=($)=>{if($.length>1)return $.some(({value:X})=>X==="overlapped")?"overlapped":"pipe";let[{type:q,value:J}]=$;return q==="native"?J:"pipe"};var $5=($,q)=>z$(CY,$,q,!0),$1=({type:$,optionName:q})=>{q5(q,L1[$])},MY=({optionName:$,value:q})=>{if(q==="ipc"||q==="overlapped")q5($,`"${q}"`);return{}},q5=($,q)=>{throw TypeError(`The \`${$}\` option cannot be ${q} with synchronous methods.`)},e7={generator(){},asyncGenerator:$1,webStream:$1,nodeStream:$1,webTransform:$1,duplex:$1,asyncIterable:$1,native:MY},CY={input:{...e7,fileUrl:({value:$})=>({contents:[Z1(s7($))]}),filePath:({value:{file:$}})=>({contents:[Z1(s7($))]}),fileNumber:$1,iterable:({value:$})=>({contents:[...$]}),string:({value:$})=>({contents:[$]}),uint8Array:({value:$})=>({contents:[$]})},output:{...e7,fileUrl:({value:$})=>({path:$}),filePath:({value:{file:$,append:q}})=>({path:$,append:q}),fileNumber:({value:$})=>({path:$}),iterable:$1,string:$1,uint8Array:$1}};var G1=($,{stripFinalNewline:q},J)=>n2(q,J)&&$!==void 0&&!Array.isArray($)?f1($):$,n2=($,q)=>q==="all"?$[1]||$[2]:$[q];import{Transform as iY,getDefaultHighWaterMark as B5}from"node:stream";var B$=($,q,J,X)=>$||J?void 0:X5(q,X),t2=($,q,J)=>J?$.flatMap((X)=>J5(X,q)):J5($,q),J5=($,q)=>{let{transform:J,final:X}=X5(q,{});return[...J($),...X()]},X5=($,q)=>{return q.previousChunks="",{transform:IY.bind(void 0,q,$),final:AY.bind(void 0,q)}},IY=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=wY(J,H,q,$),Y=J.slice(Z+1,H+1-Q);if(X.length>0)Y=a2(X,Y),X="";yield Y,Z=H}if(Z!==J.length-1)X=a2(X,J.slice(Z+1));$.previousChunks=X},wY=($,q,J,X)=>{if(J)return 0;return X.isWindowsNewline=q!==0&&$[q-1]==="\r",X.isWindowsNewline?2:1},AY=function*({previousChunks:$}){if($.length>0)yield $},Z5=({binary:$,preserveNewlines:q,readableObjectMode:J,state:X})=>$||q||J?void 0:{transform:EY.bind(void 0,X)},EY=function*({isWindowsNewline:$=!1},q){let{unixNewline:J,windowsNewline:X,LF:Z,concatBytes:H}=typeof q==="string"?yY:NY;if(q.at(-1)===Z){yield q;return}yield H(q,$?X:J)},a2=($,q)=>`${$}${q}`,yY={windowsNewline:`\r
61
+ `);return{originalMessage:x,shortMessage:N,message:K1}},V9=({originalError:$,timedOut:q,timeout:J,isMaxBuffer:X,maxBuffer:Z,errorCode:H,signal:Q,signalDescription:Y,exitCode:G,isCanceled:K,isGracefullyCanceled:U,isForcefullyTerminated:z,forceKillAfterDelay:B,killSignal:L})=>{let R=W9(z,B);if(q)return`Command timed out after ${J} milliseconds${R}`;if(U){if(Q===void 0)return`Command was gracefully canceled with exit code ${G}`;return z?`Command was gracefully canceled${R}`:`Command was gracefully canceled with ${Q} (${Y})`}if(K)return`Command was canceled${R}`;if(X)return`${R7($,Z)}${R}`;if(H!==void 0)return`Command failed with ${H}${R}`;if(z)return`Command was killed with ${L} (${S0(L)})${R}`;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"},W9=($,q)=>$?` and was forcefully terminated after ${q} milliseconds`:"",_9=($,q)=>{if($ instanceof r)return;let J=o6($)?$.originalMessage:String($?.message??$),X=t1(s8(J,q));return X===""?void 0:X},R9=($)=>typeof $==="string"?$:L9($),T9=($)=>Array.isArray($)?$.map((q)=>h1(k7(q))).filter(Boolean).join(`
62
+ `):k7($),k7=($)=>{if(typeof $==="string")return $;if(D($))return T0($);return""};var Y$=({command:$,escapedCommand:q,stdio:J,all:X,ipcOutput:Z,options:{cwd:H},startTime:Q})=>x7({command:$,escapedCommand:q,cwd:H,durationMs:B2(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:[]}),f1=({error:$,command:q,escapedCommand:J,fileDescriptors:X,options:Z,startTime:H,isSync:Q})=>q0({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}),q0=({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:R,timeout:P=R,forceKillAfterDelay:M,killSignal:F,cwd:O,maxBuffer:v},isSync:x})=>{let{exitCode:w,signal:N,signalDescription:g}=k9(K,U),{originalMessage:K1,shortMessage:U1,message:i$}=F7({stdio:z,all:B,ipcOutput:L,originalError:$,signal:N,signalDescription:g,exitCode:w,escapedCommand:J,timedOut:Z,isCanceled:H,isGracefullyCanceled:Q,isMaxBuffer:Y,isForcefullyTerminated:G,forceKillAfterDelay:M,killSignal:F,maxBuffer:v,timeout:P,cwd:O}),i1=a6($,i$,x);return Object.assign(i1,P9({error:i1,command:q,escapedCommand:J,startTime:X,timedOut:Z,isCanceled:H,isGracefullyCanceled:Q,isMaxBuffer:Y,isForcefullyTerminated:G,exitCode:w,signal:N,signalDescription:g,stdio:z,all:B,ipcOutput:L,cwd:O,originalMessage:K1,shortMessage:U1})),i1},P9=({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:R,cwd:P,originalMessage:M,shortMessage:F})=>x7({shortMessage:F,originalMessage:M,command:q,escapedCommand:J,cwd:P,durationMs:B2(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:R,pipedFrom:[]}),x7=($)=>Object.fromEntries(Object.entries($).filter(([,q])=>q!==void 0)),k9=($,q)=>{let J=$===null?void 0:$,X=q===null?void 0:q,Z=X===void 0?void 0:S0(q);return{exitCode:J,signal:X,signalDescription:Z}};var j7=($)=>Number.isFinite($)?$:0;function F9($){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(j7($*1000)%1000),nanoseconds:Math.trunc(j7($*1e6)%1000)}}function x9($){return{days:$/86400000n,hours:$/3600000n%24n,minutes:$/60000n%60n,seconds:$/1000n%60n,milliseconds:$%1000n,microseconds:0n,nanoseconds:0n}}function b2($){switch(typeof $){case"number":{if(Number.isFinite($))return F9($);break}case"bigint":return x9($)}throw TypeError("Expected a finite number or bigint")}var j9=($)=>$===0||$===0n,M9=($,q)=>q===1||q===1n?$:`${$}s`,C9=0.0000001,I9=24n*60n*60n*1000n;function g2($,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+C9);return(Math.round(B)/10**z).toFixed(z)},Q=(U,z,B,L)=>{if((Z.length===0||!q.colonNotation)&&j9(U)&&!(q.colonNotation&&B==="m"))return;if(L??=String(U),q.colonNotation){let R=L.includes(".")?L.split(".")[0].length:L.length,P=Z.length>0?2:1;L="0".repeat(Math.max(0,P-R))+L}else L+=q.verbose?" "+M9(z,U):B;Z.push(L)},Y=b2($),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 R=z+B/1000+L/1e6,P=typeof q.millisecondsDecimalDigits==="number"?q.millisecondsDecimalDigits:0,M=R>=1?Math.round(R):Math.ceil(R),F=P?R.toFixed(P):M;Q(Number.parseFloat(F),"millisecond","ms",F)}}else{let U=(J?Number($%I9):$)/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 M7=($,q)=>{if($.failed)o({type:"error",verboseMessage:$.shortMessage,verboseInfo:q,result:$})};var C7=($,q)=>{if(!A1(q))return;M7($,q),w9($,q)},w9=($,q)=>{let J=`(done in ${g2($.durationMs)})`;o({type:"duration",verboseMessage:J,verboseInfo:q,result:$})};var b1=($,q,{reject:J})=>{if(C7($,q),$.failed&&J)throw $;return $};import{readFileSync as s7}from"node:fs";var A7=($,q)=>{if(k1($))return"asyncGenerator";if(O7($))return"generator";if(G$($))return"fileUrl";if(N9($))return"filePath";if(h9($))return"webStream";if(n($,{checkOpen:!1}))return"native";if(D($))return"uint8Array";if(S9($))return"asyncIterable";if(f9($))return"iterable";if(u2($))return E7({transform:$},q);if(O9($))return A9($,q);return"native"},A9=($,q)=>{if(h2($.transform,{checkOpen:!1}))return E9($,q);if(u2($.transform))return E7($,q);return y9($,q)},E9=($,q)=>{return y7($,q,"Duplex stream"),"duplex"},E7=($,q)=>{return y7($,q,"web TransformStream"),"webTransform"},y7=({final:$,binary:q,objectMode:J},X,Z)=>{I7($,`${X}.final`,Z),I7(q,`${X}.binary`,Z),c2(J,`${X}.objectMode`)},I7=($,q,J)=>{if($!==void 0)throw TypeError(`The \`${q}\` option can only be defined when using a generator, not a ${J}.`)},y9=({transform:$,final:q,binary:J,objectMode:X},Z)=>{if($!==void 0&&!w7($))throw TypeError(`The \`${Z}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(h2(q,{checkOpen:!1}))throw TypeError(`The \`${Z}.final\` option must not be a Duplex stream.`);if(u2(q))throw TypeError(`The \`${Z}.final\` option must not be a web TransformStream.`);if(q!==void 0&&!w7(q))throw TypeError(`The \`${Z}.final\` option must be a generator.`);return c2(J,`${Z}.binary`),c2(X,`${Z}.objectMode`),k1($)||k1(q)?"asyncGenerator":"generator"},c2=($,q)=>{if($!==void 0&&typeof $!=="boolean")throw TypeError(`The \`${q}\` option must use a boolean.`)},w7=($)=>k1($)||O7($),k1=($)=>Object.prototype.toString.call($)==="[object AsyncGeneratorFunction]",O7=($)=>Object.prototype.toString.call($)==="[object GeneratorFunction]",O9=($)=>E($)&&($.transform!==void 0||$.final!==void 0),G$=($)=>Object.prototype.toString.call($)==="[object URL]",N7=($)=>G$($)&&$.protocol!=="file:",N9=($)=>E($)&&Object.keys($).length>0&&Object.keys($).every((q)=>D9.has(q))&&m2($.file),D9=new Set(["file","append"]),m2=($)=>typeof $==="string",D7=($,q)=>$==="native"&&typeof q==="string"&&!v9.has(q),v9=new Set(["ipc","ignore","inherit","overlapped","pipe"]),v7=($)=>Object.prototype.toString.call($)==="[object ReadableStream]",K$=($)=>Object.prototype.toString.call($)==="[object WritableStream]",h9=($)=>v7($)||K$($),u2=($)=>v7($?.readable)&&K$($?.writable),S9=($)=>h7($)&&typeof $[Symbol.asyncIterator]==="function",f9=($)=>h7($)&&typeof $[Symbol.iterator]==="function",h7=($)=>typeof $==="object"&&$!==null,l=new Set(["generator","asyncGenerator","duplex","webTransform"]),U$=new Set(["fileUrl","filePath","fileNumber"]),p2=new Set(["fileUrl","filePath"]),S7=new Set([...p2,"webStream","nodeStream"]),f7=new Set(["webTransform","duplex"]),L1={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 l2=($,q,J,X)=>X==="output"?b9($,q,J):g9($,q,J),b9=($,q,J)=>{let X=q!==0&&J[q-1].value.readableObjectMode;return{writableObjectMode:X,readableObjectMode:$??X}},g9=($,q,J)=>{let X=q===0?$===!0:J[q-1].value.readableObjectMode,Z=q!==J.length-1&&($??X);return{writableObjectMode:X,readableObjectMode:Z}},b7=($,q)=>{let J=$.findLast(({type:X})=>l.has(X));if(J===void 0)return!1;return q==="input"?J.value.writableObjectMode:J.value.readableObjectMode};var g7=($,q,J,X)=>[...$.filter(({type:Z})=>!l.has(Z)),...c9($,q,J,X)],c9=($,q,J,{encoding:X})=>{let Z=$.filter(({type:Q})=>l.has(Q)),H=Array.from({length:Z.length});for(let[Q,Y]of Object.entries(Z))H[Q]=m9({stdioItem:Y,index:Number(Q),newTransforms:H,optionName:q,direction:J,encoding:X});return d9(H,J)},m9=({stdioItem:$,stdioItem:{type:q},index:J,newTransforms:X,optionName:Z,direction:H,encoding:Q})=>{if(q==="duplex")return u9({stdioItem:$,optionName:Z});if(q==="webTransform")return p9({stdioItem:$,index:J,newTransforms:X,direction:H});return l9({stdioItem:$,index:J,newTransforms:X,direction:H,encoding:Q})},u9=({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}}},p9=({stdioItem:$,stdioItem:{value:q},index:J,newTransforms:X,direction:Z})=>{let{transform:H,objectMode:Q}=E(q)?q:{transform:q},{writableObjectMode:Y,readableObjectMode:G}=l2(Q,J,X,Z);return{...$,value:{transform:H,writableObjectMode:Y,readableObjectMode:G}}},l9=({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||m.has(H),{writableObjectMode:B,readableObjectMode:L}=l2(U,J,X,Z);return{...$,value:{transform:Q,final:Y,binary:z,preserveNewlines:K,writableObjectMode:B,readableObjectMode:L}}},d9=($,q)=>q==="input"?$.reverse():$;import d2 from"node:process";var c7=($,q,J)=>{let X=$.map((Z)=>i9(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)??t9},i9=({type:$,value:q},J)=>n9[J]??m7[$](q),n9=["input","output","output"],g1=()=>{return},i2=()=>"input",m7={generator:g1,asyncGenerator:g1,fileUrl:g1,filePath:g1,iterable:i2,asyncIterable:i2,uint8Array:i2,webStream:($)=>K$($)?"output":"input",nodeStream($){if(!P1($,{checkOpen:!1}))return"output";return v2($,{checkOpen:!1})?void 0:"input"},webTransform:g1,duplex:g1,native($){let q=a9($);if(q!==void 0)return q;if(n($,{checkOpen:!1}))return m7.nodeStream($)}},a9=($)=>{if([0,d2.stdin].includes($))return"input";if([1,2,d2.stdout,d2.stderr].includes($))return"output"},t9="output";var u7=($,q)=>q&&!$.includes("ipc")?[...$,"ipc"]:$;var p7=({stdio:$,ipc:q,buffer:J,...X},Z,H)=>{let Q=o9($,X).map((Y,G)=>l7(Y,G));return H?s9(Q,J,Z):u7(Q,q)},o9=($,q)=>{if($===void 0)return p.map((X)=>q[X]);if(r9(q))throw Error(`It's not possible to provide \`stdio\` in combination with one of ${p.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,p.length);return Array.from({length:J},(X,Z)=>$[Z])},r9=($)=>p.some((q)=>$[q]!==void 0),l7=($,q)=>{if(Array.isArray($))return $.map((J)=>l7(J,q));if($===null||$===void 0)return q>=p.length?"ignore":"pipe";return $},s9=($,q,J)=>$.map((X,Z)=>!q[Z]&&Z!==0&&!E1(J,Z)&&e9(X)?"ignore":X),e9=($)=>$==="pipe"||Array.isArray($)&&$.every((q)=>q==="pipe");import{readFileSync as $Y}from"node:fs";import qY from"node:tty";var i7=({stdioItem:$,stdioItem:{type:q},isStdioArray:J,fdNumber:X,direction:Z,isSync:H})=>{if(!J||q!=="native")return $;return H?JY({stdioItem:$,fdNumber:X,direction:Z}):QY({stdioItem:$,fdNumber:X})},JY=({stdioItem:$,stdioItem:{value:q,optionName:J},fdNumber:X,direction:Z})=>{let H=XY({value:q,optionName:J,fdNumber:X,direction:Z});if(H!==void 0)return H;if(n(q,{checkOpen:!1}))throw TypeError(`The \`${J}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return $},XY=({value:$,optionName:q,fdNumber:J,direction:X})=>{let Z=ZY($,J);if(Z===void 0)return;if(X==="output")return{type:"fileNumber",value:Z,optionName:q};if(qY.isatty(Z))throw TypeError(`The \`${q}: ${g0($)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:Z1($Y(Z)),optionName:q}},ZY=($,q)=>{if($==="inherit")return q;if(typeof $==="number")return $;let J=P0.indexOf($);if(J!==-1)return J},QY=({stdioItem:$,stdioItem:{value:q,optionName:J},fdNumber:X})=>{if(q==="inherit")return{type:"nodeStream",value:d7(X,q,J),optionName:J};if(typeof q==="number")return{type:"nodeStream",value:d7(q,q,J),optionName:J};if(n(q,{checkOpen:!1}))return{type:"nodeStream",value:q,optionName:J};return $},d7=($,q,J)=>{let X=P0[$];if(X===void 0)throw TypeError(`The \`${J}: ${q}\` option is invalid: no such standard stream.`);return X};var n7=({input:$,inputFile:q},J)=>J===0?[...HY($),...GY(q)]:[],HY=($)=>$===void 0?[]:[{type:YY($),value:$,optionName:"input"}],YY=($)=>{if(P1($,{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.")},GY=($)=>$===void 0?[]:[{...KY($),optionName:"inputFile"}],KY=($)=>{if(G$($))return{type:"fileUrl",value:$};if(m2($))return{type:"filePath",value:{file:$}};throw Error("The `inputFile` option must be a file path string or a file URL.")};var a7=($)=>$.filter((q,J)=>$.every((X,Z)=>q.value!==X.value||J>=Z||q.type==="generator"||q.type==="asyncGenerator")),t7=({stdioItem:{type:$,value:q,optionName:J},direction:X,fileDescriptors:Z,isSync:H})=>{let Q=UY(Z,$);if(Q.length===0)return;if(H){zY({otherStdioItems:Q,type:$,value:q,optionName:J,direction:X});return}if(S7.has($))return o7({otherStdioItems:Q,type:$,value:q,optionName:J,direction:X});if(f7.has($))LY({otherStdioItems:Q,type:$,value:q,optionName:J})},UY=($,q)=>$.flatMap(({direction:J,stdioItems:X})=>X.filter((Z)=>Z.type===q).map((Z)=>({...Z,direction:J}))),zY=({otherStdioItems:$,type:q,value:J,optionName:X,direction:Z})=>{if(p2.has(q))o7({otherStdioItems:$,type:q,value:J,optionName:X,direction:Z})},o7=({otherStdioItems:$,type:q,value:J,optionName:X,direction:Z})=>{let H=$.filter((Y)=>BY(Y,J));if(H.length===0)return;let Q=H.find((Y)=>Y.direction!==Z);return r7(Q,X,q),Z==="output"?H[0].stream:void 0},BY=({type:$,value:q},J)=>{if($==="filePath")return q.file===J.file;if($==="fileUrl")return q.href===J.href;return q===J},LY=({otherStdioItems:$,type:q,value:J,optionName:X})=>{let Z=$.find(({value:{transform:H}})=>H===J.transform);r7(Z,X,q)},r7=($,q,J)=>{if($!==void 0)throw TypeError(`The \`${$.optionName}\` and \`${q}\` options must not target ${L1[J]} that is the same.`)};var z$=($,q,J,X)=>{let H=p7(q,J,X).map((Y,G)=>VY({stdioOption:Y,fdNumber:G,options:q,isSync:X})),Q=xY({initialFileDescriptors:H,addProperties:$,options:q,isSync:X});return q.stdio=Q.map(({stdioItems:Y})=>CY(Y)),Q},VY=({stdioOption:$,fdNumber:q,options:J,isSync:X})=>{let Z=k0(q),{stdioItems:H,isStdioArray:Q}=WY({stdioOption:$,fdNumber:q,options:J,optionName:Z}),Y=c7(H,q,Z),G=H.map((z)=>i7({stdioItem:z,isStdioArray:Q,fdNumber:q,direction:Y,isSync:X})),K=g7(G,Z,Y,J),U=b7(K,Y);return FY(K,U),{direction:Y,objectMode:U,stdioItems:K}},WY=({stdioOption:$,fdNumber:q,options:J,optionName:X})=>{let H=[...(Array.isArray($)?$:[$]).map((G)=>_Y(G,X)),...n7(J,q)],Q=a7(H),Y=Q.length>1;return RY(Q,Y,X),PY(Q),{stdioItems:Q,isStdioArray:Y}},_Y=($,q)=>({type:A7($,q),value:$,optionName:q}),RY=($,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(TY.has(X))throw Error(`The \`${Z}\` option must not include \`${X}\`.`)},TY=new Set(["ignore","ipc"]),PY=($)=>{for(let q of $)kY(q)},kY=({type:$,value:q,optionName:J})=>{if(N7(q))throw TypeError(`The \`${J}: URL\` option must use the \`file:\` scheme.
63
+ For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(D7($,q))throw TypeError(`The \`${J}: { file: '...' }\` option must be used instead of \`${J}: '...'\`.`)},FY=($,q)=>{if(!q)return;let J=$.find(({type:X})=>U$.has(X));if(J!==void 0)throw TypeError(`The \`${J.optionName}\` option cannot use both files and transforms in objectMode.`)},xY=({initialFileDescriptors:$,addProperties:q,options:J,isSync:X})=>{let Z=[];try{for(let H of $)Z.push(jY({fileDescriptor:H,fileDescriptors:Z,addProperties:q,options:J,isSync:X}));return Z}catch(H){throw n2(Z),H}},jY=({fileDescriptor:{direction:$,objectMode:q,stdioItems:J},fileDescriptors:X,addProperties:Z,options:H,isSync:Q})=>{let Y=J.map((G)=>MY({stdioItem:G,addProperties:Z,direction:$,options:H,fileDescriptors:X,isSync:Q}));return{direction:$,objectMode:q,stdioItems:Y}},MY=({stdioItem:$,addProperties:q,direction:J,options:X,fileDescriptors:Z,isSync:H})=>{let Q=t7({stdioItem:$,direction:J,fileDescriptors:Z,isSync:H});if(Q!==void 0)return{...$,stream:Q};return{...$,...q[J][$.type]($,X)}},n2=($)=>{for(let{stdioItems:q}of $)for(let{stream:J}of q)if(J!==void 0&&!d(J))J.destroy()},CY=($)=>{if($.length>1)return $.some(({value:X})=>X==="overlapped")?"overlapped":"pipe";let[{type:q,value:J}]=$;return q==="native"?J:"pipe"};var $5=($,q)=>z$(wY,$,q,!0),$1=({type:$,optionName:q})=>{q5(q,L1[$])},IY=({optionName:$,value:q})=>{if(q==="ipc"||q==="overlapped")q5($,`"${q}"`);return{}},q5=($,q)=>{throw TypeError(`The \`${$}\` option cannot be ${q} with synchronous methods.`)},e7={generator(){},asyncGenerator:$1,webStream:$1,nodeStream:$1,webTransform:$1,duplex:$1,asyncIterable:$1,native:IY},wY={input:{...e7,fileUrl:({value:$})=>({contents:[Z1(s7($))]}),filePath:({value:{file:$}})=>({contents:[Z1(s7($))]}),fileNumber:$1,iterable:({value:$})=>({contents:[...$]}),string:({value:$})=>({contents:[$]}),uint8Array:({value:$})=>({contents:[$]})},output:{...e7,fileUrl:({value:$})=>({path:$}),filePath:({value:{file:$,append:q}})=>({path:$,append:q}),fileNumber:({value:$})=>({path:$}),iterable:$1,string:$1,uint8Array:$1}};var G1=($,{stripFinalNewline:q},J)=>a2(q,J)&&$!==void 0&&!Array.isArray($)?h1($):$,a2=($,q)=>q==="all"?$[1]||$[2]:$[q];import{Transform as aY,getDefaultHighWaterMark as B5}from"node:stream";var B$=($,q,J,X)=>$||J?void 0:X5(q,X),o2=($,q,J)=>J?$.flatMap((X)=>J5(X,q)):J5($,q),J5=($,q)=>{let{transform:J,final:X}=X5(q,{});return[...J($),...X()]},X5=($,q)=>{return q.previousChunks="",{transform:AY.bind(void 0,q,$),final:yY.bind(void 0,q)}},AY=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=EY(J,H,q,$),Y=J.slice(Z+1,H+1-Q);if(X.length>0)Y=t2(X,Y),X="";yield Y,Z=H}if(Z!==J.length-1)X=t2(X,J.slice(Z+1));$.previousChunks=X},EY=($,q,J,X)=>{if(J)return 0;return X.isWindowsNewline=q!==0&&$[q-1]==="\r",X.isWindowsNewline?2:1},yY=function*({previousChunks:$}){if($.length>0)yield $},Z5=({binary:$,preserveNewlines:q,readableObjectMode:J,state:X})=>$||q||J?void 0:{transform:OY.bind(void 0,X)},OY=function*({isWindowsNewline:$=!1},q){let{unixNewline:J,windowsNewline:X,LF:Z,concatBytes:H}=typeof q==="string"?NY:vY;if(q.at(-1)===Z){yield q;return}yield H(q,$?X:J)},t2=($,q)=>`${$}${q}`,NY={windowsNewline:`\r
65
65
  `,unixNewline:`
66
66
  `,LF:`
67
- `,concatBytes:a2},OY=($,q)=>{let J=new Uint8Array($.length+q.length);return J.set($,0),J.set(q,$.length),J},NY={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:OY};import{Buffer as DY}from"node:buffer";var Q5=($,q)=>$?void 0:vY.bind(void 0,q),vY=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},H5=($,q)=>$?fY.bind(void 0,q):hY.bind(void 0,q),fY=function*($,q){Y5($,q),yield q},hY=function*($,q){if(Y5($,q),typeof q!=="string"&&!D(q))throw TypeError(`The \`${$}\` option's function must yield a string or an Uint8Array, not ${typeof q}.`);yield q},Y5=($,q)=>{if(q===null||q===void 0)throw TypeError(`The \`${$}\` option's function must not call \`yield ${q}\`.
67
+ `,concatBytes:t2},DY=($,q)=>{let J=new Uint8Array($.length+q.length);return J.set($,0),J.set(q,$.length),J},vY={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:DY};import{Buffer as hY}from"node:buffer";var Q5=($,q)=>$?void 0:SY.bind(void 0,q),SY=function*($,q){if(typeof q!=="string"&&!D(q)&&!hY.isBuffer(q))throw TypeError(`The \`${$}\` option's transform must use "objectMode: true" to receive as input: ${typeof q}.`);yield q},H5=($,q)=>$?fY.bind(void 0,q):bY.bind(void 0,q),fY=function*($,q){Y5($,q),yield q},bY=function*($,q){if(Y5($,q),typeof q!=="string"&&!D(q))throw TypeError(`The \`${$}\` option's function must yield a string or an Uint8Array, not ${typeof q}.`);yield q},Y5=($,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 SY}from"node:buffer";import{StringDecoder as bY}from"node:string_decoder";var L$=($,q,J)=>{if(J)return;if($)return{transform:gY.bind(void 0,new TextEncoder)};let X=new bY(q);return{transform:cY.bind(void 0,X),final:mY.bind(void 0,X)}},gY=function*($,q){if(SY.isBuffer(q))yield Z1(q);else if(typeof q==="string")yield $.encode(q);else yield q},cY=function*($,q){yield D(q)?$.write(q):q},mY=function*($){let q=$.end();if(q!=="")yield q};import{callbackify as G5}from"node:util";var o2=G5(async($,q,J,X)=>{q.currentIterable=$(...J);try{for await(let Z of q.currentIterable)X.push(Z)}finally{delete q.currentIterable}}),_$=async function*($,q,J){if(J===q.length){yield $;return}let{transform:X=pY}=q[J];for await(let Z of X($))yield*_$(Z,q,J+1)},K5=async function*($){for(let[q,{final:J}]of Object.entries($))yield*uY(J,Number(q),$)},uY=async function*($,q,J){if($===void 0)return;for await(let X of $())yield*_$(X,J,q+1)},U5=G5(async({currentIterable:$},q)=>{if($!==void 0){await(q?$.throw(q):$.return());return}if(q)throw q}),pY=function*($){yield $};var r2=($,q,J,X)=>{try{for(let Z of $(...q))J.push(Z);X()}catch(Z){X(Z)}},z5=($,q)=>[...q.flatMap((J)=>[...F1(J,$,0)]),...J0($)],F1=function*($,q,J){if(J===q.length){yield $;return}let{transform:X=dY}=q[J];for(let Z of X($))yield*F1(Z,q,J+1)},J0=function*($){for(let[q,{final:J}]of Object.entries($))yield*lY(J,Number(q),$)},lY=function*($,q,J){if($===void 0)return;for(let X of $())yield*F1(X,J,q+1)},dY=function*($){yield $};var s2=({value:$,value:{transform:q,final:J,writableObjectMode:X,readableObjectMode:Z},optionName:H},{encoding:Q})=>{let Y={},G=L5($,Q,H),K=k1(q),U=k1(J),z=K?o2.bind(void 0,_$,Y):r2.bind(void 0,F1),B=K||U?o2.bind(void 0,K5,Y):r2.bind(void 0,J0),L=K||U?U5.bind(void 0,Y):void 0;return{stream:new iY({writableObjectMode:X,writableHighWaterMark:B5(X),readableObjectMode:Z,readableHighWaterMark:B5(Z),transform(P,M,F){z([P,G,0],this,F)},flush(P){B([G],this,P)},destroy:L})}},V$=($,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=L5(Q,J,Y);$=z5(G,$)}return $},L5=({transform:$,final:q,binary:J,writableObjectMode:X,readableObjectMode:Z,preserveNewlines:H},Q,Y)=>{let G={};return[{transform:Q5(X,Y)},L$(J,Q,X),B$(J,H,X,G),{transform:$,final:q},{transform:H5(Z,Y)},Z5({binary:J,preserveNewlines:H,readableObjectMode:Z,state:G})].filter(Boolean)};var _5=($,q)=>{for(let J of nY($))aY($,J,q)},nY=($)=>new Set(Object.entries($).filter(([,{direction:q}])=>q==="input").map(([q])=>Number(q))),aY=($,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 ${L1[Y]} with synchronous methods.`)}let Q=Z.map(({contents:Y})=>Y).map((Y)=>tY(Y,X));J.input=a1(Q)},tY=($,q)=>{let J=V$($,q,"utf8",!0);return oY(J),a1(J)},oY=($)=>{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 $G,appendFileSync as qG}from"node:fs";var R$=({stdioItems:$,encoding:q,verboseInfo:J,fdNumber:X})=>X!=="all"&&E1(J,X)&&!m.has(q)&&rY(X)&&($.some(({type:Z,value:H})=>Z==="native"&&sY.has(H))||$.every(({type:Z})=>l.has(Z))),rY=($)=>$===1||$===2,sY=new Set(["pipe","overlapped"]),V5=async($,q,J,X)=>{for await(let Z of $)if(!eY(q))W5(Z,J,X)},R5=($,q,J)=>{for(let X of $)W5(X,q,J)},eY=($)=>$._readableState.pipes.length>0,W5=($,q,J)=>{let X=I0($);o({type:"output",verboseMessage:X,fdNumber:q,verboseInfo:J})};var T5=({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)=>JG({result:G,fileDescriptors:$,fdNumber:K,state:H,outputFiles:Q,isMaxBuffer:X,verboseInfo:Z},J)),...H}},JG=({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=P7($,H,z),L=Z1(B),{stdioItems:W,objectMode:P}=q[J],M=XG([L],W,G,X),{serializedResult:F,finalResult:O=F}=ZG({chunks:M,objectMode:P,encoding:G,lines:K,stripFinalNewline:U,fdNumber:J});QG({serializedResult:F,fdNumber:J,state:X,verboseInfo:Q,encoding:G,stdioItems:W,objectMode:P});let v=Y[J]?O:void 0;try{if(X.error===void 0)HG(F,W,Z);return v}catch(x){return X.error=x,v}},XG=($,q,J,X)=>{try{return V$($,q,J,!1)}catch(Z){return X.error=Z,$}},ZG=({chunks:$,objectMode:q,encoding:J,lines:X,stripFinalNewline:Z,fdNumber:H})=>{if(q)return{serializedResult:$};if(J==="buffer")return{serializedResult:a1($)};let Q=D3($,J);if(X[H])return{serializedResult:Q,finalResult:t2(Q,!Z[H],q)};return{serializedResult:Q}},QG=({serializedResult:$,fdNumber:q,state:J,verboseInfo:X,encoding:Z,stdioItems:H,objectMode:Q})=>{if(!R$({stdioItems:H,encoding:Z,verboseInfo:X,fdNumber:q}))return;let Y=t2($,!1,Q);try{R5(Y,q,X)}catch(G){J.error??=G}},HG=($,q,J)=>{for(let{path:X,append:Z}of q.filter(({type:H})=>U$.has(H))){let H=typeof X==="string"?X:X.toString();if(Z||J.has(H))qG(X,$);else J.add(H),$G(X,$)}};var P5=([,$,q],J)=>{if(!J.all)return;if($===void 0)return q;if(q===void 0)return $;if(Array.isArray($))return Array.isArray(q)?[...$,...q]:[...$,G1(q,J,"all")];if(Array.isArray(q))return[G1($,J,"all"),...q];if(D($)&&D(q))return Z2([$,q]);return`${$}${q}`};import{once as e2}from"node:events";var k5=async($,q)=>{let[J,X]=await YG($);return q.isForcefullyTerminated??=!1,[J,X]},YG=async($)=>{let[q,J]=await Promise.allSettled([e2($,"spawn"),e2($,"exit")]);if(q.status==="rejected")return[];return J.status==="rejected"?F5($):J.value},F5=async($)=>{try{return await e2($,"exit")}catch{return F5($)}},x5=async($)=>{let[q,J]=await $;if(!GG(q,J)&&$4(q,J))throw new r;return[q,J]},GG=($,q)=>$===void 0&&q===void 0,$4=($,q)=>$!==0||q!==null;var j5=({error:$,status:q,signal:J,output:X},{maxBuffer:Z})=>{let H=KG($,q,J),Q=H?.code==="ETIMEDOUT",Y=T7(H,X,Z);return{resultError:H,exitCode:q,signal:J,timedOut:Q,isMaxBuffer:Y}},KG=($,q,J)=>{if($!==void 0)return $;return $4(q,J)?new r:void 0};var M5=($,q,J)=>{let{file:X,commandArguments:Z,command:H,escapedCommand:Q,startTime:Y,verboseInfo:G,options:K,fileDescriptors:U}=zG($,q,J),z=_G({file:X,commandArguments:Z,options:K,command:H,escapedCommand:Q,verboseInfo:G,fileDescriptors:U,startTime:Y});return b1(z,G,K)},zG=($,q,J)=>{let{command:X,escapedCommand:Z,startTime:H,verboseInfo:Q}=A0($,q,J),Y=BG(J),{file:G,commandArguments:K,options:U}=r0($,q,Y);LG(U);let z=$5(U,Q);return{file:G,commandArguments:K,command:X,escapedCommand:Z,startTime:H,verboseInfo:Q,options:U,fileDescriptors:z}},BG=($)=>$.node&&!$.ipc?{...$,ipc:!1}:$,LG=({ipc:$,ipcInput:q,detached:J,cancelSignal:X})=>{if(q)W$("ipcInput");if($)W$("ipc: true");if(J)W$("detached: true");if(X)W$("cancelSignal")},W$=($)=>{throw TypeError(`The "${$}" option cannot be used with synchronous methods.`)},_G=({file:$,commandArguments:q,options:J,command:X,escapedCommand:Z,verboseInfo:H,fileDescriptors:Q,startTime:Y})=>{let G=VG({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}=j5(G,J),{output:W,error:P=K}=T5({fileDescriptors:Q,syncResult:G,options:J,isMaxBuffer:L,verboseInfo:H}),M=W.map((O,v)=>G1(O,J,v)),F=G1(P5(W,J),J,"all");return WG({error:P,exitCode:U,signal:z,timedOut:B,isMaxBuffer:L,stdio:M,all:F,options:J,command:X,escapedCommand:Z,startTime:Y})},VG=({file:$,commandArguments:q,options:J,command:X,escapedCommand:Z,fileDescriptors:H,startTime:Q})=>{try{_5(H,J);let Y=RG(J);return UG(...s0($,q,Y))}catch(Y){return S1({error:Y,command:X,escapedCommand:Z,fileDescriptors:H,options:J,startTime:Q,isSync:!0})}},RG=({encoding:$,maxBuffer:q,...J})=>({...J,encoding:"buffer",maxBuffer:H$(q)}),WG=({error:$,exitCode:q,signal:J,timedOut:X,isMaxBuffer:Z,stdio:H,all:Q,options:Y,command:G,escapedCommand:K,startTime:U})=>$===void 0?Y$({command:G,escapedCommand:K,stdio:H,all:Q,ipcOutput:[],options:Y,startTime:U}):q0({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 ZU}from"node:events";import{spawn as QU}from"node:child_process";import E5 from"node:process";import{once as q4,on as TG}from"node:events";var C5=({anyProcess:$,channel:q,isSubprocess:J,ipc:X},{reference:Z=!0,filter:H}={})=>{return N1({methodName:"getOneMessage",isSubprocess:J,ipc:X,isConnected:d0($)}),PG({anyProcess:$,channel:q,isSubprocess:J,filter:H,reference:Z})},PG=async({anyProcess:$,channel:q,isSubprocess:J,filter:X,reference:Z})=>{m0(q,Z);let H=B1($,q,J),Q=new AbortController;try{return await Promise.race([kG(H,X,Q),FG(H,J,Q),xG(H,J,Q)])}catch(Y){throw D1($),Y}finally{Q.abort(),u0(q,Z)}},kG=async($,q,{signal:J})=>{if(q===void 0){let[X]=await q4($,"message",{signal:J});return X}for await(let[X]of TG($,"message",{signal:J}))if(q(X))return X},FG=async($,q,{signal:J})=>{await q4($,"disconnect",{signal:J}),U8(q)},xG=async($,q,{signal:J})=>{let[X]=await q4($,"strict:error",{signal:J});throw b0(X,q)};import{once as w5,on as jG}from"node:events";var A5=({anyProcess:$,channel:q,isSubprocess:J,ipc:X},{reference:Z=!0}={})=>J4({anyProcess:$,channel:q,isSubprocess:J,ipc:X,shouldAwait:!J,reference:Z}),J4=({anyProcess:$,channel:q,isSubprocess:J,ipc:X,shouldAwait:Z,reference:H})=>{N1({methodName:"getEachMessage",isSubprocess:J,ipc:X,isConnected:d0($)}),m0(q,H);let Q=B1($,q,J),Y=new AbortController,G={};return MG($,Q,Y),CG({ipcEmitter:Q,isSubprocess:J,controller:Y,state:G}),IG({anyProcess:$,channel:q,ipcEmitter:Q,isSubprocess:J,shouldAwait:Z,controller:Y,state:G,reference:H})},MG=async($,q,J)=>{try{await w5(q,"disconnect",{signal:J.signal}),J.abort()}catch{}},CG=async({ipcEmitter:$,isSubprocess:q,controller:J,state:X})=>{try{let[Z]=await w5($,"strict:error",{signal:J.signal});X.error=b0(Z,q),J.abort()}catch{}},IG=async function*({anyProcess:$,channel:q,ipcEmitter:J,isSubprocess:X,shouldAwait:Z,controller:H,state:Q,reference:Y}){try{for await(let[G]of jG(J,"message",{signal:H.signal}))I5(Q),yield G}catch{I5(Q)}finally{if(H.abort(),u0(q,Y),!X)D1($);if(Z)await $}},I5=({error:$})=>{if($)throw $};var y5=($,{ipc:q})=>{Object.assign($,N5($,!1,q))},O5=()=>{let $=E5,q=!0,J=E5.channel!==void 0;return{...N5($,!0,J),getCancelSignal:S8.bind(void 0,{anyProcess:$,channel:$.channel,isSubprocess:!0,ipc:J})}},N5=($,q,J)=>({sendMessage:t0.bind(void 0,{anyProcess:$,channel:$.channel,isSubprocess:q,ipc:J}),getOneMessage:C5.bind(void 0,{anyProcess:$,channel:$.channel,isSubprocess:q,ipc:J}),getEachMessage:A5.bind(void 0,{anyProcess:$,channel:$.channel,isSubprocess:q,ipc:J})});import{ChildProcess as wG}from"node:child_process";import{PassThrough as AG,Readable as EG,Writable as yG,Duplex as OG}from"node:stream";var D5=({error:$,command:q,escapedCommand:J,fileDescriptors:X,options:Z,startTime:H,verboseInfo:Q})=>{i2(X);let Y=new wG;NG(Y,X),Object.assign(Y,{readable:DG,writable:vG,duplex:fG});let G=S1({error:$,command:q,escapedCommand:J,fileDescriptors:X,options:Z,startTime:H,isSync:!1}),K=hG(G,Q,Z);return{subprocess:Y,promise:K}},NG=($,q)=>{let J=X0(),X=X0(),Z=X0(),H=Array.from({length:q.length-3},X0),Q=X0(),Y=[J,X,Z,...H];Object.assign($,{stdin:J,stdout:X,stderr:Z,all:Q,stdio:Y})},X0=()=>{let $=new AG;return $.end(),$},DG=()=>new EG({read(){}}),vG=()=>new yG({write(){}}),fG=()=>new OG({read(){},write(){}}),hG=async($,q,J)=>b1($,q,J);import{createReadStream as v5,createWriteStream as f5}from"node:fs";import{Buffer as SG}from"node:buffer";import{Readable as Z0,Writable as bG,Duplex as gG}from"node:stream";var S5=($,q)=>z$(cG,$,q,!1),Q0=({type:$,optionName:q})=>{throw TypeError(`The \`${q}\` option cannot be ${L1[$]}.`)},h5={fileNumber:Q0,generator:s2,asyncGenerator:s2,nodeStream:({value:$})=>({stream:$}),webTransform({value:{transform:$,writableObjectMode:q,readableObjectMode:J}}){let X=q||J;return{stream:gG.fromWeb($,{objectMode:X})}},duplex:({value:{transform:$}})=>({stream:$}),native(){}},cG={input:{...h5,fileUrl:({value:$})=>({stream:v5($)}),filePath:({value:{file:$}})=>({stream:v5($)}),webStream:({value:$})=>({stream:Z0.fromWeb($)}),iterable:({value:$})=>({stream:Z0.from($)}),asyncIterable:({value:$})=>({stream:Z0.from($)}),string:({value:$})=>({stream:Z0.from($)}),uint8Array:({value:$})=>({stream:Z0.from(SG.from($))})},output:{...h5,fileUrl:({value:$})=>({stream:f5($)}),filePath:({value:{file:$,append:q}})=>({stream:f5($,q?{flags:"a"}:{})}),webStream:({value:$})=>({stream:bG.fromWeb($)}),iterable:Q0,asyncIterable:Q0,string:Q0,uint8Array:Q0}};import{on as mG,once as b5}from"node:events";import{PassThrough as uG,getDefaultHighWaterMark as pG}from"node:stream";import{finished as m5}from"node:stream/promises";function x1($){if(!Array.isArray($))throw TypeError(`Expected an array, got \`${typeof $}\`.`);for(let Z of $)X4(Z);let q=$.some(({readableObjectMode:Z})=>Z),J=lG($,q),X=new u5({objectMode:q,writableHighWaterMark:J,readableHighWaterMark:J});for(let Z of $)X.add(Z);return X}var lG=($,q)=>{if($.length===0)return pG(q);let J=$.filter(({readableObjectMode:X})=>X===q).map(({readableHighWaterMark:X})=>X);return Math.max(...J)};class u5 extends uG{#q=new Set([]);#J=new Set([]);#$=new Set([]);#X;#Q=Symbol("unpipe");#Z=new WeakMap;add($){if(X4($),this.#q.has($))return;this.#q.add($),this.#X??=dG(this,this.#q,this.#Q);let q=aG({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(X4($),!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 dG=async($,q,J)=>{T$($,g5);let X=new AbortController;try{await Promise.race([iG($,X),nG($,q,J,X)])}finally{X.abort(),T$($,-g5)}},iG=async($,{signal:q})=>{try{await m5($,{signal:q,cleanup:!0})}catch(J){throw p5($,J),J}},nG=async($,q,J,{signal:X})=>{for await(let[Z]of mG($,"unpipe",{signal:X}))if(q.has(Z))Z.emit(J)},X4=($)=>{if(typeof $?.pipe!=="function")throw TypeError(`Expected a readable stream, got: \`${typeof $}\`.`)},aG=async({passThroughStream:$,stream:q,streams:J,ended:X,aborted:Z,onFinished:H,unpipeEvent:Q})=>{T$($,c5);let Y=new AbortController;try{await Promise.race([tG(H,q,Y),oG({passThroughStream:$,stream:q,streams:J,ended:X,aborted:Z,controller:Y}),rG({stream:q,streams:J,ended:X,aborted:Z,unpipeEvent:Q,controller:Y})])}finally{Y.abort(),T$($,-c5)}if(J.size>0&&J.size===X.size+Z.size)if(X.size===0&&Z.size>0)Z4($);else sG($)},tG=async($,q,{signal:J})=>{try{if(await $,!J.aborted)Z4(q)}catch(X){if(!J.aborted)p5(q,X)}},oG=async({passThroughStream:$,stream:q,streams:J,ended:X,aborted:Z,controller:{signal:H}})=>{try{if(await m5(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(l5(Q))Z.add(q);else d5($,Q)}},rG=async({stream:$,streams:q,ended:J,aborted:X,unpipeEvent:Z,controller:{signal:H}})=>{if(await b5($,Z,{signal:H}),!$.readable)return b5(H,"abort",{signal:H});q.delete($),J.delete($),X.delete($)},sG=($)=>{if($.writable)$.end()},p5=($,q)=>{if(l5(q))Z4($);else d5($,q)},l5=($)=>$?.code==="ERR_STREAM_PREMATURE_CLOSE",Z4=($)=>{if($.readable||$.writable)$.destroy()},d5=($,q)=>{if(!$.destroyed)$.once("error",eG),$.destroy(q)},eG=()=>{},T$=($,q)=>{let J=$.getMaxListeners();if(J!==0&&J!==Number.POSITIVE_INFINITY)$.setMaxListeners(J+q)},g5=2,c5=1;import{finished as i5}from"node:stream/promises";var c1=($,q)=>{$.pipe(q),$K($,q),qK($,q)},$K=async($,q)=>{if(d($)||d(q))return;try{await i5($,{cleanup:!0,readable:!0,writable:!1})}catch{}Q4(q)},Q4=($)=>{if($.writable)$.end()},qK=async($,q)=>{if(d($)||d(q))return;try{await i5(q,{cleanup:!0,readable:!1,writable:!0})}catch{}H4($)},H4=($)=>{if($.readable)$.destroy()};var n5=($,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})=>l.has(G)))JK($,Y,Q,Z);for(let{stream:Y}of H.filter(({type:G})=>!l.has(G)))ZK({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]:x1(H);c1(Q,Z)}},JK=($,q,J,X)=>{if(J==="output")c1($.stdio[X],q);else c1(q,$.stdio[X]);let Z=XK[X];if(Z!==void 0)$[Z]=q;$.stdio[X]=q},XK=["stdin","stdout","stderr"],ZK=({subprocess:$,stream:q,direction:J,fdNumber:X,pipeGroups:Z,controller:H})=>{if(q===void 0)return;QK(q,H);let[Q,Y]=J==="output"?[q,$.stdio[X]]:[$.stdio[X],q],G=Z.get(Q)??[];Z.set(Q,[...G,Y])},QK=($,{signal:q})=>{if(d($))T1($,HK,q)},HK=2;import{addAbortListener as KK}from"node:events";var j1=[];j1.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")j1.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")j1.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var P$=($)=>!!$&&typeof $==="object"&&typeof $.removeListener==="function"&&typeof $.emit==="function"&&typeof $.reallyExit==="function"&&typeof $.listeners==="function"&&typeof $.kill==="function"&&typeof $.pid==="number"&&typeof $.on==="function",Y4=Symbol.for("signal-exit emitter"),G4=globalThis,YK=Object.defineProperty.bind(Object);class a5{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(G4[Y4])return G4[Y4];YK(G4,Y4,{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 U4{}var GK=($)=>{return{onExit(q,J){return $.onExit(q,J)},load(){return $.load()},unload(){return $.unload()}}};class t5 extends U4{onExit(){return()=>{}}load(){}unload(){}}class o5 extends U4{#q=K4.platform==="win32"?"SIGINT":"SIGHUP";#J=new a5;#$;#X;#Q;#Z={};#H=!1;constructor($){super();this.#$=$,this.#Z={};for(let q of j1)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(!P$(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 j1)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,j1.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(!P$(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"&&P$(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:r5,load:_k,unload:Vk}=GK(P$(K4)?new o5(K4):new t5);var s5=($,{cleanup:q,detached:J},{signal:X})=>{if(!q||J)return;let Z=r5(()=>{$.kill()});KK(X,()=>{Z()})};var $q=({source:$,sourcePromise:q,boundOptions:J,createNested:X},...Z)=>{let H=w0(),{destination:Q,destinationStream:Y,destinationError:G,from:K,unpipeSignal:U}=UK(J,X,Z),{sourceStream:z,sourceError:B}=BK($,K),{options:L,fileDescriptors:W}=e.get($);return{sourcePromise:q,sourceStream:z,sourceOptions:L,sourceError:B,destination:Q,destinationStream:Y,destinationError:G,unpipeSignal:U,fileDescriptors:W,startTime:H}},UK=($,q,J)=>{try{let{destination:X,pipeOptions:{from:Z,to:H,unpipeSignal:Q}={}}=zK($,q,...J),Y=c0(X,H);return{destination:X,destinationStream:Y,from:Z,unpipeSignal:Q}}catch(X){return{destinationError:X}}},zK=($,q,J,...X)=>{if(Array.isArray(J))return{destination:q(e5,$)(J,...X),pipeOptions:$};if(typeof J==="string"||J instanceof URL||J2(J)){if(Object.keys($).length>0)throw TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[Z,H,Q]=W0(J,...X);return{destination:q(e5)(Z,H,Q),pipeOptions:Q}}if(e.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}`)},e5=({options:$})=>({options:{...$,stdin:"pipe",piped:!0}}),BK=($,q)=>{try{return{sourceStream:v1($,q)}}catch(J){return{sourceError:J}}};var Jq=({sourceStream:$,sourceError:q,destinationStream:J,destinationError:X,fileDescriptors:Z,sourceOptions:H,startTime:Q})=>{let Y=LK({sourceStream:$,sourceError:q,destinationStream:J,destinationError:X});if(Y!==void 0)throw z4({error:Y,fileDescriptors:Z,sourceOptions:H,startTime:Q})},LK=({sourceStream:$,sourceError:q,destinationStream:J,destinationError:X})=>{if(q!==void 0&&X!==void 0)return X;if(X!==void 0)return H4($),X;if(q!==void 0)return Q4(J),q},z4=({error:$,fileDescriptors:q,sourceOptions:J,startTime:X})=>S1({error:$,command:qq,escapedCommand:qq,fileDescriptors:q,options:J,startTime:X,isSync:!1}),qq="source.pipe(destination)";var Xq=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 _K}from"node:stream/promises";var Zq=($,q,J)=>{let X=k$.has(q)?RK($,q):VK($,q);return T1($,TK,J.signal),T1(q,PK,J.signal),WK(q),X},VK=($,q)=>{let J=x1([$]);return c1(J,q),k$.set(q,J),J},RK=($,q)=>{let J=k$.get(q);return J.add($),J},WK=async($)=>{try{await _K($,{cleanup:!0,readable:!1,writable:!0})}catch{}k$.delete($)},k$=new WeakMap,TK=2,PK=1;import{aborted as kK}from"node:util";var Qq=($,q)=>$===void 0?[]:[FK($,q)],FK=async($,{sourceStream:q,mergedStream:J,fileDescriptors:X,sourceOptions:Z,startTime:H})=>{await kK($,q),await J.remove(q);let Q=Error("Pipe canceled by `unpipeSignal` option.");throw z4({error:Q,fileDescriptors:X,sourceOptions:Z,startTime:H})};var F$=($,...q)=>{if(E(q[0]))return F$.bind(void 0,{...$,boundOptions:{...$.boundOptions,...q[0]}});let{destination:J,...X}=$q($,...q),Z=xK({...X,destination:J});return Z.pipe=F$.bind(void 0,{...$,source:J,sourcePromise:Z,boundOptions:{}}),Z},xK=async({sourcePromise:$,sourceStream:q,sourceOptions:J,sourceError:X,destination:Z,destinationStream:H,destinationError:Q,unpipeSignal:Y,fileDescriptors:G,startTime:K})=>{let U=jK($,Z);Jq({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([Xq(U),...Qq(Y,{sourceStream:q,mergedStream:B,sourceOptions:J,fileDescriptors:G,startTime:K})])}finally{z.abort()}},jK=($,q)=>Promise.allSettled([$,q]);import{setImmediate as yK}from"node:timers/promises";import{on as MK}from"node:events";import{getDefaultHighWaterMark as CK}from"node:stream";var x$=({subprocessStdout:$,subprocess:q,binary:J,shouldEncode:X,encoding:Z,preserveNewlines:H})=>{let Q=new AbortController;return IK(q,Q),Yq({stream:$,controller:Q,binary:J,shouldEncode:!$.readableObjectMode&&X,encoding:Z,shouldSplit:!$.readableObjectMode,preserveNewlines:H})},IK=async($,q)=>{try{await $}catch{}finally{q.abort()}},B4=({stream:$,onStreamEnd:q,lines:J,encoding:X,stripFinalNewline:Z,allMixed:H})=>{let Q=new AbortController;wK(q,Q,$);let Y=$.readableObjectMode&&!H;return Yq({stream:$,controller:Q,binary:X==="buffer",shouldEncode:!Y,encoding:X,shouldSplit:!Y&&J,preserveNewlines:!Z})},wK=async($,q,J)=>{try{await $}catch{J.destroy()}finally{q.abort()}},Yq=({stream:$,controller:q,binary:J,shouldEncode:X,encoding:Z,shouldSplit:H,preserveNewlines:Q})=>{let Y=MK($,"data",{signal:q.signal,highWaterMark:Hq,highWatermark:Hq});return AK({onStdoutChunk:Y,controller:q,binary:J,shouldEncode:X,encoding:Z,shouldSplit:H,preserveNewlines:Q})},L4=CK(!0),Hq=L4,AK=async function*({onStdoutChunk:$,controller:q,binary:J,shouldEncode:X,encoding:Z,shouldSplit:H,preserveNewlines:Q}){let Y=EK({binary:J,shouldEncode:X,encoding:Z,shouldSplit:H,preserveNewlines:Q});try{for await(let[G]of $)yield*F1(G,Y,0)}catch(G){if(!q.signal.aborted)throw G}finally{yield*J0(Y)}},EK=({binary:$,shouldEncode:q,encoding:J,shouldSplit:X,preserveNewlines:Z})=>[L$($,J,!q),B$($,Z,!X,{})].filter(Boolean);var Gq=async({stream:$,onStreamEnd:q,fdNumber:J,encoding:X,buffer:Z,maxBuffer:H,lines:Q,allMixed:Y,stripFinalNewline:G,verboseInfo:K,streamInfo:U})=>{let z=OK({stream:$,onStreamEnd:q,fdNumber:J,encoding:X,allMixed:Y,verboseInfo:K,streamInfo:U});if(!Z){await Promise.all([NK($),z]);return}let B=n2(G,J),L=B4({stream:$,onStreamEnd:q,lines:Q,encoding:X,stripFinalNewline:B,allMixed:Y}),[W]=await Promise.all([DK({stream:$,iterable:L,fdNumber:J,encoding:X,maxBuffer:H,lines:Q}),z]);return W},OK=async({stream:$,onStreamEnd:q,fdNumber:J,encoding:X,allMixed:Z,verboseInfo:H,streamInfo:{fileDescriptors:Q}})=>{if(!R$({stdioItems:Q[J]?.stdioItems,encoding:X,verboseInfo:H,fdNumber:J}))return;let Y=B4({stream:$,onStreamEnd:q,lines:!0,encoding:X,stripFinalNewline:!0,allMixed:Z});await V5(Y,$,J,H)},NK=async($)=>{if(await yK(),$.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 J$(J,{maxBuffer:H});if(Z==="buffer")return new Uint8Array(await X$(J,{maxBuffer:H}));return await Q$(J,{maxBuffer:H})}catch(Y){return Kq(V7({error:Y,stream:$,readableObjectMode:q,lines:Q,encoding:Z,fdNumber:X}))}},_4=async($)=>{try{return await $}catch(q){return Kq(q)}},Kq=({bufferedData:$})=>O3($)?new Uint8Array($):$;import{finished as vK}from"node:stream/promises";var H0=async($,q,J,{isSameDirection:X,stopOnExit:Z=!1}={})=>{let H=fK($,J),Q=new AbortController;try{await Promise.race([...Z?[J.exitPromise]:[],vK($,{cleanup:!0,signal:Q.signal})])}catch(Y){if(!H.stdinCleanedUp)bK(Y,q,J,X)}finally{Q.abort()}},fK=($,{originalStreams:[q],subprocess:J})=>{let X={stdinCleanedUp:!1};if($===q)hK($,J,X);return X},hK=($,q,J)=>{let{_destroy:X}=$;$._destroy=(...Z)=>{SK(q,J),X.call($,...Z)}},SK=({exitCode:$,signalCode:q},J)=>{if($!==null||q!==null)J.stdinCleanedUp=!0},bK=($,q,J,X)=>{if(!gK($,q,J,X))throw $},gK=($,q,J,X=!0)=>{if(J.propagating)return Uq($)||j$($);return J.propagating=!0,V4(J,q)===X?Uq($):j$($)},V4=({fileDescriptors:$},q)=>q!=="all"&&$[q].direction==="input",j$=($)=>$?.code==="ERR_STREAM_PREMATURE_CLOSE",Uq=($)=>$?.code==="EPIPE";var zq=({subprocess:$,encoding:q,buffer:J,maxBuffer:X,lines:Z,stripFinalNewline:H,verboseInfo:Q,streamInfo:Y})=>$.stdio.map((G,K)=>R4({stream:G,fdNumber:K,encoding:q,buffer:J[K],maxBuffer:X[K],lines:Z[K],allMixed:!1,stripFinalNewline:H,verboseInfo:Q,streamInfo:Y})),R4=async({stream:$,fdNumber:q,encoding:J,buffer:X,maxBuffer:Z,lines:H,allMixed:Q,stripFinalNewline:Y,verboseInfo:G,streamInfo:K})=>{if(!$)return;let U=H0($,q,K);if(V4(K,q)){await U;return}let[z]=await Promise.all([Gq({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 Bq=({stdout:$,stderr:q},{all:J})=>J&&($||q)?x1([$,q].filter(Boolean)):void 0,Lq=({subprocess:$,encoding:q,buffer:J,maxBuffer:X,lines:Z,stripFinalNewline:H,verboseInfo:Q,streamInfo:Y})=>R4({...cK($,J),fdNumber:"all",encoding:q,maxBuffer:X[1]+X[2],lines:Z[1]||Z[2],allMixed:mK($),stripFinalNewline:H,verboseInfo:Q,streamInfo:Y}),cK=({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}},mK=({all:$,stdout:q,stderr:J})=>$&&q&&J&&q.readableObjectMode!==J.readableObjectMode;import{once as uK}from"node:events";var _q=($)=>E1($,"ipc"),Vq=($,q)=>{let J=I0($);o({type:"ipc",verboseMessage:J,fdNumber:"ipc",verboseInfo:q})};var Rq=async({subprocess:$,buffer:q,maxBuffer:J,ipc:X,ipcOutput:Z,verboseInfo:H})=>{if(!X)return Z;let Q=_q(H),Y=Q1(q,"ipc"),G=Q1(J,"ipc");for await(let K of J4({anyProcess:$,channel:$.channel,isSubprocess:!1,ipc:X,shouldAwait:!1,reference:!0})){if(Y)R7($,Z,G),Z.push(K);if(Q)Vq(K,H)}return Z},Wq=async($,q)=>{return await Promise.allSettled([$]),q};var Tq=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:W,originalStreams:P,onInternalError:M,controller:F})=>{let O=k5($,B),v={originalStreams:P,fileDescriptors:W,subprocess:$,exitPromise:O,propagating:!1},x=zq({subprocess:$,encoding:q,buffer:J,maxBuffer:X,lines:Z,stripFinalNewline:K,verboseInfo:L,streamInfo:v}),w=Lq({subprocess:$,encoding:q,buffer:J,maxBuffer:X,lines:Z,stripFinalNewline:K,verboseInfo:L,streamInfo:v}),N=[],g=Rq({subprocess:$,buffer:J,maxBuffer:X,ipc:U,ipcOutput:N,verboseInfo:L}),K1=pK(P,$,v),U1=lK(W,v);try{return await Promise.race([Promise.all([{},x5(O),Promise.all(x),w,g,n8($,z),...K1,...U1]),M,dK($,F),...u8($,H,B,F),...K8({subprocess:$,cancelSignal:Q,gracefulCancel:Y,context:B,controller:F}),...c8({subprocess:$,cancelSignal:Q,gracefulCancel:Y,forceKillAfterDelay:G,context:B,controller:F})])}catch(d$){return B.terminationReason??="other",Promise.all([{error:d$},O,Promise.all(x.map((i1)=>_4(i1))),_4(w),Wq(g,N),Promise.allSettled(K1),Promise.allSettled(U1)])}},pK=($,q,J)=>$.map((X,Z)=>X===q.stdio[Z]?void 0:H0(X,Z,J)),lK=($,q)=>$.flatMap(({stdioItems:J},X)=>J.filter(({value:Z,stream:H=Z})=>n(H,{checkOpen:!1})&&!d(H)).map(({type:Z,value:H,stream:Q=H})=>H0(Q,X,q,{isSameDirection:l.has(Z),stopOnExit:Z==="native"}))),dK=async($,{signal:q})=>{let[J]=await uK($,"error",{signal:q});throw J};var Pq=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),Y0=($,q,J)=>{let X=$[J];if(!X.has(q))X.set(q,[]);let Z=X.get(q),H=s();return Z.push(H),{resolve:H.resolve.bind(H),promises:Z}},m1=async({resolve:$,promises:q},J)=>{$();let[X]=await Promise.race([Promise.allSettled([!0,J]),Promise.all([!1,...q])]);return!X};import{Readable as iK}from"node:stream";import{callbackify as nK}from"node:util";import{finished as kq}from"node:stream/promises";var W4=async($)=>{if($===void 0)return;try{await T4($)}catch{}},Fq=async($)=>{if($===void 0)return;try{await P4($)}catch{}},T4=async($)=>{await kq($,{cleanup:!0,readable:!1,writable:!0})},P4=async($)=>{await kq($,{cleanup:!0,readable:!0,writable:!1})},M$=async($,q)=>{if(await $,q)throw q},C$=($,q,J)=>{if(J&&!j$(J))$.destroy(J);else if(q)$.destroy()};var xq=({subprocess:$,concurrentStreams:q,encoding:J},{from:X,binary:Z=!0,preserveNewlines:H=!0}={})=>{let Q=Z||m.has(J),{subprocessStdout:Y,waitReadableDestroy:G}=k4($,X,q),{readableEncoding:K,readableObjectMode:U,readableHighWaterMark:z}=F4(Y,Q),{read:B,onStdoutDataDone:L}=x4({subprocessStdout:Y,subprocess:$,binary:Q,encoding:J,preserveNewlines:H}),W=new iK({read:B,destroy:nK(M4.bind(void 0,{subprocessStdout:Y,subprocess:$,waitReadableDestroy:G})),highWaterMark:z,objectMode:U,encoding:K});return j4({subprocessStdout:Y,onStdoutDataDone:L,readable:W,subprocess:$}),W},k4=($,q,J)=>{let X=v1($,q),Z=Y0(J,X,"readableDestroy");return{subprocessStdout:X,waitReadableDestroy:Z}},F4=({readableEncoding:$,readableObjectMode:q,readableHighWaterMark:J},X)=>X?{readableEncoding:$,readableObjectMode:q,readableHighWaterMark:J}:{readableEncoding:$,readableObjectMode:!0,readableHighWaterMark:L4},x4=({subprocessStdout:$,subprocess:q,binary:J,encoding:X,preserveNewlines:Z})=>{let H=s(),Q=x$({subprocessStdout:$,subprocess:q,binary:J,shouldEncode:!J,encoding:X,preserveNewlines:Z});return{read(){aK(this,Q,H)},onStdoutDataDone:H}},aK=async($,q,J)=>{try{let{value:X,done:Z}=await q.next();if(Z)J.resolve();else $.push(X)}catch{}},j4=async({subprocessStdout:$,onStdoutDataDone:q,readable:J,subprocess:X,subprocessStdin:Z})=>{try{if(await P4($),await X,await W4(Z),await q,J.readable)J.push(null)}catch(H){await W4(Z),jq(J,H)}},M4=async({subprocessStdout:$,subprocess:q,waitReadableDestroy:J},X)=>{if(await m1(J,q))jq($,X),await M$(q,X)},jq=($,q)=>{C$($,$.readable,q)};import{Writable as tK}from"node:stream";import{callbackify as Mq}from"node:util";var Cq=({subprocess:$,concurrentStreams:q},{to:J}={})=>{let{subprocessStdin:X,waitWritableFinal:Z,waitWritableDestroy:H}=C4($,J,q),Q=new tK({...I4(X,$,Z),destroy:Mq(A4.bind(void 0,{subprocessStdin:X,subprocess:$,waitWritableFinal:Z,waitWritableDestroy:H})),highWaterMark:X.writableHighWaterMark,objectMode:X.writableObjectMode});return w4(X,Q),Q},C4=($,q,J)=>{let X=c0($,q),Z=Y0(J,X,"writableFinal"),H=Y0(J,X,"writableDestroy");return{subprocessStdin:X,waitWritableFinal:Z,waitWritableDestroy:H}},I4=($,q,J)=>({write:oK.bind(void 0,$),final:Mq(rK.bind(void 0,$,q,J))}),oK=($,q,J,X)=>{if($.write(q,J))X();else $.once("drain",X)},rK=async($,q,J)=>{if(await m1(J,q)){if($.writable)$.end();await q}},w4=async($,q,J)=>{try{if(await T4($),q.writable)q.end()}catch(X){await Fq(J),Iq(q,X)}},A4=async({subprocessStdin:$,subprocess:q,waitWritableFinal:J,waitWritableDestroy:X},Z)=>{if(await m1(J,q),await m1(X,q))Iq($,Z),await M$(q,Z)},Iq=($,q)=>{C$($,$.writable,q)};import{Duplex as sK}from"node:stream";import{callbackify as eK}from"node:util";var wq=({subprocess:$,concurrentStreams:q,encoding:J},{from:X,to:Z,binary:H=!0,preserveNewlines:Q=!0}={})=>{let Y=H||m.has(J),{subprocessStdout:G,waitReadableDestroy:K}=k4($,X,q),{subprocessStdin:U,waitWritableFinal:z,waitWritableDestroy:B}=C4($,Z,q),{readableEncoding:L,readableObjectMode:W,readableHighWaterMark:P}=F4(G,Y),{read:M,onStdoutDataDone:F}=x4({subprocessStdout:G,subprocess:$,binary:Y,encoding:J,preserveNewlines:Q}),O=new sK({read:M,...I4(U,$,z),destroy:eK($U.bind(void 0,{subprocessStdout:G,subprocessStdin:U,subprocess:$,waitReadableDestroy:K,waitWritableFinal:z,waitWritableDestroy:B})),readableHighWaterMark:P,writableHighWaterMark:U.writableHighWaterMark,readableObjectMode:W,writableObjectMode:U.writableObjectMode,encoding:L});return j4({subprocessStdout:G,onStdoutDataDone:F,readable:O,subprocess:$,subprocessStdin:U}),w4(U,O,G),O},$U=async({subprocessStdout:$,subprocessStdin:q,subprocess:J,waitReadableDestroy:X,waitWritableFinal:Z,waitWritableDestroy:H},Q)=>{await Promise.all([M4({subprocessStdout:$,subprocess:J,waitReadableDestroy:X},Q),A4({subprocessStdin:q,subprocess:J,waitWritableFinal:Z,waitWritableDestroy:H},Q)])};var E4=($,q,{from:J,binary:X=!1,preserveNewlines:Z=!1}={})=>{let H=X||m.has(q),Q=v1($,J),Y=x$({subprocessStdout:Q,subprocess:$,binary:H,shouldEncode:!0,encoding:q,preserveNewlines:Z});return qU(Y,Q,$)},qU=async function*($,q,J){try{yield*$}finally{if(q.readable)q.destroy();await J}};var Aq=($,{encoding:q})=>{let J=Pq();$.readable=xq.bind(void 0,{subprocess:$,concurrentStreams:J,encoding:q}),$.writable=Cq.bind(void 0,{subprocess:$,concurrentStreams:J}),$.duplex=wq.bind(void 0,{subprocess:$,concurrentStreams:J,encoding:q}),$.iterable=E4.bind(void 0,$,q),$[Symbol.asyncIterator]=E4.bind(void 0,$,q,{})};var Eq=($,q)=>{for(let[J,X]of XU){let Z=X.value.bind(q);Reflect.defineProperty($,J,{...X,value:Z})}},JU=(async()=>{})().constructor.prototype,XU=["then","catch","finally"].map(($)=>[$,Reflect.getOwnPropertyDescriptor(JU,$)]);var yq=($,q,J,X)=>{let{file:Z,commandArguments:H,command:Q,escapedCommand:Y,startTime:G,verboseInfo:K,options:U,fileDescriptors:z}=HU($,q,J),{subprocess:B,promise:L}=GU({file:Z,commandArguments:H,options:U,startTime:G,verboseInfo:K,command:Q,escapedCommand:Y,fileDescriptors:z});return B.pipe=F$.bind(void 0,{source:B,sourcePromise:L,boundOptions:{},createNested:X}),Eq(B,L),e.set(B,{options:U,fileDescriptors:z}),B},HU=($,q,J)=>{let{command:X,escapedCommand:Z,startTime:H,verboseInfo:Q}=A0($,q,J),{file:Y,commandArguments:G,options:K}=r0($,q,J),U=YU(K),z=S5(U,Q);return{file:Y,commandArguments:G,command:X,escapedCommand:Z,startTime:H,verboseInfo:Q,options:U,fileDescriptors:z}},YU=({timeout:$,signal:q,...J})=>{if(q!==void 0)throw TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...J,timeoutDuration:$}},GU=({file:$,commandArguments:q,options:J,startTime:X,verboseInfo:Z,command:H,escapedCommand:Q,fileDescriptors:Y})=>{let G;try{G=QU(...s0($,q,J))}catch(W){return D5({error:W,command:H,escapedCommand:Q,fileDescriptors:Y,options:J,startTime:X,verboseInfo:Z})}let K=new AbortController;ZU(Number.POSITIVE_INFINITY,K.signal);let U=[...G.stdio];n5(G,Y,K),s5(G,J,K);let z={},B=s();G.kill=Y8.bind(void 0,{kill:G.kill.bind(G),options:J,onInternalError:B,context:z,controller:K}),G.all=Bq(G,J),Aq(G,J),y5(G,J);let L=KU({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}},KU=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],W,P,M]=await Tq({subprocess:$,options:q,context:G,verboseInfo:X,fileDescriptors:Z,originalStreams:H,onInternalError:K,controller:U});U.abort(),K.resolve();let F=W.map((x,w)=>G1(x,q,w)),O=G1(P,q,"all"),v=UU({errorInfo:z,exitCode:B,signal:L,stdio:F,all:O,ipcOutput:M,context:G,options:q,command:Q,escapedCommand:Y,startTime:J});return b1(v,X,q)},UU=({errorInfo:$,exitCode:q,signal:J,stdio:X,all:Z,ipcOutput:H,context:Q,options:Y,command:G,escapedCommand:K,startTime:U})=>("error"in $)?q0({error:$.error,command:G,escapedCommand:K,timedOut:Q.terminationReason==="timeout",isCanceled:Q.terminationReason==="cancel"||Q.terminationReason==="gracefulCancel",isGracefullyCanceled:Q.terminationReason==="gracefulCancel",isMaxBuffer:$.error instanceof H1,isForcefullyTerminated:Q.isForcefullyTerminated,exitCode:q,signal:J,stdio:X,all:Z,ipcOutput:H,options:Y,startTime:U,isSync:!1}):Y$({command:G,escapedCommand:K,stdio:X,all:Z,ipcOutput:H,options:Y,startTime:U});var I$=($,q)=>{let J=Object.fromEntries(Object.entries(q).map(([X,Z])=>[X,zU(X,$[X],Z)]));return{...$,...J}},zU=($,q,J)=>{if(BU.has($)&&E(q)&&E(J))return{...q,...J};return J},BU=new Set(["env",...G2]);var _1=($,q,J,X)=>{let Z=(Q,Y,G)=>_1(Q,Y,J,G),H=(...Q)=>LU({mapArguments:$,deepOptions:J,boundOptions:q,setBoundExeca:X,createNested:Z},...Q);if(X!==void 0)X(H,Z,q);return H},LU=({mapArguments:$,deepOptions:q={},boundOptions:J={},setBoundExeca:X,createNested:Z},H,...Q)=>{if(E(H))return Z($,I$(J,H),X);let{file:Y,commandArguments:G,options:K,isSync:U}=_U({mapArguments:$,firstArgument:H,nextArguments:Q,deepOptions:q,boundOptions:J});return U?M5(Y,G,K):yq(Y,G,K,Z)},_U=({mapArguments:$,firstArgument:q,nextArguments:J,deepOptions:X,boundOptions:Z})=>{let H=S3(q)?b3(q,J):[q,...J],[Q,Y,G]=W0(...H),K=I$(I$(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 Oq=({file:$,commandArguments:q})=>Dq($,q),Nq=({file:$,commandArguments:q})=>({...Dq($,q),isSync:!0}),Dq=($,q)=>{if(q.length>0)throw TypeError(`The command and its arguments must be passed as a single string: ${$} ${q}.`);let[J,...X]=VU($);return{file:J,commandArguments:X}},VU=($)=>{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(RU)){let Z=J.at(-1);if(Z&&Z.endsWith("\\"))J[J.length-1]=`${Z.slice(0,-1)} ${X}`;else J.push(X)}return J},RU=/ +/g;var vq=($,q,J)=>{$.sync=q(WU,J),$.s=$.sync},fq=({options:$})=>hq($),WU=({options:$})=>({...hq($),isSync:!0}),hq=($)=>({options:{...TU($),...$}}),TU=({input:$,inputFile:q,stdio:J})=>$===void 0&&q===void 0&&J===void 0?{stdin:"inherit"}:{},Sq={preferLocal:!0};var h=_1(()=>({})),Zj=_1(()=>({isSync:!0})),Qj=_1(Oq),Hj=_1(Nq),Yj=_1(l8),Gj=_1(fq,{},Sq,vq),{sendMessage:Kj,getOneMessage:Uj,getEachMessage:zj,getCancelSignal:Bj}=O5();import{access as bq,readFile as cq}from"fs/promises";import{join as y4,dirname as gq}from"path";async function O4(){if(process.env.IDF_PATH)try{return await bq(process.env.IDF_PATH),process.env.IDF_PATH}catch{}try{return await bq($2),$2}catch{}return null}async function w$($){let q=y4($,"version.txt");try{return(await cq(q,"utf-8")).trim()}catch{}try{return(await h("git",["describe","--tags"],{cwd:$})).stdout.trim()}catch{}return null}async function mq(){let $=await O4();if(!$)return{installed:!1};let q=await w$($);return{installed:!0,path:$,version:q||void 0}}async function M1($){let q=y4($,"CMakeLists.txt");try{let J=await cq(q,"utf-8");return J.includes("$ENV{IDF_PATH}")||J.includes("idf_component_register")}catch{return!1}}async function q1($){let q=$;while(q!==gq(q)){if(await M1(q))return q;q=gq(q)}return null}function N4($){return y4($,"export.sh")}async function D4($,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 J1($,q,J={}){let X=await O4();if(!X)return{ok:!1,error:"ESP-IDF not found. Run `espcli install` first.",code:"IDF_NOT_FOUND"};let H=`source ${N4(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",(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}`}}}function uq($,q,J={}){let X=process.env.IDF_PATH;if(!X)return null;let H=`source ${N4(X)} > /dev/null 2>&1 && ${$} ${q.join(" ")}`,{cwd:Q,operationId:Y,env:G}=J,K=h(H,[],{cwd:Q,env:{...process.env,...G},shell:!0,reject:!1});if(Y)K.stdout?.on("data",(U)=>{R.emit(Y,{type:"stdout",text:U.toString()})}),K.stderr?.on("data",(U)=>{R.emit(Y,{type:"stderr",text:U.toString()})});return K}import{homedir as PU}from"os";import{join as kU}from"path";import{readFile as FU,appendFile as xU,access as wj}from"fs/promises";function pq(){let $=process.env.SHELL||"";if($.includes("zsh"))return"zsh";if($.includes("bash"))return"bash";if($.includes("fish"))return"fish";return"unknown"}function A$(){let $=pq(),q=w3[$]||"",J=q?kU(PU(),q):"";return{type:$,configPath:J}}async function jU($){let{configPath:q}=A$();if(!q)return!1;try{return(await FU(q,"utf-8")).includes($)}catch{return!1}}async function lq($){let{configPath:q,type:J}=A$();if(!q)return{ok:!1,error:`Unsupported shell: ${J}`};if(await jU($))return{ok:!0,data:void 0};try{return await xU(q,`
69
+ if (condition) { yield value; }`)};import{Buffer as gY}from"node:buffer";import{StringDecoder as cY}from"node:string_decoder";var L$=($,q,J)=>{if(J)return;if($)return{transform:mY.bind(void 0,new TextEncoder)};let X=new cY(q);return{transform:uY.bind(void 0,X),final:pY.bind(void 0,X)}},mY=function*($,q){if(gY.isBuffer(q))yield Z1(q);else if(typeof q==="string")yield $.encode(q);else yield q},uY=function*($,q){yield D(q)?$.write(q):q},pY=function*($){let q=$.end();if(q!=="")yield q};import{callbackify as G5}from"node:util";var r2=G5(async($,q,J,X)=>{q.currentIterable=$(...J);try{for await(let Z of q.currentIterable)X.push(Z)}finally{delete q.currentIterable}}),V$=async function*($,q,J){if(J===q.length){yield $;return}let{transform:X=dY}=q[J];for await(let Z of X($))yield*V$(Z,q,J+1)},K5=async function*($){for(let[q,{final:J}]of Object.entries($))yield*lY(J,Number(q),$)},lY=async function*($,q,J){if($===void 0)return;for await(let X of $())yield*V$(X,J,q+1)},U5=G5(async({currentIterable:$},q)=>{if($!==void 0){await(q?$.throw(q):$.return());return}if(q)throw q}),dY=function*($){yield $};var s2=($,q,J,X)=>{try{for(let Z of $(...q))J.push(Z);X()}catch(Z){X(Z)}},z5=($,q)=>[...q.flatMap((J)=>[...F1(J,$,0)]),...J0($)],F1=function*($,q,J){if(J===q.length){yield $;return}let{transform:X=nY}=q[J];for(let Z of X($))yield*F1(Z,q,J+1)},J0=function*($){for(let[q,{final:J}]of Object.entries($))yield*iY(J,Number(q),$)},iY=function*($,q,J){if($===void 0)return;for(let X of $())yield*F1(X,J,q+1)},nY=function*($){yield $};var e2=({value:$,value:{transform:q,final:J,writableObjectMode:X,readableObjectMode:Z},optionName:H},{encoding:Q})=>{let Y={},G=L5($,Q,H),K=k1(q),U=k1(J),z=K?r2.bind(void 0,V$,Y):s2.bind(void 0,F1),B=K||U?r2.bind(void 0,K5,Y):s2.bind(void 0,J0),L=K||U?U5.bind(void 0,Y):void 0;return{stream:new aY({writableObjectMode:X,writableHighWaterMark:B5(X),readableObjectMode:Z,readableHighWaterMark:B5(Z),transform(P,M,F){z([P,G,0],this,F)},flush(P){B([G],this,P)},destroy:L})}},W$=($,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=L5(Q,J,Y);$=z5(G,$)}return $},L5=({transform:$,final:q,binary:J,writableObjectMode:X,readableObjectMode:Z,preserveNewlines:H},Q,Y)=>{let G={};return[{transform:Q5(X,Y)},L$(J,Q,X),B$(J,H,X,G),{transform:$,final:q},{transform:H5(Z,Y)},Z5({binary:J,preserveNewlines:H,readableObjectMode:Z,state:G})].filter(Boolean)};var V5=($,q)=>{for(let J of tY($))oY($,J,q)},tY=($)=>new Set(Object.entries($).filter(([,{direction:q}])=>q==="input").map(([q])=>Number(q))),oY=($,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 ${L1[Y]} with synchronous methods.`)}let Q=Z.map(({contents:Y})=>Y).map((Y)=>rY(Y,X));J.input=a1(Q)},rY=($,q)=>{let J=W$($,q,"utf8",!0);return sY(J),a1(J)},sY=($)=>{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 JG,appendFileSync as XG}from"node:fs";var _$=({stdioItems:$,encoding:q,verboseInfo:J,fdNumber:X})=>X!=="all"&&E1(J,X)&&!m.has(q)&&eY(X)&&($.some(({type:Z,value:H})=>Z==="native"&&$G.has(H))||$.every(({type:Z})=>l.has(Z))),eY=($)=>$===1||$===2,$G=new Set(["pipe","overlapped"]),W5=async($,q,J,X)=>{for await(let Z of $)if(!qG(q))R5(Z,J,X)},_5=($,q,J)=>{for(let X of $)R5(X,q,J)},qG=($)=>$._readableState.pipes.length>0,R5=($,q,J)=>{let X=I0($);o({type:"output",verboseMessage:X,fdNumber:q,verboseInfo:J})};var T5=({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)=>ZG({result:G,fileDescriptors:$,fdNumber:K,state:H,outputFiles:Q,isMaxBuffer:X,verboseInfo:Z},J)),...H}},ZG=({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=P7($,H,z),L=Z1(B),{stdioItems:R,objectMode:P}=q[J],M=QG([L],R,G,X),{serializedResult:F,finalResult:O=F}=HG({chunks:M,objectMode:P,encoding:G,lines:K,stripFinalNewline:U,fdNumber:J});YG({serializedResult:F,fdNumber:J,state:X,verboseInfo:Q,encoding:G,stdioItems:R,objectMode:P});let v=Y[J]?O:void 0;try{if(X.error===void 0)GG(F,R,Z);return v}catch(x){return X.error=x,v}},QG=($,q,J,X)=>{try{return W$($,q,J,!1)}catch(Z){return X.error=Z,$}},HG=({chunks:$,objectMode:q,encoding:J,lines:X,stripFinalNewline:Z,fdNumber:H})=>{if(q)return{serializedResult:$};if(J==="buffer")return{serializedResult:a1($)};let Q=D3($,J);if(X[H])return{serializedResult:Q,finalResult:o2(Q,!Z[H],q)};return{serializedResult:Q}},YG=({serializedResult:$,fdNumber:q,state:J,verboseInfo:X,encoding:Z,stdioItems:H,objectMode:Q})=>{if(!_$({stdioItems:H,encoding:Z,verboseInfo:X,fdNumber:q}))return;let Y=o2($,!1,Q);try{_5(Y,q,X)}catch(G){J.error??=G}},GG=($,q,J)=>{for(let{path:X,append:Z}of q.filter(({type:H})=>U$.has(H))){let H=typeof X==="string"?X:X.toString();if(Z||J.has(H))XG(X,$);else J.add(H),JG(X,$)}};var P5=([,$,q],J)=>{if(!J.all)return;if($===void 0)return q;if(q===void 0)return $;if(Array.isArray($))return Array.isArray(q)?[...$,...q]:[...$,G1(q,J,"all")];if(Array.isArray(q))return[G1($,J,"all"),...q];if(D($)&&D(q))return Q2([$,q]);return`${$}${q}`};import{once as $4}from"node:events";var k5=async($,q)=>{let[J,X]=await KG($);return q.isForcefullyTerminated??=!1,[J,X]},KG=async($)=>{let[q,J]=await Promise.allSettled([$4($,"spawn"),$4($,"exit")]);if(q.status==="rejected")return[];return J.status==="rejected"?F5($):J.value},F5=async($)=>{try{return await $4($,"exit")}catch{return F5($)}},x5=async($)=>{let[q,J]=await $;if(!UG(q,J)&&q4(q,J))throw new r;return[q,J]},UG=($,q)=>$===void 0&&q===void 0,q4=($,q)=>$!==0||q!==null;var j5=({error:$,status:q,signal:J,output:X},{maxBuffer:Z})=>{let H=zG($,q,J),Q=H?.code==="ETIMEDOUT",Y=T7(H,X,Z);return{resultError:H,exitCode:q,signal:J,timedOut:Q,isMaxBuffer:Y}},zG=($,q,J)=>{if($!==void 0)return $;return q4(q,J)?new r:void 0};var M5=($,q,J)=>{let{file:X,commandArguments:Z,command:H,escapedCommand:Q,startTime:Y,verboseInfo:G,options:K,fileDescriptors:U}=LG($,q,J),z=_G({file:X,commandArguments:Z,options:K,command:H,escapedCommand:Q,verboseInfo:G,fileDescriptors:U,startTime:Y});return b1(z,G,K)},LG=($,q,J)=>{let{command:X,escapedCommand:Z,startTime:H,verboseInfo:Q}=A0($,q,J),Y=VG(J),{file:G,commandArguments:K,options:U}=r0($,q,Y);WG(U);let z=$5(U,Q);return{file:G,commandArguments:K,command:X,escapedCommand:Z,startTime:H,verboseInfo:Q,options:U,fileDescriptors:z}},VG=($)=>$.node&&!$.ipc?{...$,ipc:!1}:$,WG=({ipc:$,ipcInput:q,detached:J,cancelSignal:X})=>{if(q)R$("ipcInput");if($)R$("ipc: true");if(J)R$("detached: true");if(X)R$("cancelSignal")},R$=($)=>{throw TypeError(`The "${$}" option cannot be used with synchronous methods.`)},_G=({file:$,commandArguments:q,options:J,command:X,escapedCommand:Z,verboseInfo:H,fileDescriptors:Q,startTime:Y})=>{let G=RG({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}=j5(G,J),{output:R,error:P=K}=T5({fileDescriptors:Q,syncResult:G,options:J,isMaxBuffer:L,verboseInfo:H}),M=R.map((O,v)=>G1(O,J,v)),F=G1(P5(R,J),J,"all");return PG({error:P,exitCode:U,signal:z,timedOut:B,isMaxBuffer:L,stdio:M,all:F,options:J,command:X,escapedCommand:Z,startTime:Y})},RG=({file:$,commandArguments:q,options:J,command:X,escapedCommand:Z,fileDescriptors:H,startTime:Q})=>{try{V5(H,J);let Y=TG(J);return BG(...s0($,q,Y))}catch(Y){return f1({error:Y,command:X,escapedCommand:Z,fileDescriptors:H,options:J,startTime:Q,isSync:!0})}},TG=({encoding:$,maxBuffer:q,...J})=>({...J,encoding:"buffer",maxBuffer:H$(q)}),PG=({error:$,exitCode:q,signal:J,timedOut:X,isMaxBuffer:Z,stdio:H,all:Q,options:Y,command:G,escapedCommand:K,startTime:U})=>$===void 0?Y$({command:G,escapedCommand:K,stdio:H,all:Q,ipcOutput:[],options:Y,startTime:U}):q0({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 HU}from"node:events";import{spawn as YU}from"node:child_process";import E5 from"node:process";import{once as J4,on as kG}from"node:events";var C5=({anyProcess:$,channel:q,isSubprocess:J,ipc:X},{reference:Z=!0,filter:H}={})=>{return N1({methodName:"getOneMessage",isSubprocess:J,ipc:X,isConnected:d0($)}),FG({anyProcess:$,channel:q,isSubprocess:J,filter:H,reference:Z})},FG=async({anyProcess:$,channel:q,isSubprocess:J,filter:X,reference:Z})=>{m0(q,Z);let H=B1($,q,J),Q=new AbortController;try{return await Promise.race([xG(H,X,Q),jG(H,J,Q),MG(H,J,Q)])}catch(Y){throw D1($),Y}finally{Q.abort(),u0(q,Z)}},xG=async($,q,{signal:J})=>{if(q===void 0){let[X]=await J4($,"message",{signal:J});return X}for await(let[X]of kG($,"message",{signal:J}))if(q(X))return X},jG=async($,q,{signal:J})=>{await J4($,"disconnect",{signal:J}),U8(q)},MG=async($,q,{signal:J})=>{let[X]=await J4($,"strict:error",{signal:J});throw b0(X,q)};import{once as w5,on as CG}from"node:events";var A5=({anyProcess:$,channel:q,isSubprocess:J,ipc:X},{reference:Z=!0}={})=>X4({anyProcess:$,channel:q,isSubprocess:J,ipc:X,shouldAwait:!J,reference:Z}),X4=({anyProcess:$,channel:q,isSubprocess:J,ipc:X,shouldAwait:Z,reference:H})=>{N1({methodName:"getEachMessage",isSubprocess:J,ipc:X,isConnected:d0($)}),m0(q,H);let Q=B1($,q,J),Y=new AbortController,G={};return IG($,Q,Y),wG({ipcEmitter:Q,isSubprocess:J,controller:Y,state:G}),AG({anyProcess:$,channel:q,ipcEmitter:Q,isSubprocess:J,shouldAwait:Z,controller:Y,state:G,reference:H})},IG=async($,q,J)=>{try{await w5(q,"disconnect",{signal:J.signal}),J.abort()}catch{}},wG=async({ipcEmitter:$,isSubprocess:q,controller:J,state:X})=>{try{let[Z]=await w5($,"strict:error",{signal:J.signal});X.error=b0(Z,q),J.abort()}catch{}},AG=async function*({anyProcess:$,channel:q,ipcEmitter:J,isSubprocess:X,shouldAwait:Z,controller:H,state:Q,reference:Y}){try{for await(let[G]of CG(J,"message",{signal:H.signal}))I5(Q),yield G}catch{I5(Q)}finally{if(H.abort(),u0(q,Y),!X)D1($);if(Z)await $}},I5=({error:$})=>{if($)throw $};var y5=($,{ipc:q})=>{Object.assign($,N5($,!1,q))},O5=()=>{let $=E5,q=!0,J=E5.channel!==void 0;return{...N5($,!0,J),getCancelSignal:f8.bind(void 0,{anyProcess:$,channel:$.channel,isSubprocess:!0,ipc:J})}},N5=($,q,J)=>({sendMessage:t0.bind(void 0,{anyProcess:$,channel:$.channel,isSubprocess:q,ipc:J}),getOneMessage:C5.bind(void 0,{anyProcess:$,channel:$.channel,isSubprocess:q,ipc:J}),getEachMessage:A5.bind(void 0,{anyProcess:$,channel:$.channel,isSubprocess:q,ipc:J})});import{ChildProcess as EG}from"node:child_process";import{PassThrough as yG,Readable as OG,Writable as NG,Duplex as DG}from"node:stream";var D5=({error:$,command:q,escapedCommand:J,fileDescriptors:X,options:Z,startTime:H,verboseInfo:Q})=>{n2(X);let Y=new EG;vG(Y,X),Object.assign(Y,{readable:hG,writable:SG,duplex:fG});let G=f1({error:$,command:q,escapedCommand:J,fileDescriptors:X,options:Z,startTime:H,isSync:!1}),K=bG(G,Q,Z);return{subprocess:Y,promise:K}},vG=($,q)=>{let J=X0(),X=X0(),Z=X0(),H=Array.from({length:q.length-3},X0),Q=X0(),Y=[J,X,Z,...H];Object.assign($,{stdin:J,stdout:X,stderr:Z,all:Q,stdio:Y})},X0=()=>{let $=new yG;return $.end(),$},hG=()=>new OG({read(){}}),SG=()=>new NG({write(){}}),fG=()=>new DG({read(){},write(){}}),bG=async($,q,J)=>b1($,q,J);import{createReadStream as v5,createWriteStream as h5}from"node:fs";import{Buffer as gG}from"node:buffer";import{Readable as Z0,Writable as cG,Duplex as mG}from"node:stream";var f5=($,q)=>z$(uG,$,q,!1),Q0=({type:$,optionName:q})=>{throw TypeError(`The \`${q}\` option cannot be ${L1[$]}.`)},S5={fileNumber:Q0,generator:e2,asyncGenerator:e2,nodeStream:({value:$})=>({stream:$}),webTransform({value:{transform:$,writableObjectMode:q,readableObjectMode:J}}){let X=q||J;return{stream:mG.fromWeb($,{objectMode:X})}},duplex:({value:{transform:$}})=>({stream:$}),native(){}},uG={input:{...S5,fileUrl:({value:$})=>({stream:v5($)}),filePath:({value:{file:$}})=>({stream:v5($)}),webStream:({value:$})=>({stream:Z0.fromWeb($)}),iterable:({value:$})=>({stream:Z0.from($)}),asyncIterable:({value:$})=>({stream:Z0.from($)}),string:({value:$})=>({stream:Z0.from($)}),uint8Array:({value:$})=>({stream:Z0.from(gG.from($))})},output:{...S5,fileUrl:({value:$})=>({stream:h5($)}),filePath:({value:{file:$,append:q}})=>({stream:h5($,q?{flags:"a"}:{})}),webStream:({value:$})=>({stream:cG.fromWeb($)}),iterable:Q0,asyncIterable:Q0,string:Q0,uint8Array:Q0}};import{on as pG,once as b5}from"node:events";import{PassThrough as lG,getDefaultHighWaterMark as dG}from"node:stream";import{finished as m5}from"node:stream/promises";function x1($){if(!Array.isArray($))throw TypeError(`Expected an array, got \`${typeof $}\`.`);for(let Z of $)Z4(Z);let q=$.some(({readableObjectMode:Z})=>Z),J=iG($,q),X=new u5({objectMode:q,writableHighWaterMark:J,readableHighWaterMark:J});for(let Z of $)X.add(Z);return X}var iG=($,q)=>{if($.length===0)return dG(q);let J=$.filter(({readableObjectMode:X})=>X===q).map(({readableHighWaterMark:X})=>X);return Math.max(...J)};class u5 extends lG{#q=new Set([]);#J=new Set([]);#$=new Set([]);#X;#Q=Symbol("unpipe");#Z=new WeakMap;add($){if(Z4($),this.#q.has($))return;this.#q.add($),this.#X??=nG(this,this.#q,this.#Q);let q=oG({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(Z4($),!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 nG=async($,q,J)=>{T$($,g5);let X=new AbortController;try{await Promise.race([aG($,X),tG($,q,J,X)])}finally{X.abort(),T$($,-g5)}},aG=async($,{signal:q})=>{try{await m5($,{signal:q,cleanup:!0})}catch(J){throw p5($,J),J}},tG=async($,q,J,{signal:X})=>{for await(let[Z]of pG($,"unpipe",{signal:X}))if(q.has(Z))Z.emit(J)},Z4=($)=>{if(typeof $?.pipe!=="function")throw TypeError(`Expected a readable stream, got: \`${typeof $}\`.`)},oG=async({passThroughStream:$,stream:q,streams:J,ended:X,aborted:Z,onFinished:H,unpipeEvent:Q})=>{T$($,c5);let Y=new AbortController;try{await Promise.race([rG(H,q,Y),sG({passThroughStream:$,stream:q,streams:J,ended:X,aborted:Z,controller:Y}),eG({stream:q,streams:J,ended:X,aborted:Z,unpipeEvent:Q,controller:Y})])}finally{Y.abort(),T$($,-c5)}if(J.size>0&&J.size===X.size+Z.size)if(X.size===0&&Z.size>0)Q4($);else $K($)},rG=async($,q,{signal:J})=>{try{if(await $,!J.aborted)Q4(q)}catch(X){if(!J.aborted)p5(q,X)}},sG=async({passThroughStream:$,stream:q,streams:J,ended:X,aborted:Z,controller:{signal:H}})=>{try{if(await m5(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(l5(Q))Z.add(q);else d5($,Q)}},eG=async({stream:$,streams:q,ended:J,aborted:X,unpipeEvent:Z,controller:{signal:H}})=>{if(await b5($,Z,{signal:H}),!$.readable)return b5(H,"abort",{signal:H});q.delete($),J.delete($),X.delete($)},$K=($)=>{if($.writable)$.end()},p5=($,q)=>{if(l5(q))Q4($);else d5($,q)},l5=($)=>$?.code==="ERR_STREAM_PREMATURE_CLOSE",Q4=($)=>{if($.readable||$.writable)$.destroy()},d5=($,q)=>{if(!$.destroyed)$.once("error",qK),$.destroy(q)},qK=()=>{},T$=($,q)=>{let J=$.getMaxListeners();if(J!==0&&J!==Number.POSITIVE_INFINITY)$.setMaxListeners(J+q)},g5=2,c5=1;import{finished as i5}from"node:stream/promises";var c1=($,q)=>{$.pipe(q),JK($,q),XK($,q)},JK=async($,q)=>{if(d($)||d(q))return;try{await i5($,{cleanup:!0,readable:!0,writable:!1})}catch{}H4(q)},H4=($)=>{if($.writable)$.end()},XK=async($,q)=>{if(d($)||d(q))return;try{await i5(q,{cleanup:!0,readable:!1,writable:!0})}catch{}Y4($)},Y4=($)=>{if($.readable)$.destroy()};var n5=($,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})=>l.has(G)))ZK($,Y,Q,Z);for(let{stream:Y}of H.filter(({type:G})=>!l.has(G)))HK({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]:x1(H);c1(Q,Z)}},ZK=($,q,J,X)=>{if(J==="output")c1($.stdio[X],q);else c1(q,$.stdio[X]);let Z=QK[X];if(Z!==void 0)$[Z]=q;$.stdio[X]=q},QK=["stdin","stdout","stderr"],HK=({subprocess:$,stream:q,direction:J,fdNumber:X,pipeGroups:Z,controller:H})=>{if(q===void 0)return;YK(q,H);let[Q,Y]=J==="output"?[q,$.stdio[X]]:[$.stdio[X],q],G=Z.get(Q)??[];Z.set(Q,[...G,Y])},YK=($,{signal:q})=>{if(d($))T1($,GK,q)},GK=2;import{addAbortListener as zK}from"node:events";var j1=[];j1.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")j1.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")j1.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var P$=($)=>!!$&&typeof $==="object"&&typeof $.removeListener==="function"&&typeof $.emit==="function"&&typeof $.reallyExit==="function"&&typeof $.listeners==="function"&&typeof $.kill==="function"&&typeof $.pid==="number"&&typeof $.on==="function",G4=Symbol.for("signal-exit emitter"),K4=globalThis,KK=Object.defineProperty.bind(Object);class a5{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(K4[G4])return K4[G4];KK(K4,G4,{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 z4{}var UK=($)=>{return{onExit(q,J){return $.onExit(q,J)},load(){return $.load()},unload(){return $.unload()}}};class t5 extends z4{onExit(){return()=>{}}load(){}unload(){}}class o5 extends z4{#q=U4.platform==="win32"?"SIGINT":"SIGHUP";#J=new a5;#$;#X;#Q;#Z={};#H=!1;constructor($){super();this.#$=$,this.#Z={};for(let q of j1)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(!P$(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 j1)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,j1.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(!P$(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"&&P$(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 U4=globalThis.process,{onExit:r5,load:Wk,unload:_k}=UK(P$(U4)?new o5(U4):new t5);var s5=($,{cleanup:q,detached:J},{signal:X})=>{if(!q||J)return;let Z=r5(()=>{$.kill()});zK(X,()=>{Z()})};var $q=({source:$,sourcePromise:q,boundOptions:J,createNested:X},...Z)=>{let H=w0(),{destination:Q,destinationStream:Y,destinationError:G,from:K,unpipeSignal:U}=BK(J,X,Z),{sourceStream:z,sourceError:B}=VK($,K),{options:L,fileDescriptors:R}=e.get($);return{sourcePromise:q,sourceStream:z,sourceOptions:L,sourceError:B,destination:Q,destinationStream:Y,destinationError:G,unpipeSignal:U,fileDescriptors:R,startTime:H}},BK=($,q,J)=>{try{let{destination:X,pipeOptions:{from:Z,to:H,unpipeSignal:Q}={}}=LK($,q,...J),Y=c0(X,H);return{destination:X,destinationStream:Y,from:Z,unpipeSignal:Q}}catch(X){return{destinationError:X}}},LK=($,q,J,...X)=>{if(Array.isArray(J))return{destination:q(e5,$)(J,...X),pipeOptions:$};if(typeof J==="string"||J instanceof URL||X2(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]=R0(J,...X);return{destination:q(e5)(Z,H,Q),pipeOptions:Q}}if(e.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}`)},e5=({options:$})=>({options:{...$,stdin:"pipe",piped:!0}}),VK=($,q)=>{try{return{sourceStream:v1($,q)}}catch(J){return{sourceError:J}}};var Jq=({sourceStream:$,sourceError:q,destinationStream:J,destinationError:X,fileDescriptors:Z,sourceOptions:H,startTime:Q})=>{let Y=WK({sourceStream:$,sourceError:q,destinationStream:J,destinationError:X});if(Y!==void 0)throw B4({error:Y,fileDescriptors:Z,sourceOptions:H,startTime:Q})},WK=({sourceStream:$,sourceError:q,destinationStream:J,destinationError:X})=>{if(q!==void 0&&X!==void 0)return X;if(X!==void 0)return Y4($),X;if(q!==void 0)return H4(J),q},B4=({error:$,fileDescriptors:q,sourceOptions:J,startTime:X})=>f1({error:$,command:qq,escapedCommand:qq,fileDescriptors:q,options:J,startTime:X,isSync:!1}),qq="source.pipe(destination)";var Xq=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 _K}from"node:stream/promises";var Zq=($,q,J)=>{let X=k$.has(q)?TK($,q):RK($,q);return T1($,kK,J.signal),T1(q,FK,J.signal),PK(q),X},RK=($,q)=>{let J=x1([$]);return c1(J,q),k$.set(q,J),J},TK=($,q)=>{let J=k$.get(q);return J.add($),J},PK=async($)=>{try{await _K($,{cleanup:!0,readable:!1,writable:!0})}catch{}k$.delete($)},k$=new WeakMap,kK=2,FK=1;import{aborted as xK}from"node:util";var Qq=($,q)=>$===void 0?[]:[jK($,q)],jK=async($,{sourceStream:q,mergedStream:J,fileDescriptors:X,sourceOptions:Z,startTime:H})=>{await xK($,q),await J.remove(q);let Q=Error("Pipe canceled by `unpipeSignal` option.");throw B4({error:Q,fileDescriptors:X,sourceOptions:Z,startTime:H})};var F$=($,...q)=>{if(E(q[0]))return F$.bind(void 0,{...$,boundOptions:{...$.boundOptions,...q[0]}});let{destination:J,...X}=$q($,...q),Z=MK({...X,destination:J});return Z.pipe=F$.bind(void 0,{...$,source:J,sourcePromise:Z,boundOptions:{}}),Z},MK=async({sourcePromise:$,sourceStream:q,sourceOptions:J,sourceError:X,destination:Z,destinationStream:H,destinationError:Q,unpipeSignal:Y,fileDescriptors:G,startTime:K})=>{let U=CK($,Z);Jq({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([Xq(U),...Qq(Y,{sourceStream:q,mergedStream:B,sourceOptions:J,fileDescriptors:G,startTime:K})])}finally{z.abort()}},CK=($,q)=>Promise.allSettled([$,q]);import{setImmediate as NK}from"node:timers/promises";import{on as IK}from"node:events";import{getDefaultHighWaterMark as wK}from"node:stream";var x$=({subprocessStdout:$,subprocess:q,binary:J,shouldEncode:X,encoding:Z,preserveNewlines:H})=>{let Q=new AbortController;return AK(q,Q),Yq({stream:$,controller:Q,binary:J,shouldEncode:!$.readableObjectMode&&X,encoding:Z,shouldSplit:!$.readableObjectMode,preserveNewlines:H})},AK=async($,q)=>{try{await $}catch{}finally{q.abort()}},L4=({stream:$,onStreamEnd:q,lines:J,encoding:X,stripFinalNewline:Z,allMixed:H})=>{let Q=new AbortController;EK(q,Q,$);let Y=$.readableObjectMode&&!H;return Yq({stream:$,controller:Q,binary:X==="buffer",shouldEncode:!Y,encoding:X,shouldSplit:!Y&&J,preserveNewlines:!Z})},EK=async($,q,J)=>{try{await $}catch{J.destroy()}finally{q.abort()}},Yq=({stream:$,controller:q,binary:J,shouldEncode:X,encoding:Z,shouldSplit:H,preserveNewlines:Q})=>{let Y=IK($,"data",{signal:q.signal,highWaterMark:Hq,highWatermark:Hq});return yK({onStdoutChunk:Y,controller:q,binary:J,shouldEncode:X,encoding:Z,shouldSplit:H,preserveNewlines:Q})},V4=wK(!0),Hq=V4,yK=async function*({onStdoutChunk:$,controller:q,binary:J,shouldEncode:X,encoding:Z,shouldSplit:H,preserveNewlines:Q}){let Y=OK({binary:J,shouldEncode:X,encoding:Z,shouldSplit:H,preserveNewlines:Q});try{for await(let[G]of $)yield*F1(G,Y,0)}catch(G){if(!q.signal.aborted)throw G}finally{yield*J0(Y)}},OK=({binary:$,shouldEncode:q,encoding:J,shouldSplit:X,preserveNewlines:Z})=>[L$($,J,!q),B$($,Z,!X,{})].filter(Boolean);var Gq=async({stream:$,onStreamEnd:q,fdNumber:J,encoding:X,buffer:Z,maxBuffer:H,lines:Q,allMixed:Y,stripFinalNewline:G,verboseInfo:K,streamInfo:U})=>{let z=DK({stream:$,onStreamEnd:q,fdNumber:J,encoding:X,allMixed:Y,verboseInfo:K,streamInfo:U});if(!Z){await Promise.all([vK($),z]);return}let B=a2(G,J),L=L4({stream:$,onStreamEnd:q,lines:Q,encoding:X,stripFinalNewline:B,allMixed:Y}),[R]=await Promise.all([hK({stream:$,iterable:L,fdNumber:J,encoding:X,maxBuffer:H,lines:Q}),z]);return R},DK=async({stream:$,onStreamEnd:q,fdNumber:J,encoding:X,allMixed:Z,verboseInfo:H,streamInfo:{fileDescriptors:Q}})=>{if(!_$({stdioItems:Q[J]?.stdioItems,encoding:X,verboseInfo:H,fdNumber:J}))return;let Y=L4({stream:$,onStreamEnd:q,lines:!0,encoding:X,stripFinalNewline:!0,allMixed:Z});await W5(Y,$,J,H)},vK=async($)=>{if(await NK(),$.readableFlowing===null)$.resume()},hK=async({stream:$,stream:{readableObjectMode:q},iterable:J,fdNumber:X,encoding:Z,maxBuffer:H,lines:Q})=>{try{if(q||Q)return await J$(J,{maxBuffer:H});if(Z==="buffer")return new Uint8Array(await X$(J,{maxBuffer:H}));return await Q$(J,{maxBuffer:H})}catch(Y){return Kq(W7({error:Y,stream:$,readableObjectMode:q,lines:Q,encoding:Z,fdNumber:X}))}},W4=async($)=>{try{return await $}catch(q){return Kq(q)}},Kq=({bufferedData:$})=>O3($)?new Uint8Array($):$;import{finished as SK}from"node:stream/promises";var H0=async($,q,J,{isSameDirection:X,stopOnExit:Z=!1}={})=>{let H=fK($,J),Q=new AbortController;try{await Promise.race([...Z?[J.exitPromise]:[],SK($,{cleanup:!0,signal:Q.signal})])}catch(Y){if(!H.stdinCleanedUp)cK(Y,q,J,X)}finally{Q.abort()}},fK=($,{originalStreams:[q],subprocess:J})=>{let X={stdinCleanedUp:!1};if($===q)bK($,J,X);return X},bK=($,q,J)=>{let{_destroy:X}=$;$._destroy=(...Z)=>{gK(q,J),X.call($,...Z)}},gK=({exitCode:$,signalCode:q},J)=>{if($!==null||q!==null)J.stdinCleanedUp=!0},cK=($,q,J,X)=>{if(!mK($,q,J,X))throw $},mK=($,q,J,X=!0)=>{if(J.propagating)return Uq($)||j$($);return J.propagating=!0,_4(J,q)===X?Uq($):j$($)},_4=({fileDescriptors:$},q)=>q!=="all"&&$[q].direction==="input",j$=($)=>$?.code==="ERR_STREAM_PREMATURE_CLOSE",Uq=($)=>$?.code==="EPIPE";var zq=({subprocess:$,encoding:q,buffer:J,maxBuffer:X,lines:Z,stripFinalNewline:H,verboseInfo:Q,streamInfo:Y})=>$.stdio.map((G,K)=>R4({stream:G,fdNumber:K,encoding:q,buffer:J[K],maxBuffer:X[K],lines:Z[K],allMixed:!1,stripFinalNewline:H,verboseInfo:Q,streamInfo:Y})),R4=async({stream:$,fdNumber:q,encoding:J,buffer:X,maxBuffer:Z,lines:H,allMixed:Q,stripFinalNewline:Y,verboseInfo:G,streamInfo:K})=>{if(!$)return;let U=H0($,q,K);if(_4(K,q)){await U;return}let[z]=await Promise.all([Gq({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 Bq=({stdout:$,stderr:q},{all:J})=>J&&($||q)?x1([$,q].filter(Boolean)):void 0,Lq=({subprocess:$,encoding:q,buffer:J,maxBuffer:X,lines:Z,stripFinalNewline:H,verboseInfo:Q,streamInfo:Y})=>R4({...uK($,J),fdNumber:"all",encoding:q,maxBuffer:X[1]+X[2],lines:Z[1]||Z[2],allMixed:pK($),stripFinalNewline:H,verboseInfo:Q,streamInfo:Y}),uK=({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}},pK=({all:$,stdout:q,stderr:J})=>$&&q&&J&&q.readableObjectMode!==J.readableObjectMode;import{once as lK}from"node:events";var Vq=($)=>E1($,"ipc"),Wq=($,q)=>{let J=I0($);o({type:"ipc",verboseMessage:J,fdNumber:"ipc",verboseInfo:q})};var _q=async({subprocess:$,buffer:q,maxBuffer:J,ipc:X,ipcOutput:Z,verboseInfo:H})=>{if(!X)return Z;let Q=Vq(H),Y=Q1(q,"ipc"),G=Q1(J,"ipc");for await(let K of X4({anyProcess:$,channel:$.channel,isSubprocess:!1,ipc:X,shouldAwait:!1,reference:!0})){if(Y)_7($,Z,G),Z.push(K);if(Q)Wq(K,H)}return Z},Rq=async($,q)=>{return await Promise.allSettled([$]),q};var Tq=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:R,originalStreams:P,onInternalError:M,controller:F})=>{let O=k5($,B),v={originalStreams:P,fileDescriptors:R,subprocess:$,exitPromise:O,propagating:!1},x=zq({subprocess:$,encoding:q,buffer:J,maxBuffer:X,lines:Z,stripFinalNewline:K,verboseInfo:L,streamInfo:v}),w=Lq({subprocess:$,encoding:q,buffer:J,maxBuffer:X,lines:Z,stripFinalNewline:K,verboseInfo:L,streamInfo:v}),N=[],g=_q({subprocess:$,buffer:J,maxBuffer:X,ipc:U,ipcOutput:N,verboseInfo:L}),K1=dK(P,$,v),U1=iK(R,v);try{return await Promise.race([Promise.all([{},x5(O),Promise.all(x),w,g,n8($,z),...K1,...U1]),M,nK($,F),...u8($,H,B,F),...K8({subprocess:$,cancelSignal:Q,gracefulCancel:Y,context:B,controller:F}),...c8({subprocess:$,cancelSignal:Q,gracefulCancel:Y,forceKillAfterDelay:G,context:B,controller:F})])}catch(i$){return B.terminationReason??="other",Promise.all([{error:i$},O,Promise.all(x.map((i1)=>W4(i1))),W4(w),Rq(g,N),Promise.allSettled(K1),Promise.allSettled(U1)])}},dK=($,q,J)=>$.map((X,Z)=>X===q.stdio[Z]?void 0:H0(X,Z,J)),iK=($,q)=>$.flatMap(({stdioItems:J},X)=>J.filter(({value:Z,stream:H=Z})=>n(H,{checkOpen:!1})&&!d(H)).map(({type:Z,value:H,stream:Q=H})=>H0(Q,X,q,{isSameDirection:l.has(Z),stopOnExit:Z==="native"}))),nK=async($,{signal:q})=>{let[J]=await lK($,"error",{signal:q});throw J};var Pq=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),Y0=($,q,J)=>{let X=$[J];if(!X.has(q))X.set(q,[]);let Z=X.get(q),H=s();return Z.push(H),{resolve:H.resolve.bind(H),promises:Z}},m1=async({resolve:$,promises:q},J)=>{$();let[X]=await Promise.race([Promise.allSettled([!0,J]),Promise.all([!1,...q])]);return!X};import{Readable as aK}from"node:stream";import{callbackify as tK}from"node:util";import{finished as kq}from"node:stream/promises";var T4=async($)=>{if($===void 0)return;try{await P4($)}catch{}},Fq=async($)=>{if($===void 0)return;try{await k4($)}catch{}},P4=async($)=>{await kq($,{cleanup:!0,readable:!1,writable:!0})},k4=async($)=>{await kq($,{cleanup:!0,readable:!0,writable:!1})},M$=async($,q)=>{if(await $,q)throw q},C$=($,q,J)=>{if(J&&!j$(J))$.destroy(J);else if(q)$.destroy()};var xq=({subprocess:$,concurrentStreams:q,encoding:J},{from:X,binary:Z=!0,preserveNewlines:H=!0}={})=>{let Q=Z||m.has(J),{subprocessStdout:Y,waitReadableDestroy:G}=F4($,X,q),{readableEncoding:K,readableObjectMode:U,readableHighWaterMark:z}=x4(Y,Q),{read:B,onStdoutDataDone:L}=j4({subprocessStdout:Y,subprocess:$,binary:Q,encoding:J,preserveNewlines:H}),R=new aK({read:B,destroy:tK(C4.bind(void 0,{subprocessStdout:Y,subprocess:$,waitReadableDestroy:G})),highWaterMark:z,objectMode:U,encoding:K});return M4({subprocessStdout:Y,onStdoutDataDone:L,readable:R,subprocess:$}),R},F4=($,q,J)=>{let X=v1($,q),Z=Y0(J,X,"readableDestroy");return{subprocessStdout:X,waitReadableDestroy:Z}},x4=({readableEncoding:$,readableObjectMode:q,readableHighWaterMark:J},X)=>X?{readableEncoding:$,readableObjectMode:q,readableHighWaterMark:J}:{readableEncoding:$,readableObjectMode:!0,readableHighWaterMark:V4},j4=({subprocessStdout:$,subprocess:q,binary:J,encoding:X,preserveNewlines:Z})=>{let H=s(),Q=x$({subprocessStdout:$,subprocess:q,binary:J,shouldEncode:!J,encoding:X,preserveNewlines:Z});return{read(){oK(this,Q,H)},onStdoutDataDone:H}},oK=async($,q,J)=>{try{let{value:X,done:Z}=await q.next();if(Z)J.resolve();else $.push(X)}catch{}},M4=async({subprocessStdout:$,onStdoutDataDone:q,readable:J,subprocess:X,subprocessStdin:Z})=>{try{if(await k4($),await X,await T4(Z),await q,J.readable)J.push(null)}catch(H){await T4(Z),jq(J,H)}},C4=async({subprocessStdout:$,subprocess:q,waitReadableDestroy:J},X)=>{if(await m1(J,q))jq($,X),await M$(q,X)},jq=($,q)=>{C$($,$.readable,q)};import{Writable as rK}from"node:stream";import{callbackify as Mq}from"node:util";var Cq=({subprocess:$,concurrentStreams:q},{to:J}={})=>{let{subprocessStdin:X,waitWritableFinal:Z,waitWritableDestroy:H}=I4($,J,q),Q=new rK({...w4(X,$,Z),destroy:Mq(E4.bind(void 0,{subprocessStdin:X,subprocess:$,waitWritableFinal:Z,waitWritableDestroy:H})),highWaterMark:X.writableHighWaterMark,objectMode:X.writableObjectMode});return A4(X,Q),Q},I4=($,q,J)=>{let X=c0($,q),Z=Y0(J,X,"writableFinal"),H=Y0(J,X,"writableDestroy");return{subprocessStdin:X,waitWritableFinal:Z,waitWritableDestroy:H}},w4=($,q,J)=>({write:sK.bind(void 0,$),final:Mq(eK.bind(void 0,$,q,J))}),sK=($,q,J,X)=>{if($.write(q,J))X();else $.once("drain",X)},eK=async($,q,J)=>{if(await m1(J,q)){if($.writable)$.end();await q}},A4=async($,q,J)=>{try{if(await P4($),q.writable)q.end()}catch(X){await Fq(J),Iq(q,X)}},E4=async({subprocessStdin:$,subprocess:q,waitWritableFinal:J,waitWritableDestroy:X},Z)=>{if(await m1(J,q),await m1(X,q))Iq($,Z),await M$(q,Z)},Iq=($,q)=>{C$($,$.writable,q)};import{Duplex as $U}from"node:stream";import{callbackify as qU}from"node:util";var wq=({subprocess:$,concurrentStreams:q,encoding:J},{from:X,to:Z,binary:H=!0,preserveNewlines:Q=!0}={})=>{let Y=H||m.has(J),{subprocessStdout:G,waitReadableDestroy:K}=F4($,X,q),{subprocessStdin:U,waitWritableFinal:z,waitWritableDestroy:B}=I4($,Z,q),{readableEncoding:L,readableObjectMode:R,readableHighWaterMark:P}=x4(G,Y),{read:M,onStdoutDataDone:F}=j4({subprocessStdout:G,subprocess:$,binary:Y,encoding:J,preserveNewlines:Q}),O=new $U({read:M,...w4(U,$,z),destroy:qU(JU.bind(void 0,{subprocessStdout:G,subprocessStdin:U,subprocess:$,waitReadableDestroy:K,waitWritableFinal:z,waitWritableDestroy:B})),readableHighWaterMark:P,writableHighWaterMark:U.writableHighWaterMark,readableObjectMode:R,writableObjectMode:U.writableObjectMode,encoding:L});return M4({subprocessStdout:G,onStdoutDataDone:F,readable:O,subprocess:$,subprocessStdin:U}),A4(U,O,G),O},JU=async({subprocessStdout:$,subprocessStdin:q,subprocess:J,waitReadableDestroy:X,waitWritableFinal:Z,waitWritableDestroy:H},Q)=>{await Promise.all([C4({subprocessStdout:$,subprocess:J,waitReadableDestroy:X},Q),E4({subprocessStdin:q,subprocess:J,waitWritableFinal:Z,waitWritableDestroy:H},Q)])};var y4=($,q,{from:J,binary:X=!1,preserveNewlines:Z=!1}={})=>{let H=X||m.has(q),Q=v1($,J),Y=x$({subprocessStdout:Q,subprocess:$,binary:H,shouldEncode:!0,encoding:q,preserveNewlines:Z});return XU(Y,Q,$)},XU=async function*($,q,J){try{yield*$}finally{if(q.readable)q.destroy();await J}};var Aq=($,{encoding:q})=>{let J=Pq();$.readable=xq.bind(void 0,{subprocess:$,concurrentStreams:J,encoding:q}),$.writable=Cq.bind(void 0,{subprocess:$,concurrentStreams:J}),$.duplex=wq.bind(void 0,{subprocess:$,concurrentStreams:J,encoding:q}),$.iterable=y4.bind(void 0,$,q),$[Symbol.asyncIterator]=y4.bind(void 0,$,q,{})};var Eq=($,q)=>{for(let[J,X]of QU){let Z=X.value.bind(q);Reflect.defineProperty($,J,{...X,value:Z})}},ZU=(async()=>{})().constructor.prototype,QU=["then","catch","finally"].map(($)=>[$,Reflect.getOwnPropertyDescriptor(ZU,$)]);var yq=($,q,J,X)=>{let{file:Z,commandArguments:H,command:Q,escapedCommand:Y,startTime:G,verboseInfo:K,options:U,fileDescriptors:z}=GU($,q,J),{subprocess:B,promise:L}=UU({file:Z,commandArguments:H,options:U,startTime:G,verboseInfo:K,command:Q,escapedCommand:Y,fileDescriptors:z});return B.pipe=F$.bind(void 0,{source:B,sourcePromise:L,boundOptions:{},createNested:X}),Eq(B,L),e.set(B,{options:U,fileDescriptors:z}),B},GU=($,q,J)=>{let{command:X,escapedCommand:Z,startTime:H,verboseInfo:Q}=A0($,q,J),{file:Y,commandArguments:G,options:K}=r0($,q,J),U=KU(K),z=f5(U,Q);return{file:Y,commandArguments:G,command:X,escapedCommand:Z,startTime:H,verboseInfo:Q,options:U,fileDescriptors:z}},KU=({timeout:$,signal:q,...J})=>{if(q!==void 0)throw TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...J,timeoutDuration:$}},UU=({file:$,commandArguments:q,options:J,startTime:X,verboseInfo:Z,command:H,escapedCommand:Q,fileDescriptors:Y})=>{let G;try{G=YU(...s0($,q,J))}catch(R){return D5({error:R,command:H,escapedCommand:Q,fileDescriptors:Y,options:J,startTime:X,verboseInfo:Z})}let K=new AbortController;HU(Number.POSITIVE_INFINITY,K.signal);let U=[...G.stdio];n5(G,Y,K),s5(G,J,K);let z={},B=s();G.kill=Y8.bind(void 0,{kill:G.kill.bind(G),options:J,onInternalError:B,context:z,controller:K}),G.all=Bq(G,J),Aq(G,J),y5(G,J);let L=zU({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}},zU=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],R,P,M]=await Tq({subprocess:$,options:q,context:G,verboseInfo:X,fileDescriptors:Z,originalStreams:H,onInternalError:K,controller:U});U.abort(),K.resolve();let F=R.map((x,w)=>G1(x,q,w)),O=G1(P,q,"all"),v=BU({errorInfo:z,exitCode:B,signal:L,stdio:F,all:O,ipcOutput:M,context:G,options:q,command:Q,escapedCommand:Y,startTime:J});return b1(v,X,q)},BU=({errorInfo:$,exitCode:q,signal:J,stdio:X,all:Z,ipcOutput:H,context:Q,options:Y,command:G,escapedCommand:K,startTime:U})=>("error"in $)?q0({error:$.error,command:G,escapedCommand:K,timedOut:Q.terminationReason==="timeout",isCanceled:Q.terminationReason==="cancel"||Q.terminationReason==="gracefulCancel",isGracefullyCanceled:Q.terminationReason==="gracefulCancel",isMaxBuffer:$.error instanceof H1,isForcefullyTerminated:Q.isForcefullyTerminated,exitCode:q,signal:J,stdio:X,all:Z,ipcOutput:H,options:Y,startTime:U,isSync:!1}):Y$({command:G,escapedCommand:K,stdio:X,all:Z,ipcOutput:H,options:Y,startTime:U});var I$=($,q)=>{let J=Object.fromEntries(Object.entries(q).map(([X,Z])=>[X,LU(X,$[X],Z)]));return{...$,...J}},LU=($,q,J)=>{if(VU.has($)&&E(q)&&E(J))return{...q,...J};return J},VU=new Set(["env",...K2]);var V1=($,q,J,X)=>{let Z=(Q,Y,G)=>V1(Q,Y,J,G),H=(...Q)=>WU({mapArguments:$,deepOptions:J,boundOptions:q,setBoundExeca:X,createNested:Z},...Q);if(X!==void 0)X(H,Z,q);return H},WU=({mapArguments:$,deepOptions:q={},boundOptions:J={},setBoundExeca:X,createNested:Z},H,...Q)=>{if(E(H))return Z($,I$(J,H),X);let{file:Y,commandArguments:G,options:K,isSync:U}=_U({mapArguments:$,firstArgument:H,nextArguments:Q,deepOptions:q,boundOptions:J});return U?M5(Y,G,K):yq(Y,G,K,Z)},_U=({mapArguments:$,firstArgument:q,nextArguments:J,deepOptions:X,boundOptions:Z})=>{let H=f3(q)?b3(q,J):[q,...J],[Q,Y,G]=R0(...H),K=I$(I$(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 Oq=({file:$,commandArguments:q})=>Dq($,q),Nq=({file:$,commandArguments:q})=>({...Dq($,q),isSync:!0}),Dq=($,q)=>{if(q.length>0)throw TypeError(`The command and its arguments must be passed as a single string: ${$} ${q}.`);let[J,...X]=RU($);return{file:J,commandArguments:X}},RU=($)=>{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(TU)){let Z=J.at(-1);if(Z&&Z.endsWith("\\"))J[J.length-1]=`${Z.slice(0,-1)} ${X}`;else J.push(X)}return J},TU=/ +/g;var vq=($,q,J)=>{$.sync=q(PU,J),$.s=$.sync},hq=({options:$})=>Sq($),PU=({options:$})=>({...Sq($),isSync:!0}),Sq=($)=>({options:{...kU($),...$}}),kU=({input:$,inputFile:q,stdio:J})=>$===void 0&&q===void 0&&J===void 0?{stdin:"inherit"}:{},fq={preferLocal:!0};var S=V1(()=>({})),Qj=V1(()=>({isSync:!0})),Hj=V1(Oq),Yj=V1(Nq),Gj=V1(l8),Kj=V1(hq,{},fq,vq),{sendMessage:Uj,getOneMessage:zj,getEachMessage:Bj,getCancelSignal:Lj}=O5();import{access as bq,readFile as cq}from"fs/promises";import{join as O4,dirname as gq}from"path";async function N4(){if(process.env.IDF_PATH)try{return await bq(process.env.IDF_PATH),process.env.IDF_PATH}catch{}try{return await bq(q2),q2}catch{}return null}async function w$($){let q=O4($,"version.txt");try{return(await cq(q,"utf-8")).trim()}catch{}try{return(await S("git",["describe","--tags"],{cwd:$})).stdout.trim()}catch{}return null}async function mq(){let $=await N4();if(!$)return{installed:!1};let q=await w$($);return{installed:!0,path:$,version:q||void 0}}async function M1($){let q=O4($,"CMakeLists.txt");try{let J=await cq(q,"utf-8");return J.includes("$ENV{IDF_PATH}")||J.includes("idf_component_register")}catch{return!1}}async function q1($){let q=$;while(q!==gq(q)){if(await M1(q))return q;q=gq(q)}return null}function D4($){return O4($,"export.sh")}async function v4($,q,J={}){let{cwd:X,operationId:Z,env:H}=J,Q={cwd:X,env:{...process.env,...H},reject:!1};try{let Y=S($,q,Q);if(Z)Y.stdout?.on("data",(K)=>{_.emit(Z,{type:"stdout",text:K.toString()})}),Y.stderr?.on("data",(K)=>{_.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 J1($,q,J={}){let X=await N4();if(!X)return{ok:!1,error:"ESP-IDF not found. Run `espcli install` first.",code:"IDF_NOT_FOUND"};let H=`source ${D4(X)} > /dev/null 2>&1 && ${$} ${q.join(" ")}`,{cwd:Q,operationId:Y,env:G}=J,K={cwd:Q,env:{...process.env,...G},shell:!0,reject:!1};try{let U=S(H,[],K);if(Y)U.stdout?.on("data",(B)=>{_.emit(Y,{type:"stdout",text:B.toString()})}),U.stderr?.on("data",(B)=>{_.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}`}}}function uq($,q,J={}){let X=process.env.IDF_PATH;if(!X)return null;let H=`source ${D4(X)} > /dev/null 2>&1 && ${$} ${q.join(" ")}`,{cwd:Q,operationId:Y,env:G}=J,K=S(H,[],{cwd:Q,env:{...process.env,...G},shell:!0,reject:!1});if(Y)K.stdout?.on("data",(U)=>{_.emit(Y,{type:"stdout",text:U.toString()})}),K.stderr?.on("data",(U)=>{_.emit(Y,{type:"stderr",text:U.toString()})});return K}import{homedir as FU}from"os";import{join as xU}from"path";import{readFile as jU,appendFile as MU,access as Aj}from"fs/promises";function pq(){let $=process.env.SHELL||"";if($.includes("zsh"))return"zsh";if($.includes("bash"))return"bash";if($.includes("fish"))return"fish";return"unknown"}function A$(){let $=pq(),q=w3[$]||"",J=q?xU(FU(),q):"";return{type:$,configPath:J}}async function CU($){let{configPath:q}=A$();if(!q)return!1;try{return(await jU(q,"utf-8")).includes($)}catch{return!1}}async function lq($){let{configPath:q,type:J}=A$();if(!q)return{ok:!1,error:`Unsupported shell: ${J}`};if(await CU($))return{ok:!0,data:void 0};try{return await MU(q,`
70
70
  ${$}
71
- `),{ok:!0,data:void 0}}catch(Z){return{ok:!1,error:`Failed to modify ${q}: ${Z}`}}}function dq($){if(pq()==="fish")return`source ${$}/export.fish`;return`. ${$}/export.sh`}import{mkdir as MU,access as CU}from"fs/promises";import{join as IU}from"path";async function iq($={},q){let J=q||j(),X=$.path||R0,Z=$.target||"all",H=$.addToShell??!0,Q=IU(X,"esp-idf");try{await CU(Q);let B=await w$(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 MU(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 D4("git",["clone","--recursive",M3],{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 D4("./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=dq(Q),L=await lq(B);if(L.ok)U=!0;else R.emit(J,{type:"log",level:"warn",message:L.error})}let z=await w$(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 i4}from"node:util";var S=t(f4(),1),HJ=t(C1(),1);import{stdin as ZJ,stdout as QJ}from"node:process";import*as V1 from"node:readline";import oq from"node:readline";import{Writable as NU}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 vU=DU();function YJ($){if(typeof $!="string")throw TypeError(`Expected a \`string\`, got \`${typeof $}\``);return $.replace(vU,"")}function GJ($){return $&&$.__esModule&&Object.prototype.hasOwnProperty.call($,"default")?$.default:$}var KJ={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}})(KJ);var fU=KJ.exports,hU=GJ(fU),SU=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},bU=GJ(SU);function G0($,q={}){if(typeof $!="string"||$.length===0||(q={ambiguousIsNarrow:!0,...q},$=YJ($),$.length===0))return 0;$=$.replace(bU()," ");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(hU.eastAsianWidth(Z)){case"F":case"W":X+=2;break;case"A":X+=J;break;default:X+=1}}return X}var S4=10,rq=($=0)=>(q)=>`\x1B[${q+$}m`,sq=($=0)=>(q)=>`\x1B[${38+$};5;${q}m`,eq=($=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 gU=Object.keys(C.color),cU=Object.keys(C.bgColor);[...gU,...cU];function mU(){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=rq(),C.color.ansi256=sq(),C.color.ansi16m=eq(),C.bgColor.ansi=rq(S4),C.bgColor.ansi256=sq(S4),C.bgColor.ansi16m=eq(S4),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 uU=mU(),D$=new Set(["\x1B","›"]),pU=39,c4="\x07",UJ="[",lU="]",zJ="m",m4=`${lU}8;;`,$J=($)=>`${D$.values().next().value}${UJ}${$}${zJ}`,qJ=($)=>`${D$.values().next().value}${m4}${$}${c4}`,dU=($)=>$.split(" ").map((q)=>G0(q)),b4=($,q,J)=>{let X=[...q],Z=!1,H=!1,Q=G0(YJ($[$.length-1]));for(let[Y,G]of X.entries()){let K=G0(G);if(Q+K<=J?$[$.length-1]+=G:($.push(G),Q=0),D$.has(G)&&(Z=!0,H=X.slice(Y+1).join("").startsWith(m4)),Z){H?G===c4&&(Z=!1,H=!1):G===zJ&&(Z=!1);continue}Q+=K,Q===J&&Y<X.length-1&&($.push(""),Q=0)}!Q&&$[$.length-1].length>0&&$.length>1&&($[$.length-2]+=$.pop())},iU=($)=>{let q=$.split(" "),J=q.length;for(;J>0&&!(G0(q[J-1])>0);)J--;return J===q.length?$:q.slice(0,J).join(" ")+q.slice(J).join("")},nU=($,q,J={})=>{if(J.trim!==!1&&$.trim()==="")return"";let X="",Z,H,Q=dU($),Y=[""];for(let[K,U]of $.split(" ").entries()){J.trim!==!1&&(Y[Y.length-1]=Y[Y.length-1].trimStart());let z=G0(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(""),b4(Y,U,q);continue}if(z+Q[K]>q&&z>0&&Q[K]>0){if(J.wordWrap===!1&&z<q){b4(Y,U,q);continue}Y.push("")}if(z+Q[K]>q&&J.wordWrap===!1){b4(Y,U,q);continue}Y[Y.length-1]+=U}J.trim!==!1&&(Y=Y.map((K)=>iU(K)));let G=[...Y.join(`
72
- `)];for(let[K,U]of G.entries()){if(X+=U,D$.has(U)){let{groups:B}=new RegExp(`(?:\\${UJ}(?<code>\\d+)m|\\${m4}(?<uri>.*)${c4})`).exec(G.slice(K).join(""))||{groups:{}};if(B.code!==void 0){let L=Number.parseFloat(B.code);Z=L===pU?void 0:L}else B.uri!==void 0&&(H=B.uri.length===0?void 0:B.uri)}let z=uU.codes.get(Number(Z));G[K+1]===`
71
+ `),{ok:!0,data:void 0}}catch(Z){return{ok:!1,error:`Failed to modify ${q}: ${Z}`}}}function dq($){if(pq()==="fish")return`source ${$}/export.fish`;return`. ${$}/export.sh`}import{mkdir as IU,access as wU}from"fs/promises";import{join as AU}from"path";async function iq($={},q){let J=q||j(),X=$.path||_0,Z=$.target||"all",H=$.addToShell??!0,Q=AU(X,"esp-idf");try{await wU(Q);let B=await w$(Q);return _.emit(J,{type:"log",level:"info",message:`ESP-IDF already installed at ${Q}`}),{ok:!0,data:{idfPath:Q,version:B||"unknown",addedToShell:!1}}}catch{}_.emit(J,{type:"progress",message:"Creating ESP directory..."});try{await IU(X,{recursive:!0})}catch(B){return{ok:!1,error:`Failed to create directory: ${B}`}}_.emit(J,{type:"progress",message:"Cloning ESP-IDF repository...",percent:10});let Y=await v4("git",["clone","--recursive",M3],{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}`};_.emit(J,{type:"progress",message:"Running install script...",percent:50});let K=await v4("./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){_.emit(J,{type:"progress",message:"Configuring shell...",percent:90});let B=dq(Q),L=await lq(B);if(L.ok)U=!0;else _.emit(J,{type:"log",level:"warn",message:L.error})}let z=await w$(Q);return _.emit(J,{type:"complete",result:{idfPath:Q,version:z,addedToShell:U}}),{ok:!0,data:{idfPath:Q,version:z||"unknown",addedToShell:U}}}import{stripVTControlCharacters as n4}from"node:util";var f=t(S4(),1),HJ=t(C1(),1);import{stdin as ZJ,stdout as QJ}from"node:process";import*as W1 from"node:readline";import oq from"node:readline";import{Writable as vU}from"node:stream";function hU({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 SU=hU();function YJ($){if(typeof $!="string")throw TypeError(`Expected a \`string\`, got \`${typeof $}\``);return $.replace(SU,"")}function GJ($){return $&&$.__esModule&&Object.prototype.hasOwnProperty.call($,"default")?$.default:$}var KJ={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}})(KJ);var fU=KJ.exports,bU=GJ(fU),gU=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},cU=GJ(gU);function G0($,q={}){if(typeof $!="string"||$.length===0||(q={ambiguousIsNarrow:!0,...q},$=YJ($),$.length===0))return 0;$=$.replace(cU()," ");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(bU.eastAsianWidth(Z)){case"F":case"W":X+=2;break;case"A":X+=J;break;default:X+=1}}return X}var b4=10,rq=($=0)=>(q)=>`\x1B[${q+$}m`,sq=($=0)=>(q)=>`\x1B[${38+$};5;${q}m`,eq=($=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 mU=Object.keys(C.color),uU=Object.keys(C.bgColor);[...mU,...uU];function pU(){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=rq(),C.color.ansi256=sq(),C.color.ansi16m=eq(),C.bgColor.ansi=rq(b4),C.bgColor.ansi256=sq(b4),C.bgColor.ansi16m=eq(b4),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 lU=pU(),D$=new Set(["\x1B","›"]),dU=39,m4="\x07",UJ="[",iU="]",zJ="m",u4=`${iU}8;;`,$J=($)=>`${D$.values().next().value}${UJ}${$}${zJ}`,qJ=($)=>`${D$.values().next().value}${u4}${$}${m4}`,nU=($)=>$.split(" ").map((q)=>G0(q)),g4=($,q,J)=>{let X=[...q],Z=!1,H=!1,Q=G0(YJ($[$.length-1]));for(let[Y,G]of X.entries()){let K=G0(G);if(Q+K<=J?$[$.length-1]+=G:($.push(G),Q=0),D$.has(G)&&(Z=!0,H=X.slice(Y+1).join("").startsWith(u4)),Z){H?G===m4&&(Z=!1,H=!1):G===zJ&&(Z=!1);continue}Q+=K,Q===J&&Y<X.length-1&&($.push(""),Q=0)}!Q&&$[$.length-1].length>0&&$.length>1&&($[$.length-2]+=$.pop())},aU=($)=>{let q=$.split(" "),J=q.length;for(;J>0&&!(G0(q[J-1])>0);)J--;return J===q.length?$:q.slice(0,J).join(" ")+q.slice(J).join("")},tU=($,q,J={})=>{if(J.trim!==!1&&$.trim()==="")return"";let X="",Z,H,Q=nU($),Y=[""];for(let[K,U]of $.split(" ").entries()){J.trim!==!1&&(Y[Y.length-1]=Y[Y.length-1].trimStart());let z=G0(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(""),g4(Y,U,q);continue}if(z+Q[K]>q&&z>0&&Q[K]>0){if(J.wordWrap===!1&&z<q){g4(Y,U,q);continue}Y.push("")}if(z+Q[K]>q&&J.wordWrap===!1){g4(Y,U,q);continue}Y[Y.length-1]+=U}J.trim!==!1&&(Y=Y.map((K)=>aU(K)));let G=[...Y.join(`
72
+ `)];for(let[K,U]of G.entries()){if(X+=U,D$.has(U)){let{groups:B}=new RegExp(`(?:\\${UJ}(?<code>\\d+)m|\\${u4}(?<uri>.*)${m4})`).exec(G.slice(K).join(""))||{groups:{}};if(B.code!==void 0){let L=Number.parseFloat(B.code);Z=L===dU?void 0:L}else B.uri!==void 0&&(H=B.uri.length===0?void 0:B.uri)}let z=lU.codes.get(Number(Z));G[K+1]===`
73
73
  `?(H&&(X+=qJ("")),Z&&z&&(X+=$J(z))):U===`
74
74
  `&&(Z&&z&&(X+=$J(Z)),H&&(X+=qJ(H)))}return X};function JJ($,q,J){return String($).normalize().replace(/\r\n/g,`
75
75
  `).split(`
76
- `).map((X)=>nU(X,q,J)).join(`
77
- `)}var aU=["up","down","left","right","space","enter","cancel"],N$={actions:new Set(aU),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]])};function u4($,q){if(typeof $=="string")return N$.aliases.get($)===q;for(let J of $)if(J!==void 0&&u4(J,q))return!0;return!1}function tU($,q){if($===q)return;let J=$.split(`
76
+ `).map((X)=>tU(X,q,J)).join(`
77
+ `)}var oU=["up","down","left","right","space","enter","cancel"],N$={actions:new Set(oU),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]])};function p4($,q){if(typeof $=="string")return N$.aliases.get($)===q;for(let J of $)if(J!==void 0&&p4(J,q))return!0;return!1}function rU($,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 oU=globalThis.process.platform.startsWith("win"),g4=Symbol("clack:cancel");function u1($){return $===g4}function O$($,q){let J=$;J.isTTY&&J.setRawMode(q)}function BJ({input:$=ZJ,output:q=QJ,overwrite:J=!0,hideCursor:X=!0}={}){let Z=V1.createInterface({input:$,output:q,prompt:"",tabSize:1});V1.emitKeypressEvents($,Z),$.isTTY&&$.setRawMode(!0);let H=(Q,{name:Y,sequence:G})=>{let K=String(Q);if(u4([K,Y,G],"cancel")){X&&q.write(S.cursor.show),process.exit(0);return}if(!J)return;V1.moveCursor(q,Y==="return"?0:-1,Y==="return"?-1:0,()=>{V1.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&&!oU&&$.setRawMode(!1),Z.terminal=!1,Z.close()}}var rU=Object.defineProperty,sU=($,q,J)=>(q in $)?rU($,q,{enumerable:!0,configurable:!0,writable:!0,value:J}):$[q]=J,u=($,q,J)=>(sU($,typeof q!="symbol"?q+"":q,J),J);class v${constructor($,q=!0){u(this,"input"),u(this,"output"),u(this,"_abortSignal"),u(this,"rl"),u(this,"opts"),u(this,"_render"),u(this,"_track",!1),u(this,"_prevFrame",""),u(this,"_subscribers",new Map),u(this,"_cursor",0),u(this,"state","initial"),u(this,"error",""),u(this,"value");let{input:J=ZJ,output:X=QJ,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(),$(g4);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let J=new NU;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=oq.createInterface({input:this.input,output:J,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),oq.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),O$(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),O$(this.input,!1),$(this.value)}),this.once("cancel",()=>{this.output.write(S.cursor.show),this.output.off("resize",this.render),O$(this.input,!1),$(g4)})})}onKeypress($,q){if(this.state==="error"&&(this.state="active"),q?.name&&(!this._track&&N$.aliases.has(q.name)&&this.emit("cursor",N$.aliases.get(q.name)),N$.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")}u4([$,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(`
79
+ `),Z=[];for(let H=0;H<Math.max(J.length,X.length);H++)J[H]!==X[H]&&Z.push(H);return Z}var sU=globalThis.process.platform.startsWith("win"),c4=Symbol("clack:cancel");function u1($){return $===c4}function O$($,q){let J=$;J.isTTY&&J.setRawMode(q)}function BJ({input:$=ZJ,output:q=QJ,overwrite:J=!0,hideCursor:X=!0}={}){let Z=W1.createInterface({input:$,output:q,prompt:"",tabSize:1});W1.emitKeypressEvents($,Z),$.isTTY&&$.setRawMode(!0);let H=(Q,{name:Y,sequence:G})=>{let K=String(Q);if(p4([K,Y,G],"cancel")){X&&q.write(f.cursor.show),process.exit(0);return}if(!J)return;W1.moveCursor(q,Y==="return"?0:-1,Y==="return"?-1:0,()=>{W1.clearLine(q,1,()=>{$.once("keypress",H)})})};return X&&q.write(f.cursor.hide),$.once("keypress",H),()=>{$.off("keypress",H),X&&q.write(f.cursor.show),$.isTTY&&!sU&&$.setRawMode(!1),Z.terminal=!1,Z.close()}}var eU=Object.defineProperty,$z=($,q,J)=>(q in $)?eU($,q,{enumerable:!0,configurable:!0,writable:!0,value:J}):$[q]=J,u=($,q,J)=>($z($,typeof q!="symbol"?q+"":q,J),J);class v${constructor($,q=!0){u(this,"input"),u(this,"output"),u(this,"_abortSignal"),u(this,"rl"),u(this,"opts"),u(this,"_render"),u(this,"_track",!1),u(this,"_prevFrame",""),u(this,"_subscribers",new Map),u(this,"_cursor",0),u(this,"state","initial"),u(this,"error",""),u(this,"value");let{input:J=ZJ,output:X=QJ,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(),$(c4);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let J=new vU;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=oq.createInterface({input:this.input,output:J,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),oq.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),O$(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(f.cursor.show),this.output.off("resize",this.render),O$(this.input,!1),$(this.value)}),this.once("cancel",()=>{this.output.write(f.cursor.show),this.output.off("resize",this.render),O$(this.input,!1),$(c4)})})}onKeypress($,q){if(this.state==="error"&&(this.state="active"),q?.name&&(!this._track&&N$.aliases.has(q.name)&&this.emit("cursor",N$.aliases.get(q.name)),N$.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")}p4([$,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
80
  `),O$(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let $=JJ(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
81
- `).length-1;this.output.write(S.cursor.move(-999,$*-1))}render(){let $=JJ(this._render(this)??"",process.stdout.columns,{hard:!0});if($!==this._prevFrame){if(this.state==="initial")this.output.write(S.cursor.hide);else{let q=tU(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
- `);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(`
81
+ `).length-1;this.output.write(f.cursor.move(-999,$*-1))}render(){let $=JJ(this._render(this)??"",process.stdout.columns,{hard:!0});if($!==this._prevFrame){if(this.state==="initial")this.output.write(f.cursor.hide);else{let q=rU(this._prevFrame,$);if(this.restoreCursor(),q&&q?.length===1){let J=q[0];this.output.write(f.cursor.move(0,J)),this.output.write(f.erase.lines(1));let X=$.split(`
82
+ `);this.output.write(X[J]),this._prevFrame=$,this.output.write(f.cursor.move(0,X.length-J-1));return}if(q&&q?.length>1){let J=q[0];this.output.write(f.cursor.move(0,J)),this.output.write(f.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 p4 extends v${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 eU;eU=new WeakMap;var $z=Object.defineProperty,qz=($,q,J)=>(q in $)?$z($,q,{enumerable:!0,configurable:!0,writable:!0,value:J}):$[q]=J,XJ=($,q,J)=>(qz($,typeof q!="symbol"?q+"":q,J),J);class l4 extends v${constructor($){super($,!1),XJ(this,"options"),XJ(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 d4 extends v${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`${$}${HJ.default.inverse(q)}${J.join("")}`}get cursor(){return this._cursor}constructor($){super($),this.on("finalize",()=>{this.value||(this.value=$.defaultValue)})}}var V=t(C1(),1),f$=t(f4(),1);import a from"node:process";function Jz(){return a.platform!=="win32"?a.env.TERM!=="linux":!!a.env.CI||!!a.env.WT_SESSION||!!a.env.TERMINUS_SUBLIME||a.env.ConEmuTask==="{cmd::Cmder}"||a.env.TERM_PROGRAM==="Terminus-Sublime"||a.env.TERM_PROGRAM==="vscode"||a.env.TERM==="xterm-256color"||a.env.TERM==="alacritty"||a.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var n4=Jz(),y=($,q)=>n4?$:q,Xz=y("◆","*"),_J=y("■","x"),VJ=y("▲","x"),o4=y("◇","o"),Zz=y("┌","T"),I=y("│","|"),p1=y("└","—"),a4=y("●",">"),t4=y("○"," "),rj=y("◻","[•]"),sj=y("◼","[+]"),ej=y("◻","[ ]"),$M=y("▪","•"),LJ=y("─","-"),Qz=y("╮","+"),Hz=y("├","+"),Yz=y("╯","+"),qM=y("●","•"),JM=y("◆","*"),XM=y("▲","!"),ZM=y("■","x"),r4=($)=>{switch($){case"initial":case"active":return V.default.cyan(Xz);case"cancel":return V.default.red(_J);case"error":return V.default.yellow(VJ);case"submit":return V.default.green(o4)}},Gz=($)=>{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,z,B)=>{let L=z===0&&G,W=z===B.length-1&&K;return L||W?V.default.dim("..."):X(U,z+Y===q)})},RJ=($)=>new d4({validate:$.validate,placeholder:$.placeholder,defaultValue:$.defaultValue,initialValue:$.initialValue,render(){let q=`${V.default.gray(I)}
85
- ${r4(this.state)} ${$.message}
86
- `,J=$.placeholder?V.default.inverse($.placeholder[0])+V.default.dim($.placeholder.slice(1)):V.default.inverse(V.default.hidden("_")),X=this.value?this.valueWithCursor:J;switch(this.state){case"error":return`${q.trim()}
87
- ${V.default.yellow(I)} ${X}
88
- ${V.default.yellow(p1)} ${V.default.yellow(this.error)}
89
- `;case"submit":return`${q}${V.default.gray(I)} ${V.default.dim(this.value||$.placeholder)}`;case"cancel":return`${q}${V.default.gray(I)} ${V.default.strikethrough(V.default.dim(this.value??""))}${this.value?.trim()?`
90
- ${V.default.gray(I)}`:""}`;default:return`${q}${V.default.cyan(I)} ${X}
91
- ${V.default.cyan(p1)}
92
- `}}}).prompt();var WJ=($)=>{let q=$.active??"Yes",J=$.inactive??"No";return new p4({active:q,inactive:J,initialValue:$.initialValue??!0,render(){let X=`${V.default.gray(I)}
93
- ${r4(this.state)} ${$.message}
94
- `,Z=this.value?q:J;switch(this.state){case"submit":return`${X}${V.default.gray(I)} ${V.default.dim(Z)}`;case"cancel":return`${X}${V.default.gray(I)} ${V.default.strikethrough(V.default.dim(Z))}
95
- ${V.default.gray(I)}`;default:return`${X}${V.default.cyan(I)} ${this.value?`${V.default.green(a4)} ${q}`:`${V.default.dim(t4)} ${V.default.dim(q)}`} ${V.default.dim("/")} ${this.value?`${V.default.dim(t4)} ${V.default.dim(J)}`:`${V.default.green(a4)} ${J}`}
96
- ${V.default.cyan(p1)}
97
- `}}}).prompt()},TJ=($)=>{let q=(J,X)=>{let Z=J.label??String(J.value);switch(X){case"selected":return`${V.default.dim(Z)}`;case"active":return`${V.default.green(a4)} ${Z} ${J.hint?V.default.dim(`(${J.hint})`):""}`;case"cancelled":return`${V.default.strikethrough(V.default.dim(Z))}`;default:return`${V.default.dim(t4)} ${V.default.dim(Z)}`}};return new l4({options:$.options,initialValue:$.initialValue,render(){let J=`${V.default.gray(I)}
98
- ${r4(this.state)} ${$.message}
99
- `;switch(this.state){case"submit":return`${J}${V.default.gray(I)} ${q(this.options[this.cursor],"selected")}`;case"cancel":return`${J}${V.default.gray(I)} ${q(this.options[this.cursor],"cancelled")}
100
- ${V.default.gray(I)}`;default:return`${J}${V.default.cyan(I)} ${Gz({cursor:this.cursor,options:this.options,maxItems:$.maxItems,style:(X,Z)=>q(X,Z?"active":"inactive")}).join(`
101
- ${V.default.cyan(I)} `)}
102
- ${V.default.cyan(p1)}
84
+ `)),this._prevFrame=$;return}this.output.write(f.erase.down())}this.output.write($),this.state==="initial"&&(this.state="active"),this._prevFrame=$}}}class l4 extends v${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(f.cursor.move(0,-1)),this.value=q,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}var qz;qz=new WeakMap;var Jz=Object.defineProperty,Xz=($,q,J)=>(q in $)?Jz($,q,{enumerable:!0,configurable:!0,writable:!0,value:J}):$[q]=J,XJ=($,q,J)=>(Xz($,typeof q!="symbol"?q+"":q,J),J);class d4 extends v${constructor($){super($,!1),XJ(this,"options"),XJ(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 i4 extends v${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`${$}${HJ.default.inverse(q)}${J.join("")}`}get cursor(){return this._cursor}constructor($){super($),this.on("finalize",()=>{this.value||(this.value=$.defaultValue)})}}var W=t(C1(),1),h$=t(S4(),1);import a from"node:process";function Zz(){return a.platform!=="win32"?a.env.TERM!=="linux":!!a.env.CI||!!a.env.WT_SESSION||!!a.env.TERMINUS_SUBLIME||a.env.ConEmuTask==="{cmd::Cmder}"||a.env.TERM_PROGRAM==="Terminus-Sublime"||a.env.TERM_PROGRAM==="vscode"||a.env.TERM==="xterm-256color"||a.env.TERM==="alacritty"||a.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var a4=Zz(),y=($,q)=>a4?$:q,Qz=y("◆","*"),VJ=y("■","x"),WJ=y("▲","x"),r4=y("◇","o"),Hz=y("┌","T"),I=y("│","|"),p1=y("└","—"),t4=y("●",">"),o4=y("○"," "),sj=y("◻","[•]"),ej=y("◼","[+]"),$M=y("◻","[ ]"),qM=y("▪","•"),LJ=y("─","-"),Yz=y("╮","+"),Gz=y("├","+"),Kz=y("╯","+"),JM=y("●","•"),XM=y("◆","*"),ZM=y("▲","!"),QM=y("■","x"),s4=($)=>{switch($){case"initial":case"active":return W.default.cyan(Qz);case"cancel":return W.default.red(VJ);case"error":return W.default.yellow(WJ);case"submit":return W.default.green(r4)}},Uz=($)=>{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,z,B)=>{let L=z===0&&G,R=z===B.length-1&&K;return L||R?W.default.dim("..."):X(U,z+Y===q)})},_J=($)=>new i4({validate:$.validate,placeholder:$.placeholder,defaultValue:$.defaultValue,initialValue:$.initialValue,render(){let q=`${W.default.gray(I)}
85
+ ${s4(this.state)} ${$.message}
86
+ `,J=$.placeholder?W.default.inverse($.placeholder[0])+W.default.dim($.placeholder.slice(1)):W.default.inverse(W.default.hidden("_")),X=this.value?this.valueWithCursor:J;switch(this.state){case"error":return`${q.trim()}
87
+ ${W.default.yellow(I)} ${X}
88
+ ${W.default.yellow(p1)} ${W.default.yellow(this.error)}
89
+ `;case"submit":return`${q}${W.default.gray(I)} ${W.default.dim(this.value||$.placeholder)}`;case"cancel":return`${q}${W.default.gray(I)} ${W.default.strikethrough(W.default.dim(this.value??""))}${this.value?.trim()?`
90
+ ${W.default.gray(I)}`:""}`;default:return`${q}${W.default.cyan(I)} ${X}
91
+ ${W.default.cyan(p1)}
92
+ `}}}).prompt();var RJ=($)=>{let q=$.active??"Yes",J=$.inactive??"No";return new l4({active:q,inactive:J,initialValue:$.initialValue??!0,render(){let X=`${W.default.gray(I)}
93
+ ${s4(this.state)} ${$.message}
94
+ `,Z=this.value?q:J;switch(this.state){case"submit":return`${X}${W.default.gray(I)} ${W.default.dim(Z)}`;case"cancel":return`${X}${W.default.gray(I)} ${W.default.strikethrough(W.default.dim(Z))}
95
+ ${W.default.gray(I)}`;default:return`${X}${W.default.cyan(I)} ${this.value?`${W.default.green(t4)} ${q}`:`${W.default.dim(o4)} ${W.default.dim(q)}`} ${W.default.dim("/")} ${this.value?`${W.default.dim(o4)} ${W.default.dim(J)}`:`${W.default.green(t4)} ${J}`}
96
+ ${W.default.cyan(p1)}
97
+ `}}}).prompt()},TJ=($)=>{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(t4)} ${Z} ${J.hint?W.default.dim(`(${J.hint})`):""}`;case"cancelled":return`${W.default.strikethrough(W.default.dim(Z))}`;default:return`${W.default.dim(o4)} ${W.default.dim(Z)}`}};return new d4({options:$.options,initialValue:$.initialValue,render(){let J=`${W.default.gray(I)}
98
+ ${s4(this.state)} ${$.message}
99
+ `;switch(this.state){case"submit":return`${J}${W.default.gray(I)} ${q(this.options[this.cursor],"selected")}`;case"cancel":return`${J}${W.default.gray(I)} ${q(this.options[this.cursor],"cancelled")}
100
+ ${W.default.gray(I)}`;default:return`${J}${W.default.cyan(I)} ${Uz({cursor:this.cursor,options:this.options,maxItems:$.maxItems,style:(X,Z)=>q(X,Z?"active":"inactive")}).join(`
101
+ ${W.default.cyan(I)} `)}
102
+ ${W.default.cyan(p1)}
103
103
  `}}}).prompt()};var PJ=($="",q="")=>{let J=`
104
104
  ${$}
105
105
  `.split(`
106
- `),X=i4(q).length,Z=Math.max(J.reduce((Q,Y)=>{let G=i4(Y);return G.length>Q?G.length:Q},0),X)+2,H=J.map((Q)=>`${V.default.gray(I)} ${V.default.dim(Q)}${" ".repeat(Z-i4(Q).length)}${V.default.gray(I)}`).join(`
107
- `);process.stdout.write(`${V.default.gray(I)}
108
- ${V.default.green(o4)} ${V.default.reset(q)} ${V.default.gray(LJ.repeat(Math.max(Z-X-1,1))+Qz)}
106
+ `),X=n4(q).length,Z=Math.max(J.reduce((Q,Y)=>{let G=n4(Y);return G.length>Q?G.length:Q},0),X)+2,H=J.map((Q)=>`${W.default.gray(I)} ${W.default.dim(Q)}${" ".repeat(Z-n4(Q).length)}${W.default.gray(I)}`).join(`
107
+ `);process.stdout.write(`${W.default.gray(I)}
108
+ ${W.default.green(r4)} ${W.default.reset(q)} ${W.default.gray(LJ.repeat(Math.max(Z-X-1,1))+Yz)}
109
109
  ${H}
110
- ${V.default.gray(Hz+LJ.repeat(Z+2)+Yz)}
111
- `)},l1=($="")=>{process.stdout.write(`${V.default.gray(p1)} ${V.default.red($)}
110
+ ${W.default.gray(Gz+LJ.repeat(Z+2)+Kz)}
111
+ `)},l1=($="")=>{process.stdout.write(`${W.default.gray(p1)} ${W.default.red($)}
112
112
 
113
- `)},kJ=($="")=>{process.stdout.write(`${V.default.gray(Zz)} ${$}
114
- `)},FJ=($="")=>{process.stdout.write(`${V.default.gray(I)}
115
- ${V.default.gray(p1)} ${$}
113
+ `)},kJ=($="")=>{process.stdout.write(`${W.default.gray(Hz)} ${$}
114
+ `)},FJ=($="")=>{process.stdout.write(`${W.default.gray(I)}
115
+ ${W.default.gray(p1)} ${$}
116
116
 
117
- `)};var QM=`${V.default.gray(I)} `;var xJ=({indicator:$="dots"}={})=>{let q=n4?["◒","◐","◓","◑"]:["•","o","O","0"],J=n4?80:120,X=process.env.CI==="true",Z,H,Q=!1,Y="",G,K=performance.now(),U=(x)=>{let w=x>1?"Something went wrong":"Canceled";Q&&v(w,x)},z=()=>U(2),B=()=>U(1),L=()=>{process.on("uncaughtExceptionMonitor",z),process.on("unhandledRejection",z),process.on("SIGINT",B),process.on("SIGTERM",B),process.on("exit",U)},W=()=>{process.removeListener("uncaughtExceptionMonitor",z),process.removeListener("unhandledRejection",z),process.removeListener("SIGINT",B),process.removeListener("SIGTERM",B),process.removeListener("exit",U)},P=()=>{if(G===void 0)return;X&&process.stdout.write(`
117
+ `)};var HM=`${W.default.gray(I)} `;var xJ=({indicator:$="dots"}={})=>{let q=a4?["◒","◐","◓","◑"]:["•","o","O","0"],J=a4?80:120,X=process.env.CI==="true",Z,H,Q=!1,Y="",G,K=performance.now(),U=(x)=>{let w=x>1?"Something went wrong":"Canceled";Q&&v(w,x)},z=()=>U(2),B=()=>U(1),L=()=>{process.on("uncaughtExceptionMonitor",z),process.on("unhandledRejection",z),process.on("SIGINT",B),process.on("SIGTERM",B),process.on("exit",U)},R=()=>{process.removeListener("uncaughtExceptionMonitor",z),process.removeListener("unhandledRejection",z),process.removeListener("SIGINT",B),process.removeListener("SIGTERM",B),process.removeListener("exit",U)},P=()=>{if(G===void 0)return;X&&process.stdout.write(`
118
118
  `);let x=G.split(`
119
- `);process.stdout.write(f$.cursor.move(-999,x.length-1)),process.stdout.write(f$.erase.down(x.length))},M=(x)=>x.replace(/\.+$/,""),F=(x)=>{let w=(performance.now()-x)/1000,N=Math.floor(w/60),g=Math.floor(w%60);return N>0?`[${N}m ${g}s]`:`[${g}s]`},O=(x="")=>{Q=!0,Z=BJ(),Y=M(x),K=performance.now(),process.stdout.write(`${V.default.gray(I)}
120
- `);let w=0,N=0;L(),H=setInterval(()=>{if(X&&Y===G)return;P(),G=Y;let g=V.default.magenta(q[w]);if(X)process.stdout.write(`${g} ${Y}...`);else if($==="timer")process.stdout.write(`${g} ${Y} ${F(K)}`);else{let K1=".".repeat(Math.floor(N)).slice(0,3);process.stdout.write(`${g} ${Y}${K1}`)}w=w+1<q.length?w+1:0,N=N<q.length?N+0.125:0},J)},v=(x="",w=0)=>{Q=!1,clearInterval(H),P();let N=w===0?V.default.green(o4):w===1?V.default.red(_J):V.default.red(VJ);Y=M(x??Y),$==="timer"?process.stdout.write(`${N} ${Y} ${F(K)}
119
+ `);process.stdout.write(h$.cursor.move(-999,x.length-1)),process.stdout.write(h$.erase.down(x.length))},M=(x)=>x.replace(/\.+$/,""),F=(x)=>{let w=(performance.now()-x)/1000,N=Math.floor(w/60),g=Math.floor(w%60);return N>0?`[${N}m ${g}s]`:`[${g}s]`},O=(x="")=>{Q=!0,Z=BJ(),Y=M(x),K=performance.now(),process.stdout.write(`${W.default.gray(I)}
120
+ `);let w=0,N=0;L(),H=setInterval(()=>{if(X&&Y===G)return;P(),G=Y;let g=W.default.magenta(q[w]);if(X)process.stdout.write(`${g} ${Y}...`);else if($==="timer")process.stdout.write(`${g} ${Y} ${F(K)}`);else{let K1=".".repeat(Math.floor(N)).slice(0,3);process.stdout.write(`${g} ${Y}${K1}`)}w=w+1<q.length?w+1:0,N=N<q.length?N+0.125:0},J)},v=(x="",w=0)=>{Q=!1,clearInterval(H),P();let N=w===0?W.default.green(r4):w===1?W.default.red(VJ):W.default.red(WJ);Y=M(x??Y),$==="timer"?process.stdout.write(`${N} ${Y} ${F(K)}
121
121
  `):process.stdout.write(`${N} ${Y}
122
- `),W(),Z()};return{start:O,stop:v,message:(x="")=>{Y=M(x??Y)}}};var jJ=t(C1(),1);async function K0($,q=!0){let J=await WJ({message:$,initialValue:q});if(u1(J))l1("Operation cancelled"),process.exit(0);return J}async function MJ($,q,J){let X=await RJ({message:$,placeholder:q,initialValue:J});if(u1(X))l1("Operation cancelled"),process.exit(0);return X}async function s4($,q){let J=q.map((Z)=>({value:Z.value,label:Z.label,...Z.hint&&{hint:Z.hint}})),X=await TJ({message:$,options:J});if(u1(X))l1("Operation cancelled"),process.exit(0);return X}async function CJ(){return s4("Select target chip",j3.map(($)=>({value:$.id,label:$.name,hint:$.description+($.stable?"":" (preview)")})))}async function IJ(){return s4("Select language",[{value:"c",label:"C",hint:"Standard C project"},{value:"cpp",label:"C++",hint:'C++ with extern "C" linkage'}])}async function d1($){if($.length===0)l1("No devices found"),process.exit(1);return s4("Select device",$.map((q)=>({value:q.port,label:q.port,hint:q.chip||q.manufacturer})))}function h$(){return xJ()}function S$($){kJ(jJ.default.inverse(` ${$} `))}function U0($){FJ($)}function b$($){l1($)}function g$($,q){PJ($,q)}var I1=t(C1(),1);function Uz($){console.log(I1.default.blue("ℹ"),$)}function zz($){console.log(I1.default.green("✔"),$)}function Bz($){console.log(I1.default.yellow("⚠"),$)}function Lz($){console.log(I1.default.red("✖"),$)}function _z($){console.log(I1.default.cyan("→"),$)}function Vz($){console.log(I1.default.dim($))}function Rz($){process.stdout.write($)}function Wz(){console.log()}var _={info:Uz,success:zz,warn:Bz,error:Lz,step:_z,dim:Vz,output:Rz,newline:Wz};async function wJ($){S$("ESP-IDF Installation");let q=await mq();if(q.installed){if(_.info(`ESP-IDF already installed at ${q.path}`),q.version)_.info(`Version: ${q.version}`);if(!await K0("Reinstall ESP-IDF?",!1)){U0("Installation skipped");return}}let J=$.path||R0,X=$.target||"all",Z=A$();if(!$.yes){if(g$(`Install path: ${J}
122
+ `),R(),Z()};return{start:O,stop:v,message:(x="")=>{Y=M(x??Y)}}};var jJ=t(C1(),1);async function K0($,q=!0){let J=await RJ({message:$,initialValue:q});if(u1(J))l1("Operation cancelled"),process.exit(0);return J}async function MJ($,q,J){let X=await _J({message:$,placeholder:q,initialValue:J});if(u1(X))l1("Operation cancelled"),process.exit(0);return X}async function e4($,q){let J=q.map((Z)=>({value:Z.value,label:Z.label,...Z.hint&&{hint:Z.hint}})),X=await TJ({message:$,options:J});if(u1(X))l1("Operation cancelled"),process.exit(0);return X}async function CJ(){return e4("Select target chip",j3.map(($)=>({value:$.id,label:$.name,hint:$.description+($.stable?"":" (preview)")})))}async function IJ(){return e4("Select language",[{value:"c",label:"C",hint:"Standard C project"},{value:"cpp",label:"C++",hint:'C++ with extern "C" linkage'}])}async function d1($){if($.length===0)l1("No devices found"),process.exit(1);return e4("Select device",$.map((q)=>({value:q.port,label:q.port,hint:q.chip||q.manufacturer})))}function S$(){return xJ()}function f$($){kJ(jJ.default.inverse(` ${$} `))}function U0($){FJ($)}function b$($){l1($)}function g$($,q){PJ($,q)}var I1=t(C1(),1);function Bz($){console.log(I1.default.blue("ℹ"),$)}function Lz($){console.log(I1.default.green("✔"),$)}function Vz($){console.log(I1.default.yellow("⚠"),$)}function Wz($){console.log(I1.default.red("✖"),$)}function _z($){console.log(I1.default.cyan("→"),$)}function Rz($){console.log(I1.default.dim($))}function Tz($){process.stdout.write($)}function Pz(){console.log()}var V={info:Bz,success:Lz,warn:Vz,error:Wz,step:_z,dim:Rz,output:Tz,newline:Pz};async function wJ($){f$("ESP-IDF Installation");let q=await mq();if(q.installed){if(V.info(`ESP-IDF already installed at ${q.path}`),q.version)V.info(`Version: ${q.version}`);if(!await K0("Reinstall ESP-IDF?",!1)){U0("Installation skipped");return}}let J=$.path||_0,X=$.target||"all",Z=A$();if(!$.yes){if(g$(`Install path: ${J}
123
123
  Target: ${X}
124
124
  Shell: ${Z.type}
125
- Config: ${Z.configPath}`,"Installation Plan"),!await K0("Proceed with installation?")){b$("Installation cancelled");return}}let H=j(),Q=h$();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(),_.output(G.data.text),Q.start()}),Q.start("Installing ESP-IDF...");let Y=await iq({path:J,target:X,addToShell:!0},H);if(Q.stop(),!Y.ok)_.error(Y.error),process.exit(1);if(_.success(`ESP-IDF installed at ${Y.data.idfPath}`),Y.data.addedToShell)_.info(`Added to ${Z.configPath}`),_.dim("Restart your shell or run: source "+Z.configPath);U0("Installation complete")}import{mkdir as Tz,writeFile as Pz}from"fs/promises";import{join as e4}from"path";function AJ($){return`cmake_minimum_required(VERSION 3.16)
125
+ Config: ${Z.configPath}`,"Installation Plan"),!await K0("Proceed with installation?")){b$("Installation cancelled");return}}let H=j(),Q=S$();_.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 iq({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);U0("Installation complete")}import{mkdir as hJ,writeFile as kz}from"fs/promises";import{join as c$}from"path";function AJ($){return`cmake_minimum_required(VERSION 3.16)
126
126
  include($ENV{IDF_PATH}/tools/cmake/project.cmake)
127
127
  project(${$})
128
128
  `}function EJ($){return`idf_component_register(SRCS "${$}"
@@ -152,7 +152,6 @@ extern "C" void app_main(void)
152
152
  `}function NJ(){return`build/
153
153
  sdkconfig
154
154
  sdkconfig.old
155
- .vscode/
156
155
  *.pyc
157
156
  __pycache__/
158
157
  .DS_Store
@@ -177,8 +176,34 @@ idf.py -p PORT flash
177
176
  \`\`\`bash
178
177
  idf.py -p PORT monitor
179
178
  \`\`\`
180
- `}function kz($){let{name:q,language:J,target:X}=$,Z=J==="cpp"?"main.cpp":"main.c",H=J==="cpp"?OJ(q):yJ(q);return[{path:"CMakeLists.txt",content:AJ(q)},{path:"main/CMakeLists.txt",content:EJ(Z)},{path:`main/${Z}`,content:H},{path:".gitignore",content:NJ()},{path:"README.md",content:DJ(q,X)}]}async function vJ($){let q=e4($.directory,$.name),J=kz($);try{await Tz(e4(q,"main"),{recursive:!0});let X=[];for(let Z of J){let H=e4(q,Z.path);await Pz(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 fJ($,q){let J=q||j();R.emit(J,{type:"progress",message:`Creating project ${$.name}...`});let X=await vJ($);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 J1("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 Fz}from"path";async function hJ($,q){S$("Create ESP-IDF Project");let J=$||await MJ("Project name","my-esp-project"),X=q.lang||await IJ(),Z=q.target||await CJ(),H={name:J,directory:Fz(process.cwd()),language:X,target:Z};if(g$(`Name: ${H.name}
179
+ `}function vJ(){return`{
180
+ "version": 4,
181
+ "configurations": [
182
+ {
183
+ "name": "ESP-IDF",
184
+ "compileCommands": "\${workspaceFolder}/build/compile_commands.json",
185
+ "includePath": [
186
+ "\${workspaceFolder}/**",
187
+ "\${env:HOME}/esp/esp-idf/components/**",
188
+ "\${env:IDF_PATH}/components/**"
189
+ ],
190
+ "browse": {
191
+ "path": [
192
+ "\${workspaceFolder}",
193
+ "\${env:HOME}/esp/esp-idf/components",
194
+ "\${env:IDF_PATH}/components"
195
+ ],
196
+ "limitSymbolsToIncludedHeaders": false
197
+ },
198
+ "defines": [],
199
+ "intelliSenseMode": "gcc-x64",
200
+ "cStandard": "c17",
201
+ "cppStandard": "c++17"
202
+ }
203
+ ]
204
+ }
205
+ `}function Fz($){let{name:q,language:J,target:X}=$,Z=J==="cpp"?"main.cpp":"main.c",H=J==="cpp"?OJ(q):yJ(q);return[{path:"CMakeLists.txt",content:AJ(q)},{path:"main/CMakeLists.txt",content:EJ(Z)},{path:`main/${Z}`,content:H},{path:".gitignore",content:NJ()},{path:"README.md",content:DJ(q,X)},{path:".vscode/c_cpp_properties.json",content:vJ()}]}async function SJ($){let q=c$($.directory,$.name),J=Fz($);try{await hJ(c$(q,"main"),{recursive:!0}),await hJ(c$(q,".vscode"),{recursive:!0});let X=[];for(let Z of J){let H=c$(q,Z.path);await kz(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 fJ($,q){let J=q||j();_.emit(J,{type:"progress",message:`Creating project ${$.name}...`});let X=await SJ($);if(!X.ok)return _.emit(J,{type:"error",message:X.error}),X;_.emit(J,{type:"progress",message:"Setting target...",percent:80});let Z=await J1("idf.py",["set-target",$.target],{cwd:X.data.projectPath,operationId:J});if(!Z.ok||Z.data.exitCode!==0)_.emit(J,{type:"log",level:"warn",message:"Failed to set target. You may need to run: idf.py set-target "+$.target});return _.emit(J,{type:"complete",result:X.data}),X}import{resolve as xz}from"path";async function bJ($,q){f$("Create ESP-IDF Project");let J=$||await MJ("Project name","my-esp-project"),X=q.lang||await IJ(),Z=q.target||await CJ(),H={name:J,directory:xz(process.cwd()),language:X,target:Z};if(g$(`Name: ${H.name}
181
206
  Language: ${X.toUpperCase()}
182
207
  Target: ${Z}
183
- Path: ${H.directory}/${H.name}`,"Project Configuration"),!await K0("Create project?")){b$("Cancelled");return}let Y=h$();Y.start("Creating project...");let G=j(),K=await fJ(H,G);if(Y.stop(),!K.ok)_.error(K.error),process.exit(1);_.success(`Created project at ${K.data.projectPath}`),_.newline(),_.dim("Files created:"),K.data.files.forEach((U)=>_.dim(` ${U}`)),_.newline(),_.info(`cd ${J} && espcli build`),U0("Project ready")}import{readdir as xz,access as jz,readFile as Mz}from"fs/promises";import{join as B0}from"path";var c$=null;async function $3(){if(c$)return c$;return c$=await Cz(),c$}async function Cz(){let[$,q]=await Promise.all([Iz(),wz()]),J=await Az(),X=J.ok?await Ez():void 0,[Z,H]=X?await Promise.all([yz(X),Oz(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 Iz(){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 wz(){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 Az(){let $=process.env.HOME||"",q=[process.env.IDF_PATH,B0($,"esp","esp-idf"),B0($,"esp-idf")].filter(Boolean);for(let J of q)try{await jz(J);let X;try{let Z=B0(J,"version.txt");X=(await Mz(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 Ez(){let $=process.env.HOME||"",q=B0($,".espressif","python_env");try{let J=await xz(q);for(let X of J)if(X.startsWith("idf")){let Z=B0(q,X,"bin","python");try{return await h(Z,["--version"],{timeout:2000}),Z}catch{continue}}}catch{}return}async function yz($){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 Oz($){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 SJ(){let $=await $3();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 Nz="303A";async function m$(){let $=await SJ();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(`
184
- `),H=null,Q="",Y="";for(let G of Z)if(G.startsWith("/dev/")){if(H){let K=bJ(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=bJ(H,Q,Y);if(G)X.push(G)}return await fz(q,X)}catch{return[]}}function bJ($,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=Dz(Z),Y=vz(Z,H);return{port:$,connectionType:Q,vendorId:Z,productId:H,manufacturer:q2[Z||""]?.name,chip:Y,description:q!=="n/a"?q:void 0}}function Dz($){if(!$)return"unknown";return $.toUpperCase()===Nz?"native-usb":"uart-bridge"}function vz($,q){if(!$)return;let J=q2[$.toUpperCase()];if(!J)return;if(q){let X=J.chips[q.toUpperCase()];if(X)return X}return J.name}async function fz($,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 hz($,X.port);return{...X,espChip:H}}return X}))}async function hz($,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 R1(){try{return{ok:!0,data:await m$()}}catch($){return{ok:!1,error:`Failed to list devices: ${$}`}}}var b=t(C1(),1);function Sz($){return $.replace(/\x1b\[[0-9;]*m/g,"")}function gJ($){return Sz($).length}function bz($,q){let J=$.map((K,U)=>{let z=Math.max(...q.map((B)=>gJ(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=gJ(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 cJ($){if($.length===0){console.log(b.default.dim("No devices found"));return}let q=["Port","Type","Chip","ESP"],J=$.map((H)=>{let Q=gz(H.connectionType),Y=H.espChip||(H.connectionType==="native-usb"?"?":"-");return[H.port,Q,H.chip||"-",Y]});bz(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 gz($){switch($){case"native-usb":return b.default.magenta("USB");case"uart-bridge":return b.default.cyan("UART");default:return b.default.dim("?")}}async function mJ(){_.info("Scanning for devices...");let $=await R1();if(!$.ok)_.error($.error),process.exit(1);_.newline(),cJ($.data),_.newline()}async function u$($,q){let J=q||j(),{projectDir:X,target:Z,clean:H}=$;if(!await M1(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 J1("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 J1("idf.py",["clean"],{cwd:X,operationId:J});R.emit(J,{type:"progress",message:"Building project..."});let Y=await J1("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 uJ($){let q=await q1(process.cwd());if(!q)_.error("Not in an ESP-IDF project directory"),process.exit(1);let J=j();R.subscribe(J,(Z)=>{if(Z.data.type==="stdout")_.output(Z.data.text);else if(Z.data.type==="stderr")_.output(Z.data.text)}),_.step("Building project...");let X=await u$({projectDir:q,target:$.target,clean:$.clean},J);if(!X.ok)_.newline(),_.error(X.error),process.exit(1);_.newline(),_.success("Build complete")}async function p$($,q){let J=q||j(),{projectDir:X,port:Z,baud:H=C3}=$;if(!await M1(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 J1("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 pJ($){let q=await q1(process.cwd());if(!q)_.error("Not in an ESP-IDF project directory"),process.exit(1);let J=$.port;if(!J){let H=await R1();if(!H.ok)_.error(H.error),process.exit(1);J=await d1(H.data)}let X=j();R.subscribe(X,(H)=>{if(H.data.type==="stdout"||H.data.type==="stderr")_.output(H.data.text)}),_.step(`Flashing to ${J}...`);let Z=await p$({projectDir:q,port:J,baud:$.baud},X);if(!Z.ok)_.newline(),_.error(Z.error),process.exit(1);_.newline(),_.success("Flash complete")}var q3=new Map;function l$($,q){let J=q||j(),{port:X,baud:Z=I3,projectDir:H}=$,Q=["-p",X,"-b",String(Z),"monitor"],Y=uq("idf.py",Q,{cwd:H||process.cwd(),operationId:J});if(!Y)return R.emit(J,{type:"error",message:"ESP-IDF not found"}),{ok:!1,error:"ESP-IDF not found"};return q3.set(J,Y),Y.then(()=>{q3.delete(J),R.emit(J,{type:"complete",result:{stopped:!0}})}),{ok:!0,data:{operationId:J,stop:()=>{Y.kill("SIGTERM"),q3.delete(J)},sendInput:(K)=>{Y.stdin?.write(K)}}}}async function lJ($){let q=await q1(process.cwd()),J=$.port;if(!J){let H=await R1();if(!H.ok)_.error(H.error),process.exit(1);J=await d1(H.data)}let X=j();R.subscribe(X,(H)=>{if(H.data.type==="stdout"||H.data.type==="stderr")_.output(H.data.text)}),_.step(`Connecting to ${J}...`),_.dim("Press Ctrl+C to exit"),_.newline();let Z=l$({port:J,baud:$.baud,projectDir:q||void 0},X);if(!Z.ok)_.error(Z.error),process.exit(1);process.on("SIGINT",()=>{Z.data.stop(),_.newline(),_.info("Monitor stopped"),process.exit(0)}),await new Promise(()=>{})}async function dJ($,q){let J=q||j(),{projectDir:X,full:Z}=$;if(!await M1(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 J1("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 iJ($){let q=await q1(process.cwd());if(!q)_.error("Not in an ESP-IDF project directory"),process.exit(1);let J=j();_.step($.full?"Running fullclean...":"Cleaning build...");let X=await dJ({projectDir:q,full:$.full},J);if(!X.ok)_.error(X.error),process.exit(1);_.success("Clean complete")}async function nJ($){let q=await q1(process.cwd());if(!q)_.error("Not in an ESP-IDF project directory"),process.exit(1);let J=$.port;if(!J){let G=await R1();if(!G.ok)_.error(G.error),process.exit(1);J=await d1(G.data)}let X=(G)=>{if(G.data.type==="stdout"||G.data.type==="stderr")_.output(G.data.text)};if(!$.skipBuild){let G=j();R.subscribe(G,X),_.step("Building...");let K=await u$({projectDir:q},G);if(!K.ok)_.newline(),_.error(K.error),process.exit(1);_.newline(),_.success("Build complete")}let Z=j();R.subscribe(Z,X),_.step(`Flashing to ${J}...`);let H=await p$({projectDir:q,port:J,baud:$.baud},Z);if(!H.ok)_.newline(),_.error(H.error),process.exit(1);_.newline(),_.success("Flash complete");let Q=j();R.subscribe(Q,X),_.step("Starting monitor..."),_.dim("Press Ctrl+C to exit"),_.newline();let Y=l$({port:J,baud:$.baud,projectDir:q},Q);if(!Y.ok)_.error(Y.error),process.exit(1);process.on("SIGINT",()=>{Y.data.stop(),_.newline(),_.info("Monitor stopped"),process.exit(0)}),await new Promise(()=>{})}var f=t(C1(),1);async function aJ(){_.info("Checking system health..."),_.newline();let $=await $3();if(L0($.python),L0($.git),L0($.idf),L0($.pyserial),L0($.esptool),_.newline(),await cz(),_.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."));_.newline()}function L0($){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 cz(){console.log(f.default.bold(" Devices:"));try{let $=await m$();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 tJ(){let $=new k3;return $.name("espcli").description("CLI tool for ESP-IDF development").version(A3),$.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(wJ),$.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(hJ),$.command("devices").alias("ports").description("List connected ESP devices").action(mJ),$.command("build").description("Build the current project").option("-t, --target <target>","Set target before build").option("-c, --clean","Clean before build").action(uJ),$.command("flash").description("Flash firmware to device").option("-p, --port <port>","Serial port").option("-b, --baud <baud>","Flash baud rate",parseInt).action(pJ),$.command("monitor").description("Open serial monitor").option("-p, --port <port>","Serial port").option("-b, --baud <baud>","Monitor baud rate",parseInt).action(lJ),$.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(nJ),$.command("clean").description("Clean build artifacts").option("-f, --full","Full clean (includes sdkconfig)").action(iJ),$.command("doctor").alias("check").description("Check system health and dependencies").action(aJ),$}var mz=tJ();mz.parse();
208
+ Path: ${H.directory}/${H.name}`,"Project Configuration"),!await K0("Create project?")){b$("Cancelled");return}let Y=S$();Y.start("Creating project...");let G=j(),K=await fJ(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`),U0("Project ready")}import{readdir as jz,access as Mz,readFile as Cz}from"fs/promises";import{join as B0}from"path";var m$=null;async function $3(){if(m$)return m$;return m$=await Iz(),m$}async function Iz(){let[$,q]=await Promise.all([wz(),Az()]),J=await Ez(),X=J.ok?await yz():void 0,[Z,H]=X?await Promise.all([Oz(X),Nz(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 wz(){try{let{stdout:$}=await S("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 Az(){try{let{stdout:$}=await S("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 Ez(){let $=process.env.HOME||"",q=[process.env.IDF_PATH,B0($,"esp","esp-idf"),B0($,"esp-idf")].filter(Boolean);for(let J of q)try{await Mz(J);let X;try{let Z=B0(J,"version.txt");X=(await Cz(Z,"utf-8")).trim()}catch{try{let{stdout:Z}=await S("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 yz(){let $=process.env.HOME||"",q=B0($,".espressif","python_env");try{let J=await jz(q);for(let X of J)if(X.startsWith("idf")){let Z=B0(q,X,"bin","python");try{return await S(Z,["--version"],{timeout:2000}),Z}catch{continue}}}catch{}return}async function Oz($){try{let{stdout:q}=await S($,["-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 Nz($){try{let{stdout:q}=await S($,["-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 gJ(){let $=await $3();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 Dz="303A";async function u$(){let $=await gJ();if(!$.ok)return[];let q=$.python;try{let{stdout:J}=await S(q,["-m","serial.tools.list_ports","-v"],{timeout:5000}),X=[],Z=J.split(`
209
+ `),H=null,Q="",Y="";for(let G of Z)if(G.startsWith("/dev/")){if(H){let K=cJ(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=cJ(H,Q,Y);if(G)X.push(G)}return await Sz(q,X)}catch{return[]}}function cJ($,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=vz(Z),Y=hz(Z,H);return{port:$,connectionType:Q,vendorId:Z,productId:H,manufacturer:J2[Z||""]?.name,chip:Y,description:q!=="n/a"?q:void 0}}function vz($){if(!$)return"unknown";return $.toUpperCase()===Dz?"native-usb":"uart-bridge"}function hz($,q){if(!$)return;let J=J2[$.toUpperCase()];if(!J)return;if(q){let X=J.chips[q.toUpperCase()];if(X)return X}return J.name}async function Sz($,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 fz($,X.port);return{...X,espChip:H}}return X}))}async function fz($,q){try{let{stdout:J,stderr:X}=await S($,["-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 _1(){try{return{ok:!0,data:await u$()}}catch($){return{ok:!1,error:`Failed to list devices: ${$}`}}}var b=t(C1(),1);function bz($){return $.replace(/\x1b\[[0-9;]*m/g,"")}function mJ($){return bz($).length}function gz($,q){let J=$.map((K,U)=>{let z=Math.max(...q.map((B)=>mJ(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=mJ(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 uJ($){if($.length===0){console.log(b.default.dim("No devices found"));return}let q=["Port","Type","Chip","ESP"],J=$.map((H)=>{let Q=cz(H.connectionType),Y=H.espChip||(H.connectionType==="native-usb"?"?":"-");return[H.port,Q,H.chip||"-",Y]});gz(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 cz($){switch($){case"native-usb":return b.default.magenta("USB");case"uart-bridge":return b.default.cyan("UART");default:return b.default.dim("?")}}async function pJ(){V.info("Scanning for devices...");let $=await _1();if(!$.ok)V.error($.error),process.exit(1);V.newline(),uJ($.data),V.newline()}async function p$($,q){let J=q||j(),{projectDir:X,target:Z,clean:H}=$;if(!await M1(X))return _.emit(J,{type:"error",message:"Not an ESP-IDF project directory"}),{ok:!1,error:"Not an ESP-IDF project directory"};if(Z){_.emit(J,{type:"progress",message:`Setting target to ${Z}...`});let G=await J1("idf.py",["set-target",Z],{cwd:X,operationId:J});if(!G.ok||G.data.exitCode!==0)return _.emit(J,{type:"error",message:"Failed to set target"}),{ok:!1,error:"Failed to set target"}}if(H)_.emit(J,{type:"progress",message:"Cleaning..."}),await J1("idf.py",["clean"],{cwd:X,operationId:J});_.emit(J,{type:"progress",message:"Building project..."});let Y=await J1("idf.py",["build"],{cwd:X,operationId:J});if(!Y.ok)return _.emit(J,{type:"error",message:Y.error}),{ok:!1,error:Y.error};if(Y.data.exitCode!==0)return _.emit(J,{type:"error",message:"Build failed"}),{ok:!1,error:"Build failed"};return _.emit(J,{type:"complete",result:{success:!0,projectDir:X}}),{ok:!0,data:{success:!0,projectDir:X}}}async function lJ($){let q=await q1(process.cwd());if(!q)V.error("Not in an ESP-IDF project directory"),process.exit(1);let J=j();_.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 p$({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 l$($,q){let J=q||j(),{projectDir:X,port:Z,baud:H=C3}=$;if(!await M1(X))return _.emit(J,{type:"error",message:"Not an ESP-IDF project directory"}),{ok:!1,error:"Not an ESP-IDF project directory"};_.emit(J,{type:"progress",message:`Flashing to ${Z}...`});let Y=["-p",Z,"-b",String(H),"flash"],G=await J1("idf.py",Y,{cwd:X,operationId:J});if(!G.ok)return _.emit(J,{type:"error",message:G.error}),{ok:!1,error:G.error};if(G.data.exitCode!==0)return _.emit(J,{type:"error",message:"Flash failed"}),{ok:!1,error:"Flash failed"};return _.emit(J,{type:"complete",result:{success:!0,port:Z}}),{ok:!0,data:{success:!0,port:Z}}}async function dJ($){let q=await q1(process.cwd());if(!q)V.error("Not in an ESP-IDF project directory"),process.exit(1);let J=$.port;if(!J){let H=await _1();if(!H.ok)V.error(H.error),process.exit(1);J=await d1(H.data)}let X=j();_.subscribe(X,(H)=>{if(H.data.type==="stdout"||H.data.type==="stderr")V.output(H.data.text)}),V.step(`Flashing to ${J}...`);let Z=await l$({projectDir:q,port:J,baud:$.baud},X);if(!Z.ok)V.newline(),V.error(Z.error),process.exit(1);V.newline(),V.success("Flash complete")}var q3=new Map;function d$($,q){let J=q||j(),{port:X,baud:Z=I3,projectDir:H}=$,Q=["-p",X,"-b",String(Z),"monitor"],Y=uq("idf.py",Q,{cwd:H||process.cwd(),operationId:J});if(!Y)return _.emit(J,{type:"error",message:"ESP-IDF not found"}),{ok:!1,error:"ESP-IDF not found"};return q3.set(J,Y),Y.then(()=>{q3.delete(J),_.emit(J,{type:"complete",result:{stopped:!0}})}),{ok:!0,data:{operationId:J,stop:()=>{Y.kill("SIGTERM"),q3.delete(J)},sendInput:(K)=>{Y.stdin?.write(K)}}}}async function iJ($){let q=await q1(process.cwd()),J=$.port;if(!J){let H=await _1();if(!H.ok)V.error(H.error),process.exit(1);J=await d1(H.data)}let X=j();_.subscribe(X,(H)=>{if(H.data.type==="stdout"||H.data.type==="stderr")V.output(H.data.text)}),V.step(`Connecting to ${J}...`),V.dim("Press Ctrl+C to exit"),V.newline();let Z=d$({port:J,baud:$.baud,projectDir:q||void 0},X);if(!Z.ok)V.error(Z.error),process.exit(1);process.on("SIGINT",()=>{Z.data.stop(),V.newline(),V.info("Monitor stopped"),process.exit(0)}),await new Promise(()=>{})}async function nJ($,q){let J=q||j(),{projectDir:X,full:Z}=$;if(!await M1(X))return _.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";_.emit(J,{type:"progress",message:`Running ${Q}...`});let Y=await J1("idf.py",[Q],{cwd:X,operationId:J});if(!Y.ok)return _.emit(J,{type:"error",message:Y.error}),{ok:!1,error:Y.error};if(Y.data.exitCode!==0){let G=`${Q} failed`;return _.emit(J,{type:"error",message:G}),{ok:!1,error:G}}return _.emit(J,{type:"complete",result:null}),{ok:!0,data:void 0}}async function aJ($){let q=await q1(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 nJ({projectDir:q,full:$.full},J);if(!X.ok)V.error(X.error),process.exit(1);V.success("Clean complete")}async function tJ($){let q=await q1(process.cwd());if(!q)V.error("Not in an ESP-IDF project directory"),process.exit(1);let J=$.port;if(!J){let G=await _1();if(!G.ok)V.error(G.error),process.exit(1);J=await d1(G.data)}let X=(G)=>{if(G.data.type==="stdout"||G.data.type==="stderr")V.output(G.data.text)};if(!$.skipBuild){let G=j();_.subscribe(G,X),V.step("Building...");let K=await p$({projectDir:q},G);if(!K.ok)V.newline(),V.error(K.error),process.exit(1);V.newline(),V.success("Build complete")}let Z=j();_.subscribe(Z,X),V.step(`Flashing to ${J}...`);let H=await l$({projectDir:q,port:J,baud:$.baud},Z);if(!H.ok)V.newline(),V.error(H.error),process.exit(1);V.newline(),V.success("Flash complete");let Q=j();_.subscribe(Q,X),V.step("Starting monitor..."),V.dim("Press Ctrl+C to exit"),V.newline();let Y=d$({port:J,baud:$.baud,projectDir:q},Q);if(!Y.ok)V.error(Y.error),process.exit(1);process.on("SIGINT",()=>{Y.data.stop(),V.newline(),V.info("Monitor stopped"),process.exit(0)}),await new Promise(()=>{})}var h=t(C1(),1);async function oJ(){V.info("Checking system health..."),V.newline();let $=await $3();if(L0($.python),L0($.git),L0($.idf),L0($.pyserial),L0($.esptool),V.newline(),await mz(),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 L0($){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 mz(){console.log(h.default.bold(" Devices:"));try{let $=await u$();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 rJ(){let $=new k3;return $.name("espcli").description("CLI tool for ESP-IDF development").version(A3),$.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(wJ),$.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(bJ),$.command("devices").alias("ports").description("List connected ESP devices").action(pJ),$.command("build").description("Build the current project").option("-t, --target <target>","Set target before build").option("-c, --clean","Clean before build").action(lJ),$.command("flash").description("Flash firmware to device").option("-p, --port <port>","Serial port").option("-b, --baud <baud>","Flash baud rate",parseInt).action(dJ),$.command("monitor").description("Open serial monitor").option("-p, --port <port>","Serial port").option("-b, --baud <baud>","Monitor baud rate",parseInt).action(iJ),$.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(tJ),$.command("clean").description("Clean build artifacts").option("-f, --full","Full clean (includes sdkconfig)").action(aJ),$.command("doctor").alias("check").description("Check system health and dependencies").action(oJ),$}var uz=rJ();uz.parse();