sibyl-system 1.3.6 → 1.5.1

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 (4) hide show
  1. package/README.md +26 -6
  2. package/dist/cli.js +1689 -786
  3. package/dist/index.js +3967 -15331
  4. package/package.json +13 -3
package/dist/cli.js CHANGED
@@ -9,7 +9,16 @@ var __export = (target, all) => {
9
9
  import { randomBytes } from "node:crypto";
10
10
  import { spawn as spawn2 } from "node:child_process";
11
11
  import { existsSync as existsSync3 } from "node:fs";
12
- import { copyFile as copyFile2, mkdir as mkdir6, readFile as readFile6 } from "node:fs/promises";
12
+ import { access, copyFile as copyFile2, mkdir as mkdir6, readFile as readFile6, writeFile as writeFile7 } from "node:fs/promises";
13
+
14
+ // src/fsperm.ts
15
+ import { chmod, mkdir } from "node:fs/promises";
16
+ async function mkdirPrivate(dir) {
17
+ await mkdir(dir, { recursive: true, mode: 448 });
18
+ await chmod(dir, 448);
19
+ }
20
+
21
+ // src/cli.ts
13
22
  import { basename, dirname as dirname4, isAbsolute as isAbsolute2, join as join7, resolve as resolve2 } from "node:path";
14
23
 
15
24
  // src/state/record.ts
@@ -73,7 +82,7 @@ var COUNCIL_SIZE = COUNCILORS.length;
73
82
  var KNOWN_IDS = new Set(COUNCILORS);
74
83
 
75
84
  // src/chamber/protocol.ts
76
- import { mkdir as mkdir2, readFile as readFile2, writeFile as writeFile2 } from "node:fs/promises";
85
+ import { mkdir as mkdir3, readFile as readFile2, writeFile as writeFile2 } from "node:fs/promises";
77
86
  import { join as join2 } from "node:path";
78
87
 
79
88
  // src/lane/seating.ts
@@ -185,7 +194,7 @@ var FAIL_CLOSED_REJECT = rejectVerdict("no-parse-performed");
185
194
 
186
195
  // src/state/chamber.ts
187
196
  import { createHash as createHash2 } from "node:crypto";
188
- import { mkdir, readFile, readdir, rename, unlink, writeFile } from "node:fs/promises";
197
+ import { mkdir as mkdir2, readFile, readdir, rename, unlink, writeFile } from "node:fs/promises";
189
198
  import { homedir } from "node:os";
190
199
  import { dirname, isAbsolute, join, resolve } from "node:path";
191
200
  var DEFAULT_CHAMBER_LEDGER = join(homedir(), ".sibyl", "chamber-ledger.jsonl");
@@ -293,7 +302,7 @@ async function appendLedgerRow(ledgerPath, record2) {
293
302
  const stamped = { ...record2, serial };
294
303
  const line = JSON.stringify(stamped);
295
304
  if (line.includes("\n")) return { ok: false, reason: "row serializes with a newline \u2014 refused (ledger is one-JSON-per-line)" };
296
- await mkdir(dirname(ledgerPath), { recursive: true });
305
+ await mkdir2(dirname(ledgerPath), { recursive: true });
297
306
  await writeFile(ledgerPath, `${line}
298
307
  `, { flag: "a" });
299
308
  return { ok: true, serial, line };
@@ -334,7 +343,7 @@ var RECORD_FILE = "run-record.json";
334
343
  var CHECKSUMS_FILE = "CHECKSUMS.txt";
335
344
  var LEDGER_LINE_FILE = "ledger-line.txt";
336
345
  async function atomicWrite(path, content) {
337
- await mkdir(dirname(path), { recursive: true });
346
+ await mkdir2(dirname(path), { recursive: true });
338
347
  const tmp = `${path}.${String(process.pid)}.tmp`;
339
348
  try {
340
349
  await writeFile(tmp, content, "utf8");
@@ -636,9 +645,9 @@ var Protocol = class {
636
645
  }
637
646
  };
638
647
  async function runChamber(cfg, onRecord) {
639
- await mkdir2(join2(cfg.runDir, "pids"), { recursive: true });
640
- await mkdir2(join2(cfg.runDir, "evidence"), { recursive: true });
641
- for (const role of CHAMBER_ROLES) await mkdir2(join2(cfg.runDir, role), { recursive: true });
648
+ await mkdir3(join2(cfg.runDir, "pids"), { recursive: true });
649
+ await mkdir3(join2(cfg.runDir, "evidence"), { recursive: true });
650
+ for (const role of CHAMBER_ROLES) await mkdir3(join2(cfg.runDir, role), { recursive: true });
642
651
  const roster = CHAMBER_ROLES.map((role) => {
643
652
  const d = resolveSeat(role, cfg.slots[role], cfg.pool, cfg.policy);
644
653
  return d.ok ? { role, slot: d.slot, modelId: d.modelId, policyCheck: "allow" } : { role, slot: cfg.slots[role], modelId: "", policyCheck: "deny", denyReason: d.deny };
@@ -852,7 +861,7 @@ function renderVoice(voice) {
852
861
  // src/lane/isolated.ts
853
862
  import { spawn } from "node:child_process";
854
863
  import { createWriteStream, existsSync } from "node:fs";
855
- import { copyFile, mkdir as mkdir3, readFile as readFile3, writeFile as writeFile3 } from "node:fs/promises";
864
+ import { copyFile, readFile as readFile3, writeFile as writeFile3 } from "node:fs/promises";
856
865
  import { dirname as dirname2, join as join3 } from "node:path";
857
866
  var DEFAULT_PINNED_PATH = "/usr/bin:/bin";
858
867
  function composeSandboxArgs(opts) {
@@ -882,12 +891,12 @@ function rolePaths(cfg, role) {
882
891
  }
883
892
  async function prepareRoleHome(cfg, role) {
884
893
  const paths = rolePaths(cfg, role);
885
- await mkdir3(join3(paths.home, ".config", "opencode"), { recursive: true });
886
- await mkdir3(dirname2(paths.dbPath), { recursive: true });
887
- await mkdir3(join3(paths.home, ".cache", "opencode"), { recursive: true });
888
- await mkdir3(join3(paths.home, ".local", "state", "opencode"), { recursive: true });
889
- await mkdir3(paths.workspace, { recursive: true });
890
- await mkdir3(join3(cfg.runDir, "pids"), { recursive: true });
894
+ await mkdirPrivate(join3(paths.home, ".config", "opencode"));
895
+ await mkdirPrivate(dirname2(paths.dbPath));
896
+ await mkdirPrivate(join3(paths.home, ".cache", "opencode"));
897
+ await mkdirPrivate(join3(paths.home, ".local", "state", "opencode"));
898
+ await mkdirPrivate(paths.workspace);
899
+ await mkdirPrivate(join3(cfg.runDir, "pids"));
891
900
  try {
892
901
  if (cfg.configSource.length > 0) {
893
902
  await copyFile(cfg.configSource, join3(paths.home, ".config", "opencode", "opencode.jsonc"));
@@ -1342,6 +1351,7 @@ __export(external_exports, {
1342
1351
  $brand: () => $brand,
1343
1352
  $input: () => $input,
1344
1353
  $output: () => $output,
1354
+ INVALID: () => INVALID,
1345
1355
  NEVER: () => NEVER,
1346
1356
  TimePrecision: () => TimePrecision,
1347
1357
  ZodAny: () => ZodAny,
@@ -1375,12 +1385,14 @@ __export(external_exports, {
1375
1385
  ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
1376
1386
  ZodFunction: () => ZodFunction,
1377
1387
  ZodGUID: () => ZodGUID,
1388
+ ZodIBAN: () => ZodIBAN,
1378
1389
  ZodIPv4: () => ZodIPv4,
1379
1390
  ZodIPv6: () => ZodIPv6,
1380
1391
  ZodISODate: () => ZodISODate,
1381
1392
  ZodISODateTime: () => ZodISODateTime,
1382
1393
  ZodISODuration: () => ZodISODuration,
1383
1394
  ZodISOTime: () => ZodISOTime,
1395
+ ZodInstanceOf: () => ZodInstanceOf,
1384
1396
  ZodIntersection: () => ZodIntersection,
1385
1397
  ZodIssueCode: () => ZodIssueCode,
1386
1398
  ZodJWT: () => ZodJWT,
@@ -1446,6 +1458,7 @@ __export(external_exports, {
1446
1458
  creditCard: () => creditCard2,
1447
1459
  cuid: () => cuid3,
1448
1460
  cuid2: () => cuid22,
1461
+ currencyCode: () => currencyCode2,
1449
1462
  custom: () => custom,
1450
1463
  date: () => date2,
1451
1464
  decode: () => decode2,
@@ -1478,6 +1491,7 @@ __export(external_exports, {
1478
1491
  hex: () => hex2,
1479
1492
  hostname: () => hostname2,
1480
1493
  httpUrl: () => httpUrl,
1494
+ iban: () => iban2,
1481
1495
  includes: () => _includes,
1482
1496
  input: () => input,
1483
1497
  instanceof: () => _instanceof,
@@ -1589,6 +1603,7 @@ __export(external_exports, {
1589
1603
  validate: () => validate,
1590
1604
  validateAsync: () => validateAsync,
1591
1605
  void: () => _void2,
1606
+ withParser: () => withParser,
1592
1607
  xid: () => xid2,
1593
1608
  xor: () => xor
1594
1609
  });
@@ -1625,6 +1640,7 @@ __export(core_exports2, {
1625
1640
  $ZodCheckMultipleOf: () => $ZodCheckMultipleOf,
1626
1641
  $ZodCheckNumberFormat: () => $ZodCheckNumberFormat,
1627
1642
  $ZodCheckOverwrite: () => $ZodCheckOverwrite,
1643
+ $ZodCheckProperties: () => $ZodCheckProperties,
1628
1644
  $ZodCheckProperty: () => $ZodCheckProperty,
1629
1645
  $ZodCheckRegex: () => $ZodCheckRegex,
1630
1646
  $ZodCheckSizeEquals: () => $ZodCheckSizeEquals,
@@ -1649,6 +1665,7 @@ __export(core_exports2, {
1649
1665
  $ZodFile: () => $ZodFile,
1650
1666
  $ZodFunction: () => $ZodFunction,
1651
1667
  $ZodGUID: () => $ZodGUID,
1668
+ $ZodIBAN: () => $ZodIBAN,
1652
1669
  $ZodIPv4: () => $ZodIPv4,
1653
1670
  $ZodIPv6: () => $ZodIPv6,
1654
1671
  $ZodISODate: () => $ZodISODate,
@@ -1750,6 +1767,7 @@ __export(core_exports2, {
1750
1767
  _gt: () => _gt,
1751
1768
  _gte: () => _gte,
1752
1769
  _guid: () => _guid,
1770
+ _iban: () => _iban,
1753
1771
  _includes: () => _includes,
1754
1772
  _int: () => _int,
1755
1773
  _int32: () => _int32,
@@ -1841,6 +1859,9 @@ __export(core_exports2, {
1841
1859
  _void: () => _void,
1842
1860
  _xid: () => _xid,
1843
1861
  _xor: () => _xor,
1862
+ base64Charset: () => base64Charset,
1863
+ base64urlCharset: () => base64urlCharset,
1864
+ canParseURL: () => canParseURL,
1844
1865
  clone: () => clone,
1845
1866
  compile: () => compile,
1846
1867
  compileFn: () => compileFn,
@@ -1867,6 +1888,7 @@ __export(core_exports2, {
1867
1888
  isValidBase64URL: () => isValidBase64URL,
1868
1889
  isValidCIDRv6: () => isValidCIDRv6,
1869
1890
  isValidCreditCard: () => isValidCreditCard,
1891
+ isValidIBAN: () => isValidIBAN,
1870
1892
  isValidIPv6: () => isValidIPv6,
1871
1893
  isValidJWT: () => isValidJWT,
1872
1894
  locales: () => locales_exports,
@@ -1877,7 +1899,8 @@ __export(core_exports2, {
1877
1899
  parseAsync: () => parseAsync,
1878
1900
  parseURLObject: () => parseURLObject,
1879
1901
  prettifyError: () => prettifyError,
1880
- process: () => process2,
1902
+ process: () => processSchema,
1903
+ processSchema: () => processSchema,
1881
1904
  regexes: () => regexes_exports,
1882
1905
  registry: () => registry,
1883
1906
  safeDecode: () => safeDecode,
@@ -1897,7 +1920,9 @@ __export(core_exports2, {
1897
1920
  util: () => util_exports,
1898
1921
  validate: () => validate,
1899
1922
  validateAsync: () => validateAsync,
1900
- version: () => version
1923
+ validateURL: () => validateURL,
1924
+ version: () => version,
1925
+ withParser: () => withParser
1901
1926
  });
1902
1927
 
1903
1928
  // node_modules/zod/v4/core/util.js
@@ -1929,6 +1954,7 @@ __export(util_exports, {
1929
1954
  createTransparentProxy: () => createTransparentProxy,
1930
1955
  defineLazy: () => defineLazy,
1931
1956
  defineLazyInternal: () => defineLazyInternal,
1957
+ derived: () => derived,
1932
1958
  esc: () => esc,
1933
1959
  escapeRegex: () => escapeRegex,
1934
1960
  explicitlyAborted: () => explicitlyAborted,
@@ -1966,9 +1992,11 @@ __export(util_exports, {
1966
1992
  promiseAllObject: () => promiseAllObject,
1967
1993
  propertyKeyTypes: () => propertyKeyTypes,
1968
1994
  randomString: () => randomString,
1995
+ rawShape: () => rawShape,
1969
1996
  required: () => required,
1970
1997
  safeExtend: () => safeExtend,
1971
1998
  shallowClone: () => shallowClone,
1999
+ sizeCaps: () => sizeCaps,
1972
2000
  slugify: () => slugify,
1973
2001
  stringifyPrimitive: () => stringifyPrimitive,
1974
2002
  toZod: () => toZod,
@@ -2006,18 +2034,22 @@ function jsonStringifyReplacer(_, value) {
2006
2034
  return value.toString();
2007
2035
  return value;
2008
2036
  }
2009
- function cached2(getter) {
2010
- const set2 = false;
2011
- return {
2012
- get value() {
2013
- if (!set2) {
2014
- const value = getter();
2015
- Object.defineProperty(this, "value", { value });
2016
- return value;
2017
- }
2018
- throw new Error("cached value already set");
2037
+ var Cached = class {
2038
+ constructor(getter) {
2039
+ this._getter = getter;
2040
+ this._value = void 0;
2041
+ }
2042
+ get value() {
2043
+ const getter = this._getter;
2044
+ if (getter !== void 0) {
2045
+ this._value = getter();
2046
+ this._getter = void 0;
2019
2047
  }
2020
- };
2048
+ return this._value;
2049
+ }
2050
+ };
2051
+ function cached2(getter) {
2052
+ return new Cached(getter);
2021
2053
  }
2022
2054
  function nullish(input2) {
2023
2055
  return input2 === null || input2 === void 0;
@@ -2069,6 +2101,56 @@ function assignProp(target, prop, value) {
2069
2101
  configurable: true
2070
2102
  });
2071
2103
  }
2104
+ function rawShape(def) {
2105
+ const desc = Object.getOwnPropertyDescriptor(def, "shape");
2106
+ return desc?.get ? desc.get.raw : desc?.value;
2107
+ }
2108
+ function sourceShape(schema) {
2109
+ return rawShape(schema._zod.def) ?? schema._zod.def.shape;
2110
+ }
2111
+ function deferProp(target, key, getter) {
2112
+ Object.defineProperty(target, key, {
2113
+ get() {
2114
+ const value = getter();
2115
+ assignProp(this, key, value);
2116
+ return value;
2117
+ },
2118
+ enumerable: true,
2119
+ configurable: true
2120
+ });
2121
+ }
2122
+ function putProp(target, key, value) {
2123
+ if (key in target)
2124
+ assignProp(target, key, value);
2125
+ else
2126
+ target[key] = value;
2127
+ }
2128
+ function mirrorShape(target, source, keys, wrap) {
2129
+ const raw = sourceShape(source);
2130
+ for (const key of keys) {
2131
+ const desc = Object.getOwnPropertyDescriptor(raw, key);
2132
+ if (!desc.enumerable)
2133
+ continue;
2134
+ if (desc.get) {
2135
+ deferProp(target, key, () => {
2136
+ const value = source._zod.def.shape[key];
2137
+ return wrap ? wrap(value, key) : value;
2138
+ });
2139
+ } else
2140
+ putProp(target, key, wrap ? wrap(desc.value, key) : desc.value);
2141
+ }
2142
+ }
2143
+ function mirrorProps(target, source) {
2144
+ for (const key of Reflect.ownKeys(source)) {
2145
+ const desc = Object.getOwnPropertyDescriptor(source, key);
2146
+ if (!desc.enumerable)
2147
+ continue;
2148
+ if (desc.get)
2149
+ deferProp(target, key, () => source[key]);
2150
+ else
2151
+ putProp(target, key, desc.value);
2152
+ }
2153
+ }
2072
2154
  function mergeDefs(...defs) {
2073
2155
  const mergedDescriptors = {};
2074
2156
  for (const def of defs) {
@@ -2307,23 +2389,21 @@ function pick(schema, mask) {
2307
2389
  if (hasChecks) {
2308
2390
  throw new Error(".pick() cannot be used on object schemas containing refinements");
2309
2391
  }
2310
- const def = mergeDefs(schema._zod.def, {
2311
- get shape() {
2312
- const newShape = {};
2313
- for (const key of Reflect.ownKeys(mask)) {
2314
- if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) {
2315
- throw new Error(`Unrecognized key: "${String(key)}"`);
2316
- }
2317
- if (!mask[key])
2318
- continue;
2319
- assignProp(newShape, key, currDef.shape[key]);
2320
- }
2321
- assignProp(this, "shape", newShape);
2322
- return newShape;
2323
- },
2324
- checks: []
2325
- });
2326
- return clone(schema, def);
2392
+ const newShape = {};
2393
+ mirrorShape(newShape, schema, maskedKeys(schema, mask));
2394
+ return clone(schema, mergeDefs(currDef, { shape: newShape, checks: [] }));
2395
+ }
2396
+ function maskedKeys(schema, mask) {
2397
+ const raw = sourceShape(schema);
2398
+ const keys = [];
2399
+ for (const key of Reflect.ownKeys(mask)) {
2400
+ if (!Object.getOwnPropertyDescriptor(raw, key)?.enumerable) {
2401
+ throw new Error(`Unrecognized key: "${String(key)}"`);
2402
+ }
2403
+ if (mask[key])
2404
+ keys.push(key);
2405
+ }
2406
+ return keys;
2327
2407
  }
2328
2408
  function omit(schema, mask) {
2329
2409
  const currDef = schema._zod.def;
@@ -2332,23 +2412,10 @@ function omit(schema, mask) {
2332
2412
  if (hasChecks) {
2333
2413
  throw new Error(".omit() cannot be used on object schemas containing refinements");
2334
2414
  }
2335
- const def = mergeDefs(schema._zod.def, {
2336
- get shape() {
2337
- const newShape = { ...schema._zod.def.shape };
2338
- for (const key of Reflect.ownKeys(mask)) {
2339
- if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) {
2340
- throw new Error(`Unrecognized key: "${String(key)}"`);
2341
- }
2342
- if (!mask[key])
2343
- continue;
2344
- delete newShape[key];
2345
- }
2346
- assignProp(this, "shape", newShape);
2347
- return newShape;
2348
- },
2349
- checks: []
2350
- });
2351
- return clone(schema, def);
2415
+ const omitted = new Set(maskedKeys(schema, mask));
2416
+ const newShape = {};
2417
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)).filter((key) => !omitted.has(key)));
2418
+ return clone(schema, mergeDefs(currDef, { shape: newShape, checks: [] }));
2352
2419
  }
2353
2420
  function extend(schema, shape) {
2354
2421
  if (!isPlainObject(shape)) {
@@ -2357,34 +2424,26 @@ function extend(schema, shape) {
2357
2424
  const checks = schema._zod.def.checks;
2358
2425
  const hasChecks = checks && checks.length > 0;
2359
2426
  if (hasChecks) {
2360
- const existingShape = schema._zod.def.shape;
2427
+ const existingShape = sourceShape(schema);
2361
2428
  for (const key of Reflect.ownKeys(shape)) {
2362
2429
  if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) {
2363
2430
  throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
2364
2431
  }
2365
2432
  }
2366
2433
  }
2367
- const def = mergeDefs(schema._zod.def, {
2368
- get shape() {
2369
- const _shape = { ...schema._zod.def.shape, ...shape };
2370
- assignProp(this, "shape", _shape);
2371
- return _shape;
2372
- }
2373
- });
2374
- return clone(schema, def);
2434
+ return clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
2435
+ }
2436
+ function extended(schema, shape) {
2437
+ const newShape = {};
2438
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)));
2439
+ mirrorProps(newShape, shape);
2440
+ return newShape;
2375
2441
  }
2376
2442
  function safeExtend(schema, shape) {
2377
2443
  if (!isPlainObject(shape)) {
2378
2444
  throw new Error("Invalid input to safeExtend: expected a plain object");
2379
2445
  }
2380
- const def = mergeDefs(schema._zod.def, {
2381
- get shape() {
2382
- const _shape = { ...schema._zod.def.shape, ...shape };
2383
- assignProp(this, "shape", _shape);
2384
- return _shape;
2385
- }
2386
- });
2387
- return clone(schema, def);
2446
+ return clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
2388
2447
  }
2389
2448
  function merge(a, b) {
2390
2449
  if (!b?._zod?.def) {
@@ -2393,12 +2452,11 @@ function merge(a, b) {
2393
2452
  if (a._zod.def.checks?.length) {
2394
2453
  throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
2395
2454
  }
2455
+ const newShape = {};
2456
+ mirrorShape(newShape, a, Reflect.ownKeys(sourceShape(a)));
2457
+ mirrorShape(newShape, b, Reflect.ownKeys(sourceShape(b)));
2396
2458
  const def = mergeDefs(a._zod.def, {
2397
- get shape() {
2398
- const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
2399
- assignProp(this, "shape", _shape);
2400
- return _shape;
2401
- },
2459
+ shape: newShape,
2402
2460
  get catchall() {
2403
2461
  return b._zod.def.catchall;
2404
2462
  },
@@ -2413,67 +2471,19 @@ function partial(Class2, schema, mask, name = "partial") {
2413
2471
  if (hasChecks) {
2414
2472
  throw new Error(`.${name}() cannot be used on object schemas containing refinements`);
2415
2473
  }
2416
- const def = mergeDefs(schema._zod.def, {
2417
- get shape() {
2418
- const oldShape = schema._zod.def.shape;
2419
- const shape = { ...oldShape };
2420
- if (mask) {
2421
- for (const key of Reflect.ownKeys(mask)) {
2422
- if (!Object.prototype.hasOwnProperty.call(oldShape, key)) {
2423
- throw new Error(`Unrecognized key: "${String(key)}"`);
2424
- }
2425
- if (!mask[key])
2426
- continue;
2427
- shape[key] = Class2 ? new Class2({
2428
- type: "optional",
2429
- innerType: oldShape[key]
2430
- }) : oldShape[key];
2431
- }
2432
- } else {
2433
- for (const key of Reflect.ownKeys(oldShape)) {
2434
- shape[key] = Class2 ? new Class2({
2435
- type: "optional",
2436
- innerType: oldShape[key]
2437
- }) : oldShape[key];
2438
- }
2439
- }
2440
- assignProp(this, "shape", shape);
2441
- return shape;
2442
- },
2443
- checks: []
2444
- });
2445
- return clone(schema, def);
2474
+ const selected = mask ? new Set(maskedKeys(schema, mask)) : void 0;
2475
+ const newShape = {};
2476
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), Class2 && ((value, key) => selected && !selected.has(key) ? value : new Class2({ type: "optional", innerType: value })));
2477
+ return clone(schema, mergeDefs(schema._zod.def, { shape: newShape, checks: [] }));
2446
2478
  }
2447
2479
  function required(Class2, schema, mask) {
2448
- const def = mergeDefs(schema._zod.def, {
2449
- get shape() {
2450
- const oldShape = schema._zod.def.shape;
2451
- const shape = { ...oldShape };
2452
- if (mask) {
2453
- for (const key of Reflect.ownKeys(mask)) {
2454
- if (!Object.prototype.hasOwnProperty.call(shape, key)) {
2455
- throw new Error(`Unrecognized key: "${String(key)}"`);
2456
- }
2457
- if (!mask[key])
2458
- continue;
2459
- shape[key] = new Class2({
2460
- type: "nonoptional",
2461
- innerType: oldShape[key]
2462
- });
2463
- }
2464
- } else {
2465
- for (const key of Reflect.ownKeys(oldShape)) {
2466
- shape[key] = new Class2({
2467
- type: "nonoptional",
2468
- innerType: oldShape[key]
2469
- });
2470
- }
2471
- }
2472
- assignProp(this, "shape", shape);
2473
- return shape;
2474
- }
2475
- });
2476
- return clone(schema, def);
2480
+ const selected = mask ? new Set(maskedKeys(schema, mask)) : void 0;
2481
+ const newShape = {};
2482
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), (value, key) => (
2483
+ // overwrite with non-optional
2484
+ selected && !selected.has(key) ? value : new Class2({ type: "nonoptional", innerType: value })
2485
+ ));
2486
+ return clone(schema, mergeDefs(schema._zod.def, { shape: newShape }));
2477
2487
  }
2478
2488
  function aborted(x, startIndex = 0) {
2479
2489
  if (x.aborted === true)
@@ -2506,6 +2516,18 @@ function prefixIssues(path, issues) {
2506
2516
  function unwrapMessage(message) {
2507
2517
  return typeof message === "string" ? message : message?.message;
2508
2518
  }
2519
+ function sizeCaps(defChecks) {
2520
+ const caps = [];
2521
+ for (const ch of defChecks ?? []) {
2522
+ const d = ch._zod.def;
2523
+ if (!/_(length|size)$|_equals$/.test(d.check))
2524
+ break;
2525
+ const max = d.maximum ?? d.length ?? d.size;
2526
+ if (max >= 0)
2527
+ caps.push([max, ch]);
2528
+ }
2529
+ return caps;
2530
+ }
2509
2531
  function attachSchema(issues, start, inst) {
2510
2532
  var _a3;
2511
2533
  for (let i = start; i < issues.length; i++) {
@@ -2523,13 +2545,18 @@ function finalizeIssue(iss, ctx, config2) {
2523
2545
  }
2524
2546
  const schemaError = iss.schema !== iss.inst ? iss.schema?._zod.def?.error : void 0;
2525
2547
  const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(schemaError?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input";
2526
- const { inst: _inst, schema: _schema, continue: _continue, input: _input, ...rest } = iss;
2527
- rest.path ?? (rest.path = []);
2528
- rest.message = message;
2548
+ const full = {};
2549
+ for (const k of Object.keys(iss)) {
2550
+ if (k === "inst" || k === "schema" || k === "continue" || k === "input" || k === "__proto__")
2551
+ continue;
2552
+ full[k] = iss[k];
2553
+ }
2554
+ full.path ?? (full.path = []);
2555
+ full.message = message;
2529
2556
  if (ctx?.reportInput) {
2530
- rest.input = _input;
2557
+ full.input = iss.input;
2531
2558
  }
2532
- return rest;
2559
+ return full;
2533
2560
  }
2534
2561
  function getSizableOrigin(input2) {
2535
2562
  if (input2 instanceof Set)
@@ -2656,6 +2683,23 @@ function own(inst, key, value, enumerable = true) {
2656
2683
  function hide(inst, key, value) {
2657
2684
  return own(inst, key, value, false);
2658
2685
  }
2686
+ // @__NO_SIDE_EFFECTS__
2687
+ function derived(computes, table) {
2688
+ for (const key in computes) {
2689
+ const compute = computes[key];
2690
+ Object.defineProperty(table, key, {
2691
+ configurable: true,
2692
+ enumerable: true,
2693
+ get() {
2694
+ return own(this, key, compute(this));
2695
+ },
2696
+ set(value) {
2697
+ own(this, key, value);
2698
+ }
2699
+ });
2700
+ }
2701
+ return table;
2702
+ }
2659
2703
  function defineBound(proto, key, fn) {
2660
2704
  Object.defineProperty(proto, key, {
2661
2705
  configurable: true,
@@ -2783,8 +2827,7 @@ function $constructor(name, initializer3, proto, params) {
2783
2827
  } finally {
2784
2828
  _zodDesc.value = void 0;
2785
2829
  }
2786
- }
2787
- if (inst._zod.traits.has(name)) {
2830
+ } else if (inst._zod.traits.has(name)) {
2788
2831
  return;
2789
2832
  }
2790
2833
  inst._zod.traits.add(name);
@@ -2875,16 +2918,12 @@ var _messageDesc = {
2875
2918
  enumerable: true,
2876
2919
  configurable: true
2877
2920
  };
2878
- var _zodDesc2 = { value: void 0, enumerable: false };
2879
2921
  var _issuesDesc = { value: void 0, enumerable: false };
2880
2922
  var _installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
2881
2923
  var initializer = (inst, def) => {
2882
2924
  inst.name = "$ZodError";
2883
- _zodDesc2.value = inst._zod;
2884
- Object.defineProperty(inst, "_zod", _zodDesc2);
2885
2925
  _issuesDesc.value = def;
2886
2926
  Object.defineProperty(inst, "issues", _issuesDesc);
2887
- _zodDesc2.value = void 0;
2888
2927
  _issuesDesc.value = void 0;
2889
2928
  Object.defineProperty(inst, "message", _messageDesc);
2890
2929
  const proto = Object.getPrototypeOf(inst);
@@ -2918,10 +2957,10 @@ function node(obj, key, make) {
2918
2957
  }
2919
2958
  return obj[key];
2920
2959
  }
2921
- function flattenError(error61, mapper = (issue2) => issue2.message) {
2960
+ function flattenError(error62, mapper = (issue2) => issue2.message) {
2922
2961
  const fieldErrors = {};
2923
2962
  const formErrors = [];
2924
- for (const sub of error61.issues) {
2963
+ for (const sub of error62.issues) {
2925
2964
  if (sub.path.length > 0) {
2926
2965
  node(fieldErrors, sub.path[0], () => []).push(mapper(sub));
2927
2966
  } else {
@@ -2930,10 +2969,10 @@ function flattenError(error61, mapper = (issue2) => issue2.message) {
2930
2969
  }
2931
2970
  return { formErrors, fieldErrors };
2932
2971
  }
2933
- function formatError(error61, mapper = (issue2) => issue2.message) {
2972
+ function formatError(error62, mapper = (issue2) => issue2.message) {
2934
2973
  const fieldErrors = { _errors: [] };
2935
- const processError = (error62, path = []) => {
2936
- for (const issue2 of error62.issues) {
2974
+ const processError = (error63, path = []) => {
2975
+ for (const issue2 of error63.issues) {
2937
2976
  if (issue2.code === "invalid_union" && issue2.errors.length) {
2938
2977
  issue2.errors.map((issues) => processError({ issues }, [...path, ...issue2.path]));
2939
2978
  } else if (issue2.code === "invalid_key") {
@@ -2975,14 +3014,14 @@ function formatError(error61, mapper = (issue2) => issue2.message) {
2975
3014
  }
2976
3015
  }
2977
3016
  };
2978
- processError(error61);
3017
+ processError(error62);
2979
3018
  return fieldErrors;
2980
3019
  }
2981
- function treeifyError(error61, mapper = (issue2) => issue2.message) {
3020
+ function treeifyError(error62, mapper = (issue2) => issue2.message) {
2982
3021
  const result = { errors: [] };
2983
- const processError = (error62, path = []) => {
3022
+ const processError = (error63, path = []) => {
2984
3023
  var _a3;
2985
- for (const issue2 of error62.issues) {
3024
+ for (const issue2 of error63.issues) {
2986
3025
  if (issue2.code === "invalid_union" && issue2.errors.length) {
2987
3026
  issue2.errors.map((issues) => processError({ issues }, [...path, ...issue2.path]));
2988
3027
  } else if (issue2.code === "invalid_key") {
@@ -3024,7 +3063,7 @@ function treeifyError(error61, mapper = (issue2) => issue2.message) {
3024
3063
  }
3025
3064
  }
3026
3065
  };
3027
- processError(error61);
3066
+ processError(error62);
3028
3067
  return result;
3029
3068
  }
3030
3069
  function toDotPath(_path) {
@@ -3045,9 +3084,9 @@ function toDotPath(_path) {
3045
3084
  }
3046
3085
  return segs.join("");
3047
3086
  }
3048
- function prettifyError(error61) {
3087
+ function prettifyError(error62) {
3049
3088
  const lines = [];
3050
- const issues = [...error61.issues].sort((a, b) => (a.path ?? []).length - (b.path ?? []).length);
3089
+ const issues = [...error62.issues].sort((a, b) => (a.path ?? []).length - (b.path ?? []).length);
3051
3090
  for (const issue2 of issues) {
3052
3091
  lines.push(`\u2716 ${issue2.message}`);
3053
3092
  if (issue2.path?.length)
@@ -3099,33 +3138,50 @@ var _safeParse = (_Err) => (schema, value, _ctx) => {
3099
3138
  if (result instanceof Promise) {
3100
3139
  throw new $ZodAsyncError();
3101
3140
  }
3102
- return result.issues.length ? {
3103
- success: false,
3104
- error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
3105
- } : { success: true, data: result.value };
3141
+ return result.issues.length ? failure(_Err, result.issues, ctx) : { success: true, data: result.value };
3106
3142
  };
3107
3143
  var safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
3144
+ function failure(Err, issues, ctx) {
3145
+ let error62;
3146
+ return {
3147
+ success: false,
3148
+ get error() {
3149
+ if (!error62) {
3150
+ error62 = new Err(issues.map((iss) => finalizeIssue(iss, ctx, config())));
3151
+ issues = void 0;
3152
+ ctx = void 0;
3153
+ }
3154
+ return error62;
3155
+ },
3156
+ set error(e) {
3157
+ error62 = e;
3158
+ issues = void 0;
3159
+ ctx = void 0;
3160
+ }
3161
+ };
3162
+ }
3108
3163
  var _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
3109
3164
  const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
3110
3165
  let result = schema._zod.run({ value, issues: [] }, ctx);
3111
3166
  if (result instanceof Promise)
3112
3167
  result = await result;
3113
- return result.issues.length ? {
3114
- success: false,
3115
- error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
3116
- } : { success: true, data: result.value };
3168
+ return result.issues.length ? failure(_Err, result.issues, ctx) : { success: true, data: result.value };
3117
3169
  };
3118
3170
  var safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
3119
3171
  var COMPILE_INVALID = /* @__PURE__ */ Symbol.for("zod.compile.invalid");
3120
3172
  var COMPILE_FALLBACK = /* @__PURE__ */ Symbol.for("zod.compile.fallback");
3121
3173
  var validate = ((schema, value, _ctx) => {
3122
3174
  const validator = schema._zod.bag.validator;
3123
- if (validator !== void 0 && validator(value) !== COMPILE_INVALID)
3124
- return true;
3175
+ if (validator !== void 0) {
3176
+ if (validator(value) !== COMPILE_INVALID)
3177
+ return true;
3178
+ if (validator.definite === true && _ctx === void 0)
3179
+ return false;
3180
+ }
3125
3181
  return validateFallback(schema, value, _ctx);
3126
3182
  });
3127
3183
  function validateFallback(schema, value, _ctx) {
3128
- const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
3184
+ const ctx = _ctx ? { ..._ctx, async: false, abortEarly: true } : { async: false, abortEarly: true };
3129
3185
  const fallbackRun = schema._zod.bag.fallbackRun;
3130
3186
  let result;
3131
3187
  if (fallbackRun) {
@@ -3140,7 +3196,7 @@ function validateFallback(schema, value, _ctx) {
3140
3196
  return result.issues.length === 0;
3141
3197
  }
3142
3198
  var validateAsync = async (schema, value, _ctx) => {
3143
- const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
3199
+ const ctx = _ctx ? { ..._ctx, async: true, abortEarly: true } : { async: true, abortEarly: true };
3144
3200
  let result = schema._zod.run({ value, issues: [] }, ctx);
3145
3201
  if (result instanceof Promise)
3146
3202
  result = await result;
@@ -3202,6 +3258,7 @@ var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
3202
3258
  // node_modules/zod/v4/core/regexes.js
3203
3259
  var regexes_exports = {};
3204
3260
  __export(regexes_exports, {
3261
+ anyString: () => anyString,
3205
3262
  base64: () => base64,
3206
3263
  base64url: () => base64url,
3207
3264
  bigint: () => bigint,
@@ -3212,6 +3269,7 @@ __export(regexes_exports, {
3212
3269
  creditCard: () => creditCard,
3213
3270
  cuid: () => cuid,
3214
3271
  cuid2: () => cuid2,
3272
+ currencyCode: () => currencyCode,
3215
3273
  date: () => date,
3216
3274
  datetime: () => datetime,
3217
3275
  domain: () => domain,
@@ -3225,6 +3283,7 @@ __export(regexes_exports, {
3225
3283
  hostname: () => hostname,
3226
3284
  html5Email: () => html5Email,
3227
3285
  httpProtocol: () => httpProtocol,
3286
+ iban: () => iban,
3228
3287
  idnEmail: () => idnEmail,
3229
3288
  integer: () => integer,
3230
3289
  ipv4: () => ipv4,
@@ -3284,13 +3343,13 @@ var uuid = (version2) => {
3284
3343
  var uuid4 = /* @__PURE__ */ uuid(4);
3285
3344
  var uuid6 = /* @__PURE__ */ uuid(6);
3286
3345
  var uuid7 = /* @__PURE__ */ uuid(7);
3287
- var email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
3346
+ 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,}$/;
3288
3347
  var html5Email = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
3289
3348
  var rfc5322Email = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
3290
3349
  var unicodeEmail = /^[^\s@"]{1,64}@[^\s@]{1,255}$/u;
3291
3350
  var idnEmail = unicodeEmail;
3292
3351
  var browserEmail = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
3293
- var _emoji = `^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
3352
+ var _emoji = `^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
3294
3353
  function emoji() {
3295
3354
  return new RegExp(_emoji, "u");
3296
3355
  }
@@ -3303,12 +3362,14 @@ var mac = (delimiter) => {
3303
3362
  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])$/;
3304
3363
  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])$/;
3305
3364
  var base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
3306
- var base64url = /^[A-Za-z0-9_-]*$/;
3365
+ var base64url = /^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;
3307
3366
  var hostname = /^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/;
3308
3367
  var domain = /^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/;
3309
3368
  var httpProtocol = /^https?$/;
3310
3369
  var e164 = /^\+[1-9]\d{6,14}$/;
3311
3370
  var creditCard = /^\d(?:[ -]?\d){11,18}$/;
3371
+ var currencyCode = /^(?:AED|AFN|ALL|AMD|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BHD|BIF|BMD|BND|BOB|BOV|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHE|CHF|CHW|CLF|CLP|CNY|COP|COU|CRC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MXV|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|USN|UYI|UYU|UYW|UZS|VED|VES|VND|VUV|WST|XAD|XAF|XAG|XAU|XBA|XBB|XBC|XBD|XCD|XCG|XDR|XOF|XPD|XPF|XPT|XSU|XTS|XUA|XXX|YER|ZAR|ZMW|ZWG)$/;
3372
+ var iban = /^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/;
3312
3373
  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])))`;
3313
3374
  function anchor(source) {
3314
3375
  return new RegExp(`^${source}$`);
@@ -3330,6 +3391,7 @@ function datetime(args) {
3330
3391
  const timeRegex = args.local ? `${qualified}|${timeSource({ precision: args.precision })}` : qualified;
3331
3392
  return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
3332
3393
  }
3394
+ var anyString = /^[\s\S]{0,}$/;
3333
3395
  var string = (params) => {
3334
3396
  const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
3335
3397
  return new RegExp(`^${regex}$`);
@@ -3388,16 +3450,6 @@ var numericOriginMap = {
3388
3450
  var $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst, def) => {
3389
3451
  $ZodCheck.init(inst, def);
3390
3452
  const origin = numericOriginMap[typeof def.value];
3391
- inst._zod.onattach.push((inst2) => {
3392
- const bag = inst2._zod.bag;
3393
- const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
3394
- if (def.value < curr) {
3395
- if (def.inclusive)
3396
- bag.maximum = def.value;
3397
- else
3398
- bag.exclusiveMaximum = def.value;
3399
- }
3400
- });
3401
3453
  inst._zod.check = (payload) => {
3402
3454
  if (def.inclusive ? payload.value <= def.value : payload.value < def.value) {
3403
3455
  return;
@@ -3416,16 +3468,6 @@ var $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst,
3416
3468
  var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan", (inst, def) => {
3417
3469
  $ZodCheck.init(inst, def);
3418
3470
  const origin = numericOriginMap[typeof def.value];
3419
- inst._zod.onattach.push((inst2) => {
3420
- const bag = inst2._zod.bag;
3421
- const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
3422
- if (def.value > curr) {
3423
- if (def.inclusive)
3424
- bag.minimum = def.value;
3425
- else
3426
- bag.exclusiveMinimum = def.value;
3427
- }
3428
- });
3429
3471
  inst._zod.check = (payload) => {
3430
3472
  if (def.inclusive ? payload.value >= def.value : payload.value > def.value) {
3431
3473
  return;
@@ -3443,10 +3485,6 @@ var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan",
3443
3485
  });
3444
3486
  var $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {
3445
3487
  $ZodCheck.init(inst, def);
3446
- inst._zod.onattach.push((inst2) => {
3447
- var _a3;
3448
- (_a3 = inst2._zod.bag).multipleOf ?? (_a3.multipleOf = def.value);
3449
- });
3450
3488
  inst._zod.check = (payload) => {
3451
3489
  if (typeof payload.value !== typeof def.value)
3452
3490
  throw new Error("Cannot mix number and bigint in multiple_of check.");
@@ -3472,14 +3510,6 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
3472
3510
  const isInt = def.format?.includes("int");
3473
3511
  const origin = isInt ? "int" : "number";
3474
3512
  const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
3475
- inst._zod.onattach.push((inst2) => {
3476
- const bag = inst2._zod.bag;
3477
- bag.format = def.format;
3478
- bag.minimum = minimum;
3479
- bag.maximum = maximum;
3480
- if (isInt)
3481
- bag.pattern = integer;
3482
- });
3483
3513
  inst._zod.check = (payload) => {
3484
3514
  const input2 = payload.value;
3485
3515
  if (isInt) {
@@ -3548,12 +3578,6 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
3548
3578
  var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat", (inst, def) => {
3549
3579
  $ZodCheck.init(inst, def);
3550
3580
  const [minimum, maximum] = BIGINT_FORMAT_RANGES[def.format];
3551
- inst._zod.onattach.push((inst2) => {
3552
- const bag = inst2._zod.bag;
3553
- bag.format = def.format;
3554
- bag.minimum = minimum;
3555
- bag.maximum = maximum;
3556
- });
3557
3581
  inst._zod.check = (payload) => {
3558
3582
  const input2 = payload.value;
3559
3583
  if (input2 < minimum) {
@@ -3584,11 +3608,6 @@ var $ZodCheckMaxSize = /* @__PURE__ */ $constructor("$ZodCheckMaxSize", (inst, d
3584
3608
  var _a3;
3585
3609
  $ZodCheck.init(inst, def);
3586
3610
  (_a3 = inst._zod.def).when ?? (_a3.when = _whenHasSize);
3587
- inst._zod.onattach.push((inst2) => {
3588
- const curr = inst2._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
3589
- if (def.maximum < curr)
3590
- inst2._zod.bag.maximum = def.maximum;
3591
- });
3592
3611
  inst._zod.check = (payload) => {
3593
3612
  const input2 = payload.value;
3594
3613
  const size = input2.size;
@@ -3609,11 +3628,6 @@ var $ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, d
3609
3628
  var _a3;
3610
3629
  $ZodCheck.init(inst, def);
3611
3630
  (_a3 = inst._zod.def).when ?? (_a3.when = _whenHasSize);
3612
- inst._zod.onattach.push((inst2) => {
3613
- const curr = inst2._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
3614
- if (def.minimum > curr)
3615
- inst2._zod.bag.minimum = def.minimum;
3616
- });
3617
3631
  inst._zod.check = (payload) => {
3618
3632
  const input2 = payload.value;
3619
3633
  const size = input2.size;
@@ -3634,12 +3648,6 @@ var $ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (i
3634
3648
  var _a3;
3635
3649
  $ZodCheck.init(inst, def);
3636
3650
  (_a3 = inst._zod.def).when ?? (_a3.when = _whenHasSize);
3637
- inst._zod.onattach.push((inst2) => {
3638
- const bag = inst2._zod.bag;
3639
- bag.minimum = def.size;
3640
- bag.maximum = def.size;
3641
- bag.size = def.size;
3642
- });
3643
3651
  inst._zod.check = (payload) => {
3644
3652
  const input2 = payload.value;
3645
3653
  const size = input2.size;
@@ -3661,11 +3669,6 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins
3661
3669
  var _a3;
3662
3670
  $ZodCheck.init(inst, def);
3663
3671
  (_a3 = inst._zod.def).when ?? (_a3.when = _whenHasLength);
3664
- inst._zod.onattach.push((inst2) => {
3665
- const curr = inst2._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
3666
- if (def.maximum < curr)
3667
- inst2._zod.bag.maximum = def.maximum;
3668
- });
3669
3672
  inst._zod.check = (payload) => {
3670
3673
  const input2 = payload.value;
3671
3674
  const units = input2.length;
@@ -3688,11 +3691,6 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins
3688
3691
  var _a3;
3689
3692
  $ZodCheck.init(inst, def);
3690
3693
  (_a3 = inst._zod.def).when ?? (_a3.when = _whenHasLength);
3691
- inst._zod.onattach.push((inst2) => {
3692
- const curr = inst2._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
3693
- if (def.minimum > curr)
3694
- inst2._zod.bag.minimum = def.minimum;
3695
- });
3696
3694
  inst._zod.check = (payload) => {
3697
3695
  const input2 = payload.value;
3698
3696
  const units = input2.length;
@@ -3715,12 +3713,6 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
3715
3713
  var _a3;
3716
3714
  $ZodCheck.init(inst, def);
3717
3715
  (_a3 = inst._zod.def).when ?? (_a3.when = _whenHasLength);
3718
- inst._zod.onattach.push((inst2) => {
3719
- const bag = inst2._zod.bag;
3720
- bag.minimum = def.length;
3721
- bag.maximum = def.length;
3722
- bag.length = def.length;
3723
- });
3724
3716
  inst._zod.check = (payload) => {
3725
3717
  const input2 = payload.value;
3726
3718
  const units = input2.length;
@@ -3743,14 +3735,6 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
3743
3735
  var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
3744
3736
  var _a3, _b;
3745
3737
  $ZodCheck.init(inst, def);
3746
- inst._zod.onattach.push((inst2) => {
3747
- const bag = inst2._zod.bag;
3748
- bag.format = def.format;
3749
- if (def.pattern) {
3750
- bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
3751
- bag.patterns.add(def.pattern);
3752
- }
3753
- });
3754
3738
  if (def.pattern)
3755
3739
  (_a3 = inst._zod).check ?? (_a3.check = (payload) => {
3756
3740
  def.pattern.lastIndex = 0;
@@ -3800,11 +3784,6 @@ var $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (inst,
3800
3784
  const escapedRegex = escapeRegex(def.includes);
3801
3785
  const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position},}${escapedRegex}` : escapedRegex);
3802
3786
  def.pattern = pattern;
3803
- inst._zod.onattach.push((inst2) => {
3804
- const bag = inst2._zod.bag;
3805
- bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
3806
- bag.patterns.add(pattern);
3807
- });
3808
3787
  inst._zod.check = (payload) => {
3809
3788
  if (payload.value.includes(def.includes, def.position))
3810
3789
  return;
@@ -3823,11 +3802,6 @@ var $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith", (i
3823
3802
  $ZodCheck.init(inst, def);
3824
3803
  const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
3825
3804
  def.pattern ?? (def.pattern = pattern);
3826
- inst._zod.onattach.push((inst2) => {
3827
- const bag = inst2._zod.bag;
3828
- bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
3829
- bag.patterns.add(pattern);
3830
- });
3831
3805
  inst._zod.check = (payload) => {
3832
3806
  if (payload.value.startsWith(def.prefix))
3833
3807
  return;
@@ -3846,11 +3820,6 @@ var $ZodCheckEndsWith = /* @__PURE__ */ $constructor("$ZodCheckEndsWith", (inst,
3846
3820
  $ZodCheck.init(inst, def);
3847
3821
  const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
3848
3822
  def.pattern ?? (def.pattern = pattern);
3849
- inst._zod.onattach.push((inst2) => {
3850
- const bag = inst2._zod.bag;
3851
- bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
3852
- bag.patterns.add(pattern);
3853
- });
3854
3823
  inst._zod.check = (payload) => {
3855
3824
  if (payload.value.endsWith(def.suffix))
3856
3825
  return;
@@ -3884,12 +3853,37 @@ var $ZodCheckProperty = /* @__PURE__ */ $constructor("$ZodCheckProperty", (inst,
3884
3853
  return;
3885
3854
  };
3886
3855
  });
3856
+ var $ZodCheckProperties = /* @__PURE__ */ $constructor("$ZodCheckProperties", (inst, def) => {
3857
+ $ZodCheck.init(inst, def);
3858
+ hide(inst, Symbol.iterator, function* () {
3859
+ yield inst;
3860
+ });
3861
+ let entries;
3862
+ inst._zod.check = (payload) => {
3863
+ if (payload.value == null) {
3864
+ payload.issues.push({ expected: "object", code: "invalid_type", input: payload.value, inst });
3865
+ return void 0;
3866
+ }
3867
+ entries ?? (entries = Reflect.ownKeys(def.shape).map((key) => [key, def.shape[key]]));
3868
+ const input2 = payload.value;
3869
+ let proms;
3870
+ for (const [key, schema] of entries) {
3871
+ const result = schema._zod.run({ value: input2[key], issues: [] }, {});
3872
+ if (result instanceof Promise) {
3873
+ proms ?? (proms = []);
3874
+ proms.push(result.then((result2) => handleCheckPropertyResult(result2, payload, key)));
3875
+ } else {
3876
+ handleCheckPropertyResult(result, payload, key);
3877
+ }
3878
+ }
3879
+ if (proms)
3880
+ return Promise.all(proms).then(() => void 0);
3881
+ return void 0;
3882
+ };
3883
+ });
3887
3884
  var $ZodCheckMimeType = /* @__PURE__ */ $constructor("$ZodCheckMimeType", (inst, def) => {
3888
3885
  $ZodCheck.init(inst, def);
3889
3886
  const mimeSet = new Set(def.mime);
3890
- inst._zod.onattach.push((inst2) => {
3891
- inst2._zod.bag.mime = def.mime;
3892
- });
3893
3887
  inst._zod.check = (payload) => {
3894
3888
  if (mimeSet.has(payload.value.type))
3895
3889
  return;
@@ -3917,10 +3911,14 @@ var Doc = class {
3917
3911
  this.args = args;
3918
3912
  this.closed = closed;
3919
3913
  }
3914
+ // the compiler catches a child's throw and keeps writing into this doc, so the indent has to unwind with it
3920
3915
  indented(fn) {
3921
3916
  this.indent += 1;
3922
- fn(this);
3923
- this.indent -= 1;
3917
+ try {
3918
+ fn(this);
3919
+ } finally {
3920
+ this.indent -= 1;
3921
+ }
3924
3922
  }
3925
3923
  write(arg) {
3926
3924
  if (typeof arg === "function") {
@@ -3949,8 +3947,8 @@ ${content.join("\n")}
3949
3947
  // node_modules/zod/v4/core/versions.js
3950
3948
  var version = {
3951
3949
  major: 4,
3952
- minor: 5,
3953
- patch: 4
3950
+ minor: 6,
3951
+ patch: 7
3954
3952
  };
3955
3953
 
3956
3954
  // node_modules/zod/v4/core/schemas.js
@@ -4063,15 +4061,22 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
4063
4061
  own(this, "~standard", value);
4064
4062
  }
4065
4063
  });
4066
- var toStandardResult = (r) => r.success ? { value: r.data } : { issues: r.error?.issues };
4064
+ var toStandardResult = (r, ctx) => r.issues.length ? { issues: r.issues.map((iss) => finalizeIssue(iss, ctx, config())) } : { value: r.value };
4065
+ async function validateAsync2(inst, value) {
4066
+ const ctx = { async: true };
4067
+ return toStandardResult(await inst._zod.run({ value, issues: [] }, ctx), ctx);
4068
+ }
4067
4069
  function standardProps(inst) {
4068
4070
  return {
4069
4071
  validate: (value) => {
4072
+ const ctx = { async: false };
4070
4073
  try {
4071
- return toStandardResult(safeParse(inst, value));
4074
+ const r = inst._zod.run({ value, issues: [] }, ctx);
4075
+ if (!(r instanceof Promise))
4076
+ return toStandardResult(r, ctx);
4072
4077
  } catch (_) {
4073
- return safeParseAsync(inst, value).then(toStandardResult);
4074
4078
  }
4079
+ return validateAsync2(inst, value);
4075
4080
  },
4076
4081
  vendor: "zod",
4077
4082
  version: 1
@@ -4079,7 +4084,7 @@ function standardProps(inst) {
4079
4084
  }
4080
4085
  var $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
4081
4086
  $ZodType.init(inst, def);
4082
- inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string(inst._zod.bag);
4087
+ inst._zod.pattern = def.pattern ?? anyString;
4083
4088
  inst._zod.parse = (payload, _) => {
4084
4089
  if (def.coerce)
4085
4090
  try {
@@ -4131,11 +4136,32 @@ var $ZodEmail = /* @__PURE__ */ $constructor("$ZodEmail", (inst, def) => {
4131
4136
  });
4132
4137
  var URL_BAD_FORMAT = 1;
4133
4138
  var URL_UNPARSEABLE = 2;
4139
+ function canParseURL(input2) {
4140
+ try {
4141
+ if (typeof URL !== "undefined" && typeof URL.canParse === "function")
4142
+ return URL.canParse(input2);
4143
+ new URL(input2);
4144
+ return true;
4145
+ } catch {
4146
+ return false;
4147
+ }
4148
+ }
4149
+ function validateURL(trimmed, def) {
4150
+ if (!("normalize" in def) && !("hostname" in def) && !("protocol" in def)) {
4151
+ return canParseURL(trimmed) || URL_UNPARSEABLE;
4152
+ }
4153
+ return parseURLObject(trimmed, def);
4154
+ }
4134
4155
  function parseURLObject(trimmed, def) {
4135
4156
  if (!def.normalize && def.protocol?.source === httpProtocol.source && !/^https?:\/\//i.test(trimmed)) {
4136
4157
  return URL_BAD_FORMAT;
4137
4158
  }
4138
4159
  try {
4160
+ if (typeof URL !== "undefined") {
4161
+ const URLStatic = URL;
4162
+ if (typeof URLStatic.parse === "function")
4163
+ return URLStatic.parse(trimmed) ?? URL_UNPARSEABLE;
4164
+ }
4139
4165
  return new URL(trimmed);
4140
4166
  } catch {
4141
4167
  return URL_UNPARSEABLE;
@@ -4158,7 +4184,7 @@ var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
4158
4184
  inst._zod.check = (payload) => {
4159
4185
  try {
4160
4186
  const trimmed = payload.value.trim();
4161
- const url2 = parseURLObject(trimmed, def);
4187
+ const url2 = validateURL(trimmed, def);
4162
4188
  if (url2 === URL_BAD_FORMAT) {
4163
4189
  payload.issues.push({
4164
4190
  code: "invalid_format",
@@ -4180,6 +4206,10 @@ var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
4180
4206
  });
4181
4207
  return;
4182
4208
  }
4209
+ if (url2 === true) {
4210
+ payload.value = stripTabAndNewline(trimmed);
4211
+ return;
4212
+ }
4183
4213
  if (def.hostname && !urlHostnameOk(url2, def.hostname)) {
4184
4214
  payload.issues.push({
4185
4215
  code: "invalid_format",
@@ -4248,12 +4278,6 @@ var $ZodKSUID = /* @__PURE__ */ $constructor("$ZodKSUID", (inst, def) => {
4248
4278
  var $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, def) => {
4249
4279
  def.pattern ?? (def.pattern = datetime(def));
4250
4280
  $ZodStringFormat.init(inst, def);
4251
- if (def.local || def.precision === -1) {
4252
- inst._zod.bag.laxFormat = true;
4253
- inst._zod.onattach.push((s) => {
4254
- s._zod.bag.laxFormat = true;
4255
- });
4256
- }
4257
4281
  });
4258
4282
  var $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => {
4259
4283
  def.pattern ?? (def.pattern = date);
@@ -4270,23 +4294,16 @@ var $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def
4270
4294
  var $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
4271
4295
  def.pattern ?? (def.pattern = ipv4);
4272
4296
  $ZodStringFormat.init(inst, def);
4273
- inst._zod.bag.format = `ipv4`;
4274
4297
  });
4275
4298
  var ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
4276
4299
  function isValidIPv6(value) {
4277
4300
  if (!ipv6Alphabet.test(value))
4278
4301
  return false;
4279
- try {
4280
- new URL(`http://[${value}]`);
4281
- return true;
4282
- } catch {
4283
- return false;
4284
- }
4302
+ return canParseURL(`http://[${value}]`);
4285
4303
  }
4286
4304
  var $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
4287
4305
  def.pattern ?? (def.pattern = ipv6);
4288
4306
  $ZodStringFormat.init(inst, def);
4289
- inst._zod.bag.format = `ipv6`;
4290
4307
  inst._zod.check = (payload) => {
4291
4308
  if (!isValidIPv6(payload.value)) {
4292
4309
  payload.issues.push({
@@ -4302,7 +4319,6 @@ var $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
4302
4319
  var $ZodMAC = /* @__PURE__ */ $constructor("$ZodMAC", (inst, def) => {
4303
4320
  def.pattern ?? (def.pattern = mac(def.delimiter));
4304
4321
  $ZodStringFormat.init(inst, def);
4305
- inst._zod.bag.format = `mac`;
4306
4322
  });
4307
4323
  var $ZodCIDRv4 = /* @__PURE__ */ $constructor("$ZodCIDRv4", (inst, def) => {
4308
4324
  def.pattern ?? (def.pattern = cidrv4);
@@ -4351,10 +4367,10 @@ function isValidBase64(data) {
4351
4367
  return false;
4352
4368
  }
4353
4369
  }
4370
+ var base64Charset = /^[0-9a-zA-Z+/]*={0,2}$/;
4354
4371
  var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
4355
- def.pattern ?? (def.pattern = base64);
4372
+ def.pattern ?? (def.pattern = base64Charset);
4356
4373
  $ZodStringFormat.init(inst, def);
4357
- inst._zod.bag.contentEncoding = "base64";
4358
4374
  inst._zod.check = (payload) => {
4359
4375
  if (isValidBase64(payload.value))
4360
4376
  return;
@@ -4367,17 +4383,17 @@ var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
4367
4383
  });
4368
4384
  };
4369
4385
  });
4386
+ var base64urlCharset = /^[A-Za-z0-9_-]*$/;
4370
4387
  function isValidBase64URL(data) {
4371
- if (!base64url.test(data))
4388
+ if (!base64urlCharset.test(data))
4372
4389
  return false;
4373
4390
  const base643 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
4374
4391
  const padded = base643.padEnd(Math.ceil(base643.length / 4) * 4, "=");
4375
4392
  return isValidBase64(padded);
4376
4393
  }
4377
4394
  var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
4378
- def.pattern ?? (def.pattern = base64url);
4395
+ def.pattern ?? (def.pattern = base64urlCharset);
4379
4396
  $ZodStringFormat.init(inst, def);
4380
- inst._zod.bag.contentEncoding = "base64url";
4381
4397
  inst._zod.check = (payload) => {
4382
4398
  if (isValidBase64URL(payload.value))
4383
4399
  return;
@@ -4400,7 +4416,7 @@ function isLuhnAlgo(digits) {
4400
4416
  let bit = 1;
4401
4417
  let sum = 0;
4402
4418
  while (length) {
4403
- const value = +digits[--length];
4419
+ const value = digits.charCodeAt(--length) - 48;
4404
4420
  bit ^= 1;
4405
4421
  sum += bit ? [0, 2, 4, 6, 8, 1, 3, 5, 7, 9][value] : value;
4406
4422
  }
@@ -4426,6 +4442,39 @@ var $ZodCreditCard = /* @__PURE__ */ $constructor("$ZodCreditCard", (inst, def)
4426
4442
  });
4427
4443
  };
4428
4444
  });
4445
+ function isIso7064Mod97(iban3) {
4446
+ let remainder = 0;
4447
+ const len = iban3.length;
4448
+ for (let i = 4; i < len; i++) {
4449
+ const code = iban3.charCodeAt(i);
4450
+ remainder = (code >= 65 ? remainder * 100 + (code - 55) : remainder * 10 + (code - 48)) % 97;
4451
+ }
4452
+ for (let i = 0; i < 4; i++) {
4453
+ const code = iban3.charCodeAt(i);
4454
+ remainder = (code >= 65 ? remainder * 100 + (code - 55) : remainder * 10 + (code - 48)) % 97;
4455
+ }
4456
+ return remainder === 1;
4457
+ }
4458
+ function isValidIBAN(input2) {
4459
+ if (!iban.test(input2))
4460
+ return false;
4461
+ return isIso7064Mod97(input2);
4462
+ }
4463
+ var $ZodIBAN = /* @__PURE__ */ $constructor("$ZodIBAN", (inst, def) => {
4464
+ def.pattern ?? (def.pattern = iban);
4465
+ $ZodStringFormat.init(inst, def);
4466
+ inst._zod.check = (payload) => {
4467
+ if (isValidIBAN(payload.value))
4468
+ return;
4469
+ payload.issues.push({
4470
+ code: "invalid_format",
4471
+ format: "iban",
4472
+ input: payload.value,
4473
+ inst,
4474
+ continue: !def.abort
4475
+ });
4476
+ };
4477
+ });
4429
4478
  function isValidJWT(token, algorithm = null) {
4430
4479
  try {
4431
4480
  const tokensParts = token.split(".");
@@ -4476,7 +4525,7 @@ var $ZodCustomStringFormat = /* @__PURE__ */ $constructor("$ZodCustomStringForma
4476
4525
  });
4477
4526
  var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
4478
4527
  $ZodType.init(inst, def);
4479
- inst._zod.pattern = inst._zod.bag.pattern ?? number;
4528
+ inst._zod.pattern = number;
4480
4529
  inst._zod.parse = (payload, _ctx) => {
4481
4530
  if (def.coerce)
4482
4531
  try {
@@ -4655,6 +4704,31 @@ var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
4655
4704
  return payload;
4656
4705
  };
4657
4706
  });
4707
+ function capSize(inst, size) {
4708
+ const caps = sizeCaps(inst._zod.def.checks);
4709
+ if (!caps.length)
4710
+ return;
4711
+ const cap = Math.min(...caps.map((c) => c[0]));
4712
+ const parse3 = inst._zod.parse;
4713
+ inst._zod.parse = (payload, ctx) => {
4714
+ const n = size(payload.value);
4715
+ if (n > cap && !ctx?.skipChecks && ctx?.direction !== "backward") {
4716
+ for (const [max, ch] of sizeCaps(inst._zod.def.checks)) {
4717
+ if (n > max && ch._zod.def.when(payload)) {
4718
+ const start = payload.issues.length;
4719
+ ch._zod.check(payload);
4720
+ payload.issues[start].continue = false;
4721
+ attachSchema(payload.issues, start, inst);
4722
+ return payload;
4723
+ }
4724
+ }
4725
+ }
4726
+ return parse3(payload, ctx);
4727
+ };
4728
+ }
4729
+ var arraySize = (input2) => Array.isArray(input2) ? input2.length : -1;
4730
+ var mapSize = (input2) => input2 instanceof Map ? input2.size : -1;
4731
+ var setSize = (input2) => input2 instanceof Set ? input2.size : -1;
4658
4732
  function handleArrayResult(result, final, index) {
4659
4733
  if (result.issues.length) {
4660
4734
  final.issues.push(...prefixIssues(index, result.issues));
@@ -4678,6 +4752,7 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
4678
4752
  }
4679
4753
  payload.value = memo2 ? memo2.alloc(inst, payload, Array(input2.length), ctx) : Array(input2.length);
4680
4754
  const proms = [];
4755
+ const abortEarly = ctx?.abortEarly;
4681
4756
  for (let i = 0; i < input2.length; i++) {
4682
4757
  const item = input2[i];
4683
4758
  const result = def.element._zod.run({
@@ -4688,6 +4763,8 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
4688
4763
  proms.push(result.then((result2) => handleArrayResult(result2, payload, i)));
4689
4764
  } else {
4690
4765
  handleArrayResult(result, payload, i);
4766
+ if (abortEarly && result.issues.length !== 0 && aborted(result))
4767
+ break;
4691
4768
  }
4692
4769
  }
4693
4770
  if (proms.length) {
@@ -4695,6 +4772,7 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
4695
4772
  }
4696
4773
  return payload;
4697
4774
  };
4775
+ capSize(inst, arraySize);
4698
4776
  });
4699
4777
  function handlePropertyResult(result, final, key, input2, optin, optout) {
4700
4778
  const isPresent = key in input2;
@@ -4720,7 +4798,7 @@ function handlePropertyResult(result, final, key, input2, optin, optout) {
4720
4798
  return;
4721
4799
  }
4722
4800
  if (result.value === void 0) {
4723
- if (isPresent) {
4801
+ if (isPresent || optin === "defaulted" && !isOptionalOut) {
4724
4802
  final.value[key] = void 0;
4725
4803
  }
4726
4804
  } else {
@@ -4749,14 +4827,20 @@ function normalizeDef(def) {
4749
4827
  optionalKeys: new Set(okeys)
4750
4828
  };
4751
4829
  }
4752
- function handleCatchall(proms, input2, payload, ctx, def, inst) {
4830
+ function handleCatchall(proms, input2, payload, ctx, def, inst, abortEarly) {
4753
4831
  const unrecognized = [];
4754
4832
  const keySet = def.keySet;
4755
4833
  const _catchall = def.catchall._zod;
4756
4834
  const t = _catchall.def.type;
4757
4835
  const optin = _catchall.optin;
4758
4836
  const optout = _catchall.optout;
4837
+ let seen = 0;
4759
4838
  for (const key in input2) {
4839
+ if (abortEarly && payload.issues.length !== seen) {
4840
+ if (aborted(payload, seen))
4841
+ break;
4842
+ seen = payload.issues.length;
4843
+ }
4760
4844
  if (keySet.has(key))
4761
4845
  continue;
4762
4846
  if (key === "__proto__") {
@@ -4791,23 +4875,19 @@ function handleCatchall(proms, input2, payload, ctx, def, inst) {
4791
4875
  return payload;
4792
4876
  });
4793
4877
  }
4794
- var propShapes = /* @__PURE__ */ new WeakMap();
4795
4878
  var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
4796
4879
  $ZodType.init(inst, def);
4797
4880
  const desc = Object.getOwnPropertyDescriptor(def, "shape");
4798
- if (!desc?.get) {
4799
- const sh = def.shape;
4800
- propShapes.set(def, sh);
4801
- Object.defineProperty(def, "shape", {
4802
- get: () => {
4803
- const newSh = { ...sh };
4804
- Object.defineProperty(def, "shape", {
4805
- value: newSh
4806
- });
4807
- propShapes.set(def, newSh);
4808
- return newSh;
4809
- }
4810
- });
4881
+ const sh = desc?.get ? desc.get.raw : def.shape ?? {};
4882
+ if (sh) {
4883
+ const get = () => {
4884
+ const newSh = { ...sh };
4885
+ Object.defineProperty(def, "shape", { value: newSh });
4886
+ get.raw = newSh;
4887
+ return newSh;
4888
+ };
4889
+ get.raw = sh;
4890
+ Object.defineProperty(def, "shape", { get });
4811
4891
  }
4812
4892
  const _normalized = cached2(() => normalizeDef(def));
4813
4893
  defineLazyInternal(inst, "propValues", (zod) => {
@@ -4847,7 +4927,14 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
4847
4927
  payload.value = memo2 ? memo2.alloc(inst, payload, {}, ctx) : {};
4848
4928
  const proms = [];
4849
4929
  const shape = value.shape;
4930
+ const abortEarly = ctx?.abortEarly;
4931
+ let seen = payload.issues.length;
4850
4932
  for (const key of value.allKeys) {
4933
+ if (abortEarly && payload.issues.length !== seen) {
4934
+ if (aborted(payload, seen))
4935
+ break;
4936
+ seen = payload.issues.length;
4937
+ }
4851
4938
  if (key === "__proto__")
4852
4939
  continue;
4853
4940
  const el = shape[key];
@@ -4863,7 +4950,7 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
4863
4950
  if (!catchall) {
4864
4951
  return proms.length ? Promise.all(proms).then(() => payload) : payload;
4865
4952
  }
4866
- return handleCatchall(proms, input2, payload, ctx, _normalized.value, inst);
4953
+ return handleCatchall(proms, input2, payload, ctx, _normalized.value, inst, abortEarly === true);
4867
4954
  };
4868
4955
  });
4869
4956
  var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
@@ -4877,10 +4964,16 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
4877
4964
  const doc = new Doc(["payload", "ctx"], { shape, inst, memo: memo2, syms });
4878
4965
  const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
4879
4966
  const prefixStr = (id, k) => `
4967
+ let ${id}_ab = false;
4880
4968
  for (let i = 0; i < ${id}.issues.length; i++) {
4881
4969
  const iss = ${id}.issues[i];
4882
4970
  iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
4883
4971
  payload.issues.push(iss);
4972
+ if (iss.continue !== true) ${id}_ab = true;
4973
+ }
4974
+ if (${id}_ab && ctx && ctx.abortEarly) {
4975
+ payload.value = newResult;
4976
+ return payload;
4884
4977
  }`;
4885
4978
  doc.write(`const input = payload.value;`);
4886
4979
  const ids = /* @__PURE__ */ Object.create(null);
@@ -4926,6 +5019,10 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
4926
5019
  input: undefined,
4927
5020
  path: [${k}]
4928
5021
  });
5022
+ if (ctx && ctx.abortEarly) {
5023
+ payload.value = newResult;
5024
+ return payload;
5025
+ }
4929
5026
  }
4930
5027
 
4931
5028
  if (${id}_present) {
@@ -4937,16 +5034,16 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
4937
5034
  doc.write(`
4938
5035
  if (${id}.issues.length) {${prefixStr(id, k)}
4939
5036
  }
4940
-
4941
- if (${id}.value === undefined) {
4942
- if (${isPresent}) {
4943
- newResult[${k}] = undefined;
4944
- }
5037
+ `);
5038
+ if (optin === "defaulted") {
5039
+ doc.write(`newResult[${k}] = ${id}.value;`);
4945
5040
  } else {
5041
+ doc.write(`
5042
+ if (${id}.value !== undefined || ${isPresent}) {
4946
5043
  newResult[${k}] = ${id}.value;
4947
5044
  }
4948
-
4949
5045
  `);
5046
+ }
4950
5047
  }
4951
5048
  }
4952
5049
  doc.write(`payload.value = newResult;`);
@@ -4978,7 +5075,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
4978
5075
  payload = fastpass(payload, ctx);
4979
5076
  if (!catchall)
4980
5077
  return payload;
4981
- return handleCatchall([], input2, payload, ctx, value, inst);
5078
+ return handleCatchall([], input2, payload, ctx, value, inst, ctx?.abortEarly === true);
4982
5079
  }
4983
5080
  return superParse(payload, ctx);
4984
5081
  };
@@ -5110,16 +5207,31 @@ function getDiscriminatedOption(union2, value) {
5110
5207
  const internals = union2._zod;
5111
5208
  let map2 = internals.bag.optionsMap;
5112
5209
  if (!map2) {
5113
- map2 = /* @__PURE__ */ new Map();
5114
- const { options, discriminator } = internals.def;
5115
- for (const option of options) {
5116
- for (const v of option._zod.propValues?.[discriminator] ?? [])
5117
- if (!map2.has(v))
5118
- map2.set(v, option);
5119
- }
5210
+ map2 = discriminatorMap(internals.def);
5120
5211
  internals.bag.optionsMap = map2;
5121
5212
  }
5122
- return map2.get(value);
5213
+ const option = map2.get(value);
5214
+ if (option === null)
5215
+ throw new Error(`Ambiguous discriminator value "${String(value)}"`);
5216
+ return option;
5217
+ }
5218
+ function discriminatorMap(def) {
5219
+ const map2 = /* @__PURE__ */ new Map();
5220
+ for (const option of def.options) {
5221
+ const values = option._zod.propValues?.[def.discriminator];
5222
+ if (!values || values.size === 0)
5223
+ throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
5224
+ for (const value of values) {
5225
+ if (map2.has(value)) {
5226
+ if (value !== void 0)
5227
+ throw new Error(`Duplicate discriminator value "${String(value)}"`);
5228
+ map2.set(value, null);
5229
+ } else {
5230
+ map2.set(value, option);
5231
+ }
5232
+ }
5233
+ }
5234
+ return map2;
5123
5235
  }
5124
5236
  var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
5125
5237
  def.inclusive = false;
@@ -5127,10 +5239,13 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
5127
5239
  const _super = inst._zod.parse;
5128
5240
  defineLazyInternal(inst, "propValues", (zod) => {
5129
5241
  const propValues = {};
5242
+ let undefinedCount = 0;
5130
5243
  for (const option of zod.def.options) {
5131
5244
  const pv = option._zod.propValues;
5132
5245
  if (!pv || Object.keys(pv).length === 0)
5133
5246
  throw new Error(`Invalid discriminated union option at index "${zod.def.options.indexOf(option)}"`);
5247
+ if (pv[zod.def.discriminator]?.has(void 0))
5248
+ undefinedCount++;
5134
5249
  for (const [k, v] of Object.entries(pv)) {
5135
5250
  if (!Object.prototype.hasOwnProperty.call(propValues, k)) {
5136
5251
  assignProp(propValues, k, /* @__PURE__ */ new Set());
@@ -5140,30 +5255,17 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
5140
5255
  }
5141
5256
  }
5142
5257
  }
5258
+ if (!zod.def.unionFallback && undefinedCount > 1)
5259
+ propValues[zod.def.discriminator]?.delete(void 0);
5143
5260
  return propValues;
5144
5261
  });
5145
5262
  def.options.forEach((option, i) => {
5146
- const propShape = propShapes.get(option._zod.def);
5263
+ const propShape = rawShape(option._zod.def);
5147
5264
  if (propShape && !Object.prototype.hasOwnProperty.call(propShape, def.discriminator)) {
5148
5265
  throw new Error(`Invalid discriminated union option at index "${i}"`);
5149
5266
  }
5150
5267
  });
5151
- const disc = cached2(() => {
5152
- const opts = def.options;
5153
- const map2 = /* @__PURE__ */ new Map();
5154
- for (const o of opts) {
5155
- const values = o._zod.propValues?.[def.discriminator];
5156
- if (!values || values.size === 0)
5157
- throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
5158
- for (const v of values) {
5159
- if (map2.has(v)) {
5160
- throw new Error(`Duplicate discriminator value "${String(v)}"`);
5161
- }
5162
- map2.set(v, o);
5163
- }
5164
- }
5165
- return map2;
5166
- });
5268
+ const disc = cached2(() => discriminatorMap(def));
5167
5269
  inst._zod.parse = (payload, ctx) => {
5168
5270
  const input2 = payload.value;
5169
5271
  if (!isObject(input2)) {
@@ -5175,8 +5277,9 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
5175
5277
  });
5176
5278
  return payload;
5177
5279
  }
5178
- const opt = disc.value.get(input2?.[def.discriminator]);
5179
- if (opt) {
5280
+ const value = input2?.[def.discriminator];
5281
+ const opt = disc.value.get(value);
5282
+ if (opt && (value !== void 0 || ctx.direction !== "backward")) {
5180
5283
  return opt._zod.run(payload, ctx);
5181
5284
  }
5182
5285
  if (def.unionFallback || ctx.direction === "backward") {
@@ -5187,7 +5290,7 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
5187
5290
  errors: [],
5188
5291
  note: "No matching discriminator",
5189
5292
  discriminator: def.discriminator,
5190
- options: Array.from(disc.value.keys()),
5293
+ options: Array.from(disc.value.keys()).filter((value2) => disc.value.get(value2) !== null),
5191
5294
  input: input2,
5192
5295
  path: [def.discriminator],
5193
5296
  inst
@@ -5353,6 +5456,8 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
5353
5456
  }
5354
5457
  }
5355
5458
  const itemResults = new Array(items.length);
5459
+ const abortEarly = def.rest ? ctx?.abortEarly : void 0;
5460
+ let itemAborted = false;
5356
5461
  for (let i = 0; i < items.length; i++) {
5357
5462
  const r = items[i]._zod.run({ value: input2[i], issues: [] }, ctx);
5358
5463
  if (r instanceof Promise) {
@@ -5361,12 +5466,20 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
5361
5466
  }));
5362
5467
  } else {
5363
5468
  itemResults[i] = r;
5469
+ if (abortEarly && !itemAborted && r.issues.length)
5470
+ itemAborted = aborted(r);
5364
5471
  }
5365
5472
  }
5366
- if (def.rest) {
5473
+ if (def.rest && !itemAborted) {
5367
5474
  let i = items.length - 1;
5368
5475
  const rest = input2.slice(items.length);
5476
+ let seen = payload.issues.length;
5369
5477
  for (const el of rest) {
5478
+ if (abortEarly && payload.issues.length !== seen) {
5479
+ if (aborted(payload, seen))
5480
+ break;
5481
+ seen = payload.issues.length;
5482
+ }
5370
5483
  i++;
5371
5484
  const result = def.rest._zod.run({ value: el, issues: [] }, ctx);
5372
5485
  if (result instanceof Promise) {
@@ -5594,7 +5707,14 @@ var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
5594
5707
  }
5595
5708
  const proms = [];
5596
5709
  payload.value = memo2 ? memo2.alloc(inst, payload, /* @__PURE__ */ new Map(), ctx) : /* @__PURE__ */ new Map();
5710
+ const abortEarly = ctx?.abortEarly;
5711
+ let seen = payload.issues.length;
5597
5712
  for (const [key, value] of input2) {
5713
+ if (abortEarly && payload.issues.length !== seen) {
5714
+ if (aborted(payload, seen))
5715
+ break;
5716
+ seen = payload.issues.length;
5717
+ }
5598
5718
  const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
5599
5719
  const valueResult = def.valueType._zod.run({ value, issues: [] }, ctx);
5600
5720
  if (keyResult instanceof Promise || valueResult instanceof Promise) {
@@ -5609,6 +5729,7 @@ var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
5609
5729
  return Promise.all(proms).then(() => payload);
5610
5730
  return payload;
5611
5731
  };
5732
+ capSize(inst, mapSize);
5612
5733
  });
5613
5734
  function handleMapResult(keyResult, valueResult, final, key, input2, inst, ctx) {
5614
5735
  if (keyResult.issues.length) {
@@ -5657,7 +5778,14 @@ var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
5657
5778
  }
5658
5779
  const proms = [];
5659
5780
  payload.value = memo2 ? memo2.alloc(inst, payload, /* @__PURE__ */ new Set(), ctx) : /* @__PURE__ */ new Set();
5781
+ const abortEarly = ctx?.abortEarly;
5782
+ let seen = payload.issues.length;
5660
5783
  for (const item of input2) {
5784
+ if (abortEarly && payload.issues.length !== seen) {
5785
+ if (aborted(payload, seen))
5786
+ break;
5787
+ seen = payload.issues.length;
5788
+ }
5661
5789
  const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
5662
5790
  if (result instanceof Promise) {
5663
5791
  proms.push(result.then((result2) => handleSetResult(result2, payload)));
@@ -5668,6 +5796,7 @@ var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
5668
5796
  return Promise.all(proms).then(() => payload);
5669
5797
  return payload;
5670
5798
  };
5799
+ capSize(inst, setSize);
5671
5800
  });
5672
5801
  function handleSetResult(result, final) {
5673
5802
  if (result.issues.length) {
@@ -5680,8 +5809,10 @@ var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
5680
5809
  const values = getEnumValues(def.entries);
5681
5810
  const valuesSet = new Set(values);
5682
5811
  inst._zod.values = valuesSet;
5683
- const patternValues = values.filter((k) => propertyKeyTypes.has(typeof k));
5684
- inst._zod.pattern = new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
5812
+ defineLazyInternal(inst, "pattern", (zod) => {
5813
+ const patternValues = getEnumValues(zod.def.entries).filter((k) => propertyKeyTypes.has(typeof k));
5814
+ return new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
5815
+ });
5685
5816
  inst._zod.parse = (payload, _ctx) => {
5686
5817
  const input2 = payload.value;
5687
5818
  if (valuesSet.has(input2)) {
@@ -5700,7 +5831,10 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
5700
5831
  $ZodType.init(inst, def);
5701
5832
  const values = new Set(def.values);
5702
5833
  inst._zod.values = values;
5703
- 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]$");
5834
+ defineLazyInternal(inst, "pattern", (zod) => {
5835
+ const vals = zod.def.values;
5836
+ return new RegExp(vals.length ? `^(${vals.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$` : "^[^\\s\\S]$");
5837
+ });
5704
5838
  inst._zod.parse = (payload, _ctx) => {
5705
5839
  const input2 = payload.value;
5706
5840
  if (values.has(input2)) {
@@ -6038,20 +6172,62 @@ function handleReadonlyResult(payload) {
6038
6172
  payload.value = Object.freeze(payload.value);
6039
6173
  return payload;
6040
6174
  }
6175
+ function leafPattern(schema) {
6176
+ const def = schema._zod.def;
6177
+ let pattern = def.pattern;
6178
+ let isInt = !!def.format?.includes("int");
6179
+ let minimum;
6180
+ let maximum;
6181
+ for (const ch of def.checks ?? []) {
6182
+ const d = ch._zod.def;
6183
+ if (d.pattern)
6184
+ pattern = d.pattern;
6185
+ isInt || (isInt = !!d.format?.includes("int"));
6186
+ const lo = d.minimum ?? d.length;
6187
+ const hi = d.maximum ?? d.length;
6188
+ if (lo !== void 0 && (minimum === void 0 || lo > minimum))
6189
+ minimum = lo;
6190
+ if (hi !== void 0 && (maximum === void 0 || hi < maximum))
6191
+ maximum = hi;
6192
+ }
6193
+ if (pattern)
6194
+ return pattern.source;
6195
+ if (minimum !== void 0 && maximum !== void 0 && minimum > maximum)
6196
+ return "(?!)";
6197
+ if (minimum !== void 0 || maximum !== void 0)
6198
+ return string({ minimum, maximum }).source;
6199
+ const own2 = schema._zod.pattern;
6200
+ return (isInt && own2 === number ? integer : own2)?.source;
6201
+ }
6202
+ function partPattern(schema) {
6203
+ const def = schema._zod.def;
6204
+ const own2 = schema._zod.pattern?.source;
6205
+ const inner = def.innerType ?? schema._zod.innerType;
6206
+ if (inner) {
6207
+ const before = inner._zod.pattern?.source;
6208
+ const after = partPattern(inner);
6209
+ if (own2 && before && after && after !== before) {
6210
+ return own2.replace(cleanRegex(before), () => cleanRegex(after));
6211
+ }
6212
+ return own2;
6213
+ }
6214
+ if (def.options) {
6215
+ const sources = def.options.map(partPattern);
6216
+ if (sources.every(Boolean))
6217
+ return `^(${sources.map((s) => cleanRegex(s)).join("|")})$`;
6218
+ }
6219
+ return leafPattern(schema);
6220
+ }
6041
6221
  var $ZodTemplateLiteral = /* @__PURE__ */ $constructor("$ZodTemplateLiteral", (inst, def) => {
6042
6222
  $ZodType.init(inst, def);
6043
6223
  const regexParts = [];
6044
6224
  for (const part of def.parts) {
6045
6225
  if (typeof part === "object" && part !== null) {
6046
- if (!part._zod.pattern) {
6226
+ const source = partPattern(part);
6227
+ if (!source) {
6047
6228
  throw new Error(`Invalid template literal part, no pattern found: ${[...part._zod.traits].shift()}`);
6048
6229
  }
6049
- const source = part._zod.pattern instanceof RegExp ? part._zod.pattern.source : part._zod.pattern;
6050
- if (!source)
6051
- throw new Error(`Invalid template literal part: ${part._zod.traits}`);
6052
- const start = source.startsWith("^") ? 1 : 0;
6053
- const end = source.endsWith("$") ? source.length - 1 : source.length;
6054
- regexParts.push(source.slice(start, end));
6230
+ regexParts.push(cleanRegex(source));
6055
6231
  } else if (part === null || primitiveTypes.has(typeof part)) {
6056
6232
  regexParts.push(escapeRegex(`${part}`));
6057
6233
  } else {
@@ -6226,28 +6402,53 @@ var $ZodCyclicError = class extends Error {
6226
6402
  };
6227
6403
  var STATE = "~memo";
6228
6404
  var NO_ISSUES = [];
6405
+ function isRef(value) {
6406
+ return value !== null && typeof value === "object";
6407
+ }
6229
6408
  function cloneIssues(issues) {
6230
6409
  return issues.map((iss) => iss.path ? { ...iss, path: iss.path.slice() } : { ...iss });
6231
6410
  }
6232
6411
  var recursive = /* @__PURE__ */ new WeakMap();
6233
- function isRecursive(inst, stack) {
6412
+ var NONE = 0;
6413
+ var ASSUMED = 1;
6414
+ var PROVEN = 2;
6415
+ function isRecursive(inst, stack, resolve3) {
6234
6416
  const cached3 = recursive.get(inst);
6235
6417
  if (cached3 !== void 0)
6236
- return cached3;
6418
+ return cached3 ? PROVEN : NONE;
6237
6419
  if (stack.has(inst))
6238
- return true;
6420
+ return PROVEN;
6239
6421
  stack.add(inst);
6240
- let result = false;
6422
+ let result = NONE;
6241
6423
  const check2 = (child) => {
6242
- if (!result && child?._zod && isRecursive(child, stack))
6243
- result = true;
6424
+ if (result !== PROVEN && child?._zod) {
6425
+ const answer = isRecursive(child, stack, resolve3);
6426
+ if (answer > result)
6427
+ result = answer;
6428
+ }
6429
+ };
6430
+ const shape = (sh, spread) => {
6431
+ let answer = NONE;
6432
+ for (const key of Reflect.ownKeys(sh)) {
6433
+ const desc = Object.getOwnPropertyDescriptor(sh, key);
6434
+ if (spread && !desc.enumerable)
6435
+ continue;
6436
+ const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve3) : NONE;
6437
+ if (child > answer)
6438
+ answer = child;
6439
+ }
6440
+ return answer;
6441
+ };
6442
+ const merge2 = (answer) => {
6443
+ if (answer > result)
6444
+ result = answer;
6244
6445
  };
6245
6446
  const def = inst._zod.def;
6246
6447
  const kind = def.type;
6247
6448
  switch (kind) {
6248
6449
  case "object": {
6249
- for (const key of Reflect.ownKeys(def.shape))
6250
- check2(def.shape[key]);
6450
+ const raw = rawShape(def);
6451
+ merge2(raw ? shape(raw, true) : ASSUMED);
6251
6452
  check2(def.catchall);
6252
6453
  break;
6253
6454
  }
@@ -6294,10 +6495,12 @@ function isRecursive(inst, stack) {
6294
6495
  check2(def.input);
6295
6496
  check2(def.output);
6296
6497
  break;
6297
- // reading `_zod.innerType` resolves the getter once and caches it
6298
- case "lazy":
6299
- check2(inst._zod.innerType);
6498
+ // `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
6499
+ case "lazy": {
6500
+ const inner = def._cachedInner ?? (resolve3 ? inst._zod.innerType : void 0);
6501
+ merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
6300
6502
  break;
6503
+ }
6301
6504
  // a leaf by choice: `parts` are regex fragments, not data positions
6302
6505
  case "template_literal":
6303
6506
  // leaves
@@ -6339,16 +6542,20 @@ function isRecursive(inst, stack) {
6339
6542
  }
6340
6543
  }
6341
6544
  stack.delete(inst);
6342
- recursive.set(inst, result);
6343
- return result;
6545
+ return settle(inst, result);
6546
+ }
6547
+ function settle(inst, answer) {
6548
+ if (answer !== ASSUMED)
6549
+ recursive.set(inst, answer === PROVEN);
6550
+ return answer;
6344
6551
  }
6345
6552
  function isRecursiveSchema(inst) {
6346
- return isRecursive(inst, /* @__PURE__ */ new Set());
6553
+ return isRecursive(inst, /* @__PURE__ */ new Set(), true) !== NONE;
6347
6554
  }
6348
6555
  function bucketFor(state, inst) {
6349
6556
  let bucket = state.buckets.get(inst);
6350
6557
  if (!bucket) {
6351
- bucket = /* @__PURE__ */ new Map();
6558
+ bucket = /* @__PURE__ */ new WeakMap();
6352
6559
  state.buckets.set(inst, bucket);
6353
6560
  }
6354
6561
  return bucket;
@@ -6384,6 +6591,7 @@ var memo = {
6384
6591
  attach(inst) {
6385
6592
  var _a3;
6386
6593
  let isRecursiveInst;
6594
+ let rechecked = false;
6387
6595
  let lastCtx;
6388
6596
  let lastBucket;
6389
6597
  (_a3 = inst._zod).deferred ?? (_a3.deferred = []);
@@ -6391,20 +6599,24 @@ var memo = {
6391
6599
  const base = inst._zod.parse;
6392
6600
  const wrapped = (payload, ctx) => {
6393
6601
  if (isRecursiveInst === void 0) {
6394
- isRecursiveInst = isRecursive(inst, /* @__PURE__ */ new Set());
6395
- if (!isRecursiveInst) {
6602
+ const walked = isRecursive(inst, /* @__PURE__ */ new Set(), false);
6603
+ if (walked === NONE) {
6396
6604
  inst._zod.parse = base;
6397
6605
  if (inst._zod.run === wrapped)
6398
6606
  inst._zod.run = base;
6399
6607
  return base(payload, ctx);
6400
6608
  }
6609
+ if (walked === PROVEN || rechecked)
6610
+ isRecursiveInst = true;
6611
+ else
6612
+ rechecked = true;
6401
6613
  }
6402
6614
  const input2 = payload.value;
6403
- if (input2 === null || typeof input2 !== "object")
6615
+ if (!isRef(input2))
6404
6616
  return base(payload, ctx);
6405
6617
  let state = ctx[STATE];
6406
6618
  if (!state) {
6407
- state = { buckets: /* @__PURE__ */ new Map(), backEdges: void 0 };
6619
+ state = { buckets: /* @__PURE__ */ new WeakMap(), backEdges: void 0 };
6408
6620
  ctx[STATE] = state;
6409
6621
  }
6410
6622
  let bucket;
@@ -6423,7 +6635,7 @@ var memo = {
6423
6635
  payload.issues.push(...cloneIssues(hit.issues));
6424
6636
  } else {
6425
6637
  payload.memo = true;
6426
- state.backEdges ?? (state.backEdges = /* @__PURE__ */ new Set());
6638
+ state.backEdges ?? (state.backEdges = /* @__PURE__ */ new WeakSet());
6427
6639
  state.backEdges.add(hit.value);
6428
6640
  }
6429
6641
  return payload;
@@ -6455,7 +6667,7 @@ function memoizer() {
6455
6667
  }
6456
6668
  function isBackEdge(ctx, value) {
6457
6669
  const backEdges = ctx[STATE]?.backEdges;
6458
- return backEdges !== void 0 && value !== null && typeof value === "object" && backEdges.has(value);
6670
+ return backEdges !== void 0 && isRef(value) && backEdges.has(value);
6459
6671
  }
6460
6672
 
6461
6673
  // node_modules/zod/v4/locales/index.js
@@ -6512,6 +6724,7 @@ __export(locales_exports, {
6512
6724
  sl: () => sl_default,
6513
6725
  sv: () => sv_default,
6514
6726
  ta: () => ta_default,
6727
+ tg: () => tg_default,
6515
6728
  th: () => th_default,
6516
6729
  tk: () => tk_default,
6517
6730
  tr: () => tr_default,
@@ -6566,6 +6779,8 @@ var error = () => {
6566
6779
  json_string: "\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",
6567
6780
  e164: "\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",
6568
6781
  credit_card: "\u0631\u0642\u0645 \u0628\u0637\u0627\u0642\u0629 \u0627\u0644\u0627\u0626\u062A\u0645\u0627\u0646",
6782
+ currency_code: "\u0631\u0645\u0632 \u0627\u0644\u0639\u0645\u0644\u0629",
6783
+ iban: "IBAN",
6569
6784
  jwt: "JWT",
6570
6785
  template_literal: "\u0645\u062F\u062E\u0644"
6571
6786
  };
@@ -6676,6 +6891,8 @@ var error2 = () => {
6676
6891
  json_string: "JSON string",
6677
6892
  e164: "E.164 number",
6678
6893
  credit_card: "kredit kart\u0131 n\xF6mr\u0259si",
6894
+ currency_code: "valyuta kodu",
6895
+ iban: "IBAN",
6679
6896
  jwt: "JWT",
6680
6897
  template_literal: "input"
6681
6898
  };
@@ -6835,6 +7052,8 @@ var error3 = () => {
6835
7052
  json_string: "JSON \u0440\u0430\u0434\u043E\u043A",
6836
7053
  e164: "\u043D\u0443\u043C\u0430\u0440 E.164",
6837
7054
  credit_card: "\u043D\u0443\u043C\u0430\u0440 \u043A\u0440\u044D\u0434\u044B\u0442\u043D\u0430\u0439 \u043A\u0430\u0440\u0442\u044B",
7055
+ currency_code: "\u043A\u043E\u0434 \u0432\u0430\u043B\u044E\u0442\u044B",
7056
+ iban: "IBAN",
6838
7057
  jwt: "JWT",
6839
7058
  template_literal: "\u0443\u0432\u043E\u0434"
6840
7059
  };
@@ -6952,6 +7171,8 @@ var error4 = () => {
6952
7171
  json_string: "JSON \u043D\u0438\u0437",
6953
7172
  e164: "E.164 \u043D\u043E\u043C\u0435\u0440",
6954
7173
  credit_card: "\u043D\u043E\u043C\u0435\u0440 \u043D\u0430 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u0430 \u043A\u0430\u0440\u0442\u0430",
7174
+ currency_code: "\u043A\u043E\u0434 \u043D\u0430 \u0432\u0430\u043B\u0443\u0442\u0430",
7175
+ iban: "IBAN",
6955
7176
  jwt: "JWT",
6956
7177
  template_literal: "\u0432\u0445\u043E\u0434"
6957
7178
  };
@@ -7076,6 +7297,8 @@ var error5 = () => {
7076
7297
  json_string: "JSON \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982",
7077
7298
  e164: "E.164 \u09A8\u09AE\u09CD\u09AC\u09B0",
7078
7299
  credit_card: "\u0995\u09CD\u09B0\u09C7\u09A1\u09BF\u099F \u0995\u09BE\u09B0\u09CD\u09A1 \u09A8\u09AE\u09CD\u09AC\u09B0",
7300
+ currency_code: "\u09AE\u09C1\u09A6\u09CD\u09B0\u09BE \u0995\u09CB\u09A1",
7301
+ iban: "IBAN",
7079
7302
  jwt: "JWT",
7080
7303
  template_literal: "\u0987\u09A8\u09AA\u09C1\u099F"
7081
7304
  };
@@ -7188,6 +7411,8 @@ var error6 = () => {
7188
7411
  json_string: "cadena JSON",
7189
7412
  e164: "n\xFAmero E.164",
7190
7413
  credit_card: "n\xFAmero de targeta de cr\xE8dit",
7414
+ currency_code: "codi de moneda",
7415
+ iban: "IBAN",
7191
7416
  jwt: "JWT",
7192
7417
  template_literal: "entrada"
7193
7418
  };
@@ -7300,6 +7525,8 @@ var error7 = () => {
7300
7525
  json_string: "\u062F\u06D5\u0642\u06CC JSON",
7301
7526
  e164: "\u0698\u0645\u0627\u0631\u06D5\u06CC E.164",
7302
7527
  credit_card: "\u0698\u0645\u0627\u0631\u06D5\u06CC \u06A9\u0627\u0631\u062A\u06CC \u06A9\u0631\u06CE\u062F\u06CC\u062A",
7528
+ currency_code: "\u06A9\u06C6\u062F\u06CC \u062F\u0631\u0627\u0648",
7529
+ iban: "IBAN",
7303
7530
  jwt: "JWT",
7304
7531
  template_literal: "\u062A\u06CE\u06A9\u0631\u062F\u06D5"
7305
7532
  };
@@ -7431,6 +7658,8 @@ var error8 = () => {
7431
7658
  json_string: "\u0159et\u011Bzec ve form\xE1tu JSON",
7432
7659
  e164: "\u010D\xEDslo E.164",
7433
7660
  credit_card: "\u010D\xEDslo kreditn\xED karty",
7661
+ currency_code: "k\xF3d m\u011Bny",
7662
+ iban: "IBAN",
7434
7663
  jwt: "JWT",
7435
7664
  template_literal: "vstup"
7436
7665
  };
@@ -7546,6 +7775,8 @@ var error9 = () => {
7546
7775
  json_string: "JSON-streng",
7547
7776
  e164: "E.164-nummer",
7548
7777
  credit_card: "kreditkortnummer",
7778
+ currency_code: "valutakode",
7779
+ iban: "IBAN",
7549
7780
  jwt: "JWT",
7550
7781
  template_literal: "input"
7551
7782
  };
@@ -7665,6 +7896,8 @@ var error10 = () => {
7665
7896
  json_string: "JSON-String",
7666
7897
  e164: "E.164-Nummer",
7667
7898
  credit_card: "Kreditkartennummer",
7899
+ currency_code: "W\xE4hrungscode",
7900
+ iban: "IBAN",
7668
7901
  jwt: "JWT",
7669
7902
  template_literal: "Eingabe"
7670
7903
  };
@@ -7777,6 +8010,8 @@ var error11 = () => {
7777
8010
  json_string: "\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC JSON",
7778
8011
  e164: "\u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2 E.164",
7779
8012
  credit_card: "\u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2 \u03C0\u03B9\u03C3\u03C4\u03C9\u03C4\u03B9\u03BA\u03AE\u03C2 \u03BA\u03AC\u03C1\u03C4\u03B1\u03C2",
8013
+ currency_code: "\u03BA\u03C9\u03B4\u03B9\u03BA\u03CC\u03C2 \u03BD\u03BF\u03BC\u03AF\u03C3\u03BC\u03B1\u03C4\u03BF\u03C2",
8014
+ iban: "IBAN",
7780
8015
  jwt: "JWT",
7781
8016
  template_literal: "\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"
7782
8017
  };
@@ -7887,7 +8122,9 @@ var error12 = () => {
7887
8122
  base64url: "base64url-encoded string",
7888
8123
  json_string: "JSON string",
7889
8124
  e164: "E.164 number",
8125
+ currency_code: "currency code",
7890
8126
  credit_card: "credit card number",
8127
+ iban: "IBAN",
7891
8128
  jwt: "JWT",
7892
8129
  template_literal: "input"
7893
8130
  };
@@ -8011,6 +8248,8 @@ var error13 = () => {
8011
8248
  json_string: "JSON-karaktraro",
8012
8249
  e164: "E.164-nombro",
8013
8250
  credit_card: "kreditkarta numero",
8251
+ currency_code: "valuta kodo",
8252
+ iban: "IBAN",
8014
8253
  jwt: "JWT",
8015
8254
  template_literal: "enigo"
8016
8255
  };
@@ -8123,6 +8362,8 @@ var error14 = () => {
8123
8362
  json_string: "cadena JSON",
8124
8363
  e164: "n\xFAmero E.164",
8125
8364
  credit_card: "n\xFAmero de tarjeta de cr\xE9dito",
8365
+ currency_code: "c\xF3digo de moneda",
8366
+ iban: "IBAN",
8126
8367
  jwt: "JWT",
8127
8368
  template_literal: "entrada"
8128
8369
  };
@@ -8259,6 +8500,8 @@ var error15 = () => {
8259
8500
  json_string: "JSON \u0631\u0634\u062A\u0647",
8260
8501
  e164: "E.164 \u0639\u062F\u062F",
8261
8502
  credit_card: "\u0634\u0645\u0627\u0631\u0647 \u06A9\u0627\u0631\u062A \u0627\u0639\u062A\u0628\u0627\u0631\u06CC",
8503
+ currency_code: "\u06A9\u062F \u0627\u0631\u0632",
8504
+ iban: "IBAN",
8262
8505
  jwt: "JWT",
8263
8506
  template_literal: "\u0648\u0631\u0648\u062F\u06CC"
8264
8507
  };
@@ -8381,6 +8624,8 @@ var error16 = () => {
8381
8624
  json_string: "JSON-merkkijono",
8382
8625
  e164: "E.164-luku",
8383
8626
  credit_card: "luottokortin numero",
8627
+ currency_code: "valuuttakoodi",
8628
+ iban: "IBAN",
8384
8629
  jwt: "JWT",
8385
8630
  template_literal: "templaattimerkkijono"
8386
8631
  };
@@ -8492,6 +8737,8 @@ var error17 = () => {
8492
8737
  json_string: "cha\xEEne de caract\xE8res JSON",
8493
8738
  e164: "num\xE9ro au format E.164",
8494
8739
  credit_card: "num\xE9ro de carte de cr\xE9dit",
8740
+ currency_code: "code de devise",
8741
+ iban: "IBAN",
8495
8742
  jwt: "JWT",
8496
8743
  template_literal: "entr\xE9e"
8497
8744
  };
@@ -8621,6 +8868,8 @@ var error18 = () => {
8621
8868
  json_string: "cha\xEEne JSON",
8622
8869
  e164: "num\xE9ro E.164",
8623
8870
  credit_card: "num\xE9ro de carte de cr\xE9dit",
8871
+ currency_code: "code de devise",
8872
+ iban: "IBAN",
8624
8873
  jwt: "JWT",
8625
8874
  template_literal: "entr\xE9e"
8626
8875
  };
@@ -8732,6 +8981,8 @@ var error19 = () => {
8732
8981
  json_string: "JSON \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97",
8733
8982
  e164: "E.164 \u0AA8\u0A82\u0AAC\u0AB0",
8734
8983
  credit_card: "\u0A95\u0ACD\u0AB0\u0AC7\u0AA1\u0ABF\u0A9F \u0A95\u0ABE\u0AB0\u0ACD\u0AA1 \u0AA8\u0A82\u0AAC\u0AB0",
8984
+ currency_code: "\u0A9A\u0AB2\u0AA3 \u0A95\u0ACB\u0AA1",
8985
+ iban: "IBAN",
8735
8986
  jwt: "JWT",
8736
8987
  template_literal: "\u0A87\u0AA8\u0AAA\u0AC1\u0A9F"
8737
8988
  };
@@ -8880,6 +9131,8 @@ var error20 = () => {
8880
9131
  json_string: { label: "\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON", gender: "f" },
8881
9132
  e164: { label: "\u05DE\u05E1\u05E4\u05E8 E.164", gender: "m" },
8882
9133
  credit_card: { label: "\u05DE\u05E1\u05E4\u05E8 \u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9", gender: "m" },
9134
+ currency_code: { label: "\u05E7\u05D5\u05D3 \u05DE\u05D8\u05D1\u05E2", gender: "m" },
9135
+ iban: { label: "IBAN", gender: "m" },
8883
9136
  jwt: { label: "JWT", gender: "m" },
8884
9137
  template_literal: { label: "\u05E7\u05DC\u05D8", gender: "m" },
8885
9138
  ends_with: { label: "\u05E7\u05DC\u05D8", gender: "m" },
@@ -9044,6 +9297,8 @@ var error21 = () => {
9044
9297
  json_string: "JSON \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917",
9045
9298
  e164: "E.164 \u0938\u0902\u0916\u094D\u092F\u093E",
9046
9299
  credit_card: "\u0915\u094D\u0930\u0947\u0921\u093F\u091F \u0915\u093E\u0930\u094D\u0921 \u0938\u0902\u0916\u094D\u092F\u093E",
9300
+ currency_code: "\u092E\u0941\u0926\u094D\u0930\u093E \u0915\u094B\u0921",
9301
+ iban: "IBAN",
9047
9302
  jwt: "JWT",
9048
9303
  template_literal: "\u0907\u0928\u092A\u0941\u091F"
9049
9304
  };
@@ -9153,6 +9408,8 @@ var error22 = () => {
9153
9408
  json_string: "JSON tekst",
9154
9409
  e164: "E.164 broj",
9155
9410
  credit_card: "broj kreditne kartice",
9411
+ currency_code: "kod valute",
9412
+ iban: "IBAN",
9156
9413
  jwt: "JWT",
9157
9414
  template_literal: "unos"
9158
9415
  };
@@ -9279,6 +9536,8 @@ var error23 = () => {
9279
9536
  json_string: "JSON string",
9280
9537
  e164: "E.164 sz\xE1m",
9281
9538
  credit_card: "hitelk\xE1rtyasz\xE1m",
9539
+ currency_code: "p\xE9nznemk\xF3d",
9540
+ iban: "IBAN",
9282
9541
  jwt: "JWT",
9283
9542
  template_literal: "bemenet"
9284
9543
  };
@@ -9431,6 +9690,8 @@ var error24 = () => {
9431
9690
  json_string: "JSON \u057F\u0578\u0572",
9432
9691
  e164: "E.164 \u0570\u0561\u0574\u0561\u0580",
9433
9692
  credit_card: "\u056F\u0580\u0565\u0564\u056B\u057F \u0584\u0561\u0580\u057F\u056B \u0570\u0561\u0574\u0561\u0580",
9693
+ currency_code: "\u0561\u0580\u056A\u0578\u0582\u0575\u0569\u056B \u056F\u0578\u0564",
9694
+ iban: "IBAN",
9434
9695
  jwt: "JWT",
9435
9696
  template_literal: "\u0574\u0578\u0582\u057F\u0584"
9436
9697
  };
@@ -9548,6 +9809,8 @@ var error25 = () => {
9548
9809
  json_string: "string JSON",
9549
9810
  e164: "angka E.164",
9550
9811
  credit_card: "nomor kartu kredit",
9812
+ currency_code: "kode mata uang",
9813
+ iban: "IBAN",
9551
9814
  jwt: "JWT",
9552
9815
  template_literal: "input"
9553
9816
  };
@@ -9658,6 +9921,8 @@ var error26 = () => {
9658
9921
  json_string: "JSON strengur",
9659
9922
  e164: "E.164 t\xF6lugildi",
9660
9923
  credit_card: "kreditkortan\xFAmer",
9924
+ currency_code: "gjaldmi\xF0ilsk\xF3\xF0i",
9925
+ iban: "IBAN",
9661
9926
  jwt: "JWT",
9662
9927
  template_literal: "gildi"
9663
9928
  };
@@ -9771,6 +10036,8 @@ var error27 = () => {
9771
10036
  json_string: "stringa JSON",
9772
10037
  e164: "numero E.164",
9773
10038
  credit_card: "numero di carta di credito",
10039
+ currency_code: "codice valuta",
10040
+ iban: "IBAN",
9774
10041
  jwt: "JWT",
9775
10042
  template_literal: "input"
9776
10043
  };
@@ -9883,6 +10150,8 @@ var error28 = () => {
9883
10150
  json_string: "JSON\u6587\u5B57\u5217",
9884
10151
  e164: "E.164\u756A\u53F7",
9885
10152
  credit_card: "\u30AF\u30EC\u30B8\u30C3\u30C8\u30AB\u30FC\u30C9\u756A\u53F7",
10153
+ currency_code: "\u901A\u8CA8\u30B3\u30FC\u30C9",
10154
+ iban: "IBAN",
9886
10155
  jwt: "JWT",
9887
10156
  template_literal: "\u5165\u529B\u5024"
9888
10157
  };
@@ -9994,6 +10263,8 @@ var error29 = () => {
9994
10263
  json_string: "JSON \u10D5\u10D4\u10DA\u10D8",
9995
10264
  e164: "E.164 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",
9996
10265
  credit_card: "\u10E1\u10D0\u10D9\u10E0\u10D4\u10D3\u10D8\u10E2\u10DD \u10D1\u10D0\u10E0\u10D0\u10D7\u10D8\u10E1 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",
10266
+ currency_code: "\u10D5\u10D0\u10DA\u10E3\u10E2\u10D8\u10E1 \u10D9\u10DD\u10D3\u10D8",
10267
+ iban: "IBAN",
9997
10268
  jwt: "JWT",
9998
10269
  template_literal: "\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"
9999
10270
  };
@@ -10110,6 +10381,8 @@ var error30 = () => {
10110
10381
  json_string: "\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",
10111
10382
  e164: "\u179B\u17C1\u1781 E.164",
10112
10383
  credit_card: "\u179B\u17C1\u1781\u1794\u17D0\u178E\u17D2\u178E\u17A5\u178E\u1791\u17B6\u1793",
10384
+ currency_code: "\u1780\u17BC\u178A\u179A\u17BC\u1794\u17B7\u1799\u1794\u17D0\u178E\u17D2\u178E",
10385
+ iban: "IBAN",
10113
10386
  jwt: "JWT",
10114
10387
  template_literal: "\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"
10115
10388
  };
@@ -10229,6 +10502,8 @@ var error31 = () => {
10229
10502
  json_string: "JSON\u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD",
10230
10503
  e164: "E.164 \u0CB8\u0C82\u0C96\u0CCD\u0CAF\u0CC6",
10231
10504
  credit_card: "\u0C95\u0CCD\u0CB0\u0CC6\u0CA1\u0CBF\u0C9F\u0CCD \u0C95\u0CBE\u0CB0\u0CCD\u0CA1\u0CCD \u0CB8\u0C82\u0C96\u0CCD\u0CAF\u0CC6",
10505
+ currency_code: "\u0C95\u0CB0\u0CC6\u0CA8\u0CCD\u0CB8\u0CBF \u0C95\u0CCB\u0CA1\u0CCD",
10506
+ iban: "IBAN",
10232
10507
  jwt: "JWT",
10233
10508
  template_literal: "\u0C87\u0CA8\u0CCD\u0CAA\u0CC1\u0C9F\u0CCD"
10234
10509
  };
@@ -10343,6 +10618,8 @@ var error32 = () => {
10343
10618
  json_string: "JSON \uBB38\uC790\uC5F4",
10344
10619
  e164: "E.164 \uBC88\uD638",
10345
10620
  credit_card: "\uC2E0\uC6A9\uCE74\uB4DC \uBC88\uD638",
10621
+ currency_code: "\uD1B5\uD654 \uCF54\uB4DC",
10622
+ iban: "IBAN",
10346
10623
  jwt: "JWT",
10347
10624
  template_literal: "\uC785\uB825"
10348
10625
  };
@@ -10540,6 +10817,8 @@ var error33 = () => {
10540
10817
  json_string: "JSON eilut\u0117",
10541
10818
  e164: "E.164 numeris",
10542
10819
  credit_card: "kredito kortel\u0117s numeris",
10820
+ currency_code: "valiutos kodas",
10821
+ iban: "IBAN",
10543
10822
  jwt: "JWT",
10544
10823
  template_literal: "\u012Fvestis"
10545
10824
  };
@@ -10664,6 +10943,8 @@ var error34 = () => {
10664
10943
  json_string: "JSON \u043D\u0438\u0437\u0430",
10665
10944
  e164: "E.164 \u0431\u0440\u043E\u0458",
10666
10945
  credit_card: "\u0431\u0440\u043E\u0458 \u043D\u0430 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u0430 \u043A\u0430\u0440\u0442\u0438\u0447\u043A\u0430",
10946
+ currency_code: "\u043A\u043E\u0434 \u043D\u0430 \u0432\u0430\u043B\u0443\u0442\u0430",
10947
+ iban: "IBAN",
10667
10948
  jwt: "JWT",
10668
10949
  template_literal: "\u0432\u043D\u0435\u0441"
10669
10950
  };
@@ -10777,6 +11058,8 @@ var error35 = () => {
10777
11058
  json_string: "string JSON",
10778
11059
  e164: "nombor E.164",
10779
11060
  credit_card: "nombor kad kredit",
11061
+ currency_code: "kod mata wang",
11062
+ iban: "IBAN",
10780
11063
  jwt: "JWT",
10781
11064
  template_literal: "input"
10782
11065
  };
@@ -10888,6 +11171,8 @@ var error36 = () => {
10888
11171
  json_string: "JSON \u0938\u094D\u091F\u094D\u0930\u093F\u0919",
10889
11172
  e164: "E.164 \u0928\u092E\u094D\u092C\u0930",
10890
11173
  credit_card: "\u0915\u094D\u0930\u0947\u0921\u093F\u091F \u0915\u093E\u0930\u094D\u0921 \u0928\u092E\u094D\u092C\u0930",
11174
+ currency_code: "\u092E\u0941\u0926\u094D\u0930\u093E \u0915\u094B\u0921",
11175
+ iban: "IBAN",
10891
11176
  jwt: "JWT",
10892
11177
  template_literal: "\u0907\u0928\u092A\u0941\u091F"
10893
11178
  };
@@ -10998,6 +11283,8 @@ var error37 = () => {
10998
11283
  json_string: "JSON string",
10999
11284
  e164: "E.164-nummer",
11000
11285
  credit_card: "creditcardnummer",
11286
+ currency_code: "valutacode",
11287
+ iban: "IBAN",
11001
11288
  jwt: "JWT",
11002
11289
  template_literal: "invoer"
11003
11290
  };
@@ -11112,6 +11399,8 @@ var error38 = () => {
11112
11399
  json_string: "JSON-streng",
11113
11400
  e164: "E.164-nummer",
11114
11401
  credit_card: "kredittkortnummer",
11402
+ currency_code: "valutakode",
11403
+ iban: "IBAN",
11115
11404
  jwt: "JWT",
11116
11405
  template_literal: "input"
11117
11406
  };
@@ -11224,6 +11513,8 @@ var error39 = () => {
11224
11513
  json_string: "JSON-streng",
11225
11514
  e164: "E.164-nummer",
11226
11515
  credit_card: "kredittkortnummer",
11516
+ currency_code: "valutakode",
11517
+ iban: "IBAN",
11227
11518
  jwt: "JWT",
11228
11519
  template_literal: "input"
11229
11520
  };
@@ -11336,6 +11627,8 @@ var error40 = () => {
11336
11627
  json_string: "JSON metin",
11337
11628
  e164: "E.164 say\u0131s\u0131",
11338
11629
  credit_card: "i'tib\xE2r kart\u0131 numaras\u0131",
11630
+ currency_code: "para birimi kodu",
11631
+ iban: "IBAN",
11339
11632
  jwt: "JWT",
11340
11633
  template_literal: "giren"
11341
11634
  };
@@ -11449,6 +11742,8 @@ var error41 = () => {
11449
11742
  json_string: "JSON \u0645\u062A\u0646",
11450
11743
  e164: "\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",
11451
11744
  credit_card: "\u062F \u06A9\u0631\u06CC\u0689\u06CC\u067C \u06A9\u0627\u0631\u062A \u0634\u0645\u06CC\u0631\u0647",
11745
+ currency_code: "\u062F \u0627\u0633\u0639\u0627\u0631\u0648 \u06A9\u0648\u0689",
11746
+ iban: "IBAN",
11452
11747
  jwt: "JWT",
11453
11748
  template_literal: "\u0648\u0631\u0648\u062F\u064A"
11454
11749
  };
@@ -11567,6 +11862,8 @@ var error42 = () => {
11567
11862
  json_string: "ci\u0105g znak\xF3w w formacie JSON",
11568
11863
  e164: "liczba E.164",
11569
11864
  credit_card: "numer karty kredytowej",
11865
+ currency_code: "kod waluty",
11866
+ iban: "IBAN",
11570
11867
  jwt: "JWT",
11571
11868
  template_literal: "wej\u015Bcie"
11572
11869
  };
@@ -11680,6 +11977,8 @@ var error43 = () => {
11680
11977
  json_string: "o texto JSON",
11681
11978
  e164: "o n\xFAmero E.164",
11682
11979
  credit_card: "o n\xFAmero de cart\xE3o de cr\xE9dito",
11980
+ currency_code: "o c\xF3digo de moeda",
11981
+ iban: "o IBAN",
11683
11982
  jwt: "o JWT",
11684
11983
  template_literal: "a entrada"
11685
11984
  };
@@ -11757,8 +12056,8 @@ var error43 = () => {
11757
12056
  case "not_multiple_of":
11758
12057
  return `N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${issue2.divisor}`;
11759
12058
  case "unrecognized_keys": {
11760
- const plural = issue2.keys.length > 1 ? "s" : "";
11761
- return `Chave${plural} inv\xE1lida${plural}: ${joinValues(issue2.keys, ", ")}`;
12059
+ const plural2 = issue2.keys.length > 1 ? "s" : "";
12060
+ return `Chave${plural2} inv\xE1lida${plural2}: ${joinValues(issue2.keys, ", ")}`;
11762
12061
  }
11763
12062
  case "invalid_key":
11764
12063
  return `Entrada inv\xE1lida n${translateOriginWithArticle(issue2.origin, "definite")}`;
@@ -11822,6 +12121,8 @@ var error44 = () => {
11822
12121
  json_string: "o texto JSON",
11823
12122
  e164: "o n\xFAmero E.164",
11824
12123
  credit_card: "o n\xFAmero de cart\xE3o de cr\xE9dito",
12124
+ currency_code: "o c\xF3digo de moeda",
12125
+ iban: "o IBAN",
11825
12126
  jwt: "o JWT",
11826
12127
  template_literal: "a entrada"
11827
12128
  };
@@ -11900,8 +12201,8 @@ var error44 = () => {
11900
12201
  case "not_multiple_of":
11901
12202
  return `N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${issue2.divisor}`;
11902
12203
  case "unrecognized_keys": {
11903
- const plural = issue2.keys.length > 1 ? "s" : "";
11904
- return `Chave${plural} inv\xE1lida${plural}: ${joinValues(issue2.keys, ", ")}`;
12204
+ const plural2 = issue2.keys.length > 1 ? "s" : "";
12205
+ return `Chave${plural2} inv\xE1lida${plural2}: ${joinValues(issue2.keys, ", ")}`;
11905
12206
  }
11906
12207
  case "invalid_key":
11907
12208
  return `Entrada inv\xE1lida n${translateOriginWithArticle(issue2.origin, "definite")}`;
@@ -11965,6 +12266,8 @@ var error45 = () => {
11965
12266
  json_string: "\u0219ir JSON",
11966
12267
  e164: "num\u0103r E.164",
11967
12268
  credit_card: "num\u0103r de card de credit",
12269
+ currency_code: "cod valutar",
12270
+ iban: "IBAN",
11968
12271
  jwt: "JWT",
11969
12272
  template_literal: "intrare"
11970
12273
  };
@@ -12136,6 +12439,8 @@ var error46 = () => {
12136
12439
  json_string: "JSON \u0441\u0442\u0440\u043E\u043A\u0430",
12137
12440
  e164: "\u043D\u043E\u043C\u0435\u0440 E.164",
12138
12441
  credit_card: "\u043D\u043E\u043C\u0435\u0440 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u043E\u0439 \u043A\u0430\u0440\u0442\u044B",
12442
+ currency_code: "\u043A\u043E\u0434 \u0432\u0430\u043B\u044E\u0442\u044B",
12443
+ iban: "IBAN",
12139
12444
  jwt: "JWT",
12140
12445
  template_literal: "\u0432\u0432\u043E\u0434"
12141
12446
  };
@@ -12253,6 +12558,8 @@ var error47 = () => {
12253
12558
  json_string: "re\u0165azec vo form\xE1te JSON",
12254
12559
  e164: "\u010D\xEDslo E.164",
12255
12560
  credit_card: "\u010D\xEDslo kreditnej karty",
12561
+ currency_code: "k\xF3d meny",
12562
+ iban: "IBAN",
12256
12563
  jwt: "JWT",
12257
12564
  template_literal: "vstup"
12258
12565
  };
@@ -12368,6 +12675,8 @@ var error48 = () => {
12368
12675
  json_string: "JSON niz",
12369
12676
  e164: "E.164 \u0161tevilka",
12370
12677
  credit_card: "\u0161tevilka kreditne kartice",
12678
+ currency_code: "koda valute",
12679
+ iban: "IBAN",
12371
12680
  jwt: "JWT",
12372
12681
  template_literal: "vnos"
12373
12682
  };
@@ -12481,6 +12790,8 @@ var error49 = () => {
12481
12790
  json_string: "JSON-str\xE4ng",
12482
12791
  e164: "E.164-nummer",
12483
12792
  credit_card: "kreditkortsnummer",
12793
+ currency_code: "valutakod",
12794
+ iban: "IBAN",
12484
12795
  jwt: "JWT",
12485
12796
  template_literal: "mall-literal"
12486
12797
  };
@@ -12595,6 +12906,8 @@ var error50 = () => {
12595
12906
  json_string: "JSON \u0B9A\u0BB0\u0BAE\u0BCD",
12596
12907
  e164: "E.164 \u0B8E\u0BA3\u0BCD",
12597
12908
  credit_card: "\u0B95\u0B9F\u0BA9\u0BCD \u0B85\u0B9F\u0BCD\u0B9F\u0BC8 \u0B8E\u0BA3\u0BCD",
12909
+ currency_code: "\u0BA8\u0BBE\u0BA3\u0BAF\u0B95\u0BCD \u0B95\u0BC1\u0BB1\u0BBF\u0BAF\u0BC0\u0B9F\u0BC1",
12910
+ iban: "IBAN",
12598
12911
  jwt: "JWT",
12599
12912
  template_literal: "input"
12600
12913
  };
@@ -12668,23 +12981,23 @@ function ta_default() {
12668
12981
  };
12669
12982
  }
12670
12983
 
12671
- // node_modules/zod/v4/locales/th.js
12984
+ // node_modules/zod/v4/locales/tg.js
12672
12985
  var error51 = () => {
12673
12986
  const Sizable = {
12674
- string: { unit: "\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" },
12675
- file: { unit: "\u0E44\u0E1A\u0E15\u0E4C", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" },
12676
- array: { unit: "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" },
12677
- set: { unit: "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" },
12678
- map: { unit: "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" }
12987
+ string: { unit: "\u0430\u043B\u043E\u043C\u0430\u0442", verb: "\u0434\u043E\u0448\u0442\u0430 \u0431\u043E\u0448\u0430\u0434" },
12988
+ file: { unit: "\u0431\u0430\u0439\u0442", verb: "\u0434\u043E\u0448\u0442\u0430 \u0431\u043E\u0448\u0430\u0434" },
12989
+ array: { unit: "\u0443\u043D\u0441\u0443\u0440", verb: "\u0434\u043E\u0448\u0442\u0430 \u0431\u043E\u0448\u0430\u0434" },
12990
+ set: { unit: "\u0443\u043D\u0441\u0443\u0440", verb: "\u0434\u043E\u0448\u0442\u0430 \u0431\u043E\u0448\u0430\u0434" },
12991
+ map: { unit: "\u0441\u0430\u0431\u0442", verb: "\u0434\u043E\u0448\u0442\u0430 \u0431\u043E\u0448\u0430\u0434" }
12679
12992
  };
12680
12993
  function getSizing(origin) {
12681
12994
  return Sizable[origin] ?? null;
12682
12995
  }
12683
12996
  const FormatDictionary = {
12684
- regex: "\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",
12685
- email: "\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",
12997
+ regex: "\u0432\u0443\u0440\u0443\u0434",
12998
+ email: "\u0441\u0443\u0440\u043E\u0493\u0430\u0438 email",
12686
12999
  url: "URL",
12687
- emoji: "\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",
13000
+ emoji: "\u044D\u043C\u043E\u04B7\u0438",
12688
13001
  uuid: "UUID",
12689
13002
  uuidv4: "UUIDv4",
12690
13003
  uuidv6: "UUIDv6",
@@ -12695,20 +13008,139 @@ var error51 = () => {
12695
13008
  ulid: "ULID",
12696
13009
  xid: "XID",
12697
13010
  ksuid: "KSUID",
12698
- datetime: "\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",
12699
- date: "\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",
12700
- time: "\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",
12701
- duration: "\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",
12702
- ipv4: "\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",
12703
- ipv6: "\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",
12704
- mac: "\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 MAC",
12705
- cidrv4: "\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",
12706
- cidrv6: "\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",
12707
- base64: "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",
12708
- base64url: "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",
12709
- json_string: "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",
12710
- e164: "\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",
12711
- credit_card: "\u0E2B\u0E21\u0E32\u0E22\u0E40\u0E25\u0E02\u0E1A\u0E31\u0E15\u0E23\u0E40\u0E04\u0E23\u0E14\u0E34\u0E15",
13011
+ datetime: "\u0441\u0430\u043D\u0430\u0432\u0443 \u0432\u0430\u049B\u0442\u0438 ISO",
13012
+ date: "\u0441\u0430\u043D\u0430\u0438 ISO",
13013
+ time: "\u0432\u0430\u049B\u0442\u0438 ISO",
13014
+ duration: "\u0434\u0430\u0432\u043E\u043C\u043D\u043E\u043A\u0438\u0438 ISO",
13015
+ ipv4: "\u0441\u0443\u0440\u043E\u0493\u0430\u0438 IPv4",
13016
+ ipv6: "\u0441\u0443\u0440\u043E\u0493\u0430\u0438 IPv6",
13017
+ mac: "\u0441\u0443\u0440\u043E\u0493\u0430\u0438 MAC",
13018
+ cidrv4: "\u043C\u0430\u04B3\u0434\u0443\u0434\u0430\u0438 IPv4",
13019
+ cidrv6: "\u043C\u0430\u04B3\u0434\u0443\u0434\u0430\u0438 IPv6",
13020
+ base64: "\u0441\u0430\u0442\u0440\u0438 \u0434\u0430\u0440 \u0444\u043E\u0440\u043C\u0430\u0442\u0438 base64",
13021
+ base64url: "\u0441\u0430\u0442\u0440\u0438 \u0434\u0430\u0440 \u0444\u043E\u0440\u043C\u0430\u0442\u0438 base64url",
13022
+ json_string: "\u0441\u0430\u0442\u0440\u0438 JSON",
13023
+ e164: "\u0440\u0430\u049B\u0430\u043C\u0438 E.164",
13024
+ credit_card: "\u0440\u0430\u049B\u0430\u043C\u0438 \u043A\u043E\u0440\u0442\u0438 \u043A\u0440\u0435\u0434\u0438\u0442\u04E3",
13025
+ currency_code: "\u0440\u0430\u043C\u0437\u0438 \u0430\u0441\u044A\u043E\u0440",
13026
+ iban: "IBAN",
13027
+ jwt: "JWT",
13028
+ template_literal: "\u0432\u0443\u0440\u0443\u0434"
13029
+ };
13030
+ const TypeDictionary = {
13031
+ nan: "NaN",
13032
+ number: "\u0440\u0430\u049B\u0430\u043C",
13033
+ string: "\u0441\u0430\u0442\u0440",
13034
+ array: "\u043C\u0430\u0441\u0441\u0438\u0432",
13035
+ object: "\u043E\u0431\u044A\u0435\u043A\u0442",
13036
+ date: "\u0441\u0430\u043D\u0430"
13037
+ };
13038
+ return (issue2) => {
13039
+ switch (issue2.code) {
13040
+ case "invalid_type": {
13041
+ const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
13042
+ const receivedType = parsedType(issue2.input);
13043
+ const received = TypeDictionary[receivedType] ?? receivedType;
13044
+ return `\u0412\u0443\u0440\u0443\u0434\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: ${expected} \u0438\u043D\u0442\u0438\u0437\u043E\u0440 \u043C\u0435\u0440\u0430\u0444\u0442, ${received} \u0433\u0438\u0440\u0438\u0444\u0442\u0430 \u0448\u0443\u0434`;
13045
+ }
13046
+ case "invalid_value":
13047
+ if (issue2.values.length === 1)
13048
+ return `\u0412\u0443\u0440\u0443\u0434\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: ${stringifyPrimitive(issue2.values[0])} \u0438\u043D\u0442\u0438\u0437\u043E\u0440 \u043C\u0435\u0440\u0430\u0444\u0442`;
13049
+ return `\u0418\u043D\u0442\u0438\u0445\u043E\u0431\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: \u044F\u043A\u0435 \u0430\u0437 ${joinValues(issue2.values, "|")} \u0438\u043D\u0442\u0438\u0437\u043E\u0440 \u043C\u0435\u0440\u0430\u0444\u0442`;
13050
+ case "too_big": {
13051
+ const adj = issue2.inclusive ? "<=" : "<";
13052
+ const sizing = getSizing(issue2.origin);
13053
+ if (sizing)
13054
+ return `\u0425\u0435\u043B\u0435 \u043A\u0430\u043B\u043E\u043D: ${issue2.origin ?? "\u049B\u0438\u043C\u0430\u0442"} \u0431\u043E\u044F\u0434 ${adj}${issue2.maximum.toString()} ${sizing.unit} ${sizing.verb}`;
13055
+ return `\u0425\u0435\u043B\u0435 \u043A\u0430\u043B\u043E\u043D: ${issue2.origin ?? "\u049B\u0438\u043C\u0430\u0442"} \u0431\u043E\u044F\u0434 ${adj}${issue2.maximum.toString()} \u0431\u043E\u0448\u0430\u0434`;
13056
+ }
13057
+ case "too_small": {
13058
+ const adj = issue2.inclusive ? ">=" : ">";
13059
+ const sizing = getSizing(issue2.origin);
13060
+ if (sizing)
13061
+ return `\u0425\u0435\u043B\u0435 \u0445\u0443\u0440\u0434: ${issue2.origin} \u0431\u043E\u044F\u0434 ${adj}${issue2.minimum.toString()} ${sizing.unit} ${sizing.verb}`;
13062
+ return `\u0425\u0435\u043B\u0435 \u0445\u0443\u0440\u0434: ${issue2.origin} \u0431\u043E\u044F\u0434 ${adj}${issue2.minimum.toString()} \u0431\u043E\u0448\u0430\u0434`;
13063
+ }
13064
+ case "invalid_format": {
13065
+ const _issue = issue2;
13066
+ if (_issue.format === "starts_with")
13067
+ return `\u0421\u0430\u0442\u0440\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: \u0431\u043E\u044F\u0434 \u0431\u043E "${_issue.prefix}" \u043E\u0493\u043E\u0437 \u0448\u0430\u0432\u0430\u0434`;
13068
+ if (_issue.format === "ends_with")
13069
+ return `\u0421\u0430\u0442\u0440\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: \u0431\u043E\u044F\u0434 \u0431\u043E "${_issue.suffix}" \u0430\u043D\u04B7\u043E\u043C \u0451\u0431\u0430\u0434`;
13070
+ if (_issue.format === "includes")
13071
+ return `\u0421\u0430\u0442\u0440\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: \u0431\u043E\u044F\u0434 "${_issue.includes}"-\u0440\u043E \u0434\u0430\u0440 \u0431\u0430\u0440 \u0433\u0438\u0440\u0430\u0434`;
13072
+ if (_issue.format === "regex")
13073
+ return `\u0421\u0430\u0442\u0440\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: \u0431\u043E\u044F\u0434 \u0431\u0430 \u043D\u0430\u043C\u0443\u043D\u0430\u0438 ${_issue.pattern} \u043C\u0443\u0432\u043E\u0444\u0438\u049B\u0430\u0442 \u043A\u0443\u043D\u0430\u0434`;
13074
+ return `${FormatDictionary[_issue.format] ?? issue2.format}-\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442`;
13075
+ }
13076
+ case "not_multiple_of":
13077
+ return `\u0420\u0430\u049B\u0430\u043C\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: \u0431\u043E\u044F\u0434 \u0431\u0430 ${issue2.divisor} \u0431\u0435 \u0431\u0430\u049B\u0438\u044F \u0442\u0430\u049B\u0441\u0438\u043C \u0448\u0430\u0432\u0430\u0434`;
13078
+ case "unrecognized_keys":
13079
+ return `\u041A\u0430\u043B\u0438\u0434${issue2.keys.length > 1 ? "\u04B3\u043E\u0438" : "\u0438"} \u043D\u043E\u043C\u0430\u044A\u043B\u0443\u043C: ${joinValues(issue2.keys, ", ")}`;
13080
+ case "invalid_key":
13081
+ return `\u041A\u0430\u043B\u0438\u0434\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442 \u0434\u0430\u0440 ${issue2.origin}`;
13082
+ case "invalid_union":
13083
+ if (issue2.options && Array.isArray(issue2.options) && issue2.options.length > 0) {
13084
+ const opts = issue2.options.map((o) => `'${o}'`).join(" | ");
13085
+ return `\u049A\u0438\u043C\u0430\u0442\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442\u0438 \u0434\u0438\u0441\u043A\u0440\u0438\u043C\u0438\u043D\u0430\u0442\u043E\u0440: ${opts} \u0438\u043D\u0442\u0438\u0437\u043E\u0440 \u043C\u0435\u0440\u0430\u0444\u0442`;
13086
+ }
13087
+ return "\u0412\u0443\u0440\u0443\u0434\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442";
13088
+ case "invalid_element":
13089
+ return `\u049A\u0438\u043C\u0430\u0442\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442 \u0434\u0430\u0440 ${issue2.origin}`;
13090
+ default:
13091
+ return `\u0412\u0443\u0440\u0443\u0434\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442`;
13092
+ }
13093
+ };
13094
+ };
13095
+ function tg_default() {
13096
+ return {
13097
+ localeError: error51()
13098
+ };
13099
+ }
13100
+
13101
+ // node_modules/zod/v4/locales/th.js
13102
+ var error52 = () => {
13103
+ const Sizable = {
13104
+ string: { unit: "\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" },
13105
+ file: { unit: "\u0E44\u0E1A\u0E15\u0E4C", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" },
13106
+ array: { unit: "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" },
13107
+ set: { unit: "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" },
13108
+ map: { unit: "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" }
13109
+ };
13110
+ function getSizing(origin) {
13111
+ return Sizable[origin] ?? null;
13112
+ }
13113
+ const FormatDictionary = {
13114
+ regex: "\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",
13115
+ email: "\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",
13116
+ url: "URL",
13117
+ emoji: "\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",
13118
+ uuid: "UUID",
13119
+ uuidv4: "UUIDv4",
13120
+ uuidv6: "UUIDv6",
13121
+ nanoid: "nanoid",
13122
+ guid: "GUID",
13123
+ cuid: "cuid",
13124
+ cuid2: "cuid2",
13125
+ ulid: "ULID",
13126
+ xid: "XID",
13127
+ ksuid: "KSUID",
13128
+ datetime: "\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",
13129
+ date: "\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",
13130
+ time: "\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",
13131
+ duration: "\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",
13132
+ ipv4: "\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",
13133
+ ipv6: "\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",
13134
+ mac: "\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 MAC",
13135
+ cidrv4: "\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",
13136
+ cidrv6: "\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",
13137
+ base64: "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",
13138
+ base64url: "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",
13139
+ json_string: "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",
13140
+ e164: "\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",
13141
+ credit_card: "\u0E2B\u0E21\u0E32\u0E22\u0E40\u0E25\u0E02\u0E1A\u0E31\u0E15\u0E23\u0E40\u0E04\u0E23\u0E14\u0E34\u0E15",
13142
+ currency_code: "\u0E23\u0E2B\u0E31\u0E2A\u0E2A\u0E01\u0E38\u0E25\u0E40\u0E07\u0E34\u0E19",
13143
+ iban: "IBAN",
12712
13144
  jwt: "\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",
12713
13145
  template_literal: "\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"
12714
13146
  };
@@ -12778,12 +13210,12 @@ var error51 = () => {
12778
13210
  };
12779
13211
  function th_default() {
12780
13212
  return {
12781
- localeError: error51()
13213
+ localeError: error52()
12782
13214
  };
12783
13215
  }
12784
13216
 
12785
13217
  // node_modules/zod/v4/locales/tk.js
12786
- var error52 = () => {
13218
+ var error53 = () => {
12787
13219
  const Sizable = {
12788
13220
  string: { unit: "simwol", verb: "bolmaly" },
12789
13221
  file: { unit: "ba\xFDt", verb: "bolmaly" },
@@ -12823,6 +13255,8 @@ var error52 = () => {
12823
13255
  json_string: "JSON setiri",
12824
13256
  e164: "E.164 nomeri",
12825
13257
  credit_card: "kredit kartyny\u0148 nomeri",
13258
+ currency_code: "wal\xFDuta kody",
13259
+ iban: "IBAN",
12826
13260
  jwt: "JWT",
12827
13261
  template_literal: "\u015Fablon"
12828
13262
  };
@@ -12884,12 +13318,12 @@ var error52 = () => {
12884
13318
  };
12885
13319
  function tk_default() {
12886
13320
  return {
12887
- localeError: error52()
13321
+ localeError: error53()
12888
13322
  };
12889
13323
  }
12890
13324
 
12891
13325
  // node_modules/zod/v4/locales/tr.js
12892
- var error53 = () => {
13326
+ var error54 = () => {
12893
13327
  const Sizable = {
12894
13328
  string: { unit: "karakter", verb: "olmal\u0131" },
12895
13329
  file: { unit: "bayt", verb: "olmal\u0131" },
@@ -12929,6 +13363,8 @@ var error53 = () => {
12929
13363
  json_string: "JSON dizesi",
12930
13364
  e164: "E.164 say\u0131s\u0131",
12931
13365
  credit_card: "kredi kart\u0131 numaras\u0131",
13366
+ currency_code: "para birimi kodu",
13367
+ iban: "IBAN",
12932
13368
  jwt: "JWT",
12933
13369
  template_literal: "\u015Eablon dizesi"
12934
13370
  };
@@ -12993,12 +13429,12 @@ var error53 = () => {
12993
13429
  };
12994
13430
  function tr_default() {
12995
13431
  return {
12996
- localeError: error53()
13432
+ localeError: error54()
12997
13433
  };
12998
13434
  }
12999
13435
 
13000
13436
  // node_modules/zod/v4/locales/uk.js
13001
- var error54 = () => {
13437
+ var error55 = () => {
13002
13438
  const Sizable = {
13003
13439
  string: { unit: "\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" },
13004
13440
  file: { unit: "\u0431\u0430\u0439\u0442\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" },
@@ -13038,6 +13474,8 @@ var error54 = () => {
13038
13474
  json_string: "\u0440\u044F\u0434\u043E\u043A JSON",
13039
13475
  e164: "\u043D\u043E\u043C\u0435\u0440 E.164",
13040
13476
  credit_card: "\u043D\u043E\u043C\u0435\u0440 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u043E\u0457 \u043A\u0430\u0440\u0442\u043A\u0438",
13477
+ currency_code: "\u043A\u043E\u0434 \u0432\u0430\u043B\u044E\u0442\u0438",
13478
+ iban: "IBAN",
13041
13479
  jwt: "JWT",
13042
13480
  template_literal: "\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"
13043
13481
  };
@@ -13105,7 +13543,7 @@ var error54 = () => {
13105
13543
  };
13106
13544
  function uk_default() {
13107
13545
  return {
13108
- localeError: error54()
13546
+ localeError: error55()
13109
13547
  };
13110
13548
  }
13111
13549
 
@@ -13115,7 +13553,7 @@ function ua_default() {
13115
13553
  }
13116
13554
 
13117
13555
  // node_modules/zod/v4/locales/ur.js
13118
- var error55 = () => {
13556
+ var error56 = () => {
13119
13557
  const Sizable = {
13120
13558
  string: { unit: "\u062D\u0631\u0648\u0641", verb: "\u06C1\u0648\u0646\u0627" },
13121
13559
  file: { unit: "\u0628\u0627\u0626\u0679\u0633", verb: "\u06C1\u0648\u0646\u0627" },
@@ -13155,6 +13593,8 @@ var error55 = () => {
13155
13593
  json_string: "\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",
13156
13594
  e164: "\u0627\u06CC 164 \u0646\u0645\u0628\u0631",
13157
13595
  credit_card: "\u06A9\u0631\u06CC\u0688\u0679 \u06A9\u0627\u0631\u0688 \u0646\u0645\u0628\u0631",
13596
+ currency_code: "\u06A9\u0631\u0646\u0633\u06CC \u06A9\u0648\u0688",
13597
+ iban: "IBAN",
13158
13598
  jwt: "\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",
13159
13599
  template_literal: "\u0627\u0646 \u067E\u0679"
13160
13600
  };
@@ -13224,12 +13664,12 @@ var error55 = () => {
13224
13664
  };
13225
13665
  function ur_default() {
13226
13666
  return {
13227
- localeError: error55()
13667
+ localeError: error56()
13228
13668
  };
13229
13669
  }
13230
13670
 
13231
13671
  // node_modules/zod/v4/locales/uz.js
13232
- var error56 = () => {
13672
+ var error57 = () => {
13233
13673
  const Sizable = {
13234
13674
  string: { unit: "belgi", verb: "bo\u2018lishi kerak" },
13235
13675
  file: { unit: "bayt", verb: "bo\u2018lishi kerak" },
@@ -13269,6 +13709,8 @@ var error56 = () => {
13269
13709
  json_string: "JSON satr",
13270
13710
  e164: "E.164 raqam",
13271
13711
  credit_card: "kredit karta raqami",
13712
+ currency_code: "valyuta kodi",
13713
+ iban: "IBAN",
13272
13714
  jwt: "JWT",
13273
13715
  template_literal: "kirish"
13274
13716
  };
@@ -13336,12 +13778,12 @@ var error56 = () => {
13336
13778
  };
13337
13779
  function uz_default() {
13338
13780
  return {
13339
- localeError: error56()
13781
+ localeError: error57()
13340
13782
  };
13341
13783
  }
13342
13784
 
13343
13785
  // node_modules/zod/v4/locales/vi.js
13344
- var error57 = () => {
13786
+ var error58 = () => {
13345
13787
  const Sizable = {
13346
13788
  string: { unit: "k\xFD t\u1EF1", verb: "c\xF3" },
13347
13789
  file: { unit: "byte", verb: "c\xF3" },
@@ -13381,6 +13823,8 @@ var error57 = () => {
13381
13823
  json_string: "chu\u1ED7i JSON",
13382
13824
  e164: "s\u1ED1 E.164",
13383
13825
  credit_card: "s\u1ED1 th\u1EBB t\xEDn d\u1EE5ng",
13826
+ currency_code: "m\xE3 ti\u1EC1n t\u1EC7",
13827
+ iban: "IBAN",
13384
13828
  jwt: "JWT",
13385
13829
  template_literal: "\u0111\u1EA7u v\xE0o"
13386
13830
  };
@@ -13448,12 +13892,12 @@ var error57 = () => {
13448
13892
  };
13449
13893
  function vi_default() {
13450
13894
  return {
13451
- localeError: error57()
13895
+ localeError: error58()
13452
13896
  };
13453
13897
  }
13454
13898
 
13455
13899
  // node_modules/zod/v4/locales/zh-CN.js
13456
- var error58 = () => {
13900
+ var error59 = () => {
13457
13901
  const Sizable = {
13458
13902
  string: { unit: "\u5B57\u7B26", verb: "\u5305\u542B" },
13459
13903
  file: { unit: "\u5B57\u8282", verb: "\u5305\u542B" },
@@ -13493,6 +13937,8 @@ var error58 = () => {
13493
13937
  json_string: "JSON\u5B57\u7B26\u4E32",
13494
13938
  e164: "E.164\u53F7\u7801",
13495
13939
  credit_card: "\u4FE1\u7528\u5361\u53F7",
13940
+ currency_code: "\u8D27\u5E01\u4EE3\u7801",
13941
+ iban: "IBAN",
13496
13942
  jwt: "JWT",
13497
13943
  template_literal: "\u8F93\u5165"
13498
13944
  };
@@ -13561,12 +14007,12 @@ var error58 = () => {
13561
14007
  };
13562
14008
  function zh_CN_default() {
13563
14009
  return {
13564
- localeError: error58()
14010
+ localeError: error59()
13565
14011
  };
13566
14012
  }
13567
14013
 
13568
14014
  // node_modules/zod/v4/locales/zh-TW.js
13569
- var error59 = () => {
14015
+ var error60 = () => {
13570
14016
  const Sizable = {
13571
14017
  string: { unit: "\u5B57\u5143", verb: "\u64C1\u6709" },
13572
14018
  file: { unit: "\u4F4D\u5143\u7D44", verb: "\u64C1\u6709" },
@@ -13606,6 +14052,8 @@ var error59 = () => {
13606
14052
  json_string: "JSON \u5B57\u4E32",
13607
14053
  e164: "E.164 \u6578\u503C",
13608
14054
  credit_card: "\u4FE1\u7528\u5361\u865F",
14055
+ currency_code: "\u8CA8\u5E63\u4EE3\u78BC",
14056
+ iban: "IBAN",
13609
14057
  jwt: "JWT",
13610
14058
  template_literal: "\u8F38\u5165"
13611
14059
  };
@@ -13672,12 +14120,12 @@ var error59 = () => {
13672
14120
  };
13673
14121
  function zh_TW_default() {
13674
14122
  return {
13675
- localeError: error59()
14123
+ localeError: error60()
13676
14124
  };
13677
14125
  }
13678
14126
 
13679
14127
  // node_modules/zod/v4/locales/yo.js
13680
- var error60 = () => {
14128
+ var error61 = () => {
13681
14129
  const Sizable = {
13682
14130
  string: { unit: "\xE0mi", verb: "n\xED" },
13683
14131
  file: { unit: "bytes", verb: "n\xED" },
@@ -13717,6 +14165,8 @@ var error60 = () => {
13717
14165
  json_string: "\u1ECD\u0300r\u1ECD\u0300 JSON",
13718
14166
  e164: "n\u1ECD\u0301mb\xE0 E.164",
13719
14167
  credit_card: "n\u1ECDmba kaadi gbese",
14168
+ currency_code: "koodu ow\xF3",
14169
+ iban: "IBAN",
13720
14170
  jwt: "JWT",
13721
14171
  template_literal: "\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9"
13722
14172
  };
@@ -13783,7 +14233,7 @@ var error60 = () => {
13783
14233
  };
13784
14234
  function yo_default() {
13785
14235
  return {
13786
- localeError: error60()
14236
+ localeError: error61()
13787
14237
  };
13788
14238
  }
13789
14239
 
@@ -13863,31 +14313,8 @@ function compileValidator(schema, parser) {
13863
14313
  function compile(schema, options) {
13864
14314
  try {
13865
14315
  const parser = compileFn(schema);
13866
- const clone2 = clone(schema);
13867
- const liveRun = schema._zod.run;
13868
- const originalRun = liveRun.__originalRun ?? liveRun;
13869
- const wrapped = (payload, ctx) => {
13870
- if (ctx?.async || ctx?.direction === "backward" || ctx?.skipChecks || ctx?.[FALLBACK_FLAG]) {
13871
- return originalRun(payload, ctx);
13872
- }
13873
- if (ctx && isBackEdge(ctx, payload.value)) {
13874
- return originalRun(payload, ctx);
13875
- }
13876
- const out = parser(payload.value);
13877
- if (out !== INVALID) {
13878
- payload.value = out;
13879
- return payload;
13880
- }
13881
- if (ctx)
13882
- ctx[FALLBACK_FLAG] = true;
13883
- return originalRun(payload, ctx);
13884
- };
13885
- wrapped.__originalRun = originalRun;
13886
- clone2._zod.bag.fallbackRun = originalRun;
14316
+ const clone2 = withParser(schema, parser);
13887
14317
  clone2._zod.bag.validator = compileValidator(schema, parser);
13888
- clone2._zod.run = wrapped;
13889
- if (!liveRun.__originalRun)
13890
- installCompiledUserMethods(clone2, schema, parser);
13891
14318
  return clone2;
13892
14319
  } catch (err) {
13893
14320
  if (options?.strict)
@@ -13895,6 +14322,37 @@ function compile(schema, options) {
13895
14322
  return schema;
13896
14323
  }
13897
14324
  }
14325
+ function withParser(schema, parser) {
14326
+ if (isRecursiveSchema(schema)) {
14327
+ throw new ZodCompileUnsupportedError("a schema whose subtree contains a reference cycle");
14328
+ }
14329
+ const clone2 = clone(schema);
14330
+ const liveRun = schema._zod.run;
14331
+ const originalRun = liveRun.__originalRun ?? liveRun;
14332
+ const wrapped = (payload, ctx) => {
14333
+ if (ctx?.async || ctx?.direction === "backward" || ctx?.skipChecks || ctx?.[FALLBACK_FLAG]) {
14334
+ return originalRun(payload, ctx);
14335
+ }
14336
+ if (ctx && isBackEdge(ctx, payload.value)) {
14337
+ return originalRun(payload, ctx);
14338
+ }
14339
+ const out = parser(payload.value);
14340
+ if (out !== INVALID) {
14341
+ payload.value = out;
14342
+ return payload;
14343
+ }
14344
+ if (ctx)
14345
+ ctx[FALLBACK_FLAG] = true;
14346
+ return originalRun(payload, ctx);
14347
+ };
14348
+ wrapped.__originalRun = originalRun;
14349
+ clone2._zod.bag.fallbackRun = originalRun;
14350
+ clone2._zod.bag.validator = parser;
14351
+ clone2._zod.run = wrapped;
14352
+ if (!liveRun.__originalRun)
14353
+ installCompiledUserMethods(clone2, schema, parser);
14354
+ return clone2;
14355
+ }
13898
14356
  function installCompiledUserMethods(target, source, parser) {
13899
14357
  const targetAny = target;
13900
14358
  const sourceAny = source;
@@ -13931,7 +14389,8 @@ function compileFn(schema, options) {
13931
14389
  const ctx = {
13932
14390
  constants: /* @__PURE__ */ new Map(),
13933
14391
  constantCounter: 0,
13934
- varCounter: 0
14392
+ varCounter: 0,
14393
+ definite: true
13935
14394
  };
13936
14395
  const doc = new Doc(["input"]);
13937
14396
  const outputAccessor = generateCheck(doc, ctx, schema, "input", !options?.assertOnly);
@@ -13955,6 +14414,7 @@ ${code}
13955
14414
  if (options?.debug) {
13956
14415
  fn.code = fullCode;
13957
14416
  }
14417
+ fn.definite = ctx.definite;
13958
14418
  return fn;
13959
14419
  }
13960
14420
  function addConstant(ctx, value) {
@@ -13966,6 +14426,10 @@ function addConstant(ctx, value) {
13966
14426
  ctx.constants.set(name, value);
13967
14427
  return name;
13968
14428
  }
14429
+ function addUserConstant(ctx, fn) {
14430
+ ctx.definite = false;
14431
+ return addConstant(ctx, fn);
14432
+ }
13969
14433
  function newVar(ctx) {
13970
14434
  return `v${ctx.varCounter++}`;
13971
14435
  }
@@ -13998,6 +14462,7 @@ function compileChild(doc, ctx, schema, accessor, needsValue = true) {
13998
14462
  }
13999
14463
  }
14000
14464
  function emitRuntimeIsland(doc, ctx, schema, accessor) {
14465
+ ctx.definite = false;
14001
14466
  const schemaConst = addConstant(ctx, schema);
14002
14467
  const runConst = addConstant(ctx, runtimeRun);
14003
14468
  const outVar = newVar(ctx);
@@ -14078,6 +14543,9 @@ function generateChecks(doc, ctx, schema, accessor) {
14078
14543
  case "property":
14079
14544
  generatePropertyCheck(doc, ctx, def, currentAccessor);
14080
14545
  break;
14546
+ case "properties":
14547
+ generatePropertiesChecks(doc, ctx, def, currentAccessor);
14548
+ break;
14081
14549
  case "overwrite": {
14082
14550
  const newAccessor = newVar(ctx);
14083
14551
  generateOverwriteCheck(doc, ctx, check2, currentAccessor, newAccessor);
@@ -14186,6 +14654,19 @@ function generateMimeTypeCheck(doc, ctx, def, accessor) {
14186
14654
  doc.write(`if (!${mimeSet}.has(${accessor}.type)) return INVALID;`);
14187
14655
  }
14188
14656
  }
14657
+ function generatePropertiesChecks(doc, ctx, def, accessor) {
14658
+ if (def.when) {
14659
+ throw new ZodCompileUnsupportedError(`check with a custom "when" condition`);
14660
+ }
14661
+ doc.write(`if (${accessor} == null) return INVALID;`);
14662
+ const shape = def.shape;
14663
+ for (const key of Reflect.ownKeys(shape)) {
14664
+ const keyExpr = typeof key === "symbol" ? addConstant(ctx, key) : esc(key);
14665
+ const inputVar = newVar(ctx);
14666
+ doc.write(`const ${inputVar} = ${accessor}[${keyExpr}];`);
14667
+ compileChild(doc, ctx, shape[key], inputVar, false);
14668
+ }
14669
+ }
14189
14670
  function generatePropertyCheck(doc, ctx, def, accessor) {
14190
14671
  const propAccessor = `${accessor}[${JSON.stringify(def.property)}]`;
14191
14672
  generateCheck(doc, ctx, def.schema, propAccessor);
@@ -14213,7 +14694,7 @@ function generateCustomRefineCheck(doc, ctx, check2, accessor) {
14213
14694
  if (isAsyncFunction(def.fn)) {
14214
14695
  throw new ZodCompileAsyncError("z.compile: async .refine() predicates are not supported");
14215
14696
  }
14216
- const fnConst = addConstant(ctx, def.fn);
14697
+ const fnConst = addUserConstant(ctx, def.fn);
14217
14698
  const throwAsyncConst = addConstant(ctx, throwAsync);
14218
14699
  const resVar = newVar(ctx);
14219
14700
  doc.write(`const ${resVar} = ${fnConst}(${accessor});`);
@@ -14233,7 +14714,7 @@ function generateCustomRefineCheck(doc, ctx, check2, accessor) {
14233
14714
  throwAsync();
14234
14715
  return fakePayload.issues.length === 0 ? fakePayload.value : INVALID;
14235
14716
  };
14236
- const helperConst = addConstant(ctx, helperFn);
14717
+ const helperConst = addUserConstant(ctx, helperFn);
14237
14718
  const outVar = newVar(ctx);
14238
14719
  doc.write(`const ${outVar} = ${helperConst}(${accessor});`);
14239
14720
  doc.write(`if (${outVar} === INVALID) return INVALID;`);
@@ -14267,7 +14748,7 @@ var PATTERN_IS_COMPLETE = /* @__PURE__ */ new Set([
14267
14748
  "uuid",
14268
14749
  "xid"
14269
14750
  ]);
14270
- function generateStringFormatCheck(doc, ctx, def, accessor) {
14751
+ function generateStringFormatCheck(doc, ctx, def, accessor, needsValue = true) {
14271
14752
  const fmt = def.format;
14272
14753
  if (fmt === "base64") {
14273
14754
  const validator = addConstant(ctx, isValidBase64);
@@ -14300,9 +14781,14 @@ function generateStringFormatCheck(doc, ctx, def, accessor) {
14300
14781
  doc.write(`if (!${validator}(${accessor})) return INVALID;`);
14301
14782
  return accessor;
14302
14783
  }
14784
+ if (fmt === "iban") {
14785
+ const validator = addConstant(ctx, isValidIBAN);
14786
+ doc.write(`if (!${validator}(${accessor})) return INVALID;`);
14787
+ return accessor;
14788
+ }
14303
14789
  const formatDef = def;
14304
14790
  if (fmt === "url" || fmt === "httpurl" || formatDef.normalize || formatDef.hostname !== void 0 || formatDef.protocol !== void 0) {
14305
- const parseConst = addConstant(ctx, parseURLObject);
14791
+ const parseConst = addConstant(ctx, validateURL);
14306
14792
  const defConst = addConstant(ctx, def);
14307
14793
  const trimVar = newVar(ctx);
14308
14794
  const urlVar = newVar(ctx);
@@ -14317,6 +14803,8 @@ function generateStringFormatCheck(doc, ctx, def, accessor) {
14317
14803
  const protocolConst = addConstant(ctx, urlProtocolOk);
14318
14804
  doc.write(`if (!${protocolConst}(${urlVar}, ${defConst}.protocol)) return INVALID;`);
14319
14805
  }
14806
+ if (!needsValue)
14807
+ return null;
14320
14808
  const outputVar = newVar(ctx);
14321
14809
  const outputExpr = formatDef.normalize ? `${urlVar}.href` : `${addConstant(ctx, stripTabAndNewline)}(${trimVar})`;
14322
14810
  doc.write(`const ${outputVar} = ${outputExpr};`);
@@ -14376,7 +14864,7 @@ function generateCheck(doc, ctx, schema, accessor, needsValue = true) {
14376
14864
  let typeAccessor;
14377
14865
  switch (type) {
14378
14866
  case "string":
14379
- typeAccessor = generateStringCheck(doc, ctx, schema, accessor);
14867
+ typeAccessor = generateStringCheck(doc, ctx, schema, accessor, buildsValue);
14380
14868
  break;
14381
14869
  case "number":
14382
14870
  typeAccessor = generateNumberCheck(doc, schema, accessor);
@@ -14497,12 +14985,12 @@ function generateCheck(doc, ctx, schema, accessor, needsValue = true) {
14497
14985
  return null;
14498
14986
  return generateChecks(doc, ctx, schema, typeAccessor);
14499
14987
  }
14500
- function generateStringCheck(doc, ctx, schema, accessor) {
14988
+ function generateStringCheck(doc, ctx, schema, accessor, needsValue = true) {
14501
14989
  doc.write(`if (typeof ${accessor} !== "string") return INVALID;`);
14502
14990
  const def = schema._zod.def;
14503
14991
  if (def.format === void 0)
14504
14992
  return accessor;
14505
- return generateStringFormatCheck(doc, ctx, def, accessor);
14993
+ return generateStringFormatCheck(doc, ctx, def, accessor, needsValue);
14506
14994
  }
14507
14995
  function generateNumberCheck(doc, schema, accessor) {
14508
14996
  doc.write(`if (typeof ${accessor} !== "number" || !Number.isFinite(${accessor})) return INVALID;`);
@@ -14620,7 +15108,7 @@ function generateObjectCheck(doc, ctx, schema, accessor, buildsValue = true) {
14620
15108
  }
14621
15109
  }
14622
15110
  const outputVar = newVar(ctx);
14623
- const hasConditionalKeys = allKeys.some((k) => mayOutputUndefined(propShape[k]) || dropsWhenAbsent(propShape[k]));
15111
+ const hasConditionalKeys = allKeys.some((k) => mayOmitUndefined(propShape[k]) || dropsWhenAbsent(propShape[k]));
14624
15112
  if (!buildsValue) {
14625
15113
  if (unknownKeysMode === "schema") {
14626
15114
  const knownSet = keys.length > 0 ? addConstant(ctx, new Set(keys)) : null;
@@ -14647,7 +15135,7 @@ function generateObjectCheck(doc, ctx, schema, accessor, buildsValue = true) {
14647
15135
  const out = propOutputs.get(k);
14648
15136
  if (dropsWhenAbsent(propShape[k])) {
14649
15137
  doc.write(`if (${kx} in ${accessor}) ${outputVar}[${kx}] = ${out};`);
14650
- } else if (mayOutputUndefined(propShape[k])) {
15138
+ } else if (mayOmitUndefined(propShape[k])) {
14651
15139
  doc.write(`if (${out} !== undefined || ${kx} in ${accessor}) ${outputVar}[${kx}] = ${out};`);
14652
15140
  } else {
14653
15141
  doc.write(`${outputVar}[${kx}] = ${out};`);
@@ -14780,6 +15268,9 @@ function fastPathAcceptsAbsence(schema) {
14780
15268
  function dropsWhenAbsent(schema) {
14781
15269
  return schema._zod.optin === "optional" && schema._zod.optout === "optional";
14782
15270
  }
15271
+ function mayOmitUndefined(schema) {
15272
+ return (schema._zod.optin !== "defaulted" || schema._zod.optout === "optional") && mayOutputUndefined(schema);
15273
+ }
14783
15274
  function mayOutputUndefined(schema) {
14784
15275
  const def = schema._zod.def;
14785
15276
  switch (def.type) {
@@ -14836,9 +15327,15 @@ function generateNullableCheck(doc, ctx, schema, accessor, buildsValue = true) {
14836
15327
  doc.write(`}`);
14837
15328
  return outputVar;
14838
15329
  }
15330
+ function generateSizeGate(doc, schema, size) {
15331
+ for (const [max, check2] of sizeCaps(schema._zod.def.checks)) {
15332
+ doc.write(`if (${size} > ${numericOperand(max, check2._zod.def.check)}) return INVALID;`);
15333
+ }
15334
+ }
14839
15335
  function generateArrayCheck(doc, ctx, schema, accessor, buildsValue = true) {
14840
15336
  const def = schema._zod.def;
14841
15337
  doc.write(`if (!Array.isArray(${accessor})) return INVALID;`);
15338
+ generateSizeGate(doc, schema, `${accessor}.length`);
14842
15339
  const outputVar = buildsValue ? newVar(ctx) : null;
14843
15340
  const iVar = newVar(ctx);
14844
15341
  const elemVar = newVar(ctx);
@@ -15122,6 +15619,7 @@ function literalEquality(ctx, accessor, value) {
15122
15619
  }
15123
15620
  function generateIntersectionCheck(doc, ctx, schema, accessor) {
15124
15621
  const def = schema._zod.def;
15622
+ ctx.definite = false;
15125
15623
  const leftOutput = compileChild(doc, ctx, def.left, accessor);
15126
15624
  const rightOutput = compileChild(doc, ctx, def.right, accessor);
15127
15625
  const mergeConst = addConstant(ctx, mergeValues);
@@ -15175,14 +15673,13 @@ function generateRecordCheck(doc, ctx, schema, accessor) {
15175
15673
  const keyIsBareString = keyDef.type === "string" && keyDef.format === void 0 && !keyDef.coerce && (keyDef.checks?.length ?? 0) === 0;
15176
15674
  if (!keyIsBareString) {
15177
15675
  const isLoose = def.mode === "loose";
15178
- const keyFast = addConstant(ctx, compileFn(def.keyType));
15676
+ const keyFn = compileFn(def.keyType);
15677
+ if (keyFn.definite === false)
15678
+ ctx.definite = false;
15679
+ const keyFast = addConstant(ctx, keyFn);
15179
15680
  const numericConst = addConstant(ctx, number);
15180
- const propIsEnumerableConst = addConstant(ctx, Object.prototype.propertyIsEnumerable);
15181
15681
  const outKeyVar = newVar(ctx);
15182
- doc.write(`for (const ${kVar} of Reflect.ownKeys(${accessor})) {`);
15183
- doc.indented((d) => {
15184
- d.write(`if (${kVar} === "__proto__") continue;`);
15185
- d.write(`if (!${propIsEnumerableConst}.call(${accessor}, ${kVar})) continue;`);
15682
+ emitOwnKeys(doc, ctx, accessor, kVar, (d) => {
15186
15683
  d.write(`let ${outKeyVar} = ${keyFast}(${kVar});`);
15187
15684
  d.write(`if (${outKeyVar} === INVALID && typeof ${kVar} === "string" && ${numericConst}.test(${kVar})) ${outKeyVar} = ${keyFast}(Number(${kVar}));`);
15188
15685
  if (isLoose) {
@@ -15196,21 +15693,39 @@ function generateRecordCheck(doc, ctx, schema, accessor) {
15196
15693
  const valOutput = compileChild(d, ctx, def.valueType, valueVar);
15197
15694
  d.write(`${outputVar}[${outKeyVar}] = ${valOutput};`);
15198
15695
  });
15199
- doc.write(`}`);
15200
15696
  return outputVar;
15201
15697
  }
15202
- const propIsEnumerable = addConstant(ctx, Object.prototype.propertyIsEnumerable);
15203
- doc.write(`for (const ${kVar} of Reflect.ownKeys(${accessor})) {`);
15204
- doc.indented((d) => {
15205
- d.write(`if (${kVar} === "__proto__") continue;`);
15206
- d.write(`if (!${propIsEnumerable}.call(${accessor}, ${kVar})) continue;`);
15207
- d.write(`if (typeof ${kVar} !== "string") return INVALID;`);
15698
+ emitOwnKeys(doc, ctx, accessor, kVar, (d) => {
15208
15699
  d.write(`const ${valVar} = ${accessor}[${kVar}];`);
15209
15700
  const valOutput = compileChild(d, ctx, def.valueType, valVar);
15210
15701
  d.write(`${outputVar}[${kVar}] = ${valOutput};`);
15702
+ }, `return INVALID;`);
15703
+ return outputVar;
15704
+ }
15705
+ function emitOwnKeys(doc, ctx, accessor, kVar, body, onSymbol) {
15706
+ const propIsEnumerableConst = addConstant(ctx, Object.prototype.propertyIsEnumerable);
15707
+ const symsVar = newVar(ctx);
15708
+ const keysVar = newVar(ctx);
15709
+ const iVar = newVar(ctx);
15710
+ doc.write(`const ${symsVar} = Object.getOwnPropertySymbols(${accessor});`);
15711
+ doc.write(`const ${keysVar} = Object.getOwnPropertyNames(${accessor});`);
15712
+ doc.write(`for (let ${iVar} = 0; ${iVar} < ${keysVar}.length; ${iVar}++) {`);
15713
+ doc.indented((d) => {
15714
+ d.write(`const ${kVar} = ${keysVar}[${iVar}];`);
15715
+ d.write(`if (${kVar} === "__proto__" || !${propIsEnumerableConst}.call(${accessor}, ${kVar})) continue;`);
15716
+ body(d);
15717
+ });
15718
+ doc.write(`}`);
15719
+ doc.write(`for (let ${iVar} = 0; ${iVar} < ${symsVar}.length; ${iVar}++) {`);
15720
+ doc.indented((d) => {
15721
+ d.write(`const ${kVar} = ${symsVar}[${iVar}];`);
15722
+ d.write(`if (!${propIsEnumerableConst}.call(${accessor}, ${kVar})) continue;`);
15723
+ if (onSymbol)
15724
+ d.write(onSymbol);
15725
+ else
15726
+ body(d);
15211
15727
  });
15212
15728
  doc.write(`}`);
15213
- return outputVar;
15214
15729
  }
15215
15730
  function literalPropertyKey(ctx, key) {
15216
15731
  if (typeof key === "string")
@@ -15220,6 +15735,7 @@ function literalPropertyKey(ctx, key) {
15220
15735
  function generateMapCheck(doc, ctx, schema, accessor) {
15221
15736
  const def = schema._zod.def;
15222
15737
  doc.write(`if (!(${accessor} instanceof Map)) return INVALID;`);
15738
+ generateSizeGate(doc, schema, `${accessor}.size`);
15223
15739
  const outputVar = newVar(ctx);
15224
15740
  const kVar = newVar(ctx);
15225
15741
  const valVar = newVar(ctx);
@@ -15236,6 +15752,7 @@ function generateMapCheck(doc, ctx, schema, accessor) {
15236
15752
  function generateSetCheck(doc, ctx, schema, accessor) {
15237
15753
  const def = schema._zod.def;
15238
15754
  doc.write(`if (!(${accessor} instanceof Set)) return INVALID;`);
15755
+ generateSizeGate(doc, schema, `${accessor}.size`);
15239
15756
  const outputVar = newVar(ctx);
15240
15757
  const valVar = newVar(ctx);
15241
15758
  doc.write(`const ${outputVar} = new Set();`);
@@ -15263,7 +15780,7 @@ function generateTemplateLiteralCheck(doc, ctx, schema, accessor) {
15263
15780
  }
15264
15781
  function generateLazyCheck(doc, ctx, schema, accessor) {
15265
15782
  const def = schema._zod.def;
15266
- const getterConst = addConstant(ctx, def.getter);
15783
+ const getterConst = addUserConstant(ctx, def.getter);
15267
15784
  const cacheConst = addConstant(ctx, { parser: null });
15268
15785
  doc.write(`if (!${cacheConst}.parser) {`);
15269
15786
  doc.indented((d) => {
@@ -15296,7 +15813,7 @@ function generatePipeCheck(doc, ctx, schema, accessor) {
15296
15813
  return INVALID;
15297
15814
  return fakePayload.issues.length === 0 ? result : INVALID;
15298
15815
  };
15299
- const helperConst = addConstant(ctx, helperFn);
15816
+ const helperConst = addUserConstant(ctx, helperFn);
15300
15817
  const transformedVar = newVar(ctx);
15301
15818
  doc.write(`const ${transformedVar} = ${helperConst}(${inputOutput});`);
15302
15819
  doc.write(`if (${transformedVar} === INVALID) return INVALID;`);
@@ -15314,7 +15831,7 @@ function generateCustomCheck(doc, ctx, schema, accessor) {
15314
15831
  if (isAsyncFunction(def.fn)) {
15315
15832
  throw new ZodCompileAsyncError("z.compile: async custom predicates are not supported");
15316
15833
  }
15317
- const fnConst = addConstant(ctx, def.fn);
15834
+ const fnConst = addUserConstant(ctx, def.fn);
15318
15835
  const throwAsyncConst = addConstant(ctx, throwAsync);
15319
15836
  const resVar = newVar(ctx);
15320
15837
  doc.write(`const ${resVar} = ${fnConst}(${accessor});`);
@@ -15347,7 +15864,7 @@ function generateCatchCheck(doc, ctx, schema, accessor) {
15347
15864
  });
15348
15865
  doc.write(`})();`);
15349
15866
  const innerConst = addConstant(ctx, def.innerType);
15350
- const catchConst = addConstant(ctx, def.catchValue);
15867
+ const catchConst = addUserConstant(ctx, def.catchValue);
15351
15868
  const catchHelperConst = addConstant(ctx, runtimeCatch);
15352
15869
  doc.write(`if (${outputVar} === INVALID) {`);
15353
15870
  doc.indented((d) => {
@@ -15371,7 +15888,7 @@ function generateTransformCheck(doc, ctx, schema, accessor) {
15371
15888
  return INVALID;
15372
15889
  return fakePayload.issues.length === 0 ? result : INVALID;
15373
15890
  };
15374
- const helperConst = addConstant(ctx, helperFn);
15891
+ const helperConst = addUserConstant(ctx, helperFn);
15375
15892
  const outputVar = newVar(ctx);
15376
15893
  doc.write(`const ${outputVar} = ${helperConst}(${accessor});`);
15377
15894
  doc.write(`if (${outputVar} === INVALID) return INVALID;`);
@@ -15381,20 +15898,18 @@ function generateTransformCheck(doc, ctx, schema, accessor) {
15381
15898
  }
15382
15899
 
15383
15900
  // node_modules/zod/v4/core/api.js
15901
+ function snapshotChecks(def) {
15902
+ if (def.checks)
15903
+ def.checks = [...def.checks];
15904
+ return def;
15905
+ }
15384
15906
  // @__NO_SIDE_EFFECTS__
15385
15907
  function _string(Class2, params) {
15386
- return new Class2({
15387
- type: "string",
15388
- ...normalizeParams(params)
15389
- });
15908
+ return new Class2(snapshotChecks({ type: "string", ...normalizeParams(params) }));
15390
15909
  }
15391
15910
  // @__NO_SIDE_EFFECTS__
15392
15911
  function _coercedString(Class2, params) {
15393
- return new Class2({
15394
- type: "string",
15395
- coerce: true,
15396
- ...normalizeParams(params)
15397
- });
15912
+ return new Class2(snapshotChecks({ type: "string", coerce: true, ...normalizeParams(params) }));
15398
15913
  }
15399
15914
  // @__NO_SIDE_EFFECTS__
15400
15915
  function _email(Class2, params) {
@@ -15630,6 +16145,16 @@ function _creditCard(Class2, params) {
15630
16145
  });
15631
16146
  }
15632
16147
  // @__NO_SIDE_EFFECTS__
16148
+ function _iban(Class2, params) {
16149
+ return new Class2({
16150
+ type: "string",
16151
+ format: "iban",
16152
+ check: "string_format",
16153
+ abort: false,
16154
+ ...normalizeParams(params)
16155
+ });
16156
+ }
16157
+ // @__NO_SIDE_EFFECTS__
15633
16158
  function _jwt(Class2, params) {
15634
16159
  return new Class2({
15635
16160
  type: "string",
@@ -15688,20 +16213,11 @@ function _isoDuration(Class2, params) {
15688
16213
  }
15689
16214
  // @__NO_SIDE_EFFECTS__
15690
16215
  function _number(Class2, params) {
15691
- return new Class2({
15692
- type: "number",
15693
- checks: [],
15694
- ...normalizeParams(params)
15695
- });
16216
+ return new Class2(snapshotChecks({ type: "number", checks: [], ...normalizeParams(params) }));
15696
16217
  }
15697
16218
  // @__NO_SIDE_EFFECTS__
15698
16219
  function _coercedNumber(Class2, params) {
15699
- return new Class2({
15700
- type: "number",
15701
- coerce: true,
15702
- checks: [],
15703
- ...normalizeParams(params)
15704
- });
16220
+ return new Class2(snapshotChecks({ type: "number", coerce: true, checks: [], ...normalizeParams(params) }));
15705
16221
  }
15706
16222
  // @__NO_SIDE_EFFECTS__
15707
16223
  function _int(Class2, params) {
@@ -16043,8 +16559,12 @@ function _property(property, schema, params) {
16043
16559
  });
16044
16560
  }
16045
16561
  // @__NO_SIDE_EFFECTS__
16046
- function _properties(shape) {
16047
- return Object.entries(shape).map(([property, schema]) => new $ZodCheckProperty({ check: "property", property, schema }));
16562
+ function _properties(shape, params) {
16563
+ return new $ZodCheckProperties({
16564
+ check: "properties",
16565
+ shape,
16566
+ ...normalizeParams(params)
16567
+ });
16048
16568
  }
16049
16569
  // @__NO_SIDE_EFFECTS__
16050
16570
  function _mime(types, params) {
@@ -16481,7 +17001,7 @@ function handleUnrepresentable(schema, ctx, json2, params, message) {
16481
17001
  Object.assign(json2, result);
16482
17002
  return true;
16483
17003
  }
16484
- function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
17004
+ function processSchema(schema, ctx, _params = { path: [], schemaPath: [] }) {
16485
17005
  var _a3;
16486
17006
  const def = schema._zod.def;
16487
17007
  const seen = ctx.seen.get(schema);
@@ -16520,7 +17040,7 @@ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
16520
17040
  if (parent) {
16521
17041
  if (!result.ref)
16522
17042
  result.ref = parent;
16523
- process2(parent, ctx, params);
17043
+ processSchema(parent, ctx, params);
16524
17044
  ctx.seen.get(parent).isParent = true;
16525
17045
  }
16526
17046
  }
@@ -16627,7 +17147,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16627
17147
  if (seen.count > 1) {
16628
17148
  if (ctx.reused === "ref") {
16629
17149
  extractToDef(entry);
16630
- continue;
16631
17150
  }
16632
17151
  }
16633
17152
  }
@@ -16955,19 +17474,107 @@ function isTransforming(_schema, _ctx) {
16955
17474
  }
16956
17475
  var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
16957
17476
  const ctx = initializeContext({ ...params, processors });
16958
- process2(schema, ctx);
17477
+ processSchema(schema, ctx);
16959
17478
  extractDefs(ctx, schema);
16960
17479
  return finalize(ctx, schema);
16961
17480
  };
16962
17481
  var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
16963
17482
  const { libraryOptions, target } = params ?? {};
16964
17483
  const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
16965
- process2(schema, ctx);
17484
+ processSchema(schema, ctx);
16966
17485
  extractDefs(ctx, schema);
16967
17486
  return finalize(ctx, schema);
16968
17487
  };
16969
17488
 
16970
17489
  // node_modules/zod/v4/core/json-schema-processors.js
17490
+ var narrowMin = (agg, key, value) => {
17491
+ if (agg[key] === void 0 || value > agg[key])
17492
+ agg[key] = value;
17493
+ };
17494
+ var narrowMax = (agg, key, value) => {
17495
+ if (agg[key] === void 0 || value < agg[key])
17496
+ agg[key] = value;
17497
+ };
17498
+ var narrowBoth = (agg, value) => {
17499
+ narrowMin(agg, "minimum", value);
17500
+ narrowMax(agg, "maximum", value);
17501
+ };
17502
+ var addDivisor = (agg, value) => {
17503
+ agg.multipleOf ?? (agg.multipleOf = []);
17504
+ if (!agg.multipleOf.includes(value))
17505
+ agg.multipleOf.push(value);
17506
+ };
17507
+ var addPattern = (agg, pattern) => {
17508
+ agg.patterns ?? (agg.patterns = /* @__PURE__ */ new Set());
17509
+ agg.patterns.add(pattern);
17510
+ };
17511
+ var intersectMime = (agg, mime) => {
17512
+ agg.mime = agg.mime ? agg.mime.filter((m) => mime.includes(m)) : [...mime];
17513
+ };
17514
+ var setFormat = (agg, format) => {
17515
+ agg.format = format;
17516
+ if (format.includes("int"))
17517
+ agg.isInt = true;
17518
+ };
17519
+ var minContributor = (agg, def) => narrowMin(agg, "minimum", def.minimum);
17520
+ var maxContributor = (agg, def) => narrowMax(agg, "maximum", def.maximum);
17521
+ var formatContributor = (ranges) => (agg, def) => {
17522
+ setFormat(agg, def.format);
17523
+ const [minimum, maximum] = ranges[def.format];
17524
+ narrowMin(agg, "minimum", minimum);
17525
+ narrowMax(agg, "maximum", maximum);
17526
+ };
17527
+ var contributors = {
17528
+ greater_than: (agg, def) => narrowMin(agg, def.inclusive ? "minimum" : "exclusiveMinimum", def.value),
17529
+ less_than: (agg, def) => narrowMax(agg, def.inclusive ? "maximum" : "exclusiveMaximum", def.value),
17530
+ multiple_of: (agg, def) => addDivisor(agg, def.value),
17531
+ number_format: formatContributor(NUMBER_FORMAT_RANGES),
17532
+ bigint_format: formatContributor(BIGINT_FORMAT_RANGES),
17533
+ min_length: minContributor,
17534
+ max_length: maxContributor,
17535
+ length_equals: (agg, def) => narrowBoth(agg, def.length),
17536
+ min_size: minContributor,
17537
+ max_size: maxContributor,
17538
+ size_equals: (agg, def) => narrowBoth(agg, def.size),
17539
+ string_format: (agg, def) => {
17540
+ setFormat(agg, def.format);
17541
+ if (def.pattern)
17542
+ addPattern(agg, def.pattern);
17543
+ if (def.format === "base64" || def.format === "base64url")
17544
+ agg.contentEncoding = def.format;
17545
+ if (def.local || def.precision === -1)
17546
+ agg.laxFormat = true;
17547
+ },
17548
+ mime_type: (agg, def) => intersectMime(agg, def.mime)
17549
+ };
17550
+ function aggregateChecks(schema) {
17551
+ const agg = {};
17552
+ const def = schema._zod.def;
17553
+ const list = schema._zod.traits.has("$ZodCheck") ? [schema, ...def.checks ?? []] : def.checks ?? [];
17554
+ for (const ch of list)
17555
+ contributors[ch._zod.def.check]?.(agg, ch._zod.def);
17556
+ const bag = schema._zod.bag;
17557
+ if (bag.minimum !== void 0)
17558
+ narrowMin(agg, "minimum", bag.minimum);
17559
+ if (bag.exclusiveMinimum !== void 0)
17560
+ narrowMin(agg, "exclusiveMinimum", bag.exclusiveMinimum);
17561
+ if (bag.maximum !== void 0)
17562
+ narrowMax(agg, "maximum", bag.maximum);
17563
+ if (bag.exclusiveMaximum !== void 0)
17564
+ narrowMax(agg, "exclusiveMaximum", bag.exclusiveMaximum);
17565
+ if (bag.multipleOf !== void 0)
17566
+ addDivisor(agg, bag.multipleOf);
17567
+ if (bag.format !== void 0) {
17568
+ agg.format ?? (agg.format = bag.format);
17569
+ if (bag.format.includes("int"))
17570
+ agg.isInt = true;
17571
+ }
17572
+ if (bag.mime)
17573
+ intersectMime(agg, bag.mime);
17574
+ for (const pattern of bag.patterns ?? [])
17575
+ addPattern(agg, pattern);
17576
+ return agg;
17577
+ }
16971
17578
  var formatMap = {
16972
17579
  guid: "uuid",
16973
17580
  url: "uri",
@@ -16976,10 +17583,15 @@ var formatMap = {
16976
17583
  regex: ""
16977
17584
  // do not set
16978
17585
  };
17586
+ var exactPatterns = /* @__PURE__ */ new Map([
17587
+ [base64Charset, base64],
17588
+ [base64urlCharset, base64url]
17589
+ ]);
17590
+ var exactPattern = (p) => exactPatterns.get(p) ?? p;
16979
17591
  var stringProcessor = (schema, ctx, _json, _params) => {
16980
17592
  const json2 = _json;
16981
17593
  json2.type = "string";
16982
- const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = schema._zod.bag;
17594
+ const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = aggregateChecks(schema);
16983
17595
  if (typeof minimum === "number")
16984
17596
  json2.minLength = minimum;
16985
17597
  if (typeof maximum === "number")
@@ -16995,7 +17607,7 @@ var stringProcessor = (schema, ctx, _json, _params) => {
16995
17607
  if (contentEncoding)
16996
17608
  json2.contentEncoding = contentEncoding;
16997
17609
  if (patterns && patterns.size > 0) {
16998
- const patternList = [...patterns];
17610
+ const patternList = [...patterns].map(exactPattern);
16999
17611
  if (patternList.length === 1)
17000
17612
  json2.pattern = patternList[0].source;
17001
17613
  else if (patternList.length > 1) {
@@ -17010,11 +17622,8 @@ var stringProcessor = (schema, ctx, _json, _params) => {
17010
17622
  };
17011
17623
  var numberProcessor = (schema, ctx, _json, params) => {
17012
17624
  const json2 = _json;
17013
- const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
17014
- if (typeof format === "string" && format.includes("int"))
17015
- json2.type = "integer";
17016
- else
17017
- json2.type = "number";
17625
+ const { minimum, maximum, multipleOf, exclusiveMaximum, exclusiveMinimum, isInt } = aggregateChecks(schema);
17626
+ json2.type = isInt ? "integer" : "number";
17018
17627
  const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
17019
17628
  const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
17020
17629
  const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
@@ -17038,11 +17647,19 @@ var numberProcessor = (schema, ctx, _json, params) => {
17038
17647
  } else if (typeof maximum === "number") {
17039
17648
  json2.maximum = maximum;
17040
17649
  }
17041
- if (typeof multipleOf === "number") {
17042
- if (Number.isFinite(multipleOf) && multipleOf !== 0)
17043
- json2.multipleOf = Math.abs(multipleOf);
17044
- else
17045
- handleUnrepresentable(schema, ctx, json2, params, `A multipleOf divisor of ${multipleOf} cannot be represented in JSON Schema`);
17650
+ if (multipleOf) {
17651
+ const divisors = /* @__PURE__ */ new Set();
17652
+ for (const divisor of multipleOf) {
17653
+ if (Number.isFinite(divisor) && divisor !== 0)
17654
+ divisors.add(Math.abs(divisor));
17655
+ else
17656
+ handleUnrepresentable(schema, ctx, json2, params, `A multipleOf divisor of ${divisor} cannot be represented in JSON Schema`);
17657
+ }
17658
+ const [first, ...rest] = divisors;
17659
+ if (first !== void 0)
17660
+ json2.multipleOf = first;
17661
+ if (rest.length)
17662
+ json2.allOf = [...json2.allOf ?? [], ...rest.map((m) => ({ multipleOf: m }))];
17046
17663
  }
17047
17664
  };
17048
17665
  var booleanProcessor = (_schema, _ctx, json2, _params) => {
@@ -17145,27 +17762,22 @@ var templateLiteralProcessor = (schema, _ctx, json2, _params) => {
17145
17762
  };
17146
17763
  var fileProcessor = (schema, _ctx, json2, _params) => {
17147
17764
  const _json = json2;
17148
- const file2 = {
17149
- type: "string",
17150
- format: "binary",
17151
- contentEncoding: "binary"
17152
- };
17153
- const { minimum, maximum, mime } = schema._zod.bag;
17765
+ _json.type = "string";
17766
+ _json.format = "binary";
17767
+ _json.contentEncoding = "binary";
17768
+ const { minimum, maximum, mime } = aggregateChecks(schema);
17154
17769
  if (minimum !== void 0)
17155
- file2.minLength = minimum;
17770
+ _json.minLength = minimum;
17156
17771
  if (maximum !== void 0)
17157
- file2.maxLength = maximum;
17158
- if (mime) {
17159
- if (mime.length === 1) {
17160
- file2.contentMediaType = mime[0];
17161
- Object.assign(_json, file2);
17162
- } else {
17163
- Object.assign(_json, file2);
17164
- _json.anyOf = mime.map((m) => ({ contentMediaType: m }));
17165
- }
17166
- } else {
17167
- Object.assign(_json, file2);
17168
- }
17772
+ _json.maxLength = maximum;
17773
+ if (!mime)
17774
+ return;
17775
+ if (mime.length === 0)
17776
+ _json.not = {};
17777
+ else if (mime.length === 1)
17778
+ _json.contentMediaType = mime[0];
17779
+ else
17780
+ _json.anyOf = mime.map((m) => ({ contentMediaType: m }));
17169
17781
  };
17170
17782
  var successProcessor = (_schema, _ctx, json2, _params) => {
17171
17783
  json2.type = "boolean";
@@ -17188,13 +17800,13 @@ var setProcessor = (schema, ctx, json2, params) => {
17188
17800
  var arrayProcessor = (schema, ctx, _json, params) => {
17189
17801
  const json2 = _json;
17190
17802
  const def = schema._zod.def;
17191
- const { minimum, maximum } = schema._zod.bag;
17803
+ const { minimum, maximum } = aggregateChecks(schema);
17192
17804
  if (typeof minimum === "number")
17193
17805
  json2.minItems = minimum;
17194
17806
  if (typeof maximum === "number")
17195
17807
  json2.maxItems = maximum;
17196
17808
  json2.type = "array";
17197
- json2.items = process2(def.element, ctx, {
17809
+ json2.items = processSchema(def.element, ctx, {
17198
17810
  ...params,
17199
17811
  path: [...params.path, "items"]
17200
17812
  });
@@ -17220,22 +17832,20 @@ var objectProcessor = (schema, ctx, _json, params) => {
17220
17832
  json2.type = "object";
17221
17833
  json2.properties = {};
17222
17834
  for (const key in shape) {
17223
- assignProp(json2.properties, key, process2(shape[key], ctx, {
17835
+ assignProp(json2.properties, key, processSchema(shape[key], ctx, {
17224
17836
  ...params,
17225
17837
  path: [...params.path, "properties", key]
17226
17838
  }));
17227
17839
  }
17228
- const allKeys = new Set(Object.keys(shape));
17229
- const requiredKeys = new Set([...allKeys].filter((key) => {
17840
+ const requiredKeys = [];
17841
+ for (const key of Object.keys(shape)) {
17230
17842
  const field = def.shape[key];
17231
- if (ctx.io === "input") {
17232
- return inputOptin(field) === void 0;
17233
- } else {
17234
- return field._zod.optout === void 0;
17843
+ if (ctx.io === "input" ? inputOptin(field) === void 0 : field._zod.optout === void 0) {
17844
+ requiredKeys.push(key);
17235
17845
  }
17236
- }));
17237
- if (requiredKeys.size > 0) {
17238
- json2.required = Array.from(requiredKeys);
17846
+ }
17847
+ if (requiredKeys.length > 0) {
17848
+ json2.required = requiredKeys;
17239
17849
  }
17240
17850
  if (def.catchall?._zod.def.type === "never") {
17241
17851
  json2.additionalProperties = false;
@@ -17243,7 +17853,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
17243
17853
  if (ctx.io === "output")
17244
17854
  json2.additionalProperties = false;
17245
17855
  } else if (def.catchall) {
17246
- json2.additionalProperties = process2(def.catchall, ctx, {
17856
+ json2.additionalProperties = processSchema(def.catchall, ctx, {
17247
17857
  ...params,
17248
17858
  path: [...params.path, "additionalProperties"]
17249
17859
  });
@@ -17252,7 +17862,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
17252
17862
  var unionProcessor = (schema, ctx, json2, params) => {
17253
17863
  const def = schema._zod.def;
17254
17864
  const isExclusive = def.inclusive === false;
17255
- const options = def.options.map((x, i) => process2(x, ctx, {
17865
+ const options = def.options.map((x, i) => processSchema(x, ctx, {
17256
17866
  ...params,
17257
17867
  path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
17258
17868
  }));
@@ -17264,11 +17874,11 @@ var unionProcessor = (schema, ctx, json2, params) => {
17264
17874
  };
17265
17875
  var intersectionProcessor = (schema, ctx, json2, params) => {
17266
17876
  const def = schema._zod.def;
17267
- const a = process2(def.left, ctx, {
17877
+ const a = processSchema(def.left, ctx, {
17268
17878
  ...params,
17269
17879
  path: [...params.path, "allOf", 0]
17270
17880
  });
17271
- const b = process2(def.right, ctx, {
17881
+ const b = processSchema(def.right, ctx, {
17272
17882
  ...params,
17273
17883
  path: [...params.path, "allOf", 1]
17274
17884
  });
@@ -17286,11 +17896,11 @@ var tupleProcessor = (schema, ctx, _json, params) => {
17286
17896
  json2.type = "array";
17287
17897
  const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
17288
17898
  const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
17289
- const prefixItems = def.items.map((x, i) => process2(x, ctx, {
17899
+ const prefixItems = def.items.map((x, i) => processSchema(x, ctx, {
17290
17900
  ...params,
17291
17901
  path: [...params.path, prefixPath, i]
17292
17902
  }));
17293
- const rest = def.rest ? process2(def.rest, ctx, {
17903
+ const rest = def.rest ? processSchema(def.rest, ctx, {
17294
17904
  ...params,
17295
17905
  path: [...params.path, restPath, ...ctx.target === "openapi-3.0" ? [def.items.length] : []]
17296
17906
  }) : null;
@@ -17338,7 +17948,7 @@ var tupleProcessor = (schema, ctx, _json, params) => {
17338
17948
  if (isClosed)
17339
17949
  json2.maxItems = maxItems;
17340
17950
  }
17341
- const { minimum, maximum } = schema._zod.bag;
17951
+ const { minimum, maximum } = aggregateChecks(schema);
17342
17952
  if (typeof minimum === "number")
17343
17953
  json2.minItems = minimum;
17344
17954
  if (typeof maximum === "number")
@@ -17412,20 +18022,19 @@ var recordProcessor = (schema, ctx, _json, params) => {
17412
18022
  const def = schema._zod.def;
17413
18023
  json2.type = "object";
17414
18024
  const keyType = def.keyType;
17415
- const keyBag = keyType._zod.bag;
17416
- const patterns = keyBag?.patterns;
18025
+ const patterns = aggregateChecks(keyType).patterns;
17417
18026
  if (def.mode === "loose" && patterns && patterns.size > 0) {
17418
- const valueSchema = process2(def.valueType, ctx, {
18027
+ const valueSchema = processSchema(def.valueType, ctx, {
17419
18028
  ...params,
17420
18029
  path: [...params.path, "patternProperties", "*"]
17421
18030
  });
17422
18031
  json2.patternProperties = {};
17423
18032
  for (const pattern of patterns) {
17424
- assignProp(json2.patternProperties, pattern.source, valueSchema);
18033
+ assignProp(json2.patternProperties, exactPattern(pattern).source, valueSchema);
17425
18034
  }
17426
18035
  } else {
17427
18036
  if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
17428
- json2.propertyNames = process2(def.keyType, ctx, {
18037
+ json2.propertyNames = processSchema(def.keyType, ctx, {
17429
18038
  ...params,
17430
18039
  path: [...params.path, "propertyNames"]
17431
18040
  });
@@ -17437,7 +18046,7 @@ var recordProcessor = (schema, ctx, _json, params) => {
17437
18046
  }
17438
18047
  pending.push(schema);
17439
18048
  }
17440
- json2.additionalProperties = process2(def.valueType, ctx, {
18049
+ json2.additionalProperties = processSchema(def.valueType, ctx, {
17441
18050
  ...params,
17442
18051
  path: [...params.path, "additionalProperties"]
17443
18052
  });
@@ -17453,7 +18062,7 @@ var recordProcessor = (schema, ctx, _json, params) => {
17453
18062
  };
17454
18063
  var nullableProcessor = (schema, ctx, json2, params) => {
17455
18064
  const def = schema._zod.def;
17456
- const inner = process2(def.innerType, ctx, params);
18065
+ const inner = processSchema(def.innerType, ctx, params);
17457
18066
  const seen = ctx.seen.get(schema);
17458
18067
  if (ctx.target === "openapi-3.0") {
17459
18068
  seen.ref = def.innerType;
@@ -17464,7 +18073,7 @@ var nullableProcessor = (schema, ctx, json2, params) => {
17464
18073
  };
17465
18074
  var nonoptionalProcessor = (schema, ctx, _json, params) => {
17466
18075
  const def = schema._zod.def;
17467
- process2(def.innerType, ctx, params);
18076
+ processSchema(def.innerType, ctx, params);
17468
18077
  const seen = ctx.seen.get(schema);
17469
18078
  seen.ref = def.innerType;
17470
18079
  };
@@ -17484,7 +18093,7 @@ function serializeDefaultValue(value, schema, ctx, json2, params) {
17484
18093
  }
17485
18094
  var defaultProcessor = (schema, ctx, json2, params) => {
17486
18095
  const def = schema._zod.def;
17487
- process2(def.innerType, ctx, params);
18096
+ processSchema(def.innerType, ctx, params);
17488
18097
  const seen = ctx.seen.get(schema);
17489
18098
  seen.ref = def.innerType;
17490
18099
  const value = serializeDefaultValue(def.defaultValue, schema, ctx, json2, params);
@@ -17493,7 +18102,7 @@ var defaultProcessor = (schema, ctx, json2, params) => {
17493
18102
  };
17494
18103
  var prefaultProcessor = (schema, ctx, json2, params) => {
17495
18104
  const def = schema._zod.def;
17496
- process2(def.innerType, ctx, params);
18105
+ processSchema(def.innerType, ctx, params);
17497
18106
  const seen = ctx.seen.get(schema);
17498
18107
  seen.ref = def.innerType;
17499
18108
  if (ctx.io !== "input")
@@ -17504,7 +18113,7 @@ var prefaultProcessor = (schema, ctx, json2, params) => {
17504
18113
  };
17505
18114
  var catchProcessor = (schema, ctx, json2, params) => {
17506
18115
  const def = schema._zod.def;
17507
- process2(def.innerType, ctx, params);
18116
+ processSchema(def.innerType, ctx, params);
17508
18117
  const seen = ctx.seen.get(schema);
17509
18118
  seen.ref = def.innerType;
17510
18119
  let catchValue;
@@ -17520,32 +18129,32 @@ var pipeProcessor = (schema, ctx, _json, params) => {
17520
18129
  const def = schema._zod.def;
17521
18130
  const inIsTransform = def.in._zod.traits.has("$ZodTransform");
17522
18131
  const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
17523
- process2(innerType, ctx, params);
18132
+ processSchema(innerType, ctx, params);
17524
18133
  const seen = ctx.seen.get(schema);
17525
18134
  seen.ref = innerType;
17526
18135
  };
17527
18136
  var readonlyProcessor = (schema, ctx, json2, params) => {
17528
18137
  const def = schema._zod.def;
17529
- process2(def.innerType, ctx, params);
18138
+ processSchema(def.innerType, ctx, params);
17530
18139
  const seen = ctx.seen.get(schema);
17531
18140
  seen.ref = def.innerType;
17532
18141
  json2.readOnly = true;
17533
18142
  };
17534
18143
  var promiseProcessor = (schema, ctx, _json, params) => {
17535
18144
  const def = schema._zod.def;
17536
- process2(def.innerType, ctx, params);
18145
+ processSchema(def.innerType, ctx, params);
17537
18146
  const seen = ctx.seen.get(schema);
17538
18147
  seen.ref = def.innerType;
17539
18148
  };
17540
18149
  var optionalProcessor = (schema, ctx, _json, params) => {
17541
18150
  const def = schema._zod.def;
17542
- process2(def.innerType, ctx, params);
18151
+ processSchema(def.innerType, ctx, params);
17543
18152
  const seen = ctx.seen.get(schema);
17544
18153
  seen.ref = def.innerType;
17545
18154
  };
17546
18155
  var lazyProcessor = (schema, ctx, _json, params) => {
17547
18156
  const innerType = schema._zod.innerType;
17548
- process2(innerType, ctx, params);
18157
+ processSchema(innerType, ctx, params);
17549
18158
  const seen = ctx.seen.get(schema);
17550
18159
  seen.ref = innerType;
17551
18160
  };
@@ -17597,7 +18206,7 @@ function toJSONSchema(input2, params) {
17597
18206
  const defs = {};
17598
18207
  for (const entry of registry2._idmap.entries()) {
17599
18208
  const [_, schema] = entry;
17600
- process2(schema, ctx2);
18209
+ processSchema(schema, ctx2);
17601
18210
  }
17602
18211
  const schemas = {};
17603
18212
  const external = {
@@ -17620,7 +18229,7 @@ function toJSONSchema(input2, params) {
17620
18229
  return { schemas };
17621
18230
  }
17622
18231
  const ctx = initializeContext({ ...params, processors: allProcessors });
17623
- process2(input2, ctx);
18232
+ processSchema(input2, ctx);
17624
18233
  extractDefs(ctx, input2);
17625
18234
  return finalize(ctx, input2);
17626
18235
  }
@@ -17679,7 +18288,7 @@ var JSONSchemaGenerator = class {
17679
18288
  * This must be called before emit().
17680
18289
  */
17681
18290
  process(schema, _params = { path: [], schemaPath: [] }) {
17682
- return process2(schema, this.ctx, _params);
18291
+ return processSchema(schema, this.ctx, _params);
17683
18292
  }
17684
18293
  /**
17685
18294
  * Emit the final JSON Schema after processing.
@@ -17736,12 +18345,14 @@ __export(schemas_exports2, {
17736
18345
  ZodFile: () => ZodFile,
17737
18346
  ZodFunction: () => ZodFunction,
17738
18347
  ZodGUID: () => ZodGUID,
18348
+ ZodIBAN: () => ZodIBAN,
17739
18349
  ZodIPv4: () => ZodIPv4,
17740
18350
  ZodIPv6: () => ZodIPv6,
17741
18351
  ZodISODate: () => ZodISODate,
17742
18352
  ZodISODateTime: () => ZodISODateTime,
17743
18353
  ZodISODuration: () => ZodISODuration,
17744
18354
  ZodISOTime: () => ZodISOTime,
18355
+ ZodInstanceOf: () => ZodInstanceOf,
17745
18356
  ZodIntersection: () => ZodIntersection,
17746
18357
  ZodJWT: () => ZodJWT,
17747
18358
  ZodKSUID: () => ZodKSUID,
@@ -17800,6 +18411,7 @@ __export(schemas_exports2, {
17800
18411
  creditCard: () => creditCard2,
17801
18412
  cuid: () => cuid3,
17802
18413
  cuid2: () => cuid22,
18414
+ currencyCode: () => currencyCode2,
17803
18415
  custom: () => custom,
17804
18416
  date: () => date2,
17805
18417
  describe: () => describe2,
@@ -17818,6 +18430,7 @@ __export(schemas_exports2, {
17818
18430
  hex: () => hex2,
17819
18431
  hostname: () => hostname2,
17820
18432
  httpUrl: () => httpUrl,
18433
+ iban: () => iban2,
17821
18434
  instanceof: () => _instanceof,
17822
18435
  int: () => int,
17823
18436
  int32: () => int32,
@@ -18120,6 +18733,12 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
18120
18733
  set spa(value) {
18121
18734
  util_exports.own(this, "spa", value);
18122
18735
  },
18736
+ validate(data, params) {
18737
+ return validate(this, data, params);
18738
+ },
18739
+ validateAsync(data, params) {
18740
+ return validateAsync(this, data, params);
18741
+ },
18123
18742
  encode: function _encode2(data, params) {
18124
18743
  return encode2(this, data, params, { callee: _encode2 });
18125
18744
  },
@@ -18156,61 +18775,65 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
18156
18775
  return this._zod.def;
18157
18776
  }
18158
18777
  });
18159
- var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
18160
- $ZodString.init(inst, def);
18161
- ZodType.init(inst, def);
18162
- inst._zod.processJSONSchema = (ctx, json2, params) => stringProcessor(inst, ctx, json2, params);
18163
- const bag = inst._zod.bag;
18164
- inst.format = bag.format ?? null;
18165
- inst.minLength = bag.minimum ?? null;
18166
- inst.maxLength = bag.maximum ?? null;
18167
- }, {
18168
- regex(...args) {
18169
- return this.check(_regex(...args));
18170
- },
18171
- includes(...args) {
18172
- return this.check(_includes(...args));
18173
- },
18174
- startsWith(...args) {
18175
- return this.check(_startsWith(...args));
18176
- },
18177
- endsWith(...args) {
18178
- return this.check(_endsWith(...args));
18179
- },
18180
- min(...args) {
18181
- return this.check(_minLength(...args));
18182
- },
18183
- max(...args) {
18184
- return this.check(_maxLength(...args));
18185
- },
18186
- length(...args) {
18187
- return this.check(_length(...args));
18188
- },
18189
- nonempty(...args) {
18190
- return this.check(_minLength(1, ...args));
18778
+ var _ZodString = /* @__PURE__ */ $constructor(
18779
+ "_ZodString",
18780
+ (inst, def) => {
18781
+ $ZodString.init(inst, def);
18782
+ ZodType.init(inst, def);
18783
+ inst._zod.processJSONSchema = (ctx, json2, params) => stringProcessor(inst, ctx, json2, params);
18191
18784
  },
18192
- lowercase(params) {
18193
- return this.check(_lowercase(params));
18194
- },
18195
- uppercase(params) {
18196
- return this.check(_uppercase(params));
18197
- },
18198
- trim() {
18199
- return this.check(_trim());
18200
- },
18201
- normalize(...args) {
18202
- return this.check(_normalize(...args));
18203
- },
18204
- toLowerCase() {
18205
- return this.check(_toLowerCase());
18206
- },
18207
- toUpperCase() {
18208
- return this.check(_toUpperCase());
18209
- },
18210
- slugify() {
18211
- return this.check(_slugify());
18212
- }
18213
- });
18785
+ /* @__PURE__ */ util_exports.derived({
18786
+ format: (inst) => aggregateChecks(inst).format ?? null,
18787
+ minLength: (inst) => aggregateChecks(inst).minimum ?? null,
18788
+ maxLength: (inst) => aggregateChecks(inst).maximum ?? null
18789
+ }, {
18790
+ regex(...args) {
18791
+ return this.check(_regex(...args));
18792
+ },
18793
+ includes(...args) {
18794
+ return this.check(_includes(...args));
18795
+ },
18796
+ startsWith(...args) {
18797
+ return this.check(_startsWith(...args));
18798
+ },
18799
+ endsWith(...args) {
18800
+ return this.check(_endsWith(...args));
18801
+ },
18802
+ min(...args) {
18803
+ return this.check(_minLength(...args));
18804
+ },
18805
+ max(...args) {
18806
+ return this.check(_maxLength(...args));
18807
+ },
18808
+ length(...args) {
18809
+ return this.check(_length(...args));
18810
+ },
18811
+ nonempty(...args) {
18812
+ return this.check(_minLength(1, ...args));
18813
+ },
18814
+ lowercase(params) {
18815
+ return this.check(_lowercase(params));
18816
+ },
18817
+ uppercase(params) {
18818
+ return this.check(_uppercase(params));
18819
+ },
18820
+ trim() {
18821
+ return this.check(_trim());
18822
+ },
18823
+ normalize(...args) {
18824
+ return this.check(_normalize(...args));
18825
+ },
18826
+ toLowerCase() {
18827
+ return this.check(_toLowerCase());
18828
+ },
18829
+ toUpperCase() {
18830
+ return this.check(_toUpperCase());
18831
+ },
18832
+ slugify() {
18833
+ return this.check(_slugify());
18834
+ }
18835
+ })
18836
+ );
18214
18837
  var ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
18215
18838
  $ZodString.init(inst, def);
18216
18839
  _ZodString.init(inst, def);
@@ -18356,8 +18979,8 @@ function url(params) {
18356
18979
  }
18357
18980
  function httpUrl(params) {
18358
18981
  return _url(ZodURL, {
18359
- protocol: regexes_exports.httpProtocol,
18360
- hostname: regexes_exports.domain,
18982
+ protocol: httpProtocol,
18983
+ hostname: domain,
18361
18984
  ...util_exports.normalizeParams(params)
18362
18985
  });
18363
18986
  }
@@ -18473,6 +19096,13 @@ var ZodCreditCard = /* @__PURE__ */ $constructor("ZodCreditCard", (inst, def) =>
18473
19096
  function creditCard2(params) {
18474
19097
  return _creditCard(ZodCreditCard, params);
18475
19098
  }
19099
+ var ZodIBAN = /* @__PURE__ */ $constructor("ZodIBAN", (inst, def) => {
19100
+ $ZodIBAN.init(inst, def);
19101
+ ZodStringFormat.init(inst, def);
19102
+ });
19103
+ function iban2(params) {
19104
+ return _iban(ZodIBAN, params);
19105
+ }
18476
19106
  var ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
18477
19107
  $ZodJWT.init(inst, def);
18478
19108
  ZodStringFormat.init(inst, def);
@@ -18488,10 +19118,13 @@ function stringFormat(format, fnOrRegex, _params = {}) {
18488
19118
  return _stringFormat(ZodCustomStringFormat, format, fnOrRegex, _params);
18489
19119
  }
18490
19120
  function hostname2(_params) {
18491
- return _stringFormat(ZodCustomStringFormat, "hostname", regexes_exports.hostname, _params);
19121
+ return _stringFormat(ZodCustomStringFormat, "hostname", hostname, _params);
18492
19122
  }
18493
19123
  function hex2(_params) {
18494
- return _stringFormat(ZodCustomStringFormat, "hex", regexes_exports.hex, _params);
19124
+ return _stringFormat(ZodCustomStringFormat, "hex", hex, _params);
19125
+ }
19126
+ function currencyCode2(_params) {
19127
+ return _stringFormat(ZodCustomStringFormat, "currency_code", currencyCode, _params);
18495
19128
  }
18496
19129
  function hash(alg, params) {
18497
19130
  const enc = params?.enc ?? "hex";
@@ -18501,63 +19134,76 @@ function hash(alg, params) {
18501
19134
  throw new Error(`Unrecognized hash format: ${format}`);
18502
19135
  return _stringFormat(ZodCustomStringFormat, format, regex, params);
18503
19136
  }
18504
- var ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
18505
- $ZodNumber.init(inst, def);
18506
- ZodType.init(inst, def);
18507
- inst._zod.processJSONSchema = (ctx, json2, params) => numberProcessor(inst, ctx, json2, params);
18508
- const bag = inst._zod.bag;
18509
- inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
18510
- inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
18511
- inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? 0.5);
18512
- inst.isFinite = true;
18513
- inst.format = bag.format ?? null;
18514
- }, {
18515
- gt(value, params) {
18516
- return this.check(_gt(value, params));
18517
- },
18518
- gte(value, params) {
18519
- return this.check(_gte(value, params));
18520
- },
18521
- min(value, params) {
18522
- return this.check(_gte(value, params));
18523
- },
18524
- lt(value, params) {
18525
- return this.check(_lt(value, params));
18526
- },
18527
- lte(value, params) {
18528
- return this.check(_lte(value, params));
18529
- },
18530
- max(value, params) {
18531
- return this.check(_lte(value, params));
18532
- },
18533
- int(params) {
18534
- return this.check(int(params));
18535
- },
18536
- safe(params) {
18537
- return this.check(int(params));
18538
- },
18539
- positive(params) {
18540
- return this.check(_gt(0, params));
18541
- },
18542
- nonnegative(params) {
18543
- return this.check(_gte(0, params));
18544
- },
18545
- negative(params) {
18546
- return this.check(_lt(0, params));
18547
- },
18548
- nonpositive(params) {
18549
- return this.check(_lte(0, params));
19137
+ var ZodNumber = /* @__PURE__ */ $constructor(
19138
+ "ZodNumber",
19139
+ (inst, def) => {
19140
+ $ZodNumber.init(inst, def);
19141
+ ZodType.init(inst, def);
19142
+ inst._zod.processJSONSchema = (ctx, json2, params) => numberProcessor(inst, ctx, json2, params);
19143
+ inst.isFinite = true;
18550
19144
  },
18551
- multipleOf(value, params) {
18552
- return this.check(_multipleOf(value, params));
18553
- },
18554
- step(value, params) {
18555
- return this.check(_multipleOf(value, params));
18556
- },
18557
- finite() {
18558
- return this;
18559
- }
18560
- });
19145
+ /* @__PURE__ */ util_exports.derived({
19146
+ minValue: (inst) => {
19147
+ const { minimum, exclusiveMinimum } = aggregateChecks(inst);
19148
+ return Math.max(minimum ?? Number.NEGATIVE_INFINITY, exclusiveMinimum ?? Number.NEGATIVE_INFINITY);
19149
+ },
19150
+ maxValue: (inst) => {
19151
+ const { maximum, exclusiveMaximum } = aggregateChecks(inst);
19152
+ return Math.min(maximum ?? Number.POSITIVE_INFINITY, exclusiveMaximum ?? Number.POSITIVE_INFINITY);
19153
+ },
19154
+ isInt: (inst) => {
19155
+ const { isInt, multipleOf } = aggregateChecks(inst);
19156
+ return !!isInt || !!multipleOf?.some(Number.isSafeInteger);
19157
+ },
19158
+ format: (inst) => aggregateChecks(inst).format ?? null
19159
+ }, {
19160
+ gt(value, params) {
19161
+ return this.check(_gt(value, params));
19162
+ },
19163
+ gte(value, params) {
19164
+ return this.check(_gte(value, params));
19165
+ },
19166
+ min(value, params) {
19167
+ return this.check(_gte(value, params));
19168
+ },
19169
+ lt(value, params) {
19170
+ return this.check(_lt(value, params));
19171
+ },
19172
+ lte(value, params) {
19173
+ return this.check(_lte(value, params));
19174
+ },
19175
+ max(value, params) {
19176
+ return this.check(_lte(value, params));
19177
+ },
19178
+ int(params) {
19179
+ return this.check(int(params));
19180
+ },
19181
+ safe(params) {
19182
+ return this.check(int(params));
19183
+ },
19184
+ positive(params) {
19185
+ return this.check(_gt(0, params));
19186
+ },
19187
+ nonnegative(params) {
19188
+ return this.check(_gte(0, params));
19189
+ },
19190
+ negative(params) {
19191
+ return this.check(_lt(0, params));
19192
+ },
19193
+ nonpositive(params) {
19194
+ return this.check(_lte(0, params));
19195
+ },
19196
+ multipleOf(value, params) {
19197
+ return this.check(_multipleOf(value, params));
19198
+ },
19199
+ step(value, params) {
19200
+ return this.check(_multipleOf(value, params));
19201
+ },
19202
+ finite() {
19203
+ return this;
19204
+ }
19205
+ })
19206
+ );
18561
19207
  function number2(params) {
18562
19208
  return _number(ZodNumber, params);
18563
19209
  }
@@ -18588,49 +19234,53 @@ var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
18588
19234
  function boolean2(params) {
18589
19235
  return _boolean(ZodBoolean, params);
18590
19236
  }
18591
- var ZodBigInt = /* @__PURE__ */ $constructor("ZodBigInt", (inst, def) => {
18592
- $ZodBigInt.init(inst, def);
18593
- ZodType.init(inst, def);
18594
- inst._zod.processJSONSchema = (ctx, json2, params) => bigintProcessor(inst, ctx, json2, params);
18595
- const bag = inst._zod.bag;
18596
- inst.minValue = bag.minimum ?? null;
18597
- inst.maxValue = bag.maximum ?? null;
18598
- inst.format = bag.format ?? null;
18599
- }, {
18600
- gte(value, params) {
18601
- return this.check(_gte(value, params));
18602
- },
18603
- min(value, params) {
18604
- return this.check(_gte(value, params));
19237
+ var ZodBigInt = /* @__PURE__ */ $constructor(
19238
+ "ZodBigInt",
19239
+ (inst, def) => {
19240
+ $ZodBigInt.init(inst, def);
19241
+ ZodType.init(inst, def);
19242
+ inst._zod.processJSONSchema = (ctx, json2, params) => bigintProcessor(inst, ctx, json2, params);
18605
19243
  },
18606
- gt(value, params) {
18607
- return this.check(_gt(value, params));
18608
- },
18609
- lt(value, params) {
18610
- return this.check(_lt(value, params));
18611
- },
18612
- lte(value, params) {
18613
- return this.check(_lte(value, params));
18614
- },
18615
- max(value, params) {
18616
- return this.check(_lte(value, params));
18617
- },
18618
- positive(params) {
18619
- return this.check(_gt(BigInt(0), params));
18620
- },
18621
- negative(params) {
18622
- return this.check(_lt(BigInt(0), params));
18623
- },
18624
- nonpositive(params) {
18625
- return this.check(_lte(BigInt(0), params));
18626
- },
18627
- nonnegative(params) {
18628
- return this.check(_gte(BigInt(0), params));
18629
- },
18630
- multipleOf(value, params) {
18631
- return this.check(_multipleOf(value, params));
18632
- }
18633
- });
19244
+ /* @__PURE__ */ util_exports.derived({
19245
+ minValue: (inst) => aggregateChecks(inst).minimum ?? null,
19246
+ maxValue: (inst) => aggregateChecks(inst).maximum ?? null,
19247
+ format: (inst) => aggregateChecks(inst).format ?? null
19248
+ }, {
19249
+ gte(value, params) {
19250
+ return this.check(_gte(value, params));
19251
+ },
19252
+ min(value, params) {
19253
+ return this.check(_gte(value, params));
19254
+ },
19255
+ gt(value, params) {
19256
+ return this.check(_gt(value, params));
19257
+ },
19258
+ lt(value, params) {
19259
+ return this.check(_lt(value, params));
19260
+ },
19261
+ lte(value, params) {
19262
+ return this.check(_lte(value, params));
19263
+ },
19264
+ max(value, params) {
19265
+ return this.check(_lte(value, params));
19266
+ },
19267
+ positive(params) {
19268
+ return this.check(_gt(BigInt(0), params));
19269
+ },
19270
+ negative(params) {
19271
+ return this.check(_lt(BigInt(0), params));
19272
+ },
19273
+ nonpositive(params) {
19274
+ return this.check(_lte(BigInt(0), params));
19275
+ },
19276
+ nonnegative(params) {
19277
+ return this.check(_gte(BigInt(0), params));
19278
+ },
19279
+ multipleOf(value, params) {
19280
+ return this.check(_multipleOf(value, params));
19281
+ }
19282
+ })
19283
+ );
18634
19284
  function bigint2(params) {
18635
19285
  return _bigint(ZodBigInt, params);
18636
19286
  }
@@ -18700,16 +19350,26 @@ var ZodVoid = /* @__PURE__ */ $constructor("ZodVoid", (inst, def) => {
18700
19350
  function _void2(params) {
18701
19351
  return _void(ZodVoid, params);
18702
19352
  }
18703
- var ZodDate = /* @__PURE__ */ $constructor("ZodDate", (inst, def) => {
18704
- $ZodDate.init(inst, def);
18705
- ZodType.init(inst, def);
18706
- inst._zod.processJSONSchema = (ctx, json2, params) => dateProcessor(inst, ctx, json2, params);
18707
- inst.min = (value, params) => inst.check(_gte(value, params));
18708
- inst.max = (value, params) => inst.check(_lte(value, params));
18709
- const c = inst._zod.bag;
18710
- inst.minDate = c.minimum ? new Date(c.minimum) : null;
18711
- inst.maxDate = c.maximum ? new Date(c.maximum) : null;
18712
- });
19353
+ var ZodDate = /* @__PURE__ */ $constructor(
19354
+ "ZodDate",
19355
+ (inst, def) => {
19356
+ $ZodDate.init(inst, def);
19357
+ ZodType.init(inst, def);
19358
+ inst._zod.processJSONSchema = (ctx, json2, params) => dateProcessor(inst, ctx, json2, params);
19359
+ inst.min = (value, params) => inst.check(_gte(value, params));
19360
+ inst.max = (value, params) => inst.check(_lte(value, params));
19361
+ },
19362
+ /* @__PURE__ */ util_exports.derived({
19363
+ minDate: (inst) => {
19364
+ const { minimum } = aggregateChecks(inst);
19365
+ return minimum ? new Date(minimum) : null;
19366
+ },
19367
+ maxDate: (inst) => {
19368
+ const { maximum } = aggregateChecks(inst);
19369
+ return maximum ? new Date(maximum) : null;
19370
+ }
19371
+ }, {})
19372
+ );
18713
19373
  function date2(params) {
18714
19374
  return _date(ZodDate, params);
18715
19375
  }
@@ -18754,19 +19414,19 @@ var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
18754
19414
  return _enum2(Object.keys(this._zod.def.shape));
18755
19415
  },
18756
19416
  catchall(catchall) {
18757
- return this.clone({ ...this._zod.def, catchall });
19417
+ return this.clone(util_exports.mergeDefs(this._zod.def, { catchall }));
18758
19418
  },
18759
19419
  passthrough() {
18760
- return this.clone({ ...this._zod.def, catchall: unknown() });
19420
+ return this.clone(util_exports.mergeDefs(this._zod.def, { catchall: unknown() }));
18761
19421
  },
18762
19422
  loose() {
18763
- return this.clone({ ...this._zod.def, catchall: unknown() });
19423
+ return this.clone(util_exports.mergeDefs(this._zod.def, { catchall: unknown() }));
18764
19424
  },
18765
19425
  strict() {
18766
- return this.clone({ ...this._zod.def, catchall: never() });
19426
+ return this.clone(util_exports.mergeDefs(this._zod.def, { catchall: never() }));
18767
19427
  },
18768
19428
  strip() {
18769
- return this.clone({ ...this._zod.def, catchall: void 0 });
19429
+ return this.clone(util_exports.mergeDefs(this._zod.def, { catchall: void 0 }));
18770
19430
  },
18771
19431
  extend(incoming) {
18772
19432
  return util_exports.extend(this, incoming);
@@ -18985,7 +19645,7 @@ var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
18985
19645
  ZodType.init(inst, def);
18986
19646
  inst._zod.processJSONSchema = (ctx, json2, params) => enumProcessor(inst, ctx, json2, params);
18987
19647
  inst.enum = def.entries;
18988
- inst.options = Object.values(def.entries);
19648
+ inst.options = [...inst._zod.values];
18989
19649
  const keys = new Set(Object.keys(def.entries));
18990
19650
  inst.extract = (values, params) => {
18991
19651
  const newEntries = {};
@@ -19348,8 +20008,15 @@ function superRefine(fn, params) {
19348
20008
  }
19349
20009
  var describe2 = describe;
19350
20010
  var meta2 = meta;
20011
+ var ZodInstanceOf = /* @__PURE__ */ $constructor("ZodInstanceOf", (inst, def) => {
20012
+ ZodCustom.init(inst, def);
20013
+ }, {
20014
+ properties(shape, params) {
20015
+ return this.check(_properties(shape, params));
20016
+ }
20017
+ });
19351
20018
  function _instanceof(cls, params = {}) {
19352
- const inst = new ZodCustom({
20019
+ const inst = new ZodInstanceOf({
19353
20020
  type: "custom",
19354
20021
  check: "custom",
19355
20022
  fn: (data) => data instanceof cls,
@@ -19554,27 +20221,188 @@ function resolveRef(ref, ctx) {
19554
20221
  }
19555
20222
  throw new Error(`Reference not found: ${ref}`);
19556
20223
  }
19557
- function checkPropertyNames(objectSchema, keySchema) {
20224
+ function checkObjectGuards(objectSchema, guards) {
19558
20225
  const guard = z.transform((value) => value).check((payload) => {
19559
20226
  const value = payload.value;
19560
20227
  if (typeof value !== "object" || value === null || Array.isArray(value))
19561
20228
  return;
19562
- for (const key of Object.getOwnPropertyNames(value)) {
19563
- const result = keySchema.safeParse(key);
19564
- if (result.success)
19565
- continue;
20229
+ const keys = Object.getOwnPropertyNames(value);
20230
+ if (guards.minProperties !== void 0 && keys.length < guards.minProperties) {
19566
20231
  payload.issues.push({
19567
- code: "invalid_key",
19568
- origin: "record",
19569
- issues: result.error.issues,
19570
- input: key,
19571
- path: [key],
20232
+ origin: "object",
20233
+ code: "too_small",
20234
+ minimum: guards.minProperties,
20235
+ inclusive: true,
20236
+ message: `Too small: expected object to have >=${guards.minProperties} properties`,
20237
+ input: value,
20238
+ inst: objectSchema,
19572
20239
  continue: true
19573
20240
  });
19574
20241
  }
20242
+ if (guards.maxProperties !== void 0 && keys.length > guards.maxProperties) {
20243
+ payload.issues.push({
20244
+ origin: "object",
20245
+ code: "too_big",
20246
+ maximum: guards.maxProperties,
20247
+ inclusive: true,
20248
+ message: `Too big: expected object to have <=${guards.maxProperties} properties`,
20249
+ input: value,
20250
+ inst: objectSchema,
20251
+ continue: true
20252
+ });
20253
+ }
20254
+ if (guards.keySchema) {
20255
+ for (const key of keys) {
20256
+ const result = guards.keySchema.safeParse(key);
20257
+ if (result.success)
20258
+ continue;
20259
+ payload.issues.push({
20260
+ code: "invalid_key",
20261
+ origin: "record",
20262
+ issues: result.error.issues,
20263
+ input: key,
20264
+ path: [key],
20265
+ continue: true
20266
+ });
20267
+ }
20268
+ }
19575
20269
  });
19576
20270
  return guard.pipe(objectSchema);
19577
20271
  }
20272
+ function canonicalKey(value, seen) {
20273
+ if (value === null)
20274
+ return "z";
20275
+ const type = typeof value;
20276
+ if (type !== "object") {
20277
+ if (type === "number" && Number.isNaN(value))
20278
+ return null;
20279
+ const raw = String(value);
20280
+ return `${type[0]}${raw.length}:${raw}`;
20281
+ }
20282
+ if (seen.has(value))
20283
+ return null;
20284
+ seen.add(value);
20285
+ try {
20286
+ if (Array.isArray(value)) {
20287
+ const parts2 = [];
20288
+ for (const item of value) {
20289
+ const key = canonicalKey(item, seen);
20290
+ if (key === null)
20291
+ return null;
20292
+ parts2.push(key);
20293
+ }
20294
+ return `a${parts2.length}:[${parts2.join(",")}]`;
20295
+ }
20296
+ const keys = Object.keys(value).sort();
20297
+ const parts = [];
20298
+ for (const k of keys) {
20299
+ const key = canonicalKey(value[k], seen);
20300
+ if (key === null)
20301
+ return null;
20302
+ parts.push(`${k.length}:${k}=${key}`);
20303
+ }
20304
+ return `o${parts.length}:{${parts.join(",")}}`;
20305
+ } finally {
20306
+ seen.delete(value);
20307
+ }
20308
+ }
20309
+ var SCHEMA_KEYWORDS = /* @__PURE__ */ new Set([
20310
+ "items",
20311
+ "prefixItems",
20312
+ "additionalItems",
20313
+ "additionalProperties",
20314
+ "contains",
20315
+ "propertyNames",
20316
+ "not",
20317
+ "if",
20318
+ "then",
20319
+ "else",
20320
+ "allOf",
20321
+ "anyOf",
20322
+ "oneOf",
20323
+ "unevaluatedItems",
20324
+ "unevaluatedProperties",
20325
+ "contentSchema"
20326
+ ]);
20327
+ var SCHEMA_MAP_KEYWORDS = /* @__PURE__ */ new Set([
20328
+ "properties",
20329
+ "patternProperties",
20330
+ "dependentSchemas",
20331
+ "dependencies",
20332
+ "$defs",
20333
+ "definitions"
20334
+ ]);
20335
+ function containsRef(value) {
20336
+ if (typeof value !== "object" || value === null)
20337
+ return false;
20338
+ if (Array.isArray(value))
20339
+ return value.some(containsRef);
20340
+ if (typeof value.$ref === "string")
20341
+ return true;
20342
+ return Object.entries(value).some(([key, sub]) => {
20343
+ if (SCHEMA_KEYWORDS.has(key))
20344
+ return containsRef(sub);
20345
+ if (!SCHEMA_MAP_KEYWORDS.has(key) || typeof sub !== "object" || sub === null)
20346
+ return false;
20347
+ return Object.values(sub).some(containsRef);
20348
+ });
20349
+ }
20350
+ function plural(n) {
20351
+ return n === 1 ? "element" : "elements";
20352
+ }
20353
+ function checkArrayGuards(arraySchema, guards) {
20354
+ const guard = z.transform((value) => value).check((payload) => {
20355
+ const items = payload.value;
20356
+ if (!Array.isArray(items))
20357
+ return;
20358
+ if (guards.uniqueItems === true) {
20359
+ const firstSeen = /* @__PURE__ */ new Map();
20360
+ for (let i = 0; i < items.length; i++) {
20361
+ const key = canonicalKey(items[i], /* @__PURE__ */ new Set());
20362
+ if (key === null)
20363
+ continue;
20364
+ const first = firstSeen.get(key);
20365
+ if (first === void 0) {
20366
+ firstSeen.set(key, i);
20367
+ continue;
20368
+ }
20369
+ payload.issues.push({
20370
+ code: "custom",
20371
+ message: `Array items must be unique: element at index ${i} duplicates the one at index ${first}`,
20372
+ input: items,
20373
+ path: [i],
20374
+ continue: true
20375
+ });
20376
+ }
20377
+ }
20378
+ if (guards.containsSchema) {
20379
+ const minContains = guards.minContains ?? 1;
20380
+ const ceiling = guards.maxContains !== void 0 ? guards.maxContains + 1 : Number.POSITIVE_INFINITY;
20381
+ let matches = 0;
20382
+ for (const item of items) {
20383
+ if (guards.containsSchema.safeParse(item).success && ++matches >= ceiling)
20384
+ break;
20385
+ }
20386
+ if (matches < minContains) {
20387
+ payload.issues.push({
20388
+ code: "custom",
20389
+ message: `Array must contain at least ${minContains} matching ${plural(minContains)}; found ${matches}`,
20390
+ input: items,
20391
+ continue: true
20392
+ });
20393
+ }
20394
+ if (guards.maxContains !== void 0 && matches > guards.maxContains) {
20395
+ payload.issues.push({
20396
+ code: "custom",
20397
+ message: `Array must contain at most ${guards.maxContains} matching ${plural(guards.maxContains)}`,
20398
+ input: items,
20399
+ continue: true
20400
+ });
20401
+ }
20402
+ }
20403
+ });
20404
+ return guard.pipe(arraySchema);
20405
+ }
19578
20406
  function getTupleRest(restSchema, ctx) {
19579
20407
  if (restSchema === false) {
19580
20408
  return void 0;
@@ -19704,6 +20532,8 @@ function convertBaseSchema(schema, ctx) {
19704
20532
  stringSchema = stringSchema.check(z.e164());
19705
20533
  } else if (format === "credit_card") {
19706
20534
  stringSchema = stringSchema.check(z.creditCard());
20535
+ } else if (format === "iban") {
20536
+ stringSchema = stringSchema.check(z.iban());
19707
20537
  } else if (format === "jwt") {
19708
20538
  stringSchema = stringSchema.check(z.jwt());
19709
20539
  } else if (format === "emoji") {
@@ -19836,9 +20666,16 @@ function convertBaseSchema(schema, ctx) {
19836
20666
  zodSchema = objectSchema.passthrough();
19837
20667
  }
19838
20668
  }
19839
- if (schema.propertyNames !== void 0 && schema.propertyNames !== true) {
19840
- const keyJSONSchema = typeof schema.propertyNames === "object" && schema.propertyNames.type === void 0 ? { type: "string", ...schema.propertyNames } : schema.propertyNames;
19841
- zodSchema = checkPropertyNames(zodSchema, convertSchema(keyJSONSchema, ctx));
20669
+ const hasKeyGuard = schema.propertyNames !== void 0 && schema.propertyNames !== true;
20670
+ const minProperties = typeof schema.minProperties === "number" ? schema.minProperties : void 0;
20671
+ const maxProperties = typeof schema.maxProperties === "number" ? schema.maxProperties : void 0;
20672
+ if (hasKeyGuard || minProperties !== void 0 || maxProperties !== void 0) {
20673
+ let keySchema;
20674
+ if (hasKeyGuard) {
20675
+ const keyJSONSchema = typeof schema.propertyNames === "object" && schema.propertyNames.type === void 0 ? { type: "string", ...schema.propertyNames } : schema.propertyNames;
20676
+ keySchema = convertSchema(keyJSONSchema, ctx);
20677
+ }
20678
+ zodSchema = checkObjectGuards(zodSchema, { keySchema, minProperties, maxProperties });
19842
20679
  }
19843
20680
  break;
19844
20681
  }
@@ -19884,6 +20721,14 @@ function convertBaseSchema(schema, ctx) {
19884
20721
  } else {
19885
20722
  zodSchema = z.array(z.any());
19886
20723
  }
20724
+ if (schema.uniqueItems === true || schema.contains !== void 0) {
20725
+ zodSchema = checkArrayGuards(zodSchema, {
20726
+ uniqueItems: schema.uniqueItems === true,
20727
+ containsSchema: schema.contains !== void 0 ? convertSchema(schema.contains, ctx) : void 0,
20728
+ minContains: typeof schema.minContains === "number" ? schema.minContains : void 0,
20729
+ maxContains: typeof schema.maxContains === "number" ? schema.maxContains : void 0
20730
+ });
20731
+ }
19887
20732
  break;
19888
20733
  }
19889
20734
  default:
@@ -19941,8 +20786,23 @@ function convertSchema(schema, ctx) {
19941
20786
  extraMeta[key] = schema[key];
19942
20787
  }
19943
20788
  }
19944
- if (schema.propertyNames !== void 0 && schema.type === "object" && schema.$ref === void 0) {
19945
- extraMeta.propertyNames = schema.propertyNames;
20789
+ if (schema.type === "object" && schema.$ref === void 0) {
20790
+ if (schema.propertyNames !== void 0 && !containsRef(schema.propertyNames)) {
20791
+ extraMeta.propertyNames = schema.propertyNames;
20792
+ }
20793
+ for (const key of ["minProperties", "maxProperties"]) {
20794
+ if (schema[key] !== void 0)
20795
+ extraMeta[key] = schema[key];
20796
+ }
20797
+ }
20798
+ if (schema.type === "array" && schema.$ref === void 0) {
20799
+ if (schema.contains !== void 0 && !containsRef(schema.contains)) {
20800
+ extraMeta.contains = schema.contains;
20801
+ }
20802
+ for (const key of ["uniqueItems", "minContains", "maxContains"]) {
20803
+ if (schema[key] !== void 0)
20804
+ extraMeta[key] = schema[key];
20805
+ }
19946
20806
  }
19947
20807
  for (const key of Object.keys(schema)) {
19948
20808
  if (!RECOGNIZED_KEYS.has(key)) {
@@ -20202,6 +21062,18 @@ function date4(params) {
20202
21062
  return _coercedDate(ZodDate, params);
20203
21063
  }
20204
21064
 
21065
+ // src/util.ts
21066
+ function errMessage(err) {
21067
+ if (err instanceof Error) return err.message;
21068
+ if (typeof err === "string") return err;
21069
+ try {
21070
+ const json2 = JSON.stringify(err);
21071
+ return json2 === void 0 ? String(err) : json2;
21072
+ } catch {
21073
+ return String(err);
21074
+ }
21075
+ }
21076
+
20205
21077
  // src/options.ts
20206
21078
  var DEFAULT_SLOT = "default";
20207
21079
  var DEFAULT_TIMEOUT_MS = 24e4;
@@ -20272,9 +21144,6 @@ function formatIssue(issue2) {
20272
21144
  const path = issue2.path.map((segment) => String(segment)).join(".") || "<root>";
20273
21145
  return `${path}: ${issue2.message}`;
20274
21146
  }
20275
- function describeError(err) {
20276
- return err instanceof Error ? err.message : String(err);
20277
- }
20278
21147
  function discoverOpencodeBin() {
20279
21148
  const candidates = [
20280
21149
  process.env["OPENCODE_BIN"] ?? "",
@@ -20301,7 +21170,7 @@ function parseOptions(raw) {
20301
21170
  } catch (err) {
20302
21171
  return {
20303
21172
  ok: false,
20304
- errors: [`options threw during parsing and was rejected: ${describeError(err)}`]
21173
+ errors: [`options threw during parsing and was rejected: ${errMessage(err)}`]
20305
21174
  };
20306
21175
  }
20307
21176
  }
@@ -20381,17 +21250,51 @@ async function resolveRun(flags) {
20381
21250
  return { ok: false, error: `--run-id must be a bare sibyl run id, got "${flagRunId}"` };
20382
21251
  }
20383
21252
  const runId = flagRunId ?? `sibyl-${compactIso(now)}-${randomBytes(2).toString("hex")}`;
21253
+ if (targetRaw !== "-") {
21254
+ const abs = isAbsolute2(targetRaw) ? targetRaw : resolve2(process.cwd(), targetRaw);
21255
+ try {
21256
+ await access(abs);
21257
+ } catch (e) {
21258
+ return { ok: false, error: `--target unreadable: ${e instanceof Error ? e.message : String(e)}` };
21259
+ }
21260
+ }
20384
21261
  const runDir = join7(laneCfg.runRoot, `sibyl-run-${runId}`);
20385
- await mkdir6(runDir, { recursive: true });
20386
- let launchIndependence;
21262
+ await mkdirPrivate(runDir);
21263
+ let contextLeg = null;
21264
+ let contextProblem = null;
20387
21265
  try {
20388
21266
  const lc = JSON.parse(await readFile6(join7(runDir, "launch-context.json"), "utf8"));
20389
- launchIndependence = isIndependenceShape(lc["independence"]) ? lc["independence"] : {
20390
- status: "UNVERIFIABLE",
20391
- convenerChain: [],
20392
- evidence: "launch-context staged but its independence leg is malformed \u2014 not trusted; this review carries no independence anchor"
21267
+ if (isIndependenceShape(lc["independence"])) contextLeg = lc;
21268
+ else contextProblem = "launch-context staged but its independence leg is malformed";
21269
+ } catch (err) {
21270
+ contextProblem = err instanceof Error && err.name === "SyntaxError" ? "launch-context exists but is not valid JSON" : "no launch-context staged in the run dir";
21271
+ }
21272
+ if (flagRunId !== null && contextProblem !== null) {
21273
+ const refusal = {
21274
+ kind: "refused-launch",
21275
+ runId: flagRunId,
21276
+ reason: `${contextProblem} \u2014 a --run-id launch claims a tool-staged review that never happened; rerun through the sibyl_review tool, or drop --run-id for the supported bare headless launch`,
21277
+ at: now.toISOString()
20393
21278
  };
20394
- } catch {
21279
+ await writeFile7(join7(runDir, "launch-refusal.json"), `${JSON.stringify(refusal, null, 2)}
21280
+ `, "utf8");
21281
+ return { ok: false, error: refusal.reason };
21282
+ }
21283
+ let launchIndependence;
21284
+ if (contextLeg !== null) {
21285
+ launchIndependence = contextLeg["independence"];
21286
+ try {
21287
+ const face = JSON.parse(await readFile6(join7(runDir, "run-record.json"), "utf8"));
21288
+ const faceInd = face["independence"];
21289
+ if (isIndependenceShape(faceInd) && faceInd.status !== launchIndependence.status) {
21290
+ launchIndependence = {
21291
+ ...faceInd,
21292
+ evidence: `context claimed ${launchIndependence.status}, run record carries ${faceInd.status} \u2014 record wins. ${faceInd.evidence}`
21293
+ };
21294
+ }
21295
+ } catch {
21296
+ }
21297
+ } else {
20395
21298
  launchIndependence = {
20396
21299
  status: "UNVERIFIABLE",
20397
21300
  convenerChain: [],