@powerhousedao/ph-cli 6.2.3-dev.54 → 6.2.3-dev.56

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