@tempad-dev/mcp 0.3.10 → 0.3.11

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/hub.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as SOCK_PATH, c as log, i as RUNTIME_DIR, o as ensureDir, r as PACKAGE_VERSION, s as ensureFile, t as ASSET_DIR } from "./shared-eU-gSEEq.mjs";
1
+ import { a as SOCK_PATH, c as log, i as RUNTIME_DIR, o as ensureDir, r as PACKAGE_VERSION, s as ensureFile, t as ASSET_DIR } from "./shared-H4sL6Ltt.mjs";
2
2
  import { createServer } from "node:net";
3
3
  import { join } from "node:path";
4
4
  import { URL as URL$1 } from "node:url";
@@ -11,7 +11,7 @@ import { createHash } from "node:crypto";
11
11
  import { createServer as createServer$1 } from "node:http";
12
12
  import { Transform, pipeline } from "node:stream";
13
13
 
14
- //#region ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/core/core.js
14
+ //#region ../../node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/core.js
15
15
  /** A special constant with type `never` */
16
16
  const NEVER = Object.freeze({ status: "aborted" });
17
17
  function $constructor(name, initializer$2, params) {
@@ -71,7 +71,7 @@ function config(newConfig) {
71
71
  }
72
72
 
73
73
  //#endregion
74
- //#region ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/core/util.js
74
+ //#region ../../node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/util.js
75
75
  function getEnumValues(entries) {
76
76
  const numericValues = Object.values(entries).filter((v) => typeof v === "number");
77
77
  return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
@@ -219,6 +219,8 @@ const NUMBER_FORMAT_RANGES = {
219
219
  };
220
220
  function pick(schema, mask) {
221
221
  const currDef = schema._zod.def;
222
+ const checks = currDef.checks;
223
+ if (checks && checks.length > 0) throw new Error(".pick() cannot be used on object schemas containing refinements");
222
224
  return clone(schema, mergeDefs(schema._zod.def, {
223
225
  get shape() {
224
226
  const newShape = {};
@@ -235,6 +237,8 @@ function pick(schema, mask) {
235
237
  }
236
238
  function omit(schema, mask) {
237
239
  const currDef = schema._zod.def;
240
+ const checks = currDef.checks;
241
+ if (checks && checks.length > 0) throw new Error(".omit() cannot be used on object schemas containing refinements");
238
242
  return clone(schema, mergeDefs(schema._zod.def, {
239
243
  get shape() {
240
244
  const newShape = { ...schema._zod.def.shape };
@@ -252,33 +256,29 @@ function omit(schema, mask) {
252
256
  function extend(schema, shape) {
253
257
  if (!isPlainObject(shape)) throw new Error("Invalid input to extend: expected a plain object");
254
258
  const checks = schema._zod.def.checks;
255
- if (checks && checks.length > 0) throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");
256
- return clone(schema, mergeDefs(schema._zod.def, {
257
- get shape() {
258
- const _shape = {
259
- ...schema._zod.def.shape,
260
- ...shape
261
- };
262
- assignProp(this, "shape", _shape);
263
- return _shape;
264
- },
265
- checks: []
266
- }));
259
+ if (checks && checks.length > 0) {
260
+ const existingShape = schema._zod.def.shape;
261
+ for (const key in shape) if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
262
+ }
263
+ return clone(schema, mergeDefs(schema._zod.def, { get shape() {
264
+ const _shape = {
265
+ ...schema._zod.def.shape,
266
+ ...shape
267
+ };
268
+ assignProp(this, "shape", _shape);
269
+ return _shape;
270
+ } }));
267
271
  }
268
272
  function safeExtend(schema, shape) {
269
273
  if (!isPlainObject(shape)) throw new Error("Invalid input to safeExtend: expected a plain object");
270
- return clone(schema, {
271
- ...schema._zod.def,
272
- get shape() {
273
- const _shape = {
274
- ...schema._zod.def.shape,
275
- ...shape
276
- };
277
- assignProp(this, "shape", _shape);
278
- return _shape;
279
- },
280
- checks: schema._zod.def.checks
281
- });
274
+ return clone(schema, mergeDefs(schema._zod.def, { get shape() {
275
+ const _shape = {
276
+ ...schema._zod.def.shape,
277
+ ...shape
278
+ };
279
+ assignProp(this, "shape", _shape);
280
+ return _shape;
281
+ } }));
282
282
  }
283
283
  function merge(a, b) {
284
284
  return clone(a, mergeDefs(a._zod.def, {
@@ -297,6 +297,8 @@ function merge(a, b) {
297
297
  }));
298
298
  }
299
299
  function partial(Class, schema, mask) {
300
+ const checks = schema._zod.def.checks;
301
+ if (checks && checks.length > 0) throw new Error(".partial() cannot be used on object schemas containing refinements");
300
302
  return clone(schema, mergeDefs(schema._zod.def, {
301
303
  get shape() {
302
304
  const oldShape = schema._zod.def.shape;
@@ -320,27 +322,24 @@ function partial(Class, schema, mask) {
320
322
  }));
321
323
  }
322
324
  function required(Class, schema, mask) {
323
- return clone(schema, mergeDefs(schema._zod.def, {
324
- get shape() {
325
- const oldShape = schema._zod.def.shape;
326
- const shape = { ...oldShape };
327
- if (mask) for (const key in mask) {
328
- if (!(key in shape)) throw new Error(`Unrecognized key: "${key}"`);
329
- if (!mask[key]) continue;
330
- shape[key] = new Class({
331
- type: "nonoptional",
332
- innerType: oldShape[key]
333
- });
334
- }
335
- else for (const key in oldShape) shape[key] = new Class({
325
+ return clone(schema, mergeDefs(schema._zod.def, { get shape() {
326
+ const oldShape = schema._zod.def.shape;
327
+ const shape = { ...oldShape };
328
+ if (mask) for (const key in mask) {
329
+ if (!(key in shape)) throw new Error(`Unrecognized key: "${key}"`);
330
+ if (!mask[key]) continue;
331
+ shape[key] = new Class({
336
332
  type: "nonoptional",
337
333
  innerType: oldShape[key]
338
334
  });
339
- assignProp(this, "shape", shape);
340
- return shape;
341
- },
342
- checks: []
343
- }));
335
+ }
336
+ else for (const key in oldShape) shape[key] = new Class({
337
+ type: "nonoptional",
338
+ innerType: oldShape[key]
339
+ });
340
+ assignProp(this, "shape", shape);
341
+ return shape;
342
+ } }));
344
343
  }
345
344
  function aborted(x, startIndex = 0) {
346
345
  if (x.aborted === true) return true;
@@ -386,7 +385,7 @@ function issue(...args) {
386
385
  }
387
386
 
388
387
  //#endregion
389
- //#region ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/core/errors.js
388
+ //#region ../../node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/errors.js
390
389
  const initializer$1 = (inst, def) => {
391
390
  inst.name = "$ZodError";
392
391
  Object.defineProperty(inst, "_zod", {
@@ -444,7 +443,7 @@ function formatError(error, mapper = (issue$1) => issue$1.message) {
444
443
  }
445
444
 
446
445
  //#endregion
447
- //#region ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/core/parse.js
446
+ //#region ../../node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/parse.js
448
447
  const _parse = (_Err) => (schema, value, _ctx, _params) => {
449
448
  const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
450
449
  const result = schema._zod.run({
@@ -548,7 +547,7 @@ const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
548
547
  const safeDecodeAsync$1 = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
549
548
 
550
549
  //#endregion
551
- //#region ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/core/regexes.js
550
+ //#region ../../node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/regexes.js
552
551
  const cuid = /^[cC][^\s-]{8,}$/;
553
552
  const cuid2 = /^[0-9a-z]+$/;
554
553
  const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
@@ -578,7 +577,7 @@ const cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-
578
577
  const cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
579
578
  const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
580
579
  const base64url = /^[A-Za-z0-9_-]*$/;
581
- const e164 = /^\+(?:[0-9]){6,14}[0-9]$/;
580
+ const e164 = /^\+[1-9]\d{6,14}$/;
582
581
  const dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
583
582
  const date$1 = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
584
583
  function timeSource(args) {
@@ -601,13 +600,13 @@ const string$1 = (params) => {
601
600
  return /* @__PURE__ */ new RegExp(`^${regex}$`);
602
601
  };
603
602
  const integer = /^-?\d+$/;
604
- const number$1 = /^-?\d+(?:\.\d+)?/;
603
+ const number$1 = /^-?\d+(?:\.\d+)?$/;
605
604
  const boolean$1 = /^(?:true|false)$/i;
606
605
  const lowercase = /^[^A-Z]*$/;
607
606
  const uppercase = /^[^a-z]*$/;
608
607
 
609
608
  //#endregion
610
- //#region ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/core/checks.js
609
+ //#region ../../node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/checks.js
611
610
  const $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
612
611
  var _a$1;
613
612
  inst._zod ?? (inst._zod = {});
@@ -633,7 +632,7 @@ const $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (ins
633
632
  payload.issues.push({
634
633
  origin,
635
634
  code: "too_big",
636
- maximum: def.value,
635
+ maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
637
636
  input: payload.value,
638
637
  inclusive: def.inclusive,
639
638
  inst,
@@ -655,7 +654,7 @@ const $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan"
655
654
  payload.issues.push({
656
655
  origin,
657
656
  code: "too_small",
658
- minimum: def.value,
657
+ minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
659
658
  input: payload.value,
660
659
  inclusive: def.inclusive,
661
660
  inst,
@@ -717,6 +716,7 @@ const $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberForma
717
716
  note: "Integers must be within the safe integer range.",
718
717
  inst,
719
718
  origin,
719
+ inclusive: true,
720
720
  continue: !def.abort
721
721
  });
722
722
  else payload.issues.push({
@@ -726,6 +726,7 @@ const $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberForma
726
726
  note: "Integers must be within the safe integer range.",
727
727
  inst,
728
728
  origin,
729
+ inclusive: true,
729
730
  continue: !def.abort
730
731
  });
731
732
  return;
@@ -745,7 +746,9 @@ const $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberForma
745
746
  input,
746
747
  code: "too_big",
747
748
  maximum,
748
- inst
749
+ inclusive: true,
750
+ inst,
751
+ continue: !def.abort
749
752
  });
750
753
  };
751
754
  });
@@ -962,7 +965,7 @@ const $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (i
962
965
  });
963
966
 
964
967
  //#endregion
965
- //#region ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/core/doc.js
968
+ //#region ../../node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/doc.js
966
969
  var Doc = class {
967
970
  constructor(args = []) {
968
971
  this.content = [];
@@ -994,15 +997,15 @@ var Doc = class {
994
997
  };
995
998
 
996
999
  //#endregion
997
- //#region ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/core/versions.js
1000
+ //#region ../../node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/versions.js
998
1001
  const version = {
999
1002
  major: 4,
1000
- minor: 1,
1001
- patch: 13
1003
+ minor: 3,
1004
+ patch: 5
1002
1005
  };
1003
1006
 
1004
1007
  //#endregion
1005
- //#region ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/core/schemas.js
1008
+ //#region ../../node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/schemas.js
1006
1009
  const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
1007
1010
  var _a$1;
1008
1011
  inst ?? (inst = {});
@@ -1078,7 +1081,7 @@ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
1078
1081
  return runChecks(result, checks, ctx);
1079
1082
  };
1080
1083
  }
1081
- inst["~standard"] = {
1084
+ defineLazy(inst, "~standard", () => ({
1082
1085
  validate: (value) => {
1083
1086
  try {
1084
1087
  const r = safeParse$1(inst, value);
@@ -1089,7 +1092,7 @@ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
1089
1092
  },
1090
1093
  vendor: "zod",
1091
1094
  version: 1
1092
- };
1095
+ }));
1093
1096
  });
1094
1097
  const $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
1095
1098
  $ZodType.init(inst, def);
@@ -1443,8 +1446,11 @@ const $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
1443
1446
  return payload;
1444
1447
  };
1445
1448
  });
1446
- function handlePropertyResult(result, final, key, input) {
1447
- if (result.issues.length) final.issues.push(...prefixIssues(key, result.issues));
1449
+ function handlePropertyResult(result, final, key, input, isOptionalOut) {
1450
+ if (result.issues.length) {
1451
+ if (isOptionalOut && !(key in input)) return;
1452
+ final.issues.push(...prefixIssues(key, result.issues));
1453
+ }
1448
1454
  if (result.value === void 0) {
1449
1455
  if (key in input) final.value[key] = void 0;
1450
1456
  } else final.value[key] = result.value;
@@ -1466,6 +1472,7 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
1466
1472
  const keySet = def.keySet;
1467
1473
  const _catchall = def.catchall._zod;
1468
1474
  const t = _catchall.def.type;
1475
+ const isOptionalOut = _catchall.optout === "optional";
1469
1476
  for (const key in input) {
1470
1477
  if (keySet.has(key)) continue;
1471
1478
  if (t === "never") {
@@ -1476,8 +1483,8 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
1476
1483
  value: input[key],
1477
1484
  issues: []
1478
1485
  }, ctx);
1479
- if (r instanceof Promise) proms.push(r.then((r$1) => handlePropertyResult(r$1, payload, key, input)));
1480
- else handlePropertyResult(r, payload, key, input);
1486
+ if (r instanceof Promise) proms.push(r.then((r$1) => handlePropertyResult(r$1, payload, key, input, isOptionalOut)));
1487
+ else handlePropertyResult(r, payload, key, input, isOptionalOut);
1481
1488
  }
1482
1489
  if (unrecognized.length) payload.issues.push({
1483
1490
  code: "unrecognized_keys",
@@ -1532,12 +1539,14 @@ const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
1532
1539
  const proms = [];
1533
1540
  const shape = value.shape;
1534
1541
  for (const key of value.keys) {
1535
- const r = shape[key]._zod.run({
1542
+ const el = shape[key];
1543
+ const isOptionalOut = el._zod.optout === "optional";
1544
+ const r = el._zod.run({
1536
1545
  value: input[key],
1537
1546
  issues: []
1538
1547
  }, ctx);
1539
- if (r instanceof Promise) proms.push(r.then((r$1) => handlePropertyResult(r$1, payload, key, input)));
1540
- else handlePropertyResult(r, payload, key, input);
1548
+ if (r instanceof Promise) proms.push(r.then((r$1) => handlePropertyResult(r$1, payload, key, input, isOptionalOut)));
1549
+ else handlePropertyResult(r, payload, key, input, isOptionalOut);
1541
1550
  }
1542
1551
  if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
1543
1552
  return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
@@ -1566,8 +1575,28 @@ const $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def)
1566
1575
  for (const key of normalized.keys) {
1567
1576
  const id = ids[key];
1568
1577
  const k = esc(key);
1578
+ const isOptionalOut = shape[key]?._zod?.optout === "optional";
1569
1579
  doc.write(`const ${id} = ${parseStr(key)};`);
1570
- doc.write(`
1580
+ if (isOptionalOut) doc.write(`
1581
+ if (${id}.issues.length) {
1582
+ if (${k} in input) {
1583
+ payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1584
+ ...iss,
1585
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
1586
+ })));
1587
+ }
1588
+ }
1589
+
1590
+ if (${id}.value === undefined) {
1591
+ if (${k} in input) {
1592
+ newResult[${k}] = undefined;
1593
+ }
1594
+ } else {
1595
+ newResult[${k}] = ${id}.value;
1596
+ }
1597
+
1598
+ `);
1599
+ else doc.write(`
1571
1600
  if (${id}.issues.length) {
1572
1601
  payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1573
1602
  ...iss,
@@ -1575,7 +1604,6 @@ const $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def)
1575
1604
  })));
1576
1605
  }
1577
1606
 
1578
-
1579
1607
  if (${id}.value === undefined) {
1580
1608
  if (${k} in input) {
1581
1609
  newResult[${k}] = undefined;
@@ -1676,6 +1704,7 @@ const $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
1676
1704
  };
1677
1705
  });
1678
1706
  const $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
1707
+ def.inclusive = false;
1679
1708
  $ZodUnion.init(inst, def);
1680
1709
  const _super = inst._zod.parse;
1681
1710
  defineLazy(inst._zod, "propValues", () => {
@@ -1803,8 +1832,25 @@ function mergeValues(a, b) {
1803
1832
  };
1804
1833
  }
1805
1834
  function handleIntersectionResults(result, left, right) {
1806
- if (left.issues.length) result.issues.push(...left.issues);
1807
- if (right.issues.length) result.issues.push(...right.issues);
1835
+ const unrecKeys = /* @__PURE__ */ new Map();
1836
+ let unrecIssue;
1837
+ for (const iss of left.issues) if (iss.code === "unrecognized_keys") {
1838
+ unrecIssue ?? (unrecIssue = iss);
1839
+ for (const k of iss.keys) {
1840
+ if (!unrecKeys.has(k)) unrecKeys.set(k, {});
1841
+ unrecKeys.get(k).l = true;
1842
+ }
1843
+ } else result.issues.push(iss);
1844
+ for (const iss of right.issues) if (iss.code === "unrecognized_keys") for (const k of iss.keys) {
1845
+ if (!unrecKeys.has(k)) unrecKeys.set(k, {});
1846
+ unrecKeys.get(k).r = true;
1847
+ }
1848
+ else result.issues.push(iss);
1849
+ const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
1850
+ if (bothKeys.length && unrecIssue) result.issues.push({
1851
+ ...unrecIssue,
1852
+ keys: bothKeys
1853
+ });
1808
1854
  if (aborted(result)) return result;
1809
1855
  const merged = mergeValues(left.value, right.value);
1810
1856
  if (!merged.valid) throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
@@ -1889,6 +1935,14 @@ const $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) =>
1889
1935
  return def.innerType._zod.run(payload, ctx);
1890
1936
  };
1891
1937
  });
1938
+ const $ZodExactOptional = /* @__PURE__ */ $constructor("$ZodExactOptional", (inst, def) => {
1939
+ $ZodOptional.init(inst, def);
1940
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1941
+ defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
1942
+ inst._zod.parse = (payload, ctx) => {
1943
+ return def.innerType._zod.run(payload, ctx);
1944
+ };
1945
+ });
1892
1946
  const $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
1893
1947
  $ZodType.init(inst, def);
1894
1948
  defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
@@ -2062,7 +2116,7 @@ function handleRefineResult(result, payload, input, inst) {
2062
2116
  }
2063
2117
 
2064
2118
  //#endregion
2065
- //#region ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/core/registries.js
2119
+ //#region ../../node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/registries.js
2066
2120
  var _a;
2067
2121
  var $ZodRegistry = class {
2068
2122
  constructor() {
@@ -2072,10 +2126,7 @@ var $ZodRegistry = class {
2072
2126
  add(schema, ..._meta) {
2073
2127
  const meta$2 = _meta[0];
2074
2128
  this._map.set(schema, meta$2);
2075
- if (meta$2 && typeof meta$2 === "object" && "id" in meta$2) {
2076
- if (this._idmap.has(meta$2.id)) throw new Error(`ID ${meta$2.id} already exists in the registry`);
2077
- this._idmap.set(meta$2.id, schema);
2078
- }
2129
+ if (meta$2 && typeof meta$2 === "object" && "id" in meta$2) this._idmap.set(meta$2.id, schema);
2079
2130
  return this;
2080
2131
  }
2081
2132
  clear() {
@@ -2113,13 +2164,15 @@ function registry() {
2113
2164
  const globalRegistry = globalThis.__zod_globalRegistry;
2114
2165
 
2115
2166
  //#endregion
2116
- //#region ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/core/api.js
2167
+ //#region ../../node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/api.js
2168
+ /* @__NO_SIDE_EFFECTS__ */
2117
2169
  function _string(Class, params) {
2118
2170
  return new Class({
2119
2171
  type: "string",
2120
2172
  ...normalizeParams(params)
2121
2173
  });
2122
2174
  }
2175
+ /* @__NO_SIDE_EFFECTS__ */
2123
2176
  function _email(Class, params) {
2124
2177
  return new Class({
2125
2178
  type: "string",
@@ -2129,6 +2182,7 @@ function _email(Class, params) {
2129
2182
  ...normalizeParams(params)
2130
2183
  });
2131
2184
  }
2185
+ /* @__NO_SIDE_EFFECTS__ */
2132
2186
  function _guid(Class, params) {
2133
2187
  return new Class({
2134
2188
  type: "string",
@@ -2138,6 +2192,7 @@ function _guid(Class, params) {
2138
2192
  ...normalizeParams(params)
2139
2193
  });
2140
2194
  }
2195
+ /* @__NO_SIDE_EFFECTS__ */
2141
2196
  function _uuid(Class, params) {
2142
2197
  return new Class({
2143
2198
  type: "string",
@@ -2147,6 +2202,7 @@ function _uuid(Class, params) {
2147
2202
  ...normalizeParams(params)
2148
2203
  });
2149
2204
  }
2205
+ /* @__NO_SIDE_EFFECTS__ */
2150
2206
  function _uuidv4(Class, params) {
2151
2207
  return new Class({
2152
2208
  type: "string",
@@ -2157,6 +2213,7 @@ function _uuidv4(Class, params) {
2157
2213
  ...normalizeParams(params)
2158
2214
  });
2159
2215
  }
2216
+ /* @__NO_SIDE_EFFECTS__ */
2160
2217
  function _uuidv6(Class, params) {
2161
2218
  return new Class({
2162
2219
  type: "string",
@@ -2167,6 +2224,7 @@ function _uuidv6(Class, params) {
2167
2224
  ...normalizeParams(params)
2168
2225
  });
2169
2226
  }
2227
+ /* @__NO_SIDE_EFFECTS__ */
2170
2228
  function _uuidv7(Class, params) {
2171
2229
  return new Class({
2172
2230
  type: "string",
@@ -2177,6 +2235,7 @@ function _uuidv7(Class, params) {
2177
2235
  ...normalizeParams(params)
2178
2236
  });
2179
2237
  }
2238
+ /* @__NO_SIDE_EFFECTS__ */
2180
2239
  function _url(Class, params) {
2181
2240
  return new Class({
2182
2241
  type: "string",
@@ -2186,6 +2245,7 @@ function _url(Class, params) {
2186
2245
  ...normalizeParams(params)
2187
2246
  });
2188
2247
  }
2248
+ /* @__NO_SIDE_EFFECTS__ */
2189
2249
  function _emoji(Class, params) {
2190
2250
  return new Class({
2191
2251
  type: "string",
@@ -2195,6 +2255,7 @@ function _emoji(Class, params) {
2195
2255
  ...normalizeParams(params)
2196
2256
  });
2197
2257
  }
2258
+ /* @__NO_SIDE_EFFECTS__ */
2198
2259
  function _nanoid(Class, params) {
2199
2260
  return new Class({
2200
2261
  type: "string",
@@ -2204,6 +2265,7 @@ function _nanoid(Class, params) {
2204
2265
  ...normalizeParams(params)
2205
2266
  });
2206
2267
  }
2268
+ /* @__NO_SIDE_EFFECTS__ */
2207
2269
  function _cuid(Class, params) {
2208
2270
  return new Class({
2209
2271
  type: "string",
@@ -2213,6 +2275,7 @@ function _cuid(Class, params) {
2213
2275
  ...normalizeParams(params)
2214
2276
  });
2215
2277
  }
2278
+ /* @__NO_SIDE_EFFECTS__ */
2216
2279
  function _cuid2(Class, params) {
2217
2280
  return new Class({
2218
2281
  type: "string",
@@ -2222,6 +2285,7 @@ function _cuid2(Class, params) {
2222
2285
  ...normalizeParams(params)
2223
2286
  });
2224
2287
  }
2288
+ /* @__NO_SIDE_EFFECTS__ */
2225
2289
  function _ulid(Class, params) {
2226
2290
  return new Class({
2227
2291
  type: "string",
@@ -2231,6 +2295,7 @@ function _ulid(Class, params) {
2231
2295
  ...normalizeParams(params)
2232
2296
  });
2233
2297
  }
2298
+ /* @__NO_SIDE_EFFECTS__ */
2234
2299
  function _xid(Class, params) {
2235
2300
  return new Class({
2236
2301
  type: "string",
@@ -2240,6 +2305,7 @@ function _xid(Class, params) {
2240
2305
  ...normalizeParams(params)
2241
2306
  });
2242
2307
  }
2308
+ /* @__NO_SIDE_EFFECTS__ */
2243
2309
  function _ksuid(Class, params) {
2244
2310
  return new Class({
2245
2311
  type: "string",
@@ -2249,6 +2315,7 @@ function _ksuid(Class, params) {
2249
2315
  ...normalizeParams(params)
2250
2316
  });
2251
2317
  }
2318
+ /* @__NO_SIDE_EFFECTS__ */
2252
2319
  function _ipv4(Class, params) {
2253
2320
  return new Class({
2254
2321
  type: "string",
@@ -2258,6 +2325,7 @@ function _ipv4(Class, params) {
2258
2325
  ...normalizeParams(params)
2259
2326
  });
2260
2327
  }
2328
+ /* @__NO_SIDE_EFFECTS__ */
2261
2329
  function _ipv6(Class, params) {
2262
2330
  return new Class({
2263
2331
  type: "string",
@@ -2267,6 +2335,7 @@ function _ipv6(Class, params) {
2267
2335
  ...normalizeParams(params)
2268
2336
  });
2269
2337
  }
2338
+ /* @__NO_SIDE_EFFECTS__ */
2270
2339
  function _cidrv4(Class, params) {
2271
2340
  return new Class({
2272
2341
  type: "string",
@@ -2276,6 +2345,7 @@ function _cidrv4(Class, params) {
2276
2345
  ...normalizeParams(params)
2277
2346
  });
2278
2347
  }
2348
+ /* @__NO_SIDE_EFFECTS__ */
2279
2349
  function _cidrv6(Class, params) {
2280
2350
  return new Class({
2281
2351
  type: "string",
@@ -2285,6 +2355,7 @@ function _cidrv6(Class, params) {
2285
2355
  ...normalizeParams(params)
2286
2356
  });
2287
2357
  }
2358
+ /* @__NO_SIDE_EFFECTS__ */
2288
2359
  function _base64(Class, params) {
2289
2360
  return new Class({
2290
2361
  type: "string",
@@ -2294,6 +2365,7 @@ function _base64(Class, params) {
2294
2365
  ...normalizeParams(params)
2295
2366
  });
2296
2367
  }
2368
+ /* @__NO_SIDE_EFFECTS__ */
2297
2369
  function _base64url(Class, params) {
2298
2370
  return new Class({
2299
2371
  type: "string",
@@ -2303,6 +2375,7 @@ function _base64url(Class, params) {
2303
2375
  ...normalizeParams(params)
2304
2376
  });
2305
2377
  }
2378
+ /* @__NO_SIDE_EFFECTS__ */
2306
2379
  function _e164(Class, params) {
2307
2380
  return new Class({
2308
2381
  type: "string",
@@ -2312,6 +2385,7 @@ function _e164(Class, params) {
2312
2385
  ...normalizeParams(params)
2313
2386
  });
2314
2387
  }
2388
+ /* @__NO_SIDE_EFFECTS__ */
2315
2389
  function _jwt(Class, params) {
2316
2390
  return new Class({
2317
2391
  type: "string",
@@ -2321,6 +2395,7 @@ function _jwt(Class, params) {
2321
2395
  ...normalizeParams(params)
2322
2396
  });
2323
2397
  }
2398
+ /* @__NO_SIDE_EFFECTS__ */
2324
2399
  function _isoDateTime(Class, params) {
2325
2400
  return new Class({
2326
2401
  type: "string",
@@ -2332,6 +2407,7 @@ function _isoDateTime(Class, params) {
2332
2407
  ...normalizeParams(params)
2333
2408
  });
2334
2409
  }
2410
+ /* @__NO_SIDE_EFFECTS__ */
2335
2411
  function _isoDate(Class, params) {
2336
2412
  return new Class({
2337
2413
  type: "string",
@@ -2340,6 +2416,7 @@ function _isoDate(Class, params) {
2340
2416
  ...normalizeParams(params)
2341
2417
  });
2342
2418
  }
2419
+ /* @__NO_SIDE_EFFECTS__ */
2343
2420
  function _isoTime(Class, params) {
2344
2421
  return new Class({
2345
2422
  type: "string",
@@ -2349,6 +2426,7 @@ function _isoTime(Class, params) {
2349
2426
  ...normalizeParams(params)
2350
2427
  });
2351
2428
  }
2429
+ /* @__NO_SIDE_EFFECTS__ */
2352
2430
  function _isoDuration(Class, params) {
2353
2431
  return new Class({
2354
2432
  type: "string",
@@ -2357,6 +2435,7 @@ function _isoDuration(Class, params) {
2357
2435
  ...normalizeParams(params)
2358
2436
  });
2359
2437
  }
2438
+ /* @__NO_SIDE_EFFECTS__ */
2360
2439
  function _number(Class, params) {
2361
2440
  return new Class({
2362
2441
  type: "number",
@@ -2364,6 +2443,7 @@ function _number(Class, params) {
2364
2443
  ...normalizeParams(params)
2365
2444
  });
2366
2445
  }
2446
+ /* @__NO_SIDE_EFFECTS__ */
2367
2447
  function _int(Class, params) {
2368
2448
  return new Class({
2369
2449
  type: "number",
@@ -2373,21 +2453,25 @@ function _int(Class, params) {
2373
2453
  ...normalizeParams(params)
2374
2454
  });
2375
2455
  }
2456
+ /* @__NO_SIDE_EFFECTS__ */
2376
2457
  function _boolean(Class, params) {
2377
2458
  return new Class({
2378
2459
  type: "boolean",
2379
2460
  ...normalizeParams(params)
2380
2461
  });
2381
2462
  }
2463
+ /* @__NO_SIDE_EFFECTS__ */
2382
2464
  function _unknown(Class) {
2383
2465
  return new Class({ type: "unknown" });
2384
2466
  }
2467
+ /* @__NO_SIDE_EFFECTS__ */
2385
2468
  function _never(Class, params) {
2386
2469
  return new Class({
2387
2470
  type: "never",
2388
2471
  ...normalizeParams(params)
2389
2472
  });
2390
2473
  }
2474
+ /* @__NO_SIDE_EFFECTS__ */
2391
2475
  function _lt(value, params) {
2392
2476
  return new $ZodCheckLessThan({
2393
2477
  check: "less_than",
@@ -2396,6 +2480,7 @@ function _lt(value, params) {
2396
2480
  inclusive: false
2397
2481
  });
2398
2482
  }
2483
+ /* @__NO_SIDE_EFFECTS__ */
2399
2484
  function _lte(value, params) {
2400
2485
  return new $ZodCheckLessThan({
2401
2486
  check: "less_than",
@@ -2404,6 +2489,7 @@ function _lte(value, params) {
2404
2489
  inclusive: true
2405
2490
  });
2406
2491
  }
2492
+ /* @__NO_SIDE_EFFECTS__ */
2407
2493
  function _gt(value, params) {
2408
2494
  return new $ZodCheckGreaterThan({
2409
2495
  check: "greater_than",
@@ -2412,6 +2498,7 @@ function _gt(value, params) {
2412
2498
  inclusive: false
2413
2499
  });
2414
2500
  }
2501
+ /* @__NO_SIDE_EFFECTS__ */
2415
2502
  function _gte(value, params) {
2416
2503
  return new $ZodCheckGreaterThan({
2417
2504
  check: "greater_than",
@@ -2420,6 +2507,7 @@ function _gte(value, params) {
2420
2507
  inclusive: true
2421
2508
  });
2422
2509
  }
2510
+ /* @__NO_SIDE_EFFECTS__ */
2423
2511
  function _multipleOf(value, params) {
2424
2512
  return new $ZodCheckMultipleOf({
2425
2513
  check: "multiple_of",
@@ -2427,6 +2515,7 @@ function _multipleOf(value, params) {
2427
2515
  value
2428
2516
  });
2429
2517
  }
2518
+ /* @__NO_SIDE_EFFECTS__ */
2430
2519
  function _maxLength(maximum, params) {
2431
2520
  return new $ZodCheckMaxLength({
2432
2521
  check: "max_length",
@@ -2434,6 +2523,7 @@ function _maxLength(maximum, params) {
2434
2523
  maximum
2435
2524
  });
2436
2525
  }
2526
+ /* @__NO_SIDE_EFFECTS__ */
2437
2527
  function _minLength(minimum, params) {
2438
2528
  return new $ZodCheckMinLength({
2439
2529
  check: "min_length",
@@ -2441,6 +2531,7 @@ function _minLength(minimum, params) {
2441
2531
  minimum
2442
2532
  });
2443
2533
  }
2534
+ /* @__NO_SIDE_EFFECTS__ */
2444
2535
  function _length(length, params) {
2445
2536
  return new $ZodCheckLengthEquals({
2446
2537
  check: "length_equals",
@@ -2448,6 +2539,7 @@ function _length(length, params) {
2448
2539
  length
2449
2540
  });
2450
2541
  }
2542
+ /* @__NO_SIDE_EFFECTS__ */
2451
2543
  function _regex(pattern, params) {
2452
2544
  return new $ZodCheckRegex({
2453
2545
  check: "string_format",
@@ -2456,6 +2548,7 @@ function _regex(pattern, params) {
2456
2548
  pattern
2457
2549
  });
2458
2550
  }
2551
+ /* @__NO_SIDE_EFFECTS__ */
2459
2552
  function _lowercase(params) {
2460
2553
  return new $ZodCheckLowerCase({
2461
2554
  check: "string_format",
@@ -2463,6 +2556,7 @@ function _lowercase(params) {
2463
2556
  ...normalizeParams(params)
2464
2557
  });
2465
2558
  }
2559
+ /* @__NO_SIDE_EFFECTS__ */
2466
2560
  function _uppercase(params) {
2467
2561
  return new $ZodCheckUpperCase({
2468
2562
  check: "string_format",
@@ -2470,6 +2564,7 @@ function _uppercase(params) {
2470
2564
  ...normalizeParams(params)
2471
2565
  });
2472
2566
  }
2567
+ /* @__NO_SIDE_EFFECTS__ */
2473
2568
  function _includes(includes, params) {
2474
2569
  return new $ZodCheckIncludes({
2475
2570
  check: "string_format",
@@ -2478,6 +2573,7 @@ function _includes(includes, params) {
2478
2573
  includes
2479
2574
  });
2480
2575
  }
2576
+ /* @__NO_SIDE_EFFECTS__ */
2481
2577
  function _startsWith(prefix, params) {
2482
2578
  return new $ZodCheckStartsWith({
2483
2579
  check: "string_format",
@@ -2486,6 +2582,7 @@ function _startsWith(prefix, params) {
2486
2582
  prefix
2487
2583
  });
2488
2584
  }
2585
+ /* @__NO_SIDE_EFFECTS__ */
2489
2586
  function _endsWith(suffix, params) {
2490
2587
  return new $ZodCheckEndsWith({
2491
2588
  check: "string_format",
@@ -2494,27 +2591,34 @@ function _endsWith(suffix, params) {
2494
2591
  suffix
2495
2592
  });
2496
2593
  }
2594
+ /* @__NO_SIDE_EFFECTS__ */
2497
2595
  function _overwrite(tx) {
2498
2596
  return new $ZodCheckOverwrite({
2499
2597
  check: "overwrite",
2500
2598
  tx
2501
2599
  });
2502
2600
  }
2601
+ /* @__NO_SIDE_EFFECTS__ */
2503
2602
  function _normalize(form) {
2504
- return _overwrite((input) => input.normalize(form));
2603
+ return /* @__PURE__ */ _overwrite((input) => input.normalize(form));
2505
2604
  }
2605
+ /* @__NO_SIDE_EFFECTS__ */
2506
2606
  function _trim() {
2507
- return _overwrite((input) => input.trim());
2607
+ return /* @__PURE__ */ _overwrite((input) => input.trim());
2508
2608
  }
2609
+ /* @__NO_SIDE_EFFECTS__ */
2509
2610
  function _toLowerCase() {
2510
- return _overwrite((input) => input.toLowerCase());
2611
+ return /* @__PURE__ */ _overwrite((input) => input.toLowerCase());
2511
2612
  }
2613
+ /* @__NO_SIDE_EFFECTS__ */
2512
2614
  function _toUpperCase() {
2513
- return _overwrite((input) => input.toUpperCase());
2615
+ return /* @__PURE__ */ _overwrite((input) => input.toUpperCase());
2514
2616
  }
2617
+ /* @__NO_SIDE_EFFECTS__ */
2515
2618
  function _slugify() {
2516
- return _overwrite((input) => slugify(input));
2619
+ return /* @__PURE__ */ _overwrite((input) => slugify(input));
2517
2620
  }
2621
+ /* @__NO_SIDE_EFFECTS__ */
2518
2622
  function _array(Class, element, params) {
2519
2623
  return new Class({
2520
2624
  type: "array",
@@ -2522,6 +2626,7 @@ function _array(Class, element, params) {
2522
2626
  ...normalizeParams(params)
2523
2627
  });
2524
2628
  }
2629
+ /* @__NO_SIDE_EFFECTS__ */
2525
2630
  function _refine(Class, fn, _params) {
2526
2631
  return new Class({
2527
2632
  type: "custom",
@@ -2530,8 +2635,9 @@ function _refine(Class, fn, _params) {
2530
2635
  ...normalizeParams(_params)
2531
2636
  });
2532
2637
  }
2638
+ /* @__NO_SIDE_EFFECTS__ */
2533
2639
  function _superRefine(fn) {
2534
- const ch = _check((payload) => {
2640
+ const ch = /* @__PURE__ */ _check((payload) => {
2535
2641
  payload.addIssue = (issue$1) => {
2536
2642
  if (typeof issue$1 === "string") payload.issues.push(issue(issue$1, payload.value, ch._zod.def));
2537
2643
  else {
@@ -2548,6 +2654,7 @@ function _superRefine(fn) {
2548
2654
  });
2549
2655
  return ch;
2550
2656
  }
2657
+ /* @__NO_SIDE_EFFECTS__ */
2551
2658
  function _check(fn, params) {
2552
2659
  const ch = new $ZodCheck({
2553
2660
  check: "custom",
@@ -2556,6 +2663,7 @@ function _check(fn, params) {
2556
2663
  ch._zod.check = fn;
2557
2664
  return ch;
2558
2665
  }
2666
+ /* @__NO_SIDE_EFFECTS__ */
2559
2667
  function describe$1(description) {
2560
2668
  const ch = new $ZodCheck({ check: "describe" });
2561
2669
  ch._zod.onattach = [(inst) => {
@@ -2568,6 +2676,7 @@ function describe$1(description) {
2568
2676
  ch._zod.check = () => {};
2569
2677
  return ch;
2570
2678
  }
2679
+ /* @__NO_SIDE_EFFECTS__ */
2571
2680
  function meta$1(metadata) {
2572
2681
  const ch = new $ZodCheck({ check: "meta" });
2573
2682
  ch._zod.onattach = [(inst) => {
@@ -2582,7 +2691,528 @@ function meta$1(metadata) {
2582
2691
  }
2583
2692
 
2584
2693
  //#endregion
2585
- //#region ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/classic/iso.js
2694
+ //#region ../../node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/to-json-schema.js
2695
+ function initializeContext(params) {
2696
+ let target = params?.target ?? "draft-2020-12";
2697
+ if (target === "draft-4") target = "draft-04";
2698
+ if (target === "draft-7") target = "draft-07";
2699
+ return {
2700
+ processors: params.processors ?? {},
2701
+ metadataRegistry: params?.metadata ?? globalRegistry,
2702
+ target,
2703
+ unrepresentable: params?.unrepresentable ?? "throw",
2704
+ override: params?.override ?? (() => {}),
2705
+ io: params?.io ?? "output",
2706
+ counter: 0,
2707
+ seen: /* @__PURE__ */ new Map(),
2708
+ cycles: params?.cycles ?? "ref",
2709
+ reused: params?.reused ?? "inline",
2710
+ external: params?.external ?? void 0
2711
+ };
2712
+ }
2713
+ function process$1(schema, ctx, _params = {
2714
+ path: [],
2715
+ schemaPath: []
2716
+ }) {
2717
+ var _a$1;
2718
+ const def = schema._zod.def;
2719
+ const seen = ctx.seen.get(schema);
2720
+ if (seen) {
2721
+ seen.count++;
2722
+ if (_params.schemaPath.includes(schema)) seen.cycle = _params.path;
2723
+ return seen.schema;
2724
+ }
2725
+ const result = {
2726
+ schema: {},
2727
+ count: 1,
2728
+ cycle: void 0,
2729
+ path: _params.path
2730
+ };
2731
+ ctx.seen.set(schema, result);
2732
+ const overrideSchema = schema._zod.toJSONSchema?.();
2733
+ if (overrideSchema) result.schema = overrideSchema;
2734
+ else {
2735
+ const params = {
2736
+ ..._params,
2737
+ schemaPath: [..._params.schemaPath, schema],
2738
+ path: _params.path
2739
+ };
2740
+ if (schema._zod.processJSONSchema) schema._zod.processJSONSchema(ctx, result.schema, params);
2741
+ else {
2742
+ const _json = result.schema;
2743
+ const processor = ctx.processors[def.type];
2744
+ if (!processor) throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);
2745
+ processor(schema, ctx, _json, params);
2746
+ }
2747
+ const parent = schema._zod.parent;
2748
+ if (parent) {
2749
+ if (!result.ref) result.ref = parent;
2750
+ process$1(parent, ctx, params);
2751
+ ctx.seen.get(parent).isParent = true;
2752
+ }
2753
+ }
2754
+ const meta$2 = ctx.metadataRegistry.get(schema);
2755
+ if (meta$2) Object.assign(result.schema, meta$2);
2756
+ if (ctx.io === "input" && isTransforming(schema)) {
2757
+ delete result.schema.examples;
2758
+ delete result.schema.default;
2759
+ }
2760
+ if (ctx.io === "input" && result.schema._prefault) (_a$1 = result.schema).default ?? (_a$1.default = result.schema._prefault);
2761
+ delete result.schema._prefault;
2762
+ return ctx.seen.get(schema).schema;
2763
+ }
2764
+ function extractDefs(ctx, schema) {
2765
+ const root = ctx.seen.get(schema);
2766
+ if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
2767
+ const idToSchema = /* @__PURE__ */ new Map();
2768
+ for (const entry of ctx.seen.entries()) {
2769
+ const id = ctx.metadataRegistry.get(entry[0])?.id;
2770
+ if (id) {
2771
+ const existing = idToSchema.get(id);
2772
+ if (existing && existing !== entry[0]) throw new Error(`Duplicate schema id "${id}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
2773
+ idToSchema.set(id, entry[0]);
2774
+ }
2775
+ }
2776
+ const makeURI = (entry) => {
2777
+ const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
2778
+ if (ctx.external) {
2779
+ const externalId = ctx.external.registry.get(entry[0])?.id;
2780
+ const uriGenerator = ctx.external.uri ?? ((id$1) => id$1);
2781
+ if (externalId) return { ref: uriGenerator(externalId) };
2782
+ const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
2783
+ entry[1].defId = id;
2784
+ return {
2785
+ defId: id,
2786
+ ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}`
2787
+ };
2788
+ }
2789
+ if (entry[1] === root) return { ref: "#" };
2790
+ const defUriPrefix = `#/${defsSegment}/`;
2791
+ const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
2792
+ return {
2793
+ defId,
2794
+ ref: defUriPrefix + defId
2795
+ };
2796
+ };
2797
+ const extractToDef = (entry) => {
2798
+ if (entry[1].schema.$ref) return;
2799
+ const seen = entry[1];
2800
+ const { ref, defId } = makeURI(entry);
2801
+ seen.def = { ...seen.schema };
2802
+ if (defId) seen.defId = defId;
2803
+ const schema$1 = seen.schema;
2804
+ for (const key in schema$1) delete schema$1[key];
2805
+ schema$1.$ref = ref;
2806
+ };
2807
+ if (ctx.cycles === "throw") for (const entry of ctx.seen.entries()) {
2808
+ const seen = entry[1];
2809
+ if (seen.cycle) throw new Error(`Cycle detected: #/${seen.cycle?.join("/")}/<root>
2810
+
2811
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
2812
+ }
2813
+ for (const entry of ctx.seen.entries()) {
2814
+ const seen = entry[1];
2815
+ if (schema === entry[0]) {
2816
+ extractToDef(entry);
2817
+ continue;
2818
+ }
2819
+ if (ctx.external) {
2820
+ const ext = ctx.external.registry.get(entry[0])?.id;
2821
+ if (schema !== entry[0] && ext) {
2822
+ extractToDef(entry);
2823
+ continue;
2824
+ }
2825
+ }
2826
+ if (ctx.metadataRegistry.get(entry[0])?.id) {
2827
+ extractToDef(entry);
2828
+ continue;
2829
+ }
2830
+ if (seen.cycle) {
2831
+ extractToDef(entry);
2832
+ continue;
2833
+ }
2834
+ if (seen.count > 1) {
2835
+ if (ctx.reused === "ref") {
2836
+ extractToDef(entry);
2837
+ continue;
2838
+ }
2839
+ }
2840
+ }
2841
+ }
2842
+ function finalize(ctx, schema) {
2843
+ const root = ctx.seen.get(schema);
2844
+ if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
2845
+ const flattenRef = (zodSchema) => {
2846
+ const seen = ctx.seen.get(zodSchema);
2847
+ if (seen.ref === null) return;
2848
+ const schema$1 = seen.def ?? seen.schema;
2849
+ const _cached = { ...schema$1 };
2850
+ const ref = seen.ref;
2851
+ seen.ref = null;
2852
+ if (ref) {
2853
+ flattenRef(ref);
2854
+ const refSeen = ctx.seen.get(ref);
2855
+ const refSchema = refSeen.schema;
2856
+ if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
2857
+ schema$1.allOf = schema$1.allOf ?? [];
2858
+ schema$1.allOf.push(refSchema);
2859
+ } else Object.assign(schema$1, refSchema);
2860
+ Object.assign(schema$1, _cached);
2861
+ if (zodSchema._zod.parent === ref) for (const key in schema$1) {
2862
+ if (key === "$ref" || key === "allOf") continue;
2863
+ if (!(key in _cached)) delete schema$1[key];
2864
+ }
2865
+ if (refSchema.$ref) for (const key in schema$1) {
2866
+ if (key === "$ref" || key === "allOf") continue;
2867
+ if (key in refSeen.def && JSON.stringify(schema$1[key]) === JSON.stringify(refSeen.def[key])) delete schema$1[key];
2868
+ }
2869
+ }
2870
+ const parent = zodSchema._zod.parent;
2871
+ if (parent && parent !== ref) {
2872
+ flattenRef(parent);
2873
+ const parentSeen = ctx.seen.get(parent);
2874
+ if (parentSeen?.schema.$ref) {
2875
+ schema$1.$ref = parentSeen.schema.$ref;
2876
+ if (parentSeen.def) for (const key in schema$1) {
2877
+ if (key === "$ref" || key === "allOf") continue;
2878
+ if (key in parentSeen.def && JSON.stringify(schema$1[key]) === JSON.stringify(parentSeen.def[key])) delete schema$1[key];
2879
+ }
2880
+ }
2881
+ }
2882
+ ctx.override({
2883
+ zodSchema,
2884
+ jsonSchema: schema$1,
2885
+ path: seen.path ?? []
2886
+ });
2887
+ };
2888
+ for (const entry of [...ctx.seen.entries()].reverse()) flattenRef(entry[0]);
2889
+ const result = {};
2890
+ if (ctx.target === "draft-2020-12") result.$schema = "https://json-schema.org/draft/2020-12/schema";
2891
+ else if (ctx.target === "draft-07") result.$schema = "http://json-schema.org/draft-07/schema#";
2892
+ else if (ctx.target === "draft-04") result.$schema = "http://json-schema.org/draft-04/schema#";
2893
+ else if (ctx.target === "openapi-3.0") {}
2894
+ if (ctx.external?.uri) {
2895
+ const id = ctx.external.registry.get(schema)?.id;
2896
+ if (!id) throw new Error("Schema is missing an `id` property");
2897
+ result.$id = ctx.external.uri(id);
2898
+ }
2899
+ Object.assign(result, root.def ?? root.schema);
2900
+ const defs = ctx.external?.defs ?? {};
2901
+ for (const entry of ctx.seen.entries()) {
2902
+ const seen = entry[1];
2903
+ if (seen.def && seen.defId) defs[seen.defId] = seen.def;
2904
+ }
2905
+ if (ctx.external) {} else if (Object.keys(defs).length > 0) if (ctx.target === "draft-2020-12") result.$defs = defs;
2906
+ else result.definitions = defs;
2907
+ try {
2908
+ const finalized = JSON.parse(JSON.stringify(result));
2909
+ Object.defineProperty(finalized, "~standard", {
2910
+ value: {
2911
+ ...schema["~standard"],
2912
+ jsonSchema: {
2913
+ input: createStandardJSONSchemaMethod(schema, "input", ctx.processors),
2914
+ output: createStandardJSONSchemaMethod(schema, "output", ctx.processors)
2915
+ }
2916
+ },
2917
+ enumerable: false,
2918
+ writable: false
2919
+ });
2920
+ return finalized;
2921
+ } catch (_err) {
2922
+ throw new Error("Error converting schema to JSON.");
2923
+ }
2924
+ }
2925
+ function isTransforming(_schema, _ctx) {
2926
+ const ctx = _ctx ?? { seen: /* @__PURE__ */ new Set() };
2927
+ if (ctx.seen.has(_schema)) return false;
2928
+ ctx.seen.add(_schema);
2929
+ const def = _schema._zod.def;
2930
+ if (def.type === "transform") return true;
2931
+ if (def.type === "array") return isTransforming(def.element, ctx);
2932
+ if (def.type === "set") return isTransforming(def.valueType, ctx);
2933
+ if (def.type === "lazy") return isTransforming(def.getter(), ctx);
2934
+ if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault") return isTransforming(def.innerType, ctx);
2935
+ if (def.type === "intersection") return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
2936
+ if (def.type === "record" || def.type === "map") return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
2937
+ if (def.type === "pipe") return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
2938
+ if (def.type === "object") {
2939
+ for (const key in def.shape) if (isTransforming(def.shape[key], ctx)) return true;
2940
+ return false;
2941
+ }
2942
+ if (def.type === "union") {
2943
+ for (const option of def.options) if (isTransforming(option, ctx)) return true;
2944
+ return false;
2945
+ }
2946
+ if (def.type === "tuple") {
2947
+ for (const item of def.items) if (isTransforming(item, ctx)) return true;
2948
+ if (def.rest && isTransforming(def.rest, ctx)) return true;
2949
+ return false;
2950
+ }
2951
+ return false;
2952
+ }
2953
+ /**
2954
+ * Creates a toJSONSchema method for a schema instance.
2955
+ * This encapsulates the logic of initializing context, processing, extracting defs, and finalizing.
2956
+ */
2957
+ const createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
2958
+ const ctx = initializeContext({
2959
+ ...params,
2960
+ processors
2961
+ });
2962
+ process$1(schema, ctx);
2963
+ extractDefs(ctx, schema);
2964
+ return finalize(ctx, schema);
2965
+ };
2966
+ const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
2967
+ const { libraryOptions, target } = params ?? {};
2968
+ const ctx = initializeContext({
2969
+ ...libraryOptions ?? {},
2970
+ target,
2971
+ io,
2972
+ processors
2973
+ });
2974
+ process$1(schema, ctx);
2975
+ extractDefs(ctx, schema);
2976
+ return finalize(ctx, schema);
2977
+ };
2978
+
2979
+ //#endregion
2980
+ //#region ../../node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/json-schema-processors.js
2981
+ const formatMap = {
2982
+ guid: "uuid",
2983
+ url: "uri",
2984
+ datetime: "date-time",
2985
+ json_string: "json-string",
2986
+ regex: ""
2987
+ };
2988
+ const stringProcessor = (schema, ctx, _json, _params) => {
2989
+ const json = _json;
2990
+ json.type = "string";
2991
+ const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
2992
+ if (typeof minimum === "number") json.minLength = minimum;
2993
+ if (typeof maximum === "number") json.maxLength = maximum;
2994
+ if (format) {
2995
+ json.format = formatMap[format] ?? format;
2996
+ if (json.format === "") delete json.format;
2997
+ if (format === "time") delete json.format;
2998
+ }
2999
+ if (contentEncoding) json.contentEncoding = contentEncoding;
3000
+ if (patterns && patterns.size > 0) {
3001
+ const regexes = [...patterns];
3002
+ if (regexes.length === 1) json.pattern = regexes[0].source;
3003
+ else if (regexes.length > 1) json.allOf = [...regexes.map((regex) => ({
3004
+ ...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
3005
+ pattern: regex.source
3006
+ }))];
3007
+ }
3008
+ };
3009
+ const numberProcessor = (schema, ctx, _json, _params) => {
3010
+ const json = _json;
3011
+ const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
3012
+ if (typeof format === "string" && format.includes("int")) json.type = "integer";
3013
+ else json.type = "number";
3014
+ if (typeof exclusiveMinimum === "number") if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
3015
+ json.minimum = exclusiveMinimum;
3016
+ json.exclusiveMinimum = true;
3017
+ } else json.exclusiveMinimum = exclusiveMinimum;
3018
+ if (typeof minimum === "number") {
3019
+ json.minimum = minimum;
3020
+ if (typeof exclusiveMinimum === "number" && ctx.target !== "draft-04") if (exclusiveMinimum >= minimum) delete json.minimum;
3021
+ else delete json.exclusiveMinimum;
3022
+ }
3023
+ if (typeof exclusiveMaximum === "number") if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
3024
+ json.maximum = exclusiveMaximum;
3025
+ json.exclusiveMaximum = true;
3026
+ } else json.exclusiveMaximum = exclusiveMaximum;
3027
+ if (typeof maximum === "number") {
3028
+ json.maximum = maximum;
3029
+ if (typeof exclusiveMaximum === "number" && ctx.target !== "draft-04") if (exclusiveMaximum <= maximum) delete json.maximum;
3030
+ else delete json.exclusiveMaximum;
3031
+ }
3032
+ if (typeof multipleOf === "number") json.multipleOf = multipleOf;
3033
+ };
3034
+ const booleanProcessor = (_schema, _ctx, json, _params) => {
3035
+ json.type = "boolean";
3036
+ };
3037
+ const neverProcessor = (_schema, _ctx, json, _params) => {
3038
+ json.not = {};
3039
+ };
3040
+ const unknownProcessor = (_schema, _ctx, _json, _params) => {};
3041
+ const enumProcessor = (schema, _ctx, json, _params) => {
3042
+ const def = schema._zod.def;
3043
+ const values = getEnumValues(def.entries);
3044
+ if (values.every((v) => typeof v === "number")) json.type = "number";
3045
+ if (values.every((v) => typeof v === "string")) json.type = "string";
3046
+ json.enum = values;
3047
+ };
3048
+ const literalProcessor = (schema, ctx, json, _params) => {
3049
+ const def = schema._zod.def;
3050
+ const vals = [];
3051
+ for (const val of def.values) if (val === void 0) {
3052
+ if (ctx.unrepresentable === "throw") throw new Error("Literal `undefined` cannot be represented in JSON Schema");
3053
+ } else if (typeof val === "bigint") if (ctx.unrepresentable === "throw") throw new Error("BigInt literals cannot be represented in JSON Schema");
3054
+ else vals.push(Number(val));
3055
+ else vals.push(val);
3056
+ if (vals.length === 0) {} else if (vals.length === 1) {
3057
+ const val = vals[0];
3058
+ json.type = val === null ? "null" : typeof val;
3059
+ if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") json.enum = [val];
3060
+ else json.const = val;
3061
+ } else {
3062
+ if (vals.every((v) => typeof v === "number")) json.type = "number";
3063
+ if (vals.every((v) => typeof v === "string")) json.type = "string";
3064
+ if (vals.every((v) => typeof v === "boolean")) json.type = "boolean";
3065
+ if (vals.every((v) => v === null)) json.type = "null";
3066
+ json.enum = vals;
3067
+ }
3068
+ };
3069
+ const customProcessor = (_schema, ctx, _json, _params) => {
3070
+ if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
3071
+ };
3072
+ const transformProcessor = (_schema, ctx, _json, _params) => {
3073
+ if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
3074
+ };
3075
+ const arrayProcessor = (schema, ctx, _json, params) => {
3076
+ const json = _json;
3077
+ const def = schema._zod.def;
3078
+ const { minimum, maximum } = schema._zod.bag;
3079
+ if (typeof minimum === "number") json.minItems = minimum;
3080
+ if (typeof maximum === "number") json.maxItems = maximum;
3081
+ json.type = "array";
3082
+ json.items = process$1(def.element, ctx, {
3083
+ ...params,
3084
+ path: [...params.path, "items"]
3085
+ });
3086
+ };
3087
+ const objectProcessor = (schema, ctx, _json, params) => {
3088
+ const json = _json;
3089
+ const def = schema._zod.def;
3090
+ json.type = "object";
3091
+ json.properties = {};
3092
+ const shape = def.shape;
3093
+ for (const key in shape) json.properties[key] = process$1(shape[key], ctx, {
3094
+ ...params,
3095
+ path: [
3096
+ ...params.path,
3097
+ "properties",
3098
+ key
3099
+ ]
3100
+ });
3101
+ const allKeys = new Set(Object.keys(shape));
3102
+ const requiredKeys = new Set([...allKeys].filter((key) => {
3103
+ const v = def.shape[key]._zod;
3104
+ if (ctx.io === "input") return v.optin === void 0;
3105
+ else return v.optout === void 0;
3106
+ }));
3107
+ if (requiredKeys.size > 0) json.required = Array.from(requiredKeys);
3108
+ if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
3109
+ else if (!def.catchall) {
3110
+ if (ctx.io === "output") json.additionalProperties = false;
3111
+ } else if (def.catchall) json.additionalProperties = process$1(def.catchall, ctx, {
3112
+ ...params,
3113
+ path: [...params.path, "additionalProperties"]
3114
+ });
3115
+ };
3116
+ const unionProcessor = (schema, ctx, json, params) => {
3117
+ const def = schema._zod.def;
3118
+ const isExclusive = def.inclusive === false;
3119
+ const options = def.options.map((x, i) => process$1(x, ctx, {
3120
+ ...params,
3121
+ path: [
3122
+ ...params.path,
3123
+ isExclusive ? "oneOf" : "anyOf",
3124
+ i
3125
+ ]
3126
+ }));
3127
+ if (isExclusive) json.oneOf = options;
3128
+ else json.anyOf = options;
3129
+ };
3130
+ const intersectionProcessor = (schema, ctx, json, params) => {
3131
+ const def = schema._zod.def;
3132
+ const a = process$1(def.left, ctx, {
3133
+ ...params,
3134
+ path: [
3135
+ ...params.path,
3136
+ "allOf",
3137
+ 0
3138
+ ]
3139
+ });
3140
+ const b = process$1(def.right, ctx, {
3141
+ ...params,
3142
+ path: [
3143
+ ...params.path,
3144
+ "allOf",
3145
+ 1
3146
+ ]
3147
+ });
3148
+ const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
3149
+ json.allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
3150
+ };
3151
+ const nullableProcessor = (schema, ctx, json, params) => {
3152
+ const def = schema._zod.def;
3153
+ const inner = process$1(def.innerType, ctx, params);
3154
+ const seen = ctx.seen.get(schema);
3155
+ if (ctx.target === "openapi-3.0") {
3156
+ seen.ref = def.innerType;
3157
+ json.nullable = true;
3158
+ } else json.anyOf = [inner, { type: "null" }];
3159
+ };
3160
+ const nonoptionalProcessor = (schema, ctx, _json, params) => {
3161
+ const def = schema._zod.def;
3162
+ process$1(def.innerType, ctx, params);
3163
+ const seen = ctx.seen.get(schema);
3164
+ seen.ref = def.innerType;
3165
+ };
3166
+ const defaultProcessor = (schema, ctx, json, params) => {
3167
+ const def = schema._zod.def;
3168
+ process$1(def.innerType, ctx, params);
3169
+ const seen = ctx.seen.get(schema);
3170
+ seen.ref = def.innerType;
3171
+ json.default = JSON.parse(JSON.stringify(def.defaultValue));
3172
+ };
3173
+ const prefaultProcessor = (schema, ctx, json, params) => {
3174
+ const def = schema._zod.def;
3175
+ process$1(def.innerType, ctx, params);
3176
+ const seen = ctx.seen.get(schema);
3177
+ seen.ref = def.innerType;
3178
+ if (ctx.io === "input") json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
3179
+ };
3180
+ const catchProcessor = (schema, ctx, json, params) => {
3181
+ const def = schema._zod.def;
3182
+ process$1(def.innerType, ctx, params);
3183
+ const seen = ctx.seen.get(schema);
3184
+ seen.ref = def.innerType;
3185
+ let catchValue;
3186
+ try {
3187
+ catchValue = def.catchValue(void 0);
3188
+ } catch {
3189
+ throw new Error("Dynamic catch values are not supported in JSON Schema");
3190
+ }
3191
+ json.default = catchValue;
3192
+ };
3193
+ const pipeProcessor = (schema, ctx, _json, params) => {
3194
+ const def = schema._zod.def;
3195
+ const innerType = ctx.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
3196
+ process$1(innerType, ctx, params);
3197
+ const seen = ctx.seen.get(schema);
3198
+ seen.ref = innerType;
3199
+ };
3200
+ const readonlyProcessor = (schema, ctx, json, params) => {
3201
+ const def = schema._zod.def;
3202
+ process$1(def.innerType, ctx, params);
3203
+ const seen = ctx.seen.get(schema);
3204
+ seen.ref = def.innerType;
3205
+ json.readOnly = true;
3206
+ };
3207
+ const optionalProcessor = (schema, ctx, _json, params) => {
3208
+ const def = schema._zod.def;
3209
+ process$1(def.innerType, ctx, params);
3210
+ const seen = ctx.seen.get(schema);
3211
+ seen.ref = def.innerType;
3212
+ };
3213
+
3214
+ //#endregion
3215
+ //#region ../../node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/classic/iso.js
2586
3216
  const ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
2587
3217
  $ZodISODateTime.init(inst, def);
2588
3218
  ZodStringFormat.init(inst, def);
@@ -2613,7 +3243,7 @@ function duration(params) {
2613
3243
  }
2614
3244
 
2615
3245
  //#endregion
2616
- //#region ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/classic/errors.js
3246
+ //#region ../../node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/classic/errors.js
2617
3247
  const initializer = (inst, issues) => {
2618
3248
  $ZodError.init(inst, issues);
2619
3249
  inst.name = "ZodError";
@@ -2637,7 +3267,7 @@ const ZodError = $constructor("ZodError", initializer);
2637
3267
  const ZodRealError = $constructor("ZodError", initializer, { Parent: Error });
2638
3268
 
2639
3269
  //#endregion
2640
- //#region ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/classic/parse.js
3270
+ //#region ../../node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/classic/parse.js
2641
3271
  const parse = /* @__PURE__ */ _parse(ZodRealError);
2642
3272
  const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
2643
3273
  const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
@@ -2652,9 +3282,14 @@ const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
2652
3282
  const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
2653
3283
 
2654
3284
  //#endregion
2655
- //#region ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/classic/schemas.js
3285
+ //#region ../../node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/classic/schemas.js
2656
3286
  const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
2657
3287
  $ZodType.init(inst, def);
3288
+ Object.assign(inst["~standard"], { jsonSchema: {
3289
+ input: createStandardJSONSchemaMethod(inst, "input"),
3290
+ output: createStandardJSONSchemaMethod(inst, "output")
3291
+ } });
3292
+ inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
2658
3293
  inst.def = def;
2659
3294
  inst.type = def.type;
2660
3295
  Object.defineProperty(inst, "_def", { value: def });
@@ -2663,8 +3298,9 @@ const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
2663
3298
  check: ch,
2664
3299
  def: { check: "custom" },
2665
3300
  onattach: []
2666
- } } : ch)] }));
3301
+ } } : ch)] }), { parent: true });
2667
3302
  };
3303
+ inst.with = inst.check;
2668
3304
  inst.clone = (def$1, params) => clone(inst, def$1, params);
2669
3305
  inst.brand = () => inst;
2670
3306
  inst.register = ((reg, meta$2) => {
@@ -2688,6 +3324,7 @@ const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
2688
3324
  inst.superRefine = (refinement) => inst.check(superRefine(refinement));
2689
3325
  inst.overwrite = (fn) => inst.check(_overwrite(fn));
2690
3326
  inst.optional = () => optional(inst);
3327
+ inst.exactOptional = () => exactOptional(inst);
2691
3328
  inst.nullable = () => nullable(inst);
2692
3329
  inst.nullish = () => optional(nullable(inst));
2693
3330
  inst.nonoptional = (params) => nonoptional(inst, params);
@@ -2719,12 +3356,14 @@ const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
2719
3356
  };
2720
3357
  inst.isOptional = () => inst.safeParse(void 0).success;
2721
3358
  inst.isNullable = () => inst.safeParse(null).success;
3359
+ inst.apply = (fn) => fn(inst);
2722
3360
  return inst;
2723
3361
  });
2724
3362
  /** @internal */
2725
3363
  const _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
2726
3364
  $ZodString.init(inst, def);
2727
3365
  ZodType.init(inst, def);
3366
+ inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
2728
3367
  const bag = inst._zod.bag;
2729
3368
  inst.format = bag.format ?? null;
2730
3369
  inst.minLength = bag.minimum ?? null;
@@ -2862,6 +3501,7 @@ const ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
2862
3501
  const ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
2863
3502
  $ZodNumber.init(inst, def);
2864
3503
  ZodType.init(inst, def);
3504
+ inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
2865
3505
  inst.gt = (value, params) => inst.check(_gt(value, params));
2866
3506
  inst.gte = (value, params) => inst.check(_gte(value, params));
2867
3507
  inst.min = (value, params) => inst.check(_gte(value, params));
@@ -2897,6 +3537,7 @@ function int(params) {
2897
3537
  const ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
2898
3538
  $ZodBoolean.init(inst, def);
2899
3539
  ZodType.init(inst, def);
3540
+ inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
2900
3541
  });
2901
3542
  function boolean(params) {
2902
3543
  return _boolean(ZodBoolean, params);
@@ -2904,6 +3545,7 @@ function boolean(params) {
2904
3545
  const ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
2905
3546
  $ZodUnknown.init(inst, def);
2906
3547
  ZodType.init(inst, def);
3548
+ inst._zod.processJSONSchema = (ctx, json, params) => unknownProcessor(inst, ctx, json, params);
2907
3549
  });
2908
3550
  function unknown() {
2909
3551
  return _unknown(ZodUnknown);
@@ -2911,6 +3553,7 @@ function unknown() {
2911
3553
  const ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
2912
3554
  $ZodNever.init(inst, def);
2913
3555
  ZodType.init(inst, def);
3556
+ inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json, params);
2914
3557
  });
2915
3558
  function never(params) {
2916
3559
  return _never(ZodNever, params);
@@ -2918,6 +3561,7 @@ function never(params) {
2918
3561
  const ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
2919
3562
  $ZodArray.init(inst, def);
2920
3563
  ZodType.init(inst, def);
3564
+ inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
2921
3565
  inst.element = def.element;
2922
3566
  inst.min = (minLength, params) => inst.check(_minLength(minLength, params));
2923
3567
  inst.nonempty = (params) => inst.check(_minLength(1, params));
@@ -2931,6 +3575,7 @@ function array(element, params) {
2931
3575
  const ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
2932
3576
  $ZodObjectJIT.init(inst, def);
2933
3577
  ZodType.init(inst, def);
3578
+ inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
2934
3579
  defineLazy(inst, "shape", () => {
2935
3580
  return def.shape;
2936
3581
  });
@@ -2977,6 +3622,7 @@ function object(shape, params) {
2977
3622
  const ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
2978
3623
  $ZodUnion.init(inst, def);
2979
3624
  ZodType.init(inst, def);
3625
+ inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
2980
3626
  inst.options = def.options;
2981
3627
  });
2982
3628
  function union(options, params) {
@@ -3001,6 +3647,7 @@ function discriminatedUnion(discriminator, options, params) {
3001
3647
  const ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
3002
3648
  $ZodIntersection.init(inst, def);
3003
3649
  ZodType.init(inst, def);
3650
+ inst._zod.processJSONSchema = (ctx, json, params) => intersectionProcessor(inst, ctx, json, params);
3004
3651
  });
3005
3652
  function intersection(left, right) {
3006
3653
  return new ZodIntersection({
@@ -3012,6 +3659,7 @@ function intersection(left, right) {
3012
3659
  const ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
3013
3660
  $ZodEnum.init(inst, def);
3014
3661
  ZodType.init(inst, def);
3662
+ inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
3015
3663
  inst.enum = def.entries;
3016
3664
  inst.options = Object.values(def.entries);
3017
3665
  const keys = new Set(Object.keys(def.entries));
@@ -3048,6 +3696,7 @@ function _enum(values, params) {
3048
3696
  const ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
3049
3697
  $ZodLiteral.init(inst, def);
3050
3698
  ZodType.init(inst, def);
3699
+ inst._zod.processJSONSchema = (ctx, json, params) => literalProcessor(inst, ctx, json, params);
3051
3700
  inst.values = new Set(def.values);
3052
3701
  Object.defineProperty(inst, "value", { get() {
3053
3702
  if (def.values.length > 1) throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
@@ -3064,6 +3713,7 @@ function literal(value, params) {
3064
3713
  const ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
3065
3714
  $ZodTransform.init(inst, def);
3066
3715
  ZodType.init(inst, def);
3716
+ inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
3067
3717
  inst._zod.parse = (payload, _ctx) => {
3068
3718
  if (_ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
3069
3719
  payload.addIssue = (issue$1) => {
@@ -3095,6 +3745,7 @@ function transform(fn) {
3095
3745
  const ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
3096
3746
  $ZodOptional.init(inst, def);
3097
3747
  ZodType.init(inst, def);
3748
+ inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
3098
3749
  inst.unwrap = () => inst._zod.def.innerType;
3099
3750
  });
3100
3751
  function optional(innerType) {
@@ -3103,9 +3754,22 @@ function optional(innerType) {
3103
3754
  innerType
3104
3755
  });
3105
3756
  }
3757
+ const ZodExactOptional = /* @__PURE__ */ $constructor("ZodExactOptional", (inst, def) => {
3758
+ $ZodExactOptional.init(inst, def);
3759
+ ZodType.init(inst, def);
3760
+ inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
3761
+ inst.unwrap = () => inst._zod.def.innerType;
3762
+ });
3763
+ function exactOptional(innerType) {
3764
+ return new ZodExactOptional({
3765
+ type: "optional",
3766
+ innerType
3767
+ });
3768
+ }
3106
3769
  const ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
3107
3770
  $ZodNullable.init(inst, def);
3108
3771
  ZodType.init(inst, def);
3772
+ inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor(inst, ctx, json, params);
3109
3773
  inst.unwrap = () => inst._zod.def.innerType;
3110
3774
  });
3111
3775
  function nullable(innerType) {
@@ -3117,6 +3781,7 @@ function nullable(innerType) {
3117
3781
  const ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
3118
3782
  $ZodDefault.init(inst, def);
3119
3783
  ZodType.init(inst, def);
3784
+ inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor(inst, ctx, json, params);
3120
3785
  inst.unwrap = () => inst._zod.def.innerType;
3121
3786
  inst.removeDefault = inst.unwrap;
3122
3787
  });
@@ -3132,6 +3797,7 @@ function _default(innerType, defaultValue) {
3132
3797
  const ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
3133
3798
  $ZodPrefault.init(inst, def);
3134
3799
  ZodType.init(inst, def);
3800
+ inst._zod.processJSONSchema = (ctx, json, params) => prefaultProcessor(inst, ctx, json, params);
3135
3801
  inst.unwrap = () => inst._zod.def.innerType;
3136
3802
  });
3137
3803
  function prefault(innerType, defaultValue) {
@@ -3146,6 +3812,7 @@ function prefault(innerType, defaultValue) {
3146
3812
  const ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
3147
3813
  $ZodNonOptional.init(inst, def);
3148
3814
  ZodType.init(inst, def);
3815
+ inst._zod.processJSONSchema = (ctx, json, params) => nonoptionalProcessor(inst, ctx, json, params);
3149
3816
  inst.unwrap = () => inst._zod.def.innerType;
3150
3817
  });
3151
3818
  function nonoptional(innerType, params) {
@@ -3158,6 +3825,7 @@ function nonoptional(innerType, params) {
3158
3825
  const ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
3159
3826
  $ZodCatch.init(inst, def);
3160
3827
  ZodType.init(inst, def);
3828
+ inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params);
3161
3829
  inst.unwrap = () => inst._zod.def.innerType;
3162
3830
  inst.removeCatch = inst.unwrap;
3163
3831
  });
@@ -3171,6 +3839,7 @@ function _catch(innerType, catchValue) {
3171
3839
  const ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
3172
3840
  $ZodPipe.init(inst, def);
3173
3841
  ZodType.init(inst, def);
3842
+ inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params);
3174
3843
  inst.in = def.in;
3175
3844
  inst.out = def.out;
3176
3845
  });
@@ -3184,6 +3853,7 @@ function pipe(in_, out) {
3184
3853
  const ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
3185
3854
  $ZodReadonly.init(inst, def);
3186
3855
  ZodType.init(inst, def);
3856
+ inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params);
3187
3857
  inst.unwrap = () => inst._zod.def.innerType;
3188
3858
  });
3189
3859
  function readonly(innerType) {
@@ -3195,6 +3865,7 @@ function readonly(innerType) {
3195
3865
  const ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
3196
3866
  $ZodCustom.init(inst, def);
3197
3867
  ZodType.init(inst, def);
3868
+ inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
3198
3869
  });
3199
3870
  function refine(fn, _params = {}) {
3200
3871
  return _refine(ZodCustom, fn, _params);
@@ -3284,6 +3955,34 @@ const GetAssetsResultSchema = object({
3284
3955
  missing: array(string().min(1))
3285
3956
  });
3286
3957
 
3958
+ //#endregion
3959
+ //#region src/asset-utils.ts
3960
+ const HASH_FILENAME_PATTERN = new RegExp(`^([a-f0-9]{${MCP_HASH_HEX_LENGTH}})(?:\\.[a-z0-9]+)?$`, "i");
3961
+ const MIME_EXTENSION_OVERRIDES = new Map([["image/jpeg", "jpg"]]);
3962
+ function normalizeMimeType(mimeType) {
3963
+ if (!mimeType) return "application/octet-stream";
3964
+ const [normalized] = mimeType.split(";", 1);
3965
+ return (normalized || "application/octet-stream").trim().toLowerCase();
3966
+ }
3967
+ function getImageExtension(mimeType) {
3968
+ const normalized = normalizeMimeType(mimeType);
3969
+ if (!normalized.startsWith("image/")) return "";
3970
+ const override = MIME_EXTENSION_OVERRIDES.get(normalized);
3971
+ if (override) return `.${override}`;
3972
+ const subtype = normalized.slice(6);
3973
+ if (!subtype) return "";
3974
+ const ext = subtype.split("+", 1)[0] || subtype;
3975
+ return ext ? `.${ext}` : "";
3976
+ }
3977
+ function buildAssetFilename(hash, mimeType) {
3978
+ const ext = getImageExtension(mimeType);
3979
+ return ext ? `${hash}${ext}` : hash;
3980
+ }
3981
+ function getHashFromAssetFilename(filename) {
3982
+ const match = HASH_FILENAME_PATTERN.exec(filename);
3983
+ return match ? match[1] : null;
3984
+ }
3985
+
3287
3986
  //#endregion
3288
3987
  //#region src/config.ts
3289
3988
  function parsePositiveInt(envValue, fallback) {
@@ -3381,7 +4080,12 @@ function createAssetHttpServer(store) {
3381
4080
  sendError(res, 404, "Not Found");
3382
4081
  return;
3383
4082
  }
3384
- const hash = segments[1];
4083
+ const filename = segments[1];
4084
+ const hash = getHashFromAssetFilename(filename);
4085
+ if (!hash) {
4086
+ sendError(res, 404, "Not Found");
4087
+ return;
4088
+ }
3385
4089
  if (req.method === "POST") {
3386
4090
  handleUpload(req, res, hash);
3387
4091
  return;
@@ -3438,30 +4142,41 @@ function createAssetHttpServer(store) {
3438
4142
  sendError(res, 400, "Invalid Hash Format");
3439
4143
  return;
3440
4144
  }
3441
- const mimeType = req.headers["content-type"] || "application/octet-stream";
3442
- const filePath = join(ASSET_DIR, hash);
4145
+ const contentTypeHeader = req.headers["content-type"];
4146
+ const mimeType = normalizeMimeType(Array.isArray(contentTypeHeader) ? contentTypeHeader[0] : contentTypeHeader);
4147
+ const filePath = join(ASSET_DIR, buildAssetFilename(hash, mimeType));
3443
4148
  const width = parseInt(req.headers["x-asset-width"], 10);
3444
4149
  const height = parseInt(req.headers["x-asset-height"], 10);
3445
4150
  const metadata = !isNaN(width) && !isNaN(height) && width > 0 && height > 0 ? {
3446
4151
  width,
3447
4152
  height
3448
4153
  } : void 0;
3449
- if (store.has(hash) && existsSync(filePath)) {
3450
- req.resume();
3451
- const existing = store.get(hash);
3452
- let changed = false;
3453
- if (metadata) {
3454
- existing.metadata = metadata;
3455
- changed = true;
4154
+ const existing = store.get(hash);
4155
+ if (existing) {
4156
+ let existingPath = existing.filePath;
4157
+ if (!existsSync(existingPath) && existsSync(filePath)) {
4158
+ existing.filePath = filePath;
4159
+ existingPath = filePath;
3456
4160
  }
3457
- if (existing.mimeType !== mimeType) {
3458
- existing.mimeType = mimeType;
3459
- changed = true;
4161
+ if (existsSync(existingPath)) {
4162
+ if (existingPath !== filePath) try {
4163
+ renameSync(existingPath, filePath);
4164
+ existing.filePath = filePath;
4165
+ existingPath = filePath;
4166
+ } catch (error) {
4167
+ log.warn({
4168
+ error,
4169
+ hash
4170
+ }, "Failed to rename existing asset to include extension.");
4171
+ }
4172
+ req.resume();
4173
+ if (metadata) existing.metadata = metadata;
4174
+ if (existing.mimeType !== mimeType) existing.mimeType = mimeType;
4175
+ existing.lastAccess = Date.now();
4176
+ store.upsert(existing);
4177
+ sendOk(res, 200, "Asset Already Exists");
4178
+ return;
3460
4179
  }
3461
- if (changed) store.upsert(existing);
3462
- store.touch(hash);
3463
- sendOk(res, 200, "Asset Already Exists");
3464
- return;
3465
4180
  }
3466
4181
  const tmpPath = `${filePath}.tmp.${nanoid()}`;
3467
4182
  const writeStream = createWriteStream(tmpPath);
@@ -3672,13 +4387,14 @@ function createAssetStore(options = {}) {
3672
4387
  }
3673
4388
  continue;
3674
4389
  }
3675
- if (!MCP_HASH_PATTERN.test(file)) continue;
3676
- if (!records.has(file)) {
4390
+ const hash = getHashFromAssetFilename(file);
4391
+ if (!hash) continue;
4392
+ if (!records.has(hash)) {
3677
4393
  const filePath = join(ASSET_DIR, file);
3678
4394
  try {
3679
4395
  const stat = statSync(filePath);
3680
- records.set(file, {
3681
- hash: file,
4396
+ records.set(hash, {
4397
+ hash,
3682
4398
  filePath,
3683
4399
  mimeType: "application/octet-stream",
3684
4400
  size: stat.size,
@@ -3686,7 +4402,7 @@ function createAssetStore(options = {}) {
3686
4402
  lastAccess: stat.atimeMs
3687
4403
  });
3688
4404
  changed = true;
3689
- log.info({ hash: file }, "Recovered orphan asset file.");
4405
+ log.info({ hash }, "Recovered orphan asset file.");
3690
4406
  } catch (e) {
3691
4407
  log.warn({
3692
4408
  error: e,
@@ -4033,9 +4749,10 @@ function formatAssetResourceName(hash) {
4033
4749
  return `asset:${hash.slice(0, 8)}`;
4034
4750
  }
4035
4751
  function buildAssetDescriptor(record) {
4752
+ const filename = buildAssetFilename(record.hash, record.mimeType);
4036
4753
  return {
4037
4754
  hash: record.hash,
4038
- url: `${assetHttpServer.getBaseUrl()}/assets/${record.hash}`,
4755
+ url: `${assetHttpServer.getBaseUrl()}/assets/${filename}`,
4039
4756
  mimeType: record.mimeType,
4040
4757
  size: record.size,
4041
4758
  resourceUri: buildAssetResourceUri(record.hash),