bsv-mcp 0.6.0 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -49,18 +49,23 @@ function jsonStringifyReplacer(_, value) {
49
49
  return value.toString();
50
50
  return value;
51
51
  }
52
- function cached(getter) {
53
- const set = false;
54
- return {
55
- get value() {
56
- if (!set) {
57
- const value = getter();
58
- Object.defineProperty(this, "value", { value });
59
- return value;
60
- }
61
- throw new Error("cached value already set");
52
+
53
+ class Cached {
54
+ constructor(getter) {
55
+ this._getter = getter;
56
+ this._value = undefined;
57
+ }
58
+ get value() {
59
+ const getter = this._getter;
60
+ if (getter !== undefined) {
61
+ this._value = getter();
62
+ this._getter = undefined;
62
63
  }
63
- };
64
+ return this._value;
65
+ }
66
+ }
67
+ function cached(getter) {
68
+ return new Cached(getter);
64
69
  }
65
70
  function nullish(input) {
66
71
  return input === null || input === undefined;
@@ -78,6 +83,56 @@ function assignProp(target, prop, value) {
78
83
  configurable: true
79
84
  });
80
85
  }
86
+ function rawShape(def) {
87
+ const desc = Object.getOwnPropertyDescriptor(def, "shape");
88
+ return desc?.get ? desc.get.raw : desc?.value;
89
+ }
90
+ function sourceShape(schema) {
91
+ return rawShape(schema._zod.def) ?? schema._zod.def.shape;
92
+ }
93
+ function deferProp(target, key, getter) {
94
+ Object.defineProperty(target, key, {
95
+ get() {
96
+ const value = getter();
97
+ assignProp(this, key, value);
98
+ return value;
99
+ },
100
+ enumerable: true,
101
+ configurable: true
102
+ });
103
+ }
104
+ function putProp(target, key, value) {
105
+ if (key in target)
106
+ assignProp(target, key, value);
107
+ else
108
+ target[key] = value;
109
+ }
110
+ function mirrorShape(target, source, keys, wrap) {
111
+ const raw = sourceShape(source);
112
+ for (const key of keys) {
113
+ const desc = Object.getOwnPropertyDescriptor(raw, key);
114
+ if (!desc.enumerable)
115
+ continue;
116
+ if (desc.get) {
117
+ deferProp(target, key, () => {
118
+ const value = source._zod.def.shape[key];
119
+ return wrap ? wrap(value, key) : value;
120
+ });
121
+ } else
122
+ putProp(target, key, wrap ? wrap(desc.value, key) : desc.value);
123
+ }
124
+ }
125
+ function mirrorProps(target, source) {
126
+ for (const key of Reflect.ownKeys(source)) {
127
+ const desc = Object.getOwnPropertyDescriptor(source, key);
128
+ if (!desc.enumerable)
129
+ continue;
130
+ if (desc.get)
131
+ deferProp(target, key, () => source[key]);
132
+ else
133
+ putProp(target, key, desc.value);
134
+ }
135
+ }
81
136
  function mergeDefs(...defs) {
82
137
  const mergedDescriptors = {};
83
138
  for (const def of defs) {
@@ -176,6 +231,17 @@ function optionalKeys(shape) {
176
231
  return shape[k]._zod.optin !== undefined && shape[k]._zod.optout === "optional";
177
232
  });
178
233
  }
234
+ var NUMBER_FORMAT_RANGES = /* @__PURE__ */ (() => ({
235
+ safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
236
+ int32: [-2147483648, 2147483647],
237
+ uint32: [0, 4294967295],
238
+ float32: [-340282346638528860000000000000000000000, 340282346638528860000000000000000000000],
239
+ float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
240
+ }))();
241
+ var BIGINT_FORMAT_RANGES = {
242
+ int64: [/* @__PURE__ */ BigInt("-9223372036854775808"), /* @__PURE__ */ BigInt("9223372036854775807")],
243
+ uint64: [/* @__PURE__ */ BigInt(0), /* @__PURE__ */ BigInt("18446744073709551615")]
244
+ };
179
245
  function pick(schema, mask) {
180
246
  const currDef = schema._zod.def;
181
247
  const checks = currDef.checks;
@@ -183,23 +249,21 @@ function pick(schema, mask) {
183
249
  if (hasChecks) {
184
250
  throw new Error(".pick() cannot be used on object schemas containing refinements");
185
251
  }
186
- const def = mergeDefs(schema._zod.def, {
187
- get shape() {
188
- const newShape = {};
189
- for (const key of Reflect.ownKeys(mask)) {
190
- if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) {
191
- throw new Error(`Unrecognized key: "${String(key)}"`);
192
- }
193
- if (!mask[key])
194
- continue;
195
- assignProp(newShape, key, currDef.shape[key]);
196
- }
197
- assignProp(this, "shape", newShape);
198
- return newShape;
199
- },
200
- checks: []
201
- });
202
- return clone(schema, def);
252
+ const newShape = {};
253
+ mirrorShape(newShape, schema, maskedKeys(schema, mask));
254
+ return clone(schema, mergeDefs(currDef, { shape: newShape, checks: [] }));
255
+ }
256
+ function maskedKeys(schema, mask) {
257
+ const raw = sourceShape(schema);
258
+ const keys = [];
259
+ for (const key of Reflect.ownKeys(mask)) {
260
+ if (!Object.getOwnPropertyDescriptor(raw, key)?.enumerable) {
261
+ throw new Error(`Unrecognized key: "${String(key)}"`);
262
+ }
263
+ if (mask[key])
264
+ keys.push(key);
265
+ }
266
+ return keys;
203
267
  }
204
268
  function omit(schema, mask) {
205
269
  const currDef = schema._zod.def;
@@ -208,23 +272,10 @@ function omit(schema, mask) {
208
272
  if (hasChecks) {
209
273
  throw new Error(".omit() cannot be used on object schemas containing refinements");
210
274
  }
211
- const def = mergeDefs(schema._zod.def, {
212
- get shape() {
213
- const newShape = { ...schema._zod.def.shape };
214
- for (const key of Reflect.ownKeys(mask)) {
215
- if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) {
216
- throw new Error(`Unrecognized key: "${String(key)}"`);
217
- }
218
- if (!mask[key])
219
- continue;
220
- delete newShape[key];
221
- }
222
- assignProp(this, "shape", newShape);
223
- return newShape;
224
- },
225
- checks: []
226
- });
227
- return clone(schema, def);
275
+ const omitted = new Set(maskedKeys(schema, mask));
276
+ const newShape = {};
277
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)).filter((key) => !omitted.has(key)));
278
+ return clone(schema, mergeDefs(currDef, { shape: newShape, checks: [] }));
228
279
  }
229
280
  function extend(schema, shape) {
230
281
  if (!isPlainObject(shape)) {
@@ -233,34 +284,26 @@ function extend(schema, shape) {
233
284
  const checks = schema._zod.def.checks;
234
285
  const hasChecks = checks && checks.length > 0;
235
286
  if (hasChecks) {
236
- const existingShape = schema._zod.def.shape;
287
+ const existingShape = sourceShape(schema);
237
288
  for (const key of Reflect.ownKeys(shape)) {
238
289
  if (Object.getOwnPropertyDescriptor(existingShape, key) !== undefined) {
239
290
  throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
240
291
  }
241
292
  }
242
293
  }
243
- const def = mergeDefs(schema._zod.def, {
244
- get shape() {
245
- const _shape = { ...schema._zod.def.shape, ...shape };
246
- assignProp(this, "shape", _shape);
247
- return _shape;
248
- }
249
- });
250
- return clone(schema, def);
294
+ return clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
295
+ }
296
+ function extended(schema, shape) {
297
+ const newShape = {};
298
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)));
299
+ mirrorProps(newShape, shape);
300
+ return newShape;
251
301
  }
252
302
  function safeExtend(schema, shape) {
253
303
  if (!isPlainObject(shape)) {
254
304
  throw new Error("Invalid input to safeExtend: expected a plain object");
255
305
  }
256
- const def = mergeDefs(schema._zod.def, {
257
- get shape() {
258
- const _shape = { ...schema._zod.def.shape, ...shape };
259
- assignProp(this, "shape", _shape);
260
- return _shape;
261
- }
262
- });
263
- return clone(schema, def);
306
+ return clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
264
307
  }
