aicommits 1.5.1 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +86 -15
- package/dist/cli.mjs +79 -68
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -56,14 +56,28 @@ git add <files...>
|
|
|
56
56
|
aicommits
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
`aicommits` passes down unknown flags to `git commit`, so you can pass in [`commit` flags](https://git-scm.com/docs/git-commit)
|
|
59
|
+
`aicommits` passes down unknown flags to `git commit`, so you can pass in [`commit` flags](https://git-scm.com/docs/git-commit).
|
|
60
60
|
|
|
61
|
+
For example, you can stage all changes in tracked files with as you commit:
|
|
61
62
|
```sh
|
|
62
|
-
aicommits --
|
|
63
|
+
aicommits --all # or -a
|
|
63
64
|
```
|
|
64
65
|
|
|
65
66
|
> 👉 **Tip:** Use the `aic` alias if `aicommits` is too long for you.
|
|
66
67
|
|
|
68
|
+
#### Generate multiple recommendations
|
|
69
|
+
|
|
70
|
+
Sometimes the recommended commit message isn't the best so you want it to generate a few to pick from. You can generate multiple commit messages at once by passing in the `--generate <i>` flag, where 'i' is the number of generated messages:
|
|
71
|
+
```sh
|
|
72
|
+
aicommits --generate <i> # or -g <i>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
> Warning: this uses more tokens, meaning it costs more.
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
aicommits --all
|
|
79
|
+
```
|
|
80
|
+
|
|
67
81
|
### Git hook
|
|
68
82
|
|
|
69
83
|
You can also integrate _aicommits_ with Git via the [`prepare-commit-msg`](https://git-scm.com/docs/githooks#_prepare_commit_msg) hook. This lets you use Git like you normally would, and edit the commit message before committing.
|
|
@@ -96,6 +110,75 @@ aicommits hook uninstall
|
|
|
96
110
|
|
|
97
111
|
3. Save and close the editor to commit!
|
|
98
112
|
|
|
113
|
+
## Configuration
|
|
114
|
+
|
|
115
|
+
### Reading a configuration value
|
|
116
|
+
To retrieve a configuration option, use the command:
|
|
117
|
+
|
|
118
|
+
```sh
|
|
119
|
+
aicommits config get <key>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
For example, to retrieve the API key, you can use:
|
|
123
|
+
```sh
|
|
124
|
+
aicommits config get OPENAI_KEY
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
You can also retrieve multiple configuration options at once by separating them with spaces:
|
|
128
|
+
|
|
129
|
+
```sh
|
|
130
|
+
aicommits config get OPENAI_KEY generate
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Setting a configuration value
|
|
134
|
+
|
|
135
|
+
To set a configuration option, use the command:
|
|
136
|
+
|
|
137
|
+
```sh
|
|
138
|
+
aicommits config set <key>=<value>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
For example, to set the API key, you can use:
|
|
142
|
+
|
|
143
|
+
```sh
|
|
144
|
+
aicommits config set OPENAI_KEY=<your-api-key>
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
You can also set multiple configuration options at once by separating them with spaces, like
|
|
148
|
+
|
|
149
|
+
```sh
|
|
150
|
+
aicommits config set OPENAI_KEY=<your-api-key> generate=3 locale=en
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Options
|
|
154
|
+
#### OPENAI_KEY
|
|
155
|
+
|
|
156
|
+
Required
|
|
157
|
+
|
|
158
|
+
The OpenAI API key. You can retrieve it from [OpenAI API Keys page](https://platform.openai.com/account/api-keys).
|
|
159
|
+
|
|
160
|
+
#### locale
|
|
161
|
+
Default: `en`
|
|
162
|
+
|
|
163
|
+
The locale to use for the generated commit messages. Consult the list of codes in: https://wikipedia.org/wiki/List_of_ISO_639-1_codes.
|
|
164
|
+
|
|
165
|
+
#### generate
|
|
166
|
+
|
|
167
|
+
Default: `1`
|
|
168
|
+
|
|
169
|
+
The number of commit messages to generate to pick from.
|
|
170
|
+
|
|
171
|
+
Note, this will use more tokens as it generates more results.
|
|
172
|
+
|
|
173
|
+
#### proxy
|
|
174
|
+
|
|
175
|
+
Set a HTTP/HTTPS proxy to use for requests.
|
|
176
|
+
|
|
177
|
+
To clear the proxy option, you can use the command (note the empty value after the equals sign):
|
|
178
|
+
|
|
179
|
+
```sh
|
|
180
|
+
aicommits config set proxy=
|
|
181
|
+
```
|
|
99
182
|
|
|
100
183
|
## How it works
|
|
101
184
|
|
|
@@ -103,18 +186,6 @@ This CLI tool runs `git diff` to grab all your latest code changes, sends them t
|
|
|
103
186
|
|
|
104
187
|
Video coming soon where I rebuild it from scratch to show you how to easily build your own CLI tools powered by AI.
|
|
105
188
|
|
|
106
|
-
## Future tasks
|
|
107
|
-
|
|
108
|
-
- Add support for conventional commits as a flag that users can enable
|
|
109
|
-
- Migrate to chatGPT instead of GPT-3
|
|
110
|
-
- Add support for diffs greater than 200 lines by grabbing the diff per file, optional flag
|
|
111
|
-
- Add ability to specify a commit message from inside aicommit if user doesn't like generated one
|
|
112
|
-
- Play around with prompt to produce optimal result
|
|
113
|
-
- Add an alias called `aic` that does "git add . && aicommits && git push"
|
|
114
|
-
- Add opt-in emoji flag to preface commits with an emoji, use [this](https://gitmoji.dev) as a guide
|
|
115
|
-
- Add opt-in languages flag where it returns the commit in different languages
|
|
116
|
-
- Build landing page for the 2.0 launch
|
|
117
|
-
|
|
118
189
|
## Maintainers
|
|
119
190
|
|
|
120
191
|
- **Hassan El Mghari**: [@Nutlope](https://github.com/Nutlope) [<img src="https://img.shields.io/twitter/follow/nutlope?style=flat&label=nutlope&logo=twitter&color=0bf&logoColor=fff" align="center">](https://twitter.com/nutlope)
|
|
@@ -125,4 +196,4 @@ Video coming soon where I rebuild it from scratch to show you how to easily buil
|
|
|
125
196
|
|
|
126
197
|
## Contributing
|
|
127
198
|
|
|
128
|
-
If you want to help fix a bug or implement a feature in [Issues](https://github.com/Nutlope/aicommits/issues), checkout the [Contribution Guide](CONTRIBUTING.md) to learn how to setup and test the project.
|
|
199
|
+
If you want to help fix a bug or implement a feature in [Issues](https://github.com/Nutlope/aicommits/issues), checkout the [Contribution Guide](CONTRIBUTING.md) to learn how to setup and test the project.
|
package/dist/cli.mjs
CHANGED
|
@@ -1,78 +1,89 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import cu from"tty";import{Buffer as Lt}from"node:buffer";import L from"node:path";import lu from"node:child_process";import g,{stdin as fu,stdout as du}from"node:process";import Mt from"child_process";import V from"path";import Ee from"fs";import Gt from"node:url";import Ut,{constants as pu}from"node:os";import Wt from"assert";import Kt from"events";import qt from"buffer";import ge from"stream";import zt from"util";import*as ee from"node:readline";import Fu from"node:readline";import{WriteStream as Vt}from"node:tty";import v from"fs/promises";import Ht from"os";import Yt from"https";import{encoding_for_model as Jt}from"@dqbd/tiktoken";import{fileURLToPath as Xt}from"url";const Zt="known-flag",Qt="unknown-flag",en="argument",{stringify:H}=JSON,un=/\B([A-Z])/g,tn=e=>e.replace(un,"-$1").toLowerCase(),{hasOwnProperty:nn}=Object.prototype,Y=(e,u)=>nn.call(e,u),Dn=e=>Array.isArray(e),mu=e=>typeof e=="function"?[e,!1]:Dn(e)?[e[0],!0]:mu(e.type),rn=(e,u)=>e===Boolean?u!=="false":u,on=(e,u)=>typeof u=="boolean"?u:e===Number&&u===""?Number.NaN:e(u),sn=/[\s.:=]/,an=e=>{const u=`Flag name ${H(e)}`;if(e.length===0)throw new Error(`${u} cannot be empty`);if(e.length===1)throw new Error(`${u} must be longer than a character`);const t=e.match(sn);if(t)throw new Error(`${u} cannot contain ${H(t?.[0])}`)},cn=e=>{const u={},t=(n,D)=>{if(Y(u,n))throw new Error(`Duplicate flags named ${H(n)}`);u[n]=D};for(const n in e){if(!Y(e,n))continue;an(n);const D=e[n],r=[[],...mu(D),D];t(n,r);const i=tn(n);if(n!==i&&t(i,r),"alias"in D&&typeof D.alias=="string"){const{alias:o}=D,s=`Flag alias ${H(o)} for flag ${H(n)}`;if(o.length===0)throw new Error(`${s} cannot be empty`);if(o.length>1)throw new Error(`${s} must be a single character`);t(o,r)}}return u},ln=(e,u)=>{const t={};for(const n in e){if(!Y(e,n))continue;const[D,,r,i]=u[n];if(D.length===0&&"default"in i){let{default:o}=i;typeof o=="function"&&(o=o()),t[n]=o}else t[n]=r?D:D.pop()}return t},ue="--",fn=/[.:=]/,dn=/^-{1,2}\w/,pn=e=>{if(!dn.test(e))return;const u=!e.startsWith(ue);let t=e.slice(u?1:2),n;const D=t.match(fn);if(D){const{index:r}=D;n=t.slice(r+1),t=t.slice(0,r)}return[t,n,u]},Fn=(e,{onFlag:u,onArgument:t})=>{let n;const D=(r,i)=>{if(typeof n!="function")return!0;n(r,i),n=void 0};for(let r=0;r<e.length;r+=1){const i=e[r];if(i===ue){D();const s=e.slice(r+1);t?.(s,[r],!0);break}const o=pn(i);if(o){if(D(),!u)continue;const[s,a,l]=o;if(l)for(let c=0;c<s.length;c+=1){D();const f=c===s.length-1;n=u(s[c],f?a:void 0,[r,c+1,f])}else n=u(s,a,[r])}else D(i,[r])&&t?.([i],[r])}D()},mn=(e,u)=>{for(const[t,n,D]of u.reverse()){if(n){const r=e[t];let i=r.slice(0,n);if(D||(i+=r.slice(n+1)),i!=="-"){e[t]=i;continue}}e.splice(t,1)}},Cn=(e,u=process.argv.slice(2),{ignore:t}={})=>{const n=[],D=cn(e),r={},i=[];return i[ue]=[],Fn(u,{onFlag(o,s,a){const l=Y(D,o);if(!t?.(l?Zt:Qt,o,s)){if(l){const[c,f]=D[o],d=rn(f,s),F=(E,b)=>{n.push(a),b&&n.push(b),c.push(on(f,E||""))};return d===void 0?F:F(d)}Y(r,o)||(r[o]=[]),r[o].push(s===void 0?!0:s),n.push(a)}},onArgument(o,s,a){t?.(en,u[s[0]])||(i.push(...o),a?(i[ue]=o,u.splice(s[0])):n.push(s))}}),mn(u,n),{flags:ln(e,D),unknownFlags:r,_:i}};var hn=Object.create,te=Object.defineProperty,En=Object.defineProperties,gn=Object.getOwnPropertyDescriptor,Bn=Object.getOwnPropertyDescriptors,wn=Object.getOwnPropertyNames,Cu=Object.getOwnPropertySymbols,bn=Object.getPrototypeOf,hu=Object.prototype.hasOwnProperty,yn=Object.prototype.propertyIsEnumerable,Eu=(e,u,t)=>u in e?te(e,u,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[u]=t,ne=(e,u)=>{for(var t in u||(u={}))hu.call(u,t)&&Eu(e,t,u[t]);if(Cu)for(var t of Cu(u))yn.call(u,t)&&Eu(e,t,u[t]);return e},Be=(e,u)=>En(e,Bn(u)),$n=e=>te(e,"__esModule",{value:!0}),An=(e,u)=>()=>(e&&(u=e(e=0)),u),vn=(e,u)=>()=>(u||e((u={exports:{}}).exports,u),u.exports),xn=(e,u,t,n)=>{if(u&&typeof u=="object"||typeof u=="function")for(let D of wn(u))!hu.call(e,D)&&(t||D!=="default")&&te(e,D,{get:()=>u[D],enumerable:!(n=gn(u,D))||n.enumerable});return e},Sn=(e,u)=>xn($n(te(e!=null?hn(bn(e)):{},"default",!u&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),y=An(()=>{}),On=vn((e,u)=>{y(),u.exports=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}});y(),y(),y();var In=e=>{var u,t,n;let D=(u=process.stdout.columns)!=null?u:Number.POSITIVE_INFINITY;return typeof e=="function"&&(e=e(D)),e||(e={}),Array.isArray(e)?{columns:e,stdoutColumns:D}:{columns:(t=e.columns)!=null?t:[],stdoutColumns:(n=e.stdoutColumns)!=null?n:D}};y(),y(),y(),y(),y();function Tn({onlyFirst:e=!1}={}){let u=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(u,e?void 0:"g")}function gu(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(Tn(),"")}y();function Pn(e){return Number.isInteger(e)?e>=4352&&(e<=4447||e===9001||e===9002||11904<=e&&e<=12871&&e!==12351||12880<=e&&e<=19903||19968<=e&&e<=42182||43360<=e&&e<=43388||44032<=e&&e<=55203||63744<=e&&e<=64255||65040<=e&&e<=65049||65072<=e&&e<=65131||65281<=e&&e<=65376||65504<=e&&e<=65510||110592<=e&&e<=110593||127488<=e&&e<=127569||131072<=e&&e<=262141):!1}var kn=Sn(On(),1);function k(e){if(typeof e!="string"||e.length===0||(e=gu(e),e.length===0))return 0;e=e.replace((0,kn.default)()," ");let u=0;for(let t=0;t<e.length;t++){let n=e.codePointAt(t);n<=31||n>=127&&n<=159||n>=768&&n<=879||(n>65535&&t++,u+=Pn(n)?2:1)}return u}var Bu=e=>Math.max(...e.split(`
|
|
3
|
-
`).map(k)),
|
|
4
|
-
`)];for(let[
|
|
5
|
-
`?(
|
|
6
|
-
`&&(
|
|
2
|
+
import le from"tty";import{Buffer as wn}from"node:buffer";import W from"node:path";import It from"node:child_process";import b,{stdin as Tt,stdout as Pt}from"node:process";import Bn from"child_process";import X from"path";import Te from"fs";import $n from"node:url";import vn,{constants as _t}from"node:os";import Rt from"assert";import kt from"events";import An from"buffer";import Pe from"stream";import Mt from"util";import*as fe from"node:readline";import jt from"node:readline";import{WriteStream as xn}from"node:tty";import O from"fs/promises";import Lt from"os";import Sn from"https";import{encoding_for_model as On}from"@dqbd/tiktoken";import In from"net";import Tn from"tls";import Pn,{fileURLToPath as _n}from"url";const Rn="known-flag",kn="unknown-flag",Mn="argument",{stringify:Z}=JSON,jn=/\B([A-Z])/g,Ln=e=>e.replace(jn,"-$1").toLowerCase(),{hasOwnProperty:Nn}=Object.prototype,Q=(e,t)=>Nn.call(e,t),Gn=e=>Array.isArray(e),Nt=e=>typeof e=="function"?[e,!1]:Gn(e)?[e[0],!0]:Nt(e.type),Un=(e,t)=>e===Boolean?t!=="false":t,Wn=(e,t)=>typeof t=="boolean"?t:e===Number&&t===""?Number.NaN:e(t),qn=/[\s.:=]/,Hn=e=>{const t=`Flag name ${Z(e)}`;if(e.length===0)throw new Error(`${t} cannot be empty`);if(e.length===1)throw new Error(`${t} must be longer than a character`);const n=e.match(qn);if(n)throw new Error(`${t} cannot contain ${Z(n?.[0])}`)},zn=e=>{const t={},n=(u,r)=>{if(Q(t,u))throw new Error(`Duplicate flags named ${Z(u)}`);t[u]=r};for(const u in e){if(!Q(e,u))continue;Hn(u);const r=e[u],o=[[],...Nt(r),r];n(u,o);const s=Ln(u);if(u!==s&&n(s,o),"alias"in r&&typeof r.alias=="string"){const{alias:i}=r,D=`Flag alias ${Z(i)} for flag ${Z(u)}`;if(i.length===0)throw new Error(`${D} cannot be empty`);if(i.length>1)throw new Error(`${D} must be a single character`);n(i,o)}}return t},Kn=(e,t)=>{const n={};for(const u in e){if(!Q(e,u))continue;const[r,,o,s]=t[u];if(r.length===0&&"default"in s){let{default:i}=s;typeof i=="function"&&(i=i()),n[u]=i}else n[u]=o?r:r.pop()}return n},de="--",Vn=/[.:=]/,Yn=/^-{1,2}\w/,Jn=e=>{if(!Yn.test(e))return;const t=!e.startsWith(de);let n=e.slice(t?1:2),u;const r=n.match(Vn);if(r){const{index:o}=r;u=n.slice(o+1),n=n.slice(0,o)}return[n,u,t]},Xn=(e,{onFlag:t,onArgument:n})=>{let u;const r=(o,s)=>{if(typeof u!="function")return!0;u(o,s),u=void 0};for(let o=0;o<e.length;o+=1){const s=e[o];if(s===de){r();const D=e.slice(o+1);n?.(D,[o],!0);break}const i=Jn(s);if(i){if(r(),!t)continue;const[D,l,f]=i;if(f)for(let a=0;a<D.length;a+=1){r();const c=a===D.length-1;u=t(D[a],c?l:void 0,[o,a+1,c])}else u=t(D,l,[o])}else r(s,[o])&&n?.([s],[o])}r()},Zn=(e,t)=>{for(const[n,u,r]of t.reverse()){if(u){const o=e[n];let s=o.slice(0,u);if(r||(s+=o.slice(u+1)),s!=="-"){e[n]=s;continue}}e.splice(n,1)}},Qn=(e,t=process.argv.slice(2),{ignore:n}={})=>{const u=[],r=zn(e),o={},s=[];return s[de]=[],Xn(t,{onFlag(i,D,l){const f=Q(r,i);if(!n?.(f?Rn:kn,i,D)){if(f){const[a,c]=r[i],d=Un(c,D),p=(m,h)=>{u.push(l),h&&u.push(h),a.push(Wn(c,m||""))};return d===void 0?p:p(d)}Q(o,i)||(o[i]=[]),o[i].push(D===void 0?!0:D),u.push(l)}},onArgument(i,D,l){n?.(Mn,t[D[0]])||(s.push(...i),l?(s[de]=i,t.splice(D[0])):u.push(D))}}),Zn(t,u),{flags:Kn(e,r),unknownFlags:o,_:s}};var er=Object.create,pe=Object.defineProperty,tr=Object.defineProperties,ur=Object.getOwnPropertyDescriptor,nr=Object.getOwnPropertyDescriptors,rr=Object.getOwnPropertyNames,Gt=Object.getOwnPropertySymbols,or=Object.getPrototypeOf,Ut=Object.prototype.hasOwnProperty,sr=Object.prototype.propertyIsEnumerable,Wt=(e,t,n)=>t in e?pe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ce=(e,t)=>{for(var n in t||(t={}))Ut.call(t,n)&&Wt(e,n,t[n]);if(Gt)for(var n of Gt(t))sr.call(t,n)&&Wt(e,n,t[n]);return e},_e=(e,t)=>tr(e,nr(t)),ir=e=>pe(e,"__esModule",{value:!0}),Dr=(e,t)=>()=>(e&&(t=e(e=0)),t),ar=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),cr=(e,t,n,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of rr(t))!Ut.call(e,r)&&(n||r!=="default")&&pe(e,r,{get:()=>t[r],enumerable:!(u=ur(t,r))||u.enumerable});return e},lr=(e,t)=>cr(ir(pe(e!=null?er(or(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),A=Dr(()=>{}),fr=ar((e,t)=>{A(),t.exports=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}});A(),A(),A();var dr=e=>{var t,n,u;let r=(t=process.stdout.columns)!=null?t:Number.POSITIVE_INFINITY;return typeof e=="function"&&(e=e(r)),e||(e={}),Array.isArray(e)?{columns:e,stdoutColumns:r}:{columns:(n=e.columns)!=null?n:[],stdoutColumns:(u=e.stdoutColumns)!=null?u:r}};A(),A(),A(),A(),A();function pr({onlyFirst:e=!1}={}){let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}function qt(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(pr(),"")}A();function Cr(e){return Number.isInteger(e)?e>=4352&&(e<=4447||e===9001||e===9002||11904<=e&&e<=12871&&e!==12351||12880<=e&&e<=19903||19968<=e&&e<=42182||43360<=e&&e<=43388||44032<=e&&e<=55203||63744<=e&&e<=64255||65040<=e&&e<=65049||65072<=e&&e<=65131||65281<=e&&e<=65376||65504<=e&&e<=65510||110592<=e&&e<=110593||127488<=e&&e<=127569||131072<=e&&e<=262141):!1}var mr=lr(fr(),1);function k(e){if(typeof e!="string"||e.length===0||(e=qt(e),e.length===0))return 0;e=e.replace((0,mr.default)()," ");let t=0;for(let n=0;n<e.length;n++){let u=e.codePointAt(n);u<=31||u>=127&&u<=159||u>=768&&u<=879||(u>65535&&n++,t+=Cr(u)?2:1)}return t}var Ht=e=>Math.max(...e.split(`
|
|
3
|
+
`).map(k)),hr=e=>{let t=[];for(let n of e){let{length:u}=n,r=u-t.length;for(let o=0;o<r;o+=1)t.push(0);for(let o=0;o<u;o+=1){let s=Ht(n[o]);s>t[o]&&(t[o]=s)}}return t};A();var zt=/^\d+%$/,Kt={width:"auto",align:"left",contentWidth:0,paddingLeft:0,paddingRight:0,paddingTop:0,paddingBottom:0,horizontalPadding:0,paddingLeftString:"",paddingRightString:""},Fr=(e,t)=>{var n;let u=[];for(let r=0;r<e.length;r+=1){let o=(n=t[r])!=null?n:"auto";if(typeof o=="number"||o==="auto"||o==="content-width"||typeof o=="string"&&zt.test(o)){u.push(_e(Ce({},Kt),{width:o,contentWidth:e[r]}));continue}if(o&&typeof o=="object"){let s=_e(Ce(Ce({},Kt),o),{contentWidth:e[r]});s.horizontalPadding=s.paddingLeft+s.paddingRight,u.push(s);continue}throw new Error(`Invalid column width: ${JSON.stringify(o)}`)}return u};function gr(e,t){for(let n of e){let{width:u}=n;if(u==="content-width"&&(n.width=n.contentWidth),u==="auto"){let D=Math.min(20,n.contentWidth);n.width=D,n.autoOverflow=n.contentWidth-D}if(typeof u=="string"&&zt.test(u)){let D=Number.parseFloat(u.slice(0,-1))/100;n.width=Math.floor(t*D)-(n.paddingLeft+n.paddingRight)}let{horizontalPadding:r}=n,o=1,s=o+r;if(s>=t){let D=s-t,l=Math.ceil(n.paddingLeft/r*D),f=D-l;n.paddingLeft-=l,n.paddingRight-=f,n.horizontalPadding=n.paddingLeft+n.paddingRight}n.paddingLeftString=n.paddingLeft?" ".repeat(n.paddingLeft):"",n.paddingRightString=n.paddingRight?" ".repeat(n.paddingRight):"";let i=t-n.horizontalPadding;n.width=Math.max(Math.min(n.width,i),o)}}var Vt=()=>Object.assign([],{columns:0});function Er(e,t){let n=[Vt()],[u]=n;for(let r of e){let o=r.width+r.horizontalPadding;u.columns+o>t&&(u=Vt(),n.push(u)),u.push(r),u.columns+=o}for(let r of n){let o=r.reduce((c,d)=>c+d.width+d.horizontalPadding,0),s=t-o;if(s===0)continue;let i=r.filter(c=>"autoOverflow"in c),D=i.filter(c=>c.autoOverflow>0),l=D.reduce((c,d)=>c+d.autoOverflow,0),f=Math.min(l,s);for(let c of D){let d=Math.floor(c.autoOverflow/l*f);c.width+=d,s-=d}let a=Math.floor(s/i.length);for(let c=0;c<i.length;c+=1){let d=i[c];c===i.length-1?d.width+=s:d.width+=a,s-=a}}return n}function yr(e,t,n){let u=Fr(n,t);return gr(u,e),Er(u,e)}A(),A(),A();var Re=10,Yt=(e=0)=>t=>`\x1B[${t+e}m`,Jt=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,Xt=(e=0)=>(t,n,u)=>`\x1B[${38+e};2;${t};${n};${u}m`;function br(){let e=new Map,t={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],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],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};t.color.gray=t.color.blackBright,t.bgColor.bgGray=t.bgColor.bgBlackBright,t.color.grey=t.color.blackBright,t.bgColor.bgGrey=t.bgColor.bgBlackBright;for(let[n,u]of Object.entries(t)){for(let[r,o]of Object.entries(u))t[r]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},u[r]=t[r],e.set(o[0],o[1]);Object.defineProperty(t,n,{value:u,enumerable:!1})}return Object.defineProperty(t,"codes",{value:e,enumerable:!1}),t.color.close="\x1B[39m",t.bgColor.close="\x1B[49m",t.color.ansi=Yt(),t.color.ansi256=Jt(),t.color.ansi16m=Xt(),t.bgColor.ansi=Yt(Re),t.bgColor.ansi256=Jt(Re),t.bgColor.ansi16m=Xt(Re),Object.defineProperties(t,{rgbToAnsi256:{value:(n,u,r)=>n===u&&u===r?n<8?16:n>248?231:Math.round((n-8)/247*24)+232:16+36*Math.round(n/255*5)+6*Math.round(u/255*5)+Math.round(r/255*5),enumerable:!1},hexToRgb:{value:n=>{let u=/(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(n.toString(16));if(!u)return[0,0,0];let{colorString:r}=u.groups;r.length===3&&(r=r.split("").map(s=>s+s).join(""));let o=Number.parseInt(r,16);return[o>>16&255,o>>8&255,o&255]},enumerable:!1},hexToAnsi256:{value:n=>t.rgbToAnsi256(...t.hexToRgb(n)),enumerable:!1},ansi256ToAnsi:{value:n=>{if(n<8)return 30+n;if(n<16)return 90+(n-8);let u,r,o;if(n>=232)u=((n-232)*10+8)/255,r=u,o=u;else{n-=16;let D=n%36;u=Math.floor(n/36)/5,r=Math.floor(D/6)/5,o=D%6/5}let s=Math.max(u,r,o)*2;if(s===0)return 30;let i=30+(Math.round(o)<<2|Math.round(r)<<1|Math.round(u));return s===2&&(i+=60),i},enumerable:!1},rgbToAnsi:{value:(n,u,r)=>t.ansi256ToAnsi(t.rgbToAnsi256(n,u,r)),enumerable:!1},hexToAnsi:{value:n=>t.ansi256ToAnsi(t.hexToAnsi256(n)),enumerable:!1}}),t}var wr=br(),Br=wr,me=new Set(["\x1B","\x9B"]),$r=39,ke="\x07",Zt="[",vr="]",Qt="m",Me=`${vr}8;;`,eu=e=>`${me.values().next().value}${Zt}${e}${Qt}`,tu=e=>`${me.values().next().value}${Me}${e}${ke}`,Ar=e=>e.split(" ").map(t=>k(t)),je=(e,t,n)=>{let u=[...t],r=!1,o=!1,s=k(qt(e[e.length-1]));for(let[i,D]of u.entries()){let l=k(D);if(s+l<=n?e[e.length-1]+=D:(e.push(D),s=0),me.has(D)&&(r=!0,o=u.slice(i+1).join("").startsWith(Me)),r){o?D===ke&&(r=!1,o=!1):D===Qt&&(r=!1);continue}s+=l,s===n&&i<u.length-1&&(e.push(""),s=0)}!s&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},xr=e=>{let t=e.split(" "),n=t.length;for(;n>0&&!(k(t[n-1])>0);)n--;return n===t.length?e:t.slice(0,n).join(" ")+t.slice(n).join("")},Sr=(e,t,n={})=>{if(n.trim!==!1&&e.trim()==="")return"";let u="",r,o,s=Ar(e),i=[""];for(let[l,f]of e.split(" ").entries()){n.trim!==!1&&(i[i.length-1]=i[i.length-1].trimStart());let a=k(i[i.length-1]);if(l!==0&&(a>=t&&(n.wordWrap===!1||n.trim===!1)&&(i.push(""),a=0),(a>0||n.trim===!1)&&(i[i.length-1]+=" ",a++)),n.hard&&s[l]>t){let c=t-a,d=1+Math.floor((s[l]-c-1)/t);Math.floor((s[l]-1)/t)<d&&i.push(""),je(i,f,t);continue}if(a+s[l]>t&&a>0&&s[l]>0){if(n.wordWrap===!1&&a<t){je(i,f,t);continue}i.push("")}if(a+s[l]>t&&n.wordWrap===!1){je(i,f,t);continue}i[i.length-1]+=f}n.trim!==!1&&(i=i.map(l=>xr(l)));let D=[...i.join(`
|
|
4
|
+
`)];for(let[l,f]of D.entries()){if(u+=f,me.has(f)){let{groups:c}=new RegExp(`(?:\\${Zt}(?<code>\\d+)m|\\${Me}(?<uri>.*)${ke})`).exec(D.slice(l).join(""))||{groups:{}};if(c.code!==void 0){let d=Number.parseFloat(c.code);r=d===$r?void 0:d}else c.uri!==void 0&&(o=c.uri.length===0?void 0:c.uri)}let a=Br.codes.get(Number(r));D[l+1]===`
|
|
5
|
+
`?(o&&(u+=tu("")),r&&a&&(u+=eu(a))):f===`
|
|
6
|
+
`&&(r&&a&&(u+=eu(r)),o&&(u+=tu(o)))}return u};function Or(e,t,n){return String(e).normalize().replace(/\r\n/g,`
|
|
7
7
|
`).split(`
|
|
8
|
-
`).map(
|
|
9
|
-
`)}var
|
|
10
|
-
`);if(
|
|
11
|
-
`))}return
|
|
12
|
-
`)}function
|
|
13
|
-
`)}
|
|
14
|
-
`}}function
|
|
15
|
-
`}}function
|
|
16
|
-
`):
|
|
17
|
-
`)}}}}function
|
|
18
|
-
`)),
|
|
19
|
-
`:"")+(
|
|
20
|
-
`}table({tableData:
|
|
21
|
-
`);if("type"in
|
|
22
|
-
`),
|
|
8
|
+
`).map(u=>Sr(u,t,n)).join(`
|
|
9
|
+
`)}var uu=e=>Array.from({length:e}).fill("");function Ir(e,t){let n=[],u=0;for(let r of e){let o=0,s=r.map(D=>{var l;let f=(l=t[u])!=null?l:"";u+=1,D.preprocess&&(f=D.preprocess(f)),Ht(f)>D.width&&(f=Or(f,D.width,{hard:!0}));let a=f.split(`
|
|
10
|
+
`);if(D.postprocess){let{postprocess:c}=D;a=a.map((d,p)=>c.call(D,d,p))}return D.paddingTop&&a.unshift(...uu(D.paddingTop)),D.paddingBottom&&a.push(...uu(D.paddingBottom)),a.length>o&&(o=a.length),_e(Ce({},D),{lines:a})}),i=[];for(let D=0;D<o;D+=1){let l=s.map(f=>{var a;let c=(a=f.lines[D])!=null?a:"",d=Number.isFinite(f.width)?" ".repeat(f.width-k(c)):"",p=f.paddingLeftString;return f.align==="right"&&(p+=d),p+=c,f.align==="left"&&(p+=d),p+f.paddingRightString}).join("");i.push(l)}n.push(i.join(`
|
|
11
|
+
`))}return n.join(`
|
|
12
|
+
`)}function Tr(e,t){if(!e||e.length===0)return"";let n=hr(e),u=n.length;if(u===0)return"";let{stdoutColumns:r,columns:o}=dr(t);if(o.length>u)throw new Error(`${o.length} columns defined, but only ${u} columns found`);let s=yr(r,o,n);return e.map(i=>Ir(s,i)).join(`
|
|
13
|
+
`)}A();var Pr=["<",">","=",">=","<="];function _r(e){if(!Pr.includes(e))throw new TypeError(`Invalid breakpoint operator: ${e}`)}function Rr(e){let t=Object.keys(e).map(n=>{let[u,r]=n.split(" ");_r(u);let o=Number.parseInt(r,10);if(Number.isNaN(o))throw new TypeError(`Invalid breakpoint value: ${r}`);let s=e[n];return{operator:u,breakpoint:o,value:s}}).sort((n,u)=>u.breakpoint-n.breakpoint);return n=>{var u;return(u=t.find(({operator:r,breakpoint:o})=>r==="="&&n===o||r===">"&&n>o||r==="<"&&n<o||r===">="&&n>=o||r==="<="&&n<=o))==null?void 0:u.value}}const kr=e=>e.replace(/[\W_]([a-z\d])?/gi,(t,n)=>n?n.toUpperCase():""),Mr=e=>e.replace(/\B([A-Z])/g,"-$1").toLowerCase(),jr={"> 80":[{width:"content-width",paddingLeft:2,paddingRight:8},{width:"auto"}],"> 40":[{width:"auto",paddingLeft:2,paddingRight:8,preprocess:e=>e.trim()},{width:"100%",paddingLeft:2,paddingBottom:1}],"> 0":{stdoutColumns:1e3,columns:[{width:"content-width",paddingLeft:2,paddingRight:8},{width:"content-width"}]}};function Lr(e){let t=!1;return{type:"table",data:{tableData:Object.keys(e).sort((n,u)=>n.localeCompare(u)).map(n=>{const u=e[n],r="alias"in u;return r&&(t=!0),{name:n,flag:u,flagFormatted:`--${Mr(n)}`,aliasesEnabled:t,aliasFormatted:r?`-${u.alias}`:void 0}}).map(n=>(n.aliasesEnabled=t,[{type:"flagName",data:n},{type:"flagDescription",data:n}])),tableBreakpoints:jr}}}const nu=e=>!e||(e.version??(e.help?e.help.version:void 0)),ru=e=>{const t="parent"in e&&e.parent?.name;return(t?`${t} `:"")+e.name};function Nr(e){const t=[];e.name&&t.push(ru(e));const n=nu(e)??("parent"in e&&nu(e.parent));if(n&&t.push(`v${n}`),t.length!==0)return{id:"name",type:"text",data:`${t.join(" ")}
|
|
14
|
+
`}}function Gr(e){const{help:t}=e;if(!(!t||!t.description))return{id:"description",type:"text",data:`${t.description}
|
|
15
|
+
`}}function Ur(e){const t=e.help||{};if("usage"in t)return t.usage?{id:"usage",type:"section",data:{title:"Usage:",body:Array.isArray(t.usage)?t.usage.join(`
|
|
16
|
+
`):t.usage}}:void 0;if(e.name){const n=[],u=[ru(e)];if(e.flags&&Object.keys(e.flags).length>0&&u.push("[flags...]"),e.parameters&&e.parameters.length>0){const{parameters:r}=e,o=r.indexOf("--"),s=o>-1&&r.slice(o+1).some(i=>i.startsWith("<"));u.push(r.map(i=>i!=="--"?i:s?"--":"[--]").join(" "))}if(u.length>1&&n.push(u.join(" ")),"commands"in e&&e.commands?.length&&n.push(`${e.name} <command>`),n.length>0)return{id:"usage",type:"section",data:{title:"Usage:",body:n.join(`
|
|
17
|
+
`)}}}}function Wr(e){return!("commands"in e)||!e.commands?.length?void 0:{id:"commands",type:"section",data:{title:"Commands:",body:{type:"table",data:{tableData:e.commands.map(t=>[t.options.name,t.options.help?t.options.help.description:""]),tableOptions:[{width:"content-width",paddingLeft:2,paddingRight:8}]}},indentBody:0}}}function qr(e){if(!(!e.flags||Object.keys(e.flags).length===0))return{id:"flags",type:"section",data:{title:"Flags:",body:Lr(e.flags),indentBody:0}}}function Hr(e){const{help:t}=e;if(!t||!t.examples||t.examples.length===0)return;let{examples:n}=t;if(Array.isArray(n)&&(n=n.join(`
|
|
18
|
+
`)),n)return{id:"examples",type:"section",data:{title:"Examples:",body:n}}}function zr(e){if(!("alias"in e)||!e.alias)return;const{alias:t}=e;return{id:"aliases",type:"section",data:{title:"Aliases:",body:Array.isArray(t)?t.join(", "):t}}}const Kr=e=>[Nr,Gr,Ur,Wr,qr,Hr,zr].map(t=>t(e)).filter(Boolean),Vr=le.WriteStream.prototype.hasColors();class Yr{text(t){return t}bold(t){return Vr?`\x1B[1m${t}\x1B[22m`:t.toLocaleUpperCase()}indentText({text:t,spaces:n}){return t.replace(/^/gm," ".repeat(n))}heading(t){return this.bold(t)}section({title:t,body:n,indentBody:u=2}){return`${(t?`${this.heading(t)}
|
|
19
|
+
`:"")+(n?this.indentText({text:this.render(n),spaces:u}):"")}
|
|
20
|
+
`}table({tableData:t,tableOptions:n,tableBreakpoints:u}){return Tr(t.map(r=>r.map(o=>this.render(o))),u?Rr(u):n)}flagParameter(t){return t===Boolean?"":t===String?"<string>":t===Number?"<number>":Array.isArray(t)?this.flagParameter(t[0]):"<value>"}flagOperator(t){return" "}flagName(t){const{flag:n,flagFormatted:u,aliasesEnabled:r,aliasFormatted:o}=t;let s="";if(o?s+=`${o}, `:r&&(s+=" "),s+=u,"placeholder"in n&&typeof n.placeholder=="string")s+=`${this.flagOperator(t)}${n.placeholder}`;else{const i=this.flagParameter("type"in n?n.type:n);i&&(s+=`${this.flagOperator(t)}${i}`)}return s}flagDefault(t){return JSON.stringify(t)}flagDescription({flag:t}){let n="description"in t?t.description??"":"";if("default"in t){let{default:u}=t;typeof u=="function"&&(u=u()),u&&(n+=` (default: ${this.flagDefault(u)})`)}return n}render(t){if(typeof t=="string")return t;if(Array.isArray(t))return t.map(n=>this.render(n)).join(`
|
|
21
|
+
`);if("type"in t&&this[t.type]){const n=this[t.type];if(typeof n=="function")return n.call(this,t.data)}throw new Error(`Invalid node type: ${JSON.stringify(t)}`)}}const Le=/^[\w.-]+$/,{stringify:I}=JSON,Jr=/[|\\{}()[\]^$+*?.]/;function Ne(e){const t=[];let n,u;for(const r of e){if(u)throw new Error(`Invalid parameter: Spread parameter ${I(u)} must be last`);const o=r[0],s=r[r.length-1];let i;if(o==="<"&&s===">"&&(i=!0,n))throw new Error(`Invalid parameter: Required parameter ${I(r)} cannot come after optional parameter ${I(n)}`);if(o==="["&&s==="]"&&(i=!1,n=r),i===void 0)throw new Error(`Invalid parameter: ${I(r)}. Must be wrapped in <> (required parameter) or [] (optional parameter)`);let D=r.slice(1,-1);const l=D.slice(-3)==="...";l&&(u=r,D=D.slice(0,-3));const f=D.match(Jr);if(f)throw new Error(`Invalid parameter: ${I(r)}. Invalid character found ${I(f[0])}`);t.push({name:D,required:i,spread:l})}return t}function Ge(e,t,n,u){for(let r=0;r<t.length;r+=1){const{name:o,required:s,spread:i}=t[r],D=kr(o);if(D in e)throw new Error(`Invalid parameter: ${I(o)} is used more than once.`);const l=i?n.slice(r):n[r];if(i&&(r=t.length),s&&(!l||i&&l.length===0))return console.error(`Error: Missing required parameter ${I(o)}
|
|
22
|
+
`),u(),process.exit(1);e[D]=l}}function Xr(e){return e===void 0||e!==!1}function ou(e,t,n,u){const r={...t.flags},o=t.version;o&&(r.version={type:Boolean,description:"Show version"});const{help:s}=t,i=Xr(s);i&&!("help"in r)&&(r.help={type:Boolean,alias:"h",description:"Show help"});const D=Qn(r,u,{ignore:t.ignoreArgv}),l=()=>{console.log(t.version)};if(o&&D.flags.version===!0)return l(),process.exit(0);const f=new Yr,a=i&&s?.render?s.render:p=>f.render(p),c=p=>{const m=Kr({...t,...p?{help:p}:{},flags:r});console.log(a(m,f))};if(i&&D.flags.help===!0)return c(),process.exit(0);if(t.parameters){let{parameters:p}=t,m=D._;const h=p.indexOf("--"),F=p.slice(h+1),B=Object.create(null);if(h>-1&&F.length>0){p=p.slice(0,h);const T=D._["--"];m=m.slice(0,-T.length||void 0),Ge(B,Ne(p),m,c),Ge(B,Ne(F),T,c)}else Ge(B,Ne(p),m,c);Object.assign(D._,B)}const d={...D,showVersion:l,showHelp:c};return typeof n=="function"&&n(d),{command:e,...d}}function Zr(e,t){const n=new Map;for(const u of t){const r=[u.options.name],{alias:o}=u.options;o&&(Array.isArray(o)?r.push(...o):r.push(o));for(const s of r){if(n.has(s))throw new Error(`Duplicate command name found: ${I(s)}`);n.set(s,u)}}return n.get(e)}function Qr(e,t,n=process.argv.slice(2)){if(!e)throw new Error("Options is required");if("name"in e&&(!e.name||!Le.test(e.name)))throw new Error(`Invalid script name: ${I(e.name)}`);const u=n[0];if(e.commands&&Le.test(u)){const r=Zr(u,e.commands);if(r)return ou(r.options.name,{...r.options,parent:e},r.callback,n.slice(1))}return ou(void 0,e,t,n)}function su(e,t){if(!e)throw new Error("Command options are required");const{name:n}=e;if(e.name===void 0)throw new Error("Command name is required");if(!Le.test(n))throw new Error(`Invalid command name ${JSON.stringify(n)}. Command names must be one word.`);return{options:e,callback:t}}var iu="1.7.0",eo="Writes your git commit messages for you with AI",w=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},M={},to={get exports(){return M},set exports(e){M=e}},Ue,Du;function uo(){if(Du)return Ue;Du=1,Ue=u,u.sync=r;var e=Te;function t(o,s){var i=s.pathExt!==void 0?s.pathExt:process.env.PATHEXT;if(!i||(i=i.split(";"),i.indexOf("")!==-1))return!0;for(var D=0;D<i.length;D++){var l=i[D].toLowerCase();if(l&&o.substr(-l.length).toLowerCase()===l)return!0}return!1}function n(o,s,i){return!o.isSymbolicLink()&&!o.isFile()?!1:t(s,i)}function u(o,s,i){e.stat(o,function(D,l){i(D,D?!1:n(l,o,s))})}function r(o,s){return n(e.statSync(o),o,s)}return Ue}var We,au;function no(){if(au)return We;au=1,We=t,t.sync=n;var e=Te;function t(o,s,i){e.stat(o,function(D,l){i(D,D?!1:u(l,s))})}function n(o,s){return u(e.statSync(o),s)}function u(o,s){return o.isFile()&&r(o,s)}function r(o,s){var i=o.mode,D=o.uid,l=o.gid,f=s.uid!==void 0?s.uid:process.getuid&&process.getuid(),a=s.gid!==void 0?s.gid:process.getgid&&process.getgid(),c=parseInt("100",8),d=parseInt("010",8),p=parseInt("001",8),m=c|d,h=i&p||i&d&&l===a||i&c&&D===f||i&m&&f===0;return h}return We}var he;process.platform==="win32"||w.TESTING_WINDOWS?he=uo():he=no();var ro=qe;qe.sync=oo;function qe(e,t,n){if(typeof t=="function"&&(n=t,t={}),!n){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(u,r){qe(e,t||{},function(o,s){o?r(o):u(s)})})}he(e,t||{},function(u,r){u&&(u.code==="EACCES"||t&&t.ignoreErrors)&&(u=null,r=!1),n(u,r)})}function oo(e,t){try{return he.sync(e,t||{})}catch(n){if(t&&t.ignoreErrors||n.code==="EACCES")return!1;throw n}}const q=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",cu=X,so=q?";":":",lu=ro,fu=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),du=(e,t)=>{const n=t.colon||so,u=e.match(/\//)||q&&e.match(/\\/)?[""]:[...q?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(n)],r=q?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=q?r.split(n):[""];return q&&e.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:u,pathExt:o,pathExtExe:r}},pu=(e,t,n)=>{typeof t=="function"&&(n=t,t={}),t||(t={});const{pathEnv:u,pathExt:r,pathExtExe:o}=du(e,t),s=[],i=l=>new Promise((f,a)=>{if(l===u.length)return t.all&&s.length?f(s):a(fu(e));const c=u[l],d=/^".*"$/.test(c)?c.slice(1,-1):c,p=cu.join(d,e),m=!d&&/^\.[\\\/]/.test(e)?e.slice(0,2)+p:p;f(D(m,l,0))}),D=(l,f,a)=>new Promise((c,d)=>{if(a===r.length)return c(i(f+1));const p=r[a];lu(l+p,{pathExt:o},(m,h)=>{if(!m&&h)if(t.all)s.push(l+p);else return c(l+p);return c(D(l,f,a+1))})});return n?i(0).then(l=>n(null,l),n):i(0)},io=(e,t)=>{t=t||{};const{pathEnv:n,pathExt:u,pathExtExe:r}=du(e,t),o=[];for(let s=0;s<n.length;s++){const i=n[s],D=/^".*"$/.test(i)?i.slice(1,-1):i,l=cu.join(D,e),f=!D&&/^\.[\\\/]/.test(e)?e.slice(0,2)+l:l;for(let a=0;a<u.length;a++){const c=f+u[a];try{if(lu.sync(c,{pathExt:r}))if(t.all)o.push(c);else return c}catch{}}}if(t.all&&o.length)return o;if(t.nothrow)return null;throw fu(e)};var Do=pu;pu.sync=io;var Fe={},ao={get exports(){return Fe},set exports(e){Fe=e}};const Cu=(e={})=>{const t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(u=>u.toUpperCase()==="PATH")||"Path"};ao.exports=Cu,Fe.default=Cu;const mu=X,co=Do,lo=Fe;function hu(e,t){const n=e.options.env||process.env,u=process.cwd(),r=e.options.cwd!=null,o=r&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(e.options.cwd)}catch{}let s;try{s=co.sync(e.command,{path:n[lo({env:n})],pathExt:t?mu.delimiter:void 0})}catch{}finally{o&&process.chdir(u)}return s&&(s=mu.resolve(r?e.options.cwd:"",s)),s}function fo(e){return hu(e)||hu(e,!0)}var po=fo,He={};const ze=/([()\][%!^"`<>&|;, *?])/g;function Co(e){return e=e.replace(ze,"^$1"),e}function mo(e,t){return e=`${e}`,e=e.replace(/(\\*)"/g,'$1$1\\"'),e=e.replace(/(\\*)$/,"$1$1"),e=`"${e}"`,e=e.replace(ze,"^$1"),t&&(e=e.replace(ze,"^$1")),e}He.command=Co,He.argument=mo;var ho=/^#!(.*)/;const Fo=ho;var go=(e="")=>{const t=e.match(Fo);if(!t)return null;const[n,u]=t[0].replace(/#! ?/,"").split(" "),r=n.split("/").pop();return r==="env"?u:u?`${r} ${u}`:r};const Ke=Te,Eo=go;function yo(e){const n=Buffer.alloc(150);let u;try{u=Ke.openSync(e,"r"),Ke.readSync(u,n,0,150,0),Ke.closeSync(u)}catch{}return Eo(n.toString())}var bo=yo;const wo=X,Fu=po,gu=He,Bo=bo,$o=process.platform==="win32",vo=/\.(?:com|exe)$/i,Ao=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function xo(e){e.file=Fu(e);const t=e.file&&Bo(e.file);return t?(e.args.unshift(e.file),e.command=t,Fu(e)):e.file}function So(e){if(!$o)return e;const t=xo(e),n=!vo.test(t);if(e.options.forceShell||n){const u=Ao.test(t);e.command=wo.normalize(e.command),e.command=gu.command(e.command),e.args=e.args.map(o=>gu.argument(o,u));const r=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${r}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function Oo(e,t,n){t&&!Array.isArray(t)&&(n=t,t=null),t=t?t.slice(0):[],n=Object.assign({},n);const u={command:e,args:t,options:n,file:void 0,original:{command:e,args:t}};return n.shell?u:So(u)}var Io=Oo;const Ve=process.platform==="win32";function Ye(e,t){return Object.assign(new Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function To(e,t){if(!Ve)return;const n=e.emit;e.emit=function(u,r){if(u==="exit"){const o=Eu(r,t);if(o)return n.call(e,"error",o)}return n.apply(e,arguments)}}function Eu(e,t){return Ve&&e===1&&!t.file?Ye(t.original,"spawn"):null}function Po(e,t){return Ve&&e===1&&!t.file?Ye(t.original,"spawnSync"):null}var _o={hookChildProcess:To,verifyENOENT:Eu,verifyENOENTSync:Po,notFoundError:Ye};const yu=Bn,Je=Io,Xe=_o;function bu(e,t,n){const u=Je(e,t,n),r=yu.spawn(u.command,u.args,u.options);return Xe.hookChildProcess(r,u),r}function Ro(e,t,n){const u=Je(e,t,n),r=yu.spawnSync(u.command,u.args,u.options);return r.error=r.error||Xe.verifyENOENTSync(r.status,u),r}to.exports=bu,M.spawn=bu,M.sync=Ro,M._parse=Je,M._enoent=Xe;function ko(e){const t=typeof e=="string"?`
|
|
23
23
|
`:`
|
|
24
|
-
`.charCodeAt(),
|
|
25
|
-
${
|
|
26
|
-
${
|
|
27
|
-
`);return b?(n.originalMessage=n.message,n.message=S):n=new Error(S),n.shortMessage=P,n.command=i,n.escapedCommand=o,n.exitCode=r,n.signal=D,n.signalDescription=f,n.stdout=e,n.stderr=u,t!==void 0&&(n.all=t),"bufferedData"in n&&delete n.bufferedData,n.failed=!0,n.timedOut=Boolean(s),n.isCanceled=a,n.killed=l&&!s,n},se=["stdin","stdout","stderr"],Br=e=>se.some(u=>e[u]!==void 0),wr=e=>{if(!e)return;const{stdio:u}=e;if(u===void 0)return se.map(n=>e[n]);if(Br(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${se.map(n=>`\`${n}\``).join(", ")}`);if(typeof u=="string")return u;if(!Array.isArray(u))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof u}\``);const t=Math.max(u.length,se.length);return Array.from({length:t},(n,D)=>u[D])};var G={},rt={get exports(){return G},set exports(e){G=e}},ae={},br={get exports(){return ae},set exports(e){ae=e}},it;function yr(){return it||(it=1,function(e){e.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"],process.platform!=="win32"&&e.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT"),process.platform==="linux"&&e.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")}(br)),ae}var m=I.process;const _=function(e){return e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function"};if(!_(m))rt.exports=function(){return function(){}};else{var $r=Wt,J=yr(),Ar=/^win/i.test(m.platform),ce=Kt;typeof ce!="function"&&(ce=ce.EventEmitter);var B;m.__signal_exit_emitter__?B=m.__signal_exit_emitter__:(B=m.__signal_exit_emitter__=new ce,B.count=0,B.emitted={}),B.infinite||(B.setMaxListeners(1/0),B.infinite=!0),rt.exports=function(e,u){if(!_(I.process))return function(){};$r.equal(typeof e,"function","a callback must be provided for exit handler"),X===!1&&ot();var t="exit";u&&u.alwaysLast&&(t="afterexit");var n=function(){B.removeListener(t,e),B.listeners("exit").length===0&&B.listeners("afterexit").length===0&&Le()};return B.on(t,e),n};var Le=function(){!X||!_(I.process)||(X=!1,J.forEach(function(u){try{m.removeListener(u,Me[u])}catch{}}),m.emit=Ge,m.reallyExit=st,B.count-=1)};G.unload=Le;var U=function(u,t,n){B.emitted[u]||(B.emitted[u]=!0,B.emit(u,t,n))},Me={};J.forEach(function(e){Me[e]=function(){if(_(I.process)){var t=m.listeners(e);t.length===B.count&&(Le(),U("exit",null,e),U("afterexit",null,e),Ar&&e==="SIGHUP"&&(e="SIGINT"),m.kill(m.pid,e))}}}),G.signals=function(){return J};var X=!1,ot=function(){X||!_(I.process)||(X=!0,B.count+=1,J=J.filter(function(u){try{return m.on(u,Me[u]),!0}catch{return!1}}),m.emit=xr,m.reallyExit=vr)};G.load=ot;var st=m.reallyExit,vr=function(u){_(I.process)&&(m.exitCode=u||0,U("exit",m.exitCode,null),U("afterexit",m.exitCode,null),st.call(m,m.exitCode))},Ge=m.emit,xr=function(u,t){if(u==="exit"&&_(I.process)){t!==void 0&&(m.exitCode=t);var n=Ge.apply(this,arguments);return U("exit",m.exitCode,null),U("afterexit",m.exitCode,null),n}else return Ge.apply(this,arguments)}}const Sr=1e3*5,Or=(e,u="SIGTERM",t={})=>{const n=e(u);return Ir(e,u,t,n),n},Ir=(e,u,t,n)=>{if(!Tr(u,t,n))return;const D=kr(t),r=setTimeout(()=>{e("SIGKILL")},D);r.unref&&r.unref()},Tr=(e,{forceKillAfterTimeout:u},t)=>Pr(e)&&u!==!1&&t,Pr=e=>e===Ut.constants.signals.SIGTERM||typeof e=="string"&&e.toUpperCase()==="SIGTERM",kr=({forceKillAfterTimeout:e=!0})=>{if(e===!0)return Sr;if(!Number.isFinite(e)||e<0)throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},Rr=(e,u)=>{e.kill()&&(u.isCanceled=!0)},_r=(e,u,t)=>{e.kill(u),t(Object.assign(new Error("Timed out"),{timedOut:!0,signal:u}))},jr=(e,{timeout:u,killSignal:t="SIGTERM"},n)=>{if(u===0||u===void 0)return n;let D;const r=new Promise((o,s)=>{D=setTimeout(()=>{_r(e,t,s)},u)}),i=n.finally(()=>{clearTimeout(D)});return Promise.race([r,i])},Nr=({timeout:e})=>{if(e!==void 0&&(!Number.isFinite(e)||e<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`)},Lr=async(e,{cleanup:u,detached:t},n)=>{if(!u||t)return n;const D=G(()=>{e.kill()});return n.finally(()=>{D()})};function Mr(e){return e!==null&&typeof e=="object"&&typeof e.pipe=="function"}var j={},Gr={get exports(){return j},set exports(e){j=e}};const{PassThrough:Ur}=ge;var Wr=e=>{e={...e};const{array:u}=e;let{encoding:t}=e;const n=t==="buffer";let D=!1;u?D=!(t||n):t=t||"utf8",n&&(t=null);const r=new Ur({objectMode:D});t&&r.setEncoding(t);let i=0;const o=[];return r.on("data",s=>{o.push(s),D?i=o.length:i+=s.length}),r.getBufferedValue=()=>u?o:n?Buffer.concat(o,i):o.join(""),r.getBufferedLength=()=>i,r};const{constants:Kr}=qt,qr=ge,{promisify:zr}=zt,Vr=Wr,Hr=zr(qr.pipeline);class at extends Error{constructor(){super("maxBuffer exceeded"),this.name="MaxBufferError"}}async function Ue(e,u){if(!e)throw new Error("Expected a stream");u={maxBuffer:1/0,...u};const{maxBuffer:t}=u,n=Vr(u);return await new Promise((D,r)=>{const i=o=>{o&&n.getBufferedLength()<=Kr.MAX_LENGTH&&(o.bufferedData=n.getBufferedValue()),r(o)};(async()=>{try{await Hr(e,n),D()}catch(o){i(o)}})(),n.on("data",()=>{n.getBufferedLength()>t&&i(new at)})}),n.getBufferedValue()}Gr.exports=Ue,j.buffer=(e,u)=>Ue(e,{...u,encoding:"buffer"}),j.array=(e,u)=>Ue(e,{...u,array:!0}),j.MaxBufferError=at;const{PassThrough:Yr}=ge;var Jr=function(){var e=[],u=new Yr({objectMode:!0});return u.setMaxListeners(0),u.add=t,u.isEmpty=n,u.on("unpipe",D),Array.prototype.slice.call(arguments).forEach(t),u;function t(r){return Array.isArray(r)?(r.forEach(t),this):(e.push(r),r.once("end",D.bind(null,r)),r.once("error",u.emit.bind(u,"error")),r.pipe(u,{end:!1}),this)}function n(){return e.length==0}function D(r){e=e.filter(function(i){return i!==r}),!e.length&&u.readable&&u.end()}};const Xr=(e,u)=>{u!==void 0&&(Mr(u)?u.pipe(e.stdin):e.stdin.end(u))},Zr=(e,{all:u})=>{if(!u||!e.stdout&&!e.stderr)return;const t=Jr();return e.stdout&&t.add(e.stdout),e.stderr&&t.add(e.stderr),t},We=async(e,u)=>{if(!(!e||u===void 0)){e.destroy();try{return await u}catch(t){return t.bufferedData}}},Ke=(e,{encoding:u,buffer:t,maxBuffer:n})=>{if(!(!e||!t))return u?j(e,{encoding:u,maxBuffer:n}):j.buffer(e,{maxBuffer:n})},Qr=async({stdout:e,stderr:u,all:t},{encoding:n,buffer:D,maxBuffer:r},i)=>{const o=Ke(e,{encoding:n,buffer:D,maxBuffer:r}),s=Ke(u,{encoding:n,buffer:D,maxBuffer:r}),a=Ke(t,{encoding:n,buffer:D,maxBuffer:r*2});try{return await Promise.all([i,o,s,a])}catch(l){return Promise.all([{error:l,signal:l.signal,timedOut:l.timedOut},We(e,o),We(u,s),We(t,a)])}},ei=(async()=>{})().constructor.prototype,ui=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(ei,e)]),ct=(e,u)=>{for(const[t,n]of ui){const D=typeof u=="function"?(...r)=>Reflect.apply(n.value,u(),r):n.value.bind(u);Reflect.defineProperty(e,t,{...n,value:D})}return e},ti=e=>new Promise((u,t)=>{e.on("exit",(n,D)=>{u({exitCode:n,signal:D})}),e.on("error",n=>{t(n)}),e.stdin&&e.stdin.on("error",n=>{t(n)})}),lt=(e,u=[])=>Array.isArray(u)?[e,...u]:[e],ni=/^[\w.-]+$/,Di=/"/g,ri=e=>typeof e!="string"||ni.test(e)?e:`"${e.replace(Di,'\\"')}"`,ii=(e,u)=>lt(e,u).join(" "),oi=(e,u)=>lt(e,u).map(t=>ri(t)).join(" "),si=1e3*1e3*100,ai=({env:e,extendEnv:u,preferLocal:t,localDir:n,execPath:D})=>{const r=u?{...g.env,...e}:e;return t?ur({env:r,cwd:n,execPath:D}):r},ci=(e,u,t={})=>{const n=R._parse(e,u,t);return e=n.command,u=n.args,t=n.options,t={maxBuffer:si,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:t.cwd||g.cwd(),execPath:g.execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,...t},t.env=ai(t),t.stdio=wr(t),g.platform==="win32"&&L.basename(e,".exe")==="cmd"&&u.unshift("/q"),{file:e,args:u,options:t,parsed:n}},qe=(e,u,t)=>typeof u!="string"&&!Lt.isBuffer(u)?t===void 0?void 0:"":e.stripFinalNewline?QD(u):u;function le(e,u,t){const n=ci(e,u,t),D=ii(e,u),r=oi(e,u);Nr(n.options);let i;try{i=lu.spawn(n.file,n.args,n.options)}catch(d){const F=new lu.ChildProcess,E=Promise.reject(Dt({error:d,stdout:"",stderr:"",all:"",command:D,escapedCommand:r,parsed:n,timedOut:!1,isCanceled:!1,killed:!1}));return ct(F,E)}const o=ti(i),s=jr(i,n.options,o),a=Lr(i,n.options,s),l={isCanceled:!1};i.kill=Or.bind(null,i.kill.bind(i)),i.cancel=Rr.bind(null,i,l);const f=et(async()=>{const[{error:d,exitCode:F,signal:E,timedOut:b},P,S,Q]=await Qr(i,n.options,a),iu=qe(n.options,P),ou=qe(n.options,S),su=qe(n.options,Q);if(d||F!==0||E!==null){const au=Dt({error:d,exitCode:F,signal:E,stdout:iu,stderr:ou,all:su,command:D,escapedCommand:r,parsed:n,timedOut:b,isCanceled:l.isCanceled||(n.options.signal?n.options.signal.aborted:!1),killed:i.killed});if(!n.options.reject)return au;throw au}return{command:D,escapedCommand:r,exitCode:0,stdout:iu,stderr:ou,all:su,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}});return Xr(i,n.options.input),i.all=Zr(i,n.options),ct(i,f)}let N=!0;const W=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{};let ft=0;if(W.process&&W.process.env&&W.process.stdout){const{FORCE_COLOR:e,NODE_DISABLE_COLORS:u,NO_COLOR:t,TERM:n}=W.process.env;u||t||e==="0"?N=!1:e==="1"||e==="2"||e==="3"?N=!0:n==="dumb"?N=!1:"CI"in W.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(D=>D in W.process.env)?N=!0:N=process.stdout.isTTY,N&&(ft=n&&n.endsWith("-256color")?2:1)}let dt={enabled:N,supportLevel:ft};function Z(e,u,t=1){const n=`\x1B[${e}m`,D=`\x1B[${u}m`,r=new RegExp(`\\x1b\\[${u}m`,"g");return i=>dt.enabled&&dt.supportLevel>=t?n+(""+i).replace(r,n)+D:""+i}const ze=Z(2,22),pt=Z(30,39),fe=Z(31,39),de=Z(32,39),Ft=Z(46,49),Ve="\x1B",h=`${Ve}[`,li="\x07",He={to(e,u){return u?`${h}${u+1};${e+1}H`:`${h}${e+1}G`},move(e,u){let t="";return e<0?t+=`${h}${-e}D`:e>0&&(t+=`${h}${e}C`),u<0?t+=`${h}${-u}A`:u>0&&(t+=`${h}${u}B`),t},up:(e=1)=>`${h}${e}A`,down:(e=1)=>`${h}${e}B`,forward:(e=1)=>`${h}${e}C`,backward:(e=1)=>`${h}${e}D`,nextLine:(e=1)=>`${h}E`.repeat(e),prevLine:(e=1)=>`${h}F`.repeat(e),left:`${h}G`,hide:`${h}?25l`,show:`${h}?25h`,save:`${Ve}7`,restore:`${Ve}8`},fi={up:(e=1)=>`${h}S`.repeat(e),down:(e=1)=>`${h}T`.repeat(e)},di={screen:`${h}2J`,up:(e=1)=>`${h}1J`.repeat(e),down:(e=1)=>`${h}J`.repeat(e),line:`${h}2K`,lineEnd:`${h}K`,lineStart:`${h}1K`,lines(e){let u="";for(let t=0;t<e;t++)u+=this.line+(t<e-1?He.up():"");return e&&(u+=He.left),u}};var w={cursor:He,scroll:fi,erase:di,beep:li},p={},pi={get exports(){return p},set exports(e){p=e}};let Fi=cu,mi=!("NO_COLOR"in process.env||process.argv.includes("--no-color"))&&("FORCE_COLOR"in process.env||process.argv.includes("--color")||process.platform==="win32"||Fi.isatty(1)&&process.env.TERM!=="dumb"||"CI"in process.env),C=(e,u,t=e)=>n=>{let D=""+n,r=D.indexOf(u,e.length);return~r?e+mt(D,u,t,r)+u:e+D+u},mt=(e,u,t,n)=>{let D=e.substring(0,n)+t,r=e.substring(n+u.length),i=r.indexOf(u);return~i?D+mt(r,u,t,i):D+r},Ct=(e=mi)=>({isColorSupported:e,reset:e?u=>`\x1B[0m${u}\x1B[0m`:String,bold:e?C("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"):String,dim:e?C("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"):String,italic:e?C("\x1B[3m","\x1B[23m"):String,underline:e?C("\x1B[4m","\x1B[24m"):String,inverse:e?C("\x1B[7m","\x1B[27m"):String,hidden:e?C("\x1B[8m","\x1B[28m"):String,strikethrough:e?C("\x1B[9m","\x1B[29m"):String,black:e?C("\x1B[30m","\x1B[39m"):String,red:e?C("\x1B[31m","\x1B[39m"):String,green:e?C("\x1B[32m","\x1B[39m"):String,yellow:e?C("\x1B[33m","\x1B[39m"):String,blue:e?C("\x1B[34m","\x1B[39m"):String,magenta:e?C("\x1B[35m","\x1B[39m"):String,cyan:e?C("\x1B[36m","\x1B[39m"):String,white:e?C("\x1B[37m","\x1B[39m"):String,gray:e?C("\x1B[90m","\x1B[39m"):String,bgBlack:e?C("\x1B[40m","\x1B[49m"):String,bgRed:e?C("\x1B[41m","\x1B[49m"):String,bgGreen:e?C("\x1B[42m","\x1B[49m"):String,bgYellow:e?C("\x1B[43m","\x1B[49m"):String,bgBlue:e?C("\x1B[44m","\x1B[49m"):String,bgMagenta:e?C("\x1B[45m","\x1B[49m"):String,bgCyan:e?C("\x1B[46m","\x1B[49m"):String,bgWhite:e?C("\x1B[47m","\x1B[49m"):String});pi.exports=Ct(),p.createColors=Ct;function Ci(e,u){if(e===u)return;const t=e.split(`
|
|
28
|
-
`),
|
|
29
|
-
`),
|
|
30
|
-
`)
|
|
31
|
-
`).length-1;this.output.write(
|
|
32
|
-
`);this.output.write(
|
|
33
|
-
`).slice(
|
|
34
|
-
`)),this._prevFrame=
|
|
35
|
-
${
|
|
36
|
-
`,
|
|
37
|
-
${
|
|
38
|
-
${
|
|
39
|
-
`}}}).prompt()},
|
|
40
|
-
${
|
|
41
|
-
`;switch(this.state){case"submit":return`${
|
|
42
|
-
${
|
|
43
|
-
${
|
|
44
|
-
${
|
|
45
|
-
`}}}).prompt()},
|
|
46
|
-
`)},
|
|
47
|
-
${
|
|
24
|
+
`.charCodeAt(),n=typeof e=="string"?"\r":"\r".charCodeAt();return e[e.length-1]===t&&(e=e.slice(0,-1)),e[e.length-1]===n&&(e=e.slice(0,-1)),e}function wu(e={}){const{env:t=process.env,platform:n=process.platform}=e;return n!=="win32"?"PATH":Object.keys(t).reverse().find(u=>u.toUpperCase()==="PATH")||"Path"}function Mo(e={}){const{cwd:t=b.cwd(),path:n=b.env[wu()],execPath:u=b.execPath}=e;let r;const o=t instanceof URL?$n.fileURLToPath(t):t;let s=W.resolve(o);const i=[];for(;r!==s;)i.push(W.join(s,"node_modules/.bin")),r=s,s=W.resolve(s,"..");return i.push(W.resolve(o,u,"..")),[...i,n].join(W.delimiter)}function jo({env:e=b.env,...t}={}){e={...e};const n=wu({env:e});return t.path=e[n],e[n]=Mo(t),e}const Lo=(e,t,n,u)=>{if(n==="length"||n==="prototype"||n==="arguments"||n==="caller")return;const r=Object.getOwnPropertyDescriptor(e,n),o=Object.getOwnPropertyDescriptor(t,n);!No(r,o)&&u||Object.defineProperty(e,n,o)},No=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},Go=(e,t)=>{const n=Object.getPrototypeOf(t);n!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,n)},Uo=(e,t)=>`/* Wrapped ${e}*/
|
|
25
|
+
${t}`,Wo=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),qo=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Ho=(e,t,n)=>{const u=n===""?"":`with ${n.trim()}() `,r=Uo.bind(null,u,t.toString());Object.defineProperty(r,"name",qo),Object.defineProperty(e,"toString",{...Wo,value:r})};function zo(e,t,{ignoreNonConfigurable:n=!1}={}){const{name:u}=e;for(const r of Reflect.ownKeys(t))Lo(e,t,r,n);return Go(e,t),Ho(e,t,u),e}const ge=new WeakMap,Bu=(e,t={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let n,u=0;const r=e.displayName||e.name||"<anonymous>",o=function(...s){if(ge.set(o,++u),u===1)n=e.apply(this,s),e=null;else if(t.throw===!0)throw new Error(`Function \`${r}\` can only be called once`);return n};return zo(o,e),ge.set(o,u),o};Bu.callCount=e=>{if(!ge.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return ge.get(e)};const Ko=function(){const e=vu-$u+1;return Array.from({length:e},Vo)},Vo=function(e,t){return{name:`SIGRT${t+1}`,number:$u+t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}},$u=34,vu=64,Yo=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}],Au=function(){const e=Ko();return[...Yo,...e].map(Jo)},Jo=function({name:e,number:t,description:n,action:u,forced:r=!1,standard:o}){const{signals:{[e]:s}}=_t,i=s!==void 0;return{name:e,number:i?s:t,description:n,supported:i,action:u,forced:r,standard:o}},Xo=function(){const e=Au();return Object.fromEntries(e.map(Zo))},Zo=function({name:e,number:t,description:n,supported:u,action:r,forced:o,standard:s}){return[e,{name:e,number:t,description:n,supported:u,action:r,forced:o,standard:s}]},Qo=Xo(),es=function(){const e=Au(),t=vu+1,n=Array.from({length:t},(u,r)=>ts(r,e));return Object.assign({},...n)},ts=function(e,t){const n=us(e,t);if(n===void 0)return{};const{name:u,description:r,supported:o,action:s,forced:i,standard:D}=n;return{[e]:{name:u,number:e,description:r,supported:o,action:s,forced:i,standard:D}}},us=function(e,t){const n=t.find(({name:u})=>_t.signals[u]===e);return n!==void 0?n:t.find(u=>u.number===e)};es();const ns=({timedOut:e,timeout:t,errorCode:n,signal:u,signalDescription:r,exitCode:o,isCanceled:s})=>e?`timed out after ${t} milliseconds`:s?"was canceled":n!==void 0?`failed with ${n}`:u!==void 0?`was killed with ${u} (${r})`:o!==void 0?`failed with exit code ${o}`:"failed",xu=({stdout:e,stderr:t,all:n,error:u,signal:r,exitCode:o,command:s,escapedCommand:i,timedOut:D,isCanceled:l,killed:f,parsed:{options:{timeout:a}}})=>{o=o===null?void 0:o,r=r===null?void 0:r;const c=r===void 0?void 0:Qo[r].description,d=u&&u.code,m=`Command ${ns({timedOut:D,timeout:a,errorCode:d,signal:r,signalDescription:c,exitCode:o,isCanceled:l})}: ${s}`,h=Object.prototype.toString.call(u)==="[object Error]",F=h?`${m}
|
|
26
|
+
${u.message}`:m,B=[F,t,e].filter(Boolean).join(`
|
|
27
|
+
`);return h?(u.originalMessage=u.message,u.message=B):u=new Error(B),u.shortMessage=F,u.command=s,u.escapedCommand=i,u.exitCode=o,u.signal=r,u.signalDescription=c,u.stdout=e,u.stderr=t,n!==void 0&&(u.all=n),"bufferedData"in u&&delete u.bufferedData,u.failed=!0,u.timedOut=Boolean(D),u.isCanceled=l,u.killed=f&&!D,u},Ee=["stdin","stdout","stderr"],rs=e=>Ee.some(t=>e[t]!==void 0),os=e=>{if(!e)return;const{stdio:t}=e;if(t===void 0)return Ee.map(u=>e[u]);if(rs(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Ee.map(u=>`\`${u}\``).join(", ")}`);if(typeof t=="string")return t;if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);const n=Math.max(t.length,Ee.length);return Array.from({length:n},(u,r)=>t[r])};var H={},Su={get exports(){return H},set exports(e){H=e}},ye={},ss={get exports(){return ye},set exports(e){ye=e}},Ou;function is(){return Ou||(Ou=1,function(e){e.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"],process.platform!=="win32"&&e.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT"),process.platform==="linux"&&e.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")}(ss)),ye}var g=w.process;const j=function(e){return e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function"};if(!j(g))Su.exports=function(){return function(){}};else{var Ds=Rt,ee=is(),as=/^win/i.test(g.platform),be=kt;typeof be!="function"&&(be=be.EventEmitter);var $;g.__signal_exit_emitter__?$=g.__signal_exit_emitter__:($=g.__signal_exit_emitter__=new be,$.count=0,$.emitted={}),$.infinite||($.setMaxListeners(1/0),$.infinite=!0),Su.exports=function(e,t){if(!j(w.process))return function(){};Ds.equal(typeof e,"function","a callback must be provided for exit handler"),te===!1&&Iu();var n="exit";t&&t.alwaysLast&&(n="afterexit");var u=function(){$.removeListener(n,e),$.listeners("exit").length===0&&$.listeners("afterexit").length===0&&Ze()};return $.on(n,e),u};var Ze=function(){!te||!j(w.process)||(te=!1,ee.forEach(function(t){try{g.removeListener(t,Qe[t])}catch{}}),g.emit=et,g.reallyExit=Tu,$.count-=1)};H.unload=Ze;var z=function(t,n,u){$.emitted[t]||($.emitted[t]=!0,$.emit(t,n,u))},Qe={};ee.forEach(function(e){Qe[e]=function(){if(j(w.process)){var n=g.listeners(e);n.length===$.count&&(Ze(),z("exit",null,e),z("afterexit",null,e),as&&e==="SIGHUP"&&(e="SIGINT"),g.kill(g.pid,e))}}}),H.signals=function(){return ee};var te=!1,Iu=function(){te||!j(w.process)||(te=!0,$.count+=1,ee=ee.filter(function(t){try{return g.on(t,Qe[t]),!0}catch{return!1}}),g.emit=ls,g.reallyExit=cs)};H.load=Iu;var Tu=g.reallyExit,cs=function(t){j(w.process)&&(g.exitCode=t||0,z("exit",g.exitCode,null),z("afterexit",g.exitCode,null),Tu.call(g,g.exitCode))},et=g.emit,ls=function(t,n){if(t==="exit"&&j(w.process)){n!==void 0&&(g.exitCode=n);var u=et.apply(this,arguments);return z("exit",g.exitCode,null),z("afterexit",g.exitCode,null),u}else return et.apply(this,arguments)}}const fs=1e3*5,ds=(e,t="SIGTERM",n={})=>{const u=e(t);return ps(e,t,n,u),u},ps=(e,t,n,u)=>{if(!Cs(t,n,u))return;const r=hs(n),o=setTimeout(()=>{e("SIGKILL")},r);o.unref&&o.unref()},Cs=(e,{forceKillAfterTimeout:t},n)=>ms(e)&&t!==!1&&n,ms=e=>e===vn.constants.signals.SIGTERM||typeof e=="string"&&e.toUpperCase()==="SIGTERM",hs=({forceKillAfterTimeout:e=!0})=>{if(e===!0)return fs;if(!Number.isFinite(e)||e<0)throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},Fs=(e,t)=>{e.kill()&&(t.isCanceled=!0)},gs=(e,t,n)=>{e.kill(t),n(Object.assign(new Error("Timed out"),{timedOut:!0,signal:t}))},Es=(e,{timeout:t,killSignal:n="SIGTERM"},u)=>{if(t===0||t===void 0)return u;let r;const o=new Promise((i,D)=>{r=setTimeout(()=>{gs(e,n,D)},t)}),s=u.finally(()=>{clearTimeout(r)});return Promise.race([o,s])},ys=({timeout:e})=>{if(e!==void 0&&(!Number.isFinite(e)||e<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`)},bs=async(e,{cleanup:t,detached:n},u)=>{if(!t||n)return u;const r=H(()=>{e.kill()});return u.finally(()=>{r()})};function ws(e){return e!==null&&typeof e=="object"&&typeof e.pipe=="function"}var L={},Bs={get exports(){return L},set exports(e){L=e}};const{PassThrough:$s}=Pe;var vs=e=>{e={...e};const{array:t}=e;let{encoding:n}=e;const u=n==="buffer";let r=!1;t?r=!(n||u):n=n||"utf8",u&&(n=null);const o=new $s({objectMode:r});n&&o.setEncoding(n);let s=0;const i=[];return o.on("data",D=>{i.push(D),r?s=i.length:s+=D.length}),o.getBufferedValue=()=>t?i:u?Buffer.concat(i,s):i.join(""),o.getBufferedLength=()=>s,o};const{constants:As}=An,xs=Pe,{promisify:Ss}=Mt,Os=vs,Is=Ss(xs.pipeline);class Pu extends Error{constructor(){super("maxBuffer exceeded"),this.name="MaxBufferError"}}async function tt(e,t){if(!e)throw new Error("Expected a stream");t={maxBuffer:1/0,...t};const{maxBuffer:n}=t,u=Os(t);return await new Promise((r,o)=>{const s=i=>{i&&u.getBufferedLength()<=As.MAX_LENGTH&&(i.bufferedData=u.getBufferedValue()),o(i)};(async()=>{try{await Is(e,u),r()}catch(i){s(i)}})(),u.on("data",()=>{u.getBufferedLength()>n&&s(new Pu)})}),u.getBufferedValue()}Bs.exports=tt,L.buffer=(e,t)=>tt(e,{...t,encoding:"buffer"}),L.array=(e,t)=>tt(e,{...t,array:!0}),L.MaxBufferError=Pu;const{PassThrough:Ts}=Pe;var Ps=function(){var e=[],t=new Ts({objectMode:!0});return t.setMaxListeners(0),t.add=n,t.isEmpty=u,t.on("unpipe",r),Array.prototype.slice.call(arguments).forEach(n),t;function n(o){return Array.isArray(o)?(o.forEach(n),this):(e.push(o),o.once("end",r.bind(null,o)),o.once("error",t.emit.bind(t,"error")),o.pipe(t,{end:!1}),this)}function u(){return e.length==0}function r(o){e=e.filter(function(s){return s!==o}),!e.length&&t.readable&&t.end()}};const _s=(e,t)=>{t!==void 0&&(ws(t)?t.pipe(e.stdin):e.stdin.end(t))},Rs=(e,{all:t})=>{if(!t||!e.stdout&&!e.stderr)return;const n=Ps();return e.stdout&&n.add(e.stdout),e.stderr&&n.add(e.stderr),n},ut=async(e,t)=>{if(!(!e||t===void 0)){e.destroy();try{return await t}catch(n){return n.bufferedData}}},nt=(e,{encoding:t,buffer:n,maxBuffer:u})=>{if(!(!e||!n))return t?L(e,{encoding:t,maxBuffer:u}):L.buffer(e,{maxBuffer:u})},ks=async({stdout:e,stderr:t,all:n},{encoding:u,buffer:r,maxBuffer:o},s)=>{const i=nt(e,{encoding:u,buffer:r,maxBuffer:o}),D=nt(t,{encoding:u,buffer:r,maxBuffer:o}),l=nt(n,{encoding:u,buffer:r,maxBuffer:o*2});try{return await Promise.all([s,i,D,l])}catch(f){return Promise.all([{error:f,signal:f.signal,timedOut:f.timedOut},ut(e,i),ut(t,D),ut(n,l)])}},Ms=(async()=>{})().constructor.prototype,js=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(Ms,e)]),_u=(e,t)=>{for(const[n,u]of js){const r=typeof t=="function"?(...o)=>Reflect.apply(u.value,t(),o):u.value.bind(t);Reflect.defineProperty(e,n,{...u,value:r})}return e},Ls=e=>new Promise((t,n)=>{e.on("exit",(u,r)=>{t({exitCode:u,signal:r})}),e.on("error",u=>{n(u)}),e.stdin&&e.stdin.on("error",u=>{n(u)})}),Ru=(e,t=[])=>Array.isArray(t)?[e,...t]:[e],Ns=/^[\w.-]+$/,Gs=/"/g,Us=e=>typeof e!="string"||Ns.test(e)?e:`"${e.replace(Gs,'\\"')}"`,Ws=(e,t)=>Ru(e,t).join(" "),qs=(e,t)=>Ru(e,t).map(n=>Us(n)).join(" "),Hs=1e3*1e3*100,zs=({env:e,extendEnv:t,preferLocal:n,localDir:u,execPath:r})=>{const o=t?{...b.env,...e}:e;return n?jo({env:o,cwd:u,execPath:r}):o},Ks=(e,t,n={})=>{const u=M._parse(e,t,n);return e=u.command,t=u.args,n=u.options,n={maxBuffer:Hs,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:n.cwd||b.cwd(),execPath:b.execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,...n},n.env=zs(n),n.stdio=os(n),b.platform==="win32"&&W.basename(e,".exe")==="cmd"&&t.unshift("/q"),{file:e,args:t,options:n,parsed:u}},rt=(e,t,n)=>typeof t!="string"&&!wn.isBuffer(t)?n===void 0?void 0:"":e.stripFinalNewline?ko(t):t;function ue(e,t,n){const u=Ks(e,t,n),r=Ws(e,t),o=qs(e,t);ys(u.options);let s;try{s=It.spawn(u.file,u.args,u.options)}catch(d){const p=new It.ChildProcess,m=Promise.reject(xu({error:d,stdout:"",stderr:"",all:"",command:r,escapedCommand:o,parsed:u,timedOut:!1,isCanceled:!1,killed:!1}));return _u(p,m)}const i=Ls(s),D=Es(s,u.options,i),l=bs(s,u.options,D),f={isCanceled:!1};s.kill=ds.bind(null,s.kill.bind(s)),s.cancel=Fs.bind(null,s,f);const c=Bu(async()=>{const[{error:d,exitCode:p,signal:m,timedOut:h},F,B,T]=await ks(s,u.options,l),ce=rt(u.options,F),R=rt(u.options,B),Ie=rt(u.options,T);if(d||p!==0||m!==null){const U=xu({error:d,exitCode:p,signal:m,stdout:ce,stderr:R,all:Ie,command:r,escapedCommand:o,parsed:u,timedOut:h,isCanceled:f.isCanceled||(u.options.signal?u.options.signal.aborted:!1),killed:s.killed});if(!u.options.reject)return U;throw U}return{command:r,escapedCommand:o,exitCode:0,stdout:ce,stderr:R,all:Ie,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}});return _s(s,u.options.input),s.all=Rs(s,u.options),_u(s,c)}let N=!0;const K=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{};let ku=0;if(K.process&&K.process.env&&K.process.stdout){const{FORCE_COLOR:e,NODE_DISABLE_COLORS:t,NO_COLOR:n,TERM:u}=K.process.env;t||n||e==="0"?N=!1:e==="1"||e==="2"||e==="3"?N=!0:u==="dumb"?N=!1:"CI"in K.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(r=>r in K.process.env)?N=!0:N=process.stdout.isTTY,N&&(ku=u&&u.endsWith("-256color")?2:1)}let Mu={enabled:N,supportLevel:ku};function ne(e,t,n=1){const u=`\x1B[${e}m`,r=`\x1B[${t}m`,o=new RegExp(`\\x1b\\[${t}m`,"g");return s=>Mu.enabled&&Mu.supportLevel>=n?u+(""+s).replace(o,u)+r:""+s}const ot=ne(2,22),ju=ne(30,39),we=ne(31,39),Be=ne(32,39),Lu=ne(46,49),st="\x1B",y=`${st}[`,Vs="\x07",it={to(e,t){return t?`${y}${t+1};${e+1}H`:`${y}${e+1}G`},move(e,t){let n="";return e<0?n+=`${y}${-e}D`:e>0&&(n+=`${y}${e}C`),t<0?n+=`${y}${-t}A`:t>0&&(n+=`${y}${t}B`),n},up:(e=1)=>`${y}${e}A`,down:(e=1)=>`${y}${e}B`,forward:(e=1)=>`${y}${e}C`,backward:(e=1)=>`${y}${e}D`,nextLine:(e=1)=>`${y}E`.repeat(e),prevLine:(e=1)=>`${y}F`.repeat(e),left:`${y}G`,hide:`${y}?25l`,show:`${y}?25h`,save:`${st}7`,restore:`${st}8`},Ys={up:(e=1)=>`${y}S`.repeat(e),down:(e=1)=>`${y}T`.repeat(e)},Js={screen:`${y}2J`,up:(e=1)=>`${y}1J`.repeat(e),down:(e=1)=>`${y}J`.repeat(e),line:`${y}2K`,lineEnd:`${y}K`,lineStart:`${y}1K`,lines(e){let t="";for(let n=0;n<e;n++)t+=this.line+(n<e-1?it.up():"");return e&&(t+=it.left),t}};var v={cursor:it,scroll:Ys,erase:Js,beep:Vs},C={},Xs={get exports(){return C},set exports(e){C=e}};let Zs=le,Qs=!("NO_COLOR"in process.env||process.argv.includes("--no-color"))&&("FORCE_COLOR"in process.env||process.argv.includes("--color")||process.platform==="win32"||Zs.isatty(1)&&process.env.TERM!=="dumb"||"CI"in process.env),E=(e,t,n=e)=>u=>{let r=""+u,o=r.indexOf(t,e.length);return~o?e+Nu(r,t,n,o)+t:e+r+t},Nu=(e,t,n,u)=>{let r=e.substring(0,u)+n,o=e.substring(u+t.length),s=o.indexOf(t);return~s?r+Nu(o,t,n,s):r+o},Gu=(e=Qs)=>({isColorSupported:e,reset:e?t=>`\x1B[0m${t}\x1B[0m`:String,bold:e?E("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"):String,dim:e?E("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"):String,italic:e?E("\x1B[3m","\x1B[23m"):String,underline:e?E("\x1B[4m","\x1B[24m"):String,inverse:e?E("\x1B[7m","\x1B[27m"):String,hidden:e?E("\x1B[8m","\x1B[28m"):String,strikethrough:e?E("\x1B[9m","\x1B[29m"):String,black:e?E("\x1B[30m","\x1B[39m"):String,red:e?E("\x1B[31m","\x1B[39m"):String,green:e?E("\x1B[32m","\x1B[39m"):String,yellow:e?E("\x1B[33m","\x1B[39m"):String,blue:e?E("\x1B[34m","\x1B[39m"):String,magenta:e?E("\x1B[35m","\x1B[39m"):String,cyan:e?E("\x1B[36m","\x1B[39m"):String,white:e?E("\x1B[37m","\x1B[39m"):String,gray:e?E("\x1B[90m","\x1B[39m"):String,bgBlack:e?E("\x1B[40m","\x1B[49m"):String,bgRed:e?E("\x1B[41m","\x1B[49m"):String,bgGreen:e?E("\x1B[42m","\x1B[49m"):String,bgYellow:e?E("\x1B[43m","\x1B[49m"):String,bgBlue:e?E("\x1B[44m","\x1B[49m"):String,bgMagenta:e?E("\x1B[45m","\x1B[49m"):String,bgCyan:e?E("\x1B[46m","\x1B[49m"):String,bgWhite:e?E("\x1B[47m","\x1B[49m"):String});Xs.exports=Gu(),C.createColors=Gu;function ei(e,t){if(e===t)return;const n=e.split(`
|
|
28
|
+
`),u=t.split(`
|
|
29
|
+
`),r=[];for(let o=0;o<Math.max(n.length,u.length);o++)n[o]!==u[o]&&r.push(o);return r}const Uu=Symbol("clack:cancel");function Wu(e){return e===Uu}function $e(e,t){e.isTTY&&e.setRawMode(t)}const qu=new Map([["k","up"],["j","down"],["h","left"],["l","right"]]),ti=new Set(["up","down","left","right","space","enter"]);class Hu{constructor({render:t,input:n=Tt,output:u=Pt,...r},o=!0){this._track=!1,this._cursor=0,this.state="initial",this.error="",this.subscribers=new Map,this._prevFrame="",this.opts=r,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=t.bind(this),this._track=o,this.input=n,this.output=u}prompt(){const t=new xn(0);return t._write=(n,u,r)=>{this._track&&(this.value=this.rl.line.replace(/\t/g,""),this._cursor=this.rl.cursor,this.emit("value",this.value)),r()},this.input.pipe(t),this.rl=jt.createInterface({input:this.input,output:t,tabSize:2,prompt:"",escapeCodeTimeout:50}),jt.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),$e(this.input,!0),this.render(),new Promise((n,u)=>{this.once("submit",()=>{this.output.write(v.cursor.show),$e(this.input,!1),n(this.value)}),this.once("cancel",()=>{this.output.write(v.cursor.show),$e(this.input,!1),n(Uu)})})}on(t,n){const u=this.subscribers.get(t)??[];u.push({cb:n}),this.subscribers.set(t,u)}once(t,n){const u=this.subscribers.get(t)??[];u.push({cb:n,once:!0}),this.subscribers.set(t,u)}emit(t,...n){const u=this.subscribers.get(t)??[],r=[];for(const o of u)o.cb(...n),o.once&&r.push(()=>u.splice(u.indexOf(o),1));for(const o of r)o()}unsubscribe(){this.subscribers.clear()}onKeypress(t,n){if(this.state==="error"&&(this.state="active"),n?.name&&!this._track&&qu.has(n.name)&&this.emit("cursor",qu.get(n.name)),n?.name&&ti.has(n.name)&&this.emit("cursor",n.name),t&&(t.toLowerCase()==="y"||t.toLowerCase()==="n")&&this.emit("confirm",t.toLowerCase()==="y"),t&&this.emit("key",t.toLowerCase()),n?.name==="return"){if(this.opts.validate){const u=this.opts.validate(this.value);u&&(this.error=u,this.state="error",this.rl.write(this.value))}this.state!=="error"&&(this.state="submit")}t===""&&(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(`
|
|
30
|
+
`),$e(this.input,!1),this.rl.close(),this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){const t=this._prevFrame.split(`
|
|
31
|
+
`).length-1;this.output.write(v.cursor.move(-999,t*-1))}render(){const t=this._render(this)??"";if(t!==this._prevFrame){if(this.state==="initial")this.output.write(v.cursor.hide);else{const n=ei(this._prevFrame,t);if(this.restoreCursor(),n&&n?.length===1){const u=n[0];this.output.write(v.cursor.move(0,u)),this.output.write(v.erase.lines(1));const r=t.split(`
|
|
32
|
+
`);this.output.write(r[u]),this._prevFrame=t,this.output.write(v.cursor.move(0,r.length-u-1));return}else if(n&&n?.length>1){const u=n[0];this.output.write(v.cursor.move(0,u)),this.output.write(v.erase.down());const r=t.split(`
|
|
33
|
+
`).slice(u);this.output.write(r.join(`
|
|
34
|
+
`)),this._prevFrame=t;return}this.output.write(v.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}}class ui extends Hu{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(t){super(t,!1),this.value=!!t.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",n=>{this.output.write(v.cursor.move(0,-1)),this.value=n,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}class ni extends Hu{constructor(t){super(t,!1),this.cursor=0,this.options=t.options,this.cursor=this.options.findIndex(({value:n})=>n===t.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",n=>{switch(n){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}}function ri({input:e=Tt,output:t=Pt,overwrite:n=!0,hideCursor:u=!0}={}){const r=fe.createInterface({input:e,output:t,prompt:"",tabSize:1});fe.emitKeypressEvents(e,r),e.isTTY&&e.setRawMode(!0);const o=(s,{name:i})=>{if(String(s)===""&&process.exit(0),!n)return;let D=i==="return"?0:-1,l=i==="return"?-1:0;fe.moveCursor(t,D,l,()=>{fe.clearLine(t,1,()=>{e.once("keypress",o)})})};return u&&process.stdout.write(v.cursor.hide),e.once("keypress",o),()=>{e.off("keypress",o),u&&process.stdout.write(v.cursor.show),r.terminal=!1,r.close()}}function oi(){return b.platform!=="win32"?b.env.TERM!=="linux":Boolean(b.env.CI)||Boolean(b.env.WT_SESSION)||Boolean(b.env.TERMINUS_SUBLIME)||b.env.ConEmuTask==="{cmd::Cmder}"||b.env.TERM_PROGRAM==="Terminus-Sublime"||b.env.TERM_PROGRAM==="vscode"||b.env.TERM==="xterm-256color"||b.env.TERM==="alacritty"||b.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}const Dt=oi(),P=(e,t)=>Dt?e:t,si=P("\u25C6","*"),ii=P("\u25A0","x"),Di=P("\u25B2","x"),zu=P("\u25C7","o"),ai=P("\u250C","T"),S=P("\u2502","|"),at=P("\u2514","\u2014"),ct=P("\u25CF",">"),lt=P("\u25CB"," "),Ku=e=>{switch(e){case"initial":case"active":return C.cyan(si);case"cancel":return C.red(ii);case"error":return C.yellow(Di);case"submit":return C.green(zu)}},ci=e=>{const t=e.active??"Yes",n=e.inactive??"No";return new ui({active:t,inactive:n,initialValue:e.initialValue??!0,render(){const u=`${C.gray(S)}
|
|
35
|
+
${Ku(this.state)} ${e.message}
|
|
36
|
+
`,r=this.value?t:n;switch(this.state){case"submit":return`${u}${C.gray(S)} ${C.dim(r)}`;case"cancel":return`${u}${C.gray(S)} ${C.strikethrough(C.dim(r))}
|
|
37
|
+
${C.gray(S)}`;default:return`${u}${C.cyan(S)} ${this.value?`${C.green(ct)} ${t}`:`${C.dim(lt)} ${C.dim(t)}`} ${C.dim("/")} ${this.value?`${C.dim(lt)} ${C.dim(n)}`:`${C.green(ct)} ${n}`}
|
|
38
|
+
${C.cyan(at)}
|
|
39
|
+
`}}}).prompt()},li=e=>{const t=(n,u)=>{const r=n.label??String(n.value);return u==="active"?`${C.green(ct)} ${r} ${n.hint?C.dim(`(${n.hint})`):""}`:u==="selected"?`${C.dim(r)}`:u==="cancelled"?`${C.strikethrough(C.dim(r))}`:`${C.dim(lt)} ${C.dim(r)}`};return new ni({options:e.options,initialValue:e.initialValue,render(){const n=`${C.gray(S)}
|
|
40
|
+
${Ku(this.state)} ${e.message}
|
|
41
|
+
`;switch(this.state){case"submit":return`${n}${C.gray(S)} ${t(this.options[this.cursor],"selected")}`;case"cancel":return`${n}${C.gray(S)} ${t(this.options[this.cursor],"cancelled")}
|
|
42
|
+
${C.gray(S)}`;default:return`${n}${C.cyan(S)} ${this.options.map((u,r)=>t(u,r===this.cursor?"active":"inactive")).join(`
|
|
43
|
+
${C.cyan(S)} `)}
|
|
44
|
+
${C.cyan(at)}
|
|
45
|
+
`}}}).prompt()},Vu=(e="")=>{process.stdout.write(`${C.gray(ai)} ${e}
|
|
46
|
+
`)},V=(e="")=>{process.stdout.write(`${C.gray(S)}
|
|
47
|
+
${C.gray(at)} ${e}
|
|
48
48
|
|
|
49
|
-
`)},
|
|
50
|
-
${
|
|
51
|
-
`);let
|
|
52
|
-
`),
|
|
53
|
-
${
|
|
54
|
-
`),e()}}};class
|
|
49
|
+
`)},ft=Dt?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],dt=()=>{let e,t;const n=Dt?80:120;return{start(u=""){u=u.replace(/\.?\.?\.$/,""),e=ri(),process.stdout.write(`${C.gray(S)}
|
|
50
|
+
${C.magenta("\u25CB")} ${u}
|
|
51
|
+
`);let r=0,o=0;t=setInterval(()=>{let s=ft[r];process.stdout.write(v.cursor.move(-999,-1)),process.stdout.write(`${C.magenta(s)} ${u}${Math.floor(o)>=1?".".repeat(Math.floor(o)).slice(0,3):""}
|
|
52
|
+
`),r=r===ft.length-1?0:r+1,o=o===ft.length?0:o+.125},n)},stop(u=""){process.stdout.write(v.cursor.move(-999,-2)),process.stdout.write(v.erase.down(2)),clearInterval(t),process.stdout.write(`${C.gray(S)}
|
|
53
|
+
${C.green(zu)} ${u}
|
|
54
|
+
`),e()}}};class x extends Error{}const pt=" ",ve=e=>{e instanceof Error&&!(e instanceof x)&&(e.stack&&console.error(ot(e.stack.split(`
|
|
55
55
|
`).slice(1).join(`
|
|
56
56
|
`))),console.error(`
|
|
57
|
-
${
|
|
58
|
-
${
|
|
59
|
-
`),diff:
|
|
57
|
+
${pt}${ot(`aicommits v${iu}`)}`),console.error(`
|
|
58
|
+
${pt}Please open a Bug report with the information above:`),console.error(`${pt}https://github.com/Nutlope/aicommits/issues/new/choose`))},Yu=async()=>{const{stdout:e}=await ue("git",["rev-parse","--is-inside-work-tree"],{reject:!1});if(e!=="true")throw new x("The current directory must be a Git repository!")},Ct=e=>`:(exclude)${e}`,Ju=["package-lock.json","pnpm-lock.yaml","*.lock"].map(Ct),Xu=async e=>{const t=["diff","--cached"],{stdout:n}=await ue("git",[...t,"--name-only",...Ju,...e?e.map(Ct):[]]);if(!n)return;const{stdout:u}=await ue("git",[...t,...Ju,...e?e.map(Ct):[]]);return{files:n.split(`
|
|
59
|
+
`),diff:u}},fi=e=>`Detected ${e.length.toLocaleString()} staged file${e.length>1?"s":""}`,{hasOwnProperty:mt}=Object.prototype,Ae=typeof process<"u"&&process.platform==="win32"?`\r
|
|
60
60
|
`:`
|
|
61
|
-
`,nu=(e,u)=>{const t=[];let n="";typeof u=="string"?u={section:u,whitespace:!1}:(u=u||Object.create(null),u.whitespace=u.whitespace===!0);const D=u.whitespace?" = ":"=";for(const r of Object.keys(e)){const i=e[r];if(i&&Array.isArray(i))for(const o of i)n+=q(r+"[]")+D+q(o)+me;else i&&typeof i=="object"?t.push(r):n+=q(r)+D+q(i)+me}u.section&&n.length&&(n="["+q(u.section)+"]"+me+n);for(const r of t){const i=xt(r).join("\\."),o=(u.section?u.section+".":"")+i,{whitespace:s}=u,a=nu(e[r],{section:o,whitespace:s});n.length&&a.length&&(n+=me),n+=a}return n},xt=e=>e.replace(/\1/g,"LITERAL\\1LITERAL").replace(/\\\./g,"").split(/\./).map(u=>u.replace(/\1/g,"\\.").replace(/\2LITERAL\\1LITERAL\2/g,"")),St=e=>{const u=Object.create(null);let t=u,n=null;const D=/^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i,r=e.split(/[\r\n]+/g);for(const o of r){if(!o||o.match(/^\s*[;#]/))continue;const s=o.match(D);if(!s)continue;if(s[1]!==void 0){if(n=Ce(s[1]),n==="__proto__"){t=Object.create(null);continue}t=u[n]=u[n]||Object.create(null);continue}const a=Ce(s[2]),l=a.length>2&&a.slice(-2)==="[]",c=l?a.slice(0,-2):a;if(c==="__proto__")continue;const f=s[3]?Ce(s[4]):!0,d=f==="true"||f==="false"||f==="null"?JSON.parse(f):f;l&&(tu.call(t,c)?Array.isArray(t[c])||(t[c]=[t[c]]):t[c]=[]),Array.isArray(t[c])?t[c].push(d):t[c]=d}const i=[];for(const o of Object.keys(u)){if(!tu.call(u,o)||typeof u[o]!="object"||Array.isArray(u[o]))continue;const s=xt(o);t=u;const a=s.pop(),l=a.replace(/\\\./g,".");for(const c of s)c!=="__proto__"&&((!tu.call(t,c)||typeof t[c]!="object")&&(t[c]=Object.create(null)),t=t[c]);t===u&&l===a||(t[l]=u[o],i.push(o))}for(const o of i)delete u[o];return u},Ot=e=>e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"),q=e=>typeof e!="string"||e.match(/[=\r\n]/)||e.match(/^\[/)||e.length>1&&Ot(e)||e!==e.trim()?JSON.stringify(e):e.split(";").join("\\;").split("#").join("\\#"),Ce=(e,u)=>{if(e=(e||"").trim(),Ot(e)){e.charAt(0)==="'"&&(e=e.slice(1,-1));try{e=JSON.parse(e)}catch{}}else{let t=!1,n="";for(let D=0,r=e.length;D<r;D++){const i=e.charAt(D);if(t)"\\;#".indexOf(i)!==-1?n+=i:n+="\\"+i,t=!1;else{if(";#".indexOf(i)!==-1)break;i==="\\"?t=!0:n+=i}}return t&&(n+="\\"),n.trim()}return e};var It={parse:St,decode:St,stringify:nu,encode:nu,safe:q,unsafe:Ce};const Tt=e=>v.lstat(e).then(()=>!0,()=>!1),{hasOwnProperty:Oi}=Object.prototype,Pt=(e,u)=>Oi.call(e,u),z=(e,u,t)=>{if(!u)throw new $(`Invalid config property ${e}: ${t}`)},he={OPENAI_KEY(e){if(!e)throw new $("Please set your OpenAI API key via `aicommits config set OPENAI_KEY=<your token>`");return z("OPENAI_KEY",e.startsWith("sk-"),'Must start with "sk-"'),e},locale(e){return e?(z("locale",e,"Cannot be empty"),z("locale",/^[a-z-]+$/i.test(e),"Must be a valid locale (letters and dashes/underscores). You can consult the list of codes in: https://wikipedia.org/wiki/List_of_ISO_639-1_codes"),e):"en"},generate(e){if(!e)return 1;z("generate",/^\d+$/.test(e),"Must be an integer");const u=Number(e);return z("generate",u>0,"Must be greater than 0"),z("generate",u<=5,"Must be less or equal to 5"),u}},Du=V.join(Ht.homedir(),".aicommits"),kt=async()=>{if(!await Tt(Du))return Object.create(null);const u=await v.readFile(Du,"utf8");return It.parse(u)},ru=async e=>{const u=await kt(),t={};for(const n of Object.keys(he)){const D=he[n],r=e?.[n]??u[n];t[n]=D(r)}return t},Ii=async e=>{const u=await kt();for(const[t,n]of e){if(!Pt(he,t))throw new $(`Invalid config property: ${t}`);const D=he[t](n);u[t]=D}await v.writeFile(Du,It.stringify(u),"utf8")},Ti=async(e,u,t,n)=>new Promise((D,r)=>{const i=JSON.stringify(n),o=Yt.request({port:443,hostname:e,path:u,method:"POST",headers:{...t,"Content-Type":"application/json","Content-Length":Buffer.byteLength(i)},timeout:1e4},s=>{const a=[];s.on("data",l=>a.push(l)),s.on("end",()=>{D({request:o,response:s,data:Buffer.concat(a).toString()})})});o.on("error",r),o.on("timeout",()=>{o.destroy(),r(new $("Request timed out"))}),o.write(i),o.end()}),Pi=async(e,u)=>{const{response:t,data:n}=await Ti("api.openai.com","/v1/chat/completions",{Authorization:`Bearer ${e}`},u);if(!t.statusCode||t.statusCode<200||t.statusCode>299){let D=`OpenAI API Error: ${t.statusCode} - ${t.statusMessage}`;throw n&&(D+=`
|
|
61
|
+
`,ht=(e,t)=>{const n=[];let u="";typeof t=="string"?t={section:t,whitespace:!1}:(t=t||Object.create(null),t.whitespace=t.whitespace===!0);const r=t.whitespace?" = ":"=";for(const o of Object.keys(e)){const s=e[o];if(s&&Array.isArray(s))for(const i of s)u+=Y(o+"[]")+r+Y(i)+Ae;else s&&typeof s=="object"?n.push(o):u+=Y(o)+r+Y(s)+Ae}t.section&&u.length&&(u="["+Y(t.section)+"]"+Ae+u);for(const o of n){const s=Zu(o).join("\\."),i=(t.section?t.section+".":"")+s,{whitespace:D}=t,l=ht(e[o],{section:i,whitespace:D});u.length&&l.length&&(u+=Ae),u+=l}return u},Zu=e=>e.replace(/\1/g,"LITERAL\\1LITERAL").replace(/\\\./g,"").split(/\./).map(t=>t.replace(/\1/g,"\\.").replace(/\2LITERAL\\1LITERAL\2/g,"")),Qu=e=>{const t=Object.create(null);let n=t,u=null;const r=/^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i,o=e.split(/[\r\n]+/g);for(const i of o){if(!i||i.match(/^\s*[;#]/))continue;const D=i.match(r);if(!D)continue;if(D[1]!==void 0){if(u=xe(D[1]),u==="__proto__"){n=Object.create(null);continue}n=t[u]=t[u]||Object.create(null);continue}const l=xe(D[2]),f=l.length>2&&l.slice(-2)==="[]",a=f?l.slice(0,-2):l;if(a==="__proto__")continue;const c=D[3]?xe(D[4]):!0,d=c==="true"||c==="false"||c==="null"?JSON.parse(c):c;f&&(mt.call(n,a)?Array.isArray(n[a])||(n[a]=[n[a]]):n[a]=[]),Array.isArray(n[a])?n[a].push(d):n[a]=d}const s=[];for(const i of Object.keys(t)){if(!mt.call(t,i)||typeof t[i]!="object"||Array.isArray(t[i]))continue;const D=Zu(i);n=t;const l=D.pop(),f=l.replace(/\\\./g,".");for(const a of D)a!=="__proto__"&&((!mt.call(n,a)||typeof n[a]!="object")&&(n[a]=Object.create(null)),n=n[a]);n===t&&f===l||(n[f]=t[i],s.push(i))}for(const i of s)delete t[i];return t},en=e=>e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"),Y=e=>typeof e!="string"||e.match(/[=\r\n]/)||e.match(/^\[/)||e.length>1&&en(e)||e!==e.trim()?JSON.stringify(e):e.split(";").join("\\;").split("#").join("\\#"),xe=(e,t)=>{if(e=(e||"").trim(),en(e)){e.charAt(0)==="'"&&(e=e.slice(1,-1));try{e=JSON.parse(e)}catch{}}else{let n=!1,u="";for(let r=0,o=e.length;r<o;r++){const s=e.charAt(r);if(n)"\\;#".indexOf(s)!==-1?u+=s:u+="\\"+s,n=!1;else{if(";#".indexOf(s)!==-1)break;s==="\\"?n=!0:u+=s}}return n&&(u+="\\"),u.trim()}return e};var tn={parse:Qu,decode:Qu,stringify:ht,encode:ht,safe:Y,unsafe:xe};const un=e=>O.lstat(e).then(()=>!0,()=>!1),{hasOwnProperty:di}=Object.prototype,nn=(e,t)=>di.call(e,t),G=(e,t,n)=>{if(!t)throw new x(`Invalid config property ${e}: ${n}`)},Se={OPENAI_KEY(e){if(!e)throw new x("Please set your OpenAI API key via `aicommits config set OPENAI_KEY=<your token>`");return G("OPENAI_KEY",e.startsWith("sk-"),'Must start with "sk-"'),e},locale(e){return e?(G("locale",e,"Cannot be empty"),G("locale",/^[a-z-]+$/i.test(e),"Must be a valid locale (letters and dashes/underscores). You can consult the list of codes in: https://wikipedia.org/wiki/List_of_ISO_639-1_codes"),e):"en"},generate(e){if(!e)return 1;G("generate",/^\d+$/.test(e),"Must be an integer");const t=Number(e);return G("generate",t>0,"Must be greater than 0"),G("generate",t<=5,"Must be less or equal to 5"),t},proxy(e){if(!(!e||e.length===0))return G("proxy",/^https?:\/\//.test(e),"Must be a valid URL"),e}},Ft=X.join(Lt.homedir(),".aicommits"),rn=async()=>{if(!await un(Ft))return Object.create(null);const t=await O.readFile(Ft,"utf8");return tn.parse(t)},gt=async e=>{const t=await rn(),n={};for(const u of Object.keys(Se)){const r=Se[u],o=e?.[u]??t[u];n[u]=r(o)}return n},pi=async e=>{const t=await rn();for(const[n,u]of e){if(!nn(Se,n))throw new x(`Invalid config property: ${n}`);const r=Se[n](u);t[n]=r}await O.writeFile(Ft,tn.stringify(t),"utf8")};var Et={},re={},Ci={get exports(){return re},set exports(e){re=e}},oe={},mi={get exports(){return oe},set exports(e){oe=e}},yt,on;function hi(){if(on)return yt;on=1;var e=1e3,t=e*60,n=t*60,u=n*24,r=u*7,o=u*365.25;yt=function(f,a){a=a||{};var c=typeof f;if(c==="string"&&f.length>0)return s(f);if(c==="number"&&isFinite(f))return a.long?D(f):i(f);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(f))};function s(f){if(f=String(f),!(f.length>100)){var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(f);if(a){var c=parseFloat(a[1]),d=(a[2]||"ms").toLowerCase();switch(d){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*r;case"days":case"day":case"d":return c*u;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}}}function i(f){var a=Math.abs(f);return a>=u?Math.round(f/u)+"d":a>=n?Math.round(f/n)+"h":a>=t?Math.round(f/t)+"m":a>=e?Math.round(f/e)+"s":f+"ms"}function D(f){var a=Math.abs(f);return a>=u?l(f,a,u,"day"):a>=n?l(f,a,n,"hour"):a>=t?l(f,a,t,"minute"):a>=e?l(f,a,e,"second"):f+" ms"}function l(f,a,c,d){var p=a>=c*1.5;return Math.round(f/c)+" "+d+(p?"s":"")}return yt}var bt,sn;function Dn(){if(sn)return bt;sn=1;function e(t){u.debug=u,u.default=u,u.coerce=l,u.disable=s,u.enable=o,u.enabled=i,u.humanize=hi(),u.destroy=f,Object.keys(t).forEach(a=>{u[a]=t[a]}),u.names=[],u.skips=[],u.formatters={};function n(a){let c=0;for(let d=0;d<a.length;d++)c=(c<<5)-c+a.charCodeAt(d),c|=0;return u.colors[Math.abs(c)%u.colors.length]}u.selectColor=n;function u(a){let c,d=null,p,m;function h(...F){if(!h.enabled)return;const B=h,T=Number(new Date),ce=T-(c||T);B.diff=ce,B.prev=c,B.curr=T,c=T,F[0]=u.coerce(F[0]),typeof F[0]!="string"&&F.unshift("%O");let R=0;F[0]=F[0].replace(/%([a-zA-Z%])/g,(U,yn)=>{if(U==="%%")return"%";R++;const Ot=u.formatters[yn];if(typeof Ot=="function"){const bn=F[R];U=Ot.call(B,bn),F.splice(R,1),R--}return U}),u.formatArgs.call(B,F),(B.log||u.log).apply(B,F)}return h.namespace=a,h.useColors=u.useColors(),h.color=u.selectColor(a),h.extend=r,h.destroy=u.destroy,Object.defineProperty(h,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(p!==u.namespaces&&(p=u.namespaces,m=u.enabled(a)),m),set:F=>{d=F}}),typeof u.init=="function"&&u.init(h),h}function r(a,c){const d=u(this.namespace+(typeof c>"u"?":":c)+a);return d.log=this.log,d}function o(a){u.save(a),u.namespaces=a,u.names=[],u.skips=[];let c;const d=(typeof a=="string"?a:"").split(/[\s,]+/),p=d.length;for(c=0;c<p;c++)d[c]&&(a=d[c].replace(/\*/g,".*?"),a[0]==="-"?u.skips.push(new RegExp("^"+a.slice(1)+"$")):u.names.push(new RegExp("^"+a+"$")))}function s(){const a=[...u.names.map(D),...u.skips.map(D).map(c=>"-"+c)].join(",");return u.enable(""),a}function i(a){if(a[a.length-1]==="*")return!0;let c,d;for(c=0,d=u.skips.length;c<d;c++)if(u.skips[c].test(a))return!1;for(c=0,d=u.names.length;c<d;c++)if(u.names[c].test(a))return!0;return!1}function D(a){return a.toString().substring(2,a.toString().length-2).replace(/\.\*\?$/,"*")}function l(a){return a instanceof Error?a.stack||a.message:a}function f(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return u.enable(u.load()),u}return bt=e,bt}var an;function Fi(){return an||(an=1,function(e,t){t.formatArgs=u,t.save=r,t.load=o,t.useColors=n,t.storage=s(),t.destroy=(()=>{let D=!1;return()=>{D||(D=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function n(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function u(D){if(D[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+D[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const l="color: "+this.color;D.splice(1,0,l,"color: inherit");let f=0,a=0;D[0].replace(/%[a-zA-Z%]/g,c=>{c!=="%%"&&(f++,c==="%c"&&(a=f))}),D.splice(a,0,l)}t.log=console.debug||console.log||(()=>{});function r(D){try{D?t.storage.setItem("debug",D):t.storage.removeItem("debug")}catch{}}function o(){let D;try{D=t.storage.getItem("debug")}catch{}return!D&&typeof process<"u"&&"env"in process&&(D=process.env.DEBUG),D}function s(){try{return localStorage}catch{}}e.exports=Dn()(t);const{formatters:i}=e.exports;i.j=function(D){try{return JSON.stringify(D)}catch(l){return"[UnexpectedJSONParseError]: "+l.message}}}(mi,oe)),oe}var se={},gi={get exports(){return se},set exports(e){se=e}},wt,cn;function Ei(){return cn||(cn=1,wt=(e,t=process.argv)=>{const n=e.startsWith("-")?"":e.length===1?"-":"--",u=t.indexOf(n+e),r=t.indexOf("--");return u!==-1&&(r===-1||u<r)}),wt}var Bt,ln;function yi(){if(ln)return Bt;ln=1;const e=Lt,t=le,n=Ei(),{env:u}=process;let r;n("no-color")||n("no-colors")||n("color=false")||n("color=never")?r=0:(n("color")||n("colors")||n("color=true")||n("color=always"))&&(r=1),"FORCE_COLOR"in u&&(u.FORCE_COLOR==="true"?r=1:u.FORCE_COLOR==="false"?r=0:r=u.FORCE_COLOR.length===0?1:Math.min(parseInt(u.FORCE_COLOR,10),3));function o(D){return D===0?!1:{level:D,hasBasic:!0,has256:D>=2,has16m:D>=3}}function s(D,l){if(r===0)return 0;if(n("color=16m")||n("color=full")||n("color=truecolor"))return 3;if(n("color=256"))return 2;if(D&&!l&&r===void 0)return 0;const f=r||0;if(u.TERM==="dumb")return f;if(process.platform==="win32"){const a=e.release().split(".");return Number(a[0])>=10&&Number(a[2])>=10586?Number(a[2])>=14931?3:2:1}if("CI"in u)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(a=>a in u)||u.CI_NAME==="codeship"?1:f;if("TEAMCITY_VERSION"in u)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(u.TEAMCITY_VERSION)?1:0;if(u.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in u){const a=parseInt((u.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(u.TERM_PROGRAM){case"iTerm.app":return a>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(u.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(u.TERM)||"COLORTERM"in u?1:f}function i(D){const l=s(D,D&&D.isTTY);return o(l)}return Bt={supportsColor:i,stdout:o(s(!0,t.isatty(1))),stderr:o(s(!0,t.isatty(2)))},Bt}var fn;function bi(){return fn||(fn=1,function(e,t){const n=le,u=Mt;t.init=f,t.log=i,t.formatArgs=o,t.save=D,t.load=l,t.useColors=r,t.destroy=u.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const c=yi();c&&(c.stderr||c).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}t.inspectOpts=Object.keys(process.env).filter(c=>/^debug_/i.test(c)).reduce((c,d)=>{const p=d.substring(6).toLowerCase().replace(/_([a-z])/g,(h,F)=>F.toUpperCase());let m=process.env[d];return/^(yes|on|true|enabled)$/i.test(m)?m=!0:/^(no|off|false|disabled)$/i.test(m)?m=!1:m==="null"?m=null:m=Number(m),c[p]=m,c},{});function r(){return"colors"in t.inspectOpts?Boolean(t.inspectOpts.colors):n.isatty(process.stderr.fd)}function o(c){const{namespace:d,useColors:p}=this;if(p){const m=this.color,h="\x1B[3"+(m<8?m:"8;5;"+m),F=` ${h};1m${d} \x1B[0m`;c[0]=F+c[0].split(`
|
|
62
|
+
`).join(`
|
|
63
|
+
`+F),c.push(h+"m+"+e.exports.humanize(this.diff)+"\x1B[0m")}else c[0]=s()+d+" "+c[0]}function s(){return t.inspectOpts.hideDate?"":new Date().toISOString()+" "}function i(...c){return process.stderr.write(u.format(...c)+`
|
|
64
|
+
`)}function D(c){c?process.env.DEBUG=c:delete process.env.DEBUG}function l(){return process.env.DEBUG}function f(c){c.inspectOpts={};const d=Object.keys(t.inspectOpts);for(let p=0;p<d.length;p++)c.inspectOpts[d[p]]=t.inspectOpts[d[p]]}e.exports=Dn()(t);const{formatters:a}=e.exports;a.o=function(c){return this.inspectOpts.colors=this.useColors,u.inspect(c,this.inspectOpts).split(`
|
|
65
|
+
`).map(d=>d.trim()).join(" ")},a.O=function(c){return this.inspectOpts.colors=this.useColors,u.inspect(c,this.inspectOpts)}}(gi,se)),se}(function(e){typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?e.exports=Fi():e.exports=bi()})(Ci);var $t={};Object.defineProperty($t,"__esModule",{value:!0});function wi(e){return function(t,n){return new Promise((u,r)=>{e.call(this,t,n,(o,s)=>{o?r(o):u(s)})})}}$t.default=wi;var dn=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const Bi=kt,$i=dn(re),vi=dn($t),ie=$i.default("agent-base");function Ai(e){return Boolean(e)&&typeof e.addRequest=="function"}function vt(){const{stack:e}=new Error;return typeof e!="string"?!1:e.split(`
|
|
66
|
+
`).some(t=>t.indexOf("(https.js:")!==-1||t.indexOf("node:https:")!==-1)}function Oe(e,t){return new Oe.Agent(e,t)}(function(e){class t extends Bi.EventEmitter{constructor(u,r){super();let o=r;typeof u=="function"?this.callback=u:u&&(o=u),this.timeout=null,o&&typeof o.timeout=="number"&&(this.timeout=o.timeout),this.maxFreeSockets=1,this.maxSockets=1,this.maxTotalSockets=1/0,this.sockets={},this.freeSockets={},this.requests={},this.options={}}get defaultPort(){return typeof this.explicitDefaultPort=="number"?this.explicitDefaultPort:vt()?443:80}set defaultPort(u){this.explicitDefaultPort=u}get protocol(){return typeof this.explicitProtocol=="string"?this.explicitProtocol:vt()?"https:":"http:"}set protocol(u){this.explicitProtocol=u}callback(u,r,o){throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`')}addRequest(u,r){const o=Object.assign({},r);typeof o.secureEndpoint!="boolean"&&(o.secureEndpoint=vt()),o.host==null&&(o.host="localhost"),o.port==null&&(o.port=o.secureEndpoint?443:80),o.protocol==null&&(o.protocol=o.secureEndpoint?"https:":"http:"),o.host&&o.path&&delete o.path,delete o.agent,delete o.hostname,delete o._defaultAgent,delete o.defaultPort,delete o.createConnection,u._last=!0,u.shouldKeepAlive=!1;let s=!1,i=null;const D=o.timeout||this.timeout,l=d=>{u._hadError||(u.emit("error",d),u._hadError=!0)},f=()=>{i=null,s=!0;const d=new Error(`A "socket" was not created for HTTP request before ${D}ms`);d.code="ETIMEOUT",l(d)},a=d=>{s||(i!==null&&(clearTimeout(i),i=null),l(d))},c=d=>{if(s)return;if(i!=null&&(clearTimeout(i),i=null),Ai(d)){ie("Callback returned another Agent instance %o",d.constructor.name),d.addRequest(u,o);return}if(d){d.once("free",()=>{this.freeSocket(d,o)}),u.onSocket(d);return}const p=new Error(`no Duplex stream was returned to agent-base for \`${u.method} ${u.path}\``);l(p)};if(typeof this.callback!="function"){l(new Error("`callback` is not defined"));return}this.promisifiedCallback||(this.callback.length>=3?(ie("Converting legacy callback function to promise"),this.promisifiedCallback=vi.default(this.callback)):this.promisifiedCallback=this.callback),typeof D=="number"&&D>0&&(i=setTimeout(f,D)),"port"in o&&typeof o.port!="number"&&(o.port=Number(o.port));try{ie("Resolving socket for %o request: %o",o.protocol,`${u.method} ${u.path}`),Promise.resolve(this.promisifiedCallback(u,o)).then(c,a)}catch(d){Promise.reject(d).catch(a)}}freeSocket(u,r){ie("Freeing socket %o %o",u.constructor.name,r),u.destroy()}destroy(){ie("Destroying agent %o",this.constructor.name)}}e.Agent=t,e.prototype=e.Agent.prototype})(Oe||(Oe={}));var xi=Oe,At={},Si=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(At,"__esModule",{value:!0});const Oi=Si(re),De=Oi.default("https-proxy-agent:parse-proxy-response");function Ii(e){return new Promise((t,n)=>{let u=0;const r=[];function o(){const a=e.read();a?f(a):e.once("readable",o)}function s(){e.removeListener("end",D),e.removeListener("error",l),e.removeListener("close",i),e.removeListener("readable",o)}function i(a){De("onclose had error %o",a)}function D(){De("onend")}function l(a){s(),De("onerror %o",a),n(a)}function f(a){r.push(a),u+=a.length;const c=Buffer.concat(r,u);if(c.indexOf(`\r
|
|
67
|
+
\r
|
|
68
|
+
`)===-1){De("have not received end of HTTP headers yet..."),o();return}const p=c.toString("ascii",0,c.indexOf(`\r
|
|
69
|
+
`)),m=+p.split(" ")[1];De("got proxy server response: %o",p),t({statusCode:m,buffered:c})}e.on("error",l),e.on("close",i),e.on("end",D),o()})}At.default=Ii;var Ti=w&&w.__awaiter||function(e,t,n,u){function r(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function i(f){try{l(u.next(f))}catch(a){s(a)}}function D(f){try{l(u.throw(f))}catch(a){s(a)}}function l(f){f.done?o(f.value):r(f.value).then(i,D)}l((u=u.apply(e,t||[])).next())})},J=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Et,"__esModule",{value:!0});const pn=J(In),Cn=J(Tn),Pi=J(Pn),_i=J(Rt),Ri=J(re),ki=xi,Mi=J(At),ae=Ri.default("https-proxy-agent:agent");class ji extends ki.Agent{constructor(t){let n;if(typeof t=="string"?n=Pi.default.parse(t):n=t,!n)throw new Error("an HTTP(S) proxy server `host` and `port` must be specified!");ae("creating new HttpsProxyAgent instance: %o",n),super(n);const u=Object.assign({},n);this.secureProxy=n.secureProxy||Gi(u.protocol),u.host=u.hostname||u.host,typeof u.port=="string"&&(u.port=parseInt(u.port,10)),!u.port&&u.host&&(u.port=this.secureProxy?443:80),this.secureProxy&&!("ALPNProtocols"in u)&&(u.ALPNProtocols=["http 1.1"]),u.host&&u.path&&(delete u.path,delete u.pathname),this.proxy=u}callback(t,n){return Ti(this,void 0,void 0,function*(){const{proxy:u,secureProxy:r}=this;let o;r?(ae("Creating `tls.Socket`: %o",u),o=Cn.default.connect(u)):(ae("Creating `net.Socket`: %o",u),o=pn.default.connect(u));const s=Object.assign({},u.headers);let D=`CONNECT ${`${n.host}:${n.port}`} HTTP/1.1\r
|
|
70
|
+
`;u.auth&&(s["Proxy-Authorization"]=`Basic ${Buffer.from(u.auth).toString("base64")}`);let{host:l,port:f,secureEndpoint:a}=n;Ni(f,a)||(l+=`:${f}`),s.Host=l,s.Connection="close";for(const h of Object.keys(s))D+=`${h}: ${s[h]}\r
|
|
71
|
+
`;const c=Mi.default(o);o.write(`${D}\r
|
|
72
|
+
`);const{statusCode:d,buffered:p}=yield c;if(d===200){if(t.once("socket",Li),n.secureEndpoint){ae("Upgrading socket connection to TLS");const h=n.servername||n.host;return Cn.default.connect(Object.assign(Object.assign({},Ui(n,"host","hostname","path","port")),{socket:o,servername:h}))}return o}o.destroy();const m=new pn.default.Socket({writable:!1});return m.readable=!0,t.once("socket",h=>{ae("replaying proxy buffer for failed request"),_i.default(h.listenerCount("data")>0),h.push(p),h.push(null)}),m})}}Et.default=ji;function Li(e){e.resume()}function Ni(e,t){return Boolean(!t&&e===80||t&&e===443)}function Gi(e){return typeof e=="string"?/^https:?$/i.test(e):!1}function Ui(e,...t){const n={};let u;for(u in e)t.includes(u)||(n[u]=e[u]);return n}var Wi=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const xt=Wi(Et);function St(e){return new xt.default(e)}(function(e){e.HttpsProxyAgent=xt.default,e.prototype=xt.default.prototype})(St||(St={}));var qi=St;const Hi=async(e,t,n,u,r)=>new Promise((o,s)=>{const i=JSON.stringify(u),D=Sn.request({port:443,hostname:e,path:t,method:"POST",headers:{...n,"Content-Type":"application/json","Content-Length":Buffer.byteLength(i)},timeout:1e4,agent:r?qi(r):void 0},l=>{const f=[];l.on("data",a=>f.push(a)),l.on("end",()=>{o({request:D,response:l,data:Buffer.concat(f).toString()})})});D.on("error",s),D.on("timeout",()=>{D.destroy(),s(new x("Request timed out"))}),D.write(i),D.end()}),zi=async(e,t,n)=>{const{response:u,data:r}=await Hi("api.openai.com","/v1/chat/completions",{Authorization:`Bearer ${e}`},t,n);if(!u.statusCode||u.statusCode<200||u.statusCode>299){let o=`OpenAI API Error: ${u.statusCode} - ${u.statusMessage}`;throw r&&(o+=`
|
|
62
73
|
|
|
63
|
-
${
|
|
74
|
+
${r}`),u.statusCode===500&&(o+=`
|
|
64
75
|
|
|
65
|
-
Check the API status: https://status.openai.com`),new
|
|
66
|
-
${
|
|
67
|
-
${
|
|
68
|
-
`)}`);const
|
|
76
|
+
Check the API status: https://status.openai.com`),new x(o)}return JSON.parse(r)},Ki=e=>e.trim().replace(/[\n\r]/g,"").replace(/(\w)\.$/,"$1"),Vi=e=>Array.from(new Set(e)),Yi=(e,t)=>`Write an insightful but concise Git commit message in a complete sentence in present tense for the following diff without prefacing it with anything, the response must be in the language ${e}:
|
|
77
|
+
${t}`,mn="gpt-3.5-turbo",hn=async(e,t,n,u,r)=>{const o=Yi(t,n);if(On(mn).encode(o).length>4e3)throw new x("The diff is too large for the OpenAI API. Try reducing the number of staged changes, or write your own commit message.");try{const s=await zi(e,{model:mn,messages:[{role:"user",content:o}],temperature:.7,top_p:1,frequency_penalty:0,presence_penalty:0,max_tokens:200,stream:!1,n:u},r);return Vi(s.choices.filter(i=>i.message?.content).map(i=>Ki(i.message.content)))}catch(s){const i=s;throw i.code==="ENOTFOUND"?new x(`Error connecting to ${i.hostname} (${i.syscall}). Are you connected to the internet?`):i}};var Ji=async(e,t,n,u)=>(async()=>{Vu(Lu(ju(" aicommits "))),await Yu();const r=dt();n&&await ue("git",["add","--all"]),r.start("Detecting staged files");const o=await Xu(t);if(!o)throw r.stop("Detecting staged files"),new x("No staged changes found. Stage your changes manually, or automatically stage all changes with the `--all` flag.");r.stop(`${fi(o.files)}:
|
|
78
|
+
${o.files.map(a=>` ${a}`).join(`
|
|
79
|
+
`)}`);const{env:s}=process,i=await gt({OPENAI_KEY:s.OPENAI_KEY||s.OPENAI_API_KEY,proxy:s.https_proxy||s.HTTPS_PROXY||s.http_proxy||s.HTTP_PROXY,generate:e?.toString()}),D=dt();D.start("The AI is analyzing your changes");let l;try{l=await hn(i.OPENAI_KEY,i.locale,o.diff,i.generate,i.proxy)}finally{D.stop("Changes analyzed")}if(l.length===0)throw new x("No commit messages were generated. Try again.");let f;if(l.length===1){[f]=l;const a=await ci({message:`Use this commit message?
|
|
69
80
|
|
|
70
|
-
${
|
|
71
|
-
`});if(!
|
|
72
|
-
`;
|
|
73
|
-
`,
|
|
74
|
-
${
|
|
75
|
-
`)}`):(
|
|
76
|
-
`,
|
|
77
|
-
${
|
|
78
|
-
`),await
|
|
81
|
+
${f}
|
|
82
|
+
`});if(!a||Wu(a)){V("Commit cancelled");return}}else{const a=await li({message:`Pick a commit message to use: ${ot("(Ctrl+c to exit)")}`,options:l.map(c=>({label:c,value:c}))});if(Wu(a)){V("Commit cancelled");return}f=a}await ue("git",["commit","-m",f,...u]),V(`${Be("\u2714")} Successfully committed!`)})().catch(r=>{V(`${we("\u2716")} ${r.message}`),ve(r),process.exit(1)});const[Fn,Xi]=process.argv.slice(2);var Zi=()=>(async()=>{if(!Fn)throw new x('Commit message file path is missing. This file should be called from the "prepare-commit-msg" git hook');if(Xi)return;const e=await Xu();if(!e)return;Vu(Lu(ju(" aicommits ")));const{env:t}=process,n=await gt({proxy:t.https_proxy||t.HTTPS_PROXY||t.http_proxy||t.HTTP_PROXY}),u=dt();u.start("The AI is analyzing your changes");let r;try{r=await hn(n.OPENAI_KEY,n.locale,e.diff,n.generate,n.proxy)}finally{u.stop("Changes analyzed")}const o=r.length>1;let s=`# \u{1F916} AI generated commit${o?"s":""}
|
|
83
|
+
`;o?(s+=`# Select one of the following messages by uncommeting:
|
|
84
|
+
`,s+=`
|
|
85
|
+
${r.map(i=>`# ${i}`).join(`
|
|
86
|
+
`)}`):(s+=`# Edit the message below and commit:
|
|
87
|
+
`,s+=`
|
|
88
|
+
${r[0]}
|
|
89
|
+
`),await O.appendFile(Fn,s),V(`${Be("\u2714")} Saved commit message!`)})().catch(e=>{V(`${we("\u2716")} ${e.message}`),ve(e),process.exit(1)}),Qi=su({name:"config",parameters:["<mode>","<key=value...>"]},e=>{(async()=>{const{mode:t,keyValue:n}=e._;if(t==="get"){const u=await gt();for(const r of n)nn(u,r)&&console.log(`${r}=${u[r]}`);return}if(t==="set"){await pi(n.map(u=>u.split("=")));return}throw new x(`Invalid mode: ${t}`)})().catch(t=>{console.error(`${we("\u2716")} ${t.message}`),ve(t),process.exit(1)})});const gn="prepare-commit-msg",_=`.git/hooks/${gn}`,eD=process.argv[1].endsWith(`/${_}`);var tD=su({name:"hook",parameters:["<install/uninstall>"]},e=>{const t=_n(new URL("cli.mjs",import.meta.url));(async()=>{await Yu();const{installUninstall:n}=e._,u=await un(_);if(n==="install"){if(u){if(await O.realpath(_).catch(()=>{})===t){console.warn("The hook is already installed");return}throw new x(`A different ${gn} hook seems to be installed. Please remove it before installing aicommits.`)}await O.mkdir(X.dirname(_),{recursive:!0}),await O.symlink(t,_,"file"),await O.chmod(_,493),console.log(`${Be("\u2714")} Hook installed`);return}if(n==="uninstall"){if(!u){console.warn("Hook is not installed");return}if(await O.realpath(_)!==t){console.warn("Hook is not installed");return}await O.rm(_),console.log(`${Be("\u2714")} Hook uninstalled`);return}throw new x(`Invalid mode: ${n}`)})().catch(n=>{console.error(`${we("\u2716")} ${n.message}`),ve(n),process.exit(1)})});const En=process.argv.slice(2);Qr({name:"aicommits",version:iu,flags:{generate:{type:Number,description:"Number of messages to generate (Warning: generating multiple costs more) (default: 1)",alias:"g"},exclude:{type:[String],description:"Files to exclude from AI analysis",alias:"x"},all:{type:Boolean,description:"Automatically stage changes in tracked files for the commit",alias:"a",default:!1}},commands:[Qi,tD],help:{description:eo},ignoreArgv:e=>e==="unknown-flag"||e==="argument"},e=>{eD?Zi():Ji(e.flags.generate,e.flags.exclude,e.flags.all,En)},En);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aicommits",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "Writes your git commit messages for you with AI",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -19,6 +19,6 @@
|
|
|
19
19
|
"aic": "./dist/cli.mjs"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@dqbd/tiktoken": "^0.
|
|
22
|
+
"@dqbd/tiktoken": "^1.0.2"
|
|
23
23
|
}
|
|
24
24
|
}
|