@geekmidas/cli 0.18.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/dist/{bundler-C74EKlNa.cjs → bundler-CyHg1v_T.cjs} +3 -3
  2. package/dist/{bundler-C74EKlNa.cjs.map → bundler-CyHg1v_T.cjs.map} +1 -1
  3. package/dist/{bundler-B6z6HEeh.mjs → bundler-DQIuE3Kn.mjs} +3 -3
  4. package/dist/{bundler-B6z6HEeh.mjs.map → bundler-DQIuE3Kn.mjs.map} +1 -1
  5. package/dist/{config-DYULeEv8.mjs → config-BaYqrF3n.mjs} +48 -10
  6. package/dist/config-BaYqrF3n.mjs.map +1 -0
  7. package/dist/{config-AmInkU7k.cjs → config-CxrLu8ia.cjs} +53 -9
  8. package/dist/config-CxrLu8ia.cjs.map +1 -0
  9. package/dist/config.cjs +4 -1
  10. package/dist/config.d.cts +27 -2
  11. package/dist/config.d.cts.map +1 -1
  12. package/dist/config.d.mts +27 -2
  13. package/dist/config.d.mts.map +1 -1
  14. package/dist/config.mjs +3 -2
  15. package/dist/dokploy-api-B0w17y4_.mjs +3 -0
  16. package/dist/{dokploy-api-CaETb2L6.mjs → dokploy-api-B9qR2Yn1.mjs} +1 -1
  17. package/dist/{dokploy-api-CaETb2L6.mjs.map → dokploy-api-B9qR2Yn1.mjs.map} +1 -1
  18. package/dist/dokploy-api-BnGeUqN4.cjs +3 -0
  19. package/dist/{dokploy-api-C7F9VykY.cjs → dokploy-api-C5czOZoc.cjs} +1 -1
  20. package/dist/{dokploy-api-C7F9VykY.cjs.map → dokploy-api-C5czOZoc.cjs.map} +1 -1
  21. package/dist/{encryption-D7Efcdi9.cjs → encryption-BAz0xQ1Q.cjs} +1 -1
  22. package/dist/{encryption-D7Efcdi9.cjs.map → encryption-BAz0xQ1Q.cjs.map} +1 -1
  23. package/dist/{encryption-h4Nb6W-M.mjs → encryption-JtMsiGNp.mjs} +2 -2
  24. package/dist/{encryption-h4Nb6W-M.mjs.map → encryption-JtMsiGNp.mjs.map} +1 -1
  25. package/dist/index-CWN-bgrO.d.mts +495 -0
  26. package/dist/index-CWN-bgrO.d.mts.map +1 -0
  27. package/dist/index-DEWYvYvg.d.cts +495 -0
  28. package/dist/index-DEWYvYvg.d.cts.map +1 -0
  29. package/dist/index.cjs +2639 -563
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.mjs +2634 -563
  32. package/dist/index.mjs.map +1 -1
  33. package/dist/{openapi-CZVcfxk-.mjs → openapi-CgqR6Jkw.mjs} +3 -3
  34. package/dist/{openapi-CZVcfxk-.mjs.map → openapi-CgqR6Jkw.mjs.map} +1 -1
  35. package/dist/{openapi-C89hhkZC.cjs → openapi-DfpxS0xv.cjs} +8 -2
  36. package/dist/{openapi-C89hhkZC.cjs.map → openapi-DfpxS0xv.cjs.map} +1 -1
  37. package/dist/{openapi-react-query-CM2_qlW9.mjs → openapi-react-query-5rSortLH.mjs} +1 -1
  38. package/dist/{openapi-react-query-CM2_qlW9.mjs.map → openapi-react-query-5rSortLH.mjs.map} +1 -1
  39. package/dist/{openapi-react-query-iKjfLzff.cjs → openapi-react-query-DvNpdDpM.cjs} +1 -1
  40. package/dist/{openapi-react-query-iKjfLzff.cjs.map → openapi-react-query-DvNpdDpM.cjs.map} +1 -1
  41. package/dist/openapi-react-query.cjs +1 -1
  42. package/dist/openapi-react-query.mjs +1 -1
  43. package/dist/openapi.cjs +3 -2
  44. package/dist/openapi.d.cts +1 -1
  45. package/dist/openapi.d.mts +1 -1
  46. package/dist/openapi.mjs +3 -2
  47. package/dist/{storage-Bn3K9Ccu.cjs → storage-BPRgh3DU.cjs} +136 -5
  48. package/dist/storage-BPRgh3DU.cjs.map +1 -0
  49. package/dist/{storage-nkGIjeXt.mjs → storage-DNj_I11J.mjs} +1 -1
  50. package/dist/storage-Dhst7BhI.mjs +272 -0
  51. package/dist/storage-Dhst7BhI.mjs.map +1 -0
  52. package/dist/{storage-UfyTn7Zm.cjs → storage-fOR8dMu5.cjs} +1 -1
  53. package/dist/{types-iFk5ms7y.d.mts → types-K2uQJ-FO.d.mts} +2 -2
  54. package/dist/{types-BgaMXsUa.d.cts.map → types-K2uQJ-FO.d.mts.map} +1 -1
  55. package/dist/{types-BgaMXsUa.d.cts → types-l53qUmGt.d.cts} +2 -2
  56. package/dist/{types-iFk5ms7y.d.mts.map → types-l53qUmGt.d.cts.map} +1 -1
  57. package/dist/workspace/index.cjs +19 -0
  58. package/dist/workspace/index.d.cts +3 -0
  59. package/dist/workspace/index.d.mts +3 -0
  60. package/dist/workspace/index.mjs +3 -0
  61. package/dist/workspace-CPLEZDZf.mjs +3788 -0
  62. package/dist/workspace-CPLEZDZf.mjs.map +1 -0
  63. package/dist/workspace-iWgBlX6h.cjs +3885 -0
  64. package/dist/workspace-iWgBlX6h.cjs.map +1 -0
  65. package/package.json +8 -3
  66. package/src/build/__tests__/workspace-build.spec.ts +215 -0
  67. package/src/build/index.ts +189 -1
  68. package/src/config.ts +71 -14
  69. package/src/deploy/__tests__/docker.spec.ts +1 -1
  70. package/src/deploy/__tests__/index.spec.ts +305 -1
  71. package/src/deploy/index.ts +426 -4
  72. package/src/deploy/types.ts +32 -0
  73. package/src/dev/__tests__/index.spec.ts +572 -1
  74. package/src/dev/index.ts +582 -2
  75. package/src/docker/__tests__/compose.spec.ts +425 -0
  76. package/src/docker/__tests__/templates.spec.ts +145 -0
  77. package/src/docker/compose.ts +248 -0
  78. package/src/docker/index.ts +159 -3
  79. package/src/docker/templates.ts +219 -4
  80. package/src/index.ts +24 -0
  81. package/src/init/__tests__/generators.spec.ts +17 -24
  82. package/src/init/__tests__/init.spec.ts +157 -5
  83. package/src/init/generators/auth.ts +220 -0
  84. package/src/init/generators/config.ts +61 -4
  85. package/src/init/generators/docker.ts +115 -8
  86. package/src/init/generators/env.ts +7 -127
  87. package/src/init/generators/index.ts +1 -0
  88. package/src/init/generators/models.ts +3 -1
  89. package/src/init/generators/monorepo.ts +154 -10
  90. package/src/init/generators/package.ts +5 -3
  91. package/src/init/generators/web.ts +213 -0
  92. package/src/init/index.ts +290 -58
  93. package/src/init/templates/api.ts +38 -29
  94. package/src/init/templates/index.ts +132 -4
  95. package/src/init/templates/minimal.ts +33 -35
  96. package/src/init/templates/serverless.ts +16 -19
  97. package/src/init/templates/worker.ts +50 -25
  98. package/src/init/versions.ts +47 -0
  99. package/src/secrets/keystore.ts +144 -0
  100. package/src/secrets/storage.ts +109 -6
  101. package/src/test/index.ts +97 -0
  102. package/src/workspace/__tests__/client-generator.spec.ts +357 -0
  103. package/src/workspace/__tests__/index.spec.ts +543 -0
  104. package/src/workspace/__tests__/schema.spec.ts +519 -0
  105. package/src/workspace/__tests__/type-inference.spec.ts +251 -0
  106. package/src/workspace/client-generator.ts +307 -0
  107. package/src/workspace/index.ts +372 -0
  108. package/src/workspace/schema.ts +368 -0
  109. package/src/workspace/types.ts +336 -0
  110. package/tsconfig.tsbuildinfo +1 -1
  111. package/tsdown.config.ts +1 -0
  112. package/dist/config-AmInkU7k.cjs.map +0 -1
  113. package/dist/config-DYULeEv8.mjs.map +0 -1
  114. package/dist/dokploy-api-B7KxOQr3.cjs +0 -3
  115. package/dist/dokploy-api-DHvfmWbi.mjs +0 -3
  116. package/dist/storage-BaOP55oq.mjs +0 -147
  117. package/dist/storage-BaOP55oq.mjs.map +0 -1
  118. package/dist/storage-Bn3K9Ccu.cjs.map +0 -1
