@descript/platform-cli 0.2.6 → 0.2.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.
- package/dist/descript-cli.cjs +56 -56
- package/package.json +1 -1
package/dist/descript-cli.cjs
CHANGED
|
@@ -1,99 +1,99 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var
|
|
2
|
+
"use strict";var Xi=Object.create;var Vt=Object.defineProperty;var er=Object.getOwnPropertyDescriptor;var tr=Object.getOwnPropertyNames;var ir=Object.getPrototypeOf,rr=Object.prototype.hasOwnProperty;var q=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var nr=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let u of tr(e))!rr.call(i,u)&&u!==t&&Vt(i,u,{get:()=>e[u],enumerable:!(n=er(e,u))||n.enumerable});return i};var L=(i,e,t)=>(t=i!=null?Xi(ir(i)):{},nr(e||!i||!i.__esModule?Vt(t,"default",{value:i,enumerable:!0}):t,i));var fe=q(Ze=>{var ve=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},Ye=class extends ve{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Ze.CommanderError=ve;Ze.InvalidArgumentError=Ye});var xe=q(Xe=>{var{InvalidArgumentError:ur}=fe(),Qe=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,n)=>{if(!this.argChoices.includes(t))throw new ur(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,n):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function sr(i){let e=i.name()+(i.variadic===!0?"...":"");return i.required?"<"+e+">":"["+e+"]"}Xe.Argument=Qe;Xe.humanReadableArgName=sr});var tt=q(Mt=>{var{humanReadableArgName:or}=xe(),et=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter(u=>!u._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((u,s)=>u.name().localeCompare(s.name())),t}compareOptions(e,t){let n=u=>u.short?u.short.replace(/^-/,""):u.long.replace(/^--/,"");return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(u=>!u.hidden),n=e._getHelpOption();if(n&&!n.hidden){let u=n.short&&e._findOption(n.short),s=n.long&&e._findOption(n.long);!u&&!s?t.push(n):n.long&&!s?t.push(e.createOption(n.long,n.description)):n.short&&!u&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let u=n.options.filter(s=>!s.hidden);t.push(...u)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(n=>or(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((n,u)=>Math.max(n,t.subcommandTerm(u).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((n,u)=>Math.max(n,t.optionTerm(u).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((n,u)=>Math.max(n,t.optionTerm(u).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((n,u)=>Math.max(n,t.argumentTerm(u).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let n="";for(let u=e.parent;u;u=u.parent)n=u.name()+" "+n;return n+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatHelp(e,t){let n=t.padWidth(e,t),u=t.helpWidth||80,s=2,r=2;function o(h,f){if(f){let F=`${h.padEnd(n+r)}${f}`;return t.wrap(F,u-s,n+r)}return h}function a(h){return h.join(`
|
|
3
3
|
`).replace(/^/gm," ".repeat(s))}let l=[`Usage: ${t.commandUsage(e)}`,""],c=t.commandDescription(e);c.length>0&&(l=l.concat([t.wrap(c,u,0),""]));let p=t.visibleArguments(e).map(h=>o(t.argumentTerm(h),t.argumentDescription(h)));p.length>0&&(l=l.concat(["Arguments:",a(p),""]));let m=t.visibleOptions(e).map(h=>o(t.optionTerm(h),t.optionDescription(h)));if(m.length>0&&(l=l.concat(["Options:",a(m),""])),this.showGlobalOptions){let h=t.visibleGlobalOptions(e).map(f=>o(t.optionTerm(f),t.optionDescription(f)));h.length>0&&(l=l.concat(["Global Options:",a(h),""]))}let C=t.visibleCommands(e).map(h=>o(t.subcommandTerm(h),t.subcommandDescription(h)));return C.length>0&&(l=l.concat(["Commands:",a(C),""])),l.join(`
|
|
4
4
|
`)}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,n,u=40){let s=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",r=new RegExp(`[\\n][${s}]+`);if(e.match(r))return e;let o=t-n;if(o<u)return e;let a=e.slice(0,n),l=e.slice(n).replace(`\r
|
|
5
5
|
`,`
|
|
6
6
|
`),c=" ".repeat(n),m="\\s\u200B",C=new RegExp(`
|
|
7
7
|
|.{1,${o-1}}([${m}]|$)|[^${m}]+?([${m}]|$)`,"g"),h=l.match(C)||[];return a+h.map((f,F)=>f===`
|
|
8
8
|
`?"":(F>0?c:"")+f.trimEnd()).join(`
|
|
9
|
-
`)}};
|
|
9
|
+
`)}};Mt.Help=et});var ut=q(nt=>{var{InvalidArgumentError:ar}=fe(),it=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=lr(e);this.short=n.shortFlag,this.long=n.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}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e=="string"&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,n)=>{if(!this.argChoices.includes(t))throw new ar(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,n):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return Dr(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},rt=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let u=this.negativeOptions.get(n).presetArg,s=u!==void 0?u:!1;return t.negate===(s===e)}};function Dr(i){return i.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function lr(i){let e,t,n=i.split(/[ |,]+/);return n.length>1&&!/^[[<]/.test(n[1])&&(e=n.shift()),t=n.shift(),!e&&/^-[^-]$/.test(t)&&(e=t,t=void 0),{shortFlag:e,longFlag:t}}nt.Option=it;nt.DualOptions=rt});var Ut=q(Nt=>{function cr(i,e){if(Math.abs(i.length-e.length)>3)return Math.max(i.length,e.length);let t=[];for(let n=0;n<=i.length;n++)t[n]=[n];for(let n=0;n<=e.length;n++)t[0][n]=n;for(let n=1;n<=e.length;n++)for(let u=1;u<=i.length;u++){let s=1;i[u-1]===e[n-1]?s=0:s=1,t[u][n]=Math.min(t[u-1][n]+1,t[u][n-1]+1,t[u-1][n-1]+s),u>1&&n>1&&i[u-1]===e[n-2]&&i[u-2]===e[n-1]&&(t[u][n]=Math.min(t[u][n],t[u-2][n-2]+1))}return t[i.length][e.length]}function pr(i,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=i.startsWith("--");t&&(i=i.slice(2),e=e.map(r=>r.slice(2)));let n=[],u=3,s=.4;return e.forEach(r=>{if(r.length<=1)return;let o=cr(i,r),a=Math.max(i.length,r.length);(a-o)/a>s&&(o<u?(u=o,n=[r]):o===u&&n.push(r))}),n.sort((r,o)=>r.localeCompare(o)),t&&(n=n.map(r=>`--${r}`)),n.length>1?`
|
|
10
10
|
(Did you mean one of ${n.join(", ")}?)`:n.length===1?`
|
|
11
|
-
(Did you mean ${n[0]}?)`:""}
|
|
12
|
-
- specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new
|
|
13
|
-
Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,n){this._exitCallback&&this._exitCallback(new
|
|
14
|
-
- already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=u=>[u.name()].concat(u.aliases()),n=t(e).find(u=>this._findCommand(u));if(n){let u=t(this._findCommand(n)).join("|"),s=t(e).join("|");throw new Error(`cannot add command '${s}' as already have command '${u}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),n=e.attributeName();if(e.negate){let s=e.long.replace(/^--no-/,"--");this._findOption(s)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,"default");let u=(s,r,o)=>{s==null&&e.presetArg!==void 0&&(s=e.presetArg);let a=this.getOptionValue(n);s!==null&&e.parseArg?s=this._callParseArg(e,s,a,r):s!==null&&e.variadic&&(s=e._concatValue(s,a)),s==null&&(e.negate?s=!1:e.isBoolean()||e.optional?s=!0:s=""),this.setOptionValueWithSource(n,s,o)};return this.on("option:"+t,s=>{let r=`error: option '${e.flags}' argument '${s}' is invalid.`;u(s,r,"cli")}),e.envVar&&this.on("optionEnv:"+t,s=>{let r=`error: option '${e.flags}' value '${s}' from env '${e.envVar}' is invalid.`;u(s,r,"env")}),this}_optionEx(e,t,n,u,s){if(typeof t=="object"&&t instanceof
|
|
11
|
+
(Did you mean ${n[0]}?)`:""}Nt.suggestSimilar=pr});var Gt=q(Wt=>{var hr=require("node:events").EventEmitter,st=require("node:child_process"),H=require("node:path"),ot=require("node:fs"),$=require("node:process"),{Argument:dr,humanReadableArgName:mr}=xe(),{CommanderError:at}=fe(),{Help:fr}=tt(),{Option:qt,DualOptions:gr}=ut(),{suggestSimilar:Lt}=Ut(),Dt=class i extends hr{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",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._outputConfiguration={writeOut:t=>$.stdout.write(t),writeErr:t=>$.stderr.write(t),getOutHelpWidth:()=>$.stdout.isTTY?$.stdout.columns:void 0,getErrHelpWidth:()=>$.stderr.isTTY?$.stderr.columns:void 0,outputError:(t,n)=>n(t)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,n){let u=t,s=n;typeof u=="object"&&u!==null&&(s=u,u=null),s=s||{};let[,r,o]=e.match(/([^ ]+) *(.*)/),a=this.createCommand(r);return u&&(a.description(u),a._executableHandler=!0),s.isDefault&&(this._defaultCommandName=a._name),a._hidden=!!(s.noHelp||s.hidden),a._executableFile=s.executableFile||null,o&&a.arguments(o),this._registerCommand(a),a.parent=this,a.copyInheritedSettings(this),u?this:a}createCommand(e){return new i(e)}createHelp(){return Object.assign(new fr,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
|
|
12
|
+
- specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new dr(e,t)}argument(e,t,n,u){let s=this.createArgument(e,t);return typeof n=="function"?s.default(u).argParser(n):s.default(n),this.addArgument(s),this}arguments(e){return e.trim().split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t&&t.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,this;e=e??"help [command]";let[,n,u]=e.match(/([^ ]+) *(.*)/),s=t??"display help for command",r=this.createCommand(n);return r.helpOption(!1),u&&r.arguments(u),s&&r.description(s),this._addImplicitHelpCommand=!0,this._helpCommand=r,this}addHelpCommand(e,t){return typeof e!="object"?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let n=["preSubcommand","preAction","postAction"];if(!n.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
|
|
13
|
+
Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,n){this._exitCallback&&this._exitCallback(new at(e,t,n)),$.exit(e)}action(e){let t=n=>{let u=this.registeredArguments.length,s=n.slice(0,u);return this._storeOptionsAsProperties?s[u]=this:s[u]=this.opts(),s.push(this),e.apply(this,s)};return this._actionHandler=t,this}createOption(e,t){return new qt(e,t)}_callParseArg(e,t,n,u){try{return e.parseArg(t,n)}catch(s){if(s.code==="commander.invalidArgument"){let r=`${u} ${s.message}`;this.error(r,{exitCode:s.exitCode,code:s.code})}throw s}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'
|
|
14
|
+
- already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=u=>[u.name()].concat(u.aliases()),n=t(e).find(u=>this._findCommand(u));if(n){let u=t(this._findCommand(n)).join("|"),s=t(e).join("|");throw new Error(`cannot add command '${s}' as already have command '${u}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),n=e.attributeName();if(e.negate){let s=e.long.replace(/^--no-/,"--");this._findOption(s)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,"default");let u=(s,r,o)=>{s==null&&e.presetArg!==void 0&&(s=e.presetArg);let a=this.getOptionValue(n);s!==null&&e.parseArg?s=this._callParseArg(e,s,a,r):s!==null&&e.variadic&&(s=e._concatValue(s,a)),s==null&&(e.negate?s=!1:e.isBoolean()||e.optional?s=!0:s=""),this.setOptionValueWithSource(n,s,o)};return this.on("option:"+t,s=>{let r=`error: option '${e.flags}' argument '${s}' is invalid.`;u(s,r,"cli")}),e.envVar&&this.on("optionEnv:"+t,s=>{let r=`error: option '${e.flags}' value '${s}' from env '${e.envVar}' is invalid.`;u(s,r,"env")}),this}_optionEx(e,t,n,u,s){if(typeof t=="object"&&t instanceof qt)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let r=this.createOption(t,n);if(r.makeOptionMandatory(!!e.mandatory),typeof u=="function")r.default(s).argParser(u);else if(u instanceof RegExp){let o=u;u=(a,l)=>{let c=o.exec(a);return c?c[0]:l},r.default(s).argParser(u)}else r.default(u);return this.addOption(r)}option(e,t,n,u){return this._optionEx({},e,t,n,u)}requiredOption(e,t,n,u){return this._optionEx({mandatory:!0},e,t,n,u)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,n){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(t=n.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},e===void 0&&t.from===void 0){$.versions?.electron&&(t.from="electron");let u=$.execArgv??[];(u.includes("-e")||u.includes("--eval")||u.includes("-p")||u.includes("--print"))&&(t.from="eval")}e===void 0&&(e=$.argv),this.rawArgs=e.slice();let n;switch(t.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":$.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case"user":n=e.slice(0);break;case"eval":n=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(e,t){let n=this._prepareUserArgs(e,t);return this._parseCommand([],n),this}async parseAsync(e,t){let n=this._prepareUserArgs(e,t);return await this._parseCommand([],n),this}_executeSubCommand(e,t){t=t.slice();let n=!1,u=[".js",".ts",".tsx",".mjs",".cjs"];function s(c,p){let m=H.resolve(c,p);if(ot.existsSync(m))return m;if(u.includes(H.extname(p)))return;let C=u.find(h=>ot.existsSync(`${m}${h}`));if(C)return`${m}${C}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let r=e._executableFile||`${this._name}-${e._name}`,o=this._executableDir||"";if(this._scriptPath){let c;try{c=ot.realpathSync(this._scriptPath)}catch{c=this._scriptPath}o=H.resolve(H.dirname(c),o)}if(o){let c=s(o,r);if(!c&&!e._executableFile&&this._scriptPath){let p=H.basename(this._scriptPath,H.extname(this._scriptPath));p!==this._name&&(c=s(o,`${p}-${e._name}`))}r=c||r}n=u.includes(H.extname(r));let a;$.platform!=="win32"?n?(t.unshift(r),t=Ht($.execArgv).concat(t),a=st.spawn($.argv[0],t,{stdio:"inherit"})):a=st.spawn(r,t,{stdio:"inherit"}):(t.unshift(r),t=Ht($.execArgv).concat(t),a=st.spawn($.execPath,t,{stdio:"inherit"})),a.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(p=>{$.on(p,()=>{a.killed===!1&&a.exitCode===null&&a.kill(p)})});let l=this._exitCallback;a.on("close",c=>{c=c??1,l?l(new at(c,"commander.executeSubCommandAsync","(close)")):$.exit(c)}),a.on("error",c=>{if(c.code==="ENOENT"){let p=o?`searched for local subcommand relative to directory '${o}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",m=`'${r}' does not exist
|
|
15
15
|
- if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
16
16
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
17
|
-
- ${p}`;throw new Error(m)}else if(c.code==="EACCES")throw new Error(`'${r}' not executable`);if(!l)$.exit(1);else{let p=new
|
|
17
|
+
- ${p}`;throw new Error(m)}else if(c.code==="EACCES")throw new Error(`'${r}' not executable`);if(!l)$.exit(1);else{let p=new at(1,"commander.executeSubCommandAsync","(error)");p.nestedError=c,l(p)}}),this.runningCommand=a}_dispatchSubcommand(e,t,n){let u=this._findCommand(e);u||this.help({error:!0});let s;return s=this._chainOrCallSubCommandHook(s,u,"preSubcommand"),s=this._chainOrCall(s,()=>{if(u._executableHandler)this._executeSubCommand(u,t.concat(n));else return u._parseCommand(t,n)}),s}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(n,u,s)=>{let r=u;if(u!==null&&n.parseArg){let o=`error: command-argument value '${u}' is invalid for argument '${n.name()}'.`;r=this._callParseArg(n,u,s,o)}return r};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((n,u)=>{let s=n.defaultValue;n.variadic?u<this.args.length?(s=this.args.slice(u),n.parseArg&&(s=s.reduce((r,o)=>e(n,o,r),n.defaultValue))):s===void 0&&(s=[]):u<this.args.length&&(s=this.args[u],n.parseArg&&(s=e(n,s,n.defaultValue))),t[u]=s}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let n=e,u=[];return this._getCommandAndAncestors().reverse().filter(s=>s._lifeCycleHooks[t]!==void 0).forEach(s=>{s._lifeCycleHooks[t].forEach(r=>{u.push({hookedCommand:s,callback:r})})}),t==="postAction"&&u.reverse(),u.forEach(s=>{n=this._chainOrCall(n,()=>s.callback(s.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let u=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(s=>{u=this._chainOrCall(u,()=>s(this,t))}),u}_parseCommand(e,t){let n=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),t=n.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let u=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},s=`command:${this.name()}`;if(this._actionHandler){u(),this._processArguments();let r;return r=this._chainOrCallHooks(r,"preAction"),r=this._chainOrCall(r,()=>this._actionHandler(this.processedArgs)),this.parent&&(r=this._chainOrCall(r,()=>{this.parent.emit(s,e,t)})),r=this._chainOrCallHooks(r,"postAction"),r}if(this.parent&&this.parent.listenerCount(s))u(),this._processArguments(),this.parent.emit(s,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(u(),this._processArguments())}else this.commands.length?(u(),this.help({error:!0})):(u(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(n=>{let u=n.attributeName();return this.getOptionValue(u)===void 0?!1:this.getOptionValueSource(u)!=="default"});e.filter(n=>n.conflictsWith.length>0).forEach(n=>{let u=e.find(s=>n.conflictsWith.includes(s.attributeName()));u&&this._conflictingOption(n,u)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],n=[],u=t,s=e.slice();function r(a){return a.length>1&&a[0]==="-"}let o=null;for(;s.length;){let a=s.shift();if(a==="--"){u===n&&u.push(a),u.push(...s);break}if(o&&!r(a)){this.emit(`option:${o.name()}`,a);continue}if(o=null,r(a)){let l=this._findOption(a);if(l){if(l.required){let c=s.shift();c===void 0&&this.optionMissingArgument(l),this.emit(`option:${l.name()}`,c)}else if(l.optional){let c=null;s.length>0&&!r(s[0])&&(c=s.shift()),this.emit(`option:${l.name()}`,c)}else this.emit(`option:${l.name()}`);o=l.variadic?l:null;continue}}if(a.length>2&&a[0]==="-"&&a[1]!=="-"){let l=this._findOption(`-${a[1]}`);if(l){l.required||l.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${l.name()}`,a.slice(2)):(this.emit(`option:${l.name()}`),s.unshift(`-${a.slice(2)}`));continue}}if(/^--[^=]+=/.test(a)){let l=a.indexOf("="),c=this._findOption(a.slice(0,l));if(c&&(c.required||c.optional)){this.emit(`option:${c.name()}`,a.slice(l+1));continue}}if(r(a)&&(u=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(a)){t.push(a),s.length>0&&n.push(...s);break}else if(this._getHelpCommand()&&a===this._getHelpCommand().name()){t.push(a),s.length>0&&t.push(...s);break}else if(this._defaultCommandName){n.push(a),s.length>0&&n.push(...s);break}}if(this._passThroughOptions){u.push(a),s.length>0&&u.push(...s);break}u.push(a)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let n=0;n<t;n++){let u=this.options[n].attributeName();e[u]=u===this._versionOptionName?this._version:this[u]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
|
|
18
18
|
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
19
19
|
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
|
|
20
|
-
`),this.outputHelp({error:!0}));let n=t||{},u=n.exitCode||1,s=n.code||"commander.error";this._exit(u,s,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in $.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,$.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new
|
|
21
|
-
`),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");let n=this.parent?._findCommand(e);if(n){let u=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${u}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map(n=>
|
|
20
|
+
`),this.outputHelp({error:!0}));let n=t||{},u=n.exitCode||1,s=n.code||"commander.error";this._exit(u,s,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in $.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,$.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new gr(this.options),t=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(u=>!t(u)).forEach(u=>{this.setOptionValueWithSource(u,n.implied[u],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let n=r=>{let o=r.attributeName(),a=this.getOptionValue(o),l=this.options.find(p=>p.negate&&o===p.attributeName()),c=this.options.find(p=>!p.negate&&o===p.attributeName());return l&&(l.presetArg===void 0&&a===!1||l.presetArg!==void 0&&a===l.presetArg)?l:c||r},u=r=>{let o=n(r),a=o.attributeName();return this.getOptionValueSource(a)==="env"?`environment variable '${o.envVar}'`:`option '${o.flags}'`},s=`error: ${u(e)} cannot be used with ${u(t)}`;this.error(s,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let u=[],s=this;do{let r=s.createHelp().visibleOptions(s).filter(o=>o.long).map(o=>o.long);u=u.concat(r),s=s.parent}while(s&&!s._enablePositionalOptions);t=Lt(e,u)}let n=`error: unknown option '${e}'${t}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,n=t===1?"":"s",s=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${n} but got ${e.length}.`;this.error(s,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let u=[];this.createHelp().visibleCommands(this).forEach(s=>{u.push(s.name()),s.alias()&&u.push(s.alias())}),t=Lt(e,u)}let n=`error: unknown command '${e}'${t}`;this.error(n,{code:"commander.unknownCommand"})}version(e,t,n){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",n=n||"output the version number";let u=this.createOption(t,n);return this._versionOptionName=u.attributeName(),this._registerOption(u),this.on("option:"+u.name(),()=>{this._outputConfiguration.writeOut(`${e}
|
|
21
|
+
`),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");let n=this.parent?._findCommand(e);if(n){let u=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${u}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map(n=>mr(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=H.basename(e,H.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp();return t.helpWidth===void 0&&(t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),t.formatHelp(this,t)}_getHelpContext(e){e=e||{};let t={error:!!e.error},n;return t.error?n=u=>this._outputConfiguration.writeErr(u):n=u=>this._outputConfiguration.writeOut(u),t.write=e.write||n,t.command=this,t}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let n=this._getHelpContext(e);this._getCommandAndAncestors().reverse().forEach(s=>s.emit("beforeAllHelp",n)),this.emit("beforeHelp",n);let u=this.helpInformation(n);if(t&&(u=t(u),typeof u!="string"&&!Buffer.isBuffer(u)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(u),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",n),this._getCommandAndAncestors().forEach(s=>s.emit("afterAllHelp",n))}helpOption(e,t){return typeof e=="boolean"?(e?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(e=e??"-h, --help",t=t??"display help for command",this._helpOption=this.createOption(e,t),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let t=$.exitCode||0;t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let n=["beforeAll","before","after","afterAll"];if(!n.includes(e))throw new Error(`Unexpected value for position to addHelpText.
|
|
22
22
|
Expecting one of '${n.join("', '")}'`);let u=`${e}Help`;return this.on(u,s=>{let r;typeof t=="function"?r=t({error:s.error,command:s.command}):r=t,r&&s.write(`${r}
|
|
23
|
-
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(u=>t.is(u))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Ut(i){return i.map(e=>{if(!e.startsWith("--inspect"))return e;let t,n="127.0.0.1",u="9229",s;return(s=e.match(/^(--inspect(-brk)?)$/))!==null?t=s[1]:(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=s[1],/^\d+$/.test(s[3])?u=s[3]:n=s[3]):(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=s[1],n=s[3],u=s[4]),t&&u!=="0"?`${t}=${n}:${parseInt(u)+1}`:e})}qt.Command=ot});var Kt=q(S=>{var{Argument:Ht}=ve(),{Command:at}=Lt(),{CommanderError:fr,InvalidArgumentError:Wt}=fe(),{Help:gr}=Xe(),{Option:Gt}=rt();S.program=new at;S.createCommand=i=>new at(i);S.createOption=(i,e)=>new Gt(i,e);S.createArgument=(i,e)=>new Ht(i,e);S.Command=at;S.Option=Gt;S.Argument=Ht;S.Help=gr;S.CommanderError=fr;S.InvalidArgumentError=Wt;S.InvalidOptionArgumentError=Wt});var lt=q((ou,zt)=>{"use strict";var Dt={to(i,e){return e?`\x1B[${e+1};${i+1}H`:`\x1B[${i+1}G`},move(i,e){let t="";return i<0?t+=`\x1B[${-i}D`:i>0&&(t+=`\x1B[${i}C`),e<0?t+=`\x1B[${-e}A`:e>0&&(t+=`\x1B[${e}B`),t},up:(i=1)=>`\x1B[${i}A`,down:(i=1)=>`\x1B[${i}B`,forward:(i=1)=>`\x1B[${i}C`,backward:(i=1)=>`\x1B[${i}D`,nextLine:(i=1)=>"\x1B[E".repeat(i),prevLine:(i=1)=>"\x1B[F".repeat(i),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},Cr={up:(i=1)=>"\x1B[S".repeat(i),down:(i=1)=>"\x1B[T".repeat(i)},Fr={screen:"\x1B[2J",up:(i=1)=>"\x1B[1J".repeat(i),down:(i=1)=>"\x1B[J".repeat(i),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(i){let e="";for(let t=0;t<i;t++)e+=this.line+(t<i-1?Dt.up():"");return i&&(e+=Dt.left),e}};zt.exports={cursor:Dt,scroll:Cr,erase:Fr,beep:"\x07"}});var pt=q((au,ct)=>{var Be=process||{},Yt=Be.argv||[],xe=Be.env||{},Er=!(xe.NO_COLOR||Yt.includes("--no-color"))&&(!!xe.FORCE_COLOR||Yt.includes("--color")||Be.platform==="win32"||(Be.stdout||{}).isTTY&&xe.TERM!=="dumb"||!!xe.CI),br=(i,e,t=i)=>n=>{let u=""+n,s=u.indexOf(e,i.length);return~s?i+Ar(u,e,t,s)+e:i+u+e},Ar=(i,e,t,n)=>{let u="",s=0;do u+=i.substring(s,n)+t,s=n+e.length,n=i.indexOf(e,s);while(~n);return u+i.substring(s)},Zt=(i=Er)=>{let e=i?br:()=>String;return{isColorSupported:i,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};ct.exports=Zt();ct.exports.createColors=Zt});var Jt=L(Kt(),1),{program:Yn,createCommand:Zn,createArgument:Qn,createOption:Xn,CommanderError:eu,InvalidArgumentError:tu,InvalidOptionArgumentError:iu,Command:X,Argument:ru,Option:nu,Help:uu}=Jt.default;var Ji=L(require("update-notifier"),1);var v=L(lt(),1),De=require("node:process"),ee=L(require("node:readline"),1),mt=L(require("node:readline"),1),ai=require("node:tty"),re=L(pt(),1);function $r({onlyFirst:i=!1}={}){let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(e,i?void 0:"g")}var yr=$r();function Di(i){if(typeof i!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof i}\``);return i.replace(yr,"")}function li(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var ci={exports:{}};(function(i){var e={};i.exports=e,e.eastAsianWidth=function(n){var u=n.charCodeAt(0),s=n.length==2?n.charCodeAt(1):0,r=u;return 55296<=u&&u<=56319&&56320<=s&&s<=57343&&(u&=1023,s&=1023,r=u<<10|s,r+=65536),r==12288||65281<=r&&r<=65376||65504<=r&&r<=65510?"F":r==8361||65377<=r&&r<=65470||65474<=r&&r<=65479||65482<=r&&r<=65487||65490<=r&&r<=65495||65498<=r&&r<=65500||65512<=r&&r<=65518?"H":4352<=r&&r<=4447||4515<=r&&r<=4519||4602<=r&&r<=4607||9001<=r&&r<=9002||11904<=r&&r<=11929||11931<=r&&r<=12019||12032<=r&&r<=12245||12272<=r&&r<=12283||12289<=r&&r<=12350||12353<=r&&r<=12438||12441<=r&&r<=12543||12549<=r&&r<=12589||12593<=r&&r<=12686||12688<=r&&r<=12730||12736<=r&&r<=12771||12784<=r&&r<=12830||12832<=r&&r<=12871||12880<=r&&r<=13054||13056<=r&&r<=19903||19968<=r&&r<=42124||42128<=r&&r<=42182||43360<=r&&r<=43388||44032<=r&&r<=55203||55216<=r&&r<=55238||55243<=r&&r<=55291||63744<=r&&r<=64255||65040<=r&&r<=65049||65072<=r&&r<=65106||65108<=r&&r<=65126||65128<=r&&r<=65131||110592<=r&&r<=110593||127488<=r&&r<=127490||127504<=r&&r<=127546||127552<=r&&r<=127560||127568<=r&&r<=127569||131072<=r&&r<=194367||177984<=r&&r<=196605||196608<=r&&r<=262141?"W":32<=r&&r<=126||162<=r&&r<=163||165<=r&&r<=166||r==172||r==175||10214<=r&&r<=10221||10629<=r&&r<=10630?"Na":r==161||r==164||167<=r&&r<=168||r==170||173<=r&&r<=174||176<=r&&r<=180||182<=r&&r<=186||188<=r&&r<=191||r==198||r==208||215<=r&&r<=216||222<=r&&r<=225||r==230||232<=r&&r<=234||236<=r&&r<=237||r==240||242<=r&&r<=243||247<=r&&r<=250||r==252||r==254||r==257||r==273||r==275||r==283||294<=r&&r<=295||r==299||305<=r&&r<=307||r==312||319<=r&&r<=322||r==324||328<=r&&r<=331||r==333||338<=r&&r<=339||358<=r&&r<=359||r==363||r==462||r==464||r==466||r==468||r==470||r==472||r==474||r==476||r==593||r==609||r==708||r==711||713<=r&&r<=715||r==717||r==720||728<=r&&r<=731||r==733||r==735||768<=r&&r<=879||913<=r&&r<=929||931<=r&&r<=937||945<=r&&r<=961||963<=r&&r<=969||r==1025||1040<=r&&r<=1103||r==1105||r==8208||8211<=r&&r<=8214||8216<=r&&r<=8217||8220<=r&&r<=8221||8224<=r&&r<=8226||8228<=r&&r<=8231||r==8240||8242<=r&&r<=8243||r==8245||r==8251||r==8254||r==8308||r==8319||8321<=r&&r<=8324||r==8364||r==8451||r==8453||r==8457||r==8467||r==8470||8481<=r&&r<=8482||r==8486||r==8491||8531<=r&&r<=8532||8539<=r&&r<=8542||8544<=r&&r<=8555||8560<=r&&r<=8569||r==8585||8592<=r&&r<=8601||8632<=r&&r<=8633||r==8658||r==8660||r==8679||r==8704||8706<=r&&r<=8707||8711<=r&&r<=8712||r==8715||r==8719||r==8721||r==8725||r==8730||8733<=r&&r<=8736||r==8739||r==8741||8743<=r&&r<=8748||r==8750||8756<=r&&r<=8759||8764<=r&&r<=8765||r==8776||r==8780||r==8786||8800<=r&&r<=8801||8804<=r&&r<=8807||8810<=r&&r<=8811||8814<=r&&r<=8815||8834<=r&&r<=8835||8838<=r&&r<=8839||r==8853||r==8857||r==8869||r==8895||r==8978||9312<=r&&r<=9449||9451<=r&&r<=9547||9552<=r&&r<=9587||9600<=r&&r<=9615||9618<=r&&r<=9621||9632<=r&&r<=9633||9635<=r&&r<=9641||9650<=r&&r<=9651||9654<=r&&r<=9655||9660<=r&&r<=9661||9664<=r&&r<=9665||9670<=r&&r<=9672||r==9675||9678<=r&&r<=9681||9698<=r&&r<=9701||r==9711||9733<=r&&r<=9734||r==9737||9742<=r&&r<=9743||9748<=r&&r<=9749||r==9756||r==9758||r==9792||r==9794||9824<=r&&r<=9825||9827<=r&&r<=9829||9831<=r&&r<=9834||9836<=r&&r<=9837||r==9839||9886<=r&&r<=9887||9918<=r&&r<=9919||9924<=r&&r<=9933||9935<=r&&r<=9953||r==9955||9960<=r&&r<=9983||r==10045||r==10071||10102<=r&&r<=10111||11093<=r&&r<=11097||12872<=r&&r<=12879||57344<=r&&r<=63743||65024<=r&&r<=65039||r==65533||127232<=r&&r<=127242||127248<=r&&r<=127277||127280<=r&&r<=127337||127344<=r&&r<=127386||917760<=r&&r<=917999||983040<=r&&r<=1048573||1048576<=r&&r<=1114109?"A":"N"},e.characterLength=function(n){var u=this.eastAsianWidth(n);return u=="F"||u=="W"||u=="A"?2:1};function t(n){return n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(n){for(var u=t(n),s=0,r=0;r<u.length;r++)s=s+this.characterLength(u[r]);return s},e.slice=function(n,u,s){textLen=e.length(n),u=u||0,s=s||1,u<0&&(u=textLen+u),s<0&&(s=textLen+s);for(var r="",o=0,a=t(n),l=0;l<a.length;l++){var c=a[l],p=e.length(c);if(o>=u-(p==2?1:0))if(o+p<=s)r+=c;else break;o+=p}return r}})(ci);var wr=ci.exports,_r=li(wr),vr=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},xr=li(vr);function ge(i,e={}){if(typeof i!="string"||i.length===0||(e={ambiguousIsNarrow:!0,...e},i=Di(i),i.length===0))return 0;i=i.replace(xr()," ");let t=e.ambiguousIsNarrow?1:2,n=0;for(let u of i){let s=u.codePointAt(0);if(!(s<=31||s>=127&&s<=159||s>=768&&s<=879))switch(_r.eastAsianWidth(u)){case"F":case"W":n+=2;break;case"A":n+=t;break;default:n+=1}}return n}var ht=10,Qt=(i=0)=>e=>`\x1B[${e+i}m`,Xt=(i=0)=>e=>`\x1B[${38+i};5;${e}m`,ei=(i=0)=>(e,t,n)=>`\x1B[${38+i};2;${e};${t};${n}m`,A={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(A.modifier);var Br=Object.keys(A.color),Or=Object.keys(A.bgColor);[...Br,...Or];function Sr(){let i=new Map;for(let[e,t]of Object.entries(A)){for(let[n,u]of Object.entries(t))A[n]={open:`\x1B[${u[0]}m`,close:`\x1B[${u[1]}m`},t[n]=A[n],i.set(u[0],u[1]);Object.defineProperty(A,e,{value:t,enumerable:!1})}return Object.defineProperty(A,"codes",{value:i,enumerable:!1}),A.color.close="\x1B[39m",A.bgColor.close="\x1B[49m",A.color.ansi=Qt(),A.color.ansi256=Xt(),A.color.ansi16m=ei(),A.bgColor.ansi=Qt(ht),A.bgColor.ansi256=Xt(ht),A.bgColor.ansi16m=ei(ht),Object.defineProperties(A,{rgbToAnsi256:{value:(e,t,n)=>e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:e=>{let t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[n]=t;n.length===3&&(n=[...n].map(s=>s+s).join(""));let u=Number.parseInt(n,16);return[u>>16&255,u>>8&255,u&255]},enumerable:!1},hexToAnsi256:{value:e=>A.rgbToAnsi256(...A.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,n,u;if(e>=232)t=((e-232)*10+8)/255,n=t,u=t;else{e-=16;let o=e%36;t=Math.floor(e/36)/5,n=Math.floor(o/6)/5,u=o%6/5}let s=Math.max(t,n,u)*2;if(s===0)return 30;let r=30+(Math.round(u)<<2|Math.round(n)<<1|Math.round(t));return s===2&&(r+=60),r},enumerable:!1},rgbToAnsi:{value:(e,t,n)=>A.ansi256ToAnsi(A.rgbToAnsi256(e,t,n)),enumerable:!1},hexToAnsi:{value:e=>A.ansi256ToAnsi(A.hexToAnsi256(e)),enumerable:!1}}),A}var Pr=Sr(),ke=new Set(["\x1B","\x9B"]),Ir=39,ft="\x07",pi="[",kr="]",hi="m",gt=`${kr}8;;`,ti=i=>`${ke.values().next().value}${pi}${i}${hi}`,ii=i=>`${ke.values().next().value}${gt}${i}${ft}`,jr=i=>i.split(" ").map(e=>ge(e)),dt=(i,e,t)=>{let n=[...e],u=!1,s=!1,r=ge(Di(i[i.length-1]));for(let[o,a]of n.entries()){let l=ge(a);if(r+l<=t?i[i.length-1]+=a:(i.push(a),r=0),ke.has(a)&&(u=!0,s=n.slice(o+1).join("").startsWith(gt)),u){s?a===ft&&(u=!1,s=!1):a===hi&&(u=!1);continue}r+=l,r===t&&o<n.length-1&&(i.push(""),r=0)}!r&&i[i.length-1].length>0&&i.length>1&&(i[i.length-2]+=i.pop())},Rr=i=>{let e=i.split(" "),t=e.length;for(;t>0&&!(ge(e[t-1])>0);)t--;return t===e.length?i:e.slice(0,t).join(" ")+e.slice(t).join("")},Tr=(i,e,t={})=>{if(t.trim!==!1&&i.trim()==="")return"";let n="",u,s,r=jr(i),o=[""];for(let[l,c]of i.split(" ").entries()){t.trim!==!1&&(o[o.length-1]=o[o.length-1].trimStart());let p=ge(o[o.length-1]);if(l!==0&&(p>=e&&(t.wordWrap===!1||t.trim===!1)&&(o.push(""),p=0),(p>0||t.trim===!1)&&(o[o.length-1]+=" ",p++)),t.hard&&r[l]>e){let m=e-p,C=1+Math.floor((r[l]-m-1)/e);Math.floor((r[l]-1)/e)<C&&o.push(""),dt(o,c,e);continue}if(p+r[l]>e&&p>0&&r[l]>0){if(t.wordWrap===!1&&p<e){dt(o,c,e);continue}o.push("")}if(p+r[l]>e&&t.wordWrap===!1){dt(o,c,e);continue}o[o.length-1]+=c}t.trim!==!1&&(o=o.map(l=>Rr(l)));let a=[...o.join(`
|
|
24
|
-
`)];for(let[l,c]of a.entries()){if(n+=c,
|
|
25
|
-
`?(s&&(n+=
|
|
26
|
-
`&&(u&&p&&(n+=
|
|
23
|
+
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(u=>t.is(u))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Ht(i){return i.map(e=>{if(!e.startsWith("--inspect"))return e;let t,n="127.0.0.1",u="9229",s;return(s=e.match(/^(--inspect(-brk)?)$/))!==null?t=s[1]:(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=s[1],/^\d+$/.test(s[3])?u=s[3]:n=s[3]):(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=s[1],n=s[3],u=s[4]),t&&u!=="0"?`${t}=${n}:${parseInt(u)+1}`:e})}Wt.Command=Dt});var Yt=q(S=>{var{Argument:Kt}=xe(),{Command:lt}=Gt(),{CommanderError:Cr,InvalidArgumentError:Jt}=fe(),{Help:Fr}=tt(),{Option:zt}=ut();S.program=new lt;S.createCommand=i=>new lt(i);S.createOption=(i,e)=>new zt(i,e);S.createArgument=(i,e)=>new Kt(i,e);S.Command=lt;S.Option=zt;S.Argument=Kt;S.Help=Fr;S.CommanderError=Cr;S.InvalidArgumentError=Jt;S.InvalidOptionArgumentError=Jt});var pt=q((au,Qt)=>{"use strict";var ct={to(i,e){return e?`\x1B[${e+1};${i+1}H`:`\x1B[${i+1}G`},move(i,e){let t="";return i<0?t+=`\x1B[${-i}D`:i>0&&(t+=`\x1B[${i}C`),e<0?t+=`\x1B[${-e}A`:e>0&&(t+=`\x1B[${e}B`),t},up:(i=1)=>`\x1B[${i}A`,down:(i=1)=>`\x1B[${i}B`,forward:(i=1)=>`\x1B[${i}C`,backward:(i=1)=>`\x1B[${i}D`,nextLine:(i=1)=>"\x1B[E".repeat(i),prevLine:(i=1)=>"\x1B[F".repeat(i),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},Er={up:(i=1)=>"\x1B[S".repeat(i),down:(i=1)=>"\x1B[T".repeat(i)},br={screen:"\x1B[2J",up:(i=1)=>"\x1B[1J".repeat(i),down:(i=1)=>"\x1B[J".repeat(i),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(i){let e="";for(let t=0;t<i;t++)e+=this.line+(t<i-1?ct.up():"");return i&&(e+=ct.left),e}};Qt.exports={cursor:ct,scroll:Er,erase:br,beep:"\x07"}});var dt=q((Du,ht)=>{var Oe=process||{},Xt=Oe.argv||[],Be=Oe.env||{},Ar=!(Be.NO_COLOR||Xt.includes("--no-color"))&&(!!Be.FORCE_COLOR||Xt.includes("--color")||Oe.platform==="win32"||(Oe.stdout||{}).isTTY&&Be.TERM!=="dumb"||!!Be.CI),$r=(i,e,t=i)=>n=>{let u=""+n,s=u.indexOf(e,i.length);return~s?i+yr(u,e,t,s)+e:i+u+e},yr=(i,e,t,n)=>{let u="",s=0;do u+=i.substring(s,n)+t,s=n+e.length,n=i.indexOf(e,s);while(~n);return u+i.substring(s)},ei=(i=Ar)=>{let e=i?$r:()=>String;return{isColorSupported:i,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};ht.exports=ei();ht.exports.createColors=ei});var Zt=L(Yt(),1),{program:Zn,createCommand:Qn,createArgument:Xn,createOption:eu,CommanderError:tu,InvalidArgumentError:iu,InvalidOptionArgumentError:ru,Command:X,Argument:nu,Option:uu,Help:su}=Zt.default;var Ke=L(require("update-notifier"),1);var v=L(pt(),1),De=require("node:process"),ee=L(require("node:readline"),1),gt=L(require("node:readline"),1),ci=require("node:tty"),re=L(dt(),1);function wr({onlyFirst:i=!1}={}){let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(e,i?void 0:"g")}var _r=wr();function pi(i){if(typeof i!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof i}\``);return i.replace(_r,"")}function hi(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var di={exports:{}};(function(i){var e={};i.exports=e,e.eastAsianWidth=function(n){var u=n.charCodeAt(0),s=n.length==2?n.charCodeAt(1):0,r=u;return 55296<=u&&u<=56319&&56320<=s&&s<=57343&&(u&=1023,s&=1023,r=u<<10|s,r+=65536),r==12288||65281<=r&&r<=65376||65504<=r&&r<=65510?"F":r==8361||65377<=r&&r<=65470||65474<=r&&r<=65479||65482<=r&&r<=65487||65490<=r&&r<=65495||65498<=r&&r<=65500||65512<=r&&r<=65518?"H":4352<=r&&r<=4447||4515<=r&&r<=4519||4602<=r&&r<=4607||9001<=r&&r<=9002||11904<=r&&r<=11929||11931<=r&&r<=12019||12032<=r&&r<=12245||12272<=r&&r<=12283||12289<=r&&r<=12350||12353<=r&&r<=12438||12441<=r&&r<=12543||12549<=r&&r<=12589||12593<=r&&r<=12686||12688<=r&&r<=12730||12736<=r&&r<=12771||12784<=r&&r<=12830||12832<=r&&r<=12871||12880<=r&&r<=13054||13056<=r&&r<=19903||19968<=r&&r<=42124||42128<=r&&r<=42182||43360<=r&&r<=43388||44032<=r&&r<=55203||55216<=r&&r<=55238||55243<=r&&r<=55291||63744<=r&&r<=64255||65040<=r&&r<=65049||65072<=r&&r<=65106||65108<=r&&r<=65126||65128<=r&&r<=65131||110592<=r&&r<=110593||127488<=r&&r<=127490||127504<=r&&r<=127546||127552<=r&&r<=127560||127568<=r&&r<=127569||131072<=r&&r<=194367||177984<=r&&r<=196605||196608<=r&&r<=262141?"W":32<=r&&r<=126||162<=r&&r<=163||165<=r&&r<=166||r==172||r==175||10214<=r&&r<=10221||10629<=r&&r<=10630?"Na":r==161||r==164||167<=r&&r<=168||r==170||173<=r&&r<=174||176<=r&&r<=180||182<=r&&r<=186||188<=r&&r<=191||r==198||r==208||215<=r&&r<=216||222<=r&&r<=225||r==230||232<=r&&r<=234||236<=r&&r<=237||r==240||242<=r&&r<=243||247<=r&&r<=250||r==252||r==254||r==257||r==273||r==275||r==283||294<=r&&r<=295||r==299||305<=r&&r<=307||r==312||319<=r&&r<=322||r==324||328<=r&&r<=331||r==333||338<=r&&r<=339||358<=r&&r<=359||r==363||r==462||r==464||r==466||r==468||r==470||r==472||r==474||r==476||r==593||r==609||r==708||r==711||713<=r&&r<=715||r==717||r==720||728<=r&&r<=731||r==733||r==735||768<=r&&r<=879||913<=r&&r<=929||931<=r&&r<=937||945<=r&&r<=961||963<=r&&r<=969||r==1025||1040<=r&&r<=1103||r==1105||r==8208||8211<=r&&r<=8214||8216<=r&&r<=8217||8220<=r&&r<=8221||8224<=r&&r<=8226||8228<=r&&r<=8231||r==8240||8242<=r&&r<=8243||r==8245||r==8251||r==8254||r==8308||r==8319||8321<=r&&r<=8324||r==8364||r==8451||r==8453||r==8457||r==8467||r==8470||8481<=r&&r<=8482||r==8486||r==8491||8531<=r&&r<=8532||8539<=r&&r<=8542||8544<=r&&r<=8555||8560<=r&&r<=8569||r==8585||8592<=r&&r<=8601||8632<=r&&r<=8633||r==8658||r==8660||r==8679||r==8704||8706<=r&&r<=8707||8711<=r&&r<=8712||r==8715||r==8719||r==8721||r==8725||r==8730||8733<=r&&r<=8736||r==8739||r==8741||8743<=r&&r<=8748||r==8750||8756<=r&&r<=8759||8764<=r&&r<=8765||r==8776||r==8780||r==8786||8800<=r&&r<=8801||8804<=r&&r<=8807||8810<=r&&r<=8811||8814<=r&&r<=8815||8834<=r&&r<=8835||8838<=r&&r<=8839||r==8853||r==8857||r==8869||r==8895||r==8978||9312<=r&&r<=9449||9451<=r&&r<=9547||9552<=r&&r<=9587||9600<=r&&r<=9615||9618<=r&&r<=9621||9632<=r&&r<=9633||9635<=r&&r<=9641||9650<=r&&r<=9651||9654<=r&&r<=9655||9660<=r&&r<=9661||9664<=r&&r<=9665||9670<=r&&r<=9672||r==9675||9678<=r&&r<=9681||9698<=r&&r<=9701||r==9711||9733<=r&&r<=9734||r==9737||9742<=r&&r<=9743||9748<=r&&r<=9749||r==9756||r==9758||r==9792||r==9794||9824<=r&&r<=9825||9827<=r&&r<=9829||9831<=r&&r<=9834||9836<=r&&r<=9837||r==9839||9886<=r&&r<=9887||9918<=r&&r<=9919||9924<=r&&r<=9933||9935<=r&&r<=9953||r==9955||9960<=r&&r<=9983||r==10045||r==10071||10102<=r&&r<=10111||11093<=r&&r<=11097||12872<=r&&r<=12879||57344<=r&&r<=63743||65024<=r&&r<=65039||r==65533||127232<=r&&r<=127242||127248<=r&&r<=127277||127280<=r&&r<=127337||127344<=r&&r<=127386||917760<=r&&r<=917999||983040<=r&&r<=1048573||1048576<=r&&r<=1114109?"A":"N"},e.characterLength=function(n){var u=this.eastAsianWidth(n);return u=="F"||u=="W"||u=="A"?2:1};function t(n){return n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(n){for(var u=t(n),s=0,r=0;r<u.length;r++)s=s+this.characterLength(u[r]);return s},e.slice=function(n,u,s){textLen=e.length(n),u=u||0,s=s||1,u<0&&(u=textLen+u),s<0&&(s=textLen+s);for(var r="",o=0,a=t(n),l=0;l<a.length;l++){var c=a[l],p=e.length(c);if(o>=u-(p==2?1:0))if(o+p<=s)r+=c;else break;o+=p}return r}})(di);var vr=di.exports,xr=hi(vr),Br=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},Or=hi(Br);function ge(i,e={}){if(typeof i!="string"||i.length===0||(e={ambiguousIsNarrow:!0,...e},i=pi(i),i.length===0))return 0;i=i.replace(Or()," ");let t=e.ambiguousIsNarrow?1:2,n=0;for(let u of i){let s=u.codePointAt(0);if(!(s<=31||s>=127&&s<=159||s>=768&&s<=879))switch(xr.eastAsianWidth(u)){case"F":case"W":n+=2;break;case"A":n+=t;break;default:n+=1}}return n}var mt=10,ti=(i=0)=>e=>`\x1B[${e+i}m`,ii=(i=0)=>e=>`\x1B[${38+i};5;${e}m`,ri=(i=0)=>(e,t,n)=>`\x1B[${38+i};2;${e};${t};${n}m`,A={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(A.modifier);var Sr=Object.keys(A.color),Pr=Object.keys(A.bgColor);[...Sr,...Pr];function Ir(){let i=new Map;for(let[e,t]of Object.entries(A)){for(let[n,u]of Object.entries(t))A[n]={open:`\x1B[${u[0]}m`,close:`\x1B[${u[1]}m`},t[n]=A[n],i.set(u[0],u[1]);Object.defineProperty(A,e,{value:t,enumerable:!1})}return Object.defineProperty(A,"codes",{value:i,enumerable:!1}),A.color.close="\x1B[39m",A.bgColor.close="\x1B[49m",A.color.ansi=ti(),A.color.ansi256=ii(),A.color.ansi16m=ri(),A.bgColor.ansi=ti(mt),A.bgColor.ansi256=ii(mt),A.bgColor.ansi16m=ri(mt),Object.defineProperties(A,{rgbToAnsi256:{value:(e,t,n)=>e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:e=>{let t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[n]=t;n.length===3&&(n=[...n].map(s=>s+s).join(""));let u=Number.parseInt(n,16);return[u>>16&255,u>>8&255,u&255]},enumerable:!1},hexToAnsi256:{value:e=>A.rgbToAnsi256(...A.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,n,u;if(e>=232)t=((e-232)*10+8)/255,n=t,u=t;else{e-=16;let o=e%36;t=Math.floor(e/36)/5,n=Math.floor(o/6)/5,u=o%6/5}let s=Math.max(t,n,u)*2;if(s===0)return 30;let r=30+(Math.round(u)<<2|Math.round(n)<<1|Math.round(t));return s===2&&(r+=60),r},enumerable:!1},rgbToAnsi:{value:(e,t,n)=>A.ansi256ToAnsi(A.rgbToAnsi256(e,t,n)),enumerable:!1},hexToAnsi:{value:e=>A.ansi256ToAnsi(A.hexToAnsi256(e)),enumerable:!1}}),A}var kr=Ir(),je=new Set(["\x1B","\x9B"]),jr=39,Ct="\x07",mi="[",Rr="]",fi="m",Ft=`${Rr}8;;`,ni=i=>`${je.values().next().value}${mi}${i}${fi}`,ui=i=>`${je.values().next().value}${Ft}${i}${Ct}`,Tr=i=>i.split(" ").map(e=>ge(e)),ft=(i,e,t)=>{let n=[...e],u=!1,s=!1,r=ge(pi(i[i.length-1]));for(let[o,a]of n.entries()){let l=ge(a);if(r+l<=t?i[i.length-1]+=a:(i.push(a),r=0),je.has(a)&&(u=!0,s=n.slice(o+1).join("").startsWith(Ft)),u){s?a===Ct&&(u=!1,s=!1):a===fi&&(u=!1);continue}r+=l,r===t&&o<n.length-1&&(i.push(""),r=0)}!r&&i[i.length-1].length>0&&i.length>1&&(i[i.length-2]+=i.pop())},Vr=i=>{let e=i.split(" "),t=e.length;for(;t>0&&!(ge(e[t-1])>0);)t--;return t===e.length?i:e.slice(0,t).join(" ")+e.slice(t).join("")},Mr=(i,e,t={})=>{if(t.trim!==!1&&i.trim()==="")return"";let n="",u,s,r=Tr(i),o=[""];for(let[l,c]of i.split(" ").entries()){t.trim!==!1&&(o[o.length-1]=o[o.length-1].trimStart());let p=ge(o[o.length-1]);if(l!==0&&(p>=e&&(t.wordWrap===!1||t.trim===!1)&&(o.push(""),p=0),(p>0||t.trim===!1)&&(o[o.length-1]+=" ",p++)),t.hard&&r[l]>e){let m=e-p,C=1+Math.floor((r[l]-m-1)/e);Math.floor((r[l]-1)/e)<C&&o.push(""),ft(o,c,e);continue}if(p+r[l]>e&&p>0&&r[l]>0){if(t.wordWrap===!1&&p<e){ft(o,c,e);continue}o.push("")}if(p+r[l]>e&&t.wordWrap===!1){ft(o,c,e);continue}o[o.length-1]+=c}t.trim!==!1&&(o=o.map(l=>Vr(l)));let a=[...o.join(`
|
|
24
|
+
`)];for(let[l,c]of a.entries()){if(n+=c,je.has(c)){let{groups:m}=new RegExp(`(?:\\${mi}(?<code>\\d+)m|\\${Ft}(?<uri>.*)${Ct})`).exec(a.slice(l).join(""))||{groups:{}};if(m.code!==void 0){let C=Number.parseFloat(m.code);u=C===jr?void 0:C}else m.uri!==void 0&&(s=m.uri.length===0?void 0:m.uri)}let p=kr.codes.get(Number(u));a[l+1]===`
|
|
25
|
+
`?(s&&(n+=ui("")),u&&p&&(n+=ni(p))):c===`
|
|
26
|
+
`&&(u&&p&&(n+=ni(u)),s&&(n+=ui(s)))}return n};function si(i,e,t){return String(i).normalize().replace(/\r\n/g,`
|
|
27
27
|
`).split(`
|
|
28
|
-
`).map(n=>
|
|
29
|
-
`)}var
|
|
28
|
+
`).map(n=>Mr(n,e,t)).join(`
|
|
29
|
+
`)}var Nr=Object.defineProperty,Ur=(i,e,t)=>e in i?Nr(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,P=(i,e,t)=>(Ur(i,typeof e!="symbol"?e+"":e,t),t);function qr(i,e){if(i===e)return;let t=i.split(`
|
|
30
30
|
`),n=e.split(`
|
|
31
|
-
`),u=[];for(let s=0;s<Math.max(t.length,n.length);s++)t[s]!==n[s]&&u.push(s);return u}var
|
|
32
|
-
`),
|
|
33
|
-
`).length-1;this.output.write(v.cursor.move(-999,e*-1))}render(){let e=
|
|
31
|
+
`),u=[];for(let s=0;s<Math.max(t.length,n.length);s++)t[s]!==n[s]&&u.push(s);return u}var gi=Symbol("clack:cancel");function b(i){return i===gi}function Se(i,e){i.isTTY&&i.setRawMode(e)}var oi=new Map([["k","up"],["j","down"],["h","left"],["l","right"]]),Lr=new Set(["up","down","left","right","space","enter"]),ne=class{constructor({render:e,input:t=De.stdin,output:n=De.stdout,...u},s=!0){P(this,"input"),P(this,"output"),P(this,"rl"),P(this,"opts"),P(this,"_track",!1),P(this,"_render"),P(this,"_cursor",0),P(this,"state","initial"),P(this,"value"),P(this,"error",""),P(this,"subscribers",new Map),P(this,"_prevFrame",""),this.opts=u,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=e.bind(this),this._track=s,this.input=t,this.output=n}prompt(){let e=new ci.WriteStream(0);return e._write=(t,n,u)=>{this._track&&(this.value=this.rl.line.replace(/\t/g,""),this._cursor=this.rl.cursor,this.emit("value",this.value)),u()},this.input.pipe(e),this.rl=gt.default.createInterface({input:this.input,output:e,tabSize:2,prompt:"",escapeCodeTimeout:50}),gt.default.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),Se(this.input,!0),this.output.on("resize",this.render),this.render(),new Promise((t,n)=>{this.once("submit",()=>{this.output.write(v.cursor.show),this.output.off("resize",this.render),Se(this.input,!1),t(this.value)}),this.once("cancel",()=>{this.output.write(v.cursor.show),this.output.off("resize",this.render),Se(this.input,!1),t(gi)})})}on(e,t){let n=this.subscribers.get(e)??[];n.push({cb:t}),this.subscribers.set(e,n)}once(e,t){let n=this.subscribers.get(e)??[];n.push({cb:t,once:!0}),this.subscribers.set(e,n)}emit(e,...t){let n=this.subscribers.get(e)??[],u=[];for(let s of n)s.cb(...t),s.once&&u.push(()=>n.splice(n.indexOf(s),1));for(let s of u)s()}unsubscribe(){this.subscribers.clear()}onKeypress(e,t){if(this.state==="error"&&(this.state="active"),t?.name&&!this._track&&oi.has(t.name)&&this.emit("cursor",oi.get(t.name)),t?.name&&Lr.has(t.name)&&this.emit("cursor",t.name),e&&(e.toLowerCase()==="y"||e.toLowerCase()==="n")&&this.emit("confirm",e.toLowerCase()==="y"),e===" "&&this.opts.placeholder&&(this.value||(this.rl.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),e&&this.emit("key",e.toLowerCase()),t?.name==="return"){if(this.opts.validate){let n=this.opts.validate(this.value);n&&(this.error=n,this.state="error",this.rl.write(this.value))}this.state!=="error"&&(this.state="submit")}e===""&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
|
|
32
|
+
`),Se(this.input,!1),this.rl.close(),this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=si(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
|
|
33
|
+
`).length-1;this.output.write(v.cursor.move(-999,e*-1))}render(){let e=si(this._render(this)??"",process.stdout.columns,{hard:!0});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(v.cursor.hide);else{let t=qr(this._prevFrame,e);if(this.restoreCursor(),t&&t?.length===1){let n=t[0];this.output.write(v.cursor.move(0,n)),this.output.write(v.erase.lines(1));let u=e.split(`
|
|
34
34
|
`);this.output.write(u[n]),this._prevFrame=e,this.output.write(v.cursor.move(0,u.length-n-1));return}else if(t&&t?.length>1){let n=t[0];this.output.write(v.cursor.move(0,n)),this.output.write(v.erase.down());let u=e.split(`
|
|
35
35
|
`).slice(n);this.output.write(u.join(`
|
|
36
|
-
`)),this._prevFrame=e;return}this.output.write(v.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}},
|
|
36
|
+
`)),this._prevFrame=e;return}this.output.write(v.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}},Pe=class extends ne{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(e){super(e,!1),this.value=!!e.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",t=>{this.output.write(v.cursor.move(0,-1)),this.value=t,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};var Hr=Object.defineProperty,Wr=(i,e,t)=>e in i?Hr(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,ai=(i,e,t)=>(Wr(i,typeof e!="symbol"?e+"":e,t),t),Ci=class extends ne{constructor(i){super(i,!1),ai(this,"options"),ai(this,"cursor",0),this.options=i.options,this.value=[...i.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:e})=>e===i.cursorAt),0),this.on("key",e=>{e==="a"&&this.toggleAll()}),this.on("cursor",e=>{switch(e){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break;case"space":this.toggleValue();break}})}get _value(){return this.options[this.cursor].value}toggleAll(){let i=this.value.length===this.options.length;this.value=i?[]:this.options.map(e=>e.value)}toggleValue(){let i=this.value.includes(this._value);this.value=i?this.value.filter(e=>e!==this._value):[...this.value,this._value]}},Gr=Object.defineProperty,Kr=(i,e,t)=>e in i?Gr(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,Di=(i,e,t)=>(Kr(i,typeof e!="symbol"?e+"":e,t),t),Ie=class extends ne{constructor({mask:e,...t}){super(t),Di(this,"valueWithCursor",""),Di(this,"_mask","\u2022"),this._mask=e??"\u2022",this.on("finalize",()=>{this.valueWithCursor=this.masked}),this.on("value",()=>{if(this.cursor>=this.value.length)this.valueWithCursor=`${this.masked}${re.default.inverse(re.default.hidden("_"))}`;else{let n=this.masked.slice(0,this.cursor),u=this.masked.slice(this.cursor);this.valueWithCursor=`${n}${re.default.inverse(u[0])}${u.slice(1)}`}})}get cursor(){return this._cursor}get masked(){return this.value.replaceAll(/./g,this._mask)}},Jr=Object.defineProperty,zr=(i,e,t)=>e in i?Jr(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,li=(i,e,t)=>(zr(i,typeof e!="symbol"?e+"":e,t),t),Fi=class extends ne{constructor(i){super(i,!1),li(this,"options"),li(this,"cursor",0),this.options=i.options,this.cursor=this.options.findIndex(({value:e})=>e===i.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",e=>{switch(e){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}};var Yr=Object.defineProperty,Zr=(i,e,t)=>e in i?Yr(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,Qr=(i,e,t)=>(Zr(i,typeof e!="symbol"?e+"":e,t),t),ke=class extends ne{constructor(e){super(e),Qr(this,"valueWithCursor",""),this.on("finalize",()=>{this.value||(this.value=e.defaultValue),this.valueWithCursor=this.value}),this.on("value",()=>{if(this.cursor>=this.value.length)this.valueWithCursor=`${this.value}${re.default.inverse(re.default.hidden("_"))}`;else{let t=this.value.slice(0,this.cursor),n=this.value.slice(this.cursor);this.valueWithCursor=`${t}${re.default.inverse(n[0])}${n.slice(1)}`}})}get cursor(){return this._cursor}},Xr=globalThis.process.platform.startsWith("win");function Ei({input:i=De.stdin,output:e=De.stdout,overwrite:t=!0,hideCursor:n=!0}={}){let u=ee.createInterface({input:i,output:e,prompt:"",tabSize:1});ee.emitKeypressEvents(i,u),i.isTTY&&i.setRawMode(!0);let s=(r,{name:o})=>{if(String(r)===""){n&&e.write(v.cursor.show),process.exit(0);return}if(!t)return;ee.moveCursor(e,o==="return"?0:-1,o==="return"?-1:0,()=>{ee.clearLine(e,1,()=>{i.once("keypress",s)})})};return n&&e.write(v.cursor.hide),i.once("keypress",s),()=>{i.off("keypress",s),n&&e.write(v.cursor.show),i.isTTY&&!Xr&&i.setRawMode(!1),u.terminal=!1,u.close()}}var I=L(require("node:process"),1),D=L(dt(),1),le=L(pt(),1);function en(){return I.default.platform!=="win32"?I.default.env.TERM!=="linux":!!I.default.env.CI||!!I.default.env.WT_SESSION||!!I.default.env.TERMINUS_SUBLIME||I.default.env.ConEmuTask==="{cmd::Cmder}"||I.default.env.TERM_PROGRAM==="Terminus-Sublime"||I.default.env.TERM_PROGRAM==="vscode"||I.default.env.TERM==="xterm-256color"||I.default.env.TERM==="alacritty"||I.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var bt=en(),y=(i,e)=>bt?i:e,tn=y("\u25C6","*"),$i=y("\u25A0","x"),yi=y("\u25B2","x"),Re=y("\u25C7","o"),rn=y("\u250C","T"),g=y("\u2502","|"),T=y("\u2514","\u2014"),At=y("\u25CF",">"),$t=y("\u25CB"," "),nn=y("\u25FB","[\u2022]"),bi=y("\u25FC","[+]"),un=y("\u25FB","[ ]"),sn=y("\u25AA","\u2022"),Ai=y("\u2500","-"),on=y("\u256E","+"),an=y("\u251C","+"),Dn=y("\u256F","+"),ln=y("\u25CF","\u2022"),cn=y("\u25C6","*"),pn=y("\u25B2","!"),hn=y("\u25A0","x"),Ce=i=>{switch(i){case"initial":case"active":return D.default.cyan(tn);case"cancel":return D.default.red($i);case"error":return D.default.yellow(yi);case"submit":return D.default.green(Re)}},x=i=>new ke({validate:i.validate,placeholder:i.placeholder,defaultValue:i.defaultValue,initialValue:i.initialValue,render(){let e=`${D.default.gray(g)}
|
|
37
37
|
${Ce(this.state)} ${i.message}
|
|
38
38
|
`,t=i.placeholder?D.default.inverse(i.placeholder[0])+D.default.dim(i.placeholder.slice(1)):D.default.inverse(D.default.hidden("_")),n=this.value?this.valueWithCursor:t;switch(this.state){case"error":return`${e.trim()}
|
|
39
39
|
${D.default.yellow(g)} ${n}
|
|
40
|
-
${D.default.yellow(
|
|
40
|
+
${D.default.yellow(T)} ${D.default.yellow(this.error)}
|
|
41
41
|
`;case"submit":return`${e}${D.default.gray(g)} ${D.default.dim(this.value||i.placeholder)}`;case"cancel":return`${e}${D.default.gray(g)} ${D.default.strikethrough(D.default.dim(this.value??""))}${this.value?.trim()?`
|
|
42
42
|
`+D.default.gray(g):""}`;default:return`${e}${D.default.cyan(g)} ${n}
|
|
43
|
-
${D.default.cyan(
|
|
44
|
-
`}}}).prompt(),
|
|
43
|
+
${D.default.cyan(T)}
|
|
44
|
+
`}}}).prompt(),Te=i=>new Ie({validate:i.validate,mask:i.mask??sn,render(){let e=`${D.default.gray(g)}
|
|
45
45
|
${Ce(this.state)} ${i.message}
|
|
46
46
|
`,t=this.valueWithCursor,n=this.masked;switch(this.state){case"error":return`${e.trim()}
|
|
47
47
|
${D.default.yellow(g)} ${n}
|
|
48
|
-
${D.default.yellow(
|
|
48
|
+
${D.default.yellow(T)} ${D.default.yellow(this.error)}
|
|
49
49
|
`;case"submit":return`${e}${D.default.gray(g)} ${D.default.dim(n)}`;case"cancel":return`${e}${D.default.gray(g)} ${D.default.strikethrough(D.default.dim(n??""))}${n?`
|
|
50
50
|
`+D.default.gray(g):""}`;default:return`${e}${D.default.cyan(g)} ${t}
|
|
51
|
-
${D.default.cyan(
|
|
52
|
-
`}}}).prompt(),Fe=i=>{let e=i.active??"Yes",t=i.inactive??"No";return new
|
|
51
|
+
${D.default.cyan(T)}
|
|
52
|
+
`}}}).prompt(),Fe=i=>{let e=i.active??"Yes",t=i.inactive??"No";return new Pe({active:e,inactive:t,initialValue:i.initialValue??!0,render(){let n=`${D.default.gray(g)}
|
|
53
53
|
${Ce(this.state)} ${i.message}
|
|
54
54
|
`,u=this.value?e:t;switch(this.state){case"submit":return`${n}${D.default.gray(g)} ${D.default.dim(u)}`;case"cancel":return`${n}${D.default.gray(g)} ${D.default.strikethrough(D.default.dim(u))}
|
|
55
|
-
${D.default.gray(g)}`;default:return`${n}${D.default.cyan(g)} ${this.value?`${D.default.green(
|
|
56
|
-
${D.default.cyan(
|
|
57
|
-
`}}}).prompt()},te=i=>{let e=(n,u)=>{let s=n.label??String(n.value);return u==="active"?`${D.default.green(
|
|
55
|
+
${D.default.gray(g)}`;default:return`${n}${D.default.cyan(g)} ${this.value?`${D.default.green(At)} ${e}`:`${D.default.dim($t)} ${D.default.dim(e)}`} ${D.default.dim("/")} ${this.value?`${D.default.dim($t)} ${D.default.dim(t)}`:`${D.default.green(At)} ${t}`}
|
|
56
|
+
${D.default.cyan(T)}
|
|
57
|
+
`}}}).prompt()},te=i=>{let e=(n,u)=>{let s=n.label??String(n.value);return u==="active"?`${D.default.green(At)} ${s} ${n.hint?D.default.dim(`(${n.hint})`):""}`:u==="selected"?`${D.default.dim(s)}`:u==="cancelled"?`${D.default.strikethrough(D.default.dim(s))}`:`${D.default.dim($t)} ${D.default.dim(s)}`},t=0;return new Fi({options:i.options,initialValue:i.initialValue,render(){let n=`${D.default.gray(g)}
|
|
58
58
|
${Ce(this.state)} ${i.message}
|
|
59
59
|
`;switch(this.state){case"submit":return`${n}${D.default.gray(g)} ${e(this.options[this.cursor],"selected")}`;case"cancel":return`${n}${D.default.gray(g)} ${e(this.options[this.cursor],"cancelled")}
|
|
60
60
|
${D.default.gray(g)}`;default:{let u=i.maxItems===void 0?1/0:Math.max(i.maxItems,5);this.cursor>=t+u-3?t=Math.max(Math.min(this.cursor-u+3,this.options.length-u),0):this.cursor<t+2&&(t=Math.max(this.cursor-2,0));let s=u<this.options.length&&t>0,r=u<this.options.length&&t+u<this.options.length;return`${n}${D.default.cyan(g)} ${this.options.slice(t,t+u).map((o,a,l)=>a===0&&s?D.default.dim("..."):a===l.length-1&&r?D.default.dim("..."):e(o,a+t===this.cursor?"active":"inactive")).join(`
|
|
61
61
|
${D.default.cyan(g)} `)}
|
|
62
|
-
${D.default.cyan(
|
|
63
|
-
`}}}}).prompt()};var
|
|
62
|
+
${D.default.cyan(T)}
|
|
63
|
+
`}}}}).prompt()};var wi=i=>{let e=(t,n)=>{let u=t.label??String(t.value);return n==="active"?`${D.default.cyan(nn)} ${u} ${t.hint?D.default.dim(`(${t.hint})`):""}`:n==="selected"?`${D.default.green(bi)} ${D.default.dim(u)}`:n==="cancelled"?`${D.default.strikethrough(D.default.dim(u))}`:n==="active-selected"?`${D.default.green(bi)} ${u} ${t.hint?D.default.dim(`(${t.hint})`):""}`:n==="submitted"?`${D.default.dim(u)}`:`${D.default.dim(un)} ${D.default.dim(u)}`};return new Ci({options:i.options,initialValues:i.initialValues,required:i.required??!0,cursorAt:i.cursorAt,validate(t){if(this.required&&t.length===0)return`Please select at least one option.
|
|
64
64
|
${D.default.reset(D.default.dim(`Press ${D.default.gray(D.default.bgWhite(D.default.inverse(" space ")))} to select, ${D.default.gray(D.default.bgWhite(D.default.inverse(" enter ")))} to submit`))}`},render(){let t=`${D.default.gray(g)}
|
|
65
65
|
${Ce(this.state)} ${i.message}
|
|
66
66
|
`;switch(this.state){case"submit":return`${t}${D.default.gray(g)} ${this.options.filter(({value:n})=>this.value.includes(n)).map(n=>e(n,"submitted")).join(D.default.dim(", "))||D.default.dim("none")}`;case"cancel":{let n=this.options.filter(({value:u})=>this.value.includes(u)).map(u=>e(u,"cancelled")).join(D.default.dim(", "));return`${t}${D.default.gray(g)} ${n.trim()?`${n}
|
|
67
67
|
${D.default.gray(g)}`:""}`}case"error":{let n=this.error.split(`
|
|
68
|
-
`).map((u,s)=>s===0?`${D.default.yellow(
|
|
68
|
+
`).map((u,s)=>s===0?`${D.default.yellow(T)} ${D.default.yellow(u)}`:` ${u}`).join(`
|
|
69
69
|
`);return t+D.default.yellow(g)+" "+this.options.map((u,s)=>{let r=this.value.includes(u.value),o=s===this.cursor;return o&&r?e(u,"active-selected"):r?e(u,"selected"):e(u,o?"active":"inactive")}).join(`
|
|
70
70
|
${D.default.yellow(g)} `)+`
|
|
71
71
|
`+n+`
|
|
72
72
|
`}default:return`${t}${D.default.cyan(g)} ${this.options.map((n,u)=>{let s=this.value.includes(n.value),r=u===this.cursor;return r&&s?e(n,"active-selected"):s?e(n,"selected"):e(n,r?"active":"inactive")}).join(`
|
|
73
73
|
${D.default.cyan(g)} `)}
|
|
74
|
-
${D.default.cyan(
|
|
75
|
-
`}}}).prompt()};var
|
|
74
|
+
${D.default.cyan(T)}
|
|
75
|
+
`}}}).prompt()};var Et=i=>i.replace(dn(),""),W=(i="",e="")=>{let t=`
|
|
76
76
|
${i}
|
|
77
77
|
`.split(`
|
|
78
|
-
`),n=
|
|
78
|
+
`),n=Et(e).length,u=Math.max(t.reduce((r,o)=>(o=Et(o),o.length>r?o.length:r),0),n)+2,s=t.map(r=>`${D.default.gray(g)} ${D.default.dim(r)}${" ".repeat(u-Et(r).length)}${D.default.gray(g)}`).join(`
|
|
79
79
|
`);process.stdout.write(`${D.default.gray(g)}
|
|
80
|
-
${D.default.green(
|
|
80
|
+
${D.default.green(Re)} ${D.default.reset(e)} ${D.default.gray(Ai.repeat(Math.max(u-n-1,1))+on)}
|
|
81
81
|
${s}
|
|
82
|
-
${D.default.gray(
|
|
83
|
-
`)},w=(i="")=>{process.stdout.write(`${D.default.gray(
|
|
82
|
+
${D.default.gray(an+Ai.repeat(u+2)+Dn)}
|
|
83
|
+
`)},w=(i="")=>{process.stdout.write(`${D.default.gray(T)} ${D.default.red(i)}
|
|
84
84
|
|
|
85
|
-
`)},ue=(i="")=>{process.stdout.write(`${D.default.gray(
|
|
85
|
+
`)},ue=(i="")=>{process.stdout.write(`${D.default.gray(rn)} ${i}
|
|
86
86
|
`)},ce=(i="")=>{process.stdout.write(`${D.default.gray(g)}
|
|
87
|
-
${D.default.gray(
|
|
87
|
+
${D.default.gray(T)} ${i}
|
|
88
88
|
|
|
89
89
|
`)},d={message:(i="",{symbol:e=D.default.gray(g)}={})=>{let t=[`${D.default.gray(g)}`];if(i){let[n,...u]=i.split(`
|
|
90
90
|
`);t.push(`${e} ${n}`,...u.map(s=>`${D.default.gray(g)} ${s}`))}process.stdout.write(`${t.join(`
|
|
91
91
|
`)}
|
|
92
|
-
`)},info:i=>{d.message(i,{symbol:D.default.blue(
|
|
93
|
-
`);let p=0,m=0;n=setInterval(()=>{let C=D.default.magenta(i[p]),h=".".repeat(Math.floor(m)).slice(0,3);process.stdout.write(le.cursor.move(-999,0)),process.stdout.write(le.erase.down(1)),process.stdout.write(`${C} ${s}${h}`),p=p+1<i.length?p+1:0,m=m<i.length?m+.125:0},e)},o=(c="",p=0)=>{s=c??s,u=!1,clearInterval(n);let m=p===0?D.default.green(
|
|
94
|
-
`),t()},a=(c="")=>{s=c??s},l=c=>{let p=c>1?"Something went wrong":"Canceled";u&&o(p,c)};return process.on("uncaughtExceptionMonitor",()=>l(2)),process.on("unhandledRejection",()=>l(2)),process.on("SIGINT",()=>l(1)),process.on("SIGTERM",()=>l(1)),process.on("exit",l),{start:r,stop:o,message:a}};function
|
|
95
|
-
--- API Request ---`),console.error(`${u.method} ${u.url}`),u.headers){let s=Object.fromEntries(u.headers.entries());s.authorization&&(s.authorization
|
|
96
|
-
`)}catch(s){console.error("Error logging request:",s instanceof Error?s.message:s)}return u}}),t}function
|
|
92
|
+
`)},info:i=>{d.message(i,{symbol:D.default.blue(ln)})},success:i=>{d.message(i,{symbol:D.default.green(cn)})},step:i=>{d.message(i,{symbol:D.default.green(Re)})},warn:i=>{d.message(i,{symbol:D.default.yellow(pn)})},warning:i=>{d.warn(i)},error:i=>{d.message(i,{symbol:D.default.red(hn)})}},ie=()=>{let i=bt?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],e=bt?80:120,t,n,u=!1,s="",r=(c="")=>{u=!0,t=Ei(),s=c.replace(/\.+$/,""),process.stdout.write(`${D.default.gray(g)}
|
|
93
|
+
`);let p=0,m=0;n=setInterval(()=>{let C=D.default.magenta(i[p]),h=".".repeat(Math.floor(m)).slice(0,3);process.stdout.write(le.cursor.move(-999,0)),process.stdout.write(le.erase.down(1)),process.stdout.write(`${C} ${s}${h}`),p=p+1<i.length?p+1:0,m=m<i.length?m+.125:0},e)},o=(c="",p=0)=>{s=c??s,u=!1,clearInterval(n);let m=p===0?D.default.green(Re):p===1?D.default.red($i):D.default.red(yi);process.stdout.write(le.cursor.move(-999,0)),process.stdout.write(le.erase.down(1)),process.stdout.write(`${m} ${s}
|
|
94
|
+
`),t()},a=(c="")=>{s=c??s},l=c=>{let p=c>1?"Something went wrong":"Canceled";u&&o(p,c)};return process.on("uncaughtExceptionMonitor",()=>l(2)),process.on("unhandledRejection",()=>l(2)),process.on("SIGINT",()=>l(1)),process.on("SIGTERM",()=>l(1)),process.on("exit",l),{start:r,stop:o,message:a}};function dn(){let i=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(i,"g")}var mn={"Content-Type":"application/json"},fn=/\{[^{}]+\}/g,yt=class extends Request{constructor(e,t){super(e,t);for(let n in t)n in this||(this[n]=t[n])}};function wt(i){let{baseUrl:e="",fetch:t=globalThis.fetch,querySerializer:n,bodySerializer:u,headers:s,...r}={...i};e.endsWith("/")&&(e=e.substring(0,e.length-1)),s=vi(mn,s);let o=[];async function a(l,c){let{fetch:p=t,headers:m,params:C={},parseAs:h="json",querySerializer:f,bodySerializer:F=u??Cn,...E}=c||{},O=typeof n=="function"?n:_i(n);f&&(O=typeof f=="function"?f:_i({...typeof n=="object"?n:{},...f}));let U={redirect:"follow",...r,...E,headers:vi(s,m,C.header)};U.body&&(U.body=F(U.body)),U.body instanceof FormData&&U.headers.delete("Content-Type");let Y=new yt(Fn(l,{baseUrl:e,params:C,querySerializer:O}),U),Tt={baseUrl:e,fetch:p,parseAs:h,querySerializer:O,bodySerializer:F};for(let Z of o)if(Z&&typeof Z=="object"&&typeof Z.onRequest=="function"){Y.schemaPath=l,Y.params=C;let Q=await Z.onRequest(Y,Tt);if(Q){if(!(Q instanceof Request))throw new Error("Middleware must return new Request() when modifying the request");Y=Q}}let B=await p(Y);for(let Z=o.length-1;Z>=0;Z--){let Q=o[Z];if(Q&&typeof Q=="object"&&typeof Q.onResponse=="function"){Y.schemaPath=l,Y.params=C;let ze=await Q.onResponse(B,Tt,Y);if(ze){if(!(ze instanceof Response))throw new Error("Middleware must return new Response() when modifying the response");B=ze}}}if(B.status===204||B.headers.get("Content-Length")==="0")return B.ok?{data:{},response:B}:{error:{},response:B};if(B.ok)return h==="stream"?{data:B.body,response:B}:{data:await B[h](),response:B};let Je=await B.text();try{Je=JSON.parse(Je)}catch{}return{error:Je,response:B}}return{async GET(l,c){return a(l,{...c,method:"GET"})},async PUT(l,c){return a(l,{...c,method:"PUT"})},async POST(l,c){return a(l,{...c,method:"POST"})},async DELETE(l,c){return a(l,{...c,method:"DELETE"})},async OPTIONS(l,c){return a(l,{...c,method:"OPTIONS"})},async HEAD(l,c){return a(l,{...c,method:"HEAD"})},async PATCH(l,c){return a(l,{...c,method:"PATCH"})},async TRACE(l,c){return a(l,{...c,method:"TRACE"})},use(...l){for(let c of l)if(c){if(typeof c!="object"||!("onRequest"in c||"onResponse"in c))throw new Error("Middleware must be an object with one of `onRequest()` or `onResponse()`");o.push(c)}},eject(...l){for(let c of l){let p=o.indexOf(c);p!==-1&&o.splice(p,1)}}}}function Ve(i,e,t){if(e==null)return"";if(typeof e=="object")throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");return`${i}=${t?.allowReserved===!0?e:encodeURIComponent(e)}`}function xi(i,e,t){if(!e||typeof e!="object")return"";let n=[],u={simple:",",label:".",matrix:";"}[t.style]||"&";if(t.style!=="deepObject"&&t.explode===!1){for(let o in e)n.push(o,t.allowReserved===!0?e[o]:encodeURIComponent(e[o]));let r=n.join(",");switch(t.style){case"form":return`${i}=${r}`;case"label":return`.${r}`;case"matrix":return`;${i}=${r}`;default:return r}}for(let r in e){let o=t.style==="deepObject"?`${i}[${r}]`:r;n.push(Ve(o,e[r],t))}let s=n.join(u);return t.style==="label"||t.style==="matrix"?`${u}${s}`:s}function Bi(i,e,t){if(!Array.isArray(e))return"";if(t.explode===!1){let s={form:",",spaceDelimited:"%20",pipeDelimited:"|"}[t.style]||",",r=(t.allowReserved===!0?e:e.map(o=>encodeURIComponent(o))).join(s);switch(t.style){case"simple":return r;case"label":return`.${r}`;case"matrix":return`;${i}=${r}`;default:return`${i}=${r}`}}let n={simple:",",label:".",matrix:";"}[t.style]||"&",u=[];for(let s of e)t.style==="simple"||t.style==="label"?u.push(t.allowReserved===!0?s:encodeURIComponent(s)):u.push(Ve(i,s,t));return t.style==="label"||t.style==="matrix"?`${n}${u.join(n)}`:u.join(n)}function _i(i){return function(t){let n=[];if(t&&typeof t=="object")for(let u in t){let s=t[u];if(s!=null){if(Array.isArray(s)){n.push(Bi(u,s,{style:"form",explode:!0,...i?.array,allowReserved:i?.allowReserved||!1}));continue}if(typeof s=="object"){n.push(xi(u,s,{style:"deepObject",explode:!0,...i?.object,allowReserved:i?.allowReserved||!1}));continue}n.push(Ve(u,s,i))}}return n.join("&")}}function gn(i,e){let t=i;for(let n of i.match(fn)??[]){let u=n.substring(1,n.length-1),s=!1,r="simple";if(u.endsWith("*")&&(s=!0,u=u.substring(0,u.length-1)),u.startsWith(".")?(r="label",u=u.substring(1)):u.startsWith(";")&&(r="matrix",u=u.substring(1)),!e||e[u]===void 0||e[u]===null)continue;let o=e[u];if(Array.isArray(o)){t=t.replace(n,Bi(u,o,{style:r,explode:s}));continue}if(typeof o=="object"){t=t.replace(n,xi(u,o,{style:r,explode:s}));continue}if(r==="matrix"){t=t.replace(n,`;${Ve(u,o)}`);continue}t=t.replace(n,r==="label"?`.${o}`:o)}return t}function Cn(i){return JSON.stringify(i)}function Fn(i,e){let t=`${e.baseUrl}${i}`;e.params?.path&&(t=gn(t,e.params.path));let n=e.querySerializer(e.params.query??{});return n.startsWith("?")&&(n=n.substring(1)),n&&(t+=`?${n}`),t}function vi(...i){let e=new Headers;for(let t of i){if(!t||typeof t!="object")continue;let n=t instanceof Headers?t.entries():Object.entries(t);for(let[u,s]of n)if(s===null)e.delete(u);else if(Array.isArray(s))for(let r of s)e.append(u,r);else s!==void 0&&e.set(u,s)}return e}var K=require("node:fs"),Oi=require("node:os"),vt=require("node:path");var se=class extends Error{constructor(e){super(e),this.name="CliError"}},V=class extends se{constructor(e){super(e),this.name="ConfigError"}},k=class extends se{constructor(t,n,u,s){super(`API Error (${t}): ${n}`);this.statusCode=t;this.errorType=u;this.details=s;this.name="ApiError"}},G=class extends se{constructor(t,n,u){super(`Job ${t}: ${n??"Unknown error"}`);this.status=t;this.errorMessage=n;this.details=u;this.name="JobError"}formatDetails(){let t=[this.message];if(this.details){let n=this.details.results;if(n)for(let[u,s]of Object.entries(n))s.status==="failed"&&s.error_message&&t.push(` ${u}: ${s.error_message}`)}return t}},Me=class extends se{constructor(e){super(e),this.name="TimeoutError"}};function pe(i,e){let t=i!=null&&typeof i=="object",n=t&&"message"in i?String(i.message):`HTTP ${e?.status??"unknown"} error`,u=t&&"statusCode"in i?i.statusCode:e?.status,s=[];if(t&&"details"in i&&Array.isArray(i.details))for(let r of i.details)r&&typeof r=="object"&&"message"in r&&s.push(String(r.message));return new k(u??400,n,void 0,s.length>0?s:void 0)}var oe=class extends se{constructor(e){super(e),this.name="ValidationError"}};var _t=(0,vt.join)((0,Oi.homedir)(),".descript-cli"),be=(0,vt.join)(_t,"config.json"),J="https://descriptapi.com/v1/",Ne="default";function En(){(0,K.existsSync)(_t)||(0,K.mkdirSync)(_t,{recursive:!0})}function j(){try{if((0,K.existsSync)(be)){let i=(0,K.readFileSync)(be,"utf-8"),e=JSON.parse(i);return e.profiles?e:{activeProfile:Ne,profiles:{[Ne]:{apiKey:e.apiKey,apiUrl:e.apiUrl,debug:e.debug}}}}}catch(i){console.error(`Warning: Could not parse config file at ${be}`),i instanceof Error&&console.error(` ${i.message}`)}return{activeProfile:Ne,profiles:{}}}function ae(i){En(),(0,K.writeFileSync)(be,JSON.stringify(i,null,2))}function Ue(){let i=j(),e=process.env.DESCRIPT_PROFILE||i.activeProfile;return i.profiles[e]||{}}function he(){return process.env.DESCRIPT_API_KEY?process.env.DESCRIPT_API_KEY:Ue().apiKey}function Ae(i){let e=j(),t=e.activeProfile;e.profiles[t]||(e.profiles[t]={}),e.profiles[t].apiKey=i,ae(e)}function $e(){return be}function M(){return process.env.DESCRIPT_API_URL?process.env.DESCRIPT_API_URL:Ue().apiUrl??J}function ye(){return Ue().apiUrl}function qe(i){let e=j(),t=e.activeProfile;e.profiles[t]||(e.profiles[t]={}),e.profiles[t].apiUrl=i,ae(e)}function xt(){let i=j(),e=i.activeProfile;i.profiles[e]&&(delete i.profiles[e].apiUrl,ae(i))}function _(){return process.env.DESCRIPT_DEBUG?process.env.DESCRIPT_DEBUG==="true"||process.env.DESCRIPT_DEBUG==="1":Ue().debug??!1}function Bt(i){let e=j(),t=e.activeProfile;e.profiles[t]||(e.profiles[t]={}),e.profiles[t].debug=i,ae(e)}function Le(){return process.env.DESCRIPT_PROFILE?process.env.DESCRIPT_PROFILE:j().activeProfile}function Ot(){let i=j();return Object.keys(i.profiles)}function St(i){let e=j();if(!e.profiles[i])throw new V(`Profile "${i}" does not exist`);e.activeProfile=i,ae(e)}function Pt(i){let e=j();if(e.profiles[i])throw new V(`Profile "${i}" already exists`);e.profiles[i]={},ae(e)}function Si(i){let e=j();if(i===Ne)throw new V("Cannot delete the default profile");if(!e.profiles[i])throw new V(`Profile "${i}" does not exist`);if(e.activeProfile===i)throw new V("Cannot delete the active profile. Switch to another profile first.");delete e.profiles[i],ae(e)}function Pi(i){let e=j();return i in e.profiles}var bn="@descript/platform-cli",An="0.2.7";function $n(i){return i.length<=12?"Bearer ***":`Bearer ${i.slice(0,8)}...${i.slice(-4)}`}function Ii(i,e){let t=wt({baseUrl:e,headers:{Authorization:`Bearer ${i}`,"User-Agent":`${bn}/${An} node/${process.version}`}});return _()&&t.use({async onRequest(u){try{if(console.error(`
|
|
95
|
+
--- API Request ---`),console.error(`${u.method} ${u.url}`),u.headers){let s=Object.fromEntries(u.headers.entries());s.authorization&&(s.authorization=$n(i)),console.error("Headers:",s)}if(u.body)try{let r=await u.clone().text();r&&console.error("Body:",JSON.stringify(JSON.parse(r),null,2))}catch{}console.error(`-------------------
|
|
96
|
+
`)}catch(s){console.error("Error logging request:",s instanceof Error?s.message:s)}return u}}),t}function He(){let i=he();if(!i)throw new V("API key not configured. Run `descript-api config` to set up.");return Ii(i,M())}function ki(i){return Ii(i,M())}var me=["api-key","api-url","debug"];function ji(i){return i.length<=12?"***":i.slice(0,8)+"..."+i.slice(-4)}function de(i){switch(i){case"api-key":return he();case"api-url":return ye();case"debug":return _()}}function It(i,e){switch(i){case"api-key":Ae(e);break;case"api-url":qe(e);break;case"debug":Bt(e);break}}function Ri(i,e){if(i==="api-url"){let t=M();return e||`${t} (default)`}return i==="debug"?e?"enabled":"disabled":e?i==="api-key"?ji(e):e:"Not configured"}async function kt(i){let e=ie();e.start("Validating API key...");try{let t=ki(i),{error:n}=await t.GET("/status");return n!=null&&typeof n=="object"&&"error"in n&&n.error==="unauthorized"?(e.stop("Invalid API key"),!1):(e.stop("API key validated successfully!"),!0)}catch{return e.stop("Could not validate (saved anyway)"),!0}}var N=new X("config").description("Manage CLI configuration").addHelpText("after",`
|
|
97
97
|
Profile Commands:
|
|
98
98
|
config profiles List all profiles (* marks active)
|
|
99
99
|
config profile <name> Switch to a different profile
|
|
@@ -112,25 +112,25 @@ Examples:
|
|
|
112
112
|
$ descript-api config profile staging # Switch to staging
|
|
113
113
|
$ descript-api config set api-key # Set API key for active profile
|
|
114
114
|
$ descript-api config list # View current configuration
|
|
115
|
-
`).action(async()=>{await
|
|
115
|
+
`).action(async()=>{await yn()});async function yn(){ue("Descript CLI - Configuration");let i=Ot(),e=Le(),t;if(i.length===0)d.info("No profiles found. Creating default profile."),t="default";else if(i.length===1)t=i[0];else{let u=await te({message:"Which profile would you like to configure?",options:[...i.map(s=>({value:s,label:s,hint:s===e?"(active)":""})),{value:"new",label:"Create new profile",hint:""}]});if(b(u)){w("Configuration cancelled");return}if(u==="new"){let s=await x({message:"Enter new profile name:",validate:r=>{if(!r)return"Profile name is required";if(Pi(r))return"Profile already exists"}});if(b(s)){w("Configuration cancelled");return}Pt(s),t=s,d.success(`Created profile: ${t}`)}else t=u}for(t!==e&&(St(t),d.info(`Switched to profile: ${t}`)),d.info(`Configuring profile: ${t}`),he()||(d.info("First-time setup - please configure your settings:"),await wn());;){let u=me.map(r=>{let o=de(r),a=Ri(r,o);return{value:r,label:r,hint:a}});u.push({value:"done",label:"Done",hint:"Exit configuration"});let s=await te({message:"Select a setting to update:",options:u});if(b(s)||s==="done"){ce(`Configuration saved to ${$e()}`);return}await _n(s)}}async function wn(){let i=await Te({message:"Enter your Descript API key:",validate:n=>{if(!n)return"API key is required";if(n.length<10)return"API key seems too short"}});b(i)&&(w("Setup cancelled"),process.exit(0)),await kt(i)?(Ae(i),d.success("API key saved")):(d.error("API key validation failed - saved anyway"),Ae(i));let t=await Fe({message:"Use custom API URL? (default: "+J+")",initialValue:!1});if(b(t)&&(w("Setup cancelled"),process.exit(0)),t){let n=await x({message:"Enter API base URL:",placeholder:J,validate:u=>{if(!u)return"API URL is required";try{new URL(u)}catch{return"Please enter a valid URL"}}});b(n)||(qe(n),d.success("API URL saved"))}d.success("Setup complete!")}async function _n(i){if(i==="api-key"){let e=he(),t=await Te({message:"Enter your Descript API key:",validate:u=>{if(!u)return"API key is required";if(u.length<10)return"API key seems too short"}});if(b(t))return;if(t===e){d.info("API key unchanged");return}await kt(t)?(Ae(t),d.success("API key saved")):d.error("Invalid API key - not saved")}else if(i==="api-url"){let e=ye(),t=await te({message:"API URL action:",options:[{value:"set",label:"Set custom URL",hint:e??"Currently using default"},{value:"clear",label:"Reset to default",hint:J}]});if(b(t))return;if(t==="clear"){if(!e){d.info("Already using default URL");return}xt(),d.success(`API URL reset to default: ${J}`)}else{let n=await x({message:"Enter API base URL:",placeholder:J,initialValue:e??"",validate:u=>{if(!u)return"API URL is required";try{new URL(u)}catch{return"Please enter a valid URL"}}});if(b(n))return;if(n===e){d.info("API URL unchanged");return}qe(n),d.success("API URL saved")}}else if(i==="debug"){let e=_(),t=await Fe({message:"Enable debug mode? (prints API requests)",initialValue:e});if(b(t))return;if(t===e){d.info("Debug mode unchanged");return}Bt(t),d.success(`Debug mode ${t?"enabled":"disabled"}`)}}N.command("list").description("Show all configuration values").action(()=>{vn()});function vn(){let i=Le();console.log(`
|
|
116
116
|
Configuration (${$e()}):`),console.log(`Active Profile: ${i}
|
|
117
|
-
`);for(let e of me){let t=de(e),n=
|
|
117
|
+
`);for(let e of me){let t=de(e),n=Ri(e,t);console.log(` ${e}: ${n}`)}console.log("")}N.command("get <key>").description("Get a configuration value").action(i=>{if(me.includes(i)||(console.error(`Unknown config key: ${i}`),console.error(`Valid keys: ${me.join(", ")}`),process.exit(1)),i==="api-url"){console.log(M());return}if(i==="debug"){console.log(_());return}let e=de(i);e?console.log(i==="api-key"?ji(e):e):(console.error(`${i} is not configured`),process.exit(1))});N.command("set <key> [value]").description("Set a configuration value (prompts if value not provided)").action(async(i,e)=>{me.includes(i)||(console.error(`Unknown config key: ${i}`),console.error(`Valid keys: ${me.join(", ")}`),process.exit(1));let t=i;if(!e){if(ue(`Set ${i}`),t==="api-key"){let n=await Te({message:"Enter your Descript API key:",validate:u=>{if(!u)return"API key is required";if(u.length<10)return"API key seems too short"}});b(n)&&(w("Cancelled"),process.exit(0)),e=n}else if(t==="api-url"){let n=ye(),u=await x({message:"Enter API base URL:",placeholder:J,initialValue:n??"",validate:s=>{if(!s)return"API URL is required (use `config clear api-url` to reset to default)";try{new URL(s)}catch{return"Please enter a valid URL"}}});b(u)&&(w("Cancelled"),process.exit(0)),e=u}else if(t==="debug"){let n=_(),u=await Fe({message:"Enable debug mode? (prints API requests)",initialValue:n});b(u)&&(w("Cancelled"),process.exit(0));let s=u,r=de(t);if(s===r){d.info("Debug mode unchanged");return}It(t,s),d.success(`Debug mode ${s?"enabled":"disabled"}`);return}}if(t==="api-key"&&e&&(await kt(e)||(w("The API key is invalid. Please check and try again."),process.exit(1))),t==="api-url"&&e)try{new URL(e)}catch{console.error("Invalid URL format for api-url"),process.exit(1)}if(t==="debug"&&typeof e=="string"){e!=="true"&&e!=="false"&&(console.error('Invalid debug value. Use "true" or "false"'),process.exit(1));let n=e==="true",u=de(t);if(n===u){console.log(`${i} unchanged`);return}It(t,n),console.log(`${i} saved to ${$e()}`);return}if(e!=null){let n=de(t);if(e===n){console.log(`${i} unchanged`);return}It(t,e),console.log(`${i} saved to ${$e()}`)}});N.command("clear <key>").description("Clear a configuration value (revert to default)").action(i=>{if(i!=="api-url"&&(console.error(`Cannot clear ${i}. Only api-url can be cleared (to revert to default).`),console.error('Use "config set" to update other values.'),process.exit(1)),!ye()){console.log("api-url already using default");return}xt(),console.log(`api-url cleared. Now using default: ${J}`)});N.command("profiles").description("List all profiles").action(()=>{let i=Ot(),e=Le();if(i.length===0){console.log("No profiles configured");return}console.log(`
|
|
118
118
|
Profiles:
|
|
119
|
-
`);for(let t of i)console.log(`${t===e?"* ":" "}${t}`);console.log("")});
|
|
120
|
-
Polling error response:`),console.error(JSON.stringify(C,null,2)))),null;throw a?.stop("Job status check failed"),pe(C,h)}if(p=0,!m)throw a?.stop("Job status check failed"),new k(500,"No response data");let f=m.job_state;if(
|
|
119
|
+
`);for(let t of i)console.log(`${t===e?"* ":" "}${t}`);console.log("")});N.command("profile <name>").description("Switch to a different profile").action(i=>{try{St(i),console.log(`Switched to profile: ${i}`)}catch(e){e instanceof Error?console.error(e.message):console.error("An unexpected error occurred"),process.exit(1)}});N.command("profile:create <name>").description("Create a new profile").action(i=>{try{Pt(i),console.log(`Created profile: ${i}`),console.log(`Use "config profile ${i}" to switch to it`)}catch(e){e instanceof Error?console.error(e.message):console.error("An unexpected error occurred"),process.exit(1)}});N.command("profile:delete <name>").description("Delete a profile").action(i=>{try{Si(i),console.log(`Deleted profile: ${i}`)}catch(e){e instanceof Error?console.error(e.message):console.error("An unexpected error occurred"),process.exit(1)}});function Ti(i){if(!i)return null;let e=parseInt(i,10);if(!isNaN(e)&&e>=0)return e*1e3;let t=Date.parse(i);return isNaN(t)?null:Math.max(0,t-Date.now())}function Vi(i){return i===429||i>=500&&i<600}var xn=["stopped","cancelled"];function Bn(i){return xn.includes(i)}function Mi(i){return new Promise(e=>setTimeout(e,i))}function On(i){if(i.result&&i.result.status==="error")return i.result.error_message}async function We(i,e,t,n={}){let{intervalMs:u=2e3,timeoutMs:s=18e5,maxRetries:r=5,quiet:o=!1}=n,a=o?null:ie(),l=Date.now(),c=()=>`${Math.floor((Date.now()-l)/1e3)}s`;a?.start(`${t} (${c()})`);let p=0;for(;;){let{data:m,error:C,response:h}=await i.GET("/jobs/{job_id}",{params:{path:{job_id:e}}});if(C){if(h&&Vi(h.status)){if(p<r){let E=Ti(h.headers.get("Retry-After"))??Math.min(u*Math.pow(2,p),6e4),U=`${h.status===429?"rate limited":"server error"} (${h.status}), retry ${p+1}/${r} in ${Math.ceil(E/1e3)}s`;o?d.warn(`Job ${e}: ${U}`):a?.message(`${t} (${c()}) - ${U}`),await Mi(E),p++;continue}throw a?.stop("Max retries exceeded"),new k(h.status,`Request failed after ${r} retries (last status: ${h.status})`)}if(h&&h.status>=400&&h.status<500)return a?.stop("Job polling not available"),o||(d.warn(`Jobs endpoint returned ${h.status} - polling unavailable`),_()&&(console.error(`
|
|
120
|
+
Polling error response:`),console.error(JSON.stringify(C,null,2)))),null;throw a?.stop("Job status check failed"),pe(C,h)}if(p=0,!m)throw a?.stop("Job status check failed"),new k(500,"No response data");let f=m.job_state;if(Bn(f)){if(f==="cancelled")throw a?.stop(`Job cancelled (${c()})`),new G("cancelled","Job was cancelled",m);let F=On(m);if(F)throw a?.stop(`Job failed (${c()})`),_()&&(console.error(`
|
|
121
121
|
Job failed - full response:`),console.error(JSON.stringify(m,null,2))),new G("failed",F,m);return a?.stop(`Job completed successfully! (${c()})`),_()&&(console.log(`
|
|
122
|
-
Job completed - full response:`),console.log(JSON.stringify(m,null,2))),m}if(Date.now()-l>s)throw a?.stop("Job timed out"),new
|
|
123
|
-
`).flatMap(t=>{let n=t.match(/^(\s*)/)?.[0]??"",u=t.slice(n.length),s=e-n.length;return s<1?[t]:u.length===0?[""]:
|
|
124
|
-
`)}function z(i){let e=
|
|
125
|
-
`)}function
|
|
122
|
+
Job completed - full response:`),console.log(JSON.stringify(m,null,2))),m}if(Date.now()-l>s)throw a?.stop("Job timed out"),new Me(`Job ${e} did not complete within ${s}ms`);a?.message(`${t} (${c()}) - ${f}`),await Mi(u)}}var Sn=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Pn(i){return Sn.test(i)}function In(i){try{return new URL(i),!0}catch{return!1}}function we(i){b(i)&&(w("Operation cancelled"),process.exit(0))}async function kn(i){if(i)return d.step(`Project ID: ${i}`),i;let e=await x({message:"Enter project ID:",placeholder:"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",validate:t=>{if(!t)return"Project ID is required";if(!Pn(t))return"Please enter a valid UUID"}});return we(e),e}async function Ge(i,e,t="CLI Import",n=!1){if(i)return d.step(`Project ID: ${i}`),{projectId:i};if(e)return d.step(`Project name: ${e}`),{projectName:e};if(n){let s=new Date().toISOString().split("T")[0],r=`${t} ${s}`;return d.step(`Project name: ${r}`),{projectName:r}}let u=await te({message:"Import to new or existing project?",options:[{value:"new",label:"Create new project"},{value:"existing",label:"Use existing project"}]});if(we(u),u==="new"){let s=new Date().toISOString().split("T")[0],r=`${t} ${s}`,o=await x({message:"Enter project name:",placeholder:r,defaultValue:r});return we(o),{projectName:o||r}}else return{projectId:await kn()}}async function Ni(i){if(i)return d.step(`Prompt: "${i}"`),i;let e=await x({message:"What would you like the AI to do?",placeholder:"e.g., add studio sound to all clips",validate:t=>{if(!t)return"Prompt is required"}});return we(e),e}function Ui(){return{media:new Map,sequences:new Map,compositions:[]}}function jn(i){let e=[];for(let t of i.media.keys())e.push({name:t,type:"media"});for(let t of i.sequences.keys())e.push({name:t,type:"sequence"});return e}function qi(i){let e=new Set;for(let t of i.media.keys())e.add(t);for(let[t,n]of i.sequences){e.add(t);for(let u of n)e.add(u.media)}return e}function Rn(i,e){try{let n=new URL(i).pathname.split("/");return n[n.length-1]||e}catch{return e}}function Tn(i,e){if(!e.has(i))return i;let t=i.lastIndexOf("."),n=t>0?i.slice(0,t):i,u=t>0?i.slice(t):"",s=2,r;do r=`${n} ${s}${u}`,s++;while(e.has(r));return r}async function Li(i){let e=i.media.size+i.sequences.size,t=i.compositions.length,n=await te({message:"What would you like to add?",options:[{value:"media",label:"Media file",hint:"Import from URL"},{value:"sequence",label:"Sequence",hint:"Multitrack (e.g., multicam)"},{value:"composition",label:"Composition",hint:e===0?"Add media first":"Timeline with clips"},{value:"done",label:"Done",hint:e===0?"Nothing to import":`${e} items, ${t} compositions`}]});return we(n),n}async function jt(i){let e=await x({message:"Enter media URL:",placeholder:"https://example.com/video.mp4",validate:o=>{if(o&&!In(o))return"Please enter a valid URL"}});if(b(e)||!e)return null;let t=qi(i),n=Rn(e,`media_${i.media.size+1}`),u=Tn(n,t),s=await x({message:"Name for this file:",placeholder:u});if(b(s))return null;let r=s||u;if(s&&t.has(r)){d.warn(`Name "${r}" already exists. Please use a different name.`);let o=await x({message:"Enter a different name:",validate:a=>{if(!a)return"Name is required";if(t.has(a))return"Name already exists"}});return b(o)?null:{name:o,url:e}}return{name:r,url:e}}async function Hi(i){let e=qi(i),t="Sequence",n=1;for(;e.has(t);)t=`Sequence_${n}`,n++;let u=await x({message:"Sequence name (press Enter for default):",placeholder:t,validate:c=>{if(c&&e.has(c))return"Name already exists"}});if(b(u))return null;let s=u||t;if(e.add(s),Array.from(i.media.entries()).length===0)return d.warn("No media files available. Add some media first before creating a sequence."),null;let o=new Set,a=[],l=!0;for(;l;){let m=[...Array.from(i.media.entries()).filter(([E])=>!o.has(E)).map(([E])=>({value:E,label:E,hint:"media"})),{value:"add_new",label:"Add new media file",hint:""},{value:"done",label:"Done adding tracks",hint:""}],C=await te({message:a.length===0?"Select media for first track:":"Select media for next track:",options:m});if(b(C)){if(a.length===0)return null;break}if(C==="add_new"){let E=await jt(i);E&&(i.media.set(E.name,E.url),d.success(`Added media: ${E.name}`));continue}if(C==="done"){if(a.length===0){d.warn("Sequence must have at least one track.");continue}break}let h=C,f=i.media.get(h),F=await x({message:"Time offset in seconds:",placeholder:"0",defaultValue:"0",validate:E=>{let O=parseFloat(E||"0");if(isNaN(O))return"Please enter a valid number"}});if(b(F)){if(a.length===0)return null;break}o.add(h),a.push({media:h,url:f,offset:parseFloat(F||"0")})}return a.length===0?(d.warn("Sequence must have at least one track. Skipping."),null):{name:s,tracks:a}}async function Wi(i){let e=jn(i);if(e.length===0)return d.warn("No media or sequences available. Add some first."),null;let t=await x({message:"Composition name (optional):",placeholder:"Leave empty for default"});if(b(t))return null;let n=t||void 0,u=await wi({message:"Select items for this composition (space to select, enter to confirm):",options:e.map(r=>({value:r.name,label:r.name,hint:r.type})),required:!1});if(b(u))return null;let s=u;return s.length===0?(d.warn("No items selected. Composition not added."),null):{name:n,items:s}}function Gi(){return process.stdout.columns||80}function Vn(i,e){if(e<1&&(e=1),i.length<=e)return[i];let t=i.split(" "),n=[],u="";for(let s of t)if(u.length===0)if(s.length>e){for(let r=0;r<s.length;r+=e)n.push(s.slice(r,r+e));u=n.pop()}else u=s;else if(u.length+1+s.length<=e)u+=" "+s;else if(n.push(u),s.length>e){for(let r=0;r<s.length;r+=e)n.push(s.slice(r,r+e));u=n.pop()}else u=s;return u.length>0&&n.push(u),n}function Ki(i,e){return i.split(`
|
|
123
|
+
`).flatMap(t=>{let n=t.match(/^(\s*)/)?.[0]??"",u=t.slice(n.length),s=e-n.length;return s<1?[t]:u.length===0?[""]:Vn(u,s).map(r=>n+r)}).join(`
|
|
124
|
+
`)}function z(i){let e=Gi()-4;return Ki(i,e)}function Ji(i){let e=Gi()-3;return Ki(i,e)}function Mn(i,e=60){if(i.length<=e)return i;try{let t=new URL(i),n=`${t.origin}${t.pathname}`;return n.length<=e?n+(t.search?"...":""):n.slice(0,e-3)+"..."}catch{return i.slice(0,e-3)+"..."}}function Nn(i,e,t){let n=[],u="projectId"in e?`Existing project: ${e.projectId}`:`New project: ${e.projectName}`;if(n.push(u),t&&n.push(`Team access: ${t}`),i.media.size>0){n.push(""),n.push(`Media files (${i.media.size}):`);for(let[s,r]of i.media)n.push(` ${s}: ${Mn(r)}`)}if(i.sequences.size>0){n.push(""),n.push(`Sequences (${i.sequences.size}):`);for(let[s,r]of i.sequences){let o=r.map(a=>a.media).join(", ");n.push(` ${s}: ${o} (${r.length} tracks)`)}}if(i.compositions.length>0){n.push(""),n.push(`Compositions (${i.compositions.length}):`);for(let s of i.compositions){let r=s.name||"(default)",o=s.items.length>0?s.items.join(", "):"(empty)";n.push(` ${r}: ${o}`)}}return n.join(`
|
|
125
|
+
`)}function Un(i){let e={};for(let[t,n]of i.media)e[t]={url:n};for(let[t,n]of i.sequences){for(let u of n)e[u.media]||(e[u.media]={url:u.url});e[t]={tracks:n.map(u=>({media:u.media,offset:u.offset!==0?u.offset:void 0}))}}return e}function qn(i,e=!1){if(i.compositions.length>0)return i.compositions.map(n=>({name:n.name,clips:n.items.map(u=>({media:u}))}));if(!e)return[];let t=[...i.media.keys(),...i.sequences.keys()];return t.length===0?[]:[{clips:t.map(n=>({media:n}))}]}var zi=new X("import").description("Import media, sequences, and compositions to a project").option("-n, --name, --project-name <name>","Project name (for new projects)").option("-p, --project-id <id>","Existing project ID").option("-m, --media <urls...>","Media URL(s) to import (simple mode)").option("--team-access <level>","Team access level for new projects: edit, comment, none").option("--callback-url <url>","Callback URL for import job notifications").option("--timeout <minutes>","Job polling timeout in minutes","30").option("--new","Create new project with default name").option("--no-composition","Skip creating a composition with imported media").action(async i=>{ue("Descript CLI - Import");try{d.info(`API: ${M()}`);let e=He(),t=parseInt(i.timeout??"30",10);if(isNaN(t)||t<=0)throw new oe("Timeout must be a positive number of minutes");let n=t*60*1e3;if(i.teamAccess&&!["edit","comment","none"].includes(i.teamAccess))throw new oe("Team access must be one of: edit, comment, none");let u=await Ge(i.projectId,i.name,"CLI Import",i.new),s=Ui();if(i.media&&i.media.length>0){d.step(`Media URLs: ${i.media.length} file(s) from CLI`);for(let[h,f]of i.media.entries())try{let E=new URL(f).pathname.split("/"),O=E[E.length-1]||`media_${h+1}`;s.media.set(O,f)}catch{s.media.set(`media_${h+1}`,f)}}else{let h=!1;for(;!h;)switch(await Li(s)){case"media":{let F=await jt(s);F&&(s.media.set(F.name,F.url),d.success(`Added media: ${F.name}`));break}case"sequence":{let F=await Hi(s);F&&(s.sequences.set(F.name,F.tracks),d.success(`Added sequence: ${F.name} (${F.tracks.length} tracks)`));break}case"composition":{let F=await Wi(s);F&&(s.compositions.push(F),d.success(`Added composition: ${F.name||"(default)"}`));break}case"done":h=!0;break}}let r=Un(s),o=qn(s,i.composition);W(z(Nn(s,u,i.teamAccess)),"Import Details");let a=ie();a.start("Creating import job...");let{data:l,error:c,response:p}=await e.POST("/jobs/import/project_media",{body:{..."projectId"in u?{project_id:u.projectId}:{project_name:u.projectName},add_media:r,add_compositions:o,...i.teamAccess&&{team_access:i.teamAccess},...i.callbackUrl&&{callback_url:i.callbackUrl}}});if(c)throw a.stop("Failed to create import job"),_()&&(console.error(`
|
|
126
126
|
API error response:`),console.error(JSON.stringify(c,null,2))),pe(c,p);if(!l)throw a.stop("Failed to create import job"),new k(500,"No response data");a.stop("Import job created successfully!"),_()&&(console.log(`
|
|
127
127
|
Import job response:`),console.log(JSON.stringify(l,null,2)));let m=[`Job ID: ${l.job_id}`,`Project ID: ${l.project_id}`,`Project URL: ${l.project_url}`];W(z(m.join(`
|
|
128
|
-
`)),"Import Started");let C=await
|
|
128
|
+
`)),"Import Started");let C=await We(e,l.job_id,"Waiting for import to complete...",{timeoutMs:n});if(C&&C.job_type==="import/project_media"&&C.result){let h=C.result,f=[`Status: ${h.status}`];if(h.status!=="error"){f.push(""),f.push("Media:");for(let[F,E]of Object.entries(h.media_status))if(E.status==="success"){let O=E.duration_seconds!=null?` (${E.duration_seconds.toFixed(1)}s)`:"";f.push(` ${F}: ${E.status}${O}`)}else{let O=E.error_message?` - ${E.error_message}`:"";f.push(` ${F}: ${E.status}${O}`)}if(h.created_compositions&&h.created_compositions.length>0){f.push(""),f.push("Compositions created:");for(let F of h.created_compositions)f.push(` ${F.name??F.id??"(unnamed)"}`)}f.push(""),f.push(`Media seconds used: ${h.media_seconds_used}`)}W(z(f.join(`
|
|
129
129
|
`)),"Import Complete")}ce(`Project: ${l.project_url}`)}catch(e){if(e instanceof G){let t=e.formatDetails();w(t[0]),t.length>1&&d.error(t.slice(1).join(`
|
|
130
|
-
`))}else if(e instanceof k){if(w(e.message),e.details&&e.details.length>0)for(let t of e.details)d.error(` ${t}`)}else e instanceof Error?w(e.message):w("An unexpected error occurred");process.exit(1)}});var
|
|
130
|
+
`))}else if(e instanceof k){if(w(e.message),e.details&&e.details.length>0)for(let t of e.details)d.error(` ${t}`)}else e instanceof Error?w(e.message):w("An unexpected error occurred");process.exit(1)}});var Yi=new X("agent").description("Run AI agent editing on a project").option("-p, --project-id <id>","Existing project ID").option("-n, --name, --project-name <name>","Project name (for new projects)").option("-c, --composition-id <id>","Composition ID (optional)").option("--prompt <prompt>","Natural language editing instruction").option("--model <model>","AI model to use for editing").option("--callback-url <url>","Callback URL for job notifications").option("--timeout <minutes>","Job polling timeout in minutes","30").option("--new","Create new project with default name").action(async i=>{ue("Descript CLI - AI Agent");try{d.info(`API: ${M()}`);let e=He(),t=parseInt(i.timeout??"30",10);if(isNaN(t)||t<=0)throw new oe("Timeout must be a positive number of minutes");let n=t*60*1e3,u=await Ge(i.projectId,i.name,"CLI Edit",i.new),s=await Ni(i.prompt),o=["projectId"in u?`Existing project: ${u.projectId}`:`New project: ${u.projectName}`,`Prompt: "${s}"`];i.compositionId&&o.push(`Composition ID: ${i.compositionId}`),i.model&&o.push(`Model: ${i.model}`),W(z(o.join(`
|
|
131
131
|
`)),"Agent Details");let a=ie();a.start("Submitting agent request...");let{data:l,error:c,response:p}=await e.POST("/jobs/agent",{body:{..."projectId"in u?{project_id:u.projectId}:{project_name:u.projectName},composition_id:i.compositionId,prompt:s,model:i.model,...i.callbackUrl&&{callback_url:i.callbackUrl}}});if(c)throw a.stop("Failed to create agent job"),_()&&(console.error(`
|
|
132
132
|
API error response:`),console.error(JSON.stringify(c,null,2))),pe(c,p);if(!l)throw a.stop("Failed to create agent job"),new k(500,"No response data");a.stop("Agent job created successfully!"),_()&&(console.log(`
|
|
133
133
|
Agent job response:`),console.log(JSON.stringify(l,null,2)));let m=[`Job ID: ${l.job_id}`,`Project ID: ${l.project_id}`,`Project URL: ${l.project_url}`];W(z(m.join(`
|
|
134
|
-
`)),"Agent Job Submitted");let C=await
|
|
134
|
+
`)),"Agent Job Submitted");let C=await We(e,l.job_id,"Waiting for agent to complete...",{timeoutMs:n});if(C&&C.job_type==="agent"&&C.result){let h=C.result;if(h.status!=="error"){h.agent_response&&(d.step("Agent Response"),d.message(Ji(h.agent_response)));let f=[`Status: ${h.status}`];f.push(`Project changed: ${h.project_changed?"yes":"no"}`),h.media_seconds_used!=null&&f.push(`Media seconds used: ${h.media_seconds_used}`),h.ai_credits_used!=null&&f.push(`AI credits used: ${h.ai_credits_used}`),W(z(f.join(`
|
|
135
135
|
`)),"Agent Complete")}else W(z(`Status: ${h.status}`),"Agent Complete")}ce(`Project: ${l.project_url}`)}catch(e){if(e instanceof G){let t=e.formatDetails();w(t[0]),t.length>1&&d.error(t.slice(1).join(`
|
|
136
|
-
`))}else if(e instanceof k){if(w(e.message),e.details&&e.details.length>0)for(let t of e.details)d.error(` ${t}`)}else e instanceof Error?w(e.message):w("An unexpected error occurred");process.exit(1)}});var
|
|
136
|
+
`))}else if(e instanceof k){if(w(e.message),e.details&&e.details.length>0)for(let t of e.details)d.error(` ${t}`)}else e instanceof Error?w(e.message):w("An unexpected error occurred");process.exit(1)}});var Zi=typeof Ke.default=="function"?Ke.default:Ke.default.default,Rt="@descript/platform-cli",_e="0.2.7",R=new X;R.name("descript-api").description("CLI for Descript API - import media and run AI edits").version(_e);R.addCommand(N);R.addCommand(zi);R.addCommand(Yi);R.command("update").description("Check if a newer version is available").action(async()=>{let i=Zi({pkg:{name:Rt,version:_e},updateCheckInterval:0});console.log(`Current version: ${_e}`),console.log("Checking for updates...");let e=await i.fetchInfo();e.type!=="latest"&&e.latest!==_e?(console.log(`New version available: ${e.latest}`),console.log(`Run \`npm i -g ${Rt}\` to update`)):console.log("You are on the latest version.")});R.command("help [command]").description("Show help for a command").action(i=>{if(!i){R.help();return}let e=R.commands.find(t=>t.name()===i);e?e.help():(console.error(`Unknown command: ${i}`),console.error("Run 'descript-api --help' to see available commands."),process.exit(1))});R.action(()=>{R.help()});function Qi(i){R.parse(i,{from:"user"}),Zi({pkg:{name:Rt,version:_e}}).notify()}Qi(process.argv.slice(2));
|