265
308
  function merge(a, b) {
266
309
  if (!b?._zod?.def) {
@@ -269,12 +312,11 @@ function merge(a, b) {
269
312
  if (a._zod.def.checks?.length) {
270
313
  throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
271
314
  }
315
+ const newShape = {};
316
+ mirrorShape(newShape, a, Reflect.ownKeys(sourceShape(a)));
317
+ mirrorShape(newShape, b, Reflect.ownKeys(sourceShape(b)));
272
318
  const def = mergeDefs(a._zod.def, {
273
- get shape() {
274
- const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
275
- assignProp(this, "shape", _shape);
276
- return _shape;
277
- },
319
+ shape: newShape,
278
320
  get catchall() {
279
321
  return b._zod.def.catchall;
280
322
  },
@@ -289,67 +331,16 @@ function partial(Class, schema, mask, name = "partial") {
289
331
  if (hasChecks) {
290
332
  throw new Error(`.${name}() cannot be used on object schemas containing refinements`);
291
333
  }
292
- const def = mergeDefs(schema._zod.def, {
293
- get shape() {
294
- const oldShape = schema._zod.def.shape;
295
- const shape = { ...oldShape };
296
- if (mask) {
297
- for (const key of Reflect.ownKeys(mask)) {
298
- if (!Object.prototype.hasOwnProperty.call(oldShape, key)) {
299
- throw new Error(`Unrecognized key: "${String(key)}"`);
300
- }
301
- if (!mask[key])
302
- continue;
303
- shape[key] = Class ? new Class({
304
- type: "optional",
305
- innerType: oldShape[key]
306
- }) : oldShape[key];
307
- }
308
- } else {
309
- for (const key of Reflect.ownKeys(oldShape)) {
310
- shape[key] = Class ? new Class({
311
- type: "optional",
312
- innerType: oldShape[key]
313
- }) : oldShape[key];
314
- }
315
- }
316
- assignProp(this, "shape", shape);
317
- return shape;
318
- },
319
- checks: []
320
- });
321
- return clone(schema, def);
334
+ const selected = mask ? new Set(maskedKeys(schema, mask)) : undefined;
335
+ const newShape = {};
336
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), Class && ((value, key) => selected && !selected.has(key) ? value : new Class({ type: "optional", innerType: value })));
337
+ return clone(schema, mergeDefs(schema._zod.def, { shape: newShape, checks: [] }));
322
338
  }
323
339
  function required(Class, schema, mask) {
324
- const def = mergeDefs(schema._zod.def, {
325
- get shape() {
326
- const oldShape = schema._zod.def.shape;
327
- const shape = { ...oldShape };
328
- if (mask) {
329
- for (const key of Reflect.ownKeys(mask)) {
330
- if (!Object.prototype.hasOwnProperty.call(shape, key)) {
331
- throw new Error(`Unrecognized key: "${String(key)}"`);
332
- }
333
- if (!mask[key])
334
- continue;
335
- shape[key] = new Class({
336
- type: "nonoptional",
337
- innerType: oldShape[key]
338
- });
339
- }
340
- } else {
341
- for (const key of Reflect.ownKeys(oldShape)) {
342
- shape[key] = new Class({
343
- type: "nonoptional",
344
- innerType: oldShape[key]
345
- });
346
- }
347
- }
348
- assignProp(this, "shape", shape);
349
- return shape;
350
- }
351
- });
352
- return clone(schema, def);
340
+ const selected = mask ? new Set(maskedKeys(schema, mask)) : undefined;
341
+ const newShape = {};
342
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), (value, key) => selected && !selected.has(key) ? value : new Class({ type: "nonoptional", innerType: value }));
343
+ return clone(schema, mergeDefs(schema._zod.def, { shape: newShape }));
353
344
  }
354
345
  function aborted(x, startIndex = 0) {
355
346
  if (x.aborted === true)
@@ -399,13 +390,18 @@ function finalizeIssue(iss, ctx, config) {
399
390
  }
400
391
  const schemaError = iss.schema !== iss.inst ? iss.schema?._zod.def?.error : undefined;
401
392
  const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(schemaError?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input";
402
- const { inst: _inst, schema: _schema, continue: _continue, input: _input, ...rest } = iss;
403
- rest.path ?? (rest.path = []);
404
- rest.message = message;
393
+ const full = {};
394
+ for (const k of Object.keys(iss)) {
395
+ if (k === "inst" || k === "schema" || k === "continue" || k === "input" || k === "__proto__")
396
+ continue;
397
+ full[k] = iss[k];
398
+ }
399
+ full.path ?? (full.path = []);
400
+ full.message = message;
405
401
  if (ctx?.reportInput) {
406
- rest.input = _input;
402
+ full.input = iss.input;
407
403
  }
408
- return rest;
404
+ return full;
409
405
  }
410
406
  var highSurrogate = /[\uD800-\uDBFF]/;
411
407
  function codePointLength(str) {
@@ -469,6 +465,9 @@ function members(proto, table) {
469
465
  else
470
466
  defineBound(proto, key, desc.value);
471
467
  }
468
+ for (const sym of Object.getOwnPropertySymbols(table)) {
469
+ defineBound(proto, sym, table[sym]);
470
+ }
472
471
  }
473
472
  function own(inst, key, value, enumerable = true) {
474
473
  Object.defineProperty(inst, key, { configurable: true, writable: true, enumerable, value });
@@ -477,6 +476,22 @@ function own(inst, key, value, enumerable = true) {
477
476
  function hide(inst, key, value) {
478
477
  return own(inst, key, value, false);
479
478
  }
479
+ function derived(computes, table) {
480
+ for (const key in computes) {
481
+ const compute = computes[key];
482
+ Object.defineProperty(table, key, {
483
+ configurable: true,
484
+ enumerable: true,
485
+ get() {
486
+ return own(this, key, compute(this));
487
+ },
488
+ set(value) {
489
+ own(this, key, value);
490
+ }
491
+ });
492
+ }
493
+ return table;
494
+ }
480
495
  function defineBound(proto, key, fn) {
481
496
  Object.defineProperty(proto, key, {
482
497
  configurable: true,
@@ -692,16 +707,12 @@ var _messageDesc = {
692
707
  enumerable: true,
693
708
  configurable: true
694
709
  };
695
- var _zodDesc2 = { value: undefined, enumerable: false };
696
710
  var _issuesDesc = { value: undefined, enumerable: false };
697
711
  var _installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
698
712
  var initializer = (inst, def) => {
699
713
  inst.name = "$ZodError";
700
- _zodDesc2.value = inst._zod;
701
- Object.defineProperty(inst, "_zod", _zodDesc2);
702
714
  _issuesDesc.value = def;
703
715
  Object.defineProperty(inst, "issues", _issuesDesc);
704
- _zodDesc2.value = undefined;
705
716
  _issuesDesc.value = undefined;
706
717
  Object.defineProperty(inst, "message", _messageDesc);
707
718
  const proto = Object.getPrototypeOf(inst);
@@ -837,23 +848,68 @@ var _safeParse = (_Err) => (schema, value, _ctx) => {
837
848
  if (result instanceof Promise) {
838
849
  throw new $ZodAsyncError;
839
850
  }
840
- return result.issues.length ? {
841
- success: false,
842
- error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
843
- } : { success: true, data: result.value };
851
+ return result.issues.length ? failure(_Err, result.issues, ctx) : { success: true, data: result.value };
844
852
  };
845
- var safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
853
+ function failure(Err, issues, ctx) {
854
+ let error;
855
+ return {
856
+ success: false,
857
+ get error() {
858
+ if (!error) {
859
+ error = new Err(issues.map((iss) => finalizeIssue(iss, ctx, config())));
860
+ issues = undefined;
861
+ ctx = undefined;
862
+ }
863
+ return error;
864
+ },
865
+ set error(e) {
866
+ error = e;
867
+ issues = undefined;
868
+ ctx = undefined;
869
+ }
870
+ };
871
+ }
846
872
  var _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
847
873
  const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
848
874
  let result = schema._zod.run({ value, issues: [] }, ctx);
849
875
  if (result instanceof Promise)
850
876
  result = await result;
851
- return result.issues.length ? {
852
- success: false,
853
- error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
854
- } : { success: true, data: result.value };
877
+ return result.issues.length ? failure(_Err, result.issues, ctx) : { success: true, data: result.value };
878
+ };
879
+ var COMPILE_INVALID = /* @__PURE__ */ Symbol.for("zod.compile.invalid");
880
+ var COMPILE_FALLBACK = /* @__PURE__ */ Symbol.for("zod.compile.fallback");
881
+ var validate = (schema, value, _ctx) => {
882
+ const validator = schema._zod.bag.validator;
883
+ if (validator !== undefined) {
884
+ if (validator(value) !== COMPILE_INVALID)
885
+ return true;
886
+ if (validator.definite === true && _ctx === undefined)
887
+ return false;
888
+ }
889
+ return validateFallback(schema, value, _ctx);
890
+ };
891
+ function validateFallback(schema, value, _ctx) {
892
+ const ctx = _ctx ? { ..._ctx, async: false, abortEarly: true } : { async: false, abortEarly: true };
893
+ const fallbackRun = schema._zod.bag.fallbackRun;
894
+ let result;
895
+ if (fallbackRun) {
896
+ ctx[COMPILE_FALLBACK] = true;
897
+ result = fallbackRun({ value, issues: [] }, ctx);
898
+ } else {
899
+ result = schema._zod.run({ value, issues: [] }, ctx);
900
+ }
901
+ if (result instanceof Promise) {
902
+ throw new $ZodAsyncError;
903
+ }
904
+ return result.issues.length === 0;
905
+ }
906
+ var validateAsync = async (schema, value, _ctx) => {
907
+ const ctx = _ctx ? { ..._ctx, async: true, abortEarly: true } : { async: true, abortEarly: true };
908
+ let result = schema._zod.run({ value, issues: [] }, ctx);
909
+ if (result instanceof Promise)
910
+ result = await result;
911
+ return result.issues.length === 0;
855
912
  };
856
- var safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
857
913
  var _encode = (_Err) => {
858
914
  const parse = _parse(_Err);
859
915
  const fn = (schema, value, _ctx, _params) => {
@@ -915,8 +971,8 @@ var uuid = (version) => {
915
971
  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)$/;
916
972
  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})$`);
917
973
  };
918
- var email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
919
- var _emoji = `^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
974
+ var email = /^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
975
+ var _emoji = `^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
920
976
  function emoji() {
921
977
  return new RegExp(_emoji, "u");
922
978
  }
@@ -925,7 +981,7 @@ var ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|(
925
981
  var 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])$/;
926
982
  var cidrv6 = /^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
927
983
  var base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
928
- var base64url = /^[A-Za-z0-9_-]*$/;
984
+ var base64url = /^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;
929
985
  var httpProtocol = /^https?$/;
930
986
  var e164 = /^\+[1-9]\d{6,14}$/;
931
987
  var 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])))`;
@@ -949,10 +1005,7 @@ function datetime(args) {
949
1005
  const timeRegex = args.local ? `${qualified}|${timeSource({ precision: args.precision })}` : qualified;
950
1006
  return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
951
1007
  }
952
- var string = (params) => {
953
- const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
954
- return new RegExp(`^${regex}$`);
955
- };
1008
+ var anyString = /^[\s\S]{0,}$/;
956
1009
  var lowercase = /^[^A-Z]*$/;
957
1010
  var uppercase = /^[^a-z]*$/;
958
1011
 
@@ -971,11 +1024,6 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins
971
1024
  var _a;
972
1025
  $ZodCheck.init(inst, def);
973
1026
  (_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
974
- inst._zod.onattach.push((inst) => {
975
- const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
976
- if (def.maximum < curr)
977
- inst._zod.bag.maximum = def.maximum;
978
- });
979
1027
  inst._zod.check = (payload) => {
980
1028
  const input = payload.value;
981
1029
  const units = input.length;
@@ -998,11 +1046,6 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins
998
1046
  var _a;
999
1047
  $ZodCheck.init(inst, def);
1000
1048
  (_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
1001
- inst._zod.onattach.push((inst) => {
1002
- const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
1003
- if (def.minimum > curr)
1004
- inst._zod.bag.minimum = def.minimum;
1005
- });
1006
1049
  inst._zod.check = (payload) => {
1007
1050
  const input = payload.value;
1008
1051
  const units = input.length;
@@ -1025,12 +1068,6 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
1025
1068
  var _a;
1026
1069
  $ZodCheck.init(inst, def);
1027
1070
  (_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
1028
- inst._zod.onattach.push((inst) => {
1029
- const bag = inst._zod.bag;
1030
- bag.minimum = def.length;
1031
- bag.maximum = def.length;
1032
- bag.length = def.length;
1033
- });
1034
1071
  inst._zod.check = (payload) => {
1035
1072
  const input = payload.value;
1036
1073
  const units = input.length;
@@ -1053,14 +1090,6 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
1053
1090
  var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
1054
1091
  var _a, _b;
1055
1092
  $ZodCheck.init(inst, def);
1056
- inst._zod.onattach.push((inst) => {
1057
- const bag = inst._zod.bag;
1058
- bag.format = def.format;
1059
- if (def.pattern) {
1060
- bag.patterns ?? (bag.patterns = new Set);
1061
- bag.patterns.add(def.pattern);
1062
- }
1063
- });
1064
1093
  if (def.pattern)
1065
1094
  (_a = inst._zod).check ?? (_a.check = (payload) => {
1066
1095
  def.pattern.lastIndex = 0;
@@ -1109,11 +1138,6 @@ var $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (inst,
1109
1138
  const escapedRegex = escapeRegex(def.includes);
1110
1139
  const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position},}${escapedRegex}` : escapedRegex);
1111
1140
  def.pattern = pattern;
1112
- inst._zod.onattach.push((inst) => {
1113
- const bag = inst._zod.bag;
1114
- bag.patterns ?? (bag.patterns = new Set);
1115
- bag.patterns.add(pattern);
1116
- });
1117
1141
  inst._zod.check = (payload) => {
1118
1142
  if (payload.value.includes(def.includes, def.position))
1119
1143
  return;
@@ -1132,11 +1156,6 @@ var $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith", (i
1132
1156
  $ZodCheck.init(inst, def);
1133
1157
  const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
1134
1158
  def.pattern ?? (def.pattern = pattern);
1135
- inst._zod.onattach.push((inst) => {
1136
- const bag = inst._zod.bag;
1137
- bag.patterns ?? (bag.patterns = new Set);
1138
- bag.patterns.add(pattern);
1139
- });
1140
1159
  inst._zod.check = (payload) => {
1141
1160
  if (payload.value.startsWith(def.prefix))
1142
1161
  return;
@@ -1155,11 +1174,6 @@ var $ZodCheckEndsWith = /* @__PURE__ */ $constructor("$ZodCheckEndsWith", (inst,
1155
1174
  $ZodCheck.init(inst, def);
1156
1175
  const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
1157
1176
  def.pattern ?? (def.pattern = pattern);
1158
- inst._zod.onattach.push((inst) => {
1159
- const bag = inst._zod.bag;
1160
- bag.patterns ?? (bag.patterns = new Set);
1161
- bag.patterns.add(pattern);
1162
- });
1163
1177
  inst._zod.check = (payload) => {
1164
1178
  if (payload.value.endsWith(def.suffix))
1165
1179
  return;
@@ -1191,8 +1205,11 @@ class Doc {
1191
1205
  }
1192
1206
  indented(fn) {
1193
1207
  this.indent += 1;
1194
- fn(this);
1195
- this.indent -= 1;
1208
+ try {
1209
+ fn(this);
1210
+ } finally {
1211
+ this.indent -= 1;
1212
+ }
1196
1213
  }
1197
1214
  write(arg) {
1198
1215
  if (typeof arg === "function") {
@@ -1223,8 +1240,8 @@ ${content.join(`
1223
1240
  // node_modules/zod/v4/core/versions.js
1224
1241
  var version = {
1225
1242
  major: 4,
1226
- minor: 5,
1227
- patch: 4
1243
+ minor: 6,
1244
+ patch: 1
1228
1245
  };
1229
1246
 
1230
1247
  // node_modules/zod/v4/core/schemas.js
@@ -1336,15 +1353,21 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
1336
1353
  own(this, "~standard", value);
1337
1354
  }
1338
1355
  });
1339
- var toStandardResult = (r) => r.success ? { value: r.data } : { issues: r.error?.issues };
1356
+ var toStandardResult = (r, ctx) => r.issues.length ? { issues: r.issues.map((iss) => finalizeIssue(iss, ctx, config())) } : { value: r.value };
1357
+ async function validateAsync2(inst, value) {
1358
+ const ctx = { async: true };
1359
+ return toStandardResult(await inst._zod.run({ value, issues: [] }, ctx), ctx);
1360
+ }
1340
1361
  function standardProps(inst) {
1341
1362
  return {
1342
1363
  validate: (value) => {
1364
+ const ctx = { async: false };
1343
1365
  try {
1344
- return toStandardResult(safeParse(inst, value));
1345
- } catch (_) {
1346
- return safeParseAsync(inst, value).then(toStandardResult);
1347
- }
1366
+ const r = inst._zod.run({ value, issues: [] }, ctx);
1367
+ if (!(r instanceof Promise))
1368
+ return toStandardResult(r, ctx);
1369
+ } catch (_) {}
1370
+ return validateAsync2(inst, value);
1348
1371
  },
1349
1372
  vendor: "zod",
1350
1373
  version: 1
@@ -1352,7 +1375,7 @@ function standardProps(inst) {
1352
1375
  }
1353
1376
  var $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
1354
1377
  $ZodType.init(inst, def);
1355
- inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string(inst._zod.bag);
1378
+ inst._zod.pattern = def.pattern ?? anyString;
1356
1379
  inst._zod.parse = (payload, _) => {
1357
1380
  if (def.coerce)
1358
1381
  try {
@@ -1520,12 +1543,6 @@ var $ZodKSUID = /* @__PURE__ */ $constructor("$ZodKSUID", (inst, def) => {
1520
1543
  var $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, def) => {
1521
1544
  def.pattern ?? (def.pattern = datetime(def));
1522
1545
  $ZodStringFormat.init(inst, def);
1523
- if (def.local || def.precision === -1) {
1524
- inst._zod.bag.laxFormat = true;
1525
- inst._zod.onattach.push((s) => {
1526
- s._zod.bag.laxFormat = true;
1527
- });
1528
- }
1529
1546
  });
1530
1547
  var $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => {
1531
1548
  def.pattern ?? (def.pattern = date);
@@ -1542,7 +1559,6 @@ var $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def
1542
1559
  var $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
1543
1560
  def.pattern ?? (def.pattern = ipv4);
1544
1561
  $ZodStringFormat.init(inst, def);
1545
- inst._zod.bag.format = `ipv4`;
1546
1562
  });
1547
1563
  var ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
1548
1564
  function isValidIPv6(value) {
@@ -1558,7 +1574,6 @@ function isValidIPv6(value) {
1558
1574
  var $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
1559
1575
  def.pattern ?? (def.pattern = ipv6);
1560
1576
  $ZodStringFormat.init(inst, def);
1561
- inst._zod.bag.format = `ipv6`;
1562
1577
  inst._zod.check = (payload) => {
1563
1578
  if (!isValidIPv6(payload.value)) {
1564
1579
  payload.issues.push({
@@ -1618,10 +1633,10 @@ function isValidBase64(data) {
1618
1633
  return false;
1619
1634
  }
1620
1635
  }
1636
+ var base64Charset = /^[0-9a-zA-Z+/]*={0,2}$/;
1621
1637
  var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
1622
- def.pattern ?? (def.pattern = base64);
1638
+ def.pattern ?? (def.pattern = base64Charset);
1623
1639
  $ZodStringFormat.init(inst, def);
1624
- inst._zod.bag.contentEncoding = "base64";
1625
1640
  inst._zod.check = (payload) => {
1626
1641
  if (isValidBase64(payload.value))
1627
1642
  return;
@@ -1634,17 +1649,17 @@ var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
1634
1649
  });
1635
1650
  };
1636
1651
  });
1652
+ var base64urlCharset = /^[A-Za-z0-9_-]*$/;
1637
1653
  function isValidBase64URL(data) {
1638
- if (!base64url.test(data))
1654
+ if (!base64urlCharset.test(data))
1639
1655
  return false;
1640
1656
  const base64 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
1641
1657
  const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, "=");
1642
1658
  return isValidBase64(padded);
1643
1659
  }
1644
1660
  var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
1645
- def.pattern ?? (def.pattern = base64url);
1661
+ def.pattern ?? (def.pattern = base64urlCharset);
1646
1662
  $ZodStringFormat.init(inst, def);
1647
- inst._zod.bag.contentEncoding = "base64url";
1648
1663
  inst._zod.check = (payload) => {
1649
1664
  if (isValidBase64URL(payload.value))
1650
1665
  return;
@@ -1734,6 +1749,7 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
1734
1749
  }
1735
1750
  payload.value = memo ? memo.alloc(inst, payload, Array(input.length), ctx) : Array(input.length);
1736
1751
  const proms = [];
1752
+ const abortEarly = ctx?.abortEarly;
1737
1753
  for (let i = 0;i < input.length; i++) {
1738
1754
  const item = input[i];
1739
1755
  const result = def.element._zod.run({
@@ -1744,6 +1760,8 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
1744
1760
  proms.push(result.then((result) => handleArrayResult(result, payload, i)));
1745
1761
  } else {
1746
1762
  handleArrayResult(result, payload, i);
1763
+ if (abortEarly && result.issues.length !== 0 && aborted(result))
1764
+ break;
1747
1765
  }
1748
1766
  }
1749
1767
  if (proms.length) {
@@ -1804,14 +1822,20 @@ function normalizeDef(def) {
1804
1822
  optionalKeys: new Set(okeys)
1805
1823
  };
1806
1824
  }
1807
- function handleCatchall(proms, input, payload, ctx, def, inst) {
1825
+ function handleCatchall(proms, input, payload, ctx, def, inst, abortEarly) {
1808
1826
  const unrecognized = [];
1809
1827
  const keySet = def.keySet;
1810
1828
  const _catchall = def.catchall._zod;
1811
1829
  const t = _catchall.def.type;
1812
1830
  const optin = _catchall.optin;
1813
1831
  const optout = _catchall.optout;
1832
+ let seen = 0;
1814
1833
  for (const key in input) {
1834
+ if (abortEarly && payload.issues.length !== seen) {
1835
+ if (aborted(payload, seen))
1836
+ break;
1837
+ seen = payload.issues.length;
1838
+ }
1815
1839
  if (keySet.has(key))
1816
1840
  continue;
1817
1841
  if (key === "__proto__") {
@@ -1845,23 +1869,19 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
1845
1869
  return payload;
1846
1870
  });
1847
1871
  }
1848
- var propShapes = new WeakMap;
1849
1872
  var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
1850
1873
  $ZodType.init(inst, def);
1851
1874
  const desc = Object.getOwnPropertyDescriptor(def, "shape");
1852
- if (!desc?.get) {
1853
- const sh = def.shape;
1854
- propShapes.set(def, sh);
1855
- Object.defineProperty(def, "shape", {
1856
- get: () => {
1857
- const newSh = { ...sh };
1858
- Object.defineProperty(def, "shape", {
1859
- value: newSh
1860
- });
1861
- propShapes.set(def, newSh);
1862
- return newSh;
1863
- }
1864
- });
1875
+ const sh = desc?.get ? desc.get.raw : def.shape ?? {};
1876
+ if (sh) {
1877
+ const get = () => {
1878
+ const newSh = { ...sh };
1879
+ Object.defineProperty(def, "shape", { value: newSh });
1880
+ get.raw = newSh;
1881
+ return newSh;
1882
+ };
1883
+ get.raw = sh;
1884
+ Object.defineProperty(def, "shape", { get });
1865
1885
  }
1866
1886
  const _normalized = cached(() => normalizeDef(def));
1867
1887
  defineLazyInternal(inst, "propValues", (zod) => {
@@ -1901,7 +1921,14 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
1901
1921
  payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
1902
1922
  const proms = [];
1903
1923
  const shape = value.shape;
1924
+ const abortEarly = ctx?.abortEarly;
1925
+ let seen = payload.issues.length;
1904
1926
  for (const key of value.allKeys) {
1927
+ if (abortEarly && payload.issues.length !== seen) {
1928
+ if (aborted(payload, seen))
1929
+ break;
1930
+ seen = payload.issues.length;
1931
+ }
1905
1932
  if (key === "__proto__")
1906
1933
  continue;
1907
1934
  const el = shape[key];
@@ -1917,7 +1944,7 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
1917
1944
  if (!catchall) {
1918
1945
  return proms.length ? Promise.all(proms).then(() => payload) : payload;
1919
1946
  }
1920
- return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
1947
+ return handleCatchall(proms, input, payload, ctx, _normalized.value, inst, abortEarly === true);
1921
1948
  };
1922
1949
  });
1923
1950
  var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
@@ -1931,10 +1958,16 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
1931
1958
  const doc = new Doc(["payload", "ctx"], { shape, inst, memo, syms });
1932
1959
  const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
1933
1960
  const prefixStr = (id, k) => `
1961
+ let ${id}_ab = false;
1934
1962
  for (let i = 0; i < ${id}.issues.length; i++) {
1935
1963
  const iss = ${id}.issues[i];
1936
1964
  iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
1937
1965
  payload.issues.push(iss);
1966
+ if (iss.continue !== true) ${id}_ab = true;
1967
+ }
1968
+ if (${id}_ab && ctx && ctx.abortEarly) {
1969
+ payload.value = newResult;
1970
+ return payload;
1938
1971
  }`;
1939
1972
  doc.write(`const input = payload.value;`);
1940
1973
  const ids = Object.create(null);
@@ -1980,6 +2013,10 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
1980
2013
  input: undefined,
1981
2014
  path: [${k}]
1982
2015
  });
2016
+ if (ctx && ctx.abortEarly) {
2017
+ payload.value = newResult;
2018
+ return payload;
2019
+ }
1983
2020
  }
1984
2021
 
1985
2022
  if (${id}_present) {
@@ -2032,7 +2069,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
2032
2069
  payload = fastpass(payload, ctx);
2033
2070
  if (!catchall)
2034
2071
  return payload;
2035
- return handleCatchall([], input, payload, ctx, value, inst);
2072
+ return handleCatchall([], input, payload, ctx, value, inst, ctx?.abortEarly === true);
2036
2073
  }
2037
2074
  return superParse(payload, ctx);
2038
2075
  };
@@ -2221,8 +2258,10 @@ var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
2221
2258
  const values = getEnumValues(def.entries);
2222
2259
  const valuesSet = new Set(values);
2223
2260
  inst._zod.values = valuesSet;
2224
- const patternValues = values.filter((k) => propertyKeyTypes.has(typeof k));
2225
- inst._zod.pattern = new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
2261
+ defineLazyInternal(inst, "pattern", (zod) => {
2262
+ const patternValues = getEnumValues(zod.def.entries).filter((k) => propertyKeyTypes.has(typeof k));
2263
+ return new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
2264
+ });
2226
2265
  inst._zod.parse = (payload, _ctx) => {
2227
2266
  const input = payload.value;
2228
2267
  if (valuesSet.has(input)) {
@@ -2241,7 +2280,10 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
2241
2280
  $ZodType.init(inst, def);
2242
2281
  const values = new Set(def.values);
2243
2282
  inst._zod.values = values;
2244
- inst._zod.pattern = new RegExp(def.values.length ? `^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$` : "^[^\\s\\S]$");
2283
+ defineLazyInternal(inst, "pattern", (zod) => {
2284
+ const vals = zod.def.values;
2285
+ return new RegExp(vals.length ? `^(${vals.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$` : "^[^\\s\\S]$");
2286
+ });
2245
2287
  inst._zod.parse = (payload, _ctx) => {
2246
2288
  const input = payload.value;
2247
2289
  if (values.has(input)) {
@@ -2509,6 +2551,61 @@ function handleRefineResult(result, payload, input, inst) {
2509
2551
  payload.issues.push(issue(_iss));
2510
2552
  }
2511
2553
  }
2554
+ function handlePropertiesResult(result, payload, key) {
2555
+ if (result.issues.length) {
2556
+ payload.issues.push(...prefixIssues(key, result.issues));
2557
+ }
2558
+ }
2559
+ var $ZodProperties = /* @__PURE__ */ $constructor("$ZodProperties", (inst, def) => {
2560
+ $ZodType.init(inst, def);
2561
+ $ZodCheck.init(inst, def);
2562
+ const memo = globalConfig.memoizer;
2563
+ memo?.attach(inst);
2564
+ let entries;
2565
+ const runShape = (payload, ctx) => {
2566
+ entries ?? (entries = Reflect.ownKeys(def.shape).map((key) => [key, def.shape[key]]));
2567
+ const input = payload.value;
2568
+ let proms;
2569
+ for (const [key, schema] of entries) {
2570
+ const result = schema._zod.run({ value: input[key], issues: [] }, ctx);
2571
+ if (result instanceof Promise) {
2572
+ proms ?? (proms = []);
2573
+ proms.push(result.then((result) => handlePropertiesResult(result, payload, key)));
2574
+ } else {
2575
+ handlePropertiesResult(result, payload, key);
2576
+ }
2577
+ }
2578
+ if (proms)
2579
+ return Promise.all(proms).then(() => {
2580
+ return;
2581
+ });
2582
+ return;
2583
+ };
2584
+ inst._zod.parse = (payload, ctx) => {
2585
+ const input = payload.value;
2586
+ if (input === null || typeof input !== "object" && typeof input !== "function") {
2587
+ payload.issues.push({ expected: "object", code: "invalid_type", input, inst });
2588
+ return payload;
2589
+ }
2590
+ if (ctx.direction === "backward")
2591
+ ctx = { ...ctx, direction: "forward" };
2592
+ if (memo)
2593
+ memo.alloc(inst, payload, input, ctx);
2594
+ const result = runShape(payload, ctx);
2595
+ return result instanceof Promise ? result.then(() => payload) : payload;
2596
+ };
2597
+ inst._zod.check = (payload) => {
2598
+ if (payload.value == null) {
2599
+ payload.issues.push({ expected: "object", code: "invalid_type", input: payload.value, inst });
2600
+ return;
2601
+ }
2602
+ return runShape(payload, {});
2603
+ };
2604
+ }, {
2605
+ *[Symbol.iterator]() {
2606
+ yield this;
2607
+ }
2608
+ });
2512
2609
  // node_modules/zod/v4/core/memoizer.js
2513
2610
  class $ZodCyclicError extends Error {
2514
2611
  constructor() {
@@ -2518,31 +2615,59 @@ class $ZodCyclicError extends Error {
2518
2615
  }
2519
2616
  var STATE = "~memo";
2520
2617
  var NO_ISSUES = [];
2618
+ function isRef(value) {
2619
+ return value !== null && (typeof value === "object" || typeof value === "function");
2620
+ }
2521
2621
  function cloneIssues(issues) {
2522
2622
  return issues.map((iss) => iss.path ? { ...iss, path: iss.path.slice() } : { ...iss });
2523
2623
  }
2524
2624
  var recursive = /* @__PURE__ */ new WeakMap;
2525
- function isRecursive(inst, stack) {
2625
+ var NONE = 0;
2626
+ var ASSUMED = 1;
2627
+ var PROVEN = 2;
2628
+ function isRecursive(inst, stack, resolve) {
2526
2629
  const cached = recursive.get(inst);
2527
2630
  if (cached !== undefined)
2528
- return cached;
2631
+ return cached ? PROVEN : NONE;
2529
2632
  if (stack.has(inst))
2530
- return true;
2633
+ return PROVEN;
2531
2634
  stack.add(inst);
2532
- let result = false;
2635
+ let result = NONE;
2533
2636
  const check = (child) => {
2534
- if (!result && child?._zod && isRecursive(child, stack))
2535
- result = true;
2637
+ if (result !== PROVEN && child?._zod) {
2638
+ const answer = isRecursive(child, stack, resolve);
2639
+ if (answer > result)
2640
+ result = answer;
2641
+ }
2642
+ };
2643
+ const shape = (sh, spread) => {
2644
+ let answer = NONE;
2645
+ for (const key of Reflect.ownKeys(sh)) {
2646
+ const desc = Object.getOwnPropertyDescriptor(sh, key);
2647
+ if (spread && !desc.enumerable)
2648
+ continue;
2649
+ const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve) : NONE;
2650
+ if (child > answer)
2651
+ answer = child;
2652
+ }
2653
+ return answer;
2654
+ };
2655
+ const merge = (answer) => {
2656
+ if (answer > result)
2657
+ result = answer;
2536
2658
  };
2537
2659
  const def = inst._zod.def;
2538
2660
  const kind = def.type;
2539
2661
  switch (kind) {
2540
2662
  case "object": {
2541
- for (const key of Reflect.ownKeys(def.shape))
2542
- check(def.shape[key]);
2663
+ const raw = rawShape(def);
2664
+ merge(raw ? shape(raw, true) : ASSUMED);
2543
2665
  check(def.catchall);
2544
2666
  break;
2545
2667
  }
2668
+ case "properties":
2669
+ merge(shape(def.shape, false));
2670
+ break;
2546
2671
  case "array":
2547
2672
  check(def.element);
2548
2673
  break;
@@ -2586,9 +2711,11 @@ function isRecursive(inst, stack) {
2586
2711
  check(def.input);
2587
2712
  check(def.output);
2588
2713
  break;
2589
- case "lazy":
2590
- check(inst._zod.innerType);
2714
+ case "lazy": {
2715
+ const inner = def._cachedInner ?? (resolve ? inst._zod.innerType : undefined);
2716
+ merge(inner ? isRecursive(inner, stack, false) : ASSUMED);
2591
2717
  break;
2718
+ }
2592
2719
  case "template_literal":
2593
2720
  case "string":
2594
2721
  case "number":
@@ -2627,13 +2754,17 @@ function isRecursive(inst, stack) {
2627
2754
  }
2628
2755
  }
2629
2756
  stack.delete(inst);
2630
- recursive.set(inst, result);
2631
- return result;
2757
+ return settle(inst, result);
2758
+ }
2759
+ function settle(inst, answer) {
2760
+ if (answer !== ASSUMED)
2761
+ recursive.set(inst, answer === PROVEN);
2762
+ return answer;
2632
2763
  }
2633
2764
  function bucketFor(state, inst) {
2634
2765
  let bucket = state.buckets.get(inst);
2635
2766
  if (!bucket) {
2636
- bucket = new Map;
2767
+ bucket = new WeakMap;
2637
2768
  state.buckets.set(inst, bucket);
2638
2769
  }
2639
2770
  return bucket;
@@ -2669,6 +2800,7 @@ var memo = {
2669
2800
  attach(inst) {
2670
2801
  var _a;
2671
2802
  let isRecursiveInst;
2803
+ let rechecked = false;
2672
2804
  let lastCtx;
2673
2805
  let lastBucket;
2674
2806
  (_a = inst._zod).deferred ?? (_a.deferred = []);
@@ -2676,20 +2808,24 @@ var memo = {
2676
2808
  const base = inst._zod.parse;
2677
2809
  const wrapped = (payload, ctx) => {
2678
2810
  if (isRecursiveInst === undefined) {
2679
- isRecursiveInst = isRecursive(inst, new Set);
2680
- if (!isRecursiveInst) {
2811
+ const walked = isRecursive(inst, new Set, false);
2812
+ if (walked === NONE) {
2681
2813
  inst._zod.parse = base;
2682
2814
  if (inst._zod.run === wrapped)
2683
2815
  inst._zod.run = base;
2684
2816
  return base(payload, ctx);
2685
2817
  }
2818
+ if (walked === PROVEN || rechecked)
2819
+ isRecursiveInst = true;
2820
+ else
2821
+ rechecked = true;
2686
2822
  }
2687
2823
  const input = payload.value;
2688
- if (input === null || typeof input !== "object")
2824
+ if (!isRef(input))
2689
2825
  return base(payload, ctx);
2690
2826
  let state = ctx[STATE];
2691
2827
  if (!state) {
2692
- state = { buckets: new Map, backEdges: undefined };
2828
+ state = { buckets: new WeakMap, backEdges: undefined };
2693
2829
  ctx[STATE] = state;
2694
2830
  }
2695
2831
  let bucket;
@@ -2708,7 +2844,7 @@ var memo = {
2708
2844
  payload.issues.push(...cloneIssues(hit.issues));
2709
2845
  } else {
2710
2846
  payload.memo = true;
2711
- state.backEdges ?? (state.backEdges = new Set);
2847
+ state.backEdges ?? (state.backEdges = new WeakSet);
2712
2848
  state.backEdges.add(hit.value);
2713
2849
  }
2714
2850
  return payload;
@@ -2740,7 +2876,7 @@ function memoizer() {
2740
2876
  }
2741
2877
  function isBackEdge(ctx, value) {
2742
2878
  const backEdges = ctx[STATE]?.backEdges;
2743
- return backEdges !== undefined && value !== null && typeof value === "object" && backEdges.has(value);
2879
+ return backEdges !== undefined && isRef(value) && backEdges.has(value);
2744
2880
  }
2745
2881
  // node_modules/zod/v4/locales/en.js
2746
2882
  var error = () => {
@@ -2783,6 +2919,7 @@ var error = () => {
2783
2919
  json_string: "JSON string",
2784
2920
  e164: "E.164 number",
2785
2921
  credit_card: "credit card number",
2922
+ iban: "IBAN",
2786
2923
  jwt: "JWT",
2787
2924
  template_literal: "input"
2788
2925
  };
@@ -3342,7 +3479,7 @@ function handleUnrepresentable(schema, ctx, json, params, message) {
3342
3479
  Object.assign(json, result);
3343
3480
  return true;
3344
3481
  }
3345
- function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
3482
+ function processSchema(schema, ctx, _params = { path: [], schemaPath: [] }) {
3346
3483
  var _a;
3347
3484
  const def = schema._zod.def;
3348
3485
  const seen = ctx.seen.get(schema);
@@ -3381,7 +3518,7 @@ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
3381
3518
  if (parent) {
3382
3519
  if (!result.ref)
3383
3520
  result.ref = parent;
3384
- process2(parent, ctx, params);
3521
+ processSchema(parent, ctx, params);
3385
3522
  ctx.seen.get(parent).isParent = true;
3386
3523
  }
3387
3524
  }
@@ -3486,7 +3623,6 @@ function extractDefs(ctx, schema) {
3486
3623
  if (seen.count > 1) {
3487
3624
  if (ctx.reused === "ref") {
3488
3625
  extractToDef(entry);
3489
- continue;
3490
3626
  }
3491
3627
  }
3492
3628
  }
@@ -3811,18 +3947,106 @@ function isTransforming(_schema, _ctx) {
3811
3947
  }
3812
3948
  var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
3813
3949
  const ctx = initializeContext({ ...params, processors });
3814
- process2(schema, ctx);
3950
+ processSchema(schema, ctx);
3815
3951
  extractDefs(ctx, schema);
3816
3952
  return finalize(ctx, schema);
3817
3953
  };
3818
3954
  var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
3819
3955
  const { libraryOptions, target } = params ?? {};
3820
3956
  const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
3821
- process2(schema, ctx);
3957
+ processSchema(schema, ctx);
3822
3958
  extractDefs(ctx, schema);
3823
3959
  return finalize(ctx, schema);
3824
3960
  };
3825
3961
  // node_modules/zod/v4/core/json-schema-processors.js
3962
+ var narrowMin = (agg, key, value) => {
3963
+ if (agg[key] === undefined || value > agg[key])
3964
+ agg[key] = value;
3965
+ };
3966
+ var narrowMax = (agg, key, value) => {
3967
+ if (agg[key] === undefined || value < agg[key])
3968
+ agg[key] = value;
3969
+ };
3970
+ var narrowBoth = (agg, value) => {
3971
+ narrowMin(agg, "minimum", value);
3972
+ narrowMax(agg, "maximum", value);
3973
+ };
3974
+ var addDivisor = (agg, value) => {
3975
+ agg.multipleOf ?? (agg.multipleOf = []);
3976
+ if (!agg.multipleOf.includes(value))
3977
+ agg.multipleOf.push(value);
3978
+ };
3979
+ var addPattern = (agg, pattern) => {
3980
+ agg.patterns ?? (agg.patterns = new Set);
3981
+ agg.patterns.add(pattern);
3982
+ };
3983
+ var intersectMime = (agg, mime) => {
3984
+ agg.mime = agg.mime ? agg.mime.filter((m) => mime.includes(m)) : [...mime];
3985
+ };
3986
+ var setFormat = (agg, format) => {
3987
+ agg.format = format;
3988
+ if (format.includes("int"))
3989
+ agg.isInt = true;
3990
+ };
3991
+ var minContributor = (agg, def) => narrowMin(agg, "minimum", def.minimum);
3992
+ var maxContributor = (agg, def) => narrowMax(agg, "maximum", def.maximum);
3993
+ var formatContributor = (ranges) => (agg, def) => {
3994
+ setFormat(agg, def.format);
3995
+ const [minimum, maximum] = ranges[def.format];
3996
+ narrowMin(agg, "minimum", minimum);
3997
+ narrowMax(agg, "maximum", maximum);
3998
+ };
3999
+ var contributors = {
4000
+ greater_than: (agg, def) => narrowMin(agg, def.inclusive ? "minimum" : "exclusiveMinimum", def.value),
4001
+ less_than: (agg, def) => narrowMax(agg, def.inclusive ? "maximum" : "exclusiveMaximum", def.value),
4002
+ multiple_of: (agg, def) => addDivisor(agg, def.value),
4003
+ number_format: formatContributor(NUMBER_FORMAT_RANGES),
4004
+ bigint_format: formatContributor(BIGINT_FORMAT_RANGES),
4005
+ min_length: minContributor,
4006
+ max_length: maxContributor,
4007
+ length_equals: (agg, def) => narrowBoth(agg, def.length),
4008
+ min_size: minContributor,
4009
+ max_size: maxContributor,
4010
+ size_equals: (agg, def) => narrowBoth(agg, def.size),
4011
+ string_format: (agg, def) => {
4012
+ setFormat(agg, def.format);
4013
+ if (def.pattern)
4014
+ addPattern(agg, def.pattern);
4015
+ if (def.format === "base64" || def.format === "base64url")
4016
+ agg.contentEncoding = def.format;
4017
+ if (def.local || def.precision === -1)
4018
+ agg.laxFormat = true;
4019
+ },
4020
+ mime_type: (agg, def) => intersectMime(agg, def.mime)
4021
+ };
4022
+ function aggregateChecks(schema) {
4023
+ const agg = {};
4024
+ const def = schema._zod.def;
4025
+ const list = schema._zod.traits.has("$ZodCheck") ? [schema, ...def.checks ?? []] : def.checks ?? [];
4026
+ for (const ch of list)
4027
+ contributors[ch._zod.def.check]?.(agg, ch._zod.def);
4028
+ const bag = schema._zod.bag;
4029
+ if (bag.minimum !== undefined)
4030
+ narrowMin(agg, "minimum", bag.minimum);
4031
+ if (bag.exclusiveMinimum !== undefined)
4032
+ narrowMin(agg, "exclusiveMinimum", bag.exclusiveMinimum);
4033
+ if (bag.maximum !== undefined)
4034
+ narrowMax(agg, "maximum", bag.maximum);
4035
+ if (bag.exclusiveMaximum !== undefined)
4036
+ narrowMax(agg, "exclusiveMaximum", bag.exclusiveMaximum);
4037
+ if (bag.multipleOf !== undefined)
4038
+ addDivisor(agg, bag.multipleOf);
4039
+ if (bag.format !== undefined) {
4040
+ agg.format ?? (agg.format = bag.format);
4041
+ if (bag.format.includes("int"))
4042
+ agg.isInt = true;
4043
+ }
4044
+ if (bag.mime)
4045
+ intersectMime(agg, bag.mime);
4046
+ for (const pattern of bag.patterns ?? [])
4047
+ addPattern(agg, pattern);
4048
+ return agg;
4049
+ }
3826
4050
  var formatMap = {
3827
4051
  guid: "uuid",
3828
4052
  url: "uri",
@@ -3830,10 +4054,15 @@ var formatMap = {
3830
4054
  json_string: "json-string",
3831
4055
  regex: ""
3832
4056
  };
4057
+ var exactPatterns = new Map([
4058
+ [base64Charset, base64],
4059
+ [base64urlCharset, base64url]
4060
+ ]);
4061
+ var exactPattern = (p) => exactPatterns.get(p) ?? p;
3833
4062
  var stringProcessor = (schema, ctx, _json, _params) => {
3834
4063
  const json = _json;
3835
4064
  json.type = "string";
3836
- const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = schema._zod.bag;
4065
+ const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = aggregateChecks(schema);
3837
4066
  if (typeof minimum === "number")
3838
4067
  json.minLength = minimum;
3839
4068
  if (typeof maximum === "number")
@@ -3849,7 +4078,7 @@ var stringProcessor = (schema, ctx, _json, _params) => {
3849
4078
  if (contentEncoding)
3850
4079
  json.contentEncoding = contentEncoding;
3851
4080
  if (patterns && patterns.size > 0) {
3852
- const patternList = [...patterns];
4081
+ const patternList = [...patterns].map(exactPattern);
3853
4082
  if (patternList.length === 1)
3854
4083
  json.pattern = patternList[0].source;
3855
4084
  else if (patternList.length > 1) {
@@ -3927,13 +4156,13 @@ var transformProcessor = (schema, ctx, json, params) => {
3927
4156
  var arrayProcessor = (schema, ctx, _json, params) => {
3928
4157
  const json = _json;
3929
4158
  const def = schema._zod.def;
3930
- const { minimum, maximum } = schema._zod.bag;
4159
+ const { minimum, maximum } = aggregateChecks(schema);
3931
4160
  if (typeof minimum === "number")
3932
4161
  json.minItems = minimum;
3933
4162
  if (typeof maximum === "number")
3934
4163
  json.maxItems = maximum;
3935
4164
  json.type = "array";
3936
- json.items = process2(def.element, ctx, {
4165
+ json.items = processSchema(def.element, ctx, {
3937
4166
  ...params,
3938
4167
  path: [...params.path, "items"]
3939
4168
  });
@@ -3959,7 +4188,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
3959
4188
  json.type = "object";
3960
4189
  json.properties = {};
3961
4190
  for (const key in shape) {
3962
- assignProp(json.properties, key, process2(shape[key], ctx, {
4191
+ assignProp(json.properties, key, processSchema(shape[key], ctx, {
3963
4192
  ...params,
3964
4193
  path: [...params.path, "properties", key]
3965
4194
  }));
@@ -3982,7 +4211,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
3982
4211
  if (ctx.io === "output")
3983
4212
  json.additionalProperties = false;
3984
4213
  } else if (def.catchall) {
3985
- json.additionalProperties = process2(def.catchall, ctx, {
4214
+ json.additionalProperties = processSchema(def.catchall, ctx, {
3986
4215
  ...params,
3987
4216
  path: [...params.path, "additionalProperties"]
3988
4217
  });
@@ -3991,7 +4220,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
3991
4220
  var unionProcessor = (schema, ctx, json, params) => {
3992
4221
  const def = schema._zod.def;
3993
4222
  const isExclusive = def.inclusive === false;
3994
- const options = def.options.map((x, i) => process2(x, ctx, {
4223
+ const options = def.options.map((x, i) => processSchema(x, ctx, {
3995
4224
  ...params,
3996
4225
  path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
3997
4226
  }));
@@ -4003,11 +4232,11 @@ var unionProcessor = (schema, ctx, json, params) => {
4003
4232
  };
4004
4233
  var intersectionProcessor = (schema, ctx, json, params) => {
4005
4234
  const def = schema._zod.def;
4006
- const a = process2(def.left, ctx, {
4235
+ const a = processSchema(def.left, ctx, {
4007
4236
  ...params,
4008
4237
  path: [...params.path, "allOf", 0]
4009
4238
  });
4010
- const b = process2(def.right, ctx, {
4239
+ const b = processSchema(def.right, ctx, {
4011
4240
  ...params,
4012
4241
  path: [...params.path, "allOf", 1]
4013
4242
  });
@@ -4022,7 +4251,7 @@ var intersectionProcessor = (schema, ctx, json, params) => {
4022
4251
  var pendingRecords = new WeakMap;
4023
4252
  var nullableProcessor = (schema, ctx, json, params) => {
4024
4253
  const def = schema._zod.def;
4025
- const inner = process2(def.innerType, ctx, params);
4254
+ const inner = processSchema(def.innerType, ctx, params);
4026
4255
  const seen = ctx.seen.get(schema);
4027
4256
  if (ctx.target === "openapi-3.0") {
4028
4257
  seen.ref = def.innerType;
@@ -4033,7 +4262,7 @@ var nullableProcessor = (schema, ctx, json, params) => {
4033
4262
  };
4034
4263
  var nonoptionalProcessor = (schema, ctx, _json, params) => {
4035
4264
  const def = schema._zod.def;
4036
- process2(def.innerType, ctx, params);
4265
+ processSchema(def.innerType, ctx, params);
4037
4266
  const seen = ctx.seen.get(schema);
4038
4267
  seen.ref = def.innerType;
4039
4268
  };
@@ -4053,7 +4282,7 @@ function serializeDefaultValue(value, schema, ctx, json, params) {
4053
4282
  }
4054
4283
  var defaultProcessor = (schema, ctx, json, params) => {
4055
4284
  const def = schema._zod.def;
4056
- process2(def.innerType, ctx, params);
4285
+ processSchema(def.innerType, ctx, params);
4057
4286
  const seen = ctx.seen.get(schema);
4058
4287
  seen.ref = def.innerType;
4059
4288
  const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
@@ -4062,7 +4291,7 @@ var defaultProcessor = (schema, ctx, json, params) => {
4062
4291
  };
4063
4292
  var prefaultProcessor = (schema, ctx, json, params) => {
4064
4293
  const def = schema._zod.def;
4065
- process2(def.innerType, ctx, params);
4294
+ processSchema(def.innerType, ctx, params);
4066
4295
  const seen = ctx.seen.get(schema);
4067
4296
  seen.ref = def.innerType;
4068
4297
  if (ctx.io !== "input")
@@ -4073,7 +4302,7 @@ var prefaultProcessor = (schema, ctx, json, params) => {
4073
4302
  };
4074
4303
  var catchProcessor = (schema, ctx, json, params) => {
4075
4304
  const def = schema._zod.def;
4076
- process2(def.innerType, ctx, params);
4305
+ processSchema(def.innerType, ctx, params);
4077
4306
  const seen = ctx.seen.get(schema);
4078
4307
  seen.ref = def.innerType;
4079
4308
  let catchValue;
@@ -4089,20 +4318,20 @@ var pipeProcessor = (schema, ctx, _json, params) => {
4089
4318
  const def = schema._zod.def;
4090
4319
  const inIsTransform = def.in._zod.traits.has("$ZodTransform");
4091
4320
  const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
4092
- process2(innerType, ctx, params);
4321
+ processSchema(innerType, ctx, params);
4093
4322
  const seen = ctx.seen.get(schema);
4094
4323
  seen.ref = innerType;
4095
4324
  };
4096
4325
  var readonlyProcessor = (schema, ctx, json, params) => {
4097
4326
  const def = schema._zod.def;
4098
- process2(def.innerType, ctx, params);
4327
+ processSchema(def.innerType, ctx, params);
4099
4328
  const seen = ctx.seen.get(schema);
4100
4329
  seen.ref = def.innerType;
4101
4330
  json.readOnly = true;
4102
4331
  };
4103
4332
  var optionalProcessor = (schema, ctx, _json, params) => {
4104
4333
  const def = schema._zod.def;
4105
- process2(def.innerType, ctx, params);
4334
+ processSchema(def.innerType, ctx, params);
4106
4335
  const seen = ctx.seen.get(schema);
4107
4336
  seen.ref = def.innerType;
4108
4337
  };
@@ -4152,10 +4381,10 @@ var ZodRealError = /* @__PURE__ */ $constructor("ZodError", initializer2, undefi
4152
4381
  });
4153
4382
 
4154
4383
  // node_modules/zod/v4/classic/parse.js
4155
- var parse3 = /* @__PURE__ */ _parse(ZodRealError);
4156
- var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
4157
- var safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError);
4158
- var safeParseAsync2 = /* @__PURE__ */ _safeParseAsync(ZodRealError);
4384
+ var parse2 = /* @__PURE__ */ _parse(ZodRealError);
4385
+ var parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
4386
+ var safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
4387
+ var safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError);
4159
4388
  var encode = /* @__PURE__ */ _encode(ZodRealError);
4160
4389
  var decode = /* @__PURE__ */ _decode(ZodRealError);
4161
4390
  var encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
@@ -4288,16 +4517,16 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
4288
4517
  own(this, "~standard", value);
4289
4518
  },
4290
4519
  parse: function _parse(data, params) {
4291
- return parse3(this, data, params, { callee: _parse });
4520
+ return parse2(this, data, params, { callee: _parse });
4292
4521
  },
4293
4522
  parseAsync: async function _parseAsync(data, params) {
4294
- return await parseAsync2(this, data, params, { callee: _parseAsync });
4523
+ return await parseAsync(this, data, params, { callee: _parseAsync });
4295
4524
  },
4296
4525
  safeParse(data, params) {
4297
- return safeParse2(this, data, params);
4526
+ return safeParse(this, data, params);
4298
4527
  },
4299
4528
  async safeParseAsync(data, params) {
4300
- return safeParseAsync2(this, data, params);
4529
+ return safeParseAsync(this, data, params);
4301
4530
  },
4302
4531
  get spa() {
4303
4532
  return this?.safeParseAsync;
@@ -4305,6 +4534,12 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
4305
4534
  set spa(value) {
4306
4535
  own(this, "spa", value);
4307
4536
  },
4537
+ validate(data, params) {
4538
+ return validate(this, data, params);
4539
+ },
4540
+ validateAsync(data, params) {
4541
+ return validateAsync(this, data, params);
4542
+ },
4308
4543
  encode: function _encode(data, params) {
4309
4544
  return encode(this, data, params, { callee: _encode });
4310
4545
  },
@@ -4343,10 +4578,10 @@ var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
4343
4578
  $ZodString.init(inst, def);
4344
4579
  ZodType.init(inst, def);
4345
4580
  inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
4346
- const bag = inst._zod.bag;
4347
- inst.format = bag.format ?? null;
4348
- inst.minLength = bag.minimum ?? null;
4349
- inst.maxLength = bag.maximum ?? null;
4581
+ }, /* @__PURE__ */ derived({
4582
+ format: (inst) => aggregateChecks(inst).format ?? null,
4583
+ minLength: (inst) => aggregateChecks(inst).minimum ?? null,
4584
+ maxLength: (inst) => aggregateChecks(inst).maximum ?? null
4350
4585
  }, {
4351
4586
  regex(...args) {
4352
4587
  return this.check(_regex(...args));
@@ -4393,7 +4628,7 @@ var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
4393
4628
  slugify() {
4394
4629
  return this.check(_slugify());
4395
4630
  }
4396
- });
4631
+ }));
4397
4632
  var ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
4398
4633
  $ZodString.init(inst, def);
4399
4634
  _ZodString.init(inst, def);
@@ -4629,19 +4864,19 @@ var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
4629
4864
  return _enum(Object.keys(this._zod.def.shape));
4630
4865
  },
4631
4866
  catchall(catchall) {
4632
- return this.clone({ ...this._zod.def, catchall });
4867
+ return this.clone(mergeDefs(this._zod.def, { catchall }));
4633
4868
  },
4634
4869
  passthrough() {
4635
- return this.clone({ ...this._zod.def, catchall: unknown() });
4870
+ return this.clone(mergeDefs(this._zod.def, { catchall: unknown() }));
4636
4871
  },
4637
4872
  loose() {
4638
- return this.clone({ ...this._zod.def, catchall: unknown() });
4873
+ return this.clone(mergeDefs(this._zod.def, { catchall: unknown() }));
4639
4874
  },
4640
4875
  strict() {
4641
- return this.clone({ ...this._zod.def, catchall: never() });
4876
+ return this.clone(mergeDefs(this._zod.def, { catchall: never() }));
4642
4877
  },
4643
4878
  strip() {
4644
- return this.clone({ ...this._zod.def, catchall: undefined });
4879
+ return this.clone(mergeDefs(this._zod.def, { catchall: undefined }));
4645
4880
  },
4646
4881
  extend(incoming) {
4647
4882
  return extend(this, incoming);
@@ -4706,7 +4941,7 @@ var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
4706
4941
  ZodType.init(inst, def);
4707
4942
  inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
4708
4943
  inst.enum = def.entries;
4709
- inst.options = Object.values(def.entries);
4944
+ inst.options = [...inst._zod.values];
4710
4945
  const keys = new Set(Object.keys(def.entries));
4711
4946
  inst.extract = (values, params) => {
4712
4947
  const newEntries = {};