@stacksjs/dtsx 0.9.8 → 0.9.10

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 (113) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +243 -15
  3. package/dist/bin/cli.js +10 -22
  4. package/dist/branded-types.d.ts +168 -0
  5. package/dist/bundler.d.ts +55 -0
  6. package/dist/cache.d.ts +43 -0
  7. package/dist/checker.d.ts +107 -0
  8. package/dist/chunk-09zp67d8.js +6 -0
  9. package/dist/chunk-0kmfaaz6.js +2 -0
  10. package/dist/chunk-1mm3t0nr.js +3 -0
  11. package/dist/chunk-2f046tgr.js +2 -0
  12. package/dist/chunk-3g2v2ns2.js +2 -0
  13. package/dist/chunk-3j7r0fxz.js +2 -0
  14. package/dist/chunk-3mxzfgcv.js +75 -0
  15. package/dist/chunk-4ev1n7r7.js +3 -0
  16. package/dist/chunk-57agx6g8.js +3 -0
  17. package/dist/chunk-6ppqaypd.js +2 -0
  18. package/dist/chunk-6qv7p9sg.js +170 -0
  19. package/dist/chunk-6s7n1gt0.js +2 -0
  20. package/dist/chunk-74j5mydx.js +3 -0
  21. package/dist/chunk-7cpp6v8f.js +2 -0
  22. package/dist/chunk-9a3jfxnc.js +3 -0
  23. package/dist/chunk-9mjc7ddv.js +19 -0
  24. package/dist/chunk-axb2kjeq.js +2 -0
  25. package/dist/chunk-bn29kee5.js +102 -0
  26. package/dist/chunk-c18vx9sq.js +2 -0
  27. package/dist/chunk-d0p3jzwb.js +34 -0
  28. package/dist/chunk-dk2vv0np.js +15 -0
  29. package/dist/chunk-e3j9tecw.js +3 -0
  30. package/dist/chunk-f18nyrrb.js +32 -0
  31. package/dist/chunk-fbqcsr60.js +22 -0
  32. package/dist/chunk-ffqpf34b.js +3 -0
  33. package/dist/chunk-fw6wcdfd.js +4 -0
  34. package/dist/chunk-h12gdfk9.js +2 -0
  35. package/dist/chunk-j22v8wfe.js +33 -0
  36. package/dist/chunk-jm5ywn4e.js +13 -0
  37. package/dist/chunk-jvz9t6pq.js +2 -0
  38. package/dist/chunk-k5h5ppp5.js +2 -0
  39. package/dist/chunk-p1d09y82.js +449 -0
  40. package/dist/chunk-pyxbb193.js +2 -0
  41. package/dist/chunk-q75q4w1s.js +3 -0
  42. package/dist/chunk-r1m3q3dj.js +2 -0
  43. package/dist/chunk-r1ywapeb.js +6 -0
  44. package/dist/chunk-rnt0wkrk.js +23 -0
  45. package/dist/chunk-rrkq4k1n.js +2 -0
  46. package/dist/chunk-rw6j20e2.js +3 -0
  47. package/dist/chunk-v96rjx7x.js +134 -0
  48. package/dist/circular.d.ts +82 -0
  49. package/dist/compat.d.ts +108 -0
  50. package/dist/config.d.ts +33 -3
  51. package/dist/diff.d.ts +82 -0
  52. package/dist/docs.d.ts +97 -0
  53. package/dist/errors.d.ts +113 -0
  54. package/dist/extractor/builders.d.ts +38 -0
  55. package/dist/extractor/cache.d.ts +47 -0
  56. package/dist/extractor/declarations.d.ts +50 -0
  57. package/dist/extractor/directives.d.ts +9 -0
  58. package/dist/extractor/extract.d.ts +10 -0
  59. package/dist/extractor/hash.d.ts +1 -0
  60. package/dist/extractor/helpers.d.ts +39 -0
  61. package/dist/extractor/index.d.ts +70 -0
  62. package/dist/extractor/scanner.d.ts +6 -0
  63. package/dist/extractor.d.ts +3 -4
  64. package/dist/formats.d.ts +50 -0
  65. package/dist/formatter.d.ts +61 -0
  66. package/dist/generator.d.ts +12 -3
  67. package/dist/import-sorter.d.ts +99 -0
  68. package/dist/incremental.d.ts +84 -0
  69. package/dist/index.d.ts +54 -1
  70. package/dist/logger.d.ts +57 -0
  71. package/dist/lsp.d.ts +317 -0
  72. package/dist/memory.d.ts +110 -0
  73. package/dist/merger.d.ts +38 -0
  74. package/dist/optimizer.d.ts +52 -0
  75. package/dist/output-normalizer.d.ts +123 -0
  76. package/dist/parallel-processor.d.ts +63 -0
  77. package/dist/parser.d.ts +24 -15
  78. package/dist/plugins/bun.d.ts +58 -0
  79. package/dist/plugins/esbuild.d.ts +63 -0
  80. package/dist/plugins/index.d.ts +14 -0
  81. package/dist/plugins/tsup.d.ts +53 -0
  82. package/dist/plugins/vite.d.ts +49 -0
  83. package/dist/plugins/webpack.d.ts +66 -0
  84. package/dist/plugins.d.ts +83 -0
  85. package/dist/process-source.d.ts +11 -0
  86. package/dist/processor/cache.d.ts +16 -0
  87. package/dist/processor/comments.d.ts +7 -0
  88. package/dist/processor/declarations.d.ts +37 -0
  89. package/dist/processor/imports.d.ts +65 -0
  90. package/dist/processor/index.d.ts +34 -0
  91. package/dist/processor/type-inference.d.ts +106 -0
  92. package/dist/processor.d.ts +3 -43
  93. package/dist/profiling.d.ts +101 -0
  94. package/dist/security.d.ts +100 -0
  95. package/dist/sourcemap.d.ts +125 -0
  96. package/dist/src/index.js +55 -2
  97. package/dist/src/plugins/bun.js +2 -0
  98. package/dist/src/plugins/esbuild.js +2 -0
  99. package/dist/src/plugins/index.js +2 -0
  100. package/dist/src/plugins/tsup.js +2 -0
  101. package/dist/src/plugins/vite.js +2 -0
  102. package/dist/src/plugins/webpack.js +2 -0
  103. package/dist/tracking.d.ts +89 -0
  104. package/dist/transformers.d.ts +173 -0
  105. package/dist/tree-shaker.d.ts +69 -0
  106. package/dist/type-mappings.d.ts +148 -0
  107. package/dist/types.d.ts +137 -7
  108. package/dist/utils.d.ts +53 -1
  109. package/dist/watcher.d.ts +64 -0
  110. package/dist/worker.d.ts +84 -0
  111. package/dist/workspace.d.ts +62 -0
  112. package/package.json +49 -11
  113. package/dist/chunk-qsyn1k3w.js +0 -504
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ # MIT License
2
+
3
+ Copyright (c) 2024 Open Web Foundation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -8,11 +8,16 @@
8
8
 
9
9
  # dtsx
10
10
 
11
- > A library that helps you generate TypeScript declaration files from your project. Given we do not know the user's input ever, we need to never hardcode based results based from our examples, always create a dynamic solution.
11
+ > A blazing-fast TypeScript declaration file (.d.ts) generator with advanced features like incremental builds, watch mode, bundling, and IDE integration.
12
12
 
13
13
  ## Features
14
14
 
15
15
  - ⚡ Extremely fast .d.ts generation
16
+ - 🔄 Watch mode with incremental builds
17
+ - 📦 Declaration bundling support
18
+ - 🔌 Plugin system for custom transformations
19
+ - 🧩 Monorepo/workspace support
20
+ - 🛠️ IDE integration via LSP
16
21
  - ⚙️ Highly configurable
17
22
  - 🪶 Lightweight library
18
23
  - 🤖 Cross-platform binary
@@ -36,12 +41,12 @@ pkgx install dtsx # wip
36
41
 
37
42
  There are two ways of using this ".d.ts generation" tool: _as a library or as a CLI._
38
43
 
39
- _But before you get started, please ensure you enabled `isolatedDeclarations` in your `tsconfig.json` file._
44
+ _dtsx works out of the box no `isolatedDeclarations` required. It infers sound types directly from your source values, preserving original values via `@defaultValue` JSDoc. If you do enable `isolatedDeclarations`, dtsx uses it as a fast path to skip initializer parsing when explicit type annotations are present._
40
45
 
41
46
  ```json
42
47
  {
43
48
  "compilerOptions": {
44
- "isolatedDeclarations": true
49
+ "isolatedDeclarations": true // optional — dtsx works great without it
45
50
  }
46
51
  }
47
52
  ```
