@lousy-agents/cli 5.21.15 → 5.21.16

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.
package/dist/index.js CHANGED
@@ -3053,7 +3053,7 @@ exports.basename = (path, { windows } = {}) => {
3053
3053
 
3054
3054
 
3055
3055
  },
3056
- 889(__unused_rspack_module, __unused_rspack___webpack_exports__, __webpack_require__) {
3056
+ 2953(__unused_rspack_module, __unused_rspack___webpack_exports__, __webpack_require__) {
3057
3057
  // NAMESPACE OBJECT: ../../node_modules/micromark/lib/constructs.js
3058
3058
  var constructs_namespaceObject = {};
3059
3059
  __webpack_require__.r(constructs_namespaceObject);
@@ -18009,7 +18009,7 @@ function safeExtend(schema, shape) {
18009
18009
  });
18010
18010
  return util_clone(schema, def);
18011
18011
  }
18012
- function merge(a, b) {
18012
+ function util_merge(a, b) {
18013
18013
  if (!b?._zod?.def) {
18014
18014
  throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");
18015
18015
  }
@@ -25920,7 +25920,7 @@ const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
25920
25920
  return safeExtend(this, incoming);
25921
25921
  },
25922
25922
  merge(other) {
25923
- return merge(this, other);
25923
+ return util_merge(this, other);
25924
25924
  },
25925
25925
  pick(mask) {
25926
25926
  return pick(this, mask);
@@ -30941,7 +30941,6 @@ function createJiti(id, opts = {}) {
30941
30941
  /* export default */ const lib_jiti = ((/* unused pure expression or super */ null && (createJiti)));
30942
30942
 
30943
30943
  ;// CONCATENATED MODULE: ../../node_modules/rc9/dist/_chunks/libs/flat.mjs
30944
- //#region node_modules/.pnpm/flat@6.0.1/node_modules/flat/index.js
30945
30944
  function isBuffer(obj) {
30946
30945
  return obj && obj.constructor && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj);
30947
30946
  }
@@ -31023,7 +31022,6 @@ function flat_unflatten(target, opts) {
31023
31022
  });
31024
31023
  return result;
31025
31024
  }
31026
- //#endregion
31027
31025
 
31028
31026
 
31029
31027
  ;// CONCATENATED MODULE: ../../node_modules/destr/dist/index.mjs
@@ -31107,12 +31105,8 @@ function safeDestr(value, options = {}) {
31107
31105
 
31108
31106
 
31109
31107
 
31110
- //#region src/index.ts
31111
31108
  const RE_KEY_VAL = /^\s*([^\s=]+)\s*=\s*(.*)?\s*$/;
31112
31109
  const RE_LINES = /\n|\r|\r\n/;
31113
- /**
31114
- * The default options for the configuration file.
31115
- */
31116
31110
  const dist_defaults = {
31117
31111
  name: ".conf",
31118
31112
  dir: process.cwd(),
@@ -31143,121 +31137,74 @@ function dist_parse(contents, options = {}) {
31143
31137
  }
31144
31138
  return options.flat ? config : flat_unflatten(config, { overwrite: true });
31145
31139
  }
31146
- /**
31147
- * Parses a configuration string into an object.
31148
- * @param {string} contents - The configuration data as a raw string.
31149
- * @param {RCOptions} [options={}] - Options to control the parsing behaviour. See {@link RCOptions}.
31150
- * @returns {RC} - The parsed configuration object. See {@link RC}.
31151
- */
31152
31140
  function parseFile(path, options) {
31153
31141
  if (!(0,external_node_fs_.existsSync)(path)) return {};
31154
31142
  return dist_parse((0,external_node_fs_.readFileSync)(path, "utf8"), options);
31155
31143
  }
31156
- /**
31157
- * Reads a configuration file from a default or specified location and parses its contents.
31158
- * @param {RCOptions|string} [options] - Options for reading the configuration file, or the name of the configuration file. See {@link RCOptions}.
31159
- * @returns {RC} - The parsed configuration object. See {@link RC}.
31160
- */
31161
31144
  function dist_read(options) {
31162
31145
  options = withDefaults(options);
31163
31146
  return parseFile((0,external_node_path_.resolve)(options.dir, options.name), options);
31164
31147
  }
31165
- /**
31166
- * Reads a custom configuration file from a default or specified location and parses its contents.
31167
- * @param {RCOptions|string} [options] - Options for reading the configuration file, or the name of the configuration file. See {@link RCOptions}.
31168
- * @returns {RC} - The parsed configuration object.
31169
- * @deprecated Use {@link readUserConfig} instead, which uses `~/.config` following XDG conventions.
31170
- */
31171
31148
  function readUser(options) {
31172
31149
  options = withDefaults(options);
31173
31150
  options.dir = process.env.XDG_CONFIG_HOME || (0,external_node_os_.homedir)();
31174
31151
  return dist_read(options);
31175
31152
  }
31176
- /**
31177
- * Serialises a configuration object to a string format.
31178
- * @param {RC} config - The configuration object to serialise. See {@link RC}.
31179
- * @returns {string} - The serialised configuration string.
31180
- */
31181
31153
  function serialize(config) {
31182
31154
  return Object.entries(flatten(config)).map(([key, value]) => `${key}=${JSON.stringify(value)}`).join("\n");
31183
31155
  }
31184
- /**
31185
- * Writes a configuration object to a file in a default or specified location.
31186
- * @param {RC} config - The configuration object to write. See {@link RC}.
31187
- * @param {RCOptions|string} [options] - Options for writing the configuration file, or the name of the configuration file. See {@link RCOptions}.
31188
- */
31189
31156
  function dist_write(config, options) {
31190
- options = withDefaults(options);
31191
- writeFileSync(resolve(options.dir, options.name), serialize(config), { encoding: "utf8" });
31157
+ _write(config, withDefaults(options), false);
31158
+ }
31159
+ function _write(config, options, secure) {
31160
+ const path = resolve(options.dir, options.name);
31161
+ mkdirSync(dirname(path), {
31162
+ recursive: true,
31163
+ ...secure && { mode: 448 }
31164
+ });
31165
+ writeFileSync(path, serialize(config), {
31166
+ encoding: "utf8",
31167
+ ...secure && { mode: 384 }
31168
+ });
31169
+ if (secure) chmodSync(path, 384);
31192
31170
  }
31193
- /**
31194
- * Writes a custom configuration object to a file in a default or specified location.
31195
- * @param {RC} config - The configuration object to write. See {@link RC}.
31196
- * @param {RCOptions|string} [options] - Options for writing the configuration file, or the name of the configuration file. See {@link RCOptions}.
31197
- * @deprecated Use {@link writeUserConfig} instead, which uses `~/.config` following XDG conventions.
31198
- */
31199
31171
  function writeUser(config, options) {
31200
31172
  options = withDefaults(options);
31201
31173
  options.dir = process.env.XDG_CONFIG_HOME || homedir();
31202
- dist_write(config, options);
31174
+ _write(config, options, true);
31175
+ }
31176
+ function userConfigDir() {
31177
+ return process.env.XDG_CONFIG_HOME || resolve(homedir(), ".config");
31203
31178
  }
31204
- /**
31205
- * Reads a configuration file from `$XDG_CONFIG_HOME` or `$HOME/.config` and parses its contents.
31206
- * @param {RCOptions|string} [options] - Options for reading the configuration file, or the name of the configuration file. See {@link RCOptions}.
31207
- * @returns {RC} - The parsed configuration object.
31208
- */
31209
31179
  function readUserConfig(options) {
31210
31180
  options = withDefaults(options);
31211
- options.dir = process.env.XDG_CONFIG_HOME || resolve(homedir(), ".config");
31181
+ options.dir = userConfigDir();
31212
31182
  return dist_read(options);
31213
31183
  }
31214
- /**
31215
- * Writes a configuration object to a file in `$XDG_CONFIG_HOME` or `$HOME/.config`.
31216
- * @param {RC} config - The configuration object to write. See {@link RC}.
31217
- * @param {RCOptions|string} [options] - Options for writing the configuration file, or the name of the configuration file. See {@link RCOptions}.
31218
- */
31219
31184
  function writeUserConfig(config, options) {
31220
31185
  options = withDefaults(options);
31221
- options.dir = process.env.XDG_CONFIG_HOME || resolve(homedir(), ".config");
31222
- dist_write(config, options);
31186
+ options.dir = userConfigDir();
31187
+ _write(config, options, true);
31223
31188
  }
31224
- /**
31225
- * Updates a configuration object in `$XDG_CONFIG_HOME` or `$HOME/.config` by merging and writing the result.
31226
- * @param {RC} config - The configuration object to update. See {@link RC}.
31227
- * @param {RCOptions|string} [options] - Options for updating the configuration file, or the name of the configuration file. See {@link RCOptions}.
31228
- * @returns {RC} - The updated configuration object.
31229
- */
31230
31189
  function updateUserConfig(config, options) {
31231
31190
  options = withDefaults(options);
31232
- options.dir = process.env.XDG_CONFIG_HOME || resolve(homedir(), ".config");
31233
- return update(config, options);
31191
+ options.dir = userConfigDir();
31192
+ return _update(config, options, true);
31234
31193
  }
31235
- /**
31236
- * Updates an existing configuration object by merging it with the contents of a configuration file and writing the result.
31237
- * @param {RC} config - The configuration object to update. See {@link RC}.
31238
- * @param {RCOptions|string} [options] - Options for updating the configuration file, or the name of the configuration file. See {@link RCOptions}.
31239
- * @returns {RC} - The updated configuration object. See {@link RC}.
31240
- */
31241
31194
  function update(config, options) {
31242
- options = withDefaults(options);
31195
+ return _update(config, withDefaults(options), false);
31196
+ }
31197
+ function _update(config, options, secure) {
31243
31198
  if (!options.flat) config = unflatten(config, { overwrite: true });
31244
31199
  const newConfig = defu(config, dist_read(options));
31245
- dist_write(newConfig, options);
31200
+ _write(newConfig, options, secure);
31246
31201
  return newConfig;
31247
31202
  }
31248
- /**
31249
- * Updates a custom configuration object by merging it with the contents of a configuration file in a default location and writing the result.
31250
- * @param {RC} config - The configuration object to update. See {@link RC}.
31251
- * @param {RCOptions|string} [options] - Options for updating the configuration file, or the name of the configuration file. See {@link RCOptions}.
31252
- * @returns {RC} - The updated configuration object. See {@link RC}.
31253
- * @deprecated Use {@link updateUserConfig} instead, which uses `~/.config` following XDG conventions.
31254
- */
31255
31203
  function updateUser(config, options) {
31256
31204
  options = withDefaults(options);
31257
31205
  options.dir = process.env.XDG_CONFIG_HOME || homedir();
31258
- return update(config, options);
31206
+ return _update(config, options, true);
31259
31207
  }
31260
- //#endregion
31261
31208
 
31262
31209
 
31263
31210
  ;// CONCATENATED MODULE: ../../node_modules/defu/dist/defu.mjs
@@ -31331,12 +31278,17 @@ const defuArrayFn = (/* unused pure expression or super */ null && (defu_createD
31331
31278
 
31332
31279
 
31333
31280
 
31334
- // EXTERNAL MODULE: ../../node_modules/confbox/dist/_chunks/_format.mjs
31335
- var _format = __webpack_require__(5492);
31336
- ;// CONCATENATED MODULE: ../../node_modules/confbox/dist/_chunks/json.mjs
31337
- function json_n(t,n){let r=JSON.parse(t,n?.reviver);return (0,_format.n)(t,r,n),r}function json_r(e,n){let r=t(e,n),i=JSON.stringify(e,n?.replacer,r.indent);return r.whitespace.start+i+r.whitespace.end}
31338
- // EXTERNAL MODULE: ../../node_modules/confbox/dist/jsonc.mjs + 1 modules
31339
- var jsonc = __webpack_require__(5975);
31281
+ // EXTERNAL MODULE: ../../node_modules/pkg-types/node_modules/confbox/dist/_chunks/_format.mjs + 1 modules
31282
+ var _format = __webpack_require__(8655);
31283
+ ;// CONCATENATED MODULE: ../../node_modules/pkg-types/node_modules/confbox/dist/_chunks/libs/strip-json-comments.mjs
31284
+ const strip_json_comments_e=Symbol(`singleComment`),strip_json_comments_t=Symbol(`multiComment`),strip_json_comments_n=()=>``,strip_json_comments_r=(e,t,n)=>e.slice(t,n).replace(/[^ \t\r\n]/g,` `),strip_json_comments_i=(e,t)=>{let n=t-1,r=0;for(;e[n]===`\\`;)--n,r+=1;return!!(r%2)};function strip_json_comments_a(a,{whitespace:o=!0,trailingCommas:s=!1}={}){if(typeof a!=`string`)throw TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof a}\``);let c=o?strip_json_comments_r:strip_json_comments_n,l=!1,u=!1,d=0,f=``,p=``,m=-1;for(let n=0;n<a.length;n++){let r=a[n],o=a[n+1];if(!u&&r===`"`&&(strip_json_comments_i(a,n)||(l=!l)),!l){if(!u&&r+o===`//`)f+=a.slice(d,n),d=n,u=strip_json_comments_e,n++;else if(u===strip_json_comments_e&&r+o===`\r
31285
+ `){n++,u=!1,f+=c(a,d,n),d=n;continue}else if(u===strip_json_comments_e&&r===`
31286
+ `)u=!1,f+=c(a,d,n),d=n;else if(!u&&r+o===`/*`){f+=a.slice(d,n),d=n,u=strip_json_comments_t,n++;continue}else if(u===strip_json_comments_t&&r+o===`*/`){n++,u=!1,f+=c(a,d,n+1),d=n+1;continue}else s&&!u&&(m===-1?r===`,`&&(p+=f+a.slice(d,n),f=``,d=n,m=n):r===`}`||r===`]`?(f+=a.slice(d,n),p+=c(f,0,1)+f.slice(1),f=``,d=n,m=-1):r!==` `&&r!==` `&&r!==`\r`&&r!==`
31287
+ `&&(f+=a.slice(d,n),d=n,m=-1))}}let h=u===strip_json_comments_e?c(a,d):a.slice(d);return p+f+h}
31288
+ ;// CONCATENATED MODULE: ../../node_modules/pkg-types/node_modules/confbox/dist/jsonc.mjs
31289
+ function jsonc_i(r,i){let a=JSON.parse(strip_json_comments_a((0,_format/* .stripBOM */.xi)(r),{trailingCommas:i?.allowTrailingComma}));return (0,_format/* .storeFormat */.$Z)(r,a,i),a}function jsonc_a(e,t){return r(e,t)}
31290
+ ;// CONCATENATED MODULE: ../../node_modules/pkg-types/node_modules/confbox/dist/json.mjs
31291
+ function json_r(e,r){let i=JSON.parse((0,_format/* .stripBOM */.xi)(e),r?.reviver);return (0,_format/* .storeFormat */.$Z)(e,i,r),i}function json_i(t,n){let r=e(t,n),i=JSON.stringify(t,n?.replacer,r.indent);return r.whitespace.start+i+r.whitespace.end}
31340
31292
  ;// CONCATENATED MODULE: ../../node_modules/pkg-types/dist/index.mjs
31341
31293
 
31342
31294
 
@@ -31345,6 +31297,7 @@ var jsonc = __webpack_require__(5975);
31345
31297
 
31346
31298
 
31347
31299
 
31300
+
31348
31301
  const defaultFindOptions = {
31349
31302
  startingFrom: ".",
31350
31303
  rootPattern: /^node_modules$/,
@@ -31395,7 +31348,7 @@ function _resolvePath(id, opts = {}) {
31395
31348
  from: opts.from || opts.parent || opts.url
31396
31349
  });
31397
31350
  }
31398
- const FileCache$1 = /* @__PURE__ */ (/* unused pure expression or super */ null && (new Map()));
31351
+ const FileCache$1 = /* #__PURE__ */ (/* unused pure expression or super */ null && (new Map()));
31399
31352
  function defineTSConfig(tsconfig) {
31400
31353
  return tsconfig;
31401
31354
  }
@@ -31403,7 +31356,8 @@ async function readTSConfig(id, options = {}) {
31403
31356
  const resolvedPath = await resolveTSConfig(id, options);
31404
31357
  const cache = options.cache && typeof options.cache !== "boolean" ? options.cache : FileCache$1;
31405
31358
  if (options.cache && cache.has(resolvedPath)) return cache.get(resolvedPath);
31406
- const parsed = parseJSONC(await promises.readFile(resolvedPath, "utf8"));
31359
+ const text = await promises.readFile(resolvedPath, "utf8");
31360
+ const parsed = parseJSONC(text);
31407
31361
  cache.set(resolvedPath, parsed);
31408
31362
  return parsed;
31409
31363
  }
@@ -31438,7 +31392,7 @@ const workspaceFiles = [
31438
31392
  "deno.json",
31439
31393
  "deno.jsonc"
31440
31394
  ];
31441
- const FileCache = /* @__PURE__ */ new Map();
31395
+ const FileCache = /* #__PURE__ */ new Map();
31442
31396
  function definePackageJSON(pkg) {
31443
31397
  return pkg;
31444
31398
  }
