@kubb/core 3.16.2 → 3.16.4

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 (106) hide show
  1. package/dist/FileManager-Dk759iZ3.js +918 -0
  2. package/dist/FileManager-Dk759iZ3.js.map +1 -0
  3. package/dist/FileManager-DsRjYJa_.cjs +1031 -0
  4. package/dist/FileManager-DsRjYJa_.cjs.map +1 -0
  5. package/dist/PluginManager-1jPxuyQK.d.ts +511 -0
  6. package/dist/PluginManager-Cvj5AlsU.d.cts +511 -0
  7. package/dist/chunk-DWy1uDak.cjs +39 -0
  8. package/dist/chunk-DbvY3SJr.js +33 -0
  9. package/dist/fs-BacxV1CO.js +87 -0
  10. package/dist/fs-BacxV1CO.js.map +1 -0
  11. package/dist/fs-BazSaf2y.cjs +129 -0
  12. package/dist/fs-BazSaf2y.cjs.map +1 -0
  13. package/dist/fs.cjs +15 -39
  14. package/dist/fs.d.cts +2 -19
  15. package/dist/fs.d.ts +2 -19
  16. package/dist/fs.js +4 -3
  17. package/dist/index-BKHQGQVq.d.ts +140 -0
  18. package/dist/index-BfD6z1P5.d.cts +141 -0
  19. package/dist/index-Cb4pChs8.d.ts +180 -0
  20. package/dist/index-D2ptHzfn.d.cts +180 -0
  21. package/dist/index.cjs +997 -1077
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.cts +107 -89
  24. package/dist/index.d.ts +107 -89
  25. package/dist/index.js +1020 -864
  26. package/dist/index.js.map +1 -1
  27. package/dist/logger-BxvJpQMX.cjs +1115 -0
  28. package/dist/logger-BxvJpQMX.cjs.map +1 -0
  29. package/dist/logger-Cs45J4yy.js +1085 -0
  30. package/dist/logger-Cs45J4yy.js.map +1 -0
  31. package/dist/logger-OWS6fqk0.d.cts +69 -0
  32. package/dist/logger-xcdTETKy.d.ts +69 -0
  33. package/dist/logger.cjs +6 -24
  34. package/dist/logger.d.cts +2 -3
  35. package/dist/logger.d.ts +2 -3
  36. package/dist/logger.js +4 -4
  37. package/dist/mocks.cjs +49 -65
  38. package/dist/mocks.cjs.map +1 -1
  39. package/dist/mocks.d.cts +6 -6
  40. package/dist/mocks.d.ts +6 -6
  41. package/dist/mocks.js +48 -59
  42. package/dist/mocks.js.map +1 -1
  43. package/dist/prompt-DwEAzq0q.js +853 -0
  44. package/dist/prompt-DwEAzq0q.js.map +1 -0
  45. package/dist/prompt-qiwl6Be9.cjs +855 -0
  46. package/dist/prompt-qiwl6Be9.cjs.map +1 -0
  47. package/dist/transformers-B3CHtwuB.cjs +948 -0
  48. package/dist/transformers-B3CHtwuB.cjs.map +1 -0
  49. package/dist/transformers-CJqBQFIl.js +829 -0
  50. package/dist/transformers-CJqBQFIl.js.map +1 -0
  51. package/dist/transformers.cjs +33 -88
  52. package/dist/transformers.d.cts +75 -54
  53. package/dist/transformers.d.ts +75 -54
  54. package/dist/transformers.js +4 -3
  55. package/dist/utils.cjs +20 -73
  56. package/dist/utils.d.cts +5 -126
  57. package/dist/utils.d.ts +5 -126
  58. package/dist/utils.js +6 -5
  59. package/dist/write-CLTPlucv.js +42 -0
  60. package/dist/write-CLTPlucv.js.map +1 -0
  61. package/dist/write-l_NzIqyy.cjs +48 -0
  62. package/dist/write-l_NzIqyy.cjs.map +1 -0
  63. package/package.json +25 -32
  64. package/src/BarrelManager.ts +1 -0
  65. package/src/PromiseManager.ts +1 -7
  66. package/src/build.ts +9 -11
  67. package/src/index.ts +5 -5
  68. package/src/logger.ts +10 -10
  69. package/src/utils/FunctionParams.ts +3 -1
  70. package/src/utils/TreeNode.ts +3 -1
  71. package/dist/PluginManager-E3SghPP9.d.cts +0 -458
  72. package/dist/PluginManager-PDmRCu9k.d.ts +0 -458
  73. package/dist/chunk-4V7HK7PT.js +0 -1199
  74. package/dist/chunk-4V7HK7PT.js.map +0 -1
  75. package/dist/chunk-BHSTNFNQ.cjs +0 -701
  76. package/dist/chunk-BHSTNFNQ.cjs.map +0 -1
  77. package/dist/chunk-CAZ37TGB.js +0 -918
  78. package/dist/chunk-CAZ37TGB.js.map +0 -1
  79. package/dist/chunk-E4XLCCPK.cjs +0 -170
  80. package/dist/chunk-E4XLCCPK.cjs.map +0 -1
  81. package/dist/chunk-GBYHPDPK.js +0 -595
  82. package/dist/chunk-GBYHPDPK.js.map +0 -1
  83. package/dist/chunk-L3A3DTAX.cjs +0 -1074
  84. package/dist/chunk-L3A3DTAX.cjs.map +0 -1
  85. package/dist/chunk-MCNA6SYG.cjs +0 -1231
  86. package/dist/chunk-MCNA6SYG.cjs.map +0 -1
  87. package/dist/chunk-YRPOID7E.js +0 -157
  88. package/dist/chunk-YRPOID7E.js.map +0 -1
  89. package/dist/fs.cjs.map +0 -1
  90. package/dist/fs.js.map +0 -1
  91. package/dist/logger-BWq-oJU_.d.cts +0 -63
  92. package/dist/logger-BWq-oJU_.d.ts +0 -63
  93. package/dist/logger.cjs.map +0 -1
  94. package/dist/logger.js.map +0 -1
  95. package/dist/parser-C1vOjVEd.d.ts +0 -41
  96. package/dist/parser-D6vU1kA9.d.cts +0 -41
  97. package/dist/prompt-ELTHGQK6.js +0 -753
  98. package/dist/prompt-ELTHGQK6.js.map +0 -1
  99. package/dist/prompt-U7M5G25C.cjs +0 -761
  100. package/dist/prompt-U7M5G25C.cjs.map +0 -1
  101. package/dist/transformers.cjs.map +0 -1
  102. package/dist/transformers.js.map +0 -1
  103. package/dist/types-CA8nQKwM.d.cts +0 -132
  104. package/dist/types-CA8nQKwM.d.ts +0 -132
  105. package/dist/utils.cjs.map +0 -1
  106. package/dist/utils.js.map +0 -1
