derived-cli 0.0.36 → 0.0.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/bundle.js +69 -56
  2. package/package.json +1 -1
package/dist/bundle.js CHANGED
@@ -1,83 +1,96 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var Xt=Object.create;var R=Object.defineProperty;var eu=Object.getOwnPropertyDescriptor;var tu=Object.getOwnPropertyNames;var uu=Object.getPrototypeOf,iu=Object.prototype.hasOwnProperty;var su=(r,e)=>()=>(r&&(e=r(r=0)),e);var x=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Ke=(r,e)=>{for(var t in e)R(r,t,{get:e[t],enumerable:!0})},ze=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of tu(e))!iu.call(r,s)&&s!==t&&R(r,s,{get:()=>e[s],enumerable:!(i=eu(e,s))||i.enumerable});return r};var $=(r,e,t)=>(t=r!=null?Xt(uu(r)):{},ze(e||!r||!r.__esModule?R(t,"default",{value:r,enumerable:!0}):t,r)),ru=r=>ze(R({},"__esModule",{value:!0}),r);var M=x(le=>{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}},ae=class extends q{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};le.CommanderError=q;le.InvalidArgumentError=ae});var L=x(he=>{var{InvalidArgumentError:nu}=M(),ce=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 nu(`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 ou(r){let e=r.name()+(r.variadic===!0?"...":"");return r.required?"<"+e+">":"["+e+"]"}he.Argument=ce;he.humanReadableArgName=ou});var de=x(me=>{var{humanReadableArgName:Du}=L(),pe=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(s=>!s._hidden),i=e._getHelpCommand();return i&&!i._hidden&&t.push(i),this.sortSubcommands&&t.sort((s,n)=>s.name().localeCompare(n.name())),t}compareOptions(e,t){let i=s=>s.short?s.short.replace(/^-/,""):s.long.replace(/^--/,"");return i(e).localeCompare(i(t))}visibleOptions(e){let t=e.options.filter(s=>!s.hidden),i=e._getHelpOption();if(i&&!i.hidden){let s=i.short&&e._findOption(i.short),n=i.long&&e._findOption(i.long);!s&&!n?t.push(i):i.long&&!n?t.push(e.createOption(i.long,i.description)):i.short&&!s&&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 s=i.options.filter(n=>!n.hidden);t.push(...s)}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=>Du(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,s)=>Math.max(i,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(s)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((i,s)=>Math.max(i,this.displayWidth(t.styleOptionTerm(t.optionTerm(s)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((i,s)=>Math.max(i,this.displayWidth(t.styleOptionTerm(t.optionTerm(s)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((i,s)=>Math.max(i,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(s)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let i="";for(let s=e.parent;s;s=s.parent)i=s.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 s=new Map;return e.forEach(n=>{let u=i(n);s.has(u)||s.set(u,[])}),t.forEach(n=>{let u=i(n);s.has(u)||s.set(u,[]),s.get(u).push(n)}),s}formatHelp(e,t){let i=t.padWidth(e,t),s=t.helpWidth??80;function n(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),s),""]));let a=t.visibleArguments(e).map(l=>n(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 g=l.map(B=>n(t.styleOptionTerm(t.optionTerm(B)),t.styleOptionDescription(t.optionDescription(B))));u=u.concat(this.formatItemList(p,g,t))}),t.showGlobalOptions){let l=t.visibleGlobalOptions(e).map(p=>n(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 g=l.map(B=>n(t.styleSubcommandTerm(t.subcommandTerm(B)),t.styleSubcommandDescription(t.subcommandDescription(B))));u=u.concat(this.formatItemList(p,g,t))}),u.join(`
3
- `)}displayWidth(e){return Ye(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,s){let u=" ".repeat(2);if(!i)return u+e;let o=e.padEnd(t+e.length-s.displayWidth(e)),a=2,D=(this.helpWidth??80)-t-a-2,l;return D<this.minWidthToWrap||s.preformatted(i)?l=i:l=s.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/),s=/[\s]*[^\s]+/g,n=[];return i.forEach(u=>{let o=u.match(s);if(o===null){n.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}n.push(a.join(""));let p=D.trimStart();a=[p],c=this.displayWidth(p)}),n.push(a.join(""))}),n.join(`
6
- `)}};function Ye(r){let e=/\x1b\[\d*(;\d*)*m/g;return r.replace(e,"")}me.Help=pe;me.stripColor=Ye});var ge=x(Fe=>{var{InvalidArgumentError:au}=M(),fe=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=lu(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 au(`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?Ze(this.name().replace(/^no-/,"")):Ze(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}},Ce=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 s=this.negativeOptions.get(i).presetArg,n=s!==void 0?s:!1;return t.negate===(n===e)}};function Ze(r){return r.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function lu(r){let e,t,i=/^-[^-]$/,s=/^--[^-]/,n=r.split(/[ |,]+/).concat("guard");if(i.test(n[0])&&(e=n.shift()),s.test(n[0])&&(t=n.shift()),!e&&i.test(n[0])&&(e=n.shift()),!e&&s.test(n[0])&&(e=t,t=n.shift()),n[0].startsWith("-")){let u=n[0],o=`option creation failed due to '${u}' in option flags '${r}'`;throw/^-[^-][^-]/.test(u)?new Error(`${o}
2
+ "use strict";var lu=Object.create;var U=Object.defineProperty;var cu=Object.getOwnPropertyDescriptor;var hu=Object.getOwnPropertyNames;var pu=Object.getPrototypeOf,mu=Object.prototype.hasOwnProperty;var du=(r,e)=>()=>(r&&(e=r(r=0)),e);var S=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),et=(r,e)=>{for(var t in e)U(r,t,{get:e[t],enumerable:!0})},tt=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of hu(e))!mu.call(r,s)&&s!==t&&U(r,s,{get:()=>e[s],enumerable:!(i=cu(e,s))||i.enumerable});return r};var $=(r,e,t)=>(t=r!=null?lu(pu(r)):{},tt(e||!r||!r.__esModule?U(t,"default",{value:r,enumerable:!0}):t,r)),fu=r=>tt(U({},"__esModule",{value:!0}),r);var N=S(he=>{var J=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}},ce=class extends J{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};he.CommanderError=J;he.InvalidArgumentError=ce});var K=S(me=>{var{InvalidArgumentError:Cu}=N(),pe=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 Cu(`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 Fu(r){let e=r.name()+(r.variadic===!0?"...":"");return r.required?"<"+e+">":"["+e+"]"}me.Argument=pe;me.humanReadableArgName=Fu});var Ce=S(fe=>{var{humanReadableArgName:gu}=K(),de=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(s=>!s._hidden),i=e._getHelpCommand();return i&&!i._hidden&&t.push(i),this.sortSubcommands&&t.sort((s,n)=>s.name().localeCompare(n.name())),t}compareOptions(e,t){let i=s=>s.short?s.short.replace(/^-/,""):s.long.replace(/^--/,"");return i(e).localeCompare(i(t))}visibleOptions(e){let t=e.options.filter(s=>!s.hidden),i=e._getHelpOption();if(i&&!i.hidden){let s=i.short&&e._findOption(i.short),n=i.long&&e._findOption(i.long);!s&&!n?t.push(i):i.long&&!n?t.push(e.createOption(i.long,i.description)):i.short&&!s&&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 s=i.options.filter(n=>!n.hidden);t.push(...s)}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=>gu(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,s)=>Math.max(i,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(s)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((i,s)=>Math.max(i,this.displayWidth(t.styleOptionTerm(t.optionTerm(s)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((i,s)=>Math.max(i,this.displayWidth(t.styleOptionTerm(t.optionTerm(s)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((i,s)=>Math.max(i,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(s)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let i="";for(let s=e.parent;s;s=s.parent)i=s.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 s=new Map;return e.forEach(n=>{let u=i(n);s.has(u)||s.set(u,[])}),t.forEach(n=>{let u=i(n);s.has(u)||s.set(u,[]),s.get(u).push(n)}),s}formatHelp(e,t){let i=t.padWidth(e,t),s=t.helpWidth??80;function n(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),s),""]));let D=t.visibleArguments(e).map(l=>n(t.styleArgumentTerm(t.argumentTerm(l)),t.styleArgumentDescription(t.argumentDescription(l))));if(u=u.concat(this.formatItemList("Arguments:",D,t)),this.groupItems(e.options,t.visibleOptions(e),l=>l.helpGroupHeading??"Options:").forEach((l,p)=>{let g=l.map(w=>n(t.styleOptionTerm(t.optionTerm(w)),t.styleOptionDescription(t.optionDescription(w))));u=u.concat(this.formatItemList(p,g,t))}),t.showGlobalOptions){let l=t.visibleGlobalOptions(e).map(p=>n(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 g=l.map(w=>n(t.styleSubcommandTerm(t.subcommandTerm(w)),t.styleSubcommandDescription(t.subcommandDescription(w))));u=u.concat(this.formatItemList(p,g,t))}),u.join(`
3
+ `)}displayWidth(e){return ut(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,s){let u=" ".repeat(2);if(!i)return u+e;let o=e.padEnd(t+e.length-s.displayWidth(e)),D=2,a=(this.helpWidth??80)-t-D-2,l;return a<this.minWidthToWrap||s.preformatted(i)?l=i:l=s.boxWrap(i,a).replace(/\n/g,`
4
+ `+" ".repeat(t+D)),u+o+" ".repeat(D)+l.replace(/\n/g,`
5
+ ${u}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let i=e.split(/\r\n|\n/),s=/[\s]*[^\s]+/g,n=[];return i.forEach(u=>{let o=u.match(s);if(o===null){n.push("");return}let D=[o.shift()],h=this.displayWidth(D[0]);o.forEach(a=>{let l=this.displayWidth(a);if(h+l<=t){D.push(a),h+=l;return}n.push(D.join(""));let p=a.trimStart();D=[p],h=this.displayWidth(p)}),n.push(D.join(""))}),n.join(`
6
+ `)}};function ut(r){let e=/\x1b\[\d*(;\d*)*m/g;return r.replace(e,"")}fe.Help=de;fe.stripColor=ut});var be=S(Ee=>{var{InvalidArgumentError:Eu}=N(),Fe=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=bu(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 Eu(`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?it(this.name().replace(/^no-/,"")):it(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}},ge=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 s=this.negativeOptions.get(i).presetArg,n=s!==void 0?s:!1;return t.negate===(n===e)}};function it(r){return r.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function bu(r){let e,t,i=/^-[^-]$/,s=/^--[^-]/,n=r.split(/[ |,]+/).concat("guard");if(i.test(n[0])&&(e=n.shift()),s.test(n[0])&&(t=n.shift()),!e&&i.test(n[0])&&(e=n.shift()),!e&&s.test(n[0])&&(e=t,t=n.shift()),n[0].startsWith("-")){let u=n[0],o=`option creation failed due to '${u}' in option flags '${r}'`;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
10
  - too many short flags`):s.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 '${r}'.`);return{shortFlag:e,longFlag:t}}Fe.Option=fe;Fe.DualOptions=Ce});var Xe=x(Qe=>{function cu(r,e){if(Math.abs(r.length-e.length)>3)return Math.max(r.length,e.length);let t=[];for(let i=0;i<=r.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 s=1;s<=r.length;s++){let n=1;r[s-1]===e[i-1]?n=0:n=1,t[s][i]=Math.min(t[s-1][i]+1,t[s][i-1]+1,t[s-1][i-1]+n),s>1&&i>1&&r[s-1]===e[i-2]&&r[s-2]===e[i-1]&&(t[s][i]=Math.min(t[s][i],t[s-2][i-2]+1))}return t[r.length][e.length]}function hu(r,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=r.startsWith("--");t&&(r=r.slice(2),e=e.map(u=>u.slice(2)));let i=[],s=3,n=.4;return e.forEach(u=>{if(u.length<=1)return;let o=cu(r,u),a=Math.max(r.length,u.length);(a-o)/a>n&&(o<s?(s=o,i=[u]):o===s&&i.push(u))}),i.sort((u,o)=>u.localeCompare(o)),t&&(i=i.map(u=>`--${u}`)),i.length>1?`
12
+ - unrecognised flag format`)}if(e===void 0&&t===void 0)throw new Error(`option creation failed due to no flags found in '${r}'.`);return{shortFlag:e,longFlag:t}}Ee.Option=Fe;Ee.DualOptions=ge});var rt=S(st=>{function $u(r,e){if(Math.abs(r.length-e.length)>3)return Math.max(r.length,e.length);let t=[];for(let i=0;i<=r.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 s=1;s<=r.length;s++){let n=1;r[s-1]===e[i-1]?n=0:n=1,t[s][i]=Math.min(t[s-1][i]+1,t[s][i-1]+1,t[s-1][i-1]+n),s>1&&i>1&&r[s-1]===e[i-2]&&r[s-2]===e[i-1]&&(t[s][i]=Math.min(t[s][i],t[s-2][i-2]+1))}return t[r.length][e.length]}function yu(r,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=r.startsWith("--");t&&(r=r.slice(2),e=e.map(u=>u.slice(2)));let i=[],s=3,n=.4;return e.forEach(u=>{if(u.length<=1)return;let o=$u(r,u),D=Math.max(r.length,u.length);(D-o)/D>n&&(o<s?(s=o,i=[u]):o===s&&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]}?)`:""}Qe.suggestSimilar=hu});var it=x(ye=>{var pu=require("node:events").EventEmitter,Ee=require("node:child_process"),O=require("node:path"),U=require("node:fs"),m=require("node:process"),{Argument:mu,humanReadableArgName:du}=L(),{CommanderError:be}=M(),{Help:fu,stripColor:Cu}=de(),{Option:et,DualOptions:Fu}=ge(),{suggestSimilar:tt}=Xe(),$e=class r extends pu{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=>m.stdout.write(t),writeErr:t=>m.stderr.write(t),outputError:(t,i)=>i(t),getOutHelpWidth:()=>m.stdout.isTTY?m.stdout.columns:void 0,getErrHelpWidth:()=>m.stderr.isTTY?m.stderr.columns:void 0,getOutHasColors:()=>_e()??(m.stdout.isTTY&&m.stdout.hasColors?.()),getErrHasColors:()=>_e()??(m.stderr.isTTY&&m.stderr.hasColors?.()),stripColor:t=>Cu(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 s=t,n=i;typeof s=="object"&&s!==null&&(n=s,s=null),n=n||{};let[,u,o]=e.match(/([^ ]+) *(.*)/),a=this.createCommand(u);return s&&(a.description(s),a._executableHandler=!0),n.isDefault&&(this._defaultCommandName=a._name),a._hidden=!!(n.noHelp||n.hidden),a._executableFile=n.executableFile||null,o&&a.arguments(o),this._registerCommand(a),a.parent=this,a.copyInheritedSettings(this),s?this:a}createCommand(e){return new r(e)}createHelp(){return Object.assign(new fu,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 mu(e,t)}argument(e,t,i,s){let n=this.createArgument(e,t);return typeof i=="function"?n.default(s).argParser(i):n.default(i),this.addArgument(n),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]",[,s,n]=i.match(/([^ ]+) *(.*)/),u=t??"display help for command",o=this.createCommand(s);return o.helpOption(!1),n&&o.arguments(n),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 be(e,t,i)),m.exit(e)}action(e){let t=i=>{let s=this.registeredArguments.length,n=i.slice(0,s);return this._storeOptionsAsProperties?n[s]=this:n[s]=this.opts(),n.push(this),e.apply(this,n)};return this._actionHandler=t,this}createOption(e,t){return new et(e,t)}_callParseArg(e,t,i,s){try{return e.parseArg(t,i)}catch(n){if(n.code==="commander.invalidArgument"){let u=`${s} ${n.message}`;this.error(u,{exitCode:n.exitCode,code:n.code})}throw n}}_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=s=>[s.name()].concat(s.aliases()),i=t(e).find(s=>this._findCommand(s));if(i){let s=t(this._findCommand(i)).join("|"),n=t(e).join("|");throw new Error(`cannot add command '${n}' as already have command '${s}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),i=e.attributeName();if(e.negate){let n=e.long.replace(/^--no-/,"--");this._findOption(n)||this.setOptionValueWithSource(i,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(i,e.defaultValue,"default");let s=(n,u,o)=>{n==null&&e.presetArg!==void 0&&(n=e.presetArg);let a=this.getOptionValue(i);n!==null&&e.parseArg?n=this._callParseArg(e,n,a,u):n!==null&&e.variadic&&(n=e._collectValue(n,a)),n==null&&(e.negate?n=!1:e.isBoolean()||e.optional?n=!0:n=""),this.setOptionValueWithSource(i,n,o)};return this.on("option:"+t,n=>{let u=`error: option '${e.flags}' argument '${n}' is invalid.`;s(n,u,"cli")}),e.envVar&&this.on("optionEnv:"+t,n=>{let u=`error: option '${e.flags}' value '${n}' from env '${e.envVar}' is invalid.`;s(n,u,"env")}),this}_optionEx(e,t,i,s,n){if(typeof t=="object"&&t instanceof et)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 s=="function")u.default(n).argParser(s);else if(s instanceof RegExp){let o=s;s=(a,c)=>{let D=o.exec(a);return D?D[0]:c},u.default(n).argParser(s)}else u.default(s);return this.addOption(u)}option(e,t,i,s){return this._optionEx({},e,t,i,s)}requiredOption(e,t,i,s){return this._optionEx({mandatory:!0},e,t,i,s)}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){m.versions?.electron&&(t.from="electron");let s=m.execArgv??[];(s.includes("-e")||s.includes("--eval")||s.includes("-p")||s.includes("--print"))&&(t.from="eval")}e===void 0&&(e=m.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":m.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(U.existsSync(e))return;let s=t?`searched for local subcommand relative to directory '${t}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",n=`'${e}' does not exist
14
+ (Did you mean ${i[0]}?)`:""}st.suggestSimilar=yu});var at=S(Ae=>{var _u=require("node:events").EventEmitter,$e=require("node:child_process"),k=require("node:path"),z=require("node:fs"),m=require("node:process"),{Argument:vu,humanReadableArgName:Au}=K(),{CommanderError:ye}=N(),{Help:Bu,stripColor:wu}=Ce(),{Option:nt,DualOptions:xu}=be(),{suggestSimilar:ot}=rt(),_e=class r extends _u{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=>m.stdout.write(t),writeErr:t=>m.stderr.write(t),outputError:(t,i)=>i(t),getOutHelpWidth:()=>m.stdout.isTTY?m.stdout.columns:void 0,getErrHelpWidth:()=>m.stderr.isTTY?m.stderr.columns:void 0,getOutHasColors:()=>ve()??(m.stdout.isTTY&&m.stdout.hasColors?.()),getErrHasColors:()=>ve()??(m.stderr.isTTY&&m.stderr.hasColors?.()),stripColor:t=>wu(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 s=t,n=i;typeof s=="object"&&s!==null&&(n=s,s=null),n=n||{};let[,u,o]=e.match(/([^ ]+) *(.*)/),D=this.createCommand(u);return s&&(D.description(s),D._executableHandler=!0),n.isDefault&&(this._defaultCommandName=D._name),D._hidden=!!(n.noHelp||n.hidden),D._executableFile=n.executableFile||null,o&&D.arguments(o),this._registerCommand(D),D.parent=this,D.copyInheritedSettings(this),s?this:D}createCommand(e){return new r(e)}createHelp(){return Object.assign(new Bu,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 vu(e,t)}argument(e,t,i,s){let n=this.createArgument(e,t);return typeof i=="function"?n.default(s).argParser(i):n.default(i),this.addArgument(n),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]",[,s,n]=i.match(/([^ ]+) *(.*)/),u=t??"display help for command",o=this.createCommand(s);return o.helpOption(!1),n&&o.arguments(n),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 ye(e,t,i)),m.exit(e)}action(e){let t=i=>{let s=this.registeredArguments.length,n=i.slice(0,s);return this._storeOptionsAsProperties?n[s]=this:n[s]=this.opts(),n.push(this),e.apply(this,n)};return this._actionHandler=t,this}createOption(e,t){return new nt(e,t)}_callParseArg(e,t,i,s){try{return e.parseArg(t,i)}catch(n){if(n.code==="commander.invalidArgument"){let u=`${s} ${n.message}`;this.error(u,{exitCode:n.exitCode,code:n.code})}throw n}}_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=s=>[s.name()].concat(s.aliases()),i=t(e).find(s=>this._findCommand(s));if(i){let s=t(this._findCommand(i)).join("|"),n=t(e).join("|");throw new Error(`cannot add command '${n}' as already have command '${s}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),i=e.attributeName();if(e.negate){let n=e.long.replace(/^--no-/,"--");this._findOption(n)||this.setOptionValueWithSource(i,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(i,e.defaultValue,"default");let s=(n,u,o)=>{n==null&&e.presetArg!==void 0&&(n=e.presetArg);let D=this.getOptionValue(i);n!==null&&e.parseArg?n=this._callParseArg(e,n,D,u):n!==null&&e.variadic&&(n=e._collectValue(n,D)),n==null&&(e.negate?n=!1:e.isBoolean()||e.optional?n=!0:n=""),this.setOptionValueWithSource(i,n,o)};return this.on("option:"+t,n=>{let u=`error: option '${e.flags}' argument '${n}' is invalid.`;s(n,u,"cli")}),e.envVar&&this.on("optionEnv:"+t,n=>{let u=`error: option '${e.flags}' value '${n}' from env '${e.envVar}' is invalid.`;s(n,u,"env")}),this}_optionEx(e,t,i,s,n){if(typeof t=="object"&&t instanceof nt)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 s=="function")u.default(n).argParser(s);else if(s instanceof RegExp){let o=s;s=(D,h)=>{let a=o.exec(D);return a?a[0]:h},u.default(n).argParser(s)}else u.default(s);return this.addOption(u)}option(e,t,i,s){return this._optionEx({},e,t,i,s)}requiredOption(e,t,i,s){return this._optionEx({mandatory:!0},e,t,i,s)}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){m.versions?.electron&&(t.from="electron");let s=m.execArgv??[];(s.includes("-e")||s.includes("--eval")||s.includes("-p")||s.includes("--print"))&&(t.from="eval")}e===void 0&&(e=m.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":m.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(z.existsSync(e))return;let s=t?`searched for local subcommand relative to directory '${t}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",n=`'${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
- - ${s}`;throw new Error(n)}_executeSubCommand(e,t){t=t.slice();let i=!1,s=[".js",".ts",".tsx",".mjs",".cjs"];function n(D,l){let p=O.resolve(D,l);if(U.existsSync(p))return p;if(s.includes(O.extname(l)))return;let g=s.find(B=>U.existsSync(`${p}${B}`));if(g)return`${p}${g}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let u=e._executableFile||`${this._name}-${e._name}`,o=this._executableDir||"";if(this._scriptPath){let D;try{D=U.realpathSync(this._scriptPath)}catch{D=this._scriptPath}o=O.resolve(O.dirname(D),o)}if(o){let D=n(o,u);if(!D&&!e._executableFile&&this._scriptPath){let l=O.basename(this._scriptPath,O.extname(this._scriptPath));l!==this._name&&(D=n(o,`${l}-${e._name}`))}u=D||u}i=s.includes(O.extname(u));let a;m.platform!=="win32"?i?(t.unshift(u),t=ut(m.execArgv).concat(t),a=Ee.spawn(m.argv[0],t,{stdio:"inherit"})):a=Ee.spawn(u,t,{stdio:"inherit"}):(this._checkForMissingExecutable(u,o,e._name),t.unshift(u),t=ut(m.execArgv).concat(t),a=Ee.spawn(m.execPath,t,{stdio:"inherit"})),a.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(l=>{m.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 be(D,"commander.executeSubCommandAsync","(close)")):m.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)m.exit(1);else{let l=new be(1,"commander.executeSubCommandAsync","(error)");l.nestedError=D,c(l)}}),this.runningCommand=a}_dispatchSubcommand(e,t,i){let s=this._findCommand(e);s||this.help({error:!0}),s._prepareForParse();let n;return n=this._chainOrCallSubCommandHook(n,s,"preSubcommand"),n=this._chainOrCall(n,()=>{if(s._executableHandler)this._executeSubCommand(s,t.concat(i));else return s._parseCommand(t,i)}),n}_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,s,n)=>{let u=s;if(s!==null&&i.parseArg){let o=`error: command-argument value '${s}' is invalid for argument '${i.name()}'.`;u=this._callParseArg(i,s,n,o)}return u};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((i,s)=>{let n=i.defaultValue;i.variadic?s<this.args.length?(n=this.args.slice(s),i.parseArg&&(n=n.reduce((u,o)=>e(i,o,u),i.defaultValue))):n===void 0&&(n=[]):s<this.args.length&&(n=this.args[s],i.parseArg&&(n=e(i,n,i.defaultValue))),t[s]=n}),this.processedArgs=t}_chainOrCall(e,t){return e?.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let i=e,s=[];return this._getCommandAndAncestors().reverse().filter(n=>n._lifeCycleHooks[t]!==void 0).forEach(n=>{n._lifeCycleHooks[t].forEach(u=>{s.push({hookedCommand:n,callback:u})})}),t==="postAction"&&s.reverse(),s.forEach(n=>{i=this._chainOrCall(i,()=>n.callback(n.hookedCommand,this))}),i}_chainOrCallSubCommandHook(e,t,i){let s=e;return this._lifeCycleHooks[i]!==void 0&&this._lifeCycleHooks[i].forEach(n=>{s=this._chainOrCall(s,()=>n(this,t))}),s}_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 s=()=>{i.unknown.length>0&&this.unknownOption(i.unknown[0])},n=`command:${this.name()}`;if(this._actionHandler){s(),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(n,e,t)})),u=this._chainOrCallHooks(u,"postAction"),u}if(this.parent?.listenerCount(n))s(),this._processArguments(),this.parent.emit(n,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():(s(),this._processArguments())}else this.commands.length?(s(),this.help({error:!0})):(s(),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 s=i.attributeName();return this.getOptionValue(s)===void 0?!1:this.getOptionValueSource(s)!=="default"});e.filter(i=>i.conflictsWith.length>0).forEach(i=>{let s=e.find(n=>i.conflictsWith.includes(n.attributeName()));s&&this._conflictingOption(i,s)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],i=[],s=t;function n(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==="--"){s===i&&s.push(D),s.push(...e.slice(c));break}if(o&&(!n(D)||u(D))){this.emit(`option:${o.name()}`,D);continue}if(o=null,n(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&&(!n(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(s===t&&n(D)&&!(this.commands.length===0&&u(D))&&(s=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){s.push(D,...e.slice(c));break}s.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 s=this.options[i].attributeName();e[s]=s===this._versionOptionName?this._version:this[s]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
21
+ - ${s}`;throw new Error(n)}_executeSubCommand(e,t){t=t.slice();let i=!1,s=[".js",".ts",".tsx",".mjs",".cjs"];function n(a,l){let p=k.resolve(a,l);if(z.existsSync(p))return p;if(s.includes(k.extname(l)))return;let g=s.find(w=>z.existsSync(`${p}${w}`));if(g)return`${p}${g}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let u=e._executableFile||`${this._name}-${e._name}`,o=this._executableDir||"";if(this._scriptPath){let a;try{a=z.realpathSync(this._scriptPath)}catch{a=this._scriptPath}o=k.resolve(k.dirname(a),o)}if(o){let a=n(o,u);if(!a&&!e._executableFile&&this._scriptPath){let l=k.basename(this._scriptPath,k.extname(this._scriptPath));l!==this._name&&(a=n(o,`${l}-${e._name}`))}u=a||u}i=s.includes(k.extname(u));let D;m.platform!=="win32"?i?(t.unshift(u),t=Dt(m.execArgv).concat(t),D=$e.spawn(m.argv[0],t,{stdio:"inherit"})):D=$e.spawn(u,t,{stdio:"inherit"}):(this._checkForMissingExecutable(u,o,e._name),t.unshift(u),t=Dt(m.execArgv).concat(t),D=$e.spawn(m.execPath,t,{stdio:"inherit"})),D.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(l=>{m.on(l,()=>{D.killed===!1&&D.exitCode===null&&D.kill(l)})});let h=this._exitCallback;D.on("close",a=>{a=a??1,h?h(new ye(a,"commander.executeSubCommandAsync","(close)")):m.exit(a)}),D.on("error",a=>{if(a.code==="ENOENT")this._checkForMissingExecutable(u,o,e._name);else if(a.code==="EACCES")throw new Error(`'${u}' not executable`);if(!h)m.exit(1);else{let l=new ye(1,"commander.executeSubCommandAsync","(error)");l.nestedError=a,h(l)}}),this.runningCommand=D}_dispatchSubcommand(e,t,i){let s=this._findCommand(e);s||this.help({error:!0}),s._prepareForParse();let n;return n=this._chainOrCallSubCommandHook(n,s,"preSubcommand"),n=this._chainOrCall(n,()=>{if(s._executableHandler)this._executeSubCommand(s,t.concat(i));else return s._parseCommand(t,i)}),n}_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,s,n)=>{let u=s;if(s!==null&&i.parseArg){let o=`error: command-argument value '${s}' is invalid for argument '${i.name()}'.`;u=this._callParseArg(i,s,n,o)}return u};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((i,s)=>{let n=i.defaultValue;i.variadic?s<this.args.length?(n=this.args.slice(s),i.parseArg&&(n=n.reduce((u,o)=>e(i,o,u),i.defaultValue))):n===void 0&&(n=[]):s<this.args.length&&(n=this.args[s],i.parseArg&&(n=e(i,n,i.defaultValue))),t[s]=n}),this.processedArgs=t}_chainOrCall(e,t){return e?.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let i=e,s=[];return this._getCommandAndAncestors().reverse().filter(n=>n._lifeCycleHooks[t]!==void 0).forEach(n=>{n._lifeCycleHooks[t].forEach(u=>{s.push({hookedCommand:n,callback:u})})}),t==="postAction"&&s.reverse(),s.forEach(n=>{i=this._chainOrCall(i,()=>n.callback(n.hookedCommand,this))}),i}_chainOrCallSubCommandHook(e,t,i){let s=e;return this._lifeCycleHooks[i]!==void 0&&this._lifeCycleHooks[i].forEach(n=>{s=this._chainOrCall(s,()=>n(this,t))}),s}_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 s=()=>{i.unknown.length>0&&this.unknownOption(i.unknown[0])},n=`command:${this.name()}`;if(this._actionHandler){s(),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(n,e,t)})),u=this._chainOrCallHooks(u,"postAction"),u}if(this.parent?.listenerCount(n))s(),this._processArguments(),this.parent.emit(n,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():(s(),this._processArguments())}else this.commands.length?(s(),this.help({error:!0})):(s(),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 s=i.attributeName();return this.getOptionValue(s)===void 0?!1:this.getOptionValueSource(s)!=="default"});e.filter(i=>i.conflictsWith.length>0).forEach(i=>{let s=e.find(n=>i.conflictsWith.includes(n.attributeName()));s&&this._conflictingOption(i,s)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],i=[],s=t;function n(a){return a.length>1&&a[0]==="-"}let u=a=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(a)?!this._getCommandAndAncestors().some(l=>l.options.map(p=>p.short).some(p=>/^-\d$/.test(p))):!1,o=null,D=null,h=0;for(;h<e.length||D;){let a=D??e[h++];if(D=null,a==="--"){s===i&&s.push(a),s.push(...e.slice(h));break}if(o&&(!n(a)||u(a))){this.emit(`option:${o.name()}`,a);continue}if(o=null,n(a)){let l=this._findOption(a);if(l){if(l.required){let p=e[h++];p===void 0&&this.optionMissingArgument(l),this.emit(`option:${l.name()}`,p)}else if(l.optional){let p=null;h<e.length&&(!n(e[h])||u(e[h]))&&(p=e[h++]),this.emit(`option:${l.name()}`,p)}else this.emit(`option:${l.name()}`);o=l.variadic?l:null;continue}}if(a.length>2&&a[0]==="-"&&a[1]!=="-"){let l=this._findOption(`-${a[1]}`);if(l){l.required||l.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${l.name()}`,a.slice(2)):(this.emit(`option:${l.name()}`),D=`-${a.slice(2)}`);continue}}if(/^--[^=]+=/.test(a)){let l=a.indexOf("="),p=this._findOption(a.slice(0,l));if(p&&(p.required||p.optional)){this.emit(`option:${p.name()}`,a.slice(l+1));continue}}if(s===t&&n(a)&&!(this.commands.length===0&&u(a))&&(s=i),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&i.length===0){if(this._findCommand(a)){t.push(a),i.push(...e.slice(h));break}else if(this._getHelpCommand()&&a===this._getHelpCommand().name()){t.push(a,...e.slice(h));break}else if(this._defaultCommandName){i.push(a,...e.slice(h));break}}if(this._passThroughOptions){s.push(a,...e.slice(h));break}s.push(a)}return{operands:t,unknown:i}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let i=0;i<t;i++){let s=this.options[i].attributeName();e[s]=s===this._versionOptionName?this._version:this[s]}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||{},s=i.exitCode||1,n=i.code||"commander.error";this._exit(s,n,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in m.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()}`,m.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new Fu(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(s=>!t(s)).forEach(s=>{this.setOptionValueWithSource(s,i.implied[s],"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},s=u=>{let o=i(u),a=o.attributeName();return this.getOptionValueSource(a)==="env"?`environment variable '${o.envVar}'`:`option '${o.flags}'`},n=`error: ${s(e)} cannot be used with ${s(t)}`;this.error(n,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let s=[],n=this;do{let u=n.createHelp().visibleOptions(n).filter(o=>o.long).map(o=>o.long);s=s.concat(u),n=n.parent}while(n&&!n._enablePositionalOptions);t=tt(e,s)}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",n=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${i} but got ${e.length}.`;this.error(n,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let s=[];this.createHelp().visibleCommands(this).forEach(n=>{s.push(n.name()),n.alias()&&s.push(n.alias())}),t=tt(e,s)}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 s=this.createOption(t,i);return this._versionOptionName=s.attributeName(),this._registerOption(s),this.on("option:"+s.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 s=[i.name()].concat(i.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${s}'`)}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=>du(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=O.basename(e,O.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 s=t.formatHelp(this,t);return i.hasColors?s:this._outputConfiguration.stripColor(s)}_getOutputContext(e){e=e||{};let t=!!e.error,i,s,n;return t?(i=o=>this._outputConfiguration.writeErr(o),s=this._outputConfiguration.getErrHasColors(),n=this._outputConfiguration.getErrHelpWidth()):(i=o=>this._outputConfiguration.writeOut(o),s=this._outputConfiguration.getOutHasColors(),n=this._outputConfiguration.getOutHelpWidth()),{error:t,write:o=>(s||(o=this._outputConfiguration.stripColor(o)),i(o)),hasColors:s,helpWidth:n}}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let i=this._getOutputContext(e),s={error:i.error,write:i.write,command:this};this._getCommandAndAncestors().reverse().forEach(u=>u.emit("beforeAllHelp",s)),this.emit("beforeHelp",s);let n=this.helpInformation({error:i.error});if(t&&(n=t(n),typeof n!="string"&&!Buffer.isBuffer(n)))throw new Error("outputHelp callback must return a string or a Buffer");i.write(n),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",s),this._getCommandAndAncestors().forEach(u=>u.emit("afterAllHelp",s))}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(m.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.
24
+ `),this.outputHelp({error:!0}));let i=t||{},s=i.exitCode||1,n=i.code||"commander.error";this._exit(s,n,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in m.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()}`,m.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new xu(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(s=>!t(s)).forEach(s=>{this.setOptionValueWithSource(s,i.implied[s],"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(),D=this.getOptionValue(o),h=this.options.find(l=>l.negate&&o===l.attributeName()),a=this.options.find(l=>!l.negate&&o===l.attributeName());return h&&(h.presetArg===void 0&&D===!1||h.presetArg!==void 0&&D===h.presetArg)?h:a||u},s=u=>{let o=i(u),D=o.attributeName();return this.getOptionValueSource(D)==="env"?`environment variable '${o.envVar}'`:`option '${o.flags}'`},n=`error: ${s(e)} cannot be used with ${s(t)}`;this.error(n,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let s=[],n=this;do{let u=n.createHelp().visibleOptions(n).filter(o=>o.long).map(o=>o.long);s=s.concat(u),n=n.parent}while(n&&!n._enablePositionalOptions);t=ot(e,s)}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",n=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${i} but got ${e.length}.`;this.error(n,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let s=[];this.createHelp().visibleCommands(this).forEach(n=>{s.push(n.name()),n.alias()&&s.push(n.alias())}),t=ot(e,s)}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 s=this.createOption(t,i);return this._versionOptionName=s.attributeName(),this._registerOption(s),this.on("option:"+s.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 s=[i.name()].concat(i.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${s}'`)}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=>Au(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=k.basename(e,k.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 s=t.formatHelp(this,t);return i.hasColors?s:this._outputConfiguration.stripColor(s)}_getOutputContext(e){e=e||{};let t=!!e.error,i,s,n;return t?(i=o=>this._outputConfiguration.writeErr(o),s=this._outputConfiguration.getErrHasColors(),n=this._outputConfiguration.getErrHelpWidth()):(i=o=>this._outputConfiguration.writeOut(o),s=this._outputConfiguration.getOutHasColors(),n=this._outputConfiguration.getOutHelpWidth()),{error:t,write:o=>(s||(o=this._outputConfiguration.stripColor(o)),i(o)),hasColors:s,helpWidth:n}}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let i=this._getOutputContext(e),s={error:i.error,write:i.write,command:this};this._getCommandAndAncestors().reverse().forEach(u=>u.emit("beforeAllHelp",s)),this.emit("beforeHelp",s);let n=this.helpInformation({error:i.error});if(t&&(n=t(n),typeof n!="string"&&!Buffer.isBuffer(n)))throw new Error("outputHelp callback must return a string or a Buffer");i.write(n),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",s),this._getCommandAndAncestors().forEach(u=>u.emit("afterAllHelp",s))}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(m.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
26
  Expecting one of '${i.join("', '")}'`);let s=`${e}Help`;return this.on(s,n=>{let u;typeof t=="function"?u=t({error:n.error,command:n.command}):u=t,u&&n.write(`${u}
27
- `)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(s=>t.is(s))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function ut(r){return r.map(e=>{if(!e.startsWith("--inspect"))return e;let t,i="127.0.0.1",s="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])?s=n[3]:i=n[3]):(n=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=n[1],i=n[3],s=n[4]),t&&s!=="0"?`${t}=${i}:${parseInt(s)+1}`:e})}function _e(){if(m.env.NO_COLOR||m.env.FORCE_COLOR==="0"||m.env.FORCE_COLOR==="false")return!1;if(m.env.FORCE_COLOR||m.env.CLICOLOR_FORCE!==void 0)return!0}ye.Command=$e;ye.useColor=_e});var ot=x(A=>{var{Argument:st}=L(),{Command:Ae}=it(),{CommanderError:gu,InvalidArgumentError:rt}=M(),{Help:Eu}=de(),{Option:nt}=ge();A.program=new Ae;A.createCommand=r=>new Ae(r);A.createOption=(r,e)=>new nt(r,e);A.createArgument=(r,e)=>new st(r,e);A.Command=Ae;A.Option=nt;A.Argument=st;A.Help=Eu;A.CommanderError=gu;A.InvalidArgumentError=rt;A.InvalidOptionArgumentError=rt});var we=x((Wi,lt)=>{"use strict";var ve="\x1B",f=`${ve}[`,bu="\x07",Be={to(r,e){return e?`${f}${e+1};${r+1}H`:`${f}${r+1}G`},move(r,e){let t="";return r<0?t+=`${f}${-r}D`:r>0&&(t+=`${f}${r}C`),e<0?t+=`${f}${-e}A`:e>0&&(t+=`${f}${e}B`),t},up:(r=1)=>`${f}${r}A`,down:(r=1)=>`${f}${r}B`,forward:(r=1)=>`${f}${r}C`,backward:(r=1)=>`${f}${r}D`,nextLine:(r=1)=>`${f}E`.repeat(r),prevLine:(r=1)=>`${f}F`.repeat(r),left:`${f}G`,hide:`${f}?25l`,show:`${f}?25h`,save:`${ve}7`,restore:`${ve}8`},$u={up:(r=1)=>`${f}S`.repeat(r),down:(r=1)=>`${f}T`.repeat(r)},_u={screen:`${f}2J`,up:(r=1)=>`${f}1J`.repeat(r),down:(r=1)=>`${f}J`.repeat(r),line:`${f}2K`,lineEnd:`${f}K`,lineStart:`${f}1K`,lines(r){let e="";for(let t=0;t<r;t++)e+=this.line+(t<r-1?Be.up():"");return r&&(e+=Be.left),e}};lt.exports={cursor:Be,scroll:$u,erase:_u,beep:bu}});var z=x((Gi,xe)=>{var K=process||{},ct=K.argv||[],J=K.env||{},yu=!(J.NO_COLOR||ct.includes("--no-color"))&&(!!J.FORCE_COLOR||ct.includes("--color")||K.platform==="win32"||(K.stdout||{}).isTTY&&J.TERM!=="dumb"||!!J.CI),Au=(r,e,t=r)=>i=>{let s=""+i,n=s.indexOf(e,r.length);return~n?r+vu(s,e,t,n)+e:r+s+e},vu=(r,e,t,i)=>{let s="",n=0;do s+=r.substring(n,i)+t,n=i+e.length,i=r.indexOf(e,n);while(~i);return s+r.substring(n)},ht=(r=yu)=>{let e=r?Au:()=>String;return{isColorSupported:r,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};xe.exports=ht();xe.exports.createColors=ht});var It=x((os,jt)=>{"use strict";var Ne=Object.defineProperty,ni=Object.getOwnPropertyDescriptor,oi=Object.getOwnPropertyNames,Di=Object.prototype.hasOwnProperty,ai=(r,e)=>{for(var t in e)Ne(r,t,{get:e[t],enumerable:!0})},li=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of oi(e))!Di.call(r,s)&&s!==t&&Ne(r,s,{get:()=>e[s],enumerable:!(i=ni(e,s))||i.enumerable});return r},ci=r=>li(Ne({},"__esModule",{value:!0}),r),Ht={};ai(Ht,{default:()=>mi});jt.exports=ci(Ht);var hi=class{baseUrl;defaultHeaders;constructor(r,e={}){this.baseUrl=r,this.defaultHeaders=e}buildUrl(r){return`${this.baseUrl.replace(/\/$/,"")}/${r.replace(/^\//,"")}`}async request(r,e,t,i={}){let s=this.buildUrl(e),n=await fetch(s,{method:r,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(r,e){return this.request("GET",r,void 0,e)}post(r,e,t){return this.request("POST",r,e,t)}put(r,e,t){return this.request("PUT",r,e,t)}delete(r,e){return this.request("DELETE",r,void 0,e)}},N=new hi("https://api.derived.dev/api/public"),pi=class{constructor(){}fetchBlock=async r=>N.get(`/v1/template-group/code/${r}`);getBlockInputFromUserQuery=(r,e)=>N.post("/v1/template-group/get-block-input-from-user-query",{blockInput:r,query:e});resolveMultipleTemplates=(r,e)=>N.post("/v1/template-group/resolve-multiple-templates-by-block-code",{blockCode:r,data:e});searchBlocksByName=r=>N.get(`/v1/template-group/semantic-search?q=${r}&limit=5&threshold=0.5`);fetchProjectBySlug=async r=>N.get(`/v1/project/detail-by-slug/${r}`)},mi=pi});var Gt={};Ke(Gt,{isDirectoryEmpty:()=>di,removeGitDirectory:()=>fi});function di(r){return(0,V.existsSync)(r)?(0,V.readdirSync)(r).filter(i=>!i.startsWith(".")).length===0:!0}function fi(r){let e=(0,Wt.join)(r,".git");(0,V.existsSync)(e)&&(0,V.rmSync)(e,{recursive:!0,force:!0})}var V,Wt,Nt=su(()=>{"use strict";V=require("fs"),Wt=require("path")});var Ei={};Ke(Ei,{displayFileTree:()=>Yt});module.exports=ru(Ei);var Dt=$(ot(),1),{program:xi,createCommand:Oi,createArgument:Si,createOption:ki,CommanderError:Ti,InvalidArgumentError:Vi,InvalidOptionArgumentError:Pi,Command:at,Argument:Hi,Option:ji,Help:Ii}=Dt.default;var ie=require("node:util");var b=$(we(),1),H=require("node:process"),S=$(require("node:readline"),1),ke=$(require("node:readline"),1),Et=require("node:stream"),bt=$(z(),1);function Bu({onlyFirst:r=!1}={}){let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(e,r?void 0:"g")}var wu=Bu();function $t(r){if(typeof r!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof r}\``);return r.replace(wu,"")}function _t(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var yt={exports:{}};(function(r){var e={};r.exports=e,e.eastAsianWidth=function(i){var s=i.charCodeAt(0),n=i.length==2?i.charCodeAt(1):0,u=s;return 55296<=s&&s<=56319&&56320<=n&&n<=57343&&(s&=1023,n&=1023,u=s<<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 s=this.eastAsianWidth(i);return s=="F"||s=="W"||s=="A"?2:1};function t(i){return i.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(i){for(var s=t(i),n=0,u=0;u<s.length;u++)n=n+this.characterLength(s[u]);return n},e.slice=function(i,s,n){textLen=e.length(i),s=s||0,n=n||1,s<0&&(s=textLen+s),n<0&&(n=textLen+n);for(var u="",o=0,a=t(i),c=0;c<a.length;c++){var D=a[c],l=e.length(D);if(o>=s-(l==2?1:0))if(o+l<=n)u+=D;else break;o+=l}return u}})(yt);var xu=yt.exports,Ou=_t(xu),Su=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},ku=_t(Su);function W(r,e={}){if(typeof r!="string"||r.length===0||(e={ambiguousIsNarrow:!0,...e},r=$t(r),r.length===0))return 0;r=r.replace(ku()," ");let t=e.ambiguousIsNarrow?1:2,i=0;for(let s of r){let n=s.codePointAt(0);if(!(n<=31||n>=127&&n<=159||n>=768&&n<=879))switch(Ou.eastAsianWidth(s)){case"F":case"W":i+=2;break;case"A":i+=t;break;default:i+=1}}return i}var Oe=10,pt=(r=0)=>e=>`\x1B[${e+r}m`,mt=(r=0)=>e=>`\x1B[${38+r};5;${e}m`,dt=(r=0)=>(e,t,i)=>`\x1B[${38+r};2;${e};${t};${i}m`,d={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(d.modifier);var Tu=Object.keys(d.color),Vu=Object.keys(d.bgColor);[...Tu,...Vu];function Pu(){let r=new Map;for(let[e,t]of Object.entries(d)){for(let[i,s]of Object.entries(t))d[i]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`},t[i]=d[i],r.set(s[0],s[1]);Object.defineProperty(d,e,{value:t,enumerable:!1})}return Object.defineProperty(d,"codes",{value:r,enumerable:!1}),d.color.close="\x1B[39m",d.bgColor.close="\x1B[49m",d.color.ansi=pt(),d.color.ansi256=mt(),d.color.ansi16m=dt(),d.bgColor.ansi=pt(Oe),d.bgColor.ansi256=mt(Oe),d.bgColor.ansi16m=dt(Oe),Object.defineProperties(d,{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 s=Number.parseInt(i,16);return[s>>16&255,s>>8&255,s&255]},enumerable:!1},hexToAnsi256:{value:e=>d.rgbToAnsi256(...d.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,i,s;if(e>=232)t=((e-232)*10+8)/255,i=t,s=t;else{e-=16;let o=e%36;t=Math.floor(e/36)/5,i=Math.floor(o/6)/5,s=o%6/5}let n=Math.max(t,i,s)*2;if(n===0)return 30;let u=30+(Math.round(s)<<2|Math.round(i)<<1|Math.round(t));return n===2&&(u+=60),u},enumerable:!1},rgbToAnsi:{value:(e,t,i)=>d.ansi256ToAnsi(d.rgbToAnsi256(e,t,i)),enumerable:!1},hexToAnsi:{value:e=>d.ansi256ToAnsi(d.hexToAnsi256(e)),enumerable:!1}}),d}var Hu=Pu(),te=new Set(["\x1B","\x9B"]),ju=39,Ve="\x07",At="[",Iu="]",vt="m",Pe=`${Iu}8;;`,ft=r=>`${te.values().next().value}${At}${r}${vt}`,Ct=r=>`${te.values().next().value}${Pe}${r}${Ve}`,Mu=r=>r.split(" ").map(e=>W(e)),Se=(r,e,t)=>{let i=[...e],s=!1,n=!1,u=W($t(r[r.length-1]));for(let[o,a]of i.entries()){let c=W(a);if(u+c<=t?r[r.length-1]+=a:(r.push(a),u=0),te.has(a)&&(s=!0,n=i.slice(o+1).join("").startsWith(Pe)),s){n?a===Ve&&(s=!1,n=!1):a===vt&&(s=!1);continue}u+=c,u===t&&o<i.length-1&&(r.push(""),u=0)}!u&&r[r.length-1].length>0&&r.length>1&&(r[r.length-2]+=r.pop())},Wu=r=>{let e=r.split(" "),t=e.length;for(;t>0&&!(W(e[t-1])>0);)t--;return t===e.length?r:e.slice(0,t).join(" ")+e.slice(t).join("")},Gu=(r,e,t={})=>{if(t.trim!==!1&&r.trim()==="")return"";let i="",s,n,u=Mu(r),o=[""];for(let[c,D]of r.split(" ").entries()){t.trim!==!1&&(o[o.length-1]=o[o.length-1].trimStart());let l=W(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,g=1+Math.floor((u[c]-p-1)/e);Math.floor((u[c]-1)/e)<g&&o.push(""),Se(o,D,e);continue}if(l+u[c]>e&&l>0&&u[c]>0){if(t.wordWrap===!1&&l<e){Se(o,D,e);continue}o.push("")}if(l+u[c]>e&&t.wordWrap===!1){Se(o,D,e);continue}o[o.length-1]+=D}t.trim!==!1&&(o=o.map(c=>Wu(c)));let a=[...o.join(`
28
- `)];for(let[c,D]of a.entries()){if(i+=D,te.has(D)){let{groups:p}=new RegExp(`(?:\\${At}(?<code>\\d+)m|\\${Pe}(?<uri>.*)${Ve})`).exec(a.slice(c).join(""))||{groups:{}};if(p.code!==void 0){let g=Number.parseFloat(p.code);s=g===ju?void 0:g}else p.uri!==void 0&&(n=p.uri.length===0?void 0:p.uri)}let l=Hu.codes.get(Number(s));a[c+1]===`
29
- `?(n&&(i+=Ct("")),s&&l&&(i+=ft(l))):D===`
30
- `&&(s&&l&&(i+=ft(s)),n&&(i+=Ct(n)))}return i};function Ft(r,e,t){return String(r).normalize().replace(/\r\n/g,`
27
+ `)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(s=>t.is(s))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Dt(r){return r.map(e=>{if(!e.startsWith("--inspect"))return e;let t,i="127.0.0.1",s="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])?s=n[3]:i=n[3]):(n=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=n[1],i=n[3],s=n[4]),t&&s!=="0"?`${t}=${i}:${parseInt(s)+1}`:e})}function ve(){if(m.env.NO_COLOR||m.env.FORCE_COLOR==="0"||m.env.FORCE_COLOR==="false")return!1;if(m.env.FORCE_COLOR||m.env.CLICOLOR_FORCE!==void 0)return!0}Ae.Command=_e;Ae.useColor=ve});var pt=S(v=>{var{Argument:lt}=K(),{Command:Be}=at(),{CommanderError:Ou,InvalidArgumentError:ct}=N(),{Help:Su}=Ce(),{Option:ht}=be();v.program=new Be;v.createCommand=r=>new Be(r);v.createOption=(r,e)=>new ht(r,e);v.createArgument=(r,e)=>new lt(r,e);v.Command=Be;v.Option=ht;v.Argument=lt;v.Help=Su;v.CommanderError=Ou;v.InvalidArgumentError=ct;v.InvalidOptionArgumentError=ct});var Oe=S((us,ft)=>{"use strict";var we="\x1B",C=`${we}[`,ku="\x07",xe={to(r,e){return e?`${C}${e+1};${r+1}H`:`${C}${r+1}G`},move(r,e){let t="";return r<0?t+=`${C}${-r}D`:r>0&&(t+=`${C}${r}C`),e<0?t+=`${C}${-e}A`:e>0&&(t+=`${C}${e}B`),t},up:(r=1)=>`${C}${r}A`,down:(r=1)=>`${C}${r}B`,forward:(r=1)=>`${C}${r}C`,backward:(r=1)=>`${C}${r}D`,nextLine:(r=1)=>`${C}E`.repeat(r),prevLine:(r=1)=>`${C}F`.repeat(r),left:`${C}G`,hide:`${C}?25l`,show:`${C}?25h`,save:`${we}7`,restore:`${we}8`},Tu={up:(r=1)=>`${C}S`.repeat(r),down:(r=1)=>`${C}T`.repeat(r)},Pu={screen:`${C}2J`,up:(r=1)=>`${C}1J`.repeat(r),down:(r=1)=>`${C}J`.repeat(r),line:`${C}2K`,lineEnd:`${C}K`,lineStart:`${C}1K`,lines(r){let e="";for(let t=0;t<r;t++)e+=this.line+(t<r-1?xe.up():"");return r&&(e+=xe.left),e}};ft.exports={cursor:xe,scroll:Tu,erase:Pu,beep:ku}});var Q=S((is,Se)=>{var Z=process||{},Ct=Z.argv||[],Y=Z.env||{},Vu=!(Y.NO_COLOR||Ct.includes("--no-color"))&&(!!Y.FORCE_COLOR||Ct.includes("--color")||Z.platform==="win32"||(Z.stdout||{}).isTTY&&Y.TERM!=="dumb"||!!Y.CI),ju=(r,e,t=r)=>i=>{let s=""+i,n=s.indexOf(e,r.length);return~n?r+Hu(s,e,t,n)+e:r+s+e},Hu=(r,e,t,i)=>{let s="",n=0;do s+=r.substring(n,i)+t,n=i+e.length,i=r.indexOf(e,n);while(~i);return s+r.substring(n)},Ft=(r=Vu)=>{let e=r?ju:()=>String;return{isColorSupported:r,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};Se.exports=Ft();Se.exports.createColors=Ft});var Ut=S((Es,Lt)=>{"use strict";var Ue=Object.defineProperty,Ei=Object.getOwnPropertyDescriptor,bi=Object.getOwnPropertyNames,$i=Object.prototype.hasOwnProperty,yi=(r,e)=>{for(var t in e)Ue(r,t,{get:e[t],enumerable:!0})},_i=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of bi(e))!$i.call(r,s)&&s!==t&&Ue(r,s,{get:()=>e[s],enumerable:!(i=Ei(e,s))||i.enumerable});return r},vi=r=>_i(Ue({},"__esModule",{value:!0}),r),qt={};yi(qt,{default:()=>wi});Lt.exports=vi(qt);var Ai=class{baseUrl;defaultHeaders;constructor(r,e={}){this.baseUrl=r,this.defaultHeaders=e}buildUrl(r){return`${this.baseUrl.replace(/\/$/,"")}/${r.replace(/^\//,"")}`}async request(r,e,t,i={}){let s=this.buildUrl(e),n=await fetch(s,{method:r,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(r,e){return this.request("GET",r,void 0,e)}post(r,e,t){return this.request("POST",r,e,t)}put(r,e,t){return this.request("PUT",r,e,t)}delete(r,e){return this.request("DELETE",r,void 0,e)}},L=new Ai("https://api.derived.dev/api/public"),Bi=class{constructor(){}fetchBlock=async r=>L.get(`/v1/template-group/code/${r}`);getBlockInputFromUserQuery=(r,e)=>L.post("/v1/template-group/get-block-input-from-user-query",{blockInput:r,query:e});resolveMultipleTemplates=(r,e)=>L.post("/v1/template-group/resolve-multiple-templates-by-block-code",{blockCode:r,data:e});searchBlocksByName=r=>L.get(`/v1/template-group/semantic-search?q=${r}&limit=5&threshold=0.5`);fetchProjectBySlug=async r=>L.get(`/v1/project/detail-by-slug/${r}`)},wi=Bi});var Xt={};et(Xt,{isDirectoryEmpty:()=>Si,removeGitDirectory:()=>ki});function Si(r){return(0,j.existsSync)(r)?(0,j.readdirSync)(r).filter(i=>!i.startsWith(".")).length===0:!0}function ki(r){let e=(0,Qt.join)(r,".git");(0,j.existsSync)(e)&&(0,j.rmSync)(e,{recursive:!0,force:!0})}var j,Qt,eu=du(()=>{"use strict";j=require("fs"),Qt=require("path")});var ji={};et(ji,{displayFileTree:()=>ou});module.exports=fu(ji);var mt=$(pt(),1),{program:Li,createCommand:Ui,createArgument:Ji,createOption:Ki,CommanderError:zi,InvalidArgumentError:Yi,InvalidOptionArgumentError:Zi,Command:dt,Argument:Qi,Option:Xi,Help:es}=mt.default;var se=require("node:util");var b=$(Oe(),1),I=require("node:process"),P=$(require("node:readline"),1),Pe=$(require("node:readline"),1),Bt=require("node:stream"),wt=$(Q(),1);function Iu({onlyFirst:r=!1}={}){let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(e,r?void 0:"g")}var Mu=Iu();function xt(r){if(typeof r!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof r}\``);return r.replace(Mu,"")}function Ot(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var St={exports:{}};(function(r){var e={};r.exports=e,e.eastAsianWidth=function(i){var s=i.charCodeAt(0),n=i.length==2?i.charCodeAt(1):0,u=s;return 55296<=s&&s<=56319&&56320<=n&&n<=57343&&(s&=1023,n&=1023,u=s<<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 s=this.eastAsianWidth(i);return s=="F"||s=="W"||s=="A"?2:1};function t(i){return i.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(i){for(var s=t(i),n=0,u=0;u<s.length;u++)n=n+this.characterLength(s[u]);return n},e.slice=function(i,s,n){textLen=e.length(i),s=s||0,n=n||1,s<0&&(s=textLen+s),n<0&&(n=textLen+n);for(var u="",o=0,D=t(i),h=0;h<D.length;h++){var a=D[h],l=e.length(a);if(o>=s-(l==2?1:0))if(o+l<=n)u+=a;else break;o+=l}return u}})(St);var Wu=St.exports,Gu=Ot(Wu),Nu=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},Ru=Ot(Nu);function R(r,e={}){if(typeof r!="string"||r.length===0||(e={ambiguousIsNarrow:!0,...e},r=xt(r),r.length===0))return 0;r=r.replace(Ru()," ");let t=e.ambiguousIsNarrow?1:2,i=0;for(let s of r){let n=s.codePointAt(0);if(!(n<=31||n>=127&&n<=159||n>=768&&n<=879))switch(Gu.eastAsianWidth(s)){case"F":case"W":i+=2;break;case"A":i+=t;break;default:i+=1}}return i}var ke=10,gt=(r=0)=>e=>`\x1B[${e+r}m`,Et=(r=0)=>e=>`\x1B[${38+r};5;${e}m`,bt=(r=0)=>(e,t,i)=>`\x1B[${38+r};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 qu=Object.keys(f.color),Lu=Object.keys(f.bgColor);[...qu,...Lu];function Uu(){let r=new Map;for(let[e,t]of Object.entries(f)){for(let[i,s]of Object.entries(t))f[i]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`},t[i]=f[i],r.set(s[0],s[1]);Object.defineProperty(f,e,{value:t,enumerable:!1})}return Object.defineProperty(f,"codes",{value:r,enumerable:!1}),f.color.close="\x1B[39m",f.bgColor.close="\x1B[49m",f.color.ansi=gt(),f.color.ansi256=Et(),f.color.ansi16m=bt(),f.bgColor.ansi=gt(ke),f.bgColor.ansi256=Et(ke),f.bgColor.ansi16m=bt(ke),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 s=Number.parseInt(i,16);return[s>>16&255,s>>8&255,s&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,s;if(e>=232)t=((e-232)*10+8)/255,i=t,s=t;else{e-=16;let o=e%36;t=Math.floor(e/36)/5,i=Math.floor(o/6)/5,s=o%6/5}let n=Math.max(t,i,s)*2;if(n===0)return 30;let u=30+(Math.round(s)<<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 Ju=Uu(),ie=new Set(["\x1B","\x9B"]),Ku=39,je="\x07",kt="[",zu="]",Tt="m",He=`${zu}8;;`,$t=r=>`${ie.values().next().value}${kt}${r}${Tt}`,yt=r=>`${ie.values().next().value}${He}${r}${je}`,Yu=r=>r.split(" ").map(e=>R(e)),Te=(r,e,t)=>{let i=[...e],s=!1,n=!1,u=R(xt(r[r.length-1]));for(let[o,D]of i.entries()){let h=R(D);if(u+h<=t?r[r.length-1]+=D:(r.push(D),u=0),ie.has(D)&&(s=!0,n=i.slice(o+1).join("").startsWith(He)),s){n?D===je&&(s=!1,n=!1):D===Tt&&(s=!1);continue}u+=h,u===t&&o<i.length-1&&(r.push(""),u=0)}!u&&r[r.length-1].length>0&&r.length>1&&(r[r.length-2]+=r.pop())},Zu=r=>{let e=r.split(" "),t=e.length;for(;t>0&&!(R(e[t-1])>0);)t--;return t===e.length?r:e.slice(0,t).join(" ")+e.slice(t).join("")},Qu=(r,e,t={})=>{if(t.trim!==!1&&r.trim()==="")return"";let i="",s,n,u=Yu(r),o=[""];for(let[h,a]of r.split(" ").entries()){t.trim!==!1&&(o[o.length-1]=o[o.length-1].trimStart());let l=R(o[o.length-1]);if(h!==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[h]>e){let p=e-l,g=1+Math.floor((u[h]-p-1)/e);Math.floor((u[h]-1)/e)<g&&o.push(""),Te(o,a,e);continue}if(l+u[h]>e&&l>0&&u[h]>0){if(t.wordWrap===!1&&l<e){Te(o,a,e);continue}o.push("")}if(l+u[h]>e&&t.wordWrap===!1){Te(o,a,e);continue}o[o.length-1]+=a}t.trim!==!1&&(o=o.map(h=>Zu(h)));let D=[...o.join(`
28
+ `)];for(let[h,a]of D.entries()){if(i+=a,ie.has(a)){let{groups:p}=new RegExp(`(?:\\${kt}(?<code>\\d+)m|\\${He}(?<uri>.*)${je})`).exec(D.slice(h).join(""))||{groups:{}};if(p.code!==void 0){let g=Number.parseFloat(p.code);s=g===Ku?void 0:g}else p.uri!==void 0&&(n=p.uri.length===0?void 0:p.uri)}let l=Ju.codes.get(Number(s));D[h+1]===`
29
+ `?(n&&(i+=yt("")),s&&l&&(i+=$t(l))):a===`
30
+ `&&(s&&l&&(i+=$t(s)),n&&(i+=yt(n)))}return i};function _t(r,e,t){return String(r).normalize().replace(/\r\n/g,`
31
31
  `).split(`
32
- `).map(i=>Gu(i,e,t)).join(`
33
- `)}var Nu=["up","down","left","right","space","enter","cancel"],Z={actions:new Set(Nu),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]])};function He(r,e){if(typeof r=="string")return Z.aliases.get(r)===e;for(let t of r)if(t!==void 0&&He(t,e))return!0;return!1}function Ru(r,e){if(r===e)return;let t=r.split(`
32
+ `).map(i=>Qu(i,e,t)).join(`
33
+ `)}var Xu=["up","down","left","right","space","enter","cancel"],ee={actions:new Set(Xu),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]])};function Ie(r,e){if(typeof r=="string")return ee.aliases.get(r)===e;for(let t of r)if(t!==void 0&&Ie(t,e))return!0;return!1}function ei(r,e){if(r===e)return;let t=r.split(`
34
34
  `),i=e.split(`
35
- `),s=[];for(let n=0;n<Math.max(t.length,i.length);n++)t[n]!==i[n]&&s.push(n);return s}var qu=globalThis.process.platform.startsWith("win"),Te=Symbol("clack:cancel");function ue(r){return r===Te}function Y(r,e){let t=r;t.isTTY&&t.setRawMode(e)}function Bt({input:r=H.stdin,output:e=H.stdout,overwrite:t=!0,hideCursor:i=!0}={}){let s=S.createInterface({input:r,output:e,prompt:"",tabSize:1});S.emitKeypressEvents(r,s),r.isTTY&&r.setRawMode(!0);let n=(u,{name:o,sequence:a})=>{let c=String(u);if(He([c,o,a],"cancel")){i&&e.write(b.cursor.show),process.exit(0);return}if(!t)return;S.moveCursor(e,o==="return"?0:-1,o==="return"?-1:0,()=>{S.clearLine(e,1,()=>{r.once("keypress",n)})})};return i&&e.write(b.cursor.hide),r.once("keypress",n),()=>{r.off("keypress",n),i&&e.write(b.cursor.show),r.isTTY&&!qu&&r.setRawMode(!1),s.terminal=!1,s.close()}}var Lu=Object.defineProperty,Uu=(r,e,t)=>e in r?Lu(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,_=(r,e,t)=>(Uu(r,typeof e!="symbol"?e+"":e,t),t),Q=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=H.stdin,output:s=H.stdout,render:n,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=n.bind(this),this._track=t,this._abortSignal=u,this.input=i,this.output=s}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)??[],s=[];for(let n of i)n.cb(...t),n.once&&s.push(()=>i.splice(i.indexOf(n),1));for(let n of s)n()}prompt(){return new Promise((e,t)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),e(Te);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let i=new Et.Writable;i._write=(s,n,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=ke.default.createInterface({input:this.input,output:i,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),ke.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),Y(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(b.cursor.show),this.output.off("resize",this.render),Y(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(b.cursor.show),this.output.off("resize",this.render),Y(this.input,!1),e(Te)})})}onKeypress(e,t){if(this.state==="error"&&(this.state="active"),t?.name&&(!this._track&&Z.aliases.has(t.name)&&this.emit("cursor",Z.aliases.get(t.name)),Z.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")}He([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
- `),Y(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=Ft(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
37
- `).length-1;this.output.write(b.cursor.move(-999,e*-1))}render(){let e=Ft(this._render(this)??"",process.stdout.columns,{hard:!0});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(b.cursor.hide);else{let t=Ru(this._prevFrame,e);if(this.restoreCursor(),t&&t?.length===1){let i=t[0];this.output.write(b.cursor.move(0,i)),this.output.write(b.erase.lines(1));let s=e.split(`
35
+ `),s=[];for(let n=0;n<Math.max(t.length,i.length);n++)t[n]!==i[n]&&s.push(n);return s}var ti=globalThis.process.platform.startsWith("win"),Ve=Symbol("clack:cancel");function M(r){return r===Ve}function X(r,e){let t=r;t.isTTY&&t.setRawMode(e)}function Pt({input:r=I.stdin,output:e=I.stdout,overwrite:t=!0,hideCursor:i=!0}={}){let s=P.createInterface({input:r,output:e,prompt:"",tabSize:1});P.emitKeypressEvents(r,s),r.isTTY&&r.setRawMode(!0);let n=(u,{name:o,sequence:D})=>{let h=String(u);if(Ie([h,o,D],"cancel")){i&&e.write(b.cursor.show),process.exit(0);return}if(!t)return;P.moveCursor(e,o==="return"?0:-1,o==="return"?-1:0,()=>{P.clearLine(e,1,()=>{r.once("keypress",n)})})};return i&&e.write(b.cursor.hide),r.once("keypress",n),()=>{r.off("keypress",n),i&&e.write(b.cursor.show),r.isTTY&&!ti&&r.setRawMode(!1),s.terminal=!1,s.close()}}var ui=Object.defineProperty,ii=(r,e,t)=>e in r?ui(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,y=(r,e,t)=>(ii(r,typeof e!="symbol"?e+"":e,t),t),q=class{constructor(e,t=!0){y(this,"input"),y(this,"output"),y(this,"_abortSignal"),y(this,"rl"),y(this,"opts"),y(this,"_render"),y(this,"_track",!1),y(this,"_prevFrame",""),y(this,"_subscribers",new Map),y(this,"_cursor",0),y(this,"state","initial"),y(this,"error",""),y(this,"value");let{input:i=I.stdin,output:s=I.stdout,render:n,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=n.bind(this),this._track=t,this._abortSignal=u,this.input=i,this.output=s}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)??[],s=[];for(let n of i)n.cb(...t),n.once&&s.push(()=>i.splice(i.indexOf(n),1));for(let n of s)n()}prompt(){return new Promise((e,t)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),e(Ve);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let i=new Bt.Writable;i._write=(s,n,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=Pe.default.createInterface({input:this.input,output:i,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),Pe.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),X(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(b.cursor.show),this.output.off("resize",this.render),X(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(b.cursor.show),this.output.off("resize",this.render),X(this.input,!1),e(Ve)})})}onKeypress(e,t){if(this.state==="error"&&(this.state="active"),t?.name&&(!this._track&&ee.aliases.has(t.name)&&this.emit("cursor",ee.aliases.get(t.name)),ee.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")}Ie([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
+ `),X(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=_t(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
37
+ `).length-1;this.output.write(b.cursor.move(-999,e*-1))}render(){let e=_t(this._render(this)??"",process.stdout.columns,{hard:!0});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(b.cursor.hide);else{let t=ei(this._prevFrame,e);if(this.restoreCursor(),t&&t?.length===1){let i=t[0];this.output.write(b.cursor.move(0,i)),this.output.write(b.erase.lines(1));let s=e.split(`
38
38
  `);this.output.write(s[i]),this._prevFrame=e,this.output.write(b.cursor.move(0,s.length-i-1));return}if(t&&t?.length>1){let i=t[0];this.output.write(b.cursor.move(0,i)),this.output.write(b.erase.down());let s=e.split(`
39
39
  `).slice(i);this.output.write(s.join(`
40
- `)),this._prevFrame=e;return}this.output.write(b.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}};var Ju;Ju=new WeakMap;var Ku=Object.defineProperty,zu=(r,e,t)=>e in r?Ku(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,gt=(r,e,t)=>(zu(r,typeof e!="symbol"?e+"":e,t),t),X=class extends Q{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 ee=class extends Q{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}${bt.default.inverse(t)}${i.join("")}`}get cursor(){return this._cursor}constructor(e){super(e),this.on("finalize",()=>{this.value||(this.value=e.defaultValue)})}};var v=$(require("node:process"),1),h=$(z(),1),se=$(we(),1);function Yu(){return v.default.platform!=="win32"?v.default.env.TERM!=="linux":!!v.default.env.CI||!!v.default.env.WT_SESSION||!!v.default.env.TERMINUS_SUBLIME||v.default.env.ConEmuTask==="{cmd::Cmder}"||v.default.env.TERM_PROGRAM==="Terminus-Sublime"||v.default.env.TERM_PROGRAM==="vscode"||v.default.env.TERM==="xterm-256color"||v.default.env.TERM==="alacritty"||v.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var je=Yu(),C=(r,e)=>je?r:e,Zu=C("\u25C6","*"),xt=C("\u25A0","x"),Ot=C("\u25B2","x"),Ie=C("\u25C7","o"),Qu=C("\u250C","T"),F=C("\u2502","|"),G=C("\u2514","\u2014"),Xu=C("\u25CF",">"),ei=C("\u25CB"," "),Yi=C("\u25FB","[\u2022]"),Zi=C("\u25FC","[+]"),Qi=C("\u25FB","[ ]"),Xi=C("\u25AA","\u2022"),wt=C("\u2500","-"),ti=C("\u256E","+"),ui=C("\u251C","+"),ii=C("\u256F","+"),es=C("\u25CF","\u2022"),ts=C("\u25C6","*"),us=C("\u25B2","!"),is=C("\u25A0","x"),St=r=>{switch(r){case"initial":case"active":return h.default.cyan(Zu);case"cancel":return h.default.red(xt);case"error":return h.default.yellow(Ot);case"submit":return h.default.green(Ie)}},si=r=>{let{cursor:e,options:t,style:i}=r,s=r.maxItems??Number.POSITIVE_INFINITY,n=Math.max(process.stdout.rows-4,0),u=Math.min(n,Math.max(s,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 g=l===0&&a,B=l===p.length-1&&c;return g||B?h.default.dim("..."):i(D,l+o===e)})},kt=r=>new ee({validate:r.validate,placeholder:r.placeholder,defaultValue:r.defaultValue,initialValue:r.initialValue,render(){let e=`${h.default.gray(F)}
41
- ${St(this.state)} ${r.message}
42
- `,t=r.placeholder?h.default.inverse(r.placeholder[0])+h.default.dim(r.placeholder.slice(1)):h.default.inverse(h.default.hidden("_")),i=this.value?this.valueWithCursor:t;switch(this.state){case"error":return`${e.trim()}
43
- ${h.default.yellow(F)} ${i}
44
- ${h.default.yellow(G)} ${h.default.yellow(this.error)}
45
- `;case"submit":return`${e}${h.default.gray(F)} ${h.default.dim(this.value||r.placeholder)}`;case"cancel":return`${e}${h.default.gray(F)} ${h.default.strikethrough(h.default.dim(this.value??""))}${this.value?.trim()?`
46
- ${h.default.gray(F)}`:""}`;default:return`${e}${h.default.cyan(F)} ${i}
47
- ${h.default.cyan(G)}
48
- `}}}).prompt();var Tt=r=>{let e=(t,i)=>{let s=t.label??String(t.value);switch(i){case"selected":return`${h.default.dim(s)}`;case"active":return`${h.default.green(Xu)} ${s} ${t.hint?h.default.dim(`(${t.hint})`):""}`;case"cancelled":return`${h.default.strikethrough(h.default.dim(s))}`;default:return`${h.default.dim(ei)} ${h.default.dim(s)}`}};return new X({options:r.options,initialValue:r.initialValue,render(){let t=`${h.default.gray(F)}
49
- ${St(this.state)} ${r.message}
50
- `;switch(this.state){case"submit":return`${t}${h.default.gray(F)} ${e(this.options[this.cursor],"selected")}`;case"cancel":return`${t}${h.default.gray(F)} ${e(this.options[this.cursor],"cancelled")}
51
- ${h.default.gray(F)}`;default:return`${t}${h.default.cyan(F)} ${si({cursor:this.cursor,options:this.options,maxItems:r.maxItems,style:(i,s)=>e(i,s?"active":"inactive")}).join(`
52
- ${h.default.cyan(F)} `)}
53
- ${h.default.cyan(G)}
54
- `}}}).prompt()};var Me=(r="",e="")=>{let t=`
40
+ `)),this._prevFrame=e;return}this.output.write(b.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}};var si;si=new WeakMap;var ri=Object.defineProperty,ni=(r,e,t)=>e in r?ri(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,vt=(r,e,t)=>(ni(r,typeof e!="symbol"?e+"":e,t),t),Vt=class extends q{constructor(r){super(r,!1),vt(this,"options"),vt(this,"cursor",0),this.options=r.options,this.value=[...r.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:e})=>e===r.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 r=this.value.length===this.options.length;this.value=r?[]:this.options.map(e=>e.value)}toggleValue(){let r=this.value.includes(this._value);this.value=r?this.value.filter(e=>e!==this._value):[...this.value,this._value]}};var oi=Object.defineProperty,Di=(r,e,t)=>e in r?oi(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,At=(r,e,t)=>(Di(r,typeof e!="symbol"?e+"":e,t),t),te=class extends q{constructor(e){super(e,!1),At(this,"options"),At(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 ue=class extends q{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}${wt.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=$(require("node:process"),1),c=$(Q(),1),re=$(Oe(),1);function ai(){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 Me=ai(),F=(r,e)=>Me?r:e,li=F("\u25C6","*"),It=F("\u25A0","x"),Mt=F("\u25B2","x"),Ge=F("\u25C7","o"),ci=F("\u250C","T"),d=F("\u2502","|"),V=F("\u2514","\u2014"),hi=F("\u25CF",">"),pi=F("\u25CB"," "),mi=F("\u25FB","[\u2022]"),jt=F("\u25FC","[+]"),di=F("\u25FB","[ ]"),hs=F("\u25AA","\u2022"),Ht=F("\u2500","-"),fi=F("\u256E","+"),Ci=F("\u251C","+"),Fi=F("\u256F","+"),ps=F("\u25CF","\u2022"),ms=F("\u25C6","*"),ds=F("\u25B2","!"),fs=F("\u25A0","x"),Ne=r=>{switch(r){case"initial":case"active":return c.default.cyan(li);case"cancel":return c.default.red(It);case"error":return c.default.yellow(Mt);case"submit":return c.default.green(Ge)}},We=r=>{let{cursor:e,options:t,style:i}=r,s=r.maxItems??Number.POSITIVE_INFINITY,n=Math.max(process.stdout.rows-4,0),u=Math.min(n,Math.max(s,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 D=u<t.length&&o>0,h=u<t.length&&o+u<t.length;return t.slice(o,o+u).map((a,l,p)=>{let g=l===0&&D,w=l===p.length-1&&h;return g||w?c.default.dim("..."):i(a,l+o===e)})},Wt=r=>new ue({validate:r.validate,placeholder:r.placeholder,defaultValue:r.defaultValue,initialValue:r.initialValue,render(){let e=`${c.default.gray(d)}
41
+ ${Ne(this.state)} ${r.message}
42
+ `,t=r.placeholder?c.default.inverse(r.placeholder[0])+c.default.dim(r.placeholder.slice(1)):c.default.inverse(c.default.hidden("_")),i=this.value?this.valueWithCursor:t;switch(this.state){case"error":return`${e.trim()}
43
+ ${c.default.yellow(d)} ${i}
44
+ ${c.default.yellow(V)} ${c.default.yellow(this.error)}
45
+ `;case"submit":return`${e}${c.default.gray(d)} ${c.default.dim(this.value||r.placeholder)}`;case"cancel":return`${e}${c.default.gray(d)} ${c.default.strikethrough(c.default.dim(this.value??""))}${this.value?.trim()?`
46
+ ${c.default.gray(d)}`:""}`;default:return`${e}${c.default.cyan(d)} ${i}
47
+ ${c.default.cyan(V)}
48
+ `}}}).prompt();var Re=r=>{let e=(t,i)=>{let s=t.label??String(t.value);switch(i){case"selected":return`${c.default.dim(s)}`;case"active":return`${c.default.green(hi)} ${s} ${t.hint?c.default.dim(`(${t.hint})`):""}`;case"cancelled":return`${c.default.strikethrough(c.default.dim(s))}`;default:return`${c.default.dim(pi)} ${c.default.dim(s)}`}};return new te({options:r.options,initialValue:r.initialValue,render(){let t=`${c.default.gray(d)}
49
+ ${Ne(this.state)} ${r.message}
50
+ `;switch(this.state){case"submit":return`${t}${c.default.gray(d)} ${e(this.options[this.cursor],"selected")}`;case"cancel":return`${t}${c.default.gray(d)} ${e(this.options[this.cursor],"cancelled")}
51
+ ${c.default.gray(d)}`;default:return`${t}${c.default.cyan(d)} ${We({cursor:this.cursor,options:this.options,maxItems:r.maxItems,style:(i,s)=>e(i,s?"active":"inactive")}).join(`
52
+ ${c.default.cyan(d)} `)}
53
+ ${c.default.cyan(V)}
54
+ `}}}).prompt()};var Gt=r=>{let e=(t,i)=>{let s=t.label??String(t.value);return i==="active"?`${c.default.cyan(mi)} ${s} ${t.hint?c.default.dim(`(${t.hint})`):""}`:i==="selected"?`${c.default.green(jt)} ${c.default.dim(s)} ${t.hint?c.default.dim(`(${t.hint})`):""}`:i==="cancelled"?`${c.default.strikethrough(c.default.dim(s))}`:i==="active-selected"?`${c.default.green(jt)} ${s} ${t.hint?c.default.dim(`(${t.hint})`):""}`:i==="submitted"?`${c.default.dim(s)}`:`${c.default.dim(di)} ${c.default.dim(s)}`};return new Vt({options:r.options,initialValues:r.initialValues,required:r.required??!0,cursorAt:r.cursorAt,validate(t){if(this.required&&t.length===0)return`Please select at least one option.
55
+ ${c.default.reset(c.default.dim(`Press ${c.default.gray(c.default.bgWhite(c.default.inverse(" space ")))} to select, ${c.default.gray(c.default.bgWhite(c.default.inverse(" enter ")))} to submit`))}`},render(){let t=`${c.default.gray(d)}
56
+ ${Ne(this.state)} ${r.message}
57
+ `,i=(s,n)=>{let u=this.value.includes(s.value);return n&&u?e(s,"active-selected"):u?e(s,"selected"):e(s,n?"active":"inactive")};switch(this.state){case"submit":return`${t}${c.default.gray(d)} ${this.options.filter(({value:s})=>this.value.includes(s)).map(s=>e(s,"submitted")).join(c.default.dim(", "))||c.default.dim("none")}`;case"cancel":{let s=this.options.filter(({value:n})=>this.value.includes(n)).map(n=>e(n,"cancelled")).join(c.default.dim(", "));return`${t}${c.default.gray(d)} ${s.trim()?`${s}
58
+ ${c.default.gray(d)}`:""}`}case"error":{let s=this.error.split(`
59
+ `).map((n,u)=>u===0?`${c.default.yellow(V)} ${c.default.yellow(n)}`:` ${n}`).join(`
60
+ `);return`${t+c.default.yellow(d)} ${We({options:this.options,cursor:this.cursor,maxItems:r.maxItems,style:i}).join(`
61
+ ${c.default.yellow(d)} `)}
62
+ ${s}
63
+ `}default:return`${t}${c.default.cyan(d)} ${We({options:this.options,cursor:this.cursor,maxItems:r.maxItems,style:i}).join(`
64
+ ${c.default.cyan(d)} `)}
65
+ ${c.default.cyan(V)}
66
+ `}}}).prompt()};var ne=(r="",e="")=>{let t=`
55
67
  ${r}
56
68
  `.split(`
57
- `),i=(0,ie.stripVTControlCharacters)(e).length,s=Math.max(t.reduce((u,o)=>{let a=(0,ie.stripVTControlCharacters)(o);return a.length>u?a.length:u},0),i)+2,n=t.map(u=>`${h.default.gray(F)} ${h.default.dim(u)}${" ".repeat(s-(0,ie.stripVTControlCharacters)(u).length)}${h.default.gray(F)}`).join(`
58
- `);process.stdout.write(`${h.default.gray(F)}
59
- ${h.default.green(Ie)} ${h.default.reset(e)} ${h.default.gray(wt.repeat(Math.max(s-i-1,1))+ti)}
69
+ `),i=(0,se.stripVTControlCharacters)(e).length,s=Math.max(t.reduce((u,o)=>{let D=(0,se.stripVTControlCharacters)(o);return D.length>u?D.length:u},0),i)+2,n=t.map(u=>`${c.default.gray(d)} ${c.default.dim(u)}${" ".repeat(s-(0,se.stripVTControlCharacters)(u).length)}${c.default.gray(d)}`).join(`
70
+ `);process.stdout.write(`${c.default.gray(d)}
71
+ ${c.default.green(Ge)} ${c.default.reset(e)} ${c.default.gray(Ht.repeat(Math.max(s-i-1,1))+fi)}
60
72
  ${n}
61
- ${h.default.gray(ui+wt.repeat(s+2)+ii)}
62
- `)},T=(r="")=>{process.stdout.write(`${h.default.gray(G)} ${h.default.red(r)}
73
+ ${c.default.gray(Ci+Ht.repeat(s+2)+Fi)}
74
+ `)},T=(r="")=>{process.stdout.write(`${c.default.gray(V)} ${c.default.red(r)}
63
75
 
64
- `)},We=(r="")=>{process.stdout.write(`${h.default.gray(Qu)} ${r}
65
- `)},Vt=(r="")=>{process.stdout.write(`${h.default.gray(F)}
66
- ${h.default.gray(G)} ${r}
76
+ `)},qe=(r="")=>{process.stdout.write(`${c.default.gray(ci)} ${r}
77
+ `)},Nt=(r="")=>{process.stdout.write(`${c.default.gray(d)}
78
+ ${c.default.gray(V)} ${r}
67
79
 
68
- `)};var ss=`${h.default.gray(F)} `;var j=({indicator:r="dots"}={})=>{let e=je?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],t=je?80:120,i=process.env.CI==="true",s,n,u=!1,o="",a,c=performance.now(),D=E=>{let y=E>1?"Something went wrong":"Canceled";u&&Je(y,E)},l=()=>D(2),p=()=>D(1),g=()=>{process.on("uncaughtExceptionMonitor",l),process.on("unhandledRejection",l),process.on("SIGINT",p),process.on("SIGTERM",p),process.on("exit",D)},B=()=>{process.removeListener("uncaughtExceptionMonitor",l),process.removeListener("unhandledRejection",l),process.removeListener("SIGINT",p),process.removeListener("SIGTERM",p),process.removeListener("exit",D)},Le=()=>{if(a===void 0)return;i&&process.stdout.write(`
69
- `);let E=a.split(`
70
- `);process.stdout.write(se.cursor.move(-999,E.length-1)),process.stdout.write(se.erase.down(E.length))},De=E=>E.replace(/\.+$/,""),Ue=E=>{let y=(performance.now()-E)/1e3,w=Math.floor(y/60),P=Math.floor(y%60);return w>0?`[${w}m ${P}s]`:`[${P}s]`},Zt=(E="")=>{u=!0,s=Bt(),o=De(E),c=performance.now(),process.stdout.write(`${h.default.gray(F)}
71
- `);let y=0,w=0;g(),n=setInterval(()=>{if(i&&o===a)return;Le(),a=o;let P=h.default.magenta(e[y]);if(i)process.stdout.write(`${P} ${o}...`);else if(r==="timer")process.stdout.write(`${P} ${o} ${Ue(c)}`);else{let Qt=".".repeat(Math.floor(w)).slice(0,3);process.stdout.write(`${P} ${o}${Qt}`)}y=y+1<e.length?y+1:0,w=w<e.length?w+.125:0},t)},Je=(E="",y=0)=>{u=!1,clearInterval(n),Le();let w=y===0?h.default.green(Ie):y===1?h.default.red(xt):h.default.red(Ot);o=De(E??o),r==="timer"?process.stdout.write(`${w} ${o} ${Ue(c)}
72
- `):process.stdout.write(`${w} ${o}
73
- `),B(),s()};return{start:Zt,stop:Je,message:(E="")=>{o=De(E??o)}}};var qt=require("child_process"),k=require("fs"),Lt=require("os"),Ut=require("path");var I=$(require("fs")),Ge=$(require("path")),Pt=r=>{let e=[],t=[],i=[];for(let s of r){let n=Ge.default.join(process.cwd(),s.resolvedPath);if(!s.isNotEnabled)try{if(I.default.mkdirSync(Ge.default.dirname(n),{recursive:!0}),s.templateType==="add")if(I.default.existsSync(n)&&I.default.lstatSync(n).isFile()){i.push(`File already exists: ${n}`);continue}else{if(s.pathError||s.templateError){i.push(`Failed to create file: ${n} because of error: ${s.templateError}`);continue}I.default.writeFileSync(n,s.resolvedTemplate),e.push(n)}else s.templateType==="modify"&&(s.modifiedFileContent?(I.default.writeFileSync(n,s.modifiedFileContent),t.push(n)):i.push(`Failed to modify file: ${n} because of error: ${s.templateError}`))}catch(u){i.push(u instanceof Error?u.message:String(u))}}return{addResults:e,modifyResults:t,errors:i}};var Jt=$(It());var Re=$(z());function Mt(r){let e={name:"root",type:"directory",children:[],path:""},t=r.map(i=>i.replace(/^\//,"").replace(/\\/g,"/")).sort();for(let i of t){let s=i.split("/").filter(Boolean),n=e;s.forEach((u,o)=>{let a=o===s.length-1,c=n.children?.find(D=>D.name===u);if(c)n=c;else{let D={name:u,type:a?"file":"directory",children:a?void 0:[],path:s.slice(0,o+1).join("/")};n.children||(n.children=[]),n.children.push(D),n=D}})}return e}function re(r,e="",t=!0,i=!0){if(i&&r.children)return r.children.map((a,c)=>re(a,"",c===r.children.length-1,!1)).join(`
74
- `);let s=t?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",n=r.type==="directory"?"\u{1F4C1} ":"\u{1F4C4} ",u=r.type==="directory"?Re.default.cyan(r.name+"/"):Re.default.green(r.name),o=e+s+n+u+`
75
- `;if(r.children&&r.children.length>0){let a=e+(t?" ":"\u2502 ");r.children.forEach((c,D)=>{o+=re(c,a,D===r.children.length-1,!1)})}return o}var ne=new at,oe=new Jt.default;async function Ci(r){let e=(0,Ut.join)((0,Lt.tmpdir)(),`cli-edit-${Date.now()}.json`);(0,k.writeFileSync)(e,JSON.stringify(r,null,2));let t=process.env.VISUAL||process.env.EDITOR||"nano";return new Promise((i,s)=>{(0,qt.spawn)(t,[e],{stdio:"inherit"}).on("exit",u=>{if(u===0)try{let o=(0,k.readFileSync)(e,"utf-8"),a=JSON.parse(o);(0,k.unlinkSync)(e),i(a)}catch{(0,k.unlinkSync)(e),s(new Error("Invalid JSON format"))}else(0,k.unlinkSync)(e),s(new Error("Editor closed without saving"))})})}async function Rt(r,e){let t=j();t.start(`Modifying block input for ${e}`);let i=await oe.getBlockInputFromUserQuery(JSON.stringify(r),e);return t.stop("Block input modified"),Kt(i.result,"Refined Block Input"),i.result}function Kt(r,e="Block Input"){Me(JSON.stringify(r,null,2),e)}function zt(r,e){return oe.resolveMultipleTemplates(r,e)}async function Yt(r,e){let i=(await zt(r,e)).result.files.map(u=>u.resolvedPath),s=Mt(i),n=re(s);Me(n,"\u{1F4E6} Files to be created:")}async function qe(r,e){let t=j();t.start("Resolving Files...");let i=await zt(r,e),s=Pt(i.result.files);s.errors?.length&&console.log(s.errors,"errors"),t.stop(`${s.addResults.length} files added, ${s.modifyResults.length} files modified, ${s.errors.length} errors`)}async function Fi(r,e,t){We(`Add block: ${r}`);let i=!1,s=!1,n=j();n.start("Fetching block...");let u=await oe.fetchBlock(r);if(u?.result?.id)n.stop(`Block Found '${u.result.name}' ${u.result.input?"with input":""}`);else{n.stop("Block Not Found");return}let o=t||u.result.input;for(t&&(qe(r,t),i=!0),o||(qe(r,{}),i=!0),o&&e&&!t&&(o=Rt(o,e),s=!0);!i&&o&&!e;){Kt(o);let c=await Tt({message:"What would you like to do?",options:[{value:"refine",label:"Edit (AI)"},{value:"edit",label:"Edit (Editor)"},{value:"restart",label:"Start over"},{value:"showFiles",label:"Show files to be created"},{value:"done",label:"Insert Files \u2705"}]});if(ue(c)&&(T("Operation cancelled."),process.exit(0)),c==="refine"){let D=await kt({message:"Describe what to refine:"});o=await Rt(o,D),s=!0}c==="edit"&&(o=await Ci(o)),c==="done"&&(await qe(r,o),i=!0),c==="showFiles"&&Yt(r,o),c==="restart"&&(i=!1,s=!1,o=u.result.input)}}ne.command("help").description("List all commands and usage").action(()=>{console.log(`
80
+ `)};var Cs=`${c.default.gray(d)} `;var W=({indicator:r="dots"}={})=>{let e=Me?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],t=Me?80:120,i=process.env.CI==="true",s,n,u=!1,o="",D,h=performance.now(),a=E=>{let _=E>1?"Something went wrong":"Canceled";u&&Xe(_,E)},l=()=>a(2),p=()=>a(1),g=()=>{process.on("uncaughtExceptionMonitor",l),process.on("unhandledRejection",l),process.on("SIGINT",p),process.on("SIGTERM",p),process.on("exit",a)},w=()=>{process.removeListener("uncaughtExceptionMonitor",l),process.removeListener("unhandledRejection",l),process.removeListener("SIGINT",p),process.removeListener("SIGTERM",p),process.removeListener("exit",a)},Ze=()=>{if(D===void 0)return;i&&process.stdout.write(`
81
+ `);let E=D.split(`
82
+ `);process.stdout.write(re.cursor.move(-999,E.length-1)),process.stdout.write(re.erase.down(E.length))},le=E=>E.replace(/\.+$/,""),Qe=E=>{let _=(performance.now()-E)/1e3,O=Math.floor(_/60),H=Math.floor(_%60);return O>0?`[${O}m ${H}s]`:`[${H}s]`},Du=(E="")=>{u=!0,s=Pt(),o=le(E),h=performance.now(),process.stdout.write(`${c.default.gray(d)}
83
+ `);let _=0,O=0;g(),n=setInterval(()=>{if(i&&o===D)return;Ze(),D=o;let H=c.default.magenta(e[_]);if(i)process.stdout.write(`${H} ${o}...`);else if(r==="timer")process.stdout.write(`${H} ${o} ${Qe(h)}`);else{let au=".".repeat(Math.floor(O)).slice(0,3);process.stdout.write(`${H} ${o}${au}`)}_=_+1<e.length?_+1:0,O=O<e.length?O+.125:0},t)},Xe=(E="",_=0)=>{u=!1,clearInterval(n),Ze();let O=_===0?c.default.green(Ge):_===1?c.default.red(It):c.default.red(Mt);o=le(E??o),r==="timer"?process.stdout.write(`${O} ${o} ${Qe(h)}
84
+ `):process.stdout.write(`${O} ${o}
85
+ `),w(),s()};return{start:Du,stop:Xe,message:(E="")=>{o=le(E??o)}}};var uu=require("child_process"),B=require("fs"),iu=require("os"),Ye=require("path");var G=$(require("fs")),Le=$(require("path")),Rt=(r,e=[],t=!1)=>{let i=[],s=[],n=[];for(let u of r){let o=Le.default.join(process.cwd(),u.resolvedPath);if(!u.isNotEnabled)try{if(G.default.mkdirSync(Le.default.dirname(o),{recursive:!0}),u.templateType==="add"){let D=G.default.existsSync(o)&&G.default.lstatSync(o).isFile(),h=t||e.includes(u.resolvedPath);if(D&&!h){n.push(`File already exists: ${o}`);continue}else{if(u.pathError||u.templateError){n.push(`Failed to create file: ${o} because of error: ${u.templateError}`);continue}G.default.writeFileSync(o,u.resolvedTemplate),i.push(o)}}else u.templateType==="modify"&&(u.modifiedFileContent?(G.default.writeFileSync(o,u.modifiedFileContent),s.push(o)):n.push(`Failed to modify file: ${o} because of error: ${u.templateError}`))}catch(D){n.push(D instanceof Error?D.message:String(D))}}return{addResults:i,modifyResults:s,errors:n}};var su=$(Ut());var Je=$(Q());function Jt(r){let e={name:"root",type:"directory",children:[],path:""},t=r.map(i=>i.replace(/^\//,"").replace(/\\/g,"/")).sort();for(let i of t){let s=i.split("/").filter(Boolean),n=e;s.forEach((u,o)=>{let D=o===s.length-1,h=n.children?.find(a=>a.name===u);if(h)n=h;else{let a={name:u,type:D?"file":"directory",children:D?void 0:[],path:s.slice(0,o+1).join("/")};n.children||(n.children=[]),n.children.push(a),n=a}})}return e}function oe(r,e="",t=!0,i=!0){if(i&&r.children)return r.children.map((D,h)=>oe(D,"",h===r.children.length-1,!1)).join(`
86
+ `);let s=t?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",n=r.type==="directory"?"\u{1F4C1} ":"\u{1F4C4} ",u=r.type==="directory"?Je.default.cyan(r.name+"/"):Je.default.green(r.name),o=e+s+n+u+`
87
+ `;if(r.children&&r.children.length>0){let D=e+(t?" ":"\u2502 ");r.children.forEach((h,a)=>{o+=oe(h,D,a===r.children.length-1,!1)})}return o}var x=require("fs"),Ke=require("path"),xi=".derived",Oi="blocks.json";function Kt(){return(0,Ke.join)(process.cwd(),xi)}function zt(){return(0,Ke.join)(Kt(),Oi)}function Yt(r){let e=zt();if(!(0,x.existsSync)(e))return!1;try{let t=(0,x.readFileSync)(e,"utf-8"),i=JSON.parse(t);return Array.isArray(i.addedBlocks)&&i.addedBlocks.includes(r)}catch{return!1}}function Zt(r){let e=Kt(),t=zt();(0,x.existsSync)(e)||(0,x.mkdirSync)(e,{recursive:!0});let i=[];if((0,x.existsSync)(t))try{let s=(0,x.readFileSync)(t,"utf-8"),n=JSON.parse(s);Array.isArray(n.addedBlocks)&&(i=n.addedBlocks)}catch{}i.includes(r)||(i.push(r),(0,x.writeFileSync)(t,JSON.stringify({addedBlocks:i},null,2)))}var De=new dt,ae=new su.default;async function Ti(r){let e=(0,Ye.join)((0,iu.tmpdir)(),`cli-edit-${Date.now()}.json`);(0,B.writeFileSync)(e,JSON.stringify(r,null,2));let t=process.env.VISUAL||process.env.EDITOR||"nano";return new Promise((i,s)=>{(0,uu.spawn)(t,[e],{stdio:"inherit"}).on("exit",u=>{if(u===0)try{let o=(0,B.readFileSync)(e,"utf-8"),D=JSON.parse(o);(0,B.unlinkSync)(e),i(D)}catch{(0,B.unlinkSync)(e),s(new Error("Invalid JSON format"))}else(0,B.unlinkSync)(e),s(new Error("Editor closed without saving"))})})}async function tu(r,e){let t=W();t.start(`Modifying block input for ${e}`);let i=await ae.getBlockInputFromUserQuery(JSON.stringify(r),e);return t.stop("Block input modified"),ru(i.result,"Refined Block Input"),i.result}function ru(r,e="Block Input"){ne(JSON.stringify(r,null,2),e)}function nu(r,e){return ae.resolveMultipleTemplates(r,e)}async function ou(r,e){let t=await nu(r,e),i=t.result.files.map(u=>u.resolvedPath),s=Jt(i),n=oe(s);ne(n,`\u{1F4E6} Files to be created (${t.result.files.length}):`)}async function ze(r,e,t=!1){let i=W();i.start("Resolving Files...");let s=await nu(r,e),n=s.result.files.filter(h=>{let a=(0,Ye.join)(process.cwd(),h.resolvedPath);return(0,B.existsSync)(a)&&(0,B.lstatSync)(a).isFile()&&h.templateType==="add"}),u=[],o=t;if(n.length>0&&!t){i.stop(`${n.length} conflicting files detected`);let h=await Re({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(M(h)&&(T("Operation cancelled."),process.exit(0)),h==="overwrite-all")o=!0;else if(h==="select"){let a=await Gt({message:"Select files to overwrite",options:n.map(l=>({value:l.resolvedPath,label:l.resolvedPath}))});M(a)&&(T("Operation cancelled."),process.exit(0)),u=a}i.start("Generating files...")}let D=Rt(s.result.files,u,o);D.errors?.length&&console.log(D.errors,"errors"),i.stop(`${D.addResults.length} files added, ${D.modifyResults.length} files modified, ${D.errors.length} errors`),(D.addResults.length>0||D.modifyResults.length>0)&&Zt(r)}async function Pi(r,e,t,i=!1){qe(`Add block: ${r}`);let s=!1,n=!1,u=W();u.start("Fetching block...");let o=await ae.fetchBlock(r);if(o?.result?.id)u.stop(`Block Found '${o.result.name}' ${o.result.input?"with input":""}`);else{u.stop("Block Not Found");return}let D=t||o.result.input;for(t&&(ze(r,t,i),s=!0),D||(ze(r,{},i),s=!0),D&&e&&!t&&(D=tu(D,e),n=!0);!s&&D&&!e;){ru(D);let a=await Re({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 \u2705"}]});if(M(a)&&(T("Operation cancelled."),process.exit(0)),a==="refine"){let l=await Wt({message:"Describe what to refine:"});D=await tu(D,l),n=!0}a==="edit"&&(D=await Ti(D)),a==="done"&&(await ze(r,D,i),s=!0),a==="showFiles"&&ou(r,D)}}De.command("help").description("List all commands and usage").action(()=>{console.log(`
76
88
  Available commands:
77
89
 
78
90
  add <block-id>
79
91
  Runs the interactive JSON builder with clack prompts.
80
- Example: derived-cli add hero-section
92
+ Use --overwrite to automatically overwrite existing files.
93
+ Example: derived-cli add hero-section --overwrite
81
94
 
82
95
  init <project-slug>
83
96
  Initialize a project from a template in the current directory.
@@ -87,4 +100,4 @@ Available commands:
87
100
 
88
101
  help
89
102
  Show this help text.
90
- `)});var gi=r=>{let e=j();try{e.start("Decoding base64...");let t=Buffer.from(r,"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}};ne.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").action(async(r,e)=>{let t=e.blockInput?gi(e.blockInput):null;await Fi(r,e.query,t)});ne.command("init <project-slug>").description("Initialize a project from a template").action(async r=>{We(`\u{1F680} Initializing project: ${r}`);try{let e=process.cwd(),{isDirectoryEmpty:t,removeGitDirectory:i}=await Promise.resolve().then(()=>(Nt(),Gt));t(e)||(T("\u274C Error: Current directory is not empty. Please run this command in an empty directory."),process.exit(1));let s=j();s.start("Fetching project details...");let n=await oe.fetchProjectBySlug(r);n?.result||(s.stop("\u274C Project not found"),T(`Project with slug '${r}' does not exist.`),process.exit(1));let u=n.result;s.stop(`\u2705 Found project: ${u.name}`),s.start(`Cloning repository from ${u.gitUrl}...`);let{execSync:o}=await import("child_process");try{o(`git clone ${u.gitUrl} .`,{stdio:"pipe",cwd:e}),s.stop("\u2705 Repository cloned successfully")}catch(a){s.stop("\u274C Failed to clone repository"),T(`Git clone failed: ${a.message}`),process.exit(1)}if(i(e),u.setupCommand&&u.setupCommand.trim()){let a=u.setupCommand.split(",").map(c=>c.trim());for(let c of a)if(c){s.start(`Running: ${c}`);try{o(c,{stdio:"inherit",cwd:e}),s.stop(`\u2705 Completed: ${c}`)}catch(D){s.stop(`\u26A0\uFE0F Warning: Command failed: ${c}`),console.warn(` ${D.message}`)}}}Vt(`\u{1F389} Project '${u.name}' setup successfully!`)}catch(e){T(`\u274C An error occurred: ${e.message}`),process.exit(1)}});ne.parse();0&&(module.exports={displayFileTree});
103
+ `)});var Vi=r=>{let e=W();try{e.start("Decoding base64...");let t=Buffer.from(r,"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}};De.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").action(async(r,e)=>{if(Yt(r)){ne(`Block "${r}" is already added to this project.`,"Already Added");return}let t=e.blockInput?Vi(e.blockInput):null;await Pi(r,e.query,t,e.overwrite)});De.command("init <project-slug>").description("Initialize a project from a template").action(async r=>{qe(`\u{1F680} Initializing project: ${r}`);try{let e=process.cwd(),{isDirectoryEmpty:t,removeGitDirectory:i}=await Promise.resolve().then(()=>(eu(),Xt));t(e)||(T("\u274C Error: Current directory is not empty. Please run this command in an empty directory."),process.exit(1));let s=W();s.start("Fetching project details...");let n=await ae.fetchProjectBySlug(r);n?.result||(s.stop("\u274C Project not found"),T(`Project with slug '${r}' does not exist.`),process.exit(1));let u=n.result;s.stop(`\u2705 Found project: ${u.name}`),s.start(`Cloning repository from ${u.gitUrl}...`);let{execSync:o}=await import("child_process");try{o(`git clone ${u.gitUrl} .`,{stdio:"pipe",cwd:e}),s.stop("\u2705 Repository cloned successfully")}catch(D){s.stop("\u274C Failed to clone repository"),T(`Git clone failed: ${D.message}`),process.exit(1)}if(i(e),u.setupCommand&&u.setupCommand.trim()){let D=u.setupCommand.split(",").map(h=>h.trim());for(let h of D)if(h){s.start(`Running: ${h}`);try{o(h,{stdio:"inherit",cwd:e}),s.stop(`\u2705 Completed: ${h}`)}catch(a){s.stop(`\u26A0\uFE0F Warning: Command failed: ${h}`),console.warn(` ${a.message}`)}}}Nt(`\u{1F389} Project '${u.name}' setup successfully!`)}catch(e){T(`\u274C An error occurred: ${e.message}`),process.exit(1)}});De.parse();0&&(module.exports={displayFileTree});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "derived-cli",
3
- "version": "0.0.36",
3
+ "version": "0.0.38",
4
4
  "description": "CLI for Derived",
5
5
  "author": "Derived",
6
6
  "license": "MIT",