ccjk 12.0.0 → 12.0.2

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 (161) hide show
  1. package/dist/chunks/agent-teams.mjs +17 -18
  2. package/dist/chunks/agent.mjs +105 -102
  3. package/dist/chunks/agents.mjs +87 -77
  4. package/dist/chunks/api-cli.mjs +41 -27
  5. package/dist/chunks/api-providers.mjs +2 -4
  6. package/dist/chunks/api.mjs +22 -11
  7. package/dist/chunks/auto-bootstrap.mjs +3 -5
  8. package/dist/chunks/auto-init.mjs +3 -4
  9. package/dist/chunks/auto-updater.mjs +103 -91
  10. package/dist/chunks/banner.mjs +41 -42
  11. package/dist/chunks/boost.mjs +30 -31
  12. package/dist/chunks/ccjk-agents.mjs +6 -9
  13. package/dist/chunks/ccjk-all.mjs +703 -85
  14. package/dist/chunks/ccjk-config.mjs +6 -6
  15. package/dist/chunks/ccjk-hooks.mjs +20 -9
  16. package/dist/chunks/ccjk-mcp.mjs +64 -52
  17. package/dist/chunks/ccjk-setup.mjs +35 -25
  18. package/dist/chunks/ccjk-skills.mjs +51 -41
  19. package/dist/chunks/ccr.mjs +42 -32
  20. package/dist/chunks/ccu.mjs +16 -12
  21. package/dist/chunks/check-updates.mjs +30 -19
  22. package/dist/chunks/claude-code-config-manager.mjs +25 -10
  23. package/dist/chunks/claude-code-incremental-manager.mjs +65 -51
  24. package/dist/chunks/claude-config.mjs +2 -2
  25. package/dist/chunks/claude-wrapper.mjs +9 -6
  26. package/dist/chunks/cleanup-migration.mjs +1 -1
  27. package/dist/chunks/cli-hook.mjs +10 -3
  28. package/dist/chunks/cloud-sync.mjs +1 -1
  29. package/dist/chunks/codex-config-switch.mjs +58 -45
  30. package/dist/chunks/codex-provider-manager.mjs +29 -16
  31. package/dist/chunks/codex-uninstaller.mjs +5 -6
  32. package/dist/chunks/codex.mjs +89 -89
  33. package/dist/chunks/commands.mjs +28 -29
  34. package/dist/chunks/commands2.mjs +4 -3
  35. package/dist/chunks/commit.mjs +42 -23
  36. package/dist/chunks/completion.mjs +46 -47
  37. package/dist/chunks/config-consolidator.mjs +12 -13
  38. package/dist/chunks/config-switch.mjs +66 -53
  39. package/dist/chunks/config.mjs +10 -10
  40. package/dist/chunks/config2.mjs +53 -42
  41. package/dist/chunks/config3.mjs +107 -93
  42. package/dist/chunks/constants.mjs +2 -4
  43. package/dist/chunks/context-loader.mjs +5 -4
  44. package/dist/chunks/context.mjs +77 -76
  45. package/dist/chunks/convoy-manager.mjs +4 -4
  46. package/dist/chunks/dashboard.mjs +28 -29
  47. package/dist/chunks/doctor.mjs +68 -54
  48. package/dist/chunks/evolution.mjs +37 -38
  49. package/dist/chunks/features.mjs +103 -92
  50. package/dist/chunks/fs-operations.mjs +1 -1
  51. package/dist/chunks/health-alerts.mjs +1 -1
  52. package/dist/chunks/health-check.mjs +1 -1
  53. package/dist/chunks/help.mjs +117 -116
  54. package/dist/chunks/hook-installer.mjs +3 -2
  55. package/dist/chunks/index.mjs +20 -6
  56. package/dist/chunks/index10.mjs +1171 -0
  57. package/dist/chunks/index11.mjs +1008 -0
  58. package/dist/chunks/index12.mjs +193 -0
  59. package/dist/chunks/index13.mjs +218 -0
  60. package/dist/chunks/index14.mjs +663 -0
  61. package/dist/chunks/index2.mjs +19 -10
  62. package/dist/chunks/index3.mjs +19079 -164
  63. package/dist/chunks/index4.mjs +8 -1171
  64. package/dist/chunks/index5.mjs +7479 -884
  65. package/dist/chunks/index6.mjs +160 -184
  66. package/dist/chunks/index7.mjs +3573 -653
  67. package/dist/chunks/index8.mjs +19 -0
  68. package/dist/chunks/index9.mjs +616 -0
  69. package/dist/chunks/init.mjs +173 -173
  70. package/dist/chunks/installer.mjs +92 -82
  71. package/dist/chunks/installer2.mjs +3 -2
  72. package/dist/chunks/interview.mjs +118 -107
  73. package/dist/chunks/json-config.mjs +3 -2
  74. package/dist/chunks/linux.mjs +3863 -0
  75. package/dist/chunks/macos.mjs +69 -0
  76. package/dist/chunks/main.mjs +635 -0
  77. package/dist/chunks/marketplace.mjs +69 -66
  78. package/dist/chunks/mcp-cli.mjs +61 -48
  79. package/dist/chunks/mcp.mjs +140 -127
  80. package/dist/chunks/menu.mjs +85 -85
  81. package/dist/chunks/metrics-display.mjs +41 -40
  82. package/dist/chunks/migrator.mjs +4 -5
  83. package/dist/chunks/monitor.mjs +95 -95
  84. package/dist/chunks/notification.mjs +151 -141
  85. package/dist/chunks/onboarding.mjs +26 -15
  86. package/dist/chunks/package.mjs +1 -1
  87. package/dist/chunks/paradigm.mjs +24 -23
  88. package/dist/chunks/permission-manager.mjs +10 -11
  89. package/dist/chunks/permissions.mjs +72 -57
  90. package/dist/chunks/persistence-manager.mjs +97 -84
  91. package/dist/chunks/persistence.mjs +1 -1
  92. package/dist/chunks/platform.mjs +29 -29
  93. package/dist/chunks/plugin.mjs +104 -105
  94. package/dist/chunks/prompts.mjs +36 -25
  95. package/dist/chunks/providers.mjs +68 -69
  96. package/dist/chunks/quick-actions.mjs +71 -72
  97. package/dist/chunks/quick-provider.mjs +56 -40
  98. package/dist/chunks/quick-setup.mjs +71 -60
  99. package/dist/chunks/remote.mjs +21 -12
  100. package/dist/chunks/session.mjs +116 -103
  101. package/dist/chunks/sessions.mjs +29 -28
  102. package/dist/chunks/silent-updater.mjs +8 -10
  103. package/dist/chunks/simple-config.mjs +13 -10
  104. package/dist/chunks/skill.mjs +8560 -103
  105. package/dist/chunks/skills-sync.mjs +5212 -79
  106. package/dist/chunks/skills.mjs +105 -94
  107. package/dist/chunks/slash-commands.mjs +36 -37
  108. package/dist/chunks/smart-defaults.mjs +7 -3
  109. package/dist/chunks/smart-guide.mjs +1 -1
  110. package/dist/chunks/startup.mjs +2 -4
  111. package/dist/chunks/stats.mjs +41 -42
  112. package/dist/chunks/status.mjs +49 -50
  113. package/dist/chunks/team.mjs +24 -12
  114. package/dist/chunks/thinking.mjs +74 -63
  115. package/dist/chunks/trace.mjs +20 -19
  116. package/dist/chunks/uninstall.mjs +69 -56
  117. package/dist/chunks/update.mjs +39 -28
  118. package/dist/chunks/upgrade-manager.mjs +24 -18
  119. package/dist/chunks/version-checker.mjs +45 -41
  120. package/dist/chunks/vim.mjs +81 -69
  121. package/dist/chunks/windows.mjs +14 -0
  122. package/dist/chunks/workflows.mjs +15 -15
  123. package/dist/chunks/wsl.mjs +129 -0
  124. package/dist/chunks/zero-config.mjs +45 -34
  125. package/dist/cli.mjs +20 -20
  126. package/dist/index.mjs +41 -31
  127. package/dist/shared/ccjk.BAGoDD49.mjs +36 -0
  128. package/dist/shared/ccjk.BBtCGd_g.mjs +899 -0
  129. package/dist/shared/{ccjk.CGcy7cNM.mjs → ccjk.BDKUdmLk.mjs} +1 -1
  130. package/dist/shared/{ccjk.DtMBiwVG.mjs → ccjk.BFxsJM0k.mjs} +1 -1
  131. package/dist/shared/{ccjk.j4uut26D.mjs → ccjk.BIxuVL3_.mjs} +5 -5
  132. package/dist/shared/ccjk.BRZ9ww8S.mjs +142 -0
  133. package/dist/shared/{ccjk.CN0edl87.mjs → ccjk.BSYWk9ML.mjs} +1 -1
  134. package/dist/shared/{ccjk.Dk1HDseQ.mjs → ccjk.BnpWvs9V.mjs} +75 -75
  135. package/dist/shared/ccjk.BoApaI4j.mjs +28 -0
  136. package/dist/shared/{ccjk.DKojSRzw.mjs → ccjk.BrPUmTqm.mjs} +1 -1
  137. package/dist/shared/{ccjk.C10pepYx.mjs → ccjk.BxSmJ8B7.mjs} +1 -1
  138. package/dist/shared/ccjk.Bx_rmYfN.mjs +69 -0
  139. package/dist/shared/ccjk.COweQ1RR.mjs +5 -0
  140. package/dist/shared/{ccjk.BN90X6oc.mjs → ccjk.CePkJq2S.mjs} +17 -17
  141. package/dist/shared/{ccjk.Bvoex4TZ.mjs → ccjk.CfKKcvWy.mjs} +1 -1
  142. package/dist/shared/ccjk.Cjgrln_h.mjs +297 -0
  143. package/dist/shared/ccjk.CxpGa6MC.mjs +2724 -0
  144. package/dist/shared/{ccjk.DfwJOEok.mjs → ccjk.D5MFQT7w.mjs} +1 -1
  145. package/dist/shared/{ccjk.cChAaGgT.mjs → ccjk.DG_o24cZ.mjs} +6 -6
  146. package/dist/shared/{ccjk.bhFAMRyc.mjs → ccjk.DLLw-h4Y.mjs} +32 -32
  147. package/dist/shared/ccjk.DOwtZMk8.mjs +4019 -0
  148. package/dist/shared/{ccjk.BsXQugfY.mjs → ccjk.DTdjs-qK.mjs} +13 -13
  149. package/dist/shared/{ccjk.Bdhyg3X-.mjs → ccjk.DsYaCCx4.mjs} +1 -1
  150. package/dist/shared/ccjk.KfSWcGlE.mjs +38 -0
  151. package/dist/shared/ccjk.RyizuzOI.mjs +21 -0
  152. package/dist/shared/{ccjk.h7_W-wTs.mjs → ccjk.SPoXMvZD.mjs} +1 -1
  153. package/dist/shared/ccjk.T_cX87dY.mjs +15 -0
  154. package/dist/shared/{ccjk.CrB6OYHv.mjs → ccjk._dESH4Rk.mjs} +2 -2
  155. package/dist/shared/ccjk.bQ7Dh1g4.mjs +249 -0
  156. package/dist/shared/{ccjk.CBhIZiPz.mjs → ccjk.hoqrwWdN.mjs} +1 -1
  157. package/dist/shared/{ccjk.BNwRnWYx.mjs → ccjk.s7OCVzdd.mjs} +1230 -33
  158. package/dist/shared/{ccjk.BOIUTf5z.mjs → ccjk.waa2ikKJ.mjs} +8 -9
  159. package/package.json +31 -30
  160. package/dist/shared/ccjk.DHbrGcgg.mjs +0 -13
  161. package/dist/shared/ccjk.DntgA8fQ.mjs +0 -42
