derived-cli 0.0.47 → 0.0.49
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/bundle.js +59 -56
- package/package.json +1 -1
package/dist/bundle.js
CHANGED
|
@@ -1,91 +1,91 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var Mu=Object.create;var Y=Object.defineProperty;var Nu=Object.getOwnPropertyDescriptor;var Hu=Object.getOwnPropertyNames;var Wu=Object.getPrototypeOf,Gu=Object.prototype.hasOwnProperty;var Ru=(s,e)=>()=>(s&&(e=s(s=0)),e);var k=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports),ft=(s,e)=>{for(var t in e)Y(s,t,{get:e[t],enumerable:!0})},gt=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let
|
|
3
|
-
`)}displayWidth(e){return Ct(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(t=>t==="[options]"?this.styleOptionText(t):t==="[command]"?this.styleSubcommandText(t):t[0]==="["||t[0]==="<"?this.styleArgumentText(t):this.styleCommandText(t)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(t=>t==="[options]"?this.styleOptionText(t):t[0]==="["||t[0]==="<"?this.styleArgumentText(t):this.styleSubcommandText(t)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,i,
|
|
4
|
-
`+" ".repeat(t+a)),u+o+" ".repeat(a)+
|
|
5
|
-
${u}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let i=e.split(/\r\n|\n/),
|
|
6
|
-
`)}};function Ct(s){let e=/\x1b\[\d*(;\d*)*m/g;return s.replace(e,"")}
|
|
2
|
+
"use strict";var Mu=Object.create;var Y=Object.defineProperty;var Nu=Object.getOwnPropertyDescriptor;var Hu=Object.getOwnPropertyNames;var Wu=Object.getPrototypeOf,Gu=Object.prototype.hasOwnProperty;var Ru=(s,e)=>()=>(s&&(e=s(s=0)),e);var k=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports),ft=(s,e)=>{for(var t in e)Y(s,t,{get:e[t],enumerable:!0})},gt=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Hu(e))!Gu.call(s,n)&&n!==t&&Y(s,n,{get:()=>e[n],enumerable:!(i=Nu(e,n))||i.enumerable});return s};var b=(s,e,t)=>(t=s!=null?Mu(Wu(s)):{},gt(e||!s||!s.__esModule?Y(t,"default",{value:s,enumerable:!0}):t,s)),qu=s=>gt(Y({},"__esModule",{value:!0}),s);var L=k(be=>{var Q=class extends Error{constructor(e,t,i){super(i),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},Ee=class extends Q{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};be.CommanderError=Q;be.InvalidArgumentError=Ee});var Z=k($e=>{var{InvalidArgumentError:Lu}=L(),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.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}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,i)=>{if(!this.argChoices.includes(t))throw new Lu(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(t,i):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function Uu(s){let e=s.name()+(s.variadic===!0?"...":"");return s.required?"<"+e+">":"["+e+"]"}$e.Argument=ye;$e.humanReadableArgName=Uu});var Ae=k(_e=>{var{humanReadableArgName:Ju}=Z(),ve=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(n=>!n._hidden),i=e._getHelpCommand();return i&&!i._hidden&&t.push(i),this.sortSubcommands&&t.sort((n,r)=>n.name().localeCompare(r.name())),t}compareOptions(e,t){let i=n=>n.short?n.short.replace(/^-/,""):n.long.replace(/^--/,"");return i(e).localeCompare(i(t))}visibleOptions(e){let t=e.options.filter(n=>!n.hidden),i=e._getHelpOption();if(i&&!i.hidden){let n=i.short&&e._findOption(i.short),r=i.long&&e._findOption(i.long);!n&&!r?t.push(i):i.long&&!r?t.push(e.createOption(i.long,i.description)):i.short&&!n&&t.push(e.createOption(i.short,i.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let i=e.parent;i;i=i.parent){let n=i.options.filter(r=>!r.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(i=>Ju(i)).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((i,n)=>Math.max(i,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((i,n)=>Math.max(i,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((i,n)=>Math.max(i,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((i,n)=>Math.max(i,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let i="";for(let n=e.parent;n;n=n.parent)i=n.name()+" "+i;return i+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).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){let i=`(${t.join(", ")})`;return e.description?`${e.description} ${i}`:i}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let i=`(${t.join(", ")})`;return e.description?`${e.description} ${i}`:i}return e.description}formatItemList(e,t,i){return t.length===0?[]:[i.styleTitle(e),...t,""]}groupItems(e,t,i){let n=new Map;return e.forEach(r=>{let u=i(r);n.has(u)||n.set(u,[])}),t.forEach(r=>{let u=i(r);n.has(u)||n.set(u,[]),n.get(u).push(r)}),n}formatHelp(e,t){let i=t.padWidth(e,t),n=t.helpWidth??80;function r(l,p){return t.formatItem(l,i,p,t)}let u=[`${t.styleTitle("Usage:")} ${t.styleUsage(t.commandUsage(e))}`,""],o=t.commandDescription(e);o.length>0&&(u=u.concat([t.boxWrap(t.styleCommandDescription(o),n),""]));let a=t.visibleArguments(e).map(l=>r(t.styleArgumentTerm(t.argumentTerm(l)),t.styleArgumentDescription(t.argumentDescription(l))));if(u=u.concat(this.formatItemList("Arguments:",a,t)),this.groupItems(e.options,t.visibleOptions(e),l=>l.helpGroupHeading??"Options:").forEach((l,p)=>{let F=l.map(w=>r(t.styleOptionTerm(t.optionTerm(w)),t.styleOptionDescription(t.optionDescription(w))));u=u.concat(this.formatItemList(p,F,t))}),t.showGlobalOptions){let l=t.visibleGlobalOptions(e).map(p=>r(t.styleOptionTerm(t.optionTerm(p)),t.styleOptionDescription(t.optionDescription(p))));u=u.concat(this.formatItemList("Global Options:",l,t))}return this.groupItems(e.commands,t.visibleCommands(e),l=>l.helpGroup()||"Commands:").forEach((l,p)=>{let F=l.map(w=>r(t.styleSubcommandTerm(t.subcommandTerm(w)),t.styleSubcommandDescription(t.subcommandDescription(w))));u=u.concat(this.formatItemList(p,F,t))}),u.join(`
|
|
3
|
+
`)}displayWidth(e){return Ct(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(t=>t==="[options]"?this.styleOptionText(t):t==="[command]"?this.styleSubcommandText(t):t[0]==="["||t[0]==="<"?this.styleArgumentText(t):this.styleCommandText(t)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(t=>t==="[options]"?this.styleOptionText(t):t[0]==="["||t[0]==="<"?this.styleArgumentText(t):this.styleSubcommandText(t)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,i,n){let u=" ".repeat(2);if(!i)return u+e;let o=e.padEnd(t+e.length-n.displayWidth(e)),a=2,D=(this.helpWidth??80)-t-a-2,l;return D<this.minWidthToWrap||n.preformatted(i)?l=i:l=n.boxWrap(i,D).replace(/\n/g,`
|
|
4
|
+
`+" ".repeat(t+a)),u+o+" ".repeat(a)+l.replace(/\n/g,`
|
|
5
|
+
${u}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let i=e.split(/\r\n|\n/),n=/[\s]*[^\s]+/g,r=[];return i.forEach(u=>{let o=u.match(n);if(o===null){r.push("");return}let a=[o.shift()],c=this.displayWidth(a[0]);o.forEach(D=>{let l=this.displayWidth(D);if(c+l<=t){a.push(D),c+=l;return}r.push(a.join(""));let p=D.trimStart();a=[p],c=this.displayWidth(p)}),r.push(a.join(""))}),r.join(`
|
|
6
|
+
`)}};function Ct(s){let e=/\x1b\[\d*(;\d*)*m/g;return s.replace(e,"")}_e.Help=ve;_e.stripColor=Ct});var Oe=k(xe=>{var{InvalidArgumentError:zu}=L(),Be=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 i=Ku(e);this.short=i.shortFlag,this.long=i.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(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}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,i)=>{if(!this.argChoices.includes(t))throw new zu(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(t,i):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?Ft(this.name().replace(/^no-/,"")):Ft(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},we=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,i)=>{this.positiveOptions.has(i)&&this.dualOptions.add(i)})}valueFromOption(e,t){let i=t.attributeName();if(!this.dualOptions.has(i))return!0;let n=this.negativeOptions.get(i).presetArg,r=n!==void 0?n:!1;return t.negate===(r===e)}};function Ft(s){return s.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function Ku(s){let e,t,i=/^-[^-]$/,n=/^--[^-]/,r=s.split(/[ |,]+/).concat("guard");if(i.test(r[0])&&(e=r.shift()),n.test(r[0])&&(t=r.shift()),!e&&i.test(r[0])&&(e=r.shift()),!e&&n.test(r[0])&&(e=t,t=r.shift()),r[0].startsWith("-")){let u=r[0],o=`option creation failed due to '${u}' in option flags '${s}'`;throw/^-[^-][^-]/.test(u)?new Error(`${o}
|
|
7
7
|
- a short flag is a single dash and a single character
|
|
8
8
|
- either use a single dash and a single character (for a short flag)
|
|
9
9
|
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`):i.test(u)?new Error(`${o}
|
|
10
|
-
- too many short flags`):
|
|
10
|
+
- too many short flags`):n.test(u)?new Error(`${o}
|
|
11
11
|
- too many long flags`):new Error(`${o}
|
|
12
|
-
- unrecognised flag format`)}if(e===void 0&&t===void 0)throw new Error(`option creation failed due to no flags found in '${s}'.`);return{shortFlag:e,longFlag:t}}
|
|
12
|
+
- unrecognised flag format`)}if(e===void 0&&t===void 0)throw new Error(`option creation failed due to no flags found in '${s}'.`);return{shortFlag:e,longFlag:t}}xe.Option=Be;xe.DualOptions=we});var bt=k(Et=>{function Yu(s,e){if(Math.abs(s.length-e.length)>3)return Math.max(s.length,e.length);let t=[];for(let i=0;i<=s.length;i++)t[i]=[i];for(let i=0;i<=e.length;i++)t[0][i]=i;for(let i=1;i<=e.length;i++)for(let n=1;n<=s.length;n++){let r=1;s[n-1]===e[i-1]?r=0:r=1,t[n][i]=Math.min(t[n-1][i]+1,t[n][i-1]+1,t[n-1][i-1]+r),n>1&&i>1&&s[n-1]===e[i-2]&&s[n-2]===e[i-1]&&(t[n][i]=Math.min(t[n][i],t[n-2][i-2]+1))}return t[s.length][e.length]}function Qu(s,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=s.startsWith("--");t&&(s=s.slice(2),e=e.map(u=>u.slice(2)));let i=[],n=3,r=.4;return e.forEach(u=>{if(u.length<=1)return;let o=Yu(s,u),a=Math.max(s.length,u.length);(a-o)/a>r&&(o<n?(n=o,i=[u]):o===n&&i.push(u))}),i.sort((u,o)=>u.localeCompare(o)),t&&(i=i.map(u=>`--${u}`)),i.length>1?`
|
|
13
13
|
(Did you mean one of ${i.join(", ")}?)`:i.length===1?`
|
|
14
|
-
(Did you mean ${i[0]}?)`:""}Et.suggestSimilar=Qu});var _t=k(
|
|
15
|
-
- 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 Xu(e,t)}argument(e,t,i,
|
|
16
|
-
Expecting one of '${i.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,i){this._exitCallback&&this._exitCallback(new
|
|
17
|
-
- already used by option '${t.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let t=
|
|
18
|
-
- either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,t,i){if(X.existsSync(e))return;let
|
|
14
|
+
(Did you mean ${i[0]}?)`:""}Et.suggestSimilar=Qu});var _t=k(Ve=>{var Zu=require("node:events").EventEmitter,Se=require("node:child_process"),T=require("node:path"),X=require("node:fs"),d=require("node:process"),{Argument:Xu,humanReadableArgName:ei}=Z(),{CommanderError:ke}=L(),{Help:ti,stripColor:ui}=Ae(),{Option:yt,DualOptions:ii}=Oe(),{suggestSimilar:$t}=bt(),Te=class s extends Zu{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=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._savedState=null,this._outputConfiguration={writeOut:t=>d.stdout.write(t),writeErr:t=>d.stderr.write(t),outputError:(t,i)=>i(t),getOutHelpWidth:()=>d.stdout.isTTY?d.stdout.columns:void 0,getErrHelpWidth:()=>d.stderr.isTTY?d.stderr.columns:void 0,getOutHasColors:()=>Pe()??(d.stdout.isTTY&&d.stdout.hasColors?.()),getErrHasColors:()=>Pe()??(d.stderr.isTTY&&d.stderr.hasColors?.()),stripColor:t=>ui(t)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(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,i){let n=t,r=i;typeof n=="object"&&n!==null&&(r=n,n=null),r=r||{};let[,u,o]=e.match(/([^ ]+) *(.*)/),a=this.createCommand(u);return n&&(a.description(n),a._executableHandler=!0),r.isDefault&&(this._defaultCommandName=a._name),a._hidden=!!(r.noHelp||r.hidden),a._executableFile=r.executableFile||null,o&&a.arguments(o),this._registerCommand(a),a.parent=this,a.copyInheritedSettings(this),n?this:a}createCommand(e){return new s(e)}createHelp(){return Object.assign(new ti,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...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
|
|
15
|
+
- 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 Xu(e,t)}argument(e,t,i,n){let r=this.createArgument(e,t);return typeof i=="function"?r.default(n).argParser(i):r.default(i),this.addArgument(r),this}arguments(e){return e.trim().split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(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,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let i=e??"help [command]",[,n,r]=i.match(/([^ ]+) *(.*)/),u=t??"display help for command",o=this.createCommand(n);return o.helpOption(!1),r&&o.arguments(r),u&&o.description(u),this._addImplicitHelpCommand=!0,this._helpCommand=o,(e||t)&&this._initCommandGroup(o),this}addHelpCommand(e,t){return typeof e!="object"?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(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 i=["preSubcommand","preAction","postAction"];if(!i.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
|
|
16
|
+
Expecting one of '${i.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,i){this._exitCallback&&this._exitCallback(new ke(e,t,i)),d.exit(e)}action(e){let t=i=>{let n=this.registeredArguments.length,r=i.slice(0,n);return this._storeOptionsAsProperties?r[n]=this:r[n]=this.opts(),r.push(this),e.apply(this,r)};return this._actionHandler=t,this}createOption(e,t){return new yt(e,t)}_callParseArg(e,t,i,n){try{return e.parseArg(t,i)}catch(r){if(r.code==="commander.invalidArgument"){let u=`${n} ${r.message}`;this.error(u,{exitCode:r.exitCode,code:r.code})}throw r}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let i=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 '${i}'
|
|
17
|
+
- already used by option '${t.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let t=n=>[n.name()].concat(n.aliases()),i=t(e).find(n=>this._findCommand(n));if(i){let n=t(this._findCommand(i)).join("|"),r=t(e).join("|");throw new Error(`cannot add command '${r}' as already have command '${n}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),i=e.attributeName();if(e.negate){let r=e.long.replace(/^--no-/,"--");this._findOption(r)||this.setOptionValueWithSource(i,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(i,e.defaultValue,"default");let n=(r,u,o)=>{r==null&&e.presetArg!==void 0&&(r=e.presetArg);let a=this.getOptionValue(i);r!==null&&e.parseArg?r=this._callParseArg(e,r,a,u):r!==null&&e.variadic&&(r=e._collectValue(r,a)),r==null&&(e.negate?r=!1:e.isBoolean()||e.optional?r=!0:r=""),this.setOptionValueWithSource(i,r,o)};return this.on("option:"+t,r=>{let u=`error: option '${e.flags}' argument '${r}' is invalid.`;n(r,u,"cli")}),e.envVar&&this.on("optionEnv:"+t,r=>{let u=`error: option '${e.flags}' value '${r}' from env '${e.envVar}' is invalid.`;n(r,u,"env")}),this}_optionEx(e,t,i,n,r){if(typeof t=="object"&&t instanceof yt)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let u=this.createOption(t,i);if(u.makeOptionMandatory(!!e.mandatory),typeof n=="function")u.default(r).argParser(n);else if(n instanceof RegExp){let o=n;n=(a,c)=>{let D=o.exec(a);return D?D[0]:c},u.default(r).argParser(n)}else u.default(n);return this.addOption(u)}option(e,t,i,n){return this._optionEx({},e,t,i,n)}requiredOption(e,t,i,n){return this._optionEx({mandatory:!0},e,t,i,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,i){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=i,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(i=>{i.getOptionValueSource(e)!==void 0&&(t=i.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){d.versions?.electron&&(t.from="electron");let n=d.execArgv??[];(n.includes("-e")||n.includes("--eval")||n.includes("-p")||n.includes("--print"))&&(t.from="eval")}e===void 0&&(e=d.argv),this.rawArgs=e.slice();let i;switch(t.from){case void 0:case"node":this._scriptPath=e[1],i=e.slice(2);break;case"electron":d.defaultApp?(this._scriptPath=e[1],i=e.slice(2)):i=e.slice(1);break;case"user":i=e.slice(0);break;case"eval":i=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",i}parse(e,t){this._prepareForParse();let i=this._prepareUserArgs(e,t);return this._parseCommand([],i),this}async parseAsync(e,t){this._prepareForParse();let i=this._prepareUserArgs(e,t);return await this._parseCommand([],i),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
|
|
18
|
+
- either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,t,i){if(X.existsSync(e))return;let n=t?`searched for local subcommand relative to directory '${t}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",r=`'${e}' does not exist
|
|
19
19
|
- if '${i}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
20
20
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
21
|
-
- ${
|
|
21
|
+
- ${n}`;throw new Error(r)}_executeSubCommand(e,t){t=t.slice();let i=!1,n=[".js",".ts",".tsx",".mjs",".cjs"];function r(D,l){let p=T.resolve(D,l);if(X.existsSync(p))return p;if(n.includes(T.extname(l)))return;let F=n.find(w=>X.existsSync(`${p}${w}`));if(F)return`${p}${F}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let u=e._executableFile||`${this._name}-${e._name}`,o=this._executableDir||"";if(this._scriptPath){let D;try{D=X.realpathSync(this._scriptPath)}catch{D=this._scriptPath}o=T.resolve(T.dirname(D),o)}if(o){let D=r(o,u);if(!D&&!e._executableFile&&this._scriptPath){let l=T.basename(this._scriptPath,T.extname(this._scriptPath));l!==this._name&&(D=r(o,`${l}-${e._name}`))}u=D||u}i=n.includes(T.extname(u));let a;d.platform!=="win32"?i?(t.unshift(u),t=vt(d.execArgv).concat(t),a=Se.spawn(d.argv[0],t,{stdio:"inherit"})):a=Se.spawn(u,t,{stdio:"inherit"}):(this._checkForMissingExecutable(u,o,e._name),t.unshift(u),t=vt(d.execArgv).concat(t),a=Se.spawn(d.execPath,t,{stdio:"inherit"})),a.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(l=>{d.on(l,()=>{a.killed===!1&&a.exitCode===null&&a.kill(l)})});let c=this._exitCallback;a.on("close",D=>{D=D??1,c?c(new ke(D,"commander.executeSubCommandAsync","(close)")):d.exit(D)}),a.on("error",D=>{if(D.code==="ENOENT")this._checkForMissingExecutable(u,o,e._name);else if(D.code==="EACCES")throw new Error(`'${u}' not executable`);if(!c)d.exit(1);else{let l=new ke(1,"commander.executeSubCommandAsync","(error)");l.nestedError=D,c(l)}}),this.runningCommand=a}_dispatchSubcommand(e,t,i){let n=this._findCommand(e);n||this.help({error:!0}),n._prepareForParse();let r;return r=this._chainOrCallSubCommandHook(r,n,"preSubcommand"),r=this._chainOrCall(r,()=>{if(n._executableHandler)this._executeSubCommand(n,t.concat(i));else return n._parseCommand(t,i)}),r}_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=(i,n,r)=>{let u=n;if(n!==null&&i.parseArg){let o=`error: command-argument value '${n}' is invalid for argument '${i.name()}'.`;u=this._callParseArg(i,n,r,o)}return u};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((i,n)=>{let r=i.defaultValue;i.variadic?n<this.args.length?(r=this.args.slice(n),i.parseArg&&(r=r.reduce((u,o)=>e(i,o,u),i.defaultValue))):r===void 0&&(r=[]):n<this.args.length&&(r=this.args[n],i.parseArg&&(r=e(i,r,i.defaultValue))),t[n]=r}),this.processedArgs=t}_chainOrCall(e,t){return e?.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let i=e,n=[];return this._getCommandAndAncestors().reverse().filter(r=>r._lifeCycleHooks[t]!==void 0).forEach(r=>{r._lifeCycleHooks[t].forEach(u=>{n.push({hookedCommand:r,callback:u})})}),t==="postAction"&&n.reverse(),n.forEach(r=>{i=this._chainOrCall(i,()=>r.callback(r.hookedCommand,this))}),i}_chainOrCallSubCommandHook(e,t,i){let n=e;return this._lifeCycleHooks[i]!==void 0&&this._lifeCycleHooks[i].forEach(r=>{n=this._chainOrCall(n,()=>r(this,t))}),n}_parseCommand(e,t){let i=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(i.operands),t=i.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(i.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let n=()=>{i.unknown.length>0&&this.unknownOption(i.unknown[0])},r=`command:${this.name()}`;if(this._actionHandler){n(),this._processArguments();let u;return u=this._chainOrCallHooks(u,"preAction"),u=this._chainOrCall(u,()=>this._actionHandler(this.processedArgs)),this.parent&&(u=this._chainOrCall(u,()=>{this.parent.emit(r,e,t)})),u=this._chainOrCallHooks(u,"postAction"),u}if(this.parent?.listenerCount(r))n(),this._processArguments(),this.parent.emit(r,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(i=>{let n=i.attributeName();return this.getOptionValue(n)===void 0?!1:this.getOptionValueSource(n)!=="default"});e.filter(i=>i.conflictsWith.length>0).forEach(i=>{let n=e.find(r=>i.conflictsWith.includes(r.attributeName()));n&&this._conflictingOption(i,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],i=[],n=t;function r(D){return D.length>1&&D[0]==="-"}let u=D=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(D)?!this._getCommandAndAncestors().some(l=>l.options.map(p=>p.short).some(p=>/^-\d$/.test(p))):!1,o=null,a=null,c=0;for(;c<e.length||a;){let D=a??e[c++];if(a=null,D==="--"){n===i&&n.push(D),n.push(...e.slice(c));break}if(o&&(!r(D)||u(D))){this.emit(`option:${o.name()}`,D);continue}if(o=null,r(D)){let l=this._findOption(D);if(l){if(l.required){let p=e[c++];p===void 0&&this.optionMissingArgument(l),this.emit(`option:${l.name()}`,p)}else if(l.optional){let p=null;c<e.length&&(!r(e[c])||u(e[c]))&&(p=e[c++]),this.emit(`option:${l.name()}`,p)}else this.emit(`option:${l.name()}`);o=l.variadic?l:null;continue}}if(D.length>2&&D[0]==="-"&&D[1]!=="-"){let l=this._findOption(`-${D[1]}`);if(l){l.required||l.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${l.name()}`,D.slice(2)):(this.emit(`option:${l.name()}`),a=`-${D.slice(2)}`);continue}}if(/^--[^=]+=/.test(D)){let l=D.indexOf("="),p=this._findOption(D.slice(0,l));if(p&&(p.required||p.optional)){this.emit(`option:${p.name()}`,D.slice(l+1));continue}}if(n===t&&r(D)&&!(this.commands.length===0&&u(D))&&(n=i),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&i.length===0){if(this._findCommand(D)){t.push(D),i.push(...e.slice(c));break}else if(this._getHelpCommand()&&D===this._getHelpCommand().name()){t.push(D,...e.slice(c));break}else if(this._defaultCommandName){i.push(D,...e.slice(c));break}}if(this._passThroughOptions){n.push(D,...e.slice(c));break}n.push(D)}return{operands:t,unknown:i}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let i=0;i<t;i++){let n=this.options[i].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}
|
|
22
22
|
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
23
23
|
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
|
|
24
|
-
`),this.outputHelp({error:!0}));let i=t||{},
|
|
25
|
-
`),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 i=this.parent?._findCommand(e);if(i){let
|
|
26
|
-
Expecting one of '${i.join("', '")}'`);let
|
|
27
|
-
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(r=>t.is(r))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function vt(s){return s.map(e=>{if(!e.startsWith("--inspect"))return e;let t,i="127.0.0.1",r="9229",n;return(n=e.match(/^(--inspect(-brk)?)$/))!==null?t=n[1]:(n=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=n[1],/^\d+$/.test(n[3])?r=n[3]:i=n[3]):(n=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=n[1],i=n[3],r=n[4]),t&&r!=="0"?`${t}=${i}:${parseInt(r)+1}`:e})}function Ve(){if(d.env.NO_COLOR||d.env.FORCE_COLOR==="0"||d.env.FORCE_COLOR==="false")return!1;if(d.env.FORCE_COLOR||d.env.CLICOLOR_FORCE!==void 0)return!0}je.Command=Pe;je.useColor=Ve});var xt=k(_=>{var{Argument:At}=Z(),{Command:Ie}=_t(),{CommanderError:si,InvalidArgumentError:Bt}=L(),{Help:ri}=Be(),{Option:wt}=Se();_.program=new Ie;_.createCommand=s=>new Ie(s);_.createOption=(s,e)=>new wt(s,e);_.createArgument=(s,e)=>new At(s,e);_.Command=Ie;_.Option=wt;_.Argument=At;_.Help=ri;_.CommanderError=si;_.InvalidArgumentError=Bt;_.InvalidOptionArgumentError=Bt});var He=k((qs,kt)=>{"use strict";var Me="\x1B",g=`${Me}[`,ni="\x07",Ne={to(s,e){return e?`${g}${e+1};${s+1}H`:`${g}${s+1}G`},move(s,e){let t="";return s<0?t+=`${g}${-s}D`:s>0&&(t+=`${g}${s}C`),e<0?t+=`${g}${-e}A`:e>0&&(t+=`${g}${e}B`),t},up:(s=1)=>`${g}${s}A`,down:(s=1)=>`${g}${s}B`,forward:(s=1)=>`${g}${s}C`,backward:(s=1)=>`${g}${s}D`,nextLine:(s=1)=>`${g}E`.repeat(s),prevLine:(s=1)=>`${g}F`.repeat(s),left:`${g}G`,hide:`${g}?25l`,show:`${g}?25h`,save:`${Me}7`,restore:`${Me}8`},oi={up:(s=1)=>`${g}S`.repeat(s),down:(s=1)=>`${g}T`.repeat(s)},ai={screen:`${g}2J`,up:(s=1)=>`${g}1J`.repeat(s),down:(s=1)=>`${g}J`.repeat(s),line:`${g}2K`,lineEnd:`${g}K`,lineStart:`${g}1K`,lines(s){let e="";for(let t=0;t<s;t++)e+=this.line+(t<s-1?Ne.up():"");return s&&(e+=Ne.left),e}};kt.exports={cursor:Ne,scroll:oi,erase:ai,beep:ni}});var ue=k((Ls,We)=>{var te=process||{},Tt=te.argv||[],ee=te.env||{},Di=!(ee.NO_COLOR||Tt.includes("--no-color"))&&(!!ee.FORCE_COLOR||Tt.includes("--color")||te.platform==="win32"||(te.stdout||{}).isTTY&&ee.TERM!=="dumb"||!!ee.CI),li=(s,e,t=s)=>i=>{let r=""+i,n=r.indexOf(e,s.length);return~n?s+ci(r,e,t,n)+e:s+r+e},ci=(s,e,t,i)=>{let r="",n=0;do r+=s.substring(n,i)+t,n=i+e.length,i=s.indexOf(e,n);while(~i);return r+s.substring(n)},Pt=(s=Di)=>{let e=s?li:()=>String;return{isColorSupported:s,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")}};We.exports=Pt();We.exports.createColors=Pt});var ou=k((ar,nu)=>{"use strict";var tt=Object.defineProperty,zi=Object.getOwnPropertyDescriptor,Ki=Object.getOwnPropertyNames,Yi=Object.prototype.hasOwnProperty,Qi=(s,e)=>{for(var t in e)tt(s,t,{get:e[t],enumerable:!0})},Zi=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Ki(e))!Yi.call(s,r)&&r!==t&&tt(s,r,{get:()=>e[r],enumerable:!(i=zi(e,r))||i.enumerable});return s},Xi=s=>Zi(tt({},"__esModule",{value:!0}),s),ru={};Qi(ru,{default:()=>us});nu.exports=Xi(ru);var es=class{baseUrl;defaultHeaders;constructor(s,e={}){this.baseUrl=s,this.defaultHeaders=e}buildUrl(s){return`${this.baseUrl.replace(/\/$/,"")}/${s.replace(/^\//,"")}`}async request(s,e,t,i={}){let r=this.buildUrl(e),n=await fetch(r,{method:s,headers:{"Content-Type":"application/json",...this.defaultHeaders,...i},body:t?JSON.stringify(t):void 0});if(!n.ok){let o=await n.text().catch(()=>"");throw new Error(`HTTP ${n.status} ${n.statusText}: ${o||"Request failed"}`)}let u=await n.text();try{return JSON.parse(u)}catch{return u}}get(s,e){return this.request("GET",s,void 0,e)}post(s,e,t){return this.request("POST",s,e,t)}put(s,e,t){return this.request("PUT",s,e,t)}delete(s,e){return this.request("DELETE",s,void 0,e)}},z=new es("https://api.derived.dev/api/public"),ts=class{constructor(){}fetchBlock=async s=>z.get(`/v1/template-group/code/${s}`);getBlockInputFromUserQuery=(s,e)=>z.post("/v1/template-group/get-block-input-from-user-query",{blockInput:s,query:e});resolveMultipleTemplates=(s,e)=>z.post("/v1/template-group/resolve-multiple-templates-by-block-code",{blockCode:s,data:e});searchBlocksByName=s=>z.get(`/v1/template-group/semantic-search?q=${s}&limit=5&threshold=0.5`);fetchProjectBySlug=async s=>z.get(`/v1/project/detail-by-slug/${s}`)},us=ts});var Au={};ft(Au,{isDirectoryEmpty:()=>gs,removeGitDirectory:()=>Cs});function gs(s){return(0,N.existsSync)(s)?(0,N.readdirSync)(s).filter(i=>!i.startsWith(".")).length===0:!0}function Cs(s){let e=(0,_u.join)(s,".git");(0,N.existsSync)(e)&&(0,N.rmSync)(e,{recursive:!0,force:!0})}var N,_u,Bu=Ru(()=>{"use strict";N=require("fs"),_u=require("path")});var vs={};ft(vs,{displayFileTree:()=>Vu});module.exports=qu(vs);var Ot=b(xt(),1),{program:Ts,createCommand:Ps,createArgument:Vs,createOption:js,CommanderError:Is,InvalidArgumentError:Ms,InvalidOptionArgumentError:Ns,Command:St,Argument:Hs,Option:Ws,Help:Gs}=Ot.default;var ae=require("node:util");var y=b(He(),1),W=require("node:process"),P=b(require("node:readline"),1),qe=b(require("node:readline"),1),Rt=require("node:stream"),qt=b(ue(),1);function hi({onlyFirst:s=!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,s?void 0:"g")}var pi=hi();function Lt(s){if(typeof s!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof s}\``);return s.replace(pi,"")}function Ut(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Jt={exports:{}};(function(s){var e={};s.exports=e,e.eastAsianWidth=function(i){var r=i.charCodeAt(0),n=i.length==2?i.charCodeAt(1):0,u=r;return 55296<=r&&r<=56319&&56320<=n&&n<=57343&&(r&=1023,n&=1023,u=r<<10|n,u+=65536),u==12288||65281<=u&&u<=65376||65504<=u&&u<=65510?"F":u==8361||65377<=u&&u<=65470||65474<=u&&u<=65479||65482<=u&&u<=65487||65490<=u&&u<=65495||65498<=u&&u<=65500||65512<=u&&u<=65518?"H":4352<=u&&u<=4447||4515<=u&&u<=4519||4602<=u&&u<=4607||9001<=u&&u<=9002||11904<=u&&u<=11929||11931<=u&&u<=12019||12032<=u&&u<=12245||12272<=u&&u<=12283||12289<=u&&u<=12350||12353<=u&&u<=12438||12441<=u&&u<=12543||12549<=u&&u<=12589||12593<=u&&u<=12686||12688<=u&&u<=12730||12736<=u&&u<=12771||12784<=u&&u<=12830||12832<=u&&u<=12871||12880<=u&&u<=13054||13056<=u&&u<=19903||19968<=u&&u<=42124||42128<=u&&u<=42182||43360<=u&&u<=43388||44032<=u&&u<=55203||55216<=u&&u<=55238||55243<=u&&u<=55291||63744<=u&&u<=64255||65040<=u&&u<=65049||65072<=u&&u<=65106||65108<=u&&u<=65126||65128<=u&&u<=65131||110592<=u&&u<=110593||127488<=u&&u<=127490||127504<=u&&u<=127546||127552<=u&&u<=127560||127568<=u&&u<=127569||131072<=u&&u<=194367||177984<=u&&u<=196605||196608<=u&&u<=262141?"W":32<=u&&u<=126||162<=u&&u<=163||165<=u&&u<=166||u==172||u==175||10214<=u&&u<=10221||10629<=u&&u<=10630?"Na":u==161||u==164||167<=u&&u<=168||u==170||173<=u&&u<=174||176<=u&&u<=180||182<=u&&u<=186||188<=u&&u<=191||u==198||u==208||215<=u&&u<=216||222<=u&&u<=225||u==230||232<=u&&u<=234||236<=u&&u<=237||u==240||242<=u&&u<=243||247<=u&&u<=250||u==252||u==254||u==257||u==273||u==275||u==283||294<=u&&u<=295||u==299||305<=u&&u<=307||u==312||319<=u&&u<=322||u==324||328<=u&&u<=331||u==333||338<=u&&u<=339||358<=u&&u<=359||u==363||u==462||u==464||u==466||u==468||u==470||u==472||u==474||u==476||u==593||u==609||u==708||u==711||713<=u&&u<=715||u==717||u==720||728<=u&&u<=731||u==733||u==735||768<=u&&u<=879||913<=u&&u<=929||931<=u&&u<=937||945<=u&&u<=961||963<=u&&u<=969||u==1025||1040<=u&&u<=1103||u==1105||u==8208||8211<=u&&u<=8214||8216<=u&&u<=8217||8220<=u&&u<=8221||8224<=u&&u<=8226||8228<=u&&u<=8231||u==8240||8242<=u&&u<=8243||u==8245||u==8251||u==8254||u==8308||u==8319||8321<=u&&u<=8324||u==8364||u==8451||u==8453||u==8457||u==8467||u==8470||8481<=u&&u<=8482||u==8486||u==8491||8531<=u&&u<=8532||8539<=u&&u<=8542||8544<=u&&u<=8555||8560<=u&&u<=8569||u==8585||8592<=u&&u<=8601||8632<=u&&u<=8633||u==8658||u==8660||u==8679||u==8704||8706<=u&&u<=8707||8711<=u&&u<=8712||u==8715||u==8719||u==8721||u==8725||u==8730||8733<=u&&u<=8736||u==8739||u==8741||8743<=u&&u<=8748||u==8750||8756<=u&&u<=8759||8764<=u&&u<=8765||u==8776||u==8780||u==8786||8800<=u&&u<=8801||8804<=u&&u<=8807||8810<=u&&u<=8811||8814<=u&&u<=8815||8834<=u&&u<=8835||8838<=u&&u<=8839||u==8853||u==8857||u==8869||u==8895||u==8978||9312<=u&&u<=9449||9451<=u&&u<=9547||9552<=u&&u<=9587||9600<=u&&u<=9615||9618<=u&&u<=9621||9632<=u&&u<=9633||9635<=u&&u<=9641||9650<=u&&u<=9651||9654<=u&&u<=9655||9660<=u&&u<=9661||9664<=u&&u<=9665||9670<=u&&u<=9672||u==9675||9678<=u&&u<=9681||9698<=u&&u<=9701||u==9711||9733<=u&&u<=9734||u==9737||9742<=u&&u<=9743||9748<=u&&u<=9749||u==9756||u==9758||u==9792||u==9794||9824<=u&&u<=9825||9827<=u&&u<=9829||9831<=u&&u<=9834||9836<=u&&u<=9837||u==9839||9886<=u&&u<=9887||9918<=u&&u<=9919||9924<=u&&u<=9933||9935<=u&&u<=9953||u==9955||9960<=u&&u<=9983||u==10045||u==10071||10102<=u&&u<=10111||11093<=u&&u<=11097||12872<=u&&u<=12879||57344<=u&&u<=63743||65024<=u&&u<=65039||u==65533||127232<=u&&u<=127242||127248<=u&&u<=127277||127280<=u&&u<=127337||127344<=u&&u<=127386||917760<=u&&u<=917999||983040<=u&&u<=1048573||1048576<=u&&u<=1114109?"A":"N"},e.characterLength=function(i){var r=this.eastAsianWidth(i);return r=="F"||r=="W"||r=="A"?2:1};function t(i){return i.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(i){for(var r=t(i),n=0,u=0;u<r.length;u++)n=n+this.characterLength(r[u]);return n},e.slice=function(i,r,n){textLen=e.length(i),r=r||0,n=n||1,r<0&&(r=textLen+r),n<0&&(n=textLen+n);for(var u="",o=0,a=t(i),l=0;l<a.length;l++){var c=a[l],D=e.length(c);if(o>=r-(D==2?1:0))if(o+D<=n)u+=c;else break;o+=D}return u}})(Jt);var di=Jt.exports,mi=Ut(di),fi=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},gi=Ut(fi);function U(s,e={}){if(typeof s!="string"||s.length===0||(e={ambiguousIsNarrow:!0,...e},s=Lt(s),s.length===0))return 0;s=s.replace(gi()," ");let t=e.ambiguousIsNarrow?1:2,i=0;for(let r of s){let n=r.codePointAt(0);if(!(n<=31||n>=127&&n<=159||n>=768&&n<=879))switch(mi.eastAsianWidth(r)){case"F":case"W":i+=2;break;case"A":i+=t;break;default:i+=1}}return i}var Ge=10,Vt=(s=0)=>e=>`\x1B[${e+s}m`,jt=(s=0)=>e=>`\x1B[${38+s};5;${e}m`,It=(s=0)=>(e,t,i)=>`\x1B[${38+s};2;${e};${t};${i}m`,f={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(f.modifier);var Ci=Object.keys(f.color),Fi=Object.keys(f.bgColor);[...Ci,...Fi];function Ei(){let s=new Map;for(let[e,t]of Object.entries(f)){for(let[i,r]of Object.entries(t))f[i]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`},t[i]=f[i],s.set(r[0],r[1]);Object.defineProperty(f,e,{value:t,enumerable:!1})}return Object.defineProperty(f,"codes",{value:s,enumerable:!1}),f.color.close="\x1B[39m",f.bgColor.close="\x1B[49m",f.color.ansi=Vt(),f.color.ansi256=jt(),f.color.ansi16m=It(),f.bgColor.ansi=Vt(Ge),f.bgColor.ansi256=jt(Ge),f.bgColor.ansi16m=It(Ge),Object.defineProperties(f,{rgbToAnsi256:{value:(e,t,i)=>e===t&&t===i?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(i/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[i]=t;i.length===3&&(i=[...i].map(n=>n+n).join(""));let r=Number.parseInt(i,16);return[r>>16&255,r>>8&255,r&255]},enumerable:!1},hexToAnsi256:{value:e=>f.rgbToAnsi256(...f.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,i,r;if(e>=232)t=((e-232)*10+8)/255,i=t,r=t;else{e-=16;let o=e%36;t=Math.floor(e/36)/5,i=Math.floor(o/6)/5,r=o%6/5}let n=Math.max(t,i,r)*2;if(n===0)return 30;let u=30+(Math.round(r)<<2|Math.round(i)<<1|Math.round(t));return n===2&&(u+=60),u},enumerable:!1},rgbToAnsi:{value:(e,t,i)=>f.ansi256ToAnsi(f.rgbToAnsi256(e,t,i)),enumerable:!1},hexToAnsi:{value:e=>f.ansi256ToAnsi(f.hexToAnsi256(e)),enumerable:!1}}),f}var bi=Ei(),oe=new Set(["\x1B","\x9B"]),yi=39,Ue="\x07",zt="[",$i="]",Kt="m",Je=`${$i}8;;`,Mt=s=>`${oe.values().next().value}${zt}${s}${Kt}`,Nt=s=>`${oe.values().next().value}${Je}${s}${Ue}`,vi=s=>s.split(" ").map(e=>U(e)),Re=(s,e,t)=>{let i=[...e],r=!1,n=!1,u=U(Lt(s[s.length-1]));for(let[o,a]of i.entries()){let l=U(a);if(u+l<=t?s[s.length-1]+=a:(s.push(a),u=0),oe.has(a)&&(r=!0,n=i.slice(o+1).join("").startsWith(Je)),r){n?a===Ue&&(r=!1,n=!1):a===Kt&&(r=!1);continue}u+=l,u===t&&o<i.length-1&&(s.push(""),u=0)}!u&&s[s.length-1].length>0&&s.length>1&&(s[s.length-2]+=s.pop())},_i=s=>{let e=s.split(" "),t=e.length;for(;t>0&&!(U(e[t-1])>0);)t--;return t===e.length?s:e.slice(0,t).join(" ")+e.slice(t).join("")},Ai=(s,e,t={})=>{if(t.trim!==!1&&s.trim()==="")return"";let i="",r,n,u=vi(s),o=[""];for(let[l,c]of s.split(" ").entries()){t.trim!==!1&&(o[o.length-1]=o[o.length-1].trimStart());let D=U(o[o.length-1]);if(l!==0&&(D>=e&&(t.wordWrap===!1||t.trim===!1)&&(o.push(""),D=0),(D>0||t.trim===!1)&&(o[o.length-1]+=" ",D++)),t.hard&&u[l]>e){let p=e-D,F=1+Math.floor((u[l]-p-1)/e);Math.floor((u[l]-1)/e)<F&&o.push(""),Re(o,c,e);continue}if(D+u[l]>e&&D>0&&u[l]>0){if(t.wordWrap===!1&&D<e){Re(o,c,e);continue}o.push("")}if(D+u[l]>e&&t.wordWrap===!1){Re(o,c,e);continue}o[o.length-1]+=c}t.trim!==!1&&(o=o.map(l=>_i(l)));let a=[...o.join(`
|
|
28
|
-
`)];for(let[
|
|
29
|
-
`?(
|
|
30
|
-
`&&(
|
|
24
|
+
`),this.outputHelp({error:!0}));let i=t||{},n=i.exitCode||1,r=i.code||"commander.error";this._exit(n,r,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in d.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()}`,d.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new ii(this.options),t=i=>this.getOptionValue(i)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(i));this.options.filter(i=>i.implied!==void 0&&t(i.attributeName())&&e.valueFromOption(this.getOptionValue(i.attributeName()),i)).forEach(i=>{Object.keys(i.implied).filter(n=>!t(n)).forEach(n=>{this.setOptionValueWithSource(n,i.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 i=u=>{let o=u.attributeName(),a=this.getOptionValue(o),c=this.options.find(l=>l.negate&&o===l.attributeName()),D=this.options.find(l=>!l.negate&&o===l.attributeName());return c&&(c.presetArg===void 0&&a===!1||c.presetArg!==void 0&&a===c.presetArg)?c:D||u},n=u=>{let o=i(u),a=o.attributeName();return this.getOptionValueSource(a)==="env"?`environment variable '${o.envVar}'`:`option '${o.flags}'`},r=`error: ${n(e)} cannot be used with ${n(t)}`;this.error(r,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let n=[],r=this;do{let u=r.createHelp().visibleOptions(r).filter(o=>o.long).map(o=>o.long);n=n.concat(u),r=r.parent}while(r&&!r._enablePositionalOptions);t=$t(e,n)}let i=`error: unknown option '${e}'${t}`;this.error(i,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,i=t===1?"":"s",r=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${i} but got ${e.length}.`;this.error(r,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach(r=>{n.push(r.name()),r.alias()&&n.push(r.alias())}),t=$t(e,n)}let i=`error: unknown command '${e}'${t}`;this.error(i,{code:"commander.unknownCommand"})}version(e,t,i){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",i=i||"output the version number";let n=this.createOption(t,i);return this._versionOptionName=n.attributeName(),this._registerOption(n),this.on("option:"+n.name(),()=>{this._outputConfiguration.writeOut(`${e}
|
|
25
|
+
`),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 i=this.parent?._findCommand(e);if(i){let n=[i.name()].concat(i.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(i=>ei(i));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)}helpGroup(e){return e===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=T.basename(e,T.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp(),i=this._getOutputContext(e);t.prepareContext({error:i.error,helpWidth:i.helpWidth,outputHasColors:i.hasColors});let n=t.formatHelp(this,t);return i.hasColors?n:this._outputConfiguration.stripColor(n)}_getOutputContext(e){e=e||{};let t=!!e.error,i,n,r;return t?(i=o=>this._outputConfiguration.writeErr(o),n=this._outputConfiguration.getErrHasColors(),r=this._outputConfiguration.getErrHelpWidth()):(i=o=>this._outputConfiguration.writeOut(o),n=this._outputConfiguration.getOutHasColors(),r=this._outputConfiguration.getOutHelpWidth()),{error:t,write:o=>(n||(o=this._outputConfiguration.stripColor(o)),i(o)),hasColors:n,helpWidth:r}}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let i=this._getOutputContext(e),n={error:i.error,write:i.write,command:this};this._getCommandAndAncestors().reverse().forEach(u=>u.emit("beforeAllHelp",n)),this.emit("beforeHelp",n);let r=this.helpInformation({error:i.error});if(t&&(r=t(r),typeof r!="string"&&!Buffer.isBuffer(r)))throw new Error("outputHelp callback must return a string or a Buffer");i.write(r),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",n),this._getCommandAndAncestors().forEach(u=>u.emit("afterAllHelp",n))}helpOption(e,t){return typeof e=="boolean"?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??"-h, --help",t??"display help for command"),(e||t)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let t=Number(d.exitCode??0);t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let i=["beforeAll","before","after","afterAll"];if(!i.includes(e))throw new Error(`Unexpected value for position to addHelpText.
|
|
26
|
+
Expecting one of '${i.join("', '")}'`);let n=`${e}Help`;return this.on(n,r=>{let u;typeof t=="function"?u=t({error:r.error,command:r.command}):u=t,u&&r.write(`${u}
|
|
27
|
+
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(n=>t.is(n))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function vt(s){return s.map(e=>{if(!e.startsWith("--inspect"))return e;let t,i="127.0.0.1",n="9229",r;return(r=e.match(/^(--inspect(-brk)?)$/))!==null?t=r[1]:(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=r[1],/^\d+$/.test(r[3])?n=r[3]:i=r[3]):(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=r[1],i=r[3],n=r[4]),t&&n!=="0"?`${t}=${i}:${parseInt(n)+1}`:e})}function Pe(){if(d.env.NO_COLOR||d.env.FORCE_COLOR==="0"||d.env.FORCE_COLOR==="false")return!1;if(d.env.FORCE_COLOR||d.env.CLICOLOR_FORCE!==void 0)return!0}Ve.Command=Te;Ve.useColor=Pe});var xt=k(_=>{var{Argument:At}=Z(),{Command:je}=_t(),{CommanderError:si,InvalidArgumentError:Bt}=L(),{Help:ni}=Ae(),{Option:wt}=Oe();_.program=new je;_.createCommand=s=>new je(s);_.createOption=(s,e)=>new wt(s,e);_.createArgument=(s,e)=>new At(s,e);_.Command=je;_.Option=wt;_.Argument=At;_.Help=ni;_.CommanderError=si;_.InvalidArgumentError=Bt;_.InvalidOptionArgumentError=Bt});var Ne=k((qs,kt)=>{"use strict";var Ie="\x1B",g=`${Ie}[`,ri="\x07",Me={to(s,e){return e?`${g}${e+1};${s+1}H`:`${g}${s+1}G`},move(s,e){let t="";return s<0?t+=`${g}${-s}D`:s>0&&(t+=`${g}${s}C`),e<0?t+=`${g}${-e}A`:e>0&&(t+=`${g}${e}B`),t},up:(s=1)=>`${g}${s}A`,down:(s=1)=>`${g}${s}B`,forward:(s=1)=>`${g}${s}C`,backward:(s=1)=>`${g}${s}D`,nextLine:(s=1)=>`${g}E`.repeat(s),prevLine:(s=1)=>`${g}F`.repeat(s),left:`${g}G`,hide:`${g}?25l`,show:`${g}?25h`,save:`${Ie}7`,restore:`${Ie}8`},oi={up:(s=1)=>`${g}S`.repeat(s),down:(s=1)=>`${g}T`.repeat(s)},ai={screen:`${g}2J`,up:(s=1)=>`${g}1J`.repeat(s),down:(s=1)=>`${g}J`.repeat(s),line:`${g}2K`,lineEnd:`${g}K`,lineStart:`${g}1K`,lines(s){let e="";for(let t=0;t<s;t++)e+=this.line+(t<s-1?Me.up():"");return s&&(e+=Me.left),e}};kt.exports={cursor:Me,scroll:oi,erase:ai,beep:ri}});var ue=k((Ls,He)=>{var te=process||{},Tt=te.argv||[],ee=te.env||{},Di=!(ee.NO_COLOR||Tt.includes("--no-color"))&&(!!ee.FORCE_COLOR||Tt.includes("--color")||te.platform==="win32"||(te.stdout||{}).isTTY&&ee.TERM!=="dumb"||!!ee.CI),li=(s,e,t=s)=>i=>{let n=""+i,r=n.indexOf(e,s.length);return~r?s+ci(n,e,t,r)+e:s+n+e},ci=(s,e,t,i)=>{let n="",r=0;do n+=s.substring(r,i)+t,r=i+e.length,i=s.indexOf(e,r);while(~i);return n+s.substring(r)},Pt=(s=Di)=>{let e=s?li:()=>String;return{isColorSupported:s,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")}};He.exports=Pt();He.exports.createColors=Pt});var ou=k((Dn,ru)=>{"use strict";var et=Object.defineProperty,zi=Object.getOwnPropertyDescriptor,Ki=Object.getOwnPropertyNames,Yi=Object.prototype.hasOwnProperty,Qi=(s,e)=>{for(var t in e)et(s,t,{get:e[t],enumerable:!0})},Zi=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Ki(e))!Yi.call(s,n)&&n!==t&&et(s,n,{get:()=>e[n],enumerable:!(i=zi(e,n))||i.enumerable});return s},Xi=s=>Zi(et({},"__esModule",{value:!0}),s),nu={};Qi(nu,{default:()=>us});ru.exports=Xi(nu);var es=class{baseUrl;defaultHeaders;constructor(s,e={}){this.baseUrl=s,this.defaultHeaders=e}buildUrl(s){return`${this.baseUrl.replace(/\/$/,"")}/${s.replace(/^\//,"")}`}async request(s,e,t,i={}){let n=this.buildUrl(e),r=await fetch(n,{method:s,headers:{"Content-Type":"application/json",...this.defaultHeaders,...i},body:t?JSON.stringify(t):void 0});if(!r.ok){let o=await r.text().catch(()=>"");throw new Error(`HTTP ${r.status} ${r.statusText}: ${o||"Request failed"}`)}let u=await r.text();try{return JSON.parse(u)}catch{return u}}get(s,e){return this.request("GET",s,void 0,e)}post(s,e,t){return this.request("POST",s,e,t)}put(s,e,t){return this.request("PUT",s,e,t)}delete(s,e){return this.request("DELETE",s,void 0,e)}},z=new es("https://api.derived.dev/api/public"),ts=class{constructor(){}fetchBlock=async s=>z.get(`/v1/template-group/code/${s}`);getBlockInputFromUserQuery=(s,e)=>z.post("/v1/template-group/get-block-input-from-user-query",{blockInput:s,query:e});resolveMultipleTemplates=(s,e)=>z.post("/v1/template-group/resolve-multiple-templates-by-block-code",{blockCode:s,data:e});searchBlocksByName=s=>z.get(`/v1/template-group/semantic-search?q=${s}&limit=5&threshold=0.5`);fetchProjectBySlug=async s=>z.get(`/v1/project/detail-by-slug/${s}`)},us=ts});var Au={};ft(Au,{isDirectoryEmpty:()=>gs,removeGitDirectory:()=>Cs});function gs(s){return(0,H.existsSync)(s)?(0,H.readdirSync)(s).filter(i=>!i.startsWith(".")).length===0:!0}function Cs(s){let e=(0,_u.join)(s,".git");(0,H.existsSync)(e)&&(0,H.rmSync)(e,{recursive:!0,force:!0})}var H,_u,Bu=Ru(()=>{"use strict";H=require("fs"),_u=require("path")});var vs={};ft(vs,{displayFileTree:()=>Vu});module.exports=qu(vs);var Ot=b(xt(),1),{program:Ts,createCommand:Ps,createArgument:Vs,createOption:js,CommanderError:Is,InvalidArgumentError:Ms,InvalidOptionArgumentError:Ns,Command:St,Argument:Hs,Option:Ws,Help:Gs}=Ot.default;var ae=require("node:util");var y=b(Ne(),1),G=require("node:process"),P=b(require("node:readline"),1),Re=b(require("node:readline"),1),Rt=require("node:stream"),qt=b(ue(),1);function hi({onlyFirst:s=!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,s?void 0:"g")}var pi=hi();function Lt(s){if(typeof s!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof s}\``);return s.replace(pi,"")}function Ut(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Jt={exports:{}};(function(s){var e={};s.exports=e,e.eastAsianWidth=function(i){var n=i.charCodeAt(0),r=i.length==2?i.charCodeAt(1):0,u=n;return 55296<=n&&n<=56319&&56320<=r&&r<=57343&&(n&=1023,r&=1023,u=n<<10|r,u+=65536),u==12288||65281<=u&&u<=65376||65504<=u&&u<=65510?"F":u==8361||65377<=u&&u<=65470||65474<=u&&u<=65479||65482<=u&&u<=65487||65490<=u&&u<=65495||65498<=u&&u<=65500||65512<=u&&u<=65518?"H":4352<=u&&u<=4447||4515<=u&&u<=4519||4602<=u&&u<=4607||9001<=u&&u<=9002||11904<=u&&u<=11929||11931<=u&&u<=12019||12032<=u&&u<=12245||12272<=u&&u<=12283||12289<=u&&u<=12350||12353<=u&&u<=12438||12441<=u&&u<=12543||12549<=u&&u<=12589||12593<=u&&u<=12686||12688<=u&&u<=12730||12736<=u&&u<=12771||12784<=u&&u<=12830||12832<=u&&u<=12871||12880<=u&&u<=13054||13056<=u&&u<=19903||19968<=u&&u<=42124||42128<=u&&u<=42182||43360<=u&&u<=43388||44032<=u&&u<=55203||55216<=u&&u<=55238||55243<=u&&u<=55291||63744<=u&&u<=64255||65040<=u&&u<=65049||65072<=u&&u<=65106||65108<=u&&u<=65126||65128<=u&&u<=65131||110592<=u&&u<=110593||127488<=u&&u<=127490||127504<=u&&u<=127546||127552<=u&&u<=127560||127568<=u&&u<=127569||131072<=u&&u<=194367||177984<=u&&u<=196605||196608<=u&&u<=262141?"W":32<=u&&u<=126||162<=u&&u<=163||165<=u&&u<=166||u==172||u==175||10214<=u&&u<=10221||10629<=u&&u<=10630?"Na":u==161||u==164||167<=u&&u<=168||u==170||173<=u&&u<=174||176<=u&&u<=180||182<=u&&u<=186||188<=u&&u<=191||u==198||u==208||215<=u&&u<=216||222<=u&&u<=225||u==230||232<=u&&u<=234||236<=u&&u<=237||u==240||242<=u&&u<=243||247<=u&&u<=250||u==252||u==254||u==257||u==273||u==275||u==283||294<=u&&u<=295||u==299||305<=u&&u<=307||u==312||319<=u&&u<=322||u==324||328<=u&&u<=331||u==333||338<=u&&u<=339||358<=u&&u<=359||u==363||u==462||u==464||u==466||u==468||u==470||u==472||u==474||u==476||u==593||u==609||u==708||u==711||713<=u&&u<=715||u==717||u==720||728<=u&&u<=731||u==733||u==735||768<=u&&u<=879||913<=u&&u<=929||931<=u&&u<=937||945<=u&&u<=961||963<=u&&u<=969||u==1025||1040<=u&&u<=1103||u==1105||u==8208||8211<=u&&u<=8214||8216<=u&&u<=8217||8220<=u&&u<=8221||8224<=u&&u<=8226||8228<=u&&u<=8231||u==8240||8242<=u&&u<=8243||u==8245||u==8251||u==8254||u==8308||u==8319||8321<=u&&u<=8324||u==8364||u==8451||u==8453||u==8457||u==8467||u==8470||8481<=u&&u<=8482||u==8486||u==8491||8531<=u&&u<=8532||8539<=u&&u<=8542||8544<=u&&u<=8555||8560<=u&&u<=8569||u==8585||8592<=u&&u<=8601||8632<=u&&u<=8633||u==8658||u==8660||u==8679||u==8704||8706<=u&&u<=8707||8711<=u&&u<=8712||u==8715||u==8719||u==8721||u==8725||u==8730||8733<=u&&u<=8736||u==8739||u==8741||8743<=u&&u<=8748||u==8750||8756<=u&&u<=8759||8764<=u&&u<=8765||u==8776||u==8780||u==8786||8800<=u&&u<=8801||8804<=u&&u<=8807||8810<=u&&u<=8811||8814<=u&&u<=8815||8834<=u&&u<=8835||8838<=u&&u<=8839||u==8853||u==8857||u==8869||u==8895||u==8978||9312<=u&&u<=9449||9451<=u&&u<=9547||9552<=u&&u<=9587||9600<=u&&u<=9615||9618<=u&&u<=9621||9632<=u&&u<=9633||9635<=u&&u<=9641||9650<=u&&u<=9651||9654<=u&&u<=9655||9660<=u&&u<=9661||9664<=u&&u<=9665||9670<=u&&u<=9672||u==9675||9678<=u&&u<=9681||9698<=u&&u<=9701||u==9711||9733<=u&&u<=9734||u==9737||9742<=u&&u<=9743||9748<=u&&u<=9749||u==9756||u==9758||u==9792||u==9794||9824<=u&&u<=9825||9827<=u&&u<=9829||9831<=u&&u<=9834||9836<=u&&u<=9837||u==9839||9886<=u&&u<=9887||9918<=u&&u<=9919||9924<=u&&u<=9933||9935<=u&&u<=9953||u==9955||9960<=u&&u<=9983||u==10045||u==10071||10102<=u&&u<=10111||11093<=u&&u<=11097||12872<=u&&u<=12879||57344<=u&&u<=63743||65024<=u&&u<=65039||u==65533||127232<=u&&u<=127242||127248<=u&&u<=127277||127280<=u&&u<=127337||127344<=u&&u<=127386||917760<=u&&u<=917999||983040<=u&&u<=1048573||1048576<=u&&u<=1114109?"A":"N"},e.characterLength=function(i){var n=this.eastAsianWidth(i);return n=="F"||n=="W"||n=="A"?2:1};function t(i){return i.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(i){for(var n=t(i),r=0,u=0;u<n.length;u++)r=r+this.characterLength(n[u]);return r},e.slice=function(i,n,r){textLen=e.length(i),n=n||0,r=r||1,n<0&&(n=textLen+n),r<0&&(r=textLen+r);for(var u="",o=0,a=t(i),c=0;c<a.length;c++){var D=a[c],l=e.length(D);if(o>=n-(l==2?1:0))if(o+l<=r)u+=D;else break;o+=l}return u}})(Jt);var di=Jt.exports,mi=Ut(di),fi=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},gi=Ut(fi);function U(s,e={}){if(typeof s!="string"||s.length===0||(e={ambiguousIsNarrow:!0,...e},s=Lt(s),s.length===0))return 0;s=s.replace(gi()," ");let t=e.ambiguousIsNarrow?1:2,i=0;for(let n of s){let r=n.codePointAt(0);if(!(r<=31||r>=127&&r<=159||r>=768&&r<=879))switch(mi.eastAsianWidth(n)){case"F":case"W":i+=2;break;case"A":i+=t;break;default:i+=1}}return i}var We=10,Vt=(s=0)=>e=>`\x1B[${e+s}m`,jt=(s=0)=>e=>`\x1B[${38+s};5;${e}m`,It=(s=0)=>(e,t,i)=>`\x1B[${38+s};2;${e};${t};${i}m`,f={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(f.modifier);var Ci=Object.keys(f.color),Fi=Object.keys(f.bgColor);[...Ci,...Fi];function Ei(){let s=new Map;for(let[e,t]of Object.entries(f)){for(let[i,n]of Object.entries(t))f[i]={open:`\x1B[${n[0]}m`,close:`\x1B[${n[1]}m`},t[i]=f[i],s.set(n[0],n[1]);Object.defineProperty(f,e,{value:t,enumerable:!1})}return Object.defineProperty(f,"codes",{value:s,enumerable:!1}),f.color.close="\x1B[39m",f.bgColor.close="\x1B[49m",f.color.ansi=Vt(),f.color.ansi256=jt(),f.color.ansi16m=It(),f.bgColor.ansi=Vt(We),f.bgColor.ansi256=jt(We),f.bgColor.ansi16m=It(We),Object.defineProperties(f,{rgbToAnsi256:{value:(e,t,i)=>e===t&&t===i?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(i/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[i]=t;i.length===3&&(i=[...i].map(r=>r+r).join(""));let n=Number.parseInt(i,16);return[n>>16&255,n>>8&255,n&255]},enumerable:!1},hexToAnsi256:{value:e=>f.rgbToAnsi256(...f.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,i,n;if(e>=232)t=((e-232)*10+8)/255,i=t,n=t;else{e-=16;let o=e%36;t=Math.floor(e/36)/5,i=Math.floor(o/6)/5,n=o%6/5}let r=Math.max(t,i,n)*2;if(r===0)return 30;let u=30+(Math.round(n)<<2|Math.round(i)<<1|Math.round(t));return r===2&&(u+=60),u},enumerable:!1},rgbToAnsi:{value:(e,t,i)=>f.ansi256ToAnsi(f.rgbToAnsi256(e,t,i)),enumerable:!1},hexToAnsi:{value:e=>f.ansi256ToAnsi(f.hexToAnsi256(e)),enumerable:!1}}),f}var bi=Ei(),oe=new Set(["\x1B","\x9B"]),yi=39,Le="\x07",zt="[",$i="]",Kt="m",Ue=`${$i}8;;`,Mt=s=>`${oe.values().next().value}${zt}${s}${Kt}`,Nt=s=>`${oe.values().next().value}${Ue}${s}${Le}`,vi=s=>s.split(" ").map(e=>U(e)),Ge=(s,e,t)=>{let i=[...e],n=!1,r=!1,u=U(Lt(s[s.length-1]));for(let[o,a]of i.entries()){let c=U(a);if(u+c<=t?s[s.length-1]+=a:(s.push(a),u=0),oe.has(a)&&(n=!0,r=i.slice(o+1).join("").startsWith(Ue)),n){r?a===Le&&(n=!1,r=!1):a===Kt&&(n=!1);continue}u+=c,u===t&&o<i.length-1&&(s.push(""),u=0)}!u&&s[s.length-1].length>0&&s.length>1&&(s[s.length-2]+=s.pop())},_i=s=>{let e=s.split(" "),t=e.length;for(;t>0&&!(U(e[t-1])>0);)t--;return t===e.length?s:e.slice(0,t).join(" ")+e.slice(t).join("")},Ai=(s,e,t={})=>{if(t.trim!==!1&&s.trim()==="")return"";let i="",n,r,u=vi(s),o=[""];for(let[c,D]of s.split(" ").entries()){t.trim!==!1&&(o[o.length-1]=o[o.length-1].trimStart());let l=U(o[o.length-1]);if(c!==0&&(l>=e&&(t.wordWrap===!1||t.trim===!1)&&(o.push(""),l=0),(l>0||t.trim===!1)&&(o[o.length-1]+=" ",l++)),t.hard&&u[c]>e){let p=e-l,F=1+Math.floor((u[c]-p-1)/e);Math.floor((u[c]-1)/e)<F&&o.push(""),Ge(o,D,e);continue}if(l+u[c]>e&&l>0&&u[c]>0){if(t.wordWrap===!1&&l<e){Ge(o,D,e);continue}o.push("")}if(l+u[c]>e&&t.wordWrap===!1){Ge(o,D,e);continue}o[o.length-1]+=D}t.trim!==!1&&(o=o.map(c=>_i(c)));let a=[...o.join(`
|
|
28
|
+
`)];for(let[c,D]of a.entries()){if(i+=D,oe.has(D)){let{groups:p}=new RegExp(`(?:\\${zt}(?<code>\\d+)m|\\${Ue}(?<uri>.*)${Le})`).exec(a.slice(c).join(""))||{groups:{}};if(p.code!==void 0){let F=Number.parseFloat(p.code);n=F===yi?void 0:F}else p.uri!==void 0&&(r=p.uri.length===0?void 0:p.uri)}let l=bi.codes.get(Number(n));a[c+1]===`
|
|
29
|
+
`?(r&&(i+=Nt("")),n&&l&&(i+=Mt(l))):D===`
|
|
30
|
+
`&&(n&&l&&(i+=Mt(n)),r&&(i+=Nt(r)))}return i};function Ht(s,e,t){return String(s).normalize().replace(/\r\n/g,`
|
|
31
31
|
`).split(`
|
|
32
32
|
`).map(i=>Ai(i,e,t)).join(`
|
|
33
|
-
`)}var Bi=["up","down","left","right","space","enter","cancel"],se={actions:new Set(Bi),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]])};function
|
|
33
|
+
`)}var Bi=["up","down","left","right","space","enter","cancel"],se={actions:new Set(Bi),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]])};function Je(s,e){if(typeof s=="string")return se.aliases.get(s)===e;for(let t of s)if(t!==void 0&&Je(t,e))return!0;return!1}function wi(s,e){if(s===e)return;let t=s.split(`
|
|
34
34
|
`),i=e.split(`
|
|
35
|
-
`),
|
|
35
|
+
`),n=[];for(let r=0;r<Math.max(t.length,i.length);r++)t[r]!==i[r]&&n.push(r);return n}var xi=globalThis.process.platform.startsWith("win"),qe=Symbol("clack:cancel");function R(s){return s===qe}function ie(s,e){let t=s;t.isTTY&&t.setRawMode(e)}function Yt({input:s=G.stdin,output:e=G.stdout,overwrite:t=!0,hideCursor:i=!0}={}){let n=P.createInterface({input:s,output:e,prompt:"",tabSize:1});P.emitKeypressEvents(s,n),s.isTTY&&s.setRawMode(!0);let r=(u,{name:o,sequence:a})=>{let c=String(u);if(Je([c,o,a],"cancel")){i&&e.write(y.cursor.show),process.exit(0);return}if(!t)return;P.moveCursor(e,o==="return"?0:-1,o==="return"?-1:0,()=>{P.clearLine(e,1,()=>{s.once("keypress",r)})})};return i&&e.write(y.cursor.hide),s.once("keypress",r),()=>{s.off("keypress",r),i&&e.write(y.cursor.show),s.isTTY&&!xi&&s.setRawMode(!1),n.terminal=!1,n.close()}}var Oi=Object.defineProperty,Si=(s,e,t)=>e in s?Oi(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,$=(s,e,t)=>(Si(s,typeof e!="symbol"?e+"":e,t),t),J=class{constructor(e,t=!0){$(this,"input"),$(this,"output"),$(this,"_abortSignal"),$(this,"rl"),$(this,"opts"),$(this,"_render"),$(this,"_track",!1),$(this,"_prevFrame",""),$(this,"_subscribers",new Map),$(this,"_cursor",0),$(this,"state","initial"),$(this,"error",""),$(this,"value");let{input:i=G.stdin,output:n=G.stdout,render:r,signal:u,...o}=e;this.opts=o,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=r.bind(this),this._track=t,this._abortSignal=u,this.input=i,this.output=n}unsubscribe(){this._subscribers.clear()}setSubscriber(e,t){let i=this._subscribers.get(e)??[];i.push(t),this._subscribers.set(e,i)}on(e,t){this.setSubscriber(e,{cb:t})}once(e,t){this.setSubscriber(e,{cb:t,once:!0})}emit(e,...t){let i=this._subscribers.get(e)??[],n=[];for(let r of i)r.cb(...t),r.once&&n.push(()=>i.splice(i.indexOf(r),1));for(let r of n)r()}prompt(){return new Promise((e,t)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),e(qe);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let i=new Rt.Writable;i._write=(n,r,u)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),u()},this.input.pipe(i),this.rl=Re.default.createInterface({input:this.input,output:i,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),Re.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),ie(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(y.cursor.show),this.output.off("resize",this.render),ie(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(y.cursor.show),this.output.off("resize",this.render),ie(this.input,!1),e(qe)})})}onKeypress(e,t){if(this.state==="error"&&(this.state="active"),t?.name&&(!this._track&&se.aliases.has(t.name)&&this.emit("cursor",se.aliases.get(t.name)),se.actions.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 i=this.opts.validate(this.value);i&&(this.error=i instanceof Error?i.message:i,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}Je([e,t?.name,t?.sequence],"cancel")&&(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(`
|
|
36
36
|
`),ie(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=Ht(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
|
|
37
|
-
`).length-1;this.output.write(y.cursor.move(-999,e*-1))}render(){let e=Ht(this._render(this)??"",process.stdout.columns,{hard:!0});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(y.cursor.hide);else{let t=wi(this._prevFrame,e);if(this.restoreCursor(),t&&t?.length===1){let i=t[0];this.output.write(y.cursor.move(0,i)),this.output.write(y.erase.lines(1));let
|
|
38
|
-
`);this.output.write(
|
|
39
|
-
`).slice(i);this.output.write(
|
|
40
|
-
`)),this._prevFrame=e;return}this.output.write(y.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}};var ki;ki=new WeakMap;var Ti=Object.defineProperty,Pi=(s,e,t)=>e in s?Ti(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,Wt=(s,e,t)=>(Pi(s,typeof e!="symbol"?e+"":e,t),t),Qt=class extends J{constructor(s){super(s,!1),Wt(this,"options"),Wt(this,"cursor",0),this.options=s.options,this.value=[...s.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:e})=>e===s.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 s=this.value.length===this.options.length;this.value=s?[]:this.options.map(e=>e.value)}toggleValue(){let s=this.value.includes(this._value);this.value=s?this.value.filter(e=>e!==this._value):[...this.value,this._value]}};var Vi=Object.defineProperty,ji=(s,e,t)=>e in s?Vi(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,Gt=(s,e,t)=>(ji(s,typeof e!="symbol"?e+"":e,t),t),
|
|
41
|
-
${
|
|
37
|
+
`).length-1;this.output.write(y.cursor.move(-999,e*-1))}render(){let e=Ht(this._render(this)??"",process.stdout.columns,{hard:!0});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(y.cursor.hide);else{let t=wi(this._prevFrame,e);if(this.restoreCursor(),t&&t?.length===1){let i=t[0];this.output.write(y.cursor.move(0,i)),this.output.write(y.erase.lines(1));let n=e.split(`
|
|
38
|
+
`);this.output.write(n[i]),this._prevFrame=e,this.output.write(y.cursor.move(0,n.length-i-1));return}if(t&&t?.length>1){let i=t[0];this.output.write(y.cursor.move(0,i)),this.output.write(y.erase.down());let n=e.split(`
|
|
39
|
+
`).slice(i);this.output.write(n.join(`
|
|
40
|
+
`)),this._prevFrame=e;return}this.output.write(y.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}};var ki;ki=new WeakMap;var Ti=Object.defineProperty,Pi=(s,e,t)=>e in s?Ti(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,Wt=(s,e,t)=>(Pi(s,typeof e!="symbol"?e+"":e,t),t),Qt=class extends J{constructor(s){super(s,!1),Wt(this,"options"),Wt(this,"cursor",0),this.options=s.options,this.value=[...s.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:e})=>e===s.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 s=this.value.length===this.options.length;this.value=s?[]:this.options.map(e=>e.value)}toggleValue(){let s=this.value.includes(this._value);this.value=s?this.value.filter(e=>e!==this._value):[...this.value,this._value]}};var Vi=Object.defineProperty,ji=(s,e,t)=>e in s?Vi(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,Gt=(s,e,t)=>(ji(s,typeof e!="symbol"?e+"":e,t),t),ne=class extends J{constructor(e){super(e,!1),Gt(this,"options"),Gt(this,"cursor",0),this.options=e.options,this.cursor=this.options.findIndex(({value:t})=>t===e.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",t=>{switch(t){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 re=class extends J{get valueWithCursor(){if(this.state==="submit")return this.value;if(this.cursor>=this.value.length)return`${this.value}\u2588`;let e=this.value.slice(0,this.cursor),[t,...i]=this.value.slice(this.cursor);return`${e}${qt.default.inverse(t)}${i.join("")}`}get cursor(){return this._cursor}constructor(e){super(e),this.on("finalize",()=>{this.value||(this.value=e.defaultValue)})}};var A=b(require("node:process"),1),h=b(ue(),1),De=b(Ne(),1);function Ii(){return A.default.platform!=="win32"?A.default.env.TERM!=="linux":!!A.default.env.CI||!!A.default.env.WT_SESSION||!!A.default.env.TERMINUS_SUBLIME||A.default.env.ConEmuTask==="{cmd::Cmder}"||A.default.env.TERM_PROGRAM==="Terminus-Sublime"||A.default.env.TERM_PROGRAM==="vscode"||A.default.env.TERM==="xterm-256color"||A.default.env.TERM==="alacritty"||A.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var ze=Ii(),C=(s,e)=>ze?s:e,Mi=C("\u25C6","*"),eu=C("\u25A0","x"),tu=C("\u25B2","x"),Ye=C("\u25C7","o"),Ni=C("\u250C","T"),m=C("\u2502","|"),V=C("\u2514","\u2014"),Hi=C("\u25CF",">"),Wi=C("\u25CB"," "),Gi=C("\u25FB","[\u2022]"),Zt=C("\u25FC","[+]"),Ri=C("\u25FB","[ ]"),en=C("\u25AA","\u2022"),Xt=C("\u2500","-"),qi=C("\u256E","+"),Li=C("\u251C","+"),Ui=C("\u256F","+"),tn=C("\u25CF","\u2022"),un=C("\u25C6","*"),sn=C("\u25B2","!"),nn=C("\u25A0","x"),Qe=s=>{switch(s){case"initial":case"active":return h.default.cyan(Mi);case"cancel":return h.default.red(eu);case"error":return h.default.yellow(tu);case"submit":return h.default.green(Ye)}},Ke=s=>{let{cursor:e,options:t,style:i}=s,n=s.maxItems??Number.POSITIVE_INFINITY,r=Math.max(process.stdout.rows-4,0),u=Math.min(r,Math.max(n,5)),o=0;e>=o+u-3?o=Math.max(Math.min(e-u+3,t.length-u),0):e<o+2&&(o=Math.max(e-2,0));let a=u<t.length&&o>0,c=u<t.length&&o+u<t.length;return t.slice(o,o+u).map((D,l,p)=>{let F=l===0&&a,w=l===p.length-1&&c;return F||w?h.default.dim("..."):i(D,l+o===e)})},uu=s=>new re({validate:s.validate,placeholder:s.placeholder,defaultValue:s.defaultValue,initialValue:s.initialValue,render(){let e=`${h.default.gray(m)}
|
|
41
|
+
${Qe(this.state)} ${s.message}
|
|
42
42
|
`,t=s.placeholder?h.default.inverse(s.placeholder[0])+h.default.dim(s.placeholder.slice(1)):h.default.inverse(h.default.hidden("_")),i=this.value?this.valueWithCursor:t;switch(this.state){case"error":return`${e.trim()}
|
|
43
43
|
${h.default.yellow(m)} ${i}
|
|
44
44
|
${h.default.yellow(V)} ${h.default.yellow(this.error)}
|
|
45
45
|
`;case"submit":return`${e}${h.default.gray(m)} ${h.default.dim(this.value||s.placeholder)}`;case"cancel":return`${e}${h.default.gray(m)} ${h.default.strikethrough(h.default.dim(this.value??""))}${this.value?.trim()?`
|
|
46
46
|
${h.default.gray(m)}`:""}`;default:return`${e}${h.default.cyan(m)} ${i}
|
|
47
47
|
${h.default.cyan(V)}
|
|
48
|
-
`}}}).prompt();var
|
|
49
|
-
${
|
|
48
|
+
`}}}).prompt();var Ze=s=>{let e=(t,i)=>{let n=t.label??String(t.value);switch(i){case"selected":return`${h.default.dim(n)}`;case"active":return`${h.default.green(Hi)} ${n} ${t.hint?h.default.dim(`(${t.hint})`):""}`;case"cancelled":return`${h.default.strikethrough(h.default.dim(n))}`;default:return`${h.default.dim(Wi)} ${h.default.dim(n)}`}};return new ne({options:s.options,initialValue:s.initialValue,render(){let t=`${h.default.gray(m)}
|
|
49
|
+
${Qe(this.state)} ${s.message}
|
|
50
50
|
`;switch(this.state){case"submit":return`${t}${h.default.gray(m)} ${e(this.options[this.cursor],"selected")}`;case"cancel":return`${t}${h.default.gray(m)} ${e(this.options[this.cursor],"cancelled")}
|
|
51
|
-
${h.default.gray(m)}`;default:return`${t}${h.default.cyan(m)} ${
|
|
51
|
+
${h.default.gray(m)}`;default:return`${t}${h.default.cyan(m)} ${Ke({cursor:this.cursor,options:this.options,maxItems:s.maxItems,style:(i,n)=>e(i,n?"active":"inactive")}).join(`
|
|
52
52
|
${h.default.cyan(m)} `)}
|
|
53
53
|
${h.default.cyan(V)}
|
|
54
|
-
`}}}).prompt()};var iu=s=>{let e=(t,i)=>{let
|
|
54
|
+
`}}}).prompt()};var iu=s=>{let e=(t,i)=>{let n=t.label??String(t.value);return i==="active"?`${h.default.cyan(Gi)} ${n} ${t.hint?h.default.dim(`(${t.hint})`):""}`:i==="selected"?`${h.default.green(Zt)} ${h.default.dim(n)} ${t.hint?h.default.dim(`(${t.hint})`):""}`:i==="cancelled"?`${h.default.strikethrough(h.default.dim(n))}`:i==="active-selected"?`${h.default.green(Zt)} ${n} ${t.hint?h.default.dim(`(${t.hint})`):""}`:i==="submitted"?`${h.default.dim(n)}`:`${h.default.dim(Ri)} ${h.default.dim(n)}`};return new Qt({options:s.options,initialValues:s.initialValues,required:s.required??!0,cursorAt:s.cursorAt,validate(t){if(this.required&&t.length===0)return`Please select at least one option.
|
|
55
55
|
${h.default.reset(h.default.dim(`Press ${h.default.gray(h.default.bgWhite(h.default.inverse(" space ")))} to select, ${h.default.gray(h.default.bgWhite(h.default.inverse(" enter ")))} to submit`))}`},render(){let t=`${h.default.gray(m)}
|
|
56
|
-
${
|
|
57
|
-
`,i=(r
|
|
58
|
-
${h.default.gray(m)}`:""}`}case"error":{let
|
|
59
|
-
`).map((
|
|
60
|
-
`);return`${t+h.default.yellow(m)} ${
|
|
56
|
+
${Qe(this.state)} ${s.message}
|
|
57
|
+
`,i=(n,r)=>{let u=this.value.includes(n.value);return r&&u?e(n,"active-selected"):u?e(n,"selected"):e(n,r?"active":"inactive")};switch(this.state){case"submit":return`${t}${h.default.gray(m)} ${this.options.filter(({value:n})=>this.value.includes(n)).map(n=>e(n,"submitted")).join(h.default.dim(", "))||h.default.dim("none")}`;case"cancel":{let n=this.options.filter(({value:r})=>this.value.includes(r)).map(r=>e(r,"cancelled")).join(h.default.dim(", "));return`${t}${h.default.gray(m)} ${n.trim()?`${n}
|
|
58
|
+
${h.default.gray(m)}`:""}`}case"error":{let n=this.error.split(`
|
|
59
|
+
`).map((r,u)=>u===0?`${h.default.yellow(V)} ${h.default.yellow(r)}`:` ${r}`).join(`
|
|
60
|
+
`);return`${t+h.default.yellow(m)} ${Ke({options:this.options,cursor:this.cursor,maxItems:s.maxItems,style:i}).join(`
|
|
61
61
|
${h.default.yellow(m)} `)}
|
|
62
|
-
${
|
|
63
|
-
`}default:return`${t}${h.default.cyan(m)} ${
|
|
62
|
+
${n}
|
|
63
|
+
`}default:return`${t}${h.default.cyan(m)} ${Ke({options:this.options,cursor:this.cursor,maxItems:s.maxItems,style:i}).join(`
|
|
64
64
|
${h.default.cyan(m)} `)}
|
|
65
65
|
${h.default.cyan(V)}
|
|
66
|
-
`}}}).prompt()};var
|
|
66
|
+
`}}}).prompt()};var j=(s="",e="")=>{let t=`
|
|
67
67
|
${s}
|
|
68
68
|
`.split(`
|
|
69
|
-
`),i=(0,ae.stripVTControlCharacters)(e).length,
|
|
69
|
+
`),i=(0,ae.stripVTControlCharacters)(e).length,n=Math.max(t.reduce((u,o)=>{let a=(0,ae.stripVTControlCharacters)(o);return a.length>u?a.length:u},0),i)+2,r=t.map(u=>`${h.default.gray(m)} ${h.default.dim(u)}${" ".repeat(n-(0,ae.stripVTControlCharacters)(u).length)}${h.default.gray(m)}`).join(`
|
|
70
70
|
`);process.stdout.write(`${h.default.gray(m)}
|
|
71
|
-
${h.default.green(
|
|
72
|
-
${
|
|
73
|
-
${h.default.gray(Li+Xt.repeat(
|
|
71
|
+
${h.default.green(Ye)} ${h.default.reset(e)} ${h.default.gray(Xt.repeat(Math.max(n-i-1,1))+qi)}
|
|
72
|
+
${r}
|
|
73
|
+
${h.default.gray(Li+Xt.repeat(n+2)+Ui)}
|
|
74
74
|
`)},x=(s="")=>{process.stdout.write(`${h.default.gray(V)} ${h.default.red(s)}
|
|
75
75
|
|
|
76
76
|
`)},le=(s="")=>{process.stdout.write(`${h.default.gray(Ni)} ${s}
|
|
77
77
|
`)},ce=(s="")=>{process.stdout.write(`${h.default.gray(m)}
|
|
78
78
|
${h.default.gray(V)} ${s}
|
|
79
79
|
|
|
80
|
-
`)};var
|
|
80
|
+
`)};var rn=`${h.default.gray(m)} `;var I=({indicator:s="dots"}={})=>{let e=ze?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],t=ze?80:120,i=process.env.CI==="true",n,r,u=!1,o="",a,c=performance.now(),D=E=>{let v=E>1?"Something went wrong":"Canceled";u&&mt(v,E)},l=()=>D(2),p=()=>D(1),F=()=>{process.on("uncaughtExceptionMonitor",l),process.on("unhandledRejection",l),process.on("SIGINT",p),process.on("SIGTERM",p),process.on("exit",D)},w=()=>{process.removeListener("uncaughtExceptionMonitor",l),process.removeListener("unhandledRejection",l),process.removeListener("SIGINT",p),process.removeListener("SIGTERM",p),process.removeListener("exit",D)},pt=()=>{if(a===void 0)return;i&&process.stdout.write(`
|
|
81
81
|
`);let E=a.split(`
|
|
82
|
-
`);process.stdout.write(De.cursor.move(-999,E.length-1)),process.stdout.write(De.erase.down(E.length))},
|
|
83
|
-
`);let v=0,S=0;F(),
|
|
82
|
+
`);process.stdout.write(De.cursor.move(-999,E.length-1)),process.stdout.write(De.erase.down(E.length))},Fe=E=>E.replace(/\.+$/,""),dt=E=>{let v=(performance.now()-E)/1e3,S=Math.floor(v/60),W=Math.floor(v%60);return S>0?`[${S}m ${W}s]`:`[${W}s]`},ju=(E="")=>{u=!0,n=Yt(),o=Fe(E),c=performance.now(),process.stdout.write(`${h.default.gray(m)}
|
|
83
|
+
`);let v=0,S=0;F(),r=setInterval(()=>{if(i&&o===a)return;pt(),a=o;let W=h.default.magenta(e[v]);if(i)process.stdout.write(`${W} ${o}...`);else if(s==="timer")process.stdout.write(`${W} ${o} ${dt(c)}`);else{let Iu=".".repeat(Math.floor(S)).slice(0,3);process.stdout.write(`${W} ${o}${Iu}`)}v=v+1<e.length?v+1:0,S=S<e.length?S+.125:0},t)},mt=(E="",v=0)=>{u=!1,clearInterval(r),pt();let S=v===0?h.default.green(Ye):v===1?h.default.red(eu):h.default.red(tu);o=Fe(E??o),s==="timer"?process.stdout.write(`${S} ${o} ${dt(c)}
|
|
84
84
|
`):process.stdout.write(`${S} ${o}
|
|
85
|
-
`),w(),
|
|
86
|
-
`);let
|
|
87
|
-
`;if(s.children&&s.children.length>0){let a=e+(t?" ":"\u2502 ");s.children.forEach((
|
|
88
|
-
|
|
85
|
+
`),w(),n()};return{start:ju,stop:mt,message:(E="")=>{o=Fe(E??o)}}};var xu=require("child_process"),B=require("fs"),Ou=require("os"),ht=require("path");var q=b(require("fs")),Xe=b(require("path")),su=(s,e=[],t=!1)=>{let i=[],n=[],r=[];for(let u of s){let o=Xe.default.join(process.cwd(),u.resolvedPath);if(!u.isNotEnabled)try{if(q.default.mkdirSync(Xe.default.dirname(o),{recursive:!0}),u.templateType==="add"){let a=q.default.existsSync(o)&&q.default.lstatSync(o).isFile(),c=t||e.includes(u.resolvedPath);if(a&&!c){r.push(`File already exists: ${o}`);continue}else{if(u.pathError||u.templateError){r.push(`Failed to create file: ${o} because of error: ${u.templateError}`);continue}q.default.writeFileSync(o,u.resolvedTemplate),i.push(o)}}else u.templateType==="modify"&&(u.modifiedFileContent?(q.default.writeFileSync(o,u.modifiedFileContent),n.push(o)):r.push(`Failed to modify file: ${o} because of error: ${u.templateError}`))}catch(a){r.push(a instanceof Error?a.message:String(a))}}return{addResults:i,modifyResults:n,errors:r}};var Su=b(ou());var tt=b(ue());function au(s){let e={name:"root",type:"directory",children:[],path:""},t=s.map(i=>i.replace(/^\//,"").replace(/\\/g,"/")).sort();for(let i of t){let n=i.split("/").filter(Boolean),r=e;n.forEach((u,o)=>{let a=o===n.length-1,c=r.children?.find(D=>D.name===u);if(c)r=c;else{let D={name:u,type:a?"file":"directory",children:a?void 0:[],path:n.slice(0,o+1).join("/")};r.children||(r.children=[]),r.children.push(D),r=D}})}return e}function he(s,e="",t=!0,i=!0){if(i&&s.children)return s.children.map((a,c)=>he(a,"",c===s.children.length-1,!1)).join(`
|
|
86
|
+
`);let n=t?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",r=s.type==="directory"?"\u{1F4C1} ":"\u{1F4C4} ",u=s.type==="directory"?tt.default.cyan(s.name+"/"):tt.default.green(s.name),o=e+n+r+u+`
|
|
87
|
+
`;if(s.children&&s.children.length>0){let a=e+(t?" ":"\u2502 ");s.children.forEach((c,D)=>{o+=he(c,a,D===s.children.length-1,!1)})}return o}var O=require("fs"),ut=require("path"),is=".derived",ss="blocks.json";function Du(){return(0,ut.join)(process.cwd(),is)}function lu(){return(0,ut.join)(Du(),ss)}function it(s){let e=lu();if(!(0,O.existsSync)(e))return!1;try{let t=(0,O.readFileSync)(e,"utf-8"),i=JSON.parse(t);return Array.isArray(i.addedBlocks)&&i.addedBlocks.includes(s)}catch{return!1}}function cu(s){let e=Du(),t=lu();(0,O.existsSync)(e)||(0,O.mkdirSync)(e,{recursive:!0});let i=[];if((0,O.existsSync)(t))try{let n=(0,O.readFileSync)(t,"utf-8"),r=JSON.parse(n);Array.isArray(r.addedBlocks)&&(i=r.addedBlocks)}catch{}i.includes(s)||(i.push(s),(0,O.writeFileSync)(t,JSON.stringify({addedBlocks:i},null,2)))}var N=require("child_process");function pu(s){return e=>e.length>1?[s,"run",e[0],"--",...e.slice(1)]:[s,"run",e[0]]}function ns(){return s=>["deno","run",`npm:${s[0]}`,...s.slice(1)]}var rs={agent:["npm",0],run:pu("npm"),install:["npm","i",0],frozen:["npm","ci",0],global:["npm","i","-g",0],add:["npm","i",0],upgrade:["npm","update",0],"upgrade-interactive":null,execute:["npx",0],"execute-local":["npx",0],uninstall:["npm","uninstall",0],global_uninstall:["npm","uninstall","-g",0]},du={agent:["yarn",0],run:["yarn","run",0],install:["yarn","install",0],frozen:["yarn","install","--frozen-lockfile",0],global:["yarn","global","add",0],add:["yarn","add",0],upgrade:["yarn","upgrade",0],"upgrade-interactive":["yarn","upgrade-interactive",0],execute:["npx",0],"execute-local":["yarn","exec",0],uninstall:["yarn","remove",0],global_uninstall:["yarn","global","remove",0]},os={...du,frozen:["yarn","install","--immutable",0],upgrade:["yarn","up",0],"upgrade-interactive":["yarn","up","-i",0],execute:["yarn","dlx",0],"execute-local":["yarn","exec",0],global:["npm","i","-g",0],global_uninstall:["npm","uninstall","-g",0]},hu={agent:["pnpm",0],run:["pnpm","run",0],install:["pnpm","i",0],frozen:["pnpm","i","--frozen-lockfile",0],global:["pnpm","add","-g",0],add:["pnpm","add",0],upgrade:["pnpm","update",0],"upgrade-interactive":["pnpm","update","-i",0],execute:["pnpm","dlx",0],"execute-local":["pnpm","exec",0],uninstall:["pnpm","remove",0],global_uninstall:["pnpm","remove","--global",0]},as={agent:["bun",0],run:["bun","run",0],install:["bun","install",0],frozen:["bun","install","--frozen-lockfile",0],global:["bun","add","-g",0],add:["bun","add",0],upgrade:["bun","update",0],"upgrade-interactive":["bun","update",0],execute:["bun","x",0],"execute-local":["bun","x",0],uninstall:["bun","remove",0],global_uninstall:["bun","remove","-g",0]},Ds={agent:["deno",0],run:["deno","task",0],install:["deno","install",0],frozen:["deno","install","--frozen",0],global:["deno","install","-g",0],add:["deno","add",0],upgrade:["deno","outdated","--update",0],"upgrade-interactive":["deno","outdated","--update",0],execute:ns(),"execute-local":["deno","task","--eval",0],uninstall:["deno","remove",0],global_uninstall:["deno","uninstall","-g",0]},mu={npm:rs,yarn:du,"yarn@berry":os,pnpm:hu,"pnpm@6":{...hu,run:pu("pnpm")},bun:as,deno:Ds};function st(s,e,t){let i=mu[s][e];return fu(i,t)}function fu(s,e){if(s==null)return null;let t=typeof s=="function"?s(e):s.flatMap(i=>typeof i=="number"?e:[i]);return{command:t[0],args:t.slice(1)}}var gu=["npm","yarn","yarn@berry","pnpm","pnpm@6","bun","deno"],nt={"bun.lock":"bun","bun.lockb":"bun","deno.lock":"deno","pnpm-lock.yaml":"pnpm","yarn.lock":"yarn","package-lock.json":"npm","npm-shrinkwrap.json":"npm"};var me=b(require("node:fs"),1),M=b(require("node:path"),1),$u=b(require("node:process"),1);var Cu=Symbol.for("quansync.getIsAsync"),pe=class extends Error{constructor(e="Unexpected promise in sync context"){super(e),this.name="QuansyncError"}};function ot(s){return s&&typeof s=="object"&&typeof s.then=="function"}function ls(s){return s&&typeof s=="object"&&typeof s[Symbol.iterator]=="function"&&"__quansync"in s}function at(s){let e=function*(...i){return(yield Cu)?yield s.async.apply(this,i):s.sync.apply(this,i)};function t(...i){let n=e.apply(this,i);return n.then=(...r)=>s.async.apply(this,i).then(...r),n.__quansync=!0,n}return t.sync=s.sync,t.async=s.async,t}function cs(s){return at({async:()=>Promise.resolve(s),sync:()=>{if(ot(s))throw new pe;return s}})}function rt(s,e){if(s===Cu)return e;if(ls(s))return e?bu(s):Eu(s);if(!e&&ot(s))throw new pe;return s}var Fu=s=>s;function Eu(s,e=Fu){let t=s.next();for(;!t.done;)try{t=s.next(rt(e(t.value,!1)))}catch(i){t=s.throw(i)}return rt(t.value)}async function bu(s,e=Fu){let t=s.next();for(;!t.done;)try{t=s.next(await rt(e(t.value,!0),!0))}catch(i){t=s.throw(i)}return t.value}function hs(s,e){return at({name:s.name,async(...t){return bu(s.apply(this,t),e?.onYield)},sync(...t){return Eu(s.apply(this,t),e?.onYield)}})}function Dt(s,e){return ot(s)?cs(s):typeof s=="function"?hs(s,e):at(s)}var fn=Dt({async:()=>Promise.resolve(!0),sync:()=>!1});var de=Dt;var vu=de({sync:s=>{try{return me.default.statSync(s).isFile()}catch{return!1}},async:async s=>{try{return(await me.default.promises.stat(s)).isFile()}catch{return!1}}});function*ps(s=$u.default.cwd()){let e=M.default.resolve(s),{root:t}=M.default.parse(e);for(;e&&e!==t;)yield e,e=M.default.dirname(e)}var yu=de(function*(s,e){return!s||!(yield vu(s))?null:ms(s,e)}),fe=de(function*(s={}){let{cwd:e,onUnknown:t}=s;for(let i of ps(e)){for(let r of Object.keys(nt))if(yield vu(M.default.join(i,r))){let u=nt[r],o=yield yu(M.default.join(i,"package.json"),t);return o||{name:u,agent:u}}let n=yield yu(M.default.join(i,"package.json"),t);if(n)return n}return null}),ds=fe.sync;function ms(s,e){try{let t=JSON.parse(me.default.readFileSync(s,"utf8")),i;if(typeof t.packageManager=="string"){let[n,r]=t.packageManager.replace(/^\^/,"").split("@"),u=r;return n==="yarn"&&Number.parseInt(r)>1?(i="yarn@berry",u="berry",{name:n,agent:i,version:u}):n==="pnpm"&&Number.parseInt(r)<7?(i="pnpm@6",{name:n,agent:i,version:u}):gu.includes(n)?(i=n,{name:n,agent:i,version:u}):e?.(t.packageManager)??null}}catch{}return null}function lt(s){try{return(0,N.execSync)(`command -v ${s}`,{stdio:"ignore"}),!0}catch{return!1}}function fs(s,e){if(s==="npx"||s==="pnpx"||s==="bunx")return{intent:"execute",args:e};if(s==="yarn"&&e[0]==="dlx")return{intent:"execute",args:e.slice(1)};if(["npm","pnpm","yarn","bun"].includes(s)){let i=e[0]||"",n=e.slice(1);if(!i||["install","i"].includes(i))return{intent:"install",args:n};if(i==="add")return{intent:"add",args:n};if(i==="run")return{intent:"run",args:n};if(["uninstall","remove","rm","un"].includes(i))return{intent:"uninstall",args:n};if(i==="install"&&n.length>0)return{intent:"add",args:n};if(i&&!i.startsWith("-"))return{intent:"run",args:e}}return null}async function ge(s,e={}){let t=s.trim().split(/\s+/),i=t[0]||"",n=t.slice(1),r=fs(i,n);if(r){let o=(await fe({cwd:process.cwd()}))?.agent||"npm",a=st(o,r.intent,r.args);if(a){let c=`${a.command} ${a.args.join(" ")}`;return lt(a.command)?(0,N.execSync)(c,{stdio:"inherit",cwd:process.cwd(),...e}):lt("npx")?(0,N.execSync)(`npx ${c}`,{stdio:"inherit",cwd:process.cwd(),...e}):lt("bunx")?(0,N.execSync)(`bunx --bun ${c}`,{stdio:"inherit",cwd:process.cwd(),...e}):(0,N.execSync)(c,{stdio:"inherit",cwd:process.cwd(),...e})}}return(0,N.execSync)(s,{stdio:"inherit",cwd:process.cwd(),...e})}var Ce=new St,K=new Su.default;function ku(){return!process.stdin.isTTY||process.env.CI==="true"||process.env.TERM==="dumb"||process.env.NON_INTERACTIVE==="true"}async function Fs(s){let e=(0,ht.join)((0,Ou.tmpdir)(),`cli-edit-${Date.now()}.json`);(0,B.writeFileSync)(e,JSON.stringify(s,null,2));let t=process.env.VISUAL||process.env.EDITOR||"nano";return new Promise((i,n)=>{(0,xu.spawn)(t,[e],{stdio:"inherit"}).on("exit",u=>{if(u===0)try{let o=(0,B.readFileSync)(e,"utf-8"),a=JSON.parse(o);(0,B.unlinkSync)(e),i(a)}catch{(0,B.unlinkSync)(e),n(new Error("Invalid JSON format"))}else(0,B.unlinkSync)(e),n(new Error("Editor closed without saving"))})})}async function wu(s,e){let t=I();t.start(`Modifying block input for ${e}`);let i=await K.getBlockInputFromUserQuery(JSON.stringify(s),e);return t.stop("Block input modified"),Tu(i.result,"Refined Block Input"),i.result}function Tu(s,e="Block Input"){j(JSON.stringify(s,null,2),e)}function Pu(s,e){return K.resolveMultipleTemplates(s,e)}async function Vu(s,e){let t=await Pu(s,e),i=t.result.files.map(u=>u.resolvedPath),n=au(i),r=he(n);j(r,`Files to be created (${t.result.files.length}):`)}async function ct(s,e,t=!1,i){let n=I();n.start("Resolving Files...");let r=await Pu(s,e),u=r.result.files.filter(D=>{let l=(0,ht.join)(process.cwd(),D.resolvedPath);return(0,B.existsSync)(l)&&(0,B.lstatSync)(l).isFile()&&D.templateType==="add"}),o=[],a=t;if(u.length>0&&!t){if(n.stop(`${u.length} conflicting files detected`),ku()){let l=`
|
|
88
|
+
Non-Interactive Mode Error:
|
|
89
89
|
|
|
90
90
|
${u.length} file(s) already exist and require user selection.
|
|
91
91
|
|
|
@@ -95,7 +95,7 @@ To resolve this, please restart the command with one of these flags:
|
|
|
95
95
|
|
|
96
96
|
Example:
|
|
97
97
|
derived-cli add ${s} --overwrite
|
|
98
|
-
`;x(
|
|
98
|
+
`;x(l),process.exit(1)}let D=await Ze({message:"Some files already exist. How would you like to proceed?",options:[{value:"overwrite-all",label:"Overwrite all"},{value:"select",label:"Select files to overwrite"},{value:"skip-all",label:"Skip all"}]});if(R(D)&&(x("Operation cancelled."),process.exit(0)),D==="overwrite-all")a=!0;else if(D==="select"){let l=await iu({message:"Select files to overwrite",options:u.map(p=>({value:p.resolvedPath,label:p.resolvedPath}))});R(l)&&(x("Operation cancelled."),process.exit(0)),o=l}n.start("Generating files...")}let c=su(r.result.files,o,a);if(c.errors?.length&&console.log(c.errors,"errors"),n.stop(`${c.addResults.length} files added, ${c.modifyResults.length} files modified, ${c.errors.length} errors`),c.addResults.length>0||c.modifyResults.length>0){if(cu(s),i?.setupCommands&&i.setupCommands.trim()){let D=i.setupCommands.split(",").map(p=>p.trim()),l=I();for(let p of D)if(p){l.start(`Running setup command: ${p}`);try{await ge(p,{stdio:"inherit",cwd:process.cwd()}),l.stop(`Completed: ${p}`)}catch(F){l.stop(`Warning: Setup command failed: ${p}`),console.warn(` ${F.message}`)}}}if(i?.aiInstruction&&i.aiInstruction.trim())return i.aiInstruction}return null}async function Es(s){let e=[],t=new Set;async function i(n){if(t.has(n))return;t.add(n);let r=await K.fetchBlock(n);if(r?.result?.id){if(r.result.dependsOn?.length)for(let u of r.result.dependsOn)await i(u.code);n!==s&&e.push(n)}}return await i(s),e}async function bs(s,e,t,i=!1,n=!0){n&&le(`Add block: ${s}`);let r=!1,u=I();u.start("Fetching block...");let o=await K.fetchBlock(s);if(o?.result?.id)u.stop(`Block Found '${o.result.name}' ${o.result.input?"with input":""}`);else return u.stop("Block Not Found"),null;let a=t||o.result.input;if(t){let c=await ct(s,t,i,o.result);return r=!0,c}if(!a&&!r){let c=await ct(s,{},i,o.result);return r=!0,c}for(a&&e&&!t&&(a=await wu(a,e));!r&&a&&!e;){if(Tu(a),ku()){let l=`This block requires input configuration, but user selection is not available.
|
|
99
99
|
|
|
100
100
|
To resolve this, please restart the command with below flag:
|
|
101
101
|
|
|
@@ -106,11 +106,14 @@ To resolve this, please restart the command with below flag:
|
|
|
106
106
|
|
|
107
107
|
Follow this JSON structure for block input:
|
|
108
108
|
|
|
109
|
-
${JSON.stringify(
|
|
110
|
-
`;x(
|
|
111
|
-
`);
|
|
109
|
+
${JSON.stringify(a,null,2)}
|
|
110
|
+
`;x(l),process.exit(1)}let D=await Ze({message:"What would you like to do?",options:[{value:"refine",label:"Edit (AI)"},{value:"edit",label:"Edit (Editor)"},{value:"showFiles",label:"Show files to be created"},{value:"done",label:"Insert Files"}]});if(R(D)&&(x("Operation cancelled."),process.exit(0)),D==="refine"){let l=await uu({message:"Describe what to refine:"});a=await wu(a,l)}if(D==="edit"&&(a=await Fs(a)),D==="done"){let l=await ct(s,a,i,o.result);return r=!0,l}D==="showFiles"&&await Vu(s,a)}return null}async function ys(s,e,t,i=!1){let u=[...await Es(s),s].filter(a=>a===s?!0:!it(a));if(u.length===0){j(`Block "${s}" and all its dependencies are already added.`,"Nothing to do");return}if(u.length>1){let a=u.map((c,D)=>{let l=c===s;return` ${D+1}. ${c}${l?" (main)":" (dependency)"}`}).join(`
|
|
111
|
+
`);j(`${u.length} blocks will be processed in order:
|
|
112
|
+
|
|
113
|
+
${a}`,"Processing Queue")}let o=[];for(let a=0;a<u.length;a++){let c=u[a];if(!c)continue;let D=c===s,l=a===u.length-1;u.length>1&&le(`[${a+1}/${u.length}] Processing: ${c}${D?" (main)":""}`);let p=await bs(c,D?e:void 0,D?t:null,i,u.length===1);p&&o.push({blockCode:c,instruction:p,isMain:D}),l||ce(`\u2713 ${c} completed`)}if(u.length>1){let a=`\u2713 All ${u.length} blocks processed successfully`;ce(a)}if(o.length>0){let a="";o.length===1?a=o[0]?.instruction||"":a=o.map((c,D)=>{let l=c.isMain?`${c.blockCode} (main)`:c.blockCode;return`${D+1}. [${l}]
|
|
114
|
+
${c.instruction}`}).join(`
|
|
112
115
|
|
|
113
|
-
|
|
116
|
+
`),j(a,"\u{1F4CB} Next Steps")}}Ce.command("help").description("List all commands and usage").action(()=>{console.log(`
|
|
114
117
|
Available commands:
|
|
115
118
|
|
|
116
119
|
add <block-id>
|
|
@@ -127,4 +130,4 @@ Available commands:
|
|
|
127
130
|
|
|
128
131
|
help
|
|
129
132
|
Show this help text.
|
|
130
|
-
`)});var $s=s=>{let e=
|
|
133
|
+
`)});var $s=s=>{let e=I();try{e.start("Decoding base64...");let t=Buffer.from(s,"base64").toString("utf8"),i=JSON.parse(t);for(;typeof i!="object";)i=JSON.parse(i);return e.stop("Decoded input successfully"),i}catch{return e.stop("Failed to decode input"),null}};Ce.command("add <blockCode>").description("Generate and refine a JSON block interactively").option("-q, --query <value>","Optional user input").option("-i, --block-input <value>","Optional block input json schema in base 64").option("-o, --overwrite","Automatically overwrite existing files").option("-f, --force","Force insert even if block already exists").action(async(s,e)=>{if(it(s)&&!e.force){j(`Block "${s}" is already added to this project. Use -f to force.`,"Already Added");return}let t=e.blockInput?$s(e.blockInput):null;await ys(s,e.query,t,e.overwrite)});Ce.command("init <project-slug>").description("Initialize a project from a template").action(async s=>{le(`\u{1F680} Initializing project: ${s}`);try{let e=process.cwd(),{isDirectoryEmpty:t,removeGitDirectory:i}=await Promise.resolve().then(()=>(Bu(),Au));t(e)||(x("\u274C Error: Current directory is not empty. Please run this command in an empty directory."),process.exit(1));let n=I();n.start("Fetching project details...");let r=await K.fetchProjectBySlug(s);r?.result||(n.stop("\u274C Project not found"),x(`Project with slug '${s}' does not exist.`),process.exit(1));let u=r.result;n.stop(`\u2705 Found project: ${u.name}`),n.start(`Cloning repository from ${u.gitUrl}...`);try{await ge(`git clone ${u.gitUrl} .`,{stdio:"pipe",cwd:e}),n.stop("\u2705 Repository cloned successfully")}catch(o){n.stop("\u274C Failed to clone repository"),x(`Git clone failed: ${o.message}`),process.exit(1)}if(i(e),u.setupCommand&&u.setupCommand.trim()){let o=u.setupCommand.split(",").map(a=>a.trim());for(let a of o)if(a){n.start(`Running: ${a}`);try{await ge(a,{stdio:"inherit",cwd:e}),n.stop(`\u2705 Completed: ${a}`)}catch(c){n.stop(`\u26A0\uFE0F Warning: Command failed: ${a}`),console.warn(` ${c.message}`)}}}ce(`\u{1F389} Project '${u.name}' setup successfully!`)}catch(e){x(`\u274C An error occurred: ${e.message}`),process.exit(1)}});Ce.parse();0&&(module.exports={displayFileTree});
|