@doubao-dev/cli 1.0.0-legacy-rc.13 → 1.0.0-legacy-rc.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/1349~0.js +2 -2
- package/dist/1453.js +2 -2
- package/dist/1499~0.js +13 -0
- package/dist/1547~0.js +29 -0
- package/dist/351.js +1 -1
- package/dist/4569~0.js +1 -0
- package/dist/4946.js +3 -3
- package/dist/5085~0.js +1 -1
- package/dist/5329~0.js +98 -0
- package/dist/{5792~0.js.LICENSE.txt → 5329~0.js.LICENSE.txt} +40 -0
- package/dist/5343~0.js +1 -1
- package/dist/5641~0.js +2 -2
- package/dist/5725~0.js +1 -1
- package/dist/678~0.js +1 -1
- package/dist/8352~0.js +1 -0
- package/dist/8652~0.js +5 -5
- package/dist/9652~0.js +1 -0
- package/dist/@inquirer/select.js +1 -1
- package/dist/app.js +1 -1
- package/dist/build.js +4 -4
- package/dist/business-template-personal-information.js +1 -1
- package/dist/check.js +2 -2
- package/dist/components-loader.js +1 -1
- package/dist/demo-server.js +1 -1
- package/dist/demo.js +1 -1
- package/dist/dev-service-client.js +1 -1
- package/dist/dev-shell.js +1 -1
- package/dist/dev.js +7 -12
- package/dist/dev2.js +4 -33
- package/dist/dist.js +1 -1
- package/dist/dist~1.js +1 -1
- package/dist/info.js +2 -2
- package/dist/init.js +4 -4
- package/dist/inquirer.js +1 -1
- package/dist/login.js +2 -2
- package/dist/main.js +1 -1
- package/dist/manifest-headers.js +1 -1
- package/dist/mcp-bridge.js +1 -1
- package/dist/ora.js +3 -3
- package/dist/sandbox.js +1 -1
- package/dist/sdk.js +37 -37
- package/dist/skills.js +1 -1
- package/dist/skills~1.js +1 -1
- package/dist/status.js +1 -1
- package/dist/stop.js +1 -1
- package/dist/sync.js +1 -1
- package/dist/yaml.js +1 -1
- package/package.json +5 -5
- package/dist/4970~0.js +0 -5
- package/dist/5792~0.js +0 -30
- package/dist/6179~0.js +0 -25
- package/dist/6611~0.js +0 -34
- package/dist/6686~0.js +0 -1
- package/dist/8348~0.js +0 -1
- package/dist/9966~0.js +0 -15
- package/dist/9966~0.js.LICENSE.txt +0 -39
package/dist/6179~0.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
var t,e,i,s;let r,n;import"node:module";import{__webpack_require__ as o}from"./rslib-runtime~0.js";import{external_node_process_namespaceObject as a,external_node_child_process_namespaceObject as h}from"./6686~0.js";import{external_node_module_namespaceObject as l}from"./8348~0.js";import{getEnvironmentRequestHeaders as u,withAuth as p}from"./4970~0.js";class d extends Error{constructor(t,e,i){super(i),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=e,this.exitCode=t,this.nestedError=void 0}}class c extends d{constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}class m{constructor(t,e){switch(this.description=e||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,t[0]){case"<":this.required=!0,this._name=t.slice(1,-1);break;case"[":this.required=!1,this._name=t.slice(1,-1);break;default:this.required=!0,this._name=t}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(t,e){return e!==this.defaultValue&&Array.isArray(e)?(e.push(t),e):[t]}default(t,e){return this.defaultValue=t,this.defaultValueDescription=e,this}argParser(t){return this.parseArg=t,this}choices(t){return this.argChoices=t.slice(),this.parseArg=(t,e)=>{if(!this.argChoices.includes(t))throw new c(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(t,e):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function g(t){let e=t.name()+(!0===t.variadic?"...":"");return t.required?"<"+e+">":"["+e+"]"}let f=o("node:util");class _{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(t){this.helpWidth=this.helpWidth??t.helpWidth??80}visibleCommands(t){let e=t.commands.filter(t=>!t._hidden),i=t._getHelpCommand();return i&&!i._hidden&&e.push(i),this.sortSubcommands&&e.sort((t,e)=>t.name().localeCompare(e.name())),e}compareOptions(t,e){let i=t=>t.short?t.short.replace(/^-/,""):t.long.replace(/^--/,"");return i(t).localeCompare(i(e))}visibleOptions(t){let e=t.options.filter(t=>!t.hidden),i=t._getHelpOption();if(i&&!i.hidden){let s=i.short&&t._findOption(i.short),r=i.long&&t._findOption(i.long);s||r?i.long&&!r?e.push(t.createOption(i.long,i.description)):i.short&&!s&&e.push(t.createOption(i.short,i.description)):e.push(i)}return this.sortOptions&&e.sort(this.compareOptions),e}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];let e=[];for(let i=t.parent;i;i=i.parent){let t=i.options.filter(t=>!t.hidden);e.push(...t)}return this.sortOptions&&e.sort(this.compareOptions),e}visibleArguments(t){return(t._argsDescription&&t.registeredArguments.forEach(e=>{e.description=e.description||t._argsDescription[e.name()]||""}),t.registeredArguments.find(t=>t.description))?t.registeredArguments:[]}subcommandTerm(t){let e=t.registeredArguments.map(t=>g(t)).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(e?" "+e:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,e){return e.visibleCommands(t).reduce((t,i)=>Math.max(t,this.displayWidth(e.styleSubcommandTerm(e.subcommandTerm(i)))),0)}longestOptionTermLength(t,e){return e.visibleOptions(t).reduce((t,i)=>Math.max(t,this.displayWidth(e.styleOptionTerm(e.optionTerm(i)))),0)}longestGlobalOptionTermLength(t,e){return e.visibleGlobalOptions(t).reduce((t,i)=>Math.max(t,this.displayWidth(e.styleOptionTerm(e.optionTerm(i)))),0)}longestArgumentTermLength(t,e){return e.visibleArguments(t).reduce((t,i)=>Math.max(t,this.displayWidth(e.styleArgumentTerm(e.argumentTerm(i)))),0)}commandUsage(t){let e=t._name;t._aliases[0]&&(e=e+"|"+t._aliases[0]);let i="";for(let e=t.parent;e;e=e.parent)i=e.name()+" "+i;return i+e+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){let e=[];if(t.argChoices&&e.push(`choices: ${t.argChoices.map(t=>JSON.stringify(t)).join(", ")}`),void 0!==t.defaultValue&&(t.required||t.optional||t.isBoolean()&&"boolean"==typeof t.defaultValue)&&e.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),void 0!==t.presetArg&&t.optional&&e.push(`preset: ${JSON.stringify(t.presetArg)}`),void 0!==t.envVar&&e.push(`env: ${t.envVar}`),e.length>0){let i=`(${e.join(", ")})`;return t.description?`${t.description} ${i}`:i}return t.description}argumentDescription(t){let e=[];if(t.argChoices&&e.push(`choices: ${t.argChoices.map(t=>JSON.stringify(t)).join(", ")}`),void 0!==t.defaultValue&&e.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),e.length>0){let i=`(${e.join(", ")})`;return t.description?`${t.description} ${i}`:i}return t.description}formatItemList(t,e,i){return 0===e.length?[]:[i.styleTitle(t),...e,""]}groupItems(t,e,i){let s=new Map;return t.forEach(t=>{let e=i(t);s.has(e)||s.set(e,[])}),e.forEach(t=>{let e=i(t);s.has(e)||s.set(e,[]),s.get(e).push(t)}),s}formatHelp(t,e){let i=e.padWidth(t,e),s=e.helpWidth??80;function r(t,s){return e.formatItem(t,i,s,e)}let n=[`${e.styleTitle("Usage:")} ${e.styleUsage(e.commandUsage(t))}`,""],o=e.commandDescription(t);o.length>0&&(n=n.concat([e.boxWrap(e.styleCommandDescription(o),s),""]));let a=e.visibleArguments(t).map(t=>r(e.styleArgumentTerm(e.argumentTerm(t)),e.styleArgumentDescription(e.argumentDescription(t))));if(n=n.concat(this.formatItemList("Arguments:",a,e)),this.groupItems(t.options,e.visibleOptions(t),t=>t.helpGroupHeading??"Options:").forEach((t,i)=>{let s=t.map(t=>r(e.styleOptionTerm(e.optionTerm(t)),e.styleOptionDescription(e.optionDescription(t))));n=n.concat(this.formatItemList(i,s,e))}),e.showGlobalOptions){let i=e.visibleGlobalOptions(t).map(t=>r(e.styleOptionTerm(e.optionTerm(t)),e.styleOptionDescription(e.optionDescription(t))));n=n.concat(this.formatItemList("Global Options:",i,e))}return this.groupItems(t.commands,e.visibleCommands(t),t=>t.helpGroup()||"Commands:").forEach((t,i)=>{let s=t.map(t=>r(e.styleSubcommandTerm(e.subcommandTerm(t)),e.styleSubcommandDescription(e.subcommandDescription(t))));n=n.concat(this.formatItemList(i,s,e))}),n.join("\n")}displayWidth(t){return(0,f.stripVTControlCharacters)(t).length}styleTitle(t){return t}styleUsage(t){return t.split(" ").map(t=>"[options]"===t?this.styleOptionText(t):"[command]"===t?this.styleSubcommandText(t):"["===t[0]||"<"===t[0]?this.styleArgumentText(t):this.styleCommandText(t)).join(" ")}styleCommandDescription(t){return this.styleDescriptionText(t)}styleOptionDescription(t){return this.styleDescriptionText(t)}styleSubcommandDescription(t){return this.styleDescriptionText(t)}styleArgumentDescription(t){return this.styleDescriptionText(t)}styleDescriptionText(t){return t}styleOptionTerm(t){return this.styleOptionText(t)}styleSubcommandTerm(t){return t.split(" ").map(t=>"[options]"===t?this.styleOptionText(t):"["===t[0]||"<"===t[0]?this.styleArgumentText(t):this.styleSubcommandText(t)).join(" ")}styleArgumentTerm(t){return this.styleArgumentText(t)}styleOptionText(t){return t}styleArgumentText(t){return t}styleSubcommandText(t){return t}styleCommandText(t){return t}padWidth(t,e){return Math.max(e.longestOptionTermLength(t,e),e.longestGlobalOptionTermLength(t,e),e.longestSubcommandTermLength(t,e),e.longestArgumentTermLength(t,e))}preformatted(t){return/\n[^\S\r\n]/.test(t)}formatItem(t,e,i,s){let r,n=" ".repeat(2);if(!i)return n+t;let o=t.padEnd(e+t.length-s.displayWidth(t)),a=(this.helpWidth??80)-e-2-2;return r=a<this.minWidthToWrap||s.preformatted(i)?i:s.boxWrap(i,a).replace(/\n/g,"\n"+" ".repeat(e+2)),n+o+" ".repeat(2)+r.replace(/\n/g,`
|
|
2
|
-
${n}`)}boxWrap(t,e){if(e<this.minWidthToWrap)return t;let i=t.split(/\r\n|\n/),s=/[\s]*[^\s]+/g,r=[];return i.forEach(t=>{let i=t.match(s);if(null===i)return void r.push("");let n=[i.shift()],o=this.displayWidth(n[0]);i.forEach(t=>{let i=this.displayWidth(t);if(o+i<=e){n.push(t),o+=i;return}r.push(n.join(""));let s=t.trimStart();n=[s],o=this.displayWidth(s)}),r.push(n.join(""))}),r.join("\n")}}class O{constructor(t,e){this.flags=t,this.description=e||"",this.required=t.includes("<"),this.optional=t.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(t),this.mandatory=!1;let i=function(t){let e,i,s=/^-[^-]$/,r=/^--[^-]/,n=t.split(/[ |,]+/).concat("guard");if(s.test(n[0])&&(e=n.shift()),r.test(n[0])&&(i=n.shift()),!e&&s.test(n[0])&&(e=n.shift()),!e&&r.test(n[0])&&(e=i,i=n.shift()),n[0].startsWith("-")){let e=n[0],i=`option creation failed due to '${e}' in option flags '${t}'`;if(/^-[^-][^-]/.test(e))throw Error(`${i}
|
|
3
|
-
- a short flag is a single dash and a single character
|
|
4
|
-
- either use a single dash and a single character (for a short flag)
|
|
5
|
-
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(s.test(e))throw Error(`${i}
|
|
6
|
-
- too many short flags`);if(r.test(e))throw Error(`${i}
|
|
7
|
-
- too many long flags`);throw Error(`${i}
|
|
8
|
-
- unrecognised flag format`)}if(void 0===e&&void 0===i)throw Error(`option creation failed due to no flags found in '${t}'.`);return{shortFlag:e,longFlag:i}}(t);this.short=i.shortFlag,this.long=i.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(t,e){return this.defaultValue=t,this.defaultValueDescription=e,this}preset(t){return this.presetArg=t,this}conflicts(t){return this.conflictsWith=this.conflictsWith.concat(t),this}implies(t){let e=t;return"string"==typeof t&&(e={[t]:!0}),this.implied=Object.assign(this.implied||{},e),this}env(t){return this.envVar=t,this}argParser(t){return this.parseArg=t,this}makeOptionMandatory(t=!0){return this.mandatory=!!t,this}hideHelp(t=!0){return this.hidden=!!t,this}_collectValue(t,e){return e!==this.defaultValue&&Array.isArray(e)?(e.push(t),e):[t]}choices(t){return this.argChoices=t.slice(),this.parseArg=(t,e)=>{if(!this.argChoices.includes(t))throw new c(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(t,e):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?C(this.name().replace(/^no-/,"")):C(this.name())}helpGroup(t){return this.helpGroupHeading=t,this}is(t){return this.short===t||this.long===t}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class v{constructor(t){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,t.forEach(t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,e)=>{this.positiveOptions.has(e)&&this.dualOptions.add(e)})}valueFromOption(t,e){let i=e.attributeName();if(!this.dualOptions.has(i))return!0;let s=this.negativeOptions.get(i).presetArg;return e.negate===((void 0!==s&&s)===t)}}function C(t){return t.split("-").reduce((t,e)=>t+e[0].toUpperCase()+e.slice(1))}function b(t,e){if(!e||0===e.length)return"";e=Array.from(new Set(e));let i=t.startsWith("--");i&&(t=t.slice(2),e=e.map(t=>t.slice(2)));let s=[],r=3;return(e.forEach(e=>{if(e.length<=1)return;let i=function(t,e){if(Math.abs(t.length-e.length)>3)return Math.max(t.length,e.length);let i=[];for(let e=0;e<=t.length;e++)i[e]=[e];for(let t=0;t<=e.length;t++)i[0][t]=t;for(let s=1;s<=e.length;s++)for(let r=1;r<=t.length;r++){let n;n=+(t[r-1]!==e[s-1]),i[r][s]=Math.min(i[r-1][s]+1,i[r][s-1]+1,i[r-1][s-1]+n),r>1&&s>1&&t[r-1]===e[s-2]&&t[r-2]===e[s-1]&&(i[r][s]=Math.min(i[r][s],i[r-2][s-2]+1))}return i[t.length][e.length]}(t,e),n=Math.max(t.length,e.length);(n-i)/n>.4&&(i<r?(r=i,s=[e]):i===r&&s.push(e))}),s.sort((t,e)=>t.localeCompare(e)),i&&(s=s.map(t=>`--${t}`)),s.length>1)?`
|
|
9
|
-
(Did you mean one of ${s.join(", ")}?)`:1===s.length?`
|
|
10
|
-
(Did you mean ${s[0]}?)`:""}let A=o("node:events"),y=o("node:path"),E=o("node:fs");class w extends A.EventEmitter{constructor(t){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=t||"",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:t=>a.stdout.write(t),writeErr:t=>a.stderr.write(t),outputError:(t,e)=>e(t),getOutHelpWidth:()=>a.stdout.isTTY?a.stdout.columns:void 0,getErrHelpWidth:()=>a.stderr.isTTY?a.stderr.columns:void 0,getOutHasColors:()=>S()??(a.stdout.isTTY&&a.stdout.hasColors?.()),getErrHasColors:()=>S()??(a.stderr.isTTY&&a.stderr.hasColors?.()),stripColor:t=>(0,f.stripVTControlCharacters)(t)},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(t){return this._outputConfiguration=t._outputConfiguration,this._helpOption=t._helpOption,this._helpCommand=t._helpCommand,this._helpConfiguration=t._helpConfiguration,this._exitCallback=t._exitCallback,this._storeOptionsAsProperties=t._storeOptionsAsProperties,this._combineFlagAndOptionalValue=t._combineFlagAndOptionalValue,this._allowExcessArguments=t._allowExcessArguments,this._enablePositionalOptions=t._enablePositionalOptions,this._showHelpAfterError=t._showHelpAfterError,this._showSuggestionAfterError=t._showSuggestionAfterError,this}_getCommandAndAncestors(){let t=[];for(let e=this;e;e=e.parent)t.push(e);return t}command(t,e,i){let s=e,r=i;"object"==typeof s&&null!==s&&(r=s,s=null),r=r||{};let[,n,o]=t.match(/([^ ]+) *(.*)/),a=this.createCommand(n);return(s&&(a.description(s),a._executableHandler=!0),r.isDefault&&(this._defaultCommandName=a._name),a._hidden=!!(r.noHelp||r.hidden),a._executableFile=r.executableFile||null,o&&a.arguments(o),this._registerCommand(a),a.parent=this,a.copyInheritedSettings(this),s)?this:a}createCommand(t){return new w(t)}createHelp(){return Object.assign(new _,this.configureHelp())}configureHelp(t){return void 0===t?this._helpConfiguration:(this._helpConfiguration=t,this)}configureOutput(t){return void 0===t?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...t},this)}showHelpAfterError(t=!0){return"string"!=typeof t&&(t=!!t),this._showHelpAfterError=t,this}showSuggestionAfterError(t=!0){return this._showSuggestionAfterError=!!t,this}addCommand(t,e){if(!t._name)throw Error(`Command passed to .addCommand() must have a name
|
|
11
|
-
- specify the name in Command constructor or using .name()`);return(e=e||{}).isDefault&&(this._defaultCommandName=t._name),(e.noHelp||e.hidden)&&(t._hidden=!0),this._registerCommand(t),t.parent=this,t._checkForBrokenPassThrough(),this}createArgument(t,e){return new m(t,e)}argument(t,e,i,s){let r=this.createArgument(t,e);return"function"==typeof i?r.default(s).argParser(i):r.default(i),this.addArgument(r),this}arguments(t){return t.trim().split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(t){let e=this.registeredArguments.slice(-1)[0];if(e?.variadic)throw Error(`only the last argument can be variadic '${e.name()}'`);if(t.required&&void 0!==t.defaultValue&&void 0===t.parseArg)throw Error(`a default value for a required argument is never used: '${t.name()}'`);return this.registeredArguments.push(t),this}helpCommand(t,e){if("boolean"==typeof t)return this._addImplicitHelpCommand=t,t&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let[,i,s]=(t??"help [command]").match(/([^ ]+) *(.*)/),r=e??"display help for command",n=this.createCommand(i);return n.helpOption(!1),s&&n.arguments(s),r&&n.description(r),this._addImplicitHelpCommand=!0,this._helpCommand=n,(t||e)&&this._initCommandGroup(n),this}addHelpCommand(t,e){return"object"!=typeof t?this.helpCommand(t,e):(this._addImplicitHelpCommand=!0,this._helpCommand=t,this._initCommandGroup(t)),this}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(void 0===this._helpCommand&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(t,e){let i=["preSubcommand","preAction","postAction"];if(!i.includes(t))throw Error(`Unexpected value for event passed to hook : '${t}'.
|
|
12
|
-
Expecting one of '${i.join("', '")}'`);return this._lifeCycleHooks[t]?this._lifeCycleHooks[t].push(e):this._lifeCycleHooks[t]=[e],this}exitOverride(t){return t?this._exitCallback=t:this._exitCallback=t=>{if("commander.executeSubCommandAsync"!==t.code)throw t},this}_exit(t,e,i){this._exitCallback&&this._exitCallback(new d(t,e,i)),a.exit(t)}action(t){let e=e=>{let i=this.registeredArguments.length,s=e.slice(0,i);return this._storeOptionsAsProperties?s[i]=this:s[i]=this.opts(),s.push(this),t.apply(this,s)};return this._actionHandler=e,this}createOption(t,e){return new O(t,e)}_callParseArg(t,e,i,s){try{return t.parseArg(e,i)}catch(t){if("commander.invalidArgument"===t.code){let e=`${s} ${t.message}`;this.error(e,{exitCode:t.exitCode,code:t.code})}throw t}}_registerOption(t){let e=t.short&&this._findOption(t.short)||t.long&&this._findOption(t.long);if(e){let i=t.long&&this._findOption(t.long)?t.long:t.short;throw Error(`Cannot add option '${t.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${i}'
|
|
13
|
-
- already used by option '${e.flags}'`)}this._initOptionGroup(t),this.options.push(t)}_registerCommand(t){let e=t=>[t.name()].concat(t.aliases()),i=e(t).find(t=>this._findCommand(t));if(i){let s=e(this._findCommand(i)).join("|"),r=e(t).join("|");throw Error(`cannot add command '${r}' as already have command '${s}'`)}this._initCommandGroup(t),this.commands.push(t)}addOption(t){this._registerOption(t);let e=t.name(),i=t.attributeName();void 0!==t.defaultValue&&this.setOptionValueWithSource(i,t.defaultValue,"default");let s=(e,s,r)=>{null==e&&void 0!==t.presetArg&&(e=t.presetArg);let n=this.getOptionValue(i);null!==e&&t.parseArg?e=this._callParseArg(t,e,n,s):null!==e&&t.variadic&&(e=t._collectValue(e,n)),null==e&&(e=!t.negate&&(!!t.isBoolean()||!!t.optional||"")),this.setOptionValueWithSource(i,e,r)};return this.on("option:"+e,e=>{let i=`error: option '${t.flags}' argument '${e}' is invalid.`;s(e,i,"cli")}),t.envVar&&this.on("optionEnv:"+e,e=>{let i=`error: option '${t.flags}' value '${e}' from env '${t.envVar}' is invalid.`;s(e,i,"env")}),this}_optionEx(t,e,i,s,r){if("object"==typeof e&&e instanceof O)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let n=this.createOption(e,i);if(n.makeOptionMandatory(!!t.mandatory),"function"==typeof s)n.default(r).argParser(s);else if(s instanceof RegExp){let t=s;s=(e,i)=>{let s=t.exec(e);return s?s[0]:i},n.default(r).argParser(s)}else n.default(s);return this.addOption(n)}option(t,e,i,s){return this._optionEx({},t,e,i,s)}requiredOption(t,e,i,s){return this._optionEx({mandatory:!0},t,e,i,s)}combineFlagAndOptionalValue(t=!0){return this._combineFlagAndOptionalValue=!!t,this}allowUnknownOption(t=!0){return this._allowUnknownOption=!!t,this}allowExcessArguments(t=!0){return this._allowExcessArguments=!!t,this}enablePositionalOptions(t=!0){return this._enablePositionalOptions=!!t,this}passThroughOptions(t=!0){return this._passThroughOptions=!!t,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(t=!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=!!t,this}getOptionValue(t){return this._storeOptionsAsProperties?this[t]:this._optionValues[t]}setOptionValue(t,e){return this.setOptionValueWithSource(t,e,void 0)}setOptionValueWithSource(t,e,i){return this._storeOptionsAsProperties?this[t]=e:this._optionValues[t]=e,this._optionValueSources[t]=i,this}getOptionValueSource(t){return this._optionValueSources[t]}getOptionValueSourceWithGlobals(t){let e;return this._getCommandAndAncestors().forEach(i=>{void 0!==i.getOptionValueSource(t)&&(e=i.getOptionValueSource(t))}),e}_prepareUserArgs(t,e){let i;if(void 0!==t&&!Array.isArray(t))throw Error("first parameter to parse must be array or undefined");if(e=e||{},void 0===t&&void 0===e.from){a.versions?.electron&&(e.from="electron");let t=a.execArgv??[];(t.includes("-e")||t.includes("--eval")||t.includes("-p")||t.includes("--print"))&&(e.from="eval")}switch(void 0===t&&(t=a.argv),this.rawArgs=t.slice(),e.from){case void 0:case"node":this._scriptPath=t[1],i=t.slice(2);break;case"electron":a.defaultApp?(this._scriptPath=t[1],i=t.slice(2)):i=t.slice(1);break;case"user":i=t.slice(0);break;case"eval":i=t.slice(1);break;default:throw Error(`unexpected parse option { from: '${e.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",i}parse(t,e){this._prepareForParse();let i=this._prepareUserArgs(t,e);return this._parseCommand([],i),this}async parseAsync(t,e){this._prepareForParse();let i=this._prepareUserArgs(t,e);return await this._parseCommand([],i),this}_prepareForParse(){null===this._savedState?(this.options.filter(t=>t.negate&&void 0===t.defaultValue&&void 0===this.getOptionValue(t.attributeName())).forEach(t=>{let e=t.long.replace(/^--no-/,"--");this._findOption(e)||this.setOptionValueWithSource(t.attributeName(),!0,"default")}),this.saveStateBeforeParse()):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.
|
|
14
|
-
- 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(t,e,i){if(E.existsSync(t))return;let s=e?`searched for local subcommand relative to directory '${e}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory";throw Error(`'${t}' does not exist
|
|
15
|
-
- if '${i}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
16
|
-
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
17
|
-
- ${s}`)}_executeSubCommand(t,e){let i;e=e.slice();let s=[".js",".ts",".tsx",".mjs",".cjs"];function r(t,e){let i=y.resolve(t,e);if(E.existsSync(i))return i;if(s.includes(y.extname(e)))return;let r=s.find(t=>E.existsSync(`${i}${t}`));if(r)return`${i}${r}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let n=t._executableFile||`${this._name}-${t._name}`,o=this._executableDir||"";if(this._scriptPath){let t;try{t=E.realpathSync(this._scriptPath)}catch{t=this._scriptPath}o=y.resolve(y.dirname(t),o)}if(o){let e=r(o,n);if(!e&&!t._executableFile&&this._scriptPath){let i=y.basename(this._scriptPath,y.extname(this._scriptPath));i!==this._name&&(e=r(o,`${i}-${t._name}`))}n=e||n}let l=s.includes(y.extname(n));"win32"!==a.platform?l?(e.unshift(n),e=x(a.execArgv).concat(e),i=h.spawn(a.argv["0"],e,{stdio:"inherit"})):i=h.spawn(n,e,{stdio:"inherit"}):(this._checkForMissingExecutable(n,o,t._name),e.unshift(n),e=x(a.execArgv).concat(e),i=h.spawn(a.execPath,e,{stdio:"inherit"})),i.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(t=>{a.on(t,()=>{!1===i.killed&&null===i.exitCode&&i.kill(t)})});let u=this._exitCallback;i.on("close",t=>{t=t??1,u?u(new d(t,"commander.executeSubCommandAsync","(close)")):a.exit(t)}),i.on("error",e=>{if("ENOENT"===e.code)this._checkForMissingExecutable(n,o,t._name);else if("EACCES"===e.code)throw Error(`'${n}' not executable`);if(u){let t=new d(1,"commander.executeSubCommandAsync","(error)");t.nestedError=e,u(t)}else a.exit(1)}),this.runningCommand=i}_dispatchSubcommand(t,e,i){let s,r=this._findCommand(t);return r||this.help({error:!0}),r._prepareForParse(),s=this._chainOrCallSubCommandHook(s,r,"preSubcommand"),s=this._chainOrCall(s,()=>{if(!r._executableHandler)return r._parseCommand(e,i);this._executeSubCommand(r,e.concat(i))})}_dispatchHelpCommand(t){t||this.help();let e=this._findCommand(t);return e&&!e._executableHandler&&e.help(),this._dispatchSubcommand(t,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((t,e)=>{t.required&&null==this.args[e]&&this.missingArgument(t.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic||this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let t=(t,e,i)=>{let s=e;if(null!==e&&t.parseArg){let r=`error: command-argument value '${e}' is invalid for argument '${t.name()}'.`;s=this._callParseArg(t,e,i,r)}return s};this._checkNumberOfArguments();let e=[];this.registeredArguments.forEach((i,s)=>{let r=i.defaultValue;i.variadic?s<this.args.length?(r=this.args.slice(s),i.parseArg&&(r=r.reduce((e,s)=>t(i,s,e),i.defaultValue))):void 0===r&&(r=[]):s<this.args.length&&(r=this.args[s],i.parseArg&&(r=t(i,r,i.defaultValue))),e[s]=r}),this.processedArgs=e}_chainOrCall(t,e){return t?.then&&"function"==typeof t.then?t.then(()=>e()):e()}_chainOrCallHooks(t,e){let i=t,s=[];return this._getCommandAndAncestors().reverse().filter(t=>void 0!==t._lifeCycleHooks[e]).forEach(t=>{t._lifeCycleHooks[e].forEach(e=>{s.push({hookedCommand:t,callback:e})})}),"postAction"===e&&s.reverse(),s.forEach(t=>{i=this._chainOrCall(i,()=>t.callback(t.hookedCommand,this))}),i}_chainOrCallSubCommandHook(t,e,i){let s=t;return void 0!==this._lifeCycleHooks[i]&&this._lifeCycleHooks[i].forEach(t=>{s=this._chainOrCall(s,()=>t(this,e))}),s}_parseCommand(t,e){let i=this.parseOptions(e);if(this._parseOptionsEnv(),this._parseOptionsImplied(),t=t.concat(i.operands),e=i.unknown,this.args=t.concat(e),t&&this._findCommand(t[0]))return this._dispatchSubcommand(t[0],t.slice(1),e);if(this._getHelpCommand()&&t[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(t[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(e),this._dispatchSubcommand(this._defaultCommandName,t,e);!this.commands.length||0!==this.args.length||this._actionHandler||this._defaultCommandName||this.help({error:!0}),this._outputHelpIfRequested(i.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let s=()=>{i.unknown.length>0&&this.unknownOption(i.unknown[0])},r=`command:${this.name()}`;if(this._actionHandler){let i;return s(),this._processArguments(),i=this._chainOrCallHooks(i,"preAction"),i=this._chainOrCall(i,()=>this._actionHandler(this.processedArgs)),this.parent&&(i=this._chainOrCall(i,()=>{this.parent.emit(r,t,e)})),i=this._chainOrCallHooks(i,"postAction")}if(this.parent?.listenerCount(r))s(),this._processArguments(),this.parent.emit(r,t,e);else if(t.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",t,e);this.listenerCount("command:*")?this.emit("command:*",t,e):this.commands.length?this.unknownCommand():(s(),this._processArguments())}else this.commands.length?(s(),this.help({error:!0})):(s(),this._processArguments())}_findCommand(t){if(t)return this.commands.find(e=>e._name===t||e._aliases.includes(t))}_findOption(t){return this.options.find(e=>e.is(t))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(t=>{t.options.forEach(e=>{e.mandatory&&void 0===t.getOptionValue(e.attributeName())&&t.missingMandatoryOptionValue(e)})})}_checkForConflictingLocalOptions(){let t=this.options.filter(t=>{let e=t.attributeName();return void 0!==this.getOptionValue(e)&&"default"!==this.getOptionValueSource(e)});t.filter(t=>t.conflictsWith.length>0).forEach(e=>{let i=t.find(t=>e.conflictsWith.includes(t.attributeName()));i&&this._conflictingOption(e,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(t=>{t._checkForConflictingLocalOptions()})}parseOptions(t){let e=[],i=[],s=e;function r(t){return t.length>1&&"-"===t[0]}let n=t=>!!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(t)&&!this._getCommandAndAncestors().some(t=>t.options.map(t=>t.short).some(t=>/^-\d$/.test(t))),o=null,a=null,h=0;for(;h<t.length||a;){let l=a??t[h++];if(a=null,"--"===l){s===i&&s.push(l),s.push(...t.slice(h));break}if(o&&(!r(l)||n(l))){this.emit(`option:${o.name()}`,l);continue}if(o=null,r(l)){let e=this._findOption(l);if(e){if(e.required){let i=t[h++];void 0===i&&this.optionMissingArgument(e),this.emit(`option:${e.name()}`,i)}else if(e.optional){let i=null;h<t.length&&(!r(t[h])||n(t[h]))&&(i=t[h++]),this.emit(`option:${e.name()}`,i)}else this.emit(`option:${e.name()}`);o=e.variadic?e:null;continue}}if(l.length>2&&"-"===l[0]&&"-"!==l[1]){let t=this._findOption(`-${l[1]}`);if(t){t.required||t.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${t.name()}`,l.slice(2)):(this.emit(`option:${t.name()}`),a=`-${l.slice(2)}`);continue}}if(/^--[^=]+=/.test(l)){let t=l.indexOf("="),e=this._findOption(l.slice(0,t));if(e&&(e.required||e.optional)){this.emit(`option:${e.name()}`,l.slice(t+1));continue}}if(s===e&&r(l)&&!(0===this.commands.length&&n(l))&&(s=i),(this._enablePositionalOptions||this._passThroughOptions)&&0===e.length&&0===i.length){if(this._findCommand(l)){e.push(l),i.push(...t.slice(h));break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){e.push(l,...t.slice(h));break}else if(this._defaultCommandName){i.push(l,...t.slice(h));break}}if(this._passThroughOptions){s.push(l,...t.slice(h));break}s.push(l)}return{operands:e,unknown:i}}opts(){if(this._storeOptionsAsProperties){let t={},e=this.options.length;for(let i=0;i<e;i++){let e=this.options[i].attributeName();t[e]=e===this._versionOptionName?this._version:this[e]}return t}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((t,e)=>Object.assign(t,e.opts()),{})}error(t,e){this._outputConfiguration.outputError(`${t}
|
|
18
|
-
`,this._outputConfiguration.writeErr),"string"==typeof this._showHelpAfterError?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
19
|
-
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr("\n"),this.outputHelp({error:!0}));let i=e||{},s=i.exitCode||1,r=i.code||"commander.error";this._exit(s,r,t)}_parseOptionsEnv(){this.options.forEach(t=>{if(t.envVar&&t.envVar in a.env){let e=t.attributeName();(void 0===this.getOptionValue(e)||["default","config","env"].includes(this.getOptionValueSource(e)))&&(t.required||t.optional?this.emit(`optionEnv:${t.name()}`,a.env[t.envVar]):this.emit(`optionEnv:${t.name()}`))}})}_parseOptionsImplied(){let t=new v(this.options),e=t=>void 0!==this.getOptionValue(t)&&!["default","implied"].includes(this.getOptionValueSource(t));this.options.filter(i=>void 0!==i.implied&&e(i.attributeName())&&t.valueFromOption(this.getOptionValue(i.attributeName()),i)).forEach(t=>{Object.keys(t.implied).filter(t=>!e(t)).forEach(e=>{this.setOptionValueWithSource(e,t.implied[e],"implied")})})}missingArgument(t){let e=`error: missing required argument '${t}'`;this.error(e,{code:"commander.missingArgument"})}optionMissingArgument(t){let e=`error: option '${t.flags}' argument missing`;this.error(e,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(t){let e=`error: required option '${t.flags}' not specified`;this.error(e,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(t,e){let i=t=>{let e=t.attributeName(),i=this.getOptionValue(e),s=this.options.find(t=>t.negate&&e===t.attributeName()),r=this.options.find(t=>!t.negate&&e===t.attributeName());return s&&(void 0===s.presetArg&&!1===i||void 0!==s.presetArg&&i===s.presetArg)?s:r||t},s=t=>{let e=i(t),s=e.attributeName();return"env"===this.getOptionValueSource(s)?`environment variable '${e.envVar}'`:`option '${e.flags}'`},r=`error: ${s(t)} cannot be used with ${s(e)}`;this.error(r,{code:"commander.conflictingOption"})}unknownOption(t){if(this._allowUnknownOption)return;let e="";if(t.startsWith("--")&&this._showSuggestionAfterError){let i=[],s=this;do{let t=s.createHelp().visibleOptions(s).filter(t=>t.long).map(t=>t.long);i=i.concat(t),s=s.parent}while(s&&!s._enablePositionalOptions);e=b(t,i)}let i=`error: unknown option '${t}'${e}`;this.error(i,{code:"commander.unknownOption"})}_excessArguments(t){if(this._allowExcessArguments)return;let e=this.registeredArguments.length,i=t.length,s=this.parent?` for '${this.name()}'`:"",r=t.join(", "),n=`error: too many arguments${s}. Expected ${e} argument${1===e?"":"s"} but got ${i}: ${r}.`;this.error(n,{code:"commander.excessArguments"})}unknownCommand(){let t=this.args[0],e="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(t=>{i.push(t.name()),t.alias()&&i.push(t.alias())}),e=b(t,i)}let i=`error: unknown command '${t}'${e}`;this.error(i,{code:"commander.unknownCommand"})}version(t,e,i){if(void 0===t)return this._version;this._version=t,e=e||"-V, --version",i=i||"output the version number";let s=this.createOption(e,i);return this._versionOptionName=s.attributeName(),this._registerOption(s),this.on("option:"+s.name(),()=>{this._outputConfiguration.writeOut(`${t}
|
|
20
|
-
`),this._exit(0,"commander.version",t)}),this}description(t,e){return void 0===t&&void 0===e?this._description:(this._description=t,e&&(this._argsDescription=e),this)}summary(t){return void 0===t?this._summary:(this._summary=t,this)}alias(t){if(void 0===t)return this._aliases[0];let e=this;if(0!==this.commands.length&&this.commands[this.commands.length-1]._executableHandler&&(e=this.commands[this.commands.length-1]),t===e._name)throw Error("Command alias can't be the same as its name");let i=this.parent?._findCommand(t);if(i){let e=[i.name()].concat(i.aliases()).join("|");throw Error(`cannot add alias '${t}' to command '${this.name()}' as already have command '${e}'`)}return e._aliases.push(t),this}aliases(t){return void 0===t?this._aliases:(t.forEach(t=>this.alias(t)),this)}usage(t){if(void 0===t){if(this._usage)return this._usage;let t=this.registeredArguments.map(t=>g(t));return[].concat(this.options.length||null!==this._helpOption?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=t,this}name(t){return void 0===t?this._name:(this._name=t,this)}helpGroup(t){return void 0===t?this._helpGroupHeading??"":(this._helpGroupHeading=t,this)}commandsGroup(t){return void 0===t?this._defaultCommandGroup??"":(this._defaultCommandGroup=t,this)}optionsGroup(t){return void 0===t?this._defaultOptionGroup??"":(this._defaultOptionGroup=t,this)}_initOptionGroup(t){this._defaultOptionGroup&&!t.helpGroupHeading&&t.helpGroup(this._defaultOptionGroup)}_initCommandGroup(t){this._defaultCommandGroup&&!t.helpGroup()&&t.helpGroup(this._defaultCommandGroup)}nameFromFilename(t){return this._name=y.basename(t,y.extname(t)),this}executableDir(t){return void 0===t?this._executableDir:(this._executableDir=t,this)}helpInformation(t){let e=this.createHelp(),i=this._getOutputContext(t);e.prepareContext({error:i.error,helpWidth:i.helpWidth,outputHasColors:i.hasColors});let s=e.formatHelp(this,e);return i.hasColors?s:this._outputConfiguration.stripColor(s)}_getOutputContext(t){let e,i,s,r=!!(t=t||{}).error;return r?(e=t=>this._outputConfiguration.writeErr(t),i=this._outputConfiguration.getErrHasColors(),s=this._outputConfiguration.getErrHelpWidth()):(e=t=>this._outputConfiguration.writeOut(t),i=this._outputConfiguration.getOutHasColors(),s=this._outputConfiguration.getOutHelpWidth()),{error:r,write:t=>(i||(t=this._outputConfiguration.stripColor(t)),e(t)),hasColors:i,helpWidth:s}}outputHelp(t){let e;"function"==typeof t&&(e=t,t=void 0);let i=this._getOutputContext(t),s={error:i.error,write:i.write,command:this};this._getCommandAndAncestors().reverse().forEach(t=>t.emit("beforeAllHelp",s)),this.emit("beforeHelp",s);let r=this.helpInformation({error:i.error});if(e&&"string"!=typeof(r=e(r))&&!Buffer.isBuffer(r))throw Error("outputHelp callback must return a string or a Buffer");i.write(r),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",s),this._getCommandAndAncestors().forEach(t=>t.emit("afterAllHelp",s))}helpOption(t,e){return"boolean"==typeof t?t?(null===this._helpOption&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null:(this._helpOption=this.createOption(t??"-h, --help",e??"display help for command"),(t||e)&&this._initOptionGroup(this._helpOption)),this}_getHelpOption(){return void 0===this._helpOption&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(t){return this._helpOption=t,this._initOptionGroup(t),this}help(t){this.outputHelp(t);let e=Number(a.exitCode??0);0===e&&t&&"function"!=typeof t&&t.error&&(e=1),this._exit(e,"commander.help","(outputHelp)")}addHelpText(t,e){let i=["beforeAll","before","after","afterAll"];if(!i.includes(t))throw Error(`Unexpected value for position to addHelpText.
|
|
21
|
-
Expecting one of '${i.join("', '")}'`);let s=`${t}Help`;return this.on(s,t=>{let i;(i="function"==typeof e?e({error:t.error,command:t.command}):e)&&t.write(`${i}
|
|
22
|
-
`)}),this}_outputHelpIfRequested(t){let e=this._getHelpOption();e&&t.find(t=>e.is(t))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}}function x(t){return t.map(t=>{let e,i;if(!t.startsWith("--inspect"))return t;let s="127.0.0.1",r="9229";return(null!==(i=t.match(/^(--inspect(-brk)?)$/))?e=i[1]:null!==(i=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))?(e=i[1],/^\d+$/.test(i[3])?r=i[3]:s=i[3]):null!==(i=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))&&(e=i[1],s=i[3],r=i[4]),e&&"0"!==r)?`${e}=${s}:${parseInt(r)+1}`:t})}function S(){return!a.env.NO_COLOR&&"0"!==a.env.FORCE_COLOR&&"false"!==a.env.FORCE_COLOR&&(!!a.env.FORCE_COLOR||void 0!==a.env.CLICOLOR_FORCE||void 0)}new w;let $={authBaseUrl:"https://developer.doubao.com",apiBaseUrl:"https://developer.doubao.com",authAllowedOrigins:["https://developer.doubao.com"],excludeCommands:[],requestHeaders:{}},H=(i=$,{authBaseUrl:(s=(n=process.env.DBX_BUILD_BASE_DOMAIN?k(function(t){let e=t.trim();if(/^http:\/\//i.test(e))throw Error("DBX 构建配置 baseDomain 必须使用 HTTPS");return/^https:\/\//i.test(e)?e:`https://${e}`}(process.env.DBX_BUILD_BASE_DOMAIN),"baseDomain"):void 0,{authBaseUrl:process.env.DBX_BUILD_AUTH_BASE_URL?k(process.env.DBX_BUILD_AUTH_BASE_URL,"authBaseUrl"):n,apiBaseUrl:process.env.DBX_BUILD_API_BASE_URL?k(process.env.DBX_BUILD_API_BASE_URL,"apiBaseUrl"):n,authAllowedOrigins:process.env.DBX_BUILD_AUTH_ALLOWED_ORIGINS?B(process.env.DBX_BUILD_AUTH_ALLOWED_ORIGINS):void 0,excludeCommands:process.env.DBX_BUILD_EXCLUDE_COMMANDS?B(process.env.DBX_BUILD_EXCLUDE_COMMANDS):void 0,requestHeaders:u({compatXTTEnv:!1})})).authBaseUrl??i.authBaseUrl,apiBaseUrl:s.apiBaseUrl??i.apiBaseUrl,authAllowedOrigins:[...i.authAllowedOrigins,...s.authAllowedOrigins??[]],excludeCommands:s.excludeCommands??i.excludeCommands,requestHeaders:{...i.requestHeaders,...s.requestHeaders??{}}});function T(){var t;return{baseUrl:k(H.authBaseUrl,"authBaseUrl"),allowedOrigins:[...new Set([P((t=H).authBaseUrl,"authBaseUrl"),P(t.apiBaseUrl,"apiBaseUrl"),...t.authAllowedOrigins.map(t=>P(t,"authAllowedOrigins"))])],requestHeaders:H.requestHeaders}}function D(){return k(H.apiBaseUrl,"apiBaseUrl")}function V(t){return t.replace(/\/+$/,"")}function k(t,e){let i;try{i=new URL(V(t))}catch{throw Error(`DBX 构建配置 ${e} 必须是完整的 HTTPS 地址`)}if("https:"!==i.protocol)throw Error(`DBX 构建配置 ${e} 必须使用 HTTPS`);return V(i.toString())}function P(t,e){return new URL(k(t,e)).origin}function B(t){return"string"==typeof t?t.split(",").map(t=>t.trim()).filter(Boolean):Array.isArray(t)?t.map(t=>String(t).trim()).filter(Boolean):[]}function L(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function U(t,e){if(!L(t))return;let i=t[e];return"string"==typeof i&&i?i:void 0}let{version:I}=(0,l.createRequire)(import.meta.url)("../package.json");function G(){return r}function F(t){let e=t.headers.get("x-tt-logid");e&&(r=e)}let M=p(fetch,T()),N=async(t,e)=>{let i=await M(t,e);return F(i),i},W=async(t,e)=>{var i;let s,r=(i=e,s=new Headers(T().requestHeaders),i?.headers&&new Headers(i.headers).forEach((t,e)=>s.set(e,t)),{...i,headers:s}),n=await fetch(t,r);return F(n),n};function q(){return D()}function j(t){return`${q()}${t}`}function R(t){let e=Number(t);if(!/^-?\d+$/.test(t)||!Number.isSafeInteger(e))throw new c("请输入整数");return e}function X(t){let e=R(t);if(e<1)throw new c("请输入大于或等于 1 的整数");return e}function z(t){let e=t.slice(2),i=e.indexOf("--");return(i<0?e:e.slice(0,i)).includes("--json")}function J(t){return(e,i)=>{if(!t.includes(e))throw new c(`可选值为 ${t.join(", ")}`);return[...i,e]}}function K(t,e){return t.helpOption("-h, --help","显示帮助信息"),t.configureHelp({showGlobalOptions:!0,styleTitle:t=>({"Usage:":"用法:","Arguments:":"参数:","Options:":"选项:","Global Options:":"全局选项:","Commands:":"命令:"})[t]??t}),t.exitOverride(),e&&t.configureOutput({outputError:()=>void 0,writeErr:()=>void 0}),t}(e=t||(t={})).None=()=>({dispose(){}}),e.once=function(t){return(e,i,s)=>{let r=!1,n=t(t=>{if(!r)return r=!0,e.call(i,t)},null,s);return r&&n.dispose(),n}},e.map=function(t,e){return(i,s,r)=>t(t=>i.call(s,e(t)),null,r)},e.filter=function(t,e){return(i,s,r)=>t(t=>e(t)&&i.call(s,t),null,r)},e.debounce=function(t,e,i=100){let s,r,n;return(o,a,h)=>(s=t(t=>{r=e(r,t),clearTimeout(n),n=setTimeout(()=>{let t=r;r=void 0,o.call(a,t)},i)}),{dispose(){s.dispose(),clearTimeout(n)}})};class Y{constructor(){this._listeners=new Set,this._disposed=!1,this.event=t=>this._disposed?{dispose(){}}:(this._listeners.add(t),{dispose:()=>{this._listeners.delete(t)}})}fire(t){if(!this._disposed)for(let e of[...this._listeners])try{e(t)}catch{}}dispose(){this._disposed||(this._disposed=!0,this._listeners.clear())}get hasListeners(){return this._listeners.size>0}}class Q{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}clear(){if(0===this._toDispose.size)return;let t=this._toDispose.values();for(let e of(this._toDispose.clear(),t))try{e.dispose()}catch{}}add(t){return this._isDisposed?console.warn("Adding to a disposed DisposableStore"):this._toDispose.add(t),t}get size(){return this._toDispose.size}}class Z{constructor(){this._store=new Q}dispose(){this._store.dispose()}addDispose(t){return this._store.add(t)}}class tt extends Z{constructor(t,e){super(),this.valueOrFactoryInit=t,this._initialized=!1,this._onStateChangeEmitter=new Y,this.onStateChange=this._onStateChangeEmitter.event,this._options={},this._name="AnonymousState",this.addDispose(this._onStateChangeEmitter),this._options=e||{},this._name=e?.name||"AnonymousState"}get(){return this._initialized||("function"==typeof this.valueOrFactoryInit?this.set(this.valueOrFactoryInit()):this.set(this.valueOrFactoryInit)),this._value}waitUntil(t,e={}){let i=this.get();if(t(i))return Promise.resolve(i);let{timeoutMs:s,signal:r}=e;return new Promise((e,i)=>{let n=!1,o=t=>{n||(n=!0,clearTimeout(l),a.dispose(),r?.removeEventListener("abort",h),t())},a=this.onStateChange(({to:i})=>{t(i)&&o(()=>e(i))}),h=()=>{o(()=>i(r?.reason instanceof Error?r.reason:new ti))},l=void 0!==s?setTimeout(()=>o(()=>i(new te(s))),s):void 0;r?.aborted?h():r?.addEventListener("abort",h,{once:!0})})}set(t){if(this._initialized){if(this._equals(this._value,t))return;let e=this._value;this._value=t,this._onStateChangeEmitter.fire({from:e,to:t})}else this._value=t,this._initialized=!0}_equals(t,e){return this._options.equals?.(t,e)||t===e}get name(){return this._name}}class te extends Error{constructor(t){super(`State wait timed out after ${t}ms`),this.name="StateWaitTimeoutError"}}class ti extends Error{constructor(){super("State wait cancelled"),this.name="StateWaitCancelledError"}}class ts extends tt{constructor(t,e,i){super(()=>this.doCompute(),i),this._compute=t,this.deps=e,this.computeInitialized=!1}doCompute(){return this.initComputeListener(),this._compute()}update(){this.set(this.doCompute())}initComputeListener(){this.computeInitialized||(this.computeInitialized=!0,this.deps.forEach(t=>{this.addDispose(t.onStateChange(this.update.bind(this)))}))}}function tr(t,e,i=(t,e)=>t===e){return t.length===e.length&&t.every((t,s)=>i(t,e[s]))}function tn(t){if("string"==typeof t)try{return JSON.parse(t)}catch{return}}class to extends Z{constructor(t={}){super(),this.lines=[],this.start=null,this.seq=0,this.pipeSubscribers=new Set,this.maxVisibleLines=Math.max(1,t.maxVisibleLines??8),this.maxBufferLines=Math.max(this.maxVisibleLines,t.maxBufferLines??1e3),this.logLines=new tt([],{name:"devLog.lines"}),this.pageInfo=new tt({olderCount:0,newerCount:0,following:!0},{name:"devLog.pageInfo"})}info(t){this.append("info",t)}warn(t){this.append("warn",t)}error(t){this.append("error",t)}append(t,e){let i={id:++this.seq,level:t,text:e};for(let t of(this.lines.push(i),this.trim(),this.refresh(),this.pipeSubscribers))t(i)}pipeTo(t,e,i={}){let s=s=>{let r="info"===s.level?t:e,n=i.prefix?"info"===s.level?i.prefix:`${i.prefix}:${s.level}`:null;r.write(n?`[${n}] ${s.text}
|
|
23
|
-
`:`${s.text}
|
|
24
|
-
`)};if(i.replay)for(let t of this.lines)s(t);return this.pipeSubscribers.add(s),{dispose:()=>{this.pipeSubscribers.delete(s)}}}subscribe(t,e={}){if(e.replay)for(let e of this.lines)t(e);return this.pipeSubscribers.add(t),{dispose:()=>{this.pipeSubscribers.delete(t)}}}clear(){this.lines=[],this.start=null,this.refresh()}pageUp(){if(0===this.lines.length)return;let t=Math.max(0,this.effectiveStart()-this.maxVisibleLines);this.start=t,this.refresh()}pageDown(){if(null===this.start)return;let t=this.effectiveStart()+this.maxVisibleLines;this.start=t>=this.tailStart()?null:t,this.refresh()}effectiveStart(){return this.start??this.tailStart()}tailStart(){return Math.max(0,this.lines.length-this.maxVisibleLines)}trim(){let t=this.lines.length-this.maxBufferLines;t<=0||(this.lines.splice(0,t),null!==this.start&&(this.start=Math.max(0,this.start-t)))}refresh(){let t=this.effectiveStart(),e=this.lines.slice(t,t+this.maxVisibleLines);this.logLines.set(e),this.pageInfo.set({olderCount:t,newerCount:Math.max(0,this.lines.length-t-e.length),following:null===this.start})}}class ta{get finished(){return this.done}get error(){return this.failure}constructor(t,e={}){this.messages=new tt([]),this.controller=new AbortController,this.finishEmitter=new Y,this.errorEmitter=new Y,this.progressEmitter=new Y,this.onFinish=this.finishEmitter.event,this.onError=this.errorEmitter.event,this.done=!1,this.progress={current:void 0,label:"准备中…",onProgressChange:this.progressEmitter.event},this.title=e.title,Promise.resolve().then(()=>(this.controller.signal.throwIfAborted(),t(this,this.controller.signal))).catch(t=>{this.controller.signal.aborted?this.message("操作已取消"):(this.failure=t instanceof Error?t:Error(String(t)),this.message(this.failure.message),this.errorEmitter.fire(this.failure))}).finally(()=>{this.done=!0,this.finishEmitter.fire(),this.finishEmitter.dispose(),this.errorEmitter.dispose(),this.progressEmitter.dispose()})}message(t){this.done||this.messages.set([...this.messages.get(),t])}setMessages(t){this.done||this.messages.set(t)}reportProgress(t,e){this.done||(Object.assign(this.progress,{label:t,current:void 0===e?void 0:Math.max(0,Math.min(100,e))}),this.progressEmitter.fire())}cancel(){this.done||this.controller.signal.aborted||(this.reportProgress("正在取消…"),this.controller.abort())}}let th=o("node:os");function tl(){return process.env.DBX_LOG_DIR?.trim()||y.join(th.homedir(),".dbx","logs")}class tu extends to{constructor(t){super(t),this.activeCount=0,this.namespace=t.namespace,this.rootDir=t.rootDir??tl(),this.maxFileBytes=Math.max(1,t.maxFileBytes??5242880),this.maxFiles=Math.max(1,t.maxFiles??3)}append(t,e){super.append(t,e),this.persist(t,e),this.onAppend?.(t,e)}get isActive(){return this.activeCount>0}markActive(){return this.activeCount+=1,{dispose:()=>{this.activeCount=Math.max(0,this.activeCount-1)}}}mirrorToPanel(t,e){super.append(t,e)}dispose(){this.closeFile(),super.dispose()}currentFilePath(){return void 0===this.fileSeq?void 0:this.filePath(this.fileSeq)}persist(t,e){try{this.ensureWriter();let i=`${new Date().toISOString()} [${t}] [${this.namespace}] ${e.replace(/\r?\n/g," ")}
|
|
25
|
-
`;void 0!==this.fd&&E.fstatSync(this.fd).size+Buffer.byteLength(i)>this.maxFileBytes&&this.rotate(),void 0!==this.fd&&E.writeSync(this.fd,i)}catch{}}ensureWriter(){if(void 0!==this.fd)return;E.mkdirSync(this.rootDir,{recursive:!0});let t=this.existingSeqs().at(-1);if(void 0!==t){let e=E.statSync(this.filePath(t)).size;this.fileSeq=e>=this.maxFileBytes?t+1:t}else this.fileSeq=1;this.fd=E.openSync(this.filePath(this.fileSeq),"a"),this.prune()}rotate(){this.closeFile(),this.fileSeq=(this.fileSeq??0)+1,this.fd=E.openSync(this.filePath(this.fileSeq),"a"),this.prune()}closeFile(){if(void 0!==this.fd){try{E.closeSync(this.fd)}catch{}this.fd=void 0}}prune(){let t=this.existingSeqs();for(let e of t.slice(0,Math.max(0,t.length-this.maxFiles)))try{E.rmSync(this.filePath(e),{force:!0})}catch{}}existingSeqs(){let t=`${this.namespace}-log.`;return E.readdirSync(this.rootDir).map(e=>{if(!e.startsWith(t))return;let i=Number.parseInt(e.slice(t.length),10);return Number.isInteger(i)&&i>0?i:void 0}).filter(t=>void 0!==t).sort((t,e)=>t-e)}filePath(t){return y.join(this.rootDir,`${this.namespace}-log.${String(t).padStart(3,"0")}`)}}let tp="errors";function td(t){if("string"==typeof t)return t;if(t instanceof Error)return`${t.name}: ${t.message}`;try{return JSON.stringify(t)??String(t)}catch{return String(t)}}function tc(t,e){let i=t instanceof Error?t.message:String(t);return`未捕获异常(${e}):${i}`}class tm extends Z{static get instance(){return this._instance||(this._instance=new tm),this._instance}static isDebugEnabled(){return process.env.DEBUG?.includes("DBX_CLI")??!1}constructor(t=tl()){super(),this.loggers=new Map,this.onUnhandledRejection=t=>{this.errorsLogger.error(tc(t,"unhandledRejection"))},this.onUncaughtException=t=>{this.errorsLogger.error(tc(t,"uncaughtException"))},this.rootDir=t,this.errorsLogger=new tu({namespace:tp,rootDir:t}),this.errorsLogger.onAppend=(t,e)=>{for(let i of this.loggers.values())i!==this.errorsLogger&&i.isActive&&i.mirrorToPanel(t,e)},this.loggers.set(tp,this.errorsLogger),process.on("unhandledRejection",this.onUnhandledRejection),process.on("uncaughtException",this.onUncaughtException)}getLogger(t,e={}){let i=this.loggers.get(t);if(i)return i;let s=new tu({...e,namespace:t,rootDir:this.rootDir});return this.loggers.set(t,s),s}static debugLog(t,...e){let i=`debug-${t.replace(/[^\w.-]+/g,"-")}`;try{let t=e;if(1===e.length&&"function"==typeof e[0]){let i=e[0]();t=Array.isArray(i)?i:[i]}let s=t.map(td).join(" ");tm.instance.getLogger(i).info(s)}catch(t){try{tm.instance.getLogger(i).warn(`debugLog 失败:${t instanceof Error?t.message:String(t)}`)}catch{}}}dispose(){for(let t of(process.off("unhandledRejection",this.onUnhandledRejection),process.off("uncaughtException",this.onUncaughtException),this.loggers.values()))t.dispose();this.loggers.clear(),super.dispose()}}function tg(t=process.env){return!t.DBX_TUI_NO_BLOCKS&&("vscode"===t.TERM_PROGRAM||"WezTerm"===t.TERM_PROGRAM||"xterm-kitty"===t.TERM||"wezterm"===t.TERM||!!t.WT_SESSION)}export{ta as ActionHandle,d as CommanderError,ts as ComputedState,Z as Disposable,Y as Emitter,c as InvalidArgumentError,tm as LoggerService,tt as State,m as argument_Argument,tr as arrayEquals,N as authorizedFetch,tg as blockGlyphsSafe,H as build_DBX_BUILD_CONFIG,J as collectChoiceValues,w as command_Command,K as configureCommandOutput,W as configuredFetch,D as getApiBaseUrl,j as getApiUrl,T as getAuthOptions,G as getLastHttpResponseLogId,z as hasJsonOption,q as http_getApiBaseUrl,L as isRecord,O as option_Option,R as parseInteger,X as parsePositiveInteger,U as stringField,tn as tryParseJson,I as version};
|
package/dist/6611~0.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
var e,t,r,n,o,i;let a,s;import"node:module";import{__webpack_require__ as l}from"./rslib-runtime~0.js";import{external_node_tty_namespaceObject as d,external_node_process_namespaceObject as u,external_node_child_process_namespaceObject as c,promises_namespaceObject as p}from"./6686~0.js";import"./8348~0.js";import{external_node_stream_promises_namespaceObject as f,external_node_v8_namespaceObject as h}from"./9966~0.js";import{onExit as m}from"./4970~0.js";import"./6753~0.js";import"./2585~0.js";l.add({"../../../node_modules/.pnpm/@dp+tea-sdk-node@3.0.12/node_modules/@dp/tea-sdk-node/lib/config-manager.js"(e,t,r){var n=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)0>t.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r};Object.defineProperty(t,"__esModule",{value:!0});let o=r("../../../node_modules/.pnpm/@dp+tea-sdk-node@3.0.12/node_modules/@dp/tea-sdk-node/package.json"),i=60*new Date().getTimezoneOffset(),a=new Proxy({darwin:"mac",win32:"windows"},{get:(e,t)=>e[t]||t});t.default=class{get headerFields(){return Object.assign(Object.assign({},this.partialHeaderFields),{custom:JSON.stringify(this.customField)})}get logger(){return this.options.logger}get caller(){return this.options.caller}get appId(){return this.options.app_id}constructor(e){this.options=e,this.userFields={},this.customField={},this.partialHeaderFields={app_id:e.app_id},Object.assign(this.partialHeaderFields,{platform:"Node.js",os_name:a[process.platform],tz_offset:i,sdk_version:o.version})}configure(e){var t;e.header&&this.logger.trace("Re-configure header with %o",e.header),e.user&&this.logger.trace("Re-configure user with %o",e.user),(null==(t=e.header)?void 0:t.custom)&&this.logger.warn("Set custom params inside header is deprecated, use `config` instead. which looks like:",`
|
|
2
|
-
teaSDK.config({
|
|
3
|
-
header: { ... },
|
|
4
|
-
user: { ... },
|
|
5
|
-
custom: {/** custom content */},
|
|
6
|
-
})`);let r=e.header||{},{custom:o}=r,i=n(r,["custom"]);this.customField=JSON.parse(o||"{}"),Object.assign(this.partialHeaderFields,i),Object.assign(this.userFields,e.user),Object.assign(this.customField,e.custom)}get(e){try{if(!e)return{user:this.userFields,header:this.partialHeaderFields};if(Object.hasOwnProperty.call(this.userFields,e))return this.userFields[e];if(Object.hasOwnProperty.call(this.partialHeaderFields,e))return this.partialHeaderFields[e];else return this.customField[e]?this.customField[e]:void 0}catch(e){this.logger.warn("applog node config get error");return}}compose(e,t){let r=Object.assign({},this.userFields,e.user);r.user_unique_id||(r.user_unique_id="anonymous",this.logger.warn("Composing events without specifying `user_unique_id` is strongly deprecated, use `sdk.config()` to add a global fallback value for anonymous users"));let n=Object.assign({},this.customField,e.customOfHeader);return this.partialHeaderFields&&this.partialHeaderFields.app_id&&this.logger.trace("report appid with %o",this.partialHeaderFields.app_id),{id:(null==t?void 0:t.id)||Math.random().toString(32).slice(2),originatedBy:(null==t?void 0:t.originatedBy)||"logsdk",createdAt:(null==t?void 0:t.createdAt)||Date.now(),event:{server_time:Math.ceil(Date.now()/1e3),caller:e.caller||this.caller||"",user:r,header:Object.assign({custom:JSON.stringify(n)},this.partialHeaderFields,e.header),events:e.events.map(e=>Object.assign(Object.assign({},e),{_staging_flag:this.options.isolated}))}}}}},"../../../node_modules/.pnpm/@dp+tea-sdk-node@3.0.12/node_modules/@dp/tea-sdk-node/lib/constants.js"(e,t){t.SDK_VERSION=void 0,t.SDK_VERSION="3.0.10"},"../../../node_modules/.pnpm/@dp+tea-sdk-node@3.0.12/node_modules/@dp/tea-sdk-node/lib/index.js"(e,t,r){var n=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)0>t.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TeaSDK=void 0;let i=o(r("assert")),a=o(r("../../../node_modules/.pnpm/@dp+tea-sdk-node@3.0.12/node_modules/@dp/tea-sdk-node/lib/config-manager.js")),s=r("../../../node_modules/.pnpm/@logsdk+node-utils@3.0.8/node_modules/@logsdk/node-utils/lib/index.js"),l=r("../../../node_modules/.pnpm/@dp+tea-sdk-node@3.0.12/node_modules/@dp/tea-sdk-node/package.json"),d=r("../../../node_modules/.pnpm/@dp+tea-sdk-node@3.0.12/node_modules/@dp/tea-sdk-node/lib/constants.js");t.TeaSDK=class{get meta(){return{caller:this.configManager.caller,user:this.configManager.userFields,header:this.configManager.headerFields,appId:this.configManager.appId,version:l.version,instanceID:this.instanceID,installedPlugins:[]}}constructor(e){this.plugins=[],this.instanceID=Math.random().toString(32).slice(2),this.config=e=>{this.plugins.map(t=>{var r;null==(r=t.beforeConfig)||r.call(t,e)}),this.configManager.configure(e),this.plugins.map(t=>{var r;null==(r=t.afterConfig)||r.call(t,e)})},this.logger=new s.Logger("Logsdk"),this.logger.setLevel(e.logLevel||"silent"),e.isolated&&this.logger.warn("Global isolation is enabled"),(0,i.default)("number"==typeof(null==e?void 0:e.app_id)),this.configManager=new a.default(Object.assign(Object.assign({},e),{logger:this.logger})),this.logger.trace("initialized success with options %o",e),this.logger.trace("initialized sdk version %o",d.SDK_VERSION)}composeHookContext(e){let t=this;return{get metaInfo(){return t.meta},logger:this.logger.propagate(e.name),collect:(t,r)=>{this.trigger(Object.assign({events:t.map(e=>Object.assign(Object.assign({},e.extra),{event:e.name,params:JSON.stringify(e.params),time:Math.ceil(Date.now()/1e3)}))},r),{originatedBy:e.name})}}}trigger(...e){let[t,r]=e,n=this.configManager.compose(t,r);this.logger.trace("Composed event %o",n),this.plugins.map(e=>{var t,r;null==(t=e.beforeSendEvent)||t.call(e,n),null==(r=e.onSendEvent)||r.call(e,n)})}use(...e){this.plugins.push(...e),e.map(e=>{var t;null==(t=e.install)||t.call(e,this.composeHookContext(e)),this.logger.trace("Plugin %s installed",e.name)})}collectEvents(e,t,r,n){this.trigger({events:r,user:e,header:t,caller:n||this.configManager.caller})}getConfig(e){return this.configManager.get(e)}collect(e,t,r){let o=Array.isArray(e)?e.map(({name:e,params:t})=>({event:e,params:JSON.stringify(t||{})})):[{event:e,params:JSON.stringify(t||{})}],i=(Array.isArray(e)?t:r)||{},{custom:a}=i,s=n(i,["custom"]);this.plugins.length||this.logger.warn("Dry run since no plugin applied"),this.trigger(Object.assign({events:o.map(e=>Object.assign(Object.assign({},e),{time:Math.ceil(Date.now()/1e3)})),customOfHeader:a},s))}}},"../../../node_modules/.pnpm/@logsdk+node-plugin-http@4.0.8_patch_hash=d36ee5d841feee100de58867bba710d3ebdd5840c85f8_2a73615d04585e58fdd40bf5c6ccd254/node_modules/@logsdk/node-plugin-http/lib/constants.js"(e,t){t.pathMap=t.ReportURL=void 0,t.ReportURL={cn:"https://mcs.zijieapi.com",sg:"https://sgali-mcs.byteoversea.com",va:"https://maliva-mcs.byteoversea.com"},t.pathMap={REPORT_PATH:"/v1/list",ABConfigPath:"/service/2/abtest_config/"}},"../../../node_modules/.pnpm/@logsdk+node-plugin-http@4.0.8_patch_hash=d36ee5d841feee100de58867bba710d3ebdd5840c85f8_2a73615d04585e58fdd40bf5c6ccd254/node_modules/@logsdk/node-plugin-http/lib/index.js"(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,s)}l((n=n.apply(e,t||[])).next())})},o=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)0>t.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.httpPlugin=t.HttpController=void 0;let a=r("events"),s=i(r("../../../node_modules/.pnpm/abort-controller@3.0.0/node_modules/abort-controller/dist/abort-controller.mjs")),l={default:globalThis.fetch},d=r("../../../node_modules/.pnpm/@logsdk+node-plugin-http@4.0.8_patch_hash=d36ee5d841feee100de58867bba710d3ebdd5840c85f8_2a73615d04585e58fdd40bf5c6ccd254/node_modules/@logsdk/node-plugin-http/lib/constants.js"),u=r("../../../node_modules/.pnpm/@logsdk+node-plugin-http@4.0.8_patch_hash=d36ee5d841feee100de58867bba710d3ebdd5840c85f8_2a73615d04585e58fdd40bf5c6ccd254/node_modules/@logsdk/node-plugin-http/lib/utility.js");function c(e){try{return JSON.parse(e||"{}")}catch(e){return{}}}class p extends a.EventEmitter{get concurrent(){return this.options.concurrent||10}constructor(e,t){super(),this.options=e,this.channelDomain=t,this.pending=!1,this.queue=[],this.name="http"}flush(){return n(this,void 0,void 0,function*(){let e;if(this.pending)return;this.pending=!0;let t=this.queue.splice(0,this.concurrent),r=[],{event_verify_url:n,retry:o,timeout:i=3e3}=this.options,a=!1;try{e=AbortController||s.default}catch(t){e=s.default}let c=new e;this.channelDomain.endsWith("/")&&(this.channelDomain=this.channelDomain.slice(0,-1));let p=this.channelDomain+d.pathMap.REPORT_PATH;try{if(t.length){if(n){let e=setTimeout(()=>{this.emit("submit-et-timeout"),this.pluginContext.logger.trace("verify %d event timeout",t.length),c.abort()},i);this.pluginContext.logger.trace("verify %d events with event verify url: %s",t.length);let a=(0,u.doWithRetry)({incremental:!0,durationMS:500,count:o||0,name:"verify"},()=>(0,l.default)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.map(({event:e})=>Object.assign(Object.assign({},e),{verbose:1}))),signal:c.signal}).then(e=>e.json())).then(r=>{this.pluginContext.logger.trace("new verify events %o result %s",t.map(e=>e.id),r),clearTimeout(e)}).catch(t=>{let r=null==t?void 0:t.stack,n=null==t?void 0:t.message;r&&n?this.pluginContext.logger.error("network error: %s $o",n,r):this.pluginContext.logger.error("network error: %o",null==t?void 0:t.message),this.emit("submit-et-error",{message:n,stack:r}),clearTimeout(e)});r.push(a)}this.pluginContext.logger.trace("with channel domain %s",this.channelDomain);let e=setTimeout(()=>{this.emit("submit-timeout"),this.pluginContext.logger.trace("event %o timeout",t.map(({id:e})=>e)),c.abort()},i),s=(0,u.doWithRetry)({incremental:!0,durationMS:500,count:o||2,name:"event"},()=>(0,l.default)(p,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.map(({event:e})=>Object.assign(Object.assign({},e),{verbose:1}))),signal:c.signal}).then(e=>e.json())).then(r=>{a=!0,this.pluginContext.logger.trace("new sent events %o result %s",t.map(({id:e})=>e),r),clearTimeout(e)}).catch(t=>{let r=null==t?void 0:t.stack,n=null==t?void 0:t.message;r&&n?this.pluginContext.logger.trace("network error: %s %o",n,r):this.pluginContext.logger.trace("network error: %o",t),this.emit("submit-error",{message:n,stack:r}),clearTimeout(e)});r.push(s)}yield Promise.all(r).finally(()=>{var e,r;for(let{event:n}of t)this.emit("end",{event:n,hasSucceed:a}),null==(r=(e=this.options).onEnd)||r.call(e,n,a)})}finally{this.pending=!1}this.queue.length>0?this.flush():(this.pluginContext.logger.trace("queue drained, last sent %d",t.length),this.emit("drain",{lastEvents:t,hasSucceed:a}))})}install(e){this.pluginContext=e}onSendEvent({event:e,id:t}){let{events:r}=e,n=o(e,["events"]),i=(0,u.divide)(r,50).map(e=>({id:t,event:Object.assign(Object.assign({},n),{events:e})}));this.queue.push(...i),this.flush()}getVar(e,t){var r,o,i,a;return n(this,void 0,void 0,function*(){let{header:n,user:s}=this.pluginContext.metaInfo,l=Object.assign(Object.assign(Object.assign(Object.assign({aid:n.app_id},n),s),null==t?void 0:t.extraProperties),{custom:Object.assign(Object.assign({},c(n.custom)),null==t?void 0:t.extraProperties.custom)});this.pluginContext.logger.trace("abRequest config: %o",l);let d=yield this.abRequest(l,{timeout:(null==t?void 0:t.timeout)||3e3});if(null==(r=d[e])?void 0:r.vid){let{user_unique_id:r,uuid:n}=null!=(o=null==t?void 0:t.extraProperties)?o:{};this.pluginContext.logger.trace("abtest_exposure name: %s, vid: %s, val: %o",e,d[e].vid,d[e].val),this.pluginContext.collect([{extra:{ab_sdk_version:String(d[e].vid)},name:"abtest_exposure",params:{}}],{user:{user_unique_id:r||n},header:{ab_sdk_version:String(d[e].vid)}})}return null!=(a=null==(i=d[e])?void 0:i.val)?a:null==t?void 0:t.defaultValue})}getAllVars(e){return n(this,void 0,void 0,function*(){let{header:t,user:r}=this.pluginContext.metaInfo,n=Object.assign(Object.assign(Object.assign(Object.assign({aid:t.app_id},t),r),null==e?void 0:e.extraProperties),{custom:Object.assign(Object.assign({},c(t.custom)),null==e?void 0:e.extraProperties.custom)});return this.pluginContext.logger.trace("abRequest config: %o",n),this.abRequest(n,{timeout:(null==e?void 0:e.timeout)||3e3})})}abRequest(e,t){return n(this,void 0,void 0,function*(){let r,n;try{let e=new URL(this.options.abServiceOrigin);e.pathname=d.pathMap.ABConfigPath,r=e.toJSON(),this.pluginContext.logger.trace("request abtest config with url %s",r)}catch(e){this.pluginContext.logger.error("invalid service origin %O",e)}try{n=AbortController||s.default}catch(e){n=s.default}let o=new n,i=setTimeout(()=>{this.emit("submit-ab-timeout"),this.pluginContext.logger.trace("ab requesttimeout"),o.abort()},t.timeout);if(!r)return{};let a=(0,l.default)(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({header:e}),signal:o.signal}).then(e=>e.json()).then(e=>(this.pluginContext.logger.trace("abRequest response %O",e),clearTimeout(i),null==e?void 0:e.data));return(yield a.catch(e=>{this.pluginContext.logger.error("unexpected_error_when_request_ab_ata"),this.pluginContext.logger.error(e),clearTimeout(i)}))||{}})}}t.HttpController=p,t.httpPlugin=function(e){let t=e.channel_domain||e.channel&&d.ReportURL[e.channel];if(!t)throw Error("plugin 'http': channel or channel_domain can't be both undefined");return new p(e,t)}},"../../../node_modules/.pnpm/@logsdk+node-plugin-http@4.0.8_patch_hash=d36ee5d841feee100de58867bba710d3ebdd5840c85f8_2a73615d04585e58fdd40bf5c6ccd254/node_modules/@logsdk/node-plugin-http/lib/utility.js"(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,s)}l((n=n.apply(e,t||[])).next())})};function n(e){return new Promise(t=>{setTimeout(()=>{t(!0)},e).unref()})}Object.defineProperty(t,"__esModule",{value:!0}),t.doWithRetry=t.waitUntil=t.divide=void 0,t.divide=function(e,t){return e.reduce((e,r)=>{let n=e[e.length-1];return n.length>=t&&(n=[],e.push(n)),n.push(r),e},[[]])},t.waitUntil=n,t.doWithRetry=function(e,t){return r(this,void 0,void 0,function*(){let r,o=e.count>=0?e.count:0,i=o+1;for(;i>0;){i--;try{return yield null==t?void 0:t()}catch(e){r=e}let a=o+1-i;yield n(e.durationMS*a)}return Promise.reject(r)})}},"../../../node_modules/.pnpm/@logsdk+node-utils@3.0.8/node_modules/@logsdk/node-utils/lib/format.js"(e,t,r){t.format=void 0;let n=/%[sdjo%]/g;t.format=function(e,...t){var o;return"object"==typeof process&&"string"==typeof(null==(o=null==process?void 0:process.versions)?void 0:o.node)?r("util").format(e,...t):function(e){let t=1,r=arguments,o=r.length,i=String(e).replace(n,e=>{if("%%"===e)return"%";if(t>=o)return e;switch(e){case"%s":return String(r[t++]);case"%d":return Number(r[t++]).toString();case"%j":try{return JSON.stringify(r[t++])}catch(e){return"[Circular]"}default:return e}});for(var a,s=r[t];t<o;s=r[++t])null!==s&&"object"==typeof(a=s)&&null!==a?i+=" "+JSON.stringify(s):i+=" "+s;return i}(e,...t)}},"../../../node_modules/.pnpm/@logsdk+node-utils@3.0.8/node_modules/@logsdk/node-utils/lib/index.js"(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r("../../../node_modules/.pnpm/@logsdk+node-utils@3.0.8/node_modules/@logsdk/node-utils/lib/logger.js"),t)},"../../../node_modules/.pnpm/@logsdk+node-utils@3.0.8/node_modules/@logsdk/node-utils/lib/logger.js"(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.Logger=void 0;let n=r("../../../node_modules/.pnpm/@logsdk+node-utils@3.0.8/node_modules/@logsdk/node-utils/lib/format.js"),o={silent:0,error:1,warn:2,verbose:3},i={write(e,t){switch(e){case"error":console.error(t);break;case"warn":console.warn(t);break;default:console.log(t)}}};t.Logger=class e{constructor(e){this.product=e,this.levelIndex=1,this.consumer=i,this.getLevelIndex=()=>this.levelIndex,this.getConsumer=()=>this.consumer}propagate(t){let r=new e(`${this.product}.${t}`);return r.getLevelIndex=()=>this.levelIndex,r.getConsumer=()=>this.consumer,r}setLevel(e){this.levelIndex=o[e]||1}log(e,t,...r){let o=(0,n.format)(t,...r);this.getConsumer().write(e,`[${this.product}] [${e}] ${o}`)}error(e,...t){this.getLevelIndex()>=1&&this.log("error",e,...t)}warn(e,...t){this.getLevelIndex()>=2&&this.log("warn",e,...t)}trace(e,...t){this.getLevelIndex()>=3&&this.log("trace",e,...t)}}},"../../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js"(e,t,r){let n=r("child_process"),o=r("../../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js"),i=r("../../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js");function a(e,t,r){let a=o(e,t,r),s=n.spawn(a.command,a.args,a.options);return i.hookChildProcess(s,a),s}e.exports=a,e.exports.spawn=a,e.exports.sync=function(e,t,r){let a=o(e,t,r),s=n.spawnSync(a.command,a.args,a.options);return s.error=s.error||i.verifyENOENTSync(s.status,a),s},e.exports._parse=o,e.exports._enoent=i},"../../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js"(e){let t="win32"===process.platform;function r(e,t){return Object.assign(Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function n(e,n){return t&&1===e&&!n.file?r(n.original,"spawn"):null}e.exports={hookChildProcess:function(e,r){if(!t)return;let o=e.emit;e.emit=function(t,i){if("exit"===t){let t=n(i,r);if(t)return o.call(e,"error",t)}return o.apply(e,arguments)}},verifyENOENT:n,verifyENOENTSync:function(e,n){return t&&1===e&&!n.file?r(n.original,"spawnSync"):null},notFoundError:r}},"../../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js"(e,t,r){let n=r("path"),o=r("../../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js"),i=r("../../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js"),a=r("../../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js"),s="win32"===process.platform,l=/\.(?:com|exe)$/i,d=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;e.exports=function(e,t,r){t&&!Array.isArray(t)&&(r=t,t=null);let u={command:e,args:t=t?t.slice(0):[],options:r=Object.assign({},r),file:void 0,original:{command:e,args:t}};return r.shell?u:function(e){let t;if(!s)return e;let r=(e.file=o(e),(t=e.file&&a(e.file))?(e.args.unshift(e.file),e.command=t,o(e)):e.file),u=!l.test(r);if(e.options.forceShell||u){let t=d.test(r);e.command=n.normalize(e.command),e.command=i.command(e.command),e.args=e.args.map(e=>i.argument(e,t));let o=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${o}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}(u)}},"../../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js"(e){let t=/([()\][%!^"`<>&|;, *?])/g;e.exports.command=function(e){return e.replace(t,"^$1")},e.exports.argument=function(e,r){return e=(e=(e=`${e}`).replace(/(?=(\\+?)?)\1"/g,'$1$1\\"')).replace(/(?=(\\+?)?)\1$/,"$1$1"),e=(e=`"${e}"`).replace(t,"^$1"),r&&(e=e.replace(t,"^$1")),e}},"../../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js"(e,t,r){let n=r("fs"),o=r("../../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js");e.exports=function(e){let t,r=Buffer.alloc(150);try{t=n.openSync(e,"r"),n.readSync(t,r,0,150,0),n.closeSync(t)}catch(e){}return o(r.toString())}},"../../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js"(e,t,r){let n=r("path"),o=r("../../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"),i=r("../../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js");function a(e,t){let r,a=e.options.env||process.env,s=process.cwd(),l=null!=e.options.cwd,d=l&&void 0!==process.chdir&&!process.chdir.disabled;if(d)try{process.chdir(e.options.cwd)}catch(e){}try{r=o.sync(e.command,{path:a[i({env:a})],pathExt:t?n.delimiter:void 0})}catch(e){}finally{d&&process.chdir(s)}return r&&(r=n.resolve(l?e.options.cwd:"",r)),r}e.exports=function(e){return a(e)||a(e,!0)}},"../../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(e,t,r){var n;function o(e,t,r){if("function"==typeof t&&(r=t,t={}),!r){if("function"!=typeof Promise)throw TypeError("callback not provided");return new Promise(function(r,n){o(e,t||{},function(e,t){e?n(e):r(t)})})}n(e,t||{},function(e,n){e&&("EACCES"===e.code||t&&t.ignoreErrors)&&(e=null,n=!1),r(e,n)})}r("fs"),n="win32"===process.platform||globalThis.TESTING_WINDOWS?r("../../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"):r("../../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"),e.exports=o,o.sync=function(e,t){try{return n.sync(e,t||{})}catch(e){if(t&&t.ignoreErrors||"EACCES"===e.code)return!1;throw e}}},"../../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(e,t,r){e.exports=o,o.sync=function(e,t){return i(n.statSync(e),t)};var n=r("fs");function o(e,t,r){n.stat(e,function(e,n){r(e,!e&&i(n,t))})}function i(e,t){var r,n,o,i,a,s,l,d,u;return e.isFile()&&(r=e,n=t,o=r.mode,i=r.uid,a=r.gid,s=void 0!==n.uid?n.uid:process.getuid&&process.getuid(),l=void 0!==n.gid?n.gid:process.getgid&&process.getgid(),d=parseInt("100",8),u=parseInt("010",8),o&parseInt("001",8)||o&u&&a===l||o&d&&i===s||o&(d|u)&&0===s)}},"../../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(e,t,r){e.exports=i,i.sync=function(e,t){return o(n.statSync(e),e,t)};var n=r("fs");function o(e,t,r){if(!e.isSymbolicLink()&&!e.isFile())return!1;var n=void 0!==r.pathExt?r.pathExt:process.env.PATHEXT;if(!n||-1!==(n=n.split(";")).indexOf(""))return!0;for(var o=0;o<n.length;o++){var i=n[o].toLowerCase();if(i&&t.substr(-i.length).toLowerCase()===i)return!0}return!1}function i(e,t,r){n.stat(e,function(n,i){r(n,!n&&o(i,e,t))})}},"../../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js"(e){let t=(e={})=>{let t=e.env||process.env;return"win32"!==(e.platform||process.platform)?"PATH":Object.keys(t).reverse().find(e=>"PATH"===e.toUpperCase())||"Path"};e.exports=t,e.exports.default=t},"../../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js"(e,t,r){let n=r("../../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js");e.exports=(e="")=>{let t=e.match(n);if(!t)return null;let[r,o]=t[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return"env"===i?o:o?`${i} ${o}`:i}},"../../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js"(e){e.exports=/^#!(.*)/},"../../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(e,t,r){let n="win32"===process.platform||"cygwin"===process.env.OSTYPE||"msys"===process.env.OSTYPE,o=r("path"),i=n?";":":",a=r("../../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"),s=e=>Object.assign(Error(`not found: ${e}`),{code:"ENOENT"}),l=(e,t)=>{let r=t.colon||i,o=e.match(/\//)||n&&e.match(/\\/)?[""]:[...n?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],a=n?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=n?a.split(r):[""];return n&&-1!==e.indexOf(".")&&""!==s[0]&&s.unshift(""),{pathEnv:o,pathExt:s,pathExtExe:a}},d=(e,t,r)=>{"function"==typeof t&&(r=t,t={}),t||(t={});let{pathEnv:n,pathExt:i,pathExtExe:d}=l(e,t),u=[],c=r=>new Promise((i,a)=>{if(r===n.length)return t.all&&u.length?i(u):a(s(e));let l=n[r],d=/^".*"$/.test(l)?l.slice(1,-1):l,c=o.join(d,e);i(p(!d&&/^\.[\\\/]/.test(e)?e.slice(0,2)+c:c,r,0))}),p=(e,r,n)=>new Promise((o,s)=>{if(n===i.length)return o(c(r+1));let l=i[n];a(e+l,{pathExt:d},(i,a)=>{if(!i&&a)if(!t.all)return o(e+l);else u.push(e+l);return o(p(e,r,n+1))})});return r?c(0).then(e=>r(null,e),r):c(0)};e.exports=d,d.sync=(e,t)=>{let{pathEnv:r,pathExt:n,pathExtExe:i}=l(e,t=t||{}),d=[];for(let s=0;s<r.length;s++){let l=r[s],u=/^".*"$/.test(l)?l.slice(1,-1):l,c=o.join(u,e),p=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+c:c;for(let e=0;e<n.length;e++){let r=p+n[e];try{if(a.sync(r,{pathExt:i}))if(!t.all)return r;else d.push(r)}catch(e){}}}if(t.all&&d.length)return d;if(t.nothrow)return null;throw s(e)}},"../../../node_modules/.pnpm/abort-controller@3.0.0/node_modules/abort-controller/dist/abort-controller.mjs"(e,t,r){r.r(t);var n=r("../../../node_modules/.pnpm/event-target-shim@5.0.1/node_modules/event-target-shim/dist/event-target-shim.mjs");class o extends n.SF{constructor(){throw super(),TypeError("AbortSignal cannot be constructed directly")}get aborted(){let e=i.get(this);if("boolean"!=typeof e)throw TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this===null?"null":typeof this}`);return e}}(0,n.Ui)(o.prototype,"abort");let i=new WeakMap;Object.defineProperties(o.prototype,{aborted:{enumerable:!0}}),"function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(o.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});class a{constructor(){let e;s.set(this,(e=Object.create(o.prototype),n.SF.call(e),i.set(e,!1),e))}get signal(){return l(this)}abort(){var e;e=l(this),!1===i.get(e)&&(i.set(e,!0),e.dispatchEvent({type:"abort"}))}}let s=new WeakMap;function l(e){let t=s.get(e);if(null==t)throw TypeError(`Expected 'this' to be an 'AbortController' object, but got ${null===e?"null":typeof e}`);return t}Object.defineProperties(a.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),"function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(a.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"}),r.d(t,{AbortController:()=>a,AbortSignal:()=>o},{default:a})},"../../../node_modules/.pnpm/event-target-shim@5.0.1/node_modules/event-target-shim/dist/event-target-shim.mjs"(e,t,r){let n=new WeakMap,o=new WeakMap;function i(e){let t=n.get(e);return console.assert(null!=t,"'this' is expected an Event object, but got",e),t}function a(e){if(null!=e.passiveListener){"u">typeof console&&"function"==typeof console.error&&console.error("Unable to preventDefault inside passive event listener invocation.",e.passiveListener);return}e.event.cancelable&&(e.canceled=!0,"function"==typeof e.event.preventDefault&&e.event.preventDefault())}function s(e,t){n.set(this,{eventTarget:e,event:t,eventPhase:2,currentTarget:e,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:t.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let r=Object.keys(t);for(let e=0;e<r.length;++e){let t=r[e];t in this||Object.defineProperty(this,t,l(t))}}function l(e){return{get(){return i(this).event[e]},set(t){i(this).event[e]=t},configurable:!0,enumerable:!0}}function d(e,t){i(e).passiveListener=t}s.prototype={get type(){return i(this).event.type},get target(){return i(this).eventTarget},get currentTarget(){return i(this).currentTarget},composedPath(){let e=i(this).currentTarget;return null==e?[]:[e]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return i(this).eventPhase},stopPropagation(){let e=i(this);e.stopped=!0,"function"==typeof e.event.stopPropagation&&e.event.stopPropagation()},stopImmediatePropagation(){let e=i(this);e.stopped=!0,e.immediateStopped=!0,"function"==typeof e.event.stopImmediatePropagation&&e.event.stopImmediatePropagation()},get bubbles(){return!!i(this).event.bubbles},get cancelable(){return!!i(this).event.cancelable},preventDefault(){a(i(this))},get defaultPrevented(){return i(this).canceled},get composed(){return!!i(this).event.composed},get timeStamp(){return i(this).timeStamp},get srcElement(){return i(this).eventTarget},get cancelBubble(){return i(this).stopped},set cancelBubble(value){if(!value)return;let e=i(this);e.stopped=!0,"boolean"==typeof e.event.cancelBubble&&(e.event.cancelBubble=!0)},get returnValue(){return!i(this).canceled},set returnValue(value){value||a(i(this))},initEvent(){}},Object.defineProperty(s.prototype,"constructor",{value:s,configurable:!0,writable:!0}),"u">typeof window&&void 0!==window.Event&&(Object.setPrototypeOf(s.prototype,window.Event.prototype),o.set(window.Event.prototype,s));let u=new WeakMap;function c(e){return null!==e&&"object"==typeof e}function p(e){let t=u.get(e);if(null==t)throw TypeError("'this' is expected an EventTarget object, but got another value.");return t}function f(e,t){Object.defineProperty(e,`on${t}`,{get(){let e=p(this).get(t);for(;null!=e;){if(3===e.listenerType)return e.listener;e=e.next}return null},set(e){"function"==typeof e||c(e)||(e=null);let r=p(this),n=null,o=r.get(t);for(;null!=o;)3===o.listenerType?null!==n?n.next=o.next:null!==o.next?r.set(t,o.next):r.delete(t):n=o,o=o.next;if(null!==e){let o={listener:e,listenerType:3,passive:!1,once:!1,next:null};null===n?r.set(t,o):n.next=o}},configurable:!0,enumerable:!0})}function h(e){function t(){m.call(this)}t.prototype=Object.create(m.prototype,{constructor:{value:t,configurable:!0,writable:!0}});for(let r=0;r<e.length;++r)f(t.prototype,e[r]);return t}function m(){if(this instanceof m)return void u.set(this,new Map);if(1==arguments.length&&Array.isArray(arguments[0]))return h(arguments[0]);if(arguments.length>0){let e=Array(arguments.length);for(let t=0;t<arguments.length;++t)e[t]=arguments[t];return h(e)}throw TypeError("Cannot call a class as a function")}m.prototype={addEventListener(e,t,r){if(null==t)return;if("function"!=typeof t&&!c(t))throw TypeError("'listener' should be a function or an object.");let n=p(this),o=c(r),i=(o?r.capture:r)?1:2,a={listener:t,listenerType:i,passive:o&&!!r.passive,once:o&&!!r.once,next:null},s=n.get(e);if(void 0===s)return void n.set(e,a);let l=null;for(;null!=s;){if(s.listener===t&&s.listenerType===i)return;l=s,s=s.next}l.next=a},removeEventListener(e,t,r){if(null==t)return;let n=p(this),o=(c(r)?r.capture:r)?1:2,i=null,a=n.get(e);for(;null!=a;){if(a.listener===t&&a.listenerType===o)return void(null!==i?i.next=a.next:null!==a.next?n.set(e,a.next):n.delete(e));i=a,a=a.next}},dispatchEvent(e){if(null==e||"string"!=typeof e.type)throw TypeError('"event.type" should be a string.');let t=p(this),r=e.type,n=t.get(r);if(null==n)return!0;let a=new(function e(t){if(null==t||t===Object.prototype)return s;let r=o.get(t);return null==r&&(r=function(e,t){let r=Object.keys(t);if(0===r.length)return e;function n(t,r){e.call(this,t,r)}n.prototype=Object.create(e.prototype,{constructor:{value:n,configurable:!0,writable:!0}});for(let o=0;o<r.length;++o){let a=r[o];if(!(a in e.prototype)){let e="function"==typeof Object.getOwnPropertyDescriptor(t,a).value;Object.defineProperty(n.prototype,a,e?function(e){return{value(){let t=i(this).event;return t[e].apply(t,arguments)},configurable:!0,enumerable:!0}}(a):l(a))}}return n}(e(Object.getPrototypeOf(t)),t),o.set(t,r)),r}(Object.getPrototypeOf(e)))(this,e),u=null;for(;null!=n;){if(n.once?null!==u?u.next=n.next:null!==n.next?t.set(r,n.next):t.delete(r):u=n,d(a,n.passive?n.listener:null),"function"==typeof n.listener)try{n.listener.call(this,a)}catch(e){"u">typeof console&&"function"==typeof console.error&&console.error(e)}else 3!==n.listenerType&&"function"==typeof n.listener.handleEvent&&n.listener.handleEvent(a);if(i(a).immediateStopped)break;n=n.next}return d(a,null),i(a).eventPhase=0,i(a).currentTarget=null,!a.defaultPrevented}},Object.defineProperty(m.prototype,"constructor",{value:m,configurable:!0,writable:!0}),"u">typeof window&&void 0!==window.EventTarget&&Object.setPrototypeOf(m.prototype,window.EventTarget.prototype),r.d(t,{SF:()=>m,Ui:()=>f})},"../../../node_modules/.pnpm/@dp+tea-sdk-node@3.0.12/node_modules/@dp/tea-sdk-node/package.json"(e){e.exports={version:"3.0.12"}}});let g=l("node:crypto"),b=l("node:fs"),y=l("node:os"),w=l("node:path");function v(e){try{return(0,b.readFileSync)(e,"utf8").trim()||void 0}catch{return}}let S=l("../../../node_modules/.pnpm/@dp+tea-sdk-node@3.0.12/node_modules/@dp/tea-sdk-node/lib/index.js"),O=l("../../../node_modules/.pnpm/@logsdk+node-plugin-http@4.0.8_patch_hash=d36ee5d841feee100de58867bba710d3ebdd5840c85f8_2a73615d04585e58fdd40bf5c6ccd254/node_modules/@logsdk/node-plugin-http/lib/index.js");class T{constructor(e=function(e=w.join((0,y.homedir)(),".doubao-apps")){let t=w.join(e,"monitor-user-id"),r=v(t);if(r)return r;let n=(0,g.randomUUID)();try{return(0,b.mkdirSync)(e,{recursive:!0,mode:448}),(0,b.writeFileSync)(t,`${n}
|
|
7
|
-
`,{encoding:"utf8",flag:"wx",mode:384}),n}catch{return v(t)??"anonymous-unpersisted"}}()){this.pendingCount=0,this.sdk=new S.TeaSDK({app_id:944787,logLevel:"silent"}),this.controller=(0,O.httpPlugin)({channel:"cn",retry:2,timeout:2e3}),this.controller.on("end",({hasSucceed:e})=>{this.pendingCount=Math.max(0,this.pendingCount-1),this.sdk.logger.trace("Tea event upload completed, hasSucceed: %s",e),e||this.sdk.logger.warn("Tea event upload did not succeed")}),this.controller.on("submit-error",({message:e})=>{this.sdk.logger.warn("Tea event upload failed: %s",e??"unknown network error")}),this.controller.on("submit-timeout",()=>{this.sdk.logger.warn("Tea event upload timed out after %d ms",2e3)}),this.sdk.use(this.controller),this.sdk.config({user:{user_unique_id:e}})}async upload(e){this.pendingCount+=1;try{this.sdk.collect(e.name,e.params)}catch(e){throw this.pendingCount-=1,e}}async flush(e){0!==this.pendingCount&&await new Promise(t=>{let r=()=>{clearTimeout(n),this.controller.off("drain",r),t()},n=setTimeout(r,e);this.controller.once("drain",r)})}}let x=globalThis.window?.document!==void 0;globalThis.process?.versions?.node,globalThis.process?.versions?.bun,globalThis.Deno?.version?.deno,globalThis.process?.versions?.electron,globalThis.navigator?.userAgent?.includes("jsdom");let j=globalThis.navigator?.userAgentData?.platform;function E(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}"macOS"===j||globalThis.navigator?.platform==="MacIntel"||globalThis.navigator?.userAgent?.includes(" Mac ")===!0||globalThis.process?.platform,"Windows"===j||globalThis.navigator?.platform==="Win32"||globalThis.process?.platform,"Linux"===j||globalThis.navigator?.platform?.startsWith("Linux")===!0||globalThis.navigator?.userAgent?.includes(" Linux ")===!0||globalThis.process?.platform,"iOS"===j||globalThis.navigator?.platform==="MacIntel"&&globalThis.navigator?.maxTouchPoints>1||/iPad|iPhone|iPod/.test(globalThis.navigator?.platform),"Android"===j||globalThis.navigator?.platform==="Android"||globalThis.navigator?.userAgent?.includes(" Android ")===!0||globalThis.process?.platform;let _=l("node:url"),$=(e,t)=>{let r=A(D(e));if("string"!=typeof r)throw TypeError(`${t} must be a string or a file URL: ${r}.`);return r},D=e=>P(e)?e.toString():e,P=e=>"string"!=typeof e&&e&&Object.getPrototypeOf(e)===String.prototype,A=e=>e instanceof URL?(0,_.fileURLToPath)(e):e,M=(e,t=[],r={})=>{let n=$(e,"First argument"),[o,i]=E(t)?[[],t]:[t,r];if(!Array.isArray(o))throw TypeError(`Second argument must be either an array of arguments or an options object: ${o}`);if(o.some(e=>"object"==typeof e&&null!==e))throw TypeError(`Second argument must be an array of strings: ${o}`);let a=o.map(String),s=a.find(e=>e.includes("\0"));if(void 0!==s)throw TypeError(`Arguments cannot contain null bytes ("\\0"): ${s}`);if(!E(i))throw TypeError(`Last argument must be an options object: ${i}`);return[n,a,i]},k=l("node:string_decoder"),{toString:R}=Object.prototype,C=e=>"[object Uint8Array]"===R.call(e),L=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),B=new TextEncoder,U=new TextDecoder,I=e=>1===e.length&&C(e[0])?e[0]:F(N(e)),N=e=>e.map(e=>"string"==typeof e?B.encode(e):e),F=e=>{let t=new Uint8Array(W(e)),r=0;for(let n of e)t.set(n,r),r+=n.length;return t},W=e=>{let t=0;for(let r of e)t+=r.length;return t},G=({templates:e,expressions:t,tokens:r,index:n,template:o})=>{if(void 0===o)throw TypeError(`Invalid backslash sequence: ${e.raw[n]}`);let{nextTokens:i,leadingWhitespaces:a,trailingWhitespaces:s}=H(o,e.raw[n]),l=z(r,i,a);if(n===t.length)return l;let d=t[n];return z(l,Array.isArray(d)?d.map(e=>K(e)):[K(d)],s)},H=(e,t)=>{if(0===t.length)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,o=V.has(t[0]);for(let o=0,i=0;o<e.length;o+=1,i+=1){let a=t[i];if(V.has(a))n!==o&&r.push(e.slice(n,o)),n=o+1;else if("\\"===a){let e=t[i+1];"\n"===e?(o-=1,i+=1):"u"===e&&"{"===t[i+2]?i=t.indexOf("}",i+3):i+=q[e]??1}}let i=n===e.length;return i||r.push(e.slice(n)),{nextTokens:r,leadingWhitespaces:o,trailingWhitespaces:i}},V=new Set([" "," ","\r","\n"]),q={x:3,u:5},z=(e,t,r)=>r||0===e.length||0===t.length?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t[0]}`,...t.slice(1)],K=e=>{let t=typeof e;if("string"===t)return e;if("number"===t)return String(e);if(E(e)&&("stdout"in e||"isMaxBuffer"in e))return X(e);if(e instanceof c.ChildProcess||"[object Promise]"===Object.prototype.toString.call(e))throw TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}.");throw TypeError(`Unexpected "${t}" in template expression`)},X=({stdout:e})=>{if("string"==typeof e)return e;if(C(e))return U.decode(e);if(void 0===e)throw TypeError('Missing result.stdout in template expression. This is probably due to the previous subprocess\' "stdout" option.');throw TypeError(`Unexpected "${typeof e}" stdout in template expression`)},J=e=>Y.includes(e),Y=[u.stdin,u.stdout,u.stderr],Q=["stdin","stdout","stderr"],Z=e=>Q[e]??`stdio[${e}]`,ee=l("node:util"),et=(e,t)=>{let r=Array.from({length:er(e)+1});return eu(en(e[t],r,t),t)},er=({stdio:e})=>Array.isArray(e)?Math.max(e.length,Q.length):Q.length,en=(e,t,r)=>E(e)?eo(e,t,r):t.fill(e),eo=(e,t,r)=>{for(let n of Object.keys(e).sort(ei))for(let o of es(n,r,t))t[o]=e[n];return t},ei=(e,t)=>ea(e)<ea(t)?1:-1,ea=e=>"stdout"===e||"stderr"===e?0:"all"===e?2:1,es=(e,t,r)=>{if("ipc"===e)return[r.length-1];let n=el(e);if(void 0===n||0===n)throw TypeError(`"${t}.${e}" is invalid.
|
|
8
|
-
It must be "${t}.stdout", "${t}.stderr", "${t}.all", "${t}.ipc", or "${t}.fd3", "${t}.fd4" (and so on).`);if(n>=r.length)throw TypeError(`"${t}.${e}" is invalid: that file descriptor does not exist.
|
|
9
|
-
Please set the "stdio" option to ensure that file descriptor exists.`);return"all"===n?[1,2]:[n]},el=e=>{if("all"===e)return e;if(Q.includes(e))return Q.indexOf(e);let t=ed.exec(e);if(null!==t)return Number(t[1])},ed=/^fd(\d+)$/,eu=(e,t)=>e.map(e=>void 0===e?ec[t]:e),ec={lines:!1,buffer:!0,maxBuffer:1e8,verbose:(0,ee.debuglog)("execa").enabled?"full":"none",stripFinalNewline:!0},ep=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],ef=(e,t)=>"ipc"===t?e.at(-1):e[t],eh=({verbose:e},t)=>!["none","short"].includes(em(e,t)),em=(e,t)=>void 0===t?eg(e):ef(e,t),eg=e=>e.find(e=>eb(e))??ey.findLast(t=>e.includes(t)),eb=e=>"function"==typeof e,ey=["none","short","full"],ew=e=>(0,ee.stripVTControlCharacters)(e).split("\n").map(e=>ev(e)).join("\n"),ev=e=>e.replaceAll(eO,e=>eS(e)),eS=e=>{let t=eT[e];if(void 0!==t)return t;let r=e.codePointAt(0),n=r.toString(16);return r<=ex?`\\u${n.padStart(4,"0")}`:`\\U${n}`},eO=(()=>{try{return RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}})(),eT={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},ex=65535,ej=/^[\w./-]+$/;function eE(){let{env:e}=u,{TERM:t,TERM_PROGRAM:r}=e;return"win32"!==u.platform?"linux"!==t:!!e.WT_SESSION||!!e.TERMINUS_SUBLIME||"{cmd::Cmder}"===e.ConEmuTask||"Terminus-Sublime"===r||"vscode"===r||"xterm-256color"===t||"alacritty"===t||"rxvt-unicode"===t||"rxvt-unicode-256color"===t||"JetBrains-JediTerm"===e.TERMINAL_EMULATOR}let e_={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:"\xbd",oneThird:"⅓",oneQuarter:"\xbc",oneFifth:"⅕",oneSixth:"⅙",oneEighth:"⅛",twoThirds:"⅔",twoFifths:"⅖",threeQuarters:"\xbe",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:"╱"},e$={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:"⅒"},eD={...e_,...e$},eP={...e_,tick:"√",info:"i",warning:"‼",cross:"\xd7",squareSmall:"□",squareSmallFilled:"■",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(○)",circleCross:"(\xd7)",circlePipe:"(│)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xd7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xd7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"∆",triangleLeft:"◄",triangleRight:"►",lozenge:"♦",lozengeOutline:"◊",hamburger:"≡",smiley:"☺",mustache:"┌─┐",star:"✶",play:"►",nodejs:"♦",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},eA=eE()?eD:eP;Object.entries(e$);let eM=d?.WriteStream?.prototype?.hasColors?.()??!1,ek=(e,t)=>{if(!eM)return e=>e;let r=`\u001B[${e}m`,n=`\u001B[${t}m`;return e=>{let o=e+"",i=o.indexOf(n);if(-1===i)return r+o+n;let a=r,s=0,l=(22===t?n:"")+r;for(;-1!==i;)a+=o.slice(s,i)+l,s=i+n.length,i=o.indexOf(n,s);return a+(o.slice(s)+n)}};ek(0,0);let eR=ek(1,22);ek(2,22),ek(3,23),ek(4,24),ek(53,55),ek(7,27),ek(8,28),ek(9,29),ek(30,39),ek(31,39),ek(32,39),ek(33,39),ek(34,39),ek(35,39),ek(36,39),ek(37,39);let eC=ek(90,39);ek(40,49),ek(41,49),ek(42,49),ek(43,49),ek(44,49),ek(45,49),ek(46,49),ek(47,49),ek(100,49);let eL=ek(91,39);ek(92,39);let eB=ek(93,39);ek(94,39),ek(95,39),ek(96,39),ek(97,39),ek(101,49),ek(102,49),ek(103,49),ek(104,49),ek(105,49),ek(106,49),ek(107,49);let eU=(e,t)=>String(e).padStart(t,"0"),eI=({failed:e,reject:t})=>e?t?eA.cross:eA.warning:eA.tick,eN={command:({piped:e})=>e?"|":"$",output:()=>" ",ipc:()=>"*",error:eI,duration:eI},eF=e=>e,eW={command:()=>eR,output:()=>eF,ipc:()=>eF,error:({reject:e})=>e?eL:eB,duration:()=>eC},eG=({type:e,verboseMessage:t,fdNumber:r,verboseInfo:n,result:o})=>{var i;let a,s=(i=eV(t,eH({type:e,result:o,verboseInfo:n})),a=(({verbose:e},t)=>{let r=em(e,t);return eb(r)?r:void 0})(n,r),i.map(({verboseLine:e,verboseObject:t})=>((e,t,r)=>{if(void 0===r)return e;let n=r(e,t);if("string"==typeof n)return n})(e,t,a)).filter(e=>void 0!==e).map(e=>{let t;return(t=e).endsWith("\n")?t:`${t}
|
|
10
|
-
`}).join(""));""!==s&&console.warn(s.slice(0,-1))},eH=({type:e,result:t,verboseInfo:{escapedCommand:r,commandId:n,rawOptions:{piped:o=!1,...i}}})=>({type:e,escapedCommand:r,commandId:`${n}`,timestamp:new Date,piped:o,result:t,options:i}),eV=(e,t)=>e.split("\n").map(e=>eq({...t,message:e})),eq=e=>({verboseLine:(({type:e,message:t,timestamp:r,piped:n,commandId:o,result:{failed:i=!1}={},options:{reject:a=!0}})=>{let s,l=(s=r,`${eU(s.getHours(),2)}:${eU(s.getMinutes(),2)}:${eU(s.getSeconds(),2)}.${eU(s.getMilliseconds(),3)}`),d=eN[e]({failed:i,reject:a,piped:n}),u=eW[e]({reject:a});return`${eC(`[${l}]`)} ${eC(`[${o}]`)} ${u(d)} ${u(t)}`})(e),verboseObject:e}),ez=e=>ew("string"==typeof e?e:(0,ee.inspect)(e)).replaceAll(" "," ".repeat(eK)),eK=2,eX=0n,eJ=e=>Number(u.hrtime.bigint()-e)/1e6,eY=(e,t,r)=>{var n,o;let i,a,s=u.hrtime.bigint(),{command:l,escapedCommand:d}={command:(i=[e,...t]).join(" "),escapedCommand:i.map(e=>{let t;return ej.test(t=ev(e))?t:"win32"===u.platform?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`}).join(" ")},c=(n=et(r,"verbose"),o={...r},(e=>{for(let t of e){if(!1===t)throw TypeError('The "verbose: false" option was renamed to "verbose: \'none\'".');if(!0===t)throw TypeError('The "verbose: true" option was renamed to "verbose: \'short\'".');if(!ey.includes(t)&&!eb(t)){let e=ey.map(e=>`'${e}'`).join(", ");throw TypeError(`The "verbose" option must not be ${t}. Allowed values are: ${e} or a function.`)}}})(n),a=(({verbose:e})=>"none"!==em(e,void 0))({verbose:n})?eX++:void 0,{verbose:n,escapedCommand:d,commandId:a,rawOptions:o});return(({verbose:e})=>"none"!==em(e,void 0))(c)&&eG({type:"command",verboseMessage:d,verboseInfo:c}),{command:l,escapedCommand:d,startTime:s,verboseInfo:c}};function eQ(e={}){let{env:t=process.env,platform:r=process.platform}=e;return"win32"!==r?"PATH":Object.keys(t).reverse().find(e=>"PATH"===e.toUpperCase())||"Path"}function eZ(e){return e instanceof URL?(0,_.fileURLToPath)(e):e}(0,ee.promisify)(c.execFile);let e0=({env:e=u.env,...t}={})=>{let r=eQ({env:e={...e}});return t.path=e[r],e[r]=(({cwd:e=u.cwd(),path:t=u.env[eQ()],preferLocal:r=!0,execPath:n=u.execPath,addExecPath:o=!0}={})=>{var i,a,s,l;let d,c=w.resolve(eZ(e)),p=[],f=t.split(w.delimiter);return r&&((e,t,r)=>{for(let n of{*[Symbol.iterator](){let e,t=w.resolve(eZ(r));for(;e!==t;)yield t,e=t,t=w.resolve(t,"..")}}){let r=w.join(n,"node_modules/.bin");t.includes(r)||e.push(r)}})(p,f,c),o&&(i=p,a=f,s=n,l=c,d=w.resolve(l,eZ(s),".."),a.includes(d)||i.push(d)),""===t||t===w.delimiter?`${p.join(w.delimiter)}${t}`:[...p,t].join(w.delimiter)})(t),e};class e1 extends Error{}let e3=(e,t)=>{Object.defineProperty(e.prototype,"name",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,e2,{value:!0,writable:!1,enumerable:!1,configurable:!1})},e2=Symbol("isExecaError"),e8=e=>"[object Error]"===Object.prototype.toString.call(e);class e5 extends Error{}e3(e5,e5.name);class e4 extends Error{}e3(e4,e4.name);let e6=[{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"}],e9=(e,t)=>({name:`SIGRT${t+1}`,number:e7+t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),e7=34,te=()=>[...e6,...Array.from({length:64-e7+1},e9)].map(tt),tt=({name:e,number:t,description:r,action:n,forced:o=!1,standard:i})=>{let{signals:{[e]:a}}=y.constants,s=void 0!==a;return{name:e,number:s?a:t,description:r,supported:s,action:n,forced:o,standard:i}},tr=Object.fromEntries(te().map(({name:e,number:t,description:r,supported:n,action:o,forced:i,standard:a})=>[e,{name:e,number:t,description:r,supported:n,action:o,forced:i,standard:a}])),tn=(e,t)=>{let r=t.find(({name:t})=>y.constants.signals[t]===e);return void 0!==r?r:t.find(t=>t.number===e)};a=te(),Object.assign({},...Array.from({length:65},(e,t)=>((e,t)=>{let r=tn(e,t);if(void 0===r)return{};let{name:n,description:o,supported:i,action:a,forced:s,standard:l}=r;return{[e]:{name:n,number:e,description:o,supported:i,action:a,forced:s,standard:l}}})(t,a)));let to=(e,t)=>{if(Number.isInteger(e))return ti(e,t);if("string"==typeof e)return ts(e,t);throw TypeError(`Invalid ${t} ${String(e)}: it must be a string or an integer.
|
|
11
|
-
${tl()}`)},ti=(e,t)=>{if(ta.has(e))return ta.get(e);throw TypeError(`Invalid ${t} ${e}: this signal integer does not exist.
|
|
12
|
-
${tl()}`)},ta=new Map(Object.entries(y.constants.signals).reverse().map(([e,t])=>[t,e])),ts=(e,t)=>{if(e in y.constants.signals)return e;if(e.toUpperCase()in y.constants.signals)throw TypeError(`Invalid ${t} '${e}': please rename it to '${e.toUpperCase()}'.`);throw TypeError(`Invalid ${t} '${e}': this signal name does not exist.
|
|
13
|
-
${tl()}`)},tl=()=>`Available signal names: ${td()}.
|
|
14
|
-
Available signal numbers: ${tu()}.`,td=()=>Object.keys(y.constants.signals).sort().map(e=>`'${e}'`).join(", "),tu=()=>[...new Set(Object.values(y.constants.signals).sort((e,t)=>e-t))].join(", "),tc=e=>tr[e].description,tp=({kill:e,options:{forceKillAfterDelay:t,killSignal:r},onInternalError:n,context:o,controller:i},a,s)=>{let{signal:l,error:d}=tf(a,s,r);th(d,n);let u=e(l);return tm({kill:e,signal:l,forceKillAfterDelay:t,killSignal:r,killResult:u,context:o,controller:i}),u},tf=(e,t,r)=>{let[n=r,o]=e8(e)?[void 0,e]:[e,t];if("string"!=typeof n&&!Number.isInteger(n))throw TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(n)}`);if(void 0!==o&&!e8(o))throw TypeError(`The second argument is optional. If specified, it must be an error instance: ${o}`);return{signal:0===n?n:to(n,"`subprocess.kill()`'s argument"),error:o}},th=(e,t)=>{void 0!==e&&t.reject(e)},tm=async({kill:e,signal:t,forceKillAfterDelay:r,killSignal:n,killResult:o,context:i,controller:a})=>{t===n&&o&&tg({kill:e,forceKillAfterDelay:r,context:i,controllerSignal:a.signal})},tg=async({kill:e,forceKillAfterDelay:t,context:r,controllerSignal:n})=>{if(!1!==t)try{await (0,p.setTimeout)(t,void 0,{signal:n}),e("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}},tb=l("node:events"),ty=async(e,t)=>{e.aborted||await (0,tb.once)(e,"abort",{signal:t})},tw=async(e,t,r,{signal:n})=>{throw await ty(t,n),r.terminationReason??="cancel",e.kill(),t.reason},tv=({methodName:e,isSubprocess:t,ipc:r,isConnected:n})=>{tS(e,t,r),tO(e,t,n)},tS=(e,t,r)=>{if(!r)throw Error(`${tE(e,t)} can only be used if the \`ipc\` option is \`true\`.`)},tO=(e,t,r)=>{if(!r)throw Error(`${tE(e,t)} cannot be used: the ${t$(t)} has already exited or disconnected.`)},tT=(e,t)=>Error(`${tE("sendMessage",t)} failed when sending an acknowledgment response to the ${t$(t)}.`,{cause:e}),tx=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),tj=["could not be cloned","circular structure","call stack size exceeded"],tE=(e,t,r="")=>"cancelSignal"===e?"`cancelSignal`'s `controller.abort()`":`${t_(t)}${e}(${r})`,t_=e=>e?"":"subprocess.",t$=e=>e?"parent process":"subprocess",tD=e=>{e.connected&&e.disconnect()},tP=()=>{let e={};return Object.assign(new Promise((t,r)=>{Object.assign(e,{resolve:t,reject:r})}),e)},tA=(e,t="stdin")=>{let{options:r,fileDescriptors:n}=tk.get(e),o=tR(n,t,!0),i=e.stdio[o];if(null===i)throw TypeError(tB(o,t,r,!0));return i},tM=(e,t="stdout")=>{let{options:r,fileDescriptors:n}=tk.get(e),o=tR(n,t,!1),i="all"===o?e.all:e.stdio[o];if(null==i)throw TypeError(tB(o,t,r,!1));return i},tk=new WeakMap,tR=(e,t,r)=>{let n=tC(t,r);return tL(n,t,r,e),n},tC=(e,t)=>{let r=el(e);if(void 0!==r)return r;let{validOptions:n,defaultValue:o}=t?{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw TypeError(`"${tN(t)}" must not be "${e}".
|
|
15
|
-
It must be ${n} or "fd3", "fd4" (and so on).
|
|
16
|
-
It is optional and defaults to "${o}".`)},tL=(e,t,r,n)=>{let o=n[tI(e)];if(void 0===o)throw TypeError(`"${tN(r)}" must not be ${t}. That file descriptor does not exist.
|
|
17
|
-
Please set the "stdio" option to ensure that file descriptor exists.`);if("input"===o.direction&&!r)throw TypeError(`"${tN(r)}" must not be ${t}. It must be a readable stream, not writable.`);if("input"!==o.direction&&r)throw TypeError(`"${tN(r)}" must not be ${t}. It must be a writable stream, not readable.`)},tB=(e,t,r,n)=>{if("all"===e&&!r.all)return'The "all" option must be true to use "from: \'all\'".';let{optionName:o,optionValue:i}=tU(e,r);return`The "${o}: ${tF(i)}" option is incompatible with using "${tN(n)}: ${tF(t)}".
|
|
18
|
-
Please set this option with "pipe" instead.`},tU=(e,{stdin:t,stdout:r,stderr:n,stdio:o})=>{let i=tI(e);return 0===i&&void 0!==t?{optionName:"stdin",optionValue:t}:1===i&&void 0!==r?{optionName:"stdout",optionValue:r}:2===i&&void 0!==n?{optionName:"stderr",optionValue:n}:{optionName:`stdio[${i}]`,optionValue:o[i]}},tI=e=>"all"===e?1:e,tN=e=>e?"to":"from",tF=e=>"string"==typeof e?`'${e}'`:"number"==typeof e?`${e}`:"Stream",tW=(e,t,r)=>{let n=e.getMaxListeners();0!==n&&n!==1/0&&(e.setMaxListeners(n+t),(0,tb.addAbortListener)(r,()=>{e.setMaxListeners(e.getMaxListeners()-t)}))},tG=(e,t)=>{t&&tH(e)},tH=e=>{e.refCounted()},tV=(e,t)=>{t&&tq(e)},tq=e=>{e.unrefCounted()},tz=async({anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:n},o)=>{if(t2(o)||rc(o))return;tX.has(e)||tX.set(e,[]);let i=tX.get(e);if(i.push(o),!(i.length>1))for(;i.length>0;){await t7(e,n,o),await p.scheduler.yield();let a=await t3({wrappedMessage:i[0],anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:n});i.shift(),n.emit("message",a),n.emit("message:done")}},tK=async({anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:n,boundOnMessage:o})=>{rf();let i=tX.get(e);for(;i?.length>0;)await (0,tb.once)(n,"message:done");e.removeListener("message",o),r&&(tH(t),tH(t)),n.connected=!1,n.emit("disconnect")},tX=new WeakMap,tJ=(e,t,r)=>{if(tY.has(e))return tY.get(e);let n=new tb.EventEmitter;return n.connected=!0,tY.set(e,n),tQ({ipcEmitter:n,anyProcess:e,channel:t,isSubprocess:r}),n},tY=new WeakMap,tQ=({ipcEmitter:e,anyProcess:t,channel:r,isSubprocess:n})=>{let o=tz.bind(void 0,{anyProcess:t,channel:r,isSubprocess:n,ipcEmitter:e});t.on("message",o),t.once("disconnect",tK.bind(void 0,{anyProcess:t,channel:r,isSubprocess:n,ipcEmitter:e,boundOnMessage:o})),n&&(tq(r),tq(r))},tZ=e=>{let t=tY.get(e);return void 0===t?null!==e.channel:t.connected},t0=0n,t1=(e,t)=>{if(t?.type===t6&&!t.hasListeners)for(let{id:t}of e)void 0!==t&&t5[t].resolve({isDeadlock:!0,hasListeners:!1})},t3=async({wrappedMessage:e,anyProcess:t,channel:r,isSubprocess:n,ipcEmitter:o})=>{if(e?.type!==t6||!t.connected)return e;let{id:i,message:a}=e,s={id:i,type:t9,message:rt(t,o)};try{await rn({anyProcess:t,channel:r,isSubprocess:n,ipc:!0},s)}catch(e){o.emit("strict:error",e)}return a},t2=e=>{if(e?.type!==t9)return!1;let{id:t,message:r}=e;return t5[t]?.resolve({isDeadlock:!1,hasListeners:r}),!0},t8=async(e,t,r)=>{if(e?.type!==t6)return;let n=tP();t5[e.id]=n;let o=new AbortController;try{let{isDeadlock:e,hasListeners:i}=await Promise.race([n,t4(t,r,o)]);e&&(e=>{throw Error(`${tE("sendMessage",e)} failed: the ${t$(e)} is sending a message too, instead of listening to incoming messages.
|
|
19
|
-
This can be fixed by both sending a message and listening to incoming messages at the same time:
|
|
20
|
-
|
|
21
|
-
const [receivedMessage] = await Promise.all([
|
|
22
|
-
${tE("getOneMessage",e)},
|
|
23
|
-
${tE("sendMessage",e,"message, {strict: true}")},
|
|
24
|
-
]);`)})(r),i||(e=>{throw Error(`${tE("sendMessage",e)} failed: the ${t$(e)} is not listening to incoming messages.`)})(r)}finally{o.abort(),delete t5[e.id]}},t5={},t4=async(e,t,{signal:r})=>{tW(e,1,r),await (0,tb.once)(e,"disconnect",{signal:r});throw Error(`${tE("sendMessage",t)} failed: the ${t$(t)} exited without listening to incoming messages.`)},t6="execa:ipc:request",t9="execa:ipc:response",t7=async(e,t,r)=>{for(;!rt(e,t)&&re.get(e)?.size>0;){let t=[...re.get(e)];t1(t,r),await Promise.all(t.map(({onMessageSent:e})=>e))}},re=new WeakMap,rt=(e,t)=>t.listenerCount("message")>rr(e),rr=e=>tk.has(e)&&!ef(tk.get(e).options.buffer,"ipc")?1:0,rn=({anyProcess:e,channel:t,isSubprocess:r,ipc:n},o,{strict:i=!1}={})=>{let a="sendMessage";return tv({methodName:a,isSubprocess:r,ipc:n,isConnected:e.connected}),ro({anyProcess:e,channel:t,methodName:a,isSubprocess:r,message:o,strict:i})},ro=async({anyProcess:e,channel:t,methodName:r,isSubprocess:n,message:o,strict:i})=>{let a,s,l=(({anyProcess:e,channel:t,isSubprocess:r,message:n,strict:o})=>{if(!o)return n;let i=tJ(e,t,r),a=rt(e,i);return{id:t0++,type:t6,message:n,hasListeners:a}})({anyProcess:e,channel:t,isSubprocess:n,message:o,strict:i}),d=(re.has(e)||re.set(e,new Set),a=re.get(e),s={onMessageSent:tP(),id:i?l.id:void 0},a.add(s),{outgoingMessages:a,outgoingMessage:s});try{await ri({anyProcess:e,methodName:r,isSubprocess:n,wrappedMessage:l,message:o})}catch(t){throw tD(e),t}finally{(({outgoingMessages:e,outgoingMessage:t})=>{e.delete(t),t.onMessageSent.resolve()})(d)}},ri=async({anyProcess:e,methodName:t,isSubprocess:r,wrappedMessage:n,message:o})=>{let i=ra(e);try{await Promise.all([t8(n,e,r),i(n)])}catch(e){throw(({error:e,methodName:t,isSubprocess:r})=>{if("EPIPE"===e.code)throw Error(`${tE(t,r)} cannot be used: the ${t$(r)} is disconnecting.`,{cause:e})})({error:e,methodName:t,isSubprocess:r}),(({error:e,methodName:t,isSubprocess:r,message:n})=>{if((({code:e,message:t})=>tx.has(e)||tj.some(e=>t.includes(e)))(e))throw Error(`${tE(t,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:e})})({error:e,methodName:t,isSubprocess:r,message:o}),e}},ra=e=>{if(rs.has(e))return rs.get(e);let t=(0,ee.promisify)(e.send.bind(e));return rs.set(e,t),t},rs=new WeakMap,rl=async({anyProcess:e,channel:t,isSubprocess:r,ipc:n})=>(await rd({anyProcess:e,channel:t,isSubprocess:r,ipc:n}),rh.signal),rd=async({anyProcess:e,channel:t,isSubprocess:r,ipc:n})=>{if(!ru){if(ru=!0,!n)return void(()=>{throw Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")})();if(null===t)return void rf();tJ(e,t,r),await p.scheduler.yield()}},ru=!1,rc=e=>e?.type===rp&&(rh.abort(e.message),!0),rp="execa:ipc:cancel",rf=()=>{rh.abort(Error(`\`cancelSignal\` aborted: the ${t$(!0)} disconnected.`))},rh=new AbortController,rm=async({subprocess:e,cancelSignal:t,forceKillAfterDelay:r,context:n,controller:{signal:o}})=>{let i;await ty(t,o);let a=rg(t);throw await (tO(i="cancelSignal",!1,e.connected),ri({anyProcess:e,methodName:i,isSubprocess:!1,wrappedMessage:{type:rp,message:a},message:a})),tg({kill:e.kill,forceKillAfterDelay:r,context:n,controllerSignal:o}),n.terminationReason??="gracefulCancel",t.reason},rg=({reason:e})=>{if(!(e instanceof DOMException))return e;let t=Error(e.message);return Object.defineProperty(t,"stack",{value:e.stack,enumerable:!1,configurable:!0,writable:!0}),t},rb=async(e,t,r,{signal:n})=>{throw await (0,p.setTimeout)(t,void 0,{signal:n}),r.terminationReason??="timeout",e.kill(),new e1},ry={advanced:e=>{try{(0,h.serialize)(e)}catch(e){throw Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},json:e=>{try{JSON.stringify(e)}catch(e){throw Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}}},rw=async(e,t)=>{void 0!==t&&await e.sendMessage(t)},rv=new Set(["utf8","utf16le"]),rS=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),rO=new Set([...rv,...rS]),rT={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},rx=e=>"string"==typeof e?`"${e}"`:String(e),rj=()=>{try{return u.cwd()}catch(e){throw e.message=`The current directory does not exist.
|
|
25
|
-
${e.message}`,e}},rE=l("../../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js"),r_=(e,t,r)=>{r.cwd=((e=rj())=>{let t=$(e,'The "cwd" option');return w.resolve(t)})(r.cwd);let[n,o,i]=((e,t,{node:r=!1,nodePath:n=u.execPath,nodeOptions:o=u.execArgv.filter(e=>!e.startsWith("--inspect")),cwd:i,execPath:a,...s})=>{if(void 0!==a)throw TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');let l=$(n,'The "nodePath" option'),d=w.resolve(i,l),c={...s,nodePath:d,node:r,cwd:i};if(!r)return[e,t,c];if("node"===w.basename(e,".exe"))throw TypeError('When the "node" option is true, the first argument does not need to be "node".');return[d,[...o,e,...t],{ipc:!0,...c,shell:!1}]})(e,t,r),{command:a,args:s,options:l}=rE._parse(n,o,i),d=r$((e=>{let t={...e};for(let r of ep)t[r]=et(e,r);return t})(l));return(({timeout:e})=>{if(void 0!==e&&(!Number.isFinite(e)||e<0))throw TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`)})(d),(({encoding:e})=>{if(rO.has(e))return;let t=(e=>{if(null===e)return"buffer";if("string"!=typeof e)return;let t=e.toLowerCase();return t in rT?rT[t]:rO.has(t)?t:void 0})(e);if(void 0!==t)throw TypeError(`Invalid option \`encoding: ${rx(e)}\`.
|
|
26
|
-
Please rename it to ${rx(t)}.`);let r=[...rO].map(e=>rx(e)).join(", ");throw TypeError(`Invalid option \`encoding: ${rx(e)}\`.
|
|
27
|
-
Please rename it to one of: ${r}.`)})(d),(({ipcInput:e,ipc:t,serialization:r})=>{if(void 0!==e){if(!t)throw Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");ry[r](e)}})(d),(({cancelSignal:e})=>{if(void 0!==e&&"[object AbortSignal]"!==Object.prototype.toString.call(e))throw Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(e)}`)})(d),(({gracefulCancel:e,cancelSignal:t,ipc:r,serialization:n})=>{if(e){if(void 0===t)throw Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!r)throw Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if("json"===n)throw Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")}})(d),d.shell=A(d.shell),d.env=rD(d),d.killSignal=(e=>{let t="option `killSignal`";if(0===e)throw TypeError(`Invalid ${t}: 0 cannot be used.`);return to(e,t)})(d.killSignal),d.forceKillAfterDelay=(e=>{if(!1===e)return e;if(!0===e)return 5e3;if(!Number.isFinite(e)||e<0)throw TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e})(d.forceKillAfterDelay),d.lines=d.lines.map((e,t)=>e&&!rS.has(d.encoding)&&d.buffer[t]),"win32"===u.platform&&"cmd"===w.basename(a,".exe")&&s.unshift("/q"),{file:a,commandArguments:s,options:d}},r$=({extendEnv:e=!0,preferLocal:t=!1,cwd:r,localDir:n=r,encoding:o="utf8",reject:i=!0,cleanup:a=!0,all:s=!1,windowsHide:l=!0,killSignal:d="SIGTERM",forceKillAfterDelay:u=!0,gracefulCancel:c=!1,ipcInput:p,ipc:f=void 0!==p||c,serialization:h="advanced",...m})=>({...m,extendEnv:e,preferLocal:t,cwd:r,localDirectory:n,encoding:o,reject:i,cleanup:a,all:s,windowsHide:l,killSignal:d,forceKillAfterDelay:u,gracefulCancel:c,ipcInput:p,ipc:f,serialization:h}),rD=({env:e,extendEnv:t,preferLocal:r,node:n,localDirectory:o,nodePath:i})=>{let a=t?{...u.env,...e}:e;return r||n?e0({env:a,cwd:o,execPath:i,preferLocal:r,addExecPath:n}):a},rP=(e,t,r)=>r.shell&&t.length>0?[[e,...t].join(" "),[],r]:[e,t,r];function rA(e){if("string"==typeof e)return rM(e);if(!(ArrayBuffer.isView(e)&&1===e.BYTES_PER_ELEMENT))throw Error("Input must be a string or a Uint8Array");return rk(e)}let rM=e=>e.at(-1)===rR?e.slice(0,e.at(-2)===rL?-2:-1):e,rk=e=>e.at(-1)===rC?e.subarray(0,e.at(-2)===rB?-2:-1):e,rR="\n",rC=rR.codePointAt(0),rL="\r",rB=rL.codePointAt(0);function rU(e,{checkOpen:t=!0}={}){return null!==e&&"object"==typeof e&&(e.writable||e.readable||!t||void 0===e.writable&&void 0===e.readable)&&"function"==typeof e.pipe}function rI(e,{checkOpen:t=!0}={}){return rU(e,{checkOpen:t})&&(e.writable||!t)&&"function"==typeof e.write&&"function"==typeof e.end&&"boolean"==typeof e.writable&&"boolean"==typeof e.writableObjectMode&&"function"==typeof e.destroy&&"boolean"==typeof e.destroyed}function rN(e,{checkOpen:t=!0}={}){return rU(e,{checkOpen:t})&&(e.readable||!t)&&"function"==typeof e.read&&"boolean"==typeof e.readable&&"boolean"==typeof e.readableObjectMode&&"function"==typeof e.destroy&&"boolean"==typeof e.destroyed}function rF(e,t){return rI(e,t)&&rN(e,t)}let rW=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);class rG{#e;#t;#r=!1;#n=void 0;constructor(e,t){this.#e=e,this.#t=t}next(){let e=()=>this.#o();return this.#n=this.#n?this.#n.then(e,e):e(),this.#n}return(e){let t=()=>this.#i(e);return this.#n?this.#n.then(t,t):t()}async #o(){let e;if(this.#r)return{done:!0,value:void 0};try{e=await this.#e.read()}catch(e){throw this.#n=void 0,this.#r=!0,this.#e.releaseLock(),e}return e.done&&(this.#n=void 0,this.#r=!0,this.#e.releaseLock()),e}async #i(e){if(this.#r)return{done:!0,value:e};if(this.#r=!0,!this.#t){let t=this.#e.cancel(e);return this.#e.releaseLock(),await t,{done:!0,value:e}}return this.#e.releaseLock(),{done:!0,value:e}}}let rH=Symbol();function rV(){return this[rH].next()}function rq(e){return this[rH].return(e)}Object.defineProperty(rV,"name",{value:"next"}),Object.defineProperty(rq,"name",{value:"return"});let rz=Object.create(rW,{next:{enumerable:!0,configurable:!0,writable:!0,value:rV},return:{enumerable:!0,configurable:!0,writable:!0,value:rq}});function rK({preventCancel:e=!1}={}){let t=new rG(this.getReader(),e),r=Object.create(rz);return r[rH]=t,r}let{toString:rX}=Object.prototype,rJ=async function*(e){let t=new AbortController,r={};rY(e,t,r);try{for await(let[r]of rQ.on(e,"data",{signal:t.signal}))yield r}catch(e){if(void 0!==r.error)throw r.error;if(!t.signal.aborted)throw e}finally{e.destroy()}},rY=async(e,t,r)=>{try{await rQ.finished(e,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(e){r.error=e}finally{t.abort()}},rQ={},rZ=async(e,{init:t,convertChunk:r,getSize:n,truncateChunk:o,addChunk:i,getFinalChunk:a,finalize:s},{maxBuffer:l=1/0}={})=>{let d=(e=>{if(rN(e,{checkOpen:!1})&&void 0!==rQ.on)return rJ(e);if("function"==typeof e?.[Symbol.asyncIterator])return e;if("[object ReadableStream]"===rX.call(e))return rK.call(e);throw TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")})(e),u=t();u.length=0;try{for await(let e of d){let t=r[r2(e)](e,u);r1({convertedChunk:t,state:u,getSize:n,truncateChunk:o,addChunk:i,maxBuffer:l})}return r0({state:u,convertChunk:r,getSize:n,truncateChunk:o,addChunk:i,getFinalChunk:a,maxBuffer:l}),s(u)}catch(t){let e="object"==typeof t&&null!==t?t:Error(t);throw e.bufferedData=s(u),e}},r0=({state:e,getSize:t,truncateChunk:r,addChunk:n,getFinalChunk:o,maxBuffer:i})=>{let a=o(e);void 0!==a&&r1({convertedChunk:a,state:e,getSize:t,truncateChunk:r,addChunk:n,maxBuffer:i})},r1=({convertedChunk:e,state:t,getSize:r,truncateChunk:n,addChunk:o,maxBuffer:i})=>{let a=r(e),s=t.length+a;if(s<=i)return void r3(e,t,o,s);let l=n(e,i-t.length);throw void 0!==l&&r3(l,t,o,i),new r5},r3=(e,t,r,n)=>{t.contents=r(e,t,n),t.length=n},r2=e=>{let t=typeof e;if("string"===t)return"string";if("object"!==t||null===e)return"others";if(globalThis.Buffer?.isBuffer(e))return"buffer";let r=r8.call(e);return"[object ArrayBuffer]"===r?"arrayBuffer":"[object DataView]"===r?"dataView":Number.isInteger(e.byteLength)&&Number.isInteger(e.byteOffset)&&"[object ArrayBuffer]"===r8.call(e.buffer)?"typedArray":"others"},{toString:r8}=Object.prototype;class r5 extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}let r4=(e,t,r)=>{if(t.length!==r)return;let n=new r5;throw n.maxBufferInfo={fdNumber:"ipc"},n},r6=(e,t)=>e?` and was forcefully terminated after ${t} milliseconds`:"",r9=e=>{if("string"==typeof e)return e;if(C(e))return U.decode(e);return""},r7=({command:e,escapedCommand:t,stdio:r,all:n,ipcOutput:o,options:{cwd:i},startTime:a})=>nn({command:e,escapedCommand:t,cwd:i,durationMs:eJ(a),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:r[1],stderr:r[2],all:n,stdio:r,ipcOutput:o,pipedFrom:[]}),ne=({error:e,command:t,escapedCommand:r,fileDescriptors:n,options:o,startTime:i,isSync:a})=>nt({error:e,command:t,escapedCommand:r,startTime:i,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:n.length}),ipcOutput:[],options:o,isSync:a}),nt=({error:e,command:t,escapedCommand:r,startTime:n,timedOut:o,isCanceled:i,isGracefullyCanceled:a,isMaxBuffer:s,isForcefullyTerminated:l,exitCode:d,signal:u,stdio:c,all:p,ipcOutput:f,options:{timeoutDuration:h,timeout:m=h,forceKillAfterDelay:g,killSignal:y,cwd:w,maxBuffer:v},isSync:S})=>{let{exitCode:O,signal:T,signalDescription:x}=no(d,u),{originalMessage:j,shortMessage:E,message:_}=(({stdio:e,all:t,ipcOutput:r,originalError:n,signal:o,signalDescription:i,exitCode:a,escapedCommand:s,timedOut:l,isCanceled:d,isGracefullyCanceled:u,isMaxBuffer:c,isForcefullyTerminated:p,forceKillAfterDelay:f,killSignal:h,maxBuffer:m,timeout:g,cwd:y})=>{let w=n?.code,v=(({originalError:e,timedOut:t,timeout:r,isMaxBuffer:n,maxBuffer:o,errorCode:i,signal:a,signalDescription:s,exitCode:l,isCanceled:d,isGracefullyCanceled:u,isForcefullyTerminated:c,forceKillAfterDelay:p,killSignal:f})=>{let h=r6(c,p);return t?`Command timed out after ${r} milliseconds${h}`:u?void 0===a?`Command was gracefully canceled with exit code ${l}`:c?`Command was gracefully canceled${h}`:`Command was gracefully canceled with ${a} (${s})`:d?`Command was canceled${h}`:n?`${((e,t)=>{let{streamName:r,threshold:n,unit:o}=((e,t)=>{if(e?.maxBufferInfo===void 0)return{streamName:"output",threshold:t[1],unit:"bytes"};let{maxBufferInfo:{fdNumber:r,unit:n}}=e;delete e.maxBufferInfo;let o=ef(t,r);return"ipc"===r?{streamName:"IPC output",threshold:o,unit:"messages"}:{streamName:Z(r),threshold:o,unit:n}})(e,t);return`Command's ${r} was larger than ${n} ${o}`})(e,o)}${h}`:void 0!==i?`Command failed with ${i}${h}`:c?`Command was killed with ${f} (${tc(f)})${h}`:void 0!==a?`Command was killed with ${a} (${s})`:void 0!==l?`Command failed with exit code ${l}`:"Command failed"})({originalError:n,timedOut:l,timeout:g,isMaxBuffer:c,maxBuffer:m,errorCode:w,signal:o,signalDescription:i,exitCode:a,isCanceled:d,isGracefullyCanceled:u,isForcefullyTerminated:p,forceKillAfterDelay:f,killSignal:h}),S=((e,t)=>{if(e instanceof e1)return;let r=ew(((e,t)=>{let r;if(t===rj())return e;try{r=(0,b.statSync)(t)}catch(r){return`The "cwd" option is invalid: ${t}.
|
|
28
|
-
${r.message}
|
|
29
|
-
${e}`}return r.isDirectory()?e:`The "cwd" option is not a directory: ${t}.
|
|
30
|
-
${e}`})(e8(e)&&e2 in e?e.originalMessage:String(e?.message??e),t));return""===r?void 0:r})(n,y),O=void 0===S?"":`
|
|
31
|
-
${S}`,T=`${v}: ${s}${O}`,x=[T,...void 0===t?[e[2],e[1]]:[t],...e.slice(3),r.map(e=>{let t;return"string"==typeof(t=e)?t:(0,ee.inspect)(t)}).join("\n")].map(e=>{let t;return ew(rA(Array.isArray(t=e)?t.map(e=>rA(r9(e))).filter(Boolean).join("\n"):r9(t)))}).filter(Boolean).join("\n\n");return{originalMessage:S,shortMessage:T,message:x}})({stdio:c,all:p,ipcOutput:f,originalError:e,signal:T,signalDescription:x,exitCode:O,escapedCommand:r,timedOut:o,isCanceled:i,isGracefullyCanceled:a,isMaxBuffer:s,isForcefullyTerminated:l,forceKillAfterDelay:g,killSignal:y,maxBuffer:v,timeout:m,cwd:w}),$=new(S?e4:e5)(_,e instanceof e1?{}:{cause:e});return Object.assign($,nr({error:$,command:t,escapedCommand:r,startTime:n,timedOut:o,isCanceled:i,isGracefullyCanceled:a,isMaxBuffer:s,isForcefullyTerminated:l,exitCode:O,signal:T,signalDescription:x,stdio:c,all:p,ipcOutput:f,cwd:w,originalMessage:j,shortMessage:E})),$},nr=({error:e,command:t,escapedCommand:r,startTime:n,timedOut:o,isCanceled:i,isGracefullyCanceled:a,isMaxBuffer:s,isForcefullyTerminated:l,exitCode:d,signal:u,signalDescription:c,stdio:p,all:f,ipcOutput:h,cwd:m,originalMessage:g,shortMessage:b})=>nn({shortMessage:b,originalMessage:g,command:t,escapedCommand:r,cwd:m,durationMs:eJ(n),failed:!0,timedOut:o,isCanceled:i,isGracefullyCanceled:a,isTerminated:void 0!==u,isMaxBuffer:s,isForcefullyTerminated:l,exitCode:d,signal:u,signalDescription:c,code:e.cause?.code,stdout:p[1],stderr:p[2],all:f,stdio:p,ipcOutput:h,pipedFrom:[]}),nn=e=>Object.fromEntries(Object.entries(e).filter(([,e])=>void 0!==e)),no=(e,t)=>{let r=null===t?void 0:t,n=void 0===r?void 0:tc(t);return{exitCode:null===e?void 0:e,signal:r,signalDescription:n}},ni=e=>Number.isFinite(e)?e:0,na=24n*60n*60n*1000n;function ns(e,t){let r="bigint"==typeof e;if(!r&&!Number.isFinite(e))throw TypeError("Expected a finite number or bigint");t={...t};let n=e<0?"-":"";e=e<0?-e:e,t.colonNotation&&(t.compact=!1,t.formatSubMilliseconds=!1,t.separateMilliseconds=!1,t.verbose=!1),t.compact&&(t.unitCount=1,t.secondsDecimalDigits=0,t.millisecondsDecimalDigits=0);let o=[],i=(e,r,n,i)=>{if(!((0===o.length||!t.colonNotation)&&(0===e||0n===e))||t.colonNotation&&"m"===n){if(i??=String(e),t.colonNotation){let e=i.includes(".")?i.split(".")[0].length:i.length,t=o.length>0?2:1;i="0".repeat(Math.max(0,t-e))+i}else i+=t.verbose?" "+(1===e||1n===e?r:`${r}s`):n;o.push(i)}},a=function(e){switch(typeof e){case"number":if(Number.isFinite(e))return{days:Math.trunc(e/864e5),hours:Math.trunc(e/36e5%24),minutes:Math.trunc(e/6e4%60),seconds:Math.trunc(e/1e3%60),milliseconds:Math.trunc(e%1e3),microseconds:Math.trunc(ni(1e3*e)%1e3),nanoseconds:Math.trunc(ni(1e6*e)%1e3)};break;case"bigint":return{days:e/86400000n,hours:e/3600000n%24n,minutes:e/60000n%60n,seconds:e/1000n%60n,milliseconds:e%1000n,microseconds:0n,nanoseconds:0n}}throw TypeError("Expected a finite number or bigint")}(e),s=BigInt(a.days);if(t.hideYearAndDays?i(24n*BigInt(s)+BigInt(a.hours),"hour","h"):(t.hideYear?i(s,"day","d"):(i(s/365n,"year","y"),i(s%365n,"day","d")),i(Number(a.hours),"hour","h")),i(Number(a.minutes),"minute","m"),!t.hideSeconds)if(t.separateMilliseconds||t.formatSubMilliseconds||!t.colonNotation&&e<1e3&&!t.subSecondsAsDecimals){let e=Number(a.seconds),r=Number(a.milliseconds),n=Number(a.microseconds),o=Number(a.nanoseconds);if(i(e,"second","s"),t.formatSubMilliseconds)i(r,"millisecond","ms"),i(n,"microsecond","\xb5s"),i(o,"nanosecond","ns");else{let e=r+n/1e3+o/1e6,a="number"==typeof t.millisecondsDecimalDigits?t.millisecondsDecimalDigits:0,s=e>=1?Math.round(e):Math.ceil(e),l=a?e.toFixed(a):s;i(Number.parseFloat(l),"millisecond","ms",l)}}else{let n=(r?Number(e%na):e)/1e3%60,o="number"==typeof t.secondsDecimalDigits?t.secondsDecimalDigits:1,a=(Math.round(Math.floor(n*10**o+1e-7))/10**o).toFixed(o),s=t.keepDecimalsOnWholeSeconds?a:a.replace(/\.0+$/,"");i(Number.parseFloat(s),"second","s",s)}if(0===o.length)return n+"0"+(t.verbose?" milliseconds":"ms");let l=t.colonNotation?":":" ";return"number"==typeof t.unitCount&&(o=o.slice(0,Math.max(t.unitCount,1))),n+o.join(l)}let nl=(e,t,{reject:r})=>{if((({verbose:e})=>"none"!==em(e,void 0))(t)){var n,o;e.failed&&eG({type:"error",verboseMessage:e.shortMessage,verboseInfo:t,result:e}),n=e,o=t,eG({type:"duration",verboseMessage:`(done in ${ns(n.durationMs)})`,verboseInfo:o,result:n})}if(e.failed&&r)throw e;return e},nd=(e,t)=>(nc(e,t,"Duplex stream"),"duplex"),nu=(e,t)=>(nc(e,t,"web TransformStream"),"webTransform"),nc=({final:e,binary:t,objectMode:r},n,o)=>{np(e,`${n}.final`,o),np(t,`${n}.binary`,o),nh(r,`${n}.objectMode`)},np=(e,t,r)=>{if(void 0!==e)throw TypeError(`The \`${t}\` option can only be defined when using a generator, not a ${r}.`)},nf=({transform:e,final:t,binary:r,objectMode:n},o)=>{if(void 0!==e&&!nm(e))throw TypeError(`The \`${o}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(rF(t,{checkOpen:!1}))throw TypeError(`The \`${o}.final\` option must not be a Duplex stream.`);if(nx(t))throw TypeError(`The \`${o}.final\` option must not be a web TransformStream.`);if(void 0!==t&&!nm(t))throw TypeError(`The \`${o}.final\` option must be a generator.`);return nh(r,`${o}.binary`),nh(n,`${o}.objectMode`),ng(e)||ng(t)?"asyncGenerator":"generator"},nh=(e,t)=>{if(void 0!==e&&"boolean"!=typeof e)throw TypeError(`The \`${t}\` option must use a boolean.`)},nm=e=>ng(e)||nb(e),ng=e=>"[object AsyncGeneratorFunction]"===Object.prototype.toString.call(e),nb=e=>"[object GeneratorFunction]"===Object.prototype.toString.call(e),ny=e=>"[object URL]"===Object.prototype.toString.call(e),nw=new Set(["file","append"]),nv=e=>"string"==typeof e,nS=new Set(["ipc","ignore","inherit","overlapped","pipe"]),nO=e=>"[object ReadableStream]"===Object.prototype.toString.call(e),nT=e=>"[object WritableStream]"===Object.prototype.toString.call(e),nx=e=>nO(e?.readable)&&nT(e?.writable),nj=e=>"object"==typeof e&&null!==e,nE=new Set(["generator","asyncGenerator","duplex","webTransform"]),n_=new Set(["fileUrl","filePath","fileNumber"]),n$=new Set(["fileUrl","filePath"]),nD=new Set([...n$,"webStream","nodeStream"]),nP=new Set(["webTransform","duplex"]),nA={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"},nM=(e,t,r,n)=>"output"===n?nk(e,t,r):nR(e,t,r),nk=(e,t,r)=>{let n=0!==t&&r[t-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:e??n}},nR=(e,t,r)=>{let n=0===t?!0===e:r[t-1].value.readableObjectMode,o=t!==r.length-1&&(e??n);return{writableObjectMode:n,readableObjectMode:o}},nC=({stdioItem:e,stdioItem:{type:t},index:r,newTransforms:n,optionName:o,direction:i,encoding:a})=>"duplex"===t?nL({stdioItem:e,optionName:o}):"webTransform"===t?nB({stdioItem:e,index:r,newTransforms:n,direction:i}):nU({stdioItem:e,index:r,newTransforms:n,direction:i,encoding:a}),nL=({stdioItem:e,stdioItem:{value:{transform:t,transform:{writableObjectMode:r,readableObjectMode:n},objectMode:o=n}},optionName:i})=>{if(o&&!n)throw TypeError(`The \`${i}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!o&&n)throw TypeError(`The \`${i}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...e,value:{transform:t,writableObjectMode:r,readableObjectMode:n}}},nB=({stdioItem:e,stdioItem:{value:t},index:r,newTransforms:n,direction:o})=>{let{transform:i,objectMode:a}=E(t)?t:{transform:t},{writableObjectMode:s,readableObjectMode:l}=nM(a,r,n,o);return{...e,value:{transform:i,writableObjectMode:s,readableObjectMode:l}}},nU=({stdioItem:e,stdioItem:{value:t},index:r,newTransforms:n,direction:o,encoding:i})=>{let{transform:a,final:s,binary:l=!1,preserveNewlines:d=!1,objectMode:u}=E(t)?t:{transform:t},c=l||rS.has(i),{writableObjectMode:p,readableObjectMode:f}=nM(u,r,n,o);return{...e,value:{transform:a,final:s,binary:c,preserveNewlines:d,writableObjectMode:p,readableObjectMode:f}}},nI=(e,t)=>"input"===t?e.reverse():e,nN=["input","output","output"],nF=()=>void 0,nW=()=>"input",nG={generator:nF,asyncGenerator:nF,fileUrl:nF,filePath:nF,iterable:nW,asyncIterable:nW,uint8Array:nW,webStream:e=>nT(e)?"output":"input",nodeStream:e=>rN(e,{checkOpen:!1})?rI(e,{checkOpen:!1})?void 0:"input":"output",webTransform:nF,duplex:nF,native(e){let t=nH(e);return void 0!==t?t:rU(e,{checkOpen:!1})?nG.nodeStream(e):void 0}},nH=e=>[0,u.stdin].includes(e)?"input":[1,2,u.stdout,u.stderr].includes(e)?"output":void 0,nV=e=>Q.some(t=>void 0!==e[t]),nq=(e,t)=>Array.isArray(e)?e.map(e=>nq(e,t)):null==e?t>=Q.length?"ignore":"pipe":e,nz=e=>"pipe"===e||Array.isArray(e)&&e.every(e=>"pipe"===e),nK=({value:e,optionName:t,fdNumber:r,direction:n})=>{let o=nX(e,r);if(void 0!==o){if("output"===n)return{type:"fileNumber",value:o,optionName:t};if(d.isatty(o))throw TypeError(`The \`${t}: ${tF(e)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:L((0,b.readFileSync)(o)),optionName:t}}},nX=(e,t)=>{if("inherit"===e)return t;if("number"==typeof e)return e;let r=Y.indexOf(e);if(-1!==r)return r},nJ=(e,t,r)=>{let n=Y[e];if(void 0===n)throw TypeError(`The \`${r}: ${t}\` option is invalid: no such standard stream.`);return n},nY=e=>{if(rN(e,{checkOpen:!1}))return"nodeStream";if("string"==typeof e)return"string";if(C(e))return"uint8Array";throw Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},nQ=e=>{if(ny(e))return{type:"fileUrl",value:e};if(nv(e))return{type:"filePath",value:{file:e}};throw Error("The `inputFile` option must be a file path string or a file URL.")},nZ=({otherStdioItems:e,type:t,value:r,optionName:n,direction:o})=>{let i=e.filter(e=>n0(e,r));if(0!==i.length)return n1(i.find(e=>e.direction!==o),n,t),"output"===o?i[0].stream:void 0},n0=({type:e,value:t},r)=>"filePath"===e?t.file===r.file:"fileUrl"===e?t.href===r.href:t===r,n1=(e,t,r)=>{if(void 0!==e)throw TypeError(`The \`${e.optionName}\` and \`${t}\` options must not target ${nA[r]} that is the same.`)},n3=(e,t,r,n)=>{let o=ot({initialFileDescriptors:(({stdio:e,ipc:t,buffer:r,...n},o,i)=>{let a,s,l,d=((e,t)=>{if(void 0===e)return Q.map(e=>t[e]);if(nV(t))throw Error(`It's not possible to provide \`stdio\` in combination with one of ${Q.map(e=>`\`${e}\``).join(", ")}`);if("string"==typeof e)return[e,e,e];if(!Array.isArray(e))throw TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof e}\``);return Array.from({length:Math.max(e.length,Q.length)},(t,r)=>e[r])})(e,n).map((e,t)=>nq(e,t));return i?(a=d,s=r,l=o,a.map((e,t)=>!s[t]&&0!==t&&!eh(l,t)&&nz(e)?"ignore":e)):t&&!d.includes("ipc")?[...d,"ipc"]:d})(t,r,n).map((e,r)=>n2({stdioOption:e,fdNumber:r,options:t,isSync:n})),addProperties:e,options:t,isSync:n});return t.stdio=o.map(({stdioItems:e})=>oi(e)),o},n2=({stdioOption:e,fdNumber:t,options:r,isSync:n})=>{let o,i,a=Z(t),{stdioItems:s,isStdioArray:l}=n8({stdioOption:e,fdNumber:t,options:r,optionName:a}),d=((e,t,r)=>{let n=e.map(e=>(({type:e,value:t},r)=>nN[r]??nG[e](t))(e,t));if(n.includes("input")&&n.includes("output"))throw TypeError(`The \`${r}\` option must not be an array of both readable and writable values.`);return n.find(Boolean)??"output"})(s,t,a),u=(o=s.map(e=>(({stdioItem:e,stdioItem:{type:t},isStdioArray:r,fdNumber:n,direction:o,isSync:i})=>r&&"native"===t?i?(({stdioItem:e,stdioItem:{value:t,optionName:r},fdNumber:n,direction:o})=>{let i=nK({value:t,optionName:r,fdNumber:n,direction:o});if(void 0!==i)return i;if(rU(t,{checkOpen:!1}))throw TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return e})({stdioItem:e,fdNumber:n,direction:o}):(({stdioItem:e,stdioItem:{value:t,optionName:r},fdNumber:n})=>"inherit"===t?{type:"nodeStream",value:nJ(n,t,r),optionName:r}:"number"==typeof t?{type:"nodeStream",value:nJ(t,t,r),optionName:r}:rU(t,{checkOpen:!1})?{type:"nodeStream",value:t,optionName:r}:e)({stdioItem:e,fdNumber:n}):e)({stdioItem:e,isStdioArray:l,fdNumber:t,direction:d,isSync:n})),[...o.filter(({type:e})=>!nE.has(e)),...((e,t,r,{encoding:n})=>{let o=e.filter(({type:e})=>nE.has(e)),i=Array.from({length:o.length});for(let[e,a]of Object.entries(o))i[e]=nC({stdioItem:a,index:Number(e),newTransforms:i,optionName:t,direction:r,encoding:n});return nI(i,r)})(o,a,d,r)]),c=void 0!==(i=u.findLast(({type:e})=>nE.has(e)))&&("input"===d?i.value.writableObjectMode:i.value.readableObjectMode);return oe(u,c),{direction:d,objectMode:c,stdioItems:u}},n8=({stdioOption:e,fdNumber:t,options:r,optionName:n})=>{let o,i=(o=[...(Array.isArray(e)?e:[e]).map(e=>n5(e,n)),...(({input:e,inputFile:t},r)=>{let n,o;return 0===r?[...void 0===(n=e)?[]:[{type:nY(n),value:n,optionName:"input"}],...void 0===(o=t)?[]:[{...nQ(o),optionName:"inputFile"}]]:[]})(r,t)]).filter((e,t)=>o.every((r,n)=>e.value!==r.value||t>=n||"generator"===e.type||"asyncGenerator"===e.type)),a=i.length>1;return n4(i,a,n),n9(i),{stdioItems:i,isStdioArray:a}},n5=(e,t)=>{let r,n,o,i,a,s,l;return{type:ng(e)?"asyncGenerator":nb(e)?"generator":ny(e)?"fileUrl":E(r=e)&&Object.keys(r).length>0&&Object.keys(r).every(e=>nw.has(e))&&nv(r.file)?"filePath":nO(n=e)||nT(n)?"webStream":rU(e,{checkOpen:!1})?"native":C(e)?"uint8Array":nj(o=e)&&"function"==typeof o[Symbol.asyncIterator]?"asyncIterable":nj(i=e)&&"function"==typeof i[Symbol.iterator]?"iterable":nx(e)?nu({transform:e},t):E(a=e)&&(void 0!==a.transform||void 0!==a.final)?(s=e,l=t,rF(s.transform,{checkOpen:!1})?nd(s,l):nx(s.transform)?nu(s,l):nf(s,l)):"native",value:e,optionName:t}},n4=(e,t,r)=>{if(0===e.length)throw TypeError(`The \`${r}\` option must not be an empty array.`);if(t){for(let{value:t,optionName:r}of e)if(n6.has(t))throw Error(`The \`${r}\` option must not include \`${t}\`.`)}},n6=new Set(["ignore","ipc"]),n9=e=>{for(let t of e)n7(t)},n7=({type:e,value:t,optionName:r})=>{if(ny(t)&&"file:"!==t.protocol)throw TypeError(`The \`${r}: URL\` option must use the \`file:\` scheme.
|
|
32
|
-
For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if("native"===e&&"string"==typeof t&&!nS.has(t))throw TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},oe=(e,t)=>{if(!t)return;let r=e.find(({type:e})=>n_.has(e));if(void 0!==r)throw TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},ot=({initialFileDescriptors:e,addProperties:t,options:r,isSync:n})=>{let o=[];try{for(let i of e)o.push(or({fileDescriptor:i,fileDescriptors:o,addProperties:t,options:r,isSync:n}));return o}catch(e){throw oo(o),e}},or=({fileDescriptor:{direction:e,objectMode:t,stdioItems:r},fileDescriptors:n,addProperties:o,options:i,isSync:a})=>{let s=r.map(t=>on({stdioItem:t,addProperties:o,direction:e,options:i,fileDescriptors:n,isSync:a}));return{direction:e,objectMode:t,stdioItems:s}},on=({stdioItem:e,addProperties:t,direction:r,options:n,fileDescriptors:o,isSync:i})=>{let a=(({stdioItem:{type:e,value:t,optionName:r},direction:n,fileDescriptors:o,isSync:i})=>{let a,s,l=(a=o,s=e,a.flatMap(({direction:e,stdioItems:t})=>t.filter(e=>e.type===s).map(t=>({...t,direction:e}))));if(0!==l.length){if(i)return void(({otherStdioItems:e,type:t,value:r,optionName:n,direction:o})=>{n$.has(t)&&nZ({otherStdioItems:e,type:t,value:r,optionName:n,direction:o})})({otherStdioItems:l,type:e,value:t,optionName:r,direction:n});if(nD.has(e))return nZ({otherStdioItems:l,type:e,value:t,optionName:r,direction:n});nP.has(e)&&(({otherStdioItems:e,type:t,value:r,optionName:n})=>{n1(e.find(({value:{transform:e}})=>e===r.transform),n,t)})({otherStdioItems:l,type:e,value:t,optionName:r})}})({stdioItem:e,direction:r,fileDescriptors:o,isSync:i});return void 0!==a?{...e,stream:a}:{...e,...t[r][e.type](e,n)}},oo=e=>{for(let{stdioItems:t}of e)for(let{stream:e}of t)void 0===e||J(e)||e.destroy()},oi=e=>{if(e.length>1)return e.some(({value:e})=>"overlapped"===e)?"overlapped":"pipe";let[{type:t,value:r}]=e;return"native"===t?r:"pipe"},oa=({type:e,optionName:t})=>{os(t,nA[e])},os=(e,t)=>{throw TypeError(`The \`${e}\` option cannot be ${t} with synchronous methods.`)},ol={generator(){},asyncGenerator:oa,webStream:oa,nodeStream:oa,webTransform:oa,duplex:oa,asyncIterable:oa,native:({optionName:e,value:t})=>(("ipc"===t||"overlapped"===t)&&os(e,`"${t}"`),{})},od={input:{...ol,fileUrl:({value:e})=>({contents:[L((0,b.readFileSync)(e))]}),filePath:({value:{file:e}})=>({contents:[L((0,b.readFileSync)(e))]}),fileNumber:oa,iterable:({value:e})=>({contents:[...e]}),string:({value:e})=>({contents:[e]}),uint8Array:({value:e})=>({contents:[e]})},output:{...ol,fileUrl:({value:e})=>({path:e}),filePath:({value:{file:e,append:t}})=>({path:e,append:t}),fileNumber:({value:e})=>({path:e}),iterable:oa,string:oa,uint8Array:oa}},ou=(e,{stripFinalNewline:t},r)=>oc(t,r)&&void 0!==e&&!Array.isArray(e)?rA(e):e,oc=(e,t)=>"all"===t?e[1]||e[2]:e[t],op=(e,t,r,n)=>e||r?void 0:om(t,n),of=(e,t,r)=>r?e.flatMap(e=>oh(e,t)):oh(e,t),oh=(e,t)=>{let{transform:r,final:n}=om(t,{});return[...r(e),...n()]},om=(e,t)=>(t.previousChunks="",{transform:og.bind(void 0,t,e),final:oy.bind(void 0,t)}),og=function*(e,t,r){if("string"!=typeof r)return void(yield r);let{previousChunks:n}=e,o=-1;for(let i=0;i<r.length;i+=1)if("\n"===r[i]){let a=ob(r,i,t,e),s=r.slice(o+1,i+1-a);n.length>0&&(s=ov(n,s),n=""),yield s,o=i}o!==r.length-1&&(n=ov(n,r.slice(o+1))),e.previousChunks=n},ob=(e,t,r,n)=>r?0:(n.isWindowsNewline=0!==t&&"\r"===e[t-1],n.isWindowsNewline?2:1),oy=function*({previousChunks:e}){e.length>0&&(yield e)},ow=function*({isWindowsNewline:e=!1},t){let{unixNewline:r,windowsNewline:n,LF:o,concatBytes:i}="string"==typeof t?oS:oO;t.at(-1)===o?yield t:yield i(t,e?n:r)},ov=(e,t)=>`${e}${t}`,oS={windowsNewline:"\r\n",unixNewline:"\n",LF:"\n",concatBytes:ov},oO={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:(e,t)=>{let r=new Uint8Array(e.length+t.length);return r.set(e,0),r.set(t,e.length),r}},oT=l("node:buffer"),ox=function*(e,t){if("string"!=typeof t&&!C(t)&&!oT.Buffer.isBuffer(t))throw TypeError(`The \`${e}\` option's transform must use "objectMode: true" to receive as input: ${typeof t}.`);yield t},oj=function*(e,t){o_(e,t),yield t},oE=function*(e,t){if(o_(e,t),"string"!=typeof t&&!C(t))throw TypeError(`The \`${e}\` option's function must yield a string or an Uint8Array, not ${typeof t}.`);yield t},o_=(e,t)=>{if(null==t)throw TypeError(`The \`${e}\` option's function must not call \`yield ${t}\`.
|
|
33
|
-
Instead, \`yield\` should either be called with a value, or not be called at all. For example:
|
|
34
|
-
if (condition) { yield value; }`)},o$=(e,t,r)=>{if(r)return;if(e)return{transform:oD.bind(void 0,new TextEncoder)};let n=new k.StringDecoder(t);return{transform:oP.bind(void 0,n),final:oA.bind(void 0,n)}},oD=function*(e,t){oT.Buffer.isBuffer(t)?yield L(t):"string"==typeof t?yield e.encode(t):yield t},oP=function*(e,t){yield C(t)?e.write(t):t},oA=function*(e){let t=e.end();""!==t&&(yield t)},oM=(0,ee.callbackify)(async(e,t,r,n)=>{t.currentIterable=e(...r);try{for await(let e of t.currentIterable)n.push(e)}finally{delete t.currentIterable}}),ok=async function*(e,t,r){if(r===t.length)return void(yield e);let{transform:n=oB}=t[r];for await(let o of n(e))yield*ok(o,t,r+1)},oR=async function*(e){for(let[t,{final:r}]of Object.entries(e))yield*oC(r,Number(t),e)},oC=async function*(e,t,r){if(void 0!==e)for await(let n of e())yield*ok(n,r,t+1)},oL=(0,ee.callbackify)(async({currentIterable:e},t)=>{if(void 0!==e)return void await (t?e.throw(t):e.return());if(t)throw t}),oB=function*(e){yield e},oU=(e,t,r,n)=>{try{for(let n of e(...t))r.push(n);n()}catch(e){n(e)}},oI=(e,t)=>[...t.flatMap(t=>[...oN(t,e,0)]),...oF(e)],oN=function*(e,t,r){if(r===t.length)return void(yield e);let{transform:n=oG}=t[r];for(let o of n(e))yield*oN(o,t,r+1)},oF=function*(e){for(let[t,{final:r}]of Object.entries(e))yield*oW(r,Number(t),e)},oW=function*(e,t,r){if(void 0!==e)for(let n of e())yield*oN(n,r,t+1)},oG=function*(e){yield e},oH=l("node:stream"),oV=({value:e,value:{transform:t,final:r,writableObjectMode:n,readableObjectMode:o},optionName:i},{encoding:a})=>{let s={},l=oz(e,a,i),d=ng(t),u=ng(r),c=d?oM.bind(void 0,ok,s):oU.bind(void 0,oN),p=d||u?oM.bind(void 0,oR,s):oU.bind(void 0,oF),f=d||u?oL.bind(void 0,s):void 0;return{stream:new oH.Transform({writableObjectMode:n,writableHighWaterMark:(0,oH.getDefaultHighWaterMark)(n),readableObjectMode:o,readableHighWaterMark:(0,oH.getDefaultHighWaterMark)(o),transform(e,t,r){c([e,l,0],this,r)},flush(e){p([l],this,e)},destroy:f})}},oq=(e,t,r,n)=>{let o=t.filter(({type:e})=>"generator"===e);for(let{value:t,optionName:i}of n?o.reverse():o)e=oI(oz(t,r,i),e);return e},oz=({transform:e,final:t,binary:r,writableObjectMode:n,readableObjectMode:o,preserveNewlines:i},a,s)=>{let l={};return[{transform:n?void 0:ox.bind(void 0,s)},o$(r,a,n),op(r,i,n,l),{transform:e,final:t},{transform:o?oj.bind(void 0,s):oE.bind(void 0,s)},(({binary:e,preserveNewlines:t,readableObjectMode:r,state:n})=>e||t||r?void 0:{transform:ow.bind(void 0,n)})({binary:r,preserveNewlines:i,readableObjectMode:o,state:l})].filter(Boolean)},oK=(e,t,r)=>{let{stdioItems:n}=e[t],o=n.filter(({contents:e})=>void 0!==e);if(0!==o.length){if(0!==t){let[{type:e,optionName:t}]=o;throw TypeError(`Only the \`stdin\` option, not \`${t}\`, can be ${nA[e]} with synchronous methods.`)}r.input=I(o.map(({contents:e})=>e).map(e=>oX(e,n)))}},oX=(e,t)=>{let r=oq(e,t,"utf8",!0);return oJ(r),I(r)},oJ=e=>{let t=e.find(e=>"string"!=typeof e&&!C(e));if(void 0!==t)throw TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${t}.`)},oY=({stdioItems:e,encoding:t,verboseInfo:r,fdNumber:n})=>"all"!==n&&eh(r,n)&&!rS.has(t)&&oQ(n)&&(e.some(({type:e,value:t})=>"native"===e&&oZ.has(t))||e.every(({type:e})=>nE.has(e))),oQ=e=>1===e||2===e,oZ=new Set(["pipe","overlapped"]),o0=async(e,t,r,n)=>{for await(let o of e)o1(t)||o3(o,r,n)},o1=e=>e._readableState.pipes.length>0,o3=(e,t,r)=>{eG({type:"output",verboseMessage:ez(e),fdNumber:t,verboseInfo:r})},o2=(e,t,r,n)=>{try{return oq(e,t,r,!1)}catch(t){return n.error=t,e}},o8=({chunks:e,objectMode:t,encoding:r,lines:n,stripFinalNewline:o,fdNumber:i})=>{if(t)return{serializedResult:e};if("buffer"===r)return{serializedResult:I(e)};let a=((e,t)=>{if("utf8"===t&&e.every(e=>"string"==typeof e))return e;let r=new k.StringDecoder(t),n=e.map(e=>"string"==typeof e?B.encode(e):e).map(e=>r.write(e)),o=r.end();return""===o?n:[...n,o]})(e,r).join("");return n[i]?{serializedResult:a,finalResult:of(a,!o[i],t)}:{serializedResult:a}},o5=({serializedResult:e,fdNumber:t,state:r,verboseInfo:n,encoding:o,stdioItems:i,objectMode:a})=>{if(!oY({stdioItems:i,encoding:o,verboseInfo:n,fdNumber:t}))return;let s=of(e,!1,a);try{for(let e of s)o3(e,t,n)}catch(e){r.error??=e}},o4=(e,t,r)=>{for(let{path:n,append:o}of t.filter(({type:e})=>n_.has(e))){let t="string"==typeof n?n:n.toString();o||r.has(t)?(0,b.appendFileSync)(n,e):(r.add(t),(0,b.writeFileSync)(n,e))}},o6=async(e,t)=>{let[r,n]=await o9(e);return t.isForcefullyTerminated??=!1,[r,n]},o9=async e=>{let[t,r]=await Promise.allSettled([(0,tb.once)(e,"spawn"),(0,tb.once)(e,"exit")]);return"rejected"===t.status?[]:"rejected"===r.status?o7(e):r.value},o7=async e=>{try{return await (0,tb.once)(e,"exit")}catch{return o7(e)}},ie=async e=>{let[t,r]=await e;if(!it(t,r)&&ir(t,r))throw new e1;return[t,r]},it=(e,t)=>void 0===e&&void 0===t,ir=(e,t)=>0!==e||null!==t,io=e=>e.node&&!e.ipc?{...e,ipc:!1}:e,ii=({ipc:e,ipcInput:t,detached:r,cancelSignal:n})=>{t&&ia("ipcInput"),e&&ia("ipc: true"),r&&ia("detached: true"),n&&ia("cancelSignal")},ia=e=>{throw TypeError(`The "${e}" option cannot be used with synchronous methods.`)},is=({file:e,commandArguments:t,options:r,command:n,escapedCommand:o,fileDescriptors:i,startTime:a})=>{try{let n;for(let e of(n=i,new Set(Object.entries(n).filter(([,{direction:e}])=>"input"===e).map(([e])=>Number(e)))))oK(i,e,r);let o=il(r);return(0,c.spawnSync)(...rP(e,t,o))}catch(e){return ne({error:e,command:n,escapedCommand:o,fileDescriptors:i,options:r,startTime:a,isSync:!0})}},il=({encoding:e,maxBuffer:t,...r})=>({...r,encoding:"buffer",maxBuffer:(([,e])=>e)(t)}),id=({error:e,exitCode:t,signal:r,timedOut:n,isMaxBuffer:o,stdio:i,all:a,options:s,command:l,escapedCommand:d,startTime:u})=>void 0===e?r7({command:l,escapedCommand:d,stdio:i,all:a,ipcOutput:[],options:s,startTime:u}):nt({error:e,command:l,escapedCommand:d,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:o,isForcefullyTerminated:!1,exitCode:t,signal:r,stdio:i,all:a,ipcOutput:[],options:s,startTime:u,isSync:!0}),iu=({anyProcess:e,channel:t,isSubprocess:r,ipc:n},{reference:o=!0,filter:i}={})=>(tv({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:tZ(e)}),ic({anyProcess:e,channel:t,isSubprocess:r,filter:i,reference:o})),ic=async({anyProcess:e,channel:t,isSubprocess:r,filter:n,reference:o})=>{tG(t,o);let i=tJ(e,t,r),a=new AbortController;try{return await Promise.race([ip(i,n,a),ih(i,r,a),im(i,r,a)])}catch(t){throw tD(e),t}finally{a.abort(),tV(t,o)}},ip=async(e,t,{signal:r})=>{if(void 0===t){let[t]=await (0,tb.once)(e,"message",{signal:r});return t}for await(let[n]of(0,tb.on)(e,"message",{signal:r}))if(t(n))return n},ih=async(e,t,{signal:r})=>{await (0,tb.once)(e,"disconnect",{signal:r});throw Error(`${tE("getOneMessage",t)} could not complete: the ${t$(t)} exited or disconnected.`)},im=async(e,t,{signal:r})=>{let[n]=await (0,tb.once)(e,"strict:error",{signal:r});throw tT(n,t)},ig=({anyProcess:e,channel:t,isSubprocess:r,ipc:n},{reference:o=!0}={})=>ib({anyProcess:e,channel:t,isSubprocess:r,ipc:n,shouldAwait:!r,reference:o}),ib=({anyProcess:e,channel:t,isSubprocess:r,ipc:n,shouldAwait:o,reference:i})=>{tv({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:tZ(e)}),tG(t,i);let a=tJ(e,t,r),s=new AbortController,l={};return iy(e,a,s),iw({ipcEmitter:a,isSubprocess:r,controller:s,state:l}),iv({anyProcess:e,channel:t,ipcEmitter:a,isSubprocess:r,shouldAwait:o,controller:s,state:l,reference:i})},iy=async(e,t,r)=>{try{await (0,tb.once)(t,"disconnect",{signal:r.signal}),r.abort()}catch{}},iw=async({ipcEmitter:e,isSubprocess:t,controller:r,state:n})=>{try{let[o]=await (0,tb.once)(e,"strict:error",{signal:r.signal});n.error=tT(o,t),r.abort()}catch{}},iv=async function*({anyProcess:e,channel:t,ipcEmitter:r,isSubprocess:n,shouldAwait:o,controller:i,state:a,reference:s}){try{for await(let[e]of(0,tb.on)(r,"message",{signal:i.signal}))iS(a),yield e}catch{iS(a)}finally{i.abort(),tV(t,s),n||tD(e),o&&await e}},iS=({error:e})=>{if(e)throw e},iO=(e,t,r)=>({sendMessage:rn.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r}),getOneMessage:iu.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r}),getEachMessage:ig.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r})}),iT=()=>{let e=new oH.PassThrough;return e.end(),e},ix=()=>new oH.Readable({read(){}}),ij=()=>new oH.Writable({write(){}}),iE=()=>new oH.Duplex({read(){},write(){}}),i_=async(e,t,r)=>nl(e,t,r),i$=({type:e,optionName:t})=>{throw TypeError(`The \`${t}\` option cannot be ${nA[e]}.`)},iD={fileNumber:i$,generator:oV,asyncGenerator:oV,nodeStream:({value:e})=>({stream:e}),webTransform:({value:{transform:e,writableObjectMode:t,readableObjectMode:r}})=>({stream:oH.Duplex.fromWeb(e,{objectMode:t||r})}),duplex:({value:{transform:e}})=>({stream:e}),native(){}},iP={input:{...iD,fileUrl:({value:e})=>({stream:(0,b.createReadStream)(e)}),filePath:({value:{file:e}})=>({stream:(0,b.createReadStream)(e)}),webStream:({value:e})=>({stream:oH.Readable.fromWeb(e)}),iterable:({value:e})=>({stream:oH.Readable.from(e)}),asyncIterable:({value:e})=>({stream:oH.Readable.from(e)}),string:({value:e})=>({stream:oH.Readable.from(e)}),uint8Array:({value:e})=>({stream:oH.Readable.from(oT.Buffer.from(e))})},output:{...iD,fileUrl:({value:e})=>({stream:(0,b.createWriteStream)(e)}),filePath:({value:{file:e,append:t}})=>({stream:(0,b.createWriteStream)(e,t?{flags:"a"}:{})}),webStream:({value:e})=>({stream:oH.Writable.fromWeb(e)}),iterable:i$,asyncIterable:i$,string:i$,uint8Array:i$}};function iA(e){if(!Array.isArray(e))throw TypeError(`Expected an array, got \`${typeof e}\`.`);for(let t of e)iB(t);let t=e.some(({readableObjectMode:e})=>e),r=iM(e,t),n=new ik({objectMode:t,writableHighWaterMark:r,readableHighWaterMark:r});for(let t of e)n.add(t);return n}let iM=(e,t)=>0===e.length?(0,oH.getDefaultHighWaterMark)(t):Math.max(...e.filter(({readableObjectMode:e})=>e===t).map(({readableHighWaterMark:e})=>e));class ik extends oH.PassThrough{#a=new Set([]);#s=new Set([]);#l=new Set([]);#d;#u=Symbol("unpipe");#c=new WeakMap;add(e){if(iB(e),this.#a.has(e))return;this.#a.add(e),this.#d??=iR(this,this.#a,this.#u);let t=iU({passThroughStream:this,stream:e,streams:this.#a,ended:this.#s,aborted:this.#l,onFinished:this.#d,unpipeEvent:this.#u});this.#c.set(e,t),e.pipe(this,{end:!1})}async remove(e){if(iB(e),!this.#a.has(e))return!1;let t=this.#c.get(e);return void 0!==t&&(this.#c.delete(e),e.unpipe(this),await t,!0)}}let iR=async(e,t,r)=>{iK(e,iX);let n=new AbortController;try{await Promise.race([iC(e,n),iL(e,t,r,n)])}finally{n.abort(),iK(e,-iX)}},iC=async(e,{signal:t})=>{try{await (0,f.finished)(e,{signal:t,cleanup:!0})}catch(t){throw iG(e,t),t}},iL=async(e,t,r,{signal:n})=>{for await(let[o]of(0,tb.on)(e,"unpipe",{signal:n}))t.has(o)&&o.emit(r)},iB=e=>{if("function"!=typeof e?.pipe)throw TypeError(`Expected a readable stream, got: \`${typeof e}\`.`)},iU=async({passThroughStream:e,stream:t,streams:r,ended:n,aborted:o,onFinished:i,unpipeEvent:a})=>{iK(e,iJ);let s=new AbortController;try{await Promise.race([iI(i,t,s),iN({passThroughStream:e,stream:t,streams:r,ended:n,aborted:o,controller:s}),iF({stream:t,streams:r,ended:n,aborted:o,unpipeEvent:a,controller:s})])}finally{s.abort(),iK(e,-iJ)}r.size>0&&r.size===n.size+o.size&&(0===n.size&&o.size>0?iV(e):iW(e))},iI=async(e,t,{signal:r})=>{try{await e,r.aborted||iV(t)}catch(e){r.aborted||iG(t,e)}},iN=async({passThroughStream:e,stream:t,streams:r,ended:n,aborted:o,controller:{signal:i}})=>{try{await (0,f.finished)(t,{signal:i,cleanup:!0,readable:!0,writable:!1}),r.has(t)&&n.add(t)}catch(n){if(i.aborted||!r.has(t))return;iH(n)?o.add(t):iq(e,n)}},iF=async({stream:e,streams:t,ended:r,aborted:n,unpipeEvent:o,controller:{signal:i}})=>{if(await (0,tb.once)(e,o,{signal:i}),!e.readable)return(0,tb.once)(i,"abort",{signal:i});t.delete(e),r.delete(e),n.delete(e)},iW=e=>{e.writable&&e.end()},iG=(e,t)=>{iH(t)?iV(e):iq(e,t)},iH=e=>e?.code==="ERR_STREAM_PREMATURE_CLOSE",iV=e=>{(e.readable||e.writable)&&e.destroy()},iq=(e,t)=>{e.destroyed||(e.once("error",iz),e.destroy(t))},iz=()=>{},iK=(e,t)=>{let r=e.getMaxListeners();0!==r&&r!==1/0&&e.setMaxListeners(r+t)},iX=2,iJ=1,iY=(e,t)=>{e.pipe(t),iQ(e,t),i0(e,t)},iQ=async(e,t)=>{if(!(J(e)||J(t))){try{await (0,f.finished)(e,{cleanup:!0,readable:!0,writable:!1})}catch{}iZ(t)}},iZ=e=>{e.writable&&e.end()},i0=async(e,t)=>{if(!(J(e)||J(t))){try{await (0,f.finished)(t,{cleanup:!0,readable:!1,writable:!0})}catch{}i1(e)}},i1=e=>{e.readable&&e.destroy()},i3=(e,t,r,n)=>{"output"===r?iY(e.stdio[n],t):iY(t,e.stdio[n]);let o=i2[n];void 0!==o&&(e[o]=t),e.stdio[n]=t},i2=["stdin","stdout","stderr"],i8=({subprocess:e,stream:t,direction:r,fdNumber:n,pipeGroups:o,controller:i})=>{if(void 0===t)return;i5(t,i);let[a,s]="output"===r?[t,e.stdio[n]]:[e.stdio[n],t],l=o.get(a)??[];o.set(a,[...l,s])},i5=(e,{signal:t})=>{J(e)&&tW(e,i4,t)},i4=2,i6=(e,t,r,...n)=>{if(Array.isArray(r))return{destination:t(i9,e)(r,...n),pipeOptions:e};if("string"==typeof r||r instanceof URL||P(r)){if(Object.keys(e).length>0)throw TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[o,i,a]=M(r,...n);return{destination:t(i9)(o,i,a),pipeOptions:a}}if(tk.has(r)){if(Object.keys(e).length>0)throw TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},i9=({options:e})=>({options:{...e,stdin:"pipe",piped:!0}}),i7=({error:e,fileDescriptors:t,sourceOptions:r,startTime:n})=>ne({error:e,command:ae,escapedCommand:ae,fileDescriptors:t,options:r,startTime:n,isSync:!1}),ae="source.pipe(destination)",at=async e=>{let[{status:t,reason:r,value:n=r},{status:o,reason:i,value:a=i}]=await e;if(a.pipedFrom.includes(n)||a.pipedFrom.push(n),"rejected"===o)throw a;if("rejected"===t)throw n;return a},ar=async e=>{try{await (0,f.finished)(e,{cleanup:!0,readable:!1,writable:!0})}catch{}an.delete(e)},an=new WeakMap,ao=async(e,{sourceStream:t,mergedStream:r,fileDescriptors:n,sourceOptions:o,startTime:i})=>{throw await (0,ee.aborted)(e,t),await r.remove(t),i7({error:Error("Pipe canceled by `unpipeSignal` option."),fileDescriptors:n,sourceOptions:o,startTime:i})},ai=(e,...t)=>{if(E(t[0]))return ai.bind(void 0,{...e,boundOptions:{...e.boundOptions,...t[0]}});let{destination:r,...n}=(({source:e,sourcePromise:t,boundOptions:r,createNested:n},...o)=>{let i=u.hrtime.bigint(),{destination:a,destinationStream:s,destinationError:l,from:d,unpipeSignal:c}=((e,t,r)=>{try{let{destination:n,pipeOptions:{from:o,to:i,unpipeSignal:a}={}}=i6(e,t,...r),s=tA(n,i);return{destination:n,destinationStream:s,from:o,unpipeSignal:a}}catch(e){return{destinationError:e}}})(r,n,o),{sourceStream:p,sourceError:f}=((e,t)=>{try{return{sourceStream:tM(e,t)}}catch(e){return{sourceError:e}}})(e,d),{options:h,fileDescriptors:m}=tk.get(e);return{sourcePromise:t,sourceStream:p,sourceOptions:h,sourceError:f,destination:a,destinationStream:s,destinationError:l,unpipeSignal:c,fileDescriptors:m,startTime:i}})(e,...t),o=aa({...n,destination:r});return o.pipe=ai.bind(void 0,{...e,source:r,sourcePromise:o,boundOptions:{}}),o},aa=async({sourcePromise:e,sourceStream:t,sourceOptions:r,sourceError:n,destination:o,destinationStream:i,destinationError:a,unpipeSignal:s,fileDescriptors:l,startTime:d})=>{let u=as(e,o);(({sourceStream:e,sourceError:t,destinationStream:r,destinationError:n,fileDescriptors:o,sourceOptions:i,startTime:a})=>{let s=(({sourceStream:e,sourceError:t,destinationStream:r,destinationError:n})=>void 0!==t&&void 0!==n?n:void 0!==n?(i1(e),n):void 0!==t?(iZ(r),t):void 0)({sourceStream:e,sourceError:t,destinationStream:r,destinationError:n});if(void 0!==s)throw i7({error:s,fileDescriptors:o,sourceOptions:i,startTime:a})})({sourceStream:t,sourceError:n,destinationStream:i,destinationError:a,fileDescriptors:l,sourceOptions:r,startTime:d});let c=new AbortController;try{var p,f,h,m;let e,n,o,a,g=(o=an.has(i)?(p=t,f=i,(e=an.get(f)).add(p),e):(h=t,m=i,n=iA([h]),iY(n,m),an.set(m,n),n),tW(t,2,c.signal),tW(i,1,c.signal),ar(i),o);return await Promise.race([at(u),...(a={sourceStream:t,mergedStream:g,sourceOptions:r,fileDescriptors:l,startTime:d},void 0===s?[]:[ao(s,a)])])}finally{c.abort()}},as=(e,t)=>Promise.allSettled([e,t]),al=e=>e,ad=()=>void 0,au=({contents:e})=>e,ac=e=>{throw Error(`Streams in object mode are not supported: ${String(e)}`)},ap=e=>e.length;async function af(e,t){return rZ(e,ah,t)}let ah={init:()=>({contents:[]}),convertChunk:{string:al,buffer:al,arrayBuffer:al,dataView:al,typedArray:al,others:al},getSize:()=>1,truncateChunk:ad,addChunk:(e,{contents:t})=>(t.push(e),t),getFinalChunk:ad,finalize:au};async function am(e,t){return rZ(e,aS,t)}let ag=new TextEncoder,ab=e=>new Uint8Array(e),ay=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),aw=e=>av**Math.ceil(Math.log(e)/Math.log(av)),av=2,aS={init:()=>({contents:new ArrayBuffer(0)}),convertChunk:{string:e=>ag.encode(e),buffer:ab,arrayBuffer:ab,dataView:ay,typedArray:ay,others:ac},getSize:ap,truncateChunk:(e,t)=>e.slice(0,t),addChunk:(e,{contents:t,length:r},n)=>{let o="resize"in ArrayBuffer.prototype?((e,t)=>{if(t<=e.maxByteLength)return e.resize(t),e;let r=new ArrayBuffer(t,{maxByteLength:aw(t)});return new Uint8Array(r).set(new Uint8Array(e),0),r})(t,n):((e,t)=>{if(t<=e.byteLength)return e;let r=new ArrayBuffer(aw(t));return new Uint8Array(r).set(new Uint8Array(e),0),r})(t,n);return new Uint8Array(o).set(e,r),o},getFinalChunk:ad,finalize:({contents:e,length:t})=>"resize"in ArrayBuffer.prototype?e:e.slice(0,t)};async function aO(e,t){return rZ(e,ax,t)}let aT=(e,{textDecoder:t})=>t.decode(e,{stream:!0}),ax={init:()=>({contents:"",textDecoder:new TextDecoder}),convertChunk:{string:al,buffer:aT,arrayBuffer:aT,dataView:aT,typedArray:aT,others:ac},getSize:ap,truncateChunk:(e,t)=>e.slice(0,t),addChunk:(e,{contents:t})=>t+e,getFinalChunk:({textDecoder:e})=>{let t=e.decode();return""===t?void 0:t},finalize:au},aj=({subprocessStdout:e,subprocess:t,binary:r,shouldEncode:n,encoding:o,preserveNewlines:i})=>{let a=new AbortController;return aE(t,a),aD({stream:e,controller:a,binary:r,shouldEncode:!e.readableObjectMode&&n,encoding:o,shouldSplit:!e.readableObjectMode,preserveNewlines:i})},aE=async(e,t)=>{try{await e}catch{}finally{t.abort()}},a_=({stream:e,onStreamEnd:t,lines:r,encoding:n,stripFinalNewline:o,allMixed:i})=>{let a=new AbortController;a$(t,a,e);let s=e.readableObjectMode&&!i;return aD({stream:e,controller:a,binary:"buffer"===n,shouldEncode:!s,encoding:n,shouldSplit:!s&&r,preserveNewlines:!o})},a$=async(e,t,r)=>{try{await e}catch{r.destroy()}finally{t.abort()}},aD=({stream:e,controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:i,preserveNewlines:a})=>aM({onStdoutChunk:(0,tb.on)(e,"data",{signal:t.signal,highWaterMark:aA,highWatermark:aA}),controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:i,preserveNewlines:a}),aP=(0,oH.getDefaultHighWaterMark)(!0),aA=aP,aM=async function*({onStdoutChunk:e,controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:i,preserveNewlines:a}){let s=ak({binary:r,shouldEncode:n,encoding:o,shouldSplit:i,preserveNewlines:a});try{for await(let[t]of e)yield*oN(t,s,0)}catch(e){if(!t.signal.aborted)throw e}finally{yield*oF(s)}},ak=({binary:e,shouldEncode:t,encoding:r,shouldSplit:n,preserveNewlines:o})=>[o$(e,r,!t),op(e,o,!n,{})].filter(Boolean),aR=async({stream:e,onStreamEnd:t,fdNumber:r,encoding:n,buffer:o,maxBuffer:i,lines:a,allMixed:s,stripFinalNewline:l,verboseInfo:d,streamInfo:u})=>{let c=aC({stream:e,onStreamEnd:t,fdNumber:r,encoding:n,allMixed:s,verboseInfo:d,streamInfo:u});if(!o)return void await Promise.all([aL(e),c]);let p=a_({stream:e,onStreamEnd:t,lines:a,encoding:n,stripFinalNewline:oc(l,r),allMixed:s}),[f]=await Promise.all([aB({stream:e,iterable:p,fdNumber:r,encoding:n,maxBuffer:i,lines:a}),c]);return f},aC=async({stream:e,onStreamEnd:t,fdNumber:r,encoding:n,allMixed:o,verboseInfo:i,streamInfo:{fileDescriptors:a}})=>{if(!oY({stdioItems:a[r]?.stdioItems,encoding:n,verboseInfo:i,fdNumber:r}))return;let s=a_({stream:e,onStreamEnd:t,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:o});await o0(s,e,r,i)},aL=async e=>{await (0,p.setImmediate)(),null===e.readableFlowing&&e.resume()},aB=async({stream:e,stream:{readableObjectMode:t},iterable:r,fdNumber:n,encoding:o,maxBuffer:i,lines:a})=>{try{if(t||a)return await af(r,{maxBuffer:i});if("buffer"===o)return new Uint8Array(await am(r,{maxBuffer:i}));return await aO(r,{maxBuffer:i})}catch(r){return aI((({error:e,stream:t,readableObjectMode:r,lines:n,encoding:o,fdNumber:i})=>{let a,s,l;if(!(e instanceof r5))throw e;if("all"===i)return e;throw e.maxBufferInfo={fdNumber:i,unit:(a=r,s=n,l=o,a?"objects":s?"lines":"buffer"===l?"bytes":"characters")},t.destroy(),e})({error:r,stream:e,readableObjectMode:t,lines:a,encoding:o,fdNumber:n}))}},aU=async e=>{try{return await e}catch(e){return aI(e)}},aI=({bufferedData:e})=>"[object ArrayBuffer]"===R.call(e)?new Uint8Array(e):e,aN=async(e,t,r,{isSameDirection:n,stopOnExit:o=!1}={})=>{let i=aF(e,r),a=new AbortController;try{await Promise.race([...o?[r.exitPromise]:[],(0,f.finished)(e,{cleanup:!0,signal:a.signal})])}catch(e){i.stdinCleanedUp||aH(e,t,r,n)}finally{a.abort()}},aF=(e,{originalStreams:[t],subprocess:r})=>{let n={stdinCleanedUp:!1};return e===t&&aW(e,r,n),n},aW=(e,t,r)=>{let{_destroy:n}=e;e._destroy=(...o)=>{aG(t,r),n.call(e,...o)}},aG=({exitCode:e,signalCode:t},r)=>{(null!==e||null!==t)&&(r.stdinCleanedUp=!0)},aH=(e,t,r,n)=>{if(!aV(e,t,r,n))throw e},aV=(e,t,r,n=!0)=>r.propagating?aK(e)||az(e):(r.propagating=!0,aq(r,t)===n?aK(e):az(e)),aq=({fileDescriptors:e},t)=>"all"!==t&&"input"===e[t].direction,az=e=>e?.code==="ERR_STREAM_PREMATURE_CLOSE",aK=e=>e?.code==="EPIPE",aX=async({stream:e,fdNumber:t,encoding:r,buffer:n,maxBuffer:o,lines:i,allMixed:a,stripFinalNewline:s,verboseInfo:l,streamInfo:d})=>{if(!e)return;let u=aN(e,t,d);if(aq(d,t))return void await u;let[c]=await Promise.all([aR({stream:e,onStreamEnd:u,fdNumber:t,encoding:r,buffer:n,maxBuffer:o,lines:i,allMixed:a,stripFinalNewline:s,verboseInfo:l,streamInfo:d}),u]);return c},aJ=(e,t)=>{eG({type:"ipc",verboseMessage:ez(e),fdNumber:"ipc",verboseInfo:t})},aY=async({subprocess:e,buffer:t,maxBuffer:r,ipc:n,ipcOutput:o,verboseInfo:i})=>{if(!n)return o;let a=eh(i,"ipc"),s=ef(t,"ipc"),l=ef(r,"ipc");for await(let t of ib({anyProcess:e,channel:e.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))s&&(r4(e,o,l),o.push(t)),a&&aJ(t,i);return o},aQ=async(e,t)=>(await Promise.allSettled([e]),t),aZ=async({subprocess:e,options:{encoding:t,buffer:r,maxBuffer:n,lines:o,timeoutDuration:i,cancelSignal:a,gracefulCancel:s,forceKillAfterDelay:l,stripFinalNewline:d,ipc:u,ipcInput:c},context:p,verboseInfo:f,fileDescriptors:h,originalStreams:m,onInternalError:g,controller:b})=>{let y=o6(e,p),w={originalStreams:m,fileDescriptors:h,subprocess:e,exitPromise:y,propagating:!1},v=(({subprocess:e,encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:i,verboseInfo:a,streamInfo:s})=>e.stdio.map((e,l)=>aX({stream:e,fdNumber:l,encoding:t,buffer:r[l],maxBuffer:n[l],lines:o[l],allMixed:!1,stripFinalNewline:i,verboseInfo:a,streamInfo:s})))({subprocess:e,encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:d,verboseInfo:f,streamInfo:w}),S=(({subprocess:e,encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:i,verboseInfo:a,streamInfo:s})=>aX({...(({stdout:e,stderr:t,all:r},[,n,o])=>{let i=n||o;return i?n?o?{stream:r,buffer:i}:{stream:e,buffer:i}:{stream:t,buffer:i}:{stream:r,buffer:i}})(e,r),fdNumber:"all",encoding:t,maxBuffer:n[1]+n[2],lines:o[1]||o[2],allMixed:(({all:e,stdout:t,stderr:r})=>e&&t&&r&&t.readableObjectMode!==r.readableObjectMode)(e),stripFinalNewline:i,verboseInfo:a,streamInfo:s}))({subprocess:e,encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:d,verboseInfo:f,streamInfo:w}),O=[],T=aY({subprocess:e,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:f}),x=a0(m,e,w),j=a1(h,w);try{return await Promise.race([Promise.all([{},ie(y),Promise.all(v),S,T,rw(e,c),...x,...j]),g,a3(e,b),...0===i||void 0===i?[]:[rb(e,i,p,b)],...(({subprocess:e,cancelSignal:t,gracefulCancel:r,context:n,controller:o})=>void 0===t||r?[]:[tw(e,t,n,o)])({subprocess:e,cancelSignal:a,gracefulCancel:s,context:p,controller:b}),...(({subprocess:e,cancelSignal:t,gracefulCancel:r,forceKillAfterDelay:n,context:o,controller:i})=>r?[rm({subprocess:e,cancelSignal:t,forceKillAfterDelay:n,context:o,controller:i})]:[])({subprocess:e,cancelSignal:a,gracefulCancel:s,forceKillAfterDelay:l,context:p,controller:b})])}catch(e){return p.terminationReason??="other",Promise.all([{error:e},y,Promise.all(v.map(e=>aU(e))),aU(S),aQ(T,O),Promise.allSettled(x),Promise.allSettled(j)])}},a0=(e,t,r)=>e.map((e,n)=>e===t.stdio[n]?void 0:aN(e,n,r)),a1=(e,t)=>e.flatMap(({stdioItems:e},r)=>e.filter(({value:e,stream:t=e})=>rU(t,{checkOpen:!1})&&!J(t)).map(({type:e,value:n,stream:o=n})=>aN(o,r,t,{isSameDirection:nE.has(e),stopOnExit:"native"===e}))),a3=async(e,{signal:t})=>{let[r]=await (0,tb.once)(e,"error",{signal:t});throw r},a2=(e,t,r)=>{let n=e[r];n.has(t)||n.set(t,[]);let o=n.get(t),i=tP();return o.push(i),{resolve:i.resolve.bind(i),promises:o}},a8=async({resolve:e,promises:t},r)=>{e();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...t])]);return!n},a5=async e=>{if(void 0!==e)try{await a6(e)}catch{}},a4=async e=>{if(void 0!==e)try{await a9(e)}catch{}},a6=async e=>{await (0,f.finished)(e,{cleanup:!0,readable:!1,writable:!0})},a9=async e=>{await (0,f.finished)(e,{cleanup:!0,readable:!0,writable:!1})},a7=async(e,t)=>{if(await e,t)throw t},se=(e,t,r)=>{r&&!az(r)?e.destroy(r):t&&e.destroy()},st=({subprocess:e,concurrentStreams:t,encoding:r},{from:n,binary:o=!0,preserveNewlines:i=!0}={})=>{let a=o||rS.has(r),{subprocessStdout:s,waitReadableDestroy:l}=sr(e,n,t),{readableEncoding:d,readableObjectMode:u,readableHighWaterMark:c}=sn(s,a),{read:p,onStdoutDataDone:f}=so({subprocessStdout:s,subprocess:e,binary:a,encoding:r,preserveNewlines:i}),h=new oH.Readable({read:p,destroy:(0,ee.callbackify)(ss.bind(void 0,{subprocessStdout:s,subprocess:e,waitReadableDestroy:l})),highWaterMark:c,objectMode:u,encoding:d});return sa({subprocessStdout:s,onStdoutDataDone:f,readable:h,subprocess:e}),h},sr=(e,t,r)=>{let n=tM(e,t),o=a2(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:o}},sn=({readableEncoding:e,readableObjectMode:t,readableHighWaterMark:r},n)=>n?{readableEncoding:e,readableObjectMode:t,readableHighWaterMark:r}:{readableEncoding:e,readableObjectMode:!0,readableHighWaterMark:aP},so=({subprocessStdout:e,subprocess:t,binary:r,encoding:n,preserveNewlines:o})=>{let i=tP(),a=aj({subprocessStdout:e,subprocess:t,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:o});return{read(){si(this,a,i)},onStdoutDataDone:i}},si=async(e,t,r)=>{try{let{value:n,done:o}=await t.next();o?r.resolve():e.push(n)}catch{}},sa=async({subprocessStdout:e,onStdoutDataDone:t,readable:r,subprocess:n,subprocessStdin:o})=>{try{await a9(e),await n,await a5(o),await t,r.readable&&r.push(null)}catch(e){await a5(o),sl(r,e)}},ss=async({subprocessStdout:e,subprocess:t,waitReadableDestroy:r},n)=>{await a8(r,t)&&(sl(e,n),await a7(t,n))},sl=(e,t)=>{se(e,e.readable,t)},sd=({subprocess:e,concurrentStreams:t},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:o,waitWritableDestroy:i}=su(e,r,t),a=new oH.Writable({...sc(n,e,o),destroy:(0,ee.callbackify)(sm.bind(void 0,{subprocessStdin:n,subprocess:e,waitWritableFinal:o,waitWritableDestroy:i})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return sh(n,a),a},su=(e,t,r)=>{let n=tA(e,t),o=a2(r,n,"writableFinal"),i=a2(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:o,waitWritableDestroy:i}},sc=(e,t,r)=>({write:sp.bind(void 0,e),final:(0,ee.callbackify)(sf.bind(void 0,e,t,r))}),sp=(e,t,r,n)=>{e.write(t,r)?n():e.once("drain",n)},sf=async(e,t,r)=>{await a8(r,t)&&(e.writable&&e.end(),await t)},sh=async(e,t,r)=>{try{await a6(e),t.writable&&t.end()}catch(e){await a4(r),sg(t,e)}},sm=async({subprocessStdin:e,subprocess:t,waitWritableFinal:r,waitWritableDestroy:n},o)=>{await a8(r,t),await a8(n,t)&&(sg(e,o),await a7(t,o))},sg=(e,t)=>{se(e,e.writable,t)},sb=({subprocess:e,concurrentStreams:t,encoding:r},{from:n,to:o,binary:i=!0,preserveNewlines:a=!0}={})=>{let s=i||rS.has(r),{subprocessStdout:l,waitReadableDestroy:d}=sr(e,n,t),{subprocessStdin:u,waitWritableFinal:c,waitWritableDestroy:p}=su(e,o,t),{readableEncoding:f,readableObjectMode:h,readableHighWaterMark:m}=sn(l,s),{read:g,onStdoutDataDone:b}=so({subprocessStdout:l,subprocess:e,binary:s,encoding:r,preserveNewlines:a}),y=new oH.Duplex({read:g,...sc(u,e,c),destroy:(0,ee.callbackify)(sy.bind(void 0,{subprocessStdout:l,subprocessStdin:u,subprocess:e,waitReadableDestroy:d,waitWritableFinal:c,waitWritableDestroy:p})),readableHighWaterMark:m,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:h,writableObjectMode:u.writableObjectMode,encoding:f});return sa({subprocessStdout:l,onStdoutDataDone:b,readable:y,subprocess:e,subprocessStdin:u}),sh(u,y,l),y},sy=async({subprocessStdout:e,subprocessStdin:t,subprocess:r,waitReadableDestroy:n,waitWritableFinal:o,waitWritableDestroy:i},a)=>{await Promise.all([ss({subprocessStdout:e,subprocess:r,waitReadableDestroy:n},a),sm({subprocessStdin:t,subprocess:r,waitWritableFinal:o,waitWritableDestroy:i},a)])},sw=(e,t,{from:r,binary:n=!1,preserveNewlines:o=!1}={})=>{let i=n||rS.has(t),a=tM(e,r);return sv(aj({subprocessStdout:a,subprocess:e,binary:i,shouldEncode:!0,encoding:t,preserveNewlines:o}),a,e)},sv=async function*(e,t,r){try{yield*e}finally{t.readable&&t.destroy(),await r}},sS=(async()=>{})().constructor.prototype,sO=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(sS,e)]),sT=({timeout:e,signal:t,...r})=>{if(void 0!==t)throw TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:e}},sx=async({subprocess:e,options:t,startTime:r,verboseInfo:n,fileDescriptors:o,originalStreams:i,command:a,escapedCommand:s,context:l,onInternalError:d,controller:u})=>{let[c,[p,f],h,m,g]=await aZ({subprocess:e,options:t,context:l,verboseInfo:n,fileDescriptors:o,originalStreams:i,onInternalError:d,controller:u});u.abort(),d.resolve();let b=sj({errorInfo:c,exitCode:p,signal:f,stdio:h.map((e,r)=>ou(e,t,r)),all:ou(m,t,"all"),ipcOutput:g,context:l,options:t,command:a,escapedCommand:s,startTime:r});return nl(b,n,t)},sj=({errorInfo:e,exitCode:t,signal:r,stdio:n,all:o,ipcOutput:i,context:a,options:s,command:l,escapedCommand:d,startTime:u})=>"error"in e?nt({error:e.error,command:l,escapedCommand:d,timedOut:"timeout"===a.terminationReason,isCanceled:"cancel"===a.terminationReason||"gracefulCancel"===a.terminationReason,isGracefullyCanceled:"gracefulCancel"===a.terminationReason,isMaxBuffer:e.error instanceof r5,isForcefullyTerminated:a.isForcefullyTerminated,exitCode:t,signal:r,stdio:n,all:o,ipcOutput:i,options:s,startTime:u,isSync:!1}):r7({command:l,escapedCommand:d,stdio:n,all:o,ipcOutput:i,options:s,startTime:u}),sE=(e,t)=>{let r=Object.fromEntries(Object.entries(t).map(([t,r])=>[t,s_(t,e[t],r)]));return{...e,...r}},s_=(e,t,r)=>s$.has(e)&&E(t)&&E(r)?{...t,...r}:r,s$=new Set(["env",...ep]),sD=(e,t,r,n)=>{let o=(e,t,n)=>sD(e,t,r,n),i=(...i)=>sP({mapArguments:e,deepOptions:r,boundOptions:t,setBoundExeca:n,createNested:o},...i);return void 0!==n&&n(i,o,t),i},sP=({mapArguments:e,deepOptions:t={},boundOptions:r={},setBoundExeca:n,createNested:o},i,...a)=>{if(E(i))return o(e,sE(r,i),n);let{file:s,commandArguments:l,options:d,isSync:u}=sA({mapArguments:e,firstArgument:i,nextArguments:a,deepOptions:t,boundOptions:r});return u?((e,t,r)=>{let{file:n,commandArguments:o,command:i,escapedCommand:a,startTime:s,verboseInfo:l,options:d,fileDescriptors:u}=((e,t,r)=>{let{command:n,escapedCommand:o,startTime:i,verboseInfo:a}=eY(e,t,r),{file:s,commandArguments:l,options:d}=r_(e,t,io(r));ii(d);let u=n3(od,d,a,!0);return{file:s,commandArguments:l,command:n,escapedCommand:o,startTime:i,verboseInfo:a,options:d,fileDescriptors:u}})(e,t,r);return nl((({file:e,commandArguments:t,options:r,command:n,escapedCommand:o,verboseInfo:i,fileDescriptors:a,startTime:s})=>{let l=is({file:e,commandArguments:t,options:r,command:n,escapedCommand:o,fileDescriptors:a,startTime:s});if(l.failed)return l;let{resultError:d,exitCode:u,signal:c,timedOut:p,isMaxBuffer:f}=(({error:e,status:t,signal:r,output:n},{maxBuffer:o})=>{let i,a,s,l=(i=e,a=t,s=r,void 0!==i?i:ir(a,s)?new e1:void 0),d=l?.code==="ETIMEDOUT",u=l?.code==="ENOBUFS"&&null!==n&&n.some(e=>null!==e&&e.length>(([,e])=>e)(o));return{resultError:l,exitCode:t,signal:r,timedOut:d,isMaxBuffer:u}})(l,r),{output:h,error:m=d}=(({fileDescriptors:e,syncResult:{output:t},options:r,isMaxBuffer:n,verboseInfo:o})=>{if(null===t)return{output:Array.from({length:3})};let i={},a=new Set([]);return{output:t.map((t,s)=>(({result:e,fileDescriptors:t,fdNumber:r,state:n,outputFiles:o,isMaxBuffer:i,verboseInfo:a},{buffer:s,encoding:l,lines:d,stripFinalNewline:u,maxBuffer:c})=>{if(null===e)return;let p=L(((e,t,r)=>{if(!t)return e;let n=(([,e])=>e)(r);return e.length>n?e.slice(0,n):e})(e,i,c)),{stdioItems:f,objectMode:h}=t[r],{serializedResult:m,finalResult:g=m}=o8({chunks:o2([p],f,l,n),objectMode:h,encoding:l,lines:d,stripFinalNewline:u,fdNumber:r});o5({serializedResult:m,fdNumber:r,state:n,verboseInfo:a,encoding:l,stdioItems:f,objectMode:h});let b=s[r]?g:void 0;try{return void 0===n.error&&o4(m,f,o),b}catch(e){return n.error=e,b}})({result:t,fileDescriptors:e,fdNumber:s,state:i,outputFiles:a,isMaxBuffer:n,verboseInfo:o},r)),...i}})({fileDescriptors:a,syncResult:l,options:r,isMaxBuffer:f,verboseInfo:i});return id({error:m,exitCode:u,signal:c,timedOut:p,isMaxBuffer:f,stdio:h.map((e,t)=>ou(e,r,t)),all:ou((([,e,t],r)=>{if(r.all)return void 0===e?t:void 0===t?e:Array.isArray(e)?Array.isArray(t)?[...e,...t]:[...e,ou(t,r,"all")]:Array.isArray(t)?[ou(e,r,"all"),...t]:C(e)&&C(t)?F([e,t]):`${e}${t}`})(h,r),r,"all"),options:r,command:n,escapedCommand:o,startTime:s})})({file:n,commandArguments:o,options:d,command:i,escapedCommand:a,verboseInfo:l,fileDescriptors:u,startTime:s}),l,d)})(s,l,d):((e,t,r,n)=>{let{file:o,commandArguments:i,command:a,escapedCommand:s,startTime:l,verboseInfo:d,options:u,fileDescriptors:p}=((e,t,r)=>{let{command:n,escapedCommand:o,startTime:i,verboseInfo:a}=eY(e,t,r),{file:s,commandArguments:l,options:d}=r_(e,t,r),u=sT(d),c=n3(iP,u,a,!1);return{file:s,commandArguments:l,command:n,escapedCommand:o,startTime:i,verboseInfo:a,options:u,fileDescriptors:c}})(e,t,r),{subprocess:f,promise:h}=(({file:e,commandArguments:t,options:r,startTime:n,verboseInfo:o,command:i,escapedCommand:a,fileDescriptors:s})=>{let l;try{l=(0,c.spawn)(...rP(e,t,r))}catch(e){return(({error:e,command:t,escapedCommand:r,fileDescriptors:n,options:o,startTime:i,verboseInfo:a})=>{var s,l;let d,u,p,f,h,m;oo(n);let g=new c.ChildProcess;return s=g,l=n,d=iT(),u=iT(),p=iT(),f=Array.from({length:l.length-3},iT),h=iT(),m=[d,u,p,...f],Object.assign(s,{stdin:d,stdout:u,stderr:p,all:h,stdio:m}),Object.assign(g,{readable:ix,writable:ij,duplex:iE}),{subprocess:g,promise:i_(ne({error:e,command:t,escapedCommand:r,fileDescriptors:n,options:o,startTime:i,isSync:!1}),a,o)}})({error:e,command:i,escapedCommand:a,fileDescriptors:s,options:r,startTime:n,verboseInfo:o})}let d=new AbortController;(0,tb.setMaxListeners)(1/0,d.signal);let u=[...l.stdio];var p=l;let f=new Map;for(let[e,{stdioItems:t,direction:r}]of Object.entries(s)){for(let{stream:n}of t.filter(({type:e})=>nE.has(e)))i3(p,n,r,e);for(let{stream:n}of t.filter(({type:e})=>!nE.has(e)))i8({subprocess:p,stream:n,direction:r,fdNumber:e,pipeGroups:f,controller:d})}for(let[e,t]of f.entries())iY(1===t.length?t[0]:iA(t),e);((e,{cleanup:t,detached:r},{signal:n})=>{if(!t||r)return;let o=m(()=>{e.kill()});(0,tb.addAbortListener)(n,()=>{o()})})(l,r,d);let h={},g=tP();l.kill=tp.bind(void 0,{kill:l.kill.bind(l),options:r,onInternalError:g,context:h,controller:d}),l.all=(({stdout:e,stderr:t},{all:r})=>r&&(e||t)?iA([e,t].filter(Boolean)):void 0)(l,r),((e,{encoding:t})=>{let r={readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap};e.readable=st.bind(void 0,{subprocess:e,concurrentStreams:r,encoding:t}),e.writable=sd.bind(void 0,{subprocess:e,concurrentStreams:r}),e.duplex=sb.bind(void 0,{subprocess:e,concurrentStreams:r,encoding:t}),e.iterable=sw.bind(void 0,e,t),e[Symbol.asyncIterator]=sw.bind(void 0,e,t,{})})(l,r),((e,{ipc:t})=>{Object.assign(e,iO(e,!1,t))})(l,r);let b=sx({subprocess:l,options:r,startTime:n,verboseInfo:o,fileDescriptors:s,originalStreams:u,command:i,escapedCommand:a,context:h,onInternalError:g,controller:d});return{subprocess:l,promise:b}})({file:o,commandArguments:i,options:u,startTime:l,verboseInfo:d,command:a,escapedCommand:s,fileDescriptors:p});f.pipe=ai.bind(void 0,{source:f,sourcePromise:h,boundOptions:{},createNested:n});for(let[e,t]of sO){let r=t.value.bind(h);Reflect.defineProperty(f,e,{...t,value:r})}return tk.set(f,{options:u,fileDescriptors:p}),f})(s,l,d,o)},sA=({mapArguments:e,firstArgument:t,nextArguments:r,deepOptions:n,boundOptions:o})=>{let[i,a,s]=M(...Array.isArray(t)&&Array.isArray(t.raw)?((e,t)=>{let r=[];for(let[n,o]of e.entries())r=G({templates:e,expressions:t,tokens:r,index:n,template:o});if(0===r.length)throw TypeError("Template script must not be empty");let[n,...o]=r;return[n,o,{}]})(t,r):[t,...r]),l=sE(sE(n,o),s),{file:d=i,commandArguments:u=a,options:c=l,isSync:p=!1}=e({file:i,commandArguments:a,options:l});return{file:d,commandArguments:u,options:c,isSync:p}},sM=(e,t)=>{if(t.length>0)throw TypeError(`The command and its arguments must be passed as a single string: ${e} ${t}.`);let[r,...n]=sk(e);return{file:r,commandArguments:n}},sk=e=>{if("string"!=typeof e)throw TypeError(`The command must be a string: ${String(e)}.`);let t=e.trim();if(""===t)return[];let r=[];for(let e of t.split(sR)){let t=r.at(-1);t&&t.endsWith("\\")?r[r.length-1]=`${t.slice(0,-1)} ${e}`:r.push(e)}return r},sR=/ +/g,sC=({options:e})=>({...sL(e),isSync:!0}),sL=e=>({options:{...sB(e),...e}}),sB=({input:e,inputFile:t,stdio:r})=>void 0===e&&void 0===t&&void 0===r?{stdin:"inherit"}:{},sU=sD(()=>({}));sD(()=>({isSync:!0}));let sI=sD(({file:e,commandArguments:t})=>sM(e,t));sD(({file:e,commandArguments:t})=>({...sM(e,t),isSync:!0})),sD(({options:e})=>{if(!1===e.node)throw TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...e,node:!0}}}),sD(({options:e})=>sL(e),{},{preferLocal:!0},(e,t,r)=>{e.sync=t(sC,r),e.s=e.sync});let{sendMessage:sN,getOneMessage:sF,getEachMessage:sW,getCancelSignal:sG}=(s=void 0!==u.channel,{...iO(u,!0,s),getCancelSignal:rl.bind(void 0,{anyProcess:u,channel:u.channel,isSubprocess:!0,ipc:s})}),sH=/\{\{\s*([^{}\s]+)\s*\}\}/g;function sV(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function sq(e,t){if(void 0!==e&&"string"!=typeof e)throw Error(`字段 ${t} 必须是字符串`)}function sz(e){if(!sV(e))throw Error("Scene 内容必须是 JSON 对象");if("page"!==e.type&&"widget"!==e.type&&"tool"!==e.type)throw Error("字段 type 必须是 page、widget 或 tool");if(sq(e.id,"id"),sq(e.url,"url"),sq(e.botId,"botId"),"page"===e.type){if(!e.url?.trim())throw Error("Page Scene 必须配置 url");if(void 0!==e.id)throw Error("Page Scene 不支持 id,请使用 url")}else if(!e.id?.trim())throw Error(`${"widget"===e.type?"Widget":"Tool"} Scene 必须配置 id`);if(void 0!==e.input&&!sV(e.input))throw Error("字段 input 必须是 JSON 对象");if(void 0!==e.variables){if(!sV(e.variables))throw Error("字段 variables 必须是 JSON 对象");for(let[t,r]of Object.entries(e.variables))if(null!==r&&"string"!=typeof r)throw Error(`变量 ${t} 的默认值必须是字符串或 null`)}if(void 0!==e.settings&&"string"!=typeof e.settings&&!sV(e.settings))throw Error("字段 settings 必须是字符串或 JSON 对象");return e}function sK(e){return Object.entries(e.variables||{})}function sX(e){return"string"==typeof e?e:JSON.stringify(e)}function sJ(e,t={}){let r={...e.input||{},...function(e,t={}){let r={};for(let[n,o]of sK(e))Object.prototype.hasOwnProperty.call(t,n)?r[n]=t[n]:null!==o&&(r[n]=o);return{...r,...t}}(e,t)};if("page"===e.type){let t=function(e,t){var r;let n=new Set(Array.from(e.url.matchAll(sH),e=>e[1])),o=(r=e.url,r.replace(sH,(e,r)=>{if(!Object.prototype.hasOwnProperty.call(t,r))return e;let n=sX(t[r]);return void 0===n?e:encodeURIComponent(n)})),i=o.indexOf("#"),a=i<0?o:o.slice(0,i),s=i<0?"":o.slice(i),l=a.indexOf("?"),d=new Set(new URLSearchParams(l<0?"":a.slice(l+1)).keys()),u=new URLSearchParams;for(let[e,r]of Object.entries(t)){if(n.has(e)||d.has(e))continue;let t=sX(r);void 0!==t&&u.set(e,t)}let c=u.toString();if(!c)return o;let p=l<0?"?":a.endsWith("?")||a.endsWith("&")?"":"&";return`${a}${p}${c}${s}`}(e,r);return{type:"page",unresolvedVariables:function(e){let t=new Set;for(let r of e.matchAll(sH))t.add(r[1]);return Array.from(t)}(t),url:t}}return"widget"===e.type?{type:"widget",id:e.id,resolvedInput:r,botId:e.botId}:{type:"tool",id:e.id,resolvedInput:r}}function sY(e){return e.replaceAll("\\","/").replace(/^src\//,"").replace(/\.(?:bundle|tsx?|jsx?)$/,"")}(n=e||(e={})).REACT_LYNX="lynx",n.LYNX="lynx";let sQ={REACT_LYNX:e.REACT_LYNX,LYNX:e.LYNX};(o=t||(t={}))[o.INBOX=0]="INBOX",o[o.FULL_BOX=3]="FULL_BOX",o[o.CUSTOM_BOX=4]="CUSTOM_BOX",(i=r||(r={}))[i.NORMAL=0]="NORMAL",i[i.FLOAT=1]="FLOAT",i[i.NONE=2]="NONE";let sZ={NONE:r.NONE,NORMAL:r.NORMAL,FLOAT:r.FLOAT},s0={INBOX:t.INBOX,FULL_BOX:t.FULL_BOX,CUSTOM_BOX:t.CUSTOM_BOX},s1={definePrivacyLoginWidget:{id:"mcp-privacy-login-card",name:"应用插件同意登录和隐私协议卡片",description:"展示应用插件同意登录和隐私协议的卡片组件"},defineLoginPage:{id:"mcp-login-page",name:"应用插件登录页面",path:"/pages/mcp-login-page/index",description:"展示应用插件登录页面"}};function s3(e){return"object"==typeof e&&e?.tool_call?e:void 0}function s2(e,t={}){let r=String(e??"").trim();if(!r)return;let n=function(e,{addProtocolToBareHost:t=!1,allowRootRelative:r=!1,defaultProtocol:n="http"}={}){var o;if(/^https?:\/\//i.test(e))return e;if(e.startsWith("//"))return`${s8(n,e.slice(2))}:${e}`;if(r&&e.startsWith("/"))return e;return/^(?:\[[^\]]+\]|[a-z0-9.-]+):\d+(?:[/?#]|$)/i.test(e)||t&&(o=e,/^(?:\[[^\]]+\]|[a-z0-9.-]+)(?:[/?#]|$)/i.test(o))?`${s8(n,e)}://${e}`:e}(r,t);try{let e=t.baseUrl?new URL(n,t.baseUrl):new URL(n);if("http:"!==e.protocol&&"https:"!==e.protocol)return;return e.toString()}catch{return}}function s8(e,t){return"function"==typeof e?e(t):e}function s5(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}let s4="developer.doubao.com",s6=`https://${s4}`;export{s4 as APP_DEVELOPER_DOMAIN,s6 as APP_DEVELOPER_ORIGIN,s1 as AUTH_META,s0 as BoxType,r5 as MaxBufferError,sQ as RenderType,T as TeaUploader,sZ as TitleType,eR as bold,sU as execa,sI as execaCommand,sK as getDebugSceneVariableEntries,af as getStreamAsArray,am as getStreamAsArrayBuffer,aO as getStreamAsString,eC as gray,x as isBrowser,rF as isDuplexStream,E as isPlainObject,rN as isReadableStream,s5 as isRecord,rU as isStream,eE as isUnicodeSupported,rI as isWritableStream,iA as mergeStreams,eA as node_modules_figures,s2 as normalizeHttpEndpoint,sY as normalizeWidgetSourceEntry,e0 as npmRunPathEnv,sz as parseDebugScene,s3 as parseSandboxSimulatorToolCallEvent,ns as prettyMilliseconds,eL as redBright,sJ as resolveDebugScene,tr as signalsByName,rA as strip_final_newline_stripFinalNewline,eB as yellowBright};
|
package/dist/6686~0.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as e}from"node:module";import{__webpack_require__ as o}from"./rslib-runtime~0.js";let t=e(import.meta.url);o.add({"node:async_hooks"(e){e.exports=t("node:async_hooks")},"node:crypto"(e){e.exports=t("node:crypto")},"node:events"(e){e.exports=t("node:events")},"node:os"(e){e.exports=t("node:os")},"node:url"(e){e.exports=t("node:url")},"node:util"(e){e.exports=t("node:util")},tty(e){e.exports=t("tty")}});let n=t("node:timers/promises"),s=t("node:child_process"),r=t("node:process"),d=t("node:tty"),p=t("node:readline");export{s as external_node_child_process_namespaceObject,r as external_node_process_namespaceObject,p as external_node_readline_namespaceObject,d as external_node_tty_namespaceObject,n as promises_namespaceObject};
|
package/dist/8348~0.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as e}from"node:module";import{__webpack_require__ as o}from"./rslib-runtime~0.js";let t=e(import.meta.url);o.add({"node:fs"(e){e.exports=t("node:fs")},"node:path"(e){e.exports=t("node:path")}});let d=t("node:module");export{d as external_node_module_namespaceObject};
|