@descript/platform-cli 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/descript-cli.cjs +101 -101
- package/package.json +13 -4
package/dist/descript-cli.cjs
CHANGED
|
@@ -1,99 +1,99 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var
|
|
3
|
-
`).replace(/^/gm," ".repeat(
|
|
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
|
|
2
|
+
"use strict";var zi=Object.create;var jt=Object.defineProperty;var Yi=Object.getOwnPropertyDescriptor;var Zi=Object.getOwnPropertyNames;var Qi=Object.getPrototypeOf,Xi=Object.prototype.hasOwnProperty;var q=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var er=(i,e,t,u)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Zi(e))!Xi.call(i,n)&&n!==t&&jt(i,n,{get:()=>e[n],enumerable:!(u=Yi(e,n))||u.enumerable});return i};var Q=(i,e,t)=>(t=i!=null?zi(Qi(i)):{},er(e||!i||!i.__esModule?jt(t,"default",{value:i,enumerable:!0}):t,i));var fe=q(ze=>{var _e=class extends Error{constructor(e,t,u){super(u),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},Je=class extends _e{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};ze.CommanderError=_e;ze.InvalidArgumentError=Je});var ve=q(Ze=>{var{InvalidArgumentError:tr}=fe(),Ye=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,u)=>{if(!this.argChoices.includes(t))throw new tr(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,u):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function ir(i){let e=i.name()+(i.variadic===!0?"...":"");return i.required?"<"+e+">":"["+e+"]"}Ze.Argument=Ye;Ze.humanReadableArgName=ir});var Xe=q(Rt=>{var{humanReadableArgName:rr}=ve(),Qe=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter(n=>!n._hidden),u=e._getHelpCommand();return u&&!u._hidden&&t.push(u),this.sortSubcommands&&t.sort((n,s)=>n.name().localeCompare(s.name())),t}compareOptions(e,t){let u=n=>n.short?n.short.replace(/^-/,""):n.long.replace(/^--/,"");return u(e).localeCompare(u(t))}visibleOptions(e){let t=e.options.filter(n=>!n.hidden),u=e._getHelpOption();if(u&&!u.hidden){let n=u.short&&e._findOption(u.short),s=u.long&&e._findOption(u.long);!n&&!s?t.push(u):u.long&&!s?t.push(e.createOption(u.long,u.description)):u.short&&!n&&t.push(e.createOption(u.short,u.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let u=e.parent;u;u=u.parent){let n=u.options.filter(s=>!s.hidden);t.push(...n)}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(u=>rr(u)).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((u,n)=>Math.max(u,t.subcommandTerm(n).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((u,n)=>Math.max(u,t.optionTerm(n).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((u,n)=>Math.max(u,t.optionTerm(n).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((u,n)=>Math.max(u,t.argumentTerm(n).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let u="";for(let n=e.parent;n;n=n.parent)u=n.name()+" "+u;return u+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(u=>JSON.stringify(u)).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(u=>JSON.stringify(u)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let u=`(${t.join(", ")})`;return e.description?`${e.description} ${u}`:u}return e.description}formatHelp(e,t){let u=t.padWidth(e,t),n=t.helpWidth||80,s=2,r=2;function o(h,f){if(f){let F=`${h.padEnd(u+r)}${f}`;return t.wrap(F,n-s,u+r)}return h}function a(h){return h.join(`
|
|
3
|
+
`).replace(/^/gm," ".repeat(s))}let l=[`Usage: ${t.commandUsage(e)}`,""],c=t.commandDescription(e);c.length>0&&(l=l.concat([t.wrap(c,n,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
|
+
`)}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,u,n=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-u;if(o<n)return e;let a=e.slice(0,u),l=e.slice(u).replace(`\r
|
|
5
5
|
`,`
|
|
6
|
-
`),c=" ".repeat(
|
|
7
|
-
|.{1,${o-1}}([${m}]|$)|[^${m}]+?([${m}]|$)`,"g"),
|
|
8
|
-
`?"":(
|
|
9
|
-
`)}};
|
|
10
|
-
(Did you mean one of ${
|
|
11
|
-
(Did you mean ${
|
|
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 '${
|
|
14
|
-
- already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=
|
|
6
|
+
`),c=" ".repeat(u),m="\\s\u200B",C=new RegExp(`
|
|
7
|
+
|.{1,${o-1}}([${m}]|$)|[^${m}]+?([${m}]|$)`,"g"),h=l.match(C)||[];return a+h.map((f,F)=>f===`
|
|
8
|
+
`?"":(F>0?c:"")+f.trimEnd()).join(`
|
|
9
|
+
`)}};Rt.Help=Qe});var rt=q(it=>{var{InvalidArgumentError:ur}=fe(),et=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 u=sr(e);this.short=u.shortFlag,this.long=u.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,u)=>{if(!this.argChoices.includes(t))throw new ur(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,u):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return nr(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},tt=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,u)=>{this.positiveOptions.has(u)&&this.dualOptions.add(u)})}valueFromOption(e,t){let u=t.attributeName();if(!this.dualOptions.has(u))return!0;let n=this.negativeOptions.get(u).presetArg,s=n!==void 0?n:!1;return t.negate===(s===e)}};function nr(i){return i.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function sr(i){let e,t,u=i.split(/[ |,]+/);return u.length>1&&!/^[[<]/.test(u[1])&&(e=u.shift()),t=u.shift(),!e&&/^-[^-]$/.test(t)&&(e=t,t=void 0),{shortFlag:e,longFlag:t}}it.Option=et;it.DualOptions=tt});var Vt=q(Tt=>{function or(i,e){if(Math.abs(i.length-e.length)>3)return Math.max(i.length,e.length);let t=[];for(let u=0;u<=i.length;u++)t[u]=[u];for(let u=0;u<=e.length;u++)t[0][u]=u;for(let u=1;u<=e.length;u++)for(let n=1;n<=i.length;n++){let s=1;i[n-1]===e[u-1]?s=0:s=1,t[n][u]=Math.min(t[n-1][u]+1,t[n][u-1]+1,t[n-1][u-1]+s),n>1&&u>1&&i[n-1]===e[u-2]&&i[n-2]===e[u-1]&&(t[n][u]=Math.min(t[n][u],t[n-2][u-2]+1))}return t[i.length][e.length]}function ar(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 u=[],n=3,s=.4;return e.forEach(r=>{if(r.length<=1)return;let o=or(i,r),a=Math.max(i.length,r.length);(a-o)/a>s&&(o<n?(n=o,u=[r]):o===n&&u.push(r))}),u.sort((r,o)=>r.localeCompare(o)),t&&(u=u.map(r=>`--${r}`)),u.length>1?`
|
|
10
|
+
(Did you mean one of ${u.join(", ")}?)`:u.length===1?`
|
|
11
|
+
(Did you mean ${u[0]}?)`:""}Tt.suggestSimilar=ar});var Lt=q(qt=>{var Dr=require("node:events").EventEmitter,ut=require("node:child_process"),L=require("node:path"),nt=require("node:fs"),$=require("node:process"),{Argument:lr,humanReadableArgName:cr}=ve(),{CommanderError:st}=fe(),{Help:pr}=Xe(),{Option:Mt,DualOptions:hr}=rt(),{suggestSimilar:Nt}=Vt(),ot=class i extends Dr{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,u)=>u(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,u){let n=t,s=u;typeof n=="object"&&n!==null&&(s=n,n=null),s=s||{};let[,r,o]=e.match(/([^ ]+) *(.*)/),a=this.createCommand(r);return n&&(a.description(n),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),n?this:a}createCommand(e){return new i(e)}createHelp(){return Object.assign(new pr,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 lr(e,t)}argument(e,t,u,n){let s=this.createArgument(e,t);return typeof u=="function"?s.default(n).argParser(u):s.default(u),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[,u,n]=e.match(/([^ ]+) *(.*)/),s=t??"display help for command",r=this.createCommand(u);return r.helpOption(!1),n&&r.arguments(n),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 u=["preSubcommand","preAction","postAction"];if(!u.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
|
|
13
|
+
Expecting one of '${u.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,u){this._exitCallback&&this._exitCallback(new st(e,t,u)),$.exit(e)}action(e){let t=u=>{let n=this.registeredArguments.length,s=u.slice(0,n);return this._storeOptionsAsProperties?s[n]=this:s[n]=this.opts(),s.push(this),e.apply(this,s)};return this._actionHandler=t,this}createOption(e,t){return new Mt(e,t)}_callParseArg(e,t,u,n){try{return e.parseArg(t,u)}catch(s){if(s.code==="commander.invalidArgument"){let r=`${n} ${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 u=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 '${u}'
|
|
14
|
+
- already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=n=>[n.name()].concat(n.aliases()),u=t(e).find(n=>this._findCommand(n));if(u){let n=t(this._findCommand(u)).join("|"),s=t(e).join("|");throw new Error(`cannot add command '${s}' as already have command '${n}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),u=e.attributeName();if(e.negate){let s=e.long.replace(/^--no-/,"--");this._findOption(s)||this.setOptionValueWithSource(u,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(u,e.defaultValue,"default");let n=(s,r,o)=>{s==null&&e.presetArg!==void 0&&(s=e.presetArg);let a=this.getOptionValue(u);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(u,s,o)};return this.on("option:"+t,s=>{let r=`error: option '${e.flags}' argument '${s}' is invalid.`;n(s,r,"cli")}),e.envVar&&this.on("optionEnv:"+t,s=>{let r=`error: option '${e.flags}' value '${s}' from env '${e.envVar}' is invalid.`;n(s,r,"env")}),this}_optionEx(e,t,u,n,s){if(typeof t=="object"&&t instanceof Mt)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let r=this.createOption(t,u);if(r.makeOptionMandatory(!!e.mandatory),typeof n=="function")r.default(s).argParser(n);else if(n instanceof RegExp){let o=n;n=(a,l)=>{let c=o.exec(a);return c?c[0]:l},r.default(s).argParser(n)}else r.default(n);return this.addOption(r)}option(e,t,u,n){return this._optionEx({},e,t,u,n)}requiredOption(e,t,u,n){return this._optionEx({mandatory:!0},e,t,u,n)}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,u){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=u,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(u=>{u.getOptionValueSource(e)!==void 0&&(t=u.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 n=$.execArgv??[];(n.includes("-e")||n.includes("--eval")||n.includes("-p")||n.includes("--print"))&&(t.from="eval")}e===void 0&&(e=$.argv),this.rawArgs=e.slice();let u;switch(t.from){case void 0:case"node":this._scriptPath=e[1],u=e.slice(2);break;case"electron":$.defaultApp?(this._scriptPath=e[1],u=e.slice(2)):u=e.slice(1);break;case"user":u=e.slice(0);break;case"eval":u=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",u}parse(e,t){let u=this._prepareUserArgs(e,t);return this._parseCommand([],u),this}async parseAsync(e,t){let u=this._prepareUserArgs(e,t);return await this._parseCommand([],u),this}_executeSubCommand(e,t){t=t.slice();let u=!1,n=[".js",".ts",".tsx",".mjs",".cjs"];function s(c,p){let m=L.resolve(c,p);if(nt.existsSync(m))return m;if(n.includes(L.extname(p)))return;let C=n.find(h=>nt.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=nt.realpathSync(this._scriptPath)}catch{c=this._scriptPath}o=L.resolve(L.dirname(c),o)}if(o){let c=s(o,r);if(!c&&!e._executableFile&&this._scriptPath){let p=L.basename(this._scriptPath,L.extname(this._scriptPath));p!==this._name&&(c=s(o,`${p}-${e._name}`))}r=c||r}u=n.includes(L.extname(r));let a;$.platform!=="win32"?u?(t.unshift(r),t=Ut($.execArgv).concat(t),a=ut.spawn($.argv[0],t,{stdio:"inherit"})):a=ut.spawn(r,t,{stdio:"inherit"}):(t.unshift(r),t=Ut($.execArgv).concat(t),a=ut.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 st(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
|
-
- ${
|
|
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 st(1,"commander.executeSubCommandAsync","(error)");p.nestedError=c,l(p)}}),this.runningCommand=a}_dispatchSubcommand(e,t,u){let n=this._findCommand(e);n||this.help({error:!0});let s;return s=this._chainOrCallSubCommandHook(s,n,"preSubcommand"),s=this._chainOrCall(s,()=>{if(n._executableHandler)this._executeSubCommand(n,t.concat(u));else return n._parseCommand(t,u)}),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=(u,n,s)=>{let r=n;if(n!==null&&u.parseArg){let o=`error: command-argument value '${n}' is invalid for argument '${u.name()}'.`;r=this._callParseArg(u,n,s,o)}return r};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((u,n)=>{let s=u.defaultValue;u.variadic?n<this.args.length?(s=this.args.slice(n),u.parseArg&&(s=s.reduce((r,o)=>e(u,o,r),u.defaultValue))):s===void 0&&(s=[]):n<this.args.length&&(s=this.args[n],u.parseArg&&(s=e(u,s,u.defaultValue))),t[n]=s}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let u=e,n=[];return this._getCommandAndAncestors().reverse().filter(s=>s._lifeCycleHooks[t]!==void 0).forEach(s=>{s._lifeCycleHooks[t].forEach(r=>{n.push({hookedCommand:s,callback:r})})}),t==="postAction"&&n.reverse(),n.forEach(s=>{u=this._chainOrCall(u,()=>s.callback(s.hookedCommand,this))}),u}_chainOrCallSubCommandHook(e,t,u){let n=e;return this._lifeCycleHooks[u]!==void 0&&this._lifeCycleHooks[u].forEach(s=>{n=this._chainOrCall(n,()=>s(this,t))}),n}_parseCommand(e,t){let u=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(u.operands),t=u.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(u.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let n=()=>{u.unknown.length>0&&this.unknownOption(u.unknown[0])},s=`command:${this.name()}`;if(this._actionHandler){n(),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))n(),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():(n(),this._processArguments())}else this.commands.length?(n(),this.help({error:!0})):(n(),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(u=>{let n=u.attributeName();return this.getOptionValue(n)===void 0?!1:this.getOptionValueSource(n)!=="default"});e.filter(u=>u.conflictsWith.length>0).forEach(u=>{let n=e.find(s=>u.conflictsWith.includes(s.attributeName()));n&&this._conflictingOption(u,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],u=[],n=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==="--"){n===u&&n.push(a),n.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)&&(n=u),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&u.length===0){if(this._findCommand(a)){t.push(a),s.length>0&&u.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){u.push(a),s.length>0&&u.push(...s);break}}if(this._passThroughOptions){n.push(a),s.length>0&&n.push(...s);break}n.push(a)}return{operands:t,unknown:u}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let u=0;u<t;u++){let n=this.options[u].attributeName();e[n]=n===this._versionOptionName?this._version:this[n]}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
|
|
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
|
|
22
|
-
Expecting one of '${
|
|
23
|
-
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(s=>t.is(s))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Nt(r){return r.map(e=>{if(!e.startsWith("--inspect"))return e;let t,n="127.0.0.1",s="9229",u;return(u=e.match(/^(--inspect(-brk)?)$/))!==null?t=u[1]:(u=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=u[1],/^\d+$/.test(u[3])?s=u[3]:n=u[3]):(u=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=u[1],n=u[3],s=u[4]),t&&s!=="0"?`${t}=${n}:${parseInt(s)+1}`:e})}Ut.Command=ut});var Gt=q(I=>{var{Argument:Lt}=_e(),{Command:ot}=qt(),{CommanderError:hr,InvalidArgumentError:Ht}=me(),{Help:dr}=Qe(),{Option:Wt}=it();I.program=new ot;I.createCommand=r=>new ot(r);I.createOption=(r,e)=>new Wt(r,e);I.createArgument=(r,e)=>new Lt(r,e);I.Command=ot;I.Option=Wt;I.Argument=Lt;I.Help=dr;I.CommanderError=hr;I.InvalidArgumentError=Ht;I.InvalidOptionArgumentError=Ht});var Dt=q((ns,Jt)=>{"use strict";var at={to(r,e){return e?`\x1B[${e+1};${r+1}H`:`\x1B[${r+1}G`},move(r,e){let t="";return r<0?t+=`\x1B[${-r}D`:r>0&&(t+=`\x1B[${r}C`),e<0?t+=`\x1B[${-e}A`:e>0&&(t+=`\x1B[${e}B`),t},up:(r=1)=>`\x1B[${r}A`,down:(r=1)=>`\x1B[${r}B`,forward:(r=1)=>`\x1B[${r}C`,backward:(r=1)=>`\x1B[${r}D`,nextLine:(r=1)=>"\x1B[E".repeat(r),prevLine:(r=1)=>"\x1B[F".repeat(r),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},mr={up:(r=1)=>"\x1B[S".repeat(r),down:(r=1)=>"\x1B[T".repeat(r)},fr={screen:"\x1B[2J",up:(r=1)=>"\x1B[1J".repeat(r),down:(r=1)=>"\x1B[J".repeat(r),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(r){let e="";for(let t=0;t<r;t++)e+=this.line+(t<r-1?at.up():"");return r&&(e+=at.left),e}};Jt.exports={cursor:at,scroll:mr,erase:fr,beep:"\x07"}});var ct=q((ss,lt)=>{var xe=process||{},zt=xe.argv||[],ve=xe.env||{},gr=!(ve.NO_COLOR||zt.includes("--no-color"))&&(!!ve.FORCE_COLOR||zt.includes("--color")||xe.platform==="win32"||(xe.stdout||{}).isTTY&&ve.TERM!=="dumb"||!!ve.CI),Cr=(r,e,t=r)=>n=>{let s=""+n,u=s.indexOf(e,r.length);return~u?r+Fr(s,e,t,u)+e:r+s+e},Fr=(r,e,t,n)=>{let s="",u=0;do s+=r.substring(u,n)+t,u=n+e.length,n=r.indexOf(e,u);while(~n);return s+r.substring(u)},Yt=(r=gr)=>{let e=r?Cr:()=>String;return{isColorSupported:r,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")}};lt.exports=Yt();lt.exports.createColors=Yt});var Kt=Q(Gt(),1),{program:Kn,createCommand:Jn,createArgument:zn,createOption:Yn,CommanderError:Zn,InvalidArgumentError:Qn,InvalidOptionArgumentError:Xn,Command:X,Argument:es,Option:ts,Help:is}=Kt.default;var v=Q(Dt(),1),De=require("node:process"),ee=Q(require("node:readline"),1),dt=Q(require("node:readline"),1),oi=require("node:tty"),re=Q(ct(),1);function Er({onlyFirst:r=!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,r?void 0:"g")}var br=Er();function ai(r){if(typeof r!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof r}\``);return r.replace(br,"")}function Di(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var li={exports:{}};(function(r){var e={};r.exports=e,e.eastAsianWidth=function(n){var s=n.charCodeAt(0),u=n.length==2?n.charCodeAt(1):0,i=s;return 55296<=s&&s<=56319&&56320<=u&&u<=57343&&(s&=1023,u&=1023,i=s<<10|u,i+=65536),i==12288||65281<=i&&i<=65376||65504<=i&&i<=65510?"F":i==8361||65377<=i&&i<=65470||65474<=i&&i<=65479||65482<=i&&i<=65487||65490<=i&&i<=65495||65498<=i&&i<=65500||65512<=i&&i<=65518?"H":4352<=i&&i<=4447||4515<=i&&i<=4519||4602<=i&&i<=4607||9001<=i&&i<=9002||11904<=i&&i<=11929||11931<=i&&i<=12019||12032<=i&&i<=12245||12272<=i&&i<=12283||12289<=i&&i<=12350||12353<=i&&i<=12438||12441<=i&&i<=12543||12549<=i&&i<=12589||12593<=i&&i<=12686||12688<=i&&i<=12730||12736<=i&&i<=12771||12784<=i&&i<=12830||12832<=i&&i<=12871||12880<=i&&i<=13054||13056<=i&&i<=19903||19968<=i&&i<=42124||42128<=i&&i<=42182||43360<=i&&i<=43388||44032<=i&&i<=55203||55216<=i&&i<=55238||55243<=i&&i<=55291||63744<=i&&i<=64255||65040<=i&&i<=65049||65072<=i&&i<=65106||65108<=i&&i<=65126||65128<=i&&i<=65131||110592<=i&&i<=110593||127488<=i&&i<=127490||127504<=i&&i<=127546||127552<=i&&i<=127560||127568<=i&&i<=127569||131072<=i&&i<=194367||177984<=i&&i<=196605||196608<=i&&i<=262141?"W":32<=i&&i<=126||162<=i&&i<=163||165<=i&&i<=166||i==172||i==175||10214<=i&&i<=10221||10629<=i&&i<=10630?"Na":i==161||i==164||167<=i&&i<=168||i==170||173<=i&&i<=174||176<=i&&i<=180||182<=i&&i<=186||188<=i&&i<=191||i==198||i==208||215<=i&&i<=216||222<=i&&i<=225||i==230||232<=i&&i<=234||236<=i&&i<=237||i==240||242<=i&&i<=243||247<=i&&i<=250||i==252||i==254||i==257||i==273||i==275||i==283||294<=i&&i<=295||i==299||305<=i&&i<=307||i==312||319<=i&&i<=322||i==324||328<=i&&i<=331||i==333||338<=i&&i<=339||358<=i&&i<=359||i==363||i==462||i==464||i==466||i==468||i==470||i==472||i==474||i==476||i==593||i==609||i==708||i==711||713<=i&&i<=715||i==717||i==720||728<=i&&i<=731||i==733||i==735||768<=i&&i<=879||913<=i&&i<=929||931<=i&&i<=937||945<=i&&i<=961||963<=i&&i<=969||i==1025||1040<=i&&i<=1103||i==1105||i==8208||8211<=i&&i<=8214||8216<=i&&i<=8217||8220<=i&&i<=8221||8224<=i&&i<=8226||8228<=i&&i<=8231||i==8240||8242<=i&&i<=8243||i==8245||i==8251||i==8254||i==8308||i==8319||8321<=i&&i<=8324||i==8364||i==8451||i==8453||i==8457||i==8467||i==8470||8481<=i&&i<=8482||i==8486||i==8491||8531<=i&&i<=8532||8539<=i&&i<=8542||8544<=i&&i<=8555||8560<=i&&i<=8569||i==8585||8592<=i&&i<=8601||8632<=i&&i<=8633||i==8658||i==8660||i==8679||i==8704||8706<=i&&i<=8707||8711<=i&&i<=8712||i==8715||i==8719||i==8721||i==8725||i==8730||8733<=i&&i<=8736||i==8739||i==8741||8743<=i&&i<=8748||i==8750||8756<=i&&i<=8759||8764<=i&&i<=8765||i==8776||i==8780||i==8786||8800<=i&&i<=8801||8804<=i&&i<=8807||8810<=i&&i<=8811||8814<=i&&i<=8815||8834<=i&&i<=8835||8838<=i&&i<=8839||i==8853||i==8857||i==8869||i==8895||i==8978||9312<=i&&i<=9449||9451<=i&&i<=9547||9552<=i&&i<=9587||9600<=i&&i<=9615||9618<=i&&i<=9621||9632<=i&&i<=9633||9635<=i&&i<=9641||9650<=i&&i<=9651||9654<=i&&i<=9655||9660<=i&&i<=9661||9664<=i&&i<=9665||9670<=i&&i<=9672||i==9675||9678<=i&&i<=9681||9698<=i&&i<=9701||i==9711||9733<=i&&i<=9734||i==9737||9742<=i&&i<=9743||9748<=i&&i<=9749||i==9756||i==9758||i==9792||i==9794||9824<=i&&i<=9825||9827<=i&&i<=9829||9831<=i&&i<=9834||9836<=i&&i<=9837||i==9839||9886<=i&&i<=9887||9918<=i&&i<=9919||9924<=i&&i<=9933||9935<=i&&i<=9953||i==9955||9960<=i&&i<=9983||i==10045||i==10071||10102<=i&&i<=10111||11093<=i&&i<=11097||12872<=i&&i<=12879||57344<=i&&i<=63743||65024<=i&&i<=65039||i==65533||127232<=i&&i<=127242||127248<=i&&i<=127277||127280<=i&&i<=127337||127344<=i&&i<=127386||917760<=i&&i<=917999||983040<=i&&i<=1048573||1048576<=i&&i<=1114109?"A":"N"},e.characterLength=function(n){var s=this.eastAsianWidth(n);return s=="F"||s=="W"||s=="A"?2:1};function t(n){return n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(n){for(var s=t(n),u=0,i=0;i<s.length;i++)u=u+this.characterLength(s[i]);return u},e.slice=function(n,s,u){textLen=e.length(n),s=s||0,u=u||1,s<0&&(s=textLen+s),u<0&&(u=textLen+u);for(var i="",o=0,a=t(n),l=0;l<a.length;l++){var c=a[l],h=e.length(c);if(o>=s-(h==2?1:0))if(o+h<=u)i+=c;else break;o+=h}return i}})(li);var Ar=li.exports,$r=Di(Ar),wr=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},yr=Di(wr);function fe(r,e={}){if(typeof r!="string"||r.length===0||(e={ambiguousIsNarrow:!0,...e},r=ai(r),r.length===0))return 0;r=r.replace(yr()," ");let t=e.ambiguousIsNarrow?1:2,n=0;for(let s of r){let u=s.codePointAt(0);if(!(u<=31||u>=127&&u<=159||u>=768&&u<=879))switch($r.eastAsianWidth(s)){case"F":case"W":n+=2;break;case"A":n+=t;break;default:n+=1}}return n}var pt=10,Zt=(r=0)=>e=>`\x1B[${e+r}m`,Qt=(r=0)=>e=>`\x1B[${38+r};5;${e}m`,Xt=(r=0)=>(e,t,n)=>`\x1B[${38+r};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 _r=Object.keys(A.color),vr=Object.keys(A.bgColor);[..._r,...vr];function xr(){let r=new Map;for(let[e,t]of Object.entries(A)){for(let[n,s]of Object.entries(t))A[n]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`},t[n]=A[n],r.set(s[0],s[1]);Object.defineProperty(A,e,{value:t,enumerable:!1})}return Object.defineProperty(A,"codes",{value:r,enumerable:!1}),A.color.close="\x1B[39m",A.bgColor.close="\x1B[49m",A.color.ansi=Zt(),A.color.ansi256=Qt(),A.color.ansi16m=Xt(),A.bgColor.ansi=Zt(pt),A.bgColor.ansi256=Qt(pt),A.bgColor.ansi16m=Xt(pt),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(u=>u+u).join(""));let s=Number.parseInt(n,16);return[s>>16&255,s>>8&255,s&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,s;if(e>=232)t=((e-232)*10+8)/255,n=t,s=t;else{e-=16;let o=e%36;t=Math.floor(e/36)/5,n=Math.floor(o/6)/5,s=o%6/5}let u=Math.max(t,n,s)*2;if(u===0)return 30;let i=30+(Math.round(s)<<2|Math.round(n)<<1|Math.round(t));return u===2&&(i+=60),i},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 Br=xr(),Pe=new Set(["\x1B","\x9B"]),Or=39,mt="\x07",ci="[",Sr="]",pi="m",ft=`${Sr}8;;`,ei=r=>`${Pe.values().next().value}${ci}${r}${pi}`,ti=r=>`${Pe.values().next().value}${ft}${r}${mt}`,Ir=r=>r.split(" ").map(e=>fe(e)),ht=(r,e,t)=>{let n=[...e],s=!1,u=!1,i=fe(ai(r[r.length-1]));for(let[o,a]of n.entries()){let l=fe(a);if(i+l<=t?r[r.length-1]+=a:(r.push(a),i=0),Pe.has(a)&&(s=!0,u=n.slice(o+1).join("").startsWith(ft)),s){u?a===mt&&(s=!1,u=!1):a===pi&&(s=!1);continue}i+=l,i===t&&o<n.length-1&&(r.push(""),i=0)}!i&&r[r.length-1].length>0&&r.length>1&&(r[r.length-2]+=r.pop())},Pr=r=>{let e=r.split(" "),t=e.length;for(;t>0&&!(fe(e[t-1])>0);)t--;return t===e.length?r:e.slice(0,t).join(" ")+e.slice(t).join("")},kr=(r,e,t={})=>{if(t.trim!==!1&&r.trim()==="")return"";let n="",s,u,i=Ir(r),o=[""];for(let[l,c]of r.split(" ").entries()){t.trim!==!1&&(o[o.length-1]=o[o.length-1].trimStart());let h=fe(o[o.length-1]);if(l!==0&&(h>=e&&(t.wordWrap===!1||t.trim===!1)&&(o.push(""),h=0),(h>0||t.trim===!1)&&(o[o.length-1]+=" ",h++)),t.hard&&i[l]>e){let m=e-h,C=1+Math.floor((i[l]-m-1)/e);Math.floor((i[l]-1)/e)<C&&o.push(""),ht(o,c,e);continue}if(h+i[l]>e&&h>0&&i[l]>0){if(t.wordWrap===!1&&h<e){ht(o,c,e);continue}o.push("")}if(h+i[l]>e&&t.wordWrap===!1){ht(o,c,e);continue}o[o.length-1]+=c}t.trim!==!1&&(o=o.map(l=>Pr(l)));let a=[...o.join(`
|
|
24
|
-
`)];for(let[l,c]of a.entries()){if(
|
|
25
|
-
`?(
|
|
26
|
-
`&&(
|
|
20
|
+
`),this.outputHelp({error:!0}));let u=t||{},n=u.exitCode||1,s=u.code||"commander.error";this._exit(n,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 hr(this.options),t=u=>this.getOptionValue(u)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(u));this.options.filter(u=>u.implied!==void 0&&t(u.attributeName())&&e.valueFromOption(this.getOptionValue(u.attributeName()),u)).forEach(u=>{Object.keys(u.implied).filter(n=>!t(n)).forEach(n=>{this.setOptionValueWithSource(n,u.implied[n],"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 u=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},n=r=>{let o=u(r),a=o.attributeName();return this.getOptionValueSource(a)==="env"?`environment variable '${o.envVar}'`:`option '${o.flags}'`},s=`error: ${n(e)} cannot be used with ${n(t)}`;this.error(s,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let n=[],s=this;do{let r=s.createHelp().visibleOptions(s).filter(o=>o.long).map(o=>o.long);n=n.concat(r),s=s.parent}while(s&&!s._enablePositionalOptions);t=Nt(e,n)}let u=`error: unknown option '${e}'${t}`;this.error(u,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,u=t===1?"":"s",s=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${u} but got ${e.length}.`;this.error(s,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach(s=>{n.push(s.name()),s.alias()&&n.push(s.alias())}),t=Nt(e,n)}let u=`error: unknown command '${e}'${t}`;this.error(u,{code:"commander.unknownCommand"})}version(e,t,u){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",u=u||"output the version number";let n=this.createOption(t,u);return this._versionOptionName=n.attributeName(),this._registerOption(n),this.on("option:"+n.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 u=this.parent?._findCommand(e);if(u){let n=[u.name()].concat(u.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${n}'`)}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(u=>cr(u));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=L.basename(e,L.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},u;return t.error?u=n=>this._outputConfiguration.writeErr(n):u=n=>this._outputConfiguration.writeOut(n),t.write=e.write||u,t.command=this,t}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let u=this._getHelpContext(e);this._getCommandAndAncestors().reverse().forEach(s=>s.emit("beforeAllHelp",u)),this.emit("beforeHelp",u);let n=this.helpInformation(u);if(t&&(n=t(n),typeof n!="string"&&!Buffer.isBuffer(n)))throw new Error("outputHelp callback must return a string or a Buffer");u.write(n),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",u),this._getCommandAndAncestors().forEach(s=>s.emit("afterAllHelp",u))}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 u=["beforeAll","before","after","afterAll"];if(!u.includes(e))throw new Error(`Unexpected value for position to addHelpText.
|
|
22
|
+
Expecting one of '${u.join("', '")}'`);let n=`${e}Help`;return this.on(n,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(n=>t.is(n))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Ut(i){return i.map(e=>{if(!e.startsWith("--inspect"))return e;let t,u="127.0.0.1",n="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])?n=s[3]:u=s[3]):(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=s[1],u=s[3],n=s[4]),t&&n!=="0"?`${t}=${u}:${parseInt(n)+1}`:e})}qt.Command=ot});var Kt=q(S=>{var{Argument:Ht}=ve(),{Command:at}=Lt(),{CommanderError:dr,InvalidArgumentError:Wt}=fe(),{Help:mr}=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=mr;S.CommanderError=dr;S.InvalidArgumentError=Wt;S.InvalidOptionArgumentError=Wt});var lt=q((nn,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"},fr={up:(i=1)=>"\x1B[S".repeat(i),down:(i=1)=>"\x1B[T".repeat(i)},gr={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:fr,erase:gr,beep:"\x07"}});var pt=q((sn,ct)=>{var Be=process||{},Yt=Be.argv||[],xe=Be.env||{},Cr=!(xe.NO_COLOR||Yt.includes("--no-color"))&&(!!xe.FORCE_COLOR||Yt.includes("--color")||Be.platform==="win32"||(Be.stdout||{}).isTTY&&xe.TERM!=="dumb"||!!xe.CI),Fr=(i,e,t=i)=>u=>{let n=""+u,s=n.indexOf(e,i.length);return~s?i+Er(n,e,t,s)+e:i+n+e},Er=(i,e,t,u)=>{let n="",s=0;do n+=i.substring(s,u)+t,s=u+e.length,u=i.indexOf(e,s);while(~u);return n+i.substring(s)},Zt=(i=Cr)=>{let e=i?Fr:()=>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=Q(Kt(),1),{program:Ku,createCommand:Ju,createArgument:zu,createOption:Yu,CommanderError:Zu,InvalidArgumentError:Qu,InvalidOptionArgumentError:Xu,Command:X,Argument:en,Option:tn,Help:rn}=Jt.default;var v=Q(lt(),1),De=require("node:process"),ee=Q(require("node:readline"),1),mt=Q(require("node:readline"),1),ai=require("node:tty"),re=Q(pt(),1);function br({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 Ar=br();function Di(i){if(typeof i!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof i}\``);return i.replace(Ar,"")}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(u){var n=u.charCodeAt(0),s=u.length==2?u.charCodeAt(1):0,r=n;return 55296<=n&&n<=56319&&56320<=s&&s<=57343&&(n&=1023,s&=1023,r=n<<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(u){var n=this.eastAsianWidth(u);return n=="F"||n=="W"||n=="A"?2:1};function t(u){return u.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(u){for(var n=t(u),s=0,r=0;r<n.length;r++)s=s+this.characterLength(n[r]);return s},e.slice=function(u,n,s){textLen=e.length(u),n=n||0,s=s||1,n<0&&(n=textLen+n),s<0&&(s=textLen+s);for(var r="",o=0,a=t(u),l=0;l<a.length;l++){var c=a[l],p=e.length(c);if(o>=n-(p==2?1:0))if(o+p<=s)r+=c;else break;o+=p}return r}})(ci);var $r=ci.exports,wr=li($r),yr=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},_r=li(yr);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(_r()," ");let t=e.ambiguousIsNarrow?1:2,u=0;for(let n of i){let s=n.codePointAt(0);if(!(s<=31||s>=127&&s<=159||s>=768&&s<=879))switch(wr.eastAsianWidth(n)){case"F":case"W":u+=2;break;case"A":u+=t;break;default:u+=1}}return u}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,u)=>`\x1B[${38+i};2;${e};${t};${u}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 vr=Object.keys(A.color),xr=Object.keys(A.bgColor);[...vr,...xr];function Br(){let i=new Map;for(let[e,t]of Object.entries(A)){for(let[u,n]of Object.entries(t))A[u]={open:`\x1B[${n[0]}m`,close:`\x1B[${n[1]}m`},t[u]=A[u],i.set(n[0],n[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,u)=>e===t&&t===u?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(u/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[u]=t;u.length===3&&(u=[...u].map(s=>s+s).join(""));let n=Number.parseInt(u,16);return[n>>16&255,n>>8&255,n&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,u,n;if(e>=232)t=((e-232)*10+8)/255,u=t,n=t;else{e-=16;let o=e%36;t=Math.floor(e/36)/5,u=Math.floor(o/6)/5,n=o%6/5}let s=Math.max(t,u,n)*2;if(s===0)return 30;let r=30+(Math.round(n)<<2|Math.round(u)<<1|Math.round(t));return s===2&&(r+=60),r},enumerable:!1},rgbToAnsi:{value:(e,t,u)=>A.ansi256ToAnsi(A.rgbToAnsi256(e,t,u)),enumerable:!1},hexToAnsi:{value:e=>A.ansi256ToAnsi(A.hexToAnsi256(e)),enumerable:!1}}),A}var Or=Br(),ke=new Set(["\x1B","\x9B"]),Sr=39,ft="\x07",pi="[",Ir="]",hi="m",gt=`${Ir}8;;`,ti=i=>`${ke.values().next().value}${pi}${i}${hi}`,ii=i=>`${ke.values().next().value}${gt}${i}${ft}`,Pr=i=>i.split(" ").map(e=>ge(e)),dt=(i,e,t)=>{let u=[...e],n=!1,s=!1,r=ge(Di(i[i.length-1]));for(let[o,a]of u.entries()){let l=ge(a);if(r+l<=t?i[i.length-1]+=a:(i.push(a),r=0),ke.has(a)&&(n=!0,s=u.slice(o+1).join("").startsWith(gt)),n){s?a===ft&&(n=!1,s=!1):a===hi&&(n=!1);continue}r+=l,r===t&&o<u.length-1&&(i.push(""),r=0)}!r&&i[i.length-1].length>0&&i.length>1&&(i[i.length-2]+=i.pop())},kr=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("")},jr=(i,e,t={})=>{if(t.trim!==!1&&i.trim()==="")return"";let u="",n,s,r=Pr(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=>kr(l)));let a=[...o.join(`
|
|
24
|
+
`)];for(let[l,c]of a.entries()){if(u+=c,ke.has(c)){let{groups:m}=new RegExp(`(?:\\${pi}(?<code>\\d+)m|\\${gt}(?<uri>.*)${ft})`).exec(a.slice(l).join(""))||{groups:{}};if(m.code!==void 0){let C=Number.parseFloat(m.code);n=C===Sr?void 0:C}else m.uri!==void 0&&(s=m.uri.length===0?void 0:m.uri)}let p=Or.codes.get(Number(n));a[l+1]===`
|
|
25
|
+
`?(s&&(u+=ii("")),n&&p&&(u+=ti(p))):c===`
|
|
26
|
+
`&&(n&&p&&(u+=ti(n)),s&&(u+=ii(s)))}return u};function ri(i,e,t){return String(i).normalize().replace(/\r\n/g,`
|
|
27
27
|
`).split(`
|
|
28
|
-
`).map(
|
|
29
|
-
`)}var
|
|
30
|
-
`),
|
|
31
|
-
`),
|
|
32
|
-
`),
|
|
33
|
-
`).length-1;this.output.write(v.cursor.move(-999,e*-1))}render(){let e=
|
|
34
|
-
`);this.output.write(
|
|
35
|
-
`).slice(
|
|
36
|
-
`)),this._prevFrame=e;return}this.output.write(v.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}},
|
|
37
|
-
${
|
|
38
|
-
`,t=
|
|
39
|
-
${D.default.yellow(
|
|
28
|
+
`).map(u=>jr(u,e,t)).join(`
|
|
29
|
+
`)}var Rr=Object.defineProperty,Tr=(i,e,t)=>e in i?Rr(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,I=(i,e,t)=>(Tr(i,typeof e!="symbol"?e+"":e,t),t);function Vr(i,e){if(i===e)return;let t=i.split(`
|
|
30
|
+
`),u=e.split(`
|
|
31
|
+
`),n=[];for(let s=0;s<Math.max(t.length,u.length);s++)t[s]!==u[s]&&n.push(s);return n}var di=Symbol("clack:cancel");function b(i){return i===di}function Oe(i,e){i.isTTY&&i.setRawMode(e)}var ui=new Map([["k","up"],["j","down"],["h","left"],["l","right"]]),Mr=new Set(["up","down","left","right","space","enter"]),ue=class{constructor({render:e,input:t=De.stdin,output:u=De.stdout,...n},s=!0){I(this,"input"),I(this,"output"),I(this,"rl"),I(this,"opts"),I(this,"_track",!1),I(this,"_render"),I(this,"_cursor",0),I(this,"state","initial"),I(this,"value"),I(this,"error",""),I(this,"subscribers",new Map),I(this,"_prevFrame",""),this.opts=n,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=u}prompt(){let e=new ai.WriteStream(0);return e._write=(t,u,n)=>{this._track&&(this.value=this.rl.line.replace(/\t/g,""),this._cursor=this.rl.cursor,this.emit("value",this.value)),n()},this.input.pipe(e),this.rl=mt.default.createInterface({input:this.input,output:e,tabSize:2,prompt:"",escapeCodeTimeout:50}),mt.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),Oe(this.input,!0),this.output.on("resize",this.render),this.render(),new Promise((t,u)=>{this.once("submit",()=>{this.output.write(v.cursor.show),this.output.off("resize",this.render),Oe(this.input,!1),t(this.value)}),this.once("cancel",()=>{this.output.write(v.cursor.show),this.output.off("resize",this.render),Oe(this.input,!1),t(di)})})}on(e,t){let u=this.subscribers.get(e)??[];u.push({cb:t}),this.subscribers.set(e,u)}once(e,t){let u=this.subscribers.get(e)??[];u.push({cb:t,once:!0}),this.subscribers.set(e,u)}emit(e,...t){let u=this.subscribers.get(e)??[],n=[];for(let s of u)s.cb(...t),s.once&&n.push(()=>u.splice(u.indexOf(s),1));for(let s of n)s()}unsubscribe(){this.subscribers.clear()}onKeypress(e,t){if(this.state==="error"&&(this.state="active"),t?.name&&!this._track&&ui.has(t.name)&&this.emit("cursor",ui.get(t.name)),t?.name&&Mr.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 u=this.opts.validate(this.value);u&&(this.error=u,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
|
+
`),Oe(this.input,!1),this.rl.close(),this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=ri(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
|
|
33
|
+
`).length-1;this.output.write(v.cursor.move(-999,e*-1))}render(){let e=ri(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=Vr(this._prevFrame,e);if(this.restoreCursor(),t&&t?.length===1){let u=t[0];this.output.write(v.cursor.move(0,u)),this.output.write(v.erase.lines(1));let n=e.split(`
|
|
34
|
+
`);this.output.write(n[u]),this._prevFrame=e,this.output.write(v.cursor.move(0,n.length-u-1));return}else if(t&&t?.length>1){let u=t[0];this.output.write(v.cursor.move(0,u)),this.output.write(v.erase.down());let n=e.split(`
|
|
35
|
+
`).slice(u);this.output.write(n.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}}},Se=class extends ue{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 Nr=Object.defineProperty,Ur=(i,e,t)=>e in i?Nr(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,ni=(i,e,t)=>(Ur(i,typeof e!="symbol"?e+"":e,t),t),mi=class extends ue{constructor(i){super(i,!1),ni(this,"options"),ni(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]}},qr=Object.defineProperty,Lr=(i,e,t)=>e in i?qr(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,si=(i,e,t)=>(Lr(i,typeof e!="symbol"?e+"":e,t),t),Ie=class extends ue{constructor({mask:e,...t}){super(t),si(this,"valueWithCursor",""),si(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 u=this.masked.slice(0,this.cursor),n=this.masked.slice(this.cursor);this.valueWithCursor=`${u}${re.default.inverse(n[0])}${n.slice(1)}`}})}get cursor(){return this._cursor}get masked(){return this.value.replaceAll(/./g,this._mask)}},Hr=Object.defineProperty,Wr=(i,e,t)=>e in i?Hr(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,oi=(i,e,t)=>(Wr(i,typeof e!="symbol"?e+"":e,t),t),fi=class extends ue{constructor(i){super(i,!1),oi(this,"options"),oi(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 Gr=Object.defineProperty,Kr=(i,e,t)=>e in i?Gr(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,Jr=(i,e,t)=>(Kr(i,typeof e!="symbol"?e+"":e,t),t),Pe=class extends ue{constructor(e){super(e),Jr(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),u=this.value.slice(this.cursor);this.valueWithCursor=`${t}${re.default.inverse(u[0])}${u.slice(1)}`}})}get cursor(){return this._cursor}},zr=globalThis.process.platform.startsWith("win");function gi({input:i=De.stdin,output:e=De.stdout,overwrite:t=!0,hideCursor:u=!0}={}){let n=ee.createInterface({input:i,output:e,prompt:"",tabSize:1});ee.emitKeypressEvents(i,n),i.isTTY&&i.setRawMode(!0);let s=(r,{name:o})=>{if(String(r)===""){u&&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 u&&e.write(v.cursor.hide),i.once("keypress",s),()=>{i.off("keypress",s),u&&e.write(v.cursor.show),i.isTTY&&!zr&&i.setRawMode(!1),n.terminal=!1,n.close()}}var P=Q(require("node:process"),1),D=Q(pt(),1),le=Q(lt(),1);function Yr(){return P.default.platform!=="win32"?P.default.env.TERM!=="linux":!!P.default.env.CI||!!P.default.env.WT_SESSION||!!P.default.env.TERMINUS_SUBLIME||P.default.env.ConEmuTask==="{cmd::Cmder}"||P.default.env.TERM_PROGRAM==="Terminus-Sublime"||P.default.env.TERM_PROGRAM==="vscode"||P.default.env.TERM==="xterm-256color"||P.default.env.TERM==="alacritty"||P.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Ft=Yr(),w=(i,e)=>Ft?i:e,Zr=w("\u25C6","*"),Ei=w("\u25A0","x"),bi=w("\u25B2","x"),je=w("\u25C7","o"),Qr=w("\u250C","T"),g=w("\u2502","|"),R=w("\u2514","\u2014"),Et=w("\u25CF",">"),bt=w("\u25CB"," "),Xr=w("\u25FB","[\u2022]"),Ci=w("\u25FC","[+]"),eu=w("\u25FB","[ ]"),tu=w("\u25AA","\u2022"),Fi=w("\u2500","-"),iu=w("\u256E","+"),ru=w("\u251C","+"),uu=w("\u256F","+"),nu=w("\u25CF","\u2022"),su=w("\u25C6","*"),ou=w("\u25B2","!"),au=w("\u25A0","x"),Ce=i=>{switch(i){case"initial":case"active":return D.default.cyan(Zr);case"cancel":return D.default.red(Ei);case"error":return D.default.yellow(bi);case"submit":return D.default.green(je)}},x=i=>new Pe({validate:i.validate,placeholder:i.placeholder,defaultValue:i.defaultValue,initialValue:i.initialValue,render(){let e=`${D.default.gray(g)}
|
|
37
|
+
${Ce(this.state)} ${i.message}
|
|
38
|
+
`,t=i.placeholder?D.default.inverse(i.placeholder[0])+D.default.dim(i.placeholder.slice(1)):D.default.inverse(D.default.hidden("_")),u=this.value?this.valueWithCursor:t;switch(this.state){case"error":return`${e.trim()}
|
|
39
|
+
${D.default.yellow(g)} ${u}
|
|
40
40
|
${D.default.yellow(R)} ${D.default.yellow(this.error)}
|
|
41
|
-
`;case"submit":return`${e}${D.default.gray(
|
|
42
|
-
`+D.default.gray(
|
|
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
|
+
`+D.default.gray(g):""}`;default:return`${e}${D.default.cyan(g)} ${u}
|
|
43
43
|
${D.default.cyan(R)}
|
|
44
|
-
`}}}).prompt(),
|
|
45
|
-
${
|
|
46
|
-
`,t=this.valueWithCursor,
|
|
47
|
-
${D.default.yellow(
|
|
44
|
+
`}}}).prompt(),Re=i=>new Ie({validate:i.validate,mask:i.mask??tu,render(){let e=`${D.default.gray(g)}
|
|
45
|
+
${Ce(this.state)} ${i.message}
|
|
46
|
+
`,t=this.valueWithCursor,u=this.masked;switch(this.state){case"error":return`${e.trim()}
|
|
47
|
+
${D.default.yellow(g)} ${u}
|
|
48
48
|
${D.default.yellow(R)} ${D.default.yellow(this.error)}
|
|
49
|
-
`;case"submit":return`${e}${D.default.gray(
|
|
50
|
-
`+D.default.gray(
|
|
49
|
+
`;case"submit":return`${e}${D.default.gray(g)} ${D.default.dim(u)}`;case"cancel":return`${e}${D.default.gray(g)} ${D.default.strikethrough(D.default.dim(u??""))}${u?`
|
|
50
|
+
`+D.default.gray(g):""}`;default:return`${e}${D.default.cyan(g)} ${t}
|
|
51
51
|
${D.default.cyan(R)}
|
|
52
|
-
`}}}).prompt(),
|
|
53
|
-
${
|
|
54
|
-
`,
|
|
55
|
-
${D.default.gray(
|
|
52
|
+
`}}}).prompt(),Fe=i=>{let e=i.active??"Yes",t=i.inactive??"No";return new Se({active:e,inactive:t,initialValue:i.initialValue??!0,render(){let u=`${D.default.gray(g)}
|
|
53
|
+
${Ce(this.state)} ${i.message}
|
|
54
|
+
`,n=this.value?e:t;switch(this.state){case"submit":return`${u}${D.default.gray(g)} ${D.default.dim(n)}`;case"cancel":return`${u}${D.default.gray(g)} ${D.default.strikethrough(D.default.dim(n))}
|
|
55
|
+
${D.default.gray(g)}`;default:return`${u}${D.default.cyan(g)} ${this.value?`${D.default.green(Et)} ${e}`:`${D.default.dim(bt)} ${D.default.dim(e)}`} ${D.default.dim("/")} ${this.value?`${D.default.dim(bt)} ${D.default.dim(t)}`:`${D.default.green(Et)} ${t}`}
|
|
56
56
|
${D.default.cyan(R)}
|
|
57
|
-
`}}}).prompt()},te=
|
|
58
|
-
${
|
|
59
|
-
`;switch(this.state){case"submit":return`${
|
|
60
|
-
${D.default.gray(
|
|
61
|
-
${D.default.cyan(
|
|
57
|
+
`}}}).prompt()},te=i=>{let e=(u,n)=>{let s=u.label??String(u.value);return n==="active"?`${D.default.green(Et)} ${s} ${u.hint?D.default.dim(`(${u.hint})`):""}`:n==="selected"?`${D.default.dim(s)}`:n==="cancelled"?`${D.default.strikethrough(D.default.dim(s))}`:`${D.default.dim(bt)} ${D.default.dim(s)}`},t=0;return new fi({options:i.options,initialValue:i.initialValue,render(){let u=`${D.default.gray(g)}
|
|
58
|
+
${Ce(this.state)} ${i.message}
|
|
59
|
+
`;switch(this.state){case"submit":return`${u}${D.default.gray(g)} ${e(this.options[this.cursor],"selected")}`;case"cancel":return`${u}${D.default.gray(g)} ${e(this.options[this.cursor],"cancelled")}
|
|
60
|
+
${D.default.gray(g)}`;default:{let n=i.maxItems===void 0?1/0:Math.max(i.maxItems,5);this.cursor>=t+n-3?t=Math.max(Math.min(this.cursor-n+3,this.options.length-n),0):this.cursor<t+2&&(t=Math.max(this.cursor-2,0));let s=n<this.options.length&&t>0,r=n<this.options.length&&t+n<this.options.length;return`${u}${D.default.cyan(g)} ${this.options.slice(t,t+n).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
|
+
${D.default.cyan(g)} `)}
|
|
62
62
|
${D.default.cyan(R)}
|
|
63
|
-
`}}}}).prompt()};var
|
|
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(
|
|
65
|
-
${
|
|
66
|
-
`;switch(this.state){case"submit":return`${t}${D.default.gray(
|
|
67
|
-
${D.default.gray(
|
|
68
|
-
`).map((s
|
|
69
|
-
`);return t+D.default.yellow(
|
|
70
|
-
${D.default.yellow(
|
|
71
|
-
`+
|
|
72
|
-
`}default:return`${t}${D.default.cyan(
|
|
73
|
-
${D.default.cyan(
|
|
63
|
+
`}}}}).prompt()};var Ai=i=>{let e=(t,u)=>{let n=t.label??String(t.value);return u==="active"?`${D.default.cyan(Xr)} ${n} ${t.hint?D.default.dim(`(${t.hint})`):""}`:u==="selected"?`${D.default.green(Ci)} ${D.default.dim(n)}`:u==="cancelled"?`${D.default.strikethrough(D.default.dim(n))}`:u==="active-selected"?`${D.default.green(Ci)} ${n} ${t.hint?D.default.dim(`(${t.hint})`):""}`:u==="submitted"?`${D.default.dim(n)}`:`${D.default.dim(eu)} ${D.default.dim(n)}`};return new mi({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
|
+
${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
|
+
${Ce(this.state)} ${i.message}
|
|
66
|
+
`;switch(this.state){case"submit":return`${t}${D.default.gray(g)} ${this.options.filter(({value:u})=>this.value.includes(u)).map(u=>e(u,"submitted")).join(D.default.dim(", "))||D.default.dim("none")}`;case"cancel":{let u=this.options.filter(({value:n})=>this.value.includes(n)).map(n=>e(n,"cancelled")).join(D.default.dim(", "));return`${t}${D.default.gray(g)} ${u.trim()?`${u}
|
|
67
|
+
${D.default.gray(g)}`:""}`}case"error":{let u=this.error.split(`
|
|
68
|
+
`).map((n,s)=>s===0?`${D.default.yellow(R)} ${D.default.yellow(n)}`:` ${n}`).join(`
|
|
69
|
+
`);return t+D.default.yellow(g)+" "+this.options.map((n,s)=>{let r=this.value.includes(n.value),o=s===this.cursor;return o&&r?e(n,"active-selected"):r?e(n,"selected"):e(n,o?"active":"inactive")}).join(`
|
|
70
|
+
${D.default.yellow(g)} `)+`
|
|
71
|
+
`+u+`
|
|
72
|
+
`}default:return`${t}${D.default.cyan(g)} ${this.options.map((u,n)=>{let s=this.value.includes(u.value),r=n===this.cursor;return r&&s?e(u,"active-selected"):s?e(u,"selected"):e(u,r?"active":"inactive")}).join(`
|
|
73
|
+
${D.default.cyan(g)} `)}
|
|
74
74
|
${D.default.cyan(R)}
|
|
75
|
-
`}}}).prompt()};var
|
|
76
|
-
${
|
|
75
|
+
`}}}).prompt()};var Ct=i=>i.replace(Du(),""),H=(i="",e="")=>{let t=`
|
|
76
|
+
${i}
|
|
77
77
|
`.split(`
|
|
78
|
-
`),
|
|
79
|
-
`);process.stdout.write(`${D.default.gray(
|
|
80
|
-
${D.default.green(
|
|
81
|
-
${
|
|
82
|
-
${D.default.gray(
|
|
83
|
-
`)},y=(
|
|
78
|
+
`),u=Ct(e).length,n=Math.max(t.reduce((r,o)=>(o=Ct(o),o.length>r?o.length:r),0),u)+2,s=t.map(r=>`${D.default.gray(g)} ${D.default.dim(r)}${" ".repeat(n-Ct(r).length)}${D.default.gray(g)}`).join(`
|
|
79
|
+
`);process.stdout.write(`${D.default.gray(g)}
|
|
80
|
+
${D.default.green(je)} ${D.default.reset(e)} ${D.default.gray(Fi.repeat(Math.max(n-u-1,1))+iu)}
|
|
81
|
+
${s}
|
|
82
|
+
${D.default.gray(ru+Fi.repeat(n+2)+uu)}
|
|
83
|
+
`)},y=(i="")=>{process.stdout.write(`${D.default.gray(R)} ${D.default.red(i)}
|
|
84
84
|
|
|
85
|
-
`)},
|
|
86
|
-
`)},ce=(
|
|
87
|
-
${D.default.gray(R)} ${
|
|
85
|
+
`)},ne=(i="")=>{process.stdout.write(`${D.default.gray(Qr)} ${i}
|
|
86
|
+
`)},ce=(i="")=>{process.stdout.write(`${D.default.gray(g)}
|
|
87
|
+
${D.default.gray(R)} ${i}
|
|
88
88
|
|
|
89
|
-
`)},d={message:(
|
|
90
|
-
`);t.push(`${e} ${
|
|
89
|
+
`)},d={message:(i="",{symbol:e=D.default.gray(g)}={})=>{let t=[`${D.default.gray(g)}`];if(i){let[u,...n]=i.split(`
|
|
90
|
+
`);t.push(`${e} ${u}`,...n.map(s=>`${D.default.gray(g)} ${s}`))}process.stdout.write(`${t.join(`
|
|
91
91
|
`)}
|
|
92
|
-
`)},info:
|
|
93
|
-
`);let
|
|
94
|
-
`),t()},a=(c="")=>{
|
|
95
|
-
--- API Request ---`),console.error(`${
|
|
96
|
-
`)}catch(
|
|
92
|
+
`)},info:i=>{d.message(i,{symbol:D.default.blue(nu)})},success:i=>{d.message(i,{symbol:D.default.green(su)})},step:i=>{d.message(i,{symbol:D.default.green(je)})},warn:i=>{d.message(i,{symbol:D.default.yellow(ou)})},warning:i=>{d.warn(i)},error:i=>{d.message(i,{symbol:D.default.red(au)})}},ie=()=>{let i=Ft?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],e=Ft?80:120,t,u,n=!1,s="",r=(c="")=>{n=!0,t=gi(),s=c.replace(/\.+$/,""),process.stdout.write(`${D.default.gray(g)}
|
|
93
|
+
`);let p=0,m=0;u=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,n=!1,clearInterval(u);let m=p===0?D.default.green(je):p===1?D.default.red(Ei):D.default.red(bi);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";n&&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 Du(){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 lu={"Content-Type":"application/json"},cu=/\{[^{}]+\}/g,At=class extends Request{constructor(e,t){super(e,t);for(let u in t)u in this||(this[u]=t[u])}};function $t(i){let{baseUrl:e="",fetch:t=globalThis.fetch,querySerializer:u,bodySerializer:n,headers:s,...r}={...i};e.endsWith("/")&&(e=e.substring(0,e.length-1)),s=wi(lu,s);let o=[];async function a(l,c){let{fetch:p=t,headers:m,params:C={},parseAs:h="json",querySerializer:f,bodySerializer:F=n??hu,...E}=c||{},O=typeof u=="function"?u:$i(u);f&&(O=typeof f=="function"?f:$i({...typeof u=="object"?u:{},...f}));let U={redirect:"follow",...r,...E,headers:wi(s,m,C.header)};U.body&&(U.body=F(U.body)),U.body instanceof FormData&&U.headers.delete("Content-Type");let z=new At(du(l,{baseUrl:e,params:C,querySerializer:O}),U),kt={baseUrl:e,fetch:p,parseAs:h,querySerializer:O,bodySerializer:F};for(let Y of o)if(Y&&typeof Y=="object"&&typeof Y.onRequest=="function"){z.schemaPath=l,z.params=C;let Z=await Y.onRequest(z,kt);if(Z){if(!(Z instanceof Request))throw new Error("Middleware must return new Request() when modifying the request");z=Z}}let B=await p(z);for(let Y=o.length-1;Y>=0;Y--){let Z=o[Y];if(Z&&typeof Z=="object"&&typeof Z.onResponse=="function"){z.schemaPath=l,z.params=C;let Ke=await Z.onResponse(B,kt,z);if(Ke){if(!(Ke instanceof Response))throw new Error("Middleware must return new Response() when modifying the response");B=Ke}}}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 Ge=await B.text();try{Ge=JSON.parse(Ge)}catch{}return{error:Ge,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 Te(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 yi(i,e,t){if(!e||typeof e!="object")return"";let u=[],n={simple:",",label:".",matrix:";"}[t.style]||"&";if(t.style!=="deepObject"&&t.explode===!1){for(let o in e)u.push(o,t.allowReserved===!0?e[o]:encodeURIComponent(e[o]));let r=u.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;u.push(Te(o,e[r],t))}let s=u.join(n);return t.style==="label"||t.style==="matrix"?`${n}${s}`:s}function _i(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 u={simple:",",label:".",matrix:";"}[t.style]||"&",n=[];for(let s of e)t.style==="simple"||t.style==="label"?n.push(t.allowReserved===!0?s:encodeURIComponent(s)):n.push(Te(i,s,t));return t.style==="label"||t.style==="matrix"?`${u}${n.join(u)}`:n.join(u)}function $i(i){return function(t){let u=[];if(t&&typeof t=="object")for(let n in t){let s=t[n];if(s!=null){if(Array.isArray(s)){u.push(_i(n,s,{style:"form",explode:!0,...i?.array,allowReserved:i?.allowReserved||!1}));continue}if(typeof s=="object"){u.push(yi(n,s,{style:"deepObject",explode:!0,...i?.object,allowReserved:i?.allowReserved||!1}));continue}u.push(Te(n,s,i))}}return u.join("&")}}function pu(i,e){let t=i;for(let u of i.match(cu)??[]){let n=u.substring(1,u.length-1),s=!1,r="simple";if(n.endsWith("*")&&(s=!0,n=n.substring(0,n.length-1)),n.startsWith(".")?(r="label",n=n.substring(1)):n.startsWith(";")&&(r="matrix",n=n.substring(1)),!e||e[n]===void 0||e[n]===null)continue;let o=e[n];if(Array.isArray(o)){t=t.replace(u,_i(n,o,{style:r,explode:s}));continue}if(typeof o=="object"){t=t.replace(u,yi(n,o,{style:r,explode:s}));continue}if(r==="matrix"){t=t.replace(u,`;${Te(n,o)}`);continue}t=t.replace(u,r==="label"?`.${o}`:o)}return t}function hu(i){return JSON.stringify(i)}function du(i,e){let t=`${e.baseUrl}${i}`;e.params?.path&&(t=pu(t,e.params.path));let u=e.querySerializer(e.params.query??{});return u.startsWith("?")&&(u=u.substring(1)),u&&(t+=`?${u}`),t}function wi(...i){let e=new Headers;for(let t of i){if(!t||typeof t!="object")continue;let u=t instanceof Headers?t.entries():Object.entries(t);for(let[n,s]of u)if(s===null)e.delete(n);else if(Array.isArray(s))for(let r of s)e.append(n,r);else s!==void 0&&e.set(n,s)}return e}var G=require("node:fs"),vi=require("node:os"),yt=require("node:path");var se=class extends Error{constructor(e){super(e),this.name="CliError"}},T=class extends se{constructor(e){super(e),this.name="ConfigError"}},k=class extends se{constructor(t,u,n,s){super(`API Error (${t}): ${u}`);this.statusCode=t;this.errorType=n;this.details=s;this.name="ApiError"}},W=class extends se{constructor(t,u,n){super(`Job ${t}: ${u??"Unknown error"}`);this.status=t;this.errorMessage=u;this.details=n;this.name="JobError"}formatDetails(){let t=[this.message];if(this.details){let u=this.details.results;if(u)for(let[n,s]of Object.entries(u))s.status==="failed"&&s.error_message&&t.push(` ${n}: ${s.error_message}`)}return t}},Ve=class extends se{constructor(e){super(e),this.name="TimeoutError"}};function pe(i,e){let t=i!=null&&typeof i=="object",u=t&&"message"in i?String(i.message):`HTTP ${e?.status??"unknown"} error`,n=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(n??400,u,void 0,s.length>0?s:void 0)}var oe=class extends se{constructor(e){super(e),this.name="ValidationError"}};var wt=(0,yt.join)((0,vi.homedir)(),".descript-cli"),be=(0,yt.join)(wt,"config.json"),K="https://descriptapi.com/v1/",Me="default";function mu(){(0,G.existsSync)(wt)||(0,G.mkdirSync)(wt,{recursive:!0})}function j(){try{if((0,G.existsSync)(be)){let i=(0,G.readFileSync)(be,"utf-8"),e=JSON.parse(i);return e.profiles?e:{activeProfile:Me,profiles:{[Me]:{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:Me,profiles:{}}}function ae(i){mu(),(0,G.writeFileSync)(be,JSON.stringify(i,null,2))}function Ne(){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:Ne().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 V(){return process.env.DESCRIPT_API_URL?process.env.DESCRIPT_API_URL:Ne().apiUrl??K}function we(){return Ne().apiUrl}function Ue(i){let e=j(),t=e.activeProfile;e.profiles[t]||(e.profiles[t]={}),e.profiles[t].apiUrl=i,ae(e)}function _t(){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":Ne().debug??!1}function vt(i){let e=j(),t=e.activeProfile;e.profiles[t]||(e.profiles[t]={}),e.profiles[t].debug=i,ae(e)}function qe(){return process.env.DESCRIPT_PROFILE?process.env.DESCRIPT_PROFILE:j().activeProfile}function xt(){let i=j();return Object.keys(i.profiles)}function Bt(i){let e=j();if(!e.profiles[i])throw new T(`Profile "${i}" does not exist`);e.activeProfile=i,ae(e)}function Ot(i){let e=j();if(e.profiles[i])throw new T(`Profile "${i}" already exists`);e.profiles[i]={},ae(e)}function xi(i){let e=j();if(i===Me)throw new T("Cannot delete the default profile");if(!e.profiles[i])throw new T(`Profile "${i}" does not exist`);if(e.activeProfile===i)throw new T("Cannot delete the active profile. Switch to another profile first.");delete e.profiles[i],ae(e)}function Bi(i){let e=j();return i in e.profiles}var fu="@descript/platform-cli",gu="0.2.2";function Cu(i){return i.length<=12?"Bearer ***":`Bearer ${i.slice(0,8)}...${i.slice(-4)}`}function Oi(i,e){let t=$t({baseUrl:e,headers:{Authorization:`Bearer ${i}`,"User-Agent":`${fu}/${gu} node/${process.version}`}});return _()&&t.use({async onRequest(n){try{if(console.error(`
|
|
95
|
+
--- API Request ---`),console.error(`${n.method} ${n.url}`),n.headers){let s=Object.fromEntries(n.headers.entries());s.authorization&&(s.authorization=Cu(i)),console.error("Headers:",s)}if(n.body)try{let r=await n.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 n}}),t}function Le(){let i=he();if(!i)throw new T("API key not configured. Run `descript-api config` to set up.");return Oi(i,V())}function Si(i){return Oi(i,V())}var me=["api-key","api-url","debug"];function Ii(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 we();case"debug":return _()}}function St(i,e){switch(i){case"api-key":Ae(e);break;case"api-url":Ue(e);break;case"debug":vt(e);break}}function Pi(i,e){if(i==="api-url"){let t=V();return e||`${t} (default)`}return i==="debug"?e?"enabled":"disabled":e?i==="api-key"?Ii(e):e:"Not configured"}async function It(i){let e=ie();e.start("Validating API key...");try{let t=Si(i),{error:u}=await t.GET("/status");return u!=null&&typeof u=="object"&&"error"in u&&u.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 M=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
|
|
@@ -107,30 +107,30 @@ Configuration Commands:
|
|
|
107
107
|
config clear api-url Clear API URL (revert to default)
|
|
108
108
|
|
|
109
109
|
Examples:
|
|
110
|
-
$ descript-
|
|
111
|
-
$ descript-
|
|
112
|
-
$ descript-
|
|
113
|
-
$ descript-
|
|
114
|
-
$ descript-
|
|
115
|
-
`).action(async()=>{await
|
|
116
|
-
Configuration (${
|
|
117
|
-
`);for(let e of
|
|
110
|
+
$ descript-api config # Interactive configuration
|
|
111
|
+
$ descript-api config profile:create staging # Create staging profile
|
|
112
|
+
$ descript-api config profile staging # Switch to staging
|
|
113
|
+
$ descript-api config set api-key # Set API key for active profile
|
|
114
|
+
$ descript-api config list # View current configuration
|
|
115
|
+
`).action(async()=>{await Fu()});async function Fu(){ne("Descript CLI - Configuration");let i=xt(),e=qe(),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 n=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(n)){y("Configuration cancelled");return}if(n==="new"){let s=await x({message:"Enter new profile name:",validate:r=>{if(!r)return"Profile name is required";if(Bi(r))return"Profile already exists"}});if(b(s)){y("Configuration cancelled");return}Ot(s),t=s,d.success(`Created profile: ${t}`)}else t=n}for(t!==e&&(Bt(t),d.info(`Switched to profile: ${t}`)),d.info(`Configuring profile: ${t}`),he()||(d.info("First-time setup - please configure your settings:"),await Eu());;){let n=me.map(r=>{let o=de(r),a=Pi(r,o);return{value:r,label:r,hint:a}});n.push({value:"done",label:"Done",hint:"Exit configuration"});let s=await te({message:"Select a setting to update:",options:n});if(b(s)||s==="done"){ce(`Configuration saved to ${$e()}`);return}await bu(s)}}async function Eu(){let i=await Re({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(i)&&(y("Setup cancelled"),process.exit(0)),await It(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: "+K+")",initialValue:!1});if(b(t)&&(y("Setup cancelled"),process.exit(0)),t){let u=await x({message:"Enter API base URL:",placeholder:K,validate:n=>{if(!n)return"API URL is required";try{new URL(n)}catch{return"Please enter a valid URL"}}});b(u)||(Ue(u),d.success("API URL saved"))}d.success("Setup complete!")}async function bu(i){if(i==="api-key"){let e=he(),t=await Re({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"}});if(b(t))return;if(t===e){d.info("API key unchanged");return}await It(t)?(Ae(t),d.success("API key saved")):d.error("Invalid API key - not saved")}else if(i==="api-url"){let e=we(),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:K}]});if(b(t))return;if(t==="clear"){if(!e){d.info("Already using default URL");return}_t(),d.success(`API URL reset to default: ${K}`)}else{let u=await x({message:"Enter API base URL:",placeholder:K,initialValue:e??"",validate:n=>{if(!n)return"API URL is required";try{new URL(n)}catch{return"Please enter a valid URL"}}});if(b(u))return;if(u===e){d.info("API URL unchanged");return}Ue(u),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}vt(t),d.success(`Debug mode ${t?"enabled":"disabled"}`)}}M.command("list").description("Show all configuration values").action(()=>{Au()});function Au(){let i=qe();console.log(`
|
|
116
|
+
Configuration (${$e()}):`),console.log(`Active Profile: ${i}
|
|
117
|
+
`);for(let e of me){let t=de(e),u=Pi(e,t);console.log(` ${e}: ${u}`)}console.log("")}M.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(V());return}if(i==="debug"){console.log(_());return}let e=de(i);e?console.log(i==="api-key"?Ii(e):e):(console.error(`${i} is not configured`),process.exit(1))});M.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(ne(`Set ${i}`),t==="api-key"){let u=await Re({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(u)&&(y("Cancelled"),process.exit(0)),e=u}else if(t==="api-url"){let u=we(),n=await x({message:"Enter API base URL:",placeholder:K,initialValue:u??"",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(n)&&(y("Cancelled"),process.exit(0)),e=n}else if(t==="debug"){let u=_(),n=await Fe({message:"Enable debug mode? (prints API requests)",initialValue:u});b(n)&&(y("Cancelled"),process.exit(0));let s=n,r=de(t);if(s===r){d.info("Debug mode unchanged");return}St(t,s),d.success(`Debug mode ${s?"enabled":"disabled"}`);return}}if(t==="api-key"&&e&&(await It(e)||(y("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 u=e==="true",n=de(t);if(u===n){console.log(`${i} unchanged`);return}St(t,u),console.log(`${i} saved to ${$e()}`);return}if(e!=null){let u=de(t);if(e===u){console.log(`${i} unchanged`);return}St(t,e),console.log(`${i} saved to ${$e()}`)}});M.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)),!we()){console.log("api-url already using default");return}_t(),console.log(`api-url cleared. Now using default: ${K}`)});M.command("profiles").description("List all profiles").action(()=>{let i=xt(),e=qe();if(i.length===0){console.log("No profiles configured");return}console.log(`
|
|
118
118
|
Profiles:
|
|
119
|
-
`);for(let t of
|
|
120
|
-
Polling error response:`),console.error(JSON.stringify(C,null,2)))),null;throw a?.stop("Job status check failed"),
|
|
121
|
-
Job failed - full response:`),console.error(JSON.stringify(m,null,2))),new W("failed",
|
|
122
|
-
Job completed - full response:`),console.log(JSON.stringify(m,null,2))),m}if(Date.now()-l>
|
|
123
|
-
`).flatMap(t=>{let
|
|
124
|
-
`)}function J(
|
|
125
|
-
`)}function
|
|
126
|
-
API error response:`),console.error(JSON.stringify(c,null,2)))
|
|
119
|
+
`);for(let t of i)console.log(`${t===e?"* ":" "}${t}`);console.log("")});M.command("profile <name>").description("Switch to a different profile").action(i=>{try{Bt(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)}});M.command("profile:create <name>").description("Create a new profile").action(i=>{try{Ot(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)}});M.command("profile:delete <name>").description("Delete a profile").action(i=>{try{xi(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 ki(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 ji(i){return i===429||i>=500&&i<600}var $u=["stopped","cancelled"];function wu(i){return $u.includes(i)}function Ri(i){return new Promise(e=>setTimeout(e,i))}function yu(i){if(i.result&&i.result.status==="error")return i.result.error_message}async function He(i,e,t,u={}){let{intervalMs:n=2e3,timeoutMs:s=18e5,maxRetries:r=5,quiet:o=!1}=u,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&&ji(h.status)){if(p<r){let E=ki(h.headers.get("Retry-After"))??Math.min(n*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 Ri(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(wu(f)){if(f==="cancelled")throw a?.stop(`Job cancelled (${c()})`),new W("cancelled","Job was cancelled",m);let F=yu(m);if(F)throw a?.stop(`Job failed (${c()})`),_()&&(console.error(`
|
|
121
|
+
Job failed - full response:`),console.error(JSON.stringify(m,null,2))),new W("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 Ve(`Job ${e} did not complete within ${s}ms`);a?.message(`${t} (${c()}) - ${f}`),await Ri(n)}}var _u=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function vu(i){return _u.test(i)}function xu(i){try{return new URL(i),!0}catch{return!1}}function ye(i){b(i)&&(y("Operation cancelled"),process.exit(0))}async function Bu(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(!vu(t))return"Please enter a valid UUID"}});return ye(e),e}async function We(i,e,t="CLI Import",u=!1){if(i)return d.step(`Project ID: ${i}`),{projectId:i};if(e)return d.step(`Project name: ${e}`),{projectName:e};if(u){let s=new Date().toISOString().split("T")[0],r=`${t} ${s}`;return d.step(`Project name: ${r}`),{projectName:r}}let n=await te({message:"Import to new or existing project?",options:[{value:"new",label:"Create new project"},{value:"existing",label:"Use existing project"}]});if(ye(n),n==="new"){let s=new Date().toISOString().split("T")[0],r=`${t} ${s}`,o=await x({message:"Enter project name:",placeholder:r,defaultValue:r});return ye(o),{projectName:o||r}}else return{projectId:await Bu()}}async function Ti(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 ye(e),e}function Vi(){return{media:new Map,sequences:new Map,compositions:[]}}function Ou(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 Mi(i){let e=new Set;for(let t of i.media.keys())e.add(t);for(let[t,u]of i.sequences){e.add(t);for(let n of u)e.add(n.media)}return e}function Su(i,e){try{let u=new URL(i).pathname.split("/");return u[u.length-1]||e}catch{return e}}function Iu(i,e){if(!e.has(i))return i;let t=i.lastIndexOf("."),u=t>0?i.slice(0,t):i,n=t>0?i.slice(t):"",s=2,r;do r=`${u} ${s}${n}`,s++;while(e.has(r));return r}async function Ni(i){let e=i.media.size+i.sequences.size,t=i.compositions.length,u=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 ye(u),u}async function Pt(i){let e=await x({message:"Enter media URL:",placeholder:"https://example.com/video.mp4",validate:o=>{if(o&&!xu(o))return"Please enter a valid URL"}});if(b(e)||!e)return null;let t=Mi(i),u=Su(e,`media_${i.media.size+1}`),n=Iu(u,t),s=await x({message:"Name for this file:",placeholder:n});if(b(s))return null;let r=s||n;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 Ui(i){let e=Mi(i),t="Sequence",u=1;for(;e.has(t);)t=`Sequence_${u}`,u++;let n=await x({message:"Sequence name (press Enter for default):",placeholder:t,validate:c=>{if(c&&e.has(c))return"Name already exists"}});if(b(n))return null;let s=n||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 Pt(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 qi(i){let e=Ou(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 u=t||void 0,n=await Ai({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(n))return null;let s=n;return s.length===0?(d.warn("No items selected. Composition not added."),null):{name:u,items:s}}function Li(){return process.stdout.columns||80}function Pu(i,e){if(e<1&&(e=1),i.length<=e)return[i];let t=i.split(" "),u=[],n="";for(let s of t)if(n.length===0)if(s.length>e){for(let r=0;r<s.length;r+=e)u.push(s.slice(r,r+e));n=u.pop()}else n=s;else if(n.length+1+s.length<=e)n+=" "+s;else if(u.push(n),s.length>e){for(let r=0;r<s.length;r+=e)u.push(s.slice(r,r+e));n=u.pop()}else n=s;return n.length>0&&u.push(n),u}function Hi(i,e){return i.split(`
|
|
123
|
+
`).flatMap(t=>{let u=t.match(/^(\s*)/)?.[0]??"",n=t.slice(u.length),s=e-u.length;return s<1?[t]:n.length===0?[""]:Pu(n,s).map(r=>u+r)}).join(`
|
|
124
|
+
`)}function J(i){let e=Li()-4;return Hi(i,e)}function Wi(i){let e=Li()-3;return Hi(i,e)}function ku(i,e=60){if(i.length<=e)return i;try{let t=new URL(i),u=`${t.origin}${t.pathname}`;return u.length<=e?u+(t.search?"...":""):u.slice(0,e-3)+"..."}catch{return i.slice(0,e-3)+"..."}}function ju(i,e,t){let u=[],n="projectId"in e?`Existing project: ${e.projectId}`:`New project: ${e.projectName}`;if(u.push(n),t&&u.push(`Team access: ${t}`),i.media.size>0){u.push(""),u.push(`Media files (${i.media.size}):`);for(let[s,r]of i.media)u.push(` ${s}: ${ku(r)}`)}if(i.sequences.size>0){u.push(""),u.push(`Sequences (${i.sequences.size}):`);for(let[s,r]of i.sequences){let o=r.map(a=>a.media).join(", ");u.push(` ${s}: ${o} (${r.length} tracks)`)}}if(i.compositions.length>0){u.push(""),u.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)";u.push(` ${r}: ${o}`)}}return u.join(`
|
|
125
|
+
`)}function Ru(i){let e={};for(let[t,u]of i.media)e[t]={url:u};for(let[t,u]of i.sequences){for(let n of u)e[n.media]||(e[n.media]={url:n.url});e[t]={tracks:u.map(n=>({media:n.media,offset:n.offset!==0?n.offset:void 0}))}}return e}function Tu(i,e=!1){if(i.compositions.length>0)return i.compositions.map(u=>({name:u.name,clips:u.items.map(n=>({media:n}))}));if(!e)return[];let t=[...i.media.keys(),...i.sequences.keys()];return t.length===0?[]:[{clips:t.map(u=>({media:u}))}]}var Gi=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=>{ne("Descript CLI - Import");try{d.info(`API: ${V()}`);let e=Le(),t=parseInt(i.timeout??"30",10);if(isNaN(t)||t<=0)throw new oe("Timeout must be a positive number of minutes");let u=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 n=await We(i.projectId,i.name,"CLI Import",i.new),s=Vi();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 Ni(s)){case"media":{let F=await Pt(s);F&&(s.media.set(F.name,F.url),d.success(`Added media: ${F.name}`));break}case"sequence":{let F=await Ui(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 qi(s);F&&(s.compositions.push(F),d.success(`Added composition: ${F.name||"(default)"}`));break}case"done":h=!0;break}}let r=Ru(s),o=Tu(s,i.composition);H(J(ju(s,n,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 n?{project_id:n.projectId}:{project_name:n.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
|
+
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}`];H(J(m.join(`
|
|
128
|
-
`)),"Import Started");let C=await
|
|
128
|
+
`)),"Import Started");let C=await He(e,l.job_id,"Waiting for import to complete...",{timeoutMs:u});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}`)}H(J(f.join(`
|
|
129
129
|
`)),"Import Complete")}ce(`Project: ${l.project_url}`)}catch(e){if(e instanceof W){let t=e.formatDetails();y(t[0]),t.length>1&&d.error(t.slice(1).join(`
|
|
130
|
-
`))}else if(e instanceof
|
|
131
|
-
`)),"Agent Details");let a=ie();a.start("Submitting agent request...");let{data:l,error:c,response:
|
|
132
|
-
API error response:`),console.error(JSON.stringify(c,null,2)))
|
|
130
|
+
`))}else if(e instanceof k){if(y(e.message),e.details&&e.details.length>0)for(let t of e.details)d.error(` ${t}`)}else e instanceof Error?y(e.message):y("An unexpected error occurred");process.exit(1)}});var Ki=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=>{ne("Descript CLI - AI Agent");try{d.info(`API: ${V()}`);let e=Le(),t=parseInt(i.timeout??"30",10);if(isNaN(t)||t<=0)throw new oe("Timeout must be a positive number of minutes");let u=t*60*1e3,n=await We(i.projectId,i.name,"CLI Edit",i.new),s=await Ti(i.prompt),o=["projectId"in n?`Existing project: ${n.projectId}`:`New project: ${n.projectName}`,`Prompt: "${s}"`];i.compositionId&&o.push(`Composition ID: ${i.compositionId}`),i.model&&o.push(`Model: ${i.model}`),H(J(o.join(`
|
|
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 n?{project_id:n.projectId}:{project_name:n.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
|
+
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}`];H(J(m.join(`
|
|
134
|
-
`)),"Agent Job Submitted");let C=await
|
|
135
|
-
`)),"Agent Complete")}else H(J(`Status: ${
|
|
136
|
-
`))}else if(e instanceof
|
|
134
|
+
`)),"Agent Job Submitted");let C=await He(e,l.job_id,"Waiting for agent to complete...",{timeoutMs:u});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(Wi(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}`),H(J(f.join(`
|
|
135
|
+
`)),"Agent Complete")}else H(J(`Status: ${h.status}`),"Agent Complete")}ce(`Project: ${l.project_url}`)}catch(e){if(e instanceof W){let t=e.formatDetails();y(t[0]),t.length>1&&d.error(t.slice(1).join(`
|
|
136
|
+
`))}else if(e instanceof k){if(y(e.message),e.details&&e.details.length>0)for(let t of e.details)d.error(` ${t}`)}else e instanceof Error?y(e.message):y("An unexpected error occurred");process.exit(1)}});var Vu="0.2.2",N=new X;N.name("descript-api").description("CLI for Descript API - import media and run AI edits").version(Vu);N.addCommand(M);N.addCommand(Gi);N.addCommand(Ki);N.command("help [command]").description("Show help for a command").action(i=>{if(!i){N.help();return}let e=N.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))});N.action(()=>{N.help()});function Ji(i){N.parse(i,{from:"user"})}Ji(process.argv.slice(2));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@descript/platform-cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "CLI for Descript API - import media and run AI edits",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -9,10 +9,19 @@
|
|
|
9
9
|
"url": "git+https://github.com/descriptinc/descript-api-examples.git",
|
|
10
10
|
"directory": "cli"
|
|
11
11
|
},
|
|
12
|
-
"keywords": [
|
|
13
|
-
|
|
12
|
+
"keywords": [
|
|
13
|
+
"descript",
|
|
14
|
+
"cli",
|
|
15
|
+
"api",
|
|
16
|
+
"video",
|
|
17
|
+
"audio",
|
|
18
|
+
"ai"
|
|
19
|
+
],
|
|
20
|
+
"files": [
|
|
21
|
+
"dist/"
|
|
22
|
+
],
|
|
14
23
|
"bin": {
|
|
15
|
-
"descript-api": "
|
|
24
|
+
"descript-api": "dist/descript-cli.cjs"
|
|
16
25
|
},
|
|
17
26
|
"scripts": {
|
|
18
27
|
"build": "node build.mjs",
|