@storm-software/git-tools 2.115.1 → 2.115.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.
@@ -0,0 +1,3707 @@
1
+ 'use strict';
2
+
3
+ var chalk = require('chalk');
4
+ var c12 = require('c12');
5
+ var fs = require('fs');
6
+ var path = require('path');
7
+ var promises = require('fs/promises');
8
+
9
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
+
11
+ var chalk__default = /*#__PURE__*/_interopDefault(chalk);
12
+
13
+ var __defProp = Object.defineProperty;
14
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
15
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
16
+ }) : x)(function(x) {
17
+ if (typeof require !== "undefined") return require.apply(this, arguments);
18
+ throw Error('Dynamic require of "' + x + '" is not supported');
19
+ });
20
+ var __export = (target, all) => {
21
+ for (var name in all)
22
+ __defProp(target, name, { get: all[name], enumerable: true });
23
+ };
24
+
25
+ // ../config-tools/src/types.ts
26
+ var LogLevel = {
27
+ SILENT: 0,
28
+ FATAL: 10,
29
+ ERROR: 20,
30
+ WARN: 30,
31
+ SUCCESS: 35,
32
+ INFO: 40,
33
+ DEBUG: 60,
34
+ TRACE: 70,
35
+ ALL: 100
36
+ };
37
+ var LogLevelLabel = {
38
+ SILENT: "silent",
39
+ FATAL: "fatal",
40
+ ERROR: "error",
41
+ WARN: "warn",
42
+ SUCCESS: "success",
43
+ INFO: "info",
44
+ DEBUG: "debug",
45
+ TRACE: "trace",
46
+ ALL: "all"
47
+ };
48
+
49
+ // ../config-tools/src/utilities/colors.ts
50
+ var DEFAULT_COLOR_CONFIG = {
51
+ dark: {
52
+ brand: "#2dd4bf",
53
+ success: "#10b981",
54
+ info: "#58a6ff",
55
+ warning: "#f3d371",
56
+ danger: "#D8314A",
57
+ fatal: "#a40e26"}
58
+ };
59
+ var chalkDefault = {
60
+ hex: (_) => (message) => message,
61
+ bgHex: (_) => ({
62
+ whiteBright: (message) => message,
63
+ white: (message) => message
64
+ }),
65
+ white: (message) => message,
66
+ whiteBright: (message) => message,
67
+ gray: (message) => message,
68
+ bold: {
69
+ hex: (_) => (message) => message,
70
+ bgHex: (_) => ({
71
+ whiteBright: (message) => message,
72
+ white: (message) => message
73
+ }),
74
+ whiteBright: (message) => message,
75
+ white: (message) => message
76
+ },
77
+ dim: {
78
+ hex: (_) => (message) => message,
79
+ gray: (message) => message
80
+ }
81
+ };
82
+ var getChalk = () => {
83
+ let _chalk = chalk__default.default;
84
+ if (!_chalk?.hex || !_chalk?.bold?.hex || !_chalk?.bgHex || !_chalk?.whiteBright || !_chalk?.white) {
85
+ _chalk = chalkDefault;
86
+ }
87
+ return _chalk;
88
+ };
89
+
90
+ // ../config-tools/src/logger/is-unicode-supported.ts
91
+ function isUnicodeSupported() {
92
+ if (process.platform !== "win32") {
93
+ return process.env.TERM !== "linux";
94
+ }
95
+ return Boolean(process.env.WT_SESSION) || // Windows Terminal
96
+ Boolean(process.env.TERMINUS_SUBLIME) || // Terminus (<0.2.27)
97
+ process.env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
98
+ process.env.TERM_PROGRAM === "Terminus-Sublime" || process.env.TERM_PROGRAM === "vscode" || process.env.TERM === "xterm-256color" || process.env.TERM === "alacritty" || process.env.TERM === "rxvt-unicode" || process.env.TERM === "rxvt-unicode-256color" || process.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
99
+ }
100
+
101
+ // ../config-tools/src/logger/console-icons.ts
102
+ var useIcon = (c, fallback) => isUnicodeSupported() ? c : fallback;
103
+ var CONSOLE_ICONS = {
104
+ [LogLevelLabel.ERROR]: useIcon("\u2718", "\xD7"),
105
+ [LogLevelLabel.FATAL]: useIcon("\u{1F480}", "\xD7"),
106
+ [LogLevelLabel.WARN]: useIcon("\u26A0", "\u203C"),
107
+ [LogLevelLabel.INFO]: useIcon("\u2139", "i"),
108
+ [LogLevelLabel.SUCCESS]: useIcon("\u2714", "\u221A"),
109
+ [LogLevelLabel.DEBUG]: useIcon("\u{1F6E0}", "D"),
110
+ [LogLevelLabel.TRACE]: useIcon("\u{1F6E0}", "T"),
111
+ [LogLevelLabel.ALL]: useIcon("\u2709", "\u2192")
112
+ };
113
+
114
+ // ../config-tools/src/logger/format-timestamp.ts
115
+ var formatTimestamp = (date2 = /* @__PURE__ */ new Date()) => {
116
+ return `${date2.toLocaleDateString()} ${date2.toLocaleTimeString()}`;
117
+ };
118
+
119
+ // ../config-tools/src/logger/get-log-level.ts
120
+ var getLogLevel = (label) => {
121
+ switch (label) {
122
+ case "all":
123
+ return LogLevel.ALL;
124
+ case "trace":
125
+ return LogLevel.TRACE;
126
+ case "debug":
127
+ return LogLevel.DEBUG;
128
+ case "info":
129
+ return LogLevel.INFO;
130
+ case "warn":
131
+ return LogLevel.WARN;
132
+ case "error":
133
+ return LogLevel.ERROR;
134
+ case "fatal":
135
+ return LogLevel.FATAL;
136
+ case "silent":
137
+ return LogLevel.SILENT;
138
+ default:
139
+ return LogLevel.INFO;
140
+ }
141
+ };
142
+ var getLogLevelLabel = (logLevel = LogLevel.INFO) => {
143
+ if (logLevel >= LogLevel.ALL) {
144
+ return LogLevelLabel.ALL;
145
+ }
146
+ if (logLevel >= LogLevel.TRACE) {
147
+ return LogLevelLabel.TRACE;
148
+ }
149
+ if (logLevel >= LogLevel.DEBUG) {
150
+ return LogLevelLabel.DEBUG;
151
+ }
152
+ if (logLevel >= LogLevel.INFO) {
153
+ return LogLevelLabel.INFO;
154
+ }
155
+ if (logLevel >= LogLevel.WARN) {
156
+ return LogLevelLabel.WARN;
157
+ }
158
+ if (logLevel >= LogLevel.ERROR) {
159
+ return LogLevelLabel.ERROR;
160
+ }
161
+ if (logLevel >= LogLevel.FATAL) {
162
+ return LogLevelLabel.FATAL;
163
+ }
164
+ if (logLevel <= LogLevel.SILENT) {
165
+ return LogLevelLabel.SILENT;
166
+ }
167
+ return LogLevelLabel.INFO;
168
+ };
169
+ var isVerbose = (label = LogLevelLabel.SILENT) => {
170
+ const logLevel = typeof label === "string" ? getLogLevel(label) : label;
171
+ return logLevel >= LogLevel.DEBUG;
172
+ };
173
+
174
+ // ../config-tools/src/logger/console.ts
175
+ var getLogFn = (logLevel = LogLevel.INFO, config2 = {}, _chalk = getChalk()) => {
176
+ const colors = !config2.colors?.dark && !config2.colors?.["base"] && !config2.colors?.["base"]?.dark ? DEFAULT_COLOR_CONFIG : config2.colors?.dark && typeof config2.colors.dark === "string" ? config2.colors : config2.colors?.["base"]?.dark && typeof config2.colors["base"].dark === "string" ? config2.colors["base"].dark : config2.colors?.["base"] ? config2.colors?.["base"] : DEFAULT_COLOR_CONFIG;
177
+ const configLogLevel = config2.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
178
+ if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
179
+ return (_) => {
180
+ };
181
+ }
182
+ if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel) {
183
+ return (message) => {
184
+ console.error(
185
+ `
186
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.fatal ?? DEFAULT_COLOR_CONFIG.dark.fatal)(`[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
187
+ `
188
+ );
189
+ };
190
+ }
191
+ if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel) {
192
+ return (message) => {
193
+ console.error(
194
+ `
195
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.danger ?? DEFAULT_COLOR_CONFIG.dark.danger)(`[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
196
+ `
197
+ );
198
+ };
199
+ }
200
+ if (typeof logLevel === "number" && LogLevel.WARN >= logLevel) {
201
+ return (message) => {
202
+ console.warn(
203
+ `
204
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.warning ?? DEFAULT_COLOR_CONFIG.dark.warning)(`[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
205
+ `
206
+ );
207
+ };
208
+ }
209
+ if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel) {
210
+ return (message) => {
211
+ console.info(
212
+ `
213
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.success ?? DEFAULT_COLOR_CONFIG.dark.success)(`[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
214
+ `
215
+ );
216
+ };
217
+ }
218
+ if (typeof logLevel === "number" && LogLevel.INFO >= logLevel) {
219
+ return (message) => {
220
+ console.info(
221
+ `
222
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? DEFAULT_COLOR_CONFIG.dark.info)(`[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
223
+ `
224
+ );
225
+ };
226
+ }
227
+ if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel) {
228
+ return (message) => {
229
+ console.debug(
230
+ `
231
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? DEFAULT_COLOR_CONFIG.dark.info)(`[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
232
+ `
233
+ );
234
+ };
235
+ }
236
+ if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel) {
237
+ return (message) => {
238
+ console.debug(
239
+ `
240
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? DEFAULT_COLOR_CONFIG.dark.info)(`[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Trace] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
241
+ `
242
+ );
243
+ };
244
+ }
245
+ return (message) => {
246
+ console.log(
247
+ `
248
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? DEFAULT_COLOR_CONFIG.dark.brand)(`[${CONSOLE_ICONS[LogLevelLabel.ALL]} System] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
249
+ `
250
+ );
251
+ };
252
+ };
253
+ var writeFatal = (message, config2) => getLogFn(LogLevel.FATAL, config2)(message);
254
+ var writeError = (message, config2) => getLogFn(LogLevel.ERROR, config2)(message);
255
+ var writeWarning = (message, config2) => getLogFn(LogLevel.WARN, config2)(message);
256
+ var writeInfo = (message, config2) => getLogFn(LogLevel.INFO, config2)(message);
257
+ var writeSuccess = (message, config2) => getLogFn(LogLevel.SUCCESS, config2)(message);
258
+ var writeDebug = (message, config2) => getLogFn(LogLevel.DEBUG, config2)(message);
259
+ var writeTrace = (message, config2) => getLogFn(LogLevel.TRACE, config2)(message);
260
+ var MAX_DEPTH = 4;
261
+ var formatLogMessage = (message, options = {}, depth2 = 0) => {
262
+ if (depth2 > MAX_DEPTH) {
263
+ return "<max depth>";
264
+ }
265
+ const prefix = options.prefix ?? "-";
266
+ const skip = options.skip ?? [];
267
+ return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
268
+ ${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, { prefix: `${prefix}-`, skip }, depth2 + 1)}`).join("\n")}` : typeof message === "object" ? `
269
+ ${Object.keys(message).filter((key) => !skip.includes(key)).map(
270
+ (key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(
271
+ message[key],
272
+ { prefix: `${prefix}-`, skip },
273
+ depth2 + 1
274
+ ) : message[key]}`
275
+ ).join("\n")}` : message;
276
+ };
277
+ var _isFunction = (value) => {
278
+ try {
279
+ return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
280
+ } catch {
281
+ return false;
282
+ }
283
+ };
284
+
285
+ // ../config-tools/src/utilities/process-handler.ts
286
+ var exitWithError = (config2) => {
287
+ writeFatal("Exiting script with an error status...", config2);
288
+ process.exit(1);
289
+ };
290
+ var exitWithSuccess = (config2) => {
291
+ writeSuccess("Script completed successfully. Exiting...", config2);
292
+ process.exit(0);
293
+ };
294
+ var handleProcess = (config2) => {
295
+ writeTrace(
296
+ `Using the following arguments to process the script: ${process.argv.join(", ")}`,
297
+ config2
298
+ );
299
+ process.on("unhandledRejection", (error) => {
300
+ writeError(
301
+ `An Unhandled Rejection occurred while running the program: ${error}`,
302
+ config2
303
+ );
304
+ exitWithError(config2);
305
+ });
306
+ process.on("uncaughtException", (error) => {
307
+ writeError(
308
+ `An Uncaught Exception occurred while running the program: ${error.message}
309
+ Stacktrace: ${error.stack}`,
310
+ config2
311
+ );
312
+ exitWithError(config2);
313
+ });
314
+ process.on("SIGTERM", (signal) => {
315
+ writeError(`The program terminated with signal code: ${signal}`, config2);
316
+ exitWithError(config2);
317
+ });
318
+ process.on("SIGINT", (signal) => {
319
+ writeError(`The program terminated with signal code: ${signal}`, config2);
320
+ exitWithError(config2);
321
+ });
322
+ process.on("SIGHUP", (signal) => {
323
+ writeError(`The program terminated with signal code: ${signal}`, config2);
324
+ exitWithError(config2);
325
+ });
326
+ };
327
+ // @__NO_SIDE_EFFECTS__
328
+ function $constructor(name, initializer2, params) {
329
+ function init(inst, def) {
330
+ var _a;
331
+ Object.defineProperty(inst, "_zod", {
332
+ value: inst._zod ?? {},
333
+ enumerable: false
334
+ });
335
+ (_a = inst._zod).traits ?? (_a.traits = /* @__PURE__ */ new Set());
336
+ inst._zod.traits.add(name);
337
+ initializer2(inst, def);
338
+ for (const k in _.prototype) {
339
+ if (!(k in inst))
340
+ Object.defineProperty(inst, k, { value: _.prototype[k].bind(inst) });
341
+ }
342
+ inst._zod.constr = _;
343
+ inst._zod.def = def;
344
+ }
345
+ const Parent = params?.Parent ?? Object;
346
+ class Definition extends Parent {
347
+ }
348
+ Object.defineProperty(Definition, "name", { value: name });
349
+ function _(def) {
350
+ var _a;
351
+ const inst = params?.Parent ? new Definition() : this;
352
+ init(inst, def);
353
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
354
+ for (const fn of inst._zod.deferred) {
355
+ fn();
356
+ }
357
+ return inst;
358
+ }
359
+ Object.defineProperty(_, "init", { value: init });
360
+ Object.defineProperty(_, Symbol.hasInstance, {
361
+ value: (inst) => {
362
+ if (params?.Parent && inst instanceof params.Parent)
363
+ return true;
364
+ return inst?._zod?.traits?.has(name);
365
+ }
366
+ });
367
+ Object.defineProperty(_, "name", { value: name });
368
+ return _;
369
+ }
370
+ var $ZodAsyncError = class extends Error {
371
+ constructor() {
372
+ super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
373
+ }
374
+ };
375
+ var globalConfig = {};
376
+ function config(newConfig) {
377
+ return globalConfig;
378
+ }
379
+
380
+ // ../../node_modules/.pnpm/zod@4.0.5/node_modules/zod/v4/core/util.js
381
+ var util_exports = {};
382
+ __export(util_exports, {
383
+ BIGINT_FORMAT_RANGES: () => BIGINT_FORMAT_RANGES,
384
+ Class: () => Class,
385
+ NUMBER_FORMAT_RANGES: () => NUMBER_FORMAT_RANGES,
386
+ aborted: () => aborted,
387
+ allowsEval: () => allowsEval,
388
+ assert: () => assert,
389
+ assertEqual: () => assertEqual,
390
+ assertIs: () => assertIs,
391
+ assertNever: () => assertNever,
392
+ assertNotEqual: () => assertNotEqual,
393
+ assignProp: () => assignProp,
394
+ cached: () => cached,
395
+ captureStackTrace: () => captureStackTrace,
396
+ cleanEnum: () => cleanEnum,
397
+ cleanRegex: () => cleanRegex,
398
+ clone: () => clone,
399
+ createTransparentProxy: () => createTransparentProxy,
400
+ defineLazy: () => defineLazy,
401
+ esc: () => esc,
402
+ escapeRegex: () => escapeRegex,
403
+ extend: () => extend,
404
+ finalizeIssue: () => finalizeIssue,
405
+ floatSafeRemainder: () => floatSafeRemainder,
406
+ getElementAtPath: () => getElementAtPath,
407
+ getEnumValues: () => getEnumValues,
408
+ getLengthableOrigin: () => getLengthableOrigin,
409
+ getParsedType: () => getParsedType,
410
+ getSizableOrigin: () => getSizableOrigin,
411
+ isObject: () => isObject,
412
+ isPlainObject: () => isPlainObject,
413
+ issue: () => issue,
414
+ joinValues: () => joinValues,
415
+ jsonStringifyReplacer: () => jsonStringifyReplacer,
416
+ merge: () => merge,
417
+ normalizeParams: () => normalizeParams,
418
+ nullish: () => nullish,
419
+ numKeys: () => numKeys,
420
+ omit: () => omit,
421
+ optionalKeys: () => optionalKeys,
422
+ partial: () => partial,
423
+ pick: () => pick,
424
+ prefixIssues: () => prefixIssues,
425
+ primitiveTypes: () => primitiveTypes,
426
+ promiseAllObject: () => promiseAllObject,
427
+ propertyKeyTypes: () => propertyKeyTypes,
428
+ randomString: () => randomString,
429
+ required: () => required,
430
+ stringifyPrimitive: () => stringifyPrimitive,
431
+ unwrapMessage: () => unwrapMessage
432
+ });
433
+ function assertEqual(val) {
434
+ return val;
435
+ }
436
+ function assertNotEqual(val) {
437
+ return val;
438
+ }
439
+ function assertIs(_arg) {
440
+ }
441
+ function assertNever(_x) {
442
+ throw new Error();
443
+ }
444
+ function assert(_) {
445
+ }
446
+ function getEnumValues(entries) {
447
+ const numericValues = Object.values(entries).filter((v) => typeof v === "number");
448
+ const values = Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
449
+ return values;
450
+ }
451
+ function joinValues(array2, separator = "|") {
452
+ return array2.map((val) => stringifyPrimitive(val)).join(separator);
453
+ }
454
+ function jsonStringifyReplacer(_, value) {
455
+ if (typeof value === "bigint")
456
+ return value.toString();
457
+ return value;
458
+ }
459
+ function cached(getter) {
460
+ return {
461
+ get value() {
462
+ {
463
+ const value = getter();
464
+ Object.defineProperty(this, "value", { value });
465
+ return value;
466
+ }
467
+ }
468
+ };
469
+ }
470
+ function nullish(input) {
471
+ return input === null || input === void 0;
472
+ }
473
+ function cleanRegex(source) {
474
+ const start = source.startsWith("^") ? 1 : 0;
475
+ const end = source.endsWith("$") ? source.length - 1 : source.length;
476
+ return source.slice(start, end);
477
+ }
478
+ function floatSafeRemainder(val, step) {
479
+ const valDecCount = (val.toString().split(".")[1] || "").length;
480
+ const stepDecCount = (step.toString().split(".")[1] || "").length;
481
+ const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
482
+ const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
483
+ const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
484
+ return valInt % stepInt / 10 ** decCount;
485
+ }
486
+ function defineLazy(object2, key, getter) {
487
+ Object.defineProperty(object2, key, {
488
+ get() {
489
+ {
490
+ const value = getter();
491
+ object2[key] = value;
492
+ return value;
493
+ }
494
+ },
495
+ set(v) {
496
+ Object.defineProperty(object2, key, {
497
+ value: v
498
+ // configurable: true,
499
+ });
500
+ },
501
+ configurable: true
502
+ });
503
+ }
504
+ function assignProp(target, prop, value) {
505
+ Object.defineProperty(target, prop, {
506
+ value,
507
+ writable: true,
508
+ enumerable: true,
509
+ configurable: true
510
+ });
511
+ }
512
+ function getElementAtPath(obj, path) {
513
+ if (!path)
514
+ return obj;
515
+ return path.reduce((acc, key) => acc?.[key], obj);
516
+ }
517
+ function promiseAllObject(promisesObj) {
518
+ const keys = Object.keys(promisesObj);
519
+ const promises = keys.map((key) => promisesObj[key]);
520
+ return Promise.all(promises).then((results) => {
521
+ const resolvedObj = {};
522
+ for (let i = 0; i < keys.length; i++) {
523
+ resolvedObj[keys[i]] = results[i];
524
+ }
525
+ return resolvedObj;
526
+ });
527
+ }
528
+ function randomString(length = 10) {
529
+ const chars = "abcdefghijklmnopqrstuvwxyz";
530
+ let str = "";
531
+ for (let i = 0; i < length; i++) {
532
+ str += chars[Math.floor(Math.random() * chars.length)];
533
+ }
534
+ return str;
535
+ }
536
+ function esc(str) {
537
+ return JSON.stringify(str);
538
+ }
539
+ var captureStackTrace = Error.captureStackTrace ? Error.captureStackTrace : (..._args) => {
540
+ };
541
+ function isObject(data) {
542
+ return typeof data === "object" && data !== null && !Array.isArray(data);
543
+ }
544
+ var allowsEval = cached(() => {
545
+ if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) {
546
+ return false;
547
+ }
548
+ try {
549
+ const F = Function;
550
+ new F("");
551
+ return true;
552
+ } catch (_) {
553
+ return false;
554
+ }
555
+ });
556
+ function isPlainObject(o) {
557
+ if (isObject(o) === false)
558
+ return false;
559
+ const ctor = o.constructor;
560
+ if (ctor === void 0)
561
+ return true;
562
+ const prot = ctor.prototype;
563
+ if (isObject(prot) === false)
564
+ return false;
565
+ if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) {
566
+ return false;
567
+ }
568
+ return true;
569
+ }
570
+ function numKeys(data) {
571
+ let keyCount = 0;
572
+ for (const key in data) {
573
+ if (Object.prototype.hasOwnProperty.call(data, key)) {
574
+ keyCount++;
575
+ }
576
+ }
577
+ return keyCount;
578
+ }
579
+ var getParsedType = (data) => {
580
+ const t = typeof data;
581
+ switch (t) {
582
+ case "undefined":
583
+ return "undefined";
584
+ case "string":
585
+ return "string";
586
+ case "number":
587
+ return Number.isNaN(data) ? "nan" : "number";
588
+ case "boolean":
589
+ return "boolean";
590
+ case "function":
591
+ return "function";
592
+ case "bigint":
593
+ return "bigint";
594
+ case "symbol":
595
+ return "symbol";
596
+ case "object":
597
+ if (Array.isArray(data)) {
598
+ return "array";
599
+ }
600
+ if (data === null) {
601
+ return "null";
602
+ }
603
+ if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
604
+ return "promise";
605
+ }
606
+ if (typeof Map !== "undefined" && data instanceof Map) {
607
+ return "map";
608
+ }
609
+ if (typeof Set !== "undefined" && data instanceof Set) {
610
+ return "set";
611
+ }
612
+ if (typeof Date !== "undefined" && data instanceof Date) {
613
+ return "date";
614
+ }
615
+ if (typeof File !== "undefined" && data instanceof File) {
616
+ return "file";
617
+ }
618
+ return "object";
619
+ default:
620
+ throw new Error(`Unknown data type: ${t}`);
621
+ }
622
+ };
623
+ var propertyKeyTypes = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
624
+ var primitiveTypes = /* @__PURE__ */ new Set(["string", "number", "bigint", "boolean", "symbol", "undefined"]);
625
+ function escapeRegex(str) {
626
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
627
+ }
628
+ function clone(inst, def, params) {
629
+ const cl = new inst._zod.constr(def ?? inst._zod.def);
630
+ if (!def || params?.parent)
631
+ cl._zod.parent = inst;
632
+ return cl;
633
+ }
634
+ function normalizeParams(_params) {
635
+ const params = _params;
636
+ if (!params)
637
+ return {};
638
+ if (typeof params === "string")
639
+ return { error: () => params };
640
+ if (params?.message !== void 0) {
641
+ if (params?.error !== void 0)
642
+ throw new Error("Cannot specify both `message` and `error` params");
643
+ params.error = params.message;
644
+ }
645
+ delete params.message;
646
+ if (typeof params.error === "string")
647
+ return { ...params, error: () => params.error };
648
+ return params;
649
+ }
650
+ function createTransparentProxy(getter) {
651
+ let target;
652
+ return new Proxy({}, {
653
+ get(_, prop, receiver) {
654
+ target ?? (target = getter());
655
+ return Reflect.get(target, prop, receiver);
656
+ },
657
+ set(_, prop, value, receiver) {
658
+ target ?? (target = getter());
659
+ return Reflect.set(target, prop, value, receiver);
660
+ },
661
+ has(_, prop) {
662
+ target ?? (target = getter());
663
+ return Reflect.has(target, prop);
664
+ },
665
+ deleteProperty(_, prop) {
666
+ target ?? (target = getter());
667
+ return Reflect.deleteProperty(target, prop);
668
+ },
669
+ ownKeys(_) {
670
+ target ?? (target = getter());
671
+ return Reflect.ownKeys(target);
672
+ },
673
+ getOwnPropertyDescriptor(_, prop) {
674
+ target ?? (target = getter());
675
+ return Reflect.getOwnPropertyDescriptor(target, prop);
676
+ },
677
+ defineProperty(_, prop, descriptor) {
678
+ target ?? (target = getter());
679
+ return Reflect.defineProperty(target, prop, descriptor);
680
+ }
681
+ });
682
+ }
683
+ function stringifyPrimitive(value) {
684
+ if (typeof value === "bigint")
685
+ return value.toString() + "n";
686
+ if (typeof value === "string")
687
+ return `"${value}"`;
688
+ return `${value}`;
689
+ }
690
+ function optionalKeys(shape) {
691
+ return Object.keys(shape).filter((k) => {
692
+ return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
693
+ });
694
+ }
695
+ var NUMBER_FORMAT_RANGES = {
696
+ safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
697
+ int32: [-2147483648, 2147483647],
698
+ uint32: [0, 4294967295],
699
+ float32: [-34028234663852886e22, 34028234663852886e22],
700
+ float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
701
+ };
702
+ var BIGINT_FORMAT_RANGES = {
703
+ int64: [/* @__PURE__ */ BigInt("-9223372036854775808"), /* @__PURE__ */ BigInt("9223372036854775807")],
704
+ uint64: [/* @__PURE__ */ BigInt(0), /* @__PURE__ */ BigInt("18446744073709551615")]
705
+ };
706
+ function pick(schema, mask) {
707
+ const newShape = {};
708
+ const currDef = schema._zod.def;
709
+ for (const key in mask) {
710
+ if (!(key in currDef.shape)) {
711
+ throw new Error(`Unrecognized key: "${key}"`);
712
+ }
713
+ if (!mask[key])
714
+ continue;
715
+ newShape[key] = currDef.shape[key];
716
+ }
717
+ return clone(schema, {
718
+ ...schema._zod.def,
719
+ shape: newShape,
720
+ checks: []
721
+ });
722
+ }
723
+ function omit(schema, mask) {
724
+ const newShape = { ...schema._zod.def.shape };
725
+ const currDef = schema._zod.def;
726
+ for (const key in mask) {
727
+ if (!(key in currDef.shape)) {
728
+ throw new Error(`Unrecognized key: "${key}"`);
729
+ }
730
+ if (!mask[key])
731
+ continue;
732
+ delete newShape[key];
733
+ }
734
+ return clone(schema, {
735
+ ...schema._zod.def,
736
+ shape: newShape,
737
+ checks: []
738
+ });
739
+ }
740
+ function extend(schema, shape) {
741
+ if (!isPlainObject(shape)) {
742
+ throw new Error("Invalid input to extend: expected a plain object");
743
+ }
744
+ const def = {
745
+ ...schema._zod.def,
746
+ get shape() {
747
+ const _shape = { ...schema._zod.def.shape, ...shape };
748
+ assignProp(this, "shape", _shape);
749
+ return _shape;
750
+ },
751
+ checks: []
752
+ // delete existing checks
753
+ };
754
+ return clone(schema, def);
755
+ }
756
+ function merge(a, b) {
757
+ return clone(a, {
758
+ ...a._zod.def,
759
+ get shape() {
760
+ const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
761
+ assignProp(this, "shape", _shape);
762
+ return _shape;
763
+ },
764
+ catchall: b._zod.def.catchall,
765
+ checks: []
766
+ // delete existing checks
767
+ });
768
+ }
769
+ function partial(Class2, schema, mask) {
770
+ const oldShape = schema._zod.def.shape;
771
+ const shape = { ...oldShape };
772
+ if (mask) {
773
+ for (const key in mask) {
774
+ if (!(key in oldShape)) {
775
+ throw new Error(`Unrecognized key: "${key}"`);
776
+ }
777
+ if (!mask[key])
778
+ continue;
779
+ shape[key] = Class2 ? new Class2({
780
+ type: "optional",
781
+ innerType: oldShape[key]
782
+ }) : oldShape[key];
783
+ }
784
+ } else {
785
+ for (const key in oldShape) {
786
+ shape[key] = Class2 ? new Class2({
787
+ type: "optional",
788
+ innerType: oldShape[key]
789
+ }) : oldShape[key];
790
+ }
791
+ }
792
+ return clone(schema, {
793
+ ...schema._zod.def,
794
+ shape,
795
+ checks: []
796
+ });
797
+ }
798
+ function required(Class2, schema, mask) {
799
+ const oldShape = schema._zod.def.shape;
800
+ const shape = { ...oldShape };
801
+ if (mask) {
802
+ for (const key in mask) {
803
+ if (!(key in shape)) {
804
+ throw new Error(`Unrecognized key: "${key}"`);
805
+ }
806
+ if (!mask[key])
807
+ continue;
808
+ shape[key] = new Class2({
809
+ type: "nonoptional",
810
+ innerType: oldShape[key]
811
+ });
812
+ }
813
+ } else {
814
+ for (const key in oldShape) {
815
+ shape[key] = new Class2({
816
+ type: "nonoptional",
817
+ innerType: oldShape[key]
818
+ });
819
+ }
820
+ }
821
+ return clone(schema, {
822
+ ...schema._zod.def,
823
+ shape,
824
+ // optional: [],
825
+ checks: []
826
+ });
827
+ }
828
+ function aborted(x, startIndex = 0) {
829
+ for (let i = startIndex; i < x.issues.length; i++) {
830
+ if (x.issues[i]?.continue !== true)
831
+ return true;
832
+ }
833
+ return false;
834
+ }
835
+ function prefixIssues(path, issues) {
836
+ return issues.map((iss) => {
837
+ var _a;
838
+ (_a = iss).path ?? (_a.path = []);
839
+ iss.path.unshift(path);
840
+ return iss;
841
+ });
842
+ }
843
+ function unwrapMessage(message) {
844
+ return typeof message === "string" ? message : message?.message;
845
+ }
846
+ function finalizeIssue(iss, ctx, config2) {
847
+ const full = { ...iss, path: iss.path ?? [] };
848
+ if (!iss.message) {
849
+ const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input";
850
+ full.message = message;
851
+ }
852
+ delete full.inst;
853
+ delete full.continue;
854
+ if (!ctx?.reportInput) {
855
+ delete full.input;
856
+ }
857
+ return full;
858
+ }
859
+ function getSizableOrigin(input) {
860
+ if (input instanceof Set)
861
+ return "set";
862
+ if (input instanceof Map)
863
+ return "map";
864
+ if (input instanceof File)
865
+ return "file";
866
+ return "unknown";
867
+ }
868
+ function getLengthableOrigin(input) {
869
+ if (Array.isArray(input))
870
+ return "array";
871
+ if (typeof input === "string")
872
+ return "string";
873
+ return "unknown";
874
+ }
875
+ function issue(...args) {
876
+ const [iss, input, inst] = args;
877
+ if (typeof iss === "string") {
878
+ return {
879
+ message: iss,
880
+ code: "custom",
881
+ input,
882
+ inst
883
+ };
884
+ }
885
+ return { ...iss };
886
+ }
887
+ function cleanEnum(obj) {
888
+ return Object.entries(obj).filter(([k, _]) => {
889
+ return Number.isNaN(Number.parseInt(k, 10));
890
+ }).map((el) => el[1]);
891
+ }
892
+ var Class = class {
893
+ constructor(..._args) {
894
+ }
895
+ };
896
+
897
+ // ../../node_modules/.pnpm/zod@4.0.5/node_modules/zod/v4/core/errors.js
898
+ var initializer = (inst, def) => {
899
+ inst.name = "$ZodError";
900
+ Object.defineProperty(inst, "_zod", {
901
+ value: inst._zod,
902
+ enumerable: false
903
+ });
904
+ Object.defineProperty(inst, "issues", {
905
+ value: def,
906
+ enumerable: false
907
+ });
908
+ Object.defineProperty(inst, "message", {
909
+ get() {
910
+ return JSON.stringify(def, jsonStringifyReplacer, 2);
911
+ },
912
+ enumerable: true
913
+ // configurable: false,
914
+ });
915
+ Object.defineProperty(inst, "toString", {
916
+ value: () => inst.message,
917
+ enumerable: false
918
+ });
919
+ };
920
+ var $ZodError = $constructor("$ZodError", initializer);
921
+ var $ZodRealError = $constructor("$ZodError", initializer, { Parent: Error });
922
+
923
+ // ../../node_modules/.pnpm/zod@4.0.5/node_modules/zod/v4/core/parse.js
924
+ var _parse = (_Err) => (schema, value, _ctx, _params) => {
925
+ const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
926
+ const result = schema._zod.run({ value, issues: [] }, ctx);
927
+ if (result instanceof Promise) {
928
+ throw new $ZodAsyncError();
929
+ }
930
+ if (result.issues.length) {
931
+ const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
932
+ captureStackTrace(e, _params?.callee);
933
+ throw e;
934
+ }
935
+ return result.value;
936
+ };
937
+ var parse = /* @__PURE__ */ _parse($ZodRealError);
938
+ var _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
939
+ const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
940
+ let result = schema._zod.run({ value, issues: [] }, ctx);
941
+ if (result instanceof Promise)
942
+ result = await result;
943
+ if (result.issues.length) {
944
+ const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
945
+ captureStackTrace(e, params?.callee);
946
+ throw e;
947
+ }
948
+ return result.value;
949
+ };
950
+ var parseAsync = /* @__PURE__ */ _parseAsync($ZodRealError);
951
+ var _safeParse = (_Err) => (schema, value, _ctx) => {
952
+ const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
953
+ const result = schema._zod.run({ value, issues: [] }, ctx);
954
+ if (result instanceof Promise) {
955
+ throw new $ZodAsyncError();
956
+ }
957
+ return result.issues.length ? {
958
+ success: false,
959
+ error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
960
+ } : { success: true, data: result.value };
961
+ };
962
+ var safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
963
+ var _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
964
+ const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
965
+ let result = schema._zod.run({ value, issues: [] }, ctx);
966
+ if (result instanceof Promise)
967
+ result = await result;
968
+ return result.issues.length ? {
969
+ success: false,
970
+ error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
971
+ } : { success: true, data: result.value };
972
+ };
973
+ var safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
974
+
975
+ // ../../node_modules/.pnpm/zod@4.0.5/node_modules/zod/v4/core/regexes.js
976
+ var hostname = /^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;
977
+ var string = (params) => {
978
+ const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
979
+ return new RegExp(`^${regex}$`);
980
+ };
981
+ var boolean = /true|false/i;
982
+
983
+ // ../../node_modules/.pnpm/zod@4.0.5/node_modules/zod/v4/core/checks.js
984
+ var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
985
+ var _a;
986
+ inst._zod ?? (inst._zod = {});
987
+ inst._zod.def = def;
988
+ (_a = inst._zod).onattach ?? (_a.onattach = []);
989
+ });
990
+ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
991
+ var _a;
992
+ $ZodCheck.init(inst, def);
993
+ (_a = inst._zod.def).when ?? (_a.when = (payload) => {
994
+ const val = payload.value;
995
+ return !nullish(val) && val.length !== void 0;
996
+ });
997
+ inst._zod.onattach.push((inst2) => {
998
+ const bag = inst2._zod.bag;
999
+ bag.minimum = def.length;
1000
+ bag.maximum = def.length;
1001
+ bag.length = def.length;
1002
+ });
1003
+ inst._zod.check = (payload) => {
1004
+ const input = payload.value;
1005
+ const length = input.length;
1006
+ if (length === def.length)
1007
+ return;
1008
+ const origin = getLengthableOrigin(input);
1009
+ const tooBig = length > def.length;
1010
+ payload.issues.push({
1011
+ origin,
1012
+ ...tooBig ? { code: "too_big", maximum: def.length } : { code: "too_small", minimum: def.length },
1013
+ inclusive: true,
1014
+ exact: true,
1015
+ input: payload.value,
1016
+ inst,
1017
+ continue: !def.abort
1018
+ });
1019
+ };
1020
+ });
1021
+ var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
1022
+ var _a, _b;
1023
+ $ZodCheck.init(inst, def);
1024
+ inst._zod.onattach.push((inst2) => {
1025
+ const bag = inst2._zod.bag;
1026
+ bag.format = def.format;
1027
+ if (def.pattern) {
1028
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
1029
+ bag.patterns.add(def.pattern);
1030
+ }
1031
+ });
1032
+ if (def.pattern)
1033
+ (_a = inst._zod).check ?? (_a.check = (payload) => {
1034
+ def.pattern.lastIndex = 0;
1035
+ if (def.pattern.test(payload.value))
1036
+ return;
1037
+ payload.issues.push({
1038
+ origin: "string",
1039
+ code: "invalid_format",
1040
+ format: def.format,
1041
+ input: payload.value,
1042
+ ...def.pattern ? { pattern: def.pattern.toString() } : {},
1043
+ inst,
1044
+ continue: !def.abort
1045
+ });
1046
+ });
1047
+ else
1048
+ (_b = inst._zod).check ?? (_b.check = () => {
1049
+ });
1050
+ });
1051
+ var $ZodCheckRegex = /* @__PURE__ */ $constructor("$ZodCheckRegex", (inst, def) => {
1052
+ $ZodCheckStringFormat.init(inst, def);
1053
+ inst._zod.check = (payload) => {
1054
+ def.pattern.lastIndex = 0;
1055
+ if (def.pattern.test(payload.value))
1056
+ return;
1057
+ payload.issues.push({
1058
+ origin: "string",
1059
+ code: "invalid_format",
1060
+ format: "regex",
1061
+ input: payload.value,
1062
+ pattern: def.pattern.toString(),
1063
+ inst,
1064
+ continue: !def.abort
1065
+ });
1066
+ };
1067
+ });
1068
+ var $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (inst, def) => {
1069
+ $ZodCheck.init(inst, def);
1070
+ inst._zod.check = (payload) => {
1071
+ payload.value = def.tx(payload.value);
1072
+ };
1073
+ });
1074
+
1075
+ // ../../node_modules/.pnpm/zod@4.0.5/node_modules/zod/v4/core/doc.js
1076
+ var Doc = class {
1077
+ constructor(args = []) {
1078
+ this.content = [];
1079
+ this.indent = 0;
1080
+ if (this)
1081
+ this.args = args;
1082
+ }
1083
+ indented(fn) {
1084
+ this.indent += 1;
1085
+ fn(this);
1086
+ this.indent -= 1;
1087
+ }
1088
+ write(arg) {
1089
+ if (typeof arg === "function") {
1090
+ arg(this, { execution: "sync" });
1091
+ arg(this, { execution: "async" });
1092
+ return;
1093
+ }
1094
+ const content = arg;
1095
+ const lines = content.split("\n").filter((x) => x);
1096
+ const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));
1097
+ const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
1098
+ for (const line of dedented) {
1099
+ this.content.push(line);
1100
+ }
1101
+ }
1102
+ compile() {
1103
+ const F = Function;
1104
+ const args = this?.args;
1105
+ const content = this?.content ?? [``];
1106
+ const lines = [...content.map((x) => ` ${x}`)];
1107
+ return new F(...args, lines.join("\n"));
1108
+ }
1109
+ };
1110
+
1111
+ // ../../node_modules/.pnpm/zod@4.0.5/node_modules/zod/v4/core/versions.js
1112
+ var version = {
1113
+ major: 4,
1114
+ minor: 0,
1115
+ patch: 5
1116
+ };
1117
+
1118
+ // ../../node_modules/.pnpm/zod@4.0.5/node_modules/zod/v4/core/schemas.js
1119
+ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
1120
+ var _a;
1121
+ inst ?? (inst = {});
1122
+ inst._zod.def = def;
1123
+ inst._zod.bag = inst._zod.bag || {};
1124
+ inst._zod.version = version;
1125
+ const checks = [...inst._zod.def.checks ?? []];
1126
+ if (inst._zod.traits.has("$ZodCheck")) {
1127
+ checks.unshift(inst);
1128
+ }
1129
+ for (const ch of checks) {
1130
+ for (const fn of ch._zod.onattach) {
1131
+ fn(inst);
1132
+ }
1133
+ }
1134
+ if (checks.length === 0) {
1135
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
1136
+ inst._zod.deferred?.push(() => {
1137
+ inst._zod.run = inst._zod.parse;
1138
+ });
1139
+ } else {
1140
+ const runChecks = (payload, checks2, ctx) => {
1141
+ let isAborted = aborted(payload);
1142
+ let asyncResult;
1143
+ for (const ch of checks2) {
1144
+ if (ch._zod.def.when) {
1145
+ const shouldRun = ch._zod.def.when(payload);
1146
+ if (!shouldRun)
1147
+ continue;
1148
+ } else if (isAborted) {
1149
+ continue;
1150
+ }
1151
+ const currLen = payload.issues.length;
1152
+ const _ = ch._zod.check(payload);
1153
+ if (_ instanceof Promise && ctx?.async === false) {
1154
+ throw new $ZodAsyncError();
1155
+ }
1156
+ if (asyncResult || _ instanceof Promise) {
1157
+ asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
1158
+ await _;
1159
+ const nextLen = payload.issues.length;
1160
+ if (nextLen === currLen)
1161
+ return;
1162
+ if (!isAborted)
1163
+ isAborted = aborted(payload, currLen);
1164
+ });
1165
+ } else {
1166
+ const nextLen = payload.issues.length;
1167
+ if (nextLen === currLen)
1168
+ continue;
1169
+ if (!isAborted)
1170
+ isAborted = aborted(payload, currLen);
1171
+ }
1172
+ }
1173
+ if (asyncResult) {
1174
+ return asyncResult.then(() => {
1175
+ return payload;
1176
+ });
1177
+ }
1178
+ return payload;
1179
+ };
1180
+ inst._zod.run = (payload, ctx) => {
1181
+ const result = inst._zod.parse(payload, ctx);
1182
+ if (result instanceof Promise) {
1183
+ if (ctx.async === false)
1184
+ throw new $ZodAsyncError();
1185
+ return result.then((result2) => runChecks(result2, checks, ctx));
1186
+ }
1187
+ return runChecks(result, checks, ctx);
1188
+ };
1189
+ }
1190
+ inst["~standard"] = {
1191
+ validate: (value) => {
1192
+ try {
1193
+ const r = safeParse(inst, value);
1194
+ return r.success ? { value: r.data } : { issues: r.error?.issues };
1195
+ } catch (_) {
1196
+ return safeParseAsync(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
1197
+ }
1198
+ },
1199
+ vendor: "zod",
1200
+ version: 1
1201
+ };
1202
+ });
1203
+ var $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
1204
+ $ZodType.init(inst, def);
1205
+ inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string(inst._zod.bag);
1206
+ inst._zod.parse = (payload, _) => {
1207
+ if (def.coerce)
1208
+ try {
1209
+ payload.value = String(payload.value);
1210
+ } catch (_2) {
1211
+ }
1212
+ if (typeof payload.value === "string")
1213
+ return payload;
1214
+ payload.issues.push({
1215
+ expected: "string",
1216
+ code: "invalid_type",
1217
+ input: payload.value,
1218
+ inst
1219
+ });
1220
+ return payload;
1221
+ };
1222
+ });
1223
+ var $ZodStringFormat = /* @__PURE__ */ $constructor("$ZodStringFormat", (inst, def) => {
1224
+ $ZodCheckStringFormat.init(inst, def);
1225
+ $ZodString.init(inst, def);
1226
+ });
1227
+ var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
1228
+ $ZodStringFormat.init(inst, def);
1229
+ inst._zod.check = (payload) => {
1230
+ try {
1231
+ const orig = payload.value;
1232
+ const url2 = new URL(orig);
1233
+ const href = url2.href;
1234
+ if (def.hostname) {
1235
+ def.hostname.lastIndex = 0;
1236
+ if (!def.hostname.test(url2.hostname)) {
1237
+ payload.issues.push({
1238
+ code: "invalid_format",
1239
+ format: "url",
1240
+ note: "Invalid hostname",
1241
+ pattern: hostname.source,
1242
+ input: payload.value,
1243
+ inst,
1244
+ continue: !def.abort
1245
+ });
1246
+ }
1247
+ }
1248
+ if (def.protocol) {
1249
+ def.protocol.lastIndex = 0;
1250
+ if (!def.protocol.test(url2.protocol.endsWith(":") ? url2.protocol.slice(0, -1) : url2.protocol)) {
1251
+ payload.issues.push({
1252
+ code: "invalid_format",
1253
+ format: "url",
1254
+ note: "Invalid protocol",
1255
+ pattern: def.protocol.source,
1256
+ input: payload.value,
1257
+ inst,
1258
+ continue: !def.abort
1259
+ });
1260
+ }
1261
+ }
1262
+ if (!orig.endsWith("/") && href.endsWith("/")) {
1263
+ payload.value = href.slice(0, -1);
1264
+ } else {
1265
+ payload.value = href;
1266
+ }
1267
+ return;
1268
+ } catch (_) {
1269
+ payload.issues.push({
1270
+ code: "invalid_format",
1271
+ format: "url",
1272
+ input: payload.value,
1273
+ inst,
1274
+ continue: !def.abort
1275
+ });
1276
+ }
1277
+ };
1278
+ });
1279
+ var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
1280
+ $ZodType.init(inst, def);
1281
+ inst._zod.pattern = boolean;
1282
+ inst._zod.parse = (payload, _ctx) => {
1283
+ if (def.coerce)
1284
+ try {
1285
+ payload.value = Boolean(payload.value);
1286
+ } catch (_) {
1287
+ }
1288
+ const input = payload.value;
1289
+ if (typeof input === "boolean")
1290
+ return payload;
1291
+ payload.issues.push({
1292
+ expected: "boolean",
1293
+ code: "invalid_type",
1294
+ input,
1295
+ inst
1296
+ });
1297
+ return payload;
1298
+ };
1299
+ });
1300
+ var $ZodAny = /* @__PURE__ */ $constructor("$ZodAny", (inst, def) => {
1301
+ $ZodType.init(inst, def);
1302
+ inst._zod.parse = (payload) => payload;
1303
+ });
1304
+ function handleArrayResult(result, final, index) {
1305
+ if (result.issues.length) {
1306
+ final.issues.push(...prefixIssues(index, result.issues));
1307
+ }
1308
+ final.value[index] = result.value;
1309
+ }
1310
+ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
1311
+ $ZodType.init(inst, def);
1312
+ inst._zod.parse = (payload, ctx) => {
1313
+ const input = payload.value;
1314
+ if (!Array.isArray(input)) {
1315
+ payload.issues.push({
1316
+ expected: "array",
1317
+ code: "invalid_type",
1318
+ input,
1319
+ inst
1320
+ });
1321
+ return payload;
1322
+ }
1323
+ payload.value = Array(input.length);
1324
+ const proms = [];
1325
+ for (let i = 0; i < input.length; i++) {
1326
+ const item = input[i];
1327
+ const result = def.element._zod.run({
1328
+ value: item,
1329
+ issues: []
1330
+ }, ctx);
1331
+ if (result instanceof Promise) {
1332
+ proms.push(result.then((result2) => handleArrayResult(result2, payload, i)));
1333
+ } else {
1334
+ handleArrayResult(result, payload, i);
1335
+ }
1336
+ }
1337
+ if (proms.length) {
1338
+ return Promise.all(proms).then(() => payload);
1339
+ }
1340
+ return payload;
1341
+ };
1342
+ });
1343
+ function handleObjectResult(result, final, key) {
1344
+ if (result.issues.length) {
1345
+ final.issues.push(...prefixIssues(key, result.issues));
1346
+ }
1347
+ final.value[key] = result.value;
1348
+ }
1349
+ function handleOptionalObjectResult(result, final, key, input) {
1350
+ if (result.issues.length) {
1351
+ if (input[key] === void 0) {
1352
+ if (key in input) {
1353
+ final.value[key] = void 0;
1354
+ } else {
1355
+ final.value[key] = result.value;
1356
+ }
1357
+ } else {
1358
+ final.issues.push(...prefixIssues(key, result.issues));
1359
+ }
1360
+ } else if (result.value === void 0) {
1361
+ if (key in input)
1362
+ final.value[key] = void 0;
1363
+ } else {
1364
+ final.value[key] = result.value;
1365
+ }
1366
+ }
1367
+ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
1368
+ $ZodType.init(inst, def);
1369
+ const _normalized = cached(() => {
1370
+ const keys = Object.keys(def.shape);
1371
+ for (const k of keys) {
1372
+ if (!(def.shape[k] instanceof $ZodType)) {
1373
+ throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
1374
+ }
1375
+ }
1376
+ const okeys = optionalKeys(def.shape);
1377
+ return {
1378
+ shape: def.shape,
1379
+ keys,
1380
+ keySet: new Set(keys),
1381
+ numKeys: keys.length,
1382
+ optionalKeys: new Set(okeys)
1383
+ };
1384
+ });
1385
+ defineLazy(inst._zod, "propValues", () => {
1386
+ const shape = def.shape;
1387
+ const propValues = {};
1388
+ for (const key in shape) {
1389
+ const field = shape[key]._zod;
1390
+ if (field.values) {
1391
+ propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
1392
+ for (const v of field.values)
1393
+ propValues[key].add(v);
1394
+ }
1395
+ }
1396
+ return propValues;
1397
+ });
1398
+ const generateFastpass = (shape) => {
1399
+ const doc = new Doc(["shape", "payload", "ctx"]);
1400
+ const normalized = _normalized.value;
1401
+ const parseStr = (key) => {
1402
+ const k = esc(key);
1403
+ return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
1404
+ };
1405
+ doc.write(`const input = payload.value;`);
1406
+ const ids = /* @__PURE__ */ Object.create(null);
1407
+ let counter = 0;
1408
+ for (const key of normalized.keys) {
1409
+ ids[key] = `key_${counter++}`;
1410
+ }
1411
+ doc.write(`const newResult = {}`);
1412
+ for (const key of normalized.keys) {
1413
+ if (normalized.optionalKeys.has(key)) {
1414
+ const id = ids[key];
1415
+ doc.write(`const ${id} = ${parseStr(key)};`);
1416
+ const k = esc(key);
1417
+ doc.write(`
1418
+ if (${id}.issues.length) {
1419
+ if (input[${k}] === undefined) {
1420
+ if (${k} in input) {
1421
+ newResult[${k}] = undefined;
1422
+ }
1423
+ } else {
1424
+ payload.issues = payload.issues.concat(
1425
+ ${id}.issues.map((iss) => ({
1426
+ ...iss,
1427
+ path: iss.path ? [${k}, ...iss.path] : [${k}],
1428
+ }))
1429
+ );
1430
+ }
1431
+ } else if (${id}.value === undefined) {
1432
+ if (${k} in input) newResult[${k}] = undefined;
1433
+ } else {
1434
+ newResult[${k}] = ${id}.value;
1435
+ }
1436
+ `);
1437
+ } else {
1438
+ const id = ids[key];
1439
+ doc.write(`const ${id} = ${parseStr(key)};`);
1440
+ doc.write(`
1441
+ if (${id}.issues.length) payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1442
+ ...iss,
1443
+ path: iss.path ? [${esc(key)}, ...iss.path] : [${esc(key)}]
1444
+ })));`);
1445
+ doc.write(`newResult[${esc(key)}] = ${id}.value`);
1446
+ }
1447
+ }
1448
+ doc.write(`payload.value = newResult;`);
1449
+ doc.write(`return payload;`);
1450
+ const fn = doc.compile();
1451
+ return (payload, ctx) => fn(shape, payload, ctx);
1452
+ };
1453
+ let fastpass;
1454
+ const isObject2 = isObject;
1455
+ const jit = !globalConfig.jitless;
1456
+ const allowsEval2 = allowsEval;
1457
+ const fastEnabled = jit && allowsEval2.value;
1458
+ const catchall = def.catchall;
1459
+ let value;
1460
+ inst._zod.parse = (payload, ctx) => {
1461
+ value ?? (value = _normalized.value);
1462
+ const input = payload.value;
1463
+ if (!isObject2(input)) {
1464
+ payload.issues.push({
1465
+ expected: "object",
1466
+ code: "invalid_type",
1467
+ input,
1468
+ inst
1469
+ });
1470
+ return payload;
1471
+ }
1472
+ const proms = [];
1473
+ if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
1474
+ if (!fastpass)
1475
+ fastpass = generateFastpass(def.shape);
1476
+ payload = fastpass(payload, ctx);
1477
+ } else {
1478
+ payload.value = {};
1479
+ const shape = value.shape;
1480
+ for (const key of value.keys) {
1481
+ const el = shape[key];
1482
+ const r = el._zod.run({ value: input[key], issues: [] }, ctx);
1483
+ const isOptional = el._zod.optin === "optional" && el._zod.optout === "optional";
1484
+ if (r instanceof Promise) {
1485
+ proms.push(r.then((r2) => isOptional ? handleOptionalObjectResult(r2, payload, key, input) : handleObjectResult(r2, payload, key)));
1486
+ } else if (isOptional) {
1487
+ handleOptionalObjectResult(r, payload, key, input);
1488
+ } else {
1489
+ handleObjectResult(r, payload, key);
1490
+ }
1491
+ }
1492
+ }
1493
+ if (!catchall) {
1494
+ return proms.length ? Promise.all(proms).then(() => payload) : payload;
1495
+ }
1496
+ const unrecognized = [];
1497
+ const keySet = value.keySet;
1498
+ const _catchall = catchall._zod;
1499
+ const t = _catchall.def.type;
1500
+ for (const key of Object.keys(input)) {
1501
+ if (keySet.has(key))
1502
+ continue;
1503
+ if (t === "never") {
1504
+ unrecognized.push(key);
1505
+ continue;
1506
+ }
1507
+ const r = _catchall.run({ value: input[key], issues: [] }, ctx);
1508
+ if (r instanceof Promise) {
1509
+ proms.push(r.then((r2) => handleObjectResult(r2, payload, key)));
1510
+ } else {
1511
+ handleObjectResult(r, payload, key);
1512
+ }
1513
+ }
1514
+ if (unrecognized.length) {
1515
+ payload.issues.push({
1516
+ code: "unrecognized_keys",
1517
+ keys: unrecognized,
1518
+ input,
1519
+ inst
1520
+ });
1521
+ }
1522
+ if (!proms.length)
1523
+ return payload;
1524
+ return Promise.all(proms).then(() => {
1525
+ return payload;
1526
+ });
1527
+ };
1528
+ });
1529
+ function handleUnionResults(results, final, inst, ctx) {
1530
+ for (const result of results) {
1531
+ if (result.issues.length === 0) {
1532
+ final.value = result.value;
1533
+ return final;
1534
+ }
1535
+ }
1536
+ final.issues.push({
1537
+ code: "invalid_union",
1538
+ input: final.value,
1539
+ inst,
1540
+ errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
1541
+ });
1542
+ return final;
1543
+ }
1544
+ var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
1545
+ $ZodType.init(inst, def);
1546
+ defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0);
1547
+ defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
1548
+ defineLazy(inst._zod, "values", () => {
1549
+ if (def.options.every((o) => o._zod.values)) {
1550
+ return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
1551
+ }
1552
+ return void 0;
1553
+ });
1554
+ defineLazy(inst._zod, "pattern", () => {
1555
+ if (def.options.every((o) => o._zod.pattern)) {
1556
+ const patterns = def.options.map((o) => o._zod.pattern);
1557
+ return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
1558
+ }
1559
+ return void 0;
1560
+ });
1561
+ inst._zod.parse = (payload, ctx) => {
1562
+ let async = false;
1563
+ const results = [];
1564
+ for (const option of def.options) {
1565
+ const result = option._zod.run({
1566
+ value: payload.value,
1567
+ issues: []
1568
+ }, ctx);
1569
+ if (result instanceof Promise) {
1570
+ results.push(result);
1571
+ async = true;
1572
+ } else {
1573
+ if (result.issues.length === 0)
1574
+ return result;
1575
+ results.push(result);
1576
+ }
1577
+ }
1578
+ if (!async)
1579
+ return handleUnionResults(results, payload, inst, ctx);
1580
+ return Promise.all(results).then((results2) => {
1581
+ return handleUnionResults(results2, payload, inst, ctx);
1582
+ });
1583
+ };
1584
+ });
1585
+ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
1586
+ $ZodType.init(inst, def);
1587
+ inst._zod.parse = (payload, ctx) => {
1588
+ const input = payload.value;
1589
+ if (!isPlainObject(input)) {
1590
+ payload.issues.push({
1591
+ expected: "record",
1592
+ code: "invalid_type",
1593
+ input,
1594
+ inst
1595
+ });
1596
+ return payload;
1597
+ }
1598
+ const proms = [];
1599
+ if (def.keyType._zod.values) {
1600
+ const values = def.keyType._zod.values;
1601
+ payload.value = {};
1602
+ for (const key of values) {
1603
+ if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
1604
+ const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
1605
+ if (result instanceof Promise) {
1606
+ proms.push(result.then((result2) => {
1607
+ if (result2.issues.length) {
1608
+ payload.issues.push(...prefixIssues(key, result2.issues));
1609
+ }
1610
+ payload.value[key] = result2.value;
1611
+ }));
1612
+ } else {
1613
+ if (result.issues.length) {
1614
+ payload.issues.push(...prefixIssues(key, result.issues));
1615
+ }
1616
+ payload.value[key] = result.value;
1617
+ }
1618
+ }
1619
+ }
1620
+ let unrecognized;
1621
+ for (const key in input) {
1622
+ if (!values.has(key)) {
1623
+ unrecognized = unrecognized ?? [];
1624
+ unrecognized.push(key);
1625
+ }
1626
+ }
1627
+ if (unrecognized && unrecognized.length > 0) {
1628
+ payload.issues.push({
1629
+ code: "unrecognized_keys",
1630
+ input,
1631
+ inst,
1632
+ keys: unrecognized
1633
+ });
1634
+ }
1635
+ } else {
1636
+ payload.value = {};
1637
+ for (const key of Reflect.ownKeys(input)) {
1638
+ if (key === "__proto__")
1639
+ continue;
1640
+ const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
1641
+ if (keyResult instanceof Promise) {
1642
+ throw new Error("Async schemas not supported in object keys currently");
1643
+ }
1644
+ if (keyResult.issues.length) {
1645
+ payload.issues.push({
1646
+ origin: "record",
1647
+ code: "invalid_key",
1648
+ issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
1649
+ input: key,
1650
+ path: [key],
1651
+ inst
1652
+ });
1653
+ payload.value[keyResult.value] = keyResult.value;
1654
+ continue;
1655
+ }
1656
+ const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
1657
+ if (result instanceof Promise) {
1658
+ proms.push(result.then((result2) => {
1659
+ if (result2.issues.length) {
1660
+ payload.issues.push(...prefixIssues(key, result2.issues));
1661
+ }
1662
+ payload.value[keyResult.value] = result2.value;
1663
+ }));
1664
+ } else {
1665
+ if (result.issues.length) {
1666
+ payload.issues.push(...prefixIssues(key, result.issues));
1667
+ }
1668
+ payload.value[keyResult.value] = result.value;
1669
+ }
1670
+ }
1671
+ }
1672
+ if (proms.length) {
1673
+ return Promise.all(proms).then(() => payload);
1674
+ }
1675
+ return payload;
1676
+ };
1677
+ });
1678
+ var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
1679
+ $ZodType.init(inst, def);
1680
+ const values = getEnumValues(def.entries);
1681
+ inst._zod.values = new Set(values);
1682
+ inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
1683
+ inst._zod.parse = (payload, _ctx) => {
1684
+ const input = payload.value;
1685
+ if (inst._zod.values.has(input)) {
1686
+ return payload;
1687
+ }
1688
+ payload.issues.push({
1689
+ code: "invalid_value",
1690
+ values,
1691
+ input,
1692
+ inst
1693
+ });
1694
+ return payload;
1695
+ };
1696
+ });
1697
+ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
1698
+ $ZodType.init(inst, def);
1699
+ inst._zod.values = new Set(def.values);
1700
+ inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? o.toString() : String(o)).join("|")})$`);
1701
+ inst._zod.parse = (payload, _ctx) => {
1702
+ const input = payload.value;
1703
+ if (inst._zod.values.has(input)) {
1704
+ return payload;
1705
+ }
1706
+ payload.issues.push({
1707
+ code: "invalid_value",
1708
+ values: def.values,
1709
+ input,
1710
+ inst
1711
+ });
1712
+ return payload;
1713
+ };
1714
+ });
1715
+ var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
1716
+ $ZodType.init(inst, def);
1717
+ inst._zod.optin = "optional";
1718
+ inst._zod.optout = "optional";
1719
+ defineLazy(inst._zod, "values", () => {
1720
+ return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, void 0]) : void 0;
1721
+ });
1722
+ defineLazy(inst._zod, "pattern", () => {
1723
+ const pattern = def.innerType._zod.pattern;
1724
+ return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
1725
+ });
1726
+ inst._zod.parse = (payload, ctx) => {
1727
+ if (def.innerType._zod.optin === "optional") {
1728
+ return def.innerType._zod.run(payload, ctx);
1729
+ }
1730
+ if (payload.value === void 0) {
1731
+ return payload;
1732
+ }
1733
+ return def.innerType._zod.run(payload, ctx);
1734
+ };
1735
+ });
1736
+ var $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
1737
+ $ZodType.init(inst, def);
1738
+ defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
1739
+ defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1740
+ defineLazy(inst._zod, "pattern", () => {
1741
+ const pattern = def.innerType._zod.pattern;
1742
+ return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
1743
+ });
1744
+ defineLazy(inst._zod, "values", () => {
1745
+ return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, null]) : void 0;
1746
+ });
1747
+ inst._zod.parse = (payload, ctx) => {
1748
+ if (payload.value === null)
1749
+ return payload;
1750
+ return def.innerType._zod.run(payload, ctx);
1751
+ };
1752
+ });
1753
+ var $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => {
1754
+ $ZodType.init(inst, def);
1755
+ inst._zod.optin = "optional";
1756
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1757
+ inst._zod.parse = (payload, ctx) => {
1758
+ if (payload.value === void 0) {
1759
+ payload.value = def.defaultValue;
1760
+ return payload;
1761
+ }
1762
+ const result = def.innerType._zod.run(payload, ctx);
1763
+ if (result instanceof Promise) {
1764
+ return result.then((result2) => handleDefaultResult(result2, def));
1765
+ }
1766
+ return handleDefaultResult(result, def);
1767
+ };
1768
+ });
1769
+ function handleDefaultResult(payload, def) {
1770
+ if (payload.value === void 0) {
1771
+ payload.value = def.defaultValue;
1772
+ }
1773
+ return payload;
1774
+ }
1775
+ var $ZodRegistry = class {
1776
+ constructor() {
1777
+ this._map = /* @__PURE__ */ new Map();
1778
+ this._idmap = /* @__PURE__ */ new Map();
1779
+ }
1780
+ add(schema, ..._meta) {
1781
+ const meta = _meta[0];
1782
+ this._map.set(schema, meta);
1783
+ if (meta && typeof meta === "object" && "id" in meta) {
1784
+ if (this._idmap.has(meta.id)) {
1785
+ throw new Error(`ID ${meta.id} already exists in the registry`);
1786
+ }
1787
+ this._idmap.set(meta.id, schema);
1788
+ }
1789
+ return this;
1790
+ }
1791
+ clear() {
1792
+ this._map = /* @__PURE__ */ new Map();
1793
+ this._idmap = /* @__PURE__ */ new Map();
1794
+ return this;
1795
+ }
1796
+ remove(schema) {
1797
+ const meta = this._map.get(schema);
1798
+ if (meta && typeof meta === "object" && "id" in meta) {
1799
+ this._idmap.delete(meta.id);
1800
+ }
1801
+ this._map.delete(schema);
1802
+ return this;
1803
+ }
1804
+ get(schema) {
1805
+ const p = schema._zod.parent;
1806
+ if (p) {
1807
+ const pm = { ...this.get(p) ?? {} };
1808
+ delete pm.id;
1809
+ return { ...pm, ...this._map.get(schema) };
1810
+ }
1811
+ return this._map.get(schema);
1812
+ }
1813
+ has(schema) {
1814
+ return this._map.has(schema);
1815
+ }
1816
+ };
1817
+ function registry() {
1818
+ return new $ZodRegistry();
1819
+ }
1820
+
1821
+ // ../../node_modules/.pnpm/zod@4.0.5/node_modules/zod/v4/core/api.js
1822
+ function _string(Class2, params) {
1823
+ return new Class2({
1824
+ type: "string",
1825
+ ...normalizeParams(params)
1826
+ });
1827
+ }
1828
+ function _url(Class2, params) {
1829
+ return new Class2({
1830
+ type: "string",
1831
+ format: "url",
1832
+ check: "string_format",
1833
+ abort: false,
1834
+ ...normalizeParams(params)
1835
+ });
1836
+ }
1837
+ function _boolean(Class2, params) {
1838
+ return new Class2({
1839
+ type: "boolean",
1840
+ ...normalizeParams(params)
1841
+ });
1842
+ }
1843
+ function _any(Class2) {
1844
+ return new Class2({
1845
+ type: "any"
1846
+ });
1847
+ }
1848
+ function _length(length, params) {
1849
+ return new $ZodCheckLengthEquals({
1850
+ check: "length_equals",
1851
+ ...normalizeParams(params),
1852
+ length
1853
+ });
1854
+ }
1855
+ function _regex(pattern, params) {
1856
+ return new $ZodCheckRegex({
1857
+ check: "string_format",
1858
+ format: "regex",
1859
+ ...normalizeParams(params),
1860
+ pattern
1861
+ });
1862
+ }
1863
+ function _overwrite(tx) {
1864
+ return new $ZodCheckOverwrite({
1865
+ check: "overwrite",
1866
+ tx
1867
+ });
1868
+ }
1869
+ function _trim() {
1870
+ return _overwrite((input) => input.trim());
1871
+ }
1872
+ function _toLowerCase() {
1873
+ return _overwrite((input) => input.toLowerCase());
1874
+ }
1875
+
1876
+ // ../../node_modules/.pnpm/zod@4.0.5/node_modules/zod/v4/mini/schemas.js
1877
+ var ZodMiniType = /* @__PURE__ */ $constructor("ZodMiniType", (inst, def) => {
1878
+ if (!inst._zod)
1879
+ throw new Error("Uninitialized schema in ZodMiniType.");
1880
+ $ZodType.init(inst, def);
1881
+ inst.def = def;
1882
+ inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
1883
+ inst.safeParse = (data, params) => safeParse(inst, data, params);
1884
+ inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
1885
+ inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
1886
+ inst.check = (...checks) => {
1887
+ return inst.clone(
1888
+ {
1889
+ ...def,
1890
+ checks: [
1891
+ ...def.checks ?? [],
1892
+ ...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
1893
+ ]
1894
+ }
1895
+ // { parent: true }
1896
+ );
1897
+ };
1898
+ inst.clone = (_def, params) => clone(inst, _def, params);
1899
+ inst.brand = () => inst;
1900
+ inst.register = (reg, meta) => {
1901
+ reg.add(inst, meta);
1902
+ return inst;
1903
+ };
1904
+ });
1905
+ var ZodMiniString = /* @__PURE__ */ $constructor("ZodMiniString", (inst, def) => {
1906
+ $ZodString.init(inst, def);
1907
+ ZodMiniType.init(inst, def);
1908
+ });
1909
+ function string2(params) {
1910
+ return _string(ZodMiniString, params);
1911
+ }
1912
+ var ZodMiniStringFormat = /* @__PURE__ */ $constructor("ZodMiniStringFormat", (inst, def) => {
1913
+ $ZodStringFormat.init(inst, def);
1914
+ ZodMiniString.init(inst, def);
1915
+ });
1916
+ var ZodMiniURL = /* @__PURE__ */ $constructor("ZodMiniURL", (inst, def) => {
1917
+ $ZodURL.init(inst, def);
1918
+ ZodMiniStringFormat.init(inst, def);
1919
+ });
1920
+ function url(params) {
1921
+ return _url(ZodMiniURL, params);
1922
+ }
1923
+ var ZodMiniBoolean = /* @__PURE__ */ $constructor("ZodMiniBoolean", (inst, def) => {
1924
+ $ZodBoolean.init(inst, def);
1925
+ ZodMiniType.init(inst, def);
1926
+ });
1927
+ function boolean2(params) {
1928
+ return _boolean(ZodMiniBoolean, params);
1929
+ }
1930
+ var ZodMiniAny = /* @__PURE__ */ $constructor("ZodMiniAny", (inst, def) => {
1931
+ $ZodAny.init(inst, def);
1932
+ ZodMiniType.init(inst, def);
1933
+ });
1934
+ function any() {
1935
+ return _any(ZodMiniAny);
1936
+ }
1937
+ var ZodMiniArray = /* @__PURE__ */ $constructor("ZodMiniArray", (inst, def) => {
1938
+ $ZodArray.init(inst, def);
1939
+ ZodMiniType.init(inst, def);
1940
+ });
1941
+ function array(element, params) {
1942
+ return new ZodMiniArray({
1943
+ type: "array",
1944
+ element,
1945
+ ...util_exports.normalizeParams(params)
1946
+ });
1947
+ }
1948
+ var ZodMiniObject = /* @__PURE__ */ $constructor("ZodMiniObject", (inst, def) => {
1949
+ $ZodObject.init(inst, def);
1950
+ ZodMiniType.init(inst, def);
1951
+ util_exports.defineLazy(inst, "shape", () => def.shape);
1952
+ });
1953
+ function object(shape, params) {
1954
+ const def = {
1955
+ type: "object",
1956
+ get shape() {
1957
+ util_exports.assignProp(this, "shape", { ...shape });
1958
+ return this.shape;
1959
+ },
1960
+ ...util_exports.normalizeParams(params)
1961
+ };
1962
+ return new ZodMiniObject(def);
1963
+ }
1964
+ var ZodMiniUnion = /* @__PURE__ */ $constructor("ZodMiniUnion", (inst, def) => {
1965
+ $ZodUnion.init(inst, def);
1966
+ ZodMiniType.init(inst, def);
1967
+ });
1968
+ function union(options, params) {
1969
+ return new ZodMiniUnion({
1970
+ type: "union",
1971
+ options,
1972
+ ...util_exports.normalizeParams(params)
1973
+ });
1974
+ }
1975
+ var ZodMiniRecord = /* @__PURE__ */ $constructor("ZodMiniRecord", (inst, def) => {
1976
+ $ZodRecord.init(inst, def);
1977
+ ZodMiniType.init(inst, def);
1978
+ });
1979
+ function record(keyType, valueType, params) {
1980
+ return new ZodMiniRecord({
1981
+ type: "record",
1982
+ keyType,
1983
+ valueType,
1984
+ ...util_exports.normalizeParams(params)
1985
+ });
1986
+ }
1987
+ var ZodMiniEnum = /* @__PURE__ */ $constructor("ZodMiniEnum", (inst, def) => {
1988
+ $ZodEnum.init(inst, def);
1989
+ ZodMiniType.init(inst, def);
1990
+ });
1991
+ function _enum(values, params) {
1992
+ const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
1993
+ return new ZodMiniEnum({
1994
+ type: "enum",
1995
+ entries,
1996
+ ...util_exports.normalizeParams(params)
1997
+ });
1998
+ }
1999
+ var ZodMiniLiteral = /* @__PURE__ */ $constructor("ZodMiniLiteral", (inst, def) => {
2000
+ $ZodLiteral.init(inst, def);
2001
+ ZodMiniType.init(inst, def);
2002
+ });
2003
+ function literal(value, params) {
2004
+ return new ZodMiniLiteral({
2005
+ type: "literal",
2006
+ values: Array.isArray(value) ? value : [value],
2007
+ ...util_exports.normalizeParams(params)
2008
+ });
2009
+ }
2010
+ var ZodMiniOptional = /* @__PURE__ */ $constructor("ZodMiniOptional", (inst, def) => {
2011
+ $ZodOptional.init(inst, def);
2012
+ ZodMiniType.init(inst, def);
2013
+ });
2014
+ function optional(innerType) {
2015
+ return new ZodMiniOptional({
2016
+ type: "optional",
2017
+ innerType
2018
+ });
2019
+ }
2020
+ var ZodMiniNullable = /* @__PURE__ */ $constructor("ZodMiniNullable", (inst, def) => {
2021
+ $ZodNullable.init(inst, def);
2022
+ ZodMiniType.init(inst, def);
2023
+ });
2024
+ function nullable(innerType) {
2025
+ return new ZodMiniNullable({
2026
+ type: "nullable",
2027
+ innerType
2028
+ });
2029
+ }
2030
+ var ZodMiniDefault = /* @__PURE__ */ $constructor("ZodMiniDefault", (inst, def) => {
2031
+ $ZodDefault.init(inst, def);
2032
+ ZodMiniType.init(inst, def);
2033
+ });
2034
+ function _default(innerType, defaultValue) {
2035
+ return new ZodMiniDefault({
2036
+ type: "default",
2037
+ innerType,
2038
+ get defaultValue() {
2039
+ return typeof defaultValue === "function" ? defaultValue() : defaultValue;
2040
+ }
2041
+ });
2042
+ }
2043
+
2044
+ // ../config/src/constants.ts
2045
+ var STORM_DEFAULT_DOCS = "https://docs.stormsoftware.com";
2046
+ var STORM_DEFAULT_HOMEPAGE = "https://stormsoftware.com";
2047
+ var STORM_DEFAULT_LICENSING = "https://stormsoftware.com/license";
2048
+ var STORM_DEFAULT_LICENSE = "Apache-2.0";
2049
+ var STORM_DEFAULT_ERROR_CODES_FILE = "tools/errors/codes.json";
2050
+ var STORM_DEFAULT_BANNER_ALT = "The workspace's banner image";
2051
+
2052
+ // ../config/src/schema.ts
2053
+ var schemaRegistry = registry();
2054
+ var colorSchema = string2().check(
2055
+ _length(7),
2056
+ _toLowerCase(),
2057
+ _regex(/^#([0-9a-f]{3}){1,2}$/i),
2058
+ _trim()
2059
+ );
2060
+ schemaRegistry.add(colorSchema, {
2061
+ description: "A base schema for describing the format of colors"
2062
+ });
2063
+ var darkColorSchema = _default(colorSchema, "#151718");
2064
+ schemaRegistry.add(darkColorSchema, {
2065
+ description: "The dark background color of the workspace"
2066
+ });
2067
+ var lightColorSchema = _default(colorSchema, "#cbd5e1");
2068
+ schemaRegistry.add(lightColorSchema, {
2069
+ description: "The light background color of the workspace"
2070
+ });
2071
+ var brandColorSchema = _default(colorSchema, "#1fb2a6");
2072
+ schemaRegistry.add(brandColorSchema, {
2073
+ description: "The primary brand specific color of the workspace"
2074
+ });
2075
+ var alternateColorSchema = optional(colorSchema);
2076
+ schemaRegistry.add(alternateColorSchema, {
2077
+ description: "The alternate brand specific color of the workspace"
2078
+ });
2079
+ var accentColorSchema = optional(colorSchema);
2080
+ schemaRegistry.add(accentColorSchema, {
2081
+ description: "The secondary brand specific color of the workspace"
2082
+ });
2083
+ var linkColorSchema = _default(colorSchema, "#3fa6ff");
2084
+ schemaRegistry.add(linkColorSchema, {
2085
+ description: "The color used to display hyperlink text"
2086
+ });
2087
+ var helpColorSchema = _default(colorSchema, "#818cf8");
2088
+ schemaRegistry.add(helpColorSchema, {
2089
+ description: "The second brand specific color of the workspace"
2090
+ });
2091
+ var successColorSchema = _default(colorSchema, "#45b27e");
2092
+ schemaRegistry.add(successColorSchema, {
2093
+ description: "The success color of the workspace"
2094
+ });
2095
+ var infoColorSchema = _default(colorSchema, "#38bdf8");
2096
+ schemaRegistry.add(infoColorSchema, {
2097
+ description: "The informational color of the workspace"
2098
+ });
2099
+ var warningColorSchema = _default(colorSchema, "#f3d371");
2100
+ schemaRegistry.add(warningColorSchema, {
2101
+ description: "The warning color of the workspace"
2102
+ });
2103
+ var dangerColorSchema = _default(colorSchema, "#d8314a");
2104
+ schemaRegistry.add(dangerColorSchema, {
2105
+ description: "The danger color of the workspace"
2106
+ });
2107
+ var fatalColorSchema = optional(colorSchema);
2108
+ schemaRegistry.add(fatalColorSchema, {
2109
+ description: "The fatal color of the workspace"
2110
+ });
2111
+ var positiveColorSchema = _default(colorSchema, "#4ade80");
2112
+ schemaRegistry.add(positiveColorSchema, {
2113
+ description: "The positive number color of the workspace"
2114
+ });
2115
+ var negativeColorSchema = _default(colorSchema, "#ef4444");
2116
+ schemaRegistry.add(negativeColorSchema, {
2117
+ description: "The negative number color of the workspace"
2118
+ });
2119
+ var gradientStopsSchema = optional(array(colorSchema));
2120
+ schemaRegistry.add(gradientStopsSchema, {
2121
+ description: "The color stops for the base gradient color pattern used in the workspace"
2122
+ });
2123
+ var darkColorsSchema = object({
2124
+ foreground: lightColorSchema,
2125
+ background: darkColorSchema,
2126
+ brand: brandColorSchema,
2127
+ alternate: alternateColorSchema,
2128
+ accent: accentColorSchema,
2129
+ link: linkColorSchema,
2130
+ help: helpColorSchema,
2131
+ success: successColorSchema,
2132
+ info: infoColorSchema,
2133
+ warning: warningColorSchema,
2134
+ danger: dangerColorSchema,
2135
+ fatal: fatalColorSchema,
2136
+ positive: positiveColorSchema,
2137
+ negative: negativeColorSchema,
2138
+ gradient: gradientStopsSchema
2139
+ });
2140
+ var lightColorsSchema = object({
2141
+ foreground: darkColorSchema,
2142
+ background: lightColorSchema,
2143
+ brand: brandColorSchema,
2144
+ alternate: alternateColorSchema,
2145
+ accent: accentColorSchema,
2146
+ link: linkColorSchema,
2147
+ help: helpColorSchema,
2148
+ success: successColorSchema,
2149
+ info: infoColorSchema,
2150
+ warning: warningColorSchema,
2151
+ danger: dangerColorSchema,
2152
+ fatal: fatalColorSchema,
2153
+ positive: positiveColorSchema,
2154
+ negative: negativeColorSchema,
2155
+ gradient: gradientStopsSchema
2156
+ });
2157
+ var multiColorsSchema = object({
2158
+ dark: darkColorsSchema,
2159
+ light: lightColorsSchema
2160
+ });
2161
+ var singleColorsSchema = object({
2162
+ dark: darkColorSchema,
2163
+ light: lightColorSchema,
2164
+ brand: brandColorSchema,
2165
+ alternate: alternateColorSchema,
2166
+ accent: accentColorSchema,
2167
+ link: linkColorSchema,
2168
+ help: helpColorSchema,
2169
+ success: successColorSchema,
2170
+ info: infoColorSchema,
2171
+ warning: warningColorSchema,
2172
+ danger: dangerColorSchema,
2173
+ fatal: fatalColorSchema,
2174
+ positive: positiveColorSchema,
2175
+ negative: negativeColorSchema,
2176
+ gradient: gradientStopsSchema
2177
+ });
2178
+ var registryUrlConfigSchema = optional(url());
2179
+ schemaRegistry.add(registryUrlConfigSchema, {
2180
+ description: "A remote registry URL used to publish distributable packages"
2181
+ });
2182
+ var registrySchema = _default(
2183
+ object({
2184
+ github: registryUrlConfigSchema,
2185
+ npm: registryUrlConfigSchema,
2186
+ cargo: registryUrlConfigSchema,
2187
+ cyclone: registryUrlConfigSchema,
2188
+ container: registryUrlConfigSchema
2189
+ }),
2190
+ {}
2191
+ );
2192
+ schemaRegistry.add(registrySchema, {
2193
+ description: "A list of remote registry URLs used by Storm Software"
2194
+ });
2195
+ var colorsSchema = union([singleColorsSchema, multiColorsSchema]);
2196
+ schemaRegistry.add(colorsSchema, {
2197
+ description: "Colors used for various workspace elements"
2198
+ });
2199
+ var themeColorsSchema = record(
2200
+ union([union([literal("base"), string2()]), string2()]),
2201
+ colorsSchema
2202
+ );
2203
+ schemaRegistry.add(themeColorsSchema, {
2204
+ description: "Storm theme config values used for styling various package elements"
2205
+ });
2206
+ var extendsSchema = optional(
2207
+ union([string2().check(_trim()), array(string2().check(_trim()))])
2208
+ );
2209
+ schemaRegistry.add(extendsSchema, {
2210
+ description: "The path to a base config file to use as a configuration preset file. Documentation can be found at https://github.com/unjs/c12#extending-configuration."
2211
+ });
2212
+ var workspaceBotNameSchema = string2().check(_trim());
2213
+ schemaRegistry.add(workspaceBotNameSchema, {
2214
+ description: "The workspace bot user's name (this is the bot that will be used to perform various tasks)"
2215
+ });
2216
+ var workspaceBotEmailSchema = string2().check(_trim());
2217
+ schemaRegistry.add(workspaceBotEmailSchema, {
2218
+ description: "The email of the workspace bot"
2219
+ });
2220
+ var workspaceBotSchema = object({
2221
+ name: workspaceBotNameSchema,
2222
+ email: workspaceBotEmailSchema
2223
+ });
2224
+ schemaRegistry.add(workspaceBotSchema, {
2225
+ description: "The workspace's bot user's config used to automated various operations tasks"
2226
+ });
2227
+ var workspaceReleaseBannerUrlSchema = optional(
2228
+ string2().check(_trim(), url())
2229
+ );
2230
+ schemaRegistry.add(workspaceReleaseBannerUrlSchema, {
2231
+ description: "A URL to a banner image used to display the workspace's release"
2232
+ });
2233
+ var workspaceReleaseBannerAltSchema = _default(
2234
+ string2().check(_trim()),
2235
+ STORM_DEFAULT_BANNER_ALT
2236
+ );
2237
+ schemaRegistry.add(workspaceReleaseBannerAltSchema, {
2238
+ description: "The alt text for the workspace's release banner image"
2239
+ });
2240
+ var workspaceReleaseBannerSchema = object({
2241
+ url: workspaceReleaseBannerUrlSchema,
2242
+ alt: workspaceReleaseBannerAltSchema
2243
+ });
2244
+ schemaRegistry.add(workspaceReleaseBannerSchema, {
2245
+ description: "The workspace's banner image used during the release process"
2246
+ });
2247
+ var workspaceReleaseHeaderSchema = optional(
2248
+ string2().check(_trim())
2249
+ );
2250
+ schemaRegistry.add(workspaceReleaseHeaderSchema, {
2251
+ description: "A header message appended to the start of the workspace's release notes"
2252
+ });
2253
+ var workspaceReleaseFooterSchema = optional(
2254
+ string2().check(_trim())
2255
+ );
2256
+ schemaRegistry.add(workspaceReleaseFooterSchema, {
2257
+ description: "A footer message appended to the end of the workspace's release notes"
2258
+ });
2259
+ var workspaceReleaseSchema = object({
2260
+ banner: union([
2261
+ workspaceReleaseBannerSchema,
2262
+ string2().check(_trim(), url())
2263
+ ]),
2264
+ header: workspaceReleaseHeaderSchema,
2265
+ footer: workspaceReleaseFooterSchema
2266
+ });
2267
+ schemaRegistry.add(workspaceReleaseSchema, {
2268
+ description: "The workspace's release config used during the release process"
2269
+ });
2270
+ var workspaceSocialsTwitterSchema = optional(
2271
+ string2().check(_trim())
2272
+ );
2273
+ schemaRegistry.add(workspaceSocialsTwitterSchema, {
2274
+ description: "A Twitter/X account associated with the organization/project"
2275
+ });
2276
+ var workspaceSocialsDiscordSchema = optional(
2277
+ string2().check(_trim())
2278
+ );
2279
+ schemaRegistry.add(workspaceSocialsDiscordSchema, {
2280
+ description: "A Discord account associated with the organization/project"
2281
+ });
2282
+ var workspaceSocialsTelegramSchema = optional(
2283
+ string2().check(_trim())
2284
+ );
2285
+ schemaRegistry.add(workspaceSocialsTelegramSchema, {
2286
+ description: "A Telegram account associated with the organization/project"
2287
+ });
2288
+ var workspaceSocialsSlackSchema = optional(
2289
+ string2().check(_trim())
2290
+ );
2291
+ schemaRegistry.add(workspaceSocialsSlackSchema, {
2292
+ description: "A Slack account associated with the organization/project"
2293
+ });
2294
+ var workspaceSocialsMediumSchema = optional(
2295
+ string2().check(_trim())
2296
+ );
2297
+ schemaRegistry.add(workspaceSocialsMediumSchema, {
2298
+ description: "A Medium account associated with the organization/project"
2299
+ });
2300
+ var workspaceSocialsGithubSchema = optional(
2301
+ string2().check(_trim())
2302
+ );
2303
+ schemaRegistry.add(workspaceSocialsGithubSchema, {
2304
+ description: "A GitHub account associated with the organization/project"
2305
+ });
2306
+ var workspaceSocialsSchema = object({
2307
+ twitter: workspaceSocialsTwitterSchema,
2308
+ discord: workspaceSocialsDiscordSchema,
2309
+ telegram: workspaceSocialsTelegramSchema,
2310
+ slack: workspaceSocialsSlackSchema,
2311
+ medium: workspaceSocialsMediumSchema,
2312
+ github: workspaceSocialsGithubSchema
2313
+ });
2314
+ schemaRegistry.add(workspaceSocialsSchema, {
2315
+ description: "The workspace's account config used to store various social media links"
2316
+ });
2317
+ var workspaceDirectoryCacheSchema = optional(
2318
+ string2().check(_trim())
2319
+ );
2320
+ schemaRegistry.add(workspaceDirectoryCacheSchema, {
2321
+ description: "The directory used to store the environment's cached file data"
2322
+ });
2323
+ var workspaceDirectoryDataSchema = optional(
2324
+ string2().check(_trim())
2325
+ );
2326
+ schemaRegistry.add(workspaceDirectoryDataSchema, {
2327
+ description: "The directory used to store the environment's data files"
2328
+ });
2329
+ var workspaceDirectoryConfigSchema = optional(
2330
+ string2().check(_trim())
2331
+ );
2332
+ schemaRegistry.add(workspaceDirectoryConfigSchema, {
2333
+ description: "The directory used to store the environment's configuration files"
2334
+ });
2335
+ var workspaceDirectoryTempSchema = optional(
2336
+ string2().check(_trim())
2337
+ );
2338
+ schemaRegistry.add(workspaceDirectoryTempSchema, {
2339
+ description: "The directory used to store the environment's temp files"
2340
+ });
2341
+ var workspaceDirectoryLogSchema = optional(
2342
+ string2().check(_trim())
2343
+ );
2344
+ schemaRegistry.add(workspaceDirectoryLogSchema, {
2345
+ description: "The directory used to store the environment's log files"
2346
+ });
2347
+ var workspaceDirectoryBuildSchema = _default(
2348
+ string2().check(_trim()),
2349
+ "dist"
2350
+ );
2351
+ schemaRegistry.add(workspaceDirectoryBuildSchema, {
2352
+ description: "The directory used to store the workspace's distributable files after a build (relative to the workspace root)"
2353
+ });
2354
+ var workspaceDirectorySchema = object({
2355
+ cache: workspaceDirectoryCacheSchema,
2356
+ data: workspaceDirectoryDataSchema,
2357
+ config: workspaceDirectoryConfigSchema,
2358
+ temp: workspaceDirectoryTempSchema,
2359
+ log: workspaceDirectoryLogSchema,
2360
+ build: workspaceDirectoryBuildSchema
2361
+ });
2362
+ schemaRegistry.add(workspaceDirectorySchema, {
2363
+ description: "Various directories used by the workspace to store data, cache, and configuration files"
2364
+ });
2365
+ var errorCodesFileSchema = _default(
2366
+ string2().check(_trim()),
2367
+ STORM_DEFAULT_ERROR_CODES_FILE
2368
+ );
2369
+ schemaRegistry.add(errorCodesFileSchema, {
2370
+ description: "The path to the workspace's error codes JSON file"
2371
+ });
2372
+ var errorUrlSchema = optional(url());
2373
+ schemaRegistry.add(errorUrlSchema, {
2374
+ description: "A URL to a page that looks up the workspace's error messages given a specific error code"
2375
+ });
2376
+ var errorSchema = object({
2377
+ codesFile: errorCodesFileSchema,
2378
+ url: errorUrlSchema
2379
+ });
2380
+ schemaRegistry.add(errorSchema, {
2381
+ description: "The workspace's error config used when creating error details during a system error"
2382
+ });
2383
+ var organizationNameSchema = optional(
2384
+ string2().check(_trim(), _toLowerCase())
2385
+ );
2386
+ schemaRegistry.add(organizationNameSchema, {
2387
+ description: "The name of the organization"
2388
+ });
2389
+ var organizationDescriptionSchema = optional(
2390
+ string2().check(_trim())
2391
+ );
2392
+ schemaRegistry.add(organizationDescriptionSchema, {
2393
+ description: "A description of the organization"
2394
+ });
2395
+ var organizationLogoSchema = optional(url());
2396
+ schemaRegistry.add(organizationLogoSchema, {
2397
+ description: "A URL to the organization's logo image"
2398
+ });
2399
+ var organizationIconSchema = optional(url());
2400
+ schemaRegistry.add(organizationIconSchema, {
2401
+ description: "A URL to the organization's icon image"
2402
+ });
2403
+ var organizationUrlSchema = optional(url());
2404
+ schemaRegistry.add(organizationUrlSchema, {
2405
+ description: "A URL to a page that provides more information about the organization"
2406
+ });
2407
+ var organizationSchema = object({
2408
+ name: organizationNameSchema,
2409
+ description: organizationDescriptionSchema,
2410
+ logo: organizationLogoSchema,
2411
+ icon: organizationIconSchema,
2412
+ url: organizationUrlSchema
2413
+ });
2414
+ schemaRegistry.add(organizationSchema, {
2415
+ description: "The workspace's organization details"
2416
+ });
2417
+ var schemaNameSchema = _default(
2418
+ string2().check(_trim(), _toLowerCase()),
2419
+ "https://public.storm-cdn.com/schemas/storm-workspace.schema.json"
2420
+ );
2421
+ schemaRegistry.add(schemaNameSchema, {
2422
+ description: "The URL or file path to the JSON schema file that describes the Storm configuration file"
2423
+ });
2424
+ var nameSchema = string2().check(_trim(), _toLowerCase());
2425
+ schemaRegistry.add(nameSchema, {
2426
+ description: "The name of the workspace/project/service/package/scope using this configuration"
2427
+ });
2428
+ var namespaceSchema = string2().check(_trim(), _toLowerCase());
2429
+ schemaRegistry.add(namespaceSchema, {
2430
+ description: "The namespace of the workspace/project/service/package/scope using this configuration"
2431
+ });
2432
+ var orgSchema = union([
2433
+ organizationSchema,
2434
+ string2().check(_trim(), _toLowerCase())
2435
+ ]);
2436
+ schemaRegistry.add(orgSchema, {
2437
+ description: "The organization of the workspace. This can be a string or an object containing the organization's details"
2438
+ });
2439
+ var repositorySchema = string2().check(_trim(), _toLowerCase());
2440
+ schemaRegistry.add(repositorySchema, {
2441
+ description: "The repo URL of the workspace (i.e. the GitHub repository URL)"
2442
+ });
2443
+ var licenseSchema = _default(
2444
+ string2().check(_trim()),
2445
+ "Apache-2.0"
2446
+ );
2447
+ schemaRegistry.add(licenseSchema, {
2448
+ description: "The license type of the package"
2449
+ });
2450
+ var homepageSchema = optional(url());
2451
+ schemaRegistry.add(homepageSchema, {
2452
+ description: "The homepage of the workspace"
2453
+ });
2454
+ var docsSchema = optional(url());
2455
+ schemaRegistry.add(docsSchema, {
2456
+ description: "The documentation site for the workspace"
2457
+ });
2458
+ var portalSchema = optional(url());
2459
+ schemaRegistry.add(portalSchema, {
2460
+ description: "The development portal site for the workspace"
2461
+ });
2462
+ var licensingSchema = optional(url());
2463
+ schemaRegistry.add(licensingSchema, {
2464
+ description: "The licensing site for the workspace"
2465
+ });
2466
+ var contactSchema = optional(url());
2467
+ schemaRegistry.add(contactSchema, {
2468
+ description: "The contact site for the workspace"
2469
+ });
2470
+ var supportSchema = optional(url());
2471
+ schemaRegistry.add(supportSchema, {
2472
+ description: "The support site for the workspace. If not provided, this is defaulted to the `contact` config value"
2473
+ });
2474
+ var branchSchema = _default(
2475
+ string2().check(_trim(), _toLowerCase()),
2476
+ "main"
2477
+ );
2478
+ schemaRegistry.add(branchSchema, {
2479
+ description: "The branch of the workspace"
2480
+ });
2481
+ var preidSchema = optional(
2482
+ string2().check(_trim(), _toLowerCase())
2483
+ );
2484
+ schemaRegistry.add(preidSchema, {
2485
+ description: "A tag specifying the version pre-release identifier"
2486
+ });
2487
+ var ownerSchema = optional(
2488
+ string2().check(_trim(), _toLowerCase())
2489
+ );
2490
+ schemaRegistry.add(ownerSchema, {
2491
+ description: "The owner of the package"
2492
+ });
2493
+ var modeSchema = _default(
2494
+ _enum(["development", "staging", "production"]).check(_trim(), _toLowerCase()),
2495
+ "production"
2496
+ );
2497
+ schemaRegistry.add(modeSchema, {
2498
+ description: "The current runtime environment mode for the package"
2499
+ });
2500
+ var workspaceRootSchema = string2().check(_trim(), _toLowerCase());
2501
+ schemaRegistry.add(workspaceRootSchema, {
2502
+ description: "The root directory of the workspace"
2503
+ });
2504
+ var skipCacheSchema = _default(boolean2(), false);
2505
+ schemaRegistry.add(skipCacheSchema, {
2506
+ description: "Should all known types of workspace caching be skipped?"
2507
+ });
2508
+ var packageManagerSchema = _default(
2509
+ _enum(["npm", "yarn", "pnpm", "bun"]),
2510
+ "npm"
2511
+ );
2512
+ schemaRegistry.add(packageManagerSchema, {
2513
+ description: "The JavaScript/TypeScript package manager used by the repository"
2514
+ });
2515
+ var timezoneSchema = _default(
2516
+ string2().check(_trim(), _toLowerCase()),
2517
+ "America/New_York"
2518
+ );
2519
+ schemaRegistry.add(timezoneSchema, {
2520
+ description: "The default timezone of the workspace"
2521
+ });
2522
+ var localeSchema = _default(
2523
+ string2().check(_trim(), _toLowerCase()),
2524
+ "en-US"
2525
+ );
2526
+ schemaRegistry.add(localeSchema, {
2527
+ description: "The default locale of the workspace"
2528
+ });
2529
+ var logLevelSchema = _default(
2530
+ _enum([
2531
+ "silent",
2532
+ "fatal",
2533
+ "error",
2534
+ "warn",
2535
+ "success",
2536
+ "info",
2537
+ "debug",
2538
+ "trace",
2539
+ "all"
2540
+ ]),
2541
+ "info"
2542
+ );
2543
+ schemaRegistry.add(logLevelSchema, {
2544
+ description: "The log level used to filter out lower priority log messages. If not provided, this is defaulted using the `environment` config value (if `environment` is set to `production` then `level` is `error`, else `level` is `debug`)."
2545
+ });
2546
+ var skipConfigLoggingSchema = _default(boolean2(), true);
2547
+ schemaRegistry.add(skipConfigLoggingSchema, {
2548
+ description: "Should the logging of the current Storm Workspace configuration be skipped?"
2549
+ });
2550
+ var configFileSchema = _default(
2551
+ nullable(string2().check(_trim())),
2552
+ null
2553
+ );
2554
+ schemaRegistry.add(configFileSchema, {
2555
+ description: "The filepath of the Storm config. When this field is null, no config file was found in the current workspace."
2556
+ });
2557
+ var extensionsSchema = _default(record(string2(), any()), {});
2558
+ schemaRegistry.add(extensionsSchema, {
2559
+ description: "Configuration of each used extension"
2560
+ });
2561
+ var workspaceConfigSchema = object({
2562
+ $schema: schemaNameSchema,
2563
+ extends: extendsSchema,
2564
+ name: nameSchema,
2565
+ namespace: namespaceSchema,
2566
+ organization: orgSchema,
2567
+ repository: repositorySchema,
2568
+ license: licenseSchema,
2569
+ homepage: homepageSchema,
2570
+ docs: docsSchema,
2571
+ portal: portalSchema,
2572
+ licensing: licensingSchema,
2573
+ contact: contactSchema,
2574
+ support: supportSchema,
2575
+ branch: branchSchema,
2576
+ preid: preidSchema,
2577
+ owner: ownerSchema,
2578
+ bot: workspaceBotSchema,
2579
+ release: workspaceReleaseSchema,
2580
+ socials: workspaceSocialsSchema,
2581
+ error: errorSchema,
2582
+ mode: modeSchema,
2583
+ workspaceRoot: workspaceRootSchema,
2584
+ skipCache: skipCacheSchema,
2585
+ directories: workspaceDirectorySchema,
2586
+ packageManager: packageManagerSchema,
2587
+ timezone: timezoneSchema,
2588
+ locale: localeSchema,
2589
+ logLevel: logLevelSchema,
2590
+ skipConfigLogging: skipConfigLoggingSchema,
2591
+ registry: registrySchema,
2592
+ configFile: configFileSchema,
2593
+ colors: union([colorsSchema, themeColorsSchema]),
2594
+ extensions: extensionsSchema
2595
+ });
2596
+ schemaRegistry.add(extensionsSchema, {
2597
+ description: "Storm Workspace config values used during various dev-ops processes. This type is a combination of the StormPackageConfig and StormProject types. It represents the config of the entire monorepo."
2598
+ });
2599
+
2600
+ // ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
2601
+ function isPlainObject2(value) {
2602
+ if (value === null || typeof value !== "object") {
2603
+ return false;
2604
+ }
2605
+ const prototype = Object.getPrototypeOf(value);
2606
+ if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
2607
+ return false;
2608
+ }
2609
+ if (Symbol.iterator in value) {
2610
+ return false;
2611
+ }
2612
+ if (Symbol.toStringTag in value) {
2613
+ return Object.prototype.toString.call(value) === "[object Module]";
2614
+ }
2615
+ return true;
2616
+ }
2617
+ function _defu(baseObject, defaults, namespace = ".", merger) {
2618
+ if (!isPlainObject2(defaults)) {
2619
+ return _defu(baseObject, {}, namespace, merger);
2620
+ }
2621
+ const object2 = Object.assign({}, defaults);
2622
+ for (const key in baseObject) {
2623
+ if (key === "__proto__" || key === "constructor") {
2624
+ continue;
2625
+ }
2626
+ const value = baseObject[key];
2627
+ if (value === null || value === void 0) {
2628
+ continue;
2629
+ }
2630
+ if (merger && merger(object2, key, value, namespace)) {
2631
+ continue;
2632
+ }
2633
+ if (Array.isArray(value) && Array.isArray(object2[key])) {
2634
+ object2[key] = [...value, ...object2[key]];
2635
+ } else if (isPlainObject2(value) && isPlainObject2(object2[key])) {
2636
+ object2[key] = _defu(
2637
+ value,
2638
+ object2[key],
2639
+ (namespace ? `${namespace}.` : "") + key.toString(),
2640
+ merger
2641
+ );
2642
+ } else {
2643
+ object2[key] = value;
2644
+ }
2645
+ }
2646
+ return object2;
2647
+ }
2648
+ function createDefu(merger) {
2649
+ return (...arguments_) => (
2650
+ // eslint-disable-next-line unicorn/no-array-reduce
2651
+ arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
2652
+ );
2653
+ }
2654
+ var defu = createDefu();
2655
+
2656
+ // ../config-tools/src/utilities/correct-paths.ts
2657
+ var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
2658
+ function normalizeWindowsPath(input = "") {
2659
+ if (!input) {
2660
+ return input;
2661
+ }
2662
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
2663
+ }
2664
+ var _UNC_REGEX = /^[/\\]{2}/;
2665
+ var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
2666
+ var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
2667
+ var correctPaths = function(path) {
2668
+ if (!path || path.length === 0) {
2669
+ return ".";
2670
+ }
2671
+ path = normalizeWindowsPath(path);
2672
+ const isUNCPath = path.match(_UNC_REGEX);
2673
+ const isPathAbsolute = isAbsolute(path);
2674
+ const trailingSeparator = path[path.length - 1] === "/";
2675
+ path = normalizeString(path, !isPathAbsolute);
2676
+ if (path.length === 0) {
2677
+ if (isPathAbsolute) {
2678
+ return "/";
2679
+ }
2680
+ return trailingSeparator ? "./" : ".";
2681
+ }
2682
+ if (trailingSeparator) {
2683
+ path += "/";
2684
+ }
2685
+ if (_DRIVE_LETTER_RE.test(path)) {
2686
+ path += "/";
2687
+ }
2688
+ if (isUNCPath) {
2689
+ if (!isPathAbsolute) {
2690
+ return `//./${path}`;
2691
+ }
2692
+ return `//${path}`;
2693
+ }
2694
+ return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
2695
+ };
2696
+ var joinPaths = function(...segments) {
2697
+ let path = "";
2698
+ for (const seg of segments) {
2699
+ if (!seg) {
2700
+ continue;
2701
+ }
2702
+ if (path.length > 0) {
2703
+ const pathTrailing = path[path.length - 1] === "/";
2704
+ const segLeading = seg[0] === "/";
2705
+ const both = pathTrailing && segLeading;
2706
+ if (both) {
2707
+ path += seg.slice(1);
2708
+ } else {
2709
+ path += pathTrailing || segLeading ? seg : `/${seg}`;
2710
+ }
2711
+ } else {
2712
+ path += seg;
2713
+ }
2714
+ }
2715
+ return correctPaths(path);
2716
+ };
2717
+ function normalizeString(path, allowAboveRoot) {
2718
+ let res = "";
2719
+ let lastSegmentLength = 0;
2720
+ let lastSlash = -1;
2721
+ let dots = 0;
2722
+ let char = null;
2723
+ for (let index = 0; index <= path.length; ++index) {
2724
+ if (index < path.length) {
2725
+ char = path[index];
2726
+ } else if (char === "/") {
2727
+ break;
2728
+ } else {
2729
+ char = "/";
2730
+ }
2731
+ if (char === "/") {
2732
+ if (lastSlash === index - 1 || dots === 1) ; else if (dots === 2) {
2733
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
2734
+ if (res.length > 2) {
2735
+ const lastSlashIndex = res.lastIndexOf("/");
2736
+ if (lastSlashIndex === -1) {
2737
+ res = "";
2738
+ lastSegmentLength = 0;
2739
+ } else {
2740
+ res = res.slice(0, lastSlashIndex);
2741
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
2742
+ }
2743
+ lastSlash = index;
2744
+ dots = 0;
2745
+ continue;
2746
+ } else if (res.length > 0) {
2747
+ res = "";
2748
+ lastSegmentLength = 0;
2749
+ lastSlash = index;
2750
+ dots = 0;
2751
+ continue;
2752
+ }
2753
+ }
2754
+ if (allowAboveRoot) {
2755
+ res += res.length > 0 ? "/.." : "..";
2756
+ lastSegmentLength = 2;
2757
+ }
2758
+ } else {
2759
+ if (res.length > 0) {
2760
+ res += `/${path.slice(lastSlash + 1, index)}`;
2761
+ } else {
2762
+ res = path.slice(lastSlash + 1, index);
2763
+ }
2764
+ lastSegmentLength = index - lastSlash - 1;
2765
+ }
2766
+ lastSlash = index;
2767
+ dots = 0;
2768
+ } else if (char === "." && dots !== -1) {
2769
+ ++dots;
2770
+ } else {
2771
+ dots = -1;
2772
+ }
2773
+ }
2774
+ return res;
2775
+ }
2776
+ var isAbsolute = function(p) {
2777
+ return _IS_ABSOLUTE_RE.test(p);
2778
+ };
2779
+ var MAX_PATH_SEARCH_DEPTH = 30;
2780
+ var depth = 0;
2781
+ function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
2782
+ const _startPath = startPath ?? process.cwd();
2783
+ if (endDirectoryNames.some(
2784
+ (endDirName) => fs.existsSync(path.join(_startPath, endDirName))
2785
+ )) {
2786
+ return _startPath;
2787
+ }
2788
+ if (endFileNames.some(
2789
+ (endFileName) => fs.existsSync(path.join(_startPath, endFileName))
2790
+ )) {
2791
+ return _startPath;
2792
+ }
2793
+ if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
2794
+ const parent = path.join(_startPath, "..");
2795
+ return findFolderUp(parent, endFileNames, endDirectoryNames);
2796
+ }
2797
+ return void 0;
2798
+ }
2799
+
2800
+ // ../config-tools/src/utilities/find-workspace-root.ts
2801
+ var rootFiles = [
2802
+ "storm-workspace.json",
2803
+ "storm-workspace.yaml",
2804
+ "storm-workspace.yml",
2805
+ "storm-workspace.js",
2806
+ "storm-workspace.ts",
2807
+ ".storm-workspace.json",
2808
+ ".storm-workspace.yaml",
2809
+ ".storm-workspace.yml",
2810
+ ".storm-workspace.js",
2811
+ ".storm-workspace.ts",
2812
+ "lerna.json",
2813
+ "nx.json",
2814
+ "turbo.json",
2815
+ "npm-workspace.json",
2816
+ "yarn-workspace.json",
2817
+ "pnpm-workspace.json",
2818
+ "npm-workspace.yaml",
2819
+ "yarn-workspace.yaml",
2820
+ "pnpm-workspace.yaml",
2821
+ "npm-workspace.yml",
2822
+ "yarn-workspace.yml",
2823
+ "pnpm-workspace.yml",
2824
+ "npm-lock.json",
2825
+ "yarn-lock.json",
2826
+ "pnpm-lock.json",
2827
+ "npm-lock.yaml",
2828
+ "yarn-lock.yaml",
2829
+ "pnpm-lock.yaml",
2830
+ "npm-lock.yml",
2831
+ "yarn-lock.yml",
2832
+ "pnpm-lock.yml",
2833
+ "bun.lockb"
2834
+ ];
2835
+ var rootDirectories = [
2836
+ ".storm-workspace",
2837
+ ".nx",
2838
+ ".github",
2839
+ ".vscode",
2840
+ ".verdaccio"
2841
+ ];
2842
+ function findWorkspaceRootSafe(pathInsideMonorepo) {
2843
+ if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
2844
+ return correctPaths(
2845
+ process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH
2846
+ );
2847
+ }
2848
+ return correctPaths(
2849
+ findFolderUp(
2850
+ pathInsideMonorepo ?? process.cwd(),
2851
+ rootFiles,
2852
+ rootDirectories
2853
+ )
2854
+ );
2855
+ }
2856
+ function findWorkspaceRoot(pathInsideMonorepo) {
2857
+ const result = findWorkspaceRootSafe(pathInsideMonorepo);
2858
+ if (!result) {
2859
+ throw new Error(
2860
+ `Cannot find workspace root upwards from known path. Files search list includes:
2861
+ ${rootFiles.join(
2862
+ "\n"
2863
+ )}
2864
+ Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
2865
+ );
2866
+ }
2867
+ return result;
2868
+ }
2869
+
2870
+ // ../config/src/types.ts
2871
+ var COLOR_KEYS = [
2872
+ "dark",
2873
+ "light",
2874
+ "base",
2875
+ "brand",
2876
+ "alternate",
2877
+ "accent",
2878
+ "link",
2879
+ "success",
2880
+ "help",
2881
+ "info",
2882
+ "warning",
2883
+ "danger",
2884
+ "fatal",
2885
+ "positive",
2886
+ "negative"
2887
+ ];
2888
+ async function getPackageJsonConfig(root) {
2889
+ let license = STORM_DEFAULT_LICENSE;
2890
+ let homepage = void 0;
2891
+ let support = void 0;
2892
+ let name = void 0;
2893
+ let namespace = void 0;
2894
+ let repository = void 0;
2895
+ const workspaceRoot = findWorkspaceRoot(root);
2896
+ if (fs.existsSync(path.join(workspaceRoot, "package.json"))) {
2897
+ const file = await promises.readFile(
2898
+ joinPaths(workspaceRoot, "package.json"),
2899
+ "utf8"
2900
+ );
2901
+ if (file) {
2902
+ const packageJson = JSON.parse(file);
2903
+ if (packageJson.name) {
2904
+ name = packageJson.name;
2905
+ }
2906
+ if (packageJson.namespace) {
2907
+ namespace = packageJson.namespace;
2908
+ }
2909
+ if (packageJson.repository) {
2910
+ if (typeof packageJson.repository === "string") {
2911
+ repository = packageJson.repository;
2912
+ } else if (packageJson.repository.url) {
2913
+ repository = packageJson.repository.url;
2914
+ }
2915
+ }
2916
+ if (packageJson.license) {
2917
+ license = packageJson.license;
2918
+ }
2919
+ if (packageJson.homepage) {
2920
+ homepage = packageJson.homepage;
2921
+ }
2922
+ if (packageJson.bugs) {
2923
+ if (typeof packageJson.bugs === "string") {
2924
+ support = packageJson.bugs;
2925
+ } else if (packageJson.bugs.url) {
2926
+ support = packageJson.bugs.url;
2927
+ }
2928
+ }
2929
+ }
2930
+ }
2931
+ return {
2932
+ workspaceRoot,
2933
+ name,
2934
+ namespace,
2935
+ repository,
2936
+ license,
2937
+ homepage,
2938
+ support
2939
+ };
2940
+ }
2941
+ function applyDefaultConfig(config2) {
2942
+ if (!config2.support && config2.contact) {
2943
+ config2.support = config2.contact;
2944
+ }
2945
+ if (!config2.contact && config2.support) {
2946
+ config2.contact = config2.support;
2947
+ }
2948
+ if (config2.homepage) {
2949
+ if (!config2.docs) {
2950
+ config2.docs = `${config2.homepage}/docs`;
2951
+ }
2952
+ if (!config2.license) {
2953
+ config2.license = `${config2.homepage}/license`;
2954
+ }
2955
+ if (!config2.support) {
2956
+ config2.support = `${config2.homepage}/support`;
2957
+ }
2958
+ if (!config2.contact) {
2959
+ config2.contact = `${config2.homepage}/contact`;
2960
+ }
2961
+ if (!config2.error?.codesFile || !config2?.error?.url) {
2962
+ config2.error ??= { codesFile: STORM_DEFAULT_ERROR_CODES_FILE };
2963
+ if (config2.homepage) {
2964
+ config2.error.url ??= `${config2.homepage}/errors`;
2965
+ }
2966
+ }
2967
+ }
2968
+ return config2;
2969
+ }
2970
+
2971
+ // ../config-tools/src/config-file/get-config-file.ts
2972
+ var getConfigFileByName = async (fileName, filePath, options = {}) => {
2973
+ const workspacePath = filePath || findWorkspaceRoot(filePath);
2974
+ const configs = await Promise.all([
2975
+ c12.loadConfig({
2976
+ cwd: workspacePath,
2977
+ packageJson: true,
2978
+ name: fileName,
2979
+ envName: fileName?.toUpperCase(),
2980
+ jitiOptions: {
2981
+ debug: false,
2982
+ fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
2983
+ process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
2984
+ "jiti"
2985
+ )
2986
+ },
2987
+ ...options
2988
+ }),
2989
+ c12.loadConfig({
2990
+ cwd: workspacePath,
2991
+ packageJson: true,
2992
+ name: fileName,
2993
+ envName: fileName?.toUpperCase(),
2994
+ jitiOptions: {
2995
+ debug: false,
2996
+ fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
2997
+ process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
2998
+ "jiti"
2999
+ )
3000
+ },
3001
+ configFile: fileName,
3002
+ ...options
3003
+ })
3004
+ ]);
3005
+ return defu(configs[0] ?? {}, configs[1] ?? {});
3006
+ };
3007
+ var getConfigFile = async (filePath, additionalFileNames = []) => {
3008
+ const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
3009
+ const result = await getConfigFileByName("storm-workspace", workspacePath);
3010
+ let config2 = result.config;
3011
+ const configFile = result.configFile;
3012
+ if (config2 && configFile && Object.keys(config2).length > 0 && !config2.skipConfigLogging) {
3013
+ writeTrace(
3014
+ `Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`,
3015
+ {
3016
+ logLevel: "all"
3017
+ }
3018
+ );
3019
+ }
3020
+ if (additionalFileNames && additionalFileNames.length > 0) {
3021
+ const results = await Promise.all(
3022
+ additionalFileNames.map(
3023
+ (fileName) => getConfigFileByName(fileName, workspacePath)
3024
+ )
3025
+ );
3026
+ for (const result2 of results) {
3027
+ if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
3028
+ if (!config2.skipConfigLogging && !result2.config.skipConfigLogging) {
3029
+ writeTrace(
3030
+ `Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`,
3031
+ {
3032
+ logLevel: "all"
3033
+ }
3034
+ );
3035
+ }
3036
+ config2 = defu(result2.config ?? {}, config2 ?? {});
3037
+ }
3038
+ }
3039
+ }
3040
+ if (!config2 || Object.keys(config2).length === 0) {
3041
+ return void 0;
3042
+ }
3043
+ config2.configFile = configFile;
3044
+ return config2;
3045
+ };
3046
+ var getConfigEnv = () => {
3047
+ const prefix = "STORM_";
3048
+ let config2 = {
3049
+ extends: process.env[`${prefix}EXTENDS`] || void 0,
3050
+ name: process.env[`${prefix}NAME`] || void 0,
3051
+ namespace: process.env[`${prefix}NAMESPACE`] || void 0,
3052
+ owner: process.env[`${prefix}OWNER`] || void 0,
3053
+ bot: {
3054
+ name: process.env[`${prefix}BOT_NAME`] || void 0,
3055
+ email: process.env[`${prefix}BOT_EMAIL`] || void 0
3056
+ },
3057
+ release: {
3058
+ banner: {
3059
+ url: process.env[`${prefix}RELEASE_BANNER_URL`] || void 0,
3060
+ alt: process.env[`${prefix}RELEASE_BANNER_ALT`] || void 0
3061
+ },
3062
+ header: process.env[`${prefix}RELEASE_HEADER`] || void 0,
3063
+ footer: process.env[`${prefix}RELEASE_FOOTER`] || void 0
3064
+ },
3065
+ error: {
3066
+ codesFile: process.env[`${prefix}ERROR_CODES_FILE`] || void 0,
3067
+ url: process.env[`${prefix}ERROR_URL`] || void 0
3068
+ },
3069
+ socials: {
3070
+ twitter: process.env[`${prefix}SOCIAL_TWITTER`] || void 0,
3071
+ discord: process.env[`${prefix}SOCIAL_DISCORD`] || void 0,
3072
+ telegram: process.env[`${prefix}SOCIAL_TELEGRAM`] || void 0,
3073
+ slack: process.env[`${prefix}SOCIAL_SLACK`] || void 0,
3074
+ medium: process.env[`${prefix}SOCIAL_MEDIUM`] || void 0,
3075
+ github: process.env[`${prefix}SOCIAL_GITHUB`] || void 0
3076
+ },
3077
+ organization: process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`] ? process.env[`${prefix}ORG_DESCRIPTION`] || process.env[`${prefix}ORGANIZATION_DESCRIPTION`] || process.env[`${prefix}ORG_URL`] || process.env[`${prefix}ORGANIZATION_URL`] || process.env[`${prefix}ORG_LOGO`] || process.env[`${prefix}ORGANIZATION_LOGO`] ? {
3078
+ name: process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`],
3079
+ description: process.env[`${prefix}ORG_DESCRIPTION`] || process.env[`${prefix}ORGANIZATION_DESCRIPTION`] || void 0,
3080
+ url: process.env[`${prefix}ORG_URL`] || process.env[`${prefix}ORGANIZATION_URL`] || void 0,
3081
+ logo: process.env[`${prefix}ORG_LOGO`] || process.env[`${prefix}ORGANIZATION_LOGO`] || void 0,
3082
+ icon: process.env[`${prefix}ORG_ICON`] || process.env[`${prefix}ORGANIZATION_ICON`] || void 0
3083
+ } : process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`] : void 0,
3084
+ packageManager: process.env[`${prefix}PACKAGE_MANAGER`] || void 0,
3085
+ license: process.env[`${prefix}LICENSE`] || void 0,
3086
+ homepage: process.env[`${prefix}HOMEPAGE`] || void 0,
3087
+ docs: process.env[`${prefix}DOCS`] || void 0,
3088
+ portal: process.env[`${prefix}PORTAL`] || void 0,
3089
+ licensing: process.env[`${prefix}LICENSING`] || void 0,
3090
+ contact: process.env[`${prefix}CONTACT`] || void 0,
3091
+ support: process.env[`${prefix}SUPPORT`] || void 0,
3092
+ timezone: process.env[`${prefix}TIMEZONE`] || process.env.TZ || void 0,
3093
+ locale: process.env[`${prefix}LOCALE`] || process.env.LOCALE || void 0,
3094
+ configFile: process.env[`${prefix}CONFIG_FILE`] ? correctPaths(process.env[`${prefix}CONFIG_FILE`]) : void 0,
3095
+ workspaceRoot: process.env[`${prefix}WORKSPACE_ROOT`] ? correctPaths(process.env[`${prefix}WORKSPACE_ROOT`]) : void 0,
3096
+ directories: {
3097
+ cache: process.env[`${prefix}CACHE_DIR`] ? correctPaths(process.env[`${prefix}CACHE_DIR`]) : process.env[`${prefix}CACHE_DIRECTORY`] ? correctPaths(process.env[`${prefix}CACHE_DIRECTORY`]) : void 0,
3098
+ data: process.env[`${prefix}DATA_DIR`] ? correctPaths(process.env[`${prefix}DATA_DIR`]) : process.env[`${prefix}DATA_DIRECTORY`] ? correctPaths(process.env[`${prefix}DATA_DIRECTORY`]) : void 0,
3099
+ config: process.env[`${prefix}CONFIG_DIR`] ? correctPaths(process.env[`${prefix}CONFIG_DIR`]) : process.env[`${prefix}CONFIG_DIRECTORY`] ? correctPaths(process.env[`${prefix}CONFIG_DIRECTORY`]) : void 0,
3100
+ temp: process.env[`${prefix}TEMP_DIR`] ? correctPaths(process.env[`${prefix}TEMP_DIR`]) : process.env[`${prefix}TEMP_DIRECTORY`] ? correctPaths(process.env[`${prefix}TEMP_DIRECTORY`]) : void 0,
3101
+ log: process.env[`${prefix}LOG_DIR`] ? correctPaths(process.env[`${prefix}LOG_DIR`]) : process.env[`${prefix}LOG_DIRECTORY`] ? correctPaths(process.env[`${prefix}LOG_DIRECTORY`]) : void 0,
3102
+ build: process.env[`${prefix}BUILD_DIR`] ? correctPaths(process.env[`${prefix}BUILD_DIR`]) : process.env[`${prefix}BUILD_DIRECTORY`] ? correctPaths(process.env[`${prefix}BUILD_DIRECTORY`]) : void 0
3103
+ },
3104
+ skipCache: process.env[`${prefix}SKIP_CACHE`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CACHE`]) : void 0,
3105
+ mode: (process.env[`${prefix}MODE`] ?? process.env.NODE_ENV ?? process.env.ENVIRONMENT) || void 0,
3106
+ // ci:
3107
+ // process.env[`${prefix}CI`] !== undefined
3108
+ // ? Boolean(
3109
+ // process.env[`${prefix}CI`] ??
3110
+ // process.env.CI ??
3111
+ // process.env.CONTINUOUS_INTEGRATION
3112
+ // )
3113
+ // : undefined,
3114
+ repository: process.env[`${prefix}REPOSITORY`] || void 0,
3115
+ branch: process.env[`${prefix}BRANCH`] || void 0,
3116
+ preid: process.env[`${prefix}PRE_ID`] || void 0,
3117
+ registry: {
3118
+ github: process.env[`${prefix}REGISTRY_GITHUB`] || void 0,
3119
+ npm: process.env[`${prefix}REGISTRY_NPM`] || void 0,
3120
+ cargo: process.env[`${prefix}REGISTRY_CARGO`] || void 0,
3121
+ cyclone: process.env[`${prefix}REGISTRY_CYCLONE`] || void 0,
3122
+ container: process.env[`${prefix}REGISTRY_CONTAINER`] || void 0
3123
+ },
3124
+ logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(
3125
+ Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
3126
+ ) ? getLogLevelLabel(
3127
+ Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
3128
+ ) : process.env[`${prefix}LOG_LEVEL`] : void 0,
3129
+ skipConfigLogging: process.env[`${prefix}SKIP_CONFIG_LOGGING`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CONFIG_LOGGING`]) : void 0
3130
+ };
3131
+ const themeNames = Object.keys(process.env).filter(
3132
+ (envKey) => envKey.startsWith(`${prefix}COLOR_`) && COLOR_KEYS.every(
3133
+ (colorKey) => !envKey.startsWith(`${prefix}COLOR_LIGHT_${colorKey}`) && !envKey.startsWith(`${prefix}COLOR_DARK_${colorKey}`)
3134
+ )
3135
+ );
3136
+ config2.colors = themeNames.length > 0 ? themeNames.reduce(
3137
+ (ret, themeName) => {
3138
+ ret[themeName] = getThemeColorsEnv(prefix, themeName);
3139
+ return ret;
3140
+ },
3141
+ {}
3142
+ ) : getThemeColorsEnv(prefix);
3143
+ if (config2.docs === STORM_DEFAULT_DOCS) {
3144
+ if (config2.homepage === STORM_DEFAULT_HOMEPAGE) {
3145
+ config2.docs = `${STORM_DEFAULT_HOMEPAGE}/projects/${config2.name}/docs`;
3146
+ } else {
3147
+ config2.docs = `${config2.homepage}/docs`;
3148
+ }
3149
+ }
3150
+ if (config2.licensing === STORM_DEFAULT_LICENSING) {
3151
+ if (config2.homepage === STORM_DEFAULT_HOMEPAGE) {
3152
+ config2.licensing = `${STORM_DEFAULT_HOMEPAGE}/projects/${config2.name}/licensing`;
3153
+ } else {
3154
+ config2.licensing = `${config2.homepage}/docs`;
3155
+ }
3156
+ }
3157
+ const serializedConfig = process.env[`${prefix}CONFIG`];
3158
+ if (serializedConfig) {
3159
+ const parsed = JSON.parse(serializedConfig);
3160
+ config2 = {
3161
+ ...config2,
3162
+ ...parsed,
3163
+ colors: { ...config2.colors, ...parsed.colors },
3164
+ extensions: { ...config2.extensions, ...parsed.extensions }
3165
+ };
3166
+ }
3167
+ return config2;
3168
+ };
3169
+ var getThemeColorsEnv = (prefix, theme) => {
3170
+ const themeName = `COLOR_${theme && theme !== "base" ? `${theme}_` : ""}`.toUpperCase();
3171
+ return process.env[`${prefix}${themeName}LIGHT_BRAND`] || process.env[`${prefix}${themeName}DARK_BRAND`] ? getMultiThemeColorsEnv(prefix + themeName) : getSingleThemeColorsEnv(prefix + themeName);
3172
+ };
3173
+ var getSingleThemeColorsEnv = (prefix) => {
3174
+ const gradient = [];
3175
+ if (process.env[`${prefix}GRADIENT_START`] && process.env[`${prefix}GRADIENT_END`]) {
3176
+ gradient.push(
3177
+ process.env[`${prefix}GRADIENT_START`],
3178
+ process.env[`${prefix}GRADIENT_END`]
3179
+ );
3180
+ } else if (process.env[`${prefix}GRADIENT_0`] || process.env[`${prefix}GRADIENT_1`]) {
3181
+ let index = process.env[`${prefix}GRADIENT_0`] ? 0 : 1;
3182
+ while (process.env[`${prefix}GRADIENT_${index}`]) {
3183
+ gradient.push(process.env[`${prefix}GRADIENT_${index}`]);
3184
+ index++;
3185
+ }
3186
+ }
3187
+ return {
3188
+ dark: process.env[`${prefix}DARK`],
3189
+ light: process.env[`${prefix}LIGHT`],
3190
+ brand: process.env[`${prefix}BRAND`],
3191
+ alternate: process.env[`${prefix}ALTERNATE`],
3192
+ accent: process.env[`${prefix}ACCENT`],
3193
+ link: process.env[`${prefix}LINK`],
3194
+ help: process.env[`${prefix}HELP`],
3195
+ success: process.env[`${prefix}SUCCESS`],
3196
+ info: process.env[`${prefix}INFO`],
3197
+ warning: process.env[`${prefix}WARNING`],
3198
+ danger: process.env[`${prefix}DANGER`],
3199
+ fatal: process.env[`${prefix}FATAL`],
3200
+ positive: process.env[`${prefix}POSITIVE`],
3201
+ negative: process.env[`${prefix}NEGATIVE`],
3202
+ gradient
3203
+ };
3204
+ };
3205
+ var getMultiThemeColorsEnv = (prefix) => {
3206
+ return {
3207
+ light: getBaseThemeColorsEnv(`${prefix}_LIGHT_`),
3208
+ dark: getBaseThemeColorsEnv(`${prefix}_DARK_`)
3209
+ };
3210
+ };
3211
+ var getBaseThemeColorsEnv = (prefix) => {
3212
+ const gradient = [];
3213
+ if (process.env[`${prefix}GRADIENT_START`] && process.env[`${prefix}GRADIENT_END`]) {
3214
+ gradient.push(
3215
+ process.env[`${prefix}GRADIENT_START`],
3216
+ process.env[`${prefix}GRADIENT_END`]
3217
+ );
3218
+ } else if (process.env[`${prefix}GRADIENT_0`] || process.env[`${prefix}GRADIENT_1`]) {
3219
+ let index = process.env[`${prefix}GRADIENT_0`] ? 0 : 1;
3220
+ while (process.env[`${prefix}GRADIENT_${index}`]) {
3221
+ gradient.push(process.env[`${prefix}GRADIENT_${index}`]);
3222
+ index++;
3223
+ }
3224
+ }
3225
+ return {
3226
+ foreground: process.env[`${prefix}FOREGROUND`],
3227
+ background: process.env[`${prefix}BACKGROUND`],
3228
+ brand: process.env[`${prefix}BRAND`],
3229
+ alternate: process.env[`${prefix}ALTERNATE`],
3230
+ accent: process.env[`${prefix}ACCENT`],
3231
+ link: process.env[`${prefix}LINK`],
3232
+ help: process.env[`${prefix}HELP`],
3233
+ success: process.env[`${prefix}SUCCESS`],
3234
+ info: process.env[`${prefix}INFO`],
3235
+ warning: process.env[`${prefix}WARNING`],
3236
+ danger: process.env[`${prefix}DANGER`],
3237
+ fatal: process.env[`${prefix}FATAL`],
3238
+ positive: process.env[`${prefix}POSITIVE`],
3239
+ negative: process.env[`${prefix}NEGATIVE`],
3240
+ gradient
3241
+ };
3242
+ };
3243
+
3244
+ // ../config-tools/src/env/set-env.ts
3245
+ var setExtensionEnv = (extensionName, extension) => {
3246
+ for (const key of Object.keys(extension ?? {})) {
3247
+ if (extension[key]) {
3248
+ const result = key?.replace(
3249
+ /([A-Z])+/g,
3250
+ (input) => input ? input[0]?.toUpperCase() + input.slice(1) : ""
3251
+ ).split(/(?=[A-Z])|[.\-\s_]/).map((x) => x.toLowerCase()) ?? [];
3252
+ let extensionKey;
3253
+ if (result.length === 0) {
3254
+ return;
3255
+ }
3256
+ if (result.length === 1) {
3257
+ extensionKey = result[0]?.toUpperCase() ?? "";
3258
+ } else {
3259
+ extensionKey = result.reduce((ret, part) => {
3260
+ return `${ret}_${part.toLowerCase()}`;
3261
+ });
3262
+ }
3263
+ process.env[`STORM_EXTENSION_${extensionName.toUpperCase()}_${extensionKey.toUpperCase()}`] = extension[key];
3264
+ }
3265
+ }
3266
+ };
3267
+ var setConfigEnv = (config2) => {
3268
+ const prefix = "STORM_";
3269
+ if (config2.extends) {
3270
+ process.env[`${prefix}EXTENDS`] = Array.isArray(config2.extends) ? JSON.stringify(config2.extends) : config2.extends;
3271
+ }
3272
+ if (config2.name) {
3273
+ process.env[`${prefix}NAME`] = config2.name;
3274
+ }
3275
+ if (config2.namespace) {
3276
+ process.env[`${prefix}NAMESPACE`] = config2.namespace;
3277
+ }
3278
+ if (config2.owner) {
3279
+ process.env[`${prefix}OWNER`] = config2.owner;
3280
+ }
3281
+ if (config2.bot) {
3282
+ process.env[`${prefix}BOT_NAME`] = config2.bot.name;
3283
+ process.env[`${prefix}BOT_EMAIL`] = config2.bot.email;
3284
+ }
3285
+ if (config2.error) {
3286
+ process.env[`${prefix}ERROR_CODES_FILE`] = config2.error.codesFile;
3287
+ process.env[`${prefix}ERROR_URL`] = config2.error.url;
3288
+ }
3289
+ if (config2.release) {
3290
+ if (config2.release.banner) {
3291
+ if (typeof config2.release.banner === "string") {
3292
+ process.env[`${prefix}RELEASE_BANNER`] = config2.release.banner;
3293
+ process.env[`${prefix}RELEASE_BANNER_URL`] = config2.release.banner;
3294
+ } else {
3295
+ process.env[`${prefix}RELEASE_BANNER`] = config2.release.banner.url;
3296
+ process.env[`${prefix}RELEASE_BANNER_URL`] = config2.release.banner.url;
3297
+ process.env[`${prefix}RELEASE_BANNER_ALT`] = config2.release.banner.alt;
3298
+ }
3299
+ }
3300
+ process.env[`${prefix}RELEASE_HEADER`] = config2.release.header;
3301
+ process.env[`${prefix}RELEASE_FOOTER`] = config2.release.footer;
3302
+ }
3303
+ if (config2.socials) {
3304
+ if (config2.socials.twitter) {
3305
+ process.env[`${prefix}SOCIAL_TWITTER`] = config2.socials.twitter;
3306
+ }
3307
+ if (config2.socials.discord) {
3308
+ process.env[`${prefix}SOCIAL_DISCORD`] = config2.socials.discord;
3309
+ }
3310
+ if (config2.socials.telegram) {
3311
+ process.env[`${prefix}SOCIAL_TELEGRAM`] = config2.socials.telegram;
3312
+ }
3313
+ if (config2.socials.slack) {
3314
+ process.env[`${prefix}SOCIAL_SLACK`] = config2.socials.slack;
3315
+ }
3316
+ if (config2.socials.medium) {
3317
+ process.env[`${prefix}SOCIAL_MEDIUM`] = config2.socials.medium;
3318
+ }
3319
+ if (config2.socials.github) {
3320
+ process.env[`${prefix}SOCIAL_GITHUB`] = config2.socials.github;
3321
+ }
3322
+ }
3323
+ if (config2.organization) {
3324
+ if (typeof config2.organization === "string") {
3325
+ process.env[`${prefix}ORG`] = config2.organization;
3326
+ process.env[`${prefix}ORG_NAME`] = config2.organization;
3327
+ process.env[`${prefix}ORGANIZATION`] = config2.organization;
3328
+ process.env[`${prefix}ORGANIZATION_NAME`] = config2.organization;
3329
+ } else {
3330
+ process.env[`${prefix}ORG`] = config2.organization.name;
3331
+ process.env[`${prefix}ORG_NAME`] = config2.organization.name;
3332
+ process.env[`${prefix}ORGANIZATION`] = config2.organization.name;
3333
+ process.env[`${prefix}ORGANIZATION_NAME`] = config2.organization.name;
3334
+ if (config2.organization.url) {
3335
+ process.env[`${prefix}ORG_URL`] = config2.organization.url;
3336
+ process.env[`${prefix}ORGANIZATION_URL`] = config2.organization.url;
3337
+ }
3338
+ if (config2.organization.description) {
3339
+ process.env[`${prefix}ORG_DESCRIPTION`] = config2.organization.description;
3340
+ process.env[`${prefix}ORGANIZATION_DESCRIPTION`] = config2.organization.description;
3341
+ }
3342
+ if (config2.organization.logo) {
3343
+ process.env[`${prefix}ORG_LOGO`] = config2.organization.logo;
3344
+ process.env[`${prefix}ORGANIZATION_LOGO`] = config2.organization.logo;
3345
+ }
3346
+ if (config2.organization.icon) {
3347
+ process.env[`${prefix}ORG_ICON`] = config2.organization.icon;
3348
+ process.env[`${prefix}ORGANIZATION_ICON`] = config2.organization.icon;
3349
+ }
3350
+ }
3351
+ }
3352
+ if (config2.packageManager) {
3353
+ process.env[`${prefix}PACKAGE_MANAGER`] = config2.packageManager;
3354
+ }
3355
+ if (config2.license) {
3356
+ process.env[`${prefix}LICENSE`] = config2.license;
3357
+ }
3358
+ if (config2.homepage) {
3359
+ process.env[`${prefix}HOMEPAGE`] = config2.homepage;
3360
+ }
3361
+ if (config2.docs) {
3362
+ process.env[`${prefix}DOCS`] = config2.docs;
3363
+ }
3364
+ if (config2.portal) {
3365
+ process.env[`${prefix}PORTAL`] = config2.portal;
3366
+ }
3367
+ if (config2.licensing) {
3368
+ process.env[`${prefix}LICENSING`] = config2.licensing;
3369
+ }
3370
+ if (config2.contact) {
3371
+ process.env[`${prefix}CONTACT`] = config2.contact;
3372
+ }
3373
+ if (config2.support) {
3374
+ process.env[`${prefix}SUPPORT`] = config2.support;
3375
+ }
3376
+ if (config2.timezone) {
3377
+ process.env[`${prefix}TIMEZONE`] = config2.timezone;
3378
+ process.env.TZ = config2.timezone;
3379
+ process.env.DEFAULT_TIMEZONE = config2.timezone;
3380
+ process.env.TIMEZONE = config2.timezone;
3381
+ }
3382
+ if (config2.locale) {
3383
+ process.env[`${prefix}LOCALE`] = config2.locale;
3384
+ process.env.DEFAULT_LOCALE = config2.locale;
3385
+ process.env.LOCALE = config2.locale;
3386
+ process.env.LANG = config2.locale ? `${config2.locale.replaceAll("-", "_")}.UTF-8` : "en_US.UTF-8";
3387
+ }
3388
+ if (config2.configFile) {
3389
+ process.env[`${prefix}CONFIG_FILE`] = correctPaths(config2.configFile);
3390
+ }
3391
+ if (config2.workspaceRoot) {
3392
+ process.env[`${prefix}WORKSPACE_ROOT`] = correctPaths(config2.workspaceRoot);
3393
+ process.env.NX_WORKSPACE_ROOT = correctPaths(config2.workspaceRoot);
3394
+ process.env.NX_WORKSPACE_ROOT_PATH = correctPaths(config2.workspaceRoot);
3395
+ }
3396
+ if (config2.directories) {
3397
+ if (!config2.skipCache && config2.directories.cache) {
3398
+ process.env[`${prefix}CACHE_DIR`] = correctPaths(
3399
+ config2.directories.cache
3400
+ );
3401
+ process.env[`${prefix}CACHE_DIRECTORY`] = process.env[`${prefix}CACHE_DIR`];
3402
+ }
3403
+ if (config2.directories.data) {
3404
+ process.env[`${prefix}DATA_DIR`] = correctPaths(config2.directories.data);
3405
+ process.env[`${prefix}DATA_DIRECTORY`] = process.env[`${prefix}DATA_DIR`];
3406
+ }
3407
+ if (config2.directories.config) {
3408
+ process.env[`${prefix}CONFIG_DIR`] = correctPaths(
3409
+ config2.directories.config
3410
+ );
3411
+ process.env[`${prefix}CONFIG_DIRECTORY`] = process.env[`${prefix}CONFIG_DIR`];
3412
+ }
3413
+ if (config2.directories.temp) {
3414
+ process.env[`${prefix}TEMP_DIR`] = correctPaths(config2.directories.temp);
3415
+ process.env[`${prefix}TEMP_DIRECTORY`] = process.env[`${prefix}TEMP_DIR`];
3416
+ }
3417
+ if (config2.directories.log) {
3418
+ process.env[`${prefix}LOG_DIR`] = correctPaths(config2.directories.log);
3419
+ process.env[`${prefix}LOG_DIRECTORY`] = process.env[`${prefix}LOG_DIR`];
3420
+ }
3421
+ if (config2.directories.build) {
3422
+ process.env[`${prefix}BUILD_DIR`] = correctPaths(
3423
+ config2.directories.build
3424
+ );
3425
+ process.env[`${prefix}BUILD_DIRECTORY`] = process.env[`${prefix}BUILD_DIR`];
3426
+ }
3427
+ }
3428
+ if (config2.skipCache !== void 0) {
3429
+ process.env[`${prefix}SKIP_CACHE`] = String(config2.skipCache);
3430
+ if (config2.skipCache) {
3431
+ process.env.NX_SKIP_NX_CACHE ??= String(config2.skipCache);
3432
+ process.env.NX_CACHE_PROJECT_GRAPH ??= String(config2.skipCache);
3433
+ }
3434
+ }
3435
+ if (config2.mode) {
3436
+ process.env[`${prefix}MODE`] = config2.mode;
3437
+ process.env.NODE_ENV = config2.mode;
3438
+ process.env.ENVIRONMENT = config2.mode;
3439
+ }
3440
+ if (config2.colors?.base?.light || config2.colors?.base?.dark) {
3441
+ for (const key of Object.keys(config2.colors)) {
3442
+ setThemeColorsEnv(`${prefix}COLOR_${key}_`, config2.colors[key]);
3443
+ }
3444
+ } else {
3445
+ setThemeColorsEnv(
3446
+ `${prefix}COLOR_`,
3447
+ config2.colors
3448
+ );
3449
+ }
3450
+ if (config2.repository) {
3451
+ process.env[`${prefix}REPOSITORY`] = config2.repository;
3452
+ }
3453
+ if (config2.branch) {
3454
+ process.env[`${prefix}BRANCH`] = config2.branch;
3455
+ }
3456
+ if (config2.preid) {
3457
+ process.env[`${prefix}PRE_ID`] = String(config2.preid);
3458
+ }
3459
+ if (config2.registry) {
3460
+ if (config2.registry.github) {
3461
+ process.env[`${prefix}REGISTRY_GITHUB`] = String(config2.registry.github);
3462
+ }
3463
+ if (config2.registry.npm) {
3464
+ process.env[`${prefix}REGISTRY_NPM`] = String(config2.registry.npm);
3465
+ }
3466
+ if (config2.registry.cargo) {
3467
+ process.env[`${prefix}REGISTRY_CARGO`] = String(config2.registry.cargo);
3468
+ }
3469
+ if (config2.registry.cyclone) {
3470
+ process.env[`${prefix}REGISTRY_CYCLONE`] = String(
3471
+ config2.registry.cyclone
3472
+ );
3473
+ }
3474
+ if (config2.registry.container) {
3475
+ process.env[`${prefix}REGISTRY_CONTAINER`] = String(
3476
+ config2.registry.container
3477
+ );
3478
+ }
3479
+ }
3480
+ if (config2.logLevel) {
3481
+ process.env[`${prefix}LOG_LEVEL`] = String(config2.logLevel);
3482
+ process.env.LOG_LEVEL = String(config2.logLevel);
3483
+ process.env.NX_VERBOSE_LOGGING = String(
3484
+ getLogLevel(config2.logLevel) >= LogLevel.DEBUG ? true : false
3485
+ );
3486
+ process.env.RUST_BACKTRACE = getLogLevel(config2.logLevel) >= LogLevel.DEBUG ? "full" : "none";
3487
+ }
3488
+ if (config2.skipConfigLogging !== void 0) {
3489
+ process.env[`${prefix}SKIP_CONFIG_LOGGING`] = String(
3490
+ config2.skipConfigLogging
3491
+ );
3492
+ }
3493
+ process.env[`${prefix}CONFIG`] = JSON.stringify(config2);
3494
+ for (const key of Object.keys(config2.extensions ?? {})) {
3495
+ if (config2.extensions[key] && Object.keys(config2.extensions[key])) {
3496
+ setExtensionEnv(key, config2.extensions[key]);
3497
+ }
3498
+ }
3499
+ };
3500
+ var setThemeColorsEnv = (prefix, config2) => {
3501
+ return config2?.light?.brand || config2?.dark?.brand ? setMultiThemeColorsEnv(prefix, config2) : setSingleThemeColorsEnv(prefix, config2);
3502
+ };
3503
+ var setSingleThemeColorsEnv = (prefix, config2) => {
3504
+ if (config2.dark) {
3505
+ process.env[`${prefix}DARK`] = config2.dark;
3506
+ }
3507
+ if (config2.light) {
3508
+ process.env[`${prefix}LIGHT`] = config2.light;
3509
+ }
3510
+ if (config2.brand) {
3511
+ process.env[`${prefix}BRAND`] = config2.brand;
3512
+ }
3513
+ if (config2.alternate) {
3514
+ process.env[`${prefix}ALTERNATE`] = config2.alternate;
3515
+ }
3516
+ if (config2.accent) {
3517
+ process.env[`${prefix}ACCENT`] = config2.accent;
3518
+ }
3519
+ if (config2.link) {
3520
+ process.env[`${prefix}LINK`] = config2.link;
3521
+ }
3522
+ if (config2.help) {
3523
+ process.env[`${prefix}HELP`] = config2.help;
3524
+ }
3525
+ if (config2.success) {
3526
+ process.env[`${prefix}SUCCESS`] = config2.success;
3527
+ }
3528
+ if (config2.info) {
3529
+ process.env[`${prefix}INFO`] = config2.info;
3530
+ }
3531
+ if (config2.warning) {
3532
+ process.env[`${prefix}WARNING`] = config2.warning;
3533
+ }
3534
+ if (config2.danger) {
3535
+ process.env[`${prefix}DANGER`] = config2.danger;
3536
+ }
3537
+ if (config2.fatal) {
3538
+ process.env[`${prefix}FATAL`] = config2.fatal;
3539
+ }
3540
+ if (config2.positive) {
3541
+ process.env[`${prefix}POSITIVE`] = config2.positive;
3542
+ }
3543
+ if (config2.negative) {
3544
+ process.env[`${prefix}NEGATIVE`] = config2.negative;
3545
+ }
3546
+ if (config2.gradient) {
3547
+ for (let i = 0; i < config2.gradient.length; i++) {
3548
+ process.env[`${prefix}GRADIENT_${i}`] = config2.gradient[i];
3549
+ }
3550
+ }
3551
+ };
3552
+ var setMultiThemeColorsEnv = (prefix, config2) => {
3553
+ return {
3554
+ light: setBaseThemeColorsEnv(`${prefix}LIGHT_`, config2.light),
3555
+ dark: setBaseThemeColorsEnv(`${prefix}DARK_`, config2.dark)
3556
+ };
3557
+ };
3558
+ var setBaseThemeColorsEnv = (prefix, config2) => {
3559
+ if (config2.foreground) {
3560
+ process.env[`${prefix}FOREGROUND`] = config2.foreground;
3561
+ }
3562
+ if (config2.background) {
3563
+ process.env[`${prefix}BACKGROUND`] = config2.background;
3564
+ }
3565
+ if (config2.brand) {
3566
+ process.env[`${prefix}BRAND`] = config2.brand;
3567
+ }
3568
+ if (config2.alternate) {
3569
+ process.env[`${prefix}ALTERNATE`] = config2.alternate;
3570
+ }
3571
+ if (config2.accent) {
3572
+ process.env[`${prefix}ACCENT`] = config2.accent;
3573
+ }
3574
+ if (config2.link) {
3575
+ process.env[`${prefix}LINK`] = config2.link;
3576
+ }
3577
+ if (config2.help) {
3578
+ process.env[`${prefix}HELP`] = config2.help;
3579
+ }
3580
+ if (config2.success) {
3581
+ process.env[`${prefix}SUCCESS`] = config2.success;
3582
+ }
3583
+ if (config2.info) {
3584
+ process.env[`${prefix}INFO`] = config2.info;
3585
+ }
3586
+ if (config2.warning) {
3587
+ process.env[`${prefix}WARNING`] = config2.warning;
3588
+ }
3589
+ if (config2.danger) {
3590
+ process.env[`${prefix}DANGER`] = config2.danger;
3591
+ }
3592
+ if (config2.fatal) {
3593
+ process.env[`${prefix}FATAL`] = config2.fatal;
3594
+ }
3595
+ if (config2.positive) {
3596
+ process.env[`${prefix}POSITIVE`] = config2.positive;
3597
+ }
3598
+ if (config2.negative) {
3599
+ process.env[`${prefix}NEGATIVE`] = config2.negative;
3600
+ }
3601
+ if (config2.gradient) {
3602
+ for (let i = 0; i < config2.gradient.length; i++) {
3603
+ process.env[`${prefix}GRADIENT_${i}`] = config2.gradient[i];
3604
+ }
3605
+ }
3606
+ };
3607
+ var _static_cache = void 0;
3608
+ var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {
3609
+ let result;
3610
+ if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
3611
+ let _workspaceRoot = workspaceRoot;
3612
+ if (!_workspaceRoot) {
3613
+ _workspaceRoot = findWorkspaceRoot();
3614
+ }
3615
+ const configEnv = getConfigEnv();
3616
+ const configFile = await getConfigFile(_workspaceRoot);
3617
+ if (!configFile) {
3618
+ if (!skipLogs) {
3619
+ writeWarning(
3620
+ "No Storm Workspace configuration file found in the current repository. Please ensure this is the expected behavior - you can add a `storm-workspace.json` file to the root of your workspace if it is not.\n",
3621
+ { logLevel: "all" }
3622
+ );
3623
+ }
3624
+ if (useDefault === false) {
3625
+ return void 0;
3626
+ }
3627
+ }
3628
+ const defaultConfig = await getPackageJsonConfig(_workspaceRoot);
3629
+ const configInput = defu(
3630
+ configEnv,
3631
+ configFile,
3632
+ defaultConfig
3633
+ );
3634
+ try {
3635
+ result = applyDefaultConfig(
3636
+ await workspaceConfigSchema.parseAsync(configInput)
3637
+ );
3638
+ result.workspaceRoot ??= _workspaceRoot;
3639
+ } catch (error) {
3640
+ throw new Error(
3641
+ `Failed to parse Storm Workspace configuration${error?.message ? `: ${error.message}` : ""}
3642
+
3643
+ Please ensure your configuration file is valid JSON and matches the expected schema. The current workspace configuration input is: ${formatLogMessage(
3644
+ configInput
3645
+ )}`,
3646
+ {
3647
+ cause: error
3648
+ }
3649
+ );
3650
+ }
3651
+ } else {
3652
+ result = _static_cache.data;
3653
+ }
3654
+ _static_cache = {
3655
+ timestamp: Date.now(),
3656
+ data: result
3657
+ };
3658
+ return result;
3659
+ };
3660
+ var loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
3661
+ const config2 = await createStormWorkspaceConfig(
3662
+ void 0,
3663
+ void 0,
3664
+ workspaceRoot,
3665
+ skipLogs,
3666
+ true
3667
+ );
3668
+ setConfigEnv(config2);
3669
+ if (!skipLogs && !config2.skipConfigLogging) {
3670
+ writeTrace(
3671
+ `\u2699\uFE0F Using Storm Workspace configuration:
3672
+ ${formatLogMessage(config2)}`,
3673
+ config2
3674
+ );
3675
+ }
3676
+ return config2;
3677
+ };
3678
+
3679
+ // ../config-tools/src/get-config.ts
3680
+ var getConfig = (workspaceRoot, skipLogs = false) => {
3681
+ return loadStormWorkspaceConfig(workspaceRoot, skipLogs);
3682
+ };
3683
+ var getWorkspaceConfig = (skipLogs = true, options = {}) => {
3684
+ let workspaceRoot = options.workspaceRoot;
3685
+ if (!workspaceRoot) {
3686
+ workspaceRoot = findWorkspaceRoot(options.cwd);
3687
+ }
3688
+ return getConfig(workspaceRoot, skipLogs);
3689
+ };
3690
+
3691
+ exports.__require = __require;
3692
+ exports.defu = defu;
3693
+ exports.exitWithError = exitWithError;
3694
+ exports.exitWithSuccess = exitWithSuccess;
3695
+ exports.findWorkspaceRootSafe = findWorkspaceRootSafe;
3696
+ exports.getConfig = getConfig;
3697
+ exports.getWorkspaceConfig = getWorkspaceConfig;
3698
+ exports.handleProcess = handleProcess;
3699
+ exports.isVerbose = isVerbose;
3700
+ exports.joinPaths = joinPaths;
3701
+ exports.writeDebug = writeDebug;
3702
+ exports.writeError = writeError;
3703
+ exports.writeFatal = writeFatal;
3704
+ exports.writeInfo = writeInfo;
3705
+ exports.writeSuccess = writeSuccess;
3706
+ exports.writeTrace = writeTrace;
3707
+ exports.writeWarning = writeWarning;