@@ -69,14 +74,15 @@ const options: DtsGenerationOptions = {
69
74
  await generate(options)
70
75
  ```
71
76
 
72
- _Available options:_
77
+ ### Configuration File
73
78
 
74
79
  Library usage can also be configured using a `dts.config.ts` _(or `dts.config.js`)_ file which is automatically loaded when running the `./dtsx` _(or `bunx dtsx`)_ command. It is also loaded when the `generate` function is called, unless custom options are provided.
75
80
 
76
81
  ```ts
77
82
  // dts.config.ts (or dts.config.js)
83
+ import { defineConfig } from '@stacksjs/dtsx'
78
84
 
79
- export default {
85
+ export default defineConfig({
80
86
  cwd: './',
81
87
  root: './src',
82
88
  entrypoints: ['**/*.ts'],
@@ -84,7 +90,25 @@ export default {
84
90
  keepComments: true,
85
91
  clean: true,
86
92
  verbose: true,
87
- }
93
+
94
+ // Advanced options
95
+ watch: false, // Enable watch mode
96
+ incremental: false, // Enable incremental builds
97
+ parallel: false, // Enable parallel processing
98
+ concurrency: 4, // Number of parallel workers
99
+
100
+ // Bundling
101
+ bundle: false, // Bundle all declarations into one file
102
+ bundleOutput: 'index.d.ts', // Output filename when bundling
103
+
104
+ // Output formatting
105
+ prettier: false, // Use Prettier for formatting
106
+ indentStyle: 'spaces', // 'spaces' or 'tabs'
107
+ indentSize: 2, // Number of spaces
108
+
109
+ // Plugins
110
+ plugins: [],
111
+ })
88
112
  ```
89
113
 
90
114
  _You may also run:_
@@ -98,9 +122,11 @@ _You may also run:_
98
122
 
99
123
  ## CLI
100
124
 
101
- The `dtsx` CLI provides a simple way to generate TypeScript declaration files from your project. Here's how to use it:
125
+ The `dtsx` CLI provides a comprehensive set of commands for generating and managing TypeScript declaration files.
102
126
 
103
- ### Usage
127
+ ### Commands
128
+
129
+ #### Generate Declarations
104
130
 
105
131
  Generate declaration files using the default options:
106
132
 
@@ -111,29 +137,231 @@ dtsx generate
111
137
  _Or use custom options:_
112
138
 
113
139
  ```bash
114
- # Generate declarations for specific entry points:
140
+ # Generate declarations for specific entry points
115
141
  dtsx generate --entrypoints src/index.ts,src/utils.ts --outdir dist/types
116
142
 
117
- # Generate declarations with custom configuration:
143
+ # Generate declarations with custom configuration
118
144
  dtsx generate --root ./lib --outdir ./types --clean
119
145
 
120
- dtsx --help
121
- dtsx --version
146
+ # Enable incremental builds
147
+ dtsx generate --incremental
148
+
149
+ # Enable parallel processing
150
+ dtsx generate --parallel --concurrency 8
151
+ ```
152
+
153
+ #### Watch Mode
154
+
155
+ Watch for file changes and automatically regenerate declarations:
156
+
157
+ ```bash
158
+ dtsx watch
159
+
160
+ # Watch with custom options
161
+ dtsx watch --root ./src --outdir ./dist --debounce 300
162
+ ```
163
+
164
+ #### Bundle Declarations
165
+
166
+ Bundle multiple declaration files into a single file:
167
+
168
+ ```bash
169
+ # Bundle declarations using the generate command with --bundle flag
170
+ dtsx generate --bundle --bundle-output index.d.ts
171
+
172
+ # Or with custom output directory
173
+ dtsx generate --outdir ./dist --bundle --bundle-output types.d.ts
122
174
  ```
123
175
 
124
- _Available options:_
176
+ #### Workspace/Monorepo Support
177
+
178
+ Generate declarations for all packages in a monorepo:
179
+
180
+ ```bash
181
+ dtsx workspace
182
+
183
+ # Specify packages directory
184
+ dtsx workspace --packages ./packages
185
+ ```
186
+
187
+ #### Type Checking
188
+
189
+ Run type checking with isolated declarations support:
190
+
191
+ ```bash
192
+ dtsx check
193
+
194
+ # Check specific files
195
+ dtsx check --files "src/**/*.ts"
196
+ ```
197
+
198
+ #### Circular Dependency Detection
199
+
200
+ Detect circular dependencies in your TypeScript files:
201
+
202
+ ```bash
203
+ dtsx circular
204
+
205
+ # Output as JSON or DOT (Graphviz) format
206
+ dtsx circular --format json
207
+ dtsx circular --format dot
208
+ ```
209
+
210
+ #### Generate Documentation
211
+
212
+ Generate API documentation from your TypeScript files:
213
+
214
+ ```bash
215
+ dtsx docs
216
+
217
+ # Specify output format
218
+ dtsx docs --format markdown
219
+ dtsx docs --format html
220
+ dtsx docs --format json
221
+ ```
222
+
223
+ #### Optimize Declarations
224
+
225
+ Optimize and tree-shake declaration files:
226
+
227
+ ```bash
228
+ dtsx optimize
229
+
230
+ # Optimize specific files
231
+ dtsx optimize --files "dist/**/*.d.ts"
232
+ ```
233
+
234
+ #### Convert Types
235
+
236
+ Convert TypeScript types to different schema formats:
237
+
238
+ ```bash
239
+ dtsx convert --format zod
240
+ dtsx convert --format json-schema
241
+ dtsx convert --format valibot
242
+ ```
243
+
244
+ #### LSP Server
245
+
246
+ Start the Language Server Protocol server for IDE integration:
247
+
248
+ ```bash
249
+ dtsx lsp
250
+ ```
251
+
252
+ #### Read from Stdin
253
+
254
+ Accept TypeScript code from stdin:
255
+
256
+ ```bash
257
+ echo "export function foo(): string { return 'bar' }" | dtsx stdin
258
+ ```
259
+
260
+ ### CLI Options
261
+
262
+ #### Global Options
125
263
 
126
264
  - `--cwd <path>`: Set the current working directory _(default: current directory)_
265
+ - `--verbose`: Enable verbose output _(default: false)_
266
+ - `--help`: Show help information
267
+ - `--version`: Show version number
268
+
269
+ #### Generate Options
270
+
127
271
  - `--root <path>`: Specify the root directory of the project _(default: './src')_
128
272
  - `--entrypoints <files>`: Define entry point files _(comma-separated, default: '**/*.ts')_
129
273
  - `--outdir <path>`: Set the output directory for generated .d.ts files _(default: './dist')_
130
274
  - `--keep-comments`: Keep comments in generated .d.ts files _(default: true)_
131
275
  - `--clean`: Clean output directory before generation _(default: false)_
132
276
  - `--tsconfig <path>`: Specify the path to tsconfig.json _(default: 'tsconfig.json')_
133
- - `--verbose`: Enable verbose output _(default: false)_
277
+ - `--incremental`: Enable incremental builds _(default: false)_
278
+ - `--parallel`: Enable parallel processing _(default: false)_
279
+ - `--concurrency <n>`: Number of parallel workers _(default: 4)_
280
+ - `--dry-run`: Show what would be generated without writing files
281
+ - `--diff`: Show differences from existing .d.ts files
282
+ - `--validate`: Validate generated .d.ts against TypeScript compiler
283
+ - `--stats`: Show generation statistics
284
+ - `--progress`: Show progress during generation
285
+ - `--output-format <format>`: Output format: 'text' or 'json' _(default: 'text')_
286
+
287
+ #### Watch Options
288
+
289
+ - `--debounce <ms>`: Debounce delay in milliseconds _(default: 100)_
290
+
291
+ #### Bundle Options (use with generate command)
292
+
293
+ - `--bundle`: Enable bundling of declarations into a single file
294
+ - `--bundle-output <file>`: Output filename when bundling _(default: 'index.d.ts')_
134
295
 
135
296
  To learn more, head over to the [documentation](https://dtsx.stacksjs.org/).
136
297
 
298
+ ## Build Tool Integration
299
+
300
+ dtsx provides plugins for popular build tools:
301
+
302
+ ### Vite
303
+
304
+ ```ts
305
+ // vite.config.ts
306
+ import { dts } from '@stacksjs/dtsx/vite'
307
+
308
+ export default {
309
+ plugins: [dts()],
310
+ }
311
+ ```
312
+
313
+ ### esbuild
314
+
315
+ ```ts
316
+ // build.ts
317
+ import { dtsx } from '@stacksjs/dtsx/esbuild'
318
+
319
+ await esbuild.build({
320
+ plugins: [dtsx()],
321
+ })
322
+ ```
323
+
324
+ ### webpack
325
+
326
+ ```ts
327
+ // webpack.config.js
328
+ const { DtsxWebpackPlugin } = require('@stacksjs/dtsx/webpack')
329
+
330
+ module.exports = {
331
+ plugins: [new DtsxWebpackPlugin()],
332
+ }
333
+ ```
334
+
335
+ ### tsup
336
+
337
+ ```ts
338
+ // tsup.config.ts
339
+ import { dtsxPlugin } from '@stacksjs/dtsx/tsup'
340
+
341
+ export default {
342
+ plugins: [dtsxPlugin()],
343
+ }
344
+ ```
345
+
346
+ ### Bun
347
+
348
+ ```ts
349
+ // build.ts
350
+ import { dts } from '@stacksjs/dtsx/bun'
351
+
352
+ await Bun.build({
353
+ plugins: [dts()],
354
+ })
355
+ ```
356
+
357
+ ## Documentation
358
+
359
+ - [Architecture Guide](../../ARCHITECTURE.md) - How dtsx works internally
360
+ - [Contributing Guide](../../CONTRIBUTING.md) - How to contribute to dtsx
361
+ - [Performance Guide](../../PERFORMANCE.md) - Tips for optimizing large codebases
362
+ - [Migration Guide](../../MIGRATION.md) - Migrating from other tools
363
+ - [Troubleshooting](../../TROUBLESHOOTING.md) - Common issues and solutions
364
+
137
365
  ## Testing
138
366
 
139
367
  ```bash
@@ -160,7 +388,7 @@ For casual chit-chat with others using this package:
160
388
 
161
389
  ## Postcardware
162
390
 
163
- Software that is free, but hopes for a postcard.” We love receiving postcards from around the world showing where `dtsx` is being used! We showcase them on our website too.
391
+ "Software that is free, but hopes for a postcard." We love receiving postcards from around the world showing where `dtsx` is being used! We showcase them on our website too.
164
392
 
165
393
  Our address: Stacks.js, 12665 Village Ln #2306, Playa Vista, CA 90094, United States 🌎
166
394
 
package/dist/bin/cli.js CHANGED
@@ -1,23 +1,11 @@
1
1
  // @bun
2
- import{r as W0}from"../chunk-qsyn1k3w.js";import{resolve as y}from"path";import L0 from"process";import{EventEmitter as I0}from"events";import t from"process";import m from"process";import C from"process";import g0,{stdin as CZ,stdout as bZ}from"process";import Q0,{stdin as u0,stdout as m0}from"process";import x0 from"readline";var{create:M0,getPrototypeOf:N0,defineProperty:e,getOwnPropertyNames:O0}=Object,w0=Object.prototype.hasOwnProperty,L=(Z,$,Q)=>{Q=Z!=null?M0(N0(Z)):{};let z=$||!Z||!Z.__esModule?e(Q,"default",{value:Z,enumerable:!0}):Q;for(let J of O0(Z))if(!w0.call(z,J))e(z,J,{get:()=>Z[J],enumerable:!0});return z},x=(Z,$)=>()=>($||Z(($={exports:{}}).exports,$),$.exports),B0=x((Z,$)=>{function Q(J){return J==null?[]:Array.isArray(J)?J:[J]}function z(J,Y,X,j){var q,G=J[Y],U=~j.string.indexOf(Y)?X==null||X===!0?"":String(X):typeof X==="boolean"?X:~j.boolean.indexOf(Y)?X==="false"?!1:X==="true"||(J._.push((q=+X,q*0===0)?q:X),!!X):(q=+X,q*0===0)?q:X;J[Y]=G==null?U:Array.isArray(G)?G.concat(U):[G,U]}$.exports=function(J,Y){J=J||[],Y=Y||{};var X,j,q,G,U,F={_:[]},K=0,H=0,V=0,T=J.length;let f=Y.alias!==void 0,S=Y.unknown!==void 0,r=Y.default!==void 0;if(Y.alias=Y.alias||{},Y.string=Q(Y.string),Y.boolean=Q(Y.boolean),f)for(X in Y.alias){j=Y.alias[X]=Q(Y.alias[X]);for(K=0;K<j.length;K++)(Y.alias[j[K]]=j.concat(X)).splice(K,1)}for(K=Y.boolean.length;K-- >0;){j=Y.alias[Y.boolean[K]]||[];for(H=j.length;H-- >0;)Y.boolean.push(j[H])}for(K=Y.string.length;K-- >0;){j=Y.alias[Y.string[K]]||[];for(H=j.length;H-- >0;)Y.string.push(j[H])}if(r){for(X in Y.default)if(G=typeof Y.default[X],j=Y.alias[X]=Y.alias[X]||[],Y[G]!==void 0){Y[G].push(X);for(K=0;K<j.length;K++)Y[G].push(j[K])}}let s=S?Object.keys(Y.alias):[];for(K=0;K<T;K++){if(q=J[K],q==="--"){F._=F._.concat(J.slice(++K));break}for(H=0;H<q.length;H++)if(q.charCodeAt(H)!==45)break;if(H===0)F._.push(q);else if(q.substring(H,H+3)==="no-"){if(G=q.substring(H+3),S&&!~s.indexOf(G))return Y.unknown(q);F[G]=!1}else{for(V=H+1;V<q.length;V++)if(q.charCodeAt(V)===61)break;G=q.substring(H,V),U=q.substring(++V)||(K+1===T||(""+J[K+1]).charCodeAt(0)===45||J[++K]),j=H===2?[G]:G;for(V=0;V<j.length;V++){if(G=j[V],S&&!~s.indexOf(G))return Y.unknown("-".repeat(H)+G);z(F,G,V+1<j.length||U,Y)}}}if(r){for(X in Y.default)if(F[X]===void 0)F[X]=Y.default[X]}if(f)for(X in F){j=Y.alias[X]||[];while(j.length>0)F[j.shift()]=F[X]}return F}}),N=x((Z,$)=>{var Q=process||{},z=Q.argv||[],J=Q.env||{},Y=!(!!J.NO_COLOR||z.includes("--no-color"))&&(!!J.FORCE_COLOR||z.includes("--color")||Q.platform==="win32"||(Q.stdout||{}).isTTY&&J.TERM!=="dumb"||!!J.CI),X=(G,U,F=G)=>(K)=>{let H=""+K,V=H.indexOf(U,G.length);return~V?G+j(H,U,F,V)+U:G+H+U},j=(G,U,F,K)=>{let H="",V=0;do H+=G.substring(V,K)+F,V=K+U.length,K=G.indexOf(U,V);while(~K);return H+G.substring(V)},q=(G=Y)=>{let U=G?X:()=>String;return{isColorSupported:G,reset:U("\x1B[0m","\x1B[0m"),bold:U("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:U("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:U("\x1B[3m","\x1B[23m"),underline:U("\x1B[4m","\x1B[24m"),inverse:U("\x1B[7m","\x1B[27m"),hidden:U("\x1B[8m","\x1B[28m"),strikethrough:U("\x1B[9m","\x1B[29m"),black:U("\x1B[30m","\x1B[39m"),red:U("\x1B[31m","\x1B[39m"),green:U("\x1B[32m","\x1B[39m"),yellow:U("\x1B[33m","\x1B[39m"),blue:U("\x1B[34m","\x1B[39m"),magenta:U("\x1B[35m","\x1B[39m"),cyan:U("\x1B[36m","\x1B[39m"),white:U("\x1B[37m","\x1B[39m"),gray:U("\x1B[90m","\x1B[39m"),bgBlack:U("\x1B[40m","\x1B[49m"),bgRed:U("\x1B[41m","\x1B[49m"),bgGreen:U("\x1B[42m","\x1B[49m"),bgYellow:U("\x1B[43m","\x1B[49m"),bgBlue:U("\x1B[44m","\x1B[49m"),bgMagenta:U("\x1B[45m","\x1B[49m"),bgCyan:U("\x1B[46m","\x1B[49m"),bgWhite:U("\x1B[47m","\x1B[49m"),blackBright:U("\x1B[90m","\x1B[39m"),redBright:U("\x1B[91m","\x1B[39m"),greenBright:U("\x1B[92m","\x1B[39m"),yellowBright:U("\x1B[93m","\x1B[39m"),blueBright:U("\x1B[94m","\x1B[39m"),magentaBright:U("\x1B[95m","\x1B[39m"),cyanBright:U("\x1B[96m","\x1B[39m"),whiteBright:U("\x1B[97m","\x1B[39m"),bgBlackBright:U("\x1B[100m","\x1B[49m"),bgRedBright:U("\x1B[101m","\x1B[49m"),bgGreenBright:U("\x1B[102m","\x1B[49m"),bgYellowBright:U("\x1B[103m","\x1B[49m"),bgBlueBright:U("\x1B[104m","\x1B[49m"),bgMagentaBright:U("\x1B[105m","\x1B[49m"),bgCyanBright:U("\x1B[106m","\x1B[49m"),bgWhiteBright:U("\x1B[107m","\x1B[49m")}};$.exports=q(),$.exports.createColors=q}),T0=x((Z,$)=>{$.exports=()=>{return/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g}}),P0=L(B0(),1);function G0(Z){return Z.replace(/[<[].+/,"").trim()}function R0(Z){let $=/<([^>]+)>/g,Q=/\[([^\]]+)\]/g,z=[],J=(j)=>{let q=!1,G=j[1];if(G.startsWith("..."))G=G.slice(3),q=!0;return{required:j[0].startsWith("<"),value:G,variadic:q}},Y;while(Y=$.exec(Z))z.push(J(Y));let X;while(X=Q.exec(Z))z.push(J(X));return z}function E0(Z){let $={alias:{},boolean:[]};for(let[Q,z]of Z.entries()){if(z.names.length>1)$.alias[z.names[0]]=z.names.slice(1);if(z.isBoolean)if(z.negated){if(!Z.some((Y,X)=>{return X!==Q&&Y.names.some((j)=>z.names.includes(j))&&typeof Y.required==="boolean"}))$.boolean.push(z.names[0])}else $.boolean.push(z.names[0])}return $}function o(Z){return Z.sort(($,Q)=>{return $.length>Q.length?-1:1})[0]}function Z0(Z,$){return Z.length>=$?Z:`${Z}${" ".repeat($-Z.length)}`}function k0(Z){return Z.replace(/([a-z])-([a-z])/g,($,Q,z)=>{return Q+z.toUpperCase()})}function C0(Z,$,Q){let z=0,J=$.length,Y=Z,X;for(;z<J;++z)X=Y[$[z]],Y=Y[$[z]]=z===J-1?Q:X!=null?X:!!~$[z+1].indexOf(".")||!(+$[z+1]>-1)?{}:[]}function b0(Z,$){for(let Q of Object.keys($)){let z=$[Q];if(z.shouldTransform){if(Z[Q]=Array.prototype.concat.call([],Z[Q]),typeof z.transformFunction==="function")Z[Q]=Z[Q].map(z.transformFunction)}}}function A0(Z){let $=/([^\\/]+)$/.exec(Z);return $?$[1]:""}function q0(Z){return Z.split(".").map(($,Q)=>{return Q===0?k0($):$}).join(".")}class k extends Error{constructor(Z){super(Z);if(this.name=this.constructor.name,typeof Error.captureStackTrace==="function")Error.captureStackTrace(this,this.constructor);else this.stack=Error(Z).stack}}function h0(){let{env:Z}=t,{TERM:$,TERM_PROGRAM:Q}=Z;if(t.platform!=="win32")return $!=="linux";return Boolean(Z.WT_SESSION)||Boolean(Z.TERMINUS_SUBLIME)||Z.ConEmuTask==="{cmd::Cmder}"||Q==="Terminus-Sublime"||Q==="vscode"||$==="xterm-256color"||$==="alacritty"||$==="rxvt-unicode"||$==="rxvt-unicode-256color"||Z.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var A="\x1B",M=`${A}[`;var w={to(Z,$){if(!$)return`${M}${Z+1}G`;return`${M}${$+1};${Z+1}H`},move(Z,$){let Q="";if(Z<0)Q+=`${M}${-Z}D`;else if(Z>0)Q+=`${M}${Z}C`;if($<0)Q+=`${M}${-$}A`;else if($>0)Q+=`${M}${$}B`;return Q},up:(Z=1)=>`${M}${Z}A`,down:(Z=1)=>`${M}${Z}B`,forward:(Z=1)=>`${M}${Z}C`,backward:(Z=1)=>`${M}${Z}D`,nextLine:(Z=1)=>`${M}E`.repeat(Z),prevLine:(Z=1)=>`${M}F`.repeat(Z),left:`${M}G`,hide:`${M}?25l`,show:`${M}?25h`,save:`${A}7`,restore:`${A}8`};var g={screen:`${M}2J`,up:(Z=1)=>`${M}1J`.repeat(Z),down:(Z=1)=>`${M}J`.repeat(Z),line:`${M}2K`,lineEnd:`${M}K`,lineStart:`${M}1K`,lines(Z){let $="";for(let Q=0;Q<Z;Q++)$+=this.line+(Q<Z-1?w.up():"");if(Z)$+=w.left;return $}},TZ={screen:`${A}c`};class F0{rawName;description;name;names;isBoolean;required;config;negated;constructor(Z,$,Q){if(this.rawName=Z,this.description=$,this.config=Object.assign({},Q),Z=Z.replace(/\.\*/g,""),this.negated=!1,this.names=G0(Z).split(",").map((z)=>{let J=z.trim().replace(/^-{1,2}/,"");if(J.startsWith("no-"))this.negated=!0,J=J.replace(/^no-/,"");return q0(J)}).sort((z,J)=>z.length>J.length?1:-1),this.name=this.names[this.names.length-1],this.negated&&this.config.default==null)this.config.default=!0;if(Z.includes("<"))this.required=!0;else if(Z.includes("["))this.required=!1;else this.isBoolean=!0}}var IZ=m.argv,v0=`${m.platform}-${m.arch} bun-v${typeof Bun<"u"?Bun.version:"unknown"}`,y0=C.argv,f0=`${C.platform}-${C.arch} node-${C.version}`;class l{rawName;description;config;cli;options;aliasNames;name;args;commandAction;usageText;versionNumber;examples;helpCallback;globalCommand;constructor(Z,$,Q,z){if(this.rawName=Z,this.description=$,this.config=Q,this.cli=z,this.options=[],this.aliasNames=[],this.name=G0(Z),this.args=R0(Z),this.examples=[],!Q)this.config={}}usage(Z){return this.usageText=Z,this}allowUnknownOptions(){return this.config.allowUnknownOptions=!0,this}ignoreOptionDefaultValue(){return this.config.ignoreOptionDefaultValue=!0,this}version(Z,$="-v, --version"){return this.versionNumber=Z,this.option($,"Display version number"),this}example(Z){return this.examples.push(Z),this}option(Z,$,Q){let z=new F0(Z,$,Q);return this.options.push(z),this}alias(Z){return this.aliasNames.push(Z),this}action(Z){return this.commandAction=Z,this}isMatched(Z){return this.name===Z||this.aliasNames.includes(Z)}get isDefaultCommand(){return this.name===""||this.aliasNames.includes("!")}get isGlobalCommand(){return this instanceof n}hasOption(Z){return Z=Z.split(".")[0],!!this.options.find(($)=>{return $.names.includes(Z)})}outputHelp(){let{name:Z,commands:$}=this.cli,{versionNumber:Q,options:z,helpCallback:J}=this.cli.globalCommand,Y=[{body:`${Z}${Q?`/${Q}`:""}`}];if(Y.push({title:"Usage",body:` $ ${Z} ${this.usageText||this.rawName}`}),(this.isGlobalCommand||this.isDefaultCommand)&&$.length>0){let q=o($.map((G)=>G.rawName));Y.push({title:"Commands",body:$.map((G)=>{return` ${Z0(G.rawName,q.length)} ${G.description}`}).join(`
3
- `)}),Y.push({title:"For more info, run any command with the `--help` flag",body:$.map((G)=>` $ ${Z}${G.name===""?"":` ${G.name}`} --help`).join(`
4
- `)})}let j=this.isGlobalCommand?z:[...this.options,...z||[]];if(!this.isGlobalCommand&&!this.isDefaultCommand)j=j.filter((q)=>q.name!=="version");if(j.length>0){let q=o(j.map((G)=>G.rawName));Y.push({title:"Options",body:j.map((G)=>{return` ${Z0(G.rawName,q.length)} ${G.description} ${G.config.default===void 0?"":`(default: ${G.config.default})`}`}).join(`
5
- `)})}if(this.examples.length>0)Y.push({title:"Examples",body:this.examples.map((q)=>{if(typeof q==="function")return q(Z);return q}).join(`
6
- `)});if(J)Y=J(Y)||Y;console.log(Y.map((q)=>{return q.title?`${q.title}:
7
- ${q.body}`:q.body}).join(`
8
-
9
- `))}outputVersion(){let{name:Z}=this.cli,{versionNumber:$}=this.cli.globalCommand;if($){let Q;if(Bun)Q=v0;else Q=f0;console.log(`${Z}/${$} ${Q}`)}}checkRequiredArgs(){let Z=this.args.filter(($)=>$.required).length;if(this.cli.args.length<Z)throw new k(`missing required args for command \`${this.rawName}\``)}checkUnknownOptions(){let{options:Z,globalCommand:$}=this.cli;if(!this.config.allowUnknownOptions){for(let Q of Object.keys(Z))if(Q!=="--"&&!this.hasOption(Q)&&!$.hasOption(Q))throw new k(`Unknown option \`${Q.length>1?`--${Q}`:`-${Q}`}\``)}}checkOptionValue(){let{options:Z,globalCommand:$}=this.cli,Q=[...$.options,...this.options];for(let z of Q){let J=Z[z.name.split(".")[0]];if(z.required){let Y=Q.some((X)=>X.negated&&X.names.includes(z.name));if(J===!0||J===!1&&!Y)throw new k(`option \`${z.rawName}\` value is missing`)}}}}class n extends l{constructor(Z){super("@@global@@","",{},Z)}}var S0=l;class a extends I0{name;commands;globalCommand;matchedCommand;matchedCommandName;rawArgs;args;options;showHelpOnExit;showVersionOnExit;constructor(Z=""){super();this.name=Z,this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.globalCommand=new n(this),this.globalCommand.usage("<command> [options]")}usage(Z){return this.globalCommand.usage(Z),this}command(Z,$,Q){if(!Q)Q={};let z=new S0(Z,$||"",Q,this);return z.globalCommand=this.globalCommand,this.commands.push(z),z}option(Z,$,Q){return this.globalCommand.option(Z,$,Q),this}help(Z){return this.globalCommand.option("-h, --help","Display this message"),this.globalCommand.helpCallback=Z,this.showHelpOnExit=!0,this}version(Z,$="-v, --version"){return this.globalCommand.version(Z,$),this.showVersionOnExit=!0,this}example(Z){return this.globalCommand.example(Z),this}outputHelp(){if(this.matchedCommand)this.matchedCommand.outputHelp();else this.globalCommand.outputHelp()}outputVersion(){this.globalCommand.outputVersion()}setParsedInfo({args:Z,options:$},Q,z){if(this.args=Z,this.options=$,Q)this.matchedCommand=Q;if(z)this.matchedCommandName=z;return this}unsetMatchedCommand(){this.matchedCommand=void 0,this.matchedCommandName=void 0}parse(Z=y0,{run:$=!0}={}){if(this.rawArgs=Z,!this.name)this.name=Z[1]?A0(Z[1]):"cli";let Q=!0;for(let J of this.commands){let Y=this.mri(Z.slice(2),J),X=Y.args[0];if(J.isMatched(X)){Q=!1;let j={...Y,args:Y.args.slice(1)};this.setParsedInfo(j,J,X),this.emit(`command:${X}`,J)}}if(Q){for(let J of this.commands)if(J.name===""){Q=!1;let Y=this.mri(Z.slice(2),J);this.setParsedInfo(Y,J),this.emit("command:!",J)}}if(Q){let J=this.mri(Z.slice(2));this.setParsedInfo(J)}if(this.options.help&&this.showHelpOnExit)this.outputHelp(),$=!1,this.unsetMatchedCommand();if(this.options.version&&this.showVersionOnExit&&this.matchedCommandName==null)this.outputVersion(),$=!1,this.unsetMatchedCommand();let z={args:this.args,options:this.options};if($)this.runMatchedCommand();if(!this.matchedCommand&&this.args[0])this.emit("command:*");return z}mri(Z,$){let Q=[...this.globalCommand.options,...$?$.options:[]],z=E0(Q),J=[],Y=Z.indexOf("--");if(Y>-1)J=Z.slice(Y+1),Z=Z.slice(0,Y);let X=P0.default(Z,z);X=Object.keys(X).reduce((F,K)=>{return{...F,[q0(K)]:X[K]}},{_:[]});let j=X._,q={"--":J},G=$&&$.config.ignoreOptionDefaultValue?$.config.ignoreOptionDefaultValue:this.globalCommand.config.ignoreOptionDefaultValue,U=Object.create(null);for(let F of Q){if(!G&&F.config.default!==void 0)for(let K of F.names)q[K]=F.config.default;if(Array.isArray(F.config.type)){if(U[F.name]===void 0)U[F.name]=Object.create(null),U[F.name].shouldTransform=!0,U[F.name].transformFunction=F.config.type[0]}}for(let F of Object.keys(X))if(F!=="_"){let K=F.split(".");C0(q,K,X[F]),b0(q,U)}return{args:j,options:q}}runMatchedCommand(){let{args:Z,options:$,matchedCommand:Q}=this;if(!Q||!Q.commandAction)return;Q.checkUnknownOptions(),Q.checkOptionValue(),Q.checkRequiredArgs();let z=[];return Q.args.forEach((J,Y)=>{if(J.variadic)z.push(Z.slice(Y));else z.push(Z[Y])}),z.push($),Q.commandAction.apply(this,z)}}var EZ=L(N(),1),_0=["up","down","left","right","space","enter","cancel"],b={actions:new Set(_0),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"}};function K0(Z,$){if(typeof Z==="string")return b.aliases.get(Z)===$;for(let Q of Z){if(Q===void 0)continue;if(K0(Q,$))return!0}return!1}function d0(Z,$){if(Z===$)return[];let Q=Z.split(`
10
- `),z=$.split(`
11
- `),J=[];for(let Y=0;Y<Math.max(Q.length,z.length);Y++)if(Q[Y]!==z[Y])J.push(Y);return J}var AZ=g0.platform.startsWith("win"),$0=Symbol("clapp:cancel");function E(Z,$){let Q=Z;if(Q.isTTY)Q.setRawMode($)}var _=L(N(),1);function l0({onlyFirst:Z=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",Z?void 0:"g")}var n0=l0();function H0(Z){if(typeof Z!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof Z}\``);return Z.replace(n0,"")}function a0(Z){return Z===161||Z===164||Z===167||Z===168||Z===170||Z===173||Z===174||Z>=176&&Z<=180||Z>=182&&Z<=186||Z>=188&&Z<=191||Z===198||Z===208||Z===215||Z===216||Z>=222&&Z<=225||Z===230||Z>=232&&Z<=234||Z===236||Z===237||Z===240||Z===242||Z===243||Z>=247&&Z<=250||Z===252||Z===254||Z===257||Z===273||Z===275||Z===283||Z===294||Z===295||Z===299||Z>=305&&Z<=307||Z===312||Z>=319&&Z<=322||Z===324||Z>=328&&Z<=331||Z===333||Z===338||Z===339||Z===358||Z===359||Z===363||Z===462||Z===464||Z===466||Z===468||Z===470||Z===472||Z===474||Z===476||Z===593||Z===609||Z===708||Z===711||Z>=713&&Z<=715||Z===717||Z===720||Z>=728&&Z<=731||Z===733||Z===735||Z>=768&&Z<=879||Z>=913&&Z<=929||Z>=931&&Z<=937||Z>=945&&Z<=961||Z>=963&&Z<=969||Z===1025||Z>=1040&&Z<=1103||Z===1105||Z===8208||Z>=8211&&Z<=8214||Z===8216||Z===8217||Z===8220||Z===8221||Z>=8224&&Z<=8226||Z>=8228&&Z<=8231||Z===8240||Z===8242||Z===8243||Z===8245||Z===8251||Z===8254||Z===8308||Z===8319||Z>=8321&&Z<=8324||Z===8364||Z===8451||Z===8453||Z===8457||Z===8467||Z===8470||Z===8481||Z===8482||Z===8486||Z===8491||Z===8531||Z===8532||Z>=8539&&Z<=8542||Z>=8544&&Z<=8555||Z>=8560&&Z<=8569||Z===8585||Z>=8592&&Z<=8601||Z===8632||Z===8633||Z===8658||Z===8660||Z===8679||Z===8704||Z===8706||Z===8707||Z===8711||Z===8712||Z===8715||Z===8719||Z===8721||Z===8725||Z===8730||Z>=8733&&Z<=8736||Z===8739||Z===8741||Z>=8743&&Z<=8748||Z===8750||Z>=8756&&Z<=8759||Z===8764||Z===8765||Z===8776||Z===8780||Z===8786||Z===8800||Z===8801||Z>=8804&&Z<=8807||Z===8810||Z===8811||Z===8814||Z===8815||Z===8834||Z===8835||Z===8838||Z===8839||Z===8853||Z===8857||Z===8869||Z===8895||Z===8978||Z>=9312&&Z<=9449||Z>=9451&&Z<=9547||Z>=9552&&Z<=9587||Z>=9600&&Z<=9615||Z>=9618&&Z<=9621||Z===9632||Z===9633||Z>=9635&&Z<=9641||Z===9650||Z===9651||Z===9654||Z===9655||Z===9660||Z===9661||Z===9664||Z===9665||Z>=9670&&Z<=9672||Z===9675||Z>=9678&&Z<=9681||Z>=9698&&Z<=9701||Z===9711||Z===9733||Z===9734||Z===9737||Z===9742||Z===9743||Z===9756||Z===9758||Z===9792||Z===9794||Z===9824||Z===9825||Z>=9827&&Z<=9829||Z>=9831&&Z<=9834||Z===9836||Z===9837||Z===9839||Z===9886||Z===9887||Z===9919||Z>=9926&&Z<=9933||Z>=9935&&Z<=9939||Z>=9941&&Z<=9953||Z===9955||Z===9960||Z===9961||Z>=9963&&Z<=9969||Z===9972||Z>=9974&&Z<=9977||Z===9979||Z===9980||Z===9982||Z===9983||Z===10045||Z>=10102&&Z<=10111||Z>=11094&&Z<=11097||Z>=12872&&Z<=12879||Z>=57344&&Z<=63743||Z>=65024&&Z<=65039||Z===65533||Z>=127232&&Z<=127242||Z>=127248&&Z<=127277||Z>=127280&&Z<=127337||Z>=127344&&Z<=127373||Z===127375||Z===127376||Z>=127387&&Z<=127404||Z>=917760&&Z<=917999||Z>=983040&&Z<=1048573||Z>=1048576&&Z<=1114109}function c0(Z){return Z===12288||Z>=65281&&Z<=65376||Z>=65504&&Z<=65510}function p0(Z){return Z>=4352&&Z<=4447||Z===8986||Z===8987||Z===9001||Z===9002||Z>=9193&&Z<=9196||Z===9200||Z===9203||Z===9725||Z===9726||Z===9748||Z===9749||Z>=9776&&Z<=9783||Z>=9800&&Z<=9811||Z===9855||Z>=9866&&Z<=9871||Z===9875||Z===9889||Z===9898||Z===9899||Z===9917||Z===9918||Z===9924||Z===9925||Z===9934||Z===9940||Z===9962||Z===9970||Z===9971||Z===9973||Z===9978||Z===9981||Z===9989||Z===9994||Z===9995||Z===10024||Z===10060||Z===10062||Z>=10067&&Z<=10069||Z===10071||Z>=10133&&Z<=10135||Z===10160||Z===10175||Z===11035||Z===11036||Z===11088||Z===11093||Z>=11904&&Z<=11929||Z>=11931&&Z<=12019||Z>=12032&&Z<=12245||Z>=12272&&Z<=12287||Z>=12289&&Z<=12350||Z>=12353&&Z<=12438||Z>=12441&&Z<=12543||Z>=12549&&Z<=12591||Z>=12593&&Z<=12686||Z>=12688&&Z<=12773||Z>=12783&&Z<=12830||Z>=12832&&Z<=12871||Z>=12880&&Z<=42124||Z>=42128&&Z<=42182||Z>=43360&&Z<=43388||Z>=44032&&Z<=55203||Z>=63744&&Z<=64255||Z>=65040&&Z<=65049||Z>=65072&&Z<=65106||Z>=65108&&Z<=65126||Z>=65128&&Z<=65131||Z>=94176&&Z<=94180||Z===94192||Z===94193||Z>=94208&&Z<=100343||Z>=100352&&Z<=101589||Z>=101631&&Z<=101640||Z>=110576&&Z<=110579||Z>=110581&&Z<=110587||Z===110589||Z===110590||Z>=110592&&Z<=110882||Z===110898||Z>=110928&&Z<=110930||Z===110933||Z>=110948&&Z<=110951||Z>=110960&&Z<=111355||Z>=119552&&Z<=119638||Z>=119648&&Z<=119670||Z===126980||Z===127183||Z===127374||Z>=127377&&Z<=127386||Z>=127488&&Z<=127490||Z>=127504&&Z<=127547||Z>=127552&&Z<=127560||Z===127568||Z===127569||Z>=127584&&Z<=127589||Z>=127744&&Z<=127776||Z>=127789&&Z<=127797||Z>=127799&&Z<=127868||Z>=127870&&Z<=127891||Z>=127904&&Z<=127946||Z>=127951&&Z<=127955||Z>=127968&&Z<=127984||Z===127988||Z>=127992&&Z<=128062||Z===128064||Z>=128066&&Z<=128252||Z>=128255&&Z<=128317||Z>=128331&&Z<=128334||Z>=128336&&Z<=128359||Z===128378||Z===128405||Z===128406||Z===128420||Z>=128507&&Z<=128591||Z>=128640&&Z<=128709||Z===128716||Z>=128720&&Z<=128722||Z>=128725&&Z<=128727||Z>=128732&&Z<=128735||Z===128747||Z===128748||Z>=128756&&Z<=128764||Z>=128992&&Z<=129003||Z===129008||Z>=129292&&Z<=129338||Z>=129340&&Z<=129349||Z>=129351&&Z<=129535||Z>=129648&&Z<=129660||Z>=129664&&Z<=129673||Z>=129679&&Z<=129734||Z>=129742&&Z<=129756||Z>=129759&&Z<=129769||Z>=129776&&Z<=129784||Z>=131072&&Z<=196605||Z>=196608&&Z<=262141}function i0(Z){if(!Number.isSafeInteger(Z))throw TypeError(`Expected a code point, got \`${typeof Z}\`.`)}function r0(Z,{ambiguousAsWide:$=!1}={}){if(i0(Z),c0(Z)||p0(Z)||$&&a0(Z))return 2;return 1}var s0=L(T0(),1),e0=new Intl.Segmenter,t0=/^\p{Default_Ignorable_Code_Point}$/u;function I(Z,$={}){if(typeof Z!=="string"||Z.length===0)return 0;let{ambiguousIsNarrow:Q=!0,countAnsiEscapeCodes:z=!1}=$;if(!z)Z=H0(Z);if(Z.length===0)return 0;let J=0,Y={ambiguousAsWide:!Q};for(let{segment:X}of e0.segment(Z)){let j=X.codePointAt(0);if(j<=31||j>=127&&j<=159)continue;if(j>=8203&&j<=8207||j===65279)continue;if(j>=768&&j<=879||j>=6832&&j<=6911||j>=7616&&j<=7679||j>=8400&&j<=8447||j>=65056&&j<=65071)continue;if(j>=55296&&j<=57343)continue;if(j>=65024&&j<=65039)continue;if(t0.test(X))continue;if(s0.default().test(X)){J+=2;continue}J+=r0(j,Y)}return J}var d=10,z0=(Z=0)=>($)=>`\x1B[${$+Z}m`,J0=(Z=0)=>($)=>`\x1B[${38+Z};5;${$}m`,Y0=(Z=0)=>($,Q,z)=>`\x1B[${38+Z};2;${$};${Q};${z}m`,D={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},yZ=Object.keys(D.modifier),o0=Object.keys(D.color),ZZ=Object.keys(D.bgColor),fZ=[...o0,...ZZ];function $Z(){let Z=new Map;for(let[$,Q]of Object.entries(D)){for(let[z,J]of Object.entries(Q))D[z]={open:`\x1B[${J[0]}m`,close:`\x1B[${J[1]}m`},Q[z]=D[z],Z.set(J[0],J[1]);Object.defineProperty(D,$,{value:Q,enumerable:!1})}return Object.defineProperty(D,"codes",{value:Z,enumerable:!1}),D.color.close="\x1B[39m",D.bgColor.close="\x1B[49m",D.color.ansi=z0(),D.color.ansi256=J0(),D.color.ansi16m=Y0(),D.bgColor.ansi=z0(d),D.bgColor.ansi256=J0(d),D.bgColor.ansi16m=Y0(d),Object.defineProperties(D,{rgbToAnsi256:{value:($,Q,z)=>{if($===Q&&Q===z){if($<8)return 16;if($>248)return 231;return Math.round(($-8)/247*24)+232}return 16+36*Math.round($/255*5)+6*Math.round(Q/255*5)+Math.round(z/255*5)},enumerable:!1},hexToRgb:{value:($)=>{let Q=/[a-f\d]{6}|[a-f\d]{3}/i.exec($.toString(16));if(!Q)return[0,0,0];let[z]=Q;if(z.length===3)z=[...z].map((Y)=>Y+Y).join("");let J=Number.parseInt(z,16);return[J>>16&255,J>>8&255,J&255]},enumerable:!1},hexToAnsi256:{value:($)=>D.rgbToAnsi256(...D.hexToRgb($)),enumerable:!1},ansi256ToAnsi:{value:($)=>{if($<8)return 30+$;if($<16)return 90+($-8);let Q,z,J;if($>=232)Q=(($-232)*10+8)/255,z=Q,J=Q;else{$-=16;let j=$%36;Q=Math.floor($/36)/5,z=Math.floor(j/6)/5,J=j%6/5}let Y=Math.max(Q,z,J)*2;if(Y===0)return 30;let X=30+(Math.round(J)<<2|Math.round(z)<<1|Math.round(Q));if(Y===2)X+=60;return X},enumerable:!1},rgbToAnsi:{value:($,Q,z)=>D.ansi256ToAnsi(D.rgbToAnsi256($,Q,z)),enumerable:!1},hexToAnsi:{value:($)=>D.ansi256ToAnsi(D.hexToAnsi256($)),enumerable:!1}}),D}var QZ=$Z(),zZ=QZ,v=new Set(["\x1B","\x9B"]),JZ=39,c="\x07",V0="[",YZ="]",D0="m",h=`${YZ}8;;`,j0=(Z)=>`${v.values().next().value}${V0}${Z}${D0}`,X0=(Z)=>`${v.values().next().value}${h}${Z}${c}`,jZ=(Z)=>Z.split(" ").map(($)=>I($)),u=(Z,$,Q)=>{let z=[...$],J=!1,Y=!1,X=I(H0(Z.at(-1)));for(let[j,q]of z.entries()){let G=I(q);if(X+G<=Q)Z[Z.length-1]+=q;else Z.push(q),X=0;if(v.has(q))J=!0,Y=z.slice(j+1,j+1+h.length).join("")===h;if(J){if(Y){if(q===c)J=!1,Y=!1}else if(q===D0)J=!1;continue}if(X+=G,X===Q&&j<z.length-1)Z.push(""),X=0}if(!X&&Z.at(-1).length>0&&Z.length>1)Z[Z.length-2]+=Z.pop()},XZ=(Z)=>{let $=Z.split(" "),Q=$.length;while(Q>0){if(I($[Q-1])>0)break;Q--}if(Q===$.length)return Z;return $.slice(0,Q).join(" ")+$.slice(Q).join("")},UZ=(Z,$,Q={})=>{if(Q.trim!==!1&&Z.trim()==="")return"";let z="",J,Y,X=jZ(Z),j=[""];for(let[F,K]of Z.split(" ").entries()){if(Q.trim!==!1)j[j.length-1]=j.at(-1).trimStart();let H=I(j.at(-1));if(F!==0){if(H>=$&&(Q.wordWrap===!1||Q.trim===!1))j.push(""),H=0;if(H>0||Q.trim===!1)j[j.length-1]+=" ",H++}if(Q.hard&&X[F]>$){let V=$-H,T=1+Math.floor((X[F]-V-1)/$);if(Math.floor((X[F]-1)/$)<T)j.push("");u(j,K,$);continue}if(H+X[F]>$&&H>0&&X[F]>0){if(Q.wordWrap===!1&&H<$){u(j,K,$);continue}j.push("")}if(H+X[F]>$&&Q.wordWrap===!1){u(j,K,$);continue}j[j.length-1]+=K}if(Q.trim!==!1)j=j.map((F)=>XZ(F));let q=j.join(`
12
- `),G=[...q],U=0;for(let[F,K]of G.entries()){if(z+=K,v.has(K)){let{groups:V}=new RegExp(`(?:\\${V0}(?<code>\\d+)m|\\${h}(?<uri>.*)${c})`).exec(q.slice(U))||{groups:{}};if(V.code!==void 0){let T=Number.parseFloat(V.code);J=T===JZ?void 0:T}else if(V.uri!==void 0)Y=V.uri.length===0?void 0:V.uri}let H=zZ.codes.get(Number(J));if(G[F+1]===`
13
- `){if(Y)z+=X0("");if(J&&H)z+=j0(H)}else if(K===`
14
- `){if(J&&H)z+=j0(J);if(Y)z+=X0(Y)}U+=K.length}return z};function U0(Z,$,Q){return String(Z).normalize().replaceAll(`\r
15
- `,`
16
- `).split(`
17
- `).map((z)=>UZ(z,$,Q)).join(`
18
- `)}class p{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame="";_subscribers=new Map;_cursor=0;_manualLine="";state="initial";error="";value;userInput="";constructor(Z,$=!0){let{input:Q=u0,output:z=m0,render:J,signal:Y,...X}=Z;this.opts=X,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=J.bind(this),this._track=$,this._abortSignal=Y,this.input=Q,this.output=z}unsubscribe(){this._subscribers.clear()}setSubscriber(Z,$){let Q=this._subscribers.get(Z)??[];Q.push($),this._subscribers.set(Z,Q)}on(Z,$){return this.setSubscriber(Z,{cb:$}),this}once(Z,$){return this.setSubscriber(Z,{cb:$,once:!0}),this}emit(Z,...$){let Q=this._subscribers.get(Z)??[],z=[];for(let J of Q)if(J.cb(...$),J.once)z.push(()=>Q.splice(Q.indexOf(J),1));for(let J of z)J();return this}prompt(){return new Promise((Z)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),Z($0);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}if(this.rl=x0.createInterface({input:this.input,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0)this._setUserInput(this.opts.initialUserInput,!0);this.input.on("keypress",this.onKeypress),E(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(w.show),this.output.off("resize",this.render),E(this.input,!1),Z(this.value)}),this.once("cancel",()=>{this.output.write(w.show),this.output.off("resize",this.render),E(this.input,!1),Z($0)})})}_isActionKey(Z,$){return Z==="\t"}_setValue(Z){this.value=Z,this.emit("value",this.value)}_setUserInput(Z,$){if(this.userInput=Z??"",this.emit("userInput",this.userInput),$&&this._track&&this.rl)this.rl.write(this.userInput),this._cursor=this.rl.cursor}onKeypress(Z,$){if(this._track&&$.name!=="return"){if($.name&&this._isActionKey(Z,$))this.rl?.write(null,{ctrl:!0,name:"h"});this._cursor=this.rl?.cursor??0;let Q=$.name==="tab"||$.name==="escape"||$.name==="backspace"||$.name==="delete"||$.name==="enter"||$.name==="return"||$.name&&["up","down","left","right"].includes($.name);if(Z&&!Q&&Z.length===1&&Z>=" ")this._manualLine+=Z;else if($.name==="backspace"&&this._manualLine.length>0)this._manualLine=this._manualLine.slice(0,-1);let z=this._manualLine.length>=(this.rl?.line?.length||0)?this._manualLine:this.rl?.line;this._setUserInput(z)}if(this.state==="error")this.state="active",this.error="";if($?.name){if(!this._track&&b.aliases.has($.name))this.emit("cursor",b.aliases.get($.name));if(b.actions.has($.name))this.emit("cursor",$.name)}if(Z&&(Z.toLowerCase()==="y"||Z.toLowerCase()==="n"))this.emit("confirm",Z.toLowerCase()==="y");if(this.emit("key",Z?.toLowerCase(),$),$?.name==="return"){if(this.opts.validate){let Q=this.opts.validate(this.value);if(Q)this.error=Q instanceof Error?Q.message:Q,this.state="error"}if(this.state!=="error")this.state="submit"}if(K0([Z,$?.name,$?.sequence],"cancel"))this.state="cancel";if(this.state==="submit"||this.state==="cancel")this.emit("finalize");if(this.render(),this.state==="submit"||this.state==="cancel")this.close()}close(){if(this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
19
- `),E(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.state==="cancel")setTimeout(()=>{this.unsubscribe()},10);else this.unsubscribe()}restoreCursor(){let Z=U0(this._prevFrame,Q0.stdout.columns,{hard:!0,trim:!1}).split(`
20
- `).length-1;this.output.write(w.move(-999,Z*-1))}render(){let Z=U0(this._render(this)??"",Q0.stdout.columns,{hard:!0,trim:!1});if(Z===this._prevFrame)return;if(this.state==="initial")this.output.write(w.hide);else{let $=d0(this._prevFrame,Z);if(this.restoreCursor(),$&&$?.length===1){let Q=$[0];this.output.write(w.move(0,Q)),this.output.write(g.lines(1));let z=Z.split(`
21
- `);this.output.write(z[Q]),this._prevFrame=Z,this.output.write(w.move(0,z.length-Q-1));return}if($&&$?.length>1){let Q=$[0];this.output.write(w.move(0,Q)),this.output.write(g.down());let J=Z.split(`
22
- `).slice(Q);this.output.write(J.join(`
23
- `)),this._prevFrame=Z;return}this.output.write(g.down())}if(this.output.write(Z),this.state==="initial")this.state="active";this._prevFrame=Z}}function GZ(Z,$){if(Z===void 0)return 0;if($.length===0)return 0;let z=$.findIndex((J)=>J.value===Z);return z!==-1?z:0}function qZ(Z,$){return($.label??String($.value)).toLowerCase().includes(Z.toLowerCase())}function FZ(Z,$){if(!$)return;if(Z)return $;return $[0]}class KZ extends p{filteredOptions;multiple;isNavigating=!1;selectedValues=[];focusedValue;#Z=0;#Q="";#z;#$;get cursor(){return this.#Z}get userInputWithCursor(){if(!this.userInput)return _.default.inverse(_.default.hidden("_"));if(this._cursor>=this.userInput.length)return`${this.userInput}\u2588`;let Z=this.userInput.slice(0,this._cursor),[$,...Q]=this.userInput.slice(this._cursor);return`${Z}${_.default.inverse($)}${Q.join("")}`}get options(){if(typeof this.#$==="function")return this.#$();return this.#$}constructor(Z){super(Z);this.#$=Z.options;let $=this.options;this.filteredOptions=[...$],this.multiple=Z.multiple===!0,this.#z=Z.filter??qZ;let Q;if(Z.initialValue&&Array.isArray(Z.initialValue))if(this.multiple)Q=Z.initialValue;else Q=Z.initialValue.slice(0,1);else if(!this.multiple&&this.options.length>0)Q=[this.options[0].value];if(Q)for(let z of Q){let J=$.findIndex((Y)=>Y.value===z);if(J!==-1)this.toggleSelected(z),this.#Z=J}this.focusedValue=this.options[this.#Z]?.value,this.on("key",(z,J)=>this.#J(z,J)),this.on("userInput",(z)=>this.#Y(z))}_isActionKey(Z,$){return Z==="\t"||this.multiple&&this.isNavigating&&$.name==="space"&&Z!==void 0&&Z!==""}#J(Z,$){let Q=$.name==="up",z=$.name==="down",J=$.name==="return";if(Q||z){if(this.#Z=Math.max(0,Math.min(this.#Z+(Q?-1:1),this.filteredOptions.length-1)),this.focusedValue=this.filteredOptions[this.#Z]?.value,!this.multiple)this.selectedValues=[this.focusedValue];this.isNavigating=!0}else if(J)this.value=FZ(this.multiple,this.selectedValues);else if(this.multiple)if(this.focusedValue!==void 0&&($.name==="tab"||this.isNavigating&&$.name==="space"))this.toggleSelected(this.focusedValue);else this.isNavigating=!1;else{if(this.focusedValue)this.selectedValues=[this.focusedValue];this.isNavigating=!1}}deselectAll(){this.selectedValues=[]}toggleSelected(Z){if(this.filteredOptions.length===0)return;if(this.multiple)if(this.selectedValues.includes(Z))this.selectedValues=this.selectedValues.filter(($)=>$!==Z);else this.selectedValues=[...this.selectedValues,Z];else this.selectedValues=[Z]}#Y(Z){if(Z!==this.#Q){this.#Q=Z;let $=this.options;if(Z)this.filteredOptions=$.filter((Q)=>this.#z(Z,Q));else this.filteredOptions=[...$];if(this.#Z=GZ(this.focusedValue,this.filteredOptions),this.focusedValue=this.filteredOptions[this.#Z]?.value,!this.multiple)if(this.focusedValue!==void 0)this.toggleSelected(this.focusedValue);else this.deselectAll()}}}class HZ extends p{options;cursor=0;#Z;getGroupItems(Z){return this.options.filter(($)=>$.group===Z)}isGroupSelected(Z){let $=this.getGroupItems(Z),Q=this.value;if(Q===void 0)return!1;return $.every((z)=>Q.includes(z.value))}toggleValue(){let Z=this.options[this.cursor];if(this.value===void 0)this.value=[];if(Z.group===!0){let $=Z.value,Q=this.getGroupItems($);if(this.isGroupSelected($))this.value=this.value.filter((z)=>Q.findIndex((J)=>J.value===z)===-1);else this.value=[...this.value,...Q.map((z)=>z.value)];this.value=Array.from(new Set(this.value))}else{let $=this.value.includes(Z.value);this.value=$?this.value.filter((Q)=>Q!==Z.value):[...this.value,Z.value]}}constructor(Z){super(Z,!1);let{options:$}=Z;this.#Z=Z.selectableGroups!==!1,this.options=Object.entries($).flatMap(([Q,z])=>[{value:Q,group:!0,label:Q},...z.map((J)=>({...J,group:Q}))]),this.value=[...Z.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:Q})=>Q===Z.cursorAt),this.#Z?0:1),this.on("cursor",(Q)=>{switch(Q){case"left":case"up":{this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;let z=this.options[this.cursor]?.group===!0;if(!this.#Z&&z)this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break}case"down":case"right":{this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;let z=this.options[this.cursor]?.group===!0;if(!this.#Z&&z)this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}case"space":this.toggleValue();break}})}}var SZ=L(N(),1);var gZ=L(N(),1);var _Z=L(N(),1),B={red:["\x1B[31m","\x1B[39m"],green:["\x1B[32m","\x1B[39m"],blue:["\x1B[34m","\x1B[39m"],yellow:["\x1B[33m","\x1B[39m"],cyan:["\x1B[36m","\x1B[39m"],magenta:["\x1B[35m","\x1B[39m"],white:["\x1B[37m","\x1B[39m"],gray:["\x1B[90m","\x1B[39m"],bgRed:["\x1B[41m","\x1B[49m"],bgGreen:["\x1B[42m","\x1B[49m"],bgBlue:["\x1B[44m","\x1B[49m"],bgYellow:["\x1B[43m","\x1B[49m"],bgCyan:["\x1B[46m","\x1B[49m"],bgMagenta:["\x1B[45m","\x1B[49m"],bold:["\x1B[1m","\x1B[22m"],italic:["\x1B[3m","\x1B[23m"],underline:["\x1B[4m","\x1B[24m"],dim:["\x1B[2m","\x1B[22m"],inverse:["\x1B[7m","\x1B[27m"],hidden:["\x1B[8m","\x1B[28m"],strikethrough:["\x1B[9m","\x1B[29m"]},P={primary:"blue",secondary:"cyan",success:"green",warning:"yellow",error:"red",info:"magenta",muted:"gray"};function VZ(){return!0}function DZ(){let Z={};Z.supportsColor=VZ();function $(z,J=[]){let Y=z===""?[]:[...J,z],X=function(q){if(!Z.supportsColor)return q;let G="",U="";for(let F of Y)if(F in P&&P[F]in B){let K=P[F];G+=B[K][0],U=B[K][1]+U}else if(F in B)G+=B[F][0],U=B[F][1]+U;return G+q+U},j=[...Object.keys(B),...Object.keys(P)];for(let q of j)if(!(q in X))Object.defineProperty(X,q,{get(){return $(q,Y)}});return X}let Q=[...Object.keys(B),...Object.keys(P)];for(let z of Q)if(!(z in Z))Object.defineProperty(Z,z,{get(){return $(z)}});return Z}var dZ=DZ();var WZ=h0();var W=(Z,$)=>WZ?Z:$,uZ=W("\u25C6","*"),mZ=W("\u25A0","x"),xZ=W("\u25B2","x"),lZ=W("\u25C7","o"),nZ=W("\u250C","T"),LZ=W("\u2502","|"),aZ=W("\u2514","\u2014"),cZ=W("\u25CF",">"),pZ=W("\u25CB"," "),iZ=W("\u25FB","[\u2022]"),rZ=W("\u25FC","[+]"),sZ=W("\u25FB","[ ]"),eZ=W("\u25AA","\u2022"),tZ=W("\u2500","-"),oZ=W("\u256E","+"),Z1=W("\u251C","+"),$1=W("\u256F","+"),Q1=W("\u25CF","\u2022"),z1=W("\u25C6","*"),J1=W("\u25B2","!"),Y1=W("\u25A0","x");var j1=L(N(),1);var X1=L(N(),1);var U1=L(N(),1);var G1=L(N(),1);var q1=L(N(),1);var F1=L(N(),1);var K1=L(N(),1);var H1=L(N(),1);var V1=L(N(),1),D1=L(N(),1);var W1={light:W("\u2500","-"),heavy:W("\u2501","="),block:W("\u2588","#")};var L1=L(N(),1);var M1=L(N(),1);var MZ=L(N(),1);function NZ(){return`${MZ.default.gray(LZ)} `}var N1=NZ();var O1=L(N(),1);var w1=L(N(),1);var i="0.9.8";var R=new a("dtsx"),O={cwd:L0.cwd(),root:"./src",entrypoints:["**/*.ts"],outdir:"./dist",keepComments:!0,clean:!1,tsconfigPath:"tsconfig.json",verbose:!1};R.command("generate","Generate TypeScript declaration files").option("--cwd <path>","Current working directory",{default:O.cwd}).option("--root <path>","Root directory of the project",{default:O.root}).option("--entrypoints <files>","Entry point files (comma-separated)",{default:O.entrypoints?.join(","),type:[String]}).option("--outdir <path>","Output directory for generated .d.ts files",{default:O.outdir}).option("--keep-comments","Keep comments in generated .d.ts files",{default:O.keepComments}).option("--clean","Clean output directory before generation",{default:O.clean}).option("--tsconfig <path>","Path to tsconfig.json",{default:O.tsconfigPath}).option("--verbose","Enable verbose logging",{default:O.verbose}).example("dtsx generate").example("dtsx generate --entrypoints src/index.ts,src/utils.ts --outdir dist/types").action(async(Z)=>{try{let $={entrypoints:Z.entrypoints?Z.entrypoints:O.entrypoints,cwd:y(Z.cwd||O.cwd),root:y(Z.root||O.root),outdir:y(Z.outdir||O.outdir),tsconfigPath:y(Z.tsconfigPath||O.tsconfigPath),keepComments:Z.keepComments||O.keepComments,clean:Z.clean||O.clean,verbose:Z.verbose||O.verbose};await W0($)}catch($){console.error("Error generating .d.ts files:",$),L0.exit(1)}});R.command("version","Show the version of dtsx").action(()=>{console.log(i)});R.version(i);R.help();R.parse();
2
+ import{cd as Y}from"../chunk-rw6j20e2.js";import V from"process";var f=V.argv[2];if(f==="stdin"||f==="emit"||f==="--project"){if(f==="stdin"){let{processSource:q}=await import("../chunk-0kmfaaz6.js"),Q=[];for await(let N of V.stdin)Q.push(N);let K=Buffer.concat(Q).toString("utf-8");if(K.trim())V.stdout.write(q(K,"stdin.ts")),V.stdout.write(`
3
+ `)}else if(f==="--project"){let{readdirSync:q,readFileSync:Q,writeFileSync:K,mkdirSync:N}=await import("fs"),A=typeof globalThis.Bun<"u",J=A?globalThis.Bun:null,$=V.argv.slice(3),z="",B="",G=!1;for(let X=0;X<$.length;X++)if($[X]==="--outdir"&&$[X+1])B=$[X+1],X++;else if($[X]==="--isolated-declarations")G=!0;else if(!z)z=$[X];N(B,{recursive:!0});let j=q(z).filter((X)=>X.endsWith(".ts")&&!X.endsWith(".d.ts")),Z=j.length,E=Array(Z),M=Array(Z);for(let X=0;X<Z;X++)E[X]=`${z}/${j[X]}`,M[X]=`${B}/${j[X].slice(0,-3)}.d.ts`;let T=["bun"],R=A&&Z>=64,I=!1,_=null;if(R){let X=null;try{let{createWorkerPool:F,calculateOptimalBatchSize:D}=await import("../chunk-r1m3q3dj.js"),{cpus:C}=await import("os"),w=Math.max(1,C().length-1),U=Math.min(64,Math.max(8,D(Z,w)*2)),L=Z>=256,a=!0,l=Z>=256;if(!L&&Z>=256){_=Array(Z);for(let x=0;x<Z;x++)_[x]=J.file(E[x]).text()}let O=Math.ceil(Z/U),u=Math.min(O,Math.max(2,w*2));X=F({maxWorkers:w,initialWorkers:w,recycleAfter:Math.max(100,O+1)}),await X.init();let d=X,i=0,r=Date.now(),t=async()=>{for(;;){let x=i++;if(x>=O)return;let S=x*U;if(S>=Z)return;let g=Math.min(Z,S+U)-S,m;if(l){let P=Array(g),y=Array(g),b;if(L)for(let W=0;W<g;W++){let v=S+W;P[W]=E[v],y[W]=M[v]}else{let W=Array(g);for(let v=0;v<g;v++){let c=S+v;P[v]=E[c],y[v]=M[c],W[v]=_?_[c]:J.file(E[c]).text()}b=await Promise.all(W)}m=await d.submit({id:`batch-${r}-${x}`,type:"process-batch",filePath:P[0]||"",filePaths:P,sources:b,outPaths:y,writeOutput:!0,config:{keepComments:!0,importOrder:T,isolatedDeclarations:G}})}else{let P=Array(g);if(L)for(let y=0;y<g;y++){let b=S+y;P[y]={filePath:E[b],outPath:M[b]}}else{let y=Array(g);for(let W=0;W<g;W++){let v=S+W;y[W]=_?_[v]:J.file(E[v]).text()}let b=await Promise.all(y);for(let W=0;W<g;W++){let v=S+W;P[W]={filePath:E[v],sourceCode:b[W],outPath:M[v]}}}m=await d.submit({id:`batch-${r}-${x}`,type:"process-batch",filePath:E[S]||"",files:P,writeOutput:!0,config:{keepComments:!0,importOrder:T,isolatedDeclarations:G}})}if(!m.success)throw Error(m.error||`Worker batch failed for ${E[S]}`);if(m.batchResults?.length){let P=m.batchResults[0];throw Error(P?.error||m.error||`Worker failed for ${E[S]}`)}}},n=[];for(let x=0;x<u;x++)n.push(t());await Promise.all(n),I=!0}catch{I=!1}finally{if(X)await X.shutdown()}}if(!I){let{scanDeclarations:X}=await import("../chunk-axb2kjeq.js"),{processDeclarations:F}=await import("../chunk-6ppqaypd.js"),D=Array(Z);if(A){let U=_?await Promise.all(_):await Promise.all(E.map((L)=>J.file(L).text()));for(let L=0;L<Z;L++)D[L]=U[L]}else for(let U=0;U<Z;U++)D[U]=Q(E[U],"utf-8");let C=Array(Z),w={filePath:"",sourceCode:"",declarations:[]};for(let U=0;U<Z;U++){let L=X(D[U],j[U],!0,G);w.filePath=j[U],w.sourceCode=D[U],w.declarations=L,C[U]=F(L,w,!0,T)}if(A){let U=Array(Z);for(let L=0;L<Z;L++)U[L]=J.write(M[L],C[L]);await Promise.all(U)}else for(let U=0;U<Z;U++)K(M[U],C[U])}}else{let{processSource:q}=await import("../chunk-0kmfaaz6.js"),{readFileSync:Q,writeFileSync:K,mkdirSync:N}=await import("fs"),A=typeof globalThis.Bun<"u",J=A?globalThis.Bun:null,$=V.argv[3],z=A?await J.file($).text():Q($,"utf-8"),B=V.argv[4];if(B){let{dirname:G}=await import("path");N(G(B),{recursive:!0});let j=`${q(z,$)}
4
+ `;if(A)await J.write(B,j);else K(B,j)}else V.stdout.write(q(z,$)),V.stdout.write(`
5
+ `)}V.exit(0)}var{resolve:h}=await import("path"),{CLI:s}=await import("../chunk-v96rjx7x.js"),{version:e}=await import("../chunk-h12gdfk9.js"),{getConfig:o}=await import("../chunk-6s7n1gt0.js"),{generate:qq,processSource:Hq,watch:Kq}=await import("../chunk-pyxbb193.js"),k=new s("dtsx"),H={cwd:V.cwd(),root:"./src",entrypoints:["**/*.ts"],outdir:"./dist",keepComments:!0,clean:!1,tsconfigPath:"tsconfig.json",verbose:!1,importOrder:["bun"],dryRun:!1,stats:!1,continueOnError:!1,logLevel:"info",exclude:[],outputFormat:"text",progress:!1,diff:!1,validate:!1,parallel:!1,concurrency:4};k.command("generate","Generate TypeScript declaration files").option("--cwd <path>","Current working directory",{default:H.cwd}).option("--root <path>","Root directory of the project",{default:H.root}).option("--entrypoints <files>","Entry point files (comma-separated)",{default:H.entrypoints?.join(","),type:[String]}).option("--outdir <path>","Output directory for generated .d.ts files",{default:H.outdir}).option("--keep-comments","Keep comments in generated .d.ts files",{default:H.keepComments}).option("--clean","Clean output directory before generation",{default:H.clean}).option("--tsconfig <path>","Path to tsconfig.json",{default:H.tsconfigPath}).option("--verbose","Enable verbose logging",{default:H.verbose}).option("--import-order <patterns>","Import order priority patterns (comma-separated)",{default:H.importOrder?.join(","),type:[String]}).option("--dry-run","Show what would be generated without writing files",{default:H.dryRun}).option("--stats","Show statistics after generation",{default:H.stats}).option("--continue-on-error","Continue processing other files if one fails",{default:H.continueOnError}).option("--log-level <level>","Log level (debug, info, warn, error, silent)",{default:H.logLevel}).option("--exclude <patterns>","Glob patterns to exclude (comma-separated)",{default:H.exclude?.join(","),type:[String]}).option("--output-format <format>","Output format: text or json",{default:H.outputFormat}).option("--progress","Show progress during generation",{default:H.progress}).option("--diff","Show diff of changes compared to existing files",{default:H.diff}).option("--validate","Validate generated .d.ts files against TypeScript",{default:H.validate}).option("--parallel","Process files in parallel",{default:H.parallel}).option("--concurrency <number>","Number of concurrent workers (with --parallel)",{default:H.concurrency}).option("--declaration-map","Generate declaration map files (.d.ts.map)",{default:!1}).option("--bundle","Bundle all declarations into a single output file",{default:!1}).option("--bundle-output <file>","Output filename when bundling (relative to outdir)",{default:"index.d.ts"}).option("--config <path>","Path to config file (dtsx.config.ts)",{default:""}).option("--incremental","Enable incremental builds (only regenerate changed files)",{default:!1}).option("--clear-cache","Clear the incremental build cache before generating",{default:!1}).option("--indent-style <style>","Indentation style: spaces or tabs",{default:"spaces"}).option("--indent-size <size>","Number of spaces for indentation",{default:2}).option("--prettier","Use Prettier for output formatting if available",{default:!1}).example("dtsx generate").example("dtsx generate --entrypoints src/index.ts,src/utils.ts --outdir dist/types").example('dtsx generate --import-order "node:,bun,@myorg/"').example("dtsx generate --dry-run --stats").example('dtsx generate --exclude "**/*.test.ts,**/__tests__/**"').example("dtsx generate --stats --output-format json").example("dtsx generate --bundle --bundle-output types.d.ts").action(async(q)=>{try{let Q=h(q.cwd||H.cwd),K=await o(Q),N={entrypoints:q.entrypoints?q.entrypoints:K.entrypoints||H.entrypoints,cwd:Q,root:h(q.root||K.root||H.root),outdir:h(q.outdir||K.outdir||H.outdir),tsconfigPath:h(q.tsconfigPath||K.tsconfigPath||H.tsconfigPath),keepComments:q.keepComments??K.keepComments??H.keepComments,clean:q.clean??K.clean??H.clean,verbose:q.verbose??K.verbose??H.verbose,importOrder:q.importOrder||K.importOrder||H.importOrder,dryRun:q.dryRun??K.dryRun??H.dryRun,stats:q.stats??K.stats??H.stats,continueOnError:q.continueOnError??K.continueOnError??H.continueOnError,logLevel:q.logLevel??K.logLevel??H.logLevel,exclude:q.exclude?q.exclude.flatMap((J)=>J.split(",").map(($)=>$.trim()).filter(Boolean)):K.exclude||H.exclude,outputFormat:q.outputFormat??K.outputFormat??H.outputFormat,progress:q.progress??K.progress??H.progress,diff:q.diff??K.diff??H.diff,validate:q.validate??K.validate??H.validate,parallel:q.parallel??K.parallel??H.parallel,concurrency:Number(q.concurrency)||K.concurrency||H.concurrency,declarationMap:q.declarationMap??K.declarationMap??!1,bundle:q.bundle??K.bundle??!1,bundleOutput:q.bundleOutput??K.bundleOutput??"index.d.ts",incremental:q.incremental??K.incremental??!1,clearCache:q.clearCache??!1,indentStyle:q.indentStyle??K.indentStyle??"spaces",indentSize:Number(q.indentSize)||K.indentSize||2,prettier:q.prettier??K.prettier??!1,plugins:K.plugins},A=await qq(N);if(A.filesFailed>0&&A.filesGenerated===0)V.exit(1);else if(A.filesFailed>0)V.exit(2)}catch(Q){console.error("Error generating .d.ts files:",Q),V.exit(1)}});k.command("watch","Watch for changes and regenerate .d.ts files").option("--cwd <path>","Current working directory",{default:H.cwd}).option("--root <path>","Root directory of the project",{default:H.root}).option("--entrypoints <files>","Entry point files (comma-separated)",{default:H.entrypoints?.join(","),type:[String]}).option("--outdir <path>","Output directory for generated .d.ts files",{default:H.outdir}).option("--keep-comments","Keep comments in generated .d.ts files",{default:H.keepComments}).option("--exclude <patterns>","Glob patterns to exclude (comma-separated)",{default:H.exclude?.join(","),type:[String]}).option("--log-level <level>","Log level (debug, info, warn, error, silent)",{default:H.logLevel}).example("dtsx watch").example("dtsx watch --root src --outdir dist/types").action(async(q)=>{try{let Q={entrypoints:q.entrypoints?q.entrypoints:H.entrypoints,cwd:h(q.cwd||H.cwd),root:h(q.root||H.root),outdir:h(q.outdir||H.outdir),keepComments:q.keepComments??H.keepComments,exclude:q.exclude?q.exclude.flatMap((K)=>K.split(",").map((N)=>N.trim()).filter(Boolean)):H.exclude,logLevel:q.logLevel??H.logLevel};await Kq(Q)}catch(Q){console.error("Error in watch mode:",Q),V.exit(1)}});k.command("stdin","Process TypeScript from stdin and output .d.ts to stdout").option("--keep-comments","Keep comments in generated .d.ts files",{default:!0}).option("--import-order <patterns>","Import order priority patterns (comma-separated)",{default:"bun",type:[String]}).example(`echo "export const foo: string = 'bar'" | dtsx stdin`).example("cat src/index.ts | dtsx stdin").action(async(q)=>{try{let Q=[];for await(let J of V.stdin)Q.push(J);let K=Buffer.concat(Q).toString("utf-8");if(!K.trim())console.error("Error: No input received from stdin"),V.exit(1);let N=["bun"];if(q.importOrder){if(Array.isArray(q.importOrder))N=q.importOrder.flatMap((J)=>J.split(",").map(($)=>$.trim()).filter(Boolean));else if(typeof q.importOrder==="string")N=q.importOrder.split(",").map((J)=>J.trim()).filter(Boolean)}let A=Hq(K,"stdin.ts",q.keepComments??!0,N);console.log(A)}catch(Q){console.error("Error processing stdin:",Q),V.exit(1)}});k.command("optimize","Optimize declaration files").option("--files <patterns>","Glob patterns for .d.ts files to optimize",{default:"**/*.d.ts",type:[String]}).option("--outdir <path>","Output directory (defaults to in-place)",{default:""}).option("--remove-unused-imports","Remove unused type imports",{default:!0}).option("--deduplicate","Remove duplicate declarations",{default:!0}).option("--merge-interfaces","Merge interface declarations with same name",{default:!0}).option("--inline-types","Inline simple type aliases",{default:!1}).option("--remove-empty","Remove empty interfaces",{default:!0}).option("--sort","Sort declarations alphabetically",{default:!1}).option("--sort-imports","Sort imports",{default:!0}).option("--minify","Minify output (remove whitespace)",{default:!1}).option("--remove-comments","Remove comments",{default:!1}).example('dtsx optimize --files "dist/**/*.d.ts"').example("dtsx optimize --minify --remove-comments").action(async(q)=>{try{let{optimizeFile:Q}=await import("../chunk-k5h5ppp5.js"),{Glob:K}=awaitPromise.resolve(globalThis.Bun),{resolve:N,join:A,relative:J,dirname:$,basename:z}=await import("path"),{mkdirSync:B,copyFileSync:G,existsSync:j}=await import("fs"),Z=V.cwd(),E=q.files||["**/*.d.ts"],M=[];for(let _ of E){let X=new K(_);for await(let F of X.scan({cwd:Z,absolute:!0,onlyFiles:!0}))if(F.endsWith(".d.ts")&&!F.includes("node_modules"))M.push(F)}if(M.length===0)console.error("No .d.ts files found"),V.exit(1);console.log(`Optimizing ${M.length} declaration files...`);let T=0,R=0;for(let _ of M){let X=_;if(q.outdir){let C=J(Z,_);X=A(N(q.outdir),C);let w=$(X);if(!j(w))B(w,{recursive:!0});G(_,X)}let F=await Q(X,{removeUnusedImports:q.removeUnusedImports??!0,deduplicateDeclarations:q.deduplicate??!0,mergeInterfaces:q.mergeInterfaces??!0,inlineSimpleTypes:q.inlineTypes??!1,removeEmptyInterfaces:q.removeEmpty??!0,sortDeclarations:q.sort??!1,sortImports:q.sortImports??!0,minify:q.minify??!1,removeComments:q.removeComments??!1});R+=F.originalSize,T+=F.savings;let D=J(Z,X);console.log(` ${D}: ${F.originalSize}B -> ${F.optimizedSize}B (-${F.savingsPercent}%)`)}let I=R>0?Math.round(T/R*100):0;console.log(`
6
+ Total: ${R}B -> ${R-T}B (-${I}%)`)}catch(Q){console.error("Error optimizing files:",Q),V.exit(1)}});k.command("docs","Generate API documentation from source files").option("--root <path>","Root directory to scan for source files",{default:"./src"}).option("--outdir <path>","Output directory for documentation",{default:"./docs"}).option("--format <format>","Output format: markdown or html",{default:"markdown"}).option("--title <title>","Documentation title",{default:"API Documentation"}).option("--include-private","Include private members (prefixed with _)",{default:!1}).option("--include-internal","Include internal members (@internal)",{default:!1}).option("--group-by-category","Group entries by @category tag",{default:!1}).option("--source-url <url>","Base URL for source links").example("dtsx docs").example("dtsx docs --format html --outdir ./api-docs").example('dtsx docs --group-by-category --title "My API"').action(async(q)=>{try{let{generateDocs:Q}=await import("../chunk-jvz9t6pq.js"),{Glob:K}=awaitPromise.resolve(globalThis.Bun),{resolve:N}=await import("path"),A=N(q.root||"./src"),J=new K("**/*.ts"),$=[];for await(let z of J.scan({cwd:A,absolute:!0,onlyFiles:!0}))if(!z.endsWith(".d.ts")&&!z.includes("node_modules"))$.push(z);if($.length===0)console.error("No TypeScript files found"),V.exit(1);console.log(`Found ${$.length} source files`),await Q($,{format:q.format||"markdown",outdir:N(q.outdir||"./docs"),title:q.title||"API Documentation",includePrivate:q.includePrivate??!1,includeInternal:q.includeInternal??!1,groupByCategory:q.groupByCategory??!1,includeSourceLinks:!!q.sourceUrl,sourceBaseUrl:q.sourceUrl})}catch(Q){console.error("Error generating documentation:",Q),V.exit(1)}});k.command("workspace","Generate declarations for all projects in a monorepo/workspace").option("--cwd <path>","Workspace root directory",{default:V.cwd()}).option("--parallel","Process projects in parallel",{default:!1}).option("--continue-on-error","Continue if a project fails",{default:!0}).option("--log-level <level>","Log level (debug, info, warn, error, silent)",{default:"info"}).example("dtsx workspace").example("dtsx workspace --cwd /path/to/monorepo").action(async(q)=>{try{let{generateMonorepo:Q,generateFromPackageWorkspaces:K}=await import("../chunk-rrkq4k1n.js"),{existsSync:N}=await import("fs"),{join:A,resolve:J}=await import("path"),$=J(q.cwd||V.cwd()),z=A($,"tsconfig.json"),B;if(N(z))B=await Q($,{logLevel:q.logLevel||"info",continueOnError:q.continueOnError??!0});else B=await K($,{logLevel:q.logLevel||"info",continueOnError:q.continueOnError??!0});if(!B.success)V.exit(1)}catch(Q){console.error("Error generating workspace declarations:",Q),V.exit(1)}});k.command("lsp","Start the Language Server Protocol server for IDE integration").example("dtsx lsp").action(async()=>{let{startLSPServer:q}=await import("../chunk-c18vx9sq.js");q()});k.command("check","Type check TypeScript files or validate generated declarations").option("--files <patterns>","Glob patterns for files to check",{default:"**/*.ts",type:[String]}).option("--declarations-only","Only check .d.ts files",{default:!1}).option("--tsconfig <path>","Path to tsconfig.json",{default:"tsconfig.json"}).option("--strict","Enable strict type checking",{default:!1}).option("--skip-lib-check","Skip checking library definitions",{default:!0}).option("--warnings-as-errors","Treat warnings as errors",{default:!1}).option("--max-errors <number>","Maximum errors before stopping",{default:0}).option("--isolated-declarations","Check if code follows isolated declarations best practices (recommended)",{default:!1}).option("--format <format>","Output format: text or json",{default:"text"}).example("dtsx check").example('dtsx check --files "src/**/*.ts" --strict').example('dtsx check --declarations-only --files "dist/**/*.d.ts"').example("dtsx check --isolated-declarations").action(async(q)=>{try{let{typeCheck:Q,checkIsolatedDeclarations:K,formatTypeCheckResults:N}=await import("../chunk-7cpp6v8f.js"),{Glob:A}=awaitPromise.resolve(globalThis.Bun),{resolve:J,relative:$}=await import("path"),z=V.cwd(),B=q.files||["**/*.ts"],G=[];for(let Z of B){let E=new A(Z);for await(let M of E.scan({cwd:z,absolute:!0,onlyFiles:!0}))if(!M.includes("node_modules"))if(q.declarationsOnly){if(M.endsWith(".d.ts"))G.push(M)}else G.push(M)}if(G.length===0)console.error("No files found to check"),V.exit(1);if(q.isolatedDeclarations){console.log(`Checking ${G.length} files for isolated declarations best practices...`);let Z=await K(G,q.tsconfig?J(q.tsconfig):void 0),E=0,M=[];for(let[T,R]of Z){let I=$(z,T);if(!R.compatible)if(E+=R.issues.length,q.format==="json")M.push({file:I,compatible:!1,issues:R.issues});else{console.log(`
7
+ \u2717 ${I}`);for(let _ of R.issues)if(console.log(` ${_.line}:${_.column} - ${_.message}`),_.missingAnnotation)console.log(` Missing: ${_.missingAnnotation} type annotation`)}else if(q.format==="json")M.push({file:I,compatible:!0,issues:[]})}if(q.format==="json")console.log(JSON.stringify(M,null,2));else if(E>0)console.log(`
8
+ ${G.length} files checked, ${E} recommendations found`),console.log("Tip: Adding explicit type annotations improves .d.ts accuracy");else console.log(`
9
+ ${G.length} files checked, all follow isolated declarations best practices`);V.exit(E>0?1:0)}console.log(`Type checking ${G.length} files...`);let j=await Q(G,{tsconfigPath:q.tsconfig?J(q.tsconfig):void 0,strict:q.strict??!1,declarationsOnly:q.declarationsOnly??!1,skipLibCheck:q.skipLibCheck??!0,warningsAsErrors:q.warningsAsErrors??!1,maxErrors:q.maxErrors||void 0});if(q.format==="json")console.log(JSON.stringify(j,null,2));else console.log(N(j));V.exit(j.success?0:1)}catch(Q){console.error("Error during type checking:",Q),V.exit(1)}});k.command("convert","Convert TypeScript types to different schema formats").option("--files <patterns>","Glob patterns for TypeScript files",{default:"**/*.ts",type:[String]}).option("--format <format>","Output format: json-schema, zod, valibot, io-ts, yup, arktype",{default:"json-schema"}).option("--outdir <path>","Output directory for converted files",{default:"./schemas"}).option("--include-descriptions","Include JSDoc descriptions in output",{default:!0}).option("--all-optional","Make all properties optional",{default:!1}).option("--use-infer","Include inferred types (for Zod, Valibot, etc.)",{default:!0}).option("--json-schema-draft <version>","JSON Schema draft version: 2020-12, 2019-09, draft-07",{default:"2020-12"}).example("dtsx convert --format zod").example('dtsx convert --format json-schema --files "src/types/**/*.ts"').example("dtsx convert --format valibot --outdir ./validation").action(async(q)=>{try{let Q=await import("../chunk-3g2v2ns2.js"),{extractDeclarations:K}=await import("../chunk-2f046tgr.js"),{Glob:N}=awaitPromise.resolve(globalThis.Bun),{resolve:A,relative:J,join:$,dirname:z,basename:B}=await import("path"),{mkdirSync:G,existsSync:j,readFileSync:Z,writeFileSync:E}=await import("fs"),M=V.cwd(),T=q.files||["**/*.ts"],R=q.format||"json-schema",I=A(q.outdir||"./schemas"),_=[];for(let D of T){let C=new N(D);for await(let w of C.scan({cwd:M,absolute:!0,onlyFiles:!0}))if(!w.endsWith(".d.ts")&&!w.includes("node_modules"))_.push(w)}if(_.length===0)console.error("No TypeScript files found"),V.exit(1);if(console.log(`Converting ${_.length} files to ${R} format...`),!j(I))G(I,{recursive:!0});let X=0,F=0;for(let D of _){let C=Z(D,"utf-8"),U=K(C,D).filter((d)=>d.kind==="interface"||d.kind==="type");if(U.length===0)continue;let L=Q.convertToFormat(U,{format:R,includeDescriptions:q.includeDescriptions??!0,allOptional:q.allOptional??!1,useInfer:q.useInfer??!0,jsonSchemaDraft:q.jsonSchemaDraft||"2020-12"}),a=J(M,D),l=B(D,".ts"),p=Q.getFormatExtension(R),O=$(I,z(a),`${l}${p}`),u=z(O);if(!j(u))G(u,{recursive:!0});E(O,L),X+=U.length,F++,console.log(` ${J(M,O)} (${U.length} types)`)}console.log(`
10
+ Converted ${X} declarations from ${F} files`)}catch(Q){console.error("Error converting files:",Q),V.exit(1)}});k.command("circular","Detect circular dependencies in TypeScript files").option("--files <patterns>","Glob patterns for files to check",{default:"**/*.ts",type:[String]}).option("--root <path>","Root directory for resolution",{default:"."}).option("--ignore <patterns>","Glob patterns to ignore (comma-separated)",{default:"",type:[String]}).option("--types-only","Only report type-level cycles",{default:!1}).option("--max-depth <number>","Maximum depth for cycle detection",{default:100}).option("--include-node-modules","Include node_modules in analysis",{default:!1}).option("--format <format>","Output format: text, json, dot",{default:"text"}).option("--summary","Show graph summary statistics",{default:!1}).example("dtsx circular").example('dtsx circular --files "src/**/*.ts"').example('dtsx circular --ignore "**/*.test.ts,**/__tests__/**"').example("dtsx circular --format dot > deps.dot").example("dtsx circular --summary").action(async(q)=>{try{let{analyzeCircularDependencies:Q,formatCircularAnalysis:K,getGraphSummary:N,exportGraphAsDot:A,exportGraphAsJson:J}=await import("../chunk-3j7r0fxz.js"),{Glob:$}=awaitPromise.resolve(globalThis.Bun),{resolve:z,relative:B}=await import("path"),G=V.cwd(),j=z(q.root||"."),Z=q.files||["**/*.ts"],E=[];for(let T of Z){let R=new $(T);for await(let I of R.scan({cwd:j,absolute:!0,onlyFiles:!0}))if(!I.endsWith(".d.ts")){if(!q.includeNodeModules&&I.includes("node_modules"))continue;E.push(I)}}if(E.length===0)console.error("No TypeScript files found"),V.exit(1);console.log(`Analyzing ${E.length} files for circular dependencies...`);let M=await Q(E,{rootDir:j,ignore:q.ignore?.filter(Boolean),typesOnly:q.typesOnly??!1,maxDepth:q.maxDepth??100,includeNodeModules:q.includeNodeModules??!1});if(q.format==="json")console.log(J(M.graph,j));else if(q.format==="dot")console.log(A(M.graph,j));else if(console.log(K(M,j)),q.summary){let T=N(M.graph);if(console.log(`
11
+ --- Dependency Graph Summary ---`),console.log(`Total files: ${T.totalFiles}`),console.log(`Total dependencies: ${T.totalDependencies}`),console.log(`Average dependencies per file: ${T.avgDependencies.toFixed(2)}`),T.maxDependencies.count>0)console.log(`Most dependencies: ${B(j,T.maxDependencies.file)} (${T.maxDependencies.count})`);if(T.mostDepended.count>0)console.log(`Most depended on: ${B(j,T.mostDepended.file)} (${T.mostDepended.count} dependents)`);if(T.isolatedFiles.length>0)console.log(`Isolated files (no dependencies): ${T.isolatedFiles.length}`)}V.exit(M.hasCircular?1:0)}catch(Q){console.error("Error analyzing dependencies:",Q),V.exit(1)}});k.command("version","Show the version of dtsx").action(()=>{console.log(e)});k.version(e);k.help();k.parse();