@abhi-arya1/wt 0.0.4 → 0.0.6

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/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright 2026 Abhigyan Arya
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -58,6 +58,7 @@ You're in a git repo. You want an isolated copy to mess around in without touchi
58
58
  ```bash
59
59
  wt local my-experiment --enter
60
60
  # you're now in a worktree at .wt/sandboxes/my-experiment
61
+ # type `exit` to leave the sandbox shell
61
62
 
62
63
  # or just let it pick the name from your current branch
63
64
  wt local --enter
@@ -82,6 +83,10 @@ wt gc --older-than 1d # more aggressive
82
83
  wt gc --dry-run # see what would get deleted
83
84
  ```
84
85
 
86
+ ### Agent Usage
87
+
88
+ If you are using an agent to make sandboxes for multiple agents to work within them, you can install `wt` then give agents the [`SKILL.md`](./SKILL.md) file. This will allow them to understand usage of `wt` and create sandboxes on your behalf.
89
+
85
90
  ## Guides
86
91
 
87
92
  ### Setting up a remote host from scratch
@@ -216,6 +221,32 @@ wt host add internal-box --ssh internal-box --root /srv/wt
216
221
 
217
222
  wt will connect through the bastion transparently. The same applies to `ProxyCommand`, custom `ControlMaster` settings, or any other OpenSSH config directives.
218
223
 
224
+ ### Pushing and creating PRs from a sandbox
225
+
226
+ Sandboxes are regular git worktrees — standard git commands work as expected. Push branches and create PRs the same way you normally would:
227
+
228
+ ```bash
229
+ wt enter my-sandbox
230
+
231
+ git checkout -b my-feature
232
+ # make changes
233
+ git add .
234
+ git commit -m "my changes"
235
+ git push -u origin my-feature
236
+
237
+ # create a PR with the GitHub CLI
238
+ gh pr create --title "My feature" --body "Description of changes"
239
+ ```
240
+
241
+ You can also do this without entering the sandbox:
242
+
243
+ ```bash
244
+ wt run my-sandbox -- git push -u origin my-feature
245
+ wt run my-sandbox -- gh pr create --title "My feature" --body "Description"
246
+ ```
247
+
248
+ **Note:** Because `wt` uses `git clone --bare --mirror`, the mirror fetches all remote refs including GitHub's internal PR refs (`refs/pull/*/head`). A plain `git push` with no arguments may try to push these back and produce harmless `remote rejected` errors. To avoid this, push specific branches explicitly (`git push origin my-branch`) or set `git config --global push.default current`.
249
+
219
250
  ### Using with tmux sessions
220
251
 
221
252
  Every sandbox can have a tmux session tied to it. Sessions are named `wt-<sandboxId>`.
@@ -230,7 +261,7 @@ wt sessions --host prod-box # list sessions on a remote host
230
261
 
231
262
  ### `wt up [name]`
232
263
 
233
- Create a sandbox worktree on a host. If `name` is omitted, it defaults to the branch name from `-b` / `--ref`, or the current branch.
264
+ Create a sandbox worktree on a host. If `name` is omitted, it defaults to the branch name from `-b` / `--ref`, or the current branch. When `-b` is not provided, the sandbox stays on the same branch you're currently on.
234
265
 
235
266
  | Flag | Description |
236
267
  |---|---|
@@ -421,3 +452,10 @@ Every command that produces structured output supports `--json`. Errors in JSON
421
452
  ```
422
453
 
423
454
  This makes it straightforward to compose `wt` with other tools, scripts, or agents.
455
+
456
+ ## Future Plans
457
+
458
+ Unsure if this will be added, but I'd like to add:
459
+ - Cloud provider abstractions (AWS, Fly.io, etc.)
460
+ - Automatic download for sandbox dependencies
461
+ - Better observability, error handling, cleanup, and devex
package/dist/index.js CHANGED
@@ -1,65 +1,65 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- var LE=Object.create;var{getPrototypeOf:YE,defineProperty:EF,getOwnPropertyNames:QE}=Object;var KE=Object.prototype.hasOwnProperty;var dD=(D,u,F)=>{F=D!=null?LE(YE(D)):{};let E=u||!D||!D.__esModule?EF(F,"default",{value:D,enumerable:!0}):F;for(let C of QE(D))if(!KE.call(E,C))EF(E,C,{get:()=>D[C],enumerable:!0});return E};var V=(D,u)=>()=>(u||D((u={exports:{}}).exports,u),u.exports);var s=import.meta.require;var cD=V((WE)=>{class ru extends Error{constructor(D,u,F){super(F);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=u,this.exitCode=D,this.nestedError=void 0}}class CF extends ru{constructor(D){super(1,"commander.invalidArgument",D);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}WE.CommanderError=ru;WE.InvalidArgumentError=CF});var $u=V((mE)=>{var{InvalidArgumentError:VE}=cD();class BF{constructor(D,u){switch(this.description=u||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,D[0]){case"<":this.required=!0,this._name=D.slice(1,-1);break;case"[":this.required=!1,this._name=D.slice(1,-1);break;default:this.required=!0,this._name=D;break}if(this._name.endsWith("..."))this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_collectValue(D,u){if(u===this.defaultValue||!Array.isArray(u))return[D];return u.push(D),u}default(D,u){return this.defaultValue=D,this.defaultValueDescription=u,this}argParser(D){return this.parseArg=D,this}choices(D){return this.argChoices=D.slice(),this.parseArg=(u,F)=>{if(!this.argChoices.includes(u))throw new VE(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(u,F);return u},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function kE(D){let u=D.name()+(D.variadic===!0?"...":"");return D.required?"<"+u+">":"["+u+"]"}mE.Argument=BF;mE.humanReadableArgName=kE});var bu=V((oE)=>{var{humanReadableArgName:vE}=$u();class tF{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(D){this.helpWidth=this.helpWidth??D.helpWidth??80}visibleCommands(D){let u=D.commands.filter((E)=>!E._hidden),F=D._getHelpCommand();if(F&&!F._hidden)u.push(F);if(this.sortSubcommands)u.sort((E,C)=>{return E.name().localeCompare(C.name())});return u}compareOptions(D,u){let F=(E)=>{return E.short?E.short.replace(/^-/,""):E.long.replace(/^--/,"")};return F(D).localeCompare(F(u))}visibleOptions(D){let u=D.options.filter((E)=>!E.hidden),F=D._getHelpOption();if(F&&!F.hidden){let E=F.short&&D._findOption(F.short),C=F.long&&D._findOption(F.long);if(!E&&!C)u.push(F);else if(F.long&&!C)u.push(D.createOption(F.long,F.description));else if(F.short&&!E)u.push(D.createOption(F.short,F.description))}if(this.sortOptions)u.sort(this.compareOptions);return u}visibleGlobalOptions(D){if(!this.showGlobalOptions)return[];let u=[];for(let F=D.parent;F;F=F.parent){let E=F.options.filter((C)=>!C.hidden);u.push(...E)}if(this.sortOptions)u.sort(this.compareOptions);return u}visibleArguments(D){if(D._argsDescription)D.registeredArguments.forEach((u)=>{u.description=u.description||D._argsDescription[u.name()]||""});if(D.registeredArguments.find((u)=>u.description))return D.registeredArguments;return[]}subcommandTerm(D){let u=D.registeredArguments.map((F)=>vE(F)).join(" ");return D._name+(D._aliases[0]?"|"+D._aliases[0]:"")+(D.options.length?" [options]":"")+(u?" "+u:"")}optionTerm(D){return D.flags}argumentTerm(D){return D.name()}longestSubcommandTermLength(D,u){return u.visibleCommands(D).reduce((F,E)=>{return Math.max(F,this.displayWidth(u.styleSubcommandTerm(u.subcommandTerm(E))))},0)}longestOptionTermLength(D,u){return u.visibleOptions(D).reduce((F,E)=>{return Math.max(F,this.displayWidth(u.styleOptionTerm(u.optionTerm(E))))},0)}longestGlobalOptionTermLength(D,u){return u.visibleGlobalOptions(D).reduce((F,E)=>{return Math.max(F,this.displayWidth(u.styleOptionTerm(u.optionTerm(E))))},0)}longestArgumentTermLength(D,u){return u.visibleArguments(D).reduce((F,E)=>{return Math.max(F,this.displayWidth(u.styleArgumentTerm(u.argumentTerm(E))))},0)}commandUsage(D){let u=D._name;if(D._aliases[0])u=u+"|"+D._aliases[0];let F="";for(let E=D.parent;E;E=E.parent)F=E.name()+" "+F;return F+u+" "+D.usage()}commandDescription(D){return D.description()}subcommandDescription(D){return D.summary()||D.description()}optionDescription(D){let u=[];if(D.argChoices)u.push(`choices: ${D.argChoices.map((F)=>JSON.stringify(F)).join(", ")}`);if(D.defaultValue!==void 0){if(D.required||D.optional||D.isBoolean()&&typeof D.defaultValue==="boolean")u.push(`default: ${D.defaultValueDescription||JSON.stringify(D.defaultValue)}`)}if(D.presetArg!==void 0&&D.optional)u.push(`preset: ${JSON.stringify(D.presetArg)}`);if(D.envVar!==void 0)u.push(`env: ${D.envVar}`);if(u.length>0){let F=`(${u.join(", ")})`;if(D.description)return`${D.description} ${F}`;return F}return D.description}argumentDescription(D){let u=[];if(D.argChoices)u.push(`choices: ${D.argChoices.map((F)=>JSON.stringify(F)).join(", ")}`);if(D.defaultValue!==void 0)u.push(`default: ${D.defaultValueDescription||JSON.stringify(D.defaultValue)}`);if(u.length>0){let F=`(${u.join(", ")})`;if(D.description)return`${D.description} ${F}`;return F}return D.description}formatItemList(D,u,F){if(u.length===0)return[];return[F.styleTitle(D),...u,""]}groupItems(D,u,F){let E=new Map;return D.forEach((C)=>{let B=F(C);if(!E.has(B))E.set(B,[])}),u.forEach((C)=>{let B=F(C);if(!E.has(B))E.set(B,[]);E.get(B).push(C)}),E}formatHelp(D,u){let F=u.padWidth(D,u),E=u.helpWidth??80;function C(x,H){return u.formatItem(x,F,H,u)}let B=[`${u.styleTitle("Usage:")} ${u.styleUsage(u.commandUsage(D))}`,""],t=u.commandDescription(D);if(t.length>0)B=B.concat([u.boxWrap(u.styleCommandDescription(t),E),""]);let $=u.visibleArguments(D).map((x)=>{return C(u.styleArgumentTerm(u.argumentTerm(x)),u.styleArgumentDescription(u.argumentDescription(x)))});if(B=B.concat(this.formatItemList("Arguments:",$,u)),this.groupItems(D.options,u.visibleOptions(D),(x)=>x.helpGroupHeading??"Options:").forEach((x,H)=>{let R=x.map((w)=>{return C(u.styleOptionTerm(u.optionTerm(w)),u.styleOptionDescription(u.optionDescription(w)))});B=B.concat(this.formatItemList(H,R,u))}),u.showGlobalOptions){let x=u.visibleGlobalOptions(D).map((H)=>{return C(u.styleOptionTerm(u.optionTerm(H)),u.styleOptionDescription(u.optionDescription(H)))});B=B.concat(this.formatItemList("Global Options:",x,u))}return this.groupItems(D.commands,u.visibleCommands(D),(x)=>x.helpGroup()||"Commands:").forEach((x,H)=>{let R=x.map((w)=>{return C(u.styleSubcommandTerm(u.subcommandTerm(w)),u.styleSubcommandDescription(u.subcommandDescription(w)))});B=B.concat(this.formatItemList(H,R,u))}),B.join(`
4
- `)}displayWidth(D){return $F(D).length}styleTitle(D){return D}styleUsage(D){return D.split(" ").map((u)=>{if(u==="[options]")return this.styleOptionText(u);if(u==="[command]")return this.styleSubcommandText(u);if(u[0]==="["||u[0]==="<")return this.styleArgumentText(u);return this.styleCommandText(u)}).join(" ")}styleCommandDescription(D){return this.styleDescriptionText(D)}styleOptionDescription(D){return this.styleDescriptionText(D)}styleSubcommandDescription(D){return this.styleDescriptionText(D)}styleArgumentDescription(D){return this.styleDescriptionText(D)}styleDescriptionText(D){return D}styleOptionTerm(D){return this.styleOptionText(D)}styleSubcommandTerm(D){return D.split(" ").map((u)=>{if(u==="[options]")return this.styleOptionText(u);if(u[0]==="["||u[0]==="<")return this.styleArgumentText(u);return this.styleSubcommandText(u)}).join(" ")}styleArgumentTerm(D){return this.styleArgumentText(D)}styleOptionText(D){return D}styleArgumentText(D){return D}styleSubcommandText(D){return D}styleCommandText(D){return D}padWidth(D,u){return Math.max(u.longestOptionTermLength(D,u),u.longestGlobalOptionTermLength(D,u),u.longestSubcommandTermLength(D,u),u.longestArgumentTermLength(D,u))}preformatted(D){return/\n[^\S\r\n]/.test(D)}formatItem(D,u,F,E){let B=" ".repeat(2);if(!F)return B+D;let t=D.padEnd(u+D.length-E.displayWidth(D)),$=2,A=(this.helpWidth??80)-u-$-2,x;if(A<this.minWidthToWrap||E.preformatted(F))x=F;else x=E.boxWrap(F,A).replace(/\n/g,`
5
- `+" ".repeat(u+$));return B+t+" ".repeat($)+x.replace(/\n/g,`
6
- ${B}`)}boxWrap(D,u){if(u<this.minWidthToWrap)return D;let F=D.split(/\r\n|\n/),E=/[\s]*[^\s]+/g,C=[];return F.forEach((B)=>{let t=B.match(E);if(t===null){C.push("");return}let $=[t.shift()],n=this.displayWidth($[0]);t.forEach((A)=>{let x=this.displayWidth(A);if(n+x<=u){$.push(A),n+=x;return}C.push($.join(""));let H=A.trimStart();$=[H],n=this.displayWidth(H)}),C.push($.join(""))}),C.join(`
7
- `)}}function $F(D){let u=/\x1b\[\d*(;\d*)*m/g;return D.replace(u,"")}oE.Help=tF;oE.stripColor=$F});var vu=V((sE)=>{var{InvalidArgumentError:gE}=cD();class AF{constructor(D,u){this.flags=D,this.description=u||"",this.required=D.includes("<"),this.optional=D.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(D),this.mandatory=!1;let F=iE(D);if(this.short=F.shortFlag,this.long=F.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(D,u){return this.defaultValue=D,this.defaultValueDescription=u,this}preset(D){return this.presetArg=D,this}conflicts(D){return this.conflictsWith=this.conflictsWith.concat(D),this}implies(D){let u=D;if(typeof D==="string")u={[D]:!0};return this.implied=Object.assign(this.implied||{},u),this}env(D){return this.envVar=D,this}argParser(D){return this.parseArg=D,this}makeOptionMandatory(D=!0){return this.mandatory=!!D,this}hideHelp(D=!0){return this.hidden=!!D,this}_collectValue(D,u){if(u===this.defaultValue||!Array.isArray(u))return[D];return u.push(D),u}choices(D){return this.argChoices=D.slice(),this.parseArg=(u,F)=>{if(!this.argChoices.includes(u))throw new gE(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(u,F);return u},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){if(this.negate)return xF(this.name().replace(/^no-/,""));return xF(this.name())}helpGroup(D){return this.helpGroupHeading=D,this}is(D){return this.short===D||this.long===D}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class HF{constructor(D){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,D.forEach((u)=>{if(u.negate)this.negativeOptions.set(u.attributeName(),u);else this.positiveOptions.set(u.attributeName(),u)}),this.negativeOptions.forEach((u,F)=>{if(this.positiveOptions.has(F))this.dualOptions.add(F)})}valueFromOption(D,u){let F=u.attributeName();if(!this.dualOptions.has(F))return!0;let E=this.negativeOptions.get(F).presetArg,C=E!==void 0?E:!1;return u.negate===(C===D)}}function xF(D){return D.split("-").reduce((u,F)=>{return u+F[0].toUpperCase()+F.slice(1)})}function iE(D){let u,F,E=/^-[^-]$/,C=/^--[^-]/,B=D.split(/[ |,]+/).concat("guard");if(E.test(B[0]))u=B.shift();if(C.test(B[0]))F=B.shift();if(!u&&E.test(B[0]))u=B.shift();if(!u&&C.test(B[0]))u=F,F=B.shift();if(B[0].startsWith("-")){let t=B[0],$=`option creation failed due to '${t}' in option flags '${D}'`;if(/^-[^-][^-]/.test(t))throw Error(`${$}
3
+ var k3=Object.create;var{getPrototypeOf:h3,defineProperty:AF,getOwnPropertyNames:b3}=Object;var v3=Object.prototype.hasOwnProperty;var rD=(D,u,F)=>{F=D!=null?k3(h3(D)):{};let E=u||!D||!D.__esModule?AF(F,"default",{value:D,enumerable:!0}):F;for(let C of b3(D))if(!v3.call(E,C))AF(E,C,{get:()=>D[C],enumerable:!0});return E};var v=(D,u)=>()=>(u||D((u={exports:{}}).exports,u),u.exports);var o=import.meta.require;var pD=v((m3)=>{class du extends Error{constructor(D,u,F){super(F);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=u,this.exitCode=D,this.nestedError=void 0}}class HF extends du{constructor(D){super(1,"commander.invalidArgument",D);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}m3.CommanderError=du;m3.InvalidArgumentError=HF});var xu=v((t3)=>{var{InvalidArgumentError:d3}=pD();class xF{constructor(D,u){switch(this.description=u||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,D[0]){case"<":this.required=!0,this._name=D.slice(1,-1);break;case"[":this.required=!1,this._name=D.slice(1,-1);break;default:this.required=!0,this._name=D;break}if(this._name.endsWith("..."))this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_collectValue(D,u){if(u===this.defaultValue||!Array.isArray(u))return[D];return u.push(D),u}default(D,u){return this.defaultValue=D,this.defaultValueDescription=u,this}argParser(D){return this.parseArg=D,this}choices(D){return this.argChoices=D.slice(),this.parseArg=(u,F)=>{if(!this.argChoices.includes(u))throw new d3(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(u,F);return u},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function c3(D){let u=D.name()+(D.variadic===!0?"...":"");return D.required?"<"+u+">":"["+u+"]"}t3.Argument=xF;t3.humanReadableArgName=c3});var cu=v((i3)=>{var{humanReadableArgName:p3}=xu();class JF{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(D){this.helpWidth=this.helpWidth??D.helpWidth??80}visibleCommands(D){let u=D.commands.filter((E)=>!E._hidden),F=D._getHelpCommand();if(F&&!F._hidden)u.push(F);if(this.sortSubcommands)u.sort((E,C)=>{return E.name().localeCompare(C.name())});return u}compareOptions(D,u){let F=(E)=>{return E.short?E.short.replace(/^-/,""):E.long.replace(/^--/,"")};return F(D).localeCompare(F(u))}visibleOptions(D){let u=D.options.filter((E)=>!E.hidden),F=D._getHelpOption();if(F&&!F.hidden){let E=F.short&&D._findOption(F.short),C=F.long&&D._findOption(F.long);if(!E&&!C)u.push(F);else if(F.long&&!C)u.push(D.createOption(F.long,F.description));else if(F.short&&!E)u.push(D.createOption(F.short,F.description))}if(this.sortOptions)u.sort(this.compareOptions);return u}visibleGlobalOptions(D){if(!this.showGlobalOptions)return[];let u=[];for(let F=D.parent;F;F=F.parent){let E=F.options.filter((C)=>!C.hidden);u.push(...E)}if(this.sortOptions)u.sort(this.compareOptions);return u}visibleArguments(D){if(D._argsDescription)D.registeredArguments.forEach((u)=>{u.description=u.description||D._argsDescription[u.name()]||""});if(D.registeredArguments.find((u)=>u.description))return D.registeredArguments;return[]}subcommandTerm(D){let u=D.registeredArguments.map((F)=>p3(F)).join(" ");return D._name+(D._aliases[0]?"|"+D._aliases[0]:"")+(D.options.length?" [options]":"")+(u?" "+u:"")}optionTerm(D){return D.flags}argumentTerm(D){return D.name()}longestSubcommandTermLength(D,u){return u.visibleCommands(D).reduce((F,E)=>{return Math.max(F,this.displayWidth(u.styleSubcommandTerm(u.subcommandTerm(E))))},0)}longestOptionTermLength(D,u){return u.visibleOptions(D).reduce((F,E)=>{return Math.max(F,this.displayWidth(u.styleOptionTerm(u.optionTerm(E))))},0)}longestGlobalOptionTermLength(D,u){return u.visibleGlobalOptions(D).reduce((F,E)=>{return Math.max(F,this.displayWidth(u.styleOptionTerm(u.optionTerm(E))))},0)}longestArgumentTermLength(D,u){return u.visibleArguments(D).reduce((F,E)=>{return Math.max(F,this.displayWidth(u.styleArgumentTerm(u.argumentTerm(E))))},0)}commandUsage(D){let u=D._name;if(D._aliases[0])u=u+"|"+D._aliases[0];let F="";for(let E=D.parent;E;E=E.parent)F=E.name()+" "+F;return F+u+" "+D.usage()}commandDescription(D){return D.description()}subcommandDescription(D){return D.summary()||D.description()}optionDescription(D){let u=[];if(D.argChoices)u.push(`choices: ${D.argChoices.map((F)=>JSON.stringify(F)).join(", ")}`);if(D.defaultValue!==void 0){if(D.required||D.optional||D.isBoolean()&&typeof D.defaultValue==="boolean")u.push(`default: ${D.defaultValueDescription||JSON.stringify(D.defaultValue)}`)}if(D.presetArg!==void 0&&D.optional)u.push(`preset: ${JSON.stringify(D.presetArg)}`);if(D.envVar!==void 0)u.push(`env: ${D.envVar}`);if(u.length>0){let F=`(${u.join(", ")})`;if(D.description)return`${D.description} ${F}`;return F}return D.description}argumentDescription(D){let u=[];if(D.argChoices)u.push(`choices: ${D.argChoices.map((F)=>JSON.stringify(F)).join(", ")}`);if(D.defaultValue!==void 0)u.push(`default: ${D.defaultValueDescription||JSON.stringify(D.defaultValue)}`);if(u.length>0){let F=`(${u.join(", ")})`;if(D.description)return`${D.description} ${F}`;return F}return D.description}formatItemList(D,u,F){if(u.length===0)return[];return[F.styleTitle(D),...u,""]}groupItems(D,u,F){let E=new Map;return D.forEach((C)=>{let B=F(C);if(!E.has(B))E.set(B,[])}),u.forEach((C)=>{let B=F(C);if(!E.has(B))E.set(B,[]);E.get(B).push(C)}),E}formatHelp(D,u){let F=u.padWidth(D,u),E=u.helpWidth??80;function C(H,J){return u.formatItem(H,F,J,u)}let B=[`${u.styleTitle("Usage:")} ${u.styleUsage(u.commandUsage(D))}`,""],$=u.commandDescription(D);if($.length>0)B=B.concat([u.boxWrap(u.styleCommandDescription($),E),""]);let A=u.visibleArguments(D).map((H)=>{return C(u.styleArgumentTerm(u.argumentTerm(H)),u.styleArgumentDescription(u.argumentDescription(H)))});if(B=B.concat(this.formatItemList("Arguments:",A,u)),this.groupItems(D.options,u.visibleOptions(D),(H)=>H.helpGroupHeading??"Options:").forEach((H,J)=>{let T=H.map((_)=>{return C(u.styleOptionTerm(u.optionTerm(_)),u.styleOptionDescription(u.optionDescription(_)))});B=B.concat(this.formatItemList(J,T,u))}),u.showGlobalOptions){let H=u.visibleGlobalOptions(D).map((J)=>{return C(u.styleOptionTerm(u.optionTerm(J)),u.styleOptionDescription(u.optionDescription(J)))});B=B.concat(this.formatItemList("Global Options:",H,u))}return this.groupItems(D.commands,u.visibleCommands(D),(H)=>H.helpGroup()||"Commands:").forEach((H,J)=>{let T=H.map((_)=>{return C(u.styleSubcommandTerm(u.subcommandTerm(_)),u.styleSubcommandDescription(u.subcommandDescription(_)))});B=B.concat(this.formatItemList(J,T,u))}),B.join(`
4
+ `)}displayWidth(D){return NF(D).length}styleTitle(D){return D}styleUsage(D){return D.split(" ").map((u)=>{if(u==="[options]")return this.styleOptionText(u);if(u==="[command]")return this.styleSubcommandText(u);if(u[0]==="["||u[0]==="<")return this.styleArgumentText(u);return this.styleCommandText(u)}).join(" ")}styleCommandDescription(D){return this.styleDescriptionText(D)}styleOptionDescription(D){return this.styleDescriptionText(D)}styleSubcommandDescription(D){return this.styleDescriptionText(D)}styleArgumentDescription(D){return this.styleDescriptionText(D)}styleDescriptionText(D){return D}styleOptionTerm(D){return this.styleOptionText(D)}styleSubcommandTerm(D){return D.split(" ").map((u)=>{if(u==="[options]")return this.styleOptionText(u);if(u[0]==="["||u[0]==="<")return this.styleArgumentText(u);return this.styleSubcommandText(u)}).join(" ")}styleArgumentTerm(D){return this.styleArgumentText(D)}styleOptionText(D){return D}styleArgumentText(D){return D}styleSubcommandText(D){return D}styleCommandText(D){return D}padWidth(D,u){return Math.max(u.longestOptionTermLength(D,u),u.longestGlobalOptionTermLength(D,u),u.longestSubcommandTermLength(D,u),u.longestArgumentTermLength(D,u))}preformatted(D){return/\n[^\S\r\n]/.test(D)}formatItem(D,u,F,E){let B=" ".repeat(2);if(!F)return B+D;let $=D.padEnd(u+D.length-E.displayWidth(D)),A=2,x=(this.helpWidth??80)-u-A-2,H;if(x<this.minWidthToWrap||E.preformatted(F))H=F;else H=E.boxWrap(F,x).replace(/\n/g,`
5
+ `+" ".repeat(u+A));return B+$+" ".repeat(A)+H.replace(/\n/g,`
6
+ ${B}`)}boxWrap(D,u){if(u<this.minWidthToWrap)return D;let F=D.split(/\r\n|\n/),E=/[\s]*[^\s]+/g,C=[];return F.forEach((B)=>{let $=B.match(E);if($===null){C.push("");return}let A=[$.shift()],R=this.displayWidth(A[0]);$.forEach((x)=>{let H=this.displayWidth(x);if(R+H<=u){A.push(x),R+=H;return}C.push(A.join(""));let J=x.trimStart();A=[J],R=this.displayWidth(J)}),C.push(A.join(""))}),C.join(`
7
+ `)}}function NF(D){let u=/\x1b\[\d*(;\d*)*m/g;return D.replace(u,"")}i3.Help=JF;i3.stripColor=NF});var tu=v((DE)=>{var{InvalidArgumentError:s3}=pD();class _F{constructor(D,u){this.flags=D,this.description=u||"",this.required=D.includes("<"),this.optional=D.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(D),this.mandatory=!1;let F=e3(D);if(this.short=F.shortFlag,this.long=F.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(D,u){return this.defaultValue=D,this.defaultValueDescription=u,this}preset(D){return this.presetArg=D,this}conflicts(D){return this.conflictsWith=this.conflictsWith.concat(D),this}implies(D){let u=D;if(typeof D==="string")u={[D]:!0};return this.implied=Object.assign(this.implied||{},u),this}env(D){return this.envVar=D,this}argParser(D){return this.parseArg=D,this}makeOptionMandatory(D=!0){return this.mandatory=!!D,this}hideHelp(D=!0){return this.hidden=!!D,this}_collectValue(D,u){if(u===this.defaultValue||!Array.isArray(u))return[D];return u.push(D),u}choices(D){return this.argChoices=D.slice(),this.parseArg=(u,F)=>{if(!this.argChoices.includes(u))throw new s3(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(u,F);return u},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){if(this.negate)return RF(this.name().replace(/^no-/,""));return RF(this.name())}helpGroup(D){return this.helpGroupHeading=D,this}is(D){return this.short===D||this.long===D}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class TF{constructor(D){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,D.forEach((u)=>{if(u.negate)this.negativeOptions.set(u.attributeName(),u);else this.positiveOptions.set(u.attributeName(),u)}),this.negativeOptions.forEach((u,F)=>{if(this.positiveOptions.has(F))this.dualOptions.add(F)})}valueFromOption(D,u){let F=u.attributeName();if(!this.dualOptions.has(F))return!0;let E=this.negativeOptions.get(F).presetArg,C=E!==void 0?E:!1;return u.negate===(C===D)}}function RF(D){return D.split("-").reduce((u,F)=>{return u+F[0].toUpperCase()+F.slice(1)})}function e3(D){let u,F,E=/^-[^-]$/,C=/^--[^-]/,B=D.split(/[ |,]+/).concat("guard");if(E.test(B[0]))u=B.shift();if(C.test(B[0]))F=B.shift();if(!u&&E.test(B[0]))u=B.shift();if(!u&&C.test(B[0]))u=F,F=B.shift();if(B[0].startsWith("-")){let $=B[0],A=`option creation failed due to '${$}' in option flags '${D}'`;if(/^-[^-][^-]/.test($))throw Error(`${A}
8
8
  - a short flag is a single dash and a single character
9
9
  - either use a single dash and a single character (for a short flag)
10
- - or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(E.test(t))throw Error(`${$}
11
- - too many short flags`);if(C.test(t))throw Error(`${$}
12
- - too many long flags`);throw Error(`${$}
13
- - unrecognised flag format`)}if(u===void 0&&F===void 0)throw Error(`option creation failed due to no flags found in '${D}'.`);return{shortFlag:u,longFlag:F}}sE.Option=AF;sE.DualOptions=HF});var nF=V((DC)=>{function pE(D,u){if(Math.abs(D.length-u.length)>3)return Math.max(D.length,u.length);let F=[];for(let E=0;E<=D.length;E++)F[E]=[E];for(let E=0;E<=u.length;E++)F[0][E]=E;for(let E=1;E<=u.length;E++)for(let C=1;C<=D.length;C++){let B=1;if(D[C-1]===u[E-1])B=0;else B=1;if(F[C][E]=Math.min(F[C-1][E]+1,F[C][E-1]+1,F[C-1][E-1]+B),C>1&&E>1&&D[C-1]===u[E-2]&&D[C-2]===u[E-1])F[C][E]=Math.min(F[C][E],F[C-2][E-2]+1)}return F[D.length][u.length]}function eE(D,u){if(!u||u.length===0)return"";u=Array.from(new Set(u));let F=D.startsWith("--");if(F)D=D.slice(2),u=u.map((t)=>t.slice(2));let E=[],C=3,B=0.4;if(u.forEach((t)=>{if(t.length<=1)return;let $=pE(D,t),n=Math.max(D.length,t.length);if((n-$)/n>B){if($<C)C=$,E=[t];else if($===C)E.push(t)}}),E.sort((t,$)=>t.localeCompare($)),F)E=E.map((t)=>`--${t}`);if(E.length>1)return`
10
+ - or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(E.test($))throw Error(`${A}
11
+ - too many short flags`);if(C.test($))throw Error(`${A}
12
+ - too many long flags`);throw Error(`${A}
13
+ - unrecognised flag format`)}if(u===void 0&&F===void 0)throw Error(`option creation failed due to no flags found in '${D}'.`);return{shortFlag:u,longFlag:F}}DE.Option=_F;DE.DualOptions=TF});var XF=v((BE)=>{function EE(D,u){if(Math.abs(D.length-u.length)>3)return Math.max(D.length,u.length);let F=[];for(let E=0;E<=D.length;E++)F[E]=[E];for(let E=0;E<=u.length;E++)F[0][E]=E;for(let E=1;E<=u.length;E++)for(let C=1;C<=D.length;C++){let B=1;if(D[C-1]===u[E-1])B=0;else B=1;if(F[C][E]=Math.min(F[C-1][E]+1,F[C][E-1]+1,F[C-1][E-1]+B),C>1&&E>1&&D[C-1]===u[E-2]&&D[C-2]===u[E-1])F[C][E]=Math.min(F[C][E],F[C-2][E-2]+1)}return F[D.length][u.length]}function CE(D,u){if(!u||u.length===0)return"";u=Array.from(new Set(u));let F=D.startsWith("--");if(F)D=D.slice(2),u=u.map(($)=>$.slice(2));let E=[],C=3,B=0.4;if(u.forEach(($)=>{if($.length<=1)return;let A=EE(D,$),R=Math.max(D.length,$.length);if((R-A)/R>B){if(A<C)C=A,E=[$];else if(A===C)E.push($)}}),E.sort(($,A)=>$.localeCompare(A)),F)E=E.map(($)=>`--${$}`);if(E.length>1)return`
14
14
  (Did you mean one of ${E.join(", ")}?)`;if(E.length===1)return`
15
- (Did you mean ${E[0]}?)`;return""}DC.suggestSimilar=eE});var hF=V((xC)=>{var FC=s("events").EventEmitter,ou=s("child_process"),xD=s("path"),xu=s("fs"),G=s("process"),{Argument:EC,humanReadableArgName:CC}=$u(),{CommanderError:du}=cD(),{Help:BC,stripColor:tC}=bu(),{Option:SF,DualOptions:$C}=vu(),{suggestSimilar:wF}=nF();class gu extends FC{constructor(D){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=D||"",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:(u)=>G.stdout.write(u),writeErr:(u)=>G.stderr.write(u),outputError:(u,F)=>F(u),getOutHelpWidth:()=>G.stdout.isTTY?G.stdout.columns:void 0,getErrHelpWidth:()=>G.stderr.isTTY?G.stderr.columns:void 0,getOutHasColors:()=>cu()??(G.stdout.isTTY&&G.stdout.hasColors?.()),getErrHasColors:()=>cu()??(G.stderr.isTTY&&G.stderr.hasColors?.()),stripColor:(u)=>tC(u)},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(D){return this._outputConfiguration=D._outputConfiguration,this._helpOption=D._helpOption,this._helpCommand=D._helpCommand,this._helpConfiguration=D._helpConfiguration,this._exitCallback=D._exitCallback,this._storeOptionsAsProperties=D._storeOptionsAsProperties,this._combineFlagAndOptionalValue=D._combineFlagAndOptionalValue,this._allowExcessArguments=D._allowExcessArguments,this._enablePositionalOptions=D._enablePositionalOptions,this._showHelpAfterError=D._showHelpAfterError,this._showSuggestionAfterError=D._showSuggestionAfterError,this}_getCommandAndAncestors(){let D=[];for(let u=this;u;u=u.parent)D.push(u);return D}command(D,u,F){let E=u,C=F;if(typeof E==="object"&&E!==null)C=E,E=null;C=C||{};let[,B,t]=D.match(/([^ ]+) *(.*)/),$=this.createCommand(B);if(E)$.description(E),$._executableHandler=!0;if(C.isDefault)this._defaultCommandName=$._name;if($._hidden=!!(C.noHelp||C.hidden),$._executableFile=C.executableFile||null,t)$.arguments(t);if(this._registerCommand($),$.parent=this,$.copyInheritedSettings(this),E)return this;return $}createCommand(D){return new gu(D)}createHelp(){return Object.assign(new BC,this.configureHelp())}configureHelp(D){if(D===void 0)return this._helpConfiguration;return this._helpConfiguration=D,this}configureOutput(D){if(D===void 0)return this._outputConfiguration;return this._outputConfiguration={...this._outputConfiguration,...D},this}showHelpAfterError(D=!0){if(typeof D!=="string")D=!!D;return this._showHelpAfterError=D,this}showSuggestionAfterError(D=!0){return this._showSuggestionAfterError=!!D,this}addCommand(D,u){if(!D._name)throw Error(`Command passed to .addCommand() must have a name
16
- - specify the name in Command constructor or using .name()`);if(u=u||{},u.isDefault)this._defaultCommandName=D._name;if(u.noHelp||u.hidden)D._hidden=!0;return this._registerCommand(D),D.parent=this,D._checkForBrokenPassThrough(),this}createArgument(D,u){return new EC(D,u)}argument(D,u,F,E){let C=this.createArgument(D,u);if(typeof F==="function")C.default(E).argParser(F);else C.default(F);return this.addArgument(C),this}arguments(D){return D.trim().split(/ +/).forEach((u)=>{this.argument(u)}),this}addArgument(D){let u=this.registeredArguments.slice(-1)[0];if(u?.variadic)throw Error(`only the last argument can be variadic '${u.name()}'`);if(D.required&&D.defaultValue!==void 0&&D.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${D.name()}'`);return this.registeredArguments.push(D),this}helpCommand(D,u){if(typeof D==="boolean"){if(this._addImplicitHelpCommand=D,D&&this._defaultCommandGroup)this._initCommandGroup(this._getHelpCommand());return this}let F=D??"help [command]",[,E,C]=F.match(/([^ ]+) *(.*)/),B=u??"display help for command",t=this.createCommand(E);if(t.helpOption(!1),C)t.arguments(C);if(B)t.description(B);if(this._addImplicitHelpCommand=!0,this._helpCommand=t,D||u)this._initCommandGroup(t);return this}addHelpCommand(D,u){if(typeof D!=="object")return this.helpCommand(D,u),this;return this._addImplicitHelpCommand=!0,this._helpCommand=D,this._initCommandGroup(D),this}_getHelpCommand(){if(this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))){if(this._helpCommand===void 0)this.helpCommand(void 0,void 0);return this._helpCommand}return null}hook(D,u){let F=["preSubcommand","preAction","postAction"];if(!F.includes(D))throw Error(`Unexpected value for event passed to hook : '${D}'.
17
- Expecting one of '${F.join("', '")}'`);if(this._lifeCycleHooks[D])this._lifeCycleHooks[D].push(u);else this._lifeCycleHooks[D]=[u];return this}exitOverride(D){if(D)this._exitCallback=D;else this._exitCallback=(u)=>{if(u.code!=="commander.executeSubCommandAsync")throw u};return this}_exit(D,u,F){if(this._exitCallback)this._exitCallback(new du(D,u,F));G.exit(D)}action(D){let u=(F)=>{let E=this.registeredArguments.length,C=F.slice(0,E);if(this._storeOptionsAsProperties)C[E]=this;else C[E]=this.opts();return C.push(this),D.apply(this,C)};return this._actionHandler=u,this}createOption(D,u){return new SF(D,u)}_callParseArg(D,u,F,E){try{return D.parseArg(u,F)}catch(C){if(C.code==="commander.invalidArgument"){let B=`${E} ${C.message}`;this.error(B,{exitCode:C.exitCode,code:C.code})}throw C}}_registerOption(D){let u=D.short&&this._findOption(D.short)||D.long&&this._findOption(D.long);if(u){let F=D.long&&this._findOption(D.long)?D.long:D.short;throw Error(`Cannot add option '${D.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${F}'
18
- - already used by option '${u.flags}'`)}this._initOptionGroup(D),this.options.push(D)}_registerCommand(D){let u=(E)=>{return[E.name()].concat(E.aliases())},F=u(D).find((E)=>this._findCommand(E));if(F){let E=u(this._findCommand(F)).join("|"),C=u(D).join("|");throw Error(`cannot add command '${C}' as already have command '${E}'`)}this._initCommandGroup(D),this.commands.push(D)}addOption(D){this._registerOption(D);let u=D.name(),F=D.attributeName();if(D.negate){let C=D.long.replace(/^--no-/,"--");if(!this._findOption(C))this.setOptionValueWithSource(F,D.defaultValue===void 0?!0:D.defaultValue,"default")}else if(D.defaultValue!==void 0)this.setOptionValueWithSource(F,D.defaultValue,"default");let E=(C,B,t)=>{if(C==null&&D.presetArg!==void 0)C=D.presetArg;let $=this.getOptionValue(F);if(C!==null&&D.parseArg)C=this._callParseArg(D,C,$,B);else if(C!==null&&D.variadic)C=D._collectValue(C,$);if(C==null)if(D.negate)C=!1;else if(D.isBoolean()||D.optional)C=!0;else C="";this.setOptionValueWithSource(F,C,t)};if(this.on("option:"+u,(C)=>{let B=`error: option '${D.flags}' argument '${C}' is invalid.`;E(C,B,"cli")}),D.envVar)this.on("optionEnv:"+u,(C)=>{let B=`error: option '${D.flags}' value '${C}' from env '${D.envVar}' is invalid.`;E(C,B,"env")});return this}_optionEx(D,u,F,E,C){if(typeof u==="object"&&u instanceof SF)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let B=this.createOption(u,F);if(B.makeOptionMandatory(!!D.mandatory),typeof E==="function")B.default(C).argParser(E);else if(E instanceof RegExp){let t=E;E=($,n)=>{let A=t.exec($);return A?A[0]:n},B.default(C).argParser(E)}else B.default(E);return this.addOption(B)}option(D,u,F,E){return this._optionEx({},D,u,F,E)}requiredOption(D,u,F,E){return this._optionEx({mandatory:!0},D,u,F,E)}combineFlagAndOptionalValue(D=!0){return this._combineFlagAndOptionalValue=!!D,this}allowUnknownOption(D=!0){return this._allowUnknownOption=!!D,this}allowExcessArguments(D=!0){return this._allowExcessArguments=!!D,this}enablePositionalOptions(D=!0){return this._enablePositionalOptions=!!D,this}passThroughOptions(D=!0){return this._passThroughOptions=!!D,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(D=!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=!!D,this}getOptionValue(D){if(this._storeOptionsAsProperties)return this[D];return this._optionValues[D]}setOptionValue(D,u){return this.setOptionValueWithSource(D,u,void 0)}setOptionValueWithSource(D,u,F){if(this._storeOptionsAsProperties)this[D]=u;else this._optionValues[D]=u;return this._optionValueSources[D]=F,this}getOptionValueSource(D){return this._optionValueSources[D]}getOptionValueSourceWithGlobals(D){let u;return this._getCommandAndAncestors().forEach((F)=>{if(F.getOptionValueSource(D)!==void 0)u=F.getOptionValueSource(D)}),u}_prepareUserArgs(D,u){if(D!==void 0&&!Array.isArray(D))throw Error("first parameter to parse must be array or undefined");if(u=u||{},D===void 0&&u.from===void 0){if(G.versions?.electron)u.from="electron";let E=G.execArgv??[];if(E.includes("-e")||E.includes("--eval")||E.includes("-p")||E.includes("--print"))u.from="eval"}if(D===void 0)D=G.argv;this.rawArgs=D.slice();let F;switch(u.from){case void 0:case"node":this._scriptPath=D[1],F=D.slice(2);break;case"electron":if(G.defaultApp)this._scriptPath=D[1],F=D.slice(2);else F=D.slice(1);break;case"user":F=D.slice(0);break;case"eval":F=D.slice(1);break;default:throw Error(`unexpected parse option { from: '${u.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",F}parse(D,u){this._prepareForParse();let F=this._prepareUserArgs(D,u);return this._parseCommand([],F),this}async parseAsync(D,u){this._prepareForParse();let F=this._prepareUserArgs(D,u);return await this._parseCommand([],F),this}_prepareForParse(){if(this._savedState===null)this.saveStateBeforeParse();else this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
19
- - 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(D,u,F){if(xu.existsSync(D))return;let E=u?`searched for local subcommand relative to directory '${u}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",C=`'${D}' does not exist
15
+ (Did you mean ${E[0]}?)`;return""}BE.suggestSimilar=CE});var SF=v((_E)=>{var AE=o("events").EventEmitter,lu=o("child_process"),xD=o("path"),Ju=o("fs"),Y=o("process"),{Argument:HE,humanReadableArgName:xE}=xu(),{CommanderError:ru}=pD(),{Help:JE,stripColor:NE}=cu(),{Option:GF,DualOptions:RE}=tu(),{suggestSimilar:jF}=XF();class iu extends AE{constructor(D){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=D||"",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:(u)=>Y.stdout.write(u),writeErr:(u)=>Y.stderr.write(u),outputError:(u,F)=>F(u),getOutHelpWidth:()=>Y.stdout.isTTY?Y.stdout.columns:void 0,getErrHelpWidth:()=>Y.stderr.isTTY?Y.stderr.columns:void 0,getOutHasColors:()=>pu()??(Y.stdout.isTTY&&Y.stdout.hasColors?.()),getErrHasColors:()=>pu()??(Y.stderr.isTTY&&Y.stderr.hasColors?.()),stripColor:(u)=>NE(u)},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(D){return this._outputConfiguration=D._outputConfiguration,this._helpOption=D._helpOption,this._helpCommand=D._helpCommand,this._helpConfiguration=D._helpConfiguration,this._exitCallback=D._exitCallback,this._storeOptionsAsProperties=D._storeOptionsAsProperties,this._combineFlagAndOptionalValue=D._combineFlagAndOptionalValue,this._allowExcessArguments=D._allowExcessArguments,this._enablePositionalOptions=D._enablePositionalOptions,this._showHelpAfterError=D._showHelpAfterError,this._showSuggestionAfterError=D._showSuggestionAfterError,this}_getCommandAndAncestors(){let D=[];for(let u=this;u;u=u.parent)D.push(u);return D}command(D,u,F){let E=u,C=F;if(typeof E==="object"&&E!==null)C=E,E=null;C=C||{};let[,B,$]=D.match(/([^ ]+) *(.*)/),A=this.createCommand(B);if(E)A.description(E),A._executableHandler=!0;if(C.isDefault)this._defaultCommandName=A._name;if(A._hidden=!!(C.noHelp||C.hidden),A._executableFile=C.executableFile||null,$)A.arguments($);if(this._registerCommand(A),A.parent=this,A.copyInheritedSettings(this),E)return this;return A}createCommand(D){return new iu(D)}createHelp(){return Object.assign(new JE,this.configureHelp())}configureHelp(D){if(D===void 0)return this._helpConfiguration;return this._helpConfiguration=D,this}configureOutput(D){if(D===void 0)return this._outputConfiguration;return this._outputConfiguration={...this._outputConfiguration,...D},this}showHelpAfterError(D=!0){if(typeof D!=="string")D=!!D;return this._showHelpAfterError=D,this}showSuggestionAfterError(D=!0){return this._showSuggestionAfterError=!!D,this}addCommand(D,u){if(!D._name)throw Error(`Command passed to .addCommand() must have a name
16
+ - specify the name in Command constructor or using .name()`);if(u=u||{},u.isDefault)this._defaultCommandName=D._name;if(u.noHelp||u.hidden)D._hidden=!0;return this._registerCommand(D),D.parent=this,D._checkForBrokenPassThrough(),this}createArgument(D,u){return new HE(D,u)}argument(D,u,F,E){let C=this.createArgument(D,u);if(typeof F==="function")C.default(E).argParser(F);else C.default(F);return this.addArgument(C),this}arguments(D){return D.trim().split(/ +/).forEach((u)=>{this.argument(u)}),this}addArgument(D){let u=this.registeredArguments.slice(-1)[0];if(u?.variadic)throw Error(`only the last argument can be variadic '${u.name()}'`);if(D.required&&D.defaultValue!==void 0&&D.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${D.name()}'`);return this.registeredArguments.push(D),this}helpCommand(D,u){if(typeof D==="boolean"){if(this._addImplicitHelpCommand=D,D&&this._defaultCommandGroup)this._initCommandGroup(this._getHelpCommand());return this}let F=D??"help [command]",[,E,C]=F.match(/([^ ]+) *(.*)/),B=u??"display help for command",$=this.createCommand(E);if($.helpOption(!1),C)$.arguments(C);if(B)$.description(B);if(this._addImplicitHelpCommand=!0,this._helpCommand=$,D||u)this._initCommandGroup($);return this}addHelpCommand(D,u){if(typeof D!=="object")return this.helpCommand(D,u),this;return this._addImplicitHelpCommand=!0,this._helpCommand=D,this._initCommandGroup(D),this}_getHelpCommand(){if(this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))){if(this._helpCommand===void 0)this.helpCommand(void 0,void 0);return this._helpCommand}return null}hook(D,u){let F=["preSubcommand","preAction","postAction"];if(!F.includes(D))throw Error(`Unexpected value for event passed to hook : '${D}'.
17
+ Expecting one of '${F.join("', '")}'`);if(this._lifeCycleHooks[D])this._lifeCycleHooks[D].push(u);else this._lifeCycleHooks[D]=[u];return this}exitOverride(D){if(D)this._exitCallback=D;else this._exitCallback=(u)=>{if(u.code!=="commander.executeSubCommandAsync")throw u};return this}_exit(D,u,F){if(this._exitCallback)this._exitCallback(new ru(D,u,F));Y.exit(D)}action(D){let u=(F)=>{let E=this.registeredArguments.length,C=F.slice(0,E);if(this._storeOptionsAsProperties)C[E]=this;else C[E]=this.opts();return C.push(this),D.apply(this,C)};return this._actionHandler=u,this}createOption(D,u){return new GF(D,u)}_callParseArg(D,u,F,E){try{return D.parseArg(u,F)}catch(C){if(C.code==="commander.invalidArgument"){let B=`${E} ${C.message}`;this.error(B,{exitCode:C.exitCode,code:C.code})}throw C}}_registerOption(D){let u=D.short&&this._findOption(D.short)||D.long&&this._findOption(D.long);if(u){let F=D.long&&this._findOption(D.long)?D.long:D.short;throw Error(`Cannot add option '${D.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${F}'
18
+ - already used by option '${u.flags}'`)}this._initOptionGroup(D),this.options.push(D)}_registerCommand(D){let u=(E)=>{return[E.name()].concat(E.aliases())},F=u(D).find((E)=>this._findCommand(E));if(F){let E=u(this._findCommand(F)).join("|"),C=u(D).join("|");throw Error(`cannot add command '${C}' as already have command '${E}'`)}this._initCommandGroup(D),this.commands.push(D)}addOption(D){this._registerOption(D);let u=D.name(),F=D.attributeName();if(D.negate){let C=D.long.replace(/^--no-/,"--");if(!this._findOption(C))this.setOptionValueWithSource(F,D.defaultValue===void 0?!0:D.defaultValue,"default")}else if(D.defaultValue!==void 0)this.setOptionValueWithSource(F,D.defaultValue,"default");let E=(C,B,$)=>{if(C==null&&D.presetArg!==void 0)C=D.presetArg;let A=this.getOptionValue(F);if(C!==null&&D.parseArg)C=this._callParseArg(D,C,A,B);else if(C!==null&&D.variadic)C=D._collectValue(C,A);if(C==null)if(D.negate)C=!1;else if(D.isBoolean()||D.optional)C=!0;else C="";this.setOptionValueWithSource(F,C,$)};if(this.on("option:"+u,(C)=>{let B=`error: option '${D.flags}' argument '${C}' is invalid.`;E(C,B,"cli")}),D.envVar)this.on("optionEnv:"+u,(C)=>{let B=`error: option '${D.flags}' value '${C}' from env '${D.envVar}' is invalid.`;E(C,B,"env")});return this}_optionEx(D,u,F,E,C){if(typeof u==="object"&&u instanceof GF)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let B=this.createOption(u,F);if(B.makeOptionMandatory(!!D.mandatory),typeof E==="function")B.default(C).argParser(E);else if(E instanceof RegExp){let $=E;E=(A,R)=>{let x=$.exec(A);return x?x[0]:R},B.default(C).argParser(E)}else B.default(E);return this.addOption(B)}option(D,u,F,E){return this._optionEx({},D,u,F,E)}requiredOption(D,u,F,E){return this._optionEx({mandatory:!0},D,u,F,E)}combineFlagAndOptionalValue(D=!0){return this._combineFlagAndOptionalValue=!!D,this}allowUnknownOption(D=!0){return this._allowUnknownOption=!!D,this}allowExcessArguments(D=!0){return this._allowExcessArguments=!!D,this}enablePositionalOptions(D=!0){return this._enablePositionalOptions=!!D,this}passThroughOptions(D=!0){return this._passThroughOptions=!!D,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(D=!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=!!D,this}getOptionValue(D){if(this._storeOptionsAsProperties)return this[D];return this._optionValues[D]}setOptionValue(D,u){return this.setOptionValueWithSource(D,u,void 0)}setOptionValueWithSource(D,u,F){if(this._storeOptionsAsProperties)this[D]=u;else this._optionValues[D]=u;return this._optionValueSources[D]=F,this}getOptionValueSource(D){return this._optionValueSources[D]}getOptionValueSourceWithGlobals(D){let u;return this._getCommandAndAncestors().forEach((F)=>{if(F.getOptionValueSource(D)!==void 0)u=F.getOptionValueSource(D)}),u}_prepareUserArgs(D,u){if(D!==void 0&&!Array.isArray(D))throw Error("first parameter to parse must be array or undefined");if(u=u||{},D===void 0&&u.from===void 0){if(Y.versions?.electron)u.from="electron";let E=Y.execArgv??[];if(E.includes("-e")||E.includes("--eval")||E.includes("-p")||E.includes("--print"))u.from="eval"}if(D===void 0)D=Y.argv;this.rawArgs=D.slice();let F;switch(u.from){case void 0:case"node":this._scriptPath=D[1],F=D.slice(2);break;case"electron":if(Y.defaultApp)this._scriptPath=D[1],F=D.slice(2);else F=D.slice(1);break;case"user":F=D.slice(0);break;case"eval":F=D.slice(1);break;default:throw Error(`unexpected parse option { from: '${u.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",F}parse(D,u){this._prepareForParse();let F=this._prepareUserArgs(D,u);return this._parseCommand([],F),this}async parseAsync(D,u){this._prepareForParse();let F=this._prepareUserArgs(D,u);return await this._parseCommand([],F),this}_prepareForParse(){if(this._savedState===null)this.saveStateBeforeParse();else this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
19
+ - 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(D,u,F){if(Ju.existsSync(D))return;let E=u?`searched for local subcommand relative to directory '${u}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",C=`'${D}' does not exist
20
20
  - if '${F}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
21
21
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
22
- - ${E}`;throw Error(C)}_executeSubCommand(D,u){u=u.slice();let F=!1,E=[".js",".ts",".tsx",".mjs",".cjs"];function C(A,x){let H=xD.resolve(A,x);if(xu.existsSync(H))return H;if(E.includes(xD.extname(x)))return;let R=E.find((w)=>xu.existsSync(`${H}${w}`));if(R)return`${H}${R}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let B=D._executableFile||`${this._name}-${D._name}`,t=this._executableDir||"";if(this._scriptPath){let A;try{A=xu.realpathSync(this._scriptPath)}catch{A=this._scriptPath}t=xD.resolve(xD.dirname(A),t)}if(t){let A=C(t,B);if(!A&&!D._executableFile&&this._scriptPath){let x=xD.basename(this._scriptPath,xD.extname(this._scriptPath));if(x!==this._name)A=C(t,`${x}-${D._name}`)}B=A||B}F=E.includes(xD.extname(B));let $;if(G.platform!=="win32")if(F)u.unshift(B),u=RF(G.execArgv).concat(u),$=ou.spawn(G.argv[0],u,{stdio:"inherit"});else $=ou.spawn(B,u,{stdio:"inherit"});else this._checkForMissingExecutable(B,t,D._name),u.unshift(B),u=RF(G.execArgv).concat(u),$=ou.spawn(G.execPath,u,{stdio:"inherit"});if(!$.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((x)=>{G.on(x,()=>{if($.killed===!1&&$.exitCode===null)$.kill(x)})});let n=this._exitCallback;$.on("close",(A)=>{if(A=A??1,!n)G.exit(A);else n(new du(A,"commander.executeSubCommandAsync","(close)"))}),$.on("error",(A)=>{if(A.code==="ENOENT")this._checkForMissingExecutable(B,t,D._name);else if(A.code==="EACCES")throw Error(`'${B}' not executable`);if(!n)G.exit(1);else{let x=new du(1,"commander.executeSubCommandAsync","(error)");x.nestedError=A,n(x)}}),this.runningCommand=$}_dispatchSubcommand(D,u,F){let E=this._findCommand(D);if(!E)this.help({error:!0});E._prepareForParse();let C;return C=this._chainOrCallSubCommandHook(C,E,"preSubcommand"),C=this._chainOrCall(C,()=>{if(E._executableHandler)this._executeSubCommand(E,u.concat(F));else return E._parseCommand(u,F)}),C}_dispatchHelpCommand(D){if(!D)this.help();let u=this._findCommand(D);if(u&&!u._executableHandler)u.help();return this._dispatchSubcommand(D,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach((D,u)=>{if(D.required&&this.args[u]==null)this.missingArgument(D.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let D=(F,E,C)=>{let B=E;if(E!==null&&F.parseArg){let t=`error: command-argument value '${E}' is invalid for argument '${F.name()}'.`;B=this._callParseArg(F,E,C,t)}return B};this._checkNumberOfArguments();let u=[];this.registeredArguments.forEach((F,E)=>{let C=F.defaultValue;if(F.variadic){if(E<this.args.length){if(C=this.args.slice(E),F.parseArg)C=C.reduce((B,t)=>{return D(F,t,B)},F.defaultValue)}else if(C===void 0)C=[]}else if(E<this.args.length){if(C=this.args[E],F.parseArg)C=D(F,C,F.defaultValue)}u[E]=C}),this.processedArgs=u}_chainOrCall(D,u){if(D?.then&&typeof D.then==="function")return D.then(()=>u());return u()}_chainOrCallHooks(D,u){let F=D,E=[];if(this._getCommandAndAncestors().reverse().filter((C)=>C._lifeCycleHooks[u]!==void 0).forEach((C)=>{C._lifeCycleHooks[u].forEach((B)=>{E.push({hookedCommand:C,callback:B})})}),u==="postAction")E.reverse();return E.forEach((C)=>{F=this._chainOrCall(F,()=>{return C.callback(C.hookedCommand,this)})}),F}_chainOrCallSubCommandHook(D,u,F){let E=D;if(this._lifeCycleHooks[F]!==void 0)this._lifeCycleHooks[F].forEach((C)=>{E=this._chainOrCall(E,()=>{return C(this,u)})});return E}_parseCommand(D,u){let F=this.parseOptions(u);if(this._parseOptionsEnv(),this._parseOptionsImplied(),D=D.concat(F.operands),u=F.unknown,this.args=D.concat(u),D&&this._findCommand(D[0]))return this._dispatchSubcommand(D[0],D.slice(1),u);if(this._getHelpCommand()&&D[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(D[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(u),this._dispatchSubcommand(this._defaultCommandName,D,u);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(F.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let E=()=>{if(F.unknown.length>0)this.unknownOption(F.unknown[0])},C=`command:${this.name()}`;if(this._actionHandler){E(),this._processArguments();let B;if(B=this._chainOrCallHooks(B,"preAction"),B=this._chainOrCall(B,()=>this._actionHandler(this.processedArgs)),this.parent)B=this._chainOrCall(B,()=>{this.parent.emit(C,D,u)});return B=this._chainOrCallHooks(B,"postAction"),B}if(this.parent?.listenerCount(C))E(),this._processArguments(),this.parent.emit(C,D,u);else if(D.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",D,u);if(this.listenerCount("command:*"))this.emit("command:*",D,u);else if(this.commands.length)this.unknownCommand();else E(),this._processArguments()}else if(this.commands.length)E(),this.help({error:!0});else E(),this._processArguments()}_findCommand(D){if(!D)return;return this.commands.find((u)=>u._name===D||u._aliases.includes(D))}_findOption(D){return this.options.find((u)=>u.is(D))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((D)=>{D.options.forEach((u)=>{if(u.mandatory&&D.getOptionValue(u.attributeName())===void 0)D.missingMandatoryOptionValue(u)})})}_checkForConflictingLocalOptions(){let D=this.options.filter((F)=>{let E=F.attributeName();if(this.getOptionValue(E)===void 0)return!1;return this.getOptionValueSource(E)!=="default"});D.filter((F)=>F.conflictsWith.length>0).forEach((F)=>{let E=D.find((C)=>F.conflictsWith.includes(C.attributeName()));if(E)this._conflictingOption(F,E)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((D)=>{D._checkForConflictingLocalOptions()})}parseOptions(D){let u=[],F=[],E=u;function C(A){return A.length>1&&A[0]==="-"}let B=(A)=>{if(!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(A))return!1;return!this._getCommandAndAncestors().some((x)=>x.options.map((H)=>H.short).some((H)=>/^-\d$/.test(H)))},t=null,$=null,n=0;while(n<D.length||$){let A=$??D[n++];if($=null,A==="--"){if(E===F)E.push(A);E.push(...D.slice(n));break}if(t&&(!C(A)||B(A))){this.emit(`option:${t.name()}`,A);continue}if(t=null,C(A)){let x=this._findOption(A);if(x){if(x.required){let H=D[n++];if(H===void 0)this.optionMissingArgument(x);this.emit(`option:${x.name()}`,H)}else if(x.optional){let H=null;if(n<D.length&&(!C(D[n])||B(D[n])))H=D[n++];this.emit(`option:${x.name()}`,H)}else this.emit(`option:${x.name()}`);t=x.variadic?x:null;continue}}if(A.length>2&&A[0]==="-"&&A[1]!=="-"){let x=this._findOption(`-${A[1]}`);if(x){if(x.required||x.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${x.name()}`,A.slice(2));else this.emit(`option:${x.name()}`),$=`-${A.slice(2)}`;continue}}if(/^--[^=]+=/.test(A)){let x=A.indexOf("="),H=this._findOption(A.slice(0,x));if(H&&(H.required||H.optional)){this.emit(`option:${H.name()}`,A.slice(x+1));continue}}if(E===u&&C(A)&&!(this.commands.length===0&&B(A)))E=F;if((this._enablePositionalOptions||this._passThroughOptions)&&u.length===0&&F.length===0){if(this._findCommand(A)){u.push(A),F.push(...D.slice(n));break}else if(this._getHelpCommand()&&A===this._getHelpCommand().name()){u.push(A,...D.slice(n));break}else if(this._defaultCommandName){F.push(A,...D.slice(n));break}}if(this._passThroughOptions){E.push(A,...D.slice(n));break}E.push(A)}return{operands:u,unknown:F}}opts(){if(this._storeOptionsAsProperties){let D={},u=this.options.length;for(let F=0;F<u;F++){let E=this.options[F].attributeName();D[E]=E===this._versionOptionName?this._version:this[E]}return D}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((D,u)=>Object.assign(D,u.opts()),{})}error(D,u){if(this._outputConfiguration.outputError(`${D}
22
+ - ${E}`;throw Error(C)}_executeSubCommand(D,u){u=u.slice();let F=!1,E=[".js",".ts",".tsx",".mjs",".cjs"];function C(x,H){let J=xD.resolve(x,H);if(Ju.existsSync(J))return J;if(E.includes(xD.extname(H)))return;let T=E.find((_)=>Ju.existsSync(`${J}${_}`));if(T)return`${J}${T}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let B=D._executableFile||`${this._name}-${D._name}`,$=this._executableDir||"";if(this._scriptPath){let x;try{x=Ju.realpathSync(this._scriptPath)}catch{x=this._scriptPath}$=xD.resolve(xD.dirname(x),$)}if($){let x=C($,B);if(!x&&!D._executableFile&&this._scriptPath){let H=xD.basename(this._scriptPath,xD.extname(this._scriptPath));if(H!==this._name)x=C($,`${H}-${D._name}`)}B=x||B}F=E.includes(xD.extname(B));let A;if(Y.platform!=="win32")if(F)u.unshift(B),u=OF(Y.execArgv).concat(u),A=lu.spawn(Y.argv[0],u,{stdio:"inherit"});else A=lu.spawn(B,u,{stdio:"inherit"});else this._checkForMissingExecutable(B,$,D._name),u.unshift(B),u=OF(Y.execArgv).concat(u),A=lu.spawn(Y.execPath,u,{stdio:"inherit"});if(!A.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((H)=>{Y.on(H,()=>{if(A.killed===!1&&A.exitCode===null)A.kill(H)})});let R=this._exitCallback;A.on("close",(x)=>{if(x=x??1,!R)Y.exit(x);else R(new ru(x,"commander.executeSubCommandAsync","(close)"))}),A.on("error",(x)=>{if(x.code==="ENOENT")this._checkForMissingExecutable(B,$,D._name);else if(x.code==="EACCES")throw Error(`'${B}' not executable`);if(!R)Y.exit(1);else{let H=new ru(1,"commander.executeSubCommandAsync","(error)");H.nestedError=x,R(H)}}),this.runningCommand=A}_dispatchSubcommand(D,u,F){let E=this._findCommand(D);if(!E)this.help({error:!0});E._prepareForParse();let C;return C=this._chainOrCallSubCommandHook(C,E,"preSubcommand"),C=this._chainOrCall(C,()=>{if(E._executableHandler)this._executeSubCommand(E,u.concat(F));else return E._parseCommand(u,F)}),C}_dispatchHelpCommand(D){if(!D)this.help();let u=this._findCommand(D);if(u&&!u._executableHandler)u.help();return this._dispatchSubcommand(D,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach((D,u)=>{if(D.required&&this.args[u]==null)this.missingArgument(D.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let D=(F,E,C)=>{let B=E;if(E!==null&&F.parseArg){let $=`error: command-argument value '${E}' is invalid for argument '${F.name()}'.`;B=this._callParseArg(F,E,C,$)}return B};this._checkNumberOfArguments();let u=[];this.registeredArguments.forEach((F,E)=>{let C=F.defaultValue;if(F.variadic){if(E<this.args.length){if(C=this.args.slice(E),F.parseArg)C=C.reduce((B,$)=>{return D(F,$,B)},F.defaultValue)}else if(C===void 0)C=[]}else if(E<this.args.length){if(C=this.args[E],F.parseArg)C=D(F,C,F.defaultValue)}u[E]=C}),this.processedArgs=u}_chainOrCall(D,u){if(D?.then&&typeof D.then==="function")return D.then(()=>u());return u()}_chainOrCallHooks(D,u){let F=D,E=[];if(this._getCommandAndAncestors().reverse().filter((C)=>C._lifeCycleHooks[u]!==void 0).forEach((C)=>{C._lifeCycleHooks[u].forEach((B)=>{E.push({hookedCommand:C,callback:B})})}),u==="postAction")E.reverse();return E.forEach((C)=>{F=this._chainOrCall(F,()=>{return C.callback(C.hookedCommand,this)})}),F}_chainOrCallSubCommandHook(D,u,F){let E=D;if(this._lifeCycleHooks[F]!==void 0)this._lifeCycleHooks[F].forEach((C)=>{E=this._chainOrCall(E,()=>{return C(this,u)})});return E}_parseCommand(D,u){let F=this.parseOptions(u);if(this._parseOptionsEnv(),this._parseOptionsImplied(),D=D.concat(F.operands),u=F.unknown,this.args=D.concat(u),D&&this._findCommand(D[0]))return this._dispatchSubcommand(D[0],D.slice(1),u);if(this._getHelpCommand()&&D[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(D[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(u),this._dispatchSubcommand(this._defaultCommandName,D,u);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(F.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let E=()=>{if(F.unknown.length>0)this.unknownOption(F.unknown[0])},C=`command:${this.name()}`;if(this._actionHandler){E(),this._processArguments();let B;if(B=this._chainOrCallHooks(B,"preAction"),B=this._chainOrCall(B,()=>this._actionHandler(this.processedArgs)),this.parent)B=this._chainOrCall(B,()=>{this.parent.emit(C,D,u)});return B=this._chainOrCallHooks(B,"postAction"),B}if(this.parent?.listenerCount(C))E(),this._processArguments(),this.parent.emit(C,D,u);else if(D.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",D,u);if(this.listenerCount("command:*"))this.emit("command:*",D,u);else if(this.commands.length)this.unknownCommand();else E(),this._processArguments()}else if(this.commands.length)E(),this.help({error:!0});else E(),this._processArguments()}_findCommand(D){if(!D)return;return this.commands.find((u)=>u._name===D||u._aliases.includes(D))}_findOption(D){return this.options.find((u)=>u.is(D))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((D)=>{D.options.forEach((u)=>{if(u.mandatory&&D.getOptionValue(u.attributeName())===void 0)D.missingMandatoryOptionValue(u)})})}_checkForConflictingLocalOptions(){let D=this.options.filter((F)=>{let E=F.attributeName();if(this.getOptionValue(E)===void 0)return!1;return this.getOptionValueSource(E)!=="default"});D.filter((F)=>F.conflictsWith.length>0).forEach((F)=>{let E=D.find((C)=>F.conflictsWith.includes(C.attributeName()));if(E)this._conflictingOption(F,E)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((D)=>{D._checkForConflictingLocalOptions()})}parseOptions(D){let u=[],F=[],E=u;function C(x){return x.length>1&&x[0]==="-"}let B=(x)=>{if(!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(x))return!1;return!this._getCommandAndAncestors().some((H)=>H.options.map((J)=>J.short).some((J)=>/^-\d$/.test(J)))},$=null,A=null,R=0;while(R<D.length||A){let x=A??D[R++];if(A=null,x==="--"){if(E===F)E.push(x);E.push(...D.slice(R));break}if($&&(!C(x)||B(x))){this.emit(`option:${$.name()}`,x);continue}if($=null,C(x)){let H=this._findOption(x);if(H){if(H.required){let J=D[R++];if(J===void 0)this.optionMissingArgument(H);this.emit(`option:${H.name()}`,J)}else if(H.optional){let J=null;if(R<D.length&&(!C(D[R])||B(D[R])))J=D[R++];this.emit(`option:${H.name()}`,J)}else this.emit(`option:${H.name()}`);$=H.variadic?H:null;continue}}if(x.length>2&&x[0]==="-"&&x[1]!=="-"){let H=this._findOption(`-${x[1]}`);if(H){if(H.required||H.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${H.name()}`,x.slice(2));else this.emit(`option:${H.name()}`),A=`-${x.slice(2)}`;continue}}if(/^--[^=]+=/.test(x)){let H=x.indexOf("="),J=this._findOption(x.slice(0,H));if(J&&(J.required||J.optional)){this.emit(`option:${J.name()}`,x.slice(H+1));continue}}if(E===u&&C(x)&&!(this.commands.length===0&&B(x)))E=F;if((this._enablePositionalOptions||this._passThroughOptions)&&u.length===0&&F.length===0){if(this._findCommand(x)){u.push(x),F.push(...D.slice(R));break}else if(this._getHelpCommand()&&x===this._getHelpCommand().name()){u.push(x,...D.slice(R));break}else if(this._defaultCommandName){F.push(x,...D.slice(R));break}}if(this._passThroughOptions){E.push(x,...D.slice(R));break}E.push(x)}return{operands:u,unknown:F}}opts(){if(this._storeOptionsAsProperties){let D={},u=this.options.length;for(let F=0;F<u;F++){let E=this.options[F].attributeName();D[E]=E===this._versionOptionName?this._version:this[E]}return D}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((D,u)=>Object.assign(D,u.opts()),{})}error(D,u){if(this._outputConfiguration.outputError(`${D}
23
23
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==="string")this._outputConfiguration.writeErr(`${this._showHelpAfterError}
24
24
  `);else if(this._showHelpAfterError)this._outputConfiguration.writeErr(`
25
- `),this.outputHelp({error:!0});let F=u||{},E=F.exitCode||1,C=F.code||"commander.error";this._exit(E,C,D)}_parseOptionsEnv(){this.options.forEach((D)=>{if(D.envVar&&D.envVar in G.env){let u=D.attributeName();if(this.getOptionValue(u)===void 0||["default","config","env"].includes(this.getOptionValueSource(u)))if(D.required||D.optional)this.emit(`optionEnv:${D.name()}`,G.env[D.envVar]);else this.emit(`optionEnv:${D.name()}`)}})}_parseOptionsImplied(){let D=new $C(this.options),u=(F)=>{return this.getOptionValue(F)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(F))};this.options.filter((F)=>F.implied!==void 0&&u(F.attributeName())&&D.valueFromOption(this.getOptionValue(F.attributeName()),F)).forEach((F)=>{Object.keys(F.implied).filter((E)=>!u(E)).forEach((E)=>{this.setOptionValueWithSource(E,F.implied[E],"implied")})})}missingArgument(D){let u=`error: missing required argument '${D}'`;this.error(u,{code:"commander.missingArgument"})}optionMissingArgument(D){let u=`error: option '${D.flags}' argument missing`;this.error(u,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(D){let u=`error: required option '${D.flags}' not specified`;this.error(u,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(D,u){let F=(B)=>{let t=B.attributeName(),$=this.getOptionValue(t),n=this.options.find((x)=>x.negate&&t===x.attributeName()),A=this.options.find((x)=>!x.negate&&t===x.attributeName());if(n&&(n.presetArg===void 0&&$===!1||n.presetArg!==void 0&&$===n.presetArg))return n;return A||B},E=(B)=>{let t=F(B),$=t.attributeName();if(this.getOptionValueSource($)==="env")return`environment variable '${t.envVar}'`;return`option '${t.flags}'`},C=`error: ${E(D)} cannot be used with ${E(u)}`;this.error(C,{code:"commander.conflictingOption"})}unknownOption(D){if(this._allowUnknownOption)return;let u="";if(D.startsWith("--")&&this._showSuggestionAfterError){let E=[],C=this;do{let B=C.createHelp().visibleOptions(C).filter((t)=>t.long).map((t)=>t.long);E=E.concat(B),C=C.parent}while(C&&!C._enablePositionalOptions);u=wF(D,E)}let F=`error: unknown option '${D}'${u}`;this.error(F,{code:"commander.unknownOption"})}_excessArguments(D){if(this._allowExcessArguments)return;let u=this.registeredArguments.length,F=u===1?"":"s",C=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${u} argument${F} but got ${D.length}.`;this.error(C,{code:"commander.excessArguments"})}unknownCommand(){let D=this.args[0],u="";if(this._showSuggestionAfterError){let E=[];this.createHelp().visibleCommands(this).forEach((C)=>{if(E.push(C.name()),C.alias())E.push(C.alias())}),u=wF(D,E)}let F=`error: unknown command '${D}'${u}`;this.error(F,{code:"commander.unknownCommand"})}version(D,u,F){if(D===void 0)return this._version;this._version=D,u=u||"-V, --version",F=F||"output the version number";let E=this.createOption(u,F);return this._versionOptionName=E.attributeName(),this._registerOption(E),this.on("option:"+E.name(),()=>{this._outputConfiguration.writeOut(`${D}
26
- `),this._exit(0,"commander.version",D)}),this}description(D,u){if(D===void 0&&u===void 0)return this._description;if(this._description=D,u)this._argsDescription=u;return this}summary(D){if(D===void 0)return this._summary;return this._summary=D,this}alias(D){if(D===void 0)return this._aliases[0];let u=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)u=this.commands[this.commands.length-1];if(D===u._name)throw Error("Command alias can't be the same as its name");let F=this.parent?._findCommand(D);if(F){let E=[F.name()].concat(F.aliases()).join("|");throw Error(`cannot add alias '${D}' to command '${this.name()}' as already have command '${E}'`)}return u._aliases.push(D),this}aliases(D){if(D===void 0)return this._aliases;return D.forEach((u)=>this.alias(u)),this}usage(D){if(D===void 0){if(this._usage)return this._usage;let u=this.registeredArguments.map((F)=>{return CC(F)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?u:[]).join(" ")}return this._usage=D,this}name(D){if(D===void 0)return this._name;return this._name=D,this}helpGroup(D){if(D===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=D,this}commandsGroup(D){if(D===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=D,this}optionsGroup(D){if(D===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=D,this}_initOptionGroup(D){if(this._defaultOptionGroup&&!D.helpGroupHeading)D.helpGroup(this._defaultOptionGroup)}_initCommandGroup(D){if(this._defaultCommandGroup&&!D.helpGroup())D.helpGroup(this._defaultCommandGroup)}nameFromFilename(D){return this._name=xD.basename(D,xD.extname(D)),this}executableDir(D){if(D===void 0)return this._executableDir;return this._executableDir=D,this}helpInformation(D){let u=this.createHelp(),F=this._getOutputContext(D);u.prepareContext({error:F.error,helpWidth:F.helpWidth,outputHasColors:F.hasColors});let E=u.formatHelp(this,u);if(F.hasColors)return E;return this._outputConfiguration.stripColor(E)}_getOutputContext(D){D=D||{};let u=!!D.error,F,E,C;if(u)F=(t)=>this._outputConfiguration.writeErr(t),E=this._outputConfiguration.getErrHasColors(),C=this._outputConfiguration.getErrHelpWidth();else F=(t)=>this._outputConfiguration.writeOut(t),E=this._outputConfiguration.getOutHasColors(),C=this._outputConfiguration.getOutHelpWidth();return{error:u,write:(t)=>{if(!E)t=this._outputConfiguration.stripColor(t);return F(t)},hasColors:E,helpWidth:C}}outputHelp(D){let u;if(typeof D==="function")u=D,D=void 0;let F=this._getOutputContext(D),E={error:F.error,write:F.write,command:this};this._getCommandAndAncestors().reverse().forEach((B)=>B.emit("beforeAllHelp",E)),this.emit("beforeHelp",E);let C=this.helpInformation({error:F.error});if(u){if(C=u(C),typeof C!=="string"&&!Buffer.isBuffer(C))throw Error("outputHelp callback must return a string or a Buffer")}if(F.write(C),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",E),this._getCommandAndAncestors().forEach((B)=>B.emit("afterAllHelp",E))}helpOption(D,u){if(typeof D==="boolean"){if(D){if(this._helpOption===null)this._helpOption=void 0;if(this._defaultOptionGroup)this._initOptionGroup(this._getHelpOption())}else this._helpOption=null;return this}if(this._helpOption=this.createOption(D??"-h, --help",u??"display help for command"),D||u)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption(D){return this._helpOption=D,this._initOptionGroup(D),this}help(D){this.outputHelp(D);let u=Number(G.exitCode??0);if(u===0&&D&&typeof D!=="function"&&D.error)u=1;this._exit(u,"commander.help","(outputHelp)")}addHelpText(D,u){let F=["beforeAll","before","after","afterAll"];if(!F.includes(D))throw Error(`Unexpected value for position to addHelpText.
25
+ `),this.outputHelp({error:!0});let F=u||{},E=F.exitCode||1,C=F.code||"commander.error";this._exit(E,C,D)}_parseOptionsEnv(){this.options.forEach((D)=>{if(D.envVar&&D.envVar in Y.env){let u=D.attributeName();if(this.getOptionValue(u)===void 0||["default","config","env"].includes(this.getOptionValueSource(u)))if(D.required||D.optional)this.emit(`optionEnv:${D.name()}`,Y.env[D.envVar]);else this.emit(`optionEnv:${D.name()}`)}})}_parseOptionsImplied(){let D=new RE(this.options),u=(F)=>{return this.getOptionValue(F)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(F))};this.options.filter((F)=>F.implied!==void 0&&u(F.attributeName())&&D.valueFromOption(this.getOptionValue(F.attributeName()),F)).forEach((F)=>{Object.keys(F.implied).filter((E)=>!u(E)).forEach((E)=>{this.setOptionValueWithSource(E,F.implied[E],"implied")})})}missingArgument(D){let u=`error: missing required argument '${D}'`;this.error(u,{code:"commander.missingArgument"})}optionMissingArgument(D){let u=`error: option '${D.flags}' argument missing`;this.error(u,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(D){let u=`error: required option '${D.flags}' not specified`;this.error(u,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(D,u){let F=(B)=>{let $=B.attributeName(),A=this.getOptionValue($),R=this.options.find((H)=>H.negate&&$===H.attributeName()),x=this.options.find((H)=>!H.negate&&$===H.attributeName());if(R&&(R.presetArg===void 0&&A===!1||R.presetArg!==void 0&&A===R.presetArg))return R;return x||B},E=(B)=>{let $=F(B),A=$.attributeName();if(this.getOptionValueSource(A)==="env")return`environment variable '${$.envVar}'`;return`option '${$.flags}'`},C=`error: ${E(D)} cannot be used with ${E(u)}`;this.error(C,{code:"commander.conflictingOption"})}unknownOption(D){if(this._allowUnknownOption)return;let u="";if(D.startsWith("--")&&this._showSuggestionAfterError){let E=[],C=this;do{let B=C.createHelp().visibleOptions(C).filter(($)=>$.long).map(($)=>$.long);E=E.concat(B),C=C.parent}while(C&&!C._enablePositionalOptions);u=jF(D,E)}let F=`error: unknown option '${D}'${u}`;this.error(F,{code:"commander.unknownOption"})}_excessArguments(D){if(this._allowExcessArguments)return;let u=this.registeredArguments.length,F=u===1?"":"s",C=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${u} argument${F} but got ${D.length}.`;this.error(C,{code:"commander.excessArguments"})}unknownCommand(){let D=this.args[0],u="";if(this._showSuggestionAfterError){let E=[];this.createHelp().visibleCommands(this).forEach((C)=>{if(E.push(C.name()),C.alias())E.push(C.alias())}),u=jF(D,E)}let F=`error: unknown command '${D}'${u}`;this.error(F,{code:"commander.unknownCommand"})}version(D,u,F){if(D===void 0)return this._version;this._version=D,u=u||"-V, --version",F=F||"output the version number";let E=this.createOption(u,F);return this._versionOptionName=E.attributeName(),this._registerOption(E),this.on("option:"+E.name(),()=>{this._outputConfiguration.writeOut(`${D}
26
+ `),this._exit(0,"commander.version",D)}),this}description(D,u){if(D===void 0&&u===void 0)return this._description;if(this._description=D,u)this._argsDescription=u;return this}summary(D){if(D===void 0)return this._summary;return this._summary=D,this}alias(D){if(D===void 0)return this._aliases[0];let u=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)u=this.commands[this.commands.length-1];if(D===u._name)throw Error("Command alias can't be the same as its name");let F=this.parent?._findCommand(D);if(F){let E=[F.name()].concat(F.aliases()).join("|");throw Error(`cannot add alias '${D}' to command '${this.name()}' as already have command '${E}'`)}return u._aliases.push(D),this}aliases(D){if(D===void 0)return this._aliases;return D.forEach((u)=>this.alias(u)),this}usage(D){if(D===void 0){if(this._usage)return this._usage;let u=this.registeredArguments.map((F)=>{return xE(F)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?u:[]).join(" ")}return this._usage=D,this}name(D){if(D===void 0)return this._name;return this._name=D,this}helpGroup(D){if(D===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=D,this}commandsGroup(D){if(D===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=D,this}optionsGroup(D){if(D===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=D,this}_initOptionGroup(D){if(this._defaultOptionGroup&&!D.helpGroupHeading)D.helpGroup(this._defaultOptionGroup)}_initCommandGroup(D){if(this._defaultCommandGroup&&!D.helpGroup())D.helpGroup(this._defaultCommandGroup)}nameFromFilename(D){return this._name=xD.basename(D,xD.extname(D)),this}executableDir(D){if(D===void 0)return this._executableDir;return this._executableDir=D,this}helpInformation(D){let u=this.createHelp(),F=this._getOutputContext(D);u.prepareContext({error:F.error,helpWidth:F.helpWidth,outputHasColors:F.hasColors});let E=u.formatHelp(this,u);if(F.hasColors)return E;return this._outputConfiguration.stripColor(E)}_getOutputContext(D){D=D||{};let u=!!D.error,F,E,C;if(u)F=($)=>this._outputConfiguration.writeErr($),E=this._outputConfiguration.getErrHasColors(),C=this._outputConfiguration.getErrHelpWidth();else F=($)=>this._outputConfiguration.writeOut($),E=this._outputConfiguration.getOutHasColors(),C=this._outputConfiguration.getOutHelpWidth();return{error:u,write:($)=>{if(!E)$=this._outputConfiguration.stripColor($);return F($)},hasColors:E,helpWidth:C}}outputHelp(D){let u;if(typeof D==="function")u=D,D=void 0;let F=this._getOutputContext(D),E={error:F.error,write:F.write,command:this};this._getCommandAndAncestors().reverse().forEach((B)=>B.emit("beforeAllHelp",E)),this.emit("beforeHelp",E);let C=this.helpInformation({error:F.error});if(u){if(C=u(C),typeof C!=="string"&&!Buffer.isBuffer(C))throw Error("outputHelp callback must return a string or a Buffer")}if(F.write(C),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",E),this._getCommandAndAncestors().forEach((B)=>B.emit("afterAllHelp",E))}helpOption(D,u){if(typeof D==="boolean"){if(D){if(this._helpOption===null)this._helpOption=void 0;if(this._defaultOptionGroup)this._initOptionGroup(this._getHelpOption())}else this._helpOption=null;return this}if(this._helpOption=this.createOption(D??"-h, --help",u??"display help for command"),D||u)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption(D){return this._helpOption=D,this._initOptionGroup(D),this}help(D){this.outputHelp(D);let u=Number(Y.exitCode??0);if(u===0&&D&&typeof D!=="function"&&D.error)u=1;this._exit(u,"commander.help","(outputHelp)")}addHelpText(D,u){let F=["beforeAll","before","after","afterAll"];if(!F.includes(D))throw Error(`Unexpected value for position to addHelpText.
27
27
  Expecting one of '${F.join("', '")}'`);let E=`${D}Help`;return this.on(E,(C)=>{let B;if(typeof u==="function")B=u({error:C.error,command:C.command});else B=u;if(B)C.write(`${B}
28
- `)}),this}_outputHelpIfRequested(D){let u=this._getHelpOption();if(u&&D.find((E)=>u.is(E)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function RF(D){return D.map((u)=>{if(!u.startsWith("--inspect"))return u;let F,E="127.0.0.1",C="9229",B;if((B=u.match(/^(--inspect(-brk)?)$/))!==null)F=B[1];else if((B=u.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(F=B[1],/^\d+$/.test(B[3]))C=B[3];else E=B[3];else if((B=u.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)F=B[1],E=B[3],C=B[4];if(F&&C!=="0")return`${F}=${E}:${parseInt(C)+1}`;return u})}function cu(){if(G.env.NO_COLOR||G.env.FORCE_COLOR==="0"||G.env.FORCE_COLOR==="false")return!1;if(G.env.FORCE_COLOR||G.env.CLICOLOR_FORCE!==void 0)return!0;return}xC.Command=gu;xC.useColor=cu});var _F=V((wC)=>{var{Argument:fF}=$u(),{Command:iu}=hF(),{CommanderError:nC,InvalidArgumentError:NF}=cD(),{Help:SC}=bu(),{Option:OF}=vu();wC.program=new iu;wC.createCommand=(D)=>new iu(D);wC.createOption=(D,u)=>new OF(D,u);wC.createArgument=(D,u)=>new fF(D,u);wC.Command=iu;wC.Option=OF;wC.Argument=fF;wC.Help=SC;wC.CommanderError=nC;wC.InvalidArgumentError=NF;wC.InvalidOptionArgumentError=NF});var oF=V((y6,vF)=>{vF.exports=lC;function aC(D){let u={defaultWidth:0,output:process.stdout,tty:s("tty")};if(!D)return u;return Object.keys(u).forEach(function(F){if(!D[F])D[F]=u[F]}),D}function lC(D){let u=aC(D);if(u.output.getWindowSize)return u.output.getWindowSize()[0]||u.defaultWidth;if(u.tty.getWindowSize)return u.tty.getWindowSize()[1]||u.defaultWidth;if(u.output.columns)return u.output.columns;if(process.env.CLI_WIDTH){let F=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(F)&&F!==0)return F}return u.defaultWidth}});var x2=V((B1,$2)=>{var n3=s("stream");class t2 extends n3{#F=null;constructor(D={}){super(D);this.writable=this.readable=!0,this.muted=!1,this.on("pipe",this._onpipe),this.replace=D.replace,this._prompt=D.prompt||null,this._hadControl=!1}#u(D,u){if(this._dest)return this._dest[D];if(this._src)return this._src[D];return u}#D(D,...u){if(typeof this._dest?.[D]==="function")this._dest[D](...u);if(typeof this._src?.[D]==="function")this._src[D](...u)}get isTTY(){if(this.#F!==null)return this.#F;return this.#u("isTTY",!1)}set isTTY(D){this.#F=D}get rows(){return this.#u("rows")}get columns(){return this.#u("columns")}mute(){this.muted=!0}unmute(){this.muted=!1}_onpipe(D){this._src=D}pipe(D,u){return this._dest=D,super.pipe(D,u)}pause(){if(this._src)return this._src.pause()}resume(){if(this._src)return this._src.resume()}write(D){if(this.muted){if(!this.replace)return!0;if(D.match(/^\u001b/)){if(D.indexOf(this._prompt)===0)D=D.slice(this._prompt.length),D=D.replace(/./g,this.replace),D=this._prompt+D;return this._hadControl=!0,this.emit("data",D)}else{if(this._prompt&&this._hadControl&&D.indexOf(this._prompt)===0)this._hadControl=!1,this.emit("data",this._prompt),D=D.slice(this._prompt.length);D=D.toString().replace(/./g,this.replace)}}this.emit("data",D)}end(D){if(this.muted)if(D&&this.replace)D=D.toString().replace(/./g,this.replace);else D=null;if(D)this.emit("data",D);this.emit("end")}destroy(...D){return this.#D("destroy",...D)}destroySoon(...D){return this.#D("destroySoon",...D)}close(...D){return this.#D("close",...D)}}$2.exports=t2});var I2=V((c1,T2)=>{var wD=s("constants"),T3=process.cwd,fu=null,I3=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){if(!fu)fu=T3.call(process);return fu};try{process.cwd()}catch(D){}if(typeof process.chdir==="function"){if(Nu=process.chdir,process.chdir=function(D){fu=null,Nu.call(process,D)},Object.setPrototypeOf)Object.setPrototypeOf(process.chdir,Nu)}var Nu;T2.exports=J3;function J3(D){if(wD.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./))u(D);if(!D.lutimes)F(D);if(D.chown=B(D.chown),D.fchown=B(D.fchown),D.lchown=B(D.lchown),D.chmod=E(D.chmod),D.fchmod=E(D.fchmod),D.lchmod=E(D.lchmod),D.chownSync=t(D.chownSync),D.fchownSync=t(D.fchownSync),D.lchownSync=t(D.lchownSync),D.chmodSync=C(D.chmodSync),D.fchmodSync=C(D.fchmodSync),D.lchmodSync=C(D.lchmodSync),D.stat=$(D.stat),D.fstat=$(D.fstat),D.lstat=$(D.lstat),D.statSync=n(D.statSync),D.fstatSync=n(D.fstatSync),D.lstatSync=n(D.lstatSync),D.chmod&&!D.lchmod)D.lchmod=function(x,H,R){if(R)process.nextTick(R)},D.lchmodSync=function(){};if(D.chown&&!D.lchown)D.lchown=function(x,H,R,w){if(w)process.nextTick(w)},D.lchownSync=function(){};if(I3==="win32")D.rename=typeof D.rename!=="function"?D.rename:function(x){function H(R,w,h){var f=Date.now(),O=0;x(R,w,function I(J){if(J&&(J.code==="EACCES"||J.code==="EPERM"||J.code==="EBUSY")&&Date.now()-f<60000){if(setTimeout(function(){D.stat(w,function(T,b){if(T&&T.code==="ENOENT")x(R,w,I);else h(J)})},O),O<100)O+=10;return}if(h)h(J)})}if(Object.setPrototypeOf)Object.setPrototypeOf(H,x);return H}(D.rename);D.read=typeof D.read!=="function"?D.read:function(x){function H(R,w,h,f,O,I){var J;if(I&&typeof I==="function"){var T=0;J=function(b,e,SD){if(b&&b.code==="EAGAIN"&&T<10)return T++,x.call(D,R,w,h,f,O,J);I.apply(this,arguments)}}return x.call(D,R,w,h,f,O,J)}if(Object.setPrototypeOf)Object.setPrototypeOf(H,x);return H}(D.read),D.readSync=typeof D.readSync!=="function"?D.readSync:function(x){return function(H,R,w,h,f){var O=0;while(!0)try{return x.call(D,H,R,w,h,f)}catch(I){if(I.code==="EAGAIN"&&O<10){O++;continue}throw I}}}(D.readSync);function u(x){x.lchmod=function(H,R,w){x.open(H,wD.O_WRONLY|wD.O_SYMLINK,R,function(h,f){if(h){if(w)w(h);return}x.fchmod(f,R,function(O){x.close(f,function(I){if(w)w(O||I)})})})},x.lchmodSync=function(H,R){var w=x.openSync(H,wD.O_WRONLY|wD.O_SYMLINK,R),h=!0,f;try{f=x.fchmodSync(w,R),h=!1}finally{if(h)try{x.closeSync(w)}catch(O){}else x.closeSync(w)}return f}}function F(x){if(wD.hasOwnProperty("O_SYMLINK")&&x.futimes)x.lutimes=function(H,R,w,h){x.open(H,wD.O_SYMLINK,function(f,O){if(f){if(h)h(f);return}x.futimes(O,R,w,function(I){x.close(O,function(J){if(h)h(I||J)})})})},x.lutimesSync=function(H,R,w){var h=x.openSync(H,wD.O_SYMLINK),f,O=!0;try{f=x.futimesSync(h,R,w),O=!1}finally{if(O)try{x.closeSync(h)}catch(I){}else x.closeSync(h)}return f};else if(x.futimes)x.lutimes=function(H,R,w,h){if(h)process.nextTick(h)},x.lutimesSync=function(){}}function E(x){if(!x)return x;return function(H,R,w){return x.call(D,H,R,function(h){if(A(h))h=null;if(w)w.apply(this,arguments)})}}function C(x){if(!x)return x;return function(H,R){try{return x.call(D,H,R)}catch(w){if(!A(w))throw w}}}function B(x){if(!x)return x;return function(H,R,w,h){return x.call(D,H,R,w,function(f){if(A(f))f=null;if(h)h.apply(this,arguments)})}}function t(x){if(!x)return x;return function(H,R,w){try{return x.call(D,H,R,w)}catch(h){if(!A(h))throw h}}}function $(x){if(!x)return x;return function(H,R,w){if(typeof R==="function")w=R,R=null;function h(f,O){if(O){if(O.uid<0)O.uid+=4294967296;if(O.gid<0)O.gid+=4294967296}if(w)w.apply(this,arguments)}return R?x.call(D,H,R,h):x.call(D,H,h)}}function n(x){if(!x)return x;return function(H,R){var w=R?x.call(D,H,R):x.call(D,H);if(w){if(w.uid<0)w.uid+=4294967296;if(w.gid<0)w.gid+=4294967296}return w}}function A(x){if(!x)return!0;if(x.code==="ENOSYS")return!0;var H=!process.getuid||process.getuid()!==0;if(H){if(x.code==="EINVAL"||x.code==="EPERM")return!0}return!1}}});var G2=V((g1,q2)=>{var J2=s("stream").Stream;q2.exports=q3;function q3(D){return{ReadStream:u,WriteStream:F};function u(E,C){if(!(this instanceof u))return new u(E,C);J2.call(this);var B=this;this.path=E,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,C=C||{};var t=Object.keys(C);for(var $=0,n=t.length;$<n;$++){var A=t[$];this[A]=C[A]}if(this.encoding)this.setEncoding(this.encoding);if(this.start!==void 0){if(typeof this.start!=="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!=="number")throw TypeError("end must be a Number");if(this.start>this.end)throw Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){B._read()});return}D.open(this.path,this.flags,this.mode,function(x,H){if(x){B.emit("error",x),B.readable=!1;return}B.fd=H,B.emit("open",H),B._read()})}function F(E,C){if(!(this instanceof F))return new F(E,C);J2.call(this),this.path=E,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,C=C||{};var B=Object.keys(C);for(var t=0,$=B.length;t<$;t++){var n=B[t];this[n]=C[n]}if(this.start!==void 0){if(typeof this.start!=="number")throw TypeError("start must be a Number");if(this.start<0)throw Error("start must be >= zero");this.pos=this.start}if(this.busy=!1,this._queue=[],this.fd===null)this._open=D.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush()}}});var X2=V((i1,j2)=>{j2.exports=j3;var G3=Object.getPrototypeOf||function(D){return D.__proto__};function j3(D){if(D===null||typeof D!=="object")return D;if(D instanceof Object)var u={__proto__:G3(D)};else var u=Object.create(null);return Object.getOwnPropertyNames(D).forEach(function(F){Object.defineProperty(u,F,Object.getOwnPropertyDescriptor(D,F))}),u}});var G0=V((s1,q0)=>{var W=s("fs"),X3=I2(),z3=G2(),U3=X2(),Ou=s("util"),c,Tu;if(typeof Symbol==="function"&&typeof Symbol.for==="function")c=Symbol.for("graceful-fs.queue"),Tu=Symbol.for("graceful-fs.previous");else c="___graceful-fs.queue",Tu="___graceful-fs.previous";function M3(){}function U2(D,u){Object.defineProperty(D,c,{get:function(){return u}})}var qD=M3;if(Ou.debuglog)qD=Ou.debuglog("gfs4");else if(/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))qD=function(){var D=Ou.format.apply(Ou,arguments);D="GFS4: "+D.split(/\n/).join(`
29
- GFS4: `),console.error(D)};if(!W[c]){if(T0=global[c]||[],U2(W,T0),W.close=function(D){function u(F,E){return D.call(W,F,function(C){if(!C)z2();if(typeof E==="function")E.apply(this,arguments)})}return Object.defineProperty(u,Tu,{value:D}),u}(W.close),W.closeSync=function(D){function u(F){D.apply(W,arguments),z2()}return Object.defineProperty(u,Tu,{value:D}),u}(W.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){qD(W[c]),s("assert").equal(W[c].length,0)})}var T0;if(!global[c])U2(global,W[c]);q0.exports=I0(U3(W));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!W.__patched)q0.exports=I0(W),W.__patched=!0;function I0(D){X3(D),D.gracefulify=I0,D.createReadStream=e,D.createWriteStream=SD;var u=D.readFile;D.readFile=F;function F(_,j,q){if(typeof j==="function")q=j,j=null;return v(_,j,q);function v(o,r,K,P){return u(o,r,function(X){if(X&&(X.code==="EMFILE"||X.code==="ENFILE"))QD([v,[o,r,K],X,P||Date.now(),Date.now()]);else if(typeof K==="function")K.apply(this,arguments)})}}var E=D.writeFile;D.writeFile=C;function C(_,j,q,v){if(typeof q==="function")v=q,q=null;return o(_,j,q,v);function o(r,K,P,X,d){return E(r,K,P,function(M){if(M&&(M.code==="EMFILE"||M.code==="ENFILE"))QD([o,[r,K,P,X],M,d||Date.now(),Date.now()]);else if(typeof X==="function")X.apply(this,arguments)})}}var B=D.appendFile;if(B)D.appendFile=t;function t(_,j,q,v){if(typeof q==="function")v=q,q=null;return o(_,j,q,v);function o(r,K,P,X,d){return B(r,K,P,function(M){if(M&&(M.code==="EMFILE"||M.code==="ENFILE"))QD([o,[r,K,P,X],M,d||Date.now(),Date.now()]);else if(typeof X==="function")X.apply(this,arguments)})}}var $=D.copyFile;if($)D.copyFile=n;function n(_,j,q,v){if(typeof q==="function")v=q,q=0;return o(_,j,q,v);function o(r,K,P,X,d){return $(r,K,P,function(M){if(M&&(M.code==="EMFILE"||M.code==="ENFILE"))QD([o,[r,K,P,X],M,d||Date.now(),Date.now()]);else if(typeof X==="function")X.apply(this,arguments)})}}var A=D.readdir;D.readdir=H;var x=/^v[0-5]\./;function H(_,j,q){if(typeof j==="function")q=j,j=null;var v=x.test(process.version)?function(K,P,X,d){return A(K,o(K,P,X,d))}:function(K,P,X,d){return A(K,P,o(K,P,X,d))};return v(_,j,q);function o(r,K,P,X){return function(d,M){if(d&&(d.code==="EMFILE"||d.code==="ENFILE"))QD([v,[r,K,P],d,X||Date.now(),Date.now()]);else{if(M&&M.sort)M.sort();if(typeof P==="function")P.call(this,d,M)}}}}if(process.version.substr(0,4)==="v0.8"){var R=z3(D);I=R.ReadStream,T=R.WriteStream}var w=D.ReadStream;if(w)I.prototype=Object.create(w.prototype),I.prototype.open=J;var h=D.WriteStream;if(h)T.prototype=Object.create(h.prototype),T.prototype.open=b;Object.defineProperty(D,"ReadStream",{get:function(){return I},set:function(_){I=_},enumerable:!0,configurable:!0}),Object.defineProperty(D,"WriteStream",{get:function(){return T},set:function(_){T=_},enumerable:!0,configurable:!0});var f=I;Object.defineProperty(D,"FileReadStream",{get:function(){return f},set:function(_){f=_},enumerable:!0,configurable:!0});var O=T;Object.defineProperty(D,"FileWriteStream",{get:function(){return O},set:function(_){O=_},enumerable:!0,configurable:!0});function I(_,j){if(this instanceof I)return w.apply(this,arguments),this;else return I.apply(Object.create(I.prototype),arguments)}function J(){var _=this;mu(_.path,_.flags,_.mode,function(j,q){if(j){if(_.autoClose)_.destroy();_.emit("error",j)}else _.fd=q,_.emit("open",q),_.read()})}function T(_,j){if(this instanceof T)return h.apply(this,arguments),this;else return T.apply(Object.create(T.prototype),arguments)}function b(){var _=this;mu(_.path,_.flags,_.mode,function(j,q){if(j)_.destroy(),_.emit("error",j);else _.fd=q,_.emit("open",q)})}function e(_,j){return new D.ReadStream(_,j)}function SD(_,j){return new D.WriteStream(_,j)}var oD=D.open;D.open=mu;function mu(_,j,q,v){if(typeof q==="function")v=q,q=null;return o(_,j,q,v);function o(r,K,P,X,d){return oD(r,K,P,function(M,M8){if(M&&(M.code==="EMFILE"||M.code==="ENFILE"))QD([o,[r,K,P,X],M,d||Date.now(),Date.now()]);else if(typeof X==="function")X.apply(this,arguments)})}}return D}function QD(D){qD("ENQUEUE",D[0].name,D[1]),W[c].push(D),J0()}var _u;function z2(){var D=Date.now();for(var u=0;u<W[c].length;++u)if(W[c][u].length>2)W[c][u][3]=D,W[c][u][4]=D;J0()}function J0(){if(clearTimeout(_u),_u=void 0,W[c].length===0)return;var D=W[c].shift(),u=D[0],F=D[1],E=D[2],C=D[3],B=D[4];if(C===void 0)qD("RETRY",u.name,F),u.apply(null,F);else if(Date.now()-C>=60000){qD("TIMEOUT",u.name,F);var t=F.pop();if(typeof t==="function")t.call(null,E)}else{var $=Date.now()-B,n=Math.max(B-C,1),A=Math.min(n*1.2,100);if($>=A)qD("RETRY",u.name,F),u.apply(null,F.concat([C]));else W[c].push(D)}if(_u===void 0)_u=setTimeout(J0,0)}});var Z2=V((a1,M2)=>{function FD(D,u){if(typeof u==="boolean")u={forever:u};if(this._originalTimeouts=JSON.parse(JSON.stringify(D)),this._timeouts=D,this._options=u||{},this._maxRetryTime=u&&u.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever)this._cachedTimeouts=this._timeouts.slice(0)}M2.exports=FD;FD.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};FD.prototype.stop=function(){if(this._timeout)clearTimeout(this._timeout);this._timeouts=[],this._cachedTimeouts=null};FD.prototype.retry=function(D){if(this._timeout)clearTimeout(this._timeout);if(!D)return!1;var u=new Date().getTime();if(D&&u-this._operationStart>=this._maxRetryTime)return this._errors.unshift(Error("RetryOperation timeout occurred")),!1;this._errors.push(D);var F=this._timeouts.shift();if(F===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),F=this._timeouts.shift();else return!1;var E=this,C=setTimeout(function(){if(E._attempts++,E._operationTimeoutCb){if(E._timeout=setTimeout(function(){E._operationTimeoutCb(E._attempts)},E._operationTimeout),E._options.unref)E._timeout.unref()}E._fn(E._attempts)},F);if(this._options.unref)C.unref();return!0};FD.prototype.attempt=function(D,u){if(this._fn=D,u){if(u.timeout)this._operationTimeout=u.timeout;if(u.cb)this._operationTimeoutCb=u.cb}var F=this;if(this._operationTimeoutCb)this._timeout=setTimeout(function(){F._operationTimeoutCb()},F._operationTimeout);this._operationStart=new Date().getTime(),this._fn(this._attempts)};FD.prototype.try=function(D){console.log("Using RetryOperation.try() is deprecated"),this.attempt(D)};FD.prototype.start=function(D){console.log("Using RetryOperation.start() is deprecated"),this.attempt(D)};FD.prototype.start=FD.prototype.try;FD.prototype.errors=function(){return this._errors};FD.prototype.attempts=function(){return this._attempts};FD.prototype.mainError=function(){if(this._errors.length===0)return null;var D={},u=null,F=0;for(var E=0;E<this._errors.length;E++){var C=this._errors[E],B=C.message,t=(D[B]||0)+1;if(D[B]=t,t>=F)u=C,F=t}return u}});var Y2=V((L3)=>{var Z3=Z2();L3.operation=function(D){var u=L3.timeouts(D);return new Z3(u,{forever:D&&D.forever,unref:D&&D.unref,maxRetryTime:D&&D.maxRetryTime})};L3.timeouts=function(D){if(D instanceof Array)return[].concat(D);var u={retries:10,factor:2,minTimeout:1000,maxTimeout:1/0,randomize:!1};for(var F in D)u[F]=D[F];if(u.minTimeout>u.maxTimeout)throw Error("minTimeout is greater than maxTimeout");var E=[];for(var C=0;C<u.retries;C++)E.push(this.createTimeout(C,u));if(D&&D.forever&&!E.length)E.push(this.createTimeout(C,u));return E.sort(function(B,t){return B-t}),E};L3.createTimeout=function(D,u){var F=u.randomize?Math.random()+1:1,E=Math.round(F*u.minTimeout*Math.pow(u.factor,D));return E=Math.min(E,u.maxTimeout),E};L3.wrap=function(D,u,F){if(u instanceof Array)F=u,u=null;if(!F){F=[];for(var E in D)if(typeof D[E]==="function")F.push(E)}for(var C=0;C<F.length;C++){var B=F[C],t=D[B];D[B]=function(n){var A=L3.operation(u),x=Array.prototype.slice.call(arguments,1),H=x.pop();x.push(function(R){if(A.retry(R))return;if(R)arguments[0]=A.mainError();H.apply(this,arguments)}),A.attempt(function(){n.apply(D,x)})}.bind(D,t),D[B].options=u}}});var Q2=V((p1,Iu)=>{Iu.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];if(process.platform!=="win32")Iu.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")Iu.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var K2=V((e1,WD)=>{var Q=global.process,GD=function(D){return D&&typeof D==="object"&&typeof D.removeListener==="function"&&typeof D.emit==="function"&&typeof D.reallyExit==="function"&&typeof D.listeners==="function"&&typeof D.kill==="function"&&typeof D.pid==="number"&&typeof D.on==="function"};if(!GD(Q))WD.exports=function(){return function(){}};else{if(j0=s("assert"),jD=Q2(),X0=/^win/i.test(Q.platform),KD=s("events"),typeof KD!=="function")KD=KD.EventEmitter;if(Q.__signal_exit_emitter__)m=Q.__signal_exit_emitter__;else m=Q.__signal_exit_emitter__=new KD,m.count=0,m.emitted={};if(!m.infinite)m.setMaxListeners(1/0),m.infinite=!0;WD.exports=function(D,u){if(!GD(global.process))return function(){};if(j0.equal(typeof D,"function","a callback must be provided for exit handler"),XD===!1)Ju();var F="exit";if(u&&u.alwaysLast)F="afterexit";var E=function(){if(m.removeListener(F,D),m.listeners("exit").length===0&&m.listeners("afterexit").length===0)Fu()};return m.on(F,D),E},Fu=function(){if(!XD||!GD(global.process))return;XD=!1,jD.forEach(function(u){try{Q.removeListener(u,Eu[u])}catch(F){}}),Q.emit=Cu,Q.reallyExit=qu,m.count-=1},WD.exports.unload=Fu,RD=function(u,F,E){if(m.emitted[u])return;m.emitted[u]=!0,m.emit(u,F,E)},Eu={},jD.forEach(function(D){Eu[D]=function(){if(!GD(global.process))return;var F=Q.listeners(D);if(F.length===m.count){if(Fu(),RD("exit",null,D),RD("afterexit",null,D),X0&&D==="SIGHUP")D="SIGINT";Q.kill(Q.pid,D)}}}),WD.exports.signals=function(){return jD},XD=!1,Ju=function(){if(XD||!GD(global.process))return;XD=!0,m.count+=1,jD=jD.filter(function(u){try{return Q.on(u,Eu[u]),!0}catch(F){return!1}}),Q.emit=U0,Q.reallyExit=z0},WD.exports.load=Ju,qu=Q.reallyExit,z0=function(u){if(!GD(global.process))return;Q.exitCode=u||0,RD("exit",Q.exitCode,null),RD("afterexit",Q.exitCode,null),qu.call(Q,Q.exitCode)},Cu=Q.emit,U0=function(u,F){if(u==="exit"&&GD(global.process)){if(F!==void 0)Q.exitCode=F;var E=Cu.apply(this,arguments);return RD("exit",Q.exitCode,null),RD("afterexit",Q.exitCode,null),E}else return Cu.apply(this,arguments)}}var j0,jD,X0,KD,m,Fu,RD,Eu,XD,Ju,qu,z0,Cu,U0});var y2=V((P3,M0)=>{var W2=Symbol();function W3(D,u,F){let E=u[W2];if(E)return u.stat(D,(B,t)=>{if(B)return F(B);F(null,t.mtime,E)});let C=new Date(Math.ceil(Date.now()/1000)*1000+5);u.utimes(D,C,C,(B)=>{if(B)return F(B);u.stat(D,(t,$)=>{if(t)return F(t);let n=$.mtime.getTime()%1000===0?"s":"ms";Object.defineProperty(u,W2,{value:n}),F(null,$.mtime,n)})})}function y3(D){let u=Date.now();if(D==="s")u=Math.ceil(u/1000)*1000;return new Date(u)}P3.probe=W3;P3.getMtime=y3});var r2=V((c3,tu)=>{var m3=s("path"),Y0=G0(),r3=Y2(),b3=K2(),P2=y2(),AD={};function Bu(D,u){return u.lockfilePath||`${D}.lock`}function Q0(D,u,F){if(!u.realpath)return F(null,m3.resolve(D));u.fs.realpath(D,F)}function L0(D,u,F){let E=Bu(D,u);u.fs.mkdir(E,(C)=>{if(!C)return P2.probe(E,u.fs,(B,t,$)=>{if(B)return u.fs.rmdir(E,()=>{}),F(B);F(null,t,$)});if(C.code!=="EEXIST")return F(C);if(u.stale<=0)return F(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));u.fs.stat(E,(B,t)=>{if(B){if(B.code==="ENOENT")return L0(D,{...u,stale:0},F);return F(B)}if(!V2(t,u))return F(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));k2(D,u,($)=>{if($)return F($);L0(D,{...u,stale:0},F)})})})}function V2(D,u){return D.mtime.getTime()<Date.now()-u.stale}function k2(D,u,F){u.fs.rmdir(Bu(D,u),(E)=>{if(E&&E.code!=="ENOENT")return F(E);F()})}function Gu(D,u){let F=AD[D];if(F.updateTimeout)return;if(F.updateDelay=F.updateDelay||u.update,F.updateTimeout=setTimeout(()=>{F.updateTimeout=null,u.fs.stat(F.lockfilePath,(E,C)=>{let B=F.lastUpdate+u.stale<Date.now();if(E){if(E.code==="ENOENT"||B)return Z0(D,F,Object.assign(E,{code:"ECOMPROMISED"}));return F.updateDelay=1000,Gu(D,u)}if(F.mtime.getTime()!==C.mtime.getTime())return Z0(D,F,Object.assign(Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let $=P2.getMtime(F.mtimePrecision);u.fs.utimes(F.lockfilePath,$,$,(n)=>{let A=F.lastUpdate+u.stale<Date.now();if(F.released)return;if(n){if(n.code==="ENOENT"||A)return Z0(D,F,Object.assign(n,{code:"ECOMPROMISED"}));return F.updateDelay=1000,Gu(D,u)}F.mtime=$,F.lastUpdate=Date.now(),F.updateDelay=null,Gu(D,u)})})},F.updateDelay),F.updateTimeout.unref)F.updateTimeout.unref()}function Z0(D,u,F){if(u.released=!0,u.updateTimeout)clearTimeout(u.updateTimeout);if(AD[D]===u)delete AD[D];u.options.onCompromised(F)}function v3(D,u,F){u={stale:1e4,update:null,realpath:!0,retries:0,fs:Y0,onCompromised:(E)=>{throw E},...u},u.retries=u.retries||0,u.retries=typeof u.retries==="number"?{retries:u.retries}:u.retries,u.stale=Math.max(u.stale||0,2000),u.update=u.update==null?u.stale/2:u.update||0,u.update=Math.max(Math.min(u.update,u.stale/2),1000),Q0(D,u,(E,C)=>{if(E)return F(E);let B=r3.operation(u.retries);B.attempt(()=>{L0(C,u,(t,$,n)=>{if(B.retry(t))return;if(t)return F(B.mainError());let A=AD[C]={lockfilePath:Bu(C,u),mtime:$,mtimePrecision:n,options:u,lastUpdate:Date.now()};Gu(C,u),F(null,(x)=>{if(A.released)return x&&x(Object.assign(Error("Lock is already released"),{code:"ERELEASED"}));m2(C,{...u,realpath:!1},x)})})})})}function m2(D,u,F){u={fs:Y0,realpath:!0,...u},Q0(D,u,(E,C)=>{if(E)return F(E);let B=AD[C];if(!B)return F(Object.assign(Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));B.updateTimeout&&clearTimeout(B.updateTimeout),B.released=!0,delete AD[C],k2(C,u,F)})}function o3(D,u,F){u={stale:1e4,realpath:!0,fs:Y0,...u},u.stale=Math.max(u.stale||0,2000),Q0(D,u,(E,C)=>{if(E)return F(E);u.fs.stat(Bu(C,u),(B,t)=>{if(B)return B.code==="ENOENT"?F(null,!1):F(B);return F(null,!V2(t,u))})})}function d3(){return AD}b3(()=>{for(let D in AD){let u=AD[D].options;try{u.fs.rmdirSync(Bu(D,u))}catch(F){}}});c3.lock=v3;c3.unlock=m2;c3.check=o3;c3.getLocks=d3});var v2=V((DB,b2)=>{var l3=G0();function p3(D){let u=["mkdir","realpath","stat","rmdir","utimes"],F={...D};return u.forEach((E)=>{F[E]=(...C)=>{let B=C.pop(),t;try{t=D[`${E}Sync`](...C)}catch($){return B($)}B(null,t)}}),F}function e3(D){return(...u)=>new Promise((F,E)=>{u.push((C,B)=>{if(C)E(C);else F(B)}),D(...u)})}function D8(D){return(...u)=>{let F,E;if(u.push((C,B)=>{F=C,E=B}),D(...u),F)throw F;return E}}function u8(D){if(D={...D},D.fs=p3(D.fs||l3),typeof D.retries==="number"&&D.retries>0||D.retries&&typeof D.retries.retries==="number"&&D.retries.retries>0)throw Object.assign(Error("Cannot use retries with the sync api"),{code:"ESYNC"});return D}b2.exports={toPromise:e3,toSync:D8,toSyncOptions:u8}});var d2=V((uB,hD)=>{var yD=r2(),{toPromise:ju,toSync:Xu,toSyncOptions:K0}=v2();async function o2(D,u){let F=await ju(yD.lock)(D,u);return ju(F)}function F8(D,u){let F=Xu(yD.lock)(D,K0(u));return Xu(F)}function E8(D,u){return ju(yD.unlock)(D,u)}function C8(D,u){return Xu(yD.unlock)(D,K0(u))}function B8(D,u){return ju(yD.check)(D,u)}function t8(D,u){return Xu(yD.check)(D,K0(u))}hD.exports=o2;hD.exports.lock=o2;hD.exports.unlock=E8;hD.exports.lockSync=F8;hD.exports.unlockSync=C8;hD.exports.check=B8;hD.exports.checkSync=t8});var JE=V((Ht,IE)=>{var rD=1000,bD=rD*60,vD=bD*60,ZD=vD*24,T8=ZD*7,I8=ZD*365.25;IE.exports=function(D,u){u=u||{};var F=typeof D;if(F==="string"&&D.length>0)return J8(D);else if(F==="number"&&isFinite(D))return u.long?G8(D):q8(D);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(D))};function J8(D){if(D=String(D),D.length>100)return;var u=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(D);if(!u)return;var F=parseFloat(u[1]),E=(u[2]||"ms").toLowerCase();switch(E){case"years":case"year":case"yrs":case"yr":case"y":return F*I8;case"weeks":case"week":case"w":return F*T8;case"days":case"day":case"d":return F*ZD;case"hours":case"hour":case"hrs":case"hr":case"h":return F*vD;case"minutes":case"minute":case"mins":case"min":case"m":return F*bD;case"seconds":case"second":case"secs":case"sec":case"s":return F*rD;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return F;default:return}}function q8(D){var u=Math.abs(D);if(u>=ZD)return Math.round(D/ZD)+"d";if(u>=vD)return Math.round(D/vD)+"h";if(u>=bD)return Math.round(D/bD)+"m";if(u>=rD)return Math.round(D/rD)+"s";return D+"ms"}function G8(D){var u=Math.abs(D);if(u>=ZD)return ku(D,u,ZD,"day");if(u>=vD)return ku(D,u,vD,"hour");if(u>=bD)return ku(D,u,bD,"minute");if(u>=rD)return ku(D,u,rD,"second");return D+" ms"}function ku(D,u,F,E){var C=u>=F*1.5;return Math.round(D/F)+" "+E+(C?"s":"")}});var TF=dD(_F(),1),{program:V8,createCommand:k8,createArgument:m8,createOption:r8,CommanderError:b8,InvalidArgumentError:v8,InvalidOptionArgumentError:o8,Command:IF,Argument:d8,Option:c8,Help:g8}=TF.default;var JF=(D=0)=>(u)=>`\x1B[${u+D}m`,qF=(D=0)=>(u)=>`\x1B[${38+D};5;${u}m`,GF=(D=0)=>(u,F,E)=>`\x1B[${38+D};2;${u};${F};${E}m`,Z={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},s8=Object.keys(Z.modifier),jC=Object.keys(Z.color),XC=Object.keys(Z.bgColor),a8=[...jC,...XC];function zC(){let D=new Map;for(let[u,F]of Object.entries(Z)){for(let[E,C]of Object.entries(F))Z[E]={open:`\x1B[${C[0]}m`,close:`\x1B[${C[1]}m`},F[E]=Z[E],D.set(C[0],C[1]);Object.defineProperty(Z,u,{value:F,enumerable:!1})}return Object.defineProperty(Z,"codes",{value:D,enumerable:!1}),Z.color.close="\x1B[39m",Z.bgColor.close="\x1B[49m",Z.color.ansi=JF(),Z.color.ansi256=qF(),Z.color.ansi16m=GF(),Z.bgColor.ansi=JF(10),Z.bgColor.ansi256=qF(10),Z.bgColor.ansi16m=GF(10),Object.defineProperties(Z,{rgbToAnsi256:{value(u,F,E){if(u===F&&F===E){if(u<8)return 16;if(u>248)return 231;return Math.round((u-8)/247*24)+232}return 16+36*Math.round(u/255*5)+6*Math.round(F/255*5)+Math.round(E/255*5)},enumerable:!1},hexToRgb:{value(u){let F=/[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));if(!F)return[0,0,0];let[E]=F;if(E.length===3)E=[...E].map((B)=>B+B).join("");let C=Number.parseInt(E,16);return[C>>16&255,C>>8&255,C&255]},enumerable:!1},hexToAnsi256:{value:(u)=>Z.rgbToAnsi256(...Z.hexToRgb(u)),enumerable:!1},ansi256ToAnsi:{value(u){if(u<8)return 30+u;if(u<16)return 90+(u-8);let F,E,C;if(u>=232)F=((u-232)*10+8)/255,E=F,C=F;else{u-=16;let $=u%36;F=Math.floor(u/36)/5,E=Math.floor($/6)/5,C=$%6/5}let B=Math.max(F,E,C)*2;if(B===0)return 30;let t=30+(Math.round(C)<<2|Math.round(E)<<1|Math.round(F));if(B===2)t+=60;return t},enumerable:!1},rgbToAnsi:{value:(u,F,E)=>Z.ansi256ToAnsi(Z.rgbToAnsi256(u,F,E)),enumerable:!1},hexToAnsi:{value:(u)=>Z.ansi256ToAnsi(Z.hexToAnsi256(u)),enumerable:!1}}),Z}var UC=zC(),ED=UC;import su from"process";import MC from"os";import jF from"tty";function DD(D,u=globalThis.Deno?globalThis.Deno.args:su.argv){let F=D.startsWith("-")?"":D.length===1?"-":"--",E=u.indexOf(F+D),C=u.indexOf("--");return E!==-1&&(C===-1||E<C)}var{env:L}=su,Au;if(DD("no-color")||DD("no-colors")||DD("color=false")||DD("color=never"))Au=0;else if(DD("color")||DD("colors")||DD("color=true")||DD("color=always"))Au=1;function ZC(){if("FORCE_COLOR"in L){if(L.FORCE_COLOR==="true")return 1;if(L.FORCE_COLOR==="false")return 0;return L.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(L.FORCE_COLOR,10),3)}}function LC(D){if(D===0)return!1;return{level:D,hasBasic:!0,has256:D>=2,has16m:D>=3}}function YC(D,{streamIsTTY:u,sniffFlags:F=!0}={}){let E=ZC();if(E!==void 0)Au=E;let C=F?Au:E;if(C===0)return 0;if(F){if(DD("color=16m")||DD("color=full")||DD("color=truecolor"))return 3;if(DD("color=256"))return 2}if("TF_BUILD"in L&&"AGENT_NAME"in L)return 1;if(D&&!u&&C===void 0)return 0;let B=C||0;if(L.TERM==="dumb")return B;if(su.platform==="win32"){let t=MC.release().split(".");if(Number(t[0])>=10&&Number(t[2])>=10586)return Number(t[2])>=14931?3:2;return 1}if("CI"in L){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((t)=>(t in L)))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((t)=>(t in L))||L.CI_NAME==="codeship")return 1;return B}if("TEAMCITY_VERSION"in L)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(L.TEAMCITY_VERSION)?1:0;if(L.COLORTERM==="truecolor")return 3;if(L.TERM==="xterm-kitty")return 3;if(L.TERM==="xterm-ghostty")return 3;if(L.TERM==="wezterm")return 3;if("TERM_PROGRAM"in L){let t=Number.parseInt((L.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(L.TERM_PROGRAM){case"iTerm.app":return t>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(L.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(L.TERM))return 1;if("COLORTERM"in L)return 1;return B}function XF(D,u={}){let F=YC(D,{streamIsTTY:D&&D.isTTY,...u});return LC(F)}var QC={stdout:XF({isTTY:jF.isatty(1)}),stderr:XF({isTTY:jF.isatty(2)})},zF=QC;function UF(D,u,F){let E=D.indexOf(u);if(E===-1)return D;let C=u.length,B=0,t="";do t+=D.slice(B,E)+u+F,B=E+C,E=D.indexOf(u,B);while(E!==-1);return t+=D.slice(B),t}function MF(D,u,F,E){let C=0,B="";do{let t=D[E-1]==="\r";B+=D.slice(C,t?E-1:E)+u+(t?`\r
28
+ `)}),this}_outputHelpIfRequested(D){let u=this._getHelpOption();if(u&&D.find((E)=>u.is(E)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function OF(D){return D.map((u)=>{if(!u.startsWith("--inspect"))return u;let F,E="127.0.0.1",C="9229",B;if((B=u.match(/^(--inspect(-brk)?)$/))!==null)F=B[1];else if((B=u.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(F=B[1],/^\d+$/.test(B[3]))C=B[3];else E=B[3];else if((B=u.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)F=B[1],E=B[3],C=B[4];if(F&&C!=="0")return`${F}=${E}:${parseInt(C)+1}`;return u})}function pu(){if(Y.env.NO_COLOR||Y.env.FORCE_COLOR==="0"||Y.env.FORCE_COLOR==="false")return!1;if(Y.env.FORCE_COLOR||Y.env.CLICOLOR_FORCE!==void 0)return!0;return}_E.Command=iu;_E.useColor=pu});var ZF=v((OE)=>{var{Argument:zF}=xu(),{Command:ou}=SF(),{CommanderError:GE,InvalidArgumentError:IF}=pD(),{Help:jE}=cu(),{Option:UF}=tu();OE.program=new ou;OE.createCommand=(D)=>new ou(D);OE.createOption=(D,u)=>new UF(D,u);OE.createArgument=(D,u)=>new zF(D,u);OE.Command=ou;OE.Option=UF;OE.Argument=zF;OE.Help=jE;OE.CommanderError=GE;OE.InvalidArgumentError=IF;OE.InvalidOptionArgumentError=IF});var pF=v((d6,rF)=>{rF.exports=FC;function uC(D){let u={defaultWidth:0,output:process.stdout,tty:o("tty")};if(!D)return u;return Object.keys(u).forEach(function(F){if(!D[F])D[F]=u[F]}),D}function FC(D){let u=uC(D);if(u.output.getWindowSize)return u.output.getWindowSize()[0]||u.defaultWidth;if(u.tty.getWindowSize)return u.tty.getWindowSize()[1]||u.defaultWidth;if(u.output.columns)return u.output.columns;if(process.env.CLI_WIDTH){let F=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(F)&&F!==0)return F}return u.defaultWidth}});var R2=v((R1,N2)=>{var GC=o("stream");class J2 extends GC{#F=null;constructor(D={}){super(D);this.writable=this.readable=!0,this.muted=!1,this.on("pipe",this._onpipe),this.replace=D.replace,this._prompt=D.prompt||null,this._hadControl=!1}#u(D,u){if(this._dest)return this._dest[D];if(this._src)return this._src[D];return u}#D(D,...u){if(typeof this._dest?.[D]==="function")this._dest[D](...u);if(typeof this._src?.[D]==="function")this._src[D](...u)}get isTTY(){if(this.#F!==null)return this.#F;return this.#u("isTTY",!1)}set isTTY(D){this.#F=D}get rows(){return this.#u("rows")}get columns(){return this.#u("columns")}mute(){this.muted=!0}unmute(){this.muted=!1}_onpipe(D){this._src=D}pipe(D,u){return this._dest=D,super.pipe(D,u)}pause(){if(this._src)return this._src.pause()}resume(){if(this._src)return this._src.resume()}write(D){if(this.muted){if(!this.replace)return!0;if(D.match(/^\u001b/)){if(D.indexOf(this._prompt)===0)D=D.slice(this._prompt.length),D=D.replace(/./g,this.replace),D=this._prompt+D;return this._hadControl=!0,this.emit("data",D)}else{if(this._prompt&&this._hadControl&&D.indexOf(this._prompt)===0)this._hadControl=!1,this.emit("data",this._prompt),D=D.slice(this._prompt.length);D=D.toString().replace(/./g,this.replace)}}this.emit("data",D)}end(D){if(this.muted)if(D&&this.replace)D=D.toString().replace(/./g,this.replace);else D=null;if(D)this.emit("data",D);this.emit("end")}destroy(...D){return this.#D("destroy",...D)}destroySoon(...D){return this.#D("destroySoon",...D)}close(...D){return this.#D("close",...D)}}N2.exports=J2});var M2=v((e1,Y2)=>{var TD=o("constants"),MC=process.cwd,Ou=null,qC=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){if(!Ou)Ou=MC.call(process);return Ou};try{process.cwd()}catch(D){}if(typeof process.chdir==="function"){if(Su=process.chdir,process.chdir=function(D){Ou=null,Su.call(process,D)},Object.setPrototypeOf)Object.setPrototypeOf(process.chdir,Su)}var Su;Y2.exports=QC;function QC(D){if(TD.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./))u(D);if(!D.lutimes)F(D);if(D.chown=B(D.chown),D.fchown=B(D.fchown),D.lchown=B(D.lchown),D.chmod=E(D.chmod),D.fchmod=E(D.fchmod),D.lchmod=E(D.lchmod),D.chownSync=$(D.chownSync),D.fchownSync=$(D.fchownSync),D.lchownSync=$(D.lchownSync),D.chmodSync=C(D.chmodSync),D.fchmodSync=C(D.fchmodSync),D.lchmodSync=C(D.lchmodSync),D.stat=A(D.stat),D.fstat=A(D.fstat),D.lstat=A(D.lstat),D.statSync=R(D.statSync),D.fstatSync=R(D.fstatSync),D.lstatSync=R(D.lstatSync),D.chmod&&!D.lchmod)D.lchmod=function(H,J,T){if(T)process.nextTick(T)},D.lchmodSync=function(){};if(D.chown&&!D.lchown)D.lchown=function(H,J,T,_){if(_)process.nextTick(_)},D.lchownSync=function(){};if(qC==="win32")D.rename=typeof D.rename!=="function"?D.rename:function(H){function J(T,_,X){var j=Date.now(),O=0;H(T,_,function I(U){if(U&&(U.code==="EACCES"||U.code==="EPERM"||U.code==="EBUSY")&&Date.now()-j<60000){if(setTimeout(function(){D.stat(_,function(z,d){if(z&&z.code==="ENOENT")H(T,_,I);else X(U)})},O),O<100)O+=10;return}if(X)X(U)})}if(Object.setPrototypeOf)Object.setPrototypeOf(J,H);return J}(D.rename);D.read=typeof D.read!=="function"?D.read:function(H){function J(T,_,X,j,O,I){var U;if(I&&typeof I==="function"){var z=0;U=function(d,DD,_D){if(d&&d.code==="EAGAIN"&&z<10)return z++,H.call(D,T,_,X,j,O,U);I.apply(this,arguments)}}return H.call(D,T,_,X,j,O,U)}if(Object.setPrototypeOf)Object.setPrototypeOf(J,H);return J}(D.read),D.readSync=typeof D.readSync!=="function"?D.readSync:function(H){return function(J,T,_,X,j){var O=0;while(!0)try{return H.call(D,J,T,_,X,j)}catch(I){if(I.code==="EAGAIN"&&O<10){O++;continue}throw I}}}(D.readSync);function u(H){H.lchmod=function(J,T,_){H.open(J,TD.O_WRONLY|TD.O_SYMLINK,T,function(X,j){if(X){if(_)_(X);return}H.fchmod(j,T,function(O){H.close(j,function(I){if(_)_(O||I)})})})},H.lchmodSync=function(J,T){var _=H.openSync(J,TD.O_WRONLY|TD.O_SYMLINK,T),X=!0,j;try{j=H.fchmodSync(_,T),X=!1}finally{if(X)try{H.closeSync(_)}catch(O){}else H.closeSync(_)}return j}}function F(H){if(TD.hasOwnProperty("O_SYMLINK")&&H.futimes)H.lutimes=function(J,T,_,X){H.open(J,TD.O_SYMLINK,function(j,O){if(j){if(X)X(j);return}H.futimes(O,T,_,function(I){H.close(O,function(U){if(X)X(I||U)})})})},H.lutimesSync=function(J,T,_){var X=H.openSync(J,TD.O_SYMLINK),j,O=!0;try{j=H.futimesSync(X,T,_),O=!1}finally{if(O)try{H.closeSync(X)}catch(I){}else H.closeSync(X)}return j};else if(H.futimes)H.lutimes=function(J,T,_,X){if(X)process.nextTick(X)},H.lutimesSync=function(){}}function E(H){if(!H)return H;return function(J,T,_){return H.call(D,J,T,function(X){if(x(X))X=null;if(_)_.apply(this,arguments)})}}function C(H){if(!H)return H;return function(J,T){try{return H.call(D,J,T)}catch(_){if(!x(_))throw _}}}function B(H){if(!H)return H;return function(J,T,_,X){return H.call(D,J,T,_,function(j){if(x(j))j=null;if(X)X.apply(this,arguments)})}}function $(H){if(!H)return H;return function(J,T,_){try{return H.call(D,J,T,_)}catch(X){if(!x(X))throw X}}}function A(H){if(!H)return H;return function(J,T,_){if(typeof T==="function")_=T,T=null;function X(j,O){if(O){if(O.uid<0)O.uid+=4294967296;if(O.gid<0)O.gid+=4294967296}if(_)_.apply(this,arguments)}return T?H.call(D,J,T,X):H.call(D,J,X)}}function R(H){if(!H)return H;return function(J,T){var _=T?H.call(D,J,T):H.call(D,J);if(_){if(_.uid<0)_.uid+=4294967296;if(_.gid<0)_.gid+=4294967296}return _}}function x(H){if(!H)return!0;if(H.code==="ENOSYS")return!0;var J=!process.getuid||process.getuid()!==0;if(J){if(H.code==="EINVAL"||H.code==="EPERM")return!0}return!1}}});var K2=v((DB,Q2)=>{var q2=o("stream").Stream;Q2.exports=KC;function KC(D){return{ReadStream:u,WriteStream:F};function u(E,C){if(!(this instanceof u))return new u(E,C);q2.call(this);var B=this;this.path=E,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,C=C||{};var $=Object.keys(C);for(var A=0,R=$.length;A<R;A++){var x=$[A];this[x]=C[x]}if(this.encoding)this.setEncoding(this.encoding);if(this.start!==void 0){if(typeof this.start!=="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!=="number")throw TypeError("end must be a Number");if(this.start>this.end)throw Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){B._read()});return}D.open(this.path,this.flags,this.mode,function(H,J){if(H){B.emit("error",H),B.readable=!1;return}B.fd=J,B.emit("open",J),B._read()})}function F(E,C){if(!(this instanceof F))return new F(E,C);q2.call(this),this.path=E,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,C=C||{};var B=Object.keys(C);for(var $=0,A=B.length;$<A;$++){var R=B[$];this[R]=C[R]}if(this.start!==void 0){if(typeof this.start!=="number")throw TypeError("start must be a Number");if(this.start<0)throw Error("start must be >= zero");this.pos=this.start}if(this.busy=!1,this._queue=[],this.fd===null)this._open=D.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush()}}});var L2=v((uB,W2)=>{W2.exports=LC;var WC=Object.getPrototypeOf||function(D){return D.__proto__};function LC(D){if(D===null||typeof D!=="object")return D;if(D instanceof Object)var u={__proto__:WC(D)};else var u=Object.create(null);return Object.getOwnPropertyNames(D).forEach(function(F){Object.defineProperty(u,F,Object.getOwnPropertyDescriptor(D,F))}),u}});var q0=v((FB,M0)=>{var k=o("fs"),wC=M2(),VC=K2(),fC=L2(),zu=o("util"),r,Uu;if(typeof Symbol==="function"&&typeof Symbol.for==="function")r=Symbol.for("graceful-fs.queue"),Uu=Symbol.for("graceful-fs.previous");else r="___graceful-fs.queue",Uu="___graceful-fs.previous";function yC(){}function V2(D,u){Object.defineProperty(D,r,{get:function(){return u}})}var MD=yC;if(zu.debuglog)MD=zu.debuglog("gfs4");else if(/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))MD=function(){var D=zu.format.apply(zu,arguments);D="GFS4: "+D.split(/\n/).join(`
29
+ GFS4: `),console.error(D)};if(!k[r]){if(U0=global[r]||[],V2(k,U0),k.close=function(D){function u(F,E){return D.call(k,F,function(C){if(!C)w2();if(typeof E==="function")E.apply(this,arguments)})}return Object.defineProperty(u,Uu,{value:D}),u}(k.close),k.closeSync=function(D){function u(F){D.apply(k,arguments),w2()}return Object.defineProperty(u,Uu,{value:D}),u}(k.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){MD(k[r]),o("assert").equal(k[r].length,0)})}var U0;if(!global[r])V2(global,k[r]);M0.exports=Z0(fC(k));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!k.__patched)M0.exports=Z0(k),k.__patched=!0;function Z0(D){wC(D),D.gracefulify=Z0,D.createReadStream=DD,D.createWriteStream=_D;var u=D.readFile;D.readFile=F;function F(S,q,Z){if(typeof q==="function")Z=q,q=null;return c(S,q,Z);function c(t,n,P,b){return u(t,n,function(K){if(K&&(K.code==="EMFILE"||K.code==="ENFILE"))yD([c,[t,n,P],K,b||Date.now(),Date.now()]);else if(typeof P==="function")P.apply(this,arguments)})}}var E=D.writeFile;D.writeFile=C;function C(S,q,Z,c){if(typeof Z==="function")c=Z,Z=null;return t(S,q,Z,c);function t(n,P,b,K,l){return E(n,P,b,function(L){if(L&&(L.code==="EMFILE"||L.code==="ENFILE"))yD([t,[n,P,b,K],L,l||Date.now(),Date.now()]);else if(typeof K==="function")K.apply(this,arguments)})}}var B=D.appendFile;if(B)D.appendFile=$;function $(S,q,Z,c){if(typeof Z==="function")c=Z,Z=null;return t(S,q,Z,c);function t(n,P,b,K,l){return B(n,P,b,function(L){if(L&&(L.code==="EMFILE"||L.code==="ENFILE"))yD([t,[n,P,b,K],L,l||Date.now(),Date.now()]);else if(typeof K==="function")K.apply(this,arguments)})}}var A=D.copyFile;if(A)D.copyFile=R;function R(S,q,Z,c){if(typeof Z==="function")c=Z,Z=0;return t(S,q,Z,c);function t(n,P,b,K,l){return A(n,P,b,function(L){if(L&&(L.code==="EMFILE"||L.code==="ENFILE"))yD([t,[n,P,b,K],L,l||Date.now(),Date.now()]);else if(typeof K==="function")K.apply(this,arguments)})}}var x=D.readdir;D.readdir=J;var H=/^v[0-5]\./;function J(S,q,Z){if(typeof q==="function")Z=q,q=null;var c=H.test(process.version)?function(P,b,K,l){return x(P,t(P,b,K,l))}:function(P,b,K,l){return x(P,b,t(P,b,K,l))};return c(S,q,Z);function t(n,P,b,K){return function(l,L){if(l&&(l.code==="EMFILE"||l.code==="ENFILE"))yD([c,[n,P,b],l,K||Date.now(),Date.now()]);else{if(L&&L.sort)L.sort();if(typeof b==="function")b.call(this,l,L)}}}}if(process.version.substr(0,4)==="v0.8"){var T=VC(D);I=T.ReadStream,z=T.WriteStream}var _=D.ReadStream;if(_)I.prototype=Object.create(_.prototype),I.prototype.open=U;var X=D.WriteStream;if(X)z.prototype=Object.create(X.prototype),z.prototype.open=d;Object.defineProperty(D,"ReadStream",{get:function(){return I},set:function(S){I=S},enumerable:!0,configurable:!0}),Object.defineProperty(D,"WriteStream",{get:function(){return z},set:function(S){z=S},enumerable:!0,configurable:!0});var j=I;Object.defineProperty(D,"FileReadStream",{get:function(){return j},set:function(S){j=S},enumerable:!0,configurable:!0});var O=z;Object.defineProperty(D,"FileWriteStream",{get:function(){return O},set:function(S){O=S},enumerable:!0,configurable:!0});function I(S,q){if(this instanceof I)return _.apply(this,arguments),this;else return I.apply(Object.create(I.prototype),arguments)}function U(){var S=this;nu(S.path,S.flags,S.mode,function(q,Z){if(q){if(S.autoClose)S.destroy();S.emit("error",q)}else S.fd=Z,S.emit("open",Z),S.read()})}function z(S,q){if(this instanceof z)return X.apply(this,arguments),this;else return z.apply(Object.create(z.prototype),arguments)}function d(){var S=this;nu(S.path,S.flags,S.mode,function(q,Z){if(q)S.destroy(),S.emit("error",q);else S.fd=Z,S.emit("open",Z)})}function DD(S,q){return new D.ReadStream(S,q)}function _D(S,q){return new D.WriteStream(S,q)}var lD=D.open;D.open=nu;function nu(S,q,Z,c){if(typeof Z==="function")c=Z,Z=null;return t(S,q,Z,c);function t(n,P,b,K,l){return lD(n,P,b,function(L,k8){if(L&&(L.code==="EMFILE"||L.code==="ENFILE"))yD([t,[n,P,b,K],L,l||Date.now(),Date.now()]);else if(typeof K==="function")K.apply(this,arguments)})}}return D}function yD(D){MD("ENQUEUE",D[0].name,D[1]),k[r].push(D),Y0()}var Iu;function w2(){var D=Date.now();for(var u=0;u<k[r].length;++u)if(k[r][u].length>2)k[r][u][3]=D,k[r][u][4]=D;Y0()}function Y0(){if(clearTimeout(Iu),Iu=void 0,k[r].length===0)return;var D=k[r].shift(),u=D[0],F=D[1],E=D[2],C=D[3],B=D[4];if(C===void 0)MD("RETRY",u.name,F),u.apply(null,F);else if(Date.now()-C>=60000){MD("TIMEOUT",u.name,F);var $=F.pop();if(typeof $==="function")$.call(null,E)}else{var A=Date.now()-B,R=Math.max(B-C,1),x=Math.min(R*1.2,100);if(A>=x)MD("RETRY",u.name,F),u.apply(null,F.concat([C]));else k[r].push(D)}if(Iu===void 0)Iu=setTimeout(Y0,0)}});var y2=v((EB,f2)=>{function ED(D,u){if(typeof u==="boolean")u={forever:u};if(this._originalTimeouts=JSON.parse(JSON.stringify(D)),this._timeouts=D,this._options=u||{},this._maxRetryTime=u&&u.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever)this._cachedTimeouts=this._timeouts.slice(0)}f2.exports=ED;ED.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};ED.prototype.stop=function(){if(this._timeout)clearTimeout(this._timeout);this._timeouts=[],this._cachedTimeouts=null};ED.prototype.retry=function(D){if(this._timeout)clearTimeout(this._timeout);if(!D)return!1;var u=new Date().getTime();if(D&&u-this._operationStart>=this._maxRetryTime)return this._errors.unshift(Error("RetryOperation timeout occurred")),!1;this._errors.push(D);var F=this._timeouts.shift();if(F===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),F=this._timeouts.shift();else return!1;var E=this,C=setTimeout(function(){if(E._attempts++,E._operationTimeoutCb){if(E._timeout=setTimeout(function(){E._operationTimeoutCb(E._attempts)},E._operationTimeout),E._options.unref)E._timeout.unref()}E._fn(E._attempts)},F);if(this._options.unref)C.unref();return!0};ED.prototype.attempt=function(D,u){if(this._fn=D,u){if(u.timeout)this._operationTimeout=u.timeout;if(u.cb)this._operationTimeoutCb=u.cb}var F=this;if(this._operationTimeoutCb)this._timeout=setTimeout(function(){F._operationTimeoutCb()},F._operationTimeout);this._operationStart=new Date().getTime(),this._fn(this._attempts)};ED.prototype.try=function(D){console.log("Using RetryOperation.try() is deprecated"),this.attempt(D)};ED.prototype.start=function(D){console.log("Using RetryOperation.start() is deprecated"),this.attempt(D)};ED.prototype.start=ED.prototype.try;ED.prototype.errors=function(){return this._errors};ED.prototype.attempts=function(){return this._attempts};ED.prototype.mainError=function(){if(this._errors.length===0)return null;var D={},u=null,F=0;for(var E=0;E<this._errors.length;E++){var C=this._errors[E],B=C.message,$=(D[B]||0)+1;if(D[B]=$,$>=F)u=C,F=$}return u}});var k2=v((kC)=>{var PC=y2();kC.operation=function(D){var u=kC.timeouts(D);return new PC(u,{forever:D&&D.forever,unref:D&&D.unref,maxRetryTime:D&&D.maxRetryTime})};kC.timeouts=function(D){if(D instanceof Array)return[].concat(D);var u={retries:10,factor:2,minTimeout:1000,maxTimeout:1/0,randomize:!1};for(var F in D)u[F]=D[F];if(u.minTimeout>u.maxTimeout)throw Error("minTimeout is greater than maxTimeout");var E=[];for(var C=0;C<u.retries;C++)E.push(this.createTimeout(C,u));if(D&&D.forever&&!E.length)E.push(this.createTimeout(C,u));return E.sort(function(B,$){return B-$}),E};kC.createTimeout=function(D,u){var F=u.randomize?Math.random()+1:1,E=Math.round(F*u.minTimeout*Math.pow(u.factor,D));return E=Math.min(E,u.maxTimeout),E};kC.wrap=function(D,u,F){if(u instanceof Array)F=u,u=null;if(!F){F=[];for(var E in D)if(typeof D[E]==="function")F.push(E)}for(var C=0;C<F.length;C++){var B=F[C],$=D[B];D[B]=function(R){var x=kC.operation(u),H=Array.prototype.slice.call(arguments,1),J=H.pop();H.push(function(T){if(x.retry(T))return;if(T)arguments[0]=x.mainError();J.apply(this,arguments)}),x.attempt(function(){R.apply(D,H)})}.bind(D,$),D[B].options=u}}});var h2=v((BB,Zu)=>{Zu.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];if(process.platform!=="win32")Zu.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")Zu.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var b2=v(($B,kD)=>{var y=global.process,qD=function(D){return D&&typeof D==="object"&&typeof D.removeListener==="function"&&typeof D.emit==="function"&&typeof D.reallyExit==="function"&&typeof D.listeners==="function"&&typeof D.kill==="function"&&typeof D.pid==="number"&&typeof D.on==="function"};if(!qD(y))kD.exports=function(){return function(){}};else{if(Q0=o("assert"),QD=h2(),K0=/^win/i.test(y.platform),PD=o("events"),typeof PD!=="function")PD=PD.EventEmitter;if(y.__signal_exit_emitter__)g=y.__signal_exit_emitter__;else g=y.__signal_exit_emitter__=new PD,g.count=0,g.emitted={};if(!g.infinite)g.setMaxListeners(1/0),g.infinite=!0;kD.exports=function(D,u){if(!qD(global.process))return function(){};if(Q0.equal(typeof D,"function","a callback must be provided for exit handler"),KD===!1)Yu();var F="exit";if(u&&u.alwaysLast)F="afterexit";var E=function(){if(g.removeListener(F,D),g.listeners("exit").length===0&&g.listeners("afterexit").length===0)Cu()};return g.on(F,D),E},Cu=function(){if(!KD||!qD(global.process))return;KD=!1,QD.forEach(function(u){try{y.removeListener(u,Bu[u])}catch(F){}}),y.emit=$u,y.reallyExit=Mu,g.count-=1},kD.exports.unload=Cu,XD=function(u,F,E){if(g.emitted[u])return;g.emitted[u]=!0,g.emit(u,F,E)},Bu={},QD.forEach(function(D){Bu[D]=function(){if(!qD(global.process))return;var F=y.listeners(D);if(F.length===g.count){if(Cu(),XD("exit",null,D),XD("afterexit",null,D),K0&&D==="SIGHUP")D="SIGINT";y.kill(y.pid,D)}}}),kD.exports.signals=function(){return QD},KD=!1,Yu=function(){if(KD||!qD(global.process))return;KD=!0,g.count+=1,QD=QD.filter(function(u){try{return y.on(u,Bu[u]),!0}catch(F){return!1}}),y.emit=L0,y.reallyExit=W0},kD.exports.load=Yu,Mu=y.reallyExit,W0=function(u){if(!qD(global.process))return;y.exitCode=u||0,XD("exit",y.exitCode,null),XD("afterexit",y.exitCode,null),Mu.call(y,y.exitCode)},$u=y.emit,L0=function(u,F){if(u==="exit"&&qD(global.process)){if(F!==void 0)y.exitCode=F;var E=$u.apply(this,arguments);return XD("exit",y.exitCode,null),XD("afterexit",y.exitCode,null),E}else return $u.apply(this,arguments)}}var Q0,QD,K0,PD,g,Cu,XD,Bu,KD,Yu,Mu,W0,$u,L0});var m2=v((nC,w0)=>{var v2=Symbol();function mC(D,u,F){let E=u[v2];if(E)return u.stat(D,(B,$)=>{if(B)return F(B);F(null,$.mtime,E)});let C=new Date(Math.ceil(Date.now()/1000)*1000+5);u.utimes(D,C,C,(B)=>{if(B)return F(B);u.stat(D,($,A)=>{if($)return F($);let R=A.mtime.getTime()%1000===0?"s":"ms";Object.defineProperty(u,v2,{value:R}),F(null,A.mtime,R)})})}function gC(D){let u=Date.now();if(D==="s")u=Math.ceil(u/1000)*1000;return new Date(u)}nC.probe=mC;nC.getMtime=gC});var t2=v((aC,Hu)=>{var tC=o("path"),y0=q0(),lC=k2(),rC=b2(),g2=m2(),JD={};function Au(D,u){return u.lockfilePath||`${D}.lock`}function P0(D,u,F){if(!u.realpath)return F(null,tC.resolve(D));u.fs.realpath(D,F)}function f0(D,u,F){let E=Au(D,u);u.fs.mkdir(E,(C)=>{if(!C)return g2.probe(E,u.fs,(B,$,A)=>{if(B)return u.fs.rmdir(E,()=>{}),F(B);F(null,$,A)});if(C.code!=="EEXIST")return F(C);if(u.stale<=0)return F(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));u.fs.stat(E,(B,$)=>{if(B){if(B.code==="ENOENT")return f0(D,{...u,stale:0},F);return F(B)}if(!n2($,u))return F(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));d2(D,u,(A)=>{if(A)return F(A);f0(D,{...u,stale:0},F)})})})}function n2(D,u){return D.mtime.getTime()<Date.now()-u.stale}function d2(D,u,F){u.fs.rmdir(Au(D,u),(E)=>{if(E&&E.code!=="ENOENT")return F(E);F()})}function qu(D,u){let F=JD[D];if(F.updateTimeout)return;if(F.updateDelay=F.updateDelay||u.update,F.updateTimeout=setTimeout(()=>{F.updateTimeout=null,u.fs.stat(F.lockfilePath,(E,C)=>{let B=F.lastUpdate+u.stale<Date.now();if(E){if(E.code==="ENOENT"||B)return V0(D,F,Object.assign(E,{code:"ECOMPROMISED"}));return F.updateDelay=1000,qu(D,u)}if(F.mtime.getTime()!==C.mtime.getTime())return V0(D,F,Object.assign(Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let A=g2.getMtime(F.mtimePrecision);u.fs.utimes(F.lockfilePath,A,A,(R)=>{let x=F.lastUpdate+u.stale<Date.now();if(F.released)return;if(R){if(R.code==="ENOENT"||x)return V0(D,F,Object.assign(R,{code:"ECOMPROMISED"}));return F.updateDelay=1000,qu(D,u)}F.mtime=A,F.lastUpdate=Date.now(),F.updateDelay=null,qu(D,u)})})},F.updateDelay),F.updateTimeout.unref)F.updateTimeout.unref()}function V0(D,u,F){if(u.released=!0,u.updateTimeout)clearTimeout(u.updateTimeout);if(JD[D]===u)delete JD[D];u.options.onCompromised(F)}function pC(D,u,F){u={stale:1e4,update:null,realpath:!0,retries:0,fs:y0,onCompromised:(E)=>{throw E},...u},u.retries=u.retries||0,u.retries=typeof u.retries==="number"?{retries:u.retries}:u.retries,u.stale=Math.max(u.stale||0,2000),u.update=u.update==null?u.stale/2:u.update||0,u.update=Math.max(Math.min(u.update,u.stale/2),1000),P0(D,u,(E,C)=>{if(E)return F(E);let B=lC.operation(u.retries);B.attempt(()=>{f0(C,u,($,A,R)=>{if(B.retry($))return;if($)return F(B.mainError());let x=JD[C]={lockfilePath:Au(C,u),mtime:A,mtimePrecision:R,options:u,lastUpdate:Date.now()};qu(C,u),F(null,(H)=>{if(x.released)return H&&H(Object.assign(Error("Lock is already released"),{code:"ERELEASED"}));c2(C,{...u,realpath:!1},H)})})})})}function c2(D,u,F){u={fs:y0,realpath:!0,...u},P0(D,u,(E,C)=>{if(E)return F(E);let B=JD[C];if(!B)return F(Object.assign(Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));B.updateTimeout&&clearTimeout(B.updateTimeout),B.released=!0,delete JD[C],d2(C,u,F)})}function iC(D,u,F){u={stale:1e4,realpath:!0,fs:y0,...u},u.stale=Math.max(u.stale||0,2000),P0(D,u,(E,C)=>{if(E)return F(E);u.fs.stat(Au(C,u),(B,$)=>{if(B)return B.code==="ENOENT"?F(null,!1):F(B);return F(null,!n2($,u))})})}function oC(){return JD}rC(()=>{for(let D in JD){let u=JD[D].options;try{u.fs.rmdirSync(Au(D,u))}catch(F){}}});aC.lock=pC;aC.unlock=c2;aC.check=iC;aC.getLocks=oC});var r2=v((AB,l2)=>{var F8=q0();function E8(D){let u=["mkdir","realpath","stat","rmdir","utimes"],F={...D};return u.forEach((E)=>{F[E]=(...C)=>{let B=C.pop(),$;try{$=D[`${E}Sync`](...C)}catch(A){return B(A)}B(null,$)}}),F}function C8(D){return(...u)=>new Promise((F,E)=>{u.push((C,B)=>{if(C)E(C);else F(B)}),D(...u)})}function B8(D){return(...u)=>{let F,E;if(u.push((C,B)=>{F=C,E=B}),D(...u),F)throw F;return E}}function $8(D){if(D={...D},D.fs=E8(D.fs||F8),typeof D.retries==="number"&&D.retries>0||D.retries&&typeof D.retries.retries==="number"&&D.retries.retries>0)throw Object.assign(Error("Cannot use retries with the sync api"),{code:"ESYNC"});return D}l2.exports={toPromise:C8,toSync:B8,toSyncOptions:$8}});var i2=v((HB,GD)=>{var hD=t2(),{toPromise:Qu,toSync:Ku,toSyncOptions:k0}=r2();async function p2(D,u){let F=await Qu(hD.lock)(D,u);return Qu(F)}function A8(D,u){let F=Ku(hD.lock)(D,k0(u));return Ku(F)}function H8(D,u){return Qu(hD.unlock)(D,u)}function x8(D,u){return Ku(hD.unlock)(D,k0(u))}function J8(D,u){return Qu(hD.check)(D,u)}function N8(D,u){return Ku(hD.check)(D,k0(u))}GD.exports=p2;GD.exports.lock=p2;GD.exports.unlock=H8;GD.exports.lockSync=A8;GD.exports.unlockSync=x8;GD.exports.check=J8;GD.exports.checkSync=N8});var Q3=v((Z4,q3)=>{var dD=1000,cD=dD*60,tD=cD*60,wD=tD*24,q8=wD*7,Q8=wD*365.25;q3.exports=function(D,u){u=u||{};var F=typeof D;if(F==="string"&&D.length>0)return K8(D);else if(F==="number"&&isFinite(D))return u.long?L8(D):W8(D);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(D))};function K8(D){if(D=String(D),D.length>100)return;var u=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(D);if(!u)return;var F=parseFloat(u[1]),E=(u[2]||"ms").toLowerCase();switch(E){case"years":case"year":case"yrs":case"yr":case"y":return F*Q8;case"weeks":case"week":case"w":return F*q8;case"days":case"day":case"d":return F*wD;case"hours":case"hour":case"hrs":case"hr":case"h":return F*tD;case"minutes":case"minute":case"mins":case"min":case"m":return F*cD;case"seconds":case"second":case"secs":case"sec":case"s":return F*dD;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return F;default:return}}function W8(D){var u=Math.abs(D);if(u>=wD)return Math.round(D/wD)+"d";if(u>=tD)return Math.round(D/tD)+"h";if(u>=cD)return Math.round(D/cD)+"m";if(u>=dD)return Math.round(D/dD)+"s";return D+"ms"}function L8(D){var u=Math.abs(D);if(u>=wD)return gu(D,u,wD,"day");if(u>=tD)return gu(D,u,tD,"hour");if(u>=cD)return gu(D,u,cD,"minute");if(u>=dD)return gu(D,u,dD,"second");return D+" ms"}function gu(D,u,F,E){var C=u>=F*1.5;return Math.round(D/F)+" "+E+(C?"s":"")}});var YF=rD(ZF(),1),{program:t8,createCommand:l8,createArgument:r8,createOption:p8,CommanderError:i8,InvalidArgumentError:o8,InvalidOptionArgumentError:a8,Command:MF,Argument:s8,Option:e8,Help:D6}=YF.default;var qF=(D=0)=>(u)=>`\x1B[${u+D}m`,QF=(D=0)=>(u)=>`\x1B[${38+D};5;${u}m`,KF=(D=0)=>(u,F,E)=>`\x1B[${38+D};2;${u};${F};${E}m`,w={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},F6=Object.keys(w.modifier),LE=Object.keys(w.color),wE=Object.keys(w.bgColor),E6=[...LE,...wE];function VE(){let D=new Map;for(let[u,F]of Object.entries(w)){for(let[E,C]of Object.entries(F))w[E]={open:`\x1B[${C[0]}m`,close:`\x1B[${C[1]}m`},F[E]=w[E],D.set(C[0],C[1]);Object.defineProperty(w,u,{value:F,enumerable:!1})}return Object.defineProperty(w,"codes",{value:D,enumerable:!1}),w.color.close="\x1B[39m",w.bgColor.close="\x1B[49m",w.color.ansi=qF(),w.color.ansi256=QF(),w.color.ansi16m=KF(),w.bgColor.ansi=qF(10),w.bgColor.ansi256=QF(10),w.bgColor.ansi16m=KF(10),Object.defineProperties(w,{rgbToAnsi256:{value(u,F,E){if(u===F&&F===E){if(u<8)return 16;if(u>248)return 231;return Math.round((u-8)/247*24)+232}return 16+36*Math.round(u/255*5)+6*Math.round(F/255*5)+Math.round(E/255*5)},enumerable:!1},hexToRgb:{value(u){let F=/[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));if(!F)return[0,0,0];let[E]=F;if(E.length===3)E=[...E].map((B)=>B+B).join("");let C=Number.parseInt(E,16);return[C>>16&255,C>>8&255,C&255]},enumerable:!1},hexToAnsi256:{value:(u)=>w.rgbToAnsi256(...w.hexToRgb(u)),enumerable:!1},ansi256ToAnsi:{value(u){if(u<8)return 30+u;if(u<16)return 90+(u-8);let F,E,C;if(u>=232)F=((u-232)*10+8)/255,E=F,C=F;else{u-=16;let A=u%36;F=Math.floor(u/36)/5,E=Math.floor(A/6)/5,C=A%6/5}let B=Math.max(F,E,C)*2;if(B===0)return 30;let $=30+(Math.round(C)<<2|Math.round(E)<<1|Math.round(F));if(B===2)$+=60;return $},enumerable:!1},rgbToAnsi:{value:(u,F,E)=>w.ansi256ToAnsi(w.rgbToAnsi256(u,F,E)),enumerable:!1},hexToAnsi:{value:(u)=>w.ansi256ToAnsi(w.hexToAnsi256(u)),enumerable:!1}}),w}var fE=VE(),CD=fE;import au from"process";import yE from"os";import WF from"tty";function uD(D,u=globalThis.Deno?globalThis.Deno.args:au.argv){let F=D.startsWith("-")?"":D.length===1?"-":"--",E=u.indexOf(F+D),C=u.indexOf("--");return E!==-1&&(C===-1||E<C)}var{env:V}=au,Nu;if(uD("no-color")||uD("no-colors")||uD("color=false")||uD("color=never"))Nu=0;else if(uD("color")||uD("colors")||uD("color=true")||uD("color=always"))Nu=1;function PE(){if("FORCE_COLOR"in V){if(V.FORCE_COLOR==="true")return 1;if(V.FORCE_COLOR==="false")return 0;return V.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(V.FORCE_COLOR,10),3)}}function kE(D){if(D===0)return!1;return{level:D,hasBasic:!0,has256:D>=2,has16m:D>=3}}function hE(D,{streamIsTTY:u,sniffFlags:F=!0}={}){let E=PE();if(E!==void 0)Nu=E;let C=F?Nu:E;if(C===0)return 0;if(F){if(uD("color=16m")||uD("color=full")||uD("color=truecolor"))return 3;if(uD("color=256"))return 2}if("TF_BUILD"in V&&"AGENT_NAME"in V)return 1;if(D&&!u&&C===void 0)return 0;let B=C||0;if(V.TERM==="dumb")return B;if(au.platform==="win32"){let $=yE.release().split(".");if(Number($[0])>=10&&Number($[2])>=10586)return Number($[2])>=14931?3:2;return 1}if("CI"in V){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(($)=>($ in V)))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(($)=>($ in V))||V.CI_NAME==="codeship")return 1;return B}if("TEAMCITY_VERSION"in V)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(V.TEAMCITY_VERSION)?1:0;if(V.COLORTERM==="truecolor")return 3;if(V.TERM==="xterm-kitty")return 3;if(V.TERM==="xterm-ghostty")return 3;if(V.TERM==="wezterm")return 3;if("TERM_PROGRAM"in V){let $=Number.parseInt((V.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(V.TERM_PROGRAM){case"iTerm.app":return $>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(V.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(V.TERM))return 1;if("COLORTERM"in V)return 1;return B}function LF(D,u={}){let F=hE(D,{streamIsTTY:D&&D.isTTY,...u});return kE(F)}var bE={stdout:LF({isTTY:WF.isatty(1)}),stderr:LF({isTTY:WF.isatty(2)})},wF=bE;function VF(D,u,F){let E=D.indexOf(u);if(E===-1)return D;let C=u.length,B=0,$="";do $+=D.slice(B,E)+u+F,B=E+C,E=D.indexOf(u,B);while(E!==-1);return $+=D.slice(B),$}function fF(D,u,F,E){let C=0,B="";do{let $=D[E-1]==="\r";B+=D.slice(C,$?E-1:E)+u+($?`\r
30
30
  `:`
31
31
  `)+F,C=E+1,E=D.indexOf(`
32
- `,C)}while(E!==-1);return B+=D.slice(C),B}var{stdout:ZF,stderr:LF}=zF,au=Symbol("GENERATOR"),LD=Symbol("STYLER"),gD=Symbol("IS_EMPTY"),YF=["ansi","ansi","ansi256","ansi16m"],YD=Object.create(null),KC=(D,u={})=>{if(u.level&&!(Number.isInteger(u.level)&&u.level>=0&&u.level<=3))throw Error("The `level` option should be an integer from 0 to 3");let F=ZF?ZF.level:0;D.level=u.level===void 0?F:u.level};var WC=(D)=>{let u=(...F)=>F.join(" ");return KC(u,D),Object.setPrototypeOf(u,iD.prototype),u};function iD(D){return WC(D)}Object.setPrototypeOf(iD.prototype,Function.prototype);for(let[D,u]of Object.entries(ED))YD[D]={get(){let F=Hu(this,pu(u.open,u.close,this[LD]),this[gD]);return Object.defineProperty(this,D,{value:F}),F}};YD.visible={get(){let D=Hu(this,this[LD],!0);return Object.defineProperty(this,"visible",{value:D}),D}};var lu=(D,u,F,...E)=>{if(D==="rgb"){if(u==="ansi16m")return ED[F].ansi16m(...E);if(u==="ansi256")return ED[F].ansi256(ED.rgbToAnsi256(...E));return ED[F].ansi(ED.rgbToAnsi(...E))}if(D==="hex")return lu("rgb",u,F,...ED.hexToRgb(...E));return ED[F][D](...E)},yC=["rgb","hex","ansi256"];for(let D of yC){YD[D]={get(){let{level:F}=this;return function(...E){let C=pu(lu(D,YF[F],"color",...E),ED.color.close,this[LD]);return Hu(this,C,this[gD])}}};let u="bg"+D[0].toUpperCase()+D.slice(1);YD[u]={get(){let{level:F}=this;return function(...E){let C=pu(lu(D,YF[F],"bgColor",...E),ED.bgColor.close,this[LD]);return Hu(this,C,this[gD])}}}}var PC=Object.defineProperties(()=>{},{...YD,level:{enumerable:!0,get(){return this[au].level},set(D){this[au].level=D}}}),pu=(D,u,F)=>{let E,C;if(F===void 0)E=D,C=u;else E=F.openAll+D,C=u+F.closeAll;return{open:D,close:u,openAll:E,closeAll:C,parent:F}},Hu=(D,u,F)=>{let E=(...C)=>VC(E,C.length===1?""+C[0]:C.join(" "));return Object.setPrototypeOf(E,PC),E[au]=D,E[LD]=u,E[gD]=F,E},VC=(D,u)=>{if(D.level<=0||!u)return D[gD]?"":u;let F=D[LD];if(F===void 0)return u;let{openAll:E,closeAll:C}=F;if(u.includes("\x1B"))while(F!==void 0)u=UF(u,F.close,F.open),F=F.parent;let B=u.indexOf(`
33
- `);if(B!==-1)u=MF(u,C,E,B);return E+u+C};Object.defineProperties(iD.prototype,YD);var kC=iD(),t6=iD({level:LF?LF.level:0});var S=kC;var eu=(D)=>D.name==="backspace",sD=(D)=>D.name==="tab";var aD=(D)=>D.name==="enter"||D.name==="return";class D0 extends Error{name="AbortPromptError";message="Prompt was aborted";constructor(D){super();this.cause=D?.cause}}class u0 extends Error{name="CancelPromptError";message="Prompt was canceled"}class uD extends Error{name="ExitPromptError"}class F0 extends Error{name="HookError"}class E0 extends Error{name="ValidationError"}import{AsyncResource as vC}from"async_hooks";import{AsyncLocalStorage as mC,AsyncResource as rC}from"async_hooks";var QF=new mC;function bC(D){return{rl:D,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function KF(D,u){let F=bC(D);return QF.run(F,()=>{function E(C){F.handleChange=()=>{F.index=0,C()},F.handleChange()}return u(E)})}function ND(){let D=QF.getStore();if(!D)throw new F0("[Inquirer] Hook functions can only be called from within a prompt");return D}function C0(){return ND().rl}function B0(D){let u=(...F)=>{let E=ND(),C=!1,B=E.handleChange;E.handleChange=()=>{C=!0};let t=D(...F);if(C)B();return E.handleChange=B,t};return rC.bind(u)}function nu(D){let u=ND(),{index:F}=u,E={get(){return u.hooks[F]},set(B){u.hooks[F]=B},initialized:F in u.hooks},C=D(E);return u.index++,C}function WF(){ND().handleChange()}var OD={queue(D){let u=ND(),{index:F}=u;u.hooksEffect.push(()=>{u.hooksCleanup[F]?.();let E=D(C0());if(E!=null&&typeof E!=="function")throw new E0("useEffect return value must be a cleanup function or nothing.");u.hooksCleanup[F]=E})},run(){let D=ND();B0(()=>{D.hooksEffect.forEach((u)=>{u()}),D.hooksEffect.length=0})()},clearAll(){let D=ND();D.hooksCleanup.forEach((u)=>{u?.()}),D.hooksEffect.length=0,D.hooksCleanup.length=0}};function l(D){return nu((u)=>{let F=vC.bind(function(B){if(u.get()!==B)u.set(B),WF()});if(u.initialized)return[u.get(),F];let E=typeof D==="function"?D():D;return u.set(E),[E,F]})}function _D(D,u){nu((F)=>{let E=F.get();if(!Array.isArray(E)||u.some((B,t)=>!Object.is(B,E[t])))OD.queue(D);F.set(u)})}import{styleText as CD}from"util";import BD from"process";function oC(){if(BD.platform!=="win32")return BD.env.TERM!=="linux";return Boolean(BD.env.WT_SESSION)||Boolean(BD.env.TERMINUS_SUBLIME)||BD.env.ConEmuTask==="{cmd::Cmder}"||BD.env.TERM_PROGRAM==="Terminus-Sublime"||BD.env.TERM_PROGRAM==="vscode"||BD.env.TERM==="xterm-256color"||BD.env.TERM==="alacritty"||BD.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var yF={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},PF={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},dC={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},cC={...yF,...PF},gC={...yF,...dC},iC=oC(),sC=iC?cC:gC,VF=sC,_6=Object.entries(PF);var kF={prefix:{idle:CD("blue","?"),done:CD("green",VF.tick)},spinner:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"].map((D)=>CD("yellow",D))},style:{answer:(D)=>CD("cyan",D),message:(D)=>CD("bold",D),error:(D)=>CD("red",`> ${D}`),defaultAnswer:(D)=>CD("dim",`(${D})`),help:(D)=>CD("dim",D),highlight:(D)=>CD("cyan",D),key:(D)=>CD("cyan",CD("bold",`<${D}>`))}};function mF(D){if(typeof D!=="object"||D===null)return!1;let u=D;while(Object.getPrototypeOf(u)!==null)u=Object.getPrototypeOf(u);return Object.getPrototypeOf(D)===u}function rF(...D){let u={};for(let F of D)for(let[E,C]of Object.entries(F)){let B=u[E];u[E]=mF(B)&&mF(C)?rF(B,C):C}return u}function TD(...D){let u=[kF,...D.filter((F)=>F!=null)];return rF(...u)}function lD({status:D="idle",theme:u}){let[F,E]=l(!1),[C,B]=l(0),{prefix:t,spinner:$}=TD(u);if(_D(()=>{if(D==="loading"){let A,x=-1,H=setTimeout(()=>{E(!0),A=setInterval(()=>{x=x+1,B(x%$.frames.length)},$.interval)},300);return()=>{clearTimeout(H),clearInterval(A)}}else E(!1)},[D]),F)return $.frames[C];return typeof t==="string"?t:t[D==="loading"?"idle":D]??t.idle}function bF(D){return l({current:D})[0]}function pD(D){let u=bF(D);u.current=D,_D((F)=>{let E=!1,C=B0((B,t)=>{if(E)return;u.current(t,F)});return F.input.on("keypress",C),()=>{E=!0,F.input.removeListener("keypress",C)}},[])}var C2=dD(oF(),1);function t0({onlyFirst:D=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",D?void 0:"g")}var pC=t0();function eD(D){if(typeof D!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof D}\``);return D.replace(pC,"")}function dF(D){return D===161||D===164||D===167||D===168||D===170||D===173||D===174||D>=176&&D<=180||D>=182&&D<=186||D>=188&&D<=191||D===198||D===208||D===215||D===216||D>=222&&D<=225||D===230||D>=232&&D<=234||D===236||D===237||D===240||D===242||D===243||D>=247&&D<=250||D===252||D===254||D===257||D===273||D===275||D===283||D===294||D===295||D===299||D>=305&&D<=307||D===312||D>=319&&D<=322||D===324||D>=328&&D<=331||D===333||D===338||D===339||D===358||D===359||D===363||D===462||D===464||D===466||D===468||D===470||D===472||D===474||D===476||D===593||D===609||D===708||D===711||D>=713&&D<=715||D===717||D===720||D>=728&&D<=731||D===733||D===735||D>=768&&D<=879||D>=913&&D<=929||D>=931&&D<=937||D>=945&&D<=961||D>=963&&D<=969||D===1025||D>=1040&&D<=1103||D===1105||D===8208||D>=8211&&D<=8214||D===8216||D===8217||D===8220||D===8221||D>=8224&&D<=8226||D>=8228&&D<=8231||D===8240||D===8242||D===8243||D===8245||D===8251||D===8254||D===8308||D===8319||D>=8321&&D<=8324||D===8364||D===8451||D===8453||D===8457||D===8467||D===8470||D===8481||D===8482||D===8486||D===8491||D===8531||D===8532||D>=8539&&D<=8542||D>=8544&&D<=8555||D>=8560&&D<=8569||D===8585||D>=8592&&D<=8601||D===8632||D===8633||D===8658||D===8660||D===8679||D===8704||D===8706||D===8707||D===8711||D===8712||D===8715||D===8719||D===8721||D===8725||D===8730||D>=8733&&D<=8736||D===8739||D===8741||D>=8743&&D<=8748||D===8750||D>=8756&&D<=8759||D===8764||D===8765||D===8776||D===8780||D===8786||D===8800||D===8801||D>=8804&&D<=8807||D===8810||D===8811||D===8814||D===8815||D===8834||D===8835||D===8838||D===8839||D===8853||D===8857||D===8869||D===8895||D===8978||D>=9312&&D<=9449||D>=9451&&D<=9547||D>=9552&&D<=9587||D>=9600&&D<=9615||D>=9618&&D<=9621||D===9632||D===9633||D>=9635&&D<=9641||D===9650||D===9651||D===9654||D===9655||D===9660||D===9661||D===9664||D===9665||D>=9670&&D<=9672||D===9675||D>=9678&&D<=9681||D>=9698&&D<=9701||D===9711||D===9733||D===9734||D===9737||D===9742||D===9743||D===9756||D===9758||D===9792||D===9794||D===9824||D===9825||D>=9827&&D<=9829||D>=9831&&D<=9834||D===9836||D===9837||D===9839||D===9886||D===9887||D===9919||D>=9926&&D<=9933||D>=9935&&D<=9939||D>=9941&&D<=9953||D===9955||D===9960||D===9961||D>=9963&&D<=9969||D===9972||D>=9974&&D<=9977||D===9979||D===9980||D===9982||D===9983||D===10045||D>=10102&&D<=10111||D>=11094&&D<=11097||D>=12872&&D<=12879||D>=57344&&D<=63743||D>=65024&&D<=65039||D===65533||D>=127232&&D<=127242||D>=127248&&D<=127277||D>=127280&&D<=127337||D>=127344&&D<=127373||D===127375||D===127376||D>=127387&&D<=127404||D>=917760&&D<=917999||D>=983040&&D<=1048573||D>=1048576&&D<=1114109}function cF(D){return D===12288||D>=65281&&D<=65376||D>=65504&&D<=65510}function gF(D){return D>=4352&&D<=4447||D===8986||D===8987||D===9001||D===9002||D>=9193&&D<=9196||D===9200||D===9203||D===9725||D===9726||D===9748||D===9749||D>=9776&&D<=9783||D>=9800&&D<=9811||D===9855||D>=9866&&D<=9871||D===9875||D===9889||D===9898||D===9899||D===9917||D===9918||D===9924||D===9925||D===9934||D===9940||D===9962||D===9970||D===9971||D===9973||D===9978||D===9981||D===9989||D===9994||D===9995||D===10024||D===10060||D===10062||D>=10067&&D<=10069||D===10071||D>=10133&&D<=10135||D===10160||D===10175||D===11035||D===11036||D===11088||D===11093||D>=11904&&D<=11929||D>=11931&&D<=12019||D>=12032&&D<=12245||D>=12272&&D<=12287||D>=12289&&D<=12350||D>=12353&&D<=12438||D>=12441&&D<=12543||D>=12549&&D<=12591||D>=12593&&D<=12686||D>=12688&&D<=12773||D>=12783&&D<=12830||D>=12832&&D<=12871||D>=12880&&D<=42124||D>=42128&&D<=42182||D>=43360&&D<=43388||D>=44032&&D<=55203||D>=63744&&D<=64255||D>=65040&&D<=65049||D>=65072&&D<=65106||D>=65108&&D<=65126||D>=65128&&D<=65131||D>=94176&&D<=94180||D>=94192&&D<=94198||D>=94208&&D<=101589||D>=101631&&D<=101662||D>=101760&&D<=101874||D>=110576&&D<=110579||D>=110581&&D<=110587||D===110589||D===110590||D>=110592&&D<=110882||D===110898||D>=110928&&D<=110930||D===110933||D>=110948&&D<=110951||D>=110960&&D<=111355||D>=119552&&D<=119638||D>=119648&&D<=119670||D===126980||D===127183||D===127374||D>=127377&&D<=127386||D>=127488&&D<=127490||D>=127504&&D<=127547||D>=127552&&D<=127560||D===127568||D===127569||D>=127584&&D<=127589||D>=127744&&D<=127776||D>=127789&&D<=127797||D>=127799&&D<=127868||D>=127870&&D<=127891||D>=127904&&D<=127946||D>=127951&&D<=127955||D>=127968&&D<=127984||D===127988||D>=127992&&D<=128062||D===128064||D>=128066&&D<=128252||D>=128255&&D<=128317||D>=128331&&D<=128334||D>=128336&&D<=128359||D===128378||D===128405||D===128406||D===128420||D>=128507&&D<=128591||D>=128640&&D<=128709||D===128716||D>=128720&&D<=128722||D>=128725&&D<=128728||D>=128732&&D<=128735||D===128747||D===128748||D>=128756&&D<=128764||D>=128992&&D<=129003||D===129008||D>=129292&&D<=129338||D>=129340&&D<=129349||D>=129351&&D<=129535||D>=129648&&D<=129660||D>=129664&&D<=129674||D>=129678&&D<=129734||D===129736||D>=129741&&D<=129756||D>=129759&&D<=129770||D>=129775&&D<=129784||D>=131072&&D<=196605||D>=196608&&D<=262141}function eC(D){if(!Number.isSafeInteger(D))throw TypeError(`Expected a code point, got \`${typeof D}\`.`)}function iF(D,{ambiguousAsWide:u=!1}={}){if(eC(D),cF(D)||gF(D)||u&&dF(D))return 2;return 1}var sF=()=>{return/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g};var D3=new Intl.Segmenter,u3=/^\p{Default_Ignorable_Code_Point}$/u;function ID(D,u={}){if(typeof D!=="string"||D.length===0)return 0;let{ambiguousIsNarrow:F=!0,countAnsiEscapeCodes:E=!1}=u;if(!E)D=eD(D);if(D.length===0)return 0;let C=0,B={ambiguousAsWide:!F};for(let{segment:t}of D3.segment(D)){let $=t.codePointAt(0);if($<=31||$>=127&&$<=159)continue;if($>=8203&&$<=8207||$===65279)continue;if($>=768&&$<=879||$>=6832&&$<=6911||$>=7616&&$<=7679||$>=8400&&$<=8447||$>=65056&&$<=65071)continue;if($>=55296&&$<=57343)continue;if($>=65024&&$<=65039)continue;if(u3.test(t))continue;if(sF().test(t)){C+=2;continue}C+=iF($,B)}return C}var aF=(D=0)=>(u)=>`\x1B[${u+D}m`,lF=(D=0)=>(u)=>`\x1B[${38+D};5;${u}m`,pF=(D=0)=>(u,F,E)=>`\x1B[${38+D};2;${u};${F};${E}m`,Y={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},s6=Object.keys(Y.modifier),F3=Object.keys(Y.color),E3=Object.keys(Y.bgColor),a6=[...F3,...E3];function C3(){let D=new Map;for(let[u,F]of Object.entries(Y)){for(let[E,C]of Object.entries(F))Y[E]={open:`\x1B[${C[0]}m`,close:`\x1B[${C[1]}m`},F[E]=Y[E],D.set(C[0],C[1]);Object.defineProperty(Y,u,{value:F,enumerable:!1})}return Object.defineProperty(Y,"codes",{value:D,enumerable:!1}),Y.color.close="\x1B[39m",Y.bgColor.close="\x1B[49m",Y.color.ansi=aF(),Y.color.ansi256=lF(),Y.color.ansi16m=pF(),Y.bgColor.ansi=aF(10),Y.bgColor.ansi256=lF(10),Y.bgColor.ansi16m=pF(10),Object.defineProperties(Y,{rgbToAnsi256:{value(u,F,E){if(u===F&&F===E){if(u<8)return 16;if(u>248)return 231;return Math.round((u-8)/247*24)+232}return 16+36*Math.round(u/255*5)+6*Math.round(F/255*5)+Math.round(E/255*5)},enumerable:!1},hexToRgb:{value(u){let F=/[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));if(!F)return[0,0,0];let[E]=F;if(E.length===3)E=[...E].map((B)=>B+B).join("");let C=Number.parseInt(E,16);return[C>>16&255,C>>8&255,C&255]},enumerable:!1},hexToAnsi256:{value:(u)=>Y.rgbToAnsi256(...Y.hexToRgb(u)),enumerable:!1},ansi256ToAnsi:{value(u){if(u<8)return 30+u;if(u<16)return 90+(u-8);let F,E,C;if(u>=232)F=((u-232)*10+8)/255,E=F,C=F;else{u-=16;let $=u%36;F=Math.floor(u/36)/5,E=Math.floor($/6)/5,C=$%6/5}let B=Math.max(F,E,C)*2;if(B===0)return 30;let t=30+(Math.round(C)<<2|Math.round(E)<<1|Math.round(F));if(B===2)t+=60;return t},enumerable:!1},rgbToAnsi:{value:(u,F,E)=>Y.ansi256ToAnsi(Y.rgbToAnsi256(u,F,E)),enumerable:!1},hexToAnsi:{value:(u)=>Y.ansi256ToAnsi(Y.hexToAnsi256(u)),enumerable:!1}}),Y}var B3=C3(),eF=B3;var wu=new Set(["\x1B","\x9B"]),t3=39,x0="\x07",F2="[",$3="]",E2="m",Su=`${$3}8;;`,D2=(D)=>`${wu.values().next().value}${F2}${D}${E2}`,u2=(D)=>`${wu.values().next().value}${Su}${D}${x0}`,x3=(D)=>D.split(" ").map((u)=>ID(u)),$0=(D,u,F)=>{let E=[...u],C=!1,B=!1,t=ID(eD(D.at(-1)));for(let[$,n]of E.entries()){let A=ID(n);if(t+A<=F)D[D.length-1]+=n;else D.push(n),t=0;if(wu.has(n))C=!0,B=E.slice($+1,$+1+Su.length).join("")===Su;if(C){if(B){if(n===x0)C=!1,B=!1}else if(n===E2)C=!1;continue}if(t+=A,t===F&&$<E.length-1)D.push(""),t=0}if(!t&&D.at(-1).length>0&&D.length>1)D[D.length-2]+=D.pop()},A3=(D)=>{let u=D.split(" "),F=u.length;while(F>0){if(ID(u[F-1])>0)break;F--}if(F===u.length)return D;return u.slice(0,F).join(" ")+u.slice(F).join("")},H3=(D,u,F={})=>{if(F.trim!==!1&&D.trim()==="")return"";let E="",C,B,t=x3(D),$=[""];for(let[H,R]of D.split(" ").entries()){if(F.trim!==!1)$[$.length-1]=$.at(-1).trimStart();let w=ID($.at(-1));if(H!==0){if(w>=u&&(F.wordWrap===!1||F.trim===!1))$.push(""),w=0;if(w>0||F.trim===!1)$[$.length-1]+=" ",w++}if(F.hard&&t[H]>u){let h=u-w,f=1+Math.floor((t[H]-h-1)/u);if(Math.floor((t[H]-1)/u)<f)$.push("");$0($,R,u);continue}if(w+t[H]>u&&w>0&&t[H]>0){if(F.wordWrap===!1&&w<u){$0($,R,u);continue}$.push("")}if(w+t[H]>u&&F.wordWrap===!1){$0($,R,u);continue}$[$.length-1]+=R}if(F.trim!==!1)$=$.map((H)=>A3(H));let n=$.join(`
34
- `),A=[...n],x=0;for(let[H,R]of A.entries()){if(E+=R,wu.has(R)){let{groups:h}=new RegExp(`(?:\\${F2}(?<code>\\d+)m|\\${Su}(?<uri>.*)${x0})`).exec(n.slice(x))||{groups:{}};if(h.code!==void 0){let f=Number.parseFloat(h.code);C=f===t3?void 0:f}else if(h.uri!==void 0)B=h.uri.length===0?void 0:h.uri}let w=eF.codes.get(Number(C));if(A[H+1]===`
35
- `){if(B)E+=u2("");if(C&&w)E+=D2(w)}else if(R===`
36
- `){if(C&&w)E+=D2(C);if(B)E+=u2(B)}x+=R.length}return E};function A0(D,u,F){return String(D).normalize().replaceAll(`\r
32
+ `,C)}while(E!==-1);return B+=D.slice(C),B}var{stdout:yF,stderr:PF}=wF,su=Symbol("GENERATOR"),VD=Symbol("STYLER"),iD=Symbol("IS_EMPTY"),kF=["ansi","ansi","ansi256","ansi16m"],fD=Object.create(null),vE=(D,u={})=>{if(u.level&&!(Number.isInteger(u.level)&&u.level>=0&&u.level<=3))throw Error("The `level` option should be an integer from 0 to 3");let F=yF?yF.level:0;D.level=u.level===void 0?F:u.level};var mE=(D)=>{let u=(...F)=>F.join(" ");return vE(u,D),Object.setPrototypeOf(u,oD.prototype),u};function oD(D){return mE(D)}Object.setPrototypeOf(oD.prototype,Function.prototype);for(let[D,u]of Object.entries(CD))fD[D]={get(){let F=Ru(this,D0(u.open,u.close,this[VD]),this[iD]);return Object.defineProperty(this,D,{value:F}),F}};fD.visible={get(){let D=Ru(this,this[VD],!0);return Object.defineProperty(this,"visible",{value:D}),D}};var eu=(D,u,F,...E)=>{if(D==="rgb"){if(u==="ansi16m")return CD[F].ansi16m(...E);if(u==="ansi256")return CD[F].ansi256(CD.rgbToAnsi256(...E));return CD[F].ansi(CD.rgbToAnsi(...E))}if(D==="hex")return eu("rgb",u,F,...CD.hexToRgb(...E));return CD[F][D](...E)},gE=["rgb","hex","ansi256"];for(let D of gE){fD[D]={get(){let{level:F}=this;return function(...E){let C=D0(eu(D,kF[F],"color",...E),CD.color.close,this[VD]);return Ru(this,C,this[iD])}}};let u="bg"+D[0].toUpperCase()+D.slice(1);fD[u]={get(){let{level:F}=this;return function(...E){let C=D0(eu(D,kF[F],"bgColor",...E),CD.bgColor.close,this[VD]);return Ru(this,C,this[iD])}}}}var nE=Object.defineProperties(()=>{},{...fD,level:{enumerable:!0,get(){return this[su].level},set(D){this[su].level=D}}}),D0=(D,u,F)=>{let E,C;if(F===void 0)E=D,C=u;else E=F.openAll+D,C=u+F.closeAll;return{open:D,close:u,openAll:E,closeAll:C,parent:F}},Ru=(D,u,F)=>{let E=(...C)=>dE(E,C.length===1?""+C[0]:C.join(" "));return Object.setPrototypeOf(E,nE),E[su]=D,E[VD]=u,E[iD]=F,E},dE=(D,u)=>{if(D.level<=0||!u)return D[iD]?"":u;let F=D[VD];if(F===void 0)return u;let{openAll:E,closeAll:C}=F;if(u.includes("\x1B"))while(F!==void 0)u=VF(u,F.close,F.open),F=F.parent;let B=u.indexOf(`
33
+ `);if(B!==-1)u=fF(u,C,E,B);return E+u+C};Object.defineProperties(oD.prototype,fD);var cE=oD(),_6=oD({level:PF?PF.level:0});var N=cE;var u0=(D)=>D.name==="backspace",aD=(D)=>D.name==="tab";var sD=(D)=>D.name==="enter"||D.name==="return";class F0 extends Error{name="AbortPromptError";message="Prompt was aborted";constructor(D){super();this.cause=D?.cause}}class E0 extends Error{name="CancelPromptError";message="Prompt was canceled"}class FD extends Error{name="ExitPromptError"}class C0 extends Error{name="HookError"}class B0 extends Error{name="ValidationError"}import{AsyncResource as pE}from"async_hooks";import{AsyncLocalStorage as tE,AsyncResource as lE}from"async_hooks";var hF=new tE;function rE(D){return{rl:D,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function bF(D,u){let F=rE(D);return hF.run(F,()=>{function E(C){F.handleChange=()=>{F.index=0,C()},F.handleChange()}return u(E)})}function SD(){let D=hF.getStore();if(!D)throw new C0("[Inquirer] Hook functions can only be called from within a prompt");return D}function $0(){return SD().rl}function A0(D){let u=(...F)=>{let E=SD(),C=!1,B=E.handleChange;E.handleChange=()=>{C=!0};let $=D(...F);if(C)B();return E.handleChange=B,$};return lE.bind(u)}function _u(D){let u=SD(),{index:F}=u,E={get(){return u.hooks[F]},set(B){u.hooks[F]=B},initialized:F in u.hooks},C=D(E);return u.index++,C}function vF(){SD().handleChange()}var zD={queue(D){let u=SD(),{index:F}=u;u.hooksEffect.push(()=>{u.hooksCleanup[F]?.();let E=D($0());if(E!=null&&typeof E!=="function")throw new B0("useEffect return value must be a cleanup function or nothing.");u.hooksCleanup[F]=E})},run(){let D=SD();A0(()=>{D.hooksEffect.forEach((u)=>{u()}),D.hooksEffect.length=0})()},clearAll(){let D=SD();D.hooksCleanup.forEach((u)=>{u?.()}),D.hooksEffect.length=0,D.hooksCleanup.length=0}};function s(D){return _u((u)=>{let F=pE.bind(function(B){if(u.get()!==B)u.set(B),vF()});if(u.initialized)return[u.get(),F];let E=typeof D==="function"?D():D;return u.set(E),[E,F]})}function ID(D,u){_u((F)=>{let E=F.get();if(!Array.isArray(E)||u.some((B,$)=>!Object.is(B,E[$])))zD.queue(D);F.set(u)})}import{styleText as BD}from"util";import $D from"process";function iE(){if($D.platform!=="win32")return $D.env.TERM!=="linux";return Boolean($D.env.WT_SESSION)||Boolean($D.env.TERMINUS_SUBLIME)||$D.env.ConEmuTask==="{cmd::Cmder}"||$D.env.TERM_PROGRAM==="Terminus-Sublime"||$D.env.TERM_PROGRAM==="vscode"||$D.env.TERM==="xterm-256color"||$D.env.TERM==="alacritty"||$D.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var mF={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},gF={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},oE={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},aE={...mF,...gF},sE={...mF,...oE},eE=iE(),DC=eE?aE:sE,nF=DC,q6=Object.entries(gF);var dF={prefix:{idle:BD("blue","?"),done:BD("green",nF.tick)},spinner:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"].map((D)=>BD("yellow",D))},style:{answer:(D)=>BD("cyan",D),message:(D)=>BD("bold",D),error:(D)=>BD("red",`> ${D}`),defaultAnswer:(D)=>BD("dim",`(${D})`),help:(D)=>BD("dim",D),highlight:(D)=>BD("cyan",D),key:(D)=>BD("cyan",BD("bold",`<${D}>`))}};function cF(D){if(typeof D!=="object"||D===null)return!1;let u=D;while(Object.getPrototypeOf(u)!==null)u=Object.getPrototypeOf(u);return Object.getPrototypeOf(D)===u}function tF(...D){let u={};for(let F of D)for(let[E,C]of Object.entries(F)){let B=u[E];u[E]=cF(B)&&cF(C)?tF(B,C):C}return u}function UD(...D){let u=[dF,...D.filter((F)=>F!=null)];return tF(...u)}function eD({status:D="idle",theme:u}){let[F,E]=s(!1),[C,B]=s(0),{prefix:$,spinner:A}=UD(u);if(ID(()=>{if(D==="loading"){let x,H=-1,J=setTimeout(()=>{E(!0),x=setInterval(()=>{H=H+1,B(H%A.frames.length)},A.interval)},300);return()=>{clearTimeout(J),clearInterval(x)}}else E(!1)},[D]),F)return A.frames[C];return typeof $==="string"?$:$[D==="loading"?"idle":D]??$.idle}function lF(D){return s({current:D})[0]}function Du(D){let u=lF(D);u.current=D,ID((F)=>{let E=!1,C=A0((B,$)=>{if(E)return;u.current($,F)});return F.input.on("keypress",C),()=>{E=!0,F.input.removeListener("keypress",C)}},[])}var H2=rD(pF(),1);function H0({onlyFirst:D=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",D?void 0:"g")}var EC=H0();function uu(D){if(typeof D!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof D}\``);return D.replace(EC,"")}function iF(D){return D===161||D===164||D===167||D===168||D===170||D===173||D===174||D>=176&&D<=180||D>=182&&D<=186||D>=188&&D<=191||D===198||D===208||D===215||D===216||D>=222&&D<=225||D===230||D>=232&&D<=234||D===236||D===237||D===240||D===242||D===243||D>=247&&D<=250||D===252||D===254||D===257||D===273||D===275||D===283||D===294||D===295||D===299||D>=305&&D<=307||D===312||D>=319&&D<=322||D===324||D>=328&&D<=331||D===333||D===338||D===339||D===358||D===359||D===363||D===462||D===464||D===466||D===468||D===470||D===472||D===474||D===476||D===593||D===609||D===708||D===711||D>=713&&D<=715||D===717||D===720||D>=728&&D<=731||D===733||D===735||D>=768&&D<=879||D>=913&&D<=929||D>=931&&D<=937||D>=945&&D<=961||D>=963&&D<=969||D===1025||D>=1040&&D<=1103||D===1105||D===8208||D>=8211&&D<=8214||D===8216||D===8217||D===8220||D===8221||D>=8224&&D<=8226||D>=8228&&D<=8231||D===8240||D===8242||D===8243||D===8245||D===8251||D===8254||D===8308||D===8319||D>=8321&&D<=8324||D===8364||D===8451||D===8453||D===8457||D===8467||D===8470||D===8481||D===8482||D===8486||D===8491||D===8531||D===8532||D>=8539&&D<=8542||D>=8544&&D<=8555||D>=8560&&D<=8569||D===8585||D>=8592&&D<=8601||D===8632||D===8633||D===8658||D===8660||D===8679||D===8704||D===8706||D===8707||D===8711||D===8712||D===8715||D===8719||D===8721||D===8725||D===8730||D>=8733&&D<=8736||D===8739||D===8741||D>=8743&&D<=8748||D===8750||D>=8756&&D<=8759||D===8764||D===8765||D===8776||D===8780||D===8786||D===8800||D===8801||D>=8804&&D<=8807||D===8810||D===8811||D===8814||D===8815||D===8834||D===8835||D===8838||D===8839||D===8853||D===8857||D===8869||D===8895||D===8978||D>=9312&&D<=9449||D>=9451&&D<=9547||D>=9552&&D<=9587||D>=9600&&D<=9615||D>=9618&&D<=9621||D===9632||D===9633||D>=9635&&D<=9641||D===9650||D===9651||D===9654||D===9655||D===9660||D===9661||D===9664||D===9665||D>=9670&&D<=9672||D===9675||D>=9678&&D<=9681||D>=9698&&D<=9701||D===9711||D===9733||D===9734||D===9737||D===9742||D===9743||D===9756||D===9758||D===9792||D===9794||D===9824||D===9825||D>=9827&&D<=9829||D>=9831&&D<=9834||D===9836||D===9837||D===9839||D===9886||D===9887||D===9919||D>=9926&&D<=9933||D>=9935&&D<=9939||D>=9941&&D<=9953||D===9955||D===9960||D===9961||D>=9963&&D<=9969||D===9972||D>=9974&&D<=9977||D===9979||D===9980||D===9982||D===9983||D===10045||D>=10102&&D<=10111||D>=11094&&D<=11097||D>=12872&&D<=12879||D>=57344&&D<=63743||D>=65024&&D<=65039||D===65533||D>=127232&&D<=127242||D>=127248&&D<=127277||D>=127280&&D<=127337||D>=127344&&D<=127373||D===127375||D===127376||D>=127387&&D<=127404||D>=917760&&D<=917999||D>=983040&&D<=1048573||D>=1048576&&D<=1114109}function oF(D){return D===12288||D>=65281&&D<=65376||D>=65504&&D<=65510}function aF(D){return D>=4352&&D<=4447||D===8986||D===8987||D===9001||D===9002||D>=9193&&D<=9196||D===9200||D===9203||D===9725||D===9726||D===9748||D===9749||D>=9776&&D<=9783||D>=9800&&D<=9811||D===9855||D>=9866&&D<=9871||D===9875||D===9889||D===9898||D===9899||D===9917||D===9918||D===9924||D===9925||D===9934||D===9940||D===9962||D===9970||D===9971||D===9973||D===9978||D===9981||D===9989||D===9994||D===9995||D===10024||D===10060||D===10062||D>=10067&&D<=10069||D===10071||D>=10133&&D<=10135||D===10160||D===10175||D===11035||D===11036||D===11088||D===11093||D>=11904&&D<=11929||D>=11931&&D<=12019||D>=12032&&D<=12245||D>=12272&&D<=12287||D>=12289&&D<=12350||D>=12353&&D<=12438||D>=12441&&D<=12543||D>=12549&&D<=12591||D>=12593&&D<=12686||D>=12688&&D<=12773||D>=12783&&D<=12830||D>=12832&&D<=12871||D>=12880&&D<=42124||D>=42128&&D<=42182||D>=43360&&D<=43388||D>=44032&&D<=55203||D>=63744&&D<=64255||D>=65040&&D<=65049||D>=65072&&D<=65106||D>=65108&&D<=65126||D>=65128&&D<=65131||D>=94176&&D<=94180||D>=94192&&D<=94198||D>=94208&&D<=101589||D>=101631&&D<=101662||D>=101760&&D<=101874||D>=110576&&D<=110579||D>=110581&&D<=110587||D===110589||D===110590||D>=110592&&D<=110882||D===110898||D>=110928&&D<=110930||D===110933||D>=110948&&D<=110951||D>=110960&&D<=111355||D>=119552&&D<=119638||D>=119648&&D<=119670||D===126980||D===127183||D===127374||D>=127377&&D<=127386||D>=127488&&D<=127490||D>=127504&&D<=127547||D>=127552&&D<=127560||D===127568||D===127569||D>=127584&&D<=127589||D>=127744&&D<=127776||D>=127789&&D<=127797||D>=127799&&D<=127868||D>=127870&&D<=127891||D>=127904&&D<=127946||D>=127951&&D<=127955||D>=127968&&D<=127984||D===127988||D>=127992&&D<=128062||D===128064||D>=128066&&D<=128252||D>=128255&&D<=128317||D>=128331&&D<=128334||D>=128336&&D<=128359||D===128378||D===128405||D===128406||D===128420||D>=128507&&D<=128591||D>=128640&&D<=128709||D===128716||D>=128720&&D<=128722||D>=128725&&D<=128728||D>=128732&&D<=128735||D===128747||D===128748||D>=128756&&D<=128764||D>=128992&&D<=129003||D===129008||D>=129292&&D<=129338||D>=129340&&D<=129349||D>=129351&&D<=129535||D>=129648&&D<=129660||D>=129664&&D<=129674||D>=129678&&D<=129734||D===129736||D>=129741&&D<=129756||D>=129759&&D<=129770||D>=129775&&D<=129784||D>=131072&&D<=196605||D>=196608&&D<=262141}function CC(D){if(!Number.isSafeInteger(D))throw TypeError(`Expected a code point, got \`${typeof D}\`.`)}function sF(D,{ambiguousAsWide:u=!1}={}){if(CC(D),oF(D)||aF(D)||u&&iF(D))return 2;return 1}var eF=()=>{return/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g};var BC=new Intl.Segmenter,$C=/^\p{Default_Ignorable_Code_Point}$/u;function ZD(D,u={}){if(typeof D!=="string"||D.length===0)return 0;let{ambiguousIsNarrow:F=!0,countAnsiEscapeCodes:E=!1}=u;if(!E)D=uu(D);if(D.length===0)return 0;let C=0,B={ambiguousAsWide:!F};for(let{segment:$}of BC.segment(D)){let A=$.codePointAt(0);if(A<=31||A>=127&&A<=159)continue;if(A>=8203&&A<=8207||A===65279)continue;if(A>=768&&A<=879||A>=6832&&A<=6911||A>=7616&&A<=7679||A>=8400&&A<=8447||A>=65056&&A<=65071)continue;if(A>=55296&&A<=57343)continue;if(A>=65024&&A<=65039)continue;if($C.test($))continue;if(eF().test($)){C+=2;continue}C+=sF(A,B)}return C}var D2=(D=0)=>(u)=>`\x1B[${u+D}m`,u2=(D=0)=>(u)=>`\x1B[${38+D};5;${u}m`,F2=(D=0)=>(u,F,E)=>`\x1B[${38+D};2;${u};${F};${E}m`,f={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},F1=Object.keys(f.modifier),AC=Object.keys(f.color),HC=Object.keys(f.bgColor),E1=[...AC,...HC];function xC(){let D=new Map;for(let[u,F]of Object.entries(f)){for(let[E,C]of Object.entries(F))f[E]={open:`\x1B[${C[0]}m`,close:`\x1B[${C[1]}m`},F[E]=f[E],D.set(C[0],C[1]);Object.defineProperty(f,u,{value:F,enumerable:!1})}return Object.defineProperty(f,"codes",{value:D,enumerable:!1}),f.color.close="\x1B[39m",f.bgColor.close="\x1B[49m",f.color.ansi=D2(),f.color.ansi256=u2(),f.color.ansi16m=F2(),f.bgColor.ansi=D2(10),f.bgColor.ansi256=u2(10),f.bgColor.ansi16m=F2(10),Object.defineProperties(f,{rgbToAnsi256:{value(u,F,E){if(u===F&&F===E){if(u<8)return 16;if(u>248)return 231;return Math.round((u-8)/247*24)+232}return 16+36*Math.round(u/255*5)+6*Math.round(F/255*5)+Math.round(E/255*5)},enumerable:!1},hexToRgb:{value(u){let F=/[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));if(!F)return[0,0,0];let[E]=F;if(E.length===3)E=[...E].map((B)=>B+B).join("");let C=Number.parseInt(E,16);return[C>>16&255,C>>8&255,C&255]},enumerable:!1},hexToAnsi256:{value:(u)=>f.rgbToAnsi256(...f.hexToRgb(u)),enumerable:!1},ansi256ToAnsi:{value(u){if(u<8)return 30+u;if(u<16)return 90+(u-8);let F,E,C;if(u>=232)F=((u-232)*10+8)/255,E=F,C=F;else{u-=16;let A=u%36;F=Math.floor(u/36)/5,E=Math.floor(A/6)/5,C=A%6/5}let B=Math.max(F,E,C)*2;if(B===0)return 30;let $=30+(Math.round(C)<<2|Math.round(E)<<1|Math.round(F));if(B===2)$+=60;return $},enumerable:!1},rgbToAnsi:{value:(u,F,E)=>f.ansi256ToAnsi(f.rgbToAnsi256(u,F,E)),enumerable:!1},hexToAnsi:{value:(u)=>f.ansi256ToAnsi(f.hexToAnsi256(u)),enumerable:!1}}),f}var JC=xC(),E2=JC;var Xu=new Set(["\x1B","\x9B"]),NC=39,J0="\x07",$2="[",RC="]",A2="m",Tu=`${RC}8;;`,C2=(D)=>`${Xu.values().next().value}${$2}${D}${A2}`,B2=(D)=>`${Xu.values().next().value}${Tu}${D}${J0}`,_C=(D)=>D.split(" ").map((u)=>ZD(u)),x0=(D,u,F)=>{let E=[...u],C=!1,B=!1,$=ZD(uu(D.at(-1)));for(let[A,R]of E.entries()){let x=ZD(R);if($+x<=F)D[D.length-1]+=R;else D.push(R),$=0;if(Xu.has(R))C=!0,B=E.slice(A+1,A+1+Tu.length).join("")===Tu;if(C){if(B){if(R===J0)C=!1,B=!1}else if(R===A2)C=!1;continue}if($+=x,$===F&&A<E.length-1)D.push(""),$=0}if(!$&&D.at(-1).length>0&&D.length>1)D[D.length-2]+=D.pop()},TC=(D)=>{let u=D.split(" "),F=u.length;while(F>0){if(ZD(u[F-1])>0)break;F--}if(F===u.length)return D;return u.slice(0,F).join(" ")+u.slice(F).join("")},XC=(D,u,F={})=>{if(F.trim!==!1&&D.trim()==="")return"";let E="",C,B,$=_C(D),A=[""];for(let[J,T]of D.split(" ").entries()){if(F.trim!==!1)A[A.length-1]=A.at(-1).trimStart();let _=ZD(A.at(-1));if(J!==0){if(_>=u&&(F.wordWrap===!1||F.trim===!1))A.push(""),_=0;if(_>0||F.trim===!1)A[A.length-1]+=" ",_++}if(F.hard&&$[J]>u){let X=u-_,j=1+Math.floor(($[J]-X-1)/u);if(Math.floor(($[J]-1)/u)<j)A.push("");x0(A,T,u);continue}if(_+$[J]>u&&_>0&&$[J]>0){if(F.wordWrap===!1&&_<u){x0(A,T,u);continue}A.push("")}if(_+$[J]>u&&F.wordWrap===!1){x0(A,T,u);continue}A[A.length-1]+=T}if(F.trim!==!1)A=A.map((J)=>TC(J));let R=A.join(`
34
+ `),x=[...R],H=0;for(let[J,T]of x.entries()){if(E+=T,Xu.has(T)){let{groups:X}=new RegExp(`(?:\\${$2}(?<code>\\d+)m|\\${Tu}(?<uri>.*)${J0})`).exec(R.slice(H))||{groups:{}};if(X.code!==void 0){let j=Number.parseFloat(X.code);C=j===NC?void 0:j}else if(X.uri!==void 0)B=X.uri.length===0?void 0:X.uri}let _=E2.codes.get(Number(C));if(x[J+1]===`
35
+ `){if(B)E+=B2("");if(C&&_)E+=C2(_)}else if(T===`
36
+ `){if(C&&_)E+=C2(C);if(B)E+=B2(B)}H+=T.length}return E};function N0(D,u,F){return String(D).normalize().replaceAll(`\r
37
37
  `,`
38
38
  `).split(`
39
- `).map((E)=>H3(E,u,F)).join(`
40
- `)}function H0(D,u){return D.split(`
41
- `).flatMap((F)=>A0(F,u,{trim:!1,hard:!0}).split(`
39
+ `).map((E)=>XC(E,u,F)).join(`
40
+ `)}function R0(D,u){return D.split(`
41
+ `).flatMap((F)=>N0(F,u,{trim:!1,hard:!0}).split(`
42
42
  `).map((E)=>E.trimEnd())).join(`
43
- `)}function B2(){return C2.default({defaultWidth:80,output:C0().output})}var N2=dD(x2(),1);import*as f2 from"readline";import{AsyncResource as N3}from"async_hooks";var JD=[];JD.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")JD.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")JD.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var Ru=(D)=>!!D&&typeof D==="object"&&typeof D.removeListener==="function"&&typeof D.emit==="function"&&typeof D.reallyExit==="function"&&typeof D.listeners==="function"&&typeof D.kill==="function"&&typeof D.pid==="number"&&typeof D.on==="function",n0=Symbol.for("signal-exit emitter"),S0=globalThis,S3=Object.defineProperty.bind(Object);class A2{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(S0[n0])return S0[n0];S3(S0,n0,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(D,u){this.listeners[D].push(u)}removeListener(D,u){let F=this.listeners[D],E=F.indexOf(u);if(E===-1)return;if(E===0&&F.length===1)F.length=0;else F.splice(E,1)}emit(D,u,F){if(this.emitted[D])return!1;this.emitted[D]=!0;let E=!1;for(let C of this.listeners[D])E=C(u,F)===!0||E;if(D==="exit")E=this.emit("afterExit",u,F)||E;return E}}class R0{}var w3=(D)=>{return{onExit(u,F){return D.onExit(u,F)},load(){return D.load()},unload(){return D.unload()}}};class H2 extends R0{onExit(){return()=>{}}load(){}unload(){}}class n2 extends R0{#F=w0.platform==="win32"?"SIGINT":"SIGHUP";#u=new A2;#D;#B;#t;#C={};#E=!1;constructor(D){super();this.#D=D,this.#C={};for(let u of JD)this.#C[u]=()=>{let F=this.#D.listeners(u),{count:E}=this.#u,C=D;if(typeof C.__signal_exit_emitter__==="object"&&typeof C.__signal_exit_emitter__.count==="number")E+=C.__signal_exit_emitter__.count;if(F.length===E){this.unload();let B=this.#u.emit("exit",null,u),t=u==="SIGHUP"?this.#F:u;if(!B)D.kill(D.pid,t)}};this.#t=D.reallyExit,this.#B=D.emit}onExit(D,u){if(!Ru(this.#D))return()=>{};if(this.#E===!1)this.load();let F=u?.alwaysLast?"afterExit":"exit";return this.#u.on(F,D),()=>{if(this.#u.removeListener(F,D),this.#u.listeners.exit.length===0&&this.#u.listeners.afterExit.length===0)this.unload()}}load(){if(this.#E)return;this.#E=!0,this.#u.count+=1;for(let D of JD)try{let u=this.#C[D];if(u)this.#D.on(D,u)}catch(u){}this.#D.emit=(D,...u)=>{return this.#x(D,...u)},this.#D.reallyExit=(D)=>{return this.#$(D)}}unload(){if(!this.#E)return;this.#E=!1,JD.forEach((D)=>{let u=this.#C[D];if(!u)throw Error("Listener not defined for signal: "+D);try{this.#D.removeListener(D,u)}catch(F){}}),this.#D.emit=this.#B,this.#D.reallyExit=this.#t,this.#u.count-=1}#$(D){if(!Ru(this.#D))return 0;return this.#D.exitCode=D||0,this.#u.emit("exit",this.#D.exitCode,null),this.#t.call(this.#D,this.#D.exitCode)}#x(D,...u){let F=this.#B;if(D==="exit"&&Ru(this.#D)){if(typeof u[0]==="number")this.#D.exitCode=u[0];let E=F.call(this.#D,D,...u);return this.#u.emit("exit",this.#D.exitCode,null),E}else return F.call(this.#D,D,...u)}}var w0=globalThis.process,{onExit:S2,load:x1,unload:A1}=w3(Ru(w0)?new n2(w0):new H2);import{stripVTControlCharacters as h3}from"util";var R3="\x1B[G";var R2="\x1B[?25h",h0=(D=1)=>D>0?`\x1B[${D}A`:"",f0=(D=1)=>D>0?`\x1B[${D}B`:"",N0=(D,u)=>{if(typeof u==="number"&&!Number.isNaN(u))return`\x1B[${u+1};${D+1}H`;return`\x1B[${D+1}G`},w2="\x1B[2K",O0=(D)=>D>0?(w2+h0(1)).repeat(D-1)+w2+R3:"";var h2=(D)=>D.split(`
44
- `).length,f3=(D)=>D.split(`
45
- `).pop()??"";class hu{height=0;extraLinesUnderPrompt=0;cursorPos;rl;constructor(D){this.rl=D,this.cursorPos=D.getCursorPos()}write(D){this.rl.output.unmute(),this.rl.output.write(D),this.rl.output.mute()}render(D,u=""){let F=f3(D),E=h3(F),C=E;if(this.rl.line.length>0)C=C.slice(0,-this.rl.line.length);this.rl.setPrompt(C),this.cursorPos=this.rl.getCursorPos();let B=B2();if(D=H0(D,B),u=H0(u,B),E.length%B===0)D+=`
46
- `;let t=D+(u?`
47
- `+u:""),n=Math.floor(E.length/B)-this.cursorPos.rows+(u?h2(u):0);if(n>0)t+=h0(n);t+=N0(this.cursorPos.cols),this.write(f0(this.extraLinesUnderPrompt)+O0(this.height)+t),this.extraLinesUnderPrompt=n,this.height=h2(t)}checkCursorPos(){let D=this.rl.getCursorPos();if(D.cols!==this.cursorPos.cols)this.write(N0(D.cols)),this.cursorPos=D}done({clearContent:D}){this.rl.setPrompt("");let u=f0(this.extraLinesUnderPrompt);u+=D?O0(this.height):`
48
- `,u+=R2,this.write(u),this.rl.close()}}class _0 extends Promise{static withResolver(){let D,u;return{promise:new Promise((E,C)=>{D=E,u=C}),resolve:D,reject:u}}}function O3(){let D=Error.prepareStackTrace,u=[];try{Error.prepareStackTrace=(F,E)=>{let C=E.slice(1);return u=C,C},Error().stack}catch{return u}return Error.prepareStackTrace=D,u}function Du(D){let u=O3();return(E,C={})=>{let{input:B=process.stdin,signal:t}=C,$=new Set,n=new N2.default;n.pipe(C.output??process.stdout);let A=f2.createInterface({terminal:!0,input:B,output:n}),x=new hu(A),{promise:H,resolve:R,reject:w}=_0.withResolver(),h=()=>w(new u0);if(t){let I=()=>w(new D0({cause:t.reason}));if(t.aborted)return I(),Object.assign(H,{cancel:h});t.addEventListener("abort",I),$.add(()=>t.removeEventListener("abort",I))}$.add(S2((I,J)=>{w(new uD(`User force closed the prompt with ${I} ${J}`))}));let f=()=>w(new uD("User force closed the prompt with SIGINT"));A.on("SIGINT",f),$.add(()=>A.removeListener("SIGINT",f));let O=()=>x.checkCursorPos();return A.input.on("keypress",O),$.add(()=>A.input.removeListener("keypress",O)),KF(A,(I)=>{let J=N3.bind(()=>OD.clearAll());return A.on("close",J),$.add(()=>A.removeListener("close",J)),I(()=>{try{let T=D(E,(SD)=>{setImmediate(()=>R(SD))});if(T===void 0){let SD=u[1]?.getFileName();throw Error(`Prompt functions must return a string.
49
- at ${SD}`)}let[b,e]=typeof T==="string"?[T]:T;x.render(b,e),OD.run()}catch(T){w(T)}}),Object.assign(H.then((T)=>{return OD.clearAll(),T},(T)=>{throw OD.clearAll(),T}).finally(()=>{$.forEach((T)=>T()),x.done({clearContent:Boolean(C.clearPromptOnDone)}),n.end()}).then(()=>H),{cancel:h})})}}function O2(D,u){let F=u!==!1;if(/^(y|yes)/i.test(D))F=!0;else if(/^(n|no)/i.test(D))F=!1;return F}function _2(D){return D?"Yes":"No"}var tD=Du((D,u)=>{let{transformer:F=_2}=D,[E,C]=l("idle"),[B,t]=l(""),$=TD(D.theme),n=lD({status:E,theme:$});pD((R,w)=>{if(E!=="idle")return;if(aD(R)){let h=O2(B,D.default);t(F(h)),C("done"),u(h)}else if(sD(R)){let h=_2(!O2(B,D.default));w.clearLine(0),w.write(h),t(h)}else t(w.line)});let A=B,x="";if(E==="done")A=$.style.answer(B);else x=` ${$.style.defaultAnswer(D.default===!1?"y/N":"Y/n")}`;let H=$.style.message(D.message,E);return`${n} ${H}${x} ${A}`});var _3={validationFailureMode:"keep"},uu=Du((D,u)=>{let{prefill:F="tab"}=D,E=TD(_3,D.theme),[C,B]=l("idle"),[t="",$]=l(D.default),[n,A]=l(),[x,H]=l(""),R=lD({status:C,theme:E});async function w(J){let{required:T,pattern:b,patternError:e="Invalid input"}=D;if(T&&!J)return"You must provide a value";if(b&&!b.test(J))return e;if(typeof D.validate==="function")return await D.validate(J)||"You must provide a valid value";return!0}pD(async(J,T)=>{if(C!=="idle")return;if(aD(J)){let b=x||t;B("loading");let e=await w(b);if(e===!0)H(b),B("done"),u(b);else{if(E.validationFailureMode==="clear")H("");else T.write(x);A(e),B("idle")}}else if(eu(J)&&!x)$(void 0);else if(sD(J)&&!x)$(void 0),T.clearLine(0),T.write(t),H(t);else H(T.line),A(void 0)}),_D((J)=>{if(F==="editable"&&t)J.write(t),H(t)},[]);let h=E.style.message(D.message,C),f=x;if(typeof D.transformer==="function")f=D.transformer(x,{isFinal:C==="done"});else if(C==="done")f=E.style.answer(x);let O;if(t&&C!=="done"&&!x)O=E.style.defaultAnswer(t);let I="";if(n)I=E.style.error(n);return[[R,h,O,f].filter((J)=>J!==void 0).join(" "),I]});class k extends Error{code;constructor(D,u){super(u);this.code=D;this.name="HostError"}}var c2=dD(d2(),1),z="local",$8={stale:5000,retries:{retries:5,minTimeout:100,maxTimeout:1000,factor:2}};function zu(){return`${Bun.env.HOME||Bun.env.USERPROFILE||"~"}/.config/wt/config.json`}function g2(){let D=new Date().toISOString();return{name:z,ssh:"",root:"",connectTimeout:10,labels:{},createdAt:D,updatedAt:D,lastCheckedAt:D,lastStatus:"ok"}}function i2(){return{version:1,defaultHost:z,hosts:{[z]:g2()},sandboxes:{}}}async function a(){let D=zu(),u=Bun.file(D);if(!await u.exists())return i2();try{let F=await u.json();if(F.version!==1)throw Error(`Unsupported config version: ${F.version}`);if(!F.sandboxes)F.sandboxes={};if(!F.hosts[z])F.hosts[z]=g2();if(!F.defaultHost)F.defaultHost=z;return F}catch(F){if(F instanceof SyntaxError)throw Error(`Invalid config file at ${D}: ${F.message}`);throw F}}async function s2(D){let u=zu(),F=u.slice(0,u.lastIndexOf("/"));await Bun.$`mkdir -p ${F}`.quiet();let E=JSON.stringify(D,null,2);await Bun.write(u,E)}async function p(D){let u=zu(),F=u.slice(0,u.lastIndexOf("/"));if(await Bun.$`mkdir -p ${F}`.quiet(),!await Bun.file(u).exists())await Bun.write(u,JSON.stringify(i2(),null,2));let C=await c2.default.lock(u,$8);try{let B=await a(),t=await D(B);return await s2(B),t}finally{await C()}}async function g(D){return(await a()).hosts[D]}async function zD(){let D=await a();if(!D.defaultHost)return;return D.hosts[D.defaultHost]}async function W0(D){return p((u)=>{if(!u.hosts[D])return!1;if(delete u.hosts[D],u.defaultHost===D)u.defaultHost=null;return!0})}var x8=/^[a-z][a-z0-9_-]{0,31}$/;function a2(D){if(!D)throw new k("VALIDATION_ERROR","Host name is required");if(!x8.test(D))throw new k("VALIDATION_ERROR","Host name must match pattern: starts with a-z, followed by 0-31 chars of a-z, 0-9, _, or -")}function l2(D){if(!D||D.trim()==="")throw new k("VALIDATION_ERROR","SSH target is required")}function p2(D){if(!D)throw new k("VALIDATION_ERROR","Root path is required");if(!D.startsWith("/"))throw new k("VALIDATION_ERROR","Root path must be absolute (start with /)")}function e2(D){if(D===void 0)return;if(!Number.isInteger(D)||D<1||D>65535)throw new k("VALIDATION_ERROR","Port must be an integer between 1 and 65535")}function DE(D){if(D===void 0)return;if(!Number.isInteger(D)||D<1||D>300)throw new k("VALIDATION_ERROR","Connect timeout must be an integer between 1 and 300 seconds")}function y0(D){if(!D)return{};let u={},F=D.split(",");for(let E of F){let C=E.trim();if(!C)continue;let B=C.indexOf("=");if(B===-1)throw new k("VALIDATION_ERROR",`Invalid label format "${C}": expected key=value`);let t=C.slice(0,B).trim(),$=C.slice(B+1).trim();if(!t)throw new k("VALIDATION_ERROR",`Invalid label: empty key in "${C}"`);u[t]=$}return u}function P0(D){a2(D.name),l2(D.ssh),p2(D.root),e2(D.port),DE(D.connectTimeout)}function PD(D){let u=[];if(D.connectTimeout)u.push("-o",`ConnectTimeout=${D.connectTimeout}`);if(u.push("-o","BatchMode=yes"),u.push("-o","StrictHostKeyChecking=accept-new"),D.port)u.push("-p",String(D.port));if(D.identity)u.push("-i",D.identity);return u.push(D.ssh),u}function HD(D){return{ssh:D.ssh,port:D.port,identity:D.identity,connectTimeout:D.connectTimeout}}async function U(D,u){let F=PD(D);F.push(u);try{let E=await Bun.$`ssh ${F}`.quiet().nothrow();return{ok:E.exitCode===0,exitCode:E.exitCode,stdout:E.stdout.toString().trim(),stderr:E.stderr.toString().trim()}}catch(E){return{ok:!1,exitCode:-1,stdout:"",stderr:E instanceof Error?E.message:String(E)}}}async function Mu(D){return U(D,"echo ok")}async function uE(D){return U(D,"git --version")}async function FE(D){return U(D,"node --version")}async function EE(D,u){let F=["mirrors","sandboxes","meta"],C=[`mkdir -p ${F.map((B)=>`${u}/${B}`).join(" ")}`,...F.map((B)=>`test -w ${u}/${B}`)].join(" && ");return U(D,C)}function A8(D){let u=D.match(/git version (\d+\.\d+(?:\.\d+)?)/);return u?u[1]:null}function H8(D){let u=D.match(/v?(\d+\.\d+\.\d+)/);return u?u[1]:null}function n8(D){let[u,F]=D.split(".").map(Number);return u>2||u===2&&F>=5}async function CE(D){let F=(await a()).hosts[D];if(!F)throw new k("HOST_NOT_FOUND",`Host "${D}" not found`);return Zu(F)}async function Zu(D){let u=HD(D),F=[],E=[],C={ok:!1,host:D.name,checks:{ssh:{ok:!1},directories:{ok:!1},git:{ok:!1},node:{ok:!1}},errors:F,warnings:E},B=await Mu(u);if(B.ok)C.checks.ssh={ok:!0};else return C.checks.ssh={ok:!1,error:B.stderr||"Connection failed"},F.push(`SSH connection failed: ${B.stderr||"unknown error"}`),C;let t=await EE(u,D.root);if(t.ok)C.checks.directories={ok:!0};else C.checks.directories={ok:!1,error:t.stderr||"Failed to create directories"},F.push(`Directory check failed: ${t.stderr||"unknown error"}`);let $=await uE(u);if($.ok){let A=A8($.stdout);if(A)if(n8(A))C.checks.git={ok:!0,version:A};else C.checks.git={ok:!1,version:A,error:`Git ${A} does not support worktrees (need 2.5+)`},F.push(`Git ${A} does not support worktrees (need 2.5+)`);else C.checks.git={ok:!1,error:"Could not parse git version"},F.push("Could not parse git version")}else C.checks.git={ok:!1,error:"git not found"},F.push("git not found on remote");let n=await FE(u);if(n.ok){let A=H8(n.stdout);if(A)C.checks.node={ok:!0,version:A};else C.checks.node={ok:!0,warning:!0},E.push("Could not parse node version")}else C.checks.node={ok:!1,warning:!0,error:"not found"},E.push("node not found (optional)");return C.ok=C.checks.ssh.ok&&C.checks.directories.ok&&C.checks.git.ok,C}async function S8(D,u){await p((F)=>{let E=F.hosts[D];if(!E)throw new k("HOST_NOT_FOUND",`Host "${D}" not found`);E.lastCheckedAt=new Date().toISOString(),E.lastStatus=u.ok?"ok":"error",E.updatedAt=new Date().toISOString()})}async function V0(D){let u=await CE(D);return await S8(D,u),u}var w8=10;async function k0(D){P0({name:D.name,ssh:D.ssh,root:D.root,port:D.port,connectTimeout:D.connectTimeout});let{host:u,action:F}=await p((C)=>{let B=C.hosts[D.name],t=new Date().toISOString(),$={name:D.name,ssh:D.ssh,root:D.root,port:D.port,identity:D.identity,connectTimeout:D.connectTimeout??w8,labels:D.labels??{},createdAt:B?.createdAt??t,updatedAt:t,lastCheckedAt:B?.lastCheckedAt??null,lastStatus:B?.lastStatus??"unchecked"},n=B?"updated":"created";if(C.hosts[D.name]=$,D.setDefault)C.defaultHost=D.name;return{host:$,action:n}}),E;if(!D.skipCheck)E=await Zu(u),await p((C)=>{let B=C.hosts[D.name];if(B)B.lastCheckedAt=new Date().toISOString(),B.lastStatus=E.ok?"ok":"error",B.updatedAt=new Date().toISOString()}),u.lastCheckedAt=new Date().toISOString(),u.lastStatus=E.ok?"ok":"error";return{ok:!0,action:F,host:u,checkResult:E}}async function m0(){let D=await a(),u=Object.values(D.hosts).sort((F,E)=>F.name.localeCompare(E.name));return{defaultHost:D.defaultHost,hosts:u}}function R8(D){let u=[];if(D.checks.ssh.ok)u.push(` ${S.green("\u2713")} SSH connection`);else return u.push(` ${S.red("\u2717")} SSH connection: ${D.checks.ssh.error}`),u.join(`
50
- `);if(D.checks.directories.ok)u.push(` ${S.green("\u2713")} Directory structure`);else u.push(` ${S.red("\u2717")} Directory structure: ${D.checks.directories.error||"failed"}`);if(D.checks.git.ok)u.push(` ${S.green("\u2713")} git ${D.checks.git.version}`);else u.push(` ${S.red("\u2717")} git: ${D.checks.git.error||"not found"}`);if(D.checks.node.ok)u.push(` ${S.green("\u2713")} node ${D.checks.node.version}`);else u.push(` ${S.yellow("\u26A0")} node not found (optional)`);return u.join(`
51
- `)}async function h8(){console.log(S.cyan(`
43
+ `)}function x2(){return H2.default({defaultWidth:80,output:$0().output})}var I2=rD(R2(),1);import*as z2 from"readline";import{AsyncResource as UC}from"async_hooks";var YD=[];YD.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")YD.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")YD.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var Gu=(D)=>!!D&&typeof D==="object"&&typeof D.removeListener==="function"&&typeof D.emit==="function"&&typeof D.reallyExit==="function"&&typeof D.listeners==="function"&&typeof D.kill==="function"&&typeof D.pid==="number"&&typeof D.on==="function",_0=Symbol.for("signal-exit emitter"),T0=globalThis,jC=Object.defineProperty.bind(Object);class _2{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(T0[_0])return T0[_0];jC(T0,_0,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(D,u){this.listeners[D].push(u)}removeListener(D,u){let F=this.listeners[D],E=F.indexOf(u);if(E===-1)return;if(E===0&&F.length===1)F.length=0;else F.splice(E,1)}emit(D,u,F){if(this.emitted[D])return!1;this.emitted[D]=!0;let E=!1;for(let C of this.listeners[D])E=C(u,F)===!0||E;if(D==="exit")E=this.emit("afterExit",u,F)||E;return E}}class G0{}var OC=(D)=>{return{onExit(u,F){return D.onExit(u,F)},load(){return D.load()},unload(){return D.unload()}}};class T2 extends G0{onExit(){return()=>{}}load(){}unload(){}}class X2 extends G0{#F=X0.platform==="win32"?"SIGINT":"SIGHUP";#u=new _2;#D;#B;#$;#C={};#E=!1;constructor(D){super();this.#D=D,this.#C={};for(let u of YD)this.#C[u]=()=>{let F=this.#D.listeners(u),{count:E}=this.#u,C=D;if(typeof C.__signal_exit_emitter__==="object"&&typeof C.__signal_exit_emitter__.count==="number")E+=C.__signal_exit_emitter__.count;if(F.length===E){this.unload();let B=this.#u.emit("exit",null,u),$=u==="SIGHUP"?this.#F:u;if(!B)D.kill(D.pid,$)}};this.#$=D.reallyExit,this.#B=D.emit}onExit(D,u){if(!Gu(this.#D))return()=>{};if(this.#E===!1)this.load();let F=u?.alwaysLast?"afterExit":"exit";return this.#u.on(F,D),()=>{if(this.#u.removeListener(F,D),this.#u.listeners.exit.length===0&&this.#u.listeners.afterExit.length===0)this.unload()}}load(){if(this.#E)return;this.#E=!0,this.#u.count+=1;for(let D of YD)try{let u=this.#C[D];if(u)this.#D.on(D,u)}catch(u){}this.#D.emit=(D,...u)=>{return this.#H(D,...u)},this.#D.reallyExit=(D)=>{return this.#A(D)}}unload(){if(!this.#E)return;this.#E=!1,YD.forEach((D)=>{let u=this.#C[D];if(!u)throw Error("Listener not defined for signal: "+D);try{this.#D.removeListener(D,u)}catch(F){}}),this.#D.emit=this.#B,this.#D.reallyExit=this.#$,this.#u.count-=1}#A(D){if(!Gu(this.#D))return 0;return this.#D.exitCode=D||0,this.#u.emit("exit",this.#D.exitCode,null),this.#$.call(this.#D,this.#D.exitCode)}#H(D,...u){let F=this.#B;if(D==="exit"&&Gu(this.#D)){if(typeof u[0]==="number")this.#D.exitCode=u[0];let E=F.call(this.#D,D,...u);return this.#u.emit("exit",this.#D.exitCode,null),E}else return F.call(this.#D,D,...u)}}var X0=globalThis.process,{onExit:G2,load:X1,unload:G1}=OC(Gu(X0)?new X2(X0):new T2);import{stripVTControlCharacters as zC}from"util";var SC="\x1B[G";var O2="\x1B[?25h",j0=(D=1)=>D>0?`\x1B[${D}A`:"",O0=(D=1)=>D>0?`\x1B[${D}B`:"",S0=(D,u)=>{if(typeof u==="number"&&!Number.isNaN(u))return`\x1B[${u+1};${D+1}H`;return`\x1B[${D+1}G`},j2="\x1B[2K",z0=(D)=>D>0?(j2+j0(1)).repeat(D-1)+j2+SC:"";var S2=(D)=>D.split(`
44
+ `).length,IC=(D)=>D.split(`
45
+ `).pop()??"";class ju{height=0;extraLinesUnderPrompt=0;cursorPos;rl;constructor(D){this.rl=D,this.cursorPos=D.getCursorPos()}write(D){this.rl.output.unmute(),this.rl.output.write(D),this.rl.output.mute()}render(D,u=""){let F=IC(D),E=zC(F),C=E;if(this.rl.line.length>0)C=C.slice(0,-this.rl.line.length);this.rl.setPrompt(C),this.cursorPos=this.rl.getCursorPos();let B=x2();if(D=R0(D,B),u=R0(u,B),E.length%B===0)D+=`
46
+ `;let $=D+(u?`
47
+ `+u:""),R=Math.floor(E.length/B)-this.cursorPos.rows+(u?S2(u):0);if(R>0)$+=j0(R);$+=S0(this.cursorPos.cols),this.write(O0(this.extraLinesUnderPrompt)+z0(this.height)+$),this.extraLinesUnderPrompt=R,this.height=S2($)}checkCursorPos(){let D=this.rl.getCursorPos();if(D.cols!==this.cursorPos.cols)this.write(S0(D.cols)),this.cursorPos=D}done({clearContent:D}){this.rl.setPrompt("");let u=O0(this.extraLinesUnderPrompt);u+=D?z0(this.height):`
48
+ `,u+=O2,this.write(u),this.rl.close()}}class I0 extends Promise{static withResolver(){let D,u;return{promise:new Promise((E,C)=>{D=E,u=C}),resolve:D,reject:u}}}function ZC(){let D=Error.prepareStackTrace,u=[];try{Error.prepareStackTrace=(F,E)=>{let C=E.slice(1);return u=C,C},Error().stack}catch{return u}return Error.prepareStackTrace=D,u}function Fu(D){let u=ZC();return(E,C={})=>{let{input:B=process.stdin,signal:$}=C,A=new Set,R=new I2.default;R.pipe(C.output??process.stdout);let x=z2.createInterface({terminal:!0,input:B,output:R}),H=new ju(x),{promise:J,resolve:T,reject:_}=I0.withResolver(),X=()=>_(new E0);if($){let I=()=>_(new F0({cause:$.reason}));if($.aborted)return I(),Object.assign(J,{cancel:X});$.addEventListener("abort",I),A.add(()=>$.removeEventListener("abort",I))}A.add(G2((I,U)=>{_(new FD(`User force closed the prompt with ${I} ${U}`))}));let j=()=>_(new FD("User force closed the prompt with SIGINT"));x.on("SIGINT",j),A.add(()=>x.removeListener("SIGINT",j));let O=()=>H.checkCursorPos();return x.input.on("keypress",O),A.add(()=>x.input.removeListener("keypress",O)),bF(x,(I)=>{let U=UC.bind(()=>zD.clearAll());return x.on("close",U),A.add(()=>x.removeListener("close",U)),I(()=>{try{let z=D(E,(_D)=>{setImmediate(()=>T(_D))});if(z===void 0){let _D=u[1]?.getFileName();throw Error(`Prompt functions must return a string.
49
+ at ${_D}`)}let[d,DD]=typeof z==="string"?[z]:z;H.render(d,DD),zD.run()}catch(z){_(z)}}),Object.assign(J.then((z)=>{return zD.clearAll(),z},(z)=>{throw zD.clearAll(),z}).finally(()=>{A.forEach((z)=>z()),H.done({clearContent:Boolean(C.clearPromptOnDone)}),R.end()}).then(()=>J),{cancel:X})})}}function U2(D,u){let F=u!==!1;if(/^(y|yes)/i.test(D))F=!0;else if(/^(n|no)/i.test(D))F=!1;return F}function Z2(D){return D?"Yes":"No"}var AD=Fu((D,u)=>{let{transformer:F=Z2}=D,[E,C]=s("idle"),[B,$]=s(""),A=UD(D.theme),R=eD({status:E,theme:A});Du((T,_)=>{if(E!=="idle")return;if(sD(T)){let X=U2(B,D.default);$(F(X)),C("done"),u(X)}else if(aD(T)){let X=Z2(!U2(B,D.default));_.clearLine(0),_.write(X),$(X)}else $(_.line)});let x=B,H="";if(E==="done")x=A.style.answer(B);else H=` ${A.style.defaultAnswer(D.default===!1?"y/N":"Y/n")}`;let J=A.style.message(D.message,E);return`${R} ${J}${H} ${x}`});var YC={validationFailureMode:"keep"},Eu=Fu((D,u)=>{let{prefill:F="tab"}=D,E=UD(YC,D.theme),[C,B]=s("idle"),[$="",A]=s(D.default),[R,x]=s(),[H,J]=s(""),T=eD({status:C,theme:E});async function _(U){let{required:z,pattern:d,patternError:DD="Invalid input"}=D;if(z&&!U)return"You must provide a value";if(d&&!d.test(U))return DD;if(typeof D.validate==="function")return await D.validate(U)||"You must provide a valid value";return!0}Du(async(U,z)=>{if(C!=="idle")return;if(sD(U)){let d=H||$;B("loading");let DD=await _(d);if(DD===!0)J(d),B("done"),u(d);else{if(E.validationFailureMode==="clear")J("");else z.write(H);x(DD),B("idle")}}else if(u0(U)&&!H)A(void 0);else if(aD(U)&&!H)A(void 0),z.clearLine(0),z.write($),J($);else J(z.line),x(void 0)}),ID((U)=>{if(F==="editable"&&$)U.write($),J($)},[]);let X=E.style.message(D.message,C),j=H;if(typeof D.transformer==="function")j=D.transformer(H,{isFinal:C==="done"});else if(C==="done")j=E.style.answer(H);let O;if($&&C!=="done"&&!H)O=E.style.defaultAnswer($);let I="";if(R)I=E.style.error(R);return[[T,X,O,j].filter((U)=>U!==void 0).join(" "),I]});class m extends Error{code;constructor(D,u){super(u);this.code=D;this.name="HostError"}}var o2=rD(i2(),1),W="local",R8={stale:5000,retries:{retries:5,minTimeout:100,maxTimeout:1000,factor:2}};function Wu(){return`${Bun.env.HOME||Bun.env.USERPROFILE||"~"}/.config/wt/config.json`}function a2(){let D=new Date().toISOString();return{name:W,ssh:"",root:"",connectTimeout:10,labels:{},createdAt:D,updatedAt:D,lastCheckedAt:D,lastStatus:"ok"}}function s2(){return{version:1,defaultHost:W,hosts:{[W]:a2()},sandboxes:{}}}async function a(){let D=Wu(),u=Bun.file(D);if(!await u.exists())return s2();try{let F=await u.json();if(F.version!==1)throw Error(`Unsupported config version: ${F.version}`);if(!F.sandboxes)F.sandboxes={};if(!F.hosts[W])F.hosts[W]=a2();if(!F.defaultHost)F.defaultHost=W;return F}catch(F){if(F instanceof SyntaxError)throw Error(`Invalid config file at ${D}: ${F.message}`);throw F}}async function e2(D){let u=Wu(),F=u.slice(0,u.lastIndexOf("/"));await Bun.$`mkdir -p ${F} && chmod 700 ${F}`.quiet();let E=JSON.stringify(D,null,2);await Bun.write(u,E),await Bun.$`chmod 600 ${u}`.quiet()}async function e(D){let u=Wu(),F=u.slice(0,u.lastIndexOf("/"));if(await Bun.$`mkdir -p ${F} && chmod 700 ${F}`.quiet(),!await Bun.file(u).exists())await Bun.write(u,JSON.stringify(s2(),null,2)),await Bun.$`chmod 600 ${u}`.quiet();let C=await o2.default.lock(u,R8);try{let B=await a(),$=await D(B);return await e2(B),$}finally{await C()}}async function p(D){return(await a()).hosts[D]}async function WD(){let D=await a();if(!D.defaultHost)return;return D.hosts[D.defaultHost]}async function h0(D){return e((u)=>{if(!u.hosts[D])return!1;if(delete u.hosts[D],u.defaultHost===D)u.defaultHost=null;return!0})}class G extends Error{code;constructor(D,u){super(u);this.code=D;this.name="SandboxError"}}var _8=/^[a-z][a-z0-9_-]{0,31}$/,T8=/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,63}$/,b0=/[;`|&$(){}*?<>!\\"\n\r]/;function D3(D){if(!D)throw new m("VALIDATION_ERROR","Host name is required");if(!_8.test(D))throw new m("VALIDATION_ERROR","Host name must match pattern: starts with a-z, followed by 0-31 chars of a-z, 0-9, _, or -")}function wu(D){if(!D)throw new G("VALIDATION_ERROR","Sandbox name is required");if(!T8.test(D))throw new G("VALIDATION_ERROR","Sandbox name must start with an alphanumeric character, contain only alphanumeric characters, dots, underscores, or hyphens, and be at most 64 characters");if(D==="."||D==="..")throw new G("VALIDATION_ERROR",'Sandbox name cannot be "." or ".."')}function v0(D){if(!D)return;if(b0.test(D))throw new G("VALIDATION_ERROR",`Git ref contains invalid characters: ${D}`)}function u3(D){if(!D||D.trim()==="")throw new m("VALIDATION_ERROR","SSH target is required");if(b0.test(D))throw new m("VALIDATION_ERROR","SSH target contains invalid characters (shell metacharacters are not allowed)")}function F3(D){if(!D)throw new m("VALIDATION_ERROR","Root path is required");if(!D.startsWith("/")&&!D.startsWith("~/"))throw new m("VALIDATION_ERROR","Root path must be absolute (start with / or ~/)");if(b0.test(D))throw new m("VALIDATION_ERROR","Root path contains invalid characters (shell metacharacters are not allowed)")}function E3(D){if(D===void 0)return;if(!Number.isInteger(D)||D<1||D>65535)throw new m("VALIDATION_ERROR","Port must be an integer between 1 and 65535")}function C3(D){if(D===void 0)return;if(!Number.isInteger(D)||D<1||D>300)throw new m("VALIDATION_ERROR","Connect timeout must be an integer between 1 and 300 seconds")}function m0(D){if(!D)return{};let u={},F=D.split(",");for(let E of F){let C=E.trim();if(!C)continue;let B=C.indexOf("=");if(B===-1)throw new m("VALIDATION_ERROR",`Invalid label format "${C}": expected key=value`);let $=C.slice(0,B).trim(),A=C.slice(B+1).trim();if(!$)throw new m("VALIDATION_ERROR",`Invalid label: empty key in "${C}"`);u[$]=A}return u}function g0(D){D3(D.name),u3(D.ssh),F3(D.root),E3(D.port),C3(D.connectTimeout)}function M(D){if(D.startsWith("~/"))return`~/'${D.slice(2).replace(/'/g,"'\\''")}'`;return`'${D.replace(/'/g,"'\\''")}'`}function bD(D){let u=[];if(D.connectTimeout)u.push("-o",`ConnectTimeout=${D.connectTimeout}`);if(u.push("-o","BatchMode=yes"),u.push("-o","StrictHostKeyChecking=accept-new"),D.port)u.push("-p",String(D.port));if(D.identity)u.push("-i",D.identity);return u.push(D.ssh),u}function ND(D){return{ssh:D.ssh,port:D.port,identity:D.identity,connectTimeout:D.connectTimeout}}async function Q(D,u){let F=bD(D);F.push(u);try{let E=await Bun.$`ssh ${F}`.quiet().nothrow();return{ok:E.exitCode===0,exitCode:E.exitCode,stdout:E.stdout.toString().trim(),stderr:E.stderr.toString().trim()}}catch(E){return{ok:!1,exitCode:-1,stdout:"",stderr:E instanceof Error?E.message:String(E)}}}async function Vu(D){return Q(D,"echo ok")}async function B3(D){return Q(D,"git --version")}async function $3(D){return Q(D,"node --version")}async function A3(D,u){let F=["mirrors","sandboxes","meta"],C=[`mkdir -p ${F.map((B)=>M(`${u}/${B}`)).join(" ")}`,...F.map((B)=>`test -w ${M(`${u}/${B}`)}`)].join(" && ");return Q(D,C)}function X8(D){let u=D.match(/git version (\d+\.\d+(?:\.\d+)?)/);return u?u[1]:null}function G8(D){let u=D.match(/v?(\d+\.\d+\.\d+)/);return u?u[1]:null}function j8(D){let[u,F]=D.split(".").map(Number);return u>2||u===2&&F>=5}async function H3(D){let F=(await a()).hosts[D];if(!F)throw new m("HOST_NOT_FOUND",`Host "${D}" not found`);return fu(F)}async function fu(D){let u=ND(D),F=[],E=[],C={ok:!1,host:D.name,checks:{ssh:{ok:!1},directories:{ok:!1},git:{ok:!1},node:{ok:!1}},errors:F,warnings:E},B=await Vu(u);if(B.ok)C.checks.ssh={ok:!0};else return C.checks.ssh={ok:!1,error:B.stderr||"Connection failed"},F.push(`SSH connection failed: ${B.stderr||"unknown error"}`),C;let $=await A3(u,D.root);if($.ok)C.checks.directories={ok:!0};else C.checks.directories={ok:!1,error:$.stderr||"Failed to create directories"},F.push(`Directory check failed: ${$.stderr||"unknown error"}`);let A=await B3(u);if(A.ok){let x=X8(A.stdout);if(x)if(j8(x))C.checks.git={ok:!0,version:x};else C.checks.git={ok:!1,version:x,error:`Git ${x} does not support worktrees (need 2.5+)`},F.push(`Git ${x} does not support worktrees (need 2.5+)`);else C.checks.git={ok:!1,error:"Could not parse git version"},F.push("Could not parse git version")}else C.checks.git={ok:!1,error:"git not found"},F.push("git not found on remote");let R=await $3(u);if(R.ok){let x=G8(R.stdout);if(x)C.checks.node={ok:!0,version:x};else C.checks.node={ok:!0,warning:!0},E.push("Could not parse node version")}else C.checks.node={ok:!1,warning:!0,error:"not found"},E.push("node not found (optional)");return C.ok=C.checks.ssh.ok&&C.checks.directories.ok&&C.checks.git.ok,C}async function O8(D,u){await e((F)=>{let E=F.hosts[D];if(!E)throw new m("HOST_NOT_FOUND",`Host "${D}" not found`);E.lastCheckedAt=new Date().toISOString(),E.lastStatus=u.ok?"ok":"error",E.updatedAt=new Date().toISOString()})}async function n0(D){let u=await H3(D);return await O8(D,u),u}var S8=10;async function d0(D){g0({name:D.name,ssh:D.ssh,root:D.root,port:D.port,connectTimeout:D.connectTimeout});let{host:u,action:F}=await e((C)=>{let B=C.hosts[D.name],$=new Date().toISOString(),A={name:D.name,ssh:D.ssh,root:D.root,port:D.port,identity:D.identity,connectTimeout:D.connectTimeout??S8,labels:D.labels??{},createdAt:B?.createdAt??$,updatedAt:$,lastCheckedAt:B?.lastCheckedAt??null,lastStatus:B?.lastStatus??"unchecked"},R=B?"updated":"created";if(C.hosts[D.name]=A,D.setDefault)C.defaultHost=D.name;return{host:A,action:R}}),E;if(!D.skipCheck)E=await fu(u),await e((C)=>{let B=C.hosts[D.name];if(B)B.lastCheckedAt=new Date().toISOString(),B.lastStatus=E.ok?"ok":"error",B.updatedAt=new Date().toISOString()}),u.lastCheckedAt=new Date().toISOString(),u.lastStatus=E.ok?"ok":"error";return{ok:!0,action:F,host:u,checkResult:E}}async function c0(){let D=await a(),u=Object.values(D.hosts).sort((F,E)=>F.name.localeCompare(E.name));return{defaultHost:D.defaultHost,hosts:u}}function z8(D){let u=[];if(D.checks.ssh.ok)u.push(` ${N.green("\u2713")} SSH connection`);else return u.push(` ${N.red("\u2717")} SSH connection: ${D.checks.ssh.error}`),u.join(`
50
+ `);if(D.checks.directories.ok)u.push(` ${N.green("\u2713")} Directory structure`);else u.push(` ${N.red("\u2717")} Directory structure: ${D.checks.directories.error||"failed"}`);if(D.checks.git.ok)u.push(` ${N.green("\u2713")} git ${D.checks.git.version}`);else u.push(` ${N.red("\u2717")} git: ${D.checks.git.error||"not found"}`);if(D.checks.node.ok)u.push(` ${N.green("\u2713")} node ${D.checks.node.version}`);else u.push(` ${N.yellow("\u26A0")} node not found (optional)`);return u.join(`
51
+ `)}async function I8(){console.log(N.cyan(`
52
52
  Add a new host
53
- `));let D=await uu({message:"Host name:",validate:(B)=>{if(!B)return"Host name is required";if(!/^[a-z][a-z0-9_-]{0,31}$/.test(B))return"Must start with a-z, followed by a-z, 0-9, _, or - (max 32 chars)";return!0}}),u=await uu({message:"SSH target (alias or user@host):",validate:(B)=>B?!0:"SSH target is required"}),F=await uu({message:"Remote base directory:",default:"/srv/wt",validate:(B)=>{if(!B)return"Root path is required";if(!B.startsWith("/"))return"Must be an absolute path (start with /)";return!0}}),E=await tD({message:"Set as default host?",default:!0}),C=await tD({message:"Run connectivity check?",default:!0});return{name:D,ssh:u,root:F,setDefault:E,skipCheck:!C,runCheck:C}}function BE(D){D.command("add").description("Register or update a remote host").argument("[name]","Host identifier (a-z, 0-9, _, - ; max 32 chars)").option("-s, --ssh <target>","SSH target (alias, user@host, or ssh://user@host:port)").option("-r, --root <path>","Remote base directory (absolute path)").option("-d, --default","Set as default host").option("-p, --port <number>","SSH port (overrides target/config)").option("-i, --identity <path>","Path to SSH identity file").option("-t, --connect-timeout <seconds>","Connection timeout in seconds","10").option("--no-check","Skip connectivity check after adding").option("-l, --labels <k=v,...>","Comma-separated key=value labels").option("--json","Output result as JSON").action(async(u,F)=>{try{let E,C=!u||!F.ssh||!F.root;if(C&&F.json)console.log(JSON.stringify({ok:!1,error:"Missing required arguments (name, --ssh, --root) and --json prevents interactive mode"},null,2)),process.exit(1);if(C)E=await h8();else E={name:u,ssh:F.ssh,root:F.root,setDefault:F.default,port:F.port?parseInt(F.port,10):void 0,identity:F.identity,connectTimeout:F.connectTimeout?parseInt(F.connectTimeout,10):void 0,skipCheck:F.check===!1,labels:y0(F.labels)};if(!E.skipCheck&&!F.json)console.log(`
54
- Checking ${E.name} (${E.ssh}:${E.root})...`);let B=await k0(E);if(F.json)console.log(JSON.stringify(B,null,2));else{if(B.checkResult)console.log(R8(B.checkResult)),console.log();let t=E.setDefault?S.dim(" (default)"):"",$=B.action==="created"?"Added":"Updated";if(B.checkResult?.ok===!1)console.log(S.yellow(`${$} host "${B.host.name}"${t}, but check failed.`));else console.log(S.green(`${$} host "${B.host.name}"${t}`))}if(B.checkResult&&!B.checkResult.ok)process.exit(2)}catch(E){if(E instanceof uD)console.log(S.dim(`
55
- Cancelled.`)),process.exit(130);if(E instanceof k){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(S.red(`Error: ${E.message}`));process.exit(E.code==="VALIDATION_ERROR"?1:1)}throw E}})}function f8(D){switch(D){case"ok":return S.green("ok");case"error":return S.red("error");default:return S.dim("unchecked")}}function fD(D,u){return D.padEnd(u)}function tE(D){D.command("ls").description("List all configured hosts").option("--json","Output as JSON").action(async(u)=>{let F=await m0();if(u.json){console.log(JSON.stringify(F,null,2));return}if(F.hosts.length===0){console.log(S.dim("No hosts configured. Run `wt host add` to add one."));return}let E=Math.max(4,...F.hosts.map((t)=>t.name.length))+2,C=Math.max(3,...F.hosts.map((t)=>t.ssh.length))+2,B=Math.max(4,...F.hosts.map((t)=>t.root.length))+2;console.log(S.bold(fD("NAME",E)+fD("SSH",C)+fD("ROOT",B)+fD("DEFAULT",9)+"STATUS"));for(let t of F.hosts){let n=t.name===F.defaultHost?S.cyan("*"):S.dim("-");console.log(fD(t.name,E)+fD(t.ssh,C)+fD(t.root,B)+fD(n,9)+f8(t.lastStatus))}})}function N8(D,u,F){let E=[];if(E.push(`Checking ${D.host} (${u}:${F})...`),D.checks.ssh.ok)E.push(` ${S.green("\u2713")} SSH connection`);else E.push(` ${S.red("\u2717")} SSH connection: ${D.checks.ssh.error}`);if(D.checks.ssh.ok){if(D.checks.directories.ok)E.push(` ${S.green("\u2713")} Directory structure`);else E.push(` ${S.red("\u2717")} Directory structure: ${D.checks.directories.error||"failed"}`);if(D.checks.git.ok)E.push(` ${S.green("\u2713")} git ${D.checks.git.version}`);else E.push(` ${S.red("\u2717")} git: ${D.checks.git.error||"not found"}`);if(D.checks.node.ok)E.push(` ${S.green("\u2713")} node ${D.checks.node.version}`);else E.push(` ${S.yellow("\u26A0")} node not found (optional)`)}return E.join(`
56
- `)}function $E(D){D.command("check").description("Test connectivity and capabilities of a host").argument("<name>","Host to check").option("--json","Output result as JSON").action(async(u,F)=>{try{let E=await g(u);if(!E){if(F.json)console.log(JSON.stringify({ok:!1,error:`Host "${u}" not found`},null,2));else console.error(S.red(`Error: Host "${u}" not found`));process.exit(1)}let C=await V0(u);if(F.json)console.log(JSON.stringify(C,null,2));else if(console.log(N8(C,E.ssh,E.root)),console.log(),C.ok)console.log(S.green(`Host "${u}" is ready.`));else console.log(S.red(`Host "${u}" check failed.`));if(!C.ok){if(!C.checks.ssh.ok)process.exit(2);process.exit(3)}}catch(E){if(E instanceof k){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(S.red(`Error: ${E.message}`));process.exit(E.code==="HOST_NOT_FOUND"?1:1)}throw E}})}function xE(D){D.command("rm").description("Remove a host configuration").argument("<name>","Host to remove").option("-y, --yes","Skip confirmation prompt").option("--json","Output result as JSON").action(async(u,F)=>{let E=await g(u);if(!E){if(F.json)console.log(JSON.stringify({ok:!1,error:`Host "${u}" not found`},null,2));else console.error(S.red(`Error: Host "${u}" not found`));process.exit(1)}try{if(!F.yes&&!F.json){if(!await tD({message:`Remove host "${u}" (${E.ssh})?`,default:!1})){console.log(S.dim("Cancelled."));return}}}catch(B){if(B instanceof uD)console.log(S.dim(`
57
- Cancelled.`)),process.exit(130);throw B}let C=await W0(u);if(F.json)console.log(JSON.stringify({ok:C,removed:u},null,2));else console.log(S.green(`Removed host "${u}"`))})}function r0(D){let u=D.command("host").description("Manage remote compute hosts");BE(u),tE(u),$E(u),xE(u)}class N extends Error{code;constructor(D,u){super(u);this.code=D;this.name="SandboxError"}}async function AE(){try{let D=await Bun.$`git remote get-url origin`.quiet().nothrow();if(D.exitCode!==0)throw new N("GIT_ERROR","No git remote 'origin' found");return D.stdout.toString().trim()}catch(D){if(D instanceof N)throw D;throw new N("NOT_IN_GIT_REPO","Not inside a git repository")}}async function HE(){let D=await Bun.$`git rev-parse HEAD`.quiet().nothrow();if(D.exitCode!==0)throw new N("GIT_ERROR","Failed to resolve HEAD");return D.stdout.toString().trim()}async function Lu(){let D=await Bun.$`git rev-parse --show-toplevel`.quiet().nothrow();if(D.exitCode!==0)throw new N("NOT_IN_GIT_REPO","Not inside a git repository");return D.stdout.toString().trim()}async function Yu(){return(await Bun.$`git rev-parse --is-inside-work-tree`.quiet().nothrow()).exitCode===0}async function Qu(){let D=await Bun.$`git rev-parse --abbrev-ref HEAD`.quiet().nothrow();if(D.exitCode!==0)return null;let u=D.stdout.toString().trim();return u==="HEAD"?null:u}function Ku(D){return(D.includes("/")?D.split("/").pop():D).replace(/[^a-zA-Z0-9._-]/g,"-").replace(/^-+|-+$/g,"")}import{webcrypto as SE}from"crypto";var nE="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var O8=128,MD,VD;function _8(D){if(!MD||MD.length<D)MD=Buffer.allocUnsafe(D*O8),SE.getRandomValues(MD),VD=0;else if(VD+D>MD.length)SE.getRandomValues(MD),VD=0;VD+=D}function wE(D=21){_8(D|=0);let u="";for(let F=VD-D;F<VD;F++)u+=nE[MD[F]&63];return u}function RE(){return wE(12)}async function hE(D){let u=D.replace(/\.git$/,"").toLowerCase().trim(),F=new TextEncoder().encode(u);return new Bun.CryptoHasher("sha256").update(F).digest("hex").slice(0,16)}class Wu{async ensureLayout(D){await Bun.$`mkdir -p ${D}/mirrors ${D}/sandboxes ${D}/meta`.quiet()}async ensureMirror(D,u,F){let E=`${D}/mirrors/${u}.git`;if(!await Bun.file(`${E}/HEAD`).exists()){let t=await Bun.$`git clone --bare --mirror ${F} ${E}`.quiet().nothrow();if(t.exitCode!==0)throw Error(`Failed to create mirror: ${t.stderr.toString().trim()}`)}else await Bun.$`git -C ${E} fetch --prune origin`.quiet().nothrow();let B=await Lu();return await Bun.$`git -C ${E} fetch ${B} '+refs/heads/*:refs/heads/*'`.quiet().nothrow(),E}async createWorktree(D,u,F,E){let C=E?await Bun.$`git -C ${D} worktree add -B ${E} ${u}`.quiet().nothrow():await Bun.$`git -C ${D} worktree add --detach ${u} ${F}`.quiet().nothrow();if(C.exitCode!==0)throw Error(`Failed to create worktree: ${C.stderr.toString().trim()}`)}async writeMeta(D,u,F){let E=`${D}/meta/${u}.json`;await Bun.write(E,JSON.stringify(F,null,2))}async removeSandboxDir(D){await Bun.$`rm -rf ${D}`.quiet().nothrow()}async pruneWorktrees(D){await Bun.$`git -C ${D} worktree prune`.quiet().nothrow()}async removeMeta(D,u){let F=`${D}/meta/${u}.json`;await Bun.$`rm -f ${F}`.quiet().nothrow()}async dirExists(D){return Bun.file(`${D}/.git`).exists()}async exec(D,u){let[F,...E]=u,C=await Bun.$`${F} ${E}`.cwd(D).quiet().nothrow();return{exitCode:C.exitCode,stdout:C.stdout.toString().trim(),stderr:C.stderr.toString().trim()}}async execStream(D,u){return Bun.spawn(u,{cwd:D,stdin:"inherit",stdout:"inherit",stderr:"inherit"}).exited}async execInteractive(D,u){let F=Bun.env.SHELL||"/bin/sh",C=await Bun.spawn([F,"-l"],{cwd:D,stdin:"inherit",stdout:"inherit",stderr:"inherit",env:{...process.env,...u}}).exited;process.exit(C)}async execTmux(D,u){let E=await Bun.spawn(["tmux","new-session","-A","-s",u,"-c",D],{stdin:"inherit",stdout:"inherit",stderr:"inherit"}).exited;process.exit(E)}async listTmuxSessions(){let D=await Bun.$`tmux ls -F '#{session_name}\t#{session_attached}'`.quiet().nothrow();if(D.exitCode!==0)return[];return D.stdout.toString().trim().split(`
58
- `).filter(Boolean).map((F)=>{let[E,C]=F.split("\t");return{name:E,attached:C==="1"}}).filter((F)=>F.name.startsWith("wt-"))}async copyEnvFiles(D,u){let F=new Bun.Glob(".env*");for await(let E of F.scan({cwd:D,onlyFiles:!0,dot:!0})){let C=Bun.file(`${D}/${E}`);await Bun.write(`${u}/${E}`,C)}}async checkGit(){let D=await Bun.$`git --version`.quiet().nothrow();if(D.exitCode!==0)return{name:"git",ok:!1,detail:"not found"};return{name:"git",ok:!0,detail:D.stdout.toString().trim()}}async checkTmux(){let D=await Bun.$`tmux -V`.quiet().nothrow();if(D.exitCode!==0)return{name:"tmux",ok:!1,detail:"not found"};return{name:"tmux",ok:!0,detail:D.stdout.toString().trim()}}async checkRuntime(){let D=await Bun.$`bun --version`.quiet().nothrow();if(D.exitCode===0)return{name:"bun",ok:!0,detail:D.stdout.toString().trim()};let u=await Bun.$`node --version`.quiet().nothrow();if(u.exitCode===0)return{name:"node",ok:!0,detail:u.stdout.toString().trim()};return{name:"runtime",ok:!1,detail:"neither bun nor node found"}}}function b0(D){let u=[];for(let F=0;F<D.length;F++){if(D[F]==="-o"&&D[F+1]?.startsWith("BatchMode")){F++;continue}u.push(D[F])}return u}class yu{host;constructor(D){this.host=D}get sshOpts(){return HD(this.host)}async ensureLayout(D){let u=["mirrors","sandboxes","meta"].map((E)=>`${D}/${E}`).join(" "),F=await U(this.sshOpts,`mkdir -p ${u}`);if(!F.ok)throw Error(`Failed to create remote layout: ${F.stderr}`)}async ensureMirror(D,u,F){let E=`${D}/mirrors/${u}.git`;if(!(await U(this.sshOpts,`test -f ${E}/HEAD`)).ok){let B=await U(this.sshOpts,`git clone --bare --mirror ${F} ${E}`);if(!B.ok)throw Error(`Failed to create remote mirror: ${B.stderr}`)}else await U(this.sshOpts,`git -C ${E} fetch --prune origin`);return E}async createWorktree(D,u,F,E){let C=E?`git -C ${D} worktree add -B ${E} ${u}`:`git -C ${D} worktree add --detach ${u} ${F}`,B=await U(this.sshOpts,C);if(!B.ok)throw Error(`Failed to create remote worktree: ${B.stderr}`)}async writeMeta(D,u,F){let E=`${D}/meta/${u}.json`,B=JSON.stringify(F,null,2).replace(/'/g,"'\\''"),t=await U(this.sshOpts,`printf '%s' '${B}' > ${E}`);if(!t.ok)throw Error(`Failed to write remote meta: ${t.stderr}`)}async removeSandboxDir(D){await U(this.sshOpts,`rm -rf ${D}`)}async pruneWorktrees(D){await U(this.sshOpts,`git -C ${D} worktree prune`)}async removeMeta(D,u){await U(this.sshOpts,`rm -f ${D}/meta/${u}.json`)}async dirExists(D){return(await U(this.sshOpts,`test -d ${D}`)).ok}async exec(D,u){let F=u.map((C)=>`'${C.replace(/'/g,"'\\''")}'`).join(" "),E=await U(this.sshOpts,`cd ${D} && ${F}`);return{exitCode:E.exitCode,stdout:E.stdout,stderr:E.stderr}}async execStream(D,u){let F=u.map((t)=>`'${t.replace(/'/g,"'\\''")}'`).join(" "),E=b0(PD(this.sshOpts)),C=`cd ${D} && ${F}`;return Bun.spawn(["ssh","-t",...E,C],{stdin:"inherit",stdout:"inherit",stderr:"inherit"}).exited}async execInteractive(D,u){let F=b0(PD(this.sshOpts)),E=`cd ${D} && exec $SHELL -l`,B=await Bun.spawn(["ssh","-t",...F,E],{stdin:"inherit",stdout:"inherit",stderr:"inherit",env:process.env}).exited;process.exit(B)}async execTmux(D,u){let F=b0(PD(this.sshOpts)),E=`cd ${D} && tmux new-session -A -s ${u}`,B=await Bun.spawn(["ssh","-t",...F,E],{stdin:"inherit",stdout:"inherit",stderr:"inherit",env:process.env}).exited;process.exit(B)}async listTmuxSessions(){let D=await U(this.sshOpts,"tmux ls -F '#{session_name}\t#{session_attached}'");if(!D.ok)return[];return D.stdout.trim().split(`
59
- `).filter(Boolean).map((F)=>{let[E,C]=F.split("\t");return{name:E,attached:C==="1"}}).filter((F)=>F.name.startsWith("wt-"))}async copyEnvFiles(D,u){let F=new Bun.Glob(".env*"),E=[];for await(let n of F.scan({cwd:D,onlyFiles:!0,dot:!0}))E.push(n);if(E.length===0)return;let C=PD(this.sshOpts),B=C.pop(),t=C.filter((n)=>n!=="-o"||!0),$=[];for(let n=0;n<C.length;n++)if(C[n]==="-p")$.push("-P",C[n+1]),n++;else if(C[n]==="-i")$.push("-i",C[n+1]),n++;else if(C[n]==="-o")$.push("-o",C[n+1]),n++;for(let n of E){let A=`${D}/${n}`,x=`${B}:${u}/${n}`;await Bun.$`scp ${$} ${A} ${x}`.quiet().nothrow()}}async checkGit(){let D=await U(this.sshOpts,"git --version");if(!D.ok)return{name:"git",ok:!1,detail:"not found"};return{name:"git",ok:!0,detail:D.stdout.trim()}}async checkTmux(){let D=await U(this.sshOpts,"tmux -V");if(!D.ok)return{name:"tmux",ok:!1,detail:"not found"};return{name:"tmux",ok:!0,detail:D.stdout.trim()}}async checkRuntime(){let D=await U(this.sshOpts,"bun --version");if(D.ok)return{name:"bun",ok:!0,detail:D.stdout.trim()};let u=await U(this.sshOpts,"node --version");if(u.ok)return{name:"node",ok:!0,detail:u.stdout.trim()};return{name:"runtime",ok:!1,detail:"neither bun nor node found"}}}async function y(D){if(D===z)return new Wu;let u=await g(D);if(!u)throw new N("HOST_NOT_FOUND",`Host "${D}" not found`);return new yu(u)}async function $D(D){if(D===z)return`${await Lu()}/.wt`;let u=await g(D);if(!u)throw new N("HOST_NOT_FOUND",`Host "${D}" not found`);return u.root}async function v0(D){return(await a()).sandboxes[D]}async function fE(D){await p((u)=>{u.sandboxes[D.name]=D})}async function NE(){let D=await a();return Object.values(D.sandboxes).sort((u,F)=>u.name.localeCompare(F.name))}async function nD(D){let u=await v0(D);if(!u)throw new N("SANDBOX_NOT_FOUND",`Sandbox "${D}" not found`);return u}async function OE(D,u){let F=await p((E)=>{let C=E.sandboxes[D];if(!C)throw new N("SANDBOX_NOT_FOUND",`Sandbox "${D}" not found`);if(E.sandboxes[u])throw new N("SANDBOX_EXISTS",`Sandbox "${u}" already exists`);let B={...C,name:u};return delete E.sandboxes[D],E.sandboxes[u]=B,B});try{let E=await y(F.host),C=await $D(F.host);await E.writeMeta(C,F.id,F)}catch{}return F}async function Pu(D){let u=await AE(),F=await hE(u),E=D.branch??D.ref??await HE(),C=D.branch,B=await y(D.hostName),t=await $D(D.hostName),$=await v0(D.name);if($){if($.host===D.hostName&&$.repoId===F){if(await B.dirExists($.path))return{entry:$,isIdempotent:!0}}throw new N("SANDBOX_EXISTS",`Sandbox "${D.name}" already exists (host=${$.host}, repoId=${$.repoId})`)}let n=RE(),A=`${t}/sandboxes/${D.name}`;try{await B.ensureLayout(t);let x=await B.ensureMirror(t,F,u);await B.createWorktree(x,A,E,C),await B.copyEnvFiles(process.cwd(),A);let H={name:D.name,id:n,host:D.hostName,origin:u,repoId:F,ref:E,path:A,createdAt:new Date().toISOString()};return await B.writeMeta(t,n,H),await fE(H),{entry:H,isIdempotent:!1}}catch(x){if(x instanceof N)throw x;throw new N("CREATION_FAILED",x instanceof Error?x.message:String(x))}}async function kD(D){let u=await nD(D),F=await y(u.host);if(!await F.dirExists(u.path))throw new N("PATH_MISSING",`Sandbox path does not exist: ${u.path}`);return F.execInteractive(u.path,{WT_SANDBOX:u.name,WT_SANDBOX_ID:u.id})}async function mD(D){let u=await nD(D),F=await y(u.host);if(!await F.dirExists(u.path))throw new N("PATH_MISSING",`Sandbox path does not exist: ${u.path}`);if(!(await F.checkTmux()).ok)throw new N("CREATION_FAILED","tmux not found on host. Run: wt bootstrap --tmux --host <host>");let B=`wt-${u.id}`;return F.execTmux(u.path,B)}function Vu(D,u){if(D.host===z)return`wt enter ${D.name}`;if(!u)return`wt enter ${D.name}`;let F=["ssh","-t"];if(u.port)F.push("-p",String(u.port));if(u.identity)F.push("-i",u.identity);return F.push(u.ssh,`'cd ${D.path} && exec $SHELL -l'`),F.join(" ")}function o0(D){D.command("up").description("Create a sandbox worktree on a host").argument("[name]","Sandbox name (defaults to branch name from -b/--ref or current branch)").option("-H, --host <hostName>","Target host (defaults to configured default)").option("-b, --branch <name>","Create or use a branch with this name").option("-r, --ref <ref>","Git ref to check out (branch, tag, or sha that must exist)").option("-e, --enter","Enter the sandbox after creating it").option("--tmux","Use tmux when entering (implies --enter)").option("--json","Output result as JSON").action(async(u,F)=>{try{if(!await Yu()){if(F.json)console.log(JSON.stringify({ok:!1,error:"Not inside a git repository"},null,2));else console.error(S.red("Error: Not inside a git repository"));process.exit(1)}if(F.branch&&F.ref){if(F.json)console.log(JSON.stringify({ok:!1,error:"Cannot use both --branch and --ref"},null,2));else console.error(S.red("Error: Cannot use both --branch and --ref"));process.exit(1)}let{ref:E,branch:C}=F,B=u;if(!B){let x=C??E??await Qu();if(x)B=Ku(x);else{if(F.json)console.log(JSON.stringify({ok:!1,error:"No name provided and could not determine branch name"},null,2));else console.error(S.red("Error: No name provided and could not determine branch name"));process.exit(1)}}let t;if(F.host){if(t=F.host,t!==z){if(!await g(t)){if(F.json)console.log(JSON.stringify({ok:!1,error:`Host "${t}" not found`},null,2));else console.error(S.red(`Error: Host "${t}" not found`));process.exit(1)}}}else t=(await zD())?.name??z;let $=await Pu({name:B,hostName:t,ref:E,branch:C});if(F.json){console.log(JSON.stringify($.entry,null,2));return}if($.isIdempotent)console.log(S.dim(`Sandbox "${B}" already exists`));else console.log(S.green(`Created sandbox "${B}"`));if(F.enter||F.tmux){if(F.tmux)await mD(B);else await kD(B);return}let n=t!==z?await g(t):void 0,A=Vu($.entry,n??void 0);if(process.stdout.isTTY)console.log(`Enter with: ${S.cyan(A)}`);else console.log(A)}catch(E){if(E instanceof N){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(S.red(`Error: ${E.message}`));process.exit(1)}throw E}})}function d0(D){D.command("local").description("Create a local sandbox worktree").argument("[name]","Sandbox name (defaults to branch name from -b/--ref or current branch)").option("-b, --branch <name>","Create or use a branch with this name").option("-r, --ref <ref>","Git ref to check out (branch, tag, or sha that must exist)").option("-e, --enter","Enter the sandbox after creating it").option("--tmux","Use tmux when entering (implies --enter)").option("--json","Output result as JSON").action(async(u,F)=>{try{if(!await Yu()){if(F.json)console.log(JSON.stringify({ok:!1,error:"Not inside a git repository"},null,2));else console.error(S.red("Error: Not inside a git repository"));process.exit(1)}if(F.branch&&F.ref){if(F.json)console.log(JSON.stringify({ok:!1,error:"Cannot use both --branch and --ref"},null,2));else console.error(S.red("Error: Cannot use both --branch and --ref"));process.exit(1)}let{ref:E,branch:C}=F,B=u;if(!B){let n=C??E??await Qu();if(n)B=Ku(n);else{if(F.json)console.log(JSON.stringify({ok:!1,error:"No name provided and could not determine branch name"},null,2));else console.error(S.red("Error: No name provided and could not determine branch name"));process.exit(1)}}let t=await Pu({name:B,hostName:z,ref:E,branch:C});if(F.json){console.log(JSON.stringify(t.entry,null,2));return}if(t.isIdempotent)console.log(S.dim(`Sandbox "${B}" already exists`));else console.log(S.green(`Created sandbox "${B}"`));if(F.enter||F.tmux){if(F.tmux)await mD(B);else await kD(B);return}let $=Vu(t.entry);if(process.stdout.isTTY)console.log(`Enter with: ${S.cyan($)}`);else console.log($)}catch(E){if(E instanceof N){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(S.red(`Error: ${E.message}`));process.exit(1)}throw E}})}function c0(D){D.command("enter").description("Enter an existing sandbox").argument("<name>","Sandbox name").option("--json","Output sandbox record as JSON without entering").option("--tmux","Attach or create a tmux session in the sandbox").action(async(u,F)=>{try{if(F.json){let E=await nD(u);console.log(JSON.stringify(E,null,2));return}if(F.tmux)await mD(u);else await kD(u)}catch(E){if(E instanceof N){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(S.red(`Error: ${E.message}`));process.exit(1)}throw E}})}async function _E(D,u,F){let E=await nD(D),C=await y(E.host);if(!await C.dirExists(E.path))throw new N("PATH_MISSING",`Sandbox path does not exist: ${E.path}`);if(F.capture){let $=await C.exec(E.path,u);return{name:E.name,id:E.id,host:E.host,path:E.path,command:u,exitCode:$.exitCode,stdout:$.stdout,stderr:$.stderr}}let t=await C.execStream(E.path,u);return{name:E.name,id:E.id,host:E.host,path:E.path,command:u,exitCode:t,stdout:"",stderr:""}}function g0(D){D.command("run").description("Run a command in a sandbox").argument("<name>","Sandbox name").argument("<cmd...>","Command to run").option("--json","Capture output and return as JSON").option("--quiet","Suppress non-error output").passThroughOptions().action(async(u,F,E)=>{try{let C=F[0]==="--"?F.slice(1):F;if(C.length===0)console.error(S.red("Error: No command specified")),process.exit(1);let B=await _E(u,C,{capture:!!E.json});if(E.json)console.log(JSON.stringify(B,null,2)),process.exit(B.exitCode);process.exit(B.exitCode)}catch(C){if(C instanceof N){if(E.json)console.log(JSON.stringify({ok:!1,error:C.message},null,2));else if(!E.quiet)console.error(S.red(`Error: ${C.message}`));process.exit(1)}throw C}})}async function TE(D){let u=await y(D);if(!(await u.checkTmux()).ok)return{host:D,sessions:[],ok:!0,warnings:["tmux not installed"]};let E=await u.listTmuxSessions();return{host:D,sessions:E,ok:!0,warnings:[]}}function i0(D){D.command("sessions").description("List running tmux sessions for wt sandboxes").option("-H, --host <hostName>","Target host").option("--json","Output as JSON").action(async(u)=>{let F;if(u.host)F=u.host;else F=(await zD())?.name??z;let E=await TE(F);if(u.json){console.log(JSON.stringify(E,null,2));return}if(E.warnings.length>0)for(let C of E.warnings)console.error(S.yellow(`Warning: ${C}`));if(E.sessions.length===0){console.log(S.dim("No active sessions."));return}for(let C of E.sessions){let B=C.attached?S.green("attached"):S.dim("detached");console.log(`${C.name} ${B}`)}})}var qE=dD(JE(),1);async function s0(D){let u=qE.default(D.olderThan);if(u===void 0||u<=0)throw Error(`Invalid duration: ${D.olderThan}`);let F=await a(),C=Date.now()-u,B=Object.values(F.sandboxes),t=D.hostName?B.filter((H)=>H.host===D.hostName):B,$=[],n=[],A=[],x=new Set;for(let H of t){let w=new Date(H.createdAt).getTime()<C;if(!w)try{if(!await(await y(H.host)).dirExists(H.path))w=!0}catch{w=!0}if(!w){n.push(H);continue}if(D.dryRun){$.push(H);continue}try{let h=await y(H.host),f=await $D(H.host);await h.removeSandboxDir(H.path),await h.removeMeta(f,H.id),x.add(`${H.host}:${f}/mirrors/${H.repoId}.git`),$.push(H)}catch(h){A.push({sandbox:H.name,error:h instanceof Error?h.message:String(h)})}}if(!D.dryRun&&$.length>0)await p((H)=>{for(let R of $)delete H.sandboxes[R.name]});if(!D.dryRun)for(let H of x){let[R,w]=H.split(":",2);try{await(await y(R)).pruneWorktrees(w)}catch{}}return{deleted:$,kept:n,errors:A}}function a0(D){D.command("gc").description("Remove stale sandboxes").option("-H, --host <hostName>","Target host (omit for all hosts)").option("--older-than <duration>","Age threshold (e.g. 7d, 24h, 1w)","7d").option("--dry-run","Show what would be deleted without deleting").option("-y, --yes","Skip confirmation prompt").option("--json","Output as JSON").action(async(u)=>{try{let F=await s0({hostName:u.host,olderThan:u.olderThan,dryRun:!0});if(u.json&&u.dryRun){console.log(JSON.stringify(F,null,2));return}if(F.deleted.length===0&&F.errors.length===0){if(u.json)console.log(JSON.stringify(F,null,2));else console.log(S.dim("Nothing to clean up."));return}if(u.dryRun){if(F.deleted.length>0){console.log(`Would delete ${F.deleted.length} sandbox(es)`);for(let C of F.deleted)console.log(` ${S.red("-")} ${C.name} (${C.host})`)}return}if(!u.json){console.log(`Found ${F.deleted.length} sandbox(es) to delete:`);for(let C of F.deleted)console.log(` ${S.red("-")} ${C.name} (${C.host})`)}if(!u.yes&&!u.json){if(!await tD({message:`Delete ${F.deleted.length} sandbox(es)?`,default:!1})){console.log(S.dim("Cancelled."));return}}let E=await s0({hostName:u.host,olderThan:u.olderThan,dryRun:!1});if(u.json){console.log(JSON.stringify(E,null,2));return}if(E.deleted.length>0)console.log(`Deleted ${E.deleted.length} sandbox(es)`);if(E.errors.length>0){for(let C of E.errors)console.error(S.red(`Error (${C.sandbox}): ${C.error}`));process.exit(1)}}catch(F){if(F instanceof uD)console.log(S.dim(`
60
- Cancelled.`)),process.exit(130);if(u.json)console.log(JSON.stringify({ok:!1,error:F instanceof Error?F.message:String(F)},null,2));else console.error(S.red(`Error: ${F instanceof Error?F.message:String(F)}`));process.exit(1)}})}async function GE(D){let u=[],F=[],E=[];if(D!==z){let A=await g(D);if(!A)return{ok:!1,host:D,checks:[{name:"host",ok:!1,detail:"not found in config"}],warnings:[],errors:[`Host "${D}" not found`]};let x=await Mu(HD(A)),H=x.ok?{name:"ssh",ok:!0,detail:"connected"}:{name:"ssh",ok:!1,detail:x.stderr||"connection failed"};if(u.push(H),!H.ok)return E.push(`SSH connection failed: ${H.detail}`),{ok:!1,host:D,checks:u,warnings:F,errors:E}}let C=await y(D),B=await C.checkGit();if(u.push(B),!B.ok)E.push(`git: ${B.detail}`);let t=await C.checkRuntime();if(u.push(t),!t.ok)F.push(`runtime: ${t.detail}`);let $=await C.checkTmux();if(u.push($),!$.ok)F.push(`tmux: ${$.detail}`);return{ok:u.every((A)=>A.ok||A.name==="tmux"||A.name==="runtime"),host:D,checks:u,warnings:F,errors:E}}function l0(D){D.command("doctor").description("Check system prerequisites and host health").option("-H, --host <hostName>","Target host").option("--json","Output as JSON").action(async(u)=>{let F;if(u.host)F=u.host;else F=(await zD())?.name??z;let E=await GE(F);if(u.json){console.log(JSON.stringify(E,null,2));return}for(let C of E.checks)if(C.ok)console.log(` ${S.green("\u2713")} ${C.name}${C.detail?` (${C.detail})`:""}`);else console.log(` ${S.red("\u2717")} ${C.name}${C.detail?`: ${C.detail}`:""}`);if(E.warnings.length>0)for(let C of E.warnings)console.log(` ${S.yellow("\u26A0")} ${C}`);if(console.log(),E.ok)console.log(S.green(`Host "${F}" is healthy.`));else console.log(S.red(`Host "${F}" has issues.`)),process.exit(1)})}async function j8(D){let u=await g(D);if(!u)return null;let F=HD(u);for(let E of["apt-get","apk","dnf","yum","brew"])if((await U(F,`command -v ${E}`)).ok)return E;return null}function X8(D,u){switch(u){case"apt-get":return`sudo apt-get install -y ${D}`;case"apk":return`sudo apk add ${D}`;case"dnf":return`sudo dnf install -y ${D}`;case"yum":return`sudo yum install -y ${D}`;case"brew":return`brew install ${D}`;default:return`install ${D} manually`}}async function jE(D){let u=[],F=[],E=[],C=D.hostName===z,B=await y(D.hostName),t=await B.checkGit();if(u.push(t),!t.ok)F.push("git");let $=await B.checkRuntime();if(u.push($),!$.ok)F.push("bun or node");if(D.tmux){let A=await B.checkTmux();if(u.push(A),!A.ok)F.push("tmux")}if(!C){let A=await g(D.hostName);if(!A)throw new N("HOST_NOT_FOUND",`Host "${D.hostName}" not found`);let x=HD(A);for(let H of["bash","curl"]){let w=(await U(x,`command -v ${H}`)).ok?{name:H,ok:!0}:{name:H,ok:!1,detail:"not found"};if(u.push(w),!w.ok)F.push(H)}for(let H of D.agents){let w=(await U(x,`command -v ${H}`)).ok?{name:H,ok:!0}:{name:H,ok:!1,detail:"not found"};if(u.push(w),!w.ok)F.push(H)}if(F.length>0){let H=await j8(D.hostName);if(H)for(let R of F)if(R==="bun or node")E.push("curl -fsSL https://bun.sh/install | bash");else if(R==="claude"||R==="opencode")E.push(`npm install -g ${R}`);else E.push(X8(R,H));else E.push(`No package manager found. Install manually: ${F.join(", ")}`)}}else if(F.length>0)for(let A of F)if(A==="bun or node")E.push("curl -fsSL https://bun.sh/install | bash");else E.push(`Install ${A} using your system package manager`);try{let A=await $D(D.hostName);await B.ensureLayout(A),u.push({name:"layout",ok:!0})}catch(A){u.push({name:"layout",ok:!1,detail:A instanceof Error?A.message:String(A)})}let n=F.length===0&&u.every((A)=>A.ok);return{host:D.hostName,ok:n,checks:u,missing:F,instructions:E}}function p0(D){D.command("bootstrap").description("Check host readiness and report missing packages").requiredOption("-H, --host <hostName>","Target host").option("--tmux","Include tmux in checks").option("--agents <list>","Comma-separated agent CLIs to check (e.g. claude,opencode)").option("--json","Output as JSON").action(async(u)=>{try{let F=u.agents?u.agents.split(",").map((C)=>C.trim()).filter(Boolean):[],E=await jE({hostName:u.host,tmux:!!u.tmux,agents:F});if(u.json){if(console.log(JSON.stringify(E,null,2)),!E.ok)process.exit(1);return}for(let C of E.checks)if(C.ok)console.log(` ${S.green("\u2713")} ${C.name}${C.detail?` (${C.detail})`:""}`);else console.log(` ${S.red("\u2717")} ${C.name}${C.detail?`: ${C.detail}`:""}`);if(E.missing.length>0)console.log(),console.log(S.yellow(`Missing: ${E.missing.join(", ")}`));if(E.instructions.length>0){console.log(),console.log(S.dim("Install instructions:"));for(let C of E.instructions)console.log(` ${C}`)}if(console.log(),E.ok)console.log(S.green(`Host "${u.host}" is ready.`));else console.log(S.red(`Host "${u.host}" is not ready.`)),process.exit(1)}catch(F){if(F instanceof N){if(u.json)console.log(JSON.stringify({ok:!1,error:F.message},null,2));else console.error(S.red(`Error: ${F.message}`));process.exit(1)}throw F}})}async function XE(D){let u=await NE(),F=D.hostName?u.filter((E)=>E.host===D.hostName):u;return{sandboxes:F,total:F.length}}function e0(D){D.command("ls").description("List sandboxes").option("-H, --host <hostName>","Filter by host").option("--json","Output as JSON").action(async(u)=>{try{let F=await XE({hostName:u.host});if(u.json){console.log(JSON.stringify(F,null,2));return}if(F.total===0){console.log(S.dim("No sandboxes found."));return}let E=Math.max(...F.sandboxes.map((t)=>t.name.length),4),C=Math.max(...F.sandboxes.map((t)=>t.host.length),4),B=Math.max(...F.sandboxes.map((t)=>t.ref.substring(0,8).length),3);console.log(S.bold(`${"NAME".padEnd(E)} ${"HOST".padEnd(C)} ${"REF".padEnd(B)} CREATED`));for(let t of F.sandboxes){let $=t.ref.substring(0,8),n=new Date(t.createdAt).toLocaleDateString();console.log(`${S.cyan(t.name.padEnd(E))} ${t.host.padEnd(C)} ${S.yellow($.padEnd(B))} ${S.dim(n)}`)}console.log(S.dim(`
61
- ${F.total} sandbox(es)`))}catch(F){if(u.json)console.log(JSON.stringify({ok:!1,error:F instanceof Error?F.message:String(F)},null,2));else console.error(S.red(`Error: ${F instanceof Error?F.message:String(F)}`));process.exit(1)}})}async function zE(D){let F=(await a()).sandboxes[D];if(!F)throw new N("SANDBOX_NOT_FOUND",`Sandbox "${D}" not found`);let E=await y(F.host),C=await $D(F.host),B={dir:!1,meta:!1,config:!1};try{await E.removeSandboxDir(F.path),B.dir=!0}catch{}try{await E.removeMeta(C,F.id),B.meta=!0}catch{}await p((t)=>{delete t.sandboxes[D]}),B.config=!0;try{let t=`${C}/mirrors/${F.repoId}.git`;await E.pruneWorktrees(t)}catch{}return{entry:F,cleaned:B}}function DF(D){D.command("rm").description("Remove a sandbox").argument("<name>","Sandbox name").option("-y, --yes","Skip confirmation prompt").option("--json","Output as JSON").action(async(u,F)=>{try{if(!F.yes&&!F.json){if(!await tD({message:`Remove sandbox "${u}"?`,default:!1})){console.log(S.dim("Cancelled."));return}}let E=await zE(u);if(F.json){console.log(JSON.stringify(E,null,2));return}console.log(`Removed sandbox ${S.cyan(E.entry.name)}`);let C=[];if(!E.cleaned.dir)C.push("directory");if(!E.cleaned.meta)C.push("metadata");if(C.length>0)console.log(S.yellow(` Warning: could not clean ${C.join(", ")}`))}catch(E){if(E instanceof uD)console.log(S.dim(`
62
- Cancelled.`)),process.exit(130);if(E instanceof N){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(S.red(`Error: ${E.message}`));process.exit(1)}throw E}})}function z8(D){let u=Date.now()-new Date(D).getTime(),F=Math.floor(u/1000);if(F<60)return`${F}s`;let E=Math.floor(F/60);if(E<60)return`${E}m`;let C=Math.floor(E/60);if(C<24)return`${C}h`;return`${Math.floor(C/24)}d`}async function UE(D){let u=await nD(D),F=await y(u.host),E=!1;try{E=await F.dirExists(u.path)}catch{}let C=null;try{let B=await F.listTmuxSessions(),t=`wt-${u.id}`,$=B.find((n)=>n.name===t);if($)C=$.name}catch{}return{entry:u,dirExists:E,tmuxSession:C,age:z8(u.createdAt)}}function uF(D){D.command("status").description("Show sandbox status").argument("<name>","Sandbox name").option("--json","Output as JSON").action(async(u,F)=>{try{let E=await UE(u);if(F.json){console.log(JSON.stringify(E,null,2));return}let{entry:C,dirExists:B,tmuxSession:t,age:$}=E;console.log(S.bold(C.name)),console.log(` ${"ID".padEnd(10)} ${S.dim(C.id)}`),console.log(` ${"Host".padEnd(10)} ${C.host}`),console.log(` ${"Ref".padEnd(10)} ${S.yellow(C.ref.substring(0,8))}`),console.log(` ${"Origin".padEnd(10)} ${S.dim(C.origin)}`),console.log(` ${"Path".padEnd(10)} ${C.path}`),console.log(` ${"Age".padEnd(10)} ${$}`);let n=B?S.green("exists"):S.red("missing");console.log(` ${"Dir".padEnd(10)} ${n}`);let A=t?S.green(t):S.dim("none");console.log(` ${"Tmux".padEnd(10)} ${A}`)}catch(E){if(E instanceof N){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(S.red(`Error: ${E.message}`));process.exit(1)}throw E}})}function FF(D){D.command("rename").description("Rename a sandbox").argument("<old>","Current sandbox name").argument("<new>","New sandbox name").option("--json","Output result as JSON").action(async(u,F,E)=>{try{let C=await OE(u,F);if(E.json){console.log(JSON.stringify(C,null,2));return}console.log(S.green(`Renamed "${u}" -> "${F}"`))}catch(C){if(C instanceof N){if(E.json)console.log(JSON.stringify({ok:!1,error:C.message},null,2));else console.error(S.red(`Error: ${C.message}`));process.exit(1)}throw C}})}var i=new IF,ME="0.0.4";function U8(D,u=""){let F=[],E=D.name(),C=D.registeredArguments.map(($)=>$.required?`<${$.name()}>`:`[${$.name()}]`).join(" "),B=C?`${E} ${C}`:E;F.push(`${u}${B}`);let t=D.commands.filter(($)=>$.name()!=="help");return t.forEach(($,n)=>{let A=n===t.length-1,x=A?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",H=u+(A?" ":"\u2502 "),R=$.name(),w=$.registeredArguments.map((O)=>O.required?`<${O.name()}>`:`[${O.name()}]`).join(" "),h=w?`${R} ${w}`:R,f=$.commands.filter((O)=>O.name()!=="help");if(f.length>0)F.push(`${u}${x}${h}`),f.forEach((O,I)=>{let T=I===f.length-1?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",b=O.name(),e=O.registeredArguments.map((oD)=>oD.required?`<${oD.name()}>`:`[${oD.name()}]`).join(" "),SD=e?`${b} ${e}`:b;F.push(`${H}${T}${SD}`)});else F.push(`${u}${x}${h}`)}),F}i.name("wt").enablePositionalOptions().description("Run worktrees, coding agents, and more all from the cloud. SSH included, agents too!").version(ME,"-v, --version").option("--tree","Show command tree").action((D)=>{if(D.tree){console.log(U8(i).join(`
53
+ `));let D=await Eu({message:"Host name:",validate:(B)=>{if(!B)return"Host name is required";if(!/^[a-z][a-z0-9_-]{0,31}$/.test(B))return"Must start with a-z, followed by a-z, 0-9, _, or - (max 32 chars)";return!0}}),u=await Eu({message:"SSH target (alias or user@host):",validate:(B)=>B?!0:"SSH target is required"}),F=await Eu({message:"Remote base directory:",default:"~/.wt",validate:(B)=>{if(!B)return"Root path is required";if(!B.startsWith("/")&&!B.startsWith("~/"))return"Must be an absolute path (start with / or ~/)";return!0}}),E=await AD({message:"Set as default host?",default:!0}),C=await AD({message:"Run connectivity check?",default:!0});return{name:D,ssh:u,root:F,setDefault:E,skipCheck:!C,runCheck:C}}function x3(D){D.command("add").description("Register or update a remote host").argument("[name]","Host identifier (a-z, 0-9, _, - ; max 32 chars)").option("-s, --ssh <target>","SSH target (alias, user@host, or ssh://user@host:port)").option("-r, --root <path>","Remote base directory (absolute path)").option("-d, --default","Set as default host").option("-p, --port <number>","SSH port (overrides target/config)").option("-i, --identity <path>","Path to SSH identity file").option("-t, --connect-timeout <seconds>","Connection timeout in seconds","10").option("--no-check","Skip connectivity check after adding").option("-l, --labels <k=v,...>","Comma-separated key=value labels").option("--json","Output result as JSON").action(async(u,F)=>{try{let E,C=!u||!F.ssh||!F.root;if(C&&F.json)console.log(JSON.stringify({ok:!1,error:"Missing required arguments (name, --ssh, --root) and --json prevents interactive mode"},null,2)),process.exit(1);if(C)E=await I8();else E={name:u,ssh:F.ssh,root:F.root,setDefault:F.default,port:F.port?parseInt(F.port,10):void 0,identity:F.identity,connectTimeout:F.connectTimeout?parseInt(F.connectTimeout,10):void 0,skipCheck:F.check===!1,labels:m0(F.labels)};if(!E.skipCheck&&!F.json)console.log(`
54
+ Checking ${E.name} (${E.ssh}:${E.root})...`);let B=await d0(E);if(F.json)console.log(JSON.stringify(B,null,2));else{if(B.checkResult)console.log(z8(B.checkResult)),console.log();let $=E.setDefault?N.dim(" (default)"):"",A=B.action==="created"?"Added":"Updated";if(B.checkResult?.ok===!1)console.log(N.yellow(`${A} host "${B.host.name}"${$}, but check failed.`));else console.log(N.green(`${A} host "${B.host.name}"${$}`))}if(B.checkResult&&!B.checkResult.ok)process.exit(2)}catch(E){if(E instanceof FD)console.log(N.dim(`
55
+ Cancelled.`)),process.exit(130);if(E instanceof m){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(N.red(`Error: ${E.message}`));process.exit(E.code==="VALIDATION_ERROR"?1:1)}throw E}})}function U8(D){switch(D){case"ok":return N.green("ok");case"error":return N.red("error");default:return N.dim("unchecked")}}function OD(D,u){return D.padEnd(u)}function J3(D){D.command("ls").description("List all configured hosts").option("--json","Output as JSON").action(async(u)=>{let F=await c0();if(u.json){console.log(JSON.stringify(F,null,2));return}if(F.hosts.length===0){console.log(N.dim("No hosts configured. Run `wt host add` to add one."));return}let E=Math.max(4,...F.hosts.map(($)=>$.name.length))+2,C=Math.max(3,...F.hosts.map(($)=>$.ssh.length))+2,B=Math.max(4,...F.hosts.map(($)=>$.root.length))+2;console.log(N.bold(OD("NAME",E)+OD("SSH",C)+OD("ROOT",B)+OD("DEFAULT",9)+"STATUS"));for(let $ of F.hosts){let R=$.name===F.defaultHost?N.cyan("*"):N.dim("-");console.log(OD($.name,E)+OD($.ssh,C)+OD($.root,B)+OD(R,9)+U8($.lastStatus))}})}function Z8(D,u,F){let E=[];if(E.push(`Checking ${D.host} (${u}:${F})...`),D.checks.ssh.ok)E.push(` ${N.green("\u2713")} SSH connection`);else E.push(` ${N.red("\u2717")} SSH connection: ${D.checks.ssh.error}`);if(D.checks.ssh.ok){if(D.checks.directories.ok)E.push(` ${N.green("\u2713")} Directory structure`);else E.push(` ${N.red("\u2717")} Directory structure: ${D.checks.directories.error||"failed"}`);if(D.checks.git.ok)E.push(` ${N.green("\u2713")} git ${D.checks.git.version}`);else E.push(` ${N.red("\u2717")} git: ${D.checks.git.error||"not found"}`);if(D.checks.node.ok)E.push(` ${N.green("\u2713")} node ${D.checks.node.version}`);else E.push(` ${N.yellow("\u26A0")} node not found (optional)`)}return E.join(`
56
+ `)}function N3(D){D.command("check").description("Test connectivity and capabilities of a host").argument("<name>","Host to check").option("--json","Output result as JSON").action(async(u,F)=>{try{let E=await p(u);if(!E){if(F.json)console.log(JSON.stringify({ok:!1,error:`Host "${u}" not found`},null,2));else console.error(N.red(`Error: Host "${u}" not found`));process.exit(1)}let C=await n0(u);if(F.json)console.log(JSON.stringify(C,null,2));else if(console.log(Z8(C,E.ssh,E.root)),console.log(),C.ok)console.log(N.green(`Host "${u}" is ready.`));else console.log(N.red(`Host "${u}" check failed.`));if(!C.ok){if(!C.checks.ssh.ok)process.exit(2);process.exit(3)}}catch(E){if(E instanceof m){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(N.red(`Error: ${E.message}`));process.exit(E.code==="HOST_NOT_FOUND"?1:1)}throw E}})}function R3(D){D.command("rm").description("Remove a host configuration").argument("<name>","Host to remove").option("-y, --yes","Skip confirmation prompt").option("--json","Output result as JSON").action(async(u,F)=>{let E=await p(u);if(!E){if(F.json)console.log(JSON.stringify({ok:!1,error:`Host "${u}" not found`},null,2));else console.error(N.red(`Error: Host "${u}" not found`));process.exit(1)}try{if(!F.yes&&!F.json){if(!await AD({message:`Remove host "${u}" (${E.ssh})?`,default:!1})){console.log(N.dim("Cancelled."));return}}}catch(B){if(B instanceof FD)console.log(N.dim(`
57
+ Cancelled.`)),process.exit(130);throw B}let C=await h0(u);if(F.json)console.log(JSON.stringify({ok:C,removed:u},null,2));else console.log(N.green(`Removed host "${u}"`))})}function t0(D){let u=D.command("host").description("Manage remote compute hosts");x3(u),J3(u),N3(u),R3(u)}async function _3(){try{let D=await Bun.$`git remote get-url origin`.quiet().nothrow();if(D.exitCode!==0)throw new G("GIT_ERROR","No git remote 'origin' found");return D.stdout.toString().trim()}catch(D){if(D instanceof G)throw D;throw new G("NOT_IN_GIT_REPO","Not inside a git repository")}}async function T3(){let D=await Bun.$`git rev-parse HEAD`.quiet().nothrow();if(D.exitCode!==0)throw new G("GIT_ERROR","Failed to resolve HEAD");return D.stdout.toString().trim()}async function yu(){let D=await Bun.$`git rev-parse --show-toplevel`.quiet().nothrow();if(D.exitCode!==0)throw new G("NOT_IN_GIT_REPO","Not inside a git repository");return D.stdout.toString().trim()}async function Pu(){return(await Bun.$`git rev-parse --is-inside-work-tree`.quiet().nothrow()).exitCode===0}async function vD(){let D=await Bun.$`git rev-parse --abbrev-ref HEAD`.quiet().nothrow();if(D.exitCode!==0)return null;let u=D.stdout.toString().trim();return u==="HEAD"?null:u}function ku(D){let u=D.replace(/\/+/g,"-").replace(/[^a-zA-Z0-9._-]/g,"-").replace(/-{2,}/g,"-").replace(/^-+|-+$/g,"");if(!u||u==="."||u==="..")return"sandbox";return u}function X3(D){try{let u=new URL(D);if(u.username||u.password)return u.username="",u.password="",u.toString();return D}catch{return D}}import{webcrypto as j3}from"crypto";var G3="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Y8=128,LD,mD;function M8(D){if(!LD||LD.length<D)LD=Buffer.allocUnsafe(D*Y8),j3.getRandomValues(LD),mD=0;else if(mD+D>LD.length)j3.getRandomValues(LD),mD=0;mD+=D}function O3(D=21){M8(D|=0);let u="";for(let F=mD-D;F<mD;F++)u+=G3[LD[F]&63];return u}function S3(){return O3(12)}async function z3(D){let u=D.replace(/\.git$/,"").toLowerCase().trim(),F=new TextEncoder().encode(u);return new Bun.CryptoHasher("sha256").update(F).digest("hex").slice(0,16)}class hu{async ensureLayout(D){await Bun.$`mkdir -p ${D}/mirrors ${D}/sandboxes ${D}/meta`.quiet()}async ensureMirror(D,u,F){let E=`${D}/mirrors/${u}.git`;if(!await Bun.file(`${E}/HEAD`).exists()){let $=await Bun.$`git clone --bare --mirror ${F} ${E}`.quiet().nothrow();if($.exitCode!==0)throw Error(`Failed to create mirror: ${$.stderr.toString().trim()}`)}else await Bun.$`git -C ${E} fetch --prune origin`.quiet().nothrow();let B=await yu();return await Bun.$`git -C ${E} fetch ${B} '+refs/heads/*:refs/heads/*'`.quiet().nothrow(),E}async createWorktree(D,u,F,E){let C=E?await Bun.$`git -C ${D} worktree add -B ${E} ${u}`.quiet().nothrow():await Bun.$`git -C ${D} worktree add --detach ${u} ${F}`.quiet().nothrow();if(C.exitCode!==0)throw Error(`Failed to create worktree: ${C.stderr.toString().trim()}`);await Bun.$`git -C ${u} config --unset remote.origin.mirror`.quiet().nothrow(),await Bun.$`git -C ${u} config remote.origin.push refs/heads/*:refs/heads/*`.quiet().nothrow()}async writeMeta(D,u,F){let E=`${D}/meta/${u}.json`;await Bun.write(E,JSON.stringify(F,null,2))}async removeSandboxDir(D){await Bun.$`rm -rf ${D}`.quiet().nothrow()}async pruneWorktrees(D){await Bun.$`git -C ${D} worktree prune`.quiet().nothrow()}async removeMeta(D,u){let F=`${D}/meta/${u}.json`;await Bun.$`rm -f ${F}`.quiet().nothrow()}async dirExists(D){return Bun.file(`${D}/.git`).exists()}async exec(D,u){let[F,...E]=u,C=await Bun.$`${F} ${E}`.cwd(D).quiet().nothrow();return{exitCode:C.exitCode,stdout:C.stdout.toString().trim(),stderr:C.stderr.toString().trim()}}async execStream(D,u){return Bun.spawn(u,{cwd:D,stdin:"inherit",stdout:"inherit",stderr:"inherit"}).exited}async execInteractive(D,u){let F=Bun.env.SHELL||"/bin/sh",C=await Bun.spawn([F,"-l"],{cwd:D,stdin:"inherit",stdout:"inherit",stderr:"inherit",env:{...process.env,...u}}).exited;process.exit(C)}async execTmux(D,u){let E=await Bun.spawn(["tmux","new-session","-A","-s",u,"-c",D],{stdin:"inherit",stdout:"inherit",stderr:"inherit"}).exited;process.exit(E)}async listTmuxSessions(){let D=await Bun.$`tmux ls -F '#{session_name}\t#{session_attached}'`.quiet().nothrow();if(D.exitCode!==0)return[];return D.stdout.toString().trim().split(`
58
+ `).filter(Boolean).map((F)=>{let[E,C]=F.split("\t");return{name:E,attached:C==="1"}}).filter((F)=>F.name.startsWith("wt-"))}async copyEnvFiles(D,u){let F=new Bun.Glob(".env*");for await(let E of F.scan({cwd:D,onlyFiles:!0,dot:!0})){let C=Bun.file(`${D}/${E}`);await Bun.write(`${u}/${E}`,C)}}async checkGit(){let D=await Bun.$`git --version`.quiet().nothrow();if(D.exitCode!==0)return{name:"git",ok:!1,detail:"not found"};return{name:"git",ok:!0,detail:D.stdout.toString().trim()}}async checkTmux(){let D=await Bun.$`tmux -V`.quiet().nothrow();if(D.exitCode!==0)return{name:"tmux",ok:!1,detail:"not found"};return{name:"tmux",ok:!0,detail:D.stdout.toString().trim()}}async checkRuntime(){let D=await Bun.$`bun --version`.quiet().nothrow();if(D.exitCode===0)return{name:"bun",ok:!0,detail:D.stdout.toString().trim()};let u=await Bun.$`node --version`.quiet().nothrow();if(u.exitCode===0)return{name:"node",ok:!0,detail:u.stdout.toString().trim()};return{name:"runtime",ok:!1,detail:"neither bun nor node found"}}}function l0(D){let u=[];for(let F=0;F<D.length;F++){if(D[F]==="-o"&&D[F+1]?.startsWith("BatchMode")){F++;continue}u.push(D[F])}return u}class bu{host;constructor(D){this.host=D}get sshOpts(){return ND(this.host)}async ensureLayout(D){let u=["mirrors","sandboxes","meta"].map((E)=>M(`${D}/${E}`)).join(" "),F=await Q(this.sshOpts,`mkdir -p ${u}`);if(!F.ok)throw Error(`Failed to create remote layout: ${F.stderr}`)}async ensureMirror(D,u,F){let E=`${D}/mirrors/${u}.git`;if(!(await Q(this.sshOpts,`test -f ${M(E)}/HEAD`)).ok){let B=await Q(this.sshOpts,`git clone --bare --mirror ${M(F)} ${M(E)}`);if(!B.ok)throw Error(`Failed to create remote mirror: ${B.stderr}`)}else await Q(this.sshOpts,`git -C ${M(E)} fetch --prune origin`);return E}async createWorktree(D,u,F,E){let C=E?`git -C ${M(D)} worktree add -B ${M(E)} ${M(u)}`:`git -C ${M(D)} worktree add --detach ${M(u)} ${M(F)}`,B=await Q(this.sshOpts,C);if(!B.ok)throw Error(`Failed to create remote worktree: ${B.stderr}`);await Q(this.sshOpts,`git -C ${M(u)} config --unset remote.origin.mirror`),await Q(this.sshOpts,`git -C ${M(u)} config remote.origin.push refs/heads/*:refs/heads/*`)}async writeMeta(D,u,F){let E=`${D}/meta/${u}.json`,B=JSON.stringify(F,null,2).replace(/'/g,"'\\''"),$=await Q(this.sshOpts,`printf '%s' '${B}' > ${M(E)}`);if(!$.ok)throw Error(`Failed to write remote meta: ${$.stderr}`)}async removeSandboxDir(D){await Q(this.sshOpts,`rm -rf ${M(D)}`)}async pruneWorktrees(D){await Q(this.sshOpts,`git -C ${M(D)} worktree prune`)}async removeMeta(D,u){await Q(this.sshOpts,`rm -f ${M(`${D}/meta/${u}.json`)}`)}async dirExists(D){return(await Q(this.sshOpts,`test -d ${M(D)}`)).ok}async exec(D,u){let F=u.map((C)=>`'${C.replace(/'/g,"'\\''")}'`).join(" "),E=await Q(this.sshOpts,`cd ${M(D)} && ${F}`);return{exitCode:E.exitCode,stdout:E.stdout,stderr:E.stderr}}async execStream(D,u){let F=u.map(($)=>`'${$.replace(/'/g,"'\\''")}'`).join(" "),E=l0(bD(this.sshOpts)),C=`cd ${M(D)} && ${F}`;return Bun.spawn(["ssh","-t",...E,C],{stdin:"inherit",stdout:"inherit",stderr:"inherit"}).exited}async execInteractive(D,u){let F=l0(bD(this.sshOpts)),E=`cd ${M(D)} && exec $SHELL -l`,B=await Bun.spawn(["ssh","-t",...F,E],{stdin:"inherit",stdout:"inherit",stderr:"inherit",env:process.env}).exited;process.exit(B)}async execTmux(D,u){let F=l0(bD(this.sshOpts)),E=`cd ${M(D)} && tmux new-session -A -s ${M(u)}`,B=await Bun.spawn(["ssh","-t",...F,E],{stdin:"inherit",stdout:"inherit",stderr:"inherit",env:process.env}).exited;process.exit(B)}async listTmuxSessions(){let D=await Q(this.sshOpts,"tmux ls -F '#{session_name}\t#{session_attached}'");if(!D.ok)return[];return D.stdout.trim().split(`
59
+ `).filter(Boolean).map((F)=>{let[E,C]=F.split("\t");return{name:E,attached:C==="1"}}).filter((F)=>F.name.startsWith("wt-"))}async copyEnvFiles(D,u){let F=new Bun.Glob(".env*"),E=[];for await(let A of F.scan({cwd:D,onlyFiles:!0,dot:!0}))E.push(A);if(E.length===0)return;let C=bD(this.sshOpts),B=C.pop(),$=[];for(let A=0;A<C.length;A++)if(C[A]==="-p")$.push("-P",C[A+1]),A++;else if(C[A]==="-i")$.push("-i",C[A+1]),A++;else if(C[A]==="-o")$.push("-o",C[A+1]),A++;for(let A of E){let R=`${D}/${A}`,x=`${B}:${u}/${A}`;await Bun.$`scp ${$} ${R} ${x}`.quiet().nothrow()}}async checkGit(){let D=await Q(this.sshOpts,"git --version");if(!D.ok)return{name:"git",ok:!1,detail:"not found"};return{name:"git",ok:!0,detail:D.stdout.trim()}}async checkTmux(){let D=await Q(this.sshOpts,"tmux -V");if(!D.ok)return{name:"tmux",ok:!1,detail:"not found"};return{name:"tmux",ok:!0,detail:D.stdout.trim()}}async checkRuntime(){let D=await Q(this.sshOpts,"bun --version");if(D.ok)return{name:"bun",ok:!0,detail:D.stdout.trim()};let u=await Q(this.sshOpts,"node --version");if(u.ok)return{name:"node",ok:!0,detail:u.stdout.trim()};return{name:"runtime",ok:!1,detail:"neither bun nor node found"}}}async function h(D){if(D===W)return new hu;let u=await p(D);if(!u)throw new G("HOST_NOT_FOUND",`Host "${D}" not found`);return new bu(u)}async function HD(D){if(D===W)return`${await yu()}/.wt`;let u=await p(D);if(!u)throw new G("HOST_NOT_FOUND",`Host "${D}" not found`);return u.root}async function r0(D){return(await a()).sandboxes[D]}async function I3(D){await e((u)=>{u.sandboxes[D.name]=D})}async function U3(){let D=await a();return Object.values(D.sandboxes).sort((u,F)=>u.name.localeCompare(F.name))}async function RD(D){let u=await r0(D);if(!u)throw new G("SANDBOX_NOT_FOUND",`Sandbox "${D}" not found`);return u}async function Z3(D,u){wu(u);let F=await e((E)=>{let C=E.sandboxes[D];if(!C)throw new G("SANDBOX_NOT_FOUND",`Sandbox "${D}" not found`);if(E.sandboxes[u])throw new G("SANDBOX_EXISTS",`Sandbox "${u}" already exists`);let B={...C,name:u};return delete E.sandboxes[D],E.sandboxes[u]=B,B});try{let E=await h(F.host),C=await HD(F.host);await E.writeMeta(C,F.id,F)}catch{}return F}async function vu(D){if(wu(D.name),D.ref)v0(D.ref);if(D.branch)v0(D.branch);let u=await _3(),F=await z3(u),E=!D.branch&&!D.ref?await vD():null,C=D.branch??E??void 0,B=C??D.ref??await T3(),$=await h(D.hostName),A=await HD(D.hostName),R=await r0(D.name);if(R){if(R.host===D.hostName&&R.repoId===F){if(await $.dirExists(R.path))return{entry:R,isIdempotent:!0}}throw new G("SANDBOX_EXISTS",`Sandbox "${D.name}" already exists (host=${R.host}, repoId=${R.repoId})`)}let x=S3(),H=`${A}/sandboxes/${D.name}`;try{await $.ensureLayout(A);let J=await $.ensureMirror(A,F,u);await $.createWorktree(J,H,B,C),await $.copyEnvFiles(process.cwd(),H);let T={name:D.name,id:x,host:D.hostName,origin:X3(u),repoId:F,ref:B,path:H,createdAt:new Date().toISOString()};return await $.writeMeta(A,x,T),await I3(T),{entry:T,isIdempotent:!1}}catch(J){if(J instanceof G)throw J;throw new G("CREATION_FAILED",J instanceof Error?J.message:String(J))}}async function gD(D){let u=await RD(D),F=await h(u.host);if(!await F.dirExists(u.path))throw new G("PATH_MISSING",`Sandbox path does not exist: ${u.path}`);return F.execInteractive(u.path,{WT_SANDBOX:u.name,WT_SANDBOX_ID:u.id})}async function nD(D){let u=await RD(D),F=await h(u.host);if(!await F.dirExists(u.path))throw new G("PATH_MISSING",`Sandbox path does not exist: ${u.path}`);if(!(await F.checkTmux()).ok)throw new G("CREATION_FAILED","tmux not found on host. Run: wt bootstrap --tmux --host <host>");let B=`wt-${u.id}`;return F.execTmux(u.path,B)}function mu(D,u){if(D.host===W)return`wt enter ${D.name}`;if(!u)return`wt enter ${D.name}`;let F=["ssh","-t"];if(u.port)F.push("-p",String(u.port));if(u.identity)F.push("-i",u.identity);return F.push(u.ssh,`'cd ${D.path} && exec $SHELL -l'`),F.join(" ")}function p0(D){D.command("up").description("Create a sandbox worktree on a host").argument("[name]","Sandbox name (defaults to branch name from -b/--ref or current branch)").option("-H, --host <hostName>","Target host (defaults to configured default)").option("-b, --branch <name>","Create or use a branch with this name").option("-r, --ref <ref>","Git ref to check out (branch, tag, or sha that must exist)").option("-e, --enter","Enter the sandbox after creating it").option("--tmux","Use tmux when entering (implies --enter)").option("--json","Output result as JSON").action(async(u,F)=>{try{if(!await Pu()){if(F.json)console.log(JSON.stringify({ok:!1,error:"Not inside a git repository"},null,2));else console.error(N.red("Error: Not inside a git repository"));process.exit(1)}if(F.branch&&F.ref){if(F.json)console.log(JSON.stringify({ok:!1,error:"Cannot use both --branch and --ref"},null,2));else console.error(N.red("Error: Cannot use both --branch and --ref"));process.exit(1)}let{ref:E,branch:C}=F,B=u;if(!B){let H=C??E??await vD();if(H)B=ku(H);else{if(F.json)console.log(JSON.stringify({ok:!1,error:"No name provided and could not determine branch name"},null,2));else console.error(N.red("Error: No name provided and could not determine branch name"));process.exit(1)}}let $;if(F.host){if($=F.host,$!==W){if(!await p($)){if(F.json)console.log(JSON.stringify({ok:!1,error:`Host "${$}" not found`},null,2));else console.error(N.red(`Error: Host "${$}" not found`));process.exit(1)}}}else $=(await WD())?.name??W;let A=await vu({name:B,hostName:$,ref:E,branch:C});if(F.json){console.log(JSON.stringify(A.entry,null,2));return}if(A.isIdempotent)console.log(N.dim(`Sandbox "${B}" already exists`));else console.log(N.green(`Created sandbox "${B}"`));if(F.enter||F.tmux){if(F.tmux)await nD(B);else await gD(B);return}let R=$!==W?await p($):void 0,x=mu(A.entry,R??void 0);if(process.stdout.isTTY)console.log(`Enter with: ${N.cyan(x)}`);else console.log(x)}catch(E){if(E instanceof G){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(N.red(`Error: ${E.message}`));process.exit(1)}throw E}})}function i0(D){D.command("local").description("Create a local sandbox worktree").argument("[name]","Sandbox name (defaults to branch name from -b/--ref or current branch)").option("-b, --branch <name>","Create or use a branch with this name").option("-r, --ref <ref>","Git ref to check out (branch, tag, or sha that must exist)").option("-e, --enter","Enter the sandbox after creating it").option("--tmux","Use tmux when entering (implies --enter)").option("--json","Output result as JSON").action(async(u,F)=>{try{if(!await Pu()){if(F.json)console.log(JSON.stringify({ok:!1,error:"Not inside a git repository"},null,2));else console.error(N.red("Error: Not inside a git repository"));process.exit(1)}if(F.branch&&F.ref){if(F.json)console.log(JSON.stringify({ok:!1,error:"Cannot use both --branch and --ref"},null,2));else console.error(N.red("Error: Cannot use both --branch and --ref"));process.exit(1)}let{ref:E,branch:C}=F,B=u;if(!B){let R=C??E??await vD();if(R)B=ku(R);else{if(F.json)console.log(JSON.stringify({ok:!1,error:"No name provided and could not determine branch name"},null,2));else console.error(N.red("Error: No name provided and could not determine branch name"));process.exit(1)}}let $=await vu({name:B,hostName:W,ref:E,branch:C});if(F.json){console.log(JSON.stringify($.entry,null,2));return}if($.isIdempotent)console.log(N.dim(`Sandbox "${B}" already exists`));else console.log(N.green(`Created sandbox "${B}"`));if(F.enter||F.tmux){if(F.tmux)await nD(B);else await gD(B);return}let A=mu($.entry);if(process.stdout.isTTY)console.log(`Enter with: ${N.cyan(A)}`);else console.log(A)}catch(E){if(E instanceof G){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(N.red(`Error: ${E.message}`));process.exit(1)}throw E}})}function o0(D){D.command("enter").description("Enter an existing sandbox").argument("<name>","Sandbox name").option("--json","Output sandbox record as JSON without entering").option("--tmux","Attach or create a tmux session in the sandbox").action(async(u,F)=>{try{if(F.json){let E=await RD(u);console.log(JSON.stringify(E,null,2));return}if(F.tmux)await nD(u);else await gD(u)}catch(E){if(E instanceof G){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(N.red(`Error: ${E.message}`));process.exit(1)}throw E}})}async function Y3(D,u,F){let E=await RD(D),C=await h(E.host);if(!await C.dirExists(E.path))throw new G("PATH_MISSING",`Sandbox path does not exist: ${E.path}`);if(F.capture){let A=await C.exec(E.path,u);return{name:E.name,id:E.id,host:E.host,path:E.path,command:u,exitCode:A.exitCode,stdout:A.stdout,stderr:A.stderr}}let $=await C.execStream(E.path,u);return{name:E.name,id:E.id,host:E.host,path:E.path,command:u,exitCode:$,stdout:"",stderr:""}}function a0(D){D.command("run").description("Run a command in a sandbox").argument("<name>","Sandbox name").argument("<cmd...>","Command to run").option("--json","Capture output and return as JSON").option("--quiet","Suppress non-error output").passThroughOptions().action(async(u,F,E)=>{try{let C=F[0]==="--"?F.slice(1):F;if(C.length===0)console.error(N.red("Error: No command specified")),process.exit(1);let B=await Y3(u,C,{capture:!!E.json});if(E.json)console.log(JSON.stringify(B,null,2)),process.exit(B.exitCode);process.exit(B.exitCode)}catch(C){if(C instanceof G){if(E.json)console.log(JSON.stringify({ok:!1,error:C.message},null,2));else if(!E.quiet)console.error(N.red(`Error: ${C.message}`));process.exit(1)}throw C}})}async function M3(D){let u=await h(D);if(!(await u.checkTmux()).ok)return{host:D,sessions:[],ok:!0,warnings:["tmux not installed"]};let E=await u.listTmuxSessions();return{host:D,sessions:E,ok:!0,warnings:[]}}function s0(D){D.command("sessions").description("List running tmux sessions for wt sandboxes").option("-H, --host <hostName>","Target host").option("--json","Output as JSON").action(async(u)=>{let F;if(u.host)F=u.host;else F=(await WD())?.name??W;let E=await M3(F);if(u.json){console.log(JSON.stringify(E,null,2));return}if(E.warnings.length>0)for(let C of E.warnings)console.error(N.yellow(`Warning: ${C}`));if(E.sessions.length===0){console.log(N.dim("No active sessions."));return}for(let C of E.sessions){let B=C.attached?N.green("attached"):N.dim("detached");console.log(`${C.name} ${B}`)}})}var K3=rD(Q3(),1);async function e0(D){let u=K3.default(D.olderThan);if(u===void 0||u<=0)throw Error(`Invalid duration: ${D.olderThan}`);let F=await a(),C=Date.now()-u,B=Object.values(F.sandboxes),$=D.hostName?B.filter((J)=>J.host===D.hostName):B,A=[],R=[],x=[],H=new Set;for(let J of $){let _=new Date(J.createdAt).getTime()<C;if(!_)try{if(!await(await h(J.host)).dirExists(J.path))_=!0}catch{_=!0}if(!_){R.push(J);continue}if(D.dryRun){A.push(J);continue}try{let X=await h(J.host),j=await HD(J.host);await X.removeSandboxDir(J.path),await X.removeMeta(j,J.id),H.add(`${J.host}:${j}/mirrors/${J.repoId}.git`),A.push(J)}catch(X){x.push({sandbox:J.name,error:X instanceof Error?X.message:String(X)})}}if(!D.dryRun&&A.length>0)await e((J)=>{for(let T of A)delete J.sandboxes[T.name]});if(!D.dryRun)for(let J of H){let[T,_]=J.split(":",2);try{await(await h(T)).pruneWorktrees(_)}catch{}}return{deleted:A,kept:R,errors:x}}function DF(D){D.command("gc").description("Remove stale sandboxes").option("-H, --host <hostName>","Target host (omit for all hosts)").option("--older-than <duration>","Age threshold (e.g. 7d, 24h, 1w)","7d").option("--dry-run","Show what would be deleted without deleting").option("-y, --yes","Skip confirmation prompt").option("--json","Output as JSON").action(async(u)=>{try{let F=await e0({hostName:u.host,olderThan:u.olderThan,dryRun:!0});if(u.json&&u.dryRun){console.log(JSON.stringify(F,null,2));return}if(F.deleted.length===0&&F.errors.length===0){if(u.json)console.log(JSON.stringify(F,null,2));else console.log(N.dim("Nothing to clean up."));return}if(u.dryRun){if(F.deleted.length>0){console.log(`Would delete ${F.deleted.length} sandbox(es)`);for(let C of F.deleted)console.log(` ${N.red("-")} ${C.name} (${C.host})`)}return}if(!u.json){console.log(`Found ${F.deleted.length} sandbox(es) to delete:`);for(let C of F.deleted)console.log(` ${N.red("-")} ${C.name} (${C.host})`)}if(!u.yes&&!u.json){if(!await AD({message:`Delete ${F.deleted.length} sandbox(es)?`,default:!1})){console.log(N.dim("Cancelled."));return}}let E=await e0({hostName:u.host,olderThan:u.olderThan,dryRun:!1});if(u.json){console.log(JSON.stringify(E,null,2));return}if(E.deleted.length>0)console.log(`Deleted ${E.deleted.length} sandbox(es)`);if(E.errors.length>0){for(let C of E.errors)console.error(N.red(`Error (${C.sandbox}): ${C.error}`));process.exit(1)}}catch(F){if(F instanceof FD)console.log(N.dim(`
60
+ Cancelled.`)),process.exit(130);if(u.json)console.log(JSON.stringify({ok:!1,error:F instanceof Error?F.message:String(F)},null,2));else console.error(N.red(`Error: ${F instanceof Error?F.message:String(F)}`));process.exit(1)}})}async function W3(D){let u=[],F=[],E=[];if(D!==W){let x=await p(D);if(!x)return{ok:!1,host:D,checks:[{name:"host",ok:!1,detail:"not found in config"}],warnings:[],errors:[`Host "${D}" not found`]};let H=await Vu(ND(x)),J=H.ok?{name:"ssh",ok:!0,detail:"connected"}:{name:"ssh",ok:!1,detail:H.stderr||"connection failed"};if(u.push(J),!J.ok)return E.push(`SSH connection failed: ${J.detail}`),{ok:!1,host:D,checks:u,warnings:F,errors:E}}let C=await h(D),B=await C.checkGit();if(u.push(B),!B.ok)E.push(`git: ${B.detail}`);let $=await C.checkRuntime();if(u.push($),!$.ok)F.push(`runtime: ${$.detail}`);let A=await C.checkTmux();if(u.push(A),!A.ok)F.push(`tmux: ${A.detail}`);return{ok:u.every((x)=>x.ok||x.name==="tmux"||x.name==="runtime"),host:D,checks:u,warnings:F,errors:E}}function uF(D){D.command("doctor").description("Check system prerequisites and host health").option("-H, --host <hostName>","Target host").option("--json","Output as JSON").action(async(u)=>{let F;if(u.host)F=u.host;else F=(await WD())?.name??W;let E=await W3(F);if(u.json){console.log(JSON.stringify(E,null,2));return}for(let C of E.checks)if(C.ok)console.log(` ${N.green("\u2713")} ${C.name}${C.detail?` (${C.detail})`:""}`);else console.log(` ${N.red("\u2717")} ${C.name}${C.detail?`: ${C.detail}`:""}`);if(E.warnings.length>0)for(let C of E.warnings)console.log(` ${N.yellow("\u26A0")} ${C}`);if(console.log(),E.ok)console.log(N.green(`Host "${F}" is healthy.`));else console.log(N.red(`Host "${F}" has issues.`)),process.exit(1)})}var w8=/^[a-zA-Z0-9._-]+$/;async function V8(D){let u=await p(D);if(!u)return null;let F=ND(u);for(let E of["apt-get","apk","dnf","yum","brew"])if((await Q(F,`command -v ${M(E)}`)).ok)return E;return null}function f8(D,u){switch(u){case"apt-get":return`sudo apt-get install -y ${D}`;case"apk":return`sudo apk add ${D}`;case"dnf":return`sudo dnf install -y ${D}`;case"yum":return`sudo yum install -y ${D}`;case"brew":return`brew install ${D}`;default:return`install ${D} manually`}}async function L3(D){let u=[],F=[],E=[],C=D.hostName===W,B=await h(D.hostName),$=await B.checkGit();if(u.push($),!$.ok)F.push("git");let A=await B.checkRuntime();if(u.push(A),!A.ok)F.push("bun or node");if(D.tmux){let x=await B.checkTmux();if(u.push(x),!x.ok)F.push("tmux")}if(!C){let x=await p(D.hostName);if(!x)throw new G("HOST_NOT_FOUND",`Host "${D.hostName}" not found`);let H=ND(x);for(let J of["bash","curl"]){let _=(await Q(H,`command -v ${M(J)}`)).ok?{name:J,ok:!0}:{name:J,ok:!1,detail:"not found"};if(u.push(_),!_.ok)F.push(J)}for(let J of D.agents){if(!w8.test(J))throw new G("VALIDATION_ERROR",`Invalid agent name "${J}": must contain only alphanumeric characters, dots, underscores, or hyphens`);let _=(await Q(H,`command -v ${M(J)}`)).ok?{name:J,ok:!0}:{name:J,ok:!1,detail:"not found"};if(u.push(_),!_.ok)F.push(J)}if(F.length>0){let J=await V8(D.hostName);if(J)for(let T of F)if(T==="bun or node")E.push("curl -fsSL https://bun.sh/install | bash");else if(T==="claude"||T==="opencode")E.push(`npm install -g ${T}`);else E.push(f8(T,J));else E.push(`No package manager found. Install manually: ${F.join(", ")}`)}}else if(F.length>0)for(let x of F)if(x==="bun or node")E.push("curl -fsSL https://bun.sh/install | bash");else E.push(`Install ${x} using your system package manager`);try{let x=await HD(D.hostName);await B.ensureLayout(x),u.push({name:"layout",ok:!0})}catch(x){u.push({name:"layout",ok:!1,detail:x instanceof Error?x.message:String(x)})}let R=F.length===0&&u.every((x)=>x.ok);return{host:D.hostName,ok:R,checks:u,missing:F,instructions:E}}function FF(D){D.command("bootstrap").description("Check host readiness and report missing packages").requiredOption("-H, --host <hostName>","Target host").option("--tmux","Include tmux in checks").option("--agents <list>","Comma-separated agent CLIs to check (e.g. claude,opencode)").option("--json","Output as JSON").action(async(u)=>{try{let F=u.agents?u.agents.split(",").map((C)=>C.trim()).filter(Boolean):[],E=await L3({hostName:u.host,tmux:!!u.tmux,agents:F});if(u.json){if(console.log(JSON.stringify(E,null,2)),!E.ok)process.exit(1);return}for(let C of E.checks)if(C.ok)console.log(` ${N.green("\u2713")} ${C.name}${C.detail?` (${C.detail})`:""}`);else console.log(` ${N.red("\u2717")} ${C.name}${C.detail?`: ${C.detail}`:""}`);if(E.missing.length>0)console.log(),console.log(N.yellow(`Missing: ${E.missing.join(", ")}`));if(E.instructions.length>0){console.log(),console.log(N.dim("Install instructions:"));for(let C of E.instructions)console.log(` ${C}`)}if(console.log(),E.ok)console.log(N.green(`Host "${u.host}" is ready.`));else console.log(N.red(`Host "${u.host}" is not ready.`)),process.exit(1)}catch(F){if(F instanceof G){if(u.json)console.log(JSON.stringify({ok:!1,error:F.message},null,2));else console.error(N.red(`Error: ${F.message}`));process.exit(1)}throw F}})}async function w3(D){let u=await U3(),F=D.hostName?u.filter((E)=>E.host===D.hostName):u;return{sandboxes:F,total:F.length}}function EF(D){D.command("ls").description("List sandboxes").option("-H, --host <hostName>","Filter by host").option("--json","Output as JSON").action(async(u)=>{try{let F=await w3({hostName:u.host});if(u.json){console.log(JSON.stringify(F,null,2));return}if(F.total===0){console.log(N.dim("No sandboxes found."));return}let E=Math.max(...F.sandboxes.map((A)=>A.name.length),4),C=Math.max(...F.sandboxes.map((A)=>A.host.length),4),B=(A,R=20)=>A.length>R?A.substring(0,R-3)+"...":A,$=Math.max(...F.sandboxes.map((A)=>B(A.ref).length),3);console.log(N.bold(`${"NAME".padEnd(E)} ${"HOST".padEnd(C)} ${"REF".padEnd($)} CREATED`));for(let A of F.sandboxes){let R=B(A.ref),x=new Date(A.createdAt).toLocaleDateString();console.log(`${N.cyan(A.name.padEnd(E))} ${A.host.padEnd(C)} ${N.yellow(R.padEnd($))} ${N.dim(x)}`)}console.log(N.dim(`
61
+ ${F.total} sandbox(es)`))}catch(F){if(u.json)console.log(JSON.stringify({ok:!1,error:F instanceof Error?F.message:String(F)},null,2));else console.error(N.red(`Error: ${F instanceof Error?F.message:String(F)}`));process.exit(1)}})}async function V3(D){let F=(await a()).sandboxes[D];if(!F)throw new G("SANDBOX_NOT_FOUND",`Sandbox "${D}" not found`);let E=await h(F.host),C=await HD(F.host),B={dir:!1,meta:!1,config:!1};try{await E.removeSandboxDir(F.path),B.dir=!0}catch{}try{await E.removeMeta(C,F.id),B.meta=!0}catch{}await e(($)=>{delete $.sandboxes[D]}),B.config=!0;try{let $=`${C}/mirrors/${F.repoId}.git`;await E.pruneWorktrees($)}catch{}return{entry:F,cleaned:B}}function CF(D){D.command("rm").description("Remove a sandbox").argument("<name>","Sandbox name").option("-y, --yes","Skip confirmation prompt").option("--json","Output as JSON").action(async(u,F)=>{try{if(!F.yes&&!F.json){if(!await AD({message:`Remove sandbox "${u}"?`,default:!1})){console.log(N.dim("Cancelled."));return}}let E=await V3(u);if(F.json){console.log(JSON.stringify(E,null,2));return}console.log(`Removed sandbox ${N.cyan(E.entry.name)}`);let C=[];if(!E.cleaned.dir)C.push("directory");if(!E.cleaned.meta)C.push("metadata");if(C.length>0)console.log(N.yellow(` Warning: could not clean ${C.join(", ")}`))}catch(E){if(E instanceof FD)console.log(N.dim(`
62
+ Cancelled.`)),process.exit(130);if(E instanceof G){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(N.red(`Error: ${E.message}`));process.exit(1)}throw E}})}function y8(D){let u=Date.now()-new Date(D).getTime(),F=Math.floor(u/1000);if(F<60)return`${F}s`;let E=Math.floor(F/60);if(E<60)return`${E}m`;let C=Math.floor(E/60);if(C<24)return`${C}h`;return`${Math.floor(C/24)}d`}async function f3(D){let u=await RD(D),F=await h(u.host),E=!1;try{E=await F.dirExists(u.path)}catch{}let C=null;try{let B=await F.listTmuxSessions(),$=`wt-${u.id}`,A=B.find((R)=>R.name===$);if(A)C=A.name}catch{}return{entry:u,dirExists:E,tmuxSession:C,age:y8(u.createdAt)}}function BF(D){D.command("status").description("Show sandbox status").argument("<name>","Sandbox name").option("--json","Output as JSON").action(async(u,F)=>{try{let E=await f3(u);if(F.json){console.log(JSON.stringify(E,null,2));return}let{entry:C,dirExists:B,tmuxSession:$,age:A}=E;console.log(N.bold(C.name)),console.log(` ${"ID".padEnd(10)} ${N.dim(C.id)}`),console.log(` ${"Host".padEnd(10)} ${C.host}`),console.log(` ${"Ref".padEnd(10)} ${N.yellow(C.ref.substring(0,8))}`),console.log(` ${"Origin".padEnd(10)} ${N.dim(C.origin)}`),console.log(` ${"Path".padEnd(10)} ${C.path}`),console.log(` ${"Age".padEnd(10)} ${A}`);let R=B?N.green("exists"):N.red("missing");console.log(` ${"Dir".padEnd(10)} ${R}`);let x=$?N.green($):N.dim("none");console.log(` ${"Tmux".padEnd(10)} ${x}`)}catch(E){if(E instanceof G){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(N.red(`Error: ${E.message}`));process.exit(1)}throw E}})}function $F(D){D.command("rename").description("Rename a sandbox").argument("<old>","Current sandbox name").argument("<new>","New sandbox name").option("--json","Output result as JSON").action(async(u,F,E)=>{try{let C=await Z3(u,F);if(E.json){console.log(JSON.stringify(C,null,2));return}console.log(N.green(`Renamed "${u}" -> "${F}"`))}catch(C){if(C instanceof G){if(E.json)console.log(JSON.stringify({ok:!1,error:C.message},null,2));else console.error(N.red(`Error: ${C.message}`));process.exit(1)}throw C}})}var i=new MF,y3="0.0.6";function P8(D,u=""){let F=[],E=D.name(),C=D.registeredArguments.map((A)=>A.required?`<${A.name()}>`:`[${A.name()}]`).join(" "),B=C?`${E} ${C}`:E;F.push(`${u}${B}`);let $=D.commands.filter((A)=>A.name()!=="help");return $.forEach((A,R)=>{let x=R===$.length-1,H=x?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",J=u+(x?" ":"\u2502 "),T=A.name(),_=A.registeredArguments.map((O)=>O.required?`<${O.name()}>`:`[${O.name()}]`).join(" "),X=_?`${T} ${_}`:T,j=A.commands.filter((O)=>O.name()!=="help");if(j.length>0)F.push(`${u}${H}${X}`),j.forEach((O,I)=>{let z=I===j.length-1?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",d=O.name(),DD=O.registeredArguments.map((lD)=>lD.required?`<${lD.name()}>`:`[${lD.name()}]`).join(" "),_D=DD?`${d} ${DD}`:d;F.push(`${J}${z}${_D}`)});else F.push(`${u}${H}${X}`)}),F}i.name("wt").enablePositionalOptions().description("Run worktrees, coding agents, and more all from the cloud. SSH included, agents too!").version(y3,"-v, --version").option("--tree","Show command tree").action((D)=>{if(D.tree){console.log(P8(i).join(`
63
63
  `));return}let u=`
64
64
  __
65
65
  /\\ \\__
@@ -68,6 +68,6 @@ Cancelled.`)),process.exit(130);if(E instanceof N){if(F.json)console.log(JSON.st
68
68
  \\ \\ \\_/ \\_/ \\\\ \\ \\_
69
69
  \\ \\_______/' \\ \\__\\
70
70
  \\/__//__/ \\/__/
71
- `;console.log(S.green(u)),console.log(S.cyan("Start worktrees in the cloud.")),console.log(S.white.bold.italic("wt --help"),S.gray.italic(`to get started.
72
- `)),console.log(S.dim(`v${ME} \u2022 https://github.com/abhi-arya1/wt
73
- `))});r0(i);o0(i);d0(i);c0(i);g0(i);i0(i);a0(i);l0(i);p0(i);e0(i);DF(i);uF(i);FF(i);function ZE(){i.parse(process.argv)}ZE();export{ZE as run,i as program};
71
+ `;console.log(N.green(u)),console.log(N.cyan("Start worktrees in the cloud.")),console.log(N.white.bold.italic("wt --help"),N.gray.italic(`to get started.
72
+ `)),console.log(N.dim(`v${y3} \u2022 https://github.com/abhi-arya1/wt
73
+ `))});t0(i);p0(i);i0(i);o0(i);a0(i);s0(i);DF(i);uF(i);FF(i);EF(i);CF(i);BF(i);$F(i);function P3(){i.parse(process.argv)}P3();export{P3 as run,i as program};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abhi-arya1/wt",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "Git worktree sandboxes, locally or on remote hosts over SSH.",
5
5
  "module": "index.ts",
6
6
  "type": "module",