@engagelabemail/cli 1.0.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.
Files changed (3) hide show
  1. package/README.md +384 -0
  2. package/dist/index.cjs +58 -0
  3. package/package.json +35 -0
package/README.md ADDED
@@ -0,0 +1,384 @@
1
+ # EngageLab Email CLI
2
+
3
+ EngageLab Email CLI helps agents and developers work with inbound and outbound email from the command line.
4
+
5
+ Use it to:
6
+
7
+ - List available mailboxes
8
+ - List and inspect email threads
9
+ - Read inbound messages
10
+ - Poll for new inbound messages
11
+ - Reply to inbound messages
12
+ - Send new emails
13
+
14
+ ## Install
15
+
16
+ ```bash
17
+ npm install -g @engagelabemail/cli
18
+ ```
19
+
20
+ Check the installed version:
21
+
22
+ ```bash
23
+ engagelab-email-cli -V
24
+ ```
25
+
26
+ When you run a command that connects to EngageLab Email, the CLI checks whether a newer CLI version is available. If an update is required, it stops and shows the update command:
27
+
28
+ ```bash
29
+ npm install -g @engagelabemail/cli@latest
30
+ ```
31
+
32
+ ## Configuration
33
+
34
+ ### Manage Saved Configuration
35
+
36
+ Use the `config` command group to save, inspect, or clear local credentials.
37
+
38
+ Save your service address and Secret Key locally:
39
+
40
+ ```bash
41
+ engagelab-email-cli config set --base-url http://localhost:8087 --secret-key sk_xxx
42
+ ```
43
+
44
+ View the saved configuration:
45
+
46
+ ```bash
47
+ engagelab-email-cli config list
48
+ ```
49
+
50
+ Clear the saved configuration:
51
+
52
+ ```bash
53
+ engagelab-email-cli config clear
54
+ ```
55
+
56
+ `config list` masks the Secret Key.
57
+
58
+ ### Use Global Credentials With Any Business Command
59
+
60
+ You do not have to save credentials first. You can pass `--base-url` and `--secret-key` directly before any business command such as `threads ...` or `emails ...`. These command-line credentials apply only to the current command and do not overwrite saved config.
61
+
62
+ Example:
63
+
64
+ ```bash
65
+ engagelab-email-cli --base-url http://localhost:8087 --secret-key sk_xxx threads get thread-1
66
+ ```
67
+
68
+ ## Quick Start
69
+
70
+ List recent inbound messages:
71
+
72
+ ```bash
73
+ engagelab-email-cli emails receiving list --mailbox-id 12 --page-size 20
74
+ ```
75
+
76
+ Read one inbound message:
77
+
78
+ ```bash
79
+ engagelab-email-cli emails receiving get <message-uid>
80
+ ```
81
+
82
+ View the full thread around a message:
83
+
84
+ ```bash
85
+ engagelab-email-cli threads messages <thread-id> --include-content --limit 10
86
+ ```
87
+
88
+ Reply to an inbound message:
89
+
90
+ ```bash
91
+ engagelab-email-cli emails receiving reply <message-uid> --subject "Re: Hello" --text "Thanks, we received your message."
92
+ ```
93
+
94
+ Send a new email:
95
+
96
+ ```bash
97
+ engagelab-email-cli emails send \
98
+ --mailbox-id 1001 \
99
+ --to alice@example.com \
100
+ --subject "Hello" \
101
+ --text "Hello from EngageLab Email CLI."
102
+ ```
103
+
104
+ For scripts or agents, add `--json` to get machine-readable output:
105
+
106
+ ```bash
107
+ engagelab-email-cli emails receiving list --mailbox-id 12 --page-size 20 --json
108
+ ```
109
+
110
+ ## Commands
111
+
112
+ ### `config set`
113
+
114
+ Save local configuration.
115
+
116
+ | Option | Description |
117
+ | --- | --- |
118
+ | `--base-url <url>` | Service address. Defaults to `ENGAGELAB_EMAIL_BASE_URL` when set. |
119
+ | `--secret-key <key>` | Secret Key. Defaults to `ENGAGELAB_EMAIL_SECRET_KEY` when set. |
120
+
121
+ Example:
122
+
123
+ ```bash
124
+ engagelab-email-cli config set --base-url http://localhost:8087 --secret-key sk_xxx
125
+ ```
126
+
127
+ ### `config list`
128
+
129
+ Show saved configuration.
130
+
131
+ Example:
132
+
133
+ ```bash
134
+ engagelab-email-cli config list
135
+ ```
136
+
137
+ ### `config clear`
138
+
139
+ Clear saved local configuration, including `baseUrl` and `secretKey`.
140
+
141
+ Example:
142
+
143
+ ```bash
144
+ engagelab-email-cli config clear
145
+ ```
146
+
147
+ ### `mailbox list`
148
+
149
+ List available mailboxes.
150
+
151
+ | Option | Description |
152
+ | --- | --- |
153
+ | `--mailbox <address>` | Filter by mailbox address. |
154
+ | `--page-no <number>` | Page number. |
155
+ | `--page-size <number>` | Page size. |
156
+ | `--json` | Output raw JSON. |
157
+
158
+ Example:
159
+
160
+ ```bash
161
+ engagelab-email-cli mailbox list --page-size 20
162
+ ```
163
+
164
+ ### `threads list`
165
+
166
+ List email threads.
167
+
168
+ | Option | Description |
169
+ | --- | --- |
170
+ | `--mailbox-id <id>` | Filter by mailbox ID. |
171
+ | `--subject <text>` | Search by normalized subject. |
172
+ | `--participant <email>` | Search by participant. |
173
+ | `--start-time <timestamp>` | Latest message start timestamp in milliseconds. |
174
+ | `--end-time <timestamp>` | Latest message end timestamp in milliseconds. |
175
+ | `--page-no <number>` | Page number. |
176
+ | `--page-size <number>` | Page size. |
177
+ | `--json` | Output raw JSON. |
178
+
179
+ Example:
180
+
181
+ ```bash
182
+ engagelab-email-cli threads list --subject refund --page-no 1 --page-size 20
183
+ ```
184
+
185
+ ### `threads get <thread-id>`
186
+
187
+ Show one thread.
188
+
189
+ | Argument/Option | Description |
190
+ | --- | --- |
191
+ | `<thread-id>` | Thread ID. |
192
+ | `--json` | Output raw JSON. |
193
+
194
+ Example:
195
+
196
+ ```bash
197
+ engagelab-email-cli threads get b0d9d6a1-1d17-4df8-8245-c807d7e8cb50
198
+ ```
199
+
200
+ ### `threads messages <thread-id>`
201
+
202
+ List messages in a thread.
203
+
204
+ | Argument/Option | Description |
205
+ | --- | --- |
206
+ | `<thread-id>` | Thread ID. |
207
+ | `--limit <number>` | Message limit. |
208
+ | `--include-content` | Include text/html/headers/attachments. |
209
+ | `--json` | Output raw JSON. |
210
+
211
+ Example:
212
+
213
+ ```bash
214
+ engagelab-email-cli threads messages b0d9d6a1-1d17-4df8-8245-c807d7e8cb50 --include-content --json
215
+ ```
216
+
217
+ ### `emails receiving list`
218
+
219
+ List inbound messages.
220
+
221
+ | Option | Description |
222
+ | --- | --- |
223
+ | `--mailbox-id <id>` | Filter by mailbox ID. |
224
+ | `--keyword <text>` | Search keyword. |
225
+ | `--page-no <number>` | Page number. |
226
+ | `--page-size <number>` | Page size. |
227
+ | `--json` | Output raw JSON. |
228
+
229
+ Example:
230
+
231
+ ```bash
232
+ engagelab-email-cli emails receiving list --keyword refund --page-size 20
233
+ ```
234
+
235
+ ### `emails receiving get <message-uid>`
236
+
237
+ Show one inbound message.
238
+
239
+ | Argument/Option | Description |
240
+ | --- | --- |
241
+ | `<message-uid>` | Message UID. |
242
+ | `--json` | Output raw JSON. |
243
+
244
+ Example:
245
+
246
+ ```bash
247
+ engagelab-email-cli emails receiving get 7e2b2de6-14c5-4ef1-a1e2-f4337e4606e2 --json
248
+ ```
249
+
250
+ ### `emails receiving listen`
251
+
252
+ Poll for new inbound messages. This command keeps running until you stop it with `Ctrl+C`.
253
+
254
+ | Option | Description |
255
+ | --- | --- |
256
+ | `--after <id>` | Cursor ID from the previous result. |
257
+ | `--limit <number>` | Message limit. |
258
+ | `--interval <seconds>` | Polling interval in seconds (minimum 2). |
259
+ | `--json` | Output one JSON message per line. |
260
+
261
+ Example:
262
+
263
+ ```bash
264
+ engagelab-email-cli emails receiving listen --limit 10 --interval 5 --json
265
+ ```
266
+
267
+ Continue from a known cursor:
268
+
269
+ ```bash
270
+ engagelab-email-cli emails receiving listen --after 1500 --limit 10 --interval 5 --json
271
+ ```
272
+
273
+ ### `emails receiving reply <message-uid>`
274
+
275
+ Reply to an inbound message.
276
+
277
+ | Argument/Option | Description |
278
+ | --- | --- |
279
+ | `<message-uid>` | Message UID to reply to. |
280
+ | `--subject <text>` | Reply subject. |
281
+ | `--text <text>` | Plain text body. |
282
+ | `--html <html>` | HTML body. |
283
+ | `--text-file <path>` | Read plain text body from file. |
284
+ | `--html-file <path>` | Read HTML body from file. |
285
+ | `--cc <email>` | CC address. Can be repeated. |
286
+ | `--bcc <email>` | BCC address. Can be repeated. |
287
+ | `--reply-to <email>` | Reply-To address. Can be repeated. |
288
+ | `--preview-text <text>` | Email preview text. |
289
+ | `--attachment <path>` | Attach local file. Can be repeated. Up to 10 files, 10MB total. |
290
+ | `--sandbox` | Send in sandbox mode. |
291
+ | `--json` | Output raw JSON. |
292
+
293
+ Example:
294
+
295
+ ```bash
296
+ engagelab-email-cli emails receiving reply 7e2b2de6-14c5-4ef1-a1e2-f4337e4606e2 \
297
+ --subject "Re: Refund update" \
298
+ --text "Thanks, we received your message." \
299
+ --attachment ./receipt.pdf
300
+ ```
301
+
302
+ ### `emails send`
303
+
304
+ Send a new email.
305
+
306
+ | Option | Description |
307
+ | --- | --- |
308
+ | `--mailbox-id <id>` | Mailbox ID. |
309
+ | `--from <email>` | Sender email address. |
310
+ | `--to <email>` | Recipient email address. Can be repeated. |
311
+ | `--subject <text>` | Email subject. |
312
+ | `--text <text>` | Plain text body. |
313
+ | `--html <html>` | HTML body. |
314
+ | `--text-file <path>` | Read plain text body from file. |
315
+ | `--html-file <path>` | Read HTML body from file. |
316
+ | `--cc <email>` | CC address. Can be repeated. |
317
+ | `--bcc <email>` | BCC address. Can be repeated. |
318
+ | `--reply-to <email>` | Reply-To address. Can be repeated. |
319
+ | `--preview-text <text>` | Email preview text. |
320
+ | `--attachment <path>` | Attach local file. Can be repeated. Up to 10 files, 10MB total. |
321
+ | `--sandbox` | Send in sandbox mode. |
322
+ | `--json` | Output raw JSON. |
323
+
324
+ Example:
325
+
326
+ ```bash
327
+ engagelab-email-cli emails send \
328
+ --mailbox-id 1001 \
329
+ --to alice@example.com \
330
+ --to bob@example.com \
331
+ --subject "Refund update" \
332
+ --text "Your refund has been processed." \
333
+ --attachment ./receipt.pdf
334
+ ```
335
+
336
+ Send HTML content from a file:
337
+
338
+ ```bash
339
+ engagelab-email-cli emails send \
340
+ --mailbox-id 1001 \
341
+ --to alice@example.com \
342
+ --subject "Monthly report" \
343
+ --html-file ./report.html
344
+ ```
345
+
346
+ ## Output
347
+
348
+ By default, the CLI prints readable tables or summaries and shows a short loading message while requests are running.
349
+
350
+ Use `--json` when another tool or script needs to parse the result.
351
+
352
+ ```bash
353
+ engagelab-email-cli emails receiving get <message-uid> --json
354
+ ```
355
+
356
+ `emails receiving listen --json` prints one message JSON object per line.
357
+
358
+
359
+ ## Errors
360
+
361
+ Human-readable errors include the business error code when the API returns one, for example `[100101] unauthorized`.
362
+
363
+ `--json` errors use this shape:
364
+
365
+ ```json
366
+ {
367
+ "error": {
368
+ "code": "auth_error",
369
+ "errorCode": 100101,
370
+ "message": "unauthorized"
371
+ }
372
+ }
373
+ ```
374
+
375
+ Exit codes follow the API document:
376
+
377
+ | Exit Code | Meaning |
378
+ | --- | --- |
379
+ | `1` | Parameter error or missing config |
380
+ | `2` | Authentication failure |
381
+ | `3` | Resource not found |
382
+ | `4` | Conflict or in-progress state |
383
+ | `5` | Server error or network error |
384
+
package/dist/index.cjs ADDED
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env node
2
+ var Uo=Object.create;var Ir=Object.defineProperty;var Go=Object.getOwnPropertyDescriptor;var Wo=Object.getOwnPropertyNames;var zo=Object.getPrototypeOf,Xo=Object.prototype.hasOwnProperty;var p=(r,e)=>()=>{try{return e||r((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}};var Ko=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Wo(e))!Xo.call(r,s)&&s!==t&&Ir(r,s,{get:()=>e[s],enumerable:!(i=Go(e,s))||i.enumerable});return r};var le=(r,e,t)=>(t=r!=null?Uo(zo(r)):{},Ko(e||!r||!r.__esModule?Ir(t,"default",{value:r,enumerable:!0}):t,r));var xe=p(Ot=>{var Ve=class extends Error{constructor(e,t,i){super(i),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},At=class extends Ve{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Ot.CommanderError=Ve;Ot.InvalidArgumentError=At});var Ue=p(St=>{var{InvalidArgumentError:Jo}=xe(),Rt=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,i)=>{if(!this.argChoices.includes(t))throw new Jo(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,i):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function Yo(r){let e=r.name()+(r.variadic===!0?"...":"");return r.required?"<"+e+">":"["+e+"]"}St.Argument=Rt;St.humanReadableArgName=Yo});var $t=p(vr=>{var{humanReadableArgName:Zo}=Ue(),_t=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter(s=>!s._hidden),i=e._getHelpCommand();return i&&!i._hidden&&t.push(i),this.sortSubcommands&&t.sort((s,n)=>s.name().localeCompare(n.name())),t}compareOptions(e,t){let i=s=>s.short?s.short.replace(/^-/,""):s.long.replace(/^--/,"");return i(e).localeCompare(i(t))}visibleOptions(e){let t=e.options.filter(s=>!s.hidden),i=e._getHelpOption();if(i&&!i.hidden){let s=i.short&&e._findOption(i.short),n=i.long&&e._findOption(i.long);!s&&!n?t.push(i):i.long&&!n?t.push(e.createOption(i.long,i.description)):i.short&&!s&&t.push(e.createOption(i.short,i.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let i=e.parent;i;i=i.parent){let s=i.options.filter(n=>!n.hidden);t.push(...s)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(i=>Zo(i)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((i,s)=>Math.max(i,t.subcommandTerm(s).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((i,s)=>Math.max(i,t.optionTerm(s).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((i,s)=>Math.max(i,t.optionTerm(s).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((i,s)=>Math.max(i,t.argumentTerm(s).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let i="";for(let s=e.parent;s;s=s.parent)i=s.name()+" "+i;return i+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let i=`(${t.join(", ")})`;return e.description?`${e.description} ${i}`:i}return e.description}formatHelp(e,t){let i=t.padWidth(e,t),s=t.helpWidth||80,n=2,o=2;function a(D,E){if(E){let C=`${D.padEnd(i+o)}${E}`;return t.wrap(C,s-n,i+o)}return D}function u(D){return D.join(`
3
+ `).replace(/^/gm," ".repeat(n))}let l=[`Usage: ${t.commandUsage(e)}`,""],c=t.commandDescription(e);c.length>0&&(l=l.concat([t.wrap(c,s,0),""]));let f=t.visibleArguments(e).map(D=>a(t.argumentTerm(D),t.argumentDescription(D)));f.length>0&&(l=l.concat(["Arguments:",u(f),""]));let d=t.visibleOptions(e).map(D=>a(t.optionTerm(D),t.optionDescription(D)));if(d.length>0&&(l=l.concat(["Options:",u(d),""])),this.showGlobalOptions){let D=t.visibleGlobalOptions(e).map(E=>a(t.optionTerm(E),t.optionDescription(E)));D.length>0&&(l=l.concat(["Global Options:",u(D),""]))}let h=t.visibleCommands(e).map(D=>a(t.subcommandTerm(D),t.subcommandDescription(D)));return h.length>0&&(l=l.concat(["Commands:",u(h),""])),l.join(`
4
+ `)}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,i,s=40){let n=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",o=new RegExp(`[\\n][${n}]+`);if(e.match(o))return e;let a=t-i;if(a<s)return e;let u=e.slice(0,i),l=e.slice(i).replace(`\r
5
+ `,`
6
+ `),c=" ".repeat(i),d="\\s\u200B",h=new RegExp(`
7
+ |.{1,${a-1}}([${d}]|$)|[^${d}]+?([${d}]|$)`,"g"),D=l.match(h)||[];return u+D.map((E,C)=>E===`
8
+ `?"":(C>0?c:"")+E.trimEnd()).join(`
9
+ `)}};vr.Help=_t});var Lt=p(vt=>{var{InvalidArgumentError:Qo}=xe(),Tt=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let i=tu(e);this.short=i.shortFlag,this.long=i.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e=="string"&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,i)=>{if(!this.argChoices.includes(t))throw new Qo(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,i):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return eu(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},It=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,i)=>{this.positiveOptions.has(i)&&this.dualOptions.add(i)})}valueFromOption(e,t){let i=t.attributeName();if(!this.dualOptions.has(i))return!0;let s=this.negativeOptions.get(i).presetArg,n=s!==void 0?s:!1;return t.negate===(n===e)}};function eu(r){return r.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function tu(r){let e,t,i=r.split(/[ |,]+/);return i.length>1&&!/^[[<]/.test(i[1])&&(e=i.shift()),t=i.shift(),!e&&/^-[^-]$/.test(t)&&(e=t,t=void 0),{shortFlag:e,longFlag:t}}vt.Option=Tt;vt.DualOptions=It});var Br=p(Lr=>{function ru(r,e){if(Math.abs(r.length-e.length)>3)return Math.max(r.length,e.length);let t=[];for(let i=0;i<=r.length;i++)t[i]=[i];for(let i=0;i<=e.length;i++)t[0][i]=i;for(let i=1;i<=e.length;i++)for(let s=1;s<=r.length;s++){let n=1;r[s-1]===e[i-1]?n=0:n=1,t[s][i]=Math.min(t[s-1][i]+1,t[s][i-1]+1,t[s-1][i-1]+n),s>1&&i>1&&r[s-1]===e[i-2]&&r[s-2]===e[i-1]&&(t[s][i]=Math.min(t[s][i],t[s-2][i-2]+1))}return t[r.length][e.length]}function iu(r,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=r.startsWith("--");t&&(r=r.slice(2),e=e.map(o=>o.slice(2)));let i=[],s=3,n=.4;return e.forEach(o=>{if(o.length<=1)return;let a=ru(r,o),u=Math.max(r.length,o.length);(u-a)/u>n&&(a<s?(s=a,i=[o]):a===s&&i.push(o))}),i.sort((o,a)=>o.localeCompare(a)),t&&(i=i.map(o=>`--${o}`)),i.length>1?`
10
+ (Did you mean one of ${i.join(", ")}?)`:i.length===1?`
11
+ (Did you mean ${i[0]}?)`:""}Lr.suggestSimilar=iu});var jr=p(kr=>{var su=require("node:events").EventEmitter,Bt=require("node:child_process"),te=require("node:path"),Nt=require("node:fs"),O=require("node:process"),{Argument:nu,humanReadableArgName:ou}=Ue(),{CommanderError:qt}=xe(),{Help:uu}=$t(),{Option:Nr,DualOptions:au}=Lt(),{suggestSimilar:qr}=Br(),Pt=class r extends su{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:t=>O.stdout.write(t),writeErr:t=>O.stderr.write(t),getOutHelpWidth:()=>O.stdout.isTTY?O.stdout.columns:void 0,getErrHelpWidth:()=>O.stderr.isTTY?O.stderr.columns:void 0,outputError:(t,i)=>i(t)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,i){let s=t,n=i;typeof s=="object"&&s!==null&&(n=s,s=null),n=n||{};let[,o,a]=e.match(/([^ ]+) *(.*)/),u=this.createCommand(o);return s&&(u.description(s),u._executableHandler=!0),n.isDefault&&(this._defaultCommandName=u._name),u._hidden=!!(n.noHelp||n.hidden),u._executableFile=n.executableFile||null,a&&u.arguments(a),this._registerCommand(u),u.parent=this,u.copyInheritedSettings(this),s?this:u}createCommand(e){return new r(e)}createHelp(){return Object.assign(new uu,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
12
+ - specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new nu(e,t)}argument(e,t,i,s){let n=this.createArgument(e,t);return typeof i=="function"?n.default(s).argParser(i):n.default(i),this.addArgument(n),this}arguments(e){return e.trim().split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t&&t.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,this;e=e??"help [command]";let[,i,s]=e.match(/([^ ]+) *(.*)/),n=t??"display help for command",o=this.createCommand(i);return o.helpOption(!1),s&&o.arguments(s),n&&o.description(n),this._addImplicitHelpCommand=!0,this._helpCommand=o,this}addHelpCommand(e,t){return typeof e!="object"?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let i=["preSubcommand","preAction","postAction"];if(!i.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
13
+ Expecting one of '${i.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,i){this._exitCallback&&this._exitCallback(new qt(e,t,i)),O.exit(e)}action(e){let t=i=>{let s=this.registeredArguments.length,n=i.slice(0,s);return this._storeOptionsAsProperties?n[s]=this:n[s]=this.opts(),n.push(this),e.apply(this,n)};return this._actionHandler=t,this}createOption(e,t){return new Nr(e,t)}_callParseArg(e,t,i,s){try{return e.parseArg(t,i)}catch(n){if(n.code==="commander.invalidArgument"){let o=`${s} ${n.message}`;this.error(o,{exitCode:n.exitCode,code:n.code})}throw n}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let i=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${i}'
14
+ - already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=s=>[s.name()].concat(s.aliases()),i=t(e).find(s=>this._findCommand(s));if(i){let s=t(this._findCommand(i)).join("|"),n=t(e).join("|");throw new Error(`cannot add command '${n}' as already have command '${s}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),i=e.attributeName();if(e.negate){let n=e.long.replace(/^--no-/,"--");this._findOption(n)||this.setOptionValueWithSource(i,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(i,e.defaultValue,"default");let s=(n,o,a)=>{n==null&&e.presetArg!==void 0&&(n=e.presetArg);let u=this.getOptionValue(i);n!==null&&e.parseArg?n=this._callParseArg(e,n,u,o):n!==null&&e.variadic&&(n=e._concatValue(n,u)),n==null&&(e.negate?n=!1:e.isBoolean()||e.optional?n=!0:n=""),this.setOptionValueWithSource(i,n,a)};return this.on("option:"+t,n=>{let o=`error: option '${e.flags}' argument '${n}' is invalid.`;s(n,o,"cli")}),e.envVar&&this.on("optionEnv:"+t,n=>{let o=`error: option '${e.flags}' value '${n}' from env '${e.envVar}' is invalid.`;s(n,o,"env")}),this}_optionEx(e,t,i,s,n){if(typeof t=="object"&&t instanceof Nr)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let o=this.createOption(t,i);if(o.makeOptionMandatory(!!e.mandatory),typeof s=="function")o.default(n).argParser(s);else if(s instanceof RegExp){let a=s;s=(u,l)=>{let c=a.exec(u);return c?c[0]:l},o.default(n).argParser(s)}else o.default(s);return this.addOption(o)}option(e,t,i,s){return this._optionEx({},e,t,i,s)}requiredOption(e,t,i,s){return this._optionEx({mandatory:!0},e,t,i,s)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,i){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=i,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(i=>{i.getOptionValueSource(e)!==void 0&&(t=i.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},e===void 0&&t.from===void 0){O.versions?.electron&&(t.from="electron");let s=O.execArgv??[];(s.includes("-e")||s.includes("--eval")||s.includes("-p")||s.includes("--print"))&&(t.from="eval")}e===void 0&&(e=O.argv),this.rawArgs=e.slice();let i;switch(t.from){case void 0:case"node":this._scriptPath=e[1],i=e.slice(2);break;case"electron":O.defaultApp?(this._scriptPath=e[1],i=e.slice(2)):i=e.slice(1);break;case"user":i=e.slice(0);break;case"eval":i=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",i}parse(e,t){let i=this._prepareUserArgs(e,t);return this._parseCommand([],i),this}async parseAsync(e,t){let i=this._prepareUserArgs(e,t);return await this._parseCommand([],i),this}_executeSubCommand(e,t){t=t.slice();let i=!1,s=[".js",".ts",".tsx",".mjs",".cjs"];function n(c,f){let d=te.resolve(c,f);if(Nt.existsSync(d))return d;if(s.includes(te.extname(f)))return;let h=s.find(D=>Nt.existsSync(`${d}${D}`));if(h)return`${d}${h}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let c;try{c=Nt.realpathSync(this._scriptPath)}catch{c=this._scriptPath}a=te.resolve(te.dirname(c),a)}if(a){let c=n(a,o);if(!c&&!e._executableFile&&this._scriptPath){let f=te.basename(this._scriptPath,te.extname(this._scriptPath));f!==this._name&&(c=n(a,`${f}-${e._name}`))}o=c||o}i=s.includes(te.extname(o));let u;O.platform!=="win32"?i?(t.unshift(o),t=Pr(O.execArgv).concat(t),u=Bt.spawn(O.argv[0],t,{stdio:"inherit"})):u=Bt.spawn(o,t,{stdio:"inherit"}):(t.unshift(o),t=Pr(O.execArgv).concat(t),u=Bt.spawn(O.execPath,t,{stdio:"inherit"})),u.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(f=>{O.on(f,()=>{u.killed===!1&&u.exitCode===null&&u.kill(f)})});let l=this._exitCallback;u.on("close",c=>{c=c??1,l?l(new qt(c,"commander.executeSubCommandAsync","(close)")):O.exit(c)}),u.on("error",c=>{if(c.code==="ENOENT"){let f=a?`searched for local subcommand relative to directory '${a}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",d=`'${o}' does not exist
15
+ - if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
16
+ - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
17
+ - ${f}`;throw new Error(d)}else if(c.code==="EACCES")throw new Error(`'${o}' not executable`);if(!l)O.exit(1);else{let f=new qt(1,"commander.executeSubCommandAsync","(error)");f.nestedError=c,l(f)}}),this.runningCommand=u}_dispatchSubcommand(e,t,i){let s=this._findCommand(e);s||this.help({error:!0});let n;return n=this._chainOrCallSubCommandHook(n,s,"preSubcommand"),n=this._chainOrCall(n,()=>{if(s._executableHandler)this._executeSubCommand(s,t.concat(i));else return s._parseCommand(t,i)}),n}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(i,s,n)=>{let o=s;if(s!==null&&i.parseArg){let a=`error: command-argument value '${s}' is invalid for argument '${i.name()}'.`;o=this._callParseArg(i,s,n,a)}return o};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((i,s)=>{let n=i.defaultValue;i.variadic?s<this.args.length?(n=this.args.slice(s),i.parseArg&&(n=n.reduce((o,a)=>e(i,a,o),i.defaultValue))):n===void 0&&(n=[]):s<this.args.length&&(n=this.args[s],i.parseArg&&(n=e(i,n,i.defaultValue))),t[s]=n}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let i=e,s=[];return this._getCommandAndAncestors().reverse().filter(n=>n._lifeCycleHooks[t]!==void 0).forEach(n=>{n._lifeCycleHooks[t].forEach(o=>{s.push({hookedCommand:n,callback:o})})}),t==="postAction"&&s.reverse(),s.forEach(n=>{i=this._chainOrCall(i,()=>n.callback(n.hookedCommand,this))}),i}_chainOrCallSubCommandHook(e,t,i){let s=e;return this._lifeCycleHooks[i]!==void 0&&this._lifeCycleHooks[i].forEach(n=>{s=this._chainOrCall(s,()=>n(this,t))}),s}_parseCommand(e,t){let i=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(i.operands),t=i.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(i.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let s=()=>{i.unknown.length>0&&this.unknownOption(i.unknown[0])},n=`command:${this.name()}`;if(this._actionHandler){s(),this._processArguments();let o;return o=this._chainOrCallHooks(o,"preAction"),o=this._chainOrCall(o,()=>this._actionHandler(this.processedArgs)),this.parent&&(o=this._chainOrCall(o,()=>{this.parent.emit(n,e,t)})),o=this._chainOrCallHooks(o,"postAction"),o}if(this.parent&&this.parent.listenerCount(n))s(),this._processArguments(),this.parent.emit(n,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(s(),this._processArguments())}else this.commands.length?(s(),this.help({error:!0})):(s(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(i=>{let s=i.attributeName();return this.getOptionValue(s)===void 0?!1:this.getOptionValueSource(s)!=="default"});e.filter(i=>i.conflictsWith.length>0).forEach(i=>{let s=e.find(n=>i.conflictsWith.includes(n.attributeName()));s&&this._conflictingOption(i,s)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],i=[],s=t,n=e.slice();function o(u){return u.length>1&&u[0]==="-"}let a=null;for(;n.length;){let u=n.shift();if(u==="--"){s===i&&s.push(u),s.push(...n);break}if(a&&!o(u)){this.emit(`option:${a.name()}`,u);continue}if(a=null,o(u)){let l=this._findOption(u);if(l){if(l.required){let c=n.shift();c===void 0&&this.optionMissingArgument(l),this.emit(`option:${l.name()}`,c)}else if(l.optional){let c=null;n.length>0&&!o(n[0])&&(c=n.shift()),this.emit(`option:${l.name()}`,c)}else this.emit(`option:${l.name()}`);a=l.variadic?l:null;continue}}if(u.length>2&&u[0]==="-"&&u[1]!=="-"){let l=this._findOption(`-${u[1]}`);if(l){l.required||l.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${l.name()}`,u.slice(2)):(this.emit(`option:${l.name()}`),n.unshift(`-${u.slice(2)}`));continue}}if(/^--[^=]+=/.test(u)){let l=u.indexOf("="),c=this._findOption(u.slice(0,l));if(c&&(c.required||c.optional)){this.emit(`option:${c.name()}`,u.slice(l+1));continue}}if(o(u)&&(s=i),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&i.length===0){if(this._findCommand(u)){t.push(u),n.length>0&&i.push(...n);break}else if(this._getHelpCommand()&&u===this._getHelpCommand().name()){t.push(u),n.length>0&&t.push(...n);break}else if(this._defaultCommandName){i.push(u),n.length>0&&i.push(...n);break}}if(this._passThroughOptions){s.push(u),n.length>0&&s.push(...n);break}s.push(u)}return{operands:t,unknown:i}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let i=0;i<t;i++){let s=this.options[i].attributeName();e[s]=s===this._versionOptionName?this._version:this[s]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
18
+ `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
19
+ `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
20
+ `),this.outputHelp({error:!0}));let i=t||{},s=i.exitCode||1,n=i.code||"commander.error";this._exit(s,n,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in O.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,O.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new au(this.options),t=i=>this.getOptionValue(i)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(i));this.options.filter(i=>i.implied!==void 0&&t(i.attributeName())&&e.valueFromOption(this.getOptionValue(i.attributeName()),i)).forEach(i=>{Object.keys(i.implied).filter(s=>!t(s)).forEach(s=>{this.setOptionValueWithSource(s,i.implied[s],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let i=o=>{let a=o.attributeName(),u=this.getOptionValue(a),l=this.options.find(f=>f.negate&&a===f.attributeName()),c=this.options.find(f=>!f.negate&&a===f.attributeName());return l&&(l.presetArg===void 0&&u===!1||l.presetArg!==void 0&&u===l.presetArg)?l:c||o},s=o=>{let a=i(o),u=a.attributeName();return this.getOptionValueSource(u)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},n=`error: ${s(e)} cannot be used with ${s(t)}`;this.error(n,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let s=[],n=this;do{let o=n.createHelp().visibleOptions(n).filter(a=>a.long).map(a=>a.long);s=s.concat(o),n=n.parent}while(n&&!n._enablePositionalOptions);t=qr(e,s)}let i=`error: unknown option '${e}'${t}`;this.error(i,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,i=t===1?"":"s",n=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${i} but got ${e.length}.`;this.error(n,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let s=[];this.createHelp().visibleCommands(this).forEach(n=>{s.push(n.name()),n.alias()&&s.push(n.alias())}),t=qr(e,s)}let i=`error: unknown command '${e}'${t}`;this.error(i,{code:"commander.unknownCommand"})}version(e,t,i){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",i=i||"output the version number";let s=this.createOption(t,i);return this._versionOptionName=s.attributeName(),this._registerOption(s),this.on("option:"+s.name(),()=>{this._outputConfiguration.writeOut(`${e}
21
+ `),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");let i=this.parent?._findCommand(e);if(i){let s=[i.name()].concat(i.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${s}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map(i=>ou(i));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=te.basename(e,te.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp();return t.helpWidth===void 0&&(t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),t.formatHelp(this,t)}_getHelpContext(e){e=e||{};let t={error:!!e.error},i;return t.error?i=s=>this._outputConfiguration.writeErr(s):i=s=>this._outputConfiguration.writeOut(s),t.write=e.write||i,t.command=this,t}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let i=this._getHelpContext(e);this._getCommandAndAncestors().reverse().forEach(n=>n.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let s=this.helpInformation(i);if(t&&(s=t(s),typeof s!="string"&&!Buffer.isBuffer(s)))throw new Error("outputHelp callback must return a string or a Buffer");i.write(s),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(n=>n.emit("afterAllHelp",i))}helpOption(e,t){return typeof e=="boolean"?(e?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(e=e??"-h, --help",t=t??"display help for command",this._helpOption=this.createOption(e,t),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let t=O.exitCode||0;t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let i=["beforeAll","before","after","afterAll"];if(!i.includes(e))throw new Error(`Unexpected value for position to addHelpText.
22
+ Expecting one of '${i.join("', '")}'`);let s=`${e}Help`;return this.on(s,n=>{let o;typeof t=="function"?o=t({error:n.error,command:n.command}):o=t,o&&n.write(`${o}
23
+ `)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(s=>t.is(s))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Pr(r){return r.map(e=>{if(!e.startsWith("--inspect"))return e;let t,i="127.0.0.1",s="9229",n;return(n=e.match(/^(--inspect(-brk)?)$/))!==null?t=n[1]:(n=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=n[1],/^\d+$/.test(n[3])?s=n[3]:i=n[3]):(n=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=n[1],i=n[3],s=n[4]),t&&s!=="0"?`${t}=${i}:${parseInt(s)+1}`:e})}kr.Command=Pt});var Ur=p(H=>{var{Argument:Mr}=Ue(),{Command:kt}=jr(),{CommanderError:lu,InvalidArgumentError:Hr}=xe(),{Help:cu}=$t(),{Option:Vr}=Lt();H.program=new kt;H.createCommand=r=>new kt(r);H.createOption=(r,e)=>new Vr(r,e);H.createArgument=(r,e)=>new Mr(r,e);H.Command=kt;H.Option=Vr;H.Argument=Mr;H.Help=cu;H.CommanderError=lu;H.InvalidArgumentError=Hr;H.InvalidOptionArgumentError=Hr});var Zr=p((If,Vt)=>{var Xe=process||{},Jr=Xe.argv||[],ze=Xe.env||{},hu=!(ze.NO_COLOR||Jr.includes("--no-color"))&&(!!ze.FORCE_COLOR||Jr.includes("--color")||Xe.platform==="win32"||(Xe.stdout||{}).isTTY&&ze.TERM!=="dumb"||!!ze.CI),fu=(r,e,t=r)=>i=>{let s=""+i,n=s.indexOf(e,r.length);return~n?r+Du(s,e,t,n)+e:r+s+e},Du=(r,e,t,i)=>{let s="",n=0;do s+=r.substring(n,i)+t,n=i+e.length,i=r.indexOf(e,n);while(~i);return s+r.substring(n)},Yr=(r=hu)=>{let e=r?fu:()=>String;return{isColorSupported:r,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};Vt.exports=Yr();Vt.exports.createColors=Yr});var Je=p((Uf,ui)=>{var Gt=[],oi=0,T=(r,e)=>{oi>=e&&Gt.push(r)};T.WARN=1;T.INFO=2;T.DEBUG=3;T.reset=()=>{Gt=[]};T.setDebugLevel=r=>{oi=r};T.warn=r=>T(r,T.WARN);T.info=r=>T(r,T.INFO);T.debug=r=>T(r,T.DEBUG);T.debugMessages=()=>Gt;ui.exports=T});var li=p((Gf,ai)=>{"use strict";ai.exports=({onlyFirst:r=!1}={})=>{let e=["[\\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(e,r?void 0:"g")}});var hi=p((Wf,ci)=>{"use strict";var bu=li();ci.exports=r=>typeof r=="string"?r.replace(bu(),""):r});var Di=p((zf,Wt)=>{"use strict";var fi=r=>Number.isNaN(r)?!1:r>=4352&&(r<=4447||r===9001||r===9002||11904<=r&&r<=12871&&r!==12351||12880<=r&&r<=19903||19968<=r&&r<=42182||43360<=r&&r<=43388||44032<=r&&r<=55203||63744<=r&&r<=64255||65040<=r&&r<=65049||65072<=r&&r<=65131||65281<=r&&r<=65376||65504<=r&&r<=65510||110592<=r&&r<=110593||127488<=r&&r<=127569||131072<=r&&r<=262141);Wt.exports=fi;Wt.exports.default=fi});var pi=p((Xf,di)=>{"use strict";di.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var gi=p((Kf,zt)=>{"use strict";var Fu=hi(),yu=Di(),wu=pi(),mi=r=>{if(typeof r!="string"||r.length===0||(r=Fu(r),r.length===0))return 0;r=r.replace(wu()," ");let e=0;for(let t=0;t<r.length;t++){let i=r.codePointAt(t);i<=31||i>=127&&i<=159||i>=768&&i<=879||(i>65535&&t++,e+=yu(i)?2:1)}return e};zt.exports=mi;zt.exports.default=mi});var Xt=p((Jf,Fi)=>{var Ei=gi();function Ye(r){return r?/\u001b\[((?:\d*;){0,5}\d*)m/g:/\u001b\[(?:\d*;){0,5}\d*m/g}function Y(r){let e=Ye();return(""+r).replace(e,"").split(`
24
+ `).reduce(function(s,n){return Ei(n)>s?Ei(n):s},0)}function Se(r,e){return Array(e+1).join(r)}function xu(r,e,t,i){let s=Y(r);if(e+1>=s){let n=e-s;switch(i){case"right":{r=Se(t,n)+r;break}case"center":{let o=Math.ceil(n/2),a=n-o;r=Se(t,a)+r+Se(t,o);break}default:{r=r+Se(t,n);break}}}return r}var fe={};function _e(r,e,t){e="\x1B["+e+"m",t="\x1B["+t+"m",fe[e]={set:r,to:!0},fe[t]={set:r,to:!1},fe[r]={on:e,off:t}}_e("bold",1,22);_e("italics",3,23);_e("underline",4,24);_e("inverse",7,27);_e("strikethrough",9,29);function Ci(r,e){let t=e[1]?parseInt(e[1].split(";")[0]):0;if(t>=30&&t<=39||t>=90&&t<=97){r.lastForegroundAdded=e[0];return}if(t>=40&&t<=49||t>=100&&t<=107){r.lastBackgroundAdded=e[0];return}if(t===0){for(let s in r)Object.prototype.hasOwnProperty.call(r,s)&&delete r[s];return}let i=fe[e[0]];i&&(r[i.set]=i.to)}function Au(r){let e=Ye(!0),t=e.exec(r),i={};for(;t!==null;)Ci(i,t),t=e.exec(r);return i}function bi(r,e){let t=r.lastBackgroundAdded,i=r.lastForegroundAdded;return delete r.lastBackgroundAdded,delete r.lastForegroundAdded,Object.keys(r).forEach(function(s){r[s]&&(e+=fe[s].off)}),t&&t!="\x1B[49m"&&(e+="\x1B[49m"),i&&i!="\x1B[39m"&&(e+="\x1B[39m"),e}function Ou(r,e){let t=r.lastBackgroundAdded,i=r.lastForegroundAdded;return delete r.lastBackgroundAdded,delete r.lastForegroundAdded,Object.keys(r).forEach(function(s){r[s]&&(e=fe[s].on+e)}),t&&t!="\x1B[49m"&&(e=t+e),i&&i!="\x1B[39m"&&(e=i+e),e}function Ru(r,e){if(r.length===Y(r))return r.substr(0,e);for(;Y(r)>e;)r=r.slice(0,-1);return r}function Su(r,e){let t=Ye(!0),i=r.split(Ye()),s=0,n=0,o="",a,u={};for(;n<e;){a=t.exec(r);let l=i[s];if(s++,n+Y(l)>e&&(l=Ru(l,e-n)),o+=l,n+=Y(l),n<e){if(!a)break;o+=a[0],Ci(u,a)}}return bi(u,o)}function _u(r,e,t){if(t=t||"\u2026",Y(r)<=e)return r;e-=Y(t);let s=Su(r,e);s+=t;let n="\x1B]8;;\x07";return r.includes(n)&&!s.includes(n)&&(s+=n),s}function $u(){return{chars:{top:"\u2500","top-mid":"\u252C","top-left":"\u250C","top-right":"\u2510",bottom:"\u2500","bottom-mid":"\u2534","bottom-left":"\u2514","bottom-right":"\u2518",left:"\u2502","left-mid":"\u251C",mid:"\u2500","mid-mid":"\u253C",right:"\u2502","right-mid":"\u2524",middle:"\u2502"},truncate:"\u2026",colWidths:[],rowHeights:[],colAligns:[],rowAligns:[],style:{"padding-left":1,"padding-right":1,head:["red"],border:["grey"],compact:!1},head:[]}}function Tu(r,e){r=r||{},e=e||$u();let t=Object.assign({},e,r);return t.chars=Object.assign({},e.chars,r.chars),t.style=Object.assign({},e.style,r.style),t}function Iu(r,e){let t=[],i=e.split(/(\s+)/g),s=[],n=0,o;for(let a=0;a<i.length;a+=2){let u=i[a],l=n+Y(u);n>0&&o&&(l+=o.length),l>r?(n!==0&&t.push(s.join("")),s=[u],n=Y(u)):(s.push(o||"",u),n=l),o=i[a+1]}return n&&t.push(s.join("")),t}function vu(r,e){let t=[],i="";function s(o,a){for(i.length&&a&&(i+=a),i+=o;i.length>r;)t.push(i.slice(0,r)),i=i.slice(r)}let n=e.split(/(\s+)/g);for(let o=0;o<n.length;o+=2)s(n[o],o&&n[o-1]);return i.length&&t.push(i),t}function Lu(r,e,t=!0){let i=[];e=e.split(`
25
+ `);let s=t?Iu:vu;for(let n=0;n<e.length;n++)i.push.apply(i,s(r,e[n]));return i}function Bu(r){let e={},t=[];for(let i=0;i<r.length;i++){let s=Ou(e,r[i]);e=Au(s);let n=Object.assign({},e);t.push(bi(n,s))}return t}function Nu(r,e){return["\x1B]","8",";",";",r||e,"\x07",e,"\x1B]","8",";",";","\x07"].join("")}Fi.exports={strlen:Y,repeat:Se,pad:xu,truncate:_u,mergeOptions:Tu,wordWrap:Lu,colorizeLines:Bu,hyperlink:Nu}});var Ai=p((Yf,xi)=>{var wi={};xi.exports=wi;var yi={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],grey:[90,39],brightRed:[91,39],brightGreen:[92,39],brightYellow:[93,39],brightBlue:[94,39],brightMagenta:[95,39],brightCyan:[96,39],brightWhite:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgGray:[100,49],bgGrey:[100,49],bgBrightRed:[101,49],bgBrightGreen:[102,49],bgBrightYellow:[103,49],bgBrightBlue:[104,49],bgBrightMagenta:[105,49],bgBrightCyan:[106,49],bgBrightWhite:[107,49],blackBG:[40,49],redBG:[41,49],greenBG:[42,49],yellowBG:[43,49],blueBG:[44,49],magentaBG:[45,49],cyanBG:[46,49],whiteBG:[47,49]};Object.keys(yi).forEach(function(r){var e=yi[r],t=wi[r]=[];t.open="\x1B["+e[0]+"m",t.close="\x1B["+e[1]+"m"})});var Ri=p((Zf,Oi)=>{"use strict";Oi.exports=function(r,e){e=e||process.argv;var t=e.indexOf("--"),i=/^-{1,2}/.test(r)?"":"--",s=e.indexOf(i+r);return s!==-1&&(t===-1?!0:s<t)}});var _i=p((Qf,Si)=>{"use strict";var qu=require("os"),z=Ri(),B=process.env,De=void 0;z("no-color")||z("no-colors")||z("color=false")?De=!1:(z("color")||z("colors")||z("color=true")||z("color=always"))&&(De=!0);"FORCE_COLOR"in B&&(De=B.FORCE_COLOR.length===0||parseInt(B.FORCE_COLOR,10)!==0);function Pu(r){return r===0?!1:{level:r,hasBasic:!0,has256:r>=2,has16m:r>=3}}function ku(r){if(De===!1)return 0;if(z("color=16m")||z("color=full")||z("color=truecolor"))return 3;if(z("color=256"))return 2;if(r&&!r.isTTY&&De!==!0)return 0;var e=De?1:0;if(process.platform==="win32"){var t=qu.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("CI"in B)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(s){return s in B})||B.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in B)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(B.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in B){var i=parseInt((B.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(B.TERM_PROGRAM){case"iTerm.app":return i>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(B.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(B.TERM)||"COLORTERM"in B?1:(B.TERM==="dumb",e)}function Kt(r){var e=ku(r);return Pu(e)}Si.exports={supportsColor:Kt,stdout:Kt(process.stdout),stderr:Kt(process.stderr)}});var Ti=p((eD,$i)=>{$i.exports=function(e,t){var i="";e=e||"Run the trap, drop the bass",e=e.split("");var s={a:["@","\u0104","\u023A","\u0245","\u0394","\u039B","\u0414"],b:["\xDF","\u0181","\u0243","\u026E","\u03B2","\u0E3F"],c:["\xA9","\u023B","\u03FE"],d:["\xD0","\u018A","\u0500","\u0501","\u0502","\u0503"],e:["\xCB","\u0115","\u018E","\u0258","\u03A3","\u03BE","\u04BC","\u0A6C"],f:["\u04FA"],g:["\u0262"],h:["\u0126","\u0195","\u04A2","\u04BA","\u04C7","\u050A"],i:["\u0F0F"],j:["\u0134"],k:["\u0138","\u04A0","\u04C3","\u051E"],l:["\u0139"],m:["\u028D","\u04CD","\u04CE","\u0520","\u0521","\u0D69"],n:["\xD1","\u014B","\u019D","\u0376","\u03A0","\u048A"],o:["\xD8","\xF5","\xF8","\u01FE","\u0298","\u047A","\u05DD","\u06DD","\u0E4F"],p:["\u01F7","\u048E"],q:["\u09CD"],r:["\xAE","\u01A6","\u0210","\u024C","\u0280","\u042F"],s:["\xA7","\u03DE","\u03DF","\u03E8"],t:["\u0141","\u0166","\u0373"],u:["\u01B1","\u054D"],v:["\u05D8"],w:["\u0428","\u0460","\u047C","\u0D70"],x:["\u04B2","\u04FE","\u04FC","\u04FD"],y:["\xA5","\u04B0","\u04CB"],z:["\u01B5","\u0240"]};return e.forEach(function(n){n=n.toLowerCase();var o=s[n]||[" "],a=Math.floor(Math.random()*o.length);typeof s[n]<"u"?i+=s[n][a]:i+=n}),i}});var vi=p((tD,Ii)=>{Ii.exports=function(e,t){e=e||" he is here ";var i={up:["\u030D","\u030E","\u0304","\u0305","\u033F","\u0311","\u0306","\u0310","\u0352","\u0357","\u0351","\u0307","\u0308","\u030A","\u0342","\u0313","\u0308","\u034A","\u034B","\u034C","\u0303","\u0302","\u030C","\u0350","\u0300","\u0301","\u030B","\u030F","\u0312","\u0313","\u0314","\u033D","\u0309","\u0363","\u0364","\u0365","\u0366","\u0367","\u0368","\u0369","\u036A","\u036B","\u036C","\u036D","\u036E","\u036F","\u033E","\u035B","\u0346","\u031A"],down:["\u0316","\u0317","\u0318","\u0319","\u031C","\u031D","\u031E","\u031F","\u0320","\u0324","\u0325","\u0326","\u0329","\u032A","\u032B","\u032C","\u032D","\u032E","\u032F","\u0330","\u0331","\u0332","\u0333","\u0339","\u033A","\u033B","\u033C","\u0345","\u0347","\u0348","\u0349","\u034D","\u034E","\u0353","\u0354","\u0355","\u0356","\u0359","\u035A","\u0323"],mid:["\u0315","\u031B","\u0300","\u0301","\u0358","\u0321","\u0322","\u0327","\u0328","\u0334","\u0335","\u0336","\u035C","\u035D","\u035E","\u035F","\u0360","\u0362","\u0338","\u0337","\u0361"," \u0489"]},s=[].concat(i.up,i.down,i.mid);function n(u){var l=Math.floor(Math.random()*u);return l}function o(u){var l=!1;return s.filter(function(c){l=c===u}),l}function a(u,l){var c="",f,d;l=l||{},l.up=typeof l.up<"u"?l.up:!0,l.mid=typeof l.mid<"u"?l.mid:!0,l.down=typeof l.down<"u"?l.down:!0,l.size=typeof l.size<"u"?l.size:"maxi",u=u.split("");for(d in u)if(!o(d)){switch(c=c+u[d],f={up:0,down:0,mid:0},l.size){case"mini":f.up=n(8),f.mid=n(2),f.down=n(8);break;case"maxi":f.up=n(16)+3,f.mid=n(4)+1,f.down=n(64)+3;break;default:f.up=n(8)+1,f.mid=n(6)/2,f.down=n(8)+1;break}var h=["up","mid","down"];for(var D in h)for(var E=h[D],C=0;C<=f[E];C++)l[E]&&(c=c+i[E][n(i[E].length)])}return c}return a(e,t)}});var Bi=p((rD,Li)=>{Li.exports=function(r){return function(e,t,i){if(e===" ")return e;switch(t%3){case 0:return r.red(e);case 1:return r.white(e);case 2:return r.blue(e)}}}});var qi=p((iD,Ni)=>{Ni.exports=function(r){return function(e,t,i){return t%2===0?e:r.inverse(e)}}});var ki=p((sD,Pi)=>{Pi.exports=function(r){var e=["red","yellow","green","blue","magenta"];return function(t,i,s){return t===" "?t:r[e[i++%e.length]](t)}}});var Mi=p((nD,ji)=>{ji.exports=function(r){var e=["underline","inverse","grey","yellow","red","green","blue","white","cyan","magenta","brightYellow","brightRed","brightGreen","brightBlue","brightWhite","brightCyan","brightMagenta"];return function(t,i,s){return t===" "?t:r[e[Math.round(Math.random()*(e.length-2))]](t)}}});var zi=p((uD,Wi)=>{var F={};Wi.exports=F;F.themes={};var ju=require("util"),ne=F.styles=Ai(),Vi=Object.defineProperties,Mu=new RegExp(/[\r\n]+/g);F.supportsColor=_i().supportsColor;typeof F.enabled>"u"&&(F.enabled=F.supportsColor()!==!1);F.enable=function(){F.enabled=!0};F.disable=function(){F.enabled=!1};F.stripColors=F.strip=function(r){return(""+r).replace(/\x1B\[\d+m/g,"")};var oD=F.stylize=function(e,t){if(!F.enabled)return e+"";var i=ne[t];return!i&&t in F?F[t](e):i.open+e+i.close},Hu=/[|\\{}()[\]^$+*?.]/g,Vu=function(r){if(typeof r!="string")throw new TypeError("Expected a string");return r.replace(Hu,"\\$&")};function Ui(r){var e=function t(){return Gu.apply(t,arguments)};return e._styles=r,e.__proto__=Uu,e}var Gi=(function(){var r={};return ne.grey=ne.gray,Object.keys(ne).forEach(function(e){ne[e].closeRe=new RegExp(Vu(ne[e].close),"g"),r[e]={get:function(){return Ui(this._styles.concat(e))}}}),r})(),Uu=Vi(function(){},Gi);function Gu(){var r=Array.prototype.slice.call(arguments),e=r.map(function(o){return o!=null&&o.constructor===String?o:ju.inspect(o)}).join(" ");if(!F.enabled||!e)return e;for(var t=e.indexOf(`
26
+ `)!=-1,i=this._styles,s=i.length;s--;){var n=ne[i[s]];e=n.open+e.replace(n.closeRe,n.open)+n.close,t&&(e=e.replace(Mu,function(o){return n.close+o+n.open}))}return e}F.setTheme=function(r){if(typeof r=="string"){console.log("colors.setTheme now only accepts an object, not a string. If you are trying to set a theme from a file, it is now your (the caller's) responsibility to require the file. The old syntax looked like colors.setTheme(__dirname + '/../themes/generic-logging.js'); The new syntax looks like colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));");return}for(var e in r)(function(t){F[t]=function(i){if(typeof r[t]=="object"){var s=i;for(var n in r[t])s=F[r[t][n]](s);return s}return F[r[t]](i)}})(e)};function Wu(){var r={};return Object.keys(Gi).forEach(function(e){r[e]={get:function(){return Ui([e])}}}),r}var zu=function(e,t){var i=t.split("");return i=i.map(e),i.join("")};F.trap=Ti();F.zalgo=vi();F.maps={};F.maps.america=Bi()(F);F.maps.zebra=qi()(F);F.maps.rainbow=ki()(F);F.maps.random=Mi()(F);for(Hi in F.maps)(function(r){F[r]=function(e){return zu(F.maps[r],e)}})(Hi);var Hi;Vi(F,Wu())});var Ki=p((aD,Xi)=>{var Xu=zi();Xi.exports=Xu});var Qi=p((lD,Ze)=>{var{info:Ku,debug:Zi}=Je(),k=Xt(),Yt=class r{constructor(e){this.setOptions(e),this.x=null,this.y=null}setOptions(e){["boolean","number","bigint","string"].indexOf(typeof e)!==-1&&(e={content:""+e}),e=e||{},this.options=e;let t=e.content;if(["boolean","number","bigint","string"].indexOf(typeof t)!==-1)this.content=String(t);else if(!t)this.content=this.options.href||"";else throw new Error("Content needs to be a primitive, got: "+typeof t);this.colSpan=e.colSpan||1,this.rowSpan=e.rowSpan||1,this.options.href&&Object.defineProperty(this,"href",{get(){return this.options.href}})}mergeTableOptions(e,t){this.cells=t;let i=this.options.chars||{},s=e.chars,n=this.chars={};Yu.forEach(function(u){Jt(i,s,u,n)}),this.truncate=this.options.truncate||e.truncate;let o=this.options.style=this.options.style||{},a=e.style;Jt(o,a,"padding-left",this),Jt(o,a,"padding-right",this),this.head=o.head||a.head,this.border=o.border||a.border,this.fixedWidth=e.colWidths[this.x],this.lines=this.computeLines(e),this.desiredWidth=k.strlen(this.content)+this.paddingLeft+this.paddingRight,this.desiredHeight=this.lines.length}computeLines(e){let t=e.wordWrap||e.textWrap,{wordWrap:i=t}=this.options;if(this.fixedWidth&&i){if(this.fixedWidth-=this.paddingLeft+this.paddingRight,this.colSpan){let o=1;for(;o<this.colSpan;)this.fixedWidth+=e.colWidths[this.x+o],o++}let{wrapOnWordBoundary:s=!0}=e,{wrapOnWordBoundary:n=s}=this.options;return this.wrapLines(k.wordWrap(this.fixedWidth,this.content,n))}return this.wrapLines(this.content.split(`
27
+ `))}wrapLines(e){let t=k.colorizeLines(e);return this.href?t.map(i=>k.hyperlink(this.href,i)):t}init(e){let t=this.x,i=this.y;this.widths=e.colWidths.slice(t,t+this.colSpan),this.heights=e.rowHeights.slice(i,i+this.rowSpan),this.width=this.widths.reduce(Yi,-1),this.height=this.heights.reduce(Yi,-1),this.hAlign=this.options.hAlign||e.colAligns[t],this.vAlign=this.options.vAlign||e.rowAligns[i],this.drawRight=t+this.colSpan==e.colWidths.length}draw(e,t){if(e=="top")return this.drawTop(this.drawRight);if(e=="bottom")return this.drawBottom(this.drawRight);let i=k.truncate(this.content,10,this.truncate);e||Ku(`${this.y}-${this.x}: ${this.rowSpan-e}x${this.colSpan} Cell ${i}`);let s=Math.max(this.height-this.lines.length,0),n;switch(this.vAlign){case"center":n=Math.ceil(s/2);break;case"bottom":n=s;break;default:n=0}if(e<n||e>=n+this.lines.length)return this.drawEmpty(this.drawRight,t);let o=this.lines.length>this.height&&e+1>=this.height;return this.drawLine(e-n,this.drawRight,o,t)}drawTop(e){let t=[];return this.cells?this.widths.forEach(function(i,s){t.push(this._topLeftChar(s)),t.push(k.repeat(this.chars[this.y==0?"top":"mid"],i))},this):(t.push(this._topLeftChar(0)),t.push(k.repeat(this.chars[this.y==0?"top":"mid"],this.width))),e&&t.push(this.chars[this.y==0?"topRight":"rightMid"]),this.wrapWithStyleColors("border",t.join(""))}_topLeftChar(e){let t=this.x+e,i;if(this.y==0)i=t==0?"topLeft":e==0?"topMid":"top";else if(t==0)i="leftMid";else if(i=e==0?"midMid":"bottomMid",this.cells&&(this.cells[this.y-1][t]instanceof r.ColSpanCell&&(i=e==0?"topMid":"mid"),e==0)){let n=1;for(;this.cells[this.y][t-n]instanceof r.ColSpanCell;)n++;this.cells[this.y][t-n]instanceof r.RowSpanCell&&(i="leftMid")}return this.chars[i]}wrapWithStyleColors(e,t){if(this[e]&&this[e].length)try{let i=Ki();for(let s=this[e].length-1;s>=0;s--)i=i[this[e][s]];return i(t)}catch{return t}else return t}drawLine(e,t,i,s){let n=this.chars[this.x==0?"left":"middle"];if(this.x&&s&&this.cells){let d=this.cells[this.y+s][this.x-1];for(;d instanceof $e;)d=this.cells[d.y][d.x-1];d instanceof Te||(n=this.chars.rightMid)}let o=k.repeat(" ",this.paddingLeft),a=t?this.chars.right:"",u=k.repeat(" ",this.paddingRight),l=this.lines[e],c=this.width-(this.paddingLeft+this.paddingRight);i&&(l+=this.truncate||"\u2026");let f=k.truncate(l,c,this.truncate);return f=k.pad(f,c," ",this.hAlign),f=o+f+u,this.stylizeLine(n,f,a)}stylizeLine(e,t,i){return e=this.wrapWithStyleColors("border",e),i=this.wrapWithStyleColors("border",i),this.y===0&&(t=this.wrapWithStyleColors("head",t)),e+t+i}drawBottom(e){let t=this.chars[this.x==0?"bottomLeft":"bottomMid"],i=k.repeat(this.chars.bottom,this.width),s=e?this.chars.bottomRight:"";return this.wrapWithStyleColors("border",t+i+s)}drawEmpty(e,t){let i=this.chars[this.x==0?"left":"middle"];if(this.x&&t&&this.cells){let o=this.cells[this.y+t][this.x-1];for(;o instanceof $e;)o=this.cells[o.y][o.x-1];o instanceof Te||(i=this.chars.rightMid)}let s=e?this.chars.right:"",n=k.repeat(" ",this.width);return this.stylizeLine(i,n,s)}},$e=class{constructor(){}draw(e){return typeof e=="number"&&Zi(`${this.y}-${this.x}: 1x1 ColSpanCell`),""}init(){}mergeTableOptions(){}},Te=class{constructor(e){this.originalCell=e}init(e){let t=this.y,i=this.originalCell.y;this.cellOffset=t-i,this.offset=Ju(e.rowHeights,i,this.cellOffset)}draw(e){return e=="top"?this.originalCell.draw(this.offset,this.cellOffset):e=="bottom"?this.originalCell.draw("bottom"):(Zi(`${this.y}-${this.x}: 1x${this.colSpan} RowSpanCell for ${this.originalCell.content}`),this.originalCell.draw(this.offset+1+e))}mergeTableOptions(){}};function Ji(...r){return r.filter(e=>e!=null).shift()}function Jt(r,e,t,i){let s=t.split("-");s.length>1?(s[1]=s[1].charAt(0).toUpperCase()+s[1].substr(1),s=s.join(""),i[s]=Ji(r[s],r[t],e[s],e[t])):i[t]=Ji(r[t],e[t])}function Ju(r,e,t){let i=r[e];for(let s=1;s<t;s++)i+=1+r[e+s];return i}function Yi(r,e){return r+e+1}var Yu=["top","top-mid","top-left","top-right","bottom","bottom-mid","bottom-left","bottom-right","left","left-mid","mid","mid-mid","right","right-mid","middle"];Ze.exports=Yt;Ze.exports.ColSpanCell=$e;Ze.exports.RowSpanCell=Te});var rs=p((cD,ts)=>{var{warn:Zu,debug:Qu}=Je(),Zt=Qi(),{ColSpanCell:ea,RowSpanCell:ta}=Zt;(function(){function r(h,D){return h[D]>0?r(h,D+1):D}function e(h){let D={};h.forEach(function(E,C){let x=0;E.forEach(function(y){y.y=C,y.x=C?r(D,x):x;let I=y.rowSpan||1,q=y.colSpan||1;if(I>1)for(let we=0;we<q;we++)D[y.x+we]=I;x=y.x+q}),Object.keys(D).forEach(y=>{D[y]--,D[y]<1&&delete D[y]})})}function t(h){let D=0;return h.forEach(function(E){E.forEach(function(C){D=Math.max(D,C.x+(C.colSpan||1))})}),D}function i(h){return h.length}function s(h,D){let E=h.y,C=h.y-1+(h.rowSpan||1),x=D.y,y=D.y-1+(D.rowSpan||1),I=!(E>y||x>C),q=h.x,we=h.x-1+(h.colSpan||1),Mo=D.x,Ho=D.x-1+(D.colSpan||1),Vo=!(q>Ho||Mo>we);return I&&Vo}function n(h,D,E){let C=Math.min(h.length-1,E),x={x:D,y:E};for(let y=0;y<=C;y++){let I=h[y];for(let q=0;q<I.length;q++)if(s(x,I[q]))return!0}return!1}function o(h,D,E,C){for(let x=E;x<C;x++)if(n(h,x,D))return!1;return!0}function a(h){h.forEach(function(D,E){D.forEach(function(C){for(let x=1;x<C.rowSpan;x++){let y=new ta(C);y.x=C.x,y.y=C.y+x,y.colSpan=C.colSpan,l(y,h[E+x])}})})}function u(h){for(let D=h.length-1;D>=0;D--){let E=h[D];for(let C=0;C<E.length;C++){let x=E[C];for(let y=1;y<x.colSpan;y++){let I=new ea;I.x=x.x+y,I.y=x.y,E.splice(C+1,0,I)}}}}function l(h,D){let E=0;for(;E<D.length&&D[E].x<h.x;)E++;D.splice(E,0,h)}function c(h){let D=i(h),E=t(h);Qu(`Max rows: ${D}; Max cols: ${E}`);for(let C=0;C<D;C++)for(let x=0;x<E;x++)if(!n(h,x,C)){let y={x,y:C,colSpan:1,rowSpan:1};for(x++;x<E&&!n(h,x,C);)y.colSpan++,x++;let I=C+1;for(;I<D&&o(h,I,y.x,y.x+y.colSpan);)y.rowSpan++,I++;let q=new Zt(y);q.x=y.x,q.y=y.y,Zu(`Missing cell at ${q.y}-${q.x}.`),l(q,h[C])}}function f(h){return h.map(function(D){if(!Array.isArray(D)){let E=Object.keys(D)[0];D=D[E],Array.isArray(D)?(D=D.slice(),D.unshift(E)):D=[E,D]}return D.map(function(E){return new Zt(E)})})}function d(h){let D=f(h);return e(D),c(D),a(D),u(D),D}ts.exports={makeTableLayout:d,layoutTable:e,addRowSpanCells:a,maxWidth:t,fillInTable:c,computeWidths:es("colSpan","desiredWidth","x",1),computeHeights:es("rowSpan","desiredHeight","y",1)}})();function es(r,e,t,i){return function(s,n){let o=[],a=[],u={};n.forEach(function(l){l.forEach(function(c){(c[r]||1)>1?a.push(c):o[c[t]]=Math.max(o[c[t]]||0,c[e]||0,i)})}),s.forEach(function(l,c){typeof l=="number"&&(o[c]=l)});for(let l=a.length-1;l>=0;l--){let c=a[l],f=c[r],d=c[t],h=o[d],D=typeof s[d]=="number"?0:1;if(typeof h=="number")for(let E=1;E<f;E++)h+=1+o[d+E],typeof s[d+E]!="number"&&D++;else h=e==="desiredWidth"?c.desiredWidth-1:1,(!u[d]||u[d]<h)&&(u[d]=h);if(c[e]>h){let E=0;for(;D>0&&c[e]>h;){if(typeof s[d+E]!="number"){let C=Math.round((c[e]-h)/D);h+=C,o[d+E]+=C,D--}E++}}}Object.assign(s,o,u);for(let l=0;l<s.length;l++)s[l]=Math.max(i,s[l]||0)}}});var ss=p((hD,is)=>{var re=Je(),ra=Xt(),Qt=rs(),Qe=class extends Array{constructor(e){super();let t=ra.mergeOptions(e);if(Object.defineProperty(this,"options",{value:t,enumerable:t.debug}),t.debug){switch(typeof t.debug){case"boolean":re.setDebugLevel(re.WARN);break;case"number":re.setDebugLevel(t.debug);break;case"string":re.setDebugLevel(parseInt(t.debug,10));break;default:re.setDebugLevel(re.WARN),re.warn(`Debug option is expected to be boolean, number, or string. Received a ${typeof t.debug}`)}Object.defineProperty(this,"messages",{get(){return re.debugMessages()}})}}toString(){let e=this,t=this.options.head&&this.options.head.length;t?(e=[this.options.head],this.length&&e.push.apply(e,this)):this.options.style.head=[];let i=Qt.makeTableLayout(e);i.forEach(function(n){n.forEach(function(o){o.mergeTableOptions(this.options,i)},this)},this),Qt.computeWidths(this.options.colWidths,i),Qt.computeHeights(this.options.rowHeights,i),i.forEach(function(n){n.forEach(function(o){o.init(this.options)},this)},this);let s=[];for(let n=0;n<i.length;n++){let o=i[n],a=this.options.rowHeights[n];(n===0||!this.options.style.compact||n==1&&t)&&er(o,"top",s);for(let u=0;u<a;u++)er(o,u,s);n+1==i.length&&er(o,"bottom",s)}return s.join(`
28
+ `)}get width(){return this.toString().split(`
29
+ `)[0].length}};Qe.reset=()=>re.reset();function er(r,e,t){let i=[];r.forEach(function(n){i.push(n.draw(e))});let s=i.join("");s.length&&t.push(s)}is.exports=Qe});var os=p((fD,ns)=>{ns.exports=ss()});var Ce=p((yd,Bs)=>{"use strict";var wa="2.0.0",xa=Number.MAX_SAFE_INTEGER||9007199254740991,Aa=16,Oa=250,Ra=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Bs.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:Aa,MAX_SAFE_BUILD_LENGTH:Oa,MAX_SAFE_INTEGER:xa,RELEASE_TYPES:Ra,SEMVER_SPEC_VERSION:wa,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var Pe=p((wd,Ns)=>{"use strict";var Sa=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...r)=>console.error("SEMVER",...r):()=>{};Ns.exports=Sa});var be=p((ee,qs)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:hr,MAX_SAFE_BUILD_LENGTH:_a,MAX_LENGTH:$a}=Ce(),Ta=Pe();ee=qs.exports={};var Ia=ee.re=[],va=ee.safeRe=[],m=ee.src=[],La=ee.safeSrc=[],g=ee.t={},Ba=0,fr="[a-zA-Z0-9-]",Na=[["\\s",1],["\\d",$a],[fr,_a]],qa=r=>{for(let[e,t]of Na)r=r.split(`${e}*`).join(`${e}{0,${t}}`).split(`${e}+`).join(`${e}{1,${t}}`);return r},b=(r,e,t)=>{let i=qa(e),s=Ba++;Ta(r,s,e),g[r]=s,m[s]=e,La[s]=i,Ia[s]=new RegExp(e,t?"g":void 0),va[s]=new RegExp(i,t?"g":void 0)};b("NUMERICIDENTIFIER","0|[1-9]\\d*");b("NUMERICIDENTIFIERLOOSE","\\d+");b("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${fr}*`);b("MAINVERSION",`(${m[g.NUMERICIDENTIFIER]})\\.(${m[g.NUMERICIDENTIFIER]})\\.(${m[g.NUMERICIDENTIFIER]})`);b("MAINVERSIONLOOSE",`(${m[g.NUMERICIDENTIFIERLOOSE]})\\.(${m[g.NUMERICIDENTIFIERLOOSE]})\\.(${m[g.NUMERICIDENTIFIERLOOSE]})`);b("PRERELEASEIDENTIFIER",`(?:${m[g.NONNUMERICIDENTIFIER]}|${m[g.NUMERICIDENTIFIER]})`);b("PRERELEASEIDENTIFIERLOOSE",`(?:${m[g.NONNUMERICIDENTIFIER]}|${m[g.NUMERICIDENTIFIERLOOSE]})`);b("PRERELEASE",`(?:-(${m[g.PRERELEASEIDENTIFIER]}(?:\\.${m[g.PRERELEASEIDENTIFIER]})*))`);b("PRERELEASELOOSE",`(?:-?(${m[g.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${m[g.PRERELEASEIDENTIFIERLOOSE]})*))`);b("BUILDIDENTIFIER",`${fr}+`);b("BUILD",`(?:\\+(${m[g.BUILDIDENTIFIER]}(?:\\.${m[g.BUILDIDENTIFIER]})*))`);b("FULLPLAIN",`v?${m[g.MAINVERSION]}${m[g.PRERELEASE]}?${m[g.BUILD]}?`);b("FULL",`^${m[g.FULLPLAIN]}$`);b("LOOSEPLAIN",`[v=\\s]*${m[g.MAINVERSIONLOOSE]}${m[g.PRERELEASELOOSE]}?${m[g.BUILD]}?`);b("LOOSE",`^${m[g.LOOSEPLAIN]}$`);b("GTLT","((?:<|>)?=?)");b("XRANGEIDENTIFIERLOOSE",`${m[g.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);b("XRANGEIDENTIFIER",`${m[g.NUMERICIDENTIFIER]}|x|X|\\*`);b("XRANGEPLAIN",`[v=\\s]*(${m[g.XRANGEIDENTIFIER]})(?:\\.(${m[g.XRANGEIDENTIFIER]})(?:\\.(${m[g.XRANGEIDENTIFIER]})(?:${m[g.PRERELEASE]})?${m[g.BUILD]}?)?)?`);b("XRANGEPLAINLOOSE",`[v=\\s]*(${m[g.XRANGEIDENTIFIERLOOSE]})(?:\\.(${m[g.XRANGEIDENTIFIERLOOSE]})(?:\\.(${m[g.XRANGEIDENTIFIERLOOSE]})(?:${m[g.PRERELEASELOOSE]})?${m[g.BUILD]}?)?)?`);b("XRANGE",`^${m[g.GTLT]}\\s*${m[g.XRANGEPLAIN]}$`);b("XRANGELOOSE",`^${m[g.GTLT]}\\s*${m[g.XRANGEPLAINLOOSE]}$`);b("COERCEPLAIN",`(^|[^\\d])(\\d{1,${hr}})(?:\\.(\\d{1,${hr}}))?(?:\\.(\\d{1,${hr}}))?`);b("COERCE",`${m[g.COERCEPLAIN]}(?:$|[^\\d])`);b("COERCEFULL",m[g.COERCEPLAIN]+`(?:${m[g.PRERELEASE]})?(?:${m[g.BUILD]})?(?:$|[^\\d])`);b("COERCERTL",m[g.COERCE],!0);b("COERCERTLFULL",m[g.COERCEFULL],!0);b("LONETILDE","(?:~>?)");b("TILDETRIM",`(\\s*)${m[g.LONETILDE]}\\s+`,!0);ee.tildeTrimReplace="$1~";b("TILDE",`^${m[g.LONETILDE]}${m[g.XRANGEPLAIN]}$`);b("TILDELOOSE",`^${m[g.LONETILDE]}${m[g.XRANGEPLAINLOOSE]}$`);b("LONECARET","(?:\\^)");b("CARETTRIM",`(\\s*)${m[g.LONECARET]}\\s+`,!0);ee.caretTrimReplace="$1^";b("CARET",`^${m[g.LONECARET]}${m[g.XRANGEPLAIN]}$`);b("CARETLOOSE",`^${m[g.LONECARET]}${m[g.XRANGEPLAINLOOSE]}$`);b("COMPARATORLOOSE",`^${m[g.GTLT]}\\s*(${m[g.LOOSEPLAIN]})$|^$`);b("COMPARATOR",`^${m[g.GTLT]}\\s*(${m[g.FULLPLAIN]})$|^$`);b("COMPARATORTRIM",`(\\s*)${m[g.GTLT]}\\s*(${m[g.LOOSEPLAIN]}|${m[g.XRANGEPLAIN]})`,!0);ee.comparatorTrimReplace="$1$2$3";b("HYPHENRANGE",`^\\s*(${m[g.XRANGEPLAIN]})\\s+-\\s+(${m[g.XRANGEPLAIN]})\\s*$`);b("HYPHENRANGELOOSE",`^\\s*(${m[g.XRANGEPLAINLOOSE]})\\s+-\\s+(${m[g.XRANGEPLAINLOOSE]})\\s*$`);b("STAR","(<|>)?=?\\s*\\*");b("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");b("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var ct=p((xd,Ps)=>{"use strict";var Pa=Object.freeze({loose:!0}),ka=Object.freeze({}),ja=r=>r?typeof r!="object"?Pa:r:ka;Ps.exports=ja});var Dr=p((Ad,Ms)=>{"use strict";var ks=/^[0-9]+$/,js=(r,e)=>{if(typeof r=="number"&&typeof e=="number")return r===e?0:r<e?-1:1;let t=ks.test(r),i=ks.test(e);return t&&i&&(r=+r,e=+e),r===e?0:t&&!i?-1:i&&!t?1:r<e?-1:1},Ma=(r,e)=>js(e,r);Ms.exports={compareIdentifiers:js,rcompareIdentifiers:Ma}});var _=p((Od,Vs)=>{"use strict";var ht=Pe(),{MAX_LENGTH:Hs,MAX_SAFE_INTEGER:ft}=Ce(),{safeRe:Dt,t:dt}=be(),Ha=ct(),{compareIdentifiers:dr}=Dr(),Va=(r,e)=>{let t=e.split(".");if(t.length>r.length)return!1;for(let i=0;i<t.length;i++)if(dr(r[i],t[i])!==0)return!1;return!0},pr=class r{constructor(e,t){if(t=Ha(t),e instanceof r){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>Hs)throw new TypeError(`version is longer than ${Hs} characters`);ht("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let i=e.trim().match(t.loose?Dt[dt.LOOSE]:Dt[dt.FULL]);if(!i)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+i[1],this.minor=+i[2],this.patch=+i[3],this.major>ft||this.major<0)throw new TypeError("Invalid major version");if(this.minor>ft||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>ft||this.patch<0)throw new TypeError("Invalid patch version");i[4]?this.prerelease=i[4].split(".").map(s=>{if(/^[0-9]+$/.test(s)){let n=+s;if(n>=0&&n<ft)return n}return s}):this.prerelease=[],this.build=i[5]?i[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(ht("SemVer.compare",this.version,this.options,e),!(e instanceof r)){if(typeof e=="string"&&e===this.version)return 0;e=new r(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof r||(e=new r(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof r||(e=new r(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let i=this.prerelease[t],s=e.prerelease[t];if(ht("prerelease compare",t,i,s),i===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(i===void 0)return-1;if(i===s)continue;return dr(i,s)}while(++t)}compareBuild(e){e instanceof r||(e=new r(e,this.options));let t=0;do{let i=this.build[t],s=e.build[t];if(ht("build compare",t,i,s),i===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(i===void 0)return-1;if(i===s)continue;return dr(i,s)}while(++t)}inc(e,t,i){if(e.startsWith("pre")){if(!t&&i===!1)throw new Error("invalid increment argument: identifier is empty");if(t){let s=`-${t}`.match(this.options.loose?Dt[dt.PRERELEASELOOSE]:Dt[dt.PRERELEASE]);if(!s||s[1]!==t)throw new Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,i);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,i);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,i),this.inc("pre",t,i);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",t,i),this.inc("pre",t,i);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let s=Number(i)?1:0;if(this.prerelease.length===0)this.prerelease=[s];else{let n=this.prerelease.length;for(;--n>=0;)typeof this.prerelease[n]=="number"&&(this.prerelease[n]++,n=-2);if(n===-1){if(t===this.prerelease.join(".")&&i===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(s)}}if(t){let n=[t,s];if(i===!1&&(n=[t]),Va(this.prerelease,t)){let o=this.prerelease[t.split(".").length];isNaN(o)&&(this.prerelease=n)}else this.prerelease=n}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};Vs.exports=pr});var se=p((Rd,Gs)=>{"use strict";var Us=_(),Ua=(r,e,t=!1)=>{if(r instanceof Us)return r;try{return new Us(r,e)}catch(i){if(!t)return null;throw i}};Gs.exports=Ua});var zs=p((Sd,Ws)=>{"use strict";var Ga=se(),Wa=(r,e)=>{let t=Ga(r,e);return t?t.version:null};Ws.exports=Wa});var Ks=p((_d,Xs)=>{"use strict";var za=se(),Xa=(r,e)=>{let t=za(r.trim().replace(/^[=v]+/,""),e);return t?t.version:null};Xs.exports=Xa});var Zs=p(($d,Ys)=>{"use strict";var Js=_(),Ka=(r,e,t,i,s)=>{typeof t=="string"&&(s=i,i=t,t=void 0);try{return new Js(r instanceof Js?r.version:r,t).inc(e,i,s).version}catch{return null}};Ys.exports=Ka});var tn=p((Td,en)=>{"use strict";var Qs=se(),Ja=(r,e)=>{let t=Qs(r,null,!0),i=Qs(e,null,!0),s=t.compare(i);if(s===0)return null;let n=s>0,o=n?t:i,a=n?i:t,u=!!o.prerelease.length;if(!!a.prerelease.length&&!u){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0)return a.minor&&!a.patch?"minor":"patch"}let c=u?"pre":"";return t.major!==i.major?c+"major":t.minor!==i.minor?c+"minor":t.patch!==i.patch?c+"patch":"prerelease"};en.exports=Ja});var sn=p((Id,rn)=>{"use strict";var Ya=_(),Za=(r,e)=>new Ya(r,e).major;rn.exports=Za});var on=p((vd,nn)=>{"use strict";var Qa=_(),el=(r,e)=>new Qa(r,e).minor;nn.exports=el});var an=p((Ld,un)=>{"use strict";var tl=_(),rl=(r,e)=>new tl(r,e).patch;un.exports=rl});var cn=p((Bd,ln)=>{"use strict";var il=se(),sl=(r,e)=>{let t=il(r,e);return t&&t.prerelease.length?t.prerelease:null};ln.exports=sl});var U=p((Nd,fn)=>{"use strict";var hn=_(),nl=(r,e,t)=>new hn(r,t).compare(new hn(e,t));fn.exports=nl});var dn=p((qd,Dn)=>{"use strict";var ol=U(),ul=(r,e,t)=>ol(e,r,t);Dn.exports=ul});var mn=p((Pd,pn)=>{"use strict";var al=U(),ll=(r,e)=>al(r,e,!0);pn.exports=ll});var pt=p((kd,En)=>{"use strict";var gn=_(),cl=(r,e,t)=>{let i=new gn(r,t),s=new gn(e,t);return i.compare(s)||i.compareBuild(s)};En.exports=cl});var bn=p((jd,Cn)=>{"use strict";var hl=pt(),fl=(r,e)=>r.sort((t,i)=>hl(t,i,e));Cn.exports=fl});var yn=p((Md,Fn)=>{"use strict";var Dl=pt(),dl=(r,e)=>r.sort((t,i)=>Dl(i,t,e));Fn.exports=dl});var ke=p((Hd,wn)=>{"use strict";var pl=U(),ml=(r,e,t)=>pl(r,e,t)>0;wn.exports=ml});var mt=p((Vd,xn)=>{"use strict";var gl=U(),El=(r,e,t)=>gl(r,e,t)<0;xn.exports=El});var mr=p((Ud,An)=>{"use strict";var Cl=U(),bl=(r,e,t)=>Cl(r,e,t)===0;An.exports=bl});var gr=p((Gd,On)=>{"use strict";var Fl=U(),yl=(r,e,t)=>Fl(r,e,t)!==0;On.exports=yl});var gt=p((Wd,Rn)=>{"use strict";var wl=U(),xl=(r,e,t)=>wl(r,e,t)>=0;Rn.exports=xl});var Et=p((zd,Sn)=>{"use strict";var Al=U(),Ol=(r,e,t)=>Al(r,e,t)<=0;Sn.exports=Ol});var Er=p((Xd,_n)=>{"use strict";var Rl=mr(),Sl=gr(),_l=ke(),$l=gt(),Tl=mt(),Il=Et(),vl=(r,e,t,i)=>{switch(e){case"===":return typeof r=="object"&&(r=r.version),typeof t=="object"&&(t=t.version),r===t;case"!==":return typeof r=="object"&&(r=r.version),typeof t=="object"&&(t=t.version),r!==t;case"":case"=":case"==":return Rl(r,t,i);case"!=":return Sl(r,t,i);case">":return _l(r,t,i);case">=":return $l(r,t,i);case"<":return Tl(r,t,i);case"<=":return Il(r,t,i);default:throw new TypeError(`Invalid operator: ${e}`)}};_n.exports=vl});var Tn=p((Kd,$n)=>{"use strict";var Ll=_(),Bl=se(),{safeRe:Ct,t:bt}=be(),Nl=(r,e)=>{if(r instanceof Ll)return r;if(typeof r=="number"&&(r=String(r)),typeof r!="string")return null;e=e||{};let t=null;if(!e.rtl)t=r.match(e.includePrerelease?Ct[bt.COERCEFULL]:Ct[bt.COERCE]);else{let u=e.includePrerelease?Ct[bt.COERCERTLFULL]:Ct[bt.COERCERTL],l;for(;(l=u.exec(r))&&(!t||t.index+t[0].length!==r.length);)(!t||l.index+l[0].length!==t.index+t[0].length)&&(t=l),u.lastIndex=l.index+l[1].length+l[2].length;u.lastIndex=-1}if(t===null)return null;let i=t[2],s=t[3]||"0",n=t[4]||"0",o=e.includePrerelease&&t[5]?`-${t[5]}`:"",a=e.includePrerelease&&t[6]?`+${t[6]}`:"";return Bl(`${i}.${s}.${n}${o}${a}`,e)};$n.exports=Nl});var vn=p((Jd,In)=>{"use strict";var ql=se(),Pl=Ce(),kl=_(),jl=(r,e,t)=>{if(!Pl.RELEASE_TYPES.includes(e))return null;let i=Ml(r,t);return i&&Hl(i,e)},Ml=(r,e)=>{let t=r instanceof kl?r.version:r;return ql(t,e)},Hl=(r,e)=>{if(Vl(e))return r.version;switch(r.prerelease=[],e){case"major":r.minor=0,r.patch=0;break;case"minor":r.patch=0;break}return r.format()},Vl=r=>r.startsWith("pre");In.exports=jl});var Bn=p((Yd,Ln)=>{"use strict";var Cr=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let s=this.map.keys().next().value;this.delete(s)}this.map.set(e,t)}return this}};Ln.exports=Cr});var G=p((Zd,kn)=>{"use strict";var Ul=/\s+/g,br=class r{constructor(e,t){if(t=Wl(t),e instanceof r)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new r(e.raw,t);if(e instanceof Fr)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(Ul," "),this.set=this.raw.split("||").map(i=>this.parseRange(i.trim())).filter(i=>i.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let i=this.set[0];if(this.set=this.set.filter(s=>!qn(s[0])),this.set.length===0)this.set=[i];else if(this.set.length>1){for(let s of this.set)if(s.length===1&&tc(s[0])){this.set=[s];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let t=this.set[e];for(let i=0;i<t.length;i++)i>0&&(this.formatted+=" "),this.formatted+=t[i].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){e=e.replace(ec,"");let i=((this.options.includePrerelease&&Zl)|(this.options.loose&&Ql))+":"+e,s=Nn.get(i);if(s)return s;let n=this.options.loose,o=n?N[$.HYPHENRANGELOOSE]:N[$.HYPHENRANGE];e=e.replace(o,fc(this.options.includePrerelease)),A("hyphen replace",e),e=e.replace(N[$.COMPARATORTRIM],Kl),A("comparator trim",e),e=e.replace(N[$.TILDETRIM],Jl),A("tilde trim",e),e=e.replace(N[$.CARETTRIM],Yl),A("caret trim",e);let a=e.split(" ").map(f=>rc(f,this.options)).join(" ").split(/\s+/).map(f=>hc(f,this.options));n&&(a=a.filter(f=>(A("loose invalid filter",f,this.options),!!f.match(N[$.COMPARATORLOOSE])))),A("range list",a);let u=new Map,l=a.map(f=>new Fr(f,this.options));for(let f of l){if(qn(f))return[f];u.set(f.value,f)}u.size>1&&u.has("")&&u.delete("");let c=[...u.values()];return Nn.set(i,c),c}intersects(e,t){if(!(e instanceof r))throw new TypeError("a Range is required");return this.set.some(i=>Pn(i,t)&&e.set.some(s=>Pn(s,t)&&i.every(n=>s.every(o=>n.intersects(o,t)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new zl(e,this.options)}catch{return!1}for(let t=0;t<this.set.length;t++)if(Dc(this.set[t],e,this.options))return!0;return!1}};kn.exports=br;var Gl=Bn(),Nn=new Gl,Wl=ct(),Fr=je(),A=Pe(),zl=_(),{safeRe:N,src:Xl,t:$,comparatorTrimReplace:Kl,tildeTrimReplace:Jl,caretTrimReplace:Yl}=be(),{FLAG_INCLUDE_PRERELEASE:Zl,FLAG_LOOSE:Ql}=Ce(),ec=new RegExp(Xl[$.BUILD],"g"),qn=r=>r.value==="<0.0.0-0",tc=r=>r.value==="",Pn=(r,e)=>{let t=!0,i=r.slice(),s=i.pop();for(;t&&i.length;)t=i.every(n=>s.intersects(n,e)),s=i.pop();return t},rc=(r,e)=>(r=r.replace(N[$.BUILD],""),A("comp",r,e),r=oc(r,e),A("caret",r),r=sc(r,e),A("tildes",r),r=ac(r,e),A("xrange",r),r=cc(r,e),A("stars",r),r),R=r=>!r||r.toLowerCase()==="x"||r==="*",ic=(r,e,t)=>R(r)&&!R(e)||R(e)&&t&&!R(t),sc=(r,e)=>r.trim().split(/\s+/).map(t=>nc(t,e)).join(" "),nc=(r,e)=>{let t=e.loose?N[$.TILDELOOSE]:N[$.TILDE],i=e.includePrerelease?"-0":"";return r.replace(t,(s,n,o,a,u)=>{A("tilde",r,s,n,o,a,u);let l;return R(n)?l="":R(o)?l=`>=${n}.0.0${i} <${+n+1}.0.0-0`:R(a)?l=`>=${n}.${o}.0${i} <${n}.${+o+1}.0-0`:u?(A("replaceTilde pr",u),l=`>=${n}.${o}.${a}-${u} <${n}.${+o+1}.0-0`):l=`>=${n}.${o}.${a} <${n}.${+o+1}.0-0`,A("tilde return",l),l})},oc=(r,e)=>r.trim().split(/\s+/).map(t=>uc(t,e)).join(" "),uc=(r,e)=>{A("caret",r,e);let t=e.loose?N[$.CARETLOOSE]:N[$.CARET],i=e.includePrerelease?"-0":"";return r.replace(t,(s,n,o,a,u)=>{A("caret",r,s,n,o,a,u);let l;return R(n)?l="":R(o)?l=`>=${n}.0.0${i} <${+n+1}.0.0-0`:R(a)?n==="0"?l=`>=${n}.${o}.0${i} <${n}.${+o+1}.0-0`:l=`>=${n}.${o}.0${i} <${+n+1}.0.0-0`:u?(A("replaceCaret pr",u),n==="0"?o==="0"?l=`>=${n}.${o}.${a}-${u} <${n}.${o}.${+a+1}-0`:l=`>=${n}.${o}.${a}-${u} <${n}.${+o+1}.0-0`:l=`>=${n}.${o}.${a}-${u} <${+n+1}.0.0-0`):(A("no pr"),n==="0"?o==="0"?l=`>=${n}.${o}.${a} <${n}.${o}.${+a+1}-0`:l=`>=${n}.${o}.${a} <${n}.${+o+1}.0-0`:l=`>=${n}.${o}.${a} <${+n+1}.0.0-0`),A("caret return",l),l})},ac=(r,e)=>(A("replaceXRanges",r,e),r.split(/\s+/).map(t=>lc(t,e)).join(" ")),lc=(r,e)=>{r=r.trim();let t=e.loose?N[$.XRANGELOOSE]:N[$.XRANGE];return r.replace(t,(i,s,n,o,a,u)=>{if(A("xRange",r,i,s,n,o,a,u),ic(n,o,a))return r;let l=R(n),c=l||R(o),f=c||R(a),d=f;return s==="="&&d&&(s=""),u=e.includePrerelease?"-0":"",l?s===">"||s==="<"?i="<0.0.0-0":i="*":s&&d?(c&&(o=0),a=0,s===">"?(s=">=",c?(n=+n+1,o=0,a=0):(o=+o+1,a=0)):s==="<="&&(s="<",c?n=+n+1:o=+o+1),s==="<"&&(u="-0"),i=`${s+n}.${o}.${a}${u}`):c?i=`>=${n}.0.0${u} <${+n+1}.0.0-0`:f&&(i=`>=${n}.${o}.0${u} <${n}.${+o+1}.0-0`),A("xRange return",i),i})},cc=(r,e)=>(A("replaceStars",r,e),r.trim().replace(N[$.STAR],"")),hc=(r,e)=>(A("replaceGTE0",r,e),r.trim().replace(N[e.includePrerelease?$.GTE0PRE:$.GTE0],"")),fc=r=>(e,t,i,s,n,o,a,u,l,c,f,d)=>(R(i)?t="":R(s)?t=`>=${i}.0.0${r?"-0":""}`:R(n)?t=`>=${i}.${s}.0${r?"-0":""}`:o?t=`>=${t}`:t=`>=${t}${r?"-0":""}`,R(l)?u="":R(c)?u=`<${+l+1}.0.0-0`:R(f)?u=`<${l}.${+c+1}.0-0`:d?u=`<=${l}.${c}.${f}-${d}`:r?u=`<${l}.${c}.${+f+1}-0`:u=`<=${u}`,`${t} ${u}`.trim()),Dc=(r,e,t)=>{for(let i=0;i<r.length;i++)if(!r[i].test(e))return!1;if(e.prerelease.length&&!t.includePrerelease){for(let i=0;i<r.length;i++)if(A(r[i].semver),r[i].semver!==Fr.ANY&&r[i].semver.prerelease.length>0){let s=r[i].semver;if(s.major===e.major&&s.minor===e.minor&&s.patch===e.patch)return!0}return!1}return!0}});var je=p((Qd,Gn)=>{"use strict";var Me=Symbol("SemVer ANY"),xr=class r{static get ANY(){return Me}constructor(e,t){if(t=jn(t),e instanceof r){if(e.loose===!!t.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),wr("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===Me?this.value="":this.value=this.operator+this.semver.version,wr("comp",this)}parse(e){let t=this.options.loose?Mn[Hn.COMPARATORLOOSE]:Mn[Hn.COMPARATOR],i=e.match(t);if(!i)throw new TypeError(`Invalid comparator: ${e}`);this.operator=i[1]!==void 0?i[1]:"",this.operator==="="&&(this.operator=""),i[2]?this.semver=new Vn(i[2],this.options.loose):this.semver=Me}toString(){return this.value}test(e){if(wr("Comparator.test",e,this.options.loose),this.semver===Me||e===Me)return!0;if(typeof e=="string")try{e=new Vn(e,this.options)}catch{return!1}return yr(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof r))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new Un(e.value,t).test(this.value):e.operator===""?e.value===""?!0:new Un(this.value,t).test(e.semver):(t=jn(t),t.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||yr(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||yr(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};Gn.exports=xr;var jn=ct(),{safeRe:Mn,t:Hn}=be(),yr=Er(),wr=Pe(),Vn=_(),Un=G()});var He=p((ep,Wn)=>{"use strict";var dc=G(),pc=(r,e,t)=>{try{e=new dc(e,t)}catch{return!1}return e.test(r)};Wn.exports=pc});var Xn=p((tp,zn)=>{"use strict";var mc=G(),gc=(r,e)=>new mc(r,e).set.map(t=>t.map(i=>i.value).join(" ").trim().split(" "));zn.exports=gc});var Jn=p((rp,Kn)=>{"use strict";var Ec=_(),Cc=G(),bc=(r,e,t)=>{let i=null,s=null,n=null;try{n=new Cc(e,t)}catch{return null}return r.forEach(o=>{n.test(o)&&(!i||s.compare(o)===-1)&&(i=o,s=new Ec(i,t))}),i};Kn.exports=bc});var Zn=p((ip,Yn)=>{"use strict";var Fc=_(),yc=G(),wc=(r,e,t)=>{let i=null,s=null,n=null;try{n=new yc(e,t)}catch{return null}return r.forEach(o=>{n.test(o)&&(!i||s.compare(o)===1)&&(i=o,s=new Fc(i,t))}),i};Yn.exports=wc});var to=p((sp,eo)=>{"use strict";var Ar=_(),xc=G(),Qn=ke(),Ac=(r,e)=>{r=new xc(r,e);let t=new Ar("0.0.0");if(r.test(t)||(t=new Ar("0.0.0-0"),r.test(t)))return t;t=null;for(let i=0;i<r.set.length;++i){let s=r.set[i],n=null;s.forEach(o=>{let a=new Ar(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!n||Qn(a,n))&&(n=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),n&&(!t||Qn(t,n))&&(t=n)}return t&&r.test(t)?t:null};eo.exports=Ac});var io=p((np,ro)=>{"use strict";var Oc=G(),Rc=(r,e)=>{try{return new Oc(r,e).range||"*"}catch{return null}};ro.exports=Rc});var Ft=p((op,uo)=>{"use strict";var Sc=_(),oo=je(),{ANY:_c}=oo,$c=G(),Tc=He(),so=ke(),no=mt(),Ic=Et(),vc=gt(),Lc=(r,e,t,i)=>{r=new Sc(r,i),e=new $c(e,i);let s,n,o,a,u;switch(t){case">":s=so,n=Ic,o=no,a=">",u=">=";break;case"<":s=no,n=vc,o=so,a="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Tc(r,e,i))return!1;for(let l=0;l<e.set.length;++l){let c=e.set[l],f=null,d=null;if(c.forEach(h=>{h.semver===_c&&(h=new oo(">=0.0.0")),f=f||h,d=d||h,s(h.semver,f.semver,i)?f=h:o(h.semver,d.semver,i)&&(d=h)}),f.operator===a||f.operator===u||(!d.operator||d.operator===a)&&n(r,d.semver))return!1;if(d.operator===u&&o(r,d.semver))return!1}return!0};uo.exports=Lc});var lo=p((up,ao)=>{"use strict";var Bc=Ft(),Nc=(r,e,t)=>Bc(r,e,">",t);ao.exports=Nc});var ho=p((ap,co)=>{"use strict";var qc=Ft(),Pc=(r,e,t)=>qc(r,e,"<",t);co.exports=Pc});var po=p((lp,Do)=>{"use strict";var fo=G(),kc=(r,e,t)=>(r=new fo(r,t),e=new fo(e,t),r.intersects(e,t));Do.exports=kc});var go=p((cp,mo)=>{"use strict";var jc=He(),Mc=U();mo.exports=(r,e,t)=>{let i=[],s=null,n=null,o=r.sort((c,f)=>Mc(c,f,t));for(let c of o)jc(c,e,t)?(n=c,s||(s=c)):(n&&i.push([s,n]),n=null,s=null);s&&i.push([s,null]);let a=[];for(let[c,f]of i)c===f?a.push(c):!f&&c===o[0]?a.push("*"):f?c===o[0]?a.push(`<=${f}`):a.push(`${c} - ${f}`):a.push(`>=${c}`);let u=a.join(" || "),l=typeof e.raw=="string"?e.raw:String(e);return u.length<l.length?u:e}});var wo=p((hp,yo)=>{"use strict";var Eo=G(),Sr=je(),{ANY:Or}=Sr,Rr=He(),_r=U(),Hc=(r,e,t={})=>{if(r===e)return!0;r=new Eo(r,t),e=new Eo(e,t);let i=!1;e:for(let s of r.set){for(let n of e.set){let o=Uc(s,n,t);if(i=i||o!==null,o)continue e}if(i)return!1}return!0},Vc=[new Sr(">=0.0.0-0")],Co=[new Sr(">=0.0.0")],Uc=(r,e,t)=>{if(r===e)return!0;if(r.length===1&&r[0].semver===Or){if(e.length===1&&e[0].semver===Or)return!0;t.includePrerelease?r=Vc:r=Co}if(e.length===1&&e[0].semver===Or){if(t.includePrerelease)return!0;e=Co}let i=new Set,s,n;for(let h of r)h.operator===">"||h.operator===">="?s=bo(s,h,t):h.operator==="<"||h.operator==="<="?n=Fo(n,h,t):i.add(h.semver);if(i.size>1)return null;let o;if(s&&n){if(o=_r(s.semver,n.semver,t),o>0)return null;if(o===0&&(s.operator!==">="||n.operator!=="<="))return null}for(let h of i){if(s&&!Rr(h,String(s),t)||n&&!Rr(h,String(n),t))return null;for(let D of e)if(!Rr(h,String(D),t))return!1;return!0}let a,u,l,c,f=n&&!t.includePrerelease&&n.semver.prerelease.length?n.semver:!1,d=s&&!t.includePrerelease&&s.semver.prerelease.length?s.semver:!1;f&&f.prerelease.length===1&&n.operator==="<"&&f.prerelease[0]===0&&(f=!1);for(let h of e){if(c=c||h.operator===">"||h.operator===">=",l=l||h.operator==="<"||h.operator==="<=",s){if(d&&h.semver.prerelease&&h.semver.prerelease.length&&h.semver.major===d.major&&h.semver.minor===d.minor&&h.semver.patch===d.patch&&(d=!1),h.operator===">"||h.operator===">="){if(a=bo(s,h,t),a===h&&a!==s)return!1}else if(s.operator===">="&&!h.test(s.semver))return!1}if(n){if(f&&h.semver.prerelease&&h.semver.prerelease.length&&h.semver.major===f.major&&h.semver.minor===f.minor&&h.semver.patch===f.patch&&(f=!1),h.operator==="<"||h.operator==="<="){if(u=Fo(n,h,t),u===h&&u!==n)return!1}else if(n.operator==="<="&&!h.test(n.semver))return!1}if(!h.operator&&(n||s)&&o!==0)return!1}return!(s&&l&&!n&&o!==0||n&&c&&!s&&o!==0||d||f)},bo=(r,e,t)=>{if(!r)return e;let i=_r(r.semver,e.semver,t);return i>0?r:i<0||e.operator===">"&&r.operator===">="?e:r},Fo=(r,e,t)=>{if(!r)return e;let i=_r(r.semver,e.semver,t);return i<0?r:i>0||e.operator==="<"&&r.operator==="<="?e:r};yo.exports=Hc});var Ro=p((fp,Oo)=>{"use strict";var $r=be(),xo=Ce(),Gc=_(),Ao=Dr(),Wc=se(),zc=zs(),Xc=Ks(),Kc=Zs(),Jc=tn(),Yc=sn(),Zc=on(),Qc=an(),eh=cn(),th=U(),rh=dn(),ih=mn(),sh=pt(),nh=bn(),oh=yn(),uh=ke(),ah=mt(),lh=mr(),ch=gr(),hh=gt(),fh=Et(),Dh=Er(),dh=Tn(),ph=vn(),mh=je(),gh=G(),Eh=He(),Ch=Xn(),bh=Jn(),Fh=Zn(),yh=to(),wh=io(),xh=Ft(),Ah=lo(),Oh=ho(),Rh=po(),Sh=go(),_h=wo();Oo.exports={parse:Wc,valid:zc,clean:Xc,inc:Kc,diff:Jc,major:Yc,minor:Zc,patch:Qc,prerelease:eh,compare:th,rcompare:rh,compareLoose:ih,compareBuild:sh,sort:nh,rsort:oh,gt:uh,lt:ah,eq:lh,neq:ch,gte:hh,lte:fh,cmp:Dh,coerce:dh,truncate:ph,Comparator:mh,Range:gh,satisfies:Eh,toComparators:Ch,maxSatisfying:bh,minSatisfying:Fh,minVersion:yh,validRange:wh,outside:xh,gtr:Ah,ltr:Oh,intersects:Rh,simplifyRange:Sh,subset:_h,SemVer:Gc,re:$r.re,src:$r.src,tokens:$r.t,SEMVER_SPEC_VERSION:xo.SEMVER_SPEC_VERSION,RELEASE_TYPES:xo.RELEASE_TYPES,compareIdentifiers:Ao.compareIdentifiers,rcompareIdentifiers:Ao.rcompareIdentifiers}});var Gr=le(Ur(),1),{program:Cf,createCommand:bf,createArgument:Ff,createOption:yf,CommanderError:wf,InvalidArgumentError:xf,InvalidOptionArgumentError:Af,Command:Wr,Argument:Of,Option:Rf,Help:Sf}=Gr.default;var ce=require("node:fs/promises"),Ae=le(require("node:path"),1),jt=le(require("node:os"),1);async function Oe({configPath:r=zr()}={}){try{return JSON.parse(await(0,ce.readFile)(r,"utf8"))}catch(e){if(e.code==="ENOENT")return{};throw e}}async function Mt(r,{configPath:e=zr()}={}){await(0,ce.mkdir)(Ae.default.dirname(e),{recursive:!0}),await(0,ce.writeFile)(e,`${JSON.stringify(r,null,2)}
30
+ `,{encoding:"utf8",mode:384})}function zr(r=process.env,e=process.platform){if(r.ENGAGELAB_EMAIL_CONFIG)return r.ENGAGELAB_EMAIL_CONFIG;let t=r.XDG_CONFIG_HOME||(e==="win32"?r.APPDATA||Ae.default.join(jt.default.homedir(),"AppData","Roaming"):Ae.default.join(jt.default.homedir(),".config"));return Ae.default.join(t,"engagelab-email-cli","config.json")}function Xr(r){return r?`${r.slice(0,7)}****`:""}var P=class extends Error{constructor(e,{code:t="cli_error",exitCode:i=1,status:s,data:n,cause:o,errorCode:a}={}){super(e,{cause:o}),this.name="CliError",this.code=t,this.exitCode=i,this.status=s,this.data=n,this.errorCode=a}};function Ht(r,e){return r===100101||e===401||e===403?2:r===100201||e===404?3:r===100202||r===100203||r===100303||e===409?4:5}function Ge(r){let e=r?.errorCode??r?.data?.code,t=r?.message||"Command failed";return e!==void 0?`[${e}] ${t}`:t}function Kr(r){return r instanceof P?r:new P(r?.message||"Command failed",{code:"unknown_error",exitCode:5,cause:r})}function S(r){return new P(r,{code:"validation_error",exitCode:1})}function We(r){return new P(r,{code:"config_error",exitCode:1})}var Qr=le(Zr(),1),v=(0,Qr.createColors)(!process.env.NO_COLOR);var w={start(r){return`${v.cyan(">>")} ${r}`},success(r){return`${v.green("OK")} ${r}`},failure(r){return`${v.red("X")} ${r}`},warning(r){return`${v.yellow("Warning:")} ${r}`},label(r){return v.cyan(r)},heading(r){return v.bold(r)},muted(r){return v.dim(r)},command(r){return v.bold(r)},empty(r){return v.dim(r)},tableHeader(r){return ei(r)},tableCell(r){return ei(r)},listenMessage({time:r,route:e,subject:t,id:i}){return[v.dim(`[${r}]`),v.cyan(e),v.bold(v.yellow(`"${t}"`)),i?v.dim(String(i)):null].filter(Boolean).join(" ")}};function ei(r){return Array.isArray(r)?r.join(", "):r==null?"":String(r)}function ti(r){let e=r.command("config").description("Manage local EngageLab Email CLI config");e.command("set").description("Save local CLI configuration").option("--base-url <url>","EngageLab Email API base URL").option("--secret-key <key>","EngageLab Email Secret Key").action(async(t,i)=>{if(t={...i.optsWithGlobals(),...t},!t.baseUrl&&!t.secretKey)throw S("Provide at least one of --base-url or --secret-key");if(t.secretKey&&!t.secretKey.startsWith("sk_"))throw S("Secret Key must start with sk_");let s=await Oe();await Mt({...s,...du(t)}),process.stdout.write(`${w.success("Config saved")}
31
+ `)}),e.command("list").description("Show local CLI configuration").action(async()=>{let t=await Oe();process.stdout.write(`${w.label("baseUrl")}: ${t.baseUrl||""}
32
+ `),process.stdout.write(`${w.label("secretKey")}: ${Xr(t.secretKey)}
33
+ `)}),e.command("clear").description("Clear local CLI configuration").action(async()=>{await Mt({}),process.stdout.write(`${w.success("Config cleared")}
34
+ `)})}function du(r){return Object.fromEntries(Object.entries(r).filter(([,e])=>e!==void 0))}var ii=require("node:fs/promises"),Ke=require("node:path");var pu=10,mu=10*1024*1024,si=[["text","textFile"],["html","htmlFile"]];async function Ut(r={},{readFile:e=ii.readFile}={}){gu(r);let t={};for(let[i,s]of Object.entries(r))i.endsWith("File")||i==="attachment"||s===void 0||(t[i]=s);for(let[i,s]of si)r[s]&&(t[i]=await e(r[s],"utf8"));return r.attachment&&(t.attachments=await Eu(r.attachment,{readFile:e})),t}function gu(r){for(let[e,t]of si)if(r[e]&&r[t])throw S(`--${ri(e)} and --${ri(t)} are mutually exclusive`)}async function Eu(r,{readFile:e}){let t=Array.isArray(r)?r:[r];if(t.length>pu)throw S("Attachments cannot exceed 10 files.");let i=await Promise.all(t.map(async n=>{let o=await e(n);return{filePath:n,content:o}}));if(i.reduce((n,o)=>n+o.content.byteLength,0)>mu)throw S("Attachments total size cannot exceed 10MB.");return i.map(({filePath:n,content:o})=>{let a=(0,Ke.basename)(n),u=Cu(a);return{filename:a,contentType:u,type:u,content:Buffer.from(o).toString("base64")}})}function Cu(r){switch((0,Ke.extname)(r).toLowerCase()){case".txt":return"text/plain";case".html":case".htm":return"text/html";case".json":return"application/json";case".pdf":return"application/pdf";case".csv":return"text/csv";case".png":return"image/png";case".jpg":case".jpeg":return"image/jpeg";case".gif":return"image/gif";case".svg":return"image/svg+xml";case".zip":return"application/zip";default:return"application/octet-stream"}}function ri(r){return r.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function L(r){let e=Number.parseInt(r,10);if(!Number.isInteger(e)||e<=0)throw S("Expected a positive integer");return e}function Re(r){let e=Number.parseInt(r,10);if(!Number.isInteger(e)||e<0)throw S("Expected a non-negative integer");return e}function J(r,e=[]){return[...e,r]}function ni(r){return Object.fromEntries(Object.entries(r).filter(([,e])=>e!=null&&e!==""))}function he(r,e){if(r==null||r==="")throw S(e);return r}var us=le(os(),1);function et(r,e){if(!r||r.length===0)return w.empty("No results");let t=new us.default({head:e.map(i=>w.tableHeader(i.header)),style:{border:[],head:[]},chars:{top:"\u2500","top-mid":"\u252C","top-left":"\u250C","top-right":"\u2510",bottom:"\u2500","bottom-mid":"\u2534","bottom-left":"\u2514","bottom-right":"\u2518",left:"\u2502","left-mid":"\u251C",mid:"\u2500","mid-mid":"\u253C",right:"\u2502","right-mid":"\u2524",middle:"\u2502"}});return t.push(...r.map(i=>e.map((s,n)=>w.tableCell(s.value(i),n)))),t.toString()}function as(r){return et(r.data?.list||[],[{header:"Thread ID",value:e=>e.threadId},{header:"Subject",value:e=>e.subject},{header:"Participants",value:e=>e.participants},{header:"Last Message",value:e=>e.lastMessageAt},{header:"Count",value:e=>e.messageCount}])}function ls(r){return et(r.data?.list||[],[{header:"Mailbox ID",value:e=>e.mailboxId},{header:"Address",value:e=>e.address||e.emailAddress},{header:"Domain",value:e=>e.domain},{header:"Forward",value:e=>e.transferAddress||e.forwardEmail||e.forwardUrl||"-"},{header:"Updated",value:e=>e.updateTime}])}function tt(r){return et(r.data?.list||r.data||[],[{header:"Message UID",value:e=>e.messageUid},{header:"Thread ID",value:e=>e.threadId},{header:"From",value:e=>e.fromEmail||e.envelopeFrom},{header:"Subject",value:e=>e.subject},{header:"Received",value:e=>e.receivedAt}])}function rt(r){return JSON.stringify(r.data??r,null,2)}function tr(r){let e=r.data||{};return[w.success(w.heading("Sent")),e.messageUid?`${w.label("messageUid")}: ${e.messageUid}`:null,e.requestId?`${w.label("requestId")}: ${e.requestId}`:null,e.emailIds?`${w.label("emailIds")}: ${e.emailIds.join(", ")}`:null].filter(Boolean).join(`
35
+ `)}function ia(r,{httpStatus:e}={}){if(!r||typeof r!="object"||typeof r.code!="number")throw new P("Invalid server response format",{code:"invalid_response",exitCode:5,status:e,data:r});if(r.code!==0)throw new P(r.message||"Request failed",{code:cs(r.code),exitCode:Ht(r.code,e),status:r.code,errorCode:r.code,data:r});return r}async function j(r){let e;try{e=await r.json()}catch(t){throw new P("Invalid server response format",{code:"invalid_response",exitCode:5,status:r.status,cause:t})}if(r.status<200||r.status>=300)throw new P(e?.message||`Request failed with status code ${r.status}`,{code:cs(e?.code??r.status),exitCode:Ht(e?.code,r.status),status:r.status,errorCode:e?.code,data:e});return ia(e,{httpStatus:r.status})}function cs(r){return r===100101||r===401||r===403?"auth_error":r===100201||r===404?"not_found":r===100202||r===100203||r===100303||r===409?"state_conflict":r===100301||r===400?"validation_error":"server_error"}var Z=class extends Error{name="KyError";get isKyError(){return!0}};var de=class extends Z{name="HTTPError";response;request;options;data;constructor(e,t,i){let s=e.status||e.status===0?e.status:"",n=e.statusText??"",o=`${s} ${n}`.trim(),a=o?`status code ${o}`:"an unknown error";super(`Request failed with ${a}: ${t.method} ${t.url}`),this.response=e,this.request=t,this.options=i}};var pe=class extends Z{name="NetworkError";request;constructor(e,t){super(`Request failed due to a network error: ${e.method} ${e.url}`,t),this.request=e}};var me=class extends Error{name="NonError";value;constructor(e){let t="Non-error value was thrown";try{typeof e=="string"?t=e:e&&typeof e=="object"&&"message"in e&&typeof e.message=="string"&&(t=e.message)}catch{}super(t),this.value=e}};var oe=class extends Z{name="ForceRetryError";customDelay;code;customRequest;constructor(e){let t=e?.cause?e.cause instanceof Error?e.cause:new me(e.cause):void 0;super(e?.code?`Forced retry: ${e.code}`:"Forced retry",t?{cause:t}:void 0),this.customDelay=e?.delay,this.code=e?.code,this.customRequest=e?.request}};var it=class extends Error{name="SchemaValidationError";issues;constructor(e){super("Response schema validation failed"),this.issues=e}};var V=class extends Z{name="TimeoutError";request;constructor(e){super(`Request timed out: ${e.method} ${e.url}`),this.request=e}};var rr=(()=>{let r=!1,e=!1,t=typeof globalThis.ReadableStream=="function",i=typeof globalThis.Request=="function";if(t&&i)try{e=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return r=!0,"half"}}).headers.has("Content-Type")}catch(s){if(s instanceof Error&&s.message==="unsupported BodyInit type")return!1;throw s}return r&&!e})(),hs=typeof globalThis.AbortController=="function",st=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",fs=typeof globalThis.ReadableStream=="function",Ds=typeof globalThis.FormData=="function",nt=["get","post","put","patch","head","delete"],sa=()=>{};sa();var ds={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},ge=2147483647,ps=40,ot=Symbol("stop"),Ie=class{options;constructor(e){this.options=e}},ms=r=>new Ie(r),gs={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,baseUrl:!0,prefix:!0,retry:!0,timeout:!0,totalTimeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},Es={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0};var ut=new TextEncoder,na=r=>{if(!r)return 0;if(r instanceof FormData){let e=0;for(let[t,i]of r)e+=ps,e+=ut.encode(`Content-Disposition: form-data; name="${t}"`).byteLength,e+=typeof i=="string"?ut.encode(i).byteLength:i.size;return e}return r instanceof Blob?r.size:r instanceof ArrayBuffer||ArrayBuffer.isView(r)?r.byteLength:typeof r=="string"?ut.encode(r).byteLength:r instanceof URLSearchParams?ut.encode(r.toString()).byteLength:0},Cs=(r,e,t)=>{let i,s=0;return r.pipeThrough(new TransformStream({transform(n,o){if(o.enqueue(n),i){s+=i.byteLength;let a=e===0?0:s/e;a>=1&&(a=1-Number.EPSILON),t?.({percent:a,totalBytes:Math.max(e,s),transferredBytes:s},i)}i=n},flush(){i&&(s+=i.byteLength,t?.({percent:1,totalBytes:Math.max(e,s),transferredBytes:s},i))}}))},bs=(r,e)=>{if(!r.body)return r;let t={status:r.status,statusText:r.statusText,headers:r.headers};if(r.status===204)return new Response(null,t);let i=Math.max(0,Number(r.headers.get("content-length"))||0);return new Response(Cs(r.body,i,e),t)},Fs=(r,e,t)=>{if(!r.body)return r;let i=na(t??r.body);return new Request(r,{duplex:"half",body:Cs(r.body,i,e)})};var Q=r=>r!==null&&typeof r=="object";var oa=Symbol("replaceOption"),ir=r=>Q(r)&&r[oa]===!0?{isReplace:!0,value:r.value}:{isReplace:!1,value:r};var Le=(...r)=>{for(let e of r)if((!Q(e)||Array.isArray(e))&&e!==void 0)throw new TypeError("The `options` argument must be an object");return or({},...r)},nr=(r={},e={})=>{let t=new globalThis.Headers(r),i=e instanceof globalThis.Headers,s=new globalThis.Headers(e);for(let[n,o]of s.entries())i&&o==="undefined"||o===void 0?t.delete(n):t.set(n,o);return t},sr=r=>{if(!Q(r)||Array.isArray(r))return!1;let e=Object.getPrototypeOf(r);return e===Object.prototype||e===null},Ee=r=>{if(r instanceof URLSearchParams){let e=new URLSearchParams(r),t=r[ie];return t&&(e[ie]=new Set(t)),e}return r instanceof globalThis.Headers?new globalThis.Headers(r):Array.isArray(r)?[...r]:sr(r)?{...r}:r},ua=r=>Object.fromEntries(Object.entries(r).filter(e=>e[1]!==void 0)),aa=(r,e)=>sr(r)&&sr(e)?ua({...r,...e}):nr(r,e);function ve(r,e,t){return Object.hasOwn(e,t)&&e[t]===void 0?[]:or(r[t]??[],e[t]??[])}var at=(r={},e={})=>({init:ve(r,e,"init"),beforeRequest:ve(r,e,"beforeRequest"),beforeRetry:ve(r,e,"beforeRetry"),beforeError:ve(r,e,"beforeError"),afterResponse:ve(r,e,"afterResponse")}),ie=Symbol("deletedParameters"),la=(r,e)=>{let t=new URLSearchParams,i=new Set;for(let s of[r,e])if(s!==void 0)if(s instanceof URLSearchParams){for(let[o,a]of s.entries())t.append(o,a),i.delete(o);let n=s[ie];if(n)for(let o of n)t.delete(o),i.add(o)}else if(Array.isArray(s))for(let n of s){if(!Array.isArray(n)||n.length!==2)throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");t.append(String(n[0]),String(n[1])),i.delete(String(n[0]))}else if(Q(s))for(let[n,o]of Object.entries(s))o===void 0?(t.delete(n),i.add(n)):(t.append(n,String(o)),i.delete(n));else{let n=new URLSearchParams(s);for(let[o,a]of n.entries())t.append(o,a),i.delete(o)}return i.size>0&&(t[ie]=i),t},or=(...r)=>{let e={},t={},i={},s,n=[];for(let o of r)if(Array.isArray(o))Array.isArray(e)||(e=[]),e=[...e,...o];else if(Q(o)){for(let[a,u]of Object.entries(o)){if(a==="signal"&&u instanceof globalThis.AbortSignal){n.push(u);continue}let l=ir(u),{isReplace:c}=l;if(u=l.value,a==="context"){if(u!=null&&(!Q(u)||Array.isArray(u)))throw new TypeError("The `context` option must be an object");e={...e,context:u==null?{}:c?{...u}:{...e.context,...u}};continue}if(a==="searchParams"){u==null?s=void 0:c?s=u:s=s===void 0?u:la(s,u);continue}Q(u)&&!c&&a in e&&(u=or(e[a],u)),e={...e,[a]:u}}if(Q(o.hooks)){let{value:a,isReplace:u}=ir(o.hooks);i=at(u?{}:i,a),e.hooks=i}if(Q(o.headers)){let{value:a,isReplace:u}=ir(o.headers);t=u?Ee(a):aa(t,a),e.headers=t}}return s!==void 0&&(e.searchParams=s),n.length>0&&(n.length===1?e.signal=n[0]:st?e.signal=AbortSignal.any(n):e.signal=n.at(-1)),e};var ws=r=>nt.includes(r)?r.toUpperCase():r,ca=["get","put","head","delete","options","trace"],ha=[408,413,429,500,502,503,504],fa=[413,429,503],ys={limit:2,methods:ca,statusCodes:ha,afterStatusCodes:fa,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:r=>.3*2**(r-1)*1e3,jitter:void 0,retryOnTimeout:!1},xs=(r={})=>{if(typeof r=="number")return{...ys,limit:r};if(r.methods&&!Array.isArray(r.methods))throw new Error("retry.methods must be an array");if(r.statusCodes&&!Array.isArray(r.statusCodes))throw new Error("retry.statusCodes must be an array");let e=Object.fromEntries(Object.entries({...r,methods:r.methods?.map(t=>t.toLowerCase())}).filter(([,t])=>t!==void 0));return{...ys,...e}};async function ur(r,e,t,i){return new Promise((s,n)=>{let o=setTimeout(()=>{t&&t.abort(),n(new V(r))},i.timeout);i.fetch(r,e).then(s).catch(n).then(()=>{clearTimeout(o)})})}async function lt(r,{signal:e}){return new Promise((t,i)=>{e&&(e.throwIfAborted(),e.addEventListener("abort",s,{once:!0}));function s(){clearTimeout(n),i(e.reason)}let n=setTimeout(()=>{e?.removeEventListener("abort",s),t()},r)})}var As=r=>{let e={};for(let t in r)Object.hasOwn(r,t)&&!(t in Es)&&!(t in gs)&&(e[t]=r[t]);return e},Os=r=>r===void 0?!1:Array.isArray(r)?r.length>0:r instanceof URLSearchParams?r.size>0||!!r[ie]?.size:typeof r=="object"?Object.keys(r).length>0:typeof r=="string"?r.trim().length>0:!!r;var Da=Object.prototype.toString,da=r=>Da.call(r)==="[object Error]",pa=new Set(["network error","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]);function ar(r){if(!(r&&da(r)&&r.name==="TypeError"&&typeof r.message=="string"))return!1;let{message:t,stack:i}=r;return t==="Load failed"?i===void 0||"__sentry_captured__"in r:t.startsWith("error sending request for url")||t==="Failed to fetch"||t.startsWith("Failed to fetch (")&&t.endsWith(")")?!0:pa.has(t)}var lr=(r,e)=>r instanceof e||r?.name===e.name;function Rs(r){return lr(r,de)}function Ss(r){return lr(r,pe)}function _s(r){return lr(r,V)}var ma=10*1024*1024,ga="The `prefixUrl` option has been renamed `prefix` in v2 and enhanced to allow slashes in input. See also the new `baseUrl` option for improved flexibility with standard URL resolution: https://github.com/sindresorhus/ky#baseurl",Be=Symbol("timedOutResponseData"),Ea=r=>{let e=/;\s*charset\s*=\s*(?:"([^"]+)"|([^;,\s]+))/i.exec(r),t=e?.[1]??e?.[2];if(t)try{return new TextDecoder(t)}catch{}return new TextDecoder},$s="The `schema` argument must follow the Standard Schema specification",Ca=r=>typeof r!="object"?r:{...r,...r.methods&&{methods:[...r.methods]},...r.statusCodes&&{statusCodes:[...r.statusCodes]},...r.afterStatusCodes&&{afterStatusCodes:[...r.afterStatusCodes]}},vs=Object.prototype.toString,Ts=r=>r instanceof globalThis.Request||vs.call(r)==="[object Request]",Ne=r=>r instanceof globalThis.Response||vs.call(r)==="[object Response]",ba=r=>Array.isArray(r)?r.map(e=>[...e]):Ee(r);function Fa(r){let e={...r,json:Ee(r.json),context:Ee(r.context),headers:Ee(r.headers),searchParams:ba(r.searchParams)};return r.retry!==void 0&&(e.retry=Ca(r.retry)),e}var Is=async(r,e)=>{if(typeof e!="object"&&typeof e!="function"||e===null)throw new TypeError($s);let t=e["~standard"];if(typeof t!="object"||t===null||typeof t.validate!="function")throw new TypeError($s);let i=await t.validate(r);if(i.issues)throw new it(i.issues);return i.value},qe=class r{static create(e,t){let i=t.hooks?.init??[],s=i.length>0?Fa(t):t;for(let u of i)u(s);let n=new r(e,s),o=async()=>{if(typeof n.#e.timeout=="number"&&n.#e.timeout>ge)throw new RangeError(`The \`timeout\` option cannot be greater than ${ge}`);if(typeof n.#e.totalTimeout=="number"&&n.#e.totalTimeout>ge)throw new RangeError(`The \`totalTimeout\` option cannot be greater than ${ge}`);await Promise.resolve();let u=await n.#L(),l=u??await n.#O(async()=>n.#g()),c=u!==void 0||n.#m();for(;;){if(l===void 0)return l;if(Ne(l))try{l=await n.#B(l)}catch(d){if(!(d instanceof oe))throw d;let h=await n.#p(d,async()=>n.#g());if(h===void 0)return h;l=h,c=n.#m();continue}let f=l;if(!f.ok&&f.type!=="opaque"&&(typeof n.#e.throwHttpErrors=="function"?n.#e.throwHttpErrors(f.status):n.#e.throwHttpErrors)){let d=new de(f,n.#u(f),n.#o()),h=d;if(d.data=await n.#$(f),c)throw h;let D=await n.#p(d,async()=>n.#g());if(D===void 0)return D;l=D,c=n.#m();continue}break}if(!Ne(l))return l;if(n.#w(l),n.#e.onDownloadProgress){if(typeof n.#e.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!fs)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");let f=l.clone();return n.#i(l),bs(f,n.#e.onDownloadProgress)}return l},a=(async()=>{try{return await o()}catch(u){if(!(u instanceof Error)||n.#F.has(u))throw u;let l=u;for(let c of n.#e.hooks.beforeError){let f=await c({request:n.request,options:n.#o(),error:l,retryCount:n.#r});f instanceof Error&&(l=f)}throw l}finally{let u=n.#b;n.#d(u?.body??void 0),n.request!==u&&n.#d(n.request.body??void 0)}})();for(let[u,l]of Object.entries(ds))u==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(a[u]=async c=>{n.request.headers.set("accept",n.request.headers.get("accept")||l);let f=await a;if(u!=="json")return f[u]();let d=await f.text();if(d==="")return c!==void 0?Is(void 0,c):JSON.parse(d);let h=s.parseJson?await s.parseJson(d,{request:n.#u(f),response:f}):JSON.parse(d);return c===void 0?h:Is(h,c)});return a}static#S(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof URLSearchParams)?Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0)):e}request;#s;#r=0;#t;#e;#b;#a;#F=new WeakSet;#l;#D;#c=!1;#y=new WeakMap;constructor(e,t={}){if(this.#t=e,Object.hasOwn(t,"prefixUrl"))throw new Error(ga);if(this.#e={...t,headers:nr(this.#t.headers,t.headers),hooks:at({},t.hooks),method:ws(t.method??this.#t.method??"GET"),prefix:String(t.prefix||""),retry:xs(t.retry),throwHttpErrors:t.throwHttpErrors??!0,timeout:t.timeout??1e4,totalTimeout:t.totalTimeout??!1,fetch:t.fetch??globalThis.fetch.bind(globalThis),context:t.context??{}},typeof this.#t!="string"&&!(this.#t instanceof URL||this.#t instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(typeof this.#t=="string"){if(this.#e.prefix){let s=this.#e.prefix.replace(/\/+$/,""),n=this.#t.replace(/^\/+/,"");this.#t=`${s}/${n}`}if(this.#e.baseUrl){let s;try{s=new URL(this.#t)}catch{}s||(this.#t=new URL(this.#t,new Request(this.#e.baseUrl).url))}}hs&&st&&(this.#a=this.#e.signal??this.#t.signal,this.#s=new globalThis.AbortController,this.#e.signal=this.#A()),rr&&(this.#e.duplex="half"),this.#e.json!==void 0&&(this.#e.body=this.#e.stringifyJson?.(this.#e.json)??JSON.stringify(this.#e.json),this.#e.headers.set("content-type",this.#e.headers.get("content-type")??"application/json"));let i=t.headers&&new globalThis.Headers(t.headers).has("content-type");if(this.#t instanceof globalThis.Request&&(Ds&&this.#e.body instanceof globalThis.FormData||this.#e.body instanceof URLSearchParams)&&!i&&this.#e.headers.delete("content-type"),this.request=new globalThis.Request(this.#t,this.#e),Os(this.#e.searchParams)){let s=new URL(this.request.url),n=this.#e.searchParams?.[ie];if(n)for(let o of n)s.searchParams.delete(o);if(typeof this.#e.searchParams=="string"){let o=this.#e.searchParams.replace(/^\?/,"");o!==""&&(s.search=s.search?`${s.search}&${o}`:`?${o}`)}else{let o=new URLSearchParams(r.#S(this.#e.searchParams));for(let[a,u]of o.entries())s.searchParams.append(a,u)}if(this.#e.searchParams&&typeof this.#e.searchParams=="object"&&!Array.isArray(this.#e.searchParams)&&!(this.#e.searchParams instanceof URLSearchParams))for(let[o,a]of Object.entries(this.#e.searchParams))a===void 0&&s.searchParams.delete(o);this.request=new globalThis.Request(s,this.#e)}if(this.#e.onUploadProgress&&typeof this.#e.onUploadProgress!="function")throw new TypeError("The `onUploadProgress` option must be a function");this.#D=typeof this.#e.totalTimeout=="number"?this.#R():void 0}#n(){let e=this.#e.retry.delay(this.#r+1),t=e;return this.#e.retry.jitter===!0?t=Math.random()*e:typeof this.#e.retry.jitter=="function"&&(t=this.#e.retry.jitter(e),(!Number.isFinite(t)||t<0)&&(t=e)),Math.min(this.#e.retry.backoffLimit,t)}async#_(e){if(this.#r>=this.#e.retry.limit)throw e;let t=e instanceof Error?e:new me(e);if(t instanceof oe)return t.customDelay??this.#n();if(!this.#e.retry.methods.includes(this.request.method.toLowerCase()))throw e;if(this.#e.retry.shouldRetry!==void 0){let i=await this.#e.retry.shouldRetry({error:t,retryCount:this.#r+1});if(i===!1)throw e;if(i===!0)return this.#n()}if(_s(e)){if(!this.#e.retry.retryOnTimeout)throw e;return this.#n()}if(Rs(e)){if(!this.#e.retry.statusCodes.includes(e.response.status))throw e;let i=e.response.headers.get("Retry-After")??e.response.headers.get("RateLimit-Reset")??e.response.headers.get("X-RateLimit-Retry-After")??e.response.headers.get("X-RateLimit-Reset")??e.response.headers.get("X-Rate-Limit-Reset");if(i&&this.#e.retry.afterStatusCodes.includes(e.response.status)){let s=Number(i)*1e3;return Number.isNaN(s)?s=Date.parse(i)-Date.now():s>=Date.parse("2024-01-01")&&(s-=Date.now()),Number.isFinite(s)?(s=Math.max(0,s),Math.min(this.#e.retry.maxRetryAfter,s)):Math.min(this.#e.retry.maxRetryAfter,this.#n())}if(e.response.status===413)throw e;return this.#n()}if(!Ss(e))throw e;return this.#n()}#w(e){let t=this.#u(e);return this.#e.parseJson&&(e.json=async()=>{let i=await e.text();return i===""?JSON.parse(i):this.#e.parseJson(i,{request:t,response:e})}),e}async#$(e){let t=await this.#I(e,this.#x());if(t===Be){this.#h();return}if(!t)return;if(!this.#T(e.headers.get("content-type")??""))return t;let i=await this.#v(t,e,this.#x(),this.#u(e));if(i===Be){this.#h();return}return i}#x(){let e=this.#e.timeout===!1?1e4:this.#e.timeout,t=this.#f();if(t===void 0)return e;if(t<=0)throw new V(this.request);return Math.min(e,t)}#T(e){let t=(e.split(";",1)[0]??"").trim().toLowerCase();return/\/(?:.*[.+-])?json$/.test(t)}async#I(e,t){let{body:i}=e;if(!i)try{return await e.text()}catch{return}let s;try{s=i.getReader()}catch{return}let n=Ea(e.headers.get("content-type")??""),o=[],a=0,u=(async()=>{try{for(;;){let{done:f,value:d}=await s.read();if(f)break;if(a+=d.byteLength,a>ma){s.cancel().catch(()=>{});return}o.push(n.decode(d,{stream:!0}))}}catch{return}return o.push(n.decode()),o.join("")})(),l=new Promise(f=>{let d=setTimeout(()=>{f(Be)},t);u.finally(()=>{clearTimeout(d)})}),c=await Promise.race([u,l]);return c===Be&&s.cancel().catch(()=>{}),c}async#v(e,t,i,s){let n;try{return await Promise.race([Promise.resolve().then(()=>this.#e.parseJson?this.#e.parseJson(e,{request:s,response:t}):JSON.parse(e)),new Promise(o=>{n=setTimeout(()=>{o(Be)},i)})])}catch{return}finally{clearTimeout(n)}}#d(e){e&&e.cancel().catch(()=>{})}#i(e){this.#d(e.body??void 0)}#A(){return this.#a?AbortSignal.any([this.#a,this.#s.signal]):this.#s.signal}#h(){let e=this.#f();if(e!==void 0&&e<=0)throw new V(this.request)}async#L(){for(let e of this.#e.hooks.beforeRequest){let t=await e({request:this.request,options:this.#o(),retryCount:0});if(Ts(t))this.#E(t);else if(Ne(t))return t}}async#B(e){let t=this.#u(e);for(let i of this.#e.hooks.afterResponse){let s=this.#C(e.clone(),t);this.#w(s);let n;try{n=await i({request:this.request,options:this.#o(),response:s,retryCount:this.#r})}catch(a){throw s!==e&&this.#i(s),this.#i(e),a}if(n instanceof Ie)throw s!==e&&this.#i(s),this.#i(e),new oe(n.options);let o=Ne(n)?this.#C(n,t):e;s!==e&&s!==o&&s.body!==o.body&&this.#i(s),e!==o&&e.body!==o.body&&this.#i(e),e=o}return e}async#O(e){try{return await e()}catch(t){return this.#p(t,e)}}async#p(e,t){this.#c=!1;let i=Math.min(await this.#_(e),ge),s={signal:this.#a},n=this.#f();if(n!==void 0){if(n<=0)throw new V(this.request);if(i>=n)throw await lt(n,s),new V(this.request)}if(await lt(i,s),this.#h(),e instanceof oe&&e.customRequest){let o=new globalThis.Request(e.customRequest,this.#e.signal?{signal:this.#e.signal}:void 0);this.#E(o)}for(let o of this.#e.hooks.beforeRetry){let a;try{a=await o({request:this.request,options:this.#o(),error:e,retryCount:this.#r+1})}catch(u){throw u instanceof Error&&u!==e&&this.#F.add(u),u}if(Ts(a)){this.#E(a);break}if(Ne(a))return this.#c=!0,this.#r++,a;if(a===ot)return}return this.#h(),this.#r++,this.#O(t)}#m(){let e=this.#c;return this.#c=!1,e}async#g(){this.#s?.signal.aborted&&(this.#s=new globalThis.AbortController,this.#e.signal=this.#A(),this.request=new globalThis.Request(this.request,{signal:this.#e.signal}));let e=As(this.#e),t=this.#e.retry.limit>0?this.request.clone():void 0,i=this.#N(this.request,this.#e.body??void 0);this.#b=i,t&&(this.request=t);try{let s=this.#f();if(s!==void 0&&s<=0)throw new V(this.request);let n=this.#e.timeout===!1?s:s===void 0?this.#e.timeout:Math.min(this.#e.timeout,s),o=n===void 0?await this.#e.fetch(i,e):await ur(i,e,this.#s,{timeout:n,fetch:this.#e.fetch});return this.#C(o,i)}catch(s){throw ar(s)?new pe(this.request,{cause:s}):s}}#f(){if(this.#D===void 0)return;let e=this.#R()-this.#D;return Math.max(0,this.#e.totalTimeout-e)}#R(){return globalThis.performance?.now()??Date.now()}#o(){if(!this.#l){let{hooks:e,json:t,parseJson:i,stringifyJson:s,searchParams:n,timeout:o,totalTimeout:a,throwHttpErrors:u,fetch:l,...c}=this.#e;this.#l=Object.freeze(c)}return this.#l}#E(e){this.#l=void 0,this.request=e}#u(e){return this.#y.get(e)??this.request}#C(e,t){return this.#y.set(e,t),e}#N(e,t){return!this.#e.onUploadProgress||!e.body||!rr?e:Fs(e,this.#e.onUploadProgress,t??this.#e.body??void 0)}};var cr=r=>{let e=(t,i)=>qe.create(t,Le(r,i));for(let t of nt)e[t]=(i,s)=>qe.create(i,Le(r,s,{method:t}));return e.create=t=>cr(Le(t)),e.extend=t=>(typeof t=="function"&&(t=t(r??{})),cr(Le(r,t))),e.stop=ot,e.retry=ms,e},ya=cr(),Ls=ya;var yt=le(Ro(),1);var $h={sg:"https://www.engagelab.com",tr:"https://email-tr.engagelab.com"};async function So(r={}){let e=await Th(r);if(!e.baseUrl)throw We("Missing base URL. Set --base-url, ENGAGELAB_EMAIL_BASE_URL, or config set.");if(e.requireSecretKey&&!e.secretKey)throw We("Missing Secret Key. Set --secret-key, ENGAGELAB_EMAIL_SECRET_KEY, or config set.");if(e.requireSecretKey&&!e.secretKey.startsWith("sk_"))throw We("Secret Key must start with sk_");return{baseUrl:e.baseUrl,secretKey:e.secretKey}}async function Th({cliOptions:r={},env:e=process.env,readConfig:t=Oe,requireSecretKey:i=!0}={}){let s=await t(),n=Ih(r,e,s),o=vh(r,e,s,n.value);return{baseUrl:o.value,baseUrlSource:o.source,secretKey:n.value,secretKeySource:n.source,fileConfig:s,requireSecretKey:i}}function Ih(r,e,t){return r.secretKey?{value:r.secretKey,source:"cli"}:e.ENGAGELAB_EMAIL_SECRET_KEY?{value:e.ENGAGELAB_EMAIL_SECRET_KEY,source:"env"}:t.secretKey?{value:t.secretKey,source:"config"}:{value:void 0,source:"missing"}}function vh(r,e,t,i){if(r.baseUrl)return{value:r.baseUrl,source:"cli"};if(e.ENGAGELAB_EMAIL_BASE_URL)return{value:e.ENGAGELAB_EMAIL_BASE_URL,source:"env"};if(t.baseUrl)return{value:t.baseUrl,source:"config"};let s=Lh(i);return s?{value:s,source:"inferred"}:{value:void 0,source:"missing"}}function Lh(r){if(!r||!r.startsWith("sk_"))return;let[,e]=r.split("_");return $h[e?.toLowerCase()]}function Bh(r){return`npm install -g ${r}@latest`}function Nh(r){return{command:process.platform==="win32"?"npm.cmd":"npm",args:["install","-g",`${r}@latest`],display:Bh(r)}}async function _o({packageName:r,currentVersion:e,latestVersion:t,jsonMode:i}){let s=Nh(r),n={currentVersion:e,latestVersion:t,updateCommand:s.display};throw new P(qh(r,e,t,s.display),{code:"update_required",exitCode:1,data:n})}function qh(r,e,t,i){return[`A newer version of ${r} is required: ${e} -> ${t}`,`Please run: ${i}`].join(`
36
+ `)}var $o=require("node:fs"),To=require("node:path"),Ph="1.0.0",Fe=Ph??kh();function kh(){try{return JSON.parse((0,$o.readFileSync)((0,To.join)(process.cwd(),"package.json"),"utf8")).version||"0.0.0"}catch{return"0.0.0"}}var jh="/api/email/agent/v1",Io="engagelab-email-cli",Mh="https://registry.npmjs.org",Hh=1500;async function W(r){await Vh(r);let e=await So({cliOptions:r.optsWithGlobals()});return Ls.extend({prefix:vo(e.baseUrl),headers:{Authorization:`Bearer ${e.secretKey}`},timeout:3e4,throwHttpErrors:!1})}function M(r){return`${jh}${r}`}async function X(r,e,t){if(r.opts().json)return t();process.stderr.write(`${w.start(`Starting ${e}...`)}
37
+ `);try{let i=await t();return process.stderr.write(`${w.success(`Done ${e}`)}
38
+ `),i}catch(i){throw process.stderr.write(`${w.failure(`Failed ${e}`)}
39
+ `),i}}function K(r,e,t){r.opts().json&&r.parent?.parent?.stdout?.write?.("");let i=r.programOutput?.stdout||process.stdout;if(r.opts().json){i.write(`${JSON.stringify(e,null,2)}
40
+ `);return}i.write(`${t(e)}
41
+ `)}function ue(r,e){let t={};for(let[i,s=i]of Object.entries(e))t[s]=r[i];return ni(t)}function Tr(r,e){let t={};for(let i of e)r[i]!==void 0&&(t[i]=r[i]);return t}async function Vh(r){if(process.env.ENGAGELAB_EMAIL_CLI_DISABLE_UPDATE_CHECK)return;let e;try{let t=vo(process.env.ENGAGELAB_EMAIL_CLI_UPDATE_REGISTRY_URL||Mh),i=await fetch(`${t}/${Io}/latest`,{signal:AbortSignal.timeout(Hh),headers:{accept:"application/json"}});if(!i.ok)return;e=(await i.json()).version}catch{return}!e||!yt.default.valid(e)||!yt.default.valid(Fe)||yt.default.gt(e,Fe)&&await _o({packageName:Io,currentVersion:Fe,latestVersion:e,jsonMode:r.opts().json})}function vo(r){return r.endsWith("/")?r.slice(0,-1):r}var ae=class{constructor(e){this.client=e}listMessages(e={}){return this.client.get(M("/message/list"),{searchParams:e}).then(j)}getMessage(e){return this.client.get(M("/message/get"),{searchParams:{messageUid:e}}).then(j)}listenMessages(e={}){return this.client.get(M("/message/listen"),{searchParams:e}).then(j)}replyMessage(e,t){return this.client.post(M("/message/reply"),{searchParams:{messageUid:e},json:t}).then(j)}};var wt=class{constructor(e){this.client=e}sendEmail(e){return this.client.post(M("/mail/send"),{json:e}).then(j)}};var Uh=["mailboxId","from","to","cc","bcc","replyTo","subject","text","html","textFile","htmlFile","previewText","attachment","sandbox"],Gh=["subject","text","html","textFile","htmlFile","cc","bcc","replyTo","previewText","attachment","sandbox"],Wh=10,zh=5,Xh=2,Kh=5;function Lo(r){let e=r.command("emails").description("Work with email messages");Jh(e),Yh(e)}function Jh(r){r.command("send").description("Send a new email").option("--mailbox-id <id>","Mailbox ID",L).option("--from <email>","Sender email address").option("--to <email>","Recipient email address",J).option("--subject <text>","Email subject").option("--text <text>","Plain text body").option("--html <html>","HTML body").option("--text-file <path>","Read plain text body from file").option("--html-file <path>","Read HTML body from file").option("--cc <email>","CC address",J).option("--bcc <email>","BCC address",J).option("--reply-to <email>","Reply-To address",J).option("--preview-text <text>","Email preview text").option("--attachment <path>","Attach local file",J).option("--sandbox","Send in sandbox mode").option("--json","Output raw JSON").action(async(e,t)=>{let i=await Ut(Tr(e,Uh));Zh(i);let s=new wt(await W(t)),n=await X(t,"Sending email",()=>s.sendEmail(i));K(t,n,tr)})}function Yh(r){let e=r.command("receiving").description("Work with inbound email");e.command("list").description("List inbound messages").option("--mailbox-id <id>","Filter by mailbox ID",L).option("--keyword <text>","Search keyword").option("--page-no <number>","Page number",L).option("--page-size <number>","Page size",L).option("--json","Output raw JSON").action(async(t,i)=>{let s=new ae(await W(i)),n=ue(t,{mailboxId:"mailboxId",keyword:"keyword",pageNo:"pageNo",pageSize:"pageSize"}),o=await X(i,"Fetching inbound messages",()=>s.listMessages(n));K(i,o,tt)}),e.command("get").description("Get inbound message details").argument("<message-uid>","Message UID").option("--json","Output raw JSON").action(async(t,i,s)=>{he(t,"Message UID is required");let n=new ae(await W(s)),o=await X(s,"Fetching inbound message",()=>n.getMessage(t));K(s,o,rt)}),e.command("listen").description("Poll new inbound messages for Agent processing").option("--after <id>","Cursor ID from the previous result",Re).option("--limit <number>","Message limit",L).option("--interval <seconds>","Polling interval in seconds (minimum 2)",L).option("--json","Output raw JSON").action(async(t,i)=>{let s=new ae(await W(i));await ef(s,t,i)}),e.command("reply").description("Reply to an inbound message").argument("<message-uid>","Message UID").option("--subject <text>","Reply subject").option("--text <text>","Plain text body").option("--html <html>","HTML body").option("--text-file <path>","Read plain text body from file").option("--html-file <path>","Read HTML body from file").option("--cc <email>","CC address",J).option("--bcc <email>","BCC address",J).option("--reply-to <email>","Reply-To address",J).option("--preview-text <text>","Email preview text").option("--attachment <path>","Attach local file",J).option("--sandbox","Send in sandbox mode").option("--json","Output raw JSON").action(async(t,i,s)=>{he(t,"Message UID is required");let n=await Ut(Tr(i,Gh));Qh(n);let o=new ae(await W(s)),a=await X(s,"Sending reply",()=>o.replyMessage(t,n));K(s,a,tr)})}function Zh(r){if(!r.mailboxId)throw S("mailboxId is required");if(!Array.isArray(r.to)||r.to.length===0)throw S("At least one recipient is required");if(!r.subject)throw S("subject is required");Bo(r)}function Qh(r){Bo(r)}function Bo(r){if(!r.text&&!r.html)throw S("At least one of text or html is required")}async function ef(r,e,t){let i=process.stdout,s=process.stderr,n=!!e.json,o=e.limit??Wh,a=e.interval??zh;tf(a);let u=e.after,l=0,c,f=!1,d=()=>{f=!0,c&&clearTimeout(c),n||s.write(`
42
+ ${w.muted("Stopped listening.")}
43
+ `),process.exit(130)};process.once("SIGINT",d),process.once("SIGTERM",d),n||s.write(`${w.start("Connecting...")}
44
+ `),n||(s.write(`${w.success("Ready")}
45
+
46
+ `),s.write(`${w.heading("Polling:")} every ${a}s
47
+ `),s.write(`${w.muted("Listening for new inbound emails. Press Ctrl+C to stop.")}
48
+
49
+ `));let h=async()=>{if(!f)try{let D=u===void 0?{limit:o}:{after:u,limit:o},E=await r.listenMessages(D),C=rf(E);C.length>0&&(u=sf(C)??u,of(i,C,n)),l=0}catch(D){l+=1;let E=D instanceof Error?D.message:String(D);if(n?s.write(`${JSON.stringify({error:{code:"poll_error",message:E}})}
50
+ `):s.write(`${w.muted(`[${No()}]`)} ${w.warning(E)}
51
+ `),l>=Kh)throw S("Exiting after 5 consecutive API failures.")}finally{f||(c=setTimeout(()=>{h().catch(D=>{let E=D instanceof Error?D.message:String(D);s.write(`${w.failure(E)}
52
+ `),process.exit(5)})},a*1e3))}};c=setTimeout(()=>{h().catch(D=>{let E=D instanceof Error?D.message:String(D);s.write(`${w.failure(E)}
53
+ `),process.exit(5)})},a*1e3),await new Promise(()=>{})}function tf(r){if(!Number.isInteger(r)||r<Xh)throw S("Polling interval must be at least 2 seconds.")}function rf(r){return Array.isArray(r.data)?r.data:Array.isArray(r.data?.list)?r.data.list:[]}function sf(r){let e=r.map(nf).filter(i=>i!==void 0);if(e.length===0)return;let t=e.filter(Number.isFinite);if(t.length!==0)return Math.max(...t)}function nf(r){let e=[r.id,r.messageId];for(let t of e){if(typeof t=="number"&&Number.isFinite(t))return t;if(typeof t=="string"&&/^\d+$/.test(t))return Number(t)}}function of(r,e,t){if(t){for(let i of e)r.write(`${JSON.stringify(i)}
54
+ `);return}for(let i of e)r.write(`${uf(i)}
55
+ `)}function No(){return new Date().toLocaleTimeString("en-GB",{hour12:!1})}function uf(r){let e=r.fromEmail||r.envelopeFrom||"(unknown sender)",t=af(r.to||r.toEmail||r.recipients),i=lf(r.subject||"(no subject)",60),s=r.messageUid||r.id||"",n=t?`${e} -> ${t}`:e;return w.listenMessage({time:No(),route:n,subject:i,id:s})}function af(r){return Array.isArray(r)?r.join(", "):r||""}function lf(r,e){let t=String(r);return t.length<=e?t:`${t.slice(0,e-3)}...`}var xt=class{constructor(e){this.client=e}listMailboxes(e={}){return this.client.get(M("/mailbox/list"),{searchParams:e}).then(j)}};function qo(r){r.command("mailbox").description("Work with mailboxes").command("list").description("List mailboxes").option("--mailbox <address>","Filter by mailbox address").option("--page-no <number>","Page number",L).option("--page-size <number>","Page size",L).option("--json","Output raw JSON").action(async(t,i)=>{let s=new xt(await W(i)),n=ue(t,{mailbox:"mailbox",pageNo:"pageNo",pageSize:"pageSize"}),o=await X(i,"Fetching mailboxes",()=>s.listMailboxes(n));K(i,o,ls)})}var ye=class{constructor(e){this.client=e}listThreads(e={}){return this.client.get(M("/thread/list"),{searchParams:e}).then(j)}getThread(e){return this.client.get(M("/thread/get"),{searchParams:{threadId:e}}).then(j)}listThreadMessages(e,t={}){return this.client.get(M("/thread/messages"),{searchParams:{threadId:e,...t}}).then(j)}};function Po(r){let e=r.command("threads").description("Work with email threads");e.command("list").description("List threads").option("--mailbox-id <id>","Filter by mailbox ID",L).option("--subject <text>","Search normalized subject").option("--participant <email>","Search participant").option("--start-time <timestamp>","Latest message start timestamp in milliseconds",Re).option("--end-time <timestamp>","Latest message end timestamp in milliseconds",Re).option("--page-no <number>","Page number",L).option("--page-size <number>","Page size",L).option("--json","Output raw JSON").action(async(t,i)=>{let s=new ye(await W(i)),n=ue(t,{mailboxId:"mailboxId",subject:"subject",participant:"participant",startTime:"startTime",endTime:"endTime",pageNo:"pageNo",pageSize:"pageSize"}),o=await X(i,"Fetching threads",()=>s.listThreads(n));K(i,o,as)}),e.command("get").description("Get thread details").argument("<thread-id>","Thread ID").option("--json","Output raw JSON").action(async(t,i,s)=>{he(t,"Thread ID is required");let n=new ye(await W(s)),o=await X(s,"Fetching thread",()=>n.getThread(t));K(s,o,rt)}),e.command("messages").description("List messages in a thread").argument("<thread-id>","Thread ID").option("--limit <number>","Message limit",L).option("--include-content","Include text/html/headers/attachments").option("--json","Output raw JSON").action(async(t,i,s)=>{he(t,"Thread ID is required");let n=new ye(await W(s)),o=ue(i,{limit:"limit",includeContent:"includeContent"}),a=await X(s,"Fetching thread messages",()=>n.listThreadMessages(t,o));K(s,a,tt)})}function ko(r,e){let t={error:{code:e.code||"unknown_error",errorCode:e.errorCode??e.data?.code,message:e.message||"Command failed"}};e.data!==void 0&&(t.error.data=e.data),r.write(`${JSON.stringify(t,null,2)}
56
+ `)}function cf(r=new Wr){return r.name("engagelab-email-cli").description("CLI for EngageLab Email Agent workflows").version(Fe).option("-u, --base-url <url>","EngageLab Email API base URL",process.env.ENGAGELAB_EMAIL_BASE_URL).option("--secret-key <key>","EngageLab Email Secret Key",process.env.ENGAGELAB_EMAIL_SECRET_KEY),ti(r),qo(r),Po(r),Lo(r),r}async function jo(r=process.argv){let e=cf();try{await e.parseAsync(r)}catch(t){let i=Kr(t);if(i.data?.silent){process.exitCode=i.exitCode;return}r.includes("--json")?ko(process.stderr,i):process.stderr.write(`${w.failure(Ge(i))}
57
+ `),process.exitCode=i.exitCode}}jo().catch(r=>{process.stderr.write(`${w.failure(Ge(r))}
58
+ `),process.exitCode=r?.exitCode??5});
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@engagelabemail/cli",
3
+ "version": "1.0.0",
4
+ "description": "CLI for EngageLab Email Agent and Skill workflows",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "exports": {
8
+ ".": "./dist/index.cjs"
9
+ },
10
+ "bin": {
11
+ "engagelab-email-cli": "./dist/index.cjs"
12
+ },
13
+ "keywords": [
14
+ "engagelab",
15
+ "email",
16
+ "cli",
17
+ "agent",
18
+ "inbox"
19
+ ],
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/Metaverse-Cloud/engagelab-email-cli.git"
23
+ },
24
+ "bugs": {
25
+ "url": "https://github.com/Metaverse-Cloud/engagelab-email-cli/issues"
26
+ },
27
+ "homepage": "https://github.com/Metaverse-Cloud/engagelab-email-cli#readme",
28
+ "license": "UNLICENSED",
29
+ "publishConfig": {
30
+ "access": "public"
31
+ },
32
+ "engines": {
33
+ "node": ">=20.0.0"
34
+ }
35
+ }