@abhi-arya1/wt 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +2 -5
  2. package/dist/index.js +34 -33
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -28,14 +28,11 @@ wt
28
28
  ## Install
29
29
 
30
30
  ```bash
31
- # with any package manager
32
- npm install -g @abhi-arya1/wt
33
- pnpm add -g @abhi-arya1/wt
34
- yarn global add @abhi-arya1/wt
31
+ # with any package manager, but bun is recommended
35
32
  bun install -g @abhi-arya1/wt
36
33
  ```
37
34
 
38
- Requires [Node.js](https://nodejs.org) (v18+). You can also build a standalone binary with `bun build --compile` if you prefer — no runtime needed, but the binary will be larger.
35
+ Requires [Bun](https://bun.sh) (v1.3.3+). You can also build a standalone binary with `bun build --compile` if you prefer — no runtime needed, but the binary will be larger.
39
36
 
40
37
  ### From source
41
38
 
package/dist/index.js CHANGED
@@ -1,18 +1,19 @@
1
- #!/usr/bin/env node
2
- import{createRequire as PE}from"node:module";var QE=Object.create;var{getPrototypeOf:KE,defineProperty:DF,getOwnPropertyNames:WE}=Object;var yE=Object.prototype.hasOwnProperty;var ZD=(D,u,F)=>{F=D!=null?QE(KE(D)):{};let E=u||!D||!D.__esModule?DF(F,"default",{value:D,enumerable:!0}):F;for(let C of WE(D))if(!yE.call(E,C))DF(E,C,{get:()=>D[C],enumerable:!0});return E};var W=(D,u)=>()=>(u||D((u={exports:{}}).exports,u),u.exports);var s=PE(import.meta.url);var dD=W((VE)=>{class Vu 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 uF extends Vu{constructor(D){super(1,"commander.invalidArgument",D);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}VE.CommanderError=Vu;VE.InvalidArgumentError=uF});var Bu=W((vE)=>{var{InvalidArgumentError:rE}=dD();class FF{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 rE(`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 bE(D){let u=D.name()+(D.variadic===!0?"...":"");return D.required?"<"+u+">":"["+u+"]"}vE.Argument=FF;vE.humanReadableArgName=bE});var ku=W((gE)=>{var{humanReadableArgName:cE}=Bu();class EF{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)=>cE(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(t,H){return u.formatItem(t,F,H,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 x=u.visibleArguments(D).map((t)=>{return C(u.styleArgumentTerm(u.argumentTerm(t)),u.styleArgumentDescription(u.argumentDescription(t)))});if(B=B.concat(this.formatItemList("Arguments:",x,u)),this.groupItems(D.options,u.visibleOptions(D),(t)=>t.helpGroupHeading??"Options:").forEach((t,H)=>{let N=t.map((w)=>{return C(u.styleOptionTerm(u.optionTerm(w)),u.styleOptionDescription(u.optionDescription(w)))});B=B.concat(this.formatItemList(H,N,u))}),u.showGlobalOptions){let t=u.visibleGlobalOptions(D).map((H)=>{return C(u.styleOptionTerm(u.optionTerm(H)),u.styleOptionDescription(u.optionDescription(H)))});B=B.concat(this.formatItemList("Global Options:",t,u))}return this.groupItems(D.commands,u.visibleCommands(D),(t)=>t.helpGroup()||"Commands:").forEach((t,H)=>{let N=t.map((w)=>{return C(u.styleSubcommandTerm(u.subcommandTerm(w)),u.styleSubcommandDescription(u.subcommandDescription(w)))});B=B.concat(this.formatItemList(H,N,u))}),B.join(`
1
+ #!/usr/bin/env bun
2
+ // @bun
3
+ var LE=Object.create;var{getPrototypeOf:YE,defineProperty:DF,getOwnPropertyNames:QE}=Object;var KE=Object.prototype.hasOwnProperty;var vD=(D,u,F)=>{F=D!=null?LE(YE(D)):{};let E=u||!D||!D.__esModule?DF(F,"default",{value:D,enumerable:!0}):F;for(let C of QE(D))if(!KE.call(E,C))DF(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 dD=V((WE)=>{class Vu 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 uF extends Vu{constructor(D){super(1,"commander.invalidArgument",D);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}WE.CommanderError=Vu;WE.InvalidArgumentError=uF});var Bu=V((mE)=>{var{InvalidArgumentError:VE}=dD();class FF{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=FF;mE.humanReadableArgName=kE});var ku=V((dE)=>{var{humanReadableArgName:vE}=Bu();class EF{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(t,H){return u.formatItem(t,F,H,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 x=u.visibleArguments(D).map((t)=>{return C(u.styleArgumentTerm(u.argumentTerm(t)),u.styleArgumentDescription(u.argumentDescription(t)))});if(B=B.concat(this.formatItemList("Arguments:",x,u)),this.groupItems(D.options,u.visibleOptions(D),(t)=>t.helpGroupHeading??"Options:").forEach((t,H)=>{let N=t.map((w)=>{return C(u.styleOptionTerm(u.optionTerm(w)),u.styleOptionDescription(u.optionDescription(w)))});B=B.concat(this.formatItemList(H,N,u))}),u.showGlobalOptions){let t=u.visibleGlobalOptions(D).map((H)=>{return C(u.styleOptionTerm(u.optionTerm(H)),u.styleOptionDescription(u.optionDescription(H)))});B=B.concat(this.formatItemList("Global Options:",t,u))}return this.groupItems(D.commands,u.visibleCommands(D),(t)=>t.helpGroup()||"Commands:").forEach((t,H)=>{let N=t.map((w)=>{return C(u.styleSubcommandTerm(u.subcommandTerm(w)),u.styleSubcommandDescription(u.subcommandDescription(w)))});B=B.concat(this.formatItemList(H,N,u))}),B.join(`
3
4
  `)}displayWidth(D){return CF(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)),x=2,A=(this.helpWidth??80)-u-x-2,t;if(A<this.minWidthToWrap||E.preformatted(F))t=F;else t=E.boxWrap(F,A).replace(/\n/g,`
4
5
  `+" ".repeat(u+x));return B+$+" ".repeat(x)+t.replace(/\n/g,`
5
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 x=[$.shift()],S=this.displayWidth(x[0]);$.forEach((A)=>{let t=this.displayWidth(A);if(S+t<=u){x.push(A),S+=t;return}C.push(x.join(""));let H=A.trimStart();x=[H],S=this.displayWidth(H)}),C.push(x.join(""))}),C.join(`
6
- `)}}function CF(D){let u=/\x1b\[\d*(;\d*)*m/g;return D.replace(u,"")}gE.Help=EF;gE.stripColor=CF});var mu=W((pE)=>{var{InvalidArgumentError:aE}=dD();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=lE(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 aE(`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 BF(this.name().replace(/^no-/,""));return BF(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 xF{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 BF(D){return D.split("-").reduce((u,F)=>{return u+F[0].toUpperCase()+F.slice(1)})}function lE(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],x=`option creation failed due to '${$}' in option flags '${D}'`;if(/^-[^-][^-]/.test($))throw Error(`${x}
7
+ `)}}function CF(D){let u=/\x1b\[\d*(;\d*)*m/g;return D.replace(u,"")}dE.Help=EF;dE.stripColor=CF});var mu=V((sE)=>{var{InvalidArgumentError:gE}=dD();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=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 BF(this.name().replace(/^no-/,""));return BF(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 xF{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 BF(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 $=B[0],x=`option creation failed due to '${$}' in option flags '${D}'`;if(/^-[^-][^-]/.test($))throw Error(`${x}
7
8
  - a short flag is a single dash and a single character
8
9
  - either use a single dash and a single character (for a short flag)
9
10
  - or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(E.test($))throw Error(`${x}
10
11
  - too many short flags`);if(C.test($))throw Error(`${x}
11
12
  - too many long flags`);throw Error(`${x}
12
- - 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}}pE.Option=$F;pE.DualOptions=xF});var tF=W((EC)=>{function uC(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 FC(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 x=uC(D,$),S=Math.max(D.length,$.length);if((S-x)/S>B){if(x<C)C=x,E=[$];else if(x===C)E.push($)}}),E.sort(($,x)=>$.localeCompare(x)),F)E=E.map(($)=>`--${$}`);if(E.length>1)return`
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=$F;sE.DualOptions=xF});var tF=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(($)=>$.slice(2));let E=[],C=3,B=0.4;if(u.forEach(($)=>{if($.length<=1)return;let x=pE(D,$),S=Math.max(D.length,$.length);if((S-x)/S>B){if(x<C)C=x,E=[$];else if(x===C)E.push($)}}),E.sort(($,x)=>$.localeCompare(x)),F)E=E.map(($)=>`--${$}`);if(E.length>1)return`
13
14
  (Did you mean one of ${E.join(", ")}?)`;if(E.length===1)return`
14
- (Did you mean ${E[0]}?)`;return""}EC.suggestSimilar=FC});var RF=W((SC)=>{var BC=s("node:events").EventEmitter,ru=s("node:child_process"),xD=s("node:path"),$u=s("node:fs"),G=s("node:process"),{Argument:$C,humanReadableArgName:xC}=Bu(),{CommanderError:bu}=dD(),{Help:tC,stripColor:AC}=ku(),{Option:AF,DualOptions:HC}=mu(),{suggestSimilar:HF}=tF();class du extends BC{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:()=>vu()??(G.stdout.isTTY&&G.stdout.hasColors?.()),getErrHasColors:()=>vu()??(G.stderr.isTTY&&G.stderr.hasColors?.()),stripColor:(u)=>AC(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(/([^ ]+) *(.*)/),x=this.createCommand(B);if(E)x.description(E),x._executableHandler=!0;if(C.isDefault)this._defaultCommandName=x._name;if(x._hidden=!!(C.noHelp||C.hidden),x._executableFile=C.executableFile||null,$)x.arguments($);if(this._registerCommand(x),x.parent=this,x.copyInheritedSettings(this),E)return this;return x}createCommand(D){return new du(D)}createHelp(){return Object.assign(new tC,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
15
- - 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 $C(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}'.
15
+ (Did you mean ${E[0]}?)`;return""}DC.suggestSimilar=eE});var RF=V((tC)=>{var FC=s("events").EventEmitter,ru=s("child_process"),xD=s("path"),$u=s("fs"),G=s("process"),{Argument:EC,humanReadableArgName:CC}=Bu(),{CommanderError:bu}=dD(),{Help:BC,stripColor:$C}=ku(),{Option:AF,DualOptions:xC}=mu(),{suggestSimilar:HF}=tF();class du 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:()=>vu()??(G.stdout.isTTY&&G.stdout.hasColors?.()),getErrHasColors:()=>vu()??(G.stderr.isTTY&&G.stderr.hasColors?.()),stripColor:(u)=>$C(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(/([^ ]+) *(.*)/),x=this.createCommand(B);if(E)x.description(E),x._executableHandler=!0;if(C.isDefault)this._defaultCommandName=x._name;if(x._hidden=!!(C.noHelp||C.hidden),x._executableFile=C.executableFile||null,$)x.arguments($);if(this._registerCommand(x),x.parent=this,x.copyInheritedSettings(this),E)return this;return x}createCommand(D){return new du(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",$=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}'.
16
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 bu(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 AF(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}'
17
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 x=this.getOptionValue(F);if(C!==null&&D.parseArg)C=this._callParseArg(D,C,x,B);else if(C!==null&&D.variadic)C=D._collectValue(C,x);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 AF)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=(x,S)=>{let A=$.exec(x);return A?A[0]:S},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.
18
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($u.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
@@ -21,41 +22,41 @@ Expecting one of '${F.join("', '")}'`);if(this._lifeCycleHooks[D])this._lifeCycl
21
22
  - ${E}`;throw Error(C)}_executeSubCommand(D,u){u=u.slice();let F=!1,E=[".js",".ts",".tsx",".mjs",".cjs"];function C(A,t){let H=xD.resolve(A,t);if($u.existsSync(H))return H;if(E.includes(xD.extname(t)))return;let N=E.find((w)=>$u.existsSync(`${H}${w}`));if(N)return`${H}${N}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let B=D._executableFile||`${this._name}-${D._name}`,$=this._executableDir||"";if(this._scriptPath){let A;try{A=$u.realpathSync(this._scriptPath)}catch{A=this._scriptPath}$=xD.resolve(xD.dirname(A),$)}if($){let A=C($,B);if(!A&&!D._executableFile&&this._scriptPath){let t=xD.basename(this._scriptPath,xD.extname(this._scriptPath));if(t!==this._name)A=C($,`${t}-${D._name}`)}B=A||B}F=E.includes(xD.extname(B));let x;if(G.platform!=="win32")if(F)u.unshift(B),u=SF(G.execArgv).concat(u),x=ru.spawn(G.argv[0],u,{stdio:"inherit"});else x=ru.spawn(B,u,{stdio:"inherit"});else this._checkForMissingExecutable(B,$,D._name),u.unshift(B),u=SF(G.execArgv).concat(u),x=ru.spawn(G.execPath,u,{stdio:"inherit"});if(!x.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((t)=>{G.on(t,()=>{if(x.killed===!1&&x.exitCode===null)x.kill(t)})});let S=this._exitCallback;x.on("close",(A)=>{if(A=A??1,!S)G.exit(A);else S(new bu(A,"commander.executeSubCommandAsync","(close)"))}),x.on("error",(A)=>{if(A.code==="ENOENT")this._checkForMissingExecutable(B,$,D._name);else if(A.code==="EACCES")throw Error(`'${B}' not executable`);if(!S)G.exit(1);else{let t=new bu(1,"commander.executeSubCommandAsync","(error)");t.nestedError=A,S(t)}}),this.runningCommand=x}_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(A){return A.length>1&&A[0]==="-"}let B=(A)=>{if(!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(A))return!1;return!this._getCommandAndAncestors().some((t)=>t.options.map((H)=>H.short).some((H)=>/^-\d$/.test(H)))},$=null,x=null,S=0;while(S<D.length||x){let A=x??D[S++];if(x=null,A==="--"){if(E===F)E.push(A);E.push(...D.slice(S));break}if($&&(!C(A)||B(A))){this.emit(`option:${$.name()}`,A);continue}if($=null,C(A)){let t=this._findOption(A);if(t){if(t.required){let H=D[S++];if(H===void 0)this.optionMissingArgument(t);this.emit(`option:${t.name()}`,H)}else if(t.optional){let H=null;if(S<D.length&&(!C(D[S])||B(D[S])))H=D[S++];this.emit(`option:${t.name()}`,H)}else this.emit(`option:${t.name()}`);$=t.variadic?t:null;continue}}if(A.length>2&&A[0]==="-"&&A[1]!=="-"){let t=this._findOption(`-${A[1]}`);if(t){if(t.required||t.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${t.name()}`,A.slice(2));else this.emit(`option:${t.name()}`),x=`-${A.slice(2)}`;continue}}if(/^--[^=]+=/.test(A)){let t=A.indexOf("="),H=this._findOption(A.slice(0,t));if(H&&(H.required||H.optional)){this.emit(`option:${H.name()}`,A.slice(t+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(S));break}else if(this._getHelpCommand()&&A===this._getHelpCommand().name()){u.push(A,...D.slice(S));break}else if(this._defaultCommandName){F.push(A,...D.slice(S));break}}if(this._passThroughOptions){E.push(A,...D.slice(S));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
23
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==="string")this._outputConfiguration.writeErr(`${this._showHelpAfterError}
23
24
  `);else if(this._showHelpAfterError)this._outputConfiguration.writeErr(`
24
- `),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 HC(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(),x=this.getOptionValue($),S=this.options.find((t)=>t.negate&&$===t.attributeName()),A=this.options.find((t)=>!t.negate&&$===t.attributeName());if(S&&(S.presetArg===void 0&&x===!1||S.presetArg!==void 0&&x===S.presetArg))return S;return A||B},E=(B)=>{let $=F(B),x=$.attributeName();if(this.getOptionValueSource(x)==="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=HF(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=HF(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}
25
- `),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 xC(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(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 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 xC(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(),x=this.getOptionValue($),S=this.options.find((t)=>t.negate&&$===t.attributeName()),A=this.options.find((t)=>!t.negate&&$===t.attributeName());if(S&&(S.presetArg===void 0&&x===!1||S.presetArg!==void 0&&x===S.presetArg))return S;return A||B},E=(B)=>{let $=F(B),x=$.attributeName();if(this.getOptionValueSource(x)==="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=HF(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=HF(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=($)=>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(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.
26
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}
27
- `)}),this}_outputHelpIfRequested(D){let u=this._getHelpOption();if(u&&D.find((E)=>u.is(E)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function SF(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 vu(){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}SC.Command=du;SC.useColor=vu});var OF=W((OC)=>{var{Argument:wF}=Bu(),{Command:ou}=RF(),{CommanderError:NC,InvalidArgumentError:NF}=dD(),{Help:hC}=ku(),{Option:hF}=mu();OC.program=new ou;OC.createCommand=(D)=>new ou(D);OC.createOption=(D,u)=>new hF(D,u);OC.createArgument=(D,u)=>new wF(D,u);OC.Command=ou;OC.Option=hF;OC.Argument=wF;OC.Help=hC;OC.CommanderError=NC;OC.InvalidArgumentError=NF;OC.InvalidOptionArgumentError=NF});var rF=W((m6,mF)=>{mF.exports=D3;function eC(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 D3(D){let u=eC(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 gF=W((i6,cF)=>{cF.exports=()=>{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 x2=W((t1,$2)=>{var N3=s("stream");class B2 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=B2});var T2=W((s1,n2)=>{var RD=s("constants"),q3=process.cwd,Nu=null,G3=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){if(!Nu)Nu=q3.call(process);return Nu};try{process.cwd()}catch(D){}if(typeof process.chdir==="function"){if(hu=process.chdir,process.chdir=function(D){Nu=null,hu.call(process,D)},Object.setPrototypeOf)Object.setPrototypeOf(process.chdir,hu)}var hu;n2.exports=j3;function j3(D){if(RD.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=x(D.stat),D.fstat=x(D.fstat),D.lstat=x(D.lstat),D.statSync=S(D.statSync),D.fstatSync=S(D.fstatSync),D.lstatSync=S(D.lstatSync),D.chmod&&!D.lchmod)D.lchmod=function(t,H,N){if(N)process.nextTick(N)},D.lchmodSync=function(){};if(D.chown&&!D.lchown)D.lchown=function(t,H,N,w){if(w)process.nextTick(w)},D.lchownSync=function(){};if(G3==="win32")D.rename=typeof D.rename!=="function"?D.rename:function(t){function H(N,w,h){var O=Date.now(),f=0;t(N,w,function I(J){if(J&&(J.code==="EACCES"||J.code==="EPERM"||J.code==="EBUSY")&&Date.now()-O<60000){if(setTimeout(function(){D.stat(w,function(T,b){if(T&&T.code==="ENOENT")t(N,w,I);else h(J)})},f),f<100)f+=10;return}if(h)h(J)})}if(Object.setPrototypeOf)Object.setPrototypeOf(H,t);return H}(D.rename);D.read=typeof D.read!=="function"?D.read:function(t){function H(N,w,h,O,f,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++,t.call(D,N,w,h,O,f,J);I.apply(this,arguments)}}return t.call(D,N,w,h,O,f,J)}if(Object.setPrototypeOf)Object.setPrototypeOf(H,t);return H}(D.read),D.readSync=typeof D.readSync!=="function"?D.readSync:function(t){return function(H,N,w,h,O){var f=0;while(!0)try{return t.call(D,H,N,w,h,O)}catch(I){if(I.code==="EAGAIN"&&f<10){f++;continue}throw I}}}(D.readSync);function u(t){t.lchmod=function(H,N,w){t.open(H,RD.O_WRONLY|RD.O_SYMLINK,N,function(h,O){if(h){if(w)w(h);return}t.fchmod(O,N,function(f){t.close(O,function(I){if(w)w(f||I)})})})},t.lchmodSync=function(H,N){var w=t.openSync(H,RD.O_WRONLY|RD.O_SYMLINK,N),h=!0,O;try{O=t.fchmodSync(w,N),h=!1}finally{if(h)try{t.closeSync(w)}catch(f){}else t.closeSync(w)}return O}}function F(t){if(RD.hasOwnProperty("O_SYMLINK")&&t.futimes)t.lutimes=function(H,N,w,h){t.open(H,RD.O_SYMLINK,function(O,f){if(O){if(h)h(O);return}t.futimes(f,N,w,function(I){t.close(f,function(J){if(h)h(I||J)})})})},t.lutimesSync=function(H,N,w){var h=t.openSync(H,RD.O_SYMLINK),O,f=!0;try{O=t.futimesSync(h,N,w),f=!1}finally{if(f)try{t.closeSync(h)}catch(I){}else t.closeSync(h)}return O};else if(t.futimes)t.lutimes=function(H,N,w,h){if(h)process.nextTick(h)},t.lutimesSync=function(){}}function E(t){if(!t)return t;return function(H,N,w){return t.call(D,H,N,function(h){if(A(h))h=null;if(w)w.apply(this,arguments)})}}function C(t){if(!t)return t;return function(H,N){try{return t.call(D,H,N)}catch(w){if(!A(w))throw w}}}function B(t){if(!t)return t;return function(H,N,w,h){return t.call(D,H,N,w,function(O){if(A(O))O=null;if(h)h.apply(this,arguments)})}}function $(t){if(!t)return t;return function(H,N,w){try{return t.call(D,H,N,w)}catch(h){if(!A(h))throw h}}}function x(t){if(!t)return t;return function(H,N,w){if(typeof N==="function")w=N,N=null;function h(O,f){if(f){if(f.uid<0)f.uid+=4294967296;if(f.gid<0)f.gid+=4294967296}if(w)w.apply(this,arguments)}return N?t.call(D,H,N,h):t.call(D,H,h)}}function S(t){if(!t)return t;return function(H,N){var w=N?t.call(D,H,N):t.call(D,H);if(w){if(w.uid<0)w.uid+=4294967296;if(w.gid<0)w.gid+=4294967296}return w}}function A(t){if(!t)return!0;if(t.code==="ENOSYS")return!0;var H=!process.getuid||process.getuid()!==0;if(H){if(t.code==="EINVAL"||t.code==="EPERM")return!0}return!1}}});var q2=W((a1,J2)=>{var I2=s("stream").Stream;J2.exports=X3;function X3(D){return{ReadStream:u,WriteStream:F};function u(E,C){if(!(this instanceof u))return new u(E,C);I2.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 x=0,S=$.length;x<S;x++){var A=$[x];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(t,H){if(t){B.emit("error",t),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);I2.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,x=B.length;$<x;$++){var S=B[$];this[S]=C[S]}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 j2=W((l1,G2)=>{G2.exports=M3;var z3=Object.getPrototypeOf||function(D){return D.__proto__};function M3(D){if(D===null||typeof D!=="object")return D;if(D instanceof Object)var u={__proto__:z3(D)};else var u=Object.create(null);return Object.getOwnPropertyNames(D).forEach(function(F){Object.defineProperty(u,F,Object.getOwnPropertyDescriptor(D,F))}),u}});var I0=W((p1,T0)=>{var y=s("fs"),U3=T2(),Z3=q2(),L3=j2(),Ou=s("util"),c,fu;if(typeof Symbol==="function"&&typeof Symbol.for==="function")c=Symbol.for("graceful-fs.queue"),fu=Symbol.for("graceful-fs.previous");else c="___graceful-fs.queue",fu="___graceful-fs.previous";function Y3(){}function z2(D,u){Object.defineProperty(D,c,{get:function(){return u}})}var JD=Y3;if(Ou.debuglog)JD=Ou.debuglog("gfs4");else if(/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))JD=function(){var D=Ou.format.apply(Ou,arguments);D="GFS4: "+D.split(/\n/).join(`
28
- GFS4: `),console.error(D)};if(!y[c]){if(_0=global[c]||[],z2(y,_0),y.close=function(D){function u(F,E){return D.call(y,F,function(C){if(!C)X2();if(typeof E==="function")E.apply(this,arguments)})}return Object.defineProperty(u,fu,{value:D}),u}(y.close),y.closeSync=function(D){function u(F){D.apply(y,arguments),X2()}return Object.defineProperty(u,fu,{value:D}),u}(y.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){JD(y[c]),s("assert").equal(y[c].length,0)})}var _0;if(!global[c])z2(global,y[c]);T0.exports=f0(L3(y));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!y.__patched)T0.exports=f0(y),y.__patched=!0;function f0(D){U3(D),D.gracefulify=f0,D.createReadStream=e,D.createWriteStream=SD;var u=D.readFile;D.readFile=F;function F(n,j,q){if(typeof j==="function")q=j,j=null;return v(n,j,q);function v(d,r,K,V){return u(d,r,function(X){if(X&&(X.code==="EMFILE"||X.code==="ENFILE"))KD([v,[d,r,K],X,V||Date.now(),Date.now()]);else if(typeof K==="function")K.apply(this,arguments)})}}var E=D.writeFile;D.writeFile=C;function C(n,j,q,v){if(typeof q==="function")v=q,q=null;return d(n,j,q,v);function d(r,K,V,X,o){return E(r,K,V,function(U){if(U&&(U.code==="EMFILE"||U.code==="ENFILE"))KD([d,[r,K,V,X],U,o||Date.now(),Date.now()]);else if(typeof X==="function")X.apply(this,arguments)})}}var B=D.appendFile;if(B)D.appendFile=$;function $(n,j,q,v){if(typeof q==="function")v=q,q=null;return d(n,j,q,v);function d(r,K,V,X,o){return B(r,K,V,function(U){if(U&&(U.code==="EMFILE"||U.code==="ENFILE"))KD([d,[r,K,V,X],U,o||Date.now(),Date.now()]);else if(typeof X==="function")X.apply(this,arguments)})}}var x=D.copyFile;if(x)D.copyFile=S;function S(n,j,q,v){if(typeof q==="function")v=q,q=0;return d(n,j,q,v);function d(r,K,V,X,o){return x(r,K,V,function(U){if(U&&(U.code==="EMFILE"||U.code==="ENFILE"))KD([d,[r,K,V,X],U,o||Date.now(),Date.now()]);else if(typeof X==="function")X.apply(this,arguments)})}}var A=D.readdir;D.readdir=H;var t=/^v[0-5]\./;function H(n,j,q){if(typeof j==="function")q=j,j=null;var v=t.test(process.version)?function(K,V,X,o){return A(K,d(K,V,X,o))}:function(K,V,X,o){return A(K,V,d(K,V,X,o))};return v(n,j,q);function d(r,K,V,X){return function(o,U){if(o&&(o.code==="EMFILE"||o.code==="ENFILE"))KD([v,[r,K,V],o,X||Date.now(),Date.now()]);else{if(U&&U.sort)U.sort();if(typeof V==="function")V.call(this,o,U)}}}}if(process.version.substr(0,4)==="v0.8"){var N=Z3(D);I=N.ReadStream,T=N.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(n){I=n},enumerable:!0,configurable:!0}),Object.defineProperty(D,"WriteStream",{get:function(){return T},set:function(n){T=n},enumerable:!0,configurable:!0});var O=I;Object.defineProperty(D,"FileReadStream",{get:function(){return O},set:function(n){O=n},enumerable:!0,configurable:!0});var f=T;Object.defineProperty(D,"FileWriteStream",{get:function(){return f},set:function(n){f=n},enumerable:!0,configurable:!0});function I(n,j){if(this instanceof I)return w.apply(this,arguments),this;else return I.apply(Object.create(I.prototype),arguments)}function J(){var n=this;Pu(n.path,n.flags,n.mode,function(j,q){if(j){if(n.autoClose)n.destroy();n.emit("error",j)}else n.fd=q,n.emit("open",q),n.read()})}function T(n,j){if(this instanceof T)return h.apply(this,arguments),this;else return T.apply(Object.create(T.prototype),arguments)}function b(){var n=this;Pu(n.path,n.flags,n.mode,function(j,q){if(j)n.destroy(),n.emit("error",j);else n.fd=q,n.emit("open",q)})}function e(n,j){return new D.ReadStream(n,j)}function SD(n,j){return new D.WriteStream(n,j)}var vD=D.open;D.open=Pu;function Pu(n,j,q,v){if(typeof q==="function")v=q,q=null;return d(n,j,q,v);function d(r,K,V,X,o){return vD(r,K,V,function(U,Y8){if(U&&(U.code==="EMFILE"||U.code==="ENFILE"))KD([d,[r,K,V,X],U,o||Date.now(),Date.now()]);else if(typeof X==="function")X.apply(this,arguments)})}}return D}function KD(D){JD("ENQUEUE",D[0].name,D[1]),y[c].push(D),n0()}var _u;function X2(){var D=Date.now();for(var u=0;u<y[c].length;++u)if(y[c][u].length>2)y[c][u][3]=D,y[c][u][4]=D;n0()}function n0(){if(clearTimeout(_u),_u=void 0,y[c].length===0)return;var D=y[c].shift(),u=D[0],F=D[1],E=D[2],C=D[3],B=D[4];if(C===void 0)JD("RETRY",u.name,F),u.apply(null,F);else if(Date.now()-C>=60000){JD("TIMEOUT",u.name,F);var $=F.pop();if(typeof $==="function")$.call(null,E)}else{var x=Date.now()-B,S=Math.max(B-C,1),A=Math.min(S*1.2,100);if(x>=A)JD("RETRY",u.name,F),u.apply(null,F.concat([C]));else y[c].push(D)}if(_u===void 0)_u=setTimeout(n0,0)}});var U2=W((e1,M2)=>{function uD(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=uD;uD.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};uD.prototype.stop=function(){if(this._timeout)clearTimeout(this._timeout);this._timeouts=[],this._cachedTimeouts=null};uD.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};uD.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)};uD.prototype.try=function(D){console.log("Using RetryOperation.try() is deprecated"),this.attempt(D)};uD.prototype.start=function(D){console.log("Using RetryOperation.start() is deprecated"),this.attempt(D)};uD.prototype.start=uD.prototype.try;uD.prototype.errors=function(){return this._errors};uD.prototype.attempts=function(){return this._attempts};uD.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 L2=W((K3)=>{var Q3=U2();K3.operation=function(D){var u=K3.timeouts(D);return new Q3(u,{forever:D&&D.forever,unref:D&&D.unref,maxRetryTime:D&&D.maxRetryTime})};K3.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};K3.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};K3.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(S){var A=K3.operation(u),t=Array.prototype.slice.call(arguments,1),H=t.pop();t.push(function(N){if(A.retry(N))return;if(N)arguments[0]=A.mainError();H.apply(this,arguments)}),A.attempt(function(){S.apply(D,t)})}.bind(D,$),D[B].options=u}}});var Y2=W((uB,nu)=>{nu.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];if(process.platform!=="win32")nu.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")nu.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var Q2=W((FB,yD)=>{var Q=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(Q))yD.exports=function(){return function(){}};else{if(J0=s("assert"),GD=Y2(),q0=/^win/i.test(Q.platform),WD=s("events"),typeof WD!=="function")WD=WD.EventEmitter;if(Q.__signal_exit_emitter__)m=Q.__signal_exit_emitter__;else m=Q.__signal_exit_emitter__=new WD,m.count=0,m.emitted={};if(!m.infinite)m.setMaxListeners(1/0),m.infinite=!0;yD.exports=function(D,u){if(!qD(global.process))return function(){};if(J0.equal(typeof D,"function","a callback must be provided for exit handler"),jD===!1)Tu();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)Du()};return m.on(F,D),E},Du=function(){if(!jD||!qD(global.process))return;jD=!1,GD.forEach(function(u){try{Q.removeListener(u,uu[u])}catch(F){}}),Q.emit=Fu,Q.reallyExit=Iu,m.count-=1},yD.exports.unload=Du,wD=function(u,F,E){if(m.emitted[u])return;m.emitted[u]=!0,m.emit(u,F,E)},uu={},GD.forEach(function(D){uu[D]=function(){if(!qD(global.process))return;var F=Q.listeners(D);if(F.length===m.count){if(Du(),wD("exit",null,D),wD("afterexit",null,D),q0&&D==="SIGHUP")D="SIGINT";Q.kill(Q.pid,D)}}}),yD.exports.signals=function(){return GD},jD=!1,Tu=function(){if(jD||!qD(global.process))return;jD=!0,m.count+=1,GD=GD.filter(function(u){try{return Q.on(u,uu[u]),!0}catch(F){return!1}}),Q.emit=j0,Q.reallyExit=G0},yD.exports.load=Tu,Iu=Q.reallyExit,G0=function(u){if(!qD(global.process))return;Q.exitCode=u||0,wD("exit",Q.exitCode,null),wD("afterexit",Q.exitCode,null),Iu.call(Q,Q.exitCode)},Fu=Q.emit,j0=function(u,F){if(u==="exit"&&qD(global.process)){if(F!==void 0)Q.exitCode=F;var E=Fu.apply(this,arguments);return wD("exit",Q.exitCode,null),wD("afterexit",Q.exitCode,null),E}else return Fu.apply(this,arguments)}}var J0,GD,q0,WD,m,Du,wD,uu,jD,Tu,Iu,G0,Fu,j0});var W2=W((m3,X0)=>{var K2=Symbol();function V3(D,u,F){let E=u[K2];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,($,x)=>{if($)return F($);let S=x.mtime.getTime()%1000===0?"s":"ms";Object.defineProperty(u,K2,{value:S}),F(null,x.mtime,S)})})}function k3(D){let u=Date.now();if(D==="s")u=Math.ceil(u/1000)*1000;return new Date(u)}m3.probe=V3;m3.getMtime=k3});var m2=W((s3,Cu)=>{var v3=s("path"),U0=I0(),d3=L2(),o3=Q2(),y2=W2(),tD={};function Eu(D,u){return u.lockfilePath||`${D}.lock`}function Z0(D,u,F){if(!u.realpath)return F(null,v3.resolve(D));u.fs.realpath(D,F)}function M0(D,u,F){let E=Eu(D,u);u.fs.mkdir(E,(C)=>{if(!C)return y2.probe(E,u.fs,(B,$,x)=>{if(B)return u.fs.rmdir(E,()=>{}),F(B);F(null,$,x)});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 M0(D,{...u,stale:0},F);return F(B)}if(!P2($,u))return F(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));V2(D,u,(x)=>{if(x)return F(x);M0(D,{...u,stale:0},F)})})})}function P2(D,u){return D.mtime.getTime()<Date.now()-u.stale}function V2(D,u,F){u.fs.rmdir(Eu(D,u),(E)=>{if(E&&E.code!=="ENOENT")return F(E);F()})}function Ju(D,u){let F=tD[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,Ju(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 x=y2.getMtime(F.mtimePrecision);u.fs.utimes(F.lockfilePath,x,x,(S)=>{let A=F.lastUpdate+u.stale<Date.now();if(F.released)return;if(S){if(S.code==="ENOENT"||A)return z0(D,F,Object.assign(S,{code:"ECOMPROMISED"}));return F.updateDelay=1000,Ju(D,u)}F.mtime=x,F.lastUpdate=Date.now(),F.updateDelay=null,Ju(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(tD[D]===u)delete tD[D];u.options.onCompromised(F)}function c3(D,u,F){u={stale:1e4,update:null,realpath:!0,retries:0,fs:U0,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),Z0(D,u,(E,C)=>{if(E)return F(E);let B=d3.operation(u.retries);B.attempt(()=>{M0(C,u,($,x,S)=>{if(B.retry($))return;if($)return F(B.mainError());let A=tD[C]={lockfilePath:Eu(C,u),mtime:x,mtimePrecision:S,options:u,lastUpdate:Date.now()};Ju(C,u),F(null,(t)=>{if(A.released)return t&&t(Object.assign(Error("Lock is already released"),{code:"ERELEASED"}));k2(C,{...u,realpath:!1},t)})})})})}function k2(D,u,F){u={fs:U0,realpath:!0,...u},Z0(D,u,(E,C)=>{if(E)return F(E);let B=tD[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 tD[C],V2(C,u,F)})}function g3(D,u,F){u={stale:1e4,realpath:!0,fs:U0,...u},u.stale=Math.max(u.stale||0,2000),Z0(D,u,(E,C)=>{if(E)return F(E);u.fs.stat(Eu(C,u),(B,$)=>{if(B)return B.code==="ENOENT"?F(null,!1):F(B);return F(null,!P2($,u))})})}function i3(){return tD}o3(()=>{for(let D in tD){let u=tD[D].options;try{u.fs.rmdirSync(Eu(D,u))}catch(F){}}});s3.lock=c3;s3.unlock=k2;s3.check=g3;s3.getLocks=i3});var b2=W((EB,r2)=>{var D8=I0();function u8(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(x){return B(x)}B(null,$)}}),F}function F8(D){return(...u)=>new Promise((F,E)=>{u.push((C,B)=>{if(C)E(C);else F(B)}),D(...u)})}function E8(D){return(...u)=>{let F,E;if(u.push((C,B)=>{F=C,E=B}),D(...u),F)throw F;return E}}function C8(D){if(D={...D},D.fs=u8(D.fs||D8),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}r2.exports={toPromise:F8,toSync:E8,toSyncOptions:C8}});var d2=W((CB,ND)=>{var PD=m2(),{toPromise:qu,toSync:Gu,toSyncOptions:L0}=b2();async function v2(D,u){let F=await qu(PD.lock)(D,u);return qu(F)}function B8(D,u){let F=Gu(PD.lock)(D,L0(u));return Gu(F)}function $8(D,u){return qu(PD.unlock)(D,u)}function x8(D,u){return Gu(PD.unlock)(D,L0(u))}function t8(D,u){return qu(PD.check)(D,u)}function A8(D,u){return Gu(PD.check)(D,L0(u))}ND.exports=v2;ND.exports.lock=v2;ND.exports.unlock=$8;ND.exports.lockSync=B8;ND.exports.unlockSync=x8;ND.exports.check=t8;ND.exports.checkSync=A8});var GE=W((S$,qE)=>{var mD=1000,rD=mD*60,bD=rD*60,UD=bD*24,q8=UD*7,G8=UD*365.25;qE.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?z8(D):X8(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*G8;case"weeks":case"week":case"w":return F*q8;case"days":case"day":case"d":return F*UD;case"hours":case"hour":case"hrs":case"hr":case"h":return F*bD;case"minutes":case"minute":case"mins":case"min":case"m":return F*rD;case"seconds":case"second":case"secs":case"sec":case"s":return F*mD;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return F;default:return}}function X8(D){var u=Math.abs(D);if(u>=UD)return Math.round(D/UD)+"d";if(u>=bD)return Math.round(D/bD)+"h";if(u>=rD)return Math.round(D/rD)+"m";if(u>=mD)return Math.round(D/mD)+"s";return D+"ms"}function z8(D){var u=Math.abs(D);if(u>=UD)return yu(D,u,UD,"day");if(u>=bD)return yu(D,u,bD,"hour");if(u>=rD)return yu(D,u,rD,"minute");if(u>=mD)return yu(D,u,mD,"second");return D+" ms"}function yu(D,u,F,E){var C=u>=F*1.5;return Math.round(D/F)+" "+E+(C?"s":"")}});var _F=ZD(OF(),1),{program:b8,createCommand:v8,createArgument:d8,createOption:o8,CommanderError:c8,InvalidArgumentError:g8,InvalidOptionArgumentError:i8,Command:fF,Argument:s8,Option:a8,Help:l8}=_F.default;var nF=(D=0)=>(u)=>`\x1B[${u+D}m`,TF=(D=0)=>(u)=>`\x1B[${38+D};5;${u}m`,IF=(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]}},e8=Object.keys(Z.modifier),MC=Object.keys(Z.color),UC=Object.keys(Z.bgColor),D6=[...MC,...UC];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=nF(),Z.color.ansi256=TF(),Z.color.ansi16m=IF(),Z.bgColor.ansi=nF(10),Z.bgColor.ansi256=TF(10),Z.bgColor.ansi16m=IF(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 x=u%36;F=Math.floor(u/36)/5,E=Math.floor(x/6)/5,C=x%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)=>Z.ansi256ToAnsi(Z.rgbToAnsi256(u,F,E)),enumerable:!1},hexToAnsi:{value:(u)=>Z.ansi256ToAnsi(Z.hexToAnsi256(u)),enumerable:!1}}),Z}var LC=ZC(),FD=LC;import cu from"node:process";import YC from"node:os";import JF from"node:tty";function DD(D,u=globalThis.Deno?globalThis.Deno.args:cu.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}=cu,xu;if(DD("no-color")||DD("no-colors")||DD("color=false")||DD("color=never"))xu=0;else if(DD("color")||DD("colors")||DD("color=true")||DD("color=always"))xu=1;function QC(){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 KC(D){if(D===0)return!1;return{level:D,hasBasic:!0,has256:D>=2,has16m:D>=3}}function WC(D,{streamIsTTY:u,sniffFlags:F=!0}={}){let E=QC();if(E!==void 0)xu=E;let C=F?xu: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(cu.platform==="win32"){let $=YC.release().split(".");if(Number($[0])>=10&&Number($[2])>=10586)return Number($[2])>=14931?3:2;return 1}if("CI"in L){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(($)=>($ in L)))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(($)=>($ 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 $=Number.parseInt((L.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(L.TERM_PROGRAM){case"iTerm.app":return $>=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 qF(D,u={}){let F=WC(D,{streamIsTTY:D&&D.isTTY,...u});return KC(F)}var yC={stdout:qF({isTTY:JF.isatty(1)}),stderr:qF({isTTY:JF.isatty(2)})},GF=yC;function jF(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 XF(D,u,F,E){let C=0,B="";do{let $=D[E-1]==="\r";B+=D.slice(C,$?E-1:E)+u+($?`\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 SF(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 vu(){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}tC.Command=du;tC.useColor=vu});var OF=V((wC)=>{var{Argument:wF}=Bu(),{Command:ou}=RF(),{CommanderError:SC,InvalidArgumentError:NF}=dD(),{Help:RC}=ku(),{Option:hF}=mu();wC.program=new ou;wC.createCommand=(D)=>new ou(D);wC.createOption=(D,u)=>new hF(D,u);wC.createArgument=(D,u)=>new wF(D,u);wC.Command=ou;wC.Option=hF;wC.Argument=wF;wC.Help=RC;wC.CommanderError=SC;wC.InvalidArgumentError=NF;wC.InvalidOptionArgumentError=NF});var rF=V((y6,mF)=>{mF.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 B2=V((B1,C2)=>{var S3=s("stream");class E2 extends S3{#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)}}C2.exports=E2});var _2=V((c1,f2)=>{var RD=s("constants"),T3=process.cwd,Nu=null,I3=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){if(!Nu)Nu=T3.call(process);return Nu};try{process.cwd()}catch(D){}if(typeof process.chdir==="function"){if(hu=process.chdir,process.chdir=function(D){Nu=null,hu.call(process,D)},Object.setPrototypeOf)Object.setPrototypeOf(process.chdir,hu)}var hu;f2.exports=J3;function J3(D){if(RD.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=x(D.stat),D.fstat=x(D.fstat),D.lstat=x(D.lstat),D.statSync=S(D.statSync),D.fstatSync=S(D.fstatSync),D.lstatSync=S(D.lstatSync),D.chmod&&!D.lchmod)D.lchmod=function(t,H,N){if(N)process.nextTick(N)},D.lchmodSync=function(){};if(D.chown&&!D.lchown)D.lchown=function(t,H,N,w){if(w)process.nextTick(w)},D.lchownSync=function(){};if(I3==="win32")D.rename=typeof D.rename!=="function"?D.rename:function(t){function H(N,w,h){var O=Date.now(),_=0;t(N,w,function I(J){if(J&&(J.code==="EACCES"||J.code==="EPERM"||J.code==="EBUSY")&&Date.now()-O<60000){if(setTimeout(function(){D.stat(w,function(T,b){if(T&&T.code==="ENOENT")t(N,w,I);else h(J)})},_),_<100)_+=10;return}if(h)h(J)})}if(Object.setPrototypeOf)Object.setPrototypeOf(H,t);return H}(D.rename);D.read=typeof D.read!=="function"?D.read:function(t){function H(N,w,h,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++,t.call(D,N,w,h,O,_,J);I.apply(this,arguments)}}return t.call(D,N,w,h,O,_,J)}if(Object.setPrototypeOf)Object.setPrototypeOf(H,t);return H}(D.read),D.readSync=typeof D.readSync!=="function"?D.readSync:function(t){return function(H,N,w,h,O){var _=0;while(!0)try{return t.call(D,H,N,w,h,O)}catch(I){if(I.code==="EAGAIN"&&_<10){_++;continue}throw I}}}(D.readSync);function u(t){t.lchmod=function(H,N,w){t.open(H,RD.O_WRONLY|RD.O_SYMLINK,N,function(h,O){if(h){if(w)w(h);return}t.fchmod(O,N,function(_){t.close(O,function(I){if(w)w(_||I)})})})},t.lchmodSync=function(H,N){var w=t.openSync(H,RD.O_WRONLY|RD.O_SYMLINK,N),h=!0,O;try{O=t.fchmodSync(w,N),h=!1}finally{if(h)try{t.closeSync(w)}catch(_){}else t.closeSync(w)}return O}}function F(t){if(RD.hasOwnProperty("O_SYMLINK")&&t.futimes)t.lutimes=function(H,N,w,h){t.open(H,RD.O_SYMLINK,function(O,_){if(O){if(h)h(O);return}t.futimes(_,N,w,function(I){t.close(_,function(J){if(h)h(I||J)})})})},t.lutimesSync=function(H,N,w){var h=t.openSync(H,RD.O_SYMLINK),O,_=!0;try{O=t.futimesSync(h,N,w),_=!1}finally{if(_)try{t.closeSync(h)}catch(I){}else t.closeSync(h)}return O};else if(t.futimes)t.lutimes=function(H,N,w,h){if(h)process.nextTick(h)},t.lutimesSync=function(){}}function E(t){if(!t)return t;return function(H,N,w){return t.call(D,H,N,function(h){if(A(h))h=null;if(w)w.apply(this,arguments)})}}function C(t){if(!t)return t;return function(H,N){try{return t.call(D,H,N)}catch(w){if(!A(w))throw w}}}function B(t){if(!t)return t;return function(H,N,w,h){return t.call(D,H,N,w,function(O){if(A(O))O=null;if(h)h.apply(this,arguments)})}}function $(t){if(!t)return t;return function(H,N,w){try{return t.call(D,H,N,w)}catch(h){if(!A(h))throw h}}}function x(t){if(!t)return t;return function(H,N,w){if(typeof N==="function")w=N,N=null;function h(O,_){if(_){if(_.uid<0)_.uid+=4294967296;if(_.gid<0)_.gid+=4294967296}if(w)w.apply(this,arguments)}return N?t.call(D,H,N,h):t.call(D,H,h)}}function S(t){if(!t)return t;return function(H,N){var w=N?t.call(D,H,N):t.call(D,H);if(w){if(w.uid<0)w.uid+=4294967296;if(w.gid<0)w.gid+=4294967296}return w}}function A(t){if(!t)return!0;if(t.code==="ENOSYS")return!0;var H=!process.getuid||process.getuid()!==0;if(H){if(t.code==="EINVAL"||t.code==="EPERM")return!0}return!1}}});var I2=V((g1,T2)=>{var n2=s("stream").Stream;T2.exports=q3;function q3(D){return{ReadStream:u,WriteStream:F};function u(E,C){if(!(this instanceof u))return new u(E,C);n2.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 x=0,S=$.length;x<S;x++){var A=$[x];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(t,H){if(t){B.emit("error",t),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);n2.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,x=B.length;$<x;$++){var S=B[$];this[S]=C[S]}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 q2=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 I0=V((s1,T0)=>{var W=s("fs"),X3=_2(),z3=I2(),M3=q2(),Ou=s("util"),c,_u;if(typeof Symbol==="function"&&typeof Symbol.for==="function")c=Symbol.for("graceful-fs.queue"),_u=Symbol.for("graceful-fs.previous");else c="___graceful-fs.queue",_u="___graceful-fs.previous";function U3(){}function j2(D,u){Object.defineProperty(D,c,{get:function(){return u}})}var JD=U3;if(Ou.debuglog)JD=Ou.debuglog("gfs4");else if(/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))JD=function(){var D=Ou.format.apply(Ou,arguments);D="GFS4: "+D.split(/\n/).join(`
29
+ GFS4: `),console.error(D)};if(!W[c]){if(f0=global[c]||[],j2(W,f0),W.close=function(D){function u(F,E){return D.call(W,F,function(C){if(!C)G2();if(typeof E==="function")E.apply(this,arguments)})}return Object.defineProperty(u,_u,{value:D}),u}(W.close),W.closeSync=function(D){function u(F){D.apply(W,arguments),G2()}return Object.defineProperty(u,_u,{value:D}),u}(W.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){JD(W[c]),s("assert").equal(W[c].length,0)})}var f0;if(!global[c])j2(global,W[c]);T0.exports=_0(M3(W));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!W.__patched)T0.exports=_0(W),W.__patched=!0;function _0(D){X3(D),D.gracefulify=_0,D.createReadStream=e,D.createWriteStream=SD;var u=D.readFile;D.readFile=F;function F(n,j,q){if(typeof j==="function")q=j,j=null;return v(n,j,q);function v(d,r,K,P){return u(d,r,function(X){if(X&&(X.code==="EMFILE"||X.code==="ENFILE"))QD([v,[d,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(n,j,q,v){if(typeof q==="function")v=q,q=null;return d(n,j,q,v);function d(r,K,P,X,o){return E(r,K,P,function(U){if(U&&(U.code==="EMFILE"||U.code==="ENFILE"))QD([d,[r,K,P,X],U,o||Date.now(),Date.now()]);else if(typeof X==="function")X.apply(this,arguments)})}}var B=D.appendFile;if(B)D.appendFile=$;function $(n,j,q,v){if(typeof q==="function")v=q,q=null;return d(n,j,q,v);function d(r,K,P,X,o){return B(r,K,P,function(U){if(U&&(U.code==="EMFILE"||U.code==="ENFILE"))QD([d,[r,K,P,X],U,o||Date.now(),Date.now()]);else if(typeof X==="function")X.apply(this,arguments)})}}var x=D.copyFile;if(x)D.copyFile=S;function S(n,j,q,v){if(typeof q==="function")v=q,q=0;return d(n,j,q,v);function d(r,K,P,X,o){return x(r,K,P,function(U){if(U&&(U.code==="EMFILE"||U.code==="ENFILE"))QD([d,[r,K,P,X],U,o||Date.now(),Date.now()]);else if(typeof X==="function")X.apply(this,arguments)})}}var A=D.readdir;D.readdir=H;var t=/^v[0-5]\./;function H(n,j,q){if(typeof j==="function")q=j,j=null;var v=t.test(process.version)?function(K,P,X,o){return A(K,d(K,P,X,o))}:function(K,P,X,o){return A(K,P,d(K,P,X,o))};return v(n,j,q);function d(r,K,P,X){return function(o,U){if(o&&(o.code==="EMFILE"||o.code==="ENFILE"))QD([v,[r,K,P],o,X||Date.now(),Date.now()]);else{if(U&&U.sort)U.sort();if(typeof P==="function")P.call(this,o,U)}}}}if(process.version.substr(0,4)==="v0.8"){var N=z3(D);I=N.ReadStream,T=N.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(n){I=n},enumerable:!0,configurable:!0}),Object.defineProperty(D,"WriteStream",{get:function(){return T},set:function(n){T=n},enumerable:!0,configurable:!0});var O=I;Object.defineProperty(D,"FileReadStream",{get:function(){return O},set:function(n){O=n},enumerable:!0,configurable:!0});var _=T;Object.defineProperty(D,"FileWriteStream",{get:function(){return _},set:function(n){_=n},enumerable:!0,configurable:!0});function I(n,j){if(this instanceof I)return w.apply(this,arguments),this;else return I.apply(Object.create(I.prototype),arguments)}function J(){var n=this;Pu(n.path,n.flags,n.mode,function(j,q){if(j){if(n.autoClose)n.destroy();n.emit("error",j)}else n.fd=q,n.emit("open",q),n.read()})}function T(n,j){if(this instanceof T)return h.apply(this,arguments),this;else return T.apply(Object.create(T.prototype),arguments)}function b(){var n=this;Pu(n.path,n.flags,n.mode,function(j,q){if(j)n.destroy(),n.emit("error",j);else n.fd=q,n.emit("open",q)})}function e(n,j){return new D.ReadStream(n,j)}function SD(n,j){return new D.WriteStream(n,j)}var bD=D.open;D.open=Pu;function Pu(n,j,q,v){if(typeof q==="function")v=q,q=null;return d(n,j,q,v);function d(r,K,P,X,o){return bD(r,K,P,function(U,U8){if(U&&(U.code==="EMFILE"||U.code==="ENFILE"))QD([d,[r,K,P,X],U,o||Date.now(),Date.now()]);else if(typeof X==="function")X.apply(this,arguments)})}}return D}function QD(D){JD("ENQUEUE",D[0].name,D[1]),W[c].push(D),n0()}var fu;function G2(){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;n0()}function n0(){if(clearTimeout(fu),fu=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)JD("RETRY",u.name,F),u.apply(null,F);else if(Date.now()-C>=60000){JD("TIMEOUT",u.name,F);var $=F.pop();if(typeof $==="function")$.call(null,E)}else{var x=Date.now()-B,S=Math.max(B-C,1),A=Math.min(S*1.2,100);if(x>=A)JD("RETRY",u.name,F),u.apply(null,F.concat([C]));else W[c].push(D)}if(fu===void 0)fu=setTimeout(n0,0)}});var z2=V((a1,X2)=>{function uD(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)}X2.exports=uD;uD.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};uD.prototype.stop=function(){if(this._timeout)clearTimeout(this._timeout);this._timeouts=[],this._cachedTimeouts=null};uD.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};uD.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)};uD.prototype.try=function(D){console.log("Using RetryOperation.try() is deprecated"),this.attempt(D)};uD.prototype.start=function(D){console.log("Using RetryOperation.start() is deprecated"),this.attempt(D)};uD.prototype.start=uD.prototype.try;uD.prototype.errors=function(){return this._errors};uD.prototype.attempts=function(){return this._attempts};uD.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 U2=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,$){return B-$}),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],$=D[B];D[B]=function(S){var A=L3.operation(u),t=Array.prototype.slice.call(arguments,1),H=t.pop();t.push(function(N){if(A.retry(N))return;if(N)arguments[0]=A.mainError();H.apply(this,arguments)}),A.attempt(function(){S.apply(D,t)})}.bind(D,$),D[B].options=u}}});var Z2=V((p1,nu)=>{nu.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];if(process.platform!=="win32")nu.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")nu.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var L2=V((e1,WD)=>{var Q=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(Q))WD.exports=function(){return function(){}};else{if(J0=s("assert"),GD=Z2(),q0=/^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(!qD(global.process))return function(){};if(J0.equal(typeof D,"function","a callback must be provided for exit handler"),jD===!1)Tu();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)Du()};return m.on(F,D),E},Du=function(){if(!jD||!qD(global.process))return;jD=!1,GD.forEach(function(u){try{Q.removeListener(u,uu[u])}catch(F){}}),Q.emit=Fu,Q.reallyExit=Iu,m.count-=1},WD.exports.unload=Du,wD=function(u,F,E){if(m.emitted[u])return;m.emitted[u]=!0,m.emit(u,F,E)},uu={},GD.forEach(function(D){uu[D]=function(){if(!qD(global.process))return;var F=Q.listeners(D);if(F.length===m.count){if(Du(),wD("exit",null,D),wD("afterexit",null,D),q0&&D==="SIGHUP")D="SIGINT";Q.kill(Q.pid,D)}}}),WD.exports.signals=function(){return GD},jD=!1,Tu=function(){if(jD||!qD(global.process))return;jD=!0,m.count+=1,GD=GD.filter(function(u){try{return Q.on(u,uu[u]),!0}catch(F){return!1}}),Q.emit=j0,Q.reallyExit=G0},WD.exports.load=Tu,Iu=Q.reallyExit,G0=function(u){if(!qD(global.process))return;Q.exitCode=u||0,wD("exit",Q.exitCode,null),wD("afterexit",Q.exitCode,null),Iu.call(Q,Q.exitCode)},Fu=Q.emit,j0=function(u,F){if(u==="exit"&&qD(global.process)){if(F!==void 0)Q.exitCode=F;var E=Fu.apply(this,arguments);return wD("exit",Q.exitCode,null),wD("afterexit",Q.exitCode,null),E}else return Fu.apply(this,arguments)}}var J0,GD,q0,KD,m,Du,wD,uu,jD,Tu,Iu,G0,Fu,j0});var Q2=V((P3,X0)=>{var Y2=Symbol();function W3(D,u,F){let E=u[Y2];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,($,x)=>{if($)return F($);let S=x.mtime.getTime()%1000===0?"s":"ms";Object.defineProperty(u,Y2,{value:S}),F(null,x.mtime,S)})})}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 V2=V((c3,Cu)=>{var m3=s("path"),U0=I0(),r3=U2(),b3=L2(),K2=Q2(),tD={};function Eu(D,u){return u.lockfilePath||`${D}.lock`}function Z0(D,u,F){if(!u.realpath)return F(null,m3.resolve(D));u.fs.realpath(D,F)}function M0(D,u,F){let E=Eu(D,u);u.fs.mkdir(E,(C)=>{if(!C)return K2.probe(E,u.fs,(B,$,x)=>{if(B)return u.fs.rmdir(E,()=>{}),F(B);F(null,$,x)});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 M0(D,{...u,stale:0},F);return F(B)}if(!W2($,u))return F(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));y2(D,u,(x)=>{if(x)return F(x);M0(D,{...u,stale:0},F)})})})}function W2(D,u){return D.mtime.getTime()<Date.now()-u.stale}function y2(D,u,F){u.fs.rmdir(Eu(D,u),(E)=>{if(E&&E.code!=="ENOENT")return F(E);F()})}function Ju(D,u){let F=tD[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,Ju(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 x=K2.getMtime(F.mtimePrecision);u.fs.utimes(F.lockfilePath,x,x,(S)=>{let A=F.lastUpdate+u.stale<Date.now();if(F.released)return;if(S){if(S.code==="ENOENT"||A)return z0(D,F,Object.assign(S,{code:"ECOMPROMISED"}));return F.updateDelay=1000,Ju(D,u)}F.mtime=x,F.lastUpdate=Date.now(),F.updateDelay=null,Ju(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(tD[D]===u)delete tD[D];u.options.onCompromised(F)}function v3(D,u,F){u={stale:1e4,update:null,realpath:!0,retries:0,fs:U0,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),Z0(D,u,(E,C)=>{if(E)return F(E);let B=r3.operation(u.retries);B.attempt(()=>{M0(C,u,($,x,S)=>{if(B.retry($))return;if($)return F(B.mainError());let A=tD[C]={lockfilePath:Eu(C,u),mtime:x,mtimePrecision:S,options:u,lastUpdate:Date.now()};Ju(C,u),F(null,(t)=>{if(A.released)return t&&t(Object.assign(Error("Lock is already released"),{code:"ERELEASED"}));P2(C,{...u,realpath:!1},t)})})})})}function P2(D,u,F){u={fs:U0,realpath:!0,...u},Z0(D,u,(E,C)=>{if(E)return F(E);let B=tD[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 tD[C],y2(C,u,F)})}function d3(D,u,F){u={stale:1e4,realpath:!0,fs:U0,...u},u.stale=Math.max(u.stale||0,2000),Z0(D,u,(E,C)=>{if(E)return F(E);u.fs.stat(Eu(C,u),(B,$)=>{if(B)return B.code==="ENOENT"?F(null,!1):F(B);return F(null,!W2($,u))})})}function o3(){return tD}b3(()=>{for(let D in tD){let u=tD[D].options;try{u.fs.rmdirSync(Eu(D,u))}catch(F){}}});c3.lock=v3;c3.unlock=P2;c3.check=d3;c3.getLocks=o3});var m2=V((DB,k2)=>{var l3=I0();function p3(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(x){return B(x)}B(null,$)}}),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}k2.exports={toPromise:e3,toSync:D8,toSyncOptions:u8}});var b2=V((uB,ND)=>{var yD=V2(),{toPromise:qu,toSync:Gu,toSyncOptions:L0}=m2();async function r2(D,u){let F=await qu(yD.lock)(D,u);return qu(F)}function F8(D,u){let F=Gu(yD.lock)(D,L0(u));return Gu(F)}function E8(D,u){return qu(yD.unlock)(D,u)}function C8(D,u){return Gu(yD.unlock)(D,L0(u))}function B8(D,u){return qu(yD.check)(D,u)}function $8(D,u){return Gu(yD.check)(D,L0(u))}ND.exports=r2;ND.exports.lock=r2;ND.exports.unlock=E8;ND.exports.lockSync=F8;ND.exports.unlockSync=C8;ND.exports.check=B8;ND.exports.checkSync=$8});var JE=V((t$,IE)=>{var kD=1000,mD=kD*60,rD=mD*60,UD=rD*24,T8=UD*7,I8=UD*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*UD;case"hours":case"hour":case"hrs":case"hr":case"h":return F*rD;case"minutes":case"minute":case"mins":case"min":case"m":return F*mD;case"seconds":case"second":case"secs":case"sec":case"s":return F*kD;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return F;default:return}}function q8(D){var u=Math.abs(D);if(u>=UD)return Math.round(D/UD)+"d";if(u>=rD)return Math.round(D/rD)+"h";if(u>=mD)return Math.round(D/mD)+"m";if(u>=kD)return Math.round(D/kD)+"s";return D+"ms"}function G8(D){var u=Math.abs(D);if(u>=UD)return yu(D,u,UD,"day");if(u>=rD)return yu(D,u,rD,"hour");if(u>=mD)return yu(D,u,mD,"minute");if(u>=kD)return yu(D,u,kD,"second");return D+" ms"}function yu(D,u,F,E){var C=u>=F*1.5;return Math.round(D/F)+" "+E+(C?"s":"")}});var fF=vD(OF(),1),{program:V8,createCommand:k8,createArgument:m8,createOption:r8,CommanderError:b8,InvalidArgumentError:v8,InvalidOptionArgumentError:d8,Command:_F,Argument:o8,Option:c8,Help:g8}=fF.default;var nF=(D=0)=>(u)=>`\x1B[${u+D}m`,TF=(D=0)=>(u)=>`\x1B[${38+D};5;${u}m`,IF=(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=nF(),Z.color.ansi256=TF(),Z.color.ansi16m=IF(),Z.bgColor.ansi=nF(10),Z.bgColor.ansi256=TF(10),Z.bgColor.ansi16m=IF(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 x=u%36;F=Math.floor(u/36)/5,E=Math.floor(x/6)/5,C=x%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)=>Z.ansi256ToAnsi(Z.rgbToAnsi256(u,F,E)),enumerable:!1},hexToAnsi:{value:(u)=>Z.ansi256ToAnsi(Z.hexToAnsi256(u)),enumerable:!1}}),Z}var MC=zC(),FD=MC;import cu from"process";import UC from"os";import JF from"tty";function DD(D,u=globalThis.Deno?globalThis.Deno.args:cu.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}=cu,xu;if(DD("no-color")||DD("no-colors")||DD("color=false")||DD("color=never"))xu=0;else if(DD("color")||DD("colors")||DD("color=true")||DD("color=always"))xu=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)xu=E;let C=F?xu: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(cu.platform==="win32"){let $=UC.release().split(".");if(Number($[0])>=10&&Number($[2])>=10586)return Number($[2])>=14931?3:2;return 1}if("CI"in L){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(($)=>($ in L)))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(($)=>($ 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 $=Number.parseInt((L.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(L.TERM_PROGRAM){case"iTerm.app":return $>=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 qF(D,u={}){let F=YC(D,{streamIsTTY:D&&D.isTTY,...u});return LC(F)}var QC={stdout:qF({isTTY:JF.isatty(1)}),stderr:qF({isTTY:JF.isatty(2)})},GF=QC;function jF(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 XF(D,u,F,E){let C=0,B="";do{let $=D[E-1]==="\r";B+=D.slice(C,$?E-1:E)+u+($?`\r
29
30
  `:`
30
31
  `)+F,C=E+1,E=D.indexOf(`
31
- `,C)}while(E!==-1);return B+=D.slice(C),B}var{stdout:zF,stderr:MF}=GF,gu=Symbol("GENERATOR"),LD=Symbol("STYLER"),oD=Symbol("IS_EMPTY"),UF=["ansi","ansi","ansi256","ansi16m"],YD=Object.create(null),PC=(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 VC=(D)=>{let u=(...F)=>F.join(" ");return PC(u,D),Object.setPrototypeOf(u,cD.prototype),u};function cD(D){return VC(D)}Object.setPrototypeOf(cD.prototype,Function.prototype);for(let[D,u]of Object.entries(FD))YD[D]={get(){let F=tu(this,su(u.open,u.close,this[LD]),this[oD]);return Object.defineProperty(this,D,{value:F}),F}};YD.visible={get(){let D=tu(this,this[LD],!0);return Object.defineProperty(this,"visible",{value:D}),D}};var iu=(D,u,F,...E)=>{if(D==="rgb"){if(u==="ansi16m")return FD[F].ansi16m(...E);if(u==="ansi256")return FD[F].ansi256(FD.rgbToAnsi256(...E));return FD[F].ansi(FD.rgbToAnsi(...E))}if(D==="hex")return iu("rgb",u,F,...FD.hexToRgb(...E));return FD[F][D](...E)},kC=["rgb","hex","ansi256"];for(let D of kC){YD[D]={get(){let{level:F}=this;return function(...E){let C=su(iu(D,UF[F],"color",...E),FD.color.close,this[LD]);return tu(this,C,this[oD])}}};let u="bg"+D[0].toUpperCase()+D.slice(1);YD[u]={get(){let{level:F}=this;return function(...E){let C=su(iu(D,UF[F],"bgColor",...E),FD.bgColor.close,this[LD]);return tu(this,C,this[oD])}}}}var mC=Object.defineProperties(()=>{},{...YD,level:{enumerable:!0,get(){return this[gu].level},set(D){this[gu].level=D}}}),su=(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}},tu=(D,u,F)=>{let E=(...C)=>rC(E,C.length===1?""+C[0]:C.join(" "));return Object.setPrototypeOf(E,mC),E[gu]=D,E[LD]=u,E[oD]=F,E},rC=(D,u)=>{if(D.level<=0||!u)return D[oD]?"":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=jF(u,F.close,F.open),F=F.parent;let B=u.indexOf(`
32
- `);if(B!==-1)u=XF(u,C,E,B);return E+u+C};Object.defineProperties(cD.prototype,YD);var bC=cD(),H6=cD({level:MF?MF.level:0});var R=bC;var au=(D)=>D.name==="backspace",gD=(D)=>D.name==="tab";var iD=(D)=>D.name==="enter"||D.name==="return";class lu extends Error{name="AbortPromptError";message="Prompt was aborted";constructor(D){super();this.cause=D?.cause}}class pu extends Error{name="CancelPromptError";message="Prompt was canceled"}class QD extends Error{name="ExitPromptError"}class eu extends Error{name="HookError"}class D0 extends Error{name="ValidationError"}import{AsyncResource as cC}from"node:async_hooks";import{AsyncLocalStorage as vC,AsyncResource as dC}from"node:async_hooks";var ZF=new vC;function oC(D){return{rl:D,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function LF(D,u){let F=oC(D);return ZF.run(F,()=>{function E(C){F.handleChange=()=>{F.index=0,C()},F.handleChange()}return u(E)})}function OD(){let D=ZF.getStore();if(!D)throw new eu("[Inquirer] Hook functions can only be called from within a prompt");return D}function u0(){return OD().rl}function F0(D){let u=(...F)=>{let E=OD(),C=!1,B=E.handleChange;E.handleChange=()=>{C=!0};let $=D(...F);if(C)B();return E.handleChange=B,$};return dC.bind(u)}function Au(D){let u=OD(),{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 YF(){OD().handleChange()}var _D={queue(D){let u=OD(),{index:F}=u;u.hooksEffect.push(()=>{u.hooksCleanup[F]?.();let E=D(u0());if(E!=null&&typeof E!=="function")throw new D0("useEffect return value must be a cleanup function or nothing.");u.hooksCleanup[F]=E})},run(){let D=OD();F0(()=>{D.hooksEffect.forEach((u)=>{u()}),D.hooksEffect.length=0})()},clearAll(){let D=OD();D.hooksCleanup.forEach((u)=>{u?.()}),D.hooksEffect.length=0,D.hooksCleanup.length=0}};function l(D){return Au((u)=>{let F=cC.bind(function(B){if(u.get()!==B)u.set(B),YF()});if(u.initialized)return[u.get(),F];let E=typeof D==="function"?D():D;return u.set(E),[E,F]})}function fD(D,u){Au((F)=>{let E=F.get();if(!Array.isArray(E)||u.some((B,$)=>!Object.is(B,E[$])))_D.queue(D);F.set(u)})}import{styleText as ED}from"node:util";import CD from"node:process";function gC(){if(CD.platform!=="win32")return CD.env.TERM!=="linux";return Boolean(CD.env.WT_SESSION)||Boolean(CD.env.TERMINUS_SUBLIME)||CD.env.ConEmuTask==="{cmd::Cmder}"||CD.env.TERM_PROGRAM==="Terminus-Sublime"||CD.env.TERM_PROGRAM==="vscode"||CD.env.TERM==="xterm-256color"||CD.env.TERM==="alacritty"||CD.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var QF={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"█",squareDarkShade:"▓",squareMediumShade:"▒",squareLightShade:"░",squareTop:"▀",squareBottom:"▄",squareLeft:"▌",squareRight:"▐",squareCenter:"■",bullet:"●",dot:"․",ellipsis:"…",pointerSmall:"›",triangleUp:"▲",triangleUpSmall:"▴",triangleDown:"▼",triangleDownSmall:"▾",triangleLeftSmall:"◂",triangleRightSmall:"▸",home:"⌂",heart:"♥",musicNote:"♪",musicNoteBeamed:"♫",arrowUp:"↑",arrowDown:"↓",arrowLeft:"←",arrowRight:"→",arrowLeftRight:"↔",arrowUpDown:"↕",almostEqual:"≈",notEqual:"≠",lessOrEqual:"≤",greaterOrEqual:"≥",identical:"≡",infinity:"∞",subscriptZero:"₀",subscriptOne:"₁",subscriptTwo:"₂",subscriptThree:"₃",subscriptFour:"₄",subscriptFive:"₅",subscriptSix:"₆",subscriptSeven:"₇",subscriptEight:"₈",subscriptNine:"₉",oneHalf:"½",oneThird:"⅓",oneQuarter:"¼",oneFifth:"⅕",oneSixth:"⅙",oneEighth:"⅛",twoThirds:"⅔",twoFifths:"⅖",threeQuarters:"¾",threeFifths:"⅗",threeEighths:"⅜",fourFifths:"⅘",fiveSixths:"⅚",fiveEighths:"⅝",sevenEighths:"⅞",line:"─",lineBold:"━",lineDouble:"═",lineDashed0:"┄",lineDashed1:"┅",lineDashed2:"┈",lineDashed3:"┉",lineDashed4:"╌",lineDashed5:"╍",lineDashed6:"╴",lineDashed7:"╶",lineDashed8:"╸",lineDashed9:"╺",lineDashed10:"╼",lineDashed11:"╾",lineDashed12:"−",lineDashed13:"–",lineDashed14:"‐",lineDashed15:"⁃",lineVertical:"│",lineVerticalBold:"┃",lineVerticalDouble:"║",lineVerticalDashed0:"┆",lineVerticalDashed1:"┇",lineVerticalDashed2:"┊",lineVerticalDashed3:"┋",lineVerticalDashed4:"╎",lineVerticalDashed5:"╏",lineVerticalDashed6:"╵",lineVerticalDashed7:"╷",lineVerticalDashed8:"╹",lineVerticalDashed9:"╻",lineVerticalDashed10:"╽",lineVerticalDashed11:"╿",lineDownLeft:"┐",lineDownLeftArc:"╮",lineDownBoldLeftBold:"┓",lineDownBoldLeft:"┒",lineDownLeftBold:"┑",lineDownDoubleLeftDouble:"╗",lineDownDoubleLeft:"╖",lineDownLeftDouble:"╕",lineDownRight:"┌",lineDownRightArc:"╭",lineDownBoldRightBold:"┏",lineDownBoldRight:"┎",lineDownRightBold:"┍",lineDownDoubleRightDouble:"╔",lineDownDoubleRight:"╓",lineDownRightDouble:"╒",lineUpLeft:"┘",lineUpLeftArc:"╯",lineUpBoldLeftBold:"┛",lineUpBoldLeft:"┚",lineUpLeftBold:"┙",lineUpDoubleLeftDouble:"╝",lineUpDoubleLeft:"╜",lineUpLeftDouble:"╛",lineUpRight:"└",lineUpRightArc:"╰",lineUpBoldRightBold:"┗",lineUpBoldRight:"┖",lineUpRightBold:"┕",lineUpDoubleRightDouble:"╚",lineUpDoubleRight:"╙",lineUpRightDouble:"╘",lineUpDownLeft:"┤",lineUpBoldDownBoldLeftBold:"┫",lineUpBoldDownBoldLeft:"┨",lineUpDownLeftBold:"┥",lineUpBoldDownLeftBold:"┩",lineUpDownBoldLeftBold:"┪",lineUpDownBoldLeft:"┧",lineUpBoldDownLeft:"┦",lineUpDoubleDownDoubleLeftDouble:"╣",lineUpDoubleDownDoubleLeft:"╢",lineUpDownLeftDouble:"╡",lineUpDownRight:"├",lineUpBoldDownBoldRightBold:"┣",lineUpBoldDownBoldRight:"┠",lineUpDownRightBold:"┝",lineUpBoldDownRightBold:"┡",lineUpDownBoldRightBold:"┢",lineUpDownBoldRight:"┟",lineUpBoldDownRight:"┞",lineUpDoubleDownDoubleRightDouble:"╠",lineUpDoubleDownDoubleRight:"╟",lineUpDownRightDouble:"╞",lineDownLeftRight:"┬",lineDownBoldLeftBoldRightBold:"┳",lineDownLeftBoldRightBold:"┯",lineDownBoldLeftRight:"┰",lineDownBoldLeftBoldRight:"┱",lineDownBoldLeftRightBold:"┲",lineDownLeftRightBold:"┮",lineDownLeftBoldRight:"┭",lineDownDoubleLeftDoubleRightDouble:"╦",lineDownDoubleLeftRight:"╥",lineDownLeftDoubleRightDouble:"╤",lineUpLeftRight:"┴",lineUpBoldLeftBoldRightBold:"┻",lineUpLeftBoldRightBold:"┷",lineUpBoldLeftRight:"┸",lineUpBoldLeftBoldRight:"┹",lineUpBoldLeftRightBold:"┺",lineUpLeftRightBold:"┶",lineUpLeftBoldRight:"┵",lineUpDoubleLeftDoubleRightDouble:"╩",lineUpDoubleLeftRight:"╨",lineUpLeftDoubleRightDouble:"╧",lineUpDownLeftRight:"┼",lineUpBoldDownBoldLeftBoldRightBold:"╋",lineUpDownBoldLeftBoldRightBold:"╈",lineUpBoldDownLeftBoldRightBold:"╇",lineUpBoldDownBoldLeftRightBold:"╊",lineUpBoldDownBoldLeftBoldRight:"╉",lineUpBoldDownLeftRight:"╀",lineUpDownBoldLeftRight:"╁",lineUpDownLeftBoldRight:"┽",lineUpDownLeftRightBold:"┾",lineUpBoldDownBoldLeftRight:"╂",lineUpDownLeftBoldRightBold:"┿",lineUpBoldDownLeftBoldRight:"╃",lineUpBoldDownLeftRightBold:"╄",lineUpDownBoldLeftBoldRight:"╅",lineUpDownBoldLeftRightBold:"╆",lineUpDoubleDownDoubleLeftDoubleRightDouble:"╬",lineUpDoubleDownDoubleLeftRight:"╫",lineUpDownLeftDoubleRightDouble:"╪",lineCross:"╳",lineBackslash:"╲",lineSlash:"╱"},KF={tick:"✔",info:"ℹ",warning:"⚠",cross:"✘",squareSmall:"◻",squareSmallFilled:"◼",circle:"◯",circleFilled:"◉",circleDotted:"◌",circleDouble:"◎",circleCircle:"ⓞ",circleCross:"ⓧ",circlePipe:"Ⓘ",radioOn:"◉",radioOff:"◯",checkboxOn:"☒",checkboxOff:"☐",checkboxCircleOn:"ⓧ",checkboxCircleOff:"Ⓘ",pointer:"❯",triangleUpOutline:"△",triangleLeft:"◀",triangleRight:"▶",lozenge:"◆",lozengeOutline:"◇",hamburger:"☰",smiley:"㋡",mustache:"෴",star:"★",play:"▶",nodejs:"⬢",oneSeventh:"⅐",oneNinth:"⅑",oneTenth:"⅒"},iC={tick:"√",info:"i",warning:"‼",cross:"×",squareSmall:"□",squareSmallFilled:"■",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(○)",circleCross:"(×)",circlePipe:"(│)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[×]",checkboxOff:"[ ]",checkboxCircleOn:"(×)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"∆",triangleLeft:"◄",triangleRight:"►",lozenge:"♦",lozengeOutline:"◊",hamburger:"≡",smiley:"☺",mustache:"┌─┐",star:"✶",play:"►",nodejs:"♦",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},sC={...QF,...KF},aC={...QF,...iC},lC=gC(),pC=lC?sC:aC,WF=pC,q6=Object.entries(KF);var yF={prefix:{idle:ED("blue","?"),done:ED("green",WF.tick)},spinner:{interval:80,frames:["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"].map((D)=>ED("yellow",D))},style:{answer:(D)=>ED("cyan",D),message:(D)=>ED("bold",D),error:(D)=>ED("red",`> ${D}`),defaultAnswer:(D)=>ED("dim",`(${D})`),help:(D)=>ED("dim",D),highlight:(D)=>ED("cyan",D),key:(D)=>ED("cyan",ED("bold",`<${D}>`))}};function PF(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 VF(...D){let u={};for(let F of D)for(let[E,C]of Object.entries(F)){let B=u[E];u[E]=PF(B)&&PF(C)?VF(B,C):C}return u}function nD(...D){let u=[yF,...D.filter((F)=>F!=null)];return VF(...u)}function sD({status:D="idle",theme:u}){let[F,E]=l(!1),[C,B]=l(0),{prefix:$,spinner:x}=nD(u);if(fD(()=>{if(D==="loading"){let A,t=-1,H=setTimeout(()=>{E(!0),A=setInterval(()=>{t=t+1,B(t%x.frames.length)},x.interval)},300);return()=>{clearTimeout(H),clearInterval(A)}}else E(!1)},[D]),F)return x.frames[C];return typeof $==="string"?$:$[D==="loading"?"idle":D]??$.idle}function kF(D){return l({current:D})[0]}function aD(D){let u=kF(D);u.current=D,fD((F)=>{let E=!1,C=F0((B,$)=>{if(E)return;u.current($,F)});return F.input.on("keypress",C),()=>{E=!0,F.input.removeListener("keypress",C)}},[])}var E2=ZD(rF(),1);function E0({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 u3=E0();function lD(D){if(typeof D!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof D}\``);return D.replace(u3,"")}function bF(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 vF(D){return D===12288||D>=65281&&D<=65376||D>=65504&&D<=65510}function dF(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 F3(D){if(!Number.isSafeInteger(D))throw TypeError(`Expected a code point, got \`${typeof D}\`.`)}function oF(D,{ambiguousAsWide:u=!1}={}){if(F3(D),vF(D)||dF(D)||u&&bF(D))return 2;return 1}var iF=ZD(gF(),1),E3=new Intl.Segmenter,C3=/^\p{Default_Ignorable_Code_Point}$/u;function TD(D,u={}){if(typeof D!=="string"||D.length===0)return 0;let{ambiguousIsNarrow:F=!0,countAnsiEscapeCodes:E=!1}=u;if(!E)D=lD(D);if(D.length===0)return 0;let C=0,B={ambiguousAsWide:!F};for(let{segment:$}of E3.segment(D)){let x=$.codePointAt(0);if(x<=31||x>=127&&x<=159)continue;if(x>=8203&&x<=8207||x===65279)continue;if(x>=768&&x<=879||x>=6832&&x<=6911||x>=7616&&x<=7679||x>=8400&&x<=8447||x>=65056&&x<=65071)continue;if(x>=55296&&x<=57343)continue;if(x>=65024&&x<=65039)continue;if(C3.test($))continue;if(iF.default().test($)){C+=2;continue}C+=oF(x,B)}return C}var sF=(D=0)=>(u)=>`\x1B[${u+D}m`,aF=(D=0)=>(u)=>`\x1B[${38+D};5;${u}m`,lF=(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]}},p6=Object.keys(Y.modifier),B3=Object.keys(Y.color),$3=Object.keys(Y.bgColor),e6=[...B3,...$3];function x3(){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=sF(),Y.color.ansi256=aF(),Y.color.ansi16m=lF(),Y.bgColor.ansi=sF(10),Y.bgColor.ansi256=aF(10),Y.bgColor.ansi16m=lF(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 x=u%36;F=Math.floor(u/36)/5,E=Math.floor(x/6)/5,C=x%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)=>Y.ansi256ToAnsi(Y.rgbToAnsi256(u,F,E)),enumerable:!1},hexToAnsi:{value:(u)=>Y.ansi256ToAnsi(Y.hexToAnsi256(u)),enumerable:!1}}),Y}var t3=x3(),pF=t3;var Su=new Set(["\x1B","›"]),A3=39,B0="\x07",u2="[",H3="]",F2="m",Hu=`${H3}8;;`,eF=(D)=>`${Su.values().next().value}${u2}${D}${F2}`,D2=(D)=>`${Su.values().next().value}${Hu}${D}${B0}`,S3=(D)=>D.split(" ").map((u)=>TD(u)),C0=(D,u,F)=>{let E=[...u],C=!1,B=!1,$=TD(lD(D.at(-1)));for(let[x,S]of E.entries()){let A=TD(S);if($+A<=F)D[D.length-1]+=S;else D.push(S),$=0;if(Su.has(S))C=!0,B=E.slice(x+1,x+1+Hu.length).join("")===Hu;if(C){if(B){if(S===B0)C=!1,B=!1}else if(S===F2)C=!1;continue}if($+=A,$===F&&x<E.length-1)D.push(""),$=0}if(!$&&D.at(-1).length>0&&D.length>1)D[D.length-2]+=D.pop()},R3=(D)=>{let u=D.split(" "),F=u.length;while(F>0){if(TD(u[F-1])>0)break;F--}if(F===u.length)return D;return u.slice(0,F).join(" ")+u.slice(F).join("")},w3=(D,u,F={})=>{if(F.trim!==!1&&D.trim()==="")return"";let E="",C,B,$=S3(D),x=[""];for(let[H,N]of D.split(" ").entries()){if(F.trim!==!1)x[x.length-1]=x.at(-1).trimStart();let w=TD(x.at(-1));if(H!==0){if(w>=u&&(F.wordWrap===!1||F.trim===!1))x.push(""),w=0;if(w>0||F.trim===!1)x[x.length-1]+=" ",w++}if(F.hard&&$[H]>u){let h=u-w,O=1+Math.floor(($[H]-h-1)/u);if(Math.floor(($[H]-1)/u)<O)x.push("");C0(x,N,u);continue}if(w+$[H]>u&&w>0&&$[H]>0){if(F.wordWrap===!1&&w<u){C0(x,N,u);continue}x.push("")}if(w+$[H]>u&&F.wordWrap===!1){C0(x,N,u);continue}x[x.length-1]+=N}if(F.trim!==!1)x=x.map((H)=>R3(H));let S=x.join(`
33
- `),A=[...S],t=0;for(let[H,N]of A.entries()){if(E+=N,Su.has(N)){let{groups:h}=new RegExp(`(?:\\${u2}(?<code>\\d+)m|\\${Hu}(?<uri>.*)${B0})`).exec(S.slice(t))||{groups:{}};if(h.code!==void 0){let O=Number.parseFloat(h.code);C=O===A3?void 0:O}else if(h.uri!==void 0)B=h.uri.length===0?void 0:h.uri}let w=pF.codes.get(Number(C));if(A[H+1]===`
34
- `){if(B)E+=D2("");if(C&&w)E+=eF(w)}else if(N===`
35
- `){if(C&&w)E+=eF(C);if(B)E+=D2(B)}t+=N.length}return E};function $0(D,u,F){return String(D).normalize().replaceAll(`\r
32
+ `,C)}while(E!==-1);return B+=D.slice(C),B}var{stdout:zF,stderr:MF}=GF,gu=Symbol("GENERATOR"),ZD=Symbol("STYLER"),oD=Symbol("IS_EMPTY"),UF=["ansi","ansi","ansi256","ansi16m"],LD=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,cD.prototype),u};function cD(D){return WC(D)}Object.setPrototypeOf(cD.prototype,Function.prototype);for(let[D,u]of Object.entries(FD))LD[D]={get(){let F=tu(this,su(u.open,u.close,this[ZD]),this[oD]);return Object.defineProperty(this,D,{value:F}),F}};LD.visible={get(){let D=tu(this,this[ZD],!0);return Object.defineProperty(this,"visible",{value:D}),D}};var iu=(D,u,F,...E)=>{if(D==="rgb"){if(u==="ansi16m")return FD[F].ansi16m(...E);if(u==="ansi256")return FD[F].ansi256(FD.rgbToAnsi256(...E));return FD[F].ansi(FD.rgbToAnsi(...E))}if(D==="hex")return iu("rgb",u,F,...FD.hexToRgb(...E));return FD[F][D](...E)},yC=["rgb","hex","ansi256"];for(let D of yC){LD[D]={get(){let{level:F}=this;return function(...E){let C=su(iu(D,UF[F],"color",...E),FD.color.close,this[ZD]);return tu(this,C,this[oD])}}};let u="bg"+D[0].toUpperCase()+D.slice(1);LD[u]={get(){let{level:F}=this;return function(...E){let C=su(iu(D,UF[F],"bgColor",...E),FD.bgColor.close,this[ZD]);return tu(this,C,this[oD])}}}}var PC=Object.defineProperties(()=>{},{...LD,level:{enumerable:!0,get(){return this[gu].level},set(D){this[gu].level=D}}}),su=(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}},tu=(D,u,F)=>{let E=(...C)=>VC(E,C.length===1?""+C[0]:C.join(" "));return Object.setPrototypeOf(E,PC),E[gu]=D,E[ZD]=u,E[oD]=F,E},VC=(D,u)=>{if(D.level<=0||!u)return D[oD]?"":u;let F=D[ZD];if(F===void 0)return u;let{openAll:E,closeAll:C}=F;if(u.includes("\x1B"))while(F!==void 0)u=jF(u,F.close,F.open),F=F.parent;let B=u.indexOf(`
33
+ `);if(B!==-1)u=XF(u,C,E,B);return E+u+C};Object.defineProperties(cD.prototype,LD);var kC=cD(),$6=cD({level:MF?MF.level:0});var R=kC;var au=(D)=>D.name==="backspace",gD=(D)=>D.name==="tab";var iD=(D)=>D.name==="enter"||D.name==="return";class lu extends Error{name="AbortPromptError";message="Prompt was aborted";constructor(D){super();this.cause=D?.cause}}class pu extends Error{name="CancelPromptError";message="Prompt was canceled"}class YD extends Error{name="ExitPromptError"}class eu extends Error{name="HookError"}class D0 extends Error{name="ValidationError"}import{AsyncResource as vC}from"async_hooks";import{AsyncLocalStorage as mC,AsyncResource as rC}from"async_hooks";var ZF=new mC;function bC(D){return{rl:D,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function LF(D,u){let F=bC(D);return ZF.run(F,()=>{function E(C){F.handleChange=()=>{F.index=0,C()},F.handleChange()}return u(E)})}function OD(){let D=ZF.getStore();if(!D)throw new eu("[Inquirer] Hook functions can only be called from within a prompt");return D}function u0(){return OD().rl}function F0(D){let u=(...F)=>{let E=OD(),C=!1,B=E.handleChange;E.handleChange=()=>{C=!0};let $=D(...F);if(C)B();return E.handleChange=B,$};return rC.bind(u)}function Au(D){let u=OD(),{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 YF(){OD().handleChange()}var fD={queue(D){let u=OD(),{index:F}=u;u.hooksEffect.push(()=>{u.hooksCleanup[F]?.();let E=D(u0());if(E!=null&&typeof E!=="function")throw new D0("useEffect return value must be a cleanup function or nothing.");u.hooksCleanup[F]=E})},run(){let D=OD();F0(()=>{D.hooksEffect.forEach((u)=>{u()}),D.hooksEffect.length=0})()},clearAll(){let D=OD();D.hooksCleanup.forEach((u)=>{u?.()}),D.hooksEffect.length=0,D.hooksCleanup.length=0}};function l(D){return Au((u)=>{let F=vC.bind(function(B){if(u.get()!==B)u.set(B),YF()});if(u.initialized)return[u.get(),F];let E=typeof D==="function"?D():D;return u.set(E),[E,F]})}function _D(D,u){Au((F)=>{let E=F.get();if(!Array.isArray(E)||u.some((B,$)=>!Object.is(B,E[$])))fD.queue(D);F.set(u)})}import{styleText as ED}from"util";import CD from"process";function dC(){if(CD.platform!=="win32")return CD.env.TERM!=="linux";return Boolean(CD.env.WT_SESSION)||Boolean(CD.env.TERMINUS_SUBLIME)||CD.env.ConEmuTask==="{cmd::Cmder}"||CD.env.TERM_PROGRAM==="Terminus-Sublime"||CD.env.TERM_PROGRAM==="vscode"||CD.env.TERM==="xterm-256color"||CD.env.TERM==="alacritty"||CD.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var QF={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"},KF={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"},oC={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={...QF,...KF},gC={...QF,...oC},iC=dC(),sC=iC?cC:gC,WF=sC,n6=Object.entries(KF);var yF={prefix:{idle:ED("blue","?"),done:ED("green",WF.tick)},spinner:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"].map((D)=>ED("yellow",D))},style:{answer:(D)=>ED("cyan",D),message:(D)=>ED("bold",D),error:(D)=>ED("red",`> ${D}`),defaultAnswer:(D)=>ED("dim",`(${D})`),help:(D)=>ED("dim",D),highlight:(D)=>ED("cyan",D),key:(D)=>ED("cyan",ED("bold",`<${D}>`))}};function PF(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 VF(...D){let u={};for(let F of D)for(let[E,C]of Object.entries(F)){let B=u[E];u[E]=PF(B)&&PF(C)?VF(B,C):C}return u}function nD(...D){let u=[yF,...D.filter((F)=>F!=null)];return VF(...u)}function sD({status:D="idle",theme:u}){let[F,E]=l(!1),[C,B]=l(0),{prefix:$,spinner:x}=nD(u);if(_D(()=>{if(D==="loading"){let A,t=-1,H=setTimeout(()=>{E(!0),A=setInterval(()=>{t=t+1,B(t%x.frames.length)},x.interval)},300);return()=>{clearTimeout(H),clearInterval(A)}}else E(!1)},[D]),F)return x.frames[C];return typeof $==="string"?$:$[D==="loading"?"idle":D]??$.idle}function kF(D){return l({current:D})[0]}function aD(D){let u=kF(D);u.current=D,_D((F)=>{let E=!1,C=F0((B,$)=>{if(E)return;u.current($,F)});return F.input.on("keypress",C),()=>{E=!0,F.input.removeListener("keypress",C)}},[])}var u2=vD(rF(),1);function E0({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=E0();function lD(D){if(typeof D!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof D}\``);return D.replace(pC,"")}function bF(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 vF(D){return D===12288||D>=65281&&D<=65376||D>=65504&&D<=65510}function dF(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 oF(D,{ambiguousAsWide:u=!1}={}){if(eC(D),vF(D)||dF(D)||u&&bF(D))return 2;return 1}var cF=()=>{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 TD(D,u={}){if(typeof D!=="string"||D.length===0)return 0;let{ambiguousIsNarrow:F=!0,countAnsiEscapeCodes:E=!1}=u;if(!E)D=lD(D);if(D.length===0)return 0;let C=0,B={ambiguousAsWide:!F};for(let{segment:$}of D3.segment(D)){let x=$.codePointAt(0);if(x<=31||x>=127&&x<=159)continue;if(x>=8203&&x<=8207||x===65279)continue;if(x>=768&&x<=879||x>=6832&&x<=6911||x>=7616&&x<=7679||x>=8400&&x<=8447||x>=65056&&x<=65071)continue;if(x>=55296&&x<=57343)continue;if(x>=65024&&x<=65039)continue;if(u3.test($))continue;if(cF().test($)){C+=2;continue}C+=oF(x,B)}return C}var gF=(D=0)=>(u)=>`\x1B[${u+D}m`,iF=(D=0)=>(u)=>`\x1B[${38+D};5;${u}m`,sF=(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=gF(),Y.color.ansi256=iF(),Y.color.ansi16m=sF(),Y.bgColor.ansi=gF(10),Y.bgColor.ansi256=iF(10),Y.bgColor.ansi16m=sF(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 x=u%36;F=Math.floor(u/36)/5,E=Math.floor(x/6)/5,C=x%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)=>Y.ansi256ToAnsi(Y.rgbToAnsi256(u,F,E)),enumerable:!1},hexToAnsi:{value:(u)=>Y.ansi256ToAnsi(Y.hexToAnsi256(u)),enumerable:!1}}),Y}var B3=C3(),aF=B3;var Su=new Set(["\x1B","\x9B"]),$3=39,B0="\x07",eF="[",x3="]",D2="m",Hu=`${x3}8;;`,lF=(D)=>`${Su.values().next().value}${eF}${D}${D2}`,pF=(D)=>`${Su.values().next().value}${Hu}${D}${B0}`,t3=(D)=>D.split(" ").map((u)=>TD(u)),C0=(D,u,F)=>{let E=[...u],C=!1,B=!1,$=TD(lD(D.at(-1)));for(let[x,S]of E.entries()){let A=TD(S);if($+A<=F)D[D.length-1]+=S;else D.push(S),$=0;if(Su.has(S))C=!0,B=E.slice(x+1,x+1+Hu.length).join("")===Hu;if(C){if(B){if(S===B0)C=!1,B=!1}else if(S===D2)C=!1;continue}if($+=A,$===F&&x<E.length-1)D.push(""),$=0}if(!$&&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(TD(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,$=t3(D),x=[""];for(let[H,N]of D.split(" ").entries()){if(F.trim!==!1)x[x.length-1]=x.at(-1).trimStart();let w=TD(x.at(-1));if(H!==0){if(w>=u&&(F.wordWrap===!1||F.trim===!1))x.push(""),w=0;if(w>0||F.trim===!1)x[x.length-1]+=" ",w++}if(F.hard&&$[H]>u){let h=u-w,O=1+Math.floor(($[H]-h-1)/u);if(Math.floor(($[H]-1)/u)<O)x.push("");C0(x,N,u);continue}if(w+$[H]>u&&w>0&&$[H]>0){if(F.wordWrap===!1&&w<u){C0(x,N,u);continue}x.push("")}if(w+$[H]>u&&F.wordWrap===!1){C0(x,N,u);continue}x[x.length-1]+=N}if(F.trim!==!1)x=x.map((H)=>A3(H));let S=x.join(`
34
+ `),A=[...S],t=0;for(let[H,N]of A.entries()){if(E+=N,Su.has(N)){let{groups:h}=new RegExp(`(?:\\${eF}(?<code>\\d+)m|\\${Hu}(?<uri>.*)${B0})`).exec(S.slice(t))||{groups:{}};if(h.code!==void 0){let O=Number.parseFloat(h.code);C=O===$3?void 0:O}else if(h.uri!==void 0)B=h.uri.length===0?void 0:h.uri}let w=aF.codes.get(Number(C));if(A[H+1]===`
35
+ `){if(B)E+=pF("");if(C&&w)E+=lF(w)}else if(N===`
36
+ `){if(C&&w)E+=lF(C);if(B)E+=pF(B)}t+=N.length}return E};function $0(D,u,F){return String(D).normalize().replaceAll(`\r
36
37
  `,`
37
38
  `).split(`
38
- `).map((E)=>w3(E,u,F)).join(`
39
+ `).map((E)=>H3(E,u,F)).join(`
39
40
  `)}function x0(D,u){return D.split(`
40
41
  `).flatMap((F)=>$0(F,u,{trim:!1,hard:!0}).split(`
41
42
  `).map((E)=>E.trimEnd())).join(`
42
- `)}function C2(){return E2.default({defaultWidth:80,output:u0().output})}var O2=ZD(x2(),1);import*as h2 from"node:readline";import{AsyncResource as T3}from"node:async_hooks";var ID=[];ID.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")ID.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")ID.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",t0=Symbol.for("signal-exit emitter"),A0=globalThis,h3=Object.defineProperty.bind(Object);class t2{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(A0[t0])return A0[t0];h3(A0,t0,{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 S0{}var O3=(D)=>{return{onExit(u,F){return D.onExit(u,F)},load(){return D.load()},unload(){return D.unload()}}};class A2 extends S0{onExit(){return()=>{}}load(){}unload(){}}class H2 extends S0{#F=H0.platform==="win32"?"SIGINT":"SIGHUP";#u=new t2;#D;#B;#$;#C={};#E=!1;constructor(D){super();this.#D=D,this.#C={};for(let u of ID)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(!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 ID)try{let u=this.#C[D];if(u)this.#D.on(D,u)}catch(u){}this.#D.emit=(D,...u)=>{return this.#t(D,...u)},this.#D.reallyExit=(D)=>{return this.#x(D)}}unload(){if(!this.#E)return;this.#E=!1,ID.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}#x(D){if(!Ru(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)}#t(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 H0=globalThis.process,{onExit:S2,load:S1,unload:R1}=O3(Ru(H0)?new H2(H0):new A2);import{stripVTControlCharacters as f3}from"node:util";var _3="\x1B[G";var w2="\x1B[?25h",R0=(D=1)=>D>0?`\x1B[${D}A`:"",w0=(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`},R2="\x1B[2K",h0=(D)=>D>0?(R2+R0(1)).repeat(D-1)+R2+_3:"";var N2=(D)=>D.split(`
43
- `).length,n3=(D)=>D.split(`
44
- `).pop()??"";class wu{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=n3(D),E=f3(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=C2();if(D=x0(D,B),u=x0(u,B),E.length%B===0)D+=`
43
+ `)}function F2(){return u2.default({defaultWidth:80,output:u0().output})}var N2=vD(B2(),1);import*as w2 from"readline";import{AsyncResource as f3}from"async_hooks";var ID=[];ID.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")ID.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")ID.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",t0=Symbol.for("signal-exit emitter"),A0=globalThis,R3=Object.defineProperty.bind(Object);class $2{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(A0[t0])return A0[t0];R3(A0,t0,{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 S0{}var w3=(D)=>{return{onExit(u,F){return D.onExit(u,F)},load(){return D.load()},unload(){return D.unload()}}};class x2 extends S0{onExit(){return()=>{}}load(){}unload(){}}class t2 extends S0{#F=H0.platform==="win32"?"SIGINT":"SIGHUP";#u=new $2;#D;#B;#$;#C={};#E=!1;constructor(D){super();this.#D=D,this.#C={};for(let u of ID)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(!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 ID)try{let u=this.#C[D];if(u)this.#D.on(D,u)}catch(u){}this.#D.emit=(D,...u)=>{return this.#t(D,...u)},this.#D.reallyExit=(D)=>{return this.#x(D)}}unload(){if(!this.#E)return;this.#E=!1,ID.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}#x(D){if(!Ru(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)}#t(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 H0=globalThis.process,{onExit:A2,load:t1,unload:A1}=w3(Ru(H0)?new t2(H0):new x2);import{stripVTControlCharacters as h3}from"util";var N3="\x1B[G";var S2="\x1B[?25h",R0=(D=1)=>D>0?`\x1B[${D}A`:"",w0=(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`},H2="\x1B[2K",h0=(D)=>D>0?(H2+R0(1)).repeat(D-1)+H2+N3:"";var R2=(D)=>D.split(`
44
+ `).length,O3=(D)=>D.split(`
45
+ `).pop()??"";class wu{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=O3(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=F2();if(D=x0(D,B),u=x0(u,B),E.length%B===0)D+=`
45
46
  `;let $=D+(u?`
46
- `+u:""),S=Math.floor(E.length/B)-this.cursorPos.rows+(u?N2(u):0);if(S>0)$+=R0(S);$+=N0(this.cursorPos.cols),this.write(w0(this.extraLinesUnderPrompt)+h0(this.height)+$),this.extraLinesUnderPrompt=S,this.height=N2($)}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=w0(this.extraLinesUnderPrompt);u+=D?h0(this.height):`
47
- `,u+=w2,this.write(u),this.rl.close()}}class O0 extends Promise{static withResolver(){let D,u;return{promise:new Promise((E,C)=>{D=E,u=C}),resolve:D,reject:u}}}function I3(){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 pD(D){let u=I3();return(E,C={})=>{let{input:B=process.stdin,signal:$}=C,x=new Set,S=new O2.default;S.pipe(C.output??process.stdout);let A=h2.createInterface({terminal:!0,input:B,output:S}),t=new wu(A),{promise:H,resolve:N,reject:w}=O0.withResolver(),h=()=>w(new pu);if($){let I=()=>w(new lu({cause:$.reason}));if($.aborted)return I(),Object.assign(H,{cancel:h});$.addEventListener("abort",I),x.add(()=>$.removeEventListener("abort",I))}x.add(S2((I,J)=>{w(new QD(`User force closed the prompt with ${I} ${J}`))}));let O=()=>w(new QD("User force closed the prompt with SIGINT"));A.on("SIGINT",O),x.add(()=>A.removeListener("SIGINT",O));let f=()=>t.checkCursorPos();return A.input.on("keypress",f),x.add(()=>A.input.removeListener("keypress",f)),LF(A,(I)=>{let J=T3.bind(()=>_D.clearAll());return A.on("close",J),x.add(()=>A.removeListener("close",J)),I(()=>{try{let T=D(E,(SD)=>{setImmediate(()=>N(SD))});if(T===void 0){let SD=u[1]?.getFileName();throw Error(`Prompt functions must return a string.
48
- at ${SD}`)}let[b,e]=typeof T==="string"?[T]:T;t.render(b,e),_D.run()}catch(T){w(T)}}),Object.assign(H.then((T)=>{return _D.clearAll(),T},(T)=>{throw _D.clearAll(),T}).finally(()=>{x.forEach((T)=>T()),t.done({clearContent:Boolean(C.clearPromptOnDone)}),S.end()}).then(()=>H),{cancel:h})})}}function _2(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 f2(D){return D?"Yes":"No"}var BD=pD((D,u)=>{let{transformer:F=f2}=D,[E,C]=l("idle"),[B,$]=l(""),x=nD(D.theme),S=sD({status:E,theme:x});aD((N,w)=>{if(E!=="idle")return;if(iD(N)){let h=_2(B,D.default);$(F(h)),C("done"),u(h)}else if(gD(N)){let h=f2(!_2(B,D.default));w.clearLine(0),w.write(h),$(h)}else $(w.line)});let A=B,t="";if(E==="done")A=x.style.answer(B);else t=` ${x.style.defaultAnswer(D.default===!1?"y/N":"Y/n")}`;let H=x.style.message(D.message,E);return`${S} ${H}${t} ${A}`});var J3={validationFailureMode:"keep"},eD=pD((D,u)=>{let{prefill:F="tab"}=D,E=nD(J3,D.theme),[C,B]=l("idle"),[$="",x]=l(D.default),[S,A]=l(),[t,H]=l(""),N=sD({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}aD(async(J,T)=>{if(C!=="idle")return;if(iD(J)){let b=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(t);A(e),B("idle")}}else if(au(J)&&!t)x(void 0);else if(gD(J)&&!t)x(void 0),T.clearLine(0),T.write($),H($);else H(T.line),A(void 0)}),fD((J)=>{if(F==="editable"&&$)J.write($),H($)},[]);let h=E.style.message(D.message,C),O=t;if(typeof D.transformer==="function")O=D.transformer(t,{isFinal:C==="done"});else if(C==="done")O=E.style.answer(t);let f;if($&&C!=="done"&&!t)f=E.style.defaultAnswer($);let I="";if(S)I=E.style.error(S);return[[N,h,f,O].filter((J)=>J!==void 0).join(" "),I]});class k extends Error{code;constructor(D,u){super(u);this.code=D;this.name="HostError"}}var o2=ZD(d2(),1),z="local",H8={stale:5000,retries:{retries:5,minTimeout:100,maxTimeout:1000,factor:2}};function ju(){return`${Bun.env.HOME||Bun.env.USERPROFILE||"~"}/.config/wt/config.json`}function c2(){let D=new Date().toISOString();return{name:z,ssh:"",root:"",connectTimeout:10,labels:{},createdAt:D,updatedAt:D,lastCheckedAt:D,lastStatus:"ok"}}function g2(){return{version:1,defaultHost:z,hosts:{[z]:c2()},sandboxes:{}}}async function a(){let D=ju(),u=Bun.file(D);if(!await u.exists())return g2();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]=c2();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 i2(D){let u=ju(),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=ju(),F=u.slice(0,u.lastIndexOf("/"));if(await Bun.$`mkdir -p ${F}`.quiet(),!await Bun.file(u).exists())await Bun.write(u,JSON.stringify(g2(),null,2));let C=await o2.default.lock(u,H8);try{let B=await a(),$=await D(B);return await i2(B),$}finally{await C()}}async function g(D){return(await a()).hosts[D]}async function XD(){let D=await a();if(!D.defaultHost)return;return D.hosts[D.defaultHost]}async function Y0(D){return p((u)=>{if(!u.hosts[D])return!1;if(delete u.hosts[D],u.defaultHost===D)u.defaultHost=null;return!0})}var S8=/^[a-z][a-z0-9_-]{0,31}$/;function s2(D){if(!D)throw new k("VALIDATION_ERROR","Host name is required");if(!S8.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 a2(D){if(!D||D.trim()==="")throw new k("VALIDATION_ERROR","SSH target is required")}function l2(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 p2(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 e2(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 Q0(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 $=C.slice(0,B).trim(),x=C.slice(B+1).trim();if(!$)throw new k("VALIDATION_ERROR",`Invalid label: empty key in "${C}"`);u[$]=x}return u}function K0(D){s2(D.name),a2(D.ssh),l2(D.root),p2(D.port),e2(D.connectTimeout)}function VD(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 AD(D){return{ssh:D.ssh,port:D.port,identity:D.identity,connectTimeout:D.connectTimeout}}async function M(D,u){let F=VD(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 zu(D){return M(D,"echo ok")}async function DE(D){return M(D,"git --version")}async function uE(D){return M(D,"node --version")}async function FE(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 M(D,C)}function R8(D){let u=D.match(/git version (\d+\.\d+(?:\.\d+)?)/);return u?u[1]:null}function w8(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 EE(D){let F=(await a()).hosts[D];if(!F)throw new k("HOST_NOT_FOUND",`Host "${D}" not found`);return Mu(F)}async function Mu(D){let u=AD(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 zu(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 FE(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 x=await DE(u);if(x.ok){let A=R8(x.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 S=await uE(u);if(S.ok){let A=w8(S.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 h8(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 W0(D){let u=await EE(D);return await h8(D,u),u}var O8=10;async function y0(D){K0({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],$=new Date().toISOString(),x={name:D.name,ssh:D.ssh,root:D.root,port:D.port,identity:D.identity,connectTimeout:D.connectTimeout??O8,labels:D.labels??{},createdAt:B?.createdAt??$,updatedAt:$,lastCheckedAt:B?.lastCheckedAt??null,lastStatus:B?.lastStatus??"unchecked"},S=B?"updated":"created";if(C.hosts[D.name]=x,D.setDefault)C.defaultHost=D.name;return{host:x,action:S}}),E;if(!D.skipCheck)E=await Mu(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 P0(){let D=await a(),u=Object.values(D.hosts).sort((F,E)=>F.name.localeCompare(E.name));return{defaultHost:D.defaultHost,hosts:u}}function _8(D){let u=[];if(D.checks.ssh.ok)u.push(` ${R.green("")} SSH connection`);else return u.push(` ${R.red("")} SSH connection: ${D.checks.ssh.error}`),u.join(`
49
- `);if(D.checks.directories.ok)u.push(` ${R.green("")} Directory structure`);else u.push(` ${R.red("")} Directory structure: ${D.checks.directories.error||"failed"}`);if(D.checks.git.ok)u.push(` ${R.green("")} git ${D.checks.git.version}`);else u.push(` ${R.red("")} git: ${D.checks.git.error||"not found"}`);if(D.checks.node.ok)u.push(` ${R.green("")} node ${D.checks.node.version}`);else u.push(` ${R.yellow("")} node not found (optional)`);return u.join(`
50
- `)}async function f8(){console.log(R.cyan(`
47
+ `+u:""),S=Math.floor(E.length/B)-this.cursorPos.rows+(u?R2(u):0);if(S>0)$+=R0(S);$+=N0(this.cursorPos.cols),this.write(w0(this.extraLinesUnderPrompt)+h0(this.height)+$),this.extraLinesUnderPrompt=S,this.height=R2($)}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=w0(this.extraLinesUnderPrompt);u+=D?h0(this.height):`
48
+ `,u+=S2,this.write(u),this.rl.close()}}class O0 extends Promise{static withResolver(){let D,u;return{promise:new Promise((E,C)=>{D=E,u=C}),resolve:D,reject:u}}}function _3(){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 pD(D){let u=_3();return(E,C={})=>{let{input:B=process.stdin,signal:$}=C,x=new Set,S=new N2.default;S.pipe(C.output??process.stdout);let A=w2.createInterface({terminal:!0,input:B,output:S}),t=new wu(A),{promise:H,resolve:N,reject:w}=O0.withResolver(),h=()=>w(new pu);if($){let I=()=>w(new lu({cause:$.reason}));if($.aborted)return I(),Object.assign(H,{cancel:h});$.addEventListener("abort",I),x.add(()=>$.removeEventListener("abort",I))}x.add(A2((I,J)=>{w(new YD(`User force closed the prompt with ${I} ${J}`))}));let O=()=>w(new YD("User force closed the prompt with SIGINT"));A.on("SIGINT",O),x.add(()=>A.removeListener("SIGINT",O));let _=()=>t.checkCursorPos();return A.input.on("keypress",_),x.add(()=>A.input.removeListener("keypress",_)),LF(A,(I)=>{let J=f3.bind(()=>fD.clearAll());return A.on("close",J),x.add(()=>A.removeListener("close",J)),I(()=>{try{let T=D(E,(SD)=>{setImmediate(()=>N(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;t.render(b,e),fD.run()}catch(T){w(T)}}),Object.assign(H.then((T)=>{return fD.clearAll(),T},(T)=>{throw fD.clearAll(),T}).finally(()=>{x.forEach((T)=>T()),t.done({clearContent:Boolean(C.clearPromptOnDone)}),S.end()}).then(()=>H),{cancel:h})})}}function h2(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 O2(D){return D?"Yes":"No"}var BD=pD((D,u)=>{let{transformer:F=O2}=D,[E,C]=l("idle"),[B,$]=l(""),x=nD(D.theme),S=sD({status:E,theme:x});aD((N,w)=>{if(E!=="idle")return;if(iD(N)){let h=h2(B,D.default);$(F(h)),C("done"),u(h)}else if(gD(N)){let h=O2(!h2(B,D.default));w.clearLine(0),w.write(h),$(h)}else $(w.line)});let A=B,t="";if(E==="done")A=x.style.answer(B);else t=` ${x.style.defaultAnswer(D.default===!1?"y/N":"Y/n")}`;let H=x.style.message(D.message,E);return`${S} ${H}${t} ${A}`});var n3={validationFailureMode:"keep"},eD=pD((D,u)=>{let{prefill:F="tab"}=D,E=nD(n3,D.theme),[C,B]=l("idle"),[$="",x]=l(D.default),[S,A]=l(),[t,H]=l(""),N=sD({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}aD(async(J,T)=>{if(C!=="idle")return;if(iD(J)){let b=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(t);A(e),B("idle")}}else if(au(J)&&!t)x(void 0);else if(gD(J)&&!t)x(void 0),T.clearLine(0),T.write($),H($);else H(T.line),A(void 0)}),_D((J)=>{if(F==="editable"&&$)J.write($),H($)},[]);let h=E.style.message(D.message,C),O=t;if(typeof D.transformer==="function")O=D.transformer(t,{isFinal:C==="done"});else if(C==="done")O=E.style.answer(t);let _;if($&&C!=="done"&&!t)_=E.style.defaultAnswer($);let I="";if(S)I=E.style.error(S);return[[N,h,_,O].filter((J)=>J!==void 0).join(" "),I]});class k extends Error{code;constructor(D,u){super(u);this.code=D;this.name="HostError"}}var v2=vD(b2(),1),z="local",x8={stale:5000,retries:{retries:5,minTimeout:100,maxTimeout:1000,factor:2}};function ju(){return`${Bun.env.HOME||Bun.env.USERPROFILE||"~"}/.config/wt/config.json`}function d2(){let D=new Date().toISOString();return{name:z,ssh:"",root:"",connectTimeout:10,labels:{},createdAt:D,updatedAt:D,lastCheckedAt:D,lastStatus:"ok"}}function o2(){return{version:1,defaultHost:z,hosts:{[z]:d2()},sandboxes:{}}}async function a(){let D=ju(),u=Bun.file(D);if(!await u.exists())return o2();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]=d2();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 c2(D){let u=ju(),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=ju(),F=u.slice(0,u.lastIndexOf("/"));if(await Bun.$`mkdir -p ${F}`.quiet(),!await Bun.file(u).exists())await Bun.write(u,JSON.stringify(o2(),null,2));let C=await v2.default.lock(u,x8);try{let B=await a(),$=await D(B);return await c2(B),$}finally{await C()}}async function g(D){return(await a()).hosts[D]}async function XD(){let D=await a();if(!D.defaultHost)return;return D.hosts[D.defaultHost]}async function Y0(D){return p((u)=>{if(!u.hosts[D])return!1;if(delete u.hosts[D],u.defaultHost===D)u.defaultHost=null;return!0})}var t8=/^[a-z][a-z0-9_-]{0,31}$/;function g2(D){if(!D)throw new k("VALIDATION_ERROR","Host name is required");if(!t8.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 i2(D){if(!D||D.trim()==="")throw new k("VALIDATION_ERROR","SSH target is required")}function s2(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 a2(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 l2(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 Q0(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 $=C.slice(0,B).trim(),x=C.slice(B+1).trim();if(!$)throw new k("VALIDATION_ERROR",`Invalid label: empty key in "${C}"`);u[$]=x}return u}function K0(D){g2(D.name),i2(D.ssh),s2(D.root),a2(D.port),l2(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 AD(D){return{ssh:D.ssh,port:D.port,identity:D.identity,connectTimeout:D.connectTimeout}}async function M(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 zu(D){return M(D,"echo ok")}async function p2(D){return M(D,"git --version")}async function e2(D){return M(D,"node --version")}async function DE(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 M(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 S8(D){let[u,F]=D.split(".").map(Number);return u>2||u===2&&F>=5}async function uE(D){let F=(await a()).hosts[D];if(!F)throw new k("HOST_NOT_FOUND",`Host "${D}" not found`);return Mu(F)}async function Mu(D){let u=AD(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 zu(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 DE(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 x=await p2(u);if(x.ok){let A=A8(x.stdout);if(A)if(S8(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 S=await e2(u);if(S.ok){let A=H8(S.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 R8(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 W0(D){let u=await uE(D);return await R8(D,u),u}var w8=10;async function y0(D){K0({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],$=new Date().toISOString(),x={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??$,updatedAt:$,lastCheckedAt:B?.lastCheckedAt??null,lastStatus:B?.lastStatus??"unchecked"},S=B?"updated":"created";if(C.hosts[D.name]=x,D.setDefault)C.defaultHost=D.name;return{host:x,action:S}}),E;if(!D.skipCheck)E=await Mu(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 P0(){let D=await a(),u=Object.values(D.hosts).sort((F,E)=>F.name.localeCompare(E.name));return{defaultHost:D.defaultHost,hosts:u}}function N8(D){let u=[];if(D.checks.ssh.ok)u.push(` ${R.green("\u2713")} SSH connection`);else return u.push(` ${R.red("\u2717")} SSH connection: ${D.checks.ssh.error}`),u.join(`
50
+ `);if(D.checks.directories.ok)u.push(` ${R.green("\u2713")} Directory structure`);else u.push(` ${R.red("\u2717")} Directory structure: ${D.checks.directories.error||"failed"}`);if(D.checks.git.ok)u.push(` ${R.green("\u2713")} git ${D.checks.git.version}`);else u.push(` ${R.red("\u2717")} git: ${D.checks.git.error||"not found"}`);if(D.checks.node.ok)u.push(` ${R.green("\u2713")} node ${D.checks.node.version}`);else u.push(` ${R.yellow("\u26A0")} node not found (optional)`);return u.join(`
51
+ `)}async function h8(){console.log(R.cyan(`
51
52
  Add a new host
52
- `));let D=await eD({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 eD({message:"SSH target (alias or user@host):",validate:(B)=>B?!0:"SSH target is required"}),F=await eD({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 BD({message:"Set as default host?",default:!0}),C=await BD({message:"Run connectivity check?",default:!0});return{name:D,ssh:u,root:F,setDefault:E,skipCheck:!C,runCheck:C}}function CE(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 f8();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:Q0(F.labels)};if(!E.skipCheck&&!F.json)console.log(`
53
- Checking ${E.name} (${E.ssh}:${E.root})...`);let B=await y0(E);if(F.json)console.log(JSON.stringify(B,null,2));else{if(B.checkResult)console.log(_8(B.checkResult)),console.log();let $=E.setDefault?R.dim(" (default)"):"",x=B.action==="created"?"Added":"Updated";if(B.checkResult?.ok===!1)console.log(R.yellow(`${x} host "${B.host.name}"${$}, but check failed.`));else console.log(R.green(`${x} host "${B.host.name}"${$}`))}if(B.checkResult&&!B.checkResult.ok)process.exit(2)}catch(E){if(E instanceof QD)console.log(R.dim(`
54
- 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(R.red(`Error: ${E.message}`));process.exit(E.code==="VALIDATION_ERROR"?1:1)}throw E}})}function n8(D){switch(D){case"ok":return R.green("ok");case"error":return R.red("error");default:return R.dim("unchecked")}}function hD(D,u){return D.padEnd(u)}function BE(D){D.command("ls").description("List all configured hosts").option("--json","Output as JSON").action(async(u)=>{let F=await P0();if(u.json){console.log(JSON.stringify(F,null,2));return}if(F.hosts.length===0){console.log(R.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(R.bold(hD("NAME",E)+hD("SSH",C)+hD("ROOT",B)+hD("DEFAULT",9)+"STATUS"));for(let $ of F.hosts){let S=$.name===F.defaultHost?R.cyan("*"):R.dim("-");console.log(hD($.name,E)+hD($.ssh,C)+hD($.root,B)+hD(S,9)+n8($.lastStatus))}})}function T8(D,u,F){let E=[];if(E.push(`Checking ${D.host} (${u}:${F})...`),D.checks.ssh.ok)E.push(` ${R.green("")} SSH connection`);else E.push(` ${R.red("")} SSH connection: ${D.checks.ssh.error}`);if(D.checks.ssh.ok){if(D.checks.directories.ok)E.push(` ${R.green("")} Directory structure`);else E.push(` ${R.red("")} Directory structure: ${D.checks.directories.error||"failed"}`);if(D.checks.git.ok)E.push(` ${R.green("")} git ${D.checks.git.version}`);else E.push(` ${R.red("")} git: ${D.checks.git.error||"not found"}`);if(D.checks.node.ok)E.push(` ${R.green("")} node ${D.checks.node.version}`);else E.push(` ${R.yellow("")} node not found (optional)`)}return E.join(`
55
- `)}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(R.red(`Error: Host "${u}" not found`));process.exit(1)}let C=await W0(u);if(F.json)console.log(JSON.stringify(C,null,2));else if(console.log(T8(C,E.ssh,E.root)),console.log(),C.ok)console.log(R.green(`Host "${u}" is ready.`));else console.log(R.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(R.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("-f, --force","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(R.red(`Error: Host "${u}" not found`));process.exit(1)}if(!F.force&&!F.json){if(!await BD({message:`Remove host "${u}" (${E.ssh})?`,default:!1})){console.log(R.dim("Cancelled."));return}}let C=await Y0(u);if(F.json)console.log(JSON.stringify({ok:C,removed:u},null,2));else console.log(R.green(`Removed host "${u}"`))})}function V0(D){let u=D.command("host").description("Manage remote compute hosts");CE(u),BE(u),$E(u),xE(u)}class _ extends Error{code;constructor(D,u){super(u);this.code=D;this.name="SandboxError"}}async function tE(){try{let D=await Bun.$`git remote get-url origin`.quiet().nothrow();if(D.exitCode!==0)throw new _("GIT_ERROR","No git remote 'origin' found");return D.stdout.toString().trim()}catch(D){if(D instanceof _)throw D;throw new _("NOT_IN_GIT_REPO","Not inside a git repository")}}async function AE(){let D=await Bun.$`git rev-parse HEAD`.quiet().nothrow();if(D.exitCode!==0)throw new _("GIT_ERROR","Failed to resolve HEAD");return D.stdout.toString().trim()}async function HE(){let D=await Bun.$`git rev-parse --show-toplevel`.quiet().nothrow();if(D.exitCode!==0)throw new _("NOT_IN_GIT_REPO","Not inside a git repository");return D.stdout.toString().trim()}async function Uu(){return(await Bun.$`git rev-parse --is-inside-work-tree`.quiet().nothrow()).exitCode===0}async function Zu(){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 Lu(D){return(D.includes("/")?D.split("/").pop():D).replace(/[^a-zA-Z0-9._-]/g,"-").replace(/^-+|-+$/g,"")}import{webcrypto as RE}from"node:crypto";var SE="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var I8=128,MD,kD;function J8(D){if(!MD||MD.length<D)MD=Buffer.allocUnsafe(D*I8),RE.getRandomValues(MD),kD=0;else if(kD+D>MD.length)RE.getRandomValues(MD),kD=0;kD+=D}function wE(D=21){J8(D|=0);let u="";for(let F=kD-D;F<kD;F++)u+=SE[MD[F]&63];return u}function NE(){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 Yu{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 B=await Bun.$`git clone --bare --mirror ${F} ${E}`.quiet().nothrow();if(B.exitCode!==0)throw Error(`Failed to create mirror: ${B.stderr.toString().trim()}`)}else await Bun.$`git -C ${E} fetch --prune origin`.quiet().nothrow();return E}async createWorktree(D,u,F){let E=await Bun.$`git -C ${D} worktree add --detach ${u} ${F}`.quiet().nothrow();if(E.exitCode!==0)throw Error(`Failed to create worktree: ${E.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(`
56
- `).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 k0(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 Qu{host;constructor(D){this.host=D}get sshOpts(){return AD(this.host)}async ensureLayout(D){let u=["mirrors","sandboxes","meta"].map((E)=>`${D}/${E}`).join(" "),F=await M(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 M(this.sshOpts,`test -f ${E}/HEAD`)).ok){let B=await M(this.sshOpts,`git clone --bare --mirror ${F} ${E}`);if(!B.ok)throw Error(`Failed to create remote mirror: ${B.stderr}`)}else await M(this.sshOpts,`git -C ${E} fetch --prune origin`);return E}async createWorktree(D,u,F){let E=await M(this.sshOpts,`git -C ${D} worktree add --detach ${u} ${F}`);if(!E.ok)throw Error(`Failed to create remote worktree: ${E.stderr}`)}async writeMeta(D,u,F){let E=`${D}/meta/${u}.json`,B=JSON.stringify(F,null,2).replace(/'/g,"'\\''"),$=await M(this.sshOpts,`printf '%s' '${B}' > ${E}`);if(!$.ok)throw Error(`Failed to write remote meta: ${$.stderr}`)}async removeSandboxDir(D){await M(this.sshOpts,`rm -rf ${D}`)}async pruneWorktrees(D){await M(this.sshOpts,`git -C ${D} worktree prune`)}async removeMeta(D,u){await M(this.sshOpts,`rm -f ${D}/meta/${u}.json`)}async dirExists(D){return(await M(this.sshOpts,`test -d ${D}`)).ok}async exec(D,u){let F=u.map((C)=>`'${C.replace(/'/g,"'\\''")}'`).join(" "),E=await M(this.sshOpts,`cd ${D} && ${F}`);return{exitCode:E.exitCode,stdout:E.stdout,stderr:E.stderr}}async execStream(D,u){let F=u.map(($)=>`'${$.replace(/'/g,"'\\''")}'`).join(" "),E=k0(VD(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=k0(VD(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=k0(VD(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 M(this.sshOpts,"tmux ls -F '#{session_name}\t#{session_attached}'");if(!D.ok)return[];return D.stdout.trim().split(`
57
- `).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 S of F.scan({cwd:D,onlyFiles:!0,dot:!0}))E.push(S);if(E.length===0)return;let C=VD(this.sshOpts),B=C.pop(),$=C.filter((S)=>S!=="-o"||!0),x=[];for(let S=0;S<C.length;S++)if(C[S]==="-p")x.push("-P",C[S+1]),S++;else if(C[S]==="-i")x.push("-i",C[S+1]),S++;else if(C[S]==="-o")x.push("-o",C[S+1]),S++;for(let S of E){let A=`${D}/${S}`,t=`${B}:${u}/${S}`;await Bun.$`scp ${x} ${A} ${t}`.quiet().nothrow()}}async checkGit(){let D=await M(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 M(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 M(this.sshOpts,"bun --version");if(D.ok)return{name:"bun",ok:!0,detail:D.stdout.trim()};let u=await M(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 P(D){if(D===z)return new Yu;let u=await g(D);if(!u)throw new _("HOST_NOT_FOUND",`Host "${D}" not found`);return new Qu(u)}async function $D(D){if(D===z)return`${await HE()}/.wt`;let u=await g(D);if(!u)throw new _("HOST_NOT_FOUND",`Host "${D}" not found`);return u.root}async function m0(D){return(await a()).sandboxes[D]}async function OE(D){await p((u)=>{u.sandboxes[D.name]=D})}async function _E(){let D=await a();return Object.values(D.sandboxes).sort((u,F)=>u.name.localeCompare(F.name))}async function HD(D){let u=await m0(D);if(!u)throw new _("SANDBOX_NOT_FOUND",`Sandbox "${D}" not found`);return u}async function fE(D,u){let F=await p((E)=>{let C=E.sandboxes[D];if(!C)throw new _("SANDBOX_NOT_FOUND",`Sandbox "${D}" not found`);if(E.sandboxes[u])throw new _("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 P(F.host),C=await $D(F.host);await E.writeMeta(C,F.id,F)}catch{}return F}async function Ku(D){let u=await tE(),F=await hE(u),E=D.ref??await AE(),C=await P(D.hostName),B=await $D(D.hostName),$=await m0(D.name);if($){if($.host===D.hostName&&$.repoId===F){if(await C.dirExists($.path))return{entry:$,isIdempotent:!0}}throw new _("SANDBOX_EXISTS",`Sandbox "${D.name}" already exists (host=${$.host}, repoId=${$.repoId})`)}let x=NE(),S=`${B}/sandboxes/${x}`;try{await C.ensureLayout(B);let A=await C.ensureMirror(B,F,u);await C.createWorktree(A,S,E),await C.copyEnvFiles(process.cwd(),S);let t={name:D.name,id:x,host:D.hostName,origin:u,repoId:F,ref:E,path:S,createdAt:new Date().toISOString()};return await C.writeMeta(B,x,t),await OE(t),{entry:t,isIdempotent:!1}}catch(A){if(A instanceof _)throw A;throw new _("CREATION_FAILED",A instanceof Error?A.message:String(A))}}async function nE(D){let u=await HD(D),F=await P(u.host);if(!await F.dirExists(u.path))throw new _("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 TE(D){let u=await HD(D),F=await P(u.host);if(!await F.dirExists(u.path))throw new _("PATH_MISSING",`Sandbox path does not exist: ${u.path}`);if(!(await F.checkTmux()).ok)throw new _("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 Wu(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 r0(D){D.command("up").description("Create a sandbox worktree on a host").argument("[name]","Sandbox name (defaults to branch name from --ref or current branch)").option("-H, --host <hostName>","Target host (defaults to configured default)").option("-b, --branch <ref>","Git branch, tag, or sha (defaults to HEAD)").option("-r, --ref <ref>","Alias for --branch").option("--json","Output result as JSON").action(async(u,F)=>{try{if(!await Uu()){if(F.json)console.log(JSON.stringify({ok:!1,error:"Not inside a git repository"},null,2));else console.error(R.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(R.red("Error: Cannot use both --branch and --ref"));process.exit(1)}let E=F.branch??F.ref,C=u;if(!C){let A=E??await Zu();if(A)C=Lu(A);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(R.red("Error: No name provided and could not determine branch name"));process.exit(1)}}let B;if(F.host){if(B=F.host,B!==z){if(!await g(B)){if(F.json)console.log(JSON.stringify({ok:!1,error:`Host "${B}" not found`},null,2));else console.error(R.red(`Error: Host "${B}" not found`));process.exit(1)}}}else B=(await XD())?.name??z;let $=await Ku({name:C,hostName:B,ref:E});if(F.json){console.log(JSON.stringify($.entry,null,2));return}if($.isIdempotent)console.log(R.dim(`Sandbox "${C}" already exists`));let x=B!==z?await g(B):void 0,S=Wu($.entry,x??void 0);console.log(S)}catch(E){if(E instanceof _){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(R.red(`Error: ${E.message}`));process.exit(1)}throw E}})}function b0(D){D.command("local").description("Create a local sandbox worktree").argument("[name]","Sandbox name (defaults to branch name from --ref or current branch)").option("-b, --branch <ref>","Git branch, tag, or sha (defaults to HEAD)").option("-r, --ref <ref>","Alias for --branch").option("--json","Output result as JSON").action(async(u,F)=>{try{if(!await Uu()){if(F.json)console.log(JSON.stringify({ok:!1,error:"Not inside a git repository"},null,2));else console.error(R.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(R.red("Error: Cannot use both --branch and --ref"));process.exit(1)}let E=F.branch??F.ref,C=u;if(!C){let x=E??await Zu();if(x)C=Lu(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(R.red("Error: No name provided and could not determine branch name"));process.exit(1)}}let B=await Ku({name:C,hostName:z,ref:E});if(F.json){console.log(JSON.stringify(B.entry,null,2));return}if(B.isIdempotent)console.log(R.dim(`Sandbox "${C}" already exists`));let $=Wu(B.entry);console.log($)}catch(E){if(E instanceof _){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(R.red(`Error: ${E.message}`));process.exit(1)}throw E}})}function v0(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 HD(u);console.log(JSON.stringify(E,null,2));return}if(F.tmux)await TE(u);else await nE(u)}catch(E){if(E instanceof _){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(R.red(`Error: ${E.message}`));process.exit(1)}throw E}})}async function IE(D,u,F){let E=await HD(D),C=await P(E.host);if(!await C.dirExists(E.path))throw new _("PATH_MISSING",`Sandbox path does not exist: ${E.path}`);if(F.capture){let x=await C.exec(E.path,u);return{name:E.name,id:E.id,host:E.host,path:E.path,command:u,exitCode:x.exitCode,stdout:x.stdout,stderr:x.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 d0(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(R.red("Error: No command specified")),process.exit(1);let B=await IE(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 _){if(E.json)console.log(JSON.stringify({ok:!1,error:C.message},null,2));else if(!E.quiet)console.error(R.red(`Error: ${C.message}`));process.exit(1)}throw C}})}async function JE(D){let u=await P(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 o0(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 XD())?.name??z;let E=await JE(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(R.yellow(`Warning: ${C}`));if(E.sessions.length===0){console.log(R.dim("No active sessions."));return}for(let C of E.sessions){let B=C.attached?R.green("attached"):R.dim("detached");console.log(`${C.name} ${B}`)}})}var jE=ZD(GE(),1);async function c0(D){let u=jE.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((H)=>H.host===D.hostName):B,x=[],S=[],A=[],t=new Set;for(let H of $){let w=new Date(H.createdAt).getTime()<C;if(!w)try{if(!await(await P(H.host)).dirExists(H.path))w=!0}catch{w=!0}if(!w){S.push(H);continue}if(D.dryRun){x.push(H);continue}try{let h=await P(H.host),O=await $D(H.host);await h.removeSandboxDir(H.path),await h.removeMeta(O,H.id),t.add(`${H.host}:${O}/mirrors/${H.repoId}.git`),x.push(H)}catch(h){A.push({sandbox:H.name,error:h instanceof Error?h.message:String(h)})}}if(!D.dryRun&&x.length>0)await p((H)=>{for(let N of x)delete H.sandboxes[N.name]});if(!D.dryRun)for(let H of t){let[N,w]=H.split(":",2);try{await(await P(N)).pruneWorktrees(w)}catch{}}return{deleted:x,kept:S,errors:A}}function g0(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 c0({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(R.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(` ${R.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(` ${R.red("-")} ${C.name} (${C.host})`)}if(!u.yes&&!u.json){if(!await BD({message:`Delete ${F.deleted.length} sandbox(es)?`,default:!1})){console.log(R.dim("Cancelled."));return}}let E=await c0({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(R.red(`Error (${C.sandbox}): ${C.error}`));process.exit(1)}}catch(F){if(u.json)console.log(JSON.stringify({ok:!1,error:F instanceof Error?F.message:String(F)},null,2));else console.error(R.red(`Error: ${F instanceof Error?F.message:String(F)}`));process.exit(1)}})}async function XE(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 t=await zu(AD(A)),H=t.ok?{name:"ssh",ok:!0,detail:"connected"}:{name:"ssh",ok:!1,detail:t.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 P(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 x=await C.checkTmux();if(u.push(x),!x.ok)F.push(`tmux: ${x.detail}`);return{ok:u.every((A)=>A.ok||A.name==="tmux"||A.name==="runtime"),host:D,checks:u,warnings:F,errors:E}}function i0(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 XD())?.name??z;let E=await XE(F);if(u.json){console.log(JSON.stringify(E,null,2));return}for(let C of E.checks)if(C.ok)console.log(` ${R.green("✓")} ${C.name}${C.detail?` (${C.detail})`:""}`);else console.log(` ${R.red("✗")} ${C.name}${C.detail?`: ${C.detail}`:""}`);if(E.warnings.length>0)for(let C of E.warnings)console.log(` ${R.yellow("⚠")} ${C}`);if(console.log(),E.ok)console.log(R.green(`Host "${F}" is healthy.`));else console.log(R.red(`Host "${F}" has issues.`)),process.exit(1)})}async function M8(D){let u=await g(D);if(!u)return null;let F=AD(u);for(let E of["apt-get","apk","dnf","yum","brew"])if((await M(F,`command -v ${E}`)).ok)return E;return null}function U8(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 zE(D){let u=[],F=[],E=[],C=D.hostName===z,B=await P(D.hostName),$=await B.checkGit();if(u.push($),!$.ok)F.push("git");let x=await B.checkRuntime();if(u.push(x),!x.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 _("HOST_NOT_FOUND",`Host "${D.hostName}" not found`);let t=AD(A);for(let H of["bash","curl"]){let w=(await M(t,`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 M(t,`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 M8(D.hostName);if(H)for(let N of F)if(N==="bun or node")E.push("curl -fsSL https://bun.sh/install | bash");else if(N==="claude"||N==="opencode")E.push(`npm install -g ${N}`);else E.push(U8(N,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 S=F.length===0&&u.every((A)=>A.ok);return{host:D.hostName,ok:S,checks:u,missing:F,instructions:E}}function s0(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 zE({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(` ${R.green("✓")} ${C.name}${C.detail?` (${C.detail})`:""}`);else console.log(` ${R.red("✗")} ${C.name}${C.detail?`: ${C.detail}`:""}`);if(E.missing.length>0)console.log(),console.log(R.yellow(`Missing: ${E.missing.join(", ")}`));if(E.instructions.length>0){console.log(),console.log(R.dim("Install instructions:"));for(let C of E.instructions)console.log(` ${C}`)}if(console.log(),E.ok)console.log(R.green(`Host "${u.host}" is ready.`));else console.log(R.red(`Host "${u.host}" is not ready.`)),process.exit(1)}catch(F){if(F instanceof _){if(u.json)console.log(JSON.stringify({ok:!1,error:F.message},null,2));else console.error(R.red(`Error: ${F.message}`));process.exit(1)}throw F}})}async function ME(D){let u=await _E(),F=D.hostName?u.filter((E)=>E.host===D.hostName):u;return{sandboxes:F,total:F.length}}function a0(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 ME({hostName:u.host});if(u.json){console.log(JSON.stringify(F,null,2));return}if(F.total===0){console.log(R.dim("No sandboxes found."));return}let E=Math.max(...F.sandboxes.map(($)=>$.name.length),4),C=Math.max(...F.sandboxes.map(($)=>$.host.length),4),B=Math.max(...F.sandboxes.map(($)=>$.ref.substring(0,8).length),3);console.log(R.bold(`${"NAME".padEnd(E)} ${"HOST".padEnd(C)} ${"REF".padEnd(B)} CREATED`));for(let $ of F.sandboxes){let x=$.ref.substring(0,8),S=new Date($.createdAt).toLocaleDateString();console.log(`${R.cyan($.name.padEnd(E))} ${$.host.padEnd(C)} ${R.yellow(x.padEnd(B))} ${R.dim(S)}`)}console.log(R.dim(`
58
- ${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(R.red(`Error: ${F instanceof Error?F.message:String(F)}`));process.exit(1)}})}async function UE(D){let F=(await a()).sandboxes[D];if(!F)throw new _("SANDBOX_NOT_FOUND",`Sandbox "${D}" not found`);let E=await P(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(($)=>{delete $.sandboxes[D]}),B.config=!0;try{let $=`${C}/mirrors/${F.repoId}.git`;await E.pruneWorktrees($)}catch{}return{entry:F,cleaned:B}}function l0(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 BD({message:`Remove sandbox "${u}"?`,default:!1})){console.log(R.dim("Cancelled."));return}}let E=await UE(u);if(F.json){console.log(JSON.stringify(E,null,2));return}console.log(`Removed sandbox ${R.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(R.yellow(` Warning: could not clean ${C.join(", ")}`))}catch(E){if(E instanceof _){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(R.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 ZE(D){let u=await HD(D),F=await P(u.host),E=!1;try{E=await F.dirExists(u.path)}catch{}let C=null;try{let B=await F.listTmuxSessions(),$=`wt-${u.id}`,x=B.find((S)=>S.name===$);if(x)C=x.name}catch{}return{entry:u,dirExists:E,tmuxSession:C,age:Z8(u.createdAt)}}function p0(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 ZE(u);if(F.json){console.log(JSON.stringify(E,null,2));return}let{entry:C,dirExists:B,tmuxSession:$,age:x}=E;console.log(R.bold(C.name)),console.log(` ${"ID".padEnd(10)} ${R.dim(C.id)}`),console.log(` ${"Host".padEnd(10)} ${C.host}`),console.log(` ${"Ref".padEnd(10)} ${R.yellow(C.ref.substring(0,8))}`),console.log(` ${"Origin".padEnd(10)} ${R.dim(C.origin)}`),console.log(` ${"Path".padEnd(10)} ${C.path}`),console.log(` ${"Age".padEnd(10)} ${x}`);let S=B?R.green("exists"):R.red("missing");console.log(` ${"Dir".padEnd(10)} ${S}`);let A=$?R.green($):R.dim("none");console.log(` ${"Tmux".padEnd(10)} ${A}`)}catch(E){if(E instanceof _){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(R.red(`Error: ${E.message}`));process.exit(1)}throw E}})}function e0(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 fE(u,F);if(E.json){console.log(JSON.stringify(C,null,2));return}console.log(R.green(`Renamed "${u}" -> "${F}"`))}catch(C){if(C instanceof _){if(E.json)console.log(JSON.stringify({ok:!1,error:C.message},null,2));else console.error(R.red(`Error: ${C.message}`));process.exit(1)}throw C}})}var i=new fF,LE="0.0.1";function L8(D,u=""){let F=[],E=D.name(),C=D.registeredArguments.map((x)=>x.required?`<${x.name()}>`:`[${x.name()}]`).join(" "),B=C?`${E} ${C}`:E;F.push(`${u}${B}`);let $=D.commands.filter((x)=>x.name()!=="help");return $.forEach((x,S)=>{let A=S===$.length-1,t=A?"└── ":"├── ",H=u+(A?" ":" "),N=x.name(),w=x.registeredArguments.map((f)=>f.required?`<${f.name()}>`:`[${f.name()}]`).join(" "),h=w?`${N} ${w}`:N,O=x.commands.filter((f)=>f.name()!=="help");if(O.length>0)F.push(`${u}${t}${h}`),O.forEach((f,I)=>{let T=I===O.length-1?"└── ":"├── ",b=f.name(),e=f.registeredArguments.map((vD)=>vD.required?`<${vD.name()}>`:`[${vD.name()}]`).join(" "),SD=e?`${b} ${e}`:b;F.push(`${H}${T}${SD}`)});else F.push(`${u}${t}${h}`)}),F}i.name("wt").enablePositionalOptions().description("Run worktrees, coding agents, and more all from the cloud. SSH included, agents too!").version(LE,"-v, --version").option("--tree","Show command tree").action((D)=>{if(D.tree){console.log(L8(i).join(`
53
+ `));let D=await eD({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 eD({message:"SSH target (alias or user@host):",validate:(B)=>B?!0:"SSH target is required"}),F=await eD({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 BD({message:"Set as default host?",default:!0}),C=await BD({message:"Run connectivity check?",default:!0});return{name:D,ssh:u,root:F,setDefault:E,skipCheck:!C,runCheck:C}}function FE(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:Q0(F.labels)};if(!E.skipCheck&&!F.json)console.log(`
54
+ Checking ${E.name} (${E.ssh}:${E.root})...`);let B=await y0(E);if(F.json)console.log(JSON.stringify(B,null,2));else{if(B.checkResult)console.log(N8(B.checkResult)),console.log();let $=E.setDefault?R.dim(" (default)"):"",x=B.action==="created"?"Added":"Updated";if(B.checkResult?.ok===!1)console.log(R.yellow(`${x} host "${B.host.name}"${$}, but check failed.`));else console.log(R.green(`${x} host "${B.host.name}"${$}`))}if(B.checkResult&&!B.checkResult.ok)process.exit(2)}catch(E){if(E instanceof YD)console.log(R.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(R.red(`Error: ${E.message}`));process.exit(E.code==="VALIDATION_ERROR"?1:1)}throw E}})}function O8(D){switch(D){case"ok":return R.green("ok");case"error":return R.red("error");default:return R.dim("unchecked")}}function hD(D,u){return D.padEnd(u)}function EE(D){D.command("ls").description("List all configured hosts").option("--json","Output as JSON").action(async(u)=>{let F=await P0();if(u.json){console.log(JSON.stringify(F,null,2));return}if(F.hosts.length===0){console.log(R.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(R.bold(hD("NAME",E)+hD("SSH",C)+hD("ROOT",B)+hD("DEFAULT",9)+"STATUS"));for(let $ of F.hosts){let S=$.name===F.defaultHost?R.cyan("*"):R.dim("-");console.log(hD($.name,E)+hD($.ssh,C)+hD($.root,B)+hD(S,9)+O8($.lastStatus))}})}function f8(D,u,F){let E=[];if(E.push(`Checking ${D.host} (${u}:${F})...`),D.checks.ssh.ok)E.push(` ${R.green("\u2713")} SSH connection`);else E.push(` ${R.red("\u2717")} SSH connection: ${D.checks.ssh.error}`);if(D.checks.ssh.ok){if(D.checks.directories.ok)E.push(` ${R.green("\u2713")} Directory structure`);else E.push(` ${R.red("\u2717")} Directory structure: ${D.checks.directories.error||"failed"}`);if(D.checks.git.ok)E.push(` ${R.green("\u2713")} git ${D.checks.git.version}`);else E.push(` ${R.red("\u2717")} git: ${D.checks.git.error||"not found"}`);if(D.checks.node.ok)E.push(` ${R.green("\u2713")} node ${D.checks.node.version}`);else E.push(` ${R.yellow("\u26A0")} node not found (optional)`)}return E.join(`
56
+ `)}function CE(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(R.red(`Error: Host "${u}" not found`));process.exit(1)}let C=await W0(u);if(F.json)console.log(JSON.stringify(C,null,2));else if(console.log(f8(C,E.ssh,E.root)),console.log(),C.ok)console.log(R.green(`Host "${u}" is ready.`));else console.log(R.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(R.red(`Error: ${E.message}`));process.exit(E.code==="HOST_NOT_FOUND"?1:1)}throw E}})}function BE(D){D.command("rm").description("Remove a host configuration").argument("<name>","Host to remove").option("-f, --force","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(R.red(`Error: Host "${u}" not found`));process.exit(1)}if(!F.force&&!F.json){if(!await BD({message:`Remove host "${u}" (${E.ssh})?`,default:!1})){console.log(R.dim("Cancelled."));return}}let C=await Y0(u);if(F.json)console.log(JSON.stringify({ok:C,removed:u},null,2));else console.log(R.green(`Removed host "${u}"`))})}function V0(D){let u=D.command("host").description("Manage remote compute hosts");FE(u),EE(u),CE(u),BE(u)}class f extends Error{code;constructor(D,u){super(u);this.code=D;this.name="SandboxError"}}async function $E(){try{let D=await Bun.$`git remote get-url origin`.quiet().nothrow();if(D.exitCode!==0)throw new f("GIT_ERROR","No git remote 'origin' found");return D.stdout.toString().trim()}catch(D){if(D instanceof f)throw D;throw new f("NOT_IN_GIT_REPO","Not inside a git repository")}}async function xE(){let D=await Bun.$`git rev-parse HEAD`.quiet().nothrow();if(D.exitCode!==0)throw new f("GIT_ERROR","Failed to resolve HEAD");return D.stdout.toString().trim()}async function tE(){let D=await Bun.$`git rev-parse --show-toplevel`.quiet().nothrow();if(D.exitCode!==0)throw new f("NOT_IN_GIT_REPO","Not inside a git repository");return D.stdout.toString().trim()}async function Uu(){return(await Bun.$`git rev-parse --is-inside-work-tree`.quiet().nothrow()).exitCode===0}async function Zu(){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 Lu(D){return(D.includes("/")?D.split("/").pop():D).replace(/[^a-zA-Z0-9._-]/g,"-").replace(/^-+|-+$/g,"")}import{webcrypto as HE}from"crypto";var AE="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var _8=128,MD,VD;function n8(D){if(!MD||MD.length<D)MD=Buffer.allocUnsafe(D*_8),HE.getRandomValues(MD),VD=0;else if(VD+D>MD.length)HE.getRandomValues(MD),VD=0;VD+=D}function SE(D=21){n8(D|=0);let u="";for(let F=VD-D;F<VD;F++)u+=AE[MD[F]&63];return u}function RE(){return SE(12)}async function wE(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 Yu{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 B=await Bun.$`git clone --bare --mirror ${F} ${E}`.quiet().nothrow();if(B.exitCode!==0)throw Error(`Failed to create mirror: ${B.stderr.toString().trim()}`)}else await Bun.$`git -C ${E} fetch --prune origin`.quiet().nothrow();return E}async createWorktree(D,u,F){let E=await Bun.$`git -C ${D} worktree add --detach ${u} ${F}`.quiet().nothrow();if(E.exitCode!==0)throw Error(`Failed to create worktree: ${E.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(`
57
+ `).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 k0(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 Qu{host;constructor(D){this.host=D}get sshOpts(){return AD(this.host)}async ensureLayout(D){let u=["mirrors","sandboxes","meta"].map((E)=>`${D}/${E}`).join(" "),F=await M(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 M(this.sshOpts,`test -f ${E}/HEAD`)).ok){let B=await M(this.sshOpts,`git clone --bare --mirror ${F} ${E}`);if(!B.ok)throw Error(`Failed to create remote mirror: ${B.stderr}`)}else await M(this.sshOpts,`git -C ${E} fetch --prune origin`);return E}async createWorktree(D,u,F){let E=await M(this.sshOpts,`git -C ${D} worktree add --detach ${u} ${F}`);if(!E.ok)throw Error(`Failed to create remote worktree: ${E.stderr}`)}async writeMeta(D,u,F){let E=`${D}/meta/${u}.json`,B=JSON.stringify(F,null,2).replace(/'/g,"'\\''"),$=await M(this.sshOpts,`printf '%s' '${B}' > ${E}`);if(!$.ok)throw Error(`Failed to write remote meta: ${$.stderr}`)}async removeSandboxDir(D){await M(this.sshOpts,`rm -rf ${D}`)}async pruneWorktrees(D){await M(this.sshOpts,`git -C ${D} worktree prune`)}async removeMeta(D,u){await M(this.sshOpts,`rm -f ${D}/meta/${u}.json`)}async dirExists(D){return(await M(this.sshOpts,`test -d ${D}`)).ok}async exec(D,u){let F=u.map((C)=>`'${C.replace(/'/g,"'\\''")}'`).join(" "),E=await M(this.sshOpts,`cd ${D} && ${F}`);return{exitCode:E.exitCode,stdout:E.stdout,stderr:E.stderr}}async execStream(D,u){let F=u.map(($)=>`'${$.replace(/'/g,"'\\''")}'`).join(" "),E=k0(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=k0(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=k0(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 M(this.sshOpts,"tmux ls -F '#{session_name}\t#{session_attached}'");if(!D.ok)return[];return D.stdout.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*"),E=[];for await(let S of F.scan({cwd:D,onlyFiles:!0,dot:!0}))E.push(S);if(E.length===0)return;let C=PD(this.sshOpts),B=C.pop(),$=C.filter((S)=>S!=="-o"||!0),x=[];for(let S=0;S<C.length;S++)if(C[S]==="-p")x.push("-P",C[S+1]),S++;else if(C[S]==="-i")x.push("-i",C[S+1]),S++;else if(C[S]==="-o")x.push("-o",C[S+1]),S++;for(let S of E){let A=`${D}/${S}`,t=`${B}:${u}/${S}`;await Bun.$`scp ${x} ${A} ${t}`.quiet().nothrow()}}async checkGit(){let D=await M(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 M(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 M(this.sshOpts,"bun --version");if(D.ok)return{name:"bun",ok:!0,detail:D.stdout.trim()};let u=await M(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 Yu;let u=await g(D);if(!u)throw new f("HOST_NOT_FOUND",`Host "${D}" not found`);return new Qu(u)}async function $D(D){if(D===z)return`${await tE()}/.wt`;let u=await g(D);if(!u)throw new f("HOST_NOT_FOUND",`Host "${D}" not found`);return u.root}async function m0(D){return(await a()).sandboxes[D]}async function NE(D){await p((u)=>{u.sandboxes[D.name]=D})}async function hE(){let D=await a();return Object.values(D.sandboxes).sort((u,F)=>u.name.localeCompare(F.name))}async function HD(D){let u=await m0(D);if(!u)throw new f("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 f("SANDBOX_NOT_FOUND",`Sandbox "${D}" not found`);if(E.sandboxes[u])throw new f("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 Ku(D){let u=await $E(),F=await wE(u),E=D.ref??await xE(),C=await y(D.hostName),B=await $D(D.hostName),$=await m0(D.name);if($){if($.host===D.hostName&&$.repoId===F){if(await C.dirExists($.path))return{entry:$,isIdempotent:!0}}throw new f("SANDBOX_EXISTS",`Sandbox "${D.name}" already exists (host=${$.host}, repoId=${$.repoId})`)}let x=RE(),S=`${B}/sandboxes/${x}`;try{await C.ensureLayout(B);let A=await C.ensureMirror(B,F,u);await C.createWorktree(A,S,E),await C.copyEnvFiles(process.cwd(),S);let t={name:D.name,id:x,host:D.hostName,origin:u,repoId:F,ref:E,path:S,createdAt:new Date().toISOString()};return await C.writeMeta(B,x,t),await NE(t),{entry:t,isIdempotent:!1}}catch(A){if(A instanceof f)throw A;throw new f("CREATION_FAILED",A instanceof Error?A.message:String(A))}}async function fE(D){let u=await HD(D),F=await y(u.host);if(!await F.dirExists(u.path))throw new f("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 _E(D){let u=await HD(D),F=await y(u.host);if(!await F.dirExists(u.path))throw new f("PATH_MISSING",`Sandbox path does not exist: ${u.path}`);if(!(await F.checkTmux()).ok)throw new f("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 Wu(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 r0(D){D.command("up").description("Create a sandbox worktree on a host").argument("[name]","Sandbox name (defaults to branch name from --ref or current branch)").option("-H, --host <hostName>","Target host (defaults to configured default)").option("-b, --branch <ref>","Git branch, tag, or sha (defaults to HEAD)").option("-r, --ref <ref>","Alias for --branch").option("--json","Output result as JSON").action(async(u,F)=>{try{if(!await Uu()){if(F.json)console.log(JSON.stringify({ok:!1,error:"Not inside a git repository"},null,2));else console.error(R.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(R.red("Error: Cannot use both --branch and --ref"));process.exit(1)}let E=F.branch??F.ref,C=u;if(!C){let A=E??await Zu();if(A)C=Lu(A);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(R.red("Error: No name provided and could not determine branch name"));process.exit(1)}}let B;if(F.host){if(B=F.host,B!==z){if(!await g(B)){if(F.json)console.log(JSON.stringify({ok:!1,error:`Host "${B}" not found`},null,2));else console.error(R.red(`Error: Host "${B}" not found`));process.exit(1)}}}else B=(await XD())?.name??z;let $=await Ku({name:C,hostName:B,ref:E});if(F.json){console.log(JSON.stringify($.entry,null,2));return}if($.isIdempotent)console.log(R.dim(`Sandbox "${C}" already exists`));let x=B!==z?await g(B):void 0,S=Wu($.entry,x??void 0);console.log(S)}catch(E){if(E instanceof f){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(R.red(`Error: ${E.message}`));process.exit(1)}throw E}})}function b0(D){D.command("local").description("Create a local sandbox worktree").argument("[name]","Sandbox name (defaults to branch name from --ref or current branch)").option("-b, --branch <ref>","Git branch, tag, or sha (defaults to HEAD)").option("-r, --ref <ref>","Alias for --branch").option("--json","Output result as JSON").action(async(u,F)=>{try{if(!await Uu()){if(F.json)console.log(JSON.stringify({ok:!1,error:"Not inside a git repository"},null,2));else console.error(R.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(R.red("Error: Cannot use both --branch and --ref"));process.exit(1)}let E=F.branch??F.ref,C=u;if(!C){let x=E??await Zu();if(x)C=Lu(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(R.red("Error: No name provided and could not determine branch name"));process.exit(1)}}let B=await Ku({name:C,hostName:z,ref:E});if(F.json){console.log(JSON.stringify(B.entry,null,2));return}if(B.isIdempotent)console.log(R.dim(`Sandbox "${C}" already exists`));let $=Wu(B.entry);console.log($)}catch(E){if(E instanceof f){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(R.red(`Error: ${E.message}`));process.exit(1)}throw E}})}function v0(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 HD(u);console.log(JSON.stringify(E,null,2));return}if(F.tmux)await _E(u);else await fE(u)}catch(E){if(E instanceof f){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(R.red(`Error: ${E.message}`));process.exit(1)}throw E}})}async function nE(D,u,F){let E=await HD(D),C=await y(E.host);if(!await C.dirExists(E.path))throw new f("PATH_MISSING",`Sandbox path does not exist: ${E.path}`);if(F.capture){let x=await C.exec(E.path,u);return{name:E.name,id:E.id,host:E.host,path:E.path,command:u,exitCode:x.exitCode,stdout:x.stdout,stderr:x.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 d0(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(R.red("Error: No command specified")),process.exit(1);let B=await nE(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 f){if(E.json)console.log(JSON.stringify({ok:!1,error:C.message},null,2));else if(!E.quiet)console.error(R.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 o0(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 XD())?.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(R.yellow(`Warning: ${C}`));if(E.sessions.length===0){console.log(R.dim("No active sessions."));return}for(let C of E.sessions){let B=C.attached?R.green("attached"):R.dim("detached");console.log(`${C.name} ${B}`)}})}var qE=vD(JE(),1);async function c0(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),$=D.hostName?B.filter((H)=>H.host===D.hostName):B,x=[],S=[],A=[],t=new Set;for(let H of $){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){S.push(H);continue}if(D.dryRun){x.push(H);continue}try{let h=await y(H.host),O=await $D(H.host);await h.removeSandboxDir(H.path),await h.removeMeta(O,H.id),t.add(`${H.host}:${O}/mirrors/${H.repoId}.git`),x.push(H)}catch(h){A.push({sandbox:H.name,error:h instanceof Error?h.message:String(h)})}}if(!D.dryRun&&x.length>0)await p((H)=>{for(let N of x)delete H.sandboxes[N.name]});if(!D.dryRun)for(let H of t){let[N,w]=H.split(":",2);try{await(await y(N)).pruneWorktrees(w)}catch{}}return{deleted:x,kept:S,errors:A}}function g0(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 c0({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(R.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(` ${R.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(` ${R.red("-")} ${C.name} (${C.host})`)}if(!u.yes&&!u.json){if(!await BD({message:`Delete ${F.deleted.length} sandbox(es)?`,default:!1})){console.log(R.dim("Cancelled."));return}}let E=await c0({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(R.red(`Error (${C.sandbox}): ${C.error}`));process.exit(1)}}catch(F){if(u.json)console.log(JSON.stringify({ok:!1,error:F instanceof Error?F.message:String(F)},null,2));else console.error(R.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 t=await zu(AD(A)),H=t.ok?{name:"ssh",ok:!0,detail:"connected"}:{name:"ssh",ok:!1,detail:t.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 $=await C.checkRuntime();if(u.push($),!$.ok)F.push(`runtime: ${$.detail}`);let x=await C.checkTmux();if(u.push(x),!x.ok)F.push(`tmux: ${x.detail}`);return{ok:u.every((A)=>A.ok||A.name==="tmux"||A.name==="runtime"),host:D,checks:u,warnings:F,errors:E}}function i0(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 XD())?.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(` ${R.green("\u2713")} ${C.name}${C.detail?` (${C.detail})`:""}`);else console.log(` ${R.red("\u2717")} ${C.name}${C.detail?`: ${C.detail}`:""}`);if(E.warnings.length>0)for(let C of E.warnings)console.log(` ${R.yellow("\u26A0")} ${C}`);if(console.log(),E.ok)console.log(R.green(`Host "${F}" is healthy.`));else console.log(R.red(`Host "${F}" has issues.`)),process.exit(1)})}async function j8(D){let u=await g(D);if(!u)return null;let F=AD(u);for(let E of["apt-get","apk","dnf","yum","brew"])if((await M(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),$=await B.checkGit();if(u.push($),!$.ok)F.push("git");let x=await B.checkRuntime();if(u.push(x),!x.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 f("HOST_NOT_FOUND",`Host "${D.hostName}" not found`);let t=AD(A);for(let H of["bash","curl"]){let w=(await M(t,`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 M(t,`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 N of F)if(N==="bun or node")E.push("curl -fsSL https://bun.sh/install | bash");else if(N==="claude"||N==="opencode")E.push(`npm install -g ${N}`);else E.push(X8(N,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 S=F.length===0&&u.every((A)=>A.ok);return{host:D.hostName,ok:S,checks:u,missing:F,instructions:E}}function s0(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(` ${R.green("\u2713")} ${C.name}${C.detail?` (${C.detail})`:""}`);else console.log(` ${R.red("\u2717")} ${C.name}${C.detail?`: ${C.detail}`:""}`);if(E.missing.length>0)console.log(),console.log(R.yellow(`Missing: ${E.missing.join(", ")}`));if(E.instructions.length>0){console.log(),console.log(R.dim("Install instructions:"));for(let C of E.instructions)console.log(` ${C}`)}if(console.log(),E.ok)console.log(R.green(`Host "${u.host}" is ready.`));else console.log(R.red(`Host "${u.host}" is not ready.`)),process.exit(1)}catch(F){if(F instanceof f){if(u.json)console.log(JSON.stringify({ok:!1,error:F.message},null,2));else console.error(R.red(`Error: ${F.message}`));process.exit(1)}throw F}})}async function XE(D){let u=await hE(),F=D.hostName?u.filter((E)=>E.host===D.hostName):u;return{sandboxes:F,total:F.length}}function a0(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(R.dim("No sandboxes found."));return}let E=Math.max(...F.sandboxes.map(($)=>$.name.length),4),C=Math.max(...F.sandboxes.map(($)=>$.host.length),4),B=Math.max(...F.sandboxes.map(($)=>$.ref.substring(0,8).length),3);console.log(R.bold(`${"NAME".padEnd(E)} ${"HOST".padEnd(C)} ${"REF".padEnd(B)} CREATED`));for(let $ of F.sandboxes){let x=$.ref.substring(0,8),S=new Date($.createdAt).toLocaleDateString();console.log(`${R.cyan($.name.padEnd(E))} ${$.host.padEnd(C)} ${R.yellow(x.padEnd(B))} ${R.dim(S)}`)}console.log(R.dim(`
59
+ ${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(R.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 f("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(($)=>{delete $.sandboxes[D]}),B.config=!0;try{let $=`${C}/mirrors/${F.repoId}.git`;await E.pruneWorktrees($)}catch{}return{entry:F,cleaned:B}}function l0(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 BD({message:`Remove sandbox "${u}"?`,default:!1})){console.log(R.dim("Cancelled."));return}}let E=await zE(u);if(F.json){console.log(JSON.stringify(E,null,2));return}console.log(`Removed sandbox ${R.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(R.yellow(` Warning: could not clean ${C.join(", ")}`))}catch(E){if(E instanceof f){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(R.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 ME(D){let u=await HD(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(),$=`wt-${u.id}`,x=B.find((S)=>S.name===$);if(x)C=x.name}catch{}return{entry:u,dirExists:E,tmuxSession:C,age:z8(u.createdAt)}}function p0(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 ME(u);if(F.json){console.log(JSON.stringify(E,null,2));return}let{entry:C,dirExists:B,tmuxSession:$,age:x}=E;console.log(R.bold(C.name)),console.log(` ${"ID".padEnd(10)} ${R.dim(C.id)}`),console.log(` ${"Host".padEnd(10)} ${C.host}`),console.log(` ${"Ref".padEnd(10)} ${R.yellow(C.ref.substring(0,8))}`),console.log(` ${"Origin".padEnd(10)} ${R.dim(C.origin)}`),console.log(` ${"Path".padEnd(10)} ${C.path}`),console.log(` ${"Age".padEnd(10)} ${x}`);let S=B?R.green("exists"):R.red("missing");console.log(` ${"Dir".padEnd(10)} ${S}`);let A=$?R.green($):R.dim("none");console.log(` ${"Tmux".padEnd(10)} ${A}`)}catch(E){if(E instanceof f){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(R.red(`Error: ${E.message}`));process.exit(1)}throw E}})}function e0(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(R.green(`Renamed "${u}" -> "${F}"`))}catch(C){if(C instanceof f){if(E.json)console.log(JSON.stringify({ok:!1,error:C.message},null,2));else console.error(R.red(`Error: ${C.message}`));process.exit(1)}throw C}})}var i=new _F,UE="0.0.2";function M8(D,u=""){let F=[],E=D.name(),C=D.registeredArguments.map((x)=>x.required?`<${x.name()}>`:`[${x.name()}]`).join(" "),B=C?`${E} ${C}`:E;F.push(`${u}${B}`);let $=D.commands.filter((x)=>x.name()!=="help");return $.forEach((x,S)=>{let A=S===$.length-1,t=A?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",H=u+(A?" ":"\u2502 "),N=x.name(),w=x.registeredArguments.map((_)=>_.required?`<${_.name()}>`:`[${_.name()}]`).join(" "),h=w?`${N} ${w}`:N,O=x.commands.filter((_)=>_.name()!=="help");if(O.length>0)F.push(`${u}${t}${h}`),O.forEach((_,I)=>{let T=I===O.length-1?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",b=_.name(),e=_.registeredArguments.map((bD)=>bD.required?`<${bD.name()}>`:`[${bD.name()}]`).join(" "),SD=e?`${b} ${e}`:b;F.push(`${H}${T}${SD}`)});else F.push(`${u}${t}${h}`)}),F}i.name("wt").enablePositionalOptions().description("Run worktrees, coding agents, and more all from the cloud. SSH included, agents too!").version(UE,"-v, --version").option("--tree","Show command tree").action((D)=>{if(D.tree){console.log(M8(i).join(`
59
60
  `));return}let u=`
60
61
  __
61
62
  /\\ \\__
@@ -65,5 +66,5 @@ ${F.total} sandbox(es)`))}catch(F){if(u.json)console.log(JSON.stringify({ok:!1,e
65
66
  \\ \\_______/' \\ \\__\\
66
67
  \\/__//__/ \\/__/
67
68
  `;console.log(R.green(u)),console.log(R.cyan("Start worktrees in the cloud.")),console.log(R.white.bold.italic("wt --help"),R.gray.italic(`to get started.
68
- `)),console.log(R.dim(`v${LE} https://github.com/abhi-arya1/wt
69
- `))});V0(i);r0(i);b0(i);v0(i);d0(i);o0(i);g0(i);i0(i);s0(i);a0(i);l0(i);p0(i);e0(i);function YE(){i.parse(process.argv)}YE();export{YE as run,i as program};
69
+ `)),console.log(R.dim(`v${UE} \u2022 https://github.com/abhi-arya1/wt
70
+ `))});V0(i);r0(i);b0(i);v0(i);d0(i);o0(i);g0(i);i0(i);s0(i);a0(i);l0(i);p0(i);e0(i);function ZE(){i.parse(process.argv)}ZE();export{ZE 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.1",
3
+ "version": "0.0.2",
4
4
  "description": "Git worktree sandboxes, locally or on remote hosts over SSH.",
5
5
  "module": "index.ts",
6
6
  "type": "module",
@@ -12,7 +12,7 @@
12
12
  "dist"
13
13
  ],
14
14
  "scripts": {
15
- "build": "bun build ./src/index.ts --minify --target node --outdir ./dist --banner '#!/usr/bin/env node' && chmod +x ./dist/index.js",
15
+ "build": "bun build ./src/index.ts --minify --target bun --outdir ./dist --banner '#!/usr/bin/env bun' && chmod +x ./dist/index.js",
16
16
  "dev": "bun run ./src/index.ts"
17
17
  },
18
18
  "devDependencies": {