@@ -31454,9 +31408,13 @@ async function readPackage(id, options = {}) {
31454
31408
  if (options.cache && cache.has(resolvedPath)) return cache.get(resolvedPath);
31455
31409
  const blob = await promises.readFile(resolvedPath, "utf8");
31456
31410
  let parsed;
31457
- if (resolvedPath.endsWith(".json5")) parsed = parseJSON5(blob);
31458
- else if (resolvedPath.endsWith(".yaml")) parsed = parseYAML(blob);
31459
- else try {
31411
+ if (resolvedPath.endsWith(".json5")) {
31412
+ const { parseJSON5 } = await __webpack_require__.e(/* import() */ 772).then(__webpack_require__.bind(__webpack_require__, 7103));
31413
+ parsed = parseJSON5(blob);
31414
+ } else if (resolvedPath.endsWith(".yaml")) {
31415
+ const { parseYAML } = await __webpack_require__.e(/* import() */ 873).then(__webpack_require__.bind(__webpack_require__, 7976));
31416
+ parsed = parseYAML(blob);
31417
+ } else try {
31460
31418
  parsed = parseJSON(blob);
31461
31419
  } catch {
31462
31420
  parsed = parseJSONC(blob);
@@ -31466,9 +31424,13 @@ async function readPackage(id, options = {}) {
31466
31424
  }
31467
31425
  async function writePackage(path, pkg) {
31468
31426
  let content;
31469
- if (path.endsWith(".json5")) content = stringifyJSON5(pkg);
31470
- else if (path.endsWith(".yaml")) content = stringifyYAML(pkg);
31471
- else content = stringifyJSON(pkg);
31427
+ if (path.endsWith(".json5")) {
31428
+ const { stringifyJSON5 } = await __webpack_require__.e(/* import() */ 772).then(__webpack_require__.bind(__webpack_require__, 7103));
31429
+ content = stringifyJSON5(pkg);
31430
+ } else if (path.endsWith(".yaml")) {
31431
+ const { stringifyYAML } = await __webpack_require__.e(/* import() */ 873).then(__webpack_require__.bind(__webpack_require__, 7976));
31432
+ content = stringifyYAML(pkg);
31433
+ } else content = stringifyJSON(pkg);
31472
31434
  await promises.writeFile(path, content);
31473
31435
  }
31474
31436
  async function readPackageJSON(id, options = {}) {
@@ -31478,9 +31440,9 @@ async function readPackageJSON(id, options = {}) {
31478
31440
  const blob = await external_node_fs_.promises.readFile(resolvedPath, "utf8");
31479
31441
  let parsed;
31480
31442
  try {
31481
- parsed = json_n(blob);
31443
+ parsed = json_r(blob);
31482
31444
  } catch {
31483
- parsed = (0,jsonc.parseJSONC)(blob);
31445
+ parsed = jsonc_i(blob);
31484
31446
  }
31485
31447
  cache.set(resolvedPath, parsed);
31486
31448
  return parsed;
@@ -31577,7 +31539,7 @@ const dependencyKeys = (/* unused pure expression or super */ null && ([
31577
31539
  "optionalDependencies",
31578
31540
  "peerDependencies"
31579
31541
  ]));
31580
- const objectKeys = new Set([
31542
+ const objectKeys = /* @__PURE__ */ (/* unused pure expression or super */ null && (new Set([
31581
31543
  "typesVersions",
31582
31544
  "scripts",
31583
31545
  "resolutions",
@@ -31590,7 +31552,7 @@ const objectKeys = new Set([
31590
31552
  "optionalDependencies",
31591
31553
  "engines",
31592
31554
  "publishConfig"
31593
- ]);
31555
+ ])));
31594
31556
  const defaultFieldOrder = (/* unused pure expression or super */ null && ([
31595
31557
  "$schema",
31596
31558
  "name",
@@ -31639,11 +31601,12 @@ function defineGitConfig(config) {
31639
31601
  async function resolveGitConfig(dir, opts) {
31640
31602
  return findNearestFile(".git/config", {
31641
31603
  ...opts,
31642
- startingFrom: dir
31604
+ startingFrom: _resolvePath(dir, opts)
31643
31605
  });
31644
31606
  }
31645
31607
  async function readGitConfig(dir, opts) {
31646
- return parseGitConfig(await readFile(await resolveGitConfig(dir, opts), "utf8"));
31608
+ const path = await resolveGitConfig(dir, opts);
31609
+ return parseGitConfig(await readFile(path, "utf8"));
31647
31610
  }
31648
31611
  async function writeGitConfig(path, config) {
31649
31612
  await writeFile(path, stringifyGitConfig(config));
@@ -31750,7 +31713,7 @@ const dist_normalize = (p) => p?.replace(/\\/g, "/");
31750
31713
  const ASYNC_LOADERS = {
31751
31714
  ".yaml": () => __webpack_require__.e(/* import() */ 48).then(__webpack_require__.bind(__webpack_require__, 6115)).then((r) => r.parseYAML),
31752
31715
  ".yml": () => __webpack_require__.e(/* import() */ 48).then(__webpack_require__.bind(__webpack_require__, 6115)).then((r) => r.parseYAML),
31753
- ".jsonc": () => Promise.resolve(/* import() */).then(__webpack_require__.bind(__webpack_require__, 5975)).then((r) => r.parseJSONC),
31716
+ ".jsonc": () => __webpack_require__.e(/* import() */ 564).then(__webpack_require__.bind(__webpack_require__, 5975)).then((r) => r.parseJSONC),
31754
31717
  ".json5": () => __webpack_require__.e(/* import() */ 913).then(__webpack_require__.bind(__webpack_require__, 2576)).then((r) => r.parseJSON5),
31755
31718
  ".toml": () => __webpack_require__.e(/* import() */ 127).then(__webpack_require__.bind(__webpack_require__, 1674)).then((r) => r.parseTOML)
31756
31719
  };
@@ -33107,20 +33070,44 @@ var dist_bundle_endpoint = dist_bundle_withDefaults(null, DEFAULTS);
33107
33070
  * Copyright(c) 2015 Douglas Christopher Wilson
33108
33071
  * MIT Licensed
33109
33072
  */
33110
- const TEXT_REGEXP = /^[\u0009\u0020-\u007e\u0080-\u00ff]*$/;
33111
- const TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
33112
- /**
33113
- * RegExp to match chars that must be quoted-pair in RFC 9110 sec 5.6.4
33114
- */
33115
- const QUOTE_REGEXP = /[\\"]/g;
33073
+ const SP = 32; // " "
33074
+ const HTAB = 9; // "\t"
33075
+ const SEMI = 59; // ";"
33076
+ const EQ = 61; // "="
33077
+ const DQUOTE = 34; // '"'
33078
+ const BSLASH = 92; // "\\"
33079
+ const COMMA = 44; // ","
33080
+ const LOWER_CASE = 1;
33081
+ const OWS = 2;
33082
+ const SEMI_FLAG = 4;
33083
+ const COMMA_FLAG = 8;
33084
+ const TOKEN_FLAG = 16;
33085
+ const NON_ASCII = 0xff00;
33086
+ const CASE_FLAGS = LOWER_CASE | NON_ASCII;
33116
33087
  /**
33117
- * RegExp to match type in RFC 9110 sec 8.3.1
33118
- *
33119
- * media-type = type "/" subtype
33120
- * type = token
33121
- * subtype = token
33088
+ * Character flags used to normalize HTTP field values while scanning.
33089
+ * Out-of-range reads intentionally coerce to zero in bitwise expressions.
33122
33090
  */
33123
- const TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
33091
+ const CHAR_MAP = new Uint8Array(0x100);
33092
+ CHAR_MAP[HTAB] |= OWS;
33093
+ CHAR_MAP[SP] |= OWS;
33094
+ CHAR_MAP[SEMI] |= SEMI_FLAG;
33095
+ CHAR_MAP[COMMA] |= COMMA_FLAG;
33096
+ for (let code = 0x80 /* non-ASCII */; code <= 0xff; code++) {
33097
+ CHAR_MAP[code] |= LOWER_CASE;
33098
+ }
33099
+ for (const char of "!#$%&'*+-.^_`|~") {
33100
+ CHAR_MAP[char.charCodeAt(0)] |= TOKEN_FLAG;
33101
+ }
33102
+ for (let code = 0x30 /* 0 */; code <= 0x39 /* 9 */; code++) {
33103
+ CHAR_MAP[code] |= TOKEN_FLAG;
33104
+ }
33105
+ for (let code = 0x41 /* A */; code <= 0x5a /* Z */; code++) {
33106
+ CHAR_MAP[code] |= LOWER_CASE | TOKEN_FLAG;
33107
+ }
33108
+ for (let code = 0x61 /* a */; code <= 0x7a /* z */; code++) {
33109
+ CHAR_MAP[code] |= TOKEN_FLAG;
33110
+ }
33124
33111
  /**
33125
33112
  * Null object perf optimization. Faster than `Object.create(null)` and `{ __proto__: null }`.
33126
33113
  */
@@ -33129,21 +33116,84 @@ const NullObject = /* @__PURE__ */ (() => {
33129
33116
  C.prototype = Object.create(null);
33130
33117
  return C;
33131
33118
  })();
33119
+ /**
33120
+ * Validate a type string against RFC 9110.
33121
+ */
33122
+ function isTypeValid(type, start = 0, end = type.length) {
33123
+ let hasSlash = false;
33124
+ for (let index = start; index < end; index++) {
33125
+ const code = type.charCodeAt(index);
33126
+ if (code === 47 /* / */) {
33127
+ if (hasSlash || index === start || index >= end - 1)
33128
+ return false;
33129
+ hasSlash = true;
33130
+ }
33131
+ else if (!isTokenCode(code)) {
33132
+ return false;
33133
+ }
33134
+ }
33135
+ return hasSlash;
33136
+ }
33137
+ /**
33138
+ * Validate a token against RFC 9110.
33139
+ */
33140
+ function isTokenValid(token, start = 0, end = token.length) {
33141
+ if (start >= end)
33142
+ return false;
33143
+ for (let index = start; index < end; index++) {
33144
+ if (!isTokenCode(token.charCodeAt(index)))
33145
+ return false;
33146
+ }
33147
+ return true;
33148
+ }
33149
+ /**
33150
+ * Check whether a character code belongs to the token production in RFC 9110.
33151
+ */
33152
+ function isTokenCode(code) {
33153
+ return (CHAR_MAP[code] & TOKEN_FLAG) !== 0;
33154
+ }
33155
+ /**
33156
+ * Serialize a parameter value.
33157
+ */
33158
+ function parameterValue(str) {
33159
+ const len = str.length;
33160
+ if (len === 0)
33161
+ return '""';
33162
+ let index = 0;
33163
+ while (index < len && isTokenCode(str.charCodeAt(index)))
33164
+ index++;
33165
+ if (index === len)
33166
+ return str;
33167
+ let result = '"';
33168
+ let start = 0;
33169
+ while (index < len) {
33170
+ const code = str.charCodeAt(index);
33171
+ if (code !== HTAB && (code < SP || code === 127 || code > 255)) {
33172
+ throw new TypeError(`Invalid parameter value: ${str}`);
33173
+ }
33174
+ if (code === 34 /* " */ || code === 92 /* \\ */) {
33175
+ result += `${str.slice(start, index)}\\`;
33176
+ start = index;
33177
+ }
33178
+ index++;
33179
+ }
33180
+ return `${result}${str.slice(start)}"`;
33181
+ }
33132
33182
  /**
33133
33183
  * Format an object into a `Content-Type` header.
33134
33184
  */
33135
33185
  function dist_format(obj) {
33136
33186
  const { type, parameters } = obj;
33137
- if (!type || !TYPE_REGEXP.test(type)) {
33187
+ if (!type || !isTypeValid(type)) {
33138
33188
  throw new TypeError(`Invalid type: ${type}`);
33139
33189
  }
33140
33190
  let result = type;
33141
33191
  if (parameters) {
33142
33192
  for (const param of Object.keys(parameters)) {
33143
- if (!TOKEN_REGEXP.test(param)) {
33193
+ if (!isTokenValid(param)) {
33144
33194
  throw new TypeError(`Invalid parameter name: ${param}`);
33145
33195
  }
33146
- result += `; ${param}=${qstring(parameters[param])}`;
33196
+ result += `; ${param}=${parameterValue(parameters[param])}`;
33147
33197
  }
33148
33198
  }
33149
33199
  return result;
@@ -33152,126 +33202,158 @@ function dist_format(obj) {
33152
33202
  * Parse a `Content-Type` header.
33153
33203
  */
33154
33204
  function content_type_dist_parse(header, options) {
33155
- const stopChar = options?.comma === true ? COMMA : 65_536; // Sentinel for "no stop char".
33205
+ const stopFlags = SEMI_FLAG | (options?.comma === true ? COMMA_FLAG : 0);
33156
33206
  const len = header.length;
33157
- let index = skipOWS(header, options?.start ?? 0, len);
33158
- const valueStart = index;
33159
- index = skipValue(header, index, len, stopChar);
33160
- const valueEnd = trailingOWS(header, valueStart, index);
33161
- const type = header.slice(valueStart, valueEnd).toLowerCase();
33162
- if (options?.parameters === false) {
33207
+ let valueStart = options?.start ?? 0;
33208
+ while ((CHAR_MAP[header.charCodeAt(valueStart)] & OWS) !== 0) {
33209
+ valueStart++;
33210
+ }
33211
+ let index = valueStart;
33212
+ let typeFlags = 0;
33213
+ let whitespace = -1;
33214
+ let stop = options?.parameters === false ? COMMA_FLAG : 0;
33215
+ while (index < len) {
33216
+ const code = header.charCodeAt(index);
33217
+ const flags = CHAR_MAP[code];
33218
+ if ((flags & stopFlags) !== 0) {
33219
+ stop |= flags & COMMA_FLAG;
33220
+ break;
33221
+ }
33222
+ if ((flags & OWS) !== 0) {
33223
+ if (whitespace === -1)
33224
+ whitespace = index;
33225
+ }
33226
+ else {
33227
+ whitespace = -1;
33228
+ }
33229
+ typeFlags |= (code & NON_ASCII) | flags;
33230
+ index++;
33231
+ }
33232
+ const valueEnd = whitespace === -1 ? index : whitespace;
33233
+ const value = header.slice(valueStart, valueEnd);
33234
+ const type = (typeFlags & CASE_FLAGS) === 0 ? value : value.toLowerCase();
33235
+ if (index === len || stop !== 0) {
33163
33236
  return { type, index, parameters: new NullObject() };
33164
33237
  }
33165
- return parseParameters(header, type, index, len, stopChar);
33238
+ return parseParameters(header, type, index, len, stopFlags);
33166
33239
  }
33167
- const SP = 32; // " "
33168
- const HTAB = 9; // "\t"
33169
- const SEMI = 59; // ";"
33170
- const EQ = 61; // "="
33171
- const DQUOTE = 34; // '"'
33172
- const BSLASH = 92; // "\\"
33173
- const COMMA = 44; // ","
33174
33240
  /**
33175
33241
  * Parses the parameters of a `Content-Type` header starting at the given index.
33176
33242
  */
33177
- function parseParameters(header, type, index, len, stopChar) {
33243
+ function parseParameters(header, type, index, len, stopFlags) {
33178
33244
  const parameters = new NullObject();
33179
33245
  parameter: while (index < len) {
33180
- if (header.charCodeAt(index) === stopChar)
33181
- break;
33182
- index = skipOWS(header, index + 1 /* Skip over ; */, len);
33246
+ index++; // Skip over ;
33247
+ while ((CHAR_MAP[header.charCodeAt(index)] & OWS) !== 0) {
33248
+ index++;
33249
+ }
33183
33250
  const keyStart = index;
33251
+ let keyFlags = 0;
33252
+ let keyWhitespace = -1;
33184
33253
  while (index < len) {
33185
33254
  const code = header.charCodeAt(index);
33186
- if (code === stopChar)
33187
- break parameter;
33188
- if (code === SEMI)
33255
+ const flags = CHAR_MAP[code];
33256
+ if ((flags & stopFlags) !== 0) {
33257
+ if ((flags & COMMA_FLAG) !== 0)
33258
+ break parameter;
33189
33259
  continue parameter;
33260
+ }
33190
33261
  if (code === EQ) {
33191
- const keyEnd = trailingOWS(header, keyStart, index);
33192
- const key = header.slice(keyStart, keyEnd).toLowerCase();
33193
- index = skipOWS(header, index + 1, len);
33194
- if (index < len && header.charCodeAt(index) === DQUOTE) {
33262
+ const keyEnd = keyWhitespace === -1 ? index : keyWhitespace;
33263
+ const value = header.slice(keyStart, keyEnd);
33264
+ const key = (keyFlags & CASE_FLAGS) === 0 ? value : value.toLowerCase();
33265
+ index++;
33266
+ while ((CHAR_MAP[header.charCodeAt(index)] & OWS) !== 0) {
33195
33267
  index++;
33196
- let value = "";
33268
+ }
33269
+ if (index < len && header.charCodeAt(index) === DQUOTE) {
33270
+ const quotedStart = ++index;
33271
+ let escaped = false;
33197
33272
  while (index < len) {
33198
- const code = header.charCodeAt(index++);
33273
+ const code = header.charCodeAt(index);
33199
33274
  if (code === DQUOTE) {
33200
- index = skipValue(header, index, len, stopChar);
33201
- if (parameters[key] === undefined)
33202
- parameters[key] = value;
33203
- break;
33275
+ if (parameters[key] === undefined) {
33276
+ parameters[key] = escaped
33277
+ ? unescapeQuotedPairs(header, quotedStart, index)
33278
+ : header.slice(quotedStart, index);
33279
+ }
33280
+ index++;
33281
+ let stop = 0;
33282
+ // Discard characters between quote and delimiter.
33283
+ while (index < len) {
33284
+ const code = header.charCodeAt(index);
33285
+ const flags = CHAR_MAP[code];
33286
+ if ((flags & stopFlags) !== 0) {
33287
+ stop = flags & COMMA_FLAG;
33288
+ break;
33289
+ }
33290
+ index++;
33291
+ }
33292
+ if (stop !== 0)
33293
+ break parameter;
33294
+ continue parameter;
33204
33295
  }
33205
- if (code === BSLASH && index < len) {
33206
- value += header[index++];
33296
+ if (code === BSLASH && index + 1 < len) {
33297
+ escaped = true;
33298
+ index += 2;
33207
33299
  continue;
33208
33300
  }
33209
- value += String.fromCharCode(code);
33301
+ index++;
33210
33302
  }
33211
33303
  continue parameter;
33212
33304
  }
33213
33305
  const valueStart = index;
33214
- index = skipValue(header, index, len, stopChar);
33306
+ let stop = 0;
33307
+ let valueWhitespace = -1;
33308
+ while (index < len) {
33309
+ const code = header.charCodeAt(index);
33310
+ const flags = CHAR_MAP[code];
33311
+ if ((flags & stopFlags) !== 0) {
33312
+ stop = flags & COMMA_FLAG;
33313
+ break;
33314
+ }
33315
+ if ((flags & OWS) !== 0) {
33316
+ if (valueWhitespace === -1)
33317
+ valueWhitespace = index;
33318
+ }
33319
+ else {
33320
+ valueWhitespace = -1;
33321
+ }
33322
+ index++;
33323
+ }
33215
33324
  if (parameters[key] === undefined) {
33216
- const valueEnd = trailingOWS(header, valueStart, index);
33325
+ const valueEnd = valueWhitespace === -1 ? index : valueWhitespace;
33217
33326
  parameters[key] = header.slice(valueStart, valueEnd);
33218
33327
  }
33328
+ if (stop !== 0)
33329
+ break parameter;
33219
33330
  continue parameter;
33220
33331
  }
33332
+ if ((flags & OWS) !== 0) {
33333
+ if (keyWhitespace === -1)
33334
+ keyWhitespace = index;
33335
+ }
33336
+ else {
33337
+ keyWhitespace = -1;
33338
+ }
33339
+ keyFlags |= (code & NON_ASCII) | flags;
33221
33340
  index++;
33222
33341
  }
33223
33342
  }
33224
33343
  return { type, index, parameters };
33225
33344
  }
33226
33345
  /**
33227
- * Skip over characters until a semicolon or other exit character.
33228
- */
33229
- function skipValue(str, index, len, stopChar) {
33230
- while (index < len) {
33231
- const code = str.charCodeAt(index);
33232
- if (code === SEMI || code === stopChar)
33233
- break;
33234
- index++;
33235
- }
33236
- return index;
33237
- }
33238
- /**
33239
- * Skip optional whitespace (OWS) in an HTTP header value.
33240
- *
33241
- * OWS is defined in RFC 9110 sec 5.6.3 as SP (" ") or HTAB ("\t").
33346
+ * Remove backslashes from quoted pairs in a known-terminated quoted string body.
33242
33347
  */
33243
- function skipOWS(header, index, len) {
33244
- while (index < len) {
33245
- const char = header.charCodeAt(index);
33246
- if (char !== SP && char !== HTAB)
33247
- break;
33248
- index++;
33249
- }
33250
- return index;
33251
- }
33252
- /**
33253
- * Trim optional whitespace (OWS) from the end of a substring.
33254
- *
33255
- * OWS is defined in RFC 9110 sec 5.6.3 as SP (" ") or HTAB ("\t").
33256
- */
33257
- function trailingOWS(header, start, end) {
33258
- while (end > start) {
33259
- const char = header.charCodeAt(end - 1);
33260
- if (char !== SP && char !== HTAB)
33261
- break;
33262
- end--;
33348
+ function unescapeQuotedPairs(str, start, end) {
33349
+ let result = "";
33350
+ for (let index = start; index < end; index++) {
33351
+ if (str.charCodeAt(index) === BSLASH) {
33352
+ result += str.slice(start, index);
33353
+ start = ++index;
33354
+ }
33263
33355
  }
33264
- return end;
33265
- }
33266
- /**
33267
- * Serialize a parameter value.
33268
- */
33269
- function qstring(str) {
33270
- if (TOKEN_REGEXP.test(str))
33271
- return str;
33272
- if (TEXT_REGEXP.test(str))
33273
- return `"${str.replace(QUOTE_REGEXP, "\\$&")}"`;
33274
- throw new TypeError(`Invalid parameter value: ${str}`);
33356
+ return result + str.slice(start, end);
33275
33357
  }
33276
33358
  //# sourceMappingURL=index.js.map
33277
33359
  ;// CONCATENATED MODULE: ../../node_modules/json-with-bigint/json-with-bigint.js
@@ -40445,7 +40527,7 @@ function util_safeExtend(schema, shape) {
40445
40527
  });
40446
40528
  return core_util_clone(schema, def);
40447
40529
  }
40448
- function util_merge(a, b) {
40530
+ function core_util_merge(a, b) {
40449
40531
  if (!b?._zod?.def) {
40450
40532
  throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");
40451
40533
  }
@@ -48356,7 +48438,7 @@ const schemas_ZodObject = /*@__PURE__*/ core_$constructor("ZodObject", (inst, de
48356
48438
  return util_safeExtend(this, incoming);
48357
48439
  },
48358
48440
  merge(other) {
48359
- return util_merge(this, other);
48441
+ return core_util_merge(this, other);
48360
48442
  },
48361
48443
  pick(mask) {
48362
48444
  return util_pick(this, mask);
@@ -51102,7 +51184,7 @@ function core_util_safeExtend(schema, shape) {
51102
51184
  });
51103
51185
  return v4_core_util_clone(schema, def);
51104
51186
  }
51105
- function core_util_merge(a, b) {
51187
+ function v4_core_util_merge(a, b) {
51106
51188
  if (!b?._zod?.def) {
51107
51189
  throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");
51108
51190
  }
@@ -78190,7 +78272,7 @@ function trough() {
78190
78272
 
78191
78273
  // Next or done.
78192
78274
  if (fn) {
78193
- wrap(fn, next)(...output)
78275
+ lib_wrap(fn, next)(...output)
78194
78276
  } else {
78195
78277
  callback(null, ...output)
78196
78278
  }
@@ -78242,7 +78324,7 @@ function trough() {
78242
78324
  * @returns {Run}
78243
78325
  * Wrapped middleware.
78244
78326
  */
78245
- function wrap(middleware, callback) {
78327
+ function lib_wrap(middleware, callback) {
78246
78328
  /** @type {boolean} */
78247
78329
  let called
78248
78330
 
@@ -82765,18 +82847,23 @@ function v4_core_util_jsonStringifyReplacer(_, value) {
82765
82847
  return value.toString();
82766
82848
  return value;
82767
82849
  }
82850
+ // the accessor lives on a shared prototype: an own accessor makes every box a dictionary-mode object (~360 B and a slow load per read against ~100 B and an inlined getter here)
82851
+ class Cached {
82852
+ constructor(getter) {
82853
+ this._getter = getter;
82854
+ this._value = undefined;
82855
+ }
82856
+ get value() {
82857
+ const getter = this._getter;
82858
+ if (getter !== undefined) {
82859
+ this._value = getter();
82860
+ this._getter = undefined;
82861
+ }
82862
+ return this._value;
82863
+ }
82864
+ }
82768
82865
  function zod_v4_core_util_cached(getter) {
82769
- const set = false;
82770
- return {
82771
- get value() {
82772
- if (!set) {
82773
- const value = getter();
82774
- Object.defineProperty(this, "value", { value });
82775
- return value;
82776
- }
82777
- throw new Error("cached value already set");
82778
- },
82779
- };
82866
+ return new Cached(getter);
82780
82867
  }
82781
82868
  function v4_core_util_nullish(input) {
82782
82869
  return input === null || input === undefined;
@@ -82831,6 +82918,71 @@ function zod_v4_core_util_assignProp(target, prop, value) {
82831
82918
  configurable: true,
82832
82919
  });
82833
82920
  }
82921
+ /**
82922
+ * Whichever object a def's `shape` currently answers from: the one the caller passed until the first read, the frozen copy after it.
82923
+ *
82924
+ * Its keys and descriptors read without invoking anything, which is what lets a discriminated union check its discriminator, and the cycle walk read a shape, without resolving a getter that references the schema being constructed. A def that answers `shape` from an accessor of its own has none.
82925
+ */
82926
+ function rawShape(def) {
82927
+ const desc = Object.getOwnPropertyDescriptor(def, "shape");
82928
+ return desc?.get ? desc.get.raw : desc?.value;
82929
+ }
82930
+ // where a builder reads its source's keys and descriptors, resolving only a shape a def answers for itself. A shape resolves by object spread, so only its enumerable keys are ever part of it.
82931
+ function sourceShape(schema) {
82932
+ return rawShape(schema._zod.def) ?? schema._zod.def.shape;
82933
+ }
82934
+ // a key whose value is not settled yet, self-caching so every read after the first gets the same one
82935
+ function deferProp(target, key, getter) {
82936
+ Object.defineProperty(target, key, {
82937
+ get() {
82938
+ const value = getter();
82939
+ zod_v4_core_util_assignProp(this, key, value);
82940
+ return value;
82941
+ },
82942
+ enumerable: true,
82943
+ configurable: true,
82944
+ });
82945
+ }
82946
+ // Writes a settled key. A plain assignment is much cheaper than `defineProperty` and produces the same descriptor, but it runs whatever setter already answers to the key — an accessor this shape deferred, or an inherited one, which `__proto__` has on every object and prototype pollution can add for any name.
82947
+ function putProp(target, key, value) {
82948
+ if (key in target)
82949
+ zod_v4_core_util_assignProp(target, key, value);
82950
+ else
82951
+ target[key] = value;
82952
+ }
82953
+ /**
82954
+ * Copies `keys` of `source`'s shape onto `target`, each value passed through `wrap`.
82955
+ *
82956
+ * A key the source has resolved is copied through now, so the derived shape states it outright and nothing has to resolve it to learn what it holds. A key the source still defers stays deferred, and reads back through the source's own `shape`, so it resolves once and both shapes get that one schema.
82957
+ */
82958
+ function mirrorShape(target, source, keys, wrap) {
82959
+ const raw = sourceShape(source);
82960
+ for (const key of keys) {
82961
+ const desc = Object.getOwnPropertyDescriptor(raw, key);
82962
+ if (!desc.enumerable)
82963
+ continue;
82964
+ if (desc.get) {
82965
+ deferProp(target, key, () => {
82966
+ const value = source._zod.def.shape[key];
82967
+ return wrap ? wrap(value, key) : value;
82968
+ });
82969
+ }
82970
+ else
82971
+ putProp(target, key, wrap ? wrap(desc.value, key) : desc.value);
82972
+ }
82973
+ }
82974
+ // same, for a plain shape a caller passed rather than a schema's
82975
+ function mirrorProps(target, source) {
82976
+ for (const key of Reflect.ownKeys(source)) {
82977
+ const desc = Object.getOwnPropertyDescriptor(source, key);
82978
+ if (!desc.enumerable)
82979
+ continue;
82980
+ if (desc.get)
82981
+ deferProp(target, key, () => source[key]);
82982
+ else
82983
+ putProp(target, key, desc.value);
82984
+ }
82985
+ }
82834
82986
  function v4_core_util_mergeDefs(...defs) {
82835
82987
  const mergedDescriptors = {};
82836
82988
  for (const def of defs) {
@@ -83064,13 +83216,13 @@ function v4_core_util_optionalKeys(shape) {
83064
83216
  });
83065
83217
  }
83066
83218
  // Wrapped in a `@__PURE__` IIFE: esbuild never tree-shakes a top-level initializer that contains a member access on `Number`, so the bare object literal survived into every bundle.
83067
- const v4_core_util_NUMBER_FORMAT_RANGES = /*@__PURE__*/ (/* unused pure expression or super */ null && ((() => ({
83219
+ const v4_core_util_NUMBER_FORMAT_RANGES = /*@__PURE__*/ (() => ({
83068
83220
  safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
83069
83221
  int32: [-2147483648, 2147483647],
83070
83222
  uint32: [0, 4294967295],
83071
83223
  float32: [-3.4028234663852886e38, 3.4028234663852886e38],
83072
83224
  float64: [-Number.MAX_VALUE, Number.MAX_VALUE],
83073
- }))()));
83225
+ }))();
83074
83226
  const v4_core_util_BIGINT_FORMAT_RANGES = {
83075
83227
  int64: [/* @__PURE__*/ BigInt("-9223372036854775808"), /* @__PURE__*/ BigInt("9223372036854775807")],
83076
83228
  uint64: [/* @__PURE__*/ BigInt(0), /* @__PURE__*/ BigInt("18446744073709551615")],
@@ -83082,24 +83234,23 @@ function v4_core_util_pick(schema, mask) {
83082
83234
  if (hasChecks) {
83083
83235
  throw new Error(".pick() cannot be used on object schemas containing refinements");
83084
83236
  }
83085
- const def = v4_core_util_mergeDefs(schema._zod.def, {
83086
- get shape() {
83087
- const newShape = {};
83088
- // `for...in` skips symbols, so a symbol in the mask would select nothing
83089
- for (const key of Reflect.ownKeys(mask)) {
83090
- if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) {
83091
- throw new Error(`Unrecognized key: "${String(key)}"`);
83092
- }
83093
- if (!mask[key])
83094
- continue;
83095
- zod_v4_core_util_assignProp(newShape, key, currDef.shape[key]);
83096
- }
83097
- zod_v4_core_util_assignProp(this, "shape", newShape); // self-caching
83098
- return newShape;
83099
- },
83100
- checks: [],
83101
- });
83102
- return zod_v4_core_util_clone(schema, def);
83237
+ const newShape = {};
83238
+ mirrorShape(newShape, schema, maskedKeys(schema, mask));
83239
+ return zod_v4_core_util_clone(schema, v4_core_util_mergeDefs(currDef, { shape: newShape, checks: [] }));
83240
+ }
83241
+ // the mask keys that select something, checked against the source's shape without resolving it
83242
+ function maskedKeys(schema, mask) {
83243
+ const raw = sourceShape(schema);
83244
+ const keys = [];
83245
+ // `for...in` skips symbols, so a symbol in the mask would select nothing
83246
+ for (const key of Reflect.ownKeys(mask)) {
83247
+ if (!Object.getOwnPropertyDescriptor(raw, key)?.enumerable) {
83248
+ throw new Error(`Unrecognized key: "${String(key)}"`);
83249
+ }
83250
+ if (mask[key])
83251
+ keys.push(key);
83252
+ }
83253
+ return keys;
83103
83254
  }
83104
83255
  function v4_core_util_omit(schema, mask) {
83105
83256
  const currDef = schema._zod.def;
@@ -83108,23 +83259,10 @@ function v4_core_util_omit(schema, mask) {
83108
83259
  if (hasChecks) {
83109
83260
  throw new Error(".omit() cannot be used on object schemas containing refinements");
83110
83261
  }
83111
- const def = v4_core_util_mergeDefs(schema._zod.def, {
83112
- get shape() {
83113
- const newShape = { ...schema._zod.def.shape };
83114
- for (const key of Reflect.ownKeys(mask)) {
83115
- if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) {
83116
- throw new Error(`Unrecognized key: "${String(key)}"`);
83117
- }
83118
- if (!mask[key])
83119
- continue;
83120
- delete newShape[key];
83121
- }
83122
- zod_v4_core_util_assignProp(this, "shape", newShape); // self-caching
83123
- return newShape;
83124
- },
83125
- checks: [],
83126
- });
83127
- return zod_v4_core_util_clone(schema, def);
83262
+ const omitted = new Set(maskedKeys(schema, mask));
83263
+ const newShape = {};
83264
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)).filter((key) => !omitted.has(key)));
83265
+ return zod_v4_core_util_clone(schema, v4_core_util_mergeDefs(currDef, { shape: newShape, checks: [] }));
83128
83266
  }
83129
83267
  function v4_core_util_extend(schema, shape) {
83130
83268
  if (!v4_core_util_isPlainObject(shape)) {
@@ -83134,48 +83272,40 @@ function v4_core_util_extend(schema, shape) {
83134
83272
  const hasChecks = checks && checks.length > 0;
83135
83273
  if (hasChecks) {
83136
83274
  // Only throw if new shape overlaps with existing shape. Use getOwnPropertyDescriptor to check key existence without accessing values
83137
- const existingShape = schema._zod.def.shape;
83275
+ const existingShape = sourceShape(schema);
83138
83276
  for (const key of Reflect.ownKeys(shape)) {
83139
83277
  if (Object.getOwnPropertyDescriptor(existingShape, key) !== undefined) {
83140
83278
  throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
83141
83279
  }
83142
83280
  }
83143
83281
  }
83144
- const def = v4_core_util_mergeDefs(schema._zod.def, {
83145
- get shape() {
83146
- const _shape = { ...schema._zod.def.shape, ...shape };
83147
- zod_v4_core_util_assignProp(this, "shape", _shape); // self-caching
83148
- return _shape;
83149
- },
83150
- });
83151
- return zod_v4_core_util_clone(schema, def);
83282
+ return zod_v4_core_util_clone(schema, v4_core_util_mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
83283
+ }
83284
+ // the source's keys, then the caller's overlaid on top
83285
+ function extended(schema, shape) {
83286
+ const newShape = {};
83287
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)));
83288
+ mirrorProps(newShape, shape);
83289
+ return newShape;
83152
83290
  }
83153
83291
  function v4_core_util_safeExtend(schema, shape) {
83154
83292
  if (!v4_core_util_isPlainObject(shape)) {
83155
83293
  throw new Error("Invalid input to safeExtend: expected a plain object");
83156
83294
  }
83157
- const def = v4_core_util_mergeDefs(schema._zod.def, {
83158
- get shape() {
83159
- const _shape = { ...schema._zod.def.shape, ...shape };
83160
- zod_v4_core_util_assignProp(this, "shape", _shape); // self-caching
83161
- return _shape;
83162
- },
83163
- });
83164
- return zod_v4_core_util_clone(schema, def);
83295
+ return zod_v4_core_util_clone(schema, v4_core_util_mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
83165
83296
  }
83166
- function v4_core_util_merge(a, b) {
83297
+ function zod_v4_core_util_merge(a, b) {
83167
83298
  if (!b?._zod?.def) {
83168
83299
  throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");
83169
83300
  }
83170
83301
  if (a._zod.def.checks?.length) {
83171
83302
  throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
83172
83303
  }
83304
+ const newShape = {};
83305
+ mirrorShape(newShape, a, Reflect.ownKeys(sourceShape(a)));
83306
+ mirrorShape(newShape, b, Reflect.ownKeys(sourceShape(b)));
83173
83307
  const def = v4_core_util_mergeDefs(a._zod.def, {
83174
- get shape() {
83175
- const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
83176
- zod_v4_core_util_assignProp(this, "shape", _shape); // self-caching
83177
- return _shape;
83178
- },
83308
+ shape: newShape,
83179
83309
  get catchall() {
83180
83310
  return b._zod.def.catchall;
83181
83311
  },
@@ -83190,78 +83320,19 @@ function v4_core_util_partial(Class, schema, mask, name = "partial") {
83190
83320
  if (hasChecks) {
83191
83321
  throw new Error(`.${name}() cannot be used on object schemas containing refinements`);
83192
83322
  }
83193
- const def = v4_core_util_mergeDefs(schema._zod.def, {
83194
- get shape() {
83195
- const oldShape = schema._zod.def.shape;
83196
- const shape = { ...oldShape };
83197
- if (mask) {
83198
- for (const key of Reflect.ownKeys(mask)) {
83199
- if (!Object.prototype.hasOwnProperty.call(oldShape, key)) {
83200
- throw new Error(`Unrecognized key: "${String(key)}"`);
83201
- }
83202
- if (!mask[key])
83203
- continue;
83204
- // if (oldShape[key]!._zod.optin === "optional") continue;
83205
- shape[key] = Class
83206
- ? new Class({
83207
- type: "optional",
83208
- innerType: oldShape[key],
83209
- })
83210
- : oldShape[key];
83211
- }
83212
- }
83213
- else {
83214
- // the spread copies symbol keys; `for...in` would not reach them
83215
- for (const key of Reflect.ownKeys(oldShape)) {
83216
- // if (oldShape[key]!._zod.optin === "optional") continue;
83217
- shape[key] = Class
83218
- ? new Class({
83219
- type: "optional",
83220
- innerType: oldShape[key],
83221
- })
83222
- : oldShape[key];
83223
- }
83224
- }
83225
- zod_v4_core_util_assignProp(this, "shape", shape); // self-caching
83226
- return shape;
83227
- },
83228
- checks: [],
83229
- });
83230
- return zod_v4_core_util_clone(schema, def);
83323
+ const selected = mask ? new Set(maskedKeys(schema, mask)) : undefined;
83324
+ const newShape = {};
83325
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), Class &&
83326
+ ((value, key) => (selected && !selected.has(key) ? value : new Class({ type: "optional", innerType: value }))));
83327
+ return zod_v4_core_util_clone(schema, v4_core_util_mergeDefs(schema._zod.def, { shape: newShape, checks: [] }));
83231
83328
  }
83232
83329
  function zod_v4_core_util_required(Class, schema, mask) {
83233
- const def = v4_core_util_mergeDefs(schema._zod.def, {
83234
- get shape() {
83235
- const oldShape = schema._zod.def.shape;
83236
- const shape = { ...oldShape };
83237
- if (mask) {
83238
- for (const key of Reflect.ownKeys(mask)) {
83239
- if (!Object.prototype.hasOwnProperty.call(shape, key)) {
83240
- throw new Error(`Unrecognized key: "${String(key)}"`);
83241
- }
83242
- if (!mask[key])
83243
- continue;
83244
- // overwrite with non-optional
83245
- shape[key] = new Class({
83246
- type: "nonoptional",
83247
- innerType: oldShape[key],
83248
- });
83249
- }
83250
- }
83251
- else {
83252
- for (const key of Reflect.ownKeys(oldShape)) {
83253
- // overwrite with non-optional
83254
- shape[key] = new Class({
83255
- type: "nonoptional",
83256
- innerType: oldShape[key],
83257
- });
83258
- }
83259
- }
83260
- zod_v4_core_util_assignProp(this, "shape", shape); // self-caching
83261
- return shape;
83262
- },
83263
- });
83264
- return zod_v4_core_util_clone(schema, def);
83330
+ const selected = mask ? new Set(maskedKeys(schema, mask)) : undefined;
83331
+ const newShape = {};
83332
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), (value, key) =>
83333
+ // overwrite with non-optional
83334
+ selected && !selected.has(key) ? value : new Class({ type: "nonoptional", innerType: value }));
83335
+ return zod_v4_core_util_clone(schema, v4_core_util_mergeDefs(schema._zod.def, { shape: newShape }));
83265
83336
  }
83266
83337
  // invalid_type | too_big | too_small | invalid_format | not_multiple_of | unrecognized_keys | invalid_union | invalid_key | invalid_element | invalid_value | custom
83267
83338
  function v4_core_util_aborted(x, startIndex = 0) {
@@ -83323,13 +83394,19 @@ function v4_core_util_finalizeIssue(iss, ctx, config) {
83323
83394
  v4_core_util_unwrapMessage(config.customError?.(iss)) ??
83324
83395
  v4_core_util_unwrapMessage(config.localeError?.(iss)) ??
83325
83396
  "Invalid input");
83326
- const { inst: _inst, schema: _schema, continue: _continue, input: _input, ...rest } = iss;
83327
- rest.path ?? (rest.path = []);
83328
- rest.message = message;
83397
+ // an explicit own-key copy beats object rest with excluded keys, which v8 routes through a generic runtime call; Object.keys rather than for-in so an issue pushed with a prototype does not leak inherited keys, and an own __proto__ key is dropped rather than assigned through the setter
83398
+ const full = {};
83399
+ for (const k of Object.keys(iss)) {
83400
+ if (k === "inst" || k === "schema" || k === "continue" || k === "input" || k === "__proto__")
83401
+ continue;
83402
+ full[k] = iss[k];
83403
+ }
83404
+ full.path ?? (full.path = []);
83405
+ full.message = message;
83329
83406
  if (ctx?.reportInput) {
83330
- rest.input = _input;
83407
+ full.input = iss.input;
83331
83408
  }
83332
- return rest;
83409
+ return full;
83333
83410
  }
83334
83411
  function v4_core_util_getSizableOrigin(input) {
83335
83412
  if (input instanceof Set)
@@ -83476,6 +83553,24 @@ function zod_v4_core_util_own(inst, key, value, enumerable = true) {
83476
83553
  function v4_core_util_hide(inst, key, value) {
83477
83554
  return zod_v4_core_util_own(inst, key, value, false);
83478
83555
  }
83556
+ /** Adds members a table derives from the instance: each builds on first read and shadows as own data, and assignment shadows the same way, as when these were own properties. */
83557
+ function derived(computes, table) {
83558
+ for (const key in computes) {
83559
+ const compute = computes[key];
83560
+ // an object literal's accessor is configurable and enumerable, and `members` copies the descriptor as written
83561
+ Object.defineProperty(table, key, {
83562
+ configurable: true,
83563
+ enumerable: true,
83564
+ get() {
83565
+ return zod_v4_core_util_own(this, key, compute(this));
83566
+ },
83567
+ set(value) {
83568
+ zod_v4_core_util_own(this, key, value);
83569
+ },
83570
+ });
83571
+ }
83572
+ return table;
83573
+ }
83479
83574
  function v4_core_util_defineBound(proto, key, fn) {
83480
83575
  Object.defineProperty(proto, key, {
83481
83576
  configurable: true,
@@ -83642,7 +83737,7 @@ proto, params) {
83642
83737
  v4_core_core_zodDesc.value = undefined;
83643
83738
  }
83644
83739
  }
83645
- if (inst._zod.traits.has(name)) {
83740
+ else if (inst._zod.traits.has(name)) {
83646
83741
  return;
83647
83742
  }
83648
83743
  inst._zod.traits.add(name);
@@ -83725,6 +83820,7 @@ function zod_v4_core_core_config(newConfig) {
83725
83820
  }
83726
83821
 
83727
83822
  ;// CONCATENATED MODULE: ../../node_modules/zod/v4/core/memoizer.js
83823
+
83728
83824
  class v4_core_memoizer_$ZodCyclicError extends Error {
83729
83825
  constructor() {
83730
83826
  super(`Cannot parse a reference cycle that closes through a transform`);
@@ -83734,32 +83830,62 @@ class v4_core_memoizer_$ZodCyclicError extends Error {
83734
83830
  /** Keyed off the context object every schema in one parse call already shares. */
83735
83831
  const v4_core_memoizer_STATE = "~memo";
83736
83832
  const v4_core_memoizer_NO_ISSUES = [];
83833
+ // a value a cycle can close through
83834
+ function isRef(value) {
83835
+ return value !== null && typeof value === "object";
83836
+ }
83737
83837
  // Receivers prefix paths in place, so the cache and every hand-out need their own copies.
83738
83838
  function v4_core_memoizer_cloneIssues(issues) {
83739
83839
  return issues.map((iss) => (iss.path ? { ...iss, path: iss.path.slice() } : { ...iss }));
83740
83840
  }
83741
83841
  const v4_core_memoizer_recursive = /*@__PURE__*/ new WeakMap();
83842
+ /** What the walk established, in order of certainty: ordered so the strongest answer among children wins. */
83843
+ const NONE = 0;
83844
+ const ASSUMED = 1;
83845
+ const PROVEN = 2;
83742
83846
  /** Whether this schema's subtree contains a cycle, so one parse can re-enter it. */
83743
- function v4_core_memoizer_isRecursive(inst, stack) {
83847
+ function v4_core_memoizer_isRecursive(inst, stack, resolve) {
83744
83848
  const cached = v4_core_memoizer_recursive.get(inst);
83745
83849
  if (cached !== undefined)
83746
- return cached;
83850
+ return cached ? PROVEN : NONE;
83747
83851
  // Relative to the walk in progress, so not cached.
83748
83852
  if (stack.has(inst))
83749
- return true;
83853
+ return PROVEN;
83750
83854
  stack.add(inst);
83751
- let result = false;
83855
+ let result = NONE;
83752
83856
  const check = (child) => {
83753
- if (!result && child?._zod && v4_core_memoizer_isRecursive(child, stack))
83754
- result = true;
83857
+ if (result !== PROVEN && child?._zod) {
83858
+ const answer = v4_core_memoizer_isRecursive(child, stack, resolve);
83859
+ if (answer > result)
83860
+ result = answer;
83861
+ }
83862
+ };
83863
+ // `Reflect.ownKeys` rather than `Object.keys`, so a cycle through a declared symbol key is still seen
83864
+ const shape = (sh, spread) => {
83865
+ let answer = NONE;
83866
+ for (const key of Reflect.ownKeys(sh)) {
83867
+ const desc = Object.getOwnPropertyDescriptor(sh, key);
83868
+ // an object resolves its shape by spread, so a key it does not enumerate is never parsed; `z.properties` reads every own key and so keeps them all
83869
+ if (spread && !desc.enumerable)
83870
+ continue;
83871
+ // resolving runs user code, and a factory mints a fresh subtree per read, so an edge the walk can't follow counts as a cycle
83872
+ const child = desc.get ? ASSUMED : desc.value?._zod ? v4_core_memoizer_isRecursive(desc.value, stack, resolve) : NONE;
83873
+ if (child > answer)
83874
+ answer = child;
83875
+ }
83876
+ return answer;
83877
+ };
83878
+ const merge = (answer) => {
83879
+ if (answer > result)
83880
+ result = answer;
83755
83881
  };
83756
83882
  const def = inst._zod.def;
83757
83883
  const kind = def.type;
83758
83884
  switch (kind) {
83759
83885
  case "object": {
83760
- // `Reflect.ownKeys` rather than `Object.keys`, so a cycle through a declared symbol key is still seen
83761
- for (const key of Reflect.ownKeys(def.shape))
83762
- check(def.shape[key]);
83886
+ const raw = rawShape(def);
83887
+ // a def with no raw shape answers `shape` from an accessor of its own, and running that can mint a whole fresh subtree
83888
+ merge(raw ? shape(raw, true) : ASSUMED);
83763
83889
  check(def.catchall);
83764
83890
  break;
83765
83891
  }
@@ -83806,10 +83932,13 @@ function v4_core_memoizer_isRecursive(inst, stack) {
83806
83932
  check(def.input);
83807
83933
  check(def.output);
83808
83934
  break;
83809
- // reading `_zod.innerType` resolves the getter once and caches it
83810
- case "lazy":
83811
- check(inst._zod.innerType);
83935
+ // `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
83936
+ case "lazy": {
83937
+ const inner = def._cachedInner ?? (resolve ? inst._zod.innerType : undefined);
83938
+ // walked with resolution off: one hop sees past the deferral, and a lazy that yields only another unresolved lazy is generative, so it stops there
83939
+ merge(inner ? v4_core_memoizer_isRecursive(inner, stack, false) : ASSUMED);
83812
83940
  break;
83941
+ }
83813
83942
  // a leaf by choice: `parts` are regex fragments, not data positions
83814
83943
  case "template_literal":
83815
83944
  // leaves
@@ -83853,8 +83982,13 @@ function v4_core_memoizer_isRecursive(inst, stack) {
83853
83982
  }
83854
83983
  }
83855
83984
  stack.delete(inst);
83856
- v4_core_memoizer_recursive.set(inst, result);
83857
- return result;
83985
+ return settle(inst, result);
83986
+ }
83987
+ /** An assumed answer must not outlive the resolution that settles it, so only a certain one is cached. */
83988
+ function settle(inst, answer) {
83989
+ if (answer !== ASSUMED)
83990
+ v4_core_memoizer_recursive.set(inst, answer === PROVEN);
83991
+ return answer;
83858
83992
  }
83859
83993
  /**
83860
83994
  * Whether one parse can re-enter this schema, i.e. its subtree contains a cycle.
@@ -83863,12 +83997,13 @@ function v4_core_memoizer_isRecursive(inst, stack) {
83863
83997
  * generated fast path has no context to key on.
83864
83998
  */
83865
83999
  function v4_core_memoizer_isRecursiveSchema(inst) {
83866
- return v4_core_memoizer_isRecursive(inst, new Set());
84000
+ // z.compile never parses, so nothing would ever resolve a lazy for it; it runs once and already treats a throw here as recursive
84001
+ return v4_core_memoizer_isRecursive(inst, new Set(), true) !== NONE;
83867
84002
  }
83868
84003
  function v4_core_memoizer_bucketFor(state, inst) {
83869
84004
  let bucket = state.buckets.get(inst);
83870
84005
  if (!bucket) {
83871
- bucket = new Map();
84006
+ bucket = new WeakMap();
83872
84007
  state.buckets.set(inst, bucket);
83873
84008
  }
83874
84009
  return bucket;
@@ -83907,7 +84042,8 @@ const zod_v4_core_memoizer_memo = {
83907
84042
  attach(inst) {
83908
84043
  var _a;
83909
84044
  let isRecursiveInst;
83910
- // `bucket` memoized for one parse; a recursive schema is re-entered many times and its bucket never changes
84045
+ let rechecked = false;
84046
+ // a recursive schema is re-entered many times per parse and its bucket never changes
83911
84047
  let lastCtx;
83912
84048
  let lastBucket;
83913
84049
  // Wraps `parse` in a deferred so it sees the container's final parse. Core's own deferred copies `parse` into `run` when there are no checks, and it ran first, so `run` is patched to match; with checks, `run` reads `parse` dynamically.
@@ -83916,21 +84052,26 @@ const zod_v4_core_memoizer_memo = {
83916
84052
  const base = inst._zod.parse;
83917
84053
  const wrapped = (payload, ctx) => {
83918
84054
  if (isRecursiveInst === undefined) {
83919
- isRecursiveInst = v4_core_memoizer_isRecursive(inst, new Set());
83920
- if (!isRecursiveInst) {
84055
+ const walked = v4_core_memoizer_isRecursive(inst, new Set(), false);
84056
+ if (walked === NONE) {
83921
84057
  // Nothing here can ever fire, so take it back out.
83922
84058
  inst._zod.parse = base;
83923
84059
  if (inst._zod.run === wrapped)
83924
84060
  inst._zod.run = base;
83925
84061
  return base(payload, ctx);
83926
84062
  }
84063
+ // this parse resolves the deferred edges on its own path, so ask once more before latching
84064
+ if (walked === PROVEN || rechecked)
84065
+ isRecursiveInst = true;
84066
+ else
84067
+ rechecked = true;
83927
84068
  }
83928
84069
  const input = payload.value;
83929
- if (input === null || typeof input !== "object")
84070
+ if (!isRef(input))
83930
84071
  return base(payload, ctx);
83931
84072
  let state = ctx[v4_core_memoizer_STATE];
83932
84073
  if (!state) {
83933
- state = { buckets: new Map(), backEdges: undefined };
84074
+ state = { buckets: new WeakMap(), backEdges: undefined };
83934
84075
  ctx[v4_core_memoizer_STATE] = state;
83935
84076
  }
83936
84077
  let bucket;
@@ -83952,7 +84093,7 @@ const zod_v4_core_memoizer_memo = {
83952
84093
  else {
83953
84094
  // Still being parsed: its own checks cover it, so skip them here.
83954
84095
  payload.memo = true;
83955
- state.backEdges ?? (state.backEdges = new Set());
84096
+ state.backEdges ?? (state.backEdges = new WeakSet());
83956
84097
  state.backEdges.add(hit.value);
83957
84098
  }
83958
84099
  return payload;
@@ -83988,7 +84129,7 @@ function v4_core_memoizer_memoizer() {
83988
84129
  /** Whether this value is a node a back-edge resolved to before it finished. */
83989
84130
  function v4_core_memoizer_isBackEdge(ctx, value) {
83990
84131
  const backEdges = ctx[v4_core_memoizer_STATE]?.backEdges;
83991
- return backEdges !== undefined && value !== null && typeof value === "object" && backEdges.has(value);
84132
+ return backEdges !== undefined && isRef(value) && backEdges.has(value);
83992
84133
  }
83993
84134
 
83994
84135
  ;// CONCATENATED MODULE: ../../node_modules/zod/v4/core/regexes.js
@@ -84025,7 +84166,7 @@ const core_regexes_uuid4 = /*@__PURE__*/ (/* unused pure expression or super */
84025
84166
  const core_regexes_uuid6 = /*@__PURE__*/ (/* unused pure expression or super */ null && (core_regexes_uuid(6)));
84026
84167
  const core_regexes_uuid7 = /*@__PURE__*/ (/* unused pure expression or super */ null && (core_regexes_uuid(7)));
84027
84168
  /** Practical email validation */
84028
- const core_regexes_email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
84169
+ const core_regexes_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,}$/;
84029
84170
  /** Equivalent to the HTML5 input[type=email] validation implemented by browsers. Source: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email */
84030
84171
  const core_regexes_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])?)*$/;
84031
84172
  /** The classic emailregex.com regex for RFC 5322-compliant emails */
@@ -84035,8 +84176,8 @@ const core_regexes_unicodeEmail = /^[^\s@"]{1,64}@[^\s@]{1,255}$/u;
84035
84176
  const core_regexes_idnEmail = (/* unused pure expression or super */ null && (core_regexes_unicodeEmail));
84036
84177
  const core_regexes_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])?)*$/;
84037
84178
  // from https://thekevinscott.com/emojis-in-javascript/#writing-a-regular-expression
84038
- // Single character class, not an alternation: the two properties overlap (U+1F9B0-U+1F9B3), so `(A|B)+` backtracks exponentially on a failed match.
84039
- const v4_core_regexes_emoji = `^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
84179
+ // Single character class, not an alternation: the two properties overlap (U+1F9B0-U+1F9B3), so `(A|B)+` backtracks exponentially on a failed match. The leading lookahead then demands one anchor — a pictograph, a regional indicator, or the enclosing keycap — because `\p{Emoji_Component}` on its own covers ASCII digits, `#`, `*`, ZWJ, variation selectors and skin tone modifiers, none of which is an emoji without a base.
84180
+ const v4_core_regexes_emoji = `^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
84040
84181
  function zod_v4_core_regexes_emoji() {
84041
84182
  return new RegExp(v4_core_regexes_emoji, "u");
84042
84183
  }
@@ -84050,7 +84191,7 @@ const core_regexes_cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9]
84050
84191
  const core_regexes_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])$/;
84051
84192
  // https://stackoverflow.com/questions/7860392/determine-if-string-is-in-base64-using-javascript
84052
84193
  const v4_core_regexes_base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
84053
- const v4_core_regexes_base64url = /^[A-Za-z0-9_-]*$/;
84194
+ const v4_core_regexes_base64url = /^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;
84054
84195
  // based on https://stackoverflow.com/questions/106179/regular-expression-to-match-dns-hostname-or-ip-address
84055
84196
  // export const hostname: RegExp = /^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;
84056
84197
  const v4_core_regexes_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])?)*\.?$/;
@@ -84060,6 +84201,10 @@ const core_regexes_httpProtocol = /^https?$/;
84060
84201
  const core_regexes_e164 = /^\+[1-9]\d{6,14}$/;
84061
84202
  // Credit card shape: 12–19 digits, optionally separated by single spaces or single hyphens. ISO/IEC 7812 caps the PAN at 19 digits; 12 is the shortest issued length (Maestro).
84062
84203
  const core_regexes_creditCard = /^\d(?:[ -]?\d){11,18}$/;
84204
+ // ISO 4217 alpha codes from the SIX list, regenerated by scripts/update-iso-4217.ts
84205
+ const 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)$/;
84206
+ // iban electronic format: 2-letter country, check digits 02-98 (the only values `98 - remainder` can produce), 11-30 bban characters
84207
+ const regexes_iban = /^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/;
84063
84208
  const core_regexes_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])))`;
84064
84209
  /** Anchors a pattern source. The interpolation lives here rather than at the call site because
84065
84210
  * esbuild will not drop a `@__PURE__` call whose own argument interpolates a variable, but it
@@ -84095,6 +84240,8 @@ function core_regexes_datetime(args) {
84095
84240
  const timeRegex = args.local ? `${qualified}|${core_regexes_timeSource({ precision: args.precision })}` : qualified;
84096
84241
  return new RegExp(`^${core_regexes_dateSource}T(?:${timeRegex})$`);
84097
84242
  }
84243
+ // the unbounded form of `string()` as a literal, so every plain string shares one instance instead of building its own
84244
+ const anyString = /^[\s\S]{0,}$/;
84098
84245
  const v4_core_regexes_string = (params) => {
84099
84246
  const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
84100
84247
  return new RegExp(`^${regex}$`);
@@ -84172,16 +84319,6 @@ const v4_core_checks_numericOriginMap = (/* unused pure expression or super */ n
84172
84319
  const v4_core_checks_$ZodCheckLessThan = /*@__PURE__*/ (/* unused pure expression or super */ null && (core.$constructor("$ZodCheckLessThan", (inst, def) => {
84173
84320
  v4_core_checks_$ZodCheck.init(inst, def);
84174
84321
  const origin = v4_core_checks_numericOriginMap[typeof def.value];
84175
- inst._zod.onattach.push((inst) => {
84176
- const bag = inst._zod.bag;
84177
- const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
84178
- if (def.value < curr) {
84179
- if (def.inclusive)
84180
- bag.maximum = def.value;
84181
- else
84182
- bag.exclusiveMaximum = def.value;
84183
- }
84184
- });
84185
84322
  inst._zod.check = (payload) => {
84186
84323
  if (def.inclusive ? payload.value <= def.value : payload.value < def.value) {
84187
84324
  return;
@@ -84200,16 +84337,6 @@ const v4_core_checks_$ZodCheckLessThan = /*@__PURE__*/ (/* unused pure expressio
84200
84337
  const v4_core_checks_$ZodCheckGreaterThan = /*@__PURE__*/ (/* unused pure expression or super */ null && (core.$constructor("$ZodCheckGreaterThan", (inst, def) => {
84201
84338
  v4_core_checks_$ZodCheck.init(inst, def);
84202
84339
  const origin = v4_core_checks_numericOriginMap[typeof def.value];
84203
- inst._zod.onattach.push((inst) => {
84204
- const bag = inst._zod.bag;
84205
- const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
84206
- if (def.value > curr) {
84207
- if (def.inclusive)
84208
- bag.minimum = def.value;
84209
- else
84210
- bag.exclusiveMinimum = def.value;
84211
- }
84212
- });
84213
84340
  inst._zod.check = (payload) => {
84214
84341
  if (def.inclusive ? payload.value >= def.value : payload.value > def.value) {
84215
84342
  return;
@@ -84228,10 +84355,6 @@ const v4_core_checks_$ZodCheckGreaterThan = /*@__PURE__*/ (/* unused pure expres
84228
84355
  const v4_core_checks_$ZodCheckMultipleOf =
84229
84356
  /*@__PURE__*/ (/* unused pure expression or super */ null && (core.$constructor("$ZodCheckMultipleOf", (inst, def) => {
84230
84357
  v4_core_checks_$ZodCheck.init(inst, def);
84231
- inst._zod.onattach.push((inst) => {
84232
- var _a;
84233
- (_a = inst._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
84234
- });
84235
84358
  inst._zod.check = (payload) => {
84236
84359
  if (typeof payload.value !== typeof def.value)
84237
84360
  throw new Error("Cannot mix number and bigint in multiple_of check.");
@@ -84257,14 +84380,6 @@ const v4_core_checks_$ZodCheckNumberFormat = /*@__PURE__*/ (/* unused pure expre
84257
84380
  const isInt = def.format?.includes("int");
84258
84381
  const origin = isInt ? "int" : "number";
84259
84382
  const [minimum, maximum] = util.NUMBER_FORMAT_RANGES[def.format];
84260
- inst._zod.onattach.push((inst) => {
84261
- const bag = inst._zod.bag;
84262
- bag.format = def.format;
84263
- bag.minimum = minimum;
84264
- bag.maximum = maximum;
84265
- if (isInt)
84266
- bag.pattern = regexes.integer;
84267
- });
84268
84383
  inst._zod.check = (payload) => {
84269
84384
  const input = payload.value;
84270
84385
  if (isInt) {
@@ -84353,12 +84468,6 @@ const v4_core_checks_$ZodCheckNumberFormat = /*@__PURE__*/ (/* unused pure expre
84353
84468
  const v4_core_checks_$ZodCheckBigIntFormat = /*@__PURE__*/ (/* unused pure expression or super */ null && (core.$constructor("$ZodCheckBigIntFormat", (inst, def) => {
84354
84469
  v4_core_checks_$ZodCheck.init(inst, def); // no format checks
84355
84470
  const [minimum, maximum] = util.BIGINT_FORMAT_RANGES[def.format];
84356
- inst._zod.onattach.push((inst) => {
84357
- const bag = inst._zod.bag;
84358
- bag.format = def.format;
84359
- bag.minimum = minimum;
84360
- bag.maximum = maximum;
84361
- });
84362
84471
  inst._zod.check = (payload) => {
84363
84472
  const input = payload.value;
84364
84473
  if (input < minimum) {
@@ -84389,11 +84498,6 @@ const v4_core_checks_$ZodCheckMaxSize = /*@__PURE__*/ (/* unused pure expression
84389
84498
  var _a;
84390
84499
  v4_core_checks_$ZodCheck.init(inst, def);
84391
84500
  (_a = inst._zod.def).when ?? (_a.when = v4_core_checks_whenHasSize);
84392
- inst._zod.onattach.push((inst) => {
84393
- const curr = (inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY);
84394
- if (def.maximum < curr)
84395
- inst._zod.bag.maximum = def.maximum;
84396
- });
84397
84501
  inst._zod.check = (payload) => {
84398
84502
  const input = payload.value;
84399
84503
  const size = input.size;
@@ -84414,11 +84518,6 @@ const v4_core_checks_$ZodCheckMinSize = /*@__PURE__*/ (/* unused pure expression
84414
84518
  var _a;
84415
84519
  v4_core_checks_$ZodCheck.init(inst, def);
84416
84520
  (_a = inst._zod.def).when ?? (_a.when = v4_core_checks_whenHasSize);
84417
- inst._zod.onattach.push((inst) => {
84418
- const curr = (inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY);
84419
- if (def.minimum > curr)
84420
- inst._zod.bag.minimum = def.minimum;
84421
- });
84422
84521
  inst._zod.check = (payload) => {
84423
84522
  const input = payload.value;
84424
84523
  const size = input.size;
@@ -84439,12 +84538,6 @@ const v4_core_checks_$ZodCheckSizeEquals = /*@__PURE__*/ (/* unused pure express
84439
84538
  var _a;
84440
84539
  v4_core_checks_$ZodCheck.init(inst, def);
84441
84540
  (_a = inst._zod.def).when ?? (_a.when = v4_core_checks_whenHasSize);
84442
- inst._zod.onattach.push((inst) => {
84443
- const bag = inst._zod.bag;
84444
- bag.minimum = def.size;
84445
- bag.maximum = def.size;
84446
- bag.size = def.size;
84447
- });
84448
84541
  inst._zod.check = (payload) => {
84449
84542
  const input = payload.value;
84450
84543
  const size = input.size;
@@ -84466,11 +84559,6 @@ const v4_core_checks_$ZodCheckMaxLength = /*@__PURE__*/ v4_core_core_$constructo
84466
84559
  var _a;
84467
84560
  v4_core_checks_$ZodCheck.init(inst, def);
84468
84561
  (_a = inst._zod.def).when ?? (_a.when = v4_core_checks_whenHasLength);
84469
- inst._zod.onattach.push((inst) => {
84470
- const curr = (inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY);
84471
- if (def.maximum < curr)
84472
- inst._zod.bag.maximum = def.maximum;
84473
- });
84474
84562
  inst._zod.check = (payload) => {
84475
84563
  const input = payload.value;
84476
84564
  const units = input.length;
@@ -84494,11 +84582,6 @@ const v4_core_checks_$ZodCheckMinLength = /*@__PURE__*/ v4_core_core_$constructo
84494
84582
  var _a;
84495
84583
  v4_core_checks_$ZodCheck.init(inst, def);
84496
84584
  (_a = inst._zod.def).when ?? (_a.when = v4_core_checks_whenHasLength);
84497
- inst._zod.onattach.push((inst) => {
84498
- const curr = (inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY);
84499
- if (def.minimum > curr)
84500
- inst._zod.bag.minimum = def.minimum;
84501
- });
84502
84585
  inst._zod.check = (payload) => {
84503
84586
  const input = payload.value;
84504
84587
  const units = input.length;
@@ -84524,12 +84607,6 @@ const v4_core_checks_$ZodCheckLengthEquals = /*@__PURE__*/ v4_core_core_$constru
84524
84607
  var _a;
84525
84608
  v4_core_checks_$ZodCheck.init(inst, def);
84526
84609
  (_a = inst._zod.def).when ?? (_a.when = v4_core_checks_whenHasLength);
84527
- inst._zod.onattach.push((inst) => {
84528
- const bag = inst._zod.bag;
84529
- bag.minimum = def.length;
84530
- bag.maximum = def.length;
84531
- bag.length = def.length;
84532
- });
84533
84610
  inst._zod.check = (payload) => {
84534
84611
  const input = payload.value;
84535
84612
  const units = input.length;
@@ -84555,14 +84632,6 @@ const v4_core_checks_$ZodCheckLengthEquals = /*@__PURE__*/ v4_core_core_$constru
84555
84632
  const v4_core_checks_$ZodCheckStringFormat = /*@__PURE__*/ v4_core_core_$constructor("$ZodCheckStringFormat", (inst, def) => {
84556
84633
  var _a, _b;
84557
84634
  v4_core_checks_$ZodCheck.init(inst, def);
84558
- inst._zod.onattach.push((inst) => {
84559
- const bag = inst._zod.bag;
84560
- bag.format = def.format;
84561
- if (def.pattern) {
84562
- bag.patterns ?? (bag.patterns = new Set());
84563
- bag.patterns.add(def.pattern);
84564
- }
84565
- });
84566
84635
  if (def.pattern)
84567
84636
  (_a = inst._zod).check ?? (_a.check = (payload) => {
84568
84637
  def.pattern.lastIndex = 0;
@@ -84614,11 +84683,6 @@ const v4_core_checks_$ZodCheckIncludes = /*@__PURE__*/ v4_core_core_$constructor
84614
84683
  // (`{N,}`), not exactly `position` chars (`{N}`).
84615
84684
  const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position},}${escapedRegex}` : escapedRegex);
84616
84685
  def.pattern = pattern;
84617
- inst._zod.onattach.push((inst) => {
84618
- const bag = inst._zod.bag;
84619
- bag.patterns ?? (bag.patterns = new Set());
84620
- bag.patterns.add(pattern);
84621
- });
84622
84686
  inst._zod.check = (payload) => {
84623
84687
  if (payload.value.includes(def.includes, def.position))
84624
84688
  return;
@@ -84637,11 +84701,6 @@ const v4_core_checks_$ZodCheckStartsWith = /*@__PURE__*/ v4_core_core_$construct
84637
84701
  v4_core_checks_$ZodCheck.init(inst, def);
84638
84702
  const pattern = new RegExp(`^${v4_core_util_escapeRegex(def.prefix)}.*`);
84639
84703
  def.pattern ?? (def.pattern = pattern);
84640
- inst._zod.onattach.push((inst) => {
84641
- const bag = inst._zod.bag;
84642
- bag.patterns ?? (bag.patterns = new Set());
84643
- bag.patterns.add(pattern);
84644
- });
84645
84704
  inst._zod.check = (payload) => {
84646
84705
  if (payload.value.startsWith(def.prefix))
84647
84706
  return;
@@ -84660,11 +84719,6 @@ const v4_core_checks_$ZodCheckEndsWith = /*@__PURE__*/ v4_core_core_$constructor
84660
84719
  v4_core_checks_$ZodCheck.init(inst, def);
84661
84720
  const pattern = new RegExp(`.*${v4_core_util_escapeRegex(def.suffix)}$`);
84662
84721
  def.pattern ?? (def.pattern = pattern);
84663
- inst._zod.onattach.push((inst) => {
84664
- const bag = inst._zod.bag;
84665
- bag.patterns ?? (bag.patterns = new Set());
84666
- bag.patterns.add(pattern);
84667
- });
84668
84722
  inst._zod.check = (payload) => {
84669
84723
  if (payload.value.endsWith(def.suffix))
84670
84724
  return;
@@ -84701,12 +84755,40 @@ const v4_core_checks_$ZodCheckProperty = /*@__PURE__*/ (/* unused pure expressio
84701
84755
  return;
84702
84756
  };
84703
84757
  })));
84758
+ const $ZodCheckProperties = /*@__PURE__*/ (/* unused pure expression or super */ null && (core.$constructor("$ZodCheckProperties", (inst, def) => {
84759
+ v4_core_checks_$ZodCheck.init(inst, def);
84760
+ util.hide(inst, Symbol.iterator, function* () {
84761
+ yield inst;
84762
+ });
84763
+ // key and schema snapshotted together: reading one live and the other cached lets a later mutation of the caller's shape object pair a stale key with a missing schema
84764
+ let entries;
84765
+ inst._zod.check = (payload) => {
84766
+ // the base schema already typed the value, so only a nullish one is rejected here: the properties read on a primitive too, matching z.property() on a string's length
84767
+ if (payload.value == null) {
84768
+ payload.issues.push({ expected: "object", code: "invalid_type", input: payload.value, inst });
84769
+ return undefined;
84770
+ }
84771
+ entries ?? (entries = Reflect.ownKeys(def.shape).map((key) => [key, def.shape[key]]));
84772
+ const input = payload.value;
84773
+ let proms;
84774
+ for (const [key, schema] of entries) {
84775
+ const result = schema._zod.run({ value: input[key], issues: [] }, {});
84776
+ if (result instanceof Promise) {
84777
+ proms ?? (proms = []);
84778
+ proms.push(result.then((result) => v4_core_checks_handleCheckPropertyResult(result, payload, key)));
84779
+ }
84780
+ else {
84781
+ v4_core_checks_handleCheckPropertyResult(result, payload, key);
84782
+ }
84783
+ }
84784
+ if (proms)
84785
+ return Promise.all(proms).then(() => undefined);
84786
+ return undefined;
84787
+ };
84788
+ })));
84704
84789
  const v4_core_checks_$ZodCheckMimeType = /*@__PURE__*/ (/* unused pure expression or super */ null && (core.$constructor("$ZodCheckMimeType", (inst, def) => {
84705
84790
  v4_core_checks_$ZodCheck.init(inst, def);
84706
84791
  const mimeSet = new Set(def.mime);
84707
- inst._zod.onattach.push((inst) => {
84708
- inst._zod.bag.mime = def.mime;
84709
- });
84710
84792
  inst._zod.check = (payload) => {
84711
84793
  if (mimeSet.has(payload.value.type))
84712
84794
  return;
@@ -84734,10 +84816,15 @@ class v4_core_doc_Doc {
84734
84816
  this.args = args;
84735
84817
  this.closed = closed;
84736
84818
  }
84819
+ // the compiler catches a child's throw and keeps writing into this doc, so the indent has to unwind with it
84737
84820
  indented(fn) {
84738
84821
  this.indent += 1;
84739
- fn(this);
84740
- this.indent -= 1;
84822
+ try {
84823
+ fn(this);
84824
+ }
84825
+ finally {
84826
+ this.indent -= 1;
84827
+ }
84741
84828
  }
84742
84829
  write(arg) {
84743
84830
  if (typeof arg === "function") {
@@ -84761,439 +84848,11 @@ class v4_core_doc_Doc {
84761
84848
  }
84762
84849
  }
84763
84850
 
84764
- ;// CONCATENATED MODULE: ../../node_modules/zod/v4/core/errors.js
84765
-
84766
-
84767
- /* Computing the message eagerly is expensive (pretty-printed JSON of all
84768
- * issues), so defer it until first read. The accessor functions and
84769
- * descriptors are shared across instances to keep error construction
84770
- * cheap; the computed message is cached on the internals object. The
84771
- * setter preserves plain assignment semantics for consumers that
84772
- * overwrite `message`. */
84773
- function v4_core_errors_getMessage() {
84774
- const internals = this._zod;
84775
- internals.message ?? (internals.message = JSON.stringify(internals.def, v4_core_util_jsonStringifyReplacer, 2));
84776
- return internals.message;
84777
- }
84778
- function v4_core_errors_setMessage(value) {
84779
- this._zod.message = value;
84780
- }
84781
- const v4_core_errors_messageDesc = {
84782
- get: v4_core_errors_getMessage,
84783
- set: v4_core_errors_setMessage,
84784
- enumerable: true,
84785
- configurable: true,
84786
- };
84787
- const zod_v4_core_errors_zodDesc = { value: undefined, enumerable: false };
84788
- const v4_core_errors_issuesDesc = { value: undefined, enumerable: false };
84789
- /* Prototypes that already carry the lazy `toString`. Seeded with the
84790
- * intrinsics so that `init` on a foreign object — it accepts any object —
84791
- * can never install an accessor onto a prototype we do not own. */
84792
- const v4_core_errors_installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
84793
- const zod_v4_core_errors_initializer = (inst, def) => {
84794
- inst.name = "$ZodError";
84795
- zod_v4_core_errors_zodDesc.value = inst._zod;
84796
- Object.defineProperty(inst, "_zod", zod_v4_core_errors_zodDesc);
84797
- v4_core_errors_issuesDesc.value = def;
84798
- Object.defineProperty(inst, "issues", v4_core_errors_issuesDesc);
84799
- // Clear the shared slots; a retained `value` pins the last error's issues.
84800
- zod_v4_core_errors_zodDesc.value = undefined;
84801
- v4_core_errors_issuesDesc.value = undefined;
84802
- Object.defineProperty(inst, "message", v4_core_errors_messageDesc);
84803
- /* `toString` lives as a non-enumerable lazy getter on the shared
84804
- * prototype; on first access it caches a per-instance closure so
84805
- * detached usage still works. */
84806
- const proto = Object.getPrototypeOf(inst);
84807
- if (!v4_core_errors_installedToString.has(proto)) {
84808
- v4_core_errors_installedToString.add(proto);
84809
- Object.defineProperty(proto, "toString", {
84810
- configurable: true,
84811
- enumerable: false,
84812
- get() {
84813
- const value = () => this.message;
84814
- Object.defineProperty(this, "toString", { value, configurable: true, writable: true });
84815
- return value;
84816
- },
84817
- set(value) {
84818
- Object.defineProperty(this, "toString", { value, configurable: true, writable: true });
84819
- },
84820
- });
84821
- }
84822
- };
84823
- const v4_core_errors_$ZodError = v4_core_core_$constructor("$ZodError", zod_v4_core_errors_initializer);
84824
- const v4_core_errors_$ZodRealError = v4_core_core_$constructor("$ZodError", zod_v4_core_errors_initializer, undefined, {
84825
- Parent: Error,
84826
- });
84827
- /** Get-or-create `obj[key]` as an own data property. A path segment naming an inherited member
84828
- * ("toString", "constructor") would otherwise read through to the prototype, and assigning
84829
- * "__proto__" would hit the setter instead of creating a key. */
84830
- function zod_v4_core_errors_node(obj, key, make) {
84831
- if (!Object.prototype.hasOwnProperty.call(obj, key)) {
84832
- if (key === "__proto__") {
84833
- Object.defineProperty(obj, key, { value: make(), writable: true, enumerable: true, configurable: true });
84834
- }
84835
- else {
84836
- obj[key] = make();
84837
- }
84838
- }
84839
- return obj[key];
84840
- }
84841
- function v4_core_errors_flattenError(error, mapper = (issue) => issue.message) {
84842
- const fieldErrors = {};
84843
- const formErrors = [];
84844
- for (const sub of error.issues) {
84845
- if (sub.path.length > 0) {
84846
- zod_v4_core_errors_node(fieldErrors, sub.path[0], () => []).push(mapper(sub));
84847
- }
84848
- else {
84849
- formErrors.push(mapper(sub));
84850
- }
84851
- }
84852
- return { formErrors, fieldErrors };
84853
- }
84854
- function v4_core_errors_formatError(error, mapper = (issue) => issue.message) {
84855
- const fieldErrors = { _errors: [] };
84856
- const processError = (error, path = []) => {
84857
- for (const issue of error.issues) {
84858
- if (issue.code === "invalid_union" && issue.errors.length) {
84859
- issue.errors.map((issues) => processError({ issues }, [...path, ...issue.path]));
84860
- }
84861
- else if (issue.code === "invalid_key") {
84862
- processError({ issues: issue.issues }, [...path, ...issue.path]);
84863
- }
84864
- else if (issue.code === "invalid_element") {
84865
- processError({ issues: issue.issues }, [...path, ...issue.path]);
84866
- }
84867
- else {
84868
- const fullpath = [...path, ...issue.path];
84869
- if (fullpath.length === 0) {
84870
- fieldErrors._errors.push(mapper(issue));
84871
- }
84872
- else {
84873
- let curr = fieldErrors;
84874
- let i = 0;
84875
- while (i < fullpath.length) {
84876
- const el = fullpath[i];
84877
- const terminal = i === fullpath.length - 1;
84878
- // `_errors` is reserved by this legacy format, so merge a matching path segment into the current node instead of treating its array as a child.
84879
- if (el === "_errors") {
84880
- if (terminal)
84881
- curr._errors.push(mapper(issue));
84882
- i++;
84883
- continue;
84884
- }
84885
- // A path element may collide with an inherited property name such as
84886
- // "__proto__" or "constructor". Truthiness checks read the prototype
84887
- // (so no node is created, then ._errors.push throws), and bracket
84888
- // assignment of "__proto__" hits the setter instead of creating an
84889
- // own key. Guard the read with hasOwnProperty and create the node
84890
- // with defineProperty so any path element becomes a real own key.
84891
- if (!Object.prototype.hasOwnProperty.call(curr, el)) {
84892
- Object.defineProperty(curr, el, {
84893
- value: { _errors: [] },
84894
- enumerable: true,
84895
- writable: true,
84896
- configurable: true,
84897
- });
84898
- }
84899
- const node = curr[el];
84900
- if (terminal) {
84901
- node._errors.push(mapper(issue));
84902
- }
84903
- curr = node;
84904
- i++;
84905
- }
84906
- }
84907
- }
84908
- }
84909
- };
84910
- processError(error);
84911
- return fieldErrors;
84912
- }
84913
- function v4_core_errors_treeifyError(error, mapper = (issue) => issue.message) {
84914
- const result = { errors: [] };
84915
- const processError = (error, path = []) => {
84916
- var _a;
84917
- for (const issue of error.issues) {
84918
- if (issue.code === "invalid_union" && issue.errors.length) {
84919
- // regular union error
84920
- issue.errors.map((issues) => processError({ issues }, [...path, ...issue.path]));
84921
- }
84922
- else if (issue.code === "invalid_key") {
84923
- processError({ issues: issue.issues }, [...path, ...issue.path]);
84924
- }
84925
- else if (issue.code === "invalid_element") {
84926
- processError({ issues: issue.issues }, [...path, ...issue.path]);
84927
- }
84928
- else {
84929
- const fullpath = [...path, ...issue.path];
84930
- if (fullpath.length === 0) {
84931
- result.errors.push(mapper(issue));
84932
- continue;
84933
- }
84934
- let curr = result;
84935
- let i = 0;
84936
- while (i < fullpath.length) {
84937
- const el = fullpath[i];
84938
- const terminal = i === fullpath.length - 1;
84939
- if (typeof el === "string") {
84940
- curr.properties ?? (curr.properties = {});
84941
- // el may collide with an inherited property name ("__proto__",
84942
- // "constructor", ...); ??= reads the prototype so the node is never
84943
- // created and curr.errors.push throws. Guard with hasOwnProperty and
84944
- // create the node with defineProperty so "__proto__" becomes a real
84945
- // own key rather than invoking the prototype setter.
84946
- if (!Object.prototype.hasOwnProperty.call(curr.properties, el)) {
84947
- Object.defineProperty(curr.properties, el, {
84948
- value: { errors: [] },
84949
- enumerable: true,
84950
- writable: true,
84951
- configurable: true,
84952
- });
84953
- }
84954
- curr = curr.properties[el];
84955
- }
84956
- else {
84957
- curr.items ?? (curr.items = []);
84958
- (_a = curr.items)[el] ?? (_a[el] = { errors: [] });
84959
- curr = curr.items[el];
84960
- }
84961
- if (terminal) {
84962
- curr.errors.push(mapper(issue));
84963
- }
84964
- i++;
84965
- }
84966
- }
84967
- }
84968
- };
84969
- processError(error);
84970
- return result;
84971
- }
84972
- /** Format a ZodError as a human-readable string in the following form.
84973
- *
84974
- * From
84975
- *
84976
- * ```ts
84977
- * ZodError {
84978
- * issues: [
84979
- * {
84980
- * expected: 'string',
84981
- * code: 'invalid_type',
84982
- * path: [ 'username' ],
84983
- * message: 'Invalid input: expected string'
84984
- * },
84985
- * {
84986
- * expected: 'number',
84987
- * code: 'invalid_type',
84988
- * path: [ 'favoriteNumbers', 1 ],
84989
- * message: 'Invalid input: expected number'
84990
- * }
84991
- * ];
84992
- * }
84993
- * ```
84994
- *
84995
- * to
84996
- *
84997
- * ```
84998
- * username
84999
- * ✖ Expected number, received string at "username
85000
- * favoriteNumbers[0]
85001
- * ✖ Invalid input: expected number
85002
- * ```
85003
- */
85004
- function v4_core_errors_toDotPath(_path) {
85005
- const segs = [];
85006
- const path = _path.map((seg) => (typeof seg === "object" ? seg.key : seg));
85007
- for (const seg of path) {
85008
- if (typeof seg === "number")
85009
- segs.push(`[${seg}]`);
85010
- else if (typeof seg === "symbol")
85011
- segs.push(`[${JSON.stringify(String(seg))}]`);
85012
- else if (/[^\w$]/.test(seg))
85013
- segs.push(`[${JSON.stringify(seg)}]`);
85014
- else {
85015
- if (segs.length)
85016
- segs.push(".");
85017
- segs.push(seg);
85018
- }
85019
- }
85020
- return segs.join("");
85021
- }
85022
- function v4_core_errors_prettifyError(error) {
85023
- const lines = [];
85024
- // sort by path length
85025
- const issues = [...error.issues].sort((a, b) => (a.path ?? []).length - (b.path ?? []).length);
85026
- // Process each issue
85027
- for (const issue of issues) {
85028
- lines.push(`✖ ${issue.message}`);
85029
- if (issue.path?.length)
85030
- lines.push(` → at ${v4_core_errors_toDotPath(issue.path)}`);
85031
- }
85032
- // Convert Map to formatted string
85033
- return lines.join("\n");
85034
- }
85035
-
85036
- ;// CONCATENATED MODULE: ../../node_modules/zod/v4/core/parse.js
85037
-
85038
-
85039
-
85040
- // Always both keys, so the `_params` read site in `_parse` sees one object shape rather than two.
85041
- function v4_core_parse_finalizeParams(callee, params) {
85042
- return { callee: params?.callee ?? callee, Err: params?.Err };
85043
- }
85044
- const node_modules_zod_v4_core_parse_parse_1 = (_Err) => {
85045
- const fn = (schema, value, _ctx, _params) => {
85046
- const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
85047
- const result = schema._zod.run({ value, issues: [] }, ctx);
85048
- if (result instanceof Promise) {
85049
- throw new v4_core_core_$ZodAsyncError();
85050
- }
85051
- if (result.issues.length) {
85052
- const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => v4_core_util_finalizeIssue(iss, ctx, zod_v4_core_core_config())));
85053
- v4_core_util_captureStackTrace(e, _params?.callee ?? fn);
85054
- throw e;
85055
- }
85056
- return result.value;
85057
- };
85058
- return fn;
85059
- };
85060
- const node_modules_zod_v4_core_parse_parse_2 = /* @__PURE__*/ node_modules_zod_v4_core_parse_parse_1(v4_core_errors_$ZodRealError);
85061
- const node_modules_zod_v4_core_parse_parseAsync_1 = (_Err) => {
85062
- const fn = async (schema, value, _ctx, params) => {
85063
- const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
85064
- let result = schema._zod.run({ value, issues: [] }, ctx);
85065
- if (result instanceof Promise)
85066
- result = await result;
85067
- if (result.issues.length) {
85068
- const e = new (params?.Err ?? _Err)(result.issues.map((iss) => v4_core_util_finalizeIssue(iss, ctx, zod_v4_core_core_config())));
85069
- v4_core_util_captureStackTrace(e, params?.callee ?? fn);
85070
- throw e;
85071
- }
85072
- return result.value;
85073
- };
85074
- return fn;
85075
- };
85076
- const node_modules_zod_v4_core_parse_parseAsync_2 = /* @__PURE__*/ node_modules_zod_v4_core_parse_parseAsync_1(v4_core_errors_$ZodRealError);
85077
- const node_modules_zod_v4_core_parse_safeParse_0 = (_Err) => (schema, value, _ctx) => {
85078
- const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
85079
- const result = schema._zod.run({ value, issues: [] }, ctx);
85080
- if (result instanceof Promise) {
85081
- throw new v4_core_core_$ZodAsyncError();
85082
- }
85083
- return result.issues.length
85084
- ? {
85085
- success: false,
85086
- error: new (_Err ?? v4_core_errors_$ZodError)(result.issues.map((iss) => v4_core_util_finalizeIssue(iss, ctx, zod_v4_core_core_config()))),
85087
- }
85088
- : { success: true, data: result.value };
85089
- };
85090
- const node_modules_zod_v4_core_parse_safeParse_1 = /* @__PURE__*/ node_modules_zod_v4_core_parse_safeParse_0(v4_core_errors_$ZodRealError);
85091
- const node_modules_zod_v4_core_parse_safeParseAsync_0 = (_Err) => async (schema, value, _ctx) => {
85092
- const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
85093
- let result = schema._zod.run({ value, issues: [] }, ctx);
85094
- if (result instanceof Promise)
85095
- result = await result;
85096
- return result.issues.length
85097
- ? {
85098
- success: false,
85099
- error: new _Err(result.issues.map((iss) => v4_core_util_finalizeIssue(iss, ctx, zod_v4_core_core_config()))),
85100
- }
85101
- : { success: true, data: result.value };
85102
- };
85103
- const node_modules_zod_v4_core_parse_safeParseAsync_1 = /* @__PURE__*/ node_modules_zod_v4_core_parse_safeParseAsync_0(v4_core_errors_$ZodRealError);
85104
- // registry mirrors of the compiler's sentinels, so this module never imports the compiler
85105
- const v4_core_parse_COMPILE_INVALID = /* @__PURE__ */ (/* unused pure expression or super */ null && (Symbol.for("zod.compile.invalid")));
85106
- const v4_core_parse_COMPILE_FALLBACK = /* @__PURE__ */ (/* unused pure expression or super */ null && (Symbol.for("zod.compile.fallback")));
85107
- // Deliberately tiny, because v8 will not inline a body carrying the fallback's object literals and throw. Everything that is not the compiled happy path lives in validateFallback, and that split is worth ~35% on a compiled schema.
85108
- const v4_core_parse_validate = ((schema, value, _ctx) => {
85109
- const validator = schema._zod.bag.validator;
85110
- if (validator !== undefined && validator(value) !== v4_core_parse_COMPILE_INVALID)
85111
- return true;
85112
- return v4_core_parse_validateFallback(schema, value, _ctx);
85113
- });
85114
- function v4_core_parse_validateFallback(schema, value, _ctx) {
85115
- const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
85116
- const fallbackRun = schema._zod.bag.fallbackRun;
85117
- let result;
85118
- if (fallbackRun) {
85119
- // skip nested fast paths on the fallback, so user callbacks keep the at-most-twice bound
85120
- ctx[v4_core_parse_COMPILE_FALLBACK] = true;
85121
- result = fallbackRun({ value, issues: [] }, ctx);
85122
- }
85123
- else {
85124
- result = schema._zod.run({ value, issues: [] }, ctx);
85125
- }
85126
- if (result instanceof Promise) {
85127
- throw new core.$ZodAsyncError();
85128
- }
85129
- return result.issues.length === 0;
85130
- }
85131
- // no fast path: the compiler keeps async parses on the runtime, because a promise-returning callback that is not declared async compiles to a throw
85132
- const v4_core_parse_validateAsync = async (schema, value, _ctx) => {
85133
- const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
85134
- let result = schema._zod.run({ value, issues: [] }, ctx);
85135
- if (result instanceof Promise)
85136
- result = await result;
85137
- return result.issues.length === 0;
85138
- };
85139
- const node_modules_zod_v4_core_parse_encode_0 = (_Err) => {
85140
- const parse = node_modules_zod_v4_core_parse_parse_1(_Err);
85141
- const fn = (schema, value, _ctx, _params) => {
85142
- const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
85143
- return parse(schema, value, ctx, v4_core_parse_finalizeParams(fn, _params));
85144
- };
85145
- return fn;
85146
- };
85147
- const node_modules_zod_v4_core_parse_encode_1 = /* @__PURE__*/ node_modules_zod_v4_core_parse_encode_0(v4_core_errors_$ZodRealError);
85148
- const node_modules_zod_v4_core_parse_decode_0 = (_Err) => {
85149
- const parse = node_modules_zod_v4_core_parse_parse_1(_Err);
85150
- const fn = (schema, value, _ctx, _params) => {
85151
- return parse(schema, value, _ctx, v4_core_parse_finalizeParams(fn, _params));
85152
- };
85153
- return fn;
85154
- };
85155
- const node_modules_zod_v4_core_parse_decode_1 = /* @__PURE__*/ node_modules_zod_v4_core_parse_decode_0(v4_core_errors_$ZodRealError);
85156
- const node_modules_zod_v4_core_parse_encodeAsync_0 = (_Err) => {
85157
- const parseAsync = node_modules_zod_v4_core_parse_parseAsync_1(_Err);
85158
- const fn = async (schema, value, _ctx, _params) => {
85159
- const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
85160
- return (await parseAsync(schema, value, ctx, v4_core_parse_finalizeParams(fn, _params)));
85161
- };
85162
- return fn;
85163
- };
85164
- const node_modules_zod_v4_core_parse_encodeAsync_1 = /* @__PURE__*/ node_modules_zod_v4_core_parse_encodeAsync_0(v4_core_errors_$ZodRealError);
85165
- const node_modules_zod_v4_core_parse_decodeAsync_0 = (_Err) => {
85166
- const parseAsync = node_modules_zod_v4_core_parse_parseAsync_1(_Err);
85167
- const fn = async (schema, value, _ctx, _params) => {
85168
- return await parseAsync(schema, value, _ctx, v4_core_parse_finalizeParams(fn, _params));
85169
- };
85170
- return fn;
85171
- };
85172
- const node_modules_zod_v4_core_parse_decodeAsync_1 = /* @__PURE__*/ node_modules_zod_v4_core_parse_decodeAsync_0(v4_core_errors_$ZodRealError);
85173
- const node_modules_zod_v4_core_parse_safeEncode_0 = (_Err) => (schema, value, _ctx) => {
85174
- const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
85175
- return node_modules_zod_v4_core_parse_safeParse_0(_Err)(schema, value, ctx);
85176
- };
85177
- const node_modules_zod_v4_core_parse_safeEncode_1 = /* @__PURE__*/ node_modules_zod_v4_core_parse_safeEncode_0(v4_core_errors_$ZodRealError);
85178
- const node_modules_zod_v4_core_parse_safeDecode_0 = (_Err) => (schema, value, _ctx) => {
85179
- return node_modules_zod_v4_core_parse_safeParse_0(_Err)(schema, value, _ctx);
85180
- };
85181
- const node_modules_zod_v4_core_parse_safeDecode_1 = /* @__PURE__*/ node_modules_zod_v4_core_parse_safeDecode_0(v4_core_errors_$ZodRealError);
85182
- const node_modules_zod_v4_core_parse_safeEncodeAsync_0 = (_Err) => async (schema, value, _ctx) => {
85183
- const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
85184
- return node_modules_zod_v4_core_parse_safeParseAsync_0(_Err)(schema, value, ctx);
85185
- };
85186
- const node_modules_zod_v4_core_parse_safeEncodeAsync_1 = /* @__PURE__*/ node_modules_zod_v4_core_parse_safeEncodeAsync_0(v4_core_errors_$ZodRealError);
85187
- const node_modules_zod_v4_core_parse_safeDecodeAsync_0 = (_Err) => async (schema, value, _ctx) => {
85188
- return node_modules_zod_v4_core_parse_safeParseAsync_0(_Err)(schema, value, _ctx);
85189
- };
85190
- const node_modules_zod_v4_core_parse_safeDecodeAsync_1 = /* @__PURE__*/ node_modules_zod_v4_core_parse_safeDecodeAsync_0(v4_core_errors_$ZodRealError);
85191
-
85192
84851
  ;// CONCATENATED MODULE: ../../node_modules/zod/v4/core/versions.js
85193
84852
  const zod_v4_core_versions_version = {
85194
84853
  major: 4,
85195
- minor: 5,
85196
- patch: 4,
84854
+ minor: 6,
84855
+ patch: 5,
85197
84856
  };
85198
84857
 
85199
84858
  ;// CONCATENATED MODULE: ../../node_modules/zod/v4/core/schemas.js
@@ -85327,16 +84986,24 @@ const v4_core_schemas_$ZodType = /*@__PURE__*/ v4_core_core_$constructor("$ZodTy
85327
84986
  },
85328
84987
  });
85329
84988
  /** The Standard Schema surface for `inst`. Shared so wrappers can extend it without forcing it. */
85330
- const v4_core_schemas_toStandardResult = (r) => r.success ? { value: r.data } : { issues: r.error?.issues };
84989
+ // a Standard Schema result only reports issues, so a failure finalizes them straight off the raw payload: no ZodError, and no lazy result to read through
84990
+ const v4_core_schemas_toStandardResult = (r, ctx) => r.issues.length ? { issues: r.issues.map((iss) => v4_core_util_finalizeIssue(iss, ctx, zod_v4_core_core_config())) } : { value: r.value };
84991
+ async function schemas_validateAsync(inst, value) {
84992
+ const ctx = { async: true };
84993
+ return v4_core_schemas_toStandardResult((await inst._zod.run({ value, issues: [] }, ctx)), ctx);
84994
+ }
85331
84995
  function v4_core_schemas_standardProps(inst) {
85332
84996
  return {
85333
84997
  validate: (value) => {
84998
+ const ctx = { async: false };
85334
84999
  try {
85335
- return v4_core_schemas_toStandardResult(node_modules_zod_v4_core_parse_safeParse_1(inst, value));
85336
- }
85337
- catch (_) {
85338
- return node_modules_zod_v4_core_parse_safeParseAsync_1(inst, value).then(v4_core_schemas_toStandardResult);
85000
+ const r = inst._zod.run({ value, issues: [] }, ctx);
85001
+ if (!(r instanceof Promise))
85002
+ return v4_core_schemas_toStandardResult(r, ctx);
85339
85003
  }
85004
+ catch (_) { }
85005
+ // async function so a synchronously throwing check rejects instead of escaping validate
85006
+ return schemas_validateAsync(inst, value);
85340
85007
  },
85341
85008
  vendor: "zod",
85342
85009
  version: 1,
@@ -85345,7 +85012,8 @@ function v4_core_schemas_standardProps(inst) {
85345
85012
 
85346
85013
  const v4_core_schemas_$ZodString = /*@__PURE__*/ v4_core_core_$constructor("$ZodString", (inst, def) => {
85347
85014
  v4_core_schemas_$ZodType.init(inst, def);
85348
- inst._zod.pattern = [...(inst?._zod.bag?.patterns ?? [])].pop() ?? v4_core_regexes_string(inst._zod.bag);
85015
+ // a format's own pattern, else unbounded; a template literal derives the check-aware form itself
85016
+ inst._zod.pattern = def.pattern ?? anyString;
85349
85017
  inst._zod.parse = (payload, _) => {
85350
85018
  if (def.coerce)
85351
85019
  try {
@@ -85399,15 +85067,37 @@ const v4_core_schemas_$ZodEmail = /*@__PURE__*/ v4_core_core_$constructor("$ZodE
85399
85067
  });
85400
85068
  /** The `://` guard rejected the input before the URL constructor saw it. */
85401
85069
  const v4_core_schemas_URL_BAD_FORMAT = 1;
85402
- /** The URL constructor rejected the input. */
85070
+ /** The URL parser rejected the input. */
85403
85071
  const v4_core_schemas_URL_UNPARSEABLE = 2;
85404
- /** Parses a URL for `$ZodURL`, applying the one guard the URL constructor cannot express. Returns the parsed URL, or a code naming the stage that rejected it — the runtime needs that distinction to pick an issue note, and compiled code only needs to know it is not a URL. */
85072
+ function canParseURL(input) {
85073
+ try {
85074
+ if (typeof URL !== "undefined" && typeof URL.canParse === "function")
85075
+ return URL.canParse(input);
85076
+ new URL(input);
85077
+ return true;
85078
+ }
85079
+ catch {
85080
+ return false;
85081
+ }
85082
+ }
85083
+ function validateURL(trimmed, def) {
85084
+ if (!("normalize" in def) && !("hostname" in def) && !("protocol" in def)) {
85085
+ return canParseURL(trimmed) || v4_core_schemas_URL_UNPARSEABLE;
85086
+ }
85087
+ return v4_core_schemas_parseURLObject(trimmed, def);
85088
+ }
85089
+ /** Parses a URL while preserving the non-normalizing HTTP guard. */
85405
85090
  function v4_core_schemas_parseURLObject(trimmed, def) {
85406
85091
  // When normalize is off, require :// for http/https URLs. This prevents strings like "http:example.com" or "https:/path" from being silently accepted
85407
85092
  if (!def.normalize && def.protocol?.source === core_regexes_httpProtocol.source && !/^https?:\/\//i.test(trimmed)) {
85408
85093
  return v4_core_schemas_URL_BAD_FORMAT;
85409
85094
  }
85410
85095
  try {
85096
+ if (typeof URL !== "undefined") {
85097
+ const URLStatic = URL;
85098
+ if (typeof URLStatic.parse === "function")
85099
+ return URLStatic.parse(trimmed) ?? v4_core_schemas_URL_UNPARSEABLE;
85100
+ }
85411
85101
  // @ts-ignore
85412
85102
  return new URL(trimmed);
85413
85103
  }
@@ -85434,7 +85124,7 @@ const v4_core_schemas_$ZodURL = /*@__PURE__*/ v4_core_core_$constructor("$ZodURL
85434
85124
  try {
85435
85125
  // Trim whitespace from input
85436
85126
  const trimmed = payload.value.trim();
85437
- const url = v4_core_schemas_parseURLObject(trimmed, def);
85127
+ const url = validateURL(trimmed, def);
85438
85128
  if (url === v4_core_schemas_URL_BAD_FORMAT) {
85439
85129
  payload.issues.push({
85440
85130
  code: "invalid_format",
@@ -85456,6 +85146,10 @@ const v4_core_schemas_$ZodURL = /*@__PURE__*/ v4_core_core_$constructor("$ZodURL
85456
85146
  });
85457
85147
  return;
85458
85148
  }
85149
+ if (url === true) {
85150
+ payload.value = v4_core_schemas_stripTabAndNewline(trimmed);
85151
+ return;
85152
+ }
85459
85153
  if (def.hostname && !v4_core_schemas_urlHostnameOk(url, def.hostname)) {
85460
85154
  payload.issues.push({
85461
85155
  code: "invalid_format",
@@ -85531,13 +85225,6 @@ const v4_core_schemas_$ZodKSUID = /*@__PURE__*/ v4_core_core_$constructor("$ZodK
85531
85225
  const v4_core_schemas_$ZodISODateTime = /*@__PURE__*/ v4_core_core_$constructor("$ZodISODateTime", (inst, def) => {
85532
85226
  def.pattern ?? (def.pattern = core_regexes_datetime(def));
85533
85227
  v4_core_schemas_$ZodStringFormat.init(inst, def);
85534
- // these two drop the offset or seconds `date-time` requires — on the bag not the def, since `z.string().check(...)` lands the format on a different schema
85535
- if (def.local || def.precision === -1) {
85536
- inst._zod.bag.laxFormat = true;
85537
- inst._zod.onattach.push((s) => {
85538
- s._zod.bag.laxFormat = true;
85539
- });
85540
- }
85541
85228
  });
85542
85229
  const v4_core_schemas_$ZodISODate = /*@__PURE__*/ v4_core_core_$constructor("$ZodISODate", (inst, def) => {
85543
85230
  def.pattern ?? (def.pattern = v4_core_regexes_date);
@@ -85554,26 +85241,17 @@ const v4_core_schemas_$ZodISODuration = /*@__PURE__*/ v4_core_core_$constructor(
85554
85241
  const v4_core_schemas_$ZodIPv4 = /*@__PURE__*/ v4_core_core_$constructor("$ZodIPv4", (inst, def) => {
85555
85242
  def.pattern ?? (def.pattern = core_regexes_ipv4);
85556
85243
  v4_core_schemas_$ZodStringFormat.init(inst, def);
85557
- inst._zod.bag.format = `ipv4`;
85558
85244
  });
85559
85245
  /** An IPv6 address is written with hex digits, colons and dots, and nothing else. The guard is what makes the check below an IPv6 check: `new URL("http://[...]")` parses an authority, not an address, so `@` and `\` re-delimit it and `"::@1\\"` validates against the host `0.0.0.1`. The URL parser also deletes ASCII tab, LF and CR rather than failing, which is how `"::1\n"` validated as `::1`. */
85560
85246
  const v4_core_schemas_ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
85561
85247
  function v4_core_schemas_isValidIPv6(value) {
85562
85248
  if (!v4_core_schemas_ipv6Alphabet.test(value))
85563
85249
  return false;
85564
- try {
85565
- // @ts-ignore
85566
- new URL(`http://[${value}]`);
85567
- return true;
85568
- }
85569
- catch {
85570
- return false;
85571
- }
85250
+ return canParseURL(`http://[${value}]`);
85572
85251
  }
85573
85252
  const v4_core_schemas_$ZodIPv6 = /*@__PURE__*/ v4_core_core_$constructor("$ZodIPv6", (inst, def) => {
85574
85253
  def.pattern ?? (def.pattern = core_regexes_ipv6);
85575
85254
  v4_core_schemas_$ZodStringFormat.init(inst, def);
85576
- inst._zod.bag.format = `ipv6`;
85577
85255
  inst._zod.check = (payload) => {
85578
85256
  if (!v4_core_schemas_isValidIPv6(payload.value)) {
85579
85257
  payload.issues.push({
@@ -85589,7 +85267,6 @@ const v4_core_schemas_$ZodIPv6 = /*@__PURE__*/ v4_core_core_$constructor("$ZodIP
85589
85267
  const v4_core_schemas_$ZodMAC = /*@__PURE__*/ (/* unused pure expression or super */ null && (core.$constructor("$ZodMAC", (inst, def) => {
85590
85268
  def.pattern ?? (def.pattern = regexes.mac(def.delimiter));
85591
85269
  v4_core_schemas_$ZodStringFormat.init(inst, def);
85592
- inst._zod.bag.format = `mac`;
85593
85270
  })));
85594
85271
  const v4_core_schemas_$ZodCIDRv4 = /*@__PURE__*/ v4_core_core_$constructor("$ZodCIDRv4", (inst, def) => {
85595
85272
  def.pattern ?? (def.pattern = core_regexes_cidrv4);
@@ -85642,10 +85319,11 @@ function v4_core_schemas_isValidBase64(data) {
85642
85319
  return false;
85643
85320
  }
85644
85321
  }
85322
+ // lax on purpose: the quantified regexes.base64 overflows the regex stack on multi-MB input and its leading ^$| alternation leaks through template-literal composition; isValidBase64 enforces length and padding
85323
+ const base64Charset = /^[0-9a-zA-Z+/]*={0,2}$/;
85645
85324
  const v4_core_schemas_$ZodBase64 = /*@__PURE__*/ v4_core_core_$constructor("$ZodBase64", (inst, def) => {
85646
- def.pattern ?? (def.pattern = v4_core_regexes_base64);
85325
+ def.pattern ?? (def.pattern = base64Charset);
85647
85326
  v4_core_schemas_$ZodStringFormat.init(inst, def);
85648
- inst._zod.bag.contentEncoding = "base64";
85649
85327
  inst._zod.check = (payload) => {
85650
85328
  if (v4_core_schemas_isValidBase64(payload.value))
85651
85329
  return;
@@ -85658,18 +85336,19 @@ const v4_core_schemas_$ZodBase64 = /*@__PURE__*/ v4_core_core_$constructor("$Zod
85658
85336
  });
85659
85337
  };
85660
85338
  });
85661
- ////////////////////////////// ZodBase64 //////////////////////////////
85339
+ ////////////////////////////// ZodBase64URL //////////////////////////////
85340
+ // lax on purpose: the quantified regexes.base64url overflows the regex stack on multi-MB input; isValidBase64 enforces length on the padded string
85341
+ const base64urlCharset = /^[A-Za-z0-9_-]*$/;
85662
85342
  function v4_core_schemas_isValidBase64URL(data) {
85663
- if (!v4_core_regexes_base64url.test(data))
85343
+ if (!base64urlCharset.test(data))
85664
85344
  return false;
85665
85345
  const base64 = data.replace(/[-_]/g, (c) => (c === "-" ? "+" : "/"));
85666
85346
  const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, "=");
85667
85347
  return v4_core_schemas_isValidBase64(padded);
85668
85348
  }
85669
85349
  const v4_core_schemas_$ZodBase64URL = /*@__PURE__*/ v4_core_core_$constructor("$ZodBase64URL", (inst, def) => {
85670
- def.pattern ?? (def.pattern = v4_core_regexes_base64url);
85350
+ def.pattern ?? (def.pattern = base64urlCharset);
85671
85351
  v4_core_schemas_$ZodStringFormat.init(inst, def);
85672
- inst._zod.bag.contentEncoding = "base64url";
85673
85352
  inst._zod.check = (payload) => {
85674
85353
  if (v4_core_schemas_isValidBase64URL(payload.value))
85675
85354
  return;
@@ -85694,7 +85373,7 @@ function v4_core_schemas_isLuhnAlgo(digits) {
85694
85373
  let bit = 1;
85695
85374
  let sum = 0;
85696
85375
  while (length) {
85697
- const value = +digits[--length];
85376
+ const value = digits.charCodeAt(--length) - 48;
85698
85377
  bit ^= 1;
85699
85378
  sum += bit ? [0, 2, 4, 6, 8, 1, 3, 5, 7, 9][value] : value;
85700
85379
  }
@@ -85721,6 +85400,42 @@ const v4_core_schemas_$ZodCreditCard = /*@__PURE__*/ (/* unused pure expression
85721
85400
  });
85722
85401
  };
85723
85402
  })));
85403
+ ////////////////////////////// ZodIBAN //////////////////////////////
85404
+ // iso 7064 mod 97-10 checksum without BigInt
85405
+ function isIso7064Mod97(iban) {
85406
+ let remainder = 0;
85407
+ const len = iban.length;
85408
+ for (let i = 4; i < len; i++) {
85409
+ const code = iban.charCodeAt(i);
85410
+ remainder = (code >= 65 ? remainder * 100 + (code - 55) : remainder * 10 + (code - 48)) % 97;
85411
+ }
85412
+ for (let i = 0; i < 4; i++) {
85413
+ const code = iban.charCodeAt(i);
85414
+ remainder = (code >= 65 ? remainder * 100 + (code - 55) : remainder * 10 + (code - 48)) % 97;
85415
+ }
85416
+ return remainder === 1;
85417
+ }
85418
+ function isValidIBAN(input) {
85419
+ if (!regexes.iban.test(input))
85420
+ return false;
85421
+ return isIso7064Mod97(input);
85422
+ }
85423
+ const $ZodIBAN = /*@__PURE__*/ (/* unused pure expression or super */ null && (core.$constructor("$ZodIBAN", (inst, def) => {
85424
+ // shape only — checksum is not expressible as a pattern
85425
+ def.pattern ?? (def.pattern = regexes.iban);
85426
+ v4_core_schemas_$ZodStringFormat.init(inst, def);
85427
+ inst._zod.check = (payload) => {
85428
+ if (isValidIBAN(payload.value))
85429
+ return;
85430
+ payload.issues.push({
85431
+ code: "invalid_format",
85432
+ format: "iban",
85433
+ input: payload.value,
85434
+ inst,
85435
+ continue: !def.abort,
85436
+ });
85437
+ };
85438
+ })));
85724
85439
  ////////////////////////////// ZodJWT //////////////////////////////
85725
85440
  function v4_core_schemas_isValidJWT(token, algorithm = null) {
85726
85441
  try {
@@ -85774,7 +85489,7 @@ const v4_core_schemas_$ZodCustomStringFormat = /*@__PURE__*/ (/* unused pure exp
85774
85489
  })));
85775
85490
  const v4_core_schemas_$ZodNumber = /*@__PURE__*/ (/* unused pure expression or super */ null && (core.$constructor("$ZodNumber", (inst, def) => {
85776
85491
  v4_core_schemas_$ZodType.init(inst, def);
85777
- inst._zod.pattern = inst._zod.bag.pattern ?? regexes.number;
85492
+ inst._zod.pattern = regexes.number;
85778
85493
  inst._zod.parse = (payload, _ctx) => {
85779
85494
  if (def.coerce)
85780
85495
  try {
@@ -85982,6 +85697,7 @@ const v4_core_schemas_$ZodArray = /*@__PURE__*/ v4_core_core_$constructor("$ZodA
85982
85697
  }
85983
85698
  payload.value = memo ? memo.alloc(inst, payload, Array(input.length), ctx) : Array(input.length);
85984
85699
  const proms = [];
85700
+ const abortEarly = ctx?.abortEarly;
85985
85701
  for (let i = 0; i < input.length; i++) {
85986
85702
  const item = input[i];
85987
85703
  const result = def.element._zod.run({
@@ -85993,6 +85709,9 @@ const v4_core_schemas_$ZodArray = /*@__PURE__*/ v4_core_core_$constructor("$ZodA
85993
85709
  }
85994
85710
  else {
85995
85711
  v4_core_schemas_handleArrayResult(result, payload, i);
85712
+ // the element's payload is authoritative here, since handleArrayResult forwards every issue; an object's is not, because it drops a failed absent optional
85713
+ if (abortEarly && result.issues.length !== 0 && v4_core_util_aborted(result))
85714
+ break;
85996
85715
  }
85997
85716
  }
85998
85717
  if (proms.length) {
@@ -86027,7 +85746,7 @@ function v4_core_schemas_handlePropertyResult(result, final, key, input, optin,
86027
85746
  return;
86028
85747
  }
86029
85748
  if (result.value === undefined) {
86030
- if (isPresent) {
85749
+ if (isPresent || (optin === "defaulted" && !isOptionalOut)) {
86031
85750
  final.value[key] = undefined;
86032
85751
  }
86033
85752
  }
@@ -86059,14 +85778,21 @@ function v4_core_schemas_normalizeDef(def) {
86059
85778
  optionalKeys: new Set(okeys),
86060
85779
  };
86061
85780
  }
86062
- function v4_core_schemas_handleCatchall(proms, input, payload, ctx, def, inst) {
85781
+ function v4_core_schemas_handleCatchall(proms, input, payload, ctx, def, inst, abortEarly) {
86063
85782
  const unrecognized = [];
86064
85783
  const keySet = def.keySet;
86065
85784
  const _catchall = def.catchall._zod;
86066
85785
  const t = _catchall.def.type;
86067
85786
  const optin = _catchall.optin;
86068
85787
  const optout = _catchall.optout;
85788
+ // starts at 0, not the current length: the shape phase already ran and may have aborted
85789
+ let seen = 0;
86069
85790
  for (const key in input) {
85791
+ if (abortEarly && payload.issues.length !== seen) {
85792
+ if (v4_core_util_aborted(payload, seen))
85793
+ break;
85794
+ seen = payload.issues.length;
85795
+ }
86070
85796
  // Must precede the __proto__ branch: a declared key is not unrecognized, even though the shape loop deliberately strips __proto__ from the parsed output.
86071
85797
  if (keySet.has(key))
86072
85798
  continue;
@@ -86104,26 +85830,22 @@ function v4_core_schemas_handleCatchall(proms, input, payload, ctx, def, inst) {
86104
85830
  return payload;
86105
85831
  });
86106
85832
  }
86107
- // Whichever object a def's `shape` currently answers from: the one the caller passed until the first read, the frozen copy after it. Keyed by def, so a def rebuilt by a builder is simply absent rather than inheriting the source's. Read its keys with `Object.keys`, which does not invoke them — that is what lets a discriminated union check its discriminator without resolving an option whose getters reference the union being constructed.
86108
- const v4_core_schemas_propShapes = new WeakMap();
86109
85833
  const v4_core_schemas_$ZodObject = /*@__PURE__*/ v4_core_core_$constructor("$ZodObject", (inst, def) => {
86110
85834
  // requires cast because technically $ZodObject doesn't extend
86111
85835
  v4_core_schemas_$ZodType.init(inst, def);
86112
- // const sh = def.shape;
86113
85836
  const desc = Object.getOwnPropertyDescriptor(def, "shape");
86114
- if (!desc?.get) {
86115
- const sh = def.shape;
86116
- v4_core_schemas_propShapes.set(def, sh);
86117
- Object.defineProperty(def, "shape", {
86118
- get: () => {
86119
- const newSh = { ...sh };
86120
- Object.defineProperty(def, "shape", {
86121
- value: newSh,
86122
- });
86123
- v4_core_schemas_propShapes.set(def, newSh);
86124
- return newSh;
86125
- },
86126
- });
85837
+ // a cloned def carries its source's accessor, which knows the shape it answers from; adopting that keeps the clone's keys readable without running it
85838
+ const sh = desc?.get ? desc.get.raw : (def.shape ?? {});
85839
+ if (sh) {
85840
+ // Freezes the shape on first read, so its getters resolve once and every later read sees the same schemas.
85841
+ const get = () => {
85842
+ const newSh = { ...sh };
85843
+ Object.defineProperty(def, "shape", { value: newSh });
85844
+ get.raw = newSh;
85845
+ return newSh;
85846
+ };
85847
+ get.raw = sh;
85848
+ Object.defineProperty(def, "shape", { get });
86127
85849
  }
86128
85850
  const _normalized = zod_v4_core_util_cached(() => v4_core_schemas_normalizeDef(def));
86129
85851
  v4_core_util_defineLazyInternal(inst, "propValues", (zod) => {
@@ -86164,7 +85886,14 @@ const v4_core_schemas_$ZodObject = /*@__PURE__*/ v4_core_core_$constructor("$Zod
86164
85886
  payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
86165
85887
  const proms = [];
86166
85888
  const shape = value.shape;
85889
+ const abortEarly = ctx?.abortEarly;
85890
+ let seen = payload.issues.length;
86167
85891
  for (const key of value.allKeys) {
85892
+ if (abortEarly && payload.issues.length !== seen) {
85893
+ if (v4_core_util_aborted(payload, seen))
85894
+ break;
85895
+ seen = payload.issues.length;
85896
+ }
86168
85897
  if (key === "__proto__")
86169
85898
  continue;
86170
85899
  const el = shape[key];
@@ -86181,7 +85910,7 @@ const v4_core_schemas_$ZodObject = /*@__PURE__*/ v4_core_core_$constructor("$Zod
86181
85910
  if (!catchall) {
86182
85911
  return proms.length ? Promise.all(proms).then(() => payload) : payload;
86183
85912
  }
86184
- return v4_core_schemas_handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
85913
+ return v4_core_schemas_handleCatchall(proms, input, payload, ctx, _normalized.value, inst, abortEarly === true);
86185
85914
  };
86186
85915
  });
86187
85916
  const v4_core_schemas_$ZodObjectJIT = /*@__PURE__*/ v4_core_core_$constructor("$ZodObjectJIT", (inst, def) => {
@@ -86196,12 +85925,18 @@ const v4_core_schemas_$ZodObjectJIT = /*@__PURE__*/ v4_core_core_$constructor("$
86196
85925
  // a symbol has no source literal, so it is read as `syms[i]` off the closed-over scope
86197
85926
  const doc = new v4_core_doc_Doc(["payload", "ctx"], { shape, inst, memo, syms });
86198
85927
  const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
86199
- // Prefixes in place, like util.prefixIssues does for every interpreted path.
85928
+ // prefixes in place, like util.prefixIssues. newResult must land before the early return: a catchall runs after this and would otherwise write onto the caller's input
86200
85929
  const prefixStr = (id, k) => `
85930
+ let ${id}_ab = false;
86201
85931
  for (let i = 0; i < ${id}.issues.length; i++) {
86202
85932
  const iss = ${id}.issues[i];
86203
85933
  iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
86204
85934
  payload.issues.push(iss);
85935
+ if (iss.continue !== true) ${id}_ab = true;
85936
+ }
85937
+ if (${id}_ab && ctx && ctx.abortEarly) {
85938
+ payload.value = newResult;
85939
+ return payload;
86205
85940
  }`;
86206
85941
  doc.write(`const input = payload.value;`);
86207
85942
  const ids = Object.create(null);
@@ -86250,6 +85985,10 @@ const v4_core_schemas_$ZodObjectJIT = /*@__PURE__*/ v4_core_core_$constructor("$
86250
85985
  input: undefined,
86251
85986
  path: [${k}]
86252
85987
  });
85988
+ if (ctx && ctx.abortEarly) {
85989
+ payload.value = newResult;
85990
+ return payload;
85991
+ }
86253
85992
  }
86254
85993
 
86255
85994
  if (${id}_present) {
@@ -86262,16 +86001,17 @@ const v4_core_schemas_$ZodObjectJIT = /*@__PURE__*/ v4_core_core_$constructor("$
86262
86001
  doc.write(`
86263
86002
  if (${id}.issues.length) {${prefixStr(id, k)}
86264
86003
  }
86265
-
86266
- if (${id}.value === undefined) {
86267
- if (${isPresent}) {
86268
- newResult[${k}] = undefined;
86269
- }
86270
- } else {
86004
+ `);
86005
+ if (optin === "defaulted") {
86006
+ doc.write(`newResult[${k}] = ${id}.value;`);
86007
+ }
86008
+ else {
86009
+ doc.write(`
86010
+ if (${id}.value !== undefined || ${isPresent}) {
86271
86011
  newResult[${k}] = ${id}.value;
86272
86012
  }
86273
-
86274
86013
  `);
86014
+ }
86275
86015
  }
86276
86016
  }
86277
86017
  doc.write(`payload.value = newResult;`);
@@ -86305,7 +86045,7 @@ const v4_core_schemas_$ZodObjectJIT = /*@__PURE__*/ v4_core_core_$constructor("$
86305
86045
  payload = fastpass(payload, ctx);
86306
86046
  if (!catchall)
86307
86047
  return payload;
86308
- return v4_core_schemas_handleCatchall([], input, payload, ctx, value, inst);
86048
+ return v4_core_schemas_handleCatchall([], input, payload, ctx, value, inst, ctx?.abortEarly === true);
86309
86049
  }
86310
86050
  return superParse(payload, ctx);
86311
86051
  };
@@ -86442,22 +86182,38 @@ const v4_core_schemas_$ZodXor = /*@__PURE__*/ (/* unused pure expression or supe
86442
86182
  });
86443
86183
  };
86444
86184
  })));
86445
- /** Returns the option of `union` whose discriminator claims `value`. */
86185
+ /** Returns the option whose discriminator claims `value`, or throws if ambiguous. */
86446
86186
  function v4_core_schemas_getDiscriminatedOption(union, value) {
86447
86187
  const internals = union._zod;
86448
86188
  let map = internals.bag.optionsMap;
86449
86189
  if (!map) {
86450
- map = new Map();
86451
- const { options, discriminator } = internals.def;
86452
- for (const option of options) {
86453
- // First declaration wins, matching the order the parse path resolves a duplicate in.
86454
- for (const v of option._zod.propValues?.[discriminator] ?? [])
86455
- if (!map.has(v))
86456
- map.set(v, option);
86457
- }
86190
+ map = discriminatorMap(internals.def);
86458
86191
  internals.bag.optionsMap = map;
86459
86192
  }
86460
- return map.get(value);
86193
+ const option = map.get(value);
86194
+ if (option === null)
86195
+ throw new Error(`Ambiguous discriminator value "${String(value)}"`);
86196
+ return option;
86197
+ }
86198
+ function discriminatorMap(def) {
86199
+ const map = new Map();
86200
+ for (const option of def.options) {
86201
+ const values = option._zod.propValues?.[def.discriminator];
86202
+ if (!values || values.size === 0)
86203
+ throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
86204
+ for (const value of values) {
86205
+ if (map.has(value)) {
86206
+ if (value !== undefined)
86207
+ throw new Error(`Duplicate discriminator value "${String(value)}"`);
86208
+ // keep the collision marked so a later member cannot reclaim it
86209
+ map.set(value, null);
86210
+ }
86211
+ else {
86212
+ map.set(value, option);
86213
+ }
86214
+ }
86215
+ }
86216
+ return map;
86461
86217
  }
86462
86218
  const v4_core_schemas_$ZodDiscriminatedUnion =
86463
86219
  /*@__PURE__*/
@@ -86467,10 +86223,13 @@ const v4_core_schemas_$ZodDiscriminatedUnion =
86467
86223
  const _super = inst._zod.parse;
86468
86224
  util.defineLazyInternal(inst, "propValues", (zod) => {
86469
86225
  const propValues = {};
86226
+ let undefinedCount = 0;
86470
86227
  for (const option of zod.def.options) {
86471
86228
  const pv = option._zod.propValues;
86472
86229
  if (!pv || Object.keys(pv).length === 0)
86473
86230
  throw new Error(`Invalid discriminated union option at index "${zod.def.options.indexOf(option)}"`);
86231
+ if (pv[zod.def.discriminator]?.has(undefined))
86232
+ undefinedCount++;
86474
86233
  for (const [k, v] of Object.entries(pv)) {
86475
86234
  if (!Object.prototype.hasOwnProperty.call(propValues, k)) {
86476
86235
  util.assignProp(propValues, k, new Set());
@@ -86480,31 +86239,18 @@ const v4_core_schemas_$ZodDiscriminatedUnion =
86480
86239
  }
86481
86240
  }
86482
86241
  }
86242
+ if (!zod.def.unionFallback && undefinedCount > 1)
86243
+ propValues[zod.def.discriminator]?.delete(undefined);
86483
86244
  return propValues;
86484
86245
  });
86485
- // Checked now rather than in the lookup map below, so an option that lacks the discriminator fails at the `discriminatedUnion` call instead of on the first object parsed. Options whose shape cannot be enumerated without resolving it — pipes, lazies, and objects rebuilt by a builder such as `.extend()` — are left to the map.
86246
+ // Checked now rather than in the lookup map below, so an option that lacks the discriminator fails at the `discriminatedUnion` call instead of on the first object parsed. Options whose shape cannot be enumerated without resolving it — pipes and lazies — are left to the map.
86486
86247
  def.options.forEach((option, i) => {
86487
- const propShape = v4_core_schemas_propShapes.get(option._zod.def);
86248
+ const propShape = util.rawShape(option._zod.def);
86488
86249
  if (propShape && !Object.prototype.hasOwnProperty.call(propShape, def.discriminator)) {
86489
86250
  throw new Error(`Invalid discriminated union option at index "${i}"`);
86490
86251
  }
86491
86252
  });
86492
- const disc = util.cached(() => {
86493
- const opts = def.options;
86494
- const map = new Map();
86495
- for (const o of opts) {
86496
- const values = o._zod.propValues?.[def.discriminator];
86497
- if (!values || values.size === 0)
86498
- throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
86499
- for (const v of values) {
86500
- if (map.has(v)) {
86501
- throw new Error(`Duplicate discriminator value "${String(v)}"`);
86502
- }
86503
- map.set(v, o);
86504
- }
86505
- }
86506
- return map;
86507
- });
86253
+ const disc = util.cached(() => discriminatorMap(def));
86508
86254
  inst._zod.parse = (payload, ctx) => {
86509
86255
  const input = payload.value;
86510
86256
  if (!util.isObject(input)) {
@@ -86516,8 +86262,10 @@ const v4_core_schemas_$ZodDiscriminatedUnion =
86516
86262
  });
86517
86263
  return payload;
86518
86264
  }
86519
- const opt = disc.value.get(input?.[def.discriminator]);
86520
- if (opt) {
86265
+ const value = input?.[def.discriminator];
86266
+ const opt = disc.value.get(value);
86267
+ // forward metadata cannot choose an encoder for an absent tag
86268
+ if (opt && (value !== undefined || ctx.direction !== "backward")) {
86521
86269
  return opt._zod.run(payload, ctx);
86522
86270
  }
86523
86271
  // Fall back to union matching when the fast discriminator path fails:
@@ -86532,7 +86280,7 @@ const v4_core_schemas_$ZodDiscriminatedUnion =
86532
86280
  errors: [],
86533
86281
  note: "No matching discriminator",
86534
86282
  discriminator: def.discriminator,
86535
- options: Array.from(disc.value.keys()),
86283
+ options: Array.from(disc.value.keys()).filter((value) => disc.value.get(value) !== null),
86536
86284
  input,
86537
86285
  path: [def.discriminator],
86538
86286
  inst,
@@ -86705,6 +86453,9 @@ const v4_core_schemas_$ZodTuple = /*@__PURE__*/ (/* unused pure expression or su
86705
86453
  }
86706
86454
  // Run every item in parallel, collecting results into an indexed array. The post-processing in `handleTupleResults` walks them in order so it can decide whether an absent optional-output error can truncate the tail or must be reported to preserve required output.
86707
86455
  const itemResults = new Array(items.length);
86456
+ // only tracked when there is a rest loop to skip
86457
+ const abortEarly = def.rest ? ctx?.abortEarly : undefined;
86458
+ let itemAborted = false;
86708
86459
  for (let i = 0; i < items.length; i++) {
86709
86460
  const r = items[i]._zod.run({ value: input[i], issues: [] }, ctx);
86710
86461
  if (r instanceof Promise) {
@@ -86714,12 +86465,21 @@ const v4_core_schemas_$ZodTuple = /*@__PURE__*/ (/* unused pure expression or su
86714
86465
  }
86715
86466
  else {
86716
86467
  itemResults[i] = r;
86468
+ if (abortEarly && !itemAborted && r.issues.length)
86469
+ itemAborted = util.aborted(r);
86717
86470
  }
86718
86471
  }
86719
- if (def.rest) {
86472
+ // sound because rest is non-empty exactly when every fixed index is present, the one case handleTupleResults cannot discard an item's issues
86473
+ if (def.rest && !itemAborted) {
86720
86474
  let i = items.length - 1;
86721
86475
  const rest = input.slice(items.length);
86476
+ let seen = payload.issues.length;
86722
86477
  for (const el of rest) {
86478
+ if (abortEarly && payload.issues.length !== seen) {
86479
+ if (util.aborted(payload, seen))
86480
+ break;
86481
+ seen = payload.issues.length;
86482
+ }
86723
86483
  i++;
86724
86484
  const result = def.rest._zod.run({ value: el, issues: [] }, ctx);
86725
86485
  if (result instanceof Promise) {
@@ -86801,6 +86561,7 @@ const v4_core_schemas_$ZodRecord = /*@__PURE__*/ (/* unused pure expression or s
86801
86561
  });
86802
86562
  return payload;
86803
86563
  }
86564
+ // no guard in either loop below: a record's invalid_key aborts but an enclosing intersection can reconcile it, so a stopped loop hides keys the sibling does not own and the intersection then rejects nothing
86804
86565
  const proms = [];
86805
86566
  const values = def.keyType._zod.values;
86806
86567
  if (values && !def.partial) {
@@ -86972,7 +86733,14 @@ const v4_core_schemas_$ZodMap = /*@__PURE__*/ (/* unused pure expression or supe
86972
86733
  }
86973
86734
  const proms = [];
86974
86735
  payload.value = memo ? memo.alloc(inst, payload, new Map(), ctx) : new Map();
86736
+ const abortEarly = ctx?.abortEarly;
86737
+ let seen = payload.issues.length;
86975
86738
  for (const [key, value] of input) {
86739
+ if (abortEarly && payload.issues.length !== seen) {
86740
+ if (util.aborted(payload, seen))
86741
+ break;
86742
+ seen = payload.issues.length;
86743
+ }
86976
86744
  const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
86977
86745
  const valueResult = def.valueType._zod.run({ value: value, issues: [] }, ctx);
86978
86746
  if (keyResult instanceof Promise || valueResult instanceof Promise) {
@@ -87038,7 +86806,14 @@ const v4_core_schemas_$ZodSet = /*@__PURE__*/ (/* unused pure expression or supe
87038
86806
  }
87039
86807
  const proms = [];
87040
86808
  payload.value = memo ? memo.alloc(inst, payload, new Set(), ctx) : new Set();
86809
+ const abortEarly = ctx?.abortEarly;
86810
+ let seen = payload.issues.length;
87041
86811
  for (const item of input) {
86812
+ if (abortEarly && payload.issues.length !== seen) {
86813
+ if (util.aborted(payload, seen))
86814
+ break;
86815
+ seen = payload.issues.length;
86816
+ }
87042
86817
  const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
87043
86818
  if (result instanceof Promise) {
87044
86819
  proms.push(result.then((result) => v4_core_schemas_handleSetResult(result, payload)));
@@ -87062,9 +86837,11 @@ const v4_core_schemas_$ZodEnum = /*@__PURE__*/ v4_core_core_$constructor("$ZodEn
87062
86837
  const values = v4_core_util_getEnumValues(def.entries);
87063
86838
  const valuesSet = new Set(values);
87064
86839
  inst._zod.values = valuesSet;
87065
- const patternValues = values.filter((k) => v4_core_util_propertyKeyTypes.has(typeof k));
87066
- // unmatchable fallback, RE2-safe: an empty alternation would compile to /^()$/, which matches ""
87067
- inst._zod.pattern = new RegExp(patternValues.length ? `^(${patternValues.map((o) => v4_core_util_escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
86840
+ v4_core_util_defineLazyInternal(inst, "pattern", (zod) => {
86841
+ const patternValues = v4_core_util_getEnumValues(zod.def.entries).filter((k) => v4_core_util_propertyKeyTypes.has(typeof k));
86842
+ // unmatchable fallback, RE2-safe: an empty alternation would compile to /^()$/, which matches ""
86843
+ return new RegExp(patternValues.length ? `^(${patternValues.map((o) => v4_core_util_escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
86844
+ });
87068
86845
  inst._zod.parse = (payload, _ctx) => {
87069
86846
  const input = payload.value;
87070
86847
  if (valuesSet.has(input)) {
@@ -87083,12 +86860,15 @@ const v4_core_schemas_$ZodLiteral = /*@__PURE__*/ (/* unused pure expression or
87083
86860
  v4_core_schemas_$ZodType.init(inst, def);
87084
86861
  const values = new Set(def.values);
87085
86862
  inst._zod.values = values;
87086
- // unmatchable fallback, RE2-safe: an empty alternation would compile to /^()$/, which matches ""
87087
- inst._zod.pattern = new RegExp(def.values.length
87088
- ? `^(${def.values
87089
- .map((o) => (typeof o === "string" ? util.escapeRegex(o) : o ? util.escapeRegex(o.toString()) : String(o)))
87090
- .join("|")})$`
87091
- : "^[^\\s\\S]$");
86863
+ util.defineLazyInternal(inst, "pattern", (zod) => {
86864
+ const vals = zod.def.values;
86865
+ // unmatchable fallback, RE2-safe: an empty alternation would compile to /^()$/, which matches ""
86866
+ return new RegExp(vals.length
86867
+ ? `^(${vals
86868
+ .map((o) => typeof o === "string" ? util.escapeRegex(o) : o ? util.escapeRegex(o.toString()) : String(o))
86869
+ .join("|")})$`
86870
+ : "^[^\\s\\S]$");
86871
+ });
87092
86872
  inst._zod.parse = (payload, _ctx) => {
87093
86873
  const input = payload.value;
87094
86874
  if (values.has(input)) {
@@ -87452,22 +87232,67 @@ function v4_core_schemas_handleReadonlyResult(payload) {
87452
87232
  payload.value = Object.freeze(payload.value);
87453
87233
  return payload;
87454
87234
  }
87235
+ // a leaf's pattern source with its own checks folded in: the last pattern-carrying check wins, else length bounds narrow the catch-all, else an integer format narrows the number form. the fold lives here instead of on `_zod.pattern` so a bundle without template literals never pays for it
87236
+ function leafPattern(schema) {
87237
+ const def = schema._zod.def;
87238
+ let pattern = def.pattern;
87239
+ let isInt = !!def.format?.includes("int");
87240
+ let minimum;
87241
+ let maximum;
87242
+ for (const ch of def.checks ?? []) {
87243
+ const d = ch._zod.def;
87244
+ if (d.pattern)
87245
+ pattern = d.pattern;
87246
+ isInt || (isInt = !!d.format?.includes("int"));
87247
+ const lo = d.minimum ?? d.length;
87248
+ const hi = d.maximum ?? d.length;
87249
+ if (lo !== undefined && (minimum === undefined || lo > minimum))
87250
+ minimum = lo;
87251
+ if (hi !== undefined && (maximum === undefined || hi < maximum))
87252
+ maximum = hi;
87253
+ }
87254
+ if (pattern)
87255
+ return pattern.source;
87256
+ // an empty range matches nothing at runtime, and `{8,5}` is not a legal quantifier
87257
+ if (minimum !== undefined && maximum !== undefined && minimum > maximum)
87258
+ return "(?!)";
87259
+ if (minimum !== undefined || maximum !== undefined)
87260
+ return regexes.string({ minimum, maximum }).source;
87261
+ const own = schema._zod.pattern;
87262
+ return (isInt && own === regexes.number ? regexes.integer : own)?.source;
87263
+ }
87264
+ // a part's pattern source. a wrapper's pattern embeds its inner pattern's source verbatim, so the folded form is substituted in place without knowing the wrapper's own composition; a union's options are joined the way the union builds its own pattern
87265
+ function partPattern(schema) {
87266
+ const def = schema._zod.def;
87267
+ const own = schema._zod.pattern?.source;
87268
+ // lazy resolves its inner on the internals, not the def
87269
+ const inner = def.innerType ?? schema._zod.innerType;
87270
+ if (inner) {
87271
+ const before = inner._zod.pattern?.source;
87272
+ const after = partPattern(inner);
87273
+ if (own && before && after && after !== before) {
87274
+ return own.replace(util.cleanRegex(before), () => util.cleanRegex(after));
87275
+ }
87276
+ return own;
87277
+ }
87278
+ if (def.options) {
87279
+ const sources = def.options.map(partPattern);
87280
+ if (sources.every(Boolean))
87281
+ return `^(${sources.map((s) => util.cleanRegex(s)).join("|")})$`;
87282
+ }
87283
+ return leafPattern(schema);
87284
+ }
87455
87285
  const v4_core_schemas_$ZodTemplateLiteral = /*@__PURE__*/ (/* unused pure expression or super */ null && (core.$constructor("$ZodTemplateLiteral", (inst, def) => {
87456
87286
  v4_core_schemas_$ZodType.init(inst, def);
87457
87287
  const regexParts = [];
87458
87288
  for (const part of def.parts) {
87459
87289
  if (typeof part === "object" && part !== null) {
87460
87290
  // is Zod schema
87461
- if (!part._zod.pattern) {
87462
- // if (!source)
87291
+ const source = partPattern(part);
87292
+ if (!source) {
87463
87293
  throw new Error(`Invalid template literal part, no pattern found: ${[...part._zod.traits].shift()}`);
87464
87294
  }
87465
- const source = part._zod.pattern instanceof RegExp ? part._zod.pattern.source : part._zod.pattern;
87466
- if (!source)
87467
- throw new Error(`Invalid template literal part: ${part._zod.traits}`);
87468
- const start = source.startsWith("^") ? 1 : 0;
87469
- const end = source.endsWith("$") ? source.length - 1 : source.length;
87470
- regexParts.push(source.slice(start, end));
87295
+ regexParts.push(util.cleanRegex(source));
87471
87296
  }
87472
87297
  else if (part === null || util.primitiveTypes.has(typeof part)) {
87473
87298
  regexParts.push(util.escapeRegex(`${part}`));
@@ -87696,20 +87521,18 @@ const zod_v4_core_registries_globalRegistry = globalThis.__zod_globalRegistry;
87696
87521
 
87697
87522
 
87698
87523
 
87524
+ function snapshotChecks(def) {
87525
+ if (def.checks)
87526
+ def.checks = [...def.checks];
87527
+ return def;
87528
+ }
87699
87529
  // @__NO_SIDE_EFFECTS__
87700
87530
  function v4_core_api_string(Class, params) {
87701
- return new Class({
87702
- type: "string",
87703
- ...v4_core_util_normalizeParams(params),
87704
- });
87531
+ return new Class(snapshotChecks({ type: "string", ...v4_core_util_normalizeParams(params) }));
87705
87532
  }
87706
87533
  // @__NO_SIDE_EFFECTS__
87707
87534
  function v4_core_api_coercedString(Class, params) {
87708
- return new Class({
87709
- type: "string",
87710
- coerce: true,
87711
- ...util.normalizeParams(params),
87712
- });
87535
+ return new Class(snapshotChecks({ type: "string", coerce: true, ...util.normalizeParams(params) }));
87713
87536
  }
87714
87537
  // @__NO_SIDE_EFFECTS__
87715
87538
  function v4_core_api_email(Class, params) {
@@ -87950,6 +87773,16 @@ function v4_core_api_creditCard(Class, params) {
87950
87773
  });
87951
87774
  }
87952
87775
  // @__NO_SIDE_EFFECTS__
87776
+ function _iban(Class, params) {
87777
+ return new Class({
87778
+ type: "string",
87779
+ format: "iban",
87780
+ check: "string_format",
87781
+ abort: false,
87782
+ ...util.normalizeParams(params),
87783
+ });
87784
+ }
87785
+ // @__NO_SIDE_EFFECTS__
87953
87786
  function v4_core_api_jwt(Class, params) {
87954
87787
  return new Class({
87955
87788
  type: "string",
@@ -88008,20 +87841,11 @@ function v4_core_api_isoDuration(Class, params) {
88008
87841
  }
88009
87842
  // @__NO_SIDE_EFFECTS__
88010
87843
  function v4_core_api_number(Class, params) {
88011
- return new Class({
88012
- type: "number",
88013
- checks: [],
88014
- ...util.normalizeParams(params),
88015
- });
87844
+ return new Class(snapshotChecks({ type: "number", checks: [], ...util.normalizeParams(params) }));
88016
87845
  }
88017
87846
  // @__NO_SIDE_EFFECTS__
88018
87847
  function v4_core_api_coercedNumber(Class, params) {
88019
- return new Class({
88020
- type: "number",
88021
- coerce: true,
88022
- checks: [],
88023
- ...util.normalizeParams(params),
88024
- });
87848
+ return new Class(snapshotChecks({ type: "number", coerce: true, checks: [], ...util.normalizeParams(params) }));
88025
87849
  }
88026
87850
  // @__NO_SIDE_EFFECTS__
88027
87851
  function v4_core_api_int(Class, params) {
@@ -88368,8 +88192,12 @@ function v4_core_api_property(property, schema, params) {
88368
88192
  });
88369
88193
  }
88370
88194
  // @__NO_SIDE_EFFECTS__
88371
- function v4_core_api_properties(shape) {
88372
- return Object.entries(shape).map(([property, schema]) => new checks.$ZodCheckProperty({ check: "property", property, schema }));
88195
+ function v4_core_api_properties(shape, params) {
88196
+ return new checks.$ZodCheckProperties({
88197
+ check: "properties",
88198
+ shape,
88199
+ ...util.normalizeParams(params),
88200
+ });
88373
88201
  }
88374
88202
  // @__NO_SIDE_EFFECTS__
88375
88203
  function v4_core_api_mime(types, params) {
@@ -88855,7 +88683,8 @@ function zod_v4_core_to_json_schema_handleUnrepresentable(schema, ctx, json, par
88855
88683
  Object.assign(json, result);
88856
88684
  return true;
88857
88685
  }
88858
- function zod_v4_core_to_json_schema_process(schema, ctx, _params = { path: [], schemaPath: [] }) {
88686
+ // never rename this back to `process`: bundler polyfills inject a top-level `const process` that a lexical declaration of the same name collides with (#6397)
88687
+ function to_json_schema_processSchema(schema, ctx, _params = { path: [], schemaPath: [] }) {
88859
88688
  var _a;
88860
88689
  const def = schema._zod.def;
88861
88690
  // check for schema in seens
@@ -88901,7 +88730,7 @@ function zod_v4_core_to_json_schema_process(schema, ctx, _params = { path: [], s
88901
88730
  // Also set ref if processor didn't (for inheritance)
88902
88731
  if (!result.ref)
88903
88732
  result.ref = parent;
88904
- zod_v4_core_to_json_schema_process(parent, ctx, params);
88733
+ to_json_schema_processSchema(parent, ctx, params);
88905
88734
  ctx.seen.get(parent).isParent = true;
88906
88735
  }
88907
88736
  }
@@ -88922,6 +88751,8 @@ function zod_v4_core_to_json_schema_process(schema, ctx, _params = { path: [], s
88922
88751
  const _result = ctx.seen.get(schema);
88923
88752
  return _result.schema;
88924
88753
  }
88754
+ /** @deprecated Renamed to `processSchema`. An export alias declares no binding, so it is safe to keep. */
88755
+
88925
88756
  // Escape a reference token for use in a JSON Pointer fragment (RFC 6901): `~` becomes `~0` and `/` becomes `~1`. The `~` replacement must run first.
88926
88757
  function v4_core_to_json_schema_encodeJSONPointerSegment(segment) {
88927
88758
  return segment.replace(/~/g, "~0").replace(/\//g, "~1");
@@ -89038,8 +88869,6 @@ function zod_v4_core_to_json_schema_extractDefs(ctx, schema
89038
88869
  if (seen.count > 1) {
89039
88870
  if (ctx.reused === "ref") {
89040
88871
  extractToDef(entry);
89041
- // biome-ignore lint:
89042
- continue;
89043
88872
  }
89044
88873
  }
89045
88874
  }
@@ -89433,14 +89262,14 @@ function v4_core_to_json_schema_isTransforming(_schema, _ctx) {
89433
89262
  */
89434
89263
  const v4_core_to_json_schema_createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
89435
89264
  const ctx = zod_v4_core_to_json_schema_initializeContext({ ...params, processors });
89436
- zod_v4_core_to_json_schema_process(schema, ctx);
89265
+ to_json_schema_processSchema(schema, ctx);
89437
89266
  zod_v4_core_to_json_schema_extractDefs(ctx, schema);
89438
89267
  return zod_v4_core_to_json_schema_finalize(ctx, schema);
89439
89268
  };
89440
89269
  const v4_core_to_json_schema_createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
89441
89270
  const { libraryOptions, target } = params ?? {};
89442
89271
  const ctx = zod_v4_core_to_json_schema_initializeContext({ ...(libraryOptions ?? {}), target, io, processors });
89443
- zod_v4_core_to_json_schema_process(schema, ctx);
89272
+ to_json_schema_processSchema(schema, ctx);
89444
89273
  zod_v4_core_to_json_schema_extractDefs(ctx, schema);
89445
89274
  return zod_v4_core_to_json_schema_finalize(ctx, schema);
89446
89275
  };
@@ -89449,6 +89278,100 @@ const v4_core_to_json_schema_createStandardJSONSchemaMethod = (schema, io, proce
89449
89278
 
89450
89279
 
89451
89280
 
89281
+
89282
+ const narrowMin = (agg, key, value) => {
89283
+ if (agg[key] === undefined || value > agg[key])
89284
+ agg[key] = value;
89285
+ };
89286
+ const narrowMax = (agg, key, value) => {
89287
+ if (agg[key] === undefined || value < agg[key])
89288
+ agg[key] = value;
89289
+ };
89290
+ const narrowBoth = (agg, value) => {
89291
+ narrowMin(agg, "minimum", value);
89292
+ narrowMax(agg, "maximum", value);
89293
+ };
89294
+ const addDivisor = (agg, value) => {
89295
+ agg.multipleOf ?? (agg.multipleOf = []);
89296
+ if (!agg.multipleOf.includes(value))
89297
+ agg.multipleOf.push(value);
89298
+ };
89299
+ const addPattern = (agg, pattern) => {
89300
+ agg.patterns ?? (agg.patterns = new Set());
89301
+ agg.patterns.add(pattern);
89302
+ };
89303
+ const intersectMime = (agg, mime) => {
89304
+ agg.mime = agg.mime ? agg.mime.filter((m) => mime.includes(m)) : [...mime];
89305
+ };
89306
+ // last-wins, matching the bag's historical write order; the flag keeps an integer format from being lost to a later float one
89307
+ const setFormat = (agg, format) => {
89308
+ agg.format = format;
89309
+ if (format.includes("int"))
89310
+ agg.isInt = true;
89311
+ };
89312
+ const minContributor = (agg, def) => narrowMin(agg, "minimum", def.minimum);
89313
+ const maxContributor = (agg, def) => narrowMax(agg, "maximum", def.maximum);
89314
+ const formatContributor = (ranges) => (agg, def) => {
89315
+ setFormat(agg, def.format);
89316
+ const [minimum, maximum] = ranges[def.format];
89317
+ narrowMin(agg, "minimum", minimum);
89318
+ narrowMax(agg, "maximum", maximum);
89319
+ };
89320
+ const contributors = {
89321
+ greater_than: (agg, def) => narrowMin(agg, def.inclusive ? "minimum" : "exclusiveMinimum", def.value),
89322
+ less_than: (agg, def) => narrowMax(agg, def.inclusive ? "maximum" : "exclusiveMaximum", def.value),
89323
+ multiple_of: (agg, def) => addDivisor(agg, def.value),
89324
+ number_format: formatContributor(v4_core_util_NUMBER_FORMAT_RANGES),
89325
+ bigint_format: formatContributor(v4_core_util_BIGINT_FORMAT_RANGES),
89326
+ min_length: minContributor,
89327
+ max_length: maxContributor,
89328
+ length_equals: (agg, def) => narrowBoth(agg, def.length),
89329
+ min_size: minContributor,
89330
+ max_size: maxContributor,
89331
+ size_equals: (agg, def) => narrowBoth(agg, def.size),
89332
+ string_format: (agg, def) => {
89333
+ setFormat(agg, def.format);
89334
+ if (def.pattern)
89335
+ addPattern(agg, def.pattern);
89336
+ if (def.format === "base64" || def.format === "base64url")
89337
+ agg.contentEncoding = def.format;
89338
+ if (def.local || def.precision === -1)
89339
+ agg.laxFormat = true;
89340
+ },
89341
+ mime_type: (agg, def) => intersectMime(agg, def.mime),
89342
+ };
89343
+ function aggregateChecks(schema) {
89344
+ const agg = {};
89345
+ const def = schema._zod.def;
89346
+ // a format schema is its own first check, same rule as $ZodType init
89347
+ const list = schema._zod.traits.has("$ZodCheck")
89348
+ ? [schema, ...(def.checks ?? [])]
89349
+ : (def.checks ?? []);
89350
+ for (const ch of list)
89351
+ contributors[ch._zod.def.check]?.(agg, ch._zod.def);
89352
+ // reconcile with the bag so third-party onattach contributions still land; first-party residue is never tighter than the fold, so merging it back is idempotent for one and additive for the other
89353
+ const bag = schema._zod.bag;
89354
+ if (bag.minimum !== undefined)
89355
+ narrowMin(agg, "minimum", bag.minimum);
89356
+ if (bag.exclusiveMinimum !== undefined)
89357
+ narrowMin(agg, "exclusiveMinimum", bag.exclusiveMinimum);
89358
+ if (bag.maximum !== undefined)
89359
+ narrowMax(agg, "maximum", bag.maximum);
89360
+ if (bag.exclusiveMaximum !== undefined)
89361
+ narrowMax(agg, "exclusiveMaximum", bag.exclusiveMaximum);
89362
+ if (bag.multipleOf !== undefined)
89363
+ addDivisor(agg, bag.multipleOf);
89364
+ if (bag.format !== undefined) {
89365
+ agg.format ?? (agg.format = bag.format);
89366
+ if (bag.format.includes("int"))
89367
+ agg.isInt = true;
89368
+ }
89369
+ if (bag.mime)
89370
+ intersectMime(agg, bag.mime);
89371
+ for (const pattern of bag.patterns ?? [])
89372
+ addPattern(agg, pattern);
89373
+ return agg;
89374
+ }
89452
89375
  const v4_core_json_schema_processors_formatMap = {
89453
89376
  guid: "uuid",
89454
89377
  url: "uri",
@@ -89457,11 +89380,16 @@ const v4_core_json_schema_processors_formatMap = {
89457
89380
  regex: "", // do not set
89458
89381
  };
89459
89382
  // ==================== SIMPLE TYPE PROCESSORS ====================
89383
+ // the runtime patterns are lax so parse paths never overflow the regex stack; the emitted schema swaps in the exact block forms, which zod itself never executes
89384
+ const exactPatterns = new Map([
89385
+ [base64Charset, v4_core_regexes_base64],
89386
+ [base64urlCharset, v4_core_regexes_base64url],
89387
+ ]);
89388
+ const exactPattern = (p) => exactPatterns.get(p) ?? p;
89460
89389
  const v4_core_json_schema_processors_stringProcessor = (schema, ctx, _json, _params) => {
89461
89390
  const json = _json;
89462
89391
  json.type = "string";
89463
- const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = schema._zod
89464
- .bag;
89392
+ const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = aggregateChecks(schema);
89465
89393
  if (typeof minimum === "number")
89466
89394
  json.minLength = minimum;
89467
89395
  if (typeof maximum === "number")
@@ -89479,7 +89407,7 @@ const v4_core_json_schema_processors_stringProcessor = (schema, ctx, _json, _par
89479
89407
  if (contentEncoding)
89480
89408
  json.contentEncoding = contentEncoding;
89481
89409
  if (patterns && patterns.size > 0) {
89482
- const patternList = [...patterns];
89410
+ const patternList = [...patterns].map(exactPattern);
89483
89411
  if (patternList.length === 1)
89484
89412
  json.pattern = patternList[0].source;
89485
89413
  else if (patternList.length > 1) {
@@ -89496,11 +89424,8 @@ const v4_core_json_schema_processors_stringProcessor = (schema, ctx, _json, _par
89496
89424
  };
89497
89425
  const v4_core_json_schema_processors_numberProcessor = (schema, ctx, _json, params) => {
89498
89426
  const json = _json;
89499
- const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
89500
- if (typeof format === "string" && format.includes("int"))
89501
- json.type = "integer";
89502
- else
89503
- json.type = "number";
89427
+ const { minimum, maximum, multipleOf, exclusiveMaximum, exclusiveMinimum, isInt } = aggregateChecks(schema);
89428
+ json.type = isInt ? "integer" : "number";
89504
89429
  // when both minimum and exclusiveMinimum exist, pick the more restrictive one
89505
89430
  const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
89506
89431
  const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
@@ -89529,12 +89454,21 @@ const v4_core_json_schema_processors_numberProcessor = (schema, ctx, _json, para
89529
89454
  else if (typeof maximum === "number") {
89530
89455
  json.maximum = maximum;
89531
89456
  }
89532
- if (typeof multipleOf === "number") {
89457
+ if (multipleOf) {
89533
89458
  // JSON Schema requires a divisor strictly greater than zero, and a non-finite one does not survive JSON at all. A negative divisor accepts exactly what its absolute value accepts, so it still maps; zero, NaN and Infinity have no keyword form.
89534
- if (Number.isFinite(multipleOf) && multipleOf !== 0)
89535
- json.multipleOf = Math.abs(multipleOf);
89536
- else
89537
- handleUnrepresentable(schema, ctx, json, params, `A multipleOf divisor of ${multipleOf} cannot be represented in JSON Schema`);
89459
+ const divisors = new Set();
89460
+ for (const divisor of multipleOf) {
89461
+ if (Number.isFinite(divisor) && divisor !== 0)
89462
+ divisors.add(Math.abs(divisor));
89463
+ else
89464
+ handleUnrepresentable(schema, ctx, json, params, `A multipleOf divisor of ${divisor} cannot be represented in JSON Schema`);
89465
+ }
89466
+ // chained divisors are a conjunction the keyword cannot carry alone, so extras ride an allOf, same as stacked patterns
89467
+ const [first, ...rest] = divisors;
89468
+ if (first !== undefined)
89469
+ json.multipleOf = first;
89470
+ if (rest.length)
89471
+ json.allOf = [...(json.allOf ?? []), ...rest.map((m) => ({ multipleOf: m }))];
89538
89472
  }
89539
89473
  };
89540
89474
  const v4_core_json_schema_processors_booleanProcessor = (_schema, _ctx, json, _params) => {
@@ -89651,29 +89585,24 @@ const v4_core_json_schema_processors_templateLiteralProcessor = (schema, _ctx, j
89651
89585
  };
89652
89586
  const v4_core_json_schema_processors_fileProcessor = (schema, _ctx, json, _params) => {
89653
89587
  const _json = json;
89654
- const file = {
89655
- type: "string",
89656
- format: "binary",
89657
- contentEncoding: "binary",
89658
- };
89659
- const { minimum, maximum, mime } = schema._zod.bag;
89588
+ _json.type = "string";
89589
+ _json.format = "binary";
89590
+ _json.contentEncoding = "binary";
89591
+ const { minimum, maximum, mime } = aggregateChecks(schema);
89660
89592
  if (minimum !== undefined)
89661
- file.minLength = minimum;
89593
+ _json.minLength = minimum;
89662
89594
  if (maximum !== undefined)
89663
- file.maxLength = maximum;
89664
- if (mime) {
89665
- if (mime.length === 1) {
89666
- file.contentMediaType = mime[0];
89667
- Object.assign(_json, file);
89668
- }
89669
- else {
89670
- Object.assign(_json, file); // shared props at root
89671
- _json.anyOf = mime.map((m) => ({ contentMediaType: m })); // only contentMediaType differs
89672
- }
89673
- }
89674
- else {
89675
- Object.assign(_json, file);
89676
- }
89595
+ _json.maxLength = maximum;
89596
+ if (!mime)
89597
+ return;
89598
+ // an empty intersection means the mime checks share no value, so nothing passes at runtime; `anyOf` must be non-empty, so the false schema is `not: {}`
89599
+ if (mime.length === 0)
89600
+ _json.not = {};
89601
+ else if (mime.length === 1)
89602
+ _json.contentMediaType = mime[0];
89603
+ // only contentMediaType differs, so the shared props stay at the root
89604
+ else
89605
+ _json.anyOf = mime.map((m) => ({ contentMediaType: m }));
89677
89606
  };
89678
89607
  const v4_core_json_schema_processors_successProcessor = (_schema, _ctx, json, _params) => {
89679
89608
  json.type = "boolean";
@@ -89697,13 +89626,13 @@ const v4_core_json_schema_processors_setProcessor = (schema, ctx, json, params)
89697
89626
  const v4_core_json_schema_processors_arrayProcessor = (schema, ctx, _json, params) => {
89698
89627
  const json = _json;
89699
89628
  const def = schema._zod.def;
89700
- const { minimum, maximum } = schema._zod.bag;
89629
+ const { minimum, maximum } = aggregateChecks(schema);
89701
89630
  if (typeof minimum === "number")
89702
89631
  json.minItems = minimum;
89703
89632
  if (typeof maximum === "number")
89704
89633
  json.maxItems = maximum;
89705
89634
  json.type = "array";
89706
- json.items = zod_v4_core_to_json_schema_process(def.element, ctx, {
89635
+ json.items = to_json_schema_processSchema(def.element, ctx, {
89707
89636
  ...params,
89708
89637
  path: [...params.path, "items"],
89709
89638
  });
@@ -89737,24 +89666,21 @@ const v4_core_json_schema_processors_objectProcessor = (schema, ctx, _json, para
89737
89666
  json.properties = {};
89738
89667
  for (const key in shape) {
89739
89668
  // assignProp so a __proto__ key becomes an own property instead of hitting the inherited setter on the plain {} we build into
89740
- zod_v4_core_util_assignProp(json.properties, key, zod_v4_core_to_json_schema_process(shape[key], ctx, {
89669
+ zod_v4_core_util_assignProp(json.properties, key, to_json_schema_processSchema(shape[key], ctx, {
89741
89670
  ...params,
89742
89671
  path: [...params.path, "properties", key],
89743
89672
  }));
89744
89673
  }
89745
89674
  // required keys
89746
- const allKeys = new Set(Object.keys(shape));
89747
- const requiredKeys = new Set([...allKeys].filter((key) => {
89675
+ const requiredKeys = [];
89676
+ for (const key of Object.keys(shape)) {
89748
89677
  const field = def.shape[key];
89749
- if (ctx.io === "input") {
89750
- return v4_core_json_schema_processors_inputOptin(field) === undefined;
89678
+ if (ctx.io === "input" ? v4_core_json_schema_processors_inputOptin(field) === undefined : field._zod.optout === undefined) {
89679
+ requiredKeys.push(key);
89751
89680
  }
89752
- else {
89753
- return field._zod.optout === undefined;
89754
- }
89755
- }));
89756
- if (requiredKeys.size > 0) {
89757
- json.required = Array.from(requiredKeys);
89681
+ }
89682
+ if (requiredKeys.length > 0) {
89683
+ json.required = requiredKeys;
89758
89684
  }
89759
89685
  // catchall
89760
89686
  if (def.catchall?._zod.def.type === "never") {
@@ -89767,7 +89693,7 @@ const v4_core_json_schema_processors_objectProcessor = (schema, ctx, _json, para
89767
89693
  json.additionalProperties = false;
89768
89694
  }
89769
89695
  else if (def.catchall) {
89770
- json.additionalProperties = zod_v4_core_to_json_schema_process(def.catchall, ctx, {
89696
+ json.additionalProperties = to_json_schema_processSchema(def.catchall, ctx, {
89771
89697
  ...params,
89772
89698
  path: [...params.path, "additionalProperties"],
89773
89699
  });
@@ -89777,7 +89703,7 @@ const v4_core_json_schema_processors_unionProcessor = (schema, ctx, json, params
89777
89703
  const def = schema._zod.def;
89778
89704
  // Exclusive unions (inclusive === false) use oneOf (exactly one match) instead of anyOf (one or more matches). This includes both z.xor() and discriminated unions
89779
89705
  const isExclusive = def.inclusive === false;
89780
- const options = def.options.map((x, i) => zod_v4_core_to_json_schema_process(x, ctx, {
89706
+ const options = def.options.map((x, i) => to_json_schema_processSchema(x, ctx, {
89781
89707
  ...params,
89782
89708
  path: [...params.path, isExclusive ? "oneOf" : "anyOf", i],
89783
89709
  }));
@@ -89790,11 +89716,11 @@ const v4_core_json_schema_processors_unionProcessor = (schema, ctx, json, params
89790
89716
  };
89791
89717
  const v4_core_json_schema_processors_intersectionProcessor = (schema, ctx, json, params) => {
89792
89718
  const def = schema._zod.def;
89793
- const a = zod_v4_core_to_json_schema_process(def.left, ctx, {
89719
+ const a = to_json_schema_processSchema(def.left, ctx, {
89794
89720
  ...params,
89795
89721
  path: [...params.path, "allOf", 0],
89796
89722
  });
89797
- const b = zod_v4_core_to_json_schema_process(def.right, ctx, {
89723
+ const b = to_json_schema_processSchema(def.right, ctx, {
89798
89724
  ...params,
89799
89725
  path: [...params.path, "allOf", 1],
89800
89726
  });
@@ -89813,12 +89739,12 @@ const v4_core_json_schema_processors_tupleProcessor = (schema, ctx, _json, param
89813
89739
  json.type = "array";
89814
89740
  const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
89815
89741
  const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
89816
- const prefixItems = def.items.map((x, i) => process(x, ctx, {
89742
+ const prefixItems = def.items.map((x, i) => processSchema(x, ctx, {
89817
89743
  ...params,
89818
89744
  path: [...params.path, prefixPath, i],
89819
89745
  }));
89820
89746
  const rest = def.rest
89821
- ? process(def.rest, ctx, {
89747
+ ? processSchema(def.rest, ctx, {
89822
89748
  ...params,
89823
89749
  path: [...params.path, restPath, ...(ctx.target === "openapi-3.0" ? [def.items.length] : [])],
89824
89750
  })
@@ -89872,7 +89798,7 @@ const v4_core_json_schema_processors_tupleProcessor = (schema, ctx, _json, param
89872
89798
  json.maxItems = maxItems;
89873
89799
  }
89874
89800
  // explicit user-defined length checks take precedence
89875
- const { minimum, maximum } = schema._zod.bag;
89801
+ const { minimum, maximum } = aggregateChecks(schema);
89876
89802
  if (typeof minimum === "number")
89877
89803
  json.minItems = minimum;
89878
89804
  if (typeof maximum === "number")
@@ -89965,23 +89891,22 @@ const v4_core_json_schema_processors_recordProcessor = (schema, ctx, _json, para
89965
89891
  json.type = "object";
89966
89892
  // For looseRecord with regex patterns, use patternProperties. This correctly represents "only validate keys matching the pattern" semantics and composes well with allOf (intersections)
89967
89893
  const keyType = def.keyType;
89968
- const keyBag = keyType._zod.bag;
89969
- const patterns = keyBag?.patterns;
89894
+ const patterns = aggregateChecks(keyType).patterns;
89970
89895
  if (def.mode === "loose" && patterns && patterns.size > 0) {
89971
89896
  // Use patternProperties for looseRecord with regex patterns
89972
- const valueSchema = process(def.valueType, ctx, {
89897
+ const valueSchema = processSchema(def.valueType, ctx, {
89973
89898
  ...params,
89974
89899
  path: [...params.path, "patternProperties", "*"],
89975
89900
  });
89976
89901
  json.patternProperties = {};
89977
89902
  for (const pattern of patterns) {
89978
- assignProp(json.patternProperties, pattern.source, valueSchema);
89903
+ assignProp(json.patternProperties, exactPattern(pattern).source, valueSchema);
89979
89904
  }
89980
89905
  }
89981
89906
  else {
89982
89907
  // Default behavior: use propertyNames + additionalProperties
89983
89908
  if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
89984
- json.propertyNames = process(def.keyType, ctx, {
89909
+ json.propertyNames = processSchema(def.keyType, ctx, {
89985
89910
  ...params,
89986
89911
  path: [...params.path, "propertyNames"],
89987
89912
  });
@@ -89993,7 +89918,7 @@ const v4_core_json_schema_processors_recordProcessor = (schema, ctx, _json, para
89993
89918
  }
89994
89919
  pending.push(schema);
89995
89920
  }
89996
- json.additionalProperties = process(def.valueType, ctx, {
89921
+ json.additionalProperties = processSchema(def.valueType, ctx, {
89997
89922
  ...params,
89998
89923
  path: [...params.path, "additionalProperties"],
89999
89924
  });
@@ -90011,7 +89936,7 @@ const v4_core_json_schema_processors_recordProcessor = (schema, ctx, _json, para
90011
89936
  };
90012
89937
  const v4_core_json_schema_processors_nullableProcessor = (schema, ctx, json, params) => {
90013
89938
  const def = schema._zod.def;
90014
- const inner = zod_v4_core_to_json_schema_process(def.innerType, ctx, params);
89939
+ const inner = to_json_schema_processSchema(def.innerType, ctx, params);
90015
89940
  const seen = ctx.seen.get(schema);
90016
89941
  if (ctx.target === "openapi-3.0") {
90017
89942
  seen.ref = def.innerType;
@@ -90023,7 +89948,7 @@ const v4_core_json_schema_processors_nullableProcessor = (schema, ctx, json, par
90023
89948
  };
90024
89949
  const v4_core_json_schema_processors_nonoptionalProcessor = (schema, ctx, _json, params) => {
90025
89950
  const def = schema._zod.def;
90026
- zod_v4_core_to_json_schema_process(def.innerType, ctx, params);
89951
+ to_json_schema_processSchema(def.innerType, ctx, params);
90027
89952
  const seen = ctx.seen.get(schema);
90028
89953
  seen.ref = def.innerType;
90029
89954
  };
@@ -90046,7 +89971,7 @@ function v4_core_json_schema_processors_serializeDefaultValue(value, schema, ctx
90046
89971
  }
90047
89972
  const v4_core_json_schema_processors_defaultProcessor = (schema, ctx, json, params) => {
90048
89973
  const def = schema._zod.def;
90049
- zod_v4_core_to_json_schema_process(def.innerType, ctx, params);
89974
+ to_json_schema_processSchema(def.innerType, ctx, params);
90050
89975
  const seen = ctx.seen.get(schema);
90051
89976
  seen.ref = def.innerType;
90052
89977
  const value = v4_core_json_schema_processors_serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
@@ -90055,7 +89980,7 @@ const v4_core_json_schema_processors_defaultProcessor = (schema, ctx, json, para
90055
89980
  };
90056
89981
  const v4_core_json_schema_processors_prefaultProcessor = (schema, ctx, json, params) => {
90057
89982
  const def = schema._zod.def;
90058
- zod_v4_core_to_json_schema_process(def.innerType, ctx, params);
89983
+ to_json_schema_processSchema(def.innerType, ctx, params);
90059
89984
  const seen = ctx.seen.get(schema);
90060
89985
  seen.ref = def.innerType;
90061
89986
  if (ctx.io !== "input")
@@ -90066,7 +89991,7 @@ const v4_core_json_schema_processors_prefaultProcessor = (schema, ctx, json, par
90066
89991
  };
90067
89992
  const v4_core_json_schema_processors_catchProcessor = (schema, ctx, json, params) => {
90068
89993
  const def = schema._zod.def;
90069
- zod_v4_core_to_json_schema_process(def.innerType, ctx, params);
89994
+ to_json_schema_processSchema(def.innerType, ctx, params);
90070
89995
  const seen = ctx.seen.get(schema);
90071
89996
  seen.ref = def.innerType;
90072
89997
  let catchValue;
@@ -90083,32 +90008,32 @@ const v4_core_json_schema_processors_pipeProcessor = (schema, ctx, _json, params
90083
90008
  const def = schema._zod.def;
90084
90009
  const inIsTransform = def.in._zod.traits.has("$ZodTransform");
90085
90010
  const innerType = ctx.io === "input" ? (inIsTransform ? def.out : def.in) : def.out;
90086
- zod_v4_core_to_json_schema_process(innerType, ctx, params);
90011
+ to_json_schema_processSchema(innerType, ctx, params);
90087
90012
  const seen = ctx.seen.get(schema);
90088
90013
  seen.ref = innerType;
90089
90014
  };
90090
90015
  const v4_core_json_schema_processors_readonlyProcessor = (schema, ctx, json, params) => {
90091
90016
  const def = schema._zod.def;
90092
- zod_v4_core_to_json_schema_process(def.innerType, ctx, params);
90017
+ to_json_schema_processSchema(def.innerType, ctx, params);
90093
90018
  const seen = ctx.seen.get(schema);
90094
90019
  seen.ref = def.innerType;
90095
90020
  json.readOnly = true;
90096
90021
  };
90097
90022
  const v4_core_json_schema_processors_promiseProcessor = (schema, ctx, _json, params) => {
90098
90023
  const def = schema._zod.def;
90099
- process(def.innerType, ctx, params);
90024
+ processSchema(def.innerType, ctx, params);
90100
90025
  const seen = ctx.seen.get(schema);
90101
90026
  seen.ref = def.innerType;
90102
90027
  };
90103
90028
  const v4_core_json_schema_processors_optionalProcessor = (schema, ctx, _json, params) => {
90104
90029
  const def = schema._zod.def;
90105
- zod_v4_core_to_json_schema_process(def.innerType, ctx, params);
90030
+ to_json_schema_processSchema(def.innerType, ctx, params);
90106
90031
  const seen = ctx.seen.get(schema);
90107
90032
  seen.ref = def.innerType;
90108
90033
  };
90109
90034
  const v4_core_json_schema_processors_lazyProcessor = (schema, ctx, _json, params) => {
90110
90035
  const innerType = schema._zod.innerType;
90111
- process(innerType, ctx, params);
90036
+ processSchema(innerType, ctx, params);
90112
90037
  const seen = ctx.seen.get(schema);
90113
90038
  seen.ref = innerType;
90114
90039
  };
@@ -90163,7 +90088,7 @@ function v4_core_json_schema_processors_toJSONSchema(input, params) {
90163
90088
  // First pass: process all schemas to build the seen map
90164
90089
  for (const entry of registry._idmap.entries()) {
90165
90090
  const [_, schema] = entry;
90166
- process(schema, ctx);
90091
+ processSchema(schema, ctx);
90167
90092
  }
90168
90093
  const schemas = {};
90169
90094
  const external = {
@@ -90189,7 +90114,7 @@ function v4_core_json_schema_processors_toJSONSchema(input, params) {
90189
90114
  }
90190
90115
  // Single schema case
90191
90116
  const ctx = initializeContext({ ...params, processors: v4_core_json_schema_processors_allProcessors });
90192
- process(input, ctx);
90117
+ processSchema(input, ctx);
90193
90118
  extractDefs(ctx, input);
90194
90119
  return finalize(ctx, input);
90195
90120
  }
@@ -90235,7 +90160,9 @@ const zod_v4_locales_en_error = () => {
90235
90160
  base64url: "base64url-encoded string",
90236
90161
  json_string: "JSON string",
90237
90162
  e164: "E.164 number",
90163
+ currency_code: "currency code",
90238
90164
  credit_card: "credit card number",
90165
+ iban: "IBAN",
90239
90166
  jwt: "JWT",
90240
90167
  template_literal: "input",
90241
90168
  };
@@ -90319,6 +90246,452 @@ const zod_v4_locales_en_error = () => {
90319
90246
  };
90320
90247
  }
90321
90248
 
90249
+ ;// CONCATENATED MODULE: ../../node_modules/zod/v4/core/errors.js
90250
+
90251
+
90252
+ /* Computing the message eagerly is expensive (pretty-printed JSON of all
90253
+ * issues), so defer it until first read. The accessor functions and
90254
+ * descriptors are shared across instances to keep error construction
90255
+ * cheap; the computed message is cached on the internals object. The
90256
+ * setter preserves plain assignment semantics for consumers that
90257
+ * overwrite `message`. */
90258
+ function v4_core_errors_getMessage() {
90259
+ const internals = this._zod;
90260
+ internals.message ?? (internals.message = JSON.stringify(internals.def, v4_core_util_jsonStringifyReplacer, 2));
90261
+ return internals.message;
90262
+ }
90263
+ function v4_core_errors_setMessage(value) {
90264
+ this._zod.message = value;
90265
+ }
90266
+ const v4_core_errors_messageDesc = {
90267
+ get: v4_core_errors_getMessage,
90268
+ set: v4_core_errors_setMessage,
90269
+ enumerable: true,
90270
+ configurable: true,
90271
+ };
90272
+ const v4_core_errors_issuesDesc = { value: undefined, enumerable: false };
90273
+ /* Prototypes that already carry the lazy `toString`. Seeded with the
90274
+ * intrinsics so that `init` on a foreign object — it accepts any object —
90275
+ * can never install an accessor onto a prototype we do not own. */
90276
+ const v4_core_errors_installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
90277
+ const zod_v4_core_errors_initializer = (inst, def) => {
90278
+ inst.name = "$ZodError";
90279
+ // `_zod` is already non-enumerable: $constructor's init defined it with this same descriptor
90280
+ v4_core_errors_issuesDesc.value = def;
90281
+ Object.defineProperty(inst, "issues", v4_core_errors_issuesDesc);
90282
+ // Clear the shared slot; a retained `value` pins the last error's issues.
90283
+ v4_core_errors_issuesDesc.value = undefined;
90284
+ Object.defineProperty(inst, "message", v4_core_errors_messageDesc);
90285
+ /* `toString` lives as a non-enumerable lazy getter on the shared
90286
+ * prototype; on first access it caches a per-instance closure so
90287
+ * detached usage still works. */
90288
+ const proto = Object.getPrototypeOf(inst);
90289
+ if (!v4_core_errors_installedToString.has(proto)) {
90290
+ v4_core_errors_installedToString.add(proto);
90291
+ Object.defineProperty(proto, "toString", {
90292
+ configurable: true,
90293
+ enumerable: false,
90294
+ get() {
90295
+ const value = () => this.message;
90296
+ Object.defineProperty(this, "toString", { value, configurable: true, writable: true });
90297
+ return value;
90298
+ },
90299
+ set(value) {
90300
+ Object.defineProperty(this, "toString", { value, configurable: true, writable: true });
90301
+ },
90302
+ });
90303
+ }
90304
+ };
90305
+ const v4_core_errors_$ZodError = v4_core_core_$constructor("$ZodError", zod_v4_core_errors_initializer);
90306
+ const v4_core_errors_$ZodRealError = v4_core_core_$constructor("$ZodError", zod_v4_core_errors_initializer, undefined, {
90307
+ Parent: Error,
90308
+ });
90309
+ /** Get-or-create `obj[key]` as an own data property. A path segment naming an inherited member
90310
+ * ("toString", "constructor") would otherwise read through to the prototype, and assigning
90311
+ * "__proto__" would hit the setter instead of creating a key. */
90312
+ function zod_v4_core_errors_node(obj, key, make) {
90313
+ if (!Object.prototype.hasOwnProperty.call(obj, key)) {
90314
+ if (key === "__proto__") {
90315
+ Object.defineProperty(obj, key, { value: make(), writable: true, enumerable: true, configurable: true });
90316
+ }
90317
+ else {
90318
+ obj[key] = make();
90319
+ }
90320
+ }
90321
+ return obj[key];
90322
+ }
90323
+ function v4_core_errors_flattenError(error, mapper = (issue) => issue.message) {
90324
+ const fieldErrors = {};
90325
+ const formErrors = [];
90326
+ for (const sub of error.issues) {
90327
+ if (sub.path.length > 0) {
90328
+ zod_v4_core_errors_node(fieldErrors, sub.path[0], () => []).push(mapper(sub));
90329
+ }
90330
+ else {
90331
+ formErrors.push(mapper(sub));
90332
+ }
90333
+ }
90334
+ return { formErrors, fieldErrors };
90335
+ }
90336
+ function v4_core_errors_formatError(error, mapper = (issue) => issue.message) {
90337
+ const fieldErrors = { _errors: [] };
90338
+ const processError = (error, path = []) => {
90339
+ for (const issue of error.issues) {
90340
+ if (issue.code === "invalid_union" && issue.errors.length) {
90341
+ issue.errors.map((issues) => processError({ issues }, [...path, ...issue.path]));
90342
+ }
90343
+ else if (issue.code === "invalid_key") {
90344
+ processError({ issues: issue.issues }, [...path, ...issue.path]);
90345
+ }
90346
+ else if (issue.code === "invalid_element") {
90347
+ processError({ issues: issue.issues }, [...path, ...issue.path]);
90348
+ }
90349
+ else {
90350
+ const fullpath = [...path, ...issue.path];
90351
+ if (fullpath.length === 0) {
90352
+ fieldErrors._errors.push(mapper(issue));
90353
+ }
90354
+ else {
90355
+ let curr = fieldErrors;
90356
+ let i = 0;
90357
+ while (i < fullpath.length) {
90358
+ const el = fullpath[i];
90359
+ const terminal = i === fullpath.length - 1;
90360
+ // `_errors` is reserved by this legacy format, so merge a matching path segment into the current node instead of treating its array as a child.
90361
+ if (el === "_errors") {
90362
+ if (terminal)
90363
+ curr._errors.push(mapper(issue));
90364
+ i++;
90365
+ continue;
90366
+ }
90367
+ // A path element may collide with an inherited property name such as
90368
+ // "__proto__" or "constructor". Truthiness checks read the prototype
90369
+ // (so no node is created, then ._errors.push throws), and bracket
90370
+ // assignment of "__proto__" hits the setter instead of creating an
90371
+ // own key. Guard the read with hasOwnProperty and create the node
90372
+ // with defineProperty so any path element becomes a real own key.
90373
+ if (!Object.prototype.hasOwnProperty.call(curr, el)) {
90374
+ Object.defineProperty(curr, el, {
90375
+ value: { _errors: [] },
90376
+ enumerable: true,
90377
+ writable: true,
90378
+ configurable: true,
90379
+ });
90380
+ }
90381
+ const node = curr[el];
90382
+ if (terminal) {
90383
+ node._errors.push(mapper(issue));
90384
+ }
90385
+ curr = node;
90386
+ i++;
90387
+ }
90388
+ }
90389
+ }
90390
+ }
90391
+ };
90392
+ processError(error);
90393
+ return fieldErrors;
90394
+ }
90395
+ function v4_core_errors_treeifyError(error, mapper = (issue) => issue.message) {
90396
+ const result = { errors: [] };
90397
+ const processError = (error, path = []) => {
90398
+ var _a;
90399
+ for (const issue of error.issues) {
90400
+ if (issue.code === "invalid_union" && issue.errors.length) {
90401
+ // regular union error
90402
+ issue.errors.map((issues) => processError({ issues }, [...path, ...issue.path]));
90403
+ }
90404
+ else if (issue.code === "invalid_key") {
90405
+ processError({ issues: issue.issues }, [...path, ...issue.path]);
90406
+ }
90407
+ else if (issue.code === "invalid_element") {
90408
+ processError({ issues: issue.issues }, [...path, ...issue.path]);
90409
+ }
90410
+ else {
90411
+ const fullpath = [...path, ...issue.path];
90412
+ if (fullpath.length === 0) {
90413
+ result.errors.push(mapper(issue));
90414
+ continue;
90415
+ }
90416
+ let curr = result;
90417
+ let i = 0;
90418
+ while (i < fullpath.length) {
90419
+ const el = fullpath[i];
90420
+ const terminal = i === fullpath.length - 1;
90421
+ if (typeof el === "string") {
90422
+ curr.properties ?? (curr.properties = {});
90423
+ // el may collide with an inherited property name ("__proto__",
90424
+ // "constructor", ...); ??= reads the prototype so the node is never
90425
+ // created and curr.errors.push throws. Guard with hasOwnProperty and
90426
+ // create the node with defineProperty so "__proto__" becomes a real
90427
+ // own key rather than invoking the prototype setter.
90428
+ if (!Object.prototype.hasOwnProperty.call(curr.properties, el)) {
90429
+ Object.defineProperty(curr.properties, el, {
90430
+ value: { errors: [] },
90431
+ enumerable: true,
90432
+ writable: true,
90433
+ configurable: true,
90434
+ });
90435
+ }
90436
+ curr = curr.properties[el];
90437
+ }
90438
+ else {
90439
+ curr.items ?? (curr.items = []);
90440
+ (_a = curr.items)[el] ?? (_a[el] = { errors: [] });
90441
+ curr = curr.items[el];
90442
+ }
90443
+ if (terminal) {
90444
+ curr.errors.push(mapper(issue));
90445
+ }
90446
+ i++;
90447
+ }
90448
+ }
90449
+ }
90450
+ };
90451
+ processError(error);
90452
+ return result;
90453
+ }
90454
+ /** Format a ZodError as a human-readable string in the following form.
90455
+ *
90456
+ * From
90457
+ *
90458
+ * ```ts
90459
+ * ZodError {
90460
+ * issues: [
90461
+ * {
90462
+ * expected: 'string',
90463
+ * code: 'invalid_type',
90464
+ * path: [ 'username' ],
90465
+ * message: 'Invalid input: expected string'
90466
+ * },
90467
+ * {
90468
+ * expected: 'number',
90469
+ * code: 'invalid_type',
90470
+ * path: [ 'favoriteNumbers', 1 ],
90471
+ * message: 'Invalid input: expected number'
90472
+ * }
90473
+ * ];
90474
+ * }
90475
+ * ```
90476
+ *
90477
+ * to
90478
+ *
90479
+ * ```
90480
+ * username
90481
+ * ✖ Expected number, received string at "username
90482
+ * favoriteNumbers[0]
90483
+ * ✖ Invalid input: expected number
90484
+ * ```
90485
+ */
90486
+ function v4_core_errors_toDotPath(_path) {
90487
+ const segs = [];
90488
+ const path = _path.map((seg) => (typeof seg === "object" ? seg.key : seg));
90489
+ for (const seg of path) {
90490
+ if (typeof seg === "number")
90491
+ segs.push(`[${seg}]`);
90492
+ else if (typeof seg === "symbol")
90493
+ segs.push(`[${JSON.stringify(String(seg))}]`);
90494
+ else if (/[^\w$]/.test(seg))
90495
+ segs.push(`[${JSON.stringify(seg)}]`);
90496
+ else {
90497
+ if (segs.length)
90498
+ segs.push(".");
90499
+ segs.push(seg);
90500
+ }
90501
+ }
90502
+ return segs.join("");
90503
+ }
90504
+ function v4_core_errors_prettifyError(error) {
90505
+ const lines = [];
90506
+ // sort by path length
90507
+ const issues = [...error.issues].sort((a, b) => (a.path ?? []).length - (b.path ?? []).length);
90508
+ // Process each issue
90509
+ for (const issue of issues) {
90510
+ lines.push(`✖ ${issue.message}`);
90511
+ if (issue.path?.length)
90512
+ lines.push(` → at ${v4_core_errors_toDotPath(issue.path)}`);
90513
+ }
90514
+ // Convert Map to formatted string
90515
+ return lines.join("\n");
90516
+ }
90517
+
90518
+ ;// CONCATENATED MODULE: ../../node_modules/zod/v4/core/parse.js
90519
+
90520
+
90521
+
90522
+ // Always both keys, so the `_params` read site in `_parse` sees one object shape rather than two.
90523
+ function v4_core_parse_finalizeParams(callee, params) {
90524
+ return { callee: params?.callee ?? callee, Err: params?.Err };
90525
+ }
90526
+ const node_modules_zod_v4_core_parse_parse_1 = (_Err) => {
90527
+ const fn = (schema, value, _ctx, _params) => {
90528
+ const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
90529
+ const result = schema._zod.run({ value, issues: [] }, ctx);
90530
+ if (result instanceof Promise) {
90531
+ throw new v4_core_core_$ZodAsyncError();
90532
+ }
90533
+ if (result.issues.length) {
90534
+ const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => v4_core_util_finalizeIssue(iss, ctx, zod_v4_core_core_config())));
90535
+ v4_core_util_captureStackTrace(e, _params?.callee ?? fn);
90536
+ throw e;
90537
+ }
90538
+ return result.value;
90539
+ };
90540
+ return fn;
90541
+ };
90542
+ const node_modules_zod_v4_core_parse_parse_2 = /* @__PURE__*/ node_modules_zod_v4_core_parse_parse_1(v4_core_errors_$ZodRealError);
90543
+ const node_modules_zod_v4_core_parse_parseAsync_1 = (_Err) => {
90544
+ const fn = async (schema, value, _ctx, params) => {
90545
+ const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
90546
+ let result = schema._zod.run({ value, issues: [] }, ctx);
90547
+ if (result instanceof Promise)
90548
+ result = await result;
90549
+ if (result.issues.length) {
90550
+ const e = new (params?.Err ?? _Err)(result.issues.map((iss) => v4_core_util_finalizeIssue(iss, ctx, zod_v4_core_core_config())));
90551
+ v4_core_util_captureStackTrace(e, params?.callee ?? fn);
90552
+ throw e;
90553
+ }
90554
+ return result.value;
90555
+ };
90556
+ return fn;
90557
+ };
90558
+ const node_modules_zod_v4_core_parse_parseAsync_2 = /* @__PURE__*/ node_modules_zod_v4_core_parse_parseAsync_1(v4_core_errors_$ZodRealError);
90559
+ const node_modules_zod_v4_core_parse_safeParse_0 = (_Err) => (schema, value, _ctx) => {
90560
+ const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
90561
+ const result = schema._zod.run({ value, issues: [] }, ctx);
90562
+ if (result instanceof Promise) {
90563
+ throw new v4_core_core_$ZodAsyncError();
90564
+ }
90565
+ return result.issues.length ? parse_failure(_Err, result.issues, ctx) : { success: true, data: result.value };
90566
+ };
90567
+ const node_modules_zod_v4_core_parse_safeParse_1 = /* @__PURE__*/ node_modules_zod_v4_core_parse_safeParse_0(v4_core_errors_$ZodRealError);
90568
+ // the error is built on the first read of `error`: finalizing the issues and constructing the instance is most of a failing parse, and a caller that only branches on `success` never pays it. a getter in the literal keeps this small; the alternative, one shared accessor descriptor plus a hidden state slot, reads ~15% faster but costs ~75 B gzipped in every bundle
90569
+ function parse_failure(Err, issues, ctx) {
90570
+ let error;
90571
+ return {
90572
+ success: false,
90573
+ get error() {
90574
+ if (!error) {
90575
+ error = new Err(issues.map((iss) => v4_core_util_finalizeIssue(iss, ctx, zod_v4_core_core_config())));
90576
+ // finalizeIssue drops `input`, so the built error holds nothing; keeping the raw issues past this point pins the parsed value for the life of the result
90577
+ issues = undefined;
90578
+ ctx = undefined;
90579
+ }
90580
+ return error;
90581
+ },
90582
+ set error(e) {
90583
+ error = e;
90584
+ // a replacement makes the getter's branch unreachable, so the captures have to go here too
90585
+ issues = undefined;
90586
+ ctx = undefined;
90587
+ },
90588
+ };
90589
+ }
90590
+ const node_modules_zod_v4_core_parse_safeParseAsync_0 = (_Err) => async (schema, value, _ctx) => {
90591
+ const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
90592
+ let result = schema._zod.run({ value, issues: [] }, ctx);
90593
+ if (result instanceof Promise)
90594
+ result = await result;
90595
+ return result.issues.length ? parse_failure(_Err, result.issues, ctx) : { success: true, data: result.value };
90596
+ };
90597
+ const node_modules_zod_v4_core_parse_safeParseAsync_1 = /* @__PURE__*/ node_modules_zod_v4_core_parse_safeParseAsync_0(v4_core_errors_$ZodRealError);
90598
+ // registry mirrors of the compiler's sentinels, so this module never imports the compiler
90599
+ const v4_core_parse_COMPILE_INVALID = /* @__PURE__ */ Symbol.for("zod.compile.invalid");
90600
+ const v4_core_parse_COMPILE_FALLBACK = /* @__PURE__ */ Symbol.for("zod.compile.fallback");
90601
+ // Deliberately tiny, because v8 will not inline a body carrying the fallback's object literals and throw. Everything that is not the compiled happy path lives in validateFallback, and that split is worth ~35% on a compiled schema.
90602
+ const v4_core_parse_validate = ((schema, value, _ctx) => {
90603
+ const validator = schema._zod.bag.validator;
90604
+ if (validator !== undefined) {
90605
+ if (validator(value) !== v4_core_parse_COMPILE_INVALID)
90606
+ return true;
90607
+ // a definite sentinel means the runtime would reject, so skip the re-parse; a ctx can still change the answer
90608
+ if (validator.definite === true && _ctx === undefined)
90609
+ return false;
90610
+ }
90611
+ return v4_core_parse_validateFallback(schema, value, _ctx);
90612
+ });
90613
+ function v4_core_parse_validateFallback(schema, value, _ctx) {
90614
+ const ctx = _ctx
90615
+ ? { ..._ctx, async: false, abortEarly: true }
90616
+ : { async: false, abortEarly: true };
90617
+ const fallbackRun = schema._zod.bag.fallbackRun;
90618
+ let result;
90619
+ if (fallbackRun) {
90620
+ // skip nested fast paths on the fallback, so user callbacks keep the at-most-twice bound
90621
+ ctx[v4_core_parse_COMPILE_FALLBACK] = true;
90622
+ result = fallbackRun({ value, issues: [] }, ctx);
90623
+ }
90624
+ else {
90625
+ result = schema._zod.run({ value, issues: [] }, ctx);
90626
+ }
90627
+ if (result instanceof Promise) {
90628
+ throw new v4_core_core_$ZodAsyncError();
90629
+ }
90630
+ return result.issues.length === 0;
90631
+ }
90632
+ // no fast path: the compiler keeps async parses on the runtime, because a promise-returning callback that is not declared async compiles to a throw
90633
+ const v4_core_parse_validateAsync = async (schema, value, _ctx) => {
90634
+ const ctx = _ctx
90635
+ ? { ..._ctx, async: true, abortEarly: true }
90636
+ : { async: true, abortEarly: true };
90637
+ let result = schema._zod.run({ value, issues: [] }, ctx);
90638
+ if (result instanceof Promise)
90639
+ result = await result;
90640
+ return result.issues.length === 0;
90641
+ };
90642
+ const node_modules_zod_v4_core_parse_encode_0 = (_Err) => {
90643
+ const parse = node_modules_zod_v4_core_parse_parse_1(_Err);
90644
+ const fn = (schema, value, _ctx, _params) => {
90645
+ const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
90646
+ return parse(schema, value, ctx, v4_core_parse_finalizeParams(fn, _params));
90647
+ };
90648
+ return fn;
90649
+ };
90650
+ const node_modules_zod_v4_core_parse_encode_1 = /* @__PURE__*/ node_modules_zod_v4_core_parse_encode_0(v4_core_errors_$ZodRealError);
90651
+ const node_modules_zod_v4_core_parse_decode_0 = (_Err) => {
90652
+ const parse = node_modules_zod_v4_core_parse_parse_1(_Err);
90653
+ const fn = (schema, value, _ctx, _params) => {
90654
+ return parse(schema, value, _ctx, v4_core_parse_finalizeParams(fn, _params));
90655
+ };
90656
+ return fn;
90657
+ };
90658
+ const node_modules_zod_v4_core_parse_decode_1 = /* @__PURE__*/ node_modules_zod_v4_core_parse_decode_0(v4_core_errors_$ZodRealError);
90659
+ const node_modules_zod_v4_core_parse_encodeAsync_0 = (_Err) => {
90660
+ const parseAsync = node_modules_zod_v4_core_parse_parseAsync_1(_Err);
90661
+ const fn = async (schema, value, _ctx, _params) => {
90662
+ const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
90663
+ return (await parseAsync(schema, value, ctx, v4_core_parse_finalizeParams(fn, _params)));
90664
+ };
90665
+ return fn;
90666
+ };
90667
+ const node_modules_zod_v4_core_parse_encodeAsync_1 = /* @__PURE__*/ node_modules_zod_v4_core_parse_encodeAsync_0(v4_core_errors_$ZodRealError);
90668
+ const node_modules_zod_v4_core_parse_decodeAsync_0 = (_Err) => {
90669
+ const parseAsync = node_modules_zod_v4_core_parse_parseAsync_1(_Err);
90670
+ const fn = async (schema, value, _ctx, _params) => {
90671
+ return await parseAsync(schema, value, _ctx, v4_core_parse_finalizeParams(fn, _params));
90672
+ };
90673
+ return fn;
90674
+ };
90675
+ const node_modules_zod_v4_core_parse_decodeAsync_1 = /* @__PURE__*/ node_modules_zod_v4_core_parse_decodeAsync_0(v4_core_errors_$ZodRealError);
90676
+ const node_modules_zod_v4_core_parse_safeEncode_0 = (_Err) => (schema, value, _ctx) => {
90677
+ const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
90678
+ return node_modules_zod_v4_core_parse_safeParse_0(_Err)(schema, value, ctx);
90679
+ };
90680
+ const node_modules_zod_v4_core_parse_safeEncode_1 = /* @__PURE__*/ node_modules_zod_v4_core_parse_safeEncode_0(v4_core_errors_$ZodRealError);
90681
+ const node_modules_zod_v4_core_parse_safeDecode_0 = (_Err) => (schema, value, _ctx) => {
90682
+ return node_modules_zod_v4_core_parse_safeParse_0(_Err)(schema, value, _ctx);
90683
+ };
90684
+ const node_modules_zod_v4_core_parse_safeDecode_1 = /* @__PURE__*/ node_modules_zod_v4_core_parse_safeDecode_0(v4_core_errors_$ZodRealError);
90685
+ const node_modules_zod_v4_core_parse_safeEncodeAsync_0 = (_Err) => async (schema, value, _ctx) => {
90686
+ const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
90687
+ return node_modules_zod_v4_core_parse_safeParseAsync_0(_Err)(schema, value, ctx);
90688
+ };
90689
+ const node_modules_zod_v4_core_parse_safeEncodeAsync_1 = /* @__PURE__*/ node_modules_zod_v4_core_parse_safeEncodeAsync_0(v4_core_errors_$ZodRealError);
90690
+ const node_modules_zod_v4_core_parse_safeDecodeAsync_0 = (_Err) => async (schema, value, _ctx) => {
90691
+ return node_modules_zod_v4_core_parse_safeParseAsync_0(_Err)(schema, value, _ctx);
90692
+ };
90693
+ const node_modules_zod_v4_core_parse_safeDecodeAsync_1 = /* @__PURE__*/ node_modules_zod_v4_core_parse_safeDecodeAsync_0(v4_core_errors_$ZodRealError);
90694
+
90322
90695
  ;// CONCATENATED MODULE: ../../node_modules/zod/v4/classic/errors.js
90323
90696
 
90324
90697
 
@@ -90404,6 +90777,7 @@ const zod_v4_classic_parse_safeDecodeAsync = /* @__PURE__ */ node_modules_zod_v4
90404
90777
 
90405
90778
 
90406
90779
 
90780
+
90407
90781
  // Register English as the default locale on first ZodType construction. Hooked into the `ZodType` `$constructor` (rather than a top-level `config(en())` in `external.ts`) so bundlers honoring `sideEffects: false` can't tree-shake it out — see #5953, #5725. An explicit `z.config(z.locales.xx())` call wins regardless of order, since this only sets the default when none is present.
90408
90782
  function v4_classic_schemas_ensureDefaultLocale() {
90409
90783
  if (!zod_v4_core_core_globalConfig.localeError)
@@ -90548,6 +90922,12 @@ const v4_classic_schemas_ZodType = /*@__PURE__*/ v4_core_core_$constructor("ZodT
90548
90922
  set spa(value) {
90549
90923
  zod_v4_core_util_own(this, "spa", value);
90550
90924
  },
90925
+ validate(data, params) {
90926
+ return v4_core_parse_validate(this, data, params);
90927
+ },
90928
+ validateAsync(data, params) {
90929
+ return v4_core_parse_validateAsync(this, data, params);
90930
+ },
90551
90931
  encode: function _encode(data, params) {
90552
90932
  return node_modules_zod_v4_classic_parse_encode(this, data, params, { callee: _encode });
90553
90933
  },
@@ -90589,10 +90969,11 @@ const node_modules_zod_v4_classic_schemas_ZodString = /*@__PURE__*/ v4_core_core
90589
90969
  v4_core_schemas_$ZodString.init(inst, def);
90590
90970
  v4_classic_schemas_ZodType.init(inst, def);
90591
90971
  inst._zod.processJSONSchema = (ctx, json, params) => v4_core_json_schema_processors_stringProcessor(inst, ctx, json, params);
90592
- const bag = inst._zod.bag;
90593
- inst.format = bag.format ?? null;
90594
- inst.minLength = bag.minimum ?? null;
90595
- inst.maxLength = bag.maximum ?? null;
90972
+ },
90973
+ /*@__PURE__*/ derived({
90974
+ format: (inst) => aggregateChecks(inst).format ?? null,
90975
+ minLength: (inst) => aggregateChecks(inst).minimum ?? null,
90976
+ maxLength: (inst) => aggregateChecks(inst).maximum ?? null,
90596
90977
  }, {
90597
90978
  regex(...args) {
90598
90979
  return this.check(v4_core_api_regex(...args));
@@ -90639,7 +91020,7 @@ const node_modules_zod_v4_classic_schemas_ZodString = /*@__PURE__*/ v4_core_core
90639
91020
  slugify() {
90640
91021
  return this.check(v4_core_api_slugify());
90641
91022
  },
90642
- });
91023
+ }));
90643
91024
  const node_modules_zod_v4_classic_schemas_ZodString_0 = /*@__PURE__*/ v4_core_core_$constructor("ZodString", (inst, def) => {
90644
91025
  v4_core_schemas_$ZodString.init(inst, def);
90645
91026
  node_modules_zod_v4_classic_schemas_ZodString.init(inst, def);
@@ -90791,8 +91172,8 @@ function zod_v4_classic_schemas_url(params) {
90791
91172
  }
90792
91173
  function v4_classic_schemas_httpUrl(params) {
90793
91174
  return core._url(v4_classic_schemas_ZodURL, {
90794
- protocol: core.regexes.httpProtocol,
90795
- hostname: core.regexes.domain,
91175
+ protocol: regexes.httpProtocol,
91176
+ hostname: regexes.domain,
90796
91177
  ...util.normalizeParams(params),
90797
91178
  });
90798
91179
  }
@@ -90933,6 +91314,13 @@ const v4_classic_schemas_ZodCreditCard = /*@__PURE__*/ (/* unused pure expressio
90933
91314
  function zod_v4_classic_schemas_creditCard(params) {
90934
91315
  return core._creditCard(v4_classic_schemas_ZodCreditCard, params);
90935
91316
  }
91317
+ const ZodIBAN = /*@__PURE__*/ (/* unused pure expression or super */ null && (core.$constructor("ZodIBAN", (inst, def) => {
91318
+ core.$ZodIBAN.init(inst, def);
91319
+ v4_classic_schemas_ZodStringFormat.init(inst, def);
91320
+ })));
91321
+ function schemas_iban(params) {
91322
+ return core._iban(ZodIBAN, params);
91323
+ }
90936
91324
  const v4_classic_schemas_ZodJWT = /*@__PURE__*/ v4_core_core_$constructor("ZodJWT", (inst, def) => {
90937
91325
  // ZodStringFormat.init(inst, def);
90938
91326
  v4_core_schemas_$ZodJWT.init(inst, def);
@@ -90950,10 +91338,13 @@ function v4_classic_schemas_stringFormat(format, fnOrRegex, _params = {}) {
90950
91338
  return core._stringFormat(v4_classic_schemas_ZodCustomStringFormat, format, fnOrRegex, _params);
90951
91339
  }
90952
91340
  function zod_v4_classic_schemas_hostname(_params) {
90953
- return core._stringFormat(v4_classic_schemas_ZodCustomStringFormat, "hostname", core.regexes.hostname, _params);
91341
+ return core._stringFormat(v4_classic_schemas_ZodCustomStringFormat, "hostname", regexes.hostname, _params);
90954
91342
  }
90955
91343
  function zod_v4_classic_schemas_hex(_params) {
90956
- return core._stringFormat(v4_classic_schemas_ZodCustomStringFormat, "hex", core.regexes.hex, _params);
91344
+ return core._stringFormat(v4_classic_schemas_ZodCustomStringFormat, "hex", regexes.hex, _params);
91345
+ }
91346
+ function schemas_currencyCode(_params) {
91347
+ return core._stringFormat(v4_classic_schemas_ZodCustomStringFormat, "currency_code", regexes.currencyCode, _params);
90957
91348
  }
90958
91349
  function zod_v4_classic_schemas_hash(alg, params) {
90959
91350
  const enc = params?.enc ?? "hex";
@@ -90967,14 +91358,22 @@ const v4_classic_schemas_ZodNumber = /*@__PURE__*/ (/* unused pure expression or
90967
91358
  core.$ZodNumber.init(inst, def);
90968
91359
  v4_classic_schemas_ZodType.init(inst, def);
90969
91360
  inst._zod.processJSONSchema = (ctx, json, params) => processors.numberProcessor(inst, ctx, json, params);
90970
- const bag = inst._zod.bag;
90971
- inst.minValue =
90972
- Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
90973
- inst.maxValue =
90974
- Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
90975
- inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? 0.5);
90976
91361
  inst.isFinite = true;
90977
- inst.format = bag.format ?? null;
91362
+ },
91363
+ /*@__PURE__*/ util.derived({
91364
+ minValue: (inst) => {
91365
+ const { minimum, exclusiveMinimum } = processors.aggregateChecks(inst);
91366
+ return Math.max(minimum ?? Number.NEGATIVE_INFINITY, exclusiveMinimum ?? Number.NEGATIVE_INFINITY);
91367
+ },
91368
+ maxValue: (inst) => {
91369
+ const { maximum, exclusiveMaximum } = processors.aggregateChecks(inst);
91370
+ return Math.min(maximum ?? Number.POSITIVE_INFINITY, exclusiveMaximum ?? Number.POSITIVE_INFINITY);
91371
+ },
91372
+ isInt: (inst) => {
91373
+ const { isInt, multipleOf } = processors.aggregateChecks(inst);
91374
+ return !!isInt || !!multipleOf?.some(Number.isSafeInteger);
91375
+ },
91376
+ format: (inst) => processors.aggregateChecks(inst).format ?? null,
90978
91377
  }, {
90979
91378
  gt(value, params) {
90980
91379
  return this.check(checks.gt(value, params));
@@ -91021,7 +91420,7 @@ const v4_classic_schemas_ZodNumber = /*@__PURE__*/ (/* unused pure expression or
91021
91420
  finite() {
91022
91421
  return this;
91023
91422
  },
91024
- })));
91423
+ }))));
91025
91424
  function zod_v4_classic_schemas_number(params) {
91026
91425
  return core._number(v4_classic_schemas_ZodNumber, params);
91027
91426
  }
@@ -91056,10 +91455,11 @@ const v4_classic_schemas_ZodBigInt = /*@__PURE__*/ (/* unused pure expression or
91056
91455
  core.$ZodBigInt.init(inst, def);
91057
91456
  v4_classic_schemas_ZodType.init(inst, def);
91058
91457
  inst._zod.processJSONSchema = (ctx, json, params) => processors.bigintProcessor(inst, ctx, json, params);
91059
- const bag = inst._zod.bag;
91060
- inst.minValue = bag.minimum ?? null;
91061
- inst.maxValue = bag.maximum ?? null;
91062
- inst.format = bag.format ?? null;
91458
+ },
91459
+ /*@__PURE__*/ util.derived({
91460
+ minValue: (inst) => processors.aggregateChecks(inst).minimum ?? null,
91461
+ maxValue: (inst) => processors.aggregateChecks(inst).maximum ?? null,
91462
+ format: (inst) => processors.aggregateChecks(inst).format ?? null,
91063
91463
  }, {
91064
91464
  gte(value, params) {
91065
91465
  return this.check(checks.gte(value, params));
@@ -91094,7 +91494,7 @@ const v4_classic_schemas_ZodBigInt = /*@__PURE__*/ (/* unused pure expression or
91094
91494
  multipleOf(value, params) {
91095
91495
  return this.check(checks.multipleOf(value, params));
91096
91496
  },
91097
- })));
91497
+ }))));
91098
91498
  function zod_v4_classic_schemas_bigint(params) {
91099
91499
  return core._bigint(v4_classic_schemas_ZodBigInt, params);
91100
91500
  }
@@ -91173,10 +91573,17 @@ const v4_classic_schemas_ZodDate = /*@__PURE__*/ (/* unused pure expression or s
91173
91573
  inst._zod.processJSONSchema = (ctx, json, params) => processors.dateProcessor(inst, ctx, json, params);
91174
91574
  inst.min = (value, params) => inst.check(checks.gte(value, params));
91175
91575
  inst.max = (value, params) => inst.check(checks.lte(value, params));
91176
- const c = inst._zod.bag;
91177
- inst.minDate = c.minimum ? new Date(c.minimum) : null;
91178
- inst.maxDate = c.maximum ? new Date(c.maximum) : null;
91179
- })));
91576
+ },
91577
+ /*@__PURE__*/ util.derived({
91578
+ minDate: (inst) => {
91579
+ const { minimum } = processors.aggregateChecks(inst);
91580
+ return minimum ? new Date(minimum) : null;
91581
+ },
91582
+ maxDate: (inst) => {
91583
+ const { maximum } = processors.aggregateChecks(inst);
91584
+ return maximum ? new Date(maximum) : null;
91585
+ },
91586
+ }, {}))));
91180
91587
  function zod_v4_classic_schemas_date(params) {
91181
91588
  return core._date(v4_classic_schemas_ZodDate, params);
91182
91589
  }
@@ -91222,19 +91629,20 @@ const v4_classic_schemas_ZodObject = /*@__PURE__*/ v4_core_core_$constructor("Zo
91222
91629
  return zod_v4_classic_schemas_enum(Object.keys(this._zod.def.shape));
91223
91630
  },
91224
91631
  catchall(catchall) {
91225
- return this.clone({ ...this._zod.def, catchall: catchall });
91632
+ // `mergeDefs` rather than a spread: spreading reads `shape`, and resolving it can mint a whole fresh subtree
91633
+ return this.clone(v4_core_util_mergeDefs(this._zod.def, { catchall: catchall }));
91226
91634
  },
91227
91635
  passthrough() {
91228
- return this.clone({ ...this._zod.def, catchall: zod_v4_classic_schemas_unknown() });
91636
+ return this.clone(v4_core_util_mergeDefs(this._zod.def, { catchall: zod_v4_classic_schemas_unknown() }));
91229
91637
  },
91230
91638
  loose() {
91231
- return this.clone({ ...this._zod.def, catchall: zod_v4_classic_schemas_unknown() });
91639
+ return this.clone(v4_core_util_mergeDefs(this._zod.def, { catchall: zod_v4_classic_schemas_unknown() }));
91232
91640
  },
91233
91641
  strict() {
91234
- return this.clone({ ...this._zod.def, catchall: v4_classic_schemas_never() });
91642
+ return this.clone(v4_core_util_mergeDefs(this._zod.def, { catchall: v4_classic_schemas_never() }));
91235
91643
  },
91236
91644
  strip() {
91237
- return this.clone({ ...this._zod.def, catchall: undefined });
91645
+ return this.clone(v4_core_util_mergeDefs(this._zod.def, { catchall: undefined }));
91238
91646
  },
91239
91647
  extend(incoming) {
91240
91648
  return v4_core_util_extend(this, incoming);
@@ -91243,7 +91651,7 @@ const v4_classic_schemas_ZodObject = /*@__PURE__*/ v4_core_core_$constructor("Zo
91243
91651
  return v4_core_util_safeExtend(this, incoming);
91244
91652
  },
91245
91653
  merge(other) {
91246
- return v4_core_util_merge(this, other);
91654
+ return zod_v4_core_util_merge(this, other);
91247
91655
  },
91248
91656
  pick(mask) {
91249
91657
  return v4_core_util_pick(this, mask);
@@ -91462,7 +91870,8 @@ const v4_classic_schemas_ZodEnum = /*@__PURE__*/ v4_core_core_$constructor("ZodE
91462
91870
  v4_classic_schemas_ZodType.init(inst, def);
91463
91871
  inst._zod.processJSONSchema = (ctx, json, params) => v4_core_json_schema_processors_enumProcessor(inst, ctx, json, params);
91464
91872
  inst.enum = def.entries;
91465
- inst.options = Object.values(def.entries);
91873
+ // reuse the parsed value set so a numeric TS enum's reverse-mapping keys stay out
91874
+ inst.options = [...inst._zod.values];
91466
91875
  const keys = new Set(Object.keys(def.entries));
91467
91876
  inst.extract = (values, params) => {
91468
91877
  const newEntries = {};
@@ -91844,8 +92253,16 @@ function v4_classic_schemas_superRefine(fn, params) {
91844
92253
  // Re-export describe and meta from core
91845
92254
  const zod_v4_classic_schemas_describe = v4_core_api_describe;
91846
92255
  const zod_v4_classic_schemas_meta = zod_v4_core_api_meta;
92256
+ const ZodInstanceOf = /*@__PURE__*/ (/* unused pure expression or super */ null && (core.$constructor("ZodInstanceOf", (inst, def) => {
92257
+ v4_classic_schemas_ZodCustom.init(inst, def);
92258
+ }, {
92259
+ properties(shape, params) {
92260
+ // asserts in place, so the narrowed output type is truthful without a wrapper
92261
+ return this.check(core._properties(shape, params));
92262
+ },
92263
+ })));
91847
92264
  function v4_classic_schemas_instanceof(cls, params = {}) {
91848
- const inst = new v4_classic_schemas_ZodCustom({
92265
+ const inst = new ZodInstanceOf({
91849
92266
  type: "custom",
91850
92267
  check: "custom",
91851
92268
  fn: (data) => data instanceof cls,
@@ -101429,35 +101846,19 @@ exports.visitAsync = visitAsync;
101429
101846
 
101430
101847
 
101431
101848
  },
101432
- 5492(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
101433
- const t=Symbol.for(`__confbox_fmt__`),n=/^(\s+)/,r=/(\s+)$/;function i(e,t={}){return{sample:t.indent===void 0&&t.preserveIndentation!==!1&&e.slice(0,t?.sampleSize||1024),whiteSpace:t.preserveWhitespace===!1?void 0:{start:n.exec(e)?.[0]||``,end:r.exec(e)?.[0]||``}}}function a(e,n,r){!n||typeof n!=`object`||Object.defineProperty(n,t,{enumerable:!1,configurable:!0,writable:!0,value:i(e,r)})}function o(n,r){if(!n||typeof n!=`object`||!(t in n))return{indent:r?.indent??2,whitespace:{start:``,end:``}};let i=n[t];return{indent:r?.indent||e(i.sample||``).indent,whitespace:i.whiteSpace||{start:``,end:``}}}
101434
- __webpack_require__.d(__webpack_exports__, {
101435
- n: () => (a)
101436
- });
101437
-
101438
-
101439
- },
101440
- 5975(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
101849
+ 8655(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
101441
101850
 
101442
101851
  // EXPORTS
101443
101852
  __webpack_require__.d(__webpack_exports__, {
101444
- parseJSONC: () => (/* binding */ jsonc_r)
101853
+ gV: () => (/* binding */ _format_s),
101854
+ $Z: () => (/* binding */ _format_o),
101855
+ xi: () => (/* binding */ _format_i)
101445
101856
  });
101446
101857
 
101447
- // UNUSED EXPORTS: stringifyJSONC
101448
-
101449
- // EXTERNAL MODULE: ../../node_modules/confbox/dist/_chunks/_format.mjs
101450
- var _format = __webpack_require__(5492);
101451
- ;// CONCATENATED MODULE: ../../node_modules/confbox/dist/_chunks/libs/jsonc-parser.mjs
101452
- function jsonc_parser_e(e,i=!1){let a=e.length,o=0,s=``,c=0,l=16,u=0,d=0,f=0,p=0,m=0;function h(t,n){let r=0,i=0;for(;r<t||!n;){let t=e.charCodeAt(o);if(t>=48&&t<=57)i=i*16+t-48;else if(t>=65&&t<=70)i=i*16+t-65+10;else if(t>=97&&t<=102)i=i*16+t-97+10;else break;o++,r++}return r<t&&(i=-1),i}function g(e){o=e,s=``,c=0,l=16,m=0}function _(){let t=o;if(e.charCodeAt(o)===48)o++;else for(o++;o<e.length&&jsonc_parser_r(e.charCodeAt(o));)o++;if(o<e.length&&e.charCodeAt(o)===46)if(o++,o<e.length&&jsonc_parser_r(e.charCodeAt(o)))for(o++;o<e.length&&jsonc_parser_r(e.charCodeAt(o));)o++;else return m=3,e.substring(t,o);let n=o;if(o<e.length&&(e.charCodeAt(o)===69||e.charCodeAt(o)===101))if(o++,(o<e.length&&e.charCodeAt(o)===43||e.charCodeAt(o)===45)&&o++,o<e.length&&jsonc_parser_r(e.charCodeAt(o))){for(o++;o<e.length&&jsonc_parser_r(e.charCodeAt(o));)o++;n=o}else m=3;return e.substring(t,n)}function v(){let t=``,r=o;for(;;){if(o>=a){t+=e.substring(r,o),m=2;break}let i=e.charCodeAt(o);if(i===34){t+=e.substring(r,o),o++;break}if(i===92){if(t+=e.substring(r,o),o++,o>=a){m=2;break}switch(e.charCodeAt(o++)){case 34:t+=`"`;break;case 92:t+=`\\`;break;case 47:t+=`/`;break;case 98:t+=`\b`;break;case 102:t+=`\f`;break;case 110:t+=`
101453
- `;break;case 114:t+=`\r`;break;case 116:t+=` `;break;case 117:let e=h(4,!0);e>=0?t+=String.fromCharCode(e):m=4;break;default:m=5}r=o;continue}if(i>=0&&i<=31)if(jsonc_parser_n(i)){t+=e.substring(r,o),m=2;break}else m=6;o++}return t}function y(){if(s=``,m=0,c=o,d=u,p=f,o>=a)return c=a,l=17;let i=e.charCodeAt(o);if(jsonc_parser_t(i)){do o++,s+=String.fromCharCode(i),i=e.charCodeAt(o);while(jsonc_parser_t(i));return l=15}if(jsonc_parser_n(i))return o++,s+=String.fromCharCode(i),i===13&&e.charCodeAt(o)===10&&(o++,s+=`
101454
- `),u++,f=o,l=14;switch(i){case 123:return o++,l=1;case 125:return o++,l=2;case 91:return o++,l=3;case 93:return o++,l=4;case 58:return o++,l=6;case 44:return o++,l=5;case 34:return o++,s=v(),l=10;case 47:let t=o-1;if(e.charCodeAt(o+1)===47){for(o+=2;o<a&&!jsonc_parser_n(e.charCodeAt(o));)o++;return s=e.substring(t,o),l=12}if(e.charCodeAt(o+1)===42){o+=2;let r=a-1,i=!1;for(;o<r;){let t=e.charCodeAt(o);if(t===42&&e.charCodeAt(o+1)===47){o+=2,i=!0;break}o++,jsonc_parser_n(t)&&(t===13&&e.charCodeAt(o)===10&&o++,u++,f=o)}return i||(o++,m=1),s=e.substring(t,o),l=13}return s+=String.fromCharCode(i),o++,l=16;case 45:if(s+=String.fromCharCode(i),o++,o===a||!jsonc_parser_r(e.charCodeAt(o)))return l=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return s+=_(),l=11;default:for(;o<a&&b(i);)o++,i=e.charCodeAt(o);if(c!==o){switch(s=e.substring(c,o),s){case`true`:return l=8;case`false`:return l=9;case`null`:return l=7}return l=16}return s+=String.fromCharCode(i),o++,l=16}}function b(e){if(jsonc_parser_t(e)||jsonc_parser_n(e))return!1;switch(e){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function x(){let e;do e=y();while(e>=12&&e<=15);return e}return{setPosition:g,getPosition:()=>o,scan:i?x:y,getToken:()=>l,getTokenValue:()=>s,getTokenOffset:()=>c,getTokenLength:()=>o-c,getTokenStartLine:()=>d,getTokenStartCharacter:()=>c-p,getTokenError:()=>m}}function jsonc_parser_t(e){return e===32||e===9}function jsonc_parser_n(e){return e===10||e===13}function jsonc_parser_r(e){return e>=48&&e<=57}var jsonc_parser_i;(function(e){e[e.lineFeed=10]=`lineFeed`,e[e.carriageReturn=13]=`carriageReturn`,e[e.space=32]=`space`,e[e._0=48]=`_0`,e[e._1=49]=`_1`,e[e._2=50]=`_2`,e[e._3=51]=`_3`,e[e._4=52]=`_4`,e[e._5=53]=`_5`,e[e._6=54]=`_6`,e[e._7=55]=`_7`,e[e._8=56]=`_8`,e[e._9=57]=`_9`,e[e.a=97]=`a`,e[e.b=98]=`b`,e[e.c=99]=`c`,e[e.d=100]=`d`,e[e.e=101]=`e`,e[e.f=102]=`f`,e[e.g=103]=`g`,e[e.h=104]=`h`,e[e.i=105]=`i`,e[e.j=106]=`j`,e[e.k=107]=`k`,e[e.l=108]=`l`,e[e.m=109]=`m`,e[e.n=110]=`n`,e[e.o=111]=`o`,e[e.p=112]=`p`,e[e.q=113]=`q`,e[e.r=114]=`r`,e[e.s=115]=`s`,e[e.t=116]=`t`,e[e.u=117]=`u`,e[e.v=118]=`v`,e[e.w=119]=`w`,e[e.x=120]=`x`,e[e.y=121]=`y`,e[e.z=122]=`z`,e[e.A=65]=`A`,e[e.B=66]=`B`,e[e.C=67]=`C`,e[e.D=68]=`D`,e[e.E=69]=`E`,e[e.F=70]=`F`,e[e.G=71]=`G`,e[e.H=72]=`H`,e[e.I=73]=`I`,e[e.J=74]=`J`,e[e.K=75]=`K`,e[e.L=76]=`L`,e[e.M=77]=`M`,e[e.N=78]=`N`,e[e.O=79]=`O`,e[e.P=80]=`P`,e[e.Q=81]=`Q`,e[e.R=82]=`R`,e[e.S=83]=`S`,e[e.T=84]=`T`,e[e.U=85]=`U`,e[e.V=86]=`V`,e[e.W=87]=`W`,e[e.X=88]=`X`,e[e.Y=89]=`Y`,e[e.Z=90]=`Z`,e[e.asterisk=42]=`asterisk`,e[e.backslash=92]=`backslash`,e[e.closeBrace=125]=`closeBrace`,e[e.closeBracket=93]=`closeBracket`,e[e.colon=58]=`colon`,e[e.comma=44]=`comma`,e[e.dot=46]=`dot`,e[e.doubleQuote=34]=`doubleQuote`,e[e.minus=45]=`minus`,e[e.openBrace=123]=`openBrace`,e[e.openBracket=91]=`openBracket`,e[e.plus=43]=`plus`,e[e.slash=47]=`slash`,e[e.formFeed=12]=`formFeed`,e[e.tab=9]=`tab`})(jsonc_parser_i||={}),Array(20).fill(0).map((e,t)=>` `.repeat(t)),Array(200).fill(0).map((e,t)=>`
101455
- `+` `.repeat(t)),Array(200).fill(0).map((e,t)=>`\r`+` `.repeat(t)),Array(200).fill(0).map((e,t)=>`\r
101456
- `+` `.repeat(t)),Array(200).fill(0).map((e,t)=>`
101457
- `+` `.repeat(t)),Array(200).fill(0).map((e,t)=>`\r`+` `.repeat(t)),Array(200).fill(0).map((e,t)=>`\r
101458
- `+` `.repeat(t));var jsonc_parser_a;(function(e){e.DEFAULT={allowTrailingComma:!1}})(jsonc_parser_a||={});function jsonc_parser_o(e,t=[],n=jsonc_parser_a.DEFAULT){let r=null,i=[],o=[];function s(e){Array.isArray(i)?i.push(e):r!==null&&(i[r]=e)}return jsonc_parser_d(e,{onObjectBegin:()=>{let e={};s(e),o.push(i),i=e,r=null},onObjectProperty:e=>{r=e},onObjectEnd:()=>{i=o.pop()},onArrayBegin:()=>{let e=[];s(e),o.push(i),i=e,r=null},onArrayEnd:()=>{i=o.pop()},onLiteralValue:s,onError:(e,n,r)=>{t.push({error:e,offset:n,length:r})}},n),i[0]}function jsonc_parser_s(e){if(!e.parent||!e.parent.children)return[];let t=jsonc_parser_s(e.parent);if(e.parent.type===`property`){let n=e.parent.children[0].value;t.push(n)}else if(e.parent.type===`array`){let n=e.parent.children.indexOf(e);n!==-1&&t.push(n)}return t}function jsonc_parser_c(e){switch(e.type){case`array`:return e.children.map(jsonc_parser_c);case`object`:let t=Object.create(null);for(let n of e.children){let e=n.children[1];e&&(t[n.children[0].value]=jsonc_parser_c(e))}return t;case`null`:case`string`:case`number`:case`boolean`:return e.value;default:return}}function jsonc_parser_l(e,t,n=!1){return t>=e.offset&&t<e.offset+e.length||n&&t===e.offset+e.length}function jsonc_parser_u(e,t,n=!1){if(jsonc_parser_l(e,t,n)){let r=e.children;if(Array.isArray(r))for(let e=0;e<r.length&&r[e].offset<=t;e++){let i=jsonc_parser_u(r[e],t,n);if(i)return i}return e}}function jsonc_parser_d(t,n,r=jsonc_parser_a.DEFAULT){let i=jsonc_parser_e(t,!1),o=[],s=0;function c(e){return e?()=>s===0&&e(i.getTokenOffset(),i.getTokenLength(),i.getTokenStartLine(),i.getTokenStartCharacter()):()=>!0}function l(e){return e?t=>s===0&&e(t,i.getTokenOffset(),i.getTokenLength(),i.getTokenStartLine(),i.getTokenStartCharacter()):()=>!0}function u(e){return e?t=>s===0&&e(t,i.getTokenOffset(),i.getTokenLength(),i.getTokenStartLine(),i.getTokenStartCharacter(),()=>o.slice()):()=>!0}function d(e){return e?()=>{s>0?s++:e(i.getTokenOffset(),i.getTokenLength(),i.getTokenStartLine(),i.getTokenStartCharacter(),()=>o.slice())===!1&&(s=1)}:()=>!0}function f(e){return e?()=>{s>0&&s--,s===0&&e(i.getTokenOffset(),i.getTokenLength(),i.getTokenStartLine(),i.getTokenStartCharacter())}:()=>!0}let p=d(n.onObjectBegin),m=u(n.onObjectProperty),h=f(n.onObjectEnd),g=d(n.onArrayBegin),_=f(n.onArrayEnd),v=u(n.onLiteralValue),y=l(n.onSeparator),b=c(n.onComment),x=l(n.onError),S=r&&r.disallowComments,C=r&&r.allowTrailingComma;function w(){for(;;){let e=i.scan();switch(i.getTokenError()){case 4:T(14);break;case 5:T(15);break;case 3:T(13);break;case 1:S||T(11);break;case 2:T(12);break;case 6:T(16);break}switch(e){case 12:case 13:S?T(10):b();break;case 16:T(1);break;case 15:case 14:break;default:return e}}}function T(e,t=[],n=[]){if(x(e),t.length+n.length>0){let e=i.getToken();for(;e!==17;){if(t.indexOf(e)!==-1){w();break}else if(n.indexOf(e)!==-1)break;e=w()}}}function E(e){let t=i.getTokenValue();return e?v(t):(m(t),o.push(t)),w(),!0}function D(){switch(i.getToken()){case 11:let e=i.getTokenValue(),t=Number(e);isNaN(t)&&(T(2),t=0),v(t);break;case 7:v(null);break;case 8:v(!0);break;case 9:v(!1);break;default:return!1}return w(),!0}function O(){return i.getToken()===10?(E(!1),i.getToken()===6?(y(`:`),w(),j()||T(4,[],[2,5])):T(5,[],[2,5]),o.pop(),!0):(T(3,[],[2,5]),!1)}function k(){p(),w();let e=!1;for(;i.getToken()!==2&&i.getToken()!==17;){if(i.getToken()===5){if(e||T(4,[],[]),y(`,`),w(),i.getToken()===2&&C)break}else e&&T(6,[],[]);O()||T(4,[],[2,5]),e=!0}return h(),i.getToken()===2?w():T(7,[2],[]),!0}function A(){g(),w();let e=!0,t=!1;for(;i.getToken()!==4&&i.getToken()!==17;){if(i.getToken()===5){if(t||T(4,[],[]),y(`,`),w(),i.getToken()===4&&C)break}else t&&T(6,[],[]);e?(o.push(0),e=!1):o[o.length-1]++,j()||T(4,[],[4,5]),t=!0}return _(),e||o.pop(),i.getToken()===4?w():T(8,[4],[]),!0}function j(){switch(i.getToken()){case 3:return A();case 1:return k();case 10:return E(!0);default:return D()}}return w(),i.getToken()===17?r.allowEmptyContent?!0:(T(4,[],[]),!1):j()?(i.getToken()!==17&&T(9,[],[]),!0):(T(4,[],[]),!1)}var jsonc_parser_f;(function(e){e[e.None=0]=`None`,e[e.UnexpectedEndOfComment=1]=`UnexpectedEndOfComment`,e[e.UnexpectedEndOfString=2]=`UnexpectedEndOfString`,e[e.UnexpectedEndOfNumber=3]=`UnexpectedEndOfNumber`,e[e.InvalidUnicode=4]=`InvalidUnicode`,e[e.InvalidEscapeCharacter=5]=`InvalidEscapeCharacter`,e[e.InvalidCharacter=6]=`InvalidCharacter`})(jsonc_parser_f||={});var jsonc_parser_p;(function(e){e[e.OpenBraceToken=1]=`OpenBraceToken`,e[e.CloseBraceToken=2]=`CloseBraceToken`,e[e.OpenBracketToken=3]=`OpenBracketToken`,e[e.CloseBracketToken=4]=`CloseBracketToken`,e[e.CommaToken=5]=`CommaToken`,e[e.ColonToken=6]=`ColonToken`,e[e.NullKeyword=7]=`NullKeyword`,e[e.TrueKeyword=8]=`TrueKeyword`,e[e.FalseKeyword=9]=`FalseKeyword`,e[e.StringLiteral=10]=`StringLiteral`,e[e.NumericLiteral=11]=`NumericLiteral`,e[e.LineCommentTrivia=12]=`LineCommentTrivia`,e[e.BlockCommentTrivia=13]=`BlockCommentTrivia`,e[e.LineBreakTrivia=14]=`LineBreakTrivia`,e[e.Trivia=15]=`Trivia`,e[e.Unknown=16]=`Unknown`,e[e.EOF=17]=`EOF`})(jsonc_parser_p||={});const jsonc_parser_m=jsonc_parser_o;var jsonc_parser_h;(function(e){e[e.InvalidSymbol=1]=`InvalidSymbol`,e[e.InvalidNumberFormat=2]=`InvalidNumberFormat`,e[e.PropertyNameExpected=3]=`PropertyNameExpected`,e[e.ValueExpected=4]=`ValueExpected`,e[e.ColonExpected=5]=`ColonExpected`,e[e.CommaExpected=6]=`CommaExpected`,e[e.CloseBraceExpected=7]=`CloseBraceExpected`,e[e.CloseBracketExpected=8]=`CloseBracketExpected`,e[e.EndOfFileExpected=9]=`EndOfFileExpected`,e[e.InvalidCommentToken=10]=`InvalidCommentToken`,e[e.UnexpectedEndOfComment=11]=`UnexpectedEndOfComment`,e[e.UnexpectedEndOfString=12]=`UnexpectedEndOfString`,e[e.UnexpectedEndOfNumber=13]=`UnexpectedEndOfNumber`,e[e.InvalidUnicode=14]=`InvalidUnicode`,e[e.InvalidEscapeCharacter=15]=`InvalidEscapeCharacter`,e[e.InvalidCharacter=16]=`InvalidCharacter`})(jsonc_parser_h||={});
101459
- ;// CONCATENATED MODULE: ../../node_modules/confbox/dist/jsonc.mjs
101460
- function jsonc_r(n,r){let i=jsonc_parser_m(n,r?.errors,r);return (0,_format.n)(n,i,r),i}function jsonc_i(e,t){return n(e,t)}
101858
+ ;// CONCATENATED MODULE: ../../node_modules/pkg-types/node_modules/confbox/dist/_chunks/libs/detect-indent.mjs
101859
+ const detect_indent_e=/^(?:( )+|\t+)/,detect_indent_t=`space`;function detect_indent_n(e,n,r){return e&&n===detect_indent_t&&r===1}function detect_indent_r(r,a){let o=new Map,s=0,c,l;for(let u of r.split(/\n/g)){if(!u)continue;let r=u.match(detect_indent_e);if(r===null)s=0,c=``;else{let e=r[0].length,u=r[1]?detect_indent_t:`tab`;if(detect_indent_n(a,u,e))continue;u!==c&&(s=0),c=u;let d=1,f=0,p=e-s;if(s=e,p===0)d=0,f=1;else{let e=Math.abs(p);if(detect_indent_n(a,u,e))continue;l=detect_indent_i(u,e)}let m=o.get(l);o.set(l,m===void 0?[1,0]:[m[0]+d,m[1]+f])}}return o}function detect_indent_i(e,n){return(e===detect_indent_t?`s`:`t`)+String(n)}function detect_indent_a(e){return{type:e[0]===`s`?detect_indent_t:`tab`,amount:Number(e.slice(1))}}function detect_indent_o(e){let t,n=0,r=0;for(let[i,[a,o]]of e)(a>n||a===n&&o>r)&&(n=a,r=o,t=i);return t}function detect_indent_s(e,n){return(e===detect_indent_t?` `:` `).repeat(n)}function detect_indent_c(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);let t=detect_indent_r(e,!0);t.size===0&&(t=detect_indent_r(e,!1));let n=detect_indent_o(t),i,c=0,l=``;return n!==void 0&&({type:i,amount:c}=detect_indent_a(n),l=detect_indent_s(i,c)),{amount:c,type:i,indent:l}}
101860
+ ;// CONCATENATED MODULE: ../../node_modules/pkg-types/node_modules/confbox/dist/_chunks/_format.mjs
101861
+ const _format_t=Symbol.for(`__confbox_fmt__`),_format_n=/^(\s+)/,_format_r=/(\s+)$/;function _format_i(e){return e.charCodeAt(0)===65279?e.slice(1):e}function _format_a(e,t={}){return{sample:t.indent===void 0&&t.preserveIndentation!==!1&&_format_i(e).slice(0,t?.sampleSize||1024),whiteSpace:t.preserveWhitespace===!1?void 0:{start:_format_n.exec(e)?.[0]||``,end:_format_r.exec(e)?.[0]||``}}}function _format_o(e,n,r){!n||typeof n!=`object`||Object.defineProperty(n,_format_t,{enumerable:!1,configurable:!0,writable:!0,value:_format_a(e,r)})}function _format_s(n,r){if(!n||typeof n!=`object`||!(_format_t in n))return{indent:r?.indent??2,whitespace:{start:``,end:``}};let i=n[_format_t];return{indent:r?.indent||detect_indent_c(i.sample||``).indent,whitespace:i.whiteSpace||{start:``,end:``}}}
101461
101862
 
101462
101863
  },
101463
101864
 
@@ -101644,4 +102045,4 @@ if (installedChunkData !== 0) { // 0 means "already installed".'
101644
102045
  // module factories are used so entry inlining is disabled
101645
102046
  // startup
101646
102047
  // Load entry module and return exports
101647
- var __webpack_exports__ = __webpack_require__(889);
102048
+ var __webpack_exports__ = __webpack_require__(2953);