@@ -0,0 +1,3885 @@
1
+ const require_chunk = require('./chunk-CUT6urMc.cjs');
2
+ const node_path = require_chunk.__toESM(require("node:path"));
3
+
4
+ //#region ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/core/core.js
5
+ /** A special constant with type `never` */
6
+ const NEVER = Object.freeze({ status: "aborted" });
7
+ function $constructor(name, initializer$2, params) {
8
+ function init(inst, def) {
9
+ if (!inst._zod) Object.defineProperty(inst, "_zod", {
10
+ value: {
11
+ def,
12
+ constr: _,
13
+ traits: /* @__PURE__ */ new Set()
14
+ },
15
+ enumerable: false
16
+ });
17
+ if (inst._zod.traits.has(name)) return;
18
+ inst._zod.traits.add(name);
19
+ initializer$2(inst, def);
20
+ const proto = _.prototype;
21
+ const keys = Object.keys(proto);
22
+ for (let i = 0; i < keys.length; i++) {
23
+ const k = keys[i];
24
+ if (!(k in inst)) inst[k] = proto[k].bind(inst);
25
+ }
26
+ }
27
+ const Parent = params?.Parent ?? Object;
28
+ class Definition extends Parent {}
29
+ Object.defineProperty(Definition, "name", { value: name });
30
+ function _(def) {
31
+ var _a$1;
32
+ const inst = params?.Parent ? new Definition() : this;
33
+ init(inst, def);
34
+ (_a$1 = inst._zod).deferred ?? (_a$1.deferred = []);
35
+ for (const fn of inst._zod.deferred) fn();
36
+ return inst;
37
+ }
38
+ Object.defineProperty(_, "init", { value: init });
39
+ Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
40
+ if (params?.Parent && inst instanceof params.Parent) return true;
41
+ return inst?._zod?.traits?.has(name);
42
+ } });
43
+ Object.defineProperty(_, "name", { value: name });
44
+ return _;
45
+ }
46
+ const $brand = Symbol("zod_brand");
47
+ var $ZodAsyncError = class extends Error {
48
+ constructor() {
49
+ super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
50
+ }
51
+ };
52
+ var $ZodEncodeError = class extends Error {
53
+ constructor(name) {
54
+ super(`Encountered unidirectional transform during encode: ${name}`);
55
+ this.name = "ZodEncodeError";
56
+ }
57
+ };
58
+ const globalConfig = {};
59
+ function config(newConfig) {
60
+ if (newConfig) Object.assign(globalConfig, newConfig);
61
+ return globalConfig;
62
+ }
63
+
64
+ //#endregion
65
+ //#region ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/core/util.js
66
+ function getEnumValues(entries) {
67
+ const numericValues = Object.values(entries).filter((v) => typeof v === "number");
68
+ const values = Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
69
+ return values;
70
+ }
71
+ function jsonStringifyReplacer(_, value) {
72
+ if (typeof value === "bigint") return value.toString();
73
+ return value;
74
+ }
75
+ function cached(getter) {
76
+ const set = false;
77
+ return { get value() {
78
+ if (!set) {
79
+ const value = getter();
80
+ Object.defineProperty(this, "value", { value });
81
+ return value;
82
+ }
83
+ throw new Error("cached value already set");
84
+ } };
85
+ }
86
+ function nullish(input) {
87
+ return input === null || input === void 0;
88
+ }
89
+ function cleanRegex(source) {
90
+ const start = source.startsWith("^") ? 1 : 0;
91
+ const end = source.endsWith("$") ? source.length - 1 : source.length;
92
+ return source.slice(start, end);
93
+ }
94
+ function floatSafeRemainder(val, step) {
95
+ const valDecCount = (val.toString().split(".")[1] || "").length;
96
+ const stepString = step.toString();
97
+ let stepDecCount = (stepString.split(".")[1] || "").length;
98
+ if (stepDecCount === 0 && /\d?e-\d?/.test(stepString)) {
99
+ const match = stepString.match(/\d?e-(\d?)/);
100
+ if (match?.[1]) stepDecCount = Number.parseInt(match[1]);
101
+ }
102
+ const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
103
+ const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
104
+ const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
105
+ return valInt % stepInt / 10 ** decCount;
106
+ }
107
+ const EVALUATING = Symbol("evaluating");
108
+ function defineLazy(object$1, key, getter) {
109
+ let value = void 0;
110
+ Object.defineProperty(object$1, key, {
111
+ get() {
112
+ if (value === EVALUATING) return void 0;
113
+ if (value === void 0) {
114
+ value = EVALUATING;
115
+ value = getter();
116
+ }
117
+ return value;
118
+ },
119
+ set(v) {
120
+ Object.defineProperty(object$1, key, { value: v });
121
+ },
122
+ configurable: true
123
+ });
124
+ }
125
+ function assignProp(target, prop, value) {
126
+ Object.defineProperty(target, prop, {
127
+ value,
128
+ writable: true,
129
+ enumerable: true,
130
+ configurable: true
131
+ });
132
+ }
133
+ function mergeDefs(...defs) {
134
+ const mergedDescriptors = {};
135
+ for (const def of defs) {
136
+ const descriptors = Object.getOwnPropertyDescriptors(def);
137
+ Object.assign(mergedDescriptors, descriptors);
138
+ }
139
+ return Object.defineProperties({}, mergedDescriptors);
140
+ }
141
+ function esc(str) {
142
+ return JSON.stringify(str);
143
+ }
144
+ function slugify(input) {
145
+ return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
146
+ }
147
+ const captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
148
+ function isObject(data) {
149
+ return typeof data === "object" && data !== null && !Array.isArray(data);
150
+ }
151
+ const allowsEval = cached(() => {
152
+ if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) return false;
153
+ try {
154
+ const F = Function;
155
+ new F("");
156
+ return true;
157
+ } catch (_) {
158
+ return false;
159
+ }
160
+ });
161
+ function isPlainObject(o) {
162
+ if (isObject(o) === false) return false;
163
+ const ctor = o.constructor;
164
+ if (ctor === void 0) return true;
165
+ if (typeof ctor !== "function") return true;
166
+ const prot = ctor.prototype;
167
+ if (isObject(prot) === false) return false;
168
+ if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) return false;
169
+ return true;
170
+ }
171
+ function shallowClone(o) {
172
+ if (isPlainObject(o)) return { ...o };
173
+ if (Array.isArray(o)) return [...o];
174
+ return o;
175
+ }
176
+ const propertyKeyTypes = new Set([
177
+ "string",
178
+ "number",
179
+ "symbol"
180
+ ]);
181
+ function escapeRegex(str) {
182
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
183
+ }
184
+ function clone(inst, def, params) {
185
+ const cl = new inst._zod.constr(def ?? inst._zod.def);
186
+ if (!def || params?.parent) cl._zod.parent = inst;
187
+ return cl;
188
+ }
189
+ function normalizeParams(_params) {
190
+ const params = _params;
191
+ if (!params) return {};
192
+ if (typeof params === "string") return { error: () => params };
193
+ if (params?.message !== void 0) {
194
+ if (params?.error !== void 0) throw new Error("Cannot specify both `message` and `error` params");
195
+ params.error = params.message;
196
+ }
197
+ delete params.message;
198
+ if (typeof params.error === "string") return {
199
+ ...params,
200
+ error: () => params.error
201
+ };
202
+ return params;
203
+ }
204
+ function optionalKeys(shape) {
205
+ return Object.keys(shape).filter((k) => {
206
+ return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
207
+ });
208
+ }
209
+ const NUMBER_FORMAT_RANGES = {
210
+ safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
211
+ int32: [-2147483648, 2147483647],
212
+ uint32: [0, 4294967295],
213
+ float32: [-34028234663852886e22, 34028234663852886e22],
214
+ float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
215
+ };
216
+ function pick(schema, mask) {
217
+ const currDef = schema._zod.def;
218
+ const def = mergeDefs(schema._zod.def, {
219
+ get shape() {
220
+ const newShape = {};
221
+ for (const key in mask) {
222
+ if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
223
+ if (!mask[key]) continue;
224
+ newShape[key] = currDef.shape[key];
225
+ }
226
+ assignProp(this, "shape", newShape);
227
+ return newShape;
228
+ },
229
+ checks: []
230
+ });
231
+ return clone(schema, def);
232
+ }
233
+ function omit(schema, mask) {
234
+ const currDef = schema._zod.def;
235
+ const def = mergeDefs(schema._zod.def, {
236
+ get shape() {
237
+ const newShape = { ...schema._zod.def.shape };
238
+ for (const key in mask) {
239
+ if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
240
+ if (!mask[key]) continue;
241
+ delete newShape[key];
242
+ }
243
+ assignProp(this, "shape", newShape);
244
+ return newShape;
245
+ },
246
+ checks: []
247
+ });
248
+ return clone(schema, def);
249
+ }
250
+ function extend(schema, shape) {
251
+ if (!isPlainObject(shape)) throw new Error("Invalid input to extend: expected a plain object");
252
+ const checks = schema._zod.def.checks;
253
+ const hasChecks = checks && checks.length > 0;
254
+ if (hasChecks) throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");
255
+ const def = mergeDefs(schema._zod.def, {
256
+ get shape() {
257
+ const _shape = {
258
+ ...schema._zod.def.shape,
259
+ ...shape
260
+ };
261
+ assignProp(this, "shape", _shape);
262
+ return _shape;
263
+ },
264
+ checks: []
265
+ });
266
+ return clone(schema, def);
267
+ }
268
+ function safeExtend(schema, shape) {
269
+ if (!isPlainObject(shape)) throw new Error("Invalid input to safeExtend: expected a plain object");
270
+ const def = {
271
+ ...schema._zod.def,
272
+ get shape() {
273
+ const _shape = {
274
+ ...schema._zod.def.shape,
275
+ ...shape
276
+ };
277
+ assignProp(this, "shape", _shape);
278
+ return _shape;
279
+ },
280
+ checks: schema._zod.def.checks
281
+ };
282
+ return clone(schema, def);
283
+ }
284
+ function merge(a, b) {
285
+ const def = mergeDefs(a._zod.def, {
286
+ get shape() {
287
+ const _shape = {
288
+ ...a._zod.def.shape,
289
+ ...b._zod.def.shape
290
+ };
291
+ assignProp(this, "shape", _shape);
292
+ return _shape;
293
+ },
294
+ get catchall() {
295
+ return b._zod.def.catchall;
296
+ },
297
+ checks: []
298
+ });
299
+ return clone(a, def);
300
+ }
301
+ function partial(Class, schema, mask) {
302
+ const def = mergeDefs(schema._zod.def, {
303
+ get shape() {
304
+ const oldShape = schema._zod.def.shape;
305
+ const shape = { ...oldShape };
306
+ if (mask) for (const key in mask) {
307
+ if (!(key in oldShape)) throw new Error(`Unrecognized key: "${key}"`);
308
+ if (!mask[key]) continue;
309
+ shape[key] = Class ? new Class({
310
+ type: "optional",
311
+ innerType: oldShape[key]
312
+ }) : oldShape[key];
313
+ }
314
+ else for (const key in oldShape) shape[key] = Class ? new Class({
315
+ type: "optional",
316
+ innerType: oldShape[key]
317
+ }) : oldShape[key];
318
+ assignProp(this, "shape", shape);
319
+ return shape;
320
+ },
321
+ checks: []
322
+ });
323
+ return clone(schema, def);
324
+ }
325
+ function required(Class, schema, mask) {
326
+ const def = mergeDefs(schema._zod.def, {
327
+ get shape() {
328
+ const oldShape = schema._zod.def.shape;
329
+ const shape = { ...oldShape };
330
+ if (mask) for (const key in mask) {
331
+ if (!(key in shape)) throw new Error(`Unrecognized key: "${key}"`);
332
+ if (!mask[key]) continue;
333
+ shape[key] = new Class({
334
+ type: "nonoptional",
335
+ innerType: oldShape[key]
336
+ });
337
+ }
338
+ else for (const key in oldShape) shape[key] = new Class({
339
+ type: "nonoptional",
340
+ innerType: oldShape[key]
341
+ });
342
+ assignProp(this, "shape", shape);
343
+ return shape;
344
+ },
345
+ checks: []
346
+ });
347
+ return clone(schema, def);
348
+ }
349
+ function aborted(x, startIndex = 0) {
350
+ if (x.aborted === true) return true;
351
+ for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue !== true) return true;
352
+ return false;
353
+ }
354
+ function prefixIssues(path, issues) {
355
+ return issues.map((iss) => {
356
+ var _a$1;
357
+ (_a$1 = iss).path ?? (_a$1.path = []);
358
+ iss.path.unshift(path);
359
+ return iss;
360
+ });
361
+ }
362
+ function unwrapMessage(message) {
363
+ return typeof message === "string" ? message : message?.message;
364
+ }
365
+ function finalizeIssue(iss, ctx, config$1) {
366
+ const full = {
367
+ ...iss,
368
+ path: iss.path ?? []
369
+ };
370
+ if (!iss.message) {
371
+ const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config$1.customError?.(iss)) ?? unwrapMessage(config$1.localeError?.(iss)) ?? "Invalid input";
372
+ full.message = message;
373
+ }
374
+ delete full.inst;
375
+ delete full.continue;
376
+ if (!ctx?.reportInput) delete full.input;
377
+ return full;
378
+ }
379
+ function getLengthableOrigin(input) {
380
+ if (Array.isArray(input)) return "array";
381
+ if (typeof input === "string") return "string";
382
+ return "unknown";
383
+ }
384
+ function issue(...args) {
385
+ const [iss, input, inst] = args;
386
+ if (typeof iss === "string") return {
387
+ message: iss,
388
+ code: "custom",
389
+ input,
390
+ inst
391
+ };
392
+ return { ...iss };
393
+ }
394
+
395
+ //#endregion
396
+ //#region ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/core/errors.js
397
+ const initializer$1 = (inst, def) => {
398
+ inst.name = "$ZodError";
399
+ Object.defineProperty(inst, "_zod", {
400
+ value: inst._zod,
401
+ enumerable: false
402
+ });
403
+ Object.defineProperty(inst, "issues", {
404
+ value: def,
405
+ enumerable: false
406
+ });
407
+ inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
408
+ Object.defineProperty(inst, "toString", {
409
+ value: () => inst.message,
410
+ enumerable: false
411
+ });
412
+ };
413
+ const $ZodError = $constructor("$ZodError", initializer$1);
414
+ const $ZodRealError = $constructor("$ZodError", initializer$1, { Parent: Error });
415
+ function flattenError(error, mapper = (issue$1) => issue$1.message) {
416
+ const fieldErrors = {};
417
+ const formErrors = [];
418
+ for (const sub of error.issues) if (sub.path.length > 0) {
419
+ fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
420
+ fieldErrors[sub.path[0]].push(mapper(sub));
421
+ } else formErrors.push(mapper(sub));
422
+ return {
423
+ formErrors,
424
+ fieldErrors
425
+ };
426
+ }
427
+ function formatError(error, mapper = (issue$1) => issue$1.message) {
428
+ const fieldErrors = { _errors: [] };
429
+ const processError = (error$1) => {
430
+ for (const issue$1 of error$1.issues) if (issue$1.code === "invalid_union" && issue$1.errors.length) issue$1.errors.map((issues) => processError({ issues }));
431
+ else if (issue$1.code === "invalid_key") processError({ issues: issue$1.issues });
432
+ else if (issue$1.code === "invalid_element") processError({ issues: issue$1.issues });
433
+ else if (issue$1.path.length === 0) fieldErrors._errors.push(mapper(issue$1));
434
+ else {
435
+ let curr = fieldErrors;
436
+ let i = 0;
437
+ while (i < issue$1.path.length) {
438
+ const el = issue$1.path[i];
439
+ const terminal = i === issue$1.path.length - 1;
440
+ if (!terminal) curr[el] = curr[el] || { _errors: [] };
441
+ else {
442
+ curr[el] = curr[el] || { _errors: [] };
443
+ curr[el]._errors.push(mapper(issue$1));
444
+ }
445
+ curr = curr[el];
446
+ i++;
447
+ }
448
+ }
449
+ };
450
+ processError(error);
451
+ return fieldErrors;
452
+ }
453
+
454
+ //#endregion
455
+ //#region ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/core/parse.js
456
+ const _parse = (_Err) => (schema, value, _ctx, _params) => {
457
+ const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
458
+ const result = schema._zod.run({
459
+ value,
460
+ issues: []
461
+ }, ctx);
462
+ if (result instanceof Promise) throw new $ZodAsyncError();
463
+ if (result.issues.length) {
464
+ const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
465
+ captureStackTrace(e, _params?.callee);
466
+ throw e;
467
+ }
468
+ return result.value;
469
+ };
470
+ const parse$1 = /* @__PURE__ */ _parse($ZodRealError);
471
+ const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
472
+ const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
473
+ let result = schema._zod.run({
474
+ value,
475
+ issues: []
476
+ }, ctx);
477
+ if (result instanceof Promise) result = await result;
478
+ if (result.issues.length) {
479
+ const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
480
+ captureStackTrace(e, params?.callee);
481
+ throw e;
482
+ }
483
+ return result.value;
484
+ };
485
+ const parseAsync$1 = /* @__PURE__ */ _parseAsync($ZodRealError);
486
+ const _safeParse = (_Err) => (schema, value, _ctx) => {
487
+ const ctx = _ctx ? {
488
+ ..._ctx,
489
+ async: false
490
+ } : { async: false };
491
+ const result = schema._zod.run({
492
+ value,
493
+ issues: []
494
+ }, ctx);
495
+ if (result instanceof Promise) throw new $ZodAsyncError();
496
+ return result.issues.length ? {
497
+ success: false,
498
+ error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
499
+ } : {
500
+ success: true,
501
+ data: result.value
502
+ };
503
+ };
504
+ const safeParse$1 = /* @__PURE__ */ _safeParse($ZodRealError);
505
+ const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
506
+ const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
507
+ let result = schema._zod.run({
508
+ value,
509
+ issues: []
510
+ }, ctx);
511
+ if (result instanceof Promise) result = await result;
512
+ return result.issues.length ? {
513
+ success: false,
514
+ error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
515
+ } : {
516
+ success: true,
517
+ data: result.value
518
+ };
519
+ };
520
+ const safeParseAsync$1 = /* @__PURE__ */ _safeParseAsync($ZodRealError);
521
+ const _encode = (_Err) => (schema, value, _ctx) => {
522
+ const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
523
+ return _parse(_Err)(schema, value, ctx);
524
+ };
525
+ const encode$1 = /* @__PURE__ */ _encode($ZodRealError);
526
+ const _decode = (_Err) => (schema, value, _ctx) => {
527
+ return _parse(_Err)(schema, value, _ctx);
528
+ };
529
+ const decode$1 = /* @__PURE__ */ _decode($ZodRealError);
530
+ const _encodeAsync = (_Err) => async (schema, value, _ctx) => {
531
+ const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
532
+ return _parseAsync(_Err)(schema, value, ctx);
533
+ };
534
+ const encodeAsync$1 = /* @__PURE__ */ _encodeAsync($ZodRealError);
535
+ const _decodeAsync = (_Err) => async (schema, value, _ctx) => {
536
+ return _parseAsync(_Err)(schema, value, _ctx);
537
+ };
538
+ const decodeAsync$1 = /* @__PURE__ */ _decodeAsync($ZodRealError);
539
+ const _safeEncode = (_Err) => (schema, value, _ctx) => {
540
+ const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
541
+ return _safeParse(_Err)(schema, value, ctx);
542
+ };
543
+ const safeEncode$1 = /* @__PURE__ */ _safeEncode($ZodRealError);
544
+ const _safeDecode = (_Err) => (schema, value, _ctx) => {
545
+ return _safeParse(_Err)(schema, value, _ctx);
546
+ };
547
+ const safeDecode$1 = /* @__PURE__ */ _safeDecode($ZodRealError);
548
+ const _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
549
+ const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
550
+ return _safeParseAsync(_Err)(schema, value, ctx);
551
+ };
552
+ const safeEncodeAsync$1 = /* @__PURE__ */ _safeEncodeAsync($ZodRealError);
553
+ const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
554
+ return _safeParseAsync(_Err)(schema, value, _ctx);
555
+ };
556
+ const safeDecodeAsync$1 = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
557
+
558
+ //#endregion
559
+ //#region ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/core/regexes.js
560
+ const cuid = /^[cC][^\s-]{8,}$/;
561
+ const cuid2 = /^[0-9a-z]+$/;
562
+ const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
563
+ const xid = /^[0-9a-vA-V]{20}$/;
564
+ const ksuid = /^[A-Za-z0-9]{27}$/;
565
+ const nanoid = /^[a-zA-Z0-9_-]{21}$/;
566
+ /** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */
567
+ const duration$1 = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
568
+ /** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */
569
+ const guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
570
+ /** Returns a regex for validating an RFC 9562/4122 UUID.
571
+ *
572
+ * @param version Optionally specify a version 1-8. If no version is specified, all versions are supported. */
573
+ const uuid = (version$1) => {
574
+ if (!version$1) return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
575
+ return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version$1}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
576
+ };
577
+ /** Practical email validation */
578
+ const email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
579
+ const _emoji$1 = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
580
+ function emoji() {
581
+ return new RegExp(_emoji$1, "u");
582
+ }
583
+ const ipv4 = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
584
+ const ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;
585
+ const cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
586
+ const cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
587
+ const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
588
+ const base64url = /^[A-Za-z0-9_-]*$/;
589
+ const e164 = /^\+(?:[0-9]){6,14}[0-9]$/;
590
+ const dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
591
+ const date$1 = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
592
+ function timeSource(args) {
593
+ const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
594
+ const regex = typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
595
+ return regex;
596
+ }
597
+ function time$1(args) {
598
+ return new RegExp(`^${timeSource(args)}$`);
599
+ }
600
+ function datetime$1(args) {
601
+ const time$2 = timeSource({ precision: args.precision });
602
+ const opts = ["Z"];
603
+ if (args.local) opts.push("");
604
+ if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
605
+ const timeRegex = `${time$2}(?:${opts.join("|")})`;
606
+ return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
607
+ }
608
+ const string$1 = (params) => {
609
+ const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
610
+ return new RegExp(`^${regex}$`);
611
+ };
612
+ const integer = /^-?\d+$/;
613
+ const number$1 = /^-?\d+(?:\.\d+)?/;
614
+ const boolean$1 = /^(?:true|false)$/i;
615
+ const lowercase = /^[^A-Z]*$/;
616
+ const uppercase = /^[^a-z]*$/;
617
+
618
+ //#endregion
619
+ //#region ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/core/checks.js
620
+ const $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
621
+ var _a$1;
622
+ inst._zod ?? (inst._zod = {});
623
+ inst._zod.def = def;
624
+ (_a$1 = inst._zod).onattach ?? (_a$1.onattach = []);
625
+ });
626
+ const numericOriginMap = {
627
+ number: "number",
628
+ bigint: "bigint",
629
+ object: "date"
630
+ };
631
+ const $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst, def) => {
632
+ $ZodCheck.init(inst, def);
633
+ const origin = numericOriginMap[typeof def.value];
634
+ inst._zod.onattach.push((inst$1) => {
635
+ const bag = inst$1._zod.bag;
636
+ const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
637
+ if (def.value < curr) if (def.inclusive) bag.maximum = def.value;
638
+ else bag.exclusiveMaximum = def.value;
639
+ });
640
+ inst._zod.check = (payload) => {
641
+ if (def.inclusive ? payload.value <= def.value : payload.value < def.value) return;
642
+ payload.issues.push({
643
+ origin,
644
+ code: "too_big",
645
+ maximum: def.value,
646
+ input: payload.value,
647
+ inclusive: def.inclusive,
648
+ inst,
649
+ continue: !def.abort
650
+ });
651
+ };
652
+ });
653
+ const $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan", (inst, def) => {
654
+ $ZodCheck.init(inst, def);
655
+ const origin = numericOriginMap[typeof def.value];
656
+ inst._zod.onattach.push((inst$1) => {
657
+ const bag = inst$1._zod.bag;
658
+ const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
659
+ if (def.value > curr) if (def.inclusive) bag.minimum = def.value;
660
+ else bag.exclusiveMinimum = def.value;
661
+ });
662
+ inst._zod.check = (payload) => {
663
+ if (def.inclusive ? payload.value >= def.value : payload.value > def.value) return;
664
+ payload.issues.push({
665
+ origin,
666
+ code: "too_small",
667
+ minimum: def.value,
668
+ input: payload.value,
669
+ inclusive: def.inclusive,
670
+ inst,
671
+ continue: !def.abort
672
+ });
673
+ };
674
+ });
675
+ const $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {
676
+ $ZodCheck.init(inst, def);
677
+ inst._zod.onattach.push((inst$1) => {
678
+ var _a$1;
679
+ (_a$1 = inst$1._zod.bag).multipleOf ?? (_a$1.multipleOf = def.value);
680
+ });
681
+ inst._zod.check = (payload) => {
682
+ if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check.");
683
+ const isMultiple = typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0;
684
+ if (isMultiple) return;
685
+ payload.issues.push({
686
+ origin: typeof payload.value,
687
+ code: "not_multiple_of",
688
+ divisor: def.value,
689
+ input: payload.value,
690
+ inst,
691
+ continue: !def.abort
692
+ });
693
+ };
694
+ });
695
+ const $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat", (inst, def) => {
696
+ $ZodCheck.init(inst, def);
697
+ def.format = def.format || "float64";
698
+ const isInt = def.format?.includes("int");
699
+ const origin = isInt ? "int" : "number";
700
+ const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
701
+ inst._zod.onattach.push((inst$1) => {
702
+ const bag = inst$1._zod.bag;
703
+ bag.format = def.format;
704
+ bag.minimum = minimum;
705
+ bag.maximum = maximum;
706
+ if (isInt) bag.pattern = integer;
707
+ });
708
+ inst._zod.check = (payload) => {
709
+ const input = payload.value;
710
+ if (isInt) {
711
+ if (!Number.isInteger(input)) {
712
+ payload.issues.push({
713
+ expected: origin,
714
+ format: def.format,
715
+ code: "invalid_type",
716
+ continue: false,
717
+ input,
718
+ inst
719
+ });
720
+ return;
721
+ }
722
+ if (!Number.isSafeInteger(input)) {
723
+ if (input > 0) payload.issues.push({
724
+ input,
725
+ code: "too_big",
726
+ maximum: Number.MAX_SAFE_INTEGER,
727
+ note: "Integers must be within the safe integer range.",
728
+ inst,
729
+ origin,
730
+ continue: !def.abort
731
+ });
732
+ else payload.issues.push({
733
+ input,
734
+ code: "too_small",
735
+ minimum: Number.MIN_SAFE_INTEGER,
736
+ note: "Integers must be within the safe integer range.",
737
+ inst,
738
+ origin,
739
+ continue: !def.abort
740
+ });
741
+ return;
742
+ }
743
+ }
744
+ if (input < minimum) payload.issues.push({
745
+ origin: "number",
746
+ input,
747
+ code: "too_small",
748
+ minimum,
749
+ inclusive: true,
750
+ inst,
751
+ continue: !def.abort
752
+ });
753
+ if (input > maximum) payload.issues.push({
754
+ origin: "number",
755
+ input,
756
+ code: "too_big",
757
+ maximum,
758
+ inst
759
+ });
760
+ };
761
+ });
762
+ const $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
763
+ var _a$1;
764
+ $ZodCheck.init(inst, def);
765
+ (_a$1 = inst._zod.def).when ?? (_a$1.when = (payload) => {
766
+ const val = payload.value;
767
+ return !nullish(val) && val.length !== void 0;
768
+ });
769
+ inst._zod.onattach.push((inst$1) => {
770
+ const curr = inst$1._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
771
+ if (def.maximum < curr) inst$1._zod.bag.maximum = def.maximum;
772
+ });
773
+ inst._zod.check = (payload) => {
774
+ const input = payload.value;
775
+ const length = input.length;
776
+ if (length <= def.maximum) return;
777
+ const origin = getLengthableOrigin(input);
778
+ payload.issues.push({
779
+ origin,
780
+ code: "too_big",
781
+ maximum: def.maximum,
782
+ inclusive: true,
783
+ input,
784
+ inst,
785
+ continue: !def.abort
786
+ });
787
+ };
788
+ });
789
+ const $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
790
+ var _a$1;
791
+ $ZodCheck.init(inst, def);
792
+ (_a$1 = inst._zod.def).when ?? (_a$1.when = (payload) => {
793
+ const val = payload.value;
794
+ return !nullish(val) && val.length !== void 0;
795
+ });
796
+ inst._zod.onattach.push((inst$1) => {
797
+ const curr = inst$1._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
798
+ if (def.minimum > curr) inst$1._zod.bag.minimum = def.minimum;
799
+ });
800
+ inst._zod.check = (payload) => {
801
+ const input = payload.value;
802
+ const length = input.length;
803
+ if (length >= def.minimum) return;
804
+ const origin = getLengthableOrigin(input);
805
+ payload.issues.push({
806
+ origin,
807
+ code: "too_small",
808
+ minimum: def.minimum,
809
+ inclusive: true,
810
+ input,
811
+ inst,
812
+ continue: !def.abort
813
+ });
814
+ };
815
+ });
816
+ const $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
817
+ var _a$1;
818
+ $ZodCheck.init(inst, def);
819
+ (_a$1 = inst._zod.def).when ?? (_a$1.when = (payload) => {
820
+ const val = payload.value;
821
+ return !nullish(val) && val.length !== void 0;
822
+ });
823
+ inst._zod.onattach.push((inst$1) => {
824
+ const bag = inst$1._zod.bag;
825
+ bag.minimum = def.length;
826
+ bag.maximum = def.length;
827
+ bag.length = def.length;
828
+ });
829
+ inst._zod.check = (payload) => {
830
+ const input = payload.value;
831
+ const length = input.length;
832
+ if (length === def.length) return;
833
+ const origin = getLengthableOrigin(input);
834
+ const tooBig = length > def.length;
835
+ payload.issues.push({
836
+ origin,
837
+ ...tooBig ? {
838
+ code: "too_big",
839
+ maximum: def.length
840
+ } : {
841
+ code: "too_small",
842
+ minimum: def.length
843
+ },
844
+ inclusive: true,
845
+ exact: true,
846
+ input: payload.value,
847
+ inst,
848
+ continue: !def.abort
849
+ });
850
+ };
851
+ });
852
+ const $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
853
+ var _a$1, _b;
854
+ $ZodCheck.init(inst, def);
855
+ inst._zod.onattach.push((inst$1) => {
856
+ const bag = inst$1._zod.bag;
857
+ bag.format = def.format;
858
+ if (def.pattern) {
859
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
860
+ bag.patterns.add(def.pattern);
861
+ }
862
+ });
863
+ if (def.pattern) (_a$1 = inst._zod).check ?? (_a$1.check = (payload) => {
864
+ def.pattern.lastIndex = 0;
865
+ if (def.pattern.test(payload.value)) return;
866
+ payload.issues.push({
867
+ origin: "string",
868
+ code: "invalid_format",
869
+ format: def.format,
870
+ input: payload.value,
871
+ ...def.pattern ? { pattern: def.pattern.toString() } : {},
872
+ inst,
873
+ continue: !def.abort
874
+ });
875
+ });
876
+ else (_b = inst._zod).check ?? (_b.check = () => {});
877
+ });
878
+ const $ZodCheckRegex = /* @__PURE__ */ $constructor("$ZodCheckRegex", (inst, def) => {
879
+ $ZodCheckStringFormat.init(inst, def);
880
+ inst._zod.check = (payload) => {
881
+ def.pattern.lastIndex = 0;
882
+ if (def.pattern.test(payload.value)) return;
883
+ payload.issues.push({
884
+ origin: "string",
885
+ code: "invalid_format",
886
+ format: "regex",
887
+ input: payload.value,
888
+ pattern: def.pattern.toString(),
889
+ inst,
890
+ continue: !def.abort
891
+ });
892
+ };
893
+ });
894
+ const $ZodCheckLowerCase = /* @__PURE__ */ $constructor("$ZodCheckLowerCase", (inst, def) => {
895
+ def.pattern ?? (def.pattern = lowercase);
896
+ $ZodCheckStringFormat.init(inst, def);
897
+ });
898
+ const $ZodCheckUpperCase = /* @__PURE__ */ $constructor("$ZodCheckUpperCase", (inst, def) => {
899
+ def.pattern ?? (def.pattern = uppercase);
900
+ $ZodCheckStringFormat.init(inst, def);
901
+ });
902
+ const $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (inst, def) => {
903
+ $ZodCheck.init(inst, def);
904
+ const escapedRegex = escapeRegex(def.includes);
905
+ const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
906
+ def.pattern = pattern;
907
+ inst._zod.onattach.push((inst$1) => {
908
+ const bag = inst$1._zod.bag;
909
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
910
+ bag.patterns.add(pattern);
911
+ });
912
+ inst._zod.check = (payload) => {
913
+ if (payload.value.includes(def.includes, def.position)) return;
914
+ payload.issues.push({
915
+ origin: "string",
916
+ code: "invalid_format",
917
+ format: "includes",
918
+ includes: def.includes,
919
+ input: payload.value,
920
+ inst,
921
+ continue: !def.abort
922
+ });
923
+ };
924
+ });
925
+ const $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith", (inst, def) => {
926
+ $ZodCheck.init(inst, def);
927
+ const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
928
+ def.pattern ?? (def.pattern = pattern);
929
+ inst._zod.onattach.push((inst$1) => {
930
+ const bag = inst$1._zod.bag;
931
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
932
+ bag.patterns.add(pattern);
933
+ });
934
+ inst._zod.check = (payload) => {
935
+ if (payload.value.startsWith(def.prefix)) return;
936
+ payload.issues.push({
937
+ origin: "string",
938
+ code: "invalid_format",
939
+ format: "starts_with",
940
+ prefix: def.prefix,
941
+ input: payload.value,
942
+ inst,
943
+ continue: !def.abort
944
+ });
945
+ };
946
+ });
947
+ const $ZodCheckEndsWith = /* @__PURE__ */ $constructor("$ZodCheckEndsWith", (inst, def) => {
948
+ $ZodCheck.init(inst, def);
949
+ const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
950
+ def.pattern ?? (def.pattern = pattern);
951
+ inst._zod.onattach.push((inst$1) => {
952
+ const bag = inst$1._zod.bag;
953
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
954
+ bag.patterns.add(pattern);
955
+ });
956
+ inst._zod.check = (payload) => {
957
+ if (payload.value.endsWith(def.suffix)) return;
958
+ payload.issues.push({
959
+ origin: "string",
960
+ code: "invalid_format",
961
+ format: "ends_with",
962
+ suffix: def.suffix,
963
+ input: payload.value,
964
+ inst,
965
+ continue: !def.abort
966
+ });
967
+ };
968
+ });
969
+ const $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (inst, def) => {
970
+ $ZodCheck.init(inst, def);
971
+ inst._zod.check = (payload) => {
972
+ payload.value = def.tx(payload.value);
973
+ };
974
+ });
975
+
976
+ //#endregion
977
+ //#region ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/core/doc.js
978
+ var Doc = class {
979
+ constructor(args = []) {
980
+ this.content = [];
981
+ this.indent = 0;
982
+ if (this) this.args = args;
983
+ }
984
+ indented(fn) {
985
+ this.indent += 1;
986
+ fn(this);
987
+ this.indent -= 1;
988
+ }
989
+ write(arg) {
990
+ if (typeof arg === "function") {
991
+ arg(this, { execution: "sync" });
992
+ arg(this, { execution: "async" });
993
+ return;
994
+ }
995
+ const content = arg;
996
+ const lines = content.split("\n").filter((x) => x);
997
+ const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));
998
+ const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
999
+ for (const line of dedented) this.content.push(line);
1000
+ }
1001
+ compile() {
1002
+ const F = Function;
1003
+ const args = this?.args;
1004
+ const content = this?.content ?? [``];
1005
+ const lines = [...content.map((x) => ` ${x}`)];
1006
+ return new F(...args, lines.join("\n"));
1007
+ }
1008
+ };
1009
+
1010
+ //#endregion
1011
+ //#region ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/core/versions.js
1012
+ const version = {
1013
+ major: 4,
1014
+ minor: 1,
1015
+ patch: 13
1016
+ };
1017
+
1018
+ //#endregion
1019
+ //#region ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/core/schemas.js
1020
+ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
1021
+ var _a$1;
1022
+ inst ?? (inst = {});
1023
+ inst._zod.def = def;
1024
+ inst._zod.bag = inst._zod.bag || {};
1025
+ inst._zod.version = version;
1026
+ const checks = [...inst._zod.def.checks ?? []];
1027
+ if (inst._zod.traits.has("$ZodCheck")) checks.unshift(inst);
1028
+ for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
1029
+ if (checks.length === 0) {
1030
+ (_a$1 = inst._zod).deferred ?? (_a$1.deferred = []);
1031
+ inst._zod.deferred?.push(() => {
1032
+ inst._zod.run = inst._zod.parse;
1033
+ });
1034
+ } else {
1035
+ const runChecks = (payload, checks$1, ctx) => {
1036
+ let isAborted = aborted(payload);
1037
+ let asyncResult;
1038
+ for (const ch of checks$1) {
1039
+ if (ch._zod.def.when) {
1040
+ const shouldRun = ch._zod.def.when(payload);
1041
+ if (!shouldRun) continue;
1042
+ } else if (isAborted) continue;
1043
+ const currLen = payload.issues.length;
1044
+ const _ = ch._zod.check(payload);
1045
+ if (_ instanceof Promise && ctx?.async === false) throw new $ZodAsyncError();
1046
+ if (asyncResult || _ instanceof Promise) asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
1047
+ await _;
1048
+ const nextLen = payload.issues.length;
1049
+ if (nextLen === currLen) return;
1050
+ if (!isAborted) isAborted = aborted(payload, currLen);
1051
+ });
1052
+ else {
1053
+ const nextLen = payload.issues.length;
1054
+ if (nextLen === currLen) continue;
1055
+ if (!isAborted) isAborted = aborted(payload, currLen);
1056
+ }
1057
+ }
1058
+ if (asyncResult) return asyncResult.then(() => {
1059
+ return payload;
1060
+ });
1061
+ return payload;
1062
+ };
1063
+ const handleCanaryResult = (canary, payload, ctx) => {
1064
+ if (aborted(canary)) {
1065
+ canary.aborted = true;
1066
+ return canary;
1067
+ }
1068
+ const checkResult = runChecks(payload, checks, ctx);
1069
+ if (checkResult instanceof Promise) {
1070
+ if (ctx.async === false) throw new $ZodAsyncError();
1071
+ return checkResult.then((checkResult$1) => inst._zod.parse(checkResult$1, ctx));
1072
+ }
1073
+ return inst._zod.parse(checkResult, ctx);
1074
+ };
1075
+ inst._zod.run = (payload, ctx) => {
1076
+ if (ctx.skipChecks) return inst._zod.parse(payload, ctx);
1077
+ if (ctx.direction === "backward") {
1078
+ const canary = inst._zod.parse({
1079
+ value: payload.value,
1080
+ issues: []
1081
+ }, {
1082
+ ...ctx,
1083
+ skipChecks: true
1084
+ });
1085
+ if (canary instanceof Promise) return canary.then((canary$1) => {
1086
+ return handleCanaryResult(canary$1, payload, ctx);
1087
+ });
1088
+ return handleCanaryResult(canary, payload, ctx);
1089
+ }
1090
+ const result = inst._zod.parse(payload, ctx);
1091
+ if (result instanceof Promise) {
1092
+ if (ctx.async === false) throw new $ZodAsyncError();
1093
+ return result.then((result$1) => runChecks(result$1, checks, ctx));
1094
+ }
1095
+ return runChecks(result, checks, ctx);
1096
+ };
1097
+ }
1098
+ inst["~standard"] = {
1099
+ validate: (value) => {
1100
+ try {
1101
+ const r = safeParse$1(inst, value);
1102
+ return r.success ? { value: r.data } : { issues: r.error?.issues };
1103
+ } catch (_) {
1104
+ return safeParseAsync$1(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
1105
+ }
1106
+ },
1107
+ vendor: "zod",
1108
+ version: 1
1109
+ };
1110
+ });
1111
+ const $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
1112
+ $ZodType.init(inst, def);
1113
+ inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string$1(inst._zod.bag);
1114
+ inst._zod.parse = (payload, _) => {
1115
+ if (def.coerce) try {
1116
+ payload.value = String(payload.value);
1117
+ } catch (_$1) {}
1118
+ if (typeof payload.value === "string") return payload;
1119
+ payload.issues.push({
1120
+ expected: "string",
1121
+ code: "invalid_type",
1122
+ input: payload.value,
1123
+ inst
1124
+ });
1125
+ return payload;
1126
+ };
1127
+ });
1128
+ const $ZodStringFormat = /* @__PURE__ */ $constructor("$ZodStringFormat", (inst, def) => {
1129
+ $ZodCheckStringFormat.init(inst, def);
1130
+ $ZodString.init(inst, def);
1131
+ });
1132
+ const $ZodGUID = /* @__PURE__ */ $constructor("$ZodGUID", (inst, def) => {
1133
+ def.pattern ?? (def.pattern = guid);
1134
+ $ZodStringFormat.init(inst, def);
1135
+ });
1136
+ const $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => {
1137
+ if (def.version) {
1138
+ const versionMap = {
1139
+ v1: 1,
1140
+ v2: 2,
1141
+ v3: 3,
1142
+ v4: 4,
1143
+ v5: 5,
1144
+ v6: 6,
1145
+ v7: 7,
1146
+ v8: 8
1147
+ };
1148
+ const v = versionMap[def.version];
1149
+ if (v === void 0) throw new Error(`Invalid UUID version: "${def.version}"`);
1150
+ def.pattern ?? (def.pattern = uuid(v));
1151
+ } else def.pattern ?? (def.pattern = uuid());
1152
+ $ZodStringFormat.init(inst, def);
1153
+ });
1154
+ const $ZodEmail = /* @__PURE__ */ $constructor("$ZodEmail", (inst, def) => {
1155
+ def.pattern ?? (def.pattern = email);
1156
+ $ZodStringFormat.init(inst, def);
1157
+ });
1158
+ const $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
1159
+ $ZodStringFormat.init(inst, def);
1160
+ inst._zod.check = (payload) => {
1161
+ try {
1162
+ const trimmed = payload.value.trim();
1163
+ const url$1 = new URL(trimmed);
1164
+ if (def.hostname) {
1165
+ def.hostname.lastIndex = 0;
1166
+ if (!def.hostname.test(url$1.hostname)) payload.issues.push({
1167
+ code: "invalid_format",
1168
+ format: "url",
1169
+ note: "Invalid hostname",
1170
+ pattern: def.hostname.source,
1171
+ input: payload.value,
1172
+ inst,
1173
+ continue: !def.abort
1174
+ });
1175
+ }
1176
+ if (def.protocol) {
1177
+ def.protocol.lastIndex = 0;
1178
+ if (!def.protocol.test(url$1.protocol.endsWith(":") ? url$1.protocol.slice(0, -1) : url$1.protocol)) payload.issues.push({
1179
+ code: "invalid_format",
1180
+ format: "url",
1181
+ note: "Invalid protocol",
1182
+ pattern: def.protocol.source,
1183
+ input: payload.value,
1184
+ inst,
1185
+ continue: !def.abort
1186
+ });
1187
+ }
1188
+ if (def.normalize) payload.value = url$1.href;
1189
+ else payload.value = trimmed;
1190
+ return;
1191
+ } catch (_) {
1192
+ payload.issues.push({
1193
+ code: "invalid_format",
1194
+ format: "url",
1195
+ input: payload.value,
1196
+ inst,
1197
+ continue: !def.abort
1198
+ });
1199
+ }
1200
+ };
1201
+ });
1202
+ const $ZodEmoji = /* @__PURE__ */ $constructor("$ZodEmoji", (inst, def) => {
1203
+ def.pattern ?? (def.pattern = emoji());
1204
+ $ZodStringFormat.init(inst, def);
1205
+ });
1206
+ const $ZodNanoID = /* @__PURE__ */ $constructor("$ZodNanoID", (inst, def) => {
1207
+ def.pattern ?? (def.pattern = nanoid);
1208
+ $ZodStringFormat.init(inst, def);
1209
+ });
1210
+ const $ZodCUID = /* @__PURE__ */ $constructor("$ZodCUID", (inst, def) => {
1211
+ def.pattern ?? (def.pattern = cuid);
1212
+ $ZodStringFormat.init(inst, def);
1213
+ });
1214
+ const $ZodCUID2 = /* @__PURE__ */ $constructor("$ZodCUID2", (inst, def) => {
1215
+ def.pattern ?? (def.pattern = cuid2);
1216
+ $ZodStringFormat.init(inst, def);
1217
+ });
1218
+ const $ZodULID = /* @__PURE__ */ $constructor("$ZodULID", (inst, def) => {
1219
+ def.pattern ?? (def.pattern = ulid);
1220
+ $ZodStringFormat.init(inst, def);
1221
+ });
1222
+ const $ZodXID = /* @__PURE__ */ $constructor("$ZodXID", (inst, def) => {
1223
+ def.pattern ?? (def.pattern = xid);
1224
+ $ZodStringFormat.init(inst, def);
1225
+ });
1226
+ const $ZodKSUID = /* @__PURE__ */ $constructor("$ZodKSUID", (inst, def) => {
1227
+ def.pattern ?? (def.pattern = ksuid);
1228
+ $ZodStringFormat.init(inst, def);
1229
+ });
1230
+ const $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, def) => {
1231
+ def.pattern ?? (def.pattern = datetime$1(def));
1232
+ $ZodStringFormat.init(inst, def);
1233
+ });
1234
+ const $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => {
1235
+ def.pattern ?? (def.pattern = date$1);
1236
+ $ZodStringFormat.init(inst, def);
1237
+ });
1238
+ const $ZodISOTime = /* @__PURE__ */ $constructor("$ZodISOTime", (inst, def) => {
1239
+ def.pattern ?? (def.pattern = time$1(def));
1240
+ $ZodStringFormat.init(inst, def);
1241
+ });
1242
+ const $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def) => {
1243
+ def.pattern ?? (def.pattern = duration$1);
1244
+ $ZodStringFormat.init(inst, def);
1245
+ });
1246
+ const $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
1247
+ def.pattern ?? (def.pattern = ipv4);
1248
+ $ZodStringFormat.init(inst, def);
1249
+ inst._zod.bag.format = `ipv4`;
1250
+ });
1251
+ const $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
1252
+ def.pattern ?? (def.pattern = ipv6);
1253
+ $ZodStringFormat.init(inst, def);
1254
+ inst._zod.bag.format = `ipv6`;
1255
+ inst._zod.check = (payload) => {
1256
+ try {
1257
+ new URL(`http://[${payload.value}]`);
1258
+ } catch {
1259
+ payload.issues.push({
1260
+ code: "invalid_format",
1261
+ format: "ipv6",
1262
+ input: payload.value,
1263
+ inst,
1264
+ continue: !def.abort
1265
+ });
1266
+ }
1267
+ };
1268
+ });
1269
+ const $ZodCIDRv4 = /* @__PURE__ */ $constructor("$ZodCIDRv4", (inst, def) => {
1270
+ def.pattern ?? (def.pattern = cidrv4);
1271
+ $ZodStringFormat.init(inst, def);
1272
+ });
1273
+ const $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
1274
+ def.pattern ?? (def.pattern = cidrv6);
1275
+ $ZodStringFormat.init(inst, def);
1276
+ inst._zod.check = (payload) => {
1277
+ const parts = payload.value.split("/");
1278
+ try {
1279
+ if (parts.length !== 2) throw new Error();
1280
+ const [address, prefix] = parts;
1281
+ if (!prefix) throw new Error();
1282
+ const prefixNum = Number(prefix);
1283
+ if (`${prefixNum}` !== prefix) throw new Error();
1284
+ if (prefixNum < 0 || prefixNum > 128) throw new Error();
1285
+ new URL(`http://[${address}]`);
1286
+ } catch {
1287
+ payload.issues.push({
1288
+ code: "invalid_format",
1289
+ format: "cidrv6",
1290
+ input: payload.value,
1291
+ inst,
1292
+ continue: !def.abort
1293
+ });
1294
+ }
1295
+ };
1296
+ });
1297
+ function isValidBase64(data) {
1298
+ if (data === "") return true;
1299
+ if (data.length % 4 !== 0) return false;
1300
+ try {
1301
+ atob(data);
1302
+ return true;
1303
+ } catch {
1304
+ return false;
1305
+ }
1306
+ }
1307
+ const $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
1308
+ def.pattern ?? (def.pattern = base64);
1309
+ $ZodStringFormat.init(inst, def);
1310
+ inst._zod.bag.contentEncoding = "base64";
1311
+ inst._zod.check = (payload) => {
1312
+ if (isValidBase64(payload.value)) return;
1313
+ payload.issues.push({
1314
+ code: "invalid_format",
1315
+ format: "base64",
1316
+ input: payload.value,
1317
+ inst,
1318
+ continue: !def.abort
1319
+ });
1320
+ };
1321
+ });
1322
+ function isValidBase64URL(data) {
1323
+ if (!base64url.test(data)) return false;
1324
+ const base64$1 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
1325
+ const padded = base64$1.padEnd(Math.ceil(base64$1.length / 4) * 4, "=");
1326
+ return isValidBase64(padded);
1327
+ }
1328
+ const $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
1329
+ def.pattern ?? (def.pattern = base64url);
1330
+ $ZodStringFormat.init(inst, def);
1331
+ inst._zod.bag.contentEncoding = "base64url";
1332
+ inst._zod.check = (payload) => {
1333
+ if (isValidBase64URL(payload.value)) return;
1334
+ payload.issues.push({
1335
+ code: "invalid_format",
1336
+ format: "base64url",
1337
+ input: payload.value,
1338
+ inst,
1339
+ continue: !def.abort
1340
+ });
1341
+ };
1342
+ });
1343
+ const $ZodE164 = /* @__PURE__ */ $constructor("$ZodE164", (inst, def) => {
1344
+ def.pattern ?? (def.pattern = e164);
1345
+ $ZodStringFormat.init(inst, def);
1346
+ });
1347
+ function isValidJWT(token, algorithm = null) {
1348
+ try {
1349
+ const tokensParts = token.split(".");
1350
+ if (tokensParts.length !== 3) return false;
1351
+ const [header] = tokensParts;
1352
+ if (!header) return false;
1353
+ const parsedHeader = JSON.parse(atob(header));
1354
+ if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT") return false;
1355
+ if (!parsedHeader.alg) return false;
1356
+ if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm)) return false;
1357
+ return true;
1358
+ } catch {
1359
+ return false;
1360
+ }
1361
+ }
1362
+ const $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {
1363
+ $ZodStringFormat.init(inst, def);
1364
+ inst._zod.check = (payload) => {
1365
+ if (isValidJWT(payload.value, def.alg)) return;
1366
+ payload.issues.push({
1367
+ code: "invalid_format",
1368
+ format: "jwt",
1369
+ input: payload.value,
1370
+ inst,
1371
+ continue: !def.abort
1372
+ });
1373
+ };
1374
+ });
1375
+ const $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
1376
+ $ZodType.init(inst, def);
1377
+ inst._zod.pattern = inst._zod.bag.pattern ?? number$1;
1378
+ inst._zod.parse = (payload, _ctx) => {
1379
+ if (def.coerce) try {
1380
+ payload.value = Number(payload.value);
1381
+ } catch (_) {}
1382
+ const input = payload.value;
1383
+ if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) return payload;
1384
+ const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : void 0 : void 0;
1385
+ payload.issues.push({
1386
+ expected: "number",
1387
+ code: "invalid_type",
1388
+ input,
1389
+ inst,
1390
+ ...received ? { received } : {}
1391
+ });
1392
+ return payload;
1393
+ };
1394
+ });
1395
+ const $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst, def) => {
1396
+ $ZodCheckNumberFormat.init(inst, def);
1397
+ $ZodNumber.init(inst, def);
1398
+ });
1399
+ const $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
1400
+ $ZodType.init(inst, def);
1401
+ inst._zod.pattern = boolean$1;
1402
+ inst._zod.parse = (payload, _ctx) => {
1403
+ if (def.coerce) try {
1404
+ payload.value = Boolean(payload.value);
1405
+ } catch (_) {}
1406
+ const input = payload.value;
1407
+ if (typeof input === "boolean") return payload;
1408
+ payload.issues.push({
1409
+ expected: "boolean",
1410
+ code: "invalid_type",
1411
+ input,
1412
+ inst
1413
+ });
1414
+ return payload;
1415
+ };
1416
+ });
1417
+ const $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
1418
+ $ZodType.init(inst, def);
1419
+ inst._zod.parse = (payload) => payload;
1420
+ });
1421
+ const $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
1422
+ $ZodType.init(inst, def);
1423
+ inst._zod.parse = (payload, _ctx) => {
1424
+ payload.issues.push({
1425
+ expected: "never",
1426
+ code: "invalid_type",
1427
+ input: payload.value,
1428
+ inst
1429
+ });
1430
+ return payload;
1431
+ };
1432
+ });
1433
+ function handleArrayResult(result, final, index) {
1434
+ if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
1435
+ final.value[index] = result.value;
1436
+ }
1437
+ const $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
1438
+ $ZodType.init(inst, def);
1439
+ inst._zod.parse = (payload, ctx) => {
1440
+ const input = payload.value;
1441
+ if (!Array.isArray(input)) {
1442
+ payload.issues.push({
1443
+ expected: "array",
1444
+ code: "invalid_type",
1445
+ input,
1446
+ inst
1447
+ });
1448
+ return payload;
1449
+ }
1450
+ payload.value = Array(input.length);
1451
+ const proms = [];
1452
+ for (let i = 0; i < input.length; i++) {
1453
+ const item = input[i];
1454
+ const result = def.element._zod.run({
1455
+ value: item,
1456
+ issues: []
1457
+ }, ctx);
1458
+ if (result instanceof Promise) proms.push(result.then((result$1) => handleArrayResult(result$1, payload, i)));
1459
+ else handleArrayResult(result, payload, i);
1460
+ }
1461
+ if (proms.length) return Promise.all(proms).then(() => payload);
1462
+ return payload;
1463
+ };
1464
+ });
1465
+ function handlePropertyResult(result, final, key, input) {
1466
+ if (result.issues.length) final.issues.push(...prefixIssues(key, result.issues));
1467
+ if (result.value === void 0) {
1468
+ if (key in input) final.value[key] = void 0;
1469
+ } else final.value[key] = result.value;
1470
+ }
1471
+ function normalizeDef(def) {
1472
+ const keys = Object.keys(def.shape);
1473
+ for (const k of keys) if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
1474
+ const okeys = optionalKeys(def.shape);
1475
+ return {
1476
+ ...def,
1477
+ keys,
1478
+ keySet: new Set(keys),
1479
+ numKeys: keys.length,
1480
+ optionalKeys: new Set(okeys)
1481
+ };
1482
+ }
1483
+ function handleCatchall(proms, input, payload, ctx, def, inst) {
1484
+ const unrecognized = [];
1485
+ const keySet = def.keySet;
1486
+ const _catchall = def.catchall._zod;
1487
+ const t = _catchall.def.type;
1488
+ for (const key in input) {
1489
+ if (keySet.has(key)) continue;
1490
+ if (t === "never") {
1491
+ unrecognized.push(key);
1492
+ continue;
1493
+ }
1494
+ const r = _catchall.run({
1495
+ value: input[key],
1496
+ issues: []
1497
+ }, ctx);
1498
+ if (r instanceof Promise) proms.push(r.then((r$1) => handlePropertyResult(r$1, payload, key, input)));
1499
+ else handlePropertyResult(r, payload, key, input);
1500
+ }
1501
+ if (unrecognized.length) payload.issues.push({
1502
+ code: "unrecognized_keys",
1503
+ keys: unrecognized,
1504
+ input,
1505
+ inst
1506
+ });
1507
+ if (!proms.length) return payload;
1508
+ return Promise.all(proms).then(() => {
1509
+ return payload;
1510
+ });
1511
+ }
1512
+ const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
1513
+ $ZodType.init(inst, def);
1514
+ const desc = Object.getOwnPropertyDescriptor(def, "shape");
1515
+ if (!desc?.get) {
1516
+ const sh = def.shape;
1517
+ Object.defineProperty(def, "shape", { get: () => {
1518
+ const newSh = { ...sh };
1519
+ Object.defineProperty(def, "shape", { value: newSh });
1520
+ return newSh;
1521
+ } });
1522
+ }
1523
+ const _normalized = cached(() => normalizeDef(def));
1524
+ defineLazy(inst._zod, "propValues", () => {
1525
+ const shape = def.shape;
1526
+ const propValues = {};
1527
+ for (const key in shape) {
1528
+ const field = shape[key]._zod;
1529
+ if (field.values) {
1530
+ propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
1531
+ for (const v of field.values) propValues[key].add(v);
1532
+ }
1533
+ }
1534
+ return propValues;
1535
+ });
1536
+ const isObject$1 = isObject;
1537
+ const catchall = def.catchall;
1538
+ let value;
1539
+ inst._zod.parse = (payload, ctx) => {
1540
+ value ?? (value = _normalized.value);
1541
+ const input = payload.value;
1542
+ if (!isObject$1(input)) {
1543
+ payload.issues.push({
1544
+ expected: "object",
1545
+ code: "invalid_type",
1546
+ input,
1547
+ inst
1548
+ });
1549
+ return payload;
1550
+ }
1551
+ payload.value = {};
1552
+ const proms = [];
1553
+ const shape = value.shape;
1554
+ for (const key of value.keys) {
1555
+ const el = shape[key];
1556
+ const r = el._zod.run({
1557
+ value: input[key],
1558
+ issues: []
1559
+ }, ctx);
1560
+ if (r instanceof Promise) proms.push(r.then((r$1) => handlePropertyResult(r$1, payload, key, input)));
1561
+ else handlePropertyResult(r, payload, key, input);
1562
+ }
1563
+ if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
1564
+ return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
1565
+ };
1566
+ });
1567
+ const $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
1568
+ $ZodObject.init(inst, def);
1569
+ const superParse = inst._zod.parse;
1570
+ const _normalized = cached(() => normalizeDef(def));
1571
+ const generateFastpass = (shape) => {
1572
+ const doc = new Doc([
1573
+ "shape",
1574
+ "payload",
1575
+ "ctx"
1576
+ ]);
1577
+ const normalized = _normalized.value;
1578
+ const parseStr = (key) => {
1579
+ const k = esc(key);
1580
+ return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
1581
+ };
1582
+ doc.write(`const input = payload.value;`);
1583
+ const ids = Object.create(null);
1584
+ let counter = 0;
1585
+ for (const key of normalized.keys) ids[key] = `key_${counter++}`;
1586
+ doc.write(`const newResult = {};`);
1587
+ for (const key of normalized.keys) {
1588
+ const id = ids[key];
1589
+ const k = esc(key);
1590
+ doc.write(`const ${id} = ${parseStr(key)};`);
1591
+ doc.write(`
1592
+ if (${id}.issues.length) {
1593
+ payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1594
+ ...iss,
1595
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
1596
+ })));
1597
+ }
1598
+
1599
+
1600
+ if (${id}.value === undefined) {
1601
+ if (${k} in input) {
1602
+ newResult[${k}] = undefined;
1603
+ }
1604
+ } else {
1605
+ newResult[${k}] = ${id}.value;
1606
+ }
1607
+
1608
+ `);
1609
+ }
1610
+ doc.write(`payload.value = newResult;`);
1611
+ doc.write(`return payload;`);
1612
+ const fn = doc.compile();
1613
+ return (payload, ctx) => fn(shape, payload, ctx);
1614
+ };
1615
+ let fastpass;
1616
+ const isObject$1 = isObject;
1617
+ const jit = !globalConfig.jitless;
1618
+ const allowsEval$1 = allowsEval;
1619
+ const fastEnabled = jit && allowsEval$1.value;
1620
+ const catchall = def.catchall;
1621
+ let value;
1622
+ inst._zod.parse = (payload, ctx) => {
1623
+ value ?? (value = _normalized.value);
1624
+ const input = payload.value;
1625
+ if (!isObject$1(input)) {
1626
+ payload.issues.push({
1627
+ expected: "object",
1628
+ code: "invalid_type",
1629
+ input,
1630
+ inst
1631
+ });
1632
+ return payload;
1633
+ }
1634
+ if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
1635
+ if (!fastpass) fastpass = generateFastpass(def.shape);
1636
+ payload = fastpass(payload, ctx);
1637
+ if (!catchall) return payload;
1638
+ return handleCatchall([], input, payload, ctx, value, inst);
1639
+ }
1640
+ return superParse(payload, ctx);
1641
+ };
1642
+ });
1643
+ function handleUnionResults(results, final, inst, ctx) {
1644
+ for (const result of results) if (result.issues.length === 0) {
1645
+ final.value = result.value;
1646
+ return final;
1647
+ }
1648
+ const nonaborted = results.filter((r) => !aborted(r));
1649
+ if (nonaborted.length === 1) {
1650
+ final.value = nonaborted[0].value;
1651
+ return nonaborted[0];
1652
+ }
1653
+ final.issues.push({
1654
+ code: "invalid_union",
1655
+ input: final.value,
1656
+ inst,
1657
+ errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
1658
+ });
1659
+ return final;
1660
+ }
1661
+ const $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
1662
+ $ZodType.init(inst, def);
1663
+ defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0);
1664
+ defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
1665
+ defineLazy(inst._zod, "values", () => {
1666
+ if (def.options.every((o) => o._zod.values)) return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
1667
+ return void 0;
1668
+ });
1669
+ defineLazy(inst._zod, "pattern", () => {
1670
+ if (def.options.every((o) => o._zod.pattern)) {
1671
+ const patterns = def.options.map((o) => o._zod.pattern);
1672
+ return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
1673
+ }
1674
+ return void 0;
1675
+ });
1676
+ const single = def.options.length === 1;
1677
+ const first = def.options[0]._zod.run;
1678
+ inst._zod.parse = (payload, ctx) => {
1679
+ if (single) return first(payload, ctx);
1680
+ let async = false;
1681
+ const results = [];
1682
+ for (const option of def.options) {
1683
+ const result = option._zod.run({
1684
+ value: payload.value,
1685
+ issues: []
1686
+ }, ctx);
1687
+ if (result instanceof Promise) {
1688
+ results.push(result);
1689
+ async = true;
1690
+ } else {
1691
+ if (result.issues.length === 0) return result;
1692
+ results.push(result);
1693
+ }
1694
+ }
1695
+ if (!async) return handleUnionResults(results, payload, inst, ctx);
1696
+ return Promise.all(results).then((results$1) => {
1697
+ return handleUnionResults(results$1, payload, inst, ctx);
1698
+ });
1699
+ };
1700
+ });
1701
+ const $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
1702
+ $ZodType.init(inst, def);
1703
+ inst._zod.parse = (payload, ctx) => {
1704
+ const input = payload.value;
1705
+ const left = def.left._zod.run({
1706
+ value: input,
1707
+ issues: []
1708
+ }, ctx);
1709
+ const right = def.right._zod.run({
1710
+ value: input,
1711
+ issues: []
1712
+ }, ctx);
1713
+ const async = left instanceof Promise || right instanceof Promise;
1714
+ if (async) return Promise.all([left, right]).then(([left$1, right$1]) => {
1715
+ return handleIntersectionResults(payload, left$1, right$1);
1716
+ });
1717
+ return handleIntersectionResults(payload, left, right);
1718
+ };
1719
+ });
1720
+ function mergeValues(a, b) {
1721
+ if (a === b) return {
1722
+ valid: true,
1723
+ data: a
1724
+ };
1725
+ if (a instanceof Date && b instanceof Date && +a === +b) return {
1726
+ valid: true,
1727
+ data: a
1728
+ };
1729
+ if (isPlainObject(a) && isPlainObject(b)) {
1730
+ const bKeys = Object.keys(b);
1731
+ const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
1732
+ const newObj = {
1733
+ ...a,
1734
+ ...b
1735
+ };
1736
+ for (const key of sharedKeys) {
1737
+ const sharedValue = mergeValues(a[key], b[key]);
1738
+ if (!sharedValue.valid) return {
1739
+ valid: false,
1740
+ mergeErrorPath: [key, ...sharedValue.mergeErrorPath]
1741
+ };
1742
+ newObj[key] = sharedValue.data;
1743
+ }
1744
+ return {
1745
+ valid: true,
1746
+ data: newObj
1747
+ };
1748
+ }
1749
+ if (Array.isArray(a) && Array.isArray(b)) {
1750
+ if (a.length !== b.length) return {
1751
+ valid: false,
1752
+ mergeErrorPath: []
1753
+ };
1754
+ const newArray = [];
1755
+ for (let index = 0; index < a.length; index++) {
1756
+ const itemA = a[index];
1757
+ const itemB = b[index];
1758
+ const sharedValue = mergeValues(itemA, itemB);
1759
+ if (!sharedValue.valid) return {
1760
+ valid: false,
1761
+ mergeErrorPath: [index, ...sharedValue.mergeErrorPath]
1762
+ };
1763
+ newArray.push(sharedValue.data);
1764
+ }
1765
+ return {
1766
+ valid: true,
1767
+ data: newArray
1768
+ };
1769
+ }
1770
+ return {
1771
+ valid: false,
1772
+ mergeErrorPath: []
1773
+ };
1774
+ }
1775
+ function handleIntersectionResults(result, left, right) {
1776
+ if (left.issues.length) result.issues.push(...left.issues);
1777
+ if (right.issues.length) result.issues.push(...right.issues);
1778
+ if (aborted(result)) return result;
1779
+ const merged = mergeValues(left.value, right.value);
1780
+ if (!merged.valid) throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
1781
+ result.value = merged.data;
1782
+ return result;
1783
+ }
1784
+ const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
1785
+ $ZodType.init(inst, def);
1786
+ inst._zod.parse = (payload, ctx) => {
1787
+ const input = payload.value;
1788
+ if (!isPlainObject(input)) {
1789
+ payload.issues.push({
1790
+ expected: "record",
1791
+ code: "invalid_type",
1792
+ input,
1793
+ inst
1794
+ });
1795
+ return payload;
1796
+ }
1797
+ const proms = [];
1798
+ const values = def.keyType._zod.values;
1799
+ if (values) {
1800
+ payload.value = {};
1801
+ const recordKeys = /* @__PURE__ */ new Set();
1802
+ for (const key of values) if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
1803
+ recordKeys.add(typeof key === "number" ? key.toString() : key);
1804
+ const result = def.valueType._zod.run({
1805
+ value: input[key],
1806
+ issues: []
1807
+ }, ctx);
1808
+ if (result instanceof Promise) proms.push(result.then((result$1) => {
1809
+ if (result$1.issues.length) payload.issues.push(...prefixIssues(key, result$1.issues));
1810
+ payload.value[key] = result$1.value;
1811
+ }));
1812
+ else {
1813
+ if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
1814
+ payload.value[key] = result.value;
1815
+ }
1816
+ }
1817
+ let unrecognized;
1818
+ for (const key in input) if (!recordKeys.has(key)) {
1819
+ unrecognized = unrecognized ?? [];
1820
+ unrecognized.push(key);
1821
+ }
1822
+ if (unrecognized && unrecognized.length > 0) payload.issues.push({
1823
+ code: "unrecognized_keys",
1824
+ input,
1825
+ inst,
1826
+ keys: unrecognized
1827
+ });
1828
+ } else {
1829
+ payload.value = {};
1830
+ for (const key of Reflect.ownKeys(input)) {
1831
+ if (key === "__proto__") continue;
1832
+ const keyResult = def.keyType._zod.run({
1833
+ value: key,
1834
+ issues: []
1835
+ }, ctx);
1836
+ if (keyResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
1837
+ if (keyResult.issues.length) {
1838
+ payload.issues.push({
1839
+ code: "invalid_key",
1840
+ origin: "record",
1841
+ issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
1842
+ input: key,
1843
+ path: [key],
1844
+ inst
1845
+ });
1846
+ payload.value[keyResult.value] = keyResult.value;
1847
+ continue;
1848
+ }
1849
+ const result = def.valueType._zod.run({
1850
+ value: input[key],
1851
+ issues: []
1852
+ }, ctx);
1853
+ if (result instanceof Promise) proms.push(result.then((result$1) => {
1854
+ if (result$1.issues.length) payload.issues.push(...prefixIssues(key, result$1.issues));
1855
+ payload.value[keyResult.value] = result$1.value;
1856
+ }));
1857
+ else {
1858
+ if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
1859
+ payload.value[keyResult.value] = result.value;
1860
+ }
1861
+ }
1862
+ }
1863
+ if (proms.length) return Promise.all(proms).then(() => payload);
1864
+ return payload;
1865
+ };
1866
+ });
1867
+ const $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
1868
+ $ZodType.init(inst, def);
1869
+ const values = getEnumValues(def.entries);
1870
+ const valuesSet = new Set(values);
1871
+ inst._zod.values = valuesSet;
1872
+ inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
1873
+ inst._zod.parse = (payload, _ctx) => {
1874
+ const input = payload.value;
1875
+ if (valuesSet.has(input)) return payload;
1876
+ payload.issues.push({
1877
+ code: "invalid_value",
1878
+ values,
1879
+ input,
1880
+ inst
1881
+ });
1882
+ return payload;
1883
+ };
1884
+ });
1885
+ const $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
1886
+ $ZodType.init(inst, def);
1887
+ inst._zod.parse = (payload, ctx) => {
1888
+ if (ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
1889
+ const _out = def.transform(payload.value, payload);
1890
+ if (ctx.async) {
1891
+ const output = _out instanceof Promise ? _out : Promise.resolve(_out);
1892
+ return output.then((output$1) => {
1893
+ payload.value = output$1;
1894
+ return payload;
1895
+ });
1896
+ }
1897
+ if (_out instanceof Promise) throw new $ZodAsyncError();
1898
+ payload.value = _out;
1899
+ return payload;
1900
+ };
1901
+ });
1902
+ function handleOptionalResult(result, input) {
1903
+ if (result.issues.length && input === void 0) return {
1904
+ issues: [],
1905
+ value: void 0
1906
+ };
1907
+ return result;
1908
+ }
1909
+ const $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
1910
+ $ZodType.init(inst, def);
1911
+ inst._zod.optin = "optional";
1912
+ inst._zod.optout = "optional";
1913
+ defineLazy(inst._zod, "values", () => {
1914
+ return def.innerType._zod.values ? new Set([...def.innerType._zod.values, void 0]) : void 0;
1915
+ });
1916
+ defineLazy(inst._zod, "pattern", () => {
1917
+ const pattern = def.innerType._zod.pattern;
1918
+ return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
1919
+ });
1920
+ inst._zod.parse = (payload, ctx) => {
1921
+ if (def.innerType._zod.optin === "optional") {
1922
+ const result = def.innerType._zod.run(payload, ctx);
1923
+ if (result instanceof Promise) return result.then((r) => handleOptionalResult(r, payload.value));
1924
+ return handleOptionalResult(result, payload.value);
1925
+ }
1926
+ if (payload.value === void 0) return payload;
1927
+ return def.innerType._zod.run(payload, ctx);
1928
+ };
1929
+ });
1930
+ const $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
1931
+ $ZodType.init(inst, def);
1932
+ defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
1933
+ defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1934
+ defineLazy(inst._zod, "pattern", () => {
1935
+ const pattern = def.innerType._zod.pattern;
1936
+ return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
1937
+ });
1938
+ defineLazy(inst._zod, "values", () => {
1939
+ return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : void 0;
1940
+ });
1941
+ inst._zod.parse = (payload, ctx) => {
1942
+ if (payload.value === null) return payload;
1943
+ return def.innerType._zod.run(payload, ctx);
1944
+ };
1945
+ });
1946
+ const $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => {
1947
+ $ZodType.init(inst, def);
1948
+ inst._zod.optin = "optional";
1949
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1950
+ inst._zod.parse = (payload, ctx) => {
1951
+ if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
1952
+ if (payload.value === void 0) {
1953
+ payload.value = def.defaultValue;
1954
+ /**
1955
+ * $ZodDefault returns the default value immediately in forward direction.
1956
+ * It doesn't pass the default value into the validator ("prefault"). There's no reason to pass the default value through validation. The validity of the default is enforced by TypeScript statically. Otherwise, it's the responsibility of the user to ensure the default is valid. In the case of pipes with divergent in/out types, you can specify the default on the `in` schema of your ZodPipe to set a "prefault" for the pipe. */
1957
+ return payload;
1958
+ }
1959
+ const result = def.innerType._zod.run(payload, ctx);
1960
+ if (result instanceof Promise) return result.then((result$1) => handleDefaultResult(result$1, def));
1961
+ return handleDefaultResult(result, def);
1962
+ };
1963
+ });
1964
+ function handleDefaultResult(payload, def) {
1965
+ if (payload.value === void 0) payload.value = def.defaultValue;
1966
+ return payload;
1967
+ }
1968
+ const $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
1969
+ $ZodType.init(inst, def);
1970
+ inst._zod.optin = "optional";
1971
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1972
+ inst._zod.parse = (payload, ctx) => {
1973
+ if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
1974
+ if (payload.value === void 0) payload.value = def.defaultValue;
1975
+ return def.innerType._zod.run(payload, ctx);
1976
+ };
1977
+ });
1978
+ const $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {
1979
+ $ZodType.init(inst, def);
1980
+ defineLazy(inst._zod, "values", () => {
1981
+ const v = def.innerType._zod.values;
1982
+ return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
1983
+ });
1984
+ inst._zod.parse = (payload, ctx) => {
1985
+ const result = def.innerType._zod.run(payload, ctx);
1986
+ if (result instanceof Promise) return result.then((result$1) => handleNonOptionalResult(result$1, inst));
1987
+ return handleNonOptionalResult(result, inst);
1988
+ };
1989
+ });
1990
+ function handleNonOptionalResult(payload, inst) {
1991
+ if (!payload.issues.length && payload.value === void 0) payload.issues.push({
1992
+ code: "invalid_type",
1993
+ expected: "nonoptional",
1994
+ input: payload.value,
1995
+ inst
1996
+ });
1997
+ return payload;
1998
+ }
1999
+ const $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
2000
+ $ZodType.init(inst, def);
2001
+ defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
2002
+ defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
2003
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2004
+ inst._zod.parse = (payload, ctx) => {
2005
+ if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
2006
+ const result = def.innerType._zod.run(payload, ctx);
2007
+ if (result instanceof Promise) return result.then((result$1) => {
2008
+ payload.value = result$1.value;
2009
+ if (result$1.issues.length) {
2010
+ payload.value = def.catchValue({
2011
+ ...payload,
2012
+ error: { issues: result$1.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
2013
+ input: payload.value
2014
+ });
2015
+ payload.issues = [];
2016
+ }
2017
+ return payload;
2018
+ });
2019
+ payload.value = result.value;
2020
+ if (result.issues.length) {
2021
+ payload.value = def.catchValue({
2022
+ ...payload,
2023
+ error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
2024
+ input: payload.value
2025
+ });
2026
+ payload.issues = [];
2027
+ }
2028
+ return payload;
2029
+ };
2030
+ });
2031
+ const $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {
2032
+ $ZodType.init(inst, def);
2033
+ defineLazy(inst._zod, "values", () => def.in._zod.values);
2034
+ defineLazy(inst._zod, "optin", () => def.in._zod.optin);
2035
+ defineLazy(inst._zod, "optout", () => def.out._zod.optout);
2036
+ defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
2037
+ inst._zod.parse = (payload, ctx) => {
2038
+ if (ctx.direction === "backward") {
2039
+ const right = def.out._zod.run(payload, ctx);
2040
+ if (right instanceof Promise) return right.then((right$1) => handlePipeResult(right$1, def.in, ctx));
2041
+ return handlePipeResult(right, def.in, ctx);
2042
+ }
2043
+ const left = def.in._zod.run(payload, ctx);
2044
+ if (left instanceof Promise) return left.then((left$1) => handlePipeResult(left$1, def.out, ctx));
2045
+ return handlePipeResult(left, def.out, ctx);
2046
+ };
2047
+ });
2048
+ function handlePipeResult(left, next, ctx) {
2049
+ if (left.issues.length) {
2050
+ left.aborted = true;
2051
+ return left;
2052
+ }
2053
+ return next._zod.run({
2054
+ value: left.value,
2055
+ issues: left.issues
2056
+ }, ctx);
2057
+ }
2058
+ const $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
2059
+ $ZodType.init(inst, def);
2060
+ defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
2061
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2062
+ defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
2063
+ defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
2064
+ inst._zod.parse = (payload, ctx) => {
2065
+ if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
2066
+ const result = def.innerType._zod.run(payload, ctx);
2067
+ if (result instanceof Promise) return result.then(handleReadonlyResult);
2068
+ return handleReadonlyResult(result);
2069
+ };
2070
+ });
2071
+ function handleReadonlyResult(payload) {
2072
+ payload.value = Object.freeze(payload.value);
2073
+ return payload;
2074
+ }
2075
+ const $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
2076
+ $ZodCheck.init(inst, def);
2077
+ $ZodType.init(inst, def);
2078
+ inst._zod.parse = (payload, _) => {
2079
+ return payload;
2080
+ };
2081
+ inst._zod.check = (payload) => {
2082
+ const input = payload.value;
2083
+ const r = def.fn(input);
2084
+ if (r instanceof Promise) return r.then((r$1) => handleRefineResult(r$1, payload, input, inst));
2085
+ handleRefineResult(r, payload, input, inst);
2086
+ return;
2087
+ };
2088
+ });
2089
+ function handleRefineResult(result, payload, input, inst) {
2090
+ if (!result) {
2091
+ const _iss = {
2092
+ code: "custom",
2093
+ input,
2094
+ inst,
2095
+ path: [...inst._zod.def.path ?? []],
2096
+ continue: !inst._zod.def.abort
2097
+ };
2098
+ if (inst._zod.def.params) _iss.params = inst._zod.def.params;
2099
+ payload.issues.push(issue(_iss));
2100
+ }
2101
+ }
2102
+
2103
+ //#endregion
2104
+ //#region ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/core/registries.js
2105
+ var _a;
2106
+ const $output = Symbol("ZodOutput");
2107
+ const $input = Symbol("ZodInput");
2108
+ var $ZodRegistry = class {
2109
+ constructor() {
2110
+ this._map = /* @__PURE__ */ new WeakMap();
2111
+ this._idmap = /* @__PURE__ */ new Map();
2112
+ }
2113
+ add(schema, ..._meta) {
2114
+ const meta$2 = _meta[0];
2115
+ this._map.set(schema, meta$2);
2116
+ if (meta$2 && typeof meta$2 === "object" && "id" in meta$2) {
2117
+ if (this._idmap.has(meta$2.id)) throw new Error(`ID ${meta$2.id} already exists in the registry`);
2118
+ this._idmap.set(meta$2.id, schema);
2119
+ }
2120
+ return this;
2121
+ }
2122
+ clear() {
2123
+ this._map = /* @__PURE__ */ new WeakMap();
2124
+ this._idmap = /* @__PURE__ */ new Map();
2125
+ return this;
2126
+ }
2127
+ remove(schema) {
2128
+ const meta$2 = this._map.get(schema);
2129
+ if (meta$2 && typeof meta$2 === "object" && "id" in meta$2) this._idmap.delete(meta$2.id);
2130
+ this._map.delete(schema);
2131
+ return this;
2132
+ }
2133
+ get(schema) {
2134
+ const p = schema._zod.parent;
2135
+ if (p) {
2136
+ const pm = { ...this.get(p) ?? {} };
2137
+ delete pm.id;
2138
+ const f = {
2139
+ ...pm,
2140
+ ...this._map.get(schema)
2141
+ };
2142
+ return Object.keys(f).length ? f : void 0;
2143
+ }
2144
+ return this._map.get(schema);
2145
+ }
2146
+ has(schema) {
2147
+ return this._map.has(schema);
2148
+ }
2149
+ };
2150
+ function registry() {
2151
+ return new $ZodRegistry();
2152
+ }
2153
+ (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
2154
+ const globalRegistry = globalThis.__zod_globalRegistry;
2155
+
2156
+ //#endregion
2157
+ //#region ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/core/api.js
2158
+ function _string(Class, params) {
2159
+ return new Class({
2160
+ type: "string",
2161
+ ...normalizeParams(params)
2162
+ });
2163
+ }
2164
+ function _email(Class, params) {
2165
+ return new Class({
2166
+ type: "string",
2167
+ format: "email",
2168
+ check: "string_format",
2169
+ abort: false,
2170
+ ...normalizeParams(params)
2171
+ });
2172
+ }
2173
+ function _guid(Class, params) {
2174
+ return new Class({
2175
+ type: "string",
2176
+ format: "guid",
2177
+ check: "string_format",
2178
+ abort: false,
2179
+ ...normalizeParams(params)
2180
+ });
2181
+ }
2182
+ function _uuid(Class, params) {
2183
+ return new Class({
2184
+ type: "string",
2185
+ format: "uuid",
2186
+ check: "string_format",
2187
+ abort: false,
2188
+ ...normalizeParams(params)
2189
+ });
2190
+ }
2191
+ function _uuidv4(Class, params) {
2192
+ return new Class({
2193
+ type: "string",
2194
+ format: "uuid",
2195
+ check: "string_format",
2196
+ abort: false,
2197
+ version: "v4",
2198
+ ...normalizeParams(params)
2199
+ });
2200
+ }
2201
+ function _uuidv6(Class, params) {
2202
+ return new Class({
2203
+ type: "string",
2204
+ format: "uuid",
2205
+ check: "string_format",
2206
+ abort: false,
2207
+ version: "v6",
2208
+ ...normalizeParams(params)
2209
+ });
2210
+ }
2211
+ function _uuidv7(Class, params) {
2212
+ return new Class({
2213
+ type: "string",
2214
+ format: "uuid",
2215
+ check: "string_format",
2216
+ abort: false,
2217
+ version: "v7",
2218
+ ...normalizeParams(params)
2219
+ });
2220
+ }
2221
+ function _url(Class, params) {
2222
+ return new Class({
2223
+ type: "string",
2224
+ format: "url",
2225
+ check: "string_format",
2226
+ abort: false,
2227
+ ...normalizeParams(params)
2228
+ });
2229
+ }
2230
+ function _emoji(Class, params) {
2231
+ return new Class({
2232
+ type: "string",
2233
+ format: "emoji",
2234
+ check: "string_format",
2235
+ abort: false,
2236
+ ...normalizeParams(params)
2237
+ });
2238
+ }
2239
+ function _nanoid(Class, params) {
2240
+ return new Class({
2241
+ type: "string",
2242
+ format: "nanoid",
2243
+ check: "string_format",
2244
+ abort: false,
2245
+ ...normalizeParams(params)
2246
+ });
2247
+ }
2248
+ function _cuid(Class, params) {
2249
+ return new Class({
2250
+ type: "string",
2251
+ format: "cuid",
2252
+ check: "string_format",
2253
+ abort: false,
2254
+ ...normalizeParams(params)
2255
+ });
2256
+ }
2257
+ function _cuid2(Class, params) {
2258
+ return new Class({
2259
+ type: "string",
2260
+ format: "cuid2",
2261
+ check: "string_format",
2262
+ abort: false,
2263
+ ...normalizeParams(params)
2264
+ });
2265
+ }
2266
+ function _ulid(Class, params) {
2267
+ return new Class({
2268
+ type: "string",
2269
+ format: "ulid",
2270
+ check: "string_format",
2271
+ abort: false,
2272
+ ...normalizeParams(params)
2273
+ });
2274
+ }
2275
+ function _xid(Class, params) {
2276
+ return new Class({
2277
+ type: "string",
2278
+ format: "xid",
2279
+ check: "string_format",
2280
+ abort: false,
2281
+ ...normalizeParams(params)
2282
+ });
2283
+ }
2284
+ function _ksuid(Class, params) {
2285
+ return new Class({
2286
+ type: "string",
2287
+ format: "ksuid",
2288
+ check: "string_format",
2289
+ abort: false,
2290
+ ...normalizeParams(params)
2291
+ });
2292
+ }
2293
+ function _ipv4(Class, params) {
2294
+ return new Class({
2295
+ type: "string",
2296
+ format: "ipv4",
2297
+ check: "string_format",
2298
+ abort: false,
2299
+ ...normalizeParams(params)
2300
+ });
2301
+ }
2302
+ function _ipv6(Class, params) {
2303
+ return new Class({
2304
+ type: "string",
2305
+ format: "ipv6",
2306
+ check: "string_format",
2307
+ abort: false,
2308
+ ...normalizeParams(params)
2309
+ });
2310
+ }
2311
+ function _cidrv4(Class, params) {
2312
+ return new Class({
2313
+ type: "string",
2314
+ format: "cidrv4",
2315
+ check: "string_format",
2316
+ abort: false,
2317
+ ...normalizeParams(params)
2318
+ });
2319
+ }
2320
+ function _cidrv6(Class, params) {
2321
+ return new Class({
2322
+ type: "string",
2323
+ format: "cidrv6",
2324
+ check: "string_format",
2325
+ abort: false,
2326
+ ...normalizeParams(params)
2327
+ });
2328
+ }
2329
+ function _base64(Class, params) {
2330
+ return new Class({
2331
+ type: "string",
2332
+ format: "base64",
2333
+ check: "string_format",
2334
+ abort: false,
2335
+ ...normalizeParams(params)
2336
+ });
2337
+ }
2338
+ function _base64url(Class, params) {
2339
+ return new Class({
2340
+ type: "string",
2341
+ format: "base64url",
2342
+ check: "string_format",
2343
+ abort: false,
2344
+ ...normalizeParams(params)
2345
+ });
2346
+ }
2347
+ function _e164(Class, params) {
2348
+ return new Class({
2349
+ type: "string",
2350
+ format: "e164",
2351
+ check: "string_format",
2352
+ abort: false,
2353
+ ...normalizeParams(params)
2354
+ });
2355
+ }
2356
+ function _jwt(Class, params) {
2357
+ return new Class({
2358
+ type: "string",
2359
+ format: "jwt",
2360
+ check: "string_format",
2361
+ abort: false,
2362
+ ...normalizeParams(params)
2363
+ });
2364
+ }
2365
+ function _isoDateTime(Class, params) {
2366
+ return new Class({
2367
+ type: "string",
2368
+ format: "datetime",
2369
+ check: "string_format",
2370
+ offset: false,
2371
+ local: false,
2372
+ precision: null,
2373
+ ...normalizeParams(params)
2374
+ });
2375
+ }
2376
+ function _isoDate(Class, params) {
2377
+ return new Class({
2378
+ type: "string",
2379
+ format: "date",
2380
+ check: "string_format",
2381
+ ...normalizeParams(params)
2382
+ });
2383
+ }
2384
+ function _isoTime(Class, params) {
2385
+ return new Class({
2386
+ type: "string",
2387
+ format: "time",
2388
+ check: "string_format",
2389
+ precision: null,
2390
+ ...normalizeParams(params)
2391
+ });
2392
+ }
2393
+ function _isoDuration(Class, params) {
2394
+ return new Class({
2395
+ type: "string",
2396
+ format: "duration",
2397
+ check: "string_format",
2398
+ ...normalizeParams(params)
2399
+ });
2400
+ }
2401
+ function _number(Class, params) {
2402
+ return new Class({
2403
+ type: "number",
2404
+ checks: [],
2405
+ ...normalizeParams(params)
2406
+ });
2407
+ }
2408
+ function _int(Class, params) {
2409
+ return new Class({
2410
+ type: "number",
2411
+ check: "number_format",
2412
+ abort: false,
2413
+ format: "safeint",
2414
+ ...normalizeParams(params)
2415
+ });
2416
+ }
2417
+ function _boolean(Class, params) {
2418
+ return new Class({
2419
+ type: "boolean",
2420
+ ...normalizeParams(params)
2421
+ });
2422
+ }
2423
+ function _unknown(Class) {
2424
+ return new Class({ type: "unknown" });
2425
+ }
2426
+ function _never(Class, params) {
2427
+ return new Class({
2428
+ type: "never",
2429
+ ...normalizeParams(params)
2430
+ });
2431
+ }
2432
+ function _lt(value, params) {
2433
+ return new $ZodCheckLessThan({
2434
+ check: "less_than",
2435
+ ...normalizeParams(params),
2436
+ value,
2437
+ inclusive: false
2438
+ });
2439
+ }
2440
+ function _lte(value, params) {
2441
+ return new $ZodCheckLessThan({
2442
+ check: "less_than",
2443
+ ...normalizeParams(params),
2444
+ value,
2445
+ inclusive: true
2446
+ });
2447
+ }
2448
+ function _gt(value, params) {
2449
+ return new $ZodCheckGreaterThan({
2450
+ check: "greater_than",
2451
+ ...normalizeParams(params),
2452
+ value,
2453
+ inclusive: false
2454
+ });
2455
+ }
2456
+ function _gte(value, params) {
2457
+ return new $ZodCheckGreaterThan({
2458
+ check: "greater_than",
2459
+ ...normalizeParams(params),
2460
+ value,
2461
+ inclusive: true
2462
+ });
2463
+ }
2464
+ function _multipleOf(value, params) {
2465
+ return new $ZodCheckMultipleOf({
2466
+ check: "multiple_of",
2467
+ ...normalizeParams(params),
2468
+ value
2469
+ });
2470
+ }
2471
+ function _maxLength(maximum, params) {
2472
+ const ch = new $ZodCheckMaxLength({
2473
+ check: "max_length",
2474
+ ...normalizeParams(params),
2475
+ maximum
2476
+ });
2477
+ return ch;
2478
+ }
2479
+ function _minLength(minimum, params) {
2480
+ return new $ZodCheckMinLength({
2481
+ check: "min_length",
2482
+ ...normalizeParams(params),
2483
+ minimum
2484
+ });
2485
+ }
2486
+ function _length(length, params) {
2487
+ return new $ZodCheckLengthEquals({
2488
+ check: "length_equals",
2489
+ ...normalizeParams(params),
2490
+ length
2491
+ });
2492
+ }
2493
+ function _regex(pattern, params) {
2494
+ return new $ZodCheckRegex({
2495
+ check: "string_format",
2496
+ format: "regex",
2497
+ ...normalizeParams(params),
2498
+ pattern
2499
+ });
2500
+ }
2501
+ function _lowercase(params) {
2502
+ return new $ZodCheckLowerCase({
2503
+ check: "string_format",
2504
+ format: "lowercase",
2505
+ ...normalizeParams(params)
2506
+ });
2507
+ }
2508
+ function _uppercase(params) {
2509
+ return new $ZodCheckUpperCase({
2510
+ check: "string_format",
2511
+ format: "uppercase",
2512
+ ...normalizeParams(params)
2513
+ });
2514
+ }
2515
+ function _includes(includes, params) {
2516
+ return new $ZodCheckIncludes({
2517
+ check: "string_format",
2518
+ format: "includes",
2519
+ ...normalizeParams(params),
2520
+ includes
2521
+ });
2522
+ }
2523
+ function _startsWith(prefix, params) {
2524
+ return new $ZodCheckStartsWith({
2525
+ check: "string_format",
2526
+ format: "starts_with",
2527
+ ...normalizeParams(params),
2528
+ prefix
2529
+ });
2530
+ }
2531
+ function _endsWith(suffix, params) {
2532
+ return new $ZodCheckEndsWith({
2533
+ check: "string_format",
2534
+ format: "ends_with",
2535
+ ...normalizeParams(params),
2536
+ suffix
2537
+ });
2538
+ }
2539
+ function _overwrite(tx) {
2540
+ return new $ZodCheckOverwrite({
2541
+ check: "overwrite",
2542
+ tx
2543
+ });
2544
+ }
2545
+ function _normalize(form) {
2546
+ return _overwrite((input) => input.normalize(form));
2547
+ }
2548
+ function _trim() {
2549
+ return _overwrite((input) => input.trim());
2550
+ }
2551
+ function _toLowerCase() {
2552
+ return _overwrite((input) => input.toLowerCase());
2553
+ }
2554
+ function _toUpperCase() {
2555
+ return _overwrite((input) => input.toUpperCase());
2556
+ }
2557
+ function _slugify() {
2558
+ return _overwrite((input) => slugify(input));
2559
+ }
2560
+ function _array(Class, element, params) {
2561
+ return new Class({
2562
+ type: "array",
2563
+ element,
2564
+ ...normalizeParams(params)
2565
+ });
2566
+ }
2567
+ function _refine(Class, fn, _params) {
2568
+ const schema = new Class({
2569
+ type: "custom",
2570
+ check: "custom",
2571
+ fn,
2572
+ ...normalizeParams(_params)
2573
+ });
2574
+ return schema;
2575
+ }
2576
+ function _superRefine(fn) {
2577
+ const ch = _check((payload) => {
2578
+ payload.addIssue = (issue$1) => {
2579
+ if (typeof issue$1 === "string") payload.issues.push(issue(issue$1, payload.value, ch._zod.def));
2580
+ else {
2581
+ const _issue = issue$1;
2582
+ if (_issue.fatal) _issue.continue = false;
2583
+ _issue.code ?? (_issue.code = "custom");
2584
+ _issue.input ?? (_issue.input = payload.value);
2585
+ _issue.inst ?? (_issue.inst = ch);
2586
+ _issue.continue ?? (_issue.continue = !ch._zod.def.abort);
2587
+ payload.issues.push(issue(_issue));
2588
+ }
2589
+ };
2590
+ return fn(payload.value, payload);
2591
+ });
2592
+ return ch;
2593
+ }
2594
+ function _check(fn, params) {
2595
+ const ch = new $ZodCheck({
2596
+ check: "custom",
2597
+ ...normalizeParams(params)
2598
+ });
2599
+ ch._zod.check = fn;
2600
+ return ch;
2601
+ }
2602
+ function describe$1(description) {
2603
+ const ch = new $ZodCheck({ check: "describe" });
2604
+ ch._zod.onattach = [(inst) => {
2605
+ const existing = globalRegistry.get(inst) ?? {};
2606
+ globalRegistry.add(inst, {
2607
+ ...existing,
2608
+ description
2609
+ });
2610
+ }];
2611
+ ch._zod.check = () => {};
2612
+ return ch;
2613
+ }
2614
+ function meta$1(metadata) {
2615
+ const ch = new $ZodCheck({ check: "meta" });
2616
+ ch._zod.onattach = [(inst) => {
2617
+ const existing = globalRegistry.get(inst) ?? {};
2618
+ globalRegistry.add(inst, {
2619
+ ...existing,
2620
+ ...metadata
2621
+ });
2622
+ }];
2623
+ ch._zod.check = () => {};
2624
+ return ch;
2625
+ }
2626
+
2627
+ //#endregion
2628
+ //#region ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/classic/iso.js
2629
+ const ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
2630
+ $ZodISODateTime.init(inst, def);
2631
+ ZodStringFormat.init(inst, def);
2632
+ });
2633
+ function datetime(params) {
2634
+ return _isoDateTime(ZodISODateTime, params);
2635
+ }
2636
+ const ZodISODate = /* @__PURE__ */ $constructor("ZodISODate", (inst, def) => {
2637
+ $ZodISODate.init(inst, def);
2638
+ ZodStringFormat.init(inst, def);
2639
+ });
2640
+ function date(params) {
2641
+ return _isoDate(ZodISODate, params);
2642
+ }
2643
+ const ZodISOTime = /* @__PURE__ */ $constructor("ZodISOTime", (inst, def) => {
2644
+ $ZodISOTime.init(inst, def);
2645
+ ZodStringFormat.init(inst, def);
2646
+ });
2647
+ function time(params) {
2648
+ return _isoTime(ZodISOTime, params);
2649
+ }
2650
+ const ZodISODuration = /* @__PURE__ */ $constructor("ZodISODuration", (inst, def) => {
2651
+ $ZodISODuration.init(inst, def);
2652
+ ZodStringFormat.init(inst, def);
2653
+ });
2654
+ function duration(params) {
2655
+ return _isoDuration(ZodISODuration, params);
2656
+ }
2657
+
2658
+ //#endregion
2659
+ //#region ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/classic/errors.js
2660
+ const initializer = (inst, issues) => {
2661
+ $ZodError.init(inst, issues);
2662
+ inst.name = "ZodError";
2663
+ Object.defineProperties(inst, {
2664
+ format: { value: (mapper) => formatError(inst, mapper) },
2665
+ flatten: { value: (mapper) => flattenError(inst, mapper) },
2666
+ addIssue: { value: (issue$1) => {
2667
+ inst.issues.push(issue$1);
2668
+ inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
2669
+ } },
2670
+ addIssues: { value: (issues$1) => {
2671
+ inst.issues.push(...issues$1);
2672
+ inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
2673
+ } },
2674
+ isEmpty: { get() {
2675
+ return inst.issues.length === 0;
2676
+ } }
2677
+ });
2678
+ };
2679
+ const ZodError = $constructor("ZodError", initializer);
2680
+ const ZodRealError = $constructor("ZodError", initializer, { Parent: Error });
2681
+
2682
+ //#endregion
2683
+ //#region ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/classic/parse.js
2684
+ const parse = /* @__PURE__ */ _parse(ZodRealError);
2685
+ const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
2686
+ const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
2687
+ const safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError);
2688
+ const encode = /* @__PURE__ */ _encode(ZodRealError);
2689
+ const decode = /* @__PURE__ */ _decode(ZodRealError);
2690
+ const encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
2691
+ const decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError);
2692
+ const safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
2693
+ const safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
2694
+ const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
2695
+ const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
2696
+
2697
+ //#endregion
2698
+ //#region ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/classic/schemas.js
2699
+ const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
2700
+ $ZodType.init(inst, def);
2701
+ inst.def = def;
2702
+ inst.type = def.type;
2703
+ Object.defineProperty(inst, "_def", { value: def });
2704
+ inst.check = (...checks) => {
2705
+ return inst.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...checks.map((ch) => typeof ch === "function" ? { _zod: {
2706
+ check: ch,
2707
+ def: { check: "custom" },
2708
+ onattach: []
2709
+ } } : ch)] }));
2710
+ };
2711
+ inst.clone = (def$1, params) => clone(inst, def$1, params);
2712
+ inst.brand = () => inst;
2713
+ inst.register = (reg, meta$2) => {
2714
+ reg.add(inst, meta$2);
2715
+ return inst;
2716
+ };
2717
+ inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
2718
+ inst.safeParse = (data, params) => safeParse(inst, data, params);
2719
+ inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
2720
+ inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
2721
+ inst.spa = inst.safeParseAsync;
2722
+ inst.encode = (data, params) => encode(inst, data, params);
2723
+ inst.decode = (data, params) => decode(inst, data, params);
2724
+ inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
2725
+ inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
2726
+ inst.safeEncode = (data, params) => safeEncode(inst, data, params);
2727
+ inst.safeDecode = (data, params) => safeDecode(inst, data, params);
2728
+ inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
2729
+ inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
2730
+ inst.refine = (check, params) => inst.check(refine(check, params));
2731
+ inst.superRefine = (refinement) => inst.check(superRefine(refinement));
2732
+ inst.overwrite = (fn) => inst.check(_overwrite(fn));
2733
+ inst.optional = () => optional(inst);
2734
+ inst.nullable = () => nullable(inst);
2735
+ inst.nullish = () => optional(nullable(inst));
2736
+ inst.nonoptional = (params) => nonoptional(inst, params);
2737
+ inst.array = () => array(inst);
2738
+ inst.or = (arg) => union([inst, arg]);
2739
+ inst.and = (arg) => intersection(inst, arg);
2740
+ inst.transform = (tx) => pipe(inst, transform(tx));
2741
+ inst.default = (def$1) => _default(inst, def$1);
2742
+ inst.prefault = (def$1) => prefault(inst, def$1);
2743
+ inst.catch = (params) => _catch(inst, params);
2744
+ inst.pipe = (target) => pipe(inst, target);
2745
+ inst.readonly = () => readonly(inst);
2746
+ inst.describe = (description) => {
2747
+ const cl = inst.clone();
2748
+ globalRegistry.add(cl, { description });
2749
+ return cl;
2750
+ };
2751
+ Object.defineProperty(inst, "description", {
2752
+ get() {
2753
+ return globalRegistry.get(inst)?.description;
2754
+ },
2755
+ configurable: true
2756
+ });
2757
+ inst.meta = (...args) => {
2758
+ if (args.length === 0) return globalRegistry.get(inst);
2759
+ const cl = inst.clone();
2760
+ globalRegistry.add(cl, args[0]);
2761
+ return cl;
2762
+ };
2763
+ inst.isOptional = () => inst.safeParse(void 0).success;
2764
+ inst.isNullable = () => inst.safeParse(null).success;
2765
+ return inst;
2766
+ });
2767
+ /** @internal */
2768
+ const _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
2769
+ $ZodString.init(inst, def);
2770
+ ZodType.init(inst, def);
2771
+ const bag = inst._zod.bag;
2772
+ inst.format = bag.format ?? null;
2773
+ inst.minLength = bag.minimum ?? null;
2774
+ inst.maxLength = bag.maximum ?? null;
2775
+ inst.regex = (...args) => inst.check(_regex(...args));
2776
+ inst.includes = (...args) => inst.check(_includes(...args));
2777
+ inst.startsWith = (...args) => inst.check(_startsWith(...args));
2778
+ inst.endsWith = (...args) => inst.check(_endsWith(...args));
2779
+ inst.min = (...args) => inst.check(_minLength(...args));
2780
+ inst.max = (...args) => inst.check(_maxLength(...args));
2781
+ inst.length = (...args) => inst.check(_length(...args));
2782
+ inst.nonempty = (...args) => inst.check(_minLength(1, ...args));
2783
+ inst.lowercase = (params) => inst.check(_lowercase(params));
2784
+ inst.uppercase = (params) => inst.check(_uppercase(params));
2785
+ inst.trim = () => inst.check(_trim());
2786
+ inst.normalize = (...args) => inst.check(_normalize(...args));
2787
+ inst.toLowerCase = () => inst.check(_toLowerCase());
2788
+ inst.toUpperCase = () => inst.check(_toUpperCase());
2789
+ inst.slugify = () => inst.check(_slugify());
2790
+ });
2791
+ const ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
2792
+ $ZodString.init(inst, def);
2793
+ _ZodString.init(inst, def);
2794
+ inst.email = (params) => inst.check(_email(ZodEmail, params));
2795
+ inst.url = (params) => inst.check(_url(ZodURL, params));
2796
+ inst.jwt = (params) => inst.check(_jwt(ZodJWT, params));
2797
+ inst.emoji = (params) => inst.check(_emoji(ZodEmoji, params));
2798
+ inst.guid = (params) => inst.check(_guid(ZodGUID, params));
2799
+ inst.uuid = (params) => inst.check(_uuid(ZodUUID, params));
2800
+ inst.uuidv4 = (params) => inst.check(_uuidv4(ZodUUID, params));
2801
+ inst.uuidv6 = (params) => inst.check(_uuidv6(ZodUUID, params));
2802
+ inst.uuidv7 = (params) => inst.check(_uuidv7(ZodUUID, params));
2803
+ inst.nanoid = (params) => inst.check(_nanoid(ZodNanoID, params));
2804
+ inst.guid = (params) => inst.check(_guid(ZodGUID, params));
2805
+ inst.cuid = (params) => inst.check(_cuid(ZodCUID, params));
2806
+ inst.cuid2 = (params) => inst.check(_cuid2(ZodCUID2, params));
2807
+ inst.ulid = (params) => inst.check(_ulid(ZodULID, params));
2808
+ inst.base64 = (params) => inst.check(_base64(ZodBase64, params));
2809
+ inst.base64url = (params) => inst.check(_base64url(ZodBase64URL, params));
2810
+ inst.xid = (params) => inst.check(_xid(ZodXID, params));
2811
+ inst.ksuid = (params) => inst.check(_ksuid(ZodKSUID, params));
2812
+ inst.ipv4 = (params) => inst.check(_ipv4(ZodIPv4, params));
2813
+ inst.ipv6 = (params) => inst.check(_ipv6(ZodIPv6, params));
2814
+ inst.cidrv4 = (params) => inst.check(_cidrv4(ZodCIDRv4, params));
2815
+ inst.cidrv6 = (params) => inst.check(_cidrv6(ZodCIDRv6, params));
2816
+ inst.e164 = (params) => inst.check(_e164(ZodE164, params));
2817
+ inst.datetime = (params) => inst.check(datetime(params));
2818
+ inst.date = (params) => inst.check(date(params));
2819
+ inst.time = (params) => inst.check(time(params));
2820
+ inst.duration = (params) => inst.check(duration(params));
2821
+ });
2822
+ function string(params) {
2823
+ return _string(ZodString, params);
2824
+ }
2825
+ const ZodStringFormat = /* @__PURE__ */ $constructor("ZodStringFormat", (inst, def) => {
2826
+ $ZodStringFormat.init(inst, def);
2827
+ _ZodString.init(inst, def);
2828
+ });
2829
+ const ZodEmail = /* @__PURE__ */ $constructor("ZodEmail", (inst, def) => {
2830
+ $ZodEmail.init(inst, def);
2831
+ ZodStringFormat.init(inst, def);
2832
+ });
2833
+ const ZodGUID = /* @__PURE__ */ $constructor("ZodGUID", (inst, def) => {
2834
+ $ZodGUID.init(inst, def);
2835
+ ZodStringFormat.init(inst, def);
2836
+ });
2837
+ const ZodUUID = /* @__PURE__ */ $constructor("ZodUUID", (inst, def) => {
2838
+ $ZodUUID.init(inst, def);
2839
+ ZodStringFormat.init(inst, def);
2840
+ });
2841
+ const ZodURL = /* @__PURE__ */ $constructor("ZodURL", (inst, def) => {
2842
+ $ZodURL.init(inst, def);
2843
+ ZodStringFormat.init(inst, def);
2844
+ });
2845
+ function url(params) {
2846
+ return _url(ZodURL, params);
2847
+ }
2848
+ const ZodEmoji = /* @__PURE__ */ $constructor("ZodEmoji", (inst, def) => {
2849
+ $ZodEmoji.init(inst, def);
2850
+ ZodStringFormat.init(inst, def);
2851
+ });
2852
+ const ZodNanoID = /* @__PURE__ */ $constructor("ZodNanoID", (inst, def) => {
2853
+ $ZodNanoID.init(inst, def);
2854
+ ZodStringFormat.init(inst, def);
2855
+ });
2856
+ const ZodCUID = /* @__PURE__ */ $constructor("ZodCUID", (inst, def) => {
2857
+ $ZodCUID.init(inst, def);
2858
+ ZodStringFormat.init(inst, def);
2859
+ });
2860
+ const ZodCUID2 = /* @__PURE__ */ $constructor("ZodCUID2", (inst, def) => {
2861
+ $ZodCUID2.init(inst, def);
2862
+ ZodStringFormat.init(inst, def);
2863
+ });
2864
+ const ZodULID = /* @__PURE__ */ $constructor("ZodULID", (inst, def) => {
2865
+ $ZodULID.init(inst, def);
2866
+ ZodStringFormat.init(inst, def);
2867
+ });
2868
+ const ZodXID = /* @__PURE__ */ $constructor("ZodXID", (inst, def) => {
2869
+ $ZodXID.init(inst, def);
2870
+ ZodStringFormat.init(inst, def);
2871
+ });
2872
+ const ZodKSUID = /* @__PURE__ */ $constructor("ZodKSUID", (inst, def) => {
2873
+ $ZodKSUID.init(inst, def);
2874
+ ZodStringFormat.init(inst, def);
2875
+ });
2876
+ const ZodIPv4 = /* @__PURE__ */ $constructor("ZodIPv4", (inst, def) => {
2877
+ $ZodIPv4.init(inst, def);
2878
+ ZodStringFormat.init(inst, def);
2879
+ });
2880
+ const ZodIPv6 = /* @__PURE__ */ $constructor("ZodIPv6", (inst, def) => {
2881
+ $ZodIPv6.init(inst, def);
2882
+ ZodStringFormat.init(inst, def);
2883
+ });
2884
+ const ZodCIDRv4 = /* @__PURE__ */ $constructor("ZodCIDRv4", (inst, def) => {
2885
+ $ZodCIDRv4.init(inst, def);
2886
+ ZodStringFormat.init(inst, def);
2887
+ });
2888
+ const ZodCIDRv6 = /* @__PURE__ */ $constructor("ZodCIDRv6", (inst, def) => {
2889
+ $ZodCIDRv6.init(inst, def);
2890
+ ZodStringFormat.init(inst, def);
2891
+ });
2892
+ const ZodBase64 = /* @__PURE__ */ $constructor("ZodBase64", (inst, def) => {
2893
+ $ZodBase64.init(inst, def);
2894
+ ZodStringFormat.init(inst, def);
2895
+ });
2896
+ const ZodBase64URL = /* @__PURE__ */ $constructor("ZodBase64URL", (inst, def) => {
2897
+ $ZodBase64URL.init(inst, def);
2898
+ ZodStringFormat.init(inst, def);
2899
+ });
2900
+ const ZodE164 = /* @__PURE__ */ $constructor("ZodE164", (inst, def) => {
2901
+ $ZodE164.init(inst, def);
2902
+ ZodStringFormat.init(inst, def);
2903
+ });
2904
+ const ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
2905
+ $ZodJWT.init(inst, def);
2906
+ ZodStringFormat.init(inst, def);
2907
+ });
2908
+ const ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
2909
+ $ZodNumber.init(inst, def);
2910
+ ZodType.init(inst, def);
2911
+ inst.gt = (value, params) => inst.check(_gt(value, params));
2912
+ inst.gte = (value, params) => inst.check(_gte(value, params));
2913
+ inst.min = (value, params) => inst.check(_gte(value, params));
2914
+ inst.lt = (value, params) => inst.check(_lt(value, params));
2915
+ inst.lte = (value, params) => inst.check(_lte(value, params));
2916
+ inst.max = (value, params) => inst.check(_lte(value, params));
2917
+ inst.int = (params) => inst.check(int(params));
2918
+ inst.safe = (params) => inst.check(int(params));
2919
+ inst.positive = (params) => inst.check(_gt(0, params));
2920
+ inst.nonnegative = (params) => inst.check(_gte(0, params));
2921
+ inst.negative = (params) => inst.check(_lt(0, params));
2922
+ inst.nonpositive = (params) => inst.check(_lte(0, params));
2923
+ inst.multipleOf = (value, params) => inst.check(_multipleOf(value, params));
2924
+ inst.step = (value, params) => inst.check(_multipleOf(value, params));
2925
+ inst.finite = () => inst;
2926
+ const bag = inst._zod.bag;
2927
+ inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
2928
+ inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
2929
+ inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? .5);
2930
+ inst.isFinite = true;
2931
+ inst.format = bag.format ?? null;
2932
+ });
2933
+ function number(params) {
2934
+ return _number(ZodNumber, params);
2935
+ }
2936
+ const ZodNumberFormat = /* @__PURE__ */ $constructor("ZodNumberFormat", (inst, def) => {
2937
+ $ZodNumberFormat.init(inst, def);
2938
+ ZodNumber.init(inst, def);
2939
+ });
2940
+ function int(params) {
2941
+ return _int(ZodNumberFormat, params);
2942
+ }
2943
+ const ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
2944
+ $ZodBoolean.init(inst, def);
2945
+ ZodType.init(inst, def);
2946
+ });
2947
+ function boolean(params) {
2948
+ return _boolean(ZodBoolean, params);
2949
+ }
2950
+ const ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
2951
+ $ZodUnknown.init(inst, def);
2952
+ ZodType.init(inst, def);
2953
+ });
2954
+ function unknown() {
2955
+ return _unknown(ZodUnknown);
2956
+ }
2957
+ const ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
2958
+ $ZodNever.init(inst, def);
2959
+ ZodType.init(inst, def);
2960
+ });
2961
+ function never(params) {
2962
+ return _never(ZodNever, params);
2963
+ }
2964
+ const ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
2965
+ $ZodArray.init(inst, def);
2966
+ ZodType.init(inst, def);
2967
+ inst.element = def.element;
2968
+ inst.min = (minLength, params) => inst.check(_minLength(minLength, params));
2969
+ inst.nonempty = (params) => inst.check(_minLength(1, params));
2970
+ inst.max = (maxLength, params) => inst.check(_maxLength(maxLength, params));
2971
+ inst.length = (len, params) => inst.check(_length(len, params));
2972
+ inst.unwrap = () => inst.element;
2973
+ });
2974
+ function array(element, params) {
2975
+ return _array(ZodArray, element, params);
2976
+ }
2977
+ const ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
2978
+ $ZodObjectJIT.init(inst, def);
2979
+ ZodType.init(inst, def);
2980
+ defineLazy(inst, "shape", () => {
2981
+ return def.shape;
2982
+ });
2983
+ inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
2984
+ inst.catchall = (catchall) => inst.clone({
2985
+ ...inst._zod.def,
2986
+ catchall
2987
+ });
2988
+ inst.passthrough = () => inst.clone({
2989
+ ...inst._zod.def,
2990
+ catchall: unknown()
2991
+ });
2992
+ inst.loose = () => inst.clone({
2993
+ ...inst._zod.def,
2994
+ catchall: unknown()
2995
+ });
2996
+ inst.strict = () => inst.clone({
2997
+ ...inst._zod.def,
2998
+ catchall: never()
2999
+ });
3000
+ inst.strip = () => inst.clone({
3001
+ ...inst._zod.def,
3002
+ catchall: void 0
3003
+ });
3004
+ inst.extend = (incoming) => {
3005
+ return extend(inst, incoming);
3006
+ };
3007
+ inst.safeExtend = (incoming) => {
3008
+ return safeExtend(inst, incoming);
3009
+ };
3010
+ inst.merge = (other) => merge(inst, other);
3011
+ inst.pick = (mask) => pick(inst, mask);
3012
+ inst.omit = (mask) => omit(inst, mask);
3013
+ inst.partial = (...args) => partial(ZodOptional, inst, args[0]);
3014
+ inst.required = (...args) => required(ZodNonOptional, inst, args[0]);
3015
+ });
3016
+ function object(shape, params) {
3017
+ const def = {
3018
+ type: "object",
3019
+ shape: shape ?? {},
3020
+ ...normalizeParams(params)
3021
+ };
3022
+ return new ZodObject(def);
3023
+ }
3024
+ const ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
3025
+ $ZodUnion.init(inst, def);
3026
+ ZodType.init(inst, def);
3027
+ inst.options = def.options;
3028
+ });
3029
+ function union(options, params) {
3030
+ return new ZodUnion({
3031
+ type: "union",
3032
+ options,
3033
+ ...normalizeParams(params)
3034
+ });
3035
+ }
3036
+ const ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
3037
+ $ZodIntersection.init(inst, def);
3038
+ ZodType.init(inst, def);
3039
+ });
3040
+ function intersection(left, right) {
3041
+ return new ZodIntersection({
3042
+ type: "intersection",
3043
+ left,
3044
+ right
3045
+ });
3046
+ }
3047
+ const ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
3048
+ $ZodRecord.init(inst, def);
3049
+ ZodType.init(inst, def);
3050
+ inst.keyType = def.keyType;
3051
+ inst.valueType = def.valueType;
3052
+ });
3053
+ function record(keyType, valueType, params) {
3054
+ return new ZodRecord({
3055
+ type: "record",
3056
+ keyType,
3057
+ valueType,
3058
+ ...normalizeParams(params)
3059
+ });
3060
+ }
3061
+ const ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
3062
+ $ZodEnum.init(inst, def);
3063
+ ZodType.init(inst, def);
3064
+ inst.enum = def.entries;
3065
+ inst.options = Object.values(def.entries);
3066
+ const keys = new Set(Object.keys(def.entries));
3067
+ inst.extract = (values, params) => {
3068
+ const newEntries = {};
3069
+ for (const value of values) if (keys.has(value)) newEntries[value] = def.entries[value];
3070
+ else throw new Error(`Key ${value} not found in enum`);
3071
+ return new ZodEnum({
3072
+ ...def,
3073
+ checks: [],
3074
+ ...normalizeParams(params),
3075
+ entries: newEntries
3076
+ });
3077
+ };
3078
+ inst.exclude = (values, params) => {
3079
+ const newEntries = { ...def.entries };
3080
+ for (const value of values) if (keys.has(value)) delete newEntries[value];
3081
+ else throw new Error(`Key ${value} not found in enum`);
3082
+ return new ZodEnum({
3083
+ ...def,
3084
+ checks: [],
3085
+ ...normalizeParams(params),
3086
+ entries: newEntries
3087
+ });
3088
+ };
3089
+ });
3090
+ function _enum(values, params) {
3091
+ const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
3092
+ return new ZodEnum({
3093
+ type: "enum",
3094
+ entries,
3095
+ ...normalizeParams(params)
3096
+ });
3097
+ }
3098
+ const ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
3099
+ $ZodTransform.init(inst, def);
3100
+ ZodType.init(inst, def);
3101
+ inst._zod.parse = (payload, _ctx) => {
3102
+ if (_ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
3103
+ payload.addIssue = (issue$1) => {
3104
+ if (typeof issue$1 === "string") payload.issues.push(issue(issue$1, payload.value, def));
3105
+ else {
3106
+ const _issue = issue$1;
3107
+ if (_issue.fatal) _issue.continue = false;
3108
+ _issue.code ?? (_issue.code = "custom");
3109
+ _issue.input ?? (_issue.input = payload.value);
3110
+ _issue.inst ?? (_issue.inst = inst);
3111
+ payload.issues.push(issue(_issue));
3112
+ }
3113
+ };
3114
+ const output = def.transform(payload.value, payload);
3115
+ if (output instanceof Promise) return output.then((output$1) => {
3116
+ payload.value = output$1;
3117
+ return payload;
3118
+ });
3119
+ payload.value = output;
3120
+ return payload;
3121
+ };
3122
+ });
3123
+ function transform(fn) {
3124
+ return new ZodTransform({
3125
+ type: "transform",
3126
+ transform: fn
3127
+ });
3128
+ }
3129
+ const ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
3130
+ $ZodOptional.init(inst, def);
3131
+ ZodType.init(inst, def);
3132
+ inst.unwrap = () => inst._zod.def.innerType;
3133
+ });
3134
+ function optional(innerType) {
3135
+ return new ZodOptional({
3136
+ type: "optional",
3137
+ innerType
3138
+ });
3139
+ }
3140
+ const ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
3141
+ $ZodNullable.init(inst, def);
3142
+ ZodType.init(inst, def);
3143
+ inst.unwrap = () => inst._zod.def.innerType;
3144
+ });
3145
+ function nullable(innerType) {
3146
+ return new ZodNullable({
3147
+ type: "nullable",
3148
+ innerType
3149
+ });
3150
+ }
3151
+ const ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
3152
+ $ZodDefault.init(inst, def);
3153
+ ZodType.init(inst, def);
3154
+ inst.unwrap = () => inst._zod.def.innerType;
3155
+ inst.removeDefault = inst.unwrap;
3156
+ });
3157
+ function _default(innerType, defaultValue) {
3158
+ return new ZodDefault({
3159
+ type: "default",
3160
+ innerType,
3161
+ get defaultValue() {
3162
+ return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
3163
+ }
3164
+ });
3165
+ }
3166
+ const ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
3167
+ $ZodPrefault.init(inst, def);
3168
+ ZodType.init(inst, def);
3169
+ inst.unwrap = () => inst._zod.def.innerType;
3170
+ });
3171
+ function prefault(innerType, defaultValue) {
3172
+ return new ZodPrefault({
3173
+ type: "prefault",
3174
+ innerType,
3175
+ get defaultValue() {
3176
+ return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
3177
+ }
3178
+ });
3179
+ }
3180
+ const ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
3181
+ $ZodNonOptional.init(inst, def);
3182
+ ZodType.init(inst, def);
3183
+ inst.unwrap = () => inst._zod.def.innerType;
3184
+ });
3185
+ function nonoptional(innerType, params) {
3186
+ return new ZodNonOptional({
3187
+ type: "nonoptional",
3188
+ innerType,
3189
+ ...normalizeParams(params)
3190
+ });
3191
+ }
3192
+ const ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
3193
+ $ZodCatch.init(inst, def);
3194
+ ZodType.init(inst, def);
3195
+ inst.unwrap = () => inst._zod.def.innerType;
3196
+ inst.removeCatch = inst.unwrap;
3197
+ });
3198
+ function _catch(innerType, catchValue) {
3199
+ return new ZodCatch({
3200
+ type: "catch",
3201
+ innerType,
3202
+ catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
3203
+ });
3204
+ }
3205
+ const ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
3206
+ $ZodPipe.init(inst, def);
3207
+ ZodType.init(inst, def);
3208
+ inst.in = def.in;
3209
+ inst.out = def.out;
3210
+ });
3211
+ function pipe(in_, out) {
3212
+ return new ZodPipe({
3213
+ type: "pipe",
3214
+ in: in_,
3215
+ out
3216
+ });
3217
+ }
3218
+ const ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
3219
+ $ZodReadonly.init(inst, def);
3220
+ ZodType.init(inst, def);
3221
+ inst.unwrap = () => inst._zod.def.innerType;
3222
+ });
3223
+ function readonly(innerType) {
3224
+ return new ZodReadonly({
3225
+ type: "readonly",
3226
+ innerType
3227
+ });
3228
+ }
3229
+ const ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
3230
+ $ZodCustom.init(inst, def);
3231
+ ZodType.init(inst, def);
3232
+ });
3233
+ function refine(fn, _params = {}) {
3234
+ return _refine(ZodCustom, fn, _params);
3235
+ }
3236
+ function superRefine(fn) {
3237
+ return _superRefine(fn);
3238
+ }
3239
+ const describe = describe$1;
3240
+ const meta = meta$1;
3241
+
3242
+ //#endregion
3243
+ //#region ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/classic/compat.js
3244
+ /** @deprecated Use the raw string literal codes instead, e.g. "invalid_type". */
3245
+ const ZodIssueCode = {
3246
+ invalid_type: "invalid_type",
3247
+ too_big: "too_big",
3248
+ too_small: "too_small",
3249
+ invalid_format: "invalid_format",
3250
+ not_multiple_of: "not_multiple_of",
3251
+ unrecognized_keys: "unrecognized_keys",
3252
+ invalid_union: "invalid_union",
3253
+ invalid_key: "invalid_key",
3254
+ invalid_element: "invalid_element",
3255
+ invalid_value: "invalid_value",
3256
+ custom: "custom"
3257
+ };
3258
+ /** @deprecated Do not use. Stub definition, only included for zod-to-json-schema compatibility. */
3259
+ var ZodFirstPartyTypeKind;
3260
+ (function(ZodFirstPartyTypeKind$1) {})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
3261
+
3262
+ //#endregion
3263
+ //#region src/workspace/schema.ts
3264
+ /**
3265
+ * Routes can be a string glob or array of globs.
3266
+ */
3267
+ const RoutesSchema = union([string(), array(string())]);
3268
+ /**
3269
+ * Telescope configuration schema.
3270
+ */
3271
+ const TelescopeConfigSchema = object({
3272
+ enabled: boolean().optional(),
3273
+ port: number().optional(),
3274
+ path: string().optional(),
3275
+ ignore: array(string()).optional(),
3276
+ recordBody: boolean().optional(),
3277
+ maxEntries: number().optional(),
3278
+ websocket: boolean().optional()
3279
+ });
3280
+ /**
3281
+ * Studio configuration schema.
3282
+ */
3283
+ const StudioConfigSchema = object({
3284
+ enabled: boolean().optional(),
3285
+ path: string().optional(),
3286
+ schema: string().optional()
3287
+ });
3288
+ /**
3289
+ * OpenAPI configuration schema.
3290
+ */
3291
+ const OpenApiConfigSchema = object({
3292
+ enabled: boolean().optional(),
3293
+ title: string().optional(),
3294
+ version: string().optional(),
3295
+ description: string().optional()
3296
+ });
3297
+ /**
3298
+ * Hooks configuration schema.
3299
+ */
3300
+ const HooksConfigSchema = object({ server: string().optional() });
3301
+ /**
3302
+ * Client generation configuration schema.
3303
+ */
3304
+ const ClientConfigSchema = object({ output: string().optional() });
3305
+ /**
3306
+ * Deploy target schema.
3307
+ * Currently only 'dokploy' is supported.
3308
+ * 'vercel' and 'cloudflare' are planned for Phase 2.
3309
+ */
3310
+ const DeployTargetSchema = _enum([
3311
+ "dokploy",
3312
+ "vercel",
3313
+ "cloudflare"
3314
+ ]);
3315
+ /**
3316
+ * Supported deploy targets (Phase 1).
3317
+ */
3318
+ const SUPPORTED_DEPLOY_TARGETS = ["dokploy"];
3319
+ /**
3320
+ * Phase 2 deploy targets (not yet implemented).
3321
+ */
3322
+ const PHASE_2_DEPLOY_TARGETS = ["vercel", "cloudflare"];
3323
+ /**
3324
+ * Check if a deploy target is supported.
3325
+ */
3326
+ function isDeployTargetSupported(target) {
3327
+ return SUPPORTED_DEPLOY_TARGETS.includes(target);
3328
+ }
3329
+ /**
3330
+ * Check if a deploy target is planned for Phase 2.
3331
+ */
3332
+ function isPhase2DeployTarget(target) {
3333
+ return PHASE_2_DEPLOY_TARGETS.includes(target);
3334
+ }
3335
+ /**
3336
+ * Get error message for unsupported deploy targets.
3337
+ */
3338
+ function getDeployTargetError(target, appName) {
3339
+ if (isPhase2DeployTarget(target)) {
3340
+ const context = appName ? ` for app "${appName}"` : "";
3341
+ return `Deploy target "${target}"${context} is coming in Phase 2. Currently only "dokploy" is supported.`;
3342
+ }
3343
+ return `Unknown deploy target: ${target}. Supported: dokploy. Coming in Phase 2: vercel, cloudflare.`;
3344
+ }
3345
+ /**
3346
+ * Service image configuration schema.
3347
+ */
3348
+ const ServiceImageConfigSchema = object({
3349
+ version: string().optional(),
3350
+ image: string().optional()
3351
+ });
3352
+ /**
3353
+ * Mail service configuration schema.
3354
+ */
3355
+ const MailServiceConfigSchema = ServiceImageConfigSchema.extend({ smtp: object({
3356
+ host: string(),
3357
+ port: number(),
3358
+ user: string().optional(),
3359
+ pass: string().optional()
3360
+ }).optional() });
3361
+ /**
3362
+ * Services configuration schema.
3363
+ */
3364
+ const ServicesConfigSchema = object({
3365
+ db: union([boolean(), ServiceImageConfigSchema]).optional(),
3366
+ cache: union([boolean(), ServiceImageConfigSchema]).optional(),
3367
+ mail: union([boolean(), MailServiceConfigSchema]).optional()
3368
+ });
3369
+ /**
3370
+ * Dokploy workspace configuration schema.
3371
+ */
3372
+ const DokployWorkspaceConfigSchema = object({
3373
+ endpoint: url("Dokploy endpoint must be a valid URL"),
3374
+ projectId: string().min(1, "Project ID is required"),
3375
+ registry: string().optional(),
3376
+ registryId: string().optional()
3377
+ });
3378
+ /**
3379
+ * Deploy configuration schema.
3380
+ */
3381
+ const DeployConfigSchema = object({
3382
+ default: DeployTargetSchema.optional(),
3383
+ dokploy: DokployWorkspaceConfigSchema.optional()
3384
+ });
3385
+ /**
3386
+ * Models configuration schema.
3387
+ */
3388
+ const ModelsConfigSchema = object({
3389
+ path: string().optional(),
3390
+ schema: _enum(["zod"]).optional()
3391
+ });
3392
+ /**
3393
+ * Shared configuration schema.
3394
+ */
3395
+ const SharedConfigSchema = object({
3396
+ packages: array(string()).optional(),
3397
+ models: ModelsConfigSchema.optional()
3398
+ });
3399
+ /**
3400
+ * Secrets configuration schema.
3401
+ */
3402
+ const SecretsConfigSchema = object({
3403
+ enabled: boolean().optional(),
3404
+ algorithm: string().optional(),
3405
+ kdf: _enum(["scrypt", "pbkdf2"]).optional()
3406
+ });
3407
+ /**
3408
+ * App configuration schema.
3409
+ */
3410
+ const AppConfigSchema = object({
3411
+ type: _enum(["backend", "frontend"]).optional().default("backend"),
3412
+ path: string().min(1, "App path is required"),
3413
+ port: number().int().positive("Port must be a positive integer"),
3414
+ dependencies: array(string()).optional(),
3415
+ deploy: DeployTargetSchema.optional(),
3416
+ routes: RoutesSchema.optional(),
3417
+ functions: RoutesSchema.optional(),
3418
+ crons: RoutesSchema.optional(),
3419
+ subscribers: RoutesSchema.optional(),
3420
+ envParser: string().optional(),
3421
+ logger: string().optional(),
3422
+ hooks: HooksConfigSchema.optional(),
3423
+ telescope: union([
3424
+ string(),
3425
+ boolean(),
3426
+ TelescopeConfigSchema
3427
+ ]).optional(),
3428
+ studio: union([
3429
+ string(),
3430
+ boolean(),
3431
+ StudioConfigSchema
3432
+ ]).optional(),
3433
+ openapi: union([boolean(), OpenApiConfigSchema]).optional(),
3434
+ runtime: _enum(["node", "bun"]).optional(),
3435
+ env: union([string(), array(string())]).optional(),
3436
+ framework: _enum(["nextjs"]).optional(),
3437
+ client: ClientConfigSchema.optional()
3438
+ }).refine((data) => {
3439
+ if (data.type === "backend" && !data.routes) return false;
3440
+ return true;
3441
+ }, {
3442
+ message: "Backend apps must have routes defined",
3443
+ path: ["routes"]
3444
+ }).refine((data) => {
3445
+ if (data.type === "frontend" && !data.framework) return false;
3446
+ return true;
3447
+ }, {
3448
+ message: "Frontend apps must have framework defined",
3449
+ path: ["framework"]
3450
+ });
3451
+ /**
3452
+ * Workspace configuration schema.
3453
+ */
3454
+ const WorkspaceConfigSchema = object({
3455
+ name: string().optional(),
3456
+ apps: record(string(), AppConfigSchema).refine((apps) => Object.keys(apps).length > 0, { message: "At least one app must be defined" }),
3457
+ shared: SharedConfigSchema.optional(),
3458
+ deploy: DeployConfigSchema.optional(),
3459
+ services: ServicesConfigSchema.optional(),
3460
+ secrets: SecretsConfigSchema.optional()
3461
+ }).refine((data) => {
3462
+ const appNames = Object.keys(data.apps);
3463
+ for (const [appName, app] of Object.entries(data.apps)) for (const dep of app.dependencies ?? []) {
3464
+ if (!appNames.includes(dep)) return false;
3465
+ if (dep === appName) return false;
3466
+ }
3467
+ return true;
3468
+ }, { message: "App dependencies must reference existing apps and cannot be self-referential" }).refine((data) => {
3469
+ const appNames = Object.keys(data.apps);
3470
+ const visited = /* @__PURE__ */ new Set();
3471
+ const recStack = /* @__PURE__ */ new Set();
3472
+ function hasCycle(app) {
3473
+ if (recStack.has(app)) return true;
3474
+ if (visited.has(app)) return false;
3475
+ visited.add(app);
3476
+ recStack.add(app);
3477
+ const deps = data.apps[app]?.dependencies ?? [];
3478
+ for (const dep of deps) if (hasCycle(dep)) return true;
3479
+ recStack.delete(app);
3480
+ return false;
3481
+ }
3482
+ for (const app of appNames) {
3483
+ visited.clear();
3484
+ recStack.clear();
3485
+ if (hasCycle(app)) return false;
3486
+ }
3487
+ return true;
3488
+ }, { message: "Circular dependencies detected between apps" }).superRefine((data, ctx) => {
3489
+ const defaultTarget = data.deploy?.default;
3490
+ if (defaultTarget && !isDeployTargetSupported(defaultTarget)) {
3491
+ ctx.addIssue({
3492
+ code: ZodIssueCode.custom,
3493
+ message: getDeployTargetError(defaultTarget),
3494
+ path: ["deploy", "default"]
3495
+ });
3496
+ return;
3497
+ }
3498
+ for (const [appName, app] of Object.entries(data.apps)) if (app.deploy && !isDeployTargetSupported(app.deploy)) {
3499
+ ctx.addIssue({
3500
+ code: ZodIssueCode.custom,
3501
+ message: getDeployTargetError(app.deploy, appName),
3502
+ path: [
3503
+ "apps",
3504
+ appName,
3505
+ "deploy"
3506
+ ]
3507
+ });
3508
+ return;
3509
+ }
3510
+ });
3511
+ /**
3512
+ * Validate workspace configuration.
3513
+ * Throws ZodError with detailed messages on validation failure.
3514
+ */
3515
+ function validateWorkspaceConfig(config$1) {
3516
+ return WorkspaceConfigSchema.parse(config$1);
3517
+ }
3518
+ /**
3519
+ * Safe validation that returns result instead of throwing.
3520
+ */
3521
+ function safeValidateWorkspaceConfig(config$1) {
3522
+ const result = WorkspaceConfigSchema.safeParse(config$1);
3523
+ if (result.success) return {
3524
+ success: true,
3525
+ data: result.data
3526
+ };
3527
+ return {
3528
+ success: false,
3529
+ error: result.error
3530
+ };
3531
+ }
3532
+ /**
3533
+ * Format Zod errors into user-friendly messages.
3534
+ */
3535
+ function formatValidationErrors(error) {
3536
+ const messages = error.issues.map((issue$1) => {
3537
+ const path = issue$1.path.join(".");
3538
+ return path ? ` - ${path}: ${issue$1.message}` : ` - ${issue$1.message}`;
3539
+ });
3540
+ return `Workspace configuration validation failed:\n${messages.join("\n")}`;
3541
+ }
3542
+
3543
+ //#endregion
3544
+ //#region src/workspace/types.ts
3545
+ /**
3546
+ * Type guard to check if a config is a WorkspaceConfig.
3547
+ */
3548
+ function isWorkspaceConfig(config$1) {
3549
+ return typeof config$1 === "object" && config$1 !== null && "apps" in config$1 && typeof config$1.apps === "object";
3550
+ }
3551
+
3552
+ //#endregion
3553
+ //#region src/workspace/index.ts
3554
+ /**
3555
+ * Validate that all dependencies reference existing apps.
3556
+ * Returns the config if valid, throws otherwise.
3557
+ */
3558
+ function validateDependencies(apps) {
3559
+ const appNames = new Set(Object.keys(apps));
3560
+ for (const [appName, app] of Object.entries(apps)) for (const dep of app.dependencies ?? []) {
3561
+ if (!appNames.has(dep)) throw new Error(`Invalid dependency: App "${appName}" depends on "${dep}" which does not exist. Valid apps are: ${[...appNames].join(", ")}`);
3562
+ if (dep === appName) throw new Error(`Invalid dependency: App "${appName}" cannot depend on itself.`);
3563
+ }
3564
+ }
3565
+ /**
3566
+ * Define workspace configuration with full TypeScript support and type inference.
3567
+ *
3568
+ * Uses `const` type parameter to infer literal app names, providing:
3569
+ * - Autocomplete for app names in dependencies
3570
+ * - Type errors for invalid dependency references
3571
+ * - Full type inference for the returned config
3572
+ *
3573
+ * @example
3574
+ * ```ts
3575
+ * // gkm.config.ts
3576
+ * import { defineWorkspace } from '@geekmidas/cli';
3577
+ *
3578
+ * export default defineWorkspace({
3579
+ * name: 'my-saas',
3580
+ * apps: {
3581
+ * api: {
3582
+ * type: 'backend',
3583
+ * path: 'apps/api',
3584
+ * port: 3000,
3585
+ * routes: './src/endpoints/**\/*.ts',
3586
+ * envParser: './src/config/env',
3587
+ * logger: './src/logger',
3588
+ * },
3589
+ * web: {
3590
+ * type: 'frontend',
3591
+ * framework: 'nextjs',
3592
+ * path: 'apps/web',
3593
+ * port: 3001,
3594
+ * dependencies: ['api'], // <- autocomplete shows 'api' | 'web'
3595
+ * },
3596
+ * },
3597
+ * services: {
3598
+ * db: true,
3599
+ * cache: true,
3600
+ * },
3601
+ * });
3602
+ *
3603
+ * // config.apps.api <- full type inference
3604
+ * // config.apps.foo <- TypeScript error
3605
+ * ```
3606
+ */
3607
+ function defineWorkspace(config$1) {
3608
+ validateDependencies(config$1.apps);
3609
+ const result = safeValidateWorkspaceConfig(config$1);
3610
+ if (!result.success && result.error) throw new Error(formatValidationErrors(result.error));
3611
+ return config$1;
3612
+ }
3613
+ /**
3614
+ * Get the package name from package.json in the given directory.
3615
+ */
3616
+ function getPackageName(cwd) {
3617
+ try {
3618
+ const pkg = require(`${cwd}/package.json`);
3619
+ return pkg.name?.replace(/^@[^/]+\//, "");
3620
+ } catch {
3621
+ return void 0;
3622
+ }
3623
+ }
3624
+ /**
3625
+ * Normalize a workspace configuration with resolved defaults.
3626
+ */
3627
+ function normalizeWorkspace(config$1, cwd) {
3628
+ const name = config$1.name ?? getPackageName(cwd) ?? (0, node_path.basename)(cwd);
3629
+ const defaultTarget = config$1.deploy?.default ?? "dokploy";
3630
+ const normalizedApps = {};
3631
+ for (const [appName, app] of Object.entries(config$1.apps)) normalizedApps[appName] = normalizeAppConfig(app, defaultTarget);
3632
+ return {
3633
+ name,
3634
+ root: cwd,
3635
+ apps: normalizedApps,
3636
+ services: config$1.services ?? {},
3637
+ deploy: config$1.deploy ?? { default: "dokploy" },
3638
+ shared: config$1.shared ?? { packages: ["packages/*"] },
3639
+ secrets: config$1.secrets ?? {}
3640
+ };
3641
+ }
3642
+ /**
3643
+ * Normalize an app configuration with resolved defaults.
3644
+ * @param app - App configuration
3645
+ * @param defaultTarget - Default deploy target from workspace config
3646
+ */
3647
+ function normalizeAppConfig(app, defaultTarget) {
3648
+ return {
3649
+ ...app,
3650
+ type: app.type ?? "backend",
3651
+ port: app.port,
3652
+ path: app.path,
3653
+ dependencies: app.dependencies ?? [],
3654
+ resolvedDeployTarget: app.deploy ?? defaultTarget
3655
+ };
3656
+ }
3657
+ /**
3658
+ * Wrap a single-app GkmConfig as a workspace.
3659
+ * This allows existing single-app configs to work seamlessly.
3660
+ */
3661
+ function wrapSingleAppAsWorkspace(config$1, cwd) {
3662
+ const name = getPackageName(cwd) ?? (0, node_path.basename)(cwd);
3663
+ const services = config$1.docker?.compose?.services;
3664
+ const normalizedServices = {};
3665
+ if (services) if (Array.isArray(services)) for (const svc of services) {
3666
+ if (svc === "postgres") normalizedServices.db = true;
3667
+ if (svc === "redis") normalizedServices.cache = true;
3668
+ }
3669
+ else {
3670
+ if (services.postgres) normalizedServices.db = services.postgres;
3671
+ if (services.redis) normalizedServices.cache = services.redis;
3672
+ }
3673
+ const apiApp = {
3674
+ type: "backend",
3675
+ path: ".",
3676
+ port: 3e3,
3677
+ dependencies: [],
3678
+ resolvedDeployTarget: "dokploy",
3679
+ routes: config$1.routes,
3680
+ functions: config$1.functions,
3681
+ crons: config$1.crons,
3682
+ subscribers: config$1.subscribers,
3683
+ envParser: config$1.envParser,
3684
+ logger: config$1.logger,
3685
+ providers: config$1.providers,
3686
+ hooks: config$1.hooks,
3687
+ telescope: config$1.telescope,
3688
+ studio: config$1.studio,
3689
+ openapi: config$1.openapi,
3690
+ runtime: config$1.runtime,
3691
+ env: config$1.env
3692
+ };
3693
+ return {
3694
+ name,
3695
+ root: cwd,
3696
+ apps: { api: apiApp },
3697
+ services: normalizedServices,
3698
+ deploy: { default: "dokploy" },
3699
+ shared: { packages: [] },
3700
+ secrets: {}
3701
+ };
3702
+ }
3703
+ /**
3704
+ * Process a loaded configuration (either single-app or workspace).
3705
+ * Returns a normalized workspace in both cases.
3706
+ */
3707
+ function processConfig(config$1, cwd) {
3708
+ if (isWorkspaceConfig(config$1)) {
3709
+ const result = safeValidateWorkspaceConfig(config$1);
3710
+ if (!result.success && result.error) throw new Error(formatValidationErrors(result.error));
3711
+ return {
3712
+ type: "workspace",
3713
+ raw: config$1,
3714
+ workspace: normalizeWorkspace(config$1, cwd)
3715
+ };
3716
+ }
3717
+ return {
3718
+ type: "single",
3719
+ raw: config$1,
3720
+ workspace: wrapSingleAppAsWorkspace(config$1, cwd)
3721
+ };
3722
+ }
3723
+ /**
3724
+ * Get the GkmConfig for a specific app in a workspace.
3725
+ * Useful for running existing single-app commands on a specific app.
3726
+ */
3727
+ function getAppGkmConfig(workspace, appName) {
3728
+ const app = workspace.apps[appName];
3729
+ if (!app || app.type !== "backend") return void 0;
3730
+ return {
3731
+ routes: app.routes ?? "",
3732
+ functions: app.functions,
3733
+ crons: app.crons,
3734
+ subscribers: app.subscribers,
3735
+ envParser: app.envParser ?? "",
3736
+ logger: app.logger ?? "",
3737
+ providers: app.providers,
3738
+ hooks: app.hooks,
3739
+ telescope: app.telescope,
3740
+ studio: app.studio,
3741
+ openapi: app.openapi,
3742
+ runtime: app.runtime,
3743
+ env: app.env
3744
+ };
3745
+ }
3746
+ /**
3747
+ * Get topologically sorted app names based on dependencies.
3748
+ * Apps with no dependencies come first, then apps that depend on them.
3749
+ */
3750
+ function getAppBuildOrder(workspace) {
3751
+ const appNames = Object.keys(workspace.apps);
3752
+ const visited = /* @__PURE__ */ new Set();
3753
+ const result = [];
3754
+ function visit(name) {
3755
+ if (visited.has(name)) return;
3756
+ visited.add(name);
3757
+ const app = workspace.apps[name];
3758
+ if (app) for (const dep of app.dependencies) visit(dep);
3759
+ result.push(name);
3760
+ }
3761
+ for (const name of appNames) visit(name);
3762
+ return result;
3763
+ }
3764
+ /**
3765
+ * Generate environment variables for app dependencies.
3766
+ * Each dependency gets a {DEP_NAME}_URL variable.
3767
+ */
3768
+ function getDependencyEnvVars(workspace, appName, urlPrefix = "http://localhost") {
3769
+ const app = workspace.apps[appName];
3770
+ if (!app) return {};
3771
+ const env = {};
3772
+ for (const depName of app.dependencies) {
3773
+ const dep = workspace.apps[depName];
3774
+ if (dep) {
3775
+ const envKey = `${depName.toUpperCase()}_URL`;
3776
+ env[envKey] = `${urlPrefix}:${dep.port}`;
3777
+ }
3778
+ }
3779
+ return env;
3780
+ }
3781
+
3782
+ //#endregion
3783
+ Object.defineProperty(exports, 'PHASE_2_DEPLOY_TARGETS', {
3784
+ enumerable: true,
3785
+ get: function () {
3786
+ return PHASE_2_DEPLOY_TARGETS;
3787
+ }
3788
+ });
3789
+ Object.defineProperty(exports, 'SUPPORTED_DEPLOY_TARGETS', {
3790
+ enumerable: true,
3791
+ get: function () {
3792
+ return SUPPORTED_DEPLOY_TARGETS;
3793
+ }
3794
+ });
3795
+ Object.defineProperty(exports, 'WorkspaceConfigSchema', {
3796
+ enumerable: true,
3797
+ get: function () {
3798
+ return WorkspaceConfigSchema;
3799
+ }
3800
+ });
3801
+ Object.defineProperty(exports, 'defineWorkspace', {
3802
+ enumerable: true,
3803
+ get: function () {
3804
+ return defineWorkspace;
3805
+ }
3806
+ });
3807
+ Object.defineProperty(exports, 'formatValidationErrors', {
3808
+ enumerable: true,
3809
+ get: function () {
3810
+ return formatValidationErrors;
3811
+ }
3812
+ });
3813
+ Object.defineProperty(exports, 'getAppBuildOrder', {
3814
+ enumerable: true,
3815
+ get: function () {
3816
+ return getAppBuildOrder;
3817
+ }
3818
+ });
3819
+ Object.defineProperty(exports, 'getAppGkmConfig', {
3820
+ enumerable: true,
3821
+ get: function () {
3822
+ return getAppGkmConfig;
3823
+ }
3824
+ });
3825
+ Object.defineProperty(exports, 'getDependencyEnvVars', {
3826
+ enumerable: true,
3827
+ get: function () {
3828
+ return getDependencyEnvVars;
3829
+ }
3830
+ });
3831
+ Object.defineProperty(exports, 'getDeployTargetError', {
3832
+ enumerable: true,
3833
+ get: function () {
3834
+ return getDeployTargetError;
3835
+ }
3836
+ });
3837
+ Object.defineProperty(exports, 'isDeployTargetSupported', {
3838
+ enumerable: true,
3839
+ get: function () {
3840
+ return isDeployTargetSupported;
3841
+ }
3842
+ });
3843
+ Object.defineProperty(exports, 'isPhase2DeployTarget', {
3844
+ enumerable: true,
3845
+ get: function () {
3846
+ return isPhase2DeployTarget;
3847
+ }
3848
+ });
3849
+ Object.defineProperty(exports, 'isWorkspaceConfig', {
3850
+ enumerable: true,
3851
+ get: function () {
3852
+ return isWorkspaceConfig;
3853
+ }
3854
+ });
3855
+ Object.defineProperty(exports, 'normalizeWorkspace', {
3856
+ enumerable: true,
3857
+ get: function () {
3858
+ return normalizeWorkspace;
3859
+ }
3860
+ });
3861
+ Object.defineProperty(exports, 'processConfig', {
3862
+ enumerable: true,
3863
+ get: function () {
3864
+ return processConfig;
3865
+ }
3866
+ });
3867
+ Object.defineProperty(exports, 'safeValidateWorkspaceConfig', {
3868
+ enumerable: true,
3869
+ get: function () {
3870
+ return safeValidateWorkspaceConfig;
3871
+ }
3872
+ });
3873
+ Object.defineProperty(exports, 'validateWorkspaceConfig', {
3874
+ enumerable: true,
3875
+ get: function () {
3876
+ return validateWorkspaceConfig;
3877
+ }
3878
+ });
3879
+ Object.defineProperty(exports, 'wrapSingleAppAsWorkspace', {
3880
+ enumerable: true,
3881
+ get: function () {
3882
+ return wrapSingleAppAsWorkspace;
3883
+ }
3884
+ });
3885
+ //# sourceMappingURL=workspace-iWgBlX6h.cjs.map