@@ -1,663 +1,3583 @@
1
- import { existsSync, readFileSync, readdirSync, statSync, mkdirSync, writeFileSync } from 'node:fs';
2
- import { join, dirname } from 'pathe';
3
- import { homedir } from 'node:os';
4
- import { fileURLToPath } from 'node:url';
5
-
6
- class ProjectAnalyzer {
7
- projectRoot;
8
- constructor(projectRoot = process.cwd()) {
9
- this.projectRoot = projectRoot;
10
- }
11
- /**
12
- * Analyze project and return comprehensive analysis
13
- */
14
- async analyze() {
15
- const packageJson = this.readPackageJson();
16
- const techStack = this.detectTechStack(packageJson);
17
- const projectType = this.detectProjectType(techStack, packageJson);
18
- const frameworks = this.detectFrameworks(packageJson);
19
- const hasTests = this.detectTestFramework(packageJson);
20
- const hasDatabase = this.detectDatabase(packageJson);
21
- const hasApi = this.detectApiEndpoints();
22
- const buildTool = this.detectBuildTool(packageJson);
23
- const cicd = this.detectCICD();
24
- const patterns = this.detectPatterns();
25
- const confidence = this.calculateConfidence(techStack, frameworks);
26
- return {
27
- projectRoot: this.projectRoot,
28
- projectType,
29
- techStack,
30
- frameworks,
31
- hasTests,
32
- hasDatabase,
33
- hasApi,
34
- buildTool,
35
- cicd,
36
- patterns,
37
- confidence,
38
- packageJson: packageJson ?? void 0
39
- };
40
- }
41
- /**
42
- * Read and parse package.json
43
- */
44
- readPackageJson() {
45
- const packageJsonPath = join(this.projectRoot, "package.json");
46
- if (!existsSync(packageJsonPath)) {
47
- return null;
48
- }
49
- try {
50
- const content = readFileSync(packageJsonPath, "utf-8");
51
- return JSON.parse(content);
52
- } catch {
53
- return null;
54
- }
55
- }
56
- /**
57
- * Detect technology stack from dependencies
58
- */
59
- detectTechStack(packageJson) {
60
- if (!packageJson) {
61
- return {
62
- languages: ["javascript"],
63
- runtime: "node",
64
- packageManager: this.detectPackageManager()
65
- };
66
- }
67
- const deps = {
68
- ...packageJson.dependencies,
69
- ...packageJson.devDependencies
70
- };
71
- const languages = [];
72
- let runtime = "node";
73
- if (deps.typescript || existsSync(join(this.projectRoot, "tsconfig.json"))) {
74
- languages.push("typescript");
75
- } else {
76
- languages.push("javascript");
77
- }
78
- if (existsSync(join(this.projectRoot, "deno.json")) || existsSync(join(this.projectRoot, "deno.jsonc"))) {
79
- runtime = "deno";
80
- }
81
- if (existsSync(join(this.projectRoot, "bun.lockb"))) {
82
- runtime = "bun";
83
- }
84
- return {
85
- languages,
86
- runtime,
87
- packageManager: this.detectPackageManager()
88
- };
89
- }
90
- /**
91
- * Detect package manager
92
- */
93
- detectPackageManager() {
94
- if (existsSync(join(this.projectRoot, "pnpm-lock.yaml"))) {
95
- return "pnpm";
96
- }
97
- if (existsSync(join(this.projectRoot, "yarn.lock"))) {
98
- return "yarn";
99
- }
100
- if (existsSync(join(this.projectRoot, "bun.lockb"))) {
101
- return "bun";
102
- }
103
- if (existsSync(join(this.projectRoot, "package-lock.json"))) {
104
- return "npm";
105
- }
106
- return "npm";
107
- }
108
- /**
109
- * Detect project type
110
- */
111
- detectProjectType(techStack, packageJson) {
112
- if (!packageJson) {
113
- return "unknown";
114
- }
115
- const deps = {
116
- ...packageJson.dependencies,
117
- ...packageJson.devDependencies
118
- };
119
- const hasFrontend = deps.react || deps.vue || deps["@angular/core"] || deps.svelte;
120
- const hasBackend = deps.express || deps.fastify || deps.koa || deps["@nestjs/core"] || deps.hapi;
121
- if (deps.next || deps.nuxt || deps["@remix-run/react"] || deps["@sveltejs/kit"]) {
122
- return "fullstack";
123
- }
124
- if (packageJson.bin || deps.commander || deps.yargs || deps.cac) {
125
- return "cli";
126
- }
127
- if (packageJson.main && !hasFrontend && !hasBackend) {
128
- return "library";
129
- }
130
- if (hasFrontend && hasBackend) {
131
- return "fullstack";
132
- }
133
- if (hasFrontend) {
134
- return "frontend";
135
- }
136
- if (hasBackend) {
137
- return "backend";
138
- }
139
- return "unknown";
140
- }
141
- /**
142
- * Detect frameworks
143
- */
144
- detectFrameworks(packageJson) {
145
- if (!packageJson) {
146
- return [];
147
- }
148
- const deps = {
149
- ...packageJson.dependencies,
150
- ...packageJson.devDependencies
151
- };
152
- const frameworks = [];
153
- if (deps.react)
154
- frameworks.push("react");
155
- if (deps.vue)
156
- frameworks.push("vue");
157
- if (deps["@angular/core"])
158
- frameworks.push("angular");
159
- if (deps.svelte)
160
- frameworks.push("svelte");
161
- if (deps.next)
162
- frameworks.push("next.js");
163
- if (deps.nuxt)
164
- frameworks.push("nuxt");
165
- if (deps["@remix-run/react"])
166
- frameworks.push("remix");
167
- if (deps["@sveltejs/kit"])
168
- frameworks.push("sveltekit");
169
- if (deps.express)
170
- frameworks.push("express");
171
- if (deps.fastify)
172
- frameworks.push("fastify");
173
- if (deps.koa)
174
- frameworks.push("koa");
175
- if (deps["@nestjs/core"])
176
- frameworks.push("nestjs");
177
- if (deps.hapi)
178
- frameworks.push("hapi");
179
- return frameworks;
180
- }
181
- /**
182
- * Detect test framework
183
- */
184
- detectTestFramework(packageJson) {
185
- if (!packageJson) {
186
- return false;
187
- }
188
- const deps = {
189
- ...packageJson.dependencies,
190
- ...packageJson.devDependencies
191
- };
192
- return !!(deps.vitest || deps.jest || deps.mocha || deps.ava || deps["@playwright/test"] || deps.cypress);
193
- }
194
- /**
195
- * Detect database usage
196
- */
197
- detectDatabase(packageJson) {
198
- if (!packageJson) {
199
- return false;
200
- }
201
- const deps = {
202
- ...packageJson.dependencies,
203
- ...packageJson.devDependencies
204
- };
205
- return !!(deps.prisma || deps["@prisma/client"] || deps.drizzle || deps["drizzle-orm"] || deps.typeorm || deps.sequelize || deps.mongoose || deps.pg || deps.mysql || deps.mysql2 || deps.sqlite3 || deps["better-sqlite3"]);
206
- }
207
- /**
208
- * Detect API endpoints
209
- */
210
- detectApiEndpoints() {
211
- const apiDirs = [
212
- "src/api",
213
- "src/routes",
214
- "api",
215
- "routes",
216
- "pages/api",
217
- // Next.js
218
- "app/api"
219
- // Next.js App Router
220
- ];
221
- return apiDirs.some((dir) => existsSync(join(this.projectRoot, dir)));
222
- }
223
- /**
224
- * Detect build tool
225
- */
226
- detectBuildTool(packageJson) {
227
- if (!packageJson) {
228
- return void 0;
229
- }
230
- const deps = {
231
- ...packageJson.dependencies,
232
- ...packageJson.devDependencies
233
- };
234
- if (deps.vite || existsSync(join(this.projectRoot, "vite.config.ts"))) {
235
- return "vite";
236
- }
237
- if (deps.webpack || existsSync(join(this.projectRoot, "webpack.config.js"))) {
238
- return "webpack";
239
- }
240
- if (deps.rollup || existsSync(join(this.projectRoot, "rollup.config.js"))) {
241
- return "rollup";
242
- }
243
- if (deps.esbuild) {
244
- return "esbuild";
245
- }
246
- if (deps.turbo || existsSync(join(this.projectRoot, "turbo.json"))) {
247
- return "turbo";
248
- }
249
- return void 0;
250
- }
251
- /**
252
- * Detect CI/CD configuration
253
- */
254
- detectCICD() {
255
- const cicd = [];
256
- if (existsSync(join(this.projectRoot, ".github", "workflows"))) {
257
- cicd.push("github-actions");
258
- }
259
- if (existsSync(join(this.projectRoot, ".gitlab-ci.yml"))) {
260
- cicd.push("gitlab-ci");
261
- }
262
- if (existsSync(join(this.projectRoot, ".circleci", "config.yml"))) {
263
- cicd.push("circleci");
264
- }
265
- if (existsSync(join(this.projectRoot, ".travis.yml"))) {
266
- cicd.push("travis-ci");
267
- }
268
- return cicd;
269
- }
270
- /**
271
- * Detect common patterns in the project
272
- */
273
- detectPatterns() {
274
- const patterns = [];
275
- if (existsSync(join(this.projectRoot, "packages")) || existsSync(join(this.projectRoot, "apps"))) {
276
- patterns.push("monorepo");
277
- }
278
- if (existsSync(join(this.projectRoot, "tsconfig.json"))) {
279
- patterns.push("typescript");
280
- }
281
- if (existsSync(join(this.projectRoot, ".eslintrc.js")) || existsSync(join(this.projectRoot, "eslint.config.js"))) {
282
- patterns.push("eslint");
283
- }
284
- if (existsSync(join(this.projectRoot, ".prettierrc")) || existsSync(join(this.projectRoot, "prettier.config.js"))) {
285
- patterns.push("prettier");
286
- }
287
- if (existsSync(join(this.projectRoot, "Dockerfile")) || existsSync(join(this.projectRoot, "docker-compose.yml"))) {
288
- patterns.push("docker");
289
- }
290
- if (existsSync(join(this.projectRoot, ".env.example")) || existsSync(join(this.projectRoot, ".env.local"))) {
291
- patterns.push("env-config");
292
- }
293
- return patterns;
294
- }
295
- /**
296
- * Calculate confidence score based on detected information
297
- */
298
- calculateConfidence(techStack, frameworks) {
299
- let confidence = 0.5;
300
- if (techStack.languages.length > 0)
301
- confidence += 0.1;
302
- if (techStack.runtime !== "unknown")
303
- confidence += 0.1;
304
- if (techStack.packageManager)
305
- confidence += 0.1;
306
- if (frameworks.length > 0)
307
- confidence += 0.1;
308
- if (frameworks.length > 2)
309
- confidence += 0.1;
310
- return Math.min(confidence, 1);
311
- }
312
- /**
313
- * Get file count in directory
314
- */
315
- getFileCount(dir) {
316
- try {
317
- if (!existsSync(dir)) {
318
- return 0;
319
- }
320
- let count = 0;
321
- const items = readdirSync(dir);
322
- for (const item of items) {
323
- const fullPath = join(dir, item);
324
- const stat = statSync(fullPath);
325
- if (stat.isDirectory()) {
326
- count += this.getFileCount(fullPath);
327
- } else {
328
- count++;
329
- }
330
- }
331
- return count;
332
- } catch {
333
- return 0;
334
- }
335
- }
1
+ import process__default from 'node:process';
2
+ import { stripVTControlCharacters } from 'node:util';
3
+ import { o as onExit } from '../shared/ccjk.Cjgrln_h.mjs';
4
+
5
+ const ANSI_BACKGROUND_OFFSET = 10;
6
+
7
+ const wrapAnsi16 = (offset = 0) => code => `\u001B[${code + offset}m`;
8
+
9
+ const wrapAnsi256 = (offset = 0) => code => `\u001B[${38 + offset};5;${code}m`;
10
+
11
+ const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`;
12
+
13
+ const styles$1 = {
14
+ modifier: {
15
+ reset: [0, 0],
16
+ // 21 isn't widely supported and 22 does the same thing
17
+ bold: [1, 22],
18
+ dim: [2, 22],
19
+ italic: [3, 23],
20
+ underline: [4, 24],
21
+ overline: [53, 55],
22
+ inverse: [7, 27],
23
+ hidden: [8, 28],
24
+ strikethrough: [9, 29],
25
+ },
26
+ color: {
27
+ black: [30, 39],
28
+ red: [31, 39],
29
+ green: [32, 39],
30
+ yellow: [33, 39],
31
+ blue: [34, 39],
32
+ magenta: [35, 39],
33
+ cyan: [36, 39],
34
+ white: [37, 39],
35
+
36
+ // Bright color
37
+ blackBright: [90, 39],
38
+ gray: [90, 39], // Alias of `blackBright`
39
+ grey: [90, 39], // Alias of `blackBright`
40
+ redBright: [91, 39],
41
+ greenBright: [92, 39],
42
+ yellowBright: [93, 39],
43
+ blueBright: [94, 39],
44
+ magentaBright: [95, 39],
45
+ cyanBright: [96, 39],
46
+ whiteBright: [97, 39],
47
+ },
48
+ bgColor: {
49
+ bgBlack: [40, 49],
50
+ bgRed: [41, 49],
51
+ bgGreen: [42, 49],
52
+ bgYellow: [43, 49],
53
+ bgBlue: [44, 49],
54
+ bgMagenta: [45, 49],
55
+ bgCyan: [46, 49],
56
+ bgWhite: [47, 49],
57
+
58
+ // Bright color
59
+ bgBlackBright: [100, 49],
60
+ bgGray: [100, 49], // Alias of `bgBlackBright`
61
+ bgGrey: [100, 49], // Alias of `bgBlackBright`
62
+ bgRedBright: [101, 49],
63
+ bgGreenBright: [102, 49],
64
+ bgYellowBright: [103, 49],
65
+ bgBlueBright: [104, 49],
66
+ bgMagentaBright: [105, 49],
67
+ bgCyanBright: [106, 49],
68
+ bgWhiteBright: [107, 49],
69
+ },
70
+ };
71
+
72
+ Object.keys(styles$1.modifier);
73
+ const foregroundColorNames = Object.keys(styles$1.color);
74
+ const backgroundColorNames = Object.keys(styles$1.bgColor);
75
+ [...foregroundColorNames, ...backgroundColorNames];
76
+
77
+ function assembleStyles() {
78
+ const codes = new Map();
79
+
80
+ for (const [groupName, group] of Object.entries(styles$1)) {
81
+ for (const [styleName, style] of Object.entries(group)) {
82
+ styles$1[styleName] = {
83
+ open: `\u001B[${style[0]}m`,
84
+ close: `\u001B[${style[1]}m`,
85
+ };
86
+
87
+ group[styleName] = styles$1[styleName];
88
+
89
+ codes.set(style[0], style[1]);
90
+ }
91
+
92
+ Object.defineProperty(styles$1, groupName, {
93
+ value: group,
94
+ enumerable: false,
95
+ });
96
+ }
97
+
98
+ Object.defineProperty(styles$1, 'codes', {
99
+ value: codes,
100
+ enumerable: false,
101
+ });
102
+
103
+ styles$1.color.close = '\u001B[39m';
104
+ styles$1.bgColor.close = '\u001B[49m';
105
+
106
+ styles$1.color.ansi = wrapAnsi16();
107
+ styles$1.color.ansi256 = wrapAnsi256();
108
+ styles$1.color.ansi16m = wrapAnsi16m();
109
+ styles$1.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
110
+ styles$1.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
111
+ styles$1.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
112
+
113
+ // From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js
114
+ Object.defineProperties(styles$1, {
115
+ rgbToAnsi256: {
116
+ value(red, green, blue) {
117
+ // We use the extended greyscale palette here, with the exception of
118
+ // black and white. normal palette only has 4 greyscale shades.
119
+ if (red === green && green === blue) {
120
+ if (red < 8) {
121
+ return 16;
122
+ }
123
+
124
+ if (red > 248) {
125
+ return 231;
126
+ }
127
+
128
+ return Math.round(((red - 8) / 247) * 24) + 232;
129
+ }
130
+
131
+ return 16
132
+ + (36 * Math.round(red / 255 * 5))
133
+ + (6 * Math.round(green / 255 * 5))
134
+ + Math.round(blue / 255 * 5);
135
+ },
136
+ enumerable: false,
137
+ },
138
+ hexToRgb: {
139
+ value(hex) {
140
+ const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
141
+ if (!matches) {
142
+ return [0, 0, 0];
143
+ }
144
+
145
+ let [colorString] = matches;
146
+
147
+ if (colorString.length === 3) {
148
+ colorString = [...colorString].map(character => character + character).join('');
149
+ }
150
+
151
+ const integer = Number.parseInt(colorString, 16);
152
+
153
+ return [
154
+ /* eslint-disable no-bitwise */
155
+ (integer >> 16) & 0xFF,
156
+ (integer >> 8) & 0xFF,
157
+ integer & 0xFF,
158
+ /* eslint-enable no-bitwise */
159
+ ];
160
+ },
161
+ enumerable: false,
162
+ },
163
+ hexToAnsi256: {
164
+ value: hex => styles$1.rgbToAnsi256(...styles$1.hexToRgb(hex)),
165
+ enumerable: false,
166
+ },
167
+ ansi256ToAnsi: {
168
+ value(code) {
169
+ if (code < 8) {
170
+ return 30 + code;
171
+ }
172
+
173
+ if (code < 16) {
174
+ return 90 + (code - 8);
175
+ }
176
+
177
+ let red;
178
+ let green;
179
+ let blue;
180
+
181
+ if (code >= 232) {
182
+ red = (((code - 232) * 10) + 8) / 255;
183
+ green = red;
184
+ blue = red;
185
+ } else {
186
+ code -= 16;
187
+
188
+ const remainder = code % 36;
189
+
190
+ red = Math.floor(code / 36) / 5;
191
+ green = Math.floor(remainder / 6) / 5;
192
+ blue = (remainder % 6) / 5;
193
+ }
194
+
195
+ const value = Math.max(red, green, blue) * 2;
196
+
197
+ if (value === 0) {
198
+ return 30;
199
+ }
200
+
201
+ // eslint-disable-next-line no-bitwise
202
+ let result = 30 + ((Math.round(blue) << 2) | (Math.round(green) << 1) | Math.round(red));
203
+
204
+ if (value === 2) {
205
+ result += 60;
206
+ }
207
+
208
+ return result;
209
+ },
210
+ enumerable: false,
211
+ },
212
+ rgbToAnsi: {
213
+ value: (red, green, blue) => styles$1.ansi256ToAnsi(styles$1.rgbToAnsi256(red, green, blue)),
214
+ enumerable: false,
215
+ },
216
+ hexToAnsi: {
217
+ value: hex => styles$1.ansi256ToAnsi(styles$1.hexToAnsi256(hex)),
218
+ enumerable: false,
219
+ },
220
+ });
221
+
222
+ return styles$1;
336
223
  }
337
- async function analyzeProject(projectRoot) {
338
- const analyzer = new ProjectAnalyzer(projectRoot);
339
- return analyzer.analyze();
224
+
225
+ const ansiStyles = assembleStyles();
226
+
227
+ /* eslint-env browser */
228
+
229
+ const level = (() => {
230
+ if (!('navigator' in globalThis)) {
231
+ return 0;
232
+ }
233
+
234
+ if (globalThis.navigator.userAgentData) {
235
+ const brand = navigator.userAgentData.brands.find(({brand}) => brand === 'Chromium');
236
+ if (brand && brand.version > 93) {
237
+ return 3;
238
+ }
239
+ }
240
+
241
+ if (/\b(Chrome|Chromium)\//.test(globalThis.navigator.userAgent)) {
242
+ return 1;
243
+ }
244
+
245
+ return 0;
246
+ })();
247
+
248
+ const colorSupport = level !== 0 && {
249
+ level};
250
+
251
+ const supportsColor = {
252
+ stdout: colorSupport,
253
+ stderr: colorSupport,
254
+ };
255
+
256
+ // TODO: When targeting Node.js 16, use `String.prototype.replaceAll`.
257
+ function stringReplaceAll(string, substring, replacer) {
258
+ let index = string.indexOf(substring);
259
+ if (index === -1) {
260
+ return string;
261
+ }
262
+
263
+ const substringLength = substring.length;
264
+ let endIndex = 0;
265
+ let returnValue = '';
266
+ do {
267
+ returnValue += string.slice(endIndex, index) + substring + replacer;
268
+ endIndex = index + substringLength;
269
+ index = string.indexOf(substring, endIndex);
270
+ } while (index !== -1);
271
+
272
+ returnValue += string.slice(endIndex);
273
+ return returnValue;
340
274
  }
341
275
 
342
- const __filename$1 = fileURLToPath(import.meta.url);
343
- const __dirname$1 = dirname(__filename$1);
344
- class ConfigGenerator {
345
- templatesDir;
346
- outputDir;
347
- constructor(templatesDir, outputDir) {
348
- this.templatesDir = templatesDir || join(__dirname$1, "..", "templates");
349
- this.outputDir = outputDir || join(homedir(), ".config", "claude");
350
- }
351
- /**
352
- * Generate configurations from template selection
353
- */
354
- async generate(selection) {
355
- const agentConfigs = await this.generateAgents(selection.agents);
356
- const skillConfigs = await this.generateSkills(selection.skills);
357
- return {
358
- agents: agentConfigs,
359
- skills: skillConfigs,
360
- summary: this.generateSummary(agentConfigs, skillConfigs)
361
- };
362
- }
363
- /**
364
- * Generate agent configurations
365
- */
366
- async generateAgents(agents) {
367
- const configs = [];
368
- for (const agent of agents) {
369
- const templatePath = join(this.templatesDir, "agents", agent.file);
370
- if (!existsSync(templatePath)) {
371
- console.warn(`Agent template not found: ${agent.file}`);
372
- continue;
373
- }
374
- const content = readFileSync(templatePath, "utf-8");
375
- const outputPath = join(this.outputDir, "agents", agent.file);
376
- configs.push({
377
- id: agent.id,
378
- path: outputPath,
379
- content
380
- });
381
- }
382
- return configs;
383
- }
384
- /**
385
- * Generate skill configurations
386
- */
387
- async generateSkills(skills) {
388
- const configs = [];
389
- for (const skill of skills) {
390
- const templatePath = join(this.templatesDir, "skills", skill.file);
391
- if (!existsSync(templatePath)) {
392
- console.warn(`Skill template not found: ${skill.file}`);
393
- continue;
394
- }
395
- const content = readFileSync(templatePath, "utf-8");
396
- const outputPath = join(this.outputDir, "skills", skill.file);
397
- configs.push({
398
- id: skill.id,
399
- path: outputPath,
400
- content
401
- });
402
- }
403
- return configs;
404
- }
405
- /**
406
- * Write configurations to disk
407
- */
408
- async write(config) {
409
- const agentsDir = join(this.outputDir, "agents");
410
- const skillsDir = join(this.outputDir, "skills");
411
- if (!existsSync(agentsDir)) {
412
- mkdirSync(agentsDir, { recursive: true });
413
- }
414
- if (!existsSync(skillsDir)) {
415
- mkdirSync(skillsDir, { recursive: true });
416
- }
417
- for (const agent of config.agents) {
418
- const dir = join(agent.path, "..");
419
- if (!existsSync(dir)) {
420
- mkdirSync(dir, { recursive: true });
421
- }
422
- writeFileSync(agent.path, agent.content, "utf-8");
423
- }
424
- for (const skill of config.skills) {
425
- const dir = join(skill.path, "..");
426
- if (!existsSync(dir)) {
427
- mkdirSync(dir, { recursive: true });
428
- }
429
- writeFileSync(skill.path, skill.content, "utf-8");
430
- }
431
- }
432
- /**
433
- * Generate summary
434
- */
435
- generateSummary(agents, skills) {
436
- const lines = [];
437
- lines.push("# Generated Configuration Summary\n");
438
- lines.push(`Generated at: ${(/* @__PURE__ */ new Date()).toISOString()}
439
- `);
440
- lines.push("## Agents\n");
441
- for (const agent of agents) {
442
- lines.push(`- ${agent.id}: ${agent.path}`);
443
- }
444
- lines.push("\n## Skills\n");
445
- for (const skill of skills) {
446
- lines.push(`- ${skill.id}: ${skill.path}`);
447
- }
448
- lines.push("\n## Usage\n");
449
- lines.push("1. Agents are automatically loaded by Claude Code");
450
- lines.push("2. Skills can be triggered using their command triggers");
451
- lines.push("3. Use `claude` command to start coding with AI assistance");
452
- return lines.join("\n");
453
- }
276
+ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
277
+ let endIndex = 0;
278
+ let returnValue = '';
279
+ do {
280
+ const gotCR = string[index - 1] === '\r';
281
+ returnValue += string.slice(endIndex, (gotCR ? index - 1 : index)) + prefix + (gotCR ? '\r\n' : '\n') + postfix;
282
+ endIndex = index + 1;
283
+ index = string.indexOf('\n', endIndex);
284
+ } while (index !== -1);
285
+
286
+ returnValue += string.slice(endIndex);
287
+ return returnValue;
454
288
  }
455
- async function generateConfigs(selection) {
456
- const generator = new ConfigGenerator();
457
- return generator.generate(selection);
289
+
290
+ const {stdout: stdoutColor, stderr: stderrColor} = supportsColor;
291
+
292
+ const GENERATOR = Symbol('GENERATOR');
293
+ const STYLER = Symbol('STYLER');
294
+ const IS_EMPTY = Symbol('IS_EMPTY');
295
+
296
+ // `supportsColor.level` → `ansiStyles.color[name]` mapping
297
+ const levelMapping = [
298
+ 'ansi',
299
+ 'ansi',
300
+ 'ansi256',
301
+ 'ansi16m',
302
+ ];
303
+
304
+ const styles = Object.create(null);
305
+
306
+ const applyOptions = (object, options = {}) => {
307
+ if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
308
+ throw new Error('The `level` option should be an integer from 0 to 3');
309
+ }
310
+
311
+ // Detect level if not set manually
312
+ const colorLevel = stdoutColor ? stdoutColor.level : 0;
313
+ object.level = options.level === undefined ? colorLevel : options.level;
314
+ };
315
+
316
+ const chalkFactory = options => {
317
+ const chalk = (...strings) => strings.join(' ');
318
+ applyOptions(chalk, options);
319
+
320
+ Object.setPrototypeOf(chalk, createChalk.prototype);
321
+
322
+ return chalk;
323
+ };
324
+
325
+ function createChalk(options) {
326
+ return chalkFactory(options);
458
327
  }
459
- async function writeConfigs(config) {
460
- const generator = new ConfigGenerator();
461
- await generator.write(config);
328
+
329
+ Object.setPrototypeOf(createChalk.prototype, Function.prototype);
330
+
331
+ for (const [styleName, style] of Object.entries(ansiStyles)) {
332
+ styles[styleName] = {
333
+ get() {
334
+ const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
335
+ Object.defineProperty(this, styleName, {value: builder});
336
+ return builder;
337
+ },
338
+ };
462
339
  }
463
340
 
464
- const __filename = fileURLToPath(import.meta.url);
465
- const __dirname = dirname(__filename);
466
- class TemplateSelector {
467
- templatesDir;
468
- constructor(templatesDir) {
469
- this.templatesDir = templatesDir || join(__dirname, "..", "..", "..", "templates");
470
- }
471
- /**
472
- * Select templates based on project analysis
473
- */
474
- async select(analysis) {
475
- const agents = await this.selectAgents(analysis);
476
- const skills = await this.selectSkills(analysis);
477
- return {
478
- agents,
479
- skills,
480
- reasoning: this.generateReasoning(analysis, agents, skills)
481
- };
482
- }
483
- /**
484
- * Select agent templates
485
- */
486
- async selectAgents(analysis) {
487
- const selectedAgents = [];
488
- const agentIndex = this.loadAgentIndex();
489
- switch (analysis.projectType) {
490
- case "frontend":
491
- selectedAgents.push(
492
- ...this.findAgentsByCategory(agentIndex, "frontend")
493
- );
494
- break;
495
- case "backend":
496
- selectedAgents.push(
497
- ...this.findAgentsByCategory(agentIndex, "backend")
498
- );
499
- break;
500
- case "fullstack":
501
- selectedAgents.push(
502
- ...this.findAgentsByCategory(agentIndex, "fullstack")
503
- );
504
- selectedAgents.push(
505
- ...this.findAgentsByCategory(agentIndex, "frontend").slice(0, 1),
506
- ...this.findAgentsByCategory(agentIndex, "backend").slice(0, 1)
507
- );
508
- break;
509
- case "cli":
510
- case "library":
511
- selectedAgents.push(
512
- ...this.findAgentsByCategory(agentIndex, "backend")
513
- );
514
- break;
515
- }
516
- if (analysis.hasTests) {
517
- selectedAgents.push(
518
- ...this.findAgentsByCategory(agentIndex, "testing")
519
- );
520
- }
521
- if (analysis.cicd && analysis.cicd.length > 0) {
522
- selectedAgents.push(
523
- ...this.findAgentsByCategory(agentIndex, "devops")
524
- );
525
- }
526
- if (analysis.hasApi || analysis.hasDatabase) {
527
- selectedAgents.push(
528
- ...this.findAgentsByCategory(agentIndex, "security")
529
- );
530
- }
531
- return this.deduplicateAndSort(selectedAgents);
532
- }
533
- /**
534
- * Select skill templates
535
- */
536
- async selectSkills(analysis) {
537
- const selectedSkills = [];
538
- const skillIndex = this.loadSkillIndex();
539
- selectedSkills.push(
540
- ...this.findSkillsByCategory(skillIndex, "git")
541
- );
542
- selectedSkills.push(
543
- ...this.findSkillsByCategory(skillIndex, "code-quality")
544
- );
545
- if (analysis.hasTests) {
546
- selectedSkills.push(
547
- ...this.findSkillsByIds(skillIndex, ["generate-tests"])
548
- );
549
- }
550
- if (analysis.hasApi) {
551
- selectedSkills.push(
552
- ...this.findSkillsByIds(skillIndex, ["api-docs"])
553
- );
554
- }
555
- if (analysis.hasDatabase) {
556
- selectedSkills.push(
557
- ...this.findSkillsByIds(skillIndex, ["database-migration"])
558
- );
559
- }
560
- if (analysis.projectType === "frontend" || analysis.projectType === "fullstack") {
561
- selectedSkills.push(
562
- ...this.findSkillsByIds(skillIndex, ["performance-optimization"])
563
- );
564
- }
565
- if (analysis.packageJson) {
566
- selectedSkills.push(
567
- ...this.findSkillsByIds(skillIndex, ["dependency-update"])
568
- );
569
- }
570
- selectedSkills.push(
571
- ...this.findSkillsByIds(skillIndex, ["refactor-code"])
572
- );
573
- return this.deduplicateAndSort(selectedSkills);
574
- }
575
- /**
576
- * Load agent index
577
- */
578
- loadAgentIndex() {
579
- try {
580
- const indexPath = join(this.templatesDir, "agents", "index.json");
581
- const content = readFileSync(indexPath, "utf-8");
582
- return JSON.parse(content);
583
- } catch {
584
- return { templates: [] };
585
- }
586
- }
587
- /**
588
- * Load skill index
589
- */
590
- loadSkillIndex() {
591
- try {
592
- const indexPath = join(this.templatesDir, "skills", "index.json");
593
- const content = readFileSync(indexPath, "utf-8");
594
- return JSON.parse(content);
595
- } catch {
596
- return { templates: [] };
597
- }
598
- }
599
- /**
600
- * Find agents by category
601
- */
602
- findAgentsByCategory(index, category) {
603
- return index.templates.filter((agent) => agent.category === category);
604
- }
605
- /**
606
- * Find skills by category
607
- */
608
- findSkillsByCategory(index, category) {
609
- return index.templates.filter((skill) => skill.category === category);
610
- }
611
- /**
612
- * Find skills by IDs
613
- */
614
- findSkillsByIds(index, ids) {
615
- return index.templates.filter((skill) => ids.includes(skill.id));
616
- }
617
- /**
618
- * Deduplicate and sort templates by priority
619
- */
620
- deduplicateAndSort(templates) {
621
- const seen = /* @__PURE__ */ new Set();
622
- const unique = [];
623
- for (const template of templates) {
624
- if (!seen.has(template.id)) {
625
- seen.add(template.id);
626
- unique.push(template);
627
- }
628
- }
629
- return unique.sort((a, b) => b.priority - a.priority);
630
- }
631
- /**
632
- * Generate reasoning for template selection
633
- */
634
- generateReasoning(analysis, agents, skills) {
635
- const reasons = [];
636
- reasons.push(`Detected ${analysis.projectType} project`);
637
- if (analysis.frameworks.length > 0) {
638
- reasons.push(`Using frameworks: ${analysis.frameworks.join(", ")}`);
639
- }
640
- reasons.push(`Tech stack: ${analysis.techStack.languages.join(", ")} on ${analysis.techStack.runtime}`);
641
- if (analysis.hasTests) {
642
- reasons.push("Tests detected - including test engineer and test generation");
643
- }
644
- if (analysis.hasDatabase) {
645
- reasons.push("Database detected - including migration skills");
646
- }
647
- if (analysis.hasApi) {
648
- reasons.push("API endpoints detected - including API documentation");
649
- }
650
- if (analysis.cicd && analysis.cicd.length > 0) {
651
- reasons.push(`CI/CD detected (${analysis.cicd.join(", ")}) - including DevOps engineer`);
652
- }
653
- reasons.push(`
654
- Selected ${agents.length} agents and ${skills.length} skills`);
655
- return reasons.join("\n");
656
- }
341
+ styles.visible = {
342
+ get() {
343
+ const builder = createBuilder(this, this[STYLER], true);
344
+ Object.defineProperty(this, 'visible', {value: builder});
345
+ return builder;
346
+ },
347
+ };
348
+
349
+ const getModelAnsi = (model, level, type, ...arguments_) => {
350
+ if (model === 'rgb') {
351
+ if (level === 'ansi16m') {
352
+ return ansiStyles[type].ansi16m(...arguments_);
353
+ }
354
+
355
+ if (level === 'ansi256') {
356
+ return ansiStyles[type].ansi256(ansiStyles.rgbToAnsi256(...arguments_));
357
+ }
358
+
359
+ return ansiStyles[type].ansi(ansiStyles.rgbToAnsi(...arguments_));
360
+ }
361
+
362
+ if (model === 'hex') {
363
+ return getModelAnsi('rgb', level, type, ...ansiStyles.hexToRgb(...arguments_));
364
+ }
365
+
366
+ return ansiStyles[type][model](...arguments_);
367
+ };
368
+
369
+ const usedModels = ['rgb', 'hex', 'ansi256'];
370
+
371
+ for (const model of usedModels) {
372
+ styles[model] = {
373
+ get() {
374
+ const {level} = this;
375
+ return function (...arguments_) {
376
+ const styler = createStyler(getModelAnsi(model, levelMapping[level], 'color', ...arguments_), ansiStyles.color.close, this[STYLER]);
377
+ return createBuilder(this, styler, this[IS_EMPTY]);
378
+ };
379
+ },
380
+ };
381
+
382
+ const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
383
+ styles[bgModel] = {
384
+ get() {
385
+ const {level} = this;
386
+ return function (...arguments_) {
387
+ const styler = createStyler(getModelAnsi(model, levelMapping[level], 'bgColor', ...arguments_), ansiStyles.bgColor.close, this[STYLER]);
388
+ return createBuilder(this, styler, this[IS_EMPTY]);
389
+ };
390
+ },
391
+ };
657
392
  }
658
- async function selectTemplates(analysis) {
659
- const selector = new TemplateSelector();
660
- return selector.select(analysis);
393
+
394
+ const proto = Object.defineProperties(() => {}, {
395
+ ...styles,
396
+ level: {
397
+ enumerable: true,
398
+ get() {
399
+ return this[GENERATOR].level;
400
+ },
401
+ set(level) {
402
+ this[GENERATOR].level = level;
403
+ },
404
+ },
405
+ });
406
+
407
+ const createStyler = (open, close, parent) => {
408
+ let openAll;
409
+ let closeAll;
410
+ if (parent === undefined) {
411
+ openAll = open;
412
+ closeAll = close;
413
+ } else {
414
+ openAll = parent.openAll + open;
415
+ closeAll = close + parent.closeAll;
416
+ }
417
+
418
+ return {
419
+ open,
420
+ close,
421
+ openAll,
422
+ closeAll,
423
+ parent,
424
+ };
425
+ };
426
+
427
+ const createBuilder = (self, _styler, _isEmpty) => {
428
+ // Single argument is hot path, implicit coercion is faster than anything
429
+ // eslint-disable-next-line no-implicit-coercion
430
+ const builder = (...arguments_) => applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' '));
431
+
432
+ // We alter the prototype because we must return a function, but there is
433
+ // no way to create a function with a different prototype
434
+ Object.setPrototypeOf(builder, proto);
435
+
436
+ builder[GENERATOR] = self;
437
+ builder[STYLER] = _styler;
438
+ builder[IS_EMPTY] = _isEmpty;
439
+
440
+ return builder;
441
+ };
442
+
443
+ const applyStyle = (self, string) => {
444
+ if (self.level <= 0 || !string) {
445
+ return self[IS_EMPTY] ? '' : string;
446
+ }
447
+
448
+ let styler = self[STYLER];
449
+
450
+ if (styler === undefined) {
451
+ return string;
452
+ }
453
+
454
+ const {openAll, closeAll} = styler;
455
+ if (string.includes('\u001B')) {
456
+ while (styler !== undefined) {
457
+ // Replace any instances already present with a re-opening code
458
+ // otherwise only the part of the string until said closing code
459
+ // will be colored, and the rest will simply be 'plain'.
460
+ string = stringReplaceAll(string, styler.close, styler.open);
461
+
462
+ styler = styler.parent;
463
+ }
464
+ }
465
+
466
+ // We can move both next actions out of loop, because remaining actions in loop won't have
467
+ // any/visible effect on parts we add here. Close the styling before a linebreak and reopen
468
+ // after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92
469
+ const lfIndex = string.indexOf('\n');
470
+ if (lfIndex !== -1) {
471
+ string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
472
+ }
473
+
474
+ return openAll + string + closeAll;
475
+ };
476
+
477
+ Object.defineProperties(createChalk.prototype, styles);
478
+
479
+ const chalk = createChalk();
480
+ createChalk({level: stderrColor ? stderrColor.level : 0});
481
+
482
+ const copyProperty = (to, from, property, ignoreNonConfigurable) => {
483
+ // `Function#length` should reflect the parameters of `to` not `from` since we keep its body.
484
+ // `Function#prototype` is non-writable and non-configurable so can never be modified.
485
+ if (property === 'length' || property === 'prototype') {
486
+ return;
487
+ }
488
+
489
+ // `Function#arguments` and `Function#caller` should not be copied. They were reported to be present in `Reflect.ownKeys` for some devices in React Native (#41), so we explicitly ignore them here.
490
+ if (property === 'arguments' || property === 'caller') {
491
+ return;
492
+ }
493
+
494
+ const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
495
+ const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
496
+
497
+ if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {
498
+ return;
499
+ }
500
+
501
+ Object.defineProperty(to, property, fromDescriptor);
502
+ };
503
+
504
+ // `Object.defineProperty()` throws if the property exists, is not configurable and either:
505
+ // - one its descriptors is changed
506
+ // - it is non-writable and its value is changed
507
+ const canCopyProperty = function (toDescriptor, fromDescriptor) {
508
+ return toDescriptor === undefined || toDescriptor.configurable || (
509
+ toDescriptor.writable === fromDescriptor.writable
510
+ && toDescriptor.enumerable === fromDescriptor.enumerable
511
+ && toDescriptor.configurable === fromDescriptor.configurable
512
+ && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value)
513
+ );
514
+ };
515
+
516
+ const changePrototype = (to, from) => {
517
+ const fromPrototype = Object.getPrototypeOf(from);
518
+ if (fromPrototype === Object.getPrototypeOf(to)) {
519
+ return;
520
+ }
521
+
522
+ Object.setPrototypeOf(to, fromPrototype);
523
+ };
524
+
525
+ const wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/\n${fromBody}`;
526
+
527
+ const toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, 'toString');
528
+ const toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, 'name');
529
+
530
+ // We call `from.toString()` early (not lazily) to ensure `from` can be garbage collected.
531
+ // We use `bind()` instead of a closure for the same reason.
532
+ // Calling `from.toString()` early also allows caching it in case `to.toString()` is called several times.
533
+ const changeToString = (to, from, name) => {
534
+ const withName = name === '' ? '' : `with ${name.trim()}() `;
535
+ const newToString = wrappedToString.bind(null, withName, from.toString());
536
+ // Ensure `to.toString.toString` is non-enumerable and has the same `same`
537
+ Object.defineProperty(newToString, 'name', toStringName);
538
+ const {writable, enumerable, configurable} = toStringDescriptor; // We destructue to avoid a potential `get` descriptor.
539
+ Object.defineProperty(to, 'toString', {value: newToString, writable, enumerable, configurable});
540
+ };
541
+
542
+ function mimicFunction(to, from, {ignoreNonConfigurable = false} = {}) {
543
+ const {name} = to;
544
+
545
+ for (const property of Reflect.ownKeys(from)) {
546
+ copyProperty(to, from, property, ignoreNonConfigurable);
547
+ }
548
+
549
+ changePrototype(to, from);
550
+ changeToString(to, from, name);
551
+
552
+ return to;
553
+ }
554
+
555
+ const calledFunctions = new WeakMap();
556
+
557
+ const onetime = (function_, options = {}) => {
558
+ if (typeof function_ !== 'function') {
559
+ throw new TypeError('Expected a function');
560
+ }
561
+
562
+ let returnValue;
563
+ let callCount = 0;
564
+ const functionName = function_.displayName || function_.name || '<anonymous>';
565
+
566
+ const onetime = function (...arguments_) {
567
+ calledFunctions.set(onetime, ++callCount);
568
+
569
+ if (callCount === 1) {
570
+ returnValue = function_.apply(this, arguments_);
571
+ function_ = undefined;
572
+ } else if (options.throw === true) {
573
+ throw new Error(`Function \`${functionName}\` can only be called once`);
574
+ }
575
+
576
+ return returnValue;
577
+ };
578
+
579
+ mimicFunction(onetime, function_);
580
+ calledFunctions.set(onetime, callCount);
581
+
582
+ return onetime;
583
+ };
584
+
585
+ onetime.callCount = function_ => {
586
+ if (!calledFunctions.has(function_)) {
587
+ throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
588
+ }
589
+
590
+ return calledFunctions.get(function_);
591
+ };
592
+
593
+ const terminal = process__default.stderr.isTTY
594
+ ? process__default.stderr
595
+ : (process__default.stdout.isTTY ? process__default.stdout : undefined);
596
+
597
+ const restoreCursor = terminal ? onetime(() => {
598
+ onExit(() => {
599
+ terminal.write('\u001B[?25h');
600
+ }, {alwaysLast: true});
601
+ }) : () => {};
602
+
603
+ let isHidden = false;
604
+
605
+ const cliCursor = {};
606
+
607
+ cliCursor.show = (writableStream = process__default.stderr) => {
608
+ if (!writableStream.isTTY) {
609
+ return;
610
+ }
611
+
612
+ isHidden = false;
613
+ writableStream.write('\u001B[?25h');
614
+ };
615
+
616
+ cliCursor.hide = (writableStream = process__default.stderr) => {
617
+ if (!writableStream.isTTY) {
618
+ return;
619
+ }
620
+
621
+ restoreCursor();
622
+ isHidden = true;
623
+ writableStream.write('\u001B[?25l');
624
+ };
625
+
626
+ cliCursor.toggle = (force, writableStream) => {
627
+ if (force !== undefined) {
628
+ isHidden = force;
629
+ }
630
+
631
+ if (isHidden) {
632
+ cliCursor.show(writableStream);
633
+ } else {
634
+ cliCursor.hide(writableStream);
635
+ }
636
+ };
637
+
638
+ const dots = {
639
+ interval: 80,
640
+ frames: [
641
+ "⠋",
642
+ "⠙",
643
+ "⠹",
644
+ "⠸",
645
+ "⠼",
646
+ "⠴",
647
+ "⠦",
648
+ "⠧",
649
+ "⠇",
650
+ "⠏"
651
+ ]
652
+ };
653
+ const dots2 = {
654
+ interval: 80,
655
+ frames: [
656
+ "⣾",
657
+ "⣽",
658
+ "⣻",
659
+ "⢿",
660
+ "⡿",
661
+ "⣟",
662
+ "⣯",
663
+ "⣷"
664
+ ]
665
+ };
666
+ const dots3 = {
667
+ interval: 80,
668
+ frames: [
669
+ "⠋",
670
+ "⠙",
671
+ "⠚",
672
+ "⠞",
673
+ "⠖",
674
+ "⠦",
675
+ "⠴",
676
+ "⠲",
677
+ "⠳",
678
+ "⠓"
679
+ ]
680
+ };
681
+ const dots4 = {
682
+ interval: 80,
683
+ frames: [
684
+ "⠄",
685
+ "⠆",
686
+ "⠇",
687
+ "⠋",
688
+ "⠙",
689
+ "⠸",
690
+ "⠰",
691
+ "⠠",
692
+ "⠰",
693
+ "⠸",
694
+ "⠙",
695
+ "⠋",
696
+ "⠇",
697
+ "⠆"
698
+ ]
699
+ };
700
+ const dots5 = {
701
+ interval: 80,
702
+ frames: [
703
+ "⠋",
704
+ "⠙",
705
+ "⠚",
706
+ "⠒",
707
+ "⠂",
708
+ "⠂",
709
+ "⠒",
710
+ "⠲",
711
+ "⠴",
712
+ "⠦",
713
+ "⠖",
714
+ "⠒",
715
+ "⠐",
716
+ "⠐",
717
+ "⠒",
718
+ "⠓",
719
+ "⠋"
720
+ ]
721
+ };
722
+ const dots6 = {
723
+ interval: 80,
724
+ frames: [
725
+ "⠁",
726
+ "⠉",
727
+ "⠙",
728
+ "⠚",
729
+ "⠒",
730
+ "⠂",
731
+ "⠂",
732
+ "⠒",
733
+ "⠲",
734
+ "⠴",
735
+ "⠤",
736
+ "⠄",
737
+ "⠄",
738
+ "⠤",
739
+ "⠴",
740
+ "⠲",
741
+ "⠒",
742
+ "⠂",
743
+ "⠂",
744
+ "⠒",
745
+ "⠚",
746
+ "⠙",
747
+ "⠉",
748
+ "⠁"
749
+ ]
750
+ };
751
+ const dots7 = {
752
+ interval: 80,
753
+ frames: [
754
+ "⠈",
755
+ "⠉",
756
+ "⠋",
757
+ "⠓",
758
+ "⠒",
759
+ "⠐",
760
+ "⠐",
761
+ "⠒",
762
+ "⠖",
763
+ "⠦",
764
+ "⠤",
765
+ "⠠",
766
+ "⠠",
767
+ "⠤",
768
+ "⠦",
769
+ "⠖",
770
+ "⠒",
771
+ "⠐",
772
+ "⠐",
773
+ "⠒",
774
+ "⠓",
775
+ "⠋",
776
+ "⠉",
777
+ "⠈"
778
+ ]
779
+ };
780
+ const dots8 = {
781
+ interval: 80,
782
+ frames: [
783
+ "⠁",
784
+ "⠁",
785
+ "⠉",
786
+ "⠙",
787
+ "⠚",
788
+ "⠒",
789
+ "⠂",
790
+ "⠂",
791
+ "⠒",
792
+ "⠲",
793
+ "⠴",
794
+ "⠤",
795
+ "⠄",
796
+ "⠄",
797
+ "⠤",
798
+ "⠠",
799
+ "⠠",
800
+ "⠤",
801
+ "⠦",
802
+ "⠖",
803
+ "⠒",
804
+ "⠐",
805
+ "⠐",
806
+ "⠒",
807
+ "⠓",
808
+ "⠋",
809
+ "⠉",
810
+ "⠈",
811
+ "⠈"
812
+ ]
813
+ };
814
+ const dots9 = {
815
+ interval: 80,
816
+ frames: [
817
+ "⢹",
818
+ "⢺",
819
+ "⢼",
820
+ "⣸",
821
+ "⣇",
822
+ "⡧",
823
+ "⡗",
824
+ "⡏"
825
+ ]
826
+ };
827
+ const dots10 = {
828
+ interval: 80,
829
+ frames: [
830
+ "⢄",
831
+ "⢂",
832
+ "⢁",
833
+ "⡁",
834
+ "⡈",
835
+ "⡐",
836
+ "⡠"
837
+ ]
838
+ };
839
+ const dots11 = {
840
+ interval: 100,
841
+ frames: [
842
+ "⠁",
843
+ "⠂",
844
+ "⠄",
845
+ "⡀",
846
+ "⢀",
847
+ "⠠",
848
+ "⠐",
849
+ "⠈"
850
+ ]
851
+ };
852
+ const dots12 = {
853
+ interval: 80,
854
+ frames: [
855
+ "⢀⠀",
856
+ "⡀⠀",
857
+ "⠄⠀",
858
+ "⢂⠀",
859
+ "⡂⠀",
860
+ "⠅⠀",
861
+ "⢃⠀",
862
+ "⡃⠀",
863
+ "⠍⠀",
864
+ "⢋⠀",
865
+ "⡋⠀",
866
+ "⠍⠁",
867
+ "⢋⠁",
868
+ "⡋⠁",
869
+ "⠍⠉",
870
+ "⠋⠉",
871
+ "⠋⠉",
872
+ "⠉⠙",
873
+ "⠉⠙",
874
+ "⠉⠩",
875
+ "⠈⢙",
876
+ "⠈⡙",
877
+ "⢈⠩",
878
+ "⡀⢙",
879
+ "⠄⡙",
880
+ "⢂⠩",
881
+ "⡂⢘",
882
+ "⠅⡘",
883
+ "⢃⠨",
884
+ "⡃⢐",
885
+ "⠍⡐",
886
+ "⢋⠠",
887
+ "⡋⢀",
888
+ "⠍⡁",
889
+ "⢋⠁",
890
+ "⡋⠁",
891
+ "⠍⠉",
892
+ "⠋⠉",
893
+ "⠋⠉",
894
+ "⠉⠙",
895
+ "⠉⠙",
896
+ "⠉⠩",
897
+ "⠈⢙",
898
+ "⠈⡙",
899
+ "⠈⠩",
900
+ "⠀⢙",
901
+ "⠀⡙",
902
+ "⠀⠩",
903
+ "⠀⢘",
904
+ "⠀⡘",
905
+ "⠀⠨",
906
+ "⠀⢐",
907
+ "⠀⡐",
908
+ "⠀⠠",
909
+ "⠀⢀",
910
+ "⠀⡀"
911
+ ]
912
+ };
913
+ const dots13 = {
914
+ interval: 80,
915
+ frames: [
916
+ "⣼",
917
+ "⣹",
918
+ "⢻",
919
+ "⠿",
920
+ "⡟",
921
+ "⣏",
922
+ "⣧",
923
+ "⣶"
924
+ ]
925
+ };
926
+ const dots14 = {
927
+ interval: 80,
928
+ frames: [
929
+ "⠉⠉",
930
+ "⠈⠙",
931
+ "⠀⠹",
932
+ "⠀⢸",
933
+ "⠀⣰",
934
+ "⢀⣠",
935
+ "⣀⣀",
936
+ "⣄⡀",
937
+ "⣆⠀",
938
+ "⡇⠀",
939
+ "⠏⠀",
940
+ "⠋⠁"
941
+ ]
942
+ };
943
+ const dots8Bit = {
944
+ interval: 80,
945
+ frames: [
946
+ "⠀",
947
+ "⠁",
948
+ "⠂",
949
+ "⠃",
950
+ "⠄",
951
+ "⠅",
952
+ "⠆",
953
+ "⠇",
954
+ "⡀",
955
+ "⡁",
956
+ "⡂",
957
+ "⡃",
958
+ "⡄",
959
+ "⡅",
960
+ "⡆",
961
+ "⡇",
962
+ "⠈",
963
+ "⠉",
964
+ "⠊",
965
+ "⠋",
966
+ "⠌",
967
+ "⠍",
968
+ "⠎",
969
+ "⠏",
970
+ "⡈",
971
+ "⡉",
972
+ "⡊",
973
+ "⡋",
974
+ "⡌",
975
+ "⡍",
976
+ "⡎",
977
+ "⡏",
978
+ "⠐",
979
+ "⠑",
980
+ "⠒",
981
+ "⠓",
982
+ "⠔",
983
+ "⠕",
984
+ "⠖",
985
+ "⠗",
986
+ "⡐",
987
+ "⡑",
988
+ "⡒",
989
+ "⡓",
990
+ "⡔",
991
+ "⡕",
992
+ "⡖",
993
+ "⡗",
994
+ "⠘",
995
+ "⠙",
996
+ "⠚",
997
+ "⠛",
998
+ "⠜",
999
+ "⠝",
1000
+ "⠞",
1001
+ "⠟",
1002
+ "⡘",
1003
+ "⡙",
1004
+ "⡚",
1005
+ "⡛",
1006
+ "⡜",
1007
+ "⡝",
1008
+ "⡞",
1009
+ "⡟",
1010
+ "⠠",
1011
+ "⠡",
1012
+ "⠢",
1013
+ "⠣",
1014
+ "⠤",
1015
+ "⠥",
1016
+ "⠦",
1017
+ "⠧",
1018
+ "⡠",
1019
+ "⡡",
1020
+ "⡢",
1021
+ "⡣",
1022
+ "⡤",
1023
+ "⡥",
1024
+ "⡦",
1025
+ "⡧",
1026
+ "⠨",
1027
+ "⠩",
1028
+ "⠪",
1029
+ "⠫",
1030
+ "⠬",
1031
+ "⠭",
1032
+ "⠮",
1033
+ "⠯",
1034
+ "⡨",
1035
+ "⡩",
1036
+ "⡪",
1037
+ "⡫",
1038
+ "⡬",
1039
+ "⡭",
1040
+ "⡮",
1041
+ "⡯",
1042
+ "⠰",
1043
+ "⠱",
1044
+ "⠲",
1045
+ "⠳",
1046
+ "⠴",
1047
+ "⠵",
1048
+ "⠶",
1049
+ "⠷",
1050
+ "⡰",
1051
+ "⡱",
1052
+ "⡲",
1053
+ "⡳",
1054
+ "⡴",
1055
+ "⡵",
1056
+ "⡶",
1057
+ "⡷",
1058
+ "⠸",
1059
+ "⠹",
1060
+ "⠺",
1061
+ "⠻",
1062
+ "⠼",
1063
+ "⠽",
1064
+ "⠾",
1065
+ "⠿",
1066
+ "⡸",
1067
+ "⡹",
1068
+ "⡺",
1069
+ "⡻",
1070
+ "⡼",
1071
+ "⡽",
1072
+ "⡾",
1073
+ "⡿",
1074
+ "⢀",
1075
+ "⢁",
1076
+ "⢂",
1077
+ "⢃",
1078
+ "⢄",
1079
+ "⢅",
1080
+ "⢆",
1081
+ "⢇",
1082
+ "⣀",
1083
+ "⣁",
1084
+ "⣂",
1085
+ "⣃",
1086
+ "⣄",
1087
+ "⣅",
1088
+ "⣆",
1089
+ "⣇",
1090
+ "⢈",
1091
+ "⢉",
1092
+ "⢊",
1093
+ "⢋",
1094
+ "⢌",
1095
+ "⢍",
1096
+ "⢎",
1097
+ "⢏",
1098
+ "⣈",
1099
+ "⣉",
1100
+ "⣊",
1101
+ "⣋",
1102
+ "⣌",
1103
+ "⣍",
1104
+ "⣎",
1105
+ "⣏",
1106
+ "⢐",
1107
+ "⢑",
1108
+ "⢒",
1109
+ "⢓",
1110
+ "⢔",
1111
+ "⢕",
1112
+ "⢖",
1113
+ "⢗",
1114
+ "⣐",
1115
+ "⣑",
1116
+ "⣒",
1117
+ "⣓",
1118
+ "⣔",
1119
+ "⣕",
1120
+ "⣖",
1121
+ "⣗",
1122
+ "⢘",
1123
+ "⢙",
1124
+ "⢚",
1125
+ "⢛",
1126
+ "⢜",
1127
+ "⢝",
1128
+ "⢞",
1129
+ "⢟",
1130
+ "⣘",
1131
+ "⣙",
1132
+ "⣚",
1133
+ "⣛",
1134
+ "⣜",
1135
+ "⣝",
1136
+ "⣞",
1137
+ "⣟",
1138
+ "⢠",
1139
+ "⢡",
1140
+ "⢢",
1141
+ "⢣",
1142
+ "⢤",
1143
+ "⢥",
1144
+ "⢦",
1145
+ "⢧",
1146
+ "⣠",
1147
+ "⣡",
1148
+ "⣢",
1149
+ "⣣",
1150
+ "⣤",
1151
+ "⣥",
1152
+ "⣦",
1153
+ "⣧",
1154
+ "⢨",
1155
+ "⢩",
1156
+ "⢪",
1157
+ "⢫",
1158
+ "⢬",
1159
+ "⢭",
1160
+ "⢮",
1161
+ "⢯",
1162
+ "⣨",
1163
+ "⣩",
1164
+ "⣪",
1165
+ "⣫",
1166
+ "⣬",
1167
+ "⣭",
1168
+ "⣮",
1169
+ "⣯",
1170
+ "⢰",
1171
+ "⢱",
1172
+ "⢲",
1173
+ "⢳",
1174
+ "⢴",
1175
+ "⢵",
1176
+ "⢶",
1177
+ "⢷",
1178
+ "⣰",
1179
+ "⣱",
1180
+ "⣲",
1181
+ "⣳",
1182
+ "⣴",
1183
+ "⣵",
1184
+ "⣶",
1185
+ "⣷",
1186
+ "⢸",
1187
+ "⢹",
1188
+ "⢺",
1189
+ "⢻",
1190
+ "⢼",
1191
+ "⢽",
1192
+ "⢾",
1193
+ "⢿",
1194
+ "⣸",
1195
+ "⣹",
1196
+ "⣺",
1197
+ "⣻",
1198
+ "⣼",
1199
+ "⣽",
1200
+ "⣾",
1201
+ "⣿"
1202
+ ]
1203
+ };
1204
+ const dotsCircle = {
1205
+ interval: 80,
1206
+ frames: [
1207
+ "⢎ ",
1208
+ "⠎⠁",
1209
+ "⠊⠑",
1210
+ "⠈⠱",
1211
+ " ⡱",
1212
+ "⢀⡰",
1213
+ "⢄⡠",
1214
+ "⢆⡀"
1215
+ ]
1216
+ };
1217
+ const sand = {
1218
+ interval: 80,
1219
+ frames: [
1220
+ "⠁",
1221
+ "⠂",
1222
+ "⠄",
1223
+ "⡀",
1224
+ "⡈",
1225
+ "⡐",
1226
+ "⡠",
1227
+ "⣀",
1228
+ "⣁",
1229
+ "⣂",
1230
+ "⣄",
1231
+ "⣌",
1232
+ "⣔",
1233
+ "⣤",
1234
+ "⣥",
1235
+ "⣦",
1236
+ "⣮",
1237
+ "⣶",
1238
+ "⣷",
1239
+ "⣿",
1240
+ "⡿",
1241
+ "⠿",
1242
+ "⢟",
1243
+ "⠟",
1244
+ "⡛",
1245
+ "⠛",
1246
+ "⠫",
1247
+ "⢋",
1248
+ "⠋",
1249
+ "⠍",
1250
+ "⡉",
1251
+ "⠉",
1252
+ "⠑",
1253
+ "⠡",
1254
+ "⢁"
1255
+ ]
1256
+ };
1257
+ const line = {
1258
+ interval: 130,
1259
+ frames: [
1260
+ "-",
1261
+ "\\",
1262
+ "|",
1263
+ "/"
1264
+ ]
1265
+ };
1266
+ const line2 = {
1267
+ interval: 100,
1268
+ frames: [
1269
+ "⠂",
1270
+ "-",
1271
+ "–",
1272
+ "—",
1273
+ "–",
1274
+ "-"
1275
+ ]
1276
+ };
1277
+ const pipe = {
1278
+ interval: 100,
1279
+ frames: [
1280
+ "┤",
1281
+ "┘",
1282
+ "┴",
1283
+ "└",
1284
+ "├",
1285
+ "┌",
1286
+ "┬",
1287
+ "┐"
1288
+ ]
1289
+ };
1290
+ const simpleDots = {
1291
+ interval: 400,
1292
+ frames: [
1293
+ ". ",
1294
+ ".. ",
1295
+ "...",
1296
+ " "
1297
+ ]
1298
+ };
1299
+ const simpleDotsScrolling = {
1300
+ interval: 200,
1301
+ frames: [
1302
+ ". ",
1303
+ ".. ",
1304
+ "...",
1305
+ " ..",
1306
+ " .",
1307
+ " "
1308
+ ]
1309
+ };
1310
+ const star = {
1311
+ interval: 70,
1312
+ frames: [
1313
+ "✶",
1314
+ "✸",
1315
+ "✹",
1316
+ "✺",
1317
+ "✹",
1318
+ "✷"
1319
+ ]
1320
+ };
1321
+ const star2 = {
1322
+ interval: 80,
1323
+ frames: [
1324
+ "+",
1325
+ "x",
1326
+ "*"
1327
+ ]
1328
+ };
1329
+ const flip = {
1330
+ interval: 70,
1331
+ frames: [
1332
+ "_",
1333
+ "_",
1334
+ "_",
1335
+ "-",
1336
+ "`",
1337
+ "`",
1338
+ "'",
1339
+ "´",
1340
+ "-",
1341
+ "_",
1342
+ "_",
1343
+ "_"
1344
+ ]
1345
+ };
1346
+ const hamburger = {
1347
+ interval: 100,
1348
+ frames: [
1349
+ "☱",
1350
+ "☲",
1351
+ "☴"
1352
+ ]
1353
+ };
1354
+ const growVertical = {
1355
+ interval: 120,
1356
+ frames: [
1357
+ "▁",
1358
+ "▃",
1359
+ "▄",
1360
+ "▅",
1361
+ "▆",
1362
+ "▇",
1363
+ "▆",
1364
+ "▅",
1365
+ "▄",
1366
+ "▃"
1367
+ ]
1368
+ };
1369
+ const growHorizontal = {
1370
+ interval: 120,
1371
+ frames: [
1372
+ "▏",
1373
+ "▎",
1374
+ "▍",
1375
+ "▌",
1376
+ "▋",
1377
+ "▊",
1378
+ "▉",
1379
+ "▊",
1380
+ "▋",
1381
+ "▌",
1382
+ "▍",
1383
+ "▎"
1384
+ ]
1385
+ };
1386
+ const balloon = {
1387
+ interval: 140,
1388
+ frames: [
1389
+ " ",
1390
+ ".",
1391
+ "o",
1392
+ "O",
1393
+ "@",
1394
+ "*",
1395
+ " "
1396
+ ]
1397
+ };
1398
+ const balloon2 = {
1399
+ interval: 120,
1400
+ frames: [
1401
+ ".",
1402
+ "o",
1403
+ "O",
1404
+ "°",
1405
+ "O",
1406
+ "o",
1407
+ "."
1408
+ ]
1409
+ };
1410
+ const noise = {
1411
+ interval: 100,
1412
+ frames: [
1413
+ "▓",
1414
+ "▒",
1415
+ "░"
1416
+ ]
1417
+ };
1418
+ const bounce = {
1419
+ interval: 120,
1420
+ frames: [
1421
+ "⠁",
1422
+ "⠂",
1423
+ "⠄",
1424
+ "⠂"
1425
+ ]
1426
+ };
1427
+ const boxBounce = {
1428
+ interval: 120,
1429
+ frames: [
1430
+ "▖",
1431
+ "▘",
1432
+ "▝",
1433
+ "▗"
1434
+ ]
1435
+ };
1436
+ const boxBounce2 = {
1437
+ interval: 100,
1438
+ frames: [
1439
+ "▌",
1440
+ "▀",
1441
+ "▐",
1442
+ "▄"
1443
+ ]
1444
+ };
1445
+ const triangle = {
1446
+ interval: 50,
1447
+ frames: [
1448
+ "◢",
1449
+ "◣",
1450
+ "◤",
1451
+ "◥"
1452
+ ]
1453
+ };
1454
+ const binary = {
1455
+ interval: 80,
1456
+ frames: [
1457
+ "010010",
1458
+ "001100",
1459
+ "100101",
1460
+ "111010",
1461
+ "111101",
1462
+ "010111",
1463
+ "101011",
1464
+ "111000",
1465
+ "110011",
1466
+ "110101"
1467
+ ]
1468
+ };
1469
+ const arc = {
1470
+ interval: 100,
1471
+ frames: [
1472
+ "◜",
1473
+ "◠",
1474
+ "◝",
1475
+ "◞",
1476
+ "◡",
1477
+ "◟"
1478
+ ]
1479
+ };
1480
+ const circle = {
1481
+ interval: 120,
1482
+ frames: [
1483
+ "◡",
1484
+ "⊙",
1485
+ "◠"
1486
+ ]
1487
+ };
1488
+ const squareCorners = {
1489
+ interval: 180,
1490
+ frames: [
1491
+ "◰",
1492
+ "◳",
1493
+ "◲",
1494
+ "◱"
1495
+ ]
1496
+ };
1497
+ const circleQuarters = {
1498
+ interval: 120,
1499
+ frames: [
1500
+ "◴",
1501
+ "◷",
1502
+ "◶",
1503
+ "◵"
1504
+ ]
1505
+ };
1506
+ const circleHalves = {
1507
+ interval: 50,
1508
+ frames: [
1509
+ "◐",
1510
+ "◓",
1511
+ "◑",
1512
+ "◒"
1513
+ ]
1514
+ };
1515
+ const squish = {
1516
+ interval: 100,
1517
+ frames: [
1518
+ "╫",
1519
+ "╪"
1520
+ ]
1521
+ };
1522
+ const toggle = {
1523
+ interval: 250,
1524
+ frames: [
1525
+ "⊶",
1526
+ "⊷"
1527
+ ]
1528
+ };
1529
+ const toggle2 = {
1530
+ interval: 80,
1531
+ frames: [
1532
+ "▫",
1533
+ "▪"
1534
+ ]
1535
+ };
1536
+ const toggle3 = {
1537
+ interval: 120,
1538
+ frames: [
1539
+ "□",
1540
+ "■"
1541
+ ]
1542
+ };
1543
+ const toggle4 = {
1544
+ interval: 100,
1545
+ frames: [
1546
+ "■",
1547
+ "□",
1548
+ "▪",
1549
+ "▫"
1550
+ ]
1551
+ };
1552
+ const toggle5 = {
1553
+ interval: 100,
1554
+ frames: [
1555
+ "▮",
1556
+ "▯"
1557
+ ]
1558
+ };
1559
+ const toggle6 = {
1560
+ interval: 300,
1561
+ frames: [
1562
+ "ဝ",
1563
+ "၀"
1564
+ ]
1565
+ };
1566
+ const toggle7 = {
1567
+ interval: 80,
1568
+ frames: [
1569
+ "⦾",
1570
+ "⦿"
1571
+ ]
1572
+ };
1573
+ const toggle8 = {
1574
+ interval: 100,
1575
+ frames: [
1576
+ "◍",
1577
+ "◌"
1578
+ ]
1579
+ };
1580
+ const toggle9 = {
1581
+ interval: 100,
1582
+ frames: [
1583
+ "◉",
1584
+ "◎"
1585
+ ]
1586
+ };
1587
+ const toggle10 = {
1588
+ interval: 100,
1589
+ frames: [
1590
+ "㊂",
1591
+ "㊀",
1592
+ "㊁"
1593
+ ]
1594
+ };
1595
+ const toggle11 = {
1596
+ interval: 50,
1597
+ frames: [
1598
+ "⧇",
1599
+ "⧆"
1600
+ ]
1601
+ };
1602
+ const toggle12 = {
1603
+ interval: 120,
1604
+ frames: [
1605
+ "☗",
1606
+ "☖"
1607
+ ]
1608
+ };
1609
+ const toggle13 = {
1610
+ interval: 80,
1611
+ frames: [
1612
+ "=",
1613
+ "*",
1614
+ "-"
1615
+ ]
1616
+ };
1617
+ const arrow = {
1618
+ interval: 100,
1619
+ frames: [
1620
+ "←",
1621
+ "↖",
1622
+ "↑",
1623
+ "↗",
1624
+ "→",
1625
+ "↘",
1626
+ "↓",
1627
+ "↙"
1628
+ ]
1629
+ };
1630
+ const arrow2 = {
1631
+ interval: 80,
1632
+ frames: [
1633
+ "⬆️ ",
1634
+ "↗️ ",
1635
+ "➡️ ",
1636
+ "↘️ ",
1637
+ "⬇️ ",
1638
+ "↙️ ",
1639
+ "⬅️ ",
1640
+ "↖️ "
1641
+ ]
1642
+ };
1643
+ const arrow3 = {
1644
+ interval: 120,
1645
+ frames: [
1646
+ "▹▹▹▹▹",
1647
+ "▸▹▹▹▹",
1648
+ "▹▸▹▹▹",
1649
+ "▹▹▸▹▹",
1650
+ "▹▹▹▸▹",
1651
+ "▹▹▹▹▸"
1652
+ ]
1653
+ };
1654
+ const bouncingBar = {
1655
+ interval: 80,
1656
+ frames: [
1657
+ "[ ]",
1658
+ "[= ]",
1659
+ "[== ]",
1660
+ "[=== ]",
1661
+ "[====]",
1662
+ "[ ===]",
1663
+ "[ ==]",
1664
+ "[ =]",
1665
+ "[ ]",
1666
+ "[ =]",
1667
+ "[ ==]",
1668
+ "[ ===]",
1669
+ "[====]",
1670
+ "[=== ]",
1671
+ "[== ]",
1672
+ "[= ]"
1673
+ ]
1674
+ };
1675
+ const bouncingBall = {
1676
+ interval: 80,
1677
+ frames: [
1678
+ "( ● )",
1679
+ "( ● )",
1680
+ "( ● )",
1681
+ "( ● )",
1682
+ "( ●)",
1683
+ "( ● )",
1684
+ "( ● )",
1685
+ "( ● )",
1686
+ "( ● )",
1687
+ "(● )"
1688
+ ]
1689
+ };
1690
+ const smiley = {
1691
+ interval: 200,
1692
+ frames: [
1693
+ "😄 ",
1694
+ "😝 "
1695
+ ]
1696
+ };
1697
+ const monkey = {
1698
+ interval: 300,
1699
+ frames: [
1700
+ "🙈 ",
1701
+ "🙈 ",
1702
+ "🙉 ",
1703
+ "🙊 "
1704
+ ]
1705
+ };
1706
+ const hearts = {
1707
+ interval: 100,
1708
+ frames: [
1709
+ "💛 ",
1710
+ "💙 ",
1711
+ "💜 ",
1712
+ "💚 ",
1713
+ "💗 "
1714
+ ]
1715
+ };
1716
+ const clock = {
1717
+ interval: 100,
1718
+ frames: [
1719
+ "🕛 ",
1720
+ "🕐 ",
1721
+ "🕑 ",
1722
+ "🕒 ",
1723
+ "🕓 ",
1724
+ "🕔 ",
1725
+ "🕕 ",
1726
+ "🕖 ",
1727
+ "🕗 ",
1728
+ "🕘 ",
1729
+ "🕙 ",
1730
+ "🕚 "
1731
+ ]
1732
+ };
1733
+ const earth = {
1734
+ interval: 180,
1735
+ frames: [
1736
+ "🌍 ",
1737
+ "🌎 ",
1738
+ "🌏 "
1739
+ ]
1740
+ };
1741
+ const material = {
1742
+ interval: 17,
1743
+ frames: [
1744
+ "█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
1745
+ "██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
1746
+ "███▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
1747
+ "████▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
1748
+ "██████▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
1749
+ "██████▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
1750
+ "███████▁▁▁▁▁▁▁▁▁▁▁▁▁",
1751
+ "████████▁▁▁▁▁▁▁▁▁▁▁▁",
1752
+ "█████████▁▁▁▁▁▁▁▁▁▁▁",
1753
+ "█████████▁▁▁▁▁▁▁▁▁▁▁",
1754
+ "██████████▁▁▁▁▁▁▁▁▁▁",
1755
+ "███████████▁▁▁▁▁▁▁▁▁",
1756
+ "█████████████▁▁▁▁▁▁▁",
1757
+ "██████████████▁▁▁▁▁▁",
1758
+ "██████████████▁▁▁▁▁▁",
1759
+ "▁██████████████▁▁▁▁▁",
1760
+ "▁██████████████▁▁▁▁▁",
1761
+ "▁██████████████▁▁▁▁▁",
1762
+ "▁▁██████████████▁▁▁▁",
1763
+ "▁▁▁██████████████▁▁▁",
1764
+ "▁▁▁▁█████████████▁▁▁",
1765
+ "▁▁▁▁██████████████▁▁",
1766
+ "▁▁▁▁██████████████▁▁",
1767
+ "▁▁▁▁▁██████████████▁",
1768
+ "▁▁▁▁▁██████████████▁",
1769
+ "▁▁▁▁▁██████████████▁",
1770
+ "▁▁▁▁▁▁██████████████",
1771
+ "▁▁▁▁▁▁██████████████",
1772
+ "▁▁▁▁▁▁▁█████████████",
1773
+ "▁▁▁▁▁▁▁█████████████",
1774
+ "▁▁▁▁▁▁▁▁████████████",
1775
+ "▁▁▁▁▁▁▁▁████████████",
1776
+ "▁▁▁▁▁▁▁▁▁███████████",
1777
+ "▁▁▁▁▁▁▁▁▁███████████",
1778
+ "▁▁▁▁▁▁▁▁▁▁██████████",
1779
+ "▁▁▁▁▁▁▁▁▁▁██████████",
1780
+ "▁▁▁▁▁▁▁▁▁▁▁▁████████",
1781
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁███████",
1782
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁██████",
1783
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████",
1784
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████",
1785
+ "█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████",
1786
+ "██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███",
1787
+ "██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███",
1788
+ "███▁▁▁▁▁▁▁▁▁▁▁▁▁▁███",
1789
+ "████▁▁▁▁▁▁▁▁▁▁▁▁▁▁██",
1790
+ "█████▁▁▁▁▁▁▁▁▁▁▁▁▁▁█",
1791
+ "█████▁▁▁▁▁▁▁▁▁▁▁▁▁▁█",
1792
+ "██████▁▁▁▁▁▁▁▁▁▁▁▁▁█",
1793
+ "████████▁▁▁▁▁▁▁▁▁▁▁▁",
1794
+ "█████████▁▁▁▁▁▁▁▁▁▁▁",
1795
+ "█████████▁▁▁▁▁▁▁▁▁▁▁",
1796
+ "█████████▁▁▁▁▁▁▁▁▁▁▁",
1797
+ "█████████▁▁▁▁▁▁▁▁▁▁▁",
1798
+ "███████████▁▁▁▁▁▁▁▁▁",
1799
+ "████████████▁▁▁▁▁▁▁▁",
1800
+ "████████████▁▁▁▁▁▁▁▁",
1801
+ "██████████████▁▁▁▁▁▁",
1802
+ "██████████████▁▁▁▁▁▁",
1803
+ "▁██████████████▁▁▁▁▁",
1804
+ "▁██████████████▁▁▁▁▁",
1805
+ "▁▁▁█████████████▁▁▁▁",
1806
+ "▁▁▁▁▁████████████▁▁▁",
1807
+ "▁▁▁▁▁████████████▁▁▁",
1808
+ "▁▁▁▁▁▁███████████▁▁▁",
1809
+ "▁▁▁▁▁▁▁▁█████████▁▁▁",
1810
+ "▁▁▁▁▁▁▁▁█████████▁▁▁",
1811
+ "▁▁▁▁▁▁▁▁▁█████████▁▁",
1812
+ "▁▁▁▁▁▁▁▁▁█████████▁▁",
1813
+ "▁▁▁▁▁▁▁▁▁▁█████████▁",
1814
+ "▁▁▁▁▁▁▁▁▁▁▁████████▁",
1815
+ "▁▁▁▁▁▁▁▁▁▁▁████████▁",
1816
+ "▁▁▁▁▁▁▁▁▁▁▁▁███████▁",
1817
+ "▁▁▁▁▁▁▁▁▁▁▁▁███████▁",
1818
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁███████",
1819
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁███████",
1820
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████",
1821
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████",
1822
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████",
1823
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████",
1824
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███",
1825
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███",
1826
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██",
1827
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██",
1828
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██",
1829
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█",
1830
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█",
1831
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█",
1832
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
1833
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
1834
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
1835
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁"
1836
+ ]
1837
+ };
1838
+ const moon = {
1839
+ interval: 80,
1840
+ frames: [
1841
+ "🌑 ",
1842
+ "🌒 ",
1843
+ "🌓 ",
1844
+ "🌔 ",
1845
+ "🌕 ",
1846
+ "🌖 ",
1847
+ "🌗 ",
1848
+ "🌘 "
1849
+ ]
1850
+ };
1851
+ const runner = {
1852
+ interval: 140,
1853
+ frames: [
1854
+ "🚶 ",
1855
+ "🏃 "
1856
+ ]
1857
+ };
1858
+ const pong = {
1859
+ interval: 80,
1860
+ frames: [
1861
+ "▐⠂ ▌",
1862
+ "▐⠈ ▌",
1863
+ "▐ ⠂ ▌",
1864
+ "▐ ⠠ ▌",
1865
+ "▐ ⡀ ▌",
1866
+ "▐ ⠠ ▌",
1867
+ "▐ ⠂ ▌",
1868
+ "▐ ⠈ ▌",
1869
+ "▐ ⠂ ▌",
1870
+ "▐ ⠠ ▌",
1871
+ "▐ ⡀ ▌",
1872
+ "▐ ⠠ ▌",
1873
+ "▐ ⠂ ▌",
1874
+ "▐ ⠈ ▌",
1875
+ "▐ ⠂▌",
1876
+ "▐ ⠠▌",
1877
+ "▐ ⡀▌",
1878
+ "▐ ⠠ ▌",
1879
+ "▐ ⠂ ▌",
1880
+ "▐ ⠈ ▌",
1881
+ "▐ ⠂ ▌",
1882
+ "▐ ⠠ ▌",
1883
+ "▐ ⡀ ▌",
1884
+ "▐ ⠠ ▌",
1885
+ "▐ ⠂ ▌",
1886
+ "▐ ⠈ ▌",
1887
+ "▐ ⠂ ▌",
1888
+ "▐ ⠠ ▌",
1889
+ "▐ ⡀ ▌",
1890
+ "▐⠠ ▌"
1891
+ ]
1892
+ };
1893
+ const shark = {
1894
+ interval: 120,
1895
+ frames: [
1896
+ "▐|\\____________▌",
1897
+ "▐_|\\___________▌",
1898
+ "▐__|\\__________▌",
1899
+ "▐___|\\_________▌",
1900
+ "▐____|\\________▌",
1901
+ "▐_____|\\_______▌",
1902
+ "▐______|\\______▌",
1903
+ "▐_______|\\_____▌",
1904
+ "▐________|\\____▌",
1905
+ "▐_________|\\___▌",
1906
+ "▐__________|\\__▌",
1907
+ "▐___________|\\_▌",
1908
+ "▐____________|\\▌",
1909
+ "▐____________/|▌",
1910
+ "▐___________/|_▌",
1911
+ "▐__________/|__▌",
1912
+ "▐_________/|___▌",
1913
+ "▐________/|____▌",
1914
+ "▐_______/|_____▌",
1915
+ "▐______/|______▌",
1916
+ "▐_____/|_______▌",
1917
+ "▐____/|________▌",
1918
+ "▐___/|_________▌",
1919
+ "▐__/|__________▌",
1920
+ "▐_/|___________▌",
1921
+ "▐/|____________▌"
1922
+ ]
1923
+ };
1924
+ const dqpb = {
1925
+ interval: 100,
1926
+ frames: [
1927
+ "d",
1928
+ "q",
1929
+ "p",
1930
+ "b"
1931
+ ]
1932
+ };
1933
+ const weather = {
1934
+ interval: 100,
1935
+ frames: [
1936
+ "☀️ ",
1937
+ "☀️ ",
1938
+ "☀️ ",
1939
+ "🌤 ",
1940
+ "⛅️ ",
1941
+ "🌥 ",
1942
+ "☁️ ",
1943
+ "🌧 ",
1944
+ "🌨 ",
1945
+ "🌧 ",
1946
+ "🌨 ",
1947
+ "🌧 ",
1948
+ "🌨 ",
1949
+ "⛈ ",
1950
+ "🌨 ",
1951
+ "🌧 ",
1952
+ "🌨 ",
1953
+ "☁️ ",
1954
+ "🌥 ",
1955
+ "⛅️ ",
1956
+ "🌤 ",
1957
+ "☀️ ",
1958
+ "☀️ "
1959
+ ]
1960
+ };
1961
+ const christmas = {
1962
+ interval: 400,
1963
+ frames: [
1964
+ "🌲",
1965
+ "🎄"
1966
+ ]
1967
+ };
1968
+ const grenade = {
1969
+ interval: 80,
1970
+ frames: [
1971
+ "، ",
1972
+ "′ ",
1973
+ " ´ ",
1974
+ " ‾ ",
1975
+ " ⸌",
1976
+ " ⸊",
1977
+ " |",
1978
+ " ⁎",
1979
+ " ⁕",
1980
+ " ෴ ",
1981
+ " ⁓",
1982
+ " ",
1983
+ " ",
1984
+ " "
1985
+ ]
1986
+ };
1987
+ const point = {
1988
+ interval: 125,
1989
+ frames: [
1990
+ "∙∙∙",
1991
+ "●∙∙",
1992
+ "∙●∙",
1993
+ "∙∙●",
1994
+ "∙∙∙"
1995
+ ]
1996
+ };
1997
+ const layer = {
1998
+ interval: 150,
1999
+ frames: [
2000
+ "-",
2001
+ "=",
2002
+ "≡"
2003
+ ]
2004
+ };
2005
+ const betaWave = {
2006
+ interval: 80,
2007
+ frames: [
2008
+ "ρββββββ",
2009
+ "βρβββββ",
2010
+ "ββρββββ",
2011
+ "βββρβββ",
2012
+ "ββββρββ",
2013
+ "βββββρβ",
2014
+ "ββββββρ"
2015
+ ]
2016
+ };
2017
+ const fingerDance = {
2018
+ interval: 160,
2019
+ frames: [
2020
+ "🤘 ",
2021
+ "🤟 ",
2022
+ "🖖 ",
2023
+ "✋ ",
2024
+ "🤚 ",
2025
+ "👆 "
2026
+ ]
2027
+ };
2028
+ const fistBump = {
2029
+ interval: 80,
2030
+ frames: [
2031
+ "🤜    🤛 ",
2032
+ "🤜    🤛 ",
2033
+ "🤜    🤛 ",
2034
+ " 🤜  🤛  ",
2035
+ "  🤜🤛   ",
2036
+ " 🤜✨🤛   ",
2037
+ "🤜 ✨ 🤛  "
2038
+ ]
2039
+ };
2040
+ const soccerHeader = {
2041
+ interval: 80,
2042
+ frames: [
2043
+ " 🧑⚽️ 🧑 ",
2044
+ "🧑 ⚽️ 🧑 ",
2045
+ "🧑 ⚽️ 🧑 ",
2046
+ "🧑 ⚽️ 🧑 ",
2047
+ "🧑 ⚽️ 🧑 ",
2048
+ "🧑 ⚽️ 🧑 ",
2049
+ "🧑 ⚽️🧑 ",
2050
+ "🧑 ⚽️ 🧑 ",
2051
+ "🧑 ⚽️ 🧑 ",
2052
+ "🧑 ⚽️ 🧑 ",
2053
+ "🧑 ⚽️ 🧑 ",
2054
+ "🧑 ⚽️ 🧑 "
2055
+ ]
2056
+ };
2057
+ const mindblown = {
2058
+ interval: 160,
2059
+ frames: [
2060
+ "😐 ",
2061
+ "😐 ",
2062
+ "😮 ",
2063
+ "😮 ",
2064
+ "😦 ",
2065
+ "😦 ",
2066
+ "😧 ",
2067
+ "😧 ",
2068
+ "🤯 ",
2069
+ "💥 ",
2070
+ "✨ ",
2071
+ "  ",
2072
+ "  ",
2073
+ "  "
2074
+ ]
2075
+ };
2076
+ const speaker = {
2077
+ interval: 160,
2078
+ frames: [
2079
+ "🔈 ",
2080
+ "🔉 ",
2081
+ "🔊 ",
2082
+ "🔉 "
2083
+ ]
2084
+ };
2085
+ const orangePulse = {
2086
+ interval: 100,
2087
+ frames: [
2088
+ "🔸 ",
2089
+ "🔶 ",
2090
+ "🟠 ",
2091
+ "🟠 ",
2092
+ "🔶 "
2093
+ ]
2094
+ };
2095
+ const bluePulse = {
2096
+ interval: 100,
2097
+ frames: [
2098
+ "🔹 ",
2099
+ "🔷 ",
2100
+ "🔵 ",
2101
+ "🔵 ",
2102
+ "🔷 "
2103
+ ]
2104
+ };
2105
+ const orangeBluePulse = {
2106
+ interval: 100,
2107
+ frames: [
2108
+ "🔸 ",
2109
+ "🔶 ",
2110
+ "🟠 ",
2111
+ "🟠 ",
2112
+ "🔶 ",
2113
+ "🔹 ",
2114
+ "🔷 ",
2115
+ "🔵 ",
2116
+ "🔵 ",
2117
+ "🔷 "
2118
+ ]
2119
+ };
2120
+ const timeTravel = {
2121
+ interval: 100,
2122
+ frames: [
2123
+ "🕛 ",
2124
+ "🕚 ",
2125
+ "🕙 ",
2126
+ "🕘 ",
2127
+ "🕗 ",
2128
+ "🕖 ",
2129
+ "🕕 ",
2130
+ "🕔 ",
2131
+ "🕓 ",
2132
+ "🕒 ",
2133
+ "🕑 ",
2134
+ "🕐 "
2135
+ ]
2136
+ };
2137
+ const aesthetic = {
2138
+ interval: 80,
2139
+ frames: [
2140
+ "▰▱▱▱▱▱▱",
2141
+ "▰▰▱▱▱▱▱",
2142
+ "▰▰▰▱▱▱▱",
2143
+ "▰▰▰▰▱▱▱",
2144
+ "▰▰▰▰▰▱▱",
2145
+ "▰▰▰▰▰▰▱",
2146
+ "▰▰▰▰▰▰▰",
2147
+ "▰▱▱▱▱▱▱"
2148
+ ]
2149
+ };
2150
+ const dwarfFortress = {
2151
+ interval: 80,
2152
+ frames: [
2153
+ " ██████£££ ",
2154
+ "☺██████£££ ",
2155
+ "☺██████£££ ",
2156
+ "☺▓█████£££ ",
2157
+ "☺▓█████£££ ",
2158
+ "☺▒█████£££ ",
2159
+ "☺▒█████£££ ",
2160
+ "☺░█████£££ ",
2161
+ "☺░█████£££ ",
2162
+ "☺ █████£££ ",
2163
+ " ☺█████£££ ",
2164
+ " ☺█████£££ ",
2165
+ " ☺▓████£££ ",
2166
+ " ☺▓████£££ ",
2167
+ " ☺▒████£££ ",
2168
+ " ☺▒████£££ ",
2169
+ " ☺░████£££ ",
2170
+ " ☺░████£££ ",
2171
+ " ☺ ████£££ ",
2172
+ " ☺████£££ ",
2173
+ " ☺████£££ ",
2174
+ " ☺▓███£££ ",
2175
+ " ☺▓███£££ ",
2176
+ " ☺▒███£££ ",
2177
+ " ☺▒███£££ ",
2178
+ " ☺░███£££ ",
2179
+ " ☺░███£££ ",
2180
+ " ☺ ███£££ ",
2181
+ " ☺███£££ ",
2182
+ " ☺███£££ ",
2183
+ " ☺▓██£££ ",
2184
+ " ☺▓██£££ ",
2185
+ " ☺▒██£££ ",
2186
+ " ☺▒██£££ ",
2187
+ " ☺░██£££ ",
2188
+ " ☺░██£££ ",
2189
+ " ☺ ██£££ ",
2190
+ " ☺██£££ ",
2191
+ " ☺██£££ ",
2192
+ " ☺▓█£££ ",
2193
+ " ☺▓█£££ ",
2194
+ " ☺▒█£££ ",
2195
+ " ☺▒█£££ ",
2196
+ " ☺░█£££ ",
2197
+ " ☺░█£££ ",
2198
+ " ☺ █£££ ",
2199
+ " ☺█£££ ",
2200
+ " ☺█£££ ",
2201
+ " ☺▓£££ ",
2202
+ " ☺▓£££ ",
2203
+ " ☺▒£££ ",
2204
+ " ☺▒£££ ",
2205
+ " ☺░£££ ",
2206
+ " ☺░£££ ",
2207
+ " ☺ £££ ",
2208
+ " ☺£££ ",
2209
+ " ☺£££ ",
2210
+ " ☺▓££ ",
2211
+ " ☺▓££ ",
2212
+ " ☺▒££ ",
2213
+ " ☺▒££ ",
2214
+ " ☺░££ ",
2215
+ " ☺░££ ",
2216
+ " ☺ ££ ",
2217
+ " ☺££ ",
2218
+ " ☺££ ",
2219
+ " ☺▓£ ",
2220
+ " ☺▓£ ",
2221
+ " ☺▒£ ",
2222
+ " ☺▒£ ",
2223
+ " ☺░£ ",
2224
+ " ☺░£ ",
2225
+ " ☺ £ ",
2226
+ " ☺£ ",
2227
+ " ☺£ ",
2228
+ " ☺▓ ",
2229
+ " ☺▓ ",
2230
+ " ☺▒ ",
2231
+ " ☺▒ ",
2232
+ " ☺░ ",
2233
+ " ☺░ ",
2234
+ " ☺ ",
2235
+ " ☺ &",
2236
+ " ☺ ☼&",
2237
+ " ☺ ☼ &",
2238
+ " ☺☼ &",
2239
+ " ☺☼ & ",
2240
+ " ‼ & ",
2241
+ " ☺ & ",
2242
+ " ‼ & ",
2243
+ " ☺ & ",
2244
+ " ‼ & ",
2245
+ " ☺ & ",
2246
+ "‼ & ",
2247
+ " & ",
2248
+ " & ",
2249
+ " & ░ ",
2250
+ " & ▒ ",
2251
+ " & ▓ ",
2252
+ " & £ ",
2253
+ " & ░£ ",
2254
+ " & ▒£ ",
2255
+ " & ▓£ ",
2256
+ " & ££ ",
2257
+ " & ░££ ",
2258
+ " & ▒££ ",
2259
+ "& ▓££ ",
2260
+ "& £££ ",
2261
+ " ░£££ ",
2262
+ " ▒£££ ",
2263
+ " ▓£££ ",
2264
+ " █£££ ",
2265
+ " ░█£££ ",
2266
+ " ▒█£££ ",
2267
+ " ▓█£££ ",
2268
+ " ██£££ ",
2269
+ " ░██£££ ",
2270
+ " ▒██£££ ",
2271
+ " ▓██£££ ",
2272
+ " ███£££ ",
2273
+ " ░███£££ ",
2274
+ " ▒███£££ ",
2275
+ " ▓███£££ ",
2276
+ " ████£££ ",
2277
+ " ░████£££ ",
2278
+ " ▒████£££ ",
2279
+ " ▓████£££ ",
2280
+ " █████£££ ",
2281
+ " ░█████£££ ",
2282
+ " ▒█████£££ ",
2283
+ " ▓█████£££ ",
2284
+ " ██████£££ ",
2285
+ " ██████£££ "
2286
+ ]
2287
+ };
2288
+ const spinners = {
2289
+ dots: dots,
2290
+ dots2: dots2,
2291
+ dots3: dots3,
2292
+ dots4: dots4,
2293
+ dots5: dots5,
2294
+ dots6: dots6,
2295
+ dots7: dots7,
2296
+ dots8: dots8,
2297
+ dots9: dots9,
2298
+ dots10: dots10,
2299
+ dots11: dots11,
2300
+ dots12: dots12,
2301
+ dots13: dots13,
2302
+ dots14: dots14,
2303
+ dots8Bit: dots8Bit,
2304
+ dotsCircle: dotsCircle,
2305
+ sand: sand,
2306
+ line: line,
2307
+ line2: line2,
2308
+ pipe: pipe,
2309
+ simpleDots: simpleDots,
2310
+ simpleDotsScrolling: simpleDotsScrolling,
2311
+ star: star,
2312
+ star2: star2,
2313
+ flip: flip,
2314
+ hamburger: hamburger,
2315
+ growVertical: growVertical,
2316
+ growHorizontal: growHorizontal,
2317
+ balloon: balloon,
2318
+ balloon2: balloon2,
2319
+ noise: noise,
2320
+ bounce: bounce,
2321
+ boxBounce: boxBounce,
2322
+ boxBounce2: boxBounce2,
2323
+ triangle: triangle,
2324
+ binary: binary,
2325
+ arc: arc,
2326
+ circle: circle,
2327
+ squareCorners: squareCorners,
2328
+ circleQuarters: circleQuarters,
2329
+ circleHalves: circleHalves,
2330
+ squish: squish,
2331
+ toggle: toggle,
2332
+ toggle2: toggle2,
2333
+ toggle3: toggle3,
2334
+ toggle4: toggle4,
2335
+ toggle5: toggle5,
2336
+ toggle6: toggle6,
2337
+ toggle7: toggle7,
2338
+ toggle8: toggle8,
2339
+ toggle9: toggle9,
2340
+ toggle10: toggle10,
2341
+ toggle11: toggle11,
2342
+ toggle12: toggle12,
2343
+ toggle13: toggle13,
2344
+ arrow: arrow,
2345
+ arrow2: arrow2,
2346
+ arrow3: arrow3,
2347
+ bouncingBar: bouncingBar,
2348
+ bouncingBall: bouncingBall,
2349
+ smiley: smiley,
2350
+ monkey: monkey,
2351
+ hearts: hearts,
2352
+ clock: clock,
2353
+ earth: earth,
2354
+ material: material,
2355
+ moon: moon,
2356
+ runner: runner,
2357
+ pong: pong,
2358
+ shark: shark,
2359
+ dqpb: dqpb,
2360
+ weather: weather,
2361
+ christmas: christmas,
2362
+ grenade: grenade,
2363
+ point: point,
2364
+ layer: layer,
2365
+ betaWave: betaWave,
2366
+ fingerDance: fingerDance,
2367
+ fistBump: fistBump,
2368
+ soccerHeader: soccerHeader,
2369
+ mindblown: mindblown,
2370
+ speaker: speaker,
2371
+ orangePulse: orangePulse,
2372
+ bluePulse: bluePulse,
2373
+ orangeBluePulse: orangeBluePulse,
2374
+ timeTravel: timeTravel,
2375
+ aesthetic: aesthetic,
2376
+ dwarfFortress: dwarfFortress
2377
+ };
2378
+
2379
+ const info = 'ℹ️';
2380
+ const success = '✅';
2381
+ const warning = '⚠️';
2382
+ const error = '❌️';
2383
+
2384
+ function ansiRegex({onlyFirst = false} = {}) {
2385
+ // Valid string terminator sequences are BEL, ESC\, and 0x9c
2386
+ const ST = '(?:\\u0007|\\u001B\\u005C|\\u009C)';
2387
+ const pattern = [
2388
+ `[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`,
2389
+ '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))',
2390
+ ].join('|');
2391
+
2392
+ return new RegExp(pattern, onlyFirst ? undefined : 'g');
2393
+ }
2394
+
2395
+ const regex = ansiRegex();
2396
+
2397
+ function stripAnsi(string) {
2398
+ if (typeof string !== 'string') {
2399
+ throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
2400
+ }
2401
+
2402
+ // Even though the regex is global, we don't need to reset the `.lastIndex`
2403
+ // because unlike `.exec()` and `.test()`, `.replace()` does it automatically
2404
+ // and doing it manually has a performance penalty.
2405
+ return string.replace(regex, '');
2406
+ }
2407
+
2408
+ // Generated code.
2409
+
2410
+ function isAmbiguous(x) {
2411
+ return x === 0xA1
2412
+ || x === 0xA4
2413
+ || x === 0xA7
2414
+ || x === 0xA8
2415
+ || x === 0xAA
2416
+ || x === 0xAD
2417
+ || x === 0xAE
2418
+ || x >= 0xB0 && x <= 0xB4
2419
+ || x >= 0xB6 && x <= 0xBA
2420
+ || x >= 0xBC && x <= 0xBF
2421
+ || x === 0xC6
2422
+ || x === 0xD0
2423
+ || x === 0xD7
2424
+ || x === 0xD8
2425
+ || x >= 0xDE && x <= 0xE1
2426
+ || x === 0xE6
2427
+ || x >= 0xE8 && x <= 0xEA
2428
+ || x === 0xEC
2429
+ || x === 0xED
2430
+ || x === 0xF0
2431
+ || x === 0xF2
2432
+ || x === 0xF3
2433
+ || x >= 0xF7 && x <= 0xFA
2434
+ || x === 0xFC
2435
+ || x === 0xFE
2436
+ || x === 0x101
2437
+ || x === 0x111
2438
+ || x === 0x113
2439
+ || x === 0x11B
2440
+ || x === 0x126
2441
+ || x === 0x127
2442
+ || x === 0x12B
2443
+ || x >= 0x131 && x <= 0x133
2444
+ || x === 0x138
2445
+ || x >= 0x13F && x <= 0x142
2446
+ || x === 0x144
2447
+ || x >= 0x148 && x <= 0x14B
2448
+ || x === 0x14D
2449
+ || x === 0x152
2450
+ || x === 0x153
2451
+ || x === 0x166
2452
+ || x === 0x167
2453
+ || x === 0x16B
2454
+ || x === 0x1CE
2455
+ || x === 0x1D0
2456
+ || x === 0x1D2
2457
+ || x === 0x1D4
2458
+ || x === 0x1D6
2459
+ || x === 0x1D8
2460
+ || x === 0x1DA
2461
+ || x === 0x1DC
2462
+ || x === 0x251
2463
+ || x === 0x261
2464
+ || x === 0x2C4
2465
+ || x === 0x2C7
2466
+ || x >= 0x2C9 && x <= 0x2CB
2467
+ || x === 0x2CD
2468
+ || x === 0x2D0
2469
+ || x >= 0x2D8 && x <= 0x2DB
2470
+ || x === 0x2DD
2471
+ || x === 0x2DF
2472
+ || x >= 0x300 && x <= 0x36F
2473
+ || x >= 0x391 && x <= 0x3A1
2474
+ || x >= 0x3A3 && x <= 0x3A9
2475
+ || x >= 0x3B1 && x <= 0x3C1
2476
+ || x >= 0x3C3 && x <= 0x3C9
2477
+ || x === 0x401
2478
+ || x >= 0x410 && x <= 0x44F
2479
+ || x === 0x451
2480
+ || x === 0x2010
2481
+ || x >= 0x2013 && x <= 0x2016
2482
+ || x === 0x2018
2483
+ || x === 0x2019
2484
+ || x === 0x201C
2485
+ || x === 0x201D
2486
+ || x >= 0x2020 && x <= 0x2022
2487
+ || x >= 0x2024 && x <= 0x2027
2488
+ || x === 0x2030
2489
+ || x === 0x2032
2490
+ || x === 0x2033
2491
+ || x === 0x2035
2492
+ || x === 0x203B
2493
+ || x === 0x203E
2494
+ || x === 0x2074
2495
+ || x === 0x207F
2496
+ || x >= 0x2081 && x <= 0x2084
2497
+ || x === 0x20AC
2498
+ || x === 0x2103
2499
+ || x === 0x2105
2500
+ || x === 0x2109
2501
+ || x === 0x2113
2502
+ || x === 0x2116
2503
+ || x === 0x2121
2504
+ || x === 0x2122
2505
+ || x === 0x2126
2506
+ || x === 0x212B
2507
+ || x === 0x2153
2508
+ || x === 0x2154
2509
+ || x >= 0x215B && x <= 0x215E
2510
+ || x >= 0x2160 && x <= 0x216B
2511
+ || x >= 0x2170 && x <= 0x2179
2512
+ || x === 0x2189
2513
+ || x >= 0x2190 && x <= 0x2199
2514
+ || x === 0x21B8
2515
+ || x === 0x21B9
2516
+ || x === 0x21D2
2517
+ || x === 0x21D4
2518
+ || x === 0x21E7
2519
+ || x === 0x2200
2520
+ || x === 0x2202
2521
+ || x === 0x2203
2522
+ || x === 0x2207
2523
+ || x === 0x2208
2524
+ || x === 0x220B
2525
+ || x === 0x220F
2526
+ || x === 0x2211
2527
+ || x === 0x2215
2528
+ || x === 0x221A
2529
+ || x >= 0x221D && x <= 0x2220
2530
+ || x === 0x2223
2531
+ || x === 0x2225
2532
+ || x >= 0x2227 && x <= 0x222C
2533
+ || x === 0x222E
2534
+ || x >= 0x2234 && x <= 0x2237
2535
+ || x === 0x223C
2536
+ || x === 0x223D
2537
+ || x === 0x2248
2538
+ || x === 0x224C
2539
+ || x === 0x2252
2540
+ || x === 0x2260
2541
+ || x === 0x2261
2542
+ || x >= 0x2264 && x <= 0x2267
2543
+ || x === 0x226A
2544
+ || x === 0x226B
2545
+ || x === 0x226E
2546
+ || x === 0x226F
2547
+ || x === 0x2282
2548
+ || x === 0x2283
2549
+ || x === 0x2286
2550
+ || x === 0x2287
2551
+ || x === 0x2295
2552
+ || x === 0x2299
2553
+ || x === 0x22A5
2554
+ || x === 0x22BF
2555
+ || x === 0x2312
2556
+ || x >= 0x2460 && x <= 0x24E9
2557
+ || x >= 0x24EB && x <= 0x254B
2558
+ || x >= 0x2550 && x <= 0x2573
2559
+ || x >= 0x2580 && x <= 0x258F
2560
+ || x >= 0x2592 && x <= 0x2595
2561
+ || x === 0x25A0
2562
+ || x === 0x25A1
2563
+ || x >= 0x25A3 && x <= 0x25A9
2564
+ || x === 0x25B2
2565
+ || x === 0x25B3
2566
+ || x === 0x25B6
2567
+ || x === 0x25B7
2568
+ || x === 0x25BC
2569
+ || x === 0x25BD
2570
+ || x === 0x25C0
2571
+ || x === 0x25C1
2572
+ || x >= 0x25C6 && x <= 0x25C8
2573
+ || x === 0x25CB
2574
+ || x >= 0x25CE && x <= 0x25D1
2575
+ || x >= 0x25E2 && x <= 0x25E5
2576
+ || x === 0x25EF
2577
+ || x === 0x2605
2578
+ || x === 0x2606
2579
+ || x === 0x2609
2580
+ || x === 0x260E
2581
+ || x === 0x260F
2582
+ || x === 0x261C
2583
+ || x === 0x261E
2584
+ || x === 0x2640
2585
+ || x === 0x2642
2586
+ || x === 0x2660
2587
+ || x === 0x2661
2588
+ || x >= 0x2663 && x <= 0x2665
2589
+ || x >= 0x2667 && x <= 0x266A
2590
+ || x === 0x266C
2591
+ || x === 0x266D
2592
+ || x === 0x266F
2593
+ || x === 0x269E
2594
+ || x === 0x269F
2595
+ || x === 0x26BF
2596
+ || x >= 0x26C6 && x <= 0x26CD
2597
+ || x >= 0x26CF && x <= 0x26D3
2598
+ || x >= 0x26D5 && x <= 0x26E1
2599
+ || x === 0x26E3
2600
+ || x === 0x26E8
2601
+ || x === 0x26E9
2602
+ || x >= 0x26EB && x <= 0x26F1
2603
+ || x === 0x26F4
2604
+ || x >= 0x26F6 && x <= 0x26F9
2605
+ || x === 0x26FB
2606
+ || x === 0x26FC
2607
+ || x === 0x26FE
2608
+ || x === 0x26FF
2609
+ || x === 0x273D
2610
+ || x >= 0x2776 && x <= 0x277F
2611
+ || x >= 0x2B56 && x <= 0x2B59
2612
+ || x >= 0x3248 && x <= 0x324F
2613
+ || x >= 0xE000 && x <= 0xF8FF
2614
+ || x >= 0xFE00 && x <= 0xFE0F
2615
+ || x === 0xFFFD
2616
+ || x >= 0x1F100 && x <= 0x1F10A
2617
+ || x >= 0x1F110 && x <= 0x1F12D
2618
+ || x >= 0x1F130 && x <= 0x1F169
2619
+ || x >= 0x1F170 && x <= 0x1F18D
2620
+ || x === 0x1F18F
2621
+ || x === 0x1F190
2622
+ || x >= 0x1F19B && x <= 0x1F1AC
2623
+ || x >= 0xE0100 && x <= 0xE01EF
2624
+ || x >= 0xF0000 && x <= 0xFFFFD
2625
+ || x >= 0x100000 && x <= 0x10FFFD;
2626
+ }
2627
+
2628
+ function isFullWidth(x) {
2629
+ return x === 0x3000
2630
+ || x >= 0xFF01 && x <= 0xFF60
2631
+ || x >= 0xFFE0 && x <= 0xFFE6;
2632
+ }
2633
+
2634
+ function isWide(x) {
2635
+ return x >= 0x1100 && x <= 0x115F
2636
+ || x === 0x231A
2637
+ || x === 0x231B
2638
+ || x === 0x2329
2639
+ || x === 0x232A
2640
+ || x >= 0x23E9 && x <= 0x23EC
2641
+ || x === 0x23F0
2642
+ || x === 0x23F3
2643
+ || x === 0x25FD
2644
+ || x === 0x25FE
2645
+ || x === 0x2614
2646
+ || x === 0x2615
2647
+ || x >= 0x2630 && x <= 0x2637
2648
+ || x >= 0x2648 && x <= 0x2653
2649
+ || x === 0x267F
2650
+ || x >= 0x268A && x <= 0x268F
2651
+ || x === 0x2693
2652
+ || x === 0x26A1
2653
+ || x === 0x26AA
2654
+ || x === 0x26AB
2655
+ || x === 0x26BD
2656
+ || x === 0x26BE
2657
+ || x === 0x26C4
2658
+ || x === 0x26C5
2659
+ || x === 0x26CE
2660
+ || x === 0x26D4
2661
+ || x === 0x26EA
2662
+ || x === 0x26F2
2663
+ || x === 0x26F3
2664
+ || x === 0x26F5
2665
+ || x === 0x26FA
2666
+ || x === 0x26FD
2667
+ || x === 0x2705
2668
+ || x === 0x270A
2669
+ || x === 0x270B
2670
+ || x === 0x2728
2671
+ || x === 0x274C
2672
+ || x === 0x274E
2673
+ || x >= 0x2753 && x <= 0x2755
2674
+ || x === 0x2757
2675
+ || x >= 0x2795 && x <= 0x2797
2676
+ || x === 0x27B0
2677
+ || x === 0x27BF
2678
+ || x === 0x2B1B
2679
+ || x === 0x2B1C
2680
+ || x === 0x2B50
2681
+ || x === 0x2B55
2682
+ || x >= 0x2E80 && x <= 0x2E99
2683
+ || x >= 0x2E9B && x <= 0x2EF3
2684
+ || x >= 0x2F00 && x <= 0x2FD5
2685
+ || x >= 0x2FF0 && x <= 0x2FFF
2686
+ || x >= 0x3001 && x <= 0x303E
2687
+ || x >= 0x3041 && x <= 0x3096
2688
+ || x >= 0x3099 && x <= 0x30FF
2689
+ || x >= 0x3105 && x <= 0x312F
2690
+ || x >= 0x3131 && x <= 0x318E
2691
+ || x >= 0x3190 && x <= 0x31E5
2692
+ || x >= 0x31EF && x <= 0x321E
2693
+ || x >= 0x3220 && x <= 0x3247
2694
+ || x >= 0x3250 && x <= 0xA48C
2695
+ || x >= 0xA490 && x <= 0xA4C6
2696
+ || x >= 0xA960 && x <= 0xA97C
2697
+ || x >= 0xAC00 && x <= 0xD7A3
2698
+ || x >= 0xF900 && x <= 0xFAFF
2699
+ || x >= 0xFE10 && x <= 0xFE19
2700
+ || x >= 0xFE30 && x <= 0xFE52
2701
+ || x >= 0xFE54 && x <= 0xFE66
2702
+ || x >= 0xFE68 && x <= 0xFE6B
2703
+ || x >= 0x16FE0 && x <= 0x16FE4
2704
+ || x === 0x16FF0
2705
+ || x === 0x16FF1
2706
+ || x >= 0x17000 && x <= 0x187F7
2707
+ || x >= 0x18800 && x <= 0x18CD5
2708
+ || x >= 0x18CFF && x <= 0x18D08
2709
+ || x >= 0x1AFF0 && x <= 0x1AFF3
2710
+ || x >= 0x1AFF5 && x <= 0x1AFFB
2711
+ || x === 0x1AFFD
2712
+ || x === 0x1AFFE
2713
+ || x >= 0x1B000 && x <= 0x1B122
2714
+ || x === 0x1B132
2715
+ || x >= 0x1B150 && x <= 0x1B152
2716
+ || x === 0x1B155
2717
+ || x >= 0x1B164 && x <= 0x1B167
2718
+ || x >= 0x1B170 && x <= 0x1B2FB
2719
+ || x >= 0x1D300 && x <= 0x1D356
2720
+ || x >= 0x1D360 && x <= 0x1D376
2721
+ || x === 0x1F004
2722
+ || x === 0x1F0CF
2723
+ || x === 0x1F18E
2724
+ || x >= 0x1F191 && x <= 0x1F19A
2725
+ || x >= 0x1F200 && x <= 0x1F202
2726
+ || x >= 0x1F210 && x <= 0x1F23B
2727
+ || x >= 0x1F240 && x <= 0x1F248
2728
+ || x === 0x1F250
2729
+ || x === 0x1F251
2730
+ || x >= 0x1F260 && x <= 0x1F265
2731
+ || x >= 0x1F300 && x <= 0x1F320
2732
+ || x >= 0x1F32D && x <= 0x1F335
2733
+ || x >= 0x1F337 && x <= 0x1F37C
2734
+ || x >= 0x1F37E && x <= 0x1F393
2735
+ || x >= 0x1F3A0 && x <= 0x1F3CA
2736
+ || x >= 0x1F3CF && x <= 0x1F3D3
2737
+ || x >= 0x1F3E0 && x <= 0x1F3F0
2738
+ || x === 0x1F3F4
2739
+ || x >= 0x1F3F8 && x <= 0x1F43E
2740
+ || x === 0x1F440
2741
+ || x >= 0x1F442 && x <= 0x1F4FC
2742
+ || x >= 0x1F4FF && x <= 0x1F53D
2743
+ || x >= 0x1F54B && x <= 0x1F54E
2744
+ || x >= 0x1F550 && x <= 0x1F567
2745
+ || x === 0x1F57A
2746
+ || x === 0x1F595
2747
+ || x === 0x1F596
2748
+ || x === 0x1F5A4
2749
+ || x >= 0x1F5FB && x <= 0x1F64F
2750
+ || x >= 0x1F680 && x <= 0x1F6C5
2751
+ || x === 0x1F6CC
2752
+ || x >= 0x1F6D0 && x <= 0x1F6D2
2753
+ || x >= 0x1F6D5 && x <= 0x1F6D7
2754
+ || x >= 0x1F6DC && x <= 0x1F6DF
2755
+ || x === 0x1F6EB
2756
+ || x === 0x1F6EC
2757
+ || x >= 0x1F6F4 && x <= 0x1F6FC
2758
+ || x >= 0x1F7E0 && x <= 0x1F7EB
2759
+ || x === 0x1F7F0
2760
+ || x >= 0x1F90C && x <= 0x1F93A
2761
+ || x >= 0x1F93C && x <= 0x1F945
2762
+ || x >= 0x1F947 && x <= 0x1F9FF
2763
+ || x >= 0x1FA70 && x <= 0x1FA7C
2764
+ || x >= 0x1FA80 && x <= 0x1FA89
2765
+ || x >= 0x1FA8F && x <= 0x1FAC6
2766
+ || x >= 0x1FACE && x <= 0x1FADC
2767
+ || x >= 0x1FADF && x <= 0x1FAE9
2768
+ || x >= 0x1FAF0 && x <= 0x1FAF8
2769
+ || x >= 0x20000 && x <= 0x2FFFD
2770
+ || x >= 0x30000 && x <= 0x3FFFD;
2771
+ }
2772
+
2773
+ function validate(codePoint) {
2774
+ if (!Number.isSafeInteger(codePoint)) {
2775
+ throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
2776
+ }
2777
+ }
2778
+
2779
+ function eastAsianWidth(codePoint, {ambiguousAsWide = false} = {}) {
2780
+ validate(codePoint);
2781
+
2782
+ if (
2783
+ isFullWidth(codePoint)
2784
+ || isWide(codePoint)
2785
+ || (ambiguousAsWide && isAmbiguous(codePoint))
2786
+ ) {
2787
+ return 2;
2788
+ }
2789
+
2790
+ return 1;
2791
+ }
2792
+
2793
+ /**
2794
+ Logic:
2795
+ - Segment graphemes to match how terminals render clusters.
2796
+ - Width rules:
2797
+ 1. Skip non-printing clusters (Default_Ignorable, Control, pure Mark, lone Surrogates). Tabs are ignored by design.
2798
+ 2. RGI emoji clusters (\p{RGI_Emoji}) are double-width.
2799
+ 3. Otherwise use East Asian Width of the cluster’s first visible code point, and add widths for trailing Halfwidth/Fullwidth Forms within the same cluster (e.g., dakuten/handakuten/prolonged sound mark).
2800
+ */
2801
+
2802
+ const segmenter = new Intl.Segmenter();
2803
+
2804
+ // Whole-cluster zero-width
2805
+ const zeroWidthClusterRegex = /^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Mark}|\p{Surrogate})+$/v;
2806
+
2807
+ // Pick the base scalar if the cluster starts with Prepend/Format/Marks
2808
+ const leadingNonPrintingRegex = /^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Mark}\p{Surrogate}]+/v;
2809
+
2810
+ // RGI emoji sequences
2811
+ const rgiEmojiRegex = /^\p{RGI_Emoji}$/v;
2812
+
2813
+ function baseVisible(segment) {
2814
+ return segment.replace(leadingNonPrintingRegex, '');
2815
+ }
2816
+
2817
+ function isZeroWidthCluster(segment) {
2818
+ return zeroWidthClusterRegex.test(segment);
2819
+ }
2820
+
2821
+ function trailingHalfwidthWidth(segment, eastAsianWidthOptions) {
2822
+ let extra = 0;
2823
+ if (segment.length > 1) {
2824
+ for (const char of segment.slice(1)) {
2825
+ if (char >= '\uFF00' && char <= '\uFFEF') {
2826
+ extra += eastAsianWidth(char.codePointAt(0), eastAsianWidthOptions);
2827
+ }
2828
+ }
2829
+ }
2830
+
2831
+ return extra;
2832
+ }
2833
+
2834
+ function stringWidth(input, options = {}) {
2835
+ if (typeof input !== 'string' || input.length === 0) {
2836
+ return 0;
2837
+ }
2838
+
2839
+ const {
2840
+ ambiguousIsNarrow = true,
2841
+ countAnsiEscapeCodes = false,
2842
+ } = options;
2843
+
2844
+ let string = input;
2845
+
2846
+ if (!countAnsiEscapeCodes) {
2847
+ string = stripAnsi(string);
2848
+ }
2849
+
2850
+ if (string.length === 0) {
2851
+ return 0;
2852
+ }
2853
+
2854
+ let width = 0;
2855
+ const eastAsianWidthOptions = {ambiguousAsWide: !ambiguousIsNarrow};
2856
+
2857
+ for (const {segment} of segmenter.segment(string)) {
2858
+ // Zero-width / non-printing clusters
2859
+ if (isZeroWidthCluster(segment)) {
2860
+ continue;
2861
+ }
2862
+
2863
+ // Emoji width logic
2864
+ if (rgiEmojiRegex.test(segment)) {
2865
+ width += 2;
2866
+ continue;
2867
+ }
2868
+
2869
+ // Everything else: EAW of the cluster’s first visible scalar
2870
+ const codePoint = baseVisible(segment).codePointAt(0);
2871
+ width += eastAsianWidth(codePoint, eastAsianWidthOptions);
2872
+
2873
+ // Add width for trailing Halfwidth and Fullwidth Forms (e.g., ゙, ゚, ー)
2874
+ width += trailingHalfwidthWidth(segment, eastAsianWidthOptions);
2875
+ }
2876
+
2877
+ return width;
2878
+ }
2879
+
2880
+ function isInteractive({stream = process.stdout} = {}) {
2881
+ return Boolean(
2882
+ stream && stream.isTTY &&
2883
+ process.env.TERM !== 'dumb' &&
2884
+ !('CI' in process.env)
2885
+ );
2886
+ }
2887
+
2888
+ function isUnicodeSupported() {
2889
+ const {env} = process__default;
2890
+ const {TERM, TERM_PROGRAM} = env;
2891
+
2892
+ if (process__default.platform !== 'win32') {
2893
+ return TERM !== 'linux'; // Linux console (kernel)
2894
+ }
2895
+
2896
+ return Boolean(env.WT_SESSION) // Windows Terminal
2897
+ || Boolean(env.TERMINUS_SUBLIME) // Terminus (<0.2.27)
2898
+ || env.ConEmuTask === '{cmd::Cmder}' // ConEmu and cmder
2899
+ || TERM_PROGRAM === 'Terminus-Sublime'
2900
+ || TERM_PROGRAM === 'vscode'
2901
+ || TERM === 'xterm-256color'
2902
+ || TERM === 'alacritty'
2903
+ || TERM === 'rxvt-unicode'
2904
+ || TERM === 'rxvt-unicode-256color'
2905
+ || env.TERMINAL_EMULATOR === 'JetBrains-JediTerm';
2906
+ }
2907
+
2908
+ const ASCII_ETX_CODE = 0x03; // Ctrl+C
2909
+
2910
+ class StdinDiscarder {
2911
+ #activeCount = 0;
2912
+ #stdin;
2913
+ #stdinWasPaused = false;
2914
+ #stdinWasRaw = false;
2915
+ #handleInputBound = chunk => {
2916
+ if (!chunk?.length) {
2917
+ return;
2918
+ }
2919
+
2920
+ const code = typeof chunk === 'string' ? chunk.codePointAt(0) : chunk[0];
2921
+ if (code === ASCII_ETX_CODE) {
2922
+ if (process__default.listenerCount('SIGINT') > 0) {
2923
+ process__default.emit('SIGINT');
2924
+ } else {
2925
+ process__default.kill(process__default.pid, 'SIGINT');
2926
+ }
2927
+ }
2928
+ };
2929
+
2930
+ start() {
2931
+ this.#activeCount++;
2932
+ if (this.#activeCount === 1) {
2933
+ this.#realStart();
2934
+ }
2935
+ }
2936
+
2937
+ stop() {
2938
+ if (this.#activeCount === 0) {
2939
+ return;
2940
+ }
2941
+
2942
+ if (--this.#activeCount === 0) {
2943
+ this.#realStop();
2944
+ }
2945
+ }
2946
+
2947
+ #realStart() {
2948
+ const {stdin} = process__default;
2949
+
2950
+ if (process__default.platform === 'win32' || !stdin?.isTTY || typeof stdin.setRawMode !== 'function') {
2951
+ this.#stdin = undefined;
2952
+ return;
2953
+ }
2954
+
2955
+ this.#stdin = stdin;
2956
+ this.#stdinWasPaused = stdin.isPaused();
2957
+ this.#stdinWasRaw = Boolean(stdin.isRaw);
2958
+
2959
+ stdin.setRawMode(true);
2960
+ stdin.prependListener('data', this.#handleInputBound);
2961
+
2962
+ if (this.#stdinWasPaused) {
2963
+ stdin.resume();
2964
+ }
2965
+ }
2966
+
2967
+ #realStop() {
2968
+ if (!this.#stdin) {
2969
+ return;
2970
+ }
2971
+
2972
+ const stdin = this.#stdin;
2973
+
2974
+ stdin.off('data', this.#handleInputBound);
2975
+
2976
+ if (stdin.isTTY) {
2977
+ stdin.setRawMode?.(this.#stdinWasRaw);
2978
+ }
2979
+
2980
+ if (this.#stdinWasPaused) {
2981
+ stdin.pause();
2982
+ }
2983
+
2984
+ this.#stdin = undefined;
2985
+ this.#stdinWasPaused = false;
2986
+ this.#stdinWasRaw = false;
2987
+ }
2988
+ }
2989
+
2990
+ const stdinDiscarder = new StdinDiscarder();
2991
+
2992
+ const stdinDiscarder$1 = Object.freeze(stdinDiscarder);
2993
+
2994
+ // Constants
2995
+ const RENDER_DEFERRAL_TIMEOUT = 200; // Milliseconds to wait before re-rendering after partial chunk write
2996
+ const SYNCHRONIZED_OUTPUT_ENABLE = '\u001B[?2026h';
2997
+ const SYNCHRONIZED_OUTPUT_DISABLE = '\u001B[?2026l';
2998
+
2999
+ // Global state for concurrent spinner detection
3000
+ const activeHooksPerStream = new Map(); // Stream → ora instance
3001
+
3002
+ class Ora {
3003
+ #linesToClear = 0;
3004
+ #frameIndex = -1;
3005
+ #lastFrameTime = 0;
3006
+ #options;
3007
+ #spinner;
3008
+ #stream;
3009
+ #id;
3010
+ #hookedStreams = new Map();
3011
+ #isInternalWrite = false;
3012
+ #drainHandler;
3013
+ #deferRenderTimer;
3014
+ #isDiscardingStdin = false;
3015
+ color;
3016
+
3017
+ // Helper to execute writes while preventing hook recursion
3018
+ #internalWrite(fn) {
3019
+ this.#isInternalWrite = true;
3020
+ try {
3021
+ return fn();
3022
+ } finally {
3023
+ this.#isInternalWrite = false;
3024
+ }
3025
+ }
3026
+
3027
+ // Helper to render if still spinning
3028
+ #tryRender() {
3029
+ if (this.isSpinning) {
3030
+ this.render();
3031
+ }
3032
+ }
3033
+
3034
+ #stringifyChunk(chunk, encoding) {
3035
+ if (chunk === undefined || chunk === null) {
3036
+ return '';
3037
+ }
3038
+
3039
+ if (typeof chunk === 'string') {
3040
+ return chunk;
3041
+ }
3042
+
3043
+ /* eslint-disable n/prefer-global/buffer */
3044
+ if (Buffer.isBuffer(chunk) || ArrayBuffer.isView(chunk)) {
3045
+ const normalizedEncoding = (typeof encoding === 'string' && encoding && encoding !== 'buffer') ? encoding : 'utf8';
3046
+ return Buffer.from(chunk).toString(normalizedEncoding);
3047
+ }
3048
+ /* eslint-enable n/prefer-global/buffer */
3049
+
3050
+ return String(chunk);
3051
+ }
3052
+
3053
+ #chunkTerminatesLine(chunkString) {
3054
+ if (!chunkString) {
3055
+ return false;
3056
+ }
3057
+
3058
+ const lastCharacter = chunkString.at(-1);
3059
+ return lastCharacter === '\n' || lastCharacter === '\r';
3060
+ }
3061
+
3062
+ #scheduleRenderDeferral() {
3063
+ // If already deferred, don't reset timer - let it complete
3064
+ if (this.#deferRenderTimer) {
3065
+ return;
3066
+ }
3067
+
3068
+ this.#deferRenderTimer = setTimeout(() => {
3069
+ this.#deferRenderTimer = undefined;
3070
+
3071
+ if (this.isSpinning) {
3072
+ this.#tryRender();
3073
+ }
3074
+ }, RENDER_DEFERRAL_TIMEOUT);
3075
+
3076
+ if (typeof this.#deferRenderTimer?.unref === 'function') {
3077
+ this.#deferRenderTimer.unref();
3078
+ }
3079
+ }
3080
+
3081
+ #clearRenderDeferral() {
3082
+ if (this.#deferRenderTimer) {
3083
+ clearTimeout(this.#deferRenderTimer);
3084
+ this.#deferRenderTimer = undefined;
3085
+ }
3086
+ }
3087
+
3088
+ // Helper to build complete line with symbol, text, prefix, and suffix
3089
+ #buildOutputLine(symbol, text, prefixText, suffixText) {
3090
+ const fullPrefixText = this.#getFullPrefixText(prefixText, ' ');
3091
+ const separatorText = symbol ? ' ' : '';
3092
+ const fullText = (typeof text === 'string') ? separatorText + text : '';
3093
+ const fullSuffixText = this.#getFullSuffixText(suffixText, ' ');
3094
+ return fullPrefixText + symbol + fullText + fullSuffixText;
3095
+ }
3096
+
3097
+ constructor(options) {
3098
+ if (typeof options === 'string') {
3099
+ options = {
3100
+ text: options,
3101
+ };
3102
+ }
3103
+
3104
+ this.#options = {
3105
+ color: 'cyan',
3106
+ stream: process__default.stderr,
3107
+ discardStdin: true,
3108
+ hideCursor: true,
3109
+ ...options,
3110
+ };
3111
+
3112
+ // Public
3113
+ this.color = this.#options.color;
3114
+
3115
+ this.#stream = this.#options.stream;
3116
+
3117
+ // Normalize isEnabled and isSilent into options
3118
+ if (typeof this.#options.isEnabled !== 'boolean') {
3119
+ this.#options.isEnabled = isInteractive({stream: this.#stream});
3120
+ }
3121
+
3122
+ if (typeof this.#options.isSilent !== 'boolean') {
3123
+ this.#options.isSilent = false;
3124
+ }
3125
+
3126
+ // Set *after* `this.#stream`.
3127
+ // Store original interval before spinner setter clears it
3128
+ const userInterval = this.#options.interval;
3129
+ // It's important that these use the public setters.
3130
+ this.spinner = this.#options.spinner;
3131
+ this.#options.interval = userInterval;
3132
+ this.text = this.#options.text;
3133
+ this.prefixText = this.#options.prefixText;
3134
+ this.suffixText = this.#options.suffixText;
3135
+ this.indent = this.#options.indent;
3136
+
3137
+ if (process__default.env.NODE_ENV === 'test') {
3138
+ this._stream = this.#stream;
3139
+ this._isEnabled = this.#options.isEnabled;
3140
+
3141
+ Object.defineProperty(this, '_linesToClear', {
3142
+ get() {
3143
+ return this.#linesToClear;
3144
+ },
3145
+ set(newValue) {
3146
+ this.#linesToClear = newValue;
3147
+ },
3148
+ });
3149
+
3150
+ Object.defineProperty(this, '_frameIndex', {
3151
+ get() {
3152
+ return this.#frameIndex;
3153
+ },
3154
+ });
3155
+
3156
+ Object.defineProperty(this, '_lineCount', {
3157
+ get() {
3158
+ const columns = this.#stream.columns ?? 80;
3159
+ const prefixText = typeof this.#options.prefixText === 'function' ? '' : this.#options.prefixText;
3160
+ const suffixText = typeof this.#options.suffixText === 'function' ? '' : this.#options.suffixText;
3161
+ const fullPrefixText = (typeof prefixText === 'string' && prefixText !== '') ? prefixText + ' ' : '';
3162
+ const fullSuffixText = (typeof suffixText === 'string' && suffixText !== '') ? ' ' + suffixText : '';
3163
+ const spinnerChar = '-';
3164
+ const fullText = ' '.repeat(this.#options.indent) + fullPrefixText + spinnerChar + (typeof this.#options.text === 'string' ? ' ' + this.#options.text : '') + fullSuffixText;
3165
+ return this.#computeLineCountFrom(fullText, columns);
3166
+ },
3167
+ });
3168
+ }
3169
+ }
3170
+
3171
+ get indent() {
3172
+ return this.#options.indent;
3173
+ }
3174
+
3175
+ set indent(indent = 0) {
3176
+ if (!(indent >= 0 && Number.isInteger(indent))) {
3177
+ throw new Error('The `indent` option must be an integer from 0 and up');
3178
+ }
3179
+
3180
+ this.#options.indent = indent;
3181
+ }
3182
+
3183
+ get interval() {
3184
+ return this.#options.interval ?? this.#spinner.interval ?? 100;
3185
+ }
3186
+
3187
+ get spinner() {
3188
+ return this.#spinner;
3189
+ }
3190
+
3191
+ set spinner(spinner) {
3192
+ this.#frameIndex = -1;
3193
+ this.#options.interval = undefined;
3194
+
3195
+ if (typeof spinner === 'object') {
3196
+ if (!Array.isArray(spinner.frames) || spinner.frames.length === 0 || spinner.frames.some(frame => typeof frame !== 'string')) {
3197
+ throw new Error('The given spinner must have a non-empty `frames` array of strings');
3198
+ }
3199
+
3200
+ if (spinner.interval !== undefined && !(Number.isInteger(spinner.interval) && spinner.interval > 0)) {
3201
+ throw new Error('`spinner.interval` must be a positive integer if provided');
3202
+ }
3203
+
3204
+ this.#spinner = spinner;
3205
+ } else if (!isUnicodeSupported()) {
3206
+ this.#spinner = spinners.line;
3207
+ } else if (spinner === undefined) {
3208
+ // Set default spinner
3209
+ this.#spinner = spinners.dots;
3210
+ } else if (spinner !== 'default' && spinners[spinner]) {
3211
+ this.#spinner = spinners[spinner];
3212
+ } else {
3213
+ throw new Error(`There is no built-in spinner named '${spinner}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`);
3214
+ }
3215
+ }
3216
+
3217
+ get text() {
3218
+ return this.#options.text;
3219
+ }
3220
+
3221
+ set text(value = '') {
3222
+ this.#options.text = value;
3223
+ }
3224
+
3225
+ get prefixText() {
3226
+ return this.#options.prefixText;
3227
+ }
3228
+
3229
+ set prefixText(value = '') {
3230
+ this.#options.prefixText = value;
3231
+ }
3232
+
3233
+ get suffixText() {
3234
+ return this.#options.suffixText;
3235
+ }
3236
+
3237
+ set suffixText(value = '') {
3238
+ this.#options.suffixText = value;
3239
+ }
3240
+
3241
+ get isSpinning() {
3242
+ return this.#id !== undefined;
3243
+ }
3244
+
3245
+ #formatAffix(value, separator, placeBefore = false) {
3246
+ const resolved = typeof value === 'function' ? value() : value;
3247
+ if (typeof resolved === 'string' && resolved !== '') {
3248
+ return placeBefore ? (separator + resolved) : (resolved + separator);
3249
+ }
3250
+
3251
+ return '';
3252
+ }
3253
+
3254
+ #getFullPrefixText(prefixText = this.#options.prefixText, postfix = ' ') {
3255
+ return this.#formatAffix(prefixText, postfix, false);
3256
+ }
3257
+
3258
+ #getFullSuffixText(suffixText = this.#options.suffixText, prefix = ' ') {
3259
+ return this.#formatAffix(suffixText, prefix, true);
3260
+ }
3261
+
3262
+ #computeLineCountFrom(text, columns) {
3263
+ let count = 0;
3264
+ for (const line of stripVTControlCharacters(text).split('\n')) {
3265
+ count += Math.max(1, Math.ceil(stringWidth(line) / columns));
3266
+ }
3267
+
3268
+ return count;
3269
+ }
3270
+
3271
+ get isEnabled() {
3272
+ return this.#options.isEnabled && !this.#options.isSilent;
3273
+ }
3274
+
3275
+ set isEnabled(value) {
3276
+ if (typeof value !== 'boolean') {
3277
+ throw new TypeError('The `isEnabled` option must be a boolean');
3278
+ }
3279
+
3280
+ this.#options.isEnabled = value;
3281
+ }
3282
+
3283
+ get isSilent() {
3284
+ return this.#options.isSilent;
3285
+ }
3286
+
3287
+ set isSilent(value) {
3288
+ if (typeof value !== 'boolean') {
3289
+ throw new TypeError('The `isSilent` option must be a boolean');
3290
+ }
3291
+
3292
+ this.#options.isSilent = value;
3293
+ }
3294
+
3295
+ frame() {
3296
+ // Only advance frame if enough time has passed (throttle to interval)
3297
+ const now = Date.now();
3298
+ if (this.#frameIndex === -1 || now - this.#lastFrameTime >= this.interval) {
3299
+ this.#frameIndex = (this.#frameIndex + 1) % this.#spinner.frames.length;
3300
+ this.#lastFrameTime = now;
3301
+ }
3302
+
3303
+ const {frames} = this.#spinner;
3304
+ let frame = frames[this.#frameIndex];
3305
+
3306
+ if (this.color) {
3307
+ frame = chalk[this.color](frame);
3308
+ }
3309
+
3310
+ const fullPrefixText = this.#getFullPrefixText(this.#options.prefixText, ' ');
3311
+ const fullText = typeof this.text === 'string' ? ' ' + this.text : '';
3312
+ const fullSuffixText = this.#getFullSuffixText(this.#options.suffixText, ' ');
3313
+
3314
+ return fullPrefixText + frame + fullText + fullSuffixText;
3315
+ }
3316
+
3317
+ clear() {
3318
+ if (!this.isEnabled || !this.#stream.isTTY) {
3319
+ return this;
3320
+ }
3321
+
3322
+ // Protect cursor control methods (cursorTo, moveCursor, clearLine) which internally call stream.write
3323
+ this.#internalWrite(() => {
3324
+ this.#stream.cursorTo(0);
3325
+
3326
+ for (let index = 0; index < this.#linesToClear; index++) {
3327
+ if (index > 0) {
3328
+ this.#stream.moveCursor(0, -1);
3329
+ }
3330
+
3331
+ this.#stream.clearLine(1);
3332
+ }
3333
+
3334
+ if (this.#options.indent) {
3335
+ this.#stream.cursorTo(this.#options.indent);
3336
+ }
3337
+ });
3338
+
3339
+ this.#linesToClear = 0;
3340
+
3341
+ return this;
3342
+ }
3343
+
3344
+ // Helper to hook a single stream
3345
+ #hookStream(stream) {
3346
+ if (!stream || this.#hookedStreams.has(stream) || !stream.isTTY || typeof stream.write !== 'function') {
3347
+ return;
3348
+ }
3349
+
3350
+ // Detect concurrent spinners
3351
+ if (activeHooksPerStream.has(stream)) {
3352
+ console.warn('[ora] Multiple concurrent spinners detected. This may cause visual corruption. Use one spinner at a time.');
3353
+ }
3354
+
3355
+ const originalWrite = stream.write;
3356
+ this.#hookedStreams.set(stream, originalWrite);
3357
+ activeHooksPerStream.set(stream, this);
3358
+ stream.write = (chunk, encoding, callback) => this.#hookedWrite(stream, originalWrite, chunk, encoding, callback);
3359
+ }
3360
+
3361
+ /**
3362
+ Intercept stream writes while spinner is active to handle external writes cleanly without visual corruption.
3363
+ Hooks process stdio streams and the active spinner stream so console.log(), console.error(), and direct writes stay tidy.
3364
+ */
3365
+ #installHook() {
3366
+ if (!this.isEnabled || this.#hookedStreams.size > 0) {
3367
+ return;
3368
+ }
3369
+
3370
+ const streamsToHook = new Set([this.#stream, process__default.stdout, process__default.stderr]);
3371
+
3372
+ for (const stream of streamsToHook) {
3373
+ this.#hookStream(stream);
3374
+ }
3375
+ }
3376
+
3377
+ #uninstallHook() {
3378
+ for (const [stream, originalWrite] of this.#hookedStreams) {
3379
+ stream.write = originalWrite;
3380
+ if (activeHooksPerStream.get(stream) === this) {
3381
+ activeHooksPerStream.delete(stream);
3382
+ }
3383
+ }
3384
+
3385
+ this.#hookedStreams.clear();
3386
+ }
3387
+
3388
+ // eslint-disable-next-line max-params -- Need stream and originalWrite for multi-stream support
3389
+ #hookedWrite(stream, originalWrite, chunk, encoding, callback) {
3390
+ // Handle both write(chunk, encoding, callback) and write(chunk, callback) signatures
3391
+ if (typeof encoding === 'function') {
3392
+ callback = encoding;
3393
+ encoding = undefined;
3394
+ }
3395
+
3396
+ // Pass through our own internal writes (spinner rendering, cursor control)
3397
+ if (this.#isInternalWrite) {
3398
+ return originalWrite.call(stream, chunk, encoding, callback);
3399
+ }
3400
+
3401
+ // External write detected - clear spinner, write content, re-render if appropriate
3402
+ this.clear();
3403
+
3404
+ const chunkString = this.#stringifyChunk(chunk, encoding);
3405
+ const chunkTerminatesLine = this.#chunkTerminatesLine(chunkString);
3406
+
3407
+ const writeResult = originalWrite.call(stream, chunk, encoding, callback);
3408
+
3409
+ // Schedule or clear render deferral based on chunk content
3410
+ if (chunkTerminatesLine) {
3411
+ this.#clearRenderDeferral();
3412
+ } else if (chunkString.length > 0) {
3413
+ this.#scheduleRenderDeferral();
3414
+ }
3415
+
3416
+ // Re-render spinner below the new output if still spinning and not deferred
3417
+ if (this.isSpinning && !this.#deferRenderTimer) {
3418
+ this.render();
3419
+ }
3420
+
3421
+ return writeResult;
3422
+ }
3423
+
3424
+ render() {
3425
+ if (!this.isEnabled || this.#drainHandler || this.#deferRenderTimer) {
3426
+ return this;
3427
+ }
3428
+
3429
+ const useSynchronizedOutput = this.#stream.isTTY;
3430
+ let shouldDisableSynchronizedOutput = false;
3431
+
3432
+ try {
3433
+ if (useSynchronizedOutput) {
3434
+ this.#internalWrite(() => this.#stream.write(SYNCHRONIZED_OUTPUT_ENABLE));
3435
+ shouldDisableSynchronizedOutput = true;
3436
+ }
3437
+
3438
+ this.clear();
3439
+
3440
+ let frameContent = this.frame();
3441
+ const columns = this.#stream.columns ?? 80;
3442
+ const actualLineCount = this.#computeLineCountFrom(frameContent, columns);
3443
+
3444
+ // If content would exceed viewport height, truncate it to prevent garbage
3445
+ const consoleHeight = this.#stream.rows;
3446
+ if (consoleHeight && consoleHeight > 1 && actualLineCount > consoleHeight) {
3447
+ const lines = frameContent.split('\n');
3448
+ const maxLines = consoleHeight - 1; // Reserve one line for truncation message
3449
+ frameContent = [...lines.slice(0, maxLines), '... (content truncated to fit terminal)'].join('\n');
3450
+ }
3451
+
3452
+ const canContinue = this.#internalWrite(() => this.#stream.write(frameContent));
3453
+
3454
+ // Handle backpressure - pause rendering if stream buffer is full
3455
+ if (canContinue === false && this.#stream.isTTY) {
3456
+ this.#drainHandler = () => {
3457
+ this.#drainHandler = undefined;
3458
+ this.#tryRender();
3459
+ };
3460
+
3461
+ this.#stream.once('drain', this.#drainHandler);
3462
+ }
3463
+
3464
+ this.#linesToClear = this.#computeLineCountFrom(frameContent, columns);
3465
+ } finally {
3466
+ if (shouldDisableSynchronizedOutput) {
3467
+ this.#internalWrite(() => this.#stream.write(SYNCHRONIZED_OUTPUT_DISABLE));
3468
+ }
3469
+ }
3470
+
3471
+ return this;
3472
+ }
3473
+
3474
+ start(text) {
3475
+ if (text) {
3476
+ this.text = text;
3477
+ }
3478
+
3479
+ if (this.isSilent) {
3480
+ return this;
3481
+ }
3482
+
3483
+ if (!this.isEnabled) {
3484
+ const symbol = this.text ? '-' : '';
3485
+ const line = ' '.repeat(this.#options.indent) + this.#buildOutputLine(symbol, this.text, this.#options.prefixText, this.#options.suffixText);
3486
+
3487
+ if (line.trim() !== '') {
3488
+ this.#internalWrite(() => this.#stream.write(line + '\n'));
3489
+ }
3490
+
3491
+ return this;
3492
+ }
3493
+
3494
+ if (this.isSpinning) {
3495
+ return this;
3496
+ }
3497
+
3498
+ if (this.#options.hideCursor) {
3499
+ cliCursor.hide(this.#stream);
3500
+ }
3501
+
3502
+ if (this.#options.discardStdin && process__default.stdin.isTTY) {
3503
+ stdinDiscarder$1.start();
3504
+ this.#isDiscardingStdin = true;
3505
+ }
3506
+
3507
+ this.#installHook();
3508
+ this.render();
3509
+ this.#id = setInterval(this.render.bind(this), this.interval);
3510
+
3511
+ return this;
3512
+ }
3513
+
3514
+ stop() {
3515
+ clearInterval(this.#id);
3516
+ this.#id = undefined;
3517
+ this.#frameIndex = -1;
3518
+ this.#lastFrameTime = 0;
3519
+
3520
+ this.#clearRenderDeferral();
3521
+ this.#uninstallHook();
3522
+
3523
+ // Clean up drain handler if it exists
3524
+ if (this.#drainHandler) {
3525
+ this.#stream.removeListener('drain', this.#drainHandler);
3526
+ this.#drainHandler = undefined;
3527
+ }
3528
+
3529
+ if (this.isEnabled) {
3530
+ this.clear();
3531
+ if (this.#options.hideCursor) {
3532
+ cliCursor.show(this.#stream);
3533
+ }
3534
+ }
3535
+
3536
+ if (this.#isDiscardingStdin) {
3537
+ this.#isDiscardingStdin = false;
3538
+ stdinDiscarder$1.stop();
3539
+ }
3540
+
3541
+ return this;
3542
+ }
3543
+
3544
+ succeed(text) {
3545
+ return this.stopAndPersist({symbol: success, text});
3546
+ }
3547
+
3548
+ fail(text) {
3549
+ return this.stopAndPersist({symbol: error, text});
3550
+ }
3551
+
3552
+ warn(text) {
3553
+ return this.stopAndPersist({symbol: warning, text});
3554
+ }
3555
+
3556
+ info(text) {
3557
+ return this.stopAndPersist({symbol: info, text});
3558
+ }
3559
+
3560
+ stopAndPersist(options = {}) {
3561
+ if (this.isSilent) {
3562
+ return this;
3563
+ }
3564
+
3565
+ const symbol = options.symbol ?? ' ';
3566
+ const text = options.text ?? this.text;
3567
+ const prefixText = options.prefixText ?? this.#options.prefixText;
3568
+ const suffixText = options.suffixText ?? this.#options.suffixText;
3569
+
3570
+ const textToWrite = this.#buildOutputLine(symbol, text, prefixText, suffixText) + '\n';
3571
+
3572
+ this.stop();
3573
+ this.#internalWrite(() => this.#stream.write(textToWrite));
3574
+
3575
+ return this;
3576
+ }
3577
+ }
3578
+
3579
+ function ora(options) {
3580
+ return new Ora(options);
661
3581
  }
662
3582
 
663
- export { ConfigGenerator, ProjectAnalyzer, TemplateSelector, analyzeProject, generateConfigs, selectTemplates, writeConfigs };
3583
+ export { ora as default, spinners };