clerc 0.28.1 → 0.30.0

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/index.d.ts CHANGED
@@ -257,6 +257,13 @@ interface Plugin<T extends Clerc = Clerc, U extends Clerc = Clerc> {
257
257
  setup: (cli: T) => U;
258
258
  }
259
259
 
260
+ type Locales = Dict<Dict<string>>;
261
+ type TranslateFn = (name: string, ...args: string[]) => string | undefined;
262
+ interface I18N {
263
+ add: (locales: Locales) => void;
264
+ t: TranslateFn;
265
+ }
266
+
260
267
  type CommandType = RootType | string;
261
268
  type FlagOptions = FlagSchema & {
262
269
  description?: string;
@@ -323,15 +330,13 @@ type InspectorFn<C extends CommandRecord = CommandRecord> = (ctx: InspectorConte
323
330
  interface InspectorObject<C extends CommandRecord = CommandRecord> {
324
331
  enforce?: "pre" | "post";
325
332
  fn: InspectorFn<C>;
326
- }
327
- interface I18N {
328
- add: () => void;
329
333
  }
330
334
 
331
335
  declare const Root: unique symbol;
332
336
  type RootType = typeof Root;
333
337
  declare class Clerc<C extends CommandRecord = {}> {
334
338
  #private;
339
+ i18n: I18N;
335
340
  private constructor();
336
341
  get _name(): string;
337
342
  get _description(): string;
@@ -365,7 +370,8 @@ declare class Clerc<C extends CommandRecord = {}> {
365
370
  * @example
366
371
  * ```ts
367
372
  * Clerc.create()
368
- * .description("test cli")
373
+ * .description("test cli")
374
+ * ```
369
375
  */
370
376
  description(description: string): this;
371
377
  /**
@@ -375,9 +381,47 @@ declare class Clerc<C extends CommandRecord = {}> {
375
381
  * @example
376
382
  * ```ts
377
383
  * Clerc.create()
378
- * .version("1.0.0")
384
+ * .version("1.0.0")
385
+ * ```
379
386
  */
380
387
  version(version: string): this;
388
+ /**
389
+ * Set the Locale
390
+ * You must call this method once after you created the Clerc instance.
391
+ * @param locale
392
+ * @returns
393
+ * @example
394
+ * ```ts
395
+ * Clerc.create()
396
+ * .locale("en")
397
+ * .command(...)
398
+ * ```
399
+ */
400
+ locale(locale: string): this;
401
+ /**
402
+ * Set the fallback Locale
403
+ * You must call this method once after you created the Clerc instance.
404
+ * @param fallbackLocale
405
+ * @returns
406
+ * @example
407
+ * ```ts
408
+ * Clerc.create()
409
+ * .fallbackLocale("en")
410
+ * .command(...)
411
+ * ```
412
+ */
413
+ fallbackLocale(fallbackLocale: string): this;
414
+ /**
415
+ * Register a error handler
416
+ * @param handler
417
+ * @returns
418
+ * @example
419
+ * ```ts
420
+ * Clerc.create()
421
+ * .errorHandler((err) => { console.log(err); })
422
+ * ```
423
+ */
424
+ errorHandler(handler: (err: any) => void): this;
381
425
  /**
382
426
  * Register a command
383
427
  * @param name
@@ -426,7 +470,7 @@ declare class Clerc<C extends CommandRecord = {}> {
426
470
  * })
427
471
  * ```
428
472
  */
429
- on<K extends LiteralUnion<keyof CM, string>, CM extends this["_commands"] = this["_commands"]>(name: K, handler: Handler<CM, K>): this;
473
+ on<K extends LiteralUnion<keyof CM, string | RootType>, CM extends this["_commands"] = this["_commands"]>(name: K, handler: Handler<CM, K>): this;
430
474
  /**
431
475
  * Use a plugin
432
476
  * @param plugin
@@ -463,6 +507,16 @@ declare class Clerc<C extends CommandRecord = {}> {
463
507
  * ```
464
508
  */
465
509
  parse(optionsOrArgv?: string[] | ParseOptions): this;
510
+ /**
511
+ * Run matched command
512
+ * @returns
513
+ * @example
514
+ * ```ts
515
+ * Clerc.create()
516
+ * .parse({ run: false })
517
+ * .runMatchedCommand()
518
+ * ```
519
+ */
466
520
  runMatchedCommand(): this;
467
521
  }
468
522
 
@@ -475,36 +529,40 @@ declare const defineCommand: <N extends string | typeof Root, O extends CommandO
475
529
 
476
530
  declare class CommandExistsError extends Error {
477
531
  commandName: string;
478
- constructor(commandName: string);
532
+ constructor(commandName: string, t: TranslateFn);
479
533
  }
480
534
  declare class NoSuchCommandError extends Error {
481
535
  commandName: string;
482
- constructor(commandName: string);
536
+ constructor(commandName: string, t: TranslateFn);
483
537
  }
484
538
  declare class NoCommandGivenError extends Error {
485
- constructor();
539
+ constructor(t: TranslateFn);
486
540
  }
487
541
  declare class CommandNameConflictError extends Error {
488
542
  n1: string;
489
543
  n2: string;
490
- constructor(n1: string, n2: string);
544
+ constructor(n1: string, n2: string, t: TranslateFn);
491
545
  }
492
546
  declare class NameNotSetError extends Error {
493
- constructor();
547
+ constructor(t: TranslateFn);
494
548
  }
495
549
  declare class DescriptionNotSetError extends Error {
496
- constructor();
550
+ constructor(t: TranslateFn);
497
551
  }
498
552
  declare class VersionNotSetError extends Error {
499
- constructor();
553
+ constructor(t: TranslateFn);
500
554
  }
501
555
  declare class InvalidCommandNameError extends Error {
502
556
  commandName: string;
503
- constructor(commandName: string);
557
+ constructor(commandName: string, t: TranslateFn);
558
+ }
559
+ declare class LocaleNotCalledFirstError extends Error {
560
+ constructor(t: TranslateFn);
504
561
  }
505
562
 
506
- declare function resolveFlattenCommands(commands: CommandRecord): Map<string[] | typeof Root, CommandAlias<string, CommandOptions<string[], MaybeArray$1<string | typeof Root>, Flags>>>;
507
- declare function resolveCommand(commands: CommandRecord, name: string | string[] | RootType): Command<string | RootType> | undefined;
563
+ declare function resolveFlattenCommands(commands: CommandRecord, t: TranslateFn): Map<string[] | typeof Root, CommandAlias<string, CommandOptions<string[], MaybeArray$1<string | typeof Root>, Flags>>>;
564
+ declare function resolveCommand(commands: CommandRecord, name: CommandType | string[], t: TranslateFn): [Command<string | RootType> | undefined, string[] | RootType | undefined];
565
+ declare function resolveCommandStrict(commands: CommandRecord, name: CommandType | string[], t: TranslateFn): [Command<string | RootType> | undefined, string[] | RootType | undefined];
508
566
  declare function resolveSubcommandsByParent(commands: CommandRecord, parent: string | string[], depth?: number): Command<string, CommandOptions<string[], MaybeArray$1<string | typeof Root>, Flags>>[];
509
567
  declare const resolveRootCommands: (commands: CommandRecord) => Command<string, CommandOptions<string[], MaybeArray$1<string | typeof Root>, Flags>>[];
510
568
  declare function resolveParametersBeforeFlag(argv: string[]): string[];
@@ -512,13 +570,39 @@ declare const resolveArgv: () => string[];
512
570
  declare function compose(inspectors: Inspector[]): (getCtx: () => InspectorContext) => void;
513
571
  declare const isInvalidName: (name: CommandType) => boolean;
514
572
  declare const withBrackets: (s: string, isOptional?: boolean) => string;
515
- declare const formatCommandName: (name: string | string[] | RootType) => string;
573
+ declare const formatCommandName: (name: string | string[] | RootType) => string;
574
+ declare const detectLocale: () => string;
516
575
 
517
576
  interface CompletionsPluginOptions {
518
577
  command?: boolean;
519
578
  }
520
579
  declare const completionsPlugin: (options?: CompletionsPluginOptions) => Plugin<Clerc<{}>, Clerc<{}>>;
521
580
 
581
+ interface BlockSection {
582
+ type?: "block";
583
+ title: string;
584
+ body: string[];
585
+ }
586
+ interface InlineSection {
587
+ type: "inline";
588
+ items: {
589
+ title: string;
590
+ body: string;
591
+ }[];
592
+ }
593
+ type Section = BlockSection | InlineSection;
594
+ interface Renderers {
595
+ renderSections?: (sections: Section[]) => Section[];
596
+ renderFlagName?: (name: string) => string;
597
+ renderType?: (type: any, hasDefault: boolean) => string;
598
+ renderDefault?: (default_: any) => string;
599
+ }
600
+
601
+ declare module "@clerc/core" {
602
+ interface CommandCustomProperties {
603
+ help?: Renderers;
604
+ }
605
+ }
522
606
  interface HelpPluginOptions {
523
607
  /**
524
608
  * Whether to registr the help command.
@@ -542,12 +626,8 @@ interface HelpPluginOptions {
542
626
  * Banner
543
627
  */
544
628
  banner?: string;
545
- /**
546
- * Render type
547
- */
548
- renderer?: "cliffy";
549
629
  }
550
- declare const helpPlugin: ({ command, showHelpWhenNoCommand, notes, examples, banner, renderer, }?: HelpPluginOptions) => Plugin<Clerc<{}>, Clerc<{}>>;
630
+ declare const helpPlugin: ({ command, showHelpWhenNoCommand, notes, examples, banner, }?: HelpPluginOptions) => Plugin<Clerc<{}>, Clerc<{}>>;
551
631
 
552
632
  declare const notFoundPlugin: () => Plugin<Clerc<{}>, Clerc<{}>>;
553
633
 
@@ -561,4 +641,4 @@ declare const versionPlugin: ({ alias, command, }?: VersionPluginOptions) => Plu
561
641
 
562
642
  declare const friendlyErrorPlugin: () => Plugin<Clerc<{}>, Clerc<{}>>;
563
643
 
564
- export { Clerc, Command, CommandAlias, CommandCustomProperties, CommandExistsError, CommandNameConflictError, CommandOptions, CommandRecord, CommandType, CommandWithHandler, CompletionsPluginOptions, DescriptionNotSetError, FallbackType, Flag, FlagOptions, Flags, Handler, HandlerContext, HandlerInCommand, HelpPluginOptions, I18N, Inspector, InspectorContext, InspectorFn, InspectorObject, InvalidCommandNameError, MakeEventMap, NameNotSetError, NoCommandGivenError, NoSuchCommandError, ParseOptions, Plugin, PossibleInputKind, Root, RootType, VersionNotSetError, completionsPlugin, compose, defineCommand, defineHandler, defineInspector, definePlugin, formatCommandName, friendlyErrorPlugin, helpPlugin, isInvalidName, notFoundPlugin, resolveArgv, resolveCommand, resolveFlattenCommands, resolveParametersBeforeFlag, resolveRootCommands, resolveSubcommandsByParent, strictFlagsPlugin, versionPlugin, withBrackets };
644
+ export { Clerc, Command, CommandAlias, CommandCustomProperties, CommandExistsError, CommandNameConflictError, CommandOptions, CommandRecord, CommandType, CommandWithHandler, CompletionsPluginOptions, DescriptionNotSetError, FallbackType, Flag, FlagOptions, Flags, Handler, HandlerContext, HandlerInCommand, HelpPluginOptions, I18N, Inspector, InspectorContext, InspectorFn, InspectorObject, InvalidCommandNameError, LocaleNotCalledFirstError, Locales, MakeEventMap, NameNotSetError, NoCommandGivenError, NoSuchCommandError, ParseOptions, Plugin, PossibleInputKind, Root, RootType, TranslateFn, VersionNotSetError, completionsPlugin, compose, defineCommand, defineHandler, defineInspector, definePlugin, detectLocale, formatCommandName, friendlyErrorPlugin, helpPlugin, isInvalidName, notFoundPlugin, resolveArgv, resolveCommand, resolveCommandStrict, resolveFlattenCommands, resolveParametersBeforeFlag, resolveRootCommands, resolveSubcommandsByParent, strictFlagsPlugin, versionPlugin, withBrackets };
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import oe from"tty";class pt{constructor(){this.listenerMap={},this.wildcardListeners=new Set}on(t,n){return t==="*"?(this.wildcardListeners.add(n),this):(this.listenerMap[t]||(this.listenerMap[t]=new Set),this.listenerMap[t].add(n),this)}emit(t,...n){return this.listenerMap[t]&&(this.wildcardListeners.forEach(r=>r(t,...n)),this.listenerMap[t].forEach(r=>r(...n))),this}off(t,n){var r,o;return t==="**"?(this.listenerMap={},this.wildcardListeners.clear(),this):t==="*"?(n?this.wildcardListeners.delete(n):this.wildcardListeners.clear(),this):(n?(r=this.listenerMap[t])==null||r.delete(n):(o=this.listenerMap[t])==null||o.clear(),this)}}const gt="known-flag",dt="unknown-flag",ft="argument",{stringify:U}=JSON,xt=/\B([A-Z])/g,$t=e=>e.replace(xt,"-$1").toLowerCase(),{hasOwnProperty:Bt}=Object.prototype,Y=(e,t)=>Bt.call(e,t),St=e=>Array.isArray(e),Be=e=>typeof e=="function"?[e,!1]:St(e)?[e[0],!0]:Be(e.type),wt=(e,t)=>e===Boolean?t!=="false":t,yt=(e,t)=>typeof t=="boolean"?t:e===Number&&t===""?Number.NaN:e(t),Ct=/[\s.:=]/,bt=e=>{const t=`Flag name ${U(e)}`;if(e.length===0)throw new Error(`${t} cannot be empty`);if(e.length===1)throw new Error(`${t} must be longer than a character`);const n=e.match(Ct);if(n)throw new Error(`${t} cannot contain ${U(n==null?void 0:n[0])}`)},Et=e=>{const t={},n=(r,o)=>{if(Y(t,r))throw new Error(`Duplicate flags named ${U(r)}`);t[r]=o};for(const r in e){if(!Y(e,r))continue;bt(r);const o=e[r],s=[[],...Be(o),o];n(r,s);const i=$t(r);if(r!==i&&n(i,s),"alias"in o&&typeof o.alias=="string"){const{alias:u}=o,a=`Flag alias ${U(u)} for flag ${U(r)}`;if(u.length===0)throw new Error(`${a} cannot be empty`);if(u.length>1)throw new Error(`${a} must be a single character`);n(u,s)}}return t},vt=(e,t)=>{const n={};for(const r in e){if(!Y(e,r))continue;const[o,,s,i]=t[r];if(o.length===0&&"default"in i){let{default:u}=i;typeof u=="function"&&(u=u()),n[r]=u}else n[r]=s?o:o.pop()}return n},J="--",At=/[.:=]/,Ot=/^-{1,2}\w/,_t=e=>{if(!Ot.test(e))return;const t=!e.startsWith(J);let n=e.slice(t?1:2),r;const o=n.match(At);if(o){const{index:s}=o;r=n.slice(s+1),n=n.slice(0,s)}return[n,r,t]},Tt=(e,{onFlag:t,onArgument:n})=>{let r;const o=(s,i)=>{if(typeof r!="function")return!0;r(s,i),r=void 0};for(let s=0;s<e.length;s+=1){const i=e[s];if(i===J){o();const a=e.slice(s+1);n==null||n(a,[s],!0);break}const u=_t(i);if(u){if(o(),!t)continue;const[a,l,p]=u;if(p)for(let g=0;g<a.length;g+=1){o();const c=g===a.length-1;r=t(a[g],c?l:void 0,[s,g+1,c])}else r=t(a,l,[s])}else o(i,[s])&&(n==null||n([i],[s]))}o()},Mt=(e,t)=>{for(const[n,r,o]of t.reverse()){if(r){const s=e[n];let i=s.slice(0,r);if(o||(i+=s.slice(r+1)),i!=="-"){e[n]=i;continue}}e.splice(n,1)}},It=(e,t=process.argv.slice(2),{ignore:n}={})=>{const r=[],o=Et(e),s={},i=[];return i[J]=[],Tt(t,{onFlag(u,a,l){const p=Y(o,u);if(!(n!=null&&n(p?gt:dt,u,a))){if(p){const[g,c]=o[u],h=wt(c,a),m=(d,x)=>{r.push(l),x&&r.push(x),g.push(yt(c,d||""))};return h===void 0?m:m(h)}Y(s,u)||(s[u]=[]),s[u].push(a===void 0?!0:a),r.push(l)}},onArgument(u,a,l){n!=null&&n(ft,t[a[0]])||(i.push(...u),l?(i[J]=u,t.splice(a[0])):r.push(a))}}),Mt(t,r),{flags:vt(e,o),unknownFlags:s,_:i}},se=e=>Array.isArray(e)?e:[e],kt=e=>e.replace(/[-_ ](\w)/g,(t,n)=>n.toUpperCase()),Ft=(e,t)=>t.length!==e.length?!1:e.every((n,r)=>n===t[r]),Se=(e,t)=>t.length>e.length?!1:Ft(e.slice(0,t.length),t);class we extends Error{constructor(t){super(`Command "${t}" exists.`),this.commandName=t}}class z extends Error{constructor(t){super(`No such command: ${t}`),this.commandName=t}}class K extends Error{constructor(){super("No command given.")}}class ye extends Error{constructor(t,n){super(`Command name ${t} conflicts with ${n}. Maybe caused by alias.`),this.n1=t,this.n2=n}}class Ce extends Error{constructor(){super("Name not set.")}}class be extends Error{constructor(){super("Description not set.")}}class Ee extends Error{constructor(){super("Version not set.")}}class ve extends Error{constructor(t){super(`Bad name format: ${t}`),this.commandName=t}}const Ae=typeof Deno!="undefined",Lt=typeof process!="undefined"&&!Ae,Rt=process.versions.electron&&!process.defaultApp;function Oe(e,t,n){if(n.alias){const r=se(n.alias);for(const o of r){if(o in t)throw new ye(t[o].name,n.name);e.set(typeof o=="symbol"?o:o.split(" "),{...n,__isAlias:!0})}}}function _e(e){const t=new Map;e[y]&&(t.set(y,e[y]),Oe(t,e,e[y]));for(const n of Object.values(e))Oe(t,e,n),t.set(n.name.split(" "),n);return t}function ie(e,t){if(t===y)return e[y];const n=se(t),r=_e(e);let o,s;return r.forEach((i,u)=>{if(u===y){o=r.get(y),s=y;return}Se(n,u)&&(!s||s===y||u.length>s.length)&&(o=i,s=u)}),o}function Te(e,t,n=1/0){const r=t===""?[]:Array.isArray(t)?t:t.split(" ");return Object.values(e).filter(o=>{const s=o.name.split(" ");return Se(s,r)&&s.length-r.length<=n})}const Dt=e=>Te(e,"",1);function Me(e){const t=[];for(const n of e){if(n.startsWith("-"))break;t.push(n)}return t}const ae=()=>Lt?process.argv.slice(Rt?1:2):Ae?Deno.args:[];function Ie(e){const t={pre:[],normal:[],post:[]};for(const r of e){const o=typeof r=="object"?r:{fn:r},{enforce:s,fn:i}=o;s==="post"||s==="pre"?t[s].push(i):t.normal.push(i)}const n=[...t.pre,...t.normal,...t.post];return r=>{return o(0);function o(s){const i=n[s];return i(r(),o.bind(null,s+1))}}}const ke=e=>typeof e=="string"&&(e.startsWith(" ")||e.endsWith(" ")),Fe=(e,t)=>t?`[${e}]`:`<${e}>`,jt="<Root>",j=e=>Array.isArray(e)?e.join(" "):typeof e=="string"?e:jt,{stringify:N}=JSON;function le(e){const t=[];let n,r;for(const o of e){if(r)throw new Error(`Invalid parameter: Spread parameter ${N(r)} must be last`);const s=o[0],i=o[o.length-1];let u;if(s==="<"&&i===">"&&(u=!0,n))throw new Error(`Invalid parameter: Required parameter ${N(o)} cannot come after optional parameter ${N(n)}`);if(s==="["&&i==="]"&&(u=!1,n=o),u===void 0)throw new Error(`Invalid parameter: ${N(o)}. Must be wrapped in <> (required parameter) or [] (optional parameter)`);let a=o.slice(1,-1);const l=a.slice(-3)==="...";l&&(r=o,a=a.slice(0,-3)),t.push({name:a,required:u,spread:l})}return t}function ue(e,t,n){for(let r=0;r<t.length;r+=1){const{name:o,required:s,spread:i}=t[r],u=kt(o);if(u in e)return new Error(`Invalid parameter: ${N(o)} is used more than once.`);const a=i?n.slice(r):n[r];if(i&&(r=t.length),s&&(!a||i&&a.length===0))return new Error(`Error: Missing required parameter ${N(o)}`);e[u]=a}}var ce=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},$=(e,t,n)=>(ce(e,t,"read from private field"),n?n.call(e):t.get(e)),v=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},k=(e,t,n,r)=>(ce(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Nt=(e,t,n)=>(ce(e,t,"access private method"),n),F,L,R,V,G,Q,W,X,me,Le,he,Re,pe,De;const y=Symbol("Root"),je=class{constructor(e,t,n){v(this,me),v(this,he),v(this,pe),v(this,F,""),v(this,L,""),v(this,R,""),v(this,V,[]),v(this,G,{}),v(this,Q,new pt),v(this,W,new Set),v(this,X,void 0),k(this,F,e||$(this,F)),k(this,L,t||$(this,L)),k(this,R,n||$(this,R))}get _name(){return $(this,F)}get _description(){return $(this,L)}get _version(){return $(this,R)}get _inspectors(){return $(this,V)}get _commands(){return $(this,G)}static create(e,t,n){return new je(e,t,n)}name(e){return k(this,F,e),this}description(e){return k(this,L,e),this}version(e){return k(this,R,e),this}command(e,t,n={}){const r=(l=>!(typeof l=="string"||l===y))(e),o=r?e.name:e;if(ke(o))throw new ve(o);const{handler:s=void 0,...i}=r?e:{name:o,description:t,...n},u=[i.name],a=i.alias?se(i.alias):[];i.alias&&u.push(...a);for(const l of u)if($(this,W).has(l))throw new we(j(l));return $(this,G)[o]=i,$(this,W).add(i.name),a.forEach(l=>$(this,W).add(l)),r&&s&&this.on(e.name,s),this}on(e,t){return $(this,Q).on(e,t),this}use(e){return e.setup(this)}inspector(e){return $(this,V).push(e),this}parse(e=ae()){const{argv:t,run:n}=Array.isArray(e)?{argv:e,run:!0}:{argv:ae(),...e};return k(this,X,t),Nt(this,pe,De).call(this),n&&this.runMatchedCommand(),this}runMatchedCommand(){const e=$(this,X);if(!e)throw new Error("cli.parse() must be called.");const t=Me(e),n=t.join(" "),r=()=>ie($(this,G),t),o=[],s=()=>{o.length=0;const a=r(),l=!!a,p=It((a==null?void 0:a.flags)||{},[...e]),{_:g,flags:c,unknownFlags:h}=p;let m=!l||a.name===y?g:g.slice(a.name.split(" ").length),d=(a==null?void 0:a.parameters)||[];const x=d.indexOf("--"),O=d.slice(x+1)||[],f=Object.create(null);if(x>-1&&O.length>0){d=d.slice(0,x);const E=g["--"];m=m.slice(0,-E.length||void 0),o.push(ue(f,le(d),m)),o.push(ue(f,le(O),E))}else o.push(ue(f,le(d),m));const I={...c,...h};return{name:a==null?void 0:a.name,called:t.length===0&&(a==null?void 0:a.name)?y:n,resolved:l,hasRootOrAlias:$(this,me,Le),hasRoot:$(this,he,Re),raw:{...p,parameters:m,mergedFlags:I},parameters:f,flags:c,unknownFlags:h,cli:this}},i={enforce:"post",fn:()=>{const a=r(),l=s(),p=o.filter(Boolean);if(p.length>0)throw p[0];if(!a)throw n?new z(n):new K;$(this,Q).emit(a.name,l)}},u=[...$(this,V),i];return Ie(u)(s),this}};let Wt=je;F=new WeakMap,L=new WeakMap,R=new WeakMap,V=new WeakMap,G=new WeakMap,Q=new WeakMap,W=new WeakMap,X=new WeakMap,me=new WeakSet,Le=function(){return $(this,W).has(y)},he=new WeakSet,Re=function(){return Object.prototype.hasOwnProperty.call(this._commands,y)},pe=new WeakSet,De=function(){if(!$(this,F))throw new Ce;if(!$(this,L))throw new be;if(!$(this,R))throw new Ee};const D=e=>e,Pt=(e,t,n)=>n,Ht=(e,t)=>t,Ut=(e,t)=>({...e,handler:t}),Yt=e=>`
2
- ${e})
3
- cmd+="__${e}"
4
- ;;`,Vt=e=>{const{cli:t}=e,{_name:n,_commands:r}=t;return`_${n}() {
1
+ import{format as Ru}from"node:util";import mu from"tty";class RD{constructor(){this.listenerMap={},this.wildcardListeners=new Set}on(D,e){return D==="*"?(this.wildcardListeners.add(e),this):(this.listenerMap[D]||(this.listenerMap[D]=new Set),this.listenerMap[D].add(e),this)}emit(D,...e){return this.listenerMap[D]&&(this.wildcardListeners.forEach(t=>t(D,...e)),this.listenerMap[D].forEach(t=>t(...e))),this}off(D,e){var t,r;return D==="**"?(this.listenerMap={},this.wildcardListeners.clear(),this):D==="*"?(e?this.wildcardListeners.delete(e):this.wildcardListeners.clear(),this):(e?(t=this.listenerMap[D])==null||t.delete(e):(r=this.listenerMap[D])==null||r.clear(),this)}}const jD="known-flag",WD="unknown-flag",PD="argument",{stringify:Z}=JSON,HD=/\B([A-Z])/g,UD=u=>u.replace(HD,"-$1").toLowerCase(),{hasOwnProperty:YD}=Object.prototype,V=(u,D)=>YD.call(u,D),zD=u=>Array.isArray(u),ju=u=>typeof u=="function"?[u,!1]:zD(u)?[u[0],!0]:ju(u.type),GD=(u,D)=>u===Boolean?D!=="false":D,ZD=(u,D)=>typeof D=="boolean"?D:u===Number&&D===""?Number.NaN:u(D),VD=/[\s.:=]/,qD=u=>{const D=`Flag name ${Z(u)}`;if(u.length===0)throw new Error(`${D} cannot be empty`);if(u.length===1)throw new Error(`${D} must be longer than a character`);const e=u.match(VD);if(e)throw new Error(`${D} cannot contain ${Z(e==null?void 0:e[0])}`)},JD=u=>{const D={},e=(t,r)=>{if(V(D,t))throw new Error(`Duplicate flags named ${Z(t)}`);D[t]=r};for(const t in u){if(!V(u,t))continue;qD(t);const r=u[t],n=[[],...ju(r),r];e(t,n);const o=UD(t);if(t!==o&&e(o,n),"alias"in r&&typeof r.alias=="string"){const{alias:i}=r,s=`Flag alias ${Z(i)} for flag ${Z(t)}`;if(i.length===0)throw new Error(`${s} cannot be empty`);if(i.length>1)throw new Error(`${s} must be a single character`);e(i,n)}}return D},KD=(u,D)=>{const e={};for(const t in u){if(!V(u,t))continue;const[r,,n,o]=D[t];if(r.length===0&&"default"in o){let{default:i}=o;typeof i=="function"&&(i=i()),e[t]=i}else e[t]=n?r:r.pop()}return e},nu="--",QD=/[.:=]/,XD=/^-{1,2}\w/,ue=u=>{if(!XD.test(u))return;const D=!u.startsWith(nu);let e=u.slice(D?1:2),t;const r=e.match(QD);if(r){const{index:n}=r;t=e.slice(n+1),e=e.slice(0,n)}return[e,t,D]},De=(u,{onFlag:D,onArgument:e})=>{let t;const r=(n,o)=>{if(typeof t!="function")return!0;t(n,o),t=void 0};for(let n=0;n<u.length;n+=1){const o=u[n];if(o===nu){r();const s=u.slice(n+1);e==null||e(s,[n],!0);break}const i=ue(o);if(i){if(r(),!D)continue;const[s,a,c]=i;if(c)for(let C=0;C<s.length;C+=1){r();const l=C===s.length-1;t=D(s[C],l?a:void 0,[n,C+1,l])}else t=D(s,a,[n])}else r(o,[n])&&(e==null||e([o],[n]))}r()},ee=(u,D)=>{for(const[e,t,r]of D.reverse()){if(t){const n=u[e];let o=n.slice(0,t);if(r||(o+=n.slice(t+1)),o!=="-"){u[e]=o;continue}}u.splice(e,1)}},te=(u,D=process.argv.slice(2),{ignore:e}={})=>{const t=[],r=JD(u),n={},o=[];return o[nu]=[],De(D,{onFlag(i,s,a){const c=V(r,i);if(!(e!=null&&e(c?jD:WD,i,s))){if(c){const[C,l]=r[i],m=GD(l,s),F=(h,d)=>{t.push(a),d&&t.push(d),C.push(ZD(l,h||""))};return m===void 0?F:F(m)}V(n,i)||(n[i]=[]),n[i].push(s===void 0?!0:s),t.push(a)}},onArgument(i,s,a){e!=null&&e(PD,D[s[0]])||(o.push(...i),a?(o[nu]=i,D.splice(s[0])):t.push(s))}}),ee(D,t),{flags:KD(u,r),unknownFlags:n,_:o}};function Eu(u){return u!==null&&typeof u=="object"}function hu(u,D,e=".",t){if(!Eu(D))return hu(u,{},e,t);const r=Object.assign({},D);for(const n in u){if(n==="__proto__"||n==="constructor")continue;const o=u[n];o!=null&&(t&&t(r,n,o,e)||(Array.isArray(o)&&Array.isArray(r[n])?r[n]=[...o,...r[n]]:Eu(o)&&Eu(r[n])?r[n]=hu(o,r[n],(e?`${e}.`:"")+n.toString(),t):r[n]=o))}return r}function ne(u){return(...D)=>D.reduce((e,t)=>hu(e,t,"",u),{})}const re=ne(),ru=u=>Array.isArray(u)?u:[u],oe=u=>u.replace(/[-_ ](\w)/g,(D,e)=>e.toUpperCase()),Wu=(u,D)=>D.length!==u.length?!1:u.every((e,t)=>e===D[t]),Pu=(u,D)=>D.length>u.length?!1:Wu(u.slice(0,D.length),D);class Hu extends Error{constructor(D,e){super(e("core.commandExists",D)),this.commandName=D}}class ou extends Error{constructor(D,e){super(e("core.noSuchCommand",D)),this.commandName=D}}class su extends Error{constructor(D){super(D("core.noCommandGiven"))}}class Uu extends Error{constructor(D,e,t){super(t("core.commandNameConflict",D,e)),this.n1=D,this.n2=e}}class Yu extends Error{constructor(D){super(D("core.nameNotSet"))}}class zu extends Error{constructor(D){super(D("core.descriptionNotSet"))}}class Gu extends Error{constructor(D){super(D("core.versionNotSet"))}}class Zu extends Error{constructor(D,e){super(e("core.badNameFormat",D)),this.commandName=D}}class pu extends Error{constructor(D){super(D("core.localeMustBeCalledFirst"))}}const Vu=typeof Deno!="undefined",se=typeof process!="undefined"&&!Vu,ie=process.versions.electron&&!process.defaultApp;function qu(u,D,e,t){if(e.alias){const r=ru(e.alias);for(const n of r){if(n in D)throw new Uu(D[n].name,e.name,t);u.set(typeof n=="symbol"?n:n.split(" "),{...e,__isAlias:!0})}}}function du(u,D){const e=new Map;u[p]&&(e.set(p,u[p]),qu(e,u,u[p],D));for(const t of Object.values(u))qu(e,u,t,D),e.set(t.name.split(" "),t);return e}function Ju(u,D,e){if(D===p)return[u[p],p];const t=ru(D),r=du(u,e);let n,o;return r.forEach((i,s)=>{if(s===p){n=u[p],o=p;return}Pu(t,s)&&(!o||o===p||s.length>o.length)&&(n=i,o=s)}),[n,o]}function Ku(u,D,e){if(D===p)return[u[p],p];const t=ru(D),r=du(u,e);let n,o;return r.forEach((i,s)=>{s===p||o===p||Wu(t,s)&&(n=i,o=s)}),[n,o]}function Qu(u,D,e=1/0){const t=D===""?[]:Array.isArray(D)?D:D.split(" ");return Object.values(u).filter(r=>{const n=r.name.split(" ");return Pu(n,t)&&n.length-t.length<=e})}const ae=u=>Qu(u,"",1);function Xu(u){const D=[];for(const e of u){if(e.startsWith("-"))break;D.push(e)}return D}const Bu=()=>se?process.argv.slice(ie?1:2):Vu?Deno.args:[];function uD(u){const D={pre:[],normal:[],post:[]};for(const t of u){const r=typeof t=="object"?t:{fn:t},{enforce:n,fn:o}=r;n==="post"||n==="pre"?D[n].push(o):D.normal.push(o)}const e=[...D.pre,...D.normal,...D.post];return t=>{return r(0);function r(n){const o=e[n];return o(t(),r.bind(null,n+1))}}}const DD=u=>typeof u=="string"&&(u.startsWith(" ")||u.endsWith(" ")),eD=(u,D)=>D?`[${u}]`:`<${u}>`,le="<Root>",U=u=>Array.isArray(u)?u.join(" "):typeof u=="string"?u:le,tD=()=>process.env.CLERC_LOCALE?process.env.CLERC_LOCALE:Intl.DateTimeFormat().resolvedOptions().locale,{stringify:Y}=JSON;function gu(u){const D=[];let e,t;for(const r of u){if(t)throw new Error(`Invalid parameter: Spread parameter ${Y(t)} must be last`);const n=r[0],o=r[r.length-1];let i;if(n==="<"&&o===">"&&(i=!0,e))throw new Error(`Invalid parameter: Required parameter ${Y(r)} cannot come after optional parameter ${Y(e)}`);if(n==="["&&o==="]"&&(i=!1,e=r),i===void 0)throw new Error(`Invalid parameter: ${Y(r)}. Must be wrapped in <> (required parameter) or [] (optional parameter)`);let s=r.slice(1,-1);const a=s.slice(-3)==="...";a&&(t=r,s=s.slice(0,-3)),D.push({name:s,required:i,spread:a})}return D}function fu(u,D,e){for(let t=0;t<D.length;t+=1){const{name:r,required:n,spread:o}=D[t],i=oe(r);if(i in u)throw new Error(`Invalid parameter: ${Y(r)} is used more than once.`);const s=o?e.slice(t):e[t];if(o&&(t=D.length),n&&(!s||o&&s.length===0))throw new Error(`Missing required parameter ${Y(r)}`);u[i]=s}}const ce={en:{"core.commandExists":'Command "%s" exists.',"core.noSuchCommand":"No such command: %s.","core.noCommandGiven":"No command given.","core.commandNameConflict":"Command name %s conflicts with %s. Maybe caused by alias.","core.nameNotSet":"Name not set.","core.descriptionNotSet":"Description not set.","core.versionNotSet":"Version not set.","core.badNameFormat":"Bad name format: %s.","core.localeMustBeCalledFirst":"locale() or fallbackLocale() must be called at first.","core.cliParseMustBeCalled":"cli.parse() must be called."},"zh-CN":{"core.commandExists":'\u547D\u4EE4 "%s" \u5DF2\u5B58\u5728\u3002',"core.noSuchCommand":"\u627E\u4E0D\u5230\u547D\u4EE4: %s\u3002","core.noCommandGiven":"\u6CA1\u6709\u8F93\u5165\u547D\u4EE4\u3002","core.commandNameConflict":"\u547D\u4EE4\u540D\u79F0 %s \u548C %s \u51B2\u7A81\u3002 \u53EF\u80FD\u662F\u7531\u4E8E\u522B\u540D\u5BFC\u81F4\u7684\u3002","core.nameNotSet":"\u672A\u8BBE\u7F6ECLI\u540D\u79F0\u3002","core.descriptionNotSet":"\u672A\u8BBE\u7F6ECLI\u63CF\u8FF0\u3002","core.versionNotSet":"\u672A\u8BBE\u7F6ECLI\u7248\u672C\u3002","core.badNameFormat":"\u9519\u8BEF\u7684\u547D\u4EE4\u540D\u5B57\u683C\u5F0F: %s\u3002","core.localeMustBeCalledFirst":"locale() \u6216 fallbackLocale() \u5FC5\u987B\u5728\u6700\u5F00\u59CB\u8C03\u7528\u3002","core.cliParseMustBeCalled":"cli.parse() \u5FC5\u987B\u88AB\u8C03\u7528\u3002"}};var Au=(u,D,e)=>{if(!D.has(u))throw TypeError("Cannot "+e)},E=(u,D,e)=>(Au(u,D,"read from private field"),e?e.call(u):D.get(u)),x=(u,D,e)=>{if(D.has(u))throw TypeError("Cannot add the same private member more than once");D instanceof WeakSet?D.add(u):D.set(u,e)},S=(u,D,e,t)=>(Au(u,D,"write to private field"),t?t.call(u,e):D.set(u,e),e),w=(u,D,e)=>(Au(u,D,"access private method"),e),k,I,R,q,J,iu,z,K,Q,X,uu,Du,j,xu,nD,$u,rD,Su,oD,_,T,wu,sD,bu,iD,yu,aD;const p=Symbol.for("Clerc.Root"),lD=class{constructor(u,D,e){x(this,xu),x(this,$u),x(this,Su),x(this,_),x(this,wu),x(this,bu),x(this,yu),x(this,k,""),x(this,I,""),x(this,R,""),x(this,q,[]),x(this,J,{}),x(this,iu,new RD),x(this,z,new Set),x(this,K,void 0),x(this,Q,[]),x(this,X,!1),x(this,uu,"en"),x(this,Du,"en"),x(this,j,{}),this.i18n={add:t=>{S(this,j,re(E(this,j),t))},t:(t,...r)=>{const n=E(this,j)[E(this,Du)]||E(this,j)[E(this,uu)],o=E(this,j)[E(this,uu)];return n[t]?Ru(n[t],...r):o[t]?Ru(o[t],...r):void 0}},S(this,k,u||E(this,k)),S(this,I,D||E(this,I)),S(this,R,e||E(this,R)),S(this,Du,tD()),w(this,Su,oD).call(this)}get _name(){return E(this,k)}get _description(){return E(this,I)}get _version(){return E(this,R)}get _inspectors(){return E(this,q)}get _commands(){return E(this,J)}static create(u,D,e){return new lD(u,D,e)}name(u){return w(this,_,T).call(this),S(this,k,u),this}description(u){return w(this,_,T).call(this),S(this,I,u),this}version(u){return w(this,_,T).call(this),S(this,R,u),this}locale(u){if(E(this,X))throw new pu(this.i18n.t);return S(this,Du,u),this}fallbackLocale(u){if(E(this,X))throw new pu(this.i18n.t);return S(this,uu,u),this}errorHandler(u){return E(this,Q).push(u),this}command(u,D,e={}){w(this,_,T).call(this);const{t}=this.i18n,r=(c=>!(typeof c=="string"||c===p))(u),n=r?u.name:u;if(DD(n))throw new Zu(n,t);const{handler:o=void 0,...i}=r?u:{name:n,description:D,...e},s=[i.name],a=i.alias?ru(i.alias):[];i.alias&&s.push(...a);for(const c of s)if(E(this,z).has(c))throw new Hu(U(c),t);return E(this,J)[n]=i,E(this,z).add(i.name),a.forEach(c=>E(this,z).add(c)),r&&o&&this.on(u.name,o),this}on(u,D){return E(this,iu).on(u,D),this}use(u){return w(this,_,T).call(this),u.setup(this)}inspector(u){return w(this,_,T).call(this),E(this,q).push(u),this}parse(u=Bu()){w(this,_,T).call(this);const{argv:D,run:e}=Array.isArray(u)?{argv:u,run:!0}:{argv:Bu(),...u};return S(this,K,D),w(this,wu,sD).call(this),e&&this.runMatchedCommand(),this}runMatchedCommand(){try{w(this,yu,aD).call(this)}catch(u){if(E(this,Q).length>0)E(this,Q).forEach(D=>D(u));else throw u}return this}};let Fe=lD;k=new WeakMap,I=new WeakMap,R=new WeakMap,q=new WeakMap,J=new WeakMap,iu=new WeakMap,z=new WeakMap,K=new WeakMap,Q=new WeakMap,X=new WeakMap,uu=new WeakMap,Du=new WeakMap,j=new WeakMap,xu=new WeakSet,nD=function(){return E(this,z).has(p)},$u=new WeakSet,rD=function(){return Object.prototype.hasOwnProperty.call(this._commands,p)},Su=new WeakSet,oD=function(){this.i18n.add(ce)},_=new WeakSet,T=function(){S(this,X,!0)},wu=new WeakSet,sD=function(){const{t:u}=this.i18n;if(!E(this,k))throw new Yu(u);if(!E(this,I))throw new zu(u);if(!E(this,R))throw new Gu(u)},bu=new WeakSet,iD=function(u){const D=E(this,K),[e,t]=u(),r=!!e,n=te((e==null?void 0:e.flags)||{},[...D]),{_:o,flags:i,unknownFlags:s}=n;let a=!r||e.name===p?o:o.slice(e.name.split(" ").length),c=(e==null?void 0:e.parameters)||[];const C=c.indexOf("--"),l=c.slice(C+1)||[],m=Object.create(null);if(C>-1&&l.length>0){c=c.slice(0,C);const h=o["--"];a=a.slice(0,-h.length||void 0),fu(m,gu(c),a),fu(m,gu(l),h)}else fu(m,gu(c),a);const F={...i,...s};return{name:e==null?void 0:e.name,called:Array.isArray(t)?t.join(" "):t,resolved:r,hasRootOrAlias:E(this,xu,nD),hasRoot:E(this,$u,rD),raw:{...n,parameters:a,mergedFlags:F},parameters:m,flags:i,unknownFlags:s,cli:this}},yu=new WeakSet,aD=function(){w(this,_,T).call(this);const{t:u}=this.i18n,D=E(this,K);if(!D)throw new Error(u("core.cliParseMustBeCalled"));const e=Xu(D),t=e.join(" "),r=()=>Ju(E(this,J),e,u),n=()=>w(this,bu,iD).call(this,r),o={enforce:"post",fn:()=>{const[s]=r(),a=n();if(!s)throw t?new ou(t,u):new su(u);E(this,iu).emit(s.name,a)}},i=[...E(this,q),o];uD(i)(n)};const W=u=>u,Ce=(u,D,e)=>e,me=(u,D)=>D,Ee=(u,D)=>({...u,handler:D}),he=u=>`
2
+ ${u})
3
+ cmd+="__${u}"
4
+ ;;`,pe=u=>{const{cli:D}=u,{_name:e,_commands:t}=D;return`_${e}() {
5
5
  local i cur prev opts cmds
6
6
  COMPREPLY=()
7
7
  cur="\${COMP_WORDS[COMP_CWORD]}"
@@ -13,27 +13,27 @@ import oe from"tty";class pt{constructor(){this.listenerMap={},this.wildcardList
13
13
  do
14
14
  case "\${i}" in
15
15
  "$1")
16
- cmd="${n}"
16
+ cmd="${e}"
17
17
  ;;
18
- ${Object.keys(r).map(Yt).join("")}
18
+ ${Object.keys(t).map(he).join("")}
19
19
  *)
20
20
  ;;
21
21
  esac
22
22
  done
23
23
  }
24
24
 
25
- complete -F _${n} -o bashdefault -o default ${n}
26
- `},Ne=e=>e.replace(/([A-Z])/g,(t,n)=>`-${n.toLowerCase()}`),We=e=>e.length<=1?`-${e}`:`--${Ne(e)}`,Pe="(No Description)",Gt=e=>`[CompletionResult]::new('${e.name}', '${e.name}', [CompletionResultType]::ParameterValue, '${e.description}')`,qt=e=>Object.entries(e.flags||{}).map(([t,n])=>{const r=[`[CompletionResult]::new('${We(t)}', '${Ne(t)}', [CompletionResultType]::ParameterName, '${e.flags[t].description||Pe}')`];return n!=null&&n.alias&&r.push(`[CompletionResult]::new('${We(n.alias)}', '${n.alias}', [CompletionResultType]::ParameterName, '${e.flags[t].description||Pe}')`),r.join(`
25
+ complete -F _${e} -o bashdefault -o default ${e}
26
+ `},cD=u=>u.replace(/([A-Z])/g,(D,e)=>`-${e.toLowerCase()}`),FD=u=>u.length<=1?`-${u}`:`--${cD(u)}`,CD="(No Description)",de=u=>`[CompletionResult]::new('${u.name}', '${u.name}', [CompletionResultType]::ParameterValue, '${u.description}')`,Be=u=>Object.entries(u.flags||{}).map(([D,e])=>{const t=[`[CompletionResult]::new('${FD(D)}', '${cD(D)}', [CompletionResultType]::ParameterName, '${u.flags[D].description||CD}')`];return e!=null&&e.alias&&t.push(`[CompletionResult]::new('${FD(e.alias)}', '${e.alias}', [CompletionResultType]::ParameterName, '${u.flags[D].description||CD}')`),t.join(`
27
27
  `)}).join(`
28
- `),Zt=e=>{const{cli:t}=e,{_name:n,_commands:r}=t;return`using namespace System.Management.Automation
28
+ `),ge=u=>{const{cli:D}=u,{_name:e,_commands:t}=D;return`using namespace System.Management.Automation
29
29
  using namespace System.Management.Automation.Language
30
30
 
31
- Register-ArgumentCompleter -Native -CommandName '${n}' -ScriptBlock {
31
+ Register-ArgumentCompleter -Native -CommandName '${e}' -ScriptBlock {
32
32
  param($wordToComplete, $commandAst, $cursorPosition)
33
33
 
34
34
  $commandElements = $commandAst.CommandElements
35
35
  $command = @(
36
- '${n}'
36
+ '${e}'
37
37
  for ($i = 1; $i -lt $commandElements.Count; $i++) {
38
38
  $element = $commandElements[$i]
39
39
  if ($element -isnot [StringConstantExpressionAst] -or
@@ -46,13 +46,13 @@ Register-ArgumentCompleter -Native -CommandName '${n}' -ScriptBlock {
46
46
  }) -join ';'
47
47
 
48
48
  $completions = @(switch ($command) {
49
- '${n}' {
50
- ${Object.entries(r).map(([o,s])=>Gt(s)).join(`
49
+ '${e}' {
50
+ ${Object.entries(t).map(([r,n])=>de(n)).join(`
51
51
  `)}
52
52
  break
53
53
  }
54
- ${Object.entries(r).map(([o,s])=>`'${n};${o.split(" ").join(";")}' {
55
- ${qt(s)}
54
+ ${Object.entries(t).map(([r,n])=>`'${e};${r.split(" ").join(";")}' {
55
+ ${Be(n)}
56
56
  break
57
57
  }`).join(`
58
58
  `)}
@@ -60,18 +60,18 @@ Register-ArgumentCompleter -Native -CommandName '${n}' -ScriptBlock {
60
60
 
61
61
  $completions.Where{ $_.CompletionText -like "$wordToComplete*" } |
62
62
  Sort-Object -Property ListItemText
63
- }`},He={bash:Vt,pwsh:Zt},Jt=(e={})=>D({setup:t=>{const{command:n=!0}=e;return n&&(t=t.command("completions","Print shell completions to stdout",{flags:{shell:{description:"Shell type",type:String,default:""}},parameters:["[shell]"]}).on("completions",r=>{if(!t._name)throw new Error("CLI name is not defined!");const o=String(r.parameters.shell||r.flags.shell);if(!o)throw new Error("Missing shell name");if(o in He)process.stdout.write(He[o](r));else throw new Error(`No such shell: ${o}`)})),t}}),zt=e=>Array.isArray(e)?e:[e],Kt=e=>e.replace(/([A-Z])/g,(t,n)=>`-${n.toLowerCase()}`),Ue=e=>e.length<=1?`-${e}`:`--${Kt(e)}`;var C={exports:{}};let Qt=oe,Xt=!("NO_COLOR"in process.env||process.argv.includes("--no-color"))&&("FORCE_COLOR"in process.env||process.argv.includes("--color")||process.platform==="win32"||Qt.isatty(1)&&process.env.TERM!=="dumb"||"CI"in process.env),B=(e,t,n=e)=>r=>{let o=""+r,s=o.indexOf(t,e.length);return~s?e+Ye(o,t,n,s)+t:e+o+t},Ye=(e,t,n,r)=>{let o=e.substring(0,r)+n,s=e.substring(r+t.length),i=s.indexOf(t);return~i?o+Ye(s,t,n,i):o+s},Ve=(e=Xt)=>({isColorSupported:e,reset:e?t=>`\x1B[0m${t}\x1B[0m`:String,bold:e?B("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"):String,dim:e?B("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"):String,italic:e?B("\x1B[3m","\x1B[23m"):String,underline:e?B("\x1B[4m","\x1B[24m"):String,inverse:e?B("\x1B[7m","\x1B[27m"):String,hidden:e?B("\x1B[8m","\x1B[28m"):String,strikethrough:e?B("\x1B[9m","\x1B[29m"):String,black:e?B("\x1B[30m","\x1B[39m"):String,red:e?B("\x1B[31m","\x1B[39m"):String,green:e?B("\x1B[32m","\x1B[39m"):String,yellow:e?B("\x1B[33m","\x1B[39m"):String,blue:e?B("\x1B[34m","\x1B[39m"):String,magenta:e?B("\x1B[35m","\x1B[39m"):String,cyan:e?B("\x1B[36m","\x1B[39m"):String,white:e?B("\x1B[37m","\x1B[39m"):String,gray:e?B("\x1B[90m","\x1B[39m"):String,bgBlack:e?B("\x1B[40m","\x1B[49m"):String,bgRed:e?B("\x1B[41m","\x1B[49m"):String,bgGreen:e?B("\x1B[42m","\x1B[49m"):String,bgYellow:e?B("\x1B[43m","\x1B[49m"):String,bgBlue:e?B("\x1B[44m","\x1B[49m"):String,bgMagenta:e?B("\x1B[45m","\x1B[49m"):String,bgCyan:e?B("\x1B[46m","\x1B[49m"):String,bgWhite:e?B("\x1B[47m","\x1B[49m"):String});C.exports=Ve(),C.exports.createColors=Ve;var en=Function.prototype.toString,tn=/\s*function(?:\s|\s*\/\*[^(?:*\/)]+\*\/\s*)*([^\s\(\/]+)/;function nn(e){if(typeof e!="function")return null;var t="";if(typeof Function.prototype.name=="undefined"&&typeof e.name=="undefined"){var n=en.call(e).match(tn);n&&(t=n[1])}else t=e.name;return t}var Ge=nn,rn=function(e,t){t||(t={});var n=t.hsep===void 0?" ":t.hsep,r=t.align||[],o=t.stringLength||function(a){return String(a).length},s=Ze(e,function(a,l){return Je(l,function(p,g){var c=qe(p);(!a[g]||c>a[g])&&(a[g]=c)}),a},[]),i=ee(e,function(a){return ee(a,function(l,p){var g=String(l);if(r[p]==="."){var c=qe(g),h=s[p]+(/\./.test(g)?1:2)-(o(g)-c);return g+Array(h).join(" ")}else return g})}),u=Ze(i,function(a,l){return Je(l,function(p,g){var c=o(p);(!a[g]||c>a[g])&&(a[g]=c)}),a},[]);return ee(i,function(a){return ee(a,function(l,p){var g=u[p]-o(l)||0,c=Array(Math.max(g+1,1)).join(" ");return r[p]==="r"||r[p]==="."?c+l:r[p]==="c"?Array(Math.ceil(g/2+1)).join(" ")+l+Array(Math.floor(g/2+1)).join(" "):l+c}).join(n).replace(/\s+$/,"")}).join(`
64
- `)};function qe(e){var t=/\.[^.]*$/.exec(e);return t?t.index+1:e.length}function Ze(e,t,n){if(e.reduce)return e.reduce(t,n);for(var r=0,o=arguments.length>=3?n:e[r++];r<e.length;r++)t(o,e[r],r);return o}function Je(e,t){if(e.forEach)return e.forEach(t);for(var n=0;n<e.length;n++)t.call(e,e[n],n)}function ee(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r<e.length;r++)n.push(t.call(e,e[r],r));return n}const ge=(...e)=>rn(e),de=(...e)=>ge(...e).toString().split(`
65
- `),on=e=>Array.isArray(e)?`Array<${Ge(e[0])}>`:Ge(e),sn=e=>{const t=[];for(const n of e){if(n.type==="block"||!n.type){const r=" ",o=n.body.map(i=>r+i);o.unshift("");const s=o.join(`
66
- `);t.push(ge([C.exports.bold(`${n.title}:`)],[s]).toString())}else if(n.type==="inline"){const r=n.items.map(s=>[C.exports.bold(`${s.title}:`),s.body]),o=ge(...r);t.push(o.toString())}t.push("")}return t.join(`
67
- `)},fe=C.exports.yellow("-"),an="(No description)",ln="Name",un="Version",cn="Subcommand",mn="Commands",hn="Flags",pn="Description",ze="Usage",gn="Examples",Ke="Notes",Qe=e=>{process.stdout.write(e)},Xe=(e,t,n)=>{const r=[{title:ln,body:C.exports.red(t._name)},{title:un,body:C.exports.yellow(t._version)}];n&&r.push({title:cn,body:C.exports.green(`${t._name} ${j(n.name)}`)}),e.push({type:"inline",items:r}),e.push({title:pn,body:[(n==null?void 0:n.description)||t._description]})},et=(e,t)=>{const n=t.map(([r,o])=>[r,fe,o]);e.push({title:gn,body:de(...n)})},te=(e,t,n,r)=>{const{cli:o}=t,s=[];Xe(s,o),s.push({title:ze,body:[C.exports.magenta(`$ ${o._name} ${Fe("command",t.hasRootOrAlias)} [flags]`)]});const i=[...t.hasRoot?[o._commands[y]]:[],...Object.values(o._commands)].map(u=>{const a=[typeof u.name=="symbol"?"":u.name,...zt(u.alias||[])].sort((l,p)=>l===y?-1:p===y?1:l.length-p.length).map(l=>l===""||typeof l=="symbol"?`${o._name}`:`${o._name} ${l}`).join(", ");return[C.exports.cyan(a),fe,u.description]});return s.push({title:mn,body:de(...i)}),n&&s.push({title:Ke,body:n}),r&&et(s,r),e(s)},tt=(e,t,n)=>{var r;const{cli:o}=t,s=ie(o._commands,n);if(!s)throw new z(j(n));const i=[];Xe(i,o,{...s,name:j(n)});const u=((r=s.parameters)==null?void 0:r.join(" "))||void 0,a=` ${j(n)}`,l=u?` ${u}`:"",p=s.flags?" [flags]":"";return i.push({title:ze,body:[C.exports.magenta(`$ ${o._name}${a}${l}${p}`)]}),s.flags&&i.push({title:hn,body:de(...Object.entries(s.flags).map(([g,c])=>{const h=[Ue(g)];c.alias&&h.push(Ue(c.alias));const m=[C.exports.blue(h.join(", "))];if(m.push(fe,c.description||an),c.type){const d=on(c.type);m.push(C.exports.gray(`(${d})`))}return m}))}),s.notes&&i.push({title:Ke,body:s.notes}),s.examples&&et(i,s.examples),e(i)},dn=({command:e=!0,showHelpWhenNoCommand:t=!0,notes:n,examples:r,banner:o,renderer:s="cliffy"}={})=>D({setup:i=>{const u=s==="cliffy"?sn:()=>"",a=l=>{o&&Qe(`${o}
68
- `),Qe(l)};return e&&(i=i.command("help","Show help",{parameters:["[command...]"],notes:["If no command is specified, show help for the CLI.","If a command is specified, show help for the command.","-h is an alias for --help."],examples:[[`$ ${i._name} help`,"Show help"],[`$ ${i._name} help <command>`,"Show help for a specific command"],[`$ ${i._name} <command> --help`,"Show help for a specific command"]]}).on("help",l=>{l.parameters.command.length?a(tt(u,l,l.parameters.command)):a(te(u,l,n,r))})),i.inspector((l,p)=>{const g=l.raw.mergedFlags.h||l.raw.mergedFlags.help;if(!l.hasRootOrAlias&&!l.raw._.length&&t&&!g){let c=`No command given.
63
+ }`},mD={bash:pe,pwsh:ge},fe=(u={})=>W({setup:D=>{const{command:e=!0}=u;return e&&(D=D.command("completions","Print shell completions to stdout",{flags:{shell:{description:"Shell type",type:String,default:""}},parameters:["[shell]"]}).on("completions",t=>{if(!D._name)throw new Error("CLI name is not defined!");const r=String(t.parameters.shell||t.flags.shell);if(!r)throw new Error("Missing shell name");if(r in mD)process.stdout.write(mD[r](t));else throw new Error(`No such shell: ${r}`)})),D}}),Ae=u=>Array.isArray(u)?u:[u],xe=u=>u.replace(/([A-Z])/g,(D,e)=>`-${e.toLowerCase()}`),ED=u=>u.length<=1?`-${u}`:`--${xe(u)}`;var b={exports:{}};let $e=mu,Se=!("NO_COLOR"in process.env||process.argv.includes("--no-color"))&&("FORCE_COLOR"in process.env||process.argv.includes("--color")||process.platform==="win32"||$e.isatty(1)&&process.env.TERM!=="dumb"||"CI"in process.env),B=(u,D,e=u)=>t=>{let r=""+t,n=r.indexOf(D,u.length);return~n?u+hD(r,D,e,n)+D:u+r+D},hD=(u,D,e,t)=>{let r=u.substring(0,t)+e,n=u.substring(t+D.length),o=n.indexOf(D);return~o?r+hD(n,D,e,o):r+n},pD=(u=Se)=>({isColorSupported:u,reset:u?D=>`\x1B[0m${D}\x1B[0m`:String,bold:u?B("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"):String,dim:u?B("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"):String,italic:u?B("\x1B[3m","\x1B[23m"):String,underline:u?B("\x1B[4m","\x1B[24m"):String,inverse:u?B("\x1B[7m","\x1B[27m"):String,hidden:u?B("\x1B[8m","\x1B[28m"):String,strikethrough:u?B("\x1B[9m","\x1B[29m"):String,black:u?B("\x1B[30m","\x1B[39m"):String,red:u?B("\x1B[31m","\x1B[39m"):String,green:u?B("\x1B[32m","\x1B[39m"):String,yellow:u?B("\x1B[33m","\x1B[39m"):String,blue:u?B("\x1B[34m","\x1B[39m"):String,magenta:u?B("\x1B[35m","\x1B[39m"):String,cyan:u?B("\x1B[36m","\x1B[39m"):String,white:u?B("\x1B[37m","\x1B[39m"):String,gray:u?B("\x1B[90m","\x1B[39m"):String,bgBlack:u?B("\x1B[40m","\x1B[49m"):String,bgRed:u?B("\x1B[41m","\x1B[49m"):String,bgGreen:u?B("\x1B[42m","\x1B[49m"):String,bgYellow:u?B("\x1B[43m","\x1B[49m"):String,bgBlue:u?B("\x1B[44m","\x1B[49m"):String,bgMagenta:u?B("\x1B[45m","\x1B[49m"):String,bgCyan:u?B("\x1B[46m","\x1B[49m"):String,bgWhite:u?B("\x1B[47m","\x1B[49m"):String});b.exports=pD(),b.exports.createColors=pD;var we=function(u,D){D||(D={});var e=D.hsep===void 0?" ":D.hsep,t=D.align||[],r=D.stringLength||function(s){return String(s).length},n=BD(u,function(s,a){return gD(a,function(c,C){var l=dD(c);(!s[C]||l>s[C])&&(s[C]=l)}),s},[]),o=au(u,function(s){return au(s,function(a,c){var C=String(a);if(t[c]==="."){var l=dD(C),m=n[c]+(/\./.test(C)?1:2)-(r(C)-l);return C+Array(m).join(" ")}else return C})}),i=BD(o,function(s,a){return gD(a,function(c,C){var l=r(c);(!s[C]||l>s[C])&&(s[C]=l)}),s},[]);return au(o,function(s){return au(s,function(a,c){var C=i[c]-r(a)||0,l=Array(Math.max(C+1,1)).join(" ");return t[c]==="r"||t[c]==="."?l+a:t[c]==="c"?Array(Math.ceil(C/2+1)).join(" ")+a+Array(Math.floor(C/2+1)).join(" "):a+l}).join(e).replace(/\s+$/,"")}).join(`
64
+ `)};function dD(u){var D=/\.[^.]*$/.exec(u);return D?D.index+1:u.length}function BD(u,D,e){if(u.reduce)return u.reduce(D,e);for(var t=0,r=arguments.length>=3?e:u[t++];t<u.length;t++)D(r,u[t],t);return r}function gD(u,D){if(u.forEach)return u.forEach(D);for(var e=0;e<u.length;e++)D.call(u,u[e],e)}function au(u,D){if(u.map)return u.map(D);for(var e=[],t=0;t<u.length;t++)e.push(D.call(u,u[t],t));return e}var vu={exports:{}},be=({onlyFirst:u=!1}={})=>{const D=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(D,u?void 0:"g")};const ye=be;var ve=u=>typeof u=="string"?u.replace(ye(),""):u,Ou={exports:{}};const fD=u=>Number.isNaN(u)?!1:u>=4352&&(u<=4447||u===9001||u===9002||11904<=u&&u<=12871&&u!==12351||12880<=u&&u<=19903||19968<=u&&u<=42182||43360<=u&&u<=43388||44032<=u&&u<=55203||63744<=u&&u<=64255||65040<=u&&u<=65049||65072<=u&&u<=65131||65281<=u&&u<=65376||65504<=u&&u<=65510||110592<=u&&u<=110593||127488<=u&&u<=127569||131072<=u&&u<=262141);Ou.exports=fD,Ou.exports.default=fD;var Oe=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\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\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])|\uD83C[\uDF3E\uDF73\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])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\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])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\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\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\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\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\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\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*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\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\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\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[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g};const _e=ve,Ne=Ou.exports,Te=Oe,AD=u=>{if(typeof u!="string"||u.length===0||(u=_e(u),u.length===0))return 0;u=u.replace(Te()," ");let D=0;for(let e=0;e<u.length;e++){const t=u.codePointAt(e);t<=31||t>=127&&t<=159||t>=768&&t<=879||(t>65535&&e++,D+=Ne(t)?2:1)}return D};vu.exports=AD,vu.exports.default=AD;const _u=u=>we(u,{stringLength:vu.exports}),Nu=u=>_u(u).split(`
65
+ `),xD=new Map([[Boolean,""],[String,"string"],[Number,"number"]]),Me=(u,D=!1)=>{const e=xD.has(u)?xD.get(u):"value";return D?`[${e}]`:`<${e}>`},P=u=>{const D=[];for(const e of u){if(e.type==="block"||!e.type){const t=" ",r=e.body.map(o=>t+o);r.unshift("");const n=r.join(`
66
+ `);D.push(_u([[b.exports.bold(`${e.title}:`)],[n]]).toString())}else if(e.type==="inline"){const t=e.items.map(n=>[b.exports.bold(`${n.title}:`),n.body]),r=_u(t);D.push(r.toString())}D.push("")}return D.join(`
67
+ `)},Le={renderFlagName:u=>u,renderSections:u=>u,renderType:(u,D)=>Me(u,D),renderDefault:u=>JSON.stringify(u)},ke={en:{"help.name":"Name","help.version":"Version","help.subcommand":"Subcommand","help.commands":"Commands","help.flags":"Flags","help.description":"Description","help.usage":"Usage","help.examples":"Examples","help.notes":"Notes","help.noDescription":"(No description)","help.notes.1":"If no command is specified, show help for the CLI.","help.notes.2":"If a command is specified, show help for the command.","help.notes.3":"-h is an alias for --help.","help.examples.1":"Show help","help.examples.2":"Show help for a specific command","help.commandDescription":"Show help","help.default":"Default: "},"zh-CN":{"help.name":"\u540D\u79F0","help.version":"\u7248\u672C","help.subcommand":"\u5B50\u547D\u4EE4","help.commands":"\u547D\u4EE4","help.flags":"\u6807\u5FD7","help.description":"\u63CF\u8FF0","help.usage":"\u4F7F\u7528","help.examples":"\u793A\u4F8B","help.notes":"\u5907\u6CE8","help.noDescription":"(\u65E0\u63CF\u8FF0)","help.notes.1":"\u5982\u679C\u6CA1\u6709\u6307\u5B9A\u5C55\u793A\u54EA\u4E2A\u547D\u4EE4\u7684\u5E2E\u52A9\u4FE1\u606F\uFF0C\u9ED8\u8BA4\u5C55\u793ACLI\u7684\u3002","help.notes.2":"\u5982\u679C\u6307\u5B9A\u4E86\u5219\u5C55\u793A\u8BE5\u547D\u4EE4\u5E2E\u52A9\u4FE1\u606F\u3002","help.notes.3":"-h \u662F --help \u7684\u4E00\u4E2A\u522B\u540D\u3002","help.examples.1":"\u5C55\u793A CLI \u7684\u5E2E\u52A9\u4FE1\u606F","help.examples.2":"\u5C55\u793A\u6307\u5B9A\u547D\u4EE4\u7684\u5E2E\u52A9\u4FE1\u606F","help.commandDescription":"\u5C55\u793A\u5E2E\u52A9\u4FE1\u606F","help.default":"\u9ED8\u8BA4\u503C: %s"}},Tu=b.exports.yellow("-"),$D=u=>{process.stdout.write(u)},Mu=(u,D,e)=>{const{t}=D.i18n,r=[{title:t("help.name"),body:b.exports.red(D._name)},{title:t("help.version"),body:b.exports.yellow(D._version)}];e&&r.push({title:t("help.subcommand"),body:b.exports.green(`${D._name} ${U(e.name)}`)}),u.push({type:"inline",items:r}),u.push({title:t("help.description"),body:[(e==null?void 0:e.description)||D._description]})},SD=(u,D,e)=>{const t=D.map(([r,n])=>[r,Tu,n]);u.push({title:e("help.examples"),body:Nu(t)})},lu=(u,D,e,t)=>{const{cli:r}=D,{t:n}=r.i18n,o=[];Mu(o,r),o.push({title:n("help.usage"),body:[b.exports.magenta(`$ ${r._name} ${eD("command",D.hasRootOrAlias)} [flags]`)]});const i=[...D.hasRoot?[r._commands[p]]:[],...Object.values(r._commands)].map(s=>{const a=[typeof s.name=="symbol"?"":s.name,...Ae(s.alias||[])].sort((c,C)=>c===p?-1:C===p?1:c.length-C.length).map(c=>c===""||typeof c=="symbol"?`${r._name}`:`${r._name} ${c}`).join(", ");return[b.exports.cyan(a),Tu,s.description]});return o.push({title:n("help.commands"),body:Nu(i)}),e&&o.push({title:n("help.notes"),body:e}),t&&SD(o,t,n),u(o)},Lu=(u,D,e)=>{var t;const{cli:r}=D,{t:n}=r.i18n,[o]=Ku(r._commands,e,n);if(!o)throw new ou(U(e),n);const i=Object.assign({},Le,o.help);let s=[];e===p?Mu(s,r):Mu(s,r,{...o,name:U(e)});const a=((t=o.parameters)==null?void 0:t.join(" "))||void 0,c=e===p?"":` ${U(e)}`,C=a?` ${a}`:"",l=o.flags?" [flags]":"";return s.push({title:n("help.usage"),body:[b.exports.magenta(`$ ${r._name}${c}${C}${l}`)]}),o.flags&&s.push({title:n("help.flags"),body:Nu(Object.entries(o.flags).map(([m,F])=>{const h=F.default!==void 0;let d=[ED(m)];F.alias&&d.push(ED(F.alias)),d=d.map(i.renderFlagName);const y=[b.exports.blue(d.join(", ")),i.renderType(F.type,h)];return y.push(Tu,F.description||n("help.noDescription")),h&&y.push(`(${n("help.default",i.renderDefault(F.default))})`),y}))}),o.notes&&s.push({title:n("help.notes"),body:o.notes}),o.examples&&SD(s,o.examples,n),s=i.renderSections(s),u(s)},Ie=({command:u=!0,showHelpWhenNoCommand:D=!0,notes:e,examples:t,banner:r}={})=>W({setup:n=>{const{add:o,t:i}=n.i18n;o(ke);const s=a=>{r&&$D(`${r}
68
+ `),$D(a)};return u&&(n=n.command("help",i("help.commandDescription"),{parameters:["[command...]"],notes:[i("help.notes.1"),i("help.notes.2"),i("help.notes.3")],examples:[[`$ ${n._name} help`,i("help.examples.1")],[`$ ${n._name} help <command>`,i("help.examples.2")],[`$ ${n._name} <command> --help`,i("help.examples.2")]]}).on("help",a=>{a.parameters.command.length?s(Lu(P,a,a.parameters.command)):s(lu(P,a,e,t))})),n.inspector((a,c)=>{const C=a.raw.mergedFlags.h||a.raw.mergedFlags.help;if(!a.hasRootOrAlias&&!a.raw._.length&&D&&!C){let l=`${i("core.noCommandGiven")}
69
69
 
70
- `;c+=te(u,l,n,r),c+=`
71
- `,a(c),process.exit(1)}else g?l.raw._.length?l.called!==y&&l.name===y?a(te(u,l,n,r)):a(tt(u,l,l.raw._)):a(te(u,l,n,r)):p()}),i}}),T=new Uint32Array(65536),fn=(e,t)=>{const n=e.length,r=t.length,o=1<<n-1;let s=-1,i=0,u=n,a=n;for(;a--;)T[e.charCodeAt(a)]|=1<<a;for(a=0;a<r;a++){let l=T[t.charCodeAt(a)];const p=l|i;l|=(l&s)+s^s,i|=~(l|s),s&=l,i&o&&u++,s&o&&u--,i=i<<1|1,s=s<<1|~(p|i),i&=p}for(a=n;a--;)T[e.charCodeAt(a)]=0;return u},xn=(e,t)=>{const n=t.length,r=e.length,o=[],s=[],i=Math.ceil(n/32),u=Math.ceil(r/32);for(let m=0;m<i;m++)s[m]=-1,o[m]=0;let a=0;for(;a<u-1;a++){let m=0,d=-1;const x=a*32,O=Math.min(32,r)+x;for(let f=x;f<O;f++)T[e.charCodeAt(f)]|=1<<f;for(let f=0;f<n;f++){const I=T[t.charCodeAt(f)],E=s[f/32|0]>>>f&1,_=o[f/32|0]>>>f&1,xe=I|m,$e=((I|_)&d)+d^d|I|_;let H=m|~($e|d),Z=d&$e;H>>>31^E&&(s[f/32|0]^=1<<f),Z>>>31^_&&(o[f/32|0]^=1<<f),H=H<<1|E,Z=Z<<1|_,d=Z|~(xe|H),m=H&xe}for(let f=x;f<O;f++)T[e.charCodeAt(f)]=0}let l=0,p=-1;const g=a*32,c=Math.min(32,r-g)+g;for(let m=g;m<c;m++)T[e.charCodeAt(m)]|=1<<m;let h=r;for(let m=0;m<n;m++){const d=T[t.charCodeAt(m)],x=s[m/32|0]>>>m&1,O=o[m/32|0]>>>m&1,f=d|l,I=((d|O)&p)+p^p|d|O;let E=l|~(I|p),_=p&I;h+=E>>>r-1&1,h-=_>>>r-1&1,E>>>31^x&&(s[m/32|0]^=1<<m),_>>>31^O&&(o[m/32|0]^=1<<m),E=E<<1|x,_=_<<1|O,p=_|~(f|E),l=E&f}for(let m=g;m<c;m++)T[e.charCodeAt(m)]=0;return h},nt=(e,t)=>{if(e.length<t.length){const n=t;t=e,e=n}return t.length===0?e.length:e.length<=32?fn(e,t):xn(e,t)};var ne=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},$n=1/0,Bn="[object Symbol]",Sn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,wn="\\u0300-\\u036f\\ufe20-\\ufe23",yn="\\u20d0-\\u20f0",Cn="["+wn+yn+"]",bn=RegExp(Cn,"g"),En={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"ss"},vn=typeof ne=="object"&&ne&&ne.Object===Object&&ne,An=typeof self=="object"&&self&&self.Object===Object&&self,On=vn||An||Function("return this")();function _n(e){return function(t){return e==null?void 0:e[t]}}var Tn=_n(En),Mn=Object.prototype,In=Mn.toString,rt=On.Symbol,ot=rt?rt.prototype:void 0,st=ot?ot.toString:void 0;function kn(e){if(typeof e=="string")return e;if(Ln(e))return st?st.call(e):"";var t=e+"";return t=="0"&&1/e==-$n?"-0":t}function Fn(e){return!!e&&typeof e=="object"}function Ln(e){return typeof e=="symbol"||Fn(e)&&In.call(e)==Bn}function Rn(e){return e==null?"":kn(e)}function Dn(e){return e=Rn(e),e&&e.replace(Sn,Tn).replace(bn,"")}var jn=Dn;let b,A;(function(e){e.ALL_CLOSEST_MATCHES="all-closest-matches",e.ALL_MATCHES="all-matches",e.ALL_SORTED_MATCHES="all-sorted-matches",e.FIRST_CLOSEST_MATCH="first-closest-match",e.FIRST_MATCH="first-match"})(b||(b={})),function(e){e.EDIT_DISTANCE="edit-distance",e.SIMILARITY="similarity"}(A||(A={}));const it=new Error("unknown returnType"),re=new Error("unknown thresholdType"),at=(e,t)=>{let n=e;return t.trimSpaces&&(n=n.trim().replace(/\s+/g," ")),t.deburr&&(n=jn(n)),t.caseSensitive||(n=n.toLowerCase()),n},lt=(e,t)=>{const{matchPath:n}=t,r=((o,s)=>{const i=s.length>0?s.reduce((u,a)=>u==null?void 0:u[a],o):o;return typeof i!="string"?"":i})(e,n);return at(r,t)};function Nn(e,t,n){const r=(c=>{const h={caseSensitive:!1,deburr:!0,matchPath:[],returnType:b.FIRST_CLOSEST_MATCH,thresholdType:A.SIMILARITY,trimSpaces:!0,...c};switch(h.thresholdType){case A.EDIT_DISTANCE:return{threshold:20,...h};case A.SIMILARITY:return{threshold:.4,...h};default:throw re}})(n),{returnType:o,threshold:s,thresholdType:i}=r,u=at(e,r);let a,l;switch(i){case A.EDIT_DISTANCE:a=c=>c<=s,l=c=>nt(u,lt(c,r));break;case A.SIMILARITY:a=c=>c>=s,l=c=>((h,m)=>{if(!h||!m)return 0;if(h===m)return 1;const d=nt(h,m),x=Math.max(h.length,m.length);return(x-d)/x})(u,lt(c,r));break;default:throw re}const p=[],g=t.length;switch(o){case b.ALL_CLOSEST_MATCHES:case b.FIRST_CLOSEST_MATCH:{const c=[];let h;switch(i){case A.EDIT_DISTANCE:h=1/0;for(let d=0;d<g;d+=1){const x=l(t[d]);h>x&&(h=x),c.push(x)}break;case A.SIMILARITY:h=0;for(let d=0;d<g;d+=1){const x=l(t[d]);h<x&&(h=x),c.push(x)}break;default:throw re}const m=c.length;for(let d=0;d<m;d+=1){const x=c[d];a(x)&&x===h&&p.push(d)}break}case b.ALL_MATCHES:for(let c=0;c<g;c+=1)a(l(t[c]))&&p.push(c);break;case b.ALL_SORTED_MATCHES:{const c=[];for(let h=0;h<g;h+=1){const m=l(t[h]);a(m)&&c.push({score:m,index:h})}switch(i){case A.EDIT_DISTANCE:c.sort((h,m)=>h.score-m.score);break;case A.SIMILARITY:c.sort((h,m)=>m.score-h.score);break;default:throw re}for(const h of c)p.push(h.index);break}case b.FIRST_MATCH:for(let c=0;c<g;c+=1)if(a(l(t[c]))){p.push(c);break}break;default:throw it}return((c,h,m)=>{switch(m){case b.ALL_CLOSEST_MATCHES:case b.ALL_MATCHES:case b.ALL_SORTED_MATCHES:return h.map(d=>c[d]);case b.FIRST_CLOSEST_MATCH:case b.FIRST_MATCH:return h.length?c[h[0]]:null;default:throw it}})(t,p,o)}var P={exports:{}};let Wn=oe,Pn=!("NO_COLOR"in process.env||process.argv.includes("--no-color"))&&("FORCE_COLOR"in process.env||process.argv.includes("--color")||process.platform==="win32"||Wn.isatty(1)&&process.env.TERM!=="dumb"||"CI"in process.env),S=(e,t,n=e)=>r=>{let o=""+r,s=o.indexOf(t,e.length);return~s?e+ut(o,t,n,s)+t:e+o+t},ut=(e,t,n,r)=>{let o=e.substring(0,r)+n,s=e.substring(r+t.length),i=s.indexOf(t);return~i?o+ut(s,t,n,i):o+s},ct=(e=Pn)=>({isColorSupported:e,reset:e?t=>`\x1B[0m${t}\x1B[0m`:String,bold:e?S("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"):String,dim:e?S("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"):String,italic:e?S("\x1B[3m","\x1B[23m"):String,underline:e?S("\x1B[4m","\x1B[24m"):String,inverse:e?S("\x1B[7m","\x1B[27m"):String,hidden:e?S("\x1B[8m","\x1B[28m"):String,strikethrough:e?S("\x1B[9m","\x1B[29m"):String,black:e?S("\x1B[30m","\x1B[39m"):String,red:e?S("\x1B[31m","\x1B[39m"):String,green:e?S("\x1B[32m","\x1B[39m"):String,yellow:e?S("\x1B[33m","\x1B[39m"):String,blue:e?S("\x1B[34m","\x1B[39m"):String,magenta:e?S("\x1B[35m","\x1B[39m"):String,cyan:e?S("\x1B[36m","\x1B[39m"):String,white:e?S("\x1B[37m","\x1B[39m"):String,gray:e?S("\x1B[90m","\x1B[39m"):String,bgBlack:e?S("\x1B[40m","\x1B[49m"):String,bgRed:e?S("\x1B[41m","\x1B[49m"):String,bgGreen:e?S("\x1B[42m","\x1B[49m"):String,bgYellow:e?S("\x1B[43m","\x1B[49m"):String,bgBlue:e?S("\x1B[44m","\x1B[49m"):String,bgMagenta:e?S("\x1B[45m","\x1B[49m"):String,bgCyan:e?S("\x1B[46m","\x1B[49m"):String,bgWhite:e?S("\x1B[47m","\x1B[49m"):String});P.exports=ct(),P.exports.createColors=ct;const Hn=e=>e.length<=1?e[0]:`${e.slice(0,-1).map(P.exports.bold).join(", ")} and ${P.exports.bold(e[e.length-1])}`,Un=()=>D({setup:e=>e.inspector({enforce:"pre",fn:(t,n)=>{const r=Object.keys(e._commands),o=!!r.length;try{n()}catch(s){if(!(s instanceof z||s instanceof K))throw s;if(t.raw._.length===0||s instanceof K){console.error("No command given."),o&&console.error(`Possible commands: ${Hn(r)}.`);return}const i=s.commandName,u=Nn(i,r);console.error(`Command "${P.exports.strikethrough(i)}" not found.`),o&&u?console.error(`Did you mean "${P.exports.bold(u)}"?`):o||console.error("NOTE: You haven't register any command yet."),process.stderr.write(`
72
- `),process.exit(2)}}})}),Yn=e=>e.length<=1?e[0]:`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`,Vn=()=>D({setup:e=>e.inspector((t,n)=>{const r=Object.keys(t.unknownFlags);if(!t.resolved||r.length===0)n();else throw new Error(`Unexpected flag${r.length>1?"s":""}: ${Yn(r)}`)})}),Gn=e=>e.length===0?"":e.startsWith("v")?e:`v${e}`,qn=({alias:e=["V"],command:t=!0}={})=>D({setup:n=>{const r=Gn(n._version);return t&&(n=n.command("version","Show version",{notes:['The version string begins with a "v".']}).on("version",()=>{process.stdout.write(r)})),n.inspector({enforce:"pre",fn:(o,s)=>{let i=!1;const u=["version",...e];for(const a of Object.keys(o.raw.mergedFlags))if(u.includes(a)){i=!0;break}i?process.stdout.write(r):s()}})}});var M={exports:{}};let Zn=oe,Jn=!("NO_COLOR"in process.env||process.argv.includes("--no-color"))&&("FORCE_COLOR"in process.env||process.argv.includes("--color")||process.platform==="win32"||Zn.isatty(1)&&process.env.TERM!=="dumb"||"CI"in process.env),w=(e,t,n=e)=>r=>{let o=""+r,s=o.indexOf(t,e.length);return~s?e+mt(o,t,n,s)+t:e+o+t},mt=(e,t,n,r)=>{let o=e.substring(0,r)+n,s=e.substring(r+t.length),i=s.indexOf(t);return~i?o+mt(s,t,n,i):o+s},ht=(e=Jn)=>({isColorSupported:e,reset:e?t=>`\x1B[0m${t}\x1B[0m`:String,bold:e?w("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"):String,dim:e?w("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"):String,italic:e?w("\x1B[3m","\x1B[23m"):String,underline:e?w("\x1B[4m","\x1B[24m"):String,inverse:e?w("\x1B[7m","\x1B[27m"):String,hidden:e?w("\x1B[8m","\x1B[28m"):String,strikethrough:e?w("\x1B[9m","\x1B[29m"):String,black:e?w("\x1B[30m","\x1B[39m"):String,red:e?w("\x1B[31m","\x1B[39m"):String,green:e?w("\x1B[32m","\x1B[39m"):String,yellow:e?w("\x1B[33m","\x1B[39m"):String,blue:e?w("\x1B[34m","\x1B[39m"):String,magenta:e?w("\x1B[35m","\x1B[39m"):String,cyan:e?w("\x1B[36m","\x1B[39m"):String,white:e?w("\x1B[37m","\x1B[39m"):String,gray:e?w("\x1B[90m","\x1B[39m"):String,bgBlack:e?w("\x1B[40m","\x1B[49m"):String,bgRed:e?w("\x1B[41m","\x1B[49m"):String,bgGreen:e?w("\x1B[42m","\x1B[49m"):String,bgYellow:e?w("\x1B[43m","\x1B[49m"):String,bgBlue:e?w("\x1B[44m","\x1B[49m"):String,bgMagenta:e?w("\x1B[45m","\x1B[49m"):String,bgCyan:e?w("\x1B[46m","\x1B[49m"):String,bgWhite:e?w("\x1B[47m","\x1B[49m"):String});M.exports=ht(),M.exports.createColors=ht;function zn(e){return e.split(`
73
- `).splice(1).map(t=>t.trim().replace("file://",""))}function Kn(e){return`
74
- ${zn(e).map(t=>` ${t.replace(/^at ([\s\S]+) \((.+)\)/,(n,r,o)=>M.exports.gray(`at ${r} (${M.exports.cyan(o)})`))}`).join(`
75
- `)}`}function Qn(e){return e.map(t=>typeof(t==null?void 0:t.stack)=="string"?`${t.message}
76
- ${Kn(t.stack)}`:t)}function Xn(e,t){const n=e.toUpperCase(),r=M.exports[t];return M.exports.bold(M.exports.inverse(r(` ${n} `)))}function q(e,t,n){const r=M.exports[t],o=n!=null&&n.textColor?M.exports[n.textColor]:r,s=(n==null?void 0:n.target)||console.log;return(...i)=>{const u=Qn(i);s(`${Xn(e,t)} ${o(u.join(" "))}
77
- `)}}q("log","gray"),q("info","blue",{target:console.info}),q("warn","yellow",{target:console.warn}),q("success","green");const er=q("error","red",{target:console.error}),tr=()=>D({setup:e=>e.inspector({enforce:"pre",fn:(t,n)=>{try{n()}catch(r){er(r.message),process.exit(1)}}})});export{Wt as Clerc,we as CommandExistsError,ye as CommandNameConflictError,be as DescriptionNotSetError,ve as InvalidCommandNameError,Ce as NameNotSetError,K as NoCommandGivenError,z as NoSuchCommandError,y as Root,Ee as VersionNotSetError,Jt as completionsPlugin,Ie as compose,Ut as defineCommand,Pt as defineHandler,Ht as defineInspector,D as definePlugin,j as formatCommandName,tr as friendlyErrorPlugin,dn as helpPlugin,ke as isInvalidName,Un as notFoundPlugin,ae as resolveArgv,ie as resolveCommand,_e as resolveFlattenCommands,Me as resolveParametersBeforeFlag,Dt as resolveRootCommands,Te as resolveSubcommandsByParent,Vn as strictFlagsPlugin,qn as versionPlugin,Fe as withBrackets};
70
+ `;l+=lu(P,a,e,t),l+=`
71
+ `,s(l),process.exit(1)}else C?a.raw._.length?a.called!==p&&a.name===p?s(lu(P,a,e,t)):s(Lu(P,a,a.raw._)):a.hasRootOrAlias?s(Lu(P,a,p)):s(lu(P,a,e,t)):c()}),n}}),Re={en:{"utils.and":"%s and %s"},"zh-CN":{"utils.and":"%s \u548C %s"}},je=(u,{add:D,t:e})=>(D(Re),u.length<=1?u[0]:e("utils.and",u.slice(0,-1).join(", "),u[u.length-1])),M=new Uint32Array(65536),We=(u,D)=>{const e=u.length,t=D.length,r=1<<e-1;let n=-1,o=0,i=e,s=e;for(;s--;)M[u.charCodeAt(s)]|=1<<s;for(s=0;s<t;s++){let a=M[D.charCodeAt(s)];const c=a|o;a|=(a&n)+n^n,o|=~(a|n),n&=a,o&r&&i++,n&r&&i--,o=o<<1|1,n=n<<1|~(c|o),o&=c}for(s=e;s--;)M[u.charCodeAt(s)]=0;return i},Pe=(u,D)=>{const e=D.length,t=u.length,r=[],n=[],o=Math.ceil(e/32),i=Math.ceil(t/32);for(let F=0;F<o;F++)n[F]=-1,r[F]=0;let s=0;for(;s<i-1;s++){let F=0,h=-1;const d=s*32,y=Math.min(32,t)+d;for(let A=d;A<y;A++)M[u.charCodeAt(A)]|=1<<A;for(let A=0;A<e;A++){const H=M[D.charCodeAt(A)],N=n[A/32|0]>>>A&1,O=r[A/32|0]>>>A&1,ku=H|F,Iu=((H|O)&h)+h^h|H|O;let G=F|~(Iu|h),tu=h&Iu;G>>>31^N&&(n[A/32|0]^=1<<A),tu>>>31^O&&(r[A/32|0]^=1<<A),G=G<<1|N,tu=tu<<1|O,h=tu|~(ku|G),F=G&ku}for(let A=d;A<y;A++)M[u.charCodeAt(A)]=0}let a=0,c=-1;const C=s*32,l=Math.min(32,t-C)+C;for(let F=C;F<l;F++)M[u.charCodeAt(F)]|=1<<F;let m=t;for(let F=0;F<e;F++){const h=M[D.charCodeAt(F)],d=n[F/32|0]>>>F&1,y=r[F/32|0]>>>F&1,A=h|a,H=((h|y)&c)+c^c|h|y;let N=a|~(H|c),O=c&H;m+=N>>>t-1&1,m-=O>>>t-1&1,N>>>31^d&&(n[F/32|0]^=1<<F),O>>>31^y&&(r[F/32|0]^=1<<F),N=N<<1|d,O=O<<1|y,c=O|~(A|N),a=N&A}for(let F=C;F<l;F++)M[u.charCodeAt(F)]=0;return m},wD=(u,D)=>{if(u.length<D.length){const e=D;D=u,u=e}return D.length===0?u.length:u.length<=32?We(u,D):Pe(u,D)};var cu=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},He=1/0,Ue="[object Symbol]",Ye=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ze="\\u0300-\\u036f\\ufe20-\\ufe23",Ge="\\u20d0-\\u20f0",Ze="["+ze+Ge+"]",Ve=RegExp(Ze,"g"),qe={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"ss"},Je=typeof cu=="object"&&cu&&cu.Object===Object&&cu,Ke=typeof self=="object"&&self&&self.Object===Object&&self,Qe=Je||Ke||Function("return this")();function Xe(u){return function(D){return u==null?void 0:u[D]}}var ut=Xe(qe),Dt=Object.prototype,et=Dt.toString,bD=Qe.Symbol,yD=bD?bD.prototype:void 0,vD=yD?yD.toString:void 0;function tt(u){if(typeof u=="string")return u;if(rt(u))return vD?vD.call(u):"";var D=u+"";return D=="0"&&1/u==-He?"-0":D}function nt(u){return!!u&&typeof u=="object"}function rt(u){return typeof u=="symbol"||nt(u)&&et.call(u)==Ue}function ot(u){return u==null?"":tt(u)}function st(u){return u=ot(u),u&&u.replace(Ye,ut).replace(Ve,"")}var it=st;let $,v;(function(u){u.ALL_CLOSEST_MATCHES="all-closest-matches",u.ALL_MATCHES="all-matches",u.ALL_SORTED_MATCHES="all-sorted-matches",u.FIRST_CLOSEST_MATCH="first-closest-match",u.FIRST_MATCH="first-match"})($||($={})),function(u){u.EDIT_DISTANCE="edit-distance",u.SIMILARITY="similarity"}(v||(v={}));const OD=new Error("unknown returnType"),Fu=new Error("unknown thresholdType"),_D=(u,D)=>{let e=u;return D.trimSpaces&&(e=e.trim().replace(/\s+/g," ")),D.deburr&&(e=it(e)),D.caseSensitive||(e=e.toLowerCase()),e},ND=(u,D)=>{const{matchPath:e}=D,t=((r,n)=>{const o=n.length>0?n.reduce((i,s)=>i==null?void 0:i[s],r):r;return typeof o!="string"?"":o})(u,e);return _D(t,D)};function at(u,D,e){const t=(l=>{const m={caseSensitive:!1,deburr:!0,matchPath:[],returnType:$.FIRST_CLOSEST_MATCH,thresholdType:v.SIMILARITY,trimSpaces:!0,...l};switch(m.thresholdType){case v.EDIT_DISTANCE:return{threshold:20,...m};case v.SIMILARITY:return{threshold:.4,...m};default:throw Fu}})(e),{returnType:r,threshold:n,thresholdType:o}=t,i=_D(u,t);let s,a;switch(o){case v.EDIT_DISTANCE:s=l=>l<=n,a=l=>wD(i,ND(l,t));break;case v.SIMILARITY:s=l=>l>=n,a=l=>((m,F)=>{if(!m||!F)return 0;if(m===F)return 1;const h=wD(m,F),d=Math.max(m.length,F.length);return(d-h)/d})(i,ND(l,t));break;default:throw Fu}const c=[],C=D.length;switch(r){case $.ALL_CLOSEST_MATCHES:case $.FIRST_CLOSEST_MATCH:{const l=[];let m;switch(o){case v.EDIT_DISTANCE:m=1/0;for(let h=0;h<C;h+=1){const d=a(D[h]);m>d&&(m=d),l.push(d)}break;case v.SIMILARITY:m=0;for(let h=0;h<C;h+=1){const d=a(D[h]);m<d&&(m=d),l.push(d)}break;default:throw Fu}const F=l.length;for(let h=0;h<F;h+=1){const d=l[h];s(d)&&d===m&&c.push(h)}break}case $.ALL_MATCHES:for(let l=0;l<C;l+=1)s(a(D[l]))&&c.push(l);break;case $.ALL_SORTED_MATCHES:{const l=[];for(let m=0;m<C;m+=1){const F=a(D[m]);s(F)&&l.push({score:F,index:m})}switch(o){case v.EDIT_DISTANCE:l.sort((m,F)=>m.score-F.score);break;case v.SIMILARITY:l.sort((m,F)=>F.score-m.score);break;default:throw Fu}for(const m of l)c.push(m.index);break}case $.FIRST_MATCH:for(let l=0;l<C;l+=1)if(s(a(D[l]))){c.push(l);break}break;default:throw OD}return((l,m,F)=>{switch(F){case $.ALL_CLOSEST_MATCHES:case $.ALL_MATCHES:case $.ALL_SORTED_MATCHES:return m.map(h=>l[h]);case $.FIRST_CLOSEST_MATCH:case $.FIRST_MATCH:return m.length?l[m[0]]:null;default:throw OD}})(D,c,r)}var Cu={exports:{}};let lt=mu,ct=!("NO_COLOR"in process.env||process.argv.includes("--no-color"))&&("FORCE_COLOR"in process.env||process.argv.includes("--color")||process.platform==="win32"||lt.isatty(1)&&process.env.TERM!=="dumb"||"CI"in process.env),g=(u,D,e=u)=>t=>{let r=""+t,n=r.indexOf(D,u.length);return~n?u+TD(r,D,e,n)+D:u+r+D},TD=(u,D,e,t)=>{let r=u.substring(0,t)+e,n=u.substring(t+D.length),o=n.indexOf(D);return~o?r+TD(n,D,e,o):r+n},MD=(u=ct)=>({isColorSupported:u,reset:u?D=>`\x1B[0m${D}\x1B[0m`:String,bold:u?g("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"):String,dim:u?g("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"):String,italic:u?g("\x1B[3m","\x1B[23m"):String,underline:u?g("\x1B[4m","\x1B[24m"):String,inverse:u?g("\x1B[7m","\x1B[27m"):String,hidden:u?g("\x1B[8m","\x1B[28m"):String,strikethrough:u?g("\x1B[9m","\x1B[29m"):String,black:u?g("\x1B[30m","\x1B[39m"):String,red:u?g("\x1B[31m","\x1B[39m"):String,green:u?g("\x1B[32m","\x1B[39m"):String,yellow:u?g("\x1B[33m","\x1B[39m"):String,blue:u?g("\x1B[34m","\x1B[39m"):String,magenta:u?g("\x1B[35m","\x1B[39m"):String,cyan:u?g("\x1B[36m","\x1B[39m"):String,white:u?g("\x1B[37m","\x1B[39m"):String,gray:u?g("\x1B[90m","\x1B[39m"):String,bgBlack:u?g("\x1B[40m","\x1B[49m"):String,bgRed:u?g("\x1B[41m","\x1B[49m"):String,bgGreen:u?g("\x1B[42m","\x1B[49m"):String,bgYellow:u?g("\x1B[43m","\x1B[49m"):String,bgBlue:u?g("\x1B[44m","\x1B[49m"):String,bgMagenta:u?g("\x1B[45m","\x1B[49m"):String,bgCyan:u?g("\x1B[46m","\x1B[49m"):String,bgWhite:u?g("\x1B[47m","\x1B[49m"):String});Cu.exports=MD(),Cu.exports.createColors=MD;const Ft={en:{"notFound.possibleCommands":"Possible commands: %s.","notFound.commandNotFound":'Command "%s" not found.',"notFound.didyoumean":'Did you mean "%s"?',"notFound.commandNotRegisteredNote":"NOTE: You haven't register any command yet."},"zh-CN":{"notFound.possibleCommands":"\u53EF\u80FD\u7684\u547D\u4EE4: %s\u3002","notFound.commandNotFound":'\u672A\u627E\u5230\u547D\u4EE4 "%s"\u3002',"notFound.didyoumean":'\u4F60\u662F\u4E0D\u662F\u6307 "%s"\uFF1F',"notFound.commandNotRegisteredNote":"\u63D0\u793A: \u4F60\u8FD8\u6CA1\u6709\u6CE8\u518C\u4EFB\u4F55\u547D\u4EE4\u3002"}},Ct=()=>W({setup:u=>{const{t:D,add:e}=u.i18n;return e(Ft),u.inspector({enforce:"pre",fn:(t,r)=>{const n=Object.keys(u._commands),o=!!n.length;try{r()}catch(i){if(!(i instanceof ou||i instanceof su))throw i;if(t.raw._.length===0||i instanceof su){console.error(D("core.noCommandGiven")),o&&console.error(D("notFound.possibleCommands",je(n,u.i18n)));return}const s=i.commandName,a=at(s,n);console.error(D("notFound.commandNotFound",Cu.exports.strikethrough(s))),o&&a?console.error(D("notFound.didyoumean",Cu.exports.bold(a))):o||console.error(D("notFound.commandNotRegisteredNote")),process.stderr.write(`
72
+ `),process.exit(2)}}})}}),mt={en:{"utils.and":"%s and %s"},"zh-CN":{"utils.and":"%s \u548C %s"}},LD=(u,{add:D,t:e})=>(D(mt),u.length<=1?u[0]:e("utils.and",u.slice(0,-1).join(", "),u[u.length-1])),Et={en:{"strictFlags.unexpectedSingle":"Unexpected flag: %s.","strictFlags.unexpectedMore":"Unexpected flags: %s.","strictFlags.and":"%s and %s"},"zh-CN":{"strictFlags.unexpectedSingle":"\u9884\u671F\u4E4B\u5916\u7684\u6807\u5FD7: %s\u3002","strictFlags.unexpectedMore":"\u9884\u671F\u4E4B\u5916\u7684\u6807\u5FD7: %s\u3002","strictFlags.and":"%s \u548C %s"}},ht=()=>W({setup:u=>{const{add:D,t:e}=u.i18n;return D(Et),u.inspector((t,r)=>{const n=Object.keys(t.unknownFlags);if(!t.resolved||n.length===0)r();else throw n.length>1?new Error(e("strictFlags.unexpectedMore",LD(n,u.i18n))):new Error(e("strictFlags.unexpectedSingle",LD(n,u.i18n)))})}}),pt=u=>u.length===0?"":u.startsWith("v")?u:`v${u}`,dt={en:{"version.commandDescription":"Show CLI version","version.notes.1":'The version string begins with a "v".'},"zh-CN":{"version.commandDescription":"\u5C55\u793A CLI \u7248\u672C","version.notes.1":'\u7248\u672C\u53F7\u5F00\u5934\u5E26\u6709 "v"\u3002'}},Bt=({alias:u=["V"],command:D=!0}={})=>W({setup:e=>{const{add:t,t:r}=e.i18n;t(dt);const n=pt(e._version);return D&&(e=e.command("version",r("version.commandDescription"),{notes:[r("version.notes.1")]}).on("version",()=>{process.stdout.write(n)})),e.inspector({enforce:"pre",fn:(o,i)=>{let s=!1;const a=["version",...u];for(const c of Object.keys(o.raw.mergedFlags))if(a.includes(c)){s=!0;break}s?process.stdout.write(n):i()}})}});var L={exports:{}};let gt=mu,ft=!("NO_COLOR"in process.env||process.argv.includes("--no-color"))&&("FORCE_COLOR"in process.env||process.argv.includes("--color")||process.platform==="win32"||gt.isatty(1)&&process.env.TERM!=="dumb"||"CI"in process.env),f=(u,D,e=u)=>t=>{let r=""+t,n=r.indexOf(D,u.length);return~n?u+kD(r,D,e,n)+D:u+r+D},kD=(u,D,e,t)=>{let r=u.substring(0,t)+e,n=u.substring(t+D.length),o=n.indexOf(D);return~o?r+kD(n,D,e,o):r+n},ID=(u=ft)=>({isColorSupported:u,reset:u?D=>`\x1B[0m${D}\x1B[0m`:String,bold:u?f("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"):String,dim:u?f("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"):String,italic:u?f("\x1B[3m","\x1B[23m"):String,underline:u?f("\x1B[4m","\x1B[24m"):String,inverse:u?f("\x1B[7m","\x1B[27m"):String,hidden:u?f("\x1B[8m","\x1B[28m"):String,strikethrough:u?f("\x1B[9m","\x1B[29m"):String,black:u?f("\x1B[30m","\x1B[39m"):String,red:u?f("\x1B[31m","\x1B[39m"):String,green:u?f("\x1B[32m","\x1B[39m"):String,yellow:u?f("\x1B[33m","\x1B[39m"):String,blue:u?f("\x1B[34m","\x1B[39m"):String,magenta:u?f("\x1B[35m","\x1B[39m"):String,cyan:u?f("\x1B[36m","\x1B[39m"):String,white:u?f("\x1B[37m","\x1B[39m"):String,gray:u?f("\x1B[90m","\x1B[39m"):String,bgBlack:u?f("\x1B[40m","\x1B[49m"):String,bgRed:u?f("\x1B[41m","\x1B[49m"):String,bgGreen:u?f("\x1B[42m","\x1B[49m"):String,bgYellow:u?f("\x1B[43m","\x1B[49m"):String,bgBlue:u?f("\x1B[44m","\x1B[49m"):String,bgMagenta:u?f("\x1B[45m","\x1B[49m"):String,bgCyan:u?f("\x1B[46m","\x1B[49m"):String,bgWhite:u?f("\x1B[47m","\x1B[49m"):String});L.exports=ID(),L.exports.createColors=ID;function At(u){return u.split(`
73
+ `).splice(1).map(D=>D.trim().replace("file://",""))}function xt(u){return`
74
+ ${At(u).map(D=>` ${D.replace(/^at ([\s\S]+) \((.+)\)/,(e,t,r)=>L.exports.gray(`at ${t} (${L.exports.cyan(r)})`))}`).join(`
75
+ `)}`}function $t(u){return u.map(D=>typeof(D==null?void 0:D.stack)=="string"?`${D.message}
76
+ ${xt(D.stack)}`:D)}function St(u,D){const e=u.toUpperCase(),t=L.exports[D];return L.exports.bold(L.exports.inverse(t(` ${e} `)))}function eu(u,D,e){const t=L.exports[D],r=e!=null&&e.textColor?L.exports[e.textColor]:t,n=(e==null?void 0:e.target)||console.log;return(...o)=>{const i=$t(o);n(`${St(u,D)} ${r(i.join(" "))}
77
+ `)}}eu("log","gray"),eu("info","blue",{target:console.info}),eu("warn","yellow",{target:console.warn}),eu("success","green");const wt=eu("error","red",{target:console.error}),bt=()=>W({setup:u=>u.errorHandler(D=>{wt(D.message),process.exit(1)})});export{Fe as Clerc,Hu as CommandExistsError,Uu as CommandNameConflictError,zu as DescriptionNotSetError,Zu as InvalidCommandNameError,pu as LocaleNotCalledFirstError,Yu as NameNotSetError,su as NoCommandGivenError,ou as NoSuchCommandError,p as Root,Gu as VersionNotSetError,fe as completionsPlugin,uD as compose,Ee as defineCommand,Ce as defineHandler,me as defineInspector,W as definePlugin,tD as detectLocale,U as formatCommandName,bt as friendlyErrorPlugin,Ie as helpPlugin,DD as isInvalidName,Ct as notFoundPlugin,Bu as resolveArgv,Ju as resolveCommand,Ku as resolveCommandStrict,du as resolveFlattenCommands,Xu as resolveParametersBeforeFlag,ae as resolveRootCommands,Qu as resolveSubcommandsByParent,ht as strictFlagsPlugin,Bt as versionPlugin,eD as withBrackets};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clerc",
3
- "version": "0.28.1",
3
+ "version": "0.30.0",
4
4
  "author": "Ray <nn_201312@163.com> (https://github.com/so1ve)",
5
5
  "description": "Clerc: The full-featured cli framework.",
6
6
  "keywords": [
@@ -47,13 +47,13 @@
47
47
  "access": "public"
48
48
  },
49
49
  "devDependencies": {
50
- "@clerc/core": "0.28.1",
51
- "@clerc/plugin-friendly-error": "0.28.1",
52
- "@clerc/plugin-help": "0.28.1",
53
- "@clerc/plugin-not-found": "0.28.1",
54
- "@clerc/plugin-completions": "0.28.1",
55
- "@clerc/plugin-strict-flags": "0.28.1",
56
- "@clerc/plugin-version": "0.28.1"
50
+ "@clerc/core": "0.30.0",
51
+ "@clerc/plugin-friendly-error": "0.30.0",
52
+ "@clerc/plugin-help": "0.30.0",
53
+ "@clerc/plugin-strict-flags": "0.30.0",
54
+ "@clerc/plugin-not-found": "0.30.0",
55
+ "@clerc/plugin-completions": "0.30.0",
56
+ "@clerc/plugin-version": "0.30.0"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "puild --minify",