@abhi-arya1/wt 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +50 -47
  2. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -1,65 +1,68 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- var k3=Object.create;var{getPrototypeOf:h3,defineProperty:AF,getOwnPropertyNames:b3}=Object;var v3=Object.prototype.hasOwnProperty;var rD=(D,u,F)=>{F=D!=null?k3(h3(D)):{};let E=u||!D||!D.__esModule?AF(F,"default",{value:D,enumerable:!0}):F;for(let C of b3(D))if(!v3.call(E,C))AF(E,C,{get:()=>D[C],enumerable:!0});return E};var v=(D,u)=>()=>(u||D((u={exports:{}}).exports,u),u.exports);var o=import.meta.require;var pD=v((m3)=>{class du extends Error{constructor(D,u,F){super(F);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=u,this.exitCode=D,this.nestedError=void 0}}class HF extends du{constructor(D){super(1,"commander.invalidArgument",D);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}m3.CommanderError=du;m3.InvalidArgumentError=HF});var xu=v((t3)=>{var{InvalidArgumentError:d3}=pD();class xF{constructor(D,u){switch(this.description=u||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,D[0]){case"<":this.required=!0,this._name=D.slice(1,-1);break;case"[":this.required=!1,this._name=D.slice(1,-1);break;default:this.required=!0,this._name=D;break}if(this._name.endsWith("..."))this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_collectValue(D,u){if(u===this.defaultValue||!Array.isArray(u))return[D];return u.push(D),u}default(D,u){return this.defaultValue=D,this.defaultValueDescription=u,this}argParser(D){return this.parseArg=D,this}choices(D){return this.argChoices=D.slice(),this.parseArg=(u,F)=>{if(!this.argChoices.includes(u))throw new d3(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(u,F);return u},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function c3(D){let u=D.name()+(D.variadic===!0?"...":"");return D.required?"<"+u+">":"["+u+"]"}t3.Argument=xF;t3.humanReadableArgName=c3});var cu=v((i3)=>{var{humanReadableArgName:p3}=xu();class JF{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(D){this.helpWidth=this.helpWidth??D.helpWidth??80}visibleCommands(D){let u=D.commands.filter((E)=>!E._hidden),F=D._getHelpCommand();if(F&&!F._hidden)u.push(F);if(this.sortSubcommands)u.sort((E,C)=>{return E.name().localeCompare(C.name())});return u}compareOptions(D,u){let F=(E)=>{return E.short?E.short.replace(/^-/,""):E.long.replace(/^--/,"")};return F(D).localeCompare(F(u))}visibleOptions(D){let u=D.options.filter((E)=>!E.hidden),F=D._getHelpOption();if(F&&!F.hidden){let E=F.short&&D._findOption(F.short),C=F.long&&D._findOption(F.long);if(!E&&!C)u.push(F);else if(F.long&&!C)u.push(D.createOption(F.long,F.description));else if(F.short&&!E)u.push(D.createOption(F.short,F.description))}if(this.sortOptions)u.sort(this.compareOptions);return u}visibleGlobalOptions(D){if(!this.showGlobalOptions)return[];let u=[];for(let F=D.parent;F;F=F.parent){let E=F.options.filter((C)=>!C.hidden);u.push(...E)}if(this.sortOptions)u.sort(this.compareOptions);return u}visibleArguments(D){if(D._argsDescription)D.registeredArguments.forEach((u)=>{u.description=u.description||D._argsDescription[u.name()]||""});if(D.registeredArguments.find((u)=>u.description))return D.registeredArguments;return[]}subcommandTerm(D){let u=D.registeredArguments.map((F)=>p3(F)).join(" ");return D._name+(D._aliases[0]?"|"+D._aliases[0]:"")+(D.options.length?" [options]":"")+(u?" "+u:"")}optionTerm(D){return D.flags}argumentTerm(D){return D.name()}longestSubcommandTermLength(D,u){return u.visibleCommands(D).reduce((F,E)=>{return Math.max(F,this.displayWidth(u.styleSubcommandTerm(u.subcommandTerm(E))))},0)}longestOptionTermLength(D,u){return u.visibleOptions(D).reduce((F,E)=>{return Math.max(F,this.displayWidth(u.styleOptionTerm(u.optionTerm(E))))},0)}longestGlobalOptionTermLength(D,u){return u.visibleGlobalOptions(D).reduce((F,E)=>{return Math.max(F,this.displayWidth(u.styleOptionTerm(u.optionTerm(E))))},0)}longestArgumentTermLength(D,u){return u.visibleArguments(D).reduce((F,E)=>{return Math.max(F,this.displayWidth(u.styleArgumentTerm(u.argumentTerm(E))))},0)}commandUsage(D){let u=D._name;if(D._aliases[0])u=u+"|"+D._aliases[0];let F="";for(let E=D.parent;E;E=E.parent)F=E.name()+" "+F;return F+u+" "+D.usage()}commandDescription(D){return D.description()}subcommandDescription(D){return D.summary()||D.description()}optionDescription(D){let u=[];if(D.argChoices)u.push(`choices: ${D.argChoices.map((F)=>JSON.stringify(F)).join(", ")}`);if(D.defaultValue!==void 0){if(D.required||D.optional||D.isBoolean()&&typeof D.defaultValue==="boolean")u.push(`default: ${D.defaultValueDescription||JSON.stringify(D.defaultValue)}`)}if(D.presetArg!==void 0&&D.optional)u.push(`preset: ${JSON.stringify(D.presetArg)}`);if(D.envVar!==void 0)u.push(`env: ${D.envVar}`);if(u.length>0){let F=`(${u.join(", ")})`;if(D.description)return`${D.description} ${F}`;return F}return D.description}argumentDescription(D){let u=[];if(D.argChoices)u.push(`choices: ${D.argChoices.map((F)=>JSON.stringify(F)).join(", ")}`);if(D.defaultValue!==void 0)u.push(`default: ${D.defaultValueDescription||JSON.stringify(D.defaultValue)}`);if(u.length>0){let F=`(${u.join(", ")})`;if(D.description)return`${D.description} ${F}`;return F}return D.description}formatItemList(D,u,F){if(u.length===0)return[];return[F.styleTitle(D),...u,""]}groupItems(D,u,F){let E=new Map;return D.forEach((C)=>{let B=F(C);if(!E.has(B))E.set(B,[])}),u.forEach((C)=>{let B=F(C);if(!E.has(B))E.set(B,[]);E.get(B).push(C)}),E}formatHelp(D,u){let F=u.padWidth(D,u),E=u.helpWidth??80;function C(H,J){return u.formatItem(H,F,J,u)}let B=[`${u.styleTitle("Usage:")} ${u.styleUsage(u.commandUsage(D))}`,""],$=u.commandDescription(D);if($.length>0)B=B.concat([u.boxWrap(u.styleCommandDescription($),E),""]);let A=u.visibleArguments(D).map((H)=>{return C(u.styleArgumentTerm(u.argumentTerm(H)),u.styleArgumentDescription(u.argumentDescription(H)))});if(B=B.concat(this.formatItemList("Arguments:",A,u)),this.groupItems(D.options,u.visibleOptions(D),(H)=>H.helpGroupHeading??"Options:").forEach((H,J)=>{let T=H.map((_)=>{return C(u.styleOptionTerm(u.optionTerm(_)),u.styleOptionDescription(u.optionDescription(_)))});B=B.concat(this.formatItemList(J,T,u))}),u.showGlobalOptions){let H=u.visibleGlobalOptions(D).map((J)=>{return C(u.styleOptionTerm(u.optionTerm(J)),u.styleOptionDescription(u.optionDescription(J)))});B=B.concat(this.formatItemList("Global Options:",H,u))}return this.groupItems(D.commands,u.visibleCommands(D),(H)=>H.helpGroup()||"Commands:").forEach((H,J)=>{let T=H.map((_)=>{return C(u.styleSubcommandTerm(u.subcommandTerm(_)),u.styleSubcommandDescription(u.subcommandDescription(_)))});B=B.concat(this.formatItemList(J,T,u))}),B.join(`
4
- `)}displayWidth(D){return NF(D).length}styleTitle(D){return D}styleUsage(D){return D.split(" ").map((u)=>{if(u==="[options]")return this.styleOptionText(u);if(u==="[command]")return this.styleSubcommandText(u);if(u[0]==="["||u[0]==="<")return this.styleArgumentText(u);return this.styleCommandText(u)}).join(" ")}styleCommandDescription(D){return this.styleDescriptionText(D)}styleOptionDescription(D){return this.styleDescriptionText(D)}styleSubcommandDescription(D){return this.styleDescriptionText(D)}styleArgumentDescription(D){return this.styleDescriptionText(D)}styleDescriptionText(D){return D}styleOptionTerm(D){return this.styleOptionText(D)}styleSubcommandTerm(D){return D.split(" ").map((u)=>{if(u==="[options]")return this.styleOptionText(u);if(u[0]==="["||u[0]==="<")return this.styleArgumentText(u);return this.styleSubcommandText(u)}).join(" ")}styleArgumentTerm(D){return this.styleArgumentText(D)}styleOptionText(D){return D}styleArgumentText(D){return D}styleSubcommandText(D){return D}styleCommandText(D){return D}padWidth(D,u){return Math.max(u.longestOptionTermLength(D,u),u.longestGlobalOptionTermLength(D,u),u.longestSubcommandTermLength(D,u),u.longestArgumentTermLength(D,u))}preformatted(D){return/\n[^\S\r\n]/.test(D)}formatItem(D,u,F,E){let B=" ".repeat(2);if(!F)return B+D;let $=D.padEnd(u+D.length-E.displayWidth(D)),A=2,x=(this.helpWidth??80)-u-A-2,H;if(x<this.minWidthToWrap||E.preformatted(F))H=F;else H=E.boxWrap(F,x).replace(/\n/g,`
5
- `+" ".repeat(u+A));return B+$+" ".repeat(A)+H.replace(/\n/g,`
6
- ${B}`)}boxWrap(D,u){if(u<this.minWidthToWrap)return D;let F=D.split(/\r\n|\n/),E=/[\s]*[^\s]+/g,C=[];return F.forEach((B)=>{let $=B.match(E);if($===null){C.push("");return}let A=[$.shift()],R=this.displayWidth(A[0]);$.forEach((x)=>{let H=this.displayWidth(x);if(R+H<=u){A.push(x),R+=H;return}C.push(A.join(""));let J=x.trimStart();A=[J],R=this.displayWidth(J)}),C.push(A.join(""))}),C.join(`
7
- `)}}function NF(D){let u=/\x1b\[\d*(;\d*)*m/g;return D.replace(u,"")}i3.Help=JF;i3.stripColor=NF});var tu=v((DE)=>{var{InvalidArgumentError:s3}=pD();class _F{constructor(D,u){this.flags=D,this.description=u||"",this.required=D.includes("<"),this.optional=D.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(D),this.mandatory=!1;let F=e3(D);if(this.short=F.shortFlag,this.long=F.longFlag,this.negate=!1,this.long)this.negate=this.long.startsWith("--no-");this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(D,u){return this.defaultValue=D,this.defaultValueDescription=u,this}preset(D){return this.presetArg=D,this}conflicts(D){return this.conflictsWith=this.conflictsWith.concat(D),this}implies(D){let u=D;if(typeof D==="string")u={[D]:!0};return this.implied=Object.assign(this.implied||{},u),this}env(D){return this.envVar=D,this}argParser(D){return this.parseArg=D,this}makeOptionMandatory(D=!0){return this.mandatory=!!D,this}hideHelp(D=!0){return this.hidden=!!D,this}_collectValue(D,u){if(u===this.defaultValue||!Array.isArray(u))return[D];return u.push(D),u}choices(D){return this.argChoices=D.slice(),this.parseArg=(u,F)=>{if(!this.argChoices.includes(u))throw new s3(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(u,F);return u},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){if(this.negate)return RF(this.name().replace(/^no-/,""));return RF(this.name())}helpGroup(D){return this.helpGroupHeading=D,this}is(D){return this.short===D||this.long===D}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class TF{constructor(D){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,D.forEach((u)=>{if(u.negate)this.negativeOptions.set(u.attributeName(),u);else this.positiveOptions.set(u.attributeName(),u)}),this.negativeOptions.forEach((u,F)=>{if(this.positiveOptions.has(F))this.dualOptions.add(F)})}valueFromOption(D,u){let F=u.attributeName();if(!this.dualOptions.has(F))return!0;let E=this.negativeOptions.get(F).presetArg,C=E!==void 0?E:!1;return u.negate===(C===D)}}function RF(D){return D.split("-").reduce((u,F)=>{return u+F[0].toUpperCase()+F.slice(1)})}function e3(D){let u,F,E=/^-[^-]$/,C=/^--[^-]/,B=D.split(/[ |,]+/).concat("guard");if(E.test(B[0]))u=B.shift();if(C.test(B[0]))F=B.shift();if(!u&&E.test(B[0]))u=B.shift();if(!u&&C.test(B[0]))u=F,F=B.shift();if(B[0].startsWith("-")){let $=B[0],A=`option creation failed due to '${$}' in option flags '${D}'`;if(/^-[^-][^-]/.test($))throw Error(`${A}
3
+ var e3=Object.create;var{getPrototypeOf:D1,defineProperty:SF,getOwnPropertyNames:u1}=Object;var F1=Object.prototype.hasOwnProperty;var PD=(D,u,F)=>{F=D!=null?e3(D1(D)):{};let E=u||!D||!D.__esModule?SF(F,"default",{value:D,enumerable:!0}):F;for(let C of u1(D))if(!F1.call(E,C))SF(E,C,{get:()=>D[C],enumerable:!0});return E};var w=(D,u)=>()=>(u||D((u={exports:{}}).exports,u),u.exports);var l=import.meta.require;var aD=w((E1)=>{class ou 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 _F extends ou{constructor(D){super(1,"commander.invalidArgument",D);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}E1.CommanderError=ou;E1.InvalidArgumentError=_F});var Gu=w((A1)=>{var{InvalidArgumentError:x1}=aD();class OF{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 x1(`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 $1(D){let u=D.name()+(D.variadic===!0?"...":"");return D.required?"<"+u+">":"["+u+"]"}A1.Argument=OF;A1.humanReadableArgName=$1});var au=w((N1)=>{var{humanReadableArgName:R1}=Gu();class XF{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)=>R1(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(A,J){return u.formatItem(A,F,J,u)}let B=[`${u.styleTitle("Usage:")} ${u.styleUsage(u.commandUsage(D))}`,""],x=u.commandDescription(D);if(x.length>0)B=B.concat([u.boxWrap(u.styleCommandDescription(x),E),""]);let $=u.visibleArguments(D).map((A)=>{return C(u.styleArgumentTerm(u.argumentTerm(A)),u.styleArgumentDescription(u.argumentDescription(A)))});if(B=B.concat(this.formatItemList("Arguments:",$,u)),this.groupItems(D.options,u.visibleOptions(D),(A)=>A.helpGroupHeading??"Options:").forEach((A,J)=>{let S=A.map((T)=>{return C(u.styleOptionTerm(u.optionTerm(T)),u.styleOptionDescription(u.optionDescription(T)))});B=B.concat(this.formatItemList(J,S,u))}),u.showGlobalOptions){let A=u.visibleGlobalOptions(D).map((J)=>{return C(u.styleOptionTerm(u.optionTerm(J)),u.styleOptionDescription(u.optionDescription(J)))});B=B.concat(this.formatItemList("Global Options:",A,u))}return this.groupItems(D.commands,u.visibleCommands(D),(A)=>A.helpGroup()||"Commands:").forEach((A,J)=>{let S=A.map((T)=>{return C(u.styleSubcommandTerm(u.subcommandTerm(T)),u.styleSubcommandDescription(u.subcommandDescription(T)))});B=B.concat(this.formatItemList(J,S,u))}),B.join(`
4
+ `)}displayWidth(D){return IF(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 x=D.padEnd(u+D.length-E.displayWidth(D)),$=2,H=(this.helpWidth??80)-u-$-2,A;if(H<this.minWidthToWrap||E.preformatted(F))A=F;else A=E.boxWrap(F,H).replace(/\n/g,`
5
+ `+" ".repeat(u+$));return B+x+" ".repeat($)+A.replace(/\n/g,`
6
+ ${B}`)}boxWrap(D,u){if(u<this.minWidthToWrap)return D;let F=D.split(/\r\n|\n/),E=/[\s]*[^\s]+/g,C=[];return F.forEach((B)=>{let x=B.match(E);if(x===null){C.push("");return}let $=[x.shift()],R=this.displayWidth($[0]);x.forEach((H)=>{let A=this.displayWidth(H);if(R+A<=u){$.push(H),R+=A;return}C.push($.join(""));let J=H.trimStart();$=[J],R=this.displayWidth(J)}),C.push($.join(""))}),C.join(`
7
+ `)}}function IF(D){let u=/\x1b\[\d*(;\d*)*m/g;return D.replace(u,"")}N1.Help=XF;N1.stripColor=IF});var su=w((O1)=>{var{InvalidArgumentError:S1}=aD();class zF{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=_1(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 S1(`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 jF(this.name().replace(/^no-/,""));return jF(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 ZF{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 jF(D){return D.split("-").reduce((u,F)=>{return u+F[0].toUpperCase()+F.slice(1)})}function _1(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 x=B[0],$=`option creation failed due to '${x}' in option flags '${D}'`;if(/^-[^-][^-]/.test(x))throw Error(`${$}
8
8
  - a short flag is a single dash and a single character
9
9
  - either use a single dash and a single character (for a short flag)
10
- - or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(E.test($))throw Error(`${A}
11
- - too many short flags`);if(C.test($))throw Error(`${A}
12
- - too many long flags`);throw Error(`${A}
13
- - unrecognised flag format`)}if(u===void 0&&F===void 0)throw Error(`option creation failed due to no flags found in '${D}'.`);return{shortFlag:u,longFlag:F}}DE.Option=_F;DE.DualOptions=TF});var XF=v((BE)=>{function EE(D,u){if(Math.abs(D.length-u.length)>3)return Math.max(D.length,u.length);let F=[];for(let E=0;E<=D.length;E++)F[E]=[E];for(let E=0;E<=u.length;E++)F[0][E]=E;for(let E=1;E<=u.length;E++)for(let C=1;C<=D.length;C++){let B=1;if(D[C-1]===u[E-1])B=0;else B=1;if(F[C][E]=Math.min(F[C-1][E]+1,F[C][E-1]+1,F[C-1][E-1]+B),C>1&&E>1&&D[C-1]===u[E-2]&&D[C-2]===u[E-1])F[C][E]=Math.min(F[C][E],F[C-2][E-2]+1)}return F[D.length][u.length]}function CE(D,u){if(!u||u.length===0)return"";u=Array.from(new Set(u));let F=D.startsWith("--");if(F)D=D.slice(2),u=u.map(($)=>$.slice(2));let E=[],C=3,B=0.4;if(u.forEach(($)=>{if($.length<=1)return;let A=EE(D,$),R=Math.max(D.length,$.length);if((R-A)/R>B){if(A<C)C=A,E=[$];else if(A===C)E.push($)}}),E.sort(($,A)=>$.localeCompare(A)),F)E=E.map(($)=>`--${$}`);if(E.length>1)return`
10
+ - or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(E.test(x))throw Error(`${$}
11
+ - too many short flags`);if(C.test(x))throw Error(`${$}
12
+ - too many long flags`);throw Error(`${$}
13
+ - unrecognised flag format`)}if(u===void 0&&F===void 0)throw Error(`option creation failed due to no flags found in '${D}'.`);return{shortFlag:u,longFlag:F}}O1.Option=zF;O1.DualOptions=ZF});var UF=w((Z1)=>{function j1(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 z1(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((x)=>x.slice(2));let E=[],C=3,B=0.4;if(u.forEach((x)=>{if(x.length<=1)return;let $=j1(D,x),R=Math.max(D.length,x.length);if((R-$)/R>B){if($<C)C=$,E=[x];else if($===C)E.push(x)}}),E.sort((x,$)=>x.localeCompare($)),F)E=E.map((x)=>`--${x}`);if(E.length>1)return`
14
14
  (Did you mean one of ${E.join(", ")}?)`;if(E.length===1)return`
15
- (Did you mean ${E[0]}?)`;return""}BE.suggestSimilar=CE});var SF=v((_E)=>{var AE=o("events").EventEmitter,lu=o("child_process"),xD=o("path"),Ju=o("fs"),Y=o("process"),{Argument:HE,humanReadableArgName:xE}=xu(),{CommanderError:ru}=pD(),{Help:JE,stripColor:NE}=cu(),{Option:GF,DualOptions:RE}=tu(),{suggestSimilar:jF}=XF();class iu extends AE{constructor(D){super();this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=D||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:(u)=>Y.stdout.write(u),writeErr:(u)=>Y.stderr.write(u),outputError:(u,F)=>F(u),getOutHelpWidth:()=>Y.stdout.isTTY?Y.stdout.columns:void 0,getErrHelpWidth:()=>Y.stderr.isTTY?Y.stderr.columns:void 0,getOutHasColors:()=>pu()??(Y.stdout.isTTY&&Y.stdout.hasColors?.()),getErrHasColors:()=>pu()??(Y.stderr.isTTY&&Y.stderr.hasColors?.()),stripColor:(u)=>NE(u)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(D){return this._outputConfiguration=D._outputConfiguration,this._helpOption=D._helpOption,this._helpCommand=D._helpCommand,this._helpConfiguration=D._helpConfiguration,this._exitCallback=D._exitCallback,this._storeOptionsAsProperties=D._storeOptionsAsProperties,this._combineFlagAndOptionalValue=D._combineFlagAndOptionalValue,this._allowExcessArguments=D._allowExcessArguments,this._enablePositionalOptions=D._enablePositionalOptions,this._showHelpAfterError=D._showHelpAfterError,this._showSuggestionAfterError=D._showSuggestionAfterError,this}_getCommandAndAncestors(){let D=[];for(let u=this;u;u=u.parent)D.push(u);return D}command(D,u,F){let E=u,C=F;if(typeof E==="object"&&E!==null)C=E,E=null;C=C||{};let[,B,$]=D.match(/([^ ]+) *(.*)/),A=this.createCommand(B);if(E)A.description(E),A._executableHandler=!0;if(C.isDefault)this._defaultCommandName=A._name;if(A._hidden=!!(C.noHelp||C.hidden),A._executableFile=C.executableFile||null,$)A.arguments($);if(this._registerCommand(A),A.parent=this,A.copyInheritedSettings(this),E)return this;return A}createCommand(D){return new iu(D)}createHelp(){return Object.assign(new JE,this.configureHelp())}configureHelp(D){if(D===void 0)return this._helpConfiguration;return this._helpConfiguration=D,this}configureOutput(D){if(D===void 0)return this._outputConfiguration;return this._outputConfiguration={...this._outputConfiguration,...D},this}showHelpAfterError(D=!0){if(typeof D!=="string")D=!!D;return this._showHelpAfterError=D,this}showSuggestionAfterError(D=!0){return this._showSuggestionAfterError=!!D,this}addCommand(D,u){if(!D._name)throw Error(`Command passed to .addCommand() must have a name
16
- - specify the name in Command constructor or using .name()`);if(u=u||{},u.isDefault)this._defaultCommandName=D._name;if(u.noHelp||u.hidden)D._hidden=!0;return this._registerCommand(D),D.parent=this,D._checkForBrokenPassThrough(),this}createArgument(D,u){return new HE(D,u)}argument(D,u,F,E){let C=this.createArgument(D,u);if(typeof F==="function")C.default(E).argParser(F);else C.default(F);return this.addArgument(C),this}arguments(D){return D.trim().split(/ +/).forEach((u)=>{this.argument(u)}),this}addArgument(D){let u=this.registeredArguments.slice(-1)[0];if(u?.variadic)throw Error(`only the last argument can be variadic '${u.name()}'`);if(D.required&&D.defaultValue!==void 0&&D.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${D.name()}'`);return this.registeredArguments.push(D),this}helpCommand(D,u){if(typeof D==="boolean"){if(this._addImplicitHelpCommand=D,D&&this._defaultCommandGroup)this._initCommandGroup(this._getHelpCommand());return this}let F=D??"help [command]",[,E,C]=F.match(/([^ ]+) *(.*)/),B=u??"display help for command",$=this.createCommand(E);if($.helpOption(!1),C)$.arguments(C);if(B)$.description(B);if(this._addImplicitHelpCommand=!0,this._helpCommand=$,D||u)this._initCommandGroup($);return this}addHelpCommand(D,u){if(typeof D!=="object")return this.helpCommand(D,u),this;return this._addImplicitHelpCommand=!0,this._helpCommand=D,this._initCommandGroup(D),this}_getHelpCommand(){if(this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))){if(this._helpCommand===void 0)this.helpCommand(void 0,void 0);return this._helpCommand}return null}hook(D,u){let F=["preSubcommand","preAction","postAction"];if(!F.includes(D))throw Error(`Unexpected value for event passed to hook : '${D}'.
17
- Expecting one of '${F.join("', '")}'`);if(this._lifeCycleHooks[D])this._lifeCycleHooks[D].push(u);else this._lifeCycleHooks[D]=[u];return this}exitOverride(D){if(D)this._exitCallback=D;else this._exitCallback=(u)=>{if(u.code!=="commander.executeSubCommandAsync")throw u};return this}_exit(D,u,F){if(this._exitCallback)this._exitCallback(new ru(D,u,F));Y.exit(D)}action(D){let u=(F)=>{let E=this.registeredArguments.length,C=F.slice(0,E);if(this._storeOptionsAsProperties)C[E]=this;else C[E]=this.opts();return C.push(this),D.apply(this,C)};return this._actionHandler=u,this}createOption(D,u){return new GF(D,u)}_callParseArg(D,u,F,E){try{return D.parseArg(u,F)}catch(C){if(C.code==="commander.invalidArgument"){let B=`${E} ${C.message}`;this.error(B,{exitCode:C.exitCode,code:C.code})}throw C}}_registerOption(D){let u=D.short&&this._findOption(D.short)||D.long&&this._findOption(D.long);if(u){let F=D.long&&this._findOption(D.long)?D.long:D.short;throw Error(`Cannot add option '${D.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${F}'
18
- - already used by option '${u.flags}'`)}this._initOptionGroup(D),this.options.push(D)}_registerCommand(D){let u=(E)=>{return[E.name()].concat(E.aliases())},F=u(D).find((E)=>this._findCommand(E));if(F){let E=u(this._findCommand(F)).join("|"),C=u(D).join("|");throw Error(`cannot add command '${C}' as already have command '${E}'`)}this._initCommandGroup(D),this.commands.push(D)}addOption(D){this._registerOption(D);let u=D.name(),F=D.attributeName();if(D.negate){let C=D.long.replace(/^--no-/,"--");if(!this._findOption(C))this.setOptionValueWithSource(F,D.defaultValue===void 0?!0:D.defaultValue,"default")}else if(D.defaultValue!==void 0)this.setOptionValueWithSource(F,D.defaultValue,"default");let E=(C,B,$)=>{if(C==null&&D.presetArg!==void 0)C=D.presetArg;let A=this.getOptionValue(F);if(C!==null&&D.parseArg)C=this._callParseArg(D,C,A,B);else if(C!==null&&D.variadic)C=D._collectValue(C,A);if(C==null)if(D.negate)C=!1;else if(D.isBoolean()||D.optional)C=!0;else C="";this.setOptionValueWithSource(F,C,$)};if(this.on("option:"+u,(C)=>{let B=`error: option '${D.flags}' argument '${C}' is invalid.`;E(C,B,"cli")}),D.envVar)this.on("optionEnv:"+u,(C)=>{let B=`error: option '${D.flags}' value '${C}' from env '${D.envVar}' is invalid.`;E(C,B,"env")});return this}_optionEx(D,u,F,E,C){if(typeof u==="object"&&u instanceof GF)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let B=this.createOption(u,F);if(B.makeOptionMandatory(!!D.mandatory),typeof E==="function")B.default(C).argParser(E);else if(E instanceof RegExp){let $=E;E=(A,R)=>{let x=$.exec(A);return x?x[0]:R},B.default(C).argParser(E)}else B.default(E);return this.addOption(B)}option(D,u,F,E){return this._optionEx({},D,u,F,E)}requiredOption(D,u,F,E){return this._optionEx({mandatory:!0},D,u,F,E)}combineFlagAndOptionalValue(D=!0){return this._combineFlagAndOptionalValue=!!D,this}allowUnknownOption(D=!0){return this._allowUnknownOption=!!D,this}allowExcessArguments(D=!0){return this._allowExcessArguments=!!D,this}enablePositionalOptions(D=!0){return this._enablePositionalOptions=!!D,this}passThroughOptions(D=!0){return this._passThroughOptions=!!D,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(D=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!D,this}getOptionValue(D){if(this._storeOptionsAsProperties)return this[D];return this._optionValues[D]}setOptionValue(D,u){return this.setOptionValueWithSource(D,u,void 0)}setOptionValueWithSource(D,u,F){if(this._storeOptionsAsProperties)this[D]=u;else this._optionValues[D]=u;return this._optionValueSources[D]=F,this}getOptionValueSource(D){return this._optionValueSources[D]}getOptionValueSourceWithGlobals(D){let u;return this._getCommandAndAncestors().forEach((F)=>{if(F.getOptionValueSource(D)!==void 0)u=F.getOptionValueSource(D)}),u}_prepareUserArgs(D,u){if(D!==void 0&&!Array.isArray(D))throw Error("first parameter to parse must be array or undefined");if(u=u||{},D===void 0&&u.from===void 0){if(Y.versions?.electron)u.from="electron";let E=Y.execArgv??[];if(E.includes("-e")||E.includes("--eval")||E.includes("-p")||E.includes("--print"))u.from="eval"}if(D===void 0)D=Y.argv;this.rawArgs=D.slice();let F;switch(u.from){case void 0:case"node":this._scriptPath=D[1],F=D.slice(2);break;case"electron":if(Y.defaultApp)this._scriptPath=D[1],F=D.slice(2);else F=D.slice(1);break;case"user":F=D.slice(0);break;case"eval":F=D.slice(1);break;default:throw Error(`unexpected parse option { from: '${u.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",F}parse(D,u){this._prepareForParse();let F=this._prepareUserArgs(D,u);return this._parseCommand([],F),this}async parseAsync(D,u){this._prepareForParse();let F=this._prepareUserArgs(D,u);return await this._parseCommand([],F),this}_prepareForParse(){if(this._savedState===null)this.saveStateBeforeParse();else this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
19
- - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(D,u,F){if(Ju.existsSync(D))return;let E=u?`searched for local subcommand relative to directory '${u}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",C=`'${D}' does not exist
15
+ (Did you mean ${E[0]}?)`;return""}Z1.suggestSimilar=z1});var QF=w((w1)=>{var Y1=l("events").EventEmitter,eu=l("child_process"),RD=l("path"),Su=l("fs"),Y=l("process"),{Argument:M1,humanReadableArgName:q1}=Gu(),{CommanderError:D0}=aD(),{Help:Q1,stripColor:K1}=au(),{Option:YF,DualOptions:W1}=su(),{suggestSimilar:MF}=UF();class F0 extends Y1{constructor(D){super();this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=D||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:(u)=>Y.stdout.write(u),writeErr:(u)=>Y.stderr.write(u),outputError:(u,F)=>F(u),getOutHelpWidth:()=>Y.stdout.isTTY?Y.stdout.columns:void 0,getErrHelpWidth:()=>Y.stderr.isTTY?Y.stderr.columns:void 0,getOutHasColors:()=>u0()??(Y.stdout.isTTY&&Y.stdout.hasColors?.()),getErrHasColors:()=>u0()??(Y.stderr.isTTY&&Y.stderr.hasColors?.()),stripColor:(u)=>K1(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,x]=D.match(/([^ ]+) *(.*)/),$=this.createCommand(B);if(E)$.description(E),$._executableHandler=!0;if(C.isDefault)this._defaultCommandName=$._name;if($._hidden=!!(C.noHelp||C.hidden),$._executableFile=C.executableFile||null,x)$.arguments(x);if(this._registerCommand($),$.parent=this,$.copyInheritedSettings(this),E)return this;return $}createCommand(D){return new F0(D)}createHelp(){return Object.assign(new Q1,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 M1(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",x=this.createCommand(E);if(x.helpOption(!1),C)x.arguments(C);if(B)x.description(B);if(this._addImplicitHelpCommand=!0,this._helpCommand=x,D||u)this._initCommandGroup(x);return this}addHelpCommand(D,u){if(typeof D!=="object")return this.helpCommand(D,u),this;return this._addImplicitHelpCommand=!0,this._helpCommand=D,this._initCommandGroup(D),this}_getHelpCommand(){if(this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))){if(this._helpCommand===void 0)this.helpCommand(void 0,void 0);return this._helpCommand}return null}hook(D,u){let F=["preSubcommand","preAction","postAction"];if(!F.includes(D))throw Error(`Unexpected value for event passed to hook : '${D}'.
17
+ Expecting one of '${F.join("', '")}'`);if(this._lifeCycleHooks[D])this._lifeCycleHooks[D].push(u);else this._lifeCycleHooks[D]=[u];return this}exitOverride(D){if(D)this._exitCallback=D;else this._exitCallback=(u)=>{if(u.code!=="commander.executeSubCommandAsync")throw u};return this}_exit(D,u,F){if(this._exitCallback)this._exitCallback(new D0(D,u,F));Y.exit(D)}action(D){let u=(F)=>{let E=this.registeredArguments.length,C=F.slice(0,E);if(this._storeOptionsAsProperties)C[E]=this;else C[E]=this.opts();return C.push(this),D.apply(this,C)};return this._actionHandler=u,this}createOption(D,u){return new YF(D,u)}_callParseArg(D,u,F,E){try{return D.parseArg(u,F)}catch(C){if(C.code==="commander.invalidArgument"){let B=`${E} ${C.message}`;this.error(B,{exitCode:C.exitCode,code:C.code})}throw C}}_registerOption(D){let u=D.short&&this._findOption(D.short)||D.long&&this._findOption(D.long);if(u){let F=D.long&&this._findOption(D.long)?D.long:D.short;throw Error(`Cannot add option '${D.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${F}'
18
+ - already used by option '${u.flags}'`)}this._initOptionGroup(D),this.options.push(D)}_registerCommand(D){let u=(E)=>{return[E.name()].concat(E.aliases())},F=u(D).find((E)=>this._findCommand(E));if(F){let E=u(this._findCommand(F)).join("|"),C=u(D).join("|");throw Error(`cannot add command '${C}' as already have command '${E}'`)}this._initCommandGroup(D),this.commands.push(D)}addOption(D){this._registerOption(D);let u=D.name(),F=D.attributeName();if(D.negate){let C=D.long.replace(/^--no-/,"--");if(!this._findOption(C))this.setOptionValueWithSource(F,D.defaultValue===void 0?!0:D.defaultValue,"default")}else if(D.defaultValue!==void 0)this.setOptionValueWithSource(F,D.defaultValue,"default");let E=(C,B,x)=>{if(C==null&&D.presetArg!==void 0)C=D.presetArg;let $=this.getOptionValue(F);if(C!==null&&D.parseArg)C=this._callParseArg(D,C,$,B);else if(C!==null&&D.variadic)C=D._collectValue(C,$);if(C==null)if(D.negate)C=!1;else if(D.isBoolean()||D.optional)C=!0;else C="";this.setOptionValueWithSource(F,C,x)};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 YF)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 x=E;E=($,R)=>{let H=x.exec($);return H?H[0]:R},B.default(C).argParser(E)}else B.default(E);return this.addOption(B)}option(D,u,F,E){return this._optionEx({},D,u,F,E)}requiredOption(D,u,F,E){return this._optionEx({mandatory:!0},D,u,F,E)}combineFlagAndOptionalValue(D=!0){return this._combineFlagAndOptionalValue=!!D,this}allowUnknownOption(D=!0){return this._allowUnknownOption=!!D,this}allowExcessArguments(D=!0){return this._allowExcessArguments=!!D,this}enablePositionalOptions(D=!0){return this._enablePositionalOptions=!!D,this}passThroughOptions(D=!0){return this._passThroughOptions=!!D,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(D=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!D,this}getOptionValue(D){if(this._storeOptionsAsProperties)return this[D];return this._optionValues[D]}setOptionValue(D,u){return this.setOptionValueWithSource(D,u,void 0)}setOptionValueWithSource(D,u,F){if(this._storeOptionsAsProperties)this[D]=u;else this._optionValues[D]=u;return this._optionValueSources[D]=F,this}getOptionValueSource(D){return this._optionValueSources[D]}getOptionValueSourceWithGlobals(D){let u;return this._getCommandAndAncestors().forEach((F)=>{if(F.getOptionValueSource(D)!==void 0)u=F.getOptionValueSource(D)}),u}_prepareUserArgs(D,u){if(D!==void 0&&!Array.isArray(D))throw Error("first parameter to parse must be array or undefined");if(u=u||{},D===void 0&&u.from===void 0){if(Y.versions?.electron)u.from="electron";let E=Y.execArgv??[];if(E.includes("-e")||E.includes("--eval")||E.includes("-p")||E.includes("--print"))u.from="eval"}if(D===void 0)D=Y.argv;this.rawArgs=D.slice();let F;switch(u.from){case void 0:case"node":this._scriptPath=D[1],F=D.slice(2);break;case"electron":if(Y.defaultApp)this._scriptPath=D[1],F=D.slice(2);else F=D.slice(1);break;case"user":F=D.slice(0);break;case"eval":F=D.slice(1);break;default:throw Error(`unexpected parse option { from: '${u.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",F}parse(D,u){this._prepareForParse();let F=this._prepareUserArgs(D,u);return this._parseCommand([],F),this}async parseAsync(D,u){this._prepareForParse();let F=this._prepareUserArgs(D,u);return await this._parseCommand([],F),this}_prepareForParse(){if(this._savedState===null)this.saveStateBeforeParse();else this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
19
+ - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(D,u,F){if(Su.existsSync(D))return;let E=u?`searched for local subcommand relative to directory '${u}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",C=`'${D}' does not exist
20
20
  - if '${F}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
21
21
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
22
- - ${E}`;throw Error(C)}_executeSubCommand(D,u){u=u.slice();let F=!1,E=[".js",".ts",".tsx",".mjs",".cjs"];function C(x,H){let J=xD.resolve(x,H);if(Ju.existsSync(J))return J;if(E.includes(xD.extname(H)))return;let T=E.find((_)=>Ju.existsSync(`${J}${_}`));if(T)return`${J}${T}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let B=D._executableFile||`${this._name}-${D._name}`,$=this._executableDir||"";if(this._scriptPath){let x;try{x=Ju.realpathSync(this._scriptPath)}catch{x=this._scriptPath}$=xD.resolve(xD.dirname(x),$)}if($){let x=C($,B);if(!x&&!D._executableFile&&this._scriptPath){let H=xD.basename(this._scriptPath,xD.extname(this._scriptPath));if(H!==this._name)x=C($,`${H}-${D._name}`)}B=x||B}F=E.includes(xD.extname(B));let A;if(Y.platform!=="win32")if(F)u.unshift(B),u=OF(Y.execArgv).concat(u),A=lu.spawn(Y.argv[0],u,{stdio:"inherit"});else A=lu.spawn(B,u,{stdio:"inherit"});else this._checkForMissingExecutable(B,$,D._name),u.unshift(B),u=OF(Y.execArgv).concat(u),A=lu.spawn(Y.execPath,u,{stdio:"inherit"});if(!A.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((H)=>{Y.on(H,()=>{if(A.killed===!1&&A.exitCode===null)A.kill(H)})});let R=this._exitCallback;A.on("close",(x)=>{if(x=x??1,!R)Y.exit(x);else R(new ru(x,"commander.executeSubCommandAsync","(close)"))}),A.on("error",(x)=>{if(x.code==="ENOENT")this._checkForMissingExecutable(B,$,D._name);else if(x.code==="EACCES")throw Error(`'${B}' not executable`);if(!R)Y.exit(1);else{let H=new ru(1,"commander.executeSubCommandAsync","(error)");H.nestedError=x,R(H)}}),this.runningCommand=A}_dispatchSubcommand(D,u,F){let E=this._findCommand(D);if(!E)this.help({error:!0});E._prepareForParse();let C;return C=this._chainOrCallSubCommandHook(C,E,"preSubcommand"),C=this._chainOrCall(C,()=>{if(E._executableHandler)this._executeSubCommand(E,u.concat(F));else return E._parseCommand(u,F)}),C}_dispatchHelpCommand(D){if(!D)this.help();let u=this._findCommand(D);if(u&&!u._executableHandler)u.help();return this._dispatchSubcommand(D,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach((D,u)=>{if(D.required&&this.args[u]==null)this.missingArgument(D.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let D=(F,E,C)=>{let B=E;if(E!==null&&F.parseArg){let $=`error: command-argument value '${E}' is invalid for argument '${F.name()}'.`;B=this._callParseArg(F,E,C,$)}return B};this._checkNumberOfArguments();let u=[];this.registeredArguments.forEach((F,E)=>{let C=F.defaultValue;if(F.variadic){if(E<this.args.length){if(C=this.args.slice(E),F.parseArg)C=C.reduce((B,$)=>{return D(F,$,B)},F.defaultValue)}else if(C===void 0)C=[]}else if(E<this.args.length){if(C=this.args[E],F.parseArg)C=D(F,C,F.defaultValue)}u[E]=C}),this.processedArgs=u}_chainOrCall(D,u){if(D?.then&&typeof D.then==="function")return D.then(()=>u());return u()}_chainOrCallHooks(D,u){let F=D,E=[];if(this._getCommandAndAncestors().reverse().filter((C)=>C._lifeCycleHooks[u]!==void 0).forEach((C)=>{C._lifeCycleHooks[u].forEach((B)=>{E.push({hookedCommand:C,callback:B})})}),u==="postAction")E.reverse();return E.forEach((C)=>{F=this._chainOrCall(F,()=>{return C.callback(C.hookedCommand,this)})}),F}_chainOrCallSubCommandHook(D,u,F){let E=D;if(this._lifeCycleHooks[F]!==void 0)this._lifeCycleHooks[F].forEach((C)=>{E=this._chainOrCall(E,()=>{return C(this,u)})});return E}_parseCommand(D,u){let F=this.parseOptions(u);if(this._parseOptionsEnv(),this._parseOptionsImplied(),D=D.concat(F.operands),u=F.unknown,this.args=D.concat(u),D&&this._findCommand(D[0]))return this._dispatchSubcommand(D[0],D.slice(1),u);if(this._getHelpCommand()&&D[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(D[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(u),this._dispatchSubcommand(this._defaultCommandName,D,u);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(F.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let E=()=>{if(F.unknown.length>0)this.unknownOption(F.unknown[0])},C=`command:${this.name()}`;if(this._actionHandler){E(),this._processArguments();let B;if(B=this._chainOrCallHooks(B,"preAction"),B=this._chainOrCall(B,()=>this._actionHandler(this.processedArgs)),this.parent)B=this._chainOrCall(B,()=>{this.parent.emit(C,D,u)});return B=this._chainOrCallHooks(B,"postAction"),B}if(this.parent?.listenerCount(C))E(),this._processArguments(),this.parent.emit(C,D,u);else if(D.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",D,u);if(this.listenerCount("command:*"))this.emit("command:*",D,u);else if(this.commands.length)this.unknownCommand();else E(),this._processArguments()}else if(this.commands.length)E(),this.help({error:!0});else E(),this._processArguments()}_findCommand(D){if(!D)return;return this.commands.find((u)=>u._name===D||u._aliases.includes(D))}_findOption(D){return this.options.find((u)=>u.is(D))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((D)=>{D.options.forEach((u)=>{if(u.mandatory&&D.getOptionValue(u.attributeName())===void 0)D.missingMandatoryOptionValue(u)})})}_checkForConflictingLocalOptions(){let D=this.options.filter((F)=>{let E=F.attributeName();if(this.getOptionValue(E)===void 0)return!1;return this.getOptionValueSource(E)!=="default"});D.filter((F)=>F.conflictsWith.length>0).forEach((F)=>{let E=D.find((C)=>F.conflictsWith.includes(C.attributeName()));if(E)this._conflictingOption(F,E)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((D)=>{D._checkForConflictingLocalOptions()})}parseOptions(D){let u=[],F=[],E=u;function C(x){return x.length>1&&x[0]==="-"}let B=(x)=>{if(!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(x))return!1;return!this._getCommandAndAncestors().some((H)=>H.options.map((J)=>J.short).some((J)=>/^-\d$/.test(J)))},$=null,A=null,R=0;while(R<D.length||A){let x=A??D[R++];if(A=null,x==="--"){if(E===F)E.push(x);E.push(...D.slice(R));break}if($&&(!C(x)||B(x))){this.emit(`option:${$.name()}`,x);continue}if($=null,C(x)){let H=this._findOption(x);if(H){if(H.required){let J=D[R++];if(J===void 0)this.optionMissingArgument(H);this.emit(`option:${H.name()}`,J)}else if(H.optional){let J=null;if(R<D.length&&(!C(D[R])||B(D[R])))J=D[R++];this.emit(`option:${H.name()}`,J)}else this.emit(`option:${H.name()}`);$=H.variadic?H:null;continue}}if(x.length>2&&x[0]==="-"&&x[1]!=="-"){let H=this._findOption(`-${x[1]}`);if(H){if(H.required||H.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${H.name()}`,x.slice(2));else this.emit(`option:${H.name()}`),A=`-${x.slice(2)}`;continue}}if(/^--[^=]+=/.test(x)){let H=x.indexOf("="),J=this._findOption(x.slice(0,H));if(J&&(J.required||J.optional)){this.emit(`option:${J.name()}`,x.slice(H+1));continue}}if(E===u&&C(x)&&!(this.commands.length===0&&B(x)))E=F;if((this._enablePositionalOptions||this._passThroughOptions)&&u.length===0&&F.length===0){if(this._findCommand(x)){u.push(x),F.push(...D.slice(R));break}else if(this._getHelpCommand()&&x===this._getHelpCommand().name()){u.push(x,...D.slice(R));break}else if(this._defaultCommandName){F.push(x,...D.slice(R));break}}if(this._passThroughOptions){E.push(x,...D.slice(R));break}E.push(x)}return{operands:u,unknown:F}}opts(){if(this._storeOptionsAsProperties){let D={},u=this.options.length;for(let F=0;F<u;F++){let E=this.options[F].attributeName();D[E]=E===this._versionOptionName?this._version:this[E]}return D}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((D,u)=>Object.assign(D,u.opts()),{})}error(D,u){if(this._outputConfiguration.outputError(`${D}
22
+ - ${E}`;throw Error(C)}_executeSubCommand(D,u){u=u.slice();let F=!1,E=[".js",".ts",".tsx",".mjs",".cjs"];function C(H,A){let J=RD.resolve(H,A);if(Su.existsSync(J))return J;if(E.includes(RD.extname(A)))return;let S=E.find((T)=>Su.existsSync(`${J}${T}`));if(S)return`${J}${S}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let B=D._executableFile||`${this._name}-${D._name}`,x=this._executableDir||"";if(this._scriptPath){let H;try{H=Su.realpathSync(this._scriptPath)}catch{H=this._scriptPath}x=RD.resolve(RD.dirname(H),x)}if(x){let H=C(x,B);if(!H&&!D._executableFile&&this._scriptPath){let A=RD.basename(this._scriptPath,RD.extname(this._scriptPath));if(A!==this._name)H=C(x,`${A}-${D._name}`)}B=H||B}F=E.includes(RD.extname(B));let $;if(Y.platform!=="win32")if(F)u.unshift(B),u=qF(Y.execArgv).concat(u),$=eu.spawn(Y.argv[0],u,{stdio:"inherit"});else $=eu.spawn(B,u,{stdio:"inherit"});else this._checkForMissingExecutable(B,x,D._name),u.unshift(B),u=qF(Y.execArgv).concat(u),$=eu.spawn(Y.execPath,u,{stdio:"inherit"});if(!$.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((A)=>{Y.on(A,()=>{if($.killed===!1&&$.exitCode===null)$.kill(A)})});let R=this._exitCallback;$.on("close",(H)=>{if(H=H??1,!R)Y.exit(H);else R(new D0(H,"commander.executeSubCommandAsync","(close)"))}),$.on("error",(H)=>{if(H.code==="ENOENT")this._checkForMissingExecutable(B,x,D._name);else if(H.code==="EACCES")throw Error(`'${B}' not executable`);if(!R)Y.exit(1);else{let A=new D0(1,"commander.executeSubCommandAsync","(error)");A.nestedError=H,R(A)}}),this.runningCommand=$}_dispatchSubcommand(D,u,F){let E=this._findCommand(D);if(!E)this.help({error:!0});E._prepareForParse();let C;return C=this._chainOrCallSubCommandHook(C,E,"preSubcommand"),C=this._chainOrCall(C,()=>{if(E._executableHandler)this._executeSubCommand(E,u.concat(F));else return E._parseCommand(u,F)}),C}_dispatchHelpCommand(D){if(!D)this.help();let u=this._findCommand(D);if(u&&!u._executableHandler)u.help();return this._dispatchSubcommand(D,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach((D,u)=>{if(D.required&&this.args[u]==null)this.missingArgument(D.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let D=(F,E,C)=>{let B=E;if(E!==null&&F.parseArg){let x=`error: command-argument value '${E}' is invalid for argument '${F.name()}'.`;B=this._callParseArg(F,E,C,x)}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,x)=>{return D(F,x,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(H){return H.length>1&&H[0]==="-"}let B=(H)=>{if(!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(H))return!1;return!this._getCommandAndAncestors().some((A)=>A.options.map((J)=>J.short).some((J)=>/^-\d$/.test(J)))},x=null,$=null,R=0;while(R<D.length||$){let H=$??D[R++];if($=null,H==="--"){if(E===F)E.push(H);E.push(...D.slice(R));break}if(x&&(!C(H)||B(H))){this.emit(`option:${x.name()}`,H);continue}if(x=null,C(H)){let A=this._findOption(H);if(A){if(A.required){let J=D[R++];if(J===void 0)this.optionMissingArgument(A);this.emit(`option:${A.name()}`,J)}else if(A.optional){let J=null;if(R<D.length&&(!C(D[R])||B(D[R])))J=D[R++];this.emit(`option:${A.name()}`,J)}else this.emit(`option:${A.name()}`);x=A.variadic?A:null;continue}}if(H.length>2&&H[0]==="-"&&H[1]!=="-"){let A=this._findOption(`-${H[1]}`);if(A){if(A.required||A.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${A.name()}`,H.slice(2));else this.emit(`option:${A.name()}`),$=`-${H.slice(2)}`;continue}}if(/^--[^=]+=/.test(H)){let A=H.indexOf("="),J=this._findOption(H.slice(0,A));if(J&&(J.required||J.optional)){this.emit(`option:${J.name()}`,H.slice(A+1));continue}}if(E===u&&C(H)&&!(this.commands.length===0&&B(H)))E=F;if((this._enablePositionalOptions||this._passThroughOptions)&&u.length===0&&F.length===0){if(this._findCommand(H)){u.push(H),F.push(...D.slice(R));break}else if(this._getHelpCommand()&&H===this._getHelpCommand().name()){u.push(H,...D.slice(R));break}else if(this._defaultCommandName){F.push(H,...D.slice(R));break}}if(this._passThroughOptions){E.push(H,...D.slice(R));break}E.push(H)}return{operands:u,unknown:F}}opts(){if(this._storeOptionsAsProperties){let D={},u=this.options.length;for(let F=0;F<u;F++){let E=this.options[F].attributeName();D[E]=E===this._versionOptionName?this._version:this[E]}return D}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((D,u)=>Object.assign(D,u.opts()),{})}error(D,u){if(this._outputConfiguration.outputError(`${D}
23
23
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==="string")this._outputConfiguration.writeErr(`${this._showHelpAfterError}
24
24
  `);else if(this._showHelpAfterError)this._outputConfiguration.writeErr(`
25
- `),this.outputHelp({error:!0});let F=u||{},E=F.exitCode||1,C=F.code||"commander.error";this._exit(E,C,D)}_parseOptionsEnv(){this.options.forEach((D)=>{if(D.envVar&&D.envVar in Y.env){let u=D.attributeName();if(this.getOptionValue(u)===void 0||["default","config","env"].includes(this.getOptionValueSource(u)))if(D.required||D.optional)this.emit(`optionEnv:${D.name()}`,Y.env[D.envVar]);else this.emit(`optionEnv:${D.name()}`)}})}_parseOptionsImplied(){let D=new RE(this.options),u=(F)=>{return this.getOptionValue(F)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(F))};this.options.filter((F)=>F.implied!==void 0&&u(F.attributeName())&&D.valueFromOption(this.getOptionValue(F.attributeName()),F)).forEach((F)=>{Object.keys(F.implied).filter((E)=>!u(E)).forEach((E)=>{this.setOptionValueWithSource(E,F.implied[E],"implied")})})}missingArgument(D){let u=`error: missing required argument '${D}'`;this.error(u,{code:"commander.missingArgument"})}optionMissingArgument(D){let u=`error: option '${D.flags}' argument missing`;this.error(u,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(D){let u=`error: required option '${D.flags}' not specified`;this.error(u,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(D,u){let F=(B)=>{let $=B.attributeName(),A=this.getOptionValue($),R=this.options.find((H)=>H.negate&&$===H.attributeName()),x=this.options.find((H)=>!H.negate&&$===H.attributeName());if(R&&(R.presetArg===void 0&&A===!1||R.presetArg!==void 0&&A===R.presetArg))return R;return x||B},E=(B)=>{let $=F(B),A=$.attributeName();if(this.getOptionValueSource(A)==="env")return`environment variable '${$.envVar}'`;return`option '${$.flags}'`},C=`error: ${E(D)} cannot be used with ${E(u)}`;this.error(C,{code:"commander.conflictingOption"})}unknownOption(D){if(this._allowUnknownOption)return;let u="";if(D.startsWith("--")&&this._showSuggestionAfterError){let E=[],C=this;do{let B=C.createHelp().visibleOptions(C).filter(($)=>$.long).map(($)=>$.long);E=E.concat(B),C=C.parent}while(C&&!C._enablePositionalOptions);u=jF(D,E)}let F=`error: unknown option '${D}'${u}`;this.error(F,{code:"commander.unknownOption"})}_excessArguments(D){if(this._allowExcessArguments)return;let u=this.registeredArguments.length,F=u===1?"":"s",C=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${u} argument${F} but got ${D.length}.`;this.error(C,{code:"commander.excessArguments"})}unknownCommand(){let D=this.args[0],u="";if(this._showSuggestionAfterError){let E=[];this.createHelp().visibleCommands(this).forEach((C)=>{if(E.push(C.name()),C.alias())E.push(C.alias())}),u=jF(D,E)}let F=`error: unknown command '${D}'${u}`;this.error(F,{code:"commander.unknownCommand"})}version(D,u,F){if(D===void 0)return this._version;this._version=D,u=u||"-V, --version",F=F||"output the version number";let E=this.createOption(u,F);return this._versionOptionName=E.attributeName(),this._registerOption(E),this.on("option:"+E.name(),()=>{this._outputConfiguration.writeOut(`${D}
26
- `),this._exit(0,"commander.version",D)}),this}description(D,u){if(D===void 0&&u===void 0)return this._description;if(this._description=D,u)this._argsDescription=u;return this}summary(D){if(D===void 0)return this._summary;return this._summary=D,this}alias(D){if(D===void 0)return this._aliases[0];let u=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)u=this.commands[this.commands.length-1];if(D===u._name)throw Error("Command alias can't be the same as its name");let F=this.parent?._findCommand(D);if(F){let E=[F.name()].concat(F.aliases()).join("|");throw Error(`cannot add alias '${D}' to command '${this.name()}' as already have command '${E}'`)}return u._aliases.push(D),this}aliases(D){if(D===void 0)return this._aliases;return D.forEach((u)=>this.alias(u)),this}usage(D){if(D===void 0){if(this._usage)return this._usage;let u=this.registeredArguments.map((F)=>{return xE(F)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?u:[]).join(" ")}return this._usage=D,this}name(D){if(D===void 0)return this._name;return this._name=D,this}helpGroup(D){if(D===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=D,this}commandsGroup(D){if(D===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=D,this}optionsGroup(D){if(D===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=D,this}_initOptionGroup(D){if(this._defaultOptionGroup&&!D.helpGroupHeading)D.helpGroup(this._defaultOptionGroup)}_initCommandGroup(D){if(this._defaultCommandGroup&&!D.helpGroup())D.helpGroup(this._defaultCommandGroup)}nameFromFilename(D){return this._name=xD.basename(D,xD.extname(D)),this}executableDir(D){if(D===void 0)return this._executableDir;return this._executableDir=D,this}helpInformation(D){let u=this.createHelp(),F=this._getOutputContext(D);u.prepareContext({error:F.error,helpWidth:F.helpWidth,outputHasColors:F.hasColors});let E=u.formatHelp(this,u);if(F.hasColors)return E;return this._outputConfiguration.stripColor(E)}_getOutputContext(D){D=D||{};let u=!!D.error,F,E,C;if(u)F=($)=>this._outputConfiguration.writeErr($),E=this._outputConfiguration.getErrHasColors(),C=this._outputConfiguration.getErrHelpWidth();else F=($)=>this._outputConfiguration.writeOut($),E=this._outputConfiguration.getOutHasColors(),C=this._outputConfiguration.getOutHelpWidth();return{error:u,write:($)=>{if(!E)$=this._outputConfiguration.stripColor($);return F($)},hasColors:E,helpWidth:C}}outputHelp(D){let u;if(typeof D==="function")u=D,D=void 0;let F=this._getOutputContext(D),E={error:F.error,write:F.write,command:this};this._getCommandAndAncestors().reverse().forEach((B)=>B.emit("beforeAllHelp",E)),this.emit("beforeHelp",E);let C=this.helpInformation({error:F.error});if(u){if(C=u(C),typeof C!=="string"&&!Buffer.isBuffer(C))throw Error("outputHelp callback must return a string or a Buffer")}if(F.write(C),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",E),this._getCommandAndAncestors().forEach((B)=>B.emit("afterAllHelp",E))}helpOption(D,u){if(typeof D==="boolean"){if(D){if(this._helpOption===null)this._helpOption=void 0;if(this._defaultOptionGroup)this._initOptionGroup(this._getHelpOption())}else this._helpOption=null;return this}if(this._helpOption=this.createOption(D??"-h, --help",u??"display help for command"),D||u)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption(D){return this._helpOption=D,this._initOptionGroup(D),this}help(D){this.outputHelp(D);let u=Number(Y.exitCode??0);if(u===0&&D&&typeof D!=="function"&&D.error)u=1;this._exit(u,"commander.help","(outputHelp)")}addHelpText(D,u){let F=["beforeAll","before","after","afterAll"];if(!F.includes(D))throw Error(`Unexpected value for position to addHelpText.
25
+ `),this.outputHelp({error:!0});let F=u||{},E=F.exitCode||1,C=F.code||"commander.error";this._exit(E,C,D)}_parseOptionsEnv(){this.options.forEach((D)=>{if(D.envVar&&D.envVar in Y.env){let u=D.attributeName();if(this.getOptionValue(u)===void 0||["default","config","env"].includes(this.getOptionValueSource(u)))if(D.required||D.optional)this.emit(`optionEnv:${D.name()}`,Y.env[D.envVar]);else this.emit(`optionEnv:${D.name()}`)}})}_parseOptionsImplied(){let D=new W1(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 x=B.attributeName(),$=this.getOptionValue(x),R=this.options.find((A)=>A.negate&&x===A.attributeName()),H=this.options.find((A)=>!A.negate&&x===A.attributeName());if(R&&(R.presetArg===void 0&&$===!1||R.presetArg!==void 0&&$===R.presetArg))return R;return H||B},E=(B)=>{let x=F(B),$=x.attributeName();if(this.getOptionValueSource($)==="env")return`environment variable '${x.envVar}'`;return`option '${x.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((x)=>x.long).map((x)=>x.long);E=E.concat(B),C=C.parent}while(C&&!C._enablePositionalOptions);u=MF(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=MF(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 q1(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=RD.basename(D,RD.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=(x)=>this._outputConfiguration.writeErr(x),E=this._outputConfiguration.getErrHasColors(),C=this._outputConfiguration.getErrHelpWidth();else F=(x)=>this._outputConfiguration.writeOut(x),E=this._outputConfiguration.getOutHasColors(),C=this._outputConfiguration.getOutHelpWidth();return{error:u,write:(x)=>{if(!E)x=this._outputConfiguration.stripColor(x);return F(x)},hasColors:E,helpWidth:C}}outputHelp(D){let u;if(typeof D==="function")u=D,D=void 0;let F=this._getOutputContext(D),E={error:F.error,write:F.write,command:this};this._getCommandAndAncestors().reverse().forEach((B)=>B.emit("beforeAllHelp",E)),this.emit("beforeHelp",E);let C=this.helpInformation({error:F.error});if(u){if(C=u(C),typeof C!=="string"&&!Buffer.isBuffer(C))throw Error("outputHelp callback must return a string or a Buffer")}if(F.write(C),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",E),this._getCommandAndAncestors().forEach((B)=>B.emit("afterAllHelp",E))}helpOption(D,u){if(typeof D==="boolean"){if(D){if(this._helpOption===null)this._helpOption=void 0;if(this._defaultOptionGroup)this._initOptionGroup(this._getHelpOption())}else this._helpOption=null;return this}if(this._helpOption=this.createOption(D??"-h, --help",u??"display help for command"),D||u)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption(D){return this._helpOption=D,this._initOptionGroup(D),this}help(D){this.outputHelp(D);let u=Number(Y.exitCode??0);if(u===0&&D&&typeof D!=="function"&&D.error)u=1;this._exit(u,"commander.help","(outputHelp)")}addHelpText(D,u){let F=["beforeAll","before","after","afterAll"];if(!F.includes(D))throw Error(`Unexpected value for position to addHelpText.
27
27
  Expecting one of '${F.join("', '")}'`);let E=`${D}Help`;return this.on(E,(C)=>{let B;if(typeof u==="function")B=u({error:C.error,command:C.command});else B=u;if(B)C.write(`${B}
28
- `)}),this}_outputHelpIfRequested(D){let u=this._getHelpOption();if(u&&D.find((E)=>u.is(E)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function OF(D){return D.map((u)=>{if(!u.startsWith("--inspect"))return u;let F,E="127.0.0.1",C="9229",B;if((B=u.match(/^(--inspect(-brk)?)$/))!==null)F=B[1];else if((B=u.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(F=B[1],/^\d+$/.test(B[3]))C=B[3];else E=B[3];else if((B=u.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)F=B[1],E=B[3],C=B[4];if(F&&C!=="0")return`${F}=${E}:${parseInt(C)+1}`;return u})}function pu(){if(Y.env.NO_COLOR||Y.env.FORCE_COLOR==="0"||Y.env.FORCE_COLOR==="false")return!1;if(Y.env.FORCE_COLOR||Y.env.CLICOLOR_FORCE!==void 0)return!0;return}_E.Command=iu;_E.useColor=pu});var ZF=v((OE)=>{var{Argument:zF}=xu(),{Command:ou}=SF(),{CommanderError:GE,InvalidArgumentError:IF}=pD(),{Help:jE}=cu(),{Option:UF}=tu();OE.program=new ou;OE.createCommand=(D)=>new ou(D);OE.createOption=(D,u)=>new UF(D,u);OE.createArgument=(D,u)=>new zF(D,u);OE.Command=ou;OE.Option=UF;OE.Argument=zF;OE.Help=jE;OE.CommanderError=GE;OE.InvalidArgumentError=IF;OE.InvalidOptionArgumentError=IF});var pF=v((d6,rF)=>{rF.exports=FC;function uC(D){let u={defaultWidth:0,output:process.stdout,tty:o("tty")};if(!D)return u;return Object.keys(u).forEach(function(F){if(!D[F])D[F]=u[F]}),D}function FC(D){let u=uC(D);if(u.output.getWindowSize)return u.output.getWindowSize()[0]||u.defaultWidth;if(u.tty.getWindowSize)return u.tty.getWindowSize()[1]||u.defaultWidth;if(u.output.columns)return u.output.columns;if(process.env.CLI_WIDTH){let F=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(F)&&F!==0)return F}return u.defaultWidth}});var R2=v((R1,N2)=>{var GC=o("stream");class J2 extends GC{#F=null;constructor(D={}){super(D);this.writable=this.readable=!0,this.muted=!1,this.on("pipe",this._onpipe),this.replace=D.replace,this._prompt=D.prompt||null,this._hadControl=!1}#u(D,u){if(this._dest)return this._dest[D];if(this._src)return this._src[D];return u}#D(D,...u){if(typeof this._dest?.[D]==="function")this._dest[D](...u);if(typeof this._src?.[D]==="function")this._src[D](...u)}get isTTY(){if(this.#F!==null)return this.#F;return this.#u("isTTY",!1)}set isTTY(D){this.#F=D}get rows(){return this.#u("rows")}get columns(){return this.#u("columns")}mute(){this.muted=!0}unmute(){this.muted=!1}_onpipe(D){this._src=D}pipe(D,u){return this._dest=D,super.pipe(D,u)}pause(){if(this._src)return this._src.pause()}resume(){if(this._src)return this._src.resume()}write(D){if(this.muted){if(!this.replace)return!0;if(D.match(/^\u001b/)){if(D.indexOf(this._prompt)===0)D=D.slice(this._prompt.length),D=D.replace(/./g,this.replace),D=this._prompt+D;return this._hadControl=!0,this.emit("data",D)}else{if(this._prompt&&this._hadControl&&D.indexOf(this._prompt)===0)this._hadControl=!1,this.emit("data",this._prompt),D=D.slice(this._prompt.length);D=D.toString().replace(/./g,this.replace)}}this.emit("data",D)}end(D){if(this.muted)if(D&&this.replace)D=D.toString().replace(/./g,this.replace);else D=null;if(D)this.emit("data",D);this.emit("end")}destroy(...D){return this.#D("destroy",...D)}destroySoon(...D){return this.#D("destroySoon",...D)}close(...D){return this.#D("close",...D)}}N2.exports=J2});var M2=v((e1,Y2)=>{var TD=o("constants"),MC=process.cwd,Ou=null,qC=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){if(!Ou)Ou=MC.call(process);return Ou};try{process.cwd()}catch(D){}if(typeof process.chdir==="function"){if(Su=process.chdir,process.chdir=function(D){Ou=null,Su.call(process,D)},Object.setPrototypeOf)Object.setPrototypeOf(process.chdir,Su)}var Su;Y2.exports=QC;function QC(D){if(TD.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./))u(D);if(!D.lutimes)F(D);if(D.chown=B(D.chown),D.fchown=B(D.fchown),D.lchown=B(D.lchown),D.chmod=E(D.chmod),D.fchmod=E(D.fchmod),D.lchmod=E(D.lchmod),D.chownSync=$(D.chownSync),D.fchownSync=$(D.fchownSync),D.lchownSync=$(D.lchownSync),D.chmodSync=C(D.chmodSync),D.fchmodSync=C(D.fchmodSync),D.lchmodSync=C(D.lchmodSync),D.stat=A(D.stat),D.fstat=A(D.fstat),D.lstat=A(D.lstat),D.statSync=R(D.statSync),D.fstatSync=R(D.fstatSync),D.lstatSync=R(D.lstatSync),D.chmod&&!D.lchmod)D.lchmod=function(H,J,T){if(T)process.nextTick(T)},D.lchmodSync=function(){};if(D.chown&&!D.lchown)D.lchown=function(H,J,T,_){if(_)process.nextTick(_)},D.lchownSync=function(){};if(qC==="win32")D.rename=typeof D.rename!=="function"?D.rename:function(H){function J(T,_,X){var j=Date.now(),O=0;H(T,_,function I(U){if(U&&(U.code==="EACCES"||U.code==="EPERM"||U.code==="EBUSY")&&Date.now()-j<60000){if(setTimeout(function(){D.stat(_,function(z,d){if(z&&z.code==="ENOENT")H(T,_,I);else X(U)})},O),O<100)O+=10;return}if(X)X(U)})}if(Object.setPrototypeOf)Object.setPrototypeOf(J,H);return J}(D.rename);D.read=typeof D.read!=="function"?D.read:function(H){function J(T,_,X,j,O,I){var U;if(I&&typeof I==="function"){var z=0;U=function(d,DD,_D){if(d&&d.code==="EAGAIN"&&z<10)return z++,H.call(D,T,_,X,j,O,U);I.apply(this,arguments)}}return H.call(D,T,_,X,j,O,U)}if(Object.setPrototypeOf)Object.setPrototypeOf(J,H);return J}(D.read),D.readSync=typeof D.readSync!=="function"?D.readSync:function(H){return function(J,T,_,X,j){var O=0;while(!0)try{return H.call(D,J,T,_,X,j)}catch(I){if(I.code==="EAGAIN"&&O<10){O++;continue}throw I}}}(D.readSync);function u(H){H.lchmod=function(J,T,_){H.open(J,TD.O_WRONLY|TD.O_SYMLINK,T,function(X,j){if(X){if(_)_(X);return}H.fchmod(j,T,function(O){H.close(j,function(I){if(_)_(O||I)})})})},H.lchmodSync=function(J,T){var _=H.openSync(J,TD.O_WRONLY|TD.O_SYMLINK,T),X=!0,j;try{j=H.fchmodSync(_,T),X=!1}finally{if(X)try{H.closeSync(_)}catch(O){}else H.closeSync(_)}return j}}function F(H){if(TD.hasOwnProperty("O_SYMLINK")&&H.futimes)H.lutimes=function(J,T,_,X){H.open(J,TD.O_SYMLINK,function(j,O){if(j){if(X)X(j);return}H.futimes(O,T,_,function(I){H.close(O,function(U){if(X)X(I||U)})})})},H.lutimesSync=function(J,T,_){var X=H.openSync(J,TD.O_SYMLINK),j,O=!0;try{j=H.futimesSync(X,T,_),O=!1}finally{if(O)try{H.closeSync(X)}catch(I){}else H.closeSync(X)}return j};else if(H.futimes)H.lutimes=function(J,T,_,X){if(X)process.nextTick(X)},H.lutimesSync=function(){}}function E(H){if(!H)return H;return function(J,T,_){return H.call(D,J,T,function(X){if(x(X))X=null;if(_)_.apply(this,arguments)})}}function C(H){if(!H)return H;return function(J,T){try{return H.call(D,J,T)}catch(_){if(!x(_))throw _}}}function B(H){if(!H)return H;return function(J,T,_,X){return H.call(D,J,T,_,function(j){if(x(j))j=null;if(X)X.apply(this,arguments)})}}function $(H){if(!H)return H;return function(J,T,_){try{return H.call(D,J,T,_)}catch(X){if(!x(X))throw X}}}function A(H){if(!H)return H;return function(J,T,_){if(typeof T==="function")_=T,T=null;function X(j,O){if(O){if(O.uid<0)O.uid+=4294967296;if(O.gid<0)O.gid+=4294967296}if(_)_.apply(this,arguments)}return T?H.call(D,J,T,X):H.call(D,J,X)}}function R(H){if(!H)return H;return function(J,T){var _=T?H.call(D,J,T):H.call(D,J);if(_){if(_.uid<0)_.uid+=4294967296;if(_.gid<0)_.gid+=4294967296}return _}}function x(H){if(!H)return!0;if(H.code==="ENOSYS")return!0;var J=!process.getuid||process.getuid()!==0;if(J){if(H.code==="EINVAL"||H.code==="EPERM")return!0}return!1}}});var K2=v((DB,Q2)=>{var q2=o("stream").Stream;Q2.exports=KC;function KC(D){return{ReadStream:u,WriteStream:F};function u(E,C){if(!(this instanceof u))return new u(E,C);q2.call(this);var B=this;this.path=E,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,C=C||{};var $=Object.keys(C);for(var A=0,R=$.length;A<R;A++){var x=$[A];this[x]=C[x]}if(this.encoding)this.setEncoding(this.encoding);if(this.start!==void 0){if(typeof this.start!=="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!=="number")throw TypeError("end must be a Number");if(this.start>this.end)throw Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){B._read()});return}D.open(this.path,this.flags,this.mode,function(H,J){if(H){B.emit("error",H),B.readable=!1;return}B.fd=J,B.emit("open",J),B._read()})}function F(E,C){if(!(this instanceof F))return new F(E,C);q2.call(this),this.path=E,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,C=C||{};var B=Object.keys(C);for(var $=0,A=B.length;$<A;$++){var R=B[$];this[R]=C[R]}if(this.start!==void 0){if(typeof this.start!=="number")throw TypeError("start must be a Number");if(this.start<0)throw Error("start must be >= zero");this.pos=this.start}if(this.busy=!1,this._queue=[],this.fd===null)this._open=D.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush()}}});var L2=v((uB,W2)=>{W2.exports=LC;var WC=Object.getPrototypeOf||function(D){return D.__proto__};function LC(D){if(D===null||typeof D!=="object")return D;if(D instanceof Object)var u={__proto__:WC(D)};else var u=Object.create(null);return Object.getOwnPropertyNames(D).forEach(function(F){Object.defineProperty(u,F,Object.getOwnPropertyDescriptor(D,F))}),u}});var q0=v((FB,M0)=>{var k=o("fs"),wC=M2(),VC=K2(),fC=L2(),zu=o("util"),r,Uu;if(typeof Symbol==="function"&&typeof Symbol.for==="function")r=Symbol.for("graceful-fs.queue"),Uu=Symbol.for("graceful-fs.previous");else r="___graceful-fs.queue",Uu="___graceful-fs.previous";function yC(){}function V2(D,u){Object.defineProperty(D,r,{get:function(){return u}})}var MD=yC;if(zu.debuglog)MD=zu.debuglog("gfs4");else if(/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))MD=function(){var D=zu.format.apply(zu,arguments);D="GFS4: "+D.split(/\n/).join(`
29
- GFS4: `),console.error(D)};if(!k[r]){if(U0=global[r]||[],V2(k,U0),k.close=function(D){function u(F,E){return D.call(k,F,function(C){if(!C)w2();if(typeof E==="function")E.apply(this,arguments)})}return Object.defineProperty(u,Uu,{value:D}),u}(k.close),k.closeSync=function(D){function u(F){D.apply(k,arguments),w2()}return Object.defineProperty(u,Uu,{value:D}),u}(k.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){MD(k[r]),o("assert").equal(k[r].length,0)})}var U0;if(!global[r])V2(global,k[r]);M0.exports=Z0(fC(k));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!k.__patched)M0.exports=Z0(k),k.__patched=!0;function Z0(D){wC(D),D.gracefulify=Z0,D.createReadStream=DD,D.createWriteStream=_D;var u=D.readFile;D.readFile=F;function F(S,q,Z){if(typeof q==="function")Z=q,q=null;return c(S,q,Z);function c(t,n,P,b){return u(t,n,function(K){if(K&&(K.code==="EMFILE"||K.code==="ENFILE"))yD([c,[t,n,P],K,b||Date.now(),Date.now()]);else if(typeof P==="function")P.apply(this,arguments)})}}var E=D.writeFile;D.writeFile=C;function C(S,q,Z,c){if(typeof Z==="function")c=Z,Z=null;return t(S,q,Z,c);function t(n,P,b,K,l){return E(n,P,b,function(L){if(L&&(L.code==="EMFILE"||L.code==="ENFILE"))yD([t,[n,P,b,K],L,l||Date.now(),Date.now()]);else if(typeof K==="function")K.apply(this,arguments)})}}var B=D.appendFile;if(B)D.appendFile=$;function $(S,q,Z,c){if(typeof Z==="function")c=Z,Z=null;return t(S,q,Z,c);function t(n,P,b,K,l){return B(n,P,b,function(L){if(L&&(L.code==="EMFILE"||L.code==="ENFILE"))yD([t,[n,P,b,K],L,l||Date.now(),Date.now()]);else if(typeof K==="function")K.apply(this,arguments)})}}var A=D.copyFile;if(A)D.copyFile=R;function R(S,q,Z,c){if(typeof Z==="function")c=Z,Z=0;return t(S,q,Z,c);function t(n,P,b,K,l){return A(n,P,b,function(L){if(L&&(L.code==="EMFILE"||L.code==="ENFILE"))yD([t,[n,P,b,K],L,l||Date.now(),Date.now()]);else if(typeof K==="function")K.apply(this,arguments)})}}var x=D.readdir;D.readdir=J;var H=/^v[0-5]\./;function J(S,q,Z){if(typeof q==="function")Z=q,q=null;var c=H.test(process.version)?function(P,b,K,l){return x(P,t(P,b,K,l))}:function(P,b,K,l){return x(P,b,t(P,b,K,l))};return c(S,q,Z);function t(n,P,b,K){return function(l,L){if(l&&(l.code==="EMFILE"||l.code==="ENFILE"))yD([c,[n,P,b],l,K||Date.now(),Date.now()]);else{if(L&&L.sort)L.sort();if(typeof b==="function")b.call(this,l,L)}}}}if(process.version.substr(0,4)==="v0.8"){var T=VC(D);I=T.ReadStream,z=T.WriteStream}var _=D.ReadStream;if(_)I.prototype=Object.create(_.prototype),I.prototype.open=U;var X=D.WriteStream;if(X)z.prototype=Object.create(X.prototype),z.prototype.open=d;Object.defineProperty(D,"ReadStream",{get:function(){return I},set:function(S){I=S},enumerable:!0,configurable:!0}),Object.defineProperty(D,"WriteStream",{get:function(){return z},set:function(S){z=S},enumerable:!0,configurable:!0});var j=I;Object.defineProperty(D,"FileReadStream",{get:function(){return j},set:function(S){j=S},enumerable:!0,configurable:!0});var O=z;Object.defineProperty(D,"FileWriteStream",{get:function(){return O},set:function(S){O=S},enumerable:!0,configurable:!0});function I(S,q){if(this instanceof I)return _.apply(this,arguments),this;else return I.apply(Object.create(I.prototype),arguments)}function U(){var S=this;nu(S.path,S.flags,S.mode,function(q,Z){if(q){if(S.autoClose)S.destroy();S.emit("error",q)}else S.fd=Z,S.emit("open",Z),S.read()})}function z(S,q){if(this instanceof z)return X.apply(this,arguments),this;else return z.apply(Object.create(z.prototype),arguments)}function d(){var S=this;nu(S.path,S.flags,S.mode,function(q,Z){if(q)S.destroy(),S.emit("error",q);else S.fd=Z,S.emit("open",Z)})}function DD(S,q){return new D.ReadStream(S,q)}function _D(S,q){return new D.WriteStream(S,q)}var lD=D.open;D.open=nu;function nu(S,q,Z,c){if(typeof Z==="function")c=Z,Z=null;return t(S,q,Z,c);function t(n,P,b,K,l){return lD(n,P,b,function(L,k8){if(L&&(L.code==="EMFILE"||L.code==="ENFILE"))yD([t,[n,P,b,K],L,l||Date.now(),Date.now()]);else if(typeof K==="function")K.apply(this,arguments)})}}return D}function yD(D){MD("ENQUEUE",D[0].name,D[1]),k[r].push(D),Y0()}var Iu;function w2(){var D=Date.now();for(var u=0;u<k[r].length;++u)if(k[r][u].length>2)k[r][u][3]=D,k[r][u][4]=D;Y0()}function Y0(){if(clearTimeout(Iu),Iu=void 0,k[r].length===0)return;var D=k[r].shift(),u=D[0],F=D[1],E=D[2],C=D[3],B=D[4];if(C===void 0)MD("RETRY",u.name,F),u.apply(null,F);else if(Date.now()-C>=60000){MD("TIMEOUT",u.name,F);var $=F.pop();if(typeof $==="function")$.call(null,E)}else{var A=Date.now()-B,R=Math.max(B-C,1),x=Math.min(R*1.2,100);if(A>=x)MD("RETRY",u.name,F),u.apply(null,F.concat([C]));else k[r].push(D)}if(Iu===void 0)Iu=setTimeout(Y0,0)}});var y2=v((EB,f2)=>{function ED(D,u){if(typeof u==="boolean")u={forever:u};if(this._originalTimeouts=JSON.parse(JSON.stringify(D)),this._timeouts=D,this._options=u||{},this._maxRetryTime=u&&u.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever)this._cachedTimeouts=this._timeouts.slice(0)}f2.exports=ED;ED.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};ED.prototype.stop=function(){if(this._timeout)clearTimeout(this._timeout);this._timeouts=[],this._cachedTimeouts=null};ED.prototype.retry=function(D){if(this._timeout)clearTimeout(this._timeout);if(!D)return!1;var u=new Date().getTime();if(D&&u-this._operationStart>=this._maxRetryTime)return this._errors.unshift(Error("RetryOperation timeout occurred")),!1;this._errors.push(D);var F=this._timeouts.shift();if(F===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),F=this._timeouts.shift();else return!1;var E=this,C=setTimeout(function(){if(E._attempts++,E._operationTimeoutCb){if(E._timeout=setTimeout(function(){E._operationTimeoutCb(E._attempts)},E._operationTimeout),E._options.unref)E._timeout.unref()}E._fn(E._attempts)},F);if(this._options.unref)C.unref();return!0};ED.prototype.attempt=function(D,u){if(this._fn=D,u){if(u.timeout)this._operationTimeout=u.timeout;if(u.cb)this._operationTimeoutCb=u.cb}var F=this;if(this._operationTimeoutCb)this._timeout=setTimeout(function(){F._operationTimeoutCb()},F._operationTimeout);this._operationStart=new Date().getTime(),this._fn(this._attempts)};ED.prototype.try=function(D){console.log("Using RetryOperation.try() is deprecated"),this.attempt(D)};ED.prototype.start=function(D){console.log("Using RetryOperation.start() is deprecated"),this.attempt(D)};ED.prototype.start=ED.prototype.try;ED.prototype.errors=function(){return this._errors};ED.prototype.attempts=function(){return this._attempts};ED.prototype.mainError=function(){if(this._errors.length===0)return null;var D={},u=null,F=0;for(var E=0;E<this._errors.length;E++){var C=this._errors[E],B=C.message,$=(D[B]||0)+1;if(D[B]=$,$>=F)u=C,F=$}return u}});var k2=v((kC)=>{var PC=y2();kC.operation=function(D){var u=kC.timeouts(D);return new PC(u,{forever:D&&D.forever,unref:D&&D.unref,maxRetryTime:D&&D.maxRetryTime})};kC.timeouts=function(D){if(D instanceof Array)return[].concat(D);var u={retries:10,factor:2,minTimeout:1000,maxTimeout:1/0,randomize:!1};for(var F in D)u[F]=D[F];if(u.minTimeout>u.maxTimeout)throw Error("minTimeout is greater than maxTimeout");var E=[];for(var C=0;C<u.retries;C++)E.push(this.createTimeout(C,u));if(D&&D.forever&&!E.length)E.push(this.createTimeout(C,u));return E.sort(function(B,$){return B-$}),E};kC.createTimeout=function(D,u){var F=u.randomize?Math.random()+1:1,E=Math.round(F*u.minTimeout*Math.pow(u.factor,D));return E=Math.min(E,u.maxTimeout),E};kC.wrap=function(D,u,F){if(u instanceof Array)F=u,u=null;if(!F){F=[];for(var E in D)if(typeof D[E]==="function")F.push(E)}for(var C=0;C<F.length;C++){var B=F[C],$=D[B];D[B]=function(R){var x=kC.operation(u),H=Array.prototype.slice.call(arguments,1),J=H.pop();H.push(function(T){if(x.retry(T))return;if(T)arguments[0]=x.mainError();J.apply(this,arguments)}),x.attempt(function(){R.apply(D,H)})}.bind(D,$),D[B].options=u}}});var h2=v((BB,Zu)=>{Zu.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];if(process.platform!=="win32")Zu.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")Zu.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var b2=v(($B,kD)=>{var y=global.process,qD=function(D){return D&&typeof D==="object"&&typeof D.removeListener==="function"&&typeof D.emit==="function"&&typeof D.reallyExit==="function"&&typeof D.listeners==="function"&&typeof D.kill==="function"&&typeof D.pid==="number"&&typeof D.on==="function"};if(!qD(y))kD.exports=function(){return function(){}};else{if(Q0=o("assert"),QD=h2(),K0=/^win/i.test(y.platform),PD=o("events"),typeof PD!=="function")PD=PD.EventEmitter;if(y.__signal_exit_emitter__)g=y.__signal_exit_emitter__;else g=y.__signal_exit_emitter__=new PD,g.count=0,g.emitted={};if(!g.infinite)g.setMaxListeners(1/0),g.infinite=!0;kD.exports=function(D,u){if(!qD(global.process))return function(){};if(Q0.equal(typeof D,"function","a callback must be provided for exit handler"),KD===!1)Yu();var F="exit";if(u&&u.alwaysLast)F="afterexit";var E=function(){if(g.removeListener(F,D),g.listeners("exit").length===0&&g.listeners("afterexit").length===0)Cu()};return g.on(F,D),E},Cu=function(){if(!KD||!qD(global.process))return;KD=!1,QD.forEach(function(u){try{y.removeListener(u,Bu[u])}catch(F){}}),y.emit=$u,y.reallyExit=Mu,g.count-=1},kD.exports.unload=Cu,XD=function(u,F,E){if(g.emitted[u])return;g.emitted[u]=!0,g.emit(u,F,E)},Bu={},QD.forEach(function(D){Bu[D]=function(){if(!qD(global.process))return;var F=y.listeners(D);if(F.length===g.count){if(Cu(),XD("exit",null,D),XD("afterexit",null,D),K0&&D==="SIGHUP")D="SIGINT";y.kill(y.pid,D)}}}),kD.exports.signals=function(){return QD},KD=!1,Yu=function(){if(KD||!qD(global.process))return;KD=!0,g.count+=1,QD=QD.filter(function(u){try{return y.on(u,Bu[u]),!0}catch(F){return!1}}),y.emit=L0,y.reallyExit=W0},kD.exports.load=Yu,Mu=y.reallyExit,W0=function(u){if(!qD(global.process))return;y.exitCode=u||0,XD("exit",y.exitCode,null),XD("afterexit",y.exitCode,null),Mu.call(y,y.exitCode)},$u=y.emit,L0=function(u,F){if(u==="exit"&&qD(global.process)){if(F!==void 0)y.exitCode=F;var E=$u.apply(this,arguments);return XD("exit",y.exitCode,null),XD("afterexit",y.exitCode,null),E}else return $u.apply(this,arguments)}}var Q0,QD,K0,PD,g,Cu,XD,Bu,KD,Yu,Mu,W0,$u,L0});var m2=v((nC,w0)=>{var v2=Symbol();function mC(D,u,F){let E=u[v2];if(E)return u.stat(D,(B,$)=>{if(B)return F(B);F(null,$.mtime,E)});let C=new Date(Math.ceil(Date.now()/1000)*1000+5);u.utimes(D,C,C,(B)=>{if(B)return F(B);u.stat(D,($,A)=>{if($)return F($);let R=A.mtime.getTime()%1000===0?"s":"ms";Object.defineProperty(u,v2,{value:R}),F(null,A.mtime,R)})})}function gC(D){let u=Date.now();if(D==="s")u=Math.ceil(u/1000)*1000;return new Date(u)}nC.probe=mC;nC.getMtime=gC});var t2=v((aC,Hu)=>{var tC=o("path"),y0=q0(),lC=k2(),rC=b2(),g2=m2(),JD={};function Au(D,u){return u.lockfilePath||`${D}.lock`}function P0(D,u,F){if(!u.realpath)return F(null,tC.resolve(D));u.fs.realpath(D,F)}function f0(D,u,F){let E=Au(D,u);u.fs.mkdir(E,(C)=>{if(!C)return g2.probe(E,u.fs,(B,$,A)=>{if(B)return u.fs.rmdir(E,()=>{}),F(B);F(null,$,A)});if(C.code!=="EEXIST")return F(C);if(u.stale<=0)return F(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));u.fs.stat(E,(B,$)=>{if(B){if(B.code==="ENOENT")return f0(D,{...u,stale:0},F);return F(B)}if(!n2($,u))return F(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));d2(D,u,(A)=>{if(A)return F(A);f0(D,{...u,stale:0},F)})})})}function n2(D,u){return D.mtime.getTime()<Date.now()-u.stale}function d2(D,u,F){u.fs.rmdir(Au(D,u),(E)=>{if(E&&E.code!=="ENOENT")return F(E);F()})}function qu(D,u){let F=JD[D];if(F.updateTimeout)return;if(F.updateDelay=F.updateDelay||u.update,F.updateTimeout=setTimeout(()=>{F.updateTimeout=null,u.fs.stat(F.lockfilePath,(E,C)=>{let B=F.lastUpdate+u.stale<Date.now();if(E){if(E.code==="ENOENT"||B)return V0(D,F,Object.assign(E,{code:"ECOMPROMISED"}));return F.updateDelay=1000,qu(D,u)}if(F.mtime.getTime()!==C.mtime.getTime())return V0(D,F,Object.assign(Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let A=g2.getMtime(F.mtimePrecision);u.fs.utimes(F.lockfilePath,A,A,(R)=>{let x=F.lastUpdate+u.stale<Date.now();if(F.released)return;if(R){if(R.code==="ENOENT"||x)return V0(D,F,Object.assign(R,{code:"ECOMPROMISED"}));return F.updateDelay=1000,qu(D,u)}F.mtime=A,F.lastUpdate=Date.now(),F.updateDelay=null,qu(D,u)})})},F.updateDelay),F.updateTimeout.unref)F.updateTimeout.unref()}function V0(D,u,F){if(u.released=!0,u.updateTimeout)clearTimeout(u.updateTimeout);if(JD[D]===u)delete JD[D];u.options.onCompromised(F)}function pC(D,u,F){u={stale:1e4,update:null,realpath:!0,retries:0,fs:y0,onCompromised:(E)=>{throw E},...u},u.retries=u.retries||0,u.retries=typeof u.retries==="number"?{retries:u.retries}:u.retries,u.stale=Math.max(u.stale||0,2000),u.update=u.update==null?u.stale/2:u.update||0,u.update=Math.max(Math.min(u.update,u.stale/2),1000),P0(D,u,(E,C)=>{if(E)return F(E);let B=lC.operation(u.retries);B.attempt(()=>{f0(C,u,($,A,R)=>{if(B.retry($))return;if($)return F(B.mainError());let x=JD[C]={lockfilePath:Au(C,u),mtime:A,mtimePrecision:R,options:u,lastUpdate:Date.now()};qu(C,u),F(null,(H)=>{if(x.released)return H&&H(Object.assign(Error("Lock is already released"),{code:"ERELEASED"}));c2(C,{...u,realpath:!1},H)})})})})}function c2(D,u,F){u={fs:y0,realpath:!0,...u},P0(D,u,(E,C)=>{if(E)return F(E);let B=JD[C];if(!B)return F(Object.assign(Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));B.updateTimeout&&clearTimeout(B.updateTimeout),B.released=!0,delete JD[C],d2(C,u,F)})}function iC(D,u,F){u={stale:1e4,realpath:!0,fs:y0,...u},u.stale=Math.max(u.stale||0,2000),P0(D,u,(E,C)=>{if(E)return F(E);u.fs.stat(Au(C,u),(B,$)=>{if(B)return B.code==="ENOENT"?F(null,!1):F(B);return F(null,!n2($,u))})})}function oC(){return JD}rC(()=>{for(let D in JD){let u=JD[D].options;try{u.fs.rmdirSync(Au(D,u))}catch(F){}}});aC.lock=pC;aC.unlock=c2;aC.check=iC;aC.getLocks=oC});var r2=v((AB,l2)=>{var F8=q0();function E8(D){let u=["mkdir","realpath","stat","rmdir","utimes"],F={...D};return u.forEach((E)=>{F[E]=(...C)=>{let B=C.pop(),$;try{$=D[`${E}Sync`](...C)}catch(A){return B(A)}B(null,$)}}),F}function C8(D){return(...u)=>new Promise((F,E)=>{u.push((C,B)=>{if(C)E(C);else F(B)}),D(...u)})}function B8(D){return(...u)=>{let F,E;if(u.push((C,B)=>{F=C,E=B}),D(...u),F)throw F;return E}}function $8(D){if(D={...D},D.fs=E8(D.fs||F8),typeof D.retries==="number"&&D.retries>0||D.retries&&typeof D.retries.retries==="number"&&D.retries.retries>0)throw Object.assign(Error("Cannot use retries with the sync api"),{code:"ESYNC"});return D}l2.exports={toPromise:C8,toSync:B8,toSyncOptions:$8}});var i2=v((HB,GD)=>{var hD=t2(),{toPromise:Qu,toSync:Ku,toSyncOptions:k0}=r2();async function p2(D,u){let F=await Qu(hD.lock)(D,u);return Qu(F)}function A8(D,u){let F=Ku(hD.lock)(D,k0(u));return Ku(F)}function H8(D,u){return Qu(hD.unlock)(D,u)}function x8(D,u){return Ku(hD.unlock)(D,k0(u))}function J8(D,u){return Qu(hD.check)(D,u)}function N8(D,u){return Ku(hD.check)(D,k0(u))}GD.exports=p2;GD.exports.lock=p2;GD.exports.unlock=H8;GD.exports.lockSync=A8;GD.exports.unlockSync=x8;GD.exports.check=J8;GD.exports.checkSync=N8});var Q3=v((Z4,q3)=>{var dD=1000,cD=dD*60,tD=cD*60,wD=tD*24,q8=wD*7,Q8=wD*365.25;q3.exports=function(D,u){u=u||{};var F=typeof D;if(F==="string"&&D.length>0)return K8(D);else if(F==="number"&&isFinite(D))return u.long?L8(D):W8(D);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(D))};function K8(D){if(D=String(D),D.length>100)return;var u=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(D);if(!u)return;var F=parseFloat(u[1]),E=(u[2]||"ms").toLowerCase();switch(E){case"years":case"year":case"yrs":case"yr":case"y":return F*Q8;case"weeks":case"week":case"w":return F*q8;case"days":case"day":case"d":return F*wD;case"hours":case"hour":case"hrs":case"hr":case"h":return F*tD;case"minutes":case"minute":case"mins":case"min":case"m":return F*cD;case"seconds":case"second":case"secs":case"sec":case"s":return F*dD;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return F;default:return}}function W8(D){var u=Math.abs(D);if(u>=wD)return Math.round(D/wD)+"d";if(u>=tD)return Math.round(D/tD)+"h";if(u>=cD)return Math.round(D/cD)+"m";if(u>=dD)return Math.round(D/dD)+"s";return D+"ms"}function L8(D){var u=Math.abs(D);if(u>=wD)return gu(D,u,wD,"day");if(u>=tD)return gu(D,u,tD,"hour");if(u>=cD)return gu(D,u,cD,"minute");if(u>=dD)return gu(D,u,dD,"second");return D+" ms"}function gu(D,u,F,E){var C=u>=F*1.5;return Math.round(D/F)+" "+E+(C?"s":"")}});var YF=rD(ZF(),1),{program:t8,createCommand:l8,createArgument:r8,createOption:p8,CommanderError:i8,InvalidArgumentError:o8,InvalidOptionArgumentError:a8,Command:MF,Argument:s8,Option:e8,Help:D6}=YF.default;var qF=(D=0)=>(u)=>`\x1B[${u+D}m`,QF=(D=0)=>(u)=>`\x1B[${38+D};5;${u}m`,KF=(D=0)=>(u,F,E)=>`\x1B[${38+D};2;${u};${F};${E}m`,w={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},F6=Object.keys(w.modifier),LE=Object.keys(w.color),wE=Object.keys(w.bgColor),E6=[...LE,...wE];function VE(){let D=new Map;for(let[u,F]of Object.entries(w)){for(let[E,C]of Object.entries(F))w[E]={open:`\x1B[${C[0]}m`,close:`\x1B[${C[1]}m`},F[E]=w[E],D.set(C[0],C[1]);Object.defineProperty(w,u,{value:F,enumerable:!1})}return Object.defineProperty(w,"codes",{value:D,enumerable:!1}),w.color.close="\x1B[39m",w.bgColor.close="\x1B[49m",w.color.ansi=qF(),w.color.ansi256=QF(),w.color.ansi16m=KF(),w.bgColor.ansi=qF(10),w.bgColor.ansi256=QF(10),w.bgColor.ansi16m=KF(10),Object.defineProperties(w,{rgbToAnsi256:{value(u,F,E){if(u===F&&F===E){if(u<8)return 16;if(u>248)return 231;return Math.round((u-8)/247*24)+232}return 16+36*Math.round(u/255*5)+6*Math.round(F/255*5)+Math.round(E/255*5)},enumerable:!1},hexToRgb:{value(u){let F=/[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));if(!F)return[0,0,0];let[E]=F;if(E.length===3)E=[...E].map((B)=>B+B).join("");let C=Number.parseInt(E,16);return[C>>16&255,C>>8&255,C&255]},enumerable:!1},hexToAnsi256:{value:(u)=>w.rgbToAnsi256(...w.hexToRgb(u)),enumerable:!1},ansi256ToAnsi:{value(u){if(u<8)return 30+u;if(u<16)return 90+(u-8);let F,E,C;if(u>=232)F=((u-232)*10+8)/255,E=F,C=F;else{u-=16;let A=u%36;F=Math.floor(u/36)/5,E=Math.floor(A/6)/5,C=A%6/5}let B=Math.max(F,E,C)*2;if(B===0)return 30;let $=30+(Math.round(C)<<2|Math.round(E)<<1|Math.round(F));if(B===2)$+=60;return $},enumerable:!1},rgbToAnsi:{value:(u,F,E)=>w.ansi256ToAnsi(w.rgbToAnsi256(u,F,E)),enumerable:!1},hexToAnsi:{value:(u)=>w.ansi256ToAnsi(w.hexToAnsi256(u)),enumerable:!1}}),w}var fE=VE(),CD=fE;import au from"process";import yE from"os";import WF from"tty";function uD(D,u=globalThis.Deno?globalThis.Deno.args:au.argv){let F=D.startsWith("-")?"":D.length===1?"-":"--",E=u.indexOf(F+D),C=u.indexOf("--");return E!==-1&&(C===-1||E<C)}var{env:V}=au,Nu;if(uD("no-color")||uD("no-colors")||uD("color=false")||uD("color=never"))Nu=0;else if(uD("color")||uD("colors")||uD("color=true")||uD("color=always"))Nu=1;function PE(){if("FORCE_COLOR"in V){if(V.FORCE_COLOR==="true")return 1;if(V.FORCE_COLOR==="false")return 0;return V.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(V.FORCE_COLOR,10),3)}}function kE(D){if(D===0)return!1;return{level:D,hasBasic:!0,has256:D>=2,has16m:D>=3}}function hE(D,{streamIsTTY:u,sniffFlags:F=!0}={}){let E=PE();if(E!==void 0)Nu=E;let C=F?Nu:E;if(C===0)return 0;if(F){if(uD("color=16m")||uD("color=full")||uD("color=truecolor"))return 3;if(uD("color=256"))return 2}if("TF_BUILD"in V&&"AGENT_NAME"in V)return 1;if(D&&!u&&C===void 0)return 0;let B=C||0;if(V.TERM==="dumb")return B;if(au.platform==="win32"){let $=yE.release().split(".");if(Number($[0])>=10&&Number($[2])>=10586)return Number($[2])>=14931?3:2;return 1}if("CI"in V){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(($)=>($ in V)))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(($)=>($ in V))||V.CI_NAME==="codeship")return 1;return B}if("TEAMCITY_VERSION"in V)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(V.TEAMCITY_VERSION)?1:0;if(V.COLORTERM==="truecolor")return 3;if(V.TERM==="xterm-kitty")return 3;if(V.TERM==="xterm-ghostty")return 3;if(V.TERM==="wezterm")return 3;if("TERM_PROGRAM"in V){let $=Number.parseInt((V.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(V.TERM_PROGRAM){case"iTerm.app":return $>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(V.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(V.TERM))return 1;if("COLORTERM"in V)return 1;return B}function LF(D,u={}){let F=hE(D,{streamIsTTY:D&&D.isTTY,...u});return kE(F)}var bE={stdout:LF({isTTY:WF.isatty(1)}),stderr:LF({isTTY:WF.isatty(2)})},wF=bE;function VF(D,u,F){let E=D.indexOf(u);if(E===-1)return D;let C=u.length,B=0,$="";do $+=D.slice(B,E)+u+F,B=E+C,E=D.indexOf(u,B);while(E!==-1);return $+=D.slice(B),$}function fF(D,u,F,E){let C=0,B="";do{let $=D[E-1]==="\r";B+=D.slice(C,$?E-1:E)+u+($?`\r
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 qF(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 u0(){if(Y.env.NO_COLOR||Y.env.FORCE_COLOR==="0"||Y.env.FORCE_COLOR==="false")return!1;if(Y.env.FORCE_COLOR||Y.env.CLICOLOR_FORCE!==void 0)return!0;return}w1.Command=F0;w1.useColor=u0});var LF=w((P1)=>{var{Argument:KF}=Gu(),{Command:E0}=QF(),{CommanderError:V1,InvalidArgumentError:WF}=aD(),{Help:y1}=au(),{Option:wF}=su();P1.program=new E0;P1.createCommand=(D)=>new E0(D);P1.createOption=(D,u)=>new wF(D,u);P1.createArgument=(D,u)=>new KF(D,u);P1.Command=E0;P1.Option=wF;P1.Argument=KF;P1.Help=y1;P1.CommanderError=V1;P1.InvalidArgumentError=WF;P1.InvalidOptionArgumentError=WF});var F2=w((S6,u2)=>{u2.exports=IE;function XE(D){let u={defaultWidth:0,output:process.stdout,tty:l("tty")};if(!D)return u;return Object.keys(u).forEach(function(F){if(!D[F])D[F]=u[F]}),D}function IE(D){let u=XE(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 j2=w((b6,I2)=>{var VE=l("stream");class X2 extends VE{#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)}}I2.exports=X2});var V2=w((MB,f2)=>{var _D=l("constants"),nE=process.cwd,Uu=null,dE=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){if(!Uu)Uu=nE.call(process);return Uu};try{process.cwd()}catch(D){}if(typeof process.chdir==="function"){if(Yu=process.chdir,process.chdir=function(D){Uu=null,Yu.call(process,D)},Object.setPrototypeOf)Object.setPrototypeOf(process.chdir,Yu)}var Yu;f2.exports=cE;function cE(D){if(_D.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=x(D.chownSync),D.fchownSync=x(D.fchownSync),D.lchownSync=x(D.lchownSync),D.chmodSync=C(D.chmodSync),D.fchmodSync=C(D.fchmodSync),D.lchmodSync=C(D.lchmodSync),D.stat=$(D.stat),D.fstat=$(D.fstat),D.lstat=$(D.lstat),D.statSync=R(D.statSync),D.fstatSync=R(D.fstatSync),D.lstatSync=R(D.lstatSync),D.chmod&&!D.lchmod)D.lchmod=function(A,J,S){if(S)process.nextTick(S)},D.lchmodSync=function(){};if(D.chown&&!D.lchown)D.lchown=function(A,J,S,T){if(T)process.nextTick(T)},D.lchownSync=function(){};if(dE==="win32")D.rename=typeof D.rename!=="function"?D.rename:function(A){function J(S,T,_){var I=Date.now(),O=0;A(S,T,function Z(G){if(G&&(G.code==="EACCES"||G.code==="EPERM"||G.code==="EBUSY")&&Date.now()-I<60000){if(setTimeout(function(){D.stat(T,function(j,g){if(j&&j.code==="ENOENT")A(S,T,Z);else _(G)})},O),O<100)O+=10;return}if(_)_(G)})}if(Object.setPrototypeOf)Object.setPrototypeOf(J,A);return J}(D.rename);D.read=typeof D.read!=="function"?D.read:function(A){function J(S,T,_,I,O,Z){var G;if(Z&&typeof Z==="function"){var j=0;G=function(g,s,SD){if(g&&g.code==="EAGAIN"&&j<10)return j++,A.call(D,S,T,_,I,O,G);Z.apply(this,arguments)}}return A.call(D,S,T,_,I,O,G)}if(Object.setPrototypeOf)Object.setPrototypeOf(J,A);return J}(D.read),D.readSync=typeof D.readSync!=="function"?D.readSync:function(A){return function(J,S,T,_,I){var O=0;while(!0)try{return A.call(D,J,S,T,_,I)}catch(Z){if(Z.code==="EAGAIN"&&O<10){O++;continue}throw Z}}}(D.readSync);function u(A){A.lchmod=function(J,S,T){A.open(J,_D.O_WRONLY|_D.O_SYMLINK,S,function(_,I){if(_){if(T)T(_);return}A.fchmod(I,S,function(O){A.close(I,function(Z){if(T)T(O||Z)})})})},A.lchmodSync=function(J,S){var T=A.openSync(J,_D.O_WRONLY|_D.O_SYMLINK,S),_=!0,I;try{I=A.fchmodSync(T,S),_=!1}finally{if(_)try{A.closeSync(T)}catch(O){}else A.closeSync(T)}return I}}function F(A){if(_D.hasOwnProperty("O_SYMLINK")&&A.futimes)A.lutimes=function(J,S,T,_){A.open(J,_D.O_SYMLINK,function(I,O){if(I){if(_)_(I);return}A.futimes(O,S,T,function(Z){A.close(O,function(G){if(_)_(Z||G)})})})},A.lutimesSync=function(J,S,T){var _=A.openSync(J,_D.O_SYMLINK),I,O=!0;try{I=A.futimesSync(_,S,T),O=!1}finally{if(O)try{A.closeSync(_)}catch(Z){}else A.closeSync(_)}return I};else if(A.futimes)A.lutimes=function(J,S,T,_){if(_)process.nextTick(_)},A.lutimesSync=function(){}}function E(A){if(!A)return A;return function(J,S,T){return A.call(D,J,S,function(_){if(H(_))_=null;if(T)T.apply(this,arguments)})}}function C(A){if(!A)return A;return function(J,S){try{return A.call(D,J,S)}catch(T){if(!H(T))throw T}}}function B(A){if(!A)return A;return function(J,S,T,_){return A.call(D,J,S,T,function(I){if(H(I))I=null;if(_)_.apply(this,arguments)})}}function x(A){if(!A)return A;return function(J,S,T){try{return A.call(D,J,S,T)}catch(_){if(!H(_))throw _}}}function $(A){if(!A)return A;return function(J,S,T){if(typeof S==="function")T=S,S=null;function _(I,O){if(O){if(O.uid<0)O.uid+=4294967296;if(O.gid<0)O.gid+=4294967296}if(T)T.apply(this,arguments)}return S?A.call(D,J,S,_):A.call(D,J,_)}}function R(A){if(!A)return A;return function(J,S){var T=S?A.call(D,J,S):A.call(D,J);if(T){if(T.uid<0)T.uid+=4294967296;if(T.gid<0)T.gid+=4294967296}return T}}function H(A){if(!A)return!0;if(A.code==="ENOSYS")return!0;var J=!process.getuid||process.getuid()!==0;if(J){if(A.code==="EINVAL"||A.code==="EPERM")return!0}return!1}}});var k2=w((qB,P2)=>{var y2=l("stream").Stream;P2.exports=tE;function tE(D){return{ReadStream:u,WriteStream:F};function u(E,C){if(!(this instanceof u))return new u(E,C);y2.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 x=Object.keys(C);for(var $=0,R=x.length;$<R;$++){var H=x[$];this[H]=C[H]}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(A,J){if(A){B.emit("error",A),B.readable=!1;return}B.fd=J,B.emit("open",J),B._read()})}function F(E,C){if(!(this instanceof F))return new F(E,C);y2.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 x=0,$=B.length;x<$;x++){var R=B[x];this[R]=C[R]}if(this.start!==void 0){if(typeof this.start!=="number")throw TypeError("start must be a Number");if(this.start<0)throw Error("start must be >= zero");this.pos=this.start}if(this.busy=!1,this._queue=[],this.fd===null)this._open=D.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush()}}});var b2=w((QB,h2)=>{h2.exports=lE;var rE=Object.getPrototypeOf||function(D){return D.__proto__};function lE(D){if(D===null||typeof D!=="object")return D;if(D instanceof Object)var u={__proto__:rE(D)};else var u=Object.create(null);return Object.getOwnPropertyNames(D).forEach(function(F){Object.defineProperty(u,F,Object.getOwnPropertyDescriptor(D,F))}),u}});var V0=w((KB,f0)=>{var h=l("fs"),iE=V2(),pE=k2(),oE=b2(),Mu=l("util"),i,Qu;if(typeof Symbol==="function"&&typeof Symbol.for==="function")i=Symbol.for("graceful-fs.queue"),Qu=Symbol.for("graceful-fs.previous");else i="___graceful-fs.queue",Qu="___graceful-fs.previous";function aE(){}function m2(D,u){Object.defineProperty(D,i,{get:function(){return u}})}var KD=aE;if(Mu.debuglog)KD=Mu.debuglog("gfs4");else if(/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))KD=function(){var D=Mu.format.apply(Mu,arguments);D="GFS4: "+D.split(/\n/).join(`
29
+ GFS4: `),console.error(D)};if(!h[i]){if(W0=global[i]||[],m2(h,W0),h.close=function(D){function u(F,E){return D.call(h,F,function(C){if(!C)v2();if(typeof E==="function")E.apply(this,arguments)})}return Object.defineProperty(u,Qu,{value:D}),u}(h.close),h.closeSync=function(D){function u(F){D.apply(h,arguments),v2()}return Object.defineProperty(u,Qu,{value:D}),u}(h.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){KD(h[i]),l("assert").equal(h[i].length,0)})}var W0;if(!global[i])m2(global,h[i]);f0.exports=w0(oE(h));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!h.__patched)f0.exports=w0(h),h.__patched=!0;function w0(D){iE(D),D.gracefulify=w0,D.createReadStream=s,D.createWriteStream=SD;var u=D.readFile;D.readFile=F;function F(z,q,U){if(typeof q==="function")U=q,q=null;return c(z,q,U);function c(t,d,k,v){return u(t,d,function(K){if(K&&(K.code==="EMFILE"||K.code==="ENFILE"))bD([c,[t,d,k],K,v||Date.now(),Date.now()]);else if(typeof k==="function")k.apply(this,arguments)})}}var E=D.writeFile;D.writeFile=C;function C(z,q,U,c){if(typeof U==="function")c=U,U=null;return t(z,q,U,c);function t(d,k,v,K,r){return E(d,k,v,function(L){if(L&&(L.code==="EMFILE"||L.code==="ENFILE"))bD([t,[d,k,v,K],L,r||Date.now(),Date.now()]);else if(typeof K==="function")K.apply(this,arguments)})}}var B=D.appendFile;if(B)D.appendFile=x;function x(z,q,U,c){if(typeof U==="function")c=U,U=null;return t(z,q,U,c);function t(d,k,v,K,r){return B(d,k,v,function(L){if(L&&(L.code==="EMFILE"||L.code==="ENFILE"))bD([t,[d,k,v,K],L,r||Date.now(),Date.now()]);else if(typeof K==="function")K.apply(this,arguments)})}}var $=D.copyFile;if($)D.copyFile=R;function R(z,q,U,c){if(typeof U==="function")c=U,U=0;return t(z,q,U,c);function t(d,k,v,K,r){return $(d,k,v,function(L){if(L&&(L.code==="EMFILE"||L.code==="ENFILE"))bD([t,[d,k,v,K],L,r||Date.now(),Date.now()]);else if(typeof K==="function")K.apply(this,arguments)})}}var H=D.readdir;D.readdir=J;var A=/^v[0-5]\./;function J(z,q,U){if(typeof q==="function")U=q,q=null;var c=A.test(process.version)?function(k,v,K,r){return H(k,t(k,v,K,r))}:function(k,v,K,r){return H(k,v,t(k,v,K,r))};return c(z,q,U);function t(d,k,v,K){return function(r,L){if(r&&(r.code==="EMFILE"||r.code==="ENFILE"))bD([c,[d,k,v],r,K||Date.now(),Date.now()]);else{if(L&&L.sort)L.sort();if(typeof v==="function")v.call(this,r,L)}}}}if(process.version.substr(0,4)==="v0.8"){var S=pE(D);Z=S.ReadStream,j=S.WriteStream}var T=D.ReadStream;if(T)Z.prototype=Object.create(T.prototype),Z.prototype.open=G;var _=D.WriteStream;if(_)j.prototype=Object.create(_.prototype),j.prototype.open=g;Object.defineProperty(D,"ReadStream",{get:function(){return Z},set:function(z){Z=z},enumerable:!0,configurable:!0}),Object.defineProperty(D,"WriteStream",{get:function(){return j},set:function(z){j=z},enumerable:!0,configurable:!0});var I=Z;Object.defineProperty(D,"FileReadStream",{get:function(){return I},set:function(z){I=z},enumerable:!0,configurable:!0});var O=j;Object.defineProperty(D,"FileWriteStream",{get:function(){return O},set:function(z){O=z},enumerable:!0,configurable:!0});function Z(z,q){if(this instanceof Z)return T.apply(this,arguments),this;else return Z.apply(Object.create(Z.prototype),arguments)}function G(){var z=this;pu(z.path,z.flags,z.mode,function(q,U){if(q){if(z.autoClose)z.destroy();z.emit("error",q)}else z.fd=U,z.emit("open",U),z.read()})}function j(z,q){if(this instanceof j)return _.apply(this,arguments),this;else return j.apply(Object.create(j.prototype),arguments)}function g(){var z=this;pu(z.path,z.flags,z.mode,function(q,U){if(q)z.destroy(),z.emit("error",q);else z.fd=U,z.emit("open",U)})}function s(z,q){return new D.ReadStream(z,q)}function SD(z,q){return new D.WriteStream(z,q)}var oD=D.open;D.open=pu;function pu(z,q,U,c){if(typeof U==="function")c=U,U=null;return t(z,q,U,c);function t(d,k,v,K,r){return oD(d,k,v,function(L,A8){if(L&&(L.code==="EMFILE"||L.code==="ENFILE"))bD([t,[d,k,v,K],L,r||Date.now(),Date.now()]);else if(typeof K==="function")K.apply(this,arguments)})}}return D}function bD(D){KD("ENQUEUE",D[0].name,D[1]),h[i].push(D),L0()}var qu;function v2(){var D=Date.now();for(var u=0;u<h[i].length;++u)if(h[i][u].length>2)h[i][u][3]=D,h[i][u][4]=D;L0()}function L0(){if(clearTimeout(qu),qu=void 0,h[i].length===0)return;var D=h[i].shift(),u=D[0],F=D[1],E=D[2],C=D[3],B=D[4];if(C===void 0)KD("RETRY",u.name,F),u.apply(null,F);else if(Date.now()-C>=60000){KD("TIMEOUT",u.name,F);var x=F.pop();if(typeof x==="function")x.call(null,E)}else{var $=Date.now()-B,R=Math.max(B-C,1),H=Math.min(R*1.2,100);if($>=H)KD("RETRY",u.name,F),u.apply(null,F.concat([C]));else h[i].push(D)}if(qu===void 0)qu=setTimeout(L0,0)}});var n2=w((WB,g2)=>{function ED(D,u){if(typeof u==="boolean")u={forever:u};if(this._originalTimeouts=JSON.parse(JSON.stringify(D)),this._timeouts=D,this._options=u||{},this._maxRetryTime=u&&u.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever)this._cachedTimeouts=this._timeouts.slice(0)}g2.exports=ED;ED.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};ED.prototype.stop=function(){if(this._timeout)clearTimeout(this._timeout);this._timeouts=[],this._cachedTimeouts=null};ED.prototype.retry=function(D){if(this._timeout)clearTimeout(this._timeout);if(!D)return!1;var u=new Date().getTime();if(D&&u-this._operationStart>=this._maxRetryTime)return this._errors.unshift(Error("RetryOperation timeout occurred")),!1;this._errors.push(D);var F=this._timeouts.shift();if(F===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),F=this._timeouts.shift();else return!1;var E=this,C=setTimeout(function(){if(E._attempts++,E._operationTimeoutCb){if(E._timeout=setTimeout(function(){E._operationTimeoutCb(E._attempts)},E._operationTimeout),E._options.unref)E._timeout.unref()}E._fn(E._attempts)},F);if(this._options.unref)C.unref();return!0};ED.prototype.attempt=function(D,u){if(this._fn=D,u){if(u.timeout)this._operationTimeout=u.timeout;if(u.cb)this._operationTimeoutCb=u.cb}var F=this;if(this._operationTimeoutCb)this._timeout=setTimeout(function(){F._operationTimeoutCb()},F._operationTimeout);this._operationStart=new Date().getTime(),this._fn(this._attempts)};ED.prototype.try=function(D){console.log("Using RetryOperation.try() is deprecated"),this.attempt(D)};ED.prototype.start=function(D){console.log("Using RetryOperation.start() is deprecated"),this.attempt(D)};ED.prototype.start=ED.prototype.try;ED.prototype.errors=function(){return this._errors};ED.prototype.attempts=function(){return this._attempts};ED.prototype.mainError=function(){if(this._errors.length===0)return null;var D={},u=null,F=0;for(var E=0;E<this._errors.length;E++){var C=this._errors[E],B=C.message,x=(D[B]||0)+1;if(D[B]=x,x>=F)u=C,F=x}return u}});var c2=w((eE)=>{var sE=n2();eE.operation=function(D){var u=eE.timeouts(D);return new sE(u,{forever:D&&D.forever,unref:D&&D.unref,maxRetryTime:D&&D.maxRetryTime})};eE.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,x){return B-x}),E};eE.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};eE.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],x=D[B];D[B]=function(R){var H=eE.operation(u),A=Array.prototype.slice.call(arguments,1),J=A.pop();A.push(function(S){if(H.retry(S))return;if(S)arguments[0]=H.mainError();J.apply(this,arguments)}),H.attempt(function(){R.apply(D,A)})}.bind(D,x),D[B].options=u}}});var t2=w((LB,Ku)=>{Ku.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];if(process.platform!=="win32")Ku.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")Ku.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var r2=w((fB,mD)=>{var P=global.process,WD=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(!WD(P))mD.exports=function(){return function(){}};else{if(y0=l("assert"),wD=t2(),P0=/^win/i.test(P.platform),vD=l("events"),typeof vD!=="function")vD=vD.EventEmitter;if(P.__signal_exit_emitter__)n=P.__signal_exit_emitter__;else n=P.__signal_exit_emitter__=new vD,n.count=0,n.emitted={};if(!n.infinite)n.setMaxListeners(1/0),n.infinite=!0;mD.exports=function(D,u){if(!WD(global.process))return function(){};if(y0.equal(typeof D,"function","a callback must be provided for exit handler"),LD===!1)Wu();var F="exit";if(u&&u.alwaysLast)F="afterexit";var E=function(){if(n.removeListener(F,D),n.listeners("exit").length===0&&n.listeners("afterexit").length===0)$u()};return n.on(F,D),E},$u=function(){if(!LD||!WD(global.process))return;LD=!1,wD.forEach(function(u){try{P.removeListener(u,Au[u])}catch(F){}}),P.emit=Hu,P.reallyExit=wu,n.count-=1},mD.exports.unload=$u,OD=function(u,F,E){if(n.emitted[u])return;n.emitted[u]=!0,n.emit(u,F,E)},Au={},wD.forEach(function(D){Au[D]=function(){if(!WD(global.process))return;var F=P.listeners(D);if(F.length===n.count){if($u(),OD("exit",null,D),OD("afterexit",null,D),P0&&D==="SIGHUP")D="SIGINT";P.kill(P.pid,D)}}}),mD.exports.signals=function(){return wD},LD=!1,Wu=function(){if(LD||!WD(global.process))return;LD=!0,n.count+=1,wD=wD.filter(function(u){try{return P.on(u,Au[u]),!0}catch(F){return!1}}),P.emit=h0,P.reallyExit=k0},mD.exports.load=Wu,wu=P.reallyExit,k0=function(u){if(!WD(global.process))return;P.exitCode=u||0,OD("exit",P.exitCode,null),OD("afterexit",P.exitCode,null),wu.call(P,P.exitCode)},Hu=P.emit,h0=function(u,F){if(u==="exit"&&WD(global.process)){if(F!==void 0)P.exitCode=F;var E=Hu.apply(this,arguments);return OD("exit",P.exitCode,null),OD("afterexit",P.exitCode,null),E}else return Hu.apply(this,arguments)}}var y0,wD,P0,vD,n,$u,OD,Au,LD,Wu,wu,k0,Hu,h0});var i2=w((BC,b0)=>{var l2=Symbol();function EC(D,u,F){let E=u[l2];if(E)return u.stat(D,(B,x)=>{if(B)return F(B);F(null,x.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(x)return F(x);let R=$.mtime.getTime()%1000===0?"s":"ms";Object.defineProperty(u,l2,{value:R}),F(null,$.mtime,R)})})}function CC(D){let u=Date.now();if(D==="s")u=Math.ceil(u/1000)*1000;return new Date(u)}BC.probe=EC;BC.getMtime=CC});var e2=w((GC,Ru)=>{var AC=l("path"),g0=V0(),HC=c2(),JC=r2(),p2=i2(),ND={};function Ju(D,u){return u.lockfilePath||`${D}.lock`}function n0(D,u,F){if(!u.realpath)return F(null,AC.resolve(D));u.fs.realpath(D,F)}function m0(D,u,F){let E=Ju(D,u);u.fs.mkdir(E,(C)=>{if(!C)return p2.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,x)=>{if(B){if(B.code==="ENOENT")return m0(D,{...u,stale:0},F);return F(B)}if(!o2(x,u))return F(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));a2(D,u,($)=>{if($)return F($);m0(D,{...u,stale:0},F)})})})}function o2(D,u){return D.mtime.getTime()<Date.now()-u.stale}function a2(D,u,F){u.fs.rmdir(Ju(D,u),(E)=>{if(E&&E.code!=="ENOENT")return F(E);F()})}function Lu(D,u){let F=ND[D];if(F.updateTimeout)return;if(F.updateDelay=F.updateDelay||u.update,F.updateTimeout=setTimeout(()=>{F.updateTimeout=null,u.fs.stat(F.lockfilePath,(E,C)=>{let B=F.lastUpdate+u.stale<Date.now();if(E){if(E.code==="ENOENT"||B)return v0(D,F,Object.assign(E,{code:"ECOMPROMISED"}));return F.updateDelay=1000,Lu(D,u)}if(F.mtime.getTime()!==C.mtime.getTime())return v0(D,F,Object.assign(Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let $=p2.getMtime(F.mtimePrecision);u.fs.utimes(F.lockfilePath,$,$,(R)=>{let H=F.lastUpdate+u.stale<Date.now();if(F.released)return;if(R){if(R.code==="ENOENT"||H)return v0(D,F,Object.assign(R,{code:"ECOMPROMISED"}));return F.updateDelay=1000,Lu(D,u)}F.mtime=$,F.lastUpdate=Date.now(),F.updateDelay=null,Lu(D,u)})})},F.updateDelay),F.updateTimeout.unref)F.updateTimeout.unref()}function v0(D,u,F){if(u.released=!0,u.updateTimeout)clearTimeout(u.updateTimeout);if(ND[D]===u)delete ND[D];u.options.onCompromised(F)}function RC(D,u,F){u={stale:1e4,update:null,realpath:!0,retries:0,fs:g0,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),n0(D,u,(E,C)=>{if(E)return F(E);let B=HC.operation(u.retries);B.attempt(()=>{m0(C,u,(x,$,R)=>{if(B.retry(x))return;if(x)return F(B.mainError());let H=ND[C]={lockfilePath:Ju(C,u),mtime:$,mtimePrecision:R,options:u,lastUpdate:Date.now()};Lu(C,u),F(null,(A)=>{if(H.released)return A&&A(Object.assign(Error("Lock is already released"),{code:"ERELEASED"}));s2(C,{...u,realpath:!1},A)})})})})}function s2(D,u,F){u={fs:g0,realpath:!0,...u},n0(D,u,(E,C)=>{if(E)return F(E);let B=ND[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 ND[C],a2(C,u,F)})}function NC(D,u,F){u={stale:1e4,realpath:!0,fs:g0,...u},u.stale=Math.max(u.stale||0,2000),n0(D,u,(E,C)=>{if(E)return F(E);u.fs.stat(Ju(C,u),(B,x)=>{if(B)return B.code==="ENOENT"?F(null,!1):F(B);return F(null,!o2(x,u))})})}function TC(){return ND}JC(()=>{for(let D in ND){let u=ND[D].options;try{u.fs.rmdirSync(Ju(D,u))}catch(F){}}});GC.lock=RC;GC.unlock=s2;GC.check=NC;GC.getLocks=TC});var u3=w((VB,D3)=>{var IC=V0();function jC(D){let u=["mkdir","realpath","stat","rmdir","utimes"],F={...D};return u.forEach((E)=>{F[E]=(...C)=>{let B=C.pop(),x;try{x=D[`${E}Sync`](...C)}catch($){return B($)}B(null,x)}}),F}function zC(D){return(...u)=>new Promise((F,E)=>{u.push((C,B)=>{if(C)E(C);else F(B)}),D(...u)})}function ZC(D){return(...u)=>{let F,E;if(u.push((C,B)=>{F=C,E=B}),D(...u),F)throw F;return E}}function UC(D){if(D={...D},D.fs=jC(D.fs||IC),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}D3.exports={toPromise:zC,toSync:ZC,toSyncOptions:UC}});var E3=w((yB,XD)=>{var gD=e2(),{toPromise:fu,toSync:Vu,toSyncOptions:d0}=u3();async function F3(D,u){let F=await fu(gD.lock)(D,u);return fu(F)}function YC(D,u){let F=Vu(gD.lock)(D,d0(u));return Vu(F)}function MC(D,u){return fu(gD.unlock)(D,u)}function qC(D,u){return Vu(gD.unlock)(D,d0(u))}function QC(D,u){return fu(gD.check)(D,u)}function KC(D,u){return Vu(gD.check)(D,d0(u))}XD.exports=F3;XD.exports.lock=F3;XD.exports.unlock=MC;XD.exports.lockSync=YC;XD.exports.unlockSync=qC;XD.exports.check=QC;XD.exports.checkSync=KC});var U3=w((L7,e0)=>{var mu=process||{},z3=mu.argv||[],vu=mu.env||{},gC=!(!!vu.NO_COLOR||z3.includes("--no-color"))&&(!!vu.FORCE_COLOR||z3.includes("--color")||mu.platform==="win32"||(mu.stdout||{}).isTTY&&vu.TERM!=="dumb"||!!vu.CI),nC=(D,u,F=D)=>(E)=>{let C=""+E,B=C.indexOf(u,D.length);return~B?D+dC(C,u,F,B)+u:D+C+u},dC=(D,u,F,E)=>{let C="",B=0;do C+=D.substring(B,E)+F,B=E+u.length,E=D.indexOf(u,B);while(~E);return C+D.substring(B)},Z3=(D=gC)=>{let u=D?nC:()=>String;return{isColorSupported:D,reset:u("\x1B[0m","\x1B[0m"),bold:u("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:u("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:u("\x1B[3m","\x1B[23m"),underline:u("\x1B[4m","\x1B[24m"),inverse:u("\x1B[7m","\x1B[27m"),hidden:u("\x1B[8m","\x1B[28m"),strikethrough:u("\x1B[9m","\x1B[29m"),black:u("\x1B[30m","\x1B[39m"),red:u("\x1B[31m","\x1B[39m"),green:u("\x1B[32m","\x1B[39m"),yellow:u("\x1B[33m","\x1B[39m"),blue:u("\x1B[34m","\x1B[39m"),magenta:u("\x1B[35m","\x1B[39m"),cyan:u("\x1B[36m","\x1B[39m"),white:u("\x1B[37m","\x1B[39m"),gray:u("\x1B[90m","\x1B[39m"),bgBlack:u("\x1B[40m","\x1B[49m"),bgRed:u("\x1B[41m","\x1B[49m"),bgGreen:u("\x1B[42m","\x1B[49m"),bgYellow:u("\x1B[43m","\x1B[49m"),bgBlue:u("\x1B[44m","\x1B[49m"),bgMagenta:u("\x1B[45m","\x1B[49m"),bgCyan:u("\x1B[46m","\x1B[49m"),bgWhite:u("\x1B[47m","\x1B[49m"),blackBright:u("\x1B[90m","\x1B[39m"),redBright:u("\x1B[91m","\x1B[39m"),greenBright:u("\x1B[92m","\x1B[39m"),yellowBright:u("\x1B[93m","\x1B[39m"),blueBright:u("\x1B[94m","\x1B[39m"),magentaBright:u("\x1B[95m","\x1B[39m"),cyanBright:u("\x1B[96m","\x1B[39m"),whiteBright:u("\x1B[97m","\x1B[39m"),bgBlackBright:u("\x1B[100m","\x1B[49m"),bgRedBright:u("\x1B[101m","\x1B[49m"),bgGreenBright:u("\x1B[102m","\x1B[49m"),bgYellowBright:u("\x1B[103m","\x1B[49m"),bgBlueBright:u("\x1B[104m","\x1B[49m"),bgMagentaBright:u("\x1B[105m","\x1B[49m"),bgCyanBright:u("\x1B[106m","\x1B[49m"),bgWhiteBright:u("\x1B[107m","\x1B[49m")}};e0.exports=Z3();e0.exports.createColors=Z3});var q3=w((zD)=>{var Y3=zD&&zD.__importDefault||function(D){return D&&D.__esModule?D:{default:D}};Object.defineProperty(zD,"__esModule",{value:!0});zD.symbols=zD.isTTY=void 0;var cC=Y3(l("tty")),AD=Y3(l("process")),tC=AD.default.env.CI||AD.default.env.WT_SESSION||AD.default.env.ConEmuTask==="{cmd::Cmder}"||AD.default.env.TERM_PROGRAM==="vscode"||AD.default.env.TERM==="xterm-256color"||AD.default.env.TERM==="alacritty",M3=cC.default.isatty(1)&&AD.default.env.TERM!=="dumb"&&!("CI"in AD.default.env);zD.isTTY=M3;var Nu=AD.default.platform!=="win32"?AD.default.env.TERM!=="linux":tC,rC={frames:M3?Nu?["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]:["-","\\","|","/"]:["-"],tick:Nu?"\u2714":"\u221A",cross:Nu?"\u2716":"\xD7",warn:Nu?"\u26A0":"!!",info:Nu?"\u2139":"i"};zD.symbols=rC});var K3=w((Tu)=>{var lC=Tu&&Tu.__importDefault||function(D){return D&&D.__esModule?D:{default:D}};Object.defineProperty(Tu,"__esModule",{value:!0});Tu.createSpinner=pC;var Q3=lC(U3()),HD=q3();function iC(D="",u=80){return D.replace(/\u001b[^m]*?m/g,"").split(`
30
+ `).reduce((F,E)=>F+=Math.max(1,Math.ceil(E.length/u)),0)}function pC(D="",u={}){let F=0,E=u.interval||50,C=u.stream||process.stderr,B=u.frames&&u.frames.length?u.frames:HD.symbols.frames,x=u.color||"yellow",$=!1,R=0,H=void 0,A=(G={})=>typeof G==="string"?G:G.text||D,J=(G={})=>typeof G==="string"?!1:!!G.update,S=(G={})=>typeof G==="string"||!G.color?x:G.color,T=(G={},j)=>typeof G==="string"||!G.mark?j:G.mark,_=()=>{process.on("SIGINT",Z),process.on("SIGTERM",Z)},I=()=>{process.off("SIGINT",Z),process.off("SIGTERM",Z)},O={reset(){return F=0,R=0,$=!1,clearTimeout(H),H=void 0,O},clear(){O.write("\x1B[1G");for(let G=0;G<R;G++)G>0&&O.write("\x1B[1A"),O.write("\x1B[2K\x1B[1G");return R=0,O},write(G,j=!1){if(j&&HD.isTTY)O.clear();return C.write(G),O},render(){let G=`${Q3.default[x](B[F])} ${D}`;return HD.isTTY?O.write("\x1B[?25l"):G+=`
31
+ `,O.write(G,!0),HD.isTTY&&(R=iC(G,C.columns)),O},spin(){return O.render(),F=++F%B.length,O},update(G){if(typeof G==="string")D=G;else D=G.text||D,B=G.frames&&G.frames.length?G.frames:B,E=G.interval||E,x=G.color||x;if(B.length-1<F)F=0;return O},loop(){return HD.isTTY&&(H=setTimeout(()=>O.loop(),E)),O.spin()},start(G={}){return H&&O.reset(),$=!0,_(),O.update({text:A(G),color:S(G)}).loop()},stop(G){$=!1,clearTimeout(H),H=void 0,I();let j=J(G),g=Q3.default[S(G)](T(G,B[F])),s=A(G);return O.write(G?`${g} ${s}${j?"":`
32
+ `}`:"",!0),HD.isTTY&&!j?O.write("\x1B[?25h"):O},success(G={}){return O.stop({text:A(G),mark:T(G,HD.symbols.tick),color:"green",update:J(G)})},error(G={}){return O.stop({text:A(G),mark:T(G,HD.symbols.cross),color:"red",update:J(G)})},warn(G={}){return O.stop({text:A(G),mark:T(G,HD.symbols.warn),color:"yellow",update:J(G)})},info(G={}){return O.stop({text:A(G),mark:T(G,HD.symbols.info),color:"blue",update:J(G)})},isSpinning(){return $}};function Z(G){if($)O.stop();process.exit(G==="SIGINT"?130:G==="SIGTERM"?143:1)}return O}});var c3=w((s9,d3)=>{var lD=1000,iD=lD*60,pD=iD*60,yD=pD*24,sC=yD*7,eC=yD*365.25;d3.exports=function(D,u){u=u||{};var F=typeof D;if(F==="string"&&D.length>0)return D8(D);else if(F==="number"&&isFinite(D))return u.long?F8(D):u8(D);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(D))};function D8(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*eC;case"weeks":case"week":case"w":return F*sC;case"days":case"day":case"d":return F*yD;case"hours":case"hour":case"hrs":case"hr":case"h":return F*pD;case"minutes":case"minute":case"mins":case"min":case"m":return F*iD;case"seconds":case"second":case"secs":case"sec":case"s":return F*lD;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return F;default:return}}function u8(D){var u=Math.abs(D);if(u>=yD)return Math.round(D/yD)+"d";if(u>=pD)return Math.round(D/pD)+"h";if(u>=iD)return Math.round(D/iD)+"m";if(u>=lD)return Math.round(D/lD)+"s";return D+"ms"}function F8(D){var u=Math.abs(D);if(u>=yD)return iu(D,u,yD,"day");if(u>=pD)return iu(D,u,pD,"hour");if(u>=iD)return iu(D,u,iD,"minute");if(u>=lD)return iu(D,u,lD,"second");return D+" ms"}function iu(D,u,F,E){var C=u>=F*1.5;return Math.round(D/F)+" "+E+(C?"s":"")}});var fF=PD(LF(),1),{program:O8,createCommand:X8,createArgument:I8,createOption:j8,CommanderError:z8,InvalidArgumentError:Z8,InvalidOptionArgumentError:U8,Command:VF,Argument:Y8,Option:M8,Help:q8}=fF.default;var yF=(D=0)=>(u)=>`\x1B[${u+D}m`,PF=(D=0)=>(u)=>`\x1B[${38+D};5;${u}m`,kF=(D=0)=>(u,F,E)=>`\x1B[${38+D};2;${u};${F};${E}m`,f={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},K8=Object.keys(f.modifier),l1=Object.keys(f.color),i1=Object.keys(f.bgColor),W8=[...l1,...i1];function p1(){let D=new Map;for(let[u,F]of Object.entries(f)){for(let[E,C]of Object.entries(F))f[E]={open:`\x1B[${C[0]}m`,close:`\x1B[${C[1]}m`},F[E]=f[E],D.set(C[0],C[1]);Object.defineProperty(f,u,{value:F,enumerable:!1})}return Object.defineProperty(f,"codes",{value:D,enumerable:!1}),f.color.close="\x1B[39m",f.bgColor.close="\x1B[49m",f.color.ansi=yF(),f.color.ansi256=PF(),f.color.ansi16m=kF(),f.bgColor.ansi=yF(10),f.bgColor.ansi256=PF(10),f.bgColor.ansi16m=kF(10),Object.defineProperties(f,{rgbToAnsi256:{value(u,F,E){if(u===F&&F===E){if(u<8)return 16;if(u>248)return 231;return Math.round((u-8)/247*24)+232}return 16+36*Math.round(u/255*5)+6*Math.round(F/255*5)+Math.round(E/255*5)},enumerable:!1},hexToRgb:{value(u){let F=/[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));if(!F)return[0,0,0];let[E]=F;if(E.length===3)E=[...E].map((B)=>B+B).join("");let C=Number.parseInt(E,16);return[C>>16&255,C>>8&255,C&255]},enumerable:!1},hexToAnsi256:{value:(u)=>f.rgbToAnsi256(...f.hexToRgb(u)),enumerable:!1},ansi256ToAnsi:{value(u){if(u<8)return 30+u;if(u<16)return 90+(u-8);let F,E,C;if(u>=232)F=((u-232)*10+8)/255,E=F,C=F;else{u-=16;let $=u%36;F=Math.floor(u/36)/5,E=Math.floor($/6)/5,C=$%6/5}let B=Math.max(F,E,C)*2;if(B===0)return 30;let x=30+(Math.round(C)<<2|Math.round(E)<<1|Math.round(F));if(B===2)x+=60;return x},enumerable:!1},rgbToAnsi:{value:(u,F,E)=>f.ansi256ToAnsi(f.rgbToAnsi256(u,F,E)),enumerable:!1},hexToAnsi:{value:(u)=>f.ansi256ToAnsi(f.hexToAnsi256(u)),enumerable:!1}}),f}var o1=p1(),CD=o1;import C0 from"process";import a1 from"os";import hF from"tty";function uD(D,u=globalThis.Deno?globalThis.Deno.args:C0.argv){let F=D.startsWith("-")?"":D.length===1?"-":"--",E=u.indexOf(F+D),C=u.indexOf("--");return E!==-1&&(C===-1||E<C)}var{env:V}=C0,_u;if(uD("no-color")||uD("no-colors")||uD("color=false")||uD("color=never"))_u=0;else if(uD("color")||uD("colors")||uD("color=true")||uD("color=always"))_u=1;function s1(){if("FORCE_COLOR"in V){if(V.FORCE_COLOR==="true")return 1;if(V.FORCE_COLOR==="false")return 0;return V.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(V.FORCE_COLOR,10),3)}}function e1(D){if(D===0)return!1;return{level:D,hasBasic:!0,has256:D>=2,has16m:D>=3}}function DE(D,{streamIsTTY:u,sniffFlags:F=!0}={}){let E=s1();if(E!==void 0)_u=E;let C=F?_u:E;if(C===0)return 0;if(F){if(uD("color=16m")||uD("color=full")||uD("color=truecolor"))return 3;if(uD("color=256"))return 2}if("TF_BUILD"in V&&"AGENT_NAME"in V)return 1;if(D&&!u&&C===void 0)return 0;let B=C||0;if(V.TERM==="dumb")return B;if(C0.platform==="win32"){let x=a1.release().split(".");if(Number(x[0])>=10&&Number(x[2])>=10586)return Number(x[2])>=14931?3:2;return 1}if("CI"in V){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((x)=>(x in V)))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((x)=>(x in V))||V.CI_NAME==="codeship")return 1;return B}if("TEAMCITY_VERSION"in V)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(V.TEAMCITY_VERSION)?1:0;if(V.COLORTERM==="truecolor")return 3;if(V.TERM==="xterm-kitty")return 3;if(V.TERM==="xterm-ghostty")return 3;if(V.TERM==="wezterm")return 3;if("TERM_PROGRAM"in V){let x=Number.parseInt((V.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(V.TERM_PROGRAM){case"iTerm.app":return x>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(V.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(V.TERM))return 1;if("COLORTERM"in V)return 1;return B}function bF(D,u={}){let F=DE(D,{streamIsTTY:D&&D.isTTY,...u});return e1(F)}var uE={stdout:bF({isTTY:hF.isatty(1)}),stderr:bF({isTTY:hF.isatty(2)})},vF=uE;function mF(D,u,F){let E=D.indexOf(u);if(E===-1)return D;let C=u.length,B=0,x="";do x+=D.slice(B,E)+u+F,B=E+C,E=D.indexOf(u,B);while(E!==-1);return x+=D.slice(B),x}function gF(D,u,F,E){let C=0,B="";do{let x=D[E-1]==="\r";B+=D.slice(C,x?E-1:E)+u+(x?`\r
30
33
  `:`
31
34
  `)+F,C=E+1,E=D.indexOf(`
32
- `,C)}while(E!==-1);return B+=D.slice(C),B}var{stdout:yF,stderr:PF}=wF,su=Symbol("GENERATOR"),VD=Symbol("STYLER"),iD=Symbol("IS_EMPTY"),kF=["ansi","ansi","ansi256","ansi16m"],fD=Object.create(null),vE=(D,u={})=>{if(u.level&&!(Number.isInteger(u.level)&&u.level>=0&&u.level<=3))throw Error("The `level` option should be an integer from 0 to 3");let F=yF?yF.level:0;D.level=u.level===void 0?F:u.level};var mE=(D)=>{let u=(...F)=>F.join(" ");return vE(u,D),Object.setPrototypeOf(u,oD.prototype),u};function oD(D){return mE(D)}Object.setPrototypeOf(oD.prototype,Function.prototype);for(let[D,u]of Object.entries(CD))fD[D]={get(){let F=Ru(this,D0(u.open,u.close,this[VD]),this[iD]);return Object.defineProperty(this,D,{value:F}),F}};fD.visible={get(){let D=Ru(this,this[VD],!0);return Object.defineProperty(this,"visible",{value:D}),D}};var eu=(D,u,F,...E)=>{if(D==="rgb"){if(u==="ansi16m")return CD[F].ansi16m(...E);if(u==="ansi256")return CD[F].ansi256(CD.rgbToAnsi256(...E));return CD[F].ansi(CD.rgbToAnsi(...E))}if(D==="hex")return eu("rgb",u,F,...CD.hexToRgb(...E));return CD[F][D](...E)},gE=["rgb","hex","ansi256"];for(let D of gE){fD[D]={get(){let{level:F}=this;return function(...E){let C=D0(eu(D,kF[F],"color",...E),CD.color.close,this[VD]);return Ru(this,C,this[iD])}}};let u="bg"+D[0].toUpperCase()+D.slice(1);fD[u]={get(){let{level:F}=this;return function(...E){let C=D0(eu(D,kF[F],"bgColor",...E),CD.bgColor.close,this[VD]);return Ru(this,C,this[iD])}}}}var nE=Object.defineProperties(()=>{},{...fD,level:{enumerable:!0,get(){return this[su].level},set(D){this[su].level=D}}}),D0=(D,u,F)=>{let E,C;if(F===void 0)E=D,C=u;else E=F.openAll+D,C=u+F.closeAll;return{open:D,close:u,openAll:E,closeAll:C,parent:F}},Ru=(D,u,F)=>{let E=(...C)=>dE(E,C.length===1?""+C[0]:C.join(" "));return Object.setPrototypeOf(E,nE),E[su]=D,E[VD]=u,E[iD]=F,E},dE=(D,u)=>{if(D.level<=0||!u)return D[iD]?"":u;let F=D[VD];if(F===void 0)return u;let{openAll:E,closeAll:C}=F;if(u.includes("\x1B"))while(F!==void 0)u=VF(u,F.close,F.open),F=F.parent;let B=u.indexOf(`
33
- `);if(B!==-1)u=fF(u,C,E,B);return E+u+C};Object.defineProperties(oD.prototype,fD);var cE=oD(),_6=oD({level:PF?PF.level:0});var N=cE;var u0=(D)=>D.name==="backspace",aD=(D)=>D.name==="tab";var sD=(D)=>D.name==="enter"||D.name==="return";class F0 extends Error{name="AbortPromptError";message="Prompt was aborted";constructor(D){super();this.cause=D?.cause}}class E0 extends Error{name="CancelPromptError";message="Prompt was canceled"}class FD extends Error{name="ExitPromptError"}class C0 extends Error{name="HookError"}class B0 extends Error{name="ValidationError"}import{AsyncResource as pE}from"async_hooks";import{AsyncLocalStorage as tE,AsyncResource as lE}from"async_hooks";var hF=new tE;function rE(D){return{rl:D,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function bF(D,u){let F=rE(D);return hF.run(F,()=>{function E(C){F.handleChange=()=>{F.index=0,C()},F.handleChange()}return u(E)})}function SD(){let D=hF.getStore();if(!D)throw new C0("[Inquirer] Hook functions can only be called from within a prompt");return D}function $0(){return SD().rl}function A0(D){let u=(...F)=>{let E=SD(),C=!1,B=E.handleChange;E.handleChange=()=>{C=!0};let $=D(...F);if(C)B();return E.handleChange=B,$};return lE.bind(u)}function _u(D){let u=SD(),{index:F}=u,E={get(){return u.hooks[F]},set(B){u.hooks[F]=B},initialized:F in u.hooks},C=D(E);return u.index++,C}function vF(){SD().handleChange()}var zD={queue(D){let u=SD(),{index:F}=u;u.hooksEffect.push(()=>{u.hooksCleanup[F]?.();let E=D($0());if(E!=null&&typeof E!=="function")throw new B0("useEffect return value must be a cleanup function or nothing.");u.hooksCleanup[F]=E})},run(){let D=SD();A0(()=>{D.hooksEffect.forEach((u)=>{u()}),D.hooksEffect.length=0})()},clearAll(){let D=SD();D.hooksCleanup.forEach((u)=>{u?.()}),D.hooksEffect.length=0,D.hooksCleanup.length=0}};function s(D){return _u((u)=>{let F=pE.bind(function(B){if(u.get()!==B)u.set(B),vF()});if(u.initialized)return[u.get(),F];let E=typeof D==="function"?D():D;return u.set(E),[E,F]})}function ID(D,u){_u((F)=>{let E=F.get();if(!Array.isArray(E)||u.some((B,$)=>!Object.is(B,E[$])))zD.queue(D);F.set(u)})}import{styleText as BD}from"util";import $D from"process";function iE(){if($D.platform!=="win32")return $D.env.TERM!=="linux";return Boolean($D.env.WT_SESSION)||Boolean($D.env.TERMINUS_SUBLIME)||$D.env.ConEmuTask==="{cmd::Cmder}"||$D.env.TERM_PROGRAM==="Terminus-Sublime"||$D.env.TERM_PROGRAM==="vscode"||$D.env.TERM==="xterm-256color"||$D.env.TERM==="alacritty"||$D.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var mF={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},gF={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},oE={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},aE={...mF,...gF},sE={...mF,...oE},eE=iE(),DC=eE?aE:sE,nF=DC,q6=Object.entries(gF);var dF={prefix:{idle:BD("blue","?"),done:BD("green",nF.tick)},spinner:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"].map((D)=>BD("yellow",D))},style:{answer:(D)=>BD("cyan",D),message:(D)=>BD("bold",D),error:(D)=>BD("red",`> ${D}`),defaultAnswer:(D)=>BD("dim",`(${D})`),help:(D)=>BD("dim",D),highlight:(D)=>BD("cyan",D),key:(D)=>BD("cyan",BD("bold",`<${D}>`))}};function cF(D){if(typeof D!=="object"||D===null)return!1;let u=D;while(Object.getPrototypeOf(u)!==null)u=Object.getPrototypeOf(u);return Object.getPrototypeOf(D)===u}function tF(...D){let u={};for(let F of D)for(let[E,C]of Object.entries(F)){let B=u[E];u[E]=cF(B)&&cF(C)?tF(B,C):C}return u}function UD(...D){let u=[dF,...D.filter((F)=>F!=null)];return tF(...u)}function eD({status:D="idle",theme:u}){let[F,E]=s(!1),[C,B]=s(0),{prefix:$,spinner:A}=UD(u);if(ID(()=>{if(D==="loading"){let x,H=-1,J=setTimeout(()=>{E(!0),x=setInterval(()=>{H=H+1,B(H%A.frames.length)},A.interval)},300);return()=>{clearTimeout(J),clearInterval(x)}}else E(!1)},[D]),F)return A.frames[C];return typeof $==="string"?$:$[D==="loading"?"idle":D]??$.idle}function lF(D){return s({current:D})[0]}function Du(D){let u=lF(D);u.current=D,ID((F)=>{let E=!1,C=A0((B,$)=>{if(E)return;u.current($,F)});return F.input.on("keypress",C),()=>{E=!0,F.input.removeListener("keypress",C)}},[])}var H2=rD(pF(),1);function H0({onlyFirst:D=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",D?void 0:"g")}var EC=H0();function uu(D){if(typeof D!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof D}\``);return D.replace(EC,"")}function iF(D){return D===161||D===164||D===167||D===168||D===170||D===173||D===174||D>=176&&D<=180||D>=182&&D<=186||D>=188&&D<=191||D===198||D===208||D===215||D===216||D>=222&&D<=225||D===230||D>=232&&D<=234||D===236||D===237||D===240||D===242||D===243||D>=247&&D<=250||D===252||D===254||D===257||D===273||D===275||D===283||D===294||D===295||D===299||D>=305&&D<=307||D===312||D>=319&&D<=322||D===324||D>=328&&D<=331||D===333||D===338||D===339||D===358||D===359||D===363||D===462||D===464||D===466||D===468||D===470||D===472||D===474||D===476||D===593||D===609||D===708||D===711||D>=713&&D<=715||D===717||D===720||D>=728&&D<=731||D===733||D===735||D>=768&&D<=879||D>=913&&D<=929||D>=931&&D<=937||D>=945&&D<=961||D>=963&&D<=969||D===1025||D>=1040&&D<=1103||D===1105||D===8208||D>=8211&&D<=8214||D===8216||D===8217||D===8220||D===8221||D>=8224&&D<=8226||D>=8228&&D<=8231||D===8240||D===8242||D===8243||D===8245||D===8251||D===8254||D===8308||D===8319||D>=8321&&D<=8324||D===8364||D===8451||D===8453||D===8457||D===8467||D===8470||D===8481||D===8482||D===8486||D===8491||D===8531||D===8532||D>=8539&&D<=8542||D>=8544&&D<=8555||D>=8560&&D<=8569||D===8585||D>=8592&&D<=8601||D===8632||D===8633||D===8658||D===8660||D===8679||D===8704||D===8706||D===8707||D===8711||D===8712||D===8715||D===8719||D===8721||D===8725||D===8730||D>=8733&&D<=8736||D===8739||D===8741||D>=8743&&D<=8748||D===8750||D>=8756&&D<=8759||D===8764||D===8765||D===8776||D===8780||D===8786||D===8800||D===8801||D>=8804&&D<=8807||D===8810||D===8811||D===8814||D===8815||D===8834||D===8835||D===8838||D===8839||D===8853||D===8857||D===8869||D===8895||D===8978||D>=9312&&D<=9449||D>=9451&&D<=9547||D>=9552&&D<=9587||D>=9600&&D<=9615||D>=9618&&D<=9621||D===9632||D===9633||D>=9635&&D<=9641||D===9650||D===9651||D===9654||D===9655||D===9660||D===9661||D===9664||D===9665||D>=9670&&D<=9672||D===9675||D>=9678&&D<=9681||D>=9698&&D<=9701||D===9711||D===9733||D===9734||D===9737||D===9742||D===9743||D===9756||D===9758||D===9792||D===9794||D===9824||D===9825||D>=9827&&D<=9829||D>=9831&&D<=9834||D===9836||D===9837||D===9839||D===9886||D===9887||D===9919||D>=9926&&D<=9933||D>=9935&&D<=9939||D>=9941&&D<=9953||D===9955||D===9960||D===9961||D>=9963&&D<=9969||D===9972||D>=9974&&D<=9977||D===9979||D===9980||D===9982||D===9983||D===10045||D>=10102&&D<=10111||D>=11094&&D<=11097||D>=12872&&D<=12879||D>=57344&&D<=63743||D>=65024&&D<=65039||D===65533||D>=127232&&D<=127242||D>=127248&&D<=127277||D>=127280&&D<=127337||D>=127344&&D<=127373||D===127375||D===127376||D>=127387&&D<=127404||D>=917760&&D<=917999||D>=983040&&D<=1048573||D>=1048576&&D<=1114109}function oF(D){return D===12288||D>=65281&&D<=65376||D>=65504&&D<=65510}function aF(D){return D>=4352&&D<=4447||D===8986||D===8987||D===9001||D===9002||D>=9193&&D<=9196||D===9200||D===9203||D===9725||D===9726||D===9748||D===9749||D>=9776&&D<=9783||D>=9800&&D<=9811||D===9855||D>=9866&&D<=9871||D===9875||D===9889||D===9898||D===9899||D===9917||D===9918||D===9924||D===9925||D===9934||D===9940||D===9962||D===9970||D===9971||D===9973||D===9978||D===9981||D===9989||D===9994||D===9995||D===10024||D===10060||D===10062||D>=10067&&D<=10069||D===10071||D>=10133&&D<=10135||D===10160||D===10175||D===11035||D===11036||D===11088||D===11093||D>=11904&&D<=11929||D>=11931&&D<=12019||D>=12032&&D<=12245||D>=12272&&D<=12287||D>=12289&&D<=12350||D>=12353&&D<=12438||D>=12441&&D<=12543||D>=12549&&D<=12591||D>=12593&&D<=12686||D>=12688&&D<=12773||D>=12783&&D<=12830||D>=12832&&D<=12871||D>=12880&&D<=42124||D>=42128&&D<=42182||D>=43360&&D<=43388||D>=44032&&D<=55203||D>=63744&&D<=64255||D>=65040&&D<=65049||D>=65072&&D<=65106||D>=65108&&D<=65126||D>=65128&&D<=65131||D>=94176&&D<=94180||D>=94192&&D<=94198||D>=94208&&D<=101589||D>=101631&&D<=101662||D>=101760&&D<=101874||D>=110576&&D<=110579||D>=110581&&D<=110587||D===110589||D===110590||D>=110592&&D<=110882||D===110898||D>=110928&&D<=110930||D===110933||D>=110948&&D<=110951||D>=110960&&D<=111355||D>=119552&&D<=119638||D>=119648&&D<=119670||D===126980||D===127183||D===127374||D>=127377&&D<=127386||D>=127488&&D<=127490||D>=127504&&D<=127547||D>=127552&&D<=127560||D===127568||D===127569||D>=127584&&D<=127589||D>=127744&&D<=127776||D>=127789&&D<=127797||D>=127799&&D<=127868||D>=127870&&D<=127891||D>=127904&&D<=127946||D>=127951&&D<=127955||D>=127968&&D<=127984||D===127988||D>=127992&&D<=128062||D===128064||D>=128066&&D<=128252||D>=128255&&D<=128317||D>=128331&&D<=128334||D>=128336&&D<=128359||D===128378||D===128405||D===128406||D===128420||D>=128507&&D<=128591||D>=128640&&D<=128709||D===128716||D>=128720&&D<=128722||D>=128725&&D<=128728||D>=128732&&D<=128735||D===128747||D===128748||D>=128756&&D<=128764||D>=128992&&D<=129003||D===129008||D>=129292&&D<=129338||D>=129340&&D<=129349||D>=129351&&D<=129535||D>=129648&&D<=129660||D>=129664&&D<=129674||D>=129678&&D<=129734||D===129736||D>=129741&&D<=129756||D>=129759&&D<=129770||D>=129775&&D<=129784||D>=131072&&D<=196605||D>=196608&&D<=262141}function CC(D){if(!Number.isSafeInteger(D))throw TypeError(`Expected a code point, got \`${typeof D}\`.`)}function sF(D,{ambiguousAsWide:u=!1}={}){if(CC(D),oF(D)||aF(D)||u&&iF(D))return 2;return 1}var eF=()=>{return/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g};var BC=new Intl.Segmenter,$C=/^\p{Default_Ignorable_Code_Point}$/u;function ZD(D,u={}){if(typeof D!=="string"||D.length===0)return 0;let{ambiguousIsNarrow:F=!0,countAnsiEscapeCodes:E=!1}=u;if(!E)D=uu(D);if(D.length===0)return 0;let C=0,B={ambiguousAsWide:!F};for(let{segment:$}of BC.segment(D)){let A=$.codePointAt(0);if(A<=31||A>=127&&A<=159)continue;if(A>=8203&&A<=8207||A===65279)continue;if(A>=768&&A<=879||A>=6832&&A<=6911||A>=7616&&A<=7679||A>=8400&&A<=8447||A>=65056&&A<=65071)continue;if(A>=55296&&A<=57343)continue;if(A>=65024&&A<=65039)continue;if($C.test($))continue;if(eF().test($)){C+=2;continue}C+=sF(A,B)}return C}var D2=(D=0)=>(u)=>`\x1B[${u+D}m`,u2=(D=0)=>(u)=>`\x1B[${38+D};5;${u}m`,F2=(D=0)=>(u,F,E)=>`\x1B[${38+D};2;${u};${F};${E}m`,f={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},F1=Object.keys(f.modifier),AC=Object.keys(f.color),HC=Object.keys(f.bgColor),E1=[...AC,...HC];function xC(){let D=new Map;for(let[u,F]of Object.entries(f)){for(let[E,C]of Object.entries(F))f[E]={open:`\x1B[${C[0]}m`,close:`\x1B[${C[1]}m`},F[E]=f[E],D.set(C[0],C[1]);Object.defineProperty(f,u,{value:F,enumerable:!1})}return Object.defineProperty(f,"codes",{value:D,enumerable:!1}),f.color.close="\x1B[39m",f.bgColor.close="\x1B[49m",f.color.ansi=D2(),f.color.ansi256=u2(),f.color.ansi16m=F2(),f.bgColor.ansi=D2(10),f.bgColor.ansi256=u2(10),f.bgColor.ansi16m=F2(10),Object.defineProperties(f,{rgbToAnsi256:{value(u,F,E){if(u===F&&F===E){if(u<8)return 16;if(u>248)return 231;return Math.round((u-8)/247*24)+232}return 16+36*Math.round(u/255*5)+6*Math.round(F/255*5)+Math.round(E/255*5)},enumerable:!1},hexToRgb:{value(u){let F=/[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));if(!F)return[0,0,0];let[E]=F;if(E.length===3)E=[...E].map((B)=>B+B).join("");let C=Number.parseInt(E,16);return[C>>16&255,C>>8&255,C&255]},enumerable:!1},hexToAnsi256:{value:(u)=>f.rgbToAnsi256(...f.hexToRgb(u)),enumerable:!1},ansi256ToAnsi:{value(u){if(u<8)return 30+u;if(u<16)return 90+(u-8);let F,E,C;if(u>=232)F=((u-232)*10+8)/255,E=F,C=F;else{u-=16;let A=u%36;F=Math.floor(u/36)/5,E=Math.floor(A/6)/5,C=A%6/5}let B=Math.max(F,E,C)*2;if(B===0)return 30;let $=30+(Math.round(C)<<2|Math.round(E)<<1|Math.round(F));if(B===2)$+=60;return $},enumerable:!1},rgbToAnsi:{value:(u,F,E)=>f.ansi256ToAnsi(f.rgbToAnsi256(u,F,E)),enumerable:!1},hexToAnsi:{value:(u)=>f.ansi256ToAnsi(f.hexToAnsi256(u)),enumerable:!1}}),f}var JC=xC(),E2=JC;var Xu=new Set(["\x1B","\x9B"]),NC=39,J0="\x07",$2="[",RC="]",A2="m",Tu=`${RC}8;;`,C2=(D)=>`${Xu.values().next().value}${$2}${D}${A2}`,B2=(D)=>`${Xu.values().next().value}${Tu}${D}${J0}`,_C=(D)=>D.split(" ").map((u)=>ZD(u)),x0=(D,u,F)=>{let E=[...u],C=!1,B=!1,$=ZD(uu(D.at(-1)));for(let[A,R]of E.entries()){let x=ZD(R);if($+x<=F)D[D.length-1]+=R;else D.push(R),$=0;if(Xu.has(R))C=!0,B=E.slice(A+1,A+1+Tu.length).join("")===Tu;if(C){if(B){if(R===J0)C=!1,B=!1}else if(R===A2)C=!1;continue}if($+=x,$===F&&A<E.length-1)D.push(""),$=0}if(!$&&D.at(-1).length>0&&D.length>1)D[D.length-2]+=D.pop()},TC=(D)=>{let u=D.split(" "),F=u.length;while(F>0){if(ZD(u[F-1])>0)break;F--}if(F===u.length)return D;return u.slice(0,F).join(" ")+u.slice(F).join("")},XC=(D,u,F={})=>{if(F.trim!==!1&&D.trim()==="")return"";let E="",C,B,$=_C(D),A=[""];for(let[J,T]of D.split(" ").entries()){if(F.trim!==!1)A[A.length-1]=A.at(-1).trimStart();let _=ZD(A.at(-1));if(J!==0){if(_>=u&&(F.wordWrap===!1||F.trim===!1))A.push(""),_=0;if(_>0||F.trim===!1)A[A.length-1]+=" ",_++}if(F.hard&&$[J]>u){let X=u-_,j=1+Math.floor(($[J]-X-1)/u);if(Math.floor(($[J]-1)/u)<j)A.push("");x0(A,T,u);continue}if(_+$[J]>u&&_>0&&$[J]>0){if(F.wordWrap===!1&&_<u){x0(A,T,u);continue}A.push("")}if(_+$[J]>u&&F.wordWrap===!1){x0(A,T,u);continue}A[A.length-1]+=T}if(F.trim!==!1)A=A.map((J)=>TC(J));let R=A.join(`
34
- `),x=[...R],H=0;for(let[J,T]of x.entries()){if(E+=T,Xu.has(T)){let{groups:X}=new RegExp(`(?:\\${$2}(?<code>\\d+)m|\\${Tu}(?<uri>.*)${J0})`).exec(R.slice(H))||{groups:{}};if(X.code!==void 0){let j=Number.parseFloat(X.code);C=j===NC?void 0:j}else if(X.uri!==void 0)B=X.uri.length===0?void 0:X.uri}let _=E2.codes.get(Number(C));if(x[J+1]===`
35
- `){if(B)E+=B2("");if(C&&_)E+=C2(_)}else if(T===`
36
- `){if(C&&_)E+=C2(C);if(B)E+=B2(B)}H+=T.length}return E};function N0(D,u,F){return String(D).normalize().replaceAll(`\r
35
+ `,C)}while(E!==-1);return B+=D.slice(C),B}var{stdout:nF,stderr:dF}=vF,B0=Symbol("GENERATOR"),kD=Symbol("STYLER"),sD=Symbol("IS_EMPTY"),cF=["ansi","ansi","ansi256","ansi16m"],hD=Object.create(null),FE=(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=nF?nF.level:0;D.level=u.level===void 0?F:u.level};var EE=(D)=>{let u=(...F)=>F.join(" ");return FE(u,D),Object.setPrototypeOf(u,eD.prototype),u};function eD(D){return EE(D)}Object.setPrototypeOf(eD.prototype,Function.prototype);for(let[D,u]of Object.entries(CD))hD[D]={get(){let F=Ou(this,$0(u.open,u.close,this[kD]),this[sD]);return Object.defineProperty(this,D,{value:F}),F}};hD.visible={get(){let D=Ou(this,this[kD],!0);return Object.defineProperty(this,"visible",{value:D}),D}};var x0=(D,u,F,...E)=>{if(D==="rgb"){if(u==="ansi16m")return CD[F].ansi16m(...E);if(u==="ansi256")return CD[F].ansi256(CD.rgbToAnsi256(...E));return CD[F].ansi(CD.rgbToAnsi(...E))}if(D==="hex")return x0("rgb",u,F,...CD.hexToRgb(...E));return CD[F][D](...E)},CE=["rgb","hex","ansi256"];for(let D of CE){hD[D]={get(){let{level:F}=this;return function(...E){let C=$0(x0(D,cF[F],"color",...E),CD.color.close,this[kD]);return Ou(this,C,this[sD])}}};let u="bg"+D[0].toUpperCase()+D.slice(1);hD[u]={get(){let{level:F}=this;return function(...E){let C=$0(x0(D,cF[F],"bgColor",...E),CD.bgColor.close,this[kD]);return Ou(this,C,this[sD])}}}}var BE=Object.defineProperties(()=>{},{...hD,level:{enumerable:!0,get(){return this[B0].level},set(D){this[B0].level=D}}}),$0=(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}},Ou=(D,u,F)=>{let E=(...C)=>xE(E,C.length===1?""+C[0]:C.join(" "));return Object.setPrototypeOf(E,BE),E[B0]=D,E[kD]=u,E[sD]=F,E},xE=(D,u)=>{if(D.level<=0||!u)return D[sD]?"":u;let F=D[kD];if(F===void 0)return u;let{openAll:E,closeAll:C}=F;if(u.includes("\x1B"))while(F!==void 0)u=mF(u,F.close,F.open),F=F.parent;let B=u.indexOf(`
36
+ `);if(B!==-1)u=gF(u,C,E,B);return E+u+C};Object.defineProperties(eD.prototype,hD);var $E=eD(),v8=eD({level:dF?dF.level:0});var N=$E;var A0=(D)=>D.name==="backspace",Du=(D)=>D.name==="tab";var uu=(D)=>D.name==="enter"||D.name==="return";class H0 extends Error{name="AbortPromptError";message="Prompt was aborted";constructor(D){super();this.cause=D?.cause}}class J0 extends Error{name="CancelPromptError";message="Prompt was canceled"}class FD extends Error{name="ExitPromptError"}class R0 extends Error{name="HookError"}class N0 extends Error{name="ValidationError"}import{AsyncResource as RE}from"async_hooks";import{AsyncLocalStorage as AE,AsyncResource as HE}from"async_hooks";var tF=new AE;function JE(D){return{rl:D,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function rF(D,u){let F=JE(D);return tF.run(F,()=>{function E(C){F.handleChange=()=>{F.index=0,C()},F.handleChange()}return u(E)})}function ZD(){let D=tF.getStore();if(!D)throw new R0("[Inquirer] Hook functions can only be called from within a prompt");return D}function T0(){return ZD().rl}function G0(D){let u=(...F)=>{let E=ZD(),C=!1,B=E.handleChange;E.handleChange=()=>{C=!0};let x=D(...F);if(C)B();return E.handleChange=B,x};return HE.bind(u)}function Xu(D){let u=ZD(),{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 lF(){ZD().handleChange()}var UD={queue(D){let u=ZD(),{index:F}=u;u.hooksEffect.push(()=>{u.hooksCleanup[F]?.();let E=D(T0());if(E!=null&&typeof E!=="function")throw new N0("useEffect return value must be a cleanup function or nothing.");u.hooksCleanup[F]=E})},run(){let D=ZD();G0(()=>{D.hooksEffect.forEach((u)=>{u()}),D.hooksEffect.length=0})()},clearAll(){let D=ZD();D.hooksCleanup.forEach((u)=>{u?.()}),D.hooksEffect.length=0,D.hooksCleanup.length=0}};function e(D){return Xu((u)=>{let F=RE.bind(function(B){if(u.get()!==B)u.set(B),lF()});if(u.initialized)return[u.get(),F];let E=typeof D==="function"?D():D;return u.set(E),[E,F]})}function YD(D,u){Xu((F)=>{let E=F.get();if(!Array.isArray(E)||u.some((B,x)=>!Object.is(B,E[x])))UD.queue(D);F.set(u)})}import{styleText as BD}from"util";import xD from"process";function NE(){if(xD.platform!=="win32")return xD.env.TERM!=="linux";return Boolean(xD.env.WT_SESSION)||Boolean(xD.env.TERMINUS_SUBLIME)||xD.env.ConEmuTask==="{cmd::Cmder}"||xD.env.TERM_PROGRAM==="Terminus-Sublime"||xD.env.TERM_PROGRAM==="vscode"||xD.env.TERM==="xterm-256color"||xD.env.TERM==="alacritty"||xD.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var iF={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},pF={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},TE={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"},GE={...iF,...pF},SE={...iF,...TE},_E=NE(),OE=_E?GE:SE,oF=OE,s8=Object.entries(pF);var aF={prefix:{idle:BD("blue","?"),done:BD("green",oF.tick)},spinner:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"].map((D)=>BD("yellow",D))},style:{answer:(D)=>BD("cyan",D),message:(D)=>BD("bold",D),error:(D)=>BD("red",`> ${D}`),defaultAnswer:(D)=>BD("dim",`(${D})`),help:(D)=>BD("dim",D),highlight:(D)=>BD("cyan",D),key:(D)=>BD("cyan",BD("bold",`<${D}>`))}};function sF(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 eF(...D){let u={};for(let F of D)for(let[E,C]of Object.entries(F)){let B=u[E];u[E]=sF(B)&&sF(C)?eF(B,C):C}return u}function MD(...D){let u=[aF,...D.filter((F)=>F!=null)];return eF(...u)}function Fu({status:D="idle",theme:u}){let[F,E]=e(!1),[C,B]=e(0),{prefix:x,spinner:$}=MD(u);if(YD(()=>{if(D==="loading"){let H,A=-1,J=setTimeout(()=>{E(!0),H=setInterval(()=>{A=A+1,B(A%$.frames.length)},$.interval)},300);return()=>{clearTimeout(J),clearInterval(H)}}else E(!1)},[D]),F)return $.frames[C];return typeof x==="string"?x:x[D==="loading"?"idle":D]??x.idle}function D2(D){return e({current:D})[0]}function Eu(D){let u=D2(D);u.current=D,YD((F)=>{let E=!1,C=G0((B,x)=>{if(E)return;u.current(x,F)});return F.input.on("keypress",C),()=>{E=!0,F.input.removeListener("keypress",C)}},[])}var _2=PD(F2(),1);function S0({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 jE=S0();function Cu(D){if(typeof D!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof D}\``);return D.replace(jE,"")}function E2(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 C2(D){return D===12288||D>=65281&&D<=65376||D>=65504&&D<=65510}function B2(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 zE(D){if(!Number.isSafeInteger(D))throw TypeError(`Expected a code point, got \`${typeof D}\`.`)}function x2(D,{ambiguousAsWide:u=!1}={}){if(zE(D),C2(D)||B2(D)||u&&E2(D))return 2;return 1}var $2=()=>{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 ZE=new Intl.Segmenter,UE=/^\p{Default_Ignorable_Code_Point}$/u;function qD(D,u={}){if(typeof D!=="string"||D.length===0)return 0;let{ambiguousIsNarrow:F=!0,countAnsiEscapeCodes:E=!1}=u;if(!E)D=Cu(D);if(D.length===0)return 0;let C=0,B={ambiguousAsWide:!F};for(let{segment:x}of ZE.segment(D)){let $=x.codePointAt(0);if($<=31||$>=127&&$<=159)continue;if($>=8203&&$<=8207||$===65279)continue;if($>=768&&$<=879||$>=6832&&$<=6911||$>=7616&&$<=7679||$>=8400&&$<=8447||$>=65056&&$<=65071)continue;if($>=55296&&$<=57343)continue;if($>=65024&&$<=65039)continue;if(UE.test(x))continue;if($2().test(x)){C+=2;continue}C+=x2($,B)}return C}var A2=(D=0)=>(u)=>`\x1B[${u+D}m`,H2=(D=0)=>(u)=>`\x1B[${38+D};5;${u}m`,J2=(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]}},K6=Object.keys(y.modifier),YE=Object.keys(y.color),ME=Object.keys(y.bgColor),W6=[...YE,...ME];function qE(){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=A2(),y.color.ansi256=H2(),y.color.ansi16m=J2(),y.bgColor.ansi=A2(10),y.bgColor.ansi256=H2(10),y.bgColor.ansi16m=J2(10),Object.defineProperties(y,{rgbToAnsi256:{value(u,F,E){if(u===F&&F===E){if(u<8)return 16;if(u>248)return 231;return Math.round((u-8)/247*24)+232}return 16+36*Math.round(u/255*5)+6*Math.round(F/255*5)+Math.round(E/255*5)},enumerable:!1},hexToRgb:{value(u){let F=/[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));if(!F)return[0,0,0];let[E]=F;if(E.length===3)E=[...E].map((B)=>B+B).join("");let C=Number.parseInt(E,16);return[C>>16&255,C>>8&255,C&255]},enumerable:!1},hexToAnsi256:{value:(u)=>y.rgbToAnsi256(...y.hexToRgb(u)),enumerable:!1},ansi256ToAnsi:{value(u){if(u<8)return 30+u;if(u<16)return 90+(u-8);let F,E,C;if(u>=232)F=((u-232)*10+8)/255,E=F,C=F;else{u-=16;let $=u%36;F=Math.floor(u/36)/5,E=Math.floor($/6)/5,C=$%6/5}let B=Math.max(F,E,C)*2;if(B===0)return 30;let x=30+(Math.round(C)<<2|Math.round(E)<<1|Math.round(F));if(B===2)x+=60;return x},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 QE=qE(),R2=QE;var ju=new Set(["\x1B","\x9B"]),KE=39,O0="\x07",G2="[",WE="]",S2="m",Iu=`${WE}8;;`,N2=(D)=>`${ju.values().next().value}${G2}${D}${S2}`,T2=(D)=>`${ju.values().next().value}${Iu}${D}${O0}`,wE=(D)=>D.split(" ").map((u)=>qD(u)),_0=(D,u,F)=>{let E=[...u],C=!1,B=!1,x=qD(Cu(D.at(-1)));for(let[$,R]of E.entries()){let H=qD(R);if(x+H<=F)D[D.length-1]+=R;else D.push(R),x=0;if(ju.has(R))C=!0,B=E.slice($+1,$+1+Iu.length).join("")===Iu;if(C){if(B){if(R===O0)C=!1,B=!1}else if(R===S2)C=!1;continue}if(x+=H,x===F&&$<E.length-1)D.push(""),x=0}if(!x&&D.at(-1).length>0&&D.length>1)D[D.length-2]+=D.pop()},LE=(D)=>{let u=D.split(" "),F=u.length;while(F>0){if(qD(u[F-1])>0)break;F--}if(F===u.length)return D;return u.slice(0,F).join(" ")+u.slice(F).join("")},fE=(D,u,F={})=>{if(F.trim!==!1&&D.trim()==="")return"";let E="",C,B,x=wE(D),$=[""];for(let[J,S]of D.split(" ").entries()){if(F.trim!==!1)$[$.length-1]=$.at(-1).trimStart();let T=qD($.at(-1));if(J!==0){if(T>=u&&(F.wordWrap===!1||F.trim===!1))$.push(""),T=0;if(T>0||F.trim===!1)$[$.length-1]+=" ",T++}if(F.hard&&x[J]>u){let _=u-T,I=1+Math.floor((x[J]-_-1)/u);if(Math.floor((x[J]-1)/u)<I)$.push("");_0($,S,u);continue}if(T+x[J]>u&&T>0&&x[J]>0){if(F.wordWrap===!1&&T<u){_0($,S,u);continue}$.push("")}if(T+x[J]>u&&F.wordWrap===!1){_0($,S,u);continue}$[$.length-1]+=S}if(F.trim!==!1)$=$.map((J)=>LE(J));let R=$.join(`
37
+ `),H=[...R],A=0;for(let[J,S]of H.entries()){if(E+=S,ju.has(S)){let{groups:_}=new RegExp(`(?:\\${G2}(?<code>\\d+)m|\\${Iu}(?<uri>.*)${O0})`).exec(R.slice(A))||{groups:{}};if(_.code!==void 0){let I=Number.parseFloat(_.code);C=I===KE?void 0:I}else if(_.uri!==void 0)B=_.uri.length===0?void 0:_.uri}let T=R2.codes.get(Number(C));if(H[J+1]===`
38
+ `){if(B)E+=T2("");if(C&&T)E+=N2(T)}else if(S===`
39
+ `){if(C&&T)E+=N2(C);if(B)E+=T2(B)}A+=S.length}return E};function X0(D,u,F){return String(D).normalize().replaceAll(`\r
37
40
  `,`
38
41
  `).split(`
39
- `).map((E)=>XC(E,u,F)).join(`
40
- `)}function R0(D,u){return D.split(`
41
- `).flatMap((F)=>N0(F,u,{trim:!1,hard:!0}).split(`
42
+ `).map((E)=>fE(E,u,F)).join(`
43
+ `)}function I0(D,u){return D.split(`
44
+ `).flatMap((F)=>X0(F,u,{trim:!1,hard:!0}).split(`
42
45
  `).map((E)=>E.trimEnd())).join(`
43
- `)}function x2(){return H2.default({defaultWidth:80,output:$0().output})}var I2=rD(R2(),1);import*as z2 from"readline";import{AsyncResource as UC}from"async_hooks";var YD=[];YD.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")YD.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")YD.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var Gu=(D)=>!!D&&typeof D==="object"&&typeof D.removeListener==="function"&&typeof D.emit==="function"&&typeof D.reallyExit==="function"&&typeof D.listeners==="function"&&typeof D.kill==="function"&&typeof D.pid==="number"&&typeof D.on==="function",_0=Symbol.for("signal-exit emitter"),T0=globalThis,jC=Object.defineProperty.bind(Object);class _2{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(T0[_0])return T0[_0];jC(T0,_0,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(D,u){this.listeners[D].push(u)}removeListener(D,u){let F=this.listeners[D],E=F.indexOf(u);if(E===-1)return;if(E===0&&F.length===1)F.length=0;else F.splice(E,1)}emit(D,u,F){if(this.emitted[D])return!1;this.emitted[D]=!0;let E=!1;for(let C of this.listeners[D])E=C(u,F)===!0||E;if(D==="exit")E=this.emit("afterExit",u,F)||E;return E}}class G0{}var OC=(D)=>{return{onExit(u,F){return D.onExit(u,F)},load(){return D.load()},unload(){return D.unload()}}};class T2 extends G0{onExit(){return()=>{}}load(){}unload(){}}class X2 extends G0{#F=X0.platform==="win32"?"SIGINT":"SIGHUP";#u=new _2;#D;#B;#$;#C={};#E=!1;constructor(D){super();this.#D=D,this.#C={};for(let u of YD)this.#C[u]=()=>{let F=this.#D.listeners(u),{count:E}=this.#u,C=D;if(typeof C.__signal_exit_emitter__==="object"&&typeof C.__signal_exit_emitter__.count==="number")E+=C.__signal_exit_emitter__.count;if(F.length===E){this.unload();let B=this.#u.emit("exit",null,u),$=u==="SIGHUP"?this.#F:u;if(!B)D.kill(D.pid,$)}};this.#$=D.reallyExit,this.#B=D.emit}onExit(D,u){if(!Gu(this.#D))return()=>{};if(this.#E===!1)this.load();let F=u?.alwaysLast?"afterExit":"exit";return this.#u.on(F,D),()=>{if(this.#u.removeListener(F,D),this.#u.listeners.exit.length===0&&this.#u.listeners.afterExit.length===0)this.unload()}}load(){if(this.#E)return;this.#E=!0,this.#u.count+=1;for(let D of YD)try{let u=this.#C[D];if(u)this.#D.on(D,u)}catch(u){}this.#D.emit=(D,...u)=>{return this.#H(D,...u)},this.#D.reallyExit=(D)=>{return this.#A(D)}}unload(){if(!this.#E)return;this.#E=!1,YD.forEach((D)=>{let u=this.#C[D];if(!u)throw Error("Listener not defined for signal: "+D);try{this.#D.removeListener(D,u)}catch(F){}}),this.#D.emit=this.#B,this.#D.reallyExit=this.#$,this.#u.count-=1}#A(D){if(!Gu(this.#D))return 0;return this.#D.exitCode=D||0,this.#u.emit("exit",this.#D.exitCode,null),this.#$.call(this.#D,this.#D.exitCode)}#H(D,...u){let F=this.#B;if(D==="exit"&&Gu(this.#D)){if(typeof u[0]==="number")this.#D.exitCode=u[0];let E=F.call(this.#D,D,...u);return this.#u.emit("exit",this.#D.exitCode,null),E}else return F.call(this.#D,D,...u)}}var X0=globalThis.process,{onExit:G2,load:X1,unload:G1}=OC(Gu(X0)?new X2(X0):new T2);import{stripVTControlCharacters as zC}from"util";var SC="\x1B[G";var O2="\x1B[?25h",j0=(D=1)=>D>0?`\x1B[${D}A`:"",O0=(D=1)=>D>0?`\x1B[${D}B`:"",S0=(D,u)=>{if(typeof u==="number"&&!Number.isNaN(u))return`\x1B[${u+1};${D+1}H`;return`\x1B[${D+1}G`},j2="\x1B[2K",z0=(D)=>D>0?(j2+j0(1)).repeat(D-1)+j2+SC:"";var S2=(D)=>D.split(`
44
- `).length,IC=(D)=>D.split(`
45
- `).pop()??"";class ju{height=0;extraLinesUnderPrompt=0;cursorPos;rl;constructor(D){this.rl=D,this.cursorPos=D.getCursorPos()}write(D){this.rl.output.unmute(),this.rl.output.write(D),this.rl.output.mute()}render(D,u=""){let F=IC(D),E=zC(F),C=E;if(this.rl.line.length>0)C=C.slice(0,-this.rl.line.length);this.rl.setPrompt(C),this.cursorPos=this.rl.getCursorPos();let B=x2();if(D=R0(D,B),u=R0(u,B),E.length%B===0)D+=`
46
- `;let $=D+(u?`
47
- `+u:""),R=Math.floor(E.length/B)-this.cursorPos.rows+(u?S2(u):0);if(R>0)$+=j0(R);$+=S0(this.cursorPos.cols),this.write(O0(this.extraLinesUnderPrompt)+z0(this.height)+$),this.extraLinesUnderPrompt=R,this.height=S2($)}checkCursorPos(){let D=this.rl.getCursorPos();if(D.cols!==this.cursorPos.cols)this.write(S0(D.cols)),this.cursorPos=D}done({clearContent:D}){this.rl.setPrompt("");let u=O0(this.extraLinesUnderPrompt);u+=D?z0(this.height):`
48
- `,u+=O2,this.write(u),this.rl.close()}}class I0 extends Promise{static withResolver(){let D,u;return{promise:new Promise((E,C)=>{D=E,u=C}),resolve:D,reject:u}}}function ZC(){let D=Error.prepareStackTrace,u=[];try{Error.prepareStackTrace=(F,E)=>{let C=E.slice(1);return u=C,C},Error().stack}catch{return u}return Error.prepareStackTrace=D,u}function Fu(D){let u=ZC();return(E,C={})=>{let{input:B=process.stdin,signal:$}=C,A=new Set,R=new I2.default;R.pipe(C.output??process.stdout);let x=z2.createInterface({terminal:!0,input:B,output:R}),H=new ju(x),{promise:J,resolve:T,reject:_}=I0.withResolver(),X=()=>_(new E0);if($){let I=()=>_(new F0({cause:$.reason}));if($.aborted)return I(),Object.assign(J,{cancel:X});$.addEventListener("abort",I),A.add(()=>$.removeEventListener("abort",I))}A.add(G2((I,U)=>{_(new FD(`User force closed the prompt with ${I} ${U}`))}));let j=()=>_(new FD("User force closed the prompt with SIGINT"));x.on("SIGINT",j),A.add(()=>x.removeListener("SIGINT",j));let O=()=>H.checkCursorPos();return x.input.on("keypress",O),A.add(()=>x.input.removeListener("keypress",O)),bF(x,(I)=>{let U=UC.bind(()=>zD.clearAll());return x.on("close",U),A.add(()=>x.removeListener("close",U)),I(()=>{try{let z=D(E,(_D)=>{setImmediate(()=>T(_D))});if(z===void 0){let _D=u[1]?.getFileName();throw Error(`Prompt functions must return a string.
49
- at ${_D}`)}let[d,DD]=typeof z==="string"?[z]:z;H.render(d,DD),zD.run()}catch(z){_(z)}}),Object.assign(J.then((z)=>{return zD.clearAll(),z},(z)=>{throw zD.clearAll(),z}).finally(()=>{A.forEach((z)=>z()),H.done({clearContent:Boolean(C.clearPromptOnDone)}),R.end()}).then(()=>J),{cancel:X})})}}function U2(D,u){let F=u!==!1;if(/^(y|yes)/i.test(D))F=!0;else if(/^(n|no)/i.test(D))F=!1;return F}function Z2(D){return D?"Yes":"No"}var AD=Fu((D,u)=>{let{transformer:F=Z2}=D,[E,C]=s("idle"),[B,$]=s(""),A=UD(D.theme),R=eD({status:E,theme:A});Du((T,_)=>{if(E!=="idle")return;if(sD(T)){let X=U2(B,D.default);$(F(X)),C("done"),u(X)}else if(aD(T)){let X=Z2(!U2(B,D.default));_.clearLine(0),_.write(X),$(X)}else $(_.line)});let x=B,H="";if(E==="done")x=A.style.answer(B);else H=` ${A.style.defaultAnswer(D.default===!1?"y/N":"Y/n")}`;let J=A.style.message(D.message,E);return`${R} ${J}${H} ${x}`});var YC={validationFailureMode:"keep"},Eu=Fu((D,u)=>{let{prefill:F="tab"}=D,E=UD(YC,D.theme),[C,B]=s("idle"),[$="",A]=s(D.default),[R,x]=s(),[H,J]=s(""),T=eD({status:C,theme:E});async function _(U){let{required:z,pattern:d,patternError:DD="Invalid input"}=D;if(z&&!U)return"You must provide a value";if(d&&!d.test(U))return DD;if(typeof D.validate==="function")return await D.validate(U)||"You must provide a valid value";return!0}Du(async(U,z)=>{if(C!=="idle")return;if(sD(U)){let d=H||$;B("loading");let DD=await _(d);if(DD===!0)J(d),B("done"),u(d);else{if(E.validationFailureMode==="clear")J("");else z.write(H);x(DD),B("idle")}}else if(u0(U)&&!H)A(void 0);else if(aD(U)&&!H)A(void 0),z.clearLine(0),z.write($),J($);else J(z.line),x(void 0)}),ID((U)=>{if(F==="editable"&&$)U.write($),J($)},[]);let X=E.style.message(D.message,C),j=H;if(typeof D.transformer==="function")j=D.transformer(H,{isFinal:C==="done"});else if(C==="done")j=E.style.answer(H);let O;if($&&C!=="done"&&!H)O=E.style.defaultAnswer($);let I="";if(R)I=E.style.error(R);return[[T,X,O,j].filter((U)=>U!==void 0).join(" "),I]});class m extends Error{code;constructor(D,u){super(u);this.code=D;this.name="HostError"}}var o2=rD(i2(),1),W="local",R8={stale:5000,retries:{retries:5,minTimeout:100,maxTimeout:1000,factor:2}};function Wu(){return`${Bun.env.HOME||Bun.env.USERPROFILE||"~"}/.config/wt/config.json`}function a2(){let D=new Date().toISOString();return{name:W,ssh:"",root:"",connectTimeout:10,labels:{},createdAt:D,updatedAt:D,lastCheckedAt:D,lastStatus:"ok"}}function s2(){return{version:1,defaultHost:W,hosts:{[W]:a2()},sandboxes:{}}}async function a(){let D=Wu(),u=Bun.file(D);if(!await u.exists())return s2();try{let F=await u.json();if(F.version!==1)throw Error(`Unsupported config version: ${F.version}`);if(!F.sandboxes)F.sandboxes={};if(!F.hosts[W])F.hosts[W]=a2();if(!F.defaultHost)F.defaultHost=W;return F}catch(F){if(F instanceof SyntaxError)throw Error(`Invalid config file at ${D}: ${F.message}`);throw F}}async function e2(D){let u=Wu(),F=u.slice(0,u.lastIndexOf("/"));await Bun.$`mkdir -p ${F} && chmod 700 ${F}`.quiet();let E=JSON.stringify(D,null,2);await Bun.write(u,E),await Bun.$`chmod 600 ${u}`.quiet()}async function e(D){let u=Wu(),F=u.slice(0,u.lastIndexOf("/"));if(await Bun.$`mkdir -p ${F} && chmod 700 ${F}`.quiet(),!await Bun.file(u).exists())await Bun.write(u,JSON.stringify(s2(),null,2)),await Bun.$`chmod 600 ${u}`.quiet();let C=await o2.default.lock(u,R8);try{let B=await a(),$=await D(B);return await e2(B),$}finally{await C()}}async function p(D){return(await a()).hosts[D]}async function WD(){let D=await a();if(!D.defaultHost)return;return D.hosts[D.defaultHost]}async function h0(D){return e((u)=>{if(!u.hosts[D])return!1;if(delete u.hosts[D],u.defaultHost===D)u.defaultHost=null;return!0})}class G extends Error{code;constructor(D,u){super(u);this.code=D;this.name="SandboxError"}}var _8=/^[a-z][a-z0-9_-]{0,31}$/,T8=/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,63}$/,b0=/[;`|&$(){}*?<>!\\"\n\r]/;function D3(D){if(!D)throw new m("VALIDATION_ERROR","Host name is required");if(!_8.test(D))throw new m("VALIDATION_ERROR","Host name must match pattern: starts with a-z, followed by 0-31 chars of a-z, 0-9, _, or -")}function wu(D){if(!D)throw new G("VALIDATION_ERROR","Sandbox name is required");if(!T8.test(D))throw new G("VALIDATION_ERROR","Sandbox name must start with an alphanumeric character, contain only alphanumeric characters, dots, underscores, or hyphens, and be at most 64 characters");if(D==="."||D==="..")throw new G("VALIDATION_ERROR",'Sandbox name cannot be "." or ".."')}function v0(D){if(!D)return;if(b0.test(D))throw new G("VALIDATION_ERROR",`Git ref contains invalid characters: ${D}`)}function u3(D){if(!D||D.trim()==="")throw new m("VALIDATION_ERROR","SSH target is required");if(b0.test(D))throw new m("VALIDATION_ERROR","SSH target contains invalid characters (shell metacharacters are not allowed)")}function F3(D){if(!D)throw new m("VALIDATION_ERROR","Root path is required");if(!D.startsWith("/")&&!D.startsWith("~/"))throw new m("VALIDATION_ERROR","Root path must be absolute (start with / or ~/)");if(b0.test(D))throw new m("VALIDATION_ERROR","Root path contains invalid characters (shell metacharacters are not allowed)")}function E3(D){if(D===void 0)return;if(!Number.isInteger(D)||D<1||D>65535)throw new m("VALIDATION_ERROR","Port must be an integer between 1 and 65535")}function C3(D){if(D===void 0)return;if(!Number.isInteger(D)||D<1||D>300)throw new m("VALIDATION_ERROR","Connect timeout must be an integer between 1 and 300 seconds")}function m0(D){if(!D)return{};let u={},F=D.split(",");for(let E of F){let C=E.trim();if(!C)continue;let B=C.indexOf("=");if(B===-1)throw new m("VALIDATION_ERROR",`Invalid label format "${C}": expected key=value`);let $=C.slice(0,B).trim(),A=C.slice(B+1).trim();if(!$)throw new m("VALIDATION_ERROR",`Invalid label: empty key in "${C}"`);u[$]=A}return u}function g0(D){D3(D.name),u3(D.ssh),F3(D.root),E3(D.port),C3(D.connectTimeout)}function M(D){if(D.startsWith("~/"))return`~/'${D.slice(2).replace(/'/g,"'\\''")}'`;return`'${D.replace(/'/g,"'\\''")}'`}function bD(D){let u=[];if(D.connectTimeout)u.push("-o",`ConnectTimeout=${D.connectTimeout}`);if(u.push("-o","BatchMode=yes"),u.push("-o","StrictHostKeyChecking=accept-new"),D.port)u.push("-p",String(D.port));if(D.identity)u.push("-i",D.identity);return u.push(D.ssh),u}function ND(D){return{ssh:D.ssh,port:D.port,identity:D.identity,connectTimeout:D.connectTimeout}}async function Q(D,u){let F=bD(D);F.push(u);try{let E=await Bun.$`ssh ${F}`.quiet().nothrow();return{ok:E.exitCode===0,exitCode:E.exitCode,stdout:E.stdout.toString().trim(),stderr:E.stderr.toString().trim()}}catch(E){return{ok:!1,exitCode:-1,stdout:"",stderr:E instanceof Error?E.message:String(E)}}}async function Vu(D){return Q(D,"echo ok")}async function B3(D){return Q(D,"git --version")}async function $3(D){return Q(D,"node --version")}async function A3(D,u){let F=["mirrors","sandboxes","meta"],C=[`mkdir -p ${F.map((B)=>M(`${u}/${B}`)).join(" ")}`,...F.map((B)=>`test -w ${M(`${u}/${B}`)}`)].join(" && ");return Q(D,C)}function X8(D){let u=D.match(/git version (\d+\.\d+(?:\.\d+)?)/);return u?u[1]:null}function G8(D){let u=D.match(/v?(\d+\.\d+\.\d+)/);return u?u[1]:null}function j8(D){let[u,F]=D.split(".").map(Number);return u>2||u===2&&F>=5}async function H3(D){let F=(await a()).hosts[D];if(!F)throw new m("HOST_NOT_FOUND",`Host "${D}" not found`);return fu(F)}async function fu(D){let u=ND(D),F=[],E=[],C={ok:!1,host:D.name,checks:{ssh:{ok:!1},directories:{ok:!1},git:{ok:!1},node:{ok:!1}},errors:F,warnings:E},B=await Vu(u);if(B.ok)C.checks.ssh={ok:!0};else return C.checks.ssh={ok:!1,error:B.stderr||"Connection failed"},F.push(`SSH connection failed: ${B.stderr||"unknown error"}`),C;let $=await A3(u,D.root);if($.ok)C.checks.directories={ok:!0};else C.checks.directories={ok:!1,error:$.stderr||"Failed to create directories"},F.push(`Directory check failed: ${$.stderr||"unknown error"}`);let A=await B3(u);if(A.ok){let x=X8(A.stdout);if(x)if(j8(x))C.checks.git={ok:!0,version:x};else C.checks.git={ok:!1,version:x,error:`Git ${x} does not support worktrees (need 2.5+)`},F.push(`Git ${x} does not support worktrees (need 2.5+)`);else C.checks.git={ok:!1,error:"Could not parse git version"},F.push("Could not parse git version")}else C.checks.git={ok:!1,error:"git not found"},F.push("git not found on remote");let R=await $3(u);if(R.ok){let x=G8(R.stdout);if(x)C.checks.node={ok:!0,version:x};else C.checks.node={ok:!0,warning:!0},E.push("Could not parse node version")}else C.checks.node={ok:!1,warning:!0,error:"not found"},E.push("node not found (optional)");return C.ok=C.checks.ssh.ok&&C.checks.directories.ok&&C.checks.git.ok,C}async function O8(D,u){await e((F)=>{let E=F.hosts[D];if(!E)throw new m("HOST_NOT_FOUND",`Host "${D}" not found`);E.lastCheckedAt=new Date().toISOString(),E.lastStatus=u.ok?"ok":"error",E.updatedAt=new Date().toISOString()})}async function n0(D){let u=await H3(D);return await O8(D,u),u}var S8=10;async function d0(D){g0({name:D.name,ssh:D.ssh,root:D.root,port:D.port,connectTimeout:D.connectTimeout});let{host:u,action:F}=await e((C)=>{let B=C.hosts[D.name],$=new Date().toISOString(),A={name:D.name,ssh:D.ssh,root:D.root,port:D.port,identity:D.identity,connectTimeout:D.connectTimeout??S8,labels:D.labels??{},createdAt:B?.createdAt??$,updatedAt:$,lastCheckedAt:B?.lastCheckedAt??null,lastStatus:B?.lastStatus??"unchecked"},R=B?"updated":"created";if(C.hosts[D.name]=A,D.setDefault)C.defaultHost=D.name;return{host:A,action:R}}),E;if(!D.skipCheck)E=await fu(u),await e((C)=>{let B=C.hosts[D.name];if(B)B.lastCheckedAt=new Date().toISOString(),B.lastStatus=E.ok?"ok":"error",B.updatedAt=new Date().toISOString()}),u.lastCheckedAt=new Date().toISOString(),u.lastStatus=E.ok?"ok":"error";return{ok:!0,action:F,host:u,checkResult:E}}async function c0(){let D=await a(),u=Object.values(D.hosts).sort((F,E)=>F.name.localeCompare(E.name));return{defaultHost:D.defaultHost,hosts:u}}function z8(D){let u=[];if(D.checks.ssh.ok)u.push(` ${N.green("\u2713")} SSH connection`);else return u.push(` ${N.red("\u2717")} SSH connection: ${D.checks.ssh.error}`),u.join(`
46
+ `)}function O2(){return _2.default({defaultWidth:80,output:T0().output})}var W2=PD(j2(),1);import*as K2 from"readline";import{AsyncResource as vE}from"async_hooks";var QD=[];QD.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")QD.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")QD.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var zu=(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",j0=Symbol.for("signal-exit emitter"),z0=globalThis,yE=Object.defineProperty.bind(Object);class z2{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(z0[j0])return z0[j0];yE(z0,j0,{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 U0{}var PE=(D)=>{return{onExit(u,F){return D.onExit(u,F)},load(){return D.load()},unload(){return D.unload()}}};class Z2 extends U0{onExit(){return()=>{}}load(){}unload(){}}class U2 extends U0{#F=Z0.platform==="win32"?"SIGINT":"SIGHUP";#u=new z2;#D;#B;#x;#C={};#E=!1;constructor(D){super();this.#D=D,this.#C={};for(let u of QD)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),x=u==="SIGHUP"?this.#F:u;if(!B)D.kill(D.pid,x)}};this.#x=D.reallyExit,this.#B=D.emit}onExit(D,u){if(!zu(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 QD)try{let u=this.#C[D];if(u)this.#D.on(D,u)}catch(u){}this.#D.emit=(D,...u)=>{return this.#A(D,...u)},this.#D.reallyExit=(D)=>{return this.#$(D)}}unload(){if(!this.#E)return;this.#E=!1,QD.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.#x,this.#u.count-=1}#$(D){if(!zu(this.#D))return 0;return this.#D.exitCode=D||0,this.#u.emit("exit",this.#D.exitCode,null),this.#x.call(this.#D,this.#D.exitCode)}#A(D,...u){let F=this.#B;if(D==="exit"&&zu(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 Z0=globalThis.process,{onExit:Y2,load:g6,unload:n6}=PE(zu(Z0)?new U2(Z0):new Z2);import{stripVTControlCharacters as hE}from"util";var kE="\x1B[G";var q2="\x1B[?25h",Y0=(D=1)=>D>0?`\x1B[${D}A`:"",M0=(D=1)=>D>0?`\x1B[${D}B`:"",q0=(D,u)=>{if(typeof u==="number"&&!Number.isNaN(u))return`\x1B[${u+1};${D+1}H`;return`\x1B[${D+1}G`},M2="\x1B[2K",Q0=(D)=>D>0?(M2+Y0(1)).repeat(D-1)+M2+kE:"";var Q2=(D)=>D.split(`
47
+ `).length,bE=(D)=>D.split(`
48
+ `).pop()??"";class Zu{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=bE(D),E=hE(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=O2();if(D=I0(D,B),u=I0(u,B),E.length%B===0)D+=`
49
+ `;let x=D+(u?`
50
+ `+u:""),R=Math.floor(E.length/B)-this.cursorPos.rows+(u?Q2(u):0);if(R>0)x+=Y0(R);x+=q0(this.cursorPos.cols),this.write(M0(this.extraLinesUnderPrompt)+Q0(this.height)+x),this.extraLinesUnderPrompt=R,this.height=Q2(x)}checkCursorPos(){let D=this.rl.getCursorPos();if(D.cols!==this.cursorPos.cols)this.write(q0(D.cols)),this.cursorPos=D}done({clearContent:D}){this.rl.setPrompt("");let u=M0(this.extraLinesUnderPrompt);u+=D?Q0(this.height):`
51
+ `,u+=q2,this.write(u),this.rl.close()}}class K0 extends Promise{static withResolver(){let D,u;return{promise:new Promise((E,C)=>{D=E,u=C}),resolve:D,reject:u}}}function mE(){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 Bu(D){let u=mE();return(E,C={})=>{let{input:B=process.stdin,signal:x}=C,$=new Set,R=new W2.default;R.pipe(C.output??process.stdout);let H=K2.createInterface({terminal:!0,input:B,output:R}),A=new Zu(H),{promise:J,resolve:S,reject:T}=K0.withResolver(),_=()=>T(new J0);if(x){let Z=()=>T(new H0({cause:x.reason}));if(x.aborted)return Z(),Object.assign(J,{cancel:_});x.addEventListener("abort",Z),$.add(()=>x.removeEventListener("abort",Z))}$.add(Y2((Z,G)=>{T(new FD(`User force closed the prompt with ${Z} ${G}`))}));let I=()=>T(new FD("User force closed the prompt with SIGINT"));H.on("SIGINT",I),$.add(()=>H.removeListener("SIGINT",I));let O=()=>A.checkCursorPos();return H.input.on("keypress",O),$.add(()=>H.input.removeListener("keypress",O)),rF(H,(Z)=>{let G=vE.bind(()=>UD.clearAll());return H.on("close",G),$.add(()=>H.removeListener("close",G)),Z(()=>{try{let j=D(E,(SD)=>{setImmediate(()=>S(SD))});if(j===void 0){let SD=u[1]?.getFileName();throw Error(`Prompt functions must return a string.
52
+ at ${SD}`)}let[g,s]=typeof j==="string"?[j]:j;A.render(g,s),UD.run()}catch(j){T(j)}}),Object.assign(J.then((j)=>{return UD.clearAll(),j},(j)=>{throw UD.clearAll(),j}).finally(()=>{$.forEach((j)=>j()),A.done({clearContent:Boolean(C.clearPromptOnDone)}),R.end()}).then(()=>J),{cancel:_})})}}function w2(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 L2(D){return D?"Yes":"No"}var $D=Bu((D,u)=>{let{transformer:F=L2}=D,[E,C]=e("idle"),[B,x]=e(""),$=MD(D.theme),R=Fu({status:E,theme:$});Eu((S,T)=>{if(E!=="idle")return;if(uu(S)){let _=w2(B,D.default);x(F(_)),C("done"),u(_)}else if(Du(S)){let _=L2(!w2(B,D.default));T.clearLine(0),T.write(_),x(_)}else x(T.line)});let H=B,A="";if(E==="done")H=$.style.answer(B);else A=` ${$.style.defaultAnswer(D.default===!1?"y/N":"Y/n")}`;let J=$.style.message(D.message,E);return`${R} ${J}${A} ${H}`});var gE={validationFailureMode:"keep"},xu=Bu((D,u)=>{let{prefill:F="tab"}=D,E=MD(gE,D.theme),[C,B]=e("idle"),[x="",$]=e(D.default),[R,H]=e(),[A,J]=e(""),S=Fu({status:C,theme:E});async function T(G){let{required:j,pattern:g,patternError:s="Invalid input"}=D;if(j&&!G)return"You must provide a value";if(g&&!g.test(G))return s;if(typeof D.validate==="function")return await D.validate(G)||"You must provide a valid value";return!0}Eu(async(G,j)=>{if(C!=="idle")return;if(uu(G)){let g=A||x;B("loading");let s=await T(g);if(s===!0)J(g),B("done"),u(g);else{if(E.validationFailureMode==="clear")J("");else j.write(A);H(s),B("idle")}}else if(A0(G)&&!A)$(void 0);else if(Du(G)&&!A)$(void 0),j.clearLine(0),j.write(x),J(x);else J(j.line),H(void 0)}),YD((G)=>{if(F==="editable"&&x)G.write(x),J(x)},[]);let _=E.style.message(D.message,C),I=A;if(typeof D.transformer==="function")I=D.transformer(A,{isFinal:C==="done"});else if(C==="done")I=E.style.answer(A);let O;if(x&&C!=="done"&&!A)O=E.style.defaultAnswer(x);let Z="";if(R)Z=E.style.error(R);return[[S,_,O,I].filter((G)=>G!==void 0).join(" "),Z]});class m extends Error{code;constructor(D,u){super(u);this.code=D;this.name="HostError"}}var C3=PD(E3(),1),W="local",WC={stale:5000,retries:{retries:5,minTimeout:100,maxTimeout:1000,factor:2}};function yu(){return`${Bun.env.HOME||Bun.env.USERPROFILE||"~"}/.config/wt/config.json`}function B3(){let D=new Date().toISOString();return{name:W,ssh:"",root:"",connectTimeout:10,labels:{},createdAt:D,updatedAt:D,lastCheckedAt:D,lastStatus:"ok"}}function x3(){return{version:1,defaultHost:W,hosts:{[W]:B3()},sandboxes:{}}}async function a(){let D=yu(),u=Bun.file(D);if(!await u.exists())return x3();try{let F=await u.json();if(F.version!==1)throw Error(`Unsupported config version: ${F.version}`);if(!F.sandboxes)F.sandboxes={};if(!F.hosts[W])F.hosts[W]=B3();if(!F.defaultHost)F.defaultHost=W;return F}catch(F){if(F instanceof SyntaxError)throw Error(`Invalid config file at ${D}: ${F.message}`);throw F}}async function $3(D){let u=yu(),F=u.slice(0,u.lastIndexOf("/"));await Bun.$`mkdir -p ${F} && chmod 700 ${F}`.quiet();let E=JSON.stringify(D,null,2);await Bun.write(u,E),await Bun.$`chmod 600 ${u}`.quiet()}async function DD(D){let u=yu(),F=u.slice(0,u.lastIndexOf("/"));if(await Bun.$`mkdir -p ${F} && chmod 700 ${F}`.quiet(),!await Bun.file(u).exists())await Bun.write(u,JSON.stringify(x3(),null,2)),await Bun.$`chmod 600 ${u}`.quiet();let C=await C3.default.lock(u,WC);try{let B=await a(),x=await D(B);return await $3(B),x}finally{await C()}}async function p(D){return(await a()).hosts[D]}async function fD(){let D=await a();if(!D.defaultHost)return;return D.hosts[D.defaultHost]}async function c0(D){return DD((u)=>{if(!u.hosts[D])return!1;if(delete u.hosts[D],u.defaultHost===D)u.defaultHost=null;return!0})}class X extends Error{code;constructor(D,u){super(u);this.code=D;this.name="SandboxError"}}var wC=/^[a-z][a-z0-9_-]{0,31}$/,LC=/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,63}$/,t0=/[;`|&$(){}*?<>!\\"\n\r]/;function A3(D){if(!D)throw new m("VALIDATION_ERROR","Host name is required");if(!wC.test(D))throw new m("VALIDATION_ERROR","Host name must match pattern: starts with a-z, followed by 0-31 chars of a-z, 0-9, _, or -")}function ku(D){if(!D)throw new X("VALIDATION_ERROR","Sandbox name is required");if(!LC.test(D))throw new X("VALIDATION_ERROR","Sandbox name must start with an alphanumeric character, contain only alphanumeric characters, dots, underscores, or hyphens, and be at most 64 characters");if(D==="."||D==="..")throw new X("VALIDATION_ERROR",'Sandbox name cannot be "." or ".."')}function r0(D){if(!D)return;if(t0.test(D))throw new X("VALIDATION_ERROR",`Git ref contains invalid characters: ${D}`)}function H3(D){if(!D||D.trim()==="")throw new m("VALIDATION_ERROR","SSH target is required");if(t0.test(D))throw new m("VALIDATION_ERROR","SSH target contains invalid characters (shell metacharacters are not allowed)")}function J3(D){if(!D)throw new m("VALIDATION_ERROR","Root path is required");if(!D.startsWith("/")&&!D.startsWith("~/"))throw new m("VALIDATION_ERROR","Root path must be absolute (start with / or ~/)");if(t0.test(D))throw new m("VALIDATION_ERROR","Root path contains invalid characters (shell metacharacters are not allowed)")}function R3(D){if(D===void 0)return;if(!Number.isInteger(D)||D<1||D>65535)throw new m("VALIDATION_ERROR","Port must be an integer between 1 and 65535")}function N3(D){if(D===void 0)return;if(!Number.isInteger(D)||D<1||D>300)throw new m("VALIDATION_ERROR","Connect timeout must be an integer between 1 and 300 seconds")}function l0(D){if(!D)return{};let u={},F=D.split(",");for(let E of F){let C=E.trim();if(!C)continue;let B=C.indexOf("=");if(B===-1)throw new m("VALIDATION_ERROR",`Invalid label format "${C}": expected key=value`);let x=C.slice(0,B).trim(),$=C.slice(B+1).trim();if(!x)throw new m("VALIDATION_ERROR",`Invalid label: empty key in "${C}"`);u[x]=$}return u}function i0(D){A3(D.name),H3(D.ssh),J3(D.root),R3(D.port),N3(D.connectTimeout)}function M(D){if(D.startsWith("~/"))return`~/'${D.slice(2).replace(/'/g,"'\\''")}'`;return`'${D.replace(/'/g,"'\\''")}'`}function nD(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 TD(D){return{ssh:D.ssh,port:D.port,identity:D.identity,connectTimeout:D.connectTimeout}}async function Q(D,u){let F=nD(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 hu(D){return Q(D,"echo ok")}async function T3(D){return Q(D,"git --version")}async function G3(D){return Q(D,"node --version")}async function S3(D,u){let F=["mirrors","sandboxes","meta"],C=[`mkdir -p ${F.map((B)=>M(`${u}/${B}`)).join(" ")}`,...F.map((B)=>`test -w ${M(`${u}/${B}`)}`)].join(" && ");return Q(D,C)}function fC(D){let u=D.match(/git version (\d+\.\d+(?:\.\d+)?)/);return u?u[1]:null}function VC(D){let u=D.match(/v?(\d+\.\d+\.\d+)/);return u?u[1]:null}function yC(D){let[u,F]=D.split(".").map(Number);return u>2||u===2&&F>=5}async function _3(D){let F=(await a()).hosts[D];if(!F)throw new m("HOST_NOT_FOUND",`Host "${D}" not found`);return bu(F)}async function bu(D){let u=TD(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 hu(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 x=await S3(u,D.root);if(x.ok)C.checks.directories={ok:!0};else C.checks.directories={ok:!1,error:x.stderr||"Failed to create directories"},F.push(`Directory check failed: ${x.stderr||"unknown error"}`);let $=await T3(u);if($.ok){let H=fC($.stdout);if(H)if(yC(H))C.checks.git={ok:!0,version:H};else C.checks.git={ok:!1,version:H,error:`Git ${H} does not support worktrees (need 2.5+)`},F.push(`Git ${H} does not support worktrees (need 2.5+)`);else C.checks.git={ok:!1,error:"Could not parse git version"},F.push("Could not parse git version")}else C.checks.git={ok:!1,error:"git not found"},F.push("git not found on remote");let R=await G3(u);if(R.ok){let H=VC(R.stdout);if(H)C.checks.node={ok:!0,version:H};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 PC(D,u){await DD((F)=>{let E=F.hosts[D];if(!E)throw new m("HOST_NOT_FOUND",`Host "${D}" not found`);E.lastCheckedAt=new Date().toISOString(),E.lastStatus=u.ok?"ok":"error",E.updatedAt=new Date().toISOString()})}async function p0(D){let u=await _3(D);return await PC(D,u),u}var kC=10;async function o0(D){i0({name:D.name,ssh:D.ssh,root:D.root,port:D.port,connectTimeout:D.connectTimeout});let{host:u,action:F}=await DD((C)=>{let B=C.hosts[D.name],x=new Date().toISOString(),$={name:D.name,ssh:D.ssh,root:D.root,port:D.port,identity:D.identity,connectTimeout:D.connectTimeout??kC,labels:D.labels??{},createdAt:B?.createdAt??x,updatedAt:x,lastCheckedAt:B?.lastCheckedAt??null,lastStatus:B?.lastStatus??"unchecked"},R=B?"updated":"created";if(C.hosts[D.name]=$,D.setDefault)C.defaultHost=D.name;return{host:$,action:R}}),E;if(!D.skipCheck)E=await bu(u),await DD((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 a0(){let D=await a(),u=Object.values(D.hosts).sort((F,E)=>F.name.localeCompare(E.name));return{defaultHost:D.defaultHost,hosts:u}}function hC(D){let u=[];if(D.checks.ssh.ok)u.push(` ${N.green("\u2713")} SSH connection`);else return u.push(` ${N.red("\u2717")} SSH connection: ${D.checks.ssh.error}`),u.join(`
50
53
  `);if(D.checks.directories.ok)u.push(` ${N.green("\u2713")} Directory structure`);else u.push(` ${N.red("\u2717")} Directory structure: ${D.checks.directories.error||"failed"}`);if(D.checks.git.ok)u.push(` ${N.green("\u2713")} git ${D.checks.git.version}`);else u.push(` ${N.red("\u2717")} git: ${D.checks.git.error||"not found"}`);if(D.checks.node.ok)u.push(` ${N.green("\u2713")} node ${D.checks.node.version}`);else u.push(` ${N.yellow("\u26A0")} node not found (optional)`);return u.join(`
51
- `)}async function I8(){console.log(N.cyan(`
54
+ `)}async function bC(){console.log(N.cyan(`
52
55
  Add a new host
53
- `));let D=await Eu({message:"Host name:",validate:(B)=>{if(!B)return"Host name is required";if(!/^[a-z][a-z0-9_-]{0,31}$/.test(B))return"Must start with a-z, followed by a-z, 0-9, _, or - (max 32 chars)";return!0}}),u=await Eu({message:"SSH target (alias or user@host):",validate:(B)=>B?!0:"SSH target is required"}),F=await Eu({message:"Remote base directory:",default:"~/.wt",validate:(B)=>{if(!B)return"Root path is required";if(!B.startsWith("/")&&!B.startsWith("~/"))return"Must be an absolute path (start with / or ~/)";return!0}}),E=await AD({message:"Set as default host?",default:!0}),C=await AD({message:"Run connectivity check?",default:!0});return{name:D,ssh:u,root:F,setDefault:E,skipCheck:!C,runCheck:C}}function x3(D){D.command("add").description("Register or update a remote host").argument("[name]","Host identifier (a-z, 0-9, _, - ; max 32 chars)").option("-s, --ssh <target>","SSH target (alias, user@host, or ssh://user@host:port)").option("-r, --root <path>","Remote base directory (absolute path)").option("-d, --default","Set as default host").option("-p, --port <number>","SSH port (overrides target/config)").option("-i, --identity <path>","Path to SSH identity file").option("-t, --connect-timeout <seconds>","Connection timeout in seconds","10").option("--no-check","Skip connectivity check after adding").option("-l, --labels <k=v,...>","Comma-separated key=value labels").option("--json","Output result as JSON").action(async(u,F)=>{try{let E,C=!u||!F.ssh||!F.root;if(C&&F.json)console.log(JSON.stringify({ok:!1,error:"Missing required arguments (name, --ssh, --root) and --json prevents interactive mode"},null,2)),process.exit(1);if(C)E=await I8();else E={name:u,ssh:F.ssh,root:F.root,setDefault:F.default,port:F.port?parseInt(F.port,10):void 0,identity:F.identity,connectTimeout:F.connectTimeout?parseInt(F.connectTimeout,10):void 0,skipCheck:F.check===!1,labels:m0(F.labels)};if(!E.skipCheck&&!F.json)console.log(`
54
- Checking ${E.name} (${E.ssh}:${E.root})...`);let B=await d0(E);if(F.json)console.log(JSON.stringify(B,null,2));else{if(B.checkResult)console.log(z8(B.checkResult)),console.log();let $=E.setDefault?N.dim(" (default)"):"",A=B.action==="created"?"Added":"Updated";if(B.checkResult?.ok===!1)console.log(N.yellow(`${A} host "${B.host.name}"${$}, but check failed.`));else console.log(N.green(`${A} host "${B.host.name}"${$}`))}if(B.checkResult&&!B.checkResult.ok)process.exit(2)}catch(E){if(E instanceof FD)console.log(N.dim(`
55
- Cancelled.`)),process.exit(130);if(E instanceof m){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(N.red(`Error: ${E.message}`));process.exit(E.code==="VALIDATION_ERROR"?1:1)}throw E}})}function U8(D){switch(D){case"ok":return N.green("ok");case"error":return N.red("error");default:return N.dim("unchecked")}}function OD(D,u){return D.padEnd(u)}function J3(D){D.command("ls").description("List all configured hosts").option("--json","Output as JSON").action(async(u)=>{let F=await c0();if(u.json){console.log(JSON.stringify(F,null,2));return}if(F.hosts.length===0){console.log(N.dim("No hosts configured. Run `wt host add` to add one."));return}let E=Math.max(4,...F.hosts.map(($)=>$.name.length))+2,C=Math.max(3,...F.hosts.map(($)=>$.ssh.length))+2,B=Math.max(4,...F.hosts.map(($)=>$.root.length))+2;console.log(N.bold(OD("NAME",E)+OD("SSH",C)+OD("ROOT",B)+OD("DEFAULT",9)+"STATUS"));for(let $ of F.hosts){let R=$.name===F.defaultHost?N.cyan("*"):N.dim("-");console.log(OD($.name,E)+OD($.ssh,C)+OD($.root,B)+OD(R,9)+U8($.lastStatus))}})}function Z8(D,u,F){let E=[];if(E.push(`Checking ${D.host} (${u}:${F})...`),D.checks.ssh.ok)E.push(` ${N.green("\u2713")} SSH connection`);else E.push(` ${N.red("\u2717")} SSH connection: ${D.checks.ssh.error}`);if(D.checks.ssh.ok){if(D.checks.directories.ok)E.push(` ${N.green("\u2713")} Directory structure`);else E.push(` ${N.red("\u2717")} Directory structure: ${D.checks.directories.error||"failed"}`);if(D.checks.git.ok)E.push(` ${N.green("\u2713")} git ${D.checks.git.version}`);else E.push(` ${N.red("\u2717")} git: ${D.checks.git.error||"not found"}`);if(D.checks.node.ok)E.push(` ${N.green("\u2713")} node ${D.checks.node.version}`);else E.push(` ${N.yellow("\u26A0")} node not found (optional)`)}return E.join(`
56
- `)}function N3(D){D.command("check").description("Test connectivity and capabilities of a host").argument("<name>","Host to check").option("--json","Output result as JSON").action(async(u,F)=>{try{let E=await p(u);if(!E){if(F.json)console.log(JSON.stringify({ok:!1,error:`Host "${u}" not found`},null,2));else console.error(N.red(`Error: Host "${u}" not found`));process.exit(1)}let C=await n0(u);if(F.json)console.log(JSON.stringify(C,null,2));else if(console.log(Z8(C,E.ssh,E.root)),console.log(),C.ok)console.log(N.green(`Host "${u}" is ready.`));else console.log(N.red(`Host "${u}" check failed.`));if(!C.ok){if(!C.checks.ssh.ok)process.exit(2);process.exit(3)}}catch(E){if(E instanceof m){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(N.red(`Error: ${E.message}`));process.exit(E.code==="HOST_NOT_FOUND"?1:1)}throw E}})}function R3(D){D.command("rm").description("Remove a host configuration").argument("<name>","Host to remove").option("-y, --yes","Skip confirmation prompt").option("--json","Output result as JSON").action(async(u,F)=>{let E=await p(u);if(!E){if(F.json)console.log(JSON.stringify({ok:!1,error:`Host "${u}" not found`},null,2));else console.error(N.red(`Error: Host "${u}" not found`));process.exit(1)}try{if(!F.yes&&!F.json){if(!await AD({message:`Remove host "${u}" (${E.ssh})?`,default:!1})){console.log(N.dim("Cancelled."));return}}}catch(B){if(B instanceof FD)console.log(N.dim(`
57
- Cancelled.`)),process.exit(130);throw B}let C=await h0(u);if(F.json)console.log(JSON.stringify({ok:C,removed:u},null,2));else console.log(N.green(`Removed host "${u}"`))})}function t0(D){let u=D.command("host").description("Manage remote compute hosts");x3(u),J3(u),N3(u),R3(u)}async function _3(){try{let D=await Bun.$`git remote get-url origin`.quiet().nothrow();if(D.exitCode!==0)throw new G("GIT_ERROR","No git remote 'origin' found");return D.stdout.toString().trim()}catch(D){if(D instanceof G)throw D;throw new G("NOT_IN_GIT_REPO","Not inside a git repository")}}async function T3(){let D=await Bun.$`git rev-parse HEAD`.quiet().nothrow();if(D.exitCode!==0)throw new G("GIT_ERROR","Failed to resolve HEAD");return D.stdout.toString().trim()}async function yu(){let D=await Bun.$`git rev-parse --show-toplevel`.quiet().nothrow();if(D.exitCode!==0)throw new G("NOT_IN_GIT_REPO","Not inside a git repository");return D.stdout.toString().trim()}async function Pu(){return(await Bun.$`git rev-parse --is-inside-work-tree`.quiet().nothrow()).exitCode===0}async function vD(){let D=await Bun.$`git rev-parse --abbrev-ref HEAD`.quiet().nothrow();if(D.exitCode!==0)return null;let u=D.stdout.toString().trim();return u==="HEAD"?null:u}function ku(D){let u=D.replace(/\/+/g,"-").replace(/[^a-zA-Z0-9._-]/g,"-").replace(/-{2,}/g,"-").replace(/^-+|-+$/g,"");if(!u||u==="."||u==="..")return"sandbox";return u}function X3(D){try{let u=new URL(D);if(u.username||u.password)return u.username="",u.password="",u.toString();return D}catch{return D}}import{webcrypto as j3}from"crypto";var G3="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Y8=128,LD,mD;function M8(D){if(!LD||LD.length<D)LD=Buffer.allocUnsafe(D*Y8),j3.getRandomValues(LD),mD=0;else if(mD+D>LD.length)j3.getRandomValues(LD),mD=0;mD+=D}function O3(D=21){M8(D|=0);let u="";for(let F=mD-D;F<mD;F++)u+=G3[LD[F]&63];return u}function S3(){return O3(12)}async function z3(D){let u=D.replace(/\.git$/,"").toLowerCase().trim(),F=new TextEncoder().encode(u);return new Bun.CryptoHasher("sha256").update(F).digest("hex").slice(0,16)}class hu{async ensureLayout(D){await Bun.$`mkdir -p ${D}/mirrors ${D}/sandboxes ${D}/meta`.quiet()}async ensureMirror(D,u,F){let E=`${D}/mirrors/${u}.git`;if(!await Bun.file(`${E}/HEAD`).exists()){let $=await Bun.$`git clone --bare --mirror ${F} ${E}`.quiet().nothrow();if($.exitCode!==0)throw Error(`Failed to create mirror: ${$.stderr.toString().trim()}`)}else await Bun.$`git -C ${E} fetch --prune origin`.quiet().nothrow();let B=await yu();return await Bun.$`git -C ${E} fetch ${B} '+refs/heads/*:refs/heads/*'`.quiet().nothrow(),E}async createWorktree(D,u,F,E){let C=E?await Bun.$`git -C ${D} worktree add -B ${E} ${u}`.quiet().nothrow():await Bun.$`git -C ${D} worktree add --detach ${u} ${F}`.quiet().nothrow();if(C.exitCode!==0)throw Error(`Failed to create worktree: ${C.stderr.toString().trim()}`);await Bun.$`git -C ${u} config --unset remote.origin.mirror`.quiet().nothrow(),await Bun.$`git -C ${u} config remote.origin.push refs/heads/*:refs/heads/*`.quiet().nothrow()}async writeMeta(D,u,F){let E=`${D}/meta/${u}.json`;await Bun.write(E,JSON.stringify(F,null,2))}async removeSandboxDir(D){await Bun.$`rm -rf ${D}`.quiet().nothrow()}async pruneWorktrees(D){await Bun.$`git -C ${D} worktree prune`.quiet().nothrow()}async removeMeta(D,u){let F=`${D}/meta/${u}.json`;await Bun.$`rm -f ${F}`.quiet().nothrow()}async dirExists(D){return Bun.file(`${D}/.git`).exists()}async exec(D,u){let[F,...E]=u,C=await Bun.$`${F} ${E}`.cwd(D).quiet().nothrow();return{exitCode:C.exitCode,stdout:C.stdout.toString().trim(),stderr:C.stderr.toString().trim()}}async execStream(D,u){return Bun.spawn(u,{cwd:D,stdin:"inherit",stdout:"inherit",stderr:"inherit"}).exited}async execInteractive(D,u){let F=Bun.env.SHELL||"/bin/sh",C=await Bun.spawn([F,"-l"],{cwd:D,stdin:"inherit",stdout:"inherit",stderr:"inherit",env:{...process.env,...u}}).exited;process.exit(C)}async execTmux(D,u){let E=await Bun.spawn(["tmux","new-session","-A","-s",u,"-c",D],{stdin:"inherit",stdout:"inherit",stderr:"inherit"}).exited;process.exit(E)}async listTmuxSessions(){let D=await Bun.$`tmux ls -F '#{session_name}\t#{session_attached}'`.quiet().nothrow();if(D.exitCode!==0)return[];return D.stdout.toString().trim().split(`
58
- `).filter(Boolean).map((F)=>{let[E,C]=F.split("\t");return{name:E,attached:C==="1"}}).filter((F)=>F.name.startsWith("wt-"))}async copyEnvFiles(D,u){let F=new Bun.Glob(".env*");for await(let E of F.scan({cwd:D,onlyFiles:!0,dot:!0})){let C=Bun.file(`${D}/${E}`);await Bun.write(`${u}/${E}`,C)}}async checkGit(){let D=await Bun.$`git --version`.quiet().nothrow();if(D.exitCode!==0)return{name:"git",ok:!1,detail:"not found"};return{name:"git",ok:!0,detail:D.stdout.toString().trim()}}async checkTmux(){let D=await Bun.$`tmux -V`.quiet().nothrow();if(D.exitCode!==0)return{name:"tmux",ok:!1,detail:"not found"};return{name:"tmux",ok:!0,detail:D.stdout.toString().trim()}}async checkRuntime(){let D=await Bun.$`bun --version`.quiet().nothrow();if(D.exitCode===0)return{name:"bun",ok:!0,detail:D.stdout.toString().trim()};let u=await Bun.$`node --version`.quiet().nothrow();if(u.exitCode===0)return{name:"node",ok:!0,detail:u.stdout.toString().trim()};return{name:"runtime",ok:!1,detail:"neither bun nor node found"}}}function l0(D){let u=[];for(let F=0;F<D.length;F++){if(D[F]==="-o"&&D[F+1]?.startsWith("BatchMode")){F++;continue}u.push(D[F])}return u}class bu{host;constructor(D){this.host=D}get sshOpts(){return ND(this.host)}async ensureLayout(D){let u=["mirrors","sandboxes","meta"].map((E)=>M(`${D}/${E}`)).join(" "),F=await Q(this.sshOpts,`mkdir -p ${u}`);if(!F.ok)throw Error(`Failed to create remote layout: ${F.stderr}`)}async ensureMirror(D,u,F){let E=`${D}/mirrors/${u}.git`;if(!(await Q(this.sshOpts,`test -f ${M(E)}/HEAD`)).ok){let B=await Q(this.sshOpts,`git clone --bare --mirror ${M(F)} ${M(E)}`);if(!B.ok)throw Error(`Failed to create remote mirror: ${B.stderr}`)}else await Q(this.sshOpts,`git -C ${M(E)} fetch --prune origin`);return E}async createWorktree(D,u,F,E){let C=E?`git -C ${M(D)} worktree add -B ${M(E)} ${M(u)}`:`git -C ${M(D)} worktree add --detach ${M(u)} ${M(F)}`,B=await Q(this.sshOpts,C);if(!B.ok)throw Error(`Failed to create remote worktree: ${B.stderr}`);await Q(this.sshOpts,`git -C ${M(u)} config --unset remote.origin.mirror`),await Q(this.sshOpts,`git -C ${M(u)} config remote.origin.push refs/heads/*:refs/heads/*`)}async writeMeta(D,u,F){let E=`${D}/meta/${u}.json`,B=JSON.stringify(F,null,2).replace(/'/g,"'\\''"),$=await Q(this.sshOpts,`printf '%s' '${B}' > ${M(E)}`);if(!$.ok)throw Error(`Failed to write remote meta: ${$.stderr}`)}async removeSandboxDir(D){await Q(this.sshOpts,`rm -rf ${M(D)}`)}async pruneWorktrees(D){await Q(this.sshOpts,`git -C ${M(D)} worktree prune`)}async removeMeta(D,u){await Q(this.sshOpts,`rm -f ${M(`${D}/meta/${u}.json`)}`)}async dirExists(D){return(await Q(this.sshOpts,`test -d ${M(D)}`)).ok}async exec(D,u){let F=u.map((C)=>`'${C.replace(/'/g,"'\\''")}'`).join(" "),E=await Q(this.sshOpts,`cd ${M(D)} && ${F}`);return{exitCode:E.exitCode,stdout:E.stdout,stderr:E.stderr}}async execStream(D,u){let F=u.map(($)=>`'${$.replace(/'/g,"'\\''")}'`).join(" "),E=l0(bD(this.sshOpts)),C=`cd ${M(D)} && ${F}`;return Bun.spawn(["ssh","-t",...E,C],{stdin:"inherit",stdout:"inherit",stderr:"inherit"}).exited}async execInteractive(D,u){let F=l0(bD(this.sshOpts)),E=`cd ${M(D)} && exec $SHELL -l`,B=await Bun.spawn(["ssh","-t",...F,E],{stdin:"inherit",stdout:"inherit",stderr:"inherit",env:process.env}).exited;process.exit(B)}async execTmux(D,u){let F=l0(bD(this.sshOpts)),E=`cd ${M(D)} && tmux new-session -A -s ${M(u)}`,B=await Bun.spawn(["ssh","-t",...F,E],{stdin:"inherit",stdout:"inherit",stderr:"inherit",env:process.env}).exited;process.exit(B)}async listTmuxSessions(){let D=await Q(this.sshOpts,"tmux ls -F '#{session_name}\t#{session_attached}'");if(!D.ok)return[];return D.stdout.trim().split(`
59
- `).filter(Boolean).map((F)=>{let[E,C]=F.split("\t");return{name:E,attached:C==="1"}}).filter((F)=>F.name.startsWith("wt-"))}async copyEnvFiles(D,u){let F=new Bun.Glob(".env*"),E=[];for await(let A of F.scan({cwd:D,onlyFiles:!0,dot:!0}))E.push(A);if(E.length===0)return;let C=bD(this.sshOpts),B=C.pop(),$=[];for(let A=0;A<C.length;A++)if(C[A]==="-p")$.push("-P",C[A+1]),A++;else if(C[A]==="-i")$.push("-i",C[A+1]),A++;else if(C[A]==="-o")$.push("-o",C[A+1]),A++;for(let A of E){let R=`${D}/${A}`,x=`${B}:${u}/${A}`;await Bun.$`scp ${$} ${R} ${x}`.quiet().nothrow()}}async checkGit(){let D=await Q(this.sshOpts,"git --version");if(!D.ok)return{name:"git",ok:!1,detail:"not found"};return{name:"git",ok:!0,detail:D.stdout.trim()}}async checkTmux(){let D=await Q(this.sshOpts,"tmux -V");if(!D.ok)return{name:"tmux",ok:!1,detail:"not found"};return{name:"tmux",ok:!0,detail:D.stdout.trim()}}async checkRuntime(){let D=await Q(this.sshOpts,"bun --version");if(D.ok)return{name:"bun",ok:!0,detail:D.stdout.trim()};let u=await Q(this.sshOpts,"node --version");if(u.ok)return{name:"node",ok:!0,detail:u.stdout.trim()};return{name:"runtime",ok:!1,detail:"neither bun nor node found"}}}async function h(D){if(D===W)return new hu;let u=await p(D);if(!u)throw new G("HOST_NOT_FOUND",`Host "${D}" not found`);return new bu(u)}async function HD(D){if(D===W)return`${await yu()}/.wt`;let u=await p(D);if(!u)throw new G("HOST_NOT_FOUND",`Host "${D}" not found`);return u.root}async function r0(D){return(await a()).sandboxes[D]}async function I3(D){await e((u)=>{u.sandboxes[D.name]=D})}async function U3(){let D=await a();return Object.values(D.sandboxes).sort((u,F)=>u.name.localeCompare(F.name))}async function RD(D){let u=await r0(D);if(!u)throw new G("SANDBOX_NOT_FOUND",`Sandbox "${D}" not found`);return u}async function Z3(D,u){wu(u);let F=await e((E)=>{let C=E.sandboxes[D];if(!C)throw new G("SANDBOX_NOT_FOUND",`Sandbox "${D}" not found`);if(E.sandboxes[u])throw new G("SANDBOX_EXISTS",`Sandbox "${u}" already exists`);let B={...C,name:u};return delete E.sandboxes[D],E.sandboxes[u]=B,B});try{let E=await h(F.host),C=await HD(F.host);await E.writeMeta(C,F.id,F)}catch{}return F}async function vu(D){if(wu(D.name),D.ref)v0(D.ref);if(D.branch)v0(D.branch);let u=await _3(),F=await z3(u),E=!D.branch&&!D.ref?await vD():null,C=D.branch??E??void 0,B=C??D.ref??await T3(),$=await h(D.hostName),A=await HD(D.hostName),R=await r0(D.name);if(R){if(R.host===D.hostName&&R.repoId===F){if(await $.dirExists(R.path))return{entry:R,isIdempotent:!0}}throw new G("SANDBOX_EXISTS",`Sandbox "${D.name}" already exists (host=${R.host}, repoId=${R.repoId})`)}let x=S3(),H=`${A}/sandboxes/${D.name}`;try{await $.ensureLayout(A);let J=await $.ensureMirror(A,F,u);await $.createWorktree(J,H,B,C),await $.copyEnvFiles(process.cwd(),H);let T={name:D.name,id:x,host:D.hostName,origin:X3(u),repoId:F,ref:B,path:H,createdAt:new Date().toISOString()};return await $.writeMeta(A,x,T),await I3(T),{entry:T,isIdempotent:!1}}catch(J){if(J instanceof G)throw J;throw new G("CREATION_FAILED",J instanceof Error?J.message:String(J))}}async function gD(D){let u=await RD(D),F=await h(u.host);if(!await F.dirExists(u.path))throw new G("PATH_MISSING",`Sandbox path does not exist: ${u.path}`);return F.execInteractive(u.path,{WT_SANDBOX:u.name,WT_SANDBOX_ID:u.id})}async function nD(D){let u=await RD(D),F=await h(u.host);if(!await F.dirExists(u.path))throw new G("PATH_MISSING",`Sandbox path does not exist: ${u.path}`);if(!(await F.checkTmux()).ok)throw new G("CREATION_FAILED","tmux not found on host. Run: wt bootstrap --tmux --host <host>");let B=`wt-${u.id}`;return F.execTmux(u.path,B)}function mu(D,u){if(D.host===W)return`wt enter ${D.name}`;if(!u)return`wt enter ${D.name}`;let F=["ssh","-t"];if(u.port)F.push("-p",String(u.port));if(u.identity)F.push("-i",u.identity);return F.push(u.ssh,`'cd ${D.path} && exec $SHELL -l'`),F.join(" ")}function p0(D){D.command("up").description("Create a sandbox worktree on a host").argument("[name]","Sandbox name (defaults to branch name from -b/--ref or current branch)").option("-H, --host <hostName>","Target host (defaults to configured default)").option("-b, --branch <name>","Create or use a branch with this name").option("-r, --ref <ref>","Git ref to check out (branch, tag, or sha that must exist)").option("-e, --enter","Enter the sandbox after creating it").option("--tmux","Use tmux when entering (implies --enter)").option("--json","Output result as JSON").action(async(u,F)=>{try{if(!await Pu()){if(F.json)console.log(JSON.stringify({ok:!1,error:"Not inside a git repository"},null,2));else console.error(N.red("Error: Not inside a git repository"));process.exit(1)}if(F.branch&&F.ref){if(F.json)console.log(JSON.stringify({ok:!1,error:"Cannot use both --branch and --ref"},null,2));else console.error(N.red("Error: Cannot use both --branch and --ref"));process.exit(1)}let{ref:E,branch:C}=F,B=u;if(!B){let H=C??E??await vD();if(H)B=ku(H);else{if(F.json)console.log(JSON.stringify({ok:!1,error:"No name provided and could not determine branch name"},null,2));else console.error(N.red("Error: No name provided and could not determine branch name"));process.exit(1)}}let $;if(F.host){if($=F.host,$!==W){if(!await p($)){if(F.json)console.log(JSON.stringify({ok:!1,error:`Host "${$}" not found`},null,2));else console.error(N.red(`Error: Host "${$}" not found`));process.exit(1)}}}else $=(await WD())?.name??W;let A=await vu({name:B,hostName:$,ref:E,branch:C});if(F.json){console.log(JSON.stringify(A.entry,null,2));return}if(A.isIdempotent)console.log(N.dim(`Sandbox "${B}" already exists`));else console.log(N.green(`Created sandbox "${B}"`));if(F.enter||F.tmux){if(F.tmux)await nD(B);else await gD(B);return}let R=$!==W?await p($):void 0,x=mu(A.entry,R??void 0);if(process.stdout.isTTY)console.log(`Enter with: ${N.cyan(x)}`);else console.log(x)}catch(E){if(E instanceof G){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(N.red(`Error: ${E.message}`));process.exit(1)}throw E}})}function i0(D){D.command("local").description("Create a local sandbox worktree").argument("[name]","Sandbox name (defaults to branch name from -b/--ref or current branch)").option("-b, --branch <name>","Create or use a branch with this name").option("-r, --ref <ref>","Git ref to check out (branch, tag, or sha that must exist)").option("-e, --enter","Enter the sandbox after creating it").option("--tmux","Use tmux when entering (implies --enter)").option("--json","Output result as JSON").action(async(u,F)=>{try{if(!await Pu()){if(F.json)console.log(JSON.stringify({ok:!1,error:"Not inside a git repository"},null,2));else console.error(N.red("Error: Not inside a git repository"));process.exit(1)}if(F.branch&&F.ref){if(F.json)console.log(JSON.stringify({ok:!1,error:"Cannot use both --branch and --ref"},null,2));else console.error(N.red("Error: Cannot use both --branch and --ref"));process.exit(1)}let{ref:E,branch:C}=F,B=u;if(!B){let R=C??E??await vD();if(R)B=ku(R);else{if(F.json)console.log(JSON.stringify({ok:!1,error:"No name provided and could not determine branch name"},null,2));else console.error(N.red("Error: No name provided and could not determine branch name"));process.exit(1)}}let $=await vu({name:B,hostName:W,ref:E,branch:C});if(F.json){console.log(JSON.stringify($.entry,null,2));return}if($.isIdempotent)console.log(N.dim(`Sandbox "${B}" already exists`));else console.log(N.green(`Created sandbox "${B}"`));if(F.enter||F.tmux){if(F.tmux)await nD(B);else await gD(B);return}let A=mu($.entry);if(process.stdout.isTTY)console.log(`Enter with: ${N.cyan(A)}`);else console.log(A)}catch(E){if(E instanceof G){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(N.red(`Error: ${E.message}`));process.exit(1)}throw E}})}function o0(D){D.command("enter").description("Enter an existing sandbox").argument("<name>","Sandbox name").option("--json","Output sandbox record as JSON without entering").option("--tmux","Attach or create a tmux session in the sandbox").action(async(u,F)=>{try{if(F.json){let E=await RD(u);console.log(JSON.stringify(E,null,2));return}if(F.tmux)await nD(u);else await gD(u)}catch(E){if(E instanceof G){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(N.red(`Error: ${E.message}`));process.exit(1)}throw E}})}async function Y3(D,u,F){let E=await RD(D),C=await h(E.host);if(!await C.dirExists(E.path))throw new G("PATH_MISSING",`Sandbox path does not exist: ${E.path}`);if(F.capture){let A=await C.exec(E.path,u);return{name:E.name,id:E.id,host:E.host,path:E.path,command:u,exitCode:A.exitCode,stdout:A.stdout,stderr:A.stderr}}let $=await C.execStream(E.path,u);return{name:E.name,id:E.id,host:E.host,path:E.path,command:u,exitCode:$,stdout:"",stderr:""}}function a0(D){D.command("run").description("Run a command in a sandbox").argument("<name>","Sandbox name").argument("<cmd...>","Command to run").option("--json","Capture output and return as JSON").option("--quiet","Suppress non-error output").passThroughOptions().action(async(u,F,E)=>{try{let C=F[0]==="--"?F.slice(1):F;if(C.length===0)console.error(N.red("Error: No command specified")),process.exit(1);let B=await Y3(u,C,{capture:!!E.json});if(E.json)console.log(JSON.stringify(B,null,2)),process.exit(B.exitCode);process.exit(B.exitCode)}catch(C){if(C instanceof G){if(E.json)console.log(JSON.stringify({ok:!1,error:C.message},null,2));else if(!E.quiet)console.error(N.red(`Error: ${C.message}`));process.exit(1)}throw C}})}async function M3(D){let u=await h(D);if(!(await u.checkTmux()).ok)return{host:D,sessions:[],ok:!0,warnings:["tmux not installed"]};let E=await u.listTmuxSessions();return{host:D,sessions:E,ok:!0,warnings:[]}}function s0(D){D.command("sessions").description("List running tmux sessions for wt sandboxes").option("-H, --host <hostName>","Target host").option("--json","Output as JSON").action(async(u)=>{let F;if(u.host)F=u.host;else F=(await WD())?.name??W;let E=await M3(F);if(u.json){console.log(JSON.stringify(E,null,2));return}if(E.warnings.length>0)for(let C of E.warnings)console.error(N.yellow(`Warning: ${C}`));if(E.sessions.length===0){console.log(N.dim("No active sessions."));return}for(let C of E.sessions){let B=C.attached?N.green("attached"):N.dim("detached");console.log(`${C.name} ${B}`)}})}var K3=rD(Q3(),1);async function e0(D){let u=K3.default(D.olderThan);if(u===void 0||u<=0)throw Error(`Invalid duration: ${D.olderThan}`);let F=await a(),C=Date.now()-u,B=Object.values(F.sandboxes),$=D.hostName?B.filter((J)=>J.host===D.hostName):B,A=[],R=[],x=[],H=new Set;for(let J of $){let _=new Date(J.createdAt).getTime()<C;if(!_)try{if(!await(await h(J.host)).dirExists(J.path))_=!0}catch{_=!0}if(!_){R.push(J);continue}if(D.dryRun){A.push(J);continue}try{let X=await h(J.host),j=await HD(J.host);await X.removeSandboxDir(J.path),await X.removeMeta(j,J.id),H.add(`${J.host}:${j}/mirrors/${J.repoId}.git`),A.push(J)}catch(X){x.push({sandbox:J.name,error:X instanceof Error?X.message:String(X)})}}if(!D.dryRun&&A.length>0)await e((J)=>{for(let T of A)delete J.sandboxes[T.name]});if(!D.dryRun)for(let J of H){let[T,_]=J.split(":",2);try{await(await h(T)).pruneWorktrees(_)}catch{}}return{deleted:A,kept:R,errors:x}}function DF(D){D.command("gc").description("Remove stale sandboxes").option("-H, --host <hostName>","Target host (omit for all hosts)").option("--older-than <duration>","Age threshold (e.g. 7d, 24h, 1w)","7d").option("--dry-run","Show what would be deleted without deleting").option("-y, --yes","Skip confirmation prompt").option("--json","Output as JSON").action(async(u)=>{try{let F=await e0({hostName:u.host,olderThan:u.olderThan,dryRun:!0});if(u.json&&u.dryRun){console.log(JSON.stringify(F,null,2));return}if(F.deleted.length===0&&F.errors.length===0){if(u.json)console.log(JSON.stringify(F,null,2));else console.log(N.dim("Nothing to clean up."));return}if(u.dryRun){if(F.deleted.length>0){console.log(`Would delete ${F.deleted.length} sandbox(es)`);for(let C of F.deleted)console.log(` ${N.red("-")} ${C.name} (${C.host})`)}return}if(!u.json){console.log(`Found ${F.deleted.length} sandbox(es) to delete:`);for(let C of F.deleted)console.log(` ${N.red("-")} ${C.name} (${C.host})`)}if(!u.yes&&!u.json){if(!await AD({message:`Delete ${F.deleted.length} sandbox(es)?`,default:!1})){console.log(N.dim("Cancelled."));return}}let E=await e0({hostName:u.host,olderThan:u.olderThan,dryRun:!1});if(u.json){console.log(JSON.stringify(E,null,2));return}if(E.deleted.length>0)console.log(`Deleted ${E.deleted.length} sandbox(es)`);if(E.errors.length>0){for(let C of E.errors)console.error(N.red(`Error (${C.sandbox}): ${C.error}`));process.exit(1)}}catch(F){if(F instanceof FD)console.log(N.dim(`
60
- Cancelled.`)),process.exit(130);if(u.json)console.log(JSON.stringify({ok:!1,error:F instanceof Error?F.message:String(F)},null,2));else console.error(N.red(`Error: ${F instanceof Error?F.message:String(F)}`));process.exit(1)}})}async function W3(D){let u=[],F=[],E=[];if(D!==W){let x=await p(D);if(!x)return{ok:!1,host:D,checks:[{name:"host",ok:!1,detail:"not found in config"}],warnings:[],errors:[`Host "${D}" not found`]};let H=await Vu(ND(x)),J=H.ok?{name:"ssh",ok:!0,detail:"connected"}:{name:"ssh",ok:!1,detail:H.stderr||"connection failed"};if(u.push(J),!J.ok)return E.push(`SSH connection failed: ${J.detail}`),{ok:!1,host:D,checks:u,warnings:F,errors:E}}let C=await h(D),B=await C.checkGit();if(u.push(B),!B.ok)E.push(`git: ${B.detail}`);let $=await C.checkRuntime();if(u.push($),!$.ok)F.push(`runtime: ${$.detail}`);let A=await C.checkTmux();if(u.push(A),!A.ok)F.push(`tmux: ${A.detail}`);return{ok:u.every((x)=>x.ok||x.name==="tmux"||x.name==="runtime"),host:D,checks:u,warnings:F,errors:E}}function uF(D){D.command("doctor").description("Check system prerequisites and host health").option("-H, --host <hostName>","Target host").option("--json","Output as JSON").action(async(u)=>{let F;if(u.host)F=u.host;else F=(await WD())?.name??W;let E=await W3(F);if(u.json){console.log(JSON.stringify(E,null,2));return}for(let C of E.checks)if(C.ok)console.log(` ${N.green("\u2713")} ${C.name}${C.detail?` (${C.detail})`:""}`);else console.log(` ${N.red("\u2717")} ${C.name}${C.detail?`: ${C.detail}`:""}`);if(E.warnings.length>0)for(let C of E.warnings)console.log(` ${N.yellow("\u26A0")} ${C}`);if(console.log(),E.ok)console.log(N.green(`Host "${F}" is healthy.`));else console.log(N.red(`Host "${F}" has issues.`)),process.exit(1)})}var w8=/^[a-zA-Z0-9._-]+$/;async function V8(D){let u=await p(D);if(!u)return null;let F=ND(u);for(let E of["apt-get","apk","dnf","yum","brew"])if((await Q(F,`command -v ${M(E)}`)).ok)return E;return null}function f8(D,u){switch(u){case"apt-get":return`sudo apt-get install -y ${D}`;case"apk":return`sudo apk add ${D}`;case"dnf":return`sudo dnf install -y ${D}`;case"yum":return`sudo yum install -y ${D}`;case"brew":return`brew install ${D}`;default:return`install ${D} manually`}}async function L3(D){let u=[],F=[],E=[],C=D.hostName===W,B=await h(D.hostName),$=await B.checkGit();if(u.push($),!$.ok)F.push("git");let A=await B.checkRuntime();if(u.push(A),!A.ok)F.push("bun or node");if(D.tmux){let x=await B.checkTmux();if(u.push(x),!x.ok)F.push("tmux")}if(!C){let x=await p(D.hostName);if(!x)throw new G("HOST_NOT_FOUND",`Host "${D.hostName}" not found`);let H=ND(x);for(let J of["bash","curl"]){let _=(await Q(H,`command -v ${M(J)}`)).ok?{name:J,ok:!0}:{name:J,ok:!1,detail:"not found"};if(u.push(_),!_.ok)F.push(J)}for(let J of D.agents){if(!w8.test(J))throw new G("VALIDATION_ERROR",`Invalid agent name "${J}": must contain only alphanumeric characters, dots, underscores, or hyphens`);let _=(await Q(H,`command -v ${M(J)}`)).ok?{name:J,ok:!0}:{name:J,ok:!1,detail:"not found"};if(u.push(_),!_.ok)F.push(J)}if(F.length>0){let J=await V8(D.hostName);if(J)for(let T of F)if(T==="bun or node")E.push("curl -fsSL https://bun.sh/install | bash");else if(T==="claude"||T==="opencode")E.push(`npm install -g ${T}`);else E.push(f8(T,J));else E.push(`No package manager found. Install manually: ${F.join(", ")}`)}}else if(F.length>0)for(let x of F)if(x==="bun or node")E.push("curl -fsSL https://bun.sh/install | bash");else E.push(`Install ${x} using your system package manager`);try{let x=await HD(D.hostName);await B.ensureLayout(x),u.push({name:"layout",ok:!0})}catch(x){u.push({name:"layout",ok:!1,detail:x instanceof Error?x.message:String(x)})}let R=F.length===0&&u.every((x)=>x.ok);return{host:D.hostName,ok:R,checks:u,missing:F,instructions:E}}function FF(D){D.command("bootstrap").description("Check host readiness and report missing packages").requiredOption("-H, --host <hostName>","Target host").option("--tmux","Include tmux in checks").option("--agents <list>","Comma-separated agent CLIs to check (e.g. claude,opencode)").option("--json","Output as JSON").action(async(u)=>{try{let F=u.agents?u.agents.split(",").map((C)=>C.trim()).filter(Boolean):[],E=await L3({hostName:u.host,tmux:!!u.tmux,agents:F});if(u.json){if(console.log(JSON.stringify(E,null,2)),!E.ok)process.exit(1);return}for(let C of E.checks)if(C.ok)console.log(` ${N.green("\u2713")} ${C.name}${C.detail?` (${C.detail})`:""}`);else console.log(` ${N.red("\u2717")} ${C.name}${C.detail?`: ${C.detail}`:""}`);if(E.missing.length>0)console.log(),console.log(N.yellow(`Missing: ${E.missing.join(", ")}`));if(E.instructions.length>0){console.log(),console.log(N.dim("Install instructions:"));for(let C of E.instructions)console.log(` ${C}`)}if(console.log(),E.ok)console.log(N.green(`Host "${u.host}" is ready.`));else console.log(N.red(`Host "${u.host}" is not ready.`)),process.exit(1)}catch(F){if(F instanceof G){if(u.json)console.log(JSON.stringify({ok:!1,error:F.message},null,2));else console.error(N.red(`Error: ${F.message}`));process.exit(1)}throw F}})}async function w3(D){let u=await U3(),F=D.hostName?u.filter((E)=>E.host===D.hostName):u;return{sandboxes:F,total:F.length}}function EF(D){D.command("ls").description("List sandboxes").option("-H, --host <hostName>","Filter by host").option("--json","Output as JSON").action(async(u)=>{try{let F=await w3({hostName:u.host});if(u.json){console.log(JSON.stringify(F,null,2));return}if(F.total===0){console.log(N.dim("No sandboxes found."));return}let E=Math.max(...F.sandboxes.map((A)=>A.name.length),4),C=Math.max(...F.sandboxes.map((A)=>A.host.length),4),B=(A,R=20)=>A.length>R?A.substring(0,R-3)+"...":A,$=Math.max(...F.sandboxes.map((A)=>B(A.ref).length),3);console.log(N.bold(`${"NAME".padEnd(E)} ${"HOST".padEnd(C)} ${"REF".padEnd($)} CREATED`));for(let A of F.sandboxes){let R=B(A.ref),x=new Date(A.createdAt).toLocaleDateString();console.log(`${N.cyan(A.name.padEnd(E))} ${A.host.padEnd(C)} ${N.yellow(R.padEnd($))} ${N.dim(x)}`)}console.log(N.dim(`
61
- ${F.total} sandbox(es)`))}catch(F){if(u.json)console.log(JSON.stringify({ok:!1,error:F instanceof Error?F.message:String(F)},null,2));else console.error(N.red(`Error: ${F instanceof Error?F.message:String(F)}`));process.exit(1)}})}async function V3(D){let F=(await a()).sandboxes[D];if(!F)throw new G("SANDBOX_NOT_FOUND",`Sandbox "${D}" not found`);let E=await h(F.host),C=await HD(F.host),B={dir:!1,meta:!1,config:!1};try{await E.removeSandboxDir(F.path),B.dir=!0}catch{}try{await E.removeMeta(C,F.id),B.meta=!0}catch{}await e(($)=>{delete $.sandboxes[D]}),B.config=!0;try{let $=`${C}/mirrors/${F.repoId}.git`;await E.pruneWorktrees($)}catch{}return{entry:F,cleaned:B}}function CF(D){D.command("rm").description("Remove a sandbox").argument("<name>","Sandbox name").option("-y, --yes","Skip confirmation prompt").option("--json","Output as JSON").action(async(u,F)=>{try{if(!F.yes&&!F.json){if(!await AD({message:`Remove sandbox "${u}"?`,default:!1})){console.log(N.dim("Cancelled."));return}}let E=await V3(u);if(F.json){console.log(JSON.stringify(E,null,2));return}console.log(`Removed sandbox ${N.cyan(E.entry.name)}`);let C=[];if(!E.cleaned.dir)C.push("directory");if(!E.cleaned.meta)C.push("metadata");if(C.length>0)console.log(N.yellow(` Warning: could not clean ${C.join(", ")}`))}catch(E){if(E instanceof FD)console.log(N.dim(`
62
- Cancelled.`)),process.exit(130);if(E instanceof G){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(N.red(`Error: ${E.message}`));process.exit(1)}throw E}})}function y8(D){let u=Date.now()-new Date(D).getTime(),F=Math.floor(u/1000);if(F<60)return`${F}s`;let E=Math.floor(F/60);if(E<60)return`${E}m`;let C=Math.floor(E/60);if(C<24)return`${C}h`;return`${Math.floor(C/24)}d`}async function f3(D){let u=await RD(D),F=await h(u.host),E=!1;try{E=await F.dirExists(u.path)}catch{}let C=null;try{let B=await F.listTmuxSessions(),$=`wt-${u.id}`,A=B.find((R)=>R.name===$);if(A)C=A.name}catch{}return{entry:u,dirExists:E,tmuxSession:C,age:y8(u.createdAt)}}function BF(D){D.command("status").description("Show sandbox status").argument("<name>","Sandbox name").option("--json","Output as JSON").action(async(u,F)=>{try{let E=await f3(u);if(F.json){console.log(JSON.stringify(E,null,2));return}let{entry:C,dirExists:B,tmuxSession:$,age:A}=E;console.log(N.bold(C.name)),console.log(` ${"ID".padEnd(10)} ${N.dim(C.id)}`),console.log(` ${"Host".padEnd(10)} ${C.host}`),console.log(` ${"Ref".padEnd(10)} ${N.yellow(C.ref.substring(0,8))}`),console.log(` ${"Origin".padEnd(10)} ${N.dim(C.origin)}`),console.log(` ${"Path".padEnd(10)} ${C.path}`),console.log(` ${"Age".padEnd(10)} ${A}`);let R=B?N.green("exists"):N.red("missing");console.log(` ${"Dir".padEnd(10)} ${R}`);let x=$?N.green($):N.dim("none");console.log(` ${"Tmux".padEnd(10)} ${x}`)}catch(E){if(E instanceof G){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(N.red(`Error: ${E.message}`));process.exit(1)}throw E}})}function $F(D){D.command("rename").description("Rename a sandbox").argument("<old>","Current sandbox name").argument("<new>","New sandbox name").option("--json","Output result as JSON").action(async(u,F,E)=>{try{let C=await Z3(u,F);if(E.json){console.log(JSON.stringify(C,null,2));return}console.log(N.green(`Renamed "${u}" -> "${F}"`))}catch(C){if(C instanceof G){if(E.json)console.log(JSON.stringify({ok:!1,error:C.message},null,2));else console.error(N.red(`Error: ${C.message}`));process.exit(1)}throw C}})}var i=new MF,y3="0.0.6";function P8(D,u=""){let F=[],E=D.name(),C=D.registeredArguments.map((A)=>A.required?`<${A.name()}>`:`[${A.name()}]`).join(" "),B=C?`${E} ${C}`:E;F.push(`${u}${B}`);let $=D.commands.filter((A)=>A.name()!=="help");return $.forEach((A,R)=>{let x=R===$.length-1,H=x?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",J=u+(x?" ":"\u2502 "),T=A.name(),_=A.registeredArguments.map((O)=>O.required?`<${O.name()}>`:`[${O.name()}]`).join(" "),X=_?`${T} ${_}`:T,j=A.commands.filter((O)=>O.name()!=="help");if(j.length>0)F.push(`${u}${H}${X}`),j.forEach((O,I)=>{let z=I===j.length-1?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",d=O.name(),DD=O.registeredArguments.map((lD)=>lD.required?`<${lD.name()}>`:`[${lD.name()}]`).join(" "),_D=DD?`${d} ${DD}`:d;F.push(`${J}${z}${_D}`)});else F.push(`${u}${H}${X}`)}),F}i.name("wt").enablePositionalOptions().description("Run worktrees, coding agents, and more all from the cloud. SSH included, agents too!").version(y3,"-v, --version").option("--tree","Show command tree").action((D)=>{if(D.tree){console.log(P8(i).join(`
56
+ `));let D=await xu({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 xu({message:"SSH target (alias or user@host):",validate:(B)=>B?!0:"SSH target is required"}),F=await xu({message:"Remote base directory:",default:"~/.wt",validate:(B)=>{if(!B)return"Root path is required";if(!B.startsWith("/")&&!B.startsWith("~/"))return"Must be an absolute path (start with / or ~/)";return!0}}),E=await $D({message:"Set as default host?",default:!0}),C=await $D({message:"Run connectivity check?",default:!0});return{name:D,ssh:u,root:F,setDefault:E,skipCheck:!C,runCheck:C}}function O3(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 bC();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:l0(F.labels)};if(!E.skipCheck&&!F.json)console.log(`
57
+ Checking ${E.name} (${E.ssh}:${E.root})...`);let B=await o0(E);if(F.json)console.log(JSON.stringify(B,null,2));else{if(B.checkResult)console.log(hC(B.checkResult)),console.log();let x=E.setDefault?N.dim(" (default)"):"",$=B.action==="created"?"Added":"Updated";if(B.checkResult?.ok===!1)console.log(N.yellow(`${$} host "${B.host.name}"${x}, but check failed.`));else console.log(N.green(`${$} host "${B.host.name}"${x}`))}if(B.checkResult&&!B.checkResult.ok)process.exit(2)}catch(E){if(E instanceof FD)console.log(N.dim(`
58
+ Cancelled.`)),process.exit(130);if(E instanceof m){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(N.red(`Error: ${E.message}`));process.exit(E.code==="VALIDATION_ERROR"?1:1)}throw E}})}function vC(D){switch(D){case"ok":return N.green("ok");case"error":return N.red("error");default:return N.dim("unchecked")}}function jD(D,u){return D.padEnd(u)}function X3(D){D.command("ls").description("List all configured hosts").option("--json","Output as JSON").action(async(u)=>{let F=await a0();if(u.json){console.log(JSON.stringify(F,null,2));return}if(F.hosts.length===0){console.log(N.dim("No hosts configured. Run `wt host add` to add one."));return}let E=Math.max(4,...F.hosts.map((x)=>x.name.length))+2,C=Math.max(3,...F.hosts.map((x)=>x.ssh.length))+2,B=Math.max(4,...F.hosts.map((x)=>x.root.length))+2;console.log(N.bold(jD("NAME",E)+jD("SSH",C)+jD("ROOT",B)+jD("DEFAULT",9)+"STATUS"));for(let x of F.hosts){let R=x.name===F.defaultHost?N.cyan("*"):N.dim("-");console.log(jD(x.name,E)+jD(x.ssh,C)+jD(x.root,B)+jD(R,9)+vC(x.lastStatus))}})}function mC(D,u,F){let E=[];if(E.push(`Checking ${D.host} (${u}:${F})...`),D.checks.ssh.ok)E.push(` ${N.green("\u2713")} SSH connection`);else E.push(` ${N.red("\u2717")} SSH connection: ${D.checks.ssh.error}`);if(D.checks.ssh.ok){if(D.checks.directories.ok)E.push(` ${N.green("\u2713")} Directory structure`);else E.push(` ${N.red("\u2717")} Directory structure: ${D.checks.directories.error||"failed"}`);if(D.checks.git.ok)E.push(` ${N.green("\u2713")} git ${D.checks.git.version}`);else E.push(` ${N.red("\u2717")} git: ${D.checks.git.error||"not found"}`);if(D.checks.node.ok)E.push(` ${N.green("\u2713")} node ${D.checks.node.version}`);else E.push(` ${N.yellow("\u26A0")} node not found (optional)`)}return E.join(`
59
+ `)}function I3(D){D.command("check").description("Test connectivity and capabilities of a host").argument("<name>","Host to check").option("--json","Output result as JSON").action(async(u,F)=>{try{let E=await p(u);if(!E){if(F.json)console.log(JSON.stringify({ok:!1,error:`Host "${u}" not found`},null,2));else console.error(N.red(`Error: Host "${u}" not found`));process.exit(1)}let C=await p0(u);if(F.json)console.log(JSON.stringify(C,null,2));else if(console.log(mC(C,E.ssh,E.root)),console.log(),C.ok)console.log(N.green(`Host "${u}" is ready.`));else console.log(N.red(`Host "${u}" check failed.`));if(!C.ok){if(!C.checks.ssh.ok)process.exit(2);process.exit(3)}}catch(E){if(E instanceof m){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(N.red(`Error: ${E.message}`));process.exit(E.code==="HOST_NOT_FOUND"?1:1)}throw E}})}function j3(D){D.command("rm").description("Remove a host configuration").argument("<name>","Host to remove").option("-y, --yes","Skip confirmation prompt").option("--json","Output result as JSON").action(async(u,F)=>{let E=await p(u);if(!E){if(F.json)console.log(JSON.stringify({ok:!1,error:`Host "${u}" not found`},null,2));else console.error(N.red(`Error: Host "${u}" not found`));process.exit(1)}try{if(!F.yes&&!F.json){if(!await $D({message:`Remove host "${u}" (${E.ssh})?`,default:!1})){console.log(N.dim("Cancelled."));return}}}catch(B){if(B instanceof FD)console.log(N.dim(`
60
+ Cancelled.`)),process.exit(130);throw B}let C=await c0(u);if(F.json)console.log(JSON.stringify({ok:C,removed:u},null,2));else console.log(N.green(`Removed host "${u}"`))})}function s0(D){let u=D.command("host").description("Manage remote compute hosts");O3(u),X3(u),I3(u),j3(u)}var m3=PD(K3(),1);async function W3(){try{let D=await Bun.$`git remote get-url origin`.quiet().nothrow();if(D.exitCode!==0)throw new X("GIT_ERROR","No git remote 'origin' found");return D.stdout.toString().trim()}catch(D){if(D instanceof X)throw D;throw new X("NOT_IN_GIT_REPO","Not inside a git repository")}}async function w3(){let D=await Bun.$`git rev-parse HEAD`.quiet().nothrow();if(D.exitCode!==0)throw new X("GIT_ERROR","Failed to resolve HEAD");return D.stdout.toString().trim()}async function gu(){let D=await Bun.$`git rev-parse --show-toplevel`.quiet().nothrow();if(D.exitCode!==0)throw new X("NOT_IN_GIT_REPO","Not inside a git repository");return D.stdout.toString().trim()}async function nu(){return(await Bun.$`git rev-parse --is-inside-work-tree`.quiet().nothrow()).exitCode===0}async function dD(){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 du(D){let u=D.replace(/\/+/g,"-").replace(/[^a-zA-Z0-9._-]/g,"-").replace(/-{2,}/g,"-").replace(/^-+|-+$/g,"");if(!u||u==="."||u==="..")return"sandbox";return u}function L3(D){try{let u=new URL(D);if(u.username||u.password)return u.username="",u.password="",u.toString();return D}catch{return D}}import{webcrypto as V3}from"crypto";var f3="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var oC=128,VD,cD;function aC(D){if(!VD||VD.length<D)VD=Buffer.allocUnsafe(D*oC),V3.getRandomValues(VD),cD=0;else if(cD+D>VD.length)V3.getRandomValues(VD),cD=0;cD+=D}function y3(D=21){aC(D|=0);let u="";for(let F=cD-D;F<cD;F++)u+=f3[VD[F]&63];return u}function P3(){return y3(12)}async function k3(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 cu{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 x=await Bun.$`git clone --bare --mirror ${F} ${E}`.quiet().nothrow();if(x.exitCode!==0)throw Error(`Failed to create mirror: ${x.stderr.toString().trim()}`)}else await Bun.$`git -C ${E} fetch --prune origin`.quiet().nothrow();let B=await gu();return await Bun.$`git -C ${E} fetch ${B} '+refs/heads/*:refs/heads/*'`.quiet().nothrow(),E}async createWorktree(D,u,F,E){let C=E?await Bun.$`git -C ${D} worktree add -B ${E} ${u}`.quiet().nothrow():await Bun.$`git -C ${D} worktree add --detach ${u} ${F}`.quiet().nothrow();if(C.exitCode!==0)throw Error(`Failed to create worktree: ${C.stderr.toString().trim()}`);await Bun.$`git -C ${u} config --unset remote.origin.mirror`.quiet().nothrow(),await Bun.$`git -C ${u} config remote.origin.push refs/heads/*:refs/heads/*`.quiet().nothrow()}async writeMeta(D,u,F){let E=`${D}/meta/${u}.json`;await Bun.write(E,JSON.stringify(F,null,2))}async removeSandboxDir(D){await Bun.$`rm -rf ${D}`.quiet().nothrow()}async pruneWorktrees(D){await Bun.$`git -C ${D} worktree prune`.quiet().nothrow()}async removeMeta(D,u){let F=`${D}/meta/${u}.json`;await Bun.$`rm -f ${F}`.quiet().nothrow()}async dirExists(D){return Bun.file(`${D}/.git`).exists()}async exec(D,u){let[F,...E]=u,C=await Bun.$`${F} ${E}`.cwd(D).quiet().nothrow();return{exitCode:C.exitCode,stdout:C.stdout.toString().trim(),stderr:C.stderr.toString().trim()}}async execStream(D,u){return Bun.spawn(u,{cwd:D,stdin:"inherit",stdout:"inherit",stderr:"inherit"}).exited}async execInteractive(D,u){let F=Bun.env.SHELL||"/bin/sh",C=await Bun.spawn([F,"-l"],{cwd:D,stdin:"inherit",stdout:"inherit",stderr:"inherit",env:{...process.env,...u}}).exited;process.exit(C)}async execTmux(D,u){let E=await Bun.spawn(["tmux","new-session","-A","-s",u,"-c",D],{stdin:"inherit",stdout:"inherit",stderr:"inherit"}).exited;process.exit(E)}async listTmuxSessions(){let D=await Bun.$`tmux ls -F '#{session_name}\t#{session_attached}'`.quiet().nothrow();if(D.exitCode!==0)return[];return D.stdout.toString().trim().split(`
61
+ `).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 DF(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 tu{host;constructor(D){this.host=D}get sshOpts(){return TD(this.host)}async ensureLayout(D){let u=["mirrors","sandboxes","meta"].map((E)=>M(`${D}/${E}`)).join(" "),F=await Q(this.sshOpts,`mkdir -p ${u}`);if(!F.ok)throw Error(`Failed to create remote layout: ${F.stderr}`)}async ensureMirror(D,u,F){let E=`${D}/mirrors/${u}.git`;if(!(await Q(this.sshOpts,`test -f ${M(E)}/HEAD`)).ok){let B=await Q(this.sshOpts,`git clone --bare --mirror ${M(F)} ${M(E)}`);if(!B.ok)throw Error(`Failed to create remote mirror: ${B.stderr}`)}else await Q(this.sshOpts,`git -C ${M(E)} fetch --prune origin`);return E}async createWorktree(D,u,F,E){let C=E?`git -C ${M(D)} worktree add -B ${M(E)} ${M(u)}`:`git -C ${M(D)} worktree add --detach ${M(u)} ${M(F)}`,B=await Q(this.sshOpts,C);if(!B.ok)throw Error(`Failed to create remote worktree: ${B.stderr}`);await Q(this.sshOpts,`git -C ${M(u)} config --unset remote.origin.mirror`),await Q(this.sshOpts,`git -C ${M(u)} config remote.origin.push refs/heads/*:refs/heads/*`)}async writeMeta(D,u,F){let E=`${D}/meta/${u}.json`,B=JSON.stringify(F,null,2).replace(/'/g,"'\\''"),x=await Q(this.sshOpts,`printf '%s' '${B}' > ${M(E)}`);if(!x.ok)throw Error(`Failed to write remote meta: ${x.stderr}`)}async removeSandboxDir(D){await Q(this.sshOpts,`rm -rf ${M(D)}`)}async pruneWorktrees(D){await Q(this.sshOpts,`git -C ${M(D)} worktree prune`)}async removeMeta(D,u){await Q(this.sshOpts,`rm -f ${M(`${D}/meta/${u}.json`)}`)}async dirExists(D){return(await Q(this.sshOpts,`test -d ${M(D)}`)).ok}async exec(D,u){let F=u.map((C)=>`'${C.replace(/'/g,"'\\''")}'`).join(" "),E=await Q(this.sshOpts,`cd ${M(D)} && ${F}`);return{exitCode:E.exitCode,stdout:E.stdout,stderr:E.stderr}}async execStream(D,u){let F=u.map((x)=>`'${x.replace(/'/g,"'\\''")}'`).join(" "),E=DF(nD(this.sshOpts)),C=`cd ${M(D)} && ${F}`;return Bun.spawn(["ssh","-t",...E,C],{stdin:"inherit",stdout:"inherit",stderr:"inherit"}).exited}async execInteractive(D,u){let F=DF(nD(this.sshOpts)),E=`cd ${M(D)} && exec $SHELL -l`,B=await Bun.spawn(["ssh","-t",...F,E],{stdin:"inherit",stdout:"inherit",stderr:"inherit",env:process.env}).exited;process.exit(B)}async execTmux(D,u){let F=DF(nD(this.sshOpts)),E=`cd ${M(D)} && tmux new-session -A -s ${M(u)}`,B=await Bun.spawn(["ssh","-t",...F,E],{stdin:"inherit",stdout:"inherit",stderr:"inherit",env:process.env}).exited;process.exit(B)}async listTmuxSessions(){let D=await Q(this.sshOpts,"tmux ls -F '#{session_name}\t#{session_attached}'");if(!D.ok)return[];return D.stdout.trim().split(`
62
+ `).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 $ of F.scan({cwd:D,onlyFiles:!0,dot:!0}))E.push($);if(E.length===0)return;let C=nD(this.sshOpts),B=C.pop(),x=[];for(let $=0;$<C.length;$++)if(C[$]==="-p")x.push("-P",C[$+1]),$++;else if(C[$]==="-i")x.push("-i",C[$+1]),$++;else if(C[$]==="-o")x.push("-o",C[$+1]),$++;for(let $ of E){let R=`${D}/${$}`,H=`${B}:${u}/${$}`;await Bun.$`scp ${x} ${R} ${H}`.quiet().nothrow()}}async checkGit(){let D=await Q(this.sshOpts,"git --version");if(!D.ok)return{name:"git",ok:!1,detail:"not found"};return{name:"git",ok:!0,detail:D.stdout.trim()}}async checkTmux(){let D=await Q(this.sshOpts,"tmux -V");if(!D.ok)return{name:"tmux",ok:!1,detail:"not found"};return{name:"tmux",ok:!0,detail:D.stdout.trim()}}async checkRuntime(){let D=await Q(this.sshOpts,"bun --version");if(D.ok)return{name:"bun",ok:!0,detail:D.stdout.trim()};let u=await Q(this.sshOpts,"node --version");if(u.ok)return{name:"node",ok:!0,detail:u.stdout.trim()};return{name:"runtime",ok:!1,detail:"neither bun nor node found"}}}async function b(D){if(D===W)return new cu;let u=await p(D);if(!u)throw new X("HOST_NOT_FOUND",`Host "${D}" not found`);return new tu(u)}async function JD(D){if(D===W)return`${await gu()}/.wt`;let u=await p(D);if(!u)throw new X("HOST_NOT_FOUND",`Host "${D}" not found`);return u.root}async function uF(D){return(await a()).sandboxes[D]}async function h3(D){await DD((u)=>{u.sandboxes[D.name]=D})}async function b3(){let D=await a();return Object.values(D.sandboxes).sort((u,F)=>u.name.localeCompare(F.name))}async function GD(D){let u=await uF(D);if(!u)throw new X("SANDBOX_NOT_FOUND",`Sandbox "${D}" not found`);return u}async function v3(D,u){ku(u);let F=await DD((E)=>{let C=E.sandboxes[D];if(!C)throw new X("SANDBOX_NOT_FOUND",`Sandbox "${D}" not found`);if(E.sandboxes[u])throw new X("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 b(F.host),C=await JD(F.host);await E.writeMeta(C,F.id,F)}catch{}return F}async function ru(D){if(ku(D.name),D.ref)r0(D.ref);if(D.branch)r0(D.branch);let u=await W3(),F=await k3(u),E=!D.branch&&!D.ref?await dD():null,C=D.branch??E??void 0,B=C??D.ref??await w3(),x=await b(D.hostName),$=await JD(D.hostName),R=await uF(D.name);if(R){if(R.host===D.hostName&&R.repoId===F){if(await x.dirExists(R.path))return{entry:R,isIdempotent:!0}}throw new X("SANDBOX_EXISTS",`Sandbox "${D.name}" already exists (host=${R.host}, repoId=${R.repoId})`)}let H=P3(),A=`${$}/sandboxes/${D.name}`;try{await x.ensureLayout($);let J=await x.ensureMirror($,F,u);await x.createWorktree(J,A,B,C),await x.copyEnvFiles(process.cwd(),A);let S={name:D.name,id:H,host:D.hostName,origin:L3(u),repoId:F,ref:B,path:A,createdAt:new Date().toISOString()};return await x.writeMeta($,H,S),await h3(S),{entry:S,isIdempotent:!1}}catch(J){if(J instanceof X)throw J;throw new X("CREATION_FAILED",J instanceof Error?J.message:String(J))}}async function tD(D){let u=await GD(D),F=await b(u.host);if(!await F.dirExists(u.path))throw new X("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 rD(D){let u=await GD(D),F=await b(u.host);if(!await F.dirExists(u.path))throw new X("PATH_MISSING",`Sandbox path does not exist: ${u.path}`);if(!(await F.checkTmux()).ok)throw new X("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 lu(D,u){if(D.host===W)return`wt enter ${D.name}`;if(!u)return`wt enter ${D.name}`;let F=["ssh","-t"];if(u.port)F.push("-p",String(u.port));if(u.identity)F.push("-i",u.identity);return F.push(u.ssh,`'cd ${D.path} && exec $SHELL -l'`),F.join(" ")}function FF(D){D.command("up").description("Create a sandbox worktree on a host").argument("[name]","Sandbox name (defaults to branch name from -b/--ref or current branch)").option("-H, --host <hostName>","Target host (defaults to configured default)").option("-b, --branch <name>","Create or use a branch with this name").option("-r, --ref <ref>","Git ref to check out (branch, tag, or sha that must exist)").option("-e, --enter","Enter the sandbox after creating it").option("--tmux","Use tmux when entering (implies --enter)").option("--json","Output result as JSON").action(async(u,F)=>{let E=null;try{if(!await nu()){if(F.json)console.log(JSON.stringify({ok:!1,error:"Not inside a git repository"},null,2));else console.error(N.red("Error: Not inside a git repository"));process.exit(1)}if(F.branch&&F.ref){if(F.json)console.log(JSON.stringify({ok:!1,error:"Cannot use both --branch and --ref"},null,2));else console.error(N.red("Error: Cannot use both --branch and --ref"));process.exit(1)}let{ref:C,branch:B}=F,x=u;if(!x){let J=B??C??await dD();if(J)x=du(J);else{if(F.json)console.log(JSON.stringify({ok:!1,error:"No name provided and could not determine branch name"},null,2));else console.error(N.red("Error: No name provided and could not determine branch name"));process.exit(1)}}let $;if(F.host){if($=F.host,$!==W){if(!await p($)){if(F.json)console.log(JSON.stringify({ok:!1,error:`Host "${$}" not found`},null,2));else console.error(N.red(`Error: Host "${$}" not found`));process.exit(1)}}}else $=(await fD())?.name??W;if(!F.json)E=m3.createSpinner(`Creating sandbox "${x}"...`).start();let R=await ru({name:x,hostName:$,ref:C,branch:B});if(F.json){console.log(JSON.stringify(R.entry,null,2));return}if(R.isIdempotent)E?.success({text:N.dim(`Sandbox "${x}" already exists`)});else E?.success({text:N.green(`Created sandbox "${x}"`)});if(F.enter||F.tmux){if(F.tmux)await rD(x);else await tD(x);return}let H=$!==W?await p($):void 0,A=lu(R.entry,H??void 0);if(process.stdout.isTTY)console.log(`Enter with: ${N.cyan(A)}`);else console.log(A)}catch(C){if(C instanceof X){if(F.json)console.log(JSON.stringify({ok:!1,error:C.message},null,2));else if(E)E.error({text:N.red(`Error: ${C.message}`)});else console.error(N.red(`Error: ${C.message}`));process.exit(1)}throw C}})}function EF(D){D.command("local").description("Create a local sandbox worktree").argument("[name]","Sandbox name (defaults to branch name from -b/--ref or current branch)").option("-b, --branch <name>","Create or use a branch with this name").option("-r, --ref <ref>","Git ref to check out (branch, tag, or sha that must exist)").option("-e, --enter","Enter the sandbox after creating it").option("--tmux","Use tmux when entering (implies --enter)").option("--json","Output result as JSON").action(async(u,F)=>{try{if(!await nu()){if(F.json)console.log(JSON.stringify({ok:!1,error:"Not inside a git repository"},null,2));else console.error(N.red("Error: Not inside a git repository"));process.exit(1)}if(F.branch&&F.ref){if(F.json)console.log(JSON.stringify({ok:!1,error:"Cannot use both --branch and --ref"},null,2));else console.error(N.red("Error: Cannot use both --branch and --ref"));process.exit(1)}let{ref:E,branch:C}=F,B=u;if(!B){let R=C??E??await dD();if(R)B=du(R);else{if(F.json)console.log(JSON.stringify({ok:!1,error:"No name provided and could not determine branch name"},null,2));else console.error(N.red("Error: No name provided and could not determine branch name"));process.exit(1)}}let x=await ru({name:B,hostName:W,ref:E,branch:C});if(F.json){console.log(JSON.stringify(x.entry,null,2));return}if(x.isIdempotent)console.log(N.dim(`Sandbox "${B}" already exists`));else console.log(N.green(`Created sandbox "${B}"`));if(F.enter||F.tmux){if(F.tmux)await rD(B);else await tD(B);return}let $=lu(x.entry);if(process.stdout.isTTY)console.log(`Enter with: ${N.cyan($)}`);else console.log($)}catch(E){if(E instanceof X){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(N.red(`Error: ${E.message}`));process.exit(1)}throw E}})}function CF(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 GD(u);console.log(JSON.stringify(E,null,2));return}if(F.tmux)await rD(u);else await tD(u)}catch(E){if(E instanceof X){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(N.red(`Error: ${E.message}`));process.exit(1)}throw E}})}async function g3(D,u,F){let E=await GD(D),C=await b(E.host);if(!await C.dirExists(E.path))throw new X("PATH_MISSING",`Sandbox path does not exist: ${E.path}`);if(F.capture){let $=await C.exec(E.path,u);return{name:E.name,id:E.id,host:E.host,path:E.path,command:u,exitCode:$.exitCode,stdout:$.stdout,stderr:$.stderr}}let x=await C.execStream(E.path,u);return{name:E.name,id:E.id,host:E.host,path:E.path,command:u,exitCode:x,stdout:"",stderr:""}}function BF(D){D.command("run").description("Run a command in a sandbox").argument("<name>","Sandbox name").argument("<cmd...>","Command to run").option("--json","Capture output and return as JSON").option("--quiet","Suppress non-error output").passThroughOptions().action(async(u,F,E)=>{try{let C=F[0]==="--"?F.slice(1):F;if(C.length===0)console.error(N.red("Error: No command specified")),process.exit(1);let B=await g3(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 X){if(E.json)console.log(JSON.stringify({ok:!1,error:C.message},null,2));else if(!E.quiet)console.error(N.red(`Error: ${C.message}`));process.exit(1)}throw C}})}async function n3(D){let u=await b(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 xF(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 fD())?.name??W;let E=await n3(F);if(u.json){console.log(JSON.stringify(E,null,2));return}if(E.warnings.length>0)for(let C of E.warnings)console.error(N.yellow(`Warning: ${C}`));if(E.sessions.length===0){console.log(N.dim("No active sessions."));return}for(let C of E.sessions){let B=C.attached?N.green("attached"):N.dim("detached");console.log(`${C.name} ${B}`)}})}var t3=PD(c3(),1);async function $F(D){let u=t3.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),x=D.hostName?B.filter((J)=>J.host===D.hostName):B,$=[],R=[],H=[],A=new Set;for(let J of x){let T=new Date(J.createdAt).getTime()<C;if(!T)try{if(!await(await b(J.host)).dirExists(J.path))T=!0}catch{T=!0}if(!T){R.push(J);continue}if(D.dryRun){$.push(J);continue}try{let _=await b(J.host),I=await JD(J.host);await _.removeSandboxDir(J.path),await _.removeMeta(I,J.id),A.add(`${J.host}:${I}/mirrors/${J.repoId}.git`),$.push(J)}catch(_){H.push({sandbox:J.name,error:_ instanceof Error?_.message:String(_)})}}if(!D.dryRun&&$.length>0)await DD((J)=>{for(let S of $)delete J.sandboxes[S.name]});if(!D.dryRun)for(let J of A){let[S,T]=J.split(":",2);try{await(await b(S)).pruneWorktrees(T)}catch{}}return{deleted:$,kept:R,errors:H}}function AF(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 $F({hostName:u.host,olderThan:u.olderThan,dryRun:!0});if(u.json&&u.dryRun){console.log(JSON.stringify(F,null,2));return}if(F.deleted.length===0&&F.errors.length===0){if(u.json)console.log(JSON.stringify(F,null,2));else console.log(N.dim("Nothing to clean up."));return}if(u.dryRun){if(F.deleted.length>0){console.log(`Would delete ${F.deleted.length} sandbox(es)`);for(let C of F.deleted)console.log(` ${N.red("-")} ${C.name} (${C.host})`)}return}if(!u.json){console.log(`Found ${F.deleted.length} sandbox(es) to delete:`);for(let C of F.deleted)console.log(` ${N.red("-")} ${C.name} (${C.host})`)}if(!u.yes&&!u.json){if(!await $D({message:`Delete ${F.deleted.length} sandbox(es)?`,default:!1})){console.log(N.dim("Cancelled."));return}}let E=await $F({hostName:u.host,olderThan:u.olderThan,dryRun:!1});if(u.json){console.log(JSON.stringify(E,null,2));return}if(E.deleted.length>0)console.log(`Deleted ${E.deleted.length} sandbox(es)`);if(E.errors.length>0){for(let C of E.errors)console.error(N.red(`Error (${C.sandbox}): ${C.error}`));process.exit(1)}}catch(F){if(F instanceof FD)console.log(N.dim(`
63
+ Cancelled.`)),process.exit(130);if(u.json)console.log(JSON.stringify({ok:!1,error:F instanceof Error?F.message:String(F)},null,2));else console.error(N.red(`Error: ${F instanceof Error?F.message:String(F)}`));process.exit(1)}})}async function r3(D){let u=[],F=[],E=[];if(D!==W){let H=await p(D);if(!H)return{ok:!1,host:D,checks:[{name:"host",ok:!1,detail:"not found in config"}],warnings:[],errors:[`Host "${D}" not found`]};let A=await hu(TD(H)),J=A.ok?{name:"ssh",ok:!0,detail:"connected"}:{name:"ssh",ok:!1,detail:A.stderr||"connection failed"};if(u.push(J),!J.ok)return E.push(`SSH connection failed: ${J.detail}`),{ok:!1,host:D,checks:u,warnings:F,errors:E}}let C=await b(D),B=await C.checkGit();if(u.push(B),!B.ok)E.push(`git: ${B.detail}`);let x=await C.checkRuntime();if(u.push(x),!x.ok)F.push(`runtime: ${x.detail}`);let $=await C.checkTmux();if(u.push($),!$.ok)F.push(`tmux: ${$.detail}`);return{ok:u.every((H)=>H.ok||H.name==="tmux"||H.name==="runtime"),host:D,checks:u,warnings:F,errors:E}}function HF(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 fD())?.name??W;let E=await r3(F);if(u.json){console.log(JSON.stringify(E,null,2));return}for(let C of E.checks)if(C.ok)console.log(` ${N.green("\u2713")} ${C.name}${C.detail?` (${C.detail})`:""}`);else console.log(` ${N.red("\u2717")} ${C.name}${C.detail?`: ${C.detail}`:""}`);if(E.warnings.length>0)for(let C of E.warnings)console.log(` ${N.yellow("\u26A0")} ${C}`);if(console.log(),E.ok)console.log(N.green(`Host "${F}" is healthy.`));else console.log(N.red(`Host "${F}" has issues.`)),process.exit(1)})}var E8=/^[a-zA-Z0-9._-]+$/;async function C8(D){let u=await p(D);if(!u)return null;let F=TD(u);for(let E of["apt-get","apk","dnf","yum","brew"])if((await Q(F,`command -v ${M(E)}`)).ok)return E;return null}function B8(D,u){switch(u){case"apt-get":return`sudo apt-get install -y ${D}`;case"apk":return`sudo apk add ${D}`;case"dnf":return`sudo dnf install -y ${D}`;case"yum":return`sudo yum install -y ${D}`;case"brew":return`brew install ${D}`;default:return`install ${D} manually`}}async function l3(D){let u=[],F=[],E=[],C=D.hostName===W,B=await b(D.hostName),x=await B.checkGit();if(u.push(x),!x.ok)F.push("git");let $=await B.checkRuntime();if(u.push($),!$.ok)F.push("bun or node");if(D.tmux){let H=await B.checkTmux();if(u.push(H),!H.ok)F.push("tmux")}if(!C){let H=await p(D.hostName);if(!H)throw new X("HOST_NOT_FOUND",`Host "${D.hostName}" not found`);let A=TD(H);for(let J of["bash","curl"]){let T=(await Q(A,`command -v ${M(J)}`)).ok?{name:J,ok:!0}:{name:J,ok:!1,detail:"not found"};if(u.push(T),!T.ok)F.push(J)}for(let J of D.agents){if(!E8.test(J))throw new X("VALIDATION_ERROR",`Invalid agent name "${J}": must contain only alphanumeric characters, dots, underscores, or hyphens`);let T=(await Q(A,`command -v ${M(J)}`)).ok?{name:J,ok:!0}:{name:J,ok:!1,detail:"not found"};if(u.push(T),!T.ok)F.push(J)}if(F.length>0){let J=await C8(D.hostName);if(J)for(let S of F)if(S==="bun or node")E.push("curl -fsSL https://bun.sh/install | bash");else if(S==="claude"||S==="opencode")E.push(`npm install -g ${S}`);else E.push(B8(S,J));else E.push(`No package manager found. Install manually: ${F.join(", ")}`)}}else if(F.length>0)for(let H of F)if(H==="bun or node")E.push("curl -fsSL https://bun.sh/install | bash");else E.push(`Install ${H} using your system package manager`);try{let H=await JD(D.hostName);await B.ensureLayout(H),u.push({name:"layout",ok:!0})}catch(H){u.push({name:"layout",ok:!1,detail:H instanceof Error?H.message:String(H)})}let R=F.length===0&&u.every((H)=>H.ok);return{host:D.hostName,ok:R,checks:u,missing:F,instructions:E}}function JF(D){D.command("bootstrap").description("Check host readiness and report missing packages").requiredOption("-H, --host <hostName>","Target host").option("--tmux","Include tmux in checks").option("--agents <list>","Comma-separated agent CLIs to check (e.g. claude,opencode)").option("--json","Output as JSON").action(async(u)=>{try{let F=u.agents?u.agents.split(",").map((C)=>C.trim()).filter(Boolean):[],E=await l3({hostName:u.host,tmux:!!u.tmux,agents:F});if(u.json){if(console.log(JSON.stringify(E,null,2)),!E.ok)process.exit(1);return}for(let C of E.checks)if(C.ok)console.log(` ${N.green("\u2713")} ${C.name}${C.detail?` (${C.detail})`:""}`);else console.log(` ${N.red("\u2717")} ${C.name}${C.detail?`: ${C.detail}`:""}`);if(E.missing.length>0)console.log(),console.log(N.yellow(`Missing: ${E.missing.join(", ")}`));if(E.instructions.length>0){console.log(),console.log(N.dim("Install instructions:"));for(let C of E.instructions)console.log(` ${C}`)}if(console.log(),E.ok)console.log(N.green(`Host "${u.host}" is ready.`));else console.log(N.red(`Host "${u.host}" is not ready.`)),process.exit(1)}catch(F){if(F instanceof X){if(u.json)console.log(JSON.stringify({ok:!1,error:F.message},null,2));else console.error(N.red(`Error: ${F.message}`));process.exit(1)}throw F}})}async function i3(D){let u=await b3(),F=D.hostName?u.filter((E)=>E.host===D.hostName):u;return{sandboxes:F,total:F.length}}function RF(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 i3({hostName:u.host});if(u.json){console.log(JSON.stringify(F,null,2));return}if(F.total===0){console.log(N.dim("No sandboxes found."));return}let E=Math.max(...F.sandboxes.map(($)=>$.name.length),4),C=Math.max(...F.sandboxes.map(($)=>$.host.length),4),B=($,R=20)=>$.length>R?$.substring(0,R-3)+"...":$,x=Math.max(...F.sandboxes.map(($)=>B($.ref).length),3);console.log(N.bold(`${"NAME".padEnd(E)} ${"HOST".padEnd(C)} ${"REF".padEnd(x)} CREATED`));for(let $ of F.sandboxes){let R=B($.ref),H=new Date($.createdAt).toLocaleDateString();console.log(`${N.cyan($.name.padEnd(E))} ${$.host.padEnd(C)} ${N.yellow(R.padEnd(x))} ${N.dim(H)}`)}console.log(N.dim(`
64
+ ${F.total} sandbox(es)`))}catch(F){if(u.json)console.log(JSON.stringify({ok:!1,error:F instanceof Error?F.message:String(F)},null,2));else console.error(N.red(`Error: ${F instanceof Error?F.message:String(F)}`));process.exit(1)}})}async function p3(D){let F=(await a()).sandboxes[D];if(!F)throw new X("SANDBOX_NOT_FOUND",`Sandbox "${D}" not found`);let E=await b(F.host),C=await JD(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 DD((x)=>{delete x.sandboxes[D]}),B.config=!0;try{let x=`${C}/mirrors/${F.repoId}.git`;await E.pruneWorktrees(x)}catch{}return{entry:F,cleaned:B}}function NF(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 $D({message:`Remove sandbox "${u}"?`,default:!1})){console.log(N.dim("Cancelled."));return}}let E=await p3(u);if(F.json){console.log(JSON.stringify(E,null,2));return}console.log(`Removed sandbox ${N.cyan(E.entry.name)}`);let C=[];if(!E.cleaned.dir)C.push("directory");if(!E.cleaned.meta)C.push("metadata");if(C.length>0)console.log(N.yellow(` Warning: could not clean ${C.join(", ")}`))}catch(E){if(E instanceof FD)console.log(N.dim(`
65
+ Cancelled.`)),process.exit(130);if(E instanceof X){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(N.red(`Error: ${E.message}`));process.exit(1)}throw E}})}function x8(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 o3(D){let u=await GD(D),F=await b(u.host),E=!1;try{E=await F.dirExists(u.path)}catch{}let C=null;try{let B=await F.listTmuxSessions(),x=`wt-${u.id}`,$=B.find((R)=>R.name===x);if($)C=$.name}catch{}return{entry:u,dirExists:E,tmuxSession:C,age:x8(u.createdAt)}}function TF(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 o3(u);if(F.json){console.log(JSON.stringify(E,null,2));return}let{entry:C,dirExists:B,tmuxSession:x,age:$}=E;console.log(N.bold(C.name)),console.log(` ${"ID".padEnd(10)} ${N.dim(C.id)}`),console.log(` ${"Host".padEnd(10)} ${C.host}`),console.log(` ${"Ref".padEnd(10)} ${N.yellow(C.ref.substring(0,8))}`),console.log(` ${"Origin".padEnd(10)} ${N.dim(C.origin)}`),console.log(` ${"Path".padEnd(10)} ${C.path}`),console.log(` ${"Age".padEnd(10)} ${$}`);let R=B?N.green("exists"):N.red("missing");console.log(` ${"Dir".padEnd(10)} ${R}`);let H=x?N.green(x):N.dim("none");console.log(` ${"Tmux".padEnd(10)} ${H}`)}catch(E){if(E instanceof X){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(N.red(`Error: ${E.message}`));process.exit(1)}throw E}})}function GF(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 v3(u,F);if(E.json){console.log(JSON.stringify(C,null,2));return}console.log(N.green(`Renamed "${u}" -> "${F}"`))}catch(C){if(C instanceof X){if(E.json)console.log(JSON.stringify({ok:!1,error:C.message},null,2));else console.error(N.red(`Error: ${C.message}`));process.exit(1)}throw C}})}var o=new VF,a3="0.0.7";function $8(D,u=""){let F=[],E=D.name(),C=D.registeredArguments.map(($)=>$.required?`<${$.name()}>`:`[${$.name()}]`).join(" "),B=C?`${E} ${C}`:E;F.push(`${u}${B}`);let x=D.commands.filter(($)=>$.name()!=="help");return x.forEach(($,R)=>{let H=R===x.length-1,A=H?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",J=u+(H?" ":"\u2502 "),S=$.name(),T=$.registeredArguments.map((O)=>O.required?`<${O.name()}>`:`[${O.name()}]`).join(" "),_=T?`${S} ${T}`:S,I=$.commands.filter((O)=>O.name()!=="help");if(I.length>0)F.push(`${u}${A}${_}`),I.forEach((O,Z)=>{let j=Z===I.length-1?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",g=O.name(),s=O.registeredArguments.map((oD)=>oD.required?`<${oD.name()}>`:`[${oD.name()}]`).join(" "),SD=s?`${g} ${s}`:g;F.push(`${J}${j}${SD}`)});else F.push(`${u}${A}${_}`)}),F}o.name("wt").enablePositionalOptions().description("Run worktrees, coding agents, and more all from the cloud. SSH included, agents too!").version(a3,"-v, --version").option("--tree","Show command tree").action((D)=>{if(D.tree){console.log($8(o).join(`
63
66
  `));return}let u=`
64
67
  __
65
68
  /\\ \\__
@@ -69,5 +72,5 @@ Cancelled.`)),process.exit(130);if(E instanceof G){if(F.json)console.log(JSON.st
69
72
  \\ \\_______/' \\ \\__\\
70
73
  \\/__//__/ \\/__/
71
74
  `;console.log(N.green(u)),console.log(N.cyan("Start worktrees in the cloud.")),console.log(N.white.bold.italic("wt --help"),N.gray.italic(`to get started.
72
- `)),console.log(N.dim(`v${y3} \u2022 https://github.com/abhi-arya1/wt
73
- `))});t0(i);p0(i);i0(i);o0(i);a0(i);s0(i);DF(i);uF(i);FF(i);EF(i);CF(i);BF(i);$F(i);function P3(){i.parse(process.argv)}P3();export{P3 as run,i as program};
75
+ `)),console.log(N.dim(`v${a3} \u2022 https://github.com/abhi-arya1/wt
76
+ `))});s0(o);FF(o);EF(o);CF(o);BF(o);xF(o);AF(o);HF(o);JF(o);RF(o);NF(o);TF(o);GF(o);function s3(){o.parse(process.argv)}s3();export{s3 as run,o as program};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abhi-arya1/wt",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "Git worktree sandboxes, locally or on remote hosts over SSH.",
5
5
  "module": "index.ts",
6
6
  "type": "module",
@@ -29,6 +29,7 @@
29
29
  "commander": "^14.0.3",
30
30
  "ms": "^2.1.3",
31
31
  "nanoid": "^5.1.6",
32
+ "nanospinner": "^1.2.2",
32
33
  "proper-lockfile": "^4.1.2"
33
34
  }
34
35
  }