@@ -0,0 +1,1085 @@
1
+ import { write } from "./write-CLTPlucv.js";
2
+ import { resolve, sep } from "node:path";
3
+ import pc from "picocolors";
4
+ import { formatWithOptions } from "node:util";
5
+ import g$1 from "node:process";
6
+ import * as tty from "node:tty";
7
+ import seedrandom from "seedrandom";
8
+ import { EventEmitter } from "node:events";
9
+
10
+ //#region ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/core.mjs
11
+ const LogLevels = {
12
+ silent: Number.NEGATIVE_INFINITY,
13
+ fatal: 0,
14
+ error: 0,
15
+ warn: 1,
16
+ log: 2,
17
+ info: 3,
18
+ success: 3,
19
+ fail: 3,
20
+ ready: 3,
21
+ start: 3,
22
+ box: 3,
23
+ debug: 4,
24
+ trace: 5,
25
+ verbose: Number.POSITIVE_INFINITY
26
+ };
27
+ const LogTypes = {
28
+ silent: { level: -1 },
29
+ fatal: { level: LogLevels.fatal },
30
+ error: { level: LogLevels.error },
31
+ warn: { level: LogLevels.warn },
32
+ log: { level: LogLevels.log },
33
+ info: { level: LogLevels.info },
34
+ success: { level: LogLevels.success },
35
+ fail: { level: LogLevels.fail },
36
+ ready: { level: LogLevels.info },
37
+ start: { level: LogLevels.info },
38
+ box: { level: LogLevels.info },
39
+ debug: { level: LogLevels.debug },
40
+ trace: { level: LogLevels.trace },
41
+ verbose: { level: LogLevels.verbose }
42
+ };
43
+ function isPlainObject$1(value) {
44
+ if (value === null || typeof value !== "object") return false;
45
+ const prototype = Object.getPrototypeOf(value);
46
+ if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) return false;
47
+ if (Symbol.iterator in value) return false;
48
+ if (Symbol.toStringTag in value) return Object.prototype.toString.call(value) === "[object Module]";
49
+ return true;
50
+ }
51
+ function _defu(baseObject, defaults, namespace = ".", merger) {
52
+ if (!isPlainObject$1(defaults)) return _defu(baseObject, {}, namespace, merger);
53
+ const object = Object.assign({}, defaults);
54
+ for (const key in baseObject) {
55
+ if (key === "__proto__" || key === "constructor") continue;
56
+ const value = baseObject[key];
57
+ if (value === null || value === void 0) continue;
58
+ if (merger && merger(object, key, value, namespace)) continue;
59
+ if (Array.isArray(value) && Array.isArray(object[key])) object[key] = [...value, ...object[key]];
60
+ else if (isPlainObject$1(value) && isPlainObject$1(object[key])) object[key] = _defu(value, object[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
61
+ else object[key] = value;
62
+ }
63
+ return object;
64
+ }
65
+ function createDefu(merger) {
66
+ return (...arguments_) => arguments_.reduce((p, c$1) => _defu(p, c$1, "", merger), {});
67
+ }
68
+ const defu = createDefu();
69
+ function isPlainObject(obj) {
70
+ return Object.prototype.toString.call(obj) === "[object Object]";
71
+ }
72
+ function isLogObj(arg) {
73
+ if (!isPlainObject(arg)) return false;
74
+ if (!arg.message && !arg.args) return false;
75
+ if (arg.stack) return false;
76
+ return true;
77
+ }
78
+ let paused = false;
79
+ const queue = [];
80
+ var Consola = class Consola {
81
+ options;
82
+ _lastLog;
83
+ _mockFn;
84
+ /**
85
+ * Creates an instance of Consola with specified options or defaults.
86
+ *
87
+ * @param {Partial<ConsolaOptions>} [options={}] - Configuration options for the Consola instance.
88
+ */
89
+ constructor(options = {}) {
90
+ const types = options.types || LogTypes;
91
+ this.options = defu({
92
+ ...options,
93
+ defaults: { ...options.defaults },
94
+ level: _normalizeLogLevel(options.level, types),
95
+ reporters: [...options.reporters || []]
96
+ }, {
97
+ types: LogTypes,
98
+ throttle: 1e3,
99
+ throttleMin: 5,
100
+ formatOptions: {
101
+ date: true,
102
+ colors: false,
103
+ compact: true
104
+ }
105
+ });
106
+ for (const type in types) {
107
+ const defaults = {
108
+ type,
109
+ ...this.options.defaults,
110
+ ...types[type]
111
+ };
112
+ this[type] = this._wrapLogFn(defaults);
113
+ this[type].raw = this._wrapLogFn(defaults, true);
114
+ }
115
+ if (this.options.mockFn) this.mockTypes();
116
+ this._lastLog = {};
117
+ }
118
+ /**
119
+ * Gets the current log level of the Consola instance.
120
+ *
121
+ * @returns {number} The current log level.
122
+ */
123
+ get level() {
124
+ return this.options.level;
125
+ }
126
+ /**
127
+ * Sets the minimum log level that will be output by the instance.
128
+ *
129
+ * @param {number} level - The new log level to set.
130
+ */
131
+ set level(level) {
132
+ this.options.level = _normalizeLogLevel(level, this.options.types, this.options.level);
133
+ }
134
+ /**
135
+ * Displays a prompt to the user and returns the response.
136
+ * Throw an error if `prompt` is not supported by the current configuration.
137
+ *
138
+ * @template T
139
+ * @param {string} message - The message to display in the prompt.
140
+ * @param {T} [opts] - Optional options for the prompt. See {@link PromptOptions}.
141
+ * @returns {promise<T>} A promise that infer with the prompt options. See {@link PromptOptions}.
142
+ */
143
+ prompt(message, opts) {
144
+ if (!this.options.prompt) throw new Error("prompt is not supported!");
145
+ return this.options.prompt(message, opts);
146
+ }
147
+ /**
148
+ * Creates a new instance of Consola, inheriting options from the current instance, with possible overrides.
149
+ *
150
+ * @param {Partial<ConsolaOptions>} options - Optional overrides for the new instance. See {@link ConsolaOptions}.
151
+ * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
152
+ */
153
+ create(options) {
154
+ const instance = new Consola({
155
+ ...this.options,
156
+ ...options
157
+ });
158
+ if (this._mockFn) instance.mockTypes(this._mockFn);
159
+ return instance;
160
+ }
161
+ /**
162
+ * Creates a new Consola instance with the specified default log object properties.
163
+ *
164
+ * @param {InputLogObject} defaults - Default properties to include in any log from the new instance. See {@link InputLogObject}.
165
+ * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
166
+ */
167
+ withDefaults(defaults) {
168
+ return this.create({
169
+ ...this.options,
170
+ defaults: {
171
+ ...this.options.defaults,
172
+ ...defaults
173
+ }
174
+ });
175
+ }
176
+ /**
177
+ * Creates a new Consola instance with a specified tag, which will be included in every log.
178
+ *
179
+ * @param {string} tag - The tag to include in each log of the new instance.
180
+ * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
181
+ */
182
+ withTag(tag) {
183
+ return this.withDefaults({ tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + tag : tag });
184
+ }
185
+ /**
186
+ * Adds a custom reporter to the Consola instance.
187
+ * Reporters will be called for each log message, depending on their implementation and log level.
188
+ *
189
+ * @param {ConsolaReporter} reporter - The reporter to add. See {@link ConsolaReporter}.
190
+ * @returns {Consola} The current Consola instance.
191
+ */
192
+ addReporter(reporter) {
193
+ this.options.reporters.push(reporter);
194
+ return this;
195
+ }
196
+ /**
197
+ * Removes a custom reporter from the Consola instance.
198
+ * If no reporter is specified, all reporters will be removed.
199
+ *
200
+ * @param {ConsolaReporter} reporter - The reporter to remove. See {@link ConsolaReporter}.
201
+ * @returns {Consola} The current Consola instance.
202
+ */
203
+ removeReporter(reporter) {
204
+ if (reporter) {
205
+ const i$1 = this.options.reporters.indexOf(reporter);
206
+ if (i$1 !== -1) return this.options.reporters.splice(i$1, 1);
207
+ } else this.options.reporters.splice(0);
208
+ return this;
209
+ }
210
+ /**
211
+ * Replaces all reporters of the Consola instance with the specified array of reporters.
212
+ *
213
+ * @param {ConsolaReporter[]} reporters - The new reporters to set. See {@link ConsolaReporter}.
214
+ * @returns {Consola} The current Consola instance.
215
+ */
216
+ setReporters(reporters) {
217
+ this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
218
+ return this;
219
+ }
220
+ wrapAll() {
221
+ this.wrapConsole();
222
+ this.wrapStd();
223
+ }
224
+ restoreAll() {
225
+ this.restoreConsole();
226
+ this.restoreStd();
227
+ }
228
+ /**
229
+ * Overrides console methods with Consola logging methods for consistent logging.
230
+ */
231
+ wrapConsole() {
232
+ for (const type in this.options.types) {
233
+ if (!console["__" + type]) console["__" + type] = console[type];
234
+ console[type] = this[type].raw;
235
+ }
236
+ }
237
+ /**
238
+ * Restores the original console methods, removing Consola overrides.
239
+ */
240
+ restoreConsole() {
241
+ for (const type in this.options.types) if (console["__" + type]) {
242
+ console[type] = console["__" + type];
243
+ delete console["__" + type];
244
+ }
245
+ }
246
+ /**
247
+ * Overrides standard output and error streams to redirect them through Consola.
248
+ */
249
+ wrapStd() {
250
+ this._wrapStream(this.options.stdout, "log");
251
+ this._wrapStream(this.options.stderr, "log");
252
+ }
253
+ _wrapStream(stream, type) {
254
+ if (!stream) return;
255
+ if (!stream.__write) stream.__write = stream.write;
256
+ stream.write = (data) => {
257
+ this[type].raw(String(data).trim());
258
+ };
259
+ }
260
+ /**
261
+ * Restores the original standard output and error streams, removing the Consola redirection.
262
+ */
263
+ restoreStd() {
264
+ this._restoreStream(this.options.stdout);
265
+ this._restoreStream(this.options.stderr);
266
+ }
267
+ _restoreStream(stream) {
268
+ if (!stream) return;
269
+ if (stream.__write) {
270
+ stream.write = stream.__write;
271
+ delete stream.__write;
272
+ }
273
+ }
274
+ /**
275
+ * Pauses logging, queues incoming logs until resumed.
276
+ */
277
+ pauseLogs() {
278
+ paused = true;
279
+ }
280
+ /**
281
+ * Resumes logging, processing any queued logs.
282
+ */
283
+ resumeLogs() {
284
+ paused = false;
285
+ const _queue = queue.splice(0);
286
+ for (const item of _queue) item[0]._logFn(item[1], item[2]);
287
+ }
288
+ /**
289
+ * Replaces logging methods with mocks if a mock function is provided.
290
+ *
291
+ * @param {ConsolaOptions["mockFn"]} mockFn - The function to use for mocking logging methods. See {@link ConsolaOptions["mockFn"]}.
292
+ */
293
+ mockTypes(mockFn) {
294
+ const _mockFn = mockFn || this.options.mockFn;
295
+ this._mockFn = _mockFn;
296
+ if (typeof _mockFn !== "function") return;
297
+ for (const type in this.options.types) {
298
+ this[type] = _mockFn(type, this.options.types[type]) || this[type];
299
+ this[type].raw = this[type];
300
+ }
301
+ }
302
+ _wrapLogFn(defaults, isRaw) {
303
+ return (...args) => {
304
+ if (paused) {
305
+ queue.push([
306
+ this,
307
+ defaults,
308
+ args,
309
+ isRaw
310
+ ]);
311
+ return;
312
+ }
313
+ return this._logFn(defaults, args, isRaw);
314
+ };
315
+ }
316
+ _logFn(defaults, args, isRaw) {
317
+ if ((defaults.level || 0) > this.level) return false;
318
+ const logObj = {
319
+ date: /* @__PURE__ */ new Date(),
320
+ args: [],
321
+ ...defaults,
322
+ level: _normalizeLogLevel(defaults.level, this.options.types)
323
+ };
324
+ if (!isRaw && args.length === 1 && isLogObj(args[0])) Object.assign(logObj, args[0]);
325
+ else logObj.args = [...args];
326
+ if (logObj.message) {
327
+ logObj.args.unshift(logObj.message);
328
+ delete logObj.message;
329
+ }
330
+ if (logObj.additional) {
331
+ if (!Array.isArray(logObj.additional)) logObj.additional = logObj.additional.split("\n");
332
+ logObj.args.push("\n" + logObj.additional.join("\n"));
333
+ delete logObj.additional;
334
+ }
335
+ logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
336
+ logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
337
+ const resolveLog = (newLog = false) => {
338
+ const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
339
+ if (this._lastLog.object && repeated > 0) {
340
+ const args2 = [...this._lastLog.object.args];
341
+ if (repeated > 1) args2.push(`(repeated ${repeated} times)`);
342
+ this._log({
343
+ ...this._lastLog.object,
344
+ args: args2
345
+ });
346
+ this._lastLog.count = 1;
347
+ }
348
+ if (newLog) {
349
+ this._lastLog.object = logObj;
350
+ this._log(logObj);
351
+ }
352
+ };
353
+ clearTimeout(this._lastLog.timeout);
354
+ const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
355
+ this._lastLog.time = logObj.date;
356
+ if (diffTime < this.options.throttle) try {
357
+ const serializedLog = JSON.stringify([
358
+ logObj.type,
359
+ logObj.tag,
360
+ logObj.args
361
+ ]);
362
+ const isSameLog = this._lastLog.serialized === serializedLog;
363
+ this._lastLog.serialized = serializedLog;
364
+ if (isSameLog) {
365
+ this._lastLog.count = (this._lastLog.count || 0) + 1;
366
+ if (this._lastLog.count > this.options.throttleMin) {
367
+ this._lastLog.timeout = setTimeout(resolveLog, this.options.throttle);
368
+ return;
369
+ }
370
+ }
371
+ } catch {}
372
+ resolveLog(true);
373
+ }
374
+ _log(logObj) {
375
+ for (const reporter of this.options.reporters) reporter.log(logObj, { options: this.options });
376
+ }
377
+ };
378
+ function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
379
+ if (input === void 0) return defaultLevel;
380
+ if (typeof input === "number") return input;
381
+ if (types[input] && types[input].level !== void 0) return types[input].level;
382
+ return defaultLevel;
383
+ }
384
+ Consola.prototype.add = Consola.prototype.addReporter;
385
+ Consola.prototype.remove = Consola.prototype.removeReporter;
386
+ Consola.prototype.clear = Consola.prototype.removeReporter;
387
+ Consola.prototype.withScope = Consola.prototype.withTag;
388
+ Consola.prototype.mock = Consola.prototype.mockTypes;
389
+ Consola.prototype.pause = Consola.prototype.pauseLogs;
390
+ Consola.prototype.resume = Consola.prototype.resumeLogs;
391
+ function createConsola$1(options = {}) {
392
+ return new Consola(options);
393
+ }
394
+
395
+ //#endregion
396
+ //#region ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/shared/consola.DRwqZj3T.mjs
397
+ function parseStack(stack, message) {
398
+ const cwd = process.cwd() + sep;
399
+ const lines = stack.split("\n").splice(message.split("\n").length).map((l$1) => l$1.trim().replace("file://", "").replace(cwd, ""));
400
+ return lines;
401
+ }
402
+ function writeStream(data, stream) {
403
+ const write$1 = stream.__write || stream.write;
404
+ return write$1.call(stream, data);
405
+ }
406
+ const bracket = (x) => x ? `[${x}]` : "";
407
+ var BasicReporter = class {
408
+ formatStack(stack, message, opts) {
409
+ const indent = " ".repeat((opts?.errorLevel || 0) + 1);
410
+ return indent + parseStack(stack, message).join(`
411
+ ${indent}`);
412
+ }
413
+ formatError(err, opts) {
414
+ const message = err.message ?? formatWithOptions(opts, err);
415
+ const stack = err.stack ? this.formatStack(err.stack, message, opts) : "";
416
+ const level = opts?.errorLevel || 0;
417
+ const causedPrefix = level > 0 ? `${" ".repeat(level)}[cause]: ` : "";
418
+ const causedError = err.cause ? "\n\n" + this.formatError(err.cause, {
419
+ ...opts,
420
+ errorLevel: level + 1
421
+ }) : "";
422
+ return causedPrefix + message + "\n" + stack + causedError;
423
+ }
424
+ formatArgs(args, opts) {
425
+ const _args = args.map((arg) => {
426
+ if (arg && typeof arg.stack === "string") return this.formatError(arg, opts);
427
+ return arg;
428
+ });
429
+ return formatWithOptions(opts, ..._args);
430
+ }
431
+ formatDate(date, opts) {
432
+ return opts.date ? date.toLocaleTimeString() : "";
433
+ }
434
+ filterAndJoin(arr) {
435
+ return arr.filter(Boolean).join(" ");
436
+ }
437
+ formatLogObj(logObj, opts) {
438
+ const message = this.formatArgs(logObj.args, opts);
439
+ if (logObj.type === "box") return "\n" + [
440
+ bracket(logObj.tag),
441
+ logObj.title && logObj.title,
442
+ ...message.split("\n")
443
+ ].filter(Boolean).map((l$1) => " > " + l$1).join("\n") + "\n";
444
+ return this.filterAndJoin([
445
+ bracket(logObj.type),
446
+ bracket(logObj.tag),
447
+ message
448
+ ]);
449
+ }
450
+ log(logObj, ctx) {
451
+ const line = this.formatLogObj(logObj, {
452
+ columns: ctx.options.stdout.columns || 0,
453
+ ...ctx.options.formatOptions
454
+ });
455
+ return writeStream(line + "\n", logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout);
456
+ }
457
+ };
458
+
459
+ //#endregion
460
+ //#region ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/shared/consola.DXBYu-KD.mjs
461
+ const { env = {}, argv = [], platform = "" } = typeof process === "undefined" ? {} : process;
462
+ const isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
463
+ const isForced = "FORCE_COLOR" in env || argv.includes("--color");
464
+ const isWindows = platform === "win32";
465
+ const isDumbTerminal = env.TERM === "dumb";
466
+ const isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;
467
+ const isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
468
+ const isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
469
+ function replaceClose(index, string, close, replace, head = string.slice(0, Math.max(0, index)) + replace, tail = string.slice(Math.max(0, index + close.length)), next = tail.indexOf(close)) {
470
+ return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
471
+ }
472
+ function clearBleed(index, string, open, close, replace) {
473
+ return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
474
+ }
475
+ function filterEmpty(open, close, replace = open, at = open.length + 1) {
476
+ return (string) => string || !(string === "" || string === void 0) ? clearBleed(("" + string).indexOf(close, at), string, open, close, replace) : "";
477
+ }
478
+ function init(open, close, replace) {
479
+ return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
480
+ }
481
+ const colorDefs = {
482
+ reset: init(0, 0),
483
+ bold: init(1, 22, "\x1B[22m\x1B[1m"),
484
+ dim: init(2, 22, "\x1B[22m\x1B[2m"),
485
+ italic: init(3, 23),
486
+ underline: init(4, 24),
487
+ inverse: init(7, 27),
488
+ hidden: init(8, 28),
489
+ strikethrough: init(9, 29),
490
+ black: init(30, 39),
491
+ red: init(31, 39),
492
+ green: init(32, 39),
493
+ yellow: init(33, 39),
494
+ blue: init(34, 39),
495
+ magenta: init(35, 39),
496
+ cyan: init(36, 39),
497
+ white: init(37, 39),
498
+ gray: init(90, 39),
499
+ bgBlack: init(40, 49),
500
+ bgRed: init(41, 49),
501
+ bgGreen: init(42, 49),
502
+ bgYellow: init(43, 49),
503
+ bgBlue: init(44, 49),
504
+ bgMagenta: init(45, 49),
505
+ bgCyan: init(46, 49),
506
+ bgWhite: init(47, 49),
507
+ blackBright: init(90, 39),
508
+ redBright: init(91, 39),
509
+ greenBright: init(92, 39),
510
+ yellowBright: init(93, 39),
511
+ blueBright: init(94, 39),
512
+ magentaBright: init(95, 39),
513
+ cyanBright: init(96, 39),
514
+ whiteBright: init(97, 39),
515
+ bgBlackBright: init(100, 49),
516
+ bgRedBright: init(101, 49),
517
+ bgGreenBright: init(102, 49),
518
+ bgYellowBright: init(103, 49),
519
+ bgBlueBright: init(104, 49),
520
+ bgMagentaBright: init(105, 49),
521
+ bgCyanBright: init(106, 49),
522
+ bgWhiteBright: init(107, 49)
523
+ };
524
+ function createColors(useColor = isColorSupported) {
525
+ return useColor ? colorDefs : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));
526
+ }
527
+ const colors = createColors();
528
+ function getColor$1(color, fallback = "reset") {
529
+ return colors[color] || colors[fallback];
530
+ }
531
+ const ansiRegex$1 = [String.raw`[\u001B\u009B][[\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\d\/#&.:=?%@~_]+)*|[a-zA-Z\d]+(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?\u0007)`, String.raw`(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]))`].join("|");
532
+ function stripAnsi(text) {
533
+ return text.replace(new RegExp(ansiRegex$1, "g"), "");
534
+ }
535
+ const boxStylePresets = {
536
+ solid: {
537
+ tl: "┌",
538
+ tr: "┐",
539
+ bl: "└",
540
+ br: "┘",
541
+ h: "─",
542
+ v: "│"
543
+ },
544
+ double: {
545
+ tl: "╔",
546
+ tr: "╗",
547
+ bl: "╚",
548
+ br: "╝",
549
+ h: "═",
550
+ v: "║"
551
+ },
552
+ doubleSingle: {
553
+ tl: "╓",
554
+ tr: "╖",
555
+ bl: "╙",
556
+ br: "╜",
557
+ h: "─",
558
+ v: "║"
559
+ },
560
+ doubleSingleRounded: {
561
+ tl: "╭",
562
+ tr: "╮",
563
+ bl: "╰",
564
+ br: "╯",
565
+ h: "─",
566
+ v: "║"
567
+ },
568
+ singleThick: {
569
+ tl: "┏",
570
+ tr: "┓",
571
+ bl: "┗",
572
+ br: "┛",
573
+ h: "━",
574
+ v: "┃"
575
+ },
576
+ singleDouble: {
577
+ tl: "╒",
578
+ tr: "╕",
579
+ bl: "╘",
580
+ br: "╛",
581
+ h: "═",
582
+ v: "│"
583
+ },
584
+ singleDoubleRounded: {
585
+ tl: "╭",
586
+ tr: "╮",
587
+ bl: "╰",
588
+ br: "╯",
589
+ h: "═",
590
+ v: "│"
591
+ },
592
+ rounded: {
593
+ tl: "╭",
594
+ tr: "╮",
595
+ bl: "╰",
596
+ br: "╯",
597
+ h: "─",
598
+ v: "│"
599
+ }
600
+ };
601
+ const defaultStyle = {
602
+ borderColor: "white",
603
+ borderStyle: "rounded",
604
+ valign: "center",
605
+ padding: 2,
606
+ marginLeft: 1,
607
+ marginTop: 1,
608
+ marginBottom: 1
609
+ };
610
+ function box(text, _opts = {}) {
611
+ const opts = {
612
+ ..._opts,
613
+ style: {
614
+ ...defaultStyle,
615
+ ..._opts.style
616
+ }
617
+ };
618
+ const textLines = text.split("\n");
619
+ const boxLines = [];
620
+ const _color = getColor$1(opts.style.borderColor);
621
+ const borderStyle = { ...typeof opts.style.borderStyle === "string" ? boxStylePresets[opts.style.borderStyle] || boxStylePresets.solid : opts.style.borderStyle };
622
+ if (_color) for (const key in borderStyle) borderStyle[key] = _color(borderStyle[key]);
623
+ const paddingOffset = opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
624
+ const height = textLines.length + paddingOffset;
625
+ const width = Math.max(...textLines.map((line) => stripAnsi(line).length), opts.title ? stripAnsi(opts.title).length : 0) + paddingOffset;
626
+ const widthOffset = width + paddingOffset;
627
+ const leftSpace = opts.style.marginLeft > 0 ? " ".repeat(opts.style.marginLeft) : "";
628
+ if (opts.style.marginTop > 0) boxLines.push("".repeat(opts.style.marginTop));
629
+ if (opts.title) {
630
+ const title = _color ? _color(opts.title) : opts.title;
631
+ const left = borderStyle.h.repeat(Math.floor((width - stripAnsi(opts.title).length) / 2));
632
+ const right = borderStyle.h.repeat(width - stripAnsi(opts.title).length - stripAnsi(left).length + paddingOffset);
633
+ boxLines.push(`${leftSpace}${borderStyle.tl}${left}${title}${right}${borderStyle.tr}`);
634
+ } else boxLines.push(`${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`);
635
+ const valignOffset = opts.style.valign === "center" ? Math.floor((height - textLines.length) / 2) : opts.style.valign === "top" ? height - textLines.length - paddingOffset : height - textLines.length;
636
+ for (let i$1 = 0; i$1 < height; i$1++) if (i$1 < valignOffset || i$1 >= valignOffset + textLines.length) boxLines.push(`${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${borderStyle.v}`);
637
+ else {
638
+ const line = textLines[i$1 - valignOffset];
639
+ const left = " ".repeat(paddingOffset);
640
+ const right = " ".repeat(width - stripAnsi(line).length);
641
+ boxLines.push(`${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`);
642
+ }
643
+ boxLines.push(`${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${borderStyle.br}`);
644
+ if (opts.style.marginBottom > 0) boxLines.push("".repeat(opts.style.marginBottom));
645
+ return boxLines.join("\n");
646
+ }
647
+
648
+ //#endregion
649
+ //#region ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/index.mjs
650
+ const r = Object.create(null), i = (e) => globalThis.process?.env || import.meta.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (e ? r : globalThis), o = new Proxy(r, {
651
+ get(e, s$1) {
652
+ return i()[s$1] ?? r[s$1];
653
+ },
654
+ has(e, s$1) {
655
+ const E = i();
656
+ return s$1 in E || s$1 in r;
657
+ },
658
+ set(e, s$1, E) {
659
+ const B = i(true);
660
+ return B[s$1] = E, true;
661
+ },
662
+ deleteProperty(e, s$1) {
663
+ if (!s$1) return false;
664
+ const E = i(true);
665
+ return delete E[s$1], true;
666
+ },
667
+ ownKeys() {
668
+ const e = i(true);
669
+ return Object.keys(e);
670
+ }
671
+ }), t = typeof process < "u" && process.env && process.env.NODE_ENV || "", f = [
672
+ ["APPVEYOR"],
673
+ [
674
+ "AWS_AMPLIFY",
675
+ "AWS_APP_ID",
676
+ { ci: true }
677
+ ],
678
+ ["AZURE_PIPELINES", "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"],
679
+ ["AZURE_STATIC", "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"],
680
+ ["APPCIRCLE", "AC_APPCIRCLE"],
681
+ ["BAMBOO", "bamboo_planKey"],
682
+ ["BITBUCKET", "BITBUCKET_COMMIT"],
683
+ ["BITRISE", "BITRISE_IO"],
684
+ ["BUDDY", "BUDDY_WORKSPACE_ID"],
685
+ ["BUILDKITE"],
686
+ ["CIRCLE", "CIRCLECI"],
687
+ ["CIRRUS", "CIRRUS_CI"],
688
+ [
689
+ "CLOUDFLARE_PAGES",
690
+ "CF_PAGES",
691
+ { ci: true }
692
+ ],
693
+ ["CODEBUILD", "CODEBUILD_BUILD_ARN"],
694
+ ["CODEFRESH", "CF_BUILD_ID"],
695
+ ["DRONE"],
696
+ ["DRONE", "DRONE_BUILD_EVENT"],
697
+ ["DSARI"],
698
+ ["GITHUB_ACTIONS"],
699
+ ["GITLAB", "GITLAB_CI"],
700
+ ["GITLAB", "CI_MERGE_REQUEST_ID"],
701
+ ["GOCD", "GO_PIPELINE_LABEL"],
702
+ ["LAYERCI"],
703
+ ["HUDSON", "HUDSON_URL"],
704
+ ["JENKINS", "JENKINS_URL"],
705
+ ["MAGNUM"],
706
+ ["NETLIFY"],
707
+ [
708
+ "NETLIFY",
709
+ "NETLIFY_LOCAL",
710
+ { ci: false }
711
+ ],
712
+ ["NEVERCODE"],
713
+ ["RENDER"],
714
+ ["SAIL", "SAILCI"],
715
+ ["SEMAPHORE"],
716
+ ["SCREWDRIVER"],
717
+ ["SHIPPABLE"],
718
+ ["SOLANO", "TDDIUM"],
719
+ ["STRIDER"],
720
+ ["TEAMCITY", "TEAMCITY_VERSION"],
721
+ ["TRAVIS"],
722
+ ["VERCEL", "NOW_BUILDER"],
723
+ [
724
+ "VERCEL",
725
+ "VERCEL",
726
+ { ci: false }
727
+ ],
728
+ [
729
+ "VERCEL",
730
+ "VERCEL_ENV",
731
+ { ci: false }
732
+ ],
733
+ ["APPCENTER", "APPCENTER_BUILD_ID"],
734
+ [
735
+ "CODESANDBOX",
736
+ "CODESANDBOX_SSE",
737
+ { ci: false }
738
+ ],
739
+ [
740
+ "CODESANDBOX",
741
+ "CODESANDBOX_HOST",
742
+ { ci: false }
743
+ ],
744
+ ["STACKBLITZ"],
745
+ ["STORMKIT"],
746
+ ["CLEAVR"],
747
+ ["ZEABUR"],
748
+ [
749
+ "CODESPHERE",
750
+ "CODESPHERE_APP_ID",
751
+ { ci: true }
752
+ ],
753
+ ["RAILWAY", "RAILWAY_PROJECT_ID"],
754
+ ["RAILWAY", "RAILWAY_SERVICE_ID"],
755
+ ["DENO-DEPLOY", "DENO_DEPLOYMENT_ID"],
756
+ [
757
+ "FIREBASE_APP_HOSTING",
758
+ "FIREBASE_APP_HOSTING",
759
+ { ci: true }
760
+ ]
761
+ ];
762
+ function b() {
763
+ if (globalThis.process?.env) for (const e of f) {
764
+ const s$1 = e[1] || e[0];
765
+ if (globalThis.process?.env[s$1]) return {
766
+ name: e[0].toLowerCase(),
767
+ ...e[2]
768
+ };
769
+ }
770
+ return globalThis.process?.env?.SHELL === "/bin/jsh" && globalThis.process?.versions?.webcontainer ? {
771
+ name: "stackblitz",
772
+ ci: false
773
+ } : {
774
+ name: "",
775
+ ci: false
776
+ };
777
+ }
778
+ const l = b();
779
+ l.name;
780
+ function n(e) {
781
+ return e ? e !== "false" : false;
782
+ }
783
+ const I = globalThis.process?.platform || "", T = n(o.CI) || l.ci !== false, a = n(globalThis.process?.stdout && globalThis.process?.stdout.isTTY), g = n(o.DEBUG), R = t === "test" || n(o.TEST);
784
+ n(o.MINIMAL);
785
+ const A = /^win/i.test(I);
786
+ !n(o.NO_COLOR) && (n(o.FORCE_COLOR) || (a || A) && o.TERM);
787
+ const C = (globalThis.process?.versions?.node || "").replace(/^v/, "") || null;
788
+ Number(C?.split(".")[0]);
789
+ const y = globalThis.process || Object.create(null), _ = { versions: {} };
790
+ new Proxy(y, { get(e, s$1) {
791
+ if (s$1 === "env") return o;
792
+ if (s$1 in e) return e[s$1];
793
+ if (s$1 in _) return _[s$1];
794
+ } });
795
+ const c = globalThis.process?.release?.name === "node", O = !!globalThis.Bun || !!globalThis.process?.versions?.bun, D = !!globalThis.Deno, L = !!globalThis.fastly, S = !!globalThis.Netlify, u = !!globalThis.EdgeRuntime, N = globalThis.navigator?.userAgent === "Cloudflare-Workers", F = [
796
+ [S, "netlify"],
797
+ [u, "edge-light"],
798
+ [N, "workerd"],
799
+ [L, "fastly"],
800
+ [D, "deno"],
801
+ [O, "bun"],
802
+ [c, "node"]
803
+ ];
804
+ function G() {
805
+ const e = F.find((s$1) => s$1[0]);
806
+ if (e) return { name: e[1] };
807
+ }
808
+ const P = G();
809
+ P?.name;
810
+ function ansiRegex({ onlyFirst = false } = {}) {
811
+ const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
812
+ const pattern = [`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`, "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
813
+ return new RegExp(pattern, onlyFirst ? void 0 : "g");
814
+ }
815
+ const regex = ansiRegex();
816
+ function stripAnsi$1(string) {
817
+ if (typeof string !== "string") throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
818
+ return string.replace(regex, "");
819
+ }
820
+ function isAmbiguous(x) {
821
+ return x === 161 || x === 164 || x === 167 || x === 168 || x === 170 || x === 173 || x === 174 || x >= 176 && x <= 180 || x >= 182 && x <= 186 || x >= 188 && x <= 191 || x === 198 || x === 208 || x === 215 || x === 216 || x >= 222 && x <= 225 || x === 230 || x >= 232 && x <= 234 || x === 236 || x === 237 || x === 240 || x === 242 || x === 243 || x >= 247 && x <= 250 || x === 252 || x === 254 || x === 257 || x === 273 || x === 275 || x === 283 || x === 294 || x === 295 || x === 299 || x >= 305 && x <= 307 || x === 312 || x >= 319 && x <= 322 || x === 324 || x >= 328 && x <= 331 || x === 333 || x === 338 || x === 339 || x === 358 || x === 359 || x === 363 || x === 462 || x === 464 || x === 466 || x === 468 || x === 470 || x === 472 || x === 474 || x === 476 || x === 593 || x === 609 || x === 708 || x === 711 || x >= 713 && x <= 715 || x === 717 || x === 720 || x >= 728 && x <= 731 || x === 733 || x === 735 || x >= 768 && x <= 879 || x >= 913 && x <= 929 || x >= 931 && x <= 937 || x >= 945 && x <= 961 || x >= 963 && x <= 969 || x === 1025 || x >= 1040 && x <= 1103 || x === 1105 || x === 8208 || x >= 8211 && x <= 8214 || x === 8216 || x === 8217 || x === 8220 || x === 8221 || x >= 8224 && x <= 8226 || x >= 8228 && x <= 8231 || x === 8240 || x === 8242 || x === 8243 || x === 8245 || x === 8251 || x === 8254 || x === 8308 || x === 8319 || x >= 8321 && x <= 8324 || x === 8364 || x === 8451 || x === 8453 || x === 8457 || x === 8467 || x === 8470 || x === 8481 || x === 8482 || x === 8486 || x === 8491 || x === 8531 || x === 8532 || x >= 8539 && x <= 8542 || x >= 8544 && x <= 8555 || x >= 8560 && x <= 8569 || x === 8585 || x >= 8592 && x <= 8601 || x === 8632 || x === 8633 || x === 8658 || x === 8660 || x === 8679 || x === 8704 || x === 8706 || x === 8707 || x === 8711 || x === 8712 || x === 8715 || x === 8719 || x === 8721 || x === 8725 || x === 8730 || x >= 8733 && x <= 8736 || x === 8739 || x === 8741 || x >= 8743 && x <= 8748 || x === 8750 || x >= 8756 && x <= 8759 || x === 8764 || x === 8765 || x === 8776 || x === 8780 || x === 8786 || x === 8800 || x === 8801 || x >= 8804 && x <= 8807 || x === 8810 || x === 8811 || x === 8814 || x === 8815 || x === 8834 || x === 8835 || x === 8838 || x === 8839 || x === 8853 || x === 8857 || x === 8869 || x === 8895 || x === 8978 || x >= 9312 && x <= 9449 || x >= 9451 && x <= 9547 || x >= 9552 && x <= 9587 || x >= 9600 && x <= 9615 || x >= 9618 && x <= 9621 || x === 9632 || x === 9633 || x >= 9635 && x <= 9641 || x === 9650 || x === 9651 || x === 9654 || x === 9655 || x === 9660 || x === 9661 || x === 9664 || x === 9665 || x >= 9670 && x <= 9672 || x === 9675 || x >= 9678 && x <= 9681 || x >= 9698 && x <= 9701 || x === 9711 || x === 9733 || x === 9734 || x === 9737 || x === 9742 || x === 9743 || x === 9756 || x === 9758 || x === 9792 || x === 9794 || x === 9824 || x === 9825 || x >= 9827 && x <= 9829 || x >= 9831 && x <= 9834 || x === 9836 || x === 9837 || x === 9839 || x === 9886 || x === 9887 || x === 9919 || x >= 9926 && x <= 9933 || x >= 9935 && x <= 9939 || x >= 9941 && x <= 9953 || x === 9955 || x === 9960 || x === 9961 || x >= 9963 && x <= 9969 || x === 9972 || x >= 9974 && x <= 9977 || x === 9979 || x === 9980 || x === 9982 || x === 9983 || x === 10045 || x >= 10102 && x <= 10111 || x >= 11094 && x <= 11097 || x >= 12872 && x <= 12879 || x >= 57344 && x <= 63743 || x >= 65024 && x <= 65039 || x === 65533 || x >= 127232 && x <= 127242 || x >= 127248 && x <= 127277 || x >= 127280 && x <= 127337 || x >= 127344 && x <= 127373 || x === 127375 || x === 127376 || x >= 127387 && x <= 127404 || x >= 917760 && x <= 917999 || x >= 983040 && x <= 1048573 || x >= 1048576 && x <= 1114109;
822
+ }
823
+ function isFullWidth(x) {
824
+ return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
825
+ }
826
+ function isWide(x) {
827
+ return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9776 && x <= 9783 || x >= 9800 && x <= 9811 || x === 9855 || x >= 9866 && x <= 9871 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12773 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x === 94192 || x === 94193 || x >= 94208 && x <= 100343 || x >= 100352 && x <= 101589 || x >= 101631 && x <= 101640 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x >= 119552 && x <= 119638 || x >= 119648 && x <= 119670 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128727 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129673 || x >= 129679 && x <= 129734 || x >= 129742 && x <= 129756 || x >= 129759 && x <= 129769 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
828
+ }
829
+ function validate(codePoint) {
830
+ if (!Number.isSafeInteger(codePoint)) throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
831
+ }
832
+ function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
833
+ validate(codePoint);
834
+ if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) return 2;
835
+ return 1;
836
+ }
837
+ const emojiRegex = () => {
838
+ return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
839
+ };
840
+ const segmenter = globalThis.Intl?.Segmenter ? new Intl.Segmenter() : { segment: (str) => str.split("") };
841
+ const defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
842
+ function stringWidth$1(string, options = {}) {
843
+ if (typeof string !== "string" || string.length === 0) return 0;
844
+ const { ambiguousIsNarrow = true, countAnsiEscapeCodes = false } = options;
845
+ if (!countAnsiEscapeCodes) string = stripAnsi$1(string);
846
+ if (string.length === 0) return 0;
847
+ let width = 0;
848
+ const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
849
+ for (const { segment: character } of segmenter.segment(string)) {
850
+ const codePoint = character.codePointAt(0);
851
+ if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) continue;
852
+ if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) continue;
853
+ if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) continue;
854
+ if (codePoint >= 55296 && codePoint <= 57343) continue;
855
+ if (codePoint >= 65024 && codePoint <= 65039) continue;
856
+ if (defaultIgnorableCodePointRegex.test(character)) continue;
857
+ if (emojiRegex().test(character)) {
858
+ width += 2;
859
+ continue;
860
+ }
861
+ width += eastAsianWidth(codePoint, eastAsianWidthOptions);
862
+ }
863
+ return width;
864
+ }
865
+ function isUnicodeSupported() {
866
+ const { env: env$1 } = g$1;
867
+ const { TERM, TERM_PROGRAM } = env$1;
868
+ if (g$1.platform !== "win32") return TERM !== "linux";
869
+ return Boolean(env$1.WT_SESSION) || Boolean(env$1.TERMINUS_SUBLIME) || env$1.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env$1.TERMINAL_EMULATOR === "JetBrains-JediTerm";
870
+ }
871
+ const TYPE_COLOR_MAP = {
872
+ info: "cyan",
873
+ fail: "red",
874
+ success: "green",
875
+ ready: "green",
876
+ start: "magenta"
877
+ };
878
+ const LEVEL_COLOR_MAP = {
879
+ 0: "red",
880
+ 1: "yellow"
881
+ };
882
+ const unicode = isUnicodeSupported();
883
+ const s = (c$1, fallback) => unicode ? c$1 : fallback;
884
+ const TYPE_ICONS = {
885
+ error: s("✖", "×"),
886
+ fatal: s("✖", "×"),
887
+ ready: s("✔", "√"),
888
+ warn: s("⚠", "‼"),
889
+ info: s("ℹ", "i"),
890
+ success: s("✔", "√"),
891
+ debug: s("⚙", "D"),
892
+ trace: s("→", "→"),
893
+ fail: s("✖", "×"),
894
+ start: s("◐", "o"),
895
+ log: ""
896
+ };
897
+ function stringWidth(str) {
898
+ const hasICU = typeof Intl === "object";
899
+ if (!hasICU || !Intl.Segmenter) return stripAnsi(str).length;
900
+ return stringWidth$1(str);
901
+ }
902
+ var FancyReporter = class extends BasicReporter {
903
+ formatStack(stack, message, opts) {
904
+ const indent = " ".repeat((opts?.errorLevel || 0) + 1);
905
+ return `
906
+ ${indent}` + parseStack(stack, message).map((line) => " " + line.replace(/^at +/, (m) => colors.gray(m)).replace(/\((.+)\)/, (_$1, m) => `(${colors.cyan(m)})`)).join(`
907
+ ${indent}`);
908
+ }
909
+ formatType(logObj, isBadge, opts) {
910
+ const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || "gray";
911
+ if (isBadge) return getBgColor(typeColor)(colors.black(` ${logObj.type.toUpperCase()} `));
912
+ const _type = typeof TYPE_ICONS[logObj.type] === "string" ? TYPE_ICONS[logObj.type] : logObj.icon || logObj.type;
913
+ return _type ? getColor(typeColor)(_type) : "";
914
+ }
915
+ formatLogObj(logObj, opts) {
916
+ const [message, ...additional] = this.formatArgs(logObj.args, opts).split("\n");
917
+ if (logObj.type === "box") return box(characterFormat(message + (additional.length > 0 ? "\n" + additional.join("\n") : "")), {
918
+ title: logObj.title ? characterFormat(logObj.title) : void 0,
919
+ style: logObj.style
920
+ });
921
+ const date = this.formatDate(logObj.date, opts);
922
+ const coloredDate = date && colors.gray(date);
923
+ const isBadge = logObj.badge ?? logObj.level < 2;
924
+ const type = this.formatType(logObj, isBadge, opts);
925
+ const tag = logObj.tag ? colors.gray(logObj.tag) : "";
926
+ let line;
927
+ const left = this.filterAndJoin([type, characterFormat(message)]);
928
+ const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
929
+ const space = (opts.columns || 0) - stringWidth(left) - stringWidth(right) - 2;
930
+ line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${colors.gray(`[${right}]`)} ` : "") + left;
931
+ line += characterFormat(additional.length > 0 ? "\n" + additional.join("\n") : "");
932
+ if (logObj.type === "trace") {
933
+ const _err = /* @__PURE__ */ new Error("Trace: " + logObj.message);
934
+ line += this.formatStack(_err.stack || "", _err.message);
935
+ }
936
+ return isBadge ? "\n" + line + "\n" : line;
937
+ }
938
+ };
939
+ function characterFormat(str) {
940
+ return str.replace(/`([^`]+)`/gm, (_$1, m) => colors.cyan(m)).replace(/\s+_([^_]+)_\s+/gm, (_$1, m) => ` ${colors.underline(m)} `);
941
+ }
942
+ function getColor(color = "white") {
943
+ return colors[color] || colors.white;
944
+ }
945
+ function getBgColor(color = "bgWhite") {
946
+ return colors[`bg${color[0].toUpperCase()}${color.slice(1)}`] || colors.bgWhite;
947
+ }
948
+ function createConsola(options = {}) {
949
+ let level = _getDefaultLogLevel();
950
+ if (process.env.CONSOLA_LEVEL) level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;
951
+ const consola2 = createConsola$1({
952
+ level,
953
+ defaults: { level },
954
+ stdout: process.stdout,
955
+ stderr: process.stderr,
956
+ prompt: (...args) => import("./prompt-DwEAzq0q.js").then((m) => m.prompt(...args)),
957
+ reporters: options.reporters || [options.fancy ?? !(T || R) ? new FancyReporter() : new BasicReporter()],
958
+ ...options
959
+ });
960
+ return consola2;
961
+ }
962
+ function _getDefaultLogLevel() {
963
+ if (g) return LogLevels.debug;
964
+ if (R) return LogLevels.warn;
965
+ return LogLevels.info;
966
+ }
967
+ const consola = createConsola();
968
+
969
+ //#endregion
970
+ //#region src/utils/EventEmitter.ts
971
+ var EventEmitter$1 = class {
972
+ constructor() {
973
+ this.#emitter.setMaxListeners(100);
974
+ }
975
+ #emitter = new EventEmitter();
976
+ emit(eventName, ...eventArg) {
977
+ this.#emitter.emit(eventName, ...eventArg);
978
+ }
979
+ on(eventName, handler) {
980
+ this.#emitter.on(eventName, handler);
981
+ }
982
+ off(eventName, handler) {
983
+ this.#emitter.off(eventName, handler);
984
+ }
985
+ removeAll() {
986
+ this.#emitter.removeAllListeners();
987
+ }
988
+ };
989
+
990
+ //#endregion
991
+ //#region src/logger.ts
992
+ const LogMapper = {
993
+ silent: Number.NEGATIVE_INFINITY,
994
+ info: 3,
995
+ debug: 4
996
+ };
997
+ function createLogger({ logLevel = 3, name, consola: _consola } = {}) {
998
+ const events = new EventEmitter$1();
999
+ const startDate = Date.now();
1000
+ const cachedLogs = /* @__PURE__ */ new Set();
1001
+ const consola$1 = _consola || createConsola({
1002
+ level: logLevel,
1003
+ formatOptions: {
1004
+ colors: true,
1005
+ date: true,
1006
+ columns: 80,
1007
+ compact: logLevel !== LogMapper.debug
1008
+ }
1009
+ }).withTag(name ? randomCliColour(name) : "");
1010
+ consola$1?.wrapConsole();
1011
+ events.on("start", (message) => {
1012
+ consola$1.start(message);
1013
+ });
1014
+ events.on("success", (message) => {
1015
+ consola$1.success(message);
1016
+ });
1017
+ events.on("warning", (message) => {
1018
+ consola$1.warn(pc.yellow(message));
1019
+ });
1020
+ events.on("info", (message) => {
1021
+ consola$1.info(pc.yellow(message));
1022
+ });
1023
+ events.on("debug", (message) => {
1024
+ if (message.logs.join("\n\n").length <= 100 && logLevel === LogMapper.debug) console.log(message.logs.join("\n\n"));
1025
+ cachedLogs.add(message);
1026
+ });
1027
+ events.on("error", (message, cause) => {
1028
+ const error = new Error(message || "Something went wrong");
1029
+ error.cause = cause;
1030
+ throw error;
1031
+ });
1032
+ if (consola$1) consola$1.level = logLevel;
1033
+ const logger = {
1034
+ name,
1035
+ logLevel,
1036
+ consola: consola$1,
1037
+ on(...args) {
1038
+ return events.on(...args);
1039
+ },
1040
+ emit(...args) {
1041
+ return events.emit(...args);
1042
+ },
1043
+ async writeLogs() {
1044
+ const files = {};
1045
+ cachedLogs.forEach((log) => {
1046
+ const fileName = resolve(process.cwd(), ".kubb", log.fileName || `kubb-${startDate}.log`);
1047
+ if (!files[fileName]) files[fileName] = [];
1048
+ files[fileName] = [...files[fileName], `[${log.date.toLocaleString()}]: ${log.logs.join("\n\n")}`];
1049
+ });
1050
+ await Promise.all(Object.entries(files).map(async ([fileName, logs]) => {
1051
+ return write(fileName, logs.join("\n"));
1052
+ }));
1053
+ return Object.keys(files);
1054
+ }
1055
+ };
1056
+ return logger;
1057
+ }
1058
+ function randomColour(text) {
1059
+ if (!text) return "white";
1060
+ const defaultColours = [
1061
+ "black",
1062
+ "red",
1063
+ "green",
1064
+ "yellow",
1065
+ "blue",
1066
+ "red",
1067
+ "green",
1068
+ "magenta",
1069
+ "cyan",
1070
+ "gray"
1071
+ ];
1072
+ const random = seedrandom(text);
1073
+ const colour = defaultColours.at(Math.floor(random() * defaultColours.length)) || "white";
1074
+ return colour;
1075
+ }
1076
+ function randomCliColour(text) {
1077
+ if (!text) return "";
1078
+ const colour = randomColour(text);
1079
+ const fn = pc[colour];
1080
+ return fn ? fn(text) : text;
1081
+ }
1082
+
1083
+ //#endregion
1084
+ export { EventEmitter$1 as EventEmitter, LogMapper, createLogger, randomCliColour, randomColour };
1085
+ //# sourceMappingURL=logger-Cs45J4